protocol library

Low-level access to the INDI wire protocol.

Most applications should use package:indi/indi.dart, which manages connections, devices and properties. Import this library to build tools that work directly with protocol messages, such as proxies, loggers or test servers.

import 'package:indi/protocol.dart';

final xml = encodeIndiCommand(const GetProperties());
socket.transform(const IndiDecoder()).listen(print);

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.
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.
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.

Exceptions / Errors

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