FUSE client. More...
#include <fvutils/net/fuse_client.h>
Public Member Functions | |
FuseClient (const char *hostname, unsigned short int port, FuseClientHandler *handler) | |
Constructor. | |
virtual | ~FuseClient () |
Destructor. | |
void | connect () |
Connect. | |
void | disconnect () |
Disconnect. | |
void | enqueue (FuseNetworkMessage *m) |
Enqueue message. | |
void | enqueue (FUSE_message_type_t type, void *payload, size_t payload_size) |
Enqueue message. | |
void | enqueue (FUSE_message_type_t type) |
Enqueue message without payload. | |
void | enqueue_and_wait (FuseNetworkMessage *message) |
Enqueue message and wait for reply. | |
void | enqueue_and_wait (FUSE_message_type_t type, void *payload, size_t payload_size) |
Enqueue message and wait for reply. | |
void | enqueue_and_wait (FUSE_message_type_t type) |
Enqueue message without payload and wait for reply. | |
void | wait () |
Wait for messages. | |
void | wait_greeting () |
Wait for greeting message. | |
virtual void | loop () |
Thread loop. |
FUSE client.
FUSE is the FireVision protocol to retrieve information, images and lookup tables from vision processes and to send control commands to these systems. The client is used in the retrieving or controlling process.
Definition at line 45 of file fuse_client.h.
firevision::FuseClient::FuseClient | ( | const char * | hostname, | |
unsigned short int | port, | |||
FuseClientHandler * | handler | |||
) |
Constructor.
hostname | host to connect to | |
port | port to connect to | |
handler | client handler to handle incoming data |
Definition at line 64 of file fuse_client.cpp.
firevision::FuseClient::~FuseClient | ( | ) | [virtual] |
void firevision::FuseClient::connect | ( | ) |
Connect.
Definition at line 119 of file fuse_client.cpp.
References fawkes::Socket::connect(), and firevision::FUSE_greeting_message_t::version.
Referenced by firevision::NetworkCamera::open(), FireVisionNetworkTool::run(), and FireVisionNetworkTool::service_added().
void firevision::FuseClient::disconnect | ( | ) |
Disconnect.
Definition at line 132 of file fuse_client.cpp.
References fawkes::Mutex::lock(), and fawkes::Mutex::unlock().
Referenced by firevision::NetworkCamera::close(), firevision::FuseImageListWidget::~FuseImageListWidget(), and FuseTransferWidget::~FuseTransferWidget().
void firevision::FuseClient::enqueue | ( | FUSE_message_type_t | type | ) |
Enqueue message without payload.
type | type of message |
Definition at line 207 of file fuse_client.cpp.
References fawkes::LockQueue< Type >::push_locked().
void firevision::FuseClient::enqueue | ( | FUSE_message_type_t | type, | |
void * | payload, | |||
size_t | payload_size | |||
) |
Enqueue message.
type | type of message | |
payload | payload of message | |
payload_size | size of payload |
Definition at line 196 of file fuse_client.cpp.
References fawkes::LockQueue< Type >::push_locked().
void firevision::FuseClient::enqueue | ( | FuseNetworkMessage * | m | ) |
Enqueue message.
This method takes ownership of the passed message. You must explicitly reference it before enqueing if you want to use it afterwards.
m | message to enqueue |
Definition at line 184 of file fuse_client.cpp.
References fawkes::LockQueue< Type >::push_locked().
Referenced by FireVisionNetworkTool::get_colormap(), FireVisionNetworkTool::get_image(), FireVisionNetworkTool::set_colormap(), and FireVisionNetworkTool::show_all().
void firevision::FuseClient::enqueue_and_wait | ( | FUSE_message_type_t | type | ) |
Enqueue message without payload and wait for reply.
The wait happens atomically, use this to avoid race conditions.
type | type of message |
Definition at line 252 of file fuse_client.cpp.
References fawkes::Mutex::lock(), fawkes::LockQueue< Type >::push_locked(), fawkes::Mutex::unlock(), and fawkes::WaitCondition::wait().
void firevision::FuseClient::enqueue_and_wait | ( | FUSE_message_type_t | type, | |
void * | payload, | |||
size_t | payload_size | |||
) |
Enqueue message and wait for reply.
The wait happens atomically, use this to avoid race conditions.
type | type of message | |
payload | payload of message | |
payload_size | size of payload |
Definition at line 237 of file fuse_client.cpp.
References fawkes::Mutex::lock(), fawkes::LockQueue< Type >::push_locked(), fawkes::Mutex::unlock(), and fawkes::WaitCondition::wait().
void firevision::FuseClient::enqueue_and_wait | ( | FuseNetworkMessage * | m | ) |
Enqueue message and wait for reply.
The wait happens atomically, use this to avoid race conditions. This method takes ownership of the passed message. You must explicitly reference it before enqueing if you want to use it afterwards.
m | message to enqueue |
Definition at line 221 of file fuse_client.cpp.
References fawkes::Mutex::lock(), fawkes::LockQueue< Type >::push_locked(), fawkes::Mutex::unlock(), and fawkes::WaitCondition::wait().
Referenced by firevision::NetworkCamera::capture(), firevision::NetworkCamera::image_list(), firevision::NetworkCamera::open(), and firevision::NetworkCamera::set_image_id().
void firevision::FuseClient::loop | ( | ) | [virtual] |
Thread loop.
Sends enqueued messages and reads incoming messages off the network.
Reimplemented from fawkes::Thread.
Definition at line 282 of file fuse_client.cpp.
References firevision::FuseClientHandler::fuse_connection_established(), firevision::FuseClientHandler::fuse_inbound_received(), firevision::FuseClientHandler::fuse_invalid_server_version(), fawkes::LockQueue< Type >::lock(), fawkes::Mutex::lock(), firevision::FuseNetworkMessage::msg(), firevision::FuseNetworkMessage::type(), fawkes::LockQueue< Type >::unlock(), fawkes::Mutex::unlock(), fawkes::RefCount::unref(), firevision::FUSE_greeting_message_t::version, and fawkes::WaitCondition::wake_all().
void firevision::FuseClient::wait | ( | ) |
Wait for messages.
This will wait for messages to arrive. The calling thread is blocked until messages are available.
Definition at line 338 of file fuse_client.cpp.
References fawkes::Mutex::lock(), fawkes::Mutex::unlock(), and fawkes::WaitCondition::wait().
void firevision::FuseClient::wait_greeting | ( | ) |
Wait for greeting message.
This method will wait for the greeting message to arrive. Make sure that you called connect() before waiting or call it concurrently in another thread. The calling thread will be blocked until the message has been received. If the message has already been received this method will return immediately. Thus it is safe to call this at any time without risking a race condition.
Definition at line 354 of file fuse_client.cpp.
References fawkes::Mutex::lock(), fawkes::Mutex::unlock(), and fawkes::WaitCondition::wait().
Referenced by firevision::NetworkCamera::open(), FireVisionNetworkTool::run(), and FireVisionNetworkTool::service_added().