Skip to content

Commit

Permalink
Issue 79
Browse files Browse the repository at this point in the history
  • Loading branch information
shamblett committed Dec 30, 2023
1 parent 4e38644 commit c4c05c0
Show file tree
Hide file tree
Showing 120 changed files with 178 additions and 193 deletions.
18 changes: 9 additions & 9 deletions example/mqtt5_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
* Copyright : S.Hamblett
*/

/// The mqtt5_client comprises a server client [MqttServerClient] and a browser
/// client [MqttBrowserClient]. Example usage of these two clients are contained in this directory.
///
/// Except for connection functionality the behavior of the clients wrt MQTT is the same.
///
/// Note that for previous users the [MqttClient] class is now only a support class and should not
/// be directly instantiated.
/// See the example mqtt5_universal_client to see how instantiating a server or browser client as
/// needed can be done automatically.
// The mqtt5_client comprises a server client [MqttServerClient] and a browser
// client [MqttBrowserClient]. Example usage of these two clients are contained in this directory.
//
// Except for connection functionality the behavior of the clients wrt MQTT is the same.
//
// Note that for previous users the [MqttClient] class is now only a support class and should not
// be directly instantiated.
// See the example mqtt5_universal_client to see how instantiating a server or browser client as
// needed can be done automatically.
36 changes: 18 additions & 18 deletions example/mqtt5_universal_client.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,12 +5,12 @@
* Copyright : S.Hamblett
*/

part of mqtt5_browser_client;
part of '../../../mqtt5_browser_client.dart';

/// The MQTT browser connection base class
class MqttBrowserConnection extends MqttConnectionBase {
/// 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 mqtt5_browser_client;
part of '../../../mqtt5_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(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 mqtt5_browser_client;
part of '../../../mqtt5_browser_client.dart';

/// The MQTT connection class for the browser websocket interface
class MqttBrowserWsConnection extends MqttBrowserConnection {
/// 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,7 +5,7 @@
* Copyright : S.Hamblett
*/

part of mqtt5_browser_client;
part of '../../../mqtt5_browser_client.dart';

/// Connection handler that performs connections and disconnections
/// to the hostname in a synchronous manner.
Expand Down
2 changes: 1 addition & 1 deletion lib/src/connectionhandling/mqtt_connection_base.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Copyright : S.Hamblett
*/

part of mqtt5_client;
part of '../../mqtt5_client.dart';

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

part of mqtt5_client;
part of '../../mqtt5_client.dart';

/// This class provides shared connection functionality
/// to serverand browser connection handler implementations.
Expand Down
2 changes: 1 addition & 1 deletion lib/src/connectionhandling/mqtt_connection_keep_alive.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Copyright : S.Hamblett
*/

part of mqtt5_client;
part of '../../mqtt5_client.dart';

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

part of mqtt5_client;
part of '../../mqtt5_client.dart';

/// Enumeration that indicates the origin of a client disconnection
enum MqttDisconnectionOrigin {
Expand Down
2 changes: 1 addition & 1 deletion lib/src/connectionhandling/mqtt_iconnection_handler.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Copyright : S.Hamblett
*/

part of mqtt5_client;
part of '../../mqtt5_client.dart';

/// Callback function definitions
typedef MessageCallbackFunction = bool Function(MqttMessage message);
Expand Down
2 changes: 1 addition & 1 deletion lib/src/connectionhandling/mqtt_read_wrapper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Copyright : S.Hamblett
*/

part of mqtt5_client;
part of '../../mqtt5_client.dart';

/// State and logic used to read from the underlying network stream.
class MqttReadWrapper {
Expand Down
5 changes: 2 additions & 3 deletions lib/src/connectionhandling/server/mqtt_server_connection.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@
* Copyright : S.Hamblett
*/

part of mqtt5_server_client;
part of '../../../mqtt5_server_client.dart';

/// The MQTT client server connection base class
class MqttServerConnection extends MqttConnectionBase {
/// 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 mqtt5_server_client;
part of '../../../mqtt5_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(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 mqtt5_server_client;
part of '../../../mqtt5_server_client.dart';

/// The MQTT normal(insecure TCP) server connection class
class MqttServerNormalConnection extends MqttServerConnection {
/// 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 mqtt5_server_client;
part of '../../../mqtt5_server_client.dart';

/// The MQTT server secure connection class
class MqttServerSecureConnection extends MqttServerConnection {
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 mqtt5_server_client;
part of '../../../mqtt5_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 mqtt5_server_client;
part of '../../../mqtt5_server_client.dart';

/// The MQTT server connection class for the websocket interface
class MqttServerWsConnection extends MqttServerConnection {
/// 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,7 +5,7 @@
* Copyright : S.Hamblett
*/

part of mqtt5_server_client;
part of '../../../mqtt5_server_client.dart';

/// Connection handler that performs server based connections and disconnections
/// to the hostname in a synchronous manner.
Expand Down
2 changes: 1 addition & 1 deletion lib/src/encoding/mqtt_binary_data_encoding.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Copyright : S.Hamblett
*/

part of mqtt5_client;
part of '../../mqtt5_client.dart';

/// Binary Data is represented by a Two Byte Integer length which indicates the number of data bytes,
/// followed by that number of bytes. Thus, the length of Binary Data is limited
Expand Down
2 changes: 1 addition & 1 deletion lib/src/encoding/mqtt_string_pair.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Copyright : S.Hamblett
*/

part of mqtt5_client;
part of '../../mqtt5_client.dart';

/// A UTF-8 String Pair consists of two UTF-8 Encoded Strings.
/// This data type is used to hold name-value pairs. The first string serves as the
Expand Down
2 changes: 1 addition & 1 deletion lib/src/encoding/mqtt_utf8_encoding.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Copyright : S.Hamblett
*/

part of mqtt5_client;
part of '../../mqtt5_client.dart';

/// Encoding implementation that can encode and decode strings
/// in the MQTT UTF8 string format.
Expand Down
2 changes: 1 addition & 1 deletion lib/src/encoding/mqtt_variable_byte_integer_encoding.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Copyright : S.Hamblett
*/

part of mqtt5_client;
part of '../../mqtt5_client.dart';

/// The Variable Byte Integer is encoded using an encoding scheme which uses a single
/// byte for values up to 127. Larger values are handled as follows. The least significant
Expand Down
2 changes: 1 addition & 1 deletion lib/src/exception/mqtt_connection_exception.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Copyright : S.Hamblett
*/

part of mqtt5_client;
part of '../../mqtt5_client.dart';

/// Exception thrown when the connection state is incorrect.
class MqttConnectionException implements Exception {
Expand Down
2 changes: 1 addition & 1 deletion lib/src/exception/mqtt_identifier_exception.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Copyright : S.Hamblett
*/

part of mqtt5_client;
part of '../../mqtt5_client.dart';

/// Exception thrown when a client identifier included in a message is too long.
class MqttIdentifierException 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 mqtt5_client;
part of '../../mqtt5_client.dart';

/// Exception thrown when a browser or server client is instantiated incorrectly.
class MqttIncorrectInstantiationException implements Exception {
Expand Down
2 changes: 1 addition & 1 deletion lib/src/exception/mqtt_invalid_header_exception.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Copyright : S.Hamblett
*/

part of mqtt5_client;
part of '../../mqtt5_client.dart';

/// Exception thrown when processing a header that is invalid in some way.
class MqttInvalidHeaderException implements Exception {
Expand Down
2 changes: 1 addition & 1 deletion lib/src/exception/mqtt_invalid_message_exception.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Copyright : S.Hamblett
*/

part of mqtt5_client;
part of '../../mqtt5_client.dart';

/// Exception thrown when processing a message that is invalid in some way.
class MqttInvalidMessageException implements Exception {
Expand Down
2 changes: 1 addition & 1 deletion lib/src/exception/mqtt_invalid_payload_size_exception.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Copyright : S.Hamblett
*/

part of mqtt5_client;
part of '../../mqtt5_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_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 mqtt5_client;
part of '../../mqtt5_client.dart';

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

part of mqtt5_client;
part of '../../mqtt5_client.dart';

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

part of mqtt5_client;
part of '../../mqtt5_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
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Copyright : S.Hamblett
*/

part of mqtt5_client;
part of '../../../mqtt5_client.dart';

/// An authenticate message is sent from the client to the broker or the
/// broker to the client as part of an extended authentication exchange,
Expand Down
Loading

0 comments on commit c4c05c0

Please sign in to comment.