public class ModbusDetailsRequest {
private final ReadInputRegistersRequest request;
private static class ModbusDetailsRequestLoader {
private static final ModbusDetailsRequest INSTANCE = new ModbusDetailsRequest();
private ModbusDetailsRequestLoader() {
}
}
private ModbusDetailsRequest() {
this.request = new ReadInputRegistersRequest();
}
public static ModbusDetailsRequest getInstance() {
return ModbusDetailsRequestLoader.INSTANCE;
}
public ModbusRequest getRequest(final DeviceRequestConfig config) {
request.setReference(config.getRef());
request.setWordCount(config.getCount());
request.setUnitID(config.getUnitId());
return request;
}
}