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
Diff: CommandTerminal/CmdSendStringOnInterval.cpp
- Revision:
- 2:e5eebd74d36d
- Parent:
- 1:e52ae6584f1c
- Child:
- 4:666017851052
--- a/CommandTerminal/CmdSendStringOnInterval.cpp Thu Jun 25 10:23:41 2015 -0500
+++ b/CommandTerminal/CmdSendStringOnInterval.cpp Fri Jul 10 09:43:56 2015 -0500
@@ -12,10 +12,17 @@
uint32_t CmdSendStringOnInterval::action(std::vector<std::string> args) {
int32_t code;
uint32_t interval;
- std::vector<uint8_t> data(args[2].begin(), args[2].end());
+ std::string text;
sscanf(args[1].c_str(), "%lu", &interval);
+ for (size_t i = 2; i < args.size(); i++) {
+ text.append(args[i]);
+ if (i != args.size() - 1)
+ text.append(",");
+ }
+ std::vector<uint8_t> data(text.begin(), text.end());
+
while (true) {
if (_dot->getJoinMode() == mDot::AUTO_OTA) {
Timer timer;
@@ -83,8 +90,10 @@
}
bool CmdSendStringOnInterval::verify(std::vector<std::string> args) {
- if (args.size() == 3) {
+ if (args.size() >= 3) {
uint32_t interval;
+ size_t size = 0;
+
if (sscanf(args[1].c_str(), "%lu", &interval) != 1) {
setErrorMessage("Invalid argument");
return false;
@@ -95,7 +104,9 @@
return false;
}
- if (args[2].size() > 242) {
+ for (int i = 2; i < args.size(); i++)
+ size += args[i].size();
+ if (size > 242) {
setErrorMessage("Invalid packet, expects (string:242)");
return false;
}
