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 defBLOB element. BLOB definitions carry no data.
DefBlobVector Protocol
A defBLOBVector command.
DefElement Protocol
An element inside a def*Vector: the definition of one value.
DefLight Protocol
A defLight element.
DefLightVector Protocol
A defLightVector command. Lights are always read-only.
DefNumber Protocol
A defNumber element.
DefNumberVector Protocol
A defNumberVector command.
DefSwitch Protocol
A defSwitch element.
DefSwitchVector Protocol
A defSwitchVector command.
DefText Protocol
A defText element.
DefTextVector Protocol
A defTextVector command.
DefVector<E extends DefElement> Protocol
A def*Vector command: the server defines a property.
DelProperty Protocol
A delProperty command: a property, or a whole device, is gone.
EnableBlob Protocol
An enableBLOB command: 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 getProperties command: 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 message command: a log message from a driver or the server.
NewBlobVector Protocol
A newBLOBVector command.
NewNumberVector Protocol
A newNumberVector command.
NewSwitchVector Protocol
A newSwitchVector command.
NewTextVector Protocol
A newTextVector command.
NewVector<E extends OneElement> Protocol
A new*Vector command: the client asks a driver to change a property.
OneBlob Protocol
A oneBLOB element.
OneElement Protocol
An element carrying a value inside a set*Vector or new*Vector.
OneLight Protocol
A oneLight element.
OneNumber Protocol
A oneNumber element.
OneSwitch Protocol
A oneSwitch element.
OneText Protocol
A oneText element.
PingReply Protocol
A pingReply command (INDI 2 extension).
PingRequest Protocol
A pingRequest command (INDI 2 extension).
SetBlobVector Protocol
A setBLOBVector command.
SetLightVector Protocol
A setLightVector command.
SetNumberVector Protocol
A setNumberVector command.
SetSwitchVector Protocol
A setSwitchVector command.
SetTextVector Protocol
A setTextVector command.
SetVector<E extends OneElement> Protocol
A set*Vector command: 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 command as an INDI XML string, including a trailing newline.
encodeIndiCommandChunks(IndiCommand command) → Iterable<Uint8List> Protocol
Encodes command as 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 value the way INDI drivers expect it to be displayed, using the format attribute of a number element.
formatIndiTimestamp(DateTime time) → String Protocol
Formats time as an INDI timestamp (YYYY-MM-DDTHH:MM:SS, in UTC).
formatSexagesimal(double value, {int width = 0, int fractionDigits = 6}) → String Protocol
Formats value in sexagesimal notation, as libindi's fs_sexa does.
formatWireNumber(double value) → String Protocol
Formats value for 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 30 or 5;30.

Typedefs

FakeCommandHandler = FutureOr<List<IndiCommand>?> Function(NewVector<OneElement> command, FakeIndiServer server) Testing
Decides how a FakeIndiServer answers a new*Vector command.

Exceptions / Errors

IndiProtocolException Client
Received data that does not follow the INDI protocol.