Skip to content

Commit

Permalink
Issue500 (#502)
Browse files Browse the repository at this point in the history
* Issue 500

* Issue 500

* Issue 500

* Issue 500

* Issue 500 - analysis clean, all tests running
  • Loading branch information
shamblett authored Dec 17, 2023
1 parent 4ba0ce8 commit 2a6980d
Show file tree
Hide file tree
Showing 93 changed files with 147 additions and 163 deletions.
36 changes: 18 additions & 18 deletions example/mqtt_client_universal.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,21 @@
* Copyright : S.Hamblett
*/

/// The following scheme can be used conditionally import either the server or browser client
/// automatically.
///
/// import 'server.dart' if (dart.library.html) 'browser.dart' as mqttsetup;
/// ...
/// var client = mqttsetup.setup(serverAddress, uniqueID, port);
///
/// where server.dart will contain such as the following
///
/// MqttClient setup(String serverAddress, String uniqueID, int port) {
/// return MqttServerClient.withPort(serverAddress, uniqueID, port);
/// }
///
/// and browser.dart
///
/// MqttClient setup(String serverAddress, String uniqueID, int port) {
/// return MqttBrowserClient.withPort(serverAddress, uniqueID, port);
/// }
// The following scheme can be used conditionally import either the server or browser client
// automatically.
//
// import 'server.dart' if (dart.library.html) 'browser.dart' as mqttsetup;
// ...
// var client = mqttsetup.setup(serverAddress, uniqueID, port);
//
// where server.dart will contain such as the following
//
// MqttClient setup(String serverAddress, String uniqueID, int port) {
// return MqttServerClient.withPort(serverAddress, uniqueID, port);
// }
//
// and browser.dart
//
// MqttClient setup(String serverAddress, String uniqueID, int port) {
// return MqttBrowserClient.withPort(serverAddress, uniqueID, port);
// }
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
* Copyright : S.Hamblett
*/

part of mqtt_browser_client;
part of '../../../mqtt_browser_client.dart';

/// The MQTT browser connection base class
abstract class MqttBrowserConnection<T extends Object>
extends MqttConnectionBase<T> {
/// Default constructor
MqttBrowserConnection(clientEventBus) : super(clientEventBus);
MqttBrowserConnection(super.clientEventBus);

/// Initializes a new instance of the MqttBrowserConnection class.
MqttBrowserConnection.fromConnect(server, port, clientEventBus)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@
* Copyright : S.Hamblett
*/

part of mqtt_browser_client;
part of '../../../mqtt_browser_client.dart';

/// This class provides specific connection functionality
/// for browser based connection handler implementations.
abstract class MqttBrowserConnectionHandler extends MqttConnectionHandlerBase {
/// Initializes a new instance of the [MqttBrowserConnectionHandler] class.
MqttBrowserConnectionHandler(var clientEventBus,
{required int maxConnectionAttempts})
: super(clientEventBus, maxConnectionAttempts: maxConnectionAttempts);
MqttBrowserConnectionHandler(super.clientEventBus,
{required int super.maxConnectionAttempts});
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
* Copyright : S.Hamblett
*/

part of mqtt_browser_client;
part of '../../../mqtt_browser_client.dart';

/// The MQTT connection class for the browser websocket interface
class MqttBrowserWsConnection extends MqttBrowserConnection<WebSocket> {
/// Default constructor
MqttBrowserWsConnection(events.EventBus? eventBus) : super(eventBus);
MqttBrowserWsConnection(super.eventBus);

/// Initializes a new instance of the MqttConnection class.
MqttBrowserWsConnection.fromConnect(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,15 @@
* Copyright : S.Hamblett
*/

part of mqtt_browser_client;
part of '../../../mqtt_browser_client.dart';

/// Connection handler that performs connections and disconnections
/// to the hostname in a synchronous manner.
class SynchronousMqttBrowserConnectionHandler
extends MqttBrowserConnectionHandler {
/// Initializes a new instance of the MqttConnectionHandler class.
SynchronousMqttBrowserConnectionHandler(clientEventBus,
{required int maxConnectionAttempts, reconnectTimePeriod = 5000})
: super(clientEventBus, maxConnectionAttempts: maxConnectionAttempts) {
SynchronousMqttBrowserConnectionHandler(super.clientEventBus,
{required super.maxConnectionAttempts, reconnectTimePeriod = 5000}) {
connectTimer = MqttCancellableAsyncSleep(reconnectTimePeriod);
initialiseListeners();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Copyright : S.Hamblett
*/

part of mqtt_client;
part of '../../mqtt_client.dart';

/// Enumeration that indicates the origin of a client disconnection
enum MqttDisconnectionOrigin {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Copyright : S.Hamblett
*/

part of mqtt_client;
part of '../../mqtt_client.dart';

/// Callback function definitions
typedef MessageCallbackFunction = bool Function(MqttMessage? message);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Copyright : S.Hamblett
*/

part of mqtt_client;
part of '../../mqtt_client.dart';

/// The MQTT client connection base class
abstract class MqttConnectionBase<T extends Object> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Copyright : S.Hamblett
*/

part of mqtt_client;
part of '../../mqtt_client.dart';

/// This class provides shared connection functionality
/// to serverand browser connection handler implementations.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Copyright : S.Hamblett
*/

part of mqtt_client;
part of '../../mqtt_client.dart';

/// Ping response received callback
typedef PongCallback = void Function();
Expand Down
2 changes: 1 addition & 1 deletion lib/src/connectionhandling/mqtt_client_read_wrapper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Copyright : S.Hamblett
*/

part of mqtt_client;
part of '../../mqtt_client.dart';

/// State and logic used to read from the underlying network stream.
class ReadWrapper {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,13 @@
* Copyright : S.Hamblett
*/

part of mqtt_server_client;
part of '../../../mqtt_server_client.dart';

/// The MQTT client server connection base class
abstract class MqttServerConnection<T extends Object>
extends MqttConnectionBase<T> {
/// Default constructor
MqttServerConnection(clientEventBus, this.socketOptions)
: super(clientEventBus);
MqttServerConnection(super.clientEventBus, this.socketOptions);

/// Initializes a new instance of the MqttConnection class.
MqttServerConnection.fromConnect(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@
* Copyright : S.Hamblett
*/

part of mqtt_server_client;
part of '../../../mqtt_server_client.dart';

/// This class provides specific connection functionality
/// for server based connections.
abstract class MqttServerConnectionHandler extends MqttConnectionHandlerBase {
/// Initializes a new instance of the [MqttServerConnectionHandler] class.
MqttServerConnectionHandler(var clientEventBus,
{required int? maxConnectionAttempts, required this.socketOptions})
: super(clientEventBus, maxConnectionAttempts: maxConnectionAttempts);
MqttServerConnectionHandler(super.clientEventBus,
{required super.maxConnectionAttempts, required this.socketOptions});

/// Use a websocket rather than TCP
bool useWebSocket = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,12 @@
* Copyright : S.Hamblett
*/

part of mqtt_server_client;
part of '../../../mqtt_server_client.dart';

/// The MQTT normal(insecure TCP) server connection class
class MqttServerNormalConnection extends MqttServerConnection<Socket> {
/// Default constructor
MqttServerNormalConnection(
events.EventBus? eventBus, List<RawSocketOption> socketOptions)
: super(eventBus, socketOptions);
MqttServerNormalConnection(super.eventBus, super.socketOptions);

/// Initializes a new instance of the MqttConnection class.
MqttServerNormalConnection.fromConnect(String server, int port,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Copyright : S.Hamblett
*/

part of mqtt_server_client;
part of '../../../mqtt_server_client.dart';

/// The MQTT server secure connection class
class MqttServerSecureConnection extends MqttServerConnection<SecureSocket> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* 01/19/2019 : Don Edvalson - Added this alternate websocket class to work around AWS deficiencies.
*/

part of mqtt_server_client;
part of '../../../mqtt_server_client.dart';

/// Detatched socket class for alternative websocket support
class _DetachedSocket extends Stream<Uint8List> implements Socket {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,12 @@
* Copyright : S.Hamblett
*/

part of mqtt_server_client;
part of '../../../mqtt_server_client.dart';

/// The MQTT server connection class for the websocket interface
class MqttServerWsConnection extends MqttServerConnection<WebSocket> {
/// Default constructor
MqttServerWsConnection(
events.EventBus? eventBus, List<RawSocketOption> socketOptions)
: super(eventBus, socketOptions);
MqttServerWsConnection(super.eventBus, super.socketOptions);

/// Initializes a new instance of the MqttConnection class.
MqttServerWsConnection.fromConnect(String server, int port,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,18 @@
* Copyright : S.Hamblett
*/

part of mqtt_server_client;
part of '../../../mqtt_server_client.dart';

/// Connection handler that performs server based connections and disconnections
/// to the hostname in a synchronous manner.
class SynchronousMqttServerConnectionHandler
extends MqttServerConnectionHandler {
/// Initializes a new instance of the SynchronousMqttConnectionHandler class.
SynchronousMqttServerConnectionHandler(clientEventBus,
SynchronousMqttServerConnectionHandler(super.clientEventBus,
{required int maxConnectionAttempts,
required socketOptions,
required super.socketOptions,
reconnectTimePeriod = 5000})
: super(clientEventBus,
maxConnectionAttempts: maxConnectionAttempts,
socketOptions: socketOptions) {
: super(maxConnectionAttempts: maxConnectionAttempts) {
connectTimer = MqttCancellableAsyncSleep(reconnectTimePeriod);
initialiseListeners();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Copyright : S.Hamblett
*/

part of mqtt_client;
part of '../../mqtt_client.dart';

/// Converts string data to and from the MQTT wire format
class AsciiPayloadConverter implements PayloadConverter<String> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Copyright : S.Hamblett
*/

part of mqtt_client;
part of '../../mqtt_client.dart';

/// Acts as a pass through for the raw data without doing any conversion.
class PassthruPayloadConverter implements PayloadConverter<typed.Uint8Buffer> {
Expand Down
2 changes: 1 addition & 1 deletion lib/src/dataconvertors/mqtt_client_payload_convertor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Copyright : S.Hamblett
*/

part of mqtt_client;
part of '../../mqtt_client.dart';

/// Interface that defines the methods and properties that must be provided
/// by classes that interpret and convert inbound and outbound
Expand Down
2 changes: 1 addition & 1 deletion lib/src/encoding/mqtt_client_mqtt_encoding.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Copyright : S.Hamblett
*/

part of mqtt_client;
part of '../../mqtt_client.dart';

/// Encoding implementation that can encode and decode strings
/// in the MQTT string format.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Copyright : S.Hamblett
*/

part of mqtt_client;
part of '../../mqtt_client.dart';

/// Exception thrown when a client identifier included in a message is too long.
class ClientIdentifierException implements Exception {
Expand Down
2 changes: 1 addition & 1 deletion lib/src/exception/mqtt_client_connection_exception.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Copyright : S.Hamblett
*/

part of mqtt_client;
part of '../../mqtt_client.dart';

/// Exception thrown when the connection state is incorrect.
class ConnectionException implements Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Copyright : S.Hamblett
*/

part of mqtt_client;
part of '../../mqtt_client.dart';

/// Exception thrown when a browser or server client is instantiated incorrectly.
class IncorrectInstantiationException implements Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Copyright : S.Hamblett
*/

part of mqtt_client;
part of '../../mqtt_client.dart';

/// Exception thrown when processing a header that is invalid in some way.
class InvalidHeaderException implements Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Copyright : S.Hamblett
*/

part of mqtt_client;
part of '../../mqtt_client.dart';

/// Exception thrown when processing a Message that is invalid in some way.
class InvalidMessageException implements Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Copyright : S.Hamblett
*/

part of mqtt_client;
part of '../../mqtt_client.dart';

/// Exception that is thrown when the payload of a message
/// is not the correct size.
Expand Down
2 changes: 1 addition & 1 deletion lib/src/exception/mqtt_client_invalid_topic_exception.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Copyright : S.Hamblett
*/

part of mqtt_client;
part of '../../mqtt_client.dart';

/// Exception thrown when the topic of a message is invalid
class InvalidTopicException implements Exception {
Expand Down
2 changes: 1 addition & 1 deletion lib/src/exception/mqtt_client_noconnection_exception.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Copyright : S.Hamblett
*/

part of mqtt_client;
part of '../../mqtt_client.dart';

/// Exception thrown when the client fails to connect
class NoConnectionException implements Exception {
Expand Down
2 changes: 1 addition & 1 deletion lib/src/management/mqtt_client_topic_filter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Copyright : S.Hamblett
*/

part of mqtt_client;
part of '../../mqtt_client.dart';

/// This class allows specific topics to be listened for. It essentially
/// acts as a bandpass filter for the topics you are interested in if
Expand Down
Loading

0 comments on commit 2a6980d

Please sign in to comment.