Search code examples
data-structuresdata-storageeeprommovesense

Storing one's own Movesense data-structure


I am currently working on Movesense and I would like to write my own data in the memory with the Datalogger service. My goal is to write a structure of 3 bytes every minute. This should be easy to do but at the moment, I can't find any way to do that. Indeed, on Movesense documentation I only find examples for Android code, there is no sample in C++ that could help.

So, here is what I've done:

  • First, I created a resource with 3 properties.
  • Then, I set the Datalogger config (in the .cpp file) by giving as an entry, the path of my resource.
  • After that, I start logging and update the 3-properties resource every minute.
  • On the App side, I stop logging, I call the GetLogEntriesJsonAsync() function to get the data entries and I call the GetLogbookDataJsonAsync() function to get the data.

The problem is that I get a "null" result. Does anyone know about how to get the right data?

I have tried with a non-structured data (simple resource) and it works! However, the thing is that the Logbook service returns a single value (the last one), not the whole data I've streamed. If someone has already been faced to this issue, could he tell me which solution did he used?

Otherwise, is there any way to write and read data within Movesense? If yes, could I get an example?

Thanks in advance. I hope my problem is clear.

Best regards,

Antoine


Solution

  • The way to log your own data is the way you described: 1. Create a resource that has a data type with the format you want 2. Configure DataLogger with that path 3. Start DataLogger 4. Get data from the sensor via MDS proxy service that does the JSON conversion

    To find the reason it doesn't work for you, I'd check the following:

    • Make sure that the sbem storage code is generated for your service. That can be seen in your build folder under generated/sbem-code/sbem_definitions.cpp.
    • Try to read the log entry using the Android DataLoggerSample and see if that works. If it does, the problem is in the wrapper (Xamarin?) that you use

    The issue of json returning only last value when logging primitives is a known bug. The logbook binary from the sensor actually contains all the values, the issue is in the SBEM->JSON conversion:

    https://bitbucket.org/suunto/movesense-mobile-lib/issues/86/datalogger-service-to-be-configured-to

    Full Disclosure: I work for the Movesense team