00001
00002
00003
00004
00005 #ifndef CAJUN_LABJACKUE9_H
00006 #define CAJUN_LABJACKUE9_H
00007
00008
00009 typedef struct ue9_calibration_information
00010 {
00011 double unipolar_slope[4];
00012 double unipolar_offset[4];
00013 double bipolar_slope;
00014 double bipolar_offset;
00015 double dac_slope[2];
00016 double dac_offset[2];
00017 double temp_slope;
00018 double temp_slope_low;
00019 double cal_temp;
00020 double v_ref;
00021 double v_ref_div2;
00022 double vs_slope;
00023 double hi_res_unipolar_slope;
00024 double hi_res_unipolar_offset;
00025 double hi_res_bipolar_slope;
00026 double hi_res_bipolar_offset;
00027 } calib_info_t;
00028
00029
00030 typedef struct channel_parameters
00031 {
00032 double max_voltage;
00033 double mid_voltage;
00034 double min_voltage;
00035 bool reverse;
00036 } channel_parameters_t;
00037
00038 namespace cajun
00039 {
00040 class labjack_ue9_t
00041 {
00042 public:
00043
00044 labjack_ue9_t (void);
00045
00046 bool initialize (void);
00047
00048 bool set_limits (unsigned channel_number, double max_voltage, double mid_voltage, double min_voltage, bool reverse);
00049
00050 int open_labjack_ue9_device (const char *ip_address, int tcp_port);
00051
00052 bool set_position (unsigned steering_channel, double steering_position,
00053 unsigned throttle_channel, double throttle_position);
00054
00055 bool handle_response (void);
00056 int socket_status (void);
00057 void close_labjack_device (void);
00058
00059 bool set_watchdogtimer (double timeout, double steering_position,
00060 unsigned steering_channel, double throttle_position,
00061 unsigned throttle_channel);
00062 bool get_watchdogtimer_settings (double timeout, double steering_position,
00063 unsigned steering_channel, double throttle_position,
00064 unsigned throttle_channel);
00065
00066
00067 protected:
00068 int m_socketfd;
00069
00070 calib_info_t m_calib_info;
00071
00072 channel_parameters_t channel[2];
00073
00074 double no_of_analog_channels;
00075
00076 double mapping_ratio;
00077 void set_extended_checksum (unsigned char *sendbuff, int length);
00078
00079 int check_recv_data_checksum (unsigned char *recvbuff, int length) const;
00080
00081 int get_calib_info (void);
00082
00083 double byte_array_to_double (unsigned char *buffer, int start_index);
00084
00085 };
00086 };
00087
00088
00089 #endif