if (bit != -1) {
if (registerRange != RegisterRange.HOLDING_REGISTER
&& registerRange != RegisterRange.INPUT_REGISTER) {
//throw a bad configuration exception.
} else {
modbusLocator = new BinaryLocator(slaveId, registerRange, offset, bit);
//modbusLocator = new ModbusLocator(slaveId,registerRange,offset,dataType,bit);
}
} else {
if (registerRange == RegisterRange.COIL_STATUS) {
modbusLocator = new BinaryLocator(slaveId, registerRange, offset);
} else {
modbusLocator = new NumericLocator(slaveId, registerRange, offset, dataType);
}
}
//TODO: use the number of registers