Index: trunk/Sick/SickLMSSensor.cpp
===================================================================
--- trunk/Sick/SickLMSSensor.cpp	(revision 72)
+++ trunk/Sick/SickLMSSensor.cpp	(revision 74)
@@ -110,20 +110,23 @@
 //    sprintf(buf, "%c%s%c", 0x02, "sMN SetAccessMode 03 F4724744", 0x03);
 //    S_socket->sendToServer(QString(buf));
-
-
-//    sprintf(buf, "%c%s%c", 0x02, "sWN LMDscandatacfg 03 00 1 1 0 00 00 0 0 0 0 1 1", 0x03);
+//
+//    //sprintf(buf, "%c%s%c", 0x02, "sMN mLMPsetscancfg 2500 1 2500 300000 1500000", 0x03);//chunlei to configure the angle of the sensor
+//    //S_socket->sendToServer(QString(buf));
+//
+//    sprintf(buf, "%c%s%c", 0x02, "sWN LMDscandatacfg 01 01 1 1 0 00 00 0 0 0 0 1 1", 0x03);
 //    S_socket->sendToServer(QString(buf));
-
+//
 ////    sprintf(buf, "%c%s%c", 0x02, "sWN FREchoFilter 1", 0x03);
 ////    S_socket->sendToServer(QString(buf));
-
+//
+//
 /////// SAVE PERMANENT
 //    sprintf(buf, "%c%s%c", 0x02, "sMN mEEwriteall", 0x03);
 //    S_socket->sendToServer(QString(buf));
-
+//
 ////    /// LOGOUT
 //    sprintf(buf, "%c%s%c", 0x02, "sMN Run", 0x03);
 //    S_socket->sendToServer(QString(buf));
-
+////
 
     // Start measurement
@@ -367,5 +370,4 @@
     msg->data.rssi_len2 = 0;
 
-
 //    for(std::vector<std::string>::iterator it = msg->splitMessage->begin(); it != msg->splitMessage->end(); it++){
 //        printf("%s ", (*it).c_str());
@@ -397,5 +399,5 @@
     msg->data.scanFrequency = xstol(msg->splitMessage->at(16));
     LOG_TRACE("(Parsing) Scan frequency "<< msg->data.scanFrequency <<" [1/100 Hz]");
-
+	//LOG_INFO("(Parsing) Scan frequency "<< msg->data.scanFrequency <<" [1/100 Hz]");
     //    17 //MeasurementFrequency
 
@@ -403,5 +405,5 @@
     int NumberEncoders = xstol(msg->splitMessage->at(18));
     LOG_TRACE("(Parsing) Number Encoders "<< NumberEncoders);
-
+	//LOG_INFO("(Parsing) Number Encoders "<< NumberEncoders);
         for (int i = 0; i < NumberEncoders; i++) {
     //         //EncoderPosition
@@ -449,14 +451,14 @@
                 scalingFactor = 2;
             LOG_TRACE("(Parsing 16bit channel #"<<i<<") Scaling factor x"<< scalingFactor);
-
+			//LOG_INFO("(Parsing 16bit channel #"<<i<<") Scaling factor x"<< scalingFactor);
 //            19+NumberEncoders*2+i*6+totalData16+3 //ScalingOffset
 //            19+NumberEncoders*2+i*6+totalData16+4 //Starting angle
             msg->data.startAngle = xstol(msg->splitMessage->at(19+NumberEncoders*2+i*6+totalData16+4));
             LOG_TRACE("(Parsing 16bit channel #"<<i<<") Start angle "<< msg->data.startAngle << " [1/10000 degree]");
-
+			//LOG_INFO("(Parsing 16bit channel #"<<i<<") Start angle "<< msg->data.startAngle << " [1/10000 degree]");
 //            19+NumberEncoders*2+i*6+totalData16+5 //Angular step width
             msg->data.angleResolution = xstol(msg->splitMessage->at(19+NumberEncoders*2+i*6+totalData16+5));
             LOG_TRACE("(Parsing 16bit channel #"<<i<<") Angular step width "<< msg->data.angleResolution<<" [1/10000 degree]");
-
+			//LOG_INFO("(Parsing 16bit channel #"<<i<<") Angular step width "<< msg->data.angleResolution<<" [1/10000 degree]");
 //            19+NumberEncoders*2+i*6+totalData16+6 //NumberData
             NumberData = xstol(msg->splitMessage->at(19+NumberEncoders*2+i*6+totalData16+6));
@@ -501,25 +503,37 @@
         int NumberChannels8Bit = xstol(msg->splitMessage->at(19+NumberEncoders*2+NumberChannels16Bit*6+totalData16+1));
         LOG_TRACE("(Processing) Number channels 8Bit : "<<NumberChannels8Bit);
-
+		//LOG_INFO("(Processing) Number channels 8Bit : "<<NumberChannels8Bit);
         LOG_INFO("(Parsing) 8bit channel not implemented yet !");
 
-/*
+
 //        int totalData8 = 0;
-//        for (int i = 0; i < NumberChannels8Bit; i++) {
-
+//        for (int i = 0; i < NumberChannels8Bit; i++)
+//		{
+//
 //            int type = -1;
-
+//
 //            std::string content = msg->splitMessage->at(21+NumberEncoders*2+NumberChannels16Bit*6+totalData16+totalData8+i*6);
 //            LOG_TRACE("(Parsing 8bit channel) Measured Data Content : " << content);
-//            if (content == "DIST1") {
+//            if (content == "RSSI1") {
 //                type = 0;
-//            } else if (content=="DIST2") {
+//            } else if (content=="RSSI2") {
 //                type = 1;
-//            } else if (content=="RSSI1") {
+//            } 
+//		/*	else if (content=="RSSI1") {
 //                type = 2;
 //            } else if (content == "RSSI2") {
 //                type = 3;
 //            }
-
+//			*/
+//            
+//			LOG_INFO("(Parsing 8bit channel #"<<i<<") Scaling factor x"<< 21+NumberEncoders*2+NumberChannels16Bit*6+totalData16+totalData8+i*6+1);
+////            19+NumberEncoders*2+i*6+totalData16+3 //ScalingOffset
+////            19+NumberEncoders*2+i*6+totalData16+4 //Starting angle
+//
+//			LOG_INFO("(Parsing 8bit channel #"<<i<<") Start angle "<< 21+NumberEncoders*2+NumberChannels16Bit*6+totalData16+totalData8+i*6+3 << " [1/10000 degree]");
+////            19+NumberEncoders*2+i*6+totalData16+5 //Angular step width
+//
+//			LOG_INFO("(Parsing 8bit channel #"<<i<<") Angular step width "<< 21+NumberEncoders*2+NumberChannels16Bit*6+totalData16+totalData8+i*6+4<<" [1/10000 degree]");
+///*
 //            21+NumberEncoders*2+NumberChannels16Bit*6+totalData16+i*6+1 //ScalingFactor
 //            21+NumberEncoders*2+NumberChannels16Bit*6+totalData16+i*6+2 //ScalingOffset
@@ -527,38 +541,38 @@
 //            21+NumberEncoders*2+NumberChannels16Bit*6+totalData16+i*6+4 //Angular step width
 //            21+NumberEncoders*2+NumberChannels16Bit*6+totalData16+i*6+5 //NumberData
-
+//*/
 //            int NumberData = xstol(msg->splitMessage->at(21+NumberEncoders*2+NumberChannels16Bit*6+totalData16+totalData8+i*6+5));
-//            LOG_TRACE("(Parsing 16bit channel) Number Data for "<<content<<" : "<<NumberData);
-
-//            sscanf(tok, "%X", &NumberData);
-
-//            LOG_TRACE("(Processing) Number data : "<< NumberData);
-
+//            LOG_TRACE("(Parsing 8bit channel) Number Data for "<<content<<" : "<<NumberData);
+//
+//            //sscanf(tok, "%X", &NumberData);
+//
+//            LOG_TRACE("(Processing) Number data : "<< NumberData);	//19+NumberEncoders*2+i*6+totalData16+6
+//			LOG_INFO("(Parsing 8bit channel #"<<i<<") Number data "<< NumberData);
 //            if (type == 0) {
-//                msg->data.dist_len1 = NumberData;
+//                msg->data.rssi_len1 = NumberData;
 //            } else if (type == 1) {
-//                msg->data.dist_len2 = NumberData;
-//            } else if (type == 2) {
-//                msg->data.rssi_len1 = NumberData;
-//            } else if (type == 3) {
 //                msg->data.rssi_len2 = NumberData;
+//            } 
+//			
+//            uint8_t* remissionPoints = (uint8_t*) malloc(NumberData * sizeof(uint8_t));
+//            for (int j = 0; j < NumberData; j++) {
+//                remissionPoints[j] = xstol(msg->splitMessage->at(21 + NumberEncoders*2 + NumberChannels16Bit*6 + totalData16 + totalData8 + i*6 + 6 + j));	//19+NumberEncoders*2+i*6+totalData16+7+j
+//            }			
+//            //for (int i = 0; i < NumberData; i++) {
+//                //int dat;
+//                //tok = strtok(NULL, " "); //data
+//                //sscanf(tok, "%X", &dat);
+//
+//            if (type == 0) {
+//                msg->data.rssi1_8 = remissionPoints;
+//				msg->data.rssi_len1_8 = NumberData;
+//            } else if (type == 1) {
+//                msg->data.rssi2_8 = remissionPoints;
+//				msg->data.rssi_len2_8 = NumberData;
 //            }
-//            for (int i = 0; i < NumberData; i++) {
-//                int dat;
-//                tok = strtok(NULL, " "); //data
-//                sscanf(tok, "%X", &dat);
-
-//                if (type == 0) {
-//                    msg->data.dist1[i] = dat;
-//                } else if (type == 1) {
-//                    msg->data.dist2[i] = dat;
-//                } else if (type == 2) {
-//                    msg->data.rssi1[i] = dat;
-//                } else if (type == 3) {
-//                    msg->data.rssi2[i] = dat;
-//                }
-//            }
-        } // 8bit channel
-*/
+//            //}
+//			totalData8 += NumberData;
+//        } // 8bit channel
+//
 
 		return 0;
@@ -588,4 +602,7 @@
     entry.rssi_len2 = entry.dataPos_rssi2 = 0;
 
+    //entry.rssi_len1_8 = entry.dataPos_rssi1_8 = 0;
+    //entry.rssi_len2_8 = entry.dataPos_rssi2_8 = 0;
+
     if(msg.data.dist_len1){
         entry.dist_len1 = msg.data.dist_len1;
@@ -658,4 +675,24 @@
         free(msg.data.rssi2);
     }
+	//if(msg.data.rssi_len1_8){
+ //       entry.rssi_len1_8 = msg.data.rssi_len1_8;
+ //       entry.dataPos_rssi1_8 = dataFile_.tellp();
+
+ //       for (unsigned int i = 0 ; i < msg.data.rssi_len1_8; ++i) {
+ //           dataFile_.write(reinterpret_cast<char*>(&(msg.data.rssi1_8[i])), sizeof(uint8_t));
+ //       }
+
+ //       free(msg.data.rssi1_8);
+ //   }
+ //   if(msg.data.rssi_len2_8){
+ //       entry.rssi_len2_8 = msg.data.rssi_len2_8;
+ //       entry.dataPos_rssi2_8 = dataFile_.tellp();
+
+ //       for (unsigned int i = 0 ; i < msg.data.rssi_len2_8; ++i) {
+ //           dataFile_.write(reinterpret_cast<char*>(&(msg.data.rssi2_8[i])), sizeof(uint8_t));
+ //       }
+
+ //       free(msg.data.rssi2_8);
+ //   }
     // add a magic word to delimit the block of data
     int32_t utcMagicWord = UTC_MAGIC_WORD;
