Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: libmDot-Custom MTS-Serial
Fork of mDot_AT_firmware_CUSTOM by
To change channel plans replace AS923 with AU915, EU868, KR920 or US915 on line 15
#define CHANNEL_PLAN CP_AS923
CommandTerminal/CmdPreserveSession.cpp@29:15b59b827ac7, 2017-03-23 (annotated)
- Committer:
- jreiss
- Date:
- Thu Mar 23 20:40:54 2017 +0000
- Revision:
- 29:15b59b827ac7
- Parent:
- 14:e80ace5a6834
update libmDot-Custom
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Mike Fiore |
9:ff62b20f7000 | 1 | /* |
Mike Fiore |
9:ff62b20f7000 | 2 | * CmdPreserveSession.cpp |
Mike Fiore |
9:ff62b20f7000 | 3 | * |
Mike Fiore |
9:ff62b20f7000 | 4 | * Created on: Nov 4, 2015 |
Mike Fiore |
9:ff62b20f7000 | 5 | * Author: jreiss |
Mike Fiore |
9:ff62b20f7000 | 6 | */ |
Mike Fiore |
9:ff62b20f7000 | 7 | |
Mike Fiore |
9:ff62b20f7000 | 8 | #include "CmdPreserveSession.h" |
Mike Fiore |
9:ff62b20f7000 | 9 | |
Jason Reiss |
14:e80ace5a6834 | 10 | CmdPreserveSession::CmdPreserveSession() |
Mike Fiore |
9:ff62b20f7000 | 11 | : |
Jason Reiss |
14:e80ace5a6834 | 12 | Command("Preserve Session", "AT+PS", "Save network session info through reset or power down in AUTO_OTA mode (0:off, 1:on)", "(0,1)") |
Mike Fiore |
9:ff62b20f7000 | 13 | { |
Mike Fiore |
9:ff62b20f7000 | 14 | _queryable = true; |
Mike Fiore |
9:ff62b20f7000 | 15 | } |
Mike Fiore |
9:ff62b20f7000 | 16 | |
Mike Fiore |
9:ff62b20f7000 | 17 | CmdPreserveSession::~CmdPreserveSession() |
Mike Fiore |
9:ff62b20f7000 | 18 | { |
Mike Fiore |
9:ff62b20f7000 | 19 | // TODO Auto-generated destructor stub |
Mike Fiore |
9:ff62b20f7000 | 20 | } |
Mike Fiore |
9:ff62b20f7000 | 21 | |
Mike Fiore |
9:ff62b20f7000 | 22 | uint32_t CmdPreserveSession::action(std::vector<std::string> args) { |
Mike Fiore |
9:ff62b20f7000 | 23 | |
Mike Fiore |
9:ff62b20f7000 | 24 | if (args.size() == 1) { |
Jason Reiss |
14:e80ace5a6834 | 25 | CommandTerminal::Serial()->writef("%u\r\n", CommandTerminal::Dot()->getPreserveSession()); |
Mike Fiore |
9:ff62b20f7000 | 26 | } else { |
Jason Reiss |
14:e80ace5a6834 | 27 | CommandTerminal::Dot()->setPreserveSession(args[1] == "1"); |
Mike Fiore |
9:ff62b20f7000 | 28 | } |
Mike Fiore |
9:ff62b20f7000 | 29 | |
Mike Fiore |
9:ff62b20f7000 | 30 | return mDot::MDOT_OK; |
Mike Fiore |
9:ff62b20f7000 | 31 | } |
Mike Fiore |
9:ff62b20f7000 | 32 | |
Mike Fiore |
9:ff62b20f7000 | 33 | bool CmdPreserveSession::verify(std::vector<std::string> args) { |
Mike Fiore |
9:ff62b20f7000 | 34 | if (args.size() == 1) |
Mike Fiore |
9:ff62b20f7000 | 35 | return true; |
Mike Fiore |
9:ff62b20f7000 | 36 | |
Mike Fiore |
9:ff62b20f7000 | 37 | if (args.size() == 2) { |
Mike Fiore |
9:ff62b20f7000 | 38 | |
Mike Fiore |
9:ff62b20f7000 | 39 | if (args[1] != "1" && args[1] != "0") { |
Jason Reiss |
14:e80ace5a6834 | 40 | CommandTerminal::setErrorMessage("Invalid parameter, expects (0: off, 1: on)"); |
Mike Fiore |
9:ff62b20f7000 | 41 | return false; |
Mike Fiore |
9:ff62b20f7000 | 42 | } |
Mike Fiore |
9:ff62b20f7000 | 43 | |
Mike Fiore |
9:ff62b20f7000 | 44 | return true; |
Mike Fiore |
9:ff62b20f7000 | 45 | } |
Mike Fiore |
9:ff62b20f7000 | 46 | |
Jason Reiss |
14:e80ace5a6834 | 47 | CommandTerminal::setErrorMessage("Invalid arguments"); |
Mike Fiore |
9:ff62b20f7000 | 48 | return false; |
Mike Fiore |
9:ff62b20f7000 | 49 | } |