Documentation ¶
Index ¶
- Constants
- type AlarmInformation
- type AlarmType
- type AlarmValue
- type BatteryLevel
- type DoorStatusData
- type ExternalPowerVoltageData
- type GPSCourse
- type GPSDataUploadMode
- type GPSInformation
- type GSMSignalStrength
- type HeartbeatData
- type InformationContent
- type InformationTransmissionPacket
- type InformationType
- type LBSInformation
- type Language
- type LoginData
- type MessageType
- type Packet
- type PositioningInformation
- type ResponsePacket
- type StatusInformation
- type TR06Protocol
- func (p *TR06Protocol) ConsumeStream(reader *bufio.Reader, writer io.Writer, dataStore store.Store) error
- func (p *TR06Protocol) GetDeviceID() string
- func (p *TR06Protocol) GetDeviceType() types.DeviceType
- func (p *TR06Protocol) GetProtocolType() types.DeviceProtocolType
- func (p *TR06Protocol) IsValidHeader(reader *bufio.Reader) bool
- func (p *TR06Protocol) Login(reader *bufio.Reader) (ack []byte, byteToSkip int, e error)
- func (p *TR06Protocol) SendCommandToDevice(writer io.Writer, command string) error
- func (p *TR06Protocol) SetDeviceType(t types.DeviceType)
- type TerminalInformation
- type TerminalStatusSyncData
Constants ¶
View Source
const ( StartBitValue = 0x7979 StopBitValue = 0x0D0A )
View Source
const ( MSG_LoginData MessageType = 0x01 MSG_PositioningData = 0x12 MSG_HeartbeatData = 0x13 MSG_EG_HeartbeatData = 0x23 MSG_StringInformation = 0x21 MSG_AlarmData = 0x26 MSG_LBSInformation = 0x28 // TODO: check if this is correct MSG_TimezoneInformation = 0x27 MSG_GPS_PhoneNumber = 0x2a MSG_WifiInformation = 0x2c MSG_TransmissionInstruction = 0x80 MSG_Invalid = 0xff )
View Source
const ( AL_SOSDistress AlarmType = 0x04 // 100 -> 0000 0100 AL_LowBattery = 0x03 // 011 -> 0000 0011 AL_PowerFailure = 0x02 // 010 -> 0000 0010 AL_Vibration = 0x01 // 001 -> 0000 0001 AL_Normal = 0x00 // 000 -> 0000 0000 AL_Invalid = 0xff )
View Source
const ( VL_NoPower BatteryLevel = 0x00 VL_BatteryExtremelyLow = 0x01 VL_BatteryVeryLow = 0x02 VL_BatteryLow = 0x03 VL_BatteryMedium = 0x04 VL_BatteryHigh = 0x05 VL_BatteryFull = 0x06 VL_Invalid = 0xff )
View Source
const ( ALV_Normal = 0x00 ALV_SOS = 0x01 ALV_PowerCut = 0x02 ALV_Vibration = 0x03 ALV_EnterFence = 0x04 ALV_ExitFence = 0x05 ALV_OverSpeed = 0x06 ALV_Moving = 0x09 ALV_EnterGPSDeadZone = 0x0a ALV_ExitGPSDeadZone = 0x0b ALV_PowerOn = 0x0c ALV_GPSFirstFixNotice = 0x0d ALV_ExternalLowBattery = 0x0e ALV_ExternalLowBatteryProtection = 0x0f ALV_SIMChange = 0x10 ALV_PowerOff = 0x11 ALV_AirplaneMode = 0x12 ALV_Diassemble = 0x13 ALV_Door = 0x14 ALV_ShutdownLowPower = 0x15 ALV_Sound = 0x16 ALV_InternalBatteryLow = 0x17 ALV_SleepMode = 0x20 ALV_HarshAcceleration = 0x29 ALV_HarshBraking = 0x30 ALV_SharpLeftTurn = 0x2a ALV_SharpRightTurn = 0x2b ALV_SharpCrash = 0x2c ALV_Pull = 0x32 ALV_PressToUploadAlarmMessageBtn = 0x3e ALV_Fall = 0x23 ALV_ACCOn = 0xee ALV_ACCOff = 0xff )
View Source
const ( LANG_Chinese = 0x01 LANG_English = 0x02 LANG_NoReply = 0x00 )
View Source
const ( GSM_NoSignal GSMSignalStrength = 0x00 GSM_ExtremelyWeakSignal = 0x01 GSM_WeakSignal = 0x02 GSM_GoodSignal = 0x03 GSM_StrongSignal = 0x04 GSM_Invalid = 0xff )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AlarmInformation ¶
type AlarmInformation struct { GpsInformation GPSInformation LBSInformation LBSInformation StatusInformation StatusInformation }
type AlarmValue ¶
type AlarmValue uint8
type BatteryLevel ¶
type BatteryLevel uint8
type DoorStatusData ¶
type DoorStatusData struct {
DoorOpen bool
}
type ExternalPowerVoltageData ¶
type ExternalPowerVoltageData struct {
Voltage float32
}
type GPSDataUploadMode ¶
type GPSDataUploadMode uint8
func (*GPSDataUploadMode) ToString ¶
func (m *GPSDataUploadMode) ToString() string
type GPSInformation ¶
type GSMSignalStrength ¶
type GSMSignalStrength uint8
type HeartbeatData ¶
type HeartbeatData struct { TerminalInformation TerminalInformation BatteryLevel BatteryLevel GSMSignalStrength GSMSignalStrength ExtendedPortStatus uint16 // 0x0001 Chinese, 0x0002 English }
type InformationContent ¶
type InformationContent struct { InformationType InformationType DataContent uint16 }
type InformationType ¶
type InformationType byte
const ( ExternalPowerVoltage InformationType = 0x00 TerminalStatusSync InformationType = 0x04 DoorStatus InformationType = 0x05 )
type LBSInformation ¶
type MessageType ¶
type MessageType byte
func (MessageType) String ¶
func (mt MessageType) String() string
type Packet ¶
type Packet struct { StartBit uint16 PacketLength byte MessageType MessageType Information interface{} InformationSerialNumber uint16 Crc uint16 StopBits uint16 }
func (*Packet) ToProtobufDeviceStatus ¶
func (packet *Packet) ToProtobufDeviceStatus(imei string, deviceType types.DeviceType) *types.DeviceStatus
type PositioningInformation ¶
type PositioningInformation struct { GpsInformation GPSInformation LBSInfo LBSInformation ACCHigh bool DataReportingMode GPSDataUploadMode // for concox, but not for gt06 GPSRealTime bool // 0x00 - realtime, 0x01 - re-upload MileageStatistics uint32 }
type ResponsePacket ¶
type ResponsePacket struct { StartBit uint16 PacketLength int8 ProtocolNumber int8 InformationSerialNumber uint16 Crc uint16 StopBits uint16 }
func (*ResponsePacket) ToBytes ¶
func (r *ResponsePacket) ToBytes() []byte
type StatusInformation ¶
type StatusInformation struct { TerminalInformation TerminalInformation BatteryLevel BatteryLevel GSMSignalStrength GSMSignalStrength Alarm AlarmValue Language Language }
type TR06Protocol ¶
type TR06Protocol struct { LoginInformation *LoginData DeviceType types.DeviceType }
func (*TR06Protocol) ConsumeStream ¶
func (*TR06Protocol) GetDeviceID ¶
func (p *TR06Protocol) GetDeviceID() string
func (*TR06Protocol) GetDeviceType ¶
func (p *TR06Protocol) GetDeviceType() types.DeviceType
func (*TR06Protocol) GetProtocolType ¶
func (p *TR06Protocol) GetProtocolType() types.DeviceProtocolType
func (*TR06Protocol) IsValidHeader ¶
func (p *TR06Protocol) IsValidHeader(reader *bufio.Reader) bool
func (*TR06Protocol) SendCommandToDevice ¶
func (p *TR06Protocol) SendCommandToDevice(writer io.Writer, command string) error
send command to device
func (*TR06Protocol) SetDeviceType ¶
func (p *TR06Protocol) SetDeviceType(t types.DeviceType)
type TerminalInformation ¶
type TerminalStatusSyncData ¶
type TerminalStatusSyncData struct {
Status string
}
Click to show internal directories.
Click to hide internal directories.