WebSocketTestDriverCommunicator class

Communicator suited for test drivers to be able to communicate with devices via the command and control server provided by the https://pub.dev/packages/automated_testing_framework_server_websocket package.

Once constructed, the communicator must then be activated through the activate function.

Constructors

WebSocketTestDriverCommunicator({required String appIdentifier, String? driverId, required String driverName, Logger? logger, Duration maxConnectionTime = const Duration(minutes: 30), Duration pingTime = const Duration(seconds: 30), required String secret, required String url})
The communicator that can be used by applications to drive test devices via the websocket server.

Properties

active bool
Returns whether or not the communicator is currently active.
no setter
appIdentifier String
The app identifier. This may or may not be the "package" used by the build. Ideally as apps may have multiple packages for testing though, it is a specific unique identifier for the application that is passed in to the application via TestAppSettings.initialize.
final
commandStream Stream<DeviceCommand>
Provides a stream of commands that an application can listen to in order to provide their own handlers or actions based off of commands received.
no setter
connected bool
Returns whether the communicator is currently connected to the back end. A communicator may be active but not connected either because the back end is refusing connections or the connection is being (re-)established.
no setter
deactivated bool
getter/setter pair
driverId String
The unique identifier of the driver. This defaults to being a UUID value but may be specified by the driving application.
final
driverName String
The human readable name of the driver. This is not used by the system directly but is rather provided by the system for team members to be able to see who is currently utilizing which connected device.
final
hashCode int
The hash code for this object.
no setterinherited
maxConnectionTime Duration
The maximum amount of time the communicator can be connected to the server for each connected sessions. After this time expires, the communicator will disconnect from the server and immediately attempt to reconnect to resume the session.
final
onConnectionChanged Future<void> Function(bool)
A callback that the application may set in order to receive noticies of when the communication's connectivity status changes.
no getter
pingTime Duration
The amount of time between sending ping commands to inform the server that this driver is still active and processing commands.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
url String
The websocket URL for the backend server.
final

Methods

activate() Future<void>
Activates the communicator and begins trying to connect to and communicate with the backend server.
deactivate() Future<void>
Deactivates the communicator. Once deactivated
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
sendCommand(DeviceCommand command, {bool instant = false}) Future<void>
Sends the given command to the back end server. By default the command will be inserted into the queue and sent after all other previously queued commands. Setting the instant flag to true will bypass the queue and send the command immediately. Howver, instant commands will also be lost if the communicator is not currently connected.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited