20 printf(
"Closing previous windows Winid=%d, sid = %d:\n",winid, sid);
26 ret = gethostname(hn, 100);
28 fprintf(stderr,
"vrpn_SGIBox: error in gethostname()\n");
31 sid = ret = dglopen(hn,DGLLOCAL);
33 fprintf(stderr,
"vrpn_SGIBox: error in dglopen()\n");
39 num_channel = NUM_DIALS;
40 num_buttons = NUM_BUTTONS;
43 register_autodeleted_handler(alert_message_id,sgibox_alert_handler,
this);
48void vrpn_SGIBox::reset() {
51 for (i=0; i<NUM_DIALS; i++) devs[i] = DIAL0+i;
52 for (i=0; i<NUM_BUTTONS; i++) devs[i+NUM_DIALS] = SW0+i;
57 getdev(NUMDEVS, devs, vals1);
59 for (i=0; i<NUM_BUTTONS; i++)
60 lastbuttons[i] = vals1[NUM_DIALS+i];
62 for (i=0; i<NUM_DIALS; i++) mid_values[i] = vals1[i], last[i] = 0;
65void vrpn_SGIBox::get_report() {
67 getdev(NUMDEVS, devs, vals1);
69 for (i=0; i< NUM_BUTTONS; i++) {
70 buttons[i] = vals1[NUM_DIALS+i];
72 for (i=0; i< NUM_DIALS; i++) {
73 int temp = vals1[i] -mid_values[i];
74 if (temp > 200) channel[i] = 0.5, mid_values[i] = vals1[i] - 200;
75 else if (temp < -200) channel[i] = -0.5, mid_values[i] = vals1[i]
78 channel[i] = temp/400.0;
87void vrpn_SGIBox::mainloop() {
96 vrpn_SGIBox*me=(vrpn_SGIBox *)userdata;
99 for(i=0;i<NUM_BUTTONS;i++){
110 printf(
"vrpn_SGIBox::Get first new connection, reset the box\n");
111 ((vrpn_SGIBox *)userdata) ->reset();
virtual void report_changes(vrpn_uint32 class_of_service=vrpn_CONNECTION_LOW_LATENCY, const struct timeval time=vrpn_ANALOG_NOW)
Send a report only if something has changed (for servers) Optionally, tell what time to stamp the val...
Generic connection class not specific to the transport mechanism.
virtual vrpn_int32 register_message_type(const char *name)
This structure is what is passed to a vrpn_Connection message callback.
const char * vrpn_got_first_connection
These are the strings that define the system-generated message types that tell when connections are r...