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 {
final Params newParams =
Params(handle: clientOrDeviceHandle, property: property);
final JRpcRequest setRequest = JRpcRequest(
id: _getJsonRpcId(), method: 'setproperty', params: newParams);
try {
final JRpcResponse response = await sendRequest(setRequest);
final CaptureResult? result = response.captureResult;
if (clientOrDeviceHandle != result?.handle) {
throw CaptureException(
SktErrors.ESKT_INVALIDHANDLE,
'The provided handle is invalid',
'The response handle does not match with the handle of the request');
}
return result?.property ??
(throw Exception('Missing property in response'));
} on CaptureException {
rethrow;
} catch (e) {
throw CaptureException(-32602, 'Something went wrong.', e.toString());
}
}