1#ifndef VRPN_FUNCTIONGENERATOR_H
2#define VRPN_FUNCTIONGENERATOR_H
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;
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
204 virtual int register_types( );
207 struct timeval timestamp;
217 virtual void mainloop( );
228 vrpn_uint32 setNumChannels( vrpn_uint32 numChannels );
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 );
279typedef struct _vrpn_FUNCTION_CHANNEL_REPLY_CB
281 struct timeval msg_time;
291typedef struct _vrpn_FUNCTION_START_REPLY_CB
293 struct timeval msg_time;
302typedef struct _vrpn_FUNCTION_STOP_REPLY_CB
304 struct timeval msg_time;
313typedef struct _vrpn_FUNCTION_SAMPLE_RATE_REPLY_CB
315 struct timeval msg_time;
325typedef struct _vrpn_FUNCTION_INTERPRETER_REPLY_CB
327 struct timeval msg_time;
337typedef 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( );
361 virtual void mainloop( );
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 );
Class from which all user-level (and other) classes that communicate with vrpn_Connections should der...
Generic connection class not specific to the transport mechanism.
vrpn_Callback_List< vrpn_FUNCTION_ERROR_CB > error_list
vrpn_Callback_List< vrpn_FUNCTION_STOP_REPLY_CB > stop_reply_list
vrpn_Callback_List< vrpn_FUNCTION_START_REPLY_CB > start_reply_list
vrpn_Callback_List< vrpn_FUNCTION_CHANNEL_REPLY_CB > channel_reply_list
vrpn_Callback_List< vrpn_FUNCTION_INTERPRETER_REPLY_CB > interpreter_reply_list
virtual ~vrpn_FunctionGenerator_Remote()
vrpn_Callback_List< vrpn_FUNCTION_SAMPLE_RATE_REPLY_CB > sample_rate_reply_list
virtual void setSampleRate(vrpn_float32 rate)=0
virtual const char * getInterpreterDescription()=0
virtual void setChannel(vrpn_uint32 channelNum, vrpn_FunctionGenerator_channel *channel)=0
const vrpn_FunctionGenerator_function * getFunction() const
vrpn_FunctionGenerator_function * function
vrpn_FunctionGenerator_function_NULL()
FunctionCode getFunctionCode() const
virtual ~vrpn_FunctionGenerator_function_NULL()
FunctionCode getFunctionCode() const
const char * getConstScript() const
virtual vrpn_FunctionGenerator_function * clone() const =0
virtual vrpn_int32 encode_to(char **buf, vrpn_int32 &len) const =0
virtual vrpn_float32 generateValues(vrpn_float32 *buf, vrpn_uint32 nValues, vrpn_float32 startTime, vrpn_float32 sampleRate, vrpn_FunctionGenerator_channel *channel) const =0
virtual FunctionCode getFunctionCode() const =0
virtual vrpn_int32 decode_from(const char **buf, vrpn_int32 &len)=0
vrpn_int32 channelReplyMessageID
vrpn_float32 getSampleRate()
vrpn_int32 requestInterpreterMessageID
vrpn_int32 errorMessageID
vrpn_int32 stopFunctionMessageID
vrpn_int32 requestAllChannelsMessageID
vrpn_int32 interpreterReplyMessageID
vrpn_int32 requestChannelMessageID
vrpn_int32 startFunctionMessageID
vrpn_int32 sampleRateReplyMessageID
vrpn_int32 channelMessageID
vrpn_int32 startFunctionReplyMessageID
vrpn_int32 stopFunctionReplyMessageID
vrpn_int32 sampleRateMessageID
vrpn_uint32 getNumChannels() const
vrpn_int32 gotConnectionMessageID
vrpn_FunctionGenerator_channel * channel
vrpn_FunctionGenerator::FGError err
This structure is what is passed to a vrpn_Connection message callback.
All types of client/server/peer objects in VRPN should be derived from the vrpn_BaseClass type descri...
const int vrpn_CONNECTION_TCP_BUFLEN
const vrpn_uint32 vrpn_FUNCTION_CHANNELS_MAX
void(VRPN_CALLBACK * vrpn_FUNCTION_CHANGE_REPLY_HANDLER)(void *userdata, const vrpn_FUNCTION_CHANNEL_REPLY_CB info)
const char * vrpn_FUNCTION_MESSAGE_TYPE_SAMPLE_RATE_REPLY
void(VRPN_CALLBACK * vrpn_FUNCTION_INTERPRETER_REPLY_HANDLER)(void *userdata, const vrpn_FUNCTION_INTERPRETER_REPLY_CB info)
const char * vrpn_FUNCTION_MESSAGE_TYPE_CHANNEL_REPLY
const char * vrpn_FUNCTION_MESSAGE_TYPE_CHANNEL_REQUEST
const char * vrpn_FUNCTION_MESSAGE_TYPE_INTERPRETER_REQUEST
const char * vrpn_FUNCTION_MESSAGE_TYPE_ALL_CHANNEL_REQUEST
const char * vrpn_FUNCTION_MESSAGE_TYPE_SAMPLE_RATE
const char * vrpn_FUNCTION_MESSAGE_TYPE_CHANNEL
void(VRPN_CALLBACK * vrpn_FUNCTION_SAMPLE_RATE_REPLY_HANDLER)(void *userdata, const vrpn_FUNCTION_SAMPLE_RATE_REPLY_CB info)
const char * vrpn_FUNCTION_MESSAGE_TYPE_ERROR
const char * vrpn_FUNCTION_MESSAGE_TYPE_INTERPRETER_REPLY
const char * vrpn_FUNCTION_MESSAGE_TYPE_START
const char * vrpn_FUNCTION_MESSAGE_TYPE_START_REPLY
const char * vrpn_FUNCTION_MESSAGE_TYPE_STOP_REPLY
void(VRPN_CALLBACK * vrpn_FUNCTION_ERROR_HANDLER)(void *userdata, const vrpn_FUNCTION_ERROR_CB info)
void(VRPN_CALLBACK * vrpn_FUNCTION_START_REPLY_HANDLER)(void *userdata, const vrpn_FUNCTION_START_REPLY_CB info)
void(VRPN_CALLBACK * vrpn_FUNCTION_STOP_REPLY_HANDLER)(void *userdata, const vrpn_FUNCTION_STOP_REPLY_CB info)
const char * vrpn_FUNCTION_MESSAGE_TYPE_STOP