1 #ifndef VRPN_FUNCTIONGENERATOR_H
2 #define VRPN_FUNCTIONGENERATOR_H
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;
90 vrpn_float32
generateValues( vrpn_float32* buf, vrpn_uint32 nValues,
91 vrpn_float32 startTime, vrpn_float32 sampleRate,
94 vrpn_int32
encode_to(
char** buf, vrpn_int32& len )
const;
95 vrpn_int32
decode_from(
const char** buf, vrpn_int32& len );
112 virtual vrpn_float32
generateValues( vrpn_float32* buf, vrpn_uint32 nValues,
113 vrpn_float32 startTime, vrpn_float32 sampleRate,
116 vrpn_int32
encode_to(
char** buf, vrpn_int32& len )
const;
117 vrpn_int32
decode_from(
const char** buf, vrpn_int32& len );
122 char* getScript( )
const;
127 vrpn_bool setScript(
char* script );
149 vrpn_int32 encode_to(
char** buf, vrpn_int32& len )
const;
150 vrpn_int32 decode_from(
const char** buf, vrpn_int32& len );
171 {
return sampleRate; }
176 INTERPRETER_ERROR = 1,
178 INVALID_RESULT_QUANTITY = 3,
179 INVALID_RESULT_RANGE = 4
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;
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 );
279 typedef struct _vrpn_FUNCTION_CHANNEL_REPLY_CB
281 struct timeval msg_time;
291 typedef struct _vrpn_FUNCTION_START_REPLY_CB
293 struct timeval msg_time;
302 typedef struct _vrpn_FUNCTION_STOP_REPLY_CB
304 struct timeval msg_time;
313 typedef struct _vrpn_FUNCTION_SAMPLE_RATE_REPLY_CB
315 struct timeval msg_time;
325 typedef struct _vrpn_FUNCTION_INTERPRETER_REPLY_CB
327 struct timeval msg_time;
337 typedef struct _vrpn_FUNCTION_ERROR_CB
339 struct timeval msg_time;
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,
366 virtual int unregister_channel_reply_handler(
void *userdata,
370 virtual int register_start_reply_handler(
void *userdata,
372 virtual int unregister_start_reply_handler(
void *userdata,
376 virtual int register_stop_reply_handler(
void *userdata,
378 virtual int unregister_stop_reply_handler(
void *userdata,
382 virtual int register_sample_rate_reply_handler(
void *userdata,
384 virtual int unregister_sample_rate_reply_handler(
void *userdata,
388 virtual int register_interpreter_reply_handler(
void *userdata,
390 virtual int unregister_interpreter_reply_handler(
void *userdata,
393 virtual int register_error_handler(
void* userdata,
395 virtual int unregister_error_handler(
void* userdata,
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 );
429 #endif // VRPN_FUNCTIONGENERATOR_H