aboutsummaryrefslogtreecommitdiffstats
path: root/os/various/cpp_wrappers
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2013-01-03 10:21:42 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2013-01-03 10:21:42 +0000
commitd86e97b242b4fc9dd616eeecf38f421dab7ac214 (patch)
treef3252fb7a264c363ed5baaab6ad04c49ecf51de8 /os/various/cpp_wrappers
parent865722b1be24a2672ba271d78bd4a11b20edb84a (diff)
downloadChibiOS-d86e97b242b4fc9dd616eeecf38f421dab7ac214.tar.gz
ChibiOS-d86e97b242b4fc9dd616eeecf38f421dab7ac214.tar.bz2
ChibiOS-d86e97b242b4fc9dd616eeecf38f421dab7ac214.zip
Added support for BaseSequentialStream to the C++ wrapper.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@5022 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/various/cpp_wrappers')
-rw-r--r--os/various/cpp_wrappers/ch.hpp66
1 files changed, 66 insertions, 0 deletions
diff --git a/os/various/cpp_wrappers/ch.hpp b/os/various/cpp_wrappers/ch.hpp
index 4f9f20020..25649c05d 100644
--- a/os/various/cpp_wrappers/ch.hpp
+++ b/os/various/cpp_wrappers/ch.hpp
@@ -2083,6 +2083,72 @@ namespace chibios_rt {
}
};
#endif /* CH_USE_MEMPOOLS */
+
+ /*------------------------------------------------------------------------*
+ * chibios_rt::BaseSequentialStreamInterface *
+ *------------------------------------------------------------------------*/
+ /**
+ * @brief Interface of a ::BaseSequentialStream.
+ * @note You can cast a ::BaseSequentialStream to this interface and use
+ * it, the memory layout is the same.
+ */
+ class BaseSequentialStreamInterface {
+ public:
+ /**
+ * @brief Sequential Stream write.
+ * @details The function writes data from a buffer to a stream.
+ *
+ * @param[in] bp pointer to the data buffer
+ * @param[in] n the maximum amount of data to be transferred
+ * @return The number of bytes transferred. The return value can
+ * be less than the specified number of bytes if an
+ * end-of-file condition has been met.
+ *
+ * @api
+ */
+ size_t write(const uint8_t *bp, size_t n) = 0;
+
+ /**
+ * @brief Sequential Stream read.
+ * @details The function reads data from a stream into a buffer.
+ *
+ * @param[out] bp pointer to the data buffer
+ * @param[in] n the maximum amount of data to be transferred
+ * @return The number of bytes transferred. The return value can
+ * be less than the specified number of bytes if an
+ * end-of-file condition has been met.
+ *
+ * @api
+ */
+ size_t read(uint8_t *bp, size_t n) = 0;
+
+ /**
+ * @brief Sequential Stream blocking byte write.
+ * @details This function writes a byte value to a channel. If the channel
+ * is not ready to accept data then the calling thread is suspended.
+ *
+ * @param[in] b the byte value to be written to the channel
+ *
+ * @return The operation status.
+ * @retval Q_OK if the operation succeeded.
+ * @retval Q_RESET if an end-of-file condition has been met.
+ *
+ * @api
+ */
+ msg_t put(uint8_t b) = 0;
+
+ /**
+ * @brief Sequential Stream blocking byte read.
+ * @details This function reads a byte value from a channel. If the data
+ * is not available then the calling thread is suspended.
+ *
+ * @return A byte value from the queue.
+ * @retval Q_RESET if an end-of-file condition has been met.
+ *
+ * @api
+ */
+ msg_t get(void) = 0;
+ };
}
#endif /* _CH_HPP_ */