use of org.openhab.binding.tinkerforge.internal.model.ModelFactory in project openhab1-addons by openhab.
the class MBrickdImpl method addDevice.
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated NOT
*/
@SuppressWarnings("unchecked")
private void addDevice(String uid, String connectedUid, int deviceIdentifier) {
logger.debug("{} addDevice called for uid: {}", LoggerConstants.TFINIT, uid);
if (getDevice(uid) != null) {
logger.debug("{} device already exists. uid: {}", LoggerConstants.TFINIT, uid);
} else {
ModelFactory factory = ModelFactory.eINSTANCE;
MDevice<?> mDevice = null;
if (deviceIdentifier == BrickletTemperature.DEVICE_IDENTIFIER) {
logger.debug("{} addDevice temperature", LoggerConstants.TFINIT);
mDevice = factory.createMBrickletTemperature();
mDevice.setDeviceIdentifier(BrickletTemperature.DEVICE_IDENTIFIER);
} else if (deviceIdentifier == BrickletHumidity.DEVICE_IDENTIFIER) {
logger.debug("{} addDevice humidity", LoggerConstants.TFINIT);
mDevice = factory.createMBrickletHumidity();
mDevice.setDeviceIdentifier(BrickletHumidity.DEVICE_IDENTIFIER);
} else if (deviceIdentifier == BrickServo.DEVICE_IDENTIFIER) {
logger.debug("{} addDevice BrickServo", LoggerConstants.TFINIT);
mDevice = factory.createMBrickServo();
mDevice.setDeviceIdentifier(BrickServo.DEVICE_IDENTIFIER);
} else if (deviceIdentifier == BrickletDualRelay.DEVICE_IDENTIFIER) {
logger.debug("{} addDevice BrickletDualRelayBricklet", LoggerConstants.TFINIT);
mDevice = factory.createMDualRelayBricklet();
mDevice.setDeviceIdentifier(BrickletDualRelay.DEVICE_IDENTIFIER);
} else if (deviceIdentifier == BrickletIndustrialQuadRelay.DEVICE_IDENTIFIER) {
logger.debug("{} addDevice BrickletIndustrialQuadRelayBricklet", LoggerConstants.TFINIT);
mDevice = factory.createMIndustrialQuadRelayBricklet();
mDevice.setDeviceIdentifier(BrickletIndustrialQuadRelay.DEVICE_IDENTIFIER);
} else if (deviceIdentifier == BrickletBarometer.DEVICE_IDENTIFIER) {
logger.debug("{} addDevice BrickletBarometer", LoggerConstants.TFINIT);
mDevice = factory.createMBrickletBarometer();
mDevice.setDeviceIdentifier(BrickletBarometer.DEVICE_IDENTIFIER);
} else if (deviceIdentifier == BrickletAmbientLight.DEVICE_IDENTIFIER) {
logger.debug("{} addDevice AmbientLight", LoggerConstants.TFINIT);
mDevice = factory.createMBrickletAmbientLight();
mDevice.setDeviceIdentifier(BrickletAmbientLight.DEVICE_IDENTIFIER);
} else if (deviceIdentifier == BrickletAmbientLightV2.DEVICE_IDENTIFIER) {
logger.debug("{} addDevice AmbientLighV2", LoggerConstants.TFINIT);
mDevice = factory.createMBrickletAmbientLightV2();
mDevice.setDeviceIdentifier(BrickletAmbientLightV2.DEVICE_IDENTIFIER);
} else if (deviceIdentifier == BrickletDistanceIR.DEVICE_IDENTIFIER) {
logger.debug("{} addDevice DistanceIR", LoggerConstants.TFINIT);
mDevice = factory.createMBrickletDistanceIR();
mDevice.setDeviceIdentifier(BrickletDistanceIR.DEVICE_IDENTIFIER);
} else if (deviceIdentifier == BrickDC.DEVICE_IDENTIFIER) {
logger.debug("{} addDevice BrickDC", LoggerConstants.TFINIT);
mDevice = factory.createMBrickDC();
mDevice.setDeviceIdentifier(BrickDC.DEVICE_IDENTIFIER);
} else if (deviceIdentifier == BrickletLCD20x4.DEVICE_IDENTIFIER) {
logger.debug("addDevice BrickletLCD20x4");
mDevice = factory.createMBrickletLCD20x4();
mDevice.setDeviceIdentifier(BrickletLCD20x4.DEVICE_IDENTIFIER);
} else if (deviceIdentifier == BrickletIndustrialDigitalIn4.DEVICE_IDENTIFIER) {
logger.debug("addDevice BrickletIndustrialDigitalIn4");
mDevice = factory.createMBrickletIndustrialDigitalIn4();
mDevice.setDeviceIdentifier(BrickletIndustrialDigitalIn4.DEVICE_IDENTIFIER);
} else if (deviceIdentifier == BrickletIO16.DEVICE_IDENTIFIER) {
logger.debug("addDevice BrickletIO16");
mDevice = factory.createMBrickletIO16();
mDevice.setDeviceIdentifier(BrickletIO16.DEVICE_IDENTIFIER);
} else if (deviceIdentifier == BrickletRemoteSwitch.DEVICE_IDENTIFIER) {
logger.debug("addDevice BrickletRemoteSwitch");
mDevice = factory.createMBrickletRemoteSwitch();
mDevice.setDeviceIdentifier(BrickletRemoteSwitch.DEVICE_IDENTIFIER);
} else if (deviceIdentifier == BrickletMotionDetector.DEVICE_IDENTIFIER) {
logger.debug("addDevice BrickletMotionDetector");
mDevice = factory.createMBrickletMotionDetector();
mDevice.setDeviceIdentifier(BrickletMotionDetector.DEVICE_IDENTIFIER);
} else if (deviceIdentifier == BrickletMultiTouch.DEVICE_IDENTIFIER) {
logger.debug("addDevice BrickletMultiTouch");
mDevice = factory.createMBrickletMultiTouch();
mDevice.setDeviceIdentifier(BrickletMultiTouch.DEVICE_IDENTIFIER);
} else if (deviceIdentifier == BrickletTemperatureIR.DEVICE_IDENTIFIER) {
logger.debug("addDevice BrickletTemperatureIR");
mDevice = factory.createMBrickletTemperatureIR();
mDevice.setDeviceIdentifier(BrickletTemperatureIR.DEVICE_IDENTIFIER);
} else if (deviceIdentifier == BrickletSoundIntensity.DEVICE_IDENTIFIER) {
logger.debug("addDevice BrickletSoundIntensity");
mDevice = factory.createMBrickletSoundIntensity();
mDevice.setDeviceIdentifier(BrickletSoundIntensity.DEVICE_IDENTIFIER);
} else if (deviceIdentifier == BrickletMoisture.DEVICE_IDENTIFIER) {
logger.debug("addDevice BrickletMoisture");
mDevice = factory.createMBrickletMoisture();
mDevice.setDeviceIdentifier(BrickletMoisture.DEVICE_IDENTIFIER);
} else if (deviceIdentifier == BrickletDistanceUS.DEVICE_IDENTIFIER) {
logger.debug("addDevice BrickletDistanceUS");
mDevice = factory.createMBrickletDistanceUS();
mDevice.setDeviceIdentifier(BrickletDistanceUS.DEVICE_IDENTIFIER);
} else if (deviceIdentifier == BrickletVoltageCurrent.DEVICE_IDENTIFIER) {
logger.debug("addDevice BrickletVoltageCurrent");
mDevice = factory.createMBrickletVoltageCurrent();
mDevice.setDeviceIdentifier(BrickletVoltageCurrent.DEVICE_IDENTIFIER);
} else if (deviceIdentifier == BrickletTilt.DEVICE_IDENTIFIER) {
logger.debug("addDevice BrickletTilt");
mDevice = factory.createMBrickletTilt();
mDevice.setDeviceIdentifier(BrickletTilt.DEVICE_IDENTIFIER);
} else if (deviceIdentifier == BrickletIO4.DEVICE_IDENTIFIER) {
logger.debug("addDevice BrickletIO4");
mDevice = factory.createMBrickletIO4();
mDevice.setDeviceIdentifier(BrickletIO4.DEVICE_IDENTIFIER);
} else if (deviceIdentifier == BrickletHallEffect.DEVICE_IDENTIFIER) {
logger.debug("addDevice BrickletHallEffect");
mDevice = factory.createMBrickletHallEffect();
mDevice.setDeviceIdentifier(BrickletHallEffect.DEVICE_IDENTIFIER);
} else if (deviceIdentifier == BrickletIndustrialDigitalOut4.DEVICE_IDENTIFIER) {
logger.debug("addDevice BrickletIndustrilaDigitalOut4");
mDevice = factory.createMBrickletIndustrialDigitalOut4();
mDevice.setDeviceIdentifier(BrickletIndustrialDigitalOut4.DEVICE_IDENTIFIER);
} else if (deviceIdentifier == BrickletSegmentDisplay4x7.DEVICE_IDENTIFIER) {
logger.debug("addDevice BrickletSegmentDisplay4x7");
mDevice = factory.createMBrickletSegmentDisplay4x7();
mDevice.setDeviceIdentifier(BrickletSegmentDisplay4x7.DEVICE_IDENTIFIER);
} else if (deviceIdentifier == BrickletLEDStrip.DEVICE_IDENTIFIER) {
logger.debug("addDevice BrickletLEDStrip");
mDevice = factory.createMBrickletLEDStrip();
mDevice.setDeviceIdentifier(BrickletLEDStrip.DEVICE_IDENTIFIER);
} else if (deviceIdentifier == BrickletJoystick.DEVICE_IDENTIFIER) {
logger.debug("addDevice BrickletJoystick");
mDevice = factory.createMBrickletJoystick();
mDevice.setDeviceIdentifier(BrickletJoystick.DEVICE_IDENTIFIER);
} else if (deviceIdentifier == BrickletLinearPoti.DEVICE_IDENTIFIER) {
logger.debug("addDevice BrickletLinearPoti");
mDevice = factory.createMBrickletLinearPoti();
mDevice.setDeviceIdentifier(BrickletLinearPoti.DEVICE_IDENTIFIER);
} else if (deviceIdentifier == BrickletDualButton.DEVICE_IDENTIFIER) {
logger.debug("addDevice BrickletDualButton");
mDevice = factory.createMBrickletDualButton();
mDevice.setDeviceIdentifier(BrickletDualButton.DEVICE_IDENTIFIER);
} else if (deviceIdentifier == BrickletPTC.DEVICE_IDENTIFIER) {
logger.debug("addDevice BrickletPTC");
mDevice = factory.createMBrickletPTC();
mDevice.setDeviceIdentifier(BrickletPTC.DEVICE_IDENTIFIER);
} else if (deviceIdentifier == BrickletIndustrialDual020mA.DEVICE_IDENTIFIER) {
logger.debug("addDevice BrickletIndustrialDual020mA");
mDevice = factory.createMBrickletIndustrialDual020mA();
mDevice.setDeviceIdentifier(BrickletIndustrialDual020mA.DEVICE_IDENTIFIER);
} else if (deviceIdentifier == BrickletSolidStateRelay.DEVICE_IDENTIFIER) {
logger.debug("addDevice BrickletSolidStateRelay");
mDevice = factory.createMBrickletSolidStateRelay();
mDevice.setDeviceIdentifier(BrickletSolidStateRelay.DEVICE_IDENTIFIER);
} else if (deviceIdentifier == BrickletPiezoSpeaker.DEVICE_IDENTIFIER) {
logger.debug("addDevice BrickletPiezoSpeaker");
mDevice = factory.createMBrickletPiezoSpeaker();
mDevice.setDeviceIdentifier(BrickletPiezoSpeaker.DEVICE_IDENTIFIER);
} else if (deviceIdentifier == BrickletRotaryEncoder.DEVICE_IDENTIFIER) {
logger.debug("addDevice BrickletRotaryEncoder");
mDevice = factory.createMBrickletRotaryEncoder();
mDevice.setDeviceIdentifier(BrickletRotaryEncoder.DEVICE_IDENTIFIER);
} else if (deviceIdentifier == BrickletDustDetector.DEVICE_IDENTIFIER) {
logger.debug("addDevice BrickletDustDetector");
mDevice = factory.createMBrickletDustDetector();
mDevice.setDeviceIdentifier(BrickletDustDetector.DEVICE_IDENTIFIER);
} else if (deviceIdentifier == BrickletLoadCell.DEVICE_IDENTIFIER) {
logger.debug("addDevice BrickletLoadCell");
mDevice = factory.createMBrickletLoadCell();
mDevice.setDeviceIdentifier(BrickletLoadCell.DEVICE_IDENTIFIER);
} else if (deviceIdentifier == BrickletColor.DEVICE_IDENTIFIER) {
logger.debug("addDevice BrickletColor");
mDevice = factory.createMBrickletColor();
mDevice.setDeviceIdentifier(BrickletColor.DEVICE_IDENTIFIER);
} else if (deviceIdentifier == BrickletIndustrialDualAnalogIn.DEVICE_IDENTIFIER) {
logger.debug("addDevice BrickletIndustrialDualAnalogIn");
mDevice = factory.createMBrickletIndustrialDualAnalogIn();
mDevice.setDeviceIdentifier(BrickletIndustrialDualAnalogIn.DEVICE_IDENTIFIER);
} else if (deviceIdentifier == BrickletAnalogIn.DEVICE_IDENTIFIER) {
logger.debug("addDevice BrickletAnalogIn");
mDevice = factory.createMBrickletAnalogIn();
mDevice.setDeviceIdentifier(BrickletAnalogIn.DEVICE_IDENTIFIER);
} else if (deviceIdentifier == BrickletAnalogInV2.DEVICE_IDENTIFIER) {
logger.debug("addDevice BrickletAnalogInV2");
mDevice = factory.createMBrickletAnalogInV2();
mDevice.setDeviceIdentifier(BrickletAnalogInV2.DEVICE_IDENTIFIER);
} else if (deviceIdentifier == BrickletLaserRangeFinder.DEVICE_IDENTIFIER) {
logger.debug("addDevice BrickletLaserRangeFinder");
mDevice = factory.createMBrickletLaserRangeFinder();
mDevice.setDeviceIdentifier(BrickletLaserRangeFinder.DEVICE_IDENTIFIER);
} else if (deviceIdentifier == BrickletAccelerometer.DEVICE_IDENTIFIER) {
logger.debug("addDevice BrickletAccelerometer");
mDevice = factory.createMBrickletAccelerometer();
mDevice.setDeviceIdentifier(BrickletAccelerometer.DEVICE_IDENTIFIER);
} else if (deviceIdentifier == BrickletOLED128x64.DEVICE_IDENTIFIER) {
logger.debug("addDevice BrickletOLED128x64");
mDevice = factory.createMBrickletOLED128x64();
mDevice.setDeviceIdentifier(BrickletOLED128x64.DEVICE_IDENTIFIER);
} else if (deviceIdentifier == BrickletOLED64x48.DEVICE_IDENTIFIER) {
logger.debug("addDevice BrickletOLED64x48");
mDevice = factory.createMBrickletOLE64x48();
mDevice.setDeviceIdentifier(BrickletOLED64x48.DEVICE_IDENTIFIER);
} else if (deviceIdentifier == BrickletThermocouple.DEVICE_IDENTIFIER) {
logger.debug("addDevice BrickletThermocouple");
mDevice = factory.createMBrickletThermocouple();
mDevice.setDeviceIdentifier(BrickletThermocouple.DEVICE_IDENTIFIER);
} else if (deviceIdentifier == BrickletUVLight.DEVICE_IDENTIFIER) {
logger.debug("addDevice BrickletUVLight");
mDevice = factory.createMBrickletUVLight();
mDevice.setDeviceIdentifier(BrickletUVLight.DEVICE_IDENTIFIER);
} else if (deviceIdentifier == BrickletCO2.DEVICE_IDENTIFIER) {
logger.debug("addDevice BrickletCO2");
mDevice = factory.createMBrickletCO2();
mDevice.setDeviceIdentifier(BrickletCO2.DEVICE_IDENTIFIER);
} else if (deviceIdentifier == BrickletAnalogOutV2.DEVICE_IDENTIFIER) {
logger.debug("addDevice BrickletAnalogOutV2");
mDevice = factory.createMBrickletAnalogOutV2();
mDevice.setDeviceIdentifier(BrickletAnalogOutV2.DEVICE_IDENTIFIER);
}
if (mDevice != null) {
mDevice.setIpConnection(getIpConnection());
logger.debug("{} addDevice uid: {}", LoggerConstants.TFINIT, uid);
mDevice.setUid(uid);
mDevice.setConnectedUid(connectedUid);
mDevice.init();
// be aware this triggers the notifier
mDevice.setBrickd(this);
if (mDevice instanceof MSubDeviceHolder) {
logger.debug("{} initSubDevices uid: {}", LoggerConstants.TFINIT, uid);
((MSubDeviceHolder<MSubDevice<?>>) mDevice).initSubDevices();
}
}
}
}
use of org.openhab.binding.tinkerforge.internal.model.ModelFactory in project openhab1-addons by openhab.
the class MBrickletLoadCellImpl method initSubDevices.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated NOT
*/
@Override
public void initSubDevices() {
ModelFactory factory = ModelFactory.eINSTANCE;
LoadCellWeight weight = factory.createLoadCellWeight();
weight.setUid(getUid());
String subIdWeight = "weight";
weight.setSubId(subIdWeight);
logger.debug("{} addSubDevice {}", LoggerConstants.TFINIT, subIdWeight);
weight.init();
weight.setMbrick(this);
LoadCellLed led = factory.createLoadCellLed();
led.setUid(getUid());
String subIdLed = "led";
led.setSubId(subIdLed);
logger.debug("{} addSubDevice {}", LoggerConstants.TFINIT, subIdLed);
led.init();
led.setMbrick(this);
}
use of org.openhab.binding.tinkerforge.internal.model.ModelFactory in project openhab1-addons by openhab.
the class MBrickletLaserRangeFinderImpl method initSubDevices.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated NOT
*/
@Override
public void initSubDevices() {
ModelFactory factory = ModelFactory.eINSTANCE;
LaserRangeFinderDistance distance = factory.createLaserRangeFinderDistance();
distance.setUid(getUid());
String subIdDistance = "distance";
logger.debug("{} addSubDevice {}", LoggerConstants.TFINIT, subIdDistance);
distance.setSubId(subIdDistance);
distance.init();
distance.setMbrick(this);
LaserRangeFinderVelocity velocity = factory.createLaserRangeFinderVelocity();
velocity.setUid(getUid());
String subIdVelocity = "velocity";
logger.debug("{} addSubDevice {}", LoggerConstants.TFINIT, subIdVelocity);
velocity.setSubId(subIdVelocity);
velocity.init();
velocity.setMbrick(this);
LaserRangeFinderLaser laser = factory.createLaserRangeFinderLaser();
laser.setUid(getUid());
String subIdLaser = "laser";
logger.debug("{} addSubDevice {}", LoggerConstants.TFINIT, subIdLaser);
laser.setSubId(subIdLaser);
laser.init();
laser.setMbrick(this);
}
use of org.openhab.binding.tinkerforge.internal.model.ModelFactory in project openhab1-addons by openhab.
the class MIndustrialQuadRelayBrickletImpl method initSubDevices.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated NOT
*/
@Override
public void initSubDevices() {
ModelFactory factory = ModelFactory.eINSTANCE;
for (int i = 0; i < 4; i++) {
MIndustrialQuadRelay relay = factory.createMIndustrialQuadRelay();
relay.setUid(uid);
String subId = "relay" + String.valueOf(i);
logger.debug("addSubDevice " + subId);
relay.setSubId(subId);
relay.init();
relay.setMbrick(this);
getMsubdevices().add(relay);
}
}
use of org.openhab.binding.tinkerforge.internal.model.ModelFactory in project openhab1-addons by openhab.
the class MDualRelayBrickletImpl method initSubDevices.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated NOT
*/
@Override
public void initSubDevices() {
ModelFactory factory = ModelFactory.eINSTANCE;
for (int i = 1; i < 3; i++) {
MDualRelay mrelay = factory.createMDualRelay();
mrelay.setUid(uid);
String subId = "relay" + String.valueOf(i);
logger.debug("addSubDevice: {}", subId);
mrelay.setSubId(subId);
mrelay.init();
mrelay.setMbrick(this);
getMsubdevices().add(mrelay);
}
}
Aggregations