vrpn 07.35
Virtual Reality Peripheral Network
|
This is the class users deal with: it tells the format and the region data when it arrives. More...
#include <vrpn_Imager.h>
Public Member Functions | |
vrpn_Imager_Remote (const char *name, vrpn_Connection *c=NULL) | |
virtual int | register_region_handler (void *userdata, vrpn_IMAGERREGIONHANDLER handler) |
Register a handler for when new data arrives (can look up info in object when this happens) | |
virtual int | unregister_region_handler (void *userdata, vrpn_IMAGERREGIONHANDLER handler) |
virtual int | register_description_handler (void *userdata, vrpn_IMAGERDESCRIPTIONHANDLER handler) |
Register a handler for when the object's description changes (if desired). | |
virtual int | unregister_description_handler (void *userdata, vrpn_IMAGERDESCRIPTIONHANDLER handler) |
virtual int | register_begin_frame_handler (void *userdata, vrpn_IMAGERBEGINFRAMEHANDLER handler) |
Register a handler for frame beginning (if the application cares) | |
virtual int | unregister_begin_frame_handler (void *userdata, vrpn_IMAGERBEGINFRAMEHANDLER handler) |
virtual int | register_end_frame_handler (void *userdata, vrpn_IMAGERENDFRAMEHANDLER handler) |
Register a handler for frame end (if the application cares) | |
virtual int | unregister_end_frame_handler (void *userdata, vrpn_IMAGERENDFRAMEHANDLER handler) |
virtual int | register_discarded_frames_handler (void *userdata, vrpn_IMAGERDISCARDEDFRAMESHANDLER handler) |
Register a handler for discarded frame notifications (if the application cares) | |
virtual int | unregister_discarded_frames_handler (void *userdata, vrpn_IMAGERDISCARDEDFRAMESHANDLER handler) |
virtual bool | throttle_sender (vrpn_int32 N) |
Request that the server send at most N more frames until a new request is sent. | |
virtual void | mainloop (void) |
XXX It could be nice to let the user specify separate callbacks for. | |
const vrpn_Imager_Channel * | channel (unsigned chanNum) const |
Accessors for the member variables: can be queried in the handler for object changes. | |
bool | is_description_valid () |
have we gotten a description message yet? | |
![]() | |
vrpn_Imager (const char *name, vrpn_Connection *c=NULL) | |
vrpn_int32 | nRows (void) const |
vrpn_int32 | nCols (void) const |
vrpn_int32 | nDepth (void) const |
vrpn_int32 | nChannels (void) const |
![]() | |
vrpn_BaseClass (const char *name, vrpn_Connection *c=NULL) | |
Names the device and assigns or opens connection, calls registration methods. | |
virtual | ~vrpn_BaseClass () |
virtual void | mainloop ()=0 |
Called once through each main loop iteration to handle updates. Remote object mainloop() should call client_mainloop() and then call d_connection->mainloop(). Server object mainloop() should service the device and then call server_mainloop(), but should not normally call d_connection->mainloop(). | |
![]() | |
vrpn_BaseClassUnique () | |
virtual | ~vrpn_BaseClassUnique () |
Unregister all of the message handlers that were to be autodeleted. | |
vrpn_Connection * | connectionPtr () |
Returns a pointer to the connection this object is using. | |
Static Protected Member Functions | |
static int VRPN_CALLBACK | handle_region_message (void *userdata, vrpn_HANDLERPARAM p) |
Handler for region update message from the server. | |
static int VRPN_CALLBACK | handle_description_message (void *userdata, vrpn_HANDLERPARAM p) |
Handler for resolution and channel list message from the server. | |
static int VRPN_CALLBACK | handle_connection_dropped_message (void *userdata, vrpn_HANDLERPARAM p) |
Handler for connection dropped message. | |
static int VRPN_CALLBACK | handle_begin_frame_message (void *userdata, vrpn_HANDLERPARAM p) |
Handler for begin-frame message from the server. | |
static int VRPN_CALLBACK | handle_end_frame_message (void *userdata, vrpn_HANDLERPARAM p) |
Handler for end-frame message from the server. | |
static int VRPN_CALLBACK | handle_discarded_frames_message (void *userdata, vrpn_HANDLERPARAM p) |
Handler for discarded-frames message from the server. | |
![]() | |
static int | encode_text_message_to_buffer (char *buf, vrpn_TEXT_SEVERITY severity, vrpn_uint32 level, const char *msg) |
Encodes the body of the text message into a buffer, preparing for sending. | |
static int | decode_text_message_from_buffer (char *msg, vrpn_TEXT_SEVERITY *severity, vrpn_uint32 *level, const char *buf) |
Decodes the body of the text message from a buffer from the connection. | |
Additional Inherited Members | |
![]() | |
bool | shutup |
vrpn_MESSAGEHANDLER | handler |
vrpn_int32 | sender |
vrpn_int32 | type |
void * | userdata |
![]() | |
virtual int | register_types (void) |
Register the types of messages this device sends/receives. Return 0 on success, -1 on fail. | |
![]() | |
virtual int | init (void) |
Initialize things that the constructor can't. Returns 0 on success, -1 on failure. | |
virtual int | register_senders (void) |
Register the sender for this device (by default, the name of the device). Return 0 on success, -1 on fail. | |
virtual int | register_types (void)=0 |
Register the types of messages this device sends/receives. Return 0 on success, -1 on fail. | |
![]() | |
int | register_autodeleted_handler (vrpn_int32 type, vrpn_MESSAGEHANDLER handler, void *userdata, vrpn_int32 sender=vrpn_ANY_SENDER) |
Registers a handler with the connection, and remembers to delete at destruction. | |
int | send_text_message (const char *msg, struct timeval timestamp, vrpn_TEXT_SEVERITY type=vrpn_TEXT_NORMAL, vrpn_uint32 level=0) |
Sends a NULL-terminated text message from the device d_sender_id. | |
SendTextMessageBoundCall | send_text_message (vrpn_TEXT_SEVERITY type=vrpn_TEXT_NORMAL) |
Returns an object you can stream into to send a text message from the device like send_text_message(vrpn_TEXT_WARNING) << "Value of i is: " << i; This use requires including vrpn_SendTextMessageStreamProxy.h. | |
void | server_mainloop (void) |
Handles functions that all servers should provide in their mainloop() (ping/pong, for example) Should be called by all servers in their mainloop() | |
void | client_mainloop (void) |
Handles functions that all clients should provide in their mainloop() (warning of no server, for example) Should be called by all clients in their mainloop() | |
This is the class users deal with: it tells the format and the region data when it arrives.
Definition at line 626 of file vrpn_Imager.h.
vrpn_Imager_Remote::vrpn_Imager_Remote | ( | const char * | name, |
vrpn_Connection * | c = NULL |
||
) |
Definition at line 1161 of file vrpn_Imager.C.
References vrpn_Imager::d_begin_frame_m_id, vrpn_BaseClassUnique::d_connection, vrpn_Imager::d_description_m_id, vrpn_Imager::d_discarded_frames_m_id, vrpn_Imager::d_end_frame_m_id, vrpn_Imager::d_regionf32_m_id, vrpn_Imager::d_regionu16_m_id, vrpn_Imager::d_regionu8_m_id, vrpn_BaseClassUnique::d_sender_id, handle_begin_frame_message(), handle_connection_dropped_message(), handle_description_message(), handle_discarded_frames_message(), handle_end_frame_message(), handle_region_message(), vrpn_BaseClassUnique::register_autodeleted_handler(), vrpn_Connection::register_message_type(), and vrpn_dropped_connection.
const vrpn_Imager_Channel * vrpn_Imager_Remote::channel | ( | unsigned | chanNum | ) | const |
Accessors for the member variables: can be queried in the handler for object changes.
Definition at line 1202 of file vrpn_Imager.C.
References vrpn_Imager::d_channels, and vrpn_Imager::d_nChannels.
Referenced by vrpn_Imager_Stream_Buffer::handle_image_description().
|
staticprotected |
Handler for begin-frame message from the server.
Definition at line 1290 of file vrpn_Imager.C.
References vrpn_HANDLERPARAM::buffer, vrpn_Callback_List< CALLBACK_STRUCT >::call_handlers(), vrpn_IMAGERBEGINFRAMECB::cMax, vrpn_IMAGERBEGINFRAMECB::cMin, d_begin_frame_list, d_got_description, vrpn_IMAGERBEGINFRAMECB::dMax, vrpn_IMAGERBEGINFRAMECB::dMin, vrpn_HANDLERPARAM::msg_time, vrpn_IMAGERBEGINFRAMECB::msg_time, vrpn_IMAGERBEGINFRAMECB::rMax, vrpn_IMAGERBEGINFRAMECB::rMin, vrpn_BaseClassUnique::userdata, and vrpn_unbuffer().
Referenced by vrpn_Imager_Remote().
|
staticprotected |
Handler for connection dropped message.
Definition at line 1366 of file vrpn_Imager.C.
References d_got_description, and vrpn_BaseClassUnique::userdata.
Referenced by vrpn_Imager_Remote().
|
staticprotected |
Handler for resolution and channel list message from the server.
Definition at line 1210 of file vrpn_Imager.C.
References vrpn_HANDLERPARAM::buffer, vrpn_Callback_List< CALLBACK_STRUCT >::call_handlers(), vrpn_Imager::d_channels, d_description_list, d_got_description, vrpn_Imager::d_nChannels, vrpn_Imager::d_nCols, vrpn_Imager::d_nDepth, vrpn_Imager::d_nRows, vrpn_HANDLERPARAM::msg_time, vrpn_Imager_Channel::unbuffer(), vrpn_BaseClassUnique::userdata, and vrpn_unbuffer().
Referenced by vrpn_Imager_Remote().
|
staticprotected |
Handler for discarded-frames message from the server.
Definition at line 1342 of file vrpn_Imager.C.
References vrpn_HANDLERPARAM::buffer, vrpn_Callback_List< CALLBACK_STRUCT >::call_handlers(), vrpn_IMAGERDISCARDEDFRAMESCB::count, d_discarded_frames_list, d_got_description, vrpn_HANDLERPARAM::msg_time, vrpn_IMAGERDISCARDEDFRAMESCB::msg_time, vrpn_BaseClassUnique::userdata, and vrpn_unbuffer().
Referenced by vrpn_Imager_Remote().
|
staticprotected |
Handler for end-frame message from the server.
Definition at line 1316 of file vrpn_Imager.C.
References vrpn_HANDLERPARAM::buffer, vrpn_Callback_List< CALLBACK_STRUCT >::call_handlers(), vrpn_IMAGERENDFRAMECB::cMax, vrpn_IMAGERENDFRAMECB::cMin, d_end_frame_list, d_got_description, vrpn_IMAGERENDFRAMECB::dMax, vrpn_IMAGERENDFRAMECB::dMin, vrpn_HANDLERPARAM::msg_time, vrpn_IMAGERENDFRAMECB::msg_time, vrpn_IMAGERENDFRAMECB::rMax, vrpn_IMAGERENDFRAMECB::rMin, vrpn_BaseClassUnique::userdata, and vrpn_unbuffer().
Referenced by vrpn_Imager_Remote().
|
staticprotected |
Handler for region update message from the server.
Definition at line 1238 of file vrpn_Imager.C.
References vrpn_HANDLERPARAM::buffer, vrpn_Callback_List< CALLBACK_STRUCT >::call_handlers(), vrpn_Imager_Region::d_chanIndex, vrpn_Imager::d_channels, vrpn_Imager_Region::d_cMax, vrpn_Imager_Region::d_cMin, vrpn_Imager_Channel::d_compression, vrpn_Imager_Region::d_dMax, vrpn_Imager_Region::d_dMin, d_got_description, d_region_list, vrpn_Imager_Region::d_rMax, vrpn_Imager_Region::d_rMin, vrpn_Imager_Region::d_valBuf, vrpn_Imager_Region::d_valid, vrpn_Imager_Region::d_valType, vrpn_HANDLERPARAM::msg_time, vrpn_IMAGERREGIONCB::msg_time, vrpn_Imager_Channel::NONE, vrpn_IMAGERREGIONCB::region, vrpn_BaseClassUnique::userdata, and vrpn_unbuffer().
Referenced by vrpn_Imager_Remote().
|
inline |
have we gotten a description message yet?
Definition at line 730 of file vrpn_Imager.h.
|
virtual |
XXX It could be nice to let the user specify separate callbacks for.
Call this each time through the program's main loop
Implements vrpn_BaseClass.
Definition at line 1194 of file vrpn_Imager.C.
References vrpn_BaseClassUnique::client_mainloop(), vrpn_BaseClassUnique::d_connection, and vrpn_Connection::mainloop().
Referenced by vrpn_Imager_Stream_Buffer::logging_thread_func().
|
inlinevirtual |
Register a handler for frame beginning (if the application cares)
Definition at line 660 of file vrpn_Imager.h.
|
inlinevirtual |
Register a handler for when the object's description changes (if desired).
Definition at line 646 of file vrpn_Imager.h.
Referenced by vrpn_Imager_Stream_Buffer::setup_handlers_for_logging_connection().
|
inlinevirtual |
Register a handler for discarded frame notifications (if the application cares)
Definition at line 687 of file vrpn_Imager.h.
|
inlinevirtual |
Register a handler for frame end (if the application cares)
Definition at line 673 of file vrpn_Imager.h.
|
inlinevirtual |
Register a handler for when new data arrives (can look up info in object when this happens)
Definition at line 632 of file vrpn_Imager.h.
|
virtual |
Request that the server send at most N more frames until a new request is sent.
Definition at line 1377 of file vrpn_Imager.C.
References vrpn_BaseClassUnique::d_connection, vrpn_BaseClassUnique::d_sender_id, vrpn_Imager::d_throttle_frames_m_id, vrpn_Connection::pack_message(), vrpn_buffer(), vrpn_CONNECTION_RELIABLE, vrpn_CONNECTION_TCP_BUFLEN, and vrpn_gettimeofday.
|
inlinevirtual |
Definition at line 666 of file vrpn_Imager.h.
|
inlinevirtual |
Definition at line 652 of file vrpn_Imager.h.
Referenced by vrpn_Imager_Stream_Buffer::teardown_handlers_for_logging_connection().
|
inlinevirtual |
Definition at line 692 of file vrpn_Imager.h.
|
inlinevirtual |
Definition at line 678 of file vrpn_Imager.h.
|
inlinevirtual |
Definition at line 637 of file vrpn_Imager.h.
|
protected |
Definition at line 737 of file vrpn_Imager.h.
Referenced by handle_begin_frame_message().
|
protected |
Definition at line 735 of file vrpn_Imager.h.
Referenced by handle_description_message().
|
protected |
Definition at line 739 of file vrpn_Imager.h.
Referenced by handle_discarded_frames_message().
|
protected |
Definition at line 738 of file vrpn_Imager.h.
Referenced by handle_end_frame_message().
|
protected |
Definition at line 733 of file vrpn_Imager.h.
Referenced by handle_begin_frame_message(), handle_connection_dropped_message(), handle_description_message(), handle_discarded_frames_message(), handle_end_frame_message(), and handle_region_message().
|
protected |
Definition at line 736 of file vrpn_Imager.h.
Referenced by handle_region_message().