Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Static Private Member Functions | Private Attributes
SickToolbox::SickBufferMonitor< SICK_MONITOR_CLASS, SICK_MSG_CLASS > Class Template Reference

#include <SickBufferMonitor.hh>

List of all members.

Public Member Functions

void AcquireDataStream () throw ( SickThreadException )
 Acquires a lock on the data stream.
void GetNextMessageFromDataStream (SICK_MSG_CLASS &sick_message)
bool GetNextMessageFromMonitor (SICK_MSG_CLASS &sick_message) throw ( SickThreadException )
 Checks the message container for the next available Sick message.
void ReleaseDataStream () throw ( SickThreadException )
 Releases a lock on the data stream.
void SetDataStream (const unsigned int sick_fd) throw ( SickThreadException )
 A method for setting/changing the current data stream.
 SickBufferMonitor (SICK_MONITOR_CLASS *const monitor_instance) throw ( SickThreadException )
 Primary constructor.
void StartMonitor (const unsigned int sick_fd) throw ( SickThreadException )
 Creates and starts the buffer monitor thread.
void StopMonitor () throw ( SickThreadException )
 Cancels the buffer monitor thread.
 ~SickBufferMonitor () throw ( SickThreadException )
 The destructor (kills the mutex)

Protected Member Functions

void _readBytes (uint8_t *const dest_buffer, const int num_bytes_to_read, const unsigned int timeout_value=0) const throw ( SickTimeoutException, SickIOException )
 Attempt to read a certain number of bytes from the stream.

Protected Attributes

unsigned int _sick_fd

Private Member Functions

void _acquireMessageContainer () throw ( SickThreadException )
 Locks access to the message container.
void _releaseMessageContainer () throw ( SickThreadException )
 Unlocks access to the message container.

Static Private Member Functions

static void * _bufferMonitorThread (void *thread_args)
 The monitor thread.

Private Attributes

pthread_mutex_t _container_mutex
bool _continue_grabbing
pthread_t _monitor_thread_id
SICK_MSG_CLASS _recv_msg_container
SICK_MONITOR_CLASS * _sick_monitor_instance
pthread_mutex_t _stream_mutex

Detailed Description

template<class SICK_MONITOR_CLASS, class SICK_MSG_CLASS>
class SickToolbox::SickBufferMonitor< SICK_MONITOR_CLASS, SICK_MSG_CLASS >

Definition at line 32 of file SickBufferMonitor.hh.


Constructor & Destructor Documentation

template<class SICK_MONITOR_CLASS, class SICK_MSG_CLASS >
SickToolbox::SickBufferMonitor< SICK_MONITOR_CLASS, SICK_MSG_CLASS >::SickBufferMonitor ( SICK_MONITOR_CLASS *const  monitor_instance) throw ( SickThreadException )

Primary constructor.

A standard constructor

Parameters:
device_instanceA pointer to the current driver instance

Definition at line 107 of file SickBufferMonitor.hh.

template<class SICK_MONITOR_CLASS , class SICK_MSG_CLASS >
SickToolbox::SickBufferMonitor< SICK_MONITOR_CLASS, SICK_MSG_CLASS >::~SickBufferMonitor ( ) throw ( SickThreadException )

The destructor (kills the mutex)

A standard destructor

Definition at line 289 of file SickBufferMonitor.hh.


Member Function Documentation

template<class SICK_MONITOR_CLASS , class SICK_MSG_CLASS >
void SickToolbox::SickBufferMonitor< SICK_MONITOR_CLASS, SICK_MSG_CLASS >::_acquireMessageContainer ( ) throw ( SickThreadException ) [private]

Locks access to the message container.

Locks access to the message container

Definition at line 307 of file SickBufferMonitor.hh.

template<class SICK_MONITOR_CLASS , class SICK_MSG_CLASS >
void * SickToolbox::SickBufferMonitor< SICK_MONITOR_CLASS, SICK_MSG_CLASS >::_bufferMonitorThread ( void *  thread_args) [static, private]

The monitor thread.

Entry point for the monitor thread

Parameters:
*argsThe thread arguments

Definition at line 410 of file SickBufferMonitor.hh.

template<class SICK_MONITOR_CLASS , class SICK_MSG_CLASS >
void SickToolbox::SickBufferMonitor< SICK_MONITOR_CLASS, SICK_MSG_CLASS >::_readBytes ( uint8_t *const  dest_buffer,
const int  num_bytes_to_read,
const unsigned int  timeout_value = 0 
) const throw ( SickTimeoutException, SickIOException ) [protected]

Attempt to read a certain number of bytes from the stream.

Reads n bytes into the destination buffer

Parameters:
*dest_bufferA pointer to the destination buffer
num_bytes_to_readThe number of bytes to read into the buffer
timeout_valueThe number of microseconds allowed between subsequent bytes in a message
Returns:
True if the number of requested bytes were successfully read

Definition at line 337 of file SickBufferMonitor.hh.

template<class SICK_MONITOR_CLASS , class SICK_MSG_CLASS >
void SickToolbox::SickBufferMonitor< SICK_MONITOR_CLASS, SICK_MSG_CLASS >::_releaseMessageContainer ( ) throw ( SickThreadException ) [private]

Unlocks access to the message container.

Unlocks access to the message container

Definition at line 320 of file SickBufferMonitor.hh.

template<class SICK_MONITOR_CLASS , class SICK_MSG_CLASS >
void SickToolbox::SickBufferMonitor< SICK_MONITOR_CLASS, SICK_MSG_CLASS >::AcquireDataStream ( ) throw ( SickThreadException )

Acquires a lock on the data stream.

Locks access to the data stream

Definition at line 263 of file SickBufferMonitor.hh.

template<class SICK_MONITOR_CLASS, class SICK_MSG_CLASS>
void SickToolbox::SickBufferMonitor< SICK_MONITOR_CLASS, SICK_MSG_CLASS >::GetNextMessageFromDataStream ( SICK_MSG_CLASS &  sick_message)

Acquire the next message from raw byte stream

Reimplemented in SickToolbox::SickLMS1xxBufferMonitor, SickToolbox::SickLMS2xxBufferMonitor, and SickToolbox::SickLDBufferMonitor.

template<class SICK_MONITOR_CLASS , class SICK_MSG_CLASS>
bool SickToolbox::SickBufferMonitor< SICK_MONITOR_CLASS, SICK_MSG_CLASS >::GetNextMessageFromMonitor ( SICK_MSG_CLASS &  sick_message) throw ( SickThreadException )

Checks the message container for the next available Sick message.

Acquire the most recent message buffered by the monitor

Parameters:
&sick_messageThe message object that is to be populated with the results
Returns:
True if the current contents were acquired, false otherwise

Definition at line 181 of file SickBufferMonitor.hh.

template<class SICK_MONITOR_CLASS , class SICK_MSG_CLASS >
void SickToolbox::SickBufferMonitor< SICK_MONITOR_CLASS, SICK_MSG_CLASS >::ReleaseDataStream ( ) throw ( SickThreadException )

Releases a lock on the data stream.

Unlock access to the data stream

Definition at line 276 of file SickBufferMonitor.hh.

template<class SICK_MONITOR_CLASS , class SICK_MSG_CLASS >
void SickToolbox::SickBufferMonitor< SICK_MONITOR_CLASS, SICK_MSG_CLASS >::SetDataStream ( const unsigned int  sick_fd) throw ( SickThreadException )

A method for setting/changing the current data stream.

A method for setting the target data stream

Parameters:
sick_fdThe data stream file descriptor

Definition at line 127 of file SickBufferMonitor.hh.

template<class SICK_MONITOR_CLASS , class SICK_MSG_CLASS >
void SickToolbox::SickBufferMonitor< SICK_MONITOR_CLASS, SICK_MSG_CLASS >::StartMonitor ( const unsigned int  sick_fd) throw ( SickThreadException )

Creates and starts the buffer monitor thread.

Start the buffer monitor for the device

Returns:
True upon success, False otherwise

Definition at line 160 of file SickBufferMonitor.hh.

template<class SICK_MONITOR_CLASS , class SICK_MSG_CLASS >
void SickToolbox::SickBufferMonitor< SICK_MONITOR_CLASS, SICK_MSG_CLASS >::StopMonitor ( ) throw ( SickThreadException )

Cancels the buffer monitor thread.

Stop the buffer monitor for the device

Returns:
True if the thread was properly canceled, false otherwise

Definition at line 227 of file SickBufferMonitor.hh.


Member Data Documentation

template<class SICK_MONITOR_CLASS, class SICK_MSG_CLASS>
pthread_mutex_t SickToolbox::SickBufferMonitor< SICK_MONITOR_CLASS, SICK_MSG_CLASS >::_container_mutex [private]

A mutex for guarding the message container

Definition at line 83 of file SickBufferMonitor.hh.

template<class SICK_MONITOR_CLASS, class SICK_MSG_CLASS>
bool SickToolbox::SickBufferMonitor< SICK_MONITOR_CLASS, SICK_MSG_CLASS >::_continue_grabbing [private]

A flag to indicate the monitor should continue running

Definition at line 77 of file SickBufferMonitor.hh.

template<class SICK_MONITOR_CLASS, class SICK_MSG_CLASS>
pthread_t SickToolbox::SickBufferMonitor< SICK_MONITOR_CLASS, SICK_MSG_CLASS >::_monitor_thread_id [private]

Buffer monitor thread ID

Definition at line 80 of file SickBufferMonitor.hh.

template<class SICK_MONITOR_CLASS, class SICK_MSG_CLASS>
SICK_MSG_CLASS SickToolbox::SickBufferMonitor< SICK_MONITOR_CLASS, SICK_MSG_CLASS >::_recv_msg_container [private]

A container to hold the most recent message

Definition at line 89 of file SickBufferMonitor.hh.

template<class SICK_MONITOR_CLASS, class SICK_MSG_CLASS>
unsigned int SickToolbox::SickBufferMonitor< SICK_MONITOR_CLASS, SICK_MSG_CLASS >::_sick_fd [protected]

Sick data stream file descriptor

Definition at line 66 of file SickBufferMonitor.hh.

template<class SICK_MONITOR_CLASS, class SICK_MSG_CLASS>
SICK_MONITOR_CLASS* SickToolbox::SickBufferMonitor< SICK_MONITOR_CLASS, SICK_MSG_CLASS >::_sick_monitor_instance [private]

The current monitor instance

Definition at line 74 of file SickBufferMonitor.hh.

template<class SICK_MONITOR_CLASS, class SICK_MSG_CLASS>
pthread_mutex_t SickToolbox::SickBufferMonitor< SICK_MONITOR_CLASS, SICK_MSG_CLASS >::_stream_mutex [private]

A mutex for locking the data stream

Definition at line 86 of file SickBufferMonitor.hh.


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


sicktoolbox
Author(s): Jason Derenick , Thomas Miller
autogenerated on Thu Aug 27 2015 15:17:16