|
|
|
|
@ -2,12 +2,11 @@ package main |
|
|
|
|
|
|
|
|
|
import ( |
|
|
|
|
"fmt" |
|
|
|
|
"time" |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
type ChademoEvent interface { |
|
|
|
|
// GetValue Return processed/calculated value and timestamp string
|
|
|
|
|
GetValue() (interface{}, *time.Time) |
|
|
|
|
GetValue() (interface{}, *string) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
type frame struct { |
|
|
|
|
@ -267,142 +266,142 @@ func getChargerStopControl(bytes *[]uint8) StopControl { |
|
|
|
|
return OPERATING |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (m MaximumBatteryVoltage) GetValue() (interface{}, *time.Time) { |
|
|
|
|
return bytesToUint16((*m.payload)[4:6]), m.date |
|
|
|
|
func (m MaximumBatteryVoltage) GetValue() (interface{}, *string) { |
|
|
|
|
return bytesToUint16(m.payload[4:6]), &m.date |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (c ConstChargingRateInd) GetValue() (interface{}, *time.Time) { |
|
|
|
|
return (*c.payload)[6], c.date |
|
|
|
|
func (c ConstChargingRateInd) GetValue() (interface{}, *string) { |
|
|
|
|
return c.payload[6], &c.date |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (b BatteryCapacity) GetValue() (interface{}, *time.Time) { |
|
|
|
|
return 0.1 * float32(bytesToUint16((*b.payload)[5:7])), b.date |
|
|
|
|
func (b BatteryCapacity) GetValue() (interface{}, *string) { |
|
|
|
|
return 0.1 * float32(bytesToUint16(b.payload[5:7])), &b.date |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (m MaxChargingTimeS) GetValue() (interface{}, *time.Time) { |
|
|
|
|
return 10 * uint16((*m.payload)[1]), m.date |
|
|
|
|
func (m MaxChargingTimeS) GetValue() (interface{}, *string) { |
|
|
|
|
return 10 * uint16(m.payload[1]), &m.date |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (m MaxChargingTimeM) GetValue() (interface{}, *time.Time) { |
|
|
|
|
return (*m.payload)[2], m.date |
|
|
|
|
func (m MaxChargingTimeM) GetValue() (interface{}, *string) { |
|
|
|
|
return m.payload[2], &m.date |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (e EstChargingTimeM) GetValue() (interface{}, *time.Time) { |
|
|
|
|
return (*e.payload)[3], e.date |
|
|
|
|
func (e EstChargingTimeM) GetValue() (interface{}, *string) { |
|
|
|
|
return e.payload[3], &e.date |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (c EVControlProtocolNumber) GetValue() (interface{}, *time.Time) { |
|
|
|
|
return (*c.payload)[0], c.date |
|
|
|
|
func (c EVControlProtocolNumber) GetValue() (interface{}, *string) { |
|
|
|
|
return c.payload[0], &c.date |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (t TargetBatteryVoltage) GetValue() (interface{}, *time.Time) { |
|
|
|
|
return bytesToUint16((*t.payload)[1:3]), t.date |
|
|
|
|
func (t TargetBatteryVoltage) GetValue() (interface{}, *string) { |
|
|
|
|
return bytesToUint16(t.payload[1:3]), &t.date |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (c ChargingCurrentReq) GetValue() (interface{}, *time.Time) { |
|
|
|
|
return (*c.payload)[3], c.date |
|
|
|
|
func (c ChargingCurrentReq) GetValue() (interface{}, *string) { |
|
|
|
|
return c.payload[3], &c.date |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (c ChargingRate) GetValue() (interface{}, *time.Time) { |
|
|
|
|
return (*c.payload)[6], c.date |
|
|
|
|
func (c ChargingRate) GetValue() (interface{}, *string) { |
|
|
|
|
return c.payload[6], &c.date |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (s ShiftLever) GetValue() (interface{}, *time.Time) { |
|
|
|
|
return getVehicleShiftLever(s.payload), s.date |
|
|
|
|
func (s ShiftLever) GetValue() (interface{}, *string) { |
|
|
|
|
return getVehicleShiftLever(&s.payload), &s.date |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (v VehicleCharging) GetValue() (interface{}, *time.Time) { |
|
|
|
|
return getVehicleCharging(v.payload), v.date |
|
|
|
|
func (v VehicleCharging) GetValue() (interface{}, *string) { |
|
|
|
|
return getVehicleCharging(&v.payload), &v.date |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (c ChargingSystemFault) GetValue() (interface{}, *time.Time) { |
|
|
|
|
return getFault(c.payload, 5, 2), c.date |
|
|
|
|
func (c ChargingSystemFault) GetValue() (interface{}, *string) { |
|
|
|
|
return getFault(&c.payload, 5, 2), &c.date |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (v VehicleStatus) GetValue() (interface{}, *time.Time) { |
|
|
|
|
return getVehicleStatus(v.payload), v.date |
|
|
|
|
func (v VehicleStatus) GetValue() (interface{}, *string) { |
|
|
|
|
return getVehicleStatus(&v.payload), &v.date |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (n NormalStopReq) GetValue() (interface{}, *time.Time) { |
|
|
|
|
return getNormalStopReq(n.payload), n.date |
|
|
|
|
func (n NormalStopReq) GetValue() (interface{}, *string) { |
|
|
|
|
return getNormalStopReq(&n.payload), &n.date |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (b BattOvervoltage) GetValue() (interface{}, *time.Time) { |
|
|
|
|
return getFault(b.payload, 4, 0), b.date |
|
|
|
|
func (b BattOvervoltage) GetValue() (interface{}, *string) { |
|
|
|
|
return getFault(&b.payload, 4, 0), &b.date |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (b BattUndervoltage) GetValue() (interface{}, *time.Time) { |
|
|
|
|
return getFault(b.payload, 4, 1), b.date |
|
|
|
|
func (b BattUndervoltage) GetValue() (interface{}, *string) { |
|
|
|
|
return getFault(&b.payload, 4, 1), &b.date |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (b BattCurrentDeviationErr) GetValue() (interface{}, *time.Time) { |
|
|
|
|
return getFault(b.payload, 4, 2), b.date |
|
|
|
|
func (b BattCurrentDeviationErr) GetValue() (interface{}, *string) { |
|
|
|
|
return getFault(&b.payload, 4, 2), &b.date |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (h HighBattTemperature) GetValue() (interface{}, *time.Time) { |
|
|
|
|
return getFault(h.payload, 4, 3), h.date |
|
|
|
|
func (h HighBattTemperature) GetValue() (interface{}, *string) { |
|
|
|
|
return getFault(&h.payload, 4, 3), &h.date |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (b BattVoltageDeviationErr) GetValue() (interface{}, *time.Time) { |
|
|
|
|
return getFault(b.payload, 4, 4), b.date |
|
|
|
|
func (b BattVoltageDeviationErr) GetValue() (interface{}, *string) { |
|
|
|
|
return getFault(&b.payload, 4, 4), &b.date |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (e EVcontWeldingDetectSupport) GetValue() (interface{}, *time.Time) { |
|
|
|
|
return evWeldingDetectionSupport(e.payload), e.date |
|
|
|
|
func (e EVcontWeldingDetectSupport) GetValue() (interface{}, *string) { |
|
|
|
|
return evWeldingDetectionSupport(&e.payload), &e.date |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (a AvailableOutputVoltage) GetValue() (interface{}, *time.Time) { |
|
|
|
|
return bytesToUint16((*a.payload)[1:3]), a.date |
|
|
|
|
func (a AvailableOutputVoltage) GetValue() (interface{}, *string) { |
|
|
|
|
return bytesToUint16(a.payload[1:3]), &a.date |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (a AvailableOutputCurrent) GetValue() (interface{}, *time.Time) { |
|
|
|
|
return (*a.payload)[3], a.date |
|
|
|
|
func (a AvailableOutputCurrent) GetValue() (interface{}, *string) { |
|
|
|
|
return a.payload[3], &a.date |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (t ThresholdVoltage) GetValue() (interface{}, *time.Time) { |
|
|
|
|
return bytesToUint16((*t.payload)[4:6]), t.date |
|
|
|
|
func (t ThresholdVoltage) GetValue() (interface{}, *string) { |
|
|
|
|
return bytesToUint16(t.payload[4:6]), &t.date |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (e EVSEControlProtocolNumber) GetValue() (interface{}, *time.Time) { |
|
|
|
|
return (*e.payload)[0], e.date |
|
|
|
|
func (e EVSEControlProtocolNumber) GetValue() (interface{}, *string) { |
|
|
|
|
return e.payload[0], &e.date |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (o OutputVoltage) GetValue() (interface{}, *time.Time) { |
|
|
|
|
return bytesToUint16((*o.payload)[1:3]), o.date |
|
|
|
|
func (o OutputVoltage) GetValue() (interface{}, *string) { |
|
|
|
|
return bytesToUint16(o.payload[1:3]), &o.date |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (o OutputCurrent) GetValue() (interface{}, *time.Time) { |
|
|
|
|
return (*o.payload)[3], o.date |
|
|
|
|
func (o OutputCurrent) GetValue() (interface{}, *string) { |
|
|
|
|
return o.payload[3], &o.date |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (r RemainingChargingTimeS) GetValue() (interface{}, *time.Time) { |
|
|
|
|
return (*r.payload)[6] * 10, r.date |
|
|
|
|
func (r RemainingChargingTimeS) GetValue() (interface{}, *string) { |
|
|
|
|
return r.payload[6] * 10, &r.date |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (r RemainingChargingTimeM) GetValue() (interface{}, *time.Time) { |
|
|
|
|
return (*r.payload)[7], r.date |
|
|
|
|
func (r RemainingChargingTimeM) GetValue() (interface{}, *string) { |
|
|
|
|
return r.payload[7], &r.date |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (s StationStatus) GetValue() (interface{}, *time.Time) { |
|
|
|
|
return getStationState(s.payload), s.date |
|
|
|
|
func (s StationStatus) GetValue() (interface{}, *string) { |
|
|
|
|
return getStationState(&s.payload), &s.date |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (s StationMalfunction) GetValue() (interface{}, *time.Time) { |
|
|
|
|
return getFault(s.payload, 5, 1), s.date |
|
|
|
|
func (s StationMalfunction) GetValue() (interface{}, *string) { |
|
|
|
|
return getFault(&s.payload, 5, 1), &s.date |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (v VehicleConnectorLock) GetValue() (interface{}, *time.Time) { |
|
|
|
|
return getConnectorLock(v.payload), v.date |
|
|
|
|
func (v VehicleConnectorLock) GetValue() (interface{}, *string) { |
|
|
|
|
return getConnectorLock(&v.payload), &v.date |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (b BatteryIncompatibility) GetValue() (interface{}, *time.Time) { |
|
|
|
|
return getBatteryCompatibility(b.payload), b.date |
|
|
|
|
func (b BatteryIncompatibility) GetValue() (interface{}, *string) { |
|
|
|
|
return getBatteryCompatibility(&b.payload), &b.date |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (c ChargingSystemMalfunction) GetValue() (interface{}, *time.Time) { |
|
|
|
|
return getFault(c.payload, 5, 4), c.date |
|
|
|
|
func (c ChargingSystemMalfunction) GetValue() (interface{}, *string) { |
|
|
|
|
return getFault(&c.payload, 5, 4), &c.date |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (c ChargerStopControl) GetValue() (interface{}, *time.Time) { |
|
|
|
|
return getChargerStopControl(c.payload), c.date |
|
|
|
|
func (c ChargerStopControl) GetValue() (interface{}, *string) { |
|
|
|
|
return getChargerStopControl(&c.payload), &c.date |
|
|
|
|
} |
|
|
|
|
|