setProperty method
Piggyback Capture's setProperty and use parameters and interfaces unique to http connections Implement JSON Rpc protocols.
Implementation
@override
/// Piggyback Capture's setProperty and use parameters and interfaces unique to http connections
/// Implement JSON Rpc protocols.
Future<CaptureProperty> setProperty(
int? clientOrDeviceHandle, CaptureProperty property) async {
Params newParams =
Params(clientOrDeviceHandle, property: property.toJson());
var setRequest =
JRpcRequest(this._getJsonRpcId(), 'setproperty', newParams.toJson());
try {
dynamic response = await this.sendRequest(setRequest);
Map<String, dynamic> res =
json.decode(response.toJson()['result'])['result'];
if (clientOrDeviceHandle != res['handle']) {
throw CaptureException(
SktErrors.ESKT_INVALIDHANDLE,
'The provided handle is invalid',
'The response handle does not match with the handle of the request');
}
return CaptureProperty(res['property']['id'], res['property']['type'],
res['property']['value']);
} on CaptureException {
rethrow;
} catch (e) {
throw CaptureException(-32602, 'Something went wrong.', e.toString());
}
}