Index: trunk/Gps/gpsComponent.cpp
===================================================================
--- trunk/Gps/gpsComponent.cpp	(revision 77)
+++ trunk/Gps/gpsComponent.cpp	(revision 99)
@@ -18,8 +18,10 @@
 #include <iostream>
 
+#define PACPUS_PI 3.1415926
+
 namespace pacpus {
 
 /// Construct the factory
-ComponentFactory<GpsComponent> sFactory("GpsComponent"); 
+ComponentFactory<GpsComponent> sFactory("GpsComponent");
 
 DECLARE_STATIC_LOGGER("pacpus.base.GpsComponent");
@@ -35,35 +37,35 @@
     : semaphore_(0)
     , ComponentBase(name)
-    
-{    
-  
-  ppsRecording = TRUE;
-  ggaRecording = TRUE; 
-  gsaRecording = TRUE; 
-  gstRecording = TRUE; 
-  gsvRecording = TRUE;
-  hdtRecording = TRUE; 
-  rmcRecording = TRUE; 
-  rotRecording = TRUE; 
-  vtgRecording = TRUE; 
-  zdaRecording = TRUE; 
-
-/*  ppshdFile = NULL; 
-  ggahdFile = NULL; 
-  gsahdFile = NULL; 
-  gsthdFile = NULL; 
-  gsvhdFile = NULL; 
-  hdthdFile = NULL; 
-  rmchdFile = NULL; 
-  rothdFile = NULL; 
-  vtghdFile = NULL; 
-  zdahdFile = NULL; 
+
+{
+
+  ppsRecording = true;//TRUE
+  ggaRecording = true;
+  gsaRecording = true;
+  gstRecording = true;
+  gsvRecording = true;
+  hdtRecording = true;
+  rmcRecording = true;
+  rotRecording = true;
+  vtgRecording = true;
+  zdaRecording = true;
+
+/*  ppshdFile = NULL;
+  ggahdFile = NULL;
+  gsahdFile = NULL;
+  gsthdFile = NULL;
+  gsvhdFile = NULL;
+  hdthdFile = NULL;
+  rmchdFile = NULL;
+  rothdFile = NULL;
+  vtghdFile = NULL;
+  zdahdFile = NULL;
 */
- 
-  
+
+
   nextByteToProcess_ = 0;
   currentFrame_ = NULL;
-  newFrameToDecode_ = false; 
-  startOfFrame_ = false; 
+  newFrameToDecode_ = false;
+  startOfFrame_ = false;
   endOfFrame_ = false;
 }
@@ -81,5 +83,5 @@
 ComponentBase::COMPONENT_CONFIGURATION GpsComponent::configureComponent(XmlComponentConfig config)
 {
-  setPortCOM( config.getProperty("port").toLatin1() );   
+  setPortCOM( config.getProperty("port").toLatin1() );
   setRecording ((config.getProperty("recording") == "true" ? true : false));
 
@@ -90,5 +92,5 @@
 void GpsComponent::setPortCOM(const char * port)
 {
-  portName_ = port; 
+  portName_ = port;
 }
 
@@ -111,25 +113,25 @@
 void GpsComponent::run()
 {
-  int type = -1; 
-  
+  int type = -1;
+
   // parity:0-4=no,odd,even,mark,space
   // byteSize:number of bits/byte, 4-8
-  // baudRate:port speed (ex:38400) 
-  // stopBits:0,1,2 = 1, 1.5, 2 
-  
-  serialPort->configurePort(xmlParameters().getProperty("baudrate").toLong(), 
+  // baudRate:port speed (ex:38400)
+  // stopBits:0,1,2 = 1, 1.5, 2
+
+  serialPort->configurePort(xmlParameters().getProperty("baudrate").toLong(),
     xmlParameters().getProperty("bytesize").toUInt(),
     //  config.getProperty("parity").at(0).toLatin1(),
     xmlParameters().getProperty("parity").toShort(),
-    xmlParameters().getProperty("stopbits").toUInt() - 1); 
-
-
-  serialPort->start(); 
- 
+    xmlParameters().getProperty("stopbits").toUInt() - 1);
+
+
+  serialPort->start();
+
   while (isActive())
-  { 
+  {
     // If there are no bytes remaining in the current frame, delete it
     if ((currentFrame_ != NULL) && (nextByteToProcess_ >= currentFrame_->data.length())) {
-      delete currentFrame_; 
+      delete currentFrame_;
       currentFrame_ = NULL;
     }
@@ -139,5 +141,5 @@
       semaphore_.acquire();
       if  ((currentFrame_ = serialPort->getNextFrame()) == NULL) {
-        // Should never get to this point as the semaphore counts the frames, unless 
+        // Should never get to this point as the semaphore counts the frames, unless
         // the thread is being stopped.
         continue;
@@ -151,10 +153,10 @@
       lastPpsTime_ = currentFrame_->t;
       decodeFrame(SIGNAL_PPS);
-    } else if (analyzeFrame()) { 
+    } else if (analyzeFrame()) {
       // a new complete NMEA frame has arrived, decode it.
-      type = frameType(frameToDecode_.data); 
+      type = frameType(frameToDecode_.data);
       if (type != -1) {
         if (decodeFrame(type) == -1) {
-            qWarning("Failed to decode the dataframe\n"); 
+            qWarning("Failed to decode the dataframe\n");
         }
       }
@@ -164,5 +166,5 @@
   }
 
-  qDebug() << "The thread of " << name() << " GPS component is stopped"; 
+  qDebug() << "The thread of " << name() << " GPS component is stopped";
 }
 
@@ -174,26 +176,26 @@
 void GpsComponent::stopActivity()
 {
-  setActive( FALSE ); 
+  setActive( false );
   unlockProcessing(1); // to unblock the thread that is waiting new data
-  
-  serialPort->THREAD_ALIVE = FALSE; 
+
+  serialPort->THREAD_ALIVE = false;
 
   if (!serialPort->wait(2000))
   {
-    serialPort->terminate(); 
+    serialPort->terminate();
     qDebug("The Win32SerialPort thread blocks anormally, it has been killed !!");
   }
-  if ( !serialPort->closePort() ) 
-    qDebug("Failed to close the port"); 
+  if ( !serialPort->closePort() )
+    qDebug("Failed to close the port");
   else
-    qDebug("The port is closed"); 
+    qDebug("The port is closed");
   delete serialPort;
 
   if (ppshdFile.isOpen())
-	  ppshdFile.close(); 
+	  ppshdFile.close();
   if (ggahdFile.isOpen())
 	  ggahdFile.close();
   if (gsahdFile.isOpen())
-    gsahdFile.close(); 
+    gsahdFile.close();
   if (gsthdFile.isOpen())
     gsthdFile.close();
@@ -203,9 +205,9 @@
     hdthdFile.close();
   if (rmchdFile.isOpen())
-	  rmchdFile.close(); 
+	  rmchdFile.close();
   if (rothdFile.isOpen())
 	  rothdFile.close();
   if (vtghdFile.isOpen())
-	  vtghdFile.close(); 
+	  vtghdFile.close();
   if (zdahdFile.isOpen())
 	  zdahdFile.close();
@@ -219,28 +221,28 @@
 {
   ppsIndex_ = 0;
-  
-  setActive( TRUE );   
-  
+
+  setActive( true );
+
 #if WIN32
-  serialPort = new Win32SerialPort(portName_.toLatin1());  
+  serialPort = new Win32SerialPort(portName_.toLatin1());
   // Asynchrone
-  serialPort->setMode(FILE_FLAG_OVERLAPPED); 
+  serialPort->setMode(FILE_FLAG_OVERLAPPED);
   // Synchrone
-  //serialPort->setMode(0); 
-#else 
-  serialPort = new PosixSerialPort(portName.toLatin1());  
+  //serialPort->setMode(0);
+#else
+  serialPort = new PosixSerialPort(portName_.toLatin1());
 #endif
-  
+
   if (!serialPort->openPort(portName_.toLatin1()))
   {
     qDebug() << "Failed to open the port " << portName_;
     qDebug() << "The GPS Component " << name() << " didn't start";
-    return; 
+    return;
   }
-  
-  serialPort->THREAD_ALIVE = TRUE; 
+
+  serialPort->THREAD_ALIVE = true;
   if (!QApplication::connect(serialPort,SIGNAL(newDataAvailable(int)),this, SLOT(unlockProcessing(int))))
-    qWarning("Failed to connect SIGNAL(newDataAvailable(int)) with SLOT(unlockProcessing(int)\n" );   
-  start(); 
+    qWarning("Failed to connect SIGNAL(newDataAvailable(int)) with SLOT(unlockProcessing(int)\n" );
+  start();
   qDebug() << "The Component " << name() << " is started";
 }
@@ -299,5 +301,5 @@
 
     // first looking for start-of-frame
-    if (!startOfFrame_ && (currentChar == '$')) { 
+    if (!startOfFrame_ && (currentChar == '$')) {
       startOfFrame_ = true;
       endOfFrame_ = false;
@@ -313,7 +315,7 @@
       return true;  // There is a new frame to decode
     }
-    
+
     if ((startOfFrame_) && (!endOfFrame_)) {
-      frameToDecode_.data.append(currentChar); 
+      frameToDecode_.data.append(currentChar);
     }
   }
@@ -325,5 +327,5 @@
 {
   // new frame available
-  semaphore_.release( v ); 
+  semaphore_.release( v );
 }
 
@@ -331,17 +333,17 @@
 int GpsComponent::decodeFrame(int type)
 {
-  double lat_rad = 0, lon_rad = 0; 
-  int indexGSV = 0; 
+  double lat_rad = 0, lon_rad = 0;
+  int indexGSV = 0;
   int indexGSA = 0;
-  
-  
-  SENTENCE sentence; 
-  sentence.Sentence = frameToDecode_.data; 
-  
-  switch(type) 
+
+
+  SENTENCE sentence;
+  sentence.Sentence = frameToDecode_.data;
+
+  switch(type)
   {
-  case UNKNOWN_NMEA_FRAME: 
-    qDebug("Unknown frame received !"); 
-    break; 
+  case UNKNOWN_NMEA_FRAME:
+    qDebug("Unknown frame received !");
+    break;
   case SIGNAL_PPS:
     ppsFrame.setRoadTime(lastPpsTime_);
@@ -351,13 +353,13 @@
     {
 		if (!(ppshdFile.isOpen()))
-        ppshdFile.open((char *)(name() + "_pps.dbt").toLatin1().data(),WriteMode,TYPE_INT,sizeof(int)); 
+        ppshdFile.open((char *)(name() + "_pps.dbt").toLatin1().data(),WriteMode,TYPE_INT,sizeof(int));
     if ( ppshdFile.writeRecord(frameToDecode_.t,frameToDecode_.tr,(char *) ppsFrame.getFrameData(),sizeof(int)) == 0)
-        qWarning("Failed to record PPS data ...\n");   
+        qWarning("Failed to record PPS data ...\n");
     }
     ppsFrame.notifyObservers();
 
     break;
-    
-  case TRAME_GGA_DBL:    
+
+  case TRAME_GGA_DBL:
     if (!nmea0183_.Gga.Parse(sentence)) {
       LOG_ERROR("Failed to parse the frame " << nmea0183_.Gga.ErrorMessage.toLatin1().data());
@@ -377,22 +379,22 @@
       ggaFrame.getFrameData()->d_geoidal = nmea0183_.Gga.GeoidalSeparationMeters;
       ggaFrame.getFrameData()->age = nmea0183_.Gga.AgeOfDifferentialGPSDataSeconds;
-      ggaFrame.getFrameData()->dir_lat = ( (nmea0183_.Gga.Position.Latitude.Northing == North) ? 'N' : 'S' ); 
-      ggaFrame.getFrameData()->dir_lon = ( (nmea0183_.Gga.Position.Longitude.Easting == East) ? 'E' : 'W' ); 
-      ggaFrame.getFrameData()->ref_station_ID = nmea0183_.Gga.DifferentialReferenceStationID; 
+      ggaFrame.getFrameData()->dir_lat = ( (nmea0183_.Gga.Position.Latitude.Northing == North) ? 'N' : 'S' );
+      ggaFrame.getFrameData()->dir_lon = ( (nmea0183_.Gga.Position.Longitude.Easting == East) ? 'E' : 'W' );
+      ggaFrame.getFrameData()->ref_station_ID = nmea0183_.Gga.DifferentialReferenceStationID;
       ggaFrame.setRoadTime(frameToDecode_.t);
-      
-      sendDataToServerSocket(*ggaFrame.getFrameData(),type); 
+
+      sendDataToServerSocket(*ggaFrame.getFrameData(),type);
       ggaFrame.notifyObservers();
 
       if ( (isRecording()) && (ggaRecording) ) {
 		    if (!(ggahdFile.isOpen()))
-	        ggahdFile.open((char *)(name() + "_gga.dbt").toLatin1().data(),WriteMode,TRAME_GGA_DBL,sizeof(trame_gga_dbl)); 
-		    if ( !ggahdFile.writeRecord(frameToDecode_.t,frameToDecode_.tr,(char *) ggaFrame.getFrameData(),sizeof(trame_gga_dbl))) 
-          qWarning("Failed to record GGA data ...\n"); 
+	        ggahdFile.open((char *)(name() + "_gga.dbt").toLatin1().data(),WriteMode,TRAME_GGA_DBL,sizeof(trame_gga_dbl));
+		    if ( !ggahdFile.writeRecord(frameToDecode_.t,frameToDecode_.tr,(char *) ggaFrame.getFrameData(),sizeof(trame_gga_dbl)))
+          qWarning("Failed to record GGA data ...\n");
       }
       //printf("lon=%f lat=%f\n",ggaFrame.getFrameData()->lon, ggaFrame.getFrameData()->lat);
     }
     break;
-    
+
   case TRAME_GSA:
     if (!nmea0183_.Gsa.Parse(sentence))
@@ -401,31 +403,31 @@
     gsaFrame.getFrameData()->mode_result = 0;
     if (nmea0183_.Gsa.FixMode == GSA::FixUnavailable)
-      gsaFrame.getFrameData()->mode_result = 1; 
+      gsaFrame.getFrameData()->mode_result = 1;
     if (nmea0183_.Gsa.FixMode == GSA::TwoDimensional)
-      gsaFrame.getFrameData()->mode_result = 2; 
+      gsaFrame.getFrameData()->mode_result = 2;
     if (nmea0183_.Gsa.FixMode == GSA::ThreeDimensional)
-      gsaFrame.getFrameData()->mode_result = 3; 
+      gsaFrame.getFrameData()->mode_result = 3;
     for (indexGSA = 0 ; indexGSA<12 ; indexGSA++)
-      gsaFrame.getFrameData()->SV_PRN[indexGSA] = nmea0183_.Gsa.SatelliteNumber[indexGSA]; 
-    gsaFrame.getFrameData()->pdop = nmea0183_.Gsa.PDOP; 
-    gsaFrame.getFrameData()->hdop = nmea0183_.Gsa.HDOP; 
-    gsaFrame.getFrameData()->vdop = nmea0183_.Gsa.VDOP; 
+      gsaFrame.getFrameData()->SV_PRN[indexGSA] = nmea0183_.Gsa.SatelliteNumber[indexGSA];
+    gsaFrame.getFrameData()->pdop = nmea0183_.Gsa.PDOP;
+    gsaFrame.getFrameData()->hdop = nmea0183_.Gsa.HDOP;
+    gsaFrame.getFrameData()->vdop = nmea0183_.Gsa.VDOP;
     gsaFrame.setRoadTime(frameToDecode_.t);
 
     gsaFrame.notifyObservers();
-    
-    sendDataToServerSocket(*gsaFrame.getFrameData(),type); 
-    
+
+    sendDataToServerSocket(*gsaFrame.getFrameData(),type);
+
     if ( (isRecording()) && (gsaRecording) )
     {
 		if (!(gsahdFile.isOpen()))
 		  gsahdFile.open((char *)(name() + "_gsa.dbt").toLatin1().data(),WriteMode, TRAME_GSA,sizeof(trame_gsa));
-		if ( gsahdFile.writeRecord(frameToDecode_.t, frameToDecode_.tr,(char *) gsaFrame.getFrameData(),sizeof(trame_gsa)) != 1) 
-        qWarning("Failed to record GSA data ...\n"); 
+		if ( gsahdFile.writeRecord(frameToDecode_.t, frameToDecode_.tr,(char *) gsaFrame.getFrameData(),sizeof(trame_gsa)) != 1)
+        qWarning("Failed to record GSA data ...\n");
     }
     break;
 
 
-    
+
   case TRAME_GST:
     if (!nmea0183_.Gst.Parse( sentence ))
@@ -443,17 +445,17 @@
     gstFrame.getFrameData()->Ms = nmea0183_.Gst.Time.time().msec();
     gstFrame.setRoadTime(frameToDecode_.t);
-    
-    sendDataToServerSocket(*gstFrame.getFrameData(),type); 
+
+    sendDataToServerSocket(*gstFrame.getFrameData(),type);
     gstFrame.notifyObservers();
 
 
     if ( (isRecording()) && (gstRecording) ) {
-		  if (!gsthdFile.isOpen())      
-			  gsthdFile.open((char *)(name() + "_gst.dbt").toLatin1().data(),WriteMode,TRAME_GST,sizeof(trame_gst)); 
+		  if (!gsthdFile.isOpen())
+			  gsthdFile.open((char *)(name() + "_gst.dbt").toLatin1().data(),WriteMode,TRAME_GST,sizeof(trame_gst));
       if ( !gsthdFile.writeRecord(frameToDecode_.t, frameToDecode_.tr,(char *) gstFrame.getFrameData(),sizeof(trame_gst)) )
-        qWarning("Failed to record GST data ...\n"); 
-    }
-    break; 
-    
+        qWarning("Failed to record GST data ...\n");
+    }
+    break;
+
   case TRAME_GSV:
     indexGSV = 0;
@@ -462,5 +464,5 @@
       break;
     }
-    // it's a new frame, reset stored value in case of the number of satellites 
+    // it's a new frame, reset stored value in case of the number of satellites
     // in view has decreased
     if (nmea0183_.Gsv.message_number == 1)
@@ -477,5 +479,5 @@
     gsvFrame.getFrameData()->NumberOfSatellites = nmea0183_.Gsv.NumberOfSatellites;
     gsvFrame.getFrameData()->Totalmessages = nmea0183_.Gsv.Totalmessages;
-    
+
     for  ( indexGSV=4*(nmea0183_.Gsv.message_number-1); indexGSV<=(4*nmea0183_.Gsv.message_number)-1; indexGSV++ )
     {
@@ -487,5 +489,5 @@
 
     if (nmea0183_.Gsv.Totalmessages == nmea0183_.Gsv.message_number) {
-      sendDataToServerSocket(*gsvFrame.getFrameData(),type); 
+      sendDataToServerSocket(*gsvFrame.getFrameData(),type);
       gsvFrame.setRoadTime(frameToDecode_.t);
       gsvFrame.notifyObservers();
@@ -493,11 +495,11 @@
     if ( (isRecording()) && (gsvRecording) && (nmea0183_.Gsv.Totalmessages == nmea0183_.Gsv.message_number) )
     {
-		if (!gsvhdFile.isOpen())      
-        gsvhdFile.open((char *)(name() + "_gsv.dbt").toLatin1().data(),WriteMode,TRAME_GSV,sizeof(trame_gsv)); 
+		if (!gsvhdFile.isOpen())
+        gsvhdFile.open((char *)(name() + "_gsv.dbt").toLatin1().data(),WriteMode,TRAME_GSV,sizeof(trame_gsv));
 		if ( gsvhdFile.writeRecord(frameToDecode_.t, frameToDecode_.tr,(char *) gsvFrame.getFrameData(),sizeof(trame_gsv)) == 0)
-        qWarning("Failed to record GSV data ...\n"); 
-    }
-    break; 
-    
+        qWarning("Failed to record GSV data ...\n");
+    }
+    break;
+
     case TRAME_HDT:
       if (!nmea0183_.Hdt.Parse( sentence ))
@@ -505,17 +507,17 @@
       hdtFrame.getFrameData()->DegreesTrue = nmea0183_.Hdt.DegreesTrue;
       hdtFrame.setRoadTime(frameToDecode_.t);
-      
-      sendDataToServerSocket(hdtFrame,type); 
+
+      sendDataToServerSocket(hdtFrame,type);
       hdtFrame.notifyObservers();
-      
+
       if ( (isRecording()) && (hdtRecording) )
       {
 		  if (!hdthdFile.isOpen())
-			  hdthdFile.open((char *)(name() + "_hdt.dbt").toLatin1().data(),WriteMode,TRAME_HDT,sizeof(trame_hdt)); 
+			  hdthdFile.open((char *)(name() + "_hdt.dbt").toLatin1().data(),WriteMode,TRAME_HDT,sizeof(trame_hdt));
       if ( hdthdFile.writeRecord(frameToDecode_.t, frameToDecode_.tr,(char *) hdtFrame.getFrameData(),sizeof(trame_hdt)) == 0)
-          qWarning("Failed to record HDT data ...\n"); 
-      }
-      break; 
-      
+          qWarning("Failed to record HDT data ...\n");
+      }
+      break;
+
     case TRAME_RMC:
       if (!nmea0183_.Rmc.Parse( sentence ))
@@ -545,17 +547,17 @@
       rmcFrame.getFrameData()->vitesse = nmea0183_.Rmc.SpeedOverGroundKnots * 1852.0 / 3600.0; // 1 knot = 1852 m/h
       rmcFrame.setRoadTime(frameToDecode_.t);
-      
-      sendDataToServerSocket(*rmcFrame.getFrameData(),type); 
+
+      sendDataToServerSocket(*rmcFrame.getFrameData(),type);
       rmcFrame.notifyObservers();
-      
+
       if ( (isRecording()) && (rmcRecording) )
       {
         if (!rmchdFile.isOpen())
-          rmchdFile.open((char *)(name() + "_rmc.dbt").toLatin1().data(),WriteMode,TRAME_RMC,sizeof(trame_rmc)); 
+          rmchdFile.open((char *)(name() + "_rmc.dbt").toLatin1().data(),WriteMode,TRAME_RMC,sizeof(trame_rmc));
         if (rmchdFile.writeRecord(frameToDecode_.t ,frameToDecode_.tr,(char *) rmcFrame.getFrameData(),sizeof(trame_rmc)) == 0)
-          qWarning("Failed to record RMC data ...\n"); 
+          qWarning("Failed to record RMC data ...\n");
       }
       break;
-      
+
     case TRAME_ROT:
       if (!nmea0183_.Rot.Parse( sentence ))
@@ -564,17 +566,17 @@
       rotFrame.getFrameData()->valid_data = ( (nmea0183_.Rot.IsDataValid == True) ? 1 : 0 );
       rotFrame.setRoadTime(frameToDecode_.t);
-      
-      sendDataToServerSocket(*rotFrame.getFrameData(),type); 
+
+      sendDataToServerSocket(*rotFrame.getFrameData(),type);
       rotFrame.notifyObservers();
-      
+
       if ( (isRecording()) && (rotRecording) )
       {
         if (!rothdFile.isOpen())
-          rothdFile.open((char *)(name() + "_rot.dbt").toLatin1().data(),WriteMode,TRAME_ROT,sizeof(trame_rot)); 
+          rothdFile.open((char *)(name() + "_rot.dbt").toLatin1().data(),WriteMode,TRAME_ROT,sizeof(trame_rot));
         if ( rothdFile.writeRecord(frameToDecode_.t ,frameToDecode_.tr,(char *) rotFrame.getFrameData(),sizeof(trame_rot)) == 0)
-          qWarning("Failed to record ROT data ...\n"); 
-      }
-      break; 
-      
+          qWarning("Failed to record ROT data ...\n");
+      }
+      break;
+
     case TRAME_VTG:
       if (!nmea0183_.Vtg.Parse( sentence )) {
@@ -582,20 +584,20 @@
       } else {
         vtgFrame.getFrameData()->v = nmea0183_.Vtg.SpeedKilometersPerHour;
-        vtgFrame.getFrameData()->track_true_north = nmea0183_.Vtg.TrackDegreesTrue; 
-        vtgFrame.getFrameData()->track_magnet_north = nmea0183_.Vtg.TrackDegreesMagnetic; 
+        vtgFrame.getFrameData()->track_true_north = nmea0183_.Vtg.TrackDegreesTrue;
+        vtgFrame.getFrameData()->track_magnet_north = nmea0183_.Vtg.TrackDegreesMagnetic;
         vtgFrame.setRoadTime(frameToDecode_.t);
-      
+
         sendDataToServerSocket(vtgFrame,type);
         vtgFrame.notifyObservers();
-      
+
         if (isRecording() && vtgRecording) {
-          if (!vtghdFile.isOpen()) 
-            vtghdFile.open((char *)(name() + "_vtg.dbt").toLatin1().data(),WriteMode,TRAME_VTG,sizeof(trame_vtg)); 
+          if (!vtghdFile.isOpen())
+            vtghdFile.open((char *)(name() + "_vtg.dbt").toLatin1().data(),WriteMode,TRAME_VTG,sizeof(trame_vtg));
 		      if ( vtghdFile.writeRecord(frameToDecode_.t, frameToDecode_.tr,(char *) vtgFrame.getFrameData(),sizeof(trame_vtg)) == 0)
-            qWarning("Failed to record VTG data ...\n"); 
+            qWarning("Failed to record VTG data ...\n");
         }
       }
-      break; 
-      
+      break;
+
     case TRAME_ZDA:
       if (!nmea0183_.Zda.Parse( sentence )) {
@@ -609,14 +611,14 @@
       zdaFrame.getFrameData()->MM = nmea0183_.Zda.Time.date().month();
       zdaFrame.getFrameData()->JJ = nmea0183_.Zda.Time.date().day();
-      zdaFrame.getFrameData()->H_offset = nmea0183_.Zda.LocalHourDeviation; 
-      zdaFrame.getFrameData()->Mi_offset = nmea0183_.Zda.LocalMinutesDeviation; 
-      
+      zdaFrame.getFrameData()->H_offset = nmea0183_.Zda.LocalHourDeviation;
+      zdaFrame.getFrameData()->Mi_offset = nmea0183_.Zda.LocalMinutesDeviation;
+
       sendDataToServerSocket(*zdaFrame.getFrameData(), type);
       zdaFrame.setRoadTime(frameToDecode_.t);
       zdaFrame.notifyObservers();
-      
+
       if ( (isRecording()) && (zdaRecording) ) {
-		  if (!zdahdFile.isOpen()) 
-          zdahdFile.open((char *)(name() + "_zda.dbt").toLatin1().data(),WriteMode,TRAME_ZDA,sizeof(trame_zda)); 
+		  if (!zdahdFile.isOpen())
+          zdahdFile.open((char *)(name() + "_zda.dbt").toLatin1().data(),WriteMode,TRAME_ZDA,sizeof(trame_zda));
       if ( zdahdFile.writeRecord(frameToDecode_.t, frameToDecode_.tr,(char *) zdaFrame.getFrameData(),sizeof(trame_zda)) == 0) {
             LOG_WARN("Failed to record ZDA data ...");
@@ -641,12 +643,12 @@
       }
       */
-      
-      break; 
-      
+
+      break;
+
     default:
-      return 0; 
+      return 0;
   }
-  
-  return 1; 
+
+  return 1;
 }
 
