Bridge: now processes start can be checked for errors
This commit is contained in:
parent
1dd2906435
commit
da2b2264b3
|
@ -55,11 +55,12 @@ void BridgeClass::begin() {
|
||||||
transfer(cmd, 2);
|
transfer(cmd, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t BridgeClass::runCommand(String &command) {
|
uint8_t BridgeClass::runCommand(String &command, uint8_t &err) {
|
||||||
uint8_t cmd[] = {'R'};
|
uint8_t cmd[] = {'R'};
|
||||||
uint8_t res[1];
|
uint8_t res[2];
|
||||||
transfer(cmd, 1, (uint8_t*)command.c_str(), command.length(), res, 1);
|
transfer(cmd, 1, (uint8_t*)command.c_str(), command.length(), res, 2);
|
||||||
return res[0];
|
err = res[0];
|
||||||
|
return res[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BridgeClass::commandIsRunning(uint8_t handle) {
|
bool BridgeClass::commandIsRunning(uint8_t handle) {
|
||||||
|
|
|
@ -28,7 +28,7 @@ public:
|
||||||
void begin();
|
void begin();
|
||||||
|
|
||||||
// Methods to handle processes on the linux side
|
// Methods to handle processes on the linux side
|
||||||
uint8_t runCommand(String &command);
|
uint8_t runCommand(String &command, uint8_t &err);
|
||||||
bool commandIsRunning(uint8_t handle);
|
bool commandIsRunning(uint8_t handle);
|
||||||
unsigned int commandExitValue(uint8_t handle);
|
unsigned int commandExitValue(uint8_t handle);
|
||||||
void cleanCommand(uint8_t handle);
|
void cleanCommand(uint8_t handle);
|
||||||
|
|
|
@ -85,10 +85,12 @@ void Process::addParameter(String ¶m) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Process::runAsynchronously() {
|
void Process::runAsynchronously() {
|
||||||
handle = bridge.runCommand(*cmdline);
|
uint8_t err;
|
||||||
|
handle = bridge.runCommand(*cmdline, err);
|
||||||
delete cmdline;
|
delete cmdline;
|
||||||
cmdline = NULL;
|
cmdline = NULL;
|
||||||
|
|
||||||
|
if (err==0)
|
||||||
started = true;
|
started = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,6 +39,8 @@ public:
|
||||||
unsigned int exitValue();
|
unsigned int exitValue();
|
||||||
void close();
|
void close();
|
||||||
|
|
||||||
|
operator bool () { return started; }
|
||||||
|
|
||||||
// Stream methods
|
// Stream methods
|
||||||
// (read from process stdout)
|
// (read from process stdout)
|
||||||
int available();
|
int available();
|
||||||
|
|
Loading…
Reference in New Issue