RflySimSDK v3.05
RflySimSDK说明文档
载入中...
搜索中...
未找到
vrpn_BiosciencesTools.h
1#ifndef VRPN_BIOSCIENCES_H
2#define VRPN_BIOSCIENCES_H
3
4// XXX Need to have a VRPN boolean output device. Then we can set the
5// temperature control to be on or off based on its value. For now, we're
6// doing a horrible thing and packing it into an analog output channel.
7
8#include "vrpn_Analog.h" // for vrpn_Serial_Analog
9#include "vrpn_Analog_Output.h" // for vrpn_Analog_Output
10#include "vrpn_Button.h" // for vrpn_Button_Filter
11#include "vrpn_Configure.h" // for VRPN_CALLBACK, VRPN_API
12#include "vrpn_Connection.h" // for vrpn_CONNECTION_RELIABLE, etc
13#include "vrpn_Shared.h" // for timeval
14#include "vrpn_Types.h" // for vrpn_uint32, vrpn_float64
15
16/*
17# Analog channels: (read by client)
18# 0 Reading from stage 1 in degrees Celcius
19# 1 Reading from bath 1 in degrees Celcius
20# 2 External 1 in degrees Celcius (or setpoint if ext not used)
21# 3 Reading from stage 2 in degrees Celcius
22# 4 Reading from bath 2 in degrees Celcius
23# 5 External 1 in degrees Celcius (or setpoint if ext not used)
24# Button channels: (read by client)
25# 0 Temperature control is on or off
26# Analog_Output channels: (set by client)
27# 0 Reference temperature for channel 1
28# 1 Reference temperature for channel 2
29# 2 Turn temperature control on/off (0 = off, otherwise on)
30*/
31
34{
35public:
36 // Tell it the temperature to use to set channels 1 and 2 to
37 // in Celcius and also whether to turn the temperature control on.
38 vrpn_BiosciencesTools (const char * name, vrpn_Connection * c,
39 const char * port, float temp1, float temp2,
40 bool control_on);
42
44 virtual void mainloop ();
45
46 protected:
47 char d_buffer[128]; //< Buffer of characters in report
48 unsigned d_bufcount; //< How many characters we have so far
49
50 struct timeval timestamp; //< Time of the last report from the device
51
52 virtual int reset(void); //< Set device back to starting config
53 virtual int get_report(void); //< Try to read a report from the device
54
55 // Channels are zero-referenced. Use 0 for channel 1.
56 bool set_reference_temperature(unsigned channel, float value);
57 bool set_control_status(bool on);
58 bool request_temperature(unsigned channel);
59
60 // Sets a specified channel based on a new value from the Analog_Output.
61 // Channels 0 and 1 are temperature settings, and channel 2 is our
62 // hack to turn on and off temperatur control.
63 bool set_specified_channel(unsigned channel, vrpn_float64 value);
64
65 // This lets us know which channel we're waiting for a reading on.
66 // It cycles; each time we hear from one, we ask for the next.
67 unsigned d_next_channel_to_read;
68
69 float convert_bytes_to_reading(const char *buf);
70
72 virtual void report_changes
73 (vrpn_uint32 class_of_service = vrpn_CONNECTION_RELIABLE);
75 virtual void report
76 (vrpn_uint32 class_of_service = vrpn_CONNECTION_RELIABLE);
77
80 static int VRPN_CALLBACK handle_request_message(void *userdata, vrpn_HANDLERPARAM p);
81
83 static int VRPN_CALLBACK handle_request_channels_message(void *userdata, vrpn_HANDLERPARAM p);
84
86 static int VRPN_CALLBACK handle_connect_message(void *userdata, vrpn_HANDLERPARAM p);
87};
88
89#endif
定义 vrpn_Analog_Output.h:26
定义 vrpn_BiosciencesTools.h:34
static int VRPN_CALLBACK handle_request_message(void *userdata, vrpn_HANDLERPARAM p)
virtual void mainloop()
Called once through each main loop iteration to handle updates.
virtual void report_changes(vrpn_uint32 class_of_service=vrpn_CONNECTION_RELIABLE)
send report iff changed
static int VRPN_CALLBACK handle_request_channels_message(void *userdata, vrpn_HANDLERPARAM p)
Responds to a request to change multiple channels at once.
virtual void report(vrpn_uint32 class_of_service=vrpn_CONNECTION_RELIABLE)
send report whether or not changed
static int VRPN_CALLBACK handle_connect_message(void *userdata, vrpn_HANDLERPARAM p)
Responds to a connection request with a report of the values
定义 vrpn_Button.h:66
Generic connection class not specific to the transport mechanism.
定义 vrpn_Connection.h:562
定义 vrpn_Analog.h:63
This structure is what is passed to a vrpn_Connection message callback.
定义 vrpn_Connection.h:41