protocol

package
v0.0.0-...-e7f85d1 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2025 License: BSD-4-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EntityMapper = map[Cmd]func() Entity{
	MsgT808_0x80: func() Entity {
		return new(T2929_0x80)
	},
	MsgT808_0xd8: func() Entity {
		return new(T2929_0xd8)
	},
	MsgT808_0x85: func() Entity {
		return new(T2929_0x85)
	},
	MsgT808_0xe1: func() Entity {
		return new(T2929_0xe1)
	},
	MsgT808_0xd6: func() Entity {
		return new(T2929_0xd6)
	},
}

消息实体映射

Functions

func GetCheckSum

func GetCheckSum(msg []byte) byte

Types

type Cmd

type Cmd uint8

消息ID枚举

const (
	MsgT808_0x80 Cmd = 0x80
	MsgT808_0xd8 Cmd = 0xd8
	MsgT808_0x85 Cmd = 0x85
	MsgT808_0xe1 Cmd = 0xe1
	MsgT808_0xd6 Cmd = 0xd6

	MsgT808_0xd7 Cmd = 0xd7
	MsgT808_0x21 Cmd = 0x21
	MsgT808_0x3a Cmd = 0x3a
)

type Entity

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

消息实体

type T2929

type T2929 struct {
	Head   []byte `json:"-"` // 2929
	Cmd    uint8  `json:"-"`
	Length uint16 `json:"-"`
	Verify uint8  `json:"-`
	Last   []byte `json:"-"` //0D
}

type T2929_0x3a

type T2929_0x3a struct {
	Reply []byte
}

func (*T2929_0x3a) Decode

func (entity *T2929_0x3a) Decode(data []byte) error

func (*T2929_0x3a) Encode

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

type T2929_0x21

type T2929_0x21 struct {
	Reply []byte
}

func (*T2929_0x21) Decode

func (entity *T2929_0x21) Decode(data []byte) error

func (*T2929_0x21) Encode

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

type T2929_0x80

type T2929_0x80 struct {
	//FakeIp           string             `json:"fake_ip"`
	TerminalID       uint64             `json:"terminal_id"`
	LocTime          time.Time          `json:"loc_time"` // YYMMDDhhmmss
	Lng              decimal.Decimal    `json:"lng"`
	Lat              decimal.Decimal    `json:"lat"`
	Speed            uint16             `json:"speed"`
	Direction        uint16             `json:"direction"`
	IsGpsEffectivity bool               `json:"is_gps_effectivity"`
	StatusElectric   string             `json:"status_electric"` // normal power_down low_voltage
	Extra0x0024      extra.Extra_0x0024 `json:"extra_0x0024"`
	Extra0x0008      extra.Extra_0x0008 `json:"extra_0x0008"`
	Extra0x0089      extra.Extra_0x0089 `json:"extra_0x0089"`
	Extra0x00b9      extra.Extra_0x00b9 `json:"extra_0x00b9"`
	Extra0x00c5      extra.Extra_0x00c5 `json:"extra_0x00c5"`
	Extra0x00a5      extra.Extra_0x00a5 `json:"extra_0x00a5"`
}

func (*T2929_0x80) Decode

func (entity *T2929_0x80) Decode(data []byte) error

func (*T2929_0x80) Encode

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

type T2929_0x85

type T2929_0x85 struct {
	TerminalID uint64 `json:"terminal_id"`
}

func (*T2929_0x85) Decode

func (entity *T2929_0x85) Decode(data []byte) error

func (*T2929_0x85) Encode

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

type T2929_0xd6

type T2929_0xd6 struct {
	TerminalID uint64 `json:"terminal_id"`
}

func (*T2929_0xd6) Decode

func (entity *T2929_0xd6) Decode(data []byte) error

func (*T2929_0xd6) Encode

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

type T2929_0xd7

type T2929_0xd7 struct {
	Reply []byte
}

func (*T2929_0xd7) Decode

func (entity *T2929_0xd7) Decode(data []byte) error

func (*T2929_0xd7) Encode

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

type T2929_0xd8

type T2929_0xd8 struct {
	TerminalID uint64 `json:"terminal_id"`
}

func (*T2929_0xd8) Decode

func (entity *T2929_0xd8) Decode(data []byte) error

func (*T2929_0xd8) Encode

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

type T2929_0xe1

type T2929_0xe1 struct {
	TerminalID uint64 `json:"terminal_id"`
	ICCID      string `json:"ICCID"`
}

func (*T2929_0xe1) Decode

func (entity *T2929_0xe1) Decode(data []byte) error

func (*T2929_0xe1) Encode

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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