init method

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

Initializes the connection to the device.

Implementation

@override
Future<bool> init() async {
  try {
    if (!await device.init()) {
      logger.critical("Could not open GPS on port $gpsPort");
      return false;
    }
    _subscription = device.stream.listen(_handlePacket);
	device.startListening();
	logger.info("Reading GPS over port $gpsPort");
    return true;
  } catch (error) {
    logger.critical("Could not open GPS", body: "Port $gpsPort, Error=$error");
    return false;
  }
}