vrpn
07.33
Virtual Reality Peripheral Network
|
All button servers should derive from this class, which provides the ability to turn any of the buttons into toggles (using messages from the remote button object). More...
#include <vrpn_Button.h>
Inherits vrpn_Button.
Inherited by vrpn_3DConnexion, vrpn_3DMicroscribe, vrpn_ADBox, vrpn_BiosciencesTools, vrpn_Button_5DT_Server, vrpn_Button_Example_Server, vrpn_Button_NI_DIO24, vrpn_Button_Parallel, vrpn_Button_Serial, vrpn_Button_SerialMouse, vrpn_Button_Server, vrpn_CerealBox, vrpn_CHProducts_Fighterstick_USB, vrpn_Contour_ShuttleXpress, vrpn_DreamCheeky_Drum_Kit, vrpn_Freespace, vrpn_Futaba_InterLink_Elite, vrpn_GlobalHapticsOrb, vrpn_Griffin_PowerMate, vrpn_IDEA, vrpn_ImmersionBox, vrpn_inertiamouse, vrpn_Joylin, vrpn_Joystick, vrpn_Keyboard, vrpn_Logitech_Extreme_3D_Pro, vrpn_Magellan, vrpn_Microsoft_Controller_Raw_Xbox_360, vrpn_Microsoft_Controller_Raw_Xbox_S, vrpn_Microsoft_SideWinder, vrpn_Microsoft_SideWinder_Precision_2, vrpn_Mouse, vrpn_raw_SGIBox, vrpn_Retrolink_GameCube, vrpn_Saitek_ST290_Pro, vrpn_Spaceball, vrpn_Tng3, vrpn_Tracker_3DMouse, vrpn_Tracker_DTrack, vrpn_Tracker_RazerHydra, vrpn_VPJoystick, vrpn_Wanda, vrpn_WiiMote, vrpn_Xkeys_Desktop, vrpn_Xkeys_Jog_And_Shuttle, vrpn_Xkeys_Joystick, vrpn_Xkeys_Pro, vrpn_Xkeys_XK3, and vrpn_YEI_3Space.
Public Member Functions | |
virtual void | set_momentary (vrpn_int32 which_button) |
virtual void | set_toggle (vrpn_int32 which_button, vrpn_int32 current_state) |
virtual void | set_all_momentary (void) |
virtual void | set_all_toggle (vrpn_int32 default_state) |
void | set_alerts (vrpn_int32) |
![]() | |
vrpn_Button (const char *name, vrpn_Connection *c=NULL) | |
virtual | ~vrpn_Button (void) |
void | print (void) |
![]() | |
vrpn_BaseClass (const char *name, vrpn_Connection *c=NULL) | |
Names the device and assigns or opens connection, calls registration methods. More... | |
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(). More... | |
![]() | |
vrpn_BaseClassUnique () | |
virtual | ~vrpn_BaseClassUnique () |
Unregister all of the message handlers that were to be autodeleted. More... | |
vrpn_Connection * | connectionPtr () |
Returns a pointer to the connection this object is using. More... | |
Public Attributes | |
vrpn_int32 | buttonstate [vrpn_BUTTON_MAX_BUTTONS] |
![]() | |
bool | shutup |
vrpn_MESSAGEHANDLER | handler |
vrpn_int32 | sender |
vrpn_int32 | type |
void * | userdata |
Protected Member Functions | |
vrpn_Button_Filter (const char *, vrpn_Connection *c=NULL) | |
virtual vrpn_int32 | encode_states_to (char *buf) |
Encode a message describing the state of all buttons. More... | |
virtual void | report_changes (void) |
![]() | |
virtual int | register_types (void) |
Register the types of messages this device sends/receives. Return 0 on success, -1 on fail. More... | |
virtual void | report_states (void) |
virtual vrpn_int32 | encode_to (char *buf, vrpn_int32 button, vrpn_int32 state) |
Encode a message describing the new state of a button. More... | |
![]() | |
virtual int | init (void) |
Initialize things that the constructor can't. Returns 0 on success, -1 on failure. More... | |
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. More... | |
![]() | |
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. More... | |
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. More... | |
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. More... | |
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() More... | |
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() More... | |
Static Protected Member Functions | |
static int VRPN_CALLBACK | handle_ping_message (void *userdata, vrpn_HANDLERPARAM p) |
![]() | |
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. More... | |
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. More... | |
Protected Attributes | |
int | send_alerts |
vrpn_int32 | alert_message_id |
![]() | |
unsigned char | buttons [vrpn_BUTTON_MAX_BUTTONS] |
unsigned char | lastbuttons [vrpn_BUTTON_MAX_BUTTONS] |
vrpn_int32 | minrate [vrpn_BUTTON_MAX_BUTTONS] |
vrpn_int32 | num_buttons |
struct timeval | timestamp |
vrpn_int32 | change_message_id |
vrpn_int32 | states_message_id |
vrpn_int32 | admin_message_id |
![]() | |
vrpn_Connection * | d_connection |
Connection that this object talks to. More... | |
char * | d_servicename |
Name of this device, not including the connection part. More... | |
vrpn_int32 | d_sender_id |
Sender ID registered with the connection. More... | |
vrpn_int32 | d_text_message_id |
ID for text messages. More... | |
vrpn_int32 | d_ping_message_id |
Ask the server if they are there. More... | |
vrpn_int32 | d_pong_message_id |
Server telling that it is there. More... | |
All button servers should derive from this class, which provides the ability to turn any of the buttons into toggles (using messages from the remote button object).
Definition at line 65 of file vrpn_Button.h.
|
protected |
Definition at line 128 of file vrpn_Button.C.
References vrpn_Button::admin_message_id, vrpn_BaseClassUnique::d_connection, vrpn_BaseClassUnique::d_sender_id, and vrpn_BaseClassUnique::register_autodeleted_handler().
|
protectedvirtual |
Encode a message describing the state of all buttons.
Assumes that there is enough room in the buffer to hold the bytes from the message. Returns the number of bytes sent.
Reimplemented from vrpn_Button.
Definition at line 340 of file vrpn_Button.C.
References buttonstate, vrpn_Button::num_buttons, vrpn_buffer(), and vrpn_BUTTON_MAX_BUTTONS.
|
staticprotected |
Definition at line 161 of file vrpn_Button.C.
References vrpn_Button::report_states(), and vrpn_BaseClassUnique::userdata.
|
protectedvirtual |
Reimplemented from vrpn_Button.
Reimplemented in vrpn_Xkeys_XK3, vrpn_Xkeys_Pro, vrpn_Xkeys_Desktop, and vrpn_DreamCheeky_Drum_Kit.
Definition at line 382 of file vrpn_Button.C.
References vrpn_Button::buttons, buttonstate, vrpn_BaseClassUnique::d_connection, vrpn_Button::lastbuttons, vrpn_Button::num_buttons, PACK_ALERT_MESSAGE, PACK_MESSAGE, send_alerts, vrpn_BUTTON_MOMENTARY, vrpn_BUTTON_TOGGLE_OFF, and vrpn_BUTTON_TOGGLE_ON.
Referenced by vrpn_3DConnexion::decodePacket(), vrpn_Mouse::get_report(), vrpn_raw_SGIBox::get_report(), vrpn_3DMicroscribe::get_report(), vrpn_BiosciencesTools::get_report(), vrpn_IDEA::get_report(), vrpn_ImmersionBox::get_report(), vrpn_inertiamouse::get_report(), vrpn_Keyboard::get_report(), vrpn_Magellan::get_report(), vrpn_Spaceball::get_report(), vrpn_Tng3::get_report(), vrpn_YEI_3Space::handle_report(), vrpn_3DConnexion::mainloop(), vrpn_Button_5DT_Server::mainloop(), vrpn_Button_Server::mainloop(), vrpn_Button_Example_Server::mainloop(), vrpn_Button_Python::mainloop(), vrpn_Button_PinchGlove::mainloop(), vrpn_Button_NI_DIO24::mainloop(), vrpn_WiiMote::mainloop(), vrpn_Xkeys_Joystick::mainloop(), vrpn_Xkeys_Jog_And_Shuttle::mainloop(), vrpn_Button_SerialMouse::mainloop(), vrpn_Mouse::report(), and vrpn_Mouse::report_changes().
void vrpn_Button_Filter::set_alerts | ( | vrpn_int32 | i | ) |
Definition at line 168 of file vrpn_Button.C.
References send_alerts.
Referenced by vrpn_Mouse::vrpn_Mouse().
|
virtual |
Reimplemented from vrpn_Button.
Definition at line 244 of file vrpn_Button.C.
References buttonstate, vrpn_Button::num_buttons, PACK_ALERT_MESSAGE, send_alerts, vrpn_BUTTON_MOMENTARY, and vrpn_BUTTON_TOGGLE_OFF.
|
virtual |
Reimplemented from vrpn_Button.
Definition at line 264 of file vrpn_Button.C.
References buttonstate, vrpn_Button::num_buttons, PACK_ALERT_MESSAGE, send_alerts, and vrpn_BUTTON_MOMENTARY.
|
virtual |
Reimplemented from vrpn_Button.
Definition at line 177 of file vrpn_Button.C.
References buttonstate, vrpn_Button::num_buttons, PACK_ALERT_MESSAGE, send_alerts, vrpn_BaseClassUnique::send_text_message(), vrpn_Button::timestamp, vrpn_BUTTON_MOMENTARY, vrpn_BUTTON_TOGGLE_OFF, and vrpn_TEXT_ERROR.
|
virtual |
Reimplemented from vrpn_Button.
Definition at line 204 of file vrpn_Button.C.
References buttonstate, vrpn_Button::num_buttons, PACK_ALERT_MESSAGE, send_alerts, vrpn_BaseClassUnique::send_text_message(), vrpn_Button::timestamp, vrpn_BUTTON_TOGGLE_OFF, vrpn_BUTTON_TOGGLE_ON, and vrpn_TEXT_ERROR.
|
protected |
Definition at line 78 of file vrpn_Button.h.
vrpn_int32 vrpn_Button_Filter::buttonstate[vrpn_BUTTON_MAX_BUTTONS] |
Definition at line 67 of file vrpn_Button.h.
Referenced by encode_states_to(), report_changes(), vrpn_raw_SGIBox::send_light_command(), set_all_momentary(), set_all_toggle(), set_momentary(), set_toggle(), and vrpn_Button_SerialMouse::vrpn_Button_SerialMouse().
|
protected |
Definition at line 75 of file vrpn_Button.h.
Referenced by report_changes(), set_alerts(), set_all_momentary(), set_all_toggle(), set_momentary(), and set_toggle().