protocol

package
v0.0.0-...-0f5426d Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2021 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// 标志位
	PrefixID = byte(0x7e)

	// 转义符
	EscapeByte = byte(0x7d)

	// 0x7d < ———— > 0x7d 后紧跟一个0x01
	EscapeByteSufix1 = byte(0x01)

	// 0x7e < ———— > 0x7d 后紧跟一个0x02
	EscapeByteSufix2 = byte(0x02)

	// 消息头大小
	MessageHeaderSize = 12
)
View Source
const (
	// 成功/确认
	T808_0x8001ResultSuccess = 0
	// 失败
	T808_0x8001ResultFail = 1
	// 消息有误
	T808_0x8001ResultBad = 2
	// 不支持
	T808_0x8001ResultUnsupported = 3
	// 报警处理确认
	T808_0x8001ResultAlarmConfirm = 4
)
View Source
const (

	// 北纬
	NorthLatitudeType = 0
	// 南纬
	SouthLatitudeType = 1
)
View Source
const (

	// 东经
	EastLongitudeType = 0
	// 西经
	WestLongitudeType = 1
)
View Source
const (
	// 成功
	T808_0x8100_ResultSuccess = 0
	// 车辆已被注册
	T808_0x8100_ResultCarRegistered = 1
	// 数据库中无该车辆
	T808_0x8100_ResultCarNotFound = 2
	// 终端已被注册
	T808_0x8100_ResultTerminalRegistered = 3
	// 数据库中无该终端
	T808_0x8100_ResultTerminalNotFound = 4
)

Variables

View Source
var (
	// 消息体过长
	ErrBodyTooLong = errors.New("too long message body")
	// 无效消息体
	ErrInvalidBody = errors.New("invalid message body")
	// 无效消息头
	ErrInvalidHeader = errors.New("invalid message header")
	// 无效消息格式
	ErrInvalidMessage = errors.New("invalid message format")
	// 无效消息校验和
	ErrInvalidCheckSum = errors.New("invalid message check sum")
	// 方法尚未实现
	ErrMethodNotImplemented = errors.New("method not implemented")
	// 消息类型未注册
	ErrMessageNotRegistered = errors.New("message not registered")
	// 消息解码错误
	ErrEntityDecode = errors.New("entity decode error")
	// 附加信息长度错误
	ErrInvalidExtraLength = errors.New("invalid extra length")
)

Functions

func DecryptOAEP

func DecryptOAEP(hash hash.Hash, priv *rsa.PrivateKey, ciphertext []byte, label []byte) ([]byte, error)

使用RSA-OAEP解密

func EncryptOAEP

func EncryptOAEP(hash hash.Hash, pub *rsa.PublicKey, msg []byte, label []byte) ([]byte, error)

使用RSA-OAEP加密

func GetBitByte

func GetBitByte(value byte, offset int) bool

func GetBitUint16

func GetBitUint16(value uint16, offset int) bool

func GetBitUint32

func GetBitUint32(value uint32, offset int) bool

func Register

func Register(typ uint16, creator func() Entity)

类型注册

func SetBitByte

func SetBitByte(value *byte, offset int, set bool)

func SetBitUint16

func SetBitUint16(value *uint16, offset int, set bool)

func SetBitUint32

func SetBitUint32(value *uint32, offset int, set bool)

Types

type AreaAction

type AreaAction byte

区域动作

var (
	AreaActionUpdate AreaAction = 0
	AreaActionAdd    AreaAction = 1
	AreaActionEdit   AreaAction = 2
)

type AreaAttribute

type AreaAttribute uint16

区域属性

func (AreaAttribute) GetLatitudeType

func (attr AreaAttribute) GetLatitudeType() LatitudeType

获取纬度类型

func (AreaAttribute) GetLongitudeType

func (attr AreaAttribute) GetLongitudeType() LongitudeType

获取经度类型

func (*AreaAttribute) SetEnterAlarm

func (attr *AreaAttribute) SetEnterAlarm(b bool)

设置进入报警平台

func (*AreaAttribute) SetExitAlarm

func (attr *AreaAttribute) SetExitAlarm(b bool)

设置离开报警平台

func (*AreaAttribute) SetSouthLatitude

func (attr *AreaAttribute) SetSouthLatitude(b bool)

设置南纬

func (*AreaAttribute) SetWestLongitude

func (attr *AreaAttribute) SetWestLongitude(b bool)

设置西经

type CircleArea

type CircleArea struct {
	// 区域ID
	ID uint32
	// 区域属性
	Attribute AreaAttribute
	// 中心点纬度
	Lat decimal.Decimal
	// 中心点经度
	Lng decimal.Decimal
	// 半径
	Radius uint32
	// 起始时间
	StartTime time.Time
	// 结束时间
	EndTime time.Time
	// 最高速度
	MaxSpeed uint16
	// 超速持续时间
	Duration byte
}

圆形区域

type Entity

type Entity interface {
	MsgID() MsgID
	Encode() ([]byte, error)
	Decode([]byte) (int, error)
}

消息实体

type EntityPacket

type EntityPacket interface {
	Entity
	GetTag() uint32
	GetReader() io.Reader
	SetReader(io.Reader)
	DecodePacket([]byte) error
}

可分包实体

type Header struct {
	MsgID       MsgID
	Property    Property
	IccID       uint64
	MsgSerialNo uint16
	Packet      *Packet
}

消息头

func (*Header) Decode

func (header *Header) Decode(data []byte) error

协议解码

func (*Header) Encode

func (header *Header) Encode() ([]byte, error)

协议编码

type LatitudeType

type LatitudeType int

纬度类型

type LongitudeType

type LongitudeType int

经度类型

type Message

type Message struct {
	Header Header
	Body   Entity
}

消息包

func (*Message) Decode

func (message *Message) Decode(data []byte, key ...*rsa.PrivateKey) error

协议解码

func (*Message) Encode

func (message *Message) Encode(key ...*rsa.PublicKey) ([]byte, error)

协议编码

type MsgID

type MsgID uint16

消息ID枚举

const (
	// 终端应答
	MsgT808_0x0001 MsgID = 0x0001
	// 终端心跳
	MsgT808_0x0002 MsgID = 0x0002
	// 终端注销
	MsgT808_0x0003 MsgID = 0x0003
	// 终端注册
	MsgT808_0x0100 MsgID = 0x0100
	// 终端鉴权
	MsgT808_0x0102 MsgID = 0x0102
	// 查询终端参数应答
	MsgT808_0x0104 MsgID = 0x0104
	// 查询终端属性应答
	MsgT808_0x0107 MsgID = 0x0107
	// 终端升级结果通知
	MsgT808_0x0108 MsgID = 0x0108
	// 汇报位置
	MsgT808_0x0200 MsgID = 0x0200
	// 位置信息查询应答
	MsgT808_0x0201 MsgID = 0x0201
	// 事件报告
	MsgT808_0x0301 MsgID = 0x0301
	// 提问答案
	MsgT808_0x0302 MsgID = 0x0302
	// 信息点播/取消
	MsgT808_0x0303 MsgID = 0x0303
	// 车辆控制
	MsgT808_0x0500 MsgID = 0x0500
	// 行驶记录数据上传
	MsgT808_0x0700 MsgID = 0x0700
	// 电子运单上报
	MsgT808_0x0701 MsgID = 0x0701
	// 驾驶员身份信息采集上报
	MsgT808_0x0702 MsgID = 0x0702
	// 定位数据批量上传
	MsgT808_0x0704 MsgID = 0x0704
	// CAN总线数据上传
	MsgT808_0x0705 MsgID = 0x0705
	// 多媒体事件信息上传
	MsgT808_0x0800 MsgID = 0x0800
	// 多媒体数据上传
	MsgT808_0x0801 MsgID = 0x0801
	// 存储多媒体数据检索应答
	MsgT808_0x0802 MsgID = 0x0802
	// 摄像头立即拍摄命令应答
	MsgT808_0x0805 MsgID = 0x0805
	// 平台通用应答
	MsgT808_0x8001 MsgID = 0x8001
	// 补传分包请求
	MsgT808_0x8003 MsgID = 0x8003
	// 终端注册应答
	MsgT808_0x8100 MsgID = 0x8100
	// 设置终端参数
	MsgT808_0x8103 MsgID = 0x8103
	// 查询终端参数
	MsgT808_0x8104 MsgID = 0x8104
	// 终端控制
	MsgT808_0x8105 MsgID = 0x8105
	// 查询指定参数
	MsgT808_0x8106 MsgID = 0x8106
	// 查询终端属性
	MsgT808_0x8107 MsgID = 0x8107
	// 下发终端升级包
	MsgT808_0x8108 MsgID = 0x8108
	// 查询车辆位置
	MsgT808_0x8201 MsgID = 0x8201
	// 临时位置跟踪控制
	MsgT808_0x8202 MsgID = 0x8202
	// 人工确认报警消息
	MsgT808_0x8203 MsgID = 0x8203
	// 文本信息下发
	MsgT808_0x8300 MsgID = 0x8300
	// 事件设置
	MsgT808_0x8301 MsgID = 0x8301
	// 提问下发
	MsgT808_0x8302 MsgID = 0x8302
	// 位置点播菜单设置
	MsgT808_0x8303 MsgID = 0x8303
	// 信息服务
	MsgT808_0x8304 MsgID = 0x8304
	// 电话回拨
	MsgT808_0x8400 MsgID = 0x8400
	// 设置电话本
	MsgT808_0x8401 MsgID = 0x8401
	// 车门控制
	MsgT808_0x8500 MsgID = 0x8500
	// 设置圆形区域
	MsgT808_0x8600 MsgID = 0x8600
	// 删除圆形区域
	MsgT808_0x8601 MsgID = 0x8601
	// 设置矩形区域
	MsgT808_0x8602 MsgID = 0x8602
	// 删除矩形区域
	MsgT808_0x8603 MsgID = 0x8603
	// 设置多边形区域
	MsgT808_0x8604 MsgID = 0x8604
	// 删除多边形区域
	MsgT808_0x8605 MsgID = 0x8605
	// 设置路线
	MsgT808_0x8606 MsgID = 0x8606
	// 删除路线
	MsgT808_0x8607 MsgID = 0x8607
	// 行驶记录数据采集命令
	MsgT808_0x8700 MsgID = 0x8700
	// 行驶记录参数下传命令
	MsgT808_0x8701 MsgID = 0x8701
	// 上报驾驶员身份信息请求
	MsgT808_0x8702 MsgID = 0x8702
	// 多媒体数据上传应答
	MsgT808_0x8800 MsgID = 0x8800
	// 摄像头立即拍摄命令
	MsgT808_0x8801 MsgID = 0x8801
	// 存储多媒体数据检索
	MsgT808_0x8802 MsgID = 0x8802
	// 存储多媒体数据上传命令
	MsgT808_0x8803 MsgID = 0x8803
	// 录音开始命令
	MsgT808_0x8804 MsgID = 0x8804
	// 单条存储多媒体数据检索上传命令
	MsgT808_0x8805 MsgID = 0x8805
	// 数据下行透传
	MsgT808_0x8900 MsgID = 0x8900
	// 数据上行透传
	MsgT808_0x0900 MsgID = 0x0900
	// 数据压缩上报
	MsgT808_0x0901 MsgID = 0x0901
	// 终端 RSA公钥
	MsgT808_0x0A00 MsgID = 0x0a00
	// 平台 RSA公钥
	MsgT808_0x8A00 MsgID = 0x8a00
)

type Packet

type Packet struct {
	Sum uint16
	Seq uint16
}

封包信息

type Param

type Param struct {
	// contains filtered or unexported fields
}

终端参数

func (*Param) GetByte

func (param *Param) GetByte() (byte, error)

读取Byte

func (*Param) GetBytes

func (param *Param) GetBytes() ([]byte, error)

读取Bytes

func (*Param) GetString

func (param *Param) GetString() (string, error)

读取字符串

func (*Param) GetUint16

func (param *Param) GetUint16() (uint16, error)

读取Uint16

func (*Param) GetUint32

func (param *Param) GetUint32() (uint32, error)

读取Uint32

func (*Param) ID

func (param *Param) ID() uint32

参数ID

func (*Param) SetByte

func (param *Param) SetByte(id uint32, b byte) *Param

设为Byte

func (*Param) SetBytes

func (param *Param) SetBytes(id uint32, b []byte) *Param

设为Bytes

func (*Param) SetString

func (param *Param) SetString(id uint32, s string) *Param

设为字符串

func (*Param) SetUint16

func (param *Param) SetUint16(id uint32, n uint16) *Param

设为Uint16

func (*Param) SetUint32

func (param *Param) SetUint32(id uint32, n uint32) *Param

设为Uint32

type Property

type Property uint16

消息体属性

func (*Property) GetBodySize

func (property *Property) GetBodySize() uint16

获取消息体长度

func (Property) IsEnableEncrypt

func (property Property) IsEnableEncrypt() bool

是否加密

func (Property) IsEnablePacket

func (property Property) IsEnablePacket() bool

是否分包

func (*Property) SetBodySize

func (property *Property) SetBodySize(size uint16) error

设置消息体长度

type Reader

type Reader struct {
	// contains filtered or unexported fields
}

func NewReader

func NewReader(data []byte) Reader

func (*Reader) Len

func (reader *Reader) Len() int

func (*Reader) Read

func (reader *Reader) Read(size ...int) ([]byte, error)

func (*Reader) ReadBcdTime

func (reader *Reader) ReadBcdTime() (time.Time, error)

func (*Reader) ReadByte

func (reader *Reader) ReadByte() (byte, error)

func (*Reader) ReadString

func (reader *Reader) ReadString(size ...int) (string, error)

func (*Reader) ReadUint16

func (reader *Reader) ReadUint16() (uint16, error)

func (*Reader) ReadUint32

func (reader *Reader) ReadUint32() (uint32, error)

type RectArea

type RectArea struct {
	// 区域ID
	ID uint32
	// 区域属性
	Attribute AreaAttribute
	// 左上点纬度
	LeftTopLat decimal.Decimal
	// 左上点经度
	LeftTopLon decimal.Decimal
	// 右下点纬度
	RightBottomLat decimal.Decimal
	// 右下点经度
	RightBottomLon decimal.Decimal
	// 起始时间
	StartTime time.Time
	// 结束时间
	EndTime time.Time
	// 最高速度
	MaxSpeed uint16
	// 超速持续时间
	Duration byte
}

矩形区域

type Result

type Result byte

应答结果

type T808_0x0001

type T808_0x0001 struct {
	// 应答流水号
	ReplyMsgSerialNo uint16
	// 应答 ID
	ReplyMsgID uint16
	// 结果
	Result Result
}

终端应答

func (*T808_0x0001) Decode

func (entity *T808_0x0001) Decode(data []byte) (int, error)

func (*T808_0x0001) Encode

func (entity *T808_0x0001) Encode() ([]byte, error)

func (*T808_0x0001) MsgID

func (entity *T808_0x0001) MsgID() MsgID

type T808_0x0002

type T808_0x0002 struct {
}

终端心跳

func (*T808_0x0002) Decode

func (entity *T808_0x0002) Decode(data []byte) (int, error)

func (*T808_0x0002) Encode

func (entity *T808_0x0002) Encode() ([]byte, error)

func (*T808_0x0002) MsgID

func (entity *T808_0x0002) MsgID() MsgID

type T808_0x0003

type T808_0x0003 struct {
}

终端注销

func (*T808_0x0003) Decode

func (entity *T808_0x0003) Decode(data []byte) (int, error)

func (*T808_0x0003) Encode

func (entity *T808_0x0003) Encode() ([]byte, error)

func (*T808_0x0003) MsgID

func (entity *T808_0x0003) MsgID() MsgID

type T808_0x0100

type T808_0x0100 struct {
	// 省份
	ProvinceID uint16
	// 城市
	CityID uint16
	// 制造商
	ManufactureID string
	// 终端型号
	Model string
	// 终端ID
	TerminalID string
	// 车牌颜色
	PlateColor byte
	// 车辆标识
	LicenseNo string
}

终端注册

func (*T808_0x0100) Decode

func (entity *T808_0x0100) Decode(data []byte) (int, error)

func (*T808_0x0100) Encode

func (entity *T808_0x0100) Encode() ([]byte, error)

func (*T808_0x0100) MsgID

func (entity *T808_0x0100) MsgID() MsgID

type T808_0x0102

type T808_0x0102 struct {
	// 鉴权码
	AuthKey string
}

终端鉴权

func (*T808_0x0102) Decode

func (entity *T808_0x0102) Decode(data []byte) (int, error)

func (*T808_0x0102) Encode

func (entity *T808_0x0102) Encode() ([]byte, error)

func (*T808_0x0102) MsgID

func (entity *T808_0x0102) MsgID() MsgID

type T808_0x0104

type T808_0x0104 struct {
	// 应答流水号
	ReplyMsgSerialNo uint16
	// 参数项列表
	Params []*Param
}

查询终端参数应答

func (*T808_0x0104) Decode

func (entity *T808_0x0104) Decode(data []byte) (int, error)

func (*T808_0x0104) Encode

func (entity *T808_0x0104) Encode() ([]byte, error)

func (*T808_0x0104) MsgID

func (entity *T808_0x0104) MsgID() MsgID

type T808_0x0107

type T808_0x0107 struct {
	// 终端类型
	// bit0 ,0:不适用客运车辆, 1:适用客运车辆;
	// bit1 ,0:不适用危险品车辆, 1:适用危险品车辆;
	// bit2 ,0:不适用普通货运车辆, 1:适用普通货运车辆;
	// bit3 ,0:不适用出租车辆, 1:适用出租车辆;
	// bit6 ,0:不支持硬盘录像, 1:支持硬盘录像;
	// bit7 ,0:一体机, 1:分体机。
	TerminalType uint16
	// 制造商
	ManufactureID string
	// 终端型号
	Model string
	// 终端ID
	TerminalID string
	// SIM卡号
	Sim string
	// 终端硬件版本
	HardwareVersion string
	// 终端固件版本号
	SoftwareVersion string
	// GNSS模块属性
	GNSSProperty byte
	// 通信模块属性
	COMMProperty byte
}

查询终端属性应答

func (*T808_0x0107) Decode

func (entity *T808_0x0107) Decode(data []byte) (int, error)

func (*T808_0x0107) Encode

func (entity *T808_0x0107) Encode() ([]byte, error)

func (*T808_0x0107) MsgID

func (entity *T808_0x0107) MsgID() MsgID

type T808_0x0108

type T808_0x0108 struct {
	// 升级类型
	// 0:终端, 12:道路运输证 IC 卡读卡器, 52:北斗卫星定位模块
	Type byte
	// 升级结果
	// 0:成功, 1:失败, 2:取消
	Result byte
}

终端升级结果通知

func (*T808_0x0108) Decode

func (entity *T808_0x0108) Decode(data []byte) (int, error)

func (*T808_0x0108) Encode

func (entity *T808_0x0108) Encode() ([]byte, error)

func (*T808_0x0108) MsgID

func (entity *T808_0x0108) MsgID() MsgID

type T808_0x0200

type T808_0x0200 struct {
	// 警告
	Alarm uint32
	// 状态
	Status T808_0x0200_Status
	// 纬度
	Lat decimal.Decimal
	// 经度
	Lng decimal.Decimal
	// 海拔高度
	// 单位:米
	Altitude uint16
	// 速度
	// 单位:1/10km/h
	Speed uint16
	// 方向
	// 0-359,正北为 0,顺时针
	Direction uint16
	// 时间
	Time time.Time
	// 附加信息
	Extras []extra.Entity
}

汇报位置

func (*T808_0x0200) Decode

func (entity *T808_0x0200) Decode(data []byte) (int, error)

func (*T808_0x0200) Encode

func (entity *T808_0x0200) Encode() ([]byte, error)

func (*T808_0x0200) MsgID

func (entity *T808_0x0200) MsgID() MsgID

type T808_0x0200_Status

type T808_0x0200_Status uint32

位置状态

func (T808_0x0200_Status) GetAccState

func (status T808_0x0200_Status) GetAccState() bool

获取Acc状态

func (T808_0x0200_Status) GetLatitudeType

func (status T808_0x0200_Status) GetLatitudeType() LatitudeType

获取纬度类型

func (T808_0x0200_Status) GetLongitudeType

func (status T808_0x0200_Status) GetLongitudeType() LongitudeType

获取经度类型

func (T808_0x0200_Status) Positioning

func (status T808_0x0200_Status) Positioning() bool

是否正在定位

func (*T808_0x0200_Status) SetSouthLatitude

func (status *T808_0x0200_Status) SetSouthLatitude(b bool)

设置南纬

func (*T808_0x0200_Status) SetWestLongitude

func (status *T808_0x0200_Status) SetWestLongitude(b bool)

设置西经

type T808_0x0201

type T808_0x0201 struct {
	// 应答流水号
	ReplyMsgSerialNo uint16
	// 位置信息汇报
	Result T808_0x0200
}

位置信息查询应答

func (*T808_0x0201) Decode

func (entity *T808_0x0201) Decode(data []byte) (int, error)

func (*T808_0x0201) Encode

func (entity *T808_0x0201) Encode() ([]byte, error)

func (*T808_0x0201) MsgID

func (entity *T808_0x0201) MsgID() MsgID

type T808_0x0301

type T808_0x0301 struct {
	// 事件 ID
	EventID byte
}

事件报告

func (*T808_0x0301) Decode

func (entity *T808_0x0301) Decode(data []byte) (int, error)

func (*T808_0x0301) Encode

func (entity *T808_0x0301) Encode() ([]byte, error)

func (*T808_0x0301) MsgID

func (entity *T808_0x0301) MsgID() MsgID

type T808_0x0302

type T808_0x0302 struct {
	// 应答流水号
	ReplyMsgSerialNo uint16
	// 答案 ID
	AnswerID byte
}

提问答案

func (*T808_0x0302) Decode

func (entity *T808_0x0302) Decode(data []byte) (int, error)

func (*T808_0x0302) Encode

func (entity *T808_0x0302) Encode() ([]byte, error)

func (*T808_0x0302) MsgID

func (entity *T808_0x0302) MsgID() MsgID

type T808_0x0303

type T808_0x0303 struct {
	// 信息类型
	Type byte
	// 点播/ 取消标志
	Flag T808_0x0303_Flag
}

信息点播/取消

func (*T808_0x0303) Decode

func (entity *T808_0x0303) Decode(data []byte) (int, error)

func (*T808_0x0303) Encode

func (entity *T808_0x0303) Encode() ([]byte, error)

func (*T808_0x0303) MsgID

func (entity *T808_0x0303) MsgID() MsgID

type T808_0x0303_Flag

type T808_0x0303_Flag byte

信息点播标志

var (
	// 点播
	T808_0x0303_FlagRequest T808_0x0303_Flag = 0
	// 取消
	T808_0x0303_FlagCancel T808_0x0303_Flag = 1
)

type T808_0x0500

type T808_0x0500 struct {
	// 应答流水号
	ReplyMsgSerialNo uint16
	// 位置信息汇报消息体
	Result T808_0x0200
}

车辆控制

func (*T808_0x0500) Decode

func (entity *T808_0x0500) Decode(data []byte) (int, error)

func (*T808_0x0500) Encode

func (entity *T808_0x0500) Encode() ([]byte, error)

func (*T808_0x0500) MsgID

func (entity *T808_0x0500) MsgID() MsgID

type T808_0x0700

type T808_0x0700 struct {
	// 应答流水号
	ReplyMsgSerialNo uint16
	// 命令字
	Cmd byte
	// 数据块
	Data []byte
}

行驶记录数据上传

func (*T808_0x0700) Decode

func (entity *T808_0x0700) Decode(data []byte) (int, error)

func (*T808_0x0700) Encode

func (entity *T808_0x0700) Encode() ([]byte, error)

func (*T808_0x0700) MsgID

func (entity *T808_0x0700) MsgID() MsgID

type T808_0x0701

type T808_0x0701 struct {
	// 电子运单长度
	Size uint32
	// 电子运单内容
	Content []byte
}

电子运单上报

func (*T808_0x0701) Decode

func (entity *T808_0x0701) Decode(data []byte) (int, error)

func (*T808_0x0701) Encode

func (entity *T808_0x0701) Encode() ([]byte, error)

func (*T808_0x0701) MsgID

func (entity *T808_0x0701) MsgID() MsgID

type T808_0x0702

type T808_0x0702 struct {
	// 状态
	// 0x01:从业资格证 IC 卡插入(驾驶员上班)
	// 0x02:从业资格证 IC 卡拔出(驾驶员下班)
	State byte
	// 时间
	Time time.Time
	// IC 卡读取结果
	// 0x00:IC 卡读卡成功
	//0x01:读卡失败,原因为卡片密钥认证未通过
	//0x02:读卡失败,原因为卡片已被锁定
	//0x03:读卡失败,原因为卡片被拔出
	//0x04:读卡失败,原因为数据校验错误
	//以下字段在 IC 卡读取结果等于 0x00 时才有效
	ICCardResult byte
	// 驾驶员姓名
	DriverName string
	// 从业资格证编码
	Number string
	// 发证机构名称
	CompanyName string
	// 证件有效期
	ExpiryDate time.Time
}

驾驶员身份信息采集上报

func (*T808_0x0702) Decode

func (entity *T808_0x0702) Decode(data []byte) (int, error)

func (*T808_0x0702) Encode

func (entity *T808_0x0702) Encode() ([]byte, error)

func (*T808_0x0702) MsgID

func (entity *T808_0x0702) MsgID() MsgID

type T808_0x0704

type T808_0x0704 struct {
	// 位置数据类型
	// 0:正常位置批量汇报, 1:盲区补报
	Type byte
	// 位置汇报数据项
	Items []T808_0x0200
}

定位数据批量上传

func (*T808_0x0704) Decode

func (entity *T808_0x0704) Decode(data []byte) (int, error)

func (*T808_0x0704) Encode

func (entity *T808_0x0704) Encode() ([]byte, error)

func (*T808_0x0704) MsgID

func (entity *T808_0x0704) MsgID() MsgID

type T808_0x0705

type T808_0x0705 struct {
	// CAN总线数据接收时间
	ReceiveTime time.Duration
	// CAN总线数据项
	Items []T808_0x0705_CAN
}

CAN总线数据上传

func (*T808_0x0705) Decode

func (entity *T808_0x0705) Decode(data []byte) (int, error)

func (*T808_0x0705) Encode

func (entity *T808_0x0705) Encode() ([]byte, error)

func (*T808_0x0705) MsgID

func (entity *T808_0x0705) MsgID() MsgID

type T808_0x0705_CAN

type T808_0x0705_CAN struct {
	// CAN ID
	// bit31 表示 CAN通道号, 0:CAN1,1:CAN2
	// bit30 表示帧类型, 0:标准帧, 1:扩展帧
	// bit29 表示数据采集方式, 0:原始数据, 1:采集区间的平均值
	// bit28-bit0 表示 CAN总线 ID
	ID [4]byte
	// CAN数据
	Data [8]byte
}

CAN总线数据项

type T808_0x0800

type T808_0x0800 struct {
	// 多媒体数据 ID
	MediaID uint32
	// 多媒体类型
	Type T808_0x0800_MediaType
	// 多媒体格式编码
	Coding T808_0x0800_MediaCoding
	// 事件项编码
	Event byte
	// 通道 ID
	ChannelID byte
}

多媒体事件信息上传

func (*T808_0x0800) Decode

func (entity *T808_0x0800) Decode(data []byte) (int, error)

func (*T808_0x0800) Encode

func (entity *T808_0x0800) Encode() ([]byte, error)

func (*T808_0x0800) MsgID

func (entity *T808_0x0800) MsgID() MsgID

type T808_0x0800_MediaCoding

type T808_0x0800_MediaCoding byte

多媒体编码

var (
	T808_0x0800_MediaCodingJPEG T808_0x0800_MediaCoding = 0
	T808_0x0800_MediaCodingTIF  T808_0x0800_MediaCoding = 1
	T808_0x0800_MediaCodingMP3  T808_0x0800_MediaCoding = 2
	T808_0x0800_MediaCodingWAV  T808_0x0800_MediaCoding = 3
	T808_0x0800_MediaCodingWMV  T808_0x0800_MediaCoding = 4
)

type T808_0x0800_MediaType

type T808_0x0800_MediaType byte

多媒体类型

var (
	T808_0x0800_MediaTypeImage T808_0x0800_MediaType = 0
	T808_0x0800_MediaTypeAudio T808_0x0800_MediaType = 1
	T808_0x0800_MediaTypeVideo T808_0x0800_MediaType = 2
)

type T808_0x0801

type T808_0x0801 struct {
	// 多媒体 ID
	MediaID uint32
	// 多媒体类型
	Type T808_0x0800_MediaType
	// 多媒体格式编码
	Coding T808_0x0800_MediaCoding
	// 事件项编码
	Event byte
	// 通道 ID
	ChannelID byte
	// 位置信息汇报
	Location T808_0x0200
	// 多媒体数据包
	Packet io.Reader
}

多媒体数据上传

func (*T808_0x0801) Decode

func (entity *T808_0x0801) Decode(data []byte) (int, error)

func (*T808_0x0801) DecodePacket

func (entity *T808_0x0801) DecodePacket(data []byte) error

func (*T808_0x0801) Encode

func (entity *T808_0x0801) Encode() ([]byte, error)

func (*T808_0x0801) GetReader

func (entity *T808_0x0801) GetReader() io.Reader

func (*T808_0x0801) GetTag

func (entity *T808_0x0801) GetTag() uint32

func (*T808_0x0801) MsgID

func (entity *T808_0x0801) MsgID() MsgID

func (*T808_0x0801) SetReader

func (entity *T808_0x0801) SetReader(reader io.Reader)

type T808_0x0802

type T808_0x0802 struct {
	// 应答流水号
	ReplyMsgSerialNo uint16
	// 检索项
	Items []T808_0x0802_Item
}

存储多媒体数据检索应答

func (*T808_0x0802) Decode

func (entity *T808_0x0802) Decode(data []byte) (int, error)

func (*T808_0x0802) Encode

func (entity *T808_0x0802) Encode() ([]byte, error)

func (*T808_0x0802) MsgID

func (entity *T808_0x0802) MsgID() MsgID

type T808_0x0802_Item

type T808_0x0802_Item struct {
	// 多媒体 ID
	MediaID uint32
	// 多媒体类型
	Type T808_0x0800_MediaType
	// 通道 ID
	ChannelID byte
	// 事件项编码
	// 0:平台下发指令; 1:定时动作; 2:抢劫报警触 发;3:碰撞侧翻报警触发;其他保留
	Event byte
	// 位置信息汇报
	Location T808_0x0200
}

多媒体检索项

type T808_0x0805

type T808_0x0805 struct {
	// 应答流水号
	ReplyMsgSerialNo uint16
	// 结果
	// 0:成功; 1:失败; 2:通道不支持。
	Result T808_0x0805_Result
	// 多媒体 ID 个数
	MediaIDs []uint32
}

摄像头立即拍摄命令应答

func (*T808_0x0805) Decode

func (entity *T808_0x0805) Decode(data []byte) (int, error)

func (*T808_0x0805) Encode

func (entity *T808_0x0805) Encode() ([]byte, error)

func (*T808_0x0805) MsgID

func (entity *T808_0x0805) MsgID() MsgID

type T808_0x0805_Result

type T808_0x0805_Result byte

处理结果

var (
	// 成功
	T808_0x0805_ResultSuccess T808_0x0805_Result = 0
	// 失败
	T808_0x0805_ResultFail T808_0x0805_Result = 1
	// 不支持
	T808_0x0805_ResultNotSupported T808_0x0805_Result = 2
)

type T808_0x0900

type T808_0x0900 struct {
	// 透传消息类型
	// GNSS模块详细定位数据 0x00 GNSS模块详细定位数据
	// 道路运输证 IC 卡信息 0x0B
	// 道路运输证 IC 卡信息上传消息为 64Byte,下传消息为24Byte。道路运输证 IC 卡认证透传超时时间为 30s。 超时后,不重发
	// 串口 1 透传 0x41 串口 1 透传消息
	// 串口 2 透传 0x42 串口 2 透传消息
	// 用户自定义透传 0xF0-0xFF 用户自定义透传消息
	Type byte
	// 透传消息内容
	Data []byte
}

数据上行透传

func (*T808_0x0900) Decode

func (entity *T808_0x0900) Decode(data []byte) (int, error)

func (*T808_0x0900) Encode

func (entity *T808_0x0900) Encode() ([]byte, error)

func (*T808_0x0900) MsgID

func (entity *T808_0x0900) MsgID() MsgID

type T808_0x0901

type T808_0x0901 struct {
	// 未压缩消息
	Uncompressed []byte
}

数据压缩上报

func (*T808_0x0901) Decode

func (entity *T808_0x0901) Decode(data []byte) (int, error)

func (*T808_0x0901) Encode

func (entity *T808_0x0901) Encode() ([]byte, error)

func (*T808_0x0901) MsgID

func (entity *T808_0x0901) MsgID() MsgID

type T808_0x0A00

type T808_0x0A00 struct {
	PublicKey *rsa.PublicKey
}

终端 RSA公钥

func (*T808_0x0A00) Decode

func (entity *T808_0x0A00) Decode(data []byte) (int, error)

func (*T808_0x0A00) Encode

func (entity *T808_0x0A00) Encode() ([]byte, error)

func (*T808_0x0A00) MsgID

func (entity *T808_0x0A00) MsgID() MsgID

type T808_0x8001

type T808_0x8001 struct {
	// 对应的终端消息的流水号
	ReplyMsgSerialNo uint16
	// 对应的终端消息的ID
	ReplyMsgID MsgID
	// 处理结果
	Result Result
}

平台通用应答

func (*T808_0x8001) Decode

func (entity *T808_0x8001) Decode(data []byte) (int, error)

func (*T808_0x8001) Encode

func (entity *T808_0x8001) Encode() ([]byte, error)

func (*T808_0x8001) MsgID

func (entity *T808_0x8001) MsgID() MsgID

type T808_0x8003

type T808_0x8003 struct {
	// 原始消息流水号
	MsgSerialNo uint16
	// 重传包 ID 列表
	PacketIDs []uint16
}

补传分包请求

func (*T808_0x8003) Decode

func (entity *T808_0x8003) Decode(data []byte) (int, error)

func (*T808_0x8003) Encode

func (entity *T808_0x8003) Encode() ([]byte, error)

func (*T808_0x8003) MsgID

func (entity *T808_0x8003) MsgID() MsgID

type T808_0x8100

type T808_0x8100 struct {
	// 应答流水号
	MsgSerialNo uint16
	// 结果
	Result T808_0x8100_Result
	// 鉴权码
	AuthKey string
}

终端应答

func (*T808_0x8100) Decode

func (entity *T808_0x8100) Decode(data []byte) (int, error)

func (*T808_0x8100) Encode

func (entity *T808_0x8100) Encode() ([]byte, error)

func (*T808_0x8100) MsgID

func (entity *T808_0x8100) MsgID() MsgID

type T808_0x8100_Result

type T808_0x8100_Result byte

终端应答结果

type T808_0x8103

type T808_0x8103 struct {
	// 参数项列表
	Params []*Param
}

设置终端参数

func (*T808_0x8103) Decode

func (entity *T808_0x8103) Decode(data []byte) (int, error)

func (*T808_0x8103) Encode

func (entity *T808_0x8103) Encode() ([]byte, error)

func (*T808_0x8103) MsgID

func (entity *T808_0x8103) MsgID() MsgID

type T808_0x8104

type T808_0x8104 struct {
}

查询终端参数

func (*T808_0x8104) Decode

func (entity *T808_0x8104) Decode(data []byte) (int, error)

func (*T808_0x8104) Encode

func (entity *T808_0x8104) Encode() ([]byte, error)

func (*T808_0x8104) MsgID

func (entity *T808_0x8104) MsgID() MsgID

type T808_0x8105

type T808_0x8105 struct {
	// 命令字
	Cmd T808_0x8105_Command
	// 命令参数
	Data string
}

终端控制

func (*T808_0x8105) Decode

func (entity *T808_0x8105) Decode(data []byte) (int, error)

func (*T808_0x8105) Encode

func (entity *T808_0x8105) Encode() ([]byte, error)

func (*T808_0x8105) MsgID

func (entity *T808_0x8105) MsgID() MsgID

type T808_0x8105_Command

type T808_0x8105_Command byte

终端控制命令

var (
	// 升级
	T808_0x8105_CommandUpgrade T808_0x8105_Command = 1
	// 设置服务器
	T808_0x8105_CommandHost T808_0x8105_Command = 2
	// 关机
	T808_0x8105_CommandShutdown T808_0x8105_Command = 3
	// 重置
	T808_0x8105_CommandReset T808_0x8105_Command = 4
	// 恢复出厂设置
	T808_0x8105_CommandFactoryReset T808_0x8105_Command = 5
	// 关闭无线网络
	T808_0x8105_CommandCloseNetwork T808_0x8105_Command = 6
	// 关闭所有网络
	T808_0x8105_CommandCloseAllNetwork T808_0x8105_Command = 7
)

type T808_0x8106

type T808_0x8106 struct {
	// 参数 ID 列表
	Params []uint32
}

查询终端参数

func (*T808_0x8106) Decode

func (entity *T808_0x8106) Decode(data []byte) (int, error)

func (*T808_0x8106) Encode

func (entity *T808_0x8106) Encode() ([]byte, error)

func (*T808_0x8106) MsgID

func (entity *T808_0x8106) MsgID() MsgID

type T808_0x8107

type T808_0x8107 struct {
}

查询终端参数

func (*T808_0x8107) Decode

func (entity *T808_0x8107) Decode(data []byte) (int, error)

func (*T808_0x8107) Encode

func (entity *T808_0x8107) Encode() ([]byte, error)

func (*T808_0x8107) MsgID

func (entity *T808_0x8107) MsgID() MsgID

type T808_0x8108

type T808_0x8108 struct {
	// 升级类型
	// 0:终端, 12:道路运输证 IC 卡读卡器, 52:北斗卫星定位模块
	Type byte
	// 制造商 ID
	ManufactureID string
	// 版本号
	Version string
	// 升级数据包长度
	Size uint32
	// 升级包数据
	Data []byte
}

下发终端升级包

func (*T808_0x8108) Decode

func (entity *T808_0x8108) Decode(data []byte) (int, error)

func (*T808_0x8108) Encode

func (entity *T808_0x8108) Encode() ([]byte, error)

func (*T808_0x8108) MsgID

func (entity *T808_0x8108) MsgID() MsgID

type T808_0x8201

type T808_0x8201 struct {
}

查询车辆位置

func (*T808_0x8201) Decode

func (entity *T808_0x8201) Decode(data []byte) (int, error)

func (*T808_0x8201) Encode

func (entity *T808_0x8201) Encode() ([]byte, error)

func (*T808_0x8201) MsgID

func (entity *T808_0x8201) MsgID() MsgID

type T808_0x8202

type T808_0x8202 struct {
	// 时间间隔
	// 单位为秒 (s),0 则停止跟踪。 停止跟踪无需带后继字段
	Interval uint16
	// 位置跟踪有效期
	// 单位为秒 (s),终端在接收到位置跟踪控制消息后,
	// 在有效期截止时间之前,依据消息中的时间间隔发
	// 送位置汇报
	Expire uint32
}

临时位置跟踪控制

func (*T808_0x8202) Decode

func (entity *T808_0x8202) Decode(data []byte) (int, error)

func (*T808_0x8202) Encode

func (entity *T808_0x8202) Encode() ([]byte, error)

func (*T808_0x8202) MsgID

func (entity *T808_0x8202) MsgID() MsgID

type T808_0x8203

type T808_0x8203 struct {
	// 报警消息流水号
	MsgSerialNo uint16
	// 人工确认报警类型
	Type uint32
}

人工确认报警消息

func (*T808_0x8203) Decode

func (entity *T808_0x8203) Decode(data []byte) (int, error)

func (*T808_0x8203) Encode

func (entity *T808_0x8203) Encode() ([]byte, error)

func (*T808_0x8203) MsgID

func (entity *T808_0x8203) MsgID() MsgID

type T808_0x8300

type T808_0x8300 struct {
	// 标志
	Flag byte
	// 文本信息
	Text string
}

文本信息下发

func (*T808_0x8300) Decode

func (entity *T808_0x8300) Decode(data []byte) (int, error)

func (*T808_0x8300) Encode

func (entity *T808_0x8300) Encode() ([]byte, error)

func (*T808_0x8300) MsgID

func (entity *T808_0x8300) MsgID() MsgID

type T808_0x8301

type T808_0x8301 struct {
	// 设置类型
	Type byte
	// 事件项列表
	Events []T808_0x8301_Event
}

事件设置

func (*T808_0x8301) Decode

func (entity *T808_0x8301) Decode(data []byte) (int, error)

func (*T808_0x8301) Encode

func (entity *T808_0x8301) Encode() ([]byte, error)

func (*T808_0x8301) MsgID

func (entity *T808_0x8301) MsgID() MsgID

type T808_0x8301_Event

type T808_0x8301_Event struct {
	// 事件 ID
	ID byte
	// 事件内容
	Content string
}

事件信息

type T808_0x8302

type T808_0x8302 struct {
	// 标志
	Flag byte
	// 问题
	Question string
	// 候选答案列表
	CandidateAnswers []T808_0x8302_Answer
}

提问下发

func (*T808_0x8302) Decode

func (entity *T808_0x8302) Decode(data []byte) (int, error)

func (*T808_0x8302) Encode

func (entity *T808_0x8302) Encode() ([]byte, error)

func (*T808_0x8302) MsgID

func (entity *T808_0x8302) MsgID() MsgID

type T808_0x8302_Answer

type T808_0x8302_Answer struct {
	// 答案 ID
	ID byte
	// 答案内容
	Content string
}

问题答案

type T808_0x8303

type T808_0x8303 struct {
	// 设置类型
	Type T808_0x8303_Type
	// 信息项列表
	Items []T808_0x8303_Item
}

位置点播菜单设置

func (*T808_0x8303) Decode

func (entity *T808_0x8303) Decode(data []byte) (int, error)

func (*T808_0x8303) Encode

func (entity *T808_0x8303) Encode() ([]byte, error)

func (*T808_0x8303) MsgID

func (entity *T808_0x8303) MsgID() MsgID

type T808_0x8303_Item

type T808_0x8303_Item struct {
	// 信息名称
	Name string
}

信息点播信息项

type T808_0x8303_Type

type T808_0x8303_Type byte

设置类型

var (
	// 删除所有
	T808_0x8303_TypeRemoveAll T808_0x8303_Type = 0
	// 更新
	T808_0x8303_TypeUpdate T808_0x8303_Type = 1
	// 追加
	T808_0x8303_TypeAppend T808_0x8303_Type = 2
	// 修改
	T808_0x8303_TypeModify T808_0x8303_Type = 3
)

type T808_0x8304

type T808_0x8304 struct {
	// 信息类型
	Type byte
	// 信息内容
	Content string
}

信息服务

func (*T808_0x8304) Decode

func (entity *T808_0x8304) Decode(data []byte) (int, error)

func (*T808_0x8304) Encode

func (entity *T808_0x8304) Encode() ([]byte, error)

func (*T808_0x8304) MsgID

func (entity *T808_0x8304) MsgID() MsgID

type T808_0x8400

type T808_0x8400 struct {
	// 标志
	Flag T808_0x8400_Flag
	// 电话号码
	Number string
}

电话回拨

func (*T808_0x8400) Decode

func (entity *T808_0x8400) Decode(data []byte) (int, error)

func (*T808_0x8400) Encode

func (entity *T808_0x8400) Encode() ([]byte, error)

func (*T808_0x8400) MsgID

func (entity *T808_0x8400) MsgID() MsgID

type T808_0x8400_Flag

type T808_0x8400_Flag byte

回拨标志

var (
	// 正常
	T808_0x8400_FlagNormal T808_0x8400_Flag = 0
	// 监听
	T808_0x8400_FlagMonitor T808_0x8400_Flag = 1
)

type T808_0x8401

type T808_0x8401 struct {
	// 设置类型
	Type T808_0x8401_Type
	// 联系人项
	Contacts []T808_0x8401_Contact
}

设置电话本

func (*T808_0x8401) Decode

func (entity *T808_0x8401) Decode(data []byte) (int, error)

func (*T808_0x8401) Encode

func (entity *T808_0x8401) Encode() ([]byte, error)

func (*T808_0x8401) MsgID

func (entity *T808_0x8401) MsgID() MsgID

type T808_0x8401_Contact

type T808_0x8401_Contact struct {
	// 标志
	Flag T808_0x8401_ContactFlag
	// 电话号码
	Number string
	// 联系人
	Contact string
}

电话本联系人

type T808_0x8401_ContactFlag

type T808_0x8401_ContactFlag byte

联系人标志

var (
	// 呼入
	T808_0x8401_ContactFlagIncomingCall T808_0x8401_ContactFlag = 1
	// 呼出
	T808_0x8401_ContactFlagOutgoingCall T808_0x8401_ContactFlag = 2
	// 呼入和呼出
	T808_0x8401_ContactFlagBoth T808_0x8401_ContactFlag = 3
)

type T808_0x8401_Type

type T808_0x8401_Type byte

设置类型

var (
	// 删除所有
	T808_0x8401_TypeRemoveAll T808_0x8401_Type = 0
	// 更新
	T808_0x8401_TypeUpdate T808_0x8401_Type = 1
	// 追加
	T808_0x8401_TypeAppend T808_0x8401_Type = 2
	// 修改
	T808_0x8401_TypeModify T808_0x8401_Type = 3
)

type T808_0x8500

type T808_0x8500 struct {
	// 控制标志
	Flag T808_0x8500_Flag
}

车门控制

func (*T808_0x8500) Decode

func (entity *T808_0x8500) Decode(data []byte) (int, error)

func (*T808_0x8500) Encode

func (entity *T808_0x8500) Encode() ([]byte, error)

func (*T808_0x8500) MsgID

func (entity *T808_0x8500) MsgID() MsgID

type T808_0x8500_Flag

type T808_0x8500_Flag byte

车门控制标志

func (*T808_0x8500_Flag) SetLock

func (flag *T808_0x8500_Flag) SetLock(b bool)

设置上锁

type T808_0x8600

type T808_0x8600 struct {
	// 设置属性
	Action AreaAction
	// 区域项
	Items []CircleArea
}

设置圆形区域

func (*T808_0x8600) Decode

func (entity *T808_0x8600) Decode(data []byte) (int, error)

func (*T808_0x8600) Encode

func (entity *T808_0x8600) Encode() ([]byte, error)

func (*T808_0x8600) MsgID

func (entity *T808_0x8600) MsgID() MsgID

type T808_0x8601

type T808_0x8601 struct {
	// 区域ID列表
	IDs []uint32
}

删除圆形区域

func (*T808_0x8601) Decode

func (entity *T808_0x8601) Decode(data []byte) (int, error)

func (*T808_0x8601) Encode

func (entity *T808_0x8601) Encode() ([]byte, error)

func (*T808_0x8601) MsgID

func (entity *T808_0x8601) MsgID() MsgID

type T808_0x8602

type T808_0x8602 struct {
	// 设置属性
	Action AreaAction
	// 区域项
	Items []RectArea
}

设置矩形区域

func (*T808_0x8602) Decode

func (entity *T808_0x8602) Decode(data []byte) (int, error)

func (*T808_0x8602) Encode

func (entity *T808_0x8602) Encode() ([]byte, error)

func (*T808_0x8602) MsgID

func (entity *T808_0x8602) MsgID() MsgID

type T808_0x8603

type T808_0x8603 struct {
	// 区域ID列表
	IDs []uint32
}

删除矩形区域

func (*T808_0x8603) Decode

func (entity *T808_0x8603) Decode(data []byte) (int, error)

func (*T808_0x8603) Encode

func (entity *T808_0x8603) Encode() ([]byte, error)

func (*T808_0x8603) MsgID

func (entity *T808_0x8603) MsgID() MsgID

type T808_0x8604

type T808_0x8604 struct {
	// 区域 ID
	ID uint32
	// 区域属性
	Attribute AreaAttribute
	// 起始时间
	StartTime time.Time
	// 结束时间
	EndTime time.Time
	// 最高速度
	MaxSpeed uint16
	// 超速持续时间
	Duration byte
	// 顶点项
	Vertexes []Vertex
}

设置多边形区域

func (*T808_0x8604) Decode

func (entity *T808_0x8604) Decode(data []byte) (int, error)

func (*T808_0x8604) Encode

func (entity *T808_0x8604) Encode() ([]byte, error)

func (*T808_0x8604) MsgID

func (entity *T808_0x8604) MsgID() MsgID

type T808_0x8605

type T808_0x8605 struct {
	// 区域ID列表
	IDs []uint32
}

删除多边形区域

func (*T808_0x8605) Decode

func (entity *T808_0x8605) Decode(data []byte) (int, error)

func (*T808_0x8605) Encode

func (entity *T808_0x8605) Encode() ([]byte, error)

func (*T808_0x8605) MsgID

func (entity *T808_0x8605) MsgID() MsgID

type T808_0x8606

type T808_0x8606 struct {
	// 路线 ID
	ID uint32
	// 路线属性
	Attribute uint16
	// 起始时间
	StartTime time.Time
	// 结束时间
	EndTime time.Time
	// 拐点项
	Points []T808_0x8606_Point
}

设置路线

func (*T808_0x8606) Decode

func (entity *T808_0x8606) Decode(data []byte) (int, error)

func (*T808_0x8606) Encode

func (entity *T808_0x8606) Encode() ([]byte, error)

func (*T808_0x8606) MsgID

func (entity *T808_0x8606) MsgID() MsgID

type T808_0x8606_Point

type T808_0x8606_Point struct {
	// 拐点 ID
	ID uint32
	// 路段 ID
	SectionID uint32
	// 拐点纬度
	Lat decimal.Decimal
	// 拐点经度
	Lng decimal.Decimal
	// 路段宽度
	Width byte
	// 路段属性
	Attribute T808_0x8606_SectionAttribute
	// 路段行驶过长阈值
	TimeTooLong *uint16
	// 路段行驶过短阈值
	TimeTooShort *uint16
	// 路段最高速度
	MaxSpeed *uint16
	// 路段超速持续时间
	OverSpeedDuration *byte
}

路线拐点

type T808_0x8606_SectionAttribute

type T808_0x8606_SectionAttribute byte

路段属性

func (T808_0x8606_SectionAttribute) GetLatitudeType

func (attr T808_0x8606_SectionAttribute) GetLatitudeType() LatitudeType

获取纬度类型

func (T808_0x8606_SectionAttribute) GetLongitudeType

func (attr T808_0x8606_SectionAttribute) GetLongitudeType() LongitudeType

获取经度类型

func (*T808_0x8606_SectionAttribute) HasSpeedLimit

func (attr *T808_0x8606_SectionAttribute) HasSpeedLimit() bool

是否限速

func (*T808_0x8606_SectionAttribute) HasTimeLimit

func (attr *T808_0x8606_SectionAttribute) HasTimeLimit() bool

是否限时

func (*T808_0x8606_SectionAttribute) SetSouthLatitude

func (attr *T808_0x8606_SectionAttribute) SetSouthLatitude(b bool)

设置南纬

func (*T808_0x8606_SectionAttribute) SetSpeedLimit

func (attr *T808_0x8606_SectionAttribute) SetSpeedLimit(b bool)

设置限速

func (*T808_0x8606_SectionAttribute) SetTimeLimit

func (attr *T808_0x8606_SectionAttribute) SetTimeLimit(b bool)

设置限时

func (*T808_0x8606_SectionAttribute) SetWestLongitude

func (attr *T808_0x8606_SectionAttribute) SetWestLongitude(b bool)

设置西经

type T808_0x8607

type T808_0x8607 struct {
	// 路线ID列表
	IDs []uint32
}

删除路线

func (*T808_0x8607) Decode

func (entity *T808_0x8607) Decode(data []byte) (int, error)

func (*T808_0x8607) Encode

func (entity *T808_0x8607) Encode() ([]byte, error)

func (*T808_0x8607) MsgID

func (entity *T808_0x8607) MsgID() MsgID

type T808_0x8700

type T808_0x8700 struct {
	// 命令字
	Cmd byte
	// 数据块
	Data []byte
}

行驶记录数据采集命令

func (*T808_0x8700) Decode

func (entity *T808_0x8700) Decode(data []byte) (int, error)

func (*T808_0x8700) Encode

func (entity *T808_0x8700) Encode() ([]byte, error)

func (*T808_0x8700) MsgID

func (entity *T808_0x8700) MsgID() MsgID

type T808_0x8701

type T808_0x8701 struct {
	// 命令字
	Cmd byte
	// 数据块
	Data []byte
}

行驶记录参数下传命令

func (*T808_0x8701) Decode

func (entity *T808_0x8701) Decode(data []byte) (int, error)

func (*T808_0x8701) Encode

func (entity *T808_0x8701) Encode() ([]byte, error)

func (*T808_0x8701) MsgID

func (entity *T808_0x8701) MsgID() MsgID

type T808_0x8702

type T808_0x8702 struct {
}

上报驾驶员身份信息请求

func (*T808_0x8702) Decode

func (entity *T808_0x8702) Decode(data []byte) (int, error)

func (*T808_0x8702) Encode

func (entity *T808_0x8702) Encode() ([]byte, error)

func (*T808_0x8702) MsgID

func (entity *T808_0x8702) MsgID() MsgID

type T808_0x8800

type T808_0x8800 struct {
	// 多媒体 ID
	MediaID uint32
	// 重传包 ID 列表
	RetryIDs []uint16
}

多媒体数据上传应答

func (*T808_0x8800) Decode

func (entity *T808_0x8800) Decode(data []byte) (int, error)

func (*T808_0x8800) Encode

func (entity *T808_0x8800) Encode() ([]byte, error)

func (*T808_0x8800) MsgID

func (entity *T808_0x8800) MsgID() MsgID

type T808_0x8801

type T808_0x8801 struct {
	// 通道 ID
	ChannelID byte
	// 拍摄命令
	// 0 表示停止拍摄; 0xFFFF 表示录像;其它表示拍照张数
	Cmd uint16
	// 拍照间隔/录像时间
	// 单位:秒,0表示按最小间隔拍照或一直录像
	Duration uint16
	// 保存标志
	Save T808_0x8801_SaveFlag
	// 分辨率
	Resolution T808_0x8801_Resolution
	// 图像/ 视频质量
	Quality byte
	// 亮度
	Lighting byte
	// 对比度
	Contrast byte
	// 饱和度
	Saturability byte
	// 色度
	Chroma byte
}

摄像头立即拍摄命令

func (*T808_0x8801) Decode

func (entity *T808_0x8801) Decode(data []byte) (int, error)

func (*T808_0x8801) Encode

func (entity *T808_0x8801) Encode() ([]byte, error)

func (*T808_0x8801) MsgID

func (entity *T808_0x8801) MsgID() MsgID

type T808_0x8801_Resolution

type T808_0x8801_Resolution byte

分辨率

var (
	T808_0x8801_Resolution320x240  T808_0x8801_Resolution = 0x01
	T808_0x8801_Resolution640x480  T808_0x8801_Resolution = 0x02
	T808_0x8801_Resolution800x600  T808_0x8801_Resolution = 0x03
	T808_0x8801_Resolution1024x768 T808_0x8801_Resolution = 0x04
	T808_0x8801_Resolution176x144  T808_0x8801_Resolution = 0x05
	T808_0x8801_Resolution352x288  T808_0x8801_Resolution = 0x06
	T808_0x8801_Resolution704x288  T808_0x8801_Resolution = 0x07
	T808_0x8801_Resolution704x576  T808_0x8801_Resolution = 0x08
)

type T808_0x8801_SaveFlag

type T808_0x8801_SaveFlag byte

保存标志

var (
	// 实时上传
	T808_0x8801_SaveFlagRemote T808_0x8801_SaveFlag = 0
	// 本地保存
	T808_0x8801_SaveFlagLocal T808_0x8801_SaveFlag = 1
)

type T808_0x8802

type T808_0x8802 struct {
	// 多媒体类型
	Type T808_0x0800_MediaType
	// 通道 ID
	ChannelID byte
	// 事件项编码
	// 0:平台下发指令; 1:定时动作; 2:抢劫报警触发;3:碰撞侧翻报警触发;其他保留
	Event byte
	// 起始时间
	StartTime time.Time
	// 结束时间
	EndTime time.Time
}

存储多媒体数据检索

func (*T808_0x8802) Decode

func (entity *T808_0x8802) Decode(data []byte) (int, error)

func (*T808_0x8802) Encode

func (entity *T808_0x8802) Encode() ([]byte, error)

func (*T808_0x8802) MsgID

func (entity *T808_0x8802) MsgID() MsgID

type T808_0x8803

type T808_0x8803 struct {
	// 多媒体类型
	Type T808_0x0800_MediaType
	// 通道 ID
	ChannelID byte
	// 事件项编码
	// 0:平台下发指令; 1:定时动作; 2:抢劫报警触发;3:碰撞侧翻报警触发;其他保留
	Event byte
	// 起始时间
	StartTime time.Time
	// 结束时间
	EndTime time.Time
	// 删除标志
	// 0:保留; 1:删除
	RemoveFlag byte
}

存储多媒体数据上传命令

func (*T808_0x8803) Decode

func (entity *T808_0x8803) Decode(data []byte) (int, error)

func (*T808_0x8803) Encode

func (entity *T808_0x8803) Encode() ([]byte, error)

func (*T808_0x8803) MsgID

func (entity *T808_0x8803) MsgID() MsgID

type T808_0x8804

type T808_0x8804 struct {
	// 录音命令
	// 0:停止录音; 0x01:开始录音
	Cmd byte
	// 录音时间
	// 单位为秒( s),0表示一直录音
	Duration uint16
	// 保存标志
	Save T808_0x8801_SaveFlag
	// 音频采样率
	AudioSampleRate T808_0x8804_AudioSampleRate
}

录音开始命令

func (*T808_0x8804) Decode

func (entity *T808_0x8804) Decode(data []byte) (int, error)

func (*T808_0x8804) Encode

func (entity *T808_0x8804) Encode() ([]byte, error)

func (*T808_0x8804) MsgID

func (entity *T808_0x8804) MsgID() MsgID

type T808_0x8804_AudioSampleRate

type T808_0x8804_AudioSampleRate byte

音频采样率

var (
	T808_0x8804_AudioSampleRate8k  T808_0x8804_AudioSampleRate = 0
	T808_0x8804_AudioSampleRate11k T808_0x8804_AudioSampleRate = 1
	T808_0x8804_AudioSampleRate23k T808_0x8804_AudioSampleRate = 2
	T808_0x8804_AudioSampleRate32k T808_0x8804_AudioSampleRate = 3
)

type T808_0x8805

type T808_0x8805 struct {
	// 多媒体 ID
	MediaID uint32
	// 删除标志
	RemoveFlag byte
}

单条存储多媒体数据检索上传命令

func (*T808_0x8805) Decode

func (entity *T808_0x8805) Decode(data []byte) (int, error)

func (*T808_0x8805) Encode

func (entity *T808_0x8805) Encode() ([]byte, error)

func (*T808_0x8805) MsgID

func (entity *T808_0x8805) MsgID() MsgID

type T808_0x8900

type T808_0x8900 struct {
	// 透传消息类型
	Type byte
	// 透传消息内容
	Data []byte
}

数据下行透传

func (*T808_0x8900) Decode

func (entity *T808_0x8900) Decode(data []byte) (int, error)

func (*T808_0x8900) Encode

func (entity *T808_0x8900) Encode() ([]byte, error)

func (*T808_0x8900) MsgID

func (entity *T808_0x8900) MsgID() MsgID

type T808_0x8A00

type T808_0x8A00 struct {
	PublicKey *rsa.PublicKey
}

平台 RSA公钥

func (*T808_0x8A00) Decode

func (entity *T808_0x8A00) Decode(data []byte) (int, error)

func (*T808_0x8A00) Encode

func (entity *T808_0x8A00) Encode() ([]byte, error)

func (*T808_0x8A00) MsgID

func (entity *T808_0x8A00) MsgID() MsgID

type Vertex

type Vertex struct {
	// 顶点纬度
	Lat decimal.Decimal
	// 顶点经度
	Lng decimal.Decimal
}

顶点

type Writer

type Writer struct {
	// contains filtered or unexported fields
}

func NewWriter

func NewWriter() Writer

func (*Writer) Bytes

func (writer *Writer) Bytes() []byte

func (*Writer) WritString

func (writer *Writer) WritString(str string, size ...int) error

func (*Writer) Write

func (writer *Writer) Write(p []byte, size ...int) *Writer

func (*Writer) WriteBcdTime

func (writer *Writer) WriteBcdTime(t time.Time) *Writer

func (*Writer) WriteByte

func (writer *Writer) WriteByte(b byte) *Writer

func (*Writer) WriteUint16

func (writer *Writer) WriteUint16(n uint16) *Writer

func (*Writer) WriteUint32

func (writer *Writer) WriteUint32(n uint32) *Writer

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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