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 <string> 00028 #include <stdint.h> 00029 00036 typedef struct _scanCfg { 00041 int scaningFrequency; 00042 00047 int angleResolution; 00048 00053 int startAngle; 00054 00059 int stopAngle; 00060 } scanCfg; 00061 00068 typedef struct _scanDataCfg { 00069 00074 int outputChannel; 00075 00080 bool remission; 00081 00086 int resolution; 00087 00092 int encoder; 00093 00098 bool position; 00099 00104 bool deviceName; 00105 00106 bool timestamp; 00107 00117 int outputInterval; 00118 } scanDataCfg; 00119 00126 typedef struct _scanData { 00127 00132 int dist_len1; 00133 00138 uint16_t dist1[1082]; 00139 00144 int dist_len2; 00145 00150 uint16_t dist2[1082]; 00151 00156 int rssi_len1; 00157 00162 uint16_t rssi1[1082]; 00163 00168 int rssi_len2; 00169 00174 uint16_t rssi2[1082]; 00175 } scanData; 00176 00177 typedef enum { 00178 undefined = 0, 00179 initialisation = 1, 00180 configuration = 2, 00181 idle = 3, 00182 rotated = 4, 00183 in_preparation = 5, 00184 ready = 6, 00185 ready_for_measurement = 7 00186 } status_t; 00187 00195 class LMS1xx { 00196 public: 00197 LMS1xx(); 00198 virtual ~LMS1xx(); 00199 00205 void connect(std::string host, int port = 2111); 00206 00210 void disconnect(); 00211 00216 bool isConnected(); 00217 00222 void startMeas(); 00223 00228 void stopMeas(); 00229 00234 status_t queryStatus(); 00235 00240 void login(); 00241 00251 scanCfg getScanCfg() const; 00252 00262 void setScanCfg(const scanCfg &cfg); 00263 00269 void setScanDataCfg(const scanDataCfg &cfg); 00270 00276 void scanContinous(int start); 00277 00283 void getData(scanData& data); 00284 00290 void saveConfig(); 00291 00296 void startDevice(); 00297 00298 private: 00299 bool connected; 00300 bool debug; 00301 00302 int sockDesc; 00303 }; 00304 00305 #endif /* LMS1XX_H_ */