vrpn  07.33
Virtual Reality Peripheral Network
vrpn_FunctionGenerator.C
Go to the documentation of this file.
1 
2 #include <stdio.h> // for fflush, fprintf, stderr
3 #include <string.h> // for NULL, strlen, strcpy
4 
6 
7 //#define DEBUG_VRPN_FUNCTION_GENERATOR
8 
9 const char* vrpn_FUNCTION_MESSAGE_TYPE_CHANNEL = "vrpn_FunctionGenerator channel";
10 const char* vrpn_FUNCTION_MESSAGE_TYPE_CHANNEL_REQUEST = "vrpn_FunctionGenerator channel request";
11 const char* vrpn_FUNCTION_MESSAGE_TYPE_ALL_CHANNEL_REQUEST = "vrpn_FunctionGenerator all channel request";
12 const char* vrpn_FUNCTION_MESSAGE_TYPE_SAMPLE_RATE = "vrpn_FunctionGenerator sample rate";
13 const char* vrpn_FUNCTION_MESSAGE_TYPE_START = "vrpn_FunctionGenerator start";
14 const char* vrpn_FUNCTION_MESSAGE_TYPE_STOP = "vrpn_FunctionGenerator stop";
15 const char* vrpn_FUNCTION_MESSAGE_TYPE_CHANNEL_REPLY = "vrpn_FunctionGenerator channel reply";
16 const char* vrpn_FUNCTION_MESSAGE_TYPE_START_REPLY = "vrpn_FunctionGenerator start reply";
17 const char* vrpn_FUNCTION_MESSAGE_TYPE_STOP_REPLY = "vrpn_FunctionGenerator stop reply";
18 const char* vrpn_FUNCTION_MESSAGE_TYPE_SAMPLE_RATE_REPLY = "vrpn_FunctionGenerator sample rate reply";
19 const char* vrpn_FUNCTION_MESSAGE_TYPE_INTERPRETER_REQUEST = "vrpn_FunctionGenerator interpreter-description request";
20 const char* vrpn_FUNCTION_MESSAGE_TYPE_INTERPRETER_REPLY = "vrpn_FunctionGenerator interpreter-description reply";
21 const char* vrpn_FUNCTION_MESSAGE_TYPE_ERROR = "vrpn_FunctionGenerator error report";
22 
24 
27 //
28 // class vrpn_FunctionGenerator_function_NULL
29 
31 generateValues( vrpn_float32* buf, vrpn_uint32 nValues,
32  vrpn_float32 startTime, vrpn_float32 sampleRate,
34 {
35  for( vrpn_uint32 i = 0; i <= nValues - 1; i++ )
36  {
37  buf[i] = 0;
38  }
39  return startTime + nValues / sampleRate;
40 }
41 
42 
44 encode_to( char** , vrpn_int32& ) const
45 {
46  return 0;
47 }
48 
49 
51 decode_from( const char** , vrpn_int32& )
52 {
53  return 0;
54 }
55 
57 clone( ) const
58 {
60 }
61 
62 
63 //
64 // end vrpn_FunctionGenerator_function_NULL
67 
68 
71 //
72 // class vrpn_FunctionGenerator_function_script
75 : script( NULL )
76 {
77  this->script = new char[1];
78  script[0] = '\0';
79 }
80 
81 
84 {
85  this->script = new char[ strlen( script ) + 1 ];
86  strcpy( this->script, script );
87 }
88 
89 
92 {
93  this->script = new char[ strlen( s.script ) + 1 ];
94  strcpy( this->script, s.script );
95 }
96 
97 
100 {
101  if( script != NULL )
102  {
103  delete [] script;
104  script = NULL;
105  }
106 }
107 
109 generateValues( vrpn_float32* buf, vrpn_uint32 nValues, vrpn_float32 startTime,
110  vrpn_float32 sampleRate, vrpn_FunctionGenerator_channel* /*channel*/ ) const
111 {
112  for( vrpn_uint32 i = 0; i <= nValues - 1; i++ )
113  {
114  buf[i] = 0;
115  }
116  return startTime + nValues / sampleRate;
117 };
118 
119 
121 encode_to( char** buf, vrpn_int32& len ) const
122 {
123  vrpn_uint32 length = static_cast<vrpn_uint32>(strlen( this->script ));
124  vrpn_int32 bytes = length + sizeof( vrpn_uint32 );
125  if( len < bytes )
126  {
127  fprintf( stderr, "vrpn_FunctionGenerator_function_script::encode_to: "
128  "payload error (wanted %d got %d).\n", bytes, len );
129  fflush( stderr );
130  return -1;
131  }
132  if( 0 > vrpn_buffer( buf, &len, length ) )
133  {
134  fprintf( stderr, "vrpn_FunctionGenerator_function_script::encode_to: "
135  "payload error (couldn't buffer length).\n" );
136  fflush( stderr );
137  return -1;
138  }
139  if( 0 > vrpn_buffer( buf, &len, this->script, length ) )
140  {
141  fprintf( stderr, "vrpn_FunctionGenerator_function_script::encode_to: "
142  "payload error (couldn't buffer script).\n" );
143  fflush( stderr );
144  return -1;
145  }
146  return bytes;
147 }
148 
149 
151 decode_from( const char** buf, vrpn_int32& len )
152 {
153  vrpn_int32 newlen;
154  if( 0 > vrpn_unbuffer( buf, &newlen ) )
155  {
156  fprintf( stderr, "vrpn_FunctionGenerator_function_script::decode_from: "
157  "payload error (couldn't unbuffer length).\n" );
158  fflush( stderr );
159  return -1;
160  }
161  len -= sizeof( vrpn_uint32);
162 
163  if( len < newlen )
164  {
165  fprintf( stderr, "vrpn_FunctionGenerator_function_script::decode_from: "
166  "payload error (wanted %d got %d).\n", newlen, len );
167  fflush( stderr );
168  return -1;
169  }
170 
171  char* newscript = new char[ newlen + 1 ];
172  if( 0 > vrpn_unbuffer( buf, newscript, newlen ) )
173  {
174  fprintf( stderr, "vrpn_FunctionGenerator_function_script::decode_from: "
175  "payload error (couldn't unbuffer).\n" );
176  delete [] newscript;
177  fflush( stderr );
178  return -1;
179  }
180  newscript[newlen] = '\0';
181  if( this->script != NULL )
182  delete [] this->script;
183  this->script = newscript;
184  len -= newlen;
185  return newlen + sizeof( vrpn_uint32 );
186 }
187 
188 
190 clone( ) const
191 {
192  return new vrpn_FunctionGenerator_function_script( *this );
193 }
194 
196 getScript( ) const
197 {
198  char* retval = new char[ strlen( this->script ) + 1 ];
199  strcpy( retval, this->script );
200  return retval;
201 }
202 
203 
205 setScript( char* script )
206 {
207  if( script == NULL ) return false;
208  if( this->script != NULL )
209  delete [] this->script;
210  this->script = new char[ strlen( script ) + 1 ];
211  strcpy( this->script, script );
212  return true;
213 }
214 
215 //
216 // end vrpn_FunctionGenerator_function_script
219 
220 
223 //
224 // class vrpn_FunctionGenerator_channel
225 
228 {
229  function = new vrpn_FunctionGenerator_function_NULL( );
230 }
231 
232 
235 {
236  this->function = function->clone();
237 }
238 
239 
242 {
243  delete function;
244 }
245 
246 
249 {
250  delete (this->function);
251  this->function = function->clone();
252 }
253 
254 
256 encode_to( char** buf, vrpn_int32& len ) const
257 {
258  if( static_cast<unsigned>(len) < sizeof( vrpn_FunctionGenerator_function::FunctionCode ) )
259  {
260  fprintf( stderr, "vrpn_FunctionGenerator_channel::encode_to: "
261  "insufficient buffer space given (got %d, wanted %lud).\n",
262  len, static_cast<unsigned long>(sizeof( vrpn_FunctionGenerator_function::FunctionCode )) );
263  fflush( stderr );
264  return -1;
265  }
266  if( 0 > vrpn_buffer( buf, &len, (int) this->function->getFunctionCode() ) )
267  {
268  fprintf( stderr, "vrpn_FunctionGenerator_channel::encode_to: "
269  "unable to buffer function type.\n" );
270  fflush( stderr );
271  return -1;
272  }
273  return function->encode_to( buf, len );
274 }
275 
276 
278 decode_from( const char** buf, vrpn_int32& len )
279 {
280  if( static_cast<unsigned>(len) < sizeof( vrpn_FunctionGenerator_function::FunctionCode ) )
281  {
282  fprintf( stderr, "vrpn_FunctionGenerator_channel::decode_from: "
283  "insufficient buffer space given (got %d, wanted %lud).\n",
284  len, static_cast<unsigned long>(sizeof( vrpn_FunctionGenerator_function::FunctionCode )) );
285  fflush( stderr );
286  return -1;
287  }
288  int myCode;
289  if( 0 > vrpn_unbuffer( buf, &myCode ) )
290  {
291  fprintf( stderr, "vrpn_FunctionGenerator_channel::decode_from: "
292  "unable to unbuffer function type.\n" );
293  fflush( stderr );
294  return -1;
295  }
296  // if we don't have the right function type, create a new
297  // one of the appropriate type and delete the old one
298  if( myCode != function->getFunctionCode() )
299  {
300  vrpn_FunctionGenerator_function* oldFunc = this->function;
303  switch( newCode )
304  {
306  this->function = new vrpn_FunctionGenerator_function_NULL();
307  break;
309  this->function = new vrpn_FunctionGenerator_function_script();
310  break;
311  default:
312  fprintf( stderr, "vrpn_FunctionGenerator_channel::decode_from: "
313  "unknown function type.\n" );
314  fflush( stderr );
315  return -1;
316  }
317  delete oldFunc;
318  }
319  return this->function->decode_from( buf, len );
320 }
321 
322 //
323 // end vrpn_FunctionGenerator_channel
326 
327 
330 //
331 // class vrpn_FunctionGenerator
332 
334 vrpn_FunctionGenerator( const char* name, vrpn_Connection * c )
335 : vrpn_BaseClass( name, c ),
336  sampleRate( 0 ),
337  numChannels( 0 )
338 {
340 
341  unsigned i;
342  for( i = 0; i <= vrpn_FUNCTION_CHANNELS_MAX - 1; i++ )
343  {
345  }
346 }
347 
348 
351 {
352  unsigned i;
353  for( i = 0; i <= vrpn_FUNCTION_CHANNELS_MAX - 1; i++ )
354  {
355  delete channels[i];
356  }
357 }
358 
359 
361 getChannel( vrpn_uint32 channelNum )
362 {
363  if( channelNum > vrpn_FUNCTION_CHANNELS_MAX - 1 )
364  return NULL;
365  return channels[channelNum];
366 }
367 
368 
371 {
372 #ifdef DEBUG_VRPN_FUNCTION_GENERATOR
373  fprintf( stdout, "FG::register_types\n" );
374  fflush( stdout );
375 #endif
383 
390 
392 
393  if( channelMessageID == -1 || requestChannelMessageID == -1
400  || errorMessageID == -1 )
401  {
402  fprintf( stderr, "vrpn_FunctionGenerator::register_types: error registering types.\n" );
403  fflush( stderr );
404  return -1;
405  }
406  return 0;
407 }
408 
409 //
410 // end of vrpn_FunctionGenerator
411 //
414 
415 
416 
419 //
420 // vrpn_FunctionGenerator_Server
421 //
422 
424 vrpn_FunctionGenerator_Server( const char* name, vrpn_uint32 numChannels, vrpn_Connection * c )
425 : vrpn_FunctionGenerator( name, c )
426 {
427  this->numChannels = numChannels;
428  // Check if we have a connection
429  if( d_connection == NULL )
430  {
431  fprintf( stderr, "vrpn_FunctionGenerator_Server: Can't get connection!\n" );
432  fflush( stderr );
433  return;
434  }
435 
437  {
438  fprintf( stderr, "vrpn_FunctionGenerator_Server: can't register change channel request handler\n" );
439  fflush( stderr );
440  d_connection = NULL;
441  }
442 
444  {
445  fprintf( stderr, "vrpn_FunctionGenerator_Server: can't register channel request handler\n" );
446  fflush( stderr );
447  d_connection = NULL;
448  }
449 
451  {
452  fprintf( stderr, "vrpn_FunctionGenerator_Server: can't register all-channel request handler\n" );
453  fflush( stderr );
454  d_connection = NULL;
455  }
456 
458  {
459  fprintf( stderr, "vrpn_FunctionGenerator_Server: can't register start request handler\n" );
460  fflush( stderr );
461  d_connection = NULL;
462  }
463 
465  {
466  fprintf( stderr, "vrpn_FunctionGenerator_Server: can't register stop request handler\n" );
467  fflush( stderr );
468  d_connection = NULL;
469  }
470 
472  {
473  fprintf( stderr, "vrpn_FunctionGenerator_Server: can't register sample-rate request handler\n" );
474  fflush( stderr );
475  d_connection = NULL;
476  }
477 
479  {
480  fprintf( stderr, "vrpn_FunctionGenerator_Server: can't register interpreter request handler\n" );
481  fflush( stderr );
482  d_connection = NULL;
483  }
484 }
485 
486 
489 {
490 
491 }
492 
493 
495 setNumChannels( vrpn_uint32 numChannels )
496 {
499  this->numChannels = numChannels;
500  return this->numChannels;
501 }
502 
503 
506 {
507  // call the base class' server mainloop
508  server_mainloop( );
509 }
510 
511 
512 //static
515 {
516 #ifdef DEBUG_VRPN_FUNCTION_GENERATOR
517  fprintf( stdout, "FG::handle_channel_message\n" );
518  fflush( stdout );
519 #endif
522  vrpn_uint32 channelNum = vrpn_FUNCTION_CHANNELS_MAX + 1; // an invalid number
523  if( 0 > me->decode_channel( p.buffer, p.payload_len, channelNum, *channel ) )
524  {
525  if( channelNum < vrpn_FUNCTION_CHANNELS_MAX )
526  {
527  // the decode function was able to decode the channel
528  // number, but must have had some problem decoding the channel.
529  // let the remotes know the channel didn't change
530  me->sendChannelReply( channelNum );
531  }
532  // else, we couldn't even decode the channel number
533  }
534 
535  // let the server implementation see if this channel is acceptable
536  me->setChannel( channelNum, channel );
537  return 0;
538 }
539 
540 
541 //static
544 {
545 #ifdef DEBUG_VRPN_FUNCTION_GENERATOR
546  fprintf( stdout, "FG::handle_channelRequest_message\n" );
547  fflush( stdout );
548 #endif
550  vrpn_uint32 channelNum = vrpn_FUNCTION_CHANNELS_MAX + 1; // an invalid number
551  if( 0 > me->decode_channel_request( p.buffer, p.payload_len, channelNum ) )
552  {
553  // the decode failed
554  fprintf( stderr, "vrpn_FunctionGenerator_Server::handle_channelRequest_message: "
555  "unable to decode channel number.\n" );
556  fflush( stderr );
557  return -1;
558  }
559  if( channelNum > vrpn_FUNCTION_CHANNELS_MAX )
560  {
561  fprintf( stderr, "vrpn_FunctionGenerator_Server::handle_channelRequest_message: "
562  "invalid channel number %d.\n", channelNum );
563  fflush( stderr );
564  return -1;
565  }
566  me->sendChannelReply( channelNum );
567 
568  return 0;
569 }
570 
571 
572 //static
575 {
576 #ifdef DEBUG_VRPN_FUNCTION_GENERATOR
577  fprintf( stdout, "FG::handle_allChannelRequest_message\n" );
578  fflush( stdout );
579 #endif
581  unsigned i;
582  for( i = 0; i < vrpn_FUNCTION_CHANNELS_MAX; i++ )
583  {
584  // XXX will this work as-is, or do we need to
585  // force buffers to be flushed periodically?
586  me->sendChannelReply( i );
587  }
588  return 0;
589 }
590 
591 
592 //static
595 {
596 #ifdef DEBUG_VRPN_FUNCTION_GENERATOR
597  fprintf( stdout, "FG::handle_start_message\n" );
598  fflush( stdout );
599 #endif
601  me->start( );
602  return 0;
603 }
604 
605 
606 //static
609 {
610 #ifdef DEBUG_VRPN_FUNCTION_GENERATOR
611  fprintf( stdout, "FG::handle_stop_message\n" );
612  fflush( stdout );
613 #endif
615  me->stop( );
616  return 0;
617 }
618 
619 
620 //static
623 {
624 #ifdef DEBUG_VRPN_FUNCTION_GENERATOR
625  fprintf( stdout, "FG::handle_sample_rate_message\n" );
626  fflush( stdout );
627 #endif
629  vrpn_float32 rate = 0;
630  if( 0 > me->decode_sampleRate_request( p.buffer, p.payload_len, rate ) )
631  {
632  fprintf( stderr, "vrpn_FunctionGenerator_Server::handle_sample_rate_message: "
633  "unable to decode.\n" );
634  fflush( stderr );
635  me->sendSampleRateReply( );
636  return -1;
637  }
638  me->setSampleRate( rate );
639  return 0;
640 }
641 
642 
643 //static
646 {
647 #ifdef DEBUG_VRPN_FUNCTION_GENERATOR
648  fprintf( stdout, "FG::handle_interpreter_request_message\n" );
649  fflush( stdout );
650 #endif
653  return 0;
654 }
655 
656 
657 
659 sendChannelReply( vrpn_uint32 channelNum )
660 {
661 #ifdef DEBUG_VRPN_FUNCTION_GENERATOR
662  fprintf( stdout, "FG::sendChannelReply\n" );
663  fflush( stdout );
664 #endif
665  vrpn_gettimeofday( &timestamp, NULL );
666  if( this->d_connection )
667  {
668  int buflen = vrpn_CONNECTION_TCP_BUFLEN;
669  char* buf = &msgbuf[0];
670  if( 0 > this->encode_channel_reply( &buf, buflen, channelNum ) )
671  {
672  fprintf( stderr, "vrpn_FunctionGenerator_Server::sendChannelReply: "
673  "could not buffer message.\n" );
674  fflush( stderr );
675  return -1;
676  }
678  this->channelReplyMessageID, this->d_sender_id,
680  {
681  fprintf( stderr, "vrpn_FunctionGenerator_Server::sendChannelReply: "
682  "could not write message.\n" );
683  fflush( stderr );
684  return -1;
685  }
686  }
687  return 0;
688 }
689 
690 
693 {
694 #ifdef DEBUG_VRPN_FUNCTION_GENERATOR
695  fprintf( stdout, "FG::sendSampleRateReply\n" );
696  fflush( stdout );
697 #endif
698  vrpn_gettimeofday( &timestamp, NULL );
699  if( this->d_connection )
700  {
701  int buflen = vrpn_CONNECTION_TCP_BUFLEN;
702  char* buf = &msgbuf[0];
703  if( this->encode_sampleRate_reply( &buf, buflen, sampleRate ) )
704  {
705  fprintf( stderr, "vrpn_FunctionGenerator_Server::sendSampleRateReply: "
706  "could not buffer message.\n" );
707  fflush( stderr );
708  return -1;
709  }
711  this->sampleRateReplyMessageID, this->d_sender_id,
713  {
714  fprintf( stderr, "vrpn_FunctionGenerator_Server::sendSampleRateReply: "
715  "could not write message.\n" );
716  fflush( stderr );
717  return -1;
718  }
719  }
720  return 0;
721 }
722 
723 
725 sendStartReply( vrpn_bool started )
726 {
727 #ifdef DEBUG_VRPN_FUNCTION_GENERATOR
728  fprintf( stdout, "FG::sendStartReply\n" );
729  fflush( stdout );
730 #endif
731  vrpn_gettimeofday( &timestamp, NULL );
732  if( this->d_connection )
733  {
734  int buflen = vrpn_CONNECTION_TCP_BUFLEN;
735  char* buf = &msgbuf[0];
736  if( 0 > this->encode_start_reply( &buf, buflen, started ) )
737  {
738  fprintf( stderr, "vrpn_FunctionGenerator_Server::sendStartReply: "
739  "could not buffer message.\n" );
740  fflush( stderr );
741  return -1;
742  }
744  this->startFunctionReplyMessageID, this->d_sender_id,
746  {
747  fprintf( stderr, "vrpn_FunctionGenerator_Server::sendStartReply: "
748  "could not write message.\n" );
749  fflush( stderr );
750  return -1;
751  }
752  }
753  return 0;
754 }
755 
756 
758 sendStopReply( vrpn_bool stopped )
759 {
760 #ifdef DEBUG_VRPN_FUNCTION_GENERATOR
761  fprintf( stdout, "FG::sendStopReply\n" );
762  fflush( stdout );
763 #endif
764  vrpn_gettimeofday( &timestamp, NULL );
765  if( this->d_connection )
766  {
767  int buflen = vrpn_CONNECTION_TCP_BUFLEN;
768  char* buf = &msgbuf[0];
769  if( 0 > this->encode_stop_reply( &buf, buflen, stopped ) )
770  {
771  fprintf( stderr, "vrpn_FunctionGenerator_Server::sendStopReply: "
772  "could not buffer message.\n" );
773  fflush( stderr );
774  return -1;
775  }
777  this->stopFunctionReplyMessageID, this->d_sender_id,
779  {
780  fprintf( stderr, "vrpn_FunctionGenerator_Server::sendStopReply: "
781  "could not write message.\n" );
782  fflush( stderr );
783  return -1;
784  }
785  }
786  return 0;
787 }
788 
789 
792 {
793 #ifdef DEBUG_VRPN_FUNCTION_GENERATOR
794  fprintf( stdout, "FG::sendInterpreterDescription\n" );
795  fflush( stdout );
796 #endif
797  vrpn_gettimeofday( &timestamp, NULL );
798  if( this->d_connection )
799  {
800  int buflen = vrpn_CONNECTION_TCP_BUFLEN;
801  char* buf = &msgbuf[0];
802  if( 0 > this->encode_interpreterDescription_reply( &buf, buflen, getInterpreterDescription() ) )
803  {
804  fprintf( stderr, "vrpn_FunctionGenerator_Server::sendInterpreterDescription: "
805  "could not buffer message.\n" );
806  fflush( stderr );
807  return -1;
808  }
810  this->interpreterReplyMessageID, this->d_sender_id,
812  {
813  fprintf( stderr, "vrpn_FunctionGenerator_Server::sendInterpreterDescription: "
814  "could not write message.\n" );
815  fflush( stderr );
816  return -1;
817  }
818  }
819  return 0;
820 }
821 
822 
824 sendError( FGError error, vrpn_int32 channel )
825 {
826 #ifdef DEBUG_VRPN_FUNCTION_GENERATOR
827  fprintf( stdout, "FG::sendError\n" );
828  fflush( stdout );
829 #endif
830  vrpn_gettimeofday( &timestamp, NULL );
831  if( this->d_connection )
832  {
833  int buflen = vrpn_CONNECTION_TCP_BUFLEN;
834  char* buf = &msgbuf[0];
835  if( this->encode_error_report( &buf, buflen, error, channel ) )
836  {
837  fprintf( stderr, "vrpn_FunctionGenerator_Server::sendError: "
838  "could not buffer message.\n" );
839  fflush( stderr );
840  return -1;
841  }
843  this->errorMessageID, this->d_sender_id,
845  {
846  fprintf( stderr, "vrpn_FunctionGenerator_Server::sendError: "
847  "could not write message.\n" );
848  fflush( stderr );
849  return -1;
850  }
851  }
852  return 0;
853 }
854 
855 //
856 // end vrpn_FunctionGenerator_Server
857 // (except for encode and decode functions)
860 
861 
862 
863 
866 //
867 // vrpn_FunctionGenerator_Remote
868 //
869 
872 : vrpn_FunctionGenerator( name, c )
873 {
874  // Check if we have a connection
875  if( d_connection == NULL )
876  {
877  fprintf( stderr, "vrpn_FunctionGenerator_Remote: Can't get connection!\n" );
878  fflush( stderr );
879  return;
880  }
881 
883  {
884  fprintf( stderr, "vrpn_FunctionGenerator_Remote: can't register channel reply handler\n" );
885  fflush( stderr );
886  d_connection = NULL;
887  }
888 
890  {
891  fprintf( stderr, "vrpn_FunctionGenerator_Remote: can't register start reply handler\n" );
892  fflush( stderr );
893  d_connection = NULL;
894  }
895 
897  {
898  fprintf( stderr, "vrpn_FunctionGenerator_Remote: can't register stop reply handler\n" );
899  fflush( stderr );
900  d_connection = NULL;
901  }
902 
904  {
905  fprintf( stderr, "vrpn_FunctionGenerator_Remote: can't register sample-rate reply handler\n" );
906  fflush( stderr );
907  d_connection = NULL;
908  }
909 
911  {
912  fprintf( stderr, "vrpn_FunctionGenerator_Remote: can't register interpreter reply handler\n" );
913  fflush( stderr );
914  d_connection = NULL;
915  }
916 
918  {
919  fprintf( stderr, "vrpn_FunctionGenerator_Remote: can't register error message handler\n" );
920  fflush( stderr );
921  d_connection = NULL;
922  }
923 
924 }
925 
926 
928 setChannel( const vrpn_uint32 channelNum, const vrpn_FunctionGenerator_channel* channel )
929 {
930 #ifdef DEBUG_VRPN_FUNCTION_GENERATOR
931  fprintf( stdout, "FG::setChannel\n" );
932  fflush( stdout );
933 #endif
934  vrpn_gettimeofday( &timestamp, NULL );
935  if( this->d_connection )
936  {
937  int buflen = vrpn_CONNECTION_TCP_BUFLEN;
938  char* buf = &msgbuf[0];
939  if( 0 > this->encode_channel( &buf, buflen, channelNum, channel ) )
940  {
941  fprintf( stderr, "vrpn_FunctionGenerator_Remote::setChannel: "
942  "could not buffer message.\n" );
943  fflush( stderr );
944  return -1;
945  }
947  this->channelMessageID, this->d_sender_id, msgbuf,
949  {
950  fprintf( stderr, "vrpn_FunctionGenerator_Remote::setChannel: "
951  "could not write message.\n" );
952  fflush( stderr );
953  return -1;
954  }
955  }
956  else
957  {
958  fprintf( stderr, "vrpn_FunctionGenerator_Remote::setChannel: "
959  "no connection.\n" );
960  fflush( stderr );
961  return -1;
962  }
963  return 0;
964 }
965 
966 
968 requestChannel( const vrpn_uint32 channelNum )
969 {
970 #ifdef DEBUG_VRPN_FUNCTION_GENERATOR
971  fprintf( stdout, "FG::requestChannel\n" );
972  fflush( stdout );
973 #endif
974  vrpn_gettimeofday( &timestamp, NULL );
975  if( this->d_connection )
976  {
977  int buflen = vrpn_CONNECTION_TCP_BUFLEN;
978  char* buf = &msgbuf[0];
979  if( 0 > this->encode_channel_request( &buf, buflen, channelNum ) )
980  {
981  fprintf( stderr, "vrpn_FunctionGenerator_Remote::requestChannel: "
982  "could not buffer message.\n" );
983  fflush( stderr );
984  return -1;
985  }
987  this->requestChannelMessageID, this->d_sender_id, msgbuf,
989  {
990  fprintf( stderr, "vrpn_FunctionGenerator_Remote::requestChannel: "
991  "could not write message.\n" );
992  fflush( stderr );
993  return -1;
994  }
995  }
996  else
997  {
998  fprintf( stderr, "vrpn_FunctionGenerator_Remote::requestChannel: "
999  "no connection.\n" );
1000  fflush( stderr );
1001  return -1;
1002  }
1003  return 0;
1004 }
1005 
1006 
1007 
1010 {
1011 #ifdef DEBUG_VRPN_FUNCTION_GENERATOR
1012  fprintf( stdout, "FG::requestAllChannels\n" );
1013  fflush( stdout );
1014 #endif
1015  vrpn_gettimeofday( &timestamp, NULL );
1016  if( this->d_connection )
1017  {
1018  int buflen = vrpn_CONNECTION_TCP_BUFLEN;
1019  char* buf = &msgbuf[0];
1020  // nothing to encode; the message type is the symbol
1022  this->requestAllChannelsMessageID, this->d_sender_id, buf,
1024  {
1025  fprintf( stderr, "vrpn_FunctionGenerator_Remote::requestAllChannels: "
1026  "could not write message.\n" );
1027  fflush( stderr );
1028  return -1;
1029  }
1030  }
1031  else
1032  {
1033  fprintf( stderr, "vrpn_FunctionGenerator_Remote::requestAllChannels: "
1034  "no connection.\n" );
1035  fflush( stderr );
1036  return -1;
1037  }
1038  return 0;
1039 }
1040 
1041 
1044 {
1045 #ifdef DEBUG_VRPN_FUNCTION_GENERATOR
1046  fprintf( stdout, "FG::requestStart\n" );
1047  fflush( stdout );
1048 #endif
1049  vrpn_gettimeofday( &timestamp, NULL );
1050  if( this->d_connection )
1051  {
1052  int buflen = vrpn_CONNECTION_TCP_BUFLEN;
1053  char* buf = &msgbuf[0];
1054  // nothing to encode; the message type is the symbol
1056  this->startFunctionMessageID, this->d_sender_id, buf,
1058  {
1059  fprintf( stderr, "vrpn_FunctionGenerator_Remote::requestStart: "
1060  "could not write message.\n" );
1061  fflush( stderr );
1062  return -1;
1063  }
1064  }
1065  else
1066  {
1067  fprintf( stderr, "vrpn_FunctionGenerator_Remote::requestStart: "
1068  "no connection.\n" );
1069  fflush( stderr );
1070  return -1;
1071  }
1072  return 0;
1073 }
1074 
1075 
1078 {
1079 #ifdef DEBUG_VRPN_FUNCTION_GENERATOR
1080  fprintf( stdout, "FG::requestStop\n" );
1081  fflush( stdout );
1082 #endif
1083  vrpn_gettimeofday( &timestamp, NULL );
1084  if( this->d_connection )
1085  {
1086  int buflen = vrpn_CONNECTION_TCP_BUFLEN;
1087  char* buf = &msgbuf[0];
1088  // nothing to encode; the message type is the symbol
1090  this->stopFunctionMessageID, this->d_sender_id, buf,
1092  {
1093  fprintf( stderr, "vrpn_FunctionGenerator_Remote::requestStop: "
1094  "could not write message.\n" );
1095  fflush( stderr );
1096  return -1;
1097  }
1098  }
1099  else
1100  {
1101  fprintf( stderr, "vrpn_FunctionGenerator_Remote::requestStop: "
1102  "no connection.\n" );
1103  fflush( stderr );
1104  return -1;
1105  }
1106  return 0;
1107 }
1108 
1109 
1111 requestSampleRate( vrpn_float32 rate )
1112 {
1113 #ifdef DEBUG_VRPN_FUNCTION_GENERATOR
1114  fprintf( stdout, "FG::requestSampleRate\n" );
1115  fflush( stdout );
1116 #endif
1117  vrpn_gettimeofday( &timestamp, NULL );
1118  if( this->d_connection )
1119  {
1120  int buflen = vrpn_CONNECTION_TCP_BUFLEN;
1121  char* buf = &msgbuf[0];
1122  if( 0 > this->encode_sampleRate_request( &buf, buflen, rate ) )
1123  {
1124  fprintf( stderr, "vrpn_FunctionGenerator_Remote::requestSampleRate: "
1125  "could not buffer message.\n" );
1126  fflush( stderr );
1127  return -1;
1128  }
1130  this->sampleRateMessageID, this->d_sender_id, msgbuf,
1132  {
1133  fprintf( stderr, "vrpn_FunctionGenerator_Remote::requestSampleRate: "
1134  "could not write message.\n" );
1135  fflush( stderr );
1136  return -1;
1137  }
1138  }
1139  else
1140  {
1141  fprintf( stderr, "vrpn_FunctionGenerator_Remote::requestSampleRate: "
1142  "no connection.\n" );
1143  fflush( stderr );
1144  return -1;
1145  }
1146  return 0;
1147 }
1148 
1149 
1152 {
1153 #ifdef DEBUG_VRPN_FUNCTION_GENERATOR
1154  fprintf( stdout, "FG::requestInterpreterDescription\n" );
1155  fflush( stdout );
1156 #endif
1157  vrpn_gettimeofday( &timestamp, NULL );
1158  if( this->d_connection )
1159  {
1160  int buflen = vrpn_CONNECTION_TCP_BUFLEN;
1161  char* buf = &msgbuf[0];
1162  // nothing to encode; the message type is the symbol
1164  this->requestInterpreterMessageID, this->d_sender_id, buf,
1166  {
1167  fprintf( stderr, "vrpn_FunctionGenerator_Remote::requestInterpreterDescription: "
1168  "could not write message.\n" );
1169  fflush( stderr );
1170  return -1;
1171  }
1172  }
1173  else
1174  {
1175  fprintf( stderr, "vrpn_FunctionGenerator_Remote::requestInterpreterDescription: "
1176  "no connection.\n" );
1177  fflush( stderr );
1178  return -1;
1179  }
1180  return 0;
1181 }
1182 
1183 
1186 {
1187  if( d_connection != NULL )
1188  {
1189  d_connection->mainloop( );
1190  client_mainloop( );
1191  }
1192 }
1193 
1194 
1198 {
1200 }
1201 
1202 
1206 {
1208 }
1209 
1210 
1214 {
1216 }
1217 
1218 
1222 {
1224 }
1225 
1226 
1230 {
1232 }
1233 
1234 
1238 {
1240 }
1241 
1242 
1246 {
1248 }
1249 
1250 
1254 {
1256 }
1257 
1258 
1262 {
1264 }
1265 
1266 
1270 {
1272 }
1273 
1274 
1276 register_error_handler( void *userdata,
1277  vrpn_FUNCTION_ERROR_HANDLER handler )
1278 {
1280 }
1281 
1282 
1285  vrpn_FUNCTION_ERROR_HANDLER handler )
1286 {
1288 }
1289 
1290 
1291 //static
1294 {
1295 #ifdef DEBUG_VRPN_FUNCTION_GENERATOR
1296  fprintf( stdout, "FG::handle_channelReply_message\n" );
1297  fflush( stdout );
1298 #endif
1300  vrpn_uint32 channelNum = vrpn_FUNCTION_CHANNELS_MAX + 1; // an invalid number
1301  if( 0 > me->decode_channel_reply( p.buffer, p.payload_len, channelNum ) )
1302  {
1303  fprintf( stderr, "vrpn_FunctionGenerator_Remote::handle_channelReply_message: "
1304  "unable to decode.\n" );
1305  fflush( stderr );
1306  return -1;
1307  }
1308  if( channelNum >= vrpn_FUNCTION_CHANNELS_MAX )
1309  {
1310  fprintf( stderr, "vrpn_FunctionGenerator_Remote::handle_channelReply_message: "
1311  "invalid channel %d.\n", channelNum );
1312  fflush( stderr );
1313  return -1;
1314  }
1315 
1317  cb.msg_time.tv_sec = p.msg_time.tv_sec;
1318  cb.msg_time.tv_usec = p.msg_time.tv_usec;
1319  cb.channelNum = channelNum;
1320  cb.channel = me->channels[channelNum];
1321 
1323  return 0;
1324 }
1325 
1326 
1327 //static
1330 {
1331 #ifdef DEBUG_VRPN_FUNCTION_GENERATOR
1332  fprintf( stdout, "FG::handle_startReply_message\n" );
1333  fflush( stdout );
1334 #endif
1336  vrpn_bool isStarted = false;
1337  if( 0 > me->decode_start_reply( p.buffer, p.payload_len, isStarted ) )
1338  {
1339  fprintf( stderr, "vrpn_FunctionGenerator_Remote::handle_startReply_message: "
1340  "unable to decode.\n" );
1341  fflush( stderr );
1342  return -1;
1343  }
1344 
1346  cb.msg_time.tv_sec = p.msg_time.tv_sec;
1347  cb.msg_time.tv_usec = p.msg_time.tv_usec;
1348  cb.isStarted = isStarted;
1349 
1350  me->start_reply_list.call_handlers( cb );
1351  return 0;
1352 }
1353 
1354 
1355 //static
1358 {
1359 #ifdef DEBUG_VRPN_FUNCTION_GENERATOR
1360  fprintf( stdout, "FG::handle_stopReply_message\n" );
1361  fflush( stdout );
1362 #endif
1364  vrpn_bool isStopped = false;
1365  if( 0 > me->decode_stop_reply( p.buffer, p.payload_len, isStopped ) )
1366  {
1367  fprintf( stderr, "vrpn_FunctionGenerator_Remote::handle_stopReply_message: "
1368  "unable to decode.\n" );
1369  fflush( stderr );
1370  return -1;
1371  }
1372 
1374  cb.msg_time.tv_sec = p.msg_time.tv_sec;
1375  cb.msg_time.tv_usec = p.msg_time.tv_usec;
1376  cb.isStopped = isStopped;
1377 
1378  me->stop_reply_list.call_handlers( cb );
1379  return 0;
1380 }
1381 
1382 
1383 //static
1386 {
1387 #ifdef DEBUG_VRPN_FUNCTION_GENERATOR
1388  fprintf( stdout, "FG::handle_sampleRateReply_message\n" );
1389  fflush( stdout );
1390 #endif
1392  if( 0 > me->decode_sampleRate_reply( p.buffer, p.payload_len ) )
1393  {
1394  fprintf( stderr, "vrpn_FunctionGenerator_Remote::handle_sampleRateReply_message: "
1395  "unable to decode.\n" );
1396  fflush( stderr );
1397  return -1;
1398  }
1399 
1401  cb.msg_time.tv_sec = p.msg_time.tv_sec;
1402  cb.msg_time.tv_usec = p.msg_time.tv_usec;
1403  cb.sampleRate = me->sampleRate;
1404 
1406  return 0;
1407 }
1408 
1409 
1410 //static
1413 {
1414 #ifdef DEBUG_VRPN_FUNCTION_GENERATOR
1415  fprintf( stdout, "FG::handle_interpreterReply_message\n" );
1416  fflush( stdout );
1417 #endif
1421  {
1422  fprintf( stderr, "vrpn_FunctionGenerator_Remote::handle_interpreterReply_message: "
1423  "unable to decode.\n" );
1424  fflush( stderr );
1425  return -1;
1426  }
1427 
1428  cb.msg_time.tv_sec = p.msg_time.tv_sec;
1429  cb.msg_time.tv_usec = p.msg_time.tv_usec;
1430 
1432  return 0;
1433 }
1434 
1435 
1436 // static
1439 {
1440 #ifdef DEBUG_VRPN_FUNCTION_GENERATOR
1441  fprintf( stdout, "FG::handle_error_message\n" );
1442  fflush( stdout );
1443 #endif
1446  if( 0 > me->decode_error_reply( p.buffer, p.payload_len, cb.err, cb.channel ) )
1447  {
1448  fprintf( stderr, "vrpn_FunctionGenerator_Remote::handle_error_message: "
1449  "unable to decode.\n" );
1450  fflush( stderr );
1451  return -1;
1452  }
1453 
1454  cb.msg_time.tv_sec = p.msg_time.tv_sec;
1455  cb.msg_time.tv_usec = p.msg_time.tv_usec;
1456 
1457  me->error_list.call_handlers( cb );
1458  return 0;
1459 }
1460 
1461 //
1462 // end vrpn_FunctionGenerator_Remote
1463 // (except for encode and decode functions)
1466 
1467 
1468 
1471 //
1472 // encode and decode functions for
1473 // vrpn_FunctionGenerator_Server and
1474 // vrpn_FunctionGenerator_Remote
1475 //
1476 
1478 encode_channel( char** buf, vrpn_int32& len, const vrpn_uint32 channelNum,
1479  const vrpn_FunctionGenerator_channel* channel )
1480 {
1481 #ifdef DEBUG_VRPN_FUNCTION_GENERATOR
1482  fprintf( stdout, "FG::encode_channel\n" );
1483  fflush( stdout );
1484 #endif
1485  if( channelNum > vrpn_FUNCTION_CHANNELS_MAX )
1486  {
1487  fprintf( stderr, "vrpn_FunctionGenerator_Remote::encode_channel: "
1488  "invalid channel nubmer %d.\n", channelNum );
1489  fflush( stderr );
1490  return -1;
1491  }
1492  if( static_cast<unsigned>(len) < sizeof( vrpn_uint32 ) )
1493  {
1494  // the channel's encode_to function will check that the length is
1495  // sufficient for the channel's info, so just check that we can
1496  // at least encode the channel number.
1497  fprintf( stderr, "vrpn_FunctionGenerator_Remote::encode_channel: "
1498  "couldn't buffer (got %d, wanted at least %lud).\n",
1499  len, static_cast<unsigned long>(sizeof( vrpn_int32)) );
1500  fflush( stderr );
1501  return -1;
1502  }
1503  if( 0 > vrpn_buffer( buf, &len, channelNum ) )
1504  {
1505  fprintf( stderr, "vrpn_FunctionGenerator_Remote::encode_channel: "
1506  "message payload error (couldn't buffer channel number).\n" );
1507  fflush( stderr );
1508  return -1;
1509  }
1510  if( 0 > channel->encode_to( buf, len ) )
1511  {
1512  fprintf( stderr, "vrpn_FunctionGenerator_Remote::encode_channel: "
1513  "message payload error (couldn't buffer channel).\n" );
1514  fflush( stderr );
1515  return -1;
1516  }
1517  return 0;
1518 }
1519 
1520 
1522 decode_channel( const char* buf, const vrpn_int32 len, vrpn_uint32& channelNum,
1524 {
1525 #ifdef DEBUG_VRPN_FUNCTION_GENERATOR
1526  fprintf( stdout, "FG::decode_channel\n" );
1527  fflush( stdout );
1528 #endif
1529  if( static_cast<unsigned>(len) < sizeof( vrpn_uint32 ) )
1530  {
1531  // the channel's decode_from function will check that the length is
1532  // sufficient for the channel's info, so just check that we can
1533  // at least decode the channel number.
1534  fprintf( stderr, "vrpn_FunctionGenerator_Server::decode_channel: "
1535  "channel message payload error (got %d, wanted at least %lud).\n",
1536  len, static_cast<unsigned long>(sizeof( vrpn_int32)) );
1537  fflush( stderr );
1538  return -1;
1539  }
1540  const char* mybuf = buf;
1541  vrpn_int32 mylen = len;
1542  vrpn_uint32 myNum = 0;
1543  if( 0 > vrpn_unbuffer( &mybuf, &myNum ) )
1544  {
1545  fprintf( stderr, "vrpn_FunctionGenerator_Server::decode_channel: "
1546  "message payload error (couldn't unbuffer)\n" );
1547  fflush( stderr );
1548  return -1;
1549  }
1550  mylen -= sizeof( myNum );
1551  channelNum = myNum;
1552  if( 0 > channel.decode_from( &mybuf, mylen ) )
1553  {
1554  fprintf( stderr, "vrpn_FunctionGenerator_Server::decode_channel: "
1555  "error while decoding channel %d\n", channelNum );
1556  fflush( stderr );
1557  return -1;
1558  }
1559 
1560  return 0;
1561 }
1562 
1563 
1565 encode_channel_reply( char** buf, vrpn_int32& len, const vrpn_uint32 channelNum )
1566 {
1567 #ifdef DEBUG_VRPN_FUNCTION_GENERATOR
1568  fprintf( stdout, "FG::encode_channel_reply\n" );
1569  fflush( stdout );
1570 #endif
1571  if( channelNum >= vrpn_FUNCTION_CHANNELS_MAX )
1572  {
1573  fprintf( stderr, "vrpn_FunctionGenerator_Server::encode_channel_reply: "
1574  "invalid channel\n" );
1575  fflush( stderr );
1576  return -1;
1577  }
1578  if( static_cast<unsigned>(len) < sizeof( vrpn_uint32 ) )
1579  {
1580  // the channel's encode_to function will check that the length is
1581  // sufficient for the channel's info, so just check that we can
1582  // at least encode the channel number.
1583  fprintf( stderr, "vrpn_FunctionGenerator_Server::encode_channel_reply: "
1584  "insufficient buffer space given (got %d, wanted %lud).\n",
1585  len, static_cast<unsigned long>(sizeof( vrpn_uint32)) );
1586  fflush( stderr );
1587  return -1;
1588  }
1589  if( 0 > vrpn_buffer( buf, &len, channelNum ) )
1590  {
1591  fprintf( stderr, "vrpn_FunctionGenerator_Server::encode_channel_reply: "
1592  "unable to buffer channel number.\n" );
1593  fflush( stderr );
1594  return -1;
1595  }
1596  if( 0 > channels[channelNum]->encode_to( buf, len ) )
1597  {
1598  fprintf( stderr, "vrpn_FunctionGenerator_Server::encode_channel_reply: "
1599  "unable to encode channel.\n" );
1600  fflush( stderr );
1601  return -1;
1602  }
1603  return 0;
1604 }
1605 
1606 
1608 decode_channel_reply( const char* buf, const vrpn_int32 len, vrpn_uint32& channelNum )
1609 {
1610 #ifdef DEBUG_VRPN_FUNCTION_GENERATOR
1611  fprintf( stdout, "FG::decode_channel_reply\n" );
1612  fflush( stdout );
1613 #endif
1614  if( static_cast<unsigned>(len) < sizeof( vrpn_uint32 ) )
1615  {
1616  // the channel's decode_to function will check that the length is
1617  // sufficient for the channel's info, so just check that we can
1618  // at least decode the channel number.
1619  fprintf( stderr, "vrpn_FunctionGenerator_Remote::decode_channel_reply: "
1620  "insufficient buffer space given (got %d, wanted %lud).\n",
1621  len, static_cast<unsigned long>(sizeof( vrpn_uint32)) );
1622  fflush( stderr );
1623  return -1;
1624  }
1625  const char* mybuf = buf;
1626  vrpn_int32 mylen = len;
1627  vrpn_uint32 myNum = 0;
1628  if( 0 > vrpn_unbuffer( &mybuf, &myNum ) )
1629  {
1630  fprintf( stderr, "vrpn_FunctionGenerator_Remote::decode_channel_reply: "
1631  "unable to unbuffer channel number.\n" );
1632  fflush( stderr );
1633  return -1;
1634  }
1635  if( myNum >= vrpn_FUNCTION_CHANNELS_MAX )
1636  {
1637  fprintf( stderr, "vrpn_FunctionGenerator_Remote::decode_channel_reply: "
1638  "invalid channel: %d\n", myNum );
1639  fflush( stderr );
1640  return -1;
1641  }
1642  channelNum = myNum;
1643  mylen -= sizeof( vrpn_uint32 );
1644  return channels[channelNum]->decode_from( &mybuf, mylen );
1645 }
1646 
1647 
1649 encode_channel_request( char** buf, vrpn_int32& len, const vrpn_uint32 channelNum )
1650 {
1651 #ifdef DEBUG_VRPN_FUNCTION_GENERATOR
1652  fprintf( stdout, "FG::encode_channel_request\n" );
1653  fflush( stdout );
1654 #endif
1655  if( static_cast<unsigned>(len) < sizeof( vrpn_uint32 ) )
1656  {
1657  fprintf( stderr, "vrpn_FunctionGenerator_Remote::encode_channel_request: "
1658  "channel message payload error (got %d, wanted at least %lud).\n",
1659  len, static_cast<unsigned long>(sizeof( vrpn_int32)) );
1660  fflush( stderr );
1661  return -1;
1662  }
1663  vrpn_int32 mylen = len;
1664  if( 0 > vrpn_buffer( buf, &mylen, channelNum ) )
1665  {
1666  fprintf( stderr, "vrpn_FunctionGenerator_Remote::encode_channel_request: "
1667  "unable to buffer channel %d", channelNum );
1668  fflush( stderr );
1669  return -1;
1670  }
1671  len = mylen;
1672  return 0;
1673 }
1674 
1675 
1677 decode_channel_request( const char* buf, const vrpn_int32 len, vrpn_uint32& channelNum )
1678 {
1679 #ifdef DEBUG_VRPN_FUNCTION_GENERATOR
1680  fprintf( stdout, "FG::decode_channel_request\n" );
1681  fflush( stdout );
1682 #endif
1683  if( static_cast<unsigned>(len) < sizeof( vrpn_uint32 ) )
1684  {
1685  // the channel's encode_to function will check that the length is
1686  // sufficient for the channel's info, so just check that we can
1687  // at least encode the channel number.
1688  fprintf( stderr, "vrpn_FunctionGenerator_Server::decode_channel_request: "
1689  "channel message payload error (got %d, wanted at least %lud).\n",
1690  len, static_cast<unsigned long>(sizeof( vrpn_int32)) );
1691  fflush( stderr );
1692  return -1;
1693  }
1694  const char* mybuf = buf;
1695  if( 0 > vrpn_unbuffer( &mybuf, &channelNum ) )
1696  {
1697  fprintf( stderr, "vrpn_FunctionGenerator_Server::decode_channel_request: "
1698  "unable to unbuffer channel %d", channelNum );
1699  fflush( stderr );
1700  return -1;
1701  }
1702  return 0;
1703 }
1704 
1705 
1707 encode_sampleRate_request( char** buf, vrpn_int32& len, const vrpn_float32 sampleRate )
1708 {
1709 #ifdef DEBUG_VRPN_FUNCTION_GENERATOR
1710  fprintf( stdout, "FG::encode_sampleRate_request\n" );
1711  fflush( stdout );
1712 #endif
1713  if( static_cast<unsigned>(len) < sizeof( vrpn_float32 ) )
1714  {
1715  fprintf( stderr, "vrpn_FunctionGenerator_Remote::encode_sampleRate_request: "
1716  "channel message payload error (got %d, wanted at least %lud).\n",
1717  len, static_cast<unsigned long>(sizeof( vrpn_float32)) );
1718  fflush( stderr );
1719  return -1;
1720  }
1721  vrpn_int32 mylen = len;
1722  if( 0 > vrpn_buffer( buf, &mylen, sampleRate ) )
1723  {
1724  fprintf( stderr, "vrpn_FunctionGenerator_Remote::encode_sampleRate_request: "
1725  "unable to buffer sample rate" );
1726  fflush( stderr );
1727  return -1;
1728  }
1729  len = mylen;
1730  return 0;
1731 }
1732 
1733 
1735 decode_sampleRate_request( const char* buf, const vrpn_int32 len, vrpn_float32& sampleRate )
1736 {
1737 #ifdef DEBUG_VRPN_FUNCTION_GENERATOR
1738  fprintf( stdout, "FG::decode_sampleRate_request\n" );
1739  fflush( stdout );
1740 #endif
1741  if( static_cast<unsigned>(len) < sizeof( vrpn_float32 ) )
1742  {
1743  fprintf( stderr, "vrpn_FunctionGenerator_Server::decode_sampleRate_request: "
1744  "channel message payload error (got %d, wanted at least %lud).\n",
1745  len, static_cast<unsigned long>(sizeof( vrpn_float32)) );
1746  fflush( stderr );
1747  return -1;
1748  }
1749  const char* mybuf = buf;
1750  if( 0 > vrpn_unbuffer( &mybuf, &sampleRate ) )
1751  {
1752  fprintf( stderr, "vrpn_FunctionGenerator_Server::decode_sampleRate_request: "
1753  "unable to unbuffer sample rate" );
1754  fflush( stderr );
1755  return -1;
1756  }
1757  return 0;
1758 }
1759 
1760 
1762 encode_start_reply( char** buf, vrpn_int32& len, const vrpn_bool isStarted )
1763 {
1764 #ifdef DEBUG_VRPN_FUNCTION_GENERATOR
1765  fprintf( stdout, "FG::encode_start_reply\n" );
1766  fflush( stdout );
1767 #endif
1768  if( static_cast<unsigned>(len) < sizeof( vrpn_bool ) )
1769  {
1770  fprintf( stderr, "vrpn_FunctionGenerator_Server::encode_start_reply: "
1771  "insufficient buffer space given (got %d, wanted %lud).\n",
1772  len, static_cast<unsigned long>(sizeof( vrpn_bool)) );
1773  fflush( stderr );
1774  return -1;
1775  }
1776  return vrpn_buffer( buf, &len, isStarted );
1777 }
1778 
1779 
1781 decode_start_reply( const char* buf, const vrpn_int32 len, vrpn_bool& isStarted )
1782 {
1783 #ifdef DEBUG_VRPN_FUNCTION_GENERATOR
1784  fprintf( stdout, "FG::decode_start_reply\n" );
1785  fflush( stdout );
1786 #endif
1787  if( static_cast<unsigned>(len) < sizeof( vrpn_bool ) )
1788  {
1789  fprintf( stderr, "vrpn_FunctionGenerator_Remote::decode_start_reply: "
1790  "insufficient buffer space given (got %d, wanted %lud).\n",
1791  len, static_cast<unsigned long>(sizeof( vrpn_bool)) );
1792  fflush( stderr );
1793  return -1;
1794  }
1795  const char* mybuf = buf;
1796  if( 0 > vrpn_unbuffer( &mybuf, &isStarted ) )
1797  {
1798  fprintf( stderr, "vrpn_FunctionGenerator_Remote::decode_start_reply: "
1799  "unable to unbuffer stop condition.\n" );
1800  fflush( stderr );
1801  return -1;
1802  }
1803  return 0;
1804 }
1805 
1806 
1808 encode_stop_reply( char** buf, vrpn_int32& len, const vrpn_bool isStopped )
1809 {
1810 #ifdef DEBUG_VRPN_FUNCTION_GENERATOR
1811  fprintf( stdout, "FG::encode_stop_reply\n" );
1812  fflush( stdout );
1813 #endif
1814  if( static_cast<unsigned>(len) < sizeof( vrpn_bool ) )
1815  {
1816  fprintf( stderr, "vrpn_FunctionGenerator_Server::encode_stop_reply: "
1817  "insufficient buffer space given (got %d, wanted %lud).\n",
1818  len, static_cast<unsigned long>(sizeof( vrpn_bool)) );
1819  fflush( stderr );
1820  return -1;
1821  }
1822  return vrpn_buffer( buf, &len, isStopped );
1823 }
1824 
1825 
1827 decode_stop_reply( const char* buf, const vrpn_int32 len, vrpn_bool& isStopped )
1828 {
1829 #ifdef DEBUG_VRPN_FUNCTION_GENERATOR
1830  fprintf( stdout, "FG::decode_stop_reply\n" );
1831  fflush( stdout );
1832 #endif
1833  if( static_cast<unsigned>(len) < sizeof( vrpn_bool ) )
1834  {
1835  fprintf( stderr, "vrpn_FunctionGenerator_Remote::decode_stop_reply: "
1836  "insufficient buffer space given (got %d, wanted %lud).\n",
1837  len, static_cast<unsigned long>(sizeof( vrpn_bool)) );
1838  fflush( stderr );
1839  return -1;
1840  }
1841  if( 0 > vrpn_unbuffer( &buf, &isStopped ) )
1842  {
1843  fprintf( stderr, "vrpn_FunctionGenerator_Remote::decode_stop_reply: "
1844  "unable to unbuffer stop condition.\n" );
1845  fflush( stderr );
1846  return -1;
1847  }
1848  return 0;
1849 }
1850 
1851 
1853 encode_sampleRate_reply( char** buf, vrpn_int32& len, const vrpn_float32 sampleRate )
1854 {
1855 #ifdef DEBUG_VRPN_FUNCTION_GENERATOR
1856  fprintf( stdout, "FG::encode_sampleRate_reply\n" );
1857  fflush( stdout );
1858 #endif
1859  if( static_cast<unsigned>(len) < sizeof( vrpn_float32 ) )
1860  {
1861  fprintf( stderr, "vrpn_FunctionGenerator_Server::encode_sampleRate_reply: "
1862  "insufficient buffer space given (got %d, wanted %lud).\n",
1863  len, static_cast<unsigned long>(sizeof( vrpn_float32)) );
1864  fflush( stderr );
1865  return -1;
1866  }
1867  return vrpn_buffer( buf, &len, sampleRate );
1868 }
1869 
1870 
1872 decode_sampleRate_reply( const char* buf, const vrpn_int32 len )
1873 {
1874 #ifdef DEBUG_VRPN_FUNCTION_GENERATOR
1875  fprintf( stdout, "FG::decode_sampleRate_reply\n" );
1876  fflush( stdout );
1877 #endif
1878  if( static_cast<unsigned>(len) < sizeof( vrpn_float32 ) )
1879  {
1880  fprintf( stderr, "vrpn_FunctionGenerator_Remote::decode_sampleRate_reply: "
1881  "insufficient buffer space given (got %d, wanted %lud).\n",
1882  len, static_cast<unsigned long>(sizeof( vrpn_float32)) );
1883  fflush( stderr );
1884  return -1;
1885  }
1886  vrpn_float32 myRate = 0;
1887  if( 0 > vrpn_unbuffer( &buf, &myRate ) )
1888  {
1889  fprintf( stderr, "vrpn_FunctionGenerator_Remote::decode_sampleRate_reply: "
1890  "unable to unbuffer sample rate.\n" );
1891  fflush( stderr );
1892  return -1;
1893  }
1894  this->sampleRate = myRate;
1895  return 0;
1896 }
1897 
1898 
1900 encode_interpreterDescription_reply( char** buf, vrpn_int32& len, const char* desc )
1901 {
1902 #ifdef DEBUG_VRPN_FUNCTION_GENERATOR
1903  fprintf( stdout, "FG::encode_interpreterDescription_reply\n" );
1904  fflush( stdout );
1905 #endif
1906  vrpn_int32 dlength = static_cast<vrpn_int32>(strlen( desc ));
1907  if( len < dlength + (vrpn_int32) sizeof( vrpn_int32 ) )
1908  {
1909  fprintf( stderr, "vrpn_FunctionGenerator_Server::encode_interpreterDescription_reply: "
1910  "insufficient buffer space given (got %d, wanted %lud).\n",
1911  len, dlength + static_cast<unsigned long>(sizeof( vrpn_int32 )) );
1912  fflush( stderr );
1913  return -1;
1914  }
1915  if( 0 > vrpn_buffer( buf, &len, dlength ) )
1916  {
1917  fprintf( stderr, "vrpn_FunctionGenerator_Server::encode_interpreterDescription_reply: "
1918  "unable to buffer description length.\n" );
1919  fflush( stderr );
1920  return -1;
1921  }
1922 
1923  return vrpn_buffer( buf, &len, desc, dlength );
1924 }
1925 
1926 
1928 decode_interpreterDescription_reply( const char* buf, const vrpn_int32 len, char** desc )
1929 {
1930 #ifdef DEBUG_VRPN_FUNCTION_GENERATOR
1931  fprintf( stdout, "FG::decode_interpreterDescription_reply\n" );
1932  fflush( stdout );
1933 #endif
1934  if( static_cast<unsigned>(len) < sizeof( vrpn_int32 ) )
1935  {
1936  fprintf( stderr, "vrpn_FunctionGenerator_Remote::decode_interpreterDescription_reply: "
1937  "insufficient buffer space given (got %d, wanted at least %lud).\n",
1938  len, static_cast<unsigned long>(sizeof( vrpn_int32)) );
1939  fflush( stderr );
1940  return -1;
1941  }
1942  vrpn_int32 dlength = 0;
1943  if( 0 > vrpn_unbuffer( &buf, &dlength ) )
1944  {
1945  fprintf( stderr, "vrpn_FunctionGenerator_Remote::decode_interpreterDescription_reply: "
1946  "unable to unbuffer description length.\n" );
1947  fflush( stderr );
1948  return -1;
1949  }
1950  *desc = new char[ dlength + 1 ];
1951  int retval = vrpn_unbuffer( &buf, *desc, dlength );
1952  (*desc)[dlength] = '\0';
1953  return retval;
1954 }
1955 
1956 
1958 encode_error_report( char** buf, vrpn_int32& len, const FGError error, const vrpn_int32 channel )
1959 {
1960 #ifdef DEBUG_VRPN_FUNCTION_GENERATOR
1961  fprintf( stdout, "FG::encode_error_report\n" );
1962  fflush( stdout );
1963 #endif
1964  if( static_cast<unsigned>(len) < sizeof( FGError ) + sizeof( vrpn_int32 ) )
1965  {
1966  fprintf( stderr, "vrpn_FunctionGenerator_Server::encode_error_report: "
1967  "insufficient buffer space given (got %d, wanted %lud).\n",
1968  len, static_cast<unsigned long>(sizeof( FGError) + sizeof( vrpn_int32 )) );
1969  fflush( stderr );
1970  return -1;
1971  }
1972  vrpn_int32 mylen = len;
1973  if( 0 > vrpn_buffer( buf, &mylen, error ) || 0 > vrpn_buffer( buf, &mylen, channel ) )
1974  {
1975  fprintf( stderr, "vrpn_FunctionGenerator_Server::encode_error_report: "
1976  "unable to buffer error & channel" );
1977  fflush( stderr );
1978  return -1;
1979  }
1980  len = mylen;
1981  return 0;
1982 }
1983 
1984 
1986 decode_error_reply( const char* buf, const vrpn_int32 len, FGError& error, vrpn_int32& channel )
1987 {
1988 #ifdef DEBUG_VRPN_FUNCTION_GENERATOR
1989  fprintf( stdout, "FG::decode_error_reply\n" );
1990  fflush( stdout );
1991 #endif
1992  if( static_cast<unsigned>(len) < sizeof( FGError ) + sizeof( vrpn_int32 ) )
1993  {
1994  fprintf( stderr, "vrpn_FunctionGenerator_Remote::decode_error_reply: "
1995  "insufficient buffer space given (got %d, wanted %lud).\n",
1996  len, static_cast<unsigned long>(sizeof( FGError) + sizeof( vrpn_int32 )) );
1997  fflush( stderr );
1998  return -1;
1999  }
2000  int myError = NO_FG_ERROR;
2001  vrpn_int32 myChannel = -1;
2002  if( 0 > vrpn_unbuffer( &buf, &myError )
2003  || 0 > vrpn_unbuffer( &buf, &myChannel ) )
2004  {
2005  fprintf( stderr, "vrpn_FunctionGenerator_Remote::decode_error_reply: "
2006  "unable to unbuffer error & channel.\n" );
2007  fflush( stderr );
2008  return -1;
2009  }
2010  error = FGError( myError );
2011  channel = myChannel;
2012  return 0;
2013 }
2014 
2015 
2016 
2017 //
2018 // end encode & decode functions for
2019 // vrpn_FunctionGenerator_Remote and
2020 // vrpn_FunctionGenerator_Server
2022 
vrpn_FunctionGenerator_channel::decode_from
vrpn_int32 decode_from(const char **buf, vrpn_int32 &len)
Definition: vrpn_FunctionGenerator.C:278
vrpn_FunctionGenerator_Remote::register_error_handler
virtual int register_error_handler(void *userdata, vrpn_FUNCTION_ERROR_HANDLER handler)
Definition: vrpn_FunctionGenerator.C:1276
vrpn_FunctionGenerator_Remote::handle_channelReply_message
static int VRPN_CALLBACK handle_channelReply_message(void *userdata, vrpn_HANDLERPARAM p)
Definition: vrpn_FunctionGenerator.C:1293
vrpn_FunctionGenerator::channels
vrpn_FunctionGenerator_channel * channels[vrpn_FUNCTION_CHANNELS_MAX]
Definition: vrpn_FunctionGenerator.h:185
vrpn_FunctionGenerator_Server::decode_sampleRate_request
vrpn_int32 decode_sampleRate_request(const char *buf, const vrpn_int32 len, vrpn_float32 &sampleRate)
Definition: vrpn_FunctionGenerator.C:1735
vrpn_BaseClassUnique::register_autodeleted_handler
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.
Definition: vrpn_BaseClass.C:503
vrpn_FunctionGenerator_Remote::decode_interpreterDescription_reply
vrpn_int32 decode_interpreterDescription_reply(const char *buf, const vrpn_int32 len, char **desc)
Definition: vrpn_FunctionGenerator.C:1928
vrpn_Connection::pack_message
virtual int pack_message(vrpn_uint32 len, struct timeval time, vrpn_int32 type, vrpn_int32 sender, const char *buffer, vrpn_uint32 class_of_service)
Pack a message that will be sent the next time mainloop() is called. Turn off the RELIABLE flag if yo...
Definition: vrpn_Connection.C:4632
vrpn_FunctionGenerator::FGError
FGError
Definition: vrpn_FunctionGenerator.h:173
vrpn_FunctionGenerator_Remote::sample_rate_reply_list
vrpn_Callback_List< vrpn_FUNCTION_SAMPLE_RATE_REPLY_CB > sample_rate_reply_list
Definition: vrpn_FunctionGenerator.h:409
vrpn_BaseClassUnique::client_mainloop
void client_mainloop(void)
Handles functions that all clients should provide in their mainloop() (warning of no server,...
Definition: vrpn_BaseClass.C:637
vrpn_FunctionGenerator_Server::handle_channel_message
static int VRPN_CALLBACK handle_channel_message(void *userdata, vrpn_HANDLERPARAM p)
Definition: vrpn_FunctionGenerator.C:514
vrpn_FunctionGenerator::errorMessageID
vrpn_int32 errorMessageID
Definition: vrpn_FunctionGenerator.h:200
vrpn_FunctionGenerator_Remote::requestAllChannels
int requestAllChannels()
Definition: vrpn_FunctionGenerator.C:1009
vrpn_FunctionGenerator::NO_FG_ERROR
Definition: vrpn_FunctionGenerator.h:175
vrpn_got_connection
const char * vrpn_got_connection
Definition: vrpn_Connection.C:185
vrpn_FunctionGenerator_Server::handle_sample_rate_message
static int VRPN_CALLBACK handle_sample_rate_message(void *userdata, vrpn_HANDLERPARAM p)
Definition: vrpn_FunctionGenerator.C:622
vrpn_FUNCTION_CHANNEL_REPLY_CB::msg_time
struct timeval msg_time
Definition: vrpn_FunctionGenerator.h:281
vrpn_FunctionGenerator_function_NULL::clone
vrpn_FunctionGenerator_function * clone() const
Definition: vrpn_FunctionGenerator.C:57
vrpn_FUNCTION_ERROR_CB::channel
vrpn_int32 channel
Definition: vrpn_FunctionGenerator.h:341
vrpn_FunctionGenerator::requestInterpreterMessageID
vrpn_int32 requestInterpreterMessageID
Definition: vrpn_FunctionGenerator.h:193
vrpn_FunctionGenerator_Remote::unregister_stop_reply_handler
virtual int unregister_stop_reply_handler(void *userdata, vrpn_FUNCTION_STOP_REPLY_HANDLER handler)
Definition: vrpn_FunctionGenerator.C:1236
vrpn_FUNCTION_INTERPRETER_REPLY_HANDLER
void(VRPN_CALLBACK * vrpn_FUNCTION_INTERPRETER_REPLY_HANDLER)(void *userdata, const vrpn_FUNCTION_INTERPRETER_REPLY_CB info)
Definition: vrpn_FunctionGenerator.h:330
vrpn_FUNCTION_CHANNEL_REPLY_CB::channel
vrpn_FunctionGenerator_channel * channel
Definition: vrpn_FunctionGenerator.h:283
vrpn_FunctionGenerator_function_script::vrpn_FunctionGenerator_function_script
vrpn_FunctionGenerator_function_script()
Definition: vrpn_FunctionGenerator.C:74
vrpn_FunctionGenerator_function_script::generateValues
virtual vrpn_float32 generateValues(vrpn_float32 *buf, vrpn_uint32 nValues, vrpn_float32 startTime, vrpn_float32 sampleRate, vrpn_FunctionGenerator_channel *channel) const
Definition: vrpn_FunctionGenerator.C:109
vrpn_FunctionGenerator_Server::sendStopReply
int sendStopReply(vrpn_bool stopped)
Definition: vrpn_FunctionGenerator.C:758
vrpn_FUNCTION_START_REPLY_CB
Definition: vrpn_FunctionGenerator.h:291
vrpn_FunctionGenerator_Server::handle_stop_message
static int VRPN_CALLBACK handle_stop_message(void *userdata, vrpn_HANDLERPARAM p)
Definition: vrpn_FunctionGenerator.C:608
vrpn_FunctionGenerator::register_types
virtual int register_types()
Register the types of messages this device sends/receives. Return 0 on success, -1 on fail.
Definition: vrpn_FunctionGenerator.C:370
vrpn_FunctionGenerator.h
vrpn_FunctionGenerator_Remote::handle_startReply_message
static int VRPN_CALLBACK handle_startReply_message(void *userdata, vrpn_HANDLERPARAM p)
Definition: vrpn_FunctionGenerator.C:1329
vrpn_FunctionGenerator_Server::handle_channelRequest_message
static int VRPN_CALLBACK handle_channelRequest_message(void *userdata, vrpn_HANDLERPARAM p)
Definition: vrpn_FunctionGenerator.C:543
vrpn_FunctionGenerator::sampleRateReplyMessageID
vrpn_int32 sampleRateReplyMessageID
Definition: vrpn_FunctionGenerator.h:198
vrpn_FUNCTION_START_REPLY_CB::isStarted
vrpn_bool isStarted
Definition: vrpn_FunctionGenerator.h:294
vrpn_FunctionGenerator_Remote::mainloop
virtual void mainloop()
Called once through each main loop iteration to handle updates. Remote object mainloop() should call ...
Definition: vrpn_FunctionGenerator.C:1185
vrpn_FunctionGenerator_Remote::requestStart
int requestStart()
Definition: vrpn_FunctionGenerator.C:1043
vrpn_FUNCTION_STOP_REPLY_CB
Definition: vrpn_FunctionGenerator.h:302
vrpn_FunctionGenerator
Definition: vrpn_FunctionGenerator.h:158
vrpn_FunctionGenerator_function::FUNCTION_SCRIPT
Definition: vrpn_FunctionGenerator.h:71
vrpn_FunctionGenerator_function_script::encode_to
vrpn_int32 encode_to(char **buf, vrpn_int32 &len) const
Definition: vrpn_FunctionGenerator.C:121
vrpn_FunctionGenerator_Remote::channel_reply_list
vrpn_Callback_List< vrpn_FUNCTION_CHANNEL_REPLY_CB > channel_reply_list
Definition: vrpn_FunctionGenerator.h:406
vrpn_FunctionGenerator_function::FunctionCode
FunctionCode
Definition: vrpn_FunctionGenerator.h:68
vrpn_FunctionGenerator::requestChannelMessageID
vrpn_int32 requestChannelMessageID
Definition: vrpn_FunctionGenerator.h:188
vrpn_FunctionGenerator_Remote::interpreter_reply_list
vrpn_Callback_List< vrpn_FUNCTION_INTERPRETER_REPLY_CB > interpreter_reply_list
Definition: vrpn_FunctionGenerator.h:410
vrpn_FUNCTION_MESSAGE_TYPE_CHANNEL_REPLY
const char * vrpn_FUNCTION_MESSAGE_TYPE_CHANNEL_REPLY
Definition: vrpn_FunctionGenerator.C:15
vrpn_FunctionGenerator_Server::encode_error_report
vrpn_int32 encode_error_report(char **buf, vrpn_int32 &len, const FGError err, const vrpn_int32 channel)
Definition: vrpn_FunctionGenerator.C:1958
vrpn_FUNCTION_MESSAGE_TYPE_INTERPRETER_REPLY
const char * vrpn_FUNCTION_MESSAGE_TYPE_INTERPRETER_REPLY
Definition: vrpn_FunctionGenerator.C:20
vrpn_BaseClassUnique::userdata
void * userdata
Definition: vrpn_BaseClass.h:287
vrpn_FUNCTION_MESSAGE_TYPE_START
const char * vrpn_FUNCTION_MESSAGE_TYPE_START
Definition: vrpn_FunctionGenerator.C:13
vrpn_FUNCTION_MESSAGE_TYPE_ALL_CHANNEL_REQUEST
const char * vrpn_FUNCTION_MESSAGE_TYPE_ALL_CHANNEL_REQUEST
Definition: vrpn_FunctionGenerator.C:11
vrpn_FunctionGenerator_Server::sendInterpreterDescription
int sendInterpreterDescription()
Definition: vrpn_FunctionGenerator.C:791
vrpn_FunctionGenerator_function_script::clone
vrpn_FunctionGenerator_function * clone() const
Definition: vrpn_FunctionGenerator.C:190
vrpn_FunctionGenerator_Remote::encode_channel
vrpn_int32 encode_channel(char **buf, vrpn_int32 &len, const vrpn_uint32 channelNum, const vrpn_FunctionGenerator_channel *channel)
Definition: vrpn_FunctionGenerator.C:1478
vrpn_FunctionGenerator::startFunctionMessageID
vrpn_int32 startFunctionMessageID
Definition: vrpn_FunctionGenerator.h:191
vrpn_FunctionGenerator_Remote::unregister_interpreter_reply_handler
virtual int unregister_interpreter_reply_handler(void *userdata, vrpn_FUNCTION_INTERPRETER_REPLY_HANDLER handler)
Definition: vrpn_FunctionGenerator.C:1268
vrpn_FunctionGenerator_Remote::stop_reply_list
vrpn_Callback_List< vrpn_FUNCTION_STOP_REPLY_CB > stop_reply_list
Definition: vrpn_FunctionGenerator.h:408
vrpn_FunctionGenerator::sampleRateMessageID
vrpn_int32 sampleRateMessageID
Definition: vrpn_FunctionGenerator.h:190
vrpn_FunctionGenerator_Remote::encode_channel_request
vrpn_int32 encode_channel_request(char **buf, vrpn_int32 &len, const vrpn_uint32 channelNum)
Definition: vrpn_FunctionGenerator.C:1649
vrpn_FunctionGenerator_Remote::register_stop_reply_handler
virtual int register_stop_reply_handler(void *userdata, vrpn_FUNCTION_STOP_REPLY_HANDLER handler)
Definition: vrpn_FunctionGenerator.C:1228
vrpn_HANDLERPARAM::payload_len
vrpn_int32 payload_len
Definition: vrpn_Connection.h:48
vrpn_FunctionGenerator_function::getFunctionCode
virtual FunctionCode getFunctionCode() const =0
vrpn_FUNCTION_ERROR_HANDLER
void(VRPN_CALLBACK * vrpn_FUNCTION_ERROR_HANDLER)(void *userdata, const vrpn_FUNCTION_ERROR_CB info)
Definition: vrpn_FunctionGenerator.h:343
vrpn_FunctionGenerator_Remote::unregister_channel_reply_handler
virtual int unregister_channel_reply_handler(void *userdata, vrpn_FUNCTION_CHANGE_REPLY_HANDLER handler)
Definition: vrpn_FunctionGenerator.C:1204
vrpn_FunctionGenerator_function_NULL::encode_to
vrpn_int32 encode_to(char **buf, vrpn_int32 &len) const
Definition: vrpn_FunctionGenerator.C:44
vrpn_FUNCTION_MESSAGE_TYPE_STOP
const char * vrpn_FUNCTION_MESSAGE_TYPE_STOP
Definition: vrpn_FunctionGenerator.C:14
vrpn_FunctionGenerator_Server::setSampleRate
virtual void setSampleRate(vrpn_float32 rate)=0
vrpn_CONNECTION_TCP_BUFLEN
const int vrpn_CONNECTION_TCP_BUFLEN
Definition: vrpn_Connection.h:95
vrpn_FunctionGenerator_Server::sendChannelReply
int sendChannelReply(vrpn_uint32 channelNum)
Definition: vrpn_FunctionGenerator.C:659
vrpn_FunctionGenerator_Server::sendStartReply
int sendStartReply(vrpn_bool started)
Definition: vrpn_FunctionGenerator.C:725
vrpn_FUNCTION_MESSAGE_TYPE_CHANNEL_REQUEST
const char * vrpn_FUNCTION_MESSAGE_TYPE_CHANNEL_REQUEST
Definition: vrpn_FunctionGenerator.C:10
vrpn_FunctionGenerator::msgbuf
char msgbuf[vrpn_CONNECTION_TCP_BUFLEN]
Definition: vrpn_FunctionGenerator.h:206
vrpn_Callback_List::register_handler
int register_handler(void *userdata, HANDLER_TYPE handler)
Call this to add a handler to the list.
Definition: vrpn_BaseClass.h:391
vrpn_FunctionGenerator_Remote::handle_stopReply_message
static int VRPN_CALLBACK handle_stopReply_message(void *userdata, vrpn_HANDLERPARAM p)
Definition: vrpn_FunctionGenerator.C:1357
vrpn_unbuffer
VRPN_API int vrpn_unbuffer(const char **buffer, timeval *t)
Utility routine for taking a struct timeval from a buffer that was sent as a message.
Definition: vrpn_Shared.C:312
vrpn_FunctionGenerator_function::~vrpn_FunctionGenerator_function
virtual ~vrpn_FunctionGenerator_function()=0
Definition: vrpn_FunctionGenerator.C:23
vrpn_FunctionGenerator_Server::encode_start_reply
vrpn_int32 encode_start_reply(char **buf, vrpn_int32 &len, const vrpn_bool isStarted)
Definition: vrpn_FunctionGenerator.C:1762
vrpn_FUNCTION_SAMPLE_RATE_REPLY_CB::sampleRate
vrpn_float32 sampleRate
Definition: vrpn_FunctionGenerator.h:316
vrpn_FUNCTION_INTERPRETER_REPLY_CB
Definition: vrpn_FunctionGenerator.h:325
vrpn_BaseClassUnique::d_connection
vrpn_Connection * d_connection
Connection that this object talks to.
Definition: vrpn_BaseClass.h:224
vrpn_FUNCTION_MESSAGE_TYPE_START_REPLY
const char * vrpn_FUNCTION_MESSAGE_TYPE_START_REPLY
Definition: vrpn_FunctionGenerator.C:16
vrpn_FunctionGenerator_Remote::register_start_reply_handler
virtual int register_start_reply_handler(void *userdata, vrpn_FUNCTION_START_REPLY_HANDLER handler)
Definition: vrpn_FunctionGenerator.C:1212
vrpn_FunctionGenerator_function
Definition: vrpn_FunctionGenerator.h:34
vrpn_FunctionGenerator::requestAllChannelsMessageID
vrpn_int32 requestAllChannelsMessageID
Definition: vrpn_FunctionGenerator.h:189
vrpn_FUNCTION_CHANNEL_REPLY_CB
Definition: vrpn_FunctionGenerator.h:279
vrpn_HANDLERPARAM::buffer
const char * buffer
Definition: vrpn_Connection.h:49
vrpn_Connection::register_message_type
virtual vrpn_int32 register_message_type(const char *name)
Definition: vrpn_Connection.C:5074
vrpn_FunctionGenerator_Remote
Definition: vrpn_FunctionGenerator.h:347
vrpn_FunctionGenerator::gotConnectionMessageID
vrpn_int32 gotConnectionMessageID
Definition: vrpn_FunctionGenerator.h:202
vrpn_FunctionGenerator_channel::vrpn_FunctionGenerator_channel
vrpn_FunctionGenerator_channel()
Definition: vrpn_FunctionGenerator.C:227
vrpn_FUNCTION_START_REPLY_CB::msg_time
struct timeval msg_time
Definition: vrpn_FunctionGenerator.h:293
vrpn_FunctionGenerator_function_script::~vrpn_FunctionGenerator_function_script
virtual ~vrpn_FunctionGenerator_function_script()
Definition: vrpn_FunctionGenerator.C:99
vrpn_FunctionGenerator_Remote::decode_error_reply
vrpn_int32 decode_error_reply(const char *buf, const vrpn_int32 len, FGError &error, vrpn_int32 &channel)
Definition: vrpn_FunctionGenerator.C:1986
vrpn_FUNCTION_MESSAGE_TYPE_CHANNEL
const char * vrpn_FUNCTION_MESSAGE_TYPE_CHANNEL
Definition: vrpn_FunctionGenerator.C:9
vrpn_CONNECTION_RELIABLE
const vrpn_uint32 vrpn_CONNECTION_RELIABLE
Classes of service for messages, specify multiple by ORing them together Priority of satisfying these...
Definition: vrpn_Connection.h:120
vrpn_HANDLERPARAM
This structure is what is passed to a vrpn_Connection message callback.
Definition: vrpn_Connection.h:44
vrpn_FUNCTION_STOP_REPLY_HANDLER
void(VRPN_CALLBACK * vrpn_FUNCTION_STOP_REPLY_HANDLER)(void *userdata, const vrpn_FUNCTION_STOP_REPLY_CB info)
Definition: vrpn_FunctionGenerator.h:307
vrpn_FunctionGenerator_Remote::register_channel_reply_handler
virtual int register_channel_reply_handler(void *userdata, vrpn_FUNCTION_CHANGE_REPLY_HANDLER handler)
Definition: vrpn_FunctionGenerator.C:1196
vrpn_FunctionGenerator_Remote::decode_stop_reply
vrpn_int32 decode_stop_reply(const char *buf, const vrpn_int32 len, vrpn_bool &isStopped)
Definition: vrpn_FunctionGenerator.C:1827
vrpn_FunctionGenerator_channel::setFunction
void setFunction(vrpn_FunctionGenerator_function *function)
Definition: vrpn_FunctionGenerator.C:248
vrpn_FunctionGenerator_channel::function
vrpn_FunctionGenerator_function * function
Definition: vrpn_FunctionGenerator.h:153
vrpn_FunctionGenerator_Remote::handle_interpreterReply_message
static int VRPN_CALLBACK handle_interpreterReply_message(void *userdata, vrpn_HANDLERPARAM p)
Definition: vrpn_FunctionGenerator.C:1412
vrpn_FunctionGenerator_Server::encode_channel_reply
vrpn_int32 encode_channel_reply(char **buf, vrpn_int32 &len, const vrpn_uint32 channelNum)
Definition: vrpn_FunctionGenerator.C:1565
vrpn_FUNCTION_ERROR_CB::msg_time
struct timeval msg_time
Definition: vrpn_FunctionGenerator.h:339
vrpn_BaseClassUnique::d_sender_id
vrpn_int32 d_sender_id
Sender ID registered with the connection.
Definition: vrpn_BaseClass.h:228
vrpn_FUNCTION_SAMPLE_RATE_REPLY_CB
Definition: vrpn_FunctionGenerator.h:313
vrpn_FunctionGenerator_channel
Definition: vrpn_FunctionGenerator.h:136
vrpn_FunctionGenerator_Server::sendError
int sendError(FGError error, vrpn_int32 channel)
Definition: vrpn_FunctionGenerator.C:824
vrpn_FunctionGenerator_Server::handle_start_message
static int VRPN_CALLBACK handle_start_message(void *userdata, vrpn_HANDLERPARAM p)
Definition: vrpn_FunctionGenerator.C:594
vrpn_FunctionGenerator_Remote::requestStop
int requestStop()
Definition: vrpn_FunctionGenerator.C:1077
vrpn_FunctionGenerator_Remote::register_sample_rate_reply_handler
virtual int register_sample_rate_reply_handler(void *userdata, vrpn_FUNCTION_SAMPLE_RATE_REPLY_HANDLER handler)
Definition: vrpn_FunctionGenerator.C:1244
vrpn_FUNCTION_ERROR_CB
Definition: vrpn_FunctionGenerator.h:337
vrpn_FunctionGenerator_function_script::decode_from
vrpn_int32 decode_from(const char **buf, vrpn_int32 &len)
Definition: vrpn_FunctionGenerator.C:151
vrpn_FunctionGenerator_function_NULL::generateValues
vrpn_float32 generateValues(vrpn_float32 *buf, vrpn_uint32 nValues, vrpn_float32 startTime, vrpn_float32 sampleRate, vrpn_FunctionGenerator_channel *channel) const
Definition: vrpn_FunctionGenerator.C:31
vrpn_FunctionGenerator_Remote::register_interpreter_reply_handler
virtual int register_interpreter_reply_handler(void *userdata, vrpn_FUNCTION_INTERPRETER_REPLY_HANDLER handler)
Definition: vrpn_FunctionGenerator.C:1260
vrpn_FunctionGenerator_Remote::requestSampleRate
int requestSampleRate(const vrpn_float32 rate)
Definition: vrpn_FunctionGenerator.C:1111
vrpn_FunctionGenerator_Server
Definition: vrpn_FunctionGenerator.h:211
vrpn_FunctionGenerator::numChannels
vrpn_uint32 numChannels
Definition: vrpn_FunctionGenerator.h:184
vrpn_FunctionGenerator_Server::start
virtual void start()=0
vrpn_Connection::mainloop
virtual int mainloop(const struct timeval *timeout=NULL)=0
Call each time through program main loop to handle receiving any incoming messages and sending any pa...
vrpn_FUNCTION_STOP_REPLY_CB::msg_time
struct timeval msg_time
Definition: vrpn_FunctionGenerator.h:304
vrpn_HANDLERPARAM::msg_time
struct timeval msg_time
Definition: vrpn_Connection.h:47
vrpn_FunctionGenerator_Remote::requestChannel
int requestChannel(const vrpn_uint32 channelNum)
Definition: vrpn_FunctionGenerator.C:968
vrpn_FUNCTION_SAMPLE_RATE_REPLY_HANDLER
void(VRPN_CALLBACK * vrpn_FUNCTION_SAMPLE_RATE_REPLY_HANDLER)(void *userdata, const vrpn_FUNCTION_SAMPLE_RATE_REPLY_CB info)
Definition: vrpn_FunctionGenerator.h:318
vrpn_FunctionGenerator_Server::setNumChannels
vrpn_uint32 setNumChannels(vrpn_uint32 numChannels)
Definition: vrpn_FunctionGenerator.C:495
vrpn_Connection
Generic connection class not specific to the transport mechanism.
Definition: vrpn_Connection.h:510
vrpn_FunctionGenerator_Remote::requestInterpreterDescription
int requestInterpreterDescription()
Definition: vrpn_FunctionGenerator.C:1151
vrpn_FunctionGenerator_Remote::error_list
vrpn_Callback_List< vrpn_FUNCTION_ERROR_CB > error_list
Definition: vrpn_FunctionGenerator.h:411
vrpn_FUNCTION_MESSAGE_TYPE_SAMPLE_RATE_REPLY
const char * vrpn_FUNCTION_MESSAGE_TYPE_SAMPLE_RATE_REPLY
Definition: vrpn_FunctionGenerator.C:18
vrpn_FunctionGenerator::interpreterReplyMessageID
vrpn_int32 interpreterReplyMessageID
Definition: vrpn_FunctionGenerator.h:199
vrpn_FunctionGenerator_Remote::decode_start_reply
vrpn_int32 decode_start_reply(const char *buf, const vrpn_int32 len, vrpn_bool &isStarted)
Definition: vrpn_FunctionGenerator.C:1781
vrpn_FunctionGenerator::stopFunctionReplyMessageID
vrpn_int32 stopFunctionReplyMessageID
Definition: vrpn_FunctionGenerator.h:197
vrpn_gettimeofday
#define vrpn_gettimeofday
Definition: vrpn_Shared.h:89
vrpn_FunctionGenerator_Server::getInterpreterDescription
virtual const char * getInterpreterDescription()=0
vrpn_FUNCTION_CHANGE_REPLY_HANDLER
void(VRPN_CALLBACK * vrpn_FUNCTION_CHANGE_REPLY_HANDLER)(void *userdata, const vrpn_FUNCTION_CHANNEL_REPLY_CB info)
Definition: vrpn_FunctionGenerator.h:285
vrpn_FUNCTION_ERROR_CB::err
vrpn_FunctionGenerator::FGError err
Definition: vrpn_FunctionGenerator.h:340
vrpn_FunctionGenerator_function_script::script
char * script
Definition: vrpn_FunctionGenerator.h:131
vrpn_FunctionGenerator::channelMessageID
vrpn_int32 channelMessageID
Definition: vrpn_FunctionGenerator.h:187
vrpn_FUNCTION_MESSAGE_TYPE_INTERPRETER_REQUEST
const char * vrpn_FUNCTION_MESSAGE_TYPE_INTERPRETER_REQUEST
Definition: vrpn_FunctionGenerator.C:19
vrpn_FunctionGenerator_Remote::decode_sampleRate_reply
vrpn_int32 decode_sampleRate_reply(const char *buf, const vrpn_int32 len)
Definition: vrpn_FunctionGenerator.C:1872
vrpn_FunctionGenerator_Server::sendSampleRateReply
int sendSampleRateReply()
Definition: vrpn_FunctionGenerator.C:692
vrpn_FUNCTION_STOP_REPLY_CB::isStopped
vrpn_bool isStopped
Definition: vrpn_FunctionGenerator.h:305
vrpn_FunctionGenerator_Server::encode_interpreterDescription_reply
vrpn_int32 encode_interpreterDescription_reply(char **buf, vrpn_int32 &len, const char *desc)
Definition: vrpn_FunctionGenerator.C:1900
vrpn_FunctionGenerator_Remote::handle_error_message
static int VRPN_CALLBACK handle_error_message(void *userdata, vrpn_HANDLERPARAM p)
Definition: vrpn_FunctionGenerator.C:1438
vrpn_FUNCTION_CHANNELS_MAX
const vrpn_uint32 vrpn_FUNCTION_CHANNELS_MAX
Definition: vrpn_FunctionGenerator.h:14
vrpn_FunctionGenerator_function::FUNCTION_NULL
Definition: vrpn_FunctionGenerator.h:70
vrpn_FunctionGenerator_channel::encode_to
vrpn_int32 encode_to(char **buf, vrpn_int32 &len) const
Definition: vrpn_FunctionGenerator.C:256
vrpn_FunctionGenerator::channelReplyMessageID
vrpn_int32 channelReplyMessageID
Definition: vrpn_FunctionGenerator.h:195
vrpn_FUNCTION_INTERPRETER_REPLY_CB::description
char * description
Definition: vrpn_FunctionGenerator.h:328
vrpn_FunctionGenerator_Remote::unregister_sample_rate_reply_handler
virtual int unregister_sample_rate_reply_handler(void *userdata, vrpn_FUNCTION_SAMPLE_RATE_REPLY_HANDLER handler)
Definition: vrpn_FunctionGenerator.C:1252
vrpn_FUNCTION_INTERPRETER_REPLY_CB::msg_time
struct timeval msg_time
Definition: vrpn_FunctionGenerator.h:327
vrpn_FunctionGenerator_function::decode_from
virtual vrpn_int32 decode_from(const char **buf, vrpn_int32 &len)=0
VRPN_CALLBACK
#define VRPN_CALLBACK
Definition: vrpn_Configure.h:647
vrpn_FunctionGenerator_Server::encode_stop_reply
vrpn_int32 encode_stop_reply(char **buf, vrpn_int32 &len, const vrpn_bool isStopped)
Definition: vrpn_FunctionGenerator.C:1808
vrpn_FunctionGenerator_function_NULL::decode_from
vrpn_int32 decode_from(const char **buf, vrpn_int32 &len)
Definition: vrpn_FunctionGenerator.C:51
vrpn_FunctionGenerator_function_script::setScript
vrpn_bool setScript(char *script)
Definition: vrpn_FunctionGenerator.C:205
vrpn_FunctionGenerator::startFunctionReplyMessageID
vrpn_int32 startFunctionReplyMessageID
Definition: vrpn_FunctionGenerator.h:196
vrpn_FUNCTION_MESSAGE_TYPE_ERROR
const char * vrpn_FUNCTION_MESSAGE_TYPE_ERROR
Definition: vrpn_FunctionGenerator.C:21
vrpn_FunctionGenerator_function_NULL
Definition: vrpn_FunctionGenerator.h:83
vrpn_FUNCTION_MESSAGE_TYPE_SAMPLE_RATE
const char * vrpn_FUNCTION_MESSAGE_TYPE_SAMPLE_RATE
Definition: vrpn_FunctionGenerator.C:12
vrpn_FunctionGenerator_Remote::encode_sampleRate_request
vrpn_int32 encode_sampleRate_request(char **buf, vrpn_int32 &len, const vrpn_float32 sampleRate)
Definition: vrpn_FunctionGenerator.C:1707
vrpn_FunctionGenerator_Server::~vrpn_FunctionGenerator_Server
virtual ~vrpn_FunctionGenerator_Server()
Definition: vrpn_FunctionGenerator.C:488
vrpn_FunctionGenerator_channel::~vrpn_FunctionGenerator_channel
virtual ~vrpn_FunctionGenerator_channel()
Definition: vrpn_FunctionGenerator.C:241
vrpn_BaseClass::init
virtual int init(void)
Initialize things that the constructor can't. Returns 0 on success, -1 on failure.
Definition: vrpn_BaseClass.C:363
vrpn_FunctionGenerator_Server::decode_channel
vrpn_int32 decode_channel(const char *buf, const vrpn_int32 len, vrpn_uint32 &channelNum, vrpn_FunctionGenerator_channel &channel)
Definition: vrpn_FunctionGenerator.C:1522
vrpn_FunctionGenerator::stopFunctionMessageID
vrpn_int32 stopFunctionMessageID
Definition: vrpn_FunctionGenerator.h:192
vrpn_FunctionGenerator::sampleRate
vrpn_float32 sampleRate
Definition: vrpn_FunctionGenerator.h:183
vrpn_FunctionGenerator::timestamp
struct timeval timestamp
Definition: vrpn_FunctionGenerator.h:207
vrpn_FunctionGenerator_Server::stop
virtual void stop()=0
vrpn_buffer
VRPN_API int vrpn_buffer(char **insertPt, vrpn_int32 *buflen, const timeval t)
Utility routine for placing a timeval struct into a buffer that is to be sent as a message.
Definition: vrpn_Shared.C:241
vrpn_FUNCTION_START_REPLY_HANDLER
void(VRPN_CALLBACK * vrpn_FUNCTION_START_REPLY_HANDLER)(void *userdata, const vrpn_FUNCTION_START_REPLY_CB info)
Definition: vrpn_FunctionGenerator.h:296
vrpn_FUNCTION_SAMPLE_RATE_REPLY_CB::msg_time
struct timeval msg_time
Definition: vrpn_FunctionGenerator.h:315
vrpn_FunctionGenerator::getChannel
const vrpn_FunctionGenerator_channel * getChannel(vrpn_uint32 channelNum)
Definition: vrpn_FunctionGenerator.C:361
vrpn_FunctionGenerator_Server::vrpn_FunctionGenerator_Server
vrpn_FunctionGenerator_Server(const char *name, vrpn_uint32 numChannels=vrpn_FUNCTION_CHANNELS_MAX, vrpn_Connection *c=NULL)
Definition: vrpn_FunctionGenerator.C:424
vrpn_FunctionGenerator_Remote::decode_channel_reply
vrpn_int32 decode_channel_reply(const char *buf, const vrpn_int32 len, vrpn_uint32 &channelNum)
Definition: vrpn_FunctionGenerator.C:1608
vrpn_FunctionGenerator_Remote::handle_sampleRateReply_message
static int VRPN_CALLBACK handle_sampleRateReply_message(void *userdata, vrpn_HANDLERPARAM p)
Definition: vrpn_FunctionGenerator.C:1385
vrpn_FunctionGenerator_Server::mainloop
virtual void mainloop()
Called once through each main loop iteration to handle updates. Remote object mainloop() should call ...
Definition: vrpn_FunctionGenerator.C:505
vrpn_Callback_List::call_handlers
void call_handlers(const CALLBACK_STRUCT &info)
This will pass the referenced parameter as a const to all the callbacks.
Definition: vrpn_BaseClass.h:451
vrpn_FunctionGenerator_Server::handle_interpreter_request_message
static int VRPN_CALLBACK handle_interpreter_request_message(void *userdata, vrpn_HANDLERPARAM p)
Definition: vrpn_FunctionGenerator.C:645
vrpn_Callback_List::unregister_handler
int unregister_handler(void *userdata, HANDLER_TYPE handler)
Call this to remove a handler from the list (if it exists)
Definition: vrpn_BaseClass.h:420
vrpn_FunctionGenerator_Server::encode_sampleRate_reply
vrpn_int32 encode_sampleRate_reply(char **buf, vrpn_int32 &len, const vrpn_float32 sampleRate)
Definition: vrpn_FunctionGenerator.C:1853
vrpn_FunctionGenerator_function_script
Definition: vrpn_FunctionGenerator.h:103
vrpn_FunctionGenerator_Remote::setChannel
int setChannel(const vrpn_uint32 channelNum, const vrpn_FunctionGenerator_channel *channel)
Definition: vrpn_FunctionGenerator.C:928
vrpn_FunctionGenerator_Server::setChannel
virtual void setChannel(vrpn_uint32 channelNum, vrpn_FunctionGenerator_channel *channel)=0
vrpn_FunctionGenerator_Remote::start_reply_list
vrpn_Callback_List< vrpn_FUNCTION_START_REPLY_CB > start_reply_list
Definition: vrpn_FunctionGenerator.h:407
vrpn_FunctionGenerator_Remote::unregister_start_reply_handler
virtual int unregister_start_reply_handler(void *userdata, vrpn_FUNCTION_START_REPLY_HANDLER handler)
Definition: vrpn_FunctionGenerator.C:1220
vrpn_FUNCTION_MESSAGE_TYPE_STOP_REPLY
const char * vrpn_FUNCTION_MESSAGE_TYPE_STOP_REPLY
Definition: vrpn_FunctionGenerator.C:17
vrpn_FunctionGenerator_function_NULL::vrpn_FunctionGenerator_function_NULL
vrpn_FunctionGenerator_function_NULL()
Definition: vrpn_FunctionGenerator.h:87
vrpn_FunctionGenerator::~vrpn_FunctionGenerator
virtual ~vrpn_FunctionGenerator()
Definition: vrpn_FunctionGenerator.C:350
vrpn_FunctionGenerator_Server::handle_allChannelRequest_message
static int VRPN_CALLBACK handle_allChannelRequest_message(void *userdata, vrpn_HANDLERPARAM p)
Definition: vrpn_FunctionGenerator.C:574
vrpn_FunctionGenerator_Remote::unregister_error_handler
virtual int unregister_error_handler(void *userdata, vrpn_FUNCTION_ERROR_HANDLER handler)
Definition: vrpn_FunctionGenerator.C:1284
vrpn_FunctionGenerator_Server::decode_channel_request
vrpn_int32 decode_channel_request(const char *buf, const vrpn_int32 len, vrpn_uint32 &channelNum)
Definition: vrpn_FunctionGenerator.C:1677
vrpn_BaseClassUnique::server_mainloop
void server_mainloop(void)
Handles functions that all servers should provide in their mainloop() (ping/pong, for example) Should...
Definition: vrpn_BaseClass.C:603
vrpn_BaseClass
Class from which all user-level (and other) classes that communicate with vrpn_Connections should der...
Definition: vrpn_BaseClass.h:313
vrpn_FunctionGenerator_channel
class VRPN_API vrpn_FunctionGenerator_channel
Definition: vrpn_FunctionGenerator.h:30
vrpn_FunctionGenerator_function_script::getScript
char * getScript() const
Definition: vrpn_FunctionGenerator.C:196
vrpn_FunctionGenerator::vrpn_FunctionGenerator
vrpn_FunctionGenerator(const char *name, vrpn_Connection *c=NULL)
Definition: vrpn_FunctionGenerator.C:334
vrpn_FUNCTION_CHANNEL_REPLY_CB::channelNum
vrpn_uint32 channelNum
Definition: vrpn_FunctionGenerator.h:282
vrpn_FunctionGenerator_Remote::vrpn_FunctionGenerator_Remote
vrpn_FunctionGenerator_Remote(const char *name, vrpn_Connection *c=NULL)
Definition: vrpn_FunctionGenerator.C:871
vrpn_BaseClassUnique::handler
vrpn_MESSAGEHANDLER handler
Definition: vrpn_BaseClass.h:284