Search in sources :

Example 1 with SerialConfig

use of me.retrodaredevil.io.serial.SerialConfig in project solarthing by wildmountainfarms.

the class SerialIOConfig method createIOBundle.

@Override
public IOBundle createIOBundle() throws Exception {
    SerialConfig serialConfig = this.serialConfig;
    if (serialConfig == null) {
        serialConfig = defaultSerialConfig;
        if (serialConfig == null) {
            throw new NullPointerException("serialConfig is null! This is likely because the injection didn't work properly.");
        }
    }
    String port = this.port;
    if (port == null) {
        throw new NullPointerException("null is not a valid value for the port!");
    }
    SerialPort serialPort = JSerialIOBundle.createSerialPortFromName(port);
    return new JSerialIOBundle(serialPort, serialConfig, new JSerialIOBundle.Config(200, 65536, 65536));
}
Also used : SerialPort(com.fazecast.jSerialComm.SerialPort) SerialConfig(me.retrodaredevil.io.serial.SerialConfig) JSerialIOBundle(me.retrodaredevil.io.serial.JSerialIOBundle)

Aggregations

SerialPort (com.fazecast.jSerialComm.SerialPort)1 JSerialIOBundle (me.retrodaredevil.io.serial.JSerialIOBundle)1 SerialConfig (me.retrodaredevil.io.serial.SerialConfig)1