-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add first version of MQTT binding
- Loading branch information
Showing
11 changed files
with
749 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// Copyright 2022 The NAMIB Project Developers. All rights reserved. | ||
// Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file. | ||
// | ||
// SPDX-License-Identifier: BSD-3-Clause | ||
|
||
/// Protocol binding for the Message Queue Telemetry Transport (MQTT). Follows | ||
/// the latest [WoT Binding Templates Specification][spec link] for MQTT. | ||
/// | ||
/// [spec link]: https://w3c.github.io/wot-binding-templates/bindings/protocols/mqtt | ||
export 'src/binding_mqtt/mqtt_client_factory.dart'; | ||
export 'src/binding_mqtt/mqtt_config.dart'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// Copyright 2022 The NAMIB Project Developers. All rights reserved. | ||
// Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file. | ||
// | ||
// SPDX-License-Identifier: BSD-3-Clause | ||
|
||
/// The URI scheme for unsecured MQTT (using TCP). | ||
/// | ||
/// Note that this scheme is not standardized yet, as there is an ongoing debate | ||
/// about URI schemes in the context of MQTT. | ||
const mqttUriScheme = 'mqtt'; | ||
|
||
/// The default port number used for the [mqttUriScheme]. | ||
const defaultMqttPort = 1883; | ||
|
||
/// The URI scheme for secure MQTT (using TCP and TLS). | ||
/// | ||
/// Note that this scheme is not standardized yet, as there is an ongoing debate | ||
/// about URI schemes in the context of MQTT. | ||
const mqttSecureUriScheme = 'mqtts'; | ||
|
||
/// The default port number used for the [mqttSecureUriScheme]. | ||
const defaultMqttSecurePort = 8883; | ||
|
||
/// URI pointing to the MQTT vocabulary. | ||
/// | ||
/// Used for resolving MQTT-related compact URIs (CURIEs) in TDs. Note that | ||
/// the MQTT vocabulary is not standardized yet, so this URI will change in | ||
/// future versions of this library. | ||
const mqttContextUri = 'http://www.example.org/mqtt-binding#'; | ||
|
||
/// The default prefix used in MQTT-related compact URIs (CURIEs) in TDs. | ||
const defaultMqttPrefix = 'mqv'; | ||
|
||
/// Default timeout length used for reading properties and discovering TDs. | ||
const defaultTimeout = Duration(seconds: 10); | ||
|
||
/// Default duration MQTT connections are kept alive in seconds. | ||
const defaultKeepAlivePeriod = 20; | ||
|
||
/// Default content type when returning a `Content` object from the MQTT | ||
/// binding. | ||
/// | ||
/// Evaluates to `'application/octet-stream'. | ||
const defaultContentType = 'application/octet-stream'; | ||
|
||
/// Content type used for the Content objects returned by discovery using MQTT. | ||
/// | ||
/// Evaluates to `application/td+json`. | ||
// TODO: Should probably be redefined globally | ||
const discoveryContentType = 'application/td+json'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Copyright 2022 The NAMIB Project Developers. All rights reserved. | ||
// Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file. | ||
// | ||
// SPDX-License-Identifier: BSD-3-Clause | ||
|
||
/// An [Exception] that is thrown if an error occurs within the MQTT binding. | ||
class MqttBindingException implements Exception { | ||
/// Constructor. | ||
MqttBindingException(this._message); | ||
|
||
final String _message; | ||
|
||
@override | ||
String toString() => 'MqttBindingException: $_message'; | ||
} |
Oops, something went wrong.