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.
Fork of mDot_AT_firmware by
CmdWakeMode.cpp
00001 #include "CmdWakeMode.h" 00002 00003 CmdWakeMode::CmdWakeMode() : 00004 #if MTS_CMD_TERM_VERBOSE 00005 Command("Wake Mode", "AT+WM", "Wakeup mode, INTERRUPT uses DIO7 as wake-up pin (0:INTERVAL,1:INTERRUPT,2:INTERVAL_OR_INTERRUPT)", "(0:INTERVAL,1:INTERRUPT,2:INTERVAL_OR_INTERRUPT)") 00006 #else 00007 Command("AT+WM") 00008 #endif 00009 { 00010 _queryable = true; 00011 } 00012 00013 uint32_t CmdWakeMode::action(const std::vector<std::string>& args) 00014 { 00015 if (args.size() == 1) 00016 { 00017 CommandTerminal::Serial()->writef("%lu\r\n", CommandTerminal::Dot()->getWakeMode()); 00018 } 00019 else if (args.size() == 2) 00020 { 00021 int mode; 00022 sscanf(args[1].c_str(), "%d", &mode); 00023 00024 if (CommandTerminal::Dot()->setWakeMode(mode) != mDot::MDOT_OK) { 00025 return 1; 00026 } 00027 } 00028 00029 return 0; 00030 } 00031 00032 bool CmdWakeMode::verify(const std::vector<std::string>& args) 00033 { 00034 if (args.size() == 1) 00035 return true; 00036 00037 if (args.size() == 2) { 00038 int mode; 00039 if (sscanf(args[1].c_str(), "%d", &mode) != 1) { 00040 #if MTS_CMD_TERM_VERBOSE 00041 CommandTerminal::setErrorMessage("Invalid argument"); 00042 #endif 00043 return false; 00044 } 00045 00046 if (mode != 0 && mode != 1 && mode != 2) { 00047 #if MTS_CMD_TERM_VERBOSE 00048 CommandTerminal::setErrorMessage("Invalid mode, expects (0:INTERVAL,1:INTERRUPT,2:INTERVAL_OR_INTERRUPT)"); 00049 #endif 00050 return false; 00051 } 00052 00053 return true; 00054 } 00055 00056 #if MTS_CMD_TERM_VERBOSE 00057 CommandTerminal::setErrorMessage("Invalid arguments"); 00058 #endif 00059 return false; 00060 }
Generated on Wed Jan 15 2025 16:10:47 by
1.7.2
