109 full impl
Signed-off-by: didinst <9f6129a2ddff0d0c6d03169eaa75e3fea1c1770f>
This commit is contained in:
+61
@@ -34,6 +34,12 @@ const (
|
|||||||
|
|
||||||
CONNECTOR_LOCKED ConnectorLock = iota
|
CONNECTOR_LOCKED ConnectorLock = iota
|
||||||
CONNECTOR_UNLOCKED
|
CONNECTOR_UNLOCKED
|
||||||
|
|
||||||
|
BATTERY_COMPATIBLE BatteryCompatible = iota
|
||||||
|
BATTERY_INCOMPATIBLE
|
||||||
|
|
||||||
|
OPERATING StopControl = iota
|
||||||
|
SHUTDOWN_STOP
|
||||||
)
|
)
|
||||||
|
|
||||||
type VehicleChargingEnabled uint8
|
type VehicleChargingEnabled uint8
|
||||||
@@ -52,6 +58,10 @@ type StationState uint8
|
|||||||
|
|
||||||
type ConnectorLock uint8
|
type ConnectorLock uint8
|
||||||
|
|
||||||
|
type BatteryCompatible uint8
|
||||||
|
|
||||||
|
type StopControl uint8
|
||||||
|
|
||||||
type ChademoEvent interface {
|
type ChademoEvent interface {
|
||||||
// GetValue Return processed/calculated value and timestamp string
|
// GetValue Return processed/calculated value and timestamp string
|
||||||
GetValue() (interface{}, *string)
|
GetValue() (interface{}, *string)
|
||||||
@@ -213,6 +223,9 @@ func FromCanFrames(frames <-chan *CanFrame) <-chan ChademoEvent {
|
|||||||
events <- &StationStatus{frame}
|
events <- &StationStatus{frame}
|
||||||
events <- &StationMalfunction{frame}
|
events <- &StationMalfunction{frame}
|
||||||
events <- &VehicleConnectorLock{frame}
|
events <- &VehicleConnectorLock{frame}
|
||||||
|
events <- &BatteryIncompatibility{frame}
|
||||||
|
events <- &ChargingSystemMalfunction{frame}
|
||||||
|
events <- &ChargerStopControl{frame}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
@@ -297,6 +310,20 @@ func getConnectorLock(bytes *[]byte) ConnectorLock {
|
|||||||
return CONNECTOR_UNLOCKED
|
return CONNECTOR_UNLOCKED
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func getBatteryCompatibility(bytes *[]uint8) BatteryCompatible {
|
||||||
|
if isBitSet((*bytes)[5], 3) {
|
||||||
|
return BATTERY_INCOMPATIBLE
|
||||||
|
}
|
||||||
|
return BATTERY_COMPATIBLE
|
||||||
|
}
|
||||||
|
|
||||||
|
func getChargerStopControl(bytes *[]uint8) StopControl {
|
||||||
|
if isBitSet((*bytes)[5], 5) {
|
||||||
|
return SHUTDOWN_STOP
|
||||||
|
}
|
||||||
|
return OPERATING
|
||||||
|
}
|
||||||
|
|
||||||
func (m MaximumBatteryVoltage) GetValue() (interface{}, *string) {
|
func (m MaximumBatteryVoltage) GetValue() (interface{}, *string) {
|
||||||
return bytesToUint16(m.payload[4:6]), &m.date
|
return bytesToUint16(m.payload[4:6]), &m.date
|
||||||
}
|
}
|
||||||
@@ -425,6 +452,18 @@ func (v VehicleConnectorLock) GetValue() (interface{}, *string) {
|
|||||||
return getConnectorLock(&v.payload), &v.date
|
return getConnectorLock(&v.payload), &v.date
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (b BatteryIncompatibility) GetValue() (interface{}, *string) {
|
||||||
|
return getBatteryCompatibility(&b.payload), &b.date
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c ChargingSystemMalfunction) GetValue() (interface{}, *string) {
|
||||||
|
return getFault(&c.payload, 5, 4), &c.date
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c ChargerStopControl) GetValue() (interface{}, *string) {
|
||||||
|
return getChargerStopControl(&c.payload), &c.date
|
||||||
|
}
|
||||||
|
|
||||||
func (v VehicleChargingEnabled) String() string {
|
func (v VehicleChargingEnabled) String() string {
|
||||||
switch v {
|
switch v {
|
||||||
case DISABLED:
|
case DISABLED:
|
||||||
@@ -512,3 +551,25 @@ func (c ConnectorLock) String() string {
|
|||||||
panic("ConnectorLock not implemented")
|
panic("ConnectorLock not implemented")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (b BatteryCompatible) String() string {
|
||||||
|
switch b {
|
||||||
|
case BATTERY_COMPATIBLE:
|
||||||
|
return "compatible"
|
||||||
|
case BATTERY_INCOMPATIBLE:
|
||||||
|
return "incompatible"
|
||||||
|
default:
|
||||||
|
panic("BatteryCompatible not implemented")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s StopControl) String() string {
|
||||||
|
switch s {
|
||||||
|
case OPERATING:
|
||||||
|
return "operating"
|
||||||
|
case SHUTDOWN_STOP:
|
||||||
|
return "shutdown or stop charging"
|
||||||
|
default:
|
||||||
|
panic("StopControl not implemented")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user