CLI Reference
Overview
SiFi Bridge REPL (Read-Eval-Print Loop) provides an interactive interface for managing and controlling SiFi Labs devices. The REPL supports command chaining with semicolons and outputs responses in JSON format (use -p flag for pretty-printed JSON).
At any point in the REPL, you may use help [subcommand] to show the subcommand's help message.
Starting the REPL
# Start REPL with pretty-printed JSON output
./sifibridge -p
# Start REPL with default compact JSON
./sifibridge
Default Behavior
Upon startup, SiFi Bridge automatically creates a default device manager named device. Device managers serve as the interface between you and the hardware device.
Command Chaining
Multiple commands can be chained together in a single line using semicolons:
> connect; show; command start-acquisition
Device Manager Commands
Device managers are interfaces that handle individual devices. Each manager can connect to and control one device. You can have multiple managers to control multiple devices simultaneously.
new
Create a new device manager and set it as active.
Usage:
> new <NAME>
Arguments:
<NAME>- Device manager name
Example:
> new mydevice
{
"new": {
"active": "mydevice",
"created": "mydevice",
"message": "Device mydevice created and selected"
}
}
delete
Delete a device manager. If you delete the active manager, another one will be selected automatically. You cannot delete the last manager.
Usage:
> delete <NAME>
Arguments:
<NAME>- Device manager name to delete
select
Switch to a different device manager.
Usage:
> select <NAME>
Arguments:
<NAME>- Manager name to make active
list
List devices from various sources.
Usage:
> list <FROM>
Arguments:
<FROM>- Source to list fromble- List Bluetooth Low Energy devicesserial- List serial port devicesdevices- List device managers
Example:
list ble
# Scans for BLE devices and returns available SiFi devices
Connection Commands
connect
Connect to a device via Bluetooth Low Energy.
Usage:
> connect [HANDLE]
Arguments:
[HANDLE](optional) - Connection handle:- Empty: Auto-connect to a device
- Device name (e.g.,
BioPoint,SiFiBand) - Windows/Linux: BLE MAC address (e.g.,
00:11:22:33:44:55) - macOS: BLE UUID (e.g.,
00001122-3344-5566-7788-99AABBCCDDEE)
Examples:
# Auto-connect to first available device
> connect
# Connect by device name
> connect BioPoint
# Connect by MAC address (Windows/Linux)
> connect 00:11:22:33:44:55
# Connect by UUID (macOS)
> connect 00001122-3344-5566-7788-99AABBCCDDEE
disconnect
Disconnect from the currently connected device.
Usage:
disconnect
show
Display detailed information about the current device.
Usage:
show
Configuration Commands
configure
Configure various aspects of the connected device. The configure command has multiple subcommands for different sensors and settings.
configure sensors
Enable or disable specific sensors.
Usage:
configure sensors [OPTIONS]
Options:
--ecg <STATE>- ECG sensor state (off,on)--emg <STATE>- EMG sensor state (off,on)--eda <STATE>- EDA/BIOZ sensor state (off,on)--imu <STATE>- IMU sensor state (off,on)--ppg <STATE>- PPG sensor state (off,on)
Example:
configure sensors --ecg on --ppg on --imu off
configure ecg
Configure ECG (Electrocardiography) sensor.
Usage:
configure ecg [OPTIONS]
Options:
--state <STATE>- Enable sensor (off,on)--fs <FS>- Sampling rate in Hz--dc-notch <DC_NOTCH>- Enable DC notch filter (off,on)--mains-notch <MAINS_NOTCH>- Enable mains notch filter (off,on60,on50)--bandpass <BANDPASS>- Enable bandpass filter (off,on)--flo <FLO>- Bandpass filter lower cutoff frequency (Hz)--fhi <FHI>- Bandpass filter higher cutoff frequency (Hz)
Example:
configure ecg --state on --fs 250 --mains-notch on60 --bandpass on --flo 0.5 --fhi 40
configure emg
Configure EMG (Electromyography) sensor.
Usage:
configure emg [OPTIONS]
Options:
--state <STATE>- Enable sensor (off,on)--fs <FS>- Sampling rate in Hz--dc-notch <DC_NOTCH>- Enable DC notch filter (off,on)--mains-notch <MAINS_NOTCH>- Enable mains notch filter (off,on60,on50)--bandpass <BANDPASS>- Enable bandpass filter (off,on)--flo <FLO>- Bandpass filter lower cutoff frequency (Hz)--fhi <FHI>- Bandpass filter higher cutoff frequency (Hz)
Example:
configure emg --state on --fs 1000 --bandpass on --flo 20 --fhi 450
configure eda
Configure EDA/BIOZ (Electrodermal Activity / Bioimpedance) sensor.
Usage:
configure eda [OPTIONS]
Options:
--state <STATE>- Enable sensor (off,on)--fs <FS>- Sampling rate in Hz--dc-notch <DC_NOTCH>- Enable DC notch filter (off,on)--mains-notch <MAINS_NOTCH>- Enable mains notch filter (off,on60,on50)--bandpass <BANDPASS>- Enable bandpass filter (off,on)--flo <FLO>- Bandpass filter lower cutoff frequency (Hz)--fhi <FHI>- Bandpass filter higher cutoff frequency (Hz)--freq <FREQ>- Signal frequency in Hz (0 for DC)
Example:
configure eda --state on --fs 100 --freq 0
configure ppg
Configure PPG (Photoplethysmography) sensor.
Usage:
configure ppg [OPTIONS]
Options:
--state <STATE>- Enable sensor (off,on)--fs <FS>- Sampling rate in Hz (50,100,200,400,800,1000,1600,3200)--iir <IIR>- IR LED current in mA--ired <IRED>- Red LED current in mA--igreen <IGREEN>- Green LED current in mA--iblue <IBLUE>- Blue LED current in mA--sens <SENS>- Sensor sensitivity (low,medium,high,max)--avg <AVG>- Signal averaging factor (1,2,4,8,16,32)
Example:
configure ppg --state on --fs 100 --iir 50 --ired 30 --sens high --avg 4
configure imu
Configure IMU (Inertial Measurement Unit).
Usage:
configure imu [OPTIONS]
Options:
--state <STATE>- Enable sensor (off,on)--fs <FS>- Sampling rate in Hz--acc-range <ACC_RANGE>- Accelerometer rangeaccel2-g,accel4-g,accel8-g,accel16-g
--gyro-range <GYRO_RANGE>- Gyroscope rangegyro16-dps,gyro31-dps,gyro63-dps,gyro125-dps,gyro250-dps,gyro500-dps,gyro1000-dps,gyro2000-dps
Example:
configure imu --state on --fs 100 --acc-range accel4-g --gyro-range gyro500-dps
configure memory
Set memory mode for data storage.
Usage:
configure memory <MODE>
Arguments:
<MODE>- Memory mode:streaming- Stream data over BLE onlydevice- Store data in device memory onlyboth- Stream and store simultaneously
Note: SiFiBand only supports streaming mode.
Example:
configure memory streaming
Other configure commands
configure filtering- Enable on-board filteringconfigure sampling-rates- Set channel-wise sampling ratesconfigure adc-gain- Configure ECG and EMG ADC gainconfigure low-latency-mode- Set low latency modeconfigure ble-power- Set BLE transmission power levelconfigure stealth-mode- Enable stealth modeconfigure motor-intensity- Set motor vibration intensity
Use help configure <subcommand> for detailed information on each.
Data Acquisition Commands
start
Start data acquisition from the device.
Usage:
start [OPTIONS]
Options:
--all- Start acquisition on all connected devices--set-default- Save current configuration as device default
Example:
# Start acquisition on current device
start
# Start on all devices and save configuration
start --all --set-default
stop
Stop data acquisition.
Usage:
stop [OPTIONS]
Options:
--all- Stop acquisition on all connected devices
Example:
# Stop current device
stop
# Stop all devices
stop --all
command
Send specific commands to the device. This is a lower-level interface for device control.
Usage:
command <COMMAND>
Available Commands:
start-acquisition- Start data acquisitionstop-acquisition- Stop data acquisitionset-ble-power- Set BLE TX powerset-filtering- Enable on-device filterserase-memory- Erase device memorydownload-memory- Download device memorystart-status-update- Start status updatesstop-status-update- Stop status updatesopen-led1- Turn on LED 1close-led1- Turn off LED 1open-led2- Turn on LED 2close-led2- Turn off LED 2start-motor- Start vibration motorstop-motor- Stop vibration motorpower-off- Power off the devicedeep-sleep- Put device in deep sleepset-ppg-currents- Configure PPG LED currentsset-ppg-sensitivity- Configure PPG sensitivityset-emg-mains-notch- Configure EMG mains notch filterset-eda-freq- Set EDA signal frequencyset-eda-gain- Set EDA sensor gaindownload-memory-serial- Download memory via serial portget-memory-size- Get available memory sizeset-emg-sampling-rate- Set EMG sampling rateset-default-config- Save current configuration as defaultget-device-info- Request device hardware configurationset-motor-intensity- Configure vibration motor intensity
Example:
command start-acquisition
command open-led1
command start-motor
Advanced Features
plugin
Load a plugin to process sensor data.
Usage:
plugin [OPTIONS] <PATH>
Arguments:
<PATH>- Path to the plugin file
Options:
--ecg- Send ECG data to plugin--emg- Send EMG data to plugin--eda- Send EDA data to plugin--imu- Send IMU data to plugin--ppg- Send PPG data to plugin--other <OTHER>- Send custom data to plugin
Example:
plugin --ecg --ppg /path/to/my_plugin.so
download-memory
Download data stored in device memory to CSV files.
Usage:
download-memory [OPTIONS] [DIR]
Arguments:
[DIR](optional) - Output directory (defaults to current directory)- If directory contains spaces, replace them with escaped underscore
\_
- If directory contains spaces, replace them with escaped underscore
Options:
--transport <TRANSPORT>- Transport method (ble,serial) [default:ble]--handle <HANDLE>- Serial port or device manager name (defaults to current device)
Example:
# Download the currently selected device's memory via BLE
download-memory ./data/
# Download to specific directory via serial
download-memory --transport serial --handle /dev/ttyUSB0 ./data/
firmware-update
Update device firmware using a DFU (Device Firmware Update) package.
Usage:
firmware-update [OPTIONS] <DFU_PACKAGE>
Arguments:
<DFU_PACKAGE>- Path to DFU archive file
Options:
--handle <HANDLE>- Connection handle (defaults to current device)-r, --resume- Resume interrupted DFU process
Example:
# Update firmware
firmware-update /path/to/firmware.zip
# Resume interrupted update
firmware-update --resume /path/to/firmware.zip
Utility Commands
help
Display help information for commands.
Usage:
help [COMMAND]
Arguments:
[COMMAND](optional) - Specific command to get help for
Examples:
# Show all available commands
help
# Get detailed help for a specific command
help connect
help configure ecg
quit
Exit the REPL.
Usage:
quit
CLI Mode Options
SiFi Bridge can also be run with command-line options for non-interactive use:
# Pretty-print JSON output
./sifibridge -p
# TCP input for remote control
./sifibridge --tcp-in 127.0.0.1:5000
# Send data to TCP endpoint
./sifibridge --tcp-out 192.168.1.100:8080
# Send data to UDP endpoint
./sifibridge --udp-out 192.168.1.100:9000
# Save sensor data to CSV files
./sifibridge --csv-out /path/to/output
# Disable stdout data output
./sifibridge --no-stdout-data
# Increase logging verbosity
./sifibridge -v
# Decrease logging verbosity
./sifibridge -q
JSON Response Format
All commands return JSON responses. With the -p flag, responses are pretty-printed. Response structures vary by command but typically include:
- Status information
- Success/error messages
- Data payloads
- Device state
Example response:
{
"new": {
"active": "device",
"created": "device",
"message": "Device device created and selected"
}
}