intellitrac_a

package
v0.0.0-...-e4ed9a4 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2025 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PreambleSize             = 4
	BinaryHeartbeatSize      = 22
	ASCIIHeartbeatSize       = 8
	BinaryAckSize            = 6
	BinaryPositionHeaderSize = 12
)

Protocol constants

View Source
const (
	MsgEncodingBinaryPos  = 0x00
	MsgEncodingText       = 0x02
	MsgEncodingGarminText = 0x03
	MsgEncodingATCommand  = 0x01

	MsgTypeRequest  = 0x00
	MsgTypeResponse = 0x01
	MsgTypeAsync    = 0x02
	MsgTypeAck      = 0x03
)

Message types

View Source
const (
	IgnitionStatus = 0
	Input1Status   = 1
	Input2Status   = 2
	Input3Status   = 3
	Input4Status   = 4
	Output1Status  = 8
	Output2Status  = 9
	Output3Status  = 10
)

I/O Status bits (from page 11)

View Source
const (
	EngineStatus = 0
	MotionStatus = 1
)

Vehicle Status bits (from page 11)

Variables

View Source
var (
	ErrInvalidHeartbeat    = errors.New("invalid heartbeat format")
	ErrUnsupportedMsgType  = errors.New("unsupported message type")
	ErrInvalidPositionData = errors.New("invalid position data")
	ErrChecksumMismatch    = errors.New("checksum mismatch")
	ErrInvalidLogin        = errors.New("invalid login")
)

Functions

This section is empty.

Types

type GPSData

type GPSData struct {
	Timestamp time.Time
	Latitude  float64
	Longitude float64
	Altitude  int32
	Speed     float32
	Direction float32
}

type Heartbeat

type Heartbeat struct {
	TransactionID uint16
	ModemID       uint64
	MessageID     uint16
	DataLength    uint16
	RTC           time.Time
}

type IntelliTracAProtocol

type IntelliTracAProtocol struct {
	Imei       string
	DeviceType types.DeviceType
	IsBinary   bool
}

func (*IntelliTracAProtocol) ConsumeStream

func (t *IntelliTracAProtocol) ConsumeStream(reader *bufio.Reader, writer io.Writer, store store.Store) error

func (*IntelliTracAProtocol) GetDeviceID

func (t *IntelliTracAProtocol) GetDeviceID() string

func (*IntelliTracAProtocol) GetDeviceType

func (t *IntelliTracAProtocol) GetDeviceType() types.DeviceType

func (*IntelliTracAProtocol) GetProtocolType

func (t *IntelliTracAProtocol) GetProtocolType() types.DeviceProtocolType

func (*IntelliTracAProtocol) Login

func (t *IntelliTracAProtocol) Login(reader *bufio.Reader) ([]byte, int, error)

func (*IntelliTracAProtocol) SendCommandToDevice

func (t *IntelliTracAProtocol) SendCommandToDevice(writer io.Writer, command string) error

func (*IntelliTracAProtocol) SetDeviceType

func (t *IntelliTracAProtocol) SetDeviceType(dt types.DeviceType)

type PositionRecord

type PositionRecord struct {
	TransactionID     uint16
	ModemID           string
	MessageID         uint16
	DataLength        uint16
	GPS               GPSData
	Odometer          uint32
	HDOP              uint8
	Satellites        uint8
	IOStatus          uint16
	VehicleStatus     uint8
	AnalogInput1      float32
	AnalogInput2      float32
	RTC               time.Time
	PositionSending   time.Time
	EventData         []byte
	RawData           string
	AdditionalMetrics map[uint16]interface{}
}

func (*PositionRecord) ToDeviceStatus

func (p *PositionRecord) ToDeviceStatus(imei string) *types.DeviceStatus

Jump to

Keyboard shortcuts

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