1 Star 0 Fork 36

HonglinRen / go808

forked from coco / go808 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
t808_0x0900.go 979 Bytes
一键复制 编辑 原始数据 按行查看 历史
Your Name 提交于 2020-04-07 18:27 . 添加详细注释
package protocol
// 数据上行透传
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 (entity *T808_0x0900) MsgID() MsgID {
return MsgT808_0x0900
}
func (entity *T808_0x0900) Encode() ([]byte, error) {
writer := NewWriter()
writer.WriteByte(entity.Type)
writer.Write(entity.Data)
return writer.Bytes(), nil
}
func (entity *T808_0x0900) Decode(data []byte) (int, error) {
if len(data) < 1 {
return 0, ErrInvalidBody
}
entity.Type, entity.Data = data[0], data[1:]
return len(data), nil
}
Go
1
https://gitee.com/honlin_ren/go808.git
git@gitee.com:honlin_ren/go808.git
honlin_ren
go808
go808
20b7a9eb4995

搜索帮助