Search in sources :

Example 1 with BridgeReadTask

use of io.openems.api.bridge.BridgeReadTask in project openems by OpenEMS.

the class ModbusDeviceNature method setAsRequired.

@Override
public /**
 * Sets a Channel as required. The Range with this Channel will be added to ModbusProtocol.RequiredRanges.
 */
void setAsRequired(Channel channel) {
    ModbusRange range = getProtocol().getRangeByChannel(channel);
    Iterator<BridgeReadTask> i = otherReadTasks.iterator();
    while (i.hasNext()) {
        BridgeReadTask task = i.next();
        if (((ModbusBridgeReadTask) task).getRange().equals(range)) {
            this.readTasks.add(task);
            i.remove();
        }
    }
}
Also used : WriteableModbusRange(io.openems.impl.protocol.modbus.internal.range.WriteableModbusRange) ModbusRange(io.openems.impl.protocol.modbus.internal.range.ModbusRange) BridgeReadTask(io.openems.api.bridge.BridgeReadTask)

Example 2 with BridgeReadTask

use of io.openems.api.bridge.BridgeReadTask in project openems by OpenEMS.

the class StuderDeviceNature method setAsRequired.

@Override
public /**
 * Sets a Channel as required. The Range with this Channel will be added to StuderProtocol.RequiredRanges.
 */
void setAsRequired(Channel channel) {
    StuderProperty<?> property = getProtocol().getPropertyByChannel(channel);
    Iterator<BridgeReadTask> i = readTasks.iterator();
    while (i.hasNext()) {
        BridgeReadTask task = i.next();
        if (((StuderBridgeReadTask) task).getProperty().equals(property)) {
            this.requiredReadTasks.add(task);
            i.remove();
        }
    }
}
Also used : BridgeReadTask(io.openems.api.bridge.BridgeReadTask)

Aggregations

BridgeReadTask (io.openems.api.bridge.BridgeReadTask)2 ModbusRange (io.openems.impl.protocol.modbus.internal.range.ModbusRange)1 WriteableModbusRange (io.openems.impl.protocol.modbus.internal.range.WriteableModbusRange)1