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: MTS-Serial libmDot-mbed5
Fork of Dot-AT-Firmware by
CmdWakeMode.cpp
00001 #include "CmdWakeMode.h" 00002 00003 CmdWakeMode::CmdWakeMode() : 00004 #if defined(TARGET_MTS_MDOT_F411RE) 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("Wake Mode", "AT+WM", "Wakeup mode, INTERRUPT uses WAKE as wake-up pin (0:INTERVAL,1:INTERRUPT,2:INTERVAL_OR_INTERRUPT)", "(0:INTERVAL,1:INTERRUPT,2:INTERVAL_OR_INTERRUPT)") 00008 #endif /* TARGET_MTS_MDOT_F411RE */ 00009 { 00010 _queryable = true; 00011 } 00012 00013 uint32_t CmdWakeMode::action(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 CommandTerminal::setErrorMessage(CommandTerminal::Dot()->getLastError());; 00026 return 1; 00027 } 00028 } 00029 00030 return 0; 00031 } 00032 00033 bool CmdWakeMode::verify(std::vector<std::string> args) 00034 { 00035 if (args.size() == 1) 00036 return true; 00037 00038 if (args.size() == 2) { 00039 int mode; 00040 if (sscanf(args[1].c_str(), "%d", &mode) != 1) { 00041 CommandTerminal::setErrorMessage("Invalid argument"); 00042 return false; 00043 } 00044 00045 if (mode != 0 && mode != 1 && mode != 2) { 00046 CommandTerminal::setErrorMessage("Invalid mode, expects (0:INTERVAL,1:INTERRUPT,2:INTERVAL_OR_INTERRUPT)"); 00047 return false; 00048 } 00049 00050 return true; 00051 } 00052 00053 CommandTerminal::setErrorMessage("Invalid arguments"); 00054 return false; 00055 }
Generated on Tue Jul 12 2022 20:40:04 by
