RflySimSDK v3.05
RflySimSDK说明文档
载入中...
搜索中...
未找到
vrpn_NationalInstruments.h
1// vrpn_NationalInstruments.h
2// Russell Taylor, May 2004
3//
4
5#ifndef VRPN_NATIONALINSTRUMENTS_H
6#define VRPN_NATIONALINSTRUMENTS_H
7
8#ifdef VRPN_USE_NATIONAL_INSTRUMENTS_MX
9#include <NIDAQmx.h>
10#endif
11
12#include "vrpn_Analog.h" // for vrpn_CHANNEL_MAX, etc
13#include "vrpn_Analog_Output.h" // for vrpn_Analog_Output
14#include "vrpn_Configure.h" // for VRPN_CALLBACK, VRPN_API
15#include "vrpn_Connection.h"
16#include "vrpn_Shared.h" // for timeval
17#include "vrpn_Types.h" // for vrpn_int32, vrpn_uint32, etc
18
19#define vrpn_NI_INPUT_MODE_DIFFERENTIAL (0)
20#define vrpn_NI_INPUT_MODE_REF_SINGLE_ENDED (1)
21#define vrpn_NI_INPUT_MODE_NON_REF_SINGLE_ENDED (2)
22#define vrpn_NI_INPUT_RANGE_5V (5)
23#define vrpn_NI_INPUT_RANGE_10V (10)
24#define vrpn_NI_INPUT_RANGE_20V (20)
25
26// An Analog and/or Analog_Output server that uses National Instruments cards
27// to do its input and output. It supercedes the vrpn_Analog_Output_Server_NI,
28// which is now depracated.
29
31public:
33 const char *boardName = "PCI-6713",
34 int numInChannels = vrpn_CHANNEL_MAX,
35 int numOutChannels = vrpn_CHANNEL_MAX,
36 double minInputReportDelaySecs = 0.0,
37 bool inBipolar = false,
38 int inputMode = vrpn_NI_INPUT_MODE_DIFFERENTIAL, // Input parameters (A/D)
39 int inputRange = vrpn_NI_INPUT_RANGE_10V,
40 bool driveAIS = false,
41 int inputGain = 1,
42 bool outBipolar = false, // Output parameters (D/A)
43 double minOutVoltage = 0.0,
44 double maxOutVoltage = 10.0);
46
47 virtual void mainloop();
48
49protected:
50 // Addresses of the devices
51#ifdef VRPN_USE_NATIONAL_INSTRUMENTS_MX
52 TaskHandle d_analog_task_handle;
53 TaskHandle d_analog_out_task_handle;
54 bool setValues(); // Transfer our internal values to the D/A
55 void reportError(int32 errnumber, vrpn_bool exitProgram = vrpn_false);
56#else
57 short d_device_number; //< National Instruments device to use
58#endif
59 short d_in_polarity; //< Polarity (1 = unipolar, 0 = bipolar)
60 int d_in_gain; //< Input gain
61 double d_in_min_delay; //< Minimum delay between two readings
62 double d_out_min_voltage; //< Minimum voltage allowed on a channel
63 double d_out_max_voltage; //< Maximum voltate allowed on a channel
64 short d_out_polarity; //< Polarity (1 = unipolar, 0 = bipolar)
65 struct timeval d_last_report_time;//< When was the last analog tracker report sent?
66
70 int setNumInChannels (int sizeRequested);
71
75 int setNumOutChannels (int sizeRequested);
76
81 static int VRPN_CALLBACK handle_request_message( void *userdata,
83
88 static int VRPN_CALLBACK handle_request_channels_message( void* userdata,
90
93 static int VRPN_CALLBACK handle_got_connection( void* userdata, vrpn_HANDLERPARAM p );
94
95 virtual bool report_num_channels( vrpn_uint32 class_of_service = vrpn_CONNECTION_RELIABLE );
96 virtual vrpn_int32 encode_num_channels_to( char* buf, vrpn_int32 num );
97};
98
99// An Analog output server that uses National Instruments cards to do its
100// output. It is superceded by vrpn_National_Instruments_Server, and is
101// now deprecated. It only works with the NIDAQ traditional.
102
104public:
105 vrpn_Analog_Output_Server_NI(const char* name, vrpn_Connection* c,
106 const char *boardName = "PCI-6713",
107 vrpn_int16 numChannels = vrpn_CHANNEL_MAX,
108 bool bipolar = false,
109 double minVoltage = 0.0,
110 double maxVoltage = 10.0);
111 virtual ~vrpn_Analog_Output_Server_NI(void);
112
113 virtual void mainloop();
114
115protected:
116 short NI_device_number; //< National Instruments device to use
117 short NI_num_channels; //< Number of channels on the board
118 double min_voltage; //< Minimum voltage allowed on a channel
119 double max_voltage; //< Maximum voltate allowed on a channel
120 short polarity; //< Polarity (1 = unipolar, 0 = bipolar)
121
125 vrpn_int32 setNumChannels (vrpn_int32 sizeRequested);
126
131 static int VRPN_CALLBACK handle_request_message( void *userdata,
133
138 static int VRPN_CALLBACK handle_request_channels_message( void* userdata,
140
143 static int VRPN_CALLBACK handle_got_connection( void* userdata, vrpn_HANDLERPARAM p );
144
145 virtual bool report_num_channels( vrpn_uint32 class_of_service = vrpn_CONNECTION_RELIABLE );
146 virtual vrpn_int32 encode_num_channels_to( char* buf, vrpn_int32 num );
147};
148
149#endif
定义 vrpn_NationalInstruments.h:103
static int VRPN_CALLBACK handle_request_message(void *userdata, vrpn_HANDLERPARAM p)
static int VRPN_CALLBACK handle_request_channels_message(void *userdata, vrpn_HANDLERPARAM p)
static int VRPN_CALLBACK handle_got_connection(void *userdata, vrpn_HANDLERPARAM p)
vrpn_int32 setNumChannels(vrpn_int32 sizeRequested)
定义 vrpn_Analog_Output.h:26
定义 vrpn_Analog.h:28
Generic connection class not specific to the transport mechanism.
定义 vrpn_Connection.h:562
定义 vrpn_NationalInstruments.h:30
int setNumOutChannels(int sizeRequested)
static int VRPN_CALLBACK handle_request_message(void *userdata, vrpn_HANDLERPARAM p)
int setNumInChannels(int sizeRequested)
static int VRPN_CALLBACK handle_request_channels_message(void *userdata, vrpn_HANDLERPARAM p)
static int VRPN_CALLBACK handle_got_connection(void *userdata, vrpn_HANDLERPARAM p)
This structure is what is passed to a vrpn_Connection message callback.
定义 vrpn_Connection.h:41