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:

The MultiConnect® mDot™ offers significantly longer range and improved radio performance compared to traditional wireless solutions—resulting in greater transmission range and reduced capital expense.

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 Alejandro Veiga 04 Jul 2016

Alejandro,

Currently, the best documentation is the comments in mDot.h

AUTO_OTA will save and restore your network session across sleep and deepsleep, so it should work for you.

Cheers,

Mike

posted by Mike Fiore 05 Jul 2016