diff options
author | Cristian Maglie <c.maglie@bug.st> | 2013-06-12 12:42:38 +0200 |
---|---|---|
committer | Cristian Maglie <c.maglie@bug.st> | 2013-06-12 12:42:38 +0200 |
commit | 965d2cbf7302c504fef01ab8951407bc1a40b430 (patch) | |
tree | b24a1fdbf0e2b518625a63f6ed6b7aed99a33891 /libraries/Bridge/Bridge.cpp | |
parent | 9e59262f643f1726738888b2945d3d63c1939d58 (diff) |
Factored Process class
Diffstat (limited to 'libraries/Bridge/Bridge.cpp')
-rw-r--r-- | libraries/Bridge/Bridge.cpp | 48 |
1 files changed, 0 insertions, 48 deletions
diff --git a/libraries/Bridge/Bridge.cpp b/libraries/Bridge/Bridge.cpp index 6f3e987..5802156 100644 --- a/libraries/Bridge/Bridge.cpp +++ b/libraries/Bridge/Bridge.cpp @@ -58,54 +58,6 @@ void BridgeClass::begin() { while (true); } -uint8_t BridgeClass::runCommand(String &command, uint8_t &err) { - uint8_t cmd[] = {'R'}; - uint8_t res[2]; - transfer(cmd, 1, (uint8_t*)command.c_str(), command.length(), res, 2); - err = res[0]; - return res[1]; -} - -bool BridgeClass::commandIsRunning(uint8_t handle) { - uint8_t cmd[] = {'r', handle}; - uint8_t res[1]; - transfer(cmd, 2, res, 1); - return (res[0] == 1); -} - -unsigned int BridgeClass::commandExitValue(uint8_t handle) { - uint8_t cmd[] = {'W', handle}; - uint8_t res[2]; - transfer(cmd, 2, res, 2); - return (res[0] << 8) + res[1]; -} - -void BridgeClass::cleanCommand(uint8_t handle) { - uint8_t cmd[] = {'w', handle}; - transfer(cmd, 2); -} - -unsigned int BridgeClass::commandOutputAvailable(uint8_t handle) { - uint8_t cmd[] = {'o', handle}; - uint8_t res[1]; - transfer(cmd, 2, res, 1); - return res[0]; -} - -unsigned int BridgeClass::readCommandOutput(uint8_t handle, - uint8_t *buffer, unsigned int size) { - if (size > 255) - size = 255; - uint8_t cmd[] = {'O', handle, size}; - return transfer(cmd, 3, buffer, size); -} - -void BridgeClass::writeCommandInput(uint8_t handle, - const uint8_t *buff, unsigned int size) { - uint8_t cmd[] = {'I', handle}; - transfer(cmd, 2, buff, size, NULL, 0); -} - unsigned int BridgeClass::readMessage(uint8_t *buff, unsigned int size) { uint8_t tmp[] = { 'm' }; return transfer(tmp, 1, buff, size); |