Refactored String methods and constructor on Process class.
This commit is contained in:
parent
8b6a72f3b5
commit
8674a1b9e9
|
@ -66,22 +66,12 @@ void Process::doBuffer() {
|
||||||
buffered = bridge.transfer(cmd, 3, buffer, sizeof(buffer));
|
buffered = bridge.transfer(cmd, 3, buffer, sizeof(buffer));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Process::begin(String &command) {
|
void Process::begin(const String &command) {
|
||||||
close();
|
close();
|
||||||
cmdline = new String(command);
|
cmdline = new String(command);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Process::begin(const char *command) {
|
void Process::addParameter(const String ¶m) {
|
||||||
close();
|
|
||||||
cmdline = new String(command);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Process::addParameter(const char *param) {
|
|
||||||
*cmdline += "\xFE";
|
|
||||||
*cmdline += param;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Process::addParameter(String ¶m) {
|
|
||||||
*cmdline += "\xFE";
|
*cmdline += "\xFE";
|
||||||
*cmdline += param;
|
*cmdline += param;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,16 +23,13 @@
|
||||||
|
|
||||||
class Process : public Stream {
|
class Process : public Stream {
|
||||||
public:
|
public:
|
||||||
// Default constructor uses global Bridge instance
|
|
||||||
Process() : bridge(Bridge), started(false), buffered(0), readPos(0) { }
|
|
||||||
// Constructor with a user provided BridgeClass instance
|
// 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();
|
~Process();
|
||||||
|
|
||||||
void begin(String &command);
|
void begin(const String &command);
|
||||||
void begin(const char *command);
|
void addParameter(const String ¶m);
|
||||||
void addParameter(String ¶m);
|
|
||||||
void addParameter(const char *param);
|
|
||||||
unsigned int run();
|
unsigned int run();
|
||||||
void runAsynchronously();
|
void runAsynchronously();
|
||||||
boolean running();
|
boolean running();
|
||||||
|
|
Loading…
Reference in New Issue