diff options
author | Cristian Maglie <c.maglie@bug.st> | 2013-06-10 11:23:14 +0200 |
---|---|---|
committer | Cristian Maglie <c.maglie@bug.st> | 2013-06-10 11:24:32 +0200 |
commit | 5cb9a004bc81aae296ca9a9447ff6faf803dea39 (patch) | |
tree | 0dc6a0d10b86af46321a3cde52688ffc2b2d07ca /libraries/Bridge/Bridge.h | |
parent | 9a0621aad7382d0d51dffd49a41110050f611a57 (diff) |
Fixed return type for Bridge.transfer(). Refactored File I/O class.
Diffstat (limited to 'libraries/Bridge/Bridge.h')
-rw-r--r-- | libraries/Bridge/Bridge.h | 28 |
1 files changed, 7 insertions, 21 deletions
diff --git a/libraries/Bridge/Bridge.h b/libraries/Bridge/Bridge.h index 6e54bbd..0c86175 100644 --- a/libraries/Bridge/Bridge.h +++ b/libraries/Bridge/Bridge.h @@ -42,20 +42,6 @@ public: void writeCommandInput(uint8_t handle, const char *buff, unsigned int size) { writeCommandInput(handle, reinterpret_cast<const uint8_t *>(buff), size); } - // Methods to handle files - uint8_t fileOpen(String &file, uint8_t mode, uint8_t &err); - void fileClose(uint8_t handle); - - unsigned int fileRead(uint8_t handle, uint8_t *buff, unsigned int size, uint8_t &err); - unsigned int fileRead(uint8_t handle, char *buff, unsigned int size, uint8_t &err) - { return fileRead(handle, reinterpret_cast<uint8_t *>(buff), size, err); } - - void fileWrite(uint8_t handle, const uint8_t *buff, unsigned int size, uint8_t &err); - void fileWrite(uint8_t handle, const char *buff, unsigned int size, uint8_t &err) - { fileWrite(handle, reinterpret_cast<const uint8_t *>(buff), size, err); } - - void fileSeek(uint8_t handle, uint32_t position, uint8_t &err); - // Methods to handle mailbox messages unsigned int readMessage(uint8_t *buffer, unsigned int size); void writeMessage(const uint8_t *buffer, unsigned int size); @@ -79,20 +65,20 @@ public: void flush() { stream.flush(); } // Trasnfer a frame (with error correction and response) - uint8_t transfer(const uint8_t *buff1, uint16_t len1, + uint16_t transfer(const uint8_t *buff1, uint16_t len1, const uint8_t *buff2, uint16_t len2, const uint8_t *buff3, uint16_t len3, uint8_t *rxbuff, uint16_t rxlen); // multiple inline versions of the same function to allow efficient frame concatenation - uint8_t transfer(const uint8_t *buff1, uint16_t len1) - { transfer(buff1, len1, NULL, 0); } - uint8_t transfer(const uint8_t *buff1, uint16_t len1, + uint16_t transfer(const uint8_t *buff1, uint16_t len1) + { return transfer(buff1, len1, NULL, 0); } + uint16_t transfer(const uint8_t *buff1, uint16_t len1, uint8_t *rxbuff, uint16_t rxlen) - { transfer(buff1, len1, NULL, 0, rxbuff, rxlen); } - uint8_t transfer(const uint8_t *buff1, uint16_t len1, + { return transfer(buff1, len1, NULL, 0, rxbuff, rxlen); } + uint16_t transfer(const uint8_t *buff1, uint16_t len1, const uint8_t *buff2, uint16_t len2, uint8_t *rxbuff, uint16_t rxlen) - { transfer(buff1, len1, buff2, len2, NULL, 0, rxbuff, rxlen); } + { return transfer(buff1, len1, buff2, len2, NULL, 0, rxbuff, rxlen); } private: uint8_t index; int timedRead(unsigned int timeout); |