Skip to content

Commit

Permalink
Merge pull request #142 from eclipse-thingweb/servient-api
Browse files Browse the repository at this point in the history
feat!: rework Servient API
  • Loading branch information
JKRhb authored May 21, 2024
2 parents 6ad6c0e + 830b964 commit e21cc4e
Show file tree
Hide file tree
Showing 20 changed files with 245 additions and 155 deletions.
4 changes: 2 additions & 2 deletions example/coap_discovery.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ Future<void> handleThingDescription(
}

Future<void> main(List<String> args) async {
final servient = Servient(
final servient = Servient.create(
clientFactories: [CoapClientFactory()],
discoveryConfiguration: [
discoveryConfigurations: [
DirectConfiguration(
Uri.parse("coap://plugfest.thingweb.io:5683/testthing"),
),
Expand Down
4 changes: 2 additions & 2 deletions example/coap_dns_sd_discovery.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ void handleThingDescription(ThingDescription thingDescription) =>
print('Discovered TD with title "${thingDescription.title}".');

Future<void> main(List<String> args) async {
final servient = Servient(
final servient = Servient.create(
clientFactories: [
CoapClientFactory(),
HttpClientFactory(),
],
discoveryConfiguration: [
discoveryConfigurations: [
DnsSdDConfiguration(protocolType: ProtocolType.udp),
],
);
Expand Down
2 changes: 1 addition & 1 deletion example/coaps_readproperty.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Future<void> main(List<String> args) async {
pskCredentialsCallback: _pskCredentialsCallback,
);

final servient = Servient(
final servient = Servient.create(
clientFactories: [
coapClientFactory,
],
Expand Down
2 changes: 1 addition & 1 deletion example/complex_example.dart
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ Future<void> main() async {
final httpClientFactory =
HttpClientFactory(basicCredentialsCallback: basicCredentialsCallback);

final servient = Servient(
final servient = Servient.create(
clientFactories: [
coapClientFactory,
httpClientFactory,
Expand Down
4 changes: 2 additions & 2 deletions example/core_link_format_discovery.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import "package:dart_wot/binding_coap.dart";
import "package:dart_wot/core.dart";

Future<void> main(List<String> args) async {
final servient = Servient(
final servient = Servient.create(
clientFactories: [CoapClientFactory()],
discoveryConfiguration: [
discoveryConfigurations: [
CoreLinkFormatConfiguration(
Uri.parse("coap://plugfest.thingweb.io"),
),
Expand Down
2 changes: 1 addition & 1 deletion example/directory_discovery.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import "package:dart_wot/binding_http.dart";
import "package:dart_wot/core.dart";

Future<void> main(List<String> args) async {
final servient = Servient(
final servient = Servient.create(
clientFactories: [
HttpClientFactory(),
],
Expand Down
2 changes: 1 addition & 1 deletion example/example.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import "package:dart_wot/binding_http.dart";
import "package:dart_wot/core.dart";

Future<void> main(List<String> args) async {
final servient = Servient(
final servient = Servient.create(
clientFactories: [
CoapClientFactory(),
HttpClientFactory(),
Expand Down
2 changes: 1 addition & 1 deletion example/http_basic_authentication.dart
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ Future<void> main(List<String> args) async {
final httpClientFactory = HttpClientFactory(
basicCredentialsCallback: basicCredentialsCallback,
);
final servient = Servient(
final servient = Servient.create(
clientFactories: [
httpClientFactory,
],
Expand Down
2 changes: 1 addition & 1 deletion example/mqtt_example.dart
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ Future<BasicCredentials?> basicCredentialsCallback(
}

Future<void> main(List<String> args) async {
final servient = Servient(
final servient = Servient.create(
clientFactories: [
MqttClientFactory(basicCredentialsCallback: basicCredentialsCallback),
],
Expand Down
2 changes: 1 addition & 1 deletion lib/src/core/implementation.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ export "implementation/discovery/discovery_configuration.dart";
export "implementation/protocol_interfaces/protocol_client.dart";
export "implementation/protocol_interfaces/protocol_client_factory.dart";
export "implementation/protocol_interfaces/protocol_server.dart";
export "implementation/servient.dart";
export "implementation/servient.dart" show Servient;
4 changes: 2 additions & 2 deletions lib/src/core/implementation/consumed_thing.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class ConsumedThing implements scripting_api.ConsumedThing {
: title = thingDescription.title;

/// The [Servient] corresponding with this [ConsumedThing].
final Servient servient;
final InternalServient servient;

@override
final ThingDescription thingDescription;
Expand Down Expand Up @@ -428,7 +428,7 @@ class ConsumedThing implements scripting_api.ConsumedThing {
_subscribedEvents.clear();

if (external) {
return servient.deregisterConsumedthing(this);
return servient.deregisterConsumedThing(this);
}

return false;
Expand Down
Loading

0 comments on commit e21cc4e

Please sign in to comment.