LayrzProtocolHttp class

Constructors

LayrzProtocolHttp({required String ident, String password = '', required String server, LayrzProtocolVersion version = LayrzProtocolVersion.v2, @visibleForTesting Dio? testDio})
LayrzProtocolHttp is the class that contains the methods to interact with the Layrz ecosystem.

Properties

baseUrl String
baseUrl defines the URL of the endpoint to interact with the comm interface. This URL is built with the server and the version.
no setter
hashCode int
The hash code for this object.
no setterinherited
headers Map<String, String>
headers is the headers that will be sent in the request
no setter
ident String
ident is the identifier of the device, this ident should exists in the Layrz ecosystem.
final
password String
password is the password of the device, this password can be empty if the device does not have a password.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
server String
httpUrl defines the URL of the endpoint to interact with the comm interface.
final
version LayrzProtocolVersion
version is the version of the protocol.
final

Methods

composeEmptyPd() PdPacket
getBleDevices() HttpPacketResponse
getBleDevices ask to the server the BLE devices that should sniff.
getCommands() HttpPacketResponse
getCommands ask to the server if there are commands to execute.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
sendData(ClientPacket message) HttpPacketResponse
sendData sends a plain message to the Layrz ecosystem.
sendImage({required List<int> bytes, required String filename, String contentType = 'image/jpeg'}) HttpPacketResponse
sendImage sends an image to the Layrz ecosystem.
sendSos([PdPacket? message]) HttpPacketResponse
sendSos sends an SOS message to the Layrz ecosystem.
sendText(String text, {PdPacket? message}) HttpPacketResponse
sendText sends a text message to the Layrz ecosystem.
toString() String
A string representation of this object.
inherited

Operators

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