vrpn
07.35
Virtual Reality Peripheral Network
Toggle main menu visibility
Loading...
Searching...
No Matches
vrpn_OmegaTemperature.h
Go to the documentation of this file.
1
#ifndef VRPN_OMEGATEMPERATURE_H
2
#define VRPN_OMEGATEMPERATURE_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
/* XXX The code has not been changed from the Biosciences code yet,
17
only the names have been changed. */
18
/*
19
# Analog channels: (read by client)
20
# 0 Reading from stage 1 in degrees Celcius
21
# 1 Reading from bath 1 in degrees Celcius
22
# 2 External 1 in degrees Celcius (or setpoint if ext not used)
23
# 3 Reading from stage 2 in degrees Celcius
24
# 4 Reading from bath 2 in degrees Celcius
25
# 5 External 1 in degrees Celcius (or setpoint if ext not used)
26
# Button channels: (read by client)
27
# 0 Temperature control is on or off
28
# Analog_Output channels: (set by client)
29
# 0 Reference temperature for channel 1
30
# 1 Reference temperature for channel 2
31
# 2 Turn temperature control on/off (0 = off, otherwise on)
32
*/
33
34
#if defined(VRPN_USE_MODBUS) && defined(VRPN_USE_WINSOCK2)
35
#include <modbus.h>
36
37
class
VRPN_API
vrpn_OmegaTemperature:
public
vrpn_Serial_Analog
,
38
public
vrpn_Analog_Output
,
public
vrpn_Button_Filter
39
{
40
public
:
41
// Tell it the temperature to use to set channels 1 and 2 to
42
// in Celcius and also whether to turn the temperature control on.
43
vrpn_OmegaTemperature (
const
char
* name,
vrpn_Connection
* c,
44
const
char
* port,
float
temp1,
float
temp2,
45
bool
control_on);
46
~vrpn_OmegaTemperature () {};
47
49
virtual
void
mainloop
();
50
51
protected
:
52
modbus_t *d_modbus;
//< Modbus object to use to communicate.
53
char
d_buffer[128];
//< Buffer of characters in report
54
unsigned
d_bufcount;
//< How many characters we have so far
55
56
struct
timeval timestamp;
//< Time of the last report from the device
57
58
virtual
int
reset(
void
);
//< Set device back to starting config
59
virtual
int
get_report(
void
);
//< Try to read a report from the device
60
61
// Channels are zero-referenced. Use 0 for channel 1.
62
bool
set_reference_temperature(
unsigned
channel,
float
value);
63
bool
set_control_status(
bool
on);
64
bool
request_temperature(
unsigned
channel);
65
66
// Sets a specified channel based on a new value from the Analog_Output.
67
// Channels 0 and 1 are temperature settings, and channel 2 is our
68
// hack to turn on and off temperatur control.
69
bool
set_specified_channel(
unsigned
channel, vrpn_float64 value);
70
71
// This lets us know which channel we're waiting for a reading on.
72
// It cycles; each time we hear from one, we ask for the next.
73
unsigned
d_next_channel_to_read;
74
75
float
convert_bytes_to_reading(
const
char
*buf);
76
78
virtual
void
report_changes
79
(vrpn_uint32 class_of_service =
vrpn_CONNECTION_RELIABLE
);
81
virtual
void
report
82
(vrpn_uint32 class_of_service =
vrpn_CONNECTION_RELIABLE
);
83
86
static
int
VRPN_CALLBACK
handle_request_message(
void
*userdata, vrpn_HANDLERPARAM p);
87
89
static
int
VRPN_CALLBACK
handle_request_channels_message(
void
*userdata, vrpn_HANDLERPARAM p);
90
92
static
int
VRPN_CALLBACK
handle_connect_message(
void
*userdata, vrpn_HANDLERPARAM p);
93
};
94
#endif
95
96
#endif
vrpn_Analog_Output
Definition
vrpn_Analog_Output.h:26
vrpn_Analog::report
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
vrpn_Analog::report_changes
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
vrpn_BaseClass::mainloop
virtual void mainloop()=0
Called once through each main loop iteration to handle updates. Remote object mainloop() should call ...
vrpn_Button_Filter
All button servers should derive from this class, which provides the ability to turn any of the butto...
Definition
vrpn_Button.h:66
vrpn_Serial_Analog
Definition
vrpn_Analog.h:63
vrpn_Connection
class VRPN_API vrpn_Connection
Definition
vrpn_3Space.h:7
vrpn_Analog.h
vrpn_Analog_Output.h
vrpn_Button.h
vrpn_Configure.h
VRPN_API
#define VRPN_API
Definition
vrpn_Configure.h:648
VRPN_CALLBACK
#define VRPN_CALLBACK
Definition
vrpn_Configure.h:649
vrpn_Connection.h
vrpn_CONNECTION_RELIABLE
const vrpn_uint32 vrpn_CONNECTION_RELIABLE
Classes of service for messages, specify multiple by ORing them together Priority of satisfying these...
Definition
vrpn_Connection.h:118
vrpn_Shared.h
vrpn_Types.h
vrpn_OmegaTemperature.h
Generated by
1.17.0