RflySimSDK v3.05
RflySimSDK说明文档
载入中...
搜索中...
未找到
vrpn_Analog_Radamec_SPI.h
1#ifndef VRPN_RADAMEC_SPI_H
2#define VRPN_RADAMEC_SPI_H
3
4#include "vrpn_Analog.h" // for vrpn_Serial_Analog
5#include "vrpn_Configure.h" // for VRPN_API
6#include "vrpn_Connection.h" // for vrpn_CONNECTION_LOW_LATENCY, etc
7#include "vrpn_Shared.h" // for timeval
8#include "vrpn_Types.h" // for vrpn_uint32, vrpn_int32
9
11{
12public:
13 vrpn_Radamec_SPI (const char * name, vrpn_Connection * c,
14 const char * port, int baud = 38400);
15
17
19 virtual void mainloop ();
20
21 protected:
22 int _status; //< Reset, Syncing, or Reading
23 int _camera_id; //< What is our camera ID, queried from device
24 int _numchannels; //< How many analog channels to open
25
26 unsigned _expected_chars; //< How many characters to expect in the report
27 unsigned char _buffer[512]; //< Buffer of characters in report
28 unsigned _bufcount; //< How many characters we have so far
29
30 struct timeval timestamp; //< Time of the last report from the device
31
32 virtual int reset(void); //< Set device back to starting config
33 virtual int get_report(void); //< Try to read a report from the device
34
35 virtual void clear_values(void); //< Clears all channels to 0
36
38 unsigned char compute_crc(const unsigned char *head, int len);
39
41 vrpn_uint32 convert_24bit_unsigned(const unsigned char *buf);
42
44 vrpn_int32 convert_16bit_unsigned(const unsigned char *buf);
45
46 double int_to_pan(vrpn_uint32 val); //< Returns pan in degrees
47 double int_to_tilt(vrpn_uint32 val) //< Returns tilt in degrees
48 { return int_to_pan(val); };
49 double int_to_zoom(vrpn_uint32 val); //< Returns zoom in meters
50 double int_to_focus(vrpn_uint32 val); //< Returns focal length in meters
51 double int_to_height(vrpn_uint32 val); //< Returns height in meters
52 double int_to_X(vrpn_uint32 mm, vrpn_uint32 frac); //< Returns X location in meters
53 double int_to_Y(vrpn_uint32 mm, vrpn_uint32 frac) //< Returns Y location in meters
54 { return int_to_X(mm, frac); };
55 double int_to_orientation(vrpn_uint32 val); //< Returns orientation in degrees
56
59 int send_command(const unsigned char *cmd, int len);
60
62 virtual void report_changes
63 (vrpn_uint32 class_of_service = vrpn_CONNECTION_LOW_LATENCY);
65 virtual void report
66 (vrpn_uint32 class_of_service = vrpn_CONNECTION_LOW_LATENCY);
67};
68
69#endif
Generic connection class not specific to the transport mechanism.
定义 vrpn_Connection.h:562
定义 vrpn_Analog_Radamec_SPI.h:11
int send_command(const unsigned char *cmd, int len)
vrpn_uint32 convert_24bit_unsigned(const unsigned char *buf)
Convert a 24-bit value from a buffer into an unsigned integer value
virtual void mainloop()
Called once through each main loop iteration to handle updates.
vrpn_int32 convert_16bit_unsigned(const unsigned char *buf)
Convert a 16-bit unsigned value from a buffer into an integer
virtual void report(vrpn_uint32 class_of_service=vrpn_CONNECTION_LOW_LATENCY)
send report whether or not changed
unsigned char compute_crc(const unsigned char *head, int len)
Compute the CRC for the message or report starting at head with length len.
virtual void report_changes(vrpn_uint32 class_of_service=vrpn_CONNECTION_LOW_LATENCY)
send report iff changed
定义 vrpn_Analog.h:63