pub enum Backend<'a> {
Default,
Xml(&'a str),
XmlMem(&'a str),
Network(&'a str),
Usb(&'a str),
Serial(&'a str),
Uri(&'a str),
Local,
}Expand description
Backends for I/O Contexts.
An I/O Context relies on a backend that provides sensor data.
Variants§
Default
Use the default backend. This will create a network context if the IIOD_REMOTE environment variable is set to the hostname where the IIOD server runs. If set to an empty string, the server will be discovered using ZeroConf. If the environment variable is not set, a local context will be created instead.
Xml(&'a str)
XML Backend, creates a Context from an XML file. Here the string is the name of the file. Example Parameter: “/home/user/file.xml”
XmlMem(&'a str)
XML Backend, creates a Context from an in-memory XML string. Here the string is the XML description.
Network(&'a str)
Network Backend, creates a Context through a network connection. Requires a hostname, IPv4 or IPv6 address to connect to another host that is running the IIO Daemon. If an empty string is provided, automatic discovery through ZeroConf is performed (if available in IIO). Example Parameter:
- “192.168.2.1” to connect to given IPv4 host, or
- “localhost” to connect to localhost running IIOD, or
- “plutosdr.local” to connect to host with given hostname, or
- “” for automatic discovery
Usb(&'a str)
USB Backend, creates a context through a USB connection. If only a single USB device is attached, provide an empty String (“”) to use that. When more than one usb device is attached, requires bus, address, and interface parts separated with a dot. Example Parameter: “3.32.5”
Serial(&'a str)
Serial Backend, creates a context through a serial connection. Requires (Values in parentheses show examples):
- a port (/dev/ttyUSB0),
- baud_rate (default 115200)
- serial port configuration
- data bits (5 6 7 8 9)
- parity (‘n’ none, ‘o’ odd, ‘e’ even, ‘m’ mark, ‘s’ space)
- stop bits (1 2)
- flow control (‘\0’ none, ‘x’ Xon Xoff, ‘r’ RTSCTS, ‘d’ DTRDSR)
Example Parameters:
- “/dev/ttyUSB0,115200”, or
- “/dev/ttyUSB0,115200,8n1”
Uri(&'a str)
“Guess” the backend to use from the URI that’s supplied. This merely
provides compatibility with iio_create_context_from_uri from the
underlying IIO C-library. Refer to the IIO docs for information on how
to format this parameter.
Local
Local Backend, only available on Linux hosts. Sensors to work with are
part of the system and accessible in sysfs (under /sys/...).