use of org.openhab.binding.tinkerforge.internal.model.ServoSubIDs in project openhab1-addons by openhab.
the class ConfigurationHandler method createOHTFDeviceConfig.
/**
* Generates the {@link OHConfig} EMF model configuration store for the device configuration from
* openhab.cfg.
*
* Creates the device specific configuration object {@link OHTFDevice} and calls
* {@link #fillupConfig(OHTFDevice, Map) fillupConfig} to fill in the configuration into the
* configuration object.
*
* @param deviceConfig The device configuration as {@code Map} of {@code Strings}.
* @throws ConfigurationException
*/
private void createOHTFDeviceConfig(Map<String, String> deviceConfig) throws ConfigurationException {
String deviceType = deviceConfig.get(ConfigKey.type.name());
if (deviceType.equals(TypeKey.servo.name())) {
logger.debug("{} setting servo config", LoggerConstants.CONFIG);
TFServoConfiguration servoConfiguration = modelFactory.createTFServoConfiguration();
OHTFDevice<TFServoConfiguration, ServoSubIDs> ohtfDevice = modelFactory.createOHTFDevice();
ohtfDevice.getSubDeviceIds().addAll(Arrays.asList(ServoSubIDs.values()));
ohtfDevice.setTfConfig(servoConfiguration);
fillupConfig(ohtfDevice, deviceConfig);
} else if (deviceType.equals(TypeKey.bricklet_distance_ir.name()) || deviceType.equals(TypeKey.bricklet_humidity.name()) || deviceType.equals(TypeKey.bricklet_barometer.name()) || deviceType.equals(TypeKey.bricklet_ambient_light.name()) || deviceType.equals(TypeKey.ambient_temperature.name()) || deviceType.equals(TypeKey.bricklet_soundintensity.name()) || deviceType.equals(TypeKey.voltageCurrent_voltage.name()) || deviceType.equals(TypeKey.voltageCurrent_current.name()) || deviceType.equals(TypeKey.voltageCurrent_power.name()) || deviceType.equals(TypeKey.bricklet_joystick.name()) || deviceType.equals(TypeKey.bricklet_halleffect.name()) || deviceType.equals(TypeKey.bricklet_linear_poti.name()) || deviceType.equals(TypeKey.ptc_resistance.name()) || deviceType.equals(TypeKey.ptc_temperature.name()) || deviceType.equals(TypeKey.industrial020ma_sensor.name()) || deviceType.equals(TypeKey.rotary_encoder.name()) || deviceType.equals(TypeKey.bricklet_dustdetector.name()) || deviceType.equals(TypeKey.color_color.name()) || deviceType.equals(TypeKey.color_temperature.name()) || deviceType.equals(TypeKey.color_illuminance.name()) || deviceType.equals(TypeKey.industrial_dual_analogin_channel.name()) || deviceType.equals(TypeKey.accelerometer_direction.name()) || deviceType.equals(TypeKey.laser_range_finder_distance.name()) || deviceType.equals(TypeKey.laser_range_finder_velocity.name()) || deviceType.equals(TypeKey.bricklet_uvlight.name()) || deviceType.equals(TypeKey.bricklet_co2.name())) {
logger.debug("{} setting base config", LoggerConstants.CONFIG);
TFBaseConfiguration tfBaseConfiguration = modelFactory.createTFBaseConfiguration();
if (deviceType.equals(TypeKey.bricklet_barometer)) {
OHTFDevice<TFBaseConfiguration, BarometerSubIDs> ohtfDevice = modelFactory.createOHTFDevice();
ohtfDevice.getSubDeviceIds().addAll(Arrays.asList(BarometerSubIDs.values()));
ohtfDevice.setTfConfig(tfBaseConfiguration);
fillupConfig(ohtfDevice, deviceConfig);
} else if (deviceType.equals(TypeKey.industrial_dual_analogin_channel.name())) {
OHTFDevice<TFBaseConfiguration, IndustrialDualAnalogInSubIds> ohtfDevice = modelFactory.createOHTFDevice();
ohtfDevice.getSubDeviceIds().addAll(Arrays.asList(IndustrialDualAnalogInSubIds.values()));
ohtfDevice.setTfConfig(tfBaseConfiguration);
fillupConfig(ohtfDevice, deviceConfig);
} else if (deviceType.equals(TypeKey.ambient_temperature.name())) {
OHTFDevice<TFBaseConfiguration, TemperatureIRSubIds> ohtfDevice = modelFactory.createOHTFDevice();
ohtfDevice.getSubDeviceIds().addAll(Arrays.asList(TemperatureIRSubIds.values()));
ohtfDevice.setTfConfig(tfBaseConfiguration);
fillupConfig(ohtfDevice, deviceConfig);
} else if (deviceType.equals(TypeKey.color_color.name())) {
OHTFDevice<TFBaseConfiguration, ColorBrickletSubIds> ohtfDevice = modelFactory.createOHTFDevice();
ohtfDevice.getSubDeviceIds().addAll(Arrays.asList(ColorBrickletSubIds.values()));
ohtfDevice.setTfConfig(tfBaseConfiguration);
fillupConfig(ohtfDevice, deviceConfig);
} else if (deviceType.equals(TypeKey.color_temperature.name())) {
OHTFDevice<TFBaseConfiguration, ColorBrickletSubIds> ohtfDevice = modelFactory.createOHTFDevice();
ohtfDevice.getSubDeviceIds().addAll(Arrays.asList(ColorBrickletSubIds.values()));
ohtfDevice.setTfConfig(tfBaseConfiguration);
fillupConfig(ohtfDevice, deviceConfig);
} else if (deviceType.equals(TypeKey.color_illuminance.name())) {
OHTFDevice<TFBaseConfiguration, ColorBrickletSubIds> ohtfDevice = modelFactory.createOHTFDevice();
ohtfDevice.getSubDeviceIds().addAll(Arrays.asList(ColorBrickletSubIds.values()));
ohtfDevice.setTfConfig(tfBaseConfiguration);
fillupConfig(ohtfDevice, deviceConfig);
} else if (deviceType.equals(TypeKey.voltageCurrent_current.name()) || deviceType.equals(TypeKey.voltageCurrent_voltage.name()) || deviceType.equals(TypeKey.voltageCurrent_power.name())) {
OHTFDevice<TFBaseConfiguration, VoltageCurrentSubIds> ohtfDevice = modelFactory.createOHTFDevice();
ohtfDevice.getSubDeviceIds().addAll(Arrays.asList(VoltageCurrentSubIds.values()));
ohtfDevice.setTfConfig(tfBaseConfiguration);
fillupConfig(ohtfDevice, deviceConfig);
} else if (deviceType.equals(TypeKey.ptc_resistance.name()) || deviceType.equals(TypeKey.ptc_temperature.name())) {
OHTFDevice<TFBaseConfiguration, PTCSubIds> ohtfDevice = modelFactory.createOHTFDevice();
ohtfDevice.getSubDeviceIds().addAll(Arrays.asList(PTCSubIds.values()));
ohtfDevice.setTfConfig(tfBaseConfiguration);
fillupConfig(ohtfDevice, deviceConfig);
} else if (deviceType.equals(TypeKey.industrial020ma_sensor.name())) {
OHTFDevice<TFBaseConfiguration, IndustrialDual020mASubIds> ohtfDevice = modelFactory.createOHTFDevice();
ohtfDevice.getSubDeviceIds().addAll(Arrays.asList(IndustrialDual020mASubIds.values()));
ohtfDevice.setTfConfig(tfBaseConfiguration);
fillupConfig(ohtfDevice, deviceConfig);
} else if (deviceType.equals(TypeKey.rotary_encoder.name())) {
OHTFDevice<TFBaseConfiguration, RotaryEncoderSubIds> ohtfDevice = modelFactory.createOHTFDevice();
ohtfDevice.getSubDeviceIds().addAll(Arrays.asList(RotaryEncoderSubIds.values()));
ohtfDevice.setTfConfig(tfBaseConfiguration);
fillupConfig(ohtfDevice, deviceConfig);
} else if (deviceType.equals(TypeKey.accelerometer_direction.name())) {
OHTFDevice<TFBaseConfiguration, AccelerometerSubIds> ohtfDevice = modelFactory.createOHTFDevice();
ohtfDevice.getSubDeviceIds().addAll(Arrays.asList(AccelerometerSubIds.values()));
ohtfDevice.setTfConfig(tfBaseConfiguration);
fillupConfig(ohtfDevice, deviceConfig);
} else if (deviceType.equals(TypeKey.laser_range_finder_distance.name()) || deviceType.equals(TypeKey.laser_range_finder_velocity.name())) {
OHTFDevice<TFBaseConfiguration, LaserRangeFinderSubIds> ohtfDevice = modelFactory.createOHTFDevice();
ohtfDevice.getSubDeviceIds().addAll(Arrays.asList(LaserRangeFinderSubIds.values()));
ohtfDevice.setTfConfig(tfBaseConfiguration);
fillupConfig(ohtfDevice, deviceConfig);
} else {
OHTFDevice<TFBaseConfiguration, NoSubIds> ohtfDevice = modelFactory.createOHTFDevice();
ohtfDevice.setTfConfig(tfBaseConfiguration);
fillupConfig(ohtfDevice, deviceConfig);
}
} else if (deviceType.equals(TypeKey.bricklet_analog_out_v2.name())) {
logger.debug("{} setting bricklet analog v2 config", LoggerConstants.CONFIG);
DimmableConfiguration analogOutV2Configuration = modelFactory.createDimmableConfiguration();
OHTFDevice<DimmableConfiguration, NoSubIds> ohtfDevice = modelFactory.createOHTFDevice();
ohtfDevice.getSubDeviceIds().addAll(Arrays.asList(NoSubIds.values()));
ohtfDevice.setTfConfig(analogOutV2Configuration);
fillupConfig(ohtfDevice, deviceConfig);
} else if (deviceType.equals(TypeKey.brick_dc.name())) {
logger.debug("{} setting dc config", LoggerConstants.CONFIG);
TFBrickDCConfiguration tfBrickDCConfiguration = modelFactory.createTFBrickDCConfiguration();
OHTFDevice<TFBrickDCConfiguration, NoSubIds> ohtfDevice = modelFactory.createOHTFDevice();
ohtfDevice.getSubDeviceIds().addAll(Arrays.asList(NoSubIds.values()));
ohtfDevice.setTfConfig(tfBrickDCConfiguration);
fillupConfig(ohtfDevice, deviceConfig);
} else if (deviceType.equals(TypeKey.io_actuator.name())) {
logger.debug("{} setting io_actuator config", LoggerConstants.CONFIG);
TFIOActorConfiguration tfioActorConfiguration = modelFactory.createTFIOActorConfiguration();
OHTFDevice<TFIOActorConfiguration, IO16SubIds> ohtfDevice = modelFactory.createOHTFDevice();
ohtfDevice.getSubDeviceIds().addAll(Arrays.asList(IO16SubIds.values()));
ohtfDevice.setTfConfig(tfioActorConfiguration);
fillupConfig(ohtfDevice, deviceConfig);
} else if (deviceType.equals(TypeKey.io4_actuator.name())) {
logger.debug("{} setting io4_actuator config", LoggerConstants.CONFIG);
TFIOActorConfiguration tfioActorConfiguration = modelFactory.createTFIOActorConfiguration();
OHTFDevice<TFIOActorConfiguration, IO4SubIds> ohtfDevice = modelFactory.createOHTFDevice();
ohtfDevice.getSubDeviceIds().addAll(Arrays.asList(IO4SubIds.values()));
ohtfDevice.setTfConfig(tfioActorConfiguration);
fillupConfig(ohtfDevice, deviceConfig);
} else if (deviceType.equals(TypeKey.iosensor.name())) {
logger.debug("{} setting iosensor config", LoggerConstants.CONFIG);
TFIOSensorConfiguration tfioSensorConfiguration = modelFactory.createTFIOSensorConfiguration();
OHTFDevice<TFIOSensorConfiguration, IO16SubIds> ohtfDevice = modelFactory.createOHTFDevice();
ohtfDevice.getSubDeviceIds().addAll(Arrays.asList(IO16SubIds.values()));
ohtfDevice.setTfConfig(tfioSensorConfiguration);
fillupConfig(ohtfDevice, deviceConfig);
} else if (deviceType.equals(TypeKey.io4sensor.name())) {
logger.debug("{} setting io4sensor config", LoggerConstants.CONFIG);
TFIOSensorConfiguration tfioSensorConfiguration = modelFactory.createTFIOSensorConfiguration();
OHTFDevice<TFIOSensorConfiguration, IO4SubIds> ohtfDevice = modelFactory.createOHTFDevice();
ohtfDevice.getSubDeviceIds().addAll(Arrays.asList(IO4SubIds.values()));
ohtfDevice.setTfConfig(tfioSensorConfiguration);
fillupConfig(ohtfDevice, deviceConfig);
} else if (deviceType.equals(TypeKey.bricklet_industrial_digital_4in.name()) || deviceType.equals(TypeKey.bricklet_io16.name()) || deviceType.equals(TypeKey.bricklet_io4.name())) {
logger.debug("{} setting TFInterruptListenerConfiguration device_type {}", LoggerConstants.CONFIG, deviceType);
TFInterruptListenerConfiguration tfInterruptListenerConfiguration = modelFactory.createTFInterruptListenerConfiguration();
OHTFDevice<TFInterruptListenerConfiguration, NoSubIds> ohtfDevice = modelFactory.createOHTFDevice();
ohtfDevice.getSubDeviceIds().addAll(Arrays.asList(NoSubIds.values()));
ohtfDevice.setTfConfig(tfInterruptListenerConfiguration);
fillupConfig(ohtfDevice, deviceConfig);
} else if (deviceType.equals(TypeKey.bricklet_remote_switch.name())) {
logger.debug("{} setting BrickletRemoteSwitchConfiguration device_type {}", LoggerConstants.CONFIG, deviceType);
BrickletRemoteSwitchConfiguration configuration = modelFactory.createBrickletRemoteSwitchConfiguration();
OHTFDevice<BrickletRemoteSwitchConfiguration, NoSubIds> ohtfDevice = modelFactory.createOHTFDevice();
ohtfDevice.getSubDeviceIds().addAll(Arrays.asList(NoSubIds.values()));
ohtfDevice.setTfConfig(configuration);
fillupConfig(ohtfDevice, deviceConfig);
} else if (deviceType.equals(TypeKey.remote_switch_a.name())) {
logger.debug("{} setting RemoteSwitchAConfiguration device_type {}", LoggerConstants.CONFIG, deviceType);
RemoteSwitchAConfiguration configuration = modelFactory.createRemoteSwitchAConfiguration();
OHTFSubDeviceAdminDevice<RemoteSwitchAConfiguration, NoSubIds> ohtfDevice = modelFactory.createOHTFSubDeviceAdminDevice();
ohtfDevice.getSubDeviceIds().addAll(Arrays.asList(NoSubIds.values()));
ohtfDevice.setTfConfig(configuration);
fillupConfig(ohtfDevice, deviceConfig);
} else if (deviceType.equals(TypeKey.remote_switch_b.name())) {
logger.debug("{} setting RemoteSwitchBConfiguration device_type {}", LoggerConstants.CONFIG, deviceType);
RemoteSwitchBConfiguration configuration = modelFactory.createRemoteSwitchBConfiguration();
OHTFSubDeviceAdminDevice<RemoteSwitchBConfiguration, NoSubIds> ohtfDevice = modelFactory.createOHTFSubDeviceAdminDevice();
ohtfDevice.getSubDeviceIds().addAll(Arrays.asList(NoSubIds.values()));
ohtfDevice.setTfConfig(configuration);
fillupConfig(ohtfDevice, deviceConfig);
} else if (deviceType.equals(TypeKey.remote_switch_c.name())) {
logger.debug("{} setting RemoteSwitchCConfiguration device_type {}", LoggerConstants.CONFIG, deviceType);
RemoteSwitchCConfiguration configuration = modelFactory.createRemoteSwitchCConfiguration();
OHTFSubDeviceAdminDevice<RemoteSwitchCConfiguration, NoSubIds> ohtfDevice = modelFactory.createOHTFSubDeviceAdminDevice();
ohtfDevice.getSubDeviceIds().addAll(Arrays.asList(NoSubIds.values()));
ohtfDevice.setTfConfig(configuration);
fillupConfig(ohtfDevice, deviceConfig);
} else if (deviceType.equals(TypeKey.bricklet_multitouch.name())) {
logger.debug("{} setting BrickletMultiTouchConfiguration device_type {}", LoggerConstants.CONFIG, deviceType);
BrickletMultiTouchConfiguration configuration = modelFactory.createBrickletMultiTouchConfiguration();
OHTFDevice<BrickletMultiTouchConfiguration, MultiTouchSubIds> ohtfDevice = modelFactory.createOHTFDevice();
ohtfDevice.getSubDeviceIds().addAll(Arrays.asList(MultiTouchSubIds.values()));
ohtfDevice.setTfConfig(configuration);
fillupConfig(ohtfDevice, deviceConfig);
} else if (deviceType.equals(TypeKey.electrode.name()) || deviceType.equals(TypeKey.proximity.name())) {
logger.debug("{} setting MultiTouchDeviceConfiguration device_type {}", LoggerConstants.CONFIG, deviceType);
MultiTouchDeviceConfiguration configuration = modelFactory.createMultiTouchDeviceConfiguration();
OHTFDevice<MultiTouchDeviceConfiguration, MultiTouchSubIds> ohtfDevice = modelFactory.createOHTFDevice();
ohtfDevice.getSubDeviceIds().addAll(Arrays.asList(MultiTouchSubIds.values()));
ohtfDevice.setTfConfig(configuration);
fillupConfig(ohtfDevice, deviceConfig);
} else if (deviceType.equals(TypeKey.object_temperature.name())) {
logger.debug("{} setting TFObjectTemperatureConfiguration device_type {}", LoggerConstants.CONFIG, deviceType);
TFObjectTemperatureConfiguration configuration = modelFactory.createTFObjectTemperatureConfiguration();
OHTFDevice<TFObjectTemperatureConfiguration, TemperatureIRSubIds> ohtfDevice = modelFactory.createOHTFDevice();
ohtfDevice.getSubDeviceIds().addAll(Arrays.asList(TemperatureIRSubIds.values()));
ohtfDevice.setTfConfig(configuration);
fillupConfig(ohtfDevice, deviceConfig);
} else if (deviceType.equals(TypeKey.bricklet_moisture.name())) {
TFMoistureBrickletConfiguration configuration = modelFactory.createTFMoistureBrickletConfiguration();
OHTFDevice<TFMoistureBrickletConfiguration, NoSubIds> ohtfDevice = modelFactory.createOHTFDevice();
ohtfDevice.getSubDeviceIds().addAll(Arrays.asList(NoSubIds.values()));
ohtfDevice.setTfConfig(configuration);
fillupConfig(ohtfDevice, deviceConfig);
} else if (deviceType.equals(TypeKey.bricklet_distanceUS.name())) {
TFDistanceUSBrickletConfiguration configuration = modelFactory.createTFDistanceUSBrickletConfiguration();
OHTFDevice<TFDistanceUSBrickletConfiguration, NoSubIds> ohtfDevice = modelFactory.createOHTFDevice();
ohtfDevice.getSubDeviceIds().addAll(Arrays.asList(NoSubIds.values()));
ohtfDevice.setTfConfig(configuration);
fillupConfig(ohtfDevice, deviceConfig);
} else if (deviceType.equals(TypeKey.bricklet_voltageCurrent.name())) {
TFVoltageCurrentConfiguration configuration = modelFactory.createTFVoltageCurrentConfiguration();
OHTFDevice<TFVoltageCurrentConfiguration, VoltageCurrentSubIds> ohtfDevice = modelFactory.createOHTFDevice();
ohtfDevice.getSubDeviceIds().addAll(Arrays.asList(VoltageCurrentSubIds.values()));
ohtfDevice.setTfConfig(configuration);
fillupConfig(ohtfDevice, deviceConfig);
} else if (deviceType.equals(TypeKey.dualbutton_button.name())) {
ButtonConfiguration configuration = modelFactory.createButtonConfiguration();
OHTFDevice<ButtonConfiguration, DualButtonButtonSubIds> ohtfDevice = modelFactory.createOHTFDevice();
ohtfDevice.getSubDeviceIds().addAll(Arrays.asList(DualButtonButtonSubIds.values()));
ohtfDevice.setTfConfig(configuration);
fillupConfig(ohtfDevice, deviceConfig);
} else if (deviceType.equals(TypeKey.dualbutton_led.name())) {
logger.debug("setting DualButtonLEDConfiguration device_type {}", deviceType);
DualButtonLEDConfiguration configuration = modelFactory.createDualButtonLEDConfiguration();
OHTFDevice<DualButtonLEDConfiguration, DualButtonLedSubIds> ohtfDevice = modelFactory.createOHTFDevice();
ohtfDevice.getSubDeviceIds().addAll(Arrays.asList(DualButtonLedSubIds.values()));
ohtfDevice.setTfConfig(configuration);
fillupConfig(ohtfDevice, deviceConfig);
} else if (deviceType.equals(TypeKey.joystick_button.name())) {
ButtonConfiguration configuration = modelFactory.createButtonConfiguration();
OHTFDevice<ButtonConfiguration, JoystickSubIds> ohtfDevice = modelFactory.createOHTFDevice();
ohtfDevice.getSubDeviceIds().addAll(Arrays.asList(JoystickSubIds.values()));
ohtfDevice.setTfConfig(configuration);
fillupConfig(ohtfDevice, deviceConfig);
} else if (deviceType.equals(TypeKey.rotary_encoder_button.name())) {
ButtonConfiguration configuration = modelFactory.createButtonConfiguration();
OHTFDevice<ButtonConfiguration, RotaryEncoderSubIds> ohtfDevice = modelFactory.createOHTFDevice();
ohtfDevice.getSubDeviceIds().addAll(Arrays.asList(RotaryEncoderSubIds.values()));
ohtfDevice.setTfConfig(configuration);
fillupConfig(ohtfDevice, deviceConfig);
} else if (deviceType.equals(TypeKey.lcd_button.name())) {
ButtonConfiguration configuration = modelFactory.createButtonConfiguration();
OHTFDevice<ButtonConfiguration, LCDButtonSubIds> ohtfDevice = modelFactory.createOHTFDevice();
ohtfDevice.getSubDeviceIds().addAll(Arrays.asList(LCDButtonSubIds.values()));
ohtfDevice.setTfConfig(configuration);
fillupConfig(ohtfDevice, deviceConfig);
} else if (deviceType.equals(TypeKey.bricklet_ledstrip.name())) {
LEDStripConfiguration configuration = modelFactory.createLEDStripConfiguration();
OHTFDevice<LEDStripConfiguration, NoSubIds> ohtfDevice = modelFactory.createOHTFDevice();
ohtfDevice.getSubDeviceIds().addAll(Arrays.asList(NoSubIds.values()));
ohtfDevice.setTfConfig(configuration);
fillupConfig(ohtfDevice, deviceConfig);
} else if (deviceType.equals(TypeKey.ledgroup.name())) {
LEDGroupConfiguration configuration = modelFactory.createLEDGroupConfiguration();
OHTFSubDeviceAdminDevice<LEDGroupConfiguration, NoSubIds> ohtfDevice = modelFactory.createOHTFSubDeviceAdminDevice();
ohtfDevice.getSubDeviceIds().addAll(Arrays.asList(NoSubIds.values()));
ohtfDevice.setTfConfig(configuration);
fillupConfig(ohtfDevice, deviceConfig);
} else if (deviceType.equals(TypeKey.bricklet_ptc.name())) {
TFPTCBrickletConfiguration configuration = modelFactory.createTFPTCBrickletConfiguration();
OHTFDevice<TFPTCBrickletConfiguration, PTCSubIds> ohtfDevice = modelFactory.createOHTFDevice();
ohtfDevice.getSubDeviceIds().addAll(Arrays.asList(PTCSubIds.values()));
ohtfDevice.setTfConfig(configuration);
fillupConfig(ohtfDevice, deviceConfig);
} else if (deviceType.equals(TypeKey.bricklet_industrialdual020ma.name())) {
TFIndustrialDual020mAConfiguration configuration = modelFactory.createTFIndustrialDual020mAConfiguration();
OHTFDevice<TFIndustrialDual020mAConfiguration, IndustrialDual020mASubIds> ohtfDevice = modelFactory.createOHTFDevice();
ohtfDevice.getSubDeviceIds().addAll(Arrays.asList(IndustrialDual020mASubIds.values()));
ohtfDevice.setTfConfig(configuration);
fillupConfig(ohtfDevice, deviceConfig);
} else if (deviceType.equals(TypeKey.dual_relay.name())) {
logger.debug("{} setting no tfConfig device_type {}", LoggerConstants.CONFIG, deviceType);
logger.debug("{} setting subdevice ids to {}", LoggerConstants.CONFIG, DualRelaySubIds.values());
logger.trace("{} deviceType {}", LoggerConstants.CONFIG, deviceType);
OHTFDevice<?, DualRelaySubIds> ohtfDevice = modelFactory.createOHTFDevice();
ohtfDevice.getSubDeviceIds().addAll(Arrays.asList(DualRelaySubIds.values()));
fillupConfig(ohtfDevice, deviceConfig);
} else if (deviceType.equals(TypeKey.quad_relay.name())) {
logger.debug("{} setting no tfConfig device_type {}", LoggerConstants.CONFIG, deviceType);
logger.debug("{} setting subdevice ids to {}", LoggerConstants.CONFIG, IndustrialQuadRelayIDs.values());
logger.trace("{} deviceType {}", LoggerConstants.CONFIG, deviceType);
OHTFDevice<?, IndustrialQuadRelayIDs> ohtfDevice = modelFactory.createOHTFDevice();
ohtfDevice.getSubDeviceIds().addAll(Arrays.asList(IndustrialQuadRelayIDs.values()));
fillupConfig(ohtfDevice, deviceConfig);
} else if (deviceType.equals(TypeKey.joystick_xposition.name()) || deviceType.equals(TypeKey.joystick_yposition.name())) {
logger.debug("{} setting no tfConfig device_type {}", LoggerConstants.CONFIG, deviceType);
logger.debug("{} setting subdevice ids to {}", LoggerConstants.CONFIG, JoystickSubIds.values());
logger.trace("{} deviceType {}", LoggerConstants.CONFIG, deviceType);
OHTFDevice<?, JoystickSubIds> ohtfDevice = modelFactory.createOHTFDevice();
ohtfDevice.getSubDeviceIds().addAll(Arrays.asList(JoystickSubIds.values()));
fillupConfig(ohtfDevice, deviceConfig);
} else if (deviceType.equals(TypeKey.digital_4in.name())) {
logger.debug("{} setting no tfConfig device_type {}", LoggerConstants.CONFIG, deviceType);
logger.debug("{} setting subdevice ids to {}", LoggerConstants.CONFIG, IndustrialDigitalInSubIDs.values());
logger.trace("{} deviceType {}", LoggerConstants.CONFIG, deviceType);
OHTFDevice<?, IndustrialDigitalInSubIDs> ohtfDevice = modelFactory.createOHTFDevice();
ohtfDevice.getSubDeviceIds().addAll(Arrays.asList(IndustrialDigitalInSubIDs.values()));
fillupConfig(ohtfDevice, deviceConfig);
} else if (deviceType.equals(TypeKey.digital_4out.name())) {
logger.debug("{} setting no tfConfig device_type {}", LoggerConstants.CONFIG, deviceType);
logger.debug("{} setting subdevice ids to {}", LoggerConstants.CONFIG, IndustrialDigitalOutSubIDs.values());
logger.trace("{} deviceType {}", LoggerConstants.CONFIG, deviceType);
OHTFDevice<?, IndustrialDigitalOutSubIDs> ohtfDevice = modelFactory.createOHTFDevice();
ohtfDevice.getSubDeviceIds().addAll(Arrays.asList(IndustrialDigitalOutSubIDs.values()));
fillupConfig(ohtfDevice, deviceConfig);
} else if (deviceType.equals(TypeKey.bricklet_ambient_lightv2.name())) {
logger.debug("{} setting AmbientLightV2Configuration device_type {}", LoggerConstants.CONFIG, deviceType);
logger.trace("{} deviceType {}", LoggerConstants.CONFIG, deviceType);
AmbientLightV2Configuration configuration = modelFactory.createAmbientLightV2Configuration();
OHTFDevice<AmbientLightV2Configuration, NoSubIds> ohtfDevice = modelFactory.createOHTFDevice();
ohtfDevice.getSubDeviceIds().addAll(Arrays.asList(NoSubIds.values()));
ohtfDevice.setTfConfig(configuration);
fillupConfig(ohtfDevice, deviceConfig);
} else if (deviceType.equals(TypeKey.bricklet_loadcell.name())) {
logger.debug("{} setting no tfConfig device_type {}", LoggerConstants.CONFIG, deviceType);
logger.debug("{} setting subdevice ids to {}", LoggerConstants.CONFIG, LoadCellSubIds.values());
OHTFDevice<?, LoadCellSubIds> ohtfDevice = modelFactory.createOHTFDevice();
ohtfDevice.getSubDeviceIds().addAll(Arrays.asList(LoadCellSubIds.values()));
fillupConfig(ohtfDevice, deviceConfig);
} else if (deviceType.equals(TypeKey.loadcell_weight.name())) {
logger.debug("{} setting LoadCellConfiguration device_type {}", LoggerConstants.CONFIG, deviceType);
logger.debug("{} setting subdevice ids to {}", LoggerConstants.CONFIG, LoadCellSubIds.values());
LoadCellConfiguration configuration = modelFactory.createLoadCellConfiguration();
OHTFDevice<LoadCellConfiguration, LoadCellSubIds> ohtfDevice = modelFactory.createOHTFDevice();
ohtfDevice.getSubDeviceIds().addAll(Arrays.asList(LoadCellSubIds.values()));
ohtfDevice.setTfConfig(configuration);
fillupConfig(ohtfDevice, deviceConfig);
} else if (deviceType.equals(TypeKey.loadcell_led.name())) {
logger.debug("{} setting no tfConfig device_type {}", LoggerConstants.CONFIG, deviceType);
logger.debug("{} setting subdevice ids to {}", LoggerConstants.CONFIG, LoadCellSubIds.values());
OHTFDevice<?, LoadCellSubIds> ohtfDevice = modelFactory.createOHTFDevice();
ohtfDevice.getSubDeviceIds().addAll(Arrays.asList(LoadCellSubIds.values()));
fillupConfig(ohtfDevice, deviceConfig);
} else if (deviceType.equals(TypeKey.bricklet_temperature.name())) {
TFTemperatureConfiguration configuration = modelFactory.createTFTemperatureConfiguration();
OHTFDevice<TFTemperatureConfiguration, NoSubIds> ohtfDevice = modelFactory.createOHTFDevice();
ohtfDevice.getSubDeviceIds().addAll(Arrays.asList(NoSubIds.values()));
ohtfDevice.setTfConfig(configuration);
fillupConfig(ohtfDevice, deviceConfig);
} else if (deviceType.equals(TypeKey.bricklet_color.name())) {
BrickletColorConfiguration configuration = modelFactory.createBrickletColorConfiguration();
OHTFDevice<BrickletColorConfiguration, ColorBrickletSubIds> ohtfDevice = modelFactory.createOHTFDevice();
ohtfDevice.getSubDeviceIds().addAll(Arrays.asList(ColorBrickletSubIds.values()));
ohtfDevice.setTfConfig(configuration);
fillupConfig(ohtfDevice, deviceConfig);
} else if (deviceType.equals(TypeKey.bricklet_industrial_dual_analogin.name())) {
BrickletIndustrialDualAnalogInConfiguration configuration = modelFactory.createBrickletIndustrialDualAnalogInConfiguration();
OHTFDevice<BrickletIndustrialDualAnalogInConfiguration, IndustrialDualAnalogInSubIds> ohtfDevice = modelFactory.createOHTFDevice();
ohtfDevice.getSubDeviceIds().addAll(Arrays.asList(IndustrialDualAnalogInSubIds.values()));
ohtfDevice.setTfConfig(configuration);
fillupConfig(ohtfDevice, deviceConfig);
} else if (deviceType.equals(TypeKey.bricklet_analogin.name())) {
TFAnalogInConfiguration configuration = modelFactory.createTFAnalogInConfiguration();
OHTFDevice<TFAnalogInConfiguration, NoSubIds> ohtfDevice = modelFactory.createOHTFDevice();
ohtfDevice.getSubDeviceIds().addAll(Arrays.asList(NoSubIds.values()));
ohtfDevice.setTfConfig(configuration);
fillupConfig(ohtfDevice, deviceConfig);
} else if (deviceType.equals(TypeKey.bricklet_analoginv2.name())) {
TFAnalogInV2Configuration configuration = modelFactory.createTFAnalogInV2Configuration();
OHTFDevice<TFAnalogInV2Configuration, NoSubIds> ohtfDevice = modelFactory.createOHTFDevice();
ohtfDevice.getSubDeviceIds().addAll(Arrays.asList(NoSubIds.values()));
ohtfDevice.setTfConfig(configuration);
fillupConfig(ohtfDevice, deviceConfig);
} else if (deviceType.equals(TypeKey.accelerometer_led.name())) {
OHTFDevice<?, AccelerometerSubIds> ohtfDevice = modelFactory.createOHTFDevice();
ohtfDevice.getSubDeviceIds().addAll(Arrays.asList(AccelerometerSubIds.values()));
fillupConfig(ohtfDevice, deviceConfig);
} else if (deviceType.equals(TypeKey.accelerometer_temperature.name())) {
OHTFDevice<?, AccelerometerSubIds> ohtfDevice = modelFactory.createOHTFDevice();
ohtfDevice.getSubDeviceIds().addAll(Arrays.asList(AccelerometerSubIds.values()));
fillupConfig(ohtfDevice, deviceConfig);
} else if (deviceType.equals(TypeKey.bricklet_accelerometer.name())) {
BrickletAccelerometerConfiguration configuration = modelFactory.createBrickletAccelerometerConfiguration();
OHTFDevice<BrickletAccelerometerConfiguration, AccelerometerSubIds> ohtfDevice = modelFactory.createOHTFDevice();
ohtfDevice.getSubDeviceIds().addAll(Arrays.asList(AccelerometerSubIds.values()));
ohtfDevice.setTfConfig(configuration);
fillupConfig(ohtfDevice, deviceConfig);
} else if (deviceType.equals(TypeKey.laser_range_finder_laser.name())) {
OHTFDevice<?, LaserRangeFinderSubIds> ohtfDevice = modelFactory.createOHTFDevice();
ohtfDevice.getSubDeviceIds().addAll(Arrays.asList(LaserRangeFinderSubIds.values()));
fillupConfig(ohtfDevice, deviceConfig);
} else if (deviceType.equals(TypeKey.bricklet_laser_range_finder.name())) {
LaserRangeFinderConfiguration configuration = modelFactory.createLaserRangeFinderConfiguration();
OHTFDevice<LaserRangeFinderConfiguration, LaserRangeFinderSubIds> ohtfDevice = modelFactory.createOHTFDevice();
ohtfDevice.getSubDeviceIds().addAll(Arrays.asList(LaserRangeFinderSubIds.values()));
ohtfDevice.setTfConfig(configuration);
fillupConfig(ohtfDevice, deviceConfig);
} else if (deviceType.equals(TypeKey.bricklet_oled128x64.name()) || deviceType.equals(TypeKey.bricklet_oled64x48.name())) {
BrickletOLEDConfiguration configuration = modelFactory.createBrickletOLEDConfiguration();
OHTFDevice<BrickletOLEDConfiguration, NoSubIds> ohtfDevice = modelFactory.createOHTFDevice();
ohtfDevice.getSubDeviceIds().addAll(Arrays.asList(NoSubIds.values()));
ohtfDevice.setTfConfig(configuration);
fillupConfig(ohtfDevice, deviceConfig);
} else if (deviceType.equals(TypeKey.bricklet_thermocouple.name())) {
TFThermocoupleConfiguration configuration = modelFactory.createTFThermocoupleConfiguration();
OHTFDevice<TFThermocoupleConfiguration, NoSubIds> ohtfDevice = modelFactory.createOHTFDevice();
ohtfDevice.getSubDeviceIds().addAll(Arrays.asList(NoSubIds.values()));
ohtfDevice.setTfConfig(configuration);
fillupConfig(ohtfDevice, deviceConfig);
} else {
logger.debug("{} setting no tfConfig device_type {}", LoggerConstants.CONFIG, deviceType);
logger.trace("{} deviceType {}", LoggerConstants.CONFIG, deviceType);
OHTFDevice<?, NoSubIds> ohtfDevice = modelFactory.createOHTFDevice();
ohtfDevice.getSubDeviceIds().addAll(Arrays.asList(NoSubIds.values()));
fillupConfig(ohtfDevice, deviceConfig);
}
}
Aggregations