shv1

package
v0.0.0-...-e6c2143 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 12, 2023 License: GPL-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// SockUnkonw 未知socket类型
	SockUnkonw = iota
	// SockTml 终端socket类型
	SockTml
	// SockData 数据层socket类型
	SockData
	// SockClient 客户端socket类型
	SockClient
	// SockSdcmp 串口软件socket类型
	SockSdcmp
	// SockFwdcs 前端管理socket类型
	SockFwdcs
	// SockUpgrade 升级程序socket类型
	SockUpgrade
	// SockIisi 接口socket类型
	SockIisi
	// SockVb6 VB6 socket类型
	SockVb6
	// SockUDP UDP socket类型
	SockUDP
)
View Source
const (
	// SendLevelNormal 常规发送
	SendLevelNormal = iota
	// SendLevelHigh 插队发送
	SendLevelHigh
)
View Source
const (
	// DataTypeUnknow 未知数据类型
	DataTypeUnknow = iota
	// DataTypeBytes 字节数据类型
	DataTypeBytes
	// DataTypeString 字符串数据类型
	DataTypeString
	// DataTypeBase64 base64码数据类型
	DataTypeBase64
)
View Source
const (
	// JobSend 普通数据转发任务
	JobSend = iota
	// JobDo 执行任务
	JobDo
)
View Source
const (
	// TraUnknow 未知传输方式
	TraUnknow = iota
	// TraDirect 直接传输
	TraDirect
	// Tra485 通过设备485传输
	Tra485
)

Variables

This section is empty.

Functions

func MsgFromBytes

func MsgFromBytes(b []byte, pb proto.Message) proto.Message

MsgFromBytes decode protomsg Args:

b:pb2序列化数据
pb: proto结构体

Types

type DataProcessor

type DataProcessor struct {
	// 日志
	Logger logger.Logger
	// Verbose 其他信息
	Verbose *verboseInfo
	// RemoteIP 远端ip
	RemoteIP string
	// imei
	Imei string
	// AreaCode 区域码
	AreaCode string
	// PhyID
	PhyID int64
	// Version 协议版本,1,2
	Version int
	// LocalPort 本地监听端口
	LocalPort int
	// ec1
	Ec1 byte
	// ec2
	Ec2 byte
}

DataProcessor 数据处理

func NewDP

func NewDP() *DataProcessor

NewDP 新的dp处理器

func (*DataProcessor) BuildCommand

func (dp *DataProcessor) BuildCommand(data []byte, addr int64, prm, afn, con, seq int32) []byte

BuildCommand 创建命令

addr: 地址
prm: 启动标志位0-应答,1-主动下行
crypt: 是否加密0 为不加密(身份认∕否认(证及密钥协商用到),调整1 代表明文加 MAC,2 代表密文加 MAC,3 密码信封(证书方式)
ver: 版本,1
afn: 应用层功能码
con: 是否需要设备应答0-不需要,1-需要
seq: 序号,中间层提供

func (*DataProcessor) ParseCtl

func (dp *DataProcessor) ParseCtl(b *[]byte) (lstf []*v6.Fwd)

ParseCtl 解析下行

func (*DataProcessor) ParseTml

func (dp *DataProcessor) ParseTml(d []byte) (r *v6.Rtb)

ParseTml 解析上海路灯协议

func (*DataProcessor) Reset

func (dp *DataProcessor) Reset()

Reset 复位

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL