OpenZWave Library: OpenZWave::Stream Class Reference

| OpenZWave Library 1.6.0

Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Friends | List of all members
OpenZWave::Stream Class Reference
Platform Abstraction Support

Platform-independent definition of a circular buffer. More...

`#include <Stream.h>`

Inheritance diagram for OpenZWave::Stream:

## Public Member Functions
| Stream (uint32 _bufferSize)
void | SetSignalThreshold (uint32 _size)
bool | Get (uint8 *_buffer, uint32 _size)
bool | Put (uint8 *_buffer, uint32 _size)
uint32 | GetDataSize () const
void | Purge ()
Public Member Functions inherited from OpenZWave::Wait
void | AddWatcher (pfnWaitNotification_t _callback, void *_context)
void | RemoveWatcher (pfnWaitNotification_t _callback, void *_context)
Public Member Functions inherited from OpenZWave::Ref
| Ref ()
void | AddRef ()
int32 | Release ()

## Protected Member Functions
void | LogData (uint8 *_buffer, uint32 _size, const string &_function)
virtual bool | IsSignalled ()
| ~Stream ()
Protected Member Functions inherited from OpenZWave::Wait
| Wait ()
virtual | ~Wait ()
void | Notify ()
virtual bool | IsSignalled ()=0
Protected Member Functions inherited from OpenZWave::Ref
virtual | ~Ref ()

## Friends
class | Wait

## Additional Inherited Members
Public Types inherited from OpenZWave::Wait
enum | { Timeout_Immediate = 0 , Timeout_Infinite = -1 }
typedef void(* | pfnWaitNotification_t) (void *_context)
Static Public Member Functions inherited from OpenZWave::Wait
static int32 | Single (Wait *_object, int32 _timeout=-1)
static int32 | Multiple (Wait **_objects, uint32 _numObjects, int32 _timeout=-1)

## Detailed Description

Platform-independent definition of a circular buffer.

## Constructor & Destructor Documentation

## ◆ Stream()

Stream::Stream | ( | uint32 | _bufferSize | ) |

Constructor. Creates a cross-platform ring buffer object

## ◆ ~Stream()

Stream::~Stream | ( |  | ) |
| protected

Destructor. Destroys the ring buffer object.

## Member Function Documentation

## ◆ Get()

bool Stream::Get | ( | uint8 * | _buffer,
|  | uint32 | _size
| ) |  |

Copies the requested amount of data from the stream, removing it from the stream as it does so. If there is insufficient data available, the method returns false, and no data is transferred.

Parameters

  _buffer | pointer to a block of memory that will be filled with the stream data.
  _size | the amount of data in bytes to copy from the stream.

Returns
  true if all the requested data has been copied. False if there was not enough data in the stream.

See also
  GetDataSize, Put

## ◆ GetDataSize()

uint32 OpenZWave::Stream::GetDataSize | ( |  | ) | const
| inline

Returns the amount of data in bytes that is stored in the stream.

Returns
  the number of bytes of data in the stream.

See also
  Get, GetDataSize

## ◆ IsSignalled()

bool Stream::IsSignalled | ( |  | ) |
| protectedvirtual

Used by the Wait class to test whether the buffer contains sufficient data.

Implements OpenZWave::Wait.

## ◆ LogData()

void Stream::LogData | ( | uint8 * | _buffer,
|  | uint32 | _size,
|  | const string & | _function
| ) |  |
| protected

Formats stream buffer data for output to the log.

Parameters

  _buffer | pointer to the stream buffer "head" location
  _size | number of valid bytes currently in the buffer
  _function | string containing text to display before the data

## ◆ Purge()

void Stream::Purge | ( |  | ) |

Empties the stream bytes held in the buffer.
This is called when the library gets out of sync with the controller and sends a "NAK" to the controller.

## ◆ Put()

bool Stream::Put | ( | uint8 * | _buffer,
|  | uint32 | _size
| ) |  |

Copies the requested amount of data from the buffer into the stream. If there is insufficient room available in the stream's circular buffer, and no data is transferred.

Parameters

  _buffer | pointer to a block of memory that will be copied into the stream.
  _size | the amount of data in bytes to copy to the stream.

Returns
  true if all the requested data has been copied. False if there was not enough space in the stream's circular buffer.

See also
  Get, GetDataSize

## ◆ SetSignalThreshold()

void Stream::SetSignalThreshold | ( | uint32 | _size | ) |

Set the number of bytes the buffer must contain before it becomes signalled. Once the threshold is set, the application can use Wait::Single or Wait::Multiple to wait until the buffer has been filled with the desired amount of data.

Parameters

  _size | the amount of data in bytes that the buffer must contain for it to become signalled.

See also
  Wait::Single, Wait::Multiple

## Friends And Related Symbol Documentation

## ◆ Wait

friend class Wait
| friend

The documentation for this class was generated from the following files:

- Stream.h
- Stream.cpp