Skip to content

Configuration

The Device object lets you adjust settings and issue commands.

Sending commands

python
# Accepts str or bytes; str will be UTF-8 encoded and null-terminated automatically.
await device.send("ping")              # optional process_id defaults to 0
kotlin
// String overload auto-appends null; add it yourself only when sending raw bytes.
device.send("ping", processId = 0)
swift
device.send("ping", processId: 0)
dart
device.send("ping", 0); // pass Uint8List only if you need raw bytes

send gives a direct line to the device (e.g., LED brightness, sampling rate tweaks). It accepts raw bytes and an optional processId (default 0). For text commands, send UTF-8 bytes with a trailing null. Do not send commands while synchronization is running to avoid conflicts.

processId picks the device-side process that should handle the payload; the transport echoes it in payload callbacks so you can correlate responses (e.g., didReceivePayload / did_receive_payload). For shell commands listed below, use processId = 0 (default). The SDK uses specific IDs internally for its own APIs (collect, sync, log, etc.).

Where responses arrive

Shell responses (e.g., Pong, log lines) come via the payload callback on your delegate:

python
def did_receive_payload(self, device, process: str, payload: bytes): ...
kotlin
fun didReceivePayload(device: Device, process: String, payload: ByteArray)
swift
func didReceivePayload(_ device: Device, process: String, payload: Data)
dart
void didReceivePayload(Device device, String process, Uint8List payload)
csharp
void didReceivePayload(IAidlab aidlab, string process, byte[] payload)

processId is numeric when you call send; the callback exposes process as a string label coming from the device firmware. Map them in your code if you need to correlate a request to a response.

Shell commands reference

When using send with processId = 0, the device accepts these text commands:

CommandDescriptionExample
pingChecks connection; response Pong.ping
set dateSets internal RTC date (DD:MM:YYYY).set date 24:12:2024
set timeSets internal RTC time (HH:mm:ss).set time 14:30:00
set led_brghtSets LED brightness (1–16).set led_brght 10
set ecg_debugToggles ECG debug mode (0/1).set ecg_debug 1
set ecg_fsSets ECG sampling rate (250/500/1000). Changing may break compatibility with Aidlab/Aidmed apps.set ecg_fs 500
memtestRuns flash memory test.memtest
logStreams real-time status log.log
sync start/stop/count/clearManages flash sync.sync start
dump start/stop/clearSends or clears logs stored in flash.dump start

Avoid sending commands while a sync is running to prevent conflicts.