WebSocketTestDeviceCommunicator class
Communicator intended to be used by test devices when communicating with the back end server. This communicator communicates to the 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
- WebSocketTestDeviceCommunicator({Duration maxConnectionTime = const Duration(minutes: 30), Duration pingTime = const Duration(seconds: 30), Duration reconnectDelay = const Duration(seconds: 1), required String secret, required TestControllerState testControllerState, required String url})
- The communicator that can be used by applications to allow test devices to be driven via the websocket server.
Properties
- active → bool
-
Returns whether or not the communicator is currently active.
no setter
-
commandStream
→ Stream<
DeviceCommand> -
A stream of incomming command that clients can listen to in cause they
have custom actions that should happen for commands.
no setter
- connected → bool
-
Returns whether or not the communicator is currently connected to a back
end.
no setter
- deactivated ↔ bool
-
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
- maxConnectionTime → Duration
-
The maximum amount of time the websocket can be opened. The communicator
will disconnect before this time elapses and reconnect to the server if it
is still active.
final
- onConnectionChanged ← ConnectionChangedCallback
-
Sets a callback that the communicator will execute whever the connected
state changes.
no getter
- pingTime → Duration
-
The amount of time the communicator will wait before sending a ping to the
server to keep the connection alive.
final
- reconnectDelay → Duration
-
The amount of time the communicator will wait before trying to reconnect
after a failed connection attept or an unexpected disconnection.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- url → String
-
The websocket URL to connect to.
final
Methods
-
activate(
Future< TestDeviceInfo> testDeviceInfoBuilder()) → Future<void> - Activiates the communicator with callback that is expected to be able to provide the information about the test device when called.
-
deactivate(
) → Future< void> - Deactivates the communicator and disconnects from the back end.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
sendCommand(
DeviceCommand command) → Future< void> -
Sends the given
command
to the back end command and control server. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited