Search in sources :

Example 1 with LocalRoverModbusSlave

use of me.retrodaredevil.solarthing.solar.renogy.rover.modbus.LocalRoverModbusSlave in project solarthing by wildmountainfarms.

the class DummyRoverModbusSlave method createModbusSlave.

@Override
public ModbusSlave createModbusSlave() {
    final FileInputStream fileInputStream;
    try {
        fileInputStream = new FileInputStream(file);
    } catch (FileNotFoundException e) {
        throw new RuntimeException("The dummy file was not found!", e);
    }
    final RoverStatusPacket roverStatusPacket;
    try {
        roverStatusPacket = MAPPER.readValue(fileInputStream, RoverStatusPacket.class);
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
    return new LocalRoverModbusSlave(roverStatusPacket);
}
Also used : RoverStatusPacket(me.retrodaredevil.solarthing.solar.renogy.rover.RoverStatusPacket) LocalRoverModbusSlave(me.retrodaredevil.solarthing.solar.renogy.rover.modbus.LocalRoverModbusSlave) FileNotFoundException(java.io.FileNotFoundException) IOException(java.io.IOException) FileInputStream(java.io.FileInputStream)

Aggregations

FileInputStream (java.io.FileInputStream)1 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 RoverStatusPacket (me.retrodaredevil.solarthing.solar.renogy.rover.RoverStatusPacket)1 LocalRoverModbusSlave (me.retrodaredevil.solarthing.solar.renogy.rover.modbus.LocalRoverModbusSlave)1