Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
8 years, 4 months ago.
mDot save and restore state
I would like to write a program for mDot with the following pseudocode structure:
Configure mDot Save configuration Authenticate OTA against Conduit Save session, keys and all required information (*) while(1) { Go into deepsleep Wake up Restore session information (*) Transmit data to Conduit }
Which would be the recommended way to do this? In particular, the save and restore code (*). Is there a working example that shows how to do that? If not, I would be grateful for any suggestions or ideas.
-Alejandro
Question relating to:
1 Answer
8 years, 4 months ago.
Alejandro,
There are functions in the mDot library for saving and restoring the session. See mDot::saveNetworkSession and mDot::restoreNetworkSession.
There is an issue with the program flow you described. When the mDot wakes up from deepsleep, the application begins execution at the beginning. In your current flow, you'd never actually send data to the Conduit. If you're using deepsleep mode, you should use a flow like this instead
if(mDot needs configuring) { Configure mDot Save configuration } while(1) { Restore session information (*) if (session is not joined) { Authenticate OTA against Conduit } Transmit data to Conduit Save session, keys and all required information (*) Go into deepsleep Wake up }
Cheers,
Mike
Thank you, Mike. You are right about the program flow. Would you recommend a source of documentation for functions like saveNetworkSession and restoreNetworkSession? Do you think it would be better to use AUTO_OTA in this case? Is there an online working example? Best regards, Alejandro
posted by 04 Jul 2016