Send movement data & SET_BATCH_SIZE command

Hello.
I’m developing 3rd party BLE wearable plugin for Sleep As Android and I am a little but confused with documentation about SET_BATCH_SIZE command.

Sleep As Android expects to receive data aggregated per 10 seconds intervals.
Then after a batch period (by default 120 seconds, but Sleep sometimes needs to change it and sends a SET_BATCH_SIZE command), send them to Sleep as Android.

Is batch size and batch period the same parameter?
Or how do they related to each other?

Because if they are not the same, that means by default BATCH_SIZE is 120/10=12 measurements.
And if batch size is changed, does it mean that batch period is changed as well, because data aggregation period is constant and = 10 seconds ?

For example after application start our parameters have these default values:
aggregation period = 10 sec
batch period = 120 sec
batch size = 12 aggregated measurements

But when plugin receive SET_BATCH_SIZE command with value 20, parameters have to be changed to:
aggregation period = 10 sec (because it’s constant)
batch period = 200 sec
batch size = 20 aggregated measurements

Am I right?

1 Like

Hello Den,

what Sleep as Android does it it asks for BATCH_SIZE=1 when sleep is on to try to get data as fast as possible (10s interval) when user is actively watching the tracking screen, than when screen turns off it sets batch size to 12 again…

So this is just a convenience for the user to get more frequent updates, but if you ignore this you will still have a pretty functional integration…

2 Likes