#include <SickBufferMonitor.hh>
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 |
Definition at line 31 of file SickBufferMonitor.hh.
SickToolbox::SickBufferMonitor< SICK_MONITOR_CLASS, SICK_MSG_CLASS >::SickBufferMonitor | ( | SICK_MONITOR_CLASS *const | monitor_instance | ) | throw ( SickThreadException ) |
Primary constructor.
A standard constructor
device_instance | A pointer to the current driver instance |
Definition at line 106 of file SickBufferMonitor.hh.
SickToolbox::SickBufferMonitor< SICK_MONITOR_CLASS, SICK_MSG_CLASS >::~SickBufferMonitor | ( | ) | throw ( SickThreadException ) |
The destructor (kills the mutex)
A standard destructor
Definition at line 288 of file SickBufferMonitor.hh.
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 306 of file SickBufferMonitor.hh.
void * SickToolbox::SickBufferMonitor< SICK_MONITOR_CLASS, SICK_MSG_CLASS >::_bufferMonitorThread | ( | void * | thread_args | ) | [static, private] |
The monitor thread.
Entry point for the monitor thread
*args | The thread arguments |
Definition at line 409 of file SickBufferMonitor.hh.
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
*dest_buffer | A pointer to the destination buffer |
num_bytes_to_read | The number of bytes to read into the buffer |
timeout_value | The number of microseconds allowed between subsequent bytes in a message |
Definition at line 336 of file SickBufferMonitor.hh.
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 319 of file SickBufferMonitor.hh.
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 262 of file SickBufferMonitor.hh.
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::SickPLSBufferMonitor.
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
&sick_message | The message object that is to be populated with the results |
Definition at line 180 of file SickBufferMonitor.hh.
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 275 of file SickBufferMonitor.hh.
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
sick_fd | The data stream file descriptor |
Definition at line 126 of file SickBufferMonitor.hh.
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
Definition at line 159 of file SickBufferMonitor.hh.
void SickToolbox::SickBufferMonitor< SICK_MONITOR_CLASS, SICK_MSG_CLASS >::StopMonitor | ( | ) | throw ( SickThreadException ) |
Cancels the buffer monitor thread.
Stop the buffer monitor for the device
Definition at line 226 of file SickBufferMonitor.hh.
pthread_mutex_t SickToolbox::SickBufferMonitor< SICK_MONITOR_CLASS, SICK_MSG_CLASS >::_container_mutex [private] |
A mutex for guarding the message container
Definition at line 82 of file SickBufferMonitor.hh.
bool SickToolbox::SickBufferMonitor< SICK_MONITOR_CLASS, SICK_MSG_CLASS >::_continue_grabbing [private] |
A flag to indicate the monitor should continue running
Definition at line 76 of file SickBufferMonitor.hh.
pthread_t SickToolbox::SickBufferMonitor< SICK_MONITOR_CLASS, SICK_MSG_CLASS >::_monitor_thread_id [private] |
Buffer monitor thread ID
Definition at line 79 of file SickBufferMonitor.hh.
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 88 of file SickBufferMonitor.hh.
unsigned int SickToolbox::SickBufferMonitor< SICK_MONITOR_CLASS, SICK_MSG_CLASS >::_sick_fd [protected] |
Sick data stream file descriptor
Definition at line 65 of file SickBufferMonitor.hh.
SICK_MONITOR_CLASS* SickToolbox::SickBufferMonitor< SICK_MONITOR_CLASS, SICK_MSG_CLASS >::_sick_monitor_instance [private] |
The current monitor instance
Definition at line 73 of file SickBufferMonitor.hh.
pthread_mutex_t SickToolbox::SickBufferMonitor< SICK_MONITOR_CLASS, SICK_MSG_CLASS >::_stream_mutex [private] |
A mutex for locking the data stream
Definition at line 85 of file SickBufferMonitor.hh.