Documentation
¶
Index ¶
- Constants
- Variables
- func GBT32960Timezone() *time.Location
- func SetParameterPropertiesLookup(lookup map[uint8]ParamProperties)
- func TimeDecode(pkt []byte, idx *int) (time.Time, error)
- func TimeEncode(t time.Time) (pkt []byte)
- func WriteHeader(m GBT32960Msg, pkt []byte) ([]byte, error)
- type Alarm
- type BatteriesTemperatures
- type BatteriesVoltages
- type BatteryTemperature
- type BatteryVoltages
- type Control
- type DriveMotor
- type DriveMotors
- type EnergyStorageSys
- type Engine
- type Extreme
- type FuelCell
- type GBT32960Msg
- type GBT32960MsgTime
- type GeneralParameter
- type GeneralReport
- type Location
- type Msg01
- type Msg02
- type Msg03
- type Msg04
- type Msg07
- type Msg80Receive
- type Msg80Reply
- type Msg81
- type Msg82
- type MsgComponent
- type MsgHeader
- type MsgReply
- type Msgxx
- type PacketData
- type ParamProperties
- type Parameters
- type ProcessData
- type Reports
- func (m Reports) As01() (*VehicleData, error)
- func (m Reports) As02() (*DriveMotors, error)
- func (m Reports) As03() (*FuelCell, error)
- func (m Reports) As04() (*Engine, error)
- func (m Reports) As05() (*Location, error)
- func (m Reports) As06() (*Extreme, error)
- func (m Reports) As07() (*Alarm, error)
- func (m Reports) As08() (*BatteriesVoltages, error)
- func (m Reports) As09() (*BatteriesTemperatures, error)
- func (m *Reports) Decode(pkt []byte, idx *int) error
- func (m Reports) Encode() (pkt []byte, err error)
- func (m Reports) MarshalJSON() ([]byte, error)
- type VehicleData
Constants ¶
View Source
const ( ResponseSuccess uint8 = 0x01 ResponseFailed uint8 = 0x02 ResponseVINDuplicate uint8 = 0x03 ResponseCommandPackage uint8 = 0xFE EncryptNone uint8 = 0x01 EncryptRSA uint8 = 0x02 )
View Source
const (
GBT32960TimeLayout = "060102150405" //"YYMMDDhhmmss"
)
View Source
const (
ICCIDLength = 20
)
View Source
const (
VINLength = 17
)
Variables ¶
View Source
var ( ErrInvalidParse = errors.New("Fail to parse") ErrInvalidConvert = errors.New("Fail to convert msg") ErrDecodeMsg = errors.New("Fail to decode msg") ErrEncodeMsg = errors.New("Fail to encode msg") ErrGenOutgoingMsg = errors.New("Fail to generate outgoing msg") ErrNotAvailable = errors.New("Not available") ErrMissmatch = errors.New("Missmatch") ErrInvalidID = errors.New("Invalid ID") ErrInvalidLength = errors.New("Invalid length") ErrPreprocess = errors.New("Invalid preprocess") ErrNotFound = errors.New("Not found") ErrUnset = errors.New("Unset") ErrDecryptMsg = errors.New("Fail to decrypt msg") ErrEncryptMsg = errors.New("Fail to encrypt msg") )
Functions ¶
func GBT32960Timezone ¶
func SetParameterPropertiesLookup ¶ added in v0.1.0
func SetParameterPropertiesLookup(lookup map[uint8]ParamProperties)
set custom parameter lookup for param decoder
func TimeEncode ¶
func WriteHeader ¶
func WriteHeader(m GBT32960Msg, pkt []byte) ([]byte, error)
Types ¶
type Alarm ¶
type Alarm struct {
AlarmLevel uint8 `json:"alarmLevel"`
AlarmBatteryFlag uint32 `json:"alarmBatteryFlag"`
AlarmBatteryOthers []uint32 `json:"alarmBatteryOthers"`
AlarmDriveMotor []uint32 `json:"alarmDriveMotor"`
AlarmEngines []uint32 `json:"alarmEngines"`
AlarmOthers []uint32 `json:"alarmOthers"`
}
func (*Alarm) MarshalJSON ¶
type BatteriesTemperatures ¶
type BatteriesTemperatures []*BatteryTemperature
func (*BatteriesTemperatures) Decode ¶
func (m *BatteriesTemperatures) Decode(pkt []byte, idx *int) error
func (BatteriesTemperatures) Encode ¶
func (m BatteriesTemperatures) Encode() (pkt []byte, err error)
func (BatteriesTemperatures) GetID ¶
func (m BatteriesTemperatures) GetID() uint8
func (*BatteriesTemperatures) MarshalJSON ¶
func (m *BatteriesTemperatures) MarshalJSON() ([]byte, error)
type BatteriesVoltages ¶
type BatteriesVoltages []*BatteryVoltages
func (BatteriesVoltages) Encode ¶
func (m BatteriesVoltages) Encode() (pkt []byte, err error)
func (BatteriesVoltages) GetID ¶
func (m BatteriesVoltages) GetID() uint8
func (*BatteriesVoltages) MarshalJSON ¶
func (m *BatteriesVoltages) MarshalJSON() ([]byte, error)
type BatteryTemperature ¶
type BatteryTemperature struct {
AssyNo uint8 `json:"assamblyNo "`
Temperature []uint8 `json:"temperature "`
}
func (*BatteryTemperature) Encode ¶
func (m *BatteryTemperature) Encode() (pkt []byte, err error)
type BatteryVoltages ¶
type BatteryVoltages struct {
AssyNo uint8 `json:"assamblyNo"`
Voltage uint16 `json:"voltage"`
Current uint16 `json:"current"`
BatteriesTotalNumber uint16 `json:"batteriesTotalNumber"`
BatteryStartNumberFrame uint16 `json:"batteryStartNumberFrame"`
SingleBatteryVoltageOnFrame []uint16 `json:"singleBatteryVoltageOnFrame"`
}
func (*BatteryVoltages) Encode ¶
func (m *BatteryVoltages) Encode() (pkt []byte, err error)
type DriveMotor ¶
type DriveMotor struct {
SerialNumber uint8 `json:"serialNumber"`
Status uint8 `json:"status"`
ControlerTemperature uint8 `json:"controlerTemperature"`
Speed uint16 `json:"speed"`
Torque uint16 `json:"torque"`
Temperature uint8 `json:"temperature"`
InputVoltage uint16 `json:"inputVoltage"`
InputCurrent uint16 `json:"inputCurrent"`
}
func (*DriveMotor) Encode ¶
func (m *DriveMotor) Encode() (pkt []byte, err error)
type DriveMotors ¶
type DriveMotors []*DriveMotor
func (DriveMotors) Encode ¶
func (m DriveMotors) Encode() (pkt []byte, err error)
func (DriveMotors) GetID ¶
func (m DriveMotors) GetID() uint8
func (*DriveMotors) MarshalJSON ¶
func (m *DriveMotors) MarshalJSON() ([]byte, error)
type EnergyStorageSys ¶
func (*EnergyStorageSys) Encode ¶
func (m *EnergyStorageSys) Encode() (pkt []byte)
type Engine ¶
type Engine struct {
Status uint8 `json:"status"`
Revs uint16 `json:"revolution"`
FuelRate uint16 `json:"fuelRate"`
}
func (*Engine) MarshalJSON ¶
type Extreme ¶
type Extreme struct {
MaxVoltageBatAssyNo uint8 `json:"maxVoltageBatAssyNo"`
MaxVoltageSingleBatNo uint8 `json:"maxVoltageSingleBatNo"`
MaxVoltageSingleBatValue uint16 `json:"maxVoltageSingleBatValue"`
MinVoltageBatAssyNo uint8 `json:"minVoltageBatAssyNo"`
MinVoltageSingleBatNo uint8 `json:"minVoltageSingleBatNo"`
MinVoltageSingleBatValue uint16 `json:"minVoltageSingleBatValue"`
MaxTempBatProbeNo uint8 `json:"maxTempBatProbeNo"`
MaxTempBatAssyNo uint8 `json:"maxTempBatAssyNo"`
MaxTempBatProbeValue uint8 `json:"maxTempBatProbeValue"`
MinTempBatAssyNo uint8 `json:"minTempBatAssyNo"`
MinTempBatProbeNo uint8 `json:"minTempBatProbeNo"`
MinTempBatProbeValue uint8 `json:"minTempBatProbeValue"`
}
func (*Extreme) MarshalJSON ¶
type FuelCell ¶
type FuelCell struct {
BatVoltage uint16 `json:"batVoltage"`
BatCurrent uint16 `json:"batCurrent"`
FuelRate uint16 `json:"fuelRate"`
Temperatures []uint8 `json:"temperatures"`
HydrogenSysMaxTemp uint16 `json:"hydrogenSysMaxTemp"`
HydrogenSysMaxTempNo uint8 `json:"hydrogenSysMaxTempNo"`
HydrogenSysMaxConcentrations uint16 `json:"hydrogenSysMaxConcentrations"`
HydrogenSysMaxConcentrationsNo uint8 `json:"hydrogenSysMaxConcentrationsNo"`
HydrogenSysMaxPressure uint16 `json:"hydrogenSysMaxPressure"`
HydrogenSysMaxPressureNo uint8 `json:"hydrogenSysMaxPressureNo"`
DCStatus uint8 `json:"dcStatus"`
}
func (*FuelCell) MarshalJSON ¶
type GBT32960Msg ¶
type GBT32960Msg interface {
Decode(*PacketData) error // Packet -> GBT32960Msg
Encode() (pkt []byte, err error) // GBT32960Msg -> Packet
GetHeader() *MsgHeader // Header
Copy() GBT32960Msg
GetMsgSN() string
}
type GBT32960MsgTime ¶
type GeneralParameter ¶
type GeneralReport ¶
type Location ¶
type Location struct {
Status uint8 `json:"status"`
Longitude uint32 `json:"longitude"`
Latidude uint32 `json:"latidude"`
}
func (*Location) MarshalJSON ¶
type Msg01 ¶
type Msg01 struct {
Header *MsgHeader `json:"header"`
Time time.Time `json:"time"`
SerialNumber uint16 `json:"serialNumber"`
ICCID string `json:"iccid"`
EnerygyStorageSystem EnergyStorageSys `json:"energyStorageSystem"`
}
Login
func (*Msg01) Copy ¶
func (m *Msg01) Copy() GBT32960Msg
func (*Msg01) Decode ¶
func (m *Msg01) Decode(packet *PacketData) error
type Msg02 ¶
type Msg02 struct {
Header *MsgHeader `json:"header"`
Time time.Time `json:"time"`
Reports Reports `json:"reports"`
}
func (*Msg02) Copy ¶
func (m *Msg02) Copy() GBT32960Msg
func (*Msg02) Decode ¶
func (m *Msg02) Decode(packet *PacketData) error
type Msg03 ¶
type Msg03 struct {
Header *MsgHeader `json:"header"`
Time time.Time `json:"time"`
Reports Reports `json:"reports"`
}
func (*Msg03) Copy ¶
func (m *Msg03) Copy() GBT32960Msg
func (*Msg03) Decode ¶
func (m *Msg03) Decode(packet *PacketData) error
type Msg04 ¶
type Msg04 struct {
Header *MsgHeader `json:"header"`
Time time.Time `json:"time"`
SerialNumber uint16 `json:"serialNumber"`
}
func (*Msg04) Copy ¶
func (m *Msg04) Copy() GBT32960Msg
func (*Msg04) Decode ¶
func (m *Msg04) Decode(packet *PacketData) error
type Msg07 ¶
type Msg07 struct {
Header *MsgHeader `json:"header"`
}
func (*Msg07) Copy ¶
func (m *Msg07) Copy() GBT32960Msg
func (*Msg07) Decode ¶
func (m *Msg07) Decode(packet *PacketData) error
type Msg80Receive ¶
type Msg80Receive struct {
Header *MsgHeader `json:"header"`
Time time.Time `json:"time"`
ParameterIDs []byte `json:"parameterIDs"`
}
Parameter Query
func GenerateMsh80Receive ¶
func GenerateMsh80Receive(vin string, timeNow time.Time, parameterID []byte) *Msg80Receive
func (*Msg80Receive) Copy ¶
func (m *Msg80Receive) Copy() GBT32960Msg
func (*Msg80Receive) Decode ¶
func (m *Msg80Receive) Decode(packet *PacketData) error
func (*Msg80Receive) Encode ¶
func (m *Msg80Receive) Encode() (pkt []byte, err error)
func (*Msg80Receive) GetHeader ¶
func (m *Msg80Receive) GetHeader() *MsgHeader
func (Msg80Receive) GetMsgSN ¶
func (m Msg80Receive) GetMsgSN() string
type Msg80Reply ¶
type Msg80Reply struct {
Header *MsgHeader `json:"header"`
Time time.Time `json:"time"`
Parameters Parameters `json:"parameters"`
}
Parameter Reply
func (*Msg80Reply) Copy ¶
func (m *Msg80Reply) Copy() GBT32960Msg
func (*Msg80Reply) Decode ¶
func (m *Msg80Reply) Decode(packet *PacketData) error
func (*Msg80Reply) Encode ¶
func (m *Msg80Reply) Encode() (pkt []byte, err error)
func (*Msg80Reply) GetHeader ¶
func (m *Msg80Reply) GetHeader() *MsgHeader
func (Msg80Reply) GetMsgSN ¶
func (m Msg80Reply) GetMsgSN() string
func (Msg80Reply) GetTime ¶
func (m Msg80Reply) GetTime() time.Time
type Msg81 ¶
type Msg81 struct {
Header *MsgHeader `json:"header"`
Time time.Time `json:"time"`
Parameters Parameters `json:"parameters"`
}
Parameter Set
func (*Msg81) Copy ¶
func (m *Msg81) Copy() GBT32960Msg
func (*Msg81) Decode ¶
func (m *Msg81) Decode(packet *PacketData) error
type Msg82 ¶
type Msg82 struct {
Header *MsgHeader `json:"header"`
Time time.Time `json:"time"`
Control Control `json:"control"`
}
Control
func (*Msg82) Copy ¶
func (m *Msg82) Copy() GBT32960Msg
func (*Msg82) Decode ¶
func (m *Msg82) Decode(packet *PacketData) error
type MsgComponent ¶
type MsgHeader ¶
type MsgHeader struct {
CommandID uint8 `json:"commandID"` // command id
Response uint8 `json:"responseFlag"` // command response flag
VIN string `json:"VIN"` // 17 char string
Encription uint8 `json:"encription"` // metode enkripsi
BodyLength uint16 `json:"length"` // panjang body
Idx int `json:"-"` // Read the PACKET Header.
TimeCreated time.Time `json:"timeCreated"` // Time msg create
EncryptKey *rsa.PublicKey `json:"encryptKey"` // key for encrypt
PrivateEncryptKey *rsa.PrivateKey `json:"privateKey"` // key for encrypt
}
func GenerateHeader ¶
func GenerateHeaderWithKey ¶
type MsgReply ¶
func (*MsgReply) Copy ¶
func (m *MsgReply) Copy() GBT32960Msg
func (*MsgReply) Decode ¶
func (m *MsgReply) Decode(packet *PacketData) error
type Msgxx ¶
func (*Msgxx) Copy ¶
func (m *Msgxx) Copy() GBT32960Msg
func (*Msgxx) Decode ¶
func (m *Msgxx) Decode(packet *PacketData) error
type PacketData ¶
type ParamProperties ¶ added in v0.1.0
type Parameters ¶
func (Parameters) Delete ¶
func (m Parameters) Delete(id uint8)
func (Parameters) Encode ¶
func (m Parameters) Encode() (pkt []byte, err error)
func (Parameters) IsEqual ¶
func (m Parameters) IsEqual(other Parameters) error
type ProcessData ¶
type ProcessData struct {
Incoming GBT32960Msg // received message
Outgoing GBT32960Msg // message sent
}
type Reports ¶
type Reports map[uint8]GeneralReport
func (Reports) As01 ¶
func (m Reports) As01() (*VehicleData, error)
func (Reports) As02 ¶
func (m Reports) As02() (*DriveMotors, error)
func (Reports) As08 ¶
func (m Reports) As08() (*BatteriesVoltages, error)
func (Reports) As09 ¶
func (m Reports) As09() (*BatteriesTemperatures, error)
func (Reports) MarshalJSON ¶
type VehicleData ¶
type VehicleData struct {
Status uint8 `json:"status"`
Charging uint8 `json:"charging"`
OpMode uint8 `json:"operatingMode"`
Speed uint16 `json:"speed"`
Odometer uint32 `json:"odometer"`
TotalVoltage uint16 `json:"totalVoltage"`
TotalCurrent uint16 `json:"totalCurrent"`
SoC uint8 `json:"stateOfCharge"`
DCDCStatus uint8 `json:"dcDcStatus"`
Gear uint8 `json:"gear"`
Insulator uint16 `json:"insulator"`
Throttle uint8 `json:"trottle"`
Brake uint8 `json:"brake"`
}
func (*VehicleData) Encode ¶
func (m *VehicleData) Encode() (pkt []byte, err error)
func (VehicleData) GetID ¶
func (m VehicleData) GetID() uint8
func (*VehicleData) MarshalJSON ¶
func (m *VehicleData) MarshalJSON() ([]byte, error)
Source Files
¶
- control.go
- custom_data.go
- frame.go
- header.go
- msg.go
- msg01.go
- msg02.go
- msg03.go
- msg04.go
- msg07.go
- msg80_rcv.go
- msg80_rpl.go
- msg81.go
- msg82.go
- msg_reply.go
- msgxx.go
- parameter.go
- report_01.go
- report_02.go
- report_03.go
- report_04.go
- report_05.go
- report_06.go
- report_07.go
- report_08.go
- report_09.go
- report_item.go
- session.go
- sort.go
- time.go
Click to show internal directories.
Click to hide internal directories.