Combining multiple variables data packets sent to AirVantage


#1

If you run the AssetData example and you go and look at the cellular data use and how the data is getting pushed, it looks like there is a new data transfer for each piece of data you push. If you also look at the data timeline in the AirVantage portal is hows the data coming across one piece at a time (when a device sync occurs data variables seem to be grouped together). Is there any way to update multiple data variables in the application and then push all the data at once?

I’m working on an application that is fairly sensitive as far as data use goes. It will generally only push data once every 24 hours but I’ve found each AirVantage variable I push uses around ~1-2 kb of data. I realize this is a feature I may may have to implement on my own if it doesn’t exist, just curious if there is a method already there for what I’m describing.

Another idea I may try is to use a single string variable and push JSON or some other type of encoded string. The actual data payload would be less efficient but if I don’t have to pay the overhead of multiple packets, I still may come out ahead.


#2

Hi @drewwestrick,
You mean to say you want to push all variables ROOM_NAME_VAR_RES, IS_AC_ON_VAR_RES, ROOM_TEMP_READING_VAR_RES and TARGET_TEMP_SET_RES together instead one by one?

Regards,
Muralidhara N.


#3

Yes. Right now I’m packing the data up as a JSON string and sending it as one item but I was wondering if there is a way to tell AirVantage to send all variables as a single message instead of individual messages. Since the overhead is quite high for AV it would reduce the total data used significantly.


#4

Timeseries sounds like what you are looking for http://legato.io/legato-docs/latest/avData.html#avData_TimeSeries. It allows you to aggregate multiple data points and push it all at once.


#5

Hi @drewwestrick,
Yes, you can try Timeseries api which esun has suggested. Below is the prototype test code how to create the record of multiple variables and push the multiple variables record at once. I haven’t tested it this myself,I am yet to test. Meantime you can check if this helps you.

void SendData()
{

le_avdata_RecordRef_t recRef = le_avdata_CreateRecord();



LE_ASSERT(le_avdata_RecordString(recRef, "TsVarString", "20170331-090502", 1412320402000) == LE_OK);

LE_ASSERT(le_avdata_RecordInt(recRef, "TsVarInt", 5953, 1412320402000) == LE_OK);

LE_ASSERT(le_avdata_RecordBool(recRef, "TsVarBool", true, 1412320402000) == LE_OK);

LE_ASSERT(le_avdata_RecordFloat(recRef, "TsVarFloat", 0.503618, 1412320402000) == LE_OK);

LE_ASSERT(le_avdata_PushRecord(recRef, CallbackHandler, NULL) == LE_OK);

le_avdata_DeleteRecord(recRef);

}

Regards,
Muralidhara N.