7#include "vrpn_Configure.h"
8#include "vrpn_Connection.h"
9#include "vrpn_Shared.h"
10#include "vrpn_Types.h"
12#ifndef VRPN_CLIENT_ONLY
16#define vrpn_CHANNEL_MAX 128
19const int vrpn_ANALOG_SYNCING = (2);
20const int vrpn_ANALOG_REPORT_READY = (1);
21const int vrpn_ANALOG_PARTIAL = (0);
22const int vrpn_ANALOG_RESETTING = (-1);
23const int vrpn_ANALOG_FAIL = (-2);
26const struct timeval vrpn_ANALOG_NOW = {0, 0};
35 vrpn_int32 getNumChannels(
void)
const;
38 vrpn_float64 channel[vrpn_CHANNEL_MAX];
39 vrpn_float64 last[vrpn_CHANNEL_MAX];
40 vrpn_int32 num_channel;
41 struct timeval timestamp;
42 vrpn_int32 channel_m_id;
49 virtual vrpn_int32 encode_to(
char *buf);
54 const struct timeval time = vrpn_ANALOG_NOW);
58 report(vrpn_uint32 class_of_service = vrpn_CONNECTION_LOW_LATENCY,
59 const struct timeval time = vrpn_ANALOG_NOW);
62#ifndef VRPN_CLIENT_ONLY
63class VRPN_API vrpn_Serial_Analog :
public vrpn_Analog {
66 const char *port,
int baud = 9600,
int bits = 8,
67 vrpn_SER_PARITY parity = vrpn_SER_PARITY_NONE,
68 bool rts_flow =
false);
69 ~vrpn_Serial_Analog();
75 unsigned char buffer[1024];
78 int read_available_characters(
char *buffer,
int bytes);
95class VRPN_API vrpn_Analog_Server :
public vrpn_Analog {
99 vrpn_int32 numChannels = vrpn_CHANNEL_MAX);
104 const struct timeval time = vrpn_ANALOG_NOW);
108 report(vrpn_uint32 class_of_service = vrpn_CONNECTION_LOW_LATENCY,
109 const struct timeval time = vrpn_ANALOG_NOW);
130class VRPN_API vrpn_Clipping_Analog_Server :
public vrpn_Analog_Server {
133 vrpn_int32 numChannels = vrpn_CHANNEL_MAX);
169 struct timeval msg_time;
170 vrpn_int32 num_channel;
171 vrpn_float64 channel[vrpn_CHANNEL_MAX];
174typedef void(VRPN_CALLBACK *vrpn_ANALOGCHANGEHANDLER)(
void *userdata,
175 const vrpn_ANALOGCB info);
181class VRPN_API vrpn_Analog_Remote :
public vrpn_Analog {
192 virtual int register_change_handler(
void *userdata,
193 vrpn_ANALOGCHANGEHANDLER handler)
195 return d_callback_list.register_handler(userdata, handler);
197 virtual int unregister_change_handler(
void *userdata,
198 vrpn_ANALOGCHANGEHANDLER handler)
200 return d_callback_list.unregister_handler(userdata, handler);
204 vrpn_Callback_List<vrpn_ANALOGCB> d_callback_list;
206 static int VRPN_CALLBACK
207 handle_change_message(
void *userdata, vrpn_HANDLERPARAM p);
virtual void report(vrpn_uint32 class_of_service=vrpn_CONNECTION_LOW_LATENCY, const struct timeval time=vrpn_ANALOG_NOW)
Makes public the protected base class function
vrpn_float64 * channels(void)
Exposes an array of values for the user to write into.
定义 vrpn_Analog.h:117
virtual void report_changes(vrpn_uint32 class_of_service=vrpn_CONNECTION_LOW_LATENCY, const struct timeval time=vrpn_ANALOG_NOW)
Makes public the protected base class function
virtual void mainloop()
定义 vrpn_Analog.h:114
vrpn_int32 setNumChannels(vrpn_int32 sizeRequested)
virtual void report(vrpn_uint32 class_of_service=vrpn_CONNECTION_LOW_LATENCY, const struct timeval time=vrpn_ANALOG_NOW)
virtual void report_changes(vrpn_uint32 class_of_service=vrpn_CONNECTION_LOW_LATENCY, const struct timeval time=vrpn_ANALOG_NOW)
virtual int register_types(void)
void server_mainloop(void)
vrpn_BaseClass(const char *name, vrpn_Connection *c=NULL)
int setChannelValue(int channel, double value)
int setClipValues(int channel, double min, double lowzero, double highzero, double max)
Generic connection class not specific to the transport mechanism.
定义 vrpn_Connection.h:562
vrpn_Serial: Pulls all the serial port routines into one file to make porting to new operating system...