1
#ifndef VRPN_NIKON_CONTROLS_H
2
#define VRPN_NIKON_CONTROLS_H
4
#include "vrpn_Analog.h"
5
#include "vrpn_Analog_Output.h"
7
class VRPN_API vrpn_Nikon_Controls : public vrpn_Serial_Analog, public vrpn_Analog_Output {
9
vrpn_Nikon_Controls(const char *device_name, vrpn_Connection *con = NULL, const char *port_name = "COM1");
10
~vrpn_Nikon_Controls(void) {};
12
virtual void mainloop ();
17
unsigned char _buffer[512]; //< Buffer of characters in report
18
unsigned _bufcount; //< How many characters we have so far
20
double _requested_focus; //< Where we asked the focus to be set to
22
struct timeval timestamp; //< Time of the last report from the device
24
virtual int reset(void); //< Set device back to starting config
25
virtual int get_report(void); //< Try to read a report from the device
26
virtual int set_channel(unsigned chan_num, vrpn_float64 value); //< Try to set the focus to this
28
/// Send changes since the last time
29
virtual void report_changes (vrpn_uint32 class_of_service = vrpn_CONNECTION_LOW_LATENCY);
31
/// Send values whether or not they have changed.
32
virtual void report (vrpn_uint32 class_of_service = vrpn_CONNECTION_LOW_LATENCY);
34
/// Responds to a connection request with a report of the values
35
static int VRPN_CALLBACK handle_connect_message(void *userdata, vrpn_HANDLERPARAM p);
37
/// Responds to a request to change one of the values by
38
/// setting the channel to that value.
39
static int VRPN_CALLBACK handle_request_message(void *userdata, vrpn_HANDLERPARAM p);
41
/// Responds to a request to change multiple channels at once.
42
static int VRPN_CALLBACK handle_request_channels_message(void *userdata, vrpn_HANDLERPARAM p);