Data Types and Events
When working with a supported device, you select data types to stream and handle events per sample.
Collecting data
async def did_connect(self, device):
await device.collect([
DataType.RESPIRATION_RATE,
DataType.SKIN_TEMPERATURE,
])override fun didConnect(device: Device) {
lifecycleScope.launch {
device.collect(
EnumSet.of(DataType.RESPIRATION_RATE, DataType.SKIN_TEMPERATURE),
EnumSet.noneOf(DataType::class.java)
)
}
}func didConnect(_ device: Device) {
Task {
try await device.collect(dataTypes: [.respirationRate, .skinTemperature], dataTypesToStore: [])
}
}@override
Future<void> didConnect(Device device) async {
await device.collect([DataType.respirationRate, DataType.skinTemperature], []);
}using UnityEngine;
public class MyAidlab : MonoBehaviour {
void Start() {
Aidlab.AidlabSDK.init();
var sdk = FindObjectOfType<Aidlab.AidlabSDK>();
if (sdk != null) {
sdk.SetCollectSignals(
new[] { Aidlab.Signal.RespirationRate, Aidlab.Signal.Temperature },
System.Array.Empty<Aidlab.Signal>()
);
}
}
}collect takes two lists. The first selects data streamed to your application while the device is connected. The second selects data stored in the device's memory while it is disconnected, which you can retrieve later through synchronization.
Wearing the device
The device streams and stores measurement samples only while it detects that it is being worn. Wear-state events continue when it is detached, so use wearStateDidChange / wear_state_did_change and wait for placedProperly before relying on measurements.
Available data types include:
| Data type | Description | Minimum firmware |
|---|---|---|
| ECG (Electrocardiogram) | Samples in volts (±0.8 V ADC range, 24-bit) capturing heart electrical activity. | 1.0.0 |
| Respiration | Breathing waveform in Ohms, enough to plot a breathing curve. | 1.0.0 |
| Skin Temperature | Skin temp in °C; stabilizes in ~5–15 min (touch sensor). | 1.0.0 |
| Activity | Activity changes: still, walking, running, automotive, cycling. | 2.1.0 |
| Steps | Steps counted since the previous update. | 2.1.0 |
| RR | R–R intervals from ECG, in milliseconds. | 2.1.0 |
| Respiration Rate | Breaths per minute. | 2.1.0 |
| Body Position | For lying posture: prone, supine, left side, right side, unknown. | 2.2.0 |
| Heart Rate | BPM calculated from the 9 most recent heartbeat intervals. | 2.2.0 |
| Sound Volume | Estimated ambient sound level in dB; raw audio is not exposed. | 2.2.5 |
| Orientation | Euler angles (roll, pitch, yaw) and quaternions; with Motion powers the bodyweight workout classifier. | 2.2.6 |
| Motion | 9-axis IMU: accel (ax, ay, az) in ±2 g, gyro (gx, gy, gz) in deg/s (±250 dps), mag (mx, my, mz) in µT (±4900 µT); with Orientation powers workout classifier. | 2.2.6 |
| Pressure | Nasal cannula airflow (Aidmed One only); useful for sleep/apnea studies. | 3.0.0 |
| Electrodermal Activity | Skin conductance in µS (resistance in Ω when available), sampled at 10 Hz. | 4.0.0 |
| GPS | Latitude/longitude, altitude, speed (m/s), heading, HDOP. | 4.0.0 |
Sample rates per data type are listed on the support page: Measurements range and accuracy.
Events
Each data sample invokes its handler. Timestamps represent capture time in milliseconds since the Unix epoch (1970-01-01T00:00:00Z). Samples from a single signal are emitted in capture order. When combining multiple signals or live and historical data, sort samples by timestamp.
Delivery timing
Continuous signal samples may be buffered by the device before they are sent to the SDK, so their handlers can be invoked in bursts rather than at evenly spaced wall-clock intervals. Aidlab and Aidmed One typically deliver about 250 ms of collected data per batch, while Aidlab 2 uses one-second batches for continuous high-rate streams. Event-driven values, such as RR intervals, heart rate, respiration rate, activity changes, steps, and wear-state changes, may arrive independently.
Signals retain their documented sampling rates regardless of how samples are grouped for delivery. Each callback includes the sample's capture timestamp. Use these timestamps to align signals with one another or with external events. BLE transport and platform scheduling may add further delay.
Key callback signatures by platform:
async def did_connect(self, device): ...
def did_disconnect(self, device, reason): ...
def did_receive_battery_level(self, device, soc): ...
def did_receive_ecg(self, device, ts, value): ...
def did_receive_respiration(self, device, ts, value): ...
def did_receive_respiration_rate(self, device, ts, value): ...
def did_receive_skin_temperature(self, device, ts, value): ...
def did_receive_heart_rate(self, device, ts, bpm): ...
def did_receive_rr(self, device, ts, rr): ...
def did_receive_activity(self, device, ts, activity): ...
def did_receive_steps(self, device, ts, steps): ...
def did_receive_signal_quality(self, device, ts, quality): ...
def did_receive_accelerometer(self, device, ts, ax, ay, az): ...
def did_receive_gyroscope(self, device, ts, gx, gy, gz): ...
def did_receive_magnetometer(self, device, ts, mx, my, mz): ...
def did_receive_quaternion(self, device, ts, qw, qx, qy, qz): ...
def did_receive_orientation(self, device, ts, roll, pitch, yaw): ...
def did_receive_body_position(self, device, ts, body_position): ...
def did_receive_sound_volume(self, device, ts, value): ...
def did_receive_pressure(self, device, ts, value): ...
def pressure_wear_state_did_change(self, device, wear_state): ...
def wear_state_did_change(self, device, wear_state): ...
def did_receive_eda(self, device, ts, conductance): ... # Firmware 4.0.0+
def did_receive_gps(self, device, ts, lat, lon, alt, speed, heading, hdop): ... # Firmware 4.0.0+
def did_detect_user_event(self, device, ts): ...
def did_detect_exercise(self, device, exercise): ...
def did_receive_error(self, device, error): ...
def sync_state_did_change(self, device, state): ...
def did_receive_unsynchronized_size(self, device, size, throughput): ...
def did_receive_past_ecg(self, device, ts, value): ...
def did_receive_past_respiration(self, device, ts, value): ...
def did_receive_past_eda(self, device, ts, conductance): ...
def did_receive_past_gps(self, device, ts, lat, lon, alt, speed, heading, hdop): ...fun didConnect(device: Device)
fun didDisconnect(device: Device, reason: DisconnectReason)
fun didReceiveBatteryLevel(device: Device, soc: Int)
fun didReceiveECG(device: Device, timestamp: Long, value: Float)
fun didReceiveRespiration(device: Device, timestamp: Long, value: Float)
fun didReceiveRespirationRate(device: Device, timestamp: Long, value: Int)
fun didReceiveSkinTemperature(device: Device, timestamp: Long, value: Float)
fun didReceiveHeartRate(device: Device, timestamp: Long, heartRate: Int)
fun didReceiveRr(device: Device, timestamp: Long, rr: Int)
fun didReceiveActivity(device: Device, timestamp: Long, activity: ActivityType)
fun didReceiveSteps(device: Device, timestamp: Long, value: Long)
fun didReceiveSignalQuality(device: Device, timestamp: Long, quality: Int)
fun didReceiveAccelerometer(device: Device, timestamp: Long, ax: Float, ay: Float, az: Float)
fun didReceiveGyroscope(device: Device, timestamp: Long, gx: Float, gy: Float, gz: Float)
fun didReceiveMagnetometer(device: Device, timestamp: Long, mx: Float, my: Float, mz: Float)
fun didReceiveQuaternion(device: Device, timestamp: Long, qw: Float, qx: Float, qy: Float, qz: Float)
fun didReceiveOrientation(device: Device, timestamp: Long, roll: Float, pitch: Float, yaw: Float)
fun didReceiveBodyPosition(device: Device, timestamp: Long, bodyPosition: BodyPosition)
fun didReceiveSoundVolume(device: Device, timestamp: Long, value: Int)
fun didReceivePressure(device: Device, timestamp: Long, value: Int)
fun pressureWearStateDidChange(device: Device, wearState: WearState)
fun wearStateDidChange(device: Device, wearState: WearState)
fun didReceiveEDA(device: Device, timestamp: Long, conductance: Float) // Firmware 4.0.0+
fun didReceiveGPS(device: Device, timestamp: Long, latitude: Double, longitude: Double, altitude: Double, speed: Float, heading: Float, hdop: Float) // Firmware 4.0.0+
fun didDetectUserEvent(device: Device, timestamp: Long)
fun didDetectExercise(device: Device, exercise: Exercise)
fun didReceiveError(device: Device, error: AidlabError)
fun syncStateDidChange(device: Device, state: SyncState)
fun didReceiveUnsynchronizedSize(device: Device, unsynchronizedSize: Int, syncBytesPerSecond: Float)
fun didReceivePastECG(device: Device, timestamp: Long, value: Float)
fun didReceivePastRespiration(device: Device, timestamp: Long, value: Float)
fun didReceivePastEDA(device: Device, timestamp: Long, conductance: Float)
fun didReceivePastGPS(device: Device, timestamp: Long, latitude: Double, longitude: Double, altitude: Double, speed: Float, heading: Float, hdop: Float)func didConnect(_ device: Device)
func didDisconnect(_ device: Device, reason: DisconnectReason)
func didReceiveBatteryLevel(_ device: Device, stateOfCharge: UInt8)
func didReceiveECG(_ device: Device, timestamp: UInt64, value: Float)
func didReceiveRespiration(_ device: Device, timestamp: UInt64, value: Float)
func didReceiveRespirationRate(_ device: Device, timestamp: UInt64, value: UInt32)
func didReceiveSkinTemperature(_ device: Device, timestamp: UInt64, value: Float)
func didReceiveHeartRate(_ device: Device, timestamp: UInt64, heartRate: Int32)
func didReceiveRr(_ device: Device, timestamp: UInt64, rr: Int32)
func didReceiveActivity(_ device: Device, timestamp: UInt64, activity: ActivityType)
func didReceiveSteps(_ device: Device, timestamp: UInt64, value: UInt64)
func didReceiveSignalQuality(_ device: Device, timestamp: UInt64, value: Int32)
func didReceiveAccelerometer(_ device: Device, timestamp: UInt64, ax: Float, ay: Float, az: Float)
func didReceiveGyroscope(_ device: Device, timestamp: UInt64, gx: Float, gy: Float, gz: Float)
func didReceiveMagnetometer(_ device: Device, timestamp: UInt64, mx: Float, my: Float, mz: Float)
func didReceiveQuaternion(_ device: Device, timestamp: UInt64, qw: Float, qx: Float, qy: Float, qz: Float)
func didReceiveOrientation(_ device: Device, timestamp: UInt64, roll: Float, pitch: Float, yaw: Float)
func didReceiveBodyPosition(_ device: Device, timestamp: UInt64, bodyPosition: BodyPosition)
func didReceiveSoundVolume(_ device: Device, timestamp: UInt64, soundVolume: UInt16)
func didReceivePressure(_ device: Device, timestamp: UInt64, value: Int32)
func pressureWearStateDidChange(_ device: Device, wearState: WearState)
func wearStateDidChange(_ device: Device, wearState: WearState)
func didReceiveEDA(_ device: Device, timestamp: UInt64, conductance: Float) // Firmware 4.0.0+
func didReceiveGPS(_ device: Device, timestamp: UInt64, latitude: Double, longitude: Double, altitude: Double, speed: Float, heading: Float, hdop: Float) // Firmware 4.0.0+
func didDetectUserEvent(_ device: Device, timestamp: UInt64)
func didDetectExercise(_ device: Device, exercise: Exercise)
func didReceiveError(_ device: Device, error: AidlabError)
func syncStateDidChange(_ device: Device, state: SyncState)
func didReceiveUnsynchronizedSize(_ device: Device, unsynchronizedSize: UInt32, syncBytesPerSecond: Float)
func didReceivePastECG(_ device: Device, timestamp: UInt64, value: Float)
func didReceivePastRespiration(_ device: Device, timestamp: UInt64, value: Float)
func didReceivePastEDA(_ device: Device, timestamp: UInt64, conductance: Float)
func didReceivePastGPS(_ device: Device, timestamp: UInt64, latitude: Double, longitude: Double, altitude: Double, speed: Float, heading: Float, hdop: Float)Future<void> didConnect(Device device);
void didDisconnect(Device device, DisconnectReason reason);
void didReceiveBatteryLevel(Device device, int stateOfCharge);
void didReceiveECG(Device device, int timestamp, double value);
void didReceiveRespiration(Device device, int timestamp, double value);
void didReceiveRespirationRate(Device device, int timestamp, int value);
void didReceiveSkinTemperature(Device device, int timestamp, double value);
void didReceiveHeartRate(Device device, int timestamp, int heartRate);
void didReceiveRr(Device device, int timestamp, int rr);
void didReceiveActivity(Device device, int timestamp, ActivityType activity);
void didReceiveSteps(Device device, int timestamp, int steps);
void didReceiveSignalQuality(Device device, int timestamp, int value);
void didReceiveAccelerometer(Device device, int timestamp, double ax, double ay, double az);
void didReceiveGyroscope(Device device, int timestamp, double gx, double gy, double gz);
void didReceiveMagnetometer(Device device, int timestamp, double mx, double my, double mz);
void didReceiveQuaternion(Device device, int timestamp, double qw, double qx, double qy, double qz);
void didReceiveOrientation(Device device, int timestamp, double roll, double pitch, double yaw);
void didReceiveBodyPosition(Device device, int timestamp, BodyPosition bodyPosition);
void didReceiveSoundVolume(Device device, int timestamp, int value);
void didReceivePressure(Device device, int timestamp, int value);
void pressureWearStateDidChange(Device device, WearState wearState);
void wearStateDidChange(Device device, WearState wearState);
void didReceiveEDA(Device device, int timestamp, double conductance); // Firmware 4.0.0+
void didReceiveGPS(Device device, int timestamp, double lat, double lon, double alt, double speed, double heading, double hdop); // Firmware 4.0.0+
void didDetectUserEvent(Device device, int timestamp);
void didDetectExercise(Device device, Exercise exercise);
void didReceiveError(Device device, AidlabError error);
void syncStateDidChange(Device device, SyncState state);
void didReceiveUnsynchronizedSize(Device device, int unsynchronizedSize, double syncBytesPerSecond);
void didReceivePastECG(Device device, int timestamp, double value);
void didReceivePastRespiration(Device device, int timestamp, double value);
void didReceivePastEDA(Device device, int timestamp, double conductance);
void didReceivePastGPS(Device device, int timestamp, double lat, double lon, double alt, double speed, double heading, double hdop);using UnityEngine;
public class MyAidlab : MonoBehaviour {
void Start() {
Aidlab.AidlabSDK.init();
// Subscribe to updates (callbacks run on Unity main thread).
Aidlab.AidlabSDK.aidlabDelegate.respiration.Subscribe(OnRespiration);
Aidlab.AidlabSDK.aidlabDelegate.eda.Subscribe(OnEda);
}
private void OnRespiration() {
var ts = Aidlab.AidlabSDK.aidlabDelegate.respiration.timestamp;
var value = Aidlab.AidlabSDK.aidlabDelegate.respiration.value;
Debug.Log($"Respiration @ {ts}: {value}");
}
private void OnEda() {
var ts = Aidlab.AidlabSDK.aidlabDelegate.eda.timestamp;
var value = Aidlab.AidlabSDK.aidlabDelegate.eda.value;
Debug.Log($"EDA @ {ts}: {value}");
}
}