openPort method
Low level method for opening the Z-Wave port. Clients should call open which calls this method.
Implementation
@override
Future<void> openPort(String portPath) async {
_logger.fine('starting isolate');
final setupPort = ReceivePort();
exitPort = ReceivePort();
errorPort = ReceivePort()..listen(_processError);
isolate = await Isolate.spawn(
startIsolate,
[portPath, setupPort.sendPort, notificationPort!.sendPort],
debugName: 'zw_port_isolate',
errorsAreFatal: true,
onExit: exitPort!.sendPort,
onError: errorPort!.sendPort,
);
_logger.fine('awaiting command port');
cmdSendPort = (await setupPort.first) as SendPort;
setupPort.close();
// TODO move all native operations to the isolate
_logger.fine('isolate started');
}