Offline Logging: How to read after a disconnect?

I am able to setup my device to load the on board temperature readings and things work fine until I get disconnected. Then my MBLEvent throws an error saying it has been disconnected. If I create a new one then it looks like the logged readings that should have happened while I was disconnected are lost. Is this the way this really works or am I missing something?

Comments

  • So I have been trying to use this Blog Article http://projects.mbientlab.com/persistent-events-and-filters/ and things are not working for me as I think they should.  When I first call setConfiguration I get a configuration that has my MBLEvent object in it as expected. If I disconnect and then reconnect to the device I still see the MBLEvent, but if I stop my program, make some code edits, and then run it again (typical developer thing to do) the configuration loads, but doesn't have my MBLEvent in it. I have to call setConfiguration again, but according to the docs that will erase all non-volatile memory and thus I will loose any logged readings. 
  • Okay I have done some more coding now and I have found is I make ANY change to the Configuration class I am using the MBLEvent gets lost. If I don't change that then I have a good change it will be okay. But I still have random times where that MBLEvent is nil or that it becomes disconnected. In all cases I have to call setConfiguration again, but as I stated before that wipes the non-volatile memory which I don't want because then I loose logged readings. I wish there was a way I could query for the currently Logging MBLEvents and reuse it. This configuration is neat, but right now either I am not understanding it well enough or it is to buggy.
  • edited September 2015
    Hello, thanks for the questions.  Let me try and clear some things up.

    It is correct that you must use a Configuration class (MBLRestorable object) to access log data across disconnects.  That class must be set up so that any MBLEvents that you are logging are saved and restored using the encodeWithCoder: and initWithCoder: functions, can you confirm those functions are setup correct?

  • sorry for the long time between posts. Been a lot going on and this is a side project at work. I can confirm the coder methods are working correctly because other values such as strings and ints work correctly. Just some times the MBLEvent item is null and sometimes it exists, but has become disconnected. I thought the point of this new config system was so things did not become disconnected.

    Pretty much every time I recompile my project in XCode the MBLEvent is disconnected and I have to call setConfig again.
  • Hi Krunde,

    Stephen is currently on vacation right now. Normally I would try to answer your iOS questions, but it seems like you're already deep in discussion with him, so I will forward this question to him when he returns next week.

    Thanks for your patience!
    Yu
  • The config system does not prevent disconnects, we actually want disconnects so you don't have to always have an active BLE connection.

    The config system is designed to save events on disconnect and then restore events on connect.  Can you further explain what you mean by "every time I recompile my project in XCode the MBLEvent is disconnected"
This discussion has been closed.