vrpn 07.35
Virtual Reality Peripheral Network
 
Loading...
Searching...
No Matches
vrpn_Button_Filter Class Reference

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_CHProducts_Fighterstick_USB, vrpn_CerealBox, vrpn_Contour_ShuttlePROv2, vrpn_Contour_ShuttleXpress, vrpn_DreamCheeky_Drum_Kit, vrpn_Freespace, vrpn_Futaba_InterLink_Elite, vrpn_GlobalHapticsOrb, vrpn_Griffin_PowerMate, vrpn_IDEA, vrpn_ImmersionBox, vrpn_Joylin, vrpn_Joystick, vrpn_Keyboard, vrpn_Logitech_Extreme_3D_Pro, vrpn_Magellan, vrpn_Microsoft_Controller_Raw_Xbox_360_base, vrpn_Microsoft_Controller_Raw_Xbox_S, vrpn_Microsoft_SideWinder, vrpn_Microsoft_SideWinder_Precision_2, vrpn_Mouse, vrpn_Retrolink_GameCube, vrpn_Retrolink_Genesis, vrpn_Saitek_ST290_Pro, vrpn_Spaceball, vrpn_Streaming_Arduino, vrpn_Tng3, vrpn_Tracker_3DMouse, vrpn_Tracker_DTrack, vrpn_Tracker_PhaseSpace, vrpn_Tracker_RazerHydra, vrpn_VPJoystick, vrpn_Wanda, vrpn_WiiMote, vrpn_Xkeys_Desktop, vrpn_Xkeys_Jog_And_Shuttle, vrpn_Xkeys_Jog_And_Shuttle12, vrpn_Xkeys_Jog_And_Shuttle68, vrpn_Xkeys_Joystick, vrpn_Xkeys_Joystick12, vrpn_Xkeys_Pro, vrpn_Xkeys_XK3, vrpn_YEI_3Space, vrpn_inertiamouse, vrpn_nVidia_shield_USB, vrpn_nVidia_shield_stealth_USB, and vrpn_raw_SGIBox.

Collaboration diagram for vrpn_Button_Filter:

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)
 
- Public Member Functions inherited from vrpn_Button
 vrpn_Button (const char *name, vrpn_Connection *c=NULL)
 
virtual ~vrpn_Button (void)
 
void print (void)
 
- Public Member Functions inherited from vrpn_BaseClass
 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().
 
- Public Member Functions inherited from vrpn_BaseClassUnique
 vrpn_BaseClassUnique ()
 
virtual ~vrpn_BaseClassUnique ()
 Unregister all of the message handlers that were to be autodeleted.
 
vrpn_ConnectionconnectionPtr ()
 Returns a pointer to the connection this object is using.
 

Public Attributes

vrpn_int32 buttonstate [vrpn_BUTTON_MAX_BUTTONS]
 
- Public Attributes inherited from vrpn_BaseClassUnique
bool shutup
 

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.
 
virtual void report_changes (void)
 
- Protected Member Functions inherited from vrpn_Button
virtual int register_types (void)
 Register the types of messages this device sends/receives. Return 0 on success, -1 on fail.
 
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.
 
- Protected Member Functions inherited from vrpn_BaseClass
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.
 
- Protected Member Functions inherited from vrpn_BaseClassUnique
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()
 

Static Protected Member Functions

static int VRPN_CALLBACK handle_ping_message (void *userdata, vrpn_HANDLERPARAM p)
 
- Static Protected Member Functions inherited from vrpn_BaseClassUnique
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.
 

Protected Attributes

int send_alerts
 
vrpn_int32 alert_message_id
 
- Protected Attributes inherited from vrpn_Button
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
 
- Protected Attributes inherited from vrpn_BaseClassUnique
vrpn_Connectiond_connection
 Connection that this object talks to.
 
char * d_servicename
 Name of this device, not including the connection part.
 
vrpn_int32 d_sender_id
 Sender ID registered with the connection.
 
vrpn_int32 d_text_message_id
 ID for text messages.
 
vrpn_int32 d_ping_message_id
 Ask the server if they are there.
 
vrpn_int32 d_pong_message_id
 Server telling that it is there.
 

Detailed Description

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 66 of file vrpn_Button.h.

Constructor & Destructor Documentation

◆ vrpn_Button_Filter()

vrpn_Button_Filter::vrpn_Button_Filter ( const char * name,
vrpn_Connection * c = NULL )
protected

Definition at line 129 of file vrpn_Button.C.

References vrpn_Button::admin_message_id, alert_message_id, buttonstate, vrpn_BaseClassUnique::d_connection, vrpn_BaseClassUnique::d_ping_message_id, vrpn_BaseClassUnique::d_sender_id, handle_ping_message(), vrpn_BaseClassUnique::register_autodeleted_handler(), send_alerts, vrpn_ANY_SENDER, vrpn_Button::vrpn_Button(), vrpn_BUTTON_MAX_BUTTONS, vrpn_BUTTON_MOMENTARY, vrpn_Connection, and vrpn_got_connection.

Referenced by handle_ping_message(), vrpn_3DConnexion::vrpn_3DConnexion(), vrpn_3DMicroscribe::vrpn_3DMicroscribe(), vrpn_ADBox::vrpn_ADBox(), vrpn_BiosciencesTools::vrpn_BiosciencesTools(), vrpn_Button_5DT_Server::vrpn_Button_5DT_Server(), vrpn_Button_Example_Server::vrpn_Button_Example_Server(), vrpn_Button_NI_DIO24::vrpn_Button_NI_DIO24(), vrpn_Button_Parallel::vrpn_Button_Parallel(), vrpn_Button_Serial::vrpn_Button_Serial(), vrpn_Button_SerialMouse::vrpn_Button_SerialMouse(), vrpn_Button_Server::vrpn_Button_Server(), vrpn_CerealBox::vrpn_CerealBox(), vrpn_CHProducts_Fighterstick_USB::vrpn_CHProducts_Fighterstick_USB(), vrpn_Contour_ShuttlePROv2::vrpn_Contour_ShuttlePROv2(), vrpn_Contour_ShuttleXpress::vrpn_Contour_ShuttleXpress(), vrpn_DreamCheeky_Drum_Kit::vrpn_DreamCheeky_Drum_Kit(), vrpn_Futaba_InterLink_Elite::vrpn_Futaba_InterLink_Elite(), vrpn_GlobalHapticsOrb::vrpn_GlobalHapticsOrb(), vrpn_Griffin_PowerMate::vrpn_Griffin_PowerMate(), vrpn_IDEA::vrpn_IDEA(), vrpn_ImmersionBox::vrpn_ImmersionBox(), vrpn_inertiamouse::vrpn_inertiamouse(), vrpn_Joylin::vrpn_Joylin(), vrpn_Joystick::vrpn_Joystick(), vrpn_Keyboard::vrpn_Keyboard(), vrpn_Logitech_Extreme_3D_Pro::vrpn_Logitech_Extreme_3D_Pro(), vrpn_Magellan::vrpn_Magellan(), vrpn_Microsoft_Controller_Raw_Xbox_360_base::vrpn_Microsoft_Controller_Raw_Xbox_360_base(), vrpn_Microsoft_Controller_Raw_Xbox_S::vrpn_Microsoft_Controller_Raw_Xbox_S(), vrpn_Microsoft_SideWinder::vrpn_Microsoft_SideWinder(), vrpn_Microsoft_SideWinder_Precision_2::vrpn_Microsoft_SideWinder_Precision_2(), vrpn_Mouse::vrpn_Mouse(), vrpn_nVidia_shield_stealth_USB::vrpn_nVidia_shield_stealth_USB(), vrpn_nVidia_shield_USB::vrpn_nVidia_shield_USB(), vrpn_raw_SGIBox::vrpn_raw_SGIBox(), vrpn_Retrolink_GameCube::vrpn_Retrolink_GameCube(), vrpn_Retrolink_Genesis::vrpn_Retrolink_Genesis(), vrpn_Saitek_ST290_Pro::vrpn_Saitek_ST290_Pro(), vrpn_Spaceball::vrpn_Spaceball(), vrpn_Streaming_Arduino::vrpn_Streaming_Arduino(), vrpn_Tng3::vrpn_Tng3(), vrpn_Tracker_3DMouse::vrpn_Tracker_3DMouse(), vrpn_Tracker_DTrack::vrpn_Tracker_DTrack(), vrpn_Tracker_PhaseSpace::vrpn_Tracker_PhaseSpace(), vrpn_Tracker_RazerHydra::vrpn_Tracker_RazerHydra(), vrpn_Tracker_RazerHydra::vrpn_Tracker_RazerHydra(), vrpn_Tracker_RazerHydra::vrpn_Tracker_RazerHydra(), vrpn_VPJoystick::vrpn_VPJoystick(), vrpn_Wanda::vrpn_Wanda(), vrpn_WiiMote::vrpn_WiiMote(), vrpn_Xkeys_Desktop::vrpn_Xkeys_Desktop(), vrpn_Xkeys_Jog_And_Shuttle::vrpn_Xkeys_Jog_And_Shuttle(), vrpn_Xkeys_Jog_And_Shuttle12::vrpn_Xkeys_Jog_And_Shuttle12(), vrpn_Xkeys_Jog_And_Shuttle68::vrpn_Xkeys_Jog_And_Shuttle68(), vrpn_Xkeys_Joystick::vrpn_Xkeys_Joystick(), vrpn_Xkeys_Joystick12::vrpn_Xkeys_Joystick12(), vrpn_Xkeys_Pro::vrpn_Xkeys_Pro(), vrpn_Xkeys_XK3::vrpn_Xkeys_XK3(), and vrpn_YEI_3Space::vrpn_YEI_3Space().

Here is the call graph for this function:

Member Function Documentation

◆ encode_states_to()

vrpn_int32 vrpn_Button_Filter::encode_states_to ( char * buf)
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 341 of file vrpn_Button.C.

References buttonstate, vrpn_Button::num_buttons, vrpn_buffer(), and vrpn_BUTTON_MAX_BUTTONS.

Here is the call graph for this function:

◆ handle_ping_message()

int vrpn_Button_Filter::handle_ping_message ( void * userdata,
vrpn_HANDLERPARAM p )
staticprotected

Definition at line 162 of file vrpn_Button.C.

References vrpn_Button::report_states(), vrpn_BaseClassUnique::userdata, and vrpn_Button_Filter().

Referenced by vrpn_Button_Filter().

Here is the call graph for this function:

◆ report_changes()

void vrpn_Button_Filter::report_changes ( void )
protectedvirtual

Reimplemented from vrpn_Button.

Reimplemented in vrpn_DreamCheeky_Drum_Kit, vrpn_Xkeys_Desktop, vrpn_Xkeys_Pro, and vrpn_Xkeys_XK3.

Definition at line 383 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_3DConnexion_SpaceMouseProWireless::decodePacket(), vrpn_3DMicroscribe::get_report(), vrpn_BiosciencesTools::get_report(), vrpn_CerealBox::get_report(), vrpn_GlobalHapticsOrb::get_report(), vrpn_IDEA::get_report(), vrpn_ImmersionBox::get_report(), vrpn_inertiamouse::get_report(), vrpn_Keyboard::get_report(), vrpn_Magellan::get_report(), vrpn_Mouse::get_report(), vrpn_raw_SGIBox::get_report(), vrpn_Spaceball::get_report(), vrpn_Streaming_Arduino::get_report(), vrpn_Tng3::get_report(), vrpn_Tracker_PhaseSpace::get_report(), vrpn_YEI_3Space::handle_report(), vrpn_3DConnexion::mainloop(), vrpn_Button_5DT_Server::mainloop(), vrpn_Button_Example_Server::mainloop(), vrpn_Button_NI_DIO24::mainloop(), vrpn_Button_PinchGlove::mainloop(), vrpn_Button_Python::mainloop(), vrpn_Button_SerialMouse::mainloop(), vrpn_Button_Server::mainloop(), vrpn_CHProducts_Fighterstick_USB::mainloop(), vrpn_Contour_ShuttlePROv2::mainloop(), vrpn_Contour_ShuttleXpress::mainloop(), vrpn_Futaba_InterLink_Elite::mainloop(), vrpn_Griffin_PowerMate::mainloop(), vrpn_Logitech_Extreme_3D_Pro::mainloop(), vrpn_Microsoft_Controller_Raw_Xbox_360_base::mainloop(), vrpn_Microsoft_Controller_Raw_Xbox_S::mainloop(), vrpn_Microsoft_SideWinder::mainloop(), vrpn_Microsoft_SideWinder_Precision_2::mainloop(), vrpn_nVidia_shield_stealth_USB::mainloop(), vrpn_nVidia_shield_USB::mainloop(), vrpn_Retrolink_GameCube::mainloop(), vrpn_Retrolink_Genesis::mainloop(), vrpn_Saitek_ST290_Pro::mainloop(), vrpn_WiiMote::mainloop(), vrpn_Xkeys_Jog_And_Shuttle12::mainloop(), vrpn_Xkeys_Jog_And_Shuttle68::mainloop(), vrpn_Xkeys_Jog_And_Shuttle::mainloop(), vrpn_Xkeys_Joystick12::mainloop(), vrpn_Xkeys_Joystick::mainloop(), vrpn_Mouse::report(), and vrpn_Mouse::report_changes().

◆ set_alerts()

void vrpn_Button_Filter::set_alerts ( vrpn_int32 i)

Definition at line 169 of file vrpn_Button.C.

References send_alerts.

Referenced by vrpn_Mouse::vrpn_Mouse(), and vrpn_raw_SGIBox::vrpn_raw_SGIBox().

◆ set_all_momentary()

void vrpn_Button_Filter::set_all_momentary ( void )
virtual

◆ set_all_toggle()

void vrpn_Button_Filter::set_all_toggle ( vrpn_int32 default_state)
virtual

Reimplemented from vrpn_Button.

Definition at line 265 of file vrpn_Button.C.

References buttonstate, vrpn_Button::num_buttons, PACK_ALERT_MESSAGE, send_alerts, and vrpn_BUTTON_MOMENTARY.

◆ set_momentary()

void vrpn_Button_Filter::set_momentary ( vrpn_int32 which_button)
virtual

◆ set_toggle()

void vrpn_Button_Filter::set_toggle ( vrpn_int32 which_button,
vrpn_int32 current_state )
virtual

Member Data Documentation

◆ alert_message_id

vrpn_int32 vrpn_Button_Filter::alert_message_id
protected

Definition at line 79 of file vrpn_Button.h.

Referenced by vrpn_Button_Filter(), and vrpn_raw_SGIBox::vrpn_raw_SGIBox().

◆ buttonstate

◆ send_alerts

int vrpn_Button_Filter::send_alerts
protected

The documentation for this class was generated from the following files: