testing library
Tools for testing applications that use package:indi without real
hardware or a running indiserver.
import 'package:indi/indi.dart';
import 'package:indi/testing.dart';
final server = FakeIndiServer()..define(myPropertyDefinition);
final client = IndiClient.withTransport(server.transport);
The protocol classes used to define properties and send updates, such as
DefNumberVector and SetNumberVector, are exported too.
Classes
- DefBlob Protocol
-
A
defBLOBelement. BLOB definitions carry no data. - DefBlobVector Protocol
-
A
defBLOBVectorcommand. - DefElement Protocol
-
An element inside a
def*Vector: the definition of one value. - DefLight Protocol
-
A
defLightelement. - DefLightVector Protocol
-
A
defLightVectorcommand. Lights are always read-only. - DefNumber Protocol
-
A
defNumberelement. - DefNumberVector Protocol
-
A
defNumberVectorcommand. - DefSwitch Protocol
-
A
defSwitchelement. - DefSwitchVector Protocol
-
A
defSwitchVectorcommand. - DefText Protocol
-
A
defTextelement. - DefTextVector Protocol
-
A
defTextVectorcommand. -
DefVector<
E extends DefElement> Protocol -
A
def*Vectorcommand: the server defines a property. - DelProperty Protocol
-
A
delPropertycommand: a property, or a whole device, is gone. - EnableBlob Protocol
-
An
enableBLOBcommand: sets which BLOBs the server sends on this connection. - FakeIndiServer Testing
- An in-process INDI server for testing applications without hardware.
- FakeServerConnection Testing
- One client connection to a FakeIndiServer.
- GetProperties Protocol
-
A
getPropertiescommand: asks for property definitions. - IndiCommand Protocol
- A message of the INDI protocol: one top-level XML element.
- IndiDecoder Protocol
- A StreamTransformer that turns INDI wire bytes into IndiCommands.
- IndiEncoder Protocol
- A StreamTransformer that encodes IndiCommands into INDI wire bytes.
- IndiStreamDecoder Protocol
- Incrementally decodes INDI wire bytes into IndiCommands.
- InMemoryConnection Testing
- One side of an in-memory connection.
- InMemoryTransport Testing
- A transport that connects to an in-process server, for tests.
- MessageCommand Protocol
-
A
messagecommand: a log message from a driver or the server. - NewBlobVector Protocol
-
A
newBLOBVectorcommand. - NewNumberVector Protocol
-
A
newNumberVectorcommand. - NewSwitchVector Protocol
-
A
newSwitchVectorcommand. - NewTextVector Protocol
-
A
newTextVectorcommand. -
NewVector<
E extends OneElement> Protocol -
A
new*Vectorcommand: the client asks a driver to change a property. - OneBlob Protocol
-
A
oneBLOBelement. - OneElement Protocol
-
An element carrying a value inside a
set*Vectorornew*Vector. - OneLight Protocol
-
A
oneLightelement. - OneNumber Protocol
-
A
oneNumberelement. - OneSwitch Protocol
-
A
oneSwitchelement. - OneText Protocol
-
A
oneTextelement. - PingReply Protocol
-
A
pingReplycommand (INDI 2 extension). - PingRequest Protocol
-
A
pingRequestcommand (INDI 2 extension). - SetBlobVector Protocol
-
A
setBLOBVectorcommand. - SetLightVector Protocol
-
A
setLightVectorcommand. - SetNumberVector Protocol
-
A
setNumberVectorcommand. - SetSwitchVector Protocol
-
A
setSwitchVectorcommand. - SetTextVector Protocol
-
A
setTextVectorcommand. -
SetVector<
E extends OneElement> Protocol -
A
set*Vectorcommand: the server reports new values for a property. - UnknownCommand Protocol
- A top-level element this package does not know.
Enums
- BlobMode Model
- Controls whether the server sends BLOB (binary) data to a connection.
- PropertyPermission Model
- The permission hint of an INDI property.
- PropertyState Model
- The state of an INDI property, as reported by the driver.
- PropertyType Model
- The type of an INDI property (a "vector" in protocol terms).
- SwitchRule Model
- The rule that constrains which switches of a switch property can be on.
- SwitchState Model
- The state of a single switch.
Constants
- indiProtocolVersion → const String
- The INDI protocol version implemented by this package.
Functions
-
encodeIndiCommand(
IndiCommand command) → String Protocol -
Encodes
commandas an INDI XML string, including a trailing newline. -
encodeIndiCommandChunks(
IndiCommand command) → Iterable< ProtocolUint8List> -
Encodes
commandas UTF-8 bytes, split into chunks of at most about 64 KiB so large BLOB uploads can be written to a socket progressively. -
formatIndiNumber(
double value, String format) → String Protocol -
Formats
valuethe way INDI drivers expect it to be displayed, using theformatattribute of a number element. -
formatIndiTimestamp(
DateTime time) → String Protocol -
Formats
timeas an INDI timestamp (YYYY-MM-DDTHH:MM:SS, in UTC). -
formatSexagesimal(
double value, {int width = 0, int fractionDigits = 6}) → String Protocol -
Formats
valuein sexagesimal notation, as libindi'sfs_sexadoes. -
formatWireNumber(
double value) → String Protocol -
Formats
valuefor the wire: the shortest text that parses back to the same double, never locale dependent. -
parseIndiNumber(
String text) → double? Protocol - Parses a number sent by an INDI driver or typed by a user.
-
parseIndiTimestamp(
String? text) → DateTime? Protocol -
Parses an INDI timestamp such as
2026-10-04T21:15:30.5. -
parseSexagesimal(
String text) → double? Protocol -
Parses a sexagesimal value such as
-12:30:45.5,12 30or5;30.
Typedefs
-
FakeCommandHandler
= FutureOr<
List< Function(NewVector<IndiCommand> ?>OneElement> command, FakeIndiServer server) Testing -
Decides how a FakeIndiServer answers a
new*Vectorcommand.
Exceptions / Errors
- IndiProtocolException Client
- Received data that does not follow the INDI protocol.