openDevice method

  1. @override
Future<int> openDevice(
  1. int? clientHandle,
  2. String guid
)
override

Piggyback Capture's openDevice and use parameters and interfaces unique to http connections Implement JSON Rpc protocols.

Implementation

@override
/// Piggyback Capture's openDevice and use parameters and interfaces unique to http connections
/// Implement JSON Rpc protocols.
Future<int> openDevice(int? clientHandle, String guid) async {
  JRpcRequest openRequest = JRpcRequest(
      this._getJsonRpcId(), 'opendevice', Params(clientHandle, guid: guid));

  try {
    JRpcResponse response = await this.sendRequest(openRequest);
    dynamic r = json.decode(response.result);
    var fin = r['result'];
    return fin['handle'];
  } on CaptureException {
    rethrow;
  } catch (ex) {
    throw CaptureException(-32602, 'Something went wrong.', ex.toString());
  }
}