John Bailey / XBeeApi

Dependencies:   CircularBuffer FixedLengthList

Dependents:   XBeeApiTest XBeeApiSimpleATCmdsExample XBeeApiBroadcastExample XBeeApiBroadcastExampleRTOS ... more

Committer:
johnb
Date:
Sun Jul 06 21:47:31 2014 +0000
Revision:
45:dde04adb8791
Child:
46:a1abbc66f157
Re-add changes which where committed in http://mbed.org/users/johnb/code/XBeeApi/rev/291aee9eb900 - unsure as to why they don't still seem to be present.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
johnb 45:dde04adb8791 1 /**
johnb 45:dde04adb8791 2 @file
johnb 45:dde04adb8791 3 @brief Class to decode and store received data frames in a circular
johnb 45:dde04adb8791 4 buffer
johnb 45:dde04adb8791 5
johnb 45:dde04adb8791 6 @author John Bailey
johnb 45:dde04adb8791 7
johnb 45:dde04adb8791 8 @copyright Copyright 2014 John Bailey
johnb 45:dde04adb8791 9
johnb 45:dde04adb8791 10 @section LICENSE
johnb 45:dde04adb8791 11
johnb 45:dde04adb8791 12 Licensed under the Apache License, Version 2.0 (the "License");
johnb 45:dde04adb8791 13 you may not use this file except in compliance with the License.
johnb 45:dde04adb8791 14 You may obtain a copy of the License at
johnb 45:dde04adb8791 15
johnb 45:dde04adb8791 16 http://www.apache.org/licenses/LICENSE-2.0
johnb 45:dde04adb8791 17
johnb 45:dde04adb8791 18 Unless required by applicable law or agreed to in writing, software
johnb 45:dde04adb8791 19 distributed under the License is distributed on an "AS IS" BASIS,
johnb 45:dde04adb8791 20 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
johnb 45:dde04adb8791 21 See the License for the specific language governing permissions and
johnb 45:dde04adb8791 22 limitations under the License.
johnb 45:dde04adb8791 23
johnb 45:dde04adb8791 24 */
johnb 45:dde04adb8791 25
johnb 45:dde04adb8791 26 #if !defined XBEEAPIRXFRAMECIRCULARBUFFER_HPP
johnb 45:dde04adb8791 27 #define XBEEAPIRXFRAMECIRCULARBUFFER_HPP
johnb 45:dde04adb8791 28
johnb 45:dde04adb8791 29 #include "XBeeApiRxFrameDecoder.hpp"
johnb 45:dde04adb8791 30 #include "XBeeDevice.hpp"
johnb 45:dde04adb8791 31
johnb 45:dde04adb8791 32 #include <stdint.h>
johnb 45:dde04adb8791 33
johnb 45:dde04adb8791 34 /** Class to deal with decoding of an RX'd data frame
johnb 45:dde04adb8791 35 */
johnb 45:dde04adb8791 36 class XBeeApiRxFrameCircularBuffer : public XBeeApiRxFrameDecoder
johnb 45:dde04adb8791 37 {
johnb 45:dde04adb8791 38 protected:
johnb 45:dde04adb8791 39 size_t m_bufferSize;
johnb 45:dde04adb8791 40 size_t m_head;
johnb 45:dde04adb8791 41 size_t m_tail;
johnb 45:dde04adb8791 42 size_t m_count;
johnb 45:dde04adb8791 43 XBeeApiRxFrame* m_framesBuffer;
johnb 45:dde04adb8791 44 public:
johnb 45:dde04adb8791 45 /** Constructor */
johnb 45:dde04adb8791 46 XBeeApiRxFrameCircularBuffer( size_t p_bufferSize, XBeeDevice* p_device = NULL );
johnb 45:dde04adb8791 47
johnb 45:dde04adb8791 48 /** Destructor */
johnb 45:dde04adb8791 49 virtual ~XBeeApiRxFrameCircularBuffer( void );
johnb 45:dde04adb8791 50
johnb 45:dde04adb8791 51 /* Callback which is invoked when a frame is successfully decoded
johnb 45:dde04adb8791 52 \param p_frame The frame content
johnb 45:dde04adb8791 53 */
johnb 45:dde04adb8791 54 virtual void frameRxCallback( XBeeApiRxFrame* const p_frame );
johnb 45:dde04adb8791 55
johnb 45:dde04adb8791 56 size_t getFrameCount() const;
johnb 45:dde04adb8791 57
johnb 45:dde04adb8791 58 void clear();
johnb 45:dde04adb8791 59
johnb 45:dde04adb8791 60 void pop();
johnb 45:dde04adb8791 61
johnb 45:dde04adb8791 62 const XBeeApiRxFrame* getTailPtr() const;
johnb 45:dde04adb8791 63 };
johnb 45:dde04adb8791 64
johnb 45:dde04adb8791 65 #endif