45 virtual vrpn_float32 generateValues( vrpn_float32* buf, vrpn_uint32 nValues,
46 vrpn_float32 startTime, vrpn_float32 sampleRate,
55 virtual vrpn_int32 encode_to(
char** buf, vrpn_int32& len )
const = 0;
63 virtual vrpn_int32 decode_from(
const char** buf, vrpn_int32& len ) = 0;
76 virtual FunctionCode getFunctionCode( )
const = 0;
168 vrpn_uint32 getNumChannels( )
const {
return numChannels; }
170 vrpn_float32 getSampleRate( )
171 {
return sampleRate; }
176 INTERPRETER_ERROR = 1,
178 INVALID_RESULT_QUANTITY = 3,
179 INVALID_RESULT_RANGE = 4
183 vrpn_float32 sampleRate;
184 vrpn_uint32 numChannels;
187 vrpn_int32 channelMessageID;
188 vrpn_int32 requestChannelMessageID;
189 vrpn_int32 requestAllChannelsMessageID;
190 vrpn_int32 sampleRateMessageID;
191 vrpn_int32 startFunctionMessageID;
192 vrpn_int32 stopFunctionMessageID;
193 vrpn_int32 requestInterpreterMessageID;
195 vrpn_int32 channelReplyMessageID;
196 vrpn_int32 startFunctionReplyMessageID;
197 vrpn_int32 stopFunctionReplyMessageID;
198 vrpn_int32 sampleRateReplyMessageID;
199 vrpn_int32 interpreterReplyMessageID;
200 vrpn_int32 errorMessageID;
202 vrpn_int32 gotConnectionMessageID;
206 char msgbuf[vrpn_CONNECTION_TCP_BUFLEN];
207 struct timeval timestamp;
224 virtual void start( ) = 0;
225 virtual void stop( ) = 0;
226 virtual void setSampleRate( vrpn_float32 rate ) = 0;
228 vrpn_uint32 setNumChannels( vrpn_uint32 numChannels );
232 virtual const char* getInterpreterDescription( ) = 0;
236 static int VRPN_CALLBACK handle_channel_message(
void* userdata,
vrpn_HANDLERPARAM p );
237 static int VRPN_CALLBACK handle_channelRequest_message(
void* userdata,
vrpn_HANDLERPARAM p );
238 static int VRPN_CALLBACK handle_allChannelRequest_message(
void* userdata,
vrpn_HANDLERPARAM p );
239 static int VRPN_CALLBACK handle_start_message(
void* userdata,
vrpn_HANDLERPARAM p );
240 static int VRPN_CALLBACK handle_stop_message(
void* userdata,
vrpn_HANDLERPARAM p );
241 static int VRPN_CALLBACK handle_sample_rate_message(
void* userdata,
vrpn_HANDLERPARAM p );
242 static int VRPN_CALLBACK handle_interpreter_request_message(
void* userdata,
vrpn_HANDLERPARAM p );
249 int sendChannelReply( vrpn_uint32 channelNum );
250 int sendSampleRateReply( );
251 int sendStartReply( vrpn_bool started );
252 int sendStopReply( vrpn_bool stopped );
253 int sendInterpreterDescription( );
256 int sendError( FGError error, vrpn_int32 channel );
258 vrpn_int32 decode_channel(
const char* buf,
const vrpn_int32 len, vrpn_uint32& channelNum,
260 vrpn_int32 decode_channel_request(
const char* buf,
const vrpn_int32 len, vrpn_uint32& channelNum );
261 vrpn_int32 decode_sampleRate_request(
const char* buf,
const vrpn_int32 len, vrpn_float32& sampleRate );
263 vrpn_int32 encode_channel_reply(
char** buf, vrpn_int32& len,
const vrpn_uint32 channelNum );
264 vrpn_int32 encode_start_reply(
char** buf, vrpn_int32& len,
const vrpn_bool isStarted );
265 vrpn_int32 encode_stop_reply(
char** buf, vrpn_int32& len,
const vrpn_bool isStopped );
266 vrpn_int32 encode_sampleRate_reply(
char** buf, vrpn_int32& len,
const vrpn_float32 sampleRate );
267 vrpn_int32 encode_interpreterDescription_reply(
char** buf, vrpn_int32& len,
const char* desc );
268 vrpn_int32 encode_error_report(
char** buf, vrpn_int32& len,
const FGError err,
const vrpn_int32 channel );
354 int requestChannel(
const vrpn_uint32 channelNum );
355 int requestAllChannels( );
358 int requestSampleRate(
const vrpn_float32 rate );
359 int requestInterpreterDescription( );
364 virtual int register_channel_reply_handler(
void *userdata,
365 vrpn_FUNCTION_CHANGE_REPLY_HANDLER handler );
366 virtual int unregister_channel_reply_handler(
void *userdata,
367 vrpn_FUNCTION_CHANGE_REPLY_HANDLER handler );
370 virtual int register_start_reply_handler(
void *userdata,
371 vrpn_FUNCTION_START_REPLY_HANDLER handler );
372 virtual int unregister_start_reply_handler(
void *userdata,
373 vrpn_FUNCTION_START_REPLY_HANDLER handler );
376 virtual int register_stop_reply_handler(
void *userdata,
377 vrpn_FUNCTION_STOP_REPLY_HANDLER handler );
378 virtual int unregister_stop_reply_handler(
void *userdata,
379 vrpn_FUNCTION_STOP_REPLY_HANDLER handler );
382 virtual int register_sample_rate_reply_handler(
void *userdata,
383 vrpn_FUNCTION_SAMPLE_RATE_REPLY_HANDLER handler );
384 virtual int unregister_sample_rate_reply_handler(
void *userdata,
385 vrpn_FUNCTION_SAMPLE_RATE_REPLY_HANDLER handler );
388 virtual int register_interpreter_reply_handler(
void *userdata,
389 vrpn_FUNCTION_INTERPRETER_REPLY_HANDLER handler );
390 virtual int unregister_interpreter_reply_handler(
void *userdata,
391 vrpn_FUNCTION_INTERPRETER_REPLY_HANDLER handler );
393 virtual int register_error_handler(
void* userdata,
394 vrpn_FUNCTION_ERROR_HANDLER handler );
395 virtual int unregister_error_handler(
void* userdata,
396 vrpn_FUNCTION_ERROR_HANDLER handler );
398 static int VRPN_CALLBACK handle_channelReply_message(
void* userdata,
vrpn_HANDLERPARAM p );
399 static int VRPN_CALLBACK handle_startReply_message(
void* userdata,
vrpn_HANDLERPARAM p );
400 static int VRPN_CALLBACK handle_stopReply_message(
void* userdata,
vrpn_HANDLERPARAM p );
401 static int VRPN_CALLBACK handle_sampleRateReply_message(
void* userdata,
vrpn_HANDLERPARAM p );
402 static int VRPN_CALLBACK handle_interpreterReply_message(
void* userdata,
vrpn_HANDLERPARAM p );
403 static int VRPN_CALLBACK handle_error_message(
void* userdata,
vrpn_HANDLERPARAM p );
414 vrpn_int32 decode_channel_reply(
const char* buf,
const vrpn_int32 len, vrpn_uint32& channelNum );
415 vrpn_int32 decode_start_reply(
const char* buf,
const vrpn_int32 len, vrpn_bool& isStarted );
416 vrpn_int32 decode_stop_reply(
const char* buf,
const vrpn_int32 len, vrpn_bool& isStopped );
417 vrpn_int32 decode_sampleRate_reply(
const char* buf,
const vrpn_int32 len );
418 vrpn_int32 decode_interpreterDescription_reply(
const char* buf,
const vrpn_int32 len,
char** desc );
419 vrpn_int32 decode_error_reply(
const char* buf,
const vrpn_int32 len, FGError& error, vrpn_int32& channel );
421 vrpn_int32 encode_channel(
char** buf, vrpn_int32& len,
const vrpn_uint32 channelNum,
423 vrpn_int32 encode_channel_request(
char** buf, vrpn_int32& len,
const vrpn_uint32 channelNum );
424 vrpn_int32 encode_sampleRate_request(
char** buf, vrpn_int32& len,
const vrpn_float32 sampleRate );