Device Commands
After connecting, use the Device object to collect live data, synchronize stored data, and configure the device.
How SDK commands work
The Device object represents one active connection. Await an asynchronous command before starting an operation that depends on it.
Disconnecting ends running commands, such as a synchronization. Offline recording continues. Start live collection again after each connection.
The asynchronous methods below return the ID of the process handling them. When the device rejects a command, they throw an error that names the cause, such as sync: busy, and carries the reason. Handle failures when awaiting the command. Reconfiguring or stopping an existing process returns its ID. After a timeout the result is unknown, because the device may still execute the command; collect, stopCollect and clearSynchronization are safe to repeat.
Rejection reasons
| Value | Reason | Meaning |
|---|---|---|
| 1 | UNKNOWN_COMMAND | The device does not know the command. |
| 2 | NO_FREE_SLOT | No free process slot. |
| 3 | OUT_OF_MEMORY | The device is out of memory. |
| 4 | COMMAND_TOO_LONG | The command is too long. |
| 5 | INVALID_ARGUMENT | The device rejected the arguments. |
| 6 | BUSY | The command conflicts with the device state, for example clearSynchronization() during a synchronization. |
| 7 | NO_SUCH_PROCESS | kill found no such process. |
| 8 | NOT_PERMITTED | kill is not permitted. |
| 9 | NOT_CONNECTED | No client or a stale session. |
| 10 | SHUTTING_DOWN | The device is stopping its processes. |
| -1 | UNKNOWN | The firmware does not report the reason. |
Available methods
Use these methods instead of raw shell commands whenever possible:
| Operation | What it controls |
|---|---|
collect(...) | Starts or reconfigures live streaming and events, and chooses what the device records while it does not stream live. See Data Types and Events. In Unity, use SetCollectSignals(...) and StartCollectAllAsync(). |
stopCollect() / stop_collect() | Stops live streaming without changing offline storage settings or deleting stored data. |
startSynchronization() / start_synchronization() | Starts transferring historical data from internal memory. See Reading Data from Internal Memory. |
stopSynchronization() / stop_synchronization() | Stops historical data transfer. Live collection continues. |
clearSynchronization() / clear_synchronization() | Deletes historical data stored in internal memory. See Clearing stored data. |
setTime(...) / set_time(...) | Sets the device clock from a Unix timestamp in seconds. The SDK also sets it when it connects. |
Additional configuration
To change settings such as LED brightness or ECG sampling frequency, see Configuration.