Gateways
The python gateway tools act as a bridge between local Infuse-IoT devices and other tools running on the computer. Currently the gateways support interaction with devices connected directly via a serial port, or directly over Bluetooth.
Bluetooth connectivity can be provided:
- Via an Infuse-IoT powered embedded device with the
infuse gatewaytool. (Preferred) or - Directly via your machines native PC Bluetooth libraries with the
infuse native_bttoolUsinginfuse native_btrequires compatible hardware with Bluetooth 5.0 and support advertising extension capabilities. See below for more details.
Both tools are designed to run persistently in the background, managing connections to remote devices, forwarding packets out to Infuse-IoT hardware and broadcasting received data on localhost multicast UDP sockets.
Common Functionality
Both gateway tools have common configuration options
--server-port: Server Port
The --server-port argument is used to run more than one instance of
infuse gateway concurrently on the same machine.
--server-port, the port must be an odd number.The Gateway tools act as a bridge facilitating multiple other tools to access Infuse-IoT devices.
It does so by utilising socket communications (multicast UDP). As a result of multicast UDP behaviours,
by default only one instance of infuse gateway can run at a time.
The --server-port argument can be added to enable the operation multiple gateways concurrently on the same machine.
By providing a different server port, the gateway can run independently of other gateway scripts at the same time.
Similarly, additional tools can be supplied with a --server-port argument to use a different gateway instance
(instead of the default).
--root: Key File
In some instances, Tags utilise a Root Identity that is different from that provided by the Infuse-IoT Cloud. In such instances, utilising the default Cloud for authentication will cause cryptography to fail.
As a result, a root identity certificate can be provided to override the default Cloud identity with
the --root argument.
Native Bluetooth
Native Bluetooth support is supported through the cross platform bleak package.
> infuse native_bt -h
usage: infuse native_bt [-h] [--root ROOT] [--server-port SERVER_SOCK]
Use the local Bluetooth adapter for Bluetooth interaction
options:
-h, --help show this help message and exit
--root ROOT Root identity certificate to use instead of cloud
--server-port SERVER_SOCK
Alternate port to use for Gateway connections (default
8751)
infuse native_bt.native_bt is convenient, however uses the Operating System's managed Bluetooth APIs.
As a result, OS power saving policies can and will interfer with the tool's functionality.Follow the instructions below to check compatibility.
Ensure your Bluetooth Adaptor supports Bluetooth 5.0 and advertising extensions.
Updating Bluetooth Drivers may help.
All Arm Silicon/aarch64 macOS devices support the Bluetooth requirements.
Support on Intel Mac devices will depend on hardware compatibility. As a result this has not been tested or supported.
native_bt currently relies on an
undocumented IOBluetooth APIEnsure your Bluetooth Adaptor supports Bluetooth 5.0 and advertising extensions.
Updating Bluetooth Drivers may help.
Embedded Devices
To create a bridge to a physically connected device, use the infuse gateway command.
This command can be used both for firmrware applications that forward data over Bluetooth (such as infuse-sdk/apps/gateway_usb)
or devices that only interact over the physical link, or even just to view device debug logs.
Supported backends
An appropriate physical connection interface (backend) must be provided to the tool depending on the physical connection:
> infuse gateway --help
usage: infuse gateway [-h] (--serial SERIAL | --rtt RTT | --pyocd PYOCD) [--display-only] [--log [filename]]
Connect to a gateway device over serial and route commands to Bluetooth devices
options:
-h, --help show this help message and exit
--serial SERIAL Gateway serial port
--rtt RTT RTT serial port
--pyocd PYOCD RTT via PyOCD
--display-only, -d No networking, only display serial
--log [filename], -l [filename]
Save serial output to file
--baud BAUD Baudrate for serial port
--root ROOT Root identity certificate to use instead of cloud
--server-port SERVER_SOCK
Alternate port to use for Gateway connections (default 8751)
--serialis used for standard serial ports (e.g.COMx,/dev/ttyACMx).--rttis used for RTT through pylink. The argument is the device name (e.g.nRF52840_xxAA)--pyocdis used for RTT through pyocd. The argument is the device name (e.g.stm32l451ceux)
--display-only: Only display serial output
As the tool is also useful to display basic text logging message displays,
the networking aspect of the tool can be disabled with --display-only or -d.
--log: Record serial logs to a file
Recording of the serial logs to a dedicated file can be enabled with the --log parameter.
This can be useful for long lived monitoring that would otherwise be lost due to terminal scrollback limits.
--baud: Specify the baud rate for serial connections
When using --serial the baud rate can be specified with --baud.