Reading Data from Internal Memory (aka. Synchronization)
Both Aidlab and Aidmed One are equipped with an internal memory. This allows to continuously collect and store data, even when they are not connected to an external device such as a smartphone or computer. For 8MB and 64MB versions, if the device is correctly worn by the user but not connected to any other device, the data is saved to the internal memory until it is full. To understand this process in more detail, visit Data Synchronization.
To access this collected data, you can manage the synchronization process from the internal memory to your app using specific functions and synchronization-related events.
It's important to note that Aidlab/Aidmed One can transmit past data from its internal memory and currently recorded data to your app simultaneously.
Enabling Data Synchronization
By default, if you're using our official Android or iOS app, Aidlab/Aidmed One saves data — which includes ECG, Activity, Steps, Heart Rate, Respiration, and Skin Temperature — to its internal storage. However, if you want to modify the type of signals being saved to better suit the requirements of your own app, you can do so by following these steps.
Firmware version 3 and above
In the most recent firmware versions, the data types selected in collect
method are not automatically saved to flash memory when connection is lost. If you wish to enable this feature, pass the second argument:
device.collect([DataType.ECG, ...], [DataType.ECG, ...])
device.collect(dataTypes: EnumSet.of(DataType.ECG), dataTypesToStore: EnumSet.of(DataType.ECG))
device.collect(dataTypes: [.ecg, ...], dataTypesToStore: [.ecg, ...])
Firmware versions earlier than 3
Enter the Aidlab debug shell:
- Enter
chrome://flags/#enable-experimental-web-platform-features
in your Chrome browser. - Enable the highlighted flag.
- Restart Chrome.
- Visit debug console.
- Turn Aidlab on, so the pulsating green diode will indicate the pending connection.
- Type
connect
and press enter. - Select Aidlab from the list.
- Wait till command prompt will be visible,
and use the following command with the name of your chosen signal (for example ecg
):
sync enable ecg
From this point, if your Aidlab device is powered on and correctly positioned on the user's chest (even if not connected to any device), it will autonomously store ecg
data to its flash memory. If you wish to record more than one type of signal, repeat the steps for each desired signal.
Should you wish to stop storing a specific type of signal, utilize the following command:
sync disable ecg
This will prevent the device from recording and storing ecg
data until the function is enabled again.
Synchronization Events
During the process of retrieving this internally stored data, the device emits a series of synchronization events:
def sync_state_did_change(self, device, sync_state):
pass
def did_receive_unsynchronized_size(self, device, unsynchronized_size, sync_bytes_per_second):
pass
def did_receive_past_ecg(self, device, timestamp, values):
pass
def did_receive_past_respiration(self, device, timestamp, values):
pass
def did_receive_past_respiration_rate(self, device, timestamp, value):
pass
def did_receive_past_skin_temperature(self, device, timestamp, value):
pass
def did_receive_past_accelerometer(self, device, timestamp, ax, ay, az):
pass
def did_receive_past_gyroscope(self, device, timestamp, gx, gy, gz):
pass
def did_receive_past_magnetometer(self, device, timestamp, mx, my, mz):
pass
def did_receive_past_orientation(self, device, timestamp, roll, pitch, yaw):
pass
def did_receive_past_body_position(self, device, timestamp, body_position):
pass
def did_receive_past_quaternion(self, device, timestamp, qw, qx, qy, qz):
pass
def did_receive_past_activity(self, device, timestamp, activity):
pass
def did_receive_past_steps(self, device, timestamp, steps):
pass
def did_receive_past_heart_rate(self, device, timestamp, heart_rate):
pass
def did_receive_past_rr(self, device, timestamp, rr):
pass
def did_receive_past_sound_volume(self, device, timestamp, sound_volume):
pass
def did_receive_past_signal_quality(self, device, timestamp, value):
pass
interface AidlabSynchronizationDelegate {
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 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 didReceivePastActivity(device: Device, timestamp: Long, activity: ActivityType)
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, qx: Float, qy: Float, qz: 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 didReceivePastBodyPosition(device: Device, timestamp: Long, bodyPosition: BodyPosition)
fun didReceivePastSoundVolume(device: Device, timestamp: Long, value: Int)
fun didReceivePastPressure(device: Device, timestamp: Long, value: Int)
fun didDetectPastUserEvent(timestamp: Long)
fun didReceivePastSignalQuality(device: Device, timestamp: Long, value: Int)
}
func syncStateDidChange(_ device: Device, state: SyncState)
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 didReceiveUnsynchronizedSize(_ device: Device, unsynchronizedSize: UInt16, syncBytesPerSecond: Float)
func didReceivePastRespirationRate(_ device: Device, timestamp: UInt64, value: UInt32)
func didReceivePastActivity(_ device: Device, timestamp: UInt64, activity: ActivityType)
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, qx: Float, qy: Float, qz: 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 didReceivePastBodyPosition(_ device: Device, timestamp: UInt64, bodyPosition: BodyPosition)
func didReceivePastSignalQuality(_ device: Device, timestamp: UInt64, value: Int32)
By default, synchronization is enabled. To stop synchronization, use the following method:
device.stop_synchronization()
device.stopSynchronization()
device.stopSynchronization()