00001 /* 00002 * LMS1xx.h 00003 * 00004 * Created on: 09-08-2010 00005 * Author: Konrad Banachowicz 00006 *************************************************************************** 00007 * This library is free software; you can redistribute it and/or * 00008 * modify it under the terms of the GNU Lesser General Public * 00009 * License as published by the Free Software Foundation; either * 00010 * version 2.1 of the License, or (at your option) any later version. * 00011 * * 00012 * This library is distributed in the hope that it will be useful, * 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00015 * Lesser General Public License for more details. * 00016 * * 00017 * You should have received a copy of the GNU Lesser General Public * 00018 * License along with this library; if not, write to the Free Software * 00019 * Foundation, Inc., 59 Temple Place, * 00020 * Suite 330, Boston, MA 02111-1307 USA * 00021 * * 00022 ***************************************************************************/ 00023 00024 #ifndef LMS1XX_H_ 00025 #define LMS1XX_H_ 00026 00027 #include <LMS1xx/lms_buffer.h> 00028 #include <LMS1xx/lms_structs.h> 00029 #include <string> 00030 #include <stdint.h> 00031 00032 typedef enum 00033 { 00034 undefined = 0, 00035 initialisation = 1, 00036 configuration = 2, 00037 idle = 3, 00038 rotated = 4, 00039 in_preparation = 5, 00040 ready = 6, 00041 ready_for_measurement = 7 00042 } status_t; 00043 00051 class LMS1xx 00052 { 00053 public: 00054 LMS1xx(); 00055 virtual ~LMS1xx(); 00056 00062 void connect(std::string host, int port = 2111); 00063 00067 void disconnect(); 00068 00073 bool isConnected(); 00074 00079 void startMeas(); 00080 00085 void stopMeas(); 00086 00091 status_t queryStatus(); 00092 00097 void login(); 00098 00108 scanCfg getScanCfg() const; 00109 00119 void setScanCfg(const scanCfg &cfg); 00120 00126 void setScanDataCfg(const scanDataCfg &cfg); 00127 00136 scanOutputRange getScanOutputRange() const; 00137 00143 void scanContinous(int start); 00144 00150 bool getScanData(scanData* scan_data); 00151 00157 void saveConfig(); 00158 00163 void startDevice(); 00164 00165 protected: 00170 static void parseScanData(char* buf, scanData* data); 00171 00172 bool connected_; 00173 LMSBuffer buffer_; 00174 int socket_fd_; 00175 }; 00176 00177 #endif /* LMS1XX_H_ */ 00178