init method

  1. @override
Future<bool> init()
override

Initializes the connection to the device.

Implementation

@override
Future<bool> init() async {
  try {
    if (!await serial.init()) {
      logger.critical("Could not open IMU on port $imuPort");
      return false;
    }
    subscription = serial.stream.map(processSlip).listen(handleOsc);
    serial.startListening();
    logger.info("Reading IMU on port $imuPort");
    return true;
  } catch (error) {
    logger.critical("Could not open IMU", body: "Port $imuPort, Error: $error");
    return false;
  }
}