Reading Data from Internal Memory (Synchronization)
The device records selected signals in internal memory whenever it does not stream live. Synchronization transfers the stored samples to your application.
Starting synchronization
After connecting, start synchronization to transfer stored data. The device marks transferred data as sent and does not send it again. Data not yet transferred, for example after synchronization stops, is sent by the next synchronization.
While it does not stream live, the device keeps recording during synchronization, so the transfer can keep finding new data. To transfer everything stored, first call collect() with an empty list of data to store; stopCollect() keeps recording.
Firmware compatibility
Firmware 3.7.84–3.7.110 is an exception: synchronization starts automatically when data collection starts. On these versions, do not start synchronization separately.
# Start transferring stored data from internal memory.
await device.start_synchronization()
# Stop transferring stored data from internal memory.
await device.stop_synchronization()lifecycleScope.launch {
// Start transferring stored data from internal memory.
device.startSynchronization()
// Stop transferring stored data from internal memory.
device.stopSynchronization()
}// Start transferring stored data from internal memory.
try await device.startSynchronization()
// Stop transferring stored data from internal memory.
try await device.stopSynchronization()// Start transferring stored data from internal memory.
await device.startSynchronization();
// Stop transferring stored data from internal memory.
await device.stopSynchronization();var sdk = FindAnyObjectByType<Aidlab.AidlabSDK>();
if (sdk != null) {
// Start transferring stored data from internal memory.
await sdk.StartSynchronization();
// Stop transferring stored data from internal memory.
await sdk.StopSynchronization();
}Receiving stored data
Stored samples are delivered through historical data callbacks. Timestamps represent capture time in milliseconds since the Unix epoch. Within each data type, samples arrive in capture order, from oldest to newest. To combine multiple data types into one timeline, sort them by timestamp.
def did_receive_past_ecg(self, device, timestamp, value): ...
def did_receive_past_respiration(self, device, timestamp, value): ...
def did_receive_past_respiration_rate(self, device, timestamp, value): ...
def did_receive_past_skin_temperature(self, device, timestamp, value): ...
def did_receive_past_accelerometer(self, device, timestamp, ax, ay, az): ...
def did_receive_past_gyroscope(self, device, timestamp, gx, gy, gz): ...
def did_receive_past_magnetometer(self, device, timestamp, mx, my, mz): ...
def did_receive_past_orientation(self, device, timestamp, roll, pitch, yaw): ...
def did_receive_past_body_position(self, device, timestamp, body_position): ...
def did_receive_past_quaternion(self, device, timestamp, qw, qx, qy, qz): ...
def did_receive_past_steps(self, device, timestamp, steps): ...
def did_receive_past_heart_rate(self, device, timestamp, heart_rate): ...
def did_receive_past_rr(self, device, timestamp, rr): ...
def did_receive_past_sound_volume(self, device, timestamp, sound_volume): ...
def did_receive_past_pressure(self, device, timestamp, value): ...
def did_receive_past_signal_quality(self, device, timestamp, value): ...fun didReceivePastECG(device: Device, timestamp: Long, value: Float)
fun didReceivePastRespiration(device: Device, timestamp: Long, value: Float)
fun didReceivePastSkinTemperature(device: Device, timestamp: Long, value: Float)
fun didReceivePastHeartRate(device: Device, timestamp: Long, heartRate: Int)
fun didReceivePastRr(device: Device, timestamp: Long, rr: Int)
fun didReceivePastRespirationRate(device: Device, timestamp: Long, value: Int)
fun didReceivePastSteps(device: Device, timestamp: Long, value: Long)
fun didReceivePastAccelerometer(device: Device, timestamp: Long, ax: Float, ay: Float, az: Float)
fun didReceivePastGyroscope(device: Device, timestamp: Long, gx: Float, gy: Float, gz: Float)
fun didReceivePastMagnetometer(device: Device, timestamp: Long, mx: Float, my: Float, mz: Float)
fun didReceivePastQuaternion(device: Device, timestamp: Long, qw: Float, qx: Float, qy: Float, qz: Float)
fun didReceivePastOrientation(device: Device, timestamp: Long, roll: Float, pitch: Float, yaw: 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)
fun didReceivePastBodyPosition(device: Device, timestamp: Long, bodyPosition: BodyPosition)
fun didReceivePastSoundVolume(device: Device, timestamp: Long, value: Int)
fun didReceivePastPressure(device: Device, timestamp: Long, value: Int)
fun didReceivePastSignalQuality(device: Device, timestamp: Long, value: Int)func didReceivePastECG(_ device: Device, timestamp: UInt64, value: Float)
func didReceivePastRespiration(_ device: Device, timestamp: UInt64, value: Float)
func didReceivePastSkinTemperature(_ device: Device, timestamp: UInt64, value: Float)
func didReceivePastHeartRate(_ device: Device, timestamp: UInt64, heartRate: Int32)
func didReceivePastRr(_ device: Device, timestamp: UInt64, rr: Int32)
func didReceivePastRespirationRate(_ device: Device, timestamp: UInt64, value: UInt32)
func didReceivePastSteps(_ device: Device, timestamp: UInt64, value: UInt64)
func didReceivePastSoundVolume(_ device: Device, timestamp: UInt64, soundVolume: UInt16)
func didReceivePastAccelerometer(_ device: Device, timestamp: UInt64, ax: Float, ay: Float, az: Float)
func didReceivePastGyroscope(_ device: Device, timestamp: UInt64, gx: Float, gy: Float, gz: Float)
func didReceivePastMagnetometer(_ device: Device, timestamp: UInt64, mx: Float, my: Float, mz: Float)
func didReceivePastQuaternion(_ device: Device, timestamp: UInt64, qw: Float, qx: Float, qy: Float, qz: Float)
func didReceivePastOrientation(_ device: Device, timestamp: UInt64, roll: Float, pitch: Float, yaw: 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)
func didReceivePastBodyPosition(_ device: Device, timestamp: UInt64, bodyPosition: BodyPosition)
func didReceivePastPressure(_ device: Device, timestamp: UInt64, value: Int32)
func didReceivePastSignalQuality(_ device: Device, timestamp: UInt64, value: UInt8)void didReceivePastECG(Device device, int timestamp, double value) {}
void didReceivePastRespiration(Device device, int timestamp, double value) {}
void didReceivePastSkinTemperature(Device device, int timestamp, double value) {}
void didReceivePastHeartRate(Device device, int timestamp, int heartRate) {}
void didReceivePastRr(Device device, int timestamp, int rr) {}
void didReceivePastRespirationRate(Device device, int timestamp, int value) {}
void didReceivePastSteps(Device device, int timestamp, int steps) {}
void didReceivePastSoundVolume(Device device, int timestamp, int soundVolume) {}
void didReceivePastAccelerometer(Device device, int timestamp, double ax, double ay, double az) {}
void didReceivePastGyroscope(Device device, int timestamp, double gx, double gy, double gz) {}
void didReceivePastMagnetometer(Device device, int timestamp, double mx, double my, double mz) {}
void didReceivePastQuaternion(Device device, int timestamp, double qw, double qx, double qy, double qz) {}
void didReceivePastOrientation(Device device, int timestamp, double roll, double pitch, double yaw) {}
void didReceivePastBodyPosition(Device device, int timestamp, BodyPosition bodyPosition) {}
void didReceivePastPressure(Device device, int timestamp, int value) {}
void didReceivePastEDA(Device device, int timestamp, double conductance) {}
void didReceivePastGPS(Device device, int timestamp, double latitude, double longitude, double altitude, double speed, double heading, double hdop) {}
void didReceivePastSignalQuality(Device device, int timestamp, int value) {}void OnEnable() {
Aidlab.AidlabSDK.aidlabSyncDelegate.pastEcg.Subscribe(OnPastEcg);
Aidlab.AidlabSDK.aidlabSyncDelegate.pastRespiration.Subscribe(OnPastRespiration);
}
void OnDisable() {
Aidlab.AidlabSDK.aidlabSyncDelegate.pastEcg.Unsubscribe(OnPastEcg);
Aidlab.AidlabSDK.aidlabSyncDelegate.pastRespiration.Unsubscribe(OnPastRespiration);
}
void OnPastEcg() {
var sample = Aidlab.AidlabSDK.aidlabSyncDelegate.pastEcg;
Debug.Log($"Past ECG: {sample.value} at {sample.timestamp}");
}
void OnPastRespiration() {
var sample = Aidlab.AidlabSDK.aidlabSyncDelegate.pastRespiration;
Debug.Log($"Past respiration: {sample.value} at {sample.timestamp}");
}Stored events use the same didReceiveEvent callback as live events, with isPast = true (is_past in Python).
Synchronization progress
Listen for synchronization state changes to track the transfer. Progress callbacks report how many bytes remain and the current transfer speed in bytes per second. The speed is -1 until measured or when unavailable.
def sync_state_did_change(self, device, sync_state): ...
def did_receive_unsynchronized_size(self, device, size, bytes_per_second): ...fun syncStateDidChange(device: Device, state: SyncState)
fun didReceiveUnsynchronizedSize(device: Device, unsynchronizedSize: Long, syncBytesPerSecond: Float)func syncStateDidChange(_ device: Device, state: SyncState)
func didReceiveUnsynchronizedSize(_ device: Device, unsynchronizedSize: UInt32, syncBytesPerSecond: Float)void syncStateDidChange(Device device, SyncState state) {}
void didReceiveUnsynchronizedSize(Device device, int size, double bytesPerSecond) {}Aidlab.AidlabSDK.aidlabSyncDelegate.syncState.Subscribe(OnSyncState);
Aidlab.AidlabSDK.aidlabSyncDelegate.unsynchronizedSize.Subscribe(OnSyncProgress);The synchronization states are:
| State | Meaning |
|---|---|
START | Transfer of stored data has started. |
END | The available stored data was transferred and synchronization finished normally. |
STOP | Synchronization was explicitly stopped before normal completion. |
EMPTY | There was no stored data to transfer. |
UNAVAILABLE | Synchronization could not access the device storage or is unavailable. |
Clearing stored data
Call clearSynchronization() (clear_synchronization() in Python) to delete data stored on the device, including data not yet synchronized.