vrpn 07.35
Virtual Reality Peripheral Network
 
Loading...
Searching...
No Matches
vrpn_Zaber.h
Go to the documentation of this file.
1#ifndef VRPN_ZABER_H
2#define VRPN_ZABER_H
3
4#include "vrpn_Analog.h" // for vrpn_Serial_Analog
5#include "vrpn_Analog_Output.h" // for vrpn_Analog_Output
6#include "vrpn_Configure.h" // for VRPN_CALLBACK, VRPN_API
7#include "vrpn_Connection.h" // for vrpn_CONNECTION_RELIABLE, etc
8#include "vrpn_Shared.h" // for timeval
9#include "vrpn_Types.h" // for vrpn_int32, vrpn_uint32
10
12{
13public:
14 vrpn_Zaber (const char * name, vrpn_Connection * c,
15 const char * port);
17
19 virtual void mainloop ();
20
21 protected:
22 unsigned d_expected_chars; //< How many characters to expect in the report
23 unsigned char d_buffer[512]; //< Buffer of characters in report
24 unsigned d_bufcount; //< How many characters we have so far
25
26 struct timeval timestamp; //< Time of the last report from the device
27 struct timeval d_last_poll; //< Time of last poll of the device.
28
29 virtual int reset(void); //< Set device back to starting config
30 virtual int get_report(void); //< Try to read a report from the device
31
32 bool send_command(unsigned char devicenum, unsigned char cmd, vrpn_int32 data);
33 bool send_command(unsigned char devnum, unsigned char cmd, unsigned char d0,
34 unsigned char d1, unsigned char d2, unsigned char d3);
35 vrpn_int32 convert_bytes_to_reading(const unsigned char *buf);
36
38 virtual void report_changes
39 (vrpn_uint32 class_of_service = vrpn_CONNECTION_RELIABLE);
41 virtual void report
42 (vrpn_uint32 class_of_service = vrpn_CONNECTION_RELIABLE);
43
47
50
53};
54
55#endif
vrpn_Analog_Output(const char *name, vrpn_Connection *c=NULL)
virtual void report(vrpn_uint32 class_of_service=vrpn_CONNECTION_LOW_LATENCY, const struct timeval time=vrpn_ANALOG_NOW)
Send a report whether something has changed or not (for servers) Optionally, tell what time to stamp ...
Definition vrpn_Analog.C:94
virtual void report_changes(vrpn_uint32 class_of_service=vrpn_CONNECTION_LOW_LATENCY, const struct timeval time=vrpn_ANALOG_NOW)
Send a report only if something has changed (for servers) Optionally, tell what time to stamp the val...
Definition vrpn_Analog.C:71
virtual void mainloop()=0
Called once through each main loop iteration to handle updates. Remote object mainloop() should call ...
Generic connection class not specific to the transport mechanism.
vrpn_Serial_Analog(const char *name, vrpn_Connection *connection, const char *port, int baud=9600, int bits=8, vrpn_SER_PARITY parity=vrpn_SER_PARITY_NONE, bool rts_flow=false)
vrpn_int32 convert_bytes_to_reading(const unsigned char *buf)
Convert the four bytes that have been read into a signed integer value.
Definition vrpn_Zaber.C:114
static int VRPN_CALLBACK handle_request_message(void *userdata, vrpn_HANDLERPARAM p)
Responds to a request to change one of the values by setting the channel to that value.
Definition vrpn_Zaber.C:335
virtual int reset(void)
Definition vrpn_Zaber.C:134
static int VRPN_CALLBACK handle_request_channels_message(void *userdata, vrpn_HANDLERPARAM p)
Responds to a request to change multiple channels at once.
Definition vrpn_Zaber.C:363
vrpn_Zaber(const char *name, vrpn_Connection *c, const char *port)
Definition vrpn_Zaber.C:38
virtual int get_report(void)
Definition vrpn_Zaber.C:226
unsigned char d_buffer[512]
Definition vrpn_Zaber.h:23
unsigned d_bufcount
Definition vrpn_Zaber.h:24
static int VRPN_CALLBACK handle_connect_message(void *userdata, vrpn_HANDLERPARAM p)
Responds to a connection request with a report of the values.
Definition vrpn_Zaber.C:391
struct timeval timestamp
Definition vrpn_Zaber.h:26
struct timeval d_last_poll
Definition vrpn_Zaber.h:27
bool send_command(unsigned char devicenum, unsigned char cmd, vrpn_int32 data)
Definition vrpn_Zaber.C:76
unsigned d_expected_chars
Definition vrpn_Zaber.h:22
This structure is what is passed to a vrpn_Connection message callback.
#define VRPN_API
#define VRPN_CALLBACK
const vrpn_uint32 vrpn_CONNECTION_RELIABLE
Classes of service for messages, specify multiple by ORing them together Priority of satisfying these...