aboutsummaryrefslogtreecommitdiff
path: root/libraries/Bridge
diff options
context:
space:
mode:
authorCristian Maglie <c.maglie@bug.st>2013-06-12 13:20:25 +0200
committerCristian Maglie <c.maglie@bug.st>2013-06-12 13:20:25 +0200
commit8674a1b9e9da542b729d660d8f996f0e58008dbd (patch)
tree7c30a0d84394d927dbf92be5c46197e263633b82 /libraries/Bridge
parent8b6a72f3b56dec9441ba1a1b151dc58a05dafa57 (diff)
Refactored String methods and constructor on Process class.
Diffstat (limited to 'libraries/Bridge')
-rw-r--r--libraries/Bridge/Process.cpp14
-rw-r--r--libraries/Bridge/Process.h11
2 files changed, 6 insertions, 19 deletions
diff --git a/libraries/Bridge/Process.cpp b/libraries/Bridge/Process.cpp
index 6b86d54..78f168f 100644
--- a/libraries/Bridge/Process.cpp
+++ b/libraries/Bridge/Process.cpp
@@ -66,22 +66,12 @@ void Process::doBuffer() {
buffered = bridge.transfer(cmd, 3, buffer, sizeof(buffer));
}
-void Process::begin(String &command) {
+void Process::begin(const String &command) {
close();
cmdline = new String(command);
}
-void Process::begin(const char *command) {
- close();
- cmdline = new String(command);
-}
-
-void Process::addParameter(const char *param) {
- *cmdline += "\xFE";
- *cmdline += param;
-}
-
-void Process::addParameter(String &param) {
+void Process::addParameter(const String &param) {
*cmdline += "\xFE";
*cmdline += param;
}
diff --git a/libraries/Bridge/Process.h b/libraries/Bridge/Process.h
index 2877545..cf950d4 100644
--- a/libraries/Bridge/Process.h
+++ b/libraries/Bridge/Process.h
@@ -23,16 +23,13 @@
class Process : public Stream {
public:
- // Default constructor uses global Bridge instance
- Process() : bridge(Bridge), started(false), buffered(0), readPos(0) { }
// Constructor with a user provided BridgeClass instance
- Process(BridgeClass &_b) : bridge(_b), started(false), buffered(0), readPos(0) { }
+ Process(BridgeClass &_b = Bridge) :
+ bridge(_b), started(false), buffered(0), readPos(0) { }
~Process();
- void begin(String &command);
- void begin(const char *command);
- void addParameter(String &param);
- void addParameter(const char *param);
+ void begin(const String &command);
+ void addParameter(const String &param);
unsigned int run();
void runAsynchronously();
boolean running();