iio_create_context_from_uri

Function iio_create_context_from_uri 

Source
pub unsafe extern "C" fn iio_create_context_from_uri(
    uri: *const c_char,
) -> *mut iio_context
Expand description

@brief Create a context from a URI description @param uri A URI describing the context location @return On success, a pointer to a iio_context structure @return On failure, NULL is returned and errno is set appropriately

NOTE: The following URIs are supported based on compile time backend support:

  • Local backend, “local:”\n Does not have an address part. For example “local:”
  • XML backend, “xml:”\n Requires a path to the XML file for the address part. For example “xml:/home/user/file.xml”
  • Network backend, “ip:”\n Requires a hostname, IPv4, or IPv6 to connect to a specific running IIO Daemon or no address part for automatic discovery when library is compiled with ZeroConf support. For example “ip:192.168.2.1”, or “ip:localhost”, or “ip:” or “ip:plutosdr.local”. To support alternative port numbers the standard ip:host:port format is used. A special format is required as defined in RFC2732 for IPv6 literal hostnames, (adding ‘[]’ around the host) to use a ip:[x:x:x:x:x:x:x:x]:port format. Valid examples would be:
    • ip: Any host on default port
    • ip::40000 Any host on port 40000
    • ip:analog.local Default port
    • ip:brain.local:40000 Port 40000
    • ip:192.168.1.119 Default Port
    • ip:192.168.1.119:40000 Port 40000
    • ip:2601:190:400:da:47b3:55ab:3914:bff1 Default Port
    • ip:[2601:190:400:da:9a90:96ff:feb5:acaa]:40000 Port 40000
    • ip:fe80::f14d:3728:501e:1f94%eth0 Link-local through eth0, default port
    • ip:[fe80::f14d:3728:501e:1f94%eth0]:40000 Link-local through eth0, port 40000
  • USB backend, “usb:”\n When more than one usb device is attached, requires bus, address, and interface parts separated with a dot. For example “usb:3.32.5”. Where there is only one USB device attached, the shorthand “usb:” can be used.
  • Serial backend, “serial:”\n Requires:
    • 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)

For example “serial:/dev/ttyUSB0,115200” or “serial:/dev/ttyUSB0,115200,8n1”