![]() |
![]() |
OpenThread
1.05.03.02
|
#include <hdlc.hpp>
Public Member Functions | |
void | Clear (void) |
void | ClearSavedFrames (void) |
void | DiscardFrame (void) |
uint8_t * | GetFrame (void) const |
uint16_t | GetFrameMaxLength (void) const |
uint16_t | GetLength (void) const |
otError | GetNextSavedFrame (uint8_t *&aFrame, uint16_t &aLength) |
uint16_t | GetSkipLength (void) const |
bool | HasFrame (void) const |
bool | HasSavedFrame (void) const |
MultiFrameBuffer (void) | |
void | SaveFrame (void) |
otError | SetLength (uint16_t aLength) |
otError | SetSkipLength (uint16_t aSkipLength) |
![]() | |
bool | CanWrite (uint16_t aWriteLength) const |
void | UndoLastWrites (uint16_t aUndoLength) |
otError | WriteByte (uint8_t aByte) |
Private Types | |
enum | { kHeaderTotalLengthOffset = 0, kHeaderSkipLengthOffset = sizeof(uint16_t), kHeaderSize = sizeof(uint16_t) + sizeof(uint16_t) } |
Private Attributes | |
uint8_t | mBuffer [kSize] |
uint8_t * | mWriteFrameStart |
Additional Inherited Members | |
![]() | |
FrameWritePointer (void) | |
![]() | |
uint16_t | mRemainingLength |
Number of remaining bytes available to write. More... | |
uint8_t * | mWritePointer |
A pointer to current write position in the buffer. More... | |
This class defines a template frame buffer of a given size for storing multiple frames.
The template parameter kSize
specifies the total size of the buffer.
Unlike FrameBuffer
class where a single frame can be stored, this class is capable of saving multiple frames in a FIFO queue format.
|
inline |
This constructor initializes the MultiFrameBuffer
object.
|
inline |
This method clears the buffer, removing current frame and all previously saved frames.
It moves the write pointer to the beginning of the buffer.
Referenced by RadioSpinel< InterfaceType, ProcessContextType >::RecoverFromRcpFailure().
|
inline |
This method indicates whether the current frame (being written) is empty or not.
TRUE | Current frame is empty. |
FALSE | Current frame is not empty. |
|
inline |
This method sets the length (number of bytes) of the current frame being written.
param[in] aLength The length of current frame.
OT_ERROR_NONE | Successfully set the length of the current frame. |
OT_ERROR_NO_BUFS | Insufficient buffer space to hold a frame of length aLength . |
|
inline |
This method gets the length (number of bytes) in the current frame being written into the buffer.
Referenced by RadioSpinel< InterfaceType, ProcessContextType >::HandleNotification(), and RadioSpinel< InterfaceType, ProcessContextType >::HandleReceivedFrame().
|
inline |
This method sets the length (number of bytes) of reserved buffer in front of the current frame being written.
param[in] aSkipLength The length of reserved buffer.
OT_ERROR_NONE | Successfully set the length of reserved buffer. |
OT_ERROR_NO_BUFS | Insufficient buffer space to hold a reserved buffer of length aLength . |
|
inline |
This method gets the length (number of bytes) of reserved buffer in front of the current frame being written.
|
inline |
This method gets a pointer to the start of the current frame.
Referenced by RadioSpinel< InterfaceType, ProcessContextType >::HandleNotification(), and RadioSpinel< InterfaceType, ProcessContextType >::HandleReceivedFrame().
|
inline |
This method gets the maximum length of the current frame.
|
inline |
This method saves the current frame and prepares the write pointer for a next frame to be written into the buffer.
Saved frame can be retrieved later using GetNextSavedFrame()
.
Referenced by RadioSpinel< InterfaceType, ProcessContextType >::HandleNotification().
|
inline |
This method discards the current frame and prepares the write pointer for a next frame to be written into the buffer.
Referenced by RadioSpinel< InterfaceType, ProcessContextType >::HandleNotification(), and RadioSpinel< InterfaceType, ProcessContextType >::HandleReceivedFrame().
|
inline |
This method indicates whether there are any saved frames in the buffer.
TRUE | There is at least one saved frame in the buffer. |
FALSE | There is no saved frame in the buffer. |
Referenced by RadioSpinel< InterfaceType, ProcessContextType >::HasPendingFrame(), and RadioSpinel< InterfaceType, ProcessContextType >::Process().
|
inline |
This method iterates through previously saved frames in the buffer, getting a next frame in the queue.
[in,out] | aFrame | On entry, should point to a previous saved frame or nullptr to get the first frame. On exit, the pointer variable is updated to next frame or set to nullptr if there are none. |
[in,out] | aLength | On entry, should be a reference to the frame length of the previous saved frame. On exit, the reference is updated to the frame length (number of bytes) of next frame. |
OT_ERROR_NONE | Updated and successfully with the next saved frame. |
OT_ERROR_NOT_FOUND | No more saved frame in the buffer. |
Referenced by RadioSpinel< InterfaceType, ProcessContextType >::ProcessFrameQueue().
|
inline |
This method clears all saved frames from the buffer and adjusts all the pointers.
GetFrame()
or GetNextSavedFrame()
) should be considered invalid after calling this method. Referenced by RadioSpinel< InterfaceType, ProcessContextType >::ProcessFrameQueue().
|
private |
|
private |