Skip to content

Commit

Permalink
feat(plc4go/cbus): added some more dummy implementations for value types
Browse files Browse the repository at this point in the history
  • Loading branch information
sruehl committed Aug 18, 2022
1 parent 96a452e commit 6906355
Show file tree
Hide file tree
Showing 2 changed files with 211 additions and 20 deletions.
223 changes: 207 additions & 16 deletions plc4go/internal/cbus/ValueHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func (m ValueHandler) NewPlcValue(field apiModel.PlcField, value interface{}) (a
CAL_IDENTIFY_REPLY.GetName(),
CAL_STATUS.GetName(),
CAL_STATUS_EXTENDED.GetName():
panic("implement me")
panic("Implement me") //TODO: implement me
case SAL.GetName():
var curValues []any
if field.GetQuantity() > 1 {
Expand All @@ -63,7 +63,11 @@ func (m ValueHandler) NewPlcValue(field apiModel.PlcField, value interface{}) (a
salCommand := field.salCommand
switch field.application.ApplicationId() {
case readWriteModel.ApplicationId_FREE_USAGE:
panic("Not yet implemented") // TODO: implement
switch salCommand {
// TODO:implement
default:
return nil, errors.Errorf("Unsupported command %s for %s", salCommand, field.application.ApplicationId())
}
case readWriteModel.ApplicationId_TEMPERATURE_BROADCAST:
switch salCommand {
case readWriteModel.TemperatureBroadcastCommandType_BROADCAST_EVENT.PLC4XEnumName():
Expand All @@ -83,7 +87,11 @@ func (m ValueHandler) NewPlcValue(field apiModel.PlcField, value interface{}) (a
return nil, errors.Errorf("Unsupported command %s for %s", salCommand, field.application.ApplicationId())
}
case readWriteModel.ApplicationId_ROOM_CONTROL_SYSTEM:
panic("Implement me")
switch salCommand {
// TODO:implement
default:
return nil, errors.Errorf("Unsupported command %s for %s", salCommand, field.application.ApplicationId())
}
case readWriteModel.ApplicationId_LIGHTING,
readWriteModel.ApplicationId_VENTILATION,
readWriteModel.ApplicationId_IRRIGATION_CONTROL,
Expand Down Expand Up @@ -133,34 +141,217 @@ func (m ValueHandler) NewPlcValue(field apiModel.PlcField, value interface{}) (a
}
return group, nil
case readWriteModel.LightingCommandType_LABEL.PLC4XEnumName():
panic("Implement me")
panic("Implement me") //TODO: implement me
default:
return nil, errors.Errorf("Unsupported command %s for %s", salCommand, field.application.ApplicationId())
}
case readWriteModel.ApplicationId_AIR_CONDITIONING:
panic("Implement me")
switch salCommand {
case readWriteModel.AirConditioningCommandType_SET_ZONE_GROUP_OFF.PLC4XEnumName():
zoneGroup, err := m.IEC61131ValueHandler.NewPlcValueFromType(spiValues.IEC61131_BYTE, curValues[0])
if err != nil {
return nil, errors.Wrap(err, "error creating value for zoneGroup")
}
return zoneGroup, nil
case readWriteModel.AirConditioningCommandType_ZONE_HVAC_PLANT_STATUS.PLC4XEnumName():
panic("Implement me") //TODO: implement me
case readWriteModel.AirConditioningCommandType_ZONE_HUMIDITY_PLANT_STATUS.PLC4XEnumName():
panic("Implement me") //TODO: implement me
case readWriteModel.AirConditioningCommandType_ZONE_TEMPERATURE.PLC4XEnumName():
panic("Implement me") //TODO: implement me
case readWriteModel.AirConditioningCommandType_ZONE_HUMIDITY.PLC4XEnumName():
panic("Implement me") //TODO: implement me
case readWriteModel.AirConditioningCommandType_REFRESH.PLC4XEnumName():
zoneGroup, err := m.IEC61131ValueHandler.NewPlcValueFromType(spiValues.IEC61131_BYTE, curValues[0])
if err != nil {
return nil, errors.Wrap(err, "error creating value for zoneGroup")
}
return zoneGroup, nil
case readWriteModel.AirConditioningCommandType_SET_ZONE_HVAC_MODE.PLC4XEnumName():
panic("Implement me") //TODO: implement me
case readWriteModel.AirConditioningCommandType_SET_PLANT_HVAC_LEVEL.PLC4XEnumName():
panic("Implement me") //TODO: implement me
case readWriteModel.AirConditioningCommandType_SET_ZONE_HUMIDITY_MODE.PLC4XEnumName():
panic("Implement me") //TODO: implement me
case readWriteModel.AirConditioningCommandType_SET_PLANT_HUMIDITY_LEVEL.PLC4XEnumName():
panic("Implement me") //TODO: implement me
case readWriteModel.AirConditioningCommandType_SET_HVAC_UPPER_GUARD_LIMIT.PLC4XEnumName():
panic("Implement me") //TODO: implement me
case readWriteModel.AirConditioningCommandType_SET_HVAC_LOWER_GUARD_LIMIT.PLC4XEnumName():
panic("Implement me") //TODO: implement me
case readWriteModel.AirConditioningCommandType_SET_HVAC_SETBACK_LIMIT.PLC4XEnumName():
panic("Implement me") //TODO: implement me
case readWriteModel.AirConditioningCommandType_SET_HUMIDITY_UPPER_GUARD_LIMIT.PLC4XEnumName():
panic("Implement me") //TODO: implement me
case readWriteModel.AirConditioningCommandType_SET_HUMIDITY_LOWER_GUARD_LIMIT.PLC4XEnumName():
panic("Implement me") //TODO: implement me
case readWriteModel.AirConditioningCommandType_SET_ZONE_GROUP_ON.PLC4XEnumName():
zoneGroup, err := m.IEC61131ValueHandler.NewPlcValueFromType(spiValues.IEC61131_BYTE, curValues[0])
if err != nil {
return nil, errors.Wrap(err, "error creating value for zoneGroup")
}
return zoneGroup, nil
case readWriteModel.AirConditioningCommandType_SET_HUMIDITY_SETBACK_LIMIT.PLC4XEnumName():
panic("Implement me") //TODO: implement me
case readWriteModel.AirConditioningCommandType_HVAC_SCHEDULE_ENTRY.PLC4XEnumName():
panic("Implement me") //TODO: implement me
case readWriteModel.AirConditioningCommandType_HUMIDITY_SCHEDULE_ENTRY.PLC4XEnumName():
panic("Implement me") //TODO: implement me
default:
return nil, errors.Errorf("Unsupported command %s for %s", salCommand, field.application.ApplicationId())
}
case readWriteModel.ApplicationId_TRIGGER_CONTROL:
panic("Implement me")
switch salCommand {
case readWriteModel.TriggerControlCommandType_TRIGGER_EVENT.PLC4XEnumName():
panic("Implement me") //TODO: implement me
case readWriteModel.TriggerControlCommandType_TRIGGER_MIN.PLC4XEnumName():
panic("Implement me") //TODO: implement me
case readWriteModel.TriggerControlCommandType_TRIGGER_MAX.PLC4XEnumName():
panic("Implement me") //TODO: implement me
case readWriteModel.TriggerControlCommandType_INDICATOR_KILL.PLC4XEnumName():
panic("Implement me") //TODO: implement me
case readWriteModel.TriggerControlCommandType_LABEL.PLC4XEnumName():
panic("Implement me") //TODO: implement me
default:
return nil, errors.Errorf("Unsupported command %s for %s", salCommand, field.application.ApplicationId())
}
case readWriteModel.ApplicationId_ENABLE_CONTROL:
panic("Implement me")
switch salCommand {
case readWriteModel.EnableControlCommandType_SET_NETWORK_VARIABLE.PLC4XEnumName():
panic("Implement me") //TODO: implement me
default:
return nil, errors.Errorf("Unsupported command %s for %s", salCommand, field.application.ApplicationId())
}
case readWriteModel.ApplicationId_SECURITY:
panic("Implement me")
switch salCommand {
case readWriteModel.SecurityCommandType_OFF.PLC4XEnumName():
panic("Implement me") // TODO: implement
case readWriteModel.SecurityCommandType_ON.PLC4XEnumName():
panic("Implement me") // TODO: implement
case readWriteModel.SecurityCommandType_EVENT.PLC4XEnumName():
panic("Implement me") // TODO: implement
default:
return nil, errors.Errorf("Unsupported command %s for %s", salCommand, field.application.ApplicationId())
}
case readWriteModel.ApplicationId_METERING:
panic("Implement me")
switch salCommand {
case readWriteModel.MeteringCommandType_EVENT.PLC4XEnumName():
panic("Implement me") // TODO: implement
default:
return nil, errors.Errorf("Unsupported command %s for %s", salCommand, field.application.ApplicationId())
}
case readWriteModel.ApplicationId_ACCESS_CONTROL:
panic("Implement me")
switch salCommand {
case readWriteModel.AccessControlCommandType_CLOSE_ACCESS_POINT.PLC4XEnumName():
panic("Implement me") // TODO: implement
case readWriteModel.AccessControlCommandType_LOCK_ACCESS_POINT.PLC4XEnumName():
panic("Implement me") // TODO: implement
case readWriteModel.AccessControlCommandType_ACCESS_POINT_LEFT_OPEN.PLC4XEnumName():
panic("Implement me") // TODO: implement
case readWriteModel.AccessControlCommandType_ACCESS_POINT_FORCED_OPEN.PLC4XEnumName():
panic("Implement me") // TODO: implement
case readWriteModel.AccessControlCommandType_ACCESS_POINT_CLOSED.PLC4XEnumName():
panic("Implement me") // TODO: implement
case readWriteModel.AccessControlCommandType_REQUEST_TO_EXIT.PLC4XEnumName():
panic("Implement me") // TODO: implement
case readWriteModel.AccessControlCommandType_VALID_ACCESS.PLC4XEnumName():
panic("Implement me") // TODO: implement
case readWriteModel.AccessControlCommandType_INVALID_ACCESS.PLC4XEnumName():
panic("Implement me") // TODO: implement
default:
return nil, errors.Errorf("Unsupported command %s for %s", salCommand, field.application.ApplicationId())
}
case readWriteModel.ApplicationId_CLOCK_AND_TIMEKEEPING:
panic("Implement me")
switch salCommand {
case readWriteModel.ClockAndTimekeepingCommandType_UPDATE_NETWORK_VARIABLE.PLC4XEnumName():
panic("Implement me") // TODO: implement
case readWriteModel.ClockAndTimekeepingCommandType_REQUEST_REFRESH.PLC4XEnumName():
panic("Implement me") // TODO: implement
default:
return nil, errors.Errorf("Unsupported command %s for %s", salCommand, field.application.ApplicationId())
}
case readWriteModel.ApplicationId_TELEPHONY_STATUS_AND_CONTROL:
panic("Implement me")
switch salCommand {
case readWriteModel.TelephonyCommandType_EVENT.PLC4XEnumName():
panic("Implement me") // TODO: implement
default:
return nil, errors.Errorf("Unsupported command %s for %s", salCommand, field.application.ApplicationId())
}
case readWriteModel.ApplicationId_MEASUREMENT:
panic("Implement me")
switch salCommand {
case readWriteModel.MeasurementCommandType_MEASUREMENT_EVENT.PLC4XEnumName():
panic("Implement me") // TODO: implement
default:
return nil, errors.Errorf("Unsupported command %s for %s", salCommand, field.application.ApplicationId())
}
case readWriteModel.ApplicationId_TESTING:
panic("Implement me")
switch salCommand {
// TODO:implement
default:
return nil, errors.Errorf("Unsupported command %s for %s", salCommand, field.application.ApplicationId())
}
case readWriteModel.ApplicationId_MEDIA_TRANSPORT_CONTROL:
panic("Implement me")
switch salCommand {
case readWriteModel.MediaTransportControlCommandType_STOP.PLC4XEnumName():
panic("Implement me") // TODO: implement me
case readWriteModel.MediaTransportControlCommandType_PLAY.PLC4XEnumName():
panic("Implement me") // TODO: implement me
case readWriteModel.MediaTransportControlCommandType_PAUSE_RESUME.PLC4XEnumName():
panic("Implement me") // TODO: implement me
case readWriteModel.MediaTransportControlCommandType_SELECT_CATEGORY.PLC4XEnumName():
panic("Implement me") // TODO: implement me
case readWriteModel.MediaTransportControlCommandType_SELECT_SELECTION.PLC4XEnumName():
panic("Implement me") // TODO: implement me
case readWriteModel.MediaTransportControlCommandType_SELECT_TRACK.PLC4XEnumName():
panic("Implement me") // TODO: implement me
case readWriteModel.MediaTransportControlCommandType_SHUFFLE_ON_OFF.PLC4XEnumName():
panic("Implement me") // TODO: implement me
case readWriteModel.MediaTransportControlCommandType_REPEAT_ON_OFF.PLC4XEnumName():
panic("Implement me") // TODO: implement me
case readWriteModel.MediaTransportControlCommandType_NEXT_PREVIOUS_CATEGORY.PLC4XEnumName():
panic("Implement me") // TODO: implement me
case readWriteModel.MediaTransportControlCommandType_NEXT_PREVIOUS_SELECTION.PLC4XEnumName():
panic("Implement me") // TODO: implement me
case readWriteModel.MediaTransportControlCommandType_NEXT_PREVIOUS_TRACK.PLC4XEnumName():
panic("Implement me") // TODO: implement me
case readWriteModel.MediaTransportControlCommandType_FAST_FORWARD.PLC4XEnumName():
panic("Implement me") // TODO: implement me
case readWriteModel.MediaTransportControlCommandType_REWIND.PLC4XEnumName():
panic("Implement me") // TODO: implement me
case readWriteModel.MediaTransportControlCommandType_SOURCE_POWER_CONTROL.PLC4XEnumName():
panic("Implement me") // TODO: implement me
case readWriteModel.MediaTransportControlCommandType_TOTAL_TRACKS.PLC4XEnumName():
panic("Implement me") // TODO: implement me
case readWriteModel.MediaTransportControlCommandType_STATUS_REQUEST.PLC4XEnumName():
panic("Implement me") // TODO: implement me
case readWriteModel.MediaTransportControlCommandType_ENUMERATE_CATEGORIES_SELECTIONS_TRACKS.PLC4XEnumName():
panic("Implement me") // TODO: implement me
case readWriteModel.MediaTransportControlCommandType_ENUMERATION_SIZE.PLC4XEnumName():
panic("Implement me") // TODO: implement me
case readWriteModel.MediaTransportControlCommandType_TRACK_NAME.PLC4XEnumName():
panic("Implement me") // TODO: implement me
case readWriteModel.MediaTransportControlCommandType_SELECTION_NAME.PLC4XEnumName():
panic("Implement me") // TODO: implement me
case readWriteModel.MediaTransportControlCommandType_CATEGORY_NAME.PLC4XEnumName():
panic("Implement me") // TODO: implement me
case readWriteModel.MediaTransportControlCommandType_FAST_FORWARD.PLC4XEnumName():
panic("Implement me") // TODO: implement me
default:
return nil, errors.Errorf("Unsupported command %s for %s", salCommand, field.application.ApplicationId())
}
case readWriteModel.ApplicationId_ERROR_REPORTING:
panic("Implement me")
switch salCommand {
case readWriteModel.ErrorReportingCommandType_DEPRECATED.PLC4XEnumName():
panic("Implement me") // TODO: implement me
case readWriteModel.ErrorReportingCommandType_ERROR_REPORT.PLC4XEnumName():
panic("Implement me") // TODO: implement me
case readWriteModel.ErrorReportingCommandType_ACKNOWLEDGE.PLC4XEnumName():
panic("Implement me") // TODO: implement me
case readWriteModel.ErrorReportingCommandType_CLEAR_MOST_SEVERE.PLC4XEnumName():
panic("Implement me") // TODO: implement me
default:
return nil, errors.Errorf("Unsupported command %s for %s", salCommand, field.application.ApplicationId())
}
default:
return nil, errors.Errorf("No support for %s", field.application)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
[simple byte format ]
[simple HVACModeAndFlags hvacModeAndFlags ]
[simple HVACStartTime startTime ]
[optional HVACTemperature level 'hvacModeAndFlags.isLevelTemperature' ]
[optional HVACRawLevels rawLevel 'hvacModeAndFlags.isLevelRaw' ]
[optional HVACTemperature level 'hvacModeAndFlags.isLevelTemperature' ]
[optional HVACRawLevels rawLevel 'hvacModeAndFlags.isLevelRaw' ]
]
['HUMIDITY_SCHEDULE_ENTRY' *HumidityScheduleEntry
[simple byte zoneGroup ]
Expand All @@ -40,8 +40,8 @@
[simple byte format ]
[simple HVACHumidityModeAndFlags humidityModeAndFlags ]
[simple HVACStartTime startTime ]
[optional HVACHumidity level 'humidityModeAndFlags.isLevelHumidity' ]
[optional HVACRawLevels rawLevel 'humidityModeAndFlags.isLevelRaw' ]
[optional HVACHumidity level 'humidityModeAndFlags.isLevelHumidity' ]
[optional HVACRawLevels rawLevel 'humidityModeAndFlags.isLevelRaw' ]
]
['REFRESH' *Refresh
[simple byte zoneGroup ]
Expand Down

0 comments on commit 6906355

Please sign in to comment.