skylab: add unmarshal bounds check
remove recover from telem log parser
This commit is contained in:
parent
aaec62fd3a
commit
41689eee10
|
@ -143,3 +143,11 @@ type UnknownIdError struct {
|
|||
func (e *UnknownIdError) Error() string {
|
||||
return fmt.Sprintf("unknown id: %x", e.id)
|
||||
}
|
||||
|
||||
type BadLengthError struct {
|
||||
expected uint32
|
||||
actual uint32
|
||||
}
|
||||
func (e *BadLengthError) Error() string {
|
||||
return fmt.Sprintf("bad data length, expected %d, got %d", e.expected, e.actual)
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// generated by gen_skylab.go at 2024-02-28 14:10:10.252960174 -0600 CST m=+0.003082874 DO NOT EDIT!
|
||||
// generated by gen_skylab.go at 2024-02-28 18:38:32.339579498 -0600 CST m=+0.002992359 DO NOT EDIT!
|
||||
|
||||
package skylab
|
||||
|
||||
|
@ -1024,6 +1024,9 @@ func (p *BmsMeasurement) MarshalPacket() ([]byte, error) {
|
|||
}
|
||||
|
||||
func (p *BmsMeasurement) UnmarshalPacket(b []byte) error {
|
||||
if len(b) != 8 {
|
||||
return &BadLengthError{expected: 8, actual: uint32(len(b))}
|
||||
}
|
||||
p.BatteryVoltage = binary.LittleEndian.Uint16(b[0:])
|
||||
p.AuxVoltage = binary.LittleEndian.Uint16(b[2:])
|
||||
p.Current = float32FromBytes(b[4:], false)
|
||||
|
@ -1278,6 +1281,9 @@ func (p *BatteryStatus) MarshalPacket() ([]byte, error) {
|
|||
}
|
||||
|
||||
func (p *BatteryStatus) UnmarshalPacket(b []byte) error {
|
||||
if len(b) != 5 {
|
||||
return &BadLengthError{expected: 5, actual: uint32(len(b))}
|
||||
}
|
||||
p.BatteryState.UnmarshalByte(b[0])
|
||||
p.ContactorState.UnmarshalByte(b[1])
|
||||
p.LvChannelStatus.UnmarshalByte(b[2])
|
||||
|
@ -1404,6 +1410,9 @@ func (p *BmsKillReason) MarshalPacket() ([]byte, error) {
|
|||
}
|
||||
|
||||
func (p *BmsKillReason) UnmarshalPacket(b []byte) error {
|
||||
if len(b) != 8 {
|
||||
return &BadLengthError{expected: 8, actual: uint32(len(b))}
|
||||
}
|
||||
p.Reason1.UnmarshalByte(b[0])
|
||||
p.Reason2.UnmarshalByte(b[1])
|
||||
p.Module = binary.LittleEndian.Uint16(b[2:])
|
||||
|
@ -1451,6 +1460,9 @@ func (p *BmsModuleMinMax) MarshalPacket() ([]byte, error) {
|
|||
}
|
||||
|
||||
func (p *BmsModuleMinMax) UnmarshalPacket(b []byte) error {
|
||||
if len(b) != 8 {
|
||||
return &BadLengthError{expected: 8, actual: uint32(len(b))}
|
||||
}
|
||||
p.ModuleMaxTemp = int16(binary.LittleEndian.Uint16(b[0:]))
|
||||
p.ModuleMinTemp = int16(binary.LittleEndian.Uint16(b[2:]))
|
||||
p.ModuleMaxVoltage = binary.LittleEndian.Uint16(b[4:])
|
||||
|
@ -1488,6 +1500,9 @@ func (p *BmsSoc) MarshalPacket() ([]byte, error) {
|
|||
}
|
||||
|
||||
func (p *BmsSoc) UnmarshalPacket(b []byte) error {
|
||||
if len(b) != 4 {
|
||||
return &BadLengthError{expected: 4, actual: uint32(len(b))}
|
||||
}
|
||||
p.Soc = float32FromBytes(b[0:], false)
|
||||
|
||||
return nil
|
||||
|
@ -1524,6 +1539,9 @@ func (p *BmsCapacity) MarshalPacket() ([]byte, error) {
|
|||
}
|
||||
|
||||
func (p *BmsCapacity) UnmarshalPacket(b []byte) error {
|
||||
if len(b) != 8 {
|
||||
return &BadLengthError{expected: 8, actual: uint32(len(b))}
|
||||
}
|
||||
p.Ah = float32FromBytes(b[0:], false)
|
||||
p.Wh = float32FromBytes(b[4:], false)
|
||||
|
||||
|
@ -1563,6 +1581,9 @@ func (p *BmsCurrentlimit) MarshalPacket() ([]byte, error) {
|
|||
}
|
||||
|
||||
func (p *BmsCurrentlimit) UnmarshalPacket(b []byte) error {
|
||||
if len(b) != 4 {
|
||||
return &BadLengthError{expected: 4, actual: uint32(len(b))}
|
||||
}
|
||||
p.CurrentMax = int16(binary.LittleEndian.Uint16(b[0:]))
|
||||
p.CurrentMin = int16(binary.LittleEndian.Uint16(b[2:]))
|
||||
|
||||
|
@ -1608,6 +1629,9 @@ func (p *BmsFanInfo) MarshalPacket() ([]byte, error) {
|
|||
}
|
||||
|
||||
func (p *BmsFanInfo) UnmarshalPacket(b []byte) error {
|
||||
if len(b) != 8 {
|
||||
return &BadLengthError{expected: 8, actual: uint32(len(b))}
|
||||
}
|
||||
p.Fan1 = binary.LittleEndian.Uint16(b[0:])
|
||||
p.Fan2 = binary.LittleEndian.Uint16(b[2:])
|
||||
p.Fan3 = binary.LittleEndian.Uint16(b[4:])
|
||||
|
@ -1649,6 +1673,9 @@ func (p *BmsSetMinFanSpeed) MarshalPacket() ([]byte, error) {
|
|||
}
|
||||
|
||||
func (p *BmsSetMinFanSpeed) UnmarshalPacket(b []byte) error {
|
||||
if len(b) != 6 {
|
||||
return &BadLengthError{expected: 6, actual: uint32(len(b))}
|
||||
}
|
||||
p.FanPercentage = float32FromBytes(b[0:], false)
|
||||
p.Time = binary.LittleEndian.Uint16(b[4:])
|
||||
|
||||
|
@ -1693,6 +1720,9 @@ func (p *BmsModule) MarshalPacket() ([]byte, error) {
|
|||
}
|
||||
|
||||
func (p *BmsModule) UnmarshalPacket(b []byte) error {
|
||||
if len(b) != 8 {
|
||||
return &BadLengthError{expected: 8, actual: uint32(len(b))}
|
||||
}
|
||||
p.Voltage = float32FromBytes(b[0:], false)
|
||||
p.Temperature = float32FromBytes(b[4:], false)
|
||||
|
||||
|
@ -1744,6 +1774,9 @@ func (p *BmsChargerResponse) MarshalPacket() ([]byte, error) {
|
|||
}
|
||||
|
||||
func (p *BmsChargerResponse) UnmarshalPacket(b []byte) error {
|
||||
if len(b) != 1 {
|
||||
return &BadLengthError{expected: 1, actual: uint32(len(b))}
|
||||
}
|
||||
p.ResponseFlags.UnmarshalByte(b[0])
|
||||
|
||||
return nil
|
||||
|
@ -1794,6 +1827,9 @@ func (p *ChassisIsolationFault) MarshalPacket() ([]byte, error) {
|
|||
}
|
||||
|
||||
func (p *ChassisIsolationFault) UnmarshalPacket(b []byte) error {
|
||||
if len(b) != 1 {
|
||||
return &BadLengthError{expected: 1, actual: uint32(len(b))}
|
||||
}
|
||||
p.FaultDetected.UnmarshalByte(b[0])
|
||||
|
||||
return nil
|
||||
|
@ -2040,6 +2076,9 @@ func (p *BmsImdInfo) MarshalPacket() ([]byte, error) {
|
|||
}
|
||||
|
||||
func (p *BmsImdInfo) UnmarshalPacket(b []byte) error {
|
||||
if len(b) != 6 {
|
||||
return &BadLengthError{expected: 6, actual: uint32(len(b))}
|
||||
}
|
||||
p.DImcRIso = binary.LittleEndian.Uint16(b[0:])
|
||||
p.DImcStatus1.UnmarshalByte(b[2])
|
||||
p.DImcStatus2.UnmarshalByte(b[3])
|
||||
|
@ -2080,6 +2119,9 @@ func (p *DashboardPedalPercentages) MarshalPacket() ([]byte, error) {
|
|||
}
|
||||
|
||||
func (p *DashboardPedalPercentages) UnmarshalPacket(b []byte) error {
|
||||
if len(b) != 2 {
|
||||
return &BadLengthError{expected: 2, actual: uint32(len(b))}
|
||||
}
|
||||
p.AccelPedalValue = b[0]
|
||||
p.BrakePedalValue = b[1]
|
||||
|
||||
|
@ -2115,6 +2157,9 @@ func (p *CarState) MarshalPacket() ([]byte, error) {
|
|||
}
|
||||
|
||||
func (p *CarState) UnmarshalPacket(b []byte) error {
|
||||
if len(b) != 1 {
|
||||
return &BadLengthError{expected: 1, actual: uint32(len(b))}
|
||||
}
|
||||
p.State = b[0]
|
||||
|
||||
return nil
|
||||
|
@ -2151,6 +2196,9 @@ func (p *DashboardPedalFault) MarshalPacket() ([]byte, error) {
|
|||
}
|
||||
|
||||
func (p *DashboardPedalFault) UnmarshalPacket(b []byte) error {
|
||||
if len(b) != 2 {
|
||||
return &BadLengthError{expected: 2, actual: uint32(len(b))}
|
||||
}
|
||||
p.BrakeFaultCount = b[0]
|
||||
p.AccelFaultCount = b[1]
|
||||
|
||||
|
@ -2237,6 +2285,9 @@ func (p *DashboardSystemTimeoutTest) MarshalPacket() ([]byte, error) {
|
|||
}
|
||||
|
||||
func (p *DashboardSystemTimeoutTest) UnmarshalPacket(b []byte) error {
|
||||
if len(b) != 1 {
|
||||
return &BadLengthError{expected: 1, actual: uint32(len(b))}
|
||||
}
|
||||
p.FlagSet0.UnmarshalByte(b[0])
|
||||
|
||||
return nil
|
||||
|
@ -2271,6 +2322,9 @@ func (p *CarSpeed) MarshalPacket() ([]byte, error) {
|
|||
}
|
||||
|
||||
func (p *CarSpeed) UnmarshalPacket(b []byte) error {
|
||||
if len(b) != 4 {
|
||||
return &BadLengthError{expected: 4, actual: uint32(len(b))}
|
||||
}
|
||||
p.Speed = float32FromBytes(b[0:], false)
|
||||
|
||||
return nil
|
||||
|
@ -2315,6 +2369,9 @@ func (p *FlightComputerLvBoardDisconnectCounts) MarshalPacket() ([]byte, error)
|
|||
}
|
||||
|
||||
func (p *FlightComputerLvBoardDisconnectCounts) UnmarshalPacket(b []byte) error {
|
||||
if len(b) != 6 {
|
||||
return &BadLengthError{expected: 6, actual: uint32(len(b))}
|
||||
}
|
||||
p.FrontLights = b[0]
|
||||
p.RearLights = b[1]
|
||||
p.Steering = b[2]
|
||||
|
@ -2364,6 +2421,9 @@ func (p *FlightComputerHvBoardDisconnectCounts) MarshalPacket() ([]byte, error)
|
|||
}
|
||||
|
||||
func (p *FlightComputerHvBoardDisconnectCounts) UnmarshalPacket(b []byte) error {
|
||||
if len(b) != 6 {
|
||||
return &BadLengthError{expected: 6, actual: uint32(len(b))}
|
||||
}
|
||||
p.Bms = b[0]
|
||||
p.Charger = b[1]
|
||||
p.Wsl = b[2]
|
||||
|
@ -2511,6 +2571,9 @@ func (p *FlightComputerInternalState) MarshalPacket() ([]byte, error) {
|
|||
}
|
||||
|
||||
func (p *FlightComputerInternalState) UnmarshalPacket(b []byte) error {
|
||||
if len(b) != 5 {
|
||||
return &BadLengthError{expected: 5, actual: uint32(len(b))}
|
||||
}
|
||||
p.Bms.UnmarshalByte(b[0])
|
||||
p.Charger.UnmarshalByte(b[1])
|
||||
p.Photon3.UnmarshalByte(b[2])
|
||||
|
@ -2553,6 +2616,9 @@ func (p *PowerToDrive) MarshalPacket() ([]byte, error) {
|
|||
}
|
||||
|
||||
func (p *PowerToDrive) UnmarshalPacket(b []byte) error {
|
||||
if len(b) != 6 {
|
||||
return &BadLengthError{expected: 6, actual: uint32(len(b))}
|
||||
}
|
||||
p.MovingAverage100 = int16(binary.LittleEndian.Uint16(b[0:]))
|
||||
p.MovingAverage1K = int16(binary.LittleEndian.Uint16(b[2:]))
|
||||
p.MovingAverage10K = int16(binary.LittleEndian.Uint16(b[4:]))
|
||||
|
@ -2595,6 +2661,9 @@ func (p *ArrayPower) MarshalPacket() ([]byte, error) {
|
|||
}
|
||||
|
||||
func (p *ArrayPower) UnmarshalPacket(b []byte) error {
|
||||
if len(b) != 8 {
|
||||
return &BadLengthError{expected: 8, actual: uint32(len(b))}
|
||||
}
|
||||
p.FrontArrayChannel0 = binary.LittleEndian.Uint16(b[0:])
|
||||
p.FrontArrayChannel1 = binary.LittleEndian.Uint16(b[2:])
|
||||
p.RearArrayChannel0 = binary.LittleEndian.Uint16(b[4:])
|
||||
|
@ -2633,6 +2702,9 @@ func (p *ArrayEnergy) MarshalPacket() ([]byte, error) {
|
|||
}
|
||||
|
||||
func (p *ArrayEnergy) UnmarshalPacket(b []byte) error {
|
||||
if len(b) != 4 {
|
||||
return &BadLengthError{expected: 4, actual: uint32(len(b))}
|
||||
}
|
||||
p.Energy = float32FromBytes(b[0:], false)
|
||||
|
||||
return nil
|
||||
|
@ -2668,6 +2740,9 @@ func (p *ArrayEnergyReset) MarshalPacket() ([]byte, error) {
|
|||
}
|
||||
|
||||
func (p *ArrayEnergyReset) UnmarshalPacket(b []byte) error {
|
||||
if len(b) != 4 {
|
||||
return &BadLengthError{expected: 4, actual: uint32(len(b))}
|
||||
}
|
||||
p.Energy = float32FromBytes(b[0:], false)
|
||||
|
||||
return nil
|
||||
|
@ -2738,6 +2813,9 @@ func (p *VisionTurnSignalsCommand) MarshalPacket() ([]byte, error) {
|
|||
}
|
||||
|
||||
func (p *VisionTurnSignalsCommand) UnmarshalPacket(b []byte) error {
|
||||
if len(b) != 1 {
|
||||
return &BadLengthError{expected: 1, actual: uint32(len(b))}
|
||||
}
|
||||
p.Lights.UnmarshalByte(b[0])
|
||||
|
||||
return nil
|
||||
|
@ -2803,6 +2881,9 @@ func (p *VisionBrakeLightsCommand) MarshalPacket() ([]byte, error) {
|
|||
}
|
||||
|
||||
func (p *VisionBrakeLightsCommand) UnmarshalPacket(b []byte) error {
|
||||
if len(b) != 1 {
|
||||
return &BadLengthError{expected: 1, actual: uint32(len(b))}
|
||||
}
|
||||
p.Lights.UnmarshalByte(b[0])
|
||||
|
||||
return nil
|
||||
|
@ -2875,6 +2956,9 @@ func (p *VisionHeadlightsCommand) MarshalPacket() ([]byte, error) {
|
|||
}
|
||||
|
||||
func (p *VisionHeadlightsCommand) UnmarshalPacket(b []byte) error {
|
||||
if len(b) != 5 {
|
||||
return &BadLengthError{expected: 5, actual: uint32(len(b))}
|
||||
}
|
||||
p.Lights.UnmarshalByte(b[0])
|
||||
p.Brightness = float32FromBytes(b[1:], false)
|
||||
|
||||
|
@ -2931,6 +3015,9 @@ func (p *VisionHornCommand) MarshalPacket() ([]byte, error) {
|
|||
}
|
||||
|
||||
func (p *VisionHornCommand) UnmarshalPacket(b []byte) error {
|
||||
if len(b) != 1 {
|
||||
return &BadLengthError{expected: 1, actual: uint32(len(b))}
|
||||
}
|
||||
p.Horn.UnmarshalByte(b[0])
|
||||
|
||||
return nil
|
||||
|
@ -2986,6 +3073,9 @@ func (p *VisionArrayLatchesCommand) MarshalPacket() ([]byte, error) {
|
|||
}
|
||||
|
||||
func (p *VisionArrayLatchesCommand) UnmarshalPacket(b []byte) error {
|
||||
if len(b) != 1 {
|
||||
return &BadLengthError{expected: 1, actual: uint32(len(b))}
|
||||
}
|
||||
p.ArrayLatches.UnmarshalByte(b[0])
|
||||
|
||||
return nil
|
||||
|
@ -3046,6 +3136,9 @@ func (p *VisionRearviewCommand) MarshalPacket() ([]byte, error) {
|
|||
}
|
||||
|
||||
func (p *VisionRearviewCommand) UnmarshalPacket(b []byte) error {
|
||||
if len(b) != 1 {
|
||||
return &BadLengthError{expected: 1, actual: uint32(len(b))}
|
||||
}
|
||||
p.Cameras.UnmarshalByte(b[0])
|
||||
|
||||
return nil
|
||||
|
@ -3085,6 +3178,9 @@ func (p *TrackerEnable) MarshalPacket() ([]byte, error) {
|
|||
}
|
||||
|
||||
func (p *TrackerEnable) UnmarshalPacket(b []byte) error {
|
||||
if len(b) != 1 {
|
||||
return &BadLengthError{expected: 1, actual: uint32(len(b))}
|
||||
}
|
||||
p.Enable = b[0]
|
||||
|
||||
return nil
|
||||
|
@ -3120,6 +3216,9 @@ func (p *DistanceTraveled) MarshalPacket() ([]byte, error) {
|
|||
}
|
||||
|
||||
func (p *DistanceTraveled) UnmarshalPacket(b []byte) error {
|
||||
if len(b) != 4 {
|
||||
return &BadLengthError{expected: 4, actual: uint32(len(b))}
|
||||
}
|
||||
p.TripDistance = float32FromBytes(b[0:], false)
|
||||
|
||||
return nil
|
||||
|
@ -3229,6 +3328,9 @@ func (p *ChargerState) MarshalPacket() ([]byte, error) {
|
|||
}
|
||||
|
||||
func (p *ChargerState) UnmarshalPacket(b []byte) error {
|
||||
if len(b) != 8 {
|
||||
return &BadLengthError{expected: 8, actual: uint32(len(b))}
|
||||
}
|
||||
p.StateFlags.UnmarshalByte(b[0])
|
||||
p.ChargerMaxTemp = binary.LittleEndian.Uint16(b[1:])
|
||||
p.Fault.UnmarshalByte(b[3])
|
||||
|
@ -3282,6 +3384,9 @@ func (p *ChargerBmsRequest) MarshalPacket() ([]byte, error) {
|
|||
}
|
||||
|
||||
func (p *ChargerBmsRequest) UnmarshalPacket(b []byte) error {
|
||||
if len(b) != 1 {
|
||||
return &BadLengthError{expected: 1, actual: uint32(len(b))}
|
||||
}
|
||||
p.RequestFlags.UnmarshalByte(b[0])
|
||||
|
||||
return nil
|
||||
|
@ -3320,6 +3425,9 @@ func (p *ChargerCurrentVoltage) MarshalPacket() ([]byte, error) {
|
|||
}
|
||||
|
||||
func (p *ChargerCurrentVoltage) UnmarshalPacket(b []byte) error {
|
||||
if len(b) != 8 {
|
||||
return &BadLengthError{expected: 8, actual: uint32(len(b))}
|
||||
}
|
||||
p.MaxCurrent = float32FromBytes(b[0:], false)
|
||||
p.MaxCapacity = float32FromBytes(b[4:], false)
|
||||
|
||||
|
@ -3356,6 +3464,9 @@ func (p *ChargerPower) MarshalPacket() ([]byte, error) {
|
|||
}
|
||||
|
||||
func (p *ChargerPower) UnmarshalPacket(b []byte) error {
|
||||
if len(b) != 4 {
|
||||
return &BadLengthError{expected: 4, actual: uint32(len(b))}
|
||||
}
|
||||
p.Power = float32FromBytes(b[0:], false)
|
||||
|
||||
return nil
|
||||
|
@ -3403,6 +3514,9 @@ func (p *ThunderstruckControlMessage) MarshalPacket() ([]byte, error) {
|
|||
}
|
||||
|
||||
func (p *ThunderstruckControlMessage) UnmarshalPacket(b []byte) error {
|
||||
if len(b) != 8 {
|
||||
return &BadLengthError{expected: 8, actual: uint32(len(b))}
|
||||
}
|
||||
p.Enable = b[0]
|
||||
p.CHARGEVOLTAGE = binary.LittleEndian.Uint16(b[1:])
|
||||
p.CHARGECURRENT = binary.LittleEndian.Uint16(b[3:])
|
||||
|
@ -3576,6 +3690,9 @@ func (p *VisionStatusFront) MarshalPacket() ([]byte, error) {
|
|||
}
|
||||
|
||||
func (p *VisionStatusFront) UnmarshalPacket(b []byte) error {
|
||||
if len(b) != 4 {
|
||||
return &BadLengthError{expected: 4, actual: uint32(len(b))}
|
||||
}
|
||||
p.Lights.UnmarshalByte(b[0])
|
||||
p.Horn.UnmarshalByte(b[1])
|
||||
p.Cameras.UnmarshalByte(b[2])
|
||||
|
@ -3748,6 +3865,9 @@ func (p *VisionStatusRear) MarshalPacket() ([]byte, error) {
|
|||
}
|
||||
|
||||
func (p *VisionStatusRear) UnmarshalPacket(b []byte) error {
|
||||
if len(b) != 4 {
|
||||
return &BadLengthError{expected: 4, actual: uint32(len(b))}
|
||||
}
|
||||
p.Lights.UnmarshalByte(b[0])
|
||||
p.Horn.UnmarshalByte(b[1])
|
||||
p.Cameras.UnmarshalByte(b[2])
|
||||
|
@ -3793,6 +3913,9 @@ func (p *LightsFrontId) MarshalPacket() ([]byte, error) {
|
|||
}
|
||||
|
||||
func (p *LightsFrontId) UnmarshalPacket(b []byte) error {
|
||||
if len(b) != 8 {
|
||||
return &BadLengthError{expected: 8, actual: uint32(len(b))}
|
||||
}
|
||||
p.BoardId = binary.LittleEndian.Uint16(b[0:])
|
||||
p.McuTemp = int16(binary.LittleEndian.Uint16(b[2:]))
|
||||
p.BusVoltage = binary.LittleEndian.Uint16(b[4:])
|
||||
|
@ -3838,6 +3961,9 @@ func (p *LightsBackId) MarshalPacket() ([]byte, error) {
|
|||
}
|
||||
|
||||
func (p *LightsBackId) UnmarshalPacket(b []byte) error {
|
||||
if len(b) != 8 {
|
||||
return &BadLengthError{expected: 8, actual: uint32(len(b))}
|
||||
}
|
||||
p.BoardId = binary.LittleEndian.Uint16(b[0:])
|
||||
p.McuTemp = int16(binary.LittleEndian.Uint16(b[2:]))
|
||||
p.BusVoltage = binary.LittleEndian.Uint16(b[4:])
|
||||
|
@ -3883,6 +4009,9 @@ func (p *VisionId) MarshalPacket() ([]byte, error) {
|
|||
}
|
||||
|
||||
func (p *VisionId) UnmarshalPacket(b []byte) error {
|
||||
if len(b) != 8 {
|
||||
return &BadLengthError{expected: 8, actual: uint32(len(b))}
|
||||
}
|
||||
p.BoardId = binary.LittleEndian.Uint16(b[0:])
|
||||
p.McuTemp = int16(binary.LittleEndian.Uint16(b[2:]))
|
||||
p.BusVoltage = binary.LittleEndian.Uint16(b[4:])
|
||||
|
@ -3932,6 +4061,9 @@ func (p *SteeringPressCount1) MarshalPacket() ([]byte, error) {
|
|||
}
|
||||
|
||||
func (p *SteeringPressCount1) UnmarshalPacket(b []byte) error {
|
||||
if len(b) != 7 {
|
||||
return &BadLengthError{expected: 7, actual: uint32(len(b))}
|
||||
}
|
||||
p.Button0 = b[0]
|
||||
p.Button1 = b[1]
|
||||
p.Button2 = b[2]
|
||||
|
@ -3978,6 +4110,9 @@ func (p *SteeringPressCount2) MarshalPacket() ([]byte, error) {
|
|||
}
|
||||
|
||||
func (p *SteeringPressCount2) UnmarshalPacket(b []byte) error {
|
||||
if len(b) != 4 {
|
||||
return &BadLengthError{expected: 4, actual: uint32(len(b))}
|
||||
}
|
||||
p.Button7 = b[0]
|
||||
p.Button8 = b[1]
|
||||
p.Button9 = b[2]
|
||||
|
@ -4027,6 +4162,9 @@ func (p *SteeringButtonColors1) MarshalPacket() ([]byte, error) {
|
|||
}
|
||||
|
||||
func (p *SteeringButtonColors1) UnmarshalPacket(b []byte) error {
|
||||
if len(b) != 7 {
|
||||
return &BadLengthError{expected: 7, actual: uint32(len(b))}
|
||||
}
|
||||
p.Button0 = b[0]
|
||||
p.Button1 = b[1]
|
||||
p.Button2 = b[2]
|
||||
|
@ -4073,6 +4211,9 @@ func (p *SteeringButtonColors2) MarshalPacket() ([]byte, error) {
|
|||
}
|
||||
|
||||
func (p *SteeringButtonColors2) UnmarshalPacket(b []byte) error {
|
||||
if len(b) != 4 {
|
||||
return &BadLengthError{expected: 4, actual: uint32(len(b))}
|
||||
}
|
||||
p.Button7 = b[0]
|
||||
p.Button8 = b[1]
|
||||
p.Button9 = b[2]
|
||||
|
@ -4110,6 +4251,9 @@ func (p *SteeringHorn) MarshalPacket() ([]byte, error) {
|
|||
}
|
||||
|
||||
func (p *SteeringHorn) UnmarshalPacket(b []byte) error {
|
||||
if len(b) != 1 {
|
||||
return &BadLengthError{expected: 1, actual: uint32(len(b))}
|
||||
}
|
||||
p.Horn = b[0]
|
||||
|
||||
return nil
|
||||
|
@ -4160,6 +4304,9 @@ func (p *ThunderstruckStatusMessage) MarshalPacket() ([]byte, error) {
|
|||
}
|
||||
|
||||
func (p *ThunderstruckStatusMessage) UnmarshalPacket(b []byte) error {
|
||||
if len(b) != 8 {
|
||||
return &BadLengthError{expected: 8, actual: uint32(len(b))}
|
||||
}
|
||||
p.STATUSFLAGS = b[0]
|
||||
p.CHARGEFLAGS = b[1]
|
||||
p.OUTPUTVOLTAGE = binary.LittleEndian.Uint16(b[2:])
|
||||
|
@ -4214,6 +4361,9 @@ func (p *TrackerData) MarshalPacket() ([]byte, error) {
|
|||
}
|
||||
|
||||
func (p *TrackerData) UnmarshalPacket(b []byte) error {
|
||||
if len(b) != 8 {
|
||||
return &BadLengthError{expected: 8, actual: uint32(len(b))}
|
||||
}
|
||||
p.ArrayVoltage = binary.LittleEndian.Uint16(b[0:])
|
||||
p.ArrayCurrent = binary.LittleEndian.Uint16(b[2:])
|
||||
p.BatteryVoltage = binary.LittleEndian.Uint16(b[4:])
|
||||
|
@ -4253,6 +4403,9 @@ func (p *TritiumMotorDriveL) MarshalPacket() ([]byte, error) {
|
|||
}
|
||||
|
||||
func (p *TritiumMotorDriveL) UnmarshalPacket(b []byte) error {
|
||||
if len(b) != 8 {
|
||||
return &BadLengthError{expected: 8, actual: uint32(len(b))}
|
||||
}
|
||||
p.MotorVelocity = float32FromBytes(b[0:], false)
|
||||
p.MotorCurrent = float32FromBytes(b[4:], false)
|
||||
|
||||
|
@ -4290,6 +4443,9 @@ func (p *TritiumMotorPowerL) MarshalPacket() ([]byte, error) {
|
|||
}
|
||||
|
||||
func (p *TritiumMotorPowerL) UnmarshalPacket(b []byte) error {
|
||||
if len(b) != 8 {
|
||||
return &BadLengthError{expected: 8, actual: uint32(len(b))}
|
||||
}
|
||||
p.Reserved = float32FromBytes(b[0:], false)
|
||||
p.BusCurrent = float32FromBytes(b[4:], false)
|
||||
|
||||
|
@ -4327,6 +4483,9 @@ func (p *TritiumResetL) MarshalPacket() ([]byte, error) {
|
|||
}
|
||||
|
||||
func (p *TritiumResetL) UnmarshalPacket(b []byte) error {
|
||||
if len(b) != 8 {
|
||||
return &BadLengthError{expected: 8, actual: uint32(len(b))}
|
||||
}
|
||||
p.Unused1 = float32FromBytes(b[0:], false)
|
||||
p.Unused2 = float32FromBytes(b[4:], false)
|
||||
|
||||
|
@ -4364,6 +4523,9 @@ func (p *TritiumMotorDriveR) MarshalPacket() ([]byte, error) {
|
|||
}
|
||||
|
||||
func (p *TritiumMotorDriveR) UnmarshalPacket(b []byte) error {
|
||||
if len(b) != 8 {
|
||||
return &BadLengthError{expected: 8, actual: uint32(len(b))}
|
||||
}
|
||||
p.MotorVelocity = float32FromBytes(b[0:], false)
|
||||
p.MotorCurrent = float32FromBytes(b[4:], false)
|
||||
|
||||
|
@ -4401,6 +4563,9 @@ func (p *TritiumMotorPowerR) MarshalPacket() ([]byte, error) {
|
|||
}
|
||||
|
||||
func (p *TritiumMotorPowerR) UnmarshalPacket(b []byte) error {
|
||||
if len(b) != 8 {
|
||||
return &BadLengthError{expected: 8, actual: uint32(len(b))}
|
||||
}
|
||||
p.Reserved = float32FromBytes(b[0:], false)
|
||||
p.BusCurrent = float32FromBytes(b[4:], false)
|
||||
|
||||
|
@ -4438,6 +4603,9 @@ func (p *TritiumResetR) MarshalPacket() ([]byte, error) {
|
|||
}
|
||||
|
||||
func (p *TritiumResetR) UnmarshalPacket(b []byte) error {
|
||||
if len(b) != 8 {
|
||||
return &BadLengthError{expected: 8, actual: uint32(len(b))}
|
||||
}
|
||||
p.Unused1 = float32FromBytes(b[0:], false)
|
||||
p.Unused2 = float32FromBytes(b[4:], false)
|
||||
|
||||
|
@ -4473,6 +4641,9 @@ func (p *BmsAhSet) MarshalPacket() ([]byte, error) {
|
|||
}
|
||||
|
||||
func (p *BmsAhSet) UnmarshalPacket(b []byte) error {
|
||||
if len(b) != 4 {
|
||||
return &BadLengthError{expected: 4, actual: uint32(len(b))}
|
||||
}
|
||||
p.Ah = binary.LittleEndian.Uint32(b[0:])
|
||||
|
||||
return nil
|
||||
|
@ -4507,6 +4678,9 @@ func (p *BmsWhSet) MarshalPacket() ([]byte, error) {
|
|||
}
|
||||
|
||||
func (p *BmsWhSet) UnmarshalPacket(b []byte) error {
|
||||
if len(b) != 4 {
|
||||
return &BadLengthError{expected: 4, actual: uint32(len(b))}
|
||||
}
|
||||
p.Wh = binary.LittleEndian.Uint32(b[0:])
|
||||
|
||||
return nil
|
||||
|
@ -4557,6 +4731,9 @@ func (p *BmsKill) MarshalPacket() ([]byte, error) {
|
|||
}
|
||||
|
||||
func (p *BmsKill) UnmarshalPacket(b []byte) error {
|
||||
if len(b) != 1 {
|
||||
return &BadLengthError{expected: 1, actual: uint32(len(b))}
|
||||
}
|
||||
p.KillType.UnmarshalByte(b[0])
|
||||
|
||||
return nil
|
||||
|
@ -4601,6 +4778,9 @@ func (p *TelemetryRtcReset) MarshalPacket() ([]byte, error) {
|
|||
}
|
||||
|
||||
func (p *TelemetryRtcReset) UnmarshalPacket(b []byte) error {
|
||||
if len(b) != 6 {
|
||||
return &BadLengthError{expected: 6, actual: uint32(len(b))}
|
||||
}
|
||||
p.Year = b[0]
|
||||
p.Month = b[1]
|
||||
p.Day = b[2]
|
||||
|
@ -4642,6 +4822,9 @@ func (p *WsrIdentification) MarshalPacket() ([]byte, error) {
|
|||
}
|
||||
|
||||
func (p *WsrIdentification) UnmarshalPacket(b []byte) error {
|
||||
if len(b) != 8 {
|
||||
return &BadLengthError{expected: 8, actual: uint32(len(b))}
|
||||
}
|
||||
p.TritiumId = binary.LittleEndian.Uint32(b[0:])
|
||||
p.SerialNumber = binary.LittleEndian.Uint32(b[4:])
|
||||
|
||||
|
@ -4840,6 +5023,9 @@ func (p *WsrStatusInformation) MarshalPacket() ([]byte, error) {
|
|||
}
|
||||
|
||||
func (p *WsrStatusInformation) UnmarshalPacket(b []byte) error {
|
||||
if len(b) != 8 {
|
||||
return &BadLengthError{expected: 8, actual: uint32(len(b))}
|
||||
}
|
||||
p.LimitFlags.UnmarshalByte(b[0])
|
||||
p.LimitFlagsReserved = b[1]
|
||||
p.ErrorFlags0.UnmarshalByte(b[2])
|
||||
|
@ -4883,6 +5069,9 @@ func (p *WsrBusMeasurement) MarshalPacket() ([]byte, error) {
|
|||
}
|
||||
|
||||
func (p *WsrBusMeasurement) UnmarshalPacket(b []byte) error {
|
||||
if len(b) != 8 {
|
||||
return &BadLengthError{expected: 8, actual: uint32(len(b))}
|
||||
}
|
||||
p.BusVoltage = float32FromBytes(b[0:], false)
|
||||
p.BusCurrent = float32FromBytes(b[4:], false)
|
||||
|
||||
|
@ -4922,6 +5111,9 @@ func (p *WsrVelocity) MarshalPacket() ([]byte, error) {
|
|||
}
|
||||
|
||||
func (p *WsrVelocity) UnmarshalPacket(b []byte) error {
|
||||
if len(b) != 8 {
|
||||
return &BadLengthError{expected: 8, actual: uint32(len(b))}
|
||||
}
|
||||
p.MotorVelocity = float32FromBytes(b[0:], false)
|
||||
p.VehicleVelocity = float32FromBytes(b[4:], false)
|
||||
|
||||
|
@ -4961,6 +5153,9 @@ func (p *WsrPhaseCurrent) MarshalPacket() ([]byte, error) {
|
|||
}
|
||||
|
||||
func (p *WsrPhaseCurrent) UnmarshalPacket(b []byte) error {
|
||||
if len(b) != 8 {
|
||||
return &BadLengthError{expected: 8, actual: uint32(len(b))}
|
||||
}
|
||||
p.PhaseBCurrent = float32FromBytes(b[0:], false)
|
||||
p.PhaseCCurrent = float32FromBytes(b[4:], false)
|
||||
|
||||
|
@ -5000,6 +5195,9 @@ func (p *WsrMotorVoltageVector) MarshalPacket() ([]byte, error) {
|
|||
}
|
||||
|
||||
func (p *WsrMotorVoltageVector) UnmarshalPacket(b []byte) error {
|
||||
if len(b) != 8 {
|
||||
return &BadLengthError{expected: 8, actual: uint32(len(b))}
|
||||
}
|
||||
p.Vq = float32FromBytes(b[0:], false)
|
||||
p.Vd = float32FromBytes(b[4:], false)
|
||||
|
||||
|
@ -5039,6 +5237,9 @@ func (p *WsrMotorCurrentVector) MarshalPacket() ([]byte, error) {
|
|||
}
|
||||
|
||||
func (p *WsrMotorCurrentVector) UnmarshalPacket(b []byte) error {
|
||||
if len(b) != 8 {
|
||||
return &BadLengthError{expected: 8, actual: uint32(len(b))}
|
||||
}
|
||||
p.Iq = float32FromBytes(b[0:], false)
|
||||
p.Id = float32FromBytes(b[4:], false)
|
||||
|
||||
|
@ -5078,6 +5279,9 @@ func (p *WsrMotorBackemf) MarshalPacket() ([]byte, error) {
|
|||
}
|
||||
|
||||
func (p *WsrMotorBackemf) UnmarshalPacket(b []byte) error {
|
||||
if len(b) != 8 {
|
||||
return &BadLengthError{expected: 8, actual: uint32(len(b))}
|
||||
}
|
||||
p.Bemfq = float32FromBytes(b[0:], false)
|
||||
p.Bemfd = float32FromBytes(b[4:], false)
|
||||
|
||||
|
@ -5117,6 +5321,9 @@ func (p *Wsr15165VoltageRail) MarshalPacket() ([]byte, error) {
|
|||
}
|
||||
|
||||
func (p *Wsr15165VoltageRail) UnmarshalPacket(b []byte) error {
|
||||
if len(b) != 8 {
|
||||
return &BadLengthError{expected: 8, actual: uint32(len(b))}
|
||||
}
|
||||
p.Reference165V = float32FromBytes(b[0:], false)
|
||||
p.Supply15V = float32FromBytes(b[4:], false)
|
||||
|
||||
|
@ -5156,6 +5363,9 @@ func (p *Wsr2512VoltageRail) MarshalPacket() ([]byte, error) {
|
|||
}
|
||||
|
||||
func (p *Wsr2512VoltageRail) UnmarshalPacket(b []byte) error {
|
||||
if len(b) != 8 {
|
||||
return &BadLengthError{expected: 8, actual: uint32(len(b))}
|
||||
}
|
||||
p.Supply12V = float32FromBytes(b[0:], false)
|
||||
p.Supply25V = float32FromBytes(b[4:], false)
|
||||
|
||||
|
@ -5195,6 +5405,9 @@ func (p *WsrHeatsinkMotorTemp) MarshalPacket() ([]byte, error) {
|
|||
}
|
||||
|
||||
func (p *WsrHeatsinkMotorTemp) UnmarshalPacket(b []byte) error {
|
||||
if len(b) != 8 {
|
||||
return &BadLengthError{expected: 8, actual: uint32(len(b))}
|
||||
}
|
||||
p.MotorTemp = float32FromBytes(b[0:], false)
|
||||
p.HeatsinkTemp = float32FromBytes(b[4:], false)
|
||||
|
||||
|
@ -5234,6 +5447,9 @@ func (p *WsrDspBoardTemp) MarshalPacket() ([]byte, error) {
|
|||
}
|
||||
|
||||
func (p *WsrDspBoardTemp) UnmarshalPacket(b []byte) error {
|
||||
if len(b) != 8 {
|
||||
return &BadLengthError{expected: 8, actual: uint32(len(b))}
|
||||
}
|
||||
p.DspBoardTemp = float32FromBytes(b[0:], false)
|
||||
p.Reserved = float32FromBytes(b[4:], false)
|
||||
|
||||
|
@ -5271,6 +5487,9 @@ func (p *WsrReserved) MarshalPacket() ([]byte, error) {
|
|||
}
|
||||
|
||||
func (p *WsrReserved) UnmarshalPacket(b []byte) error {
|
||||
if len(b) != 8 {
|
||||
return &BadLengthError{expected: 8, actual: uint32(len(b))}
|
||||
}
|
||||
p.Reserved0 = float32FromBytes(b[0:], false)
|
||||
p.Reserved1 = float32FromBytes(b[4:], false)
|
||||
|
||||
|
@ -5310,6 +5529,9 @@ func (p *WsrOdometerBusAmphoursMeasurement) MarshalPacket() ([]byte, error) {
|
|||
}
|
||||
|
||||
func (p *WsrOdometerBusAmphoursMeasurement) UnmarshalPacket(b []byte) error {
|
||||
if len(b) != 8 {
|
||||
return &BadLengthError{expected: 8, actual: uint32(len(b))}
|
||||
}
|
||||
p.Odometer = float32FromBytes(b[0:], false)
|
||||
p.DcBusAmphours = float32FromBytes(b[4:], false)
|
||||
|
||||
|
@ -5349,6 +5571,9 @@ func (p *WsrSlipSpeedMeasurement) MarshalPacket() ([]byte, error) {
|
|||
}
|
||||
|
||||
func (p *WsrSlipSpeedMeasurement) UnmarshalPacket(b []byte) error {
|
||||
if len(b) != 8 {
|
||||
return &BadLengthError{expected: 8, actual: uint32(len(b))}
|
||||
}
|
||||
p.Reserved = float32FromBytes(b[0:], false)
|
||||
p.SlipSpeed = float32FromBytes(b[4:], false)
|
||||
|
||||
|
@ -5386,6 +5611,9 @@ func (p *WslIdentification) MarshalPacket() ([]byte, error) {
|
|||
}
|
||||
|
||||
func (p *WslIdentification) UnmarshalPacket(b []byte) error {
|
||||
if len(b) != 8 {
|
||||
return &BadLengthError{expected: 8, actual: uint32(len(b))}
|
||||
}
|
||||
p.TritiumId = binary.LittleEndian.Uint32(b[0:])
|
||||
p.SerialNumber = binary.LittleEndian.Uint32(b[4:])
|
||||
|
||||
|
@ -5584,6 +5812,9 @@ func (p *WslStatusInformation) MarshalPacket() ([]byte, error) {
|
|||
}
|
||||
|
||||
func (p *WslStatusInformation) UnmarshalPacket(b []byte) error {
|
||||
if len(b) != 8 {
|
||||
return &BadLengthError{expected: 8, actual: uint32(len(b))}
|
||||
}
|
||||
p.LimitFlags.UnmarshalByte(b[0])
|
||||
p.LimitFlagsReserved = b[1]
|
||||
p.ErrorFlags0.UnmarshalByte(b[2])
|
||||
|
@ -5627,6 +5858,9 @@ func (p *WslBusMeasurement) MarshalPacket() ([]byte, error) {
|
|||
}
|
||||
|
||||
func (p *WslBusMeasurement) UnmarshalPacket(b []byte) error {
|
||||
if len(b) != 8 {
|
||||
return &BadLengthError{expected: 8, actual: uint32(len(b))}
|
||||
}
|
||||
p.BusVoltage = float32FromBytes(b[0:], false)
|
||||
p.BusCurrent = float32FromBytes(b[4:], false)
|
||||
|
||||
|
@ -5666,6 +5900,9 @@ func (p *WslVelocity) MarshalPacket() ([]byte, error) {
|
|||
}
|
||||
|
||||
func (p *WslVelocity) UnmarshalPacket(b []byte) error {
|
||||
if len(b) != 8 {
|
||||
return &BadLengthError{expected: 8, actual: uint32(len(b))}
|
||||
}
|
||||
p.MotorVelocity = float32FromBytes(b[0:], false)
|
||||
p.VehicleVelocity = float32FromBytes(b[4:], false)
|
||||
|
||||
|
@ -5705,6 +5942,9 @@ func (p *WslPhaseCurrent) MarshalPacket() ([]byte, error) {
|
|||
}
|
||||
|
||||
func (p *WslPhaseCurrent) UnmarshalPacket(b []byte) error {
|
||||
if len(b) != 8 {
|
||||
return &BadLengthError{expected: 8, actual: uint32(len(b))}
|
||||
}
|
||||
p.PhaseBCurrent = float32FromBytes(b[0:], false)
|
||||
p.PhaseCCurrent = float32FromBytes(b[4:], false)
|
||||
|
||||
|
@ -5744,6 +5984,9 @@ func (p *WslMotorVoltageVector) MarshalPacket() ([]byte, error) {
|
|||
}
|
||||
|
||||
func (p *WslMotorVoltageVector) UnmarshalPacket(b []byte) error {
|
||||
if len(b) != 8 {
|
||||
return &BadLengthError{expected: 8, actual: uint32(len(b))}
|
||||
}
|
||||
p.Vq = float32FromBytes(b[0:], false)
|
||||
p.Vd = float32FromBytes(b[4:], false)
|
||||
|
||||
|
@ -5783,6 +6026,9 @@ func (p *WslMotorCurrentVector) MarshalPacket() ([]byte, error) {
|
|||
}
|
||||
|
||||
func (p *WslMotorCurrentVector) UnmarshalPacket(b []byte) error {
|
||||
if len(b) != 8 {
|
||||
return &BadLengthError{expected: 8, actual: uint32(len(b))}
|
||||
}
|
||||
p.Iq = float32FromBytes(b[0:], false)
|
||||
p.Id = float32FromBytes(b[4:], false)
|
||||
|
||||
|
@ -5822,6 +6068,9 @@ func (p *WslMotorBackemf) MarshalPacket() ([]byte, error) {
|
|||
}
|
||||
|
||||
func (p *WslMotorBackemf) UnmarshalPacket(b []byte) error {
|
||||
if len(b) != 8 {
|
||||
return &BadLengthError{expected: 8, actual: uint32(len(b))}
|
||||
}
|
||||
p.Bemfq = float32FromBytes(b[0:], false)
|
||||
p.Bemfd = float32FromBytes(b[4:], false)
|
||||
|
||||
|
@ -5861,6 +6110,9 @@ func (p *Wsl15165VoltageRail) MarshalPacket() ([]byte, error) {
|
|||
}
|
||||
|
||||
func (p *Wsl15165VoltageRail) UnmarshalPacket(b []byte) error {
|
||||
if len(b) != 8 {
|
||||
return &BadLengthError{expected: 8, actual: uint32(len(b))}
|
||||
}
|
||||
p.Reference165V = float32FromBytes(b[0:], false)
|
||||
p.Supply15V = float32FromBytes(b[4:], false)
|
||||
|
||||
|
@ -5900,6 +6152,9 @@ func (p *Wsl2512VoltageRail) MarshalPacket() ([]byte, error) {
|
|||
}
|
||||
|
||||
func (p *Wsl2512VoltageRail) UnmarshalPacket(b []byte) error {
|
||||
if len(b) != 8 {
|
||||
return &BadLengthError{expected: 8, actual: uint32(len(b))}
|
||||
}
|
||||
p.Supply12V = float32FromBytes(b[0:], false)
|
||||
p.Supply25V = float32FromBytes(b[4:], false)
|
||||
|
||||
|
@ -5939,6 +6194,9 @@ func (p *WslHeatsinkMotorTemp) MarshalPacket() ([]byte, error) {
|
|||
}
|
||||
|
||||
func (p *WslHeatsinkMotorTemp) UnmarshalPacket(b []byte) error {
|
||||
if len(b) != 8 {
|
||||
return &BadLengthError{expected: 8, actual: uint32(len(b))}
|
||||
}
|
||||
p.MotorTemp = float32FromBytes(b[0:], false)
|
||||
p.HeatsinkTemp = float32FromBytes(b[4:], false)
|
||||
|
||||
|
@ -5978,6 +6236,9 @@ func (p *WslDspBoardTemp) MarshalPacket() ([]byte, error) {
|
|||
}
|
||||
|
||||
func (p *WslDspBoardTemp) UnmarshalPacket(b []byte) error {
|
||||
if len(b) != 8 {
|
||||
return &BadLengthError{expected: 8, actual: uint32(len(b))}
|
||||
}
|
||||
p.DspBoardTemp = float32FromBytes(b[0:], false)
|
||||
p.Reserved = float32FromBytes(b[4:], false)
|
||||
|
||||
|
@ -6017,6 +6278,9 @@ func (p *WslOdometerBusAmphoursMeasurement) MarshalPacket() ([]byte, error) {
|
|||
}
|
||||
|
||||
func (p *WslOdometerBusAmphoursMeasurement) UnmarshalPacket(b []byte) error {
|
||||
if len(b) != 8 {
|
||||
return &BadLengthError{expected: 8, actual: uint32(len(b))}
|
||||
}
|
||||
p.Odometer = float32FromBytes(b[0:], false)
|
||||
p.DcBusAmphours = float32FromBytes(b[4:], false)
|
||||
|
||||
|
@ -6054,6 +6318,9 @@ func (p *WslReserved) MarshalPacket() ([]byte, error) {
|
|||
}
|
||||
|
||||
func (p *WslReserved) UnmarshalPacket(b []byte) error {
|
||||
if len(b) != 8 {
|
||||
return &BadLengthError{expected: 8, actual: uint32(len(b))}
|
||||
}
|
||||
p.Reserved0 = float32FromBytes(b[0:], false)
|
||||
p.Reserved1 = float32FromBytes(b[4:], false)
|
||||
|
||||
|
@ -6093,6 +6360,9 @@ func (p *WslSlipSpeedMeasurement) MarshalPacket() ([]byte, error) {
|
|||
}
|
||||
|
||||
func (p *WslSlipSpeedMeasurement) UnmarshalPacket(b []byte) error {
|
||||
if len(b) != 8 {
|
||||
return &BadLengthError{expected: 8, actual: uint32(len(b))}
|
||||
}
|
||||
p.Reserved = float32FromBytes(b[0:], false)
|
||||
p.SlipSpeed = float32FromBytes(b[4:], false)
|
||||
|
||||
|
|
|
@ -69,6 +69,9 @@ func (p *{{$structName}}) MarshalPacket() ([]byte, error) {
|
|||
}
|
||||
|
||||
func (p *{{$structName}}) UnmarshalPacket(b []byte) error {
|
||||
if len(b) != {{.CalcSize}} {
|
||||
return &BadLengthError{expected: {{.CalcSize}}, actual: uint32(len(b))}
|
||||
}
|
||||
{{.MakeUnmarshal}}
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue