Christian Burri / Mbed 2 deprecated autonomous Robot Android

Dependencies:   mbed

Fork of autonomous Robot Android by Christian Burri

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers PacketBuffer.h Source File

PacketBuffer.h

Go to the documentation of this file.
00001 
00002 
00003 /** @file PacketBuffer.h
00004  * @brief Packet Buffer
00005  */
00006 
00007 #ifndef PacketBuffer_H
00008 #define PacketBuffer_H
00009 
00010 #include "mbed.h"
00011 
00012 typedef struct
00013 {
00014     char *buf;
00015     int size;
00016 } PacketBufInf;
00017 
00018 class PacketBuffer {
00019 public:
00020     /** init Stack class
00021      * @param num  buffering packet num
00022      * @param packet_size size of packet(max size)
00023      */
00024     PacketBuffer(int num,int packet_size);
00025     ~PacketBuffer();
00026 
00027     /** put to Packet buffer
00028      * @param packet packet data
00029      * @param len packet length
00030      * @return put length
00031      */
00032     int PutPacket(char *packet, int len);
00033 
00034     /** get from ring buffer
00035      * @param packet packet data
00036      * @return get length
00037      */
00038     int GetPacket(char *packet);
00039 
00040     void clear();
00041     int available();
00042     int use();
00043 
00044 private:
00045     PacketBufInf *p_buf;
00046     int max_num,max_size;
00047     int addr_w, addr_r;
00048 };
00049 #endif