Elmo Terminal provides functionality to test Lora radio and access SX1272 chip registers delivered with Elmo board. Also contains example ping-pong application.
Dependencies: SX1272lib mbed-src
Revision 3:bb58d4e78e68, committed 2015-10-01
- Comitter:
- WGorniak
- Date:
- Thu Oct 01 14:42:59 2015 +0200
- Parent:
- 2:8d8295a51f68
- Child:
- 4:2767f13b0a75
- Commit message:
- removed sstream (arm microlib compatibility)
Changed in this revision
--- a/Settings/Settings.cpp Thu Oct 01 09:40:30 2015 +0200 +++ b/Settings/Settings.cpp Thu Oct 01 14:42:59 2015 +0200 @@ -1,4 +1,3 @@ -#include <sstream> #include <cassert> #include "Settings.h" @@ -24,9 +23,11 @@ { const Variable& r = find(variable); - std::ostringstream temp; - temp << r.name() << ": " << r.describe(); - return temp.str(); + std::string temp(r.name()); + temp.append(": "); + temp.append(r.describe()); + + return temp; } int32_t Settings::get(std::string variable) const @@ -54,22 +55,27 @@ std::string Settings::help() const { - std::ostringstream temp; + std::string temp; for (Variable* p = variables_; !p->endGuard(); ++p) { - temp << p->name() << ": " << p->help() << "\r\n"; + temp.append(p->name()); + temp.append(": "); + temp.append(p->help()); + temp.append("\r\n"); } - return temp.str(); + return temp; } std::string Settings::values() const { - std::ostringstream temp; - + std::string temp; for (Variable* p = variables_; !p->endGuard(); ++p) { - temp << p->name() << ": " << p->describe() << "\r\n"; + temp.append(p->name()); + temp.append(": "); + temp.append(p->describe()); + temp.append("\r\n"); } - return temp.str(); + return temp; }
--- a/Settings/Variable.cpp Thu Oct 01 09:40:30 2015 +0200 +++ b/Settings/Variable.cpp Thu Oct 01 14:42:59 2015 +0200 @@ -1,7 +1,14 @@ -#include <sstream> +#include <stdio.h> #include <limits> #include "Variable.h" +std::string to_string(const int32_t val) +{ + char buffer[10]; + sprintf(buffer,"%ld",val); + return std::string(buffer); +} + Variable::ValueDescription Variable::none[] = {{0,0}}; int32_t Variable::nonSetValue() @@ -37,9 +44,9 @@ std::string Variable::help() const { - std::ostringstream temp; - - temp << description_ << "\r\n"; +// std::ostringstream temp; + std::string temp(description_); + temp.append("\r\n"); for (const ValueDescription* p = pValueDescriptions_; !p->isEnd(); ++p) { @@ -48,22 +55,26 @@ continue; } - temp << " "; + temp.append(" "); if ((p+1)->isEndRange()) { - temp << p->value << "..." << (p+1)->value << " " << p->description; + temp.append(to_string(p->value)); + temp.append("..."); + temp.append(to_string((p+1)->value)); + temp.append(" "); + temp.append(p->description); } else { - temp << p->value << ": " << p->description << " "; + temp.append(to_string(p->value)); + temp.append(": "); + temp.append(p->description); + temp.append(" "); } - - temp << "\r\n"; + temp.append("\r\n"); } - - std::string s = temp.str(); - return s; + return temp; } std::string Variable::describe(int32_t value) const @@ -79,16 +90,17 @@ { if ((p->value <= value) && (value <= (p+1)->value)) { - std::ostringstream temp; - temp << value << " " << p->description; - return temp.str(); + std::string temp(to_string(value)); + temp.append(p->description); + return temp; } } else if (p->value == value) { - std::ostringstream temp; - temp << value << " - " << p->description; - return temp.str(); + std::string temp(to_string(value)); + temp.append(" - "); + temp.append(p->description); + return temp; } } return "";
--- a/main.cpp Thu Oct 01 09:40:30 2015 +0200 +++ b/main.cpp Thu Oct 01 14:42:59 2015 +0200 @@ -8,8 +8,6 @@ #include "PingPongCmd.h" -#include <sstream> - Variable::ValueDescription frequencyValues[] = {{860000, "kHz"}, {1020000, 0}, {0,0} };