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 _scanOutputRange { 00131 int angleResolution; 00132 00137 int startAngle; 00138 00143 int stopAngle; 00144 } scanOutputRange; 00151 typedef struct _scanData { 00152 00157 int dist_len1; 00158 00163 uint16_t dist1[1082]; 00164 00169 int dist_len2; 00170 00175 uint16_t dist2[1082]; 00176 00181 int rssi_len1; 00182 00187 uint16_t rssi1[1082]; 00188 00193 int rssi_len2; 00194 00199 uint16_t rssi2[1082]; 00200 } scanData; 00201 00202 typedef enum { 00203 undefined = 0, 00204 initialisation = 1, 00205 configuration = 2, 00206 idle = 3, 00207 rotated = 4, 00208 in_preparation = 5, 00209 ready = 6, 00210 ready_for_measurement = 7 00211 } status_t; 00212 00220 class LMS1xx { 00221 public: 00222 LMS1xx(); 00223 virtual ~LMS1xx(); 00224 00230 void connect(std::string host, int port = 2111); 00231 00235 void disconnect(); 00236 00241 bool isConnected(); 00242 00247 void startMeas(); 00248 00253 void stopMeas(); 00254 00259 status_t queryStatus(); 00260 00265 void login(); 00266 00276 scanCfg getScanCfg() const; 00277 00287 void setScanCfg(const scanCfg &cfg); 00288 00294 void setScanDataCfg(const scanDataCfg &cfg); 00295 00304 scanOutputRange getScanOutputRange() const; 00305 00311 void scanContinous(int start); 00312 00318 void getData(scanData& data); 00319 00325 void saveConfig(); 00326 00331 void startDevice(); 00332 00333 private: 00334 bool connected; 00335 00336 int sockDesc; 00337 }; 00338 00339 #endif /* LMS1XX_H_ */ 00340