ModbusRequest request = new ReadCoilsRequest(getStart(), getLength());
if (this instanceof ModbusSerialSlave) {
request.setHeadless();
}
request.setUnitID(id);
ReadCoilsResponse responce = (ReadCoilsResponse) getModbusData(request);
local = responce.getCoils();
} else if (ModbusBindingProvider.TYPE_DISCRETE.equals(getType())) {
ModbusRequest request = new ReadInputDiscretesRequest(getStart(), getLength());
ReadInputDiscretesResponse responce = (ReadInputDiscretesResponse) getModbusData(request);
local = responce.getDiscretes();
} else if (ModbusBindingProvider.TYPE_HOLDING.equals(getType())) {
ModbusRequest request = new ReadMultipleRegistersRequest(getStart(), getLength());
ReadMultipleRegistersResponse responce = (ReadMultipleRegistersResponse) getModbusData(request);
local = responce.getRegisters();
} else if (ModbusBindingProvider.TYPE_INPUT.equals(getType())) {
ModbusRequest request = new ReadInputRegistersRequest(getStart(), getLength());
ReadInputRegistersResponse responce = (ReadInputRegistersResponse) getModbusData(request);
local = responce.getRegisters();
}
if (storage == null)
storage = local;
else {
synchronized(storage) {