vrpn 07.35
Virtual Reality Peripheral Network
|
#include <vrpn_FunctionGenerator.h>
Static Public Member Functions | |
static int VRPN_CALLBACK | handle_channelReply_message (void *userdata, vrpn_HANDLERPARAM p) |
static int VRPN_CALLBACK | handle_startReply_message (void *userdata, vrpn_HANDLERPARAM p) |
static int VRPN_CALLBACK | handle_stopReply_message (void *userdata, vrpn_HANDLERPARAM p) |
static int VRPN_CALLBACK | handle_sampleRateReply_message (void *userdata, vrpn_HANDLERPARAM p) |
static int VRPN_CALLBACK | handle_interpreterReply_message (void *userdata, vrpn_HANDLERPARAM p) |
static int VRPN_CALLBACK | handle_error_message (void *userdata, vrpn_HANDLERPARAM p) |
Protected Member Functions | |
vrpn_int32 | decode_channel_reply (const char *buf, const vrpn_int32 len, vrpn_uint32 &channelNum) |
vrpn_int32 | decode_start_reply (const char *buf, const vrpn_int32 len, vrpn_bool &isStarted) |
vrpn_int32 | decode_stop_reply (const char *buf, const vrpn_int32 len, vrpn_bool &isStopped) |
vrpn_int32 | decode_sampleRate_reply (const char *buf, const vrpn_int32 len) |
vrpn_int32 | decode_interpreterDescription_reply (const char *buf, const vrpn_int32 len, char **desc) |
vrpn_int32 | decode_error_reply (const char *buf, const vrpn_int32 len, FGError &error, vrpn_int32 &channel) |
vrpn_int32 | encode_channel (char **buf, vrpn_int32 &len, const vrpn_uint32 channelNum, const vrpn_FunctionGenerator_channel *channel) |
vrpn_int32 | encode_channel_request (char **buf, vrpn_int32 &len, const vrpn_uint32 channelNum) |
vrpn_int32 | encode_sampleRate_request (char **buf, vrpn_int32 &len, const vrpn_float32 sampleRate) |
![]() | |
virtual int | register_types () |
Register the types of messages this device sends/receives. Return 0 on success, -1 on fail. | |
![]() | |
virtual int | init (void) |
Initialize things that the constructor can't. Returns 0 on success, -1 on failure. | |
virtual int | register_senders (void) |
Register the sender for this device (by default, the name of the device). Return 0 on success, -1 on fail. | |
![]() | |
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. | |
int | send_text_message (const char *msg, struct timeval timestamp, vrpn_TEXT_SEVERITY type=vrpn_TEXT_NORMAL, vrpn_uint32 level=0) |
Sends a NULL-terminated text message from the device d_sender_id. | |
SendTextMessageBoundCall | send_text_message (vrpn_TEXT_SEVERITY type=vrpn_TEXT_NORMAL) |
Returns an object you can stream into to send a text message from the device like send_text_message(vrpn_TEXT_WARNING) << "Value of i is: " << i; This use requires including vrpn_SendTextMessageStreamProxy.h. | |
void | server_mainloop (void) |
Handles functions that all servers should provide in their mainloop() (ping/pong, for example) Should be called by all servers in their mainloop() | |
void | client_mainloop (void) |
Handles functions that all clients should provide in their mainloop() (warning of no server, for example) Should be called by all clients in their mainloop() | |
Additional Inherited Members | |
![]() | |
enum | FGError { NO_FG_ERROR = 0 , INTERPRETER_ERROR = 1 , TAKING_TOO_LONG = 2 , INVALID_RESULT_QUANTITY = 3 , INVALID_RESULT_RANGE = 4 } |
![]() | |
bool | shutup |
![]() | |
static int | encode_text_message_to_buffer (char *buf, vrpn_TEXT_SEVERITY severity, vrpn_uint32 level, const char *msg) |
Encodes the body of the text message into a buffer, preparing for sending. | |
static int | decode_text_message_from_buffer (char *msg, vrpn_TEXT_SEVERITY *severity, vrpn_uint32 *level, const char *buf) |
Decodes the body of the text message from a buffer from the connection. | |
Definition at line 347 of file vrpn_FunctionGenerator.h.
vrpn_FunctionGenerator_Remote::vrpn_FunctionGenerator_Remote | ( | const char * | name, |
vrpn_Connection * | c = NULL ) |
Definition at line 941 of file vrpn_FunctionGenerator.C.
References vrpn_FunctionGenerator::channelReplyMessageID, vrpn_BaseClassUnique::d_connection, vrpn_BaseClassUnique::d_sender_id, vrpn_FunctionGenerator::errorMessageID, handle_channelReply_message(), handle_error_message(), handle_interpreterReply_message(), handle_sampleRateReply_message(), handle_startReply_message(), handle_stopReply_message(), vrpn_FunctionGenerator::interpreterReplyMessageID, vrpn_BaseClassUnique::register_autodeleted_handler(), vrpn_FunctionGenerator::sampleRateReplyMessageID, vrpn_FunctionGenerator::startFunctionReplyMessageID, and vrpn_FunctionGenerator::stopFunctionReplyMessageID.
|
inlinevirtual |
Definition at line 351 of file vrpn_FunctionGenerator.h.
|
protected |
Definition at line 1678 of file vrpn_FunctionGenerator.C.
References vrpn_FunctionGenerator::channels, vrpn_FunctionGenerator_channel::decode_from(), vrpn_FUNCTION_CHANNELS_MAX, and vrpn_unbuffer().
Referenced by handle_channelReply_message().
|
protected |
Definition at line 2062 of file vrpn_FunctionGenerator.C.
References vrpn_FunctionGenerator::NO_FG_ERROR, and vrpn_unbuffer().
Referenced by handle_error_message().
|
protected |
Definition at line 1998 of file vrpn_FunctionGenerator.C.
References vrpn_unbuffer().
Referenced by handle_interpreterReply_message().
|
protected |
Definition at line 1942 of file vrpn_FunctionGenerator.C.
References vrpn_FunctionGenerator::sampleRate, and vrpn_unbuffer().
Referenced by handle_sampleRateReply_message().
|
protected |
Definition at line 1851 of file vrpn_FunctionGenerator.C.
References vrpn_unbuffer().
Referenced by handle_startReply_message().
|
protected |
Definition at line 1897 of file vrpn_FunctionGenerator.C.
References vrpn_unbuffer().
Referenced by handle_stopReply_message().
|
protected |
Definition at line 1548 of file vrpn_FunctionGenerator.C.
References vrpn_FunctionGenerator_channel::encode_to(), vrpn_buffer(), and vrpn_FUNCTION_CHANNELS_MAX.
Referenced by setChannel().
|
protected |
Definition at line 1719 of file vrpn_FunctionGenerator.C.
References vrpn_buffer().
Referenced by requestChannel().
|
protected |
Definition at line 1777 of file vrpn_FunctionGenerator.C.
References vrpn_FunctionGenerator::sampleRate, and vrpn_buffer().
Referenced by requestSampleRate().
|
static |
Definition at line 1363 of file vrpn_FunctionGenerator.C.
References vrpn_HANDLERPARAM::buffer, vrpn_Callback_List< CALLBACK_STRUCT >::call_handlers(), vrpn_FUNCTION_CHANNEL_REPLY_CB::channel, channel_reply_list, vrpn_FUNCTION_CHANNEL_REPLY_CB::channelNum, vrpn_FunctionGenerator::channels, decode_channel_reply(), vrpn_HANDLERPARAM::msg_time, vrpn_FUNCTION_CHANNEL_REPLY_CB::msg_time, vrpn_HANDLERPARAM::payload_len, vrpn_BaseClassUnique::userdata, and vrpn_FUNCTION_CHANNELS_MAX.
Referenced by vrpn_FunctionGenerator_Remote().
|
static |
Definition at line 1508 of file vrpn_FunctionGenerator.C.
References vrpn_HANDLERPARAM::buffer, vrpn_Callback_List< CALLBACK_STRUCT >::call_handlers(), vrpn_FUNCTION_ERROR_CB::channel, decode_error_reply(), vrpn_FUNCTION_ERROR_CB::err, error_list, vrpn_HANDLERPARAM::msg_time, vrpn_FUNCTION_ERROR_CB::msg_time, vrpn_HANDLERPARAM::payload_len, and vrpn_BaseClassUnique::userdata.
Referenced by vrpn_FunctionGenerator_Remote().
|
static |
Definition at line 1482 of file vrpn_FunctionGenerator.C.
References vrpn_HANDLERPARAM::buffer, vrpn_Callback_List< CALLBACK_STRUCT >::call_handlers(), decode_interpreterDescription_reply(), vrpn_FUNCTION_INTERPRETER_REPLY_CB::description, interpreter_reply_list, vrpn_HANDLERPARAM::msg_time, vrpn_FUNCTION_INTERPRETER_REPLY_CB::msg_time, vrpn_HANDLERPARAM::payload_len, and vrpn_BaseClassUnique::userdata.
Referenced by vrpn_FunctionGenerator_Remote().
|
static |
Definition at line 1455 of file vrpn_FunctionGenerator.C.
References vrpn_HANDLERPARAM::buffer, vrpn_Callback_List< CALLBACK_STRUCT >::call_handlers(), decode_sampleRate_reply(), vrpn_HANDLERPARAM::msg_time, vrpn_FUNCTION_SAMPLE_RATE_REPLY_CB::msg_time, vrpn_HANDLERPARAM::payload_len, sample_rate_reply_list, vrpn_FunctionGenerator::sampleRate, vrpn_FUNCTION_SAMPLE_RATE_REPLY_CB::sampleRate, and vrpn_BaseClassUnique::userdata.
Referenced by vrpn_FunctionGenerator_Remote().
|
static |
Definition at line 1399 of file vrpn_FunctionGenerator.C.
References vrpn_HANDLERPARAM::buffer, vrpn_Callback_List< CALLBACK_STRUCT >::call_handlers(), decode_start_reply(), vrpn_FUNCTION_START_REPLY_CB::isStarted, vrpn_HANDLERPARAM::msg_time, vrpn_FUNCTION_START_REPLY_CB::msg_time, vrpn_HANDLERPARAM::payload_len, start_reply_list, and vrpn_BaseClassUnique::userdata.
Referenced by vrpn_FunctionGenerator_Remote().
|
static |
Definition at line 1427 of file vrpn_FunctionGenerator.C.
References vrpn_HANDLERPARAM::buffer, vrpn_Callback_List< CALLBACK_STRUCT >::call_handlers(), decode_stop_reply(), vrpn_FUNCTION_STOP_REPLY_CB::isStopped, vrpn_HANDLERPARAM::msg_time, vrpn_FUNCTION_STOP_REPLY_CB::msg_time, vrpn_HANDLERPARAM::payload_len, stop_reply_list, and vrpn_BaseClassUnique::userdata.
Referenced by vrpn_FunctionGenerator_Remote().
|
virtual |
Called once through each main loop iteration to handle updates. Remote object mainloop() should call client_mainloop() and then call d_connection->mainloop(). Server object mainloop() should service the device and then call server_mainloop(), but should not normally call d_connection->mainloop().
Implements vrpn_BaseClass.
Definition at line 1255 of file vrpn_FunctionGenerator.C.
References vrpn_BaseClassUnique::client_mainloop(), vrpn_BaseClassUnique::d_connection, and vrpn_Connection::mainloop().
|
virtual |
Definition at line 1266 of file vrpn_FunctionGenerator.C.
References channel_reply_list, vrpn_BaseClassUnique::handler, vrpn_Callback_List< CALLBACK_STRUCT >::register_handler(), and vrpn_BaseClassUnique::userdata.
|
virtual |
Definition at line 1346 of file vrpn_FunctionGenerator.C.
References error_list, vrpn_BaseClassUnique::handler, vrpn_Callback_List< CALLBACK_STRUCT >::register_handler(), and vrpn_BaseClassUnique::userdata.
|
virtual |
Definition at line 1330 of file vrpn_FunctionGenerator.C.
References vrpn_BaseClassUnique::handler, interpreter_reply_list, vrpn_Callback_List< CALLBACK_STRUCT >::register_handler(), and vrpn_BaseClassUnique::userdata.
|
virtual |
Definition at line 1314 of file vrpn_FunctionGenerator.C.
References vrpn_BaseClassUnique::handler, vrpn_Callback_List< CALLBACK_STRUCT >::register_handler(), sample_rate_reply_list, and vrpn_BaseClassUnique::userdata.
|
virtual |
Definition at line 1282 of file vrpn_FunctionGenerator.C.
References vrpn_BaseClassUnique::handler, vrpn_Callback_List< CALLBACK_STRUCT >::register_handler(), start_reply_list, and vrpn_BaseClassUnique::userdata.
|
virtual |
Definition at line 1298 of file vrpn_FunctionGenerator.C.
References vrpn_BaseClassUnique::handler, vrpn_Callback_List< CALLBACK_STRUCT >::register_handler(), stop_reply_list, and vrpn_BaseClassUnique::userdata.
int vrpn_FunctionGenerator_Remote::requestAllChannels | ( | ) |
Definition at line 1079 of file vrpn_FunctionGenerator.C.
References vrpn_BaseClassUnique::d_connection, vrpn_FunctionGenerator::msgbuf, vrpn_Connection::pack_message(), vrpn_FunctionGenerator::timestamp, vrpn_CONNECTION_RELIABLE, vrpn_CONNECTION_TCP_BUFLEN, and vrpn_gettimeofday.
int vrpn_FunctionGenerator_Remote::requestChannel | ( | const vrpn_uint32 | channelNum | ) |
Definition at line 1038 of file vrpn_FunctionGenerator.C.
References vrpn_BaseClassUnique::d_connection, encode_channel_request(), vrpn_FunctionGenerator::msgbuf, vrpn_Connection::pack_message(), vrpn_FunctionGenerator::timestamp, vrpn_CONNECTION_RELIABLE, vrpn_CONNECTION_TCP_BUFLEN, and vrpn_gettimeofday.
int vrpn_FunctionGenerator_Remote::requestInterpreterDescription | ( | ) |
Definition at line 1221 of file vrpn_FunctionGenerator.C.
References vrpn_BaseClassUnique::d_connection, vrpn_FunctionGenerator::msgbuf, vrpn_Connection::pack_message(), vrpn_FunctionGenerator::timestamp, vrpn_CONNECTION_RELIABLE, vrpn_CONNECTION_TCP_BUFLEN, and vrpn_gettimeofday.
int vrpn_FunctionGenerator_Remote::requestSampleRate | ( | const vrpn_float32 | rate | ) |
Definition at line 1181 of file vrpn_FunctionGenerator.C.
References vrpn_BaseClassUnique::d_connection, encode_sampleRate_request(), vrpn_FunctionGenerator::msgbuf, vrpn_Connection::pack_message(), vrpn_FunctionGenerator::timestamp, vrpn_CONNECTION_RELIABLE, vrpn_CONNECTION_TCP_BUFLEN, and vrpn_gettimeofday.
int vrpn_FunctionGenerator_Remote::requestStart | ( | ) |
Definition at line 1113 of file vrpn_FunctionGenerator.C.
References vrpn_BaseClassUnique::d_connection, vrpn_FunctionGenerator::msgbuf, vrpn_Connection::pack_message(), vrpn_FunctionGenerator::timestamp, vrpn_CONNECTION_RELIABLE, vrpn_CONNECTION_TCP_BUFLEN, and vrpn_gettimeofday.
int vrpn_FunctionGenerator_Remote::requestStop | ( | ) |
Definition at line 1147 of file vrpn_FunctionGenerator.C.
References vrpn_BaseClassUnique::d_connection, vrpn_FunctionGenerator::msgbuf, vrpn_Connection::pack_message(), vrpn_FunctionGenerator::timestamp, vrpn_CONNECTION_RELIABLE, vrpn_CONNECTION_TCP_BUFLEN, and vrpn_gettimeofday.
int vrpn_FunctionGenerator_Remote::setChannel | ( | const vrpn_uint32 | channelNum, |
const vrpn_FunctionGenerator_channel * | channel ) |
Definition at line 998 of file vrpn_FunctionGenerator.C.
References vrpn_BaseClassUnique::d_connection, encode_channel(), vrpn_FunctionGenerator::msgbuf, vrpn_Connection::pack_message(), vrpn_FunctionGenerator::timestamp, vrpn_CONNECTION_RELIABLE, vrpn_CONNECTION_TCP_BUFLEN, and vrpn_gettimeofday.
|
virtual |
Definition at line 1274 of file vrpn_FunctionGenerator.C.
References channel_reply_list, vrpn_BaseClassUnique::handler, vrpn_Callback_List< CALLBACK_STRUCT >::unregister_handler(), and vrpn_BaseClassUnique::userdata.
|
virtual |
Definition at line 1354 of file vrpn_FunctionGenerator.C.
References error_list, vrpn_BaseClassUnique::handler, vrpn_Callback_List< CALLBACK_STRUCT >::unregister_handler(), and vrpn_BaseClassUnique::userdata.
|
virtual |
Definition at line 1338 of file vrpn_FunctionGenerator.C.
References vrpn_BaseClassUnique::handler, interpreter_reply_list, vrpn_Callback_List< CALLBACK_STRUCT >::unregister_handler(), and vrpn_BaseClassUnique::userdata.
|
virtual |
Definition at line 1322 of file vrpn_FunctionGenerator.C.
References vrpn_BaseClassUnique::handler, sample_rate_reply_list, vrpn_Callback_List< CALLBACK_STRUCT >::unregister_handler(), and vrpn_BaseClassUnique::userdata.
|
virtual |
Definition at line 1290 of file vrpn_FunctionGenerator.C.
References vrpn_BaseClassUnique::handler, start_reply_list, vrpn_Callback_List< CALLBACK_STRUCT >::unregister_handler(), and vrpn_BaseClassUnique::userdata.
|
virtual |
Definition at line 1306 of file vrpn_FunctionGenerator.C.
References vrpn_BaseClassUnique::handler, stop_reply_list, vrpn_Callback_List< CALLBACK_STRUCT >::unregister_handler(), and vrpn_BaseClassUnique::userdata.
|
protected |
Definition at line 406 of file vrpn_FunctionGenerator.h.
Referenced by handle_channelReply_message(), register_channel_reply_handler(), and unregister_channel_reply_handler().
|
protected |
Definition at line 411 of file vrpn_FunctionGenerator.h.
Referenced by handle_error_message(), register_error_handler(), and unregister_error_handler().
|
protected |
Definition at line 410 of file vrpn_FunctionGenerator.h.
Referenced by handle_interpreterReply_message(), register_interpreter_reply_handler(), and unregister_interpreter_reply_handler().
|
protected |
Definition at line 409 of file vrpn_FunctionGenerator.h.
Referenced by handle_sampleRateReply_message(), register_sample_rate_reply_handler(), and unregister_sample_rate_reply_handler().
|
protected |
Definition at line 407 of file vrpn_FunctionGenerator.h.
Referenced by handle_startReply_message(), register_start_reply_handler(), and unregister_start_reply_handler().
|
protected |
Definition at line 408 of file vrpn_FunctionGenerator.h.
Referenced by handle_stopReply_message(), register_stop_reply_handler(), and unregister_stop_reply_handler().