subscribe method
Future<void>
subscribe(
- int nodeId,
- SubscriptionCallback callback,
- List<ChipAttributePath>? attributePaths,
- List<ChipEventPath>? eventPaths,
- int minInterval,
- int maxInterval,
- bool keepSubscriptions,
- bool isFabricFiltered,
- int imTimeoutMs,
- int eventMin, {
- Object? connectContext,
})
Implementation
Future<void> subscribe(
int nodeId,
SubscriptionCallback callback,
// int devicePtr,
List<ChipAttributePath>? attributePaths,
List<ChipEventPath>? eventPaths,
// List<DataVersionFilter>? dataVersionFilters,
int minInterval,
int maxInterval,
bool keepSubscriptions,
bool isFabricFiltered,
int imTimeoutMs,
int eventMin,
{Object? connectContext}
) async {
String callbackHandle = callback.hashCode.toString();
_subscriptionCallbacks[callbackHandle] = callback;
try {
await _requestPlatform('subscribe', jsonEncode({
jsonKeyHandle: _platformDeviceControllerHandle,
'nodeId': nodeId,
// 'devicePtr': devicePtr,
'callbackHandle': callbackHandle,
'attributePaths': attributePaths?.map((e) => e.toJson()).toList(),
'eventPaths': eventPaths?.map((e) => e.toJson()).toList(),
// 'dataVersionFilters': dataVersionFilters?.map((e) => e.toJson()).toList(),
'minInterval': minInterval,
'maxInterval': maxInterval,
'keepSubscriptions': keepSubscriptions,
'isFabricFiltered': isFabricFiltered,
'imTimeoutMs': imTimeoutMs,
'eventMin': eventMin,
'connectContext': connectContext
}));
} catch(e, s) {
print(s);
_subscriptionCallbacks.remove(callbackHandle);
}
}