Search in sources :

Example 1 with DigitalSensor

use of org.openhab.binding.tinkerforge.internal.model.DigitalSensor in project openhab1-addons by openhab.

the class MBrickletIO16Impl method initSubDevices.

/**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * 
     * @generated NOT
     */
@Override
public void initSubDevices() {
    ModelFactory factory = ModelFactory.eINSTANCE;
    ArrayList<String> portList = new ArrayList<String>(2);
    portList.add("a");
    portList.add("b");
    char[] a = { 'a', 'b' };
    for (int j = 0; j < a.length; j++) {
        char port = a[j];
        for (int i = 0; i < 8; i++) {
            DigitalSensor sensor = factory.createDigitalSensor();
            sensor.setUid(getUid());
            String genericDeviceId = port + String.valueOf(i);
            String subId = "in" + genericDeviceId;
            sensor.setSubId(subId);
            sensor.setPin(i);
            sensor.setPort(port);
            sensor.setGenericDeviceId(genericDeviceId);
            sensor.init();
            sensor.setMbrick(this);
            logger.debug("{} addSubDevice {}", LoggerConstants.TFINIT, subId);
        }
        for (int i = 0; i < 8; i++) {
            DigitalActorIO16 actor = factory.createDigitalActorIO16();
            actor.setUid(getUid());
            String genericDeviceId = port + String.valueOf(i);
            String subId = "out" + genericDeviceId;
            actor.setSubId(subId);
            actor.setPin(i);
            actor.setPort(port);
            actor.setGenericDeviceId(genericDeviceId);
            actor.init();
            actor.setMbrick(this);
            logger.debug("{} addSubDevice {}", LoggerConstants.TFINIT, subId);
        }
    }
}
Also used : ArrayList(java.util.ArrayList) DigitalSensor(org.openhab.binding.tinkerforge.internal.model.DigitalSensor) ModelFactory(org.openhab.binding.tinkerforge.internal.model.ModelFactory) DigitalActorIO16(org.openhab.binding.tinkerforge.internal.model.DigitalActorIO16)

Aggregations

ArrayList (java.util.ArrayList)1 DigitalActorIO16 (org.openhab.binding.tinkerforge.internal.model.DigitalActorIO16)1 DigitalSensor (org.openhab.binding.tinkerforge.internal.model.DigitalSensor)1 ModelFactory (org.openhab.binding.tinkerforge.internal.model.ModelFactory)1