#include <SickBufferMonitor.hh>
Public Member Functions | |
| void | AcquireDataStream () throw ( SickThreadException ) |
| Acquires a lock on the data stream. More... | |
| 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. More... | |
| void | ReleaseDataStream () throw ( SickThreadException ) |
| Releases a lock on the data stream. More... | |
| void | SetDataStream (const unsigned int sick_fd) throw ( SickThreadException ) |
| A method for setting/changing the current data stream. More... | |
| SickBufferMonitor (SICK_MONITOR_CLASS *const monitor_instance) throw ( SickThreadException ) | |
| Primary constructor. More... | |
| void | StartMonitor (const unsigned int sick_fd) throw ( SickThreadException ) |
| Creates and starts the buffer monitor thread. More... | |
| void | StopMonitor () throw ( SickThreadException ) |
| Cancels the buffer monitor thread. More... | |
| ~SickBufferMonitor () throw ( SickThreadException ) | |
| The destructor (kills the mutex) More... | |
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. More... | |
Protected Attributes | |
| unsigned int | _sick_fd |
Private Member Functions | |
| void | _acquireMessageContainer () throw ( SickThreadException ) |
| Locks access to the message container. More... | |
| void | _releaseMessageContainer () throw ( SickThreadException ) |
| Unlocks access to the message container. More... | |
Static Private Member Functions | |
| static void * | _bufferMonitorThread (void *thread_args) |
| The monitor thread. More... | |
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.
|
private | |||||||||||||
Locks access to the message container.
Locks access to the message container
Definition at line 306 of file SickBufferMonitor.hh.
|
staticprivate |
The monitor thread.
Entry point for the monitor thread
| *args | The thread arguments |
Definition at line 409 of file SickBufferMonitor.hh.
|
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.
|
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
| 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.
|
private |
A mutex for guarding the message container
Definition at line 82 of file SickBufferMonitor.hh.
|
private |
A flag to indicate the monitor should continue running
Definition at line 76 of file SickBufferMonitor.hh.
|
private |
Buffer monitor thread ID
Definition at line 79 of file SickBufferMonitor.hh.
|
private |
A container to hold the most recent message
Definition at line 88 of file SickBufferMonitor.hh.
|
protected |
Sick data stream file descriptor
Definition at line 65 of file SickBufferMonitor.hh.
|
private |
The current monitor instance
Definition at line 73 of file SickBufferMonitor.hh.
|
private |
A mutex for locking the data stream
Definition at line 85 of file SickBufferMonitor.hh.