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 == 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);
}
if (mDevice != null) {
mDevice.setIpConnection(getIpConnection());
logger.debug("{} addDevice uid: {}", LoggerConstants.TFINIT, uid);