Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: PacketBuffer.h
- Revision:
- 0:0e4cbd5ddf25
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/PacketBuffer.h Wed Aug 17 10:51:55 2011 +0000
@@ -0,0 +1,49 @@
+
+
+/** @file PacketBuffer.h
+ * @brief Packet Buffer
+ */
+
+#ifndef PacketBuffer_H
+#define PacketBuffer_H
+
+#include "mbed.h"
+
+typedef struct
+{
+ char *buf;
+ int size;
+} PacketBufInf;
+
+class PacketBuffer {
+public:
+ /** init Stack class
+ * @param num buffering packet num
+ * @param packet_size size of packet(max size)
+ */
+ PacketBuffer(int num,int packet_size);
+ ~PacketBuffer();
+
+ /** put to Packet buffer
+ * @param packet packet data
+ * @param len packet length
+ * @return put length
+ */
+ int PutPacket(char *packet, int len);
+
+ /** get from ring buffer
+ * @param packet packet data
+ * @return get length
+ */
+ int GetPacket(char *packet);
+
+ void clear();
+ int available();
+ int use();
+
+private:
+ PacketBufInf *p_buf;
+ int max_num,max_size;
+ int addr_w, addr_r;
+};
+#endif
\ No newline at end of file