vrpn  07.33
Virtual Reality Peripheral Network
vrpn_FunctionGenerator_Server Class Referenceabstract

#include <vrpn_FunctionGenerator.h>

Inheritance diagram for vrpn_FunctionGenerator_Server:
Collaboration diagram for vrpn_FunctionGenerator_Server:

Public Member Functions

 vrpn_FunctionGenerator_Server (const char *name, vrpn_uint32 numChannels=vrpn_FUNCTION_CHANNELS_MAX, vrpn_Connection *c=NULL)
 
virtual ~vrpn_FunctionGenerator_Server ()
 
virtual void mainloop ()
 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(). More...
 
virtual void setChannel (vrpn_uint32 channelNum, vrpn_FunctionGenerator_channel *channel)=0
 
virtual void start ()=0
 
virtual void stop ()=0
 
virtual void setSampleRate (vrpn_float32 rate)=0
 
vrpn_uint32 setNumChannels (vrpn_uint32 numChannels)
 
virtual const char * getInterpreterDescription ()=0
 
- Public Member Functions inherited from vrpn_FunctionGenerator
 vrpn_FunctionGenerator (const char *name, vrpn_Connection *c=NULL)
 
virtual ~vrpn_FunctionGenerator ()
 
const vrpn_FunctionGenerator_channelgetChannel (vrpn_uint32 channelNum)
 
vrpn_uint32 getNumChannels () const
 
vrpn_float32 getSampleRate ()
 
- Public Member Functions inherited from vrpn_BaseClass
 vrpn_BaseClass (const char *name, vrpn_Connection *c=NULL)
 Names the device and assigns or opens connection, calls registration methods. More...
 
virtual ~vrpn_BaseClass ()
 
- Public Member Functions inherited from vrpn_BaseClassUnique
 vrpn_BaseClassUnique ()
 
virtual ~vrpn_BaseClassUnique ()
 Unregister all of the message handlers that were to be autodeleted. More...
 
vrpn_ConnectionconnectionPtr ()
 Returns a pointer to the connection this object is using. More...
 

Static Public Member Functions

static int VRPN_CALLBACK handle_channel_message (void *userdata, vrpn_HANDLERPARAM p)
 
static int VRPN_CALLBACK handle_channelRequest_message (void *userdata, vrpn_HANDLERPARAM p)
 
static int VRPN_CALLBACK handle_allChannelRequest_message (void *userdata, vrpn_HANDLERPARAM p)
 
static int VRPN_CALLBACK handle_start_message (void *userdata, vrpn_HANDLERPARAM p)
 
static int VRPN_CALLBACK handle_stop_message (void *userdata, vrpn_HANDLERPARAM p)
 
static int VRPN_CALLBACK handle_sample_rate_message (void *userdata, vrpn_HANDLERPARAM p)
 
static int VRPN_CALLBACK handle_interpreter_request_message (void *userdata, vrpn_HANDLERPARAM p)
 

Protected Member Functions

int sendChannelReply (vrpn_uint32 channelNum)
 
int sendSampleRateReply ()
 
int sendStartReply (vrpn_bool started)
 
int sendStopReply (vrpn_bool stopped)
 
int sendInterpreterDescription ()
 
int sendError (FGError error, vrpn_int32 channel)
 
vrpn_int32 decode_channel (const char *buf, const vrpn_int32 len, vrpn_uint32 &channelNum, vrpn_FunctionGenerator_channel &channel)
 
vrpn_int32 decode_channel_request (const char *buf, const vrpn_int32 len, vrpn_uint32 &channelNum)
 
vrpn_int32 decode_sampleRate_request (const char *buf, const vrpn_int32 len, vrpn_float32 &sampleRate)
 
vrpn_int32 encode_channel_reply (char **buf, vrpn_int32 &len, const vrpn_uint32 channelNum)
 
vrpn_int32 encode_start_reply (char **buf, vrpn_int32 &len, const vrpn_bool isStarted)
 
vrpn_int32 encode_stop_reply (char **buf, vrpn_int32 &len, const vrpn_bool isStopped)
 
vrpn_int32 encode_sampleRate_reply (char **buf, vrpn_int32 &len, const vrpn_float32 sampleRate)
 
vrpn_int32 encode_interpreterDescription_reply (char **buf, vrpn_int32 &len, const char *desc)
 
vrpn_int32 encode_error_report (char **buf, vrpn_int32 &len, const FGError err, const vrpn_int32 channel)
 
- Protected Member Functions inherited from vrpn_FunctionGenerator
virtual int register_types ()
 Register the types of messages this device sends/receives. Return 0 on success, -1 on fail. More...
 
- Protected Member Functions inherited from vrpn_BaseClass
virtual int init (void)
 Initialize things that the constructor can't. Returns 0 on success, -1 on failure. More...
 
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. More...
 
- Protected Member Functions inherited from vrpn_BaseClassUnique
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. More...
 
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. More...
 
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. More...
 
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() More...
 
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() More...
 

Additional Inherited Members

- Public Types inherited from vrpn_FunctionGenerator
enum  FGError {
  NO_FG_ERROR = 0, INTERPRETER_ERROR = 1, TAKING_TOO_LONG = 2, INVALID_RESULT_QUANTITY = 3,
  INVALID_RESULT_RANGE = 4
}
 
- Public Attributes inherited from vrpn_BaseClassUnique
bool shutup
 
vrpn_MESSAGEHANDLER handler
 
vrpn_int32 sender
 
vrpn_int32 type
 
void * userdata
 
- Static Protected Member Functions inherited from vrpn_BaseClassUnique
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. More...
 
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. More...
 
- Protected Attributes inherited from vrpn_FunctionGenerator
vrpn_float32 sampleRate
 
vrpn_uint32 numChannels
 
vrpn_FunctionGenerator_channelchannels [vrpn_FUNCTION_CHANNELS_MAX]
 
vrpn_int32 channelMessageID
 
vrpn_int32 requestChannelMessageID
 
vrpn_int32 requestAllChannelsMessageID
 
vrpn_int32 sampleRateMessageID
 
vrpn_int32 startFunctionMessageID
 
vrpn_int32 stopFunctionMessageID
 
vrpn_int32 requestInterpreterMessageID
 
vrpn_int32 channelReplyMessageID
 
vrpn_int32 startFunctionReplyMessageID
 
vrpn_int32 stopFunctionReplyMessageID
 
vrpn_int32 sampleRateReplyMessageID
 
vrpn_int32 interpreterReplyMessageID
 
vrpn_int32 errorMessageID
 
vrpn_int32 gotConnectionMessageID
 
char msgbuf [vrpn_CONNECTION_TCP_BUFLEN]
 
struct timeval timestamp
 
- Protected Attributes inherited from vrpn_BaseClassUnique
vrpn_Connectiond_connection
 Connection that this object talks to. More...
 
char * d_servicename
 Name of this device, not including the connection part. More...
 
vrpn_int32 d_sender_id
 Sender ID registered with the connection. More...
 
vrpn_int32 d_text_message_id
 ID for text messages. More...
 
vrpn_int32 d_ping_message_id
 Ask the server if they are there. More...
 
vrpn_int32 d_pong_message_id
 Server telling that it is there. More...
 

Detailed Description

Definition at line 211 of file vrpn_FunctionGenerator.h.

Constructor & Destructor Documentation

◆ vrpn_FunctionGenerator_Server()

◆ ~vrpn_FunctionGenerator_Server()

vrpn_FunctionGenerator_Server::~vrpn_FunctionGenerator_Server ( )
virtual

Definition at line 488 of file vrpn_FunctionGenerator.C.

Member Function Documentation

◆ decode_channel()

vrpn_int32 vrpn_FunctionGenerator_Server::decode_channel ( const char *  buf,
const vrpn_int32  len,
vrpn_uint32 &  channelNum,
vrpn_FunctionGenerator_channel channel 
)
protected

Definition at line 1522 of file vrpn_FunctionGenerator.C.

References vrpn_FunctionGenerator_channel::decode_from(), and vrpn_unbuffer().

Referenced by handle_channel_message().

Here is the call graph for this function:

◆ decode_channel_request()

vrpn_int32 vrpn_FunctionGenerator_Server::decode_channel_request ( const char *  buf,
const vrpn_int32  len,
vrpn_uint32 &  channelNum 
)
protected

Definition at line 1677 of file vrpn_FunctionGenerator.C.

References vrpn_unbuffer().

Referenced by handle_channelRequest_message().

Here is the call graph for this function:

◆ decode_sampleRate_request()

vrpn_int32 vrpn_FunctionGenerator_Server::decode_sampleRate_request ( const char *  buf,
const vrpn_int32  len,
vrpn_float32 &  sampleRate 
)
protected

Definition at line 1735 of file vrpn_FunctionGenerator.C.

References vrpn_FunctionGenerator::sampleRate, and vrpn_unbuffer().

Referenced by handle_sample_rate_message().

Here is the call graph for this function:

◆ encode_channel_reply()

vrpn_int32 vrpn_FunctionGenerator_Server::encode_channel_reply ( char **  buf,
vrpn_int32 &  len,
const vrpn_uint32  channelNum 
)
protected

Definition at line 1565 of file vrpn_FunctionGenerator.C.

References vrpn_FunctionGenerator::channels, vrpn_buffer(), and vrpn_FUNCTION_CHANNELS_MAX.

Referenced by sendChannelReply().

Here is the call graph for this function:

◆ encode_error_report()

vrpn_int32 vrpn_FunctionGenerator_Server::encode_error_report ( char **  buf,
vrpn_int32 &  len,
const FGError  err,
const vrpn_int32  channel 
)
protected

Definition at line 1958 of file vrpn_FunctionGenerator.C.

References vrpn_buffer().

Referenced by sendError().

Here is the call graph for this function:

◆ encode_interpreterDescription_reply()

vrpn_int32 vrpn_FunctionGenerator_Server::encode_interpreterDescription_reply ( char **  buf,
vrpn_int32 &  len,
const char *  desc 
)
protected

Definition at line 1900 of file vrpn_FunctionGenerator.C.

References vrpn_buffer().

Referenced by sendInterpreterDescription().

Here is the call graph for this function:

◆ encode_sampleRate_reply()

vrpn_int32 vrpn_FunctionGenerator_Server::encode_sampleRate_reply ( char **  buf,
vrpn_int32 &  len,
const vrpn_float32  sampleRate 
)
protected

Definition at line 1853 of file vrpn_FunctionGenerator.C.

References vrpn_FunctionGenerator::sampleRate, and vrpn_buffer().

Referenced by sendSampleRateReply().

Here is the call graph for this function:

◆ encode_start_reply()

vrpn_int32 vrpn_FunctionGenerator_Server::encode_start_reply ( char **  buf,
vrpn_int32 &  len,
const vrpn_bool  isStarted 
)
protected

Definition at line 1762 of file vrpn_FunctionGenerator.C.

References vrpn_buffer().

Referenced by sendStartReply().

Here is the call graph for this function:

◆ encode_stop_reply()

vrpn_int32 vrpn_FunctionGenerator_Server::encode_stop_reply ( char **  buf,
vrpn_int32 &  len,
const vrpn_bool  isStopped 
)
protected

Definition at line 1808 of file vrpn_FunctionGenerator.C.

References vrpn_buffer().

Referenced by sendStopReply().

Here is the call graph for this function:

◆ getInterpreterDescription()

virtual const char* vrpn_FunctionGenerator_Server::getInterpreterDescription ( )
pure virtual

◆ handle_allChannelRequest_message()

int VRPN_CALLBACK vrpn_FunctionGenerator_Server::handle_allChannelRequest_message ( void *  userdata,
vrpn_HANDLERPARAM  p 
)
static

Definition at line 574 of file vrpn_FunctionGenerator.C.

References sendChannelReply(), vrpn_BaseClassUnique::userdata, and vrpn_FUNCTION_CHANNELS_MAX.

Referenced by vrpn_FunctionGenerator_Server().

Here is the call graph for this function:

◆ handle_channel_message()

int VRPN_CALLBACK vrpn_FunctionGenerator_Server::handle_channel_message ( void *  userdata,
vrpn_HANDLERPARAM  p 
)
static

◆ handle_channelRequest_message()

int VRPN_CALLBACK vrpn_FunctionGenerator_Server::handle_channelRequest_message ( void *  userdata,
vrpn_HANDLERPARAM  p 
)
static

◆ handle_interpreter_request_message()

int VRPN_CALLBACK vrpn_FunctionGenerator_Server::handle_interpreter_request_message ( void *  userdata,
vrpn_HANDLERPARAM  p 
)
static

Definition at line 645 of file vrpn_FunctionGenerator.C.

References sendInterpreterDescription(), and vrpn_BaseClassUnique::userdata.

Referenced by vrpn_FunctionGenerator_Server().

Here is the call graph for this function:

◆ handle_sample_rate_message()

int VRPN_CALLBACK vrpn_FunctionGenerator_Server::handle_sample_rate_message ( void *  userdata,
vrpn_HANDLERPARAM  p 
)
static

◆ handle_start_message()

int VRPN_CALLBACK vrpn_FunctionGenerator_Server::handle_start_message ( void *  userdata,
vrpn_HANDLERPARAM  p 
)
static

Definition at line 594 of file vrpn_FunctionGenerator.C.

References start(), and vrpn_BaseClassUnique::userdata.

Referenced by vrpn_FunctionGenerator_Server().

Here is the call graph for this function:

◆ handle_stop_message()

int VRPN_CALLBACK vrpn_FunctionGenerator_Server::handle_stop_message ( void *  userdata,
vrpn_HANDLERPARAM  p 
)
static

Definition at line 608 of file vrpn_FunctionGenerator.C.

References stop(), and vrpn_BaseClassUnique::userdata.

Referenced by vrpn_FunctionGenerator_Server().

Here is the call graph for this function:

◆ mainloop()

void vrpn_FunctionGenerator_Server::mainloop ( )
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 505 of file vrpn_FunctionGenerator.C.

References vrpn_BaseClassUnique::server_mainloop().

Here is the call graph for this function:

◆ sendChannelReply()

◆ sendError()

int vrpn_FunctionGenerator_Server::sendError ( FGError  error,
vrpn_int32  channel 
)
protected

◆ sendInterpreterDescription()

◆ sendSampleRateReply()

◆ sendStartReply()

int vrpn_FunctionGenerator_Server::sendStartReply ( vrpn_bool  started)
protected

◆ sendStopReply()

int vrpn_FunctionGenerator_Server::sendStopReply ( vrpn_bool  stopped)
protected

◆ setChannel()

virtual void vrpn_FunctionGenerator_Server::setChannel ( vrpn_uint32  channelNum,
vrpn_FunctionGenerator_channel channel 
)
pure virtual

Referenced by handle_channel_message().

◆ setNumChannels()

vrpn_uint32 vrpn_FunctionGenerator_Server::setNumChannels ( vrpn_uint32  numChannels)

◆ setSampleRate()

virtual void vrpn_FunctionGenerator_Server::setSampleRate ( vrpn_float32  rate)
pure virtual

◆ start()

virtual void vrpn_FunctionGenerator_Server::start ( )
pure virtual

Referenced by handle_start_message().

◆ stop()

virtual void vrpn_FunctionGenerator_Server::stop ( )
pure virtual

Referenced by handle_stop_message().


The documentation for this class was generated from the following files: