Skip to content

Commit

Permalink
fixup! Implement ExposedThing functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
JKRhb committed Jun 20, 2024
1 parent 2dcba20 commit ce579af
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
13 changes: 12 additions & 1 deletion lib/src/core/implementation/exposed_thing.dart
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ class ExposedThing implements scripting_api.ExposedThing, ExposableThing {
}

@override
Stream<Content> handleUnsubscribeEvent(
Future<void> handleUnsubscribeEvent(
String eventName, {
int? formIndex,
Map<String, Object>? uriVariables,
Expand All @@ -292,4 +292,15 @@ class ExposedThing implements scripting_api.ExposedThing, ExposableThing {
// TODO: implement handleWriteMultipleProperties
throw UnimplementedError();
}

@override
Future<void> handleUnobserveProperty(
String eventName, {
int? formIndex,
Map<String, Object>? uriVariables,
Object? data,
}) {
// TODO: implement handleUnobserveProperty
throw UnimplementedError();
}
}
13 changes: 12 additions & 1 deletion lib/src/core/protocol_interfaces/exposable_thing.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import "../definitions.dart";
import "../implementation.dart";

///
typedef PropertyContentMap = Map<String, Content>;

/// Interface that allows ProtocolServers to interact with ExposedThings.
Expand All @@ -23,6 +24,7 @@ abstract interface class ExposableThing {
Object? data,
});

/// Handles a `readmultipleproperties` operation triggered by a TD consumer.
Future<PropertyContentMap> handleReadMultipleProperties(
List<String> propertyNames,
Content input, {
Expand All @@ -31,6 +33,7 @@ abstract interface class ExposableThing {
Object? data,
});

/// Handles a `readallproperties` operation triggered by a TD consumer.
Future<void> handleReadAllProperties(
List<String> propertyNames,
PropertyContentMap inputs, {
Expand Down Expand Up @@ -65,6 +68,14 @@ abstract interface class ExposableThing {
Object? data,
});

/// Handles an `unobserveproperty` operation triggered by a TD consumer.
Future<void> handleUnobserveProperty(
String eventName, {
int? formIndex,
Map<String, Object>? uriVariables,
Object? data,
});

/// Handles an `invokeaction` operation triggered by a TD consumer.
Future<Content?> handleInvokeAction(
String propertyName,
Expand All @@ -83,7 +94,7 @@ abstract interface class ExposableThing {
});

/// Handles an `unsubscribeevent` operation triggered by a TD consumer.
Stream<Content> handleUnsubscribeEvent(
Future<void> handleUnsubscribeEvent(
String eventName, {
int? formIndex,
Map<String, Object>? uriVariables,
Expand Down

0 comments on commit ce579af

Please sign in to comment.