Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/eclipse-thingweb/dart_wot
Framework to build Web of Things applications in Dart and Flutter.
https://github.com/eclipse-thingweb/dart_wot
coap dart flutter internetofthings iot web-of-things wot
Last synced: 12 days ago
JSON representation
Framework to build Web of Things applications in Dart and Flutter.
- Host: GitHub
- URL: https://github.com/eclipse-thingweb/dart_wot
- Owner: eclipse-thingweb
- License: other
- Created: 2021-10-29T14:31:17.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2024-12-12T21:39:14.000Z (21 days ago)
- Last Synced: 2024-12-12T22:28:49.332Z (21 days ago)
- Topics: coap, dart, flutter, internetofthings, iot, web-of-things, wot
- Language: Dart
- Homepage: https://thingweb.io
- Size: 1.2 MB
- Stars: 15
- Watchers: 9
- Forks: 3
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
[![pub package](https://img.shields.io/pub/v/dart_wot.svg)](https://pub.dev/packages/dart_wot)
[![Build](https://github.com/eclipse-thingweb/dart_wot/actions/workflows/ci.yml/badge.svg)](https://github.com/eclipse-thingweb/dart_wot/actions/workflows/ci.yml)
[![codecov](https://codecov.io/gh/eclipse-thingweb/dart_wot/branch/main/graph/badge.svg?token=76OBNOVL60)](https://codecov.io/gh/eclipse-thingweb/dart_wot)
[![style: lint](https://img.shields.io/badge/style-lint-4BC0F5.svg)](https://pub.dev/packages/lint)
[![Adopters](https://img.shields.io/badge/Show%20Adopters%20and%20Users-%2331b8a3ff?logoColor=31b8a3ff)](#adopters)
# dart_wot
dart_wot is an implementation of the
Web of Things [Scripting API](https://w3c.github.io/wot-scripting-api/) modelled
after the WoT reference implementation
[node-wot](https://github.com/eclipse-thingweb/node-wot).
At the moment, it supports interacting with Things using the Constrained Application
Protocol (CoAP), the Hypertext Transfer Protocol (HTTP), and the MQTT protocol.## Features
You can consume Thing Descriptions and interact with a Thing based on its
exposed Properties, Actions, and Events.
Discovery support is currently limited to the "direct" method (i.e. fetching a
TD using a single URL).
Exposing Things is not yet supported but will be added in future versions.Using the Protocol Interfaces in the `core` package, you can add support for
additional protocols in your own application or library. The main requirement
for this to work is the existence of a URI scheme for the given protocol.## Getting started
To get started, you first need to install the package by adding it to your
`pubspec.yaml` file.
You can use `dart pub add dart_wot` (for a Dart project) or
`flutter pub add dart_wot` (for a Flutter project) to do so.You can then use the package in your project by adding
`import 'package:dart_wot/dart_wot.dart'` to your source files.## Usage
Below you can find a basic example for incrementing and reading the value of a
counter Thing, which is part of the
[Thingweb Online Things](https://www.thingweb.io/services).In the example, we first create a WoT runtime using a `Servient` with CoAP and
HTTP support.
With the runtime, we then retrieve a TD (using the `requestThingDescription()`
method) and consume it (using the `consume()` method), creating a
`ConsumedThing` object,
Afterward, the actual interactions with the counter are performed by calling the
`invokeAction()` and `readProperty()` methods on the `ConsumedThing`.```dart
import "package:dart_wot/binding_coap.dart";
import "package:dart_wot/binding_http.dart";
import "package:dart_wot/core.dart";Future main(List args) async {
final servient = Servient.create(
clientFactories: [
CoapClientFactory(),
HttpClientFactory(),
],
);
final wot = await servient.start();final url = Uri.parse("coap://plugfest.thingweb.io/counter");
print("Requesting TD from $url ...");
final thingDescription = await wot.requestThingDescription(url);final consumedThing = await wot.consume(thingDescription);
print(
"Successfully retrieved and consumed TD with title "
'"${thingDescription.title}"!',
);print(consumedThing.thingDescription.events);
final subscription = await consumedThing.subscribeEvent("change", print);print("Incrementing counter ...");
await consumedThing.invokeAction("increment");final status = await consumedThing.readProperty("count");
final value = await status.value();
print("New counter value: $value");await subscription.stop();
}
```More complex examples can be found in the `example` directory.
## License
`dart_wot` is licensed under the 3-Clause BSD License.
See the `LICENSE` file for more information.SPDX-License-Identifier: BSD-3-Clause
## Acknowledgements
`dart_wot` was inspired by Eclipse Thingweb
[node-wot](https://github.com/eclipse/thingweb.node-wot), a W3C Web of Things
implementation for the Node.js ecosystem.## Contribution
Please refer to our [contribution guidelines](CONTRIBUTING.md) for more details.
## Adopters
If you are using Eclipse Thingweb dart_wot within your organization, please
support us by adding your logo to the
[Eclipse IoT adopters list](https://iot.eclipse.org/adopters/#iot.thingweb).
To do so, simply open an issue at
[the Eclipse Gitlab](https://gitlab.eclipse.org/eclipsefdn/it/api/eclipsefdn-project-adopters/-/issues/new?issuable_template=adopter_request)
by providing the name of your organization, its logo, and a link to your
organization or team.
You should be affiliated with that organization for the issue to be implemented.## Maintainers
This project is currently maintained by the following developers:
| Name | Email Address | GitHub Username |
|:----------:|:--------------------:|:--------------------------------------------:|
| Jan Romann | [email protected] | [JKRhb](https://github.com/JKRhb) |