openDevice method
Initiate connection to open physical device. Set new root capture in order to work within device ecosystem. If successful, set clientOrDeviceHandle to response value and return code for 'no error' (0).
Implementation
Future<int> openDevice(String guid, Capture? capture) async {
if (capture == null) {
throw CaptureException(SktErrors.ESKT_INVALIDPARAMETER,
'The provided parameter is invalid', 'NO CAPTURE INSTANCE');
} else {
rootCapture = capture;
transport = capture.transport;
try {
final int? value = await transport?.openDevice(rootCapture!.clientOrDeviceHandle ?? 0, guid);
clientOrDeviceHandle = value;
return SktErrors.ESKT_NOERROR;
} on CaptureException {
rethrow;
} catch (e) {
throw CaptureException(SktErrors.ESKT_COMMUNICATIONERROR,
'There was an error during communication.', e.toString());
}
}
}