Hi. May I know, in what format does SleepAsAndroid expect to get data from com.urbandroid.sleep.watch.DATA_UPDATE intent?
Send movement data
Intent : com.urbandroid.sleep.watch.DATA_UPDATE
Extras:
MAX_DATA (float array): Array containing latest MAX values from the watch.
MAX_RAW_DATA (float array): Array containing a geometric average of latest MAX values from the watch.
This sentence from documentation is a bit confused:
The values to be aggregated should be changes in raw accelerometer data expressed in m/s2.
Do both MAX_DATA (float array) and MAX_RAW_DATA (float array) and x/y/z from pseudocode have to be in m/s?
on_sensor_change() {
x = sensor.x;
y = sensor.y;
z = sensor.z;
max = abs(x - lastX) + abs(y - lastY) + abs(z - lastZ);
if (max > current_max_data) {
current_max_data = max;
}
max_raw = sqrt((x * x) + (y * y) + (z * z));
if (max_raw > current_max_raw_data) {
current_max_raw_data = max_raw;
}
lastX = x;
lastY = y;
lastZ = z;
}