Index: trunk/lib/FlairCore/src/AhrsData.cpp
===================================================================
--- trunk/lib/FlairCore/src/AhrsData.cpp	(revision 14)
+++ trunk/lib/FlairCore/src/AhrsData.cpp	(revision 15)
@@ -24,107 +24,106 @@
 using std::string;
 
-namespace flair { namespace core {
+namespace flair {
+namespace core {
 
 /*! \class AhrsDataElement
     */
-    class AhrsDataElement: public IODataElement {
-        public:
-
-            AhrsDataElement(const AhrsData *inAhrsData,string name,AhrsData::PlotableData_t inPlotableData):
-                            IODataElement(inAhrsData,name),
-                            ahrsData(inAhrsData),
-                            plotableData(inPlotableData) {
-
-                size=sizeof(float);
-            }
-
-            ~AhrsDataElement() {}
-
-            void CopyData(char* destination) const {
-                float data;
-                Vector3D angularRates;
-                Euler eulerAngles;
-                Quaternion quaternion;
-                ahrsData->GetQuaternionAndAngularRates(quaternion,angularRates);
-                quaternion.ToEuler(eulerAngles);
-                switch(plotableData) {
-                case AhrsData::Roll:
-                    data=eulerAngles.roll;
-                    break;
-                case AhrsData::Pitch:
-                    data=eulerAngles.pitch;
-                    break;
-                case AhrsData::Yaw:
-                    data=eulerAngles.yaw;
-                    break;
-                case AhrsData::RollDeg:
-                    data=Euler::ToDegree(eulerAngles.roll);
-                    break;
-                case AhrsData::PitchDeg:
-                    data=Euler::ToDegree(eulerAngles.pitch);
-                    break;
-                case AhrsData::YawDeg:
-                    data=Euler::ToDegree(eulerAngles.yaw);
-                    break;
-                case AhrsData::Q0:
-                    data=quaternion.q0;
-                    break;
-                case AhrsData::Q1:
-                    data=quaternion.q1;
-                    break;
-                case AhrsData::Q2:
-                    data=quaternion.q2;
-                    break;
-                case AhrsData::Q3:
-                    data=quaternion.q3;
-                    break;
-                case AhrsData::Wx:
-                    data=angularRates.x;
-                    break;
-                case AhrsData::Wy:
-                    data=angularRates.y;
-                    break;
-                case AhrsData::Wz:
-                    data=angularRates.z;
-                    break;
-                case AhrsData::WxDeg:
-                    data=Euler::ToDegree(angularRates.x);
-                    break;
-                case AhrsData::WyDeg:
-                    data=Euler::ToDegree(angularRates.y);
-                    break;
-                case AhrsData::WzDeg:
-                    data=Euler::ToDegree(angularRates.z);
-                    break;
-                default:
-                    ahrsData->Err("data type unavailable.\n");
-                    data=0;
-                    break;
-                }
-                memcpy(destination,&data,sizeof(float));
-            }
-
-            const FloatType &GetDataType(void) const {
-                return dataType;
-            }
-
-        private:
-            const AhrsData *ahrsData;
-            AhrsData::PlotableData_t plotableData;
-            FloatType dataType;
-
-    };
-
-AhrsData::AhrsData(const Object *parent,std::string name,int n): io_data(parent,name,n), dataType(floatType) {
-    if(n>1) Warn("n>1 not supported\n");
-
-    AppendLogDescription("q0",floatType);
-    AppendLogDescription("q1",floatType);
-    AppendLogDescription("q2",floatType);
-    AppendLogDescription("q3",floatType);
-
-    AppendLogDescription("wx",floatType);
-    AppendLogDescription("wy",floatType);
-    AppendLogDescription("wz",floatType);
+class AhrsDataElement : public IODataElement {
+public:
+  AhrsDataElement(const AhrsData *inAhrsData, string name,
+                  AhrsData::PlotableData_t inPlotableData)
+      : IODataElement(inAhrsData, name), ahrsData(inAhrsData),
+        plotableData(inPlotableData) {
+
+    size = sizeof(float);
+  }
+
+  ~AhrsDataElement() {}
+
+  void CopyData(char *destination) const {
+    float data;
+    Vector3D angularRates;
+    Euler eulerAngles;
+    Quaternion quaternion;
+    ahrsData->GetQuaternionAndAngularRates(quaternion, angularRates);
+    quaternion.ToEuler(eulerAngles);
+    switch (plotableData) {
+    case AhrsData::Roll:
+      data = eulerAngles.roll;
+      break;
+    case AhrsData::Pitch:
+      data = eulerAngles.pitch;
+      break;
+    case AhrsData::Yaw:
+      data = eulerAngles.yaw;
+      break;
+    case AhrsData::RollDeg:
+      data = Euler::ToDegree(eulerAngles.roll);
+      break;
+    case AhrsData::PitchDeg:
+      data = Euler::ToDegree(eulerAngles.pitch);
+      break;
+    case AhrsData::YawDeg:
+      data = Euler::ToDegree(eulerAngles.yaw);
+      break;
+    case AhrsData::Q0:
+      data = quaternion.q0;
+      break;
+    case AhrsData::Q1:
+      data = quaternion.q1;
+      break;
+    case AhrsData::Q2:
+      data = quaternion.q2;
+      break;
+    case AhrsData::Q3:
+      data = quaternion.q3;
+      break;
+    case AhrsData::Wx:
+      data = angularRates.x;
+      break;
+    case AhrsData::Wy:
+      data = angularRates.y;
+      break;
+    case AhrsData::Wz:
+      data = angularRates.z;
+      break;
+    case AhrsData::WxDeg:
+      data = Euler::ToDegree(angularRates.x);
+      break;
+    case AhrsData::WyDeg:
+      data = Euler::ToDegree(angularRates.y);
+      break;
+    case AhrsData::WzDeg:
+      data = Euler::ToDegree(angularRates.z);
+      break;
+    default:
+      ahrsData->Err("data type unavailable.\n");
+      data = 0;
+      break;
+    }
+    memcpy(destination, &data, sizeof(float));
+  }
+
+  const FloatType &GetDataType(void) const { return dataType; }
+
+private:
+  const AhrsData *ahrsData;
+  AhrsData::PlotableData_t plotableData;
+  FloatType dataType;
+};
+
+AhrsData::AhrsData(const Object *parent, std::string name, int n)
+    : io_data(parent, name, n), dataType(floatType) {
+  if (n > 1)
+    Warn("n>1 not supported\n");
+
+  AppendLogDescription("q0", floatType);
+  AppendLogDescription("q1", floatType);
+  AppendLogDescription("q2", floatType);
+  AppendLogDescription("q3", floatType);
+
+  AppendLogDescription("wx", floatType);
+  AppendLogDescription("wy", floatType);
+  AppendLogDescription("wz", floatType);
 }
 
@@ -132,119 +131,121 @@
 
 Quaternion AhrsData::GetQuaternion(void) const {
-    Quaternion out;
-    GetMutex();
-    out=quaternion;
-    ReleaseMutex();
-    return out;
+  Quaternion out;
+  GetMutex();
+  out = quaternion;
+  ReleaseMutex();
+  return out;
 }
 
 Vector3D AhrsData::GetAngularRates(void) const {
-    Vector3D out;
-    GetMutex();
-    out=angularRates;
-    ReleaseMutex();
-    return out;
-}
-
-void AhrsData::GetQuaternionAndAngularRates(Quaternion &outQuaternion,Vector3D &outAngularRates) const {
-    GetMutex();
-    outQuaternion=quaternion;
-    outAngularRates=angularRates;
-    ReleaseMutex();
-}
-
-void AhrsData::SetQuaternionAndAngularRates(const Quaternion &inQuaternion,const Vector3D &inAngularRates) {
-    GetMutex();
-    quaternion=inQuaternion;
-    angularRates=inAngularRates;
-    ReleaseMutex();
+  Vector3D out;
+  GetMutex();
+  out = angularRates;
+  ReleaseMutex();
+  return out;
+}
+
+void AhrsData::GetQuaternionAndAngularRates(Quaternion &outQuaternion,
+                                            Vector3D &outAngularRates) const {
+  GetMutex();
+  outQuaternion = quaternion;
+  outAngularRates = angularRates;
+  ReleaseMutex();
+}
+
+void AhrsData::SetQuaternionAndAngularRates(const Quaternion &inQuaternion,
+                                            const Vector3D &inAngularRates) {
+  GetMutex();
+  quaternion = inQuaternion;
+  angularRates = inAngularRates;
+  ReleaseMutex();
 }
 
 void AhrsData::SetQuaternion(const Quaternion &inQuaternion) {
-    GetMutex();
-    quaternion=inQuaternion;
-    ReleaseMutex();
+  GetMutex();
+  quaternion = inQuaternion;
+  ReleaseMutex();
 }
 
 void AhrsData::SetAngularRates(const Vector3D &inAngularRates) {
-    GetMutex();
-    angularRates=inAngularRates;
-    ReleaseMutex();
-}
-
-IODataElement* AhrsData::Element(PlotableData_t plotableData) const {
-    string name;
-    switch(plotableData) {
-    case AhrsData::Roll:
-        name="Roll";
-        break;
-    case AhrsData::Pitch:
-        name="Pitch";
-        break;
-    case AhrsData::Yaw:
-        name="Yaw";
-        break;
-     case AhrsData::RollDeg:
-        name="Roll degree";
-        break;
-    case AhrsData::PitchDeg:
-        name="Pitch degree";
-        break;
-    case AhrsData::YawDeg:
-        name="Yaw degree";
-        break;
-    case AhrsData::Q0:
-        name="Q0";
-        break;
-    case AhrsData::Q1:
-        name="Q1";
-        break;
-    case AhrsData::Q2:
-        name="Q2";
-        break;
-    case AhrsData::Q3:
-        name="Q3";
-        break;
-    case AhrsData::Wx:
-        name="Wx";
-        break;
-    case AhrsData::Wy:
-        name="Wy";
-        break;
-    case AhrsData::Wz:
-        name="Wz";
-        break;
-    case AhrsData::WxDeg:
-        name="Wx degree";
-        break;
-    case AhrsData::WyDeg:
-        name="Wy degree";
-        break;
-    case AhrsData::WzDeg:
-        name="Wz degree";
-        break;
-    default:
-        Err("data type unavailable.\n");
-    }
-
-    return new AhrsDataElement(this,name,plotableData);
+  GetMutex();
+  angularRates = inAngularRates;
+  ReleaseMutex();
+}
+
+IODataElement *AhrsData::Element(PlotableData_t plotableData) const {
+  string name;
+  switch (plotableData) {
+  case AhrsData::Roll:
+    name = "Roll";
+    break;
+  case AhrsData::Pitch:
+    name = "Pitch";
+    break;
+  case AhrsData::Yaw:
+    name = "Yaw";
+    break;
+  case AhrsData::RollDeg:
+    name = "Roll degree";
+    break;
+  case AhrsData::PitchDeg:
+    name = "Pitch degree";
+    break;
+  case AhrsData::YawDeg:
+    name = "Yaw degree";
+    break;
+  case AhrsData::Q0:
+    name = "Q0";
+    break;
+  case AhrsData::Q1:
+    name = "Q1";
+    break;
+  case AhrsData::Q2:
+    name = "Q2";
+    break;
+  case AhrsData::Q3:
+    name = "Q3";
+    break;
+  case AhrsData::Wx:
+    name = "Wx";
+    break;
+  case AhrsData::Wy:
+    name = "Wy";
+    break;
+  case AhrsData::Wz:
+    name = "Wz";
+    break;
+  case AhrsData::WxDeg:
+    name = "Wx degree";
+    break;
+  case AhrsData::WyDeg:
+    name = "Wy degree";
+    break;
+  case AhrsData::WzDeg:
+    name = "Wz degree";
+    break;
+  default:
+    Err("data type unavailable.\n");
+  }
+
+  return new AhrsDataElement(this, name, plotableData);
 }
 
 void AhrsData::CopyDatas(char *dst) const {
-    GetMutex();
-    Queue(&dst,&quaternion.q0,sizeof(quaternion.q0));
-    Queue(&dst,&quaternion.q1,sizeof(quaternion.q1));
-    Queue(&dst,&quaternion.q2,sizeof(quaternion.q2));
-    Queue(&dst,&quaternion.q3,sizeof(quaternion.q3));
-
-    Queue(&dst,&angularRates.x,sizeof(angularRates.x));
-    Queue(&dst,&angularRates.y,sizeof(angularRates.y));
-    Queue(&dst,&angularRates.z,sizeof(angularRates.z));
-    ReleaseMutex();
-}
-
-void AhrsData::Queue(char **dst,const void *src,size_t size) const {
-    memcpy(*dst,src,size);
-    *dst+=size;
+  GetMutex();
+  Queue(&dst, &quaternion.q0, sizeof(quaternion.q0));
+  Queue(&dst, &quaternion.q1, sizeof(quaternion.q1));
+  Queue(&dst, &quaternion.q2, sizeof(quaternion.q2));
+  Queue(&dst, &quaternion.q3, sizeof(quaternion.q3));
+
+  Queue(&dst, &angularRates.x, sizeof(angularRates.x));
+  Queue(&dst, &angularRates.y, sizeof(angularRates.y));
+  Queue(&dst, &angularRates.z, sizeof(angularRates.z));
+  ReleaseMutex();
+}
+
+void AhrsData::Queue(char **dst, const void *src, size_t size) const {
+  memcpy(*dst, src, size);
+  *dst += size;
 }
 
Index: trunk/lib/FlairCore/src/AhrsData.h
===================================================================
--- trunk/lib/FlairCore/src/AhrsData.h	(revision 14)
+++ trunk/lib/FlairCore/src/AhrsData.h	(revision 15)
@@ -18,158 +18,172 @@
 #include <Quaternion.h>
 
-namespace flair { namespace core {
+namespace flair {
+namespace core {
 
-    /*! \class AhrsData
-    *
-    * \brief Class defining AHRS datas
-    *
-    * AHRS datas consist of quaternion and rotational angles values. \n
-    *
-    */
-    class AhrsData: public io_data {
-        public:
-            class Type: public DataType {
-            public:
-                Type(const ScalarType &inElementDataType):
-                    elementDataType(inElementDataType) {}
-                const ScalarType  &GetElementDataType() const {return elementDataType;}
-                std::string GetDescription() const {return "ahrs data";}
-                size_t GetSize() const {
-                    return 7*elementDataType.GetSize();
-                }
-            private:
-                const ScalarType &elementDataType;
-            };
+/*! \class AhrsData
+*
+* \brief Class defining AHRS datas
+*
+* AHRS datas consist of quaternion and rotational angles values. \n
+*
+*/
+class AhrsData : public io_data {
+public:
+  class Type : public DataType {
+  public:
+    Type(const ScalarType &inElementDataType)
+        : elementDataType(inElementDataType) {}
+    const ScalarType &GetElementDataType() const { return elementDataType; }
+    std::string GetDescription() const { return "ahrs data"; }
+    size_t GetSize() const { return 7 * elementDataType.GetSize(); }
 
-            /*!
-            \enum PlotableData_t
-            \brief Datas wich can be plotted in a DataPlot1D
-            */
-            typedef enum {
-                Roll/*! roll */, Pitch/*! pitch */, Yaw/*! yaw */,
-                RollDeg/*! roll degree*/, PitchDeg/*! pitch degree */, YawDeg/*! yaw degree */,
-                Q0/*! quaternion 0 */, Q1/*! quaternion 1 */, Q2/*! quaternion 2 */, Q3/*! quaternion 3 */,
-                Wx/*! x filtered angular rate */, Wy/*! y filtered angular rate */, Wz/*! z filtered angular rate */,
-                WxDeg/*! x filtered angular rate degree*/, WyDeg/*! y filtered angular rate degree*/, WzDeg/*! z filtered angular rate degree*/,
-                } PlotableData_t;
+  private:
+    const ScalarType &elementDataType;
+  };
 
-            /*!
-            * \brief Constructor
-            *
-            * Construct an io_data representing AHRS datas. \n
-            *
-            * \param parent parent
-            * \param name name
-            * \param n number of samples
-            */
-            AhrsData(const Object* parent,std::string name="",int n=1);
+  /*!
+  \enum PlotableData_t
+  \brief Datas wich can be plotted in a DataPlot1D
+  */
+  typedef enum {
+    Roll /*! roll */,
+    Pitch /*! pitch */,
+    Yaw /*! yaw */,
+    RollDeg /*! roll degree*/,
+    PitchDeg /*! pitch degree */,
+    YawDeg /*! yaw degree */,
+    Q0 /*! quaternion 0 */,
+    Q1 /*! quaternion 1 */,
+    Q2 /*! quaternion 2 */,
+    Q3 /*! quaternion 3 */,
+    Wx /*! x filtered angular rate */,
+    Wy /*! y filtered angular rate */,
+    Wz /*! z filtered angular rate */,
+    WxDeg /*! x filtered angular rate degree*/,
+    WyDeg /*! y filtered angular rate degree*/,
+    WzDeg /*! z filtered angular rate degree*/,
+  } PlotableData_t;
 
-            /*!
-            * \brief Destructor
-            *
-            */
-            ~AhrsData();
+  /*!
+  * \brief Constructor
+  *
+  * Construct an io_data representing AHRS datas. \n
+  *
+  * \param parent parent
+  * \param name name
+  * \param n number of samples
+  */
+  AhrsData(const Object *parent, std::string name = "", int n = 1);
 
-            /*!
-            * \brief Element
-            *
-            * Get a pointer to a specific element. This pointer can be used for plotting.
-            *
-            * \param plotableData data type
-            *
-            * \return pointer to the element
-            */
-            IODataElement *Element(PlotableData_t plotableData) const;
+  /*!
+  * \brief Destructor
+  *
+  */
+  ~AhrsData();
 
-            /*!
-            * \brief Set quaternion
-            *
-            * This method is mutex protected.
-            *
-            * \param quaternion quaternion
-            *
-            */
-            void SetQuaternion(const Quaternion &quaternion);
+  /*!
+  * \brief Element
+  *
+  * Get a pointer to a specific element. This pointer can be used for plotting.
+  *
+  * \param plotableData data type
+  *
+  * \return pointer to the element
+  */
+  IODataElement *Element(PlotableData_t plotableData) const;
 
-            /*!
-            * \brief Get quaternion
-            *
-            * This method is mutex protected.
-            *
-            * \return quaternion
-            *
-            */
-            Quaternion GetQuaternion(void) const;
+  /*!
+  * \brief Set quaternion
+  *
+  * This method is mutex protected.
+  *
+  * \param quaternion quaternion
+  *
+  */
+  void SetQuaternion(const Quaternion &quaternion);
 
-            /*!
-            * \brief Set angular rates
-            *
-            * This method is mutex protected.
-            *
-            * \param angularRates angular rates
-            *
-            */
-            void SetAngularRates(const Vector3D &angularRates);
+  /*!
+  * \brief Get quaternion
+  *
+  * This method is mutex protected.
+  *
+  * \return quaternion
+  *
+  */
+  Quaternion GetQuaternion(void) const;
 
-            /*!
-            * \brief Get angular rates
-            *
-            * This method is mutex protected.
-            *
-            * \return angular rates
-            *
-            */
-            Vector3D GetAngularRates(void) const;
+  /*!
+  * \brief Set angular rates
+  *
+  * This method is mutex protected.
+  *
+  * \param angularRates angular rates
+  *
+  */
+  void SetAngularRates(const Vector3D &angularRates);
 
-            /*!
-            * \brief Get both quaternion and angular rates
-            *
-            * This method is mutex protected.
-            *
-            * \param quaternion quaternion
-            * \param angularRates angular rates
-            *
-            */
-            void GetQuaternionAndAngularRates(Quaternion &quaternion,Vector3D &angularRates) const;
+  /*!
+  * \brief Get angular rates
+  *
+  * This method is mutex protected.
+  *
+  * \return angular rates
+  *
+  */
+  Vector3D GetAngularRates(void) const;
 
-            /*!
-            * \brief Set both quaternion and angular rates
-            *
-            * This method is mutex protected.
-            *
-            * \param quaternion quaternion
-            * \param angularRates angular rates
-            *
-            */
-            void SetQuaternionAndAngularRates(const Quaternion &quaternion,const Vector3D &angularRates);
+  /*!
+  * \brief Get both quaternion and angular rates
+  *
+  * This method is mutex protected.
+  *
+  * \param quaternion quaternion
+  * \param angularRates angular rates
+  *
+  */
+  void GetQuaternionAndAngularRates(Quaternion &quaternion,
+                                    Vector3D &angularRates) const;
 
-            const Type &GetDataType() const {return dataType;}
-        private:
-            /*!
-            * \brief Copy datas
-            *
-            * Reimplemented from io_data. \n
-            * See io_data::CopyDatas.
-            *
-            * \param dst destination buffer
-            */
-            void CopyDatas(char *dst) const;
+  /*!
+  * \brief Set both quaternion and angular rates
+  *
+  * This method is mutex protected.
+  *
+  * \param quaternion quaternion
+  * \param angularRates angular rates
+  *
+  */
+  void SetQuaternionAndAngularRates(const Quaternion &quaternion,
+                                    const Vector3D &angularRates);
 
-            void Queue(char **dst,const void *src,size_t size) const;
+  const Type &GetDataType() const { return dataType; }
 
-            /*!
-            * \brief %Quaternion
-            *
-            */
-            Quaternion quaternion;
+private:
+  /*!
+  * \brief Copy datas
+  *
+  * Reimplemented from io_data. \n
+  * See io_data::CopyDatas.
+  *
+  * \param dst destination buffer
+  */
+  void CopyDatas(char *dst) const;
 
-            /*!
-            * \brief Angular rates
-            *
-            */
-            Vector3D angularRates;
+  void Queue(char **dst, const void *src, size_t size) const;
 
-            Type dataType;
-    };
+  /*!
+  * \brief %Quaternion
+  *
+  */
+  Quaternion quaternion;
+
+  /*!
+  * \brief Angular rates
+  *
+  */
+  Vector3D angularRates;
+
+  Type dataType;
+};
 
 } // end namespace core
Index: trunk/lib/FlairCore/src/Box.cpp
===================================================================
--- trunk/lib/FlairCore/src/Box.cpp	(revision 14)
+++ trunk/lib/FlairCore/src/Box.cpp	(revision 15)
@@ -21,54 +21,38 @@
 using std::string;
 
-namespace flair
-{
-namespace gui
-{
+namespace flair {
+namespace gui {
 
-Box::Box(const LayoutPosition* position,string name,string type): Widget(position->getLayout(),name,type)
-{
-    value_changed=true;
-    SetVolatileXmlProp("row",position->Row());
-    SetVolatileXmlProp("col",position->Col());
-    delete position;
+Box::Box(const LayoutPosition *position, string name, string type)
+    : Widget(position->getLayout(), name, type) {
+  value_changed = true;
+  SetVolatileXmlProp("row", position->Row());
+  SetVolatileXmlProp("col", position->Col());
+  delete position;
 }
 
-Box::~Box()
-{
-core::Object::ObjectName();
+Box::~Box() { core::Object::ObjectName(); }
+
+bool Box::ValueChanged(void) {
+  bool ret;
+
+  GetMutex();
+  if (value_changed == true) {
+    value_changed = false;
+    ret = true;
+  } else {
+    ret = false;
+  }
+  ReleaseMutex();
+
+  return ret;
 }
 
-bool Box::ValueChanged(void)
-{
-    bool ret;
+void Box::SetValueChanged(void) { value_changed = true; }
 
-    GetMutex();
-    if(value_changed==true)
-    {
-       value_changed=false;
-       ret=true;
-    }
-    else
-    {
-        ret=false;
-    }
-    ReleaseMutex();
+void Box::GetMutex(void) const { ((Layout *)Parent())->mutex->GetMutex(); }
 
-    return ret;
-}
-
-void Box::SetValueChanged(void)
-{
-    value_changed=true;
-}
-
-void Box::GetMutex(void) const
-{
-    ((Layout*)Parent())->mutex->GetMutex();
-}
-
-void Box::ReleaseMutex(void) const
-{
-    ((Layout*)Parent())->mutex->ReleaseMutex();
+void Box::ReleaseMutex(void) const {
+  ((Layout *)Parent())->mutex->ReleaseMutex();
 }
 
Index: trunk/lib/FlairCore/src/Box.h
===================================================================
--- trunk/lib/FlairCore/src/Box.h	(revision 14)
+++ trunk/lib/FlairCore/src/Box.h	(revision 15)
@@ -16,91 +16,92 @@
 #include <Widget.h>
 
-namespace flair
-{
-namespace gui
-{
+namespace flair {
+namespace gui {
 
-    class Layout;
-    class LayoutPosition;
+class Layout;
+class LayoutPosition;
 
-    /*! \class Box
-    *
-    * \brief Abstract class to display a box on the ground station
-    *
-    * This is an abstract class to display boxes (like CheckBox, SpinBox, etc). \n
-    * To access reimplemented box's value, use Box::GetMutex and Box::ReleaseMutex. \n
-    * Note that this mutex is in reality the one from the parent Layout. To minimize memory
-    * footprint, each Box does not have its own Mutex.
-    */
-    class Box: public Widget
-    {
-        public:
-            /*!
-            * \brief Constructor
-            *
-            * Construct a Box. \n
-            * Type must agree with predifined (hard coded) types
-            * in ground station code. \n
-            * The Box will automatically be child of position->getLayout() Layout. After calling this method,
-            * position will be deleted as it is no longer usefull.
-            *
-            * \param position position
-            * \param name name
-            * \param type type
-            */
-            Box(const LayoutPosition* position,std::string name,std::string type);
+/*! \class Box
+*
+* \brief Abstract class to display a box on the ground station
+*
+* This is an abstract class to display boxes (like CheckBox, SpinBox, etc). \n
+* To access reimplemented box's value, use Box::GetMutex and Box::ReleaseMutex.
+*\n
+* Note that this mutex is in reality the one from the parent Layout. To minimize
+*memory
+* footprint, each Box does not have its own Mutex.
+*/
+class Box : public Widget {
+public:
+  /*!
+  * \brief Constructor
+  *
+  * Construct a Box. \n
+  * Type must agree with predifined (hard coded) types
+  * in ground station code. \n
+  * The Box will automatically be child of position->getLayout() Layout. After
+  *calling this method,
+  * position will be deleted as it is no longer usefull.
+  *
+  * \param position position
+  * \param name name
+  * \param type type
+  */
+  Box(const LayoutPosition *position, std::string name, std::string type);
 
-            /*!
-            * \brief Destructor
-            *
-            */
-            ~Box();
+  /*!
+  * \brief Destructor
+  *
+  */
+  ~Box();
 
-            /*!
-            * \brief Has the value changed since last call?
-            *
-            * This method returns the value of an internal flag
-            * which is set through SetValueChanged(). \n
-            * After calling this method, the internal flag is
-            * set to false.
-            *
-            * \return true is valued has changed since last call
-            */
-            bool ValueChanged(void);
+  /*!
+  * \brief Has the value changed since last call?
+  *
+  * This method returns the value of an internal flag
+  * which is set through SetValueChanged(). \n
+  * After calling this method, the internal flag is
+  * set to false.
+  *
+  * \return true is valued has changed since last call
+  */
+  bool ValueChanged(void);
 
-        protected:
-            /*!
-            * \brief Set the value changed flag
-            *
-            * The reimplemented class must call this method when Box's value is changed. \n
-            * This method must be called with Mutex locked. Indeed, as reimplemented class
-            * also has to lock the Mutex to change the Box value, this mecanism avoid two successives
-            * lock and unlock.
-            *
-            */
-            void SetValueChanged(void);
+protected:
+  /*!
+  * \brief Set the value changed flag
+  *
+  * The reimplemented class must call this method when Box's value is changed.
+  *\n
+  * This method must be called with Mutex locked. Indeed, as reimplemented class
+  * also has to lock the Mutex to change the Box value, this mecanism avoid two
+  *successives
+  * lock and unlock.
+  *
+  */
+  void SetValueChanged(void);
 
-            /*!
-            * \brief Get Mutex
-            *
-            * This method must be called before changing Box's value or
-            * calling SetValueChanged().
-            *
-            */
-            void GetMutex(void) const;
+  /*!
+  * \brief Get Mutex
+  *
+  * This method must be called before changing Box's value or
+  * calling SetValueChanged().
+  *
+  */
+  void GetMutex(void) const;
 
-            /*!
-            * \brief Release Mutex
-            *
-             * This method must be called after changing Box's value or
-            *  calling SetValueChanged().
-            *
-            */
-            void ReleaseMutex(void) const;
+  /*!
+  * \brief Release Mutex
+  *
+   * This method must be called after changing Box's value or
+  *  calling SetValueChanged().
+  *
+  */
+  void ReleaseMutex(void) const;
 
-
-        private:
-            bool value_changed;
-    };
+private:
+  bool value_changed;
+};
 
 } // end namespace gui
Index: trunk/lib/FlairCore/src/CheckBox.cpp
===================================================================
--- trunk/lib/FlairCore/src/CheckBox.cpp	(revision 14)
+++ trunk/lib/FlairCore/src/CheckBox.cpp	(revision 15)
@@ -19,48 +19,42 @@
 using std::string;
 
-namespace flair
-{
-namespace gui
-{
+namespace flair {
+namespace gui {
 
-CheckBox::CheckBox(const LayoutPosition* position,string name,bool default_value):Box(position,name,"CheckBox")
-{
-    //update value from xml file
-    box_value=default_value;
+CheckBox::CheckBox(const LayoutPosition *position, string name,
+                   bool default_value)
+    : Box(position, name, "CheckBox") {
+  // update value from xml file
+  box_value = default_value;
 
-    GetPersistentXmlProp("value",box_value);
-    SetPersistentXmlProp("value",Value());
-    SendXml();
+  GetPersistentXmlProp("value", box_value);
+  SetPersistentXmlProp("value", Value());
+  SendXml();
 }
 
-CheckBox::~CheckBox()
-{
+CheckBox::~CheckBox() {}
 
+bool CheckBox::IsChecked(void) const {
+  bool tmp;
+
+  GetMutex();
+  tmp = box_value;
+  ReleaseMutex();
+
+  return tmp;
 }
 
-bool CheckBox::IsChecked(void) const
-{
-    bool tmp;
-
-    GetMutex();
-    tmp=box_value;
-    ReleaseMutex();
-
-    return tmp;
+int CheckBox::Value(void) const {
+  if (IsChecked() == true)
+    return 1;
+  else
+    return 0;
 }
 
-int CheckBox::Value(void) const
-{
-    if(IsChecked()==true)
-        return 1;
-    else
-        return 0;
-}
-
-void CheckBox::XmlEvent(void)
-{
-    GetMutex();
-    if(GetPersistentXmlProp("value",box_value)) SetValueChanged();
-    ReleaseMutex();
+void CheckBox::XmlEvent(void) {
+  GetMutex();
+  if (GetPersistentXmlProp("value", box_value))
+    SetValueChanged();
+  ReleaseMutex();
 }
 
Index: trunk/lib/FlairCore/src/CheckBox.h
===================================================================
--- trunk/lib/FlairCore/src/CheckBox.h	(revision 14)
+++ trunk/lib/FlairCore/src/CheckBox.h	(revision 15)
@@ -16,61 +16,59 @@
 #include <Box.h>
 
-namespace flair
-{
-namespace gui
-{
+namespace flair {
+namespace gui {
 
-    class LayoutPosition;
+class LayoutPosition;
 
-    /*! \class CheckBox
-    *
-    * \brief Class displaying a QCheckBox on the ground station
-    *
-    */
-    class CheckBox: public Box
-    {
-        public:
-            /*!
-            * \brief Constructor
-            *
-            * Construct a QCheckBox at given position.
-            *
-            * \param position position to display the QCheckBox
-            * \param name name
-            * \param default_value default value if not in the xml config file
-            */
-            CheckBox(const LayoutPosition* position,std::string name,bool default_value=true);
+/*! \class CheckBox
+*
+* \brief Class displaying a QCheckBox on the ground station
+*
+*/
+class CheckBox : public Box {
+public:
+  /*!
+  * \brief Constructor
+  *
+  * Construct a QCheckBox at given position.
+  *
+  * \param position position to display the QCheckBox
+  * \param name name
+  * \param default_value default value if not in the xml config file
+  */
+  CheckBox(const LayoutPosition *position, std::string name,
+           bool default_value = true);
 
-            /*!
-            * \brief Destructor
-            *
-            */
-            ~CheckBox();
+  /*!
+  * \brief Destructor
+  *
+  */
+  ~CheckBox();
 
-            /*!
-            * \brief Is checked?
-            *
-            * \return true if checked
-            */
-            bool IsChecked(void) const;
+  /*!
+  * \brief Is checked?
+  *
+  * \return true if checked
+  */
+  bool IsChecked(void) const;
 
-            /*!
-            * \brief Value
-            *
-            * \return 1 if checked, 0 otherwise
-            */
-            int Value(void) const;
+  /*!
+  * \brief Value
+  *
+  * \return 1 if checked, 0 otherwise
+  */
+  int Value(void) const;
 
-        private:
-            /*!
-            * \brief XmlEvent from ground station
-            *
-            * Reimplemented from Widget.
-            *
-            */
-            void XmlEvent(void);
+private:
+  /*!
+  * \brief XmlEvent from ground station
+  *
+  * Reimplemented from Widget.
+  *
+  */
+  void XmlEvent(void);
 
-            bool box_value;
-    };
+  bool box_value;
+};
 
 } // end namespace gui
Index: trunk/lib/FlairCore/src/ComboBox.cpp
===================================================================
--- trunk/lib/FlairCore/src/ComboBox.cpp	(revision 14)
+++ trunk/lib/FlairCore/src/ComboBox.cpp	(revision 15)
@@ -19,46 +19,39 @@
 using std::string;
 
-namespace flair
-{
-namespace gui
-{
+namespace flair {
+namespace gui {
 
-ComboBox::ComboBox(const LayoutPosition* position,string name):Box(position,name,"ComboBox")
-{
-    //update value from xml file
-    box_value=0;
-    GetPersistentXmlProp("value",box_value);
-    SetPersistentXmlProp("value",box_value);
+ComboBox::ComboBox(const LayoutPosition *position, string name)
+    : Box(position, name, "ComboBox") {
+  // update value from xml file
+  box_value = 0;
+  GetPersistentXmlProp("value", box_value);
+  SetPersistentXmlProp("value", box_value);
 
-    SendXml();
+  SendXml();
 }
 
-ComboBox::~ComboBox()
-{
+ComboBox::~ComboBox() {}
 
+void ComboBox::AddItem(string name) {
+  SetVolatileXmlProp("item", name);
+  SendXml();
 }
 
-void ComboBox::AddItem(string name)
-{
-    SetVolatileXmlProp("item",name);
-    SendXml();
+int ComboBox::CurrentIndex(void) const {
+  int tmp;
+
+  GetMutex();
+  tmp = box_value;
+  ReleaseMutex();
+
+  return tmp;
 }
 
-int ComboBox::CurrentIndex(void) const
-{
-    int tmp;
-
-    GetMutex();
-    tmp=box_value;
-    ReleaseMutex();
-
-    return tmp;
-}
-
-void ComboBox::XmlEvent(void)
-{
-    GetMutex();
-    if(GetPersistentXmlProp("value",box_value)) SetValueChanged();
-    ReleaseMutex();
+void ComboBox::XmlEvent(void) {
+  GetMutex();
+  if (GetPersistentXmlProp("value", box_value))
+    SetValueChanged();
+  ReleaseMutex();
 }
 
Index: trunk/lib/FlairCore/src/ComboBox.h
===================================================================
--- trunk/lib/FlairCore/src/ComboBox.h	(revision 14)
+++ trunk/lib/FlairCore/src/ComboBox.h	(revision 15)
@@ -16,64 +16,61 @@
 #include <Box.h>
 
-namespace flair
-{
-namespace gui
-{
+namespace flair {
+namespace gui {
 
-    class LayoutPosition;
+class LayoutPosition;
 
-    /*! \class ComboBox
-    *
-    * \brief Class displaying a QComboBox on the ground station
-    *
-    */
-    class ComboBox: public Box
-    {
-        public:
-            /*!
-            * \brief Constructor
-            *
-            * Construct a QComboBox at given position.
-            *
-            * \param position position to display the QComboBox
-            * \param name name
-            */
-            ComboBox(const LayoutPosition* position,std::string name);
+/*! \class ComboBox
+*
+* \brief Class displaying a QComboBox on the ground station
+*
+*/
+class ComboBox : public Box {
+public:
+  /*!
+  * \brief Constructor
+  *
+  * Construct a QComboBox at given position.
+  *
+  * \param position position to display the QComboBox
+  * \param name name
+  */
+  ComboBox(const LayoutPosition *position, std::string name);
 
-            /*!
-            * \brief Destructor
-            *
-            */
-            ~ComboBox();
+  /*!
+  * \brief Destructor
+  *
+  */
+  ~ComboBox();
 
-             /*!
-            * \brief Add an item
-            *
-            * Add an item to the end of the list.
-            *
-            * \param name item nam
-            */
-            void AddItem(std::string name);
+  /*!
+ * \brief Add an item
+ *
+ * Add an item to the end of the list.
+ *
+ * \param name item nam
+ */
+  void AddItem(std::string name);
 
-            /*!
-            * \brief Currend index
-            *
-            * Index of the currently selected item. Items are numbered starting to 0.
-            *
-            * \return index number
-            */
-            int CurrentIndex(void) const;
+  /*!
+  * \brief Currend index
+  *
+  * Index of the currently selected item. Items are numbered starting to 0.
+  *
+  * \return index number
+  */
+  int CurrentIndex(void) const;
 
-        private:
-            /*!
-            * \brief XmlEvent from ground station
-            *
-            * Reimplemented from Widget.
-            *
-            */
-            void XmlEvent(void);
+private:
+  /*!
+  * \brief XmlEvent from ground station
+  *
+  * Reimplemented from Widget.
+  *
+  */
+  void XmlEvent(void);
 
-            int box_value;
-    };
+  int box_value;
+};
 
 } // end namespace gui
Index: trunk/lib/FlairCore/src/ConditionVariable.cpp
===================================================================
--- trunk/lib/FlairCore/src/ConditionVariable.cpp	(revision 14)
+++ trunk/lib/FlairCore/src/ConditionVariable.cpp	(revision 15)
@@ -21,25 +21,21 @@
 using std::string;
 
-namespace flair { namespace core {
+namespace flair {
+namespace core {
 
-ConditionVariable::ConditionVariable(const Object* parent,string name): Mutex(parent,name) {
-     pimpl_=new ConditionVariable_impl(this);
+ConditionVariable::ConditionVariable(const Object *parent, string name)
+    : Mutex(parent, name) {
+  pimpl_ = new ConditionVariable_impl(this);
 }
 
-ConditionVariable::~ConditionVariable() {
-    delete pimpl_;
+ConditionVariable::~ConditionVariable() { delete pimpl_; }
+
+void ConditionVariable::CondWait(void) { pimpl_->CondWait(); }
+
+bool ConditionVariable::CondWaitUntil(Time date) {
+  return pimpl_->CondWaitUntil(date);
 }
 
-void ConditionVariable::CondWait(void) {
-    pimpl_->CondWait();
-}
-
-bool ConditionVariable::CondWaitUntil(Time date) {
-    return pimpl_->CondWaitUntil(date);
-}
-
-void ConditionVariable::CondSignal(void) {
-    pimpl_->CondSignal();
-}
+void ConditionVariable::CondSignal(void) { pimpl_->CondSignal(); }
 
 } // end namespace core
Index: trunk/lib/FlairCore/src/ConditionVariable.h
===================================================================
--- trunk/lib/FlairCore/src/ConditionVariable.h	(revision 14)
+++ trunk/lib/FlairCore/src/ConditionVariable.h	(revision 15)
@@ -18,69 +18,75 @@
 class ConditionVariable_impl;
 
-namespace flair
-{
-namespace core
-{
+namespace flair {
+namespace core {
 
-    /*! \class ConditionVariable
-    *
-    * \brief Class defining a condition variable
-    *
-    */
+/*! \class ConditionVariable
+*
+* \brief Class defining a condition variable
+*
+*/
 
-    class ConditionVariable: public Mutex
-    {
-        public:
-            /*!
-            * \brief Constructor
-            *
-            * Construct a condition variable with its associated mutex.
-            *
-            * \param parent parent
-            * \param name name
-            */
-            ConditionVariable(const Object* parent,std::string name);
+class ConditionVariable : public Mutex {
+public:
+  /*!
+  * \brief Constructor
+  *
+  * Construct a condition variable with its associated mutex.
+  *
+  * \param parent parent
+  * \param name name
+  */
+  ConditionVariable(const Object *parent, std::string name);
 
-            /*!
-            * \brief Destructor
-            *
-            */
-            ~ConditionVariable();
+  /*!
+  * \brief Destructor
+  *
+  */
+  ~ConditionVariable();
 
-            /*!
-            * \brief Block on the condition variable
-            *
-            * This method must be called with mutex locked (see Mutex::GetMutex) by the calling thread or undefined behaviour will result. \n
-            * It atomically releases mutex and causes the calling thread to block on the condition variable. \n
-            * Only one thread can be blocked at the same time. \n
-            * Upon successful return, the mutex has been locked and is owned by the calling thread which should unlock it (see Mutex::ReleaseMutex).
-            */
-            void CondWait(void);
+  /*!
+  * \brief Block on the condition variable
+  *
+  * This method must be called with mutex locked (see Mutex::GetMutex) by the
+  *calling thread or undefined behaviour will result. \n
+  * It atomically releases mutex and causes the calling thread to block on the
+  *condition variable. \n
+  * Only one thread can be blocked at the same time. \n
+  * Upon successful return, the mutex has been locked and is owned by the
+  *calling thread which should unlock it (see Mutex::ReleaseMutex).
+  */
+  void CondWait(void);
 
-            /*!
-            * \brief Block on the condition variable with a timeout
-            *
-            * This method must be called with mutex locked (see Mutex::GetMutex) by the calling thread or undefined behaviour will result. \n
-            * It atomically releases mutex and causes the calling thread to block on the condition variable. \n
-            * Only one thread can be blocked at the same time. \n
-            * Upon successful return, the mutex has been locked and is owned by the calling thread which should unlock it (see Mutex::ReleaseMutex).
-            *
-            * \param date absolute date
-            * \return true if the condition variable is signaled before the date specified in parameter elapses, false otherwise
-            */
-            bool CondWaitUntil(Time date);
+  /*!
+  * \brief Block on the condition variable with a timeout
+  *
+  * This method must be called with mutex locked (see Mutex::GetMutex) by the
+  *calling thread or undefined behaviour will result. \n
+  * It atomically releases mutex and causes the calling thread to block on the
+  *condition variable. \n
+  * Only one thread can be blocked at the same time. \n
+  * Upon successful return, the mutex has been locked and is owned by the
+  *calling thread which should unlock it (see Mutex::ReleaseMutex).
+  *
+  * \param date absolute date
+  * \return true if the condition variable is signaled before the date specified
+  *in parameter elapses, false otherwise
+  */
+  bool CondWaitUntil(Time date);
 
-            /*!
-            * \brief Unblock threads blocked on the condition variable
-            *
-            * This method should be called with mutex locked (see Mutex::GetMutex) by the calling thread. \n
-            * In this case, upon return, the calling thread should unlock the mutex (see Mutex::ReleaseMutex).
-            *
-            */
-            void CondSignal(void);
+  /*!
+  * \brief Unblock threads blocked on the condition variable
+  *
+  * This method should be called with mutex locked (see Mutex::GetMutex) by the
+  *calling thread. \n
+  * In this case, upon return, the calling thread should unlock the mutex (see
+  *Mutex::ReleaseMutex).
+  *
+  */
+  void CondSignal(void);
 
-        private:
-            class ConditionVariable_impl* pimpl_;
-    };
+private:
+  class ConditionVariable_impl *pimpl_;
+};
 
 } // end namespace core
Index: trunk/lib/FlairCore/src/ConditionVariable_impl.cpp
===================================================================
--- trunk/lib/FlairCore/src/ConditionVariable_impl.cpp	(revision 14)
+++ trunk/lib/FlairCore/src/ConditionVariable_impl.cpp	(revision 15)
@@ -24,59 +24,67 @@
 using namespace flair::core;
 
-ConditionVariable_impl::ConditionVariable_impl(ConditionVariable* self) {
-    this->self=self;
-    int status;
+ConditionVariable_impl::ConditionVariable_impl(ConditionVariable *self) {
+  this->self = self;
+  int status;
 
 #ifdef __XENO__
-    status=rt_cond_create(&m_ResumeCond,NULL);
+  status = rt_cond_create(&m_ResumeCond, NULL);
 #else
-    status=pthread_cond_init(&m_ResumeCond, 0);
+  status = pthread_cond_init(&m_ResumeCond, 0);
 #endif
-    if(status!=0) self->Err("error creating condition variable (%s)\n",strerror(-status));
+  if (status != 0)
+    self->Err("error creating condition variable (%s)\n", strerror(-status));
 }
 
 ConditionVariable_impl::~ConditionVariable_impl() {
-    int status;
+  int status;
 
 #ifdef __XENO__
-    status=rt_cond_delete(&m_ResumeCond);
+  status = rt_cond_delete(&m_ResumeCond);
 #else
-    status=pthread_cond_destroy(&m_ResumeCond);
+  status = pthread_cond_destroy(&m_ResumeCond);
 #endif
-    if(status!=0) self->Err("error destroying condition variable (%s)\n",strerror(-status));
+  if (status != 0)
+    self->Err("error destroying condition variable (%s)\n", strerror(-status));
 }
 
 void ConditionVariable_impl::CondWait(void) {
-    int status;
+  int status;
 #ifdef __XENO__
-    status=rt_cond_wait(&m_ResumeCond, &self->Mutex::pimpl_->mutex,TM_INFINITE);
+  status =
+      rt_cond_wait(&m_ResumeCond, &self->Mutex::pimpl_->mutex, TM_INFINITE);
 #else
-    status=pthread_cond_wait(&m_ResumeCond, &self->Mutex::pimpl_->mutex);
+  status = pthread_cond_wait(&m_ResumeCond, &self->Mutex::pimpl_->mutex);
 #endif
-    if(status!=0) self->Err("error (%s)\n",strerror(-status));
+  if (status != 0)
+    self->Err("error (%s)\n", strerror(-status));
 }
 
 bool ConditionVariable_impl::CondWaitUntil(Time date) {
-    int status;
+  int status;
 #ifdef __XENO__
-    status=rt_cond_wait_until(&m_ResumeCond, &self->Mutex::pimpl_->mutex,date);
+  status = rt_cond_wait_until(&m_ResumeCond, &self->Mutex::pimpl_->mutex, date);
 #else
-    struct timespec restrict;
-    restrict.tv_sec=date/1000000000;
-    restrict.tv_nsec=date%1000000000;
-    status=pthread_cond_timedwait(&m_ResumeCond, &self->Mutex::pimpl_->mutex,&restrict);
+  struct timespec restrict;
+  restrict.tv_sec = date / 1000000000;
+  restrict.tv_nsec = date % 1000000000;
+  status = pthread_cond_timedwait(&m_ResumeCond, &self->Mutex::pimpl_->mutex,
+                                  &restrict);
 #endif
-    if (status==0) return true;
-    if(status!=ETIMEDOUT) self->Err("error (%s)\n",strerror(-status));
-    return false;
+  if (status == 0)
+    return true;
+  if (status != ETIMEDOUT)
+    self->Err("error (%s)\n", strerror(-status));
+  return false;
 }
 
 void ConditionVariable_impl::CondSignal(void) {
-     int status;
+  int status;
 #ifdef __XENO__
-    status=rt_cond_signal(&m_ResumeCond);
+  status = rt_cond_signal(&m_ResumeCond);
 #else
-    status=pthread_cond_signal(&m_ResumeCond);
+  status = pthread_cond_signal(&m_ResumeCond);
 #endif
-    if(status!=0) self->Err("error (%s)\n",strerror(-status));
+  if (status != 0)
+    self->Err("error (%s)\n", strerror(-status));
 }
Index: trunk/lib/FlairCore/src/ConnectedSocket.cpp
===================================================================
--- trunk/lib/FlairCore/src/ConnectedSocket.cpp	(revision 14)
+++ trunk/lib/FlairCore/src/ConnectedSocket.cpp	(revision 15)
@@ -21,88 +21,100 @@
 using std::string;
 
-namespace flair
-{
-namespace core
-{
+namespace flair {
+namespace core {
 
-ConnectedSocket::ConnectedSocket(const Object* parent,const std::string name):Object(parent,name) {};
+ConnectedSocket::ConnectedSocket(const Object *parent, const std::string name)
+    : Object(parent, name){};
 
-ConnectedSocket::~ConnectedSocket() {};
+ConnectedSocket::~ConnectedSocket(){};
 
-uint16_t ConnectedSocket::ReadUInt16(Time const& timeout) {
-    char buffer[sizeof(uint16_t)];
-    size_t alreadyReceived=0;
-    Time remainingTimeout=timeout; //ms
-    do {
-        Time beforeTime=GetTime(); //ns
-        ssize_t received=RecvMessage(buffer+alreadyReceived,sizeof(uint16_t)-alreadyReceived,remainingTimeout);
-        remainingTimeout-=(GetTime()-beforeTime)/100000;
-        if ((received<0) || (remainingTimeout<0)) throw std::runtime_error("Timeout");
-        alreadyReceived+=received;
-    } while (alreadyReceived!=sizeof(uint16_t));
-    uint16_t *dataInNetworkEndianness=(uint16_t*)buffer;
-    uint16_t myinteger=NetworkToHost16(*dataInNetworkEndianness);
-    return myinteger;
+uint16_t ConnectedSocket::ReadUInt16(Time const &timeout) {
+  char buffer[sizeof(uint16_t)];
+  size_t alreadyReceived = 0;
+  Time remainingTimeout = timeout; // ms
+  do {
+    Time beforeTime = GetTime(); // ns
+    ssize_t received =
+        RecvMessage(buffer + alreadyReceived,
+                    sizeof(uint16_t) - alreadyReceived, remainingTimeout);
+    remainingTimeout -= (GetTime() - beforeTime) / 100000;
+    if ((received < 0) || (remainingTimeout < 0))
+      throw std::runtime_error("Timeout");
+    alreadyReceived += received;
+  } while (alreadyReceived != sizeof(uint16_t));
+  uint16_t *dataInNetworkEndianness = (uint16_t *)buffer;
+  uint16_t myinteger = NetworkToHost16(*dataInNetworkEndianness);
+  return myinteger;
 }
 
-void ConnectedSocket::WriteUInt16(uint16_t const& data,Time const& timeout) {
-    uint16_t dataInNetworkEndianness=HostToNetwork16(data);
-    char *buffer=(char *)&dataInNetworkEndianness;
-    size_t alreadySent=0;
-    Time remainingTimeout=timeout; //ms
-    do {
-        Time beforeTime=GetTime(); //ns
-        ssize_t sent=SendMessage(buffer+alreadySent,sizeof(uint16_t)-alreadySent,remainingTimeout);
-        remainingTimeout-=(GetTime()-beforeTime)/100000;
-        if ((sent<0) || (remainingTimeout<0)) throw std::runtime_error("Timeout");
-        alreadySent+=sent;
-    } while (alreadySent!=sizeof(uint16_t));
+void ConnectedSocket::WriteUInt16(uint16_t const &data, Time const &timeout) {
+  uint16_t dataInNetworkEndianness = HostToNetwork16(data);
+  char *buffer = (char *)&dataInNetworkEndianness;
+  size_t alreadySent = 0;
+  Time remainingTimeout = timeout; // ms
+  do {
+    Time beforeTime = GetTime(); // ns
+    ssize_t sent = SendMessage(
+        buffer + alreadySent, sizeof(uint16_t) - alreadySent, remainingTimeout);
+    remainingTimeout -= (GetTime() - beforeTime) / 100000;
+    if ((sent < 0) || (remainingTimeout < 0))
+      throw std::runtime_error("Timeout");
+    alreadySent += sent;
+  } while (alreadySent != sizeof(uint16_t));
 }
 
-uint32_t ConnectedSocket::ReadUInt32(Time const& timeout) {
-    char buffer[sizeof(uint32_t)];
-    size_t alreadyReceived=0;
-    Time remainingTimeout=timeout; //ms
-    do {
-        Time beforeTime=GetTime(); //ns
-        ssize_t received=RecvMessage(buffer+alreadyReceived,sizeof(uint32_t)-alreadyReceived,remainingTimeout);
-        remainingTimeout-=(GetTime()-beforeTime)/100000;
-        if ((received<0) || (remainingTimeout<0)) throw std::runtime_error("Timeout");
-        alreadyReceived+=received;
-    } while (alreadyReceived!=sizeof(uint32_t));
-    uint32_t *dataInNetworkEndianness=(uint32_t*)buffer;
-    uint32_t myinteger=NetworkToHost32(*dataInNetworkEndianness);
-    return myinteger;
+uint32_t ConnectedSocket::ReadUInt32(Time const &timeout) {
+  char buffer[sizeof(uint32_t)];
+  size_t alreadyReceived = 0;
+  Time remainingTimeout = timeout; // ms
+  do {
+    Time beforeTime = GetTime(); // ns
+    ssize_t received =
+        RecvMessage(buffer + alreadyReceived,
+                    sizeof(uint32_t) - alreadyReceived, remainingTimeout);
+    remainingTimeout -= (GetTime() - beforeTime) / 100000;
+    if ((received < 0) || (remainingTimeout < 0))
+      throw std::runtime_error("Timeout");
+    alreadyReceived += received;
+  } while (alreadyReceived != sizeof(uint32_t));
+  uint32_t *dataInNetworkEndianness = (uint32_t *)buffer;
+  uint32_t myinteger = NetworkToHost32(*dataInNetworkEndianness);
+  return myinteger;
 }
 
-void ConnectedSocket::WriteUInt32(uint32_t const& data,Time const& timeout) {
-    uint32_t dataInNetworkEndianness=HostToNetwork32(data);
-    char *buffer=(char *)&dataInNetworkEndianness;
-    size_t alreadySent=0;
-    Time remainingTimeout=timeout; //ms
-    do {
-        Time beforeTime=GetTime(); //ns
-        ssize_t sent=SendMessage(buffer+alreadySent,sizeof(uint32_t)-alreadySent,remainingTimeout);
-        remainingTimeout-=(GetTime()-beforeTime)/100000;
-        if ((sent<0) || (remainingTimeout<0)) throw std::runtime_error("Timeout");
-        alreadySent+=sent;
-    } while (alreadySent!=sizeof(uint32_t));
+void ConnectedSocket::WriteUInt32(uint32_t const &data, Time const &timeout) {
+  uint32_t dataInNetworkEndianness = HostToNetwork32(data);
+  char *buffer = (char *)&dataInNetworkEndianness;
+  size_t alreadySent = 0;
+  Time remainingTimeout = timeout; // ms
+  do {
+    Time beforeTime = GetTime(); // ns
+    ssize_t sent = SendMessage(
+        buffer + alreadySent, sizeof(uint32_t) - alreadySent, remainingTimeout);
+    remainingTimeout -= (GetTime() - beforeTime) / 100000;
+    if ((sent < 0) || (remainingTimeout < 0))
+      throw std::runtime_error("Timeout");
+    alreadySent += sent;
+  } while (alreadySent != sizeof(uint32_t));
 }
 
 string ConnectedSocket::ReadString(const size_t &stringSize, Time timeout) {
-    char buffer[stringSize+1];
-    size_t alreadyReceived=0;
-    Time remainingTimeout=timeout; //ms
-    do {
-        Time beforeTime=GetTime(); //ns
-        ssize_t received=RecvMessage(buffer+alreadyReceived,stringSize-alreadyReceived,remainingTimeout);
-        remainingTimeout-=(GetTime()-beforeTime)/100000;
-        if ((received<0) || (remainingTimeout<0)) throw std::runtime_error("Timeout");
-        alreadyReceived+=received;
-    } while (alreadyReceived!=stringSize);
-    buffer[stringSize]='\0';
+  char buffer[stringSize + 1];
+  size_t alreadyReceived = 0;
+  Time remainingTimeout = timeout; // ms
+  do {
+    Time beforeTime = GetTime(); // ns
+    ssize_t received =
+        RecvMessage(buffer + alreadyReceived, stringSize - alreadyReceived,
+                    remainingTimeout);
+    remainingTimeout -= (GetTime() - beforeTime) / 100000;
+    if ((received < 0) || (remainingTimeout < 0))
+      throw std::runtime_error("Timeout");
+    alreadyReceived += received;
+  } while (alreadyReceived != stringSize);
+  buffer[stringSize] = '\0';
 
-    string mystring=buffer;
-    return mystring;
+  string mystring = buffer;
+  return mystring;
 }
 
Index: trunk/lib/FlairCore/src/ConnectedSocket.h
===================================================================
--- trunk/lib/FlairCore/src/ConnectedSocket.h	(revision 14)
+++ trunk/lib/FlairCore/src/ConnectedSocket.h	(revision 15)
@@ -16,89 +16,93 @@
 #include <Object.h>
 
-namespace flair
-{
-namespace core
-{
+namespace flair {
+namespace core {
 
-    /*! \class ConnectedSocket
-    *
-    * \brief Interface class encapsulating a connected socket. Preserves packets order and guaranty delivery.
-    *
-    */
-    class ConnectedSocket: public Object {
-    public:
-        /*!
-        * \brief Constructor
-        *
-        */
-        ConnectedSocket(const Object* parent,const std::string name);
+/*! \class ConnectedSocket
+*
+* \brief Interface class encapsulating a connected socket. Preserves packets
+*order and guaranty delivery.
+*
+*/
+class ConnectedSocket : public Object {
+public:
+  /*!
+  * \brief Constructor
+  *
+  */
+  ConnectedSocket(const Object *parent, const std::string name);
 
-        /*!
-        * \brief Destructor
-        *
-        */
-        ~ConnectedSocket();
+  /*!
+  * \brief Destructor
+  *
+  */
+  ~ConnectedSocket();
 
-        /*!
-        * \brief Returns a socket which listens on a specific port/address
-        *
-        * \param const Object* parentObject
-        * \param const string name
-        * \param unsigned int port
-        * \param const localAddress (defaults to any)
-        */
-        virtual void Listen(const unsigned int port,const std::string localAddress="ANY")=0;
+  /*!
+  * \brief Returns a socket which listens on a specific port/address
+  *
+  * \param const Object* parentObject
+  * \param const string name
+  * \param unsigned int port
+  * \param const localAddress (defaults to any)
+  */
+  virtual void Listen(const unsigned int port,
+                      const std::string localAddress = "ANY") = 0;
 
-        /*!
-        * \brief Returns a socket on a new incoming connexion
-        *
-        * \param ConnectedSocket &listeningSocket
-        */
-        virtual ConnectedSocket *Accept(Time timeout)=0; //should throw an exception if not a listening socket
+  /*!
+  * \brief Returns a socket on a new incoming connexion
+  *
+  * \param ConnectedSocket &listeningSocket
+  */
+  virtual ConnectedSocket *Accept(
+      Time timeout) = 0; // should throw an exception if not a listening socket
 
-        /*!
-        * \brief Returns a socket connected to a distant host
-        *
-        * \param const Object* parentObject
-        * \param const string name
-        * \param unsigned int port
-        * \param const distantAddress
-        * \param timeout timeout (in milliseconds)
-        */
-        virtual bool Connect(const unsigned int port,const std::string distantAddress,Time timeout)=0;
+  /*!
+  * \brief Returns a socket connected to a distant host
+  *
+  * \param const Object* parentObject
+  * \param const string name
+  * \param unsigned int port
+  * \param const distantAddress
+  * \param timeout timeout (in milliseconds)
+  */
+  virtual bool Connect(const unsigned int port,
+                       const std::string distantAddress, Time timeout) = 0;
 
-        /*!
-        * \brief Send a message
-        *
-        * \param message message
-        * \param message_len message length
-        * \param timeout timeout (in milliseconds)
-        */
-        virtual ssize_t SendMessage(const char* message,size_t message_len,Time timeout)=0;
+  /*!
+  * \brief Send a message
+  *
+  * \param message message
+  * \param message_len message length
+  * \param timeout timeout (in milliseconds)
+  */
+  virtual ssize_t SendMessage(const char *message, size_t message_len,
+                              Time timeout) = 0;
 
-        /*!
-        * \brief Receive a message
-        *
-        * Receive a message and wait up to timeout. \n
-        *
-        * \param buf buffer to put the message
-        * \param buf_len buffer length
-        * \param timeout timeout (in milliseconds)
-        *
-        * \return size of the received message
-        */
-        virtual ssize_t RecvMessage(char* buf,size_t buf_len,Time timeout)=0;
+  /*!
+  * \brief Receive a message
+  *
+  * Receive a message and wait up to timeout. \n
+  *
+  * \param buf buffer to put the message
+  * \param buf_len buffer length
+  * \param timeout timeout (in milliseconds)
+  *
+  * \return size of the received message
+  */
+  virtual ssize_t RecvMessage(char *buf, size_t buf_len, Time timeout) = 0;
 
-        std::string ReadString(const size_t &stringLength, Time timeout);
-        uint16_t ReadUInt16(Time const& timeout);
-        void WriteUInt16(uint16_t const& data,Time const& timeout);
-        uint32_t ReadUInt32(Time const& timeout);
-        void WriteUInt32(uint32_t const& data,Time const& timeout);
+  std::string ReadString(const size_t &stringLength, Time timeout);
+  uint16_t ReadUInt16(Time const &timeout);
+  void WriteUInt16(uint16_t const &data, Time const &timeout);
+  uint32_t ReadUInt32(Time const &timeout);
+  void WriteUInt32(uint32_t const &data, Time const &timeout);
 
-        //!! See Socket.h for a more generic implementation of network/host endianness conversion
-        virtual uint16_t NetworkToHost16(uint16_t data)=0;
-        virtual uint16_t HostToNetwork16(uint16_t data)=0;
-        virtual uint32_t NetworkToHost32(uint32_t data)=0;
-        virtual uint32_t HostToNetwork32(uint32_t data)=0;
+  //!! See Socket.h for a more generic implementation of network/host endianness
+  //conversion
+  virtual uint16_t NetworkToHost16(uint16_t data) = 0;
+  virtual uint16_t HostToNetwork16(uint16_t data) = 0;
+  virtual uint32_t NetworkToHost32(uint32_t data) = 0;
+  virtual uint32_t HostToNetwork32(uint32_t data) = 0;
 };
 
Index: trunk/lib/FlairCore/src/DataPlot.cpp
===================================================================
--- trunk/lib/FlairCore/src/DataPlot.cpp	(revision 14)
+++ trunk/lib/FlairCore/src/DataPlot.cpp	(revision 15)
@@ -24,72 +24,64 @@
 using std::string;
 
-namespace flair
-{
-namespace gui
-{
+namespace flair {
+namespace gui {
 
 using namespace core;
 
-void RGBFromColor(DataPlot::Color_t color,uint8_t &r,uint8_t &g,uint8_t &b)
-{
-    switch(color)
-    {
-        case DataPlot::Red:
-            r=255;
-            g=0;
-            b=0;
-            break;
-        case DataPlot::Blue:
-            r=0;
-            g=0;
-            b=255;
-            break;
-        case DataPlot::Green:
-            r=0;
-            g=255;
-            b=0;
-            break;
-        case DataPlot::Yellow:
-            r=255;
-            g=255;
-            b=0;
-            break;
-        case DataPlot::Black:
-            r=0;
-            g=0;
-            b=0;
-            break;
-        case DataPlot::White:
-            r=255;
-            g=255;
-            b=255;
-            break;
-    }
+void RGBFromColor(DataPlot::Color_t color, uint8_t &r, uint8_t &g, uint8_t &b) {
+  switch (color) {
+  case DataPlot::Red:
+    r = 255;
+    g = 0;
+    b = 0;
+    break;
+  case DataPlot::Blue:
+    r = 0;
+    g = 0;
+    b = 255;
+    break;
+  case DataPlot::Green:
+    r = 0;
+    g = 255;
+    b = 0;
+    break;
+  case DataPlot::Yellow:
+    r = 255;
+    g = 255;
+    b = 0;
+    break;
+  case DataPlot::Black:
+    r = 0;
+    g = 0;
+    b = 0;
+    break;
+  case DataPlot::White:
+    r = 255;
+    g = 255;
+    b = 255;
+    break;
+  }
 }
 
-DataPlot::DataPlot(const LayoutPosition* position,string name,string type):SendData(position,name,type)
-{
-    pimpl_=new DataPlot_impl();
+DataPlot::DataPlot(const LayoutPosition *position, string name, string type)
+    : SendData(position, name, type) {
+  pimpl_ = new DataPlot_impl();
 }
 
-DataPlot::~DataPlot()
-{
-    delete pimpl_;
+DataPlot::~DataPlot() { delete pimpl_; }
+
+void DataPlot::AddDataToSend(const IODataElement *element) {
+  pimpl_->tosend.push_back(element);
+
+  SetSendSize(SendSize() + element->Size());
 }
 
-void DataPlot::AddDataToSend(const IODataElement *element)
-{
-    pimpl_->tosend.push_back(element);
+void DataPlot::CopyDatas(char *buf) const {
+  int buf_size = 0;
 
-    SetSendSize(SendSize()+element->Size());
-}
-
-void DataPlot::CopyDatas(char* buf) const {
-    int buf_size=0;
-
-    for(size_t i=0;i<pimpl_->tosend.size();i++) {
-        pimpl_->tosend[i]->CopyData(buf+buf_size);
-        buf_size+=pimpl_->tosend[i]->Size();
-    }
+  for (size_t i = 0; i < pimpl_->tosend.size(); i++) {
+    pimpl_->tosend[i]->CopyData(buf + buf_size);
+    buf_size += pimpl_->tosend[i]->Size();
+  }
 }
 
Index: trunk/lib/FlairCore/src/DataPlot.h
===================================================================
--- trunk/lib/FlairCore/src/DataPlot.h	(revision 14)
+++ trunk/lib/FlairCore/src/DataPlot.h	(revision 15)
@@ -18,98 +18,93 @@
 class DataPlot_impl;
 
-namespace flair
-{
-    namespace core
-    {
-        class IODataElement;
-    }
+namespace flair {
+namespace core {
+class IODataElement;
 }
-namespace flair
-{
-namespace gui
-{
-    class LayoutPosition;
+}
+namespace flair {
+namespace gui {
+class LayoutPosition;
 
-    /*! \class DataPlot
-    *
-    * \brief Abstract class to display plots on ground station
-    *
-    */
-    class DataPlot: public SendData
-    {
-        public:
-            /*!
-            \enum Color_t
-            \brief Types of colors
-            */
-            typedef enum {
-                Red/*! red  */,
-                Blue/*! blue  */,
-                Green/*! green  */,
-                Yellow/*! yellow  */,
-                Black/*! black  */,
-                White/*! white  */,
-                } Color_t;
+/*! \class DataPlot
+*
+* \brief Abstract class to display plots on ground station
+*
+*/
+class DataPlot : public SendData {
+public:
+  /*!
+  \enum Color_t
+  \brief Types of colors
+  */
+  typedef enum {
+    Red /*! red  */,
+    Blue /*! blue  */,
+    Green /*! green  */,
+    Yellow /*! yellow  */,
+    Black /*! black  */,
+    White /*! white  */,
+  } Color_t;
 
-            /*!
-            * \brief Constructor
-            *
-            * Type must agree with predifined (hard coded) types
-            * in ground station code. After calling this constructor,
-            * position will be deleted as it is no longer usefull.
-            * The DataPlot will automatically be child of position->getLayout() Layout.
-            *
-            * \param position position
-            * \param name nom
-            * \param type type
-            */
-            DataPlot(const LayoutPosition* position,std::string name,std::string type);
+  /*!
+  * \brief Constructor
+  *
+  * Type must agree with predifined (hard coded) types
+  * in ground station code. After calling this constructor,
+  * position will be deleted as it is no longer usefull.
+  * The DataPlot will automatically be child of position->getLayout() Layout.
+  *
+  * \param position position
+  * \param name nom
+  * \param type type
+  */
+  DataPlot(const LayoutPosition *position, std::string name, std::string type);
 
-            /*!
-            * \brief Destructor
-            *
-            */
-            ~DataPlot();
+  /*!
+  * \brief Destructor
+  *
+  */
+  ~DataPlot();
 
-        protected:
-            /*!
-            * \brief Add an IODataElement to the plot.
-            *
-            * This method registers element for sending.
-            *
-            * \param element element to plot
-            */
-            void AddDataToSend(const core::IODataElement *element);
+protected:
+  /*!
+  * \brief Add an IODataElement to the plot.
+  *
+  * This method registers element for sending.
+  *
+  * \param element element to plot
+  */
+  void AddDataToSend(const core::IODataElement *element);
 
-        private:
-            /*!
-            * \brief Copy datas to specified buffer
-            *
-            * Reimplemented from SendData.
-            *
-            * \param buf output buffer
-            */
-            void CopyDatas(char* buf) const;
+private:
+  /*!
+  * \brief Copy datas to specified buffer
+  *
+  * Reimplemented from SendData.
+  *
+  * \param buf output buffer
+  */
+  void CopyDatas(char *buf) const;
 
-            /*!
-            * \brief Extra Xml event
-            *
-            * Reimplemented from SendData.
-            */
-            void ExtraXmlEvent(void){};
+  /*!
+  * \brief Extra Xml event
+  *
+  * Reimplemented from SendData.
+  */
+  void ExtraXmlEvent(void){};
 
-            class DataPlot_impl* pimpl_;
-    };
+  class DataPlot_impl *pimpl_;
+};
 
-    /*!
-    * \brief Get RGB components from color type
-    *
-    *
-    * \param color input color
-    * \param r output component
-    * \param g output component
-    * \param b output component
-    */
-    void RGBFromColor(DataPlot::Color_t color,uint8_t &r,uint8_t &g,uint8_t &b);
+/*!
+* \brief Get RGB components from color type
+*
+*
+* \param color input color
+* \param r output component
+* \param g output component
+* \param b output component
+*/
+void RGBFromColor(DataPlot::Color_t color, uint8_t &r, uint8_t &g, uint8_t &b);
 
 } // end namespace gui
Index: trunk/lib/FlairCore/src/DataPlot1D.cpp
===================================================================
--- trunk/lib/FlairCore/src/DataPlot1D.cpp	(revision 14)
+++ trunk/lib/FlairCore/src/DataPlot1D.cpp	(revision 15)
@@ -23,46 +23,43 @@
 using std::string;
 
-namespace flair
-{
-namespace gui
-{
+namespace flair {
+namespace gui {
 
 using namespace core;
 
-DataPlot1D::DataPlot1D(const LayoutPosition* position,string name,float ymin,float ymax):DataPlot(position,name,"DataPlot1D")
-{
-    SetVolatileXmlProp("min",ymin);
-    SetVolatileXmlProp("max",ymax);
-    SendXml();
+DataPlot1D::DataPlot1D(const LayoutPosition *position, string name, float ymin,
+                       float ymax)
+    : DataPlot(position, name, "DataPlot1D") {
+  SetVolatileXmlProp("min", ymin);
+  SetVolatileXmlProp("max", ymax);
+  SendXml();
 }
 
-DataPlot1D::~DataPlot1D() {
+DataPlot1D::~DataPlot1D() {}
+
+void DataPlot1D::AddCurve(const core::IODataElement *element, uint8_t r,
+                          uint8_t g, uint8_t b, string curve_name) {
+  if (curve_name != "") {
+    SetVolatileXmlProp("curve", curve_name);
+  } else {
+    SetVolatileXmlProp("curve", element->Parent()->ObjectName() + "\\" +
+                                    element->ObjectName());
+  }
+  SetVolatileXmlProp("type", element->GetDataType().GetDescription());
+  SetVolatileXmlProp("r", r);
+  SetVolatileXmlProp("g", g);
+  SetVolatileXmlProp("b", b);
+
+  SendXml();
+
+  // save data information
+  AddDataToSend(element);
 }
 
-void DataPlot1D::AddCurve(const core::IODataElement* element,uint8_t r,uint8_t g,uint8_t b,string curve_name)
-{
-    if(curve_name!="")
-    {
-        SetVolatileXmlProp("curve",curve_name);
-    }
-    else
-    {
-        SetVolatileXmlProp("curve",element->Parent()->ObjectName() + "\\" +element->ObjectName());
-    }
-    SetVolatileXmlProp("type",element->GetDataType().GetDescription());
-    SetVolatileXmlProp("r",r);
-    SetVolatileXmlProp("g",g);
-    SetVolatileXmlProp("b",b);
-
-    SendXml();
-
-    //save data information
-    AddDataToSend(element);
-}
-
-void DataPlot1D::AddCurve(const core::IODataElement* element,Color_t color,string curve_name) {
-    uint8_t r,g,b;
-    RGBFromColor(color,r,g,b);
-    AddCurve(element,r,g,b,curve_name);
+void DataPlot1D::AddCurve(const core::IODataElement *element, Color_t color,
+                          string curve_name) {
+  uint8_t r, g, b;
+  RGBFromColor(color, r, g, b);
+  AddCurve(element, r, g, b, curve_name);
 }
 
Index: trunk/lib/FlairCore/src/DataPlot1D.h
===================================================================
--- trunk/lib/FlairCore/src/DataPlot1D.h	(revision 14)
+++ trunk/lib/FlairCore/src/DataPlot1D.h	(revision 15)
@@ -17,66 +17,67 @@
 #include <stdint.h>
 
-namespace flair
-{
-namespace core
-{
-    class IODataElement;
+namespace flair {
+namespace core {
+class IODataElement;
 }
 
-namespace gui
-{
+namespace gui {
 
-    class LayoutPosition;
+class LayoutPosition;
 
-    /*! \class DataPlot1D
-    *
-    * \brief Class displaying a 1D plot on the ground station
-    *
-    */
-    class DataPlot1D: private DataPlot
-    {
-        public:
-            /*!
-            * \brief Constructor
-            *
-            * Construct a 1D plot at given position.
-            *
-            * \param position position to display the plot
-            * \param name name
-            * \param ymin default ymin of the plot
-            * \param ymax default ymax of the plot
-            */
-            DataPlot1D(const LayoutPosition* position,std::string name,float ymin,float ymax);
+/*! \class DataPlot1D
+*
+* \brief Class displaying a 1D plot on the ground station
+*
+*/
+class DataPlot1D : private DataPlot {
+public:
+  /*!
+  * \brief Constructor
+  *
+  * Construct a 1D plot at given position.
+  *
+  * \param position position to display the plot
+  * \param name name
+  * \param ymin default ymin of the plot
+  * \param ymax default ymax of the plot
+  */
+  DataPlot1D(const LayoutPosition *position, std::string name, float ymin,
+             float ymax);
 
-            /*!
-            * \brief Destructor
-            *
-            */
-            ~DataPlot1D();
+  /*!
+  * \brief Destructor
+  *
+  */
+  ~DataPlot1D();
 
-            /*!
-            * \brief Add a curve from an IODataElement to the plot.
-            *
-            * Curve's color can be selected by its name.
-            *
-            * \param element element to plot
-            * \param color color of the curve
-            * \param curve_name name of the curve for the legend, if unspecified, element->ObjectName() will be used
-            */
-            void AddCurve(const core::IODataElement* element,Color_t color,std::string curve_name="");
+  /*!
+  * \brief Add a curve from an IODataElement to the plot.
+  *
+  * Curve's color can be selected by its name.
+  *
+  * \param element element to plot
+  * \param color color of the curve
+  * \param curve_name name of the curve for the legend, if unspecified,
+  *element->ObjectName() will be used
+  */
+  void AddCurve(const core::IODataElement *element, Color_t color,
+                std::string curve_name = "");
 
-            /*!
-            * \brief Add a curve from an IODataElement to the plot.
-            *
-            * Curve's color can be selected by its RGB components.
-            *
-            * \param element element to plot
-            * \param r red component of the curve
-            * \param g green component of the curve
-            * \param b blue component of the curve
-            * \param curve_name name of the curve for the legend, if unspecified, element->ObjectName() will be used
-            */
-            void AddCurve(const core::IODataElement* element,uint8_t r=255,uint8_t g=0,uint8_t b=0,std::string curve_name="");
-    };
+  /*!
+  * \brief Add a curve from an IODataElement to the plot.
+  *
+  * Curve's color can be selected by its RGB components.
+  *
+  * \param element element to plot
+  * \param r red component of the curve
+  * \param g green component of the curve
+  * \param b blue component of the curve
+  * \param curve_name name of the curve for the legend, if unspecified,
+  *element->ObjectName() will be used
+  */
+  void AddCurve(const core::IODataElement *element, uint8_t r = 255,
+                uint8_t g = 0, uint8_t b = 0, std::string curve_name = "");
+};
 
 } // end namespace gui
Index: trunk/lib/FlairCore/src/DataPlot2D.cpp
===================================================================
--- trunk/lib/FlairCore/src/DataPlot2D.cpp	(revision 14)
+++ trunk/lib/FlairCore/src/DataPlot2D.cpp	(revision 15)
@@ -23,46 +23,58 @@
 using std::string;
 
-namespace flair { namespace gui {
+namespace flair {
+namespace gui {
 
-DataPlot2D::DataPlot2D(const LayoutPosition* position,string name,string x_name,float xmin,float xmax,string y_name,float ymin,float ymax):DataPlot(position,name,"DataPlot2D") {
-    SetVolatileXmlProp("xmin",xmin);
-    SetVolatileXmlProp("xmax",xmax);
-    SetVolatileXmlProp("ymin",ymin);
-    SetVolatileXmlProp("ymax",ymax);
-    SetVolatileXmlProp("x_name",x_name);
-    SetVolatileXmlProp("y_name",y_name);
-    SendXml();
+DataPlot2D::DataPlot2D(const LayoutPosition *position, string name,
+                       string x_name, float xmin, float xmax, string y_name,
+                       float ymin, float ymax)
+    : DataPlot(position, name, "DataPlot2D") {
+  SetVolatileXmlProp("xmin", xmin);
+  SetVolatileXmlProp("xmax", xmax);
+  SetVolatileXmlProp("ymin", ymin);
+  SetVolatileXmlProp("ymax", ymax);
+  SetVolatileXmlProp("x_name", x_name);
+  SetVolatileXmlProp("y_name", y_name);
+  SendXml();
 }
 
 DataPlot2D::~DataPlot2D() {}
 
-void DataPlot2D::AddCurve(const core::IODataElement* x_element,const core::IODataElement* y_element,Color_t color,string curve_name) {
-    uint8_t r,g,b;
-    RGBFromColor(color,r,g,b);
-    AddCurve(x_element,y_element,r,g,b,curve_name);
+void DataPlot2D::AddCurve(const core::IODataElement *x_element,
+                          const core::IODataElement *y_element, Color_t color,
+                          string curve_name) {
+  uint8_t r, g, b;
+  RGBFromColor(color, r, g, b);
+  AddCurve(x_element, y_element, r, g, b, curve_name);
 }
 
-void DataPlot2D::AddCurve(const core::IODataElement* x_element,const core::IODataElement* y_element,uint8_t r,uint8_t g,uint8_t b,string curve_name) {
-    if(typeid(x_element->GetDataType())!=typeid(y_element->GetDataType())) {
-        Err("x_element type is different from y_element type (%i-%i)\n",x_element->GetDataType().GetDescription().c_str(),y_element->GetDataType().GetDescription().c_str());
-        //gerer erreur
-        return;
-    }
+void DataPlot2D::AddCurve(const core::IODataElement *x_element,
+                          const core::IODataElement *y_element, uint8_t r,
+                          uint8_t g, uint8_t b, string curve_name) {
+  if (typeid(x_element->GetDataType()) != typeid(y_element->GetDataType())) {
+    Err("x_element type is different from y_element type (%i-%i)\n",
+        x_element->GetDataType().GetDescription().c_str(),
+        y_element->GetDataType().GetDescription().c_str());
+    // gerer erreur
+    return;
+  }
 
-    if(curve_name!="") {
-        SetVolatileXmlProp("curve",curve_name);
-    } else {
-        SetVolatileXmlProp("curve",x_element->Parent()->ObjectName() + "\\" +x_element->ObjectName()+ "\\" +y_element->ObjectName());
-    }
-    SetVolatileXmlProp("type",x_element->GetDataType().GetDescription());
-    SetVolatileXmlProp("r",r);
-    SetVolatileXmlProp("g",g);
-    SetVolatileXmlProp("b",b);
+  if (curve_name != "") {
+    SetVolatileXmlProp("curve", curve_name);
+  } else {
+    SetVolatileXmlProp("curve", x_element->Parent()->ObjectName() + "\\" +
+                                    x_element->ObjectName() + "\\" +
+                                    y_element->ObjectName());
+  }
+  SetVolatileXmlProp("type", x_element->GetDataType().GetDescription());
+  SetVolatileXmlProp("r", r);
+  SetVolatileXmlProp("g", g);
+  SetVolatileXmlProp("b", b);
 
-    SendXml();
+  SendXml();
 
-    //save data information
-    AddDataToSend(x_element);
-    AddDataToSend(y_element);
+  // save data information
+  AddDataToSend(x_element);
+  AddDataToSend(y_element);
 }
 
Index: trunk/lib/FlairCore/src/DataPlot2D.h
===================================================================
--- trunk/lib/FlairCore/src/DataPlot2D.h	(revision 14)
+++ trunk/lib/FlairCore/src/DataPlot2D.h	(revision 15)
@@ -17,74 +17,75 @@
 #include <stdint.h>
 
-namespace flair
-{
-    namespace core
-    {
-        class IODataElement;
-    }
+namespace flair {
+namespace core {
+class IODataElement;
 }
-namespace flair
-{
-namespace gui
-{
+}
+namespace flair {
+namespace gui {
 
-    class LayoutPosition;
+class LayoutPosition;
 
-    /*! \class DataPlot2D
-    *
-    * \brief Class displaying a 2D plot on the ground station
-    *
-    */
-    class DataPlot2D: private DataPlot
-    {
-        public:
-            /*!
-            * \brief Constructor
-            *
-            * Construct a 2D plot at given place position.
-            *
-            * \param position position to display the plot
-            * \param name name
-            * \param x_name name of x axis
-            * \param xmin default xmin of the plot
-            * \param xmax default xmax of the plot
-            * \param y_name name of y axis
-            * \param ymin default ymin of the plot
-            * \param ymax default ymax of the plot
-            */
-            DataPlot2D(const LayoutPosition* position,std::string name,std::string x_name,float xmin,float xmax,std::string y_name,float ymin,float ymax);
+/*! \class DataPlot2D
+*
+* \brief Class displaying a 2D plot on the ground station
+*
+*/
+class DataPlot2D : private DataPlot {
+public:
+  /*!
+  * \brief Constructor
+  *
+  * Construct a 2D plot at given place position.
+  *
+  * \param position position to display the plot
+  * \param name name
+  * \param x_name name of x axis
+  * \param xmin default xmin of the plot
+  * \param xmax default xmax of the plot
+  * \param y_name name of y axis
+  * \param ymin default ymin of the plot
+  * \param ymax default ymax of the plot
+  */
+  DataPlot2D(const LayoutPosition *position, std::string name,
+             std::string x_name, float xmin, float xmax, std::string y_name,
+             float ymin, float ymax);
 
-            /*!
-            * \brief Destructor
-            *
-            */
-            ~DataPlot2D();
+  /*!
+  * \brief Destructor
+  *
+  */
+  ~DataPlot2D();
 
-            /*!
-            * \brief Add a curve from elements to the plot.
-            *
-            * Curve's color can be selected by its name.
-            *
-            * \param x_element element to plot for x coordinate
-            * \param y_element element to plot for y coordinate
-            * \param color color of the curve
-            * \param curve_name name of the curve ofr the legend
-            */
-            void AddCurve(const core::IODataElement* x_element,const core::IODataElement* y_element,Color_t color,std::string curve_name="");
+  /*!
+  * \brief Add a curve from elements to the plot.
+  *
+  * Curve's color can be selected by its name.
+  *
+  * \param x_element element to plot for x coordinate
+  * \param y_element element to plot for y coordinate
+  * \param color color of the curve
+  * \param curve_name name of the curve ofr the legend
+  */
+  void AddCurve(const core::IODataElement *x_element,
+                const core::IODataElement *y_element, Color_t color,
+                std::string curve_name = "");
 
-            /*!
-            * \brief Add a curve from elements to the plot.
-            *
-            * Curve's color can be selected by its RGB components.
-            *
-            * \param x_element element to plot for x coordinate
-            * \param y_element element to plot for y coordinate
-            * \param r red component of the curve
-            * \param g green component of the curve
-            * \param b blue component of the curve
-            * \param curve_name name of the curve ofr the legend
-            */
-            void AddCurve(const core::IODataElement* x_element,const core::IODataElement* y_element,uint8_t r=255,uint8_t g=0,uint8_t b=0,std::string curve_name="");
-    };
+  /*!
+  * \brief Add a curve from elements to the plot.
+  *
+  * Curve's color can be selected by its RGB components.
+  *
+  * \param x_element element to plot for x coordinate
+  * \param y_element element to plot for y coordinate
+  * \param r red component of the curve
+  * \param g green component of the curve
+  * \param b blue component of the curve
+  * \param curve_name name of the curve ofr the legend
+  */
+  void AddCurve(const core::IODataElement *x_element,
+                const core::IODataElement *y_element, uint8_t r = 255,
+                uint8_t g = 0, uint8_t b = 0, std::string curve_name = "");
+};
 
 } // end namespace gui
Index: trunk/lib/FlairCore/src/DataPlot_impl.cpp
===================================================================
--- trunk/lib/FlairCore/src/DataPlot_impl.cpp	(revision 14)
+++ trunk/lib/FlairCore/src/DataPlot_impl.cpp	(revision 15)
@@ -18,9 +18,5 @@
 #include "DataPlot_impl.h"
 
-DataPlot_impl::DataPlot_impl()
-{
-}
+DataPlot_impl::DataPlot_impl() {}
 
-DataPlot_impl::~DataPlot_impl()
-{
-}
+DataPlot_impl::~DataPlot_impl() {}
Index: trunk/lib/FlairCore/src/DoubleSpinBox.cpp
===================================================================
--- trunk/lib/FlairCore/src/DoubleSpinBox.cpp	(revision 14)
+++ trunk/lib/FlairCore/src/DoubleSpinBox.cpp	(revision 15)
@@ -20,65 +20,67 @@
 using std::string;
 
-namespace flair
-{
-namespace gui
-{
+namespace flair {
+namespace gui {
 
-DoubleSpinBox::DoubleSpinBox(const LayoutPosition* position,string name,double min,double max,double step,int decimals,double default_value):Box(position,name,"DoubleSpinBox")
-{
-    //update value from xml file
-    if(default_value<min) default_value=min;
-    if(default_value>max) default_value=max;
-    box_value=default_value;
+DoubleSpinBox::DoubleSpinBox(const LayoutPosition *position, string name,
+                             double min, double max, double step, int decimals,
+                             double default_value)
+    : Box(position, name, "DoubleSpinBox") {
+  // update value from xml file
+  if (default_value < min)
+    default_value = min;
+  if (default_value > max)
+    default_value = max;
+  box_value = default_value;
 
-    SetVolatileXmlProp("min",min);
-    SetVolatileXmlProp("max",max);
-    SetVolatileXmlProp("step",step);
-    SetVolatileXmlProp("decimals",decimals);
-    GetPersistentXmlProp("value",box_value);
-    SetPersistentXmlProp("value",box_value);
+  SetVolatileXmlProp("min", min);
+  SetVolatileXmlProp("max", max);
+  SetVolatileXmlProp("step", step);
+  SetVolatileXmlProp("decimals", decimals);
+  GetPersistentXmlProp("value", box_value);
+  SetPersistentXmlProp("value", box_value);
 
-    SendXml();
+  SendXml();
 }
 
-DoubleSpinBox::DoubleSpinBox(const LayoutPosition* position,string name,string suffix,double min,double max,double step,int decimals,double default_value):Box(position,name,"DoubleSpinBox")
-{
-    //update value from xml file
-    if(default_value<min) default_value=min;
-    if(default_value>max) default_value=max;
-    box_value=default_value;
+DoubleSpinBox::DoubleSpinBox(const LayoutPosition *position, string name,
+                             string suffix, double min, double max, double step,
+                             int decimals, double default_value)
+    : Box(position, name, "DoubleSpinBox") {
+  // update value from xml file
+  if (default_value < min)
+    default_value = min;
+  if (default_value > max)
+    default_value = max;
+  box_value = default_value;
 
-    SetVolatileXmlProp("suffix",suffix);
-    SetVolatileXmlProp("min",min);
-    SetVolatileXmlProp("max",max);
-    SetVolatileXmlProp("step",step);
-    SetVolatileXmlProp("decimals",decimals);
-    GetPersistentXmlProp("value",box_value);
-    SetPersistentXmlProp("value",box_value);
+  SetVolatileXmlProp("suffix", suffix);
+  SetVolatileXmlProp("min", min);
+  SetVolatileXmlProp("max", max);
+  SetVolatileXmlProp("step", step);
+  SetVolatileXmlProp("decimals", decimals);
+  GetPersistentXmlProp("value", box_value);
+  SetPersistentXmlProp("value", box_value);
 
-    SendXml();
+  SendXml();
 }
 
-DoubleSpinBox::~DoubleSpinBox()
-{
+DoubleSpinBox::~DoubleSpinBox() {}
 
+double DoubleSpinBox::Value(void) const {
+  double tmp;
+
+  GetMutex();
+  tmp = box_value;
+  ReleaseMutex();
+
+  return tmp;
 }
 
-double DoubleSpinBox::Value(void) const
-{
-    double tmp;
-
-    GetMutex();
-    tmp=box_value;
-    ReleaseMutex();
-
-    return tmp;
-}
-
-void DoubleSpinBox::XmlEvent(void)
-{
-    GetMutex();
-    if(GetPersistentXmlProp("value",box_value)) SetValueChanged();
-    ReleaseMutex();
+void DoubleSpinBox::XmlEvent(void) {
+  GetMutex();
+  if (GetPersistentXmlProp("value", box_value))
+    SetValueChanged();
+  ReleaseMutex();
 }
 
Index: trunk/lib/FlairCore/src/DoubleSpinBox.h
===================================================================
--- trunk/lib/FlairCore/src/DoubleSpinBox.h	(revision 14)
+++ trunk/lib/FlairCore/src/DoubleSpinBox.h	(revision 15)
@@ -16,76 +16,77 @@
 #include <Box.h>
 
-namespace flair
-{
-namespace gui
-{
+namespace flair {
+namespace gui {
 
-    class Layout;
+class Layout;
 
-    /*! \class DoubleSpinBox
-    *
-    * \brief Class displaying a QDoubleSpinBox on the ground station
-    *
-    */
-    class DoubleSpinBox: public Box
-    {
-        public:
-            /*!
-            * \brief Constructor
-            *
-            * Construct a QDoubleSpinBox at given position. \n
-            * The QDoubleSpinBox is saturated to min and max values.
-            *
-            * \param position position to display the QDoubleSpinBox
-            * \param name name
-            * \param min minimum value
-            * \param max maximum value
-            * \param step step
-            * \param decimals number of decimals
-            * \param default_value default value if not in the xml config file
-            */
-            DoubleSpinBox(const LayoutPosition* position,std::string name,double min,double max,double step,int decimals=2,double default_value=0);
+/*! \class DoubleSpinBox
+*
+* \brief Class displaying a QDoubleSpinBox on the ground station
+*
+*/
+class DoubleSpinBox : public Box {
+public:
+  /*!
+  * \brief Constructor
+  *
+  * Construct a QDoubleSpinBox at given position. \n
+  * The QDoubleSpinBox is saturated to min and max values.
+  *
+  * \param position position to display the QDoubleSpinBox
+  * \param name name
+  * \param min minimum value
+  * \param max maximum value
+  * \param step step
+  * \param decimals number of decimals
+  * \param default_value default value if not in the xml config file
+  */
+  DoubleSpinBox(const LayoutPosition *position, std::string name, double min,
+                double max, double step, int decimals = 2,
+                double default_value = 0);
 
-            /*!
-            * \brief Constructor
-            *
-            * Construct a QDoubleSpinBox at given position. \n
-            * The QDoubleSpinBox is saturated to min and max values.
-            *
-            * \param position position to display the QDoubleSpinBox
-            * \param name name
-            * \param suffix suffix for the value (eg unit)
-            * \param min minimum value
-            * \param max maximum value
-            * \param step step
-            * \param decimals number of decimals
-            * \param default_value default value if not in the xml config file
-            */
-            DoubleSpinBox(const LayoutPosition* position,std::string name,std::string suffix,double min,double max,double step,int decimals=2,double default_value=0);
+  /*!
+  * \brief Constructor
+  *
+  * Construct a QDoubleSpinBox at given position. \n
+  * The QDoubleSpinBox is saturated to min and max values.
+  *
+  * \param position position to display the QDoubleSpinBox
+  * \param name name
+  * \param suffix suffix for the value (eg unit)
+  * \param min minimum value
+  * \param max maximum value
+  * \param step step
+  * \param decimals number of decimals
+  * \param default_value default value if not in the xml config file
+  */
+  DoubleSpinBox(const LayoutPosition *position, std::string name,
+                std::string suffix, double min, double max, double step,
+                int decimals = 2, double default_value = 0);
 
-            /*!
-            * \brief Destructor
-            *
-            */
-            ~DoubleSpinBox();
+  /*!
+  * \brief Destructor
+  *
+  */
+  ~DoubleSpinBox();
 
-            /*!
-            * \brief Value
-            *
-            * \return value
-            */
-            double Value(void) const;
+  /*!
+  * \brief Value
+  *
+  * \return value
+  */
+  double Value(void) const;
 
-        private:
-            /*!
-            * \brief XmlEvent from ground station
-            *
-            * Reimplemented from Widget.
-            *
-            */
-            void XmlEvent(void);
+private:
+  /*!
+  * \brief XmlEvent from ground station
+  *
+  * Reimplemented from Widget.
+  *
+  */
+  void XmlEvent(void);
 
-            double box_value;
-    };
+  double box_value;
+};
 
 } // end namespace gui
Index: trunk/lib/FlairCore/src/Euler.cpp
===================================================================
--- trunk/lib/FlairCore/src/Euler.cpp	(revision 14)
+++ trunk/lib/FlairCore/src/Euler.cpp	(revision 15)
@@ -23,21 +23,17 @@
 #define PI_D ((double)3.14159265358979323846)
 
-namespace flair
-{
-namespace core
-{
+namespace flair {
+namespace core {
 
-Euler::Euler(float inRoll,float inPitch,float inYaw): roll(inRoll), pitch(inPitch),yaw(inYaw) {
-}
+Euler::Euler(float inRoll, float inPitch, float inYaw)
+    : roll(inRoll), pitch(inPitch), yaw(inYaw) {}
 
-Euler::~Euler() {
+Euler::~Euler() {}
 
-}
-
-Euler& Euler::operator=(const Euler &euler) {
-    roll=euler.roll;
-    pitch=euler.pitch;
-    yaw=euler.yaw;
-    return (*this);
+Euler &Euler::operator=(const Euler &euler) {
+  roll = euler.roll;
+  pitch = euler.pitch;
+  yaw = euler.yaw;
+  return (*this);
 }
 /*
@@ -85,44 +81,41 @@
 */
 void Euler::ToQuaternion(Quaternion &quaternion) const {
-    quaternion.q0=cos(yaw/2)*cos(pitch/2)*cos(roll/2)
-        +sin(yaw/2)*sin(pitch/2)*sin(roll/2);
+  quaternion.q0 = cos(yaw / 2) * cos(pitch / 2) * cos(roll / 2) +
+                  sin(yaw / 2) * sin(pitch / 2) * sin(roll / 2);
 
-    quaternion.q1=cos(yaw/2)*cos(pitch/2)*sin(roll/2)
-        -sin(yaw/2)*sin(pitch/2)*cos(roll/2);
+  quaternion.q1 = cos(yaw / 2) * cos(pitch / 2) * sin(roll / 2) -
+                  sin(yaw / 2) * sin(pitch / 2) * cos(roll / 2);
 
-    quaternion.q2=cos(yaw/2)*sin(pitch/2)*cos(roll/2)
-        +sin(yaw/2)*cos(pitch/2)*sin(roll/2);
+  quaternion.q2 = cos(yaw / 2) * sin(pitch / 2) * cos(roll / 2) +
+                  sin(yaw / 2) * cos(pitch / 2) * sin(roll / 2);
 
-    quaternion.q3=sin(yaw/2)*cos(pitch/2)*cos(roll/2)
-        -cos(yaw/2)*sin(pitch/2)*sin(roll/2);
+  quaternion.q3 = sin(yaw / 2) * cos(pitch / 2) * cos(roll / 2) -
+                  cos(yaw / 2) * sin(pitch / 2) * sin(roll / 2);
 }
 
 Quaternion Euler::ToQuaternion(void) const {
-    Quaternion quaternion;
-    ToQuaternion(quaternion);
-    return quaternion;
+  Quaternion quaternion;
+  ToQuaternion(quaternion);
+  return quaternion;
 }
 
-float Euler::ToDegree(float radianValue) {
-    return radianValue*180.0f/PI;
-}
+float Euler::ToDegree(float radianValue) { return radianValue * 180.0f / PI; }
 
-float Euler::ToRadian(float degreeValue) {
-    return degreeValue/180.0f*PI;
-}
+float Euler::ToRadian(float degreeValue) { return degreeValue / 180.0f * PI; }
 
 float Euler::YawDistanceFrom(float angle) const {
-    float rot1,rot2;
-    if(angle > yaw ) {
-        rot1=angle-yaw;
-        rot2=2*PI-angle+yaw;
-    } else {
-        rot1=2*PI+angle-yaw;
-        rot2=yaw-angle;
-    }
-    if(rot2<rot1) rot1=-rot2;
-    rot1=-rot1;//pour avoir rot1=yaw-angle
+  float rot1, rot2;
+  if (angle > yaw) {
+    rot1 = angle - yaw;
+    rot2 = 2 * PI - angle + yaw;
+  } else {
+    rot1 = 2 * PI + angle - yaw;
+    rot2 = yaw - angle;
+  }
+  if (rot2 < rot1)
+    rot1 = -rot2;
+  rot1 = -rot1; // pour avoir rot1=yaw-angle
 
-    return rot1;
+  return rot1;
 }
 
Index: trunk/lib/FlairCore/src/Euler.h
===================================================================
--- trunk/lib/FlairCore/src/Euler.h	(revision 14)
+++ trunk/lib/FlairCore/src/Euler.h	(revision 15)
@@ -14,136 +14,136 @@
 #define EULER_H
 
-namespace flair { namespace core {
-    class Quaternion;
+namespace flair {
+namespace core {
+class Quaternion;
 
-    /*! \class Euler
-    *
-    * \brief Class defining euler angles
-    *
-    * Euler angles are expressed in radians.
-    *
-    */
-    class Euler {
-        public:
-            /*!
-            * \brief Constructor
-            *
-            * Construct euler angles using specified values.
-            *
-            * \param roll roll value
-            * \param pitch pitch value
-            * \param yaw yaw value
-            */
-            Euler(float roll=0,float pitch=0,float yaw=0);
+/*! \class Euler
+*
+* \brief Class defining euler angles
+*
+* Euler angles are expressed in radians.
+*
+*/
+class Euler {
+public:
+  /*!
+  * \brief Constructor
+  *
+  * Construct euler angles using specified values.
+  *
+  * \param roll roll value
+  * \param pitch pitch value
+  * \param yaw yaw value
+  */
+  Euler(float roll = 0, float pitch = 0, float yaw = 0);
 
-            /*!
-            * \brief Destructor
-            *
-            */
-            ~Euler();
+  /*!
+  * \brief Destructor
+  *
+  */
+  ~Euler();
 
-            /*!
-            * \brief x axis rotation
-            *
-            * \param value rotation value in radians
-            */
-            //todo: passer par un quaternion
-            //void RotateX(float value);
+  /*!
+  * \brief x axis rotation
+  *
+  * \param value rotation value in radians
+  */
+  // todo: passer par un quaternion
+  // void RotateX(float value);
 
-            /*!
-            * \brief x axis rotation
-            *
-            * \param value rotation value in degrees
-            */
-            //void RotateXDeg(float value);
+  /*!
+  * \brief x axis rotation
+  *
+  * \param value rotation value in degrees
+  */
+  // void RotateXDeg(float value);
 
-            /*!
-            * \brief y axis rotation
-            *
-            * \param value rotation value in radians
-            */
-            //void RotateY(float value);
+  /*!
+  * \brief y axis rotation
+  *
+  * \param value rotation value in radians
+  */
+  // void RotateY(float value);
 
-            /*!
-            * \brief y axis rotation
-            *
-            * \param value rotation value in degrees
-            */
-            //void RotateYDeg(float value);
+  /*!
+  * \brief y axis rotation
+  *
+  * \param value rotation value in degrees
+  */
+  // void RotateYDeg(float value);
 
-            /*!
-            * \brief z axis rotation
-            *
-            * \param value rotation value in radians
-            */
-            //void RotateZ(float value);
+  /*!
+  * \brief z axis rotation
+  *
+  * \param value rotation value in radians
+  */
+  // void RotateZ(float value);
 
-            /*!
-            * \brief z axis rotation
-            *
-            * \param value rotation value in degrees
-            */
-            //void RotateZDeg(float value);
+  /*!
+  * \brief z axis rotation
+  *
+  * \param value rotation value in degrees
+  */
+  // void RotateZDeg(float value);
 
-            /*!
-            * \brief Convert to quaternion
-            *
-            * \param quaternion output quaternion
-            */
-            void ToQuaternion(Quaternion &quaternion) const;
+  /*!
+  * \brief Convert to quaternion
+  *
+  * \param quaternion output quaternion
+  */
+  void ToQuaternion(Quaternion &quaternion) const;
 
-            /*!
-            * \brief Convert to quaternion
-            *
-            * \return quaternion
-            */
-            Quaternion ToQuaternion(void) const;
-            /*!
-            * \brief Convert from radian to degree
-            *
-            * \param radianValue value in radian
-            *
-            * \return value in degree
-            */
-            static float ToDegree(float radianValue);
+  /*!
+  * \brief Convert to quaternion
+  *
+  * \return quaternion
+  */
+  Quaternion ToQuaternion(void) const;
+  /*!
+  * \brief Convert from radian to degree
+  *
+  * \param radianValue value in radian
+  *
+  * \return value in degree
+  */
+  static float ToDegree(float radianValue);
 
-            /*!
-            * \brief Convert from degree to radian
-            *
-            * \param degreeValue value in degree
-            *
-            * \return value in radian
-            */
-            static float ToRadian(float degreeValue);
+  /*!
+  * \brief Convert from degree to radian
+  *
+  * \param degreeValue value in degree
+  *
+  * \return value in radian
+  */
+  static float ToRadian(float degreeValue);
 
-            /*!
-            * \brief Compute yaw distance
-            *
-            * Compute yaw distance from given angle. This is the minimum distance.
-            *
-            * \param angle starting angle
-            *
-            * \return value distance in radian
-            */
-            float YawDistanceFrom(float angle) const;
+  /*!
+  * \brief Compute yaw distance
+  *
+  * Compute yaw distance from given angle. This is the minimum distance.
+  *
+  * \param angle starting angle
+  *
+  * \return value distance in radian
+  */
+  float YawDistanceFrom(float angle) const;
 
-            /*!
-            * \brief roll value
-            */
-            float roll;
+  /*!
+  * \brief roll value
+  */
+  float roll;
 
-            /*!
-            * \brief pitch value
-            */
-            float pitch;
+  /*!
+  * \brief pitch value
+  */
+  float pitch;
 
-            /*!
-            * \brief yaw value
-            */
-            float yaw;
+  /*!
+  * \brief yaw value
+  */
+  float yaw;
 
-            Euler& operator=(const Euler &euler);
-
-    };
+  Euler &operator=(const Euler &euler);
+};
 
 } // end namespace core
Index: trunk/lib/FlairCore/src/FrameworkManager.cpp
===================================================================
--- trunk/lib/FlairCore/src/FrameworkManager.cpp	(revision 14)
+++ trunk/lib/FlairCore/src/FrameworkManager.cpp	(revision 15)
@@ -26,161 +26,161 @@
 using namespace flair::gui;
 
-namespace
-{
-    flair::core::FrameworkManager* frameworkmanager=NULL;
+namespace {
+flair::core::FrameworkManager *frameworkmanager = NULL;
 }
 
+namespace flair {
+namespace core {
 
-namespace flair
-{
-namespace core
-{
+FrameworkManager *getFrameworkManager(void) { return frameworkmanager; }
 
+bool IsBigEndian(void) {
+  union {
+    uint32_t i;
+    char c[4];
+  } bint = {0x01020304};
 
-FrameworkManager* getFrameworkManager(void) {
-    return frameworkmanager;
+  if (bint.c[0] == 1) {
+    return true;
+  } else {
+    return false;
+  }
 }
 
-bool IsBigEndian(void) {
-    union {
-        uint32_t i;
-        char c[4];
-    } bint = {0x01020304};
+FrameworkManager::FrameworkManager(string name)
+    : Object(NULL, name, XML_ROOT_TYPE) {
+  if (frameworkmanager != NULL) {
+    Err("FrameworkManager should be instanced only one time\n");
+    return;
+  }
 
-    if(bint.c[0] == 1) {
-        return true;
-    } else {
-        return false;
-    }
-}
-
-FrameworkManager::FrameworkManager(string name): Object(NULL,name,XML_ROOT_TYPE)
-{
-    if(frameworkmanager!=NULL) {
-        Err("FrameworkManager should be instanced only one time\n");
-        return;
-    }
-
-    Printf(SVN_REV);
-    frameworkmanager=this;
-    pimpl_=new FrameworkManager_impl(this,name);
+  Printf(SVN_REV);
+  frameworkmanager = this;
+  pimpl_ = new FrameworkManager_impl(this, name);
 }
 
 FrameworkManager::~FrameworkManager() {
-    //Printf("destruction FrameworkManager\n");
+  // Printf("destruction FrameworkManager\n");
 
-    //stop ui_com thread (which sends datas for graphs), we do not need it as graphs will be destroyed
-    if(getUiCom()!=NULL) {
-        getUiCom()->SafeStop();
-        getUiCom()->Join();
+  // stop ui_com thread (which sends datas for graphs), we do not need it as
+  // graphs will be destroyed
+  if (getUiCom() != NULL) {
+    getUiCom()->SafeStop();
+    getUiCom()->Join();
+  }
+
+  // we start by deleting threads (except pimpl which must be deleted at last)
+  // (before deleting objects that could be used by the threads)
+  // Printf("delete Threads\n");
+  for (vector<const Object *>::iterator it = Childs()->begin();
+       it < Childs()->end(); it++) {
+    // Printf("child %i %s
+    // %s\n",Childs()->size(),(*it)->ObjectName().c_str(),(*it)->ObjectType().c_str());
+    if ((*it)->ObjectType() == "Thread") {
+      if (*it != pimpl_) {
+        // Printf("del\n");
+        delete (Thread *)(*it);
+        // Childs() vector has been modified, we start from beginning again
+        // it will be incremented by the loop, so in fact we start again at
+        // begin()+1
+        // it is not a problem since begin is pimpl
+        it = Childs()->begin();
+        // Printf("del ok\n");
+      }
     }
+  }
 
-    //we start by deleting threads (except pimpl which must be deleted at last)
-    // (before deleting objects that could be used by the threads)
-    //Printf("delete Threads\n");
-    for(vector<const Object*>::iterator it=Childs()->begin() ; it < Childs()->end(); it++ ) {
-        //Printf("child %i %s %s\n",Childs()->size(),(*it)->ObjectName().c_str(),(*it)->ObjectType().c_str());
-        if((*it)->ObjectType()=="Thread") {
-            if(*it!=pimpl_) {
-                //Printf("del\n");
-                delete (Thread*)(*it);
-                //Childs() vector has been modified, we start from beginning again
-                //it will be incremented by the loop, so in fact we start again at begin()+1
-                //it is not a problem since begin is pimpl
-                it=Childs()->begin();
-                //Printf("del ok\n");
-            }
-        }
+  // next we delete IODevice
+  // (before deleting objects that could be used by the IODevice)
+  // Printf("delete IODevices\n");
+  for (vector<const Object *>::iterator it = Childs()->begin();
+       it < Childs()->end(); it++) {
+    // Printf("child %i %s
+    // %s\n",Childs()->size(),(*it)->ObjectName().c_str(),(*it)->ObjectType().c_str());
+    if ((*it)->ObjectType() == "IODevice") {
+      // Printf("del\n");
+      delete (IODevice *)*it;
+      // Printf("del ok\n");
+      // Childs() vector has been modified, we start from beginning again
+      // it will be incremented by the loop, so in fact we start again at
+      // begin()+1
+      // it is not a problem since begin is pimpl (not an IODevice)
+      it = Childs()->begin();
+      // Printf("del ok\n");
     }
+  }
 
-    //next we delete IODevice
-    // (before deleting objects that could be used by the IODevice)
-    //Printf("delete IODevices\n");
-    for(vector<const Object*>::iterator it=Childs()->begin() ; it < Childs()->end(); it++ ) {
-        //Printf("child %i %s %s\n",Childs()->size(),(*it)->ObjectName().c_str(),(*it)->ObjectType().c_str());
-        if((*it)->ObjectType()=="IODevice") {
-            //Printf("del\n");
-            delete (IODevice*)*it;
-            //Printf("del ok\n");
-            //Childs() vector has been modified, we start from beginning again
-            //it will be incremented by the loop, so in fact we start again at begin()+1
-            //it is not a problem since begin is pimpl (not an IODevice)
-            it=Childs()->begin();
-            //Printf("del ok\n");
-        }
-    }
+  // Printf("delete childs\n");
+  // on efface les enfants en commencant par la fin
+  // le ui_com puis FrameworkManager_impl est détruit en dernier
+  // permet de garder l'uicom pour notifer des destructions
+  while (Childs()->size() != 0) {
+    // Printf("child %i %s
+    // %s\n",Childs()->size(),Childs()->back()->ObjectName().c_str(),Childs()->back()->ObjectType().c_str());
+    if (Childs()->back() != NULL)
+      delete Childs()->back();
+  }
 
-//Printf("delete childs\n");
-    //on efface les enfants en commencant par la fin
-    //le ui_com puis FrameworkManager_impl est détruit en dernier
-    //permet de garder l'uicom pour notifer des destructions
-    while(Childs()->size()!=0) {
-        //Printf("child %i %s %s\n",Childs()->size(),Childs()->back()->ObjectName().c_str(),Childs()->back()->ObjectType().c_str());
-        if(Childs()->back()!=NULL) delete Childs()->back();
-    }
+  // childs.clear();
 
-    //childs.clear();
-
-//Printf("destruction FrameworkManager ok\n");
+  // Printf("destruction FrameworkManager ok\n");
 }
 
-void FrameworkManager::SetupConnection(string address,uint16_t port,size_t rcv_buf_size) {
-    pimpl_->SetupConnection(address,port,rcv_buf_size);
+void FrameworkManager::SetupConnection(string address, uint16_t port,
+                                       size_t rcv_buf_size) {
+  pimpl_->SetupConnection(address, port, rcv_buf_size);
 }
 
 void FrameworkManager::SetupUserInterface(string xml_file) {
-    pimpl_->SetupUserInterface(xml_file);
+  pimpl_->SetupUserInterface(xml_file);
 }
 
-gui::TabWidget* FrameworkManager::GetTabWidget(void) const {
-    return pimpl_->tabwidget;
+gui::TabWidget *FrameworkManager::GetTabWidget(void) const {
+  return pimpl_->tabwidget;
 }
 
 void FrameworkManager::UpdateSendData(const SendData *obj) {
-    if(getUiCom()!=NULL) getUiCom()->UpdateSendData(obj);
+  if (getUiCom() != NULL)
+    getUiCom()->UpdateSendData(obj);
 }
 
 void FrameworkManager::BlockCom(void) {
-    if(getUiCom()!=NULL) getUiCom()->Block();
+  if (getUiCom() != NULL)
+    getUiCom()->Block();
 }
 
 void FrameworkManager::UnBlockCom(void) {
-    if(getUiCom()!=NULL) getUiCom()->UnBlock();
+  if (getUiCom() != NULL)
+    getUiCom()->UnBlock();
 }
 
 bool FrameworkManager::ConnectionLost(void) const {
-    if(getUiCom()!=NULL) {
-        return (getUiCom()->ConnectionLost()| pimpl_->connection_lost);
-    } else {
-        return false;
-    }
+  if (getUiCom() != NULL) {
+    return (getUiCom()->ConnectionLost() | pimpl_->connection_lost);
+  } else {
+    return false;
+  }
 }
 
 void FrameworkManager::SetupLogger(string log_path) {
-    pimpl_->SetupLogger(log_path);
+  pimpl_->SetupLogger(log_path);
 }
 
 void FrameworkManager::AddDeviceToLog(IODevice *device) {
-    pimpl_->AddDeviceToLog(device);
+  pimpl_->AddDeviceToLog(device);
 }
 
-void FrameworkManager::StartLog(void) {
-    pimpl_->StartLog();
-}
+void FrameworkManager::StartLog(void) { pimpl_->StartLog(); }
 
-void FrameworkManager::StopLog(void) {
-    pimpl_->StopLog();
-}
+void FrameworkManager::StopLog(void) { pimpl_->StopLog(); }
 
-bool FrameworkManager::IsLogging(void) const {
-    return pimpl_->is_logging;
-}
+bool FrameworkManager::IsLogging(void) const { return pimpl_->is_logging; }
 
 void FrameworkManager::DisableErrorsDisplay(bool value) {
-    pimpl_->disable_errors=value;
+  pimpl_->disable_errors = value;
 }
 
 bool FrameworkManager::IsDisplayingErrors(void) const {
-    return !(pimpl_->disable_errors);
+  return !(pimpl_->disable_errors);
 }
 
Index: trunk/lib/FlairCore/src/FrameworkManager.h
===================================================================
--- trunk/lib/FlairCore/src/FrameworkManager.h	(revision 14)
+++ trunk/lib/FlairCore/src/FrameworkManager.h	(revision 15)
@@ -18,202 +18,209 @@
 class FrameworkManager_impl;
 
-namespace flair
-{
-    namespace gui
-    {
-        class TabWidget;
-        class SendData;
-    }
+namespace flair {
+namespace gui {
+class TabWidget;
+class SendData;
 }
-namespace flair
-{
-namespace core
-{
-    class IODevice;
-
-    /*! \class FrameworkManager
-    *
-    * \brief Main class of the Framework library
-    *
-    * This is the main class of the library. Only one instance of this class is allowed
-    * by program. Morevoer, its name must be unique if more than one program using this class
-    * is running on the same system (a control and a simlator for example). \n
-    * This class allows: \n
-    * -connexion with ground station, \n
-    * -creation of a QTabWidget on ground station, \n
-    * -handling of xml files, used for default values of Widgets, \n
-    * -logging of datas.
-    */
-    class FrameworkManager: public Object
-    {
-        public:
-            /*!
-            * \brief Constructor
-            *
-            * Construct a FrameworkManager. \n
-            * Call SetupConnection method just after this constructor to setup the conection with a ground station.
-            *
-            * \param name name, must be unique
-            */
-            FrameworkManager(std::string name);
-
-            /*!
-            * \brief Destructor
-            *
-            * Calling it will automatically destruct all childs. \n
-            * Destruction implies destruction of the QTabWidget on ground station.
-            *
-            */
-            ~FrameworkManager();
-
-            /*!
-            * \brief Setup the connection with ground station
-            *
-            * Call this method just after the constructor of this class. If this method is not called, the program will run headless.
-            *
-            * \param address address of ground station
-            * \param port port of ground station
-            * \param rcv_buf_size receive buffer size
-            */
-            void SetupConnection(std::string address,uint16_t port,size_t rcv_buf_size=10000);
-
-            /*!
-            * \brief Setup the user interface
-            *
-            * If this method is called after SetupConnection, Widgets will be displayed in the ground station.
-            * Otherwise, it will run headless, but default values of Widgets will be taken from the xml file.
-            *
-            * \param xml_file xml file for default values of Widgets
-            */
-            void SetupUserInterface(std::string xml_file);
-
-            /*!
-            * \brief Get TabWidget
-            *
-            * \return TabWidget
-            */
-            gui::TabWidget* GetTabWidget(void) const;
-
-            /*!
-            * \brief Logger setup
-            *
-            * Setup path of log files. \n
-            * No logging will be performed if this method is not called. \n
-            *
-            * \param log_path path to store logs
-            */
-            void SetupLogger(std::string log_path);
-
-            /*!
-            * \brief Add log element
-            *
-            * The added element will be automatically logged once
-            * logging started (see StartLog()). \n
-            * This element must define on its side the io_data
-            * to log, trough IODevice::SetDataToLog method.
-            *
-            * \param device IODevice to add
-            */
-            void AddDeviceToLog(IODevice *device);
-
-            /*!
-            * \brief Start logging
-            *
-            * All IODevice added through AddDeviceToLog() method
-            * will automatically be logged. \n
-            * SetupLogger() must have been called before.
-            */
-            void StartLog(void);
-
-            /*!
-            * \brief Stop logging
-            *
-            * Logs will automatically be sent to ground station.
-            */
-            void StopLog(void);
-
-            /*!
-            * \brief Is logging?
-            *
-            * \return true if is logging
-            */
-            bool IsLogging(void) const;
-
-            /*!
-            * \brief Notify that SendData's period has changed
-            *
-            * This funtion must be called when the period has changed. \n
-            * Normally, it occurs in the Widget::XmlEvent method. \n
-            * This method must be called with communication blocked (see BlockCom()).
-            *
-            * \param obj SendData which changed
-            */
-            void UpdateSendData(const gui::SendData *obj);
-
-            /*!
-            * \brief Block communication
-            *
-            * This funtion blocks the communication beetween the program and ground station. \n
-            * It must be called before changing datas or parameters exchanged between the program
-            * and the ground station.
-            *
-            */
-            void BlockCom(void);
-
-             /*!
-            * \brief Unblock communication
-            *
-            * This funtion unblocks the communication beetween the program and ground station. \n
-            * It must be called after changing datas or parameters exchanged between the program
-            * and the ground station.
-            *
-            */
-            void UnBlockCom(void);
-
-            /*!
-            * \brief Is connection lost?
-            *
-            * Once this method returns true, it will never return false back. \n
-            * Note that this method return false if no connection is defined (see SetupConnection).
-            *
-            * \return true if connection with ground station is lost
-            */
-            bool ConnectionLost(void) const;
-
-            /*!
-            * \brief Disable errors display
-            *
-            * Disable errors display, if you do not want to saturate console for exemple.
-            * By defaults errors disply is enabled.
-            *
-            * \param value true to disable errors display
-            */
-            void DisableErrorsDisplay(bool value);
-
-            /*!
-            * \brief Is displaying errors?
-            *
-            *
-            * \return true if errors display is enabled
-            */
-            bool IsDisplayingErrors(void) const;
-
-        private:
-            class FrameworkManager_impl* pimpl_;
-    };
-
-    /*!
-    * \brief get FrameworkManager
-    *
-    * \return the FrameworkManager
-    */
-    FrameworkManager* getFrameworkManager(void);
-
-    /*!
-    * \brief is big endian?
-    *
-    * \return true if big endian, false if little endian
-    */
-    bool IsBigEndian(void);
+}
+namespace flair {
+namespace core {
+class IODevice;
+
+/*! \class FrameworkManager
+*
+* \brief Main class of the Framework library
+*
+* This is the main class of the library. Only one instance of this class is
+*allowed
+* by program. Morevoer, its name must be unique if more than one program using
+*this class
+* is running on the same system (a control and a simlator for example). \n
+* This class allows: \n
+* -connexion with ground station, \n
+* -creation of a QTabWidget on ground station, \n
+* -handling of xml files, used for default values of Widgets, \n
+* -logging of datas.
+*/
+class FrameworkManager : public Object {
+public:
+  /*!
+  * \brief Constructor
+  *
+  * Construct a FrameworkManager. \n
+  * Call SetupConnection method just after this constructor to setup the
+  *conection with a ground station.
+  *
+  * \param name name, must be unique
+  */
+  FrameworkManager(std::string name);
+
+  /*!
+  * \brief Destructor
+  *
+  * Calling it will automatically destruct all childs. \n
+  * Destruction implies destruction of the QTabWidget on ground station.
+  *
+  */
+  ~FrameworkManager();
+
+  /*!
+  * \brief Setup the connection with ground station
+  *
+  * Call this method just after the constructor of this class. If this method is
+  *not called, the program will run headless.
+  *
+  * \param address address of ground station
+  * \param port port of ground station
+  * \param rcv_buf_size receive buffer size
+  */
+  void SetupConnection(std::string address, uint16_t port,
+                       size_t rcv_buf_size = 10000);
+
+  /*!
+  * \brief Setup the user interface
+  *
+  * If this method is called after SetupConnection, Widgets will be displayed in
+  *the ground station.
+  * Otherwise, it will run headless, but default values of Widgets will be taken
+  *from the xml file.
+  *
+  * \param xml_file xml file for default values of Widgets
+  */
+  void SetupUserInterface(std::string xml_file);
+
+  /*!
+  * \brief Get TabWidget
+  *
+  * \return TabWidget
+  */
+  gui::TabWidget *GetTabWidget(void) const;
+
+  /*!
+  * \brief Logger setup
+  *
+  * Setup path of log files. \n
+  * No logging will be performed if this method is not called. \n
+  *
+  * \param log_path path to store logs
+  */
+  void SetupLogger(std::string log_path);
+
+  /*!
+  * \brief Add log element
+  *
+  * The added element will be automatically logged once
+  * logging started (see StartLog()). \n
+  * This element must define on its side the io_data
+  * to log, trough IODevice::SetDataToLog method.
+  *
+  * \param device IODevice to add
+  */
+  void AddDeviceToLog(IODevice *device);
+
+  /*!
+  * \brief Start logging
+  *
+  * All IODevice added through AddDeviceToLog() method
+  * will automatically be logged. \n
+  * SetupLogger() must have been called before.
+  */
+  void StartLog(void);
+
+  /*!
+  * \brief Stop logging
+  *
+  * Logs will automatically be sent to ground station.
+  */
+  void StopLog(void);
+
+  /*!
+  * \brief Is logging?
+  *
+  * \return true if is logging
+  */
+  bool IsLogging(void) const;
+
+  /*!
+  * \brief Notify that SendData's period has changed
+  *
+  * This funtion must be called when the period has changed. \n
+  * Normally, it occurs in the Widget::XmlEvent method. \n
+  * This method must be called with communication blocked (see BlockCom()).
+  *
+  * \param obj SendData which changed
+  */
+  void UpdateSendData(const gui::SendData *obj);
+
+  /*!
+  * \brief Block communication
+  *
+  * This funtion blocks the communication beetween the program and ground
+  *station. \n
+  * It must be called before changing datas or parameters exchanged between the
+  *program
+  * and the ground station.
+  *
+  */
+  void BlockCom(void);
+
+  /*!
+ * \brief Unblock communication
+ *
+ * This funtion unblocks the communication beetween the program and ground
+ *station. \n
+ * It must be called after changing datas or parameters exchanged between the
+ *program
+ * and the ground station.
+ *
+ */
+  void UnBlockCom(void);
+
+  /*!
+  * \brief Is connection lost?
+  *
+  * Once this method returns true, it will never return false back. \n
+  * Note that this method return false if no connection is defined (see
+  *SetupConnection).
+  *
+  * \return true if connection with ground station is lost
+  */
+  bool ConnectionLost(void) const;
+
+  /*!
+  * \brief Disable errors display
+  *
+  * Disable errors display, if you do not want to saturate console for exemple.
+  * By defaults errors disply is enabled.
+  *
+  * \param value true to disable errors display
+  */
+  void DisableErrorsDisplay(bool value);
+
+  /*!
+  * \brief Is displaying errors?
+  *
+  *
+  * \return true if errors display is enabled
+  */
+  bool IsDisplayingErrors(void) const;
+
+private:
+  class FrameworkManager_impl *pimpl_;
+};
+
+/*!
+* \brief get FrameworkManager
+*
+* \return the FrameworkManager
+*/
+FrameworkManager *getFrameworkManager(void);
+
+/*!
+* \brief is big endian?
+*
+* \return true if big endian, false if little endian
+*/
+bool IsBigEndian(void);
 
 } // end namespace core
Index: trunk/lib/FlairCore/src/FrameworkManager_impl.cpp
===================================================================
--- trunk/lib/FlairCore/src/FrameworkManager_impl.cpp	(revision 14)
+++ trunk/lib/FlairCore/src/FrameworkManager_impl.cpp	(revision 15)
@@ -43,6 +43,6 @@
 using namespace flair::gui;
 
-ui_com* FrameworkManager_impl::com=NULL;
-FrameworkManager_impl* FrameworkManager_impl::_this=NULL;
+ui_com *FrameworkManager_impl::com = NULL;
+FrameworkManager_impl *FrameworkManager_impl::_this = NULL;
 
 namespace {
@@ -50,83 +50,80 @@
 
 #ifdef SIGDEBUG
-    static const char *reason_str[] = {
-        "undefined",
-        "received signal",
-        "invoked syscall",
-        "triggered fault",
-        "affected by priority inversion",
-         "missing mlockall",
-        "runaway thread",
-    };
-
-    void warn_upon_switch(int sig, siginfo_t *si, void *context)     {
-        unsigned int reason = si->si_value.sival_int;
-        void *bt[32];
-        int nentries;
+static const char *reason_str[] = {
+    "undefined", "received signal", "invoked syscall", "triggered fault",
+    "affected by priority inversion", "missing mlockall", "runaway thread",
+};
+
+void warn_upon_switch(int sig, siginfo_t *si, void *context) {
+  unsigned int reason = si->si_value.sival_int;
+  void *bt[32];
+  int nentries;
 #ifdef SIGDEBUG_WATCHDOG
-        printf("\nSIGDEBUG received, reason %d: %s\n", reason,
-           reason <= SIGDEBUG_WATCHDOG ? reason_str[reason] : "<unknown>");
-#endif
-        // Dump a backtrace of the frame which caused the switch to secondary mode:
-        nentries = backtrace(bt,sizeof(bt) / sizeof(bt[0]));
-        backtrace_symbols_fd(bt,nentries,fileno(stdout));
-    }
-#else //SIGDEBUG
-    void warn_upon_switch(int sig __attribute__((unused))) {
-        void *bt[32];
-        int nentries;
-
-        /* Dump a backtrace of the frame which caused the switch to
-           secondary mode: */
-        nentries = backtrace(bt,sizeof(bt) / sizeof(bt[0]));
-        backtrace_symbols_fd(bt,nentries,fileno(stdout));
-    }
-#endif //SIGDEBUG
+  printf("\nSIGDEBUG received, reason %d: %s\n", reason,
+         reason <= SIGDEBUG_WATCHDOG ? reason_str[reason] : "<unknown>");
+#endif
+  // Dump a backtrace of the frame which caused the switch to secondary mode:
+  nentries = backtrace(bt, sizeof(bt) / sizeof(bt[0]));
+  backtrace_symbols_fd(bt, nentries, fileno(stdout));
+}
+#else  // SIGDEBUG
+void warn_upon_switch(int sig __attribute__((unused))) {
+  void *bt[32];
+  int nentries;
+
+  /* Dump a backtrace of the frame which caused the switch to
+     secondary mode: */
+  nentries = backtrace(bt, sizeof(bt) / sizeof(bt[0]));
+  backtrace_symbols_fd(bt, nentries, fileno(stdout));
+}
+#endif // SIGDEBUG
 #endif //__XENO__
-    void seg_fault(int sig __attribute__((unused))) {
-        void *bt[32];
-        int nentries;
-
-        printf("Segmentation fault:\n");
-        /* Dump a backtrace of the frame which caused the segfault: */
-        nentries = backtrace(bt,sizeof(bt) / sizeof(bt[0]));
-        backtrace_symbols_fd(bt,nentries,fileno(stdout));
-
-        exit(1);
-    }
-}
-
-FrameworkManager_impl::FrameworkManager_impl(FrameworkManager *self,string name): Thread(self,"FrameworkManager",FRAMEWORK_TASK_PRIORITY) {
-    this->self=self;
-    is_logging=false;
-    logger_defined=false;
-    disable_errors=false;
-    ui_defined=false;
-    rcv_buf=NULL;
-    _this=this;
-
-    // Avoids memory swapping for this program
-    mlockall(MCL_CURRENT|MCL_FUTURE);
-    struct sigaction sa;
-
-    //catch segfault
-    signal(SIGSEGV, seg_fault);
-
-    //catch primary->secondary switch
+void seg_fault(int sig __attribute__((unused))) {
+  void *bt[32];
+  int nentries;
+
+  printf("Segmentation fault:\n");
+  /* Dump a backtrace of the frame which caused the segfault: */
+  nentries = backtrace(bt, sizeof(bt) / sizeof(bt[0]));
+  backtrace_symbols_fd(bt, nentries, fileno(stdout));
+
+  exit(1);
+}
+}
+
+FrameworkManager_impl::FrameworkManager_impl(FrameworkManager *self,
+                                             string name)
+    : Thread(self, "FrameworkManager", FRAMEWORK_TASK_PRIORITY) {
+  this->self = self;
+  is_logging = false;
+  logger_defined = false;
+  disable_errors = false;
+  ui_defined = false;
+  rcv_buf = NULL;
+  _this = this;
+
+  // Avoids memory swapping for this program
+  mlockall(MCL_CURRENT | MCL_FUTURE);
+  struct sigaction sa;
+
+  // catch segfault
+  signal(SIGSEGV, seg_fault);
+
+// catch primary->secondary switch
 #ifdef __XENO__
 #ifdef SIGDEBUG
-    sigemptyset(&sa.sa_mask);
-    sa.sa_sigaction = warn_upon_switch;
-    sa.sa_flags = SA_SIGINFO;
-    sigaction(SIGDEBUG, &sa, NULL);
-#else
-    signal(SIGXCPU, warn_upon_switch);
-#endif
-
-    string task_name="Framework_"+name;
-    int status=rt_task_shadow(NULL,task_name.c_str(),10,0);
-    if(status!=0) {
-        self->Err("rt_task_shadow error (%s)\n",strerror(-status));
-    }
+  sigemptyset(&sa.sa_mask);
+  sa.sa_sigaction = warn_upon_switch;
+  sa.sa_flags = SA_SIGINFO;
+  sigaction(SIGDEBUG, &sa, NULL);
+#else
+  signal(SIGXCPU, warn_upon_switch);
+#endif
+
+  string task_name = "Framework_" + name;
+  int status = rt_task_shadow(NULL, task_name.c_str(), 10, 0);
+  if (status != 0) {
+    self->Err("rt_task_shadow error (%s)\n", strerror(-status));
+  }
 
 #endif //__XENO__
@@ -134,812 +131,761 @@
 
 void FrameworkManager_impl::ConnectionLost(void) {
-    Err("connection lost\n");
-    gcs_watchdog->SafeStop();
-    connection_lost=true;
+  Err("connection lost\n");
+  gcs_watchdog->SafeStop();
+  connection_lost = true;
 }
 
 FrameworkManager_impl::~FrameworkManager_impl() {
-    //Printf("destruction FrameworkManager_impl\n");
-    int status;
-
-    SafeStop();
-    Join();
-
-    if(rcv_buf!=NULL) free(rcv_buf);
-
-    if(logger_defined==true) {
-        continuer=false;
-        (void)pthread_join(log_th,NULL);
-
-        status=DeletePipe(&cmd_pipe);
-        if(status!=0) {
-            Err("Error deleting pipe (%s)\n",strerror(-status));
+  // Printf("destruction FrameworkManager_impl\n");
+  int status;
+
+  SafeStop();
+  Join();
+
+  if (rcv_buf != NULL)
+    free(rcv_buf);
+
+  if (logger_defined == true) {
+    continuer = false;
+    (void)pthread_join(log_th, NULL);
+
+    status = DeletePipe(&cmd_pipe);
+    if (status != 0) {
+      Err("Error deleting pipe (%s)\n", strerror(-status));
+    }
+    status = DeletePipe(&data_pipe);
+    if (status != 0) {
+      Err("Error deleting pipe (%s)\n", strerror(-status));
+    }
+
+#ifdef __XENO__
+    status = rt_heap_delete(&log_heap);
+    if (status != 0) {
+      Err("rt_heap_delete error (%s)\n", strerror(-status));
+    }
+#endif
+
+    logs.clear();
+  }
+
+  if (file_doc != NULL)
+    xmlFreeDoc(file_doc);
+
+  if (ui_defined)
+    delete top_layout;
+
+  if (com != NULL) {
+    delete com;
+    status = UDT::close(com_sock);
+    if (status != 0)
+      printf("Error udt::close %s", UDT::getlasterror().getErrorMessage());
+
+    status = UDT::close(file_sock);
+    if (status != 0)
+      printf("Error udt::close %s", UDT::getlasterror().getErrorMessage());
+
+    SleepMS(200); // a revoir, sinon UDT::cleanup bloque en RT
+    UDT::cleanup();
+  }
+
+  // Printf("destruction FrameworkManager_impl ok\n");
+}
+
+void FrameworkManager_impl::SetupConnection(string address, uint16_t port,
+                                            size_t rcv_buf_size) {
+  UDT::startup();
+  this->rcv_buf_size = rcv_buf_size;
+
+  // socket file_socket, doit être créé en premier, cf station sol
+  Printf("Connecting to %s:%i\n", address.c_str(), port);
+  file_sock = GetSocket(address, port);
+  com_sock = GetSocket(address, port);
+
+  // receive buffer allocation
+  rcv_buf = (char *)malloc(rcv_buf_size);
+  if (rcv_buf == NULL) {
+    Err("receive buffer malloc error\n");
+  }
+
+  com = new ui_com(this, com_sock);
+
+  // file managment
+  bool blocking = true;
+  UDT::setsockopt(file_sock, 0, UDT_SNDSYN, &blocking, sizeof(bool));
+  UDT::setsockopt(file_sock, 0, UDT_RCVSYN, &blocking, sizeof(bool));
+
+  // configure timeout of blocking receive, short timeout to have priority on
+  // the other socket (see run method)
+  int timeout = 1; // ms
+  UDT::setsockopt(file_sock, 0, UDT_RCVTIMEO, &timeout, sizeof(int));
+
+  timeout = 100; // ms
+  UDT::setsockopt(com_sock, 0, UDT_RCVTIMEO, &timeout, sizeof(int));
+
+  Start();
+
+  // watchdog for connection with ground station
+  connection_lost = false;
+  gcs_watchdog = new Watchdog(
+      this, std::bind(&FrameworkManager_impl::ConnectionLost, this),
+      (Time)1000000000);
+  gcs_watchdog->Start();
+}
+
+void FrameworkManager_impl::SetupUserInterface(string xml_file) {
+  ui_defined = true;
+  this->xml_file = xml_file;
+
+  // top_layout=new Layout(NULL,XML_ROOT_ELEMENT,XML_ROOT_TYPE);
+  top_layout = new Layout(NULL, self->ObjectName(), XML_ROOT_TYPE);
+
+  // xml setup of the main widget
+  if (xml_file != "") {
+    xmlNodePtr *file_node = &(((Widget *)(top_layout))->pimpl_->file_node);
+    file_doc = xmlParseFile(xml_file.c_str());
+    if (file_doc == NULL) {
+      self->Warn("XML document not parsed successfully. Creating a new one.\n");
+      file_doc = xmlNewDoc((xmlChar *)"1.0");
+      *file_node = xmlNewNode(NULL, (xmlChar *)XML_ROOT_TYPE);
+      xmlSetProp(*file_node, (xmlChar *)"name",
+                 (xmlChar *)ObjectName().c_str());
+      xmlDocSetRootElement(file_doc, *file_node);
+      // PrintXml();
+    } else {
+      *file_node = xmlDocGetRootElement(file_doc);
+      if (xmlStrcmp((*file_node)->name, (xmlChar *)XML_ROOT_TYPE)) {
+        self->Warn("%s, no match found in xml file\n", XML_ROOT_TYPE);
+        *file_node = xmlNewNode(NULL, (xmlChar *)XML_ROOT_TYPE);
+        xmlSetProp(*file_node, (xmlChar *)"name",
+                   (xmlChar *)ObjectName().c_str());
+        xmlDocSetRootElement(file_doc, *file_node);
+      }
+    }
+  } else {
+    self->Err("xml file not defined\n");
+  }
+
+  // gui
+  tabwidget =
+      new TabWidget(top_layout->At(0, 0), XML_MAIN_TABWIDGET, TabWidget::North);
+  save_button =
+      new PushButton(top_layout->At(1, 0),
+                     "save config on target (" + self->ObjectName() + ")");
+  // load_button=new PushButton(top_layout->At(1,1),"load config on target (" +
+  // self->ObjectName() + ")");
+}
+
+// in case of RT, this thread switches to secondary mode when calling
+// com->Receive
+// it switches back to RT in ProcessXML when mutex are locked
+void FrameworkManager_impl::Run(void) {
+  while (!ToBeStopped()) {
+    ssize_t bytesRead;
+
+    bytesRead = com->Receive(rcv_buf, rcv_buf_size);
+
+    if (bytesRead == (ssize_t)rcv_buf_size)
+      Err("FrameworkManager max receive size, augmenter le buffer size!\n");
+
+    if (bytesRead > 0) {
+      // printf("recu %ld, trame %x\n",bytesRead,(uint8_t)rcv_buf[0]);
+      // rcv_buf[bytesRead-1]=0;//pour affichage
+      // printf("%s\n",rcv_buf);
+
+      switch ((uint8_t)rcv_buf[0]) {
+      case XML_HEADER: {
+        xmlDoc *doc;
+        rcv_buf[bytesRead] = 0;
+
+        doc = xmlReadMemory(rcv_buf, (int)bytesRead, "include.xml",
+                            "ISO-8859-1", 0);
+        xmlNode *cur_node = NULL;
+
+        for (cur_node = xmlDocGetRootElement(doc); cur_node;
+             cur_node = cur_node->next) {
+          if (cur_node->type == XML_ELEMENT_NODE) {
+            if (!xmlStrcmp(cur_node->name, (xmlChar *)XML_ROOT_TYPE)) {
+#ifdef __XENO__
+              WarnUponSwitches(
+                  true); // ProcessXML should not switch to secondary mode
+#endif
+              top_layout->Widget::pimpl_->ProcessXML(cur_node->children);
+#ifdef __XENO__
+              WarnUponSwitches(false); // other parts of this thread can switch
+                                       // to secondary mode
+#endif
+              break;
+            }
+          }
         }
-        status=DeletePipe(&data_pipe);
-        if(status!=0) {
-            Err("Error deleting pipe (%s)\n",strerror(-status));
+
+        xmlFreeDoc(doc);
+
+        if (save_button->Clicked())
+          SaveXml();
+
+        SaveXmlChange(rcv_buf);
+
+        break;
+      }
+      case WATCHDOG_HEADER: {
+        gcs_watchdog->Touch();
+        break;
+      }
+      default:
+        Err("unknown id: %x\n", (uint8_t)rcv_buf[0]);
+        break;
+      }
+    } else {
+      if (com->ConnectionLost())
+        SleepMS(10); // avoid infinite loop in this case
+    }
+  }
+}
+
+void FrameworkManager_impl::SaveXml(void) {
+  if (ui_defined)
+    xmlSaveFormatFile(xml_file.c_str(), file_doc, 1);
+}
+
+void FrameworkManager_impl::SaveXmlChange(char *buf) {
+  if (is_logging == true) {
+    FILE *xml_change;
+    char filename[256];
+    Time time = GetTime();
+
+    sprintf(filename, "%s/changes_at_%lld.xml", log_path.c_str(), time);
+
+    xml_change = fopen(filename, "a");
+    fprintf(xml_change, "%s", buf);
+    fclose(xml_change);
+
+    sprintf(filename, "changes_at_%lld.xml", time);
+    xml_changes.push_back(filename);
+  }
+}
+
+void FrameworkManager_impl::SendFile(string path, string name) {
+  char *buf, *more_buf;
+  int size;
+  filebuf *pbuf;
+  ssize_t nb_write;
+  string filename = path + "/" + name;
+
+  // open the file
+  fstream ifs(filename.c_str(), ios::in | ios::binary);
+  ifs.seekg(0, ios::end);
+  size = ifs.tellg();
+  ifs.seekg(0, ios::beg);
+  pbuf = ifs.rdbuf();
+
+  if (size <= 0) {
+    Err("error opening file %s\n", filename.c_str());
+    return;
+  }
+
+  buf = (char *)malloc(sizeof(uint8_t) + sizeof(int) + name.size());
+  if (buf == NULL) {
+    Err("malloc error, not sending file\n");
+    return;
+  }
+
+  if (IsBigEndian()) {
+    buf[0] = FILE_INFO_BIG_ENDIAN;
+  } else {
+    buf[0] = FILE_INFO_LITTLE_ENDIAN;
+  }
+
+  memcpy(buf + 1, &size, sizeof(int));
+  memcpy(buf + 1 + sizeof(int), name.c_str(), name.size());
+  Printf("sending %s, size: %i\n", filename.c_str(), size);
+  // send file information
+  UDT::sendmsg(file_sock, buf, sizeof(uint8_t) + sizeof(int) + name.size(), -1,
+               true);
+
+  more_buf = (char *)realloc((void *)buf, size);
+  if (more_buf == NULL) {
+    Err("realloc error, not sending file\n");
+    free(buf);
+    return;
+  } else {
+    buf = more_buf;
+  }
+
+  pbuf->sgetn(buf, size);
+  // send the file
+  nb_write = UDT::sendmsg(file_sock, buf, size, -1, true);
+
+  if (nb_write < 0) {
+    Err("UDT::sendmsg error (%s)\n", UDT::getlasterror().getErrorMessage());
+  } else if (nb_write != size) {
+    Err("UDT::sendmsg error, sent %ld/%i\n", nb_write, size);
+  }
+
+  ifs.close();
+  free(buf);
+}
+
+void FrameworkManager_impl::FinishSending() {
+  char rm_cmd[256];
+
+  // send orignal xml
+  SendFile(log_path, "setup.xml");
+  sprintf(rm_cmd, "rm %s/setup.xml", log_path.c_str());
+  system(rm_cmd);
+
+  // send xml changes
+  for (size_t i = 0; i < xml_changes.size(); i++) {
+    // Printf("%s\n",xml_changes.at(i).c_str());
+    SendFile(log_path, xml_changes.at(i).c_str());
+    sprintf(rm_cmd, "rm %s/%s", log_path.c_str(), xml_changes.at(i).c_str());
+    system(rm_cmd);
+  }
+  xml_changes.clear();
+
+  // end notify
+  char buf = END;
+  int nb_write = UDT::sendmsg(file_sock, &buf, 1, -1, true);
+
+  if (nb_write < 0) {
+    Err("UDT::sendmsg error (%s)\n", UDT::getlasterror().getErrorMessage());
+  } else if (nb_write != 1) {
+    Err("UDT::sendmsg error, sent %i/%i\n", nb_write, 1);
+  }
+}
+
+UDTSOCKET FrameworkManager_impl::GetSocket(string address, uint16_t port) {
+  while (1) {
+    UDTSOCKET new_fd;
+    new_fd = UDT::socket(AF_INET, SOCK_DGRAM, 0);
+    if (new_fd == UDT::INVALID_SOCK) {
+      Err("socket error: %s\n", UDT::getlasterror().getErrorMessage());
+      return 0;
+    }
+
+    sockaddr_in serv_addr;
+    serv_addr.sin_family = AF_INET;
+    serv_addr.sin_port = htons(short(port));
+
+    if (inet_pton(AF_INET, address.c_str(), &serv_addr.sin_addr) <= 0) {
+      Err("incorrect network address\n");
+      return 0;
+    }
+
+    memset(&(serv_addr.sin_zero), '\0', 8);
+
+    if (UDT::ERROR ==
+        UDT::connect(new_fd, (sockaddr *)&serv_addr, sizeof(serv_addr))) {
+      // Printf("connect error: %s
+      // %i\n",UDT::getlasterror().getErrorMessage(),UDT::getlasterror().getErrorCode());
+      UDT::close(new_fd);
+      if (UDT::getlasterror().getErrorCode() != 1001 &&
+          UDT::getlasterror().getErrorCode() != 1002) {
+        Err("connect error: %s\n", UDT::getlasterror().getErrorMessage());
+        return 0;
+      }
+    } else {
+      // printf("connected to
+      // %s:%i\n",inet_ntoa(serv_addr.sin_addr),serv_addr.sin_port);
+      return new_fd;
+    }
+  }
+}
+
+#ifdef __XENO__
+int FrameworkManager_impl::CreatePipe(RT_PIPE *fd, string name) {
+  name = self->ObjectName() + "-" + name;
+  // xenomai limitation
+  if (name.size() > 31)
+    self->Err("rt_pipe_create error (%s is too long)\n", name.c_str());
+// start log writter
+#ifdef RT_PIPE_SIZE
+  return rt_pipe_create(fd, name.c_str(), P_MINOR_AUTO, RT_PIPE_SIZE);
+#else
+  return rt_pipe_create(fd, name.c_str(), P_MINOR_AUTO, 0);
+#endif
+}
+#else
+int FrameworkManager_impl::CreatePipe(int (*fd)[2], string name) {
+  // if(pipe2(fd[0],O_NONBLOCK) == -1)
+  if (pipe(fd[0]) == -1) {
+    return errno;
+  } else {
+    int attr = fcntl((*fd)[0], F_GETFL, 0);
+    if (attr == -1) {
+      return errno;
+    }
+    if (fcntl((*fd)[0], F_SETFL, attr | O_NONBLOCK) == -1) {
+      return errno;
+    }
+    attr = fcntl((*fd)[1], F_GETFL, 0);
+    if (attr == -1) {
+      return errno;
+    }
+    if (fcntl((*fd)[1], F_SETFL, attr | O_NONBLOCK) == -1) {
+      return errno;
+    }
+
+    return 0;
+  }
+}
+#endif
+
+#ifdef __XENO__
+int FrameworkManager_impl::DeletePipe(RT_PIPE *fd) {
+  return rt_pipe_delete(fd);
+}
+#else
+int FrameworkManager_impl::DeletePipe(int (*fd)[2]) {
+  int status1 = close((*fd)[0]);
+  int status2 = close((*fd)[1]);
+  if (status1 == 0 && status2 == 0)
+    return 0;
+  if (status1 != 0)
+    return status1;
+  if (status2 != 0)
+    return status2;
+}
+#endif
+
+void FrameworkManager_impl::SetupLogger(string log_path) {
+  if (logger_defined == true) {
+    Warn("SetupLogger() was already called.\n");
+    return;
+  }
+
+  this->log_path = log_path;
+
+  int status = CreatePipe(&cmd_pipe, "log_cmd");
+  if (status != 0) {
+    Err("Error creating pipe (%s)\n", strerror(-status));
+    return;
+  }
+
+  status = CreatePipe(&data_pipe, "log_data");
+  if (status != 0) {
+    Err("Error creating pipe (%s)\n", strerror(-status));
+    return;
+  }
+
+#ifdef __XENO__
+  string tmp_name;
+  tmp_name = self->ObjectName() + "-log_heap";
+  status = rt_heap_create(&log_heap, tmp_name.c_str(), LOG_HEAP, H_FIFO);
+  if (status != 0) {
+    Err("rt_heap_create error (%s)\n", strerror(-status));
+    return;
+  }
+#endif //__XENO__
+
+  continuer = true;
+
+#ifdef NRT_STACK_SIZE
+  // Initialize thread creation attributes
+  pthread_attr_t attr;
+  if (pthread_attr_init(&attr) != 0) {
+    Err("pthread_attr_init error\n");
+    return;
+  }
+
+  if (pthread_attr_setstacksize(&attr, NRT_STACK_SIZE) != 0) {
+    Err("pthread_attr_setstacksize error\n");
+    return;
+  }
+
+  if (pthread_create(&log_th, &attr, write_log_user, (void *)this) < 0)
+#else
+  if (pthread_create(&log_th, NULL, write_log_user, (void *)this) < 0)
+#endif
+  {
+    Err("pthread_create error\n");
+    return;
+  }
+#ifdef NRT_STACK_SIZE
+  if (pthread_attr_destroy(&attr) != 0) {
+    Err("pthread_attr_destroy error\n");
+    return;
+  }
+#endif
+
+  logger_defined = true;
+}
+
+void FrameworkManager_impl::AddDeviceToLog(IODevice *device) {
+  if (logger_defined == false) {
+    Err("SetupLogger() was not called, not starting log\n");
+    return;
+  }
+
+  if (is_logging == false) {
+    if (device->pimpl_->SetToBeLogged()) {
+      log_desc_t tmp;
+      tmp.device = device;
+      logs.push_back(tmp);
+    } else {
+      Warn("not adding it twice\n");
+    }
+  } else {
+    Err("impossible while logging\n");
+  }
+}
+
+void FrameworkManager_impl::StartLog(void) {
+  if (logger_defined == false) {
+    Err("SetupLogger() was not called, not starting log\n");
+    return;
+  }
+
+  ssize_t written;
+  size_t nb_err = 0;
+
+  if (logs.size() == 0) {
+    Warn("Not starting log: nothing to log!\n");
+    return;
+  }
+
+  if (is_logging == false) {
+    for (size_t i = 0; i < logs.size(); i++) {
+
+      logs.at(i).running = true;
+      logs.at(i).dbtFile = NULL;
+      logs.at(i).size = logs.at(i).device->pimpl_->LogSize();
+#ifdef __XENO__
+      written =
+          rt_pipe_write(&cmd_pipe, &logs.at(i), sizeof(log_desc_t), P_NORMAL);
+#else
+      written = write(cmd_pipe[1], &logs.at(i), sizeof(log_desc_t));
+#endif
+
+      if (written < 0) {
+        Err("write pipe error (%s)\n", strerror(-written));
+        nb_err++;
+        logs.at(i).running = false;
+      } else if (written != sizeof(log_desc_t)) {
+        Err("write pipe error %ld/%ld\n", written, sizeof(log_desc_t));
+        nb_err++;
+        logs.at(i).running = false;
+      }
+    }
+
+    if (nb_err != logs.size())
+      is_logging = true;
+  } else {
+    Warn("Already logging\n");
+  }
+}
+
+void FrameworkManager_impl::StopLog(void) {
+  ssize_t written;
+
+  if (is_logging == true) {
+    for (size_t i = 0; i < logs.size(); i++) {
+      logs.at(i).running = false;
+    }
+// send only one running false condition, user thread will stop and send all
+#ifdef __XENO__
+    written =
+        rt_pipe_write(&cmd_pipe, &logs.at(0), sizeof(log_desc_t), P_NORMAL);
+#else
+    written = write(cmd_pipe[1], &logs.at(0), sizeof(log_desc_t));
+#endif
+
+    if (written < 0) {
+      Err("write pipe error (%s)\n", strerror(-written));
+      return;
+    } else if (written != sizeof(log_desc_t)) {
+      Err("write pipe error %ld/%ld\n", written, sizeof(log_desc_t));
+      return;
+    }
+
+    is_logging = false;
+  } else {
+    Warn("Not logging\n");
+  }
+}
+
+char *FrameworkManager_impl::GetBuffer(size_t sz) {
+// Printf("alloc %i\n",sz);
+#ifdef __XENO__
+  void *ptr;
+  int status = rt_heap_alloc(&log_heap, sz, TM_NONBLOCK, &ptr);
+  if (status != 0) {
+    Err("rt_heap_alloc error (%s)\n", strerror(-status));
+    ptr = NULL;
+  }
+  return (char *)ptr;
+#else
+  return (char *)malloc(sz);
+#endif
+}
+
+void FrameworkManager_impl::ReleaseBuffer(char *buf) {
+#ifdef __XENO__
+  int status = rt_heap_free(&log_heap, buf);
+
+  if (status != 0) {
+    Err("rt_heap_free error (%s)\n", strerror(-status));
+  }
+#else
+  free(buf);
+#endif
+}
+
+void FrameworkManager_impl::WriteLog(const char *buf, size_t size) {
+  ssize_t written;
+
+#ifdef __XENO__
+  written = rt_pipe_write(&data_pipe, buf, size, P_NORMAL);
+#else
+  written = write(data_pipe[1], buf, size);
+#endif
+
+  if (written < 0) {
+    Err("erreur write pipe (%s)\n", strerror(-written));
+  } else if (written != (ssize_t)size) {
+    Err("erreur write pipe %ld/%ld\n", written, size);
+  }
+}
+
+void *FrameworkManager_impl::write_log_user(void *arg) {
+  int cmd_pipe = -1;
+  int data_pipe = -1;
+  string filename;
+  fd_set set;
+  struct timeval timeout;
+  FrameworkManager_impl *caller = (FrameworkManager_impl *)arg;
+  int rv;
+
+  vector<log_desc_t> logs;
+
+#ifdef __XENO__
+  filename = NRT_PIPE_PATH + caller->self->ObjectName() + "-log_cmd";
+  while (cmd_pipe < 0) {
+    cmd_pipe = open(filename.c_str(), O_RDWR);
+    if (cmd_pipe < 0 && errno != ENOENT)
+      caller->self->Err("open rt_pipe error: %s %i\n", filename.c_str(), errno);
+    usleep(1000);
+  }
+  filename = NRT_PIPE_PATH + caller->self->ObjectName() + "-log_data";
+  while (data_pipe < 0) {
+    data_pipe = open(filename.c_str(), O_RDWR);
+    if (data_pipe < 0 && errno != ENOENT)
+      caller->self->Err("open rt_pipe error: %s %i\n", filename.c_str(), errno);
+    usleep(1000);
+  }
+#else
+  cmd_pipe = caller->cmd_pipe[0];
+  data_pipe = caller->data_pipe[0];
+#endif
+
+  while (caller->continuer == true) {
+    FD_ZERO(&set);
+    FD_SET(cmd_pipe, &set);
+    FD_SET(data_pipe, &set);
+
+    timeout.tv_sec = 0;
+    timeout.tv_usec = SELECT_TIMEOUT_MS * 1000;
+    rv = select(FD_SETSIZE, &set, NULL, NULL, &timeout);
+
+    if (rv == -1) {
+      caller->Err("select error\n"); // an error accured
+    } else if (rv == 0) {
+      // printf("timeout write_log_user %s\n",caller->ObjectName().c_str()); //
+      // a timeout occured
+    } else {
+      if (FD_ISSET(cmd_pipe, &set)) {
+        log_desc_t tmp;
+        read(cmd_pipe, &tmp, sizeof(log_desc_t));
+
+        if (tmp.running == true) // start logging
+        {
+          filename =
+              caller->log_path + "/" + caller->FileName(tmp.device) + ".dbt";
+          printf("Creating log file %s (log size %i)\n", filename.c_str(),
+                 (int)tmp.size);
+          tmp.dbtFile = inithdFile((char *)filename.c_str(), UAV, tmp.size);
+          logs.push_back(tmp);
+
+          if (logs.size() == 1) {
+            filename = caller->log_path + "/setup.xml";
+            xmlSaveFile(filename.c_str(), caller->file_doc);
+          }
+        } else // stop logging
+        {
+          for (size_t i = 0; i < logs.size(); i++) {
+            if (logs.at(i).dbtFile != NULL) {
+              close_hdfile(logs.at(i).dbtFile);
+
+              filename = caller->FileName(logs.at(i).device) + ".dbt";
+              caller->SendFile(caller->log_path, filename);
+
+              fstream txt_file;
+              filename = caller->FileName(logs.at(i).device) + ".txt";
+              txt_file.open((caller->log_path + "/" + filename).c_str(),
+                            fstream::out);
+              txt_file << "1: time (us)\n2: time (ns)\n";
+              int index = 3;
+              logs.at(i).device->pimpl_->WriteLogsDescriptors(txt_file, &index);
+              txt_file.close();
+
+              caller->SendFile(caller->log_path, filename);
+            }
+          }
+          // a revoir celui ci est le xml enregistré et pas forcement l'actuel
+          // if(caller->xml_file!="") caller->SendFile(caller->xml_file);
+          caller->FinishSending();
+
+          logs.clear();
         }
-
-#ifdef __XENO__
-        status=rt_heap_delete(&log_heap);
-        if(status!=0) {
-            Err("rt_heap_delete error (%s)\n",strerror(-status));
+      }
+
+      if (FD_ISSET(data_pipe, &set)) {
+        log_header_t header;
+        read(data_pipe, &header, sizeof(log_header_t));
+
+        for (size_t i = 0; i < logs.size(); i++) {
+          if (logs.at(i).device == header.device) {
+            char *buf = (char *)malloc(header.size);
+            read(data_pipe, buf, header.size);
+            // printf("%s \n",header.device->ObjectName().c_str());
+            // for(int i=0;i<header.size;i++) printf("%x ",buf[i]);
+            // printf("\n");
+            if (logs.at(i).size == header.size) {
+              if (logs.at(i).dbtFile != NULL) {
+                write_hdfile(
+                    logs.at(i).dbtFile, buf, (road_time_t)(header.time / 1000),
+                    (road_timerange_t)(header.time % 1000), header.size);
+              } else {
+                printf("err\n");
+              }
+            } else {
+              caller->self->Err("%s log size is not correct %i/%i\n",
+                                header.device->ObjectName().c_str(),
+                                header.size, logs.at(i).size);
+            }
+            free(buf);
+          }
         }
-#endif
-
-        logs.clear();
-    }
-
-    if(file_doc!=NULL) xmlFreeDoc(file_doc);
-
-    if(ui_defined) delete top_layout;
-
-    if(com!=NULL) {
-        delete com;
-        status=UDT::close(com_sock);
-        if(status!=0) printf("Error udt::close %s",UDT::getlasterror().getErrorMessage());
-
-        status=UDT::close(file_sock);
-        if(status!=0) printf("Error udt::close %s",UDT::getlasterror().getErrorMessage());
-
-        SleepMS(200);//a revoir, sinon UDT::cleanup bloque en RT
-        UDT::cleanup();
-    }
-
-    //Printf("destruction FrameworkManager_impl ok\n");
-}
-
-
-void FrameworkManager_impl::SetupConnection(string address,uint16_t port,size_t rcv_buf_size) {
-    UDT::startup();
-    this->rcv_buf_size=rcv_buf_size;
-
-    //socket file_socket, doit être créé en premier, cf station sol
-    Printf("Connecting to %s:%i\n",address.c_str(),port);
-    file_sock=GetSocket(address,port);
-    com_sock=GetSocket(address,port);
-
-    //receive buffer allocation
-    rcv_buf=(char*)malloc(rcv_buf_size);
-    if(rcv_buf==NULL) {
-        Err("receive buffer malloc error\n");
-    }
-
-    com=new ui_com(this,com_sock);
-
-    //file managment
-    bool blocking = true;
-    UDT::setsockopt(file_sock, 0, UDT_SNDSYN, &blocking, sizeof(bool));
-    UDT::setsockopt(file_sock, 0, UDT_RCVSYN, &blocking, sizeof(bool));
-
-    //configure timeout of blocking receive, short timeout to have priority on the other socket (see run method)
-    int timeout=1;//ms
-    UDT::setsockopt(file_sock, 0, UDT_RCVTIMEO, &timeout, sizeof(int));
-
-    timeout=100;//ms
-    UDT::setsockopt(com_sock, 0, UDT_RCVTIMEO, &timeout, sizeof(int));
-
-    Start();
-
-    //watchdog for connection with ground station
-    connection_lost=false;
-    gcs_watchdog=new Watchdog(this,std::bind(&FrameworkManager_impl::ConnectionLost,this),(Time)1000000000);
-    gcs_watchdog->Start();
-}
-
-void FrameworkManager_impl::SetupUserInterface(string xml_file) {
-    ui_defined=true;
-    this->xml_file=xml_file;
-
-    //top_layout=new Layout(NULL,XML_ROOT_ELEMENT,XML_ROOT_TYPE);
-    top_layout=new Layout(NULL,self->ObjectName(),XML_ROOT_TYPE);
-
-    //xml setup of the main widget
-    if(xml_file!="") {
-        xmlNodePtr* file_node=&(((Widget*)(top_layout))->pimpl_->file_node);
-        file_doc = xmlParseFile(xml_file.c_str());
-        if (file_doc == NULL ) {
-            self->Warn("XML document not parsed successfully. Creating a new one.\n");
-            file_doc = xmlNewDoc((xmlChar*)"1.0");
-            *file_node=xmlNewNode(NULL, (xmlChar*)XML_ROOT_TYPE);
-            xmlSetProp(*file_node,(xmlChar*)"name",(xmlChar*)ObjectName().c_str());
-            xmlDocSetRootElement(file_doc, *file_node);
-            //PrintXml();
-        } else {
-            *file_node=xmlDocGetRootElement(file_doc);
-            if(xmlStrcmp((*file_node)->name,(xmlChar*)XML_ROOT_TYPE)) {
-                self->Warn("%s, no match found in xml file\n",XML_ROOT_TYPE);
-                *file_node=xmlNewNode(NULL, (xmlChar*)XML_ROOT_TYPE);
-                xmlSetProp(*file_node,(xmlChar*)"name",(xmlChar*)ObjectName().c_str());
-                xmlDocSetRootElement(file_doc, *file_node);
-            }
-        }
-    } else {
-        self->Err("xml file not defined\n");
-    }
-
-    //gui
-    tabwidget=new TabWidget(top_layout->At(0,0),XML_MAIN_TABWIDGET,TabWidget::North);
-    save_button=new PushButton(top_layout->At(1,0),"save config on target (" + self->ObjectName() + ")");
-    //load_button=new PushButton(top_layout->At(1,1),"load config on target (" + self->ObjectName() + ")");
-}
-
-//in case of RT, this thread switches to secondary mode when calling com->Receive
-//it switches back to RT in ProcessXML when mutex are locked
-void FrameworkManager_impl::Run(void)
-{
-    while(!ToBeStopped())
-    {
-        ssize_t bytesRead;
-
-        bytesRead=com->Receive(rcv_buf,rcv_buf_size);
-
-        if(bytesRead==(ssize_t)rcv_buf_size) Err("FrameworkManager max receive size, augmenter le buffer size!\n");
-
-        if(bytesRead>0)
-        {
-            //printf("recu %ld, trame %x\n",bytesRead,(uint8_t)rcv_buf[0]);
-            //rcv_buf[bytesRead-1]=0;//pour affichage
-            //printf("%s\n",rcv_buf);
-
-            switch((uint8_t)rcv_buf[0])
-            {
-                case XML_HEADER:
-                {
-                    xmlDoc *doc;
-                    rcv_buf[bytesRead]=0;
-
-                    doc = xmlReadMemory(rcv_buf, (int)bytesRead, "include.xml", "ISO-8859-1", 0);
-                    xmlNode *cur_node = NULL;
-
-                    for (cur_node = xmlDocGetRootElement(doc); cur_node; cur_node = cur_node->next)
-                    {
-                        if (cur_node->type == XML_ELEMENT_NODE)
-                        {
-                            if(!xmlStrcmp(cur_node->name,(xmlChar*)XML_ROOT_TYPE) )
-                            {
-#ifdef __XENO__
-                                WarnUponSwitches(true);//ProcessXML should not switch to secondary mode
-#endif
-                                top_layout->Widget::pimpl_->ProcessXML(cur_node->children);
-#ifdef __XENO__
-                                WarnUponSwitches(false);//other parts of this thread can switch to secondary mode
-#endif
-                                break;
-                            }
-                        }
-                    }
-
-                    xmlFreeDoc(doc);
-
-                    if(save_button->Clicked()) SaveXml();
-
-                    SaveXmlChange(rcv_buf);
-
-                    break;
-                }
-                case WATCHDOG_HEADER: {
-                    gcs_watchdog->Touch();
-                    break;
-                }
-                default:
-                    Err("unknown id: %x\n",(uint8_t)rcv_buf[0]);
-                    break;
-            }
-        } else {
-            if(com->ConnectionLost()) SleepMS(10);//avoid infinite loop in this case
-        }
-    }
-}
-
-void FrameworkManager_impl::SaveXml(void)
-{
-    if(ui_defined) xmlSaveFormatFile(xml_file.c_str(),file_doc,1);
-}
-
-void FrameworkManager_impl::SaveXmlChange(char* buf)
-{
-    if(is_logging==true)
-    {
-        FILE *xml_change;
-        char filename[256];
-        Time time=GetTime();
-
-        sprintf(filename,"%s/changes_at_%lld.xml",log_path.c_str(),time);
-
-        xml_change=fopen(filename,"a");
-        fprintf(xml_change,"%s",buf);
-        fclose(xml_change);
-
-        sprintf(filename,"changes_at_%lld.xml",time);
-        xml_changes.push_back(filename);
-    }
-}
-
-void FrameworkManager_impl::SendFile(string path,string name)
-{
-    char *buf,*more_buf;
-    int size;
-    filebuf *pbuf;
-    ssize_t nb_write;
-    string filename=path+ "/" +name;
-
-    // open the file
-    fstream ifs(filename.c_str(), ios::in | ios::binary);
-    ifs.seekg(0, ios::end);
-    size = ifs.tellg();
-    ifs.seekg(0, ios::beg);
-    pbuf=ifs.rdbuf();
-
-    if(size<=0)
-    {
-        Err("error opening file %s\n",filename.c_str());
-        return;
-    }
-
-    buf=(char*)malloc(sizeof(uint8_t)+sizeof(int)+name.size());
-    if(buf==NULL)
-    {
-        Err("malloc error, not sending file\n");
-        return;
-    }
-
-    if(IsBigEndian())
-    {
-        buf[0]=FILE_INFO_BIG_ENDIAN;
-    }
-    else
-    {
-        buf[0]=FILE_INFO_LITTLE_ENDIAN;
-    }
-
-    memcpy(buf+1,&size,sizeof(int));
-    memcpy(buf+1+sizeof(int),name.c_str(),name.size());
-    Printf("sending %s, size: %i\n",filename.c_str(),size);
-    // send file information
-    UDT::sendmsg(file_sock, buf, sizeof(uint8_t)+sizeof(int)+name.size(), -1,true);
-
-    more_buf=(char*)realloc((void*)buf,size);
-    if(more_buf==NULL)
-    {
-        Err("realloc error, not sending file\n");
-        free(buf);
-        return;
-    }
-    else
-    {
-        buf=more_buf;
-    }
-
-    pbuf->sgetn (buf,size);
-    // send the file
-    nb_write=UDT::sendmsg(file_sock, buf, size,-1,true);
-
-    if(nb_write<0)
-    {
-        Err("UDT::sendmsg error (%s)\n",UDT::getlasterror().getErrorMessage());
-    }
-    else if (nb_write != size)
-    {
-        Err("UDT::sendmsg error, sent %ld/%i\n",nb_write,size);
-    }
-
-    ifs.close();
-    free(buf);
-}
-
-void FrameworkManager_impl::FinishSending()
-{
-    char rm_cmd[256];
-
-    //send orignal xml
-    SendFile(log_path,"setup.xml");
-    sprintf(rm_cmd,"rm %s/setup.xml",log_path.c_str());
-    system(rm_cmd);
-
-    //send xml changes
-    for(size_t i=0;i<xml_changes.size();i++)
-    {
-        //Printf("%s\n",xml_changes.at(i).c_str());
-        SendFile(log_path,xml_changes.at(i).c_str());
-        sprintf(rm_cmd,"rm %s/%s",log_path.c_str(),xml_changes.at(i).c_str());
-        system(rm_cmd);
-    }
-    xml_changes.clear();
-
-    //end notify
-    char buf=END;
-    int nb_write=UDT::sendmsg(file_sock, &buf, 1,-1,true);
-
-    if(nb_write<0)
-    {
-        Err("UDT::sendmsg error (%s)\n",UDT::getlasterror().getErrorMessage());
-    }
-    else if (nb_write != 1)
-    {
-        Err("UDT::sendmsg error, sent %i/%i\n",nb_write,1);
-    }
-}
-
-UDTSOCKET FrameworkManager_impl::GetSocket(string address,uint16_t port) {
-    while(1) {
-        UDTSOCKET new_fd;
-        new_fd = UDT::socket(AF_INET, SOCK_DGRAM, 0);
-        if(new_fd==UDT::INVALID_SOCK) {
-            Err("socket error: %s\n",UDT::getlasterror().getErrorMessage());
-            return 0;
-        }
-
-        sockaddr_in serv_addr;
-        serv_addr.sin_family = AF_INET;
-        serv_addr.sin_port = htons(short(port));
-
-        if (inet_pton(AF_INET,address.c_str(), &serv_addr.sin_addr) <= 0) {
-            Err("incorrect network address\n");
-            return 0;
-        }
-
-        memset(&(serv_addr.sin_zero), '\0', 8);
-
-        if (UDT::ERROR == UDT::connect(new_fd, (sockaddr*)&serv_addr, sizeof(serv_addr))) {
-            //Printf("connect error: %s %i\n",UDT::getlasterror().getErrorMessage(),UDT::getlasterror().getErrorCode());
-            UDT::close(new_fd);
-            if(UDT::getlasterror().getErrorCode()!=1001 && UDT::getlasterror().getErrorCode()!=1002) {
-                Err("connect error: %s\n",UDT::getlasterror().getErrorMessage());
-                return 0;
-            }
-        } else {
-            //printf("connected to %s:%i\n",inet_ntoa(serv_addr.sin_addr),serv_addr.sin_port);
-            return new_fd;
-        }
-    }
-}
-
-#ifdef __XENO__
-int FrameworkManager_impl::CreatePipe(RT_PIPE* fd,string name)
-{
-    name=self->ObjectName()+ "-" + name;
-    //xenomai limitation
-    if(name.size()>31) self->Err("rt_pipe_create error (%s is too long)\n",name.c_str());
-    //start log writter
-#ifdef RT_PIPE_SIZE
-    return rt_pipe_create(fd, name.c_str(), P_MINOR_AUTO,RT_PIPE_SIZE);
-#else
-    return rt_pipe_create(fd, name.c_str(), P_MINOR_AUTO,0);
-#endif
-}
-#else
-int FrameworkManager_impl::CreatePipe(int (*fd)[2],string name)
-{
-    //if(pipe2(fd[0],O_NONBLOCK) == -1)
-    if(pipe(fd[0]) == -1)
-    {
-        return errno;
-    }
-    else
-    {
-        int attr=fcntl((*fd)[0], F_GETFL,0);
-        if(attr == -1)
-        {
-            return errno;
-        }
-        if(fcntl((*fd)[0], F_SETFL, attr|O_NONBLOCK)== -1)
-        {
-            return errno;
-        }
-        attr=fcntl((*fd)[1], F_GETFL,0);
-        if(attr == -1)
-        {
-            return errno;
-        }
-        if(fcntl((*fd)[1], F_SETFL, attr|O_NONBLOCK)== -1)
-        {
-            return errno;
-        }
-
-        return 0;
-    }
-}
-#endif
-
-#ifdef __XENO__
-int FrameworkManager_impl::DeletePipe(RT_PIPE* fd)
-{
-    return rt_pipe_delete(fd);
-}
-#else
-int FrameworkManager_impl::DeletePipe(int (*fd)[2])
-{
-    int status1=close((*fd)[0]);
-    int status2=close((*fd)[1]);
-    if(status1==0 && status2==0) return 0;
-    if(status1!=0) return status1;
-    if(status2!=0) return status2;
-}
-#endif
-
-void FrameworkManager_impl::SetupLogger(string log_path) {
-    if(logger_defined==true) {
-        Warn("SetupLogger() was already called.\n");
-        return;
-    }
-
-    this->log_path=log_path;
-
-    int status=CreatePipe(&cmd_pipe,"log_cmd");
-    if(status!=0) {
-        Err("Error creating pipe (%s)\n",strerror(-status));
-        return;
-    }
-
-    status=CreatePipe(&data_pipe,"log_data");
-    if(status!=0) {
-        Err("Error creating pipe (%s)\n",strerror(-status));
-        return;
-    }
-
-#ifdef __XENO__
-    string tmp_name;
-    tmp_name=self->ObjectName() + "-log_heap";
-    status=rt_heap_create(&log_heap,tmp_name.c_str(),LOG_HEAP,H_FIFO);
-    if(status!=0) {
-        Err("rt_heap_create error (%s)\n",strerror(-status));
-        return;
-    }
-#endif //__XENO__
-
-    continuer=true;
-
-#ifdef NRT_STACK_SIZE
-    // Initialize thread creation attributes
-    pthread_attr_t attr;
-    if(pthread_attr_init(&attr) != 0) {
-        Err("pthread_attr_init error\n");
-        return;
-    }
-
-    if(pthread_attr_setstacksize(&attr, NRT_STACK_SIZE) != 0) {
-       Err("pthread_attr_setstacksize error\n");
-       return;
-    }
-
-    if(pthread_create(&log_th,  &attr, write_log_user, (void*)this) < 0)
-#else
-    if(pthread_create(&log_th, NULL, write_log_user, (void*)this) < 0)
-#endif
-    {
-        Err("pthread_create error\n");
-        return;
-    }
-#ifdef NRT_STACK_SIZE
-    if(pthread_attr_destroy(&attr) != 0) {
-        Err("pthread_attr_destroy error\n");
-        return;
-    }
-#endif
-
-    logger_defined=true;
-}
-
-void FrameworkManager_impl::AddDeviceToLog(IODevice *device)
-{
-    if(logger_defined==false)
-    {
-        Err("SetupLogger() was not called, not starting log\n");
-        return;
-    }
-
-    if(is_logging==false)
-    {
-        if(device->pimpl_->SetToBeLogged()) {
-            log_desc_t tmp;
-            tmp.device=device;
-            logs.push_back(tmp);
-        } else {
-            Warn("not adding it twice\n");
-        }
-    }
-    else
-    {
-        Err("impossible while logging\n");
-    }
-}
-
-void FrameworkManager_impl::StartLog(void)
-{
-    if(logger_defined==false)
-    {
-        Err("SetupLogger() was not called, not starting log\n");
-        return;
-    }
-
-    ssize_t written;
-    size_t nb_err=0;
-
-    if(logs.size()==0)
-    {
-        Warn("Not starting log: nothing to log!\n");
-        return;
-    }
-
-    if(is_logging==false)
-    {
-        for(size_t i=0;i<logs.size();i++)
-        {
-
-            logs.at(i).running=true;
-            logs.at(i).dbtFile=NULL;
-            logs.at(i).size=logs.at(i).device->pimpl_->LogSize();
-#ifdef __XENO__
-            written=rt_pipe_write(&cmd_pipe,&logs.at(i),sizeof(log_desc_t),P_NORMAL);
-#else
-            written=write(cmd_pipe[1],&logs.at(i),sizeof(log_desc_t));
-#endif
-
-            if(written<0)
-            {
-                Err("write pipe error (%s)\n",strerror(-written));
-                nb_err++;
-                logs.at(i).running=false;
-            }
-            else if (written != sizeof(log_desc_t))
-            {
-                Err("write pipe error %ld/%ld\n",written,sizeof(log_desc_t));
-                nb_err++;
-                logs.at(i).running=false;
-            }
-        }
-
-        if(nb_err!=logs.size()) is_logging=true;
-    }
-    else
-    {
-        Warn("Already logging\n");
-    }
-}
-
-void FrameworkManager_impl::StopLog(void)
-{
-    ssize_t written;
-
-    if(is_logging==true)
-    {
-        for(size_t i=0;i<logs.size();i++)
-        {
-            logs.at(i).running=false;
-        }
-        //send only one running false condition, user thread will stop and send all
-#ifdef __XENO__
-        written=rt_pipe_write(&cmd_pipe,&logs.at(0),sizeof(log_desc_t),P_NORMAL);
-#else
-        written=write(cmd_pipe[1],&logs.at(0),sizeof(log_desc_t));
-#endif
-
-        if(written<0)
-        {
-            Err("write pipe error (%s)\n",strerror(-written));
-            return;
-        }
-        else if (written != sizeof(log_desc_t))
-        {
-            Err("write pipe error %ld/%ld\n",written,sizeof(log_desc_t));
-            return;
-        }
-
-        is_logging=false;
-    }
-    else
-    {
-        Warn("Not logging\n");
-    }
-}
-
-char* FrameworkManager_impl::GetBuffer(size_t sz)
-{
-    //Printf("alloc %i\n",sz);
-#ifdef __XENO__
-    void *ptr;
-    int status=rt_heap_alloc(&log_heap,sz,TM_NONBLOCK ,&ptr);
-    if(status!=0)
-    {
-        Err("rt_heap_alloc error (%s)\n",strerror(-status));
-        ptr=NULL;
-    }
-    return (char*)ptr;
-#else
-    return (char*)malloc(sz);
-#endif
-}
-
-void FrameworkManager_impl::ReleaseBuffer(char* buf)
-{
-#ifdef __XENO__
-    int status=rt_heap_free(&log_heap,buf);
-
-    if(status!=0)
-    {
-        Err("rt_heap_free error (%s)\n",strerror(-status));
-    }
-#else
-    free(buf);
-#endif
-}
-
-void FrameworkManager_impl::WriteLog(const char* buf,size_t size)
-{
-    ssize_t written;
-
-#ifdef __XENO__
-    written=rt_pipe_write(&data_pipe,buf,size,P_NORMAL);
-#else
-    written=write(data_pipe[1],buf,size);
-#endif
-
-    if(written<0)
-    {
-        Err("erreur write pipe (%s)\n",strerror(-written));
-    }
-    else if (written != (ssize_t)size)
-    {
-        Err("erreur write pipe %ld/%ld\n",written,size);
-    }
-}
-
-void* FrameworkManager_impl::write_log_user(void * arg)
-{
-    int cmd_pipe=-1;
-    int data_pipe=-1;
-    string filename;
-    fd_set set;
-    struct timeval timeout;
-    FrameworkManager_impl *caller = (FrameworkManager_impl*)arg;
-    int rv;
-
-    vector<log_desc_t> logs;
-
-#ifdef __XENO__
-    filename=NRT_PIPE_PATH+ caller->self->ObjectName() + "-log_cmd";
-    while(cmd_pipe<0)
-    {
-        cmd_pipe = open(filename.c_str(), O_RDWR);
-        if (cmd_pipe < 0 && errno!=ENOENT) caller->self->Err("open rt_pipe error: %s %i\n",filename.c_str(),errno);
-        usleep(1000);
-    }
-    filename=NRT_PIPE_PATH+ caller->self->ObjectName() + "-log_data";
-    while(data_pipe<0)
-    {
-        data_pipe = open(filename.c_str(), O_RDWR);
-        if (data_pipe < 0 && errno!=ENOENT) caller->self->Err("open rt_pipe error: %s %i\n",filename.c_str(),errno);
-        usleep(1000);
-    }
-#else
-    cmd_pipe=caller->cmd_pipe[0];
-    data_pipe=caller->data_pipe[0];
-#endif
-
-    while(caller->continuer==true)
-    {
-        FD_ZERO(&set);
-        FD_SET(cmd_pipe, &set);
-        FD_SET(data_pipe, &set);
-
-        timeout.tv_sec = 0;
-        timeout.tv_usec = SELECT_TIMEOUT_MS*1000;
-        rv = select(FD_SETSIZE, &set, NULL, NULL, &timeout);
-
-        if(rv == -1)
-        {
-            caller->Err("select error\n"); // an error accured
-        }
-        else if(rv == 0)
-        {
-            //printf("timeout write_log_user %s\n",caller->ObjectName().c_str()); // a timeout occured
-        }
-        else
-        {
-            if(FD_ISSET(cmd_pipe, &set))
-            {
-                log_desc_t tmp;
-                read(cmd_pipe,&tmp,sizeof(log_desc_t));
-
-                if(tmp.running==true)//start logging
-                {
-                    filename= caller->log_path + "/" +caller->FileName(tmp.device)+ ".dbt";
-                    printf("Creating log file %s (log size %i)\n",filename.c_str(), (int)tmp.size);
-                    tmp.dbtFile = inithdFile((char*)filename.c_str(),UAV,tmp.size);
-                    logs.push_back(tmp);
-
-                    if(logs.size()==1)
-                    {
-                        filename= caller->log_path + "/setup.xml";
-                        xmlSaveFile(filename.c_str(),caller->file_doc);
-                    }
-                }
-                else//stop logging
-                {
-                    for(size_t i=0;i<logs.size();i++)
-                    {
-                        if(logs.at(i).dbtFile!=NULL)
-                        {
-                            close_hdfile(logs.at(i).dbtFile);
-
-                            filename= caller->FileName(logs.at(i).device)+ ".dbt";
-                            caller->SendFile(caller->log_path,filename);
-
-                            fstream txt_file;
-                            filename= caller->FileName(logs.at(i).device)+ ".txt";
-                            txt_file.open((caller->log_path+"/"+filename).c_str(),fstream::out);
-                            txt_file << "1: time (us)\n2: time (ns)\n";
-                            int index=3;
-                            logs.at(i).device->pimpl_->WriteLogsDescriptors(txt_file,&index);
-                            txt_file.close();
-
-                            caller->SendFile(caller->log_path,filename);
-                        }
-                    }
-                    //a revoir celui ci est le xml enregistré et pas forcement l'actuel
-                    //if(caller->xml_file!="") caller->SendFile(caller->xml_file);
-                    caller->FinishSending();
-
-                    logs.clear();
-                }
-            }
-
-            if(FD_ISSET(data_pipe, &set))
-            {
-                log_header_t header;
-                read(data_pipe,&header,sizeof(log_header_t));
-
-                for(size_t i=0;i<logs.size();i++)
-                {
-                    if(logs.at(i).device==header.device)
-                    {
-                        char* buf=(char*)malloc(header.size);
-                        read(data_pipe,buf,header.size);
-//printf("%s \n",header.device->ObjectName().c_str());
-//for(int i=0;i<header.size;i++) printf("%x ",buf[i]);
-//printf("\n");
-                        if(logs.at(i).size==header.size)
-                        {
-                            if(logs.at(i).dbtFile!=NULL)
-                            {
-                                write_hdfile(logs.at(i).dbtFile,buf,(road_time_t)(header.time/1000),(road_timerange_t)(header.time%1000),header.size);
-                            }
-                            else
-                            {
-                                printf("err\n");
-                            }
-                        }
-                        else
-                        {
-                            caller->self->Err("%s log size is not correct %i/%i\n",header.device->ObjectName().c_str(),header.size,logs.at(i).size);
-                        }
-                        free(buf);
-                    }
-                }
-            }
-        }
-    }
-
-#ifdef __XENO__
-    close(cmd_pipe);
-    close(data_pipe);
-#endif
-
-    pthread_exit(0);
-
-}
-
-string FrameworkManager_impl::FileName(IODevice* device)
-{
-    return getFrameworkManager()->ObjectName() + "_"+device->ObjectName();
-}
-
-void FrameworkManager_impl::PrintXml(void) const
-{
-    xmlChar *xmlbuff;
-    int buffersize;
-    xmlDocDumpFormatMemory(file_doc, &xmlbuff, &buffersize, 1);
-    Printf("xml:\n%s\n",xmlbuff);
-    xmlFree(xmlbuff);
-}
+      }
+    }
+  }
+
+#ifdef __XENO__
+  close(cmd_pipe);
+  close(data_pipe);
+#endif
+
+  pthread_exit(0);
+}
+
+string FrameworkManager_impl::FileName(IODevice *device) {
+  return getFrameworkManager()->ObjectName() + "_" + device->ObjectName();
+}
+
+void FrameworkManager_impl::PrintXml(void) const {
+  xmlChar *xmlbuff;
+  int buffersize;
+  xmlDocDumpFormatMemory(file_doc, &xmlbuff, &buffersize, 1);
+  Printf("xml:\n%s\n", xmlbuff);
+  xmlFree(xmlbuff);
+}
Index: trunk/lib/FlairCore/src/GeoCoordinate.cpp
===================================================================
--- trunk/lib/FlairCore/src/GeoCoordinate.cpp	(revision 14)
+++ trunk/lib/FlairCore/src/GeoCoordinate.cpp	(revision 15)
@@ -20,60 +20,54 @@
 using std::string;
 
-namespace flair
-{
-namespace core
-{
+namespace flair {
+namespace core {
 
-GeoCoordinate::GeoCoordinate(const Object* parent,string name,const GeoCoordinate *point,int n): io_data(parent,name,n)
-{
-    if(n>1) Warn("n>1 not supported\n");
-    CopyFrom(point);
+GeoCoordinate::GeoCoordinate(const Object *parent, string name,
+                             const GeoCoordinate *point, int n)
+    : io_data(parent, name, n) {
+  if (n > 1)
+    Warn("n>1 not supported\n");
+  CopyFrom(point);
 }
 
-GeoCoordinate::GeoCoordinate(const Object* parent,string name,double latitude,double longitude,double altitude,int n): io_data(parent,name,n)
-{
-    this->latitude=latitude;
-    this->longitude=longitude;
-    this->altitude=altitude;
+GeoCoordinate::GeoCoordinate(const Object *parent, string name, double latitude,
+                             double longitude, double altitude, int n)
+    : io_data(parent, name, n) {
+  this->latitude = latitude;
+  this->longitude = longitude;
+  this->altitude = altitude;
 }
 
-GeoCoordinate::~GeoCoordinate()
-{
+GeoCoordinate::~GeoCoordinate() {}
 
+void GeoCoordinate::CopyFrom(const GeoCoordinate *point) {
+  double latitude, longitude, altitude;
+  point->GetCoordinates(&latitude, &longitude, &altitude);
+  GetMutex();
+  this->latitude = latitude;
+  this->longitude = longitude;
+  this->altitude = altitude;
+  ReleaseMutex();
 }
 
-void GeoCoordinate::CopyFrom(const GeoCoordinate *point)
-{
-    double latitude,longitude,altitude;
-    point->GetCoordinates(&latitude,&longitude,&altitude);
-    GetMutex();
-    this->latitude=latitude;
-    this->longitude=longitude;
-    this->altitude=altitude;
-    ReleaseMutex();
+void GeoCoordinate::SetCoordinates(double latitude, double longitude,
+                                   double altitude) {
+  GetMutex();
+  this->latitude = latitude;
+  this->longitude = longitude;
+  this->altitude = altitude;
+  ReleaseMutex();
 }
 
-void GeoCoordinate::SetCoordinates(double latitude,double longitude,double altitude)
-{
-    GetMutex();
-    this->latitude=latitude;
-    this->longitude=longitude;
-    this->altitude=altitude;
-    ReleaseMutex();
+void GeoCoordinate::GetCoordinates(double *latitude, double *longitude,
+                                   double *altitude) const {
+  GetMutex();
+  *latitude = this->latitude;
+  *longitude = this->longitude;
+  *altitude = this->altitude;
+  ReleaseMutex();
 }
 
-void GeoCoordinate::GetCoordinates(double *latitude,double *longitude,double *altitude) const
-{
-    GetMutex();
-    *latitude=this->latitude;
-    *longitude=this->longitude;
-    *altitude=this->altitude;
-    ReleaseMutex();
-}
-
-void GeoCoordinate::CopyDatas(char* ptr) const
-{
-    Warn("a ecrire");
-}
+void GeoCoordinate::CopyDatas(char *ptr) const { Warn("a ecrire"); }
 
 } // end namespace core
Index: trunk/lib/FlairCore/src/GeoCoordinate.h
===================================================================
--- trunk/lib/FlairCore/src/GeoCoordinate.h	(revision 14)
+++ trunk/lib/FlairCore/src/GeoCoordinate.h	(revision 15)
@@ -15,94 +15,99 @@
 #include <io_data.h>
 
-namespace flair { namespace core {
+namespace flair {
+namespace core {
 
-    /*! \class GeoCoordinate
-    *
-    * \brief Class defining a point by its lla coordinates
-    */
-    class GeoCoordinate: public io_data {
-        public:
-            class Type: public DataType {
-            public:
-                size_t GetSize() const {
-                    return sizeof(latitude)+sizeof(longitude)+sizeof(altitude);
-                }
-                std::string GetDescription() const {return "lla";}
-            };
+/*! \class GeoCoordinate
+*
+* \brief Class defining a point by its lla coordinates
+*/
+class GeoCoordinate : public io_data {
+public:
+  class Type : public DataType {
+  public:
+    size_t GetSize() const {
+      return sizeof(latitude) + sizeof(longitude) + sizeof(altitude);
+    }
+    std::string GetDescription() const { return "lla"; }
+  };
 
-            /*!
-            * \brief Constructor
-            *
-            * Construct GeoCoordinate using values from another class.
-            *
-            * \param parent parent
-            * \param name name
-            * \param point class to copy
-            * \param n number of samples
-            */
-            GeoCoordinate(const Object* parent,std::string name,const GeoCoordinate *point,int n=1);
+  /*!
+  * \brief Constructor
+  *
+  * Construct GeoCoordinate using values from another class.
+  *
+  * \param parent parent
+  * \param name name
+  * \param point class to copy
+  * \param n number of samples
+  */
+  GeoCoordinate(const Object *parent, std::string name,
+                const GeoCoordinate *point, int n = 1);
 
-            /*!
-            * \brief Constructor
-            *
-            * Construct GeoCoordinate using specified values.
-            *
-            * \param parent parent
-            * \param name name
-            * \param latitude latitude
-            * \param longitude longitude
-            * \param altitude altitude
-            * \param n number of samples
-            */
-            GeoCoordinate(const Object* parent,std::string name,double latitude,double longitude,double altitude,int n=1);
+  /*!
+  * \brief Constructor
+  *
+  * Construct GeoCoordinate using specified values.
+  *
+  * \param parent parent
+  * \param name name
+  * \param latitude latitude
+  * \param longitude longitude
+  * \param altitude altitude
+  * \param n number of samples
+  */
+  GeoCoordinate(const Object *parent, std::string name, double latitude,
+                double longitude, double altitude, int n = 1);
 
-            /*!
-            * \brief Destructor
-            *
-            */
-            ~GeoCoordinate();
+  /*!
+  * \brief Destructor
+  *
+  */
+  ~GeoCoordinate();
 
-            /*!
-            * \brief Copy
-            *
-            * \param point class to copy
-            */
-            void CopyFrom(const GeoCoordinate *point);
+  /*!
+  * \brief Copy
+  *
+  * \param point class to copy
+  */
+  void CopyFrom(const GeoCoordinate *point);
 
-            /*!
-            * \brief Set coordinates
-            *
-            * \param latitude latitude
-            * \param longitude longitude
-            * \param altitude altitude
-            */
-            void SetCoordinates(double latitude,double longitude,double altitude);
+  /*!
+  * \brief Set coordinates
+  *
+  * \param latitude latitude
+  * \param longitude longitude
+  * \param altitude altitude
+  */
+  void SetCoordinates(double latitude, double longitude, double altitude);
 
-            /*!
-            * \brief Get coordinates
-            *
-            * \param latitude latitude
-            * \param longitude longitude
-            * \param altitude altitude
-            */
-            void GetCoordinates(double *latitude,double *longitude,double *altitude) const;
+  /*!
+  * \brief Get coordinates
+  *
+  * \param latitude latitude
+  * \param longitude longitude
+  * \param altitude altitude
+  */
+  void GetCoordinates(double *latitude, double *longitude,
+                      double *altitude) const;
 
-            Type const &GetDataType() const {return dataType;}
-        private:
-            /*!
-            * \brief Copy datas
-            *
-            * Reimplemented from io_data. \n
-            * See io_data::CopyDatas.
-            *
-            * \param dst destination buffer
-            */
-            void CopyDatas(char* ptr) const;
+  Type const &GetDataType() const { return dataType; }
 
-            double latitude;
-            double longitude;
-            double altitude;
-            Type dataType;
-    };
+private:
+  /*!
+  * \brief Copy datas
+  *
+  * Reimplemented from io_data. \n
+  * See io_data::CopyDatas.
+  *
+  * \param dst destination buffer
+  */
+  void CopyDatas(char *ptr) const;
+
+  double latitude;
+  double longitude;
+  double altitude;
+  Type dataType;
+};
 
 } // end namespace core
Index: trunk/lib/FlairCore/src/GridLayout.cpp
===================================================================
--- trunk/lib/FlairCore/src/GridLayout.cpp	(revision 14)
+++ trunk/lib/FlairCore/src/GridLayout.cpp	(revision 15)
@@ -20,22 +20,17 @@
 using std::string;
 
-namespace flair
-{
-namespace gui
-{
+namespace flair {
+namespace gui {
 
-GridLayout::GridLayout(const LayoutPosition* position,string name): Layout(position->getLayout(),name,"GridLayout")
-{
-    SetVolatileXmlProp("row",position->Row());
-    SetVolatileXmlProp("col",position->Col());
-    SendXml();
+GridLayout::GridLayout(const LayoutPosition *position, string name)
+    : Layout(position->getLayout(), name, "GridLayout") {
+  SetVolatileXmlProp("row", position->Row());
+  SetVolatileXmlProp("col", position->Col());
+  SendXml();
 
-    delete position;
+  delete position;
 }
 
-GridLayout::~GridLayout()
-{
-
-}
+GridLayout::~GridLayout() {}
 
 } // end namespace gui
Index: trunk/lib/FlairCore/src/GridLayout.h
===================================================================
--- trunk/lib/FlairCore/src/GridLayout.h	(revision 14)
+++ trunk/lib/FlairCore/src/GridLayout.h	(revision 15)
@@ -16,39 +16,37 @@
 #include <Layout.h>
 
-namespace flair
-{
-namespace gui
-{
-    class LayoutPosition;
+namespace flair {
+namespace gui {
+class LayoutPosition;
 
-    /*! \class GridLayout
-    *
-    * \brief Class displaying a QGridLayout on the ground station
-    *
-    */
-    class GridLayout: public Layout
-    {
-        public:
-            /*!
-            * \brief Constructor
-            *
-            * Construct a QCheckBox at given position. \n
-            * The GridLayout will automatically be child of position->getLayout() Layout. After calling this constructor,
-            * position will be deleted as it is no longer usefull.
-            *
-            * \param parent parent
-            * \param name name
+/*! \class GridLayout
+*
+* \brief Class displaying a QGridLayout on the ground station
+*
+*/
+class GridLayout : public Layout {
+public:
+  /*!
+  * \brief Constructor
+  *
+  * Construct a QCheckBox at given position. \n
+  * The GridLayout will automatically be child of position->getLayout() Layout.
+  After calling this constructor,
+  * position will be deleted as it is no longer usefull.
+  *
+  * \param parent parent
+  * \param name name
 
-            */
-            GridLayout(const LayoutPosition* position,std::string name);
+  */
+  GridLayout(const LayoutPosition *position, std::string name);
 
-            /*!
-            * \brief Destructor
-            *
-            */
-            ~GridLayout();
+  /*!
+  * \brief Destructor
+  *
+  */
+  ~GridLayout();
 
-        private:
-    };
+private:
+};
 
 } // end namespace gui
Index: trunk/lib/FlairCore/src/GroupBox.cpp
===================================================================
--- trunk/lib/FlairCore/src/GroupBox.cpp	(revision 14)
+++ trunk/lib/FlairCore/src/GroupBox.cpp	(revision 15)
@@ -20,22 +20,17 @@
 using std::string;
 
-namespace flair
-{
-namespace gui
-{
+namespace flair {
+namespace gui {
 
-GroupBox::GroupBox(const LayoutPosition* position,string name): Layout(position->getLayout(),name,"GroupBox")
-{
-    SetVolatileXmlProp("row",position->Row());
-    SetVolatileXmlProp("col",position->Col());
-    SendXml();
+GroupBox::GroupBox(const LayoutPosition *position, string name)
+    : Layout(position->getLayout(), name, "GroupBox") {
+  SetVolatileXmlProp("row", position->Row());
+  SetVolatileXmlProp("col", position->Col());
+  SendXml();
 
-    delete position;
+  delete position;
 }
 
-GroupBox::~GroupBox()
-{
-
-}
+GroupBox::~GroupBox() {}
 
 } // end namespace gui
Index: trunk/lib/FlairCore/src/GroupBox.h
===================================================================
--- trunk/lib/FlairCore/src/GroupBox.h	(revision 14)
+++ trunk/lib/FlairCore/src/GroupBox.h	(revision 15)
@@ -16,38 +16,36 @@
 #include <Layout.h>
 
-namespace flair
-{
-namespace gui
-{
-    class LayoutPosition;
+namespace flair {
+namespace gui {
+class LayoutPosition;
 
-    /*! \class GroupBox
-    *
-    * \brief Class displaying a QGroupBox on the ground station
-    *
-    */
-    class GroupBox: public Layout
-    {
-        public:
-            /*!
-            * \brief Constructor
-            *
-            * Construct a QGroupBox at given position. \n
-            * The GroupBox will automatically be child of position->getLayout() Layout. After calling this constructor,
-            * position will be deleted as it is no longer usefull.
-            *
-            * \param position position
-            * \param name name
-            */
-            GroupBox(const LayoutPosition* position,std::string name);
+/*! \class GroupBox
+*
+* \brief Class displaying a QGroupBox on the ground station
+*
+*/
+class GroupBox : public Layout {
+public:
+  /*!
+  * \brief Constructor
+  *
+  * Construct a QGroupBox at given position. \n
+  * The GroupBox will automatically be child of position->getLayout() Layout.
+  *After calling this constructor,
+  * position will be deleted as it is no longer usefull.
+  *
+  * \param position position
+  * \param name name
+  */
+  GroupBox(const LayoutPosition *position, std::string name);
 
-            /*!
-            * \brief Destructor
-            *
-            */
-            ~GroupBox();
+  /*!
+  * \brief Destructor
+  *
+  */
+  ~GroupBox();
 
-        private:
-    };
+private:
+};
 
 } // end namespace gui
Index: trunk/lib/FlairCore/src/I2cPort.h
===================================================================
--- trunk/lib/FlairCore/src/I2cPort.h	(revision 14)
+++ trunk/lib/FlairCore/src/I2cPort.h	(revision 15)
@@ -17,84 +17,81 @@
 #include <stdint.h>
 
-namespace flair
-{
-namespace core
-{
-    /*! \class I2cPort
-    *
-    * \brief Base class for i2c port
-    *
-    * This class has a Mutex which must be used to protect access to the port in case
-    * that more than one Thread is using it. Lock the Mutex before any communication (including SetSlave)
-    * and release it after communication.
-    */
-    class I2cPort: public Mutex
-    {
-        public:
-            /*!
-            * \brief Constructor
-            *
-            * Construct an i2c port.
-            *
-            * \param parent parent
-            * \param name name
-            */
-            I2cPort(const Object* parent,std::string name): Mutex(parent,name)
-            {}
+namespace flair {
+namespace core {
+/*! \class I2cPort
+*
+* \brief Base class for i2c port
+*
+* This class has a Mutex which must be used to protect access to the port in
+*case
+* that more than one Thread is using it. Lock the Mutex before any communication
+*(including SetSlave)
+* and release it after communication.
+*/
+class I2cPort : public Mutex {
+public:
+  /*!
+  * \brief Constructor
+  *
+  * Construct an i2c port.
+  *
+  * \param parent parent
+  * \param name name
+  */
+  I2cPort(const Object *parent, std::string name) : Mutex(parent, name) {}
 
-            /*!
-            * \brief Destructor
-            *
-            */
-            ~I2cPort(){};
+  /*!
+  * \brief Destructor
+  *
+  */
+  ~I2cPort(){};
 
-            /*!
-            * \brief Set slave's address
-            *
-            * This function need to be called before any communication.
-            *
-            * \param address slave's address
-            */
-            virtual int SetSlave(uint16_t address)=0;
+  /*!
+  * \brief Set slave's address
+  *
+  * This function need to be called before any communication.
+  *
+  * \param address slave's address
+  */
+  virtual int SetSlave(uint16_t address) = 0;
 
-            /*!
-            * \brief Write datas
-            *
-            * \param buf pointer to datas
-            * \param nbyte length of datas
-            *
-            * \return amount of written datas
-            */
-            virtual ssize_t Write(const void *buf,size_t nbyte)=0;
+  /*!
+  * \brief Write datas
+  *
+  * \param buf pointer to datas
+  * \param nbyte length of datas
+  *
+  * \return amount of written datas
+  */
+  virtual ssize_t Write(const void *buf, size_t nbyte) = 0;
 
-            /*!
-            * \brief Read datas
-            *
-            * \param buf pointer to datas
-            * \param nbyte length of datas
-            *
-            * \return amount of read datas
-            */
-            virtual ssize_t Read(void *buf,size_t nbyte)=0;
+  /*!
+  * \brief Read datas
+  *
+  * \param buf pointer to datas
+  * \param nbyte length of datas
+  *
+  * \return amount of read datas
+  */
+  virtual ssize_t Read(void *buf, size_t nbyte) = 0;
 
-            /*!
-            * \brief Set RX timeout
-            *
-            * Timeout for waiting an ACK from the slave.
-            *
-            * \param timeout_ns timeout in nano second
-            */
-            virtual void SetRxTimeout(Time timeout_ns)=0;
+  /*!
+  * \brief Set RX timeout
+  *
+  * Timeout for waiting an ACK from the slave.
+  *
+  * \param timeout_ns timeout in nano second
+  */
+  virtual void SetRxTimeout(Time timeout_ns) = 0;
 
-            /*!
-            * \brief Set TX timeout
-            *
-            * Timeout for waiting an ACK from the slave.
-            *
-            * \param timeout_ns timeout in nano second
-            */
-            virtual void SetTxTimeout(Time timeout_ns)=0;
-
-    };
+  /*!
+  * \brief Set TX timeout
+  *
+  * Timeout for waiting an ACK from the slave.
+  *
+  * \param timeout_ns timeout in nano second
+  */
+  virtual void SetTxTimeout(Time timeout_ns) = 0;
+};
 } // end namespace core
 } // end namespace framework
Index: trunk/lib/FlairCore/src/IODataElement.h
===================================================================
--- trunk/lib/FlairCore/src/IODataElement.h	(revision 14)
+++ trunk/lib/FlairCore/src/IODataElement.h	(revision 15)
@@ -16,46 +16,42 @@
 #include "io_data.h"
 
-namespace flair { namespace core {
+namespace flair {
+namespace core {
 
-    class DataType;
+class DataType;
 
-    /*! \class IODataElement
-    *
-    * \brief Abstract class for accessing an element of an io_data.
-    */
-    class IODataElement: public Object
-    {
-        public:
-            /*!
-            * \brief Constructor
-            *
-            * Construct an IODataElement. \n
-            *
-            */
-            IODataElement(const io_data* parent,std::string name): Object(parent,name)
-            {
-                this->parent=parent;
-            }
-            size_t Size() const
-            {
-                return size;
-            }
+/*! \class IODataElement
+*
+* \brief Abstract class for accessing an element of an io_data.
+*/
+class IODataElement : public Object {
+public:
+  /*!
+  * \brief Constructor
+  *
+  * Construct an IODataElement. \n
+  *
+  */
+  IODataElement(const io_data *parent, std::string name)
+      : Object(parent, name) {
+    this->parent = parent;
+  }
+  size_t Size() const { return size; }
 
-            virtual void CopyData(char* dst) const=0;
+  virtual void CopyData(char *dst) const = 0;
 
-            /*!
-            * \brief DataType
-            *
-            * \return type of data
-            */
-            virtual DataType const &GetDataType(void) const=0;
+  /*!
+  * \brief DataType
+  *
+  * \return type of data
+  */
+  virtual DataType const &GetDataType(void) const = 0;
 
-        protected:
-            size_t size;
+protected:
+  size_t size;
 
-        private:
-            const io_data* parent;
-
-    };
+private:
+  const io_data *parent;
+};
 
 } // end namespace core
Index: trunk/lib/FlairCore/src/IODevice.cpp
===================================================================
--- trunk/lib/FlairCore/src/IODevice.cpp	(revision 14)
+++ trunk/lib/FlairCore/src/IODevice.cpp	(revision 15)
@@ -24,61 +24,45 @@
 using std::string;
 
-namespace flair
-{
-namespace core
-{
+namespace flair {
+namespace core {
 
-IODevice::IODevice(const Object* parent,string name): Object(parent,name,"IODevice")
-{
-    pimpl_=new IODevice_impl(this);
+IODevice::IODevice(const Object *parent, string name)
+    : Object(parent, name, "IODevice") {
+  pimpl_ = new IODevice_impl(this);
 }
 
-IODevice::~IODevice()
-{
-    delete pimpl_;
+IODevice::~IODevice() { delete pimpl_; }
+
+void IODevice::AddDeviceToLog(const IODevice *device) {
+  pimpl_->AddDeviceToLog(device);
 }
 
-void IODevice::AddDeviceToLog(const IODevice* device)
-{
-    pimpl_->AddDeviceToLog(device);
+void IODevice::OutputToShMem(bool enabled) { pimpl_->OutputToShMem(enabled); }
+
+void IODevice::ProcessUpdate(io_data *data) {
+  if (data != NULL)
+    data->pimpl_->SetConsistent(true);
+
+  for (size_t i = 0; i < TypeChilds()->size(); i++) {
+    ((IODevice *)TypeChilds()->at(i))->UpdateFrom(data);
+  }
+
+  if (data != NULL) {
+    if (getFrameworkManager()->IsLogging() == true)
+      pimpl_->WriteLog(data->DataTime());
+
+    data->pimpl_->Circle();
+  }
+
+  pimpl_->WriteToShMem();
+
+  pimpl_->ResumeThread();
 }
 
-void IODevice::OutputToShMem(bool enabled) {
-    pimpl_->OutputToShMem(enabled);
-}
+void IODevice::AddDataToLog(const io_data *data) { pimpl_->AddDataToLog(data); }
 
-void IODevice::ProcessUpdate(io_data* data)
-{
-    if(data!=NULL) data->pimpl_->SetConsistent(true);
+DataType const &IODevice::GetInputDataType() const { return dummyType; }
 
-    for(size_t i=0;i<TypeChilds()->size();i++)
-    {
-        ((IODevice*)TypeChilds()->at(i))->UpdateFrom(data);
-    }
-
-    if(data!=NULL)
-    {
-        if(getFrameworkManager()->IsLogging()==true) pimpl_->WriteLog(data->DataTime());
-
-        data->pimpl_->Circle();
-    }
-
-    pimpl_->WriteToShMem();
-
-    pimpl_->ResumeThread();
-}
-
-void IODevice::AddDataToLog(const io_data* data)
-{
-    pimpl_->AddDataToLog(data);
-}
-
-DataType const &IODevice::GetInputDataType() const {
-    return dummyType;
-}
-
-DataType const &IODevice::GetOutputDataType() const {
-    return dummyType;
-}
+DataType const &IODevice::GetOutputDataType() const { return dummyType; }
 
 } // end namespace core
Index: trunk/lib/FlairCore/src/IODevice.h
===================================================================
--- trunk/lib/FlairCore/src/IODevice.h	(revision 14)
+++ trunk/lib/FlairCore/src/IODevice.h	(revision 15)
@@ -20,120 +20,131 @@
 class FrameworkManager_impl;
 
-namespace flair { namespace core {
+namespace flair {
+namespace core {
 
-    class io_data;
-    class DataType;
+class io_data;
+class DataType;
 
-    /*! \class IODevice
-    *
-    * \brief Abstract class for input/ouput system
-    *
-    * An input/output system is generally used to describe a sensor, an actuator or a filter. \n
-    * These systems can be linked (for exemple a sensor with a filter), when an IODevice
-    * is created with a parent of type IODevice.
-    * In this case, an update of the parent's data will call an update
-    * of the child's data (for exemple when a sensor gets new datas, a filter is automatically called). \n
-    * Output of this object can also be sent to a shared memory using the OutputToShMem method; in order to use it with an
-    * external program.
-    */
-    class IODevice: public Object {
-        friend class ::IODevice_impl;
-        friend class ::Thread_impl;
-        friend class ::FrameworkManager_impl;
+/*! \class IODevice
+*
+* \brief Abstract class for input/ouput system
+*
+* An input/output system is generally used to describe a sensor, an actuator or
+*a filter. \n
+* These systems can be linked (for exemple a sensor with a filter), when an
+*IODevice
+* is created with a parent of type IODevice.
+* In this case, an update of the parent's data will call an update
+* of the child's data (for exemple when a sensor gets new datas, a filter is
+*automatically called). \n
+* Output of this object can also be sent to a shared memory using the
+*OutputToShMem method; in order to use it with an
+* external program.
+*/
+class IODevice : public Object {
+  friend class ::IODevice_impl;
+  friend class ::Thread_impl;
+  friend class ::FrameworkManager_impl;
 
-        public:
-            /*!
-            * \brief Constructor
-            *
-            * Construct an IODevice of Object's type "IODevice" (see Object::ObjectType). \n
-            * If parent's Object::ObjectType is also "IODevice", this IODevice will be linked to its parent
-            * (see ProcessUpdate()).
-            *
-            * \param parent parent
-            * \param name name
-            */
-            IODevice(const Object* parent,std::string name);
+public:
+  /*!
+  * \brief Constructor
+  *
+  * Construct an IODevice of Object's type "IODevice" (see Object::ObjectType).
+  *\n
+  * If parent's Object::ObjectType is also "IODevice", this IODevice will be
+  *linked to its parent
+  * (see ProcessUpdate()).
+  *
+  * \param parent parent
+  * \param name name
+  */
+  IODevice(const Object *parent, std::string name);
 
-            /*!
-            * \brief Destructor
-            *
-            */
-            virtual ~IODevice();
+  /*!
+  * \brief Destructor
+  *
+  */
+  virtual ~IODevice();
 
-            /*!
-            * \brief Add an IODevice to the logs
-            *
-            * The IODevice will be automatically logged among this IODevice logs,
-            * if logging is enabled (see SetDataToLog(), FrameworkManager::StartLog
-            * and FrameworkManager::AddDeviceToLog). \n
-            * Logging happens when ProcessUpdate() is called. \n
-            * Note that when an IODevice is just added for logs (ie. no parent/child
-            * link between the two IODevice),
-            * UpdateFrom() is not automatically called.
-            *
-            * \param device IODevice to log
-            */
-            void AddDeviceToLog(const IODevice* device);
+  /*!
+  * \brief Add an IODevice to the logs
+  *
+  * The IODevice will be automatically logged among this IODevice logs,
+  * if logging is enabled (see SetDataToLog(), FrameworkManager::StartLog
+  * and FrameworkManager::AddDeviceToLog). \n
+  * Logging happens when ProcessUpdate() is called. \n
+  * Note that when an IODevice is just added for logs (ie. no parent/child
+  * link between the two IODevice),
+  * UpdateFrom() is not automatically called.
+  *
+  * \param device IODevice to log
+  */
+  void AddDeviceToLog(const IODevice *device);
 
-            /*!
-            * \brief Add an io_data to the log
-            *
-            * The io_data will be automatically logged if enabled (see FrameworkManager::StartLog
-            * and FrameworkManager::AddDeviceToLog),
-            * during call to ProcessUpdate().
-            *
-            * \param data data to log
-            */
-            void AddDataToLog(const io_data* data);
+  /*!
+  * \brief Add an io_data to the log
+  *
+  * The io_data will be automatically logged if enabled (see
+  *FrameworkManager::StartLog
+  * and FrameworkManager::AddDeviceToLog),
+  * during call to ProcessUpdate().
+  *
+  * \param data data to log
+  */
+  void AddDataToLog(const io_data *data);
 
-            /*!
-            * \brief Send the output to a shared memory
-            *
-            * Use this method to output log datas to a shared memory.
-            * This can be usefull to get datas from an external progam. \n
-            * Output happens when ProcessUpdate() is called. \n
-            * The name and the structure of the shared memory will be displayed when
-            * this method is called with true as argument. \n
-            * By default it is not enabled.
-            *
-            *
-            * \param enabled true to enable the output, false otherwise
-            */
-            void OutputToShMem(bool enabled);
+  /*!
+  * \brief Send the output to a shared memory
+  *
+  * Use this method to output log datas to a shared memory.
+  * This can be usefull to get datas from an external progam. \n
+  * Output happens when ProcessUpdate() is called. \n
+  * The name and the structure of the shared memory will be displayed when
+  * this method is called with true as argument. \n
+  * By default it is not enabled.
+  *
+  *
+  * \param enabled true to enable the output, false otherwise
+  */
+  void OutputToShMem(bool enabled);
 
-            //TODO: these 2 method should be pure virtual
-            virtual DataType const &GetInputDataType() const;
-            virtual DataType const &GetOutputDataType() const;
+  // TODO: these 2 method should be pure virtual
+  virtual DataType const &GetInputDataType() const;
+  virtual DataType const &GetOutputDataType() const;
 
-        protected:
-            /*!
-            * \brief Process the childs of type IODevice, and log if needed
-            *
-            * This method must be called after computing datas;
-            * generally at the end of the reimplemented UpdateFrom or after acquiring datas in case of a sensor. \n
-            * It will call UpdateFrom methods of each child of type IODevice,
-            * and log all datas (this IODevice and its childs)
-            * if logging is enabled (see SetDataToLog(), AddDeviceToLog(),
-            * FrameworkManager::StartLog and FrameworkManager::AddDeviceToLog). \n
-            * If a thread is waiting on this IODevice (see Thread::WaitUpdate), it will be resumed.
-            *
-            * \param data data to process
-            */
-            void ProcessUpdate(io_data* data);
+protected:
+  /*!
+  * \brief Process the childs of type IODevice, and log if needed
+  *
+  * This method must be called after computing datas;
+  * generally at the end of the reimplemented UpdateFrom or after acquiring
+  *datas in case of a sensor. \n
+  * It will call UpdateFrom methods of each child of type IODevice,
+  * and log all datas (this IODevice and its childs)
+  * if logging is enabled (see SetDataToLog(), AddDeviceToLog(),
+  * FrameworkManager::StartLog and FrameworkManager::AddDeviceToLog). \n
+  * If a thread is waiting on this IODevice (see Thread::WaitUpdate), it will be
+  *resumed.
+  *
+  * \param data data to process
+  */
+  void ProcessUpdate(io_data *data);
 
-        private:
-            /*!
-            * \brief Update using provided datas
-            *
-            * This method is automatically called by ProcessUpdate()
-            * of the Object::Parent's if its Object::ObjectType is "IODevice". \n
-            * This method must be reimplemented, in order to process the data from the parent.
-            *
-            * \param data data from the parent to process
-            */
-            virtual void UpdateFrom(const io_data *data)=0;
+private:
+  /*!
+  * \brief Update using provided datas
+  *
+  * This method is automatically called by ProcessUpdate()
+  * of the Object::Parent's if its Object::ObjectType is "IODevice". \n
+  * This method must be reimplemented, in order to process the data from the
+  *parent.
+  *
+  * \param data data from the parent to process
+  */
+  virtual void UpdateFrom(const io_data *data) = 0;
 
-            class IODevice_impl* pimpl_;
-    };
+  class IODevice_impl *pimpl_;
+};
 
 } // end namespace core
Index: trunk/lib/FlairCore/src/IODevice_impl.cpp
===================================================================
--- trunk/lib/FlairCore/src/IODevice_impl.cpp	(revision 14)
+++ trunk/lib/FlairCore/src/IODevice_impl.cpp	(revision 15)
@@ -31,12 +31,12 @@
 using namespace flair::core;
 
-IODevice_impl::IODevice_impl(const IODevice* self) {
-    this->self=self;
-    thread_to_wake=NULL;
-    wake_mutex= new Mutex(self);
-    framework_impl=::getFrameworkManagerImpl();
-    framework=getFrameworkManager();
-    tobelogged=false;
-    outputtoshm=false;
+IODevice_impl::IODevice_impl(const IODevice *self) {
+  this->self = self;
+  thread_to_wake = NULL;
+  wake_mutex = new Mutex(self);
+  framework_impl = ::getFrameworkManagerImpl();
+  framework = getFrameworkManager();
+  tobelogged = false;
+  outputtoshm = false;
 }
 
@@ -44,176 +44,187 @@
 
 void IODevice_impl::OutputToShMem(bool enabled) {
-    if(framework->IsLogging()) {
-        self->Err("impossible while logging\n");
+  if (framework->IsLogging()) {
+    self->Err("impossible while logging\n");
+  } else {
+    if (LogSize() == 0) {
+      self->Warn("log size is null, not enabling output to shared memory.");
+      return;
+    }
+
+    if (enabled) {
+      string dev_name =
+          getFrameworkManager()->ObjectName() + "-" + self->ObjectName();
+      shmem = new SharedMem(self, dev_name.c_str(), LogSize());
+      outputtoshm = true;
+
+      Printf("Created %s shared memory for object %s; size: %i\n",
+             dev_name.c_str(), self->ObjectName().c_str(), LogSize());
+      PrintLogsDescriptors();
     } else {
-        if(LogSize()==0) {
-            self->Warn("log size is null, not enabling output to shared memory.");
-            return;
-        }
-
-        if(enabled) {
-            string dev_name=getFrameworkManager()->ObjectName()+ "-" + self->ObjectName();
-            shmem=new SharedMem(self,dev_name.c_str(),LogSize());
-            outputtoshm=true;
-
-            Printf("Created %s shared memory for object %s; size: %i\n",dev_name.c_str(),self->ObjectName().c_str(),LogSize());
-            PrintLogsDescriptors();
-        } else {
-            outputtoshm=false;
-            delete shmem;
-        }
+      outputtoshm = false;
+      delete shmem;
     }
+  }
 }
 
 void IODevice_impl::PrintLogsDescriptors(void) {
-    //own logs
-    for(size_t i=0;i<datasToLog.size();i++) datasToLog.at(i)->pimpl_->PrintLogDescriptor();
-    //childs logs
-    for(size_t i=0;i<self->TypeChilds()->size();i++) ((IODevice*)self->TypeChilds()->at(i))->pimpl_->PrintLogsDescriptors();
-    //manually added logs
-    for(size_t i=0;i<devicesToLog.size();i++) devicesToLog.at(i)->pimpl_->PrintLogsDescriptors();
+  // own logs
+  for (size_t i = 0; i < datasToLog.size(); i++)
+    datasToLog.at(i)->pimpl_->PrintLogDescriptor();
+  // childs logs
+  for (size_t i = 0; i < self->TypeChilds()->size(); i++)
+    ((IODevice *)self->TypeChilds()->at(i))->pimpl_->PrintLogsDescriptors();
+  // manually added logs
+  for (size_t i = 0; i < devicesToLog.size(); i++)
+    devicesToLog.at(i)->pimpl_->PrintLogsDescriptors();
 }
 
 void IODevice_impl::WriteToShMem(void) {
-    if(outputtoshm) {
-        size_t size=LogSize();
-
-        char* buf=framework_impl->GetBuffer(size);
-        char* buf_orig=buf;
-        if(buf==NULL) {
-            self->Err("err GetBuffer\n");
-            return;
-        }
-
-        AppendLog(&buf);
-
-        shmem->Write(buf_orig,size);
-        framework_impl->ReleaseBuffer(buf_orig);
+  if (outputtoshm) {
+    size_t size = LogSize();
+
+    char *buf = framework_impl->GetBuffer(size);
+    char *buf_orig = buf;
+    if (buf == NULL) {
+      self->Err("err GetBuffer\n");
+      return;
     }
-}
-
-void IODevice_impl::AddDeviceToLog(const IODevice* device) {
-    if(framework->IsLogging()) {
-        self->Err("impossible while logging\n");
-    } else {
-        devicesToLog.push_back(device);
-    }
+
+    AppendLog(&buf);
+
+    shmem->Write(buf_orig, size);
+    framework_impl->ReleaseBuffer(buf_orig);
+  }
+}
+
+void IODevice_impl::AddDeviceToLog(const IODevice *device) {
+  if (framework->IsLogging()) {
+    self->Err("impossible while logging\n");
+  } else {
+    devicesToLog.push_back(device);
+  }
 }
 
 bool IODevice_impl::SetToBeLogged(void) {
-    if(!tobelogged) {
-        tobelogged=true;
-        return true;
-    } else {
-        self->Warn("already added to log\n");
-        return false;
-    }
-}
-
-void IODevice_impl::WriteLogsDescriptors(fstream& desc_file,int *index) {
-    //own descriptor
-    for(size_t i=0;i<datasToLog.size();i++) datasToLog.at(i)->pimpl_->WriteLogDescriptor(desc_file,index);
-    //childs descriptors
-    for(size_t i=0;i<self->TypeChilds()->size();i++) ((IODevice*)self->TypeChilds()->at(i))->pimpl_->WriteLogsDescriptors(desc_file,index);
-    //manually added logs
-    for(size_t i=0;i<devicesToLog.size();i++) devicesToLog.at(i)->pimpl_->WriteLogsDescriptors(desc_file,index);
+  if (!tobelogged) {
+    tobelogged = true;
+    return true;
+  } else {
+    self->Warn("already added to log\n");
+    return false;
+  }
+}
+
+void IODevice_impl::WriteLogsDescriptors(fstream &desc_file, int *index) {
+  // own descriptor
+  for (size_t i = 0; i < datasToLog.size(); i++)
+    datasToLog.at(i)->pimpl_->WriteLogDescriptor(desc_file, index);
+  // childs descriptors
+  for (size_t i = 0; i < self->TypeChilds()->size(); i++)
+    ((IODevice *)self->TypeChilds()->at(i))
+        ->pimpl_->WriteLogsDescriptors(desc_file, index);
+  // manually added logs
+  for (size_t i = 0; i < devicesToLog.size(); i++)
+    devicesToLog.at(i)->pimpl_->WriteLogsDescriptors(desc_file, index);
 }
 
 void IODevice_impl::ResumeThread(void) {
-    wake_mutex->GetMutex();
-    if(thread_to_wake!=NULL) {
-        thread_to_wake->Resume();
-        thread_to_wake=NULL;
-    }
-    wake_mutex->ReleaseMutex();
-}
-
-void IODevice_impl::AddDataToLog(const io_data* data) {
-    if(framework->IsLogging()) {
-        self->Err("impossible while logging\n");
-    } else {
-        datasToLog.push_back(data);
-    }
+  wake_mutex->GetMutex();
+  if (thread_to_wake != NULL) {
+    thread_to_wake->Resume();
+    thread_to_wake = NULL;
+  }
+  wake_mutex->ReleaseMutex();
+}
+
+void IODevice_impl::AddDataToLog(const io_data *data) {
+  if (framework->IsLogging()) {
+    self->Err("impossible while logging\n");
+  } else {
+    datasToLog.push_back(data);
+  }
 }
 
 size_t IODevice_impl::LogSize() const {
-    size_t value=0;
-
-    for(size_t i=0;i<datasToLog.size();i++) {
-        value+=datasToLog.at(i)->GetDataType().GetSize();
-    }
-
-    //childs logs
-    for(size_t i=0;i<self->TypeChilds()->size();i++) {
-        value+=((IODevice*)self->TypeChilds()->at(i))->pimpl_->LogSize();
-    }
-    //manually added logs
-    for(size_t i=0;i<devicesToLog.size();i++) {
-        value+=devicesToLog.at(i)->pimpl_->LogSize();
-    }
-
-    return value;
+  size_t value = 0;
+
+  for (size_t i = 0; i < datasToLog.size(); i++) {
+    value += datasToLog.at(i)->GetDataType().GetSize();
+  }
+
+  // childs logs
+  for (size_t i = 0; i < self->TypeChilds()->size(); i++) {
+    value += ((IODevice *)self->TypeChilds()->at(i))->pimpl_->LogSize();
+  }
+  // manually added logs
+  for (size_t i = 0; i < devicesToLog.size(); i++) {
+    value += devicesToLog.at(i)->pimpl_->LogSize();
+  }
+
+  return value;
 }
 
 void IODevice_impl::WriteLog(Time time) {
-    if(tobelogged==false) return;
-
-    size_t size=LogSize();
-
-    char* buf=framework_impl->GetBuffer(sizeof(FrameworkManager_impl::log_header_t)+size);
-    char* buf_orig=buf;
-    if(buf==NULL) {
-        self->Err("err GetBuffer\n");
-        return;
-    }
-
-    FrameworkManager_impl::log_header_t header;
-    header.device=self;
-    header.size=size;
-    header.time=time;
-
-    memcpy(buf,&header,sizeof(FrameworkManager_impl::log_header_t));
-    buf+=sizeof(FrameworkManager_impl::log_header_t);
-    AppendLog(&buf);
-
-    framework_impl->WriteLog(buf_orig,sizeof(FrameworkManager_impl::log_header_t)+size);
-    framework_impl->ReleaseBuffer(buf_orig);
-}
-
-void IODevice_impl::AppendLog(char** ptr)
-{
-    //Printf("AppendLog %s %x\n",self->ObjectName().c_str(),*ptr);
-
-    //copy state to buf
-    for(size_t i=0;i<datasToLog.size();i++) {
-        //printf("copy\n");
-        datasToLog.at(i)->CopyDatas(*ptr);
-        (*ptr)+=datasToLog.at(i)->GetDataType().GetSize();
-    }
-
-    //copy linked states to buf
-    for(size_t i=0;i<self->TypeChilds()->size();i++) {
-        ((IODevice*)self->TypeChilds()->at(i))->pimpl_->AppendLog(ptr);
-    }
-    //copy manually added logs to buf
-    for(size_t i=0;i<devicesToLog.size();i++) {
-        devicesToLog.at(i)->pimpl_->AppendLog(ptr);
-        //devices.at(i)->DataToLog()->CopyDatas(*ptr);
-        //(*ptr)+=devices.at(i)->DataToLog()->Size();
-    }
-    //Printf("AppendLog %s ok\n",self->ObjectName().c_str());
-}
-
-int IODevice_impl::SetToWake(const Thread* thread) {
-    int status=0;
-
-    wake_mutex->GetMutex();
-    if(thread_to_wake==NULL) {
-        thread_to_wake=(Thread*)thread;
-    } else {
-        status=-1;
-    }
-    wake_mutex->ReleaseMutex();
-
-    return status;
-}
+  if (tobelogged == false)
+    return;
+
+  size_t size = LogSize();
+
+  char *buf = framework_impl->GetBuffer(
+      sizeof(FrameworkManager_impl::log_header_t) + size);
+  char *buf_orig = buf;
+  if (buf == NULL) {
+    self->Err("err GetBuffer\n");
+    return;
+  }
+
+  FrameworkManager_impl::log_header_t header;
+  header.device = self;
+  header.size = size;
+  header.time = time;
+
+  memcpy(buf, &header, sizeof(FrameworkManager_impl::log_header_t));
+  buf += sizeof(FrameworkManager_impl::log_header_t);
+  AppendLog(&buf);
+
+  framework_impl->WriteLog(buf_orig,
+                           sizeof(FrameworkManager_impl::log_header_t) + size);
+  framework_impl->ReleaseBuffer(buf_orig);
+}
+
+void IODevice_impl::AppendLog(char **ptr) {
+  // Printf("AppendLog %s %x\n",self->ObjectName().c_str(),*ptr);
+
+  // copy state to buf
+  for (size_t i = 0; i < datasToLog.size(); i++) {
+    // printf("copy\n");
+    datasToLog.at(i)->CopyDatas(*ptr);
+    (*ptr) += datasToLog.at(i)->GetDataType().GetSize();
+  }
+
+  // copy linked states to buf
+  for (size_t i = 0; i < self->TypeChilds()->size(); i++) {
+    ((IODevice *)self->TypeChilds()->at(i))->pimpl_->AppendLog(ptr);
+  }
+  // copy manually added logs to buf
+  for (size_t i = 0; i < devicesToLog.size(); i++) {
+    devicesToLog.at(i)->pimpl_->AppendLog(ptr);
+    // devices.at(i)->DataToLog()->CopyDatas(*ptr);
+    //(*ptr)+=devices.at(i)->DataToLog()->Size();
+  }
+  // Printf("AppendLog %s ok\n",self->ObjectName().c_str());
+}
+
+int IODevice_impl::SetToWake(const Thread *thread) {
+  int status = 0;
+
+  wake_mutex->GetMutex();
+  if (thread_to_wake == NULL) {
+    thread_to_wake = (Thread *)thread;
+  } else {
+    status = -1;
+  }
+  wake_mutex->ReleaseMutex();
+
+  return status;
+}
Index: trunk/lib/FlairCore/src/ImuData.cpp
===================================================================
--- trunk/lib/FlairCore/src/ImuData.cpp	(revision 14)
+++ trunk/lib/FlairCore/src/ImuData.cpp	(revision 15)
@@ -24,225 +24,227 @@
 using std::string;
 
-namespace flair { namespace core {
+namespace flair {
+namespace core {
 
 /*! \class ImuDataElement
     */
-    class ImuDataElement: public IODataElement {
-        public:
-
-            ImuDataElement(const ImuData *inImudata,string name,ImuData::PlotableData_t inPlotableData):IODataElement(inImudata,name) {
-                imudata=inImudata;
-                plotableData=inPlotableData;
-
-                size=4;
-            }
-
-            ~ImuDataElement() {}
-
-            void CopyData(char* dst) const {
-                float data;
-                Vector3D rawAcc=imudata->GetRawAcc();
-                Vector3D rawMag=imudata->GetRawMag();
-                Vector3D rawGyr=imudata->GetRawGyr();
-                switch(plotableData) {
-                case ImuData::RawAx:
-                    data=rawAcc.x;
-                    break;
-                case ImuData::RawAy:
-                    data=rawAcc.y;
-                    break;
-                case ImuData::RawAz:
-                    data=rawAcc.z;
-                    break;
-                case ImuData::RawGx:
-                    data=rawGyr.x;
-                    break;
-                case ImuData::RawGy:
-                    data=rawGyr.y;
-                    break;
-                case ImuData::RawGz:
-                    data=rawGyr.z;
-                    break;
-                case ImuData::RawGxDeg:
-                    data=Euler::ToDegree(rawGyr.x);
-                    break;
-                case ImuData::RawGyDeg:
-                    data=Euler::ToDegree(rawGyr.y);
-                    break;
-                case ImuData::RawGzDeg:
-                    data=Euler::ToDegree(rawGyr.z);
-                    break;
-                case ImuData::RawMx:
-                    data=rawMag.x;
-                    break;
-                case ImuData::RawMy:
-                    data=rawMag.y;
-                    break;
-                case ImuData::RawMz:
-                    data=rawMag.z;
-                    break;
-                default:
-                    imudata->Err("data type unavailable.\n");
-                    data=0;
-                    break;
-                }
-
-                memcpy(dst,&data,sizeof(float));
-            }
-
-            FloatType const &GetDataType(void) const {
-                return dataType;
-            }
-
-        private:
-            const ImuData *imudata;
-            ImuData::PlotableData_t plotableData;
-            FloatType dataType;
-
-    };
-
-ImuData::ImuData(const Object* parent,std::string name,int n): io_data(parent,name,n),dataType(floatType) {
-    if(n>1) Warn("n>1 not supported\n");
-
-    AppendLogDescription("raw_ax",floatType);
-    AppendLogDescription("raw_ay",floatType);
-    AppendLogDescription("raw_az",floatType);
-
-    AppendLogDescription("raw_gx",floatType);
-    AppendLogDescription("raw_gy",floatType);
-    AppendLogDescription("raw_gz",floatType);
-
-    AppendLogDescription("raw_mx",floatType);
-    AppendLogDescription("raw_my",floatType);
-    AppendLogDescription("raw_mz",floatType);
-
+class ImuDataElement : public IODataElement {
+public:
+  ImuDataElement(const ImuData *inImudata, string name,
+                 ImuData::PlotableData_t inPlotableData)
+      : IODataElement(inImudata, name) {
+    imudata = inImudata;
+    plotableData = inPlotableData;
+
+    size = 4;
+  }
+
+  ~ImuDataElement() {}
+
+  void CopyData(char *dst) const {
+    float data;
+    Vector3D rawAcc = imudata->GetRawAcc();
+    Vector3D rawMag = imudata->GetRawMag();
+    Vector3D rawGyr = imudata->GetRawGyr();
+    switch (plotableData) {
+    case ImuData::RawAx:
+      data = rawAcc.x;
+      break;
+    case ImuData::RawAy:
+      data = rawAcc.y;
+      break;
+    case ImuData::RawAz:
+      data = rawAcc.z;
+      break;
+    case ImuData::RawGx:
+      data = rawGyr.x;
+      break;
+    case ImuData::RawGy:
+      data = rawGyr.y;
+      break;
+    case ImuData::RawGz:
+      data = rawGyr.z;
+      break;
+    case ImuData::RawGxDeg:
+      data = Euler::ToDegree(rawGyr.x);
+      break;
+    case ImuData::RawGyDeg:
+      data = Euler::ToDegree(rawGyr.y);
+      break;
+    case ImuData::RawGzDeg:
+      data = Euler::ToDegree(rawGyr.z);
+      break;
+    case ImuData::RawMx:
+      data = rawMag.x;
+      break;
+    case ImuData::RawMy:
+      data = rawMag.y;
+      break;
+    case ImuData::RawMz:
+      data = rawMag.z;
+      break;
+    default:
+      imudata->Err("data type unavailable.\n");
+      data = 0;
+      break;
+    }
+
+    memcpy(dst, &data, sizeof(float));
+  }
+
+  FloatType const &GetDataType(void) const { return dataType; }
+
+private:
+  const ImuData *imudata;
+  ImuData::PlotableData_t plotableData;
+  FloatType dataType;
+};
+
+ImuData::ImuData(const Object *parent, std::string name, int n)
+    : io_data(parent, name, n), dataType(floatType) {
+  if (n > 1)
+    Warn("n>1 not supported\n");
+
+  AppendLogDescription("raw_ax", floatType);
+  AppendLogDescription("raw_ay", floatType);
+  AppendLogDescription("raw_az", floatType);
+
+  AppendLogDescription("raw_gx", floatType);
+  AppendLogDescription("raw_gy", floatType);
+  AppendLogDescription("raw_gz", floatType);
+
+  AppendLogDescription("raw_mx", floatType);
+  AppendLogDescription("raw_my", floatType);
+  AppendLogDescription("raw_mz", floatType);
 }
 
 ImuData::~ImuData() {}
 
-
 Vector3D ImuData::GetRawAcc(void) const {
-    Vector3D out;
-    GetMutex();
-    out=rawAcc;
-    ReleaseMutex();
-    return out;
+  Vector3D out;
+  GetMutex();
+  out = rawAcc;
+  ReleaseMutex();
+  return out;
 }
 
 Vector3D ImuData::GetRawMag(void) const {
-    Vector3D out;
-    GetMutex();
-    out=rawMag;
-    ReleaseMutex();
-    return out;
+  Vector3D out;
+  GetMutex();
+  out = rawMag;
+  ReleaseMutex();
+  return out;
 }
 
 Vector3D ImuData::GetRawGyr(void) const {
-    Vector3D out;
-    GetMutex();
-    out=rawGyr;
-    ReleaseMutex();
-    return out;
-}
-
-void ImuData::GetRawAccMagAndGyr(Vector3D &inRawAcc,Vector3D &inRawMag,Vector3D &inRawGyr) const {
-    GetMutex();
-    inRawAcc=rawAcc;
-    inRawMag=rawMag;
-    inRawGyr=rawGyr;
-    ReleaseMutex();
+  Vector3D out;
+  GetMutex();
+  out = rawGyr;
+  ReleaseMutex();
+  return out;
+}
+
+void ImuData::GetRawAccMagAndGyr(Vector3D &inRawAcc, Vector3D &inRawMag,
+                                 Vector3D &inRawGyr) const {
+  GetMutex();
+  inRawAcc = rawAcc;
+  inRawMag = rawMag;
+  inRawGyr = rawGyr;
+  ReleaseMutex();
 }
 
 void ImuData::SetRawAcc(const Vector3D &inRawAcc) {
-    GetMutex();
-    rawAcc=inRawAcc;
-    ReleaseMutex();
+  GetMutex();
+  rawAcc = inRawAcc;
+  ReleaseMutex();
 }
 
 void ImuData::SetRawMag(const Vector3D &inRawMag) {
-    GetMutex();
-    rawMag=inRawMag;
-    ReleaseMutex();
+  GetMutex();
+  rawMag = inRawMag;
+  ReleaseMutex();
 }
 
 void ImuData::SetRawGyr(const Vector3D &inRawGyr) {
-    GetMutex();
-    rawGyr=inRawGyr;
-    ReleaseMutex();
-}
-
-void ImuData::SetRawAccMagAndGyr(const Vector3D &inRawAcc,const Vector3D &inRawMag,const Vector3D &inRawGyr) {
-    GetMutex();
-    rawAcc=inRawAcc;
-    rawMag=inRawMag;
-    rawGyr=inRawGyr;
-    ReleaseMutex();
-}
-
-IODataElement* ImuData::Element(PlotableData_t data_type) const {
-    string name;
-    switch(data_type) {
-    case ImuData::RawAx:
-        name="RawAx";
-        break;
-    case ImuData::RawAy:
-        name="RawAy";
-        break;
-    case ImuData::RawAz:
-        name="RawAz";
-        break;
-    case ImuData::RawGx:
-        name="RawGx";
-        break;
-    case ImuData::RawGy:
-        name="RawGy";
-        break;
-    case ImuData::RawGz:
-        name="RawGz";
-        break;
-    case ImuData::RawGxDeg:
-        name="RawGx degree";
-        break;
-    case ImuData::RawGyDeg:
-        name="RawGy degree";
-        break;
-    case ImuData::RawGzDeg:
-        name="RawGz degree";
-        break;
-    case ImuData::RawMx:
-        name="RawMx";
-        break;
-    case ImuData::RawMy:
-        name="RawMy";
-        break;
-    case ImuData::RawMz:
-        name="RawMz";
-        break;
-    }
-
-    return new ImuDataElement(this,name,data_type);
-}
-
-void ImuData::CopyDatas(char* dst) const {
-    GetMutex();
-
-    Queue(&dst,&rawAcc.x,sizeof(rawAcc.x));
-    Queue(&dst,&rawAcc.y,sizeof(rawAcc.y));
-    Queue(&dst,&rawAcc.z,sizeof(rawAcc.z));
-
-    Queue(&dst,&rawGyr.x,sizeof(rawGyr.x));
-    Queue(&dst,&rawGyr.y,sizeof(rawGyr.y));
-    Queue(&dst,&rawGyr.z,sizeof(rawGyr.z));
-
-    Queue(&dst,&rawMag.x,sizeof(rawMag.x));
-    Queue(&dst,&rawMag.y,sizeof(rawMag.y));
-    Queue(&dst,&rawMag.z,sizeof(rawMag.z));
-
-    ReleaseMutex();
-}
-
-void ImuData::Queue(char** dst,const void *src,size_t size) const {
-    memcpy(*dst,src,size);
-    *dst+=size;
+  GetMutex();
+  rawGyr = inRawGyr;
+  ReleaseMutex();
+}
+
+void ImuData::SetRawAccMagAndGyr(const Vector3D &inRawAcc,
+                                 const Vector3D &inRawMag,
+                                 const Vector3D &inRawGyr) {
+  GetMutex();
+  rawAcc = inRawAcc;
+  rawMag = inRawMag;
+  rawGyr = inRawGyr;
+  ReleaseMutex();
+}
+
+IODataElement *ImuData::Element(PlotableData_t data_type) const {
+  string name;
+  switch (data_type) {
+  case ImuData::RawAx:
+    name = "RawAx";
+    break;
+  case ImuData::RawAy:
+    name = "RawAy";
+    break;
+  case ImuData::RawAz:
+    name = "RawAz";
+    break;
+  case ImuData::RawGx:
+    name = "RawGx";
+    break;
+  case ImuData::RawGy:
+    name = "RawGy";
+    break;
+  case ImuData::RawGz:
+    name = "RawGz";
+    break;
+  case ImuData::RawGxDeg:
+    name = "RawGx degree";
+    break;
+  case ImuData::RawGyDeg:
+    name = "RawGy degree";
+    break;
+  case ImuData::RawGzDeg:
+    name = "RawGz degree";
+    break;
+  case ImuData::RawMx:
+    name = "RawMx";
+    break;
+  case ImuData::RawMy:
+    name = "RawMy";
+    break;
+  case ImuData::RawMz:
+    name = "RawMz";
+    break;
+  }
+
+  return new ImuDataElement(this, name, data_type);
+}
+
+void ImuData::CopyDatas(char *dst) const {
+  GetMutex();
+
+  Queue(&dst, &rawAcc.x, sizeof(rawAcc.x));
+  Queue(&dst, &rawAcc.y, sizeof(rawAcc.y));
+  Queue(&dst, &rawAcc.z, sizeof(rawAcc.z));
+
+  Queue(&dst, &rawGyr.x, sizeof(rawGyr.x));
+  Queue(&dst, &rawGyr.y, sizeof(rawGyr.y));
+  Queue(&dst, &rawGyr.z, sizeof(rawGyr.z));
+
+  Queue(&dst, &rawMag.x, sizeof(rawMag.x));
+  Queue(&dst, &rawMag.y, sizeof(rawMag.y));
+  Queue(&dst, &rawMag.z, sizeof(rawMag.z));
+
+  ReleaseMutex();
+}
+
+void ImuData::Queue(char **dst, const void *src, size_t size) const {
+  memcpy(*dst, src, size);
+  *dst += size;
 }
 
Index: trunk/lib/FlairCore/src/ImuData.h
===================================================================
--- trunk/lib/FlairCore/src/ImuData.h	(revision 14)
+++ trunk/lib/FlairCore/src/ImuData.h	(revision 15)
@@ -17,190 +17,203 @@
 #include <Vector3D.h>
 
-namespace flair { namespace core {
-
-    /*! \class ImuData
-    *
-    * \brief Class defining IMU datas
-    *
-    * IMU (inertial measurement unit) datas consist of raw accelerometer values, raw gyrometer values
-    * and raw magnetometer values.
-    *
-    */
-    class ImuData: public io_data {
-        public:
-            class Type: public DataType {
-            public:
-                Type(ScalarType const &_elementDataType):
-                    elementDataType(_elementDataType){}
-                ScalarType const &GetElementDataType() const {return elementDataType;}
-                std::string GetDescription() const {return "imu data";}
-                size_t GetSize() const {
-                    size_t size=0;
-                    size+=3*elementDataType.GetSize();//RawAcc
-                    size+=3*elementDataType.GetSize();//RawGyr
-                    size+=3*elementDataType.GetSize();//RawMag
-                    return size;
-                }
-            private:
-                ScalarType const &elementDataType;
-            };
-
-            /*!
-            \enum PlotableData_t
-            \brief Datas wich can be plotted in a DataPlot1D
-            */
-            typedef enum {
-                RawAx/*! x raw accelerometer */, RawAy/*! y raw accelerometer */ ,RawAz/*! z raw accelerometer */,
-                RawGx/*! x raw gyrometer */,RawGy/*! y raw gyrometer */,RawGz/*! z raw gyrometer */,
-                RawGxDeg/*! x raw gyrometer degree */,RawGyDeg/*! y raw gyrometer degree */,RawGzDeg/*! z raw gyrometer degree */,
-                RawMx/*! x raw magnetometer */,RawMy/*! y raw magnetometer */,RawMz/*! z raw magnetometer */
-                } PlotableData_t;
-
-            /*!
-            * \brief Constructor
-            *
-            * Construct an io_data representing IMU datas. \n
-            *
-            * \param parent parent
-            * \param name name
-            * \param n number of samples
-            */
-            ImuData(const Object* parent,std::string name="",int n=1);
-
-            /*!
-            * \brief Destructor
-            *
-            */
-            ~ImuData();
-
-            /*!
-            * \brief Element
-            *
-            * Get a pointer to a specific element. This pointer can be used for plotting.
-            *
-            * \param data_type data type
-            *
-            * \return pointer to the element
-            */
-            IODataElement* Element(PlotableData_t data_type) const;
-
-            /*!
-            * \brief Get raw accelerations
-            *
-            * This method is mutex protected.
-            *
-            * \return raw accelerations
-            *
-            */
-            Vector3D GetRawAcc(void) const;
-
-            /*!
-            * \brief Get raw magnetometers
-            *
-            * This method is mutex protected.
-            *
-            * \return raw magnetometers
-            *
-            */
-            Vector3D GetRawMag(void) const;
-
-            /*!
-            * \brief Get raw angular speed
-            *
-            * This method is mutex protected.
-            *
-            * \return raw angular speed
-            *
-            */
-            Vector3D GetRawGyr(void) const;
-
-            /*!
-            * \brief Get raw accelerations, magnetometers and angular speeds
-            *
-            * This method is mutex protected.
-            *
-            * \param rawAcc raw accelerations
-            * \param rawMag raw magnetometers
-            * \param rawGyr raw angular speeds
-            *
-            */
-            void GetRawAccMagAndGyr(Vector3D &rawAcc,Vector3D &rawMag,Vector3D &rawGyr) const;
-
-            /*!
-            * \brief Set raw accelerations
-            *
-            * This method is mutex protected.
-            *
-            * \param raw accelerations
-            *
-            */
-            void SetRawAcc(const Vector3D &rawAcc);
-
-            /*!
-            * \brief Set raw magnetometers
-            *
-            * This method is mutex protected.
-            *
-            * \param raw magnetometers
-            *
-            */
-            void SetRawMag(const Vector3D &rawMag);
-
-            /*!
-            * \brief Set raw angular speed
-            *
-            * This method is mutex protected.
-            *
-            * \param raw angular speed
-            *
-            */
-            void SetRawGyr(const Vector3D &rawGyr);
-
-            /*!
-            * \brief Set raw accelerations, magnetometers and angular speeds
-            *
-            * This method is mutex protected.
-            *
-            * \param rawAcc raw accelerations
-            * \param rawMag raw magnetometers
-            * \param rawGyr raw angular speeds
-            *
-            */
-            void SetRawAccMagAndGyr(const Vector3D &rawAcc,const Vector3D &rawMag,const Vector3D &rawGyr);
-
-            Type const&GetDataType() const {return dataType;}
-        private:
-            /*!
-            * \brief Copy datas
-            *
-            * Reimplemented from io_data. \n
-            * See io_data::CopyDatas.
-            *
-            * \param dst destination buffer
-            */
-            void CopyDatas(char* dst) const;
-
-            /*!
-            * \brief Raw accelerometer
-            *
-            */
-            Vector3D rawAcc;
-
-            /*!
-            * \brief Raw gyrometer
-            *
-            */
-            Vector3D rawGyr;
-
-            /*!
-            * \brief Raw magnetometer
-            *
-            */
-            Vector3D rawMag;
-
-            void Queue(char** dst,const void *src,size_t size) const;
-            Type dataType;
-
-    };
+namespace flair {
+namespace core {
+
+/*! \class ImuData
+*
+* \brief Class defining IMU datas
+*
+* IMU (inertial measurement unit) datas consist of raw accelerometer values, raw
+*gyrometer values
+* and raw magnetometer values.
+*
+*/
+class ImuData : public io_data {
+public:
+  class Type : public DataType {
+  public:
+    Type(ScalarType const &_elementDataType)
+        : elementDataType(_elementDataType) {}
+    ScalarType const &GetElementDataType() const { return elementDataType; }
+    std::string GetDescription() const { return "imu data"; }
+    size_t GetSize() const {
+      size_t size = 0;
+      size += 3 * elementDataType.GetSize(); // RawAcc
+      size += 3 * elementDataType.GetSize(); // RawGyr
+      size += 3 * elementDataType.GetSize(); // RawMag
+      return size;
+    }
+
+  private:
+    ScalarType const &elementDataType;
+  };
+
+  /*!
+  \enum PlotableData_t
+  \brief Datas wich can be plotted in a DataPlot1D
+  */
+  typedef enum {
+    RawAx /*! x raw accelerometer */,
+    RawAy /*! y raw accelerometer */,
+    RawAz /*! z raw accelerometer */,
+    RawGx /*! x raw gyrometer */,
+    RawGy /*! y raw gyrometer */,
+    RawGz /*! z raw gyrometer */,
+    RawGxDeg /*! x raw gyrometer degree */,
+    RawGyDeg /*! y raw gyrometer degree */,
+    RawGzDeg /*! z raw gyrometer degree */,
+    RawMx /*! x raw magnetometer */,
+    RawMy /*! y raw magnetometer */,
+    RawMz /*! z raw magnetometer */
+  } PlotableData_t;
+
+  /*!
+  * \brief Constructor
+  *
+  * Construct an io_data representing IMU datas. \n
+  *
+  * \param parent parent
+  * \param name name
+  * \param n number of samples
+  */
+  ImuData(const Object *parent, std::string name = "", int n = 1);
+
+  /*!
+  * \brief Destructor
+  *
+  */
+  ~ImuData();
+
+  /*!
+  * \brief Element
+  *
+  * Get a pointer to a specific element. This pointer can be used for plotting.
+  *
+  * \param data_type data type
+  *
+  * \return pointer to the element
+  */
+  IODataElement *Element(PlotableData_t data_type) const;
+
+  /*!
+  * \brief Get raw accelerations
+  *
+  * This method is mutex protected.
+  *
+  * \return raw accelerations
+  *
+  */
+  Vector3D GetRawAcc(void) const;
+
+  /*!
+  * \brief Get raw magnetometers
+  *
+  * This method is mutex protected.
+  *
+  * \return raw magnetometers
+  *
+  */
+  Vector3D GetRawMag(void) const;
+
+  /*!
+  * \brief Get raw angular speed
+  *
+  * This method is mutex protected.
+  *
+  * \return raw angular speed
+  *
+  */
+  Vector3D GetRawGyr(void) const;
+
+  /*!
+  * \brief Get raw accelerations, magnetometers and angular speeds
+  *
+  * This method is mutex protected.
+  *
+  * \param rawAcc raw accelerations
+  * \param rawMag raw magnetometers
+  * \param rawGyr raw angular speeds
+  *
+  */
+  void GetRawAccMagAndGyr(Vector3D &rawAcc, Vector3D &rawMag,
+                          Vector3D &rawGyr) const;
+
+  /*!
+  * \brief Set raw accelerations
+  *
+  * This method is mutex protected.
+  *
+  * \param raw accelerations
+  *
+  */
+  void SetRawAcc(const Vector3D &rawAcc);
+
+  /*!
+  * \brief Set raw magnetometers
+  *
+  * This method is mutex protected.
+  *
+  * \param raw magnetometers
+  *
+  */
+  void SetRawMag(const Vector3D &rawMag);
+
+  /*!
+  * \brief Set raw angular speed
+  *
+  * This method is mutex protected.
+  *
+  * \param raw angular speed
+  *
+  */
+  void SetRawGyr(const Vector3D &rawGyr);
+
+  /*!
+  * \brief Set raw accelerations, magnetometers and angular speeds
+  *
+  * This method is mutex protected.
+  *
+  * \param rawAcc raw accelerations
+  * \param rawMag raw magnetometers
+  * \param rawGyr raw angular speeds
+  *
+  */
+  void SetRawAccMagAndGyr(const Vector3D &rawAcc, const Vector3D &rawMag,
+                          const Vector3D &rawGyr);
+
+  Type const &GetDataType() const { return dataType; }
+
+private:
+  /*!
+  * \brief Copy datas
+  *
+  * Reimplemented from io_data. \n
+  * See io_data::CopyDatas.
+  *
+  * \param dst destination buffer
+  */
+  void CopyDatas(char *dst) const;
+
+  /*!
+  * \brief Raw accelerometer
+  *
+  */
+  Vector3D rawAcc;
+
+  /*!
+  * \brief Raw gyrometer
+  *
+  */
+  Vector3D rawGyr;
+
+  /*!
+  * \brief Raw magnetometer
+  *
+  */
+  Vector3D rawMag;
+
+  void Queue(char **dst, const void *src, size_t size) const;
+  Type dataType;
+};
 
 } // end namespace core
Index: trunk/lib/FlairCore/src/Label.cpp
===================================================================
--- trunk/lib/FlairCore/src/Label.cpp	(revision 14)
+++ trunk/lib/FlairCore/src/Label.cpp	(revision 15)
@@ -22,42 +22,39 @@
 using std::string;
 
-namespace flair
-{
-namespace gui
-{
+namespace flair {
+namespace gui {
 
-Label::Label(const LayoutPosition* position,string name,size_t buf_size): Widget(position->getLayout(),name,"Label")
-{
-    SetVolatileXmlProp("row",position->Row());
-    SetVolatileXmlProp("col",position->Col());
+Label::Label(const LayoutPosition *position, string name, size_t buf_size)
+    : Widget(position->getLayout(), name, "Label") {
+  SetVolatileXmlProp("row", position->Row());
+  SetVolatileXmlProp("col", position->Col());
 
-    SendXml();
+  SendXml();
 
-    printf_buffer=(char*)malloc(buf_size);
-    if(printf_buffer==NULL) Err("erreur malloc\n");
+  printf_buffer = (char *)malloc(buf_size);
+  if (printf_buffer == NULL)
+    Err("erreur malloc\n");
 
-    delete position;
+  delete position;
 }
 
-Label::~Label()
-{
-    if(printf_buffer!=NULL) free(printf_buffer);
-    printf_buffer=NULL;
+Label::~Label() {
+  if (printf_buffer != NULL)
+    free(printf_buffer);
+  printf_buffer = NULL;
 }
 
+void Label::SetText(const char *format, ...) {
+  int n;
 
-void Label::SetText(const char * format, ...)
-{
-    int n;
+  va_list args;
+  va_start(args, format);
+  n = vsprintf(printf_buffer, format, args);
+  va_end(args);
+  if (n <= 0)
+    return;
 
-    va_list args;
-    va_start (args, format);
-    n = vsprintf(printf_buffer,format, args);
-    va_end (args);
-    if (n<=0) return;
-
-    SetVolatileXmlProp("value",printf_buffer);
-    SendXml();
-
+  SetVolatileXmlProp("value", printf_buffer);
+  SendXml();
 }
 
Index: trunk/lib/FlairCore/src/Label.h
===================================================================
--- trunk/lib/FlairCore/src/Label.h	(revision 14)
+++ trunk/lib/FlairCore/src/Label.h	(revision 15)
@@ -16,48 +16,47 @@
 #include <Widget.h>
 
-namespace flair
-{
-namespace gui
-{
+namespace flair {
+namespace gui {
 
-    class LayoutPosition;
+class LayoutPosition;
 
-    /*! \class Label
-    *
-    * \brief Class displaying a QLabel on the ground station
-    *
-    */
-    class Label:public Widget
-    {
-        public:
-            /*!
-            * \brief Constructor
-            *
-            * Construct a QLabel at given position. \n
-            * The Label will automatically be child of position->getLayout() Layout. After calling this constructor,
-            * position will be deleted as it is no longer usefull.
-            *
-            * \param parent parent
-            * \param name name
-            * \param buf_size size of the text buffer
-            */
-            Label(const LayoutPosition* position,std::string name,size_t buf_size=255);
+/*! \class Label
+*
+* \brief Class displaying a QLabel on the ground station
+*
+*/
+class Label : public Widget {
+public:
+  /*!
+  * \brief Constructor
+  *
+  * Construct a QLabel at given position. \n
+  * The Label will automatically be child of position->getLayout() Layout. After
+  *calling this constructor,
+  * position will be deleted as it is no longer usefull.
+  *
+  * \param parent parent
+  * \param name name
+  * \param buf_size size of the text buffer
+  */
+  Label(const LayoutPosition *position, std::string name,
+        size_t buf_size = 255);
 
-            /*!
-            * \brief Destructor
-            *
-            */
-            ~Label();
+  /*!
+  * \brief Destructor
+  *
+  */
+  ~Label();
 
-            /*!
-            * \brief Set text
-            *
-            * \param format text string to display, see standard printf
-            */
-            void SetText(const char * format, ...);
+  /*!
+  * \brief Set text
+  *
+  * \param format text string to display, see standard printf
+  */
+  void SetText(const char *format, ...);
 
-        private:
-            char* printf_buffer;
-    };
+private:
+  char *printf_buffer;
+};
 
 } // end namespace gui
Index: trunk/lib/FlairCore/src/Layout.cpp
===================================================================
--- trunk/lib/FlairCore/src/Layout.cpp	(revision 14)
+++ trunk/lib/FlairCore/src/Layout.cpp	(revision 15)
@@ -21,32 +21,24 @@
 using std::string;
 
-namespace flair
-{
-namespace gui
-{
+namespace flair {
+namespace gui {
 
-Layout::Layout(const Widget* parent,string name,string type): Widget(parent,name,type)
-{
-    mutex=new core::Mutex(this,name);
+Layout::Layout(const Widget *parent, string name, string type)
+    : Widget(parent, name, type) {
+  mutex = new core::Mutex(this, name);
 }
 
-Layout::~Layout()
-{
+Layout::~Layout() {}
 
+LayoutPosition *Layout::LastRowLastCol(void) const {
+  return new LayoutPosition(this, -1, 0);
 }
 
-LayoutPosition* Layout::LastRowLastCol(void) const
-{
-    return new LayoutPosition(this,-1,0);
+LayoutPosition *Layout::NewRow(void) const {
+  return new LayoutPosition(this, -1, -1);
 }
 
-LayoutPosition*  Layout::NewRow(void) const
-{
-    return new LayoutPosition(this,-1,-1);
-}
-
-LayoutPosition*  Layout::At(uint16_t row,uint16_t col) const
-{
-    return new LayoutPosition(this,row,col);
+LayoutPosition *Layout::At(uint16_t row, uint16_t col) const {
+  return new LayoutPosition(this, row, col);
 }
 
Index: trunk/lib/FlairCore/src/Layout.h
===================================================================
--- trunk/lib/FlairCore/src/Layout.h	(revision 14)
+++ trunk/lib/FlairCore/src/Layout.h	(revision 15)
@@ -17,80 +17,80 @@
 #include <Mutex.h>
 
-namespace flair
-{
-namespace gui
-{
-    class LayoutPosition;
+namespace flair {
+namespace gui {
+class LayoutPosition;
 
-    /*! \class Layout
-    *
-    * \brief Abstract class to display a layout on the ground station
-    *
-    * This is an abstract class to display layouts (like GridLayout, GroupBox, etc). \n
-    * A layout can contains Widgets (Box, DataPlot, Picture, etc). \n
-    * Layout holds a Mutex, which can be used to protect access to Box's value for example.
-    */
-    class Layout: public Widget
-    {
-        friend class Box;
+/*! \class Layout
+*
+* \brief Abstract class to display a layout on the ground station
+*
+* This is an abstract class to display layouts (like GridLayout, GroupBox, etc).
+*\n
+* A layout can contains Widgets (Box, DataPlot, Picture, etc). \n
+* Layout holds a Mutex, which can be used to protect access to Box's value for
+*example.
+*/
+class Layout : public Widget {
+  friend class Box;
 
-        public:
-            /*!
-            * \brief Constructor
-            *
-            * Construct a Layout. Type is a predifined one, and will be
-            * interpreted by the ground station.
-            *
-            * \param parent parent
-            * \param name name
-            * \param type type of layout
-            */
-            Layout(const Widget* parent,std::string name,std::string type);
+public:
+  /*!
+  * \brief Constructor
+  *
+  * Construct a Layout. Type is a predifined one, and will be
+  * interpreted by the ground station.
+  *
+  * \param parent parent
+  * \param name name
+  * \param type type of layout
+  */
+  Layout(const Widget *parent, std::string name, std::string type);
 
-            /*!
-            * \brief Destructor
-            *
-            */
-            ~Layout();
+  /*!
+  * \brief Destructor
+  *
+  */
+  ~Layout();
 
-            /*!
-            * \brief Last Row and Col LayoutPosition
-            *
-            * Get a LayoutPosition at the last row and col.
-            *
-            * \return the LayoutPosition
-            */
-            LayoutPosition* LastRowLastCol(void) const;
+  /*!
+  * \brief Last Row and Col LayoutPosition
+  *
+  * Get a LayoutPosition at the last row and col.
+  *
+  * \return the LayoutPosition
+  */
+  LayoutPosition *LastRowLastCol(void) const;
 
-            /*!
-            * \brief New Row LayoutPosition
-            *
-            * Get a LayoutPosition at a new row and first col. This new row will be at the last position.
-            *
-            * \return the LayoutPosition
-            */
-            LayoutPosition*  NewRow(void) const;
+  /*!
+  * \brief New Row LayoutPosition
+  *
+  * Get a LayoutPosition at a new row and first col. This new row will be at the
+  *last position.
+  *
+  * \return the LayoutPosition
+  */
+  LayoutPosition *NewRow(void) const;
 
-            /*!
-            * \brief LayoutPosition at specified position
-            *
-            * Get a LayoutPosition at specified row and col.
-            *
-            * \param row row
-            * \param col col
-            *
-            * \return the LayoutPosition
-            */
-            LayoutPosition*  At(uint16_t row,uint16_t col) const;
+  /*!
+  * \brief LayoutPosition at specified position
+  *
+  * Get a LayoutPosition at specified row and col.
+  *
+  * \param row row
+  * \param col col
+  *
+  * \return the LayoutPosition
+  */
+  LayoutPosition *At(uint16_t row, uint16_t col) const;
 
-        private:
-            /*!
-            * \brief Mutex
-            *
-            * This Mutex can be used by friends class like Box to protect access
-            * to Box's value.
-            */
-            core::Mutex* mutex;
-    };
+private:
+  /*!
+  * \brief Mutex
+  *
+  * This Mutex can be used by friends class like Box to protect access
+  * to Box's value.
+  */
+  core::Mutex *mutex;
+};
 
 } // end namespace gui
Index: trunk/lib/FlairCore/src/LayoutPosition.cpp
===================================================================
--- trunk/lib/FlairCore/src/LayoutPosition.cpp	(revision 14)
+++ trunk/lib/FlairCore/src/LayoutPosition.cpp	(revision 15)
@@ -17,36 +17,20 @@
 #include "LayoutPosition.h"
 
+namespace flair {
+namespace gui {
 
-namespace flair
-{
-namespace gui
-{
-
-LayoutPosition::LayoutPosition(const Layout* layout,int16_t row,int16_t col)
-{
-    this->layout=layout;
-    this->row=row;
-    this->col=col;
+LayoutPosition::LayoutPosition(const Layout *layout, int16_t row, int16_t col) {
+  this->layout = layout;
+  this->row = row;
+  this->col = col;
 }
 
-LayoutPosition::~LayoutPosition()
-{
+LayoutPosition::~LayoutPosition() {}
 
-}
+const Layout *LayoutPosition::getLayout(void) const { return layout; }
 
-const Layout* LayoutPosition::getLayout(void) const
-{
-    return layout;
-}
+int16_t LayoutPosition::Row(void) const { return row; }
 
-int16_t LayoutPosition::Row(void) const
-{
-    return row;
-}
-
-int16_t LayoutPosition::Col(void) const
-{
-    return col;
-}
+int16_t LayoutPosition::Col(void) const { return col; }
 
 } // end namespace gui
Index: trunk/lib/FlairCore/src/LayoutPosition.h
===================================================================
--- trunk/lib/FlairCore/src/LayoutPosition.h	(revision 14)
+++ trunk/lib/FlairCore/src/LayoutPosition.h	(revision 15)
@@ -16,63 +16,58 @@
 #include <stdint.h>
 
-namespace flair
-{
-namespace gui
-{
-    class Layout;
+namespace flair {
+namespace gui {
+class Layout;
 
-    /*! \class LayoutPosition
-    *
-    * \brief Class to define a position in a layout on the ground station.
-    *
+/*! \class LayoutPosition
+*
+* \brief Class to define a position in a layout on the ground station.
+*
 
-    */
-    class LayoutPosition
-    {
-        public:
-            /*!
-            * \brief Constructor
-            *
-            * Construct a LayoutPosition, in given Layout at given place.
-            *
-            * \param layout layout
-            * \param row row position
-            * \param col col position
-            */
-            LayoutPosition(const Layout* layout,int16_t row,int16_t col);
+*/
+class LayoutPosition {
+public:
+  /*!
+  * \brief Constructor
+  *
+  * Construct a LayoutPosition, in given Layout at given place.
+  *
+  * \param layout layout
+  * \param row row position
+  * \param col col position
+  */
+  LayoutPosition(const Layout *layout, int16_t row, int16_t col);
 
-            /*!
-            * \brief Destructor
-            *
-            */
-            ~LayoutPosition();
+  /*!
+  * \brief Destructor
+  *
+  */
+  ~LayoutPosition();
 
-            /*!
-            * \brief get Layout
-            *
-            * \return the parent Layout
-            */
-            const Layout* getLayout(void) const;
+  /*!
+  * \brief get Layout
+  *
+  * \return the parent Layout
+  */
+  const Layout *getLayout(void) const;
 
-            /*!
-            * \brief get row
-            *
-            * \return row position
-            */
-            int16_t Row(void) const;
+  /*!
+  * \brief get row
+  *
+  * \return row position
+  */
+  int16_t Row(void) const;
 
-            /*!
-            * \brief get col
-            *
-            * \return col position
-            */
-            int16_t Col(void) const;
+  /*!
+  * \brief get col
+  *
+  * \return col position
+  */
+  int16_t Col(void) const;
 
-
-        private:
-            const Layout *layout;
-            int16_t row,col;
-
-    };
+private:
+  const Layout *layout;
+  int16_t row, col;
+};
 
 } // end namespace gui
Index: trunk/lib/FlairCore/src/Map.cpp
===================================================================
--- trunk/lib/FlairCore/src/Map.cpp	(revision 14)
+++ trunk/lib/FlairCore/src/Map.cpp	(revision 15)
@@ -27,105 +27,110 @@
 using std::ostringstream;
 
-namespace flair
-{
-namespace gui
-{
+namespace flair {
+namespace gui {
 
 using namespace core;
 
-Map::Map(const LayoutPosition* position,string name):SendData(position,name,"Map",1000) {
-    size_t i=0;
-    while(1) {
-        double latitude,longitude;
-        double altitude=0;
-        ostringstream lat_prop,long_prop,alt_prop;
-        lat_prop << "lat" << i;
-        long_prop << "long" << i;
-        alt_prop << "alt" << i;
-        if(GetPersistentXmlProp(lat_prop.str(),latitude) && GetPersistentXmlProp(long_prop.str(),longitude)) {
-            SetVolatileXmlProp(lat_prop.str(),latitude);
-            SetVolatileXmlProp(long_prop.str(),longitude);
-            if(GetPersistentXmlProp(alt_prop.str(),altitude)) SetVolatileXmlProp(alt_prop.str(),altitude);
-            GeoCoordinate *checkpoint=new GeoCoordinate(this,"checkpoint",latitude,longitude,altitude);
-            checkpoints.push_back(checkpoint);
-        } else {
-            break;
-        }
-        i++;
+Map::Map(const LayoutPosition *position, string name)
+    : SendData(position, name, "Map", 1000) {
+  size_t i = 0;
+  while (1) {
+    double latitude, longitude;
+    double altitude = 0;
+    ostringstream lat_prop, long_prop, alt_prop;
+    lat_prop << "lat" << i;
+    long_prop << "long" << i;
+    alt_prop << "alt" << i;
+    if (GetPersistentXmlProp(lat_prop.str(), latitude) &&
+        GetPersistentXmlProp(long_prop.str(), longitude)) {
+      SetVolatileXmlProp(lat_prop.str(), latitude);
+      SetVolatileXmlProp(long_prop.str(), longitude);
+      if (GetPersistentXmlProp(alt_prop.str(), altitude))
+        SetVolatileXmlProp(alt_prop.str(), altitude);
+      GeoCoordinate *checkpoint =
+          new GeoCoordinate(this, "checkpoint", latitude, longitude, altitude);
+      checkpoints.push_back(checkpoint);
+    } else {
+      break;
     }
-    for(size_t i=0;i<checkpoints.size();i++) {
-        double latitude,longitude,altitude;
-        checkpoints.at(i)->GetCoordinates(&latitude,&longitude,&altitude);
-        //printf("%i %f %f\n",i,latitude,longitude);
-    }
+    i++;
+  }
+  for (size_t i = 0; i < checkpoints.size(); i++) {
+    double latitude, longitude, altitude;
+    checkpoints.at(i)->GetCoordinates(&latitude, &longitude, &altitude);
+    // printf("%i %f %f\n",i,latitude,longitude);
+  }
 
-    SendXml();
-/*
-    //update value from xml file
-    XmlEvent(XmlFileNode());
-    if(checkpoints_node.size()!=0) SendXml();//pour les checkpoints
+  SendXml();
+  /*
+      //update value from xml file
+      XmlEvent(XmlFileNode());
+      if(checkpoints_node.size()!=0) SendXml();//pour les checkpoints
 
-    //on enleve les checkpoints du xml
-    for(size_t i=0;i<checkpoints_node.size();i++)
-    {
-        xmlUnlinkNode(checkpoints_node.at(i));
-        xmlFreeNode(checkpoints_node.at(i));
-    }*/
+      //on enleve les checkpoints du xml
+      for(size_t i=0;i<checkpoints_node.size();i++)
+      {
+          xmlUnlinkNode(checkpoints_node.at(i));
+          xmlFreeNode(checkpoints_node.at(i));
+      }*/
 }
 
-Map::~Map() {
-
-}
+Map::~Map() {}
 
 void Map::ExtraXmlEvent(void) {
 
-//attention pas rt safe (creation checkpoint)
-    size_t i=0;
-    while(1) {
-        //printf("test %i\n",i);
-        double latitude,longitude;
-        double altitude=0;
-        ostringstream lat_prop,long_prop,alt_prop;
-        lat_prop << "lat" << i;
-        long_prop << "long" << i;
-        alt_prop << "alt" << i;
-        if(GetPersistentXmlProp(lat_prop.str(),latitude) && GetPersistentXmlProp(long_prop.str(),longitude)) {
-            GetPersistentXmlProp(alt_prop.str(),altitude);
-            if(i>=checkpoints.size()) {
-                GeoCoordinate *checkpoint=new GeoCoordinate(this,"checkpoint",latitude,longitude,altitude);
-                checkpoints.push_back(checkpoint);
-                //printf("add %i\n",i);
-            } else {
-                checkpoints.at(i)->SetCoordinates(latitude,longitude,altitude);
-            }
-        } else {
-            if(i==checkpoints.size()) break;
-        }
-        i++;
+  // attention pas rt safe (creation checkpoint)
+  size_t i = 0;
+  while (1) {
+    // printf("test %i\n",i);
+    double latitude, longitude;
+    double altitude = 0;
+    ostringstream lat_prop, long_prop, alt_prop;
+    lat_prop << "lat" << i;
+    long_prop << "long" << i;
+    alt_prop << "alt" << i;
+    if (GetPersistentXmlProp(lat_prop.str(), latitude) &&
+        GetPersistentXmlProp(long_prop.str(), longitude)) {
+      GetPersistentXmlProp(alt_prop.str(), altitude);
+      if (i >= checkpoints.size()) {
+        GeoCoordinate *checkpoint = new GeoCoordinate(
+            this, "checkpoint", latitude, longitude, altitude);
+        checkpoints.push_back(checkpoint);
+        // printf("add %i\n",i);
+      } else {
+        checkpoints.at(i)->SetCoordinates(latitude, longitude, altitude);
+      }
+    } else {
+      if (i == checkpoints.size())
+        break;
     }
+    i++;
+  }
 
-    for(size_t i=0;i<checkpoints.size();i++) {
-        double latitude,longitude,altitude;
-        checkpoints.at(i)->GetCoordinates(&latitude,&longitude,&altitude);
-        //printf("%i %f %f\n",i,latitude,longitude);
-    }
+  for (size_t i = 0; i < checkpoints.size(); i++) {
+    double latitude, longitude, altitude;
+    checkpoints.at(i)->GetCoordinates(&latitude, &longitude, &altitude);
+    // printf("%i %f %f\n",i,latitude,longitude);
+  }
 }
 
-void Map::AddPoint(const GeoCoordinate* point,string name) {
-    SetVolatileXmlProp("point",name);
-    SendXml();
+void Map::AddPoint(const GeoCoordinate *point, string name) {
+  SetVolatileXmlProp("point", name);
+  SendXml();
 
-    to_draw.push_back(point);
-    SetSendSize(to_draw.size()*3*sizeof(double));//lat,long,alt
+  to_draw.push_back(point);
+  SetSendSize(to_draw.size() * 3 * sizeof(double)); // lat,long,alt
 }
 
-void Map::CopyDatas(char* buf) const {
-    for(size_t i=0;i<to_draw.size();i++) {
-        double latitude,longitude,altitude;
-        to_draw.at(i)->GetCoordinates(&latitude,&longitude,&altitude);
-        memcpy(buf+i*3*sizeof(double),&latitude,sizeof(double));
-        memcpy(buf+sizeof(double)+i*3*sizeof(double),&longitude,sizeof(double));
-        memcpy(buf+2*sizeof(double)+i*3*sizeof(double),&altitude,sizeof(double));
-    }
+void Map::CopyDatas(char *buf) const {
+  for (size_t i = 0; i < to_draw.size(); i++) {
+    double latitude, longitude, altitude;
+    to_draw.at(i)->GetCoordinates(&latitude, &longitude, &altitude);
+    memcpy(buf + i * 3 * sizeof(double), &latitude, sizeof(double));
+    memcpy(buf + sizeof(double) + i * 3 * sizeof(double), &longitude,
+           sizeof(double));
+    memcpy(buf + 2 * sizeof(double) + i * 3 * sizeof(double), &altitude,
+           sizeof(double));
+  }
 }
 
Index: trunk/lib/FlairCore/src/Map.h
===================================================================
--- trunk/lib/FlairCore/src/Map.h	(revision 14)
+++ trunk/lib/FlairCore/src/Map.h	(revision 15)
@@ -17,72 +17,69 @@
 #include <stdint.h>
 
-namespace flair
-{
-namespace core
-{
-    class GeoCoordinate;
+namespace flair {
+namespace core {
+class GeoCoordinate;
 }
 
-namespace gui
-{
+namespace gui {
 
-    class LayoutPosition;
+class LayoutPosition;
 
-    /*! \class Map
-    *
-    * \brief Class displaying a GPS map on the ground station
-    *
-    */
-    class Map: public SendData
-    {
-        public:
-            /*!
-            * \brief Constructor
-            *
-            * Construct a map at given position. \n
-            * The Map will automatically be child of position->getLayout() Layout. After calling this constructor,
-            * position will be deleted as it is no longer usefull.
-            *
-            * \param position position to draw map
-            * \param name name
-            */
-            Map(const LayoutPosition* position,std::string name);
+/*! \class Map
+*
+* \brief Class displaying a GPS map on the ground station
+*
+*/
+class Map : public SendData {
+public:
+  /*!
+  * \brief Constructor
+  *
+  * Construct a map at given position. \n
+  * The Map will automatically be child of position->getLayout() Layout. After
+  *calling this constructor,
+  * position will be deleted as it is no longer usefull.
+  *
+  * \param position position to draw map
+  * \param name name
+  */
+  Map(const LayoutPosition *position, std::string name);
 
-            /*!
-            * \brief Destructor
-            *
-            */
-            ~Map();
+  /*!
+  * \brief Destructor
+  *
+  */
+  ~Map();
 
-            /*!
-            * \brief Add a point to the map
-            *
-            * \param point point to draw
-            * \param name name
-            */
-            void AddPoint(const core::GeoCoordinate* point,std::string name="");
+  /*!
+  * \brief Add a point to the map
+  *
+  * \param point point to draw
+  * \param name name
+  */
+  void AddPoint(const core::GeoCoordinate *point, std::string name = "");
 
-            /*!
-            * \brief Copy datas to specified buffer
-            *
-            * Reimplemented from SendData.
-            *
-            * \param buf output buffer
-            */
-            void CopyDatas(char* buf) const;
+  /*!
+  * \brief Copy datas to specified buffer
+  *
+  * Reimplemented from SendData.
+  *
+  * \param buf output buffer
+  */
+  void CopyDatas(char *buf) const;
 
-        private:
-            /*!
-            * \brief Extra Xml event
-            *
-            * Reimplemented from SendData.
-            */
-            void ExtraXmlEvent(void);
+private:
+  /*!
+  * \brief Extra Xml event
+  *
+  * Reimplemented from SendData.
+  */
+  void ExtraXmlEvent(void);
 
-            std::vector<core::GeoCoordinate*> checkpoints;
-            std::vector<const core::GeoCoordinate*> to_draw;
-            //std::vector<xmlNodePtr> checkpoints_node;
-            //bool init;
-    };
+  std::vector<core::GeoCoordinate *> checkpoints;
+  std::vector<const core::GeoCoordinate *> to_draw;
+  // std::vector<xmlNodePtr> checkpoints_node;
+  // bool init;
+};
 
 } // end namespace gui
Index: trunk/lib/FlairCore/src/Mutex.cpp
===================================================================
--- trunk/lib/FlairCore/src/Mutex.cpp	(revision 14)
+++ trunk/lib/FlairCore/src/Mutex.cpp	(revision 15)
@@ -21,28 +21,17 @@
 using std::string;
 
-namespace flair
-{
-namespace core
-{
+namespace flair {
+namespace core {
 
-Mutex::Mutex(const Object *parent,string name): Object(parent, name,"mutex")
-{
-    pimpl_=new Mutex_impl(this);
+Mutex::Mutex(const Object *parent, string name)
+    : Object(parent, name, "mutex") {
+  pimpl_ = new Mutex_impl(this);
 }
 
-Mutex::~Mutex()
-{
-    delete pimpl_;
-}
+Mutex::~Mutex() { delete pimpl_; }
 
-void Mutex::GetMutex(void) const
-{
-    pimpl_->GetMutex();
-}
+void Mutex::GetMutex(void) const { pimpl_->GetMutex(); }
 
-void Mutex::ReleaseMutex(void) const
-{
-    pimpl_->ReleaseMutex();
-}
+void Mutex::ReleaseMutex(void) const { pimpl_->ReleaseMutex(); }
 
 /*
Index: trunk/lib/FlairCore/src/Mutex.h
===================================================================
--- trunk/lib/FlairCore/src/Mutex.h	(revision 14)
+++ trunk/lib/FlairCore/src/Mutex.h	(revision 15)
@@ -19,54 +19,51 @@
 class ConditionVariable_impl;
 
-namespace flair
-{
-namespace core
-{
+namespace flair {
+namespace core {
 
-    /*! \class Mutex
-    *
-    * \brief Class defining a mutex
-    *
-    */
-    class Mutex: public Object
-    {
-        friend class ::ConditionVariable_impl;
+/*! \class Mutex
+*
+* \brief Class defining a mutex
+*
+*/
+class Mutex : public Object {
+  friend class ::ConditionVariable_impl;
 
-        public:
-            /*!
-            * \brief Constructor
-            *
-            * Construct a mutex.
-            *
-            * \param parent parent
-            * \param name name
-            */
-            Mutex(const Object *parent,std::string name="");
+public:
+  /*!
+  * \brief Constructor
+  *
+  * Construct a mutex.
+  *
+  * \param parent parent
+  * \param name name
+  */
+  Mutex(const Object *parent, std::string name = "");
 
-            /*!
-            * \brief Destructor
-            *
-            */
-            ~Mutex();
+  /*!
+  * \brief Destructor
+  *
+  */
+  ~Mutex();
 
-            /*!
-            * \brief GetMutex
-            *
-            * Lock the mutex.
-            *
-            */
-            void GetMutex(void) const;
+  /*!
+  * \brief GetMutex
+  *
+  * Lock the mutex.
+  *
+  */
+  void GetMutex(void) const;
 
-            /*!
-            * \brief ReleaseMutex
-            *
-            * Unlock the mutex.
-            *
-            */
-            void ReleaseMutex(void) const;
+  /*!
+  * \brief ReleaseMutex
+  *
+  * Unlock the mutex.
+  *
+  */
+  void ReleaseMutex(void) const;
 
-        private:
-            class Mutex_impl* pimpl_;
-    };
+private:
+  class Mutex_impl *pimpl_;
+};
 
 } // end namespace core
Index: trunk/lib/FlairCore/src/Mutex_impl.cpp
===================================================================
--- trunk/lib/FlairCore/src/Mutex_impl.cpp	(revision 14)
+++ trunk/lib/FlairCore/src/Mutex_impl.cpp	(revision 15)
@@ -23,65 +23,61 @@
 using namespace flair::core;
 
-Mutex_impl::Mutex_impl(Mutex *self)
-{
-    this->self=self;
+Mutex_impl::Mutex_impl(Mutex *self) {
+  this->self = self;
 #ifdef __XENO__
-    int status=rt_mutex_create(&mutex,NULL);
-    if(status!=0) self->Err("rt_mutex_create error (%s)\n",strerror(-status));
+  int status = rt_mutex_create(&mutex, NULL);
+  if (status != 0)
+    self->Err("rt_mutex_create error (%s)\n", strerror(-status));
 #else
-    //flag_locked=false;//revoir l'implementation nrt du is_locked
-    pthread_mutexattr_t attr;
-    if(pthread_mutexattr_init(&attr)!=0)
-    {
-        self->Err("pthread_mutexattr_init error\n");
-    }
-    if(pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE) != 0)
-    {
-        self->Err("pthread_mutexattr_settype error\n");
-    }
-    if(pthread_mutex_init(&mutex, &attr)!=0)
-    {
-        self->Err("pthread_mutex_init error\n");
-    }
-    if(pthread_mutexattr_destroy(&attr)!=0)
-    {
-        self->Err("pthread_mutexattr_destroy error\n");
-    }
+  // flag_locked=false;//revoir l'implementation nrt du is_locked
+  pthread_mutexattr_t attr;
+  if (pthread_mutexattr_init(&attr) != 0) {
+    self->Err("pthread_mutexattr_init error\n");
+  }
+  if (pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE) != 0) {
+    self->Err("pthread_mutexattr_settype error\n");
+  }
+  if (pthread_mutex_init(&mutex, &attr) != 0) {
+    self->Err("pthread_mutex_init error\n");
+  }
+  if (pthread_mutexattr_destroy(&attr) != 0) {
+    self->Err("pthread_mutexattr_destroy error\n");
+  }
 #endif
 }
 
-Mutex_impl::~Mutex_impl()
-{
-    int status;
+Mutex_impl::~Mutex_impl() {
+  int status;
 #ifdef __XENO__
-    status=rt_mutex_delete(&mutex);
+  status = rt_mutex_delete(&mutex);
 #else
-    status=pthread_mutex_destroy(&mutex);
+  status = pthread_mutex_destroy(&mutex);
 #endif
-    if(status!=0) self->Err("error destroying mutex (%s)\n",strerror(-status));
+  if (status != 0)
+    self->Err("error destroying mutex (%s)\n", strerror(-status));
 }
 
-void Mutex_impl::GetMutex(void)
-{
-    int status;
+void Mutex_impl::GetMutex(void) {
+  int status;
 #ifdef __XENO__
-    status=rt_mutex_acquire(&mutex,TM_INFINITE);
+  status = rt_mutex_acquire(&mutex, TM_INFINITE);
 #else
-    //flag_locked=true;
-    status=pthread_mutex_lock(&mutex);
+  // flag_locked=true;
+  status = pthread_mutex_lock(&mutex);
 #endif
-    if(status!=0) self->Err("error (%s)\n",strerror(-status));
+  if (status != 0)
+    self->Err("error (%s)\n", strerror(-status));
 }
 
-void Mutex_impl::ReleaseMutex(void)
-{
-    int status;
+void Mutex_impl::ReleaseMutex(void) {
+  int status;
 #ifdef __XENO__
-    status=rt_mutex_release(&mutex);
+  status = rt_mutex_release(&mutex);
 #else
-    status=pthread_mutex_unlock(&mutex);
-    //flag_locked=false;
+  status = pthread_mutex_unlock(&mutex);
+// flag_locked=false;
 #endif
-    if(status!=0) self->Err("error (%s)\n",strerror(-status));
+  if (status != 0)
+    self->Err("error (%s)\n", strerror(-status));
 }
 
@@ -92,5 +88,6 @@
     RT_MUTEX_INFO info;
     int status=rt_mutex_inquire(&mutex_rt,&info);
-    if(status!=0) mutex->Err("erreur rt_mutex_inquire (%s)\n",strerror(-status));
+    if(status!=0) mutex->Err("erreur rt_mutex_inquire
+(%s)\n",strerror(-status));
     if(info.locked>0) return true;
     return false;
Index: trunk/lib/FlairCore/src/Object.cpp
===================================================================
--- trunk/lib/FlairCore/src/Object.cpp	(revision 14)
+++ trunk/lib/FlairCore/src/Object.cpp	(revision 15)
@@ -33,129 +33,111 @@
 using std::vector;
 
-namespace flair
-{
-namespace core
-{
+namespace flair {
+namespace core {
 
-Time GetTime(void)
-{
+Time GetTime(void) {
 #ifdef __XENO__
-    return rt_timer_read();
+  return rt_timer_read();
 #else
-    struct timeval t;
-    gettimeofday(&t, NULL);
-    return (Time)((Time)(t.tv_sec)*1000000 + (Time)(t.tv_usec))*1000;
+  struct timeval t;
+  gettimeofday(&t, NULL);
+  return (Time)((Time)(t.tv_sec) * 1000000 + (Time)(t.tv_usec)) * 1000;
 
 #endif
 }
 
-void Printf(const char *format, ...)
-{
-    va_list args;
-    va_start(args, format);
+void Printf(const char *format, ...) {
+  va_list args;
+  va_start(args, format);
 #ifdef __XENO__
-    if(rt_task_self()!=NULL)
-    {
-        rt_vfprintf(stderr,format, args);
-    }
-    else
+  if (rt_task_self() != NULL) {
+    rt_vfprintf(stderr, format, args);
+  } else
 #endif
-    {
-        vfprintf(stderr,format, args);
-    }
+  {
+    vfprintf(stderr, format, args);
+  }
 
-    va_end (args);
+  va_end(args);
 }
 
-Object::Object(const Object* parent,string name,string type)
-{
-    pimpl_=new Object_impl(this,parent,name,type);
-    if(parent!=NULL) parent->pimpl_->AddChild(this);
+Object::Object(const Object *parent, string name, string type) {
+  pimpl_ = new Object_impl(this, parent, name, type);
+  if (parent != NULL)
+    parent->pimpl_->AddChild(this);
 }
 
-Object::~Object()
-{
-    if(pimpl_->parent!=NULL) pimpl_->parent->pimpl_->RemoveChild(this);
-    delete pimpl_;
+Object::~Object() {
+  if (pimpl_->parent != NULL)
+    pimpl_->parent->pimpl_->RemoveChild(this);
+  delete pimpl_;
 }
 
-string Object::ObjectName(void) const
-{
-    return pimpl_->name;
+string Object::ObjectName(void) const { return pimpl_->name; }
+
+string Object::ObjectType(void) const { return pimpl_->type; }
+
+const Object *Object::Parent(void) const { return pimpl_->parent; }
+
+vector<const Object *> *Object::TypeChilds(void) const {
+  return &(pimpl_->type_childs);
 }
 
-string Object::ObjectType(void) const
-{
-    return pimpl_->type;
+vector<const Object *> *Object::Childs(void) const { return &(pimpl_->childs); }
+
+void Object::ColorPrintf(color_t color, const char *function, int line,
+                         const char *format, va_list *args) const {
+#ifdef __XENO__
+  if (rt_task_self() != NULL) {
+    rt_fprintf(stderr, "\033[%dm", color);
+    if (line) {
+      rt_fprintf(stderr, "%s - line %d, %s: ", function, line,
+                 pimpl_->name.c_str());
+    } else {
+      rt_fprintf(stderr, "%s, %s: ", function, pimpl_->name.c_str());
+    }
+    rt_vfprintf(stderr, format, *args);
+    rt_fprintf(stderr, "\033[%dm", color_t::Auto);
+  } else
+#endif
+  {
+    fprintf(stderr, "\033[%dm", color);
+    if (line) {
+      fprintf(stderr, "%s - line %d, %s: ", function, line,
+              pimpl_->name.c_str());
+    } else {
+      fprintf(stderr, "%s, %s: ", function, pimpl_->name.c_str());
+    }
+    vfprintf(stderr, format, *args);
+    fprintf(stderr, "\033[%dm", color_t::Auto);
+  }
 }
 
-const Object* Object::Parent(void) const
-{
-    return pimpl_->parent;
-}
-
-vector<const Object*>* Object::TypeChilds(void) const
-{
-    return &(pimpl_->type_childs);
-}
-
-vector<const Object*>* Object::Childs(void) const
-{
-    return &(pimpl_->childs);
-}
-
-void Object::ColorPrintf(color_t color, const char *function, int line, const char *format,va_list *args) const {
-#ifdef __XENO__
-    if(rt_task_self()!=NULL)
-    {
-        rt_fprintf(stderr,"\033[%dm", color);
-        if (line) {
-            rt_fprintf(stderr,"%s - line %d, %s: ", function, line, pimpl_->name.c_str());
-        } else {
-            rt_fprintf(stderr,"%s, %s: ", function, pimpl_->name.c_str());
-        }
-        rt_vfprintf(stderr,format, *args);
-        rt_fprintf(stderr,"\033[%dm", color_t::Auto);
-    }
-    else
-#endif
-    {
-        fprintf(stderr,"\033[%dm", color);
-        if (line) {
-            fprintf(stderr,"%s - line %d, %s: ", function, line, pimpl_->name.c_str());
-        } else {
-            fprintf(stderr,"%s, %s: ", function, pimpl_->name.c_str());
-        }
-        vfprintf(stderr,format, *args);
-        fprintf(stderr,"\033[%dm", color_t::Auto);
-    }
-}
-
-void Object::Information(const char *function, int line, const char *format, ...) const {
-    va_list args;
-    va_start(args, format);
-    ColorPrintf(color_t::Green, function, line, format, &args);
-    va_end (args);
+void Object::Information(const char *function, int line, const char *format,
+                         ...) const {
+  va_list args;
+  va_start(args, format);
+  ColorPrintf(color_t::Green, function, line, format, &args);
+  va_end(args);
 }
 
 void Object::Warning(const char *function, const char *format, ...) const {
-    va_list args;
-    va_start(args, format);
-    ColorPrintf(color_t::Orange, function, 0, format, &args);
-    va_end (args);
+  va_list args;
+  va_start(args, format);
+  ColorPrintf(color_t::Orange, function, 0, format, &args);
+  va_end(args);
 }
 
 void Object::Error(const char *function, const char *format, ...) const {
-    va_list args;
-    va_start(args, format);
-    ColorPrintf(color_t::Red, function, 0, format, &args);
-    va_end (args);
+  va_list args;
+  va_start(args, format);
+  ColorPrintf(color_t::Red, function, 0, format, &args);
+  va_end(args);
 
-    pimpl_->error_occured=true;
+  pimpl_->error_occured = true;
 }
 
-bool Object::ErrorOccured(bool recursive) const
-{
-    return pimpl_->ErrorOccured(recursive);
+bool Object::ErrorOccured(bool recursive) const {
+  return pimpl_->ErrorOccured(recursive);
 }
 
Index: trunk/lib/FlairCore/src/Object.h
===================================================================
--- trunk/lib/FlairCore/src/Object.h	(revision 14)
+++ trunk/lib/FlairCore/src/Object.h	(revision 15)
@@ -18,7 +18,7 @@
 #include <stdarg.h>
 
-#define Warn(...) Warning(__PRETTY_FUNCTION__,__VA_ARGS__)
-#define Err(...) Error(__PRETTY_FUNCTION__,__VA_ARGS__)
-#define Info(...) Information(__PRETTY_FUNCTION__,__LINE__,__VA_ARGS__)
+#define Warn(...) Warning(__PRETTY_FUNCTION__, __VA_ARGS__)
+#define Err(...) Error(__PRETTY_FUNCTION__, __VA_ARGS__)
+#define Info(...) Information(__PRETTY_FUNCTION__, __LINE__, __VA_ARGS__)
 
 #define TIME_INFINITE 0
@@ -28,168 +28,166 @@
 class Widget_impl;
 
-namespace flair
-{
-namespace core
-{
+namespace flair {
+namespace core {
 
-    class FrameworkManager;
+class FrameworkManager;
 
-    class Message {
-    public:
-        Message(unsigned int myBufferSize):bufferSize(myBufferSize) {
-            buffer=new char[bufferSize];
-        }
-        ~Message() {
-            delete buffer;
-        }
-        char *buffer;
-        size_t bufferSize;
-    };
+class Message {
+public:
+  Message(unsigned int myBufferSize) : bufferSize(myBufferSize) {
+    buffer = new char[bufferSize];
+  }
+  ~Message() { delete buffer; }
+  char *buffer;
+  size_t bufferSize;
+};
 
-    /*!
-    * \brief Time definition, in ns
-    *
-    */
-    typedef unsigned long long Time;
+/*!
+* \brief Time definition, in ns
+*
+*/
+typedef unsigned long long Time;
 
-    /*!
-    * \brief Time
-    *
-    * \return actual time in ns (origin depends on whether the method is compiled in hard real time mode or not. As a conquence, only time differences should be used)
-    */
-    Time GetTime(void);
+/*!
+* \brief Time
+*
+* \return actual time in ns (origin depends on whether the method is compiled in
+*hard real time mode or not. As a conquence, only time differences should be
+*used)
+*/
+Time GetTime(void);
 
-    /*!
-    * \brief Formatted print
-    *
-    * See standard printf for syntax.
-    *
-    * \param format text string to display
-    */
-    void Printf(const char *format, ...);
+/*!
+* \brief Formatted print
+*
+* See standard printf for syntax.
+*
+* \param format text string to display
+*/
+void Printf(const char *format, ...);
 
-    /*! \class Object
-    *
-    * \brief Base class for all Framework's classes
-    *
-    * This is the base class for all other classes. \n
-    * It handles parent/child links and thus allow auto destruction of childs.
-    *
-    */
-    class Object
-    {
-        friend class ::Widget_impl;
+/*! \class Object
+*
+* \brief Base class for all Framework's classes
+*
+* This is the base class for all other classes. \n
+* It handles parent/child links and thus allow auto destruction of childs.
+*
+*/
+class Object {
+  friend class ::Widget_impl;
 
-        public:
-            typedef enum {
-                Auto=0,
-                Red=31,
-                Green=32,
-                Orange=33
-            } color_t;
-            /*!
-            * \brief Constructor
-            *
-            * Construct an Object, which is child of its parent.
-            *
-            * \param parent parent
-            * \param name name
-            * \param type type
-            */
-            Object(const Object* parent=NULL,std::string name="",std::string type="");
+public:
+  typedef enum { Auto = 0, Red = 31, Green = 32, Orange = 33 } color_t;
+  /*!
+  * \brief Constructor
+  *
+  * Construct an Object, which is child of its parent.
+  *
+  * \param parent parent
+  * \param name name
+  * \param type type
+  */
+  Object(const Object *parent = NULL, std::string name = "",
+         std::string type = "");
 
-            /*!
-            * \brief Destructor
-            *
-            * Calling it will automatically destruct all childs.
-            *
-            */
-            virtual ~Object();
+  /*!
+  * \brief Destructor
+  *
+  * Calling it will automatically destruct all childs.
+  *
+  */
+  virtual ~Object();
 
-            /*!
-            * \brief Name
-            *
-            * \return Object's name
-            */
-            std::string ObjectName(void) const;
+  /*!
+  * \brief Name
+  *
+  * \return Object's name
+  */
+  std::string ObjectName(void) const;
 
-            /*!
-            * \brief Type
-            *
-            * \return Object's type
-            */
-            std::string ObjectType(void) const;
+  /*!
+  * \brief Type
+  *
+  * \return Object's type
+  */
+  std::string ObjectType(void) const;
 
-            /*!
-            * \brief Parent
-            *
-            * \return Object's parent
-            */
-            const Object* Parent(void) const;
+  /*!
+  * \brief Parent
+  *
+  * \return Object's parent
+  */
+  const Object *Parent(void) const;
 
-            /*!
-            * \brief Childs of the same type
-            *
-            * \return a vector of all childs of the same type
-            */
-            std::vector<const Object*>* TypeChilds(void) const;
+  /*!
+  * \brief Childs of the same type
+  *
+  * \return a vector of all childs of the same type
+  */
+  std::vector<const Object *> *TypeChilds(void) const;
 
-            /*!
-            * \brief Childs
-            *
-            * \return a vector of all childs
-            */
-            std::vector<const Object*>* Childs(void) const;
+  /*!
+  * \brief Childs
+  *
+  * \return a vector of all childs
+  */
+  std::vector<const Object *> *Childs(void) const;
 
-            /*!
-            * \brief Formatted information
-            *
-            * Green colored Printf(). \n
-            * Note that it is better to call Info macro, which automatically fills function parameter.
-            *
-            * \param function name of calling function
-            * \param line line number in calling function
-            * \param format text string to display
-            */
-            void Information(const char *function, int line, const char *format, ...) const;
+  /*!
+  * \brief Formatted information
+  *
+  * Green colored Printf(). \n
+  * Note that it is better to call Info macro, which automatically fills
+  *function parameter.
+  *
+  * \param function name of calling function
+  * \param line line number in calling function
+  * \param format text string to display
+  */
+  void Information(const char *function, int line, const char *format,
+                   ...) const;
 
-            /*!
-            * \brief Formatted warning
-            *
-            * Orange colored Printf(). \n
-            * Note that it is better to call Warn macro, which automatically fills function parameter.
-            *
-            * \param function name of calling function
-            * \param format text string to display
-            */
-            void Warning(const char *function,const char *format, ...) const;
+  /*!
+  * \brief Formatted warning
+  *
+  * Orange colored Printf(). \n
+  * Note that it is better to call Warn macro, which automatically fills
+  *function parameter.
+  *
+  * \param function name of calling function
+  * \param format text string to display
+  */
+  void Warning(const char *function, const char *format, ...) const;
 
-            /*!
-            * \brief Formatted error
-            *
-            * Red colored Printf(). \n
-            * Note that it is better to call Err macro, which automatically fills function parameter. \n
-            * After calling this method, ErrorOccured() will always return true.
-            *
-            * \param function name of calling function
-            * \param format text string to display
-            */
-            void Error(const char *function,const char *format, ...) const;
+  /*!
+  * \brief Formatted error
+  *
+  * Red colored Printf(). \n
+  * Note that it is better to call Err macro, which automatically fills function
+  *parameter. \n
+  * After calling this method, ErrorOccured() will always return true.
+  *
+  * \param function name of calling function
+  * \param format text string to display
+  */
+  void Error(const char *function, const char *format, ...) const;
 
-            /*!
-            * \brief Has an errror occured?
-            *
-            * Check if an error occured, in fact if Error() was called at least once. \n
-            * Once Error() was called, this method will never return back false.
-            *
-            * \param recursive if true, recursively check among childs
-            * \return true if an error occured
-            */
-            bool ErrorOccured(bool recursive=true) const;
+  /*!
+  * \brief Has an errror occured?
+  *
+  * Check if an error occured, in fact if Error() was called at least once. \n
+  * Once Error() was called, this method will never return back false.
+  *
+  * \param recursive if true, recursively check among childs
+  * \return true if an error occured
+  */
+  bool ErrorOccured(bool recursive = true) const;
 
-        private:
-            class Object_impl* pimpl_;
-            void ColorPrintf(color_t, const char *function, int line, const char *format, va_list *args) const;
-    };
+private:
+  class Object_impl *pimpl_;
+  void ColorPrintf(color_t, const char *function, int line, const char *format,
+                   va_list *args) const;
+};
 
 } // end namespace core
Index: trunk/lib/FlairCore/src/Object_impl.cpp
===================================================================
--- trunk/lib/FlairCore/src/Object_impl.cpp	(revision 14)
+++ trunk/lib/FlairCore/src/Object_impl.cpp	(revision 15)
@@ -23,81 +23,74 @@
 using namespace flair::core;
 
-Object_impl::Object_impl(const Object* self,const Object* parent,string name,string type)
-{
-    //Printf("Object %s\n",name.c_str());
-    this->self=self;
-    this->parent=parent;
-    this->name=name;
-    this->type=type;
-    error_occured=false;
+Object_impl::Object_impl(const Object *self, const Object *parent, string name,
+                         string type) {
+  // Printf("Object %s\n",name.c_str());
+  this->self = self;
+  this->parent = parent;
+  this->name = name;
+  this->type = type;
+  error_occured = false;
 
-    if(parent!=NULL)
-    {
-        if(name=="") this->name=parent->ObjectName();
-    }
+  if (parent != NULL) {
+    if (name == "")
+      this->name = parent->ObjectName();
+  }
 }
 
-Object_impl::~Object_impl()
-{
-    //Printf("destruction Object %s %s\n",name.c_str(),type.c_str());
+Object_impl::~Object_impl() {
+  // Printf("destruction Object %s %s\n",name.c_str(),type.c_str());
 
-    while(childs.size()!=0)
-    {
-        //Printf("child %i %s %s\n",childs.size(),childs.front()->ObjectName().c_str(),childs.front()->ObjectType().c_str());
-        //if(childs.front()!=NULL)
-        delete childs.front();
-    }
+  while (childs.size() != 0) {
+    // Printf("child %i %s
+    // %s\n",childs.size(),childs.front()->ObjectName().c_str(),childs.front()->ObjectType().c_str());
+    // if(childs.front()!=NULL)
+    delete childs.front();
+  }
 
-    if(type_childs.size()!=0)
-    {
-        type_childs.clear();
-        self->Warn("type_childs not cleared\n");
-    }
+  if (type_childs.size() != 0) {
+    type_childs.clear();
+    self->Warn("type_childs not cleared\n");
+  }
 
-    //Printf("destruction Object %s %s ok\n",name.c_str(),type.c_str());
+  // Printf("destruction Object %s %s ok\n",name.c_str(),type.c_str());
 }
 
-void Object_impl::AddChild(const Object* child)
-{
-    childs.push_back(child);
-//self->Printf("added Object %s %s (%s %s)\n",child->ObjectName().c_str(),child->ObjectType().c_str(),name.c_str(),type.c_str());
-    if(child->ObjectType()==type) type_childs.push_back(child);
+void Object_impl::AddChild(const Object *child) {
+  childs.push_back(child);
+  // self->Printf("added Object %s %s (%s
+  // %s)\n",child->ObjectName().c_str(),child->ObjectType().c_str(),name.c_str(),type.c_str());
+  if (child->ObjectType() == type)
+    type_childs.push_back(child);
 }
 
-void Object_impl::RemoveChild(const Object* child)
-{
-    //self->Printf("removed Object %s %s (%s %s)\n",child->ObjectName().c_str(),child->ObjectType().c_str(),name.c_str(),type.c_str());
+void Object_impl::RemoveChild(const Object *child) {
+  // self->Printf("removed Object %s %s (%s
+  // %s)\n",child->ObjectName().c_str(),child->ObjectType().c_str(),name.c_str(),type.c_str());
 
-    for(vector<const Object*>::iterator it=childs.begin() ; it < childs.end(); it++ )
-    {
-        if(*it==child)
-        {
-            childs.erase (it);
-            break;
-        }
+  for (vector<const Object *>::iterator it = childs.begin(); it < childs.end();
+       it++) {
+    if (*it == child) {
+      childs.erase(it);
+      break;
     }
+  }
 
-    for(vector<const Object*>::iterator it=type_childs.begin() ; it < type_childs.end(); it++ )
-    {
-        if(*it==child)
-        {
-            type_childs.erase (it);
-            break;
-        }
+  for (vector<const Object *>::iterator it = type_childs.begin();
+       it < type_childs.end(); it++) {
+    if (*it == child) {
+      type_childs.erase(it);
+      break;
     }
+  }
 }
 
-bool Object_impl::ErrorOccured(bool recursive)
-{
-    if(recursive==true)
-    {
-        for(size_t i=0;i<childs.size();i++)
-        {
-            if(childs[i]->ErrorOccured(true)==true)
-            {
-                return true;
-            }
-        }
+bool Object_impl::ErrorOccured(bool recursive) {
+  if (recursive == true) {
+    for (size_t i = 0; i < childs.size(); i++) {
+      if (childs[i]->ErrorOccured(true) == true) {
+        return true;
+      }
     }
-    return error_occured;
+  }
+  return error_occured;
 }
Index: trunk/lib/FlairCore/src/OneAxisRotation.cpp
===================================================================
--- trunk/lib/FlairCore/src/OneAxisRotation.cpp	(revision 14)
+++ trunk/lib/FlairCore/src/OneAxisRotation.cpp	(revision 15)
@@ -16,9 +16,9 @@
 /*********************************************************************/
 
-//this "filter" is in core but it should be in filter
-//filter depends on sensoractuator
-//sensoractuators depends on oneaxisrotation
-//so if oneaxisrotation is in fiter we have a circular dependency
-//TODO: fix this!
+// this "filter" is in core but it should be in filter
+// filter depends on sensoractuator
+// sensoractuators depends on oneaxisrotation
+// so if oneaxisrotation is in fiter we have a circular dependency
+// TODO: fix this!
 
 #include "OneAxisRotation.h"
@@ -29,35 +29,29 @@
 using std::string;
 
-namespace flair
-{
-namespace core
-{
+namespace flair {
+namespace core {
 
-OneAxisRotation::OneAxisRotation(const gui::LayoutPosition* position,string name): gui::GroupBox(position,name)
-{
-    pimpl_=new OneAxisRotation_impl(this);
+OneAxisRotation::OneAxisRotation(const gui::LayoutPosition *position,
+                                 string name)
+    : gui::GroupBox(position, name) {
+  pimpl_ = new OneAxisRotation_impl(this);
 }
 
-OneAxisRotation::~OneAxisRotation()
-{
-    delete pimpl_;
+OneAxisRotation::~OneAxisRotation() { delete pimpl_; }
+
+void OneAxisRotation::ComputeRotation(Vector3D &vector) const {
+  pimpl_->ComputeRotation(vector);
 }
 
-void OneAxisRotation::ComputeRotation(Vector3D& vector) const
-{
-    pimpl_->ComputeRotation(vector);
+void OneAxisRotation::ComputeRotation(Euler &euler) const {
+  pimpl_->ComputeRotation(euler);
 }
 
-void OneAxisRotation::ComputeRotation(Euler& euler) const
-{
-    pimpl_->ComputeRotation(euler);
+void OneAxisRotation::ComputeRotation(Quaternion &quaternion) const {
+  pimpl_->ComputeRotation(quaternion);
 }
 
-void OneAxisRotation::ComputeRotation(Quaternion& quaternion) const {
-    pimpl_->ComputeRotation(quaternion);
-}
-
-void OneAxisRotation::ComputeRotation(RotationMatrix& matrix) const {
-    pimpl_->ComputeRotation(matrix);
+void OneAxisRotation::ComputeRotation(RotationMatrix &matrix) const {
+  pimpl_->ComputeRotation(matrix);
 }
 
Index: trunk/lib/FlairCore/src/OneAxisRotation.h
===================================================================
--- trunk/lib/FlairCore/src/OneAxisRotation.h	(revision 14)
+++ trunk/lib/FlairCore/src/OneAxisRotation.h	(revision 15)
@@ -18,77 +18,71 @@
 class OneAxisRotation_impl;
 
-
-namespace flair
-{
-namespace gui
-{
-    class LayoutPosition;
+namespace flair {
+namespace gui {
+class LayoutPosition;
 }
 
-namespace core
-{
-    class Vector3D;
-    class Euler;
-    class Quaternion;
-    class RotationMatrix;
+namespace core {
+class Vector3D;
+class Euler;
+class Quaternion;
+class RotationMatrix;
 
-    /*! \class OneAxisRotation
-    *
-    * \brief Class defining a rotation around one axis
-    *
-    * Axe and value of the rotation are placed in a GroupBox on ground station.
-    *
-    */
-    class OneAxisRotation: public gui::GroupBox
-    {
-        public:
-            /*!
-            * \brief Constructor
-            *
-            * Construct a OneAxisRotation at given position.
-            *
-            * \param position position to place the GroupBox
-            * \param name name
-            */
-            OneAxisRotation(const gui::LayoutPosition* position,std::string namel);
+/*! \class OneAxisRotation
+*
+* \brief Class defining a rotation around one axis
+*
+* Axe and value of the rotation are placed in a GroupBox on ground station.
+*
+*/
+class OneAxisRotation : public gui::GroupBox {
+public:
+  /*!
+  * \brief Constructor
+  *
+  * Construct a OneAxisRotation at given position.
+  *
+  * \param position position to place the GroupBox
+  * \param name name
+  */
+  OneAxisRotation(const gui::LayoutPosition *position, std::string namel);
 
-            /*!
-            * \brief Destructor
-            *
-            */
-            ~OneAxisRotation();
+  /*!
+  * \brief Destructor
+  *
+  */
+  ~OneAxisRotation();
 
-            /*!
-            * \brief Compute rotation
-            *
-            * \param vector Vector3D to rotate
-            */
-            void ComputeRotation(core::Vector3D& vector) const;
+  /*!
+  * \brief Compute rotation
+  *
+  * \param vector Vector3D to rotate
+  */
+  void ComputeRotation(core::Vector3D &vector) const;
 
-            /*!
-            * \brief Compute rotation
-            *
-            * \param euler Euler angle to rotate
-            */
-            void ComputeRotation(core::Euler& euler) const;
+  /*!
+  * \brief Compute rotation
+  *
+  * \param euler Euler angle to rotate
+  */
+  void ComputeRotation(core::Euler &euler) const;
 
-            /*!
-            * \brief Compute rotation
-            *
-            * \param quaternion Quaternion to rotate
-            */
-            void ComputeRotation(core::Quaternion& quaternion) const;
+  /*!
+  * \brief Compute rotation
+  *
+  * \param quaternion Quaternion to rotate
+  */
+  void ComputeRotation(core::Quaternion &quaternion) const;
 
-            /*!
-            * \brief Compute rotation
-            *
-            * \param matrix RotationMatrix to rotate
-            */
-            void ComputeRotation(core::RotationMatrix& matrix) const;
+  /*!
+  * \brief Compute rotation
+  *
+  * \param matrix RotationMatrix to rotate
+  */
+  void ComputeRotation(core::RotationMatrix &matrix) const;
 
-        private:
-            const class OneAxisRotation_impl* pimpl_;
-
-    };
+private:
+  const class OneAxisRotation_impl *pimpl_;
+};
 
 } // end namespace core
Index: trunk/lib/FlairCore/src/OneAxisRotation_impl.cpp
===================================================================
--- trunk/lib/FlairCore/src/OneAxisRotation_impl.cpp	(revision 14)
+++ trunk/lib/FlairCore/src/OneAxisRotation_impl.cpp	(revision 15)
@@ -28,55 +28,48 @@
 using namespace flair::gui;
 
-OneAxisRotation_impl::OneAxisRotation_impl(GroupBox* box)
-{
-    rot_value=new DoubleSpinBox(box->NewRow(),"value"," deg",-180.,180.,10.,1);
-    rot_axe=new ComboBox(box->LastRowLastCol(),"axis");
-    rot_axe->AddItem("x");
-    rot_axe->AddItem("y");
-    rot_axe->AddItem("z");
+OneAxisRotation_impl::OneAxisRotation_impl(GroupBox *box) {
+  rot_value =
+      new DoubleSpinBox(box->NewRow(), "value", " deg", -180., 180., 10., 1);
+  rot_axe = new ComboBox(box->LastRowLastCol(), "axis");
+  rot_axe->AddItem("x");
+  rot_axe->AddItem("y");
+  rot_axe->AddItem("z");
 }
 
-OneAxisRotation_impl::~OneAxisRotation_impl()
-{
+OneAxisRotation_impl::~OneAxisRotation_impl() {}
 
+// compute rotation of each axis through ComputeRotation(Vector3D& vector)
+void OneAxisRotation_impl::ComputeRotation(Quaternion &quat) const {
+  Vector3D rot = Vector3D(quat.q1, quat.q2, quat.q3);
+  ComputeRotation(rot);
+  quat.q1 = rot.x;
+  quat.q2 = rot.y;
+  quat.q3 = rot.z;
 }
 
-//compute rotation of each axis through ComputeRotation(Vector3D& vector)
-void OneAxisRotation_impl::ComputeRotation(Quaternion& quat) const {
-    Vector3D rot=Vector3D(quat.q1,quat.q2,quat.q3);
-    ComputeRotation(rot);
-    quat.q1=rot.x;
-    quat.q2=rot.y;
-    quat.q3=rot.z;
+void OneAxisRotation_impl::ComputeRotation(RotationMatrix &matrix) const {
+  printf("not yet implemented\n");
 }
 
-void OneAxisRotation_impl::ComputeRotation(RotationMatrix& matrix) const {
-printf("not yet implemented\n");
+// on utilise la rotation d'un vector pour faire une rotation de repere
+// d'ou le signe negatif
+void OneAxisRotation_impl::ComputeRotation(Vector3D &vector) const {
+  switch (rot_axe->CurrentIndex()) {
+  case 0:
+    vector.RotateXDeg(-rot_value->Value());
+    break;
+  case 1:
+    vector.RotateYDeg(-rot_value->Value());
+    break;
+  case 2:
+    vector.RotateZDeg(-rot_value->Value());
+    break;
+  }
 }
 
-//on utilise la rotation d'un vector pour faire une rotation de repere
-//d'ou le signe negatif
-void OneAxisRotation_impl::ComputeRotation(Vector3D& vector) const
-{
-    switch(rot_axe->CurrentIndex())
-    {
-        case 0:
-            vector.RotateXDeg(-rot_value->Value());
-            break;
-        case 1:
-            vector.RotateYDeg(-rot_value->Value());
-            break;
-        case 2:
-            vector.RotateZDeg(-rot_value->Value());
-            break;
-    }
+void OneAxisRotation_impl::ComputeRotation(Euler &euler) const {
+  Quaternion quat;
+  euler.ToQuaternion(quat);
+  ComputeRotation(quat);
+  quat.ToEuler(euler);
 }
-
-void OneAxisRotation_impl::ComputeRotation(Euler& euler) const
-{
-    Quaternion quat;
-    euler.ToQuaternion(quat);
-    ComputeRotation(quat);
-    quat.ToEuler(euler);
-}
-
Index: trunk/lib/FlairCore/src/Picture.cpp
===================================================================
--- trunk/lib/FlairCore/src/Picture.cpp	(revision 14)
+++ trunk/lib/FlairCore/src/Picture.cpp	(revision 15)
@@ -24,37 +24,30 @@
 using std::string;
 
-namespace flair
-{
-namespace gui
-{
+namespace flair {
+namespace gui {
 
 using namespace core;
 
-Picture::Picture(const LayoutPosition* position,string name,const cvimage *image):SendData(position,name,"Picture",200)
-{
-    this->image=image;
+Picture::Picture(const LayoutPosition *position, string name,
+                 const cvimage *image)
+    : SendData(position, name, "Picture", 200) {
+  this->image = image;
 
-    SetSendSize(image->GetDataType().GetSize());
+  SetSendSize(image->GetDataType().GetSize());
 
-    SetVolatileXmlProp("width",image->GetDataType().GetWidth());
-    SetVolatileXmlProp("height",image->GetDataType().GetHeight());
-    SendXml();
+  SetVolatileXmlProp("width", image->GetDataType().GetWidth());
+  SetVolatileXmlProp("height", image->GetDataType().GetHeight());
+  SendXml();
 }
 
-Picture::~Picture()
-{
+Picture::~Picture() {}
+
+void Picture::CopyDatas(char *buf) const {
+  if (image != NULL) {
+    image->GetMutex();
+    memcpy(buf, image->img->imageData, image->GetDataType().GetSize());
+    image->ReleaseMutex();
+  }
 }
-
-
-void Picture::CopyDatas(char* buf) const
-{
-    if(image!=NULL)
-    {
-        image->GetMutex();
-        memcpy(buf,image->img->imageData,image->GetDataType().GetSize());
-        image->ReleaseMutex();
-    }
-}
-
 
 } // end namespace gui
Index: trunk/lib/FlairCore/src/Picture.h
===================================================================
--- trunk/lib/FlairCore/src/Picture.h	(revision 14)
+++ trunk/lib/FlairCore/src/Picture.h	(revision 15)
@@ -17,62 +17,60 @@
 #include <cxtypes.h>
 
-namespace flair
-{
-namespace core
-{
-    class cvimage;
+namespace flair {
+namespace core {
+class cvimage;
 }
 
-namespace gui
-{
+namespace gui {
 
-    class LayoutPosition;
+class LayoutPosition;
 
-    /*! \class Picture
-    *
-    * \brief Class displaying a Picture on the ground station
-    *
-    */
-    class Picture:public SendData
-    {
-        public:
-            /*!
-            * \brief Constructor
-            *
-            * Construct a picture at given position. \n
-            * The Picture will automatically be child of position->getLayout() Layout. After calling this constructor,
-            * position will be deleted as it is no longer usefull.
-            *
-            * \param position position to draw plot
-            * \param name name
-            * \param image image to draw
-            */
-            Picture(const LayoutPosition* position,std::string name,const core::cvimage *image);
+/*! \class Picture
+*
+* \brief Class displaying a Picture on the ground station
+*
+*/
+class Picture : public SendData {
+public:
+  /*!
+  * \brief Constructor
+  *
+  * Construct a picture at given position. \n
+  * The Picture will automatically be child of position->getLayout() Layout.
+  *After calling this constructor,
+  * position will be deleted as it is no longer usefull.
+  *
+  * \param position position to draw plot
+  * \param name name
+  * \param image image to draw
+  */
+  Picture(const LayoutPosition *position, std::string name,
+          const core::cvimage *image);
 
-            /*!
-            * \brief Destructor
-            *
-            */
-            ~Picture();
+  /*!
+  * \brief Destructor
+  *
+  */
+  ~Picture();
 
-        private:
-            /*!
-            * \brief Copy datas to specified buffer
-            *
-            * Reimplemented from SendData.
-            *
-            * \param buf output buffer
-            */
-            void CopyDatas(char* buf) const;
+private:
+  /*!
+  * \brief Copy datas to specified buffer
+  *
+  * Reimplemented from SendData.
+  *
+  * \param buf output buffer
+  */
+  void CopyDatas(char *buf) const;
 
-            /*!
-            * \brief Extra Xml event
-            *
-            * Reimplemented from SendData.
-            */
-            void ExtraXmlEvent(void){};
+  /*!
+  * \brief Extra Xml event
+  *
+  * Reimplemented from SendData.
+  */
+  void ExtraXmlEvent(void){};
 
-            const core::cvimage *image;
-    };
+  const core::cvimage *image;
+};
 
 } // end namespace gui
Index: trunk/lib/FlairCore/src/PushButton.cpp
===================================================================
--- trunk/lib/FlairCore/src/PushButton.cpp	(revision 14)
+++ trunk/lib/FlairCore/src/PushButton.cpp	(revision 15)
@@ -22,44 +22,35 @@
 using std::string;
 
-namespace flair
-{
-namespace gui
-{
+namespace flair {
+namespace gui {
 
-PushButton::PushButton(const LayoutPosition* position,string name): Widget(position->getLayout(),name,"PushButton")
-{
-    SetVolatileXmlProp("row",position->Row());
-    SetVolatileXmlProp("col",position->Col());
-    delete position;
+PushButton::PushButton(const LayoutPosition *position, string name)
+    : Widget(position->getLayout(), name, "PushButton") {
+  SetVolatileXmlProp("row", position->Row());
+  SetVolatileXmlProp("col", position->Col());
+  delete position;
 
-    SendXml();
+  SendXml();
 
-    clicked=false;
+  clicked = false;
 }
 
-PushButton::~PushButton()
-{
+PushButton::~PushButton() {}
 
+void PushButton::XmlEvent(void) {
+  int clic = 0;
+  GetPersistentXmlProp("value", clic);
+
+  if (clic == 1)
+    clicked = true;
 }
 
-void PushButton::XmlEvent(void)
-{
-    int clic=0;
-    GetPersistentXmlProp("value",clic);
-
-    if(clic==1) clicked=true;
-}
-
-bool PushButton::Clicked(void)
-{
-    if(clicked==true)
-    {
-       clicked=false;
-       return true;
-    }
-    else
-    {
-        return false;
-    }
+bool PushButton::Clicked(void) {
+  if (clicked == true) {
+    clicked = false;
+    return true;
+  } else {
+    return false;
+  }
 }
 
Index: trunk/lib/FlairCore/src/PushButton.h
===================================================================
--- trunk/lib/FlairCore/src/PushButton.h	(revision 14)
+++ trunk/lib/FlairCore/src/PushButton.h	(revision 15)
@@ -16,59 +16,57 @@
 #include <Widget.h>
 
-namespace flair
-{
-namespace gui
-{
+namespace flair {
+namespace gui {
 
-    class LayoutPosition;
+class LayoutPosition;
 
-    /*! \class PushButton
-    *
-    * \brief Class displaying a QPushButton on the ground station
-    *
-    */
-    class PushButton:public Widget
-    {
-        public:
-            /*!
-            * \brief Constructor
-            *
-            * Construct a QPushButton at given position. \n
-            * The PushButton will automatically be child of position->getLayout() Layout. After calling this constructor,
-            * position will be deleted as it is no longer usefull.
-            *
-            * \param parent parent
-            * \param name name
-            */
-            PushButton(const LayoutPosition* position,std::string name);
+/*! \class PushButton
+*
+* \brief Class displaying a QPushButton on the ground station
+*
+*/
+class PushButton : public Widget {
+public:
+  /*!
+  * \brief Constructor
+  *
+  * Construct a QPushButton at given position. \n
+  * The PushButton will automatically be child of position->getLayout() Layout.
+  *After calling this constructor,
+  * position will be deleted as it is no longer usefull.
+  *
+  * \param parent parent
+  * \param name name
+  */
+  PushButton(const LayoutPosition *position, std::string name);
 
-            /*!
-            * \brief Destructor
-            *
-            */
-            ~PushButton();
+  /*!
+  * \brief Destructor
+  *
+  */
+  ~PushButton();
 
-            /*!
-            * \brief Has been clicled?
-            *
-            * After calling this method, the internal flag
-            * representing the state of the button is
-            * automatically set to false.
-            *
-            * \return true if button was clicked
-            */
-            bool Clicked(void);
+  /*!
+  * \brief Has been clicled?
+  *
+  * After calling this method, the internal flag
+  * representing the state of the button is
+  * automatically set to false.
+  *
+  * \return true if button was clicked
+  */
+  bool Clicked(void);
 
-        private:
-            /*!
-            * \brief XmlEvent from ground station
-            *
-            * Reimplemented from Widget.
-            *
-            */
-            void XmlEvent(void);
+private:
+  /*!
+  * \brief XmlEvent from ground station
+  *
+  * Reimplemented from Widget.
+  *
+  */
+  void XmlEvent(void);
 
-            bool clicked;
-    };
+  bool clicked;
+};
 
 } // end namespace gui
Index: trunk/lib/FlairCore/src/Quaternion.cpp
===================================================================
--- trunk/lib/FlairCore/src/Quaternion.cpp	(revision 14)
+++ trunk/lib/FlairCore/src/Quaternion.cpp	(revision 15)
@@ -26,161 +26,158 @@
 namespace core {
 
-Quaternion::Quaternion(float inQ0,float inQ1,float inQ2,float inQ3):q0(inQ0),q1(inQ1),q2(inQ2),q3(inQ3) {
-}
+Quaternion::Quaternion(float inQ0, float inQ1, float inQ2, float inQ3)
+    : q0(inQ0), q1(inQ1), q2(inQ2), q3(inQ3) {}
 
-Quaternion::~Quaternion() {
-}
+Quaternion::~Quaternion() {}
 
-Quaternion& Quaternion::operator=(const Quaternion &quaternion) {
-    q0=quaternion.q0;
-    q1=quaternion.q1;
-    q2=quaternion.q2;
-    q3=quaternion.q3;
-    return (*this);
+Quaternion &Quaternion::operator=(const Quaternion &quaternion) {
+  q0 = quaternion.q0;
+  q1 = quaternion.q1;
+  q2 = quaternion.q2;
+  q3 = quaternion.q3;
+  return (*this);
 }
 
 float Quaternion::GetNorm(void) const {
-    return sqrt(q0*q0+q1*q1+q2*q2+q3*q3);
+  return sqrt(q0 * q0 + q1 * q1 + q2 * q2 + q3 * q3);
 }
 
 void Quaternion::Normalize(void) {
-    float n=GetNorm();
-    if(n!=0) {
-        q0=q0/n;
-        q1=q1/n;
-        q2=q2/n;
-        q3=q3/n;
-    }
+  float n = GetNorm();
+  if (n != 0) {
+    q0 = q0 / n;
+    q1 = q1 / n;
+    q2 = q2 / n;
+    q3 = q3 / n;
+  }
 }
 
 void Quaternion::Conjugate(void) {
-    q1=-q1;
-    q2=-q2;
-    q3=-q3;
+  q1 = -q1;
+  q2 = -q2;
+  q3 = -q3;
 }
 
 Quaternion Quaternion::GetConjugate(void) {
-    return Quaternion(q0,-q1,-q2,-q3);
+  return Quaternion(q0, -q1, -q2, -q3);
 }
 
 void Quaternion::GetLogarithm(Vector3D &logarithm) {
-    Normalize();
-    float v_norm=sqrtf(q1*q1+q2*q2+q3*q3);
+  Normalize();
+  float v_norm = sqrtf(q1 * q1 + q2 * q2 + q3 * q3);
 
-    if(v_norm!=0) {
-        float v_arccos = acosf(q0);
-        logarithm.x=(q1*v_arccos)/v_norm;
-        logarithm.y=(q2*v_arccos)/v_norm;
-        logarithm.z=(q3*v_arccos)/v_norm;
-    } else {
-        logarithm.x=0;
-        logarithm.y=0;
-        logarithm.z=0;
-    }
+  if (v_norm != 0) {
+    float v_arccos = acosf(q0);
+    logarithm.x = (q1 * v_arccos) / v_norm;
+    logarithm.y = (q2 * v_arccos) / v_norm;
+    logarithm.z = (q3 * v_arccos) / v_norm;
+  } else {
+    logarithm.x = 0;
+    logarithm.y = 0;
+    logarithm.z = 0;
+  }
 }
 
 Vector3D Quaternion::GetLogarithm(void) {
-    Vector3D vector;
-    GetLogarithm(vector);
-    return vector;
+  Vector3D vector;
+  GetLogarithm(vector);
+  return vector;
 }
 
 Quaternion Quaternion::GetDerivative(const Vector3D &angularSpeed) const {
-    const Quaternion Qw(0,angularSpeed.x,angularSpeed.y,angularSpeed.z);
-    return 0.5*(*this)*Qw;
+  const Quaternion Qw(0, angularSpeed.x, angularSpeed.y, angularSpeed.z);
+  return 0.5 * (*this) * Qw;
 }
 
 void Quaternion::Derivate(const Vector3D &angularSpeed) {
-    Quaternion Q=GetDerivative(angularSpeed);
-    (*this)=Q;
+  Quaternion Q = GetDerivative(angularSpeed);
+  (*this) = Q;
 }
 
 void Quaternion::ToEuler(Euler &euler) const {
-    euler.roll=atan2(2*(q0*q1+q2*q3), 1-2*(q1*q1+q2*q2));
-    euler.pitch=asin(2*(q0*q2-q1*q3));
-    euler.yaw = atan2(2*(q0*q3+q1*q2), 1-2*(q2*q2+q3*q3));
+  euler.roll = atan2(2 * (q0 * q1 + q2 * q3), 1 - 2 * (q1 * q1 + q2 * q2));
+  euler.pitch = asin(2 * (q0 * q2 - q1 * q3));
+  euler.yaw = atan2(2 * (q0 * q3 + q1 * q2), 1 - 2 * (q2 * q2 + q3 * q3));
 }
 
 Euler Quaternion::ToEuler(void) const {
-    Euler euler;
-    ToEuler(euler);
-    return euler;
+  Euler euler;
+  ToEuler(euler);
+  return euler;
 }
 
 void Quaternion::ToRotationMatrix(RotationMatrix &matrix) const {
-    float aSq = q0 * q0;
-    float bSq = q1 * q1;
-    float cSq = q2 * q2;
-    float dSq = q3 * q3;
-    matrix.m[0][0] = aSq + bSq - cSq - dSq;
-    matrix.m[0][1] = 2.0f * (q1 * q2 - q0 * q3);
-    matrix.m[0][2] = 2.0f * (q0 * q2 + q1 * q3);
-    matrix.m[1][0] = 2.0f * (q1 * q2 + q0 * q3);
-    matrix.m[1][1] = aSq - bSq + cSq - dSq;
-    matrix.m[1][2] = 2.0f * (q2 * q3 - q0 * q1);
-    matrix.m[2][0] = 2.0f * (q1 * q3 - q0 * q2);
-    matrix.m[2][1] = 2.0f * (q0 * q1 + q2 * q3);
-    matrix.m[2][2] = aSq - bSq - cSq + dSq;
+  float aSq = q0 * q0;
+  float bSq = q1 * q1;
+  float cSq = q2 * q2;
+  float dSq = q3 * q3;
+  matrix.m[0][0] = aSq + bSq - cSq - dSq;
+  matrix.m[0][1] = 2.0f * (q1 * q2 - q0 * q3);
+  matrix.m[0][2] = 2.0f * (q0 * q2 + q1 * q3);
+  matrix.m[1][0] = 2.0f * (q1 * q2 + q0 * q3);
+  matrix.m[1][1] = aSq - bSq + cSq - dSq;
+  matrix.m[1][2] = 2.0f * (q2 * q3 - q0 * q1);
+  matrix.m[2][0] = 2.0f * (q1 * q3 - q0 * q2);
+  matrix.m[2][1] = 2.0f * (q0 * q1 + q2 * q3);
+  matrix.m[2][2] = aSq - bSq - cSq + dSq;
 }
 
 Quaternion &Quaternion::operator+=(const Quaternion &quaternion) {
-    q0+=quaternion.q0;
-    q1+=quaternion.q1;
-    q2+=quaternion.q2;
-    q3+=quaternion.q3;
-    return (*this);
+  q0 += quaternion.q0;
+  q1 += quaternion.q1;
+  q2 += quaternion.q2;
+  q3 += quaternion.q3;
+  return (*this);
 }
 
 Quaternion &Quaternion::operator-=(const Quaternion &quaternion) {
-    q0-=quaternion.q0;
-    q1-=quaternion.q1;
-    q2-=quaternion.q2;
-    q3-=quaternion.q3;
-    return (*this);
+  q0 -= quaternion.q0;
+  q1 -= quaternion.q1;
+  q2 -= quaternion.q2;
+  q3 -= quaternion.q3;
+  return (*this);
 }
 
-Quaternion operator + (const Quaternion &quaternionA,const Quaternion &quaterniontB) {
-    return Quaternion(
-               quaternionA.q0 + quaterniontB.q0,
-               quaternionA.q1 + quaterniontB.q1,
-               quaternionA.q2 + quaterniontB.q2,
-               quaternionA.q3 + quaterniontB.q3);
+Quaternion operator+(const Quaternion &quaternionA,
+                     const Quaternion &quaterniontB) {
+  return Quaternion(
+      quaternionA.q0 + quaterniontB.q0, quaternionA.q1 + quaterniontB.q1,
+      quaternionA.q2 + quaterniontB.q2, quaternionA.q3 + quaterniontB.q3);
 }
 
-Quaternion operator- (const Quaternion &quaterniontA,const Quaternion &quaterniontB) {
-   return Quaternion(
-               quaterniontA.q0 - quaterniontB.q0,
-               quaterniontA.q1 - quaterniontB.q1,
-               quaterniontA.q2 - quaterniontB.q2,
-               quaterniontA.q3 - quaterniontB.q3);
+Quaternion operator-(const Quaternion &quaterniontA,
+                     const Quaternion &quaterniontB) {
+  return Quaternion(
+      quaterniontA.q0 - quaterniontB.q0, quaterniontA.q1 - quaterniontB.q1,
+      quaterniontA.q2 - quaterniontB.q2, quaterniontA.q3 - quaterniontB.q3);
 }
 
 Quaternion operator-(const Quaternion &quaternion) {
-    return Quaternion(-quaternion.q0,-quaternion.q1,-quaternion.q2,-quaternion.q3);
+  return Quaternion(-quaternion.q0, -quaternion.q1, -quaternion.q2,
+                    -quaternion.q3);
 }
 
-Quaternion operator * (const Quaternion &quaterniontA,const Quaternion &quaterniontB) {
-    return Quaternion(
-               quaterniontA.q0 * quaterniontB.q0 - quaterniontA.q1 * quaterniontB.q1 - quaterniontA.q2 * quaterniontB.q2 - quaterniontA.q3 * quaterniontB.q3,
-               quaterniontA.q0 * quaterniontB.q1 + quaterniontA.q1 * quaterniontB.q0 + quaterniontA.q2 * quaterniontB.q3 - quaterniontA.q3 * quaterniontB.q2,
-               quaterniontA.q0 * quaterniontB.q2 - quaterniontA.q1 * quaterniontB.q3 + quaterniontA.q2 * quaterniontB.q0 + quaterniontA.q3 * quaterniontB.q1,
-               quaterniontA.q0 * quaterniontB.q3 + quaterniontA.q1 * quaterniontB.q2 - quaterniontA.q2 * quaterniontB.q1 + quaterniontA.q3 * quaterniontB.q0);
+Quaternion operator*(const Quaternion &quaterniontA,
+                     const Quaternion &quaterniontB) {
+  return Quaternion(
+      quaterniontA.q0 * quaterniontB.q0 - quaterniontA.q1 * quaterniontB.q1 -
+          quaterniontA.q2 * quaterniontB.q2 - quaterniontA.q3 * quaterniontB.q3,
+      quaterniontA.q0 * quaterniontB.q1 + quaterniontA.q1 * quaterniontB.q0 +
+          quaterniontA.q2 * quaterniontB.q3 - quaterniontA.q3 * quaterniontB.q2,
+      quaterniontA.q0 * quaterniontB.q2 - quaterniontA.q1 * quaterniontB.q3 +
+          quaterniontA.q2 * quaterniontB.q0 + quaterniontA.q3 * quaterniontB.q1,
+      quaterniontA.q0 * quaterniontB.q3 + quaterniontA.q1 * quaterniontB.q2 -
+          quaterniontA.q2 * quaterniontB.q1 +
+          quaterniontA.q3 * quaterniontB.q0);
 }
 
-Quaternion operator * (float coeff,const Quaternion &quaternion) {
-    return Quaternion(
-               coeff*quaternion.q0,
-               coeff*quaternion.q1,
-               coeff*quaternion.q2,
-               coeff*quaternion.q3);
+Quaternion operator*(float coeff, const Quaternion &quaternion) {
+  return Quaternion(coeff * quaternion.q0, coeff * quaternion.q1,
+                    coeff * quaternion.q2, coeff * quaternion.q3);
 }
 
-
-Quaternion operator * (const Quaternion &quaternion,float coeff) {
-    return Quaternion(
-               coeff*quaternion.q0,
-               coeff*quaternion.q1,
-               coeff*quaternion.q2,
-               coeff*quaternion.q3);
+Quaternion operator*(const Quaternion &quaternion, float coeff) {
+  return Quaternion(coeff * quaternion.q0, coeff * quaternion.q1,
+                    coeff * quaternion.q2, coeff * quaternion.q3);
 }
 
Index: trunk/lib/FlairCore/src/Quaternion.h
===================================================================
--- trunk/lib/FlairCore/src/Quaternion.h	(revision 14)
+++ trunk/lib/FlairCore/src/Quaternion.h	(revision 15)
@@ -13,201 +13,205 @@
 #define QUATERNION_H
 
-namespace flair { namespace core {
-    class Euler;
-    class Vector3D;
-    class RotationMatrix;
-
-    /*! \class Quaternion
-    *
-    * \brief Class defining a quaternion
-    */
-    class Quaternion {
-        public:
-            /*!
-            * \brief Constructor
-            *
-            * Construct a quaternion using specified values.
-            *
-            * \param q0, scalar part
-            * \param q1
-            * \param q2
-            * \param q3
-            */
-            Quaternion(float q0=1,float q1=0,float q2=0,float q3=0);
-
-            /*!
-            * \brief Destructor
-            *
-            */
-            ~Quaternion();
-
-            /*!
-            * \brief Norm
-            *
-            * \return norm
-            */
-            float GetNorm(void) const;
-
-            /*!
-            * \brief Normalize
-            */
-            void Normalize(void);
-
-            /*!
-            * \brief Logarithm
-            *
-            * This method also Normalize the quaternion.
-            *
-            * \param logarithm output logarithm
-            */
-            void GetLogarithm(Vector3D &logarithm);
-
-            /*!
-            * \brief Logarithm
-            *
-            * This method also Normalize the quaternion.
-            *
-            * \return output logarithm
-            */
-            Vector3D GetLogarithm(void);
-
-            /*!
-            * \brief Conjugate
-            */
-            void Conjugate(void);
-
-            /*!
-            * \brief Conjugate
-            *
-            * \return Conjugate
-            */
-            Quaternion GetConjugate(void);
-
-            /*!
-            * \brief Derivative
-            *
-            * \param w angular speed
-            *
-            * \return derivative
-            */
-            Quaternion GetDerivative(const Vector3D &angularSpeed) const;
-
-            /*!
-            * \brief Derivate
-            *
-            * \param w rotationonal speed
-            */
-            void Derivate(const Vector3D &angularSpeed);
-
-            /*!
-            * \brief Convert to euler angles
-            *
-            * \param euler output euler angles
-            */
-            void ToEuler(Euler &euler) const;
-
-            /*!
-            * \brief Convert to euler angles
-            *
-            * \return euler angles
-            */
-            Euler ToEuler(void) const;
-
-            /*!
-            * \brief Convert to rotation matrix
-            *
-            * \param m output matrix
-            */
-            void ToRotationMatrix(RotationMatrix &matrix) const;
-
-            /*!
-            * \brief q0
-            */
-            float q0;
-
-            /*!
-            * \brief q1
-            */
-            float q1;
-
-            /*!
-            * \brief q2
-            */
-            float q2;
-
-            /*!
-            * \brief q3
-            */
-            float q3;
-
-            Quaternion& operator+=(const Quaternion& quaternion);
-            Quaternion& operator-=(const Quaternion& quaternion);
-            Quaternion& operator=(const Quaternion& quaternion);
-    };
-
-    /*! Add
-    *
-    * \brief Add
-    *
-    * \param quaterniontA quaternion
-    * \param quaterniontB quaternion
-    *
-    * \return quaterniontA+quaterniontB
-    */
-    Quaternion operator + (Quaternion const &quaterniontA,Quaternion const &quaterniontB);
-
-    /*! Substract
-    *
-    * \brief Substract
-    *
-    * \param quaterniontA quaternion
-    * \param quaterniontB quaternion
-    *
-    * \return quaterniontA-quaterniontB
-    */
-    Quaternion operator - (Quaternion const &quaternionA,Quaternion const &quaterniontB);
-
-    /*! Minus
-    *
-    * \brief Minus
-    *
-    * \param quaternion quaternion
-    *
-    * \return -quaternion
-    */
-    Quaternion operator-(const Quaternion &quaternion);
-
-    /*! Multiply
-    *
-    * \brief Multiply
-    *
-    * \param quaterniontA quaternion
-    * \param quaterniontB quaternion
-    *
-    * \return quaterniontA*quaterniontB
-    */
-    Quaternion operator * (Quaternion const &quaternionA,Quaternion const &quaterniontB);
-
-    /*! Multiply
-    *
-    * \brief Multiply
-    *
-    * \param coeff coefficient
-    * \param quat quaternion
-    *
-    * \return coeff*quat
-    */
-    Quaternion operator * (float coeff,Quaternion const &quaternion);
-
-    /*! Multiply
-    *
-    * \brief Multiply
-    *
-    * \param quat quaternion
-    * \param coeff coefficient
-    *
-    * \return coeff*quat
-    */
-    Quaternion operator * (Quaternion const &quaternion,float coeff);
+namespace flair {
+namespace core {
+class Euler;
+class Vector3D;
+class RotationMatrix;
+
+/*! \class Quaternion
+*
+* \brief Class defining a quaternion
+*/
+class Quaternion {
+public:
+  /*!
+  * \brief Constructor
+  *
+  * Construct a quaternion using specified values.
+  *
+  * \param q0, scalar part
+  * \param q1
+  * \param q2
+  * \param q3
+  */
+  Quaternion(float q0 = 1, float q1 = 0, float q2 = 0, float q3 = 0);
+
+  /*!
+  * \brief Destructor
+  *
+  */
+  ~Quaternion();
+
+  /*!
+  * \brief Norm
+  *
+  * \return norm
+  */
+  float GetNorm(void) const;
+
+  /*!
+  * \brief Normalize
+  */
+  void Normalize(void);
+
+  /*!
+  * \brief Logarithm
+  *
+  * This method also Normalize the quaternion.
+  *
+  * \param logarithm output logarithm
+  */
+  void GetLogarithm(Vector3D &logarithm);
+
+  /*!
+  * \brief Logarithm
+  *
+  * This method also Normalize the quaternion.
+  *
+  * \return output logarithm
+  */
+  Vector3D GetLogarithm(void);
+
+  /*!
+  * \brief Conjugate
+  */
+  void Conjugate(void);
+
+  /*!
+  * \brief Conjugate
+  *
+  * \return Conjugate
+  */
+  Quaternion GetConjugate(void);
+
+  /*!
+  * \brief Derivative
+  *
+  * \param w angular speed
+  *
+  * \return derivative
+  */
+  Quaternion GetDerivative(const Vector3D &angularSpeed) const;
+
+  /*!
+  * \brief Derivate
+  *
+  * \param w rotationonal speed
+  */
+  void Derivate(const Vector3D &angularSpeed);
+
+  /*!
+  * \brief Convert to euler angles
+  *
+  * \param euler output euler angles
+  */
+  void ToEuler(Euler &euler) const;
+
+  /*!
+  * \brief Convert to euler angles
+  *
+  * \return euler angles
+  */
+  Euler ToEuler(void) const;
+
+  /*!
+  * \brief Convert to rotation matrix
+  *
+  * \param m output matrix
+  */
+  void ToRotationMatrix(RotationMatrix &matrix) const;
+
+  /*!
+  * \brief q0
+  */
+  float q0;
+
+  /*!
+  * \brief q1
+  */
+  float q1;
+
+  /*!
+  * \brief q2
+  */
+  float q2;
+
+  /*!
+  * \brief q3
+  */
+  float q3;
+
+  Quaternion &operator+=(const Quaternion &quaternion);
+  Quaternion &operator-=(const Quaternion &quaternion);
+  Quaternion &operator=(const Quaternion &quaternion);
+};
+
+/*! Add
+*
+* \brief Add
+*
+* \param quaterniontA quaternion
+* \param quaterniontB quaternion
+*
+* \return quaterniontA+quaterniontB
+*/
+Quaternion operator+(Quaternion const &quaterniontA,
+                     Quaternion const &quaterniontB);
+
+/*! Substract
+*
+* \brief Substract
+*
+* \param quaterniontA quaternion
+* \param quaterniontB quaternion
+*
+* \return quaterniontA-quaterniontB
+*/
+Quaternion operator-(Quaternion const &quaternionA,
+                     Quaternion const &quaterniontB);
+
+/*! Minus
+*
+* \brief Minus
+*
+* \param quaternion quaternion
+*
+* \return -quaternion
+*/
+Quaternion operator-(const Quaternion &quaternion);
+
+/*! Multiply
+*
+* \brief Multiply
+*
+* \param quaterniontA quaternion
+* \param quaterniontB quaternion
+*
+* \return quaterniontA*quaterniontB
+*/
+Quaternion operator*(Quaternion const &quaternionA,
+                     Quaternion const &quaterniontB);
+
+/*! Multiply
+*
+* \brief Multiply
+*
+* \param coeff coefficient
+* \param quat quaternion
+*
+* \return coeff*quat
+*/
+Quaternion operator*(float coeff, Quaternion const &quaternion);
+
+/*! Multiply
+*
+* \brief Multiply
+*
+* \param quat quaternion
+* \param coeff coefficient
+*
+* \return coeff*quat
+*/
+Quaternion operator*(Quaternion const &quaternion, float coeff);
 
 } // end namespace core
Index: trunk/lib/FlairCore/src/RTDM_I2cPort.cpp
===================================================================
--- trunk/lib/FlairCore/src/RTDM_I2cPort.cpp	(revision 14)
+++ trunk/lib/FlairCore/src/RTDM_I2cPort.cpp	(revision 15)
@@ -26,87 +26,76 @@
 using std::string;
 
-namespace flair
-{
-namespace core
-{
+namespace flair {
+namespace core {
 
-RTDM_I2cPort::RTDM_I2cPort(const Object* parent,string name,string device) : I2cPort(parent,name)
-{
-    int err=0;
-    struct rti2c_config write_config;
+RTDM_I2cPort::RTDM_I2cPort(const Object *parent, string name, string device)
+    : I2cPort(parent, name) {
+  int err = 0;
+  struct rti2c_config write_config;
 
-    //printf("i2c integer le mutex dans le driver, avec acces ioctl\n");
-    fd = rt_dev_open(device.c_str(), 0);
-    if (fd < 0)
-	{
-		Err("rt_dev_open (%s)\n",ObjectName().c_str(),strerror(-fd));
-	}
+  // printf("i2c integer le mutex dans le driver, avec acces ioctl\n");
+  fd = rt_dev_open(device.c_str(), 0);
+  if (fd < 0) {
+    Err("rt_dev_open (%s)\n", ObjectName().c_str(), strerror(-fd));
+  }
 
-	write_config.config_mask       = RTI2C_SET_BAUD|RTI2C_SET_TIMEOUT_RX|RTI2C_SET_TIMEOUT_TX;
-	write_config.baud_rate         = 400000;
-	write_config.rx_timeout        = 500000;
-	write_config.tx_timeout        = 1000000;//5ms pour les xbldc, normalement 1ms
-	// the rest implicitely remains default
+  write_config.config_mask =
+      RTI2C_SET_BAUD | RTI2C_SET_TIMEOUT_RX | RTI2C_SET_TIMEOUT_TX;
+  write_config.baud_rate = 400000;
+  write_config.rx_timeout = 500000;
+  write_config.tx_timeout = 1000000; // 5ms pour les xbldc, normalement 1ms
+  // the rest implicitely remains default
 
-	// config
-	err = rt_dev_ioctl(fd, RTI2C_RTIOC_SET_CONFIG, &write_config );
-	if (err)
-	{
-	    Err("rt_dev_ioctl RTI2C_RTIOC_SET_CONFIG error (%s)\n",ObjectName().c_str(),strerror(-err));
-	}
+  // config
+  err = rt_dev_ioctl(fd, RTI2C_RTIOC_SET_CONFIG, &write_config);
+  if (err) {
+    Err("rt_dev_ioctl RTI2C_RTIOC_SET_CONFIG error (%s)\n",
+        ObjectName().c_str(), strerror(-err));
+  }
 }
 
-RTDM_I2cPort::~RTDM_I2cPort()
-{
-    rt_dev_close(fd);
+RTDM_I2cPort::~RTDM_I2cPort() { rt_dev_close(fd); }
+
+int RTDM_I2cPort::SetSlave(uint16_t address) {
+  int err = rt_dev_ioctl(fd, RTI2C_RTIOC_SET_SLAVE, &address);
+  if (err) {
+    Err("rt_dev_ioctl RTI2C_RTIOC_SET_SLAVE error (%s)\n", strerror(-err));
+  }
+
+  return err;
 }
 
-int RTDM_I2cPort::SetSlave(uint16_t address)
-{
-	int err = rt_dev_ioctl(fd, RTI2C_RTIOC_SET_SLAVE, &address);
-    if (err)
-	{
-	    Err("rt_dev_ioctl RTI2C_RTIOC_SET_SLAVE error (%s)\n",strerror(-err));
-	}
+void RTDM_I2cPort::SetRxTimeout(Time timeout_ns) {
+  struct rti2c_config write_config;
 
-	return err;
+  write_config.config_mask = RTI2C_SET_TIMEOUT_RX;
+  write_config.rx_timeout = timeout_ns;
+
+  int err = rt_dev_ioctl(fd, RTI2C_RTIOC_SET_CONFIG, &write_config);
+  if (err) {
+    Err("rt_dev_ioctl RTI2C_RTIOC_SET_CONFIG (%s)\n", ObjectName().c_str(),
+        strerror(-err));
+  }
 }
 
-void RTDM_I2cPort::SetRxTimeout(Time timeout_ns)
-{
-    struct rti2c_config write_config;
+void RTDM_I2cPort::SetTxTimeout(Time timeout_ns) {
+  struct rti2c_config write_config;
 
-	write_config.config_mask       = RTI2C_SET_TIMEOUT_RX;
-	write_config.rx_timeout        = timeout_ns;
+  write_config.config_mask = RTI2C_SET_TIMEOUT_TX;
+  write_config.tx_timeout = timeout_ns;
 
-	int err = rt_dev_ioctl(fd, RTI2C_RTIOC_SET_CONFIG, &write_config );
-	if (err)
-	{
-	    Err("rt_dev_ioctl RTI2C_RTIOC_SET_CONFIG (%s)\n",ObjectName().c_str(),strerror(-err));
-	}
+  int err = rt_dev_ioctl(fd, RTI2C_RTIOC_SET_CONFIG, &write_config);
+  if (err) {
+    Err("rt_dev_ioctl RTI2C_RTIOC_SET_CONFIG (%s)\n", ObjectName().c_str(),
+        strerror(-err));
+  }
 }
 
-void RTDM_I2cPort::SetTxTimeout(Time timeout_ns)
-{
-    struct rti2c_config write_config;
-
-	write_config.config_mask       = RTI2C_SET_TIMEOUT_TX;
-	write_config.tx_timeout        = timeout_ns;
-
-	int err = rt_dev_ioctl(fd, RTI2C_RTIOC_SET_CONFIG, &write_config );
-	if (err)
-	{
-	    Err("rt_dev_ioctl RTI2C_RTIOC_SET_CONFIG (%s)\n",ObjectName().c_str(),strerror(-err));
-	}
+ssize_t RTDM_I2cPort::Write(const void *buf, size_t nbyte) {
+  return rt_dev_write(fd, buf, nbyte);
 }
 
-ssize_t RTDM_I2cPort::Write(const void *buf,size_t nbyte)
-{
-    return rt_dev_write(fd, buf, nbyte);
-}
-
-ssize_t RTDM_I2cPort::Read(void *buf,size_t nbyte)
-{
-    return rt_dev_read(fd, buf, nbyte);
+ssize_t RTDM_I2cPort::Read(void *buf, size_t nbyte) {
+  return rt_dev_read(fd, buf, nbyte);
 }
 
@@ -119,42 +108,23 @@
 using namespace flair::core;
 
+namespace flair {
+namespace core {
 
-namespace flair
-{
-namespace core
-{
-
-RTDM_I2cPort::RTDM_I2cPort(const Object* parent,string name,string device) : I2cPort(parent,name)
-{
-    Err("not available in non real time\n");
+RTDM_I2cPort::RTDM_I2cPort(const Object *parent, string name, string device)
+    : I2cPort(parent, name) {
+  Err("not available in non real time\n");
 }
 
-RTDM_I2cPort::~RTDM_I2cPort()
-{
+RTDM_I2cPort::~RTDM_I2cPort() {}
 
-}
+int RTDM_I2cPort::SetSlave(uint16_t address) { return -1; }
 
-int RTDM_I2cPort::SetSlave(uint16_t address)
-{
-	return -1;
-}
+void RTDM_I2cPort::SetRxTimeout(Time timeout_ns) {}
 
-void RTDM_I2cPort::SetRxTimeout(Time timeout_ns)
-{
-}
+void RTDM_I2cPort::SetTxTimeout(Time timeout_ns) {}
 
-void RTDM_I2cPort::SetTxTimeout(Time timeout_ns)
-{
-}
+ssize_t RTDM_I2cPort::Write(const void *buf, size_t nbyte) { return -1; }
 
-ssize_t RTDM_I2cPort::Write(const void *buf,size_t nbyte)
-{
-    return -1;
-}
-
-ssize_t RTDM_I2cPort::Read(void *buf,size_t nbyte)
-{
-    return -1;
-}
+ssize_t RTDM_I2cPort::Read(void *buf, size_t nbyte) { return -1; }
 
 } // end namespace core
Index: trunk/lib/FlairCore/src/RTDM_I2cPort.h
===================================================================
--- trunk/lib/FlairCore/src/RTDM_I2cPort.h	(revision 14)
+++ trunk/lib/FlairCore/src/RTDM_I2cPort.h	(revision 15)
@@ -16,88 +16,85 @@
 #include <I2cPort.h>
 
-namespace flair
-{
-namespace core
-{
-    /*! \class RTDM_I2cPort
-    *
-    * \brief Class for real time i2c port using RTDM
-    *
-    * This class can only be used with the real time version of Framework library.
-    *
-    */
-    class RTDM_I2cPort: public I2cPort
-    {
-        public:
-            /*!
-            * \brief Constructor
-            *
-            * Construct an RTDM i2c port, with the following default values: \n
-            * - 400kbits baudrate \n
-            * - 500000ns RX timeout \n
-            * - 1000000ns TX timeout
-            *
-            * \param parent parent
-            * \param name name
-            * \param device i2c device (ex rti2c1)
-            */
-            RTDM_I2cPort(const Object* parent,std::string name,std::string device);
+namespace flair {
+namespace core {
+/*! \class RTDM_I2cPort
+*
+* \brief Class for real time i2c port using RTDM
+*
+* This class can only be used with the real time version of Framework library.
+*
+*/
+class RTDM_I2cPort : public I2cPort {
+public:
+  /*!
+  * \brief Constructor
+  *
+  * Construct an RTDM i2c port, with the following default values: \n
+  * - 400kbits baudrate \n
+  * - 500000ns RX timeout \n
+  * - 1000000ns TX timeout
+  *
+  * \param parent parent
+  * \param name name
+  * \param device i2c device (ex rti2c1)
+  */
+  RTDM_I2cPort(const Object *parent, std::string name, std::string device);
 
-            /*!
-            * \brief Destructor
-            *
-            */
-            ~RTDM_I2cPort();
+  /*!
+  * \brief Destructor
+  *
+  */
+  ~RTDM_I2cPort();
 
-            /*!
-            * \brief Set slave's address
-            *
-            * This method need to be called before any communication.
-            *
-            * \param address slave's address
-            */
-            int SetSlave(uint16_t address);
+  /*!
+  * \brief Set slave's address
+  *
+  * This method need to be called before any communication.
+  *
+  * \param address slave's address
+  */
+  int SetSlave(uint16_t address);
 
-            /*!
-            * \brief Write datas
-            *
-            * \param buf pointer to datas
-            * \param nbyte length of datas
-            *
-            * \return amount of written datas
-            */
-            ssize_t Write(const void *buf,size_t nbyte);
+  /*!
+  * \brief Write datas
+  *
+  * \param buf pointer to datas
+  * \param nbyte length of datas
+  *
+  * \return amount of written datas
+  */
+  ssize_t Write(const void *buf, size_t nbyte);
 
-            /*!
-            * \brief Read datas
-            *
-            * \param buf pointer to datas
-            * \param nbyte length of datas
-            *
-            * \return amount of read datas
-            */
-            ssize_t Read(void *buf,size_t nbyte);
+  /*!
+  * \brief Read datas
+  *
+  * \param buf pointer to datas
+  * \param nbyte length of datas
+  *
+  * \return amount of read datas
+  */
+  ssize_t Read(void *buf, size_t nbyte);
 
-            /*!
-            * \brief Set RX timeout
-            *
-            * Timeout for waiting an ACK from the slave.
-            *
-            * \param timeout_ns timeout in nano second
-            */
-            void SetRxTimeout(Time timeout_ns);
+  /*!
+  * \brief Set RX timeout
+  *
+  * Timeout for waiting an ACK from the slave.
+  *
+  * \param timeout_ns timeout in nano second
+  */
+  void SetRxTimeout(Time timeout_ns);
 
-            /*!
-            * \brief Set TX timeout
-            *
-            * Timeout for waiting an ACK from the slave.
-            *
-            * \param timeout_ns timeout in nano second
-            */
-            void SetTxTimeout(Time timeout_ns);
+  /*!
+  * \brief Set TX timeout
+  *
+  * Timeout for waiting an ACK from the slave.
+  *
+  * \param timeout_ns timeout in nano second
+  */
+  void SetTxTimeout(Time timeout_ns);
 
-        private:
-            int fd;
-    };
+private:
+  int fd;
+};
 } // end namespace core
 } // end namespace flair
Index: trunk/lib/FlairCore/src/RTDM_SerialPort.cpp
===================================================================
--- trunk/lib/FlairCore/src/RTDM_SerialPort.cpp	(revision 14)
+++ trunk/lib/FlairCore/src/RTDM_SerialPort.cpp	(revision 15)
@@ -26,86 +26,74 @@
 using std::string;
 
-namespace flair
-{
-namespace core
-{
+namespace flair {
+namespace core {
 
-RTDM_SerialPort::RTDM_SerialPort(const Object* parent,string name,string device) : SerialPort(parent,name)
-{
-    struct rtser_config write_config;
+RTDM_SerialPort::RTDM_SerialPort(const Object *parent, string name,
+                                 string device)
+    : SerialPort(parent, name) {
+  struct rtser_config write_config;
 
-	write_config.config_mask       = RTSER_SET_BAUD | RTSER_SET_TIMESTAMP_HISTORY,
-	write_config.baud_rate         = 115200,
-	write_config.timestamp_history = RTSER_DEF_TIMESTAMP_HISTORY,
-	// the rest implicitely remains default
+  write_config.config_mask = RTSER_SET_BAUD | RTSER_SET_TIMESTAMP_HISTORY,
+  write_config.baud_rate = 115200,
+  write_config.timestamp_history = RTSER_DEF_TIMESTAMP_HISTORY,
+  // the rest implicitely remains default
 
-	fd = rt_dev_open(device.c_str(), 0);
-	if (fd < 0)
-	{
-		Err("erreur rt_dev_open (%s)\n",strerror(-fd));
-	}
+      fd = rt_dev_open(device.c_str(), 0);
+  if (fd < 0) {
+    Err("erreur rt_dev_open (%s)\n", strerror(-fd));
+  }
 
-	// config
-	int err = rt_dev_ioctl(fd, RTSER_RTIOC_SET_CONFIG, &write_config );
-	if (err)
-	{
-	    Err("erreur rt_dev_ioctl RTSER_RTIOC_SET_CONFIG (%s)\n",strerror(-err));
-	}
+  // config
+  int err = rt_dev_ioctl(fd, RTSER_RTIOC_SET_CONFIG, &write_config);
+  if (err) {
+    Err("erreur rt_dev_ioctl RTSER_RTIOC_SET_CONFIG (%s)\n", strerror(-err));
+  }
 }
 
-RTDM_SerialPort::~RTDM_SerialPort()
-{
-    rt_dev_close(fd);
+RTDM_SerialPort::~RTDM_SerialPort() { rt_dev_close(fd); }
+
+void RTDM_SerialPort::SetBaudrate(int baudrate) {
+  struct rtser_config write_config;
+
+  write_config.config_mask = RTSER_SET_BAUD;
+  write_config.baud_rate = baudrate;
+  // the rest implicitely remains default
+
+  // config
+  int err = rt_dev_ioctl(fd, RTSER_RTIOC_SET_CONFIG, &write_config);
+  if (err) {
+    Err("erreur rt_dev_ioctl RTSER_RTIOC_SET_CONFIG (%s)\n", strerror(-err));
+  }
 }
 
-void RTDM_SerialPort::SetBaudrate(int baudrate)
-{
-    struct rtser_config write_config;
+void RTDM_SerialPort::SetRxTimeout(core::Time timeout_ns) {
+  struct rtser_config write_config;
 
-	write_config.config_mask       = RTSER_SET_BAUD;
-	write_config.baud_rate         = baudrate;
-	// the rest implicitely remains default
+  write_config.config_mask = RTSER_SET_TIMEOUT_RX;
+  write_config.rx_timeout = timeout_ns;
+  // the rest implicitely remains default
 
-	// config
-	int err = rt_dev_ioctl(fd, RTSER_RTIOC_SET_CONFIG, &write_config );
-	if (err)
-	{
-	    Err("erreur rt_dev_ioctl RTSER_RTIOC_SET_CONFIG (%s)\n",strerror(-err));
-	}
+  // config
+  int err = rt_dev_ioctl(fd, RTSER_RTIOC_SET_CONFIG, &write_config);
+  if (err) {
+    Err("erreur rt_dev_ioctl RTSER_RTIOC_SET_CONFIG (%s)\n", strerror(-err));
+  }
 }
 
-void RTDM_SerialPort::SetRxTimeout(core::Time timeout_ns)
-{
-    struct rtser_config write_config;
+void RTDM_SerialPort::FlushInput(void) {
+  char tmp;
 
-	write_config.config_mask       = RTSER_SET_TIMEOUT_RX;
-	write_config.rx_timeout         = timeout_ns;
-	// the rest implicitely remains default
-
-	// config
-	int err = rt_dev_ioctl(fd, RTSER_RTIOC_SET_CONFIG, &write_config );
-	if (err)
-	{
-	    Err("erreur rt_dev_ioctl RTSER_RTIOC_SET_CONFIG (%s)\n",strerror(-err));
-	}
+  SetRxTimeout(1000000);
+  while (rt_dev_read(fd, &tmp, 1) == 1)
+    ;
+  SetRxTimeout(TIME_INFINITE);
 }
 
-void RTDM_SerialPort::FlushInput(void)
-{
-    char tmp;
-
-    SetRxTimeout(1000000);
-    while(rt_dev_read(fd,&tmp,1)==1);
-    SetRxTimeout(TIME_INFINITE);
+ssize_t RTDM_SerialPort::Write(const void *buf, size_t nbyte) {
+  return rt_dev_write(fd, buf, nbyte);
 }
 
-ssize_t RTDM_SerialPort::Write(const void *buf,size_t nbyte)
-{
-    return rt_dev_write(fd, buf, nbyte);
-}
-
-ssize_t RTDM_SerialPort::Read(void *buf,size_t nbyte)
-{
-    return rt_dev_read(fd, buf, nbyte);
+ssize_t RTDM_SerialPort::Read(void *buf, size_t nbyte) {
+  return rt_dev_read(fd, buf, nbyte);
 }
 
@@ -118,41 +106,24 @@
 using namespace flair::core;
 
+namespace flair {
+namespace core {
 
-namespace flair
-{
-namespace core
-{
-
-RTDM_SerialPort::RTDM_SerialPort(const Object* parent,string name,string device) : SerialPort(parent,name)
-{
-    Err("not available in non real time\n");
+RTDM_SerialPort::RTDM_SerialPort(const Object *parent, string name,
+                                 string device)
+    : SerialPort(parent, name) {
+  Err("not available in non real time\n");
 }
 
-RTDM_SerialPort::~RTDM_SerialPort()
-{
+RTDM_SerialPort::~RTDM_SerialPort() {}
 
-}
+ssize_t RTDM_SerialPort::Write(const void *buf, size_t nbyte) { return -1; }
 
-ssize_t RTDM_SerialPort::Write(const void *buf,size_t nbyte)
-{
-    return -1;
-}
+ssize_t RTDM_SerialPort::Read(void *buf, size_t nbyte) { return -1; }
 
-ssize_t RTDM_SerialPort::Read(void *buf,size_t nbyte)
-{
-    return -1;
-}
+void RTDM_SerialPort::SetBaudrate(int baudrate) {}
 
-void RTDM_SerialPort::SetBaudrate(int baudrate)
-{
-}
+void RTDM_SerialPort::SetRxTimeout(core::Time timeout_ns) {}
 
-void RTDM_SerialPort::SetRxTimeout(core::Time timeout_ns)
-{
-}
-
-void RTDM_SerialPort::FlushInput(void)
-{
-}
+void RTDM_SerialPort::FlushInput(void) {}
 
 } // end namespace core
Index: trunk/lib/FlairCore/src/RTDM_SerialPort.h
===================================================================
--- trunk/lib/FlairCore/src/RTDM_SerialPort.h	(revision 14)
+++ trunk/lib/FlairCore/src/RTDM_SerialPort.h	(revision 15)
@@ -16,83 +16,81 @@
 #include <SerialPort.h>
 
-namespace flair
-{
-namespace core
-{
-    /*! \class RTDM_SerialPort
-    *
-    * \brief Class for real time serial port using RTDM
-    *
-    * This class can only be used with the real time version of Framework library.
-    *
-    */
-    class RTDM_SerialPort: public SerialPort
-    {
+namespace flair {
+namespace core {
+/*! \class RTDM_SerialPort
+*
+* \brief Class for real time serial port using RTDM
+*
+* This class can only be used with the real time version of Framework library.
+*
+*/
+class RTDM_SerialPort : public SerialPort {
 
-        public:
-            /*!
-            * \brief Constructor
-            *
-            * Construct an RTDM serial port, with the following default values: \n
-            * - 115200bps baudrate
-            *
-            * \param parent parent
-            * \param name name
-            * \param device serial device (ex rtser1)
-            */
-            RTDM_SerialPort(const Object* parent,std::string port_name,std::string device);
+public:
+  /*!
+  * \brief Constructor
+  *
+  * Construct an RTDM serial port, with the following default values: \n
+  * - 115200bps baudrate
+  *
+  * \param parent parent
+  * \param name name
+  * \param device serial device (ex rtser1)
+  */
+  RTDM_SerialPort(const Object *parent, std::string port_name,
+                  std::string device);
 
-            /*!
-            * \brief Destructor
-            *
-            */
-            ~RTDM_SerialPort();
+  /*!
+  * \brief Destructor
+  *
+  */
+  ~RTDM_SerialPort();
 
-            /*!
-            * \brief Set baudrate
-            *
-            * \param baudrate baudrate
-            *
-            */
-            void SetBaudrate(int baudrate);
+  /*!
+  * \brief Set baudrate
+  *
+  * \param baudrate baudrate
+  *
+  */
+  void SetBaudrate(int baudrate);
 
-            /*!
-            * \brief Set RX timeout
-            *
-            * Timeout for waiting datas.
-            *
-            * \param timeout_ns timeout in nano second
-            */
-            void SetRxTimeout(Time timeout_ns);
+  /*!
+  * \brief Set RX timeout
+  *
+  * Timeout for waiting datas.
+  *
+  * \param timeout_ns timeout in nano second
+  */
+  void SetRxTimeout(Time timeout_ns);
 
-            /*!
-            * \brief Write datas
-            *
-            * \param buf pointer to datas
-            * \param nbyte length of datas
-            *
-            * \return amount of written datas
-            */
-            ssize_t Write(const void *buf,size_t nbyte);
+  /*!
+  * \brief Write datas
+  *
+  * \param buf pointer to datas
+  * \param nbyte length of datas
+  *
+  * \return amount of written datas
+  */
+  ssize_t Write(const void *buf, size_t nbyte);
 
-            /*!
-            * \brief Read datas
-            *
-            * \param buf pointer to datas
-            * \param nbyte length of datas
-            *
-            * \return amount of read datas
-            */
-            ssize_t Read(void *buf,size_t nbyte);
+  /*!
+  * \brief Read datas
+  *
+  * \param buf pointer to datas
+  * \param nbyte length of datas
+  *
+  * \return amount of read datas
+  */
+  ssize_t Read(void *buf, size_t nbyte);
 
-            /*!
-            * \brief Flush input datas
-            *
-            */
-            void FlushInput(void);
+  /*!
+  * \brief Flush input datas
+  *
+  */
+  void FlushInput(void);
 
-        private:
-            int fd;
-    };
+private:
+  int fd;
+};
 } // end namespace core
 } // end namespace flair
Index: trunk/lib/FlairCore/src/RangeFinderPlot.cpp
===================================================================
--- trunk/lib/FlairCore/src/RangeFinderPlot.cpp	(revision 14)
+++ trunk/lib/FlairCore/src/RangeFinderPlot.cpp	(revision 15)
@@ -11,5 +11,6 @@
 //  version:    $Id: $
 //
-//  purpose:    Class displaying a 2D plot on the ground station for laser range finder like Hokuyo
+//  purpose:    Class displaying a 2D plot on the ground station for laser range
+//  finder like Hokuyo
 //
 //
@@ -26,36 +27,40 @@
 using namespace flair::core;
 
-namespace flair { namespace gui {
+namespace flair {
+namespace gui {
 
-RangeFinderPlot::RangeFinderPlot(const LayoutPosition* position,string name,
-                                 string x_name,float xmin,float xmax,
-                                 string y_name,float ymin,float ymax,
-                                 const cvmatrix* datas,float start_angle,float end_angle,uint32_t nb_samples):
-                                 SendData(position,name,"RangeFinderPlot",200) {
-    this->datas=datas;
+RangeFinderPlot::RangeFinderPlot(const LayoutPosition *position, string name,
+                                 string x_name, float xmin, float xmax,
+                                 string y_name, float ymin, float ymax,
+                                 const cvmatrix *datas, float start_angle,
+                                 float end_angle, uint32_t nb_samples)
+    : SendData(position, name, "RangeFinderPlot", 200) {
+  this->datas = datas;
 
-    SetSendSize(datas->GetDataType().GetSize());
+  SetSendSize(datas->GetDataType().GetSize());
 
-    SetVolatileXmlProp("xmin",xmin);
-    SetVolatileXmlProp("xmax",xmax);
-    SetVolatileXmlProp("ymin",ymin);
-    SetVolatileXmlProp("ymax",ymax);
-    SetVolatileXmlProp("x_name",x_name);
-    SetVolatileXmlProp("y_name",y_name);
-    SetVolatileXmlProp("start_angle",start_angle);
-    SetVolatileXmlProp("end_angle",end_angle);
-    SetVolatileXmlProp("nb_samples",nb_samples);
-    SetVolatileXmlProp("type",datas->GetDataType().GetElementDataType().GetDescription());
-    SendXml();
+  SetVolatileXmlProp("xmin", xmin);
+  SetVolatileXmlProp("xmax", xmax);
+  SetVolatileXmlProp("ymin", ymin);
+  SetVolatileXmlProp("ymax", ymax);
+  SetVolatileXmlProp("x_name", x_name);
+  SetVolatileXmlProp("y_name", y_name);
+  SetVolatileXmlProp("start_angle", start_angle);
+  SetVolatileXmlProp("end_angle", end_angle);
+  SetVolatileXmlProp("nb_samples", nb_samples);
+  SetVolatileXmlProp(
+      "type", datas->GetDataType().GetElementDataType().GetDescription());
+  SendXml();
 
-    if(datas->Cols()!=1 || datas->Rows()!=nb_samples) Err("Wrong input matrix size\n");
+  if (datas->Cols() != 1 || datas->Rows() != nb_samples)
+    Err("Wrong input matrix size\n");
 }
 
 RangeFinderPlot::~RangeFinderPlot() {}
 
-void RangeFinderPlot::CopyDatas(char* buf) const {
-    datas->GetMutex();
-    memcpy(buf,datas->getCvMat()->data.ptr,datas->GetDataType().GetSize());
-    datas->ReleaseMutex();
+void RangeFinderPlot::CopyDatas(char *buf) const {
+  datas->GetMutex();
+  memcpy(buf, datas->getCvMat()->data.ptr, datas->GetDataType().GetSize());
+  datas->ReleaseMutex();
 }
 
Index: trunk/lib/FlairCore/src/RangeFinderPlot.h
===================================================================
--- trunk/lib/FlairCore/src/RangeFinderPlot.h	(revision 14)
+++ trunk/lib/FlairCore/src/RangeFinderPlot.h	(revision 15)
@@ -5,5 +5,6 @@
 /*!
  * \file RangeFinderPlot.h
- * \brief Class displaying a 2D plot on the ground station for laser range finder like Hokuyo
+ * \brief Class displaying a 2D plot on the ground station for laser range
+ * finder like Hokuyo
  * \author Guillaume Sanahuja, Copyright Heudiasyc UMR UTC/CNRS 7253
  * \date 2014/07/23
@@ -17,77 +18,75 @@
 #include <stdint.h>
 
-namespace flair
-{
-    namespace core
-    {
-        class cvmatrix;
-    }
+namespace flair {
+namespace core {
+class cvmatrix;
+}
 }
 
-namespace flair
-{
-namespace gui
-{
+namespace flair {
+namespace gui {
 
-    class LayoutPosition;
+class LayoutPosition;
 
-    /*! \class RangeFinderPlot
-    *
-    * \brief Class displaying a 2D plot on the ground station for laser range finder like Hokuyo
-    *
-    */
-    class RangeFinderPlot: public SendData
-    {
-        public:
-            /*!
-            * \brief Constructor
-            *
-            * Construct a 2D plot at given position. \n
-            * The RangeFinderPlot will automatically be child of position->getLayout() Layout. After calling this constructor,
-            * position will be deleted as it is no longer usefull.
-            *
-            * \param position position to display the plot
-            * \param name name
-            * \param x_name name of x axis
-            * \param xmin default xmin of the plot
-            * \param xmax default xmax of the plot
-            * \param y_name name of y axis
-            * \param ymin default ymin of the plot
-            * \param ymax default ymax of the plot
-            * \param datas laser datas
-            * \param start_angle start angle of the laser
-            * \param end_angle end angle of the laser
-            * \param nb_samples number of samples
-            */
-            RangeFinderPlot(const LayoutPosition* position,std::string name,
-                            std::string x_name,float xmin,float xmax,
-                            std::string y_name,float ymin,float ymax,
-                            const core::cvmatrix* datas,float start_angle,float end_angle,uint32_t nb_samples);
+/*! \class RangeFinderPlot
+*
+* \brief Class displaying a 2D plot on the ground station for laser range finder
+*like Hokuyo
+*
+*/
+class RangeFinderPlot : public SendData {
+public:
+  /*!
+  * \brief Constructor
+  *
+  * Construct a 2D plot at given position. \n
+  * The RangeFinderPlot will automatically be child of position->getLayout()
+  *Layout. After calling this constructor,
+  * position will be deleted as it is no longer usefull.
+  *
+  * \param position position to display the plot
+  * \param name name
+  * \param x_name name of x axis
+  * \param xmin default xmin of the plot
+  * \param xmax default xmax of the plot
+  * \param y_name name of y axis
+  * \param ymin default ymin of the plot
+  * \param ymax default ymax of the plot
+  * \param datas laser datas
+  * \param start_angle start angle of the laser
+  * \param end_angle end angle of the laser
+  * \param nb_samples number of samples
+  */
+  RangeFinderPlot(const LayoutPosition *position, std::string name,
+                  std::string x_name, float xmin, float xmax,
+                  std::string y_name, float ymin, float ymax,
+                  const core::cvmatrix *datas, float start_angle,
+                  float end_angle, uint32_t nb_samples);
 
-            /*!
-            * \brief Destructor
-            *
-            */
-            ~RangeFinderPlot();
+  /*!
+  * \brief Destructor
+  *
+  */
+  ~RangeFinderPlot();
 
-        private:
-            /*!
-            * \brief Copy datas to specified buffer
-            *
-            * Reimplemented from SendData.
-            *
-            * \param buf output buffer
-            */
-            void CopyDatas(char* buf) const;
+private:
+  /*!
+  * \brief Copy datas to specified buffer
+  *
+  * Reimplemented from SendData.
+  *
+  * \param buf output buffer
+  */
+  void CopyDatas(char *buf) const;
 
-            /*!
-            * \brief Extra Xml event
-            *
-            * Reimplemented from SendData.
-            */
-            void ExtraXmlEvent(void){};
+  /*!
+  * \brief Extra Xml event
+  *
+  * Reimplemented from SendData.
+  */
+  void ExtraXmlEvent(void){};
 
-            const core::cvmatrix* datas;
-    };
+  const core::cvmatrix *datas;
+};
 
 } // end namespace gui
Index: trunk/lib/FlairCore/src/RotationMatrix.cpp
===================================================================
--- trunk/lib/FlairCore/src/RotationMatrix.cpp	(revision 14)
+++ trunk/lib/FlairCore/src/RotationMatrix.cpp	(revision 15)
@@ -21,53 +21,49 @@
 #include "math.h"
 
-namespace flair
-{
-namespace core
-{
+namespace flair {
+namespace core {
 
 RotationMatrix::RotationMatrix() {
-    for(int i=0;i<3;i++) {
-        for(int j=0;j<3;j++) {
-            if(i==j) {
-                m[i][j]=1;
-            }else {
-                m[i][j]=0;
-            }
-        }
+  for (int i = 0; i < 3; i++) {
+    for (int j = 0; j < 3; j++) {
+      if (i == j) {
+        m[i][j] = 1;
+      } else {
+        m[i][j] = 0;
+      }
     }
+  }
 }
 
-RotationMatrix::~RotationMatrix() {
-
-}
+RotationMatrix::~RotationMatrix() {}
 
 void RotationMatrix::ToEuler(Euler &euler) const {
-    euler.roll=atanf(m[1][2]/m[2][2]);
-    euler.pitch=asinf(-m[0][2]);
-    euler.yaw=atan2f(m[0][1],m[0][0]);
+  euler.roll = atanf(m[1][2] / m[2][2]);
+  euler.pitch = asinf(-m[0][2]);
+  euler.yaw = atan2f(m[0][1], m[0][0]);
 }
 
 Euler RotationMatrix::ToEuler(void) const {
-    Euler euler;
-    ToEuler(euler);
-    return euler;
+  Euler euler;
+  ToEuler(euler);
+  return euler;
 }
 
-float& RotationMatrix::operator()(size_t row,size_t col) {
-    if(row<3 && col<3) {
-        return m[row][col];
-    } else {
-        Printf("RotationMatrix: index (%i,%i) out of bound\n",row,col);
-        return m[2][2];
-    }
+float &RotationMatrix::operator()(size_t row, size_t col) {
+  if (row < 3 && col < 3) {
+    return m[row][col];
+  } else {
+    Printf("RotationMatrix: index (%i,%i) out of bound\n", row, col);
+    return m[2][2];
+  }
 }
 
-const float& RotationMatrix::operator()(size_t row,size_t col) const {
-    if(row<3 && col<3) {
-        return m[row][col];
-    } else {
-        Printf("RotationMatrix: index (%i,%i) out of bound\n",row,col);
-        return m[2][2];
-    }
+const float &RotationMatrix::operator()(size_t row, size_t col) const {
+  if (row < 3 && col < 3) {
+    return m[row][col];
+  } else {
+    Printf("RotationMatrix: index (%i,%i) out of bound\n", row, col);
+    return m[2][2];
+  }
 }
 
Index: trunk/lib/FlairCore/src/RotationMatrix.h
===================================================================
--- trunk/lib/FlairCore/src/RotationMatrix.h	(revision 14)
+++ trunk/lib/FlairCore/src/RotationMatrix.h	(revision 15)
@@ -17,48 +17,48 @@
 namespace flair {
 namespace core {
-    class Euler;
+class Euler;
 
-    /*! \class RotationMatrix
-    *
-    * \brief Class defining a rotation matrix
-    */
-    class RotationMatrix {
-        public:
-            /*!
-            * \brief Constructor
-            *
-            * Construct an identity rotation matrix
-            *
-            */
-            RotationMatrix();
+/*! \class RotationMatrix
+*
+* \brief Class defining a rotation matrix
+*/
+class RotationMatrix {
+public:
+  /*!
+  * \brief Constructor
+  *
+  * Construct an identity rotation matrix
+  *
+  */
+  RotationMatrix();
 
-            /*!
-            * \brief Destructor
-            *
-            */
-            ~RotationMatrix();
+  /*!
+  * \brief Destructor
+  *
+  */
+  ~RotationMatrix();
 
-            /*!
-            * \brief Convert to euler angles
-            *
-            * \param euler output euler angles
-            */
-            void ToEuler(Euler &euler) const;
+  /*!
+  * \brief Convert to euler angles
+  *
+  * \param euler output euler angles
+  */
+  void ToEuler(Euler &euler) const;
 
-            /*!
-            * \brief Convert to euler angles
-            *
-            * \return euler angles
-            */
-            Euler ToEuler(void) const;
-            /*!
-            * \brief matrix
-            *
-            */
-            float m[3][3];
+  /*!
+  * \brief Convert to euler angles
+  *
+  * \return euler angles
+  */
+  Euler ToEuler(void) const;
+  /*!
+  * \brief matrix
+  *
+  */
+  float m[3][3];
 
-            float& operator()(size_t row,size_t col);
-            const float& operator()(size_t row,size_t col) const;
-    };
+  float &operator()(size_t row, size_t col);
+  const float &operator()(size_t row, size_t col) const;
+};
 
 } // end namespace core
Index: trunk/lib/FlairCore/src/SendData.cpp
===================================================================
--- trunk/lib/FlairCore/src/SendData.cpp	(revision 14)
+++ trunk/lib/FlairCore/src/SendData.cpp	(revision 15)
@@ -26,99 +26,93 @@
 using namespace flair::core;
 
-namespace flair
-{
-namespace gui
-{
+namespace flair {
+namespace gui {
 
-SendData::SendData(const LayoutPosition* position,string name,string type,uint16_t default_periodms,bool default_enabled) :Widget(position->getLayout(),name,type) {
-    pimpl_=new SendData_impl();
+SendData::SendData(const LayoutPosition *position, string name, string type,
+                   uint16_t default_periodms, bool default_enabled)
+    : Widget(position->getLayout(), name, type) {
+  pimpl_ = new SendData_impl();
 
-    pimpl_->send_size=0;
+  pimpl_->send_size = 0;
 
-    //default refesh rate: (ms)
-    pimpl_->send_period=default_periodms;
-    pimpl_->is_enabled=default_enabled;
+  // default refesh rate: (ms)
+  pimpl_->send_period = default_periodms;
+  pimpl_->is_enabled = default_enabled;
 
-    SetVolatileXmlProp("row",position->Row());
-    SetVolatileXmlProp("col",position->Col());
-    GetPersistentXmlProp("period",pimpl_->send_period);
-    SetPersistentXmlProp("period",pimpl_->send_period);
-    GetPersistentXmlProp("enabled",pimpl_->is_enabled);
-    SetPersistentXmlProp("enabled",pimpl_->is_enabled);
+  SetVolatileXmlProp("row", position->Row());
+  SetVolatileXmlProp("col", position->Col());
+  GetPersistentXmlProp("period", pimpl_->send_period);
+  SetPersistentXmlProp("period", pimpl_->send_period);
+  GetPersistentXmlProp("enabled", pimpl_->is_enabled);
+  SetPersistentXmlProp("enabled", pimpl_->is_enabled);
 
-    delete position;
+  delete position;
 
-    if(getUiCom()!=NULL) {
-        //register SendData for sending to ground station
-        getUiCom()->AddSendData(this);
-        //resume if necessary
-        getUiCom()->UpdateSendData(this);
-    }
+  if (getUiCom() != NULL) {
+    // register SendData for sending to ground station
+    getUiCom()->AddSendData(this);
+    // resume if necessary
+    getUiCom()->UpdateSendData(this);
+  }
 }
 
 SendData::~SendData() {
-    if(getUiCom()!=NULL) {
-        //unregister SendData for sending to ground station
-        getUiCom()->RemoveSendData(this);
-    }
+  if (getUiCom() != NULL) {
+    // unregister SendData for sending to ground station
+    getUiCom()->RemoveSendData(this);
+  }
 
-    delete pimpl_;
+  delete pimpl_;
 }
 
 void SendData::XmlEvent(void) {
-    uint16_t send_period;
-    bool is_enabled;
-    bool something_changed=false;
+  uint16_t send_period;
+  bool is_enabled;
+  bool something_changed = false;
 
-    if(GetPersistentXmlProp("period",send_period) && GetPersistentXmlProp("enabled",is_enabled)) {
-        if(send_period!=SendPeriod()) something_changed=true;
-        if(is_enabled!=IsEnabled()) something_changed=true;
-    }
+  if (GetPersistentXmlProp("period", send_period) &&
+      GetPersistentXmlProp("enabled", is_enabled)) {
+    if (send_period != SendPeriod())
+      something_changed = true;
+    if (is_enabled != IsEnabled())
+      something_changed = true;
+  }
 
-    if(something_changed) {
-        getFrameworkManager()->BlockCom();
+  if (something_changed) {
+    getFrameworkManager()->BlockCom();
 
-        SetSendPeriod(send_period);
-        SetEnabled(is_enabled);
+    SetSendPeriod(send_period);
+    SetEnabled(is_enabled);
 
-        getFrameworkManager()->UpdateSendData(this);
+    getFrameworkManager()->UpdateSendData(this);
 
-        //ack pour la station sol
-        //period and enabled are already in persistent prop
-        SetVolatileXmlProp("period",send_period);
-        SetVolatileXmlProp("enabled",is_enabled);
-        SendXml();
+    // ack pour la station sol
+    // period and enabled are already in persistent prop
+    SetVolatileXmlProp("period", send_period);
+    SetVolatileXmlProp("enabled", is_enabled);
+    SendXml();
 
-        getFrameworkManager()->UnBlockCom();
-    }
+    getFrameworkManager()->UnBlockCom();
+  }
 
-    ExtraXmlEvent();
+  ExtraXmlEvent();
 }
 
-size_t SendData::SendSize(void) const {
-    return pimpl_->send_size;
+size_t SendData::SendSize(void) const { return pimpl_->send_size; }
+
+uint16_t SendData::SendPeriod(void) const { return pimpl_->send_period; }
+
+bool SendData::IsEnabled(void) const { return pimpl_->is_enabled; }
+
+void SendData::SetEnabled(bool value) { pimpl_->is_enabled = value; }
+
+void SendData::SetSendSize(size_t value) {
+  pimpl_->send_size = value;
+
+  if (getUiCom() != NULL)
+    getUiCom()->UpdateDataToSendSize();
 }
 
-uint16_t SendData::SendPeriod(void) const {
-    return pimpl_->send_period;
-}
-
-bool SendData::IsEnabled(void) const {
-    return pimpl_->is_enabled;
-}
-
-void SendData::SetEnabled(bool value) {
-    pimpl_->is_enabled=value;
-}
-
-void SendData::SetSendSize(size_t value) {
-    pimpl_->send_size=value;
-
-    if(getUiCom()!=NULL) getUiCom()->UpdateDataToSendSize();
-}
-
-void SendData::SetSendPeriod(uint16_t value) {
-    pimpl_->send_period=value;
-}
+void SendData::SetSendPeriod(uint16_t value) { pimpl_->send_period = value; }
 
 } // end namespace core
Index: trunk/lib/FlairCore/src/SendData.h
===================================================================
--- trunk/lib/FlairCore/src/SendData.h	(revision 14)
+++ trunk/lib/FlairCore/src/SendData.h	(revision 15)
@@ -18,80 +18,78 @@
 class SendData_impl;
 
-namespace flair
-{
-namespace gui
-{
-    class LayoutPosition;
+namespace flair {
+namespace gui {
+class LayoutPosition;
 
-    /*! \class SendData
-    *
-    * \brief Abstract class for sending datas to ground station
-    *
-    */
-    class SendData: public Widget
-    {
-        public:
-            /*!
-            * \brief Constructor
-            *
-            */
-            SendData(const LayoutPosition* position,std::string name,std::string type,uint16_t default_periodms=100,bool default_enabled=false);
+/*! \class SendData
+*
+* \brief Abstract class for sending datas to ground station
+*
+*/
+class SendData : public Widget {
+public:
+  /*!
+  * \brief Constructor
+  *
+  */
+  SendData(const LayoutPosition *position, std::string name, std::string type,
+           uint16_t default_periodms = 100, bool default_enabled = false);
 
-            /*!
-            * \brief Destructor
-            *
-            */
-            virtual ~SendData();
+  /*!
+  * \brief Destructor
+  *
+  */
+  virtual ~SendData();
 
-            /*!
-            * \brief Copy datas to specified buffer
-            *
-            * This method must be reimplemented, in order to send datas to ground station.
-            *
-            * \param buf output buffer
-            */
-            virtual void CopyDatas(char* buf) const =0;
+  /*!
+  * \brief Copy datas to specified buffer
+  *
+  * This method must be reimplemented, in order to send datas to ground station.
+  *
+  * \param buf output buffer
+  */
+  virtual void CopyDatas(char *buf) const = 0;
 
-            size_t SendSize(void) const;
-            uint16_t SendPeriod(void) const; // in ms
-            bool IsEnabled(void) const;
+  size_t SendSize(void) const;
+  uint16_t SendPeriod(void) const; // in ms
+  bool IsEnabled(void) const;
 
-        protected:
+protected:
+  /*!
+  * \brief Notify that SenData's datas have changed
+  *
+  * This method must be called when the datas have changed. \n
+  * Normally, it occurs when a curve is added to a plot for example. \n
+  * This method automatically blocks and unblocks the communication.
+  *
+  */
+  void SetSendSize(size_t value);
 
-            /*!
-            * \brief Notify that SenData's datas have changed
-            *
-            * This method must be called when the datas have changed. \n
-            * Normally, it occurs when a curve is added to a plot for example. \n
-            * This method automatically blocks and unblocks the communication.
-            *
-            */
-            void SetSendSize(size_t value);
+  /*!
+  * \brief Extra Xml event
+  *
+  * This method must be reimplemented to handle extra xml event. \n
+  * It is automatically called when something changed from
+  * ground station, through XmlEvent method. \n
+  */
+  virtual void ExtraXmlEvent(void) = 0;
 
-            /*!
-            * \brief Extra Xml event
-            *
-            * This method must be reimplemented to handle extra xml event. \n
-            * It is automatically called when something changed from
-            * ground station, through XmlEvent method. \n
-            */
-            virtual void ExtraXmlEvent(void)=0;
+private:
+  /*!
+  * \brief XmlEvent from ground station
+  *
+  * Reimplemented from Widget. \n
+  * This method handles period and enabled properties of the SendData. \n
+  * Then it calls ExtraXmlEvent to handle specific xml events of reimplemented
+  *class.
+  *
+  */
+  void XmlEvent(void);
 
-        private:
-            /*!
-            * \brief XmlEvent from ground station
-            *
-            * Reimplemented from Widget. \n
-            * This method handles period and enabled properties of the SendData. \n
-            * Then it calls ExtraXmlEvent to handle specific xml events of reimplemented class.
-            *
-            */
-            void XmlEvent(void);
+  void SetSendPeriod(uint16_t value);
+  void SetEnabled(bool value);
 
-            void SetSendPeriod(uint16_t value);
-            void SetEnabled(bool value);
-
-            class SendData_impl* pimpl_;
-    };
+  class SendData_impl *pimpl_;
+};
 
 } // end namespace core
Index: trunk/lib/FlairCore/src/SendData_impl.cpp
===================================================================
--- trunk/lib/FlairCore/src/SendData_impl.cpp	(revision 14)
+++ trunk/lib/FlairCore/src/SendData_impl.cpp	(revision 15)
@@ -18,9 +18,5 @@
 #include "SendData_impl.h"
 
-SendData_impl::SendData_impl()
-{
-}
+SendData_impl::SendData_impl() {}
 
-SendData_impl::~SendData_impl()
-{
-}
+SendData_impl::~SendData_impl() {}
Index: trunk/lib/FlairCore/src/SerialPort.h
===================================================================
--- trunk/lib/FlairCore/src/SerialPort.h	(revision 14)
+++ trunk/lib/FlairCore/src/SerialPort.h	(revision 15)
@@ -17,76 +17,71 @@
 #include <stdint.h>
 
-namespace flair
-{
-namespace core
-{
-    /*! \class SerialPort
-    *
-    * \brief Base class for serial port
-    */
-    class SerialPort: public Object
-    {
-        public:
-            /*!
-            * \brief Constructor
-            *
-            * Construct a serial port.
-            *
-            * \param parent parent
-            * \param name name
-            */
-            SerialPort(const Object* parent,std::string name): Object(parent,name)
-            {}
+namespace flair {
+namespace core {
+/*! \class SerialPort
+*
+* \brief Base class for serial port
+*/
+class SerialPort : public Object {
+public:
+  /*!
+  * \brief Constructor
+  *
+  * Construct a serial port.
+  *
+  * \param parent parent
+  * \param name name
+  */
+  SerialPort(const Object *parent, std::string name) : Object(parent, name) {}
 
-            /*!
-            * \brief Destructor
-            *
-            */
-            ~SerialPort(){};
+  /*!
+  * \brief Destructor
+  *
+  */
+  ~SerialPort(){};
 
-            /*!
-            * \brief Set baudrate
-            *
-            * \param baudrate baudrate
-            *
-            */
-            virtual void SetBaudrate(int baudrate)=0;
+  /*!
+  * \brief Set baudrate
+  *
+  * \param baudrate baudrate
+  *
+  */
+  virtual void SetBaudrate(int baudrate) = 0;
 
-            /*!
-            * \brief Set RX timeout
-            *
-            * Timeout for waiting datas.
-            *
-            * \param timeout_ns timeout in nano second
-            */
-            virtual void SetRxTimeout(Time timeout_ns)=0;
+  /*!
+  * \brief Set RX timeout
+  *
+  * Timeout for waiting datas.
+  *
+  * \param timeout_ns timeout in nano second
+  */
+  virtual void SetRxTimeout(Time timeout_ns) = 0;
 
-            /*!
-            * \brief Write datas
-            *
-            * \param buf pointer to datas
-            * \param nbyte length of datas
-            *
-            * \return amount of written datas
-            */
-            virtual ssize_t Write(const void *buf,size_t nbyte)=0;
+  /*!
+  * \brief Write datas
+  *
+  * \param buf pointer to datas
+  * \param nbyte length of datas
+  *
+  * \return amount of written datas
+  */
+  virtual ssize_t Write(const void *buf, size_t nbyte) = 0;
 
-            /*!
-            * \brief Read datas
-            *
-            * \param buf pointer to datas
-            * \param nbyte length of datas
-            *
-            * \return amount of read datas
-            */
-            virtual ssize_t Read(void *buf,size_t nbyte)=0;
+  /*!
+  * \brief Read datas
+  *
+  * \param buf pointer to datas
+  * \param nbyte length of datas
+  *
+  * \return amount of read datas
+  */
+  virtual ssize_t Read(void *buf, size_t nbyte) = 0;
 
-            /*!
-            * \brief Flush input datas
-            *
-            */
-            virtual void FlushInput(void)=0;
-
-    };
+  /*!
+  * \brief Flush input datas
+  *
+  */
+  virtual void FlushInput(void) = 0;
+};
 } // end namespace core
 } // end namespace framework
Index: trunk/lib/FlairCore/src/SharedMem.cpp
===================================================================
--- trunk/lib/FlairCore/src/SharedMem.cpp	(revision 14)
+++ trunk/lib/FlairCore/src/SharedMem.cpp	(revision 15)
@@ -21,28 +21,19 @@
 using std::string;
 
-namespace flair
-{
-namespace core
-{
+namespace flair {
+namespace core {
 
-SharedMem::SharedMem(const Object* parent,string name,size_t size): Object(parent,name,"shmem")
-{
-    pimpl_=new SharedMem_impl(this,name,size);
+SharedMem::SharedMem(const Object *parent, string name, size_t size)
+    : Object(parent, name, "shmem") {
+  pimpl_ = new SharedMem_impl(this, name, size);
 }
 
-SharedMem::~SharedMem()
-{
-    delete pimpl_;
+SharedMem::~SharedMem() { delete pimpl_; }
+
+void SharedMem::Write(const char *buf, size_t size) {
+  pimpl_->Write(buf, size);
 }
 
-void SharedMem::Write(const char* buf,size_t size)
-{
-    pimpl_->Write(buf,size);
-}
-
-void SharedMem::Read(char* buf,size_t size) const
-{
-    pimpl_->Read(buf,size);
-}
+void SharedMem::Read(char *buf, size_t size) const { pimpl_->Read(buf, size); }
 
 } // end namespace core
Index: trunk/lib/FlairCore/src/SharedMem.h
===================================================================
--- trunk/lib/FlairCore/src/SharedMem.h	(revision 14)
+++ trunk/lib/FlairCore/src/SharedMem.h	(revision 15)
@@ -19,56 +19,53 @@
 class SharedMem_impl;
 
-namespace flair
-{
-namespace core
-{
+namespace flair {
+namespace core {
 
-    /*! \class SharedMem
-    *
-    * \brief Class defining a shared memory
-    *
-    * Shared memory is identified by its name so it can be accessed
-    * by another processus using its name.
-    */
+/*! \class SharedMem
+*
+* \brief Class defining a shared memory
+*
+* Shared memory is identified by its name so it can be accessed
+* by another processus using its name.
+*/
 
-    class SharedMem: public Object
-    {
-        public:
-            /*!
-            * \brief Constructor
-            *
-            * Construct a shared memory object
-            *
-            * \param parent parent
-            * \param name name
-            * \param size size of the shared memory
-            */
-            SharedMem(const Object* parent,std::string name,size_t size);
+class SharedMem : public Object {
+public:
+  /*!
+  * \brief Constructor
+  *
+  * Construct a shared memory object
+  *
+  * \param parent parent
+  * \param name name
+  * \param size size of the shared memory
+  */
+  SharedMem(const Object *parent, std::string name, size_t size);
 
-            /*!
-            * \brief Destructor
-            *
-            */
-            ~SharedMem();
+  /*!
+  * \brief Destructor
+  *
+  */
+  ~SharedMem();
 
-            /*!
-            * \brief Write
-            *
-            * \param buf input buffer to write to memory
-            * \param size buffer size
-            */
-            void Write(const char* buf,size_t size);
+  /*!
+  * \brief Write
+  *
+  * \param buf input buffer to write to memory
+  * \param size buffer size
+  */
+  void Write(const char *buf, size_t size);
 
-            /*!
-            * \brief Read
-            *
-            * \param buf output buffer to write from memory
-            * \param size buffer size
-            */
-            void Read(char* buf,size_t size) const;
+  /*!
+  * \brief Read
+  *
+  * \param buf output buffer to write from memory
+  * \param size buffer size
+  */
+  void Read(char *buf, size_t size) const;
 
-        private:
-            SharedMem_impl* pimpl_;
-    };
+private:
+  SharedMem_impl *pimpl_;
+};
 
 } // end namespace core
Index: trunk/lib/FlairCore/src/SharedMem_impl.cpp
===================================================================
--- trunk/lib/FlairCore/src/SharedMem_impl.cpp	(revision 14)
+++ trunk/lib/FlairCore/src/SharedMem_impl.cpp	(revision 15)
@@ -26,161 +26,148 @@
 using namespace flair::core;
 
-SharedMem_impl::SharedMem_impl(const SharedMem* self,string name,size_t size)
-{
-    this->size=size;
-    this->self=self;
+SharedMem_impl::SharedMem_impl(const SharedMem *self, string name,
+                               size_t size) {
+  this->size = size;
+  this->self = self;
 
 #ifdef __XENO__
-    heap_binded=false;
-    int status=rt_heap_create(&heap,name.c_str(),size,H_SHARED|H_FIFO|H_NONCACHED);
-    if(status==-EEXIST)
-    {
-        heap_binded=true;
-        status=rt_heap_bind(&heap,name.c_str(),TM_INFINITE);
-    }
-    if(status!=0)
-    {
-        self->Err("rt_heap_create error (%s)\n",strerror(-status));
-        return;
-    }
+  heap_binded = false;
+  int status = rt_heap_create(&heap, name.c_str(), size,
+                              H_SHARED | H_FIFO | H_NONCACHED);
+  if (status == -EEXIST) {
+    heap_binded = true;
+    status = rt_heap_bind(&heap, name.c_str(), TM_INFINITE);
+  }
+  if (status != 0) {
+    self->Err("rt_heap_create error (%s)\n", strerror(-status));
+    return;
+  }
 
-    void *ptr;
-    status=rt_heap_alloc(&heap,0,TM_NONBLOCK ,&ptr);
-    if(status!=0)
-    {
-        self->Err("rt_heap_alloc error (%s)\n",strerror(-status));
-    }
-    mem_segment =(char*)ptr;
+  void *ptr;
+  status = rt_heap_alloc(&heap, 0, TM_NONBLOCK, &ptr);
+  if (status != 0) {
+    self->Err("rt_heap_alloc error (%s)\n", strerror(-status));
+  }
+  mem_segment = (char *)ptr;
 
-    mutex_binded=false;
-    string mutex_name="mutex_"+ name;
-    status=rt_mutex_create(&mutex,mutex_name.c_str());
-    if(status==-EEXIST)
-    {
-        mutex_binded=true;
-        status=rt_mutex_bind(&mutex,mutex_name.c_str(),TM_INFINITE);
-    }
-    if(status!=0)
-    {
-        self->Err("rt_mutex_create error (%s)\n",strerror(-status));
-        return;
-    }
+  mutex_binded = false;
+  string mutex_name = "mutex_" + name;
+  status = rt_mutex_create(&mutex, mutex_name.c_str());
+  if (status == -EEXIST) {
+    mutex_binded = true;
+    status = rt_mutex_bind(&mutex, mutex_name.c_str(), TM_INFINITE);
+  }
+  if (status != 0) {
+    self->Err("rt_mutex_create error (%s)\n", strerror(-status));
+    return;
+  }
 
 #else
-    shm_name="/" + name;
-    fd = shm_open(shm_name.c_str(), O_RDWR | O_CREAT, 0666);
-    if (fd == -1)
-    {
-        self->Err("Error creating shared memory\n");
-    }
-    ftruncate(fd, size);
+  shm_name = "/" + name;
+  fd = shm_open(shm_name.c_str(), O_RDWR | O_CREAT, 0666);
+  if (fd == -1) {
+    self->Err("Error creating shared memory\n");
+  }
+  ftruncate(fd, size);
 
-    sem_name="/"  +name;
-    sem = sem_open(sem_name.c_str(), O_CREAT, 0666, 1);
-    if (sem == SEM_FAILED)
-    {
-        self->Err("Error creating semaphore\n");
-    }
+  sem_name = "/" + name;
+  sem = sem_open(sem_name.c_str(), O_CREAT, 0666, 1);
+  if (sem == SEM_FAILED) {
+    self->Err("Error creating semaphore\n");
+  }
 
-    mem_segment =(char*)mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
-    if (mem_segment == MAP_FAILED)
-    {
-        self->Err("Failed to map memory\n");
-    }
+  mem_segment =
+      (char *)mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
+  if (mem_segment == MAP_FAILED) {
+    self->Err("Failed to map memory\n");
+  }
 #endif
 }
 
-SharedMem_impl::~SharedMem_impl()
-{
-    int status;
+SharedMem_impl::~SharedMem_impl() {
+  int status;
 #ifdef __XENO__
-    /* unnecessary because heap is opened in H_SINGLE mode
-    status=rt_heap_free(&heap,mem_segment);
-    if(status!=0)
-    {
-        self->Err("rt_heap_free error (%s)\n",strerror(-status));
+  /* unnecessary because heap is opened in H_SINGLE mode
+  status=rt_heap_free(&heap,mem_segment);
+  if(status!=0)
+  {
+      self->Err("rt_heap_free error (%s)\n",strerror(-status));
+  }
+  */
+
+  if (heap_binded == false) {
+    status = rt_heap_delete(&heap);
+    if (status != 0) {
+      self->Err("rt_heap_delete error (%s)\n", strerror(-status));
     }
-    */
+  }
 
-    if(heap_binded==false)
-    {
-        status=rt_heap_delete(&heap);
-        if(status!=0)
-        {
-            self->Err("rt_heap_delete error (%s)\n",strerror(-status));
-        }
+  if (mutex_binded == false) {
+    status = rt_mutex_delete(&mutex);
+    if (status != 0) {
+      self->Err("error destroying mutex (%s)\n", strerror(-status));
     }
+  }
+#else
+  status = munmap(mem_segment, size);
+  if (status != 0) {
+    self->Err("Failed to unmap memory (%s)\n", strerror(-status));
+  }
 
-    if(mutex_binded==false)
-    {
-        status=rt_mutex_delete(&mutex);
-        if(status!=0)
-        {
-            self->Err("error destroying mutex (%s)\n",strerror(-status));
-        }
-    }
-#else
-    status = munmap(mem_segment, size);
-    if(status!=0)
-    {
-        self->Err("Failed to unmap memory (%s)\n",strerror(-status));
-    }
+  status = close(fd);
+  if (status != 0) {
+    self->Err("Failed to close file (%s)\n", strerror(-status));
+  }
 
-    status = close(fd);
-    if(status!=0)
-    {
-        self->Err("Failed to close file (%s)\n",strerror(-status));
-    }
+  // do not check erros as it can be done by another process
+  status = shm_unlink(shm_name.c_str()); /*
+   if(status!=0)
+   {
+       self->Err("Failed to unlink memory (%s)\n",strerror(-status));
+   }
+*/
+  // do not check erros as it can be done by another process
+  status = sem_unlink(sem_name.c_str()); /*
+   if(status!=0)
+   {
+       self->Err("Failed to unlink semaphore (%s)\n",strerror(-status));
+   }*/
 
-    //do not check erros as it can be done by another process
-    status = shm_unlink(shm_name.c_str());/*
-    if(status!=0)
-    {
-        self->Err("Failed to unlink memory (%s)\n",strerror(-status));
-    }
-*/
-    //do not check erros as it can be done by another process
-    status = sem_unlink(sem_name.c_str());/*
-    if(status!=0)
-    {
-        self->Err("Failed to unlink semaphore (%s)\n",strerror(-status));
-    }*/
-
-    status = sem_close(sem);
-    if(status!=0)
-    {
-        self->Err("Failed to close semaphore (%s)\n",strerror(-status));
-    }
+  status = sem_close(sem);
+  if (status != 0) {
+    self->Err("Failed to close semaphore (%s)\n", strerror(-status));
+  }
 #endif
 }
 
-
-void SharedMem_impl::Write(const char* buf,size_t size)
-{
+void SharedMem_impl::Write(const char *buf, size_t size) {
 #ifdef __XENO__
-    int status=rt_mutex_acquire(&mutex,TM_INFINITE);
-    if(status!=0) self->Err("error (%s)\n",strerror(-status));
-    memcpy(mem_segment,buf,size);
-    status=rt_mutex_release(&mutex);
-    if(status!=0) self->Err("error (%s)\n",strerror(-status));
+  int status = rt_mutex_acquire(&mutex, TM_INFINITE);
+  if (status != 0)
+    self->Err("error (%s)\n", strerror(-status));
+  memcpy(mem_segment, buf, size);
+  status = rt_mutex_release(&mutex);
+  if (status != 0)
+    self->Err("error (%s)\n", strerror(-status));
 #else
-    sem_wait(sem);
-    memcpy(mem_segment,buf,size);
-    sem_post(sem);
+  sem_wait(sem);
+  memcpy(mem_segment, buf, size);
+  sem_post(sem);
 #endif
 }
 
-void SharedMem_impl::Read(char* buf,size_t size)
-{
+void SharedMem_impl::Read(char *buf, size_t size) {
 #ifdef __XENO__
-    int status=rt_mutex_acquire(&mutex,TM_INFINITE);
-    if(status!=0) self->Err("error (%s)\n",strerror(-status));
-    memcpy(buf,mem_segment,size);
-    status=rt_mutex_release(&mutex);
-    if(status!=0) self->Err("error (%s)\n",strerror(-status));
+  int status = rt_mutex_acquire(&mutex, TM_INFINITE);
+  if (status != 0)
+    self->Err("error (%s)\n", strerror(-status));
+  memcpy(buf, mem_segment, size);
+  status = rt_mutex_release(&mutex);
+  if (status != 0)
+    self->Err("error (%s)\n", strerror(-status));
 #else
-    sem_wait(sem);
-    memcpy(buf,mem_segment,size);
-    sem_post(sem);
+  sem_wait(sem);
+  memcpy(buf, mem_segment, size);
+  sem_post(sem);
 #endif
 }
Index: trunk/lib/FlairCore/src/Socket.cpp
===================================================================
--- trunk/lib/FlairCore/src/Socket.cpp	(revision 14)
+++ trunk/lib/FlairCore/src/Socket.cpp	(revision 15)
@@ -23,59 +23,67 @@
 using std::string;
 
-namespace flair
-{
-namespace core
-{
+namespace flair {
+namespace core {
 
-Socket::Socket(const Object* parent, string name,uint16_t port): Object(parent,name) {
-    pimpl_=new Socket_impl(this,name,port);
+Socket::Socket(const Object *parent, string name, uint16_t port)
+    : Object(parent, name) {
+  pimpl_ = new Socket_impl(this, name, port);
 }
 
-Socket::Socket(const Object* parent, string name,string address,bool broadcast): Object(parent,name) {
-    pimpl_=new Socket_impl(this,name,address,broadcast);
+Socket::Socket(const Object *parent, string name, string address,
+               bool broadcast)
+    : Object(parent, name) {
+  pimpl_ = new Socket_impl(this, name, address, broadcast);
 }
 
-Socket::~Socket() {
-    delete pimpl_;
+Socket::~Socket() { delete pimpl_; }
+
+void Socket::SendMessage(const char *message, size_t message_len) {
+  pimpl_->SendMessage(message, message_len);
 }
 
-void Socket::SendMessage(const char* message,size_t message_len) {
-    pimpl_->SendMessage(message,message_len);
+void Socket::SendMessage(string message) { pimpl_->SendMessage(message); }
+
+ssize_t Socket::RecvMessage(char *buf, size_t buf_len, Time timeout, char *src,
+                            size_t *src_len) {
+  return pimpl_->RecvMessage(buf, buf_len, timeout, src, src_len);
 }
 
-void Socket::SendMessage(string message) {
-    pimpl_->SendMessage(message);
+void Socket::NetworkToHost(char *data, size_t dataSize) {
+  if (core::IsBigEndian())
+    return;
+  if (dataSize == 1)
+    return;
+  if ((dataSize == 2) || (dataSize == 4) || (dataSize == 8) ||
+      (dataSize == 16)) {
+    char dataInHostEndianness[dataSize];
+    for (unsigned int i = 0; i < dataSize; i++) {
+      dataInHostEndianness[i] = data[dataSize - i - 1];
+    }
+    memcpy(data, dataInHostEndianness, dataSize);
+    return;
+  }
+  throw std::runtime_error(
+      string("Unsupported data size (") + std::to_string(dataSize) +
+      string(") in host to network endianness conversion"));
 }
 
-ssize_t Socket::RecvMessage(char* buf,size_t buf_len,Time timeout,char* src,size_t* src_len) {
-    return pimpl_->RecvMessage(buf,buf_len,timeout,src,src_len);
-}
-
-void Socket::NetworkToHost(char *data,size_t dataSize) {
-    if (core::IsBigEndian()) return;
-    if (dataSize==1) return;
-    if ((dataSize==2)||(dataSize==4)||(dataSize==8)||(dataSize==16)) {
-        char dataInHostEndianness[dataSize];
-        for (unsigned int i=0;i<dataSize;i++) {
-            dataInHostEndianness[i]=data[dataSize-i-1];
-        }
-        memcpy(data,dataInHostEndianness,dataSize);
-        return;
+void Socket::HostToNetwork(char *data, size_t dataSize) {
+  if (IsBigEndian())
+    return;
+  if (dataSize == 1)
+    return;
+  if ((dataSize == 2) || (dataSize == 4) || (dataSize == 8) ||
+      (dataSize == 16)) {
+    char dataInNetworkEndianness[dataSize];
+    for (unsigned int i = 0; i < dataSize; i++) {
+      dataInNetworkEndianness[i] = data[dataSize - i - 1];
     }
-    throw std::runtime_error(string("Unsupported data size (")+std::to_string(dataSize)+string(") in host to network endianness conversion"));
-}
-
-void Socket::HostToNetwork(char *data,size_t dataSize) {
-    if (IsBigEndian()) return;
-    if (dataSize==1) return;
-    if ((dataSize==2)||(dataSize==4)||(dataSize==8)||(dataSize==16)) {
-        char dataInNetworkEndianness[dataSize];
-        for (unsigned int i=0;i<dataSize;i++) {
-            dataInNetworkEndianness[i]=data[dataSize-i-1];
-        }
-        memcpy(data,dataInNetworkEndianness,dataSize);
-        return;
-    }
-    throw std::runtime_error(string("Unsupported data size (")+std::to_string(dataSize)+string(") in host to network endianness conversion"));
+    memcpy(data, dataInNetworkEndianness, dataSize);
+    return;
+  }
+  throw std::runtime_error(
+      string("Unsupported data size (") + std::to_string(dataSize) +
+      string(") in host to network endianness conversion"));
 }
 
Index: trunk/lib/FlairCore/src/Socket.h
===================================================================
--- trunk/lib/FlairCore/src/Socket.h	(revision 14)
+++ trunk/lib/FlairCore/src/Socket.h	(revision 15)
@@ -20,87 +20,89 @@
 class Socket_impl;
 
-namespace flair
-{
-namespace core
-{
+namespace flair {
+namespace core {
 
-    /*! \class Socket
-    *
-    * \brief Class encapsulating a UDP socket. It assumes packets are coming from only one distant host on a given port.
-    *
-    */
-    class Socket: public Object {
-    public:
-        /*!
-        * \brief Constructor
-        *
-        * Construct the client side of the socket
-        *
-        * \param parent parent
-        * \param name name
-        * \param address server address (ex 192.168.1.1:9000)
-        * \param broadcast true if address is a broadcast address
-        */
-        Socket(const Object* parent, std::string name,std::string address,bool broadcast=false);
+/*! \class Socket
+*
+* \brief Class encapsulating a UDP socket. It assumes packets are coming from
+*only one distant host on a given port.
+*
+*/
+class Socket : public Object {
+public:
+  /*!
+  * \brief Constructor
+  *
+  * Construct the client side of the socket
+  *
+  * \param parent parent
+  * \param name name
+  * \param address server address (ex 192.168.1.1:9000)
+  * \param broadcast true if address is a broadcast address
+  */
+  Socket(const Object *parent, std::string name, std::string address,
+         bool broadcast = false);
 
-        /*!
-        * \brief Constructor
-        *
-        * Construct the server side of the socket
-        *
-        * \param parent parent
-        * \param name name
-        * \param port listening port
-        */
-        Socket(const Object* parent, std::string name,uint16_t port);
+  /*!
+  * \brief Constructor
+  *
+  * Construct the server side of the socket
+  *
+  * \param parent parent
+  * \param name name
+  * \param port listening port
+  */
+  Socket(const Object *parent, std::string name, uint16_t port);
 
-        /*!
-        * \brief Destructor
-        *
-        */
-        ~Socket();
+  /*!
+  * \brief Destructor
+  *
+  */
+  ~Socket();
 
-        /*!
-        * \brief Send a message
-        *
-        * In case of a broadcast Socket, Parent()->ObjectName() is used as source of the message, this name should be unique.
-        *
-        * \param message message
-        */
-        void SendMessage(std::string message);
+  /*!
+  * \brief Send a message
+  *
+  * In case of a broadcast Socket, Parent()->ObjectName() is used as source of
+  *the message, this name should be unique.
+  *
+  * \param message message
+  */
+  void SendMessage(std::string message);
 
-        /*!
-        * \brief Send a message
-        *
-        * \param message message
-        * \param message_len message length
-        */
-        void SendMessage(const char* message,size_t message_len);
+  /*!
+  * \brief Send a message
+  *
+  * \param message message
+  * \param message_len message length
+  */
+  void SendMessage(const char *message, size_t message_len);
 
-        /*!
-        * \brief Receive a message
-        *
-        * Receive a message and wait up to timeout. \n
-        * If src and src_len are specified, the source of the message will be
-        * copied in the src buffer. \n
-        * Note that in case of a broadcast socket, own messages are filtered and
-        * are not received.
-        *
-        * \param buf buffer to put the message
-        * \param buf_len buffer length
-        * \param timeout timeout
-        * \param src buffer to put source name
-        * \param src_len buffer length
-        *
-        * \return size of the received message
-        */
-        ssize_t RecvMessage(char* buf,size_t buf_len,Time timeout,char* src=NULL,size_t* src_len=NULL);
+  /*!
+  * \brief Receive a message
+  *
+  * Receive a message and wait up to timeout. \n
+  * If src and src_len are specified, the source of the message will be
+  * copied in the src buffer. \n
+  * Note that in case of a broadcast socket, own messages are filtered and
+  * are not received.
+  *
+  * \param buf buffer to put the message
+  * \param buf_len buffer length
+  * \param timeout timeout
+  * \param src buffer to put source name
+  * \param src_len buffer length
+  *
+  * \return size of the received message
+  */
+  ssize_t RecvMessage(char *buf, size_t buf_len, Time timeout, char *src = NULL,
+                      size_t *src_len = NULL);
 
-        void NetworkToHost(char *data,size_t dataSize);
-        void HostToNetwork(char *data,size_t dataSize);
+  void NetworkToHost(char *data, size_t dataSize);
+  void HostToNetwork(char *data, size_t dataSize);
 
-    private:
-       class Socket_impl* pimpl_;
-    };
+private:
+  class Socket_impl *pimpl_;
+};
 
 } // end namespace core
Index: trunk/lib/FlairCore/src/Socket_impl.cpp
===================================================================
--- trunk/lib/FlairCore/src/Socket_impl.cpp	(revision 14)
+++ trunk/lib/FlairCore/src/Socket_impl.cpp	(revision 15)
@@ -29,372 +29,339 @@
 using namespace flair::core;
 
-Socket_impl::Socket_impl(const Socket* self,string name,uint16_t port)
-{
-    this->self=self;
-    this->port=port;
-    this->address="";
-    this->broadcast=false;
-    Init();
-}
-
-Socket_impl::Socket_impl(const Socket* self,string name,string address,bool broadcast)
-{
-    this->self=self;
-    int pos = address.find(":");
-    this->address=address.substr (0,pos);
-    port=atoi(address.substr(pos+1).c_str());
-    this->broadcast=broadcast;
-
-    if(pos==0 || address=="")
-    {
-        self->Err("address %s is not correct\n",address.c_str());
-    }
-    Init();
-
-}
-
-void Socket_impl::Init(void)
-{
-	int yes=1;
-
-    fd = socket(AF_INET, SOCK_DGRAM, 0); //UDP
-
-    if(broadcast==true)
-    {
-        if(setsockopt(fd, SOL_SOCKET, SO_BROADCAST, &yes, sizeof(int) )!=0)
-            self->Err("Setsockopt error\n");
-    }
-
-    if(setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(int) )!=0)
-        self->Err("Setsockopt error\n");
-
-    if(address=="" || broadcast==true)
-    {
-        sockaddr_in sin = { 0 };
-
-        if(broadcast==true)
-        {
-            struct hostent *hostinfo;
-
-            hostinfo = gethostbyname(this->address.c_str());
-            if (hostinfo == NULL)
-            {
-                self->Err("hostinfo error\n");
-            }
-            sin.sin_addr = *(in_addr *) hostinfo->h_addr;
-        }
-        else
-        {
-            sin.sin_addr.s_addr=INADDR_ANY;
-        }
-
-        sin.sin_port = htons(port);
-        sin.sin_family = AF_INET;
-        if(bind(fd,(sockaddr *) &sin, sizeof sin) == -1)
-        {
-            self->Err("bind error\n");
-        }
-    }
-
-
-#ifdef __XENO__
-    string tmp_name;
-    int status;
-    is_running=true;
-
-    //pipe
-    tmp_name= getFrameworkManager()->ObjectName() + "-" + self->ObjectName()+ "-pipe";
-    //xenomai limitation
-    if(tmp_name.size()>31) self->Err("rt_pipe_create error (%s is too long)\n",tmp_name.c_str());
+Socket_impl::Socket_impl(const Socket *self, string name, uint16_t port) {
+  this->self = self;
+  this->port = port;
+  this->address = "";
+  this->broadcast = false;
+  Init();
+}
+
+Socket_impl::Socket_impl(const Socket *self, string name, string address,
+                         bool broadcast) {
+  this->self = self;
+  int pos = address.find(":");
+  this->address = address.substr(0, pos);
+  port = atoi(address.substr(pos + 1).c_str());
+  this->broadcast = broadcast;
+
+  if (pos == 0 || address == "") {
+    self->Err("address %s is not correct\n", address.c_str());
+  }
+  Init();
+}
+
+void Socket_impl::Init(void) {
+  int yes = 1;
+
+  fd = socket(AF_INET, SOCK_DGRAM, 0); // UDP
+
+  if (broadcast == true) {
+    if (setsockopt(fd, SOL_SOCKET, SO_BROADCAST, &yes, sizeof(int)) != 0)
+      self->Err("Setsockopt error\n");
+  }
+
+  if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(int)) != 0)
+    self->Err("Setsockopt error\n");
+
+  if (address == "" || broadcast == true) {
+    sockaddr_in sin = {0};
+
+    if (broadcast == true) {
+      struct hostent *hostinfo;
+
+      hostinfo = gethostbyname(this->address.c_str());
+      if (hostinfo == NULL) {
+        self->Err("hostinfo error\n");
+      }
+      sin.sin_addr = *(in_addr *)hostinfo->h_addr;
+    } else {
+      sin.sin_addr.s_addr = INADDR_ANY;
+    }
+
+    sin.sin_port = htons(port);
+    sin.sin_family = AF_INET;
+    if (bind(fd, (sockaddr *)&sin, sizeof sin) == -1) {
+      self->Err("bind error\n");
+    }
+  }
+
+#ifdef __XENO__
+  string tmp_name;
+  int status;
+  is_running = true;
+
+  // pipe
+  tmp_name =
+      getFrameworkManager()->ObjectName() + "-" + self->ObjectName() + "-pipe";
+  // xenomai limitation
+  if (tmp_name.size() > 31)
+    self->Err("rt_pipe_create error (%s is too long)\n", tmp_name.c_str());
 #ifdef RT_PIPE_SIZE
-    status=rt_pipe_create(&pipe, tmp_name.c_str(), P_MINOR_AUTO,RT_PIPE_SIZE);
+  status = rt_pipe_create(&pipe, tmp_name.c_str(), P_MINOR_AUTO, RT_PIPE_SIZE);
 #else
-    status=rt_pipe_create(&pipe, tmp_name.c_str(), P_MINOR_AUTO,0);
-#endif
-    if(status!=0)
-    {
-        self->Err("rt_pipe_create error (%s)\n",strerror(-status));
-    }
-
-    //start user side thread
+  status = rt_pipe_create(&pipe, tmp_name.c_str(), P_MINOR_AUTO, 0);
+#endif
+  if (status != 0) {
+    self->Err("rt_pipe_create error (%s)\n", strerror(-status));
+  }
+
+// start user side thread
 #ifdef NRT_STACK_SIZE
-    // Initialize thread creation attributes
-    pthread_attr_t attr;
-    if(pthread_attr_init(&attr) != 0)
-    {
-        self->Err("pthread_attr_init error\n");
-    }
-    if(pthread_attr_setstacksize(&attr, NRT_STACK_SIZE) != 0)
-    {
-        self->Err("pthread_attr_setstacksize error\n");
-    }
-    if(pthread_create(&user_thread,  &attr, user, (void*)this) < 0)
-    {
-        self->Err("pthread_create error\n");
-    }
-    if(pthread_attr_destroy(&attr) != 0)
-    {
-        self->Err("pthread_attr_destroy error\n");
-    }
-#else //NRT_STACK_SIZE
-    if(pthread_create(&user_thread, NULL, user, (void*)this) < 0)
-    {
-        self->Err("pthread_create error\n");
-    }
-#endif //NRT_STACK_SIZE
+  // Initialize thread creation attributes
+  pthread_attr_t attr;
+  if (pthread_attr_init(&attr) != 0) {
+    self->Err("pthread_attr_init error\n");
+  }
+  if (pthread_attr_setstacksize(&attr, NRT_STACK_SIZE) != 0) {
+    self->Err("pthread_attr_setstacksize error\n");
+  }
+  if (pthread_create(&user_thread, &attr, user, (void *)this) < 0) {
+    self->Err("pthread_create error\n");
+  }
+  if (pthread_attr_destroy(&attr) != 0) {
+    self->Err("pthread_attr_destroy error\n");
+  }
+#else  // NRT_STACK_SIZE
+  if (pthread_create(&user_thread, NULL, user, (void *)this) < 0) {
+    self->Err("pthread_create error\n");
+  }
+#endif // NRT_STACK_SIZE
 #endif //__XENO__
 
-    if(address!="")
-    {
-        struct hostent *hostinfo;
-        hostinfo = gethostbyname(address.c_str());
-        if (hostinfo == NULL)
-        {
-            self->Err("gethostbyname\n");
-        }
-
-        sock_in.sin_addr=*(in_addr *) hostinfo->h_addr;
-        sock_in.sin_port = htons(port);
-        sock_in.sin_family = AF_INET;
-    }
-}
-
-Socket_impl::~Socket_impl()
-{
-#ifdef __XENO__
-    is_running=false;
-
-    pthread_join(user_thread,NULL);
-    int status=rt_pipe_delete(&pipe);
-    if(status!=0) self->Err("rt_pipe_delete error (%s)\n",strerror(-status));
-
-#endif
-    close(fd);
-}
-
-void Socket_impl::SendMessage(const char* src,size_t src_len)
-{
-    ssize_t written;
-    string to_send;
-
-    if(broadcast==true)
-    {
-        to_send=getFrameworkManager()->ObjectName()+ ":" + string(src, src_len);
-        src_len=to_send.size();
-        src=(char*)to_send.c_str();
-    }
-
-#ifdef __XENO__
-//Printf("send pipe %s\n",src);
-    written=rt_pipe_write(&pipe,src,src_len,P_NORMAL);
-
-    if(written<0)
-    {
-        self->Err("rt_pipe_write error (%s)\n",strerror(-written));
-    }
-    else if (written != (ssize_t)src_len)
-    {
-        self->Err("rt_pipe_write error %i/%i\n",written,to_send.size());
-    }
+  if (address != "") {
+    struct hostent *hostinfo;
+    hostinfo = gethostbyname(address.c_str());
+    if (hostinfo == NULL) {
+      self->Err("gethostbyname\n");
+    }
+
+    sock_in.sin_addr = *(in_addr *)hostinfo->h_addr;
+    sock_in.sin_port = htons(port);
+    sock_in.sin_family = AF_INET;
+  }
+}
+
+Socket_impl::~Socket_impl() {
+#ifdef __XENO__
+  is_running = false;
+
+  pthread_join(user_thread, NULL);
+  int status = rt_pipe_delete(&pipe);
+  if (status != 0)
+    self->Err("rt_pipe_delete error (%s)\n", strerror(-status));
+
+#endif
+  close(fd);
+}
+
+void Socket_impl::SendMessage(const char *src, size_t src_len) {
+  ssize_t written;
+  string to_send;
+
+  if (broadcast == true) {
+    to_send = getFrameworkManager()->ObjectName() + ":" + string(src, src_len);
+    src_len = to_send.size();
+    src = (char *)to_send.c_str();
+  }
+
+#ifdef __XENO__
+  // Printf("send pipe %s\n",src);
+  written = rt_pipe_write(&pipe, src, src_len, P_NORMAL);
+
+  if (written < 0) {
+    self->Err("rt_pipe_write error (%s)\n", strerror(-written));
+  } else if (written != (ssize_t)src_len) {
+    self->Err("rt_pipe_write error %i/%i\n", written, to_send.size());
+  }
 #else
-    written=sendto(fd,src,src_len, 0, (struct sockaddr *) &sock_in, sizeof(sock_in));
-
-    if(written!=(ssize_t)src_len)
-    {
-        self->Err("sendto error\n");
-    }
-#endif
-}
-
-void Socket_impl::SendMessage(string message)
-{
-    ssize_t written;
-
-    if(broadcast==true) message=self->Parent()->ObjectName()+ ":" + message;
-    //Printf("SendMessage %s\n",message.c_str());
-#ifdef __XENO__
-    written=rt_pipe_write(&pipe,message.c_str(),message.size(),P_NORMAL);
-
-    if(written<0)
-    {
-        self->Err("rt_pipe_write error (%s)\n",strerror(-written));
-    }
-    else if (written != (ssize_t)message.size())
-    {
-        self->Err("rt_pipe_write error %i/%i\n",written,message.size());
-    }
+  written =
+      sendto(fd, src, src_len, 0, (struct sockaddr *)&sock_in, sizeof(sock_in));
+
+  if (written != (ssize_t)src_len) {
+    self->Err("sendto error\n");
+  }
+#endif
+}
+
+void Socket_impl::SendMessage(string message) {
+  ssize_t written;
+
+  if (broadcast == true)
+    message = self->Parent()->ObjectName() + ":" + message;
+// Printf("SendMessage %s\n",message.c_str());
+#ifdef __XENO__
+  written = rt_pipe_write(&pipe, message.c_str(), message.size(), P_NORMAL);
+
+  if (written < 0) {
+    self->Err("rt_pipe_write error (%s)\n", strerror(-written));
+  } else if (written != (ssize_t)message.size()) {
+    self->Err("rt_pipe_write error %i/%i\n", written, message.size());
+  }
 #else
-    written=sendto(fd,message.c_str(),message.size(), 0, (struct sockaddr *) &sock_in, sizeof(sock_in));
-    if(written!=(ssize_t)message.size())
-    {
-        self->Err("sendto error\n");
-    }
-
-#endif
-}
-
-ssize_t Socket_impl::RecvMessage(char* msg,size_t msg_len,Time timeout,char* src,size_t* src_len)
-{
-    ssize_t nb_read;
-    char buffer[128];
-#ifdef __XENO__
-    nb_read=rt_pipe_read(&pipe,&buffer,sizeof(buffer),timeout);
+  written = sendto(fd, message.c_str(), message.size(), 0,
+                   (struct sockaddr *)&sock_in, sizeof(sock_in));
+  if (written != (ssize_t)message.size()) {
+    self->Err("sendto error\n");
+  }
+
+#endif
+}
+
+ssize_t Socket_impl::RecvMessage(char *msg, size_t msg_len, Time timeout,
+                                 char *src, size_t *src_len) {
+  ssize_t nb_read;
+  char buffer[128];
+#ifdef __XENO__
+  nb_read = rt_pipe_read(&pipe, &buffer, sizeof(buffer), timeout);
 #else
-    socklen_t sinsize = sizeof(sock_in);
-    struct timeval tv;
-
-    if(timeout!=TIME_NONBLOCK) {
-        int attr=fcntl(fd, F_GETFL,0);
-        fcntl(fd, F_SETFL, attr & (~O_NONBLOCK));
-
-        tv.tv_sec = timeout/1000000000;
-        timeout=timeout-(timeout/1000000000)*1000000000;
-        tv.tv_usec = timeout/1000;
-        if (setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO,&tv,sizeof(tv)) < 0) {
-            self->Err("setsockopt SO_RCVTIMEO failed\n");
-        }
+  socklen_t sinsize = sizeof(sock_in);
+  struct timeval tv;
+
+  if (timeout != TIME_NONBLOCK) {
+    int attr = fcntl(fd, F_GETFL, 0);
+    fcntl(fd, F_SETFL, attr & (~O_NONBLOCK));
+
+    tv.tv_sec = timeout / 1000000000;
+    timeout = timeout - (timeout / 1000000000) * 1000000000;
+    tv.tv_usec = timeout / 1000;
+    if (setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv)) < 0) {
+      self->Err("setsockopt SO_RCVTIMEO failed\n");
+    }
+  } else {
+    fcntl(fd, F_SETFL, O_NONBLOCK);
+  }
+
+  if (broadcast == false) {
+    nb_read =
+        recvfrom(fd, buffer, sizeof(buffer), 0, (sockaddr *)&sock_in, &sinsize);
+  } else {
+    nb_read = recvfrom(fd, buffer, sizeof(buffer), 0, NULL, NULL);
+  }
+#endif
+  if (nb_read <= 0) {
+    return nb_read;
+  } else {
+    // printf("%s\n",buffer);
+    if (broadcast == true) {
+      int index = -1;
+      for (int i = 0; i < nb_read; i++) {
+        if (buffer[i] == ':') {
+          index = i;
+          break;
+        }
+      }
+      if (index < 0) {
+        self->Warn("Malformed message\n");
+        return -1;
+      } else if (src_len != NULL && src != NULL) {
+        if (index + 1 > (int)(*src_len) &&
+            src != NULL) { //+1 pour inserer un 0)
+          self->Warn("insufficent src size\n");
+          return -1;
+        }
+      } else if (nb_read - index - 1 + 1 >
+                 (int)msg_len) { //+1 pour inserer un 0
+        self->Warn("insufficent msg size (%i/%i)\n", nb_read - index - 1 + 1,
+                   msg_len);
+        return -1;
+      }
+      if (src != NULL) {
+        memcpy(src, buffer, index);
+        src[index] = 0;
+      }
+      memcpy(msg, &buffer[index + 1], nb_read - index - 1);
+      msg[nb_read - index - 1] = 0;
+      return nb_read - index;
     } else {
-        fcntl(fd, F_SETFL, O_NONBLOCK);
-    }
-
-    if(broadcast==false) {
-        nb_read = recvfrom(fd, buffer, sizeof(buffer), 0, (sockaddr *) &sock_in, &sinsize);
+      if (nb_read > (int)msg_len) {
+        self->Warn("insufficent msg size (%i/%i)\n", nb_read, msg_len);
+        return -1;
+      }
+      memcpy(msg, buffer, nb_read);
+      return nb_read;
+    }
+  }
+}
+
+#ifdef __XENO__
+void *Socket_impl::user(void *arg) {
+  Socket_impl *caller = (Socket_impl *)arg;
+  int pipe_fd = -1;
+  string devname;
+
+  devname = NRT_PIPE_PATH + getFrameworkManager()->ObjectName() + "-" +
+            caller->self->ObjectName() + "-pipe";
+  while (pipe_fd < 0) {
+    pipe_fd = open(devname.c_str(), O_RDWR);
+    if (pipe_fd < 0 && errno != ENOENT)
+      caller->self->Err("open pipe_fd error (%s)\n", strerror(-errno));
+    usleep(1000);
+  }
+
+  while (caller->is_running == true) {
+    fd_set set;
+    struct timeval timeout;
+    int rv;
+
+    FD_ZERO(&set);            // clear the set
+    FD_SET(caller->fd, &set); // add our file descriptor to the set
+    FD_SET(pipe_fd, &set);    // add our file descriptor to the set
+
+    timeout.tv_sec = 0;
+    timeout.tv_usec = SELECT_TIMEOUT_MS * 1000;
+    rv = select(FD_SETSIZE, &set, NULL, NULL, &timeout);
+
+    if (rv == -1) {
+      caller->self->Err("select error\n"); // an error occured
+    } else if (rv == 0) {
+      // printf("timeout\n");
     } else {
-        nb_read = recvfrom(fd, buffer, sizeof(buffer), 0, NULL,NULL);
-    }
-#endif
-    if(nb_read<=0) {
-        return nb_read;
-    } else {
-        //printf("%s\n",buffer);
-        if(broadcast==true) {
-            int index=-1;
-            for(int i=0;i<nb_read;i++) {
-                if(buffer[i]==':') {
-                    index=i;
-                    break;
-                }
-            }
-            if(index<0) {
-                self->Warn("Malformed message\n");
-                return -1;
-            } else if(src_len!=NULL && src!=NULL) {
-                if(index+1>(int)(*src_len) && src!=NULL) { //+1 pour inserer un 0)
-                    self->Warn("insufficent src size\n");
-                    return -1;
-                }
-            } else if(nb_read-index-1+1>(int)msg_len) { //+1 pour inserer un 0
-                self->Warn("insufficent msg size (%i/%i)\n",nb_read-index-1+1,msg_len);
-                return -1;
-            }
-            if(src!=NULL) {
-                memcpy(src,buffer,index);
-                src[index]=0;
-            }
-            memcpy(msg,&buffer[index+1],nb_read-index-1);
-            msg[nb_read-index-1]=0;
-            return nb_read-index;
+      ssize_t nb_read, nb_write;
+      char buffer[1024];
+
+      if (FD_ISSET(caller->fd, &set)) {
+        socklen_t sinsize = sizeof(caller->sock_in);
+        if (caller->broadcast == false) {
+          nb_read = recvfrom(caller->fd, buffer, sizeof(buffer), 0,
+                             (sockaddr *)&(caller->sock_in), &sinsize);
         } else {
-            if(nb_read>(int)msg_len) {
-                self->Warn("insufficent msg size (%i/%i)\n",nb_read,msg_len);
-                return -1;
-            }
-            memcpy(msg,buffer,nb_read);
-            return nb_read;
-        }
-    }
-}
-
-#ifdef __XENO__
-void* Socket_impl::user(void * arg)
-{
-    Socket_impl *caller = (Socket_impl*)arg;
-    int pipe_fd=-1;
-    string devname;
-
-    devname= NRT_PIPE_PATH + getFrameworkManager()->ObjectName() + "-" + caller->self->ObjectName()+ "-pipe";
-    while(pipe_fd<0)
-    {
-        pipe_fd = open(devname.c_str(), O_RDWR);
-        if (pipe_fd < 0 && errno!=ENOENT) caller->self->Err("open pipe_fd error (%s)\n",strerror(-errno));
-        usleep(1000);
-    }
-
-    while(caller->is_running==true)
-    {
-        fd_set set;
-        struct timeval timeout;
-        int rv;
-
-        FD_ZERO(&set); // clear the set
-        FD_SET(caller->fd, &set); // add our file descriptor to the set
-        FD_SET(pipe_fd, &set); // add our file descriptor to the set
-
-        timeout.tv_sec = 0;
-        timeout.tv_usec = SELECT_TIMEOUT_MS*1000;
-        rv = select(FD_SETSIZE, &set, NULL, NULL, &timeout);
-
-        if(rv == -1)
-        {
-            caller->self->Err("select error\n"); // an error occured
-        }
-        else if(rv == 0)
-        {
-            //printf("timeout\n");
-        }
-        else
-        {
-            ssize_t nb_read,nb_write;
-            char buffer[1024];
-
-            if(FD_ISSET(caller->fd, &set))
-            {
-                socklen_t sinsize = sizeof(caller->sock_in);
-                if (caller->broadcast==false)
-                {
-                    nb_read = recvfrom(caller->fd, buffer, sizeof(buffer), 0, (sockaddr *) &(caller->sock_in), &sinsize);
-                }
-                else
-                {
-                    nb_read = recvfrom(caller->fd, buffer, sizeof(buffer), 0, NULL,NULL);
-                }
-                if(nb_read  < 0)
-                {
-                    caller->self->Err("recvfrom error\n");
-                }
-//printf("user %s\n",buffer);
-                //on ne garde que les messages venant pas de soi meme
-                if (caller->broadcast==false || (caller->broadcast==true && getFrameworkManager()->ObjectName().compare(0,getFrameworkManager()->ObjectName().size(),buffer,getFrameworkManager()->ObjectName().size()) != 0))
-                {
-                    nb_write=write(pipe_fd,buffer,nb_read);
-                    if(nb_write!=nb_read)
-                    {
-                        caller->self->Err("write error\n");
-                    }
-                }
-                else
-                {
-                    //printf("self %s\n",buffer);
-                }
-            }
-            if(FD_ISSET(pipe_fd, &set))
-            {
-                nb_read=read(pipe_fd,buffer,sizeof(buffer));
-                //printf("read pipe %i %s\n",nb_read,buffer);
-                if(nb_read>0)
-                {
-                    //printf("send %s\n",buffer);
-                    nb_write=sendto(caller->fd,buffer,nb_read, 0, (struct sockaddr *) &(caller->sock_in), sizeof(caller->sock_in));
-                    if(nb_write!=nb_read)
-                    {
-                        caller->self->Err("sendto error\n");
-                    }
-                }
-            }
-        }
-    }
-
-    close(pipe_fd);
-    pthread_exit(0);
-}
-#endif
+          nb_read = recvfrom(caller->fd, buffer, sizeof(buffer), 0, NULL, NULL);
+        }
+        if (nb_read < 0) {
+          caller->self->Err("recvfrom error\n");
+        }
+        // printf("user %s\n",buffer);
+        // on ne garde que les messages venant pas de soi meme
+        if (caller->broadcast == false ||
+            (caller->broadcast == true &&
+             getFrameworkManager()->ObjectName().compare(
+                 0, getFrameworkManager()->ObjectName().size(), buffer,
+                 getFrameworkManager()->ObjectName().size()) != 0)) {
+          nb_write = write(pipe_fd, buffer, nb_read);
+          if (nb_write != nb_read) {
+            caller->self->Err("write error\n");
+          }
+        } else {
+          // printf("self %s\n",buffer);
+        }
+      }
+      if (FD_ISSET(pipe_fd, &set)) {
+        nb_read = read(pipe_fd, buffer, sizeof(buffer));
+        // printf("read pipe %i %s\n",nb_read,buffer);
+        if (nb_read > 0) {
+          // printf("send %s\n",buffer);
+          nb_write = sendto(caller->fd, buffer, nb_read, 0,
+                            (struct sockaddr *)&(caller->sock_in),
+                            sizeof(caller->sock_in));
+          if (nb_write != nb_read) {
+            caller->self->Err("sendto error\n");
+          }
+        }
+      }
+    }
+  }
+
+  close(pipe_fd);
+  pthread_exit(0);
+}
+#endif
Index: trunk/lib/FlairCore/src/SpinBox.cpp
===================================================================
--- trunk/lib/FlairCore/src/SpinBox.cpp	(revision 14)
+++ trunk/lib/FlairCore/src/SpinBox.cpp	(revision 15)
@@ -20,53 +20,62 @@
 using std::string;
 
-namespace flair { namespace gui {
+namespace flair {
+namespace gui {
 
-SpinBox::SpinBox(const LayoutPosition* position,string name,int min,int max,int step,int default_value):Box(position,name,"SpinBox") {
-    //update value from xml file
-    if(default_value<min) default_value=min;
-    if(default_value>max) default_value=max;
-    box_value=default_value;
+SpinBox::SpinBox(const LayoutPosition *position, string name, int min, int max,
+                 int step, int default_value)
+    : Box(position, name, "SpinBox") {
+  // update value from xml file
+  if (default_value < min)
+    default_value = min;
+  if (default_value > max)
+    default_value = max;
+  box_value = default_value;
 
-    SetVolatileXmlProp("min",min);
-    SetVolatileXmlProp("max",max);
-    SetVolatileXmlProp("step",step);
-    GetPersistentXmlProp("value",box_value);
-    SetPersistentXmlProp("value",box_value);
+  SetVolatileXmlProp("min", min);
+  SetVolatileXmlProp("max", max);
+  SetVolatileXmlProp("step", step);
+  GetPersistentXmlProp("value", box_value);
+  SetPersistentXmlProp("value", box_value);
 
-    SendXml();
+  SendXml();
 }
 
-SpinBox::SpinBox(const LayoutPosition* position,string name,string suffix,int min,int max,int step,int default_value):Box(position,name,"SpinBox") {
-    //update value from xml file
-    if(default_value<min) default_value=min;
-    if(default_value>max) default_value=max;
-    box_value=default_value;
+SpinBox::SpinBox(const LayoutPosition *position, string name, string suffix,
+                 int min, int max, int step, int default_value)
+    : Box(position, name, "SpinBox") {
+  // update value from xml file
+  if (default_value < min)
+    default_value = min;
+  if (default_value > max)
+    default_value = max;
+  box_value = default_value;
 
-    SetVolatileXmlProp("suffix",suffix);
-    SetVolatileXmlProp("min",min);
-    SetVolatileXmlProp("max",max);
-    SetVolatileXmlProp("step",step);
-    GetPersistentXmlProp("value",box_value);
-    SetPersistentXmlProp("value",box_value);
-    SendXml();
+  SetVolatileXmlProp("suffix", suffix);
+  SetVolatileXmlProp("min", min);
+  SetVolatileXmlProp("max", max);
+  SetVolatileXmlProp("step", step);
+  GetPersistentXmlProp("value", box_value);
+  SetPersistentXmlProp("value", box_value);
+  SendXml();
 }
 
-SpinBox::~SpinBox() {
-}
+SpinBox::~SpinBox() {}
 
 int SpinBox::Value(void) const {
-    int tmp;
+  int tmp;
 
-    GetMutex();
-    tmp=box_value;
-    ReleaseMutex();
+  GetMutex();
+  tmp = box_value;
+  ReleaseMutex();
 
-    return tmp;
+  return tmp;
 }
 
 void SpinBox::XmlEvent(void) {
-    GetMutex();
-    if(GetPersistentXmlProp("value",box_value)) SetValueChanged();
-    ReleaseMutex();
+  GetMutex();
+  if (GetPersistentXmlProp("value", box_value))
+    SetValueChanged();
+  ReleaseMutex();
 }
 
Index: trunk/lib/FlairCore/src/SpinBox.h
===================================================================
--- trunk/lib/FlairCore/src/SpinBox.h	(revision 14)
+++ trunk/lib/FlairCore/src/SpinBox.h	(revision 15)
@@ -16,73 +16,72 @@
 #include <Box.h>
 
-namespace flair
-{
-namespace gui
-{
+namespace flair {
+namespace gui {
 
-    class LayoutPosition;
+class LayoutPosition;
 
-    /*! \class SpinBox
-    *
-    * \brief Class displaying a QSpinBox on the ground station
-    *
-    */
-    class SpinBox : public Box
-    {
-        public:
-            /*!
-            * \brief Constructor
-            *
-            * Construct a QSpinBox at given position. \n
-            * The QSpinBox is saturated to min and max values.
-            *
-            * \param position position to display the QSpinBox
-            * \param name name
-            * \param min minimum value
-            * \param max maximum value
-            * \param step step
-            * \param default_value default value if not in the xml config file
-            */
-            SpinBox(const LayoutPosition* position,std::string name,int min,int max,int step,int default_value=0);/*!
+/*! \class SpinBox
+*
+* \brief Class displaying a QSpinBox on the ground station
+*
+*/
+class SpinBox : public Box {
+public:
+  /*!
+  * \brief Constructor
+  *
+  * Construct a QSpinBox at given position. \n
+  * The QSpinBox is saturated to min and max values.
+  *
+  * \param position position to display the QSpinBox
+  * \param name name
+  * \param min minimum value
+  * \param max maximum value
+  * \param step step
+  * \param default_value default value if not in the xml config file
+  */
+  SpinBox(const LayoutPosition *position, std::string name, int min, int max,
+          int step, int default_value = 0); /*!
 
-            * \brief Constructor
-            *
-            * Construct a QSpinBox at given position. \n
-            * The QSpinBox is saturated to min and max values.
-            *
-            * \param position position to display the QSpinBox
-            * \param name name
-            * \param suffix suffix for the value (eg unit)
-            * \param min minimum value
-            * \param max maximum value
-            * \param step step
-            * \param default_value default value if not in the xml config file
-            */
-            SpinBox(const LayoutPosition* position,std::string name,std::string suffix,int min,int max,int step,int default_value=0);
+* \brief Constructor
+*
+* Construct a QSpinBox at given position. \n
+* The QSpinBox is saturated to min and max values.
+*
+* \param position position to display the QSpinBox
+* \param name name
+* \param suffix suffix for the value (eg unit)
+* \param min minimum value
+* \param max maximum value
+* \param step step
+* \param default_value default value if not in the xml config file
+*/
+  SpinBox(const LayoutPosition *position, std::string name, std::string suffix,
+          int min, int max, int step, int default_value = 0);
 
-            /*!
-            * \brief Destructor
-            *
-            */
-            ~SpinBox();
+  /*!
+  * \brief Destructor
+  *
+  */
+  ~SpinBox();
 
-           /*!
-            * \brief Value
-            *
-            * \return value
-            */
-            int Value(void) const;
+  /*!
+   * \brief Value
+   *
+   * \return value
+   */
+  int Value(void) const;
 
-        private:
-            /*!
-            * \brief XmlEvent from ground station
-            *
-            * Reimplemented from Widget.
-            *
-            */
-            void XmlEvent(void);
+private:
+  /*!
+  * \brief XmlEvent from ground station
+  *
+  * Reimplemented from Widget.
+  *
+  */
+  void XmlEvent(void);
 
-            int box_value;
-    };
+  int box_value;
+};
 
 } // end namespace gui
Index: trunk/lib/FlairCore/src/Tab.cpp
===================================================================
--- trunk/lib/FlairCore/src/Tab.cpp	(revision 14)
+++ trunk/lib/FlairCore/src/Tab.cpp	(revision 15)
@@ -20,19 +20,14 @@
 using std::string;
 
-namespace flair
-{
-namespace gui
-{
+namespace flair {
+namespace gui {
 
-Tab::Tab(const TabWidget* parent,string name,int position): Layout(parent,name,"Tab")
-{
-    SetVolatileXmlProp("position",position);
-    SendXml();
+Tab::Tab(const TabWidget *parent, string name, int position)
+    : Layout(parent, name, "Tab") {
+  SetVolatileXmlProp("position", position);
+  SendXml();
 }
 
-Tab::~Tab()
-{
-
-}
+Tab::~Tab() {}
 
 } // end namespace gui
Index: trunk/lib/FlairCore/src/Tab.h
===================================================================
--- trunk/lib/FlairCore/src/Tab.h	(revision 14)
+++ trunk/lib/FlairCore/src/Tab.h	(revision 15)
@@ -16,39 +16,36 @@
 #include <Layout.h>
 
-namespace flair
-{
-namespace gui
-{
+namespace flair {
+namespace gui {
 
-    class TabWidget;
+class TabWidget;
 
-    /*! \class Tab
-    *
-    * \brief Class displaying a QTab on the ground station
-    *
-    * Tabs are displayed in a TabWidget.
-    */
-    class Tab: public Layout
-    {
-        public:
-            /*!
-            * \brief Constructor
-            *
-            * Construct a Tab in the TabWidget.
-            *
-            * \param parent parent
-            * \param name name
-            * \param position tab position, -1 to put at the last position
-            */
-            Tab(const TabWidget* parent,std::string name,int position=-1);
+/*! \class Tab
+*
+* \brief Class displaying a QTab on the ground station
+*
+* Tabs are displayed in a TabWidget.
+*/
+class Tab : public Layout {
+public:
+  /*!
+  * \brief Constructor
+  *
+  * Construct a Tab in the TabWidget.
+  *
+  * \param parent parent
+  * \param name name
+  * \param position tab position, -1 to put at the last position
+  */
+  Tab(const TabWidget *parent, std::string name, int position = -1);
 
-            /*!
-            * \brief Destructor
-            *
-            */
-            ~Tab();
+  /*!
+  * \brief Destructor
+  *
+  */
+  ~Tab();
 
-        private:
-    };
+private:
+};
 
 } // end namespace gui
Index: trunk/lib/FlairCore/src/TabWidget.cpp
===================================================================
--- trunk/lib/FlairCore/src/TabWidget.cpp	(revision 14)
+++ trunk/lib/FlairCore/src/TabWidget.cpp	(revision 15)
@@ -22,22 +22,19 @@
 using std::string;
 
-namespace flair
-{
-namespace gui
-{
+namespace flair {
+namespace gui {
 
-TabWidget::TabWidget(const LayoutPosition* position,string name,TabPosition_t tabPosition): Widget(position->getLayout(),name,"TabWidget")
-{
-    SetVolatileXmlProp("row",position->Row());
-    SetVolatileXmlProp("col",position->Col());
-    SetVolatileXmlProp("position",(int)tabPosition);
-    SendXml();
+TabWidget::TabWidget(const LayoutPosition *position, string name,
+                     TabPosition_t tabPosition)
+    : Widget(position->getLayout(), name, "TabWidget") {
+  SetVolatileXmlProp("row", position->Row());
+  SetVolatileXmlProp("col", position->Col());
+  SetVolatileXmlProp("position", (int)tabPosition);
+  SendXml();
 
-    delete position;
+  delete position;
 }
 
-TabWidget::~TabWidget()
-{
-}
+TabWidget::~TabWidget() {}
 
 } // end namespace gui
Index: trunk/lib/FlairCore/src/TabWidget.h
===================================================================
--- trunk/lib/FlairCore/src/TabWidget.h	(revision 14)
+++ trunk/lib/FlairCore/src/TabWidget.h	(revision 15)
@@ -16,47 +16,51 @@
 #include <Widget.h>
 
-namespace flair
-{
-namespace gui
-{
-    class LayoutPosition;
+namespace flair {
+namespace gui {
+class LayoutPosition;
 
-    /*! \class TabWidget
-    *
-    * \brief Class displaying a QTabWidget on the ground station
-    *
-    * TabWidget contains Tabs.
-    *
-    */
-    class TabWidget:public Widget
-    {
-        public:
-            /*!
-            * \enum TabPosition_t
-            * \brief Position of tabs
-            */
-            typedef enum { North/*! north */, South/*! south */, West/*! west */, East/*! east */} TabPosition_t;
+/*! \class TabWidget
+*
+* \brief Class displaying a QTabWidget on the ground station
+*
+* TabWidget contains Tabs.
+*
+*/
+class TabWidget : public Widget {
+public:
+  /*!
+  * \enum TabPosition_t
+  * \brief Position of tabs
+  */
+  typedef enum {
+    North /*! north */,
+    South /*! south */,
+    West /*! west */,
+    East /*! east */
+  } TabPosition_t;
 
-            /*!
-            * \brief Constructor
-            *
-            * Construct a QTabWidget at given position. \n
-            * The TabWidget will automatically be child of position->getLayout() Layout. After calling this constructor,
-            * position will be deleted as it is no longer usefull.
-            *
-            * \param position position
-            * \param name name
-            * \param tabPosition position of tabs
-            */
-            TabWidget(const LayoutPosition* position,std::string name,TabPosition_t tabPosition=TabWidget::West);
+  /*!
+  * \brief Constructor
+  *
+  * Construct a QTabWidget at given position. \n
+  * The TabWidget will automatically be child of position->getLayout() Layout.
+  *After calling this constructor,
+  * position will be deleted as it is no longer usefull.
+  *
+  * \param position position
+  * \param name name
+  * \param tabPosition position of tabs
+  */
+  TabWidget(const LayoutPosition *position, std::string name,
+            TabPosition_t tabPosition = TabWidget::West);
 
-            /*!
-            * \brief Destructor
-            *
-            */
-            ~TabWidget();
+  /*!
+  * \brief Destructor
+  *
+  */
+  ~TabWidget();
 
-        private:
-    };
+private:
+};
 
 } // end namespace core
Index: trunk/lib/FlairCore/src/TcpSocket.cpp
===================================================================
--- trunk/lib/FlairCore/src/TcpSocket.cpp	(revision 14)
+++ trunk/lib/FlairCore/src/TcpSocket.cpp	(revision 15)
@@ -28,207 +28,219 @@
 namespace core {
 
-TcpSocket::TcpSocket(const Object* parent,const std::string name,bool _blockOnSend,bool _blockOnReceive):ConnectedSocket(parent,name),isConnected(false) {
-    blockOnSend=_blockOnSend;
-    blockOnReceive=_blockOnReceive;
+TcpSocket::TcpSocket(const Object *parent, const std::string name,
+                     bool _blockOnSend, bool _blockOnReceive)
+    : ConnectedSocket(parent, name), isConnected(false) {
+  blockOnSend = _blockOnSend;
+  blockOnReceive = _blockOnReceive;
 }
 
 TcpSocket::~TcpSocket() {
-    //Info("Debug: destroying TCP socket %s", ObjectName().c_str());
+  // Info("Debug: destroying TCP socket %s", ObjectName().c_str());
+  close(socket);
+}
+
+void TcpSocket::Listen(const unsigned int port,
+                       const std::string localAddress) {
+  socket = ::socket(AF_INET, SOCK_STREAM, 0);
+
+  sockaddr_in my_addr;
+  my_addr.sin_family = AF_INET;
+  my_addr.sin_port = htons(port);
+  if (localAddress == "ANY") {
+    my_addr.sin_addr.s_addr = INADDR_ANY;
+  } else {
+    inet_aton(localAddress.c_str(), &(my_addr.sin_addr));
+  }
+  memset(&(my_addr.sin_zero), '\0', 8);
+
+  if (bind(socket, (sockaddr *)&my_addr, sizeof(my_addr)) < 0) {
+    char errorMsg[256];
+    Err("TCP bind, %s\n", strerror_r(errno, errorMsg, sizeof(errorMsg)));
+  }
+
+  listen(socket, 1);
+}
+
+TcpSocket *TcpSocket::Accept(Time timeout) {
+  char errorMsg[256];
+  TcpSocket *acceptedSocket = nullptr;
+
+  struct timeval tv;
+  if (timeout != 0) {
+    tv.tv_sec = timeout / 1000; // timeout is in ms
+    tv.tv_usec = (timeout % 1000) * 1000;
+  }
+  fd_set rset;
+  FD_ZERO(&rset);
+  FD_SET(socket, &rset);
+  int ret = select(socket + 1, &rset, nullptr, nullptr,
+                   (timeout == 0) ? nullptr : &tv); // man 2 accept
+  if (ret < 0) {
+    Err("select: %s\n", strerror_r(errno, errorMsg, sizeof(errorMsg)));
+  } else {
+    if (ret == 0) {
+      // timeout reached
+      // Err("timeout reached\n");
+    } else {
+      // our socket is readable, a new connection can be accepted
+      acceptedSocket = new TcpSocket(this->Parent(), this->ObjectName(),
+                                     blockOnSend, blockOnReceive);
+      sockaddr_in their_addr;
+      socklen_t namelen = sizeof(their_addr);
+      if ((acceptedSocket->socket =
+               accept(socket, (sockaddr *)&their_addr, &namelen)) < 0) {
+        Err("error: %s\n", strerror_r(errno, errorMsg, sizeof(errorMsg)));
+        delete acceptedSocket;
+        acceptedSocket = nullptr;
+      }
+    }
+  }
+
+  return acceptedSocket;
+}
+
+bool TcpSocket::Connect(const unsigned int distantPort,
+                        const std::string distantAddress, Time timeout) {
+  bool success = false;
+  char errorMsg[256];
+
+  if (isConnected) {
+    if (this->distantPort == distantPort &&
+        this->distantAddress == distantAddress) {
+      return true;
+    } else {
+      close(socket);
+    }
+  }
+  socket = ::socket(AF_INET, SOCK_STREAM, 0);
+  if (socket == -1)
+    return false;
+
+  sockaddr_in serv_addr;
+  serv_addr.sin_family = AF_INET;
+  serv_addr.sin_port = htons(short(distantPort));
+  if (inet_pton(AF_INET, distantAddress.c_str(), &serv_addr.sin_addr) <= 0) {
+    printf("incorrect network address.");
     close(socket);
-}
-
-void TcpSocket::Listen(const unsigned int port,const std::string localAddress) {
-    socket=::socket(AF_INET,SOCK_STREAM,0);
-
-    sockaddr_in my_addr;
-    my_addr.sin_family = AF_INET;
-    my_addr.sin_port = htons(port);
-    if (localAddress=="ANY") {
-        my_addr.sin_addr.s_addr=INADDR_ANY;
+    return false;
+  }
+  memset(&(serv_addr.sin_zero), '\0', 8);
+
+  // go non blocking
+  int flags = fcntl(socket, F_GETFL);
+  fcntl(socket, F_SETFL, flags | O_NONBLOCK);
+  if (connect(socket, (sockaddr *)&serv_addr, sizeof(serv_addr)) == -1) {
+    if ((errno != EINPROGRESS) && (errno != EAGAIN)) {
+      Err("socket connect: %s\n",
+          strerror_r(errno, errorMsg, sizeof(errorMsg)));
+      success = false;
     } else {
-        inet_aton(localAddress.c_str(),&(my_addr.sin_addr));
+      // now block with a timeout
+      struct timeval tv;
+      if (timeout != 0) {
+        tv.tv_sec = timeout / 1000; // timeout is in ms
+        tv.tv_usec = (timeout % 1000) * 1000;
+      }
+      fd_set wset;
+      FD_ZERO(&wset);
+      FD_SET(socket, &wset);
+      int ret =
+          select(socket + 1, NULL, &wset, NULL,
+                 (timeout == 0) ? NULL : &tv); // man 2 connect EINPROGRESS
+      if (ret < 0) {
+        Err("select: %s\n", strerror_r(errno, errorMsg, sizeof(errorMsg)));
+        success = false;
+      } else {
+        if (ret == 0) {
+          // timeout reached
+          // Err("timeout reached\n");
+          success = false;
+        } else {
+          // something happened on our socket. Check if an error occured
+          int error;
+          socklen_t len = sizeof(error);
+          if (getsockopt(socket, SOL_SOCKET, SO_ERROR, &error, &len) != 0) {
+            // Err("getsockopt:
+            // %s\n",strerror_r(errno,errorMsg,sizeof(errorMsg)));
+            success = false;
+          } else if (error != 0) {
+            // Err("socket error:
+            // %d(%s)\n",error,strerror_r(error,errorMsg,sizeof(errorMsg)));
+            success = false;
+          } else {
+            if (connect(socket, (sockaddr *)&serv_addr, sizeof(serv_addr)) ==
+                -1) {
+              success = false;
+            } else {
+              // Info("connected indeed ^^\n");
+              success = true;
+            }
+          }
+        }
+      }
     }
-    memset(&(my_addr.sin_zero), '\0', 8);
-
-    if (bind(socket,(sockaddr*)&my_addr,sizeof(my_addr))<0) {
-        char errorMsg[256];
-        Err("TCP bind, %s\n",strerror_r(errno,errorMsg,sizeof(errorMsg)));
-    }
-
-    listen(socket,1);
-}
-
-TcpSocket *TcpSocket::Accept(Time timeout) {
-    char errorMsg[256];
-    TcpSocket *acceptedSocket=nullptr;
-
+  } else {
+    success = true; // never reached suprisingly...
+  }
+  // switch back to blocking mode (default)
+  fcntl(socket, F_SETFL, flags);
+
+  if (!success) {
+    close(socket);
+    // Info("Debug: Connect to %s:%d failed\n", distantAddress.c_str(),
+    // distantPort);
+    return false;
+  } else {
+    isConnected = true;
+    this->distantPort = distantPort;
+    this->distantAddress = distantAddress;
+    // Info("Debug: Connect to %s:%d succeeded\n", distantAddress.c_str(),
+    // distantPort);
+    return true;
+  }
+}
+
+ssize_t TcpSocket::SendMessage(const char *buffer, size_t bufferSize,
+                               Time timeout) {
+  int flags = 0;
+  if (!blockOnSend) {
+    flags |= MSG_DONTWAIT;
+  } else {
     struct timeval tv;
-    if (timeout!=0) {
-        tv.tv_sec=timeout/1000; //timeout is in ms
-        tv.tv_usec=(timeout%1000)*1000;
-    }
-    fd_set rset;
-    FD_ZERO(&rset);
-    FD_SET(socket, &rset);
-    int ret=select(socket + 1, &rset, nullptr, nullptr,(timeout==0)?nullptr:&tv); //man 2 accept
-    if (ret<0) {
-        Err("select: %s\n",strerror_r(errno,errorMsg,sizeof(errorMsg)));
-    } else {
-        if (ret==0) {
-            //timeout reached
-            //Err("timeout reached\n");
-        } else {
-            //our socket is readable, a new connection can be accepted
-            acceptedSocket=new TcpSocket(this->Parent(),this->ObjectName(),blockOnSend,blockOnReceive);
-            sockaddr_in their_addr;
-            socklen_t namelen = sizeof(their_addr);
-            if ((acceptedSocket->socket=accept(socket,(sockaddr*)&their_addr, &namelen))<0) {
-                Err("error: %s\n",strerror_r(errno,errorMsg,sizeof(errorMsg)));
-                delete acceptedSocket;
-                acceptedSocket=nullptr;
-            }
-        }
-    }
-
-    return acceptedSocket;
-}
-
-bool TcpSocket::Connect(const unsigned int distantPort,const std::string distantAddress,Time timeout) {
-    bool success=false;
-    char errorMsg[256];
-
-    if (isConnected) {
-        if (this->distantPort==distantPort && this->distantAddress==distantAddress) {
-            return true;
-        } else {
-            close(socket);
-        }
-    }
-    socket=::socket(AF_INET,SOCK_STREAM,0);
-    if (socket==-1) return false;
-
-    sockaddr_in serv_addr;
-    serv_addr.sin_family = AF_INET;
-    serv_addr.sin_port = htons(short(distantPort));
-    if (inet_pton(AF_INET, distantAddress.c_str(), &serv_addr.sin_addr) <= 0) {
-        printf("incorrect network address.");
-        close(socket);
-        return false;
-    }
-    memset(&(serv_addr.sin_zero), '\0', 8);
-
-    //go non blocking
-    int flags=fcntl(socket, F_GETFL);
-    fcntl(socket, F_SETFL, flags | O_NONBLOCK);
-    if (connect(socket, (sockaddr*)&serv_addr, sizeof(serv_addr))==-1) {
-        if ((errno != EINPROGRESS) && (errno != EAGAIN)){
-            Err("socket connect: %s\n",strerror_r(errno,errorMsg,sizeof(errorMsg)));
-            success=false;
-        } else {
-            //now block with a timeout
-            struct timeval tv;
-            if (timeout!=0) {
-                tv.tv_sec=timeout/1000; //timeout is in ms
-                tv.tv_usec=(timeout%1000)*1000;
-            }
-            fd_set wset;
-            FD_ZERO(&wset);
-            FD_SET(socket, &wset);
-            int ret=select(socket + 1, NULL, &wset, NULL,(timeout==0)?NULL:&tv); //man 2 connect EINPROGRESS
-            if (ret<0) {
-                Err("select: %s\n",strerror_r(errno,errorMsg,sizeof(errorMsg)));
-                success=false;
-            } else {
-                if (ret==0) {
-                    //timeout reached
-                    //Err("timeout reached\n");
-                    success=false;
-                } else {
-                    //something happened on our socket. Check if an error occured
-                    int error;
-                    socklen_t len = sizeof(error);
-                    if (getsockopt(socket, SOL_SOCKET, SO_ERROR, &error, &len)!=0) {
-                        //Err("getsockopt: %s\n",strerror_r(errno,errorMsg,sizeof(errorMsg)));
-                        success=false;
-                    } else if (error!=0) {
-                        //Err("socket error: %d(%s)\n",error,strerror_r(error,errorMsg,sizeof(errorMsg)));
-                        success=false;
-                    } else {
-                        if (connect(socket, (sockaddr*)&serv_addr, sizeof(serv_addr))==-1) {
-                            success=false;
-                        } else {
-                            //Info("connected indeed ^^\n");
-                            success=true;
-                        }
-                    }
-                }
-            }
-        }
-    } else {
-        success=true; //never reached suprisingly...
-    }
-    //switch back to blocking mode (default)
-    fcntl(socket, F_SETFL, flags);
-
-    if (!success) {
-        close(socket);
-        //Info("Debug: Connect to %s:%d failed\n", distantAddress.c_str(), distantPort);
-        return false;
-    } else {
-        isConnected=true;
-        this->distantPort=distantPort;
-        this->distantAddress=distantAddress;
-        //Info("Debug: Connect to %s:%d succeeded\n", distantAddress.c_str(), distantPort);
-        return true;
-    }
-}
-
-ssize_t TcpSocket::SendMessage(const char* buffer,size_t bufferSize,Time timeout){
-    int flags=0;
-    if (!blockOnSend) {
-        flags|=MSG_DONTWAIT;
-    } else {
-        struct timeval tv;
-        tv.tv_sec=timeout/1000; //timeout is in ms
-        tv.tv_usec=(timeout%1000)*1000;
-
-        setsockopt(socket,SOL_SOCKET,SO_SNDTIMEO,(char *)&tv,sizeof(struct timeval));
-    }
-    ssize_t bytesSent=send(socket, buffer, bufferSize, flags);
-
-    return bytesSent;
-}
-
-ssize_t TcpSocket::RecvMessage(char* buffer,size_t bufferSize,Time timeout){
-    int flags=0;
-    if (!blockOnReceive) {
-        flags|=MSG_DONTWAIT;
-    } else {
-        struct timeval tv;
-        tv.tv_sec=timeout/1000; //timeout is in ms
-        tv.tv_usec=(timeout%1000)*1000;
-
-        setsockopt(socket,SOL_SOCKET,SO_RCVTIMEO,(char *)&tv,sizeof(struct timeval));
-    }
-    ssize_t bytesRead=recv(socket,buffer,bufferSize,flags);
-
-    return bytesRead;
-}
-
-uint16_t TcpSocket::NetworkToHost16(uint16_t data) {
-    return ntohs(data);
-}
-
-uint16_t TcpSocket::HostToNetwork16(uint16_t data) {
-    return htons(data);
-}
-
-uint32_t TcpSocket::NetworkToHost32(uint32_t data) {
-    return ntohl(data);
-}
-
-uint32_t TcpSocket::HostToNetwork32(uint32_t data) {
-    return htonl(data);
-}
+    tv.tv_sec = timeout / 1000; // timeout is in ms
+    tv.tv_usec = (timeout % 1000) * 1000;
+
+    setsockopt(socket, SOL_SOCKET, SO_SNDTIMEO, (char *)&tv,
+               sizeof(struct timeval));
+  }
+  ssize_t bytesSent = send(socket, buffer, bufferSize, flags);
+
+  return bytesSent;
+}
+
+ssize_t TcpSocket::RecvMessage(char *buffer, size_t bufferSize, Time timeout) {
+  int flags = 0;
+  if (!blockOnReceive) {
+    flags |= MSG_DONTWAIT;
+  } else {
+    struct timeval tv;
+    tv.tv_sec = timeout / 1000; // timeout is in ms
+    tv.tv_usec = (timeout % 1000) * 1000;
+
+    setsockopt(socket, SOL_SOCKET, SO_RCVTIMEO, (char *)&tv,
+               sizeof(struct timeval));
+  }
+  ssize_t bytesRead = recv(socket, buffer, bufferSize, flags);
+
+  return bytesRead;
+}
+
+uint16_t TcpSocket::NetworkToHost16(uint16_t data) { return ntohs(data); }
+
+uint16_t TcpSocket::HostToNetwork16(uint16_t data) { return htons(data); }
+
+uint32_t TcpSocket::NetworkToHost32(uint32_t data) { return ntohl(data); }
+
+uint32_t TcpSocket::HostToNetwork32(uint32_t data) { return htonl(data); }
 
 } // end namespace core
Index: trunk/lib/FlairCore/src/TcpSocket.h
===================================================================
--- trunk/lib/FlairCore/src/TcpSocket.h	(revision 14)
+++ trunk/lib/FlairCore/src/TcpSocket.h	(revision 15)
@@ -16,36 +16,39 @@
 #include <ConnectedSocket.h>
 
-namespace flair
-{
-namespace core
-{
-    /*! \class TcpSocket
-    *
-    * \brief Class encapsulating a TCP socket
-    *
-    */
-    class TcpSocket:public ConnectedSocket {
-    public:
-        TcpSocket(const Object* parent,const std::string name,bool blockOnSend=false,bool blockOnReceive=true);
-        ~TcpSocket();
-        void Listen(const unsigned int port,const std::string localAddress="ANY");
-        TcpSocket *Accept(Time timeout=0); //should throw an exception if not a listening socket
-        bool Connect(const unsigned int distantPort,const std::string distantAddress,Time timeout=0); // timeout in milliseconds
-        ssize_t SendMessage(const char* message,size_t message_len,Time timeout=0); // timeout in milliseconds
-        ssize_t RecvMessage(char* buf,size_t buf_len,Time timeout=0); // timeout in milliseconds
+namespace flair {
+namespace core {
+/*! \class TcpSocket
+*
+* \brief Class encapsulating a TCP socket
+*
+*/
+class TcpSocket : public ConnectedSocket {
+public:
+  TcpSocket(const Object *parent, const std::string name,
+            bool blockOnSend = false, bool blockOnReceive = true);
+  ~TcpSocket();
+  void Listen(const unsigned int port, const std::string localAddress = "ANY");
+  TcpSocket *Accept(
+      Time timeout = 0); // should throw an exception if not a listening socket
+  bool Connect(const unsigned int distantPort, const std::string distantAddress,
+               Time timeout = 0); // timeout in milliseconds
+  ssize_t SendMessage(const char *message, size_t message_len,
+                      Time timeout = 0); // timeout in milliseconds
+  ssize_t RecvMessage(char *buf, size_t buf_len,
+                      Time timeout = 0); // timeout in milliseconds
 
-        uint16_t NetworkToHost16(uint16_t data);
-        uint16_t HostToNetwork16(uint16_t data);
-        uint32_t NetworkToHost32(uint32_t data);
-        uint32_t HostToNetwork32(uint32_t data);
+  uint16_t NetworkToHost16(uint16_t data);
+  uint16_t HostToNetwork16(uint16_t data);
+  uint32_t NetworkToHost32(uint32_t data);
+  uint32_t HostToNetwork32(uint32_t data);
 
-    private:
-        int socket; // socket file descriptor
-        bool blockOnSend;
-        bool blockOnReceive;
-        bool isConnected;
-        unsigned int distantPort;
-        std::string distantAddress;
-    };
+private:
+  int socket; // socket file descriptor
+  bool blockOnSend;
+  bool blockOnReceive;
+  bool isConnected;
+  unsigned int distantPort;
+  std::string distantAddress;
+};
 
 } // end namespace core
Index: trunk/lib/FlairCore/src/TextEdit.cpp
===================================================================
--- trunk/lib/FlairCore/src/TextEdit.cpp	(revision 14)
+++ trunk/lib/FlairCore/src/TextEdit.cpp	(revision 15)
@@ -22,42 +22,36 @@
 using std::string;
 
-namespace flair
-{
-namespace gui
-{
+namespace flair {
+namespace gui {
 
-TextEdit::TextEdit(const LayoutPosition* position,string name,size_t buf_size): Widget(position->getLayout(),name,"TextEdit")
-{
-    SetVolatileXmlProp("row",position->Row());
-    SetVolatileXmlProp("col",position->Col());
-    SendXml();
+TextEdit::TextEdit(const LayoutPosition *position, string name, size_t buf_size)
+    : Widget(position->getLayout(), name, "TextEdit") {
+  SetVolatileXmlProp("row", position->Row());
+  SetVolatileXmlProp("col", position->Col());
+  SendXml();
 
-    delete position;
+  delete position;
 
-//    text_node=AddXmlChild("Text");
+  //    text_node=AddXmlChild("Text");
 
-    printf_buffer=(char*)malloc(buf_size);
-    if(printf_buffer==NULL) Err("erreur malloc\n");
+  printf_buffer = (char *)malloc(buf_size);
+  if (printf_buffer == NULL)
+    Err("erreur malloc\n");
 }
 
-TextEdit::~TextEdit()
-{
-    free(printf_buffer);
-}
+TextEdit::~TextEdit() { free(printf_buffer); }
 
+void TextEdit::Append(const char *format, ...) {
+  int n;
 
-void TextEdit::Append(const char * format, ...)
-{
-    int n;
+  va_list args;
+  va_start(args, format);
+  n = vsprintf(printf_buffer, format, args);
+  va_end(args);
+  if (n <= 0)
+    return;
 
-    va_list args;
-    va_start(args, format);
-    n = vsprintf(printf_buffer,format, args);
-    va_end (args);
-    if (n<=0) return;
-
-    SetVolatileXmlProp("value",printf_buffer,text_node);
-    SendXml();
-
+  SetVolatileXmlProp("value", printf_buffer, text_node);
+  SendXml();
 }
 
Index: trunk/lib/FlairCore/src/TextEdit.h
===================================================================
--- trunk/lib/FlairCore/src/TextEdit.h	(revision 14)
+++ trunk/lib/FlairCore/src/TextEdit.h	(revision 15)
@@ -16,51 +16,50 @@
 #include <Widget.h>
 
-namespace flair
-{
-namespace gui
-{
+namespace flair {
+namespace gui {
 
-    class LayoutPosition;
+class LayoutPosition;
 
-    /*! \class TextEdit
-    *
-    * \brief Class displaying a QTextEdit on the ground station
-    *
-    * QTextEdit allows printing on multiple lines. \n
-    *
-    */
-    class TextEdit:public Widget
-    {
-        public:
-            /*!
-            * \brief Constructor
-            *
-            * Construct a QTabWidget at given position. \n
-            * The TextEdit will automatically be child of position->getLayout() Layout. After calling this constructor,
-            * position will be deleted as it is no longer usefull.
-            *
-            * \param parent parent
-            * \param name name
-            * \param buf_size size of the text buffer
-            */
-            TextEdit(const LayoutPosition* position,std::string name,size_t buf_size=255);
+/*! \class TextEdit
+*
+* \brief Class displaying a QTextEdit on the ground station
+*
+* QTextEdit allows printing on multiple lines. \n
+*
+*/
+class TextEdit : public Widget {
+public:
+  /*!
+  * \brief Constructor
+  *
+  * Construct a QTabWidget at given position. \n
+  * The TextEdit will automatically be child of position->getLayout() Layout.
+  *After calling this constructor,
+  * position will be deleted as it is no longer usefull.
+  *
+  * \param parent parent
+  * \param name name
+  * \param buf_size size of the text buffer
+  */
+  TextEdit(const LayoutPosition *position, std::string name,
+           size_t buf_size = 255);
 
-            /*!
-            * \brief Destructor
-            *
-            */
-            ~TextEdit();
+  /*!
+  * \brief Destructor
+  *
+  */
+  ~TextEdit();
 
-            /*!
-            * \brief Append a line
-            *
-            * \param format text string to display, see standard printf
-            */
-            void Append(const char * format, ...);
+  /*!
+  * \brief Append a line
+  *
+  * \param format text string to display, see standard printf
+  */
+  void Append(const char *format, ...);
 
-        private:
-            char* printf_buffer;
-            xmlNodePtr text_node;
-    };
+private:
+  char *printf_buffer;
+  xmlNodePtr text_node;
+};
 
 } // end namespace gui
Index: trunk/lib/FlairCore/src/Thread.cpp
===================================================================
--- trunk/lib/FlairCore/src/Thread.cpp	(revision 14)
+++ trunk/lib/FlairCore/src/Thread.cpp	(revision 15)
@@ -27,146 +27,95 @@
 using std::string;
 
-namespace flair
-{
-namespace core
-{
+namespace flair {
+namespace core {
 
-Thread::Thread(const Object* parent,string name,uint8_t priority): Object(parent,name,"Thread")
-{
-     pimpl_=new Thread_impl(this,priority);
+Thread::Thread(const Object *parent, string name, uint8_t priority)
+    : Object(parent, name, "Thread") {
+  pimpl_ = new Thread_impl(this, priority);
 }
 
-Thread::~Thread()
-{
-    delete pimpl_;
-}
+Thread::~Thread() { delete pimpl_; }
 
-void Thread::Start(void)
-{
-    pimpl_->Start();
-}
+void Thread::Start(void) { pimpl_->Start(); }
 
-void Thread::SafeStop(void)
-{
-    pimpl_->SafeStop();
-}
+void Thread::SafeStop(void) { pimpl_->SafeStop(); }
 
-bool Thread::ToBeStopped(void) const
-{
-    return pimpl_->ToBeStopped();
-}
+bool Thread::ToBeStopped(void) const { return pimpl_->ToBeStopped(); }
 
 #ifdef __XENO__
-void Thread::WarnUponSwitches(bool value)
-{
-    // Ask Xenomai to warn us upon switches to secondary mode.
-    if(value==true)
-    {
-        rt_task_set_mode(0, T_WARNSW, NULL);
-    }
-    else
-    {
-        rt_task_set_mode(T_WARNSW, 0, NULL);
-    }
+void Thread::WarnUponSwitches(bool value) {
+  // Ask Xenomai to warn us upon switches to secondary mode.
+  if (value == true) {
+    rt_task_set_mode(0, T_WARNSW, NULL);
+  } else {
+    rt_task_set_mode(T_WARNSW, 0, NULL);
+  }
 }
 #else
-void Thread::WarnUponSwitches(bool value)
-{
-    //Warn("Not applicable in non real time\n");
+void Thread::WarnUponSwitches(bool value) {
+  // Warn("Not applicable in non real time\n");
 }
 #endif
 
-void Thread::Join(void)
-{
-    pimpl_->Join();
+void Thread::Join(void) { pimpl_->Join(); }
+
+void Thread::SetPeriodUS(uint32_t period) { pimpl_->SetPeriodUS(period); }
+
+uint32_t Thread::GetPeriodUS(void) const { return pimpl_->GetPeriodUS(); }
+
+void Thread::SetPeriodMS(uint32_t period) { pimpl_->SetPeriodMS(period); }
+
+uint32_t Thread::GetPeriodMS(void) const { return pimpl_->GetPeriodMS(); }
+
+bool Thread::IsPeriodSet(void) { return pimpl_->period_set; }
+
+void Thread::WaitPeriod(void) const { pimpl_->WaitPeriod(); }
+
+void Thread::Suspend(void) { pimpl_->Suspend(); }
+
+bool Thread::SuspendUntil(Time date) { return pimpl_->SuspendUntil(date); }
+
+bool Thread::IsSuspended(void) const { return pimpl_->IsSuspended(); }
+
+void Thread::Resume(void) { pimpl_->Resume(); }
+
+int Thread::WaitUpdate(const IODevice *device) {
+  return pimpl_->WaitUpdate(device);
 }
 
-void Thread::SetPeriodUS(uint32_t period) {
-    pimpl_->SetPeriodUS(period);
-}
-
-uint32_t Thread::GetPeriodUS(void) const {
-    return pimpl_->GetPeriodUS();
-}
-
-void Thread::SetPeriodMS(uint32_t period) {
-    pimpl_->SetPeriodMS(period);
-}
-
-uint32_t Thread::GetPeriodMS(void) const {
-    return pimpl_->GetPeriodMS();
-}
-
-
-bool Thread::IsPeriodSet(void)
-{
-    return pimpl_->period_set;
-}
-
-void Thread::WaitPeriod(void) const
-{
-    pimpl_->WaitPeriod();
-}
-
-void Thread::Suspend(void)
-{
-    pimpl_->Suspend();
-}
-
-bool Thread::SuspendUntil(Time date){
-    return pimpl_->SuspendUntil(date);
-}
-
-bool Thread::IsSuspended(void) const
-{
-    return pimpl_->IsSuspended();
-}
-
-void Thread::Resume(void)
-{
-    pimpl_->Resume();
-}
-
-int Thread::WaitUpdate(const IODevice* device)
-{
-    return pimpl_->WaitUpdate(device);
-}
-
-void Thread::SleepUntil(Time time) const
-{
+void Thread::SleepUntil(Time time) const {
 #ifdef __XENO__
-    int status=rt_task_sleep_until(time);
-    if(status!=0) Err("%s, error rt_task_sleep_until (%s), resume time: %lld, actual time: %lld\n",
-                      ObjectName().c_str(),
-                      strerror(-status),
-                      time,
-                      GetTime());
-    //Printf("rt_task_sleep_until, resume time: %lld, actual time: %lld\n",time,GetTime());
+  int status = rt_task_sleep_until(time);
+  if (status != 0)
+    Err("%s, error rt_task_sleep_until (%s), resume time: %lld, actual time: "
+        "%lld\n",
+        ObjectName().c_str(), strerror(-status), time, GetTime());
+// Printf("rt_task_sleep_until, resume time: %lld, actual time:
+// %lld\n",time,GetTime());
 #else
-    Time current=GetTime();
-    if(current<time)
-    {
-        usleep((time-current)/1000);
-    }
+  Time current = GetTime();
+  if (current < time) {
+    usleep((time - current) / 1000);
+  }
 #endif
 }
 
-void Thread::SleepMS(uint32_t time) const
-{
+void Thread::SleepMS(uint32_t time) const {
 #ifdef __XENO__
-    int status=rt_task_sleep(time*1000*1000);
-    if(status!=0) Err("erreur rt_task_sleep (%s)\n",strerror(-status));
+  int status = rt_task_sleep(time * 1000 * 1000);
+  if (status != 0)
+    Err("erreur rt_task_sleep (%s)\n", strerror(-status));
 #else
-    usleep(time*1000);
+  usleep(time * 1000);
 #endif
 }
 
-void Thread::SleepUS(uint32_t time) const
-{
+void Thread::SleepUS(uint32_t time) const {
 #ifdef __XENO__
-    int status=rt_task_sleep(time*1000);
-    if(status!=0) Err("erreur rt_task_sleep (%s)\n",strerror(-status));
+  int status = rt_task_sleep(time * 1000);
+  if (status != 0)
+    Err("erreur rt_task_sleep (%s)\n", strerror(-status));
 #else
-    usleep(time);
+  usleep(time);
 #endif
 }
Index: trunk/lib/FlairCore/src/Thread.h
===================================================================
--- trunk/lib/FlairCore/src/Thread.h	(revision 14)
+++ trunk/lib/FlairCore/src/Thread.h	(revision 15)
@@ -19,212 +19,214 @@
 class Thread_impl;
 
-namespace flair
-{
-namespace core
-{
-
-    class IODevice;
-
-    /*! \class Thread
-    *
-    * \brief Abstract class for a thread
-    *
-    * To implement a thread, Run() method must be reimplemented. \n
-    * When Start() is called, it will automatically call Run() reimplemented method.
-    * A thread can be periodic, in this case WaitPeriod() will block untill period is met.
-    * Thread can also e synnchronized with an IODevice, using WaitUpdate() method. \n
-    * Thread period is by default 100ms.
-    */
-    class Thread: public Object
-    {
-        friend class ::Thread_impl;
-
-        public:
-            /*!
-            * \brief Constructor
-            *
-            * \param parent parent
-            * \param name name
-            * \param priority priority, should be >20 (<20 is reserved for internal use)
-            */
-            Thread(const Object* parent,std::string name,uint8_t priority);//priority>20, for real time only
-
-            /*!
-            * \brief Destructor
-            *
-            * If thread is started, SafeStop() and Join() will
-            * be automatically called.
-            *
-            */
-            virtual ~Thread();
-
-            /*!
-            * \brief Start the thread
-            *
-            */
-            void Start(void);
-
-            /*!
-            * \brief Set a stop flag
-            *
-            * ToBeStopped() will return true after calling this method.
-            */
-            void SafeStop(void);
-
-            /*!
-            * \brief Set a stop flag
-            *
-            * Reimplemented Run() can poll this method to
-            * determine when to stop the thread.
-            *
-            * \return true if SafeStop() was called
-            */
-            bool ToBeStopped(void) const;
-
-            /*!
-            * \brief Join the thread
-            *
-            * This method will block untill Run() returns.
-            *
-            */
-            void Join(void);
-
-            /*!
-            * \brief Set the period in micro second
-            *
-            * After calling this method, IsPeriodSet will return true.
-            *
-            * \param period_us period in us
-            */
-            void SetPeriodUS(uint32_t period_us);
-
-            uint32_t GetPeriodUS() const;
-
-            /*!
-            * \brief Set the period in milli second
-            *
-            * After calling this method, IsPeriodSet will return true.
-            *
-            * \param period_ums period in ms
-            */
-            void SetPeriodMS(uint32_t period_ms);
-
-            uint32_t GetPeriodMS() const;
-
-            /*!
-            * \brief Returns if period was set
-            *
-            * \return true if a period was set using SetPeriodUS or SetPeriodMS
-            * false otherwise
-            */
-            bool IsPeriodSet(void);
-
-            /*!
-            * \brief Wait the period
-            *
-            * This method will block untill period is met. \n
-            * If no period was set (see SetPeriodUS, SetPeriodMS and IsPeriodSet), this method
-            * returns immediately.
-            *
-            */
-            void WaitPeriod(void) const;
-
-            /*!
-            * \brief Wait update of an IODevice
-            *
-            * This method will block untill IODevice::ProcessUpdate
-            * is called. \n
-            * This method is usefull to synchronize a thread with an IODevice.
-            *
-            * \param device IODevice to wait update from
-            */
-            int WaitUpdate(const IODevice* device);
-
-            /*!
-            * \brief Suspend the thread
-            *
-            * This method will block untill Resume() is called.
-            *
-            */
-            void Suspend(void);
-
-            /*!
-            * \brief Suspend the thread with timeout
-            *
-            * This method will block until Resume() is called or the absolute date specified occurs
-            *
-            * \param date absolute date in ns
-            * \return true if thread is woken up by a call to Resume, false otherwise
-            */
-            bool SuspendUntil(Time date);
-
-            /*!
-            * \brief Resume the thread
-            *
-            * This method will unblock the call to Suspend().
-            *
-            */
-            void Resume(void);
-
-            /*!
-            * \brief Is the thread suspended?
-            *
-            * \return true if thread is suspended
-            *
-            */
-            bool IsSuspended(void) const;
-
-            /*!
-            * \brief Sleep until absolute time
-            *
-            * This method will block untill time is reached.
-            *
-            * \param time absolute time
-            */
-            void SleepUntil(Time time) const;
-
-            /*!
-            * \brief Sleep for a certain time in micro second
-            *
-            * This method will block untill time is elapsed.
-            *
-            * \param time_us time to wait in micro second
-            */
-            void SleepUS(uint32_t time_us) const;
-
-            /*!
-            * \brief Sleep for a cartain time in milli second
-            *
-            * This method will block untill time is elapsed.
-            *
-            * \param time_ms time to wait in milli second
-            */
-            void SleepMS(uint32_t time_ms) const;
-
-            /*!
-            * \brief Warn if real time / non real time switches occur
-            *
-            * If enabled, a message with the call stack will be displayed
-            * in case of real time / non real time switches. \n
-            * This method can help to debug application and see if switches occur. \n
-            * Note that it as no effect if this method is called from the non real time
-            * Framework library.
-            *
-            * \param enable enable or disable warns
-            */
-            static void WarnUponSwitches(bool enable);
-
-        private:
-            /*!
-            * \brief Run method
-            *
-            * This method is automatically called by Start(). \n
-            * This method must be reimplemented, in order to implement the thread.
-            *
-            */
-            virtual void Run(void)=0;
-
-            class Thread_impl* pimpl_;
-    };
+namespace flair {
+namespace core {
+
+class IODevice;
+
+/*! \class Thread
+*
+* \brief Abstract class for a thread
+*
+* To implement a thread, Run() method must be reimplemented. \n
+* When Start() is called, it will automatically call Run() reimplemented method.
+* A thread can be periodic, in this case WaitPeriod() will block untill period
+*is met.
+* Thread can also e synnchronized with an IODevice, using WaitUpdate() method.
+*\n
+* Thread period is by default 100ms.
+*/
+class Thread : public Object {
+  friend class ::Thread_impl;
+
+public:
+  /*!
+  * \brief Constructor
+  *
+  * \param parent parent
+  * \param name name
+  * \param priority priority, should be >20 (<20 is reserved for internal use)
+  */
+  Thread(const Object *parent, std::string name,
+         uint8_t priority); // priority>20, for real time only
+
+  /*!
+  * \brief Destructor
+  *
+  * If thread is started, SafeStop() and Join() will
+  * be automatically called.
+  *
+  */
+  virtual ~Thread();
+
+  /*!
+  * \brief Start the thread
+  *
+  */
+  void Start(void);
+
+  /*!
+  * \brief Set a stop flag
+  *
+  * ToBeStopped() will return true after calling this method.
+  */
+  void SafeStop(void);
+
+  /*!
+  * \brief Set a stop flag
+  *
+  * Reimplemented Run() can poll this method to
+  * determine when to stop the thread.
+  *
+  * \return true if SafeStop() was called
+  */
+  bool ToBeStopped(void) const;
+
+  /*!
+  * \brief Join the thread
+  *
+  * This method will block untill Run() returns.
+  *
+  */
+  void Join(void);
+
+  /*!
+  * \brief Set the period in micro second
+  *
+  * After calling this method, IsPeriodSet will return true.
+  *
+  * \param period_us period in us
+  */
+  void SetPeriodUS(uint32_t period_us);
+
+  uint32_t GetPeriodUS() const;
+
+  /*!
+  * \brief Set the period in milli second
+  *
+  * After calling this method, IsPeriodSet will return true.
+  *
+  * \param period_ums period in ms
+  */
+  void SetPeriodMS(uint32_t period_ms);
+
+  uint32_t GetPeriodMS() const;
+
+  /*!
+  * \brief Returns if period was set
+  *
+  * \return true if a period was set using SetPeriodUS or SetPeriodMS
+  * false otherwise
+  */
+  bool IsPeriodSet(void);
+
+  /*!
+  * \brief Wait the period
+  *
+  * This method will block untill period is met. \n
+  * If no period was set (see SetPeriodUS, SetPeriodMS and IsPeriodSet), this
+  *method
+  * returns immediately.
+  *
+  */
+  void WaitPeriod(void) const;
+
+  /*!
+  * \brief Wait update of an IODevice
+  *
+  * This method will block untill IODevice::ProcessUpdate
+  * is called. \n
+  * This method is usefull to synchronize a thread with an IODevice.
+  *
+  * \param device IODevice to wait update from
+  */
+  int WaitUpdate(const IODevice *device);
+
+  /*!
+  * \brief Suspend the thread
+  *
+  * This method will block untill Resume() is called.
+  *
+  */
+  void Suspend(void);
+
+  /*!
+  * \brief Suspend the thread with timeout
+  *
+  * This method will block until Resume() is called or the absolute date
+  *specified occurs
+  *
+  * \param date absolute date in ns
+  * \return true if thread is woken up by a call to Resume, false otherwise
+  */
+  bool SuspendUntil(Time date);
+
+  /*!
+  * \brief Resume the thread
+  *
+  * This method will unblock the call to Suspend().
+  *
+  */
+  void Resume(void);
+
+  /*!
+  * \brief Is the thread suspended?
+  *
+  * \return true if thread is suspended
+  *
+  */
+  bool IsSuspended(void) const;
+
+  /*!
+  * \brief Sleep until absolute time
+  *
+  * This method will block untill time is reached.
+  *
+  * \param time absolute time
+  */
+  void SleepUntil(Time time) const;
+
+  /*!
+  * \brief Sleep for a certain time in micro second
+  *
+  * This method will block untill time is elapsed.
+  *
+  * \param time_us time to wait in micro second
+  */
+  void SleepUS(uint32_t time_us) const;
+
+  /*!
+  * \brief Sleep for a cartain time in milli second
+  *
+  * This method will block untill time is elapsed.
+  *
+  * \param time_ms time to wait in milli second
+  */
+  void SleepMS(uint32_t time_ms) const;
+
+  /*!
+  * \brief Warn if real time / non real time switches occur
+  *
+  * If enabled, a message with the call stack will be displayed
+  * in case of real time / non real time switches. \n
+  * This method can help to debug application and see if switches occur. \n
+  * Note that it as no effect if this method is called from the non real time
+  * Framework library.
+  *
+  * \param enable enable or disable warns
+  */
+  static void WarnUponSwitches(bool enable);
+
+private:
+  /*!
+  * \brief Run method
+  *
+  * This method is automatically called by Start(). \n
+  * This method must be reimplemented, in order to implement the thread.
+  *
+  */
+  virtual void Run(void) = 0;
+
+  class Thread_impl *pimpl_;
+};
 
 } // end namespace core
Index: trunk/lib/FlairCore/src/Thread_impl.cpp
===================================================================
--- trunk/lib/FlairCore/src/Thread_impl.cpp	(revision 14)
+++ trunk/lib/FlairCore/src/Thread_impl.cpp	(revision 15)
@@ -33,324 +33,288 @@
 using namespace flair::core;
 
-Thread_impl::Thread_impl(Thread* self,uint8_t priority)
-{
-    isRunning=false;
-    tobestopped=false;
-    is_suspended=false;
-    period_set=false;
-
-    this->self=self;
-    cond=new ConditionVariable(self,self->ObjectName());
-
-    if(priority<MIN_THREAD_PRIORITY)
-    {
-        priority=MIN_THREAD_PRIORITY;
-//        printf("Thread::Thread, %s: priority set to %i\n",self->ObjectName().c_str(), priority);
+Thread_impl::Thread_impl(Thread *self, uint8_t priority) {
+  isRunning = false;
+  tobestopped = false;
+  is_suspended = false;
+  period_set = false;
+
+  this->self = self;
+  cond = new ConditionVariable(self, self->ObjectName());
+
+  if (priority < MIN_THREAD_PRIORITY) {
+    priority = MIN_THREAD_PRIORITY;
+    //        printf("Thread::Thread, %s: priority set to
+    //        %i\n",self->ObjectName().c_str(), priority);
+  }
+  if (priority > MAX_THREAD_PRIORITY) {
+    priority = MAX_THREAD_PRIORITY;
+    self->Warn("priority set to %i\n", MAX_THREAD_PRIORITY);
+  }
+
+  this->priority = priority;
+  period = 100 * 1000 * 1000; // 100ms par defaut
+  min_jitter = 1000 * 1000 * 1000;
+  max_jitter = 0;
+  mean_jitter = 0;
+  last = 0;
+  cpt = 0;
+}
+
+Thread_impl::~Thread_impl() {
+  SafeStop();
+  Join();
+}
+
+void Thread_impl::Start(void) {
+  int status;
+
+  isRunning = true;
+
+#ifdef __XENO__
+  string th_name =
+      getFrameworkManager()->ObjectName() + "-" + self->ObjectName();
+
+#ifdef RT_STACK_SIZE
+  status = rt_task_create(&task_rt, th_name.c_str(), RT_STACK_SIZE,
+                          (int)priority, T_JOINABLE);
+#else
+  status =
+      rt_task_create(&task_rt, th_name.c_str(), 0, (int)priority, T_JOINABLE);
+#endif // RT_STACK_SIZE
+  if (status != 0) {
+    self->Err("rt_task_create error (%s)\n", strerror(-status));
+  } else {
+    //_printf("rt_task_create ok %s\n",th_name);
+  }
+
+  status = rt_task_start(&task_rt, &main_rt, (void *)this);
+  if (status != 0) {
+    self->Err("rt_task_start error (%s)\n", strerror(-status));
+  } else {
+    //_printf("rt_task_start ok %s\n",th_name);
+  }
+
+  // Initialise the rt_print buffer for this task explicitly
+  rt_print_init(512, th_name.c_str());
+
+#else //__XENO__
+
+  // Initialize thread creation attributes
+  pthread_attr_t attr;
+  if (pthread_attr_init(&attr) != 0) {
+    self->Err("Error pthread_attr_init\n");
+  }
+
+#ifdef NRT_STACK_SIZE
+  if (pthread_attr_setstacksize(&attr, NRT_STACK_SIZE) != 0) {
+    self->Err("Error pthread_attr_setstacksize\n");
+  }
+#endif // NRT_STACK_SIZE
+
+  if (pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED) != 0) {
+    self->Err("Error pthread_attr_setinheritsched\n");
+  }
+
+  if (pthread_attr_setschedpolicy(&attr, SCHED_FIFO) != 0) {
+    self->Err("Error pthread_attr_setschedpolicy\n");
+  }
+
+  struct sched_param parm;
+  parm.sched_priority = priority;
+  if (pthread_attr_setschedparam(&attr, &parm) != 0) {
+    self->Err("Error pthread_attr_setschedparam\n");
+  }
+
+  next_time = GetTime() + period;
+
+  if (pthread_create(&task_nrt, &attr, main_nrt, (void *)this) != 0) {
+    self->Err("pthread_create error\n");
+  }
+
+  if (pthread_attr_destroy(&attr) != 0) {
+    self->Err("Error pthread_attr_destroy\n");
+  }
+
+#endif //__XENO__
+}
+
+#ifdef __XENO__
+void Thread_impl::main_rt(void *arg) {
+  Thread_impl *caller = (Thread_impl *)arg;
+
+  // Perform auto-init of rt_print buffers if the task doesn't do so
+  rt_print_auto_init(1);
+
+  caller->self->Run();
+
+  caller->PrintStats();
+}
+#else
+void *Thread_impl::main_nrt(void *arg) {
+  Thread_impl *caller = (Thread_impl *)arg;
+
+  caller->self->Run();
+
+  caller->PrintStats();
+
+  pthread_exit(0);
+}
+#endif //__XENO__
+
+void Thread_impl::SetPeriodUS(uint32_t period) {
+  if (period == 0) {
+    self->Err("Period must be>0\n");
+    return;
+  }
+
+#ifdef __XENO__
+  int status = rt_task_set_periodic(&task_rt, TM_NOW, period * 1000);
+  if (status != 0)
+    self->Err("Error rt_task_set_periodic %s\n", strerror(-status));
+#else
+  next_time -= period;
+  next_time += period * 1000;
+#endif
+  this->period = period * 1000;
+  period_set = true;
+}
+
+uint32_t Thread_impl::GetPeriodUS() const { return this->period / 1000; }
+
+void Thread_impl::SetPeriodMS(uint32_t period) {
+  if (period == 0) {
+    self->Err("Period must be>0\n");
+    return;
+  }
+
+#ifdef __XENO__
+  int status = rt_task_set_periodic(&task_rt, TM_NOW, period * 1000 * 1000);
+  if (status != 0)
+    self->Err("Error rt_task_set_periodic %s\n", strerror(-status));
+#else
+  next_time -= period;
+  next_time += period * 1000 * 1000;
+#endif
+  this->period = period * 1000 * 1000;
+  period_set = true;
+}
+
+uint32_t Thread_impl::GetPeriodMS() const { return this->period / 1000 / 1000; }
+
+void Thread_impl::WaitPeriod(void) {
+  if (period_set == false) {
+    self->Err("Period must be set befaore calling this method\n");
+    return;
+  }
+#ifdef __XENO__
+  unsigned long overruns_r;
+  int status = rt_task_wait_period(&overruns_r);
+  if (status != 0)
+    self->Err("Error rt_task_wait_period %s\n", strerror(-status));
+  if (status == -ETIMEDOUT)
+    self->Err("overrun: %lld\n", overruns_r);
+#else
+  self->SleepUntil(next_time);
+  next_time += period;
+#endif
+  ComputeJitter(GetTime());
+}
+
+void Thread_impl::Suspend(void) {
+  if (isRunning == false) {
+    self->Err("thread is not started\n");
+    return;
+  }
+
+  cond->GetMutex(), is_suspended = true;
+  cond->CondWait();
+  is_suspended = false;
+  cond->ReleaseMutex();
+}
+
+bool Thread_impl::SuspendUntil(Time date) {
+  if (isRunning == false) {
+    self->Err("thread is not started\n");
+    return false;
+  }
+
+  cond->GetMutex(), is_suspended = true;
+  bool success = cond->CondWaitUntil(date);
+  is_suspended = false;
+  cond->ReleaseMutex();
+  return success;
+}
+
+bool Thread_impl::IsSuspended(void) {
+  bool result;
+
+  cond->GetMutex();
+  result = is_suspended;
+  cond->ReleaseMutex();
+
+  return result;
+}
+
+void Thread_impl::Resume(void) {
+  if (isRunning == false) {
+    self->Err("thread is not started\n");
+    return;
+  }
+
+  cond->GetMutex();
+  if (is_suspended == true) {
+    cond->CondSignal();
+  } else {
+    self->Err("thread is not suspended\n");
+  }
+  cond->ReleaseMutex();
+}
+
+int Thread_impl::WaitUpdate(const IODevice *device) {
+  int status = 0;
+
+  if (IsSuspended() == true) {
+    self->Err("thread is already supended\n");
+    status = -1;
+  } else {
+    cond->GetMutex();
+
+    if (device->pimpl_->SetToWake(self) == 0) {
+      is_suspended = true;
+      cond->CondWait();
+      is_suspended = false;
+    } else {
+      self->Err("%s is already waiting an update\n",
+                device->ObjectName().c_str());
+      status = -1;
     }
-    if(priority>MAX_THREAD_PRIORITY)
-    {
-        priority=MAX_THREAD_PRIORITY;
-        self->Warn("priority set to %i\n",MAX_THREAD_PRIORITY);
-    }
-
-    this->priority=priority;
-    period=100*1000*1000;//100ms par defaut
-    min_jitter=1000*1000*1000;
-    max_jitter=0;
-    mean_jitter=0;
-    last=0;
-    cpt=0;
-}
-
-Thread_impl::~Thread_impl()
-{
-    SafeStop();
-    Join();
-}
-
-void Thread_impl::Start(void)
-{
-    int status;
-
-    isRunning=true;
-
-#ifdef __XENO__
-    string th_name=getFrameworkManager()->ObjectName()+ "-" + self->ObjectName();
-
-#ifdef RT_STACK_SIZE
-    status=rt_task_create(&task_rt, th_name.c_str(), RT_STACK_SIZE, (int)priority, T_JOINABLE);
-#else
-    status=rt_task_create(&task_rt, th_name.c_str(), 0,(int)priority, T_JOINABLE);
-#endif //RT_STACK_SIZE
-    if(status!=0)
-    {
-        self->Err("rt_task_create error (%s)\n",strerror(-status));
-    }
-    else
-    {
-        //_printf("rt_task_create ok %s\n",th_name);
-    }
-
-    status=rt_task_start(&task_rt, &main_rt, (void*)this);
-    if(status!=0)
-    {
-        self->Err("rt_task_start error (%s)\n",strerror(-status));
-    }
-     else
-     {
-        //_printf("rt_task_start ok %s\n",th_name);
-     }
-
-    // Initialise the rt_print buffer for this task explicitly
-    rt_print_init(512, th_name.c_str());
-
-#else //__XENO__
-
-    // Initialize thread creation attributes
-    pthread_attr_t attr;
-    if(pthread_attr_init(&attr) != 0)
-    {
-        self->Err("Error pthread_attr_init\n");
-    }
-
-#ifdef NRT_STACK_SIZE
-    if(pthread_attr_setstacksize(&attr, NRT_STACK_SIZE) != 0)
-    {
-        self->Err("Error pthread_attr_setstacksize\n");
-    }
-#endif //NRT_STACK_SIZE
-
-    if(pthread_attr_setinheritsched(&attr,PTHREAD_EXPLICIT_SCHED)!=0)
-    {
-        self->Err("Error pthread_attr_setinheritsched\n");
-    }
-
-    if(pthread_attr_setschedpolicy(&attr, SCHED_FIFO)!=0)
-    {
-        self->Err("Error pthread_attr_setschedpolicy\n");
-    }
-
-    struct sched_param parm;
-    parm.sched_priority = priority;
-    if(pthread_attr_setschedparam(&attr,&parm)!=0)
-    {
-        self->Err("Error pthread_attr_setschedparam\n");
-    }
-
-    next_time=GetTime()+period;
-
-    if(pthread_create(&task_nrt,  &attr, main_nrt, (void*)this) != 0)
-    {
-        self->Err("pthread_create error\n");
-    }
-
-    if(pthread_attr_destroy(&attr) != 0)
-    {
-        self->Err("Error pthread_attr_destroy\n");
-    }
-
-#endif //__XENO__
-}
-
-#ifdef __XENO__
-void Thread_impl::main_rt(void * arg)
-{
-    Thread_impl *caller = (Thread_impl*)arg;
-
-    // Perform auto-init of rt_print buffers if the task doesn't do so
-    rt_print_auto_init(1);
-
-    caller->self->Run();
-
-    caller->PrintStats();
-}
-#else
-void* Thread_impl::main_nrt(void * arg)
-{
-    Thread_impl *caller = (Thread_impl*)arg;
-
-    caller->self->Run();
-
-    caller->PrintStats();
-
-    pthread_exit(0);
-}
-#endif //__XENO__
-
-void Thread_impl::SetPeriodUS(uint32_t period) {
-    if(period==0) {
-        self->Err("Period must be>0\n");
-        return;
-    }
-
-#ifdef __XENO__
-    int status=rt_task_set_periodic(&task_rt, TM_NOW, period*1000);
-    if(status!=0) self->Err("Error rt_task_set_periodic %s\n",strerror(-status));
-#else
-    next_time-=period;
-    next_time+=period*1000;
-#endif
-    this->period=period*1000;
-    period_set=true;
-}
-
-uint32_t Thread_impl::GetPeriodUS() const {
-    return this->period/1000;
-}
-
-void Thread_impl::SetPeriodMS(uint32_t period) {
-    if(period==0) {
-        self->Err("Period must be>0\n");
-        return;
-    }
-
-#ifdef __XENO__
-    int status=rt_task_set_periodic(&task_rt, TM_NOW, period*1000*1000);
-    if(status!=0) self->Err("Error rt_task_set_periodic %s\n",strerror(-status));
-#else
-    next_time-=period;
-    next_time+=period*1000*1000;
-#endif
-    this->period=period*1000*1000;
-    period_set=true;
-}
-
-uint32_t Thread_impl::GetPeriodMS() const {
-    return this->period/1000/1000;
-}
-
-void Thread_impl::WaitPeriod(void)
-{
-    if(period_set==false)
-    {
-        self->Err("Period must be set befaore calling this method\n");
-        return;
-    }
-#ifdef __XENO__
-    unsigned long overruns_r;
-    int status=rt_task_wait_period(&overruns_r);
-    if(status!=0) self->Err("Error rt_task_wait_period %s\n",strerror(-status));
-    if(status==-ETIMEDOUT) self->Err("overrun: %lld\n",overruns_r);
-#else
-    self->SleepUntil(next_time);
-    next_time+=period;
-#endif
-    ComputeJitter(GetTime());
-}
-
-
-void Thread_impl::Suspend(void) {
-    if(isRunning==false) {
-        self->Err("thread is not started\n");
-        return;
-    }
-
-    cond->GetMutex(),
-    is_suspended=true;
-    cond->CondWait();
-    is_suspended=false;
+
     cond->ReleaseMutex();
-}
-
-bool Thread_impl::SuspendUntil(Time date) {
-    if(isRunning==false) {
-        self->Err("thread is not started\n");
-        return false;
-    }
-
-    cond->GetMutex(),
-    is_suspended=true;
-    bool success=cond->CondWaitUntil(date);
-    is_suspended=false;
-    cond->ReleaseMutex();
-    return success;
-}
-
-bool Thread_impl::IsSuspended(void)
-{
-    bool result;
-
-    cond->GetMutex();
-    result=is_suspended;
-    cond->ReleaseMutex();
-
-    return result;
-}
-
-void Thread_impl::Resume(void)
-{
-    if(isRunning==false)
-    {
-        self->Err("thread is not started\n");
-        return;
-    }
-
-    cond->GetMutex();
-    if(is_suspended==true)
-    {
-        cond->CondSignal();
-    }
-    else
-    {
-        self->Err("thread is not suspended\n");
-    }
-    cond->ReleaseMutex();
-}
-
-int Thread_impl::WaitUpdate(const IODevice* device)
-{
-    int status=0;
-
-    if(IsSuspended()==true)
-    {
-        self->Err("thread is already supended\n");
-        status=-1;
-    }
-    else
-    {
-        cond->GetMutex();
-
-        if(device->pimpl_->SetToWake(self)==0)
-        {
-            is_suspended=true;
-            cond->CondWait();
-            is_suspended=false;
-        }
-        else
-        {
-            self->Err("%s is already waiting an update\n",device->ObjectName().c_str());
-            status=-1;
-        }
-
-        cond->ReleaseMutex();
-    }
-
-    return status;
-}
-
-void Thread_impl::PrintStats(void)
-{
-#ifdef __XENO__
-    RT_TASK_INFO info;
-
-    int status=rt_task_inquire(NULL, &info);
-    if(status!=0)
-    {
-        self->Err("Error rt_task_inquire %s\n",strerror(-status));
-    }
-    else
-#endif
-    {
+  }
+
+  return status;
+}
+
+void Thread_impl::PrintStats(void) {
+#ifdef __XENO__
+  RT_TASK_INFO info;
+
+  int status = rt_task_inquire(NULL, &info);
+  if (status != 0) {
+    self->Err("Error rt_task_inquire %s\n", strerror(-status));
+  } else
+#endif
+  {
 #ifndef __XENO__
-        //if(last!=0)
-#endif
-        {
-            Printf("Thread::%s :\n",self->ObjectName().c_str());
-        }
-#ifdef __XENO__
-        Printf("    number of context switches: %i\n",info.ctxswitches);
-        Printf("    number of primary->secondary mode switch: %i\n",info.modeswitches);
-        //printf("number of page faults: %i\n",info.pagefaults);
-        Printf("    execution time (ms) in primary mode: %lld\n",info.exectime/1000000);
+// if(last!=0)
+#endif
+    { Printf("Thread::%s :\n", self->ObjectName().c_str()); }
+#ifdef __XENO__
+    Printf("    number of context switches: %i\n", info.ctxswitches);
+    Printf("    number of primary->secondary mode switch: %i\n",
+           info.modeswitches);
+    // printf("number of page faults: %i\n",info.pagefaults);
+    Printf("    execution time (ms) in primary mode: %lld\n",
+           info.exectime / 1000000);
 #else
 /*
@@ -358,68 +322,64 @@
         getrusage(RUSAGE_THREAD,&r_usage);
         printf("    memory usage = %ld\n",r_usage.ru_maxrss);
-        printf("RUSAGE :ru_utime => %lld [sec] : %lld [usec], :ru_stime => %lld [sec] : %lld [usec] \n",
+        printf("RUSAGE :ru_utime => %lld [sec] : %lld [usec], :ru_stime => %lld
+   [sec] : %lld [usec] \n",
            (int64_t)r_usage.ru_utime.tv_sec, (int64_t)r_usage.ru_utime.tv_usec,
-           (int64_t)r_usage.ru_stime.tv_sec, (int64_t)r_usage.ru_stime.tv_usec);*/
-#endif
-        if(last!=0)
-        {
-            Printf("    min jitter (ns): %lld\n",min_jitter);
-            Printf("    max jitter (ns): %lld\n",max_jitter);
-            Printf("    jitter moy (ns): %lld\n",mean_jitter/cpt);
-            Printf("    itertions: %lld\n",cpt);
-        }
+           (int64_t)r_usage.ru_stime.tv_sec,
+   (int64_t)r_usage.ru_stime.tv_usec);*/
+#endif
+    if (last != 0) {
+      Printf("    min jitter (ns): %lld\n", min_jitter);
+      Printf("    max jitter (ns): %lld\n", max_jitter);
+      Printf("    jitter moy (ns): %lld\n", mean_jitter / cpt);
+      Printf("    itertions: %lld\n", cpt);
     }
-}
-
-void Thread_impl::Join(void)
-{
-    if(isRunning==true)
-    {
-        int status;
-
-#ifdef __XENO__
-        status=rt_task_join(&task_rt);
-#else
-        status=pthread_join(task_nrt,NULL);
-#endif
-        if(status!=0) self->Err("error %s\n",strerror(-status));
-        isRunning=false;
-    }
-}
-
-void Thread_impl::ComputeJitter(Time time)
-{
-    Time diff,delta;
-    diff=time-last;
-
-    if(diff>=period)
-    {
-        delta=diff-period;
-    }
-    else
-    {
-        delta=period-diff;
-    }
-    //if(delta==0) rt_printf("%lld %lld\n",time,last);
-    last=time;
-    if(diff==time) return;
-
-    if(delta>max_jitter) max_jitter=delta;
-    if(delta<min_jitter) min_jitter=delta;
-    mean_jitter+=delta;
-    cpt++;
-
-    //Printf("Thread::%s jitter moy (ns): %lld\n",self->ObjectName().c_str(),mean_jitter/cpt);
-
-}
-
-void Thread_impl::SafeStop(void)
-{
-    tobestopped=true;
-    if(IsSuspended()) Resume();
-}
-
-bool Thread_impl::ToBeStopped(void)
-{
-    return tobestopped;
-}
+  }
+}
+
+void Thread_impl::Join(void) {
+  if (isRunning == true) {
+    int status;
+
+#ifdef __XENO__
+    status = rt_task_join(&task_rt);
+#else
+    status = pthread_join(task_nrt, NULL);
+#endif
+    if (status != 0)
+      self->Err("error %s\n", strerror(-status));
+    isRunning = false;
+  }
+}
+
+void Thread_impl::ComputeJitter(Time time) {
+  Time diff, delta;
+  diff = time - last;
+
+  if (diff >= period) {
+    delta = diff - period;
+  } else {
+    delta = period - diff;
+  }
+  // if(delta==0) rt_printf("%lld %lld\n",time,last);
+  last = time;
+  if (diff == time)
+    return;
+
+  if (delta > max_jitter)
+    max_jitter = delta;
+  if (delta < min_jitter)
+    min_jitter = delta;
+  mean_jitter += delta;
+  cpt++;
+
+  // Printf("Thread::%s jitter moy (ns):
+  // %lld\n",self->ObjectName().c_str(),mean_jitter/cpt);
+}
+
+void Thread_impl::SafeStop(void) {
+  tobestopped = true;
+  if (IsSuspended())
+    Resume();
+}
+
+bool Thread_impl::ToBeStopped(void) { return tobestopped; }
Index: trunk/lib/FlairCore/src/UdtSocket.cpp
===================================================================
--- trunk/lib/FlairCore/src/UdtSocket.cpp	(revision 14)
+++ trunk/lib/FlairCore/src/UdtSocket.cpp	(revision 15)
@@ -24,128 +24,130 @@
 using std::string;
 
-namespace flair
-{
-namespace core
-{
+namespace flair {
+namespace core {
 
-UdtSocket::UdtSocket(const Object* parent,const std::string name,bool _blockOnSend,bool _blockOnReceive):ConnectedSocket(parent,name) {
-    UDT::startup();
-    blockOnSend=_blockOnSend;
-    blockOnReceive=_blockOnReceive;
+UdtSocket::UdtSocket(const Object *parent, const std::string name,
+                     bool _blockOnSend, bool _blockOnReceive)
+    : ConnectedSocket(parent, name) {
+  UDT::startup();
+  blockOnSend = _blockOnSend;
+  blockOnReceive = _blockOnReceive;
 }
 
-UdtSocket::~UdtSocket(){
-}
+UdtSocket::~UdtSocket() {}
 
-void UdtSocket::Listen(const unsigned int port,const std::string localAddress) {
-    socket = UDT::socket(AF_INET, SOCK_DGRAM, 0);
+void UdtSocket::Listen(const unsigned int port,
+                       const std::string localAddress) {
+  socket = UDT::socket(AF_INET, SOCK_DGRAM, 0);
 
-    UDT::setsockopt(socket, 0, UDT_SNDSYN, &blockOnSend, sizeof(bool));
-    UDT::setsockopt(socket, 0, UDT_RCVSYN, &blockOnReceive, sizeof(bool));
-    bool reuse = true;
-    UDT::setsockopt(socket, 0, UDT_REUSEADDR, &reuse, sizeof(bool));
+  UDT::setsockopt(socket, 0, UDT_SNDSYN, &blockOnSend, sizeof(bool));
+  UDT::setsockopt(socket, 0, UDT_RCVSYN, &blockOnReceive, sizeof(bool));
+  bool reuse = true;
+  UDT::setsockopt(socket, 0, UDT_REUSEADDR, &reuse, sizeof(bool));
 
-    sockaddr_in my_addr;
-    my_addr.sin_family = AF_INET;
-    my_addr.sin_port = htons(port);
-    if (localAddress=="ANY") {
-        my_addr.sin_addr.s_addr=INADDR_ANY;
-    } else {
-        inet_aton(localAddress.c_str(),&(my_addr.sin_addr));
-    }
-    memset(&(my_addr.sin_zero), '\0', 8);
+  sockaddr_in my_addr;
+  my_addr.sin_family = AF_INET;
+  my_addr.sin_port = htons(port);
+  if (localAddress == "ANY") {
+    my_addr.sin_addr.s_addr = INADDR_ANY;
+  } else {
+    inet_aton(localAddress.c_str(), &(my_addr.sin_addr));
+  }
+  memset(&(my_addr.sin_zero), '\0', 8);
 
-    if (UDT::ERROR == UDT::bind(socket, (sockaddr*)&my_addr, sizeof(my_addr))) {
-      Err("bind, %s\n",UDT::getlasterror().getErrorMessage());
-    }
+  if (UDT::ERROR == UDT::bind(socket, (sockaddr *)&my_addr, sizeof(my_addr))) {
+    Err("bind, %s\n", UDT::getlasterror().getErrorMessage());
+  }
 
-    UDT::listen(socket, 1);
+  UDT::listen(socket, 1);
 }
 
 UdtSocket *UdtSocket::Accept(Time timeout) {
-    // TIMEOUT UNSUPPORTED!!
-    UdtSocket *acceptedSocket=new UdtSocket(this->Parent(),this->ObjectName());
-    acceptedSocket->blockOnSend=this->blockOnSend;
-    acceptedSocket->blockOnReceive=this->blockOnReceive;
+  // TIMEOUT UNSUPPORTED!!
+  UdtSocket *acceptedSocket = new UdtSocket(this->Parent(), this->ObjectName());
+  acceptedSocket->blockOnSend = this->blockOnSend;
+  acceptedSocket->blockOnReceive = this->blockOnReceive;
 
-    sockaddr_in their_addr;
-    int namelen = sizeof(their_addr);
+  sockaddr_in their_addr;
+  int namelen = sizeof(their_addr);
 
-    if ((acceptedSocket->socket = UDT::accept(socket, (sockaddr*)&their_addr, &namelen))==UDT::INVALID_SOCK) {
-        Err("accept: %s, code %i\n",UDT::getlasterror().getErrorMessage(),UDT::getlasterror().getErrorCode());
-    }
+  if ((acceptedSocket->socket = UDT::accept(socket, (sockaddr *)&their_addr,
+                                            &namelen)) == UDT::INVALID_SOCK) {
+    Err("accept: %s, code %i\n", UDT::getlasterror().getErrorMessage(),
+        UDT::getlasterror().getErrorCode());
+  }
 
-    return acceptedSocket;
+  return acceptedSocket;
 }
 
-bool UdtSocket::Connect(const unsigned int port,const std::string distantAddress,Time timeout) {
-    bool success=true;
-    socket=UDT::socket(AF_INET, SOCK_DGRAM, 0);
+bool UdtSocket::Connect(const unsigned int port,
+                        const std::string distantAddress, Time timeout) {
+  bool success = true;
+  socket = UDT::socket(AF_INET, SOCK_DGRAM, 0);
 
-    UDT::setsockopt(socket, 0, UDT_SNDSYN, &blockOnSend, sizeof(bool));
-    UDT::setsockopt(socket, 0, UDT_RCVSYN, &blockOnReceive, sizeof(bool));
-    bool reuse = true;
-    UDT::setsockopt(socket, 0, UDT_REUSEADDR, &reuse, sizeof(bool));
+  UDT::setsockopt(socket, 0, UDT_SNDSYN, &blockOnSend, sizeof(bool));
+  UDT::setsockopt(socket, 0, UDT_RCVSYN, &blockOnReceive, sizeof(bool));
+  bool reuse = true;
+  UDT::setsockopt(socket, 0, UDT_REUSEADDR, &reuse, sizeof(bool));
 
-    sockaddr_in serv_addr;
-    serv_addr.sin_family = AF_INET;
-    serv_addr.sin_port = htons(short(port));
-    if (inet_pton(AF_INET, distantAddress.c_str(), &serv_addr.sin_addr) <= 0) {
-        printf("incorrect network address.");
-        success=false;
-    }
-    memset(&(serv_addr.sin_zero), '\0', 8);
+  sockaddr_in serv_addr;
+  serv_addr.sin_family = AF_INET;
+  serv_addr.sin_port = htons(short(port));
+  if (inet_pton(AF_INET, distantAddress.c_str(), &serv_addr.sin_addr) <= 0) {
+    printf("incorrect network address.");
+    success = false;
+  }
+  memset(&(serv_addr.sin_zero), '\0', 8);
 
-    if (UDT::ERROR == UDT::connect(socket, (sockaddr*)&serv_addr, sizeof(serv_addr))) {
-        success=false;
-    }
-    if (!success) {
-        UDT::close(socket);
-        return false;
-    } else return true;
+  if (UDT::ERROR ==
+      UDT::connect(socket, (sockaddr *)&serv_addr, sizeof(serv_addr))) {
+    success = false;
+  }
+  if (!success) {
+    UDT::close(socket);
+    return false;
+  } else
+    return true;
 }
 
-ssize_t UdtSocket::SendMessage(const char* buffer,size_t bufferSize,Time timeout){
-    int udtTimeout=timeout;
-    if (blockOnSend) {
-        if(UDT::setsockopt(socket, 0, UDT_SNDTIMEO, &udtTimeout, sizeof(udtTimeout))!=0) Err("error UDT_SNDTIMEO %s\n", UDT::getlasterror().getErrorMessage());
-    }
-    ssize_t bytesSent=UDT::sendmsg(socket, buffer, bufferSize, -1,true);
+ssize_t UdtSocket::SendMessage(const char *buffer, size_t bufferSize,
+                               Time timeout) {
+  int udtTimeout = timeout;
+  if (blockOnSend) {
+    if (UDT::setsockopt(socket, 0, UDT_SNDTIMEO, &udtTimeout,
+                        sizeof(udtTimeout)) != 0)
+      Err("error UDT_SNDTIMEO %s\n", UDT::getlasterror().getErrorMessage());
+  }
+  ssize_t bytesSent = UDT::sendmsg(socket, buffer, bufferSize, -1, true);
 
-    return bytesSent;
+  return bytesSent;
 }
 
-ssize_t UdtSocket::RecvMessage(char* buffer,size_t bufferSize,Time timeout){
-    int udtTimeout=timeout;
-    if (blockOnReceive) {
-        if(UDT::setsockopt(socket, 0, UDT_RCVTIMEO, &udtTimeout, sizeof(udtTimeout))!=0) Err("error UDT_RCVTIMEO %s\n", UDT::getlasterror().getErrorMessage());
-    }
-    ssize_t bytesRead= UDT::recvmsg(socket,buffer,bufferSize);
+ssize_t UdtSocket::RecvMessage(char *buffer, size_t bufferSize, Time timeout) {
+  int udtTimeout = timeout;
+  if (blockOnReceive) {
+    if (UDT::setsockopt(socket, 0, UDT_RCVTIMEO, &udtTimeout,
+                        sizeof(udtTimeout)) != 0)
+      Err("error UDT_RCVTIMEO %s\n", UDT::getlasterror().getErrorMessage());
+  }
+  ssize_t bytesRead = UDT::recvmsg(socket, buffer, bufferSize);
 
-/*
-    if(bytesRead<0) {
-        if(UDT::getlasterror().getErrorCode()==CUDTException::ECONNLOST) {
-            connection_lost=true;
-        }
-    }
-*/
-    return bytesRead;
+  /*
+      if(bytesRead<0) {
+          if(UDT::getlasterror().getErrorCode()==CUDTException::ECONNLOST) {
+              connection_lost=true;
+          }
+      }
+  */
+  return bytesRead;
 }
 
-uint16_t UdtSocket::NetworkToHost16(uint16_t data) {
-    return ntohs(data);
-}
+uint16_t UdtSocket::NetworkToHost16(uint16_t data) { return ntohs(data); }
 
-uint16_t UdtSocket::HostToNetwork16(uint16_t data) {
-    return htons(data);
-}
+uint16_t UdtSocket::HostToNetwork16(uint16_t data) { return htons(data); }
 
-uint32_t UdtSocket::NetworkToHost32(uint32_t data) {
-    return ntohl(data);
-}
+uint32_t UdtSocket::NetworkToHost32(uint32_t data) { return ntohl(data); }
 
-uint32_t UdtSocket::HostToNetwork32(uint32_t data) {
-    return htonl(data);
-}
+uint32_t UdtSocket::HostToNetwork32(uint32_t data) { return htonl(data); }
 
 } // end namespace core
Index: trunk/lib/FlairCore/src/UdtSocket.h
===================================================================
--- trunk/lib/FlairCore/src/UdtSocket.h	(revision 14)
+++ trunk/lib/FlairCore/src/UdtSocket.h	(revision 15)
@@ -18,33 +18,34 @@
 #include <ConnectedSocket.h>
 
-namespace flair
-{
-namespace core
-{
-    /*! \class UdtSocket
-    *
-    * \brief Class encapsulating a UDT socket
-    *
-    */
-    class UdtSocket:public ConnectedSocket {
-    public:
-        UdtSocket(const Object* parent,const std::string name,bool blockOnSend=false,bool blockOnReceive=true);
-        ~UdtSocket();
-        void Listen(const unsigned int port,const std::string localAddress="ANY");
-        UdtSocket *Accept(Time timeout); //should throw an exception if not a listening socket
-        bool Connect(const unsigned int port,const std::string distantAddress,Time timeout); // /!\ timeout is ignored
-        ssize_t SendMessage(const char* message,size_t message_len,Time timeout);
-        ssize_t RecvMessage(char* buf,size_t buf_len,Time timeout);
+namespace flair {
+namespace core {
+/*! \class UdtSocket
+*
+* \brief Class encapsulating a UDT socket
+*
+*/
+class UdtSocket : public ConnectedSocket {
+public:
+  UdtSocket(const Object *parent, const std::string name,
+            bool blockOnSend = false, bool blockOnReceive = true);
+  ~UdtSocket();
+  void Listen(const unsigned int port, const std::string localAddress = "ANY");
+  UdtSocket *
+  Accept(Time timeout); // should throw an exception if not a listening socket
+  bool Connect(const unsigned int port, const std::string distantAddress,
+               Time timeout); // /!\ timeout is ignored
+  ssize_t SendMessage(const char *message, size_t message_len, Time timeout);
+  ssize_t RecvMessage(char *buf, size_t buf_len, Time timeout);
 
-        uint16_t NetworkToHost16(uint16_t data);
-        uint16_t HostToNetwork16(uint16_t data);
-        uint32_t NetworkToHost32(uint32_t data);
-        uint32_t HostToNetwork32(uint32_t data);
+  uint16_t NetworkToHost16(uint16_t data);
+  uint16_t HostToNetwork16(uint16_t data);
+  uint32_t NetworkToHost32(uint32_t data);
+  uint32_t HostToNetwork32(uint32_t data);
 
-    private:
-        UDTSOCKET socket;
-        bool blockOnSend;
-        bool blockOnReceive;
-    };
+private:
+  UDTSOCKET socket;
+  bool blockOnSend;
+  bool blockOnReceive;
+};
 
 } // end namespace core
Index: trunk/lib/FlairCore/src/Unix_I2cPort.cpp
===================================================================
--- trunk/lib/FlairCore/src/Unix_I2cPort.cpp	(revision 14)
+++ trunk/lib/FlairCore/src/Unix_I2cPort.cpp	(revision 15)
@@ -18,64 +18,50 @@
 #include "Unix_I2cPort.h"
 #include <errno.h>
-#include <fcntl.h>   /* File control definitions */
+#include <fcntl.h> /* File control definitions */
 #include <unistd.h>
 #include <sys/ioctl.h>
 #include <linux/i2c-dev.h>
 
-
 using std::string;
 
-namespace flair
-{
-namespace core
-{
+namespace flair {
+namespace core {
 
-Unix_I2cPort::Unix_I2cPort(const Object* parent,string name,string device) : I2cPort(parent,name)
-{
-    //open port
-    fd = open( device.c_str(), O_RDWR );
-	if (fd == -1)
-	{
-		Err("open_port: Unable to open %s\n",device.c_str());
-	}
+Unix_I2cPort::Unix_I2cPort(const Object *parent, string name, string device)
+    : I2cPort(parent, name) {
+  // open port
+  fd = open(device.c_str(), O_RDWR);
+  if (fd == -1) {
+    Err("open_port: Unable to open %s\n", device.c_str());
+  }
 }
 
-Unix_I2cPort::~Unix_I2cPort()
-{
-    close(fd);
+Unix_I2cPort::~Unix_I2cPort() { close(fd); }
+
+void Unix_I2cPort::SetRxTimeout(core::Time timeout_ns) {
+  Warn("not implemented\n");
 }
 
-void Unix_I2cPort::SetRxTimeout(core::Time timeout_ns)
-{
-    Warn("not implemented\n");
+void Unix_I2cPort::SetTxTimeout(core::Time timeout_ns) {
+  Warn("not implemented\n");
 }
 
-void Unix_I2cPort::SetTxTimeout(core::Time timeout_ns)
-{
-    Warn("not implemented\n");
+int Unix_I2cPort::SetSlave(uint16_t address) {
+  int err = ioctl(fd, I2C_SLAVE_FORCE, address);
+  if (err < 0) {
+    Err("Failed to set slave address\n");
+  }
+
+  return err;
 }
 
-int Unix_I2cPort::SetSlave(uint16_t address)
-{
-    int err=ioctl( fd, I2C_SLAVE_FORCE, address);
-	if( err < 0 )
-    {
-        Err("Failed to set slave address\n");
-    }
-
-	return err;
+ssize_t Unix_I2cPort::Write(const void *buf, size_t nbyte) {
+  return write(fd, buf, nbyte);
 }
 
-ssize_t Unix_I2cPort::Write(const void *buf,size_t nbyte)
-{
-    return write(fd,buf, nbyte);
-}
-
-ssize_t Unix_I2cPort::Read(void *buf,size_t nbyte)
-{
-    return read(fd,buf, nbyte);
+ssize_t Unix_I2cPort::Read(void *buf, size_t nbyte) {
+  return read(fd, buf, nbyte);
 }
 
 } // end namespace core
 } // end namespace flair
-
Index: trunk/lib/FlairCore/src/Unix_I2cPort.h
===================================================================
--- trunk/lib/FlairCore/src/Unix_I2cPort.h	(revision 14)
+++ trunk/lib/FlairCore/src/Unix_I2cPort.h	(revision 15)
@@ -16,84 +16,81 @@
 #include <I2cPort.h>
 
-namespace flair
-{
-namespace core
-{
-    /*! \class Unix_I2cPort
-    *
-    * \brief Class for unix serial port
-    *
-    */
-    class Unix_I2cPort: public I2cPort
-    {
+namespace flair {
+namespace core {
+/*! \class Unix_I2cPort
+*
+* \brief Class for unix serial port
+*
+*/
+class Unix_I2cPort : public I2cPort {
 
-        public:
-            /*!
-            * \brief Constructor
-            *
-            * Construct an unix i2c port
-            *
-            * \param parent parent
-            * \param name name
-            * \param device serial device (ex /dev/i2c-1)
-            */
-            Unix_I2cPort(const Object* parent,std::string port_name,std::string device);
+public:
+  /*!
+  * \brief Constructor
+  *
+  * Construct an unix i2c port
+  *
+  * \param parent parent
+  * \param name name
+  * \param device serial device (ex /dev/i2c-1)
+  */
+  Unix_I2cPort(const Object *parent, std::string port_name, std::string device);
 
-            /*!
-            * \brief Destructor
-            *
-            */
-            ~Unix_I2cPort();
+  /*!
+  * \brief Destructor
+  *
+  */
+  ~Unix_I2cPort();
 
-            /*!
-            * \brief Set slave's address
-            *
-            * This method need to be called before any communication.
-            *
-            * \param address slave's address
-            */
-            int SetSlave(uint16_t address);
+  /*!
+  * \brief Set slave's address
+  *
+  * This method need to be called before any communication.
+  *
+  * \param address slave's address
+  */
+  int SetSlave(uint16_t address);
 
-            /*!
-            * \brief Set RX timeout
-            *
-            * Timeout for waiting datas.
-            *
-            * \param timeout_ns timeout in nano second
-            */
-            void SetRxTimeout(Time timeout_ns);
+  /*!
+  * \brief Set RX timeout
+  *
+  * Timeout for waiting datas.
+  *
+  * \param timeout_ns timeout in nano second
+  */
+  void SetRxTimeout(Time timeout_ns);
 
-            /*!
-            * \brief Set TX timeout
-            *
-            * Timeout for waiting an ACK from the slave.
-            *
-            * \param timeout_ns timeout in nano second
-            */
-            void SetTxTimeout(Time timeout_ns);
+  /*!
+  * \brief Set TX timeout
+  *
+  * Timeout for waiting an ACK from the slave.
+  *
+  * \param timeout_ns timeout in nano second
+  */
+  void SetTxTimeout(Time timeout_ns);
 
-            /*!
-            * \brief Write datas
-            *
-            * \param buf pointer to datas
-            * \param nbyte length of datas
-            *
-            * \return amount of written datas
-            */
-            ssize_t Write(const void *buf,size_t nbyte);
+  /*!
+  * \brief Write datas
+  *
+  * \param buf pointer to datas
+  * \param nbyte length of datas
+  *
+  * \return amount of written datas
+  */
+  ssize_t Write(const void *buf, size_t nbyte);
 
-            /*!
-            * \brief Read datas
-            *
-            * \param buf pointer to datas
-            * \param nbyte length of datas
-            *
-            * \return amount of read datas
-            */
-            ssize_t Read(void *buf,size_t nbyte);
+  /*!
+  * \brief Read datas
+  *
+  * \param buf pointer to datas
+  * \param nbyte length of datas
+  *
+  * \return amount of read datas
+  */
+  ssize_t Read(void *buf, size_t nbyte);
 
-        private:
-            int fd;
-    };
+private:
+  int fd;
+};
 } // end namespace core
 } // end namespace flair
Index: trunk/lib/FlairCore/src/Unix_SerialPort.cpp
===================================================================
--- trunk/lib/FlairCore/src/Unix_SerialPort.cpp	(revision 14)
+++ trunk/lib/FlairCore/src/Unix_SerialPort.cpp	(revision 15)
@@ -17,131 +17,113 @@
 
 #include "Unix_SerialPort.h"
-#include <fcntl.h>   /* File control definitions */
+#include <fcntl.h> /* File control definitions */
 #include <unistd.h>
 
 using std::string;
 
-namespace flair
-{
-namespace core
-{
+namespace flair {
+namespace core {
 
-Unix_SerialPort::Unix_SerialPort(const Object* parent,string name,string device) : SerialPort(parent,name)
-{
-    //open port
-	fd = open(device.c_str(), O_RDWR | O_NOCTTY);// |O_NDELAY|O_NONBLOCK);
-	if (fd == -1)
-	{
-		Err("open_port: Unable to open %s\n",device.c_str());
-	}
-	//fcntl(fd, F_SETFL, 0); //read calls are non blocking
+Unix_SerialPort::Unix_SerialPort(const Object *parent, string name,
+                                 string device)
+    : SerialPort(parent, name) {
+  // open port
+  fd = open(device.c_str(), O_RDWR | O_NOCTTY); // |O_NDELAY|O_NONBLOCK);
+  if (fd == -1) {
+    Err("open_port: Unable to open %s\n", device.c_str());
+  }
+  // fcntl(fd, F_SETFL, 0); //read calls are non blocking
 
-	//Get the current options for the port
+  // Get the current options for the port
 
-	tcgetattr(fd, &options);
-	//Set the baud rates to 115200
-	cfsetispeed(&options, B115200);
-	cfsetospeed(&options, B115200);
+  tcgetattr(fd, &options);
+  // Set the baud rates to 115200
+  cfsetispeed(&options, B115200);
+  cfsetospeed(&options, B115200);
 
-	options.c_cflag |= (CLOCAL | CREAD); //Enable the receiver and set local mode
-	options.c_iflag = 0; //clear input options
-	options.c_lflag=0; //clear local options
-	options.c_oflag &= ~OPOST; //clear output options (raw output)
+  options.c_cflag |= (CLOCAL | CREAD); // Enable the receiver and set local mode
+  options.c_iflag = 0;                 // clear input options
+  options.c_lflag = 0;                 // clear local options
+  options.c_oflag &= ~OPOST;           // clear output options (raw output)
 
-	//Set the new options for the port
-    options.c_cc[VTIME] = 0;
-    options.c_cc[VMIN] = 1;
-	FlushInput();
-	tcsetattr(fd, TCSANOW, &options);
+  // Set the new options for the port
+  options.c_cc[VTIME] = 0;
+  options.c_cc[VMIN] = 1;
+  FlushInput();
+  tcsetattr(fd, TCSANOW, &options);
 }
 
-Unix_SerialPort::~Unix_SerialPort()
-{
-    close(fd);
+Unix_SerialPort::~Unix_SerialPort() { close(fd); }
+
+void Unix_SerialPort::SetBaudrate(int baudrate) {
+  // set port options
+  struct termios options;
+  // Get the current options for the port
+  tcgetattr(fd, &options);
+  // Set the baud rates to 115200
+
+  switch (baudrate) {
+  case 1200:
+    cfsetispeed(&options, B1200);
+    cfsetospeed(&options, B1200);
+    break;
+  case 2400:
+    cfsetispeed(&options, B2400);
+    cfsetospeed(&options, B2400);
+    break;
+  case 4800:
+    cfsetispeed(&options, B4800);
+    cfsetospeed(&options, B4800);
+    break;
+  case 9600:
+    cfsetispeed(&options, B9600);
+    cfsetospeed(&options, B9600);
+    break;
+  case 19200:
+    cfsetispeed(&options, B19200);
+    cfsetospeed(&options, B19200);
+    break;
+  case 38400:
+    cfsetispeed(&options, B38400);
+    cfsetospeed(&options, B38400);
+    break;
+  case 115200:
+    cfsetispeed(&options, B115200);
+    cfsetospeed(&options, B115200);
+    break;
+  case 460800:
+    cfsetispeed(&options, B460800);
+    cfsetospeed(&options, B460800);
+    break;
+  case 921600:
+    cfsetispeed(&options, B921600);
+    cfsetospeed(&options, B921600);
+    break;
+  default:
+    Err("unsupported baudrate\n");
+  }
+  tcsetattr(fd, TCSANOW, &options);
+  FlushInput();
 }
 
-void Unix_SerialPort::SetBaudrate(int baudrate)
-{
-    //set port options
-	struct termios options;
-	//Get the current options for the port
-	tcgetattr(fd, &options);
-	//Set the baud rates to 115200
+void Unix_SerialPort::SetRxTimeout(core::Time timeout_ns) {}
 
-	switch(baudrate)
-	{
-	    case 1200:
-            cfsetispeed(&options, B1200);
-            cfsetospeed(&options, B1200);
-            break;
-        case 2400:
-            cfsetispeed(&options, B2400);
-            cfsetospeed(&options, B2400);
-            break;
-        case 4800:
-            cfsetispeed(&options, B4800);
-            cfsetospeed(&options, B4800);
-            break;
-        case 9600:
-            cfsetispeed(&options, B9600);
-            cfsetospeed(&options, B9600);
-            break;
-        case 19200:
-            cfsetispeed(&options, B19200);
-            cfsetospeed(&options, B19200);
-            break;
-        case 38400:
-            cfsetispeed(&options, B38400);
-            cfsetospeed(&options, B38400);
-            break;
-        case 115200:
-            cfsetispeed(&options, B115200);
-            cfsetospeed(&options, B115200);
-            break;
-        case 460800:
-            cfsetispeed(&options, B460800);
-            cfsetospeed(&options, B460800);
-            break;
-        case 921600:
-            cfsetispeed(&options, B921600);
-            cfsetospeed(&options, B921600);
-            break;
-        default:
-            Err("unsupported baudrate\n");
-	}
-	tcsetattr(fd, TCSANOW, &options);
-	FlushInput();
+void Unix_SerialPort::FlushInput(void) { tcflush(fd, TCIFLUSH); }
 
+ssize_t Unix_SerialPort::Write(const void *buf, size_t nbyte) {
+  return write(fd, buf, nbyte);
 }
 
-void Unix_SerialPort::SetRxTimeout(core::Time timeout_ns)
-{
+ssize_t Unix_SerialPort::Read(void *buf, size_t nbyte) {
+  if (options.c_cc[VMIN] != nbyte) {
+    tcgetattr(fd, &options); // bug if not called?
+    options.c_cc[VTIME] = 0;
+    options.c_cc[VMIN] = nbyte;
+    tcsetattr(fd, TCSANOW, &options);
+  }
 
-}
-
-void Unix_SerialPort::FlushInput(void)
-{
-    tcflush(fd, TCIFLUSH);
-}
-
-ssize_t Unix_SerialPort::Write(const void *buf,size_t nbyte)
-{
-    return write(fd, buf, nbyte);
-}
-
-ssize_t Unix_SerialPort::Read(void *buf,size_t nbyte)
-{
-    if(options.c_cc[VMIN] != nbyte)
-    {
-        tcgetattr(fd, &options);//bug if not called?
-        options.c_cc[VTIME] = 0;
-        options.c_cc[VMIN] = nbyte;
-        tcsetattr(fd, TCSANOW, &options);
-    }
-
-    return read(fd, buf, nbyte);
+  return read(fd, buf, nbyte);
 }
 
 } // end namespace core
 } // end namespace flair
-
Index: trunk/lib/FlairCore/src/Unix_SerialPort.h
===================================================================
--- trunk/lib/FlairCore/src/Unix_SerialPort.h	(revision 14)
+++ trunk/lib/FlairCore/src/Unix_SerialPort.h	(revision 15)
@@ -17,82 +17,80 @@
 #include <termios.h> /* POSIX terminal control definitions */
 
-namespace flair
-{
-namespace core
-{
-    /*! \class RTDM_I2cPort
-    *
-    * \brief Class for unix serial port
-    *
-    */
-    class Unix_SerialPort: public SerialPort
-    {
+namespace flair {
+namespace core {
+/*! \class RTDM_I2cPort
+*
+* \brief Class for unix serial port
+*
+*/
+class Unix_SerialPort : public SerialPort {
 
-        public:
-            /*!
-            * \brief Constructor
-            *
-            * Construct an unix serial port, with the following default values: \n
-            * - 115200bps baudrate
-            *
-            * \param parent parent
-            * \param name name
-            * \param device serial device (ex rtser1)
-            */
-            Unix_SerialPort(const Object* parent,std::string port_name,std::string device);
+public:
+  /*!
+  * \brief Constructor
+  *
+  * Construct an unix serial port, with the following default values: \n
+  * - 115200bps baudrate
+  *
+  * \param parent parent
+  * \param name name
+  * \param device serial device (ex rtser1)
+  */
+  Unix_SerialPort(const Object *parent, std::string port_name,
+                  std::string device);
 
-            /*!
-            * \brief Destructor
-            *
-            */
-            ~Unix_SerialPort();
+  /*!
+  * \brief Destructor
+  *
+  */
+  ~Unix_SerialPort();
 
-            /*!
-            * \brief Set baudrate
-            *
-            * \param baudrate baudrate
-            *
-            */
-            void SetBaudrate(int baudrate);
+  /*!
+  * \brief Set baudrate
+  *
+  * \param baudrate baudrate
+  *
+  */
+  void SetBaudrate(int baudrate);
 
-            /*!
-            * \brief Set RX timeout
-            *
-            * Timeout for waiting datas.
-            *
-            * \param timeout_ns timeout in nano second
-            */
-            void SetRxTimeout(Time timeout_ns);
+  /*!
+  * \brief Set RX timeout
+  *
+  * Timeout for waiting datas.
+  *
+  * \param timeout_ns timeout in nano second
+  */
+  void SetRxTimeout(Time timeout_ns);
 
-            /*!
-            * \brief Write datas
-            *
-            * \param buf pointer to datas
-            * \param nbyte length of datas
-            *
-            * \return amount of written datas
-            */
-            ssize_t Write(const void *buf,size_t nbyte);
+  /*!
+  * \brief Write datas
+  *
+  * \param buf pointer to datas
+  * \param nbyte length of datas
+  *
+  * \return amount of written datas
+  */
+  ssize_t Write(const void *buf, size_t nbyte);
 
-            /*!
-            * \brief Read datas
-            *
-            * \param buf pointer to datas
-            * \param nbyte length of datas
-            *
-            * \return amount of read datas
-            */
-            ssize_t Read(void *buf,size_t nbyte);
+  /*!
+  * \brief Read datas
+  *
+  * \param buf pointer to datas
+  * \param nbyte length of datas
+  *
+  * \return amount of read datas
+  */
+  ssize_t Read(void *buf, size_t nbyte);
 
-            /*!
-            * \brief Flush input datas
-            *
-            */
-            void FlushInput(void);
+  /*!
+  * \brief Flush input datas
+  *
+  */
+  void FlushInput(void);
 
-        private:
-            int fd;
-            struct termios options;
-    };
+private:
+  int fd;
+  struct termios options;
+};
 } // end namespace core
 } // end namespace flair
Index: trunk/lib/FlairCore/src/Vector2D.cpp
===================================================================
--- trunk/lib/FlairCore/src/Vector2D.cpp	(revision 14)
+++ trunk/lib/FlairCore/src/Vector2D.cpp	(revision 15)
@@ -20,87 +20,85 @@
 #include <math.h>
 
-namespace flair { namespace core {
+namespace flair {
+namespace core {
 
-Vector2D::Vector2D(float inX,float inY): x(inX),y(inY) {
+Vector2D::Vector2D(float inX, float inY) : x(inX), y(inY) {}
+
+Vector2D::~Vector2D() {}
+
+Vector2D &Vector2D::operator=(const Vector2D &vector) {
+  x = vector.x;
+  y = vector.y;
+  return (*this);
 }
 
-Vector2D::~Vector2D() {
-
+Vector2D operator+(const Vector2D &vectorA, const Vector2D &vectorB) {
+  return Vector2D(vectorA.x + vectorB.x, vectorA.y + vectorB.y);
 }
 
-Vector2D &Vector2D::operator=(const Vector2D &vector) {
-    x=vector.x;
-    y=vector.y;
-    return (*this);
+Vector2D operator-(const Vector2D &vectorA, const Vector2D &vectorB) {
+  return Vector2D(vectorA.x - vectorB.x, vectorA.y - vectorB.y);
 }
 
-Vector2D operator+ (const Vector2D &vectorA,const Vector2D &vectorB) {
-    return Vector2D(vectorA.x + vectorB.x,vectorA.y + vectorB.y);
+Vector2D operator/(const Vector2D &vector, float coeff) {
+  if (coeff != 0) {
+    return Vector2D(vector.x / coeff, vector.y / coeff);
+  } else {
+    return Vector2D(0, 0);
+  }
 }
 
-Vector2D operator- (const Vector2D &vectorA,const Vector2D  &vectorB) {
-    return Vector2D(vectorA.x - vectorB.x,vectorA.y - vectorB.y);
+Vector2D operator*(const Vector2D &vector, float coeff) {
+  return Vector2D(vector.x * coeff, vector.y * coeff);
 }
 
-Vector2D operator/ (const Vector2D &vector, float coeff) {
-    if(coeff!=0) {
-        return Vector2D(vector.x/ coeff,vector.y/ coeff);
-    } else {
-        return Vector2D(0,0);
-    }
-}
-
-Vector2D operator * (const Vector2D &vector, float coeff) {
-    return Vector2D(vector.x * coeff,vector.y * coeff);
-}
-
-Vector2D operator * (float coeff,const Vector2D &vector) {
-    return Vector2D(vector.x * coeff,vector.y * coeff);
+Vector2D operator*(float coeff, const Vector2D &vector) {
+  return Vector2D(vector.x * coeff, vector.y * coeff);
 }
 
 void Vector2D::Rotate(float value) {
-    float xTmp;
-    xTmp=x*cosf(value)-y*sinf(value);
-    y=x*sinf(value)+y*cosf(value);
-    x=xTmp;
+  float xTmp;
+  xTmp = x * cosf(value) - y * sinf(value);
+  y = x * sinf(value) + y * cosf(value);
+  x = xTmp;
 }
 
-void Vector2D::RotateDeg(float value) {
-    Rotate(Euler::ToRadian(value));
+void Vector2D::RotateDeg(float value) { Rotate(Euler::ToRadian(value)); }
+
+float Vector2D::GetNorm(void) const { return sqrt(x * x + y * y); }
+
+void Vector2D::Normalize(void) {
+  float n = GetNorm();
+  if (n != 0) {
+    x = x / n;
+    y = y / n;
+  }
 }
 
-float Vector2D::GetNorm(void) const {
-    return sqrt(x*x+y*y);
+void Vector2D::Saturate(Vector2D min, Vector2D max) {
+  if (x < min.x)
+    x = min.x;
+  if (x > max.x)
+    x = max.x;
+
+  if (y < min.y)
+    y = min.y;
+  if (y > max.y)
+    y = max.y;
 }
 
-void Vector2D::Normalize(void) {
-    float n=GetNorm();
-    if(n!=0) {
-        x=x/n;
-        y=y/n;
-    }
-}
-
-void Vector2D::Saturate(Vector2D min,Vector2D max) {
-    if(x<min.x) x=min.x;
-    if(x>max.x) x=max.x;
-
-    if(y<min.y) y=min.y;
-    if(y>max.y) y=max.y;
-}
-
-void Vector2D::Saturate(float min,float max) {
-    Saturate(Vector2D(min,min),Vector2D(max,max));
+void Vector2D::Saturate(float min, float max) {
+  Saturate(Vector2D(min, min), Vector2D(max, max));
 }
 
 void Vector2D::Saturate(const Vector2D &value) {
-    float x=fabs(value.x);
-    float y=fabs(value.y);
-    Saturate(Vector2D(-x,-y),Vector2D(x,y));
+  float x = fabs(value.x);
+  float y = fabs(value.y);
+  Saturate(Vector2D(-x, -y), Vector2D(x, y));
 }
 
 void Vector2D::Saturate(float value) {
-    float sat=fabs(value);
-    Saturate(Vector2D(-sat,-sat),Vector2D(sat,sat));
+  float sat = fabs(value);
+  Saturate(Vector2D(-sat, -sat), Vector2D(sat, sat));
 }
 
Index: trunk/lib/FlairCore/src/Vector2D.h
===================================================================
--- trunk/lib/FlairCore/src/Vector2D.h	(revision 14)
+++ trunk/lib/FlairCore/src/Vector2D.h	(revision 15)
@@ -14,153 +14,153 @@
 #define VECTOR2D_H
 
-namespace flair { namespace core {
+namespace flair {
+namespace core {
 
-    /*! \class Vector2D
-    *
-    * \brief Class defining a 2D vector
-    */
-    class Vector2D {
-        public:
-            /*!
-            * \brief Constructor
-            *
-            * Construct a Vector2D using specified values.
-            *
-            * \param x
-            * \param y
-            */
-            Vector2D(float x=0,float y=0);
+/*! \class Vector2D
+*
+* \brief Class defining a 2D vector
+*/
+class Vector2D {
+public:
+  /*!
+  * \brief Constructor
+  *
+  * Construct a Vector2D using specified values.
+  *
+  * \param x
+  * \param y
+  */
+  Vector2D(float x = 0, float y = 0);
 
-            /*!
-            * \brief Destructor
-            *
-            */
-            ~Vector2D();
+  /*!
+  * \brief Destructor
+  *
+  */
+  ~Vector2D();
 
-            /*!
-            * \brief Rotation
-            *
-            * \param value rotation value in radians
-            */
-            void Rotate(float value);
+  /*!
+  * \brief Rotation
+  *
+  * \param value rotation value in radians
+  */
+  void Rotate(float value);
 
-            /*!
-            * \brief Rotation
-            *
-            * \param value rotation value in degrees
-            */
-            void RotateDeg(float value);
+  /*!
+  * \brief Rotation
+  *
+  * \param value rotation value in degrees
+  */
+  void RotateDeg(float value);
 
-            /*!
-            * \brief Norm
-            *
-            * \return value
-            */
-            float GetNorm(void) const;
+  /*!
+  * \brief Norm
+  *
+  * \return value
+  */
+  float GetNorm(void) const;
 
-            /*!
-            * \brief Normalize
-            */
-            void Normalize(void);
+  /*!
+  * \brief Normalize
+  */
+  void Normalize(void);
 
-            /*!
-            * \brief Saturate
-            *
-            * Saturate between min and max
-            *
-            * \param min minimum Vector2D value
-            * \param max maximum Vector2D value
-            */
-            void Saturate(Vector2D min,Vector2D max);
+  /*!
+  * \brief Saturate
+  *
+  * Saturate between min and max
+  *
+  * \param min minimum Vector2D value
+  * \param max maximum Vector2D value
+  */
+  void Saturate(Vector2D min, Vector2D max);
 
-            /*!
-            * \brief Saturate
-            *
-            * Saturate between min and max
-            *
-            * \param min minimum Vector2D(min,min) value
-            * \param max maximum Vector2D(max,max) value
-            */
-            void Saturate(float min,float max);
+  /*!
+  * \brief Saturate
+  *
+  * Saturate between min and max
+  *
+  * \param min minimum Vector2D(min,min) value
+  * \param max maximum Vector2D(max,max) value
+  */
+  void Saturate(float min, float max);
 
-            /*!
-            * \brief Saturate
-            *
-            * Saturate between -abs(value) and abs(value)
-            *
-            * \param value saturation Vector2D value
-            */
-            void Saturate(const Vector2D &value);
+  /*!
+  * \brief Saturate
+  *
+  * Saturate between -abs(value) and abs(value)
+  *
+  * \param value saturation Vector2D value
+  */
+  void Saturate(const Vector2D &value);
 
-            /*!
-            * \brief Saturate
-            *
-            * Saturate between -abs(Vector2D(value,value)) and abs(Vector2D(value,value))
-            *
-            * \param value saturation Vector2D(value,value)
-            */
-            void Saturate(float value);
+  /*!
+  * \brief Saturate
+  *
+  * Saturate between -abs(Vector2D(value,value)) and abs(Vector2D(value,value))
+  *
+  * \param value saturation Vector2D(value,value)
+  */
+  void Saturate(float value);
 
+  /*!
+  * \brief x
+  */
+  float x;
 
-            /*!
-            * \brief x
-            */
-            float x;
+  /*!
+  * \brief y
+  */
+  float y;
 
-            /*!
-            * \brief y
-            */
-            float y;
+  Vector2D &operator=(const Vector2D &vector);
+};
 
-            Vector2D &operator=(const Vector2D &vector);
-    };
+/*! Add
+*
+* \brief Add
+*
+* \param vectorA vector
+* \param vectorB vector
+*/
+Vector2D operator+(const Vector2D &vectorA, const Vector2D &vectorB);
 
-    /*! Add
-    *
-    * \brief Add
-    *
-    * \param vectorA vector
-    * \param vectorB vector
-    */
-    Vector2D operator + (const Vector2D &vectorA,const Vector2D &vectorB);
+/*! Substract
+*
+* \brief Substract
+*
+* \param vectorA vector
+* \param vectorB vector
+*/
+Vector2D operator-(const Vector2D &vectorA, const Vector2D &vectorB);
 
-    /*! Substract
-    *
-    * \brief Substract
-    *
-    * \param vectorA vector
-    * \param vectorB vector
-    */
-    Vector2D operator - (const Vector2D &vectorA,const Vector2D &vectorB);
+/*! Divid
+*
+* \brief Divid
+*
+* \param vector vector
+* \param coeff coefficent
+* \return vector/coefficient
+*/
+Vector2D operator/(const Vector2D &vector, float coeff);
 
-    /*! Divid
-    *
-    * \brief Divid
-    *
-    * \param vector vector
-    * \param coeff coefficent
-    * \return vector/coefficient
-    */
-    Vector2D operator / (const Vector2D &vector, float coeff);
+/*! Multiply
+*
+* \brief Multiplyf
+*
+* \param vector vector
+* \param coeff coefficent
+* \return coefficient*vector
+*/
+Vector2D operator*(const Vector2D &vector, float coeff);
 
-    /*! Multiply
-    *
-    * \brief Multiplyf
-    *
-    * \param vector vector
-    * \param coeff coefficent
-    * \return coefficient*vector
-    */
-    Vector2D operator * (const Vector2D &vector, float coeff);
-
-    /*! Multiply
-    *
-    * \brief Multiply
-    *
-    * \param coeff coefficent
-    * \param vector vector
-    * \return coefficient*vector
-    */
-    Vector2D operator * (float coeff,const Vector2D &vector);
+/*! Multiply
+*
+* \brief Multiply
+*
+* \param coeff coefficent
+* \param vector vector
+* \return coefficient*vector
+*/
+Vector2D operator*(float coeff, const Vector2D &vector);
 
 } // end namespace core
Index: trunk/lib/FlairCore/src/Vector3D.cpp
===================================================================
--- trunk/lib/FlairCore/src/Vector3D.cpp	(revision 14)
+++ trunk/lib/FlairCore/src/Vector3D.cpp	(revision 15)
@@ -25,12 +25,10 @@
 //#include "Vector3DSpinBox.h"
 
-namespace flair { namespace core {
-
-Vector3D::Vector3D(float inX,float inY,float inZ): x(inX),y(inY),z(inZ){
-}
-
-Vector3D::~Vector3D() {
-
-}
+namespace flair {
+namespace core {
+
+Vector3D::Vector3D(float inX, float inY, float inZ) : x(inX), y(inY), z(inZ) {}
+
+Vector3D::~Vector3D() {}
 /*
 void Vector3D::operator=(const gui::Vector3DSpinBox *vector) {
@@ -42,208 +40,197 @@
 
 Vector3D &Vector3D::operator=(const Vector3D &vector) {
-    x=vector.x;
-    y=vector.y;
-    z=vector.z;
-    return (*this);
+  x = vector.x;
+  y = vector.y;
+  z = vector.z;
+  return (*this);
 }
 
 Vector3D &Vector3D::operator+=(const Vector3D &vector) {
-    x+=vector.x;
-    y+=vector.y;
-    z+=vector.z;
-    return (*this);
+  x += vector.x;
+  y += vector.y;
+  z += vector.z;
+  return (*this);
 }
 
 Vector3D &Vector3D::operator-=(const Vector3D &vector) {
-    x-=vector.x;
-    y-=vector.y;
-    z-=vector.z;
-    return (*this);
+  x -= vector.x;
+  y -= vector.y;
+  z -= vector.z;
+  return (*this);
 }
 
 float &Vector3D::operator[](size_t idx) {
-    if(idx==0) {
-        return x;
-    } else if(idx==1) {
-        return y;
-    } else if(idx==2) {
-        return z;
-    } else {
-        Printf("Vector3D: index %i out of bound\n",idx);
-        return z;
+  if (idx == 0) {
+    return x;
+  } else if (idx == 1) {
+    return y;
+  } else if (idx == 2) {
+    return z;
+  } else {
+    Printf("Vector3D: index %i out of bound\n", idx);
+    return z;
+  }
+}
+
+const float &Vector3D::operator[](size_t idx) const {
+  if (idx == 0) {
+    return x;
+  } else if (idx == 1) {
+    return y;
+  } else if (idx == 2) {
+    return z;
+  } else {
+    Printf("Vector3D: index %i out of bound\n", idx);
+    return z;
+  }
+}
+
+Vector3D CrossProduct(const Vector3D &vectorA, const Vector3D &vectorB) {
+  return Vector3D(vectorA.y * vectorB.z - vectorA.z * vectorB.y,
+                  vectorA.z * vectorB.x - vectorA.x * vectorB.z,
+                  vectorA.x * vectorB.y - vectorA.y * vectorB.x);
+}
+
+float DotProduct(const Vector3D &vectorA, const Vector3D &vectorB) {
+  return vectorA.x * vectorB.x + vectorA.y * vectorB.y + vectorA.z * vectorB.z;
+}
+
+Vector3D operator+(const Vector3D &vectorA, const Vector3D &vectorB) {
+  return Vector3D(vectorA.x + vectorB.x, vectorA.y + vectorB.y,
+                  vectorA.z + vectorB.z);
+}
+
+Vector3D operator-(const Vector3D &vectorA, const Vector3D &vectorB) {
+  return Vector3D(vectorA.x - vectorB.x, vectorA.y - vectorB.y,
+                  vectorA.z - vectorB.z);
+}
+
+Vector3D operator-(const Vector3D &vector) {
+  return Vector3D(-vector.x, -vector.y, -vector.z);
+}
+
+Vector3D operator*(const Vector3D &vectorA, const Vector3D &vectorB) {
+  return Vector3D(vectorA.x * vectorB.x, vectorA.y * vectorB.y,
+                  vectorA.z * vectorB.z);
+}
+
+Vector3D operator*(const Vector3D &vector, float coeff) {
+  return Vector3D(vector.x * coeff, vector.y * coeff, vector.z * coeff);
+}
+
+Vector3D operator*(float coeff, const Vector3D &vector) {
+  return Vector3D(vector.x * coeff, vector.y * coeff, vector.z * coeff);
+}
+
+Vector3D operator/(const Vector3D &vector, float coeff) {
+  if (coeff != 0) {
+    return Vector3D(vector.x / coeff, vector.y / coeff, vector.z / coeff);
+  } else {
+    printf("Vector3D: err divinding by 0\n");
+    return Vector3D(0, 0, 0);
+  }
+}
+
+void Vector3D::RotateX(float value) {
+  float y_tmp;
+  y_tmp = y * cosf(value) - z * sinf(value);
+  z = y * sinf(value) + z * cosf(value);
+  y = y_tmp;
+}
+
+void Vector3D::RotateXDeg(float value) { RotateX(Euler::ToRadian(value)); }
+
+void Vector3D::RotateY(float value) {
+  float x_tmp;
+  x_tmp = x * cosf(value) + z * sinf(value);
+  z = -x * sinf(value) + z * cosf(value);
+  x = x_tmp;
+}
+
+void Vector3D::RotateYDeg(float value) { RotateY(Euler::ToRadian(value)); }
+
+void Vector3D::RotateZ(float value) {
+  float x_tmp;
+  x_tmp = x * cosf(value) - y * sinf(value);
+  y = x * sinf(value) + y * cosf(value);
+  x = x_tmp;
+}
+
+void Vector3D::RotateZDeg(float value) { RotateZ(Euler::ToRadian(value)); }
+
+void Vector3D::Rotate(const RotationMatrix &matrix) {
+  float a[3] = {0, 0, 0};
+  float b[3] = {x, y, z};
+
+  for (int i = 0; i < 3; i++) {
+    for (int j = 0; j < 3; j++) {
+      a[i] += matrix.m[i][j] * b[j];
     }
-}
-
-const float &Vector3D::operator[](size_t idx) const {
-    if(idx==0) {
-        return x;
-    } else if(idx==1) {
-        return y;
-    } else if(idx==2) {
-        return z;
-    } else {
-        Printf("Vector3D: index %i out of bound\n",idx);
-        return z;
-    }
-}
-
-Vector3D CrossProduct(const Vector3D &vectorA,const Vector3D &vectorB) {
-    return Vector3D(vectorA.y*vectorB.z - vectorA.z*vectorB.y,
-                    vectorA.z*vectorB.x - vectorA.x*vectorB.z,
-                    vectorA.x*vectorB.y - vectorA.y*vectorB.x);
-}
-
-float DotProduct(const Vector3D &vectorA,const Vector3D &vectorB) {
-    return vectorA.x*vectorB.x + vectorA.y*vectorB.y+ vectorA.z*vectorB.z;
-}
-
-Vector3D operator+ (const Vector3D &vectorA,const Vector3D &vectorB) {
-    return Vector3D(vectorA.x + vectorB.x,
-                    vectorA.y + vectorB.y,
-                    vectorA.z + vectorB.z);
-}
-
-Vector3D operator- (const Vector3D &vectorA,const Vector3D &vectorB) {
-    return Vector3D(vectorA.x - vectorB.x,
-                    vectorA.y - vectorB.y,
-                    vectorA.z - vectorB.z);
-}
-
-Vector3D operator-(const Vector3D &vector) {
-    return Vector3D(-vector.x,-vector.y,-vector.z);
-}
-
-Vector3D operator * (const Vector3D &vectorA,const Vector3D &vectorB) {
-    return Vector3D(vectorA.x* vectorB.x,
-                    vectorA.y* vectorB.y,
-                    vectorA.z* vectorB.z);
-}
-
-Vector3D operator * (const Vector3D &vector, float coeff) {
-    return Vector3D(vector.x* coeff,
-                    vector.y* coeff,
-                    vector.z* coeff);
-}
-
-Vector3D operator * (float coeff,const Vector3D &vector) {
-    return Vector3D(vector.x* coeff,
-                    vector.y* coeff,
-                    vector.z* coeff);
-}
-
-Vector3D operator/ (const Vector3D &vector, float coeff) {
-    if(coeff!=0) {
-        return Vector3D(vector.x/ coeff,
-                        vector.y/ coeff,
-                        vector.z/ coeff);
-    } else {
-        printf("Vector3D: err divinding by 0\n");
-        return Vector3D(0,0,0);
-    }
-}
-
-void Vector3D::RotateX(float value) {
-    float y_tmp;
-    y_tmp=y*cosf(value)-z*sinf(value);
-    z=y*sinf(value)+z*cosf(value);
-    y=y_tmp;
-}
-
-void Vector3D::RotateXDeg(float value) {
-    RotateX(Euler::ToRadian(value));
-}
-
-void Vector3D::RotateY(float value) {
-    float x_tmp;
-    x_tmp=x*cosf(value)+z*sinf(value);
-    z=-x*sinf(value)+z*cosf(value);
-    x=x_tmp;
-}
-
-void Vector3D::RotateYDeg(float value) {
-    RotateY(Euler::ToRadian(value));
-}
-
-void Vector3D::RotateZ(float value) {
-    float x_tmp;
-    x_tmp=x*cosf(value)-y*sinf(value);
-    y=x*sinf(value)+y*cosf(value);
-    x=x_tmp;
-}
-
-void Vector3D::RotateZDeg(float value) {
-    RotateZ(Euler::ToRadian(value));
-}
-
-void Vector3D::Rotate(const RotationMatrix &matrix) {
-    float a[3]= {0,0,0};
-    float b[3]= {x,y,z};
-
-    for(int i=0; i<3; i++) {
-        for(int j=0; j<3; j++) {
-            a[i]+=matrix.m[i][j]*b[j];
-        }
-    }
-
-    x=a[0];
-    y=a[1];
-    z=a[2];
+  }
+
+  x = a[0];
+  y = a[1];
+  z = a[2];
 }
 
 void Vector3D::Rotate(const Quaternion &quaternion) {
-    RotationMatrix matrix;
-    quaternion.ToRotationMatrix(matrix);
-    Rotate(matrix);
+  RotationMatrix matrix;
+  quaternion.ToRotationMatrix(matrix);
+  Rotate(matrix);
 }
 
 void Vector3D::To2Dxy(Vector2D &vector) const {
-    vector.x=x;
-    vector.y=y;
+  vector.x = x;
+  vector.y = y;
 }
 
 Vector2D Vector3D::To2Dxy(void) const {
-    Vector2D vect;
-    To2Dxy(vect);
-    return vect;
-}
-
-float Vector3D::GetNorm(void) const {
-    return sqrt(x*x+y*y+z*z);
-}
+  Vector2D vect;
+  To2Dxy(vect);
+  return vect;
+}
+
+float Vector3D::GetNorm(void) const { return sqrt(x * x + y * y + z * z); }
 
 void Vector3D::Normalize(void) {
-    float n=GetNorm();
-    if(n!=0) {
-        x=x/n;
-        y=y/n;
-        z=z/n;
-    }
-}
-
-void Vector3D::Saturate(const Vector3D &min,const Vector3D &max) {
-    if(x<min.x) x=min.x;
-    if(x>max.x) x=max.x;
-
-    if(y<min.y) y=min.y;
-    if(y>max.y) y=max.y;
-
-    if(z<min.z) z=min.z;
-    if(z>max.z) z=max.z;
-}
-
-void Vector3D::Saturate(float min,float max) {
-    Saturate(Vector3D(min,min,min),Vector3D(max,max,max));
+  float n = GetNorm();
+  if (n != 0) {
+    x = x / n;
+    y = y / n;
+    z = z / n;
+  }
+}
+
+void Vector3D::Saturate(const Vector3D &min, const Vector3D &max) {
+  if (x < min.x)
+    x = min.x;
+  if (x > max.x)
+    x = max.x;
+
+  if (y < min.y)
+    y = min.y;
+  if (y > max.y)
+    y = max.y;
+
+  if (z < min.z)
+    z = min.z;
+  if (z > max.z)
+    z = max.z;
+}
+
+void Vector3D::Saturate(float min, float max) {
+  Saturate(Vector3D(min, min, min), Vector3D(max, max, max));
 }
 
 void Vector3D::Saturate(const Vector3D &value) {
-    float x=fabs(value.x);
-    float y=fabs(value.y);
-    float z=fabs(value.z);
-    Saturate(Vector3D(-x,-y,-z),Vector3D(x,y,z));
+  float x = fabs(value.x);
+  float y = fabs(value.y);
+  float z = fabs(value.z);
+  Saturate(Vector3D(-x, -y, -z), Vector3D(x, y, z));
 }
 
 void Vector3D::Saturate(float value) {
-    float sat=fabs(value);
-    Saturate(Vector3D(-sat,-sat,-sat),Vector3D(sat,sat,sat));
+  float sat = fabs(value);
+  Saturate(Vector3D(-sat, -sat, -sat), Vector3D(sat, sat, sat));
 }
 
Index: trunk/lib/FlairCore/src/Vector3D.h
===================================================================
--- trunk/lib/FlairCore/src/Vector3D.h	(revision 14)
+++ trunk/lib/FlairCore/src/Vector3D.h	(revision 15)
@@ -16,281 +16,282 @@
 #include <stddef.h>
 
-namespace flair { namespace core {
-    class Vector2D;
-    class RotationMatrix;
-    class Quaternion;
-
-    /*! \class Vector3D
-    *
-    * \brief Class defining a 3D vector
-    */
-    class Vector3D {
-        public:
-            /*!
-            * \brief Constructor
-            *
-            * Construct a Vector3D using specified values.
-            *
-            * \param x
-            * \param y
-            * \param z
-            */
-            Vector3D(float x=0,float y=0,float z=0);
-
-            /*!
-            * \brief Destructor
-            *
-            */
-            ~Vector3D();
-
-            /*!
-            * \brief x
-            */
-            float x;
-
-            /*!
-            * \brief y
-            */
-            float y;
-
-            /*!
-            * \brief z
-            */
-            float z;
-
-            /*!
-            * \brief x axis rotation
-            *
-            * \param value rotation value in radians
-            */
-            void RotateX(float value);
-
-            /*!
-            * \brief x axis rotation
-            *
-            * \param value rotation value in degrees
-            */
-            void RotateXDeg(float value);
-
-            /*!
-            * \brief y axis rotation
-            *
-            * \param value rotation value in radians
-            */
-            void RotateY(float value);
-
-            /*!
-            * \brief y axis rotation
-            *
-            * \param value rotation value in degrees
-            */
-            void RotateYDeg(float value);
-
-            /*!
-            * \brief z axis rotation
-            *
-            * \param value rotation value in radians
-            */
-            void RotateZ(float value);
-
-            /*!
-            * \brief z axis rotation
-            *
-            * \param value rotation value in degrees
-            */
-            void RotateZDeg(float value);
-
-            /*!
-            * \brief rotation
-            *
-            * \param matrix rotation matrix
-            */
-            void Rotate(const RotationMatrix &matrix);
-
-            /*!
-            * \brief rotation
-            *
-            * Compute a rotation from a quaternion. This method uses a rotation matrix
-            * internaly.
-            *
-            * \param quaternion quaternion
-            */
-            void Rotate(const Quaternion &quaternion);
-
-            /*!
-            * \brief Convert to a Vector2D
-            *
-            * Uses x and y coordinates.
-            *
-            * \param vector destination
-            */
-            void To2Dxy(Vector2D &vector) const;
-
-            /*!
-            * \brief Convert to a Vector2D
-            *
-            * Uses x and y coordinates.
-            *
-            * \return destination
-            */
-            Vector2D To2Dxy(void) const;
-
-            /*!
-            * \brief Norm
-            *
-            * \return value
-            */
-            float GetNorm(void) const;
-
-            /*!
-            * \brief Normalize
-            */
-            void Normalize(void);
-
-            /*!
-            * \brief Saturate
-            *
-            * Saturate between min and max
-            *
-            * \param min minimum value
-            * \param max maximum value
-            */
-            void Saturate(const Vector3D &min,const Vector3D &max);
-
-            /*!
-            * \brief Saturate
-            *
-            * Saturate between min and max
-            *
-            * \param min minimum Vector3D(min,min,min) value
-            * \param max maximum Vector3D(max,max,max) value
-            */
-            void Saturate(float min,float max);
-
-            /*!
-            * \brief Saturate
-            *
-            * Saturate between -abs(value) and abs(value)
-            *
-            * \param value saturation Vector3D value
-            */
-            void Saturate(const Vector3D &value);
-
-            /*!
-            * \brief Saturate
-            *
-            * Saturate between -abs(Vector3D(value,value,value)) and abs(Vector3D(value,value,value))
-            *
-            * \param value saturation Vector3D(value,value,value)
-            */
-            void Saturate(float value);
-
-            float &operator[](size_t idx);
-            const float &operator[](size_t idx) const;
-            Vector3D &operator=(const Vector3D& vector);
-            Vector3D &operator+=(const Vector3D& vector);
-            Vector3D &operator-=(const Vector3D& vector);
-
-        private:
-
-    };
-
-    /*! Add
-    *
-    * \brief Add
-    *
-    * \param vectorA vector
-    * \param vectorB vector
-    *
-    * \return vectorA+vectorB
-    */
-    Vector3D operator + (const Vector3D &vectorA,const Vector3D &vectorB);
-
-    /*! Substract
-    *
-    * \brief Substract
-    *
-    * \param vectorA vector
-    * \param vectorB vector
-    *
-    * \return vectorA-vectorB
-    */
-    Vector3D operator - (const Vector3D &vectorA,const Vector3D &vectorB);
-
-    /*! Minus
-    *
-    * \brief Minus
-    *
-    * \param vector vector
-    *
-    * \return -vector
-    */
-    Vector3D operator-(const Vector3D &vector);
-
-    /*! Divid
-    *
-    * \brief Divid
-    *
-    * \param vector vector
-    * \param coeff coefficent
-    *
-    * \return vector/coefficient
-    */
-    Vector3D operator / (const Vector3D &vector, float coeff);
-
-    /*! Hadamard product
-    *
-    * \brief Hadamard product
-    *
-    * \param vectorA vector
-    * \param vectorBA vector
-    *
-    * \return Hadamard product
-    */
-    Vector3D operator * (const Vector3D &vectorA, const Vector3D &vectorB);
-
-    /*! Multiply
-    *
-    * \brief Multiply
-    *
-    * \param vector vector
-    * \param coeff coefficent
-    *
-    * \return coefficient*vector
-    */
-    Vector3D operator * (const Vector3D &vector, float coeff);
-
-    /*! Multiply
-    *
-    * \brief Multiply
-    *
-    * \param coeff coefficent
-    * \param vector vector
-    *
-    * \return coefficient*vector
-    */
-    Vector3D operator * (float coeff, const Vector3D &vector);
-
-    /*! Cross product
-    *
-    * \brief Cross product
-    *
-    * \param vectorA first vector
-    * \param vectorB second vector
-    *
-    * \return cross product
-    */
-    Vector3D CrossProduct(const Vector3D &vectorA, const Vector3D &vectorB);
-
-    /*! Dot product
-    *
-    * \brief Dot product
-    *
-    * \param vectorA first vector
-    * \param vectorB second vector
-    *
-    * \return dot product
-    */
-    float DotProduct(const Vector3D &vectorA, const Vector3D &vectorB);
+namespace flair {
+namespace core {
+class Vector2D;
+class RotationMatrix;
+class Quaternion;
+
+/*! \class Vector3D
+*
+* \brief Class defining a 3D vector
+*/
+class Vector3D {
+public:
+  /*!
+  * \brief Constructor
+  *
+  * Construct a Vector3D using specified values.
+  *
+  * \param x
+  * \param y
+  * \param z
+  */
+  Vector3D(float x = 0, float y = 0, float z = 0);
+
+  /*!
+  * \brief Destructor
+  *
+  */
+  ~Vector3D();
+
+  /*!
+  * \brief x
+  */
+  float x;
+
+  /*!
+  * \brief y
+  */
+  float y;
+
+  /*!
+  * \brief z
+  */
+  float z;
+
+  /*!
+  * \brief x axis rotation
+  *
+  * \param value rotation value in radians
+  */
+  void RotateX(float value);
+
+  /*!
+  * \brief x axis rotation
+  *
+  * \param value rotation value in degrees
+  */
+  void RotateXDeg(float value);
+
+  /*!
+  * \brief y axis rotation
+  *
+  * \param value rotation value in radians
+  */
+  void RotateY(float value);
+
+  /*!
+  * \brief y axis rotation
+  *
+  * \param value rotation value in degrees
+  */
+  void RotateYDeg(float value);
+
+  /*!
+  * \brief z axis rotation
+  *
+  * \param value rotation value in radians
+  */
+  void RotateZ(float value);
+
+  /*!
+  * \brief z axis rotation
+  *
+  * \param value rotation value in degrees
+  */
+  void RotateZDeg(float value);
+
+  /*!
+  * \brief rotation
+  *
+  * \param matrix rotation matrix
+  */
+  void Rotate(const RotationMatrix &matrix);
+
+  /*!
+  * \brief rotation
+  *
+  * Compute a rotation from a quaternion. This method uses a rotation matrix
+  * internaly.
+  *
+  * \param quaternion quaternion
+  */
+  void Rotate(const Quaternion &quaternion);
+
+  /*!
+  * \brief Convert to a Vector2D
+  *
+  * Uses x and y coordinates.
+  *
+  * \param vector destination
+  */
+  void To2Dxy(Vector2D &vector) const;
+
+  /*!
+  * \brief Convert to a Vector2D
+  *
+  * Uses x and y coordinates.
+  *
+  * \return destination
+  */
+  Vector2D To2Dxy(void) const;
+
+  /*!
+  * \brief Norm
+  *
+  * \return value
+  */
+  float GetNorm(void) const;
+
+  /*!
+  * \brief Normalize
+  */
+  void Normalize(void);
+
+  /*!
+  * \brief Saturate
+  *
+  * Saturate between min and max
+  *
+  * \param min minimum value
+  * \param max maximum value
+  */
+  void Saturate(const Vector3D &min, const Vector3D &max);
+
+  /*!
+  * \brief Saturate
+  *
+  * Saturate between min and max
+  *
+  * \param min minimum Vector3D(min,min,min) value
+  * \param max maximum Vector3D(max,max,max) value
+  */
+  void Saturate(float min, float max);
+
+  /*!
+  * \brief Saturate
+  *
+  * Saturate between -abs(value) and abs(value)
+  *
+  * \param value saturation Vector3D value
+  */
+  void Saturate(const Vector3D &value);
+
+  /*!
+  * \brief Saturate
+  *
+  * Saturate between -abs(Vector3D(value,value,value)) and
+  *abs(Vector3D(value,value,value))
+  *
+  * \param value saturation Vector3D(value,value,value)
+  */
+  void Saturate(float value);
+
+  float &operator[](size_t idx);
+  const float &operator[](size_t idx) const;
+  Vector3D &operator=(const Vector3D &vector);
+  Vector3D &operator+=(const Vector3D &vector);
+  Vector3D &operator-=(const Vector3D &vector);
+
+private:
+};
+
+/*! Add
+*
+* \brief Add
+*
+* \param vectorA vector
+* \param vectorB vector
+*
+* \return vectorA+vectorB
+*/
+Vector3D operator+(const Vector3D &vectorA, const Vector3D &vectorB);
+
+/*! Substract
+*
+* \brief Substract
+*
+* \param vectorA vector
+* \param vectorB vector
+*
+* \return vectorA-vectorB
+*/
+Vector3D operator-(const Vector3D &vectorA, const Vector3D &vectorB);
+
+/*! Minus
+*
+* \brief Minus
+*
+* \param vector vector
+*
+* \return -vector
+*/
+Vector3D operator-(const Vector3D &vector);
+
+/*! Divid
+*
+* \brief Divid
+*
+* \param vector vector
+* \param coeff coefficent
+*
+* \return vector/coefficient
+*/
+Vector3D operator/(const Vector3D &vector, float coeff);
+
+/*! Hadamard product
+*
+* \brief Hadamard product
+*
+* \param vectorA vector
+* \param vectorBA vector
+*
+* \return Hadamard product
+*/
+Vector3D operator*(const Vector3D &vectorA, const Vector3D &vectorB);
+
+/*! Multiply
+*
+* \brief Multiply
+*
+* \param vector vector
+* \param coeff coefficent
+*
+* \return coefficient*vector
+*/
+Vector3D operator*(const Vector3D &vector, float coeff);
+
+/*! Multiply
+*
+* \brief Multiply
+*
+* \param coeff coefficent
+* \param vector vector
+*
+* \return coefficient*vector
+*/
+Vector3D operator*(float coeff, const Vector3D &vector);
+
+/*! Cross product
+*
+* \brief Cross product
+*
+* \param vectorA first vector
+* \param vectorB second vector
+*
+* \return cross product
+*/
+Vector3D CrossProduct(const Vector3D &vectorA, const Vector3D &vectorB);
+
+/*! Dot product
+*
+* \brief Dot product
+*
+* \param vectorA first vector
+* \param vectorB second vector
+*
+* \return dot product
+*/
+float DotProduct(const Vector3D &vectorA, const Vector3D &vectorB);
 
 } // end namespace core
Index: trunk/lib/FlairCore/src/Vector3DSpinBox.cpp
===================================================================
--- trunk/lib/FlairCore/src/Vector3DSpinBox.cpp	(revision 14)
+++ trunk/lib/FlairCore/src/Vector3DSpinBox.cpp	(revision 15)
@@ -11,5 +11,6 @@
 //  version:    $Id: $
 //
-//  purpose:    Class displaying 3 QDoubleSpinBox for x,y,z on the ground station
+//  purpose:    Class displaying 3 QDoubleSpinBox for x,y,z on the ground
+//  station
 //
 //
@@ -20,28 +21,30 @@
 using std::string;
 
-namespace flair { namespace gui {
+namespace flair {
+namespace gui {
 
-Vector3DSpinBox::Vector3DSpinBox(const LayoutPosition* position,string name,double min,double max,double step,int decimals,core::Vector3D default_value):Box(position,name,"Vector3DSpinBox") {
-    //update value from xml file
-    default_value.Saturate(min,max);
-    box_value=default_value;
+Vector3DSpinBox::Vector3DSpinBox(const LayoutPosition *position, string name,
+                                 double min, double max, double step,
+                                 int decimals, core::Vector3D default_value)
+    : Box(position, name, "Vector3DSpinBox") {
+  // update value from xml file
+  default_value.Saturate(min, max);
+  box_value = default_value;
 
-    SetVolatileXmlProp("min",min);
-    SetVolatileXmlProp("max",max);
-    SetVolatileXmlProp("step",step);
-    SetVolatileXmlProp("decimals",decimals);
-    GetPersistentXmlProp("value_x",box_value.x);
-    SetPersistentXmlProp("value_x",box_value.x);
-    GetPersistentXmlProp("value_y",box_value.y);
-    SetPersistentXmlProp("value_y",box_value.y);
-    GetPersistentXmlProp("value_z",box_value.z);
-    SetPersistentXmlProp("value_z",box_value.z);
+  SetVolatileXmlProp("min", min);
+  SetVolatileXmlProp("max", max);
+  SetVolatileXmlProp("step", step);
+  SetVolatileXmlProp("decimals", decimals);
+  GetPersistentXmlProp("value_x", box_value.x);
+  SetPersistentXmlProp("value_x", box_value.x);
+  GetPersistentXmlProp("value_y", box_value.y);
+  SetPersistentXmlProp("value_y", box_value.y);
+  GetPersistentXmlProp("value_z", box_value.z);
+  SetPersistentXmlProp("value_z", box_value.z);
 
-    SendXml();
+  SendXml();
 }
 
-Vector3DSpinBox::~Vector3DSpinBox() {
-
-}
+Vector3DSpinBox::~Vector3DSpinBox() {}
 /*
 Vector3DSpinBox::operator core::Vector3D() const {
@@ -50,21 +53,25 @@
 */
 core::Vector3D Vector3DSpinBox::Value(void) const {
-    core::Vector3D tmp;
+  core::Vector3D tmp;
 
-    GetMutex();
-    tmp=box_value;
-    ReleaseMutex();
+  GetMutex();
+  tmp = box_value;
+  ReleaseMutex();
 
-    return tmp;
+  return tmp;
 }
 
 void Vector3DSpinBox::XmlEvent(void) {
-    bool changed=false;
-    GetMutex();
-    if(GetPersistentXmlProp("value_x",box_value.x)) changed=true;
-    if(GetPersistentXmlProp("value_y",box_value.y)) changed=true;
-    if(GetPersistentXmlProp("value_z",box_value.z)) changed=true;
-    if(changed) SetValueChanged();
-    ReleaseMutex();
+  bool changed = false;
+  GetMutex();
+  if (GetPersistentXmlProp("value_x", box_value.x))
+    changed = true;
+  if (GetPersistentXmlProp("value_y", box_value.y))
+    changed = true;
+  if (GetPersistentXmlProp("value_z", box_value.z))
+    changed = true;
+  if (changed)
+    SetValueChanged();
+  ReleaseMutex();
 }
 
Index: trunk/lib/FlairCore/src/Vector3DSpinBox.h
===================================================================
--- trunk/lib/FlairCore/src/Vector3DSpinBox.h	(revision 14)
+++ trunk/lib/FlairCore/src/Vector3DSpinBox.h	(revision 15)
@@ -17,54 +17,57 @@
 #include <Vector3D.h>
 
-namespace flair { namespace gui {
-    class Layout;
+namespace flair {
+namespace gui {
+class Layout;
 
-    /*! \class Vector3DSpinBox
-    *
-    * \brief Class displaying 3 QDoubleSpinBox for x,y,z on the ground station
-    *
-    */
-    class Vector3DSpinBox: public Box {
-        public:
-            /*!
-            * \brief Constructor
-            *
-            * Construct a Vector3DSpinBox at given position. \n
-            * Each DoubleSpinBox is saturated to min and max values.
-            *
-            * \param position position to display the Vector3DSpinBox
-            * \param name name
-            * \param min minimum value
-            * \param max maximum value
-            * \param step step
-            * \param decimals number of decimals
-            * \param default_value default value if not in the xml config file
-            */
-            Vector3DSpinBox(const LayoutPosition* position,std::string name,double min,double max,double step,int decimals=2,core::Vector3D default_value=core::Vector3D(0,0,0));
+/*! \class Vector3DSpinBox
+*
+* \brief Class displaying 3 QDoubleSpinBox for x,y,z on the ground station
+*
+*/
+class Vector3DSpinBox : public Box {
+public:
+  /*!
+  * \brief Constructor
+  *
+  * Construct a Vector3DSpinBox at given position. \n
+  * Each DoubleSpinBox is saturated to min and max values.
+  *
+  * \param position position to display the Vector3DSpinBox
+  * \param name name
+  * \param min minimum value
+  * \param max maximum value
+  * \param step step
+  * \param decimals number of decimals
+  * \param default_value default value if not in the xml config file
+  */
+  Vector3DSpinBox(const LayoutPosition *position, std::string name, double min,
+                  double max, double step, int decimals = 2,
+                  core::Vector3D default_value = core::Vector3D(0, 0, 0));
 
-            /*!
-            * \brief Destructor
-            *
-            */
-            ~Vector3DSpinBox();
+  /*!
+  * \brief Destructor
+  *
+  */
+  ~Vector3DSpinBox();
 
-            /*!
-            * \brief Value
-            *
-            * \return value
-            */
-            core::Vector3D Value(void) const;
-            //operator core::Vector3D() const;
-        private:
-            /*!
-            * \brief XmlEvent from ground station
-            *
-            * Reimplemented from Widget.
-            *
-            */
-            void XmlEvent(void);
+  /*!
+  * \brief Value
+  *
+  * \return value
+  */
+  core::Vector3D Value(void) const;
+  // operator core::Vector3D() const;
+private:
+  /*!
+  * \brief XmlEvent from ground station
+  *
+  * Reimplemented from Widget.
+  *
+  */
+  void XmlEvent(void);
 
-            core::Vector3D box_value;
-    };
+  core::Vector3D box_value;
+};
 
 } // end namespace gui
Index: trunk/lib/FlairCore/src/Vector3Ddata.cpp
===================================================================
--- trunk/lib/FlairCore/src/Vector3Ddata.cpp	(revision 14)
+++ trunk/lib/FlairCore/src/Vector3Ddata.cpp	(revision 15)
@@ -25,78 +25,75 @@
 using std::string;
 
-namespace flair { namespace core {
+namespace flair {
+namespace core {
 
-   /*! \class Vector3DdataElement
-    */
-    class Vector3DdataElement: public IODataElement {
-    public:
-        Vector3DdataElement(const Vector3Ddata *data,string name,uint32_t elem):IODataElement(data,name) {
-            this->data=data;
-            this->elem=elem;
-            size=4;
-        }
+/*! \class Vector3DdataElement
+ */
+class Vector3DdataElement : public IODataElement {
+public:
+  Vector3DdataElement(const Vector3Ddata *data, string name, uint32_t elem)
+      : IODataElement(data, name) {
+    this->data = data;
+    this->elem = elem;
+    size = 4;
+  }
 
-        ~Vector3DdataElement() {
-        }
+  ~Vector3DdataElement() {}
 
-        void CopyData(char* dst) const {
-            float value;
-            data->GetMutex();
-            switch(elem) {
-                case X:
-                    value=data->x;
-                    break;
-                case Y:
-                    value=data->y;
-                    break;
-                case Z:
-                    value=data->z;
-                    break;
-                default:
-                    data->Err("type not handled\n");
-                    value=0;
-                    break;
-            }
-            data->ReleaseMutex();
+  void CopyData(char *dst) const {
+    float value;
+    data->GetMutex();
+    switch (elem) {
+    case X:
+      value = data->x;
+      break;
+    case Y:
+      value = data->y;
+      break;
+    case Z:
+      value = data->z;
+      break;
+    default:
+      data->Err("type not handled\n");
+      value = 0;
+      break;
+    }
+    data->ReleaseMutex();
 
-            memcpy(dst,&value,sizeof(float));
-        }
+    memcpy(dst, &value, sizeof(float));
+  }
 
-        ScalarType const &GetDataType() const {
-            return dataType;
-        }
+  ScalarType const &GetDataType() const { return dataType; }
 
-    private:
-        const Vector3Ddata *data;
-        uint32_t elem;
-        FloatType dataType;
-    };
+private:
+  const Vector3Ddata *data;
+  uint32_t elem;
+  FloatType dataType;
+};
 
-Vector3Ddata::Vector3Ddata(const Object* parent, string name,float x,float y,float z,uint32_t n): io_data(parent,name,n), Vector3D(x,y,z) {
+Vector3Ddata::Vector3Ddata(const Object *parent, string name, float x, float y,
+                           float z, uint32_t n)
+    : io_data(parent, name, n), Vector3D(x, y, z) {}
 
+Vector3Ddata::~Vector3Ddata() {}
+
+void Vector3Ddata::CopyDatas(char *dst) const {
+  GetMutex();
+  memcpy(dst, &x, sizeof(float));
+  memcpy(dst + sizeof(float), &y, sizeof(float));
+  memcpy(dst + 2 * sizeof(float), &z, sizeof(float));
+  ReleaseMutex();
 }
 
-Vector3Ddata::~Vector3Ddata() {
-
+IODataElement *Vector3Ddata::XElement(void) const {
+  return new Vector3DdataElement(this, "x", X);
 }
 
-void Vector3Ddata::CopyDatas(char* dst) const {
-    GetMutex();
-    memcpy(dst,&x,sizeof(float));
-    memcpy(dst+sizeof(float),&y,sizeof(float));
-    memcpy(dst+2*sizeof(float),&z,sizeof(float));
-    ReleaseMutex();
+IODataElement *Vector3Ddata::YElement(void) const {
+  return new Vector3DdataElement(this, "y", Y);
 }
 
-IODataElement* Vector3Ddata::XElement(void) const {
-    return new Vector3DdataElement(this,"x",X);
-}
-
-IODataElement* Vector3Ddata::YElement(void) const {
-    return new Vector3DdataElement(this,"y",Y);
-}
-
-IODataElement* Vector3Ddata::ZElement(void) const {
-    return new Vector3DdataElement(this,"z",Z);
+IODataElement *Vector3Ddata::ZElement(void) const {
+  return new Vector3DdataElement(this, "z", Z);
 }
 
Index: trunk/lib/FlairCore/src/Vector3Ddata.h
===================================================================
--- trunk/lib/FlairCore/src/Vector3Ddata.h	(revision 14)
+++ trunk/lib/FlairCore/src/Vector3Ddata.h	(revision 15)
@@ -18,72 +18,70 @@
 #include <Vector3D.h>
 
-namespace flair
-{
-namespace core
-{
+namespace flair {
+namespace core {
 
-    /*! \class Vector3Ddata
-    *
-    * \brief Class defining a 3D vector and a io_data
-    * User must manually use the io_data's Mutex to access to Vector3D values.
-    */
-    class Vector3Ddata: public io_data, public Vector3D
-    {
-        public:
-            /*!
-            * \brief Constructor
-            *
-            * Construct a Vector3D using specified values.
-            *
-            * \param x
-            * \param y
-            * \param z
-            */
-            Vector3Ddata(const Object* parent, std::string name,float x=0,float y=0,float z=0,uint32_t n=1);
+/*! \class Vector3Ddata
+*
+* \brief Class defining a 3D vector and a io_data
+* User must manually use the io_data's Mutex to access to Vector3D values.
+*/
+class Vector3Ddata : public io_data, public Vector3D {
+public:
+  /*!
+  * \brief Constructor
+  *
+  * Construct a Vector3D using specified values.
+  *
+  * \param x
+  * \param y
+  * \param z
+  */
+  Vector3Ddata(const Object *parent, std::string name, float x = 0, float y = 0,
+               float z = 0, uint32_t n = 1);
 
-            /*!
-            * \brief Destructor
-            *
-            */
-            ~Vector3Ddata();
+  /*!
+  * \brief Destructor
+  *
+  */
+  ~Vector3Ddata();
 
-            /*!
-            * \brief X Element
-            *
-            * Get a vectorer to x element. This pointer can be used for plotting.
-            *
-            * \return pointer to the element
-            */
-            IODataElement* XElement(void) const;
+  /*!
+  * \brief X Element
+  *
+  * Get a vectorer to x element. This pointer can be used for plotting.
+  *
+  * \return pointer to the element
+  */
+  IODataElement *XElement(void) const;
 
-            /*!
-            * \brief Y Element
-            *
-            * Get a pointer to y element. This pointer can be used for plotting.
-            *
-            * \return pointer to the element
-            */
-            IODataElement* YElement(void) const;
+  /*!
+  * \brief Y Element
+  *
+  * Get a pointer to y element. This pointer can be used for plotting.
+  *
+  * \return pointer to the element
+  */
+  IODataElement *YElement(void) const;
 
-            /*!
-            * \brief Z Element
-            *
-            * Get a pointer to z element. This pointer can be used for plotting.
-            *
-            * \return pointer to the element
-            */
-            IODataElement* ZElement(void) const;
+  /*!
+  * \brief Z Element
+  *
+  * Get a pointer to z element. This pointer can be used for plotting.
+  *
+  * \return pointer to the element
+  */
+  IODataElement *ZElement(void) const;
 
-        private:
-            /*!
-            * \brief Copy datas
-            *
-            * Reimplemented from io_data. \n
-            * See io_data::CopyDatas.
-            *
-            * \param dst destination buffer
-            */
-            void CopyDatas(char* dst) const;
-    };
+private:
+  /*!
+  * \brief Copy datas
+  *
+  * Reimplemented from io_data. \n
+  * See io_data::CopyDatas.
+  *
+  * \param dst destination buffer
+  */
+  void CopyDatas(char *dst) const;
+};
 
 } // end namespace core
Index: trunk/lib/FlairCore/src/Watchdog.cpp
===================================================================
--- trunk/lib/FlairCore/src/Watchdog.cpp	(revision 14)
+++ trunk/lib/FlairCore/src/Watchdog.cpp	(revision 15)
@@ -20,29 +20,33 @@
 namespace core {
 
-Watchdog::Watchdog(const Object* parent,std::function<void()> _expired,Time _timer):Thread(parent,"watchdog",0),expired(_expired),timer(_timer){
-}
+Watchdog::Watchdog(const Object *parent, std::function<void()> _expired,
+                   Time _timer)
+    : Thread(parent, "watchdog", 0), expired(_expired), timer(_timer) {}
 
 Watchdog::~Watchdog() {
-    SafeStop();
-    Join();
+  SafeStop();
+  Join();
 }
 
 void Watchdog::Touch() {
-    if (IsSuspended()) Resume();
+  if (IsSuspended())
+    Resume();
 }
 
 void Watchdog::SetTimer(Time _Timer) {
-    timer=_Timer; Touch();
+  timer = _Timer;
+  Touch();
 }
 
 void Watchdog::Run() {
-    while (!ToBeStopped()) {
-        Time current=GetTime();
-        Time date=current+timer;
-        //Printf("watchdog goes to sleep at %llu, scheduled to wake up at %llu\n",current,date);
-        if (!SuspendUntil(date)) {
-            expired();
-        }
+  while (!ToBeStopped()) {
+    Time current = GetTime();
+    Time date = current + timer;
+    // Printf("watchdog goes to sleep at %llu, scheduled to wake up at
+    // %llu\n",current,date);
+    if (!SuspendUntil(date)) {
+      expired();
     }
+  }
 };
 
Index: trunk/lib/FlairCore/src/Watchdog.h
===================================================================
--- trunk/lib/FlairCore/src/Watchdog.h	(revision 14)
+++ trunk/lib/FlairCore/src/Watchdog.h	(revision 15)
@@ -20,24 +20,25 @@
 namespace core {
 
-    /*! \class Watchdog
-    *
-    * \brief Watchdog class
-    *
-    * Calls a given function if not touched within a specified period of time
-    *
-    */
-    class Watchdog:public Thread {
-    public:
-        Watchdog(const Object* parent,std::function<void()> _expired,Time _timer);
-        ~Watchdog();
+/*! \class Watchdog
+*
+* \brief Watchdog class
+*
+* Calls a given function if not touched within a specified period of time
+*
+*/
+class Watchdog : public Thread {
+public:
+  Watchdog(const Object *parent, std::function<void()> _expired, Time _timer);
+  ~Watchdog();
 
-        //reset the timer
-        void Touch();
-        void SetTimer(Time _Timer);
-    private:
-        void Run();
-        std::function<void()> expired;
-        Time timer;
-    };
+  // reset the timer
+  void Touch();
+  void SetTimer(Time _Timer);
+
+private:
+  void Run();
+  std::function<void()> expired;
+  Time timer;
+};
 
 } // end namespace core
Index: trunk/lib/FlairCore/src/Widget.cpp
===================================================================
--- trunk/lib/FlairCore/src/Widget.cpp	(revision 14)
+++ trunk/lib/FlairCore/src/Widget.cpp	(revision 15)
@@ -21,227 +21,196 @@
 using std::string;
 
-namespace flair
-{
-namespace gui
-{
+namespace flair {
+namespace gui {
 
 using namespace core;
 
-Widget::Widget(const Widget* parent,string name,string type): Object(parent,name,type)
-{
-    pimpl_=new Widget_impl(this,parent,name,type);
-}
-
-Widget::~Widget()
-{
-    delete pimpl_;
-}
-
-template <>
-bool Widget::GetPersistentXmlProp(std::string prop,double &value)
-{
-    xmlChar *result=NULL;
-    result=xmlGetProp(pimpl_->file_node,(xmlChar*)prop.c_str());
-
-    if(result!=NULL) {
-        value=xmlXPathCastStringToNumber(result);
-        xmlFree(result);
-        return true;
-    } else {
-        return false;
-    }
-}
-
-template <>
-bool Widget::GetPersistentXmlProp(std::string prop,float &value) {
-    double tmp;
-    if(GetPersistentXmlProp<double>(prop,tmp)) {
-        value=tmp;
-        return true;
-    } else {
-        return false;
-    }
-}
-
-template <>
-bool Widget::GetPersistentXmlProp(std::string prop,bool &value) {
-    double tmp;
-    if(GetPersistentXmlProp<double>(prop,tmp)) {
-        value=tmp;
-        return true;
-    } else {
-        return false;
-    }
-}
-
-template <>
-bool Widget::GetPersistentXmlProp(std::string prop,int32_t &value) {
-    double tmp;
-    if(GetPersistentXmlProp<double>(prop,tmp)) {
-        value=tmp;
-        return true;
-    } else {
-        return false;
-    }
-}
-
-template <>
-bool Widget::GetPersistentXmlProp(std::string prop,uint16_t &value) {
-    double tmp;
-    if(GetPersistentXmlProp<double>(prop,tmp)) {
-        value=tmp;
-        return true;
-    } else {
-        return false;
-    }
-}
-
-template <>
-void Widget::SetVolatileXmlProp(string prop,string value,xmlNodePtr node)
-{
-    if(node==NULL) node=pimpl_->send_node;
-    xmlSetProp(node,(xmlChar*)prop.c_str(),(xmlChar*)value.c_str());
-}
-
-template <>
-void Widget::SetVolatileXmlProp(string prop,char* value,xmlNodePtr node)
-{
-    if(node==NULL) node=pimpl_->send_node;
-    xmlSetProp(node,(xmlChar*)prop.c_str(),(xmlChar*)value);
-}
-
-template <>
-void Widget::SetVolatileXmlProp(string prop,double value,xmlNodePtr node)
-{
-    xmlChar* xmlChar_value=xmlXPathCastNumberToString(value);
-
-    if(node==NULL) node=pimpl_->send_node;
-    xmlSetProp(node,(xmlChar*)prop.c_str(),xmlChar_value);
-    xmlFree(xmlChar_value);
-}
-
-template <>
-void Widget::SetVolatileXmlProp(string prop,float value,xmlNodePtr node)
-{
-    SetVolatileXmlProp<double>(prop,value,node);
-}
-
-template <>
-void Widget::SetVolatileXmlProp(string prop,int32_t value,xmlNodePtr node)
-{
-    SetVolatileXmlProp<double>(prop,value,node);
-}
-
-template <>
-void Widget::SetVolatileXmlProp(string prop,uint32_t value,xmlNodePtr node)
-{
-    SetVolatileXmlProp<double>(prop,value,node);
-}
-
-template <>
-void Widget::SetVolatileXmlProp(string prop,int16_t value,xmlNodePtr node)
-{
-    SetVolatileXmlProp<double>(prop,value,node);
-}
-
-template <>
-void Widget::SetVolatileXmlProp(string prop,uint16_t value,xmlNodePtr node)
-{
-    SetVolatileXmlProp<double>(prop,value,node);
-}
-
-template <>
-void Widget::SetVolatileXmlProp(string prop,int8_t value,xmlNodePtr node)
-{
-    SetVolatileXmlProp<double>(prop,value,node);
-}
-
-template <>
-void Widget::SetVolatileXmlProp(string prop,uint8_t value,xmlNodePtr node)
-{
-    SetVolatileXmlProp<double>(prop,value,node);
-}
-
-template <>
-void Widget::SetVolatileXmlProp(string prop,bool value,xmlNodePtr node)
-{
-    SetVolatileXmlProp<double>(prop,value,node);
-}
-
-template <>
-void Widget::SetVolatileXmlProp(string prop,xmlChar* value,xmlNodePtr node) {
-    if(node==NULL) node=pimpl_->send_node;
-    xmlSetProp(node,(xmlChar*)prop.c_str(),value);
-}
-
-template <>
-void Widget::SetVolatileXmlProp(string prop,DataType const &dataType,xmlNodePtr node) {
-    if(node==NULL) node=pimpl_->send_node;
-    xmlSetProp(node,(xmlChar*)prop.c_str(),(xmlChar*)dataType.GetDescription().c_str());
-/*
-    switch(dataType)
-    {
-        case io_data::Float:
-            xmlSetProp(node,(xmlChar*)prop.c_str(),(xmlChar*)"float");
-            break;
-        case io_data::Int8_t:
-            xmlSetProp(node,(xmlChar*)prop.c_str(),(xmlChar*)"int8_t");
-            break;
-        case io_data::Int16_t:
-            xmlSetProp(node,(xmlChar*)prop.c_str(),(xmlChar*)"int16_t");
-            break;
-    }
-    */
-}
-
-template <>
-void Widget::SetPersistentXmlProp(std::string prop,double value) {
-    SetVolatileXmlProp(prop,value);
-    SetVolatileXmlProp(prop,value,pimpl_->file_node);
-}
-
-template <>
-void Widget::SetPersistentXmlProp(std::string prop,float value)
-{
-    SetVolatileXmlProp(prop,value);
-    SetVolatileXmlProp(prop,value,pimpl_->file_node);
-}
-
-template <>
-void Widget::SetPersistentXmlProp(std::string prop,int32_t value)
-{
-    SetVolatileXmlProp(prop,value);
-    SetVolatileXmlProp(prop,value,pimpl_->file_node);
-}
-
-template <>
-void Widget::SetPersistentXmlProp(std::string prop,uint16_t value)
-{
-    SetVolatileXmlProp(prop,value);
-    SetVolatileXmlProp(prop,value,pimpl_->file_node);
-}
-
-template <>
-void Widget::SetPersistentXmlProp(std::string prop,bool value)
-{
-    SetVolatileXmlProp(prop,value);
-    SetVolatileXmlProp(prop,value,pimpl_->file_node);
-}
-
-void Widget::SendXml(void)
-{
-    pimpl_->SendXml();
-}
-
-void Widget::setEnabled(bool status)
-{
-    pimpl_->setEnabled(status);
-}
-
-bool Widget::isEnabled(void) const
-{
-    return pimpl_->isenabled;
-
-}
+Widget::Widget(const Widget *parent, string name, string type)
+    : Object(parent, name, type) {
+  pimpl_ = new Widget_impl(this, parent, name, type);
+}
+
+Widget::~Widget() { delete pimpl_; }
+
+template <> bool Widget::GetPersistentXmlProp(std::string prop, double &value) {
+  xmlChar *result = NULL;
+  result = xmlGetProp(pimpl_->file_node, (xmlChar *)prop.c_str());
+
+  if (result != NULL) {
+    value = xmlXPathCastStringToNumber(result);
+    xmlFree(result);
+    return true;
+  } else {
+    return false;
+  }
+}
+
+template <> bool Widget::GetPersistentXmlProp(std::string prop, float &value) {
+  double tmp;
+  if (GetPersistentXmlProp<double>(prop, tmp)) {
+    value = tmp;
+    return true;
+  } else {
+    return false;
+  }
+}
+
+template <> bool Widget::GetPersistentXmlProp(std::string prop, bool &value) {
+  double tmp;
+  if (GetPersistentXmlProp<double>(prop, tmp)) {
+    value = tmp;
+    return true;
+  } else {
+    return false;
+  }
+}
+
+template <>
+bool Widget::GetPersistentXmlProp(std::string prop, int32_t &value) {
+  double tmp;
+  if (GetPersistentXmlProp<double>(prop, tmp)) {
+    value = tmp;
+    return true;
+  } else {
+    return false;
+  }
+}
+
+template <>
+bool Widget::GetPersistentXmlProp(std::string prop, uint16_t &value) {
+  double tmp;
+  if (GetPersistentXmlProp<double>(prop, tmp)) {
+    value = tmp;
+    return true;
+  } else {
+    return false;
+  }
+}
+
+template <>
+void Widget::SetVolatileXmlProp(string prop, string value, xmlNodePtr node) {
+  if (node == NULL)
+    node = pimpl_->send_node;
+  xmlSetProp(node, (xmlChar *)prop.c_str(), (xmlChar *)value.c_str());
+}
+
+template <>
+void Widget::SetVolatileXmlProp(string prop, char *value, xmlNodePtr node) {
+  if (node == NULL)
+    node = pimpl_->send_node;
+  xmlSetProp(node, (xmlChar *)prop.c_str(), (xmlChar *)value);
+}
+
+template <>
+void Widget::SetVolatileXmlProp(string prop, double value, xmlNodePtr node) {
+  xmlChar *xmlChar_value = xmlXPathCastNumberToString(value);
+
+  if (node == NULL)
+    node = pimpl_->send_node;
+  xmlSetProp(node, (xmlChar *)prop.c_str(), xmlChar_value);
+  xmlFree(xmlChar_value);
+}
+
+template <>
+void Widget::SetVolatileXmlProp(string prop, float value, xmlNodePtr node) {
+  SetVolatileXmlProp<double>(prop, value, node);
+}
+
+template <>
+void Widget::SetVolatileXmlProp(string prop, int32_t value, xmlNodePtr node) {
+  SetVolatileXmlProp<double>(prop, value, node);
+}
+
+template <>
+void Widget::SetVolatileXmlProp(string prop, uint32_t value, xmlNodePtr node) {
+  SetVolatileXmlProp<double>(prop, value, node);
+}
+
+template <>
+void Widget::SetVolatileXmlProp(string prop, int16_t value, xmlNodePtr node) {
+  SetVolatileXmlProp<double>(prop, value, node);
+}
+
+template <>
+void Widget::SetVolatileXmlProp(string prop, uint16_t value, xmlNodePtr node) {
+  SetVolatileXmlProp<double>(prop, value, node);
+}
+
+template <>
+void Widget::SetVolatileXmlProp(string prop, int8_t value, xmlNodePtr node) {
+  SetVolatileXmlProp<double>(prop, value, node);
+}
+
+template <>
+void Widget::SetVolatileXmlProp(string prop, uint8_t value, xmlNodePtr node) {
+  SetVolatileXmlProp<double>(prop, value, node);
+}
+
+template <>
+void Widget::SetVolatileXmlProp(string prop, bool value, xmlNodePtr node) {
+  SetVolatileXmlProp<double>(prop, value, node);
+}
+
+template <>
+void Widget::SetVolatileXmlProp(string prop, xmlChar *value, xmlNodePtr node) {
+  if (node == NULL)
+    node = pimpl_->send_node;
+  xmlSetProp(node, (xmlChar *)prop.c_str(), value);
+}
+
+template <>
+void Widget::SetVolatileXmlProp(string prop, DataType const &dataType,
+                                xmlNodePtr node) {
+  if (node == NULL)
+    node = pimpl_->send_node;
+  xmlSetProp(node, (xmlChar *)prop.c_str(),
+             (xmlChar *)dataType.GetDescription().c_str());
+  /*
+      switch(dataType)
+      {
+          case io_data::Float:
+              xmlSetProp(node,(xmlChar*)prop.c_str(),(xmlChar*)"float");
+              break;
+          case io_data::Int8_t:
+              xmlSetProp(node,(xmlChar*)prop.c_str(),(xmlChar*)"int8_t");
+              break;
+          case io_data::Int16_t:
+              xmlSetProp(node,(xmlChar*)prop.c_str(),(xmlChar*)"int16_t");
+              break;
+      }
+      */
+}
+
+template <> void Widget::SetPersistentXmlProp(std::string prop, double value) {
+  SetVolatileXmlProp(prop, value);
+  SetVolatileXmlProp(prop, value, pimpl_->file_node);
+}
+
+template <> void Widget::SetPersistentXmlProp(std::string prop, float value) {
+  SetVolatileXmlProp(prop, value);
+  SetVolatileXmlProp(prop, value, pimpl_->file_node);
+}
+
+template <> void Widget::SetPersistentXmlProp(std::string prop, int32_t value) {
+  SetVolatileXmlProp(prop, value);
+  SetVolatileXmlProp(prop, value, pimpl_->file_node);
+}
+
+template <>
+void Widget::SetPersistentXmlProp(std::string prop, uint16_t value) {
+  SetVolatileXmlProp(prop, value);
+  SetVolatileXmlProp(prop, value, pimpl_->file_node);
+}
+
+template <> void Widget::SetPersistentXmlProp(std::string prop, bool value) {
+  SetVolatileXmlProp(prop, value);
+  SetVolatileXmlProp(prop, value, pimpl_->file_node);
+}
+
+void Widget::SendXml(void) { pimpl_->SendXml(); }
+
+void Widget::setEnabled(bool status) { pimpl_->setEnabled(status); }
+
+bool Widget::isEnabled(void) const { return pimpl_->isenabled; }
 
 } // end namespace gui
Index: trunk/lib/FlairCore/src/Widget.h
===================================================================
--- trunk/lib/FlairCore/src/Widget.h	(revision 14)
+++ trunk/lib/FlairCore/src/Widget.h	(revision 15)
@@ -21,125 +21,129 @@
 class FrameworkManager_impl;
 
-namespace flair
-{
-namespace gui
-{
+namespace flair {
+namespace gui {
 
-    /*! \class Widget
-    *
-    * \brief Abstract class for all Framework's widget classes
-    *
-    * A widget is an object to display on the ground station. \n
-    * Communication with ground station is done through xml files; properties of theses files
-    * are modified through appropriate method. \n
-    * A xml file is used for default values of the Widget, if it has been specified in the
-    *  constructor of the FrameworkManager.
-    */
-    class Widget: public core::Object
-    {
-        friend class core::FrameworkManager;
-        friend class ::Widget_impl;
-        friend class ::FrameworkManager_impl;
+/*! \class Widget
+*
+* \brief Abstract class for all Framework's widget classes
+*
+* A widget is an object to display on the ground station. \n
+* Communication with ground station is done through xml files; properties of
+*theses files
+* are modified through appropriate method. \n
+* A xml file is used for default values of the Widget, if it has been specified
+*in the
+*  constructor of the FrameworkManager.
+*/
+class Widget : public core::Object {
+  friend class core::FrameworkManager;
+  friend class ::Widget_impl;
+  friend class ::FrameworkManager_impl;
 
-        public:
-            /*!
-            * \brief Constructor
-            *
-            * Construct a Widget, the xml file specified to the FrameworkManager's
-            * constructor is sued for default values. \n
-            * Two Widget with same parent must have different names. If a brother Widget already
-            * has the same name, the name of the new one will be automatically changed. \n
-            * Type must agree with predifined (hard coded) types
-            * in ground station code.
-            *
-            * \param parent parent
-            * \param name name
-            * \param type type
-            */
-            Widget(const Widget* parent,std::string name,std::string type);
+public:
+  /*!
+  * \brief Constructor
+  *
+  * Construct a Widget, the xml file specified to the FrameworkManager's
+  * constructor is sued for default values. \n
+  * Two Widget with same parent must have different names. If a brother Widget
+  *already
+  * has the same name, the name of the new one will be automatically changed. \n
+  * Type must agree with predifined (hard coded) types
+  * in ground station code.
+  *
+  * \param parent parent
+  * \param name name
+  * \param type type
+  */
+  Widget(const Widget *parent, std::string name, std::string type);
 
-            /*!
-            * \brief Destructor
-            *
-            */
-            virtual ~Widget();
+  /*!
+  * \brief Destructor
+  *
+  */
+  virtual ~Widget();
 
-            /*!
-            * \brief Set enabled
-            *
-            * Enable or disable the Widget on the ground station. \n
-            * A disabled widget is greyed out on the ground station
-            * and in unmodifiable.
-            *
-            * \param status
-            */
-            void setEnabled(bool status);
+  /*!
+  * \brief Set enabled
+  *
+  * Enable or disable the Widget on the ground station. \n
+  * A disabled widget is greyed out on the ground station
+  * and in unmodifiable.
+  *
+  * \param status
+  */
+  void setEnabled(bool status);
 
-            /*!
-            * \brief Is enabled?
-            *
-            * \return true if widget is enabled
-            */
-            bool isEnabled(void) const;
+  /*!
+  * \brief Is enabled?
+  *
+  * \return true if widget is enabled
+  */
+  bool isEnabled(void) const;
 
-        protected:
-            /*!
-            * \brief Set a persistent xml property
-            *
-            * The property will be saved in the configuration xml and also used to configure the ground station.
-            *
-            * \param prop property to set and save
-            * \param value value to set and save
-            */
-            template <typename T>
-            void SetPersistentXmlProp(std::string prop,T value);
+protected:
+  /*!
+  * \brief Set a persistent xml property
+  *
+  * The property will be saved in the configuration xml and also used to
+  *configure the ground station.
+  *
+  * \param prop property to set and save
+  * \param value value to set and save
+  */
+  template <typename T> void SetPersistentXmlProp(std::string prop, T value);
 
-            /*!
-            * \brief Get a persistent xml property
-            *
-            * Get the property from the xml file. If no corresponding property is found in the xml, value remains unchanged. \n
-            * Thus value can be initialized with a default value before calling this method.
-            *
-            * \param prop property to get
-            * \param value value to store the result
-            * \return true if value was changed
-            */
-            template <typename T>
-            bool GetPersistentXmlProp(std::string prop,T &value);
+  /*!
+  * \brief Get a persistent xml property
+  *
+  * Get the property from the xml file. If no corresponding property is found in
+  *the xml, value remains unchanged. \n
+  * Thus value can be initialized with a default value before calling this
+  *method.
+  *
+  * \param prop property to get
+  * \param value value to store the result
+  * \return true if value was changed
+  */
+  template <typename T> bool GetPersistentXmlProp(std::string prop, T &value);
 
-            /*!
-            * \brief Set a volatile xml property
-            *
-            * This property should be used to configure the ground station (one time init). \n
-            * The property will be destroyed after calling SendXml() as it should no be used anymore.
-            *
-            * \param prop property to set
-            * \param value value to set
-            * \param node if sepcified, node to set; otherwise use the node of the Widget
-            */
-            template <typename T>
-            void SetVolatileXmlProp(std::string prop,T value,xmlNodePtr node=NULL);
+  /*!
+  * \brief Set a volatile xml property
+  *
+  * This property should be used to configure the ground station (one time
+  *init). \n
+  * The property will be destroyed after calling SendXml() as it should no be
+  *used anymore.
+  *
+  * \param prop property to set
+  * \param value value to set
+  * \param node if sepcified, node to set; otherwise use the node of the Widget
+  */
+  template <typename T>
+  void SetVolatileXmlProp(std::string prop, T value, xmlNodePtr node = NULL);
 
-            /*!
-            * \brief Send xml
-            *
-            * Send Widget's xml to ground station. \n
-            * New changes will be taken into account by ground station. \n
-            * All volatile properties will be erased after calling ths method, as they should not be used anymore.
-            */
-            void SendXml(void);
+  /*!
+  * \brief Send xml
+  *
+  * Send Widget's xml to ground station. \n
+  * New changes will be taken into account by ground station. \n
+  * All volatile properties will be erased after calling ths method, as they
+  *should not be used anymore.
+  */
+  void SendXml(void);
 
-            /*!
-            * \brief Xml event
-            *
-            * This method must be reimplemented to handle a xml event. \n
-            * It is automatically called when something changed from
-            * ground station. \n
-            */
-            virtual void XmlEvent(void){};
+  /*!
+  * \brief Xml event
+  *
+  * This method must be reimplemented to handle a xml event. \n
+  * It is automatically called when something changed from
+  * ground station. \n
+  */
+  virtual void XmlEvent(void){};
 
-         private:
-            class Widget_impl* pimpl_;
-    };
+private:
+  class Widget_impl *pimpl_;
+};
 
 } // end namespace gui
Index: trunk/lib/FlairCore/src/Widget_impl.cpp
===================================================================
--- trunk/lib/FlairCore/src/Widget_impl.cpp	(revision 14)
+++ trunk/lib/FlairCore/src/Widget_impl.cpp	(revision 15)
@@ -34,336 +34,319 @@
 using namespace flair::gui;
 
-namespace{
+namespace {
 #ifdef __XENO__
-    RT_HEAP xml_heap;
-
-    void xml2_free(void *mem)
-    {
-        //Printf("free %x\n",mem);
-        if(mem==NULL) return;
-        int status=rt_heap_free(&xml_heap,mem);
-
-        if(status!=0)
-        {
-            printf("libxml2: rt_heap_free error (%s)\n",strerror(-status));
-        }
-    }
-
-    void *xml2_alloc(size_t sz)
-    {
-        void *ptr;
-        //printf("alloc %i\n",sz);
-        int status=rt_heap_alloc(&xml_heap,sz,TM_NONBLOCK ,&ptr);
-        if(status!=0)
-        {
-            printf("libxml2: rt_heap_alloc error (%s)\n",strerror(-status));
-        }
-        //Printf("alloc %x %i\n",ptr,sz);
-
-        return ptr;
-
-    }
-
-    void *xml2_realloc(void *emem,size_t sz)
-    {
-        //Printf("realloc %x %i -> %i\n",emem,sz,sz);
-        void *mem_re;
-
-
-        if (emem == NULL)
-        {
-            return xml2_alloc(sz);
-        }
-        else if (sz == 0)
-        {
-            xml2_free(emem);
-        }
-
-        mem_re = xml2_alloc(sz);
-
-        memcpy(mem_re, emem, sz);
-
-        xml2_free(emem);
-
-        return mem_re;
-    }
-
-    char *xml2_strdup(const char * str)
-    {
-       // printf("strdup %s\n",str);
-        char *s = (char*)xml2_alloc(strlen(str) + 1);
-        if (s == NULL)
-           return NULL;
-
-        strcpy(s, str);
-        return s;
-
-    }
+RT_HEAP xml_heap;
+
+void xml2_free(void *mem) {
+  // Printf("free %x\n",mem);
+  if (mem == NULL)
+    return;
+  int status = rt_heap_free(&xml_heap, mem);
+
+  if (status != 0) {
+    printf("libxml2: rt_heap_free error (%s)\n", strerror(-status));
+  }
+}
+
+void *xml2_alloc(size_t sz) {
+  void *ptr;
+  // printf("alloc %i\n",sz);
+  int status = rt_heap_alloc(&xml_heap, sz, TM_NONBLOCK, &ptr);
+  if (status != 0) {
+    printf("libxml2: rt_heap_alloc error (%s)\n", strerror(-status));
+  }
+  // Printf("alloc %x %i\n",ptr,sz);
+
+  return ptr;
+}
+
+void *xml2_realloc(void *emem, size_t sz) {
+  // Printf("realloc %x %i -> %i\n",emem,sz,sz);
+  void *mem_re;
+
+  if (emem == NULL) {
+    return xml2_alloc(sz);
+  } else if (sz == 0) {
+    xml2_free(emem);
+  }
+
+  mem_re = xml2_alloc(sz);
+
+  memcpy(mem_re, emem, sz);
+
+  xml2_free(emem);
+
+  return mem_re;
+}
+
+char *xml2_strdup(const char *str) {
+  // printf("strdup %s\n",str);
+  char *s = (char *)xml2_alloc(strlen(str) + 1);
+  if (s == NULL)
+    return NULL;
+
+  strcpy(s, str);
+  return s;
+}
 #endif //__XENO__
 }
 
-Widget_impl::Widget_impl(Widget* self,const Widget* parent,string name,string type)
-{
-    //Printf("Widget %s\n",name.c_str());
-    isenabled=true;
-    file_node=NULL;
-    this->self=self;
-
-    //n'est execute qu'une fois lorsqu'on construit le FrameworkManager
-    if(parent==NULL)
-    {
+Widget_impl::Widget_impl(Widget *self, const Widget *parent, string name,
+                         string type) {
+  // Printf("Widget %s\n",name.c_str());
+  isenabled = true;
+  file_node = NULL;
+  this->self = self;
+
+  // n'est execute qu'une fois lorsqu'on construit le FrameworkManager
+  if (parent == NULL) {
 #ifdef __XENO__
-        string tmp_name;
-        tmp_name=name + "-xml";
-        int status=rt_heap_create(&xml_heap,tmp_name.c_str(),XML_HEAP,H_FIFO);
-        if(status!=0)
-        {
-            self->Err("rt_heap_create error (%s)\n",strerror(-status));
-        }
-
-        xmlMemSetup(xml2_free,xml2_alloc, xml2_realloc,xml2_strdup);
+    string tmp_name;
+    tmp_name = name + "-xml";
+    int status = rt_heap_create(&xml_heap, tmp_name.c_str(), XML_HEAP, H_FIFO);
+    if (status != 0) {
+      self->Err("rt_heap_create error (%s)\n", strerror(-status));
+    }
+
+    xmlMemSetup(xml2_free, xml2_alloc, xml2_realloc, xml2_strdup);
 #endif //__XENO__
-    }
-
-    //xml init
-    if(parent==NULL)
-    {
-        //create local doc
-        send_doc = xmlNewDoc((xmlChar*)"1.0");
-        send_node = xmlNewNode(NULL, (xmlChar*)type.c_str());
-        xmlDocSetRootElement(send_doc, send_node);
-        xmlSetProp(send_node,(xmlChar*)"name",(xmlChar*)self->ObjectName().c_str());
-    }
-    else
-    {
-        parent->pimpl_->AddChild(self);
-
-        //get node corresponding to this widget in the xml file
-        if(parent->pimpl_->file_node!=NULL)
-        {
-            xmlChar* search=xmlCharStrdup(type.c_str());
-            file_node=GetNodeByProp(parent->pimpl_->file_node->xmlChildrenNode,search,(xmlChar*)"name",(xmlChar*)name.c_str());
-            xmlFree(search);
-        }
-        else
-        {
-            self->Err("parent->file_node is NULL\n");
-        }
-
-        if(file_node==NULL)
-        {
-            self->Warn("%s, no match found in xml file\n",type.c_str());
-            xmlNode *node;
-            node=xmlNewNode(NULL, (xmlChar*)type.c_str());
-            xmlSetProp(node,(xmlChar*)"name",(xmlChar*)name.c_str());
-            file_node=xmlAddChild(parent->pimpl_->file_node,node);
-            //((Widget*)getFrameworkManager())->pimpl_->PrintXml();
-        }
-
-        send_doc=parent->pimpl_->CopyDoc();
-
-        //on recupere le dernier node
-        xmlNodePtr node=xmlDocGetRootElement(send_doc);
-        while(node->children!=NULL) node=node->children;
-
-        //on ajoute le node du widget
-        send_node = xmlNewNode(NULL, (xmlChar*)type.c_str());
-        xmlSetProp(send_node,(xmlChar*)"name",(xmlChar*)name.c_str());
-        xmlAddChild(node,send_node);
-    }
-
-    //Printf("Widget ok %s\n",name.c_str());
-}
-
-Widget_impl::~Widget_impl()
-{
-    //Printf("destruction widget %s\n",self->ObjectName().c_str());
-
-    if(self->Parent()!=NULL) ((Widget*)(self->Parent()))->pimpl_->RemoveChild(self);
-
-    //on efface les widgets enfants avant d'envoyer son propre delete au sol
-    //dans le delete child on modifie le child du parent, donc on se refere toujours au premier
-    while(childs.size()!=0)
-    {
-        //Printf("child %i %s\n",childs.size(),childs.front()->ObjectName().c_str());
-        if(childs.front()!=NULL) delete childs.front();
-    }
-    childs.clear();
-
-    self->SetVolatileXmlProp("Delete",true);
-
-    if(self->Parent()!=NULL) SendXml();
-
-    xmlFreeDoc(send_doc);
-
-    if(self->Parent()==NULL)
-    {
-        xmlCleanupParser();
+  }
+
+  // xml init
+  if (parent == NULL) {
+    // create local doc
+    send_doc = xmlNewDoc((xmlChar *)"1.0");
+    send_node = xmlNewNode(NULL, (xmlChar *)type.c_str());
+    xmlDocSetRootElement(send_doc, send_node);
+    xmlSetProp(send_node, (xmlChar *)"name",
+               (xmlChar *)self->ObjectName().c_str());
+  } else {
+    parent->pimpl_->AddChild(self);
+
+    // get node corresponding to this widget in the xml file
+    if (parent->pimpl_->file_node != NULL) {
+      xmlChar *search = xmlCharStrdup(type.c_str());
+      file_node =
+          GetNodeByProp(parent->pimpl_->file_node->xmlChildrenNode, search,
+                        (xmlChar *)"name", (xmlChar *)name.c_str());
+      xmlFree(search);
+    } else {
+      self->Err("parent->file_node is NULL\n");
+    }
+
+    if (file_node == NULL) {
+      self->Warn("%s, no match found in xml file\n", type.c_str());
+      xmlNode *node;
+      node = xmlNewNode(NULL, (xmlChar *)type.c_str());
+      xmlSetProp(node, (xmlChar *)"name", (xmlChar *)name.c_str());
+      file_node = xmlAddChild(parent->pimpl_->file_node, node);
+      //((Widget*)getFrameworkManager())->pimpl_->PrintXml();
+    }
+
+    send_doc = parent->pimpl_->CopyDoc();
+
+    // on recupere le dernier node
+    xmlNodePtr node = xmlDocGetRootElement(send_doc);
+    while (node->children != NULL)
+      node = node->children;
+
+    // on ajoute le node du widget
+    send_node = xmlNewNode(NULL, (xmlChar *)type.c_str());
+    xmlSetProp(send_node, (xmlChar *)"name", (xmlChar *)name.c_str());
+    xmlAddChild(node, send_node);
+  }
+
+  // Printf("Widget ok %s\n",name.c_str());
+}
+
+Widget_impl::~Widget_impl() {
+  // Printf("destruction widget %s\n",self->ObjectName().c_str());
+
+  if (self->Parent() != NULL)
+    ((Widget *)(self->Parent()))->pimpl_->RemoveChild(self);
+
+  // on efface les widgets enfants avant d'envoyer son propre delete au sol
+  // dans le delete child on modifie le child du parent, donc on se refere
+  // toujours au premier
+  while (childs.size() != 0) {
+    // Printf("child %i
+    // %s\n",childs.size(),childs.front()->ObjectName().c_str());
+    if (childs.front() != NULL)
+      delete childs.front();
+  }
+  childs.clear();
+
+  self->SetVolatileXmlProp("Delete", true);
+
+  if (self->Parent() != NULL)
+    SendXml();
+
+  xmlFreeDoc(send_doc);
+
+  if (self->Parent() == NULL) {
+    xmlCleanupParser();
 #ifdef __XENO__
-        int status;
-        RT_HEAP_INFO info;
-        status=rt_heap_inquire(&xml_heap,&info);
-        if(status!=0)
-        {
-            self->Err("rt_heap_inquire error (%s)\n",strerror(-status));
-        }
-        if(info.usedmem!=0) self->Err("fuite memoire xml heap (%ld)\n",info.usedmem);
-    //Printf("fin heap xml\n");
-        status=rt_heap_delete(&xml_heap);
-        if(status!=0)
-        {
-            self->Err("rt_heap_delete error (%s)\n",strerror(-status));
-        }
+    int status;
+    RT_HEAP_INFO info;
+    status = rt_heap_inquire(&xml_heap, &info);
+    if (status != 0) {
+      self->Err("rt_heap_inquire error (%s)\n", strerror(-status));
+    }
+    if (info.usedmem != 0)
+      self->Err("fuite memoire xml heap (%ld)\n", info.usedmem);
+    // Printf("fin heap xml\n");
+    status = rt_heap_delete(&xml_heap);
+    if (status != 0) {
+      self->Err("rt_heap_delete error (%s)\n", strerror(-status));
+    }
 #endif
-    }
-    //Printf("destruction widget %s ok\n",self->ObjectName().c_str());
-}
-
-void Widget_impl::AddChild(const Widget* child)
-{
-    childs.push_back((Widget*)child);
-}
-
-void Widget_impl::RemoveChild(const Widget* child)
-{
-    for(vector<Widget*>::iterator it=childs.begin() ; it < childs.end(); it++ )
-    {
-        if(*it==child)
-        {
-            childs.erase(it);
-            break;
-        }
-    }
-}
-
-xmlDocPtr Widget_impl::CopyDoc(void)
-{
-    return xmlCopyDoc(send_doc,1);
-}
+  }
+  // Printf("destruction widget %s ok\n",self->ObjectName().c_str());
+}
+
+void Widget_impl::AddChild(const Widget *child) {
+  childs.push_back((Widget *)child);
+}
+
+void Widget_impl::RemoveChild(const Widget *child) {
+  for (vector<Widget *>::iterator it = childs.begin(); it < childs.end();
+       it++) {
+    if (*it == child) {
+      childs.erase(it);
+      break;
+    }
+  }
+}
+
+xmlDocPtr Widget_impl::CopyDoc(void) { return xmlCopyDoc(send_doc, 1); }
 
 void Widget_impl::ClearXmlProps(void) {
-    xmlUnlinkNode(send_node);
-    xmlFreeNode(send_node);
-
-    xmlNodePtr node;
-    node=xmlDocGetRootElement(send_doc);
-
-    if(node==NULL) {//il ne reste plus rien, on refait le rootelement
-        send_node = xmlNewNode(NULL, (xmlChar*)XML_ROOT_TYPE);
-        xmlSetProp(send_node,(xmlChar*)"name",(xmlChar*)self->ObjectName().c_str());
-        xmlDocSetRootElement(send_doc, send_node);
-    } else {
-        while(node->children!=NULL) node=node->children;
-        send_node = xmlNewNode(NULL, (xmlChar*)self->ObjectType().c_str());
-        xmlSetProp(send_node,(xmlChar*)"name",(xmlChar*)self->ObjectName().c_str());
-        xmlAddChild(node,send_node);
-    }
+  xmlUnlinkNode(send_node);
+  xmlFreeNode(send_node);
+
+  xmlNodePtr node;
+  node = xmlDocGetRootElement(send_doc);
+
+  if (node == NULL) { // il ne reste plus rien, on refait le rootelement
+    send_node = xmlNewNode(NULL, (xmlChar *)XML_ROOT_TYPE);
+    xmlSetProp(send_node, (xmlChar *)"name",
+               (xmlChar *)self->ObjectName().c_str());
+    xmlDocSetRootElement(send_doc, send_node);
+  } else {
+    while (node->children != NULL)
+      node = node->children;
+    send_node = xmlNewNode(NULL, (xmlChar *)self->ObjectType().c_str());
+    xmlSetProp(send_node, (xmlChar *)"name",
+               (xmlChar *)self->ObjectName().c_str());
+    xmlAddChild(node, send_node);
+  }
 }
 
 void Widget_impl::printSendNode() {
 
+  xmlChar *xmlbuff;
+  int buffersize;
+  xmlDocDumpFormatMemory(send_doc, &xmlbuff, &buffersize, 1);
+  Printf("xml:\n%s\n", xmlbuff);
+  xmlFree(xmlbuff);
+}
+
+void Widget_impl::SendXml(void) {
+  if (getUiCom() != NULL) {
     xmlChar *xmlbuff;
     int buffersize;
-    xmlDocDumpFormatMemory(send_doc, &xmlbuff, &buffersize, 1);
-    Printf("xml:\n%s\n",xmlbuff);
+    xmlDocDumpFormatMemory(send_doc, &xmlbuff, &buffersize, 0);
+    getUiCom()->Send((char *)xmlbuff, buffersize);
     xmlFree(xmlbuff);
-}
-
-void Widget_impl::SendXml(void)
-{
-    if(getUiCom()!=NULL) {
-        xmlChar *xmlbuff;
-        int buffersize;
-        xmlDocDumpFormatMemory(send_doc, &xmlbuff, &buffersize, 0);
-        getUiCom()->Send((char*)xmlbuff,buffersize);
-        xmlFree(xmlbuff);
-
-        ClearXmlProps();
-    }
+
+    ClearXmlProps();
+  }
 }
 
 void Widget_impl::setEnabled(bool status) {
-    self->SetVolatileXmlProp("IsEnabled",status);
-    SendXml();
-}
-
-
-void Widget_impl::ProcessXML(xmlNode *node)
-{
-    //Printf("ProcessXML %s %s\n",xmlGetProp(send_node, (xmlChar*)"name"),send_node->name);
-    xmlNode *cur_node = NULL;
-
-    for(size_t i=0;i<childs.size();i++)
-    {
-        for (cur_node = node; cur_node; cur_node = cur_node->next)
-        {
-            if (cur_node->type == XML_ELEMENT_NODE)
-            {
-                //Printf("recherche %s\n", xmlGetProp(cur_node, (xmlChar*)"name"));
-                xmlChar* name=NULL;
-                name=xmlGetProp(cur_node, (xmlChar*)"name");
-                if (!xmlStrcmp((xmlChar *)childs[i]->ObjectName().c_str(), name))
-                {
-                    //Printf("correspond %s\n",childs[i]->ObjectName().c_str());
-                    xmlChar* new_name=NULL;
-                    new_name=xmlGetProp(cur_node, (xmlChar*)"new_name");
-                    if(new_name!=NULL)
-                    {
-                        unsigned char* ren_name=new_name;//xmlGetProp(cur_node, (xmlChar*)"new_name");
-                        self->Warn("%s existe deja, renommage en %s; possiblite de problemes!!\n",childs[i]->ObjectName().c_str(),new_name);
-                        childs[i]->Object::pimpl_->name=((const char*)ren_name);
-                        xmlSetProp(childs[i]->pimpl_->send_node,(xmlChar*)"name",xmlGetProp(cur_node, (xmlChar*)"new_name"));
-                        xmlFree(new_name);
-                        if(name!=NULL) xmlFree(name);
-                        break;
-                    }
-
-                    if(name!=NULL) xmlFree(name);
-
-                    //update file node
-                    xmlAttr *cur_prop = NULL;
-                    //xmlAttr *file_prop = NULL;
-                    for (cur_prop = cur_node->properties; cur_prop; cur_prop = cur_prop->next)
-                    {
-                        //Printf("rcv prop %s %s\n",cur_prop->name,cur_prop->children->content);
-                        xmlSetProp(childs[i]->pimpl_->file_node,cur_prop->name,cur_prop->children->content);
-                    }
-
-                    childs[i]->XmlEvent();
-
-                    childs[i]->pimpl_->ProcessXML(cur_node->children);
-                    break;
-
-                }
-                if(name!=NULL) xmlFree(name);
-            }
+  self->SetVolatileXmlProp("IsEnabled", status);
+  SendXml();
+}
+
+void Widget_impl::ProcessXML(xmlNode *node) {
+  // Printf("ProcessXML %s %s\n",xmlGetProp(send_node,
+  // (xmlChar*)"name"),send_node->name);
+  xmlNode *cur_node = NULL;
+
+  for (size_t i = 0; i < childs.size(); i++) {
+    for (cur_node = node; cur_node; cur_node = cur_node->next) {
+      if (cur_node->type == XML_ELEMENT_NODE) {
+        // Printf("recherche %s\n", xmlGetProp(cur_node, (xmlChar*)"name"));
+        xmlChar *name = NULL;
+        name = xmlGetProp(cur_node, (xmlChar *)"name");
+        if (!xmlStrcmp((xmlChar *)childs[i]->ObjectName().c_str(), name)) {
+          // Printf("correspond %s\n",childs[i]->ObjectName().c_str());
+          xmlChar *new_name = NULL;
+          new_name = xmlGetProp(cur_node, (xmlChar *)"new_name");
+          if (new_name != NULL) {
+            unsigned char *ren_name =
+                new_name; // xmlGetProp(cur_node, (xmlChar*)"new_name");
+            self->Warn(
+                "%s existe deja, renommage en %s; possiblite de problemes!!\n",
+                childs[i]->ObjectName().c_str(), new_name);
+            childs[i]->Object::pimpl_->name = ((const char *)ren_name);
+            xmlSetProp(childs[i]->pimpl_->send_node, (xmlChar *)"name",
+                       xmlGetProp(cur_node, (xmlChar *)"new_name"));
+            xmlFree(new_name);
+            if (name != NULL)
+              xmlFree(name);
+            break;
+          }
+
+          if (name != NULL)
+            xmlFree(name);
+
+          // update file node
+          xmlAttr *cur_prop = NULL;
+          // xmlAttr *file_prop = NULL;
+          for (cur_prop = cur_node->properties; cur_prop;
+               cur_prop = cur_prop->next) {
+            // Printf("rcv prop %s
+            // %s\n",cur_prop->name,cur_prop->children->content);
+            xmlSetProp(childs[i]->pimpl_->file_node, cur_prop->name,
+                       cur_prop->children->content);
+          }
+
+          childs[i]->XmlEvent();
+
+          childs[i]->pimpl_->ProcessXML(cur_node->children);
+          break;
         }
-    }
-
-    //printf("fin ProcessXML %s %s\n",xmlGetProp(send_node, (xmlChar*)"name"),send_node->name);
-}
-
-
-xmlNodePtr Widget_impl::GetNodeByProp(xmlNodePtr doc,xmlChar *type,xmlChar *prop,xmlChar *value)
-{
-	//printf("cherche keyword: %s %s %s\n", type,prop,value);
-    xmlNode *cur_node = NULL;
-	for (cur_node = doc; cur_node; cur_node = cur_node->next)
-    {
-        if (cur_node->type == XML_ELEMENT_NODE)
-        {
-            //printf("node %s %s\n",xmlGetProp(cur_node, (xmlChar*)"name"),cur_node->name);
-            xmlChar *test = NULL;
-            test=xmlGetProp(cur_node, prop);
-            if(!xmlStrcmp(test,value) && !xmlStrcmp(cur_node->name,type ))
-            {
-                //printf("ok\n");
-                if(test!=NULL) xmlFree(test);
-                return cur_node;
-            }
-            if(test!=NULL) xmlFree(test);
-        }
-    }
-
-    return NULL;
-}
+        if (name != NULL)
+          xmlFree(name);
+      }
+    }
+  }
+
+  // printf("fin ProcessXML %s %s\n",xmlGetProp(send_node,
+  // (xmlChar*)"name"),send_node->name);
+}
+
+xmlNodePtr Widget_impl::GetNodeByProp(xmlNodePtr doc, xmlChar *type,
+                                      xmlChar *prop, xmlChar *value) {
+  // printf("cherche keyword: %s %s %s\n", type,prop,value);
+  xmlNode *cur_node = NULL;
+  for (cur_node = doc; cur_node; cur_node = cur_node->next) {
+    if (cur_node->type == XML_ELEMENT_NODE) {
+      // printf("node %s %s\n",xmlGetProp(cur_node,
+      // (xmlChar*)"name"),cur_node->name);
+      xmlChar *test = NULL;
+      test = xmlGetProp(cur_node, prop);
+      if (!xmlStrcmp(test, value) && !xmlStrcmp(cur_node->name, type)) {
+        // printf("ok\n");
+        if (test != NULL)
+          xmlFree(test);
+        return cur_node;
+      }
+      if (test != NULL)
+        xmlFree(test);
+    }
+  }
+
+  return NULL;
+}
Index: trunk/lib/FlairCore/src/cvimage.cpp
===================================================================
--- trunk/lib/FlairCore/src/cvimage.cpp	(revision 14)
+++ trunk/lib/FlairCore/src/cvimage.cpp	(revision 15)
@@ -19,59 +19,62 @@
 using std::string;
 
-namespace flair { namespace core {
+namespace flair {
+namespace core {
 
-cvimage::cvimage(const Object* parent,uint16_t width,uint16_t height,Type::Format format,string name,bool allocate_data,int n): io_data(parent,name,n),dataType(width,height,format) {
-    this->allocate_data=allocate_data;
+cvimage::cvimage(const Object *parent, uint16_t width, uint16_t height,
+                 Type::Format format, string name, bool allocate_data, int n)
+    : io_data(parent, name, n), dataType(width, height, format) {
+  this->allocate_data = allocate_data;
 
-    if(allocate_data) {
-        switch(format) {
-            case Type::Format::YUYV:
-            case Type::Format::UYVY:
-                img=cvCreateImage(cvSize(width,height),IPL_DEPTH_8U,2);
-                break;
-            case Type::Format::BGR:
-                img=cvCreateImage(cvSize(width,height),IPL_DEPTH_8U,3);
-                break;
-            case Type::Format::GRAY:
-                img=cvCreateImage(cvSize(width,height),IPL_DEPTH_8U,1);
-                break;
-            default:
-                Err("format no supported");
-                break;
-        }
-    } else {
-        if(n>1) Err("number of samples!=1 not possible when not allocating data\n");
-        n=1;
-        switch(format) {
-            case Type::Format::YUYV:
-            case Type::Format::UYVY:
-                img=cvCreateImageHeader(cvSize(width,height),IPL_DEPTH_8U,2);
-                break;
-            case Type::Format::BGR:
-                img=cvCreateImageHeader(cvSize(width,height),IPL_DEPTH_8U,3);
-                break;
-            case Type::Format::GRAY:
-                img=cvCreateImageHeader(cvSize(width,height),IPL_DEPTH_8U,1);
-                break;
-            default:
-                Err("format no supported");
-                break;
-        }
+  if (allocate_data) {
+    switch (format) {
+    case Type::Format::YUYV:
+    case Type::Format::UYVY:
+      img = cvCreateImage(cvSize(width, height), IPL_DEPTH_8U, 2);
+      break;
+    case Type::Format::BGR:
+      img = cvCreateImage(cvSize(width, height), IPL_DEPTH_8U, 3);
+      break;
+    case Type::Format::GRAY:
+      img = cvCreateImage(cvSize(width, height), IPL_DEPTH_8U, 1);
+      break;
+    default:
+      Err("format no supported");
+      break;
     }
+  } else {
+    if (n > 1)
+      Err("number of samples!=1 not possible when not allocating data\n");
+    n = 1;
+    switch (format) {
+    case Type::Format::YUYV:
+    case Type::Format::UYVY:
+      img = cvCreateImageHeader(cvSize(width, height), IPL_DEPTH_8U, 2);
+      break;
+    case Type::Format::BGR:
+      img = cvCreateImageHeader(cvSize(width, height), IPL_DEPTH_8U, 3);
+      break;
+    case Type::Format::GRAY:
+      img = cvCreateImageHeader(cvSize(width, height), IPL_DEPTH_8U, 1);
+      break;
+    default:
+      Err("format no supported");
+      break;
+    }
+  }
 
-    SetPtrToCircle((void**)&img);
+  SetPtrToCircle((void **)&img);
 
-    if(n>1) prev=new cvimage(this,width,height,format,name,n-1);
+  if (n > 1)
+    prev = new cvimage(this, width, height, format, name, n - 1);
 }
 
 cvimage::~cvimage() {
-    //printf("destructeur cvimage\n");
+  // printf("destructeur cvimage\n");
 
-    cvReleaseImage(&img);
+  cvReleaseImage(&img);
 }
 
-void cvimage::CopyDatas(char* dst) const {
-    Warn("non implementé\n");
-}
+void cvimage::CopyDatas(char *dst) const { Warn("non implementé\n"); }
 
 } // end namespace core
Index: trunk/lib/FlairCore/src/cvimage.h
===================================================================
--- trunk/lib/FlairCore/src/cvimage.h	(revision 14)
+++ trunk/lib/FlairCore/src/cvimage.h	(revision 15)
@@ -18,105 +18,106 @@
 #include <stdint.h>
 
-namespace flair
-{
-namespace core
-{
-    /*! \class cvimage
-    *
-    * \brief Class defining an image of kind IplImage
-    *
-    * IplImage is an image struct defined in OpenCV.
-    *
+namespace flair {
+namespace core {
+/*! \class cvimage
+*
+* \brief Class defining an image of kind IplImage
+*
+* IplImage is an image struct defined in OpenCV.
+*
+*/
+class cvimage : public io_data {
+public:
+  class Type : public DataType {
+  public:
+    /*!
+    \enum Format_t
+    \brief Picture formats
     */
-    class cvimage: public io_data {
-    public:
-        class Type: public DataType {
-        public:
-            /*!
-            \enum Format_t
-            \brief Picture formats
-            */
-            enum class Format {
-                YUYV,/*!< YUYV 16 bits */
-                UYVY,/*!< UYVY 16 bits */
-                BGR,/*!< BGR 24 bits */
-                GRAY,/*!< gray 8 bits */
-            } ;
-            Type(uint16_t _width, uint16_t _height, Format _format):width(_width),height(_height),format(_format) {}
+    enum class Format {
+      YUYV, /*!< YUYV 16 bits */
+      UYVY, /*!< UYVY 16 bits */
+      BGR,  /*!< BGR 24 bits */
+      GRAY, /*!< gray 8 bits */
+    };
+    Type(uint16_t _width, uint16_t _height, Format _format)
+        : width(_width), height(_height), format(_format) {}
 
-            size_t GetSize() const {
-                size_t pixelSize;
-                switch(format) {
-                case Format::GRAY:
-                    pixelSize=1;
-                    break;
-                case Format::YUYV:
-                case Format::UYVY:
-                    pixelSize=2;
-                    break;
-                case Format::BGR:
-                    pixelSize=3;
-                    break;
-                default:
-                    pixelSize=0; //TODO should throw an exception instead
-                }
-                return pixelSize*width*height;
-            }
-            std::string GetDescription() const {return "cv image";};
+    size_t GetSize() const {
+      size_t pixelSize;
+      switch (format) {
+      case Format::GRAY:
+        pixelSize = 1;
+        break;
+      case Format::YUYV:
+      case Format::UYVY:
+        pixelSize = 2;
+        break;
+      case Format::BGR:
+        pixelSize = 3;
+        break;
+      default:
+        pixelSize = 0; // TODO should throw an exception instead
+      }
+      return pixelSize * width * height;
+    }
+    std::string GetDescription() const { return "cv image"; };
 
-            Format GetFormat() const {return format;};
-            uint16_t GetWidth() const {return width;};
-            uint16_t GetHeight() const {return height;};
+    Format GetFormat() const { return format; };
+    uint16_t GetWidth() const { return width; };
+    uint16_t GetHeight() const { return height; };
 
-        private:
-            uint16_t width;
-            uint16_t height;
-            Format format;
+  private:
+    uint16_t width;
+    uint16_t height;
+    Format format;
+  };
 
-        };
+  /*!
+  * \brief Constructor
+  *
+  * Construct an io_data representing an IplImage.
+  *
+  * \param parent parent
+  * \param width image width
+  * \param height image height
+  * \param name name
+  * \param allocate_data if true, IplImage image data is allocated; otherwise
+  *img->imagedata must be changed
+  * \param n number of samples
+  */
+  cvimage(const Object *parent, uint16_t width, uint16_t height,
+          Type::Format format, std::string name = "", bool allocate_data = true,
+          int n = 1);
 
-        /*!
-        * \brief Constructor
-        *
-        * Construct an io_data representing an IplImage.
-        *
-        * \param parent parent
-        * \param width image width
-        * \param height image height
-        * \param name name
-        * \param allocate_data if true, IplImage image data is allocated; otherwise img->imagedata must be changed
-        * \param n number of samples
-        */
-        cvimage(const Object* parent,uint16_t width,uint16_t height,Type::Format format,std::string name="",bool allocate_data=true,int n=1);
+  /*!
+  * \brief Destructor
+  *
+  */
+  ~cvimage();
 
-        /*!
-        * \brief Destructor
-        *
-        */
-        ~cvimage();
+  /*!
+  * \brief IplImage
+  *
+  * \return IplImage
+  */
+  IplImage *img;
 
-        /*!
-        * \brief IplImage
-        *
-        * \return IplImage
-        */
-        IplImage* img;
+  Type const &GetDataType() const { return dataType; };
 
-        Type const&GetDataType() const {return dataType;};
+private:
+  /*!
+  * \brief Copy datas
+  *
+  * Reimplemented from io_data. \n
+  * See io_data::CopyDatas.
+  *
+  * \param dst destination buffer
+  */
+  void CopyDatas(char *dst) const;
 
-    private:
-        /*!
-        * \brief Copy datas
-        *
-        * Reimplemented from io_data. \n
-        * See io_data::CopyDatas.
-        *
-        * \param dst destination buffer
-        */
-        void CopyDatas(char* dst) const;
-
-        bool allocate_data;
-        Type dataType;
-    };
+  bool allocate_data;
+  Type dataType;
+};
 
 } // end namespace core
Index: trunk/lib/FlairCore/src/cvmatrix.cpp
===================================================================
--- trunk/lib/FlairCore/src/cvmatrix.cpp	(revision 14)
+++ trunk/lib/FlairCore/src/cvmatrix.cpp	(revision 15)
@@ -24,166 +24,174 @@
 using std::string;
 
-namespace flair { namespace core {
-    /*! \class cvmatrixElement
-    */
-    class cvmatrixElement: public IODataElement {
-    public:
-        cvmatrixElement(const cvmatrix *matrix,string name,uint32_t row, uint32_t col):IODataElement(matrix,name) {
-            this->matrix=matrix;
-            this->row=row;
-            this->col=col;
-            if(row>=matrix->Rows() || col>=matrix->Cols()) {
-                matrix->Err("index (%i,%i) out of bound (%i,%i)\n",row,col,matrix->Rows()-1,matrix->Cols()-1);
-                size=0;
-            } else {
-                try {
-                    ScalarType const &scalarType=dynamic_cast<ScalarType const &>(matrix->GetDataType().GetElementDataType());
-                    size=scalarType.GetSize();
-                } catch (std::bad_cast e) {
-                    matrix->Err("type not handled\n");
-                    size=0;
-                }
-            }
-        }
+namespace flair {
+namespace core {
+/*! \class cvmatrixElement
+*/
+class cvmatrixElement : public IODataElement {
+public:
+  cvmatrixElement(const cvmatrix *matrix, string name, uint32_t row,
+                  uint32_t col)
+      : IODataElement(matrix, name) {
+    this->matrix = matrix;
+    this->row = row;
+    this->col = col;
+    if (row >= matrix->Rows() || col >= matrix->Cols()) {
+      matrix->Err("index (%i,%i) out of bound (%i,%i)\n", row, col,
+                  matrix->Rows() - 1, matrix->Cols() - 1);
+      size = 0;
+    } else {
+      try {
+        ScalarType const &scalarType = dynamic_cast<ScalarType const &>(
+            matrix->GetDataType().GetElementDataType());
+        size = scalarType.GetSize();
+      } catch (std::bad_cast e) {
+        matrix->Err("type not handled\n");
+        size = 0;
+      }
+    }
+  }
 
-        ~cvmatrixElement() {
-        }
+  ~cvmatrixElement() {}
 
-        void CopyData(char* dst) const {
-            if (typeid(matrix->GetDataType().GetElementDataType())==typeid(FloatType)) {
-                float value=matrix->Value(row,col);
-                memcpy(dst,&value,sizeof(value));
-            } else if (typeid(matrix->GetDataType().GetElementDataType())==typeid(SignedIntegerType)) {
-                switch(matrix->GetDataType().GetElementDataType().GetSize()) {
-                case 1: {
-                        int8_t int8Value=matrix->Value(row,col);
-                        memcpy(dst,&int8Value,1);
-                    }
-                    break;
-                case 2: {
-                        int16_t int16Value=matrix->Value(row,col);
-                        memcpy(dst,&int16Value,2);
-                    }
-                    break;
-                }
-            }
-        }
+  void CopyData(char *dst) const {
+    if (typeid(matrix->GetDataType().GetElementDataType()) ==
+        typeid(FloatType)) {
+      float value = matrix->Value(row, col);
+      memcpy(dst, &value, sizeof(value));
+    } else if (typeid(matrix->GetDataType().GetElementDataType()) ==
+               typeid(SignedIntegerType)) {
+      switch (matrix->GetDataType().GetElementDataType().GetSize()) {
+      case 1: {
+        int8_t int8Value = matrix->Value(row, col);
+        memcpy(dst, &int8Value, 1);
+      } break;
+      case 2: {
+        int16_t int16Value = matrix->Value(row, col);
+        memcpy(dst, &int16Value, 2);
+      } break;
+      }
+    }
+  }
 
-        DataType const &GetDataType(void) const {
-            return matrix->GetDataType().GetElementDataType();
-        }
+  DataType const &GetDataType(void) const {
+    return matrix->GetDataType().GetElementDataType();
+  }
 
-    private:
-        const cvmatrix *matrix;
-        uint32_t row,col;
+private:
+  const cvmatrix *matrix;
+  uint32_t row, col;
+};
 
-    };
+cvmatrix::cvmatrix(const Object *parent, uint32_t rows, uint32_t cols,
+                   ScalarType const &elementDataType, string name, uint32_t n)
+    : io_data(parent, name, n), dataType(rows, cols, elementDataType) {
+  pimpl_ = new cvmatrix_impl(this, rows, cols, elementDataType, n);
 
-cvmatrix::cvmatrix(const Object* parent,uint32_t rows, uint32_t cols, ScalarType const &elementDataType,string name,uint32_t n): io_data(parent,name,n),dataType(rows,cols,elementDataType) {
-    pimpl_=new cvmatrix_impl(this,rows,cols,elementDataType,n);
-
-    for(uint32_t i=0;i<rows;i++) {
-        for(uint32_t j=0;j<cols;j++) {
-            AppendLogDescription(pimpl_->descriptor->ElementName(i,j),elementDataType);
-            SetValue(i,j,0);
-        }
+  for (uint32_t i = 0; i < rows; i++) {
+    for (uint32_t j = 0; j < cols; j++) {
+      AppendLogDescription(pimpl_->descriptor->ElementName(i, j),
+                           elementDataType);
+      SetValue(i, j, 0);
     }
+  }
 }
 
-cvmatrix::cvmatrix(const Object* parent,const cvmatrix_descriptor *descriptor, ScalarType const &elementDataType,string name,uint32_t n): io_data(parent,name,n),dataType(descriptor->Rows(),descriptor->Cols(),elementDataType) {
-    pimpl_=new cvmatrix_impl(this,descriptor,elementDataType,n);
+cvmatrix::cvmatrix(const Object *parent, const cvmatrix_descriptor *descriptor,
+                   ScalarType const &elementDataType, string name, uint32_t n)
+    : io_data(parent, name, n),
+      dataType(descriptor->Rows(), descriptor->Cols(), elementDataType) {
+  pimpl_ = new cvmatrix_impl(this, descriptor, elementDataType, n);
 
-    for(uint32_t i=0;i<descriptor->Rows();i++) {
-        for(uint32_t j=0;j<descriptor->Cols();j++) {
-            AppendLogDescription(descriptor->ElementName(i,j),elementDataType);
-            SetValue(i,j,0);
-        }
+  for (uint32_t i = 0; i < descriptor->Rows(); i++) {
+    for (uint32_t j = 0; j < descriptor->Cols(); j++) {
+      AppendLogDescription(descriptor->ElementName(i, j), elementDataType);
+      SetValue(i, j, 0);
     }
+  }
 }
 
-cvmatrix::~cvmatrix() {
-    delete pimpl_;
+cvmatrix::~cvmatrix() { delete pimpl_; }
+
+IODataElement *cvmatrix::Element(uint32_t row, uint32_t col) const {
+  return new cvmatrixElement(this, Name(row, col), row, col);
 }
 
-IODataElement* cvmatrix::Element(uint32_t row, uint32_t col) const {
-    return new cvmatrixElement(this,Name(row,col),row,col);
-}
-
-IODataElement* cvmatrix::Element(uint32_t index) const {
-    if(Rows()==1) {
-        return new cvmatrixElement(this,Name(0,index),0,index);
-    } else if(Cols()==1) {
-        return new cvmatrixElement(this,Name(index,0),index,0);
-    } else {
-        Err("matrix is not 1D\n");
-        return nullptr;
-    }
+IODataElement *cvmatrix::Element(uint32_t index) const {
+  if (Rows() == 1) {
+    return new cvmatrixElement(this, Name(0, index), 0, index);
+  } else if (Cols() == 1) {
+    return new cvmatrixElement(this, Name(index, 0), index, 0);
+  } else {
+    Err("matrix is not 1D\n");
+    return nullptr;
+  }
 }
 
 float cvmatrix::Value(uint32_t row, uint32_t col) const {
-    float value;
+  float value;
 
-    if(row>=(uint32_t)pimpl_->mat->rows || col>=(uint32_t)pimpl_->mat->cols) {
-        Warn("index (%i,%i) out of bound (%i,%i)\n",row,col,pimpl_->mat->rows-1,pimpl_->mat->cols-1);
-        return 0;
-    }
+  if (row >= (uint32_t)pimpl_->mat->rows ||
+      col >= (uint32_t)pimpl_->mat->cols) {
+    Warn("index (%i,%i) out of bound (%i,%i)\n", row, col,
+         pimpl_->mat->rows - 1, pimpl_->mat->cols - 1);
+    return 0;
+  }
 
-    GetMutex();
-    value=cvGetReal2D(pimpl_->mat,row,col);
-    ReleaseMutex();
+  GetMutex();
+  value = cvGetReal2D(pimpl_->mat, row, col);
+  ReleaseMutex();
 
-    return value;
+  return value;
 }
 
 float cvmatrix::ValueNoMutex(uint32_t row, uint32_t col) const {
-    if(row>=(uint32_t)pimpl_->mat->rows || col>=(uint32_t)pimpl_->mat->cols) {
-        Warn("index (%i,%i) out of bound (%i,%i)\n",row,col,pimpl_->mat->rows-1,pimpl_->mat->cols-1);
-        return 0;
-    }
+  if (row >= (uint32_t)pimpl_->mat->rows ||
+      col >= (uint32_t)pimpl_->mat->cols) {
+    Warn("index (%i,%i) out of bound (%i,%i)\n", row, col,
+         pimpl_->mat->rows - 1, pimpl_->mat->cols - 1);
+    return 0;
+  }
 
-    return cvGetReal2D(pimpl_->mat,row,col);
+  return cvGetReal2D(pimpl_->mat, row, col);
 }
 
-void cvmatrix::SetValue(uint32_t row, uint32_t col,float value) {
-    if(row>=(uint32_t)pimpl_->mat->rows || col>=(uint32_t)pimpl_->mat->cols) {
-        Warn("index (%i,%i) out of bound (%i,%i)\n",row,col,pimpl_->mat->rows-1,pimpl_->mat->cols-1);
-    } else {
-        GetMutex();
-        cvSetReal2D(pimpl_->mat,row,col,value);
-        ReleaseMutex();
-    }
+void cvmatrix::SetValue(uint32_t row, uint32_t col, float value) {
+  if (row >= (uint32_t)pimpl_->mat->rows ||
+      col >= (uint32_t)pimpl_->mat->cols) {
+    Warn("index (%i,%i) out of bound (%i,%i)\n", row, col,
+         pimpl_->mat->rows - 1, pimpl_->mat->cols - 1);
+  } else {
+    GetMutex();
+    cvSetReal2D(pimpl_->mat, row, col, value);
+    ReleaseMutex();
+  }
 }
 
-void cvmatrix::SetValueNoMutex(uint32_t row, uint32_t col,float value) {
-    if(row>=(uint32_t)pimpl_->mat->rows || col>=(uint32_t)pimpl_->mat->cols) {
-        Warn("index (%i,%i) out of bound (%i,%i)\n",row,col,pimpl_->mat->rows-1,pimpl_->mat->cols-1);
-    } else {
-        cvSetReal2D(pimpl_->mat,row,col,value);
-    }
+void cvmatrix::SetValueNoMutex(uint32_t row, uint32_t col, float value) {
+  if (row >= (uint32_t)pimpl_->mat->rows ||
+      col >= (uint32_t)pimpl_->mat->cols) {
+    Warn("index (%i,%i) out of bound (%i,%i)\n", row, col,
+         pimpl_->mat->rows - 1, pimpl_->mat->cols - 1);
+  } else {
+    cvSetReal2D(pimpl_->mat, row, col, value);
+  }
 }
 
-CvMat* cvmatrix::getCvMat(void) const {
-    return pimpl_->mat;
+CvMat *cvmatrix::getCvMat(void) const { return pimpl_->mat; }
+
+void cvmatrix::CopyDatas(char *dst) const {
+  GetMutex();
+  // printf("%f %x %i\n",cvGetReal2D(pimpl_->mat,0,0),dst,Size());
+  memcpy(dst, pimpl_->mat->data.ptr, dataType.GetSize());
+  ReleaseMutex();
 }
 
-void cvmatrix::CopyDatas(char* dst) const {
-    GetMutex();
-    //printf("%f %x %i\n",cvGetReal2D(pimpl_->mat,0,0),dst,Size());
-    memcpy(dst,pimpl_->mat->data.ptr,dataType.GetSize());
-    ReleaseMutex();
-}
+uint32_t cvmatrix::Rows(void) const { return pimpl_->mat->rows; }
 
-uint32_t cvmatrix::Rows(void) const {
-    return pimpl_->mat->rows;
-}
-
-uint32_t cvmatrix::Cols(void) const {
-    return pimpl_->mat->cols;
-}
+uint32_t cvmatrix::Cols(void) const { return pimpl_->mat->cols; }
 
 string cvmatrix::Name(uint32_t row, uint32_t col) const {
-    return pimpl_->descriptor->ElementName(row,col);
+  return pimpl_->descriptor->ElementName(row, col);
 }
-
 
 } // end namespace core
Index: trunk/lib/FlairCore/src/cvmatrix.h
===================================================================
--- trunk/lib/FlairCore/src/cvmatrix.h	(revision 14)
+++ trunk/lib/FlairCore/src/cvmatrix.h	(revision 15)
@@ -21,192 +21,199 @@
 struct CvMat;
 
-namespace flair { namespace core {
-
-    /*! \class cvmatrix
-    *
-    * \brief Class defining a matrix of kind CvMat
-    *
-    * CvMat is a matrix struct defined in OpenCV.
-    *
-    */
-    class cvmatrix: public io_data {
-    public:
-        class Type: public DataType {
-        public:
-            Type(size_t _nbRows,size_t _nbCols,ScalarType const &_elementDataType):nbRows(_nbRows),nbCols(_nbCols),elementDataType(_elementDataType) {}
-            size_t GetSize() const {
-                return nbRows*nbCols*elementDataType.GetSize();
-            }
-            std::string GetDescription() const {return "matrix";}
-            size_t GetNbRows() const {return nbRows;}
-            size_t GetNbCols() const {return nbCols;}
-            ScalarType const &GetElementDataType() const {return elementDataType;}
-
-        private:
-            size_t nbRows,nbCols;
-            ScalarType const &elementDataType;
-        };
-
-        /*!
-        * \brief Constructor
-        *
-        * Construct an io_data representing a CvMat. \n
-        * It uses a cvmatrix_descriptor to get size and elements' names. \n
-        * Names are used for graphs and logs.
-        *
-        * \param parent parent
-        * \param descriptor matrix description
-        * \param type type of matrix elements
-        * \param name name
-        * \param n number of samples
-        */
-        cvmatrix(const Object* parent,const cvmatrix_descriptor *descriptor, ScalarType const &elementDataType,std::string name="",uint32_t n=1);
-
-        /*!
-        * \brief Constructor
-        *
-        * Construct an io_data representing a CvMat. \n
-        * Elements are unamed.
-        *
-        * \param parent parent
-        * \param rows matrix rows
-        * \param cols matrix cols
-        * \param type type of matrix elements
-        * \param name name
-        * \param n number of samples
-        */
-        cvmatrix(const Object* parent,uint32_t rows, uint32_t cols, ScalarType const &elementDataType,std::string name="",uint32_t n=1);
-
-        /*!
-        * \brief Destructor
-        *
-        */
-        ~cvmatrix();
-
-        /*!
-        * \brief Element value
-        *
-        * Element is accessed by locking and unlocking the io_data Mutex.
-        *
-        * \param row element row
-        * \param col element col
-        *
-        * \return element value
-        */
-        float Value(uint32_t row, uint32_t col) const;
-
-        /*!
-        * \brief Element value
-        *
-        * Element is not accessed by locking and unlocking the io_data Mutex. \n
-        * Thus, this function should be called with Mutex locked. \n
-        * This function is usefull when multiple successive access are done to the
-        * elments of the matrix. It avoids unnecessary locking and unlocking.
-        *
-        * \param row element row
-        * \param col element col
-        *
-        * \return element value
-        */
-        float ValueNoMutex(uint32_t row, uint32_t col) const;
-
-        /*!
-        * \brief Set element value
-        *
-        * Element is accessed by locking and unlocking the io_data Mutex.
-        *
-        * \param row element row
-        * \param col element col
-        * \param value element value
-        */
-        void SetValue(uint32_t row, uint32_t col,float value);
-
-        /*!
-        * \brief Set element value
-        *
-        * Element is not accessed by locking and unlocking the io_data Mutex. \n
-        * Thus, this function should be called with Mutex locked. \n
-        * This function is usefull when multiple successive access are done to the
-        * elments of the matrix. It avoids unnecessary locking and unlocking.
-        *
-        * \param row element row
-        * \param col element col
-        * \param value element value
-        */
-        void SetValueNoMutex(uint32_t row, uint32_t col,float value);
-
-        /*!
-        * \brief get CvMat
-        *
-        * The io_data Mutex must be used by the user.
-        */
-        CvMat* getCvMat(void) const;
-
-        /*!
-        * \brief Element name
-        *
-        * If cvmatrix was created without cvmatrix_descriptor, element name is empty.
-        *
-        * \param row element row
-        * \param col element col
-        *
-        * \return element name
-        */
-        std::string Name(uint32_t row, uint32_t col) const;
-
-        /*!
-        * \brief Element
-        *
-        * Get a pointer to a specific element. This pointer can be used for plotting.
-        *
-        * \param row element row
-        * \param col element col
-        *
-        * \return pointer to the element
-        */
-        IODataElement* Element(uint32_t row, uint32_t col) const;
-
-        /*!
-        * \brief Element
-        *
-        * Get a pointer to a specific element. This pointer can be used for plotting. \n
-        * This function can be used for a 1D matrix.
-        *
-        * \param index element index
-        *
-        * \return pointer to the element
-        */
-        IODataElement* Element(uint32_t index) const;
-
-        /*!
-        * \brief Number of rows
-        *
-        * \return rows
-        */
-        uint32_t Rows(void) const;
-
-        /*!
-        * \brief Number of colomns
-        *
-        * \return colomns
-        */
-        uint32_t Cols(void) const;
-
-        Type const &GetDataType() const {return dataType;};
-
-    private:
-        /*!
-        * \brief Copy datas
-        *
-        * Reimplemented from io_data. \n
-        * See io_data::CopyDatas.
-        *
-        * \param dst destination buffer
-        */
-        void CopyDatas(char* dst) const;
-
-        class cvmatrix_impl* pimpl_;
-        Type dataType;
-    };
+namespace flair {
+namespace core {
+
+/*! \class cvmatrix
+*
+* \brief Class defining a matrix of kind CvMat
+*
+* CvMat is a matrix struct defined in OpenCV.
+*
+*/
+class cvmatrix : public io_data {
+public:
+  class Type : public DataType {
+  public:
+    Type(size_t _nbRows, size_t _nbCols, ScalarType const &_elementDataType)
+        : nbRows(_nbRows), nbCols(_nbCols), elementDataType(_elementDataType) {}
+    size_t GetSize() const {
+      return nbRows * nbCols * elementDataType.GetSize();
+    }
+    std::string GetDescription() const { return "matrix"; }
+    size_t GetNbRows() const { return nbRows; }
+    size_t GetNbCols() const { return nbCols; }
+    ScalarType const &GetElementDataType() const { return elementDataType; }
+
+  private:
+    size_t nbRows, nbCols;
+    ScalarType const &elementDataType;
+  };
+
+  /*!
+  * \brief Constructor
+  *
+  * Construct an io_data representing a CvMat. \n
+  * It uses a cvmatrix_descriptor to get size and elements' names. \n
+  * Names are used for graphs and logs.
+  *
+  * \param parent parent
+  * \param descriptor matrix description
+  * \param type type of matrix elements
+  * \param name name
+  * \param n number of samples
+  */
+  cvmatrix(const Object *parent, const cvmatrix_descriptor *descriptor,
+           ScalarType const &elementDataType, std::string name = "",
+           uint32_t n = 1);
+
+  /*!
+  * \brief Constructor
+  *
+  * Construct an io_data representing a CvMat. \n
+  * Elements are unamed.
+  *
+  * \param parent parent
+  * \param rows matrix rows
+  * \param cols matrix cols
+  * \param type type of matrix elements
+  * \param name name
+  * \param n number of samples
+  */
+  cvmatrix(const Object *parent, uint32_t rows, uint32_t cols,
+           ScalarType const &elementDataType, std::string name = "",
+           uint32_t n = 1);
+
+  /*!
+  * \brief Destructor
+  *
+  */
+  ~cvmatrix();
+
+  /*!
+  * \brief Element value
+  *
+  * Element is accessed by locking and unlocking the io_data Mutex.
+  *
+  * \param row element row
+  * \param col element col
+  *
+  * \return element value
+  */
+  float Value(uint32_t row, uint32_t col) const;
+
+  /*!
+  * \brief Element value
+  *
+  * Element is not accessed by locking and unlocking the io_data Mutex. \n
+  * Thus, this function should be called with Mutex locked. \n
+  * This function is usefull when multiple successive access are done to the
+  * elments of the matrix. It avoids unnecessary locking and unlocking.
+  *
+  * \param row element row
+  * \param col element col
+  *
+  * \return element value
+  */
+  float ValueNoMutex(uint32_t row, uint32_t col) const;
+
+  /*!
+  * \brief Set element value
+  *
+  * Element is accessed by locking and unlocking the io_data Mutex.
+  *
+  * \param row element row
+  * \param col element col
+  * \param value element value
+  */
+  void SetValue(uint32_t row, uint32_t col, float value);
+
+  /*!
+  * \brief Set element value
+  *
+  * Element is not accessed by locking and unlocking the io_data Mutex. \n
+  * Thus, this function should be called with Mutex locked. \n
+  * This function is usefull when multiple successive access are done to the
+  * elments of the matrix. It avoids unnecessary locking and unlocking.
+  *
+  * \param row element row
+  * \param col element col
+  * \param value element value
+  */
+  void SetValueNoMutex(uint32_t row, uint32_t col, float value);
+
+  /*!
+  * \brief get CvMat
+  *
+  * The io_data Mutex must be used by the user.
+  */
+  CvMat *getCvMat(void) const;
+
+  /*!
+  * \brief Element name
+  *
+  * If cvmatrix was created without cvmatrix_descriptor, element name is empty.
+  *
+  * \param row element row
+  * \param col element col
+  *
+  * \return element name
+  */
+  std::string Name(uint32_t row, uint32_t col) const;
+
+  /*!
+  * \brief Element
+  *
+  * Get a pointer to a specific element. This pointer can be used for plotting.
+  *
+  * \param row element row
+  * \param col element col
+  *
+  * \return pointer to the element
+  */
+  IODataElement *Element(uint32_t row, uint32_t col) const;
+
+  /*!
+  * \brief Element
+  *
+  * Get a pointer to a specific element. This pointer can be used for plotting.
+  *\n
+  * This function can be used for a 1D matrix.
+  *
+  * \param index element index
+  *
+  * \return pointer to the element
+  */
+  IODataElement *Element(uint32_t index) const;
+
+  /*!
+  * \brief Number of rows
+  *
+  * \return rows
+  */
+  uint32_t Rows(void) const;
+
+  /*!
+  * \brief Number of colomns
+  *
+  * \return colomns
+  */
+  uint32_t Cols(void) const;
+
+  Type const &GetDataType() const { return dataType; };
+
+private:
+  /*!
+  * \brief Copy datas
+  *
+  * Reimplemented from io_data. \n
+  * See io_data::CopyDatas.
+  *
+  * \param dst destination buffer
+  */
+  void CopyDatas(char *dst) const;
+
+  class cvmatrix_impl *pimpl_;
+  Type dataType;
+};
 
 } // end namespace core
Index: trunk/lib/FlairCore/src/cvmatrix_descriptor.cpp
===================================================================
--- trunk/lib/FlairCore/src/cvmatrix_descriptor.cpp	(revision 14)
+++ trunk/lib/FlairCore/src/cvmatrix_descriptor.cpp	(revision 15)
@@ -20,48 +20,49 @@
 using std::string;
 
-namespace flair { namespace core {
+namespace flair {
+namespace core {
 
 cvmatrix_descriptor::cvmatrix_descriptor(uint32_t rows, uint32_t cols) {
-    this->rows=rows;
-    this->cols=cols;
+  this->rows = rows;
+  this->cols = cols;
 
-    if(rows==0 || cols==0) getFrameworkManager()->Err("rows and cols must be >0\n");
+  if (rows == 0 || cols == 0)
+    getFrameworkManager()->Err("rows and cols must be >0\n");
 
-    element_names=(string**)malloc(rows*cols*sizeof(string*));
-    for(uint32_t i=0; i<rows*cols; i++) {
-        element_names[i]=new string();
-    }
+  element_names = (string **)malloc(rows * cols * sizeof(string *));
+  for (uint32_t i = 0; i < rows * cols; i++) {
+    element_names[i] = new string();
+  }
 }
 
 cvmatrix_descriptor::~cvmatrix_descriptor() {
-    for(uint32_t i=0; i<rows*cols; i++) {
-        delete element_names[i];
-    }
-    free(element_names);
+  for (uint32_t i = 0; i < rows * cols; i++) {
+    delete element_names[i];
+  }
+  free(element_names);
 }
 
-void cvmatrix_descriptor::SetElementName(uint32_t row, uint32_t col,string name) {
-    if(row>=rows || col>=cols) {
-        getFrameworkManager()->Err("index out of bound %s (%i,%i), range (%i,%i)\n",name.c_str(),row,col,rows-1,cols-1);
-        return;
-    }
-    *element_names[row*cols+col]=name;
+void cvmatrix_descriptor::SetElementName(uint32_t row, uint32_t col,
+                                         string name) {
+  if (row >= rows || col >= cols) {
+    getFrameworkManager()->Err("index out of bound %s (%i,%i), range (%i,%i)\n",
+                               name.c_str(), row, col, rows - 1, cols - 1);
+    return;
+  }
+  *element_names[row * cols + col] = name;
 }
 
 string cvmatrix_descriptor::ElementName(uint32_t row, uint32_t col) const {
-    if(row>=rows || col>=cols) {
-        getFrameworkManager()->Err("index out of bound (%i,%i), range (%i,%i)\n",row,col,rows-1,cols-1);
-        return *element_names[0];//safe value...
-    }
-    return *element_names[row*cols+col];
+  if (row >= rows || col >= cols) {
+    getFrameworkManager()->Err("index out of bound (%i,%i), range (%i,%i)\n",
+                               row, col, rows - 1, cols - 1);
+    return *element_names[0]; // safe value...
+  }
+  return *element_names[row * cols + col];
 }
 
-uint32_t cvmatrix_descriptor::Rows() const {
-    return rows;
-}
+uint32_t cvmatrix_descriptor::Rows() const { return rows; }
 
-uint32_t cvmatrix_descriptor::Cols() const {
-    return cols;
-}
+uint32_t cvmatrix_descriptor::Cols() const { return cols; }
 
 } // end namespace core
Index: trunk/lib/FlairCore/src/cvmatrix_descriptor.h
===================================================================
--- trunk/lib/FlairCore/src/cvmatrix_descriptor.h	(revision 14)
+++ trunk/lib/FlairCore/src/cvmatrix_descriptor.h	(revision 15)
@@ -16,70 +16,69 @@
 #include <string>
 
-namespace flair { namespace core
-{
+namespace flair {
+namespace core {
 
-    /*! \class cvmatrix_descriptor
-    *
-    * \brief Class describing cvmatrix elements, for log and graphs purpose
-    *
-    * This class allows to give a name to matrix elements. These names
-    * will be used in graphs and logs.
-    */
-    class cvmatrix_descriptor {
-        public:
-            /*!
-            * \brief Constructor
-            *
-            * Construct a matrix descriptor.
-            *
-            * \param rows matrix rows
-            * \param cols matrix cols
-            */
-            cvmatrix_descriptor(uint32_t rows, uint32_t cols);
+/*! \class cvmatrix_descriptor
+*
+* \brief Class describing cvmatrix elements, for log and graphs purpose
+*
+* This class allows to give a name to matrix elements. These names
+* will be used in graphs and logs.
+*/
+class cvmatrix_descriptor {
+public:
+  /*!
+  * \brief Constructor
+  *
+  * Construct a matrix descriptor.
+  *
+  * \param rows matrix rows
+  * \param cols matrix cols
+  */
+  cvmatrix_descriptor(uint32_t rows, uint32_t cols);
 
-            /*!
-            * \brief Destructor
-            *
-            */
-            ~cvmatrix_descriptor();
+  /*!
+  * \brief Destructor
+  *
+  */
+  ~cvmatrix_descriptor();
 
-            /*!
-            * \brief Set element name
-            *
-            * \param row element row
-            * \param col element col
-            * \param name element name
-            */
-            void SetElementName(uint32_t row, uint32_t col,std::string name);
+  /*!
+  * \brief Set element name
+  *
+  * \param row element row
+  * \param col element col
+  * \param name element name
+  */
+  void SetElementName(uint32_t row, uint32_t col, std::string name);
 
-            /*!
-            * \brief Element name
-            *
-            * \param row element row
-            * \param col element col
-            *
-            * \return element name
-            */
-            std::string ElementName(uint32_t row, uint32_t col) const;
+  /*!
+  * \brief Element name
+  *
+  * \param row element row
+  * \param col element col
+  *
+  * \return element name
+  */
+  std::string ElementName(uint32_t row, uint32_t col) const;
 
-            /*!
-            * \brief Number of rows
-            *
-            * \return rows
-            */
-            uint32_t Rows(void) const;
+  /*!
+  * \brief Number of rows
+  *
+  * \return rows
+  */
+  uint32_t Rows(void) const;
 
-            /*!
-            * \brief Number of colomns
-            *
-            * \return colomns
-            */
-            uint32_t Cols(void) const;
+  /*!
+  * \brief Number of colomns
+  *
+  * \return colomns
+  */
+  uint32_t Cols(void) const;
 
-        private:
-            uint32_t rows,cols;
-            std::string **element_names;
-
-    };
+private:
+  uint32_t rows, cols;
+  std::string **element_names;
+};
 
 } // end namespace core
Index: trunk/lib/FlairCore/src/cvmatrix_impl.cpp
===================================================================
--- trunk/lib/FlairCore/src/cvmatrix_impl.cpp	(revision 14)
+++ trunk/lib/FlairCore/src/cvmatrix_impl.cpp	(revision 15)
@@ -24,46 +24,56 @@
 using namespace flair::core;
 
-cvmatrix_impl::cvmatrix_impl(cvmatrix* self,int rows, int cols,flair::core::ScalarType const &_elementDataType,int n):elementDataType(_elementDataType) {
-    descriptor=new cvmatrix_descriptor(rows,cols);
-    Init(self,n);
+cvmatrix_impl::cvmatrix_impl(cvmatrix *self, int rows, int cols,
+                             flair::core::ScalarType const &_elementDataType,
+                             int n)
+    : elementDataType(_elementDataType) {
+  descriptor = new cvmatrix_descriptor(rows, cols);
+  Init(self, n);
 }
 
-cvmatrix_impl::cvmatrix_impl(cvmatrix* self,const cvmatrix_descriptor *descriptor,flair::core::ScalarType const &_elementDataType,int  n):elementDataType(_elementDataType) {
-    this->descriptor=descriptor;
-    Init(self,n);
+cvmatrix_impl::cvmatrix_impl(cvmatrix *self,
+                             const cvmatrix_descriptor *descriptor,
+                             flair::core::ScalarType const &_elementDataType,
+                             int n)
+    : elementDataType(_elementDataType) {
+  this->descriptor = descriptor;
+  Init(self, n);
 }
 
-void cvmatrix_impl::Init(cvmatrix* self,int n) {
-    this->self=self;
+void cvmatrix_impl::Init(cvmatrix *self, int n) {
+  this->self = self;
 
-    mat=nullptr;
-    try {
-        ScalarType const &scalarType=dynamic_cast<ScalarType const &>(elementDataType);
-        if (typeid(scalarType)==typeid(FloatType)) {
-            mat=cvCreateMat(descriptor->Rows(),descriptor->Cols(),CV_32FC1);
-        } else if (typeid(scalarType)==typeid(SignedIntegerType)) {
-            switch(elementDataType.GetSize()) {
-            case 1:
-                mat=cvCreateMat(descriptor->Rows(),descriptor->Cols(),CV_8SC1);
-                break;
-            case 2:
-                mat=cvCreateMat(descriptor->Rows(),descriptor->Cols(),CV_16SC1);
-                break;
-            default:
-                self->Err("unsupported integer scalar type\n");
-            }
-        } else {
-            self->Err("unsupported scalar type\n");
-        }
-    } catch(std::bad_cast e) {
-        self->Err("type is not a scalar\n");
+  mat = nullptr;
+  try {
+    ScalarType const &scalarType =
+        dynamic_cast<ScalarType const &>(elementDataType);
+    if (typeid(scalarType) == typeid(FloatType)) {
+      mat = cvCreateMat(descriptor->Rows(), descriptor->Cols(), CV_32FC1);
+    } else if (typeid(scalarType) == typeid(SignedIntegerType)) {
+      switch (elementDataType.GetSize()) {
+      case 1:
+        mat = cvCreateMat(descriptor->Rows(), descriptor->Cols(), CV_8SC1);
+        break;
+      case 2:
+        mat = cvCreateMat(descriptor->Rows(), descriptor->Cols(), CV_16SC1);
+        break;
+      default:
+        self->Err("unsupported integer scalar type\n");
+      }
+    } else {
+      self->Err("unsupported scalar type\n");
     }
+  } catch (std::bad_cast e) {
+    self->Err("type is not a scalar\n");
+  }
 
-    if(mat==nullptr) self->Err("allocating matrix failed\n");
-    if(n>1) self->Warn("n>1 not supported\n");
+  if (mat == nullptr)
+    self->Err("allocating matrix failed\n");
+  if (n > 1)
+    self->Warn("n>1 not supported\n");
 }
 
 cvmatrix_impl::~cvmatrix_impl() {
-    cvReleaseMat(&mat);
-    delete descriptor;
+  cvReleaseMat(&mat);
+  delete descriptor;
 }
Index: trunk/lib/FlairCore/src/io_data.cpp
===================================================================
--- trunk/lib/FlairCore/src/io_data.cpp	(revision 14)
+++ trunk/lib/FlairCore/src/io_data.cpp	(revision 15)
@@ -21,5 +21,6 @@
 using std::string;
 
-namespace flair { namespace core {
+namespace flair {
+namespace core {
 
 DummyType dummyType;
@@ -28,40 +29,38 @@
 SignedIntegerType Int16Type(16);
 
-io_data::io_data(const Object* parent,string name,int n): Mutex(parent,name) {
-    pimpl_=new io_data_impl(this,n);
+io_data::io_data(const Object *parent, string name, int n)
+    : Mutex(parent, name) {
+  pimpl_ = new io_data_impl(this, n);
 }
 
-io_data::~io_data() {
-    delete pimpl_;
-}
+io_data::~io_data() { delete pimpl_; }
 
-void io_data::AppendLogDescription(string description,DataType const &datatype) {
-    pimpl_->AppendLogDescription(description,datatype);
+void io_data::AppendLogDescription(string description,
+                                   DataType const &datatype) {
+  pimpl_->AppendLogDescription(description, datatype);
 }
 
 void io_data::SetDataTime(Time time) {
-    GetMutex();
-    pimpl_->time=time;
-    ReleaseMutex();
+  GetMutex();
+  pimpl_->time = time;
+  ReleaseMutex();
 }
 
 Time io_data::DataTime(void) const {
-    Time tmp;
-    GetMutex();
-    tmp=pimpl_->time;
-    ReleaseMutex();
-    return tmp;
+  Time tmp;
+  GetMutex();
+  tmp = pimpl_->time;
+  ReleaseMutex();
+  return tmp;
 }
 
-const io_data* io_data::Prev(int n) const {
-    if(n>0)
-        return prev->Prev(n-1);
-    else
-        return this;
+const io_data *io_data::Prev(int n) const {
+  if (n > 0)
+    return prev->Prev(n - 1);
+  else
+    return this;
 }
 
-void io_data::SetPtrToCircle(void **ptr) {
-    pimpl_->circle_ptr=ptr;
-}
+void io_data::SetPtrToCircle(void **ptr) { pimpl_->circle_ptr = ptr; }
 
 } // end namespace core
Index: trunk/lib/FlairCore/src/io_data.h
===================================================================
--- trunk/lib/FlairCore/src/io_data.h	(revision 14)
+++ trunk/lib/FlairCore/src/io_data.h	(revision 15)
@@ -19,150 +19,157 @@
 class io_data_impl;
 
-namespace flair { namespace core {
+namespace flair {
+namespace core {
 
-    class Object;
+class Object;
 
-    class DataType {
-    public:
-        virtual std::string GetDescription() const =0;
-        //size in bytes
-        virtual size_t GetSize() const =0;
-    };
+class DataType {
+public:
+  virtual std::string GetDescription() const = 0;
+  // size in bytes
+  virtual size_t GetSize() const = 0;
+};
 
-    class DummyType: public DataType {
-    public:
-        size_t GetSize() const {return 0;}
-        std::string GetDescription() const {return "dummy";};
-    };
-    extern DummyType dummyType;
+class DummyType : public DataType {
+public:
+  size_t GetSize() const { return 0; }
+  std::string GetDescription() const { return "dummy"; };
+};
+extern DummyType dummyType;
 
-    class ScalarType: public DataType {
-    public:
-        ScalarType(size_t _size):size(_size) {}
-        size_t GetSize() const {return size;}
-        virtual std::string GetDescription() const {return "scalar";};
-    private:
-        size_t size;
-    };
+class ScalarType : public DataType {
+public:
+  ScalarType(size_t _size) : size(_size) {}
+  size_t GetSize() const { return size; }
+  virtual std::string GetDescription() const { return "scalar"; };
 
-    class SignedIntegerType: public ScalarType {
-    public:
-        SignedIntegerType(size_t sizeInBits):ScalarType(sizeInBits/8){}
-        std::string GetDescription() const {return "int"+std::to_string(GetSize()*8)+"_t";};
-    };
-    extern SignedIntegerType Int8Type;
-    extern SignedIntegerType Int16Type;
+private:
+  size_t size;
+};
 
-    class FloatType: public ScalarType {
-    public:
-        FloatType():ScalarType(4){}
-        std::string GetDescription() const {return "float";};
-    };
-    extern FloatType floatType;
+class SignedIntegerType : public ScalarType {
+public:
+  SignedIntegerType(size_t sizeInBits) : ScalarType(sizeInBits / 8) {}
+  std::string GetDescription() const {
+    return "int" + std::to_string(GetSize() * 8) + "_t";
+  };
+};
+extern SignedIntegerType Int8Type;
+extern SignedIntegerType Int16Type;
 
+class FloatType : public ScalarType {
+public:
+  FloatType() : ScalarType(4) {}
+  std::string GetDescription() const { return "float"; };
+};
+extern FloatType floatType;
 
-    /*! \class io_data
-    *
-    * \brief Abstract class for data types.
-    *
-    * Use this class to define a custom data type. Data types ares used for logging and graphs. \n
-    * The reimplemented class must call SetSize() in its constructor. \n
-    * io_data can be constructed with n samples (see io_data::io_data).
-    * In this case, old samples can be accessed throug io_data::Prev.
-    */
-    class io_data: public Mutex {
-        friend class IODevice;
-        friend class ::IODevice_impl;
-        friend class ::io_data_impl;
+/*! \class io_data
+*
+* \brief Abstract class for data types.
+*
+* Use this class to define a custom data type. Data types ares used for logging
+*and graphs. \n
+* The reimplemented class must call SetSize() in its constructor. \n
+* io_data can be constructed with n samples (see io_data::io_data).
+* In this case, old samples can be accessed throug io_data::Prev.
+*/
+class io_data : public Mutex {
+  friend class IODevice;
+  friend class ::IODevice_impl;
+  friend class ::io_data_impl;
 
-        public:
-            /*!
-            * \brief Constructor
-            *
-            * Construct an io_data. \n
-            *
-            * \param parent parent
-            * \param name name
-            * \param n number of samples
-            */
-            io_data(const Object* parent,std::string name,int n);
+public:
+  /*!
+  * \brief Constructor
+  *
+  * Construct an io_data. \n
+  *
+  * \param parent parent
+  * \param name name
+  * \param n number of samples
+  */
+  io_data(const Object *parent, std::string name, int n);
 
-            /*!
-            * \brief Destructor
-            *
-            */
-            virtual ~io_data();
+  /*!
+  * \brief Destructor
+  *
+  */
+  virtual ~io_data();
 
-            /*!
-            * \brief Set data time
-            *
-            * \param time time
-            */
-            void SetDataTime(Time time);
+  /*!
+  * \brief Set data time
+  *
+  * \param time time
+  */
+  void SetDataTime(Time time);
 
-            /*!
-            * \brief Data time
-            *
-            * \return data time
-            */
-            Time DataTime(void) const;
+  /*!
+  * \brief Data time
+  *
+  * \return data time
+  */
+  Time DataTime(void) const;
 
-            /*!
-            * \brief Previous data
-            *
-            * Access previous data. io_data must have been constructed with
-            * n>1, io_data::SetPtrToCircle must have been set and
-            * io_data::prev must have been allocated.
-            *
-            * \param n previous data number
-            *
-            * \return previous data
-            */
-            const io_data* Prev(int n) const;
+  /*!
+  * \brief Previous data
+  *
+  * Access previous data. io_data must have been constructed with
+  * n>1, io_data::SetPtrToCircle must have been set and
+  * io_data::prev must have been allocated.
+  *
+  * \param n previous data number
+  *
+  * \return previous data
+  */
+  const io_data *Prev(int n) const;
 
-            virtual DataType const&GetDataType() const =0;
+  virtual DataType const &GetDataType() const = 0;
 
-        protected:
-            /*!
-            * \brief Specify the description of the reimplemented class data's
-            *
-            *  This method must be called in the constructor of the reimplemented class, once by element. \n
-            *  Each element description must be called in the same order as CopyDatas put the datas in the buffer. \n
-            *  The description will be used for the log descriptor file.
-            *
-            * \param description description of the element
-            * \param datatype type of the element
-            */
-            void AppendLogDescription(std::string description, DataType const &datatype);
+protected:
+  /*!
+  * \brief Specify the description of the reimplemented class data's
+  *
+  *  This method must be called in the constructor of the reimplemented class,
+  *once by element. \n
+  *  Each element description must be called in the same order as CopyDatas put
+  *the datas in the buffer. \n
+  *  The description will be used for the log descriptor file.
+  *
+  * \param description description of the element
+  * \param datatype type of the element
+  */
+  void AppendLogDescription(std::string description, DataType const &datatype);
 
-            /*!
-            * \brief Set the datas to circle
-            *
-            * \param ptr pointer to the data to circle
-            */
-            void SetPtrToCircle(void **ptr);
+  /*!
+  * \brief Set the datas to circle
+  *
+  * \param ptr pointer to the data to circle
+  */
+  void SetPtrToCircle(void **ptr);
 
-            /*!
-            * \brief Pointer to previous data
-            *
-            * Reimplemented class must allocate this pointer if n>1. \n
-            * Pointer must be allocated with the same kind of reimplemented class.
-            */
-            io_data* prev;
+  /*!
+  * \brief Pointer to previous data
+  *
+  * Reimplemented class must allocate this pointer if n>1. \n
+  * Pointer must be allocated with the same kind of reimplemented class.
+  */
+  io_data *prev;
 
-        private:
-            /*!
-            * \brief Copy datas
-            *
-            * This method is automatically called by IODevice::ProcessUpdate to log io_data datas. \n
-            * This method must be reimplemented, in order to copy the datas to the logs.
-            * Copied datas must be of size io_data::Size.
-            *
-            * \param dst destination buffer
-            */
-            virtual void CopyDatas(char* dst) const =0;
+private:
+  /*!
+  * \brief Copy datas
+  *
+  * This method is automatically called by IODevice::ProcessUpdate to log
+  *io_data datas. \n
+  * This method must be reimplemented, in order to copy the datas to the logs.
+  * Copied datas must be of size io_data::Size.
+  *
+  * \param dst destination buffer
+  */
+  virtual void CopyDatas(char *dst) const = 0;
 
-            io_data_impl *pimpl_;
-    };
+  io_data_impl *pimpl_;
+};
 
 } // end namespace core
Index: trunk/lib/FlairCore/src/io_data_impl.cpp
===================================================================
--- trunk/lib/FlairCore/src/io_data_impl.cpp	(revision 14)
+++ trunk/lib/FlairCore/src/io_data_impl.cpp	(revision 15)
@@ -23,56 +23,56 @@
 using namespace flair::core;
 
-io_data_impl::io_data_impl(io_data* self,int n) {
-    this->self=self;
-    this->n=n;
-    if(n<1) self->Err("n doit être >0\n");
-    size=0;
-    is_consistent=false;
-    circle_ptr=NULL;
+io_data_impl::io_data_impl(io_data *self, int n) {
+  this->self = self;
+  this->n = n;
+  if (n < 1)
+    self->Err("n doit être >0\n");
+  size = 0;
+  is_consistent = false;
+  circle_ptr = NULL;
 }
 
 io_data_impl::~io_data_impl() {}
 
-void io_data_impl::AppendLogDescription(string description,DataType const &datatype) {
-    description+=" ("+datatype.GetDescription()+")";
-    descriptors.push_back(description);
+void io_data_impl::AppendLogDescription(string description,
+                                        DataType const &datatype) {
+  description += " (" + datatype.GetDescription() + ")";
+  descriptors.push_back(description);
 }
 
-void io_data_impl::WriteLogDescriptor(std::fstream& desc_file,int *index) {
-    for(size_t i=0;i<descriptors.size();i++) {
-        desc_file << (*index)++ << ": " << self->ObjectName() << " - " << descriptors.at(i) << "\n";
-    }
+void io_data_impl::WriteLogDescriptor(std::fstream &desc_file, int *index) {
+  for (size_t i = 0; i < descriptors.size(); i++) {
+    desc_file << (*index)++ << ": " << self->ObjectName() << " - "
+              << descriptors.at(i) << "\n";
+  }
 }
 
 void io_data_impl::PrintLogDescriptor(void) {
-    for(size_t i=0;i<descriptors.size();i++) {
-        Printf("    %s\n",descriptors.at(i).c_str());
-    }
+  for (size_t i = 0; i < descriptors.size(); i++) {
+    Printf("    %s\n", descriptors.at(i).c_str());
+  }
 }
 
 void io_data_impl::Circle(void) {
-    if(n>1) {
-        self->GetMutex();
+  if (n > 1) {
+    self->GetMutex();
 
-        void* tmp=*self->Prev(n-1)->pimpl_->circle_ptr;
+    void *tmp = *self->Prev(n - 1)->pimpl_->circle_ptr;
 
-        for(int i=0;i<n-1;i++) {
-            //printf("%i\n",i);
-            *(self->Prev(n-1-i)->pimpl_->circle_ptr)=*(self->Prev(n-2-i)->pimpl_->circle_ptr);
-            self->Prev(n-1-i)->pimpl_->is_consistent=self->Prev(n-2-i)->pimpl_->is_consistent;
-            self->Prev(n-1-i)->pimpl_->time=self->Prev(n-2-i)->pimpl_->time;
-        }
-        *circle_ptr=tmp;
-        is_consistent=false;
-        self->ReleaseMutex();
-
+    for (int i = 0; i < n - 1; i++) {
+      // printf("%i\n",i);
+      *(self->Prev(n - 1 - i)->pimpl_->circle_ptr) =
+          *(self->Prev(n - 2 - i)->pimpl_->circle_ptr);
+      self->Prev(n - 1 - i)->pimpl_->is_consistent =
+          self->Prev(n - 2 - i)->pimpl_->is_consistent;
+      self->Prev(n - 1 - i)->pimpl_->time = self->Prev(n - 2 - i)->pimpl_->time;
     }
+    *circle_ptr = tmp;
+    is_consistent = false;
+    self->ReleaseMutex();
+  }
 }
 
-bool io_data_impl::IsConsistent(void) {
-    return is_consistent;
-}
+bool io_data_impl::IsConsistent(void) { return is_consistent; }
 
-void io_data_impl::SetConsistent(bool status) {
-    is_consistent=status;
-}
+void io_data_impl::SetConsistent(bool status) { is_consistent = status; }
Index: trunk/lib/FlairCore/src/ui_com.cpp
===================================================================
--- trunk/lib/FlairCore/src/ui_com.cpp	(revision 14)
+++ trunk/lib/FlairCore/src/ui_com.cpp	(revision 15)
@@ -39,562 +39,535 @@
 using namespace flair::gui;
 
-ui_com::ui_com(const Object *parent,UDTSOCKET sock): Thread(parent,"send",2)
-{
-    //buffer envoi
-    send_buffer=(char*)malloc(3);
-    send_size=3;//id(1)+period(2)
-
-    //mutex
-    send_mutex=NULL;
-    send_mutex=new Mutex(this,ObjectName());
-
-    socket_fd=sock;
-    connection_lost=false;
+ui_com::ui_com(const Object *parent, UDTSOCKET sock)
+    : Thread(parent, "send", 2) {
+  // buffer envoi
+  send_buffer = (char *)malloc(3);
+  send_size = 3; // id(1)+period(2)
+
+  // mutex
+  send_mutex = NULL;
+  send_mutex = new Mutex(this, ObjectName());
+
+  socket_fd = sock;
+  connection_lost = false;
 
 #ifdef __XENO__
-    int status;
-    string tmp_name;
-
-    is_running=true;
-
-    //pipe
-    tmp_name= getFrameworkManager()->ObjectName() + "-" + ObjectName()+ "-pipe";
-    //xenomai limitation
-    if(tmp_name.size()>31) Err("rt_pipe_create error (%s is too long)\n",tmp_name.c_str());
+  int status;
+  string tmp_name;
+
+  is_running = true;
+
+  // pipe
+  tmp_name = getFrameworkManager()->ObjectName() + "-" + ObjectName() + "-pipe";
+  // xenomai limitation
+  if (tmp_name.size() > 31)
+    Err("rt_pipe_create error (%s is too long)\n", tmp_name.c_str());
 #ifdef RT_PIPE_SIZE
-    status=rt_pipe_create(&pipe, tmp_name.c_str(), P_MINOR_AUTO,RT_PIPE_SIZE);
+  status = rt_pipe_create(&pipe, tmp_name.c_str(), P_MINOR_AUTO, RT_PIPE_SIZE);
 #else
-    status=rt_pipe_create(&pipe, tmp_name.c_str(), P_MINOR_AUTO,0);
-#endif
-
-    if(status!=0)
-    {
-        Err("rt_pipe_create error (%s)\n",strerror(-status));
-        //return -1;
-    }
-
-    //start user side thread
+  status = rt_pipe_create(&pipe, tmp_name.c_str(), P_MINOR_AUTO, 0);
+#endif
+
+  if (status != 0) {
+    Err("rt_pipe_create error (%s)\n", strerror(-status));
+    // return -1;
+  }
+
+// start user side thread
 #ifdef NRT_STACK_SIZE
-    // Initialize thread creation attributes
-    pthread_attr_t attr;
-    if(pthread_attr_init(&attr) != 0)
-    {
-        Err("pthread_attr_init error\n");
-    }
-
-    if(pthread_attr_setstacksize(&attr, NRT_STACK_SIZE) != 0)
-    {
-       Err("pthread_attr_setstacksize error\n");
-    }
-
-    if(pthread_create(&thread,  &attr, user_thread, (void*)this) < 0)
-#else //NRT_STACK_SIZE
-    if(pthread_create(&thread, NULL, user_thread, (void*)this) < 0)
-#endif //NRT_STACK_SIZE
-    {
-        Err("pthread_create error\n");
-      //return -1;
-    }
+  // Initialize thread creation attributes
+  pthread_attr_t attr;
+  if (pthread_attr_init(&attr) != 0) {
+    Err("pthread_attr_init error\n");
+  }
+
+  if (pthread_attr_setstacksize(&attr, NRT_STACK_SIZE) != 0) {
+    Err("pthread_attr_setstacksize error\n");
+  }
+
+  if (pthread_create(&thread, &attr, user_thread, (void *)this) < 0)
+#else  // NRT_STACK_SIZE
+  if (pthread_create(&thread, NULL, user_thread, (void *)this) < 0)
+#endif // NRT_STACK_SIZE
+  {
+    Err("pthread_create error\n");
+    // return -1;
+  }
 #ifdef NRT_STACK_SIZE
-    if(pthread_attr_destroy(&attr) != 0)
-    {
-        Err("pthread_attr_destroy error\n");
-    }
-#endif
-
-#endif//__XENO__
-    int timeout=100;
-    if(UDT::setsockopt(socket_fd, 0, UDT_RCVTIMEO, &timeout, sizeof(int))!=0) Err("UDT::setsockopt error (UDT_RCVTIMEO)\n");
-
-    bool blocking = true;
-    if(UDT::setsockopt(socket_fd, 0, UDT_SNDSYN, &blocking, sizeof(bool))!=0) Err("UDT::setsockopt error (UDT_SNDSYN)\n");
-
-    if(UDT::setsockopt(socket_fd, 0, UDT_RCVSYN, &blocking, sizeof(bool))!=0) Err("UDT::setsockopt error (UDT_RCVSYN)\n");
-//#endif //__XENO__
-
-    Start();
-}
-
-
-ui_com::~ui_com()
-{
-    //printf("destruction ui_com\n");
+  if (pthread_attr_destroy(&attr) != 0) {
+    Err("pthread_attr_destroy error\n");
+  }
+#endif
+
+#endif //__XENO__
+  int timeout = 100;
+  if (UDT::setsockopt(socket_fd, 0, UDT_RCVTIMEO, &timeout, sizeof(int)) != 0)
+    Err("UDT::setsockopt error (UDT_RCVTIMEO)\n");
+
+  bool blocking = true;
+  if (UDT::setsockopt(socket_fd, 0, UDT_SNDSYN, &blocking, sizeof(bool)) != 0)
+    Err("UDT::setsockopt error (UDT_SNDSYN)\n");
+
+  if (UDT::setsockopt(socket_fd, 0, UDT_RCVSYN, &blocking, sizeof(bool)) != 0)
+    Err("UDT::setsockopt error (UDT_RCVSYN)\n");
+  //#endif //__XENO__
+
+  Start();
+}
+
+ui_com::~ui_com() {
+// printf("destruction ui_com\n");
 
 #ifdef __XENO__
-    is_running=false;
-
-    pthread_join(thread, NULL);
-
-    int status=rt_pipe_delete(&pipe);
-    if(status!=0) Err("rt_pipe_delete error (%s)\n",strerror(-status));
-#endif
-
-    SafeStop();
-
-    if(IsSuspended()==true) Resume();
-
-    Join();
-
-    if(send_buffer!=NULL) free(send_buffer);
-    send_buffer=NULL;
-
-    //printf("destruction ui_com ok\n");
-}
-
-void ui_com::Send(char* buf,ssize_t size) {
-    if(connection_lost==true) return;
-
-    char* tosend=buf;
-    ssize_t nb_write;
-
-    if(buf[0]==XML_HEADER) {
-        //cut xml header
-        tosend=strstr(buf,"<root");
-        size-=tosend-buf;
-    }
+  is_running = false;
+
+  pthread_join(thread, NULL);
+
+  int status = rt_pipe_delete(&pipe);
+  if (status != 0)
+    Err("rt_pipe_delete error (%s)\n", strerror(-status));
+#endif
+
+  SafeStop();
+
+  if (IsSuspended() == true)
+    Resume();
+
+  Join();
+
+  if (send_buffer != NULL)
+    free(send_buffer);
+  send_buffer = NULL;
+
+  // printf("destruction ui_com ok\n");
+}
+
+void ui_com::Send(char *buf, ssize_t size) {
+  if (connection_lost == true)
+    return;
+
+  char *tosend = buf;
+  ssize_t nb_write;
+
+  if (buf[0] == XML_HEADER) {
+    // cut xml header
+    tosend = strstr(buf, "<root");
+    size -= tosend - buf;
+  }
 
 #ifdef __XENO__
-    nb_write=rt_pipe_write(&pipe,tosend,size,P_NORMAL);
-
-    if(nb_write<0)
-    {
-        Err("rt_pipe_write error (%s)\n",strerror(-nb_write));
-    }
-    else if (nb_write != size)
-    {
-        Err("rt_pipe_write error %i/%i\n",nb_write,size);
-    }
+  nb_write = rt_pipe_write(&pipe, tosend, size, P_NORMAL);
+
+  if (nb_write < 0) {
+    Err("rt_pipe_write error (%s)\n", strerror(-nb_write));
+  } else if (nb_write != size) {
+    Err("rt_pipe_write error %i/%i\n", nb_write, size);
+  }
 #else //__XENO__
 
 #ifdef COMPRESS_FRAMES
-    bool sendItCompressed=false;
-    if(buf[0]==XML_HEADER) {
-        sendItCompressed=true;
-    }
-
-    if(sendItCompressed) {
-        char *out;
-        ssize_t out_size;
-        if(compressBuffer(tosend, size,&out,&out_size, 9)==Z_OK) {
-            size=out_size;
-            nb_write = UDT::sendmsg(socket_fd,out,size, -1, true);
-            free(out);
+  bool sendItCompressed = false;
+  if (buf[0] == XML_HEADER) {
+    sendItCompressed = true;
+  }
+
+  if (sendItCompressed) {
+    char *out;
+    ssize_t out_size;
+    if (compressBuffer(tosend, size, &out, &out_size, 9) == Z_OK) {
+      size = out_size;
+      nb_write = UDT::sendmsg(socket_fd, out, size, -1, true);
+      free(out);
+    } else {
+      Warn("Compress error, sending it uncompressed\n");
+      sendItCompressed = false;
+    }
+  }
+
+  if (!sendItCompressed) {
+    nb_write = UDT::sendmsg(socket_fd, tosend, size, -1, true);
+  }
+
+#else // COMPRESS_FRAMES
+  nb_write = UDT::sendmsg(socket_fd, tosend, size, -1, true);
+#endif // COMPRESS_FRAMES
+  // Printf("write %i %i\n",nb_write,size);
+  if (nb_write < 0) {
+    Err("UDT::sendmsg error (%s)\n", UDT::getlasterror().getErrorMessage());
+    if (UDT::getlasterror().getErrorCode() == CUDTException::ECONNLOST ||
+        UDT::getlasterror().getErrorCode() == CUDTException::EINVSOCK) {
+      connection_lost = true;
+    }
+  } else if (nb_write != size) {
+    Err("%s, code %i (%ld/%ld)\n", UDT::getlasterror().getErrorMessage(),
+        UDT::getlasterror().getErrorCode(), nb_write, size);
+  }
+#endif //__XENO__
+}
+
+ssize_t ui_com::Receive(char *buf, ssize_t buf_size) {
+  ssize_t bytesRead = UDT::recvmsg(socket_fd, buf, buf_size);
+
+  if (bytesRead < 0) {
+    if (UDT::getlasterror().getErrorCode() == CUDTException::ECONNLOST) {
+      Err("UDT::recvmsg error (%s)\n", UDT::getlasterror().getErrorMessage());
+      connection_lost = true;
+    }
+  }
+
+  return bytesRead;
+}
+
+void ui_com::Run(void) {
+  // check endianness
+  char header;
+  if (IsBigEndian()) {
+    header = DATAS_BIG_ENDIAN;
+    Printf("System is big endian\n");
+  } else {
+    header = DATAS_LITTLE_ENDIAN;
+    Printf("System is little endian\n");
+  }
+
+#ifdef __XENO__
+  WarnUponSwitches(true);
+  printf("\n"); // a revoir pourquoi??
+// sans ce printf, dans le simu_roll, le suspend ne fonctionne pas...
+#endif
+  // on attend d'avoir des choses à faire
+  Suspend();
+
+  while (!ToBeStopped()) {
+    size_t resume_id;
+    Time min = 0xffffffffffffffffULL;
+
+    // on recpuere l'id de la prochaine execution
+    send_mutex->GetMutex();
+    resume_id = resume_time.size();
+    for (size_t i = 0; i < resume_time.size(); i++) {
+      if (resume_time.at(i) < min && data_to_send.at(i)->IsEnabled() == true) {
+        min = resume_time.at(i);
+        resume_id = i;
+      }
+    }
+
+    // attente
+    if (resume_id < resume_time.size()) {
+      Time time = resume_time.at(resume_id);
+      uint16_t resume_period = data_to_send.at(resume_id)->SendPeriod();
+      send_mutex->ReleaseMutex();
+      // on dort jusqu'a la prochaine execution
+      SleepUntil(time);
+
+      // envoi des donnees
+      int offset = 3;
+      send_buffer[0] = header;
+      send_mutex->GetMutex();
+
+      for (size_t i = 0; i < data_to_send.size(); i++) {
+        if (data_to_send.at(i)->SendPeriod() == resume_period &&
+            data_to_send.at(i)->IsEnabled() == true) {
+          data_to_send.at(i)->CopyDatas(send_buffer + offset);
+          offset += data_to_send.at(i)->SendSize();
+        }
+      }
+      if (offset != 3) {
+        memcpy(&send_buffer[1], &resume_period, sizeof(uint16_t));
+        // printf("send %i %i %i %x
+        // %x\n",resume_period,offset,sizeof(uint16_t),send_buffer,&send_buffer[1]);
+        // for(int i=0;i<offset;i++) printf("%x ",send_buffer[i]);
+        // printf("\n");
+        Send(send_buffer, offset);
+      }
+
+      // on planifie la prochaine execution
+      for (size_t i = 0; i < data_to_send.size(); i++) {
+        if (data_to_send.at(i)->SendPeriod() == resume_period) {
+          resume_time.at(i) += data_to_send.at(i)->SendPeriod() * 1000000;
+        }
+      }
+      send_mutex->ReleaseMutex();
+      // Printf("%i %lld\n",resume_period,GetTime()/1000000);
+    } else {
+      send_mutex->ReleaseMutex();
+      // rien a faire, suspend
+      // Printf("rien a faire suspend\n");
+      Suspend();
+      // Printf("wake\n");
+      // on planifie la prochaine execution
+      Time time = GetTime();
+      send_mutex->GetMutex();
+      for (size_t i = 0; i < data_to_send.size(); i++) {
+        resume_time.at(i) =
+            time + (Time)data_to_send.at(i)->SendPeriod() * 1000000;
+      }
+      send_mutex->ReleaseMutex();
+    }
+  }
+}
+#ifdef __XENO__
+void *ui_com::user_thread(void *arg) {
+  int pipe_fd = -1;
+  string devname;
+  char *buf = NULL;
+  ui_com *caller = (ui_com *)arg;
+  int rv;
+  fd_set set;
+  struct timeval timeout;
+  ssize_t nb_read, nb_write;
+
+  buf = (char *)malloc(NRT_PIPE_SIZE);
+  if (buf == NULL) {
+    caller->Err("malloc error\n");
+  }
+
+  devname = NRT_PIPE_PATH + getFrameworkManager()->ObjectName() + "-" +
+            caller->ObjectName() + "-pipe";
+  while (pipe_fd < 0) {
+    pipe_fd = open(devname.c_str(), O_RDWR);
+    if (pipe_fd < 0 && errno != ENOENT)
+      caller->Err("open pipe_fd error (%s)\n", strerror(-errno));
+    usleep(1000);
+  }
+
+  while (1) {
+    FD_ZERO(&set);         // clear the set
+    FD_SET(pipe_fd, &set); // add our file descriptor to the set
+
+    timeout.tv_sec = 0;
+    timeout.tv_usec = SELECT_TIMEOUT_MS * 1000;
+
+    rv = select(FD_SETSIZE, &set, NULL, NULL, &timeout);
+
+    if (rv == -1) {
+      if (caller->is_running == false &&
+          UDT::getlasterror().getErrorCode() == CUDTException::ETIMEOUT)
+        break; // timeout
+      if (UDT::getlasterror().getErrorCode() != CUDTException::ETIMEOUT)
+        caller->Err("epoll_wait, %s, code %i\n",
+                    UDT::getlasterror().getErrorMessage(),
+                    UDT::getlasterror().getErrorCode());
+    } else if (rv == 0) {
+      // printf("timeout\n"); // a timeout occured
+      if (caller->is_running == false)
+        break;
+
+    } else {
+      nb_read = read(pipe_fd, buf, NRT_PIPE_SIZE);
+      buf[nb_read] = 0;
+// printf("envoi\n%s\n",buf);
+
+#ifdef COMPRESS_FRAMES
+      char *out;
+      ssize_t out_size;
+
+      if (buf[0] == XML_HEADER) {
+        if (compressBuffer(buf, nb_read, &out, &out_size, 9) == Z_OK) {
+          nb_read = out_size;
+          nb_write = UDT::sendmsg(caller->socket_fd, out, out_size, -1, true);
+          free(out);
         } else {
-            Warn("Compress error, sending it uncompressed\n");
-            sendItCompressed=false;
+          caller->Warn("Compress error, sending it uncompressed\n");
+          nb_write = UDT::sendmsg(caller->socket_fd, buf, nb_read, -1, true);
         }
-    }
-
-    if(!sendItCompressed) {
-        nb_write = UDT::sendmsg(socket_fd,tosend,size, -1, true);
-    }
-
-#else //COMPRESS_FRAMES
-    nb_write = UDT::sendmsg(socket_fd,tosend,size, -1, true);
-#endif //COMPRESS_FRAMES
-//Printf("write %i %i\n",nb_write,size);
-    if(nb_write<0) {
-        Err("UDT::sendmsg error (%s)\n",UDT::getlasterror().getErrorMessage());
-        if(UDT::getlasterror().getErrorCode()==CUDTException::ECONNLOST || UDT::getlasterror().getErrorCode()==CUDTException::EINVSOCK) {
-            connection_lost=true;
+      } else {
+        nb_write = UDT::sendmsg(caller->socket_fd, buf, nb_read, -1, true);
+      }
+#else
+      nb_write = UDT::sendmsg(caller->socket_fd, buf, nb_read, -1, true);
+#endif
+
+      if (nb_write < 0) {
+        caller->Err("UDT::sendmsg error (%s)\n",
+                    UDT::getlasterror().getErrorMessage());
+        if (UDT::getlasterror().getErrorCode() == CUDTException::ECONNLOST ||
+            UDT::getlasterror().getErrorCode() == CUDTException::EINVSOCK) {
+          caller->connection_lost = true;
         }
-    } else if (nb_write != size) {
-        Err("%s, code %i (%ld/%ld)\n",UDT::getlasterror().getErrorMessage(),UDT::getlasterror().getErrorCode(),nb_write,size);
-    }
-#endif //__XENO__
-}
-
-ssize_t ui_com::Receive(char* buf,ssize_t buf_size) {
-    ssize_t bytesRead= UDT::recvmsg(socket_fd,buf,buf_size);
-
-    if(bytesRead<0) {
-        if(UDT::getlasterror().getErrorCode()==CUDTException::ECONNLOST) {
-            Err("UDT::recvmsg error (%s)\n",UDT::getlasterror().getErrorMessage());
-            connection_lost=true;
-        }
-    }
-
-    return bytesRead;
-}
-
-void ui_com::Run(void)
-{
-    //check endianness
-    char header;
-    if(IsBigEndian())
-    {
-        header=DATAS_BIG_ENDIAN;
-        Printf("System is big endian\n");
-    }
-    else
-    {
-        header=DATAS_LITTLE_ENDIAN;
-        Printf("System is little endian\n");
-    }
-
-#ifdef __XENO__
-    WarnUponSwitches(true);
-    printf("\n");//a revoir pourquoi??
-    //sans ce printf, dans le simu_roll, le suspend ne fonctionne pas...
-#endif
-    //on attend d'avoir des choses à faire
-    Suspend();
-
-    while(!ToBeStopped())
-    {
-        size_t resume_id;
-        Time min=0xffffffffffffffffULL;
-
-        //on recpuere l'id de la prochaine execution
-        send_mutex->GetMutex();
-        resume_id=resume_time.size();
-        for(size_t i=0;i<resume_time.size();i++)
-        {
-            if(resume_time.at(i)<min && data_to_send.at(i)->IsEnabled()==true)
-            {
-                min=resume_time.at(i);
-                resume_id=i;
-            }
-        }
-
-        //attente
-        if(resume_id<resume_time.size())
-        {
-            Time time=resume_time.at(resume_id);
-            uint16_t resume_period=data_to_send.at(resume_id)->SendPeriod();
-            send_mutex->ReleaseMutex();
-            //on dort jusqu'a la prochaine execution
-            SleepUntil(time);
-
-            //envoi des donnees
-            int offset=3;
-            send_buffer[0]=header;
-            send_mutex->GetMutex();
-
-            for(size_t i=0;i<data_to_send.size();i++) {
-                if(data_to_send.at(i)->SendPeriod()==resume_period && data_to_send.at(i)->IsEnabled()==true) {
-                    data_to_send.at(i)->CopyDatas(send_buffer+offset);
-                    offset+=data_to_send.at(i)->SendSize();
-                }
-            }
-            if(offset!=3) {
-                memcpy(&send_buffer[1],&resume_period,sizeof(uint16_t));
-                //printf("send %i %i %i %x %x\n",resume_period,offset,sizeof(uint16_t),send_buffer,&send_buffer[1]);
-                //for(int i=0;i<offset;i++) printf("%x ",send_buffer[i]);
-                //printf("\n");
-                Send(send_buffer,offset);
-            }
-
-            //on planifie la prochaine execution
-            for(size_t i=0;i<data_to_send.size();i++)
-            {
-                if(data_to_send.at(i)->SendPeriod()==resume_period)
-                {
-                    resume_time.at(i)+=data_to_send.at(i)->SendPeriod()*1000000;
-                }
-            }
-            send_mutex->ReleaseMutex();
-            //Printf("%i %lld\n",resume_period,GetTime()/1000000);
-        }
-        else
-        {
-            send_mutex->ReleaseMutex();
-            //rien a faire, suspend
-            //Printf("rien a faire suspend\n");
-            Suspend();
-            //Printf("wake\n");
-            //on planifie la prochaine execution
-            Time time=GetTime();
-            send_mutex->GetMutex();
-            for(size_t i=0;i<data_to_send.size();i++)
-            {
-                resume_time.at(i)=time+(Time)data_to_send.at(i)->SendPeriod()*1000000;
-            }
-            send_mutex->ReleaseMutex();
-        }
-    }
-}
-#ifdef __XENO__
-void* ui_com::user_thread(void * arg)
-{
-    int pipe_fd=-1;
-    string devname;
-    char* buf=NULL;
-    ui_com *caller = (ui_com*)arg;
-    int rv;
-    fd_set set;
-    struct timeval timeout;
-    ssize_t nb_read,nb_write;
-
-    buf=(char*)malloc(NRT_PIPE_SIZE);
-    if(buf==NULL)
-    {
-        caller->Err("malloc error\n");
-    }
-
-    devname= NRT_PIPE_PATH + getFrameworkManager()->ObjectName() + "-" + caller->ObjectName()+ "-pipe";
-    while(pipe_fd<0)
-    {
-        pipe_fd = open(devname.c_str(), O_RDWR);
-        if (pipe_fd < 0 && errno!=ENOENT) caller->Err("open pipe_fd error (%s)\n",strerror(-errno));
-        usleep(1000);
-    }
-
-    while(1)
-    {
-        FD_ZERO(&set); // clear the set
-        FD_SET(pipe_fd, &set); // add our file descriptor to the set
-
-        timeout.tv_sec = 0;
-        timeout.tv_usec = SELECT_TIMEOUT_MS*1000;
-
-        rv = select(FD_SETSIZE, &set, NULL, NULL, &timeout);
-
-        if(rv == -1)
-        {
-            if(caller->is_running==false && UDT::getlasterror().getErrorCode()==CUDTException::ETIMEOUT) break;//timeout
-            if(UDT::getlasterror().getErrorCode()!=CUDTException::ETIMEOUT) caller->Err("epoll_wait, %s, code %i\n",UDT::getlasterror().getErrorMessage(),UDT::getlasterror().getErrorCode());
-        }
-        else if(rv == 0)
-        {
-            //printf("timeout\n"); // a timeout occured
-            if(caller->is_running==false) break;
-
-        }
-        else
-        {
-            nb_read=read(pipe_fd,buf,NRT_PIPE_SIZE);
-            buf[nb_read]=0;
-            //printf("envoi\n%s\n",buf);
-
-#ifdef COMPRESS_FRAMES
-            char *out;
-            ssize_t out_size;
-
-            if(buf[0]==XML_HEADER) {
-                if(compressBuffer(buf, nb_read,&out,&out_size, 9)==Z_OK) {
-                    nb_read=out_size;
-                    nb_write = UDT::sendmsg(caller->socket_fd,out,out_size, -1, true);
-                    free(out);
-                } else {
-                    caller->Warn("Compress error, sending it uncompressed\n");
-                    nb_write = UDT::sendmsg(caller->socket_fd, buf,nb_read, -1, true);
-                }
-            } else {
-                nb_write = UDT::sendmsg(caller->socket_fd, buf,nb_read, -1, true);
-            }
-#else
-            nb_write = UDT::sendmsg(caller->socket_fd, buf,nb_read, -1, true);
-#endif
-
-            if(nb_write<0)
-            {
-                caller->Err("UDT::sendmsg error (%s)\n",UDT::getlasterror().getErrorMessage());
-                if(UDT::getlasterror().getErrorCode()==CUDTException::ECONNLOST || UDT::getlasterror().getErrorCode()==CUDTException::EINVSOCK)
-                {
-                    caller->connection_lost=true;
-                }
-            }
-            else if (nb_write != nb_read)
-            {
-                caller->Err("UDT::sendmsg error %i/%i\n",nb_write,nb_read);
-            }
-        }
-    }
-
-    close(pipe_fd);
-    if(buf!=NULL) free(buf);
-    pthread_exit(0);
-}
-#endif
-
-int ui_com::compressBuffer(char *in, ssize_t in_size,char **out,ssize_t *out_size, int level)
-{
-    int ret, flush;
-    unsigned have;
-    z_stream strm;
-
-    /* allocate deflate state */
-    strm.zalloc = Z_NULL;
-    strm.zfree = Z_NULL;
-    strm.opaque = Z_NULL;
-    ret = deflateInit(&strm, level);
-    if (ret != Z_OK)
-        return ret;
-
-    *out=(char*)malloc(COMPRESS_CHUNK);
-    if(!(*out))
-        return Z_BUF_ERROR;
-
-    strm.next_in = (unsigned char*)in;
-    strm.avail_out =  COMPRESS_CHUNK;
-    strm.next_out = (unsigned char*)*out;
-    strm.avail_in=in_size;
-    flush=Z_FINISH;
-
-    ret = deflate(&strm, flush);    /* no bad return value */
-    if (ret == Z_STREAM_ERROR) {
-        free(*out);
-        return ret;
-    }
-
-    have = COMPRESS_CHUNK - strm.avail_out;
-    *out_size=have;
-//printf("%i -> %i\n",in_size,have);
-    /* clean up and return */
-    (void)deflateEnd(&strm);
-
-    if(strm.avail_out!=0) {
-        return Z_OK;
-    } else {
-        return Z_STREAM_ERROR;
-    }
-}
-
-int ui_com::uncompressBuffer(unsigned char *in, ssize_t in_size,unsigned char **out,ssize_t *out_size)
-{
-    int ret;
-    //unsigned have;
-    z_stream strm;
-
-    /* allocate inflate state */
-    strm.zalloc = Z_NULL;
-    strm.zfree = Z_NULL;
-    strm.opaque = Z_NULL;
-    strm.avail_in = 0;
-    strm.next_in = Z_NULL;
-    ret = inflateInit(&strm);
-    if (ret != Z_OK)
-        return ret;
-
-    *out=(unsigned char*)malloc(COMPRESS_CHUNK);
-    if(!(*out))
-        return Z_BUF_ERROR;
-
-    strm.avail_in = in_size;
-    strm.next_in = in;
-    strm.avail_out = COMPRESS_CHUNK;
-    strm.next_out = *out;
-
-    ret = inflate(&strm, Z_NO_FLUSH);
-    assert(ret != Z_STREAM_ERROR);  /* state not clobbered */
-    switch (ret) {
-    case Z_NEED_DICT:
-        ret = Z_DATA_ERROR;     /* and fall through */
-    case Z_DATA_ERROR:
-    case Z_MEM_ERROR:
-        (void)inflateEnd(&strm);
-        return ret;
-    }
-    //have = COMPRESS_CHUNK - strm.avail_out;
-
-    /* clean up and return */
+      } else if (nb_write != nb_read) {
+        caller->Err("UDT::sendmsg error %i/%i\n", nb_write, nb_read);
+      }
+    }
+  }
+
+  close(pipe_fd);
+  if (buf != NULL)
+    free(buf);
+  pthread_exit(0);
+}
+#endif
+
+int ui_com::compressBuffer(char *in, ssize_t in_size, char **out,
+                           ssize_t *out_size, int level) {
+  int ret, flush;
+  unsigned have;
+  z_stream strm;
+
+  /* allocate deflate state */
+  strm.zalloc = Z_NULL;
+  strm.zfree = Z_NULL;
+  strm.opaque = Z_NULL;
+  ret = deflateInit(&strm, level);
+  if (ret != Z_OK)
+    return ret;
+
+  *out = (char *)malloc(COMPRESS_CHUNK);
+  if (!(*out))
+    return Z_BUF_ERROR;
+
+  strm.next_in = (unsigned char *)in;
+  strm.avail_out = COMPRESS_CHUNK;
+  strm.next_out = (unsigned char *)*out;
+  strm.avail_in = in_size;
+  flush = Z_FINISH;
+
+  ret = deflate(&strm, flush); /* no bad return value */
+  if (ret == Z_STREAM_ERROR) {
+    free(*out);
+    return ret;
+  }
+
+  have = COMPRESS_CHUNK - strm.avail_out;
+  *out_size = have;
+  // printf("%i -> %i\n",in_size,have);
+  /* clean up and return */
+  (void)deflateEnd(&strm);
+
+  if (strm.avail_out != 0) {
+    return Z_OK;
+  } else {
+    return Z_STREAM_ERROR;
+  }
+}
+
+int ui_com::uncompressBuffer(unsigned char *in, ssize_t in_size,
+                             unsigned char **out, ssize_t *out_size) {
+  int ret;
+  // unsigned have;
+  z_stream strm;
+
+  /* allocate inflate state */
+  strm.zalloc = Z_NULL;
+  strm.zfree = Z_NULL;
+  strm.opaque = Z_NULL;
+  strm.avail_in = 0;
+  strm.next_in = Z_NULL;
+  ret = inflateInit(&strm);
+  if (ret != Z_OK)
+    return ret;
+
+  *out = (unsigned char *)malloc(COMPRESS_CHUNK);
+  if (!(*out))
+    return Z_BUF_ERROR;
+
+  strm.avail_in = in_size;
+  strm.next_in = in;
+  strm.avail_out = COMPRESS_CHUNK;
+  strm.next_out = *out;
+
+  ret = inflate(&strm, Z_NO_FLUSH);
+  assert(ret != Z_STREAM_ERROR); /* state not clobbered */
+  switch (ret) {
+  case Z_NEED_DICT:
+    ret = Z_DATA_ERROR; /* and fall through */
+  case Z_DATA_ERROR:
+  case Z_MEM_ERROR:
     (void)inflateEnd(&strm);
-    return ret == Z_STREAM_END ? Z_OK : Z_DATA_ERROR;
-}
-
-bool ui_com::ConnectionLost()
-{
-    return connection_lost;
-}
-
-void ui_com::AddSendData(const SendData *obj)
-{
-    send_mutex->GetMutex();
-
-    resume_time.push_back(GetTime()+(Time)obj->SendPeriod()*1000000);
-
-    //on resume en meme temps tout ceux qui ont la meme periode
-    for(size_t i=0;i<data_to_send.size();i++)
-    {
-        if(data_to_send.at(i)->SendPeriod()==obj->SendPeriod())
-        {
-            resume_time.at(resume_time.size()-1)=resume_time.at(i);
-            break;
-        }
-    }
-
-    data_to_send.push_back(obj);
-
-    send_mutex->ReleaseMutex();
-}
-
-void ui_com::UpdateSendData(const SendData *obj)
-{
-    //le mutex est deja pris par l'appellant
-    size_t id,i;
-
-    //on recupere l'id
-    for(i=0;i<data_to_send.size();i++)
-    {
-        if(data_to_send.at(i)==obj)
-        {
-            id=i;
-            break;
-        }
-    }
-
-    //on resume en meme temps tout ceux qui ont la meme periode
-    for(i=0;i<data_to_send.size();i++)
-    {
-        if(i==id) continue;
-        if(data_to_send.at(i)->IsEnabled()==true && data_to_send.at(i)->SendPeriod()==obj->SendPeriod())
-        {
-            resume_time.at(id)=resume_time.at(i);
-            break;
-        }
-    }
-
-    //si aucun match, on planifie l'execution
-    if(i==data_to_send.size()) resume_time.at(id)=GetTime()+(Time)obj->SendPeriod()*1000000;
-
-    if(IsSuspended()==true) Resume();
-
-    return;
-}
-
-void ui_com::UpdateDataToSendSize(void)
-{
-    send_mutex->GetMutex();
-    send_size=3;//id(1)+period(2)
-    for(size_t i=0;i<data_to_send.size();i++)
-    {
-        if(data_to_send[i]!=NULL) send_size+=data_to_send[i]->SendSize();
-    }
-
-    //send_buffer=(char*)realloc((void*)send_buffer,send_size*sizeof(char));
-    if(send_buffer!=NULL) free(send_buffer);
-    send_buffer=(char*)malloc(send_size*sizeof(char));
-    send_mutex->ReleaseMutex();
-}
-
-void ui_com::RemoveSendData(const SendData *obj)
-{
-    //printf("remove_data_to_send %i\n",data_to_send.size());
-
-    send_mutex->GetMutex();
-    //on recupere l'id
-    for(size_t i=0;i<data_to_send.size();i++)
-    {
-        if(data_to_send.at(i)==obj)
-        {
-            data_to_send.erase (data_to_send.begin()+i);
-            resume_time.erase (resume_time.begin()+i);
-            //printf("remove_data_to_send %i ok\n",data_to_send.size());
-            break;
-        }
-    }
-    send_mutex->ReleaseMutex();
-
-    return;
-}
-
-void ui_com::Block(void)
-{
-    send_mutex->GetMutex();
-}
-
-void ui_com::UnBlock(void)
-{
-    send_mutex->ReleaseMutex();
-}
+    return ret;
+  }
+  // have = COMPRESS_CHUNK - strm.avail_out;
+
+  /* clean up and return */
+  (void)inflateEnd(&strm);
+  return ret == Z_STREAM_END ? Z_OK : Z_DATA_ERROR;
+}
+
+bool ui_com::ConnectionLost() { return connection_lost; }
+
+void ui_com::AddSendData(const SendData *obj) {
+  send_mutex->GetMutex();
+
+  resume_time.push_back(GetTime() + (Time)obj->SendPeriod() * 1000000);
+
+  // on resume en meme temps tout ceux qui ont la meme periode
+  for (size_t i = 0; i < data_to_send.size(); i++) {
+    if (data_to_send.at(i)->SendPeriod() == obj->SendPeriod()) {
+      resume_time.at(resume_time.size() - 1) = resume_time.at(i);
+      break;
+    }
+  }
+
+  data_to_send.push_back(obj);
+
+  send_mutex->ReleaseMutex();
+}
+
+void ui_com::UpdateSendData(const SendData *obj) {
+  // le mutex est deja pris par l'appellant
+  size_t id, i;
+
+  // on recupere l'id
+  for (i = 0; i < data_to_send.size(); i++) {
+    if (data_to_send.at(i) == obj) {
+      id = i;
+      break;
+    }
+  }
+
+  // on resume en meme temps tout ceux qui ont la meme periode
+  for (i = 0; i < data_to_send.size(); i++) {
+    if (i == id)
+      continue;
+    if (data_to_send.at(i)->IsEnabled() == true &&
+        data_to_send.at(i)->SendPeriod() == obj->SendPeriod()) {
+      resume_time.at(id) = resume_time.at(i);
+      break;
+    }
+  }
+
+  // si aucun match, on planifie l'execution
+  if (i == data_to_send.size())
+    resume_time.at(id) = GetTime() + (Time)obj->SendPeriod() * 1000000;
+
+  if (IsSuspended() == true)
+    Resume();
+
+  return;
+}
+
+void ui_com::UpdateDataToSendSize(void) {
+  send_mutex->GetMutex();
+  send_size = 3; // id(1)+period(2)
+  for (size_t i = 0; i < data_to_send.size(); i++) {
+    if (data_to_send[i] != NULL)
+      send_size += data_to_send[i]->SendSize();
+  }
+
+  // send_buffer=(char*)realloc((void*)send_buffer,send_size*sizeof(char));
+  if (send_buffer != NULL)
+    free(send_buffer);
+  send_buffer = (char *)malloc(send_size * sizeof(char));
+  send_mutex->ReleaseMutex();
+}
+
+void ui_com::RemoveSendData(const SendData *obj) {
+  // printf("remove_data_to_send %i\n",data_to_send.size());
+
+  send_mutex->GetMutex();
+  // on recupere l'id
+  for (size_t i = 0; i < data_to_send.size(); i++) {
+    if (data_to_send.at(i) == obj) {
+      data_to_send.erase(data_to_send.begin() + i);
+      resume_time.erase(resume_time.begin() + i);
+      // printf("remove_data_to_send %i ok\n",data_to_send.size());
+      break;
+    }
+  }
+  send_mutex->ReleaseMutex();
+
+  return;
+}
+
+void ui_com::Block(void) { send_mutex->GetMutex(); }
+
+void ui_com::UnBlock(void) { send_mutex->ReleaseMutex(); }
Index: trunk/lib/FlairCore/src/unexported/ConditionVariable_impl.h
===================================================================
--- trunk/lib/FlairCore/src/unexported/ConditionVariable_impl.h	(revision 14)
+++ trunk/lib/FlairCore/src/unexported/ConditionVariable_impl.h	(revision 15)
@@ -23,7 +23,7 @@
 
 namespace flair {
-    namespace core {
-        class ConditionVariable;
-    }
+namespace core {
+class ConditionVariable;
+}
 }
 
@@ -32,20 +32,19 @@
 *
 */
-class ConditionVariable_impl
-{
+class ConditionVariable_impl {
 
-    public:
-        ConditionVariable_impl(flair::core::ConditionVariable* self);
-        ~ConditionVariable_impl();
-        void CondWait(void);
-        bool CondWaitUntil(flair::core::Time date);
-        void CondSignal(void);
+public:
+  ConditionVariable_impl(flair::core::ConditionVariable *self);
+  ~ConditionVariable_impl();
+  void CondWait(void);
+  bool CondWaitUntil(flair::core::Time date);
+  void CondSignal(void);
 
-    private:
-        flair::core::ConditionVariable* self;
+private:
+  flair::core::ConditionVariable *self;
 #ifdef __XENO__
-        RT_COND m_ResumeCond;
+  RT_COND m_ResumeCond;
 #else
-        pthread_cond_t m_ResumeCond;
+  pthread_cond_t m_ResumeCond;
 #endif
 };
Index: trunk/lib/FlairCore/src/unexported/DataPlot_impl.h
===================================================================
--- trunk/lib/FlairCore/src/unexported/DataPlot_impl.h	(revision 14)
+++ trunk/lib/FlairCore/src/unexported/DataPlot_impl.h	(revision 15)
@@ -16,10 +16,8 @@
 #include <vector>
 
-namespace flair
-{
-    namespace core
-    {
-        class IODataElement;
-    }
+namespace flair {
+namespace core {
+class IODataElement;
+}
 }
 
@@ -28,11 +26,10 @@
 *
 */
-class DataPlot_impl
-{
-    public:
-        DataPlot_impl();
-        ~DataPlot_impl();
+class DataPlot_impl {
+public:
+  DataPlot_impl();
+  ~DataPlot_impl();
 
-        std::vector<const flair::core::IODataElement*> tosend;
+  std::vector<const flair::core::IODataElement *> tosend;
 };
 
Index: trunk/lib/FlairCore/src/unexported/FrameworkManager_impl.h
===================================================================
--- trunk/lib/FlairCore/src/unexported/FrameworkManager_impl.h	(revision 14)
+++ trunk/lib/FlairCore/src/unexported/FrameworkManager_impl.h	(revision 15)
@@ -24,117 +24,111 @@
 #endif
 
-namespace flair
-{
-    namespace core
-    {
-        class FrameworkManager;
-        class IODevice;
-        class Watchdog;
-    }
-    namespace gui
-    {
-        class TabWidget;
-        class PushButton;
-        class Layout;
-    }
+namespace flair {
+namespace core {
+class FrameworkManager;
+class IODevice;
+class Watchdog;
+}
+namespace gui {
+class TabWidget;
+class PushButton;
+class Layout;
+}
 }
 
 class ui_com;
 
-class FrameworkManager_impl: public flair::core::Thread
-{
-    public:
-        FrameworkManager_impl(flair::core::FrameworkManager *self,std::string name);
-        ~FrameworkManager_impl();
-        void SetupConnection(std::string address,uint16_t port,size_t rcv_buf_size=10000);
-        void SetupUserInterface(std::string xml_file);
-        void SetupLogger(std::string log_path);
-        void AddDeviceToLog(flair::core::IODevice *device);
-        void StartLog();
-        void StopLog();
-        char* GetBuffer(size_t sz);
-        void ReleaseBuffer(char* buf);
-        void WriteLog(const char* buf,size_t size);
+class FrameworkManager_impl : public flair::core::Thread {
+public:
+  FrameworkManager_impl(flair::core::FrameworkManager *self, std::string name);
+  ~FrameworkManager_impl();
+  void SetupConnection(std::string address, uint16_t port,
+                       size_t rcv_buf_size = 10000);
+  void SetupUserInterface(std::string xml_file);
+  void SetupLogger(std::string log_path);
+  void AddDeviceToLog(flair::core::IODevice *device);
+  void StartLog();
+  void StopLog();
+  char *GetBuffer(size_t sz);
+  void ReleaseBuffer(char *buf);
+  void WriteLog(const char *buf, size_t size);
 
-        /*!
-        * \brief Affiche le xml
-        *
-        * Pour debug.
-        */
-        void PrintXml(void) const;
+  /*!
+  * \brief Affiche le xml
+  *
+  * Pour debug.
+  */
+  void PrintXml(void) const;
 
-        bool is_logging;
-        bool disable_errors;
-        bool connection_lost;
-        static ui_com *com;
-        static FrameworkManager_impl *_this;
-        std::string log_path;
+  bool is_logging;
+  bool disable_errors;
+  bool connection_lost;
+  static ui_com *com;
+  static FrameworkManager_impl *_this;
+  std::string log_path;
 
-        flair::gui::TabWidget* tabwidget;
-        flair::gui::PushButton *save_button;//,*load_button;
+  flair::gui::TabWidget *tabwidget;
+  flair::gui::PushButton *save_button; //,*load_button;
 
-        xmlDocPtr file_doc;
+  xmlDocPtr file_doc;
 
-        typedef struct {
-            const flair::core::IODevice* device;
-            size_t size;
-            flair::core::Time time;
-        } log_header_t;
+  typedef struct {
+    const flair::core::IODevice *device;
+    size_t size;
+    flair::core::Time time;
+  } log_header_t;
 
-    private:
-        flair::core::FrameworkManager *self;
-        UDTSOCKET file_sock,com_sock;
-        UDTSOCKET GetSocket(std::string address,uint16_t port);
-        void Run();
-        void SendFile(std::string path,std::string name);
-        void FinishSending(void);
-        std::string FileName(flair::core::IODevice* device);
-        void SaveXmlChange(char* buf);
-        void SaveXml(void);
-        size_t rcv_buf_size;
-        char *rcv_buf;
+private:
+  flair::core::FrameworkManager *self;
+  UDTSOCKET file_sock, com_sock;
+  UDTSOCKET GetSocket(std::string address, uint16_t port);
+  void Run();
+  void SendFile(std::string path, std::string name);
+  void FinishSending(void);
+  std::string FileName(flair::core::IODevice *device);
+  void SaveXmlChange(char *buf);
+  void SaveXml(void);
+  size_t rcv_buf_size;
+  char *rcv_buf;
 #ifdef __XENO__
-        int CreatePipe(RT_PIPE* fd,std::string name);
-        int DeletePipe(RT_PIPE* fd);
-        RT_PIPE cmd_pipe;
-        RT_PIPE data_pipe;
-        RT_HEAP log_heap;
+  int CreatePipe(RT_PIPE *fd, std::string name);
+  int DeletePipe(RT_PIPE *fd);
+  RT_PIPE cmd_pipe;
+  RT_PIPE data_pipe;
+  RT_HEAP log_heap;
 #else
-        int CreatePipe(int (*fd)[2],std::string name);
-        int DeletePipe(int (*fd)[2]);
-        int cmd_pipe[2];
-        int data_pipe[2];
+  int CreatePipe(int (*fd)[2], std::string name);
+  int DeletePipe(int (*fd)[2]);
+  int cmd_pipe[2];
+  int data_pipe[2];
 #endif
-        //logger
-        bool continuer;//a enlever, avoir un seul bool pour toutes les taches
-        static void* write_log_user(void * arg);
-        pthread_t log_th;
-        std::string xml_file;
-        bool logger_defined;
-        bool ui_defined;
-        flair::gui::Layout* top_layout;
+  // logger
+  bool continuer; // a enlever, avoir un seul bool pour toutes les taches
+  static void *write_log_user(void *arg);
+  pthread_t log_th;
+  std::string xml_file;
+  bool logger_defined;
+  bool ui_defined;
+  flair::gui::Layout *top_layout;
 
-        typedef struct {
-            flair::core::IODevice* device;
-            size_t size;
-            hdfile_t *dbtFile;
-            bool running;
-        } log_desc_t;
+  typedef struct {
+    flair::core::IODevice *device;
+    size_t size;
+    hdfile_t *dbtFile;
+    bool running;
+  } log_desc_t;
 
-        std::vector<log_desc_t> logs;
-        std::vector<std::string> xml_changes;
-        flair::core::Watchdog* gcs_watchdog;
-        void ConnectionLost(void);
+  std::vector<log_desc_t> logs;
+  std::vector<std::string> xml_changes;
+  flair::core::Watchdog *gcs_watchdog;
+  void ConnectionLost(void);
 };
 
-namespace
-{
-    inline ui_com* getUiCom(void) {
-        return FrameworkManager_impl::com;
-    }
+namespace {
+inline ui_com *getUiCom(void) { return FrameworkManager_impl::com; }
 
-    inline  FrameworkManager_impl* getFrameworkManagerImpl(void) {
-        return FrameworkManager_impl::_this;
-    }
+inline FrameworkManager_impl *getFrameworkManagerImpl(void) {
+  return FrameworkManager_impl::_this;
+}
 }
 
Index: trunk/lib/FlairCore/src/unexported/IODevice_impl.h
===================================================================
--- trunk/lib/FlairCore/src/unexported/IODevice_impl.h	(revision 14)
+++ trunk/lib/FlairCore/src/unexported/IODevice_impl.h	(revision 15)
@@ -17,48 +17,45 @@
 #include <Object.h>
 
-namespace flair
-{
-    namespace core
-    {
-        class io_data;
-        class IODevice;
-        class Thread;
-        class Mutex;
-        class FrameworkManager;
-        class SharedMem;
-    }
+namespace flair {
+namespace core {
+class io_data;
+class IODevice;
+class Thread;
+class Mutex;
+class FrameworkManager;
+class SharedMem;
+}
 }
 
 class FrameworkManager_impl;
 
-class IODevice_impl
-{
-    public:
-        IODevice_impl(const flair::core::IODevice* self);
-        ~IODevice_impl();
-        void ResumeThread(void);
-        size_t LogSize(void) const;
-        void AppendLog(char** ptr);
-        void AddDataToLog(const flair::core::io_data* data);
-        void WriteLogsDescriptors(std::fstream& desc_file,int *index);
-        int SetToWake(const flair::core::Thread* thread);
-        void WriteLog(flair::core::Time time);
-        void AddDeviceToLog(const flair::core::IODevice* device);
-        bool SetToBeLogged(void);//return true if possible
-        void OutputToShMem(bool enabled);
-        void WriteToShMem(void);
-        void PrintLogsDescriptors(void);
+class IODevice_impl {
+public:
+  IODevice_impl(const flair::core::IODevice *self);
+  ~IODevice_impl();
+  void ResumeThread(void);
+  size_t LogSize(void) const;
+  void AppendLog(char **ptr);
+  void AddDataToLog(const flair::core::io_data *data);
+  void WriteLogsDescriptors(std::fstream &desc_file, int *index);
+  int SetToWake(const flair::core::Thread *thread);
+  void WriteLog(flair::core::Time time);
+  void AddDeviceToLog(const flair::core::IODevice *device);
+  bool SetToBeLogged(void); // return true if possible
+  void OutputToShMem(bool enabled);
+  void WriteToShMem(void);
+  void PrintLogsDescriptors(void);
 
-    private:
-        std::vector<const flair::core::IODevice*> devicesToLog;
-        const flair::core::IODevice* self;
-        const flair::core::FrameworkManager* framework;
-        FrameworkManager_impl* framework_impl;
-        std::vector<const flair::core::io_data*> datasToLog;
-        flair::core::Thread* thread_to_wake;
-        flair::core::Mutex* wake_mutex;
-        bool tobelogged;
-        bool outputtoshm;
-        flair::core::SharedMem *shmem;
+private:
+  std::vector<const flair::core::IODevice *> devicesToLog;
+  const flair::core::IODevice *self;
+  const flair::core::FrameworkManager *framework;
+  FrameworkManager_impl *framework_impl;
+  std::vector<const flair::core::io_data *> datasToLog;
+  flair::core::Thread *thread_to_wake;
+  flair::core::Mutex *wake_mutex;
+  bool tobelogged;
+  bool outputtoshm;
+  flair::core::SharedMem *shmem;
 };
 
Index: trunk/lib/FlairCore/src/unexported/Mutex_impl.h
===================================================================
--- trunk/lib/FlairCore/src/unexported/Mutex_impl.h	(revision 14)
+++ trunk/lib/FlairCore/src/unexported/Mutex_impl.h	(revision 15)
@@ -20,30 +20,26 @@
 #endif
 
-namespace flair
-{
-    namespace core
-    {
-        class Mutex;
-    }
+namespace flair {
+namespace core {
+class Mutex;
+}
 }
 
-class Mutex_impl
-{
-    public:
-        Mutex_impl(flair::core::Mutex *self);
-        ~Mutex_impl();
-        void GetMutex(void);
-        void ReleaseMutex(void);
+class Mutex_impl {
+public:
+  Mutex_impl(flair::core::Mutex *self);
+  ~Mutex_impl();
+  void GetMutex(void);
+  void ReleaseMutex(void);
 //        bool IsLocked(void);
 #ifdef __XENO__
-        RT_MUTEX mutex;
+  RT_MUTEX mutex;
 #else
-        pthread_mutex_t mutex;
-        //bool flag_locked;
+  pthread_mutex_t mutex;
+// bool flag_locked;
 #endif
 
-    private:
-        flair::core::Mutex *self;
-
+private:
+  flair::core::Mutex *self;
 };
 
Index: trunk/lib/FlairCore/src/unexported/Object_impl.h
===================================================================
--- trunk/lib/FlairCore/src/unexported/Object_impl.h	(revision 14)
+++ trunk/lib/FlairCore/src/unexported/Object_impl.h	(revision 15)
@@ -19,20 +19,21 @@
 #define OBJECT_IMPL_H
 
-class Object_impl
-{
-    public:
-        Object_impl(const flair::core::Object* self,const flair::core::Object* parent=NULL,std::string name="",std::string type="");
-        ~Object_impl();
-        std::string name,type;
-        std::vector<const flair::core::Object*> childs;
-        std::vector<const flair::core::Object*> type_childs;
-        void AddChild(const flair::core::Object* child);
-        void RemoveChild(const flair::core::Object* child);
-        bool ErrorOccured(bool recursive);
-        bool error_occured;
-        const flair::core::Object* parent;
+class Object_impl {
+public:
+  Object_impl(const flair::core::Object *self,
+              const flair::core::Object *parent = NULL, std::string name = "",
+              std::string type = "");
+  ~Object_impl();
+  std::string name, type;
+  std::vector<const flair::core::Object *> childs;
+  std::vector<const flair::core::Object *> type_childs;
+  void AddChild(const flair::core::Object *child);
+  void RemoveChild(const flair::core::Object *child);
+  bool ErrorOccured(bool recursive);
+  bool error_occured;
+  const flair::core::Object *parent;
 
-    private:
-        const flair::core::Object* self;
+private:
+  const flair::core::Object *self;
 };
 
Index: trunk/lib/FlairCore/src/unexported/OneAxisRotation_impl.h
===================================================================
--- trunk/lib/FlairCore/src/unexported/OneAxisRotation_impl.h	(revision 14)
+++ trunk/lib/FlairCore/src/unexported/OneAxisRotation_impl.h	(revision 15)
@@ -14,19 +14,16 @@
 #define ONEAXISROTATION_IMPL_H
 
-namespace flair
-{
-    namespace core
-    {
-        class Vector3D;
-        class Euler;
-        class Quaternion;
-        class RotationMatrix;
-    }
-    namespace gui
-    {
-        class GroupBox;
-        class ComboBox;
-        class DoubleSpinBox;
-    }
+namespace flair {
+namespace core {
+class Vector3D;
+class Euler;
+class Quaternion;
+class RotationMatrix;
+}
+namespace gui {
+class GroupBox;
+class ComboBox;
+class DoubleSpinBox;
+}
 }
 
@@ -35,17 +32,16 @@
 *
 */
-class OneAxisRotation_impl
-{
-    public:
-        OneAxisRotation_impl(flair::gui::GroupBox* box);
-        ~OneAxisRotation_impl();
-        void ComputeRotation(flair::core::Vector3D& point) const;
-        void ComputeRotation(flair::core::Quaternion& quat) const;
-        void ComputeRotation(flair::core::RotationMatrix& matrix) const;
-        void ComputeRotation(flair::core::Euler& euler) const;
+class OneAxisRotation_impl {
+public:
+  OneAxisRotation_impl(flair::gui::GroupBox *box);
+  ~OneAxisRotation_impl();
+  void ComputeRotation(flair::core::Vector3D &point) const;
+  void ComputeRotation(flair::core::Quaternion &quat) const;
+  void ComputeRotation(flair::core::RotationMatrix &matrix) const;
+  void ComputeRotation(flair::core::Euler &euler) const;
 
-    private:
-        flair::gui::ComboBox *rot_axe;
-        flair::gui::DoubleSpinBox* rot_value;
+private:
+  flair::gui::ComboBox *rot_axe;
+  flair::gui::DoubleSpinBox *rot_value;
 };
 
Index: trunk/lib/FlairCore/src/unexported/SendData_impl.h
===================================================================
--- trunk/lib/FlairCore/src/unexported/SendData_impl.h	(revision 14)
+++ trunk/lib/FlairCore/src/unexported/SendData_impl.h	(revision 15)
@@ -23,12 +23,11 @@
 *
 */
-class SendData_impl
-{
-    public:
-		SendData_impl();
-		~SendData_impl();
-        bool is_enabled;
-        size_t send_size;
-        uint16_t send_period;
+class SendData_impl {
+public:
+  SendData_impl();
+  ~SendData_impl();
+  bool is_enabled;
+  size_t send_size;
+  uint16_t send_period;
 };
 
Index: trunk/lib/FlairCore/src/unexported/SharedMem_impl.h
===================================================================
--- trunk/lib/FlairCore/src/unexported/SharedMem_impl.h	(revision 14)
+++ trunk/lib/FlairCore/src/unexported/SharedMem_impl.h	(revision 15)
@@ -23,10 +23,8 @@
 #endif
 
-namespace flair
-{
-    namespace core
-    {
-        class SharedMem;
-    }
+namespace flair {
+namespace core {
+class SharedMem;
+}
 }
 
@@ -36,26 +34,26 @@
 */
 
-class SharedMem_impl
-{
-    public:
-        SharedMem_impl(const flair::core::SharedMem* self,std::string name,size_t size);
-        ~SharedMem_impl();
+class SharedMem_impl {
+public:
+  SharedMem_impl(const flair::core::SharedMem *self, std::string name,
+                 size_t size);
+  ~SharedMem_impl();
 
-        void Write(const char* buf,size_t size);
-        void Read(char* buf,size_t size);
+  void Write(const char *buf, size_t size);
+  void Read(char *buf, size_t size);
 
-    private:
-        const flair::core::SharedMem* self;
-        size_t size;
-        char *mem_segment;
+private:
+  const flair::core::SharedMem *self;
+  size_t size;
+  char *mem_segment;
 #ifdef __XENO__
-        RT_HEAP heap;
-        RT_MUTEX mutex;
-        bool heap_binded;
-        bool mutex_binded;
+  RT_HEAP heap;
+  RT_MUTEX mutex;
+  bool heap_binded;
+  bool mutex_binded;
 #else
-        int fd;
-        sem_t *sem;
-        std::string sem_name,shm_name;
+  int fd;
+  sem_t *sem;
+  std::string sem_name, shm_name;
 #endif
 };
Index: trunk/lib/FlairCore/src/unexported/Socket_impl.h
===================================================================
--- trunk/lib/FlairCore/src/unexported/Socket_impl.h	(revision 14)
+++ trunk/lib/FlairCore/src/unexported/Socket_impl.h	(revision 15)
@@ -21,36 +21,35 @@
 #endif
 
-namespace flair
-{
-    namespace core
-    {
-        class Socket;
-    }
+namespace flair {
+namespace core {
+class Socket;
+}
 }
 
-class Socket_impl
-{
-    public:
-        Socket_impl(const flair::core::Socket* self, std::string name,std::string address,bool broadcast=false);
-        Socket_impl(const flair::core::Socket* self, std::string name,uint16_t port);
-        ~Socket_impl();
+class Socket_impl {
+public:
+  Socket_impl(const flair::core::Socket *self, std::string name,
+              std::string address, bool broadcast = false);
+  Socket_impl(const flair::core::Socket *self, std::string name, uint16_t port);
+  ~Socket_impl();
 
-        void SendMessage(std::string message);
-        void SendMessage(const char* src,size_t src_len);
-        ssize_t RecvMessage(char* msg,size_t msg_len,flair::core::Time timeout,char* src=NULL,size_t* src_len=NULL);
+  void SendMessage(std::string message);
+  void SendMessage(const char *src, size_t src_len);
+  ssize_t RecvMessage(char *msg, size_t msg_len, flair::core::Time timeout,
+                      char *src = NULL, size_t *src_len = NULL);
 
-    private:
-        int fd;
-        uint16_t port;
-        std::string address;
-        bool broadcast;
-        void Init(void);
-        const flair::core::Socket* self;
-        struct sockaddr_in sock_in;
+private:
+  int fd;
+  uint16_t port;
+  std::string address;
+  bool broadcast;
+  void Init(void);
+  const flair::core::Socket *self;
+  struct sockaddr_in sock_in;
 #ifdef __XENO__
-        bool is_running;
-        static void* user(void * arg);
-        pthread_t user_thread;
-        RT_PIPE pipe;
+  bool is_running;
+  static void *user(void *arg);
+  pthread_t user_thread;
+  RT_PIPE pipe;
 #endif
 };
Index: trunk/lib/FlairCore/src/unexported/Thread_impl.h
===================================================================
--- trunk/lib/FlairCore/src/unexported/Thread_impl.h	(revision 14)
+++ trunk/lib/FlairCore/src/unexported/Thread_impl.h	(revision 15)
@@ -22,55 +22,52 @@
 #endif
 
-namespace flair
-{
-    namespace core
-    {
-        class Thread;
-        class IODevice;
-        class ConditionVariable;
-    }
+namespace flair {
+namespace core {
+class Thread;
+class IODevice;
+class ConditionVariable;
+}
 }
 
-class Thread_impl
-{
-    public:
-        Thread_impl(flair::core::Thread* self,uint8_t priority);
-        ~Thread_impl();
-        void Start(void);
-        void Join(void);
-        void SafeStop(void);
-        bool ToBeStopped(void);
-        void SetPeriodUS(uint32_t period);
-        uint32_t GetPeriodUS(void) const;
-        void SetPeriodMS(uint32_t period);
-        uint32_t GetPeriodMS(void) const;
-        void WaitPeriod(void);
-        void Suspend(void);
-        bool SuspendUntil (flair::core::Time date);
-        void Resume(void);
-        bool IsSuspended(void);
-        int WaitUpdate(const flair::core::IODevice* device);
-        bool period_set;
+class Thread_impl {
+public:
+  Thread_impl(flair::core::Thread *self, uint8_t priority);
+  ~Thread_impl();
+  void Start(void);
+  void Join(void);
+  void SafeStop(void);
+  bool ToBeStopped(void);
+  void SetPeriodUS(uint32_t period);
+  uint32_t GetPeriodUS(void) const;
+  void SetPeriodMS(uint32_t period);
+  uint32_t GetPeriodMS(void) const;
+  void WaitPeriod(void);
+  void Suspend(void);
+  bool SuspendUntil(flair::core::Time date);
+  void Resume(void);
+  bool IsSuspended(void);
+  int WaitUpdate(const flair::core::IODevice *device);
+  bool period_set;
 
-    private:
-        flair::core::Thread* self;
-        flair::core::ConditionVariable* cond;
-        uint8_t priority;
-        flair::core::Time max_jitter,min_jitter,mean_jitter;
-        flair::core::Time last;
-        uint64_t cpt;
-        flair::core::Time period;
-        bool isRunning;
-        bool tobestopped;
-        bool is_suspended;
-        void PrintStats(void);
-        void ComputeJitter(flair::core::Time time);
+private:
+  flair::core::Thread *self;
+  flair::core::ConditionVariable *cond;
+  uint8_t priority;
+  flair::core::Time max_jitter, min_jitter, mean_jitter;
+  flair::core::Time last;
+  uint64_t cpt;
+  flair::core::Time period;
+  bool isRunning;
+  bool tobestopped;
+  bool is_suspended;
+  void PrintStats(void);
+  void ComputeJitter(flair::core::Time time);
 #ifdef __XENO__
-        RT_TASK task_rt;
-        static void main_rt(void * arg);
+  RT_TASK task_rt;
+  static void main_rt(void *arg);
 #else
-        pthread_t task_nrt;
-        static void* main_nrt(void * arg);
-        flair::core::Time next_time;
+  pthread_t task_nrt;
+  static void *main_nrt(void *arg);
+  flair::core::Time next_time;
 #endif
 };
Index: trunk/lib/FlairCore/src/unexported/Widget_impl.h
===================================================================
--- trunk/lib/FlairCore/src/unexported/Widget_impl.h	(revision 14)
+++ trunk/lib/FlairCore/src/unexported/Widget_impl.h	(revision 15)
@@ -17,10 +17,8 @@
 #include <io_data.h>
 
-namespace flair
-{
-    namespace gui
-    {
-        class Widget;
-    }
+namespace flair {
+namespace gui {
+class Widget;
+}
 }
 
@@ -28,87 +26,97 @@
 * \brief Classe representant un Widget
 *
-*  C'est une classe de base. Tout comme l'Object elle permet de gérer les liens de parenté
-*  et de détruire automatiquement les enfants. Elle permet en plus de gérer une communication
+*  C'est une classe de base. Tout comme l'Object elle permet de gérer les liens
+*de parenté
+*  et de détruire automatiquement les enfants. Elle permet en plus de gérer une
+*communication
 *  avec la station sol, et donc d'y afficher un QWidget. \n
-*  La comunication avec la station sol se fait par l'échange de fichiers xml. Les propriétés xml du Widget sont
+*  La comunication avec la station sol se fait par l'échange de fichiers xml.
+*Les propriétés xml du Widget sont
 *  modifiables par les fonctions appropriées. \n
-*  Un fichier xml de réglages par défaut du Widget est utilisé s'il a été spécifié à la construction du FrameworkManager.
+*  Un fichier xml de réglages par défaut du Widget est utilisé s'il a été
+*spécifié à la construction du FrameworkManager.
 */
-class Widget_impl
-{
-    friend class flair::core::FrameworkManager;
-    friend class FrameworkManager_impl;
+class Widget_impl {
+  friend class flair::core::FrameworkManager;
+  friend class FrameworkManager_impl;
 
-    public:
-        /*!
-        * \brief Constructeur
-        *
-        * Construit un Widget, qui est automatiquement enfant du parent. Le fichier xml
-        * spécifié au constructeur du FrameworkManager est utilisé pour les réglages par
-        * défaut. \n
-        * Sauf pour le FrameworkManager, ce constructeur doit être apellé depuis une tache temps réel
-        * lorsque l'on utilise la librairie framework_rt.
-        *
-        * \param parent parent
-        * \param name nom
-        * \param type type
-        */
-        Widget_impl(flair::gui::Widget* self,const flair::gui::Widget* parent,std::string name,std::string type);
+public:
+  /*!
+  * \brief Constructeur
+  *
+  * Construit un Widget, qui est automatiquement enfant du parent. Le fichier
+  *xml
+  * spécifié au constructeur du FrameworkManager est utilisé pour les réglages
+  *par
+  * défaut. \n
+  * Sauf pour le FrameworkManager, ce constructeur doit être apellé depuis une
+  *tache temps réel
+  * lorsque l'on utilise la librairie framework_rt.
+  *
+  * \param parent parent
+  * \param name nom
+  * \param type type
+  */
+  Widget_impl(flair::gui::Widget *self, const flair::gui::Widget *parent,
+              std::string name, std::string type);
 
-        /*!
-        * \brief Déstructeur
-        *
-        * Détruit automatiquement les enfants.
-        * La destruction implique la destruction du QWidget associé sur la station sol.\n
-        * Sauf pour le FrameworkManager, ce déstructeur doit être apellé depuis une tache temps réel
-        * lorsque l'on utilise la librairie framework_rt.
-        *
-        */
-        ~Widget_impl();
+  /*!
+  * \brief Déstructeur
+  *
+  * Détruit automatiquement les enfants.
+  * La destruction implique la destruction du QWidget associé sur la station
+  *sol.\n
+  * Sauf pour le FrameworkManager, ce déstructeur doit être apellé depuis une
+  *tache temps réel
+  * lorsque l'on utilise la librairie framework_rt.
+  *
+  */
+  ~Widget_impl();
 
-        /*!
-        * \brief Activer
-        *
-        * Active le QWidget associé sur la station sol. \n
-        * Un QWdiget désactivé apparait grisé et n'est pas modifiable.
-        *
-        * \param status
-        */
-        void setEnabled(bool status);
+  /*!
+  * \brief Activer
+  *
+  * Active le QWidget associé sur la station sol. \n
+  * Un QWdiget désactivé apparait grisé et n'est pas modifiable.
+  *
+  * \param status
+  */
+  void setEnabled(bool status);
 
-        /*!
-        * \brief Envoi le xml
-        *
-        * Envoi le xml à la station sol pour prendre en compte les changements.
-        */
-        void SendXml(void);
+  /*!
+  * \brief Envoi le xml
+  *
+  * Envoi le xml à la station sol pour prendre en compte les changements.
+  */
+  void SendXml(void);
 
-        xmlNodePtr file_node;
-        xmlNodePtr send_node;
-        bool isenabled;
+  xmlNodePtr file_node;
+  xmlNodePtr send_node;
+  bool isenabled;
 
-     private:
-        flair::gui::Widget* self;
+private:
+  flair::gui::Widget *self;
 
-        std::vector<flair::gui::Widget*> childs;
+  std::vector<flair::gui::Widget *> childs;
 
-        void AddChild(const flair::gui::Widget* child);
-        void RemoveChild(const flair::gui::Widget* child);
+  void AddChild(const flair::gui::Widget *child);
+  void RemoveChild(const flair::gui::Widget *child);
 
-         /*!
-        * \brief Efface les proriétés xml
-        *
-        *  Permet d'effacer toutes les propriétés XML fixées par SetVolatileXmlProp.
-        *  A utliser lorsque l'on a plus besoin d'utiliser ces propriétés. Utile
-        * pour réduire la taille des fichiers XML écangés avec la station sol.
-        */
-        void ClearXmlProps(void);
+  /*!
+ * \brief Efface les proriétés xml
+ *
+ *  Permet d'effacer toutes les propriétés XML fixées par SetVolatileXmlProp.
+ *  A utliser lorsque l'on a plus besoin d'utiliser ces propriétés. Utile
+ * pour réduire la taille des fichiers XML écangés avec la station sol.
+ */
+  void ClearXmlProps(void);
 
-        //xml
-        void ProcessXML(xmlNode *node);
-        xmlDocPtr CopyDoc(void);
-        static xmlNodePtr GetNodeByProp(xmlNodePtr doc,xmlChar *type,xmlChar *prop,xmlChar *value);
-        void printSendNode();
-        xmlDocPtr send_doc;
+  // xml
+  void ProcessXML(xmlNode *node);
+  xmlDocPtr CopyDoc(void);
+  static xmlNodePtr GetNodeByProp(xmlNodePtr doc, xmlChar *type, xmlChar *prop,
+                                  xmlChar *value);
+  void printSendNode();
+  xmlDocPtr send_doc;
 };
 
Index: trunk/lib/FlairCore/src/unexported/communication.h
===================================================================
--- trunk/lib/FlairCore/src/unexported/communication.h	(revision 14)
+++ trunk/lib/FlairCore/src/unexported/communication.h	(revision 15)
@@ -6,6 +6,5 @@
 #define COMMUNICATION_H
 
-
-//messages file socket
+// messages file socket
 #define FILE_INFO_LITTLE_ENDIAN 0x01
 #define FILE_INFO_BIG_ENDIAN 0x02
@@ -19,4 +18,3 @@
 #define DATAS_BIG_ENDIAN 0xfe
 
-
 #endif // COMMUNICATION_H
Index: trunk/lib/FlairCore/src/unexported/config.h
===================================================================
--- trunk/lib/FlairCore/src/unexported/config.h	(revision 14)
+++ trunk/lib/FlairCore/src/unexported/config.h	(revision 15)
@@ -19,53 +19,53 @@
 #define CONFIG_H
 
-//stack size of nrt threads, comment it to use default value
-#define NRT_STACK_SIZE 1024*1024*1
+// stack size of nrt threads, comment it to use default value
+#define NRT_STACK_SIZE 1024 * 1024 * 1
 
-//stack size of rt threads, comment it to use default value
-#define RT_STACK_SIZE 1024*100
+// stack size of rt threads, comment it to use default value
+#define RT_STACK_SIZE 1024 * 100
 
-//rt pipe size, comment it to use system heap
-#define RT_PIPE_SIZE 1024*1024
+// rt pipe size, comment it to use system heap
+#define RT_PIPE_SIZE 1024 * 1024
 
-//nrt pipe size
-#define NRT_PIPE_SIZE 1024*100
+// nrt pipe size
+#define NRT_PIPE_SIZE 1024 * 100
 
-//rt log heap size
-#define LOG_HEAP 1024*100
+// rt log heap size
+#define LOG_HEAP 1024 * 100
 
-//xml heap size
-#define XML_HEAP 5*1024*1024
+// xml heap size
+#define XML_HEAP 5 * 1024 * 1024
 
-//nrt pipe path
+// nrt pipe path
 #define NRT_PIPE_PATH "/proc/xenomai/registry/native/pipes/"
 
-//min priority for Threads
+// min priority for Threads
 #define MIN_THREAD_PRIORITY 20
 
-//max priority for Threads
+// max priority for Threads
 #define MAX_THREAD_PRIORITY 99
 
-//priority of the FrameworkManager task (manages udt connection)
+// priority of the FrameworkManager task (manages udt connection)
 #define FRAMEWORK_TASK_PRIORITY 1
 
-//timeout in ms for select
+// timeout in ms for select
 #define SELECT_TIMEOUT_MS 200
 
-//type of xml root element
+// type of xml root element
 #define XML_ROOT_TYPE "root"
 
-//name of xml root element
+// name of xml root element
 //#define XML_ROOT_ELEMENT "Manager"
 
-//name of main tabwidget
+// name of main tabwidget
 #define XML_MAIN_TABWIDGET "Main_TabWidget"
 
-//name of app tabwidget
+// name of app tabwidget
 #define XML_APP_TABWIDGET "App_TabWidget"
 
-//use compression for messages with ground station
+// use compression for messages with ground station
 #define COMPRESS_FRAMES
 
-//size of buffer shunck
+// size of buffer shunck
 #define COMPRESS_CHUNK 1024
 
Index: trunk/lib/FlairCore/src/unexported/cvmatrix_impl.h
===================================================================
--- trunk/lib/FlairCore/src/unexported/cvmatrix_impl.h	(revision 14)
+++ trunk/lib/FlairCore/src/unexported/cvmatrix_impl.h	(revision 15)
@@ -14,5 +14,4 @@
 #define CVMATRIX_IMPL_H
 
-
 #include <io_data.h>
 #include <cvmatrix.h>
@@ -24,19 +23,22 @@
 *
 */
-class cvmatrix_impl
-{
-    public:
-        cvmatrix_impl(flair::core::cvmatrix* self,int rows,int cols,flair::core::ScalarType const &elementDataType,int n);
-        cvmatrix_impl(flair::core::cvmatrix* self,const flair::core::cvmatrix_descriptor *descriptor, flair::core::ScalarType const &elementDataType,int n);
-        ~cvmatrix_impl();
+class cvmatrix_impl {
+public:
+  cvmatrix_impl(flair::core::cvmatrix *self, int rows, int cols,
+                flair::core::ScalarType const &elementDataType, int n);
+  cvmatrix_impl(flair::core::cvmatrix *self,
+                const flair::core::cvmatrix_descriptor *descriptor,
+                flair::core::ScalarType const &elementDataType, int n);
+  ~cvmatrix_impl();
 
-        CvMat* mat;
-        flair::core::ScalarType const &elementDataType;
-	// const since if element description is modified it would be a mess in the log
-        const flair::core::cvmatrix_descriptor *descriptor;
+  CvMat *mat;
+  flair::core::ScalarType const &elementDataType;
+  // const since if element description is modified it would be a mess in the
+  // log
+  const flair::core::cvmatrix_descriptor *descriptor;
 
-    private:
-        flair::core::cvmatrix* self;
-        void Init(flair::core::cvmatrix* self,int n);
+private:
+  flair::core::cvmatrix *self;
+  void Init(flair::core::cvmatrix *self, int n);
 };
 
Index: trunk/lib/FlairCore/src/unexported/io_data_impl.h
===================================================================
--- trunk/lib/FlairCore/src/unexported/io_data_impl.h	(revision 14)
+++ trunk/lib/FlairCore/src/unexported/io_data_impl.h	(revision 15)
@@ -19,29 +19,30 @@
 * \brief Abstract class for data types.
 *
-* Use this class to define a custom data type. Data types ares used for logging and graphs. \n
+* Use this class to define a custom data type. Data types ares used for logging
+*and graphs. \n
 * The reimplemented class must call SetSize() in its constructor. \n
 * io_data can be constructed with n samples (see io_data::io_data).
 * In this case, old samples can be accessed throug io_data::Prev.
 */
-class io_data_impl
-{
-    public:
-		io_data_impl(flair::core::io_data* self,int n);
-		~io_data_impl();
-		void Circle(void);
-		bool IsConsistent(void);
-		void SetConsistent(bool status);
-		void WriteLogDescriptor(std::fstream& desc_file,int *index);
-		void PrintLogDescriptor(void);
-        void AppendLogDescription(std::string description,flair::core::DataType const &datatype);
-        size_t size;
-        flair::core::Time time;
-        void** circle_ptr;
+class io_data_impl {
+public:
+  io_data_impl(flair::core::io_data *self, int n);
+  ~io_data_impl();
+  void Circle(void);
+  bool IsConsistent(void);
+  void SetConsistent(bool status);
+  void WriteLogDescriptor(std::fstream &desc_file, int *index);
+  void PrintLogDescriptor(void);
+  void AppendLogDescription(std::string description,
+                            flair::core::DataType const &datatype);
+  size_t size;
+  flair::core::Time time;
+  void **circle_ptr;
 
-    private:
-        flair::core::io_data* self;
-        int n;
-        bool is_consistent;
-        std::vector<std::string> descriptors;
+private:
+  flair::core::io_data *self;
+  int n;
+  bool is_consistent;
+  std::vector<std::string> descriptors;
 };
 
Index: trunk/lib/FlairCore/src/unexported/ui_com.h
===================================================================
--- trunk/lib/FlairCore/src/unexported/ui_com.h	(revision 14)
+++ trunk/lib/FlairCore/src/unexported/ui_com.h	(revision 15)
@@ -25,51 +25,48 @@
 #endif
 
-namespace flair
-{
-    namespace core
-    {
-        class Mutex;
-        class Object;
-    }
-    namespace gui
-    {
-        class SendData;
-    }
+namespace flair {
+namespace core {
+class Mutex;
+class Object;
+}
+namespace gui {
+class SendData;
+}
 }
 
-class ui_com: public flair::core::Thread
-{
-    public:
-        ui_com(const flair::core::Object *parent,UDTSOCKET sock);
-        ~ui_com();
-        void Send(char* buf,ssize_t size);
-        ssize_t Receive(char* buf,ssize_t buf_size);
-        void AddSendData(const flair::gui::SendData *obj);
-        void UpdateSendData(const flair::gui::SendData *obj);
-        void RemoveSendData(const flair::gui::SendData *obj);
-        void UpdateDataToSendSize(void);
-        void Block(void);
-        void UnBlock(void);
-        bool ConnectionLost(void);
+class ui_com : public flair::core::Thread {
+public:
+  ui_com(const flair::core::Object *parent, UDTSOCKET sock);
+  ~ui_com();
+  void Send(char *buf, ssize_t size);
+  ssize_t Receive(char *buf, ssize_t buf_size);
+  void AddSendData(const flair::gui::SendData *obj);
+  void UpdateSendData(const flair::gui::SendData *obj);
+  void RemoveSendData(const flair::gui::SendData *obj);
+  void UpdateDataToSendSize(void);
+  void Block(void);
+  void UnBlock(void);
+  bool ConnectionLost(void);
 
-    private:
-        ssize_t send_size;
-        char *send_buffer;
-        std::vector<const flair::gui::SendData*> data_to_send;
-        std::vector<flair::core::Time> resume_time;
-        flair::core::Mutex *send_mutex;
-        UDTSOCKET socket_fd;
-        bool connection_lost;
-        void Run(void);
-        void SendDatas(void);
-        static int compressBuffer(char *in, ssize_t in_size,char **out,ssize_t *out_size, int level);
-        static int uncompressBuffer(unsigned char *in, ssize_t in_size,unsigned char **out,ssize_t *out_size);
+private:
+  ssize_t send_size;
+  char *send_buffer;
+  std::vector<const flair::gui::SendData *> data_to_send;
+  std::vector<flair::core::Time> resume_time;
+  flair::core::Mutex *send_mutex;
+  UDTSOCKET socket_fd;
+  bool connection_lost;
+  void Run(void);
+  void SendDatas(void);
+  static int compressBuffer(char *in, ssize_t in_size, char **out,
+                            ssize_t *out_size, int level);
+  static int uncompressBuffer(unsigned char *in, ssize_t in_size,
+                              unsigned char **out, ssize_t *out_size);
 #ifdef __XENO__
-        bool is_running;
-        static void* user_thread(void * arg);
-        pthread_t thread;
-        RT_PIPE pipe;
+  bool is_running;
+  static void *user_thread(void *arg);
+  pthread_t thread;
+  RT_PIPE pipe;
 #endif
-
 };
 
Index: trunk/lib/FlairFilter/src/Ahrs.cpp
===================================================================
--- trunk/lib/FlairFilter/src/Ahrs.cpp	(revision 14)
+++ trunk/lib/FlairFilter/src/Ahrs.cpp	(revision 15)
@@ -27,67 +27,50 @@
 using namespace flair::sensor;
 
-namespace flair { namespace filter {
+namespace flair {
+namespace filter {
 
-Ahrs::Ahrs(const Imu* parent,string name) : IODevice(parent,name) {
-    pimpl_=new Ahrs_impl(this);
-    AddDataToLog(pimpl_->ahrsData);
+Ahrs::Ahrs(const Imu *parent, string name) : IODevice(parent, name) {
+  pimpl_ = new Ahrs_impl(this);
+  AddDataToLog(pimpl_->ahrsData);
 }
 
-Ahrs::~Ahrs() {
-    delete pimpl_;
-}
+Ahrs::~Ahrs() { delete pimpl_; }
 
-const Imu *Ahrs::GetImu(void) const {
-    return (Imu*)Parent();
-}
+const Imu *Ahrs::GetImu(void) const { return (Imu *)Parent(); }
 
-const AhrsData *Ahrs::GetDatas(void) const {
-    return pimpl_->ahrsData;
-}
+const AhrsData *Ahrs::GetDatas(void) const { return pimpl_->ahrsData; }
 
 void Ahrs::GetDatas(core::AhrsData **ahrsData) const {
-    *ahrsData=pimpl_->ahrsData;
+  *ahrsData = pimpl_->ahrsData;
 }
 
 void Ahrs::LockUserInterface(void) const {
-    //((Imu*)Parent())->LockUserInterface();
+  //((Imu*)Parent())->LockUserInterface();
 }
 
 void Ahrs::UnlockUserInterface(void) const {
-    //((Imu*)Parent())->UnlockUserInterface();
+  //((Imu*)Parent())->UnlockUserInterface();
 }
 
 void Ahrs::UseDefaultPlot(void) {
-    pimpl_->UseDefaultPlot();
-    ((Imu*)Parent())->UseDefaultPlot();
+  pimpl_->UseDefaultPlot();
+  ((Imu *)Parent())->UseDefaultPlot();
 }
 
-void Ahrs::AddPlot(const AhrsData *ahrsData,DataPlot::Color_t color) {
-    pimpl_->AddPlot(ahrsData,color);
+void Ahrs::AddPlot(const AhrsData *ahrsData, DataPlot::Color_t color) {
+  pimpl_->AddPlot(ahrsData, color);
 }
 
-DataPlot1D *Ahrs::RollPlot(void) const {
-    return pimpl_->rollPlot;
-}
+DataPlot1D *Ahrs::RollPlot(void) const { return pimpl_->rollPlot; }
 
-DataPlot1D *Ahrs::PitchPlot(void) const {
-    return pimpl_->pitchPlot;
-}
+DataPlot1D *Ahrs::PitchPlot(void) const { return pimpl_->pitchPlot; }
 
-DataPlot1D *Ahrs::YawPlot(void) const {
-    return pimpl_->yawPlot;
-}
+DataPlot1D *Ahrs::YawPlot(void) const { return pimpl_->yawPlot; }
 
-DataPlot1D *Ahrs::WXPlot(void) const {
-    return pimpl_->wXPlot;
-}
+DataPlot1D *Ahrs::WXPlot(void) const { return pimpl_->wXPlot; }
 
-DataPlot1D *Ahrs::WYPlot(void) const {
-    return pimpl_->wYPlot;
-}
+DataPlot1D *Ahrs::WYPlot(void) const { return pimpl_->wYPlot; }
 
-DataPlot1D *Ahrs::WZPlot(void) const {
-    return pimpl_->wZPlot;
-}
+DataPlot1D *Ahrs::WZPlot(void) const { return pimpl_->wZPlot; }
 
 } // end namespace filter
Index: trunk/lib/FlairFilter/src/Ahrs.h
===================================================================
--- trunk/lib/FlairFilter/src/Ahrs.h	(revision 14)
+++ trunk/lib/FlairFilter/src/Ahrs.h	(revision 15)
@@ -18,167 +18,168 @@
 
 namespace flair {
-    namespace core {
-        class Euler;
-        class Vector3D;
-        class ImuData;
-        class Quaternion;
-        class AhrsData;
-    }
-    namespace gui {
-        class Tab;
-        class DataPlot1D;
-    }
-    namespace sensor {
-        class Imu;
-    }
+namespace core {
+class Euler;
+class Vector3D;
+class ImuData;
+class Quaternion;
+class AhrsData;
+}
+namespace gui {
+class Tab;
+class DataPlot1D;
+}
+namespace sensor {
+class Imu;
+}
 }
 
 class Ahrs_impl;
 
-namespace flair { namespace filter {
-    /*! \class Ahrs
-    *
-    * \brief Abstract class for AHRS
-    *
-    * Use this class to define a custom AHRS. This class is child
-    * of an Imu class, which will provide measurements. \n
-    *
-    */
-    class Ahrs : public core::IODevice {
-        public:
-            /*!
-            * \brief Constructor
-            *
-            * Construct an Ahrs.
-            *
-            * \param parent parent
-            * \param name name
-            */
-            Ahrs(const sensor::Imu* parent,std::string name);
+namespace flair {
+namespace filter {
+/*! \class Ahrs
+*
+* \brief Abstract class for AHRS
+*
+* Use this class to define a custom AHRS. This class is child
+* of an Imu class, which will provide measurements. \n
+*
+*/
+class Ahrs : public core::IODevice {
+public:
+  /*!
+  * \brief Constructor
+  *
+  * Construct an Ahrs.
+  *
+  * \param parent parent
+  * \param name name
+  */
+  Ahrs(const sensor::Imu *parent, std::string name);
 
-            /*!
-            * \brief Destructor
-            *
-            */
-            ~Ahrs();
+  /*!
+  * \brief Destructor
+  *
+  */
+  ~Ahrs();
 
-            /*!
-            * \brief Get parent Imu
-            *
-            * This function is identical to (Imu*)Parent()
-            */
-            const sensor::Imu *GetImu(void) const;
+  /*!
+  * \brief Get parent Imu
+  *
+  * This function is identical to (Imu*)Parent()
+  */
+  const sensor::Imu *GetImu(void) const;
 
-            /*!
-            * \brief Get ahrs datas
-            *
-            * \return AhrsData
-            */
-            const core::AhrsData *GetDatas(void) const;
+  /*!
+  * \brief Get ahrs datas
+  *
+  * \return AhrsData
+  */
+  const core::AhrsData *GetDatas(void) const;
 
-            /*!
-            * \brief Lock the graphical user interface
-            *
-            * When locked, parameters cannot be modified.
-            *
-            */
-            void LockUserInterface(void) const;
+  /*!
+  * \brief Lock the graphical user interface
+  *
+  * When locked, parameters cannot be modified.
+  *
+  */
+  void LockUserInterface(void) const;
 
-            /*!
-            * \brief Unlock the graphical user interface
-            *
-            */
-            void UnlockUserInterface(void) const;
+  /*!
+  * \brief Unlock the graphical user interface
+  *
+  */
+  void UnlockUserInterface(void) const;
 
-            /*!
-            * \brief Use default plot
-            *
-            * Plot the datas defined in imudata,
-            * and datas defined in Imu::imudata.
-            *
-            */
-            void UseDefaultPlot(void);
+  /*!
+  * \brief Use default plot
+  *
+  * Plot the datas defined in imudata,
+  * and datas defined in Imu::imudata.
+  *
+  */
+  void UseDefaultPlot(void);
 
-            /*!
-            * \brief Add plot
-            *
-            * Add plot of an AhrsData to the default plot
-            *
-            * \param ahrsData ahrs datas to plot
-            * \param color color to use
-            */
-            void AddPlot(const core::AhrsData *ahrsData,gui::DataPlot::Color_t color);
+  /*!
+  * \brief Add plot
+  *
+  * Add plot of an AhrsData to the default plot
+  *
+  * \param ahrsData ahrs datas to plot
+  * \param color color to use
+  */
+  void AddPlot(const core::AhrsData *ahrsData, gui::DataPlot::Color_t color);
 
-            /*!
-            * \brief Roll plot
-            *
-            * Use this plot to add own curves.
-            *
-            * \return plot
-            *
-            */
-            gui::DataPlot1D *RollPlot(void)const ;
+  /*!
+  * \brief Roll plot
+  *
+  * Use this plot to add own curves.
+  *
+  * \return plot
+  *
+  */
+  gui::DataPlot1D *RollPlot(void) const;
 
-            /*!
-            * \brief Pitch plot
-            *
-            * Use this plot to add own curves.
-            *
-            * \return plot
-            *
-            */
-            gui::DataPlot1D *PitchPlot(void) const;
+  /*!
+  * \brief Pitch plot
+  *
+  * Use this plot to add own curves.
+  *
+  * \return plot
+  *
+  */
+  gui::DataPlot1D *PitchPlot(void) const;
 
-            /*!
-            * \brief Yaw plot
-            *
-            * Use this plot to add own curves.
-            *
-            * \return plot
-            *
-            */
-            gui::DataPlot1D *YawPlot(void) const;
+  /*!
+  * \brief Yaw plot
+  *
+  * Use this plot to add own curves.
+  *
+  * \return plot
+  *
+  */
+  gui::DataPlot1D *YawPlot(void) const;
 
-            /*!
-            * \brief Rotation speed around x axis plot
-            *
-            * Use this plot to add own curves.
-            *
-            * \return plot
-            *
-            */
-            gui::DataPlot1D *WXPlot(void) const;
+  /*!
+  * \brief Rotation speed around x axis plot
+  *
+  * Use this plot to add own curves.
+  *
+  * \return plot
+  *
+  */
+  gui::DataPlot1D *WXPlot(void) const;
 
-            /*!
-            * \brief Rotation speed around y axis plot
-            *
-            * Use this plot to add own curves.
-            *
-            * \return plot
-            *
-            */
-            gui::DataPlot1D *WYPlot(void) const;
+  /*!
+  * \brief Rotation speed around y axis plot
+  *
+  * Use this plot to add own curves.
+  *
+  * \return plot
+  *
+  */
+  gui::DataPlot1D *WYPlot(void) const;
 
-            /*!
-            * \brief Rotation speed around z axis plot
-            *
-            * Use this plot to add own curves.
-            *
-            * \return plot
-            *
-            */
-            gui::DataPlot1D *WZPlot(void) const;
+  /*!
+  * \brief Rotation speed around z axis plot
+  *
+  * Use this plot to add own curves.
+  *
+  * \return plot
+  *
+  */
+  gui::DataPlot1D *WZPlot(void) const;
 
-        protected:
-            /*!
-            * \brief Get ahrs datas
-            *
-            * \param ahrsData ahrs datas
-            */
-            void GetDatas(core::AhrsData **ahrsData) const;
+protected:
+  /*!
+  * \brief Get ahrs datas
+  *
+  * \param ahrsData ahrs datas
+  */
+  void GetDatas(core::AhrsData **ahrsData) const;
 
-        private:
-            class Ahrs_impl *pimpl_;
-    };
+private:
+  class Ahrs_impl *pimpl_;
+};
 } // end namespace filter
 } // end namespace flair
Index: trunk/lib/FlairFilter/src/Ahrs_impl.cpp
===================================================================
--- trunk/lib/FlairFilter/src/Ahrs_impl.cpp	(revision 14)
+++ trunk/lib/FlairFilter/src/Ahrs_impl.cpp	(revision 15)
@@ -30,70 +30,68 @@
 using namespace flair::sensor;
 
-Ahrs_impl::Ahrs_impl(Ahrs* inSelf): self(inSelf) {
-    rollPlot=NULL;
-    pitchPlot=NULL;
-    yawPlot=NULL;
-    wXPlot=NULL;
-    wYPlot=NULL;
-    wZPlot=NULL;
-    q0Plot=NULL;
-    q1Plot=NULL;
-    q2Plot=NULL;
-    q3Plot=NULL;
+Ahrs_impl::Ahrs_impl(Ahrs *inSelf) : self(inSelf) {
+  rollPlot = NULL;
+  pitchPlot = NULL;
+  yawPlot = NULL;
+  wXPlot = NULL;
+  wYPlot = NULL;
+  wZPlot = NULL;
+  q0Plot = NULL;
+  q1Plot = NULL;
+  q2Plot = NULL;
+  q3Plot = NULL;
 
-    eulerTab=NULL;
-    quaternionTab=NULL;
+  eulerTab = NULL;
+  quaternionTab = NULL;
 
-    ahrsData=new AhrsData(self);
+  ahrsData = new AhrsData(self);
 }
 
-Ahrs_impl::~Ahrs_impl() {
-}
+Ahrs_impl::~Ahrs_impl() {}
 
 void Ahrs_impl::UseDefaultPlot(void) {
 
-    eulerTab=new Tab(((Imu*)(self->Parent()))->tab,"AHRS");
-    rollPlot=new DataPlot1D(eulerTab->NewRow(),"roll",-30,30);
-    rollPlot->AddCurve(ahrsData->Element(AhrsData::RollDeg));
-    pitchPlot=new DataPlot1D(eulerTab->LastRowLastCol(),"pitch",-30,30);
-    pitchPlot->AddCurve(ahrsData->Element(AhrsData::PitchDeg));
-    yawPlot=new DataPlot1D(eulerTab->LastRowLastCol(),"yaw",-180,180);
-    yawPlot->AddCurve(ahrsData->Element(AhrsData::YawDeg));
+  eulerTab = new Tab(((Imu *)(self->Parent()))->tab, "AHRS");
+  rollPlot = new DataPlot1D(eulerTab->NewRow(), "roll", -30, 30);
+  rollPlot->AddCurve(ahrsData->Element(AhrsData::RollDeg));
+  pitchPlot = new DataPlot1D(eulerTab->LastRowLastCol(), "pitch", -30, 30);
+  pitchPlot->AddCurve(ahrsData->Element(AhrsData::PitchDeg));
+  yawPlot = new DataPlot1D(eulerTab->LastRowLastCol(), "yaw", -180, 180);
+  yawPlot->AddCurve(ahrsData->Element(AhrsData::YawDeg));
 
-    wXPlot=new DataPlot1D(eulerTab->NewRow(),"w_x",-200,200);
-    wXPlot->AddCurve(ahrsData->Element(AhrsData::WxDeg));
-    wYPlot=new DataPlot1D(eulerTab->LastRowLastCol(),"w_y",-200,200);
-    wYPlot->AddCurve(ahrsData->Element(AhrsData::WyDeg));
-    wZPlot=new DataPlot1D(eulerTab->LastRowLastCol(),"w_z",-200,200);
-    wZPlot->AddCurve(ahrsData->Element(AhrsData::WzDeg));
+  wXPlot = new DataPlot1D(eulerTab->NewRow(), "w_x", -200, 200);
+  wXPlot->AddCurve(ahrsData->Element(AhrsData::WxDeg));
+  wYPlot = new DataPlot1D(eulerTab->LastRowLastCol(), "w_y", -200, 200);
+  wYPlot->AddCurve(ahrsData->Element(AhrsData::WyDeg));
+  wZPlot = new DataPlot1D(eulerTab->LastRowLastCol(), "w_z", -200, 200);
+  wZPlot->AddCurve(ahrsData->Element(AhrsData::WzDeg));
 
-    quaternionTab=new Tab(((Imu*)(self->Parent()))->tab,"Quaternion");
-    q0Plot=new DataPlot1D(quaternionTab->NewRow(),"q0",-1,1);
-    q0Plot->AddCurve(ahrsData->Element(AhrsData::Q0));
-    q1Plot=new DataPlot1D(quaternionTab->NewRow(),"q1",-1,1);
-    q1Plot->AddCurve(ahrsData->Element(AhrsData::Q1));
-    q2Plot=new DataPlot1D(quaternionTab->LastRowLastCol(),"q2",-1,1);
-    q2Plot->AddCurve(ahrsData->Element(AhrsData::Q2));
-    q3Plot=new DataPlot1D(quaternionTab->LastRowLastCol(),"q3",-1,1);
-    q3Plot->AddCurve(ahrsData->Element(AhrsData::Q3));
-
+  quaternionTab = new Tab(((Imu *)(self->Parent()))->tab, "Quaternion");
+  q0Plot = new DataPlot1D(quaternionTab->NewRow(), "q0", -1, 1);
+  q0Plot->AddCurve(ahrsData->Element(AhrsData::Q0));
+  q1Plot = new DataPlot1D(quaternionTab->NewRow(), "q1", -1, 1);
+  q1Plot->AddCurve(ahrsData->Element(AhrsData::Q1));
+  q2Plot = new DataPlot1D(quaternionTab->LastRowLastCol(), "q2", -1, 1);
+  q2Plot->AddCurve(ahrsData->Element(AhrsData::Q2));
+  q3Plot = new DataPlot1D(quaternionTab->LastRowLastCol(), "q3", -1, 1);
+  q3Plot->AddCurve(ahrsData->Element(AhrsData::Q3));
 }
 
-void Ahrs_impl::AddPlot(const AhrsData *ahrsData,DataPlot::Color_t color) {
-    if(rollPlot!=NULL) {
-        rollPlot->AddCurve(ahrsData->Element(AhrsData::RollDeg),color);
-        pitchPlot->AddCurve(ahrsData->Element(AhrsData::PitchDeg),color);
-        yawPlot->AddCurve(ahrsData->Element(AhrsData::YawDeg),color);
-    }
-    if(wXPlot!=NULL) {
-        wXPlot->AddCurve(ahrsData->Element(AhrsData::WxDeg),color);
-        wYPlot->AddCurve(ahrsData->Element(AhrsData::WyDeg),color);
-        wZPlot->AddCurve(ahrsData->Element(AhrsData::WzDeg),color);
-    }
-    if(quaternionTab!=NULL) {
-        q0Plot->AddCurve(ahrsData->Element(AhrsData::Q0),color);
-        q1Plot->AddCurve(ahrsData->Element(AhrsData::Q1),color);
-        q2Plot->AddCurve(ahrsData->Element(AhrsData::Q2),color);
-        q3Plot->AddCurve(ahrsData->Element(AhrsData::Q3),color);
-    }
+void Ahrs_impl::AddPlot(const AhrsData *ahrsData, DataPlot::Color_t color) {
+  if (rollPlot != NULL) {
+    rollPlot->AddCurve(ahrsData->Element(AhrsData::RollDeg), color);
+    pitchPlot->AddCurve(ahrsData->Element(AhrsData::PitchDeg), color);
+    yawPlot->AddCurve(ahrsData->Element(AhrsData::YawDeg), color);
+  }
+  if (wXPlot != NULL) {
+    wXPlot->AddCurve(ahrsData->Element(AhrsData::WxDeg), color);
+    wYPlot->AddCurve(ahrsData->Element(AhrsData::WyDeg), color);
+    wZPlot->AddCurve(ahrsData->Element(AhrsData::WzDeg), color);
+  }
+  if (quaternionTab != NULL) {
+    q0Plot->AddCurve(ahrsData->Element(AhrsData::Q0), color);
+    q1Plot->AddCurve(ahrsData->Element(AhrsData::Q1), color);
+    q2Plot->AddCurve(ahrsData->Element(AhrsData::Q2), color);
+    q3Plot->AddCurve(ahrsData->Element(AhrsData::Q3), color);
+  }
 }
Index: trunk/lib/FlairFilter/src/ButterworthLowPass.cpp
===================================================================
--- trunk/lib/FlairFilter/src/ButterworthLowPass.cpp	(revision 14)
+++ trunk/lib/FlairFilter/src/ButterworthLowPass.cpp	(revision 15)
@@ -26,41 +26,33 @@
 using namespace flair::gui;
 
-namespace flair
-{
-namespace filter
-{
+namespace flair {
+namespace filter {
 
-ButterworthLowPass::ButterworthLowPass(const IODevice* parent,const LayoutPosition* position,string name,int order): IODevice(parent,name)
-{
-    pimpl_=new ButterworthLowPass_impl(this,position,name,order);
-    AddDataToLog(pimpl_->output);
+ButterworthLowPass::ButterworthLowPass(const IODevice *parent,
+                                       const LayoutPosition *position,
+                                       string name, int order)
+    : IODevice(parent, name) {
+  pimpl_ = new ButterworthLowPass_impl(this, position, name, order);
+  AddDataToLog(pimpl_->output);
 }
 
-ButterworthLowPass::ButterworthLowPass(const gui::LayoutPosition* position,string name,int order): IODevice(position->getLayout(),name)
-{
-    pimpl_=new ButterworthLowPass_impl(this,position,name,order);
-    AddDataToLog(pimpl_->output);
+ButterworthLowPass::ButterworthLowPass(const gui::LayoutPosition *position,
+                                       string name, int order)
+    : IODevice(position->getLayout(), name) {
+  pimpl_ = new ButterworthLowPass_impl(this, position, name, order);
+  AddDataToLog(pimpl_->output);
 }
 
+ButterworthLowPass::~ButterworthLowPass() { delete pimpl_; }
 
-ButterworthLowPass::~ButterworthLowPass()
-{
-    delete pimpl_;
+cvmatrix *ButterworthLowPass::Matrix(void) const { return pimpl_->output; }
+
+float ButterworthLowPass::Output(void) const {
+  return pimpl_->output->Value(0, 0);
 }
 
-cvmatrix *ButterworthLowPass::Matrix(void) const
-{
-    return pimpl_->output;
-}
-
-float ButterworthLowPass::Output(void) const
-{
-   return pimpl_->output->Value(0,0);
-}
-
-void ButterworthLowPass::UpdateFrom(const io_data *data)
-{
-    pimpl_->UpdateFrom(data);
-    ProcessUpdate(pimpl_->output);
+void ButterworthLowPass::UpdateFrom(const io_data *data) {
+  pimpl_->UpdateFrom(data);
+  ProcessUpdate(pimpl_->output);
 }
 
Index: trunk/lib/FlairFilter/src/ButterworthLowPass.h
===================================================================
--- trunk/lib/FlairFilter/src/ButterworthLowPass.h	(revision 14)
+++ trunk/lib/FlairFilter/src/ButterworthLowPass.h	(revision 15)
@@ -16,91 +16,89 @@
 #include <IODevice.h>
 
-namespace flair
-{
-    namespace core
-    {
-        class cvmatrix;
-    }
-    namespace gui
-    {
-        class LayoutPosition;
-    }
+namespace flair {
+namespace core {
+class cvmatrix;
+}
+namespace gui {
+class LayoutPosition;
+}
 }
 
 class ButterworthLowPass_impl;
 
-namespace flair
-{
-namespace filter
-{
-    /*! \class ButterworthLowPass
-    *
-    * \brief Class defining a Butterworth low pass filter
-    */
-    class ButterworthLowPass : public core::IODevice
-    {
-        public:
-            /*!
-            * \brief Constructor
-            *
-            * Construct a ButterworthLowPass at position. \n
-            * After calling this function, position will be deleted as it is no longer usefull. \n
-            * The filter is automatically updated when parent's
-            * IODevice::ProcessUpdate is called.
-            *
-            * \param parent parent
-            * \param position position to display settings
-            * \param name name
-            * \param order order of the filter
-            */
-            ButterworthLowPass(const IODevice* parent,const gui::LayoutPosition* position,std::string name,int order);
+namespace flair {
+namespace filter {
+/*! \class ButterworthLowPass
+*
+* \brief Class defining a Butterworth low pass filter
+*/
+class ButterworthLowPass : public core::IODevice {
+public:
+  /*!
+  * \brief Constructor
+  *
+  * Construct a ButterworthLowPass at position. \n
+  * After calling this function, position will be deleted as it is no longer
+  *usefull. \n
+  * The filter is automatically updated when parent's
+  * IODevice::ProcessUpdate is called.
+  *
+  * \param parent parent
+  * \param position position to display settings
+  * \param name name
+  * \param order order of the filter
+  */
+  ButterworthLowPass(const IODevice *parent,
+                     const gui::LayoutPosition *position, std::string name,
+                     int order);
 
-            /*!
-            * \brief Constructor
-            *
-            * Construct a ButterworthLowPass at position. \n
-            * The ButterworthLowPass will automatically be child of position->getLayout() Layout. After calling this function,
-            * position will be deleted as it is no longer usefull. \n
-            * The filter is updated manually with UpdateFrom method. \n
-            *
-            * \param position position to display settings
-            * \param name name
-            * \param order order of the filter
-            */
-            ButterworthLowPass(const gui::LayoutPosition* position,std::string name,int order);
+  /*!
+  * \brief Constructor
+  *
+  * Construct a ButterworthLowPass at position. \n
+  * The ButterworthLowPass will automatically be child of position->getLayout()
+  *Layout. After calling this function,
+  * position will be deleted as it is no longer usefull. \n
+  * The filter is updated manually with UpdateFrom method. \n
+  *
+  * \param position position to display settings
+  * \param name name
+  * \param order order of the filter
+  */
+  ButterworthLowPass(const gui::LayoutPosition *position, std::string name,
+                     int order);
 
-            /*!
-            * \brief Destructor
-            *
-            */
-            ~ButterworthLowPass();
+  /*!
+  * \brief Destructor
+  *
+  */
+  ~ButterworthLowPass();
 
-            /*!
-            * \brief Output value
-            *
-            * \return filtered output
-            */
-            float Output(void) const;
+  /*!
+  * \brief Output value
+  *
+  * \return filtered output
+  */
+  float Output(void) const;
 
-            /*!
-            * \brief Output matrix
-            *
-            * \return filtered output
-            */
-            core::cvmatrix* Matrix(void)const ;
+  /*!
+  * \brief Output matrix
+  *
+  * \return filtered output
+  */
+  core::cvmatrix *Matrix(void) const;
 
-            /*!
-            * \brief Update using provided datas
-            *
-            * Reimplemented from IODevice.
-            *
-            * \param data data from the parent to process
-            */
-            void UpdateFrom(const core::io_data *data);
+  /*!
+  * \brief Update using provided datas
+  *
+  * Reimplemented from IODevice.
+  *
+  * \param data data from the parent to process
+  */
+  void UpdateFrom(const core::io_data *data);
 
-        private:
-
-            class ButterworthLowPass_impl* pimpl_;
-    };
+private:
+  class ButterworthLowPass_impl *pimpl_;
+};
 } // end namespace filter
 } // end namespace flair
Index: trunk/lib/FlairFilter/src/ButterworthLowPass_impl.cpp
===================================================================
--- trunk/lib/FlairFilter/src/ButterworthLowPass_impl.cpp	(revision 14)
+++ trunk/lib/FlairFilter/src/ButterworthLowPass_impl.cpp	(revision 15)
@@ -29,72 +29,63 @@
 using namespace flair::filter;
 
-ButterworthLowPass_impl::ButterworthLowPass_impl(ButterworthLowPass* self,const LayoutPosition* position,string name,int order)
-{
-    //init UI
-    GroupBox* reglages_groupbox=new GroupBox(position,name);
-        T=new DoubleSpinBox(reglages_groupbox->NewRow(),"period, 0 for auto"," s",0,10,0.01);
-        cutoff=new DoubleSpinBox(reglages_groupbox->NewRow(),"cutoff frequency"," Hz",0,10000,0.1,2,1);
+ButterworthLowPass_impl::ButterworthLowPass_impl(ButterworthLowPass *self,
+                                                 const LayoutPosition *position,
+                                                 string name, int order) {
+  // init UI
+  GroupBox *reglages_groupbox = new GroupBox(position, name);
+  T = new DoubleSpinBox(reglages_groupbox->NewRow(), "period, 0 for auto", " s",
+                        0, 10, 0.01);
+  cutoff = new DoubleSpinBox(reglages_groupbox->NewRow(), "cutoff frequency",
+                             " Hz", 0, 10000, 0.1, 2, 1);
 
-    cvmatrix_descriptor* desc=new cvmatrix_descriptor(1,1);
-    desc->SetElementName(0,0,"output");
-    output=new cvmatrix(self,desc,floatType,name);
+  cvmatrix_descriptor *desc = new cvmatrix_descriptor(1, 1);
+  desc->SetElementName(0, 0, "output");
+  output = new cvmatrix(self, desc, floatType, name);
 
-    output->SetValue(0,0,0);
+  output->SetValue(0, 0, 0);
 
-	f= new PoleFilter(order);
+  f = new PoleFilter(order);
 
-    if(T->Value()!=0) f->setup(1./T->Value(), cutoff->Value());
-	f->reset();
+  if (T->Value() != 0)
+    f->setup(1. / T->Value(), cutoff->Value());
+  f->reset();
 
-	first_update=true;
+  first_update = true;
 }
 
-ButterworthLowPass_impl::~ButterworthLowPass_impl()
-{
-    delete f;
+ButterworthLowPass_impl::~ButterworthLowPass_impl() { delete f; }
+
+void ButterworthLowPass_impl::UpdateFrom(const io_data *data) {
+  float result;
+  cvmatrix *input = (cvmatrix *)data;
+
+  if (T->ValueChanged() || cutoff->ValueChanged()) {
+    if (T->Value() != 0) {
+      f->setup(1. / T->Value(), cutoff->Value());
+    } else {
+      first_update = true;
+    }
+  }
+
+  // on prend une fois pour toute les mutex et on fait des accès directs
+  output->GetMutex();
+  input->GetMutex();
+
+  if (T->Value() == 0) {
+    float delta_t = (float)(data->DataTime() - previous_time) / 1000000000.;
+    f->setup(1. / delta_t, cutoff->Value());
+  }
+
+  if (first_update == true) {
+    first_update = false;
+  } else {
+    result = f->filter(input->ValueNoMutex(0, 0));
+    output->SetValueNoMutex(0, 0, result);
+  }
+
+  input->ReleaseMutex();
+  output->ReleaseMutex();
+
+  output->SetDataTime(data->DataTime());
+  previous_time = data->DataTime();
 }
-
-void ButterworthLowPass_impl::UpdateFrom(const io_data *data)
-{
-    float result;
-    cvmatrix *input=(cvmatrix*)data;
-
-    if(T->ValueChanged() || cutoff->ValueChanged())
-    {
-        if(T->Value()!=0)
-        {
-            f->setup (1./T->Value(), cutoff->Value());
-        }
-        else
-        {
-            first_update=true;
-        }
-    }
-
-    //on prend une fois pour toute les mutex et on fait des accès directs
-    output->GetMutex();
-    input->GetMutex();
-
-    if(T->Value()==0)
-    {
-        float delta_t=(float)(data->DataTime()-previous_time)/1000000000.;
-        f->setup (1./delta_t, cutoff->Value());
-    }
-
-    if(first_update==true)
-    {
-        first_update=false;
-    }
-    else
-    {
-        result = f->filter(input->ValueNoMutex(0,0));
-        output->SetValueNoMutex(0,0,result);
-    }
-
-    input->ReleaseMutex();
-    output->ReleaseMutex();
-
-    output->SetDataTime(data->DataTime());
-    previous_time=data->DataTime();
-}
-
Index: trunk/lib/FlairFilter/src/ControlLaw.cpp
===================================================================
--- trunk/lib/FlairFilter/src/ControlLaw.cpp	(revision 14)
+++ trunk/lib/FlairFilter/src/ControlLaw.cpp	(revision 15)
@@ -29,39 +29,39 @@
 namespace filter {
 
-ControlLaw::ControlLaw(const Object* parent,string name,uint32_t nb_out) : IODevice(parent,name) {
-    if(nb_out==1) {
-        output=new cvmatrix(this,nb_out,1,floatType,name);
-    } else {
-        cvmatrix_descriptor* desc=new cvmatrix_descriptor(nb_out,1);
-        for(int i=0;i<nb_out;i++) {
-            std::stringstream ss;
-            ss << i;
-            desc->SetElementName(i,0,ss.str());
-        }
-        output=new cvmatrix(this,desc,floatType,name);
+ControlLaw::ControlLaw(const Object *parent, string name, uint32_t nb_out)
+    : IODevice(parent, name) {
+  if (nb_out == 1) {
+    output = new cvmatrix(this, nb_out, 1, floatType, name);
+  } else {
+    cvmatrix_descriptor *desc = new cvmatrix_descriptor(nb_out, 1);
+    for (int i = 0; i < nb_out; i++) {
+      std::stringstream ss;
+      ss << i;
+      desc->SetElementName(i, 0, ss.str());
     }
+    output = new cvmatrix(this, desc, floatType, name);
+  }
 
-    input=NULL;
-    AddDataToLog(output);
+  input = NULL;
+  AddDataToLog(output);
 }
 
-ControlLaw::~ControlLaw(void) {
-
-}
+ControlLaw::~ControlLaw(void) {}
 
 void ControlLaw::Update(Time time) {
-    input->SetDataTime(time);
-    UpdateFrom(input);
+  input->SetDataTime(time);
+  UpdateFrom(input);
 }
 
 float ControlLaw::Output(uint32_t index) const {
-    return output->Value(index,0);
+  return output->Value(index, 0);
 }
 
-void ControlLaw::UseDefaultPlot(const LayoutPosition* position) {
-    if(output->Rows()!=1) Warn("Output size is different from 1. Plotting only Output(1,1).\n");
+void ControlLaw::UseDefaultPlot(const LayoutPosition *position) {
+  if (output->Rows() != 1)
+    Warn("Output size is different from 1. Plotting only Output(1,1).\n");
 
-    DataPlot1D *plot=new DataPlot1D(position,ObjectName(),-1,1);
-    plot->AddCurve(output->Element(0));
+  DataPlot1D *plot = new DataPlot1D(position, ObjectName(), -1, 1);
+  plot->AddCurve(output->Element(0));
 }
 } // end namespace filter
Index: trunk/lib/FlairFilter/src/ControlLaw.h
===================================================================
--- trunk/lib/FlairFilter/src/ControlLaw.h	(revision 14)
+++ trunk/lib/FlairFilter/src/ControlLaw.h	(revision 15)
@@ -17,105 +17,108 @@
 
 namespace flair {
-    namespace gui {
-        class LayoutPosition;
-    }
-    namespace core {
-        class cvmatrix;
-    }
+namespace gui {
+class LayoutPosition;
+}
+namespace core {
+class cvmatrix;
+}
 }
 
-namespace flair { namespace filter {
-    /*! \class ControlLaw
-    *
-    * \brief Base class for control law
-    * input must be created by reimplemented class.\n
-    * output is created by this class, it is of size (nb_out,1) and type float.\n
-    * see constructor for nb_out
-    */
-    class ControlLaw : public core::IODevice {
-        public:
-            /*!
-            * \brief Constructor
-            *
-            * Construct a ControlLaw
-            *
-            * \param parent parent
-            * \param name name
-            * \param nb_out number of output
-            */
-            ControlLaw(const core::Object* parent,std::string name,uint32_t nb_out=1);
+namespace flair {
+namespace filter {
+/*! \class ControlLaw
+*
+* \brief Base class for control law
+* input must be created by reimplemented class.\n
+* output is created by this class, it is of size (nb_out,1) and type float.\n
+* see constructor for nb_out
+*/
+class ControlLaw : public core::IODevice {
+public:
+  /*!
+  * \brief Constructor
+  *
+  * Construct a ControlLaw
+  *
+  * \param parent parent
+  * \param name name
+  * \param nb_out number of output
+  */
+  ControlLaw(const core::Object *parent, std::string name, uint32_t nb_out = 1);
 
-            /*!
-            * \brief Destructor
-            *
-            */
-            ~ControlLaw();
+  /*!
+  * \brief Destructor
+  *
+  */
+  ~ControlLaw();
 
-            /*!
-            * \brief Output value
-            *
-            * \param index output index, between 0 and nb_out-1
-            *
-            * \return output value
-            */
-            float Output(uint32_t index=0) const;
+  /*!
+  * \brief Output value
+  *
+  * \param index output index, between 0 and nb_out-1
+  *
+  * \return output value
+  */
+  float Output(uint32_t index = 0) const;
 
-            /*!
-            * \brief Use default plot
-            *
-            * Plot the output value at given position. \n
-            * Only Output(1,1) is plotted. \n
-            * In case of a mutliple output ControlLaw, this function should be reimplemented. \n
-            * After calling this function, position will be deleted as it is no longer usefull. \n
-            *
-            * \param position position to display plot
-            */
-            virtual void UseDefaultPlot(const gui::LayoutPosition* position);
+  /*!
+  * \brief Use default plot
+  *
+  * Plot the output value at given position. \n
+  * Only Output(1,1) is plotted. \n
+  * In case of a mutliple output ControlLaw, this function should be
+  *reimplemented. \n
+  * After calling this function, position will be deleted as it is no longer
+  *usefull. \n
+  *
+  * \param position position to display plot
+  */
+  virtual void UseDefaultPlot(const gui::LayoutPosition *position);
 
-            /*!
-            * \brief Update using provided datas
-            *
-            * Reimplemented class must fill input matrix before calling this.
-            *
-            * \param time time of the update
-            */
-            void Update(core::Time time);
+  /*!
+  * \brief Update using provided datas
+  *
+  * Reimplemented class must fill input matrix before calling this.
+  *
+  * \param time time of the update
+  */
+  void Update(core::Time time);
 
-            /*!
-            * \brief Reset the internal state of the control law
-            *
-            * Doesn't do anything by default
-            *
-            */
-            virtual void Reset() {};
+  /*!
+  * \brief Reset the internal state of the control law
+  *
+  * Doesn't do anything by default
+  *
+  */
+  virtual void Reset(){};
 
-        protected:
-            /*!
-            * \brief input matrix
-            *
-            * This matrix must be created by the reimplemented class.
-            *
-            */
-            core::cvmatrix *input;
+protected:
+  /*!
+  * \brief input matrix
+  *
+  * This matrix must be created by the reimplemented class.
+  *
+  */
+  core::cvmatrix *input;
 
-            /*!
-            * \brief output matrix
-            *
-            * This matrix is created by this class. Its size is (nb_out,1) and its type
-            * is io_data::Float.
-            *
-            */
-            core::cvmatrix *output;
+  /*!
+  * \brief output matrix
+  *
+  * This matrix is created by this class. Its size is (nb_out,1) and its type
+  * is io_data::Float.
+  *
+  */
+  core::cvmatrix *output;
 
-        private:
-            /*!
-            * \brief Update using provided datas
-            *
-            * Reimplemented from IODevice.
-            *
-            * \param data data from the parent to process
-            */
-            virtual void UpdateFrom(const core::io_data *data)=0;
-    };
+private:
+  /*!
+  * \brief Update using provided datas
+  *
+  * Reimplemented from IODevice.
+  *
+  * \param data data from the parent to process
+  */
+  virtual void UpdateFrom(const core::io_data *data) = 0;
+};
 } // end namespace filter
 } // end namespace flair
Index: trunk/lib/FlairFilter/src/EulerDerivative.cpp
===================================================================
--- trunk/lib/FlairFilter/src/EulerDerivative.cpp	(revision 14)
+++ trunk/lib/FlairFilter/src/EulerDerivative.cpp	(revision 15)
@@ -25,34 +25,26 @@
 using namespace flair::gui;
 
-namespace flair
-{
-namespace filter
-{
+namespace flair {
+namespace filter {
 
-EulerDerivative::EulerDerivative(const IODevice* parent,const LayoutPosition* position,string name,const cvmatrix* init_value) : IODevice(parent,name)
-{
-    pimpl_=new EulerDerivative_impl(this,position,name,init_value);
-    AddDataToLog(pimpl_->output);
+EulerDerivative::EulerDerivative(const IODevice *parent,
+                                 const LayoutPosition *position, string name,
+                                 const cvmatrix *init_value)
+    : IODevice(parent, name) {
+  pimpl_ = new EulerDerivative_impl(this, position, name, init_value);
+  AddDataToLog(pimpl_->output);
 }
 
-EulerDerivative::~EulerDerivative()
-{
-    delete pimpl_;
+EulerDerivative::~EulerDerivative() { delete pimpl_; }
+
+cvmatrix *EulerDerivative::Matrix(void) const { return pimpl_->output; }
+
+float EulerDerivative::Output(int row, int col) const {
+  return pimpl_->output->Value(row, col);
 }
 
-cvmatrix* EulerDerivative::Matrix(void) const
-{
-    return pimpl_->output;
-}
-
-float EulerDerivative::Output(int row,int col) const
-{
-    return pimpl_->output->Value(row,col);
-}
-
-void EulerDerivative::UpdateFrom(const io_data *data)
-{
-    pimpl_->UpdateFrom(data);
-    ProcessUpdate(pimpl_->output);
+void EulerDerivative::UpdateFrom(const io_data *data) {
+  pimpl_->UpdateFrom(data);
+  ProcessUpdate(pimpl_->output);
 }
 
Index: trunk/lib/FlairFilter/src/EulerDerivative.h
===================================================================
--- trunk/lib/FlairFilter/src/EulerDerivative.h	(revision 14)
+++ trunk/lib/FlairFilter/src/EulerDerivative.h	(revision 15)
@@ -16,84 +16,81 @@
 #include <IODevice.h>
 
-namespace flair
-{
-    namespace core
-    {
-        class cvmatrix;
-    }
-    namespace gui
-    {
-        class LayoutPosition;
-    }
+namespace flair {
+namespace core {
+class cvmatrix;
+}
+namespace gui {
+class LayoutPosition;
+}
 }
 
 class EulerDerivative_impl;
 
-namespace flair
-{
-namespace filter
-{
-    /*! \class EulerDerivative
-    *
-    * \brief Class defining an euler derivative
-    */
+namespace flair {
+namespace filter {
+/*! \class EulerDerivative
+*
+* \brief Class defining an euler derivative
+*/
 
-    class EulerDerivative : public core::IODevice
-    {
-        public:
-            /*!
-            * \brief Constructor
-            *
-            * Construct an EulerDerivative at given position. \n
-            * After calling this function, position will be deleted as it is no longer usefull. \n
-            * The filter is automatically updated when parent's
-            * IODevice::ProcessUpdate is called. \n
-            * The optional init_value parameters allow to specify
-            * the size of the input datas and its inital values.
-            * If unspecified, a 1*1 size is used, and values are
-            * initialized with 0.
-            *
-            * \param parent parent
-            * \param position position to display settings
-            * \param name name
-            * \param init_value initial value
-            */
-            EulerDerivative(const core::IODevice* parent,const gui::LayoutPosition* position,std::string name,const core::cvmatrix* init_value=NULL);
+class EulerDerivative : public core::IODevice {
+public:
+  /*!
+  * \brief Constructor
+  *
+  * Construct an EulerDerivative at given position. \n
+  * After calling this function, position will be deleted as it is no longer
+  *usefull. \n
+  * The filter is automatically updated when parent's
+  * IODevice::ProcessUpdate is called. \n
+  * The optional init_value parameters allow to specify
+  * the size of the input datas and its inital values.
+  * If unspecified, a 1*1 size is used, and values are
+  * initialized with 0.
+  *
+  * \param parent parent
+  * \param position position to display settings
+  * \param name name
+  * \param init_value initial value
+  */
+  EulerDerivative(const core::IODevice *parent,
+                  const gui::LayoutPosition *position, std::string name,
+                  const core::cvmatrix *init_value = NULL);
 
-            /*!
-            * \brief Destructor
-            *
-            */
-            ~EulerDerivative();
+  /*!
+  * \brief Destructor
+  *
+  */
+  ~EulerDerivative();
 
-            /*!
-            * \brief Output value
-            *
-            * \param row row element
-            * \param col column element
-            *
-            * \return element value
-            */
-            float Output(int row, int col) const;
+  /*!
+  * \brief Output value
+  *
+  * \param row row element
+  * \param col column element
+  *
+  * \return element value
+  */
+  float Output(int row, int col) const;
 
-            /*!
-            * \brief Output matrix
-            *
-            * \return filtered output
-            */
-            core::cvmatrix *Matrix(void) const;
+  /*!
+  * \brief Output matrix
+  *
+  * \return filtered output
+  */
+  core::cvmatrix *Matrix(void) const;
 
-        private:
-            /*!
-            * \brief Update using provided datas
-            *
-            * Reimplemented from IODevice.
-            *
-            * \param data data from the parent to process
-            */
-            void UpdateFrom(const core::io_data *data);
+private:
+  /*!
+  * \brief Update using provided datas
+  *
+  * Reimplemented from IODevice.
+  *
+  * \param data data from the parent to process
+  */
+  void UpdateFrom(const core::io_data *data);
 
-            class EulerDerivative_impl* pimpl_;
-    };
+  class EulerDerivative_impl *pimpl_;
+};
 } // end namespace filter
 } // end namespace flair
Index: trunk/lib/FlairFilter/src/EulerDerivative_impl.cpp
===================================================================
--- trunk/lib/FlairFilter/src/EulerDerivative_impl.cpp	(revision 14)
+++ trunk/lib/FlairFilter/src/EulerDerivative_impl.cpp	(revision 15)
@@ -28,91 +28,78 @@
 using namespace flair::filter;
 
-EulerDerivative_impl::EulerDerivative_impl(EulerDerivative* self,const LayoutPosition* position,string name,const cvmatrix* init_value)
-{
-    first_update=true;
+EulerDerivative_impl::EulerDerivative_impl(EulerDerivative *self,
+                                           const LayoutPosition *position,
+                                           string name,
+                                           const cvmatrix *init_value) {
+  first_update = true;
 
-    if(init_value!=NULL)
-    {
-        prev_value=(cvmatrix*)init_value;
+  if (init_value != NULL) {
+    prev_value = (cvmatrix *)init_value;
+  } else {
+    // if NULL, assume dimension 1, and init=0
+    cvmatrix_descriptor *desc = new cvmatrix_descriptor(1, 1);
+    desc->SetElementName(0, 0, "output");
+    prev_value = new cvmatrix(self, desc, floatType, name);
+    prev_value->SetValue(0, 0, 0);
+  }
+
+  // init UI
+  GroupBox *reglages_groupbox = new GroupBox(position, name);
+  T = new DoubleSpinBox(reglages_groupbox->NewRow(), "period, 0 for auto:",
+                        " s", 0, 1, 0.01);
+
+  // init output matrix of same size as init
+  cvmatrix_descriptor *desc =
+      new cvmatrix_descriptor(prev_value->Rows(), prev_value->Cols());
+
+  for (int i = 0; i < prev_value->Rows(); i++) {
+    for (int j = 0; j < prev_value->Cols(); j++) {
+      desc->SetElementName(i, j, prev_value->Name(i, j));
     }
-    else
-    {
-        //if NULL, assume dimension 1, and init=0
-        cvmatrix_descriptor* desc=new cvmatrix_descriptor(1,1);
-        desc->SetElementName(0,0,"output");
-        prev_value=new cvmatrix(self,desc,floatType,name);
-        prev_value->SetValue(0,0,0);
+  }
+
+  output = new cvmatrix(self, desc,
+                        prev_value->GetDataType().GetElementDataType(), name);
+}
+
+EulerDerivative_impl::~EulerDerivative_impl() {}
+
+void EulerDerivative_impl::UpdateFrom(const io_data *data) {
+  float delta_t;
+  cvmatrix *input = (cvmatrix *)data;
+
+  // on prend une fois pour toute les mutex et on fait des accès directs
+  output->GetMutex();
+  input->GetMutex();
+
+  if (first_update == true) {
+    for (int i = 0; i < input->Rows(); i++) {
+      for (int j = 0; j < input->Cols(); j++) {
+        output->SetValueNoMutex(i, j, prev_value->ValueNoMutex(i, j));
+        prev_value->SetValueNoMutex(i, j, input->ValueNoMutex(i, j));
+      }
+    }
+    first_update = false;
+  } else {
+    if (T->Value() == 0) {
+      delta_t = (float)(data->DataTime() - previous_time) / 1000000000.;
+    } else {
+      delta_t = T->Value();
     }
 
-    //init UI
-    GroupBox* reglages_groupbox=new GroupBox(position,name);
-        T=new DoubleSpinBox(reglages_groupbox->NewRow(),"period, 0 for auto:"," s",0,1,0.01);
+    for (int i = 0; i < input->Rows(); i++) {
+      for (int j = 0; j < input->Cols(); j++) {
+        output->SetValueNoMutex(
+            i, j, (input->ValueNoMutex(i, j) - prev_value->ValueNoMutex(i, j)) /
+                      delta_t);
+        prev_value->SetValueNoMutex(i, j, input->ValueNoMutex(i, j));
+      }
+    }
+  }
 
-    //init output matrix of same size as init
-    cvmatrix_descriptor* desc=new cvmatrix_descriptor(prev_value->Rows(),prev_value->Cols());
+  input->ReleaseMutex();
+  output->ReleaseMutex();
 
-    for(int i=0;i<prev_value->Rows();i++)
-    {
-        for(int j=0;j<prev_value->Cols();j++)
-        {
-            desc->SetElementName(i,j,prev_value->Name(i,j));
-        }
-    }
-
-    output=new cvmatrix(self,desc,prev_value->GetDataType().GetElementDataType(),name);
+  output->SetDataTime(data->DataTime());
+  previous_time = data->DataTime();
 }
-
-EulerDerivative_impl::~EulerDerivative_impl()
-{
-
-}
-
-void EulerDerivative_impl::UpdateFrom(const io_data *data)
-{
-    float delta_t;
-    cvmatrix *input=(cvmatrix*)data;
-
-    //on prend une fois pour toute les mutex et on fait des accès directs
-    output->GetMutex();
-    input->GetMutex();
-
-    if(first_update==true)
-    {
-        for(int i=0;i<input->Rows();i++)
-        {
-            for(int j=0;j<input->Cols();j++)
-            {
-                output->SetValueNoMutex(i,j,prev_value->ValueNoMutex(i,j));
-                prev_value->SetValueNoMutex(i,j,input->ValueNoMutex(i,j));
-            }
-        }
-        first_update=false;
-    }
-    else
-    {
-        if(T->Value()==0)
-        {
-            delta_t=(float)(data->DataTime()-previous_time)/1000000000.;
-        }
-        else
-        {
-            delta_t=T->Value();
-        }
-
-        for(int i=0;i<input->Rows();i++)
-        {
-            for(int j=0;j<input->Cols();j++)
-            {
-                output->SetValueNoMutex(i,j,(input->ValueNoMutex(i,j)-prev_value->ValueNoMutex(i,j))/delta_t);
-                prev_value->SetValueNoMutex(i,j,input->ValueNoMutex(i,j));
-            }
-        }
-    }
-
-    input->ReleaseMutex();
-    output->ReleaseMutex();
-
-    output->SetDataTime(data->DataTime());
-    previous_time=data->DataTime();
-}
-
Index: trunk/lib/FlairFilter/src/Gx3_25_ahrs.cpp
===================================================================
--- trunk/lib/FlairFilter/src/Gx3_25_ahrs.cpp	(revision 14)
+++ trunk/lib/FlairFilter/src/Gx3_25_ahrs.cpp	(revision 15)
@@ -24,32 +24,31 @@
 using namespace flair::sensor;
 
-namespace flair { namespace filter {
+namespace flair {
+namespace filter {
 
-Gx3_25_ahrs::Gx3_25_ahrs(const FrameworkManager* parent,string name,SerialPort *serialport,Gx3_25_imu::Command_t command,uint8_t priority) : Ahrs(new Gx3_25_imu(parent,name,serialport,command,priority),name) {
-}
+Gx3_25_ahrs::Gx3_25_ahrs(const FrameworkManager *parent, string name,
+                         SerialPort *serialport, Gx3_25_imu::Command_t command,
+                         uint8_t priority)
+    : Ahrs(new Gx3_25_imu(parent, name, serialport, command, priority), name) {}
 
-Gx3_25_ahrs::~Gx3_25_ahrs() {
-}
+Gx3_25_ahrs::~Gx3_25_ahrs() {}
 
-void Gx3_25_ahrs::Start(void) {
-    ((Gx3_25_imu*)GetImu())->Start();
-}
+void Gx3_25_ahrs::Start(void) { ((Gx3_25_imu *)GetImu())->Start(); }
 
-//datas from Gx3_25_imu are AhrsData!
+// datas from Gx3_25_imu are AhrsData!
 void Gx3_25_ahrs::UpdateFrom(const io_data *data) {
-    AhrsData *input=(AhrsData*)data;
-    AhrsData *output;
-    GetDatas(&output);
+  AhrsData *input = (AhrsData *)data;
+  AhrsData *output;
+  GetDatas(&output);
 
-    Quaternion quaternion;
-    Vector3D filteredAngRates;
-    input->GetQuaternionAndAngularRates(quaternion,filteredAngRates);
-    output->SetQuaternionAndAngularRates(quaternion,filteredAngRates);
-    output->SetDataTime(input->DataTime());
+  Quaternion quaternion;
+  Vector3D filteredAngRates;
+  input->GetQuaternionAndAngularRates(quaternion, filteredAngRates);
+  output->SetQuaternionAndAngularRates(quaternion, filteredAngRates);
+  output->SetDataTime(input->DataTime());
 
-    ProcessUpdate(output);
+  ProcessUpdate(output);
 }
 
 } // end namespace filter
 } // end namespace flair
-
Index: trunk/lib/FlairFilter/src/Gx3_25_ahrs.h
===================================================================
--- trunk/lib/FlairFilter/src/Gx3_25_ahrs.h	(revision 14)
+++ trunk/lib/FlairFilter/src/Gx3_25_ahrs.h	(revision 15)
@@ -17,52 +17,51 @@
 #include <Gx3_25_imu.h>
 
-namespace flair
-{
-namespace filter
-{
-    /*! \class Gx3_25_ahrs
-    *
-    * \brief Class for 3dmgx3-25 ahrs
-    *
-    * This class constructs a Gx3_25_imu as Imu of this Ahrs.
-    */
-    class Gx3_25_ahrs : public Ahrs
-    {
-        public:
-            /*!
-            * \brief Constructor
-            *
-            * Construct an Ahrs for 3dmgx3-25
-            *
-            * \param parent parent
-            * \param name name
-            * \param serialport Imu SerialPort
-            * \param command command for the Gx3_25_imu continuous mode
-            * \param priority priority of the Gx3_25_imu Thread
-            */
-            Gx3_25_ahrs(const core::FrameworkManager* parent,std::string name,core::SerialPort *serialport,sensor::Gx3_25_imu::Command_t command,uint8_t priority);
+namespace flair {
+namespace filter {
+/*! \class Gx3_25_ahrs
+*
+* \brief Class for 3dmgx3-25 ahrs
+*
+* This class constructs a Gx3_25_imu as Imu of this Ahrs.
+*/
+class Gx3_25_ahrs : public Ahrs {
+public:
+  /*!
+  * \brief Constructor
+  *
+  * Construct an Ahrs for 3dmgx3-25
+  *
+  * \param parent parent
+  * \param name name
+  * \param serialport Imu SerialPort
+  * \param command command for the Gx3_25_imu continuous mode
+  * \param priority priority of the Gx3_25_imu Thread
+  */
+  Gx3_25_ahrs(const core::FrameworkManager *parent, std::string name,
+              core::SerialPort *serialport,
+              sensor::Gx3_25_imu::Command_t command, uint8_t priority);
 
-            /*!
-            * \brief Destructor
-            *
-            */
-            ~Gx3_25_ahrs();
+  /*!
+  * \brief Destructor
+  *
+  */
+  ~Gx3_25_ahrs();
 
-            /*!
-            * \brief Start Gx3_25_imu Thread
-            *
-            */
-            void Start(void);
+  /*!
+  * \brief Start Gx3_25_imu Thread
+  *
+  */
+  void Start(void);
 
-        private:
-            /*!
-            * \brief Update using provided datas
-            *
-            * Reimplemented from IODevice.
-            *
-            * \param data data from the parent to process
-            */
-            void UpdateFrom(const core::io_data *data);
-    };
+private:
+  /*!
+  * \brief Update using provided datas
+  *
+  * Reimplemented from IODevice.
+  *
+  * \param data data from the parent to process
+  */
+  void UpdateFrom(const core::io_data *data);
+};
 } // end namespace filter
 } // end namespace flair
Index: trunk/lib/FlairFilter/src/JoyReference.cpp
===================================================================
--- trunk/lib/FlairFilter/src/JoyReference.cpp	(revision 14)
+++ trunk/lib/FlairFilter/src/JoyReference.cpp	(revision 15)
@@ -29,92 +29,65 @@
 using namespace flair::gui;
 
-namespace flair { namespace filter {
+namespace flair {
+namespace filter {
 
-JoyReference::JoyReference(const LayoutPosition* position,string name) : IODevice(position->getLayout(),name) {
-    pimpl_=new JoyReference_impl(this,position,name);
-    AddDataToLog(pimpl_->output);
-    AddDataToLog(pimpl_->ahrsData);
+JoyReference::JoyReference(const LayoutPosition *position, string name)
+    : IODevice(position->getLayout(), name) {
+  pimpl_ = new JoyReference_impl(this, position, name);
+  AddDataToLog(pimpl_->output);
+  AddDataToLog(pimpl_->ahrsData);
 }
 
-JoyReference::~JoyReference(void) {
-    delete pimpl_;
+JoyReference::~JoyReference(void) { delete pimpl_; }
+
+AhrsData *JoyReference::GetReferenceOrientation(void) const {
+  return pimpl_->ahrsData;
 }
 
-AhrsData* JoyReference::GetReferenceOrientation(void) const{
-    return pimpl_->ahrsData;
+void JoyReference::SetRollAxis(float value) { pimpl_->SetRollAxis(value); }
+
+void JoyReference::SetPitchAxis(float value) { pimpl_->SetPitchAxis(value); }
+
+void JoyReference::SetYawAxis(float value) { pimpl_->SetYawAxis(value); }
+
+void JoyReference::SetAltitudeAxis(float value) {
+  pimpl_->SetAltitudeAxis(value);
 }
 
-void JoyReference::SetRollAxis(float value) {
-    pimpl_->SetRollAxis(value);
-}
+void JoyReference::RollTrimUp(void) { pimpl_->RollTrimUp(); }
 
-void JoyReference::SetPitchAxis(float value) {
-    pimpl_->SetPitchAxis(value);
-}
+void JoyReference::RollTrimDown(void) { pimpl_->RollTrimDown(); }
 
-void JoyReference::SetYawAxis(float value) {
-    pimpl_->SetYawAxis(value);
-}
+void JoyReference::PitchTrimUp(void) { pimpl_->PitchTrimUp(); }
 
-void JoyReference::SetAltitudeAxis(float value) {
-    pimpl_->SetAltitudeAxis(value);
-}
+void JoyReference::PitchTrimDown(void) { pimpl_->PitchTrimDown(); }
 
-void JoyReference::RollTrimUp(void) {
-    pimpl_->RollTrimUp();
-}
-
-void JoyReference::RollTrimDown(void) {
-    pimpl_->RollTrimDown();
-}
-
-void JoyReference::PitchTrimUp(void) {
-    pimpl_->PitchTrimUp();
-}
-
-void JoyReference::PitchTrimDown(void) {
-    pimpl_->PitchTrimDown();
-}
-
-void JoyReference::SetYawRef(float value) {
-    pimpl_->SetYawRef(value);
-}
+void JoyReference::SetYawRef(float value) { pimpl_->SetYawRef(value); }
 
 void JoyReference::SetYawRef(core::Quaternion const &value) {
-    Euler euler;
-    value.ToEuler(euler);
-    pimpl_->SetYawRef(euler.yaw);
+  Euler euler;
+  value.ToEuler(euler);
+  pimpl_->SetYawRef(euler.yaw);
 }
-void JoyReference::SetZRef(float value) {
-    pimpl_->SetZRef(value);
-}
+void JoyReference::SetZRef(float value) { pimpl_->SetZRef(value); }
 
-float JoyReference::ZRef(void) const {
-    return pimpl_->ZRef();
-}
+float JoyReference::ZRef(void) const { return pimpl_->ZRef(); }
 
-float JoyReference::DzRef(void) const {
-    return pimpl_->dZRef();
-}
+float JoyReference::DzRef(void) const { return pimpl_->dZRef(); }
 
-float JoyReference::RollTrim(void) const {
-    return pimpl_->RollTrim();
-}
+float JoyReference::RollTrim(void) const { return pimpl_->RollTrim(); }
 
-float JoyReference::PitchTrim(void) const {
-    return pimpl_->PitchTrim();
-}
+float JoyReference::PitchTrim(void) const { return pimpl_->PitchTrim(); }
 
 void JoyReference::Update(Time time) {
-    pimpl_->Update(time);
-    ProcessUpdate(pimpl_->output);
+  pimpl_->Update(time);
+  ProcessUpdate(pimpl_->output);
 }
 
 void JoyReference::UpdateFrom(const io_data *data) {
-    pimpl_->UpdateFrom(data);
-    ProcessUpdate(pimpl_->output);
+  pimpl_->UpdateFrom(data);
+  ProcessUpdate(pimpl_->output);
 }
 
 } // end namespace sensor
 } // end namespace flair
-
Index: trunk/lib/FlairFilter/src/JoyReference.h
===================================================================
--- trunk/lib/FlairFilter/src/JoyReference.h	(revision 14)
+++ trunk/lib/FlairFilter/src/JoyReference.h	(revision 15)
@@ -17,186 +17,190 @@
 #include <stdint.h>
 
-namespace flair
-{
-    namespace core {
-        class Quaternion;
-        class AhrsData;
-    }
-    namespace gui {
-        class LayoutPosition;
-    }
+namespace flair {
+namespace core {
+class Quaternion;
+class AhrsData;
 }
+namespace gui {
+class LayoutPosition;
+}
+}
 
 class JoyReference_impl;
 
-namespace flair { namespace filter {
-    /*! \class JoyReference
-    *
-    * \brief Class creating references from a joystick
-    */
-    class JoyReference : public core::IODevice
-    {
-        public:
-            /*!
-            * \brief Constructor
-            *
-            * Construct a JoyReference at given position. \n
-            * The JoyReference will automatically be child of position->getLayout() Layout. After calling this function,
-            * position will be deleted as it is no longer usefull. \n
-            * JoyReference compute reference in quaternion, wz, altitude and altitude speed.
-            *
-            * \param position position
-            * \param name name
-            */
-            JoyReference(const gui::LayoutPosition* position,std::string name);
-
-            /*!
-            * \brief Destructor
-            *
-            */
-            ~JoyReference();
-
-            /*!
-            * \brief Set roll axis value
-            *
-            * \param value value
-            */
-            void SetRollAxis(float value);
-
-            /*!
-            * \brief Set pitch axis value
-            *
-            * \param value value
-            */
-            void SetPitchAxis(float value);
-
-            /*!
-            * \brief Set yaw axis value
-            *
-            * \param value value
-            */
-            void SetYawAxis(float value);
-
-            /*!
-            * \brief Set thrust axis value
-            *
-            * \param value value
-            */
-            void SetAltitudeAxis(float value);
-
-            /*!
-            * \brief Get orientation reference
-            *
-            * \return reference
-            */
-            core::AhrsData* GetReferenceOrientation(void) const;
-
-            /*!
-            * \brief Get z reference
-            *
-            * \return reference
-            */
-            float ZRef(void) const;
-
-            /*!
-            * \brief Get z derivative reference
-            *
-            * \return reference
-            */
-            float DzRef(void) const;
-
-            /*!
-            * \brief Get roll trim
-            *
-            * \return trim value
-            */
-            float RollTrim(void) const;
-
-            /*!
-            * \brief Get pitch trim
-            *
-            * \return trim value
-            */
-            float PitchTrim(void) const;
-
-            /*!
-            * \brief Set yaw reference
-            *
-            * Yaw part of the output quaternion is obtained by integrating the wz desired angular speed.\n
-            * This method reset the yaw.
-            *
-            * \param value value
-            */
-            void SetYawRef(float value);
-
-            /*!
-            * \brief Set yaw reference
-            *
-            * Yaw part of the output quaternion is obtained by integrating the wz desired angular speed.\n
-            * This method reset the yaw.
-            *
-            * \param value value, only the yaw part of the quaternion is used
-            */
-            void SetYawRef(core::Quaternion const &value);
-
-            /*!
-            * \brief Set z reference
-            *
-            * Altitude of the output is obtained by integrating the vz desired altitude speed.\n
-            * This method reset z.
-            *
-            * \param value value
-            */
-            void SetZRef(float value);
-
-            /*!
-            * \brief Trim up roll
-            *
-            * Roll trim value is increased by one
-            */
-            void RollTrimUp(void);
-
-            /*!
-            * \brief Trim down roll
-            *
-            * Roll trim value is decreased by one
-            */
-            void RollTrimDown(void);
-
-            /*!
-            * \brief Trim up pitch
-            *
-            * Pitch trim value is increased by one
-            */
-            void PitchTrimUp(void);
-
-            /*!
-            * \brief Trim down pitch
-            *
-            * Pitch trim value is decreased by one
-            */
-            void PitchTrimDown(void);
-
-            /*!
-            * \brief Update references
-            *
-            * Calls UpdateFrom with values entered manually.
-            *
-            * \param time time
-            */
-            void Update(core::Time time);
-
-        private:
-            /*!
-            * \brief Update using provided datas
-            *
-            * Reimplemented from IODevice.
-            *
-            * \param data data from the parent to process
-            */
-            void UpdateFrom(const core::io_data *data);
-
-            class JoyReference_impl* pimpl_;
-    };
+namespace flair {
+namespace filter {
+/*! \class JoyReference
+*
+* \brief Class creating references from a joystick
+*/
+class JoyReference : public core::IODevice {
+public:
+  /*!
+  * \brief Constructor
+  *
+  * Construct a JoyReference at given position. \n
+  * The JoyReference will automatically be child of position->getLayout()
+  *Layout. After calling this function,
+  * position will be deleted as it is no longer usefull. \n
+  * JoyReference compute reference in quaternion, wz, altitude and altitude
+  *speed.
+  *
+  * \param position position
+  * \param name name
+  */
+  JoyReference(const gui::LayoutPosition *position, std::string name);
+
+  /*!
+  * \brief Destructor
+  *
+  */
+  ~JoyReference();
+
+  /*!
+  * \brief Set roll axis value
+  *
+  * \param value value
+  */
+  void SetRollAxis(float value);
+
+  /*!
+  * \brief Set pitch axis value
+  *
+  * \param value value
+  */
+  void SetPitchAxis(float value);
+
+  /*!
+  * \brief Set yaw axis value
+  *
+  * \param value value
+  */
+  void SetYawAxis(float value);
+
+  /*!
+  * \brief Set thrust axis value
+  *
+  * \param value value
+  */
+  void SetAltitudeAxis(float value);
+
+  /*!
+  * \brief Get orientation reference
+  *
+  * \return reference
+  */
+  core::AhrsData *GetReferenceOrientation(void) const;
+
+  /*!
+  * \brief Get z reference
+  *
+  * \return reference
+  */
+  float ZRef(void) const;
+
+  /*!
+  * \brief Get z derivative reference
+  *
+  * \return reference
+  */
+  float DzRef(void) const;
+
+  /*!
+  * \brief Get roll trim
+  *
+  * \return trim value
+  */
+  float RollTrim(void) const;
+
+  /*!
+  * \brief Get pitch trim
+  *
+  * \return trim value
+  */
+  float PitchTrim(void) const;
+
+  /*!
+  * \brief Set yaw reference
+  *
+  * Yaw part of the output quaternion is obtained by integrating the wz desired
+  *angular speed.\n
+  * This method reset the yaw.
+  *
+  * \param value value
+  */
+  void SetYawRef(float value);
+
+  /*!
+  * \brief Set yaw reference
+  *
+  * Yaw part of the output quaternion is obtained by integrating the wz desired
+  *angular speed.\n
+  * This method reset the yaw.
+  *
+  * \param value value, only the yaw part of the quaternion is used
+  */
+  void SetYawRef(core::Quaternion const &value);
+
+  /*!
+  * \brief Set z reference
+  *
+  * Altitude of the output is obtained by integrating the vz desired altitude
+  *speed.\n
+  * This method reset z.
+  *
+  * \param value value
+  */
+  void SetZRef(float value);
+
+  /*!
+  * \brief Trim up roll
+  *
+  * Roll trim value is increased by one
+  */
+  void RollTrimUp(void);
+
+  /*!
+  * \brief Trim down roll
+  *
+  * Roll trim value is decreased by one
+  */
+  void RollTrimDown(void);
+
+  /*!
+  * \brief Trim up pitch
+  *
+  * Pitch trim value is increased by one
+  */
+  void PitchTrimUp(void);
+
+  /*!
+  * \brief Trim down pitch
+  *
+  * Pitch trim value is decreased by one
+  */
+  void PitchTrimDown(void);
+
+  /*!
+  * \brief Update references
+  *
+  * Calls UpdateFrom with values entered manually.
+  *
+  * \param time time
+  */
+  void Update(core::Time time);
+
+private:
+  /*!
+  * \brief Update using provided datas
+  *
+  * Reimplemented from IODevice.
+  *
+  * \param data data from the parent to process
+  */
+  void UpdateFrom(const core::io_data *data);
+
+  class JoyReference_impl *pimpl_;
+};
 } // end namespace sensor
 } // end namespace flair
Index: trunk/lib/FlairFilter/src/JoyReference_impl.cpp
===================================================================
--- trunk/lib/FlairFilter/src/JoyReference_impl.cpp	(revision 14)
+++ trunk/lib/FlairFilter/src/JoyReference_impl.cpp	(revision 15)
@@ -34,169 +34,169 @@
 using namespace flair::filter;
 
-JoyReference_impl::JoyReference_impl(JoyReference *inSelf,const LayoutPosition* position,string name): self(inSelf) {
-
-    ahrsData= new AhrsData(self);
-	input=new cvmatrix(self,4,1,floatType,name);
-
-	cvmatrix_descriptor* desc=new cvmatrix_descriptor(4,1);
-	desc->SetElementName(0,0,"z");;
-	desc->SetElementName(1,0,"dz");
-    desc->SetElementName(2,0,"trim_roll");
-    desc->SetElementName(3,0,"trim_pitch");
-    output=new cvmatrix(self,desc,floatType,name);
-
-	reglages_groupbox=new GroupBox(position,name);
-    deb_roll=new DoubleSpinBox(reglages_groupbox->NewRow(),"debattement roll"," deg",-45,45,1,0);
-    deb_pitch=new DoubleSpinBox(reglages_groupbox->LastRowLastCol(),"debattement pitch"," deg",-45,45,1,0);
-    deb_wz=new DoubleSpinBox(reglages_groupbox->NewRow(),"debattement wz"," deg/s",-180,180,1,0);
-    deb_dz=new DoubleSpinBox(reglages_groupbox->LastRowLastCol(),"debattement dz"," m/s",-2,2,0.1,1);
-    trim=new DoubleSpinBox(reglages_groupbox->NewRow(),"trim",-1,1,0.01);
-    label_roll=new Label(reglages_groupbox->NewRow(),"trim roll");
-    button_roll=new PushButton(reglages_groupbox->LastRowLastCol(),"reset roll trim");
-    label_pitch=new Label(reglages_groupbox->NewRow(),"trim pitch");
-    button_pitch=new PushButton(reglages_groupbox->LastRowLastCol(),"reset pitch trim");
-
-    z_ref=0;
-    previous_time=0;
-    trim_roll=0;
-    trim_pitch=0;
-
-    label_roll->SetText("trim roll: %.2f",trim_roll);
-    label_pitch->SetText("trim pitch: %.2f",trim_pitch);
-}
-
-JoyReference_impl::~JoyReference_impl(void) {
-}
+JoyReference_impl::JoyReference_impl(JoyReference *inSelf,
+                                     const LayoutPosition *position,
+                                     string name)
+    : self(inSelf) {
+
+  ahrsData = new AhrsData(self);
+  input = new cvmatrix(self, 4, 1, floatType, name);
+
+  cvmatrix_descriptor *desc = new cvmatrix_descriptor(4, 1);
+  desc->SetElementName(0, 0, "z");
+  ;
+  desc->SetElementName(1, 0, "dz");
+  desc->SetElementName(2, 0, "trim_roll");
+  desc->SetElementName(3, 0, "trim_pitch");
+  output = new cvmatrix(self, desc, floatType, name);
+
+  reglages_groupbox = new GroupBox(position, name);
+  deb_roll = new DoubleSpinBox(reglages_groupbox->NewRow(), "debattement roll",
+                               " deg", -45, 45, 1, 0);
+  deb_pitch = new DoubleSpinBox(reglages_groupbox->LastRowLastCol(),
+                                "debattement pitch", " deg", -45, 45, 1, 0);
+  deb_wz = new DoubleSpinBox(reglages_groupbox->NewRow(), "debattement wz",
+                             " deg/s", -180, 180, 1, 0);
+  deb_dz = new DoubleSpinBox(reglages_groupbox->LastRowLastCol(),
+                             "debattement dz", " m/s", -2, 2, 0.1, 1);
+  trim = new DoubleSpinBox(reglages_groupbox->NewRow(), "trim", -1, 1, 0.01);
+  label_roll = new Label(reglages_groupbox->NewRow(), "trim roll");
+  button_roll =
+      new PushButton(reglages_groupbox->LastRowLastCol(), "reset roll trim");
+  label_pitch = new Label(reglages_groupbox->NewRow(), "trim pitch");
+  button_pitch =
+      new PushButton(reglages_groupbox->LastRowLastCol(), "reset pitch trim");
+
+  z_ref = 0;
+  previous_time = 0;
+  trim_roll = 0;
+  trim_pitch = 0;
+
+  label_roll->SetText("trim roll: %.2f", trim_roll);
+  label_pitch->SetText("trim pitch: %.2f", trim_pitch);
+}
+
+JoyReference_impl::~JoyReference_impl(void) {}
 
 void JoyReference_impl::SetRollAxis(float value) {
-    input->SetValue(0,0,value);
+  input->SetValue(0, 0, value);
 }
 
 void JoyReference_impl::SetPitchAxis(float value) {
-    input->SetValue(1,0,value);
+  input->SetValue(1, 0, value);
 }
 
 void JoyReference_impl::SetYawAxis(float value) {
-    input->SetValue(2,0,value);
+  input->SetValue(2, 0, value);
 }
 
 void JoyReference_impl::SetAltitudeAxis(float value) {
-    input->SetValue(3,0,value);
+  input->SetValue(3, 0, value);
 }
 
 void JoyReference_impl::RollTrimUp(void) {
-    trim_roll+=trim->Value();
-    output->SetValue(2,0,trim_roll);
-    label_roll->SetText("trim roll: %.2f",trim_roll);
+  trim_roll += trim->Value();
+  output->SetValue(2, 0, trim_roll);
+  label_roll->SetText("trim roll: %.2f", trim_roll);
 }
 
 void JoyReference_impl::RollTrimDown(void) {
-    trim_roll-=trim->Value();
-    output->SetValue(2,0,trim_roll);
-    label_roll->SetText("trim roll: %.2f",trim_roll);
+  trim_roll -= trim->Value();
+  output->SetValue(2, 0, trim_roll);
+  label_roll->SetText("trim roll: %.2f", trim_roll);
 }
 
 void JoyReference_impl::PitchTrimUp(void) {
-    trim_pitch+=trim->Value();
-    output->SetValue(3,0,trim_pitch);
-    label_pitch->SetText("trim pitch: %.2f",trim_pitch);
+  trim_pitch += trim->Value();
+  output->SetValue(3, 0, trim_pitch);
+  label_pitch->SetText("trim pitch: %.2f", trim_pitch);
 }
 
 void JoyReference_impl::PitchTrimDown(void) {
-    trim_pitch-=trim->Value();
-    output->SetValue(3,0,trim_pitch);
-    label_pitch->SetText("trim pitch: %.2f",trim_pitch);
+  trim_pitch -= trim->Value();
+  output->SetValue(3, 0, trim_pitch);
+  label_pitch->SetText("trim pitch: %.2f", trim_pitch);
 }
 
 void JoyReference_impl::SetYawRef(float value) {
-    Euler ref(0,0,value);
-    input->GetMutex();
-    ref.ToQuaternion(q_z);
-    input->ReleaseMutex();
-
-    Update(GetTime());
+  Euler ref(0, 0, value);
+  input->GetMutex();
+  ref.ToQuaternion(q_z);
+  input->ReleaseMutex();
+
+  Update(GetTime());
 }
 
 void JoyReference_impl::SetZRef(float value) {
-    z_ref=value;
-    output->SetValue(0,0,z_ref);
-}
-
-float JoyReference_impl::ZRef(void) const {
-    return output->Value(0,0);
-}
-
-float JoyReference_impl::dZRef(void) const {
-   return output->Value(1,0);
-}
-
-float JoyReference_impl::RollTrim(void) const {
-    return trim_roll;
-}
-
-float JoyReference_impl::PitchTrim(void) const {
-    return trim_pitch;
-}
+  z_ref = value;
+  output->SetValue(0, 0, z_ref);
+}
+
+float JoyReference_impl::ZRef(void) const { return output->Value(0, 0); }
+
+float JoyReference_impl::dZRef(void) const { return output->Value(1, 0); }
+
+float JoyReference_impl::RollTrim(void) const { return trim_roll; }
+
+float JoyReference_impl::PitchTrim(void) const { return trim_pitch; }
 
 void JoyReference_impl::Update(Time time) {
-    input->SetDataTime(time);
-    UpdateFrom(input);
+  input->SetDataTime(time);
+  UpdateFrom(input);
 }
 
 void JoyReference_impl::UpdateFrom(const io_data *data) {
-    cvmatrix *input=(cvmatrix*)data;
-
-    if(previous_time==0) previous_time=data->DataTime();//pour la premiere iteration
-    float delta_t=(float)(data->DataTime()-previous_time)/1000000000.;
-    previous_time=data->DataTime();
-
-    if(button_roll->Clicked()==true) {
-        trim_roll=0;
-        output->SetValue(2,0,0);
-        label_roll->SetText("trim roll: %.2f",trim_roll);
-    }
-    if(button_pitch->Clicked()==true) {
-        trim_pitch=0;
-        output->SetValue(3,0,0);
-        label_pitch->SetText("trim pitch: %.2f",trim_pitch);
-    }
-
-    //les box sont en degrés
-    input->GetMutex();
-
-    Vector3D theta_xy(-Euler::ToRadian(input->ValueNoMutex(0,0)*deb_roll->Value()),
-                      -Euler::ToRadian(input->ValueNoMutex(1,0)*deb_pitch->Value()),
-                      0);
-    Vector3D e_bar=theta_xy;
-    e_bar.Normalize();
-    Quaternion q_xy(cos(theta_xy.GetNorm()/2.0f),
-                    e_bar.x*sin(theta_xy.GetNorm()/2.0f),
-                    e_bar.y*sin(theta_xy.GetNorm()/2.0f),
-                    0);
-    q_xy.Normalize();
-
-    float wz_ref=Euler::ToRadian(input->ValueNoMutex(2,0)*deb_wz->Value());
-	Quaternion w_zd(1,0,0,wz_ref*delta_t/2);
-	w_zd.Normalize();
-	q_z = q_z*w_zd;
-	q_z.Normalize();
-
-	Quaternion q_ref = q_z*q_xy;
-	q_ref.Normalize();
-
-    z_ref+=input->ValueNoMutex(3,0)*deb_dz->Value()*delta_t;
-    float dz_ref=input->ValueNoMutex(3,0)*deb_dz->Value();
-
-    input->ReleaseMutex();
-
-    ahrsData->SetQuaternionAndAngularRates(q_ref,Vector3D(0,0,wz_ref));
-
-    //ouput quaternion for control law
-    output->GetMutex();
-    output->SetValueNoMutex(0,0,z_ref);
-    output->SetValueNoMutex(1,0,dz_ref);
-    output->ReleaseMutex();
-
-    output->SetDataTime(data->DataTime());
-}
-
+  cvmatrix *input = (cvmatrix *)data;
+
+  if (previous_time == 0)
+    previous_time = data->DataTime(); // pour la premiere iteration
+  float delta_t = (float)(data->DataTime() - previous_time) / 1000000000.;
+  previous_time = data->DataTime();
+
+  if (button_roll->Clicked() == true) {
+    trim_roll = 0;
+    output->SetValue(2, 0, 0);
+    label_roll->SetText("trim roll: %.2f", trim_roll);
+  }
+  if (button_pitch->Clicked() == true) {
+    trim_pitch = 0;
+    output->SetValue(3, 0, 0);
+    label_pitch->SetText("trim pitch: %.2f", trim_pitch);
+  }
+
+  // les box sont en degrés
+  input->GetMutex();
+
+  Vector3D theta_xy(
+      -Euler::ToRadian(input->ValueNoMutex(0, 0) * deb_roll->Value()),
+      -Euler::ToRadian(input->ValueNoMutex(1, 0) * deb_pitch->Value()), 0);
+  Vector3D e_bar = theta_xy;
+  e_bar.Normalize();
+  Quaternion q_xy(cos(theta_xy.GetNorm() / 2.0f),
+                  e_bar.x * sin(theta_xy.GetNorm() / 2.0f),
+                  e_bar.y * sin(theta_xy.GetNorm() / 2.0f), 0);
+  q_xy.Normalize();
+
+  float wz_ref = Euler::ToRadian(input->ValueNoMutex(2, 0) * deb_wz->Value());
+  Quaternion w_zd(1, 0, 0, wz_ref * delta_t / 2);
+  w_zd.Normalize();
+  q_z = q_z * w_zd;
+  q_z.Normalize();
+
+  Quaternion q_ref = q_z * q_xy;
+  q_ref.Normalize();
+
+  z_ref += input->ValueNoMutex(3, 0) * deb_dz->Value() * delta_t;
+  float dz_ref = input->ValueNoMutex(3, 0) * deb_dz->Value();
+
+  input->ReleaseMutex();
+
+  ahrsData->SetQuaternionAndAngularRates(q_ref, Vector3D(0, 0, wz_ref));
+
+  // ouput quaternion for control law
+  output->GetMutex();
+  output->SetValueNoMutex(0, 0, z_ref);
+  output->SetValueNoMutex(1, 0, dz_ref);
+  output->ReleaseMutex();
+
+  output->SetDataTime(data->DataTime());
+}
Index: trunk/lib/FlairFilter/src/LowPassFilter.cpp
===================================================================
--- trunk/lib/FlairFilter/src/LowPassFilter.cpp	(revision 14)
+++ trunk/lib/FlairFilter/src/LowPassFilter.cpp	(revision 15)
@@ -25,34 +25,26 @@
 using namespace flair::gui;
 
-namespace flair
-{
-namespace filter
-{
+namespace flair {
+namespace filter {
 
-LowPassFilter::LowPassFilter(const IODevice* parent,const LayoutPosition* position,string name,const cvmatrix* init_value) : IODevice(parent,name)
-{
-    pimpl_=new LowPassFilter_impl(this,position,name,init_value);
-    AddDataToLog(pimpl_->output);
+LowPassFilter::LowPassFilter(const IODevice *parent,
+                             const LayoutPosition *position, string name,
+                             const cvmatrix *init_value)
+    : IODevice(parent, name) {
+  pimpl_ = new LowPassFilter_impl(this, position, name, init_value);
+  AddDataToLog(pimpl_->output);
 }
 
-LowPassFilter::~LowPassFilter()
-{
-    delete pimpl_;
+LowPassFilter::~LowPassFilter() { delete pimpl_; }
+
+cvmatrix *LowPassFilter::Matrix(void) const { return pimpl_->output; }
+
+float LowPassFilter::Output(int row, int col) const {
+  return pimpl_->output->Value(row, col);
 }
 
-cvmatrix *LowPassFilter::Matrix(void) const
-{
-    return pimpl_->output;
-}
-
-float LowPassFilter::Output(int row,int col) const
-{
-   return pimpl_->output->Value(row,col);
-}
-
-void LowPassFilter::UpdateFrom(const io_data *data)
-{
-    pimpl_->UpdateFrom(data);
-    ProcessUpdate(pimpl_->output);
+void LowPassFilter::UpdateFrom(const io_data *data) {
+  pimpl_->UpdateFrom(data);
+  ProcessUpdate(pimpl_->output);
 }
 
Index: trunk/lib/FlairFilter/src/LowPassFilter.h
===================================================================
--- trunk/lib/FlairFilter/src/LowPassFilter.h	(revision 14)
+++ trunk/lib/FlairFilter/src/LowPassFilter.h	(revision 15)
@@ -16,84 +16,81 @@
 #include <IODevice.h>
 
-namespace flair
-{
-    namespace core
-    {
-        class cvmatrix;
-    }
-    namespace gui
-    {
-        class Layout;
-        class LayoutPosition;
-    }
+namespace flair {
+namespace core {
+class cvmatrix;
+}
+namespace gui {
+class Layout;
+class LayoutPosition;
+}
 }
 
 class LowPassFilter_impl;
 
-namespace flair
-{
-namespace filter
-{
-    /*! \class LowPassFilter
-    *
-    * \brief Class defining a first order low pass filter
-    */
-    class LowPassFilter : public core::IODevice
-    {
-        public:
-            /*!
-            * \brief Constructor
-            *
-            * Construct a LowPassFilter at position. \n
-            * After calling this function, position will be deleted as it is no longer usefull. \n
-            * The filter is automatically updated when parent's
-            * IODevice::ProcessUpdate is called. \n
-            * The optional init_value parameters allow to specify
-            * the size of the input datas and its inital values.
-            * If unspecified, a 1*1 size is used, and values are
-            * initialized with 0.
-            *
-            * \param parent parent
-            * \param position position to display settings
-            * \param name name
-            * \param init_value initial value
-            */
-            LowPassFilter(const core::IODevice* parent,const gui::LayoutPosition* position,std::string name,const core::cvmatrix* init_value=NULL);
+namespace flair {
+namespace filter {
+/*! \class LowPassFilter
+*
+* \brief Class defining a first order low pass filter
+*/
+class LowPassFilter : public core::IODevice {
+public:
+  /*!
+  * \brief Constructor
+  *
+  * Construct a LowPassFilter at position. \n
+  * After calling this function, position will be deleted as it is no longer
+  *usefull. \n
+  * The filter is automatically updated when parent's
+  * IODevice::ProcessUpdate is called. \n
+  * The optional init_value parameters allow to specify
+  * the size of the input datas and its inital values.
+  * If unspecified, a 1*1 size is used, and values are
+  * initialized with 0.
+  *
+  * \param parent parent
+  * \param position position to display settings
+  * \param name name
+  * \param init_value initial value
+  */
+  LowPassFilter(const core::IODevice *parent,
+                const gui::LayoutPosition *position, std::string name,
+                const core::cvmatrix *init_value = NULL);
 
-            /*!
-            * \brief Destructor
-            *
-            */
-            ~LowPassFilter();
+  /*!
+  * \brief Destructor
+  *
+  */
+  ~LowPassFilter();
 
-            /*!
-            * \brief Output value
-            *
-            * \param row row element
-            * \param col column element
-            *
-            * \return element value
-            */
-            float Output(int row, int col) const;
+  /*!
+  * \brief Output value
+  *
+  * \param row row element
+  * \param col column element
+  *
+  * \return element value
+  */
+  float Output(int row, int col) const;
 
-            /*!
-            * \brief Output matrix
-            *
-            * \return filtered output
-            */
-            core::cvmatrix* Matrix(void) const;
+  /*!
+  * \brief Output matrix
+  *
+  * \return filtered output
+  */
+  core::cvmatrix *Matrix(void) const;
 
-        private:
-            /*!
-            * \brief Update using provided datas
-            *
-            * Reimplemented from IODevice.
-            *
-            * \param data data from the parent to process
-            */
-            void UpdateFrom(const core::io_data *data);
+private:
+  /*!
+  * \brief Update using provided datas
+  *
+  * Reimplemented from IODevice.
+  *
+  * \param data data from the parent to process
+  */
+  void UpdateFrom(const core::io_data *data);
 
-            class LowPassFilter_impl* pimpl_;
-    };
+  class LowPassFilter_impl *pimpl_;
+};
 } // end namespace filter
 } // end namespace flair
Index: trunk/lib/FlairFilter/src/LowPassFilter_impl.cpp
===================================================================
--- trunk/lib/FlairFilter/src/LowPassFilter_impl.cpp	(revision 14)
+++ trunk/lib/FlairFilter/src/LowPassFilter_impl.cpp	(revision 15)
@@ -31,101 +31,87 @@
 using namespace flair::filter;
 
-LowPassFilter_impl::LowPassFilter_impl(const LowPassFilter* self,const LayoutPosition* position,string name,const cvmatrix* init_value)
-{
-    first_update=true;
+LowPassFilter_impl::LowPassFilter_impl(const LowPassFilter *self,
+                                       const LayoutPosition *position,
+                                       string name,
+                                       const cvmatrix *init_value) {
+  first_update = true;
 
-    if(init_value!=NULL)
-    {
-        prev_value=(cvmatrix*)init_value;
+  if (init_value != NULL) {
+    prev_value = (cvmatrix *)init_value;
+  } else {
+    // if NULL, assume dimension 1, and init=0
+    cvmatrix_descriptor *desc = new cvmatrix_descriptor(1, 1);
+    desc->SetElementName(0, 0, "output");
+    prev_value = new cvmatrix(self, desc, floatType, name);
+    prev_value->SetValue(0, 0, 0);
+  }
+
+  // init UI
+  GroupBox *reglages_groupbox = new GroupBox(position, name);
+  T = new DoubleSpinBox(reglages_groupbox->NewRow(), "period, 0 for auto", " s",
+                        0, 10, 0.01);
+  freq = new DoubleSpinBox(reglages_groupbox->NewRow(), "cutoff frequency",
+                           " Hz", 0, 10000, 0.1, 2, 1);
+
+  // init output matrix of same size as init
+  cvmatrix_descriptor *desc =
+      new cvmatrix_descriptor(prev_value->Rows(), prev_value->Cols());
+
+  for (int i = 0; i < prev_value->Rows(); i++) {
+    for (int j = 0; j < prev_value->Cols(); j++) {
+      desc->SetElementName(i, j, prev_value->Name(i, j));
     }
-    else
-    {
-        //if NULL, assume dimension 1, and init=0
-        cvmatrix_descriptor* desc=new cvmatrix_descriptor(1,1);
-        desc->SetElementName(0,0,"output");
-        prev_value=new cvmatrix(self,desc,floatType,name);
-        prev_value->SetValue(0,0,0);
-    }
+  }
 
-    //init UI
-    GroupBox* reglages_groupbox=new GroupBox(position,name);
-        T=new DoubleSpinBox(reglages_groupbox->NewRow(),"period, 0 for auto"," s",0,10,0.01);
-        freq=new DoubleSpinBox(reglages_groupbox->NewRow(),"cutoff frequency"," Hz",0,10000,0.1,2,1);
+  output = new cvmatrix(self, desc,
+                        prev_value->GetDataType().GetElementDataType(), name);
 
-
-    //init output matrix of same size as init
-    cvmatrix_descriptor* desc=new cvmatrix_descriptor(prev_value->Rows(),prev_value->Cols());
-
-    for(int i=0;i<prev_value->Rows();i++)
-    {
-        for(int j=0;j<prev_value->Cols();j++)
-        {
-            desc->SetElementName(i,j,prev_value->Name(i,j));
-        }
-    }
-
-    output=new cvmatrix(self,desc,prev_value->GetDataType().GetElementDataType(),name);
-
-    output->SetValue(0,0,0);
+  output->SetValue(0, 0, 0);
 }
 
-LowPassFilter_impl::~LowPassFilter_impl()
-{
+LowPassFilter_impl::~LowPassFilter_impl() {}
+
+void LowPassFilter_impl::UpdateFrom(const io_data *data) {
+  float delta_t;
+  float result;
+  cvmatrix *input = (cvmatrix *)data;
+
+  // on prend une fois pour toute les mutex et on fait des accès directs
+  output->GetMutex();
+  input->GetMutex();
+
+  if (first_update == true) {
+    for (int i = 0; i < input->Rows(); i++) {
+      for (int j = 0; j < input->Cols(); j++) {
+        output->SetValueNoMutex(i, j, prev_value->ValueNoMutex(i, j));
+        prev_value->SetValueNoMutex(i, j, input->ValueNoMutex(i, j));
+      }
+    }
+    first_update = false;
+  } else {
+    if (T->Value() == 0) {
+      delta_t = (float)(data->DataTime() - previous_time) / 1000000000.;
+    } else {
+      delta_t = T->Value();
+    }
+    for (int i = 0; i < input->Rows(); i++) {
+      for (int j = 0; j < input->Cols(); j++) {
+
+        if (freq->Value() != 0) {
+          output->SetValueNoMutex(i, j, (1 - 2 * PI * freq->Value() * delta_t) *
+                                                prev_value->ValueNoMutex(i, j) +
+                                            2 * PI * freq->Value() * delta_t *
+                                                input->ValueNoMutex(i, j));
+        } else {
+          output->SetValueNoMutex(i, j, input->ValueNoMutex(i, j));
+        }
+        prev_value->SetValueNoMutex(i, j, output->ValueNoMutex(i, j));
+      }
+    }
+  }
+  input->ReleaseMutex();
+  output->ReleaseMutex();
+
+  output->SetDataTime(data->DataTime());
+  previous_time = data->DataTime();
 }
-
-void LowPassFilter_impl::UpdateFrom(const io_data *data)
-{
-    float delta_t;
-    float result;
-    cvmatrix *input=(cvmatrix*)data;
-
-    //on prend une fois pour toute les mutex et on fait des accès directs
-    output->GetMutex();
-    input->GetMutex();
-
-    if(first_update==true)
-    {
-        for(int i=0;i<input->Rows();i++)
-        {
-            for(int j=0;j<input->Cols();j++)
-            {
-                output->SetValueNoMutex(i,j,prev_value->ValueNoMutex(i,j));
-                prev_value->SetValueNoMutex(i,j,input->ValueNoMutex(i,j));
-            }
-        }
-        first_update=false;
-    }
-    else
-    {
-        if(T->Value()==0)
-        {
-            delta_t=(float)(data->DataTime()-previous_time)/1000000000.;
-        }
-        else
-        {
-            delta_t=T->Value();
-        }
-        for(int i=0;i<input->Rows();i++)
-        {
-            for(int j=0;j<input->Cols();j++)
-            {
-
-                if(freq->Value()!=0)
-                {
-                    output->SetValueNoMutex(i,j,(1-2*PI*freq->Value()*delta_t)*prev_value->ValueNoMutex(i,j)+2*PI*freq->Value()*delta_t*input->ValueNoMutex(i,j));
-                }
-                else
-                {
-                    output->SetValueNoMutex(i,j,input->ValueNoMutex(i,j));
-                }
-                prev_value->SetValueNoMutex(i,j,output->ValueNoMutex(i,j));
-            }
-        }
-    }
-    input->ReleaseMutex();
-    output->ReleaseMutex();
-
-    output->SetDataTime(data->DataTime());
-    previous_time=data->DataTime();
-}
-
Index: trunk/lib/FlairFilter/src/NestedSat.cpp
===================================================================
--- trunk/lib/FlairFilter/src/NestedSat.cpp	(revision 14)
+++ trunk/lib/FlairFilter/src/NestedSat.cpp	(revision 15)
@@ -27,36 +27,26 @@
 using namespace flair::gui;
 
-namespace flair
-{
-namespace filter
-{
+namespace flair {
+namespace filter {
 
-NestedSat::NestedSat(const LayoutPosition* position,string name) : ControlLaw(position->getLayout(),name)
-{
-    pimpl_=new NestedSat_impl(this,position,name);
+NestedSat::NestedSat(const LayoutPosition *position, string name)
+    : ControlLaw(position->getLayout(), name) {
+  pimpl_ = new NestedSat_impl(this, position, name);
 }
 
-NestedSat::~NestedSat(void)
-{
-    delete pimpl_;
+NestedSat::~NestedSat(void) { delete pimpl_; }
+
+void NestedSat::UpdateFrom(const io_data *data) {
+  pimpl_->UpdateFrom(data);
+  ProcessUpdate(output);
 }
 
-void NestedSat::UpdateFrom(const io_data *data)
-{
-    pimpl_->UpdateFrom(data);
-    ProcessUpdate(output);
+void NestedSat::SetValues(float p_ref, float p, float d) {
+  input->SetValue(0, 0, p_ref);
+  input->SetValue(1, 0, p);
+  input->SetValue(2, 0, d);
 }
-
-void NestedSat::SetValues(float p_ref,float p,float d)
-{
-    input->SetValue(0,0,p_ref);
-    input->SetValue(1,0,p);
-    input->SetValue(2,0,d);
-}
-//TODO: add a combobox to choose between rad and deg
-void NestedSat::ConvertSatFromDegToRad(void)
-{
-    pimpl_->k=Euler::ToRadian(1);
-}
+// TODO: add a combobox to choose between rad and deg
+void NestedSat::ConvertSatFromDegToRad(void) { pimpl_->k = Euler::ToRadian(1); }
 
 } // end namespace filter
Index: trunk/lib/FlairFilter/src/NestedSat.h
===================================================================
--- trunk/lib/FlairFilter/src/NestedSat.h	(revision 14)
+++ trunk/lib/FlairFilter/src/NestedSat.h	(revision 15)
@@ -16,86 +16,83 @@
 #include <ControlLaw.h>
 
-namespace flair
-{
-    namespace gui
-    {
-        class Layout;
-        class LayoutPosition;
-    }
+namespace flair {
+namespace gui {
+class Layout;
+class LayoutPosition;
+}
 }
 
 class NestedSat_impl;
 
-namespace flair
-{
-namespace filter
-{
-    /*! \class NestedSat
-    *
-    * \brief  Class defining a PID with saturations
-    *
-    * The output of this control law is calculated
-    * as follows: \n
-    * p_ref=Sat(p_ref,k*sat_ref) \n
-    * d_ref=Sat[(p_ref-p)*kp,k*sat_dref] \n
-    * law=Sat[(d-d_ref)*kd,sat_u] \n
-    * where p, p_ref and d are input values (see SetValues()), \n
-    * where sat_ref, sat_dref and sat_u are settings availables on the ground station, \n
-    * where k is a conversion factor (see ConvertSatFromDegToRad()).
-    */
-    class NestedSat : public ControlLaw
-    {
-        friend class ::NestedSat_impl;
+namespace flair {
+namespace filter {
+/*! \class NestedSat
+*
+* \brief  Class defining a PID with saturations
+*
+* The output of this control law is calculated
+* as follows: \n
+* p_ref=Sat(p_ref,k*sat_ref) \n
+* d_ref=Sat[(p_ref-p)*kp,k*sat_dref] \n
+* law=Sat[(d-d_ref)*kd,sat_u] \n
+* where p, p_ref and d are input values (see SetValues()), \n
+* where sat_ref, sat_dref and sat_u are settings availables on the ground
+*station, \n
+* where k is a conversion factor (see ConvertSatFromDegToRad()).
+*/
+class NestedSat : public ControlLaw {
+  friend class ::NestedSat_impl;
 
-        public:
-            /*!
-            * \brief Constructor
-            *
-            * Construct a NestedSat at given place position. \n
-            * The NestedSat will automatically be child of position->getLayout() Layout. After calling this function,
-            * position will be deleted as it is no longer usefull. \n
-            *
-            * \param position position to display settings
-            * \param name name
-            */
-            NestedSat(const gui::LayoutPosition* position,std::string name);
+public:
+  /*!
+  * \brief Constructor
+  *
+  * Construct a NestedSat at given place position. \n
+  * The NestedSat will automatically be child of position->getLayout() Layout.
+  *After calling this function,
+  * position will be deleted as it is no longer usefull. \n
+  *
+  * \param position position to display settings
+  * \param name name
+  */
+  NestedSat(const gui::LayoutPosition *position, std::string name);
 
-            /*!
-            * \brief Destructor
-            *
-            */
-            ~NestedSat();
+  /*!
+  * \brief Destructor
+  *
+  */
+  ~NestedSat();
 
-            /*!
-            * \brief Set input values
-            *
-            * \param p_ref proportional reference
-            * \param p proportional value
-            * \param d derivative value
-            */
-            void SetValues(float p_ref,float p,float d);
+  /*!
+  * \brief Set input values
+  *
+  * \param p_ref proportional reference
+  * \param p proportional value
+  * \param d derivative value
+  */
+  void SetValues(float p_ref, float p, float d);
 
-            /*!
-            * \brief Convert saturation parameters in radians
-            *
-            * If this function is called, saturation parameters
-            * on the ground station will be interpreted as degrees. \n
-            * Thus, an internal conversion from degrees to radians will
-            * be done (k=PI/180).
-            */
-            void ConvertSatFromDegToRad(void);
+  /*!
+  * \brief Convert saturation parameters in radians
+  *
+  * If this function is called, saturation parameters
+  * on the ground station will be interpreted as degrees. \n
+  * Thus, an internal conversion from degrees to radians will
+  * be done (k=PI/180).
+  */
+  void ConvertSatFromDegToRad(void);
 
-        private:
-            /*!
-            * \brief Update using provided datas
-            *
-            * Reimplemented from IODevice.
-            *
-            * \param data data from the parent to process
-            */
-            void UpdateFrom(const core::io_data *data);
+private:
+  /*!
+  * \brief Update using provided datas
+  *
+  * Reimplemented from IODevice.
+  *
+  * \param data data from the parent to process
+  */
+  void UpdateFrom(const core::io_data *data);
 
-            NestedSat_impl* pimpl_;
-    };
+  NestedSat_impl *pimpl_;
+};
 } // end namespace filter
 } // end namespace flair
Index: trunk/lib/FlairFilter/src/NestedSat_impl.cpp
===================================================================
--- trunk/lib/FlairFilter/src/NestedSat_impl.cpp	(revision 14)
+++ trunk/lib/FlairFilter/src/NestedSat_impl.cpp	(revision 15)
@@ -28,47 +28,47 @@
 using namespace flair::filter;
 
-NestedSat_impl::NestedSat_impl(NestedSat* self,const LayoutPosition* position,string name)
-{
-    this->self=self;
-	k=1;
+NestedSat_impl::NestedSat_impl(NestedSat *self, const LayoutPosition *position,
+                               string name) {
+  this->self = self;
+  k = 1;
 
-    //init matrix
-    self->input=new cvmatrix(self,3,1,floatType,name);
+  // init matrix
+  self->input = new cvmatrix(self, 3, 1, floatType, name);
 
-    GroupBox* reglages_groupbox=new GroupBox(position,name);
-            sat=new DoubleSpinBox(reglages_groupbox->NewRow(),"sat ref:",0,9000000,1);
-            kp=new DoubleSpinBox(reglages_groupbox->NewRow(),"kp:",0,9000000,1);
-            dsat=new DoubleSpinBox(reglages_groupbox->NewRow(),"sat dref:",0,9000000,1);
-            kd=new DoubleSpinBox(reglages_groupbox->NewRow(),"kd:",0,9000000,0.1);
-            usat=new DoubleSpinBox(reglages_groupbox->NewRow(),"sat u:",0,1,.1);
+  GroupBox *reglages_groupbox = new GroupBox(position, name);
+  sat =
+      new DoubleSpinBox(reglages_groupbox->NewRow(), "sat ref:", 0, 9000000, 1);
+  kp = new DoubleSpinBox(reglages_groupbox->NewRow(), "kp:", 0, 9000000, 1);
+  dsat = new DoubleSpinBox(reglages_groupbox->NewRow(), "sat dref:", 0, 9000000,
+                           1);
+  kd = new DoubleSpinBox(reglages_groupbox->NewRow(), "kd:", 0, 9000000, 0.1);
+  usat = new DoubleSpinBox(reglages_groupbox->NewRow(), "sat u:", 0, 1, .1);
 }
 
-NestedSat_impl::~NestedSat_impl(void)
-{
+NestedSat_impl::~NestedSat_impl(void) {}
+
+void NestedSat_impl::UpdateFrom(const io_data *data) {
+  float cons, dcons, law;
+  cvmatrix *input = (cvmatrix *)data;
+
+  input->GetMutex();
+
+  cons = Sat(input->ValueNoMutex(0, 0), k * sat->Value());
+  dcons = (cons - input->ValueNoMutex(1, 0)) * kp->Value();
+  dcons = Sat(dcons, k * dsat->Value());
+  law = (input->ValueNoMutex(2, 0) - dcons) * kd->Value();
+  law = Sat(law, usat->Value());
+
+  input->ReleaseMutex();
+
+  self->output->SetValue(0, 0, law);
+  self->output->SetDataTime(data->DataTime());
 }
 
-void NestedSat_impl::UpdateFrom(const io_data *data)
-{
-    float cons,dcons,law;
-    cvmatrix *input=(cvmatrix*)data;
-
-    input->GetMutex();
-
-    cons=Sat(input->ValueNoMutex(0,0),k*sat->Value());
-    dcons=(cons-input->ValueNoMutex(1,0))*kp->Value();
-    dcons=Sat(dcons,k*dsat->Value());
-    law=(input->ValueNoMutex(2,0)-dcons)*kd->Value();
-    law=Sat(law,usat->Value());
-
-    input->ReleaseMutex();
-
-    self->output->SetValue(0,0,law);
-    self->output->SetDataTime(data->DataTime());
+float NestedSat_impl::Sat(float value, float borne) {
+  if (value < -borne)
+    return -borne;
+  if (value > borne)
+    return borne;
+  return value;
 }
-
-float NestedSat_impl::Sat(float value,float borne)
-{
-    if(value<-borne) return -borne;
-    if(value>borne) return borne;
-    return value;
-}
Index: trunk/lib/FlairFilter/src/Pid.cpp
===================================================================
--- trunk/lib/FlairFilter/src/Pid.cpp	(revision 14)
+++ trunk/lib/FlairFilter/src/Pid.cpp	(revision 15)
@@ -26,33 +26,32 @@
 using namespace flair::gui;
 
-namespace flair { namespace filter {
+namespace flair {
+namespace filter {
 
-Pid::Pid(const LayoutPosition* position,string name) : ControlLaw(position->getLayout(),name) {
-    pimpl_=new Pid_impl(this,position,name);
+Pid::Pid(const LayoutPosition *position, string name)
+    : ControlLaw(position->getLayout(), name) {
+  pimpl_ = new Pid_impl(this, position, name);
 }
 
-Pid::~Pid(void) {
-    delete pimpl_;
-}
+Pid::~Pid(void) { delete pimpl_; }
 
-void Pid::UseDefaultPlot(const gui::LayoutPosition* position) {
-    pimpl_->UseDefaultPlot(position);
+void Pid::UseDefaultPlot(const gui::LayoutPosition *position) {
+  pimpl_->UseDefaultPlot(position);
 }
 
 void Pid::Reset(void) {
-    pimpl_->i=0;
-    pimpl_->first_update=true;
+  pimpl_->i = 0;
+  pimpl_->first_update = true;
 }
 
 void Pid::UpdateFrom(const io_data *data) {
-    pimpl_->UpdateFrom(data);
-    ProcessUpdate(output);
+  pimpl_->UpdateFrom(data);
+  ProcessUpdate(output);
 }
 
-void Pid::SetValues(float p,float d) {
-    input->SetValue(0,0,p);
-    input->SetValue(1,0,d);
+void Pid::SetValues(float p, float d) {
+  input->SetValue(0, 0, p);
+  input->SetValue(1, 0, d);
 }
-
 
 } // end namespace filter
Index: trunk/lib/FlairFilter/src/Pid.h
===================================================================
--- trunk/lib/FlairFilter/src/Pid.h	(revision 14)
+++ trunk/lib/FlairFilter/src/Pid.h	(revision 15)
@@ -16,84 +16,81 @@
 #include <ControlLaw.h>
 
-namespace flair
-{
-    namespace gui
-    {
-        class LayoutPosition;
-    }
+namespace flair {
+namespace gui {
+class LayoutPosition;
+}
 }
 
 class Pid_impl;
 
-namespace flair
-{
-namespace filter
-{
-    /*! \class Pid
-    *
-    * \brief Class defining a PID
-    */
-    class Pid : public ControlLaw
-    {
-        friend class ::Pid_impl;
+namespace flair {
+namespace filter {
+/*! \class Pid
+*
+* \brief Class defining a PID
+*/
+class Pid : public ControlLaw {
+  friend class ::Pid_impl;
 
-        public:
-            /*!
-            * \brief Constructor
-            *
-            * Construct a PID at given position. \n
-            * The PID will automatically be child of position->getLayout() Layout. After calling this function,
-            * position will be deleted as it is no longer usefull. \n
-            *
-            * \param position position to display settings
-            * \param name name
-            */
-            Pid(const gui::LayoutPosition* position,std::string name);
+public:
+  /*!
+  * \brief Constructor
+  *
+  * Construct a PID at given position. \n
+  * The PID will automatically be child of position->getLayout() Layout. After
+  *calling this function,
+  * position will be deleted as it is no longer usefull. \n
+  *
+  * \param position position to display settings
+  * \param name name
+  */
+  Pid(const gui::LayoutPosition *position, std::string name);
 
-            /*!
-            * \brief Destructor
-            *
-            */
-            ~Pid();
+  /*!
+  * \brief Destructor
+  *
+  */
+  ~Pid();
 
-            /*!
-            * \brief Reset integral
-            *
-            */
-            void Reset(void);
+  /*!
+  * \brief Reset integral
+  *
+  */
+  void Reset(void);
 
-            /*!
-            * \brief Set input values
-            *
-            * \param p proportional value
-            * \param d derivative value
-            */
-            void SetValues(float p,float d);
+  /*!
+  * \brief Set input values
+  *
+  * \param p proportional value
+  * \param d derivative value
+  */
+  void SetValues(float p, float d);
 
-            /*!
-            * \brief Use default plot
-            *
-            * Plot the output values at position. \n
-            * Plot consists of 4 curves: proportional part,
-            * derivative part, integral part and
-            * the sum of the three. \n
-            * After calling this function, position will be deleted as it is no longer usefull. \n
-            *
-            * \param position position to display plot
-            */
-            void UseDefaultPlot(const gui::LayoutPosition* position);
+  /*!
+  * \brief Use default plot
+  *
+  * Plot the output values at position. \n
+  * Plot consists of 4 curves: proportional part,
+  * derivative part, integral part and
+  * the sum of the three. \n
+  * After calling this function, position will be deleted as it is no longer
+  *usefull. \n
+  *
+  * \param position position to display plot
+  */
+  void UseDefaultPlot(const gui::LayoutPosition *position);
 
-        private:
-            /*!
-            * \brief Update using provided datas
-            *
-            * Reimplemented from IODevice.
-            *
-            * \param data data from the parent to process
-            */
-            void UpdateFrom(const core::io_data *data);
+private:
+  /*!
+  * \brief Update using provided datas
+  *
+  * Reimplemented from IODevice.
+  *
+  * \param data data from the parent to process
+  */
+  void UpdateFrom(const core::io_data *data);
 
-            Pid_impl* pimpl_;
-    };
+  Pid_impl *pimpl_;
+};
 } // end namespace filter
 } // end namespace flair
Index: trunk/lib/FlairFilter/src/PidThrust.cpp
===================================================================
--- trunk/lib/FlairFilter/src/PidThrust.cpp	(revision 14)
+++ trunk/lib/FlairFilter/src/PidThrust.cpp	(revision 15)
@@ -27,86 +27,59 @@
 using namespace flair::gui;
 
-namespace flair
-{
-namespace filter
-{
+namespace flair {
+namespace filter {
 
-PidThrust::PidThrust(const LayoutPosition* position,string name) : ControlLaw(position->getLayout(),name)
-{
-    pimpl_=new PidThrust_impl(this,position,name);
+PidThrust::PidThrust(const LayoutPosition *position, string name)
+    : ControlLaw(position->getLayout(), name) {
+  pimpl_ = new PidThrust_impl(this, position, name);
 }
 
-PidThrust::~PidThrust(void)
-{
-    delete pimpl_;
-}
+PidThrust::~PidThrust(void) { delete pimpl_; }
 
-void PidThrust::UseDefaultPlot(const flair::gui::LayoutPosition* position)
-{
-    pimpl_->UseDefaultPlot(position);
+void PidThrust::UseDefaultPlot(const flair::gui::LayoutPosition *position) {
+  pimpl_->UseDefaultPlot(position);
 }
 
 void PidThrust::Reset(void) {
-    pimpl_->i=0;
-    pimpl_->offset_g=0;
+  pimpl_->i = 0;
+  pimpl_->offset_g = 0;
 }
 
-void PidThrust::ResetI(void)
-{
-    pimpl_->i=0;
+void PidThrust::ResetI(void) { pimpl_->i = 0; }
+
+float PidThrust::GetOffset(void) { return pimpl_->offset_g; }
+
+void PidThrust::UpdateFrom(const io_data *data) {
+  pimpl_->UpdateFrom(data);
+  ProcessUpdate(output);
 }
 
-float PidThrust::GetOffset(void) {
-    return pimpl_->offset_g;
+void PidThrust::SetValues(float p, float d) {
+  input->SetValue(0, 0, p);
+  input->SetValue(1, 0, d);
 }
 
-void PidThrust::UpdateFrom(const io_data *data)
-{
-    pimpl_->UpdateFrom(data);
-    ProcessUpdate(output);
+void PidThrust::ResetOffset(void) { pimpl_->offset_g = 0; }
+
+void PidThrust::SetOffset(void) { pimpl_->offset_g = pimpl_->offset->Value(); }
+
+bool PidThrust::OffsetStepUp(void) {
+  pimpl_->offset_g += pimpl_->pas_offset->Value();
+  if (pimpl_->offset_g > 1) {
+    pimpl_->offset_g = 1;
+    return false;
+  } else {
+    return true;
+  }
 }
 
-void PidThrust::SetValues(float p,float d)
-{
-    input->SetValue(0,0,p);
-    input->SetValue(1,0,d);
-}
-
-void PidThrust::ResetOffset(void)
-{
-    pimpl_->offset_g=0;
-}
-
-void PidThrust::SetOffset(void)
-{
-    pimpl_->offset_g=pimpl_->offset->Value();
-}
-
-bool PidThrust::OffsetStepUp(void)
-{
-    pimpl_->offset_g+=pimpl_->pas_offset->Value();
-    if(pimpl_->offset_g>1)
-    {
-        pimpl_->offset_g=1;
-        return false;
-    }
-    else
-    {
-        return true;
-    }
-}
-
-bool PidThrust::OffsetStepDown(void)
-{
-    pimpl_->offset_g-=pimpl_->pas_offset->Value();
-    if(pimpl_->offset_g<pimpl_->offset->Value())
-    {
-        pimpl_->offset_g=pimpl_->offset->Value();
-        return false;
-    }
-    else
-    {
-        return true;
-    }
+bool PidThrust::OffsetStepDown(void) {
+  pimpl_->offset_g -= pimpl_->pas_offset->Value();
+  if (pimpl_->offset_g < pimpl_->offset->Value()) {
+    pimpl_->offset_g = pimpl_->offset->Value();
+    return false;
+  } else {
+    return true;
+  }
 }
 
Index: trunk/lib/FlairFilter/src/PidThrust.h
===================================================================
--- trunk/lib/FlairFilter/src/PidThrust.h	(revision 14)
+++ trunk/lib/FlairFilter/src/PidThrust.h	(revision 15)
@@ -16,124 +16,122 @@
 #include <ControlLaw.h>
 
-namespace flair
-{
-    namespace gui
-    {
-        class LayoutPosition;
-    }
+namespace flair {
+namespace gui {
+class LayoutPosition;
+}
 }
 
 class PidThrust_impl;
 
-namespace flair
-{
-namespace filter
-{
-    /*! \class PidThrust
-    *
-    * \brief Class defining a Pid for Thrust.\n
-    * This Pid as an extra offset for compensating gravity.
-    */
-    class PidThrust : public ControlLaw
-    {
-        friend class ::PidThrust_impl;
+namespace flair {
+namespace filter {
+/*! \class PidThrust
+*
+* \brief Class defining a Pid for Thrust.\n
+* This Pid as an extra offset for compensating gravity.
+*/
+class PidThrust : public ControlLaw {
+  friend class ::PidThrust_impl;
 
-        public:
-            /*!
-            * \brief Constructor
-            *
-            * Construct a PidThrust at given position
-            * The PidThrust will automatically be child of position->getLayout() Layout. After calling this function,
-            * position will be deleted as it is no longer usefull. \n
-            *
-            * \param position position to display settings
-            * \param name name
-            */
-            PidThrust(const gui::LayoutPosition* position,std::string name);
+public:
+  /*!
+  * \brief Constructor
+  *
+  * Construct a PidThrust at given position
+  * The PidThrust will automatically be child of position->getLayout() Layout.
+  *After calling this function,
+  * position will be deleted as it is no longer usefull. \n
+  *
+  * \param position position to display settings
+  * \param name name
+  */
+  PidThrust(const gui::LayoutPosition *position, std::string name);
 
-            /*!
-            * \brief Destructor
-            *
-            */
-            ~PidThrust();
+  /*!
+  * \brief Destructor
+  *
+  */
+  ~PidThrust();
 
-            /*!
-            * \brief Reset integral and offset to 0
-            *
-            */
-            void Reset(void);
+  /*!
+  * \brief Reset integral and offset to 0
+  *
+  */
+  void Reset(void);
 
-            /*!
-            * \brief Reset integral to 0
-            *
-            */
-            void ResetI(void);
+  /*!
+  * \brief Reset integral to 0
+  *
+  */
+  void ResetI(void);
 
-            /*!
-            * \brief Reset offset to 0
-            *
-            */
-            void ResetOffset(void);
+  /*!
+  * \brief Reset offset to 0
+  *
+  */
+  void ResetOffset(void);
 
-            /*!
-            * \brief Set offset to specified value in ground station
-            *
-            */
-            void SetOffset(void);
+  /*!
+  * \brief Set offset to specified value in ground station
+  *
+  */
+  void SetOffset(void);
 
-            /*!
-            * \brief Get offset
-            *
-            * \return current offset
-            */
-            float GetOffset(void);
+  /*!
+  * \brief Get offset
+  *
+  * \return current offset
+  */
+  float GetOffset(void);
 
-            /*!
-            * \brief Step up the offset according to specified value in ground station
-            *
-            * \return false if offset is at its maximum (1) value, true otherwise
-            */
-            bool OffsetStepUp(void);
+  /*!
+  * \brief Step up the offset according to specified value in ground station
+  *
+  * \return false if offset is at its maximum (1) value, true otherwise
+  */
+  bool OffsetStepUp(void);
 
-            /*!
-            * \brief Step down the offset according to specified value in ground station
-            *
-            * \return false if offset is at its minimum (specified in ground station) value, true otherwise
-            */
-            bool OffsetStepDown(void);
+  /*!
+  * \brief Step down the offset according to specified value in ground station
+  *
+  * \return false if offset is at its minimum (specified in ground station)
+  *value, true otherwise
+  */
+  bool OffsetStepDown(void);
 
-            /*!
-            * \brief Set input values
-            *
-            * \param p proportional value
-            * \param d derivative value
-            */
-            void SetValues(float p,float d);
+  /*!
+  * \brief Set input values
+  *
+  * \param p proportional value
+  * \param d derivative value
+  */
+  void SetValues(float p, float d);
 
-            /*!
-            * \brief Use default plot
-            *
-            * Plot the output values at position. \n
-            * Plot consists of 4 curves: proportional part,
-            * derivative part, integral part and
-            * the sum of the three. \n
-            * After calling this function, position will be deleted as it is no longer usefull. \n
-            *
-            * \param position position to display plot
-            */
-            void UseDefaultPlot(const gui::LayoutPosition* position);
+  /*!
+  * \brief Use default plot
+  *
+  * Plot the output values at position. \n
+  * Plot consists of 4 curves: proportional part,
+  * derivative part, integral part and
+  * the sum of the three. \n
+  * After calling this function, position will be deleted as it is no longer
+  *usefull. \n
+  *
+  * \param position position to display plot
+  */
+  void UseDefaultPlot(const gui::LayoutPosition *position);
 
-        private:
-            /*!
-            * \brief Update using provided datas
-            *
-            * Reimplemented from IODevice.
-            *
-            * \param data data from the parent to process
-            */
-            void UpdateFrom(const core::io_data *data);
+private:
+  /*!
+  * \brief Update using provided datas
+  *
+  * Reimplemented from IODevice.
+  *
+  * \param data data from the parent to process
+  */
+  void UpdateFrom(const core::io_data *data);
 
-            PidThrust_impl* pimpl_;
-    };
+  PidThrust_impl *pimpl_;
+};
 } // end namespace filter
 } // end namespace flair
Index: trunk/lib/FlairFilter/src/PidThrust_impl.cpp
===================================================================
--- trunk/lib/FlairFilter/src/PidThrust_impl.cpp	(revision 14)
+++ trunk/lib/FlairFilter/src/PidThrust_impl.cpp	(revision 15)
@@ -28,90 +28,92 @@
 using namespace flair::filter;
 
-PidThrust_impl::PidThrust_impl(PidThrust* self,const LayoutPosition* position,string name) {
-    i=0;
-    offset_g=0;
-	first_update=true;
-	this->self=self;
+PidThrust_impl::PidThrust_impl(PidThrust *self, const LayoutPosition *position,
+                               string name) {
+  i = 0;
+  offset_g = 0;
+  first_update = true;
+  this->self = self;
 
-    //init matrix
-    self->input=new cvmatrix(self,2,1,floatType,name);
+  // init matrix
+  self->input = new cvmatrix(self, 2, 1, floatType, name);
 
-    cvmatrix_descriptor* desc=new cvmatrix_descriptor(5,1);
-    desc->SetElementName(0,0,"p");
-	desc->SetElementName(1,0,"i");
-	desc->SetElementName(2,0,"d");
-	desc->SetElementName(3,0,"p+i+d");
-	desc->SetElementName(4,0,"p+i+d+offset");
-    state=new cvmatrix(self,desc,floatType,name);
+  cvmatrix_descriptor *desc = new cvmatrix_descriptor(5, 1);
+  desc->SetElementName(0, 0, "p");
+  desc->SetElementName(1, 0, "i");
+  desc->SetElementName(2, 0, "d");
+  desc->SetElementName(3, 0, "p+i+d");
+  desc->SetElementName(4, 0, "p+i+d+offset");
+  state = new cvmatrix(self, desc, floatType, name);
 
-    GroupBox* reglages_groupbox=new GroupBox(position,name);
-            T=new DoubleSpinBox(reglages_groupbox->NewRow(),"period, 0 for auto"," s",0,1,0.01);
-            kp=new DoubleSpinBox(reglages_groupbox->NewRow(),"kp:",0,90000000,0.01);
-            ki=new DoubleSpinBox(reglages_groupbox->NewRow(),"ki:",0,90000000,0.01);
-            sati=new DoubleSpinBox(reglages_groupbox->LastRowLastCol(),"sat i:",0,1,0.01);
-            kd=new DoubleSpinBox(reglages_groupbox->NewRow(),"kd:",0,90000000,0.01);
-            offset=new DoubleSpinBox(reglages_groupbox->LastRowLastCol(),"offset g:",0,1,0.01);
-            sat=new DoubleSpinBox(reglages_groupbox->NewRow(),"sat:",0,1,0.1);
-            pas_offset=new DoubleSpinBox(reglages_groupbox->LastRowLastCol(),"offset step:",0,1,.0001,4);
+  GroupBox *reglages_groupbox = new GroupBox(position, name);
+  T = new DoubleSpinBox(reglages_groupbox->NewRow(), "period, 0 for auto", " s",
+                        0, 1, 0.01);
+  kp = new DoubleSpinBox(reglages_groupbox->NewRow(), "kp:", 0, 90000000, 0.01);
+  ki = new DoubleSpinBox(reglages_groupbox->NewRow(), "ki:", 0, 90000000, 0.01);
+  sati = new DoubleSpinBox(reglages_groupbox->LastRowLastCol(), "sat i:", 0, 1,
+                           0.01);
+  kd = new DoubleSpinBox(reglages_groupbox->NewRow(), "kd:", 0, 90000000, 0.01);
+  offset = new DoubleSpinBox(reglages_groupbox->LastRowLastCol(), "offset g:",
+                             0, 1, 0.01);
+  sat = new DoubleSpinBox(reglages_groupbox->NewRow(), "sat:", 0, 1, 0.1);
+  pas_offset = new DoubleSpinBox(reglages_groupbox->LastRowLastCol(),
+                                 "offset step:", 0, 1, .0001, 4);
 }
 
-PidThrust_impl::~PidThrust_impl(void) {
+PidThrust_impl::~PidThrust_impl(void) {}
+
+void PidThrust_impl::UseDefaultPlot(const LayoutPosition *position) {
+  DataPlot1D *plot = new DataPlot1D(position, self->ObjectName(), -1, 1);
+  plot->AddCurve(state->Element(0));
+  plot->AddCurve(state->Element(1), DataPlot::Green);
+  plot->AddCurve(state->Element(2), DataPlot::Blue);
+  plot->AddCurve(state->Element(3), DataPlot::Black);
+  plot->AddCurve(state->Element(4), DataPlot::Yellow);
 }
 
-void PidThrust_impl::UseDefaultPlot(const LayoutPosition* position)
-{
-    DataPlot1D *plot=new DataPlot1D(position,self->ObjectName(),-1,1);
-            plot->AddCurve(state->Element(0));
-            plot->AddCurve(state->Element(1),DataPlot::Green);
-            plot->AddCurve(state->Element(2),DataPlot::Blue);
-            plot->AddCurve(state->Element(3),DataPlot::Black);
-            plot->AddCurve(state->Element(4),DataPlot::Yellow);
+void PidThrust_impl::UpdateFrom(const io_data *data) {
+  float p, d, total;
+  float delta_t;
+  cvmatrix *input = (cvmatrix *)data;
+
+  if (T->Value() == 0) {
+    delta_t = (float)(data->DataTime() - previous_time) / 1000000000.;
+  } else {
+    delta_t = T->Value();
+  }
+  if (first_update == true) {
+    delta_t = 0;
+    first_update = false;
+  }
+
+  input->GetMutex();
+  p = kp->Value() * input->ValueNoMutex(0, 0);
+  i += ki->Value() * input->ValueNoMutex(0, 0) * delta_t;
+  if (i > sati->Value())
+    i = sati->Value();
+  if (i < -sati->Value())
+    i = -sati->Value();
+  d = kd->Value() * input->ValueNoMutex(1, 0);
+  input->ReleaseMutex();
+
+  total = p + i + d;
+  if (total > sat->Value())
+    total = sat->Value();
+  if (total < -sat->Value())
+    total = -sat->Value();
+
+  state->GetMutex();
+  state->SetValueNoMutex(0, 0, p);
+  state->SetValueNoMutex(1, 0, i);
+  state->SetValueNoMutex(2, 0, d);
+  state->SetValueNoMutex(3, 0, total);
+  state->SetValueNoMutex(4, 0, total - offset_g * offset_g);
+  state->ReleaseMutex();
+
+  //-offset_g, car on met -u_z dans le multiplex
+  // a revoir!
+  self->output->SetValue(0, 0, total - offset_g * offset_g);
+  self->output->SetDataTime(data->DataTime());
+
+  previous_time = data->DataTime();
 }
-
-void PidThrust_impl::UpdateFrom(const io_data *data)
-{
-    float p,d,total;
-    float delta_t;
-    cvmatrix *input=(cvmatrix*)data;
-
-    if(T->Value()==0)
-    {
-        delta_t=(float)(data->DataTime()-previous_time)/1000000000.;
-    }
-    else
-    {
-        delta_t=T->Value();
-    }
-    if(first_update==true)
-    {
-        delta_t=0;
-        first_update=false;
-    }
-
-    input->GetMutex();
-    p=kp->Value()*input->ValueNoMutex(0,0);
-    i+=ki->Value()*input->ValueNoMutex(0,0)*delta_t;
-    if(i>sati->Value()) i=sati->Value();
-    if(i<-sati->Value()) i=-sati->Value();
-    d=kd->Value()*input->ValueNoMutex(1,0);
-    input->ReleaseMutex();
-
-    total=p+i+d;
-    if(total>sat->Value()) total=sat->Value();
-    if(total<-sat->Value()) total=-sat->Value();
-
-    state->GetMutex();
-    state->SetValueNoMutex(0,0,p);
-    state->SetValueNoMutex(1,0,i);
-    state->SetValueNoMutex(2,0,d);
-    state->SetValueNoMutex(3,0,total);
-    state->SetValueNoMutex(4,0,total-offset_g*offset_g);
-    state->ReleaseMutex();
-
-    //-offset_g, car on met -u_z dans le multiplex
-    //a revoir!
-    self->output->SetValue(0,0,total-offset_g*offset_g);
-    self->output->SetDataTime(data->DataTime());
-
-    previous_time=data->DataTime();
-}
Index: trunk/lib/FlairFilter/src/Pid_impl.cpp
===================================================================
--- trunk/lib/FlairFilter/src/Pid_impl.cpp	(revision 14)
+++ trunk/lib/FlairFilter/src/Pid_impl.cpp	(revision 15)
@@ -28,76 +28,84 @@
 using namespace flair::filter;
 
-Pid_impl::Pid_impl(Pid* self,const LayoutPosition* position,string name) {
-    i=0;
-    first_update=true;
-    this->self=self;
+Pid_impl::Pid_impl(Pid *self, const LayoutPosition *position, string name) {
+  i = 0;
+  first_update = true;
+  this->self = self;
 
-    //init matrix
-    self->input=new cvmatrix(self,2,1,floatType,name);
+  // init matrix
+  self->input = new cvmatrix(self, 2, 1, floatType, name);
 
-    cvmatrix_descriptor* desc=new cvmatrix_descriptor(4,1);
-    desc->SetElementName(0,0,"p");
-    desc->SetElementName(1,0,"i");
-    desc->SetElementName(2,0,"d");
-    desc->SetElementName(3,0,"p+i+d");
-    state=new cvmatrix(self,desc,floatType,name);
+  cvmatrix_descriptor *desc = new cvmatrix_descriptor(4, 1);
+  desc->SetElementName(0, 0, "p");
+  desc->SetElementName(1, 0, "i");
+  desc->SetElementName(2, 0, "d");
+  desc->SetElementName(3, 0, "p+i+d");
+  state = new cvmatrix(self, desc, floatType, name);
 
-    GroupBox* reglages_groupbox=new GroupBox(position,name);
-    T=new DoubleSpinBox(reglages_groupbox->NewRow(),"period, 0 for auto"," s",0,1,0.01);
-    kp=new DoubleSpinBox(reglages_groupbox->NewRow(),"kp:",0,90000000,0.01,3);
-    ki=new DoubleSpinBox(reglages_groupbox->NewRow(),"ki:",0,90000000,0.01,3);
-    sati=new DoubleSpinBox(reglages_groupbox->LastRowLastCol(),"sat i:",0,1,0.01);
-    kd=new DoubleSpinBox(reglages_groupbox->NewRow(),"kd:",0,90000000,0.01,3);
-    sat=new DoubleSpinBox(reglages_groupbox->NewRow(),"sat:",0,1,0.1);
+  GroupBox *reglages_groupbox = new GroupBox(position, name);
+  T = new DoubleSpinBox(reglages_groupbox->NewRow(), "period, 0 for auto", " s",
+                        0, 1, 0.01);
+  kp = new DoubleSpinBox(reglages_groupbox->NewRow(), "kp:", 0, 90000000, 0.01,
+                         3);
+  ki = new DoubleSpinBox(reglages_groupbox->NewRow(), "ki:", 0, 90000000, 0.01,
+                         3);
+  sati = new DoubleSpinBox(reglages_groupbox->LastRowLastCol(), "sat i:", 0, 1,
+                           0.01);
+  kd = new DoubleSpinBox(reglages_groupbox->NewRow(), "kd:", 0, 90000000, 0.01,
+                         3);
+  sat = new DoubleSpinBox(reglages_groupbox->NewRow(), "sat:", 0, 1, 0.1);
 }
 
-Pid_impl::~Pid_impl(void) {
-}
+Pid_impl::~Pid_impl(void) {}
 
-void Pid_impl::UseDefaultPlot(const LayoutPosition* position) {
-    DataPlot1D *plot=new DataPlot1D(position,self->ObjectName(),-1,1);
-    plot->AddCurve(state->Element(0));
-    plot->AddCurve(state->Element(1),DataPlot::Green);
-    plot->AddCurve(state->Element(2),DataPlot::Blue);
-    plot->AddCurve(state->Element(3),DataPlot::Black);
+void Pid_impl::UseDefaultPlot(const LayoutPosition *position) {
+  DataPlot1D *plot = new DataPlot1D(position, self->ObjectName(), -1, 1);
+  plot->AddCurve(state->Element(0));
+  plot->AddCurve(state->Element(1), DataPlot::Green);
+  plot->AddCurve(state->Element(2), DataPlot::Blue);
+  plot->AddCurve(state->Element(3), DataPlot::Black);
 }
 
 void Pid_impl::UpdateFrom(const io_data *data) {
-    float p,d,total;
-    float delta_t;
-    cvmatrix *input=(cvmatrix*)data;
+  float p, d, total;
+  float delta_t;
+  cvmatrix *input = (cvmatrix *)data;
 
-    if(T->Value()==0) {
-        delta_t=(float)(data->DataTime()-previous_time)/1000000000.;
-    } else {
-        delta_t=T->Value();
-    }
-    if(first_update==true) {
-        delta_t=0;
-        first_update=false;
-    }
+  if (T->Value() == 0) {
+    delta_t = (float)(data->DataTime() - previous_time) / 1000000000.;
+  } else {
+    delta_t = T->Value();
+  }
+  if (first_update == true) {
+    delta_t = 0;
+    first_update = false;
+  }
 
-    input->GetMutex();
-    p=kp->Value()*input->ValueNoMutex(0,0);
-    i+=ki->Value()*input->ValueNoMutex(0,0)*delta_t;
-    if(i>sati->Value()) i=sati->Value();
-    if(i<-sati->Value()) i=-sati->Value();
-    d=kd->Value()*input->ValueNoMutex(1,0);
-    input->ReleaseMutex();
+  input->GetMutex();
+  p = kp->Value() * input->ValueNoMutex(0, 0);
+  i += ki->Value() * input->ValueNoMutex(0, 0) * delta_t;
+  if (i > sati->Value())
+    i = sati->Value();
+  if (i < -sati->Value())
+    i = -sati->Value();
+  d = kd->Value() * input->ValueNoMutex(1, 0);
+  input->ReleaseMutex();
 
-    total=p+i+d;
-    if(total>sat->Value()) total=sat->Value();
-    if(total<-sat->Value()) total=-sat->Value();
+  total = p + i + d;
+  if (total > sat->Value())
+    total = sat->Value();
+  if (total < -sat->Value())
+    total = -sat->Value();
 
-    state->GetMutex();
-    state->SetValueNoMutex(0,0,p);
-    state->SetValueNoMutex(1,0,i);
-    state->SetValueNoMutex(2,0,d);
-    state->SetValueNoMutex(3,0,total);
-    state->ReleaseMutex();
+  state->GetMutex();
+  state->SetValueNoMutex(0, 0, p);
+  state->SetValueNoMutex(1, 0, i);
+  state->SetValueNoMutex(2, 0, d);
+  state->SetValueNoMutex(3, 0, total);
+  state->ReleaseMutex();
 
-    self->output->SetValue(0,0,total);
-    self->output->SetDataTime(data->DataTime());
+  self->output->SetValue(0, 0, total);
+  self->output->SetDataTime(data->DataTime());
 
-    previous_time=data->DataTime();
+  previous_time = data->DataTime();
 }
Index: trunk/lib/FlairFilter/src/SimuAhrs.cpp
===================================================================
--- trunk/lib/FlairFilter/src/SimuAhrs.cpp	(revision 14)
+++ trunk/lib/FlairFilter/src/SimuAhrs.cpp	(revision 15)
@@ -25,28 +25,28 @@
 using namespace flair::sensor;
 
-namespace flair { namespace filter {
+namespace flair {
+namespace filter {
 
-SimuAhrs::SimuAhrs(const FrameworkManager* parent,string name,uint32_t dev_id,uint8_t priority) :Ahrs(new SimuImu(parent,name,dev_id,priority),name) {
-}
+SimuAhrs::SimuAhrs(const FrameworkManager *parent, string name, uint32_t dev_id,
+                   uint8_t priority)
+    : Ahrs(new SimuImu(parent, name, dev_id, priority), name) {}
 
 SimuAhrs::~SimuAhrs() {}
 
-void SimuAhrs::Start(void) {
-    ((SimuImu*)GetImu())->Start();
-}
+void SimuAhrs::Start(void) { ((SimuImu *)GetImu())->Start(); }
 
-//datas from SimuImu are AhrsData!
+// datas from SimuImu are AhrsData!
 void SimuAhrs::UpdateFrom(const io_data *data) {
-    AhrsData *input=(AhrsData*)data;
-    AhrsData *output;
-    GetDatas(&output);
+  AhrsData *input = (AhrsData *)data;
+  AhrsData *output;
+  GetDatas(&output);
 
-    Quaternion quaternion;
-    Vector3D filteredAngRates;
-    input->GetQuaternionAndAngularRates(quaternion,filteredAngRates);
-    output->SetQuaternionAndAngularRates(quaternion,filteredAngRates);
-    output->SetDataTime(input->DataTime());
+  Quaternion quaternion;
+  Vector3D filteredAngRates;
+  input->GetQuaternionAndAngularRates(quaternion, filteredAngRates);
+  output->SetQuaternionAndAngularRates(quaternion, filteredAngRates);
+  output->SetDataTime(input->DataTime());
 
-    ProcessUpdate(output);
+  ProcessUpdate(output);
 }
 
Index: trunk/lib/FlairFilter/src/SimuAhrs.h
===================================================================
--- trunk/lib/FlairFilter/src/SimuAhrs.h	(revision 14)
+++ trunk/lib/FlairFilter/src/SimuAhrs.h	(revision 15)
@@ -17,51 +17,49 @@
 #include <stdint.h>
 
-namespace flair
-{
-namespace filter
-{
-    /*! \class SimuAhrs
-    *
-    * \brief Class for a simulation Ahrs
-    *
-    * This class constructs a SimuImu as Imu of this Ahrs.
-    */
-    class SimuAhrs : public filter::Ahrs
-    {
-        public:
-            /*!
-            * \brief Constructor
-            *
-            * Construct a simulation Ahrs.
-            *
-            * \param parent parent
-            * \param name name
-            * \param dev_id number id of the simulated Ahrs
-            * \param priority priority of the SimuImu Thread
-            */
-            SimuAhrs(const core::FrameworkManager* parent,std::string name,uint32_t dev_id,uint8_t priority);
+namespace flair {
+namespace filter {
+/*! \class SimuAhrs
+*
+* \brief Class for a simulation Ahrs
+*
+* This class constructs a SimuImu as Imu of this Ahrs.
+*/
+class SimuAhrs : public filter::Ahrs {
+public:
+  /*!
+  * \brief Constructor
+  *
+  * Construct a simulation Ahrs.
+  *
+  * \param parent parent
+  * \param name name
+  * \param dev_id number id of the simulated Ahrs
+  * \param priority priority of the SimuImu Thread
+  */
+  SimuAhrs(const core::FrameworkManager *parent, std::string name,
+           uint32_t dev_id, uint8_t priority);
 
-            /*!
-            * \brief Destructor
-            *
-            */
-            ~SimuAhrs();
+  /*!
+  * \brief Destructor
+  *
+  */
+  ~SimuAhrs();
 
-             /*!
-            * \brief Start SimuImu Thread
-            *
-            */
-            void Start(void);
+  /*!
+ * \brief Start SimuImu Thread
+ *
+ */
+  void Start(void);
 
-        private:
-            /*!
-            * \brief Update using provided datas
-            *
-            * Reimplemented from IODevice.
-            *
-            * \param data data from the parent to process
-            */
-            void UpdateFrom(const core::io_data *data);
-    };
+private:
+  /*!
+  * \brief Update using provided datas
+  *
+  * Reimplemented from IODevice.
+  *
+  * \param data data from the parent to process
+  */
+  void UpdateFrom(const core::io_data *data);
+};
 } // end namespace filter
 } // end namespace flair
Index: trunk/lib/FlairFilter/src/TrajectoryGenerator1D.cpp
===================================================================
--- trunk/lib/FlairFilter/src/TrajectoryGenerator1D.cpp	(revision 14)
+++ trunk/lib/FlairFilter/src/TrajectoryGenerator1D.cpp	(revision 15)
@@ -26,67 +26,64 @@
 using namespace flair::gui;
 
-namespace flair { namespace filter {
+namespace flair {
+namespace filter {
 
-TrajectoryGenerator1D::TrajectoryGenerator1D(const LayoutPosition* position,string name,string unit) : IODevice(position->getLayout(),name) {
-    pimpl_=new TrajectoryGenerator1D_impl(this,position,name,unit);
-    AddDataToLog(pimpl_->output);
+TrajectoryGenerator1D::TrajectoryGenerator1D(const LayoutPosition *position,
+                                             string name, string unit)
+    : IODevice(position->getLayout(), name) {
+  pimpl_ = new TrajectoryGenerator1D_impl(this, position, name, unit);
+  AddDataToLog(pimpl_->output);
 }
 
-TrajectoryGenerator1D::~TrajectoryGenerator1D() {
-    delete pimpl_;
+TrajectoryGenerator1D::~TrajectoryGenerator1D() { delete pimpl_; }
+
+cvmatrix *TrajectoryGenerator1D::Matrix(void) const { return pimpl_->output; }
+
+void TrajectoryGenerator1D::StartTraj(float start_pos, float end_pos) {
+  pimpl_->StartTraj(start_pos, end_pos);
 }
 
-cvmatrix *TrajectoryGenerator1D::Matrix(void) const {
-    return pimpl_->output;
-}
-
-void TrajectoryGenerator1D::StartTraj(float start_pos,float end_pos) {
-    pimpl_->StartTraj(start_pos,end_pos);
-}
-
-//revoir l'interet du stop?
-void TrajectoryGenerator1D::StopTraj(void) {
-    pimpl_->StopTraj();
-}
+// revoir l'interet du stop?
+void TrajectoryGenerator1D::StopTraj(void) { pimpl_->StopTraj(); }
 
 bool TrajectoryGenerator1D::IsRunning(void) const {
-    if(pimpl_->is_started==true) {
-        if(pimpl_->is_finished==true) {
-            return false;
-        } else {
-            return true;
-        }
+  if (pimpl_->is_started == true) {
+    if (pimpl_->is_finished == true) {
+      return false;
     } else {
-        return false;
+      return true;
     }
+  } else {
+    return false;
+  }
 }
 
 float TrajectoryGenerator1D::Position(void) const {
-    return pimpl_->output->Value(0,0);
+  return pimpl_->output->Value(0, 0);
 }
 
 void TrajectoryGenerator1D::Reset(void) {
-    if(IsRunning()==false) {
-        pimpl_->Reset();
-    } else {
-        Err("impossible while running\n");
-    }
+  if (IsRunning() == false) {
+    pimpl_->Reset();
+  } else {
+    Err("impossible while running\n");
+  }
 }
 
 void TrajectoryGenerator1D::SetPositionOffset(float value) {
-    pimpl_->pos_off=value;
+  pimpl_->pos_off = value;
 }
 
 float TrajectoryGenerator1D::Speed(void) const {
-    return pimpl_->output->Value(1,0);
+  return pimpl_->output->Value(1, 0);
 }
 
 void TrajectoryGenerator1D::SetSpeedOffset(float value) {
-    pimpl_->vel_off=value;
+  pimpl_->vel_off = value;
 }
 
 void TrajectoryGenerator1D::Update(Time time) {
-    pimpl_->Update(time);
-    ProcessUpdate(pimpl_->output);
+  pimpl_->Update(time);
+  ProcessUpdate(pimpl_->output);
 }
 
Index: trunk/lib/FlairFilter/src/TrajectoryGenerator1D.h
===================================================================
--- trunk/lib/FlairFilter/src/TrajectoryGenerator1D.h	(revision 14)
+++ trunk/lib/FlairFilter/src/TrajectoryGenerator1D.h	(revision 15)
@@ -16,141 +16,141 @@
 #include <IODevice.h>
 
-namespace flair
-{
-    namespace core
-    {
-        class cvmatrix;
-    }
-    namespace gui
-    {
-        class LayoutPosition;
-    }
+namespace flair {
+namespace core {
+class cvmatrix;
+}
+namespace gui {
+class LayoutPosition;
+}
 }
 
 class TrajectoryGenerator1D_impl;
 
-namespace flair
-{
-namespace filter
-{
-    /*! \class TrajectoryGenerator1D
-    *
-    * \brief Class generating a trajectory in 1D
-    *
-    * This class generates position and velocity references, given
-    * an absolute maximum velocity and an absolute acceleration. \n
-    * When trajectory is started (see StartTraj()), position and velocity will increase
-    * at the given acceleration. If the maximum velocity is reached,
-    * velocity will not increase anymore. Then, velocity will decrease according
-    * to the given acceleration until velocity is null and final position is reached. \n
-    * Manual inputs can be introduced using SetPositionOffset() and SetSpeedOffset().
-    *
-    */
-    class TrajectoryGenerator1D : public core::IODevice
-    {
-        public:
-            /*!
-            * \brief Constructor
-            *
-            * Construct a TrajectoryGenerator1D at given position. \n
-            * The TrajectoryGenerator1D will automatically be child of position->getLayout() Layout. After calling this function,
-            * position will be deleted as it is no longer usefull. \n
-            *
-            * \param position position to display settings
-            * \param name name
-            * \param unit unit of the position (for exemple m, deg, etc). Its only used for display on ground station.
-            */
-            TrajectoryGenerator1D(const gui::LayoutPosition* position,std::string name,std::string unit="");
+namespace flair {
+namespace filter {
+/*! \class TrajectoryGenerator1D
+*
+* \brief Class generating a trajectory in 1D
+*
+* This class generates position and velocity references, given
+* an absolute maximum velocity and an absolute acceleration. \n
+* When trajectory is started (see StartTraj()), position and velocity will
+*increase
+* at the given acceleration. If the maximum velocity is reached,
+* velocity will not increase anymore. Then, velocity will decrease according
+* to the given acceleration until velocity is null and final position is
+*reached. \n
+* Manual inputs can be introduced using SetPositionOffset() and
+*SetSpeedOffset().
+*
+*/
+class TrajectoryGenerator1D : public core::IODevice {
+public:
+  /*!
+  * \brief Constructor
+  *
+  * Construct a TrajectoryGenerator1D at given position. \n
+  * The TrajectoryGenerator1D will automatically be child of
+  *position->getLayout() Layout. After calling this function,
+  * position will be deleted as it is no longer usefull. \n
+  *
+  * \param position position to display settings
+  * \param name name
+  * \param unit unit of the position (for exemple m, deg, etc). Its only used
+  *for display on ground station.
+  */
+  TrajectoryGenerator1D(const gui::LayoutPosition *position, std::string name,
+                        std::string unit = "");
 
-            /*!
-            * \brief Destructor
-            *
-            */
-            ~TrajectoryGenerator1D();
+  /*!
+  * \brief Destructor
+  *
+  */
+  ~TrajectoryGenerator1D();
 
-            /*!
-            * \brief Start trajectory
-            *
-            * \param start_pos start position
-            * \param end_pos end position
-            */
-            void StartTraj(float start_pos,float end_pos);
+  /*!
+  * \brief Start trajectory
+  *
+  * \param start_pos start position
+  * \param end_pos end position
+  */
+  void StartTraj(float start_pos, float end_pos);
 
-            /*!
-            * \brief Stop trajectory
-            *
-            */
-            void StopTraj(void);
+  /*!
+  * \brief Stop trajectory
+  *
+  */
+  void StopTraj(void);
 
-            /*!
-            * \brief Reset
-            *
-            * Reset all outputs to 0. This can be done only when IsRunning()==false.
-            *
-            */
-            void Reset(void);
+  /*!
+  * \brief Reset
+  *
+  * Reset all outputs to 0. This can be done only when IsRunning()==false.
+  *
+  */
+  void Reset(void);
 
-            /*!
-            * \brief Is trajectory running?
-            *
-            * \return true if trajectory is running
-            */
-            bool IsRunning(void) const;
+  /*!
+  * \brief Is trajectory running?
+  *
+  * \return true if trajectory is running
+  */
+  bool IsRunning(void) const;
 
-            /*!
-            * \brief Set position offset
-            *
-            * \param value position offset
-            */
-            void SetPositionOffset(float value);
+  /*!
+  * \brief Set position offset
+  *
+  * \param value position offset
+  */
+  void SetPositionOffset(float value);
 
-            /*!
-            * \brief Set speed offset
-            *
-            * \param value speed offset
-            */
-            void SetSpeedOffset(float value);
+  /*!
+  * \brief Set speed offset
+  *
+  * \param value speed offset
+  */
+  void SetSpeedOffset(float value);
 
-            /*!
-            * \brief Update using provided datas
-            *
-            * Uses values specified by StartTraj(),
-            * SetPositionOffset() and SetSpeedOffset().
-            *
-            * \param time time of the update
-            */
-            void Update(core::Time time);
+  /*!
+  * \brief Update using provided datas
+  *
+  * Uses values specified by StartTraj(),
+  * SetPositionOffset() and SetSpeedOffset().
+  *
+  * \param time time of the update
+  */
+  void Update(core::Time time);
 
-            /*!
-            * \brief Position
-            *
-            */
-            float Position(void) const;
+  /*!
+  * \brief Position
+  *
+  */
+  float Position(void) const;
 
-            /*!
-            * \brief Speed
-            *
-            */
-            float Speed(void) const;
+  /*!
+  * \brief Speed
+  *
+  */
+  float Speed(void) const;
 
-            /*!
-            * \brief Output matrix
-            *
-            * \return matrix
-            */
-            core::cvmatrix *Matrix(void) const;
+  /*!
+  * \brief Output matrix
+  *
+  * \return matrix
+  */
+  core::cvmatrix *Matrix(void) const;
 
-        private:
-            /*!
-            * \brief Update using provided datas
-            *
-            * Reimplemented from IODevice. Nothing to do in this IODevice.
-            *
-            * \param data data from the parent to process
-            */
-            void UpdateFrom(const core::io_data *data){};
+private:
+  /*!
+  * \brief Update using provided datas
+  *
+  * Reimplemented from IODevice. Nothing to do in this IODevice.
+  *
+  * \param data data from the parent to process
+  */
+  void UpdateFrom(const core::io_data *data){};
 
-            TrajectoryGenerator1D_impl* pimpl_;
-    };
+  TrajectoryGenerator1D_impl *pimpl_;
+};
 } // end namespace filter
 } // end namespace flair
Index: trunk/lib/FlairFilter/src/TrajectoryGenerator1D_impl.cpp
===================================================================
--- trunk/lib/FlairFilter/src/TrajectoryGenerator1D_impl.cpp	(revision 14)
+++ trunk/lib/FlairFilter/src/TrajectoryGenerator1D_impl.cpp	(revision 15)
@@ -29,118 +29,130 @@
 using namespace flair::filter;
 
-TrajectoryGenerator1D_impl::TrajectoryGenerator1D_impl(TrajectoryGenerator1D* self,const LayoutPosition* position,string name,string unit) {
-    first_update=true;
-    is_started=false;
+TrajectoryGenerator1D_impl::TrajectoryGenerator1D_impl(
+    TrajectoryGenerator1D *self, const LayoutPosition *position, string name,
+    string unit) {
+  first_update = true;
+  is_started = false;
 
-    //init UI
-    GroupBox* reglages_groupbox=new GroupBox(position,name);
-    T=new DoubleSpinBox(reglages_groupbox->NewRow(),"period, 0 for auto:"," s",0,1,0.01);
-    if(unit=="") {
-        max_veloctity=new DoubleSpinBox(reglages_groupbox->LastRowLastCol(),"velocity max (absolute):",0.,200000,1);
-    } else {
-        max_veloctity=new DoubleSpinBox(reglages_groupbox->LastRowLastCol(),"velocity max (absolute):"," "+ unit+"/s",0.,200000,1);
-    }
-    if(unit=="") {
-        acceleration=new DoubleSpinBox(reglages_groupbox->LastRowLastCol(),"acceleration (absolute):",0.,10,1,3);
-    } else {
-        acceleration=new DoubleSpinBox(reglages_groupbox->LastRowLastCol(),"acceleration (absolute):"," "+unit +"/s²",0.,200000,1);
-    }
+  // init UI
+  GroupBox *reglages_groupbox = new GroupBox(position, name);
+  T = new DoubleSpinBox(reglages_groupbox->NewRow(), "period, 0 for auto:",
+                        " s", 0, 1, 0.01);
+  if (unit == "") {
+    max_veloctity =
+        new DoubleSpinBox(reglages_groupbox->LastRowLastCol(),
+                          "velocity max (absolute):", 0., 200000, 1);
+  } else {
+    max_veloctity = new DoubleSpinBox(reglages_groupbox->LastRowLastCol(),
+                                      "velocity max (absolute):",
+                                      " " + unit + "/s", 0., 200000, 1);
+  }
+  if (unit == "") {
+    acceleration = new DoubleSpinBox(reglages_groupbox->LastRowLastCol(),
+                                     "acceleration (absolute):", 0., 10, 1, 3);
+  } else {
+    acceleration = new DoubleSpinBox(reglages_groupbox->LastRowLastCol(),
+                                     "acceleration (absolute):",
+                                     " " + unit + "/s²", 0., 200000, 1);
+  }
 
-    Reset();
+  Reset();
 
-    //init matrix
-    cvmatrix_descriptor* desc=new cvmatrix_descriptor(2,1);
-    desc->SetElementName(0,0,"pos");
-    desc->SetElementName(1,0,"vel");
-    output=new cvmatrix(self,desc,floatType,name);
+  // init matrix
+  cvmatrix_descriptor *desc = new cvmatrix_descriptor(2, 1);
+  desc->SetElementName(0, 0, "pos");
+  desc->SetElementName(1, 0, "vel");
+  output = new cvmatrix(self, desc, floatType, name);
 
-    output->SetValue(0,0,pos);
-    output->SetValue(1,0,v);
+  output->SetValue(0, 0, pos);
+  output->SetValue(1, 0, v);
 }
 
-TrajectoryGenerator1D_impl::~TrajectoryGenerator1D_impl() {
+TrajectoryGenerator1D_impl::~TrajectoryGenerator1D_impl() {}
+
+void TrajectoryGenerator1D_impl::Reset(void) {
+  pos = 0;
+  v = 0;
+  pos_off = 0;
+  vel_off = 0;
 }
 
-void TrajectoryGenerator1D_impl::Reset(void) {
-    pos=0;
-    v=0;
-    pos_off=0;
-    vel_off=0;
+void TrajectoryGenerator1D_impl::StartTraj(float start_pos, float end_pos) {
+  is_started = true;
+  is_finished = false;
+  first_update = true;
+
+  // configure trajectory
+  end_position = end_pos;
+  pos = start_pos;
+  acc = acceleration->Value();
+  v = 0;
+  if (end_position < start_pos) {
+    acc = -acc;
+    // max_veloctity=-max_veloctity;
+  }
 }
 
-void TrajectoryGenerator1D_impl::StartTraj(float start_pos,float end_pos) {
-    is_started=true;
-    is_finished=false;
-    first_update=true;
-
-    //configure trajectory
-    end_position=end_pos;
-    pos=start_pos;
-    acc=acceleration->Value();
-    v=0;
-    if(end_position<start_pos) {
-        acc=-acc;
-        //max_veloctity=-max_veloctity;
-    }
-}
-
-//revoir l'interet du stop?
+// revoir l'interet du stop?
 void TrajectoryGenerator1D_impl::StopTraj(void) {
-    is_started=false;
-    v=0;
-    //output->SetValue(1,0,v);
+  is_started = false;
+  v = 0;
+  // output->SetValue(1,0,v);
 }
 
 void TrajectoryGenerator1D_impl::Update(Time time) {
-    float delta_t;
+  float delta_t;
 
-    if(T->Value()==0) {
-        if(first_update==true) {
-            first_update=false;
-            previous_time=time;
-            output->GetMutex();
-            output->SetValueNoMutex(0,0,pos+pos_off);
-            output->SetValueNoMutex(1,0,v+vel_off);
-            output->ReleaseMutex();
+  if (T->Value() == 0) {
+    if (first_update == true) {
+      first_update = false;
+      previous_time = time;
+      output->GetMutex();
+      output->SetValueNoMutex(0, 0, pos + pos_off);
+      output->SetValueNoMutex(1, 0, v + vel_off);
+      output->ReleaseMutex();
 
-            output->SetDataTime(time);
-            return;
-        } else {
-            delta_t=(float)(time-previous_time)/1000000000.;
-        }
+      output->SetDataTime(time);
+      return;
     } else {
-        delta_t=T->Value();
+      delta_t = (float)(time - previous_time) / 1000000000.;
     }
-    previous_time=time;
+  } else {
+    delta_t = T->Value();
+  }
+  previous_time = time;
 
+  if (is_started == true) {
+    if (is_finished == false) {
+      v += acc * delta_t;
+      if (fabs(v) > fabs(max_veloctity->Value())) {
+        if (v > 0)
+          v = max_veloctity->Value();
+        else
+          v = -max_veloctity->Value();
+      }
+      pos += v * delta_t;
+      if (end_position - v * v / (2 * acc) <= pos && v >= 0)
+        acc = -acc;
+      if (end_position - v * v / (2 * acc) >= pos && v < 0)
+        acc = -acc;
+      if (pos >= end_position && v >= 0)
+        is_finished = true;
+      if (pos <= end_position && v < 0)
+        is_finished = true;
+    }
+    // else
+    if (is_finished == true) {
+      v = 0;
+      pos = end_position;
+    }
+  }
 
-    if(is_started==true) {
-        if(is_finished==false) {
-            v+=acc*delta_t;
-            if(fabs(v)>fabs(max_veloctity->Value())) {
-                if(v>0)
-                    v=max_veloctity->Value();
-                else
-                    v=-max_veloctity->Value();
-            }
-            pos+=v*delta_t;
-            if(end_position-v*v/(2*acc)<=pos && v>=0) acc=-acc;
-            if(end_position-v*v/(2*acc)>=pos && v<0) acc=-acc;
-            if(pos>=end_position && v>=0) is_finished=true;
-            if(pos<=end_position && v<0) is_finished=true;
-        }
-        //else
-        if(is_finished==true) {
-            v=0;
-            pos=end_position;
-        }
-    }
+  // on prend une fois pour toute les mutex et on fait des accès directs
+  output->GetMutex();
+  output->SetValueNoMutex(0, 0, pos + pos_off);
+  output->SetValueNoMutex(1, 0, v + vel_off);
+  output->ReleaseMutex();
 
-    //on prend une fois pour toute les mutex et on fait des accès directs
-    output->GetMutex();
-    output->SetValueNoMutex(0,0,pos+pos_off);
-    output->SetValueNoMutex(1,0,v+vel_off);
-    output->ReleaseMutex();
-
-    output->SetDataTime(time);
+  output->SetDataTime(time);
 }
Index: trunk/lib/FlairFilter/src/TrajectoryGenerator2DCircle.cpp
===================================================================
--- trunk/lib/FlairFilter/src/TrajectoryGenerator2DCircle.cpp	(revision 14)
+++ trunk/lib/FlairFilter/src/TrajectoryGenerator2DCircle.cpp	(revision 15)
@@ -27,72 +27,54 @@
 using namespace flair::gui;
 
-namespace flair
-{
-namespace filter
-{
+namespace flair {
+namespace filter {
 
-TrajectoryGenerator2DCircle::TrajectoryGenerator2DCircle(const LayoutPosition* position,string name) : IODevice(position->getLayout(),name)
-{
-    pimpl_=new TrajectoryGenerator2DCircle_impl(this,position,name);
-    AddDataToLog(pimpl_->output);
+TrajectoryGenerator2DCircle::TrajectoryGenerator2DCircle(
+    const LayoutPosition *position, string name)
+    : IODevice(position->getLayout(), name) {
+  pimpl_ = new TrajectoryGenerator2DCircle_impl(this, position, name);
+  AddDataToLog(pimpl_->output);
 }
 
+TrajectoryGenerator2DCircle::~TrajectoryGenerator2DCircle() { delete pimpl_; }
 
-TrajectoryGenerator2DCircle::~TrajectoryGenerator2DCircle()
-{
-    delete pimpl_;
+bool TrajectoryGenerator2DCircle::IsRunning(void) const {
+  return pimpl_->is_running;
 }
 
-bool TrajectoryGenerator2DCircle::IsRunning(void) const
-{
-    return pimpl_->is_running;
+cvmatrix *TrajectoryGenerator2DCircle::Matrix(void) const {
+  return pimpl_->output;
 }
 
-cvmatrix *TrajectoryGenerator2DCircle::Matrix(void) const
-{
-    return pimpl_->output;
+void TrajectoryGenerator2DCircle::StartTraj(const Vector2D &start_pos,
+                                            float nb_lap) {
+  pimpl_->StartTraj(start_pos, nb_lap);
 }
 
-void TrajectoryGenerator2DCircle::StartTraj(const Vector2D &start_pos,float nb_lap)
-{
-    pimpl_->StartTraj(start_pos,nb_lap);
+void TrajectoryGenerator2DCircle::FinishTraj(void) { pimpl_->FinishTraj(); }
+
+void TrajectoryGenerator2DCircle::StopTraj(void) { pimpl_->is_running = false; }
+
+void TrajectoryGenerator2DCircle::GetPosition(Vector2D &point) const {
+  point.x = pimpl_->output->Value(0, 0);
+  point.y = pimpl_->output->Value(0, 1);
 }
 
-void TrajectoryGenerator2DCircle::FinishTraj(void)
-{
-    pimpl_->FinishTraj();
+void TrajectoryGenerator2DCircle::SetCenter(const Vector2D &value) {
+  pimpl_->pos_off = value;
 }
 
-void TrajectoryGenerator2DCircle::StopTraj(void)
-{
-    pimpl_->is_running=false;
+void TrajectoryGenerator2DCircle::GetSpeed(Vector2D &point) const {
+  point.x = pimpl_->output->Value(1, 0);
+  point.y = pimpl_->output->Value(1, 1);
 }
 
-void TrajectoryGenerator2DCircle::GetPosition(Vector2D &point) const
-{
-    point.x=pimpl_->output->Value(0,0);
-    point.y=pimpl_->output->Value(0,1);
+void TrajectoryGenerator2DCircle::SetCenterSpeed(const Vector2D &value) {
+  pimpl_->vel_off = value;
 }
 
-void TrajectoryGenerator2DCircle::SetCenter(const Vector2D &value)
-{
-    pimpl_->pos_off=value;
-}
-
-void TrajectoryGenerator2DCircle::GetSpeed(Vector2D &point) const
-{
-    point.x=pimpl_->output->Value(1,0);
-    point.y=pimpl_->output->Value(1,1);
-}
-
-void TrajectoryGenerator2DCircle::SetCenterSpeed(const Vector2D &value)
-{
-    pimpl_->vel_off=value;
-}
-
-void TrajectoryGenerator2DCircle::Update(Time time)
-{
-    pimpl_->Update(time);
-    ProcessUpdate(pimpl_->output);
+void TrajectoryGenerator2DCircle::Update(Time time) {
+  pimpl_->Update(time);
+  ProcessUpdate(pimpl_->output);
 }
 
Index: trunk/lib/FlairFilter/src/TrajectoryGenerator2DCircle.h
===================================================================
--- trunk/lib/FlairFilter/src/TrajectoryGenerator2DCircle.h	(revision 14)
+++ trunk/lib/FlairFilter/src/TrajectoryGenerator2DCircle.h	(revision 15)
@@ -16,144 +16,140 @@
 #include <IODevice.h>
 
-namespace flair
-{
-    namespace core
-    {
-        class cvmatrix;
-        class Vector2D;
-    }
-    namespace gui
-    {
-        class LayoutPosition;
-    }
+namespace flair {
+namespace core {
+class cvmatrix;
+class Vector2D;
+}
+namespace gui {
+class LayoutPosition;
+}
 }
 
 class TrajectoryGenerator2DCircle_impl;
 
-namespace flair
-{
-namespace filter
-{
-    /*! \class TrajectoryGenerator2DCircle
-    *
-    * \brief Class generating a circle trajectory in 2D
-    *
-    * This class generates position and velocity references, given
-    * a maximum velocity and an absolute acceleration, for a circle. \n
-    * When trajectory is started (StartTraj), position and velocity will increase
-    * at the given acceleration untill maximum velocity is reached. \n
-    * When trajectory is asked to be finished (see FinishTraj()), position
-    * and velocity will decrease at the given acceleration untill null velocity is reached. \n
-    * Position and velocity of the center of the circle can be manually changed
-    * through SetCenter() and SetCenterSpeed().
-    */
-    class TrajectoryGenerator2DCircle : public core::IODevice
-    {
-        public:
-            /*!
-            * \brief Constructor
-            *
-            * Construct a TrajectoryGenerator2DCircle at position. \n
-            * The TrajectoryGenerator2DCircle will automatically be child of position->getLayout() Layout. After calling this function,
-            * position will be deleted as it is no longer usefull. \n
-            *
-            * \param position position to display settings
-            * \param name name
-            */
-            TrajectoryGenerator2DCircle(const gui::LayoutPosition* position,std::string name);
+namespace flair {
+namespace filter {
+/*! \class TrajectoryGenerator2DCircle
+*
+* \brief Class generating a circle trajectory in 2D
+*
+* This class generates position and velocity references, given
+* a maximum velocity and an absolute acceleration, for a circle. \n
+* When trajectory is started (StartTraj), position and velocity will increase
+* at the given acceleration untill maximum velocity is reached. \n
+* When trajectory is asked to be finished (see FinishTraj()), position
+* and velocity will decrease at the given acceleration untill null velocity is
+*reached. \n
+* Position and velocity of the center of the circle can be manually changed
+* through SetCenter() and SetCenterSpeed().
+*/
+class TrajectoryGenerator2DCircle : public core::IODevice {
+public:
+  /*!
+  * \brief Constructor
+  *
+  * Construct a TrajectoryGenerator2DCircle at position. \n
+  * The TrajectoryGenerator2DCircle will automatically be child of
+  *position->getLayout() Layout. After calling this function,
+  * position will be deleted as it is no longer usefull. \n
+  *
+  * \param position position to display settings
+  * \param name name
+  */
+  TrajectoryGenerator2DCircle(const gui::LayoutPosition *position,
+                              std::string name);
 
-            /*!
-            * \brief Destructor
-            *
-            */
-            ~TrajectoryGenerator2DCircle();
+  /*!
+  * \brief Destructor
+  *
+  */
+  ~TrajectoryGenerator2DCircle();
 
-            /*!
-            * \brief Start trajectory
-            *
-            * \param start_pos start position
-            * \param nb_lap number of laps, -1 for infinite
-            */
-            void StartTraj(const core::Vector2D &start_pos,float nb_lap=-1);
+  /*!
+  * \brief Start trajectory
+  *
+  * \param start_pos start position
+  * \param nb_lap number of laps, -1 for infinite
+  */
+  void StartTraj(const core::Vector2D &start_pos, float nb_lap = -1);
 
-            /*!
-            * \brief Stop trajectory
-            *
-            * Stop abruptly the trajectory.
-            */
-            void StopTraj(void);
+  /*!
+  * \brief Stop trajectory
+  *
+  * Stop abruptly the trajectory.
+  */
+  void StopTraj(void);
 
-            /*!
-            * \brief Finish trajectory
-            *
-            * Finish smoothly the trajectory.
-            */
-            void FinishTraj(void);
+  /*!
+  * \brief Finish trajectory
+  *
+  * Finish smoothly the trajectory.
+  */
+  void FinishTraj(void);
 
-            /*!
-            * \brief Set center position
-            *
-            * \param value center position
-            */
-            void SetCenter(const core::Vector2D &value);
+  /*!
+  * \brief Set center position
+  *
+  * \param value center position
+  */
+  void SetCenter(const core::Vector2D &value);
 
-            /*!
-            * \brief Set center speed
-            *
-            * \param value center speed
-            */
-            void SetCenterSpeed(const core::Vector2D &value);
+  /*!
+  * \brief Set center speed
+  *
+  * \param value center speed
+  */
+  void SetCenterSpeed(const core::Vector2D &value);
 
-            /*!
-            * \brief Update using provided datas
-            *
-            * Uses values specified by StartTraj(),
-            * SetCenter() and SetCenterSpeed().
-            *
-            * \param time time of the update
-            */
-            void Update(core::Time time);
+  /*!
+  * \brief Update using provided datas
+  *
+  * Uses values specified by StartTraj(),
+  * SetCenter() and SetCenterSpeed().
+  *
+  * \param time time of the update
+  */
+  void Update(core::Time time);
 
-            /*!
-            * \brief Position
-            *
-            * \param point returned position
-            */
-            void GetPosition(core::Vector2D &point) const;
+  /*!
+  * \brief Position
+  *
+  * \param point returned position
+  */
+  void GetPosition(core::Vector2D &point) const;
 
-            /*!
-            * \brief Speed
-            *
-            * \param point returned speed
-            */
-            void GetSpeed(core::Vector2D &point) const;
+  /*!
+  * \brief Speed
+  *
+  * \param point returned speed
+  */
+  void GetSpeed(core::Vector2D &point) const;
 
-            /*!
-            * \brief Output matrix
-            *
-            * \return matrix
-            */
-            core::cvmatrix *Matrix(void) const;
+  /*!
+  * \brief Output matrix
+  *
+  * \return matrix
+  */
+  core::cvmatrix *Matrix(void) const;
 
-            /*!
-            * \brief Is trajectory running?
-            *
-            * \return true if trajectory is running
-            */
-            bool IsRunning(void) const;
+  /*!
+  * \brief Is trajectory running?
+  *
+  * \return true if trajectory is running
+  */
+  bool IsRunning(void) const;
 
-        private:
-            /*!
-            * \brief Update using provided datas
-            *
-            * Reimplemented from IODevice. Nothing to do in this IODevice.
-            *
-            * \param data data from the parent to process
-            */
-            void UpdateFrom(const core::io_data *data){};
+private:
+  /*!
+  * \brief Update using provided datas
+  *
+  * Reimplemented from IODevice. Nothing to do in this IODevice.
+  *
+  * \param data data from the parent to process
+  */
+  void UpdateFrom(const core::io_data *data){};
 
-            TrajectoryGenerator2DCircle_impl* pimpl_;
-
-    };
+  TrajectoryGenerator2DCircle_impl *pimpl_;
+};
 } // end namespace filter
 } // end namespace flair
Index: trunk/lib/FlairFilter/src/TrajectoryGenerator2DCircle_impl.cpp
===================================================================
--- trunk/lib/FlairFilter/src/TrajectoryGenerator2DCircle_impl.cpp	(revision 14)
+++ trunk/lib/FlairFilter/src/TrajectoryGenerator2DCircle_impl.cpp	(revision 15)
@@ -31,125 +31,141 @@
 using namespace flair::filter;
 
-TrajectoryGenerator2DCircle_impl::TrajectoryGenerator2DCircle_impl(TrajectoryGenerator2DCircle* self,const LayoutPosition* position,string name) {
-    first_update=true;
-    is_running=false;
-    is_finishing=false;
+TrajectoryGenerator2DCircle_impl::TrajectoryGenerator2DCircle_impl(
+    TrajectoryGenerator2DCircle *self, const LayoutPosition *position,
+    string name) {
+  first_update = true;
+  is_running = false;
+  is_finishing = false;
 
-    //init UI
-   GroupBox* reglages_groupbox=new GroupBox(position,name);
-        T=new DoubleSpinBox(reglages_groupbox->NewRow(),"period, 0 for auto"," s",0,1,0.01);
-        rayon=new DoubleSpinBox(reglages_groupbox->LastRowLastCol(),"R"," m",0,1000,.1);
-        veloctity=new DoubleSpinBox(reglages_groupbox->LastRowLastCol(),"velocity"," m/s",-10,10,1);
-        acceleration=new DoubleSpinBox(reglages_groupbox->LastRowLastCol(),"acceleration (absolute)"," m/s²",0,10,.1);
+  // init UI
+  GroupBox *reglages_groupbox = new GroupBox(position, name);
+  T = new DoubleSpinBox(reglages_groupbox->NewRow(), "period, 0 for auto", " s",
+                        0, 1, 0.01);
+  rayon = new DoubleSpinBox(reglages_groupbox->LastRowLastCol(), "R", " m", 0,
+                            1000, .1);
+  veloctity = new DoubleSpinBox(reglages_groupbox->LastRowLastCol(), "velocity",
+                                " m/s", -10, 10, 1);
+  acceleration =
+      new DoubleSpinBox(reglages_groupbox->LastRowLastCol(),
+                        "acceleration (absolute)", " m/s²", 0, 10, .1);
 
-    //init matrix
-    cvmatrix_descriptor* desc=new cvmatrix_descriptor(2,2);
-    desc->SetElementName(0,0,"pos.x");
-    desc->SetElementName(0,1,"pos.y");
-    desc->SetElementName(1,0,"vel.x");
-    desc->SetElementName(1,1,"vel.y");
-    output=new cvmatrix(self,desc,floatType,name);
+  // init matrix
+  cvmatrix_descriptor *desc = new cvmatrix_descriptor(2, 2);
+  desc->SetElementName(0, 0, "pos.x");
+  desc->SetElementName(0, 1, "pos.y");
+  desc->SetElementName(1, 0, "vel.x");
+  desc->SetElementName(1, 1, "vel.y");
+  output = new cvmatrix(self, desc, floatType, name);
 
-    output->SetValue(0,0,0);
-    output->SetValue(0,1,0);
-    output->SetValue(1,0,0);
-    output->SetValue(1,1,0);
+  output->SetValue(0, 0, 0);
+  output->SetValue(0, 1, 0);
+  output->SetValue(1, 0, 0);
+  output->SetValue(1, 1, 0);
 }
 
-
 TrajectoryGenerator2DCircle_impl::~TrajectoryGenerator2DCircle_impl() {
-    delete output;
+  delete output;
 }
 
-void TrajectoryGenerator2DCircle_impl::StartTraj(const Vector2D &start_pos,float nb_lap) {
-    is_running=true;
-    first_update=true;
-    is_finishing=false;
-    this->nb_lap=nb_lap;
+void TrajectoryGenerator2DCircle_impl::StartTraj(const Vector2D &start_pos,
+                                                 float nb_lap) {
+  is_running = true;
+  first_update = true;
+  is_finishing = false;
+  this->nb_lap = nb_lap;
 
-    //configure trajectory
-    angle_off=atan2(start_pos.y-pos_off.y,start_pos.x-pos_off.x);
-    CurrentTime=0;
+  // configure trajectory
+  angle_off = atan2(start_pos.y - pos_off.y, start_pos.x - pos_off.x);
+  CurrentTime = 0;
 }
 
 void TrajectoryGenerator2DCircle_impl::FinishTraj(void) {
-    if(!is_finishing) {
-        is_finishing=true;
-        FinishTime=CurrentTime;
-    }
+  if (!is_finishing) {
+    is_finishing = true;
+    FinishTime = CurrentTime;
+  }
 }
 
 void TrajectoryGenerator2DCircle_impl::Update(Time time) {
-    float delta_t;
-    float theta;
-    float V=veloctity->Value();
-    float A=acceleration->Value();
-    float R=rayon->Value();
-    Vector2D v;
+  float delta_t;
+  float theta;
+  float V = veloctity->Value();
+  float A = acceleration->Value();
+  float R = rayon->Value();
+  Vector2D v;
 
-    if(V<0) A=-A;
+  if (V < 0)
+    A = -A;
 
-    if(T->Value()==0) {
-        if(first_update) {
-            first_update=false;
-            previous_time=time;
-            return;
+  if (T->Value() == 0) {
+    if (first_update) {
+      first_update = false;
+      previous_time = time;
+      return;
+    } else {
+      delta_t = (float)(time - previous_time) / 1000000000.;
+    }
+  } else {
+    delta_t = T->Value();
+  }
+  previous_time = time;
+  CurrentTime += delta_t;
+
+  if (is_finishing && CurrentTime > FinishTime + V / A)
+    is_running = false;
+
+  if (is_running) {
+    if (R == 0) {
+      pos.x = 0;
+      pos.y = 0;
+      v.x = 0;
+      v.y = 0;
+    } else {
+      if (CurrentTime < V / A) {
+        theta = angle_off + A / 2 * CurrentTime * CurrentTime / R;
+        pos.x = R * cos(theta);
+        pos.y = R * sin(theta);
+        v.x = -A * CurrentTime * sin(theta);
+        v.y = A * CurrentTime * cos(theta);
+      } else {
+        if (!is_finishing) {
+          theta =
+              angle_off + V * V / (2 * A * R) + (CurrentTime - V / A) * V / R;
+          pos.x = R * cos(theta);
+          pos.y = R * sin(theta);
+          v.x = -V * sin(theta);
+          v.y = V * cos(theta);
         } else {
-            delta_t=(float)(time-previous_time)/1000000000.;
+          theta = angle_off + V * V / (2 * A * R) +
+                  (FinishTime - V / A) * V / R -
+                  A / 2 * (FinishTime - CurrentTime) *
+                      (FinishTime - CurrentTime) / R +
+                  V * (CurrentTime - FinishTime) / R;
+          pos.x = R * cos(theta);
+          pos.y = R * sin(theta);
+          v.x = -(V + A * (FinishTime - CurrentTime)) * sin(theta);
+          v.y = (V + A * (FinishTime - CurrentTime)) * cos(theta);
         }
-    } else {
-        delta_t=T->Value();
-    }
-    previous_time=time;
-    CurrentTime+=delta_t;
-
-    if(is_finishing && CurrentTime>FinishTime+V/A) is_running=false;
-
-    if(is_running) {
-        if(R==0) {
-            pos.x=0;
-            pos.y=0;
-            v.x=0;
-            v.y=0;
-        } else {
-            if(CurrentTime<V/A) {
-                theta=angle_off+A/2*CurrentTime*CurrentTime/R;
-                pos.x=R*cos(theta);
-                pos.y=R*sin(theta);
-                v.x=-A*CurrentTime*sin(theta);
-                v.y=A*CurrentTime*cos(theta);
-            } else {
-                if(!is_finishing) {
-                    theta=angle_off+V*V/(2*A*R)+(CurrentTime-V/A)*V/R;
-                    pos.x=R*cos(theta);
-                    pos.y=R*sin(theta);
-                    v.x=-V*sin(theta);
-                    v.y=V*cos(theta);
-                } else {
-                    theta=angle_off+V*V/(2*A*R)+(FinishTime-V/A)*V/R-A/2*(FinishTime-CurrentTime)*(FinishTime-CurrentTime)/R+V*(CurrentTime-FinishTime)/R;
-                    pos.x=R*cos(theta);
-                    pos.y=R*sin(theta);
-                    v.x=-(V+A*(FinishTime-CurrentTime))*sin(theta);
-                    v.y=(V+A*(FinishTime-CurrentTime))*cos(theta);
-                }
-            }
-        }
-
-        if(theta-angle_off>=nb_lap*2*PI-(-A/2*(V/A)*(V/A)/R+V*(V/A)/R) && nb_lap>0) {
-            FinishTraj();
-        }
-    } else {
-        v.x=0;
-        v.y=0;
+      }
     }
 
-    //on prend une fois pour toute les mutex et on fait des accès directs
-    output->GetMutex();
-    output->SetValueNoMutex(0,0,pos.x+pos_off.x);
-    output->SetValueNoMutex(0,1,pos.y+pos_off.y);
-    output->SetValueNoMutex(1,0,v.x+vel_off.x);
-    output->SetValueNoMutex(1,1,v.y+vel_off.y);
-    output->ReleaseMutex();
+    if (theta - angle_off >= nb_lap * 2 * PI - (-A / 2 * (V / A) * (V / A) / R +
+                                                V * (V / A) / R) &&
+        nb_lap > 0) {
+      FinishTraj();
+    }
+  } else {
+    v.x = 0;
+    v.y = 0;
+  }
 
-    output->SetDataTime(time);
+  // on prend une fois pour toute les mutex et on fait des accès directs
+  output->GetMutex();
+  output->SetValueNoMutex(0, 0, pos.x + pos_off.x);
+  output->SetValueNoMutex(0, 1, pos.y + pos_off.y);
+  output->SetValueNoMutex(1, 0, v.x + vel_off.x);
+  output->SetValueNoMutex(1, 1, v.y + vel_off.y);
+  output->ReleaseMutex();
+
+  output->SetDataTime(time);
 }
Index: trunk/lib/FlairFilter/src/UavMultiplex.cpp
===================================================================
--- trunk/lib/FlairFilter/src/UavMultiplex.cpp	(revision 14)
+++ trunk/lib/FlairFilter/src/UavMultiplex.cpp	(revision 15)
@@ -27,88 +27,64 @@
 using namespace flair::gui;
 
-namespace flair
-{
-namespace filter
-{
+namespace flair {
+namespace filter {
 
-UavMultiplex::UavMultiplex(const core::FrameworkManager* parent,std::string name) : IODevice(parent,name)
-{
-    pimpl_=new UavMultiplex_impl(parent,this,name);
+UavMultiplex::UavMultiplex(const core::FrameworkManager *parent,
+                           std::string name)
+    : IODevice(parent, name) {
+  pimpl_ = new UavMultiplex_impl(parent, this, name);
 }
 
-UavMultiplex::~UavMultiplex(void)
-{
-    delete pimpl_;
+UavMultiplex::~UavMultiplex(void) { delete pimpl_; }
+
+void UavMultiplex::Update(core::Time time) {
+  pimpl_->input->SetDataTime(time);
+  UpdateFrom(pimpl_->input);
 }
 
-void UavMultiplex::Update(core::Time time)
-{
-    pimpl_->input->SetDataTime(time);
-    UpdateFrom(pimpl_->input);
+void UavMultiplex::SetMultiplexComboBox(string name, int index) {
+  pimpl_->SetMultiplexComboBox(name, index);
 }
 
-void UavMultiplex::SetMultiplexComboBox(string name,int index)
-{
-    pimpl_->SetMultiplexComboBox(name,index);
+int UavMultiplex::MultiplexValue(int index) const {
+  return pimpl_->MultiplexValue(index);
 }
 
-int UavMultiplex::MultiplexValue(int index) const
-{
-    return pimpl_->MultiplexValue(index);
+TabWidget *UavMultiplex::GetTabWidget(void) const { return pimpl_->tabwidget; }
+
+Layout *UavMultiplex::GetLayout(void) const { return pimpl_->setup_tab; }
+
+void UavMultiplex::LockUserInterface(void) const {
+  pimpl_->setup_tab->setEnabled(false);
 }
 
-TabWidget* UavMultiplex::GetTabWidget(void) const
-{
-    return pimpl_->tabwidget;
+void UavMultiplex::UnlockUserInterface(void) const {
+  pimpl_->setup_tab->setEnabled(true);
 }
 
-Layout* UavMultiplex::GetLayout(void) const
-{
-    return pimpl_->setup_tab;
+void UavMultiplex::SetRoll(float value) {
+  pimpl_->input->SetValue(0, 0, value);
 }
 
-void UavMultiplex::LockUserInterface(void) const
-{
-    pimpl_->setup_tab->setEnabled(false);
+void UavMultiplex::SetPitch(float value) {
+  pimpl_->input->SetValue(1, 0, value);
 }
 
-void UavMultiplex::UnlockUserInterface(void) const
-{
-    pimpl_->setup_tab->setEnabled(true);
+void UavMultiplex::SetYaw(float value) { pimpl_->input->SetValue(2, 0, value); }
+
+void UavMultiplex::SetThrust(float value) {
+  pimpl_->input->SetValue(3, 0, value);
 }
 
-void UavMultiplex::SetRoll(float value)
-{
-    pimpl_->input->SetValue(0,0,value);
+void UavMultiplex::SetRollTrim(float value) {
+  pimpl_->input->SetValue(4, 0, value);
 }
 
-void UavMultiplex::SetPitch(float value)
-{
-    pimpl_->input->SetValue(1,0,value);
+void UavMultiplex::SetPitchTrim(float value) {
+  pimpl_->input->SetValue(5, 0, value);
 }
 
-void UavMultiplex::SetYaw(float value)
-{
-    pimpl_->input->SetValue(2,0,value);
-}
-
-void UavMultiplex::SetThrust(float value)
-{
-    pimpl_->input->SetValue(3,0,value);
-}
-
-void UavMultiplex::SetRollTrim(float value)
-{
-    pimpl_->input->SetValue(4,0,value);
-}
-
-void UavMultiplex::SetPitchTrim(float value)
-{
-    pimpl_->input->SetValue(5,0,value);
-}
-
-void UavMultiplex::SetYawTrim(float value)
-{
-    pimpl_->input->SetValue(6,0,value);
+void UavMultiplex::SetYawTrim(float value) {
+  pimpl_->input->SetValue(6, 0, value);
 }
 
Index: trunk/lib/FlairFilter/src/UavMultiplex.h
===================================================================
--- trunk/lib/FlairFilter/src/UavMultiplex.h	(revision 14)
+++ trunk/lib/FlairFilter/src/UavMultiplex.h	(revision 15)
@@ -17,207 +17,202 @@
 #include <stdint.h>
 
-namespace flair
-{
-    namespace core
-    {
-        class FrameworkManager;
-        class io_data;
-    }
-    namespace gui
-    {
-        class TabWidget;
-        class Layout;
-    }
+namespace flair {
+namespace core {
+class FrameworkManager;
+class io_data;
 }
+namespace gui {
+class TabWidget;
+class Layout;
+}
+}
 
 class UavMultiplex_impl;
 
-namespace flair
-{
-namespace filter
-{
-    /*! \class UavMultiplex
-    *
-    * \brief Class defining uav multiplexing
-    */
-    class UavMultiplex : public core::IODevice
-    {
-        public:
-            /*!
-            * \brief Constructor
-            *
-            * Construct a uav multiplexing
-            *
-            * \param parent parent
-            * \param name name
-            */
-            UavMultiplex(const core::FrameworkManager* parent,std::string name);
-
-            /*!
-            * \brief Destructor
-            *
-            */
-            ~UavMultiplex();
-
-            /*!
-            * \brief Set roll torque
-            *
-            * roll torque is placed in input(0,0)
-            *
-            * \param value value between -1 and 1
-            */
-            void SetRoll(float value);
-
-            /*!
-            * \brief Set pitch torque
-            *
-            * pitch torque is placed in input(1,0)
-            *
-            * \param value value between -1 and 1
-            */
-            void SetPitch(float value);
-
-            /*!
-            * \brief Set yaw torque
-            *
-            * yaw torque is placed in input(2,0)
-            *
-            * \param value value between -1 and 1
-            */
-            void SetYaw(float value);
-
-            /*!
-            * \brief Set thrust
-            *
-            * thrust is placed in input(3,0)
-            *
-            * \param value value between 0 and 1
-            */
-            void SetThrust(float value);
-
-            /*!
-            * \brief Set roll trim
-            *
-            * trim is placed in input(4,0)
-            *
-            * \param value value
-            */
-            void SetRollTrim(float value);
-
-            /*!
-            * \brief Set pitch trim
-            *
-            * trim is placed in input(5,0)
-            *
-            * \param value value
-            */
-            void SetPitchTrim(float value);
-
-            /*!
-            * \brief Set yaw trim
-            *
-            * trim is placed in input(6,0)
-            *
-            * \param value value
-            */
-            void SetYawTrim(float value);
-
-            /*!
-            * \brief Update using provided datas
-            *
-            * Uses values specified by Set*().
-            *
-            * \param time time of the update
-            */
-            void Update(core::Time time);
-
-            /*!
-            * \brief Lock user interface
-            *
-            * User interface will be grayed out.\n
-            * Use it do disallow changes when flying.
-            *
-            */
-            void LockUserInterface(void) const;
-
-            /*!
-            * \brief Unlock user interface
-            *
-            * User interface will be enabled.\n
-            *
-            */
-            void UnlockUserInterface(void) const;
-
-            /*!
-            * \brief Layout
-            *
-            * Layout to place custom widgets.\n
-            *
-            * \return the layout
-            */
-            gui::Layout* GetLayout(void) const;
-
-            /*!
-            * \brief Use default plot
-            *
-            * Derived class can implement this function do draw default plot.
-            *
-            */
-            virtual void UseDefaultPlot(void){};
-
-            /*!
-            * \brief Motors count
-            *
-            * This function must be reimplemented, in order to get the number of motors.
-            *
-            * \return motors count
-            */
-            virtual uint8_t MotorsCount(void) const=0;
-
-            /*!
-            * \brief Multiplex value
-            *
-            * Get the mutliplexed value of a motor, if SetMultiplexComboBox() was used.\n
-            *
-            * \param index index of the motor, from 0 to MotorsCount()
-            * \return multiplexed index of the motor
-            */
-            int MultiplexValue(int index) const;
-
-            /*!
-            * \brief Get TabWidget
-            *
-            * Usefull to add tabs.\n
-            *
-            * \return the TabWidget
-            */
-            gui::TabWidget* GetTabWidget(void) const;
-
-        protected:
-            /*!
-            * \brief Set multiplex ComboBox
-            *
-            * Draws a ComboBox to define motor multiplexing. \n
-            * This is used to change the order of the output motors.
-            *
-            * \param name description of the motor (ex front left)
-            * \param index index of the motor, from 0 to MotorsCount()
-            */
-            void SetMultiplexComboBox(std::string name,int index);
-
-        private:
-            /*!
-            * \brief Update using provided datas
-            *
-            * This function is automatically called by ProcessUpdate()
-            * of the Object::Parent's if its Object::ObjectType is "IODevice". \n
-            * This function must be reimplemented, in order to process the data from the parent.
-            *
-            * \param data data from the parent to process
-            */
-            virtual void UpdateFrom(const core::io_data *data)=0;
-
-            UavMultiplex_impl *pimpl_;
-    };
+namespace flair {
+namespace filter {
+/*! \class UavMultiplex
+*
+* \brief Class defining uav multiplexing
+*/
+class UavMultiplex : public core::IODevice {
+public:
+  /*!
+  * \brief Constructor
+  *
+  * Construct a uav multiplexing
+  *
+  * \param parent parent
+  * \param name name
+  */
+  UavMultiplex(const core::FrameworkManager *parent, std::string name);
+
+  /*!
+  * \brief Destructor
+  *
+  */
+  ~UavMultiplex();
+
+  /*!
+  * \brief Set roll torque
+  *
+  * roll torque is placed in input(0,0)
+  *
+  * \param value value between -1 and 1
+  */
+  void SetRoll(float value);
+
+  /*!
+  * \brief Set pitch torque
+  *
+  * pitch torque is placed in input(1,0)
+  *
+  * \param value value between -1 and 1
+  */
+  void SetPitch(float value);
+
+  /*!
+  * \brief Set yaw torque
+  *
+  * yaw torque is placed in input(2,0)
+  *
+  * \param value value between -1 and 1
+  */
+  void SetYaw(float value);
+
+  /*!
+  * \brief Set thrust
+  *
+  * thrust is placed in input(3,0)
+  *
+  * \param value value between 0 and 1
+  */
+  void SetThrust(float value);
+
+  /*!
+  * \brief Set roll trim
+  *
+  * trim is placed in input(4,0)
+  *
+  * \param value value
+  */
+  void SetRollTrim(float value);
+
+  /*!
+  * \brief Set pitch trim
+  *
+  * trim is placed in input(5,0)
+  *
+  * \param value value
+  */
+  void SetPitchTrim(float value);
+
+  /*!
+  * \brief Set yaw trim
+  *
+  * trim is placed in input(6,0)
+  *
+  * \param value value
+  */
+  void SetYawTrim(float value);
+
+  /*!
+  * \brief Update using provided datas
+  *
+  * Uses values specified by Set*().
+  *
+  * \param time time of the update
+  */
+  void Update(core::Time time);
+
+  /*!
+  * \brief Lock user interface
+  *
+  * User interface will be grayed out.\n
+  * Use it do disallow changes when flying.
+  *
+  */
+  void LockUserInterface(void) const;
+
+  /*!
+  * \brief Unlock user interface
+  *
+  * User interface will be enabled.\n
+  *
+  */
+  void UnlockUserInterface(void) const;
+
+  /*!
+  * \brief Layout
+  *
+  * Layout to place custom widgets.\n
+  *
+  * \return the layout
+  */
+  gui::Layout *GetLayout(void) const;
+
+  /*!
+  * \brief Use default plot
+  *
+  * Derived class can implement this function do draw default plot.
+  *
+  */
+  virtual void UseDefaultPlot(void){};
+
+  /*!
+  * \brief Motors count
+  *
+  * This function must be reimplemented, in order to get the number of motors.
+  *
+  * \return motors count
+  */
+  virtual uint8_t MotorsCount(void) const = 0;
+
+  /*!
+  * \brief Multiplex value
+  *
+  * Get the mutliplexed value of a motor, if SetMultiplexComboBox() was used.\n
+  *
+  * \param index index of the motor, from 0 to MotorsCount()
+  * \return multiplexed index of the motor
+  */
+  int MultiplexValue(int index) const;
+
+  /*!
+  * \brief Get TabWidget
+  *
+  * Usefull to add tabs.\n
+  *
+  * \return the TabWidget
+  */
+  gui::TabWidget *GetTabWidget(void) const;
+
+protected:
+  /*!
+  * \brief Set multiplex ComboBox
+  *
+  * Draws a ComboBox to define motor multiplexing. \n
+  * This is used to change the order of the output motors.
+  *
+  * \param name description of the motor (ex front left)
+  * \param index index of the motor, from 0 to MotorsCount()
+  */
+  void SetMultiplexComboBox(std::string name, int index);
+
+private:
+  /*!
+  * \brief Update using provided datas
+  *
+  * This function is automatically called by ProcessUpdate()
+  * of the Object::Parent's if its Object::ObjectType is "IODevice". \n
+  * This function must be reimplemented, in order to process the data from the
+  *parent.
+  *
+  * \param data data from the parent to process
+  */
+  virtual void UpdateFrom(const core::io_data *data) = 0;
+
+  UavMultiplex_impl *pimpl_;
+};
 } // end namespace filter
 } // end namespace flair
Index: trunk/lib/FlairFilter/src/UavMultiplex_impl.cpp
===================================================================
--- trunk/lib/FlairFilter/src/UavMultiplex_impl.cpp	(revision 14)
+++ trunk/lib/FlairFilter/src/UavMultiplex_impl.cpp	(revision 15)
@@ -33,62 +33,56 @@
 using namespace flair::filter;
 
-UavMultiplex_impl::UavMultiplex_impl(const FrameworkManager* parent,UavMultiplex* self,std::string name) {
-    input=new cvmatrix(self,7,1,floatType);
-    multiplexcombobox=NULL;
-    this->self=self;
+UavMultiplex_impl::UavMultiplex_impl(const FrameworkManager *parent,
+                                     UavMultiplex *self, std::string name) {
+  input = new cvmatrix(self, 7, 1, floatType);
+  multiplexcombobox = NULL;
+  this->self = self;
 
-    //station sol
-    main_tab=new Tab(parent->GetTabWidget(),name);
-    tabwidget=new TabWidget(main_tab->NewRow(),"UavMultiplex");
-	setup_tab=new Tab(tabwidget,"Setup");
+  // station sol
+  main_tab = new Tab(parent->GetTabWidget(), name);
+  tabwidget = new TabWidget(main_tab->NewRow(), "UavMultiplex");
+  setup_tab = new Tab(tabwidget, "Setup");
 }
 
-UavMultiplex_impl::~UavMultiplex_impl(void)
-{
-    delete main_tab;
-    if(multiplexcombobox!=NULL) free(multiplexcombobox);
+UavMultiplex_impl::~UavMultiplex_impl(void) {
+  delete main_tab;
+  if (multiplexcombobox != NULL)
+    free(multiplexcombobox);
 }
 
-void UavMultiplex_impl::SetMultiplexComboBox(string name,int index)
-{
-    //we do not know motorcount at constructor time, so allocation is done here
-    if(multiplexcombobox==NULL)
-    {
-        multiplexcombobox=(ComboBox**)malloc(self->MotorsCount()*sizeof(ComboBox*));
-        for(int i=0;i<self->MotorsCount();i++) multiplexcombobox[i]=NULL;
-        groupbox=new GroupBox(setup_tab->NewRow(),"motor attribution");
-    }
-    if(index>self->MotorsCount())
-    {
-        self->Err("index out of bound %i/%i\n",index,self->MotorsCount());
-        return;
-    }
-    if(multiplexcombobox[index]!=NULL)
-    {
-        self->Err("index already setup\n");
-        return;
-    }
+void UavMultiplex_impl::SetMultiplexComboBox(string name, int index) {
+  // we do not know motorcount at constructor time, so allocation is done here
+  if (multiplexcombobox == NULL) {
+    multiplexcombobox =
+        (ComboBox **)malloc(self->MotorsCount() * sizeof(ComboBox *));
+    for (int i = 0; i < self->MotorsCount(); i++)
+      multiplexcombobox[i] = NULL;
+    groupbox = new GroupBox(setup_tab->NewRow(), "motor attribution");
+  }
+  if (index > self->MotorsCount()) {
+    self->Err("index out of bound %i/%i\n", index, self->MotorsCount());
+    return;
+  }
+  if (multiplexcombobox[index] != NULL) {
+    self->Err("index already setup\n");
+    return;
+  }
 
-    multiplexcombobox[index]=new ComboBox(groupbox->At(index/4,index%4),name);
+  multiplexcombobox[index] =
+      new ComboBox(groupbox->At(index / 4, index % 4), name);
 
-    for(int i=0;i<self->MotorsCount();i++)
-    {
-        ostringstream oss;
-        oss << i;
-        multiplexcombobox[index]->AddItem(oss.str());
-    }
+  for (int i = 0; i < self->MotorsCount(); i++) {
+    ostringstream oss;
+    oss << i;
+    multiplexcombobox[index]->AddItem(oss.str());
+  }
 }
 
-int UavMultiplex_impl::MultiplexValue(int index) const
-{
-    if(multiplexcombobox[index]!=NULL)
-    {
-        return multiplexcombobox[index]->CurrentIndex();
-    }
-    else
-    {
-        self->Err("multiplex not setup for motor %i\n",index);
-        return 0;
-    }
-
+int UavMultiplex_impl::MultiplexValue(int index) const {
+  if (multiplexcombobox[index] != NULL) {
+    return multiplexcombobox[index]->CurrentIndex();
+  } else {
+    self->Err("multiplex not setup for motor %i\n", index);
+    return 0;
+  }
 }
Index: trunk/lib/FlairFilter/src/X4X8Multiplex.cpp
===================================================================
--- trunk/lib/FlairFilter/src/X4X8Multiplex.cpp	(revision 14)
+++ trunk/lib/FlairFilter/src/X4X8Multiplex.cpp	(revision 15)
@@ -23,52 +23,39 @@
 using namespace flair::gui;
 
-namespace flair
-{
-namespace filter
-{
+namespace flair {
+namespace filter {
 
-X4X8Multiplex::X4X8Multiplex(const FrameworkManager* parent,std::string name,UavType_t type) : UavMultiplex(parent,name)
-{
-    int nb_mot;
+X4X8Multiplex::X4X8Multiplex(const FrameworkManager *parent, std::string name,
+                             UavType_t type)
+    : UavMultiplex(parent, name) {
+  int nb_mot;
 
-    switch(type)
-    {
-        case X4:
-            nb_mot=4;
-            break;
-        case X8:
-            nb_mot=8;
-            break;
-        default:
-            Err("uav type not supported\n");
-            break;
-    }
+  switch (type) {
+  case X4:
+    nb_mot = 4;
+    break;
+  case X8:
+    nb_mot = 8;
+    break;
+  default:
+    Err("uav type not supported\n");
+    break;
+  }
 
-    pimpl_=new X4X8Multiplex_impl(this,nb_mot);
+  pimpl_ = new X4X8Multiplex_impl(this, nb_mot);
 
-    for(int i=0;i<nb_mot;i++)
-    {
-        SetMultiplexComboBox(pimpl_->MotorName(i),i);
-    }
+  for (int i = 0; i < nb_mot; i++) {
+    SetMultiplexComboBox(pimpl_->MotorName(i), i);
+  }
 }
 
-X4X8Multiplex::~X4X8Multiplex(void)
-{
-    delete pimpl_;
-}
+X4X8Multiplex::~X4X8Multiplex(void) { delete pimpl_; }
 
-uint8_t X4X8Multiplex::MotorsCount(void) const
-{
-    return pimpl_->nb_mot;
-}
+uint8_t X4X8Multiplex::MotorsCount(void) const { return pimpl_->nb_mot; }
 
-void X4X8Multiplex::UseDefaultPlot(void)
-{
-    pimpl_->UseDefaultPlot();
-}
+void X4X8Multiplex::UseDefaultPlot(void) { pimpl_->UseDefaultPlot(); }
 
-void X4X8Multiplex::UpdateFrom(const io_data *data)
-{
-    pimpl_->UpdateFrom(data);
+void X4X8Multiplex::UpdateFrom(const io_data *data) {
+  pimpl_->UpdateFrom(data);
 }
 
Index: trunk/lib/FlairFilter/src/X4X8Multiplex.h
===================================================================
--- trunk/lib/FlairFilter/src/X4X8Multiplex.h	(revision 14)
+++ trunk/lib/FlairFilter/src/X4X8Multiplex.h	(revision 15)
@@ -18,90 +18,89 @@
 class X4X8Multiplex_impl;
 
-namespace flair
-{
-namespace filter
-{
-    /*! \class X4X8Multiplex
-    *
-    * \brief Class defining X4 and X8 multiplexing
-    *
-    * The output order of the motors can be changed through ground station.
-    */
-    class X4X8Multiplex : public UavMultiplex
-    {
-        friend class ::X4X8Multiplex_impl;
+namespace flair {
+namespace filter {
+/*! \class X4X8Multiplex
+*
+* \brief Class defining X4 and X8 multiplexing
+*
+* The output order of the motors can be changed through ground station.
+*/
+class X4X8Multiplex : public UavMultiplex {
+  friend class ::X4X8Multiplex_impl;
 
-        public:
-             /*!
-            \enum UavType_t
-            \brief type of UAV
-            */
-            typedef enum {
-                X4,/*!< 4 motors: front left, front right, rear left, rear right */
-                X8/*!< 8 motors: top front left, top front right, top rear left, top rear right, bottom front left, bottom front right, bottom rear left, bottom rear right */
-                } UavType_t;
+public:
+  /*!
+ \enum UavType_t
+ \brief type of UAV
+ */
+  typedef enum {
+    X4, /*!< 4 motors: front left, front right, rear left, rear right */
+    X8  /*!< 8 motors: top front left, top front right, top rear left, top rear
+           right, bottom front left, bottom front right, bottom rear left, bottom
+           rear right */
+  } UavType_t;
 
-            /*!
-            \enum MotorNames_t
-            \brief Motor names
-            */
-            typedef enum {
-                TopFrontLeft=0,/*!< Top front left, X4 or X8 */
-                TopFrontRight=1,/*!< Top front right, X4 or X8 */
-                TopRearLeft=2,/*!< Top rear left, X4 or X8 */
-                TopRearRight=3,/*!< Top rear right, X4 or X8 */
-                BottomFrontLeft=4,/*!< Bottom front left, X8 */
-                BottomFrontRight=5,/*!< Bottom front right, X8 */
-                BottomRearLeft=6,/*!< Bottom rear left, X8 */
-                BottomRearRight=7,/*!< Bottom rear right, X8 */
-                } MotorNames_t;
+  /*!
+  \enum MotorNames_t
+  \brief Motor names
+  */
+  typedef enum {
+    TopFrontLeft = 0,     /*!< Top front left, X4 or X8 */
+    TopFrontRight = 1,    /*!< Top front right, X4 or X8 */
+    TopRearLeft = 2,      /*!< Top rear left, X4 or X8 */
+    TopRearRight = 3,     /*!< Top rear right, X4 or X8 */
+    BottomFrontLeft = 4,  /*!< Bottom front left, X8 */
+    BottomFrontRight = 5, /*!< Bottom front right, X8 */
+    BottomRearLeft = 6,   /*!< Bottom rear left, X8 */
+    BottomRearRight = 7,  /*!< Bottom rear right, X8 */
+  } MotorNames_t;
 
-            /*!
-            * \brief Constructor
-            *
-            * Construct a X4 and X8 multiplexing
-            *
-            * \param parent parent
-            * \param name name
-            * \param type type
-            */
-            X4X8Multiplex(const core::FrameworkManager* parent,std::string name,UavType_t type);
+  /*!
+  * \brief Constructor
+  *
+  * Construct a X4 and X8 multiplexing
+  *
+  * \param parent parent
+  * \param name name
+  * \param type type
+  */
+  X4X8Multiplex(const core::FrameworkManager *parent, std::string name,
+                UavType_t type);
 
-            /*!
-            * \brief Destructor
-            *
-            */
-            ~X4X8Multiplex();
+  /*!
+  * \brief Destructor
+  *
+  */
+  ~X4X8Multiplex();
 
-            /*!
-            * \brief Use default plot
-            *
-            * Plot the output values.
-            *
-            */
-            void UseDefaultPlot(void);
+  /*!
+  * \brief Use default plot
+  *
+  * Plot the output values.
+  *
+  */
+  void UseDefaultPlot(void);
 
-            /*!
-            * \brief Motors count
-            *
-            * Reimplemented from UavMultiplex.
-            *
-            * \return motors count
-            */
-            uint8_t MotorsCount(void) const;
+  /*!
+  * \brief Motors count
+  *
+  * Reimplemented from UavMultiplex.
+  *
+  * \return motors count
+  */
+  uint8_t MotorsCount(void) const;
 
-        private:
-            /*!
-            * \brief Update using provided datas
-            *
-            * Reimplemented from IODevice.
-            *
-            * \param data data from the parent to process
-            */
-            void UpdateFrom(const core::io_data *data);
+private:
+  /*!
+  * \brief Update using provided datas
+  *
+  * Reimplemented from IODevice.
+  *
+  * \param data data from the parent to process
+  */
+  void UpdateFrom(const core::io_data *data);
 
-            X4X8Multiplex_impl *pimpl_;
-
-    };
+  X4X8Multiplex_impl *pimpl_;
+};
 } // end namespace filter
 } // end namespace flair
Index: trunk/lib/FlairFilter/src/X4X8Multiplex_impl.cpp
===================================================================
--- trunk/lib/FlairFilter/src/X4X8Multiplex_impl.cpp	(revision 14)
+++ trunk/lib/FlairFilter/src/X4X8Multiplex_impl.cpp	(revision 15)
@@ -33,199 +33,183 @@
 using namespace flair::filter;
 
-X4X8Multiplex_impl::X4X8Multiplex_impl(flair::filter::X4X8Multiplex* self,int nb_mot)
-{
-    this->nb_mot=nb_mot;
-    this->self=self;
-
-    if(nb_mot==4)
-    {
-        GroupBox *groupbox=new GroupBox(self->GetLayout()->NewRow(),"x4 multiplex");
-        pas=new ComboBox(groupbox->NewRow(),"front left blade pitch:");
+X4X8Multiplex_impl::X4X8Multiplex_impl(flair::filter::X4X8Multiplex *self,
+                                       int nb_mot) {
+  this->nb_mot = nb_mot;
+  this->self = self;
+
+  if (nb_mot == 4) {
+    GroupBox *groupbox =
+        new GroupBox(self->GetLayout()->NewRow(), "x4 multiplex");
+    pas = new ComboBox(groupbox->NewRow(), "front left blade pitch:");
+  } else {
+    GroupBox *groupbox =
+        new GroupBox(self->GetLayout()->NewRow(), "x8 multiplex");
+    pas = new ComboBox(groupbox->NewRow(), "top front left blade pitch:");
+  }
+  pas->AddItem("normal");
+  pas->AddItem("inverted");
+
+  cvmatrix_descriptor *desc = new cvmatrix_descriptor(nb_mot, 1);
+  for (int i = 0; i < nb_mot; i++) {
+    desc->SetElementName(i, 0, MotorName(i));
+  }
+
+  output = new cvmatrix(self, desc, floatType);
+
+  self->AddDataToLog(output);
+}
+
+X4X8Multiplex_impl::~X4X8Multiplex_impl(void) {}
+
+void X4X8Multiplex_impl::UseDefaultPlot(void) {
+  Tab *plot_tab = new Tab(self->GetTabWidget(), "Values");
+  plots[0] = new DataPlot1D(plot_tab->NewRow(), "front left", 0, 1);
+  plots[1] = new DataPlot1D(plot_tab->LastRowLastCol(), "front right", 0, 1);
+  plots[2] = new DataPlot1D(plot_tab->NewRow(), "rear left", 0, 1);
+  plots[3] = new DataPlot1D(plot_tab->LastRowLastCol(), "rear right", 0, 1);
+
+  for (int i = 0; i < 4; i++)
+    plots[i]->AddCurve(output->Element(i));
+
+  if (nb_mot == 8) {
+    for (int i = 0; i < 4; i++)
+      plots[i]->AddCurve(output->Element(i + 4), DataPlot::Blue);
+  }
+}
+
+void X4X8Multiplex_impl::UpdateFrom(const io_data *data) {
+  float u_roll, u_pitch, u_yaw, u_thrust;
+  float trim_roll, trim_pitch, trim_yaw;
+  float value[MAX_MOTORS];
+
+  cvmatrix *input = (cvmatrix *)data;
+
+  // on prend une fois pour toute le mutex et on fait des accès directs
+  input->GetMutex();
+
+  u_roll = input->ValueNoMutex(0, 0);
+  u_pitch = input->ValueNoMutex(1, 0);
+  u_yaw = input->ValueNoMutex(2, 0);
+  u_thrust = input->ValueNoMutex(3, 0);
+  trim_roll = input->ValueNoMutex(4, 0);
+  trim_pitch = input->ValueNoMutex(5, 0);
+  trim_yaw = input->ValueNoMutex(6, 0);
+
+  input->ReleaseMutex();
+
+  if (pas->CurrentIndex() == 1) {
+    trim_yaw = -trim_yaw;
+    u_yaw = -u_yaw;
+  }
+
+  if (nb_mot == 2) {
+    //(top) front left
+    value[self->MultiplexValue(X4X8Multiplex::TopFrontLeft)] = Set(
+        trim_pitch + trim_roll + trim_yaw, u_thrust + u_pitch + u_roll + u_yaw);
+
+    //(top) front right
+    value[self->MultiplexValue(X4X8Multiplex::TopFrontRight)] = Set(
+        trim_pitch - trim_roll - trim_yaw, u_thrust + u_pitch - u_roll - u_yaw);
+  }
+  if (nb_mot == 4 || nb_mot == 8) {
+    //(top) front left
+    value[self->MultiplexValue(X4X8Multiplex::TopFrontLeft)] = Set(
+        trim_pitch + trim_roll + trim_yaw, u_thrust + u_pitch + u_roll + u_yaw);
+
+    //(top) front right
+    value[self->MultiplexValue(X4X8Multiplex::TopFrontRight)] = Set(
+        trim_pitch - trim_roll - trim_yaw, u_thrust + u_pitch - u_roll - u_yaw);
+
+    //(top) rear left
+    value[self->MultiplexValue(X4X8Multiplex::TopRearLeft)] =
+        Set(-trim_pitch + trim_roll - trim_yaw,
+            u_thrust - u_pitch + u_roll - u_yaw);
+
+    //(top) rear right
+    value[self->MultiplexValue(X4X8Multiplex::TopRearRight)] =
+        Set(-trim_pitch - trim_roll + trim_yaw,
+            u_thrust - u_pitch - u_roll + u_yaw);
+  }
+
+  if (nb_mot == 8) {
+    // bottom front left
+    value[self->MultiplexValue(X4X8Multiplex::BottomFrontLeft)] = Set(
+        trim_pitch + trim_roll - trim_yaw, u_thrust + u_pitch + u_roll - u_yaw);
+
+    // bottom front right
+    value[self->MultiplexValue(X4X8Multiplex::BottomFrontRight)] = Set(
+        trim_pitch - trim_roll + trim_yaw, u_thrust + u_pitch - u_roll + u_yaw);
+
+    // bottom rear left
+    value[self->MultiplexValue(X4X8Multiplex::BottomRearLeft)] =
+        Set(-trim_pitch + trim_roll + trim_yaw,
+            u_thrust - u_pitch + u_roll + u_yaw);
+
+    // bottom rear right
+    value[self->MultiplexValue(X4X8Multiplex::BottomRearRight)] =
+        Set(-trim_pitch - trim_roll - trim_yaw,
+            u_thrust - u_pitch - u_roll - u_yaw);
+  }
+
+  // on prend une fois pour toute le mutex et on fait des accès directs
+  output->GetMutex();
+  for (int i = 0; i < nb_mot; i++)
+    output->SetValueNoMutex(i, 0, value[i]);
+  output->ReleaseMutex();
+
+  output->SetDataTime(data->DataTime());
+
+  self->ProcessUpdate(output);
+}
+
+float X4X8Multiplex_impl::Set(float trim, float u) {
+  float value = trim;
+
+  if (u > 0) {
+    value += sqrtf(u);
+  }
+
+  return value;
+}
+
+string X4X8Multiplex_impl::MotorName(int index) {
+  switch (nb_mot) {
+  case 4: {
+    switch (index) {
+    case 0:
+      return "front left";
+    case 1:
+      return "front rigth";
+    case 2:
+      return "rear left";
+    case 3:
+      return "rear rigth";
+    default:
+      return "unammed motor";
     }
-    else
-    {
-        GroupBox *groupbox=new GroupBox(self->GetLayout()->NewRow(),"x8 multiplex");
-        pas=new ComboBox(groupbox->NewRow(),"top front left blade pitch:");
+  }
+  case 8: {
+    switch (index) {
+    case 0:
+      return "top front left";
+    case 1:
+      return "top front rigth";
+    case 2:
+      return "top rear left";
+    case 3:
+      return "top rear rigth";
+    case 4:
+      return "bottom front left";
+    case 5:
+      return "bottom front rigth";
+    case 6:
+      return "bottom rear left";
+    case 7:
+      return "bottom rear rigth";
+    default:
+      return "unammed motor";
     }
-    pas->AddItem("normal");
-    pas->AddItem("inverted");
-
-    cvmatrix_descriptor* desc=new cvmatrix_descriptor(nb_mot,1);
-    for(int i=0;i<nb_mot;i++)
-    {
-        desc->SetElementName(i,0,MotorName(i));
-    }
-
-    output=new cvmatrix(self,desc,floatType);
-
-    self->AddDataToLog(output);
-}
-
-X4X8Multiplex_impl::~X4X8Multiplex_impl(void)
-{
-}
-
-void X4X8Multiplex_impl::UseDefaultPlot(void)
-{
-    Tab *plot_tab=new Tab(self->GetTabWidget(),"Values");
-    plots[0]=new DataPlot1D(plot_tab->NewRow(),"front left",0,1);
-    plots[1]=new DataPlot1D(plot_tab->LastRowLastCol(),"front right",0,1);
-    plots[2]=new DataPlot1D(plot_tab->NewRow(),"rear left",0,1);
-    plots[3]=new DataPlot1D(plot_tab->LastRowLastCol(),"rear right",0,1);
-
-    for(int i=0;i<4;i++) plots[i]->AddCurve(output->Element(i));
-
-    if(nb_mot==8)
-    {
-        for(int i=0;i<4;i++) plots[i]->AddCurve(output->Element(i+4),DataPlot::Blue);
-    }
-}
-
-void X4X8Multiplex_impl::UpdateFrom(const io_data *data)
-{
-    float u_roll,u_pitch,u_yaw,u_thrust;
-    float trim_roll,trim_pitch,trim_yaw;
-    float value[MAX_MOTORS];
-
-    cvmatrix* input=(cvmatrix*)data;
-
-    //on prend une fois pour toute le mutex et on fait des accès directs
-    input->GetMutex();
-
-    u_roll=input->ValueNoMutex(0,0);
-    u_pitch=input->ValueNoMutex(1,0);
-    u_yaw=input->ValueNoMutex(2,0);
-    u_thrust=input->ValueNoMutex(3,0);
-    trim_roll=input->ValueNoMutex(4,0);
-    trim_pitch=input->ValueNoMutex(5,0);
-    trim_yaw=input->ValueNoMutex(6,0);
-
-    input->ReleaseMutex();
-
-    if(pas->CurrentIndex()==1)
-    {
-        trim_yaw=-trim_yaw;
-        u_yaw=-u_yaw;
-    }
-
-if(nb_mot==2)
-{
-    //(top) front left
-    value[self->MultiplexValue(X4X8Multiplex::TopFrontLeft)]=Set(trim_pitch+trim_roll+trim_yaw,
-                 u_thrust+u_pitch+u_roll+u_yaw);
-
-    //(top) front right
-    value[self->MultiplexValue(X4X8Multiplex::TopFrontRight)]=Set(trim_pitch-trim_roll-trim_yaw,
-                 u_thrust+u_pitch-u_roll-u_yaw);
-}
-    if(nb_mot==4 || nb_mot==8)
-    {
-        //(top) front left
-        value[self->MultiplexValue(X4X8Multiplex::TopFrontLeft)]=Set(trim_pitch+trim_roll+trim_yaw,
-                     u_thrust+u_pitch+u_roll+u_yaw);
-
-        //(top) front right
-        value[self->MultiplexValue(X4X8Multiplex::TopFrontRight)]=Set(trim_pitch-trim_roll-trim_yaw,
-                     u_thrust+u_pitch-u_roll-u_yaw);
-
-        //(top) rear left
-        value[self->MultiplexValue(X4X8Multiplex::TopRearLeft)]=Set(-trim_pitch+trim_roll-trim_yaw,
-                     u_thrust-u_pitch+u_roll-u_yaw);
-
-        //(top) rear right
-        value[self->MultiplexValue(X4X8Multiplex::TopRearRight)]=Set(-trim_pitch-trim_roll+trim_yaw,
-                     u_thrust-u_pitch-u_roll+u_yaw);
-    }
-
-    if(nb_mot==8)
-    {
-        //bottom front left
-        value[self->MultiplexValue(X4X8Multiplex::BottomFrontLeft)]=Set(trim_pitch+trim_roll-trim_yaw,
-                     u_thrust+u_pitch+u_roll-u_yaw);
-
-        //bottom front right
-        value[self->MultiplexValue(X4X8Multiplex::BottomFrontRight)]=Set(trim_pitch-trim_roll+trim_yaw,
-                     u_thrust+u_pitch-u_roll+u_yaw);
-
-        //bottom rear left
-        value[self->MultiplexValue(X4X8Multiplex::BottomRearLeft)]=Set(-trim_pitch+trim_roll+trim_yaw,
-                     u_thrust-u_pitch+u_roll+u_yaw);
-
-        //bottom rear right
-        value[self->MultiplexValue(X4X8Multiplex::BottomRearRight)]=Set(-trim_pitch-trim_roll-trim_yaw,
-                     u_thrust-u_pitch-u_roll-u_yaw);
-
-    }
-
-    //on prend une fois pour toute le mutex et on fait des accès directs
-    output->GetMutex();
-    for(int i=0;i<nb_mot;i++) output->SetValueNoMutex(i,0,value[i]);
-    output->ReleaseMutex();
-
-    output->SetDataTime(data->DataTime());
-
-    self->ProcessUpdate(output);
-}
-
-float X4X8Multiplex_impl::Set(float trim,float u)
-{
-    float value=trim;
-
-    if(u>0)
-    {
-        value+=sqrtf(u);
-    }
-
-    return value;
-}
-
-string X4X8Multiplex_impl::MotorName(int index)
-{
-    switch(nb_mot)
-    {
-        case 4:
-        {
-            switch(index)
-            {
-                case 0:
-                    return "front left";
-                case 1:
-                    return "front rigth";
-                case 2:
-                    return "rear left";
-                case 3:
-                    return "rear rigth";
-                default:
-                    return "unammed motor";
-            }
-        }
-        case 8:
-        {
-            switch(index)
-            {
-                case 0:
-                    return "top front left";
-                case 1:
-                    return "top front rigth";
-                case 2:
-                    return "top rear left";
-                case 3:
-                    return "top rear rigth";
-                case 4:
-                    return "bottom front left";
-                case 5:
-                    return "bottom front rigth";
-                case 6:
-                    return "bottom rear left";
-                case 7:
-                    return "bottom rear rigth";
-                default:
-                    return "unammed motor";
-            }
-        }
-        default:
-        {
-            return "unammed motor";
-        }
-    }
-}
+  }
+  default: { return "unammed motor"; }
+  }
+}
Index: trunk/lib/FlairFilter/src/unexported/Ahrs_impl.h
===================================================================
--- trunk/lib/FlairFilter/src/unexported/Ahrs_impl.h	(revision 14)
+++ trunk/lib/FlairFilter/src/unexported/Ahrs_impl.h	(revision 15)
@@ -17,14 +17,14 @@
 
 namespace flair {
-    namespace core {
-        class AhrsData;
-    }
-    namespace gui {
-        class Tab;
-        class DataPlot1D;
-    }
-    namespace filter {
-        class Ahrs;
-    }
+namespace core {
+class AhrsData;
+}
+namespace gui {
+class Tab;
+class DataPlot1D;
+}
+namespace filter {
+class Ahrs;
+}
 }
 
@@ -37,17 +37,18 @@
 
 class Ahrs_impl {
-    public:
-        Ahrs_impl(flair::filter::Ahrs* self);
-        ~Ahrs_impl();
-        void UseDefaultPlot(void);
-        void AddPlot(const flair::core::AhrsData *ahrsData,flair::gui::DataPlot::Color_t color);
-        flair::gui::DataPlot1D *rollPlot,*pitchPlot,*yawPlot;
-        flair::gui::DataPlot1D *wXPlot,*wYPlot,*wZPlot;
-        flair::gui::DataPlot1D *q0Plot,*q1Plot,*q2Plot,*q3Plot;
-        flair::core::AhrsData *ahrsData;
+public:
+  Ahrs_impl(flair::filter::Ahrs *self);
+  ~Ahrs_impl();
+  void UseDefaultPlot(void);
+  void AddPlot(const flair::core::AhrsData *ahrsData,
+               flair::gui::DataPlot::Color_t color);
+  flair::gui::DataPlot1D *rollPlot, *pitchPlot, *yawPlot;
+  flair::gui::DataPlot1D *wXPlot, *wYPlot, *wZPlot;
+  flair::gui::DataPlot1D *q0Plot, *q1Plot, *q2Plot, *q3Plot;
+  flair::core::AhrsData *ahrsData;
 
-    private:
-        flair::gui::Tab *eulerTab,*quaternionTab;
-        flair::filter::Ahrs* self;
+private:
+  flair::gui::Tab *eulerTab, *quaternionTab;
+  flair::filter::Ahrs *self;
 };
 
Index: trunk/lib/FlairFilter/src/unexported/ButterworthLowPass_impl.h
===================================================================
--- trunk/lib/FlairFilter/src/unexported/ButterworthLowPass_impl.h	(revision 14)
+++ trunk/lib/FlairFilter/src/unexported/ButterworthLowPass_impl.h	(revision 15)
@@ -17,138 +17,119 @@
 #include <Butterworth.h>
 
-namespace flair
-{
-    namespace core
-    {
-        class cvmatrix;
-    }
-    namespace gui
-    {
-        class LayoutPosition;
-        class SpinBox;
-        class DoubleSpinBox;
-    }
-    namespace filter
-    {
-        class ButterworthLowPass;
-    }
+namespace flair {
+namespace core {
+class cvmatrix;
+}
+namespace gui {
+class LayoutPosition;
+class SpinBox;
+class DoubleSpinBox;
+}
+namespace filter {
+class ButterworthLowPass;
+}
 }
 
 // Storage for Layout
-//de-templatized for pimpl idom
-//comes from iir from Bernd Porr
-class LayoutStorage
-{
-    public:
-        LayoutStorage(int MaxPoles)
-        {
-            this->MaxPoles=MaxPoles;
-            m_pairs=(Iir::PoleZeroPair*)malloc((MaxPoles+1)/2*sizeof(Iir::PoleZeroPair));
-        }
-        ~LayoutStorage()
-        {
-            free(m_pairs);
-        }
-        operator Iir::LayoutBase ()
-        {
-            return Iir::LayoutBase (MaxPoles, m_pairs);
-        }
+// de-templatized for pimpl idom
+// comes from iir from Bernd Porr
+class LayoutStorage {
+public:
+  LayoutStorage(int MaxPoles) {
+    this->MaxPoles = MaxPoles;
+    m_pairs = (Iir::PoleZeroPair *)malloc((MaxPoles + 1) / 2 *
+                                          sizeof(Iir::PoleZeroPair));
+  }
+  ~LayoutStorage() { free(m_pairs); }
+  operator Iir::LayoutBase() { return Iir::LayoutBase(MaxPoles, m_pairs); }
 
-    private:
-        Iir::PoleZeroPair *m_pairs;
-        int MaxPoles;
+private:
+  Iir::PoleZeroPair *m_pairs;
+  int MaxPoles;
 };
 
 // Storage for Cascade
-//de-templatized for pimpl idom
-//comes from iir from Bernd Porr
-class CascadeStages
-{
-    public:
-        CascadeStages(int MaxStages)
-        {
-            this->MaxStages=MaxStages;
-            m_stages=(Iir::Cascade::Stage*)malloc(MaxStages*sizeof(Iir::Cascade::Stage));
-            m_states=(Iir::DirectFormII*)malloc(MaxStages*sizeof(Iir::DirectFormII));
-        }
-        ~CascadeStages()
-        {
-            free(m_stages);
-            free(m_states);
-        }
-        void reset ()
-        {
-            Iir::DirectFormII* state = m_states;
-            for (int i = MaxStages; --i >= 0; ++state)
-            state->reset();
-        }
+// de-templatized for pimpl idom
+// comes from iir from Bernd Porr
+class CascadeStages {
+public:
+  CascadeStages(int MaxStages) {
+    this->MaxStages = MaxStages;
+    m_stages =
+        (Iir::Cascade::Stage *)malloc(MaxStages * sizeof(Iir::Cascade::Stage));
+    m_states =
+        (Iir::DirectFormII *)malloc(MaxStages * sizeof(Iir::DirectFormII));
+  }
+  ~CascadeStages() {
+    free(m_stages);
+    free(m_states);
+  }
+  void reset() {
+    Iir::DirectFormII *state = m_states;
+    for (int i = MaxStages; --i >= 0; ++state)
+      state->reset();
+  }
 
-        template <typename Sample>
-        inline Sample filter(const Sample in)
-        {
-            double out = in;
-            Iir::DirectFormII* state = m_states;
-            Iir::Biquad const* stage = m_stages;
-            for (int i = MaxStages; --i >= 0; ++state, ++stage)
-            out = state->process1 (out, *stage);
-            return static_cast<Sample> (out);
-        }
+  template <typename Sample> inline Sample filter(const Sample in) {
+    double out = in;
+    Iir::DirectFormII *state = m_states;
+    Iir::Biquad const *stage = m_stages;
+    for (int i = MaxStages; --i >= 0; ++state, ++stage)
+      out = state->process1(out, *stage);
+    return static_cast<Sample>(out);
+  }
 
-        Iir::Cascade::Storage getCascadeStorage()
-        {
-            return Iir::Cascade::Storage (MaxStages, m_stages);
-        }
+  Iir::Cascade::Storage getCascadeStorage() {
+    return Iir::Cascade::Storage(MaxStages, m_stages);
+  }
 
-    private:
-        int MaxStages;
-        Iir::Cascade::Stage *m_stages;
-        Iir::DirectFormII *m_states;
+private:
+  int MaxStages;
+  Iir::Cascade::Stage *m_stages;
+  Iir::DirectFormII *m_states;
 };
 
-//de-templatized for pimpl idom
-//comes from iir from Bernd Porr
-class PoleFilter : Iir::Butterworth::LowPassBase,public CascadeStages
-{
-    public:
-        PoleFilter (int MaxPoles):CascadeStages((MaxPoles + 1) / 2)
-        {
-            this->MaxPoles=MaxPoles;
-            m_analogStorage=new LayoutStorage(MaxPoles);
-            m_digitalStorage=new LayoutStorage(MaxPoles);
-            // This glues together the factored base classes
-            // with the templatized storage classes.
-            Iir::Butterworth::LowPassBase::setCascadeStorage (this->getCascadeStorage());
-            Iir::Butterworth::LowPassBase::setPrototypeStorage (*m_analogStorage,*m_digitalStorage);
-        }
-        ~PoleFilter()
-        {
-            delete m_analogStorage;
-            delete m_digitalStorage;
-        }
-        void setup (double sampleRate,double cutoffFrequency)
-        {
-            Iir::Butterworth::LowPassBase::setup (MaxPoles, sampleRate,cutoffFrequency);
-        }
+// de-templatized for pimpl idom
+// comes from iir from Bernd Porr
+class PoleFilter : Iir::Butterworth::LowPassBase, public CascadeStages {
+public:
+  PoleFilter(int MaxPoles) : CascadeStages((MaxPoles + 1) / 2) {
+    this->MaxPoles = MaxPoles;
+    m_analogStorage = new LayoutStorage(MaxPoles);
+    m_digitalStorage = new LayoutStorage(MaxPoles);
+    // This glues together the factored base classes
+    // with the templatized storage classes.
+    Iir::Butterworth::LowPassBase::setCascadeStorage(this->getCascadeStorage());
+    Iir::Butterworth::LowPassBase::setPrototypeStorage(*m_analogStorage,
+                                                       *m_digitalStorage);
+  }
+  ~PoleFilter() {
+    delete m_analogStorage;
+    delete m_digitalStorage;
+  }
+  void setup(double sampleRate, double cutoffFrequency) {
+    Iir::Butterworth::LowPassBase::setup(MaxPoles, sampleRate, cutoffFrequency);
+  }
 
-    private:
-        int MaxPoles;
-        LayoutStorage* m_analogStorage;
-        LayoutStorage* m_digitalStorage;
+private:
+  int MaxPoles;
+  LayoutStorage *m_analogStorage;
+  LayoutStorage *m_digitalStorage;
 };
 
+class ButterworthLowPass_impl {
+public:
+  ButterworthLowPass_impl(flair::filter::ButterworthLowPass *self,
+                          const flair::gui::LayoutPosition *position,
+                          std::string name, int order);
+  ~ButterworthLowPass_impl();
+  void UpdateFrom(const flair::core::io_data *data);
+  flair::core::cvmatrix *output;
 
-class ButterworthLowPass_impl
-{
-    public:
-        ButterworthLowPass_impl(flair::filter::ButterworthLowPass* self,const flair::gui::LayoutPosition* position,std::string name,int order);
-        ~ButterworthLowPass_impl();
-        void UpdateFrom(const flair::core::io_data *data);
-        flair::core::cvmatrix *output;
-
-    private:
-        flair::gui::DoubleSpinBox *cutoff,*T;
-        PoleFilter* f;
-        bool first_update;
-        flair::core::Time previous_time;
+private:
+  flair::gui::DoubleSpinBox *cutoff, *T;
+  PoleFilter *f;
+  bool first_update;
+  flair::core::Time previous_time;
 };
 
Index: trunk/lib/FlairFilter/src/unexported/EulerDerivative_impl.h
===================================================================
--- trunk/lib/FlairFilter/src/unexported/EulerDerivative_impl.h	(revision 14)
+++ trunk/lib/FlairFilter/src/unexported/EulerDerivative_impl.h	(revision 15)
@@ -16,19 +16,15 @@
 #include <IODevice.h>
 
-namespace flair
-{
-    namespace core
-    {
-        class cvmatrix;
-    }
-    namespace gui
-    {
-        class LayoutPosition;
-        class DoubleSpinBox;
-    }
-    namespace filter
-    {
-        class EulerDerivative;
-    }
+namespace flair {
+namespace core {
+class cvmatrix;
+}
+namespace gui {
+class LayoutPosition;
+class DoubleSpinBox;
+}
+namespace filter {
+class EulerDerivative;
+}
 }
 
@@ -37,18 +33,19 @@
 */
 
-class EulerDerivative_impl
-{
-    public:
-        EulerDerivative_impl(flair::filter::EulerDerivative* self,const flair::gui::LayoutPosition* position,std::string name,const flair::core::cvmatrix* init_value=NULL);
-        ~EulerDerivative_impl();
-        void UpdateFrom(const flair::core::io_data *data);
-        flair::core::cvmatrix *output;
+class EulerDerivative_impl {
+public:
+  EulerDerivative_impl(flair::filter::EulerDerivative *self,
+                       const flair::gui::LayoutPosition *position,
+                       std::string name,
+                       const flair::core::cvmatrix *init_value = NULL);
+  ~EulerDerivative_impl();
+  void UpdateFrom(const flair::core::io_data *data);
+  flair::core::cvmatrix *output;
 
-    private:
-        flair::gui::DoubleSpinBox* T;
-        flair::core::Time previous_time;
-        bool first_update;
-        flair::core::cvmatrix* prev_value;
-
+private:
+  flair::gui::DoubleSpinBox *T;
+  flair::core::Time previous_time;
+  bool first_update;
+  flair::core::cvmatrix *prev_value;
 };
 
Index: trunk/lib/FlairFilter/src/unexported/JoyReference_impl.h
===================================================================
--- trunk/lib/FlairFilter/src/unexported/JoyReference_impl.h	(revision 14)
+++ trunk/lib/FlairFilter/src/unexported/JoyReference_impl.h	(revision 15)
@@ -24,61 +24,63 @@
 
 namespace flair {
-    namespace core {
-        class cvmatrix;
-        class io_data;
-        class AhrsData;
-    }
-    namespace gui {
-        class LayoutPosition;
-        class GroupBox;
-        class DoubleSpinBox;
-        class SpinBox;
-        class Label;
-        class PushButton;
-    }
-    namespace filter {
-        class JoyReference;
-    }
+namespace core {
+class cvmatrix;
+class io_data;
+class AhrsData;
+}
+namespace gui {
+class LayoutPosition;
+class GroupBox;
+class DoubleSpinBox;
+class SpinBox;
+class Label;
+class PushButton;
+}
+namespace filter {
+class JoyReference;
+}
 }
 
 class JoyReference_impl {
 
-    public:
-        JoyReference_impl(flair::filter::JoyReference *self,const flair::gui::LayoutPosition* position,std::string name);
-        ~JoyReference_impl();
-        void SetRollAxis(float value);
-        void SetPitchAxis(float value);
-        void SetYawAxis(float value);
-        void SetAltitudeAxis(float value);
-        float ZRef(void) const;
-        float dZRef(void) const;
-        float RollTrim(void) const;
-        float PitchTrim(void) const;
-        void SetYawRef(float value);
-        void SetZRef(float value);
-        void RollTrimUp(void);
-        void RollTrimDown(void);
-        void PitchTrimUp(void);
-        void PitchTrimDown(void);
-        void Update(flair::core::Time time);
-        void UpdateFrom(const flair::core::io_data *data);
-        flair::core::cvmatrix *output;
-        flair::core::AhrsData *ahrsData;
+public:
+  JoyReference_impl(flair::filter::JoyReference *self,
+                    const flair::gui::LayoutPosition *position,
+                    std::string name);
+  ~JoyReference_impl();
+  void SetRollAxis(float value);
+  void SetPitchAxis(float value);
+  void SetYawAxis(float value);
+  void SetAltitudeAxis(float value);
+  float ZRef(void) const;
+  float dZRef(void) const;
+  float RollTrim(void) const;
+  float PitchTrim(void) const;
+  void SetYawRef(float value);
+  void SetZRef(float value);
+  void RollTrimUp(void);
+  void RollTrimDown(void);
+  void PitchTrimUp(void);
+  void PitchTrimDown(void);
+  void Update(flair::core::Time time);
+  void UpdateFrom(const flair::core::io_data *data);
+  flair::core::cvmatrix *output;
+  flair::core::AhrsData *ahrsData;
 
-    private:
-        flair::core::cvmatrix *input;
+private:
+  flair::core::cvmatrix *input;
 
-        flair::gui::GroupBox *reglages_groupbox;
-        flair::gui::DoubleSpinBox *deb_roll,*deb_pitch,*deb_wz,*deb_dz;
-        flair::gui::DoubleSpinBox *trim;
-        flair::gui::Label *label_roll,*label_pitch;
-        flair::gui::PushButton *button_roll,*button_pitch;
+  flair::gui::GroupBox *reglages_groupbox;
+  flair::gui::DoubleSpinBox *deb_roll, *deb_pitch, *deb_wz, *deb_dz;
+  flair::gui::DoubleSpinBox *trim;
+  flair::gui::Label *label_roll, *label_pitch;
+  flair::gui::PushButton *button_roll, *button_pitch;
 
-        float z_ref;
-        flair::core::Quaternion q_z=flair::core::Quaternion(1,0,0,0);
-        float trim_roll,trim_pitch;
-        flair::core::Time previous_time;
+  float z_ref;
+  flair::core::Quaternion q_z = flair::core::Quaternion(1, 0, 0, 0);
+  float trim_roll, trim_pitch;
+  flair::core::Time previous_time;
 
-        flair::filter::JoyReference *self;
+  flair::filter::JoyReference *self;
 };
 
Index: trunk/lib/FlairFilter/src/unexported/LowPassFilter_impl.h
===================================================================
--- trunk/lib/FlairFilter/src/unexported/LowPassFilter_impl.h	(revision 14)
+++ trunk/lib/FlairFilter/src/unexported/LowPassFilter_impl.h	(revision 15)
@@ -16,36 +16,34 @@
 #include <IODevice.h>
 
-namespace flair
-{
-    namespace core
-    {
-        class cvmatrix;
-    }
-    namespace gui
-    {
-        class LayoutPosition;
-        class SpinBox;
-        class DoubleSpinBox;
-    }
-    namespace filter
-    {
-        class LowPassFilter;
-    }
+namespace flair {
+namespace core {
+class cvmatrix;
+}
+namespace gui {
+class LayoutPosition;
+class SpinBox;
+class DoubleSpinBox;
+}
+namespace filter {
+class LowPassFilter;
+}
 }
 
-class LowPassFilter_impl
-{
+class LowPassFilter_impl {
 
-    public:
-        LowPassFilter_impl(const flair::filter::LowPassFilter* self,const flair::gui::LayoutPosition* position,std::string name,const flair::core::cvmatrix* init_value=NULL);
-        ~LowPassFilter_impl();
-        void UpdateFrom(const flair::core::io_data *data);
-        flair::core::cvmatrix *output;
+public:
+  LowPassFilter_impl(const flair::filter::LowPassFilter *self,
+                     const flair::gui::LayoutPosition *position,
+                     std::string name,
+                     const flair::core::cvmatrix *init_value = NULL);
+  ~LowPassFilter_impl();
+  void UpdateFrom(const flair::core::io_data *data);
+  flair::core::cvmatrix *output;
 
-    private:
-        flair::core::Time previous_time;
-        bool first_update;
-        flair::core::cvmatrix* prev_value;
-        flair::gui::DoubleSpinBox *freq,*T;
+private:
+  flair::core::Time previous_time;
+  bool first_update;
+  flair::core::cvmatrix *prev_value;
+  flair::gui::DoubleSpinBox *freq, *T;
 };
 
Index: trunk/lib/FlairFilter/src/unexported/NestedSat_impl.h
===================================================================
--- trunk/lib/FlairFilter/src/unexported/NestedSat_impl.h	(revision 14)
+++ trunk/lib/FlairFilter/src/unexported/NestedSat_impl.h	(revision 15)
@@ -16,22 +16,18 @@
 #include <Object.h>
 
-namespace flair
-{
-    namespace core
-    {
-        class cvmatrix;
-        class io_data;
-    }
-    namespace gui
-    {
-        class Layout;
-        class LayoutPosition;
-        class DoubleSpinBox;
-        class DataPlot1D;
-    }
-    namespace filter
-    {
-        class NestedSat;
-    }
+namespace flair {
+namespace core {
+class cvmatrix;
+class io_data;
+}
+namespace gui {
+class Layout;
+class LayoutPosition;
+class DoubleSpinBox;
+class DataPlot1D;
+}
+namespace filter {
+class NestedSat;
+}
 }
 
@@ -39,22 +35,21 @@
 * \brief Classe permettant le calcul d'un Pid avec saturations
 */
-class NestedSat_impl
-{
-    public:
-        NestedSat_impl(flair::filter::NestedSat* self,const flair::gui::LayoutPosition* position,std::string name);
-        ~NestedSat_impl();
-        float Value(void);
-        void UseDefaultPlot(const flair::gui::Layout* layout,int row,int col);
-        void UpdateFrom(const flair::core::io_data *data);
-        void ConvertSatFromDegToRad(void);
-        float k;
+class NestedSat_impl {
+public:
+  NestedSat_impl(flair::filter::NestedSat *self,
+                 const flair::gui::LayoutPosition *position, std::string name);
+  ~NestedSat_impl();
+  float Value(void);
+  void UseDefaultPlot(const flair::gui::Layout *layout, int row, int col);
+  void UpdateFrom(const flair::core::io_data *data);
+  void ConvertSatFromDegToRad(void);
+  float k;
 
-    private:
-        flair::filter::NestedSat* self;
-        flair::gui::DoubleSpinBox *kp,*kd,*sat,*dsat,*usat;
-        flair::gui::DataPlot1D *plot;
-        float Sat(float value,float borne);
+private:
+  flair::filter::NestedSat *self;
+  flair::gui::DoubleSpinBox *kp, *kd, *sat, *dsat, *usat;
+  flair::gui::DataPlot1D *plot;
+  float Sat(float value, float borne);
 };
 
-
 #endif // NESTEDSAT_IMPL_H
Index: trunk/lib/FlairFilter/src/unexported/PidThrust_impl.h
===================================================================
--- trunk/lib/FlairFilter/src/unexported/PidThrust_impl.h	(revision 14)
+++ trunk/lib/FlairFilter/src/unexported/PidThrust_impl.h	(revision 15)
@@ -16,20 +16,16 @@
 #include <Object.h>
 
-namespace flair
-{
-    namespace core
-    {
-        class cvmatrix;
-        class io_data;
-    }
-    namespace gui
-    {
-        class LayoutPosition;
-        class DoubleSpinBox;
-    }
-    namespace filter
-    {
-        class PidThrust;
-    }
+namespace flair {
+namespace core {
+class cvmatrix;
+class io_data;
+}
+namespace gui {
+class LayoutPosition;
+class DoubleSpinBox;
+}
+namespace filter {
+class PidThrust;
+}
 }
 
@@ -38,23 +34,23 @@
 */
 
-class PidThrust_impl
-{
-    public:
-        PidThrust_impl(flair::filter::PidThrust* self,const flair::gui::LayoutPosition* position,std::string name);
-        ~PidThrust_impl();
-        void UseDefaultPlot(const flair::gui::LayoutPosition* position);
-        void UpdateFrom(const flair::core::io_data *data);
-        float i,offset_g;
-        flair::gui::DoubleSpinBox *offset,*pas_offset;
+class PidThrust_impl {
+public:
+  PidThrust_impl(flair::filter::PidThrust *self,
+                 const flair::gui::LayoutPosition *position, std::string name);
+  ~PidThrust_impl();
+  void UseDefaultPlot(const flair::gui::LayoutPosition *position);
+  void UpdateFrom(const flair::core::io_data *data);
+  float i, offset_g;
+  flair::gui::DoubleSpinBox *offset, *pas_offset;
 
-    private:
-        flair::filter::PidThrust* self;
-        flair::core::Time previous_time;
-        bool first_update;
+private:
+  flair::filter::PidThrust *self;
+  flair::core::Time previous_time;
+  bool first_update;
 
-        //matrix
-        flair::core::cvmatrix *state;
+  // matrix
+  flair::core::cvmatrix *state;
 
-        flair::gui::DoubleSpinBox *T,*kp,*ki,*kd,*sat,*sati;
+  flair::gui::DoubleSpinBox *T, *kp, *ki, *kd, *sat, *sati;
 };
 
Index: trunk/lib/FlairFilter/src/unexported/Pid_impl.h
===================================================================
--- trunk/lib/FlairFilter/src/unexported/Pid_impl.h	(revision 14)
+++ trunk/lib/FlairFilter/src/unexported/Pid_impl.h	(revision 15)
@@ -16,20 +16,16 @@
 #include <Object.h>
 
-namespace flair
-{
-    namespace core
-    {
-        class cvmatrix;
-        class io_data;
-    }
-    namespace gui
-    {
-        class LayoutPosition;
-        class DoubleSpinBox;
-    }
-    namespace filter
-    {
-        class Pid;
-    }
+namespace flair {
+namespace core {
+class cvmatrix;
+class io_data;
+}
+namespace gui {
+class LayoutPosition;
+class DoubleSpinBox;
+}
+namespace filter {
+class Pid;
+}
 }
 
@@ -38,22 +34,22 @@
 */
 
-class Pid_impl
-{
-    public:
-        Pid_impl(flair::filter::Pid* self,const flair::gui::LayoutPosition* position,std::string name);
-        ~Pid_impl();
-        void UseDefaultPlot(const flair::gui::LayoutPosition* position);
-        void UpdateFrom(const flair::core::io_data *data);
-        float i;
-        bool first_update;
+class Pid_impl {
+public:
+  Pid_impl(flair::filter::Pid *self, const flair::gui::LayoutPosition *position,
+           std::string name);
+  ~Pid_impl();
+  void UseDefaultPlot(const flair::gui::LayoutPosition *position);
+  void UpdateFrom(const flair::core::io_data *data);
+  float i;
+  bool first_update;
 
-    private:
-        flair::filter::Pid* self;
-        flair::core::Time previous_time;
+private:
+  flair::filter::Pid *self;
+  flair::core::Time previous_time;
 
-        //matrix
-        flair::core::cvmatrix *state;
+  // matrix
+  flair::core::cvmatrix *state;
 
-        flair::gui::DoubleSpinBox *T,*kp,*ki,*kd,*sat,*sati;
+  flair::gui::DoubleSpinBox *T, *kp, *ki, *kd, *sat, *sati;
 };
 
Index: trunk/lib/FlairFilter/src/unexported/TrajectoryGenerator1D_impl.h
===================================================================
--- trunk/lib/FlairFilter/src/unexported/TrajectoryGenerator1D_impl.h	(revision 14)
+++ trunk/lib/FlairFilter/src/unexported/TrajectoryGenerator1D_impl.h	(revision 15)
@@ -14,15 +14,12 @@
 #define TRAJECTORYGENERATOR1D_IMPL_H
 
-namespace flair
-{
-    namespace core
-    {
-        class cvmatrix;
-    }
-    namespace gui
-    {
-        class LayoutPosition;
-        class DoubleSpinBox;
-    }
+namespace flair {
+namespace core {
+class cvmatrix;
+}
+namespace gui {
+class LayoutPosition;
+class DoubleSpinBox;
+}
 }
 
@@ -30,24 +27,25 @@
 * \brief Class generating a trajectory in 1D
 */
-class TrajectoryGenerator1D_impl
-{
+class TrajectoryGenerator1D_impl {
 
-    public:
-        TrajectoryGenerator1D_impl(flair::filter::TrajectoryGenerator1D* self,const flair::gui::LayoutPosition* position,std::string name,std::string unit);
-        ~TrajectoryGenerator1D_impl();
-        void Update(flair::core::Time time);
-        void StartTraj(float start_pos,float end_pos);
-        void StopTraj(void);
-        void Reset(void);
-        flair::core::cvmatrix *output;
-        float pos_off,vel_off;
-        bool is_finished,is_started;
+public:
+  TrajectoryGenerator1D_impl(flair::filter::TrajectoryGenerator1D *self,
+                             const flair::gui::LayoutPosition *position,
+                             std::string name, std::string unit);
+  ~TrajectoryGenerator1D_impl();
+  void Update(flair::core::Time time);
+  void StartTraj(float start_pos, float end_pos);
+  void StopTraj(void);
+  void Reset(void);
+  flair::core::cvmatrix *output;
+  float pos_off, vel_off;
+  bool is_finished, is_started;
 
-    private:
-        float end_position;
-        float pos,v,acc;
-        flair::core::Time previous_time;
-        bool first_update;
-        flair::gui::DoubleSpinBox *T,*max_veloctity,*acceleration;
+private:
+  float end_position;
+  float pos, v, acc;
+  flair::core::Time previous_time;
+  bool first_update;
+  flair::gui::DoubleSpinBox *T, *max_veloctity, *acceleration;
 };
 
Index: trunk/lib/FlairFilter/src/unexported/TrajectoryGenerator2DCircle_impl.h
===================================================================
--- trunk/lib/FlairFilter/src/unexported/TrajectoryGenerator2DCircle_impl.h	(revision 14)
+++ trunk/lib/FlairFilter/src/unexported/TrajectoryGenerator2DCircle_impl.h	(revision 15)
@@ -17,22 +17,17 @@
 #include <Vector2D.h>
 
-namespace flair
-{
-    namespace core
-    {
-        class cvmatrix;
-        class io_data;
-    }
-    namespace gui
-    {
-        class LayoutPosition;
-        class DoubleSpinBox;
-    }
-    namespace filter
-    {
-        class TrajectoryGenerator2DCircle;
-    }
+namespace flair {
+namespace core {
+class cvmatrix;
+class io_data;
 }
-
+namespace gui {
+class LayoutPosition;
+class DoubleSpinBox;
+}
+namespace filter {
+class TrajectoryGenerator2DCircle;
+}
+}
 
 /*! \class TrajectoryGenerator2DCircle_impl
@@ -40,25 +35,26 @@
 */
 
-class TrajectoryGenerator2DCircle_impl
-{
+class TrajectoryGenerator2DCircle_impl {
 
-    public:
-        TrajectoryGenerator2DCircle_impl(flair::filter::TrajectoryGenerator2DCircle* self,const flair::gui::LayoutPosition* position,std::string name);
-        ~TrajectoryGenerator2DCircle_impl();
-        void Update(flair::core::Time time);
-        void StartTraj(const flair::core::Vector2D &start_pos,float nb_lap);
-        void FinishTraj(void);
-        bool is_running;
-        flair::core::cvmatrix *output;
-        flair::core::Vector2D pos_off,vel_off;
+public:
+  TrajectoryGenerator2DCircle_impl(
+      flair::filter::TrajectoryGenerator2DCircle *self,
+      const flair::gui::LayoutPosition *position, std::string name);
+  ~TrajectoryGenerator2DCircle_impl();
+  void Update(flair::core::Time time);
+  void StartTraj(const flair::core::Vector2D &start_pos, float nb_lap);
+  void FinishTraj(void);
+  bool is_running;
+  flair::core::cvmatrix *output;
+  flair::core::Vector2D pos_off, vel_off;
 
-    private:
-        flair::core::Time previous_time;
-        float CurrentTime,FinishTime;
-        bool first_update,is_finishing;
-        flair::core::Vector2D pos;
-        float angle_off;
-        flair::gui::DoubleSpinBox *T,*veloctity,*acceleration,*rayon;
-        float nb_lap;
+private:
+  flair::core::Time previous_time;
+  float CurrentTime, FinishTime;
+  bool first_update, is_finishing;
+  flair::core::Vector2D pos;
+  float angle_off;
+  flair::gui::DoubleSpinBox *T, *veloctity, *acceleration, *rayon;
+  float nb_lap;
 };
 
Index: trunk/lib/FlairFilter/src/unexported/UavMultiplex_impl.h
===================================================================
--- trunk/lib/FlairFilter/src/unexported/UavMultiplex_impl.h	(revision 14)
+++ trunk/lib/FlairFilter/src/unexported/UavMultiplex_impl.h	(revision 15)
@@ -17,25 +17,20 @@
 #include <string>
 
-namespace flair
-{
-    namespace core
-    {
-        class FrameworkManager;
-        class cvmatrix;
-        class io_data;
-    }
-    namespace gui
-    {
-        class Tab;
-        class ComboBox;
-        class GroupBox;
-        class TabWidget;
-    }
-    namespace filter
-    {
-        class UavMultiplex;
-    }
+namespace flair {
+namespace core {
+class FrameworkManager;
+class cvmatrix;
+class io_data;
 }
-
+namespace gui {
+class Tab;
+class ComboBox;
+class GroupBox;
+class TabWidget;
+}
+namespace filter {
+class UavMultiplex;
+}
+}
 
 /*! \class UavMultiplex_impl
@@ -43,36 +38,35 @@
 * \brief Class defining uav multiplexing
 */
-class UavMultiplex_impl
-{
-    public:
+class UavMultiplex_impl {
+public:
+  /*!
+  * \brief Constructor
+  *
+  * Construct a uav multiplexing
+  *
+  * \param parent parent
+  * \param name name
+  */
+  UavMultiplex_impl(const flair::core::FrameworkManager *parent,
+                    flair::filter::UavMultiplex *self, std::string name);
 
-        /*!
-        * \brief Constructor
-        *
-        * Construct a uav multiplexing
-        *
-        * \param parent parent
-        * \param name name
-        */
-        UavMultiplex_impl(const flair::core::FrameworkManager* parent,flair::filter::UavMultiplex* self,std::string name);
+  /*!
+  * \brief Destructor
+  *
+  */
+  ~UavMultiplex_impl();
 
-        /*!
-        * \brief Destructor
-        *
-        */
-        ~UavMultiplex_impl();
+  flair::core::cvmatrix *input;
+  void SetMultiplexComboBox(std::string name, int index);
+  int MultiplexValue(int index) const;
 
-        flair::core::cvmatrix *input;
-        void SetMultiplexComboBox(std::string name,int index);
-        int MultiplexValue(int index) const;
+  flair::gui::TabWidget *tabwidget;
+  flair::gui::Tab *setup_tab;
 
-        flair::gui::TabWidget* tabwidget;
-        flair::gui::Tab *setup_tab;
-
-    private:
-        flair::gui::Tab *main_tab;
-        flair::gui::ComboBox **multiplexcombobox;
-        flair::gui::GroupBox *groupbox;
-        flair::filter::UavMultiplex* self;
+private:
+  flair::gui::Tab *main_tab;
+  flair::gui::ComboBox **multiplexcombobox;
+  flair::gui::GroupBox *groupbox;
+  flair::filter::UavMultiplex *self;
 };
 
Index: trunk/lib/FlairFilter/src/unexported/X4X8Multiplex_impl.h
===================================================================
--- trunk/lib/FlairFilter/src/unexported/X4X8Multiplex_impl.h	(revision 14)
+++ trunk/lib/FlairFilter/src/unexported/X4X8Multiplex_impl.h	(revision 15)
@@ -16,22 +16,17 @@
 #include <string>
 
-namespace flair
-{
-    namespace core
-    {
-        class cvmatrix;
-        class io_data;
-    }
-    namespace gui
-    {
-        class DataPlot1D;
-        class ComboBox;
-    }
-    namespace filter
-    {
-        class X4X8Multiplex;
-    }
+namespace flair {
+namespace core {
+class cvmatrix;
+class io_data;
 }
-
+namespace gui {
+class DataPlot1D;
+class ComboBox;
+}
+namespace filter {
+class X4X8Multiplex;
+}
+}
 
 /*! \class X4X8Multiplex_impl
@@ -39,20 +34,19 @@
 * \brief Class defining X4 and X8 multiplexing
 */
-class X4X8Multiplex_impl
-{
-    public:
-        X4X8Multiplex_impl(flair::filter::X4X8Multiplex* self,int nb_mot);
-        ~X4X8Multiplex_impl();
-        void UseDefaultPlot(void);
-        void UpdateFrom(const flair::core::io_data *data);
-        int nb_mot;
-        std::string MotorName(int index);
+class X4X8Multiplex_impl {
+public:
+  X4X8Multiplex_impl(flair::filter::X4X8Multiplex *self, int nb_mot);
+  ~X4X8Multiplex_impl();
+  void UseDefaultPlot(void);
+  void UpdateFrom(const flair::core::io_data *data);
+  int nb_mot;
+  std::string MotorName(int index);
 
-    private:
-        flair::core::cvmatrix *output;
-        flair::gui::ComboBox *pas;
-        flair::gui::DataPlot1D *plots[4];
-        flair::filter::X4X8Multiplex* self;
-        float Set(float trim,float u);
+private:
+  flair::core::cvmatrix *output;
+  flair::gui::ComboBox *pas;
+  flair::gui::DataPlot1D *plots[4];
+  flair::filter::X4X8Multiplex *self;
+  float Set(float trim, float u);
 };
 
Index: trunk/lib/FlairMeta/src/HdsX8.cpp
===================================================================
--- trunk/lib/FlairMeta/src/HdsX8.cpp	(revision 14)
+++ trunk/lib/FlairMeta/src/HdsX8.cpp	(revision 15)
@@ -32,38 +32,44 @@
 using namespace flair::actuator;
 
-namespace flair { namespace meta {
+namespace flair {
+namespace meta {
 
-HdsX8::HdsX8(FrameworkManager* parent,string uav_name,filter::UavMultiplex *multiplex) : Uav(parent,uav_name,multiplex) {
-    RTDM_I2cPort* i2cport=new RTDM_I2cPort(parent,"rtdm_i2c","rti2c3");
-    RTDM_SerialPort* imu_port=new RTDM_SerialPort(parent,"imu_port","rtser1");
+HdsX8::HdsX8(FrameworkManager *parent, string uav_name,
+             filter::UavMultiplex *multiplex)
+    : Uav(parent, uav_name, multiplex) {
+  RTDM_I2cPort *i2cport = new RTDM_I2cPort(parent, "rtdm_i2c", "rti2c3");
+  RTDM_SerialPort *imu_port = new RTDM_SerialPort(parent, "imu_port", "rtser1");
 
-    if(multiplex==NULL) SetMultiplex(new X4X8Multiplex(parent,"motors",X4X8Multiplex::X8));
+  if (multiplex == NULL)
+    SetMultiplex(new X4X8Multiplex(parent, "motors", X4X8Multiplex::X8));
 
-    SetBldc(new BlCtrlV2(GetUavMultiplex(),GetUavMultiplex()->GetLayout(),"motors",GetUavMultiplex()->MotorsCount(),i2cport));
-    SetUsRangeFinder(new Srf08(parent,"SRF08",i2cport,0x70,60));
-    SetAhrs(new Gx3_25_ahrs(parent,"imu",imu_port,Gx3_25_imu::EulerAnglesAndAngularRates,70));
-    SetBatteryMonitor(((BlCtrlV2*)GetBldc())->GetBatteryMonitor());
+  SetBldc(new BlCtrlV2(GetUavMultiplex(), GetUavMultiplex()->GetLayout(),
+                       "motors", GetUavMultiplex()->MotorsCount(), i2cport));
+  SetUsRangeFinder(new Srf08(parent, "SRF08", i2cport, 0x70, 60));
+  SetAhrs(new Gx3_25_ahrs(parent, "imu", imu_port,
+                          Gx3_25_imu::EulerAnglesAndAngularRates, 70));
+  SetBatteryMonitor(((BlCtrlV2 *)GetBldc())->GetBatteryMonitor());
 
-/*
-        if(VRPNType==Auto || VRPNType==AutoSerialPort)
-        {
-            RTDM_SerialPort* vrpn_port=new RTDM_SerialPort(parent,"vrpn_port","rtser3");
+  /*
+          if(VRPNType==Auto || VRPNType==AutoSerialPort)
+          {
+              RTDM_SerialPort* vrpn_port=new
+     RTDM_SerialPort(parent,"vrpn_port","rtser3");
 
-            vrpnclient=new VrpnClient(parent,"vrpn",vrpn_port,10000,80);
-            uav_vrpn=new MetaVrpnObject(vrpnclient,uav_name,VRPNSerialObjectId);
-        }
-*/
-    SetVerticalCamera(new Ps3Eye(parent,"camv",0,50));
+              vrpnclient=new VrpnClient(parent,"vrpn",vrpn_port,10000,80);
+              uav_vrpn=new
+     MetaVrpnObject(vrpnclient,uav_name,VRPNSerialObjectId);
+          }
+  */
+  SetVerticalCamera(new Ps3Eye(parent, "camv", 0, 50));
 }
 
-HdsX8::~HdsX8() {
-
-}
+HdsX8::~HdsX8() {}
 
 void HdsX8::StartSensors(void) {
-    ((Gx3_25_ahrs*)GetAhrs())->Start();
-    ((Srf08*)GetUsRangeFinder())->Start();
-    ((Ps3Eye *)GetVerticalCamera())->Start();
-    Uav::StartSensors();
+  ((Gx3_25_ahrs *)GetAhrs())->Start();
+  ((Srf08 *)GetUsRangeFinder())->Start();
+  ((Ps3Eye *)GetVerticalCamera())->Start();
+  Uav::StartSensors();
 }
 
Index: trunk/lib/FlairMeta/src/HdsX8.h
===================================================================
--- trunk/lib/FlairMeta/src/HdsX8.h	(revision 14)
+++ trunk/lib/FlairMeta/src/HdsX8.h	(revision 15)
@@ -16,21 +16,19 @@
 #include "Uav.h"
 
-namespace flair
-{
-namespace meta
-{
-    /*! \class HdsX8
-    *
-    * \brief Class defining an ardrone2 uav
-    */
-    class HdsX8 : public Uav {
-        public:
-            HdsX8(core::FrameworkManager* parent,std::string uav_name,filter::UavMultiplex *multiplex=NULL);
-            ~HdsX8();
-            void StartSensors(void);
+namespace flair {
+namespace meta {
+/*! \class HdsX8
+*
+* \brief Class defining an ardrone2 uav
+*/
+class HdsX8 : public Uav {
+public:
+  HdsX8(core::FrameworkManager *parent, std::string uav_name,
+        filter::UavMultiplex *multiplex = NULL);
+  ~HdsX8();
+  void StartSensors(void);
 
-        private:
-
-    };
+private:
+};
 } // end namespace meta
 } // end namespace flair
Index: trunk/lib/FlairMeta/src/MetaDualShock3.cpp
===================================================================
--- trunk/lib/FlairMeta/src/MetaDualShock3.cpp	(revision 14)
+++ trunk/lib/FlairMeta/src/MetaDualShock3.cpp	(revision 15)
@@ -31,67 +31,65 @@
 using namespace flair::gui;
 
-namespace flair { namespace meta {
+namespace flair {
+namespace meta {
 
-MetaDualShock3::MetaDualShock3(FrameworkManager* parent,string name,uint16_t port,uint8_t priority) : TargetEthController(parent,name,port,priority) {
-    pimpl_=new MetaDualShock3_impl(this,name);
-    parent->AddDeviceToLog(pimpl_->joy_ref);
-    Start();
+MetaDualShock3::MetaDualShock3(FrameworkManager *parent, string name,
+                               uint16_t port, uint8_t priority)
+    : TargetEthController(parent, name, port, priority) {
+  pimpl_ = new MetaDualShock3_impl(this, name);
+  parent->AddDeviceToLog(pimpl_->joy_ref);
+  Start();
 }
 
-MetaDualShock3::~MetaDualShock3() {
-    delete pimpl_;
-}
+MetaDualShock3::~MetaDualShock3() { delete pimpl_; }
 
-AhrsData* MetaDualShock3::GetReferenceOrientation(void) const {
-    return pimpl_->joy_ref->GetReferenceOrientation();
+AhrsData *MetaDualShock3::GetReferenceOrientation(void) const {
+  return pimpl_->joy_ref->GetReferenceOrientation();
 }
 
 void MetaDualShock3::ErrorNotify(void) {
-    TargetEthController::FlashLed(4,10,0);
-    TargetEthController::Rumble(0xff,20,0,0);
+  TargetEthController::FlashLed(4, 10, 0);
+  TargetEthController::Rumble(0xff, 20, 0, 0);
 }
 
-void MetaDualShock3::Rumble(uint8_t left_force,uint8_t left_timeout,uint8_t right_force,uint8_t right_timeout) {
-    TargetEthController::Rumble(left_force,left_timeout,right_force,right_timeout);
+void MetaDualShock3::Rumble(uint8_t left_force, uint8_t left_timeout,
+                            uint8_t right_force, uint8_t right_timeout) {
+  TargetEthController::Rumble(left_force, left_timeout, right_force,
+                              right_timeout);
 }
 
 void MetaDualShock3::SetLedON(unsigned int ledId) {
-    TargetEthController::SetLedOn(ledId);
+  TargetEthController::SetLedOn(ledId);
 }
 
 void MetaDualShock3::SetLedOFF(unsigned int ledId) {
-    TargetEthController::SetLedOff(ledId);
+  TargetEthController::SetLedOff(ledId);
 }
 
-void MetaDualShock3::FlashLed(unsigned int ledId,uint8_t on_timeout,uint8_t off_timeout) {
-    TargetEthController::FlashLed(ledId,on_timeout,off_timeout);
+void MetaDualShock3::FlashLed(unsigned int ledId, uint8_t on_timeout,
+                              uint8_t off_timeout) {
+  TargetEthController::FlashLed(ledId, on_timeout, off_timeout);
 }
 
-float MetaDualShock3::ZRef(void) const {
-    return pimpl_->joy_ref->ZRef();
-}
+float MetaDualShock3::ZRef(void) const { return pimpl_->joy_ref->ZRef(); }
 
-float MetaDualShock3::DzRef(void) const {
-    return pimpl_->joy_ref->DzRef();
-}
+float MetaDualShock3::DzRef(void) const { return pimpl_->joy_ref->DzRef(); }
 
 void MetaDualShock3::SetYawRef(float value) {
-    pimpl_->joy_ref->SetYawRef(value);
+  pimpl_->joy_ref->SetYawRef(value);
 }
 
 void MetaDualShock3::SetYawRef(Quaternion const &value) {
-    pimpl_->joy_ref->SetYawRef(value);
+  pimpl_->joy_ref->SetYawRef(value);
 }
 
-void MetaDualShock3::SetZRef(float value) {
-    pimpl_->joy_ref->SetZRef(value);
-}
+void MetaDualShock3::SetZRef(float value) { pimpl_->joy_ref->SetZRef(value); }
 
 float MetaDualShock3::RollTrim(void) const {
-    return pimpl_->joy_ref->RollTrim();
+  return pimpl_->joy_ref->RollTrim();
 }
 
 float MetaDualShock3::PitchTrim(void) const {
-    return pimpl_->joy_ref->PitchTrim();
+  return pimpl_->joy_ref->PitchTrim();
 }
 
Index: trunk/lib/FlairMeta/src/MetaDualShock3.h
===================================================================
--- trunk/lib/FlairMeta/src/MetaDualShock3.h	(revision 14)
+++ trunk/lib/FlairMeta/src/MetaDualShock3.h	(revision 15)
@@ -17,11 +17,11 @@
 
 namespace flair {
-    namespace core {
-        class AhrsData;
-        class Quaternion;
-    }
-    namespace filter {
-        class Ahrs;
-    }
+namespace core {
+class AhrsData;
+class Quaternion;
+}
+namespace filter {
+class Ahrs;
+}
 }
 
@@ -31,40 +31,42 @@
 namespace meta {
 
-    /*! \class MetaDualShock3
-    *
-    * \brief Classe intégrant la manette MetaDualShock3
-    */
-    class MetaDualShock3 : public sensor::TargetEthController {
-        friend class ::MetaDualShock3_impl;
+/*! \class MetaDualShock3
+*
+* \brief Classe intégrant la manette MetaDualShock3
+*/
+class MetaDualShock3 : public sensor::TargetEthController {
+  friend class ::MetaDualShock3_impl;
 
-        public:
-            MetaDualShock3(core::FrameworkManager* parent,std::string name,uint16_t port,uint8_t priority);
-            ~MetaDualShock3();
-            core::AhrsData* GetReferenceOrientation(void) const;
-            float ZRef(void) const;
-            float DzRef(void) const;
-            void SetYawRef(float value);
-            /*!
-            * \brief Set yaw reference
-            *
-            * Yaw part of the output quaternion is obtained by integrating the wz desired angular speed.\n
-            * This method reset the yaw.
-            *
-            * \param value value, only the yaw part of the quaternion is used
-            */
-            void SetYawRef(core::Quaternion const &value);
-            void SetZRef(float value);
-            float RollTrim(void) const;
-            float PitchTrim(void) const;
-            void ErrorNotify(void);
-            void Rumble(uint8_t left_force,uint8_t left_timeout=20,uint8_t right_force=0,uint8_t right_timeout=0);
-            void SetLedON(unsigned int ledId);
-            void SetLedOFF(unsigned int ledId);
-            void FlashLed(unsigned int ledId,uint8_t on_timeout,uint8_t off_timeout);
+public:
+  MetaDualShock3(core::FrameworkManager *parent, std::string name,
+                 uint16_t port, uint8_t priority);
+  ~MetaDualShock3();
+  core::AhrsData *GetReferenceOrientation(void) const;
+  float ZRef(void) const;
+  float DzRef(void) const;
+  void SetYawRef(float value);
+  /*!
+  * \brief Set yaw reference
+  *
+  * Yaw part of the output quaternion is obtained by integrating the wz desired
+  *angular speed.\n
+  * This method reset the yaw.
+  *
+  * \param value value, only the yaw part of the quaternion is used
+  */
+  void SetYawRef(core::Quaternion const &value);
+  void SetZRef(float value);
+  float RollTrim(void) const;
+  float PitchTrim(void) const;
+  void ErrorNotify(void);
+  void Rumble(uint8_t left_force, uint8_t left_timeout = 20,
+              uint8_t right_force = 0, uint8_t right_timeout = 0);
+  void SetLedON(unsigned int ledId);
+  void SetLedOFF(unsigned int ledId);
+  void FlashLed(unsigned int ledId, uint8_t on_timeout, uint8_t off_timeout);
 
-        private:
-            class MetaDualShock3_impl* pimpl_;
-
-    };
+private:
+  class MetaDualShock3_impl *pimpl_;
+};
 } // end namespace meta
 } // end namespace flair
Index: trunk/lib/FlairMeta/src/MetaDualShock3_impl.cpp
===================================================================
--- trunk/lib/FlairMeta/src/MetaDualShock3_impl.cpp	(revision 14)
+++ trunk/lib/FlairMeta/src/MetaDualShock3_impl.cpp	(revision 15)
@@ -29,85 +29,84 @@
 using namespace flair::meta;
 
-MetaDualShock3_impl::MetaDualShock3_impl(MetaDualShock3* self,string name): IODevice((IODevice*)self,name) {
-    joy_ref=new JoyReference(self->GetTab()->NewRow(),"consignes joy");
-    this->self=self;
-    joy_init=false;
-    wasRollTrimUpButtonPressed=false;
-    wasRollTrimDownButtonPressed=false;
-    wasPitchTrimUpButtonPressed=false;
-    wasPitchTrimDownButtonPressed=false;
+MetaDualShock3_impl::MetaDualShock3_impl(MetaDualShock3 *self, string name)
+    : IODevice((IODevice *)self, name) {
+  joy_ref = new JoyReference(self->GetTab()->NewRow(), "consignes joy");
+  this->self = self;
+  joy_init = false;
+  wasRollTrimUpButtonPressed = false;
+  wasRollTrimDownButtonPressed = false;
+  wasPitchTrimUpButtonPressed = false;
+  wasPitchTrimDownButtonPressed = false;
 }
 
-MetaDualShock3_impl::~MetaDualShock3_impl() {
+MetaDualShock3_impl::~MetaDualShock3_impl() {}
 
+// receives updates from the controler
+void MetaDualShock3_impl::UpdateFrom(const io_data *data) {
+  cvmatrix *input = (cvmatrix *)data;
+
+  // on prend une fois pour toute le mutex et on fait des accès directs
+  input->GetMutex();
+
+  // up
+  if (self->IsButtonPressed(12)) {
+    if (!wasPitchTrimDownButtonPressed) {
+      joy_ref->PitchTrimDown();
+      wasPitchTrimDownButtonPressed = true;
+    }
+  } else {
+    wasPitchTrimDownButtonPressed = false;
+  }
+
+  // down
+  if (self->IsButtonPressed(13)) {
+    if (!wasPitchTrimUpButtonPressed) {
+      joy_ref->PitchTrimUp();
+      wasPitchTrimUpButtonPressed = true;
+    }
+  } else {
+    wasPitchTrimUpButtonPressed = false;
+  }
+
+  // right
+  if (self->IsButtonPressed(15)) {
+    if (!wasRollTrimUpButtonPressed) {
+      joy_ref->RollTrimUp();
+      wasRollTrimUpButtonPressed = true;
+    }
+  } else {
+    wasRollTrimUpButtonPressed = false;
+  }
+
+  // left
+  if (self->IsButtonPressed(14)) {
+    if (!wasRollTrimDownButtonPressed) {
+      joy_ref->RollTrimDown();
+      wasRollTrimDownButtonPressed = true;
+    }
+  } else {
+    wasRollTrimDownButtonPressed = false;
+  }
+
+  if (!getFrameworkManager()->ConnectionLost()) {
+    input->GetMutex();
+    joy_ref->SetRollAxis(input->ValueNoMutex(0, 0));
+    joy_ref->SetPitchAxis(input->ValueNoMutex(1, 0));
+    joy_ref->SetYawAxis(input->ValueNoMutex(2, 0));
+    joy_ref->SetAltitudeAxis(input->ValueNoMutex(3, 0));
+    input->ReleaseMutex();
+  } else {
+    joy_ref->SetRollAxis(0);
+    joy_ref->SetPitchAxis(0);
+    joy_ref->SetYawAxis(0);
+    joy_ref->SetAltitudeAxis(0);
+  }
+  input->ReleaseMutex();
+
+  joy_ref->Update(data->DataTime());
+
+  if (!joy_init) {
+    self->TargetEthController::FlashLed(1, 10, 10);
+    joy_init = true;
+  }
 }
-
-//receives updates from the controler
-void MetaDualShock3_impl::UpdateFrom(const io_data *data) {
-    cvmatrix *input=(cvmatrix*)data;
-
-    //on prend une fois pour toute le mutex et on fait des accès directs
-    input->GetMutex();
-
-    //up
-    if(self->IsButtonPressed(12)) {
-        if(!wasPitchTrimDownButtonPressed) {
-            joy_ref->PitchTrimDown();
-            wasPitchTrimDownButtonPressed=true;
-        }
-    } else {
-        wasPitchTrimDownButtonPressed=false;
-    }
-
-    //down
-    if(self->IsButtonPressed(13)) {
-        if(!wasPitchTrimUpButtonPressed) {
-            joy_ref->PitchTrimUp();
-            wasPitchTrimUpButtonPressed=true;
-        }
-    } else {
-        wasPitchTrimUpButtonPressed=false;
-    }
-
-    //right
-    if(self->IsButtonPressed(15)) {
-        if(!wasRollTrimUpButtonPressed) {
-            joy_ref->RollTrimUp();
-            wasRollTrimUpButtonPressed=true;
-        }
-    } else {
-        wasRollTrimUpButtonPressed=false;
-    }
-
-    //left
-    if(self->IsButtonPressed(14)) {
-        if(!wasRollTrimDownButtonPressed) {
-            joy_ref->RollTrimDown();
-            wasRollTrimDownButtonPressed=true;
-        }
-    } else {
-        wasRollTrimDownButtonPressed=false;
-    }
-
-    if(!getFrameworkManager()->ConnectionLost()) {
-        input->GetMutex();
-        joy_ref->SetRollAxis(input->ValueNoMutex(0,0));
-        joy_ref->SetPitchAxis(input->ValueNoMutex(1,0));
-        joy_ref->SetYawAxis(input->ValueNoMutex(2,0));
-        joy_ref->SetAltitudeAxis(input->ValueNoMutex(3,0));
-        input->ReleaseMutex();
-    } else {
-        joy_ref->SetRollAxis(0);
-        joy_ref->SetPitchAxis(0);
-        joy_ref->SetYawAxis(0);
-        joy_ref->SetAltitudeAxis(0);
-    }
-    input->ReleaseMutex();
-
-    joy_ref->Update(data->DataTime());
-
-    if(!joy_init) {
-        self->TargetEthController::FlashLed(1,10,10);
-        joy_init=true;
-    }
-}
Index: trunk/lib/FlairMeta/src/MetaUsRangeFinder.cpp
===================================================================
--- trunk/lib/FlairMeta/src/MetaUsRangeFinder.cpp	(revision 14)
+++ trunk/lib/FlairMeta/src/MetaUsRangeFinder.cpp	(revision 15)
@@ -35,44 +35,36 @@
 using namespace flair::sensor;
 
-namespace flair { namespace meta
-{
+namespace flair {
+namespace meta {
 
-MetaUsRangeFinder::MetaUsRangeFinder(UsRangeFinder* us): Object(us,us->ObjectName()) {
-    this->us=us;
-    pbas_z=new ButterworthLowPass(us,us->GetLayout()->NewRow(),"Passe bas",3);
-    vz_euler=new EulerDerivative(pbas_z,us->GetLayout()->NewRow(),"Vz");
-    pbas_vz=new ButterworthLowPass(vz_euler,us->GetLayout()->NewRow(),"Passe bas v",3);
-
+MetaUsRangeFinder::MetaUsRangeFinder(UsRangeFinder *us)
+    : Object(us, us->ObjectName()) {
+  this->us = us;
+  pbas_z =
+      new ButterworthLowPass(us, us->GetLayout()->NewRow(), "Passe bas", 3);
+  vz_euler = new EulerDerivative(pbas_z, us->GetLayout()->NewRow(), "Vz");
+  pbas_vz = new ButterworthLowPass(vz_euler, us->GetLayout()->NewRow(),
+                                   "Passe bas v", 3);
 }
 
-MetaUsRangeFinder::~MetaUsRangeFinder() {
+MetaUsRangeFinder::~MetaUsRangeFinder() {}
 
+void MetaUsRangeFinder::UseDefaultPlot(void) {
+  us->UseDefaultPlot();
+
+  us->GetPlot()->AddCurve(pbas_z->Matrix()->Element(0), DataPlot::Blue);
+
+  vz_plot = new DataPlot1D(us->GetPlotTab()->LastRowLastCol(), "vz", -2, 2);
+  vz_plot->AddCurve(vz_euler->Matrix()->Element(0));
+  vz_plot->AddCurve(pbas_vz->Matrix()->Element(0), DataPlot::Blue);
 }
 
-void MetaUsRangeFinder::UseDefaultPlot(void) {
-    us->UseDefaultPlot();
+gui::DataPlot1D *MetaUsRangeFinder::GetZPlot() { return us->GetPlot(); }
 
-    us->GetPlot()->AddCurve(pbas_z->Matrix()->Element(0),DataPlot::Blue);
+gui::DataPlot1D *MetaUsRangeFinder::GetVzPlot() { return vz_plot; }
 
-    vz_plot=new DataPlot1D(us->GetPlotTab()->LastRowLastCol(),"vz",-2,2);
-    vz_plot->AddCurve(vz_euler->Matrix()->Element(0));
-    vz_plot->AddCurve(pbas_vz->Matrix()->Element(0),DataPlot::Blue);
-}
+float MetaUsRangeFinder::z(void) const { return pbas_z->Output(); }
 
-gui::DataPlot1D *MetaUsRangeFinder::GetZPlot() {
-    return us->GetPlot();
-}
-
-gui::DataPlot1D *MetaUsRangeFinder::GetVzPlot() {
-    return vz_plot;
-}
-
-float MetaUsRangeFinder::z(void) const {
-    return pbas_z->Output();
-}
-
-float MetaUsRangeFinder::Vz(void) const {
-    return pbas_vz->Output();
-}
+float MetaUsRangeFinder::Vz(void) const { return pbas_vz->Output(); }
 
 } // end namespace sensor
Index: trunk/lib/FlairMeta/src/MetaUsRangeFinder.h
===================================================================
--- trunk/lib/FlairMeta/src/MetaUsRangeFinder.h	(revision 14)
+++ trunk/lib/FlairMeta/src/MetaUsRangeFinder.h	(revision 15)
@@ -17,43 +17,41 @@
 
 namespace flair {
-    namespace filter {
-        class ButterworthLowPass;
-        class EulerDerivative;
-    }
-    namespace sensor {
-        class UsRangeFinder;
-    }
-    namespace gui {
-        class DataPlot1D;
-    }
+namespace filter {
+class ButterworthLowPass;
+class EulerDerivative;
+}
+namespace sensor {
+class UsRangeFinder;
+}
+namespace gui {
+class DataPlot1D;
+}
 }
 
-namespace flair
-{
-namespace meta
-{
-    /*! \class MetaUsRangeFinder
-    *
-    * \brief Classe haut niveau pour capteur à ultra son
-    *
-    * Contient une dérivée d'euler et un passe bas.
-    * Cette classe est adaptée pour un capteur d'altitude.
-    */
-    class MetaUsRangeFinder: public core::Object {
-        public:
-            MetaUsRangeFinder(sensor::UsRangeFinder* us);
-            ~MetaUsRangeFinder();
-            void UseDefaultPlot(void);
-            float z(void) const;
-            float Vz(void) const;
-            gui::DataPlot1D *GetZPlot();
-            gui::DataPlot1D *GetVzPlot();
+namespace flair {
+namespace meta {
+/*! \class MetaUsRangeFinder
+*
+* \brief Classe haut niveau pour capteur à ultra son
+*
+* Contient une dérivée d'euler et un passe bas.
+* Cette classe est adaptée pour un capteur d'altitude.
+*/
+class MetaUsRangeFinder : public core::Object {
+public:
+  MetaUsRangeFinder(sensor::UsRangeFinder *us);
+  ~MetaUsRangeFinder();
+  void UseDefaultPlot(void);
+  float z(void) const;
+  float Vz(void) const;
+  gui::DataPlot1D *GetZPlot();
+  gui::DataPlot1D *GetVzPlot();
 
-        private:
-            sensor::UsRangeFinder* us;
-            filter::ButterworthLowPass *pbas_z,*pbas_vz;
-            filter::EulerDerivative *vz_euler;
-            gui::DataPlot1D* vz_plot;
-    };
+private:
+  sensor::UsRangeFinder *us;
+  filter::ButterworthLowPass *pbas_z, *pbas_vz;
+  filter::EulerDerivative *vz_euler;
+  gui::DataPlot1D *vz_plot;
+};
 } // end namespace meta
 } // end namespace flair
Index: trunk/lib/FlairMeta/src/MetaVrpnObject.cpp
===================================================================
--- trunk/lib/FlairMeta/src/MetaVrpnObject.cpp	(revision 14)
+++ trunk/lib/FlairMeta/src/MetaVrpnObject.cpp	(revision 15)
@@ -36,79 +36,69 @@
 using namespace flair::filter;
 
-namespace flair { namespace meta {
+namespace flair {
+namespace meta {
 
-MetaVrpnObject::MetaVrpnObject(const VrpnClient *parent,string name): VrpnObject(parent,name,parent->GetTabWidget())
-{
-    ConstructorCommon(parent,name);
+MetaVrpnObject::MetaVrpnObject(const VrpnClient *parent, string name)
+    : VrpnObject(parent, name, parent->GetTabWidget()) {
+  ConstructorCommon(parent, name);
 }
 
-MetaVrpnObject::MetaVrpnObject(const VrpnClient *parent,std::string name,uint8_t id): VrpnObject(parent,name,id,parent->GetTabWidget())
-{
-    ConstructorCommon(parent,name);
+MetaVrpnObject::MetaVrpnObject(const VrpnClient *parent, std::string name,
+                               uint8_t id)
+    : VrpnObject(parent, name, id, parent->GetTabWidget()) {
+  ConstructorCommon(parent, name);
 }
 
-void MetaVrpnObject::ConstructorCommon(const VrpnClient *parent,string name) {
-    cvmatrix_descriptor* desc=new cvmatrix_descriptor(6,1);
-    for(int i=0;i<6;i++) {
-        desc->SetElementName(i,0,Output()->Name(i,0));
-    }
-    cvmatrix* prev_value=new cvmatrix(this,desc,elementDataType,name);
-    for(int i=0;i<6;i++) {
-        prev_value->SetValue(i,0,0);
-    }
+void MetaVrpnObject::ConstructorCommon(const VrpnClient *parent, string name) {
+  cvmatrix_descriptor *desc = new cvmatrix_descriptor(6, 1);
+  for (int i = 0; i < 6; i++) {
+    desc->SetElementName(i, 0, Output()->Name(i, 0));
+  }
+  cvmatrix *prev_value = new cvmatrix(this, desc, elementDataType, name);
+  for (int i = 0; i < 6; i++) {
+    prev_value->SetValue(i, 0, 0);
+  }
 
-    pbas=new LowPassFilter(this,parent->GetLayout()->NewRow(),name + " Passe bas",prev_value);
+  pbas = new LowPassFilter(this, parent->GetLayout()->NewRow(),
+                           name + " Passe bas", prev_value);
 
-    desc=new cvmatrix_descriptor(6,1);
-    for(int i=0;i<6;i++) {
-        desc->SetElementName(i,0,"d" + Output()->Name(i,0));
-    }
-    prev_value=new cvmatrix(this,desc,elementDataType,name);
-    for(int i=0;i<6;i++) {
-        prev_value->SetValue(i,0,0);
-    }
+  desc = new cvmatrix_descriptor(6, 1);
+  for (int i = 0; i < 6; i++) {
+    desc->SetElementName(i, 0, "d" + Output()->Name(i, 0));
+  }
+  prev_value = new cvmatrix(this, desc, elementDataType, name);
+  for (int i = 0; i < 6; i++) {
+    prev_value->SetValue(i, 0, 0);
+  }
 
-    euler=new EulerDerivative(pbas,parent->GetLayout()->NewRow(),name + "_euler",prev_value);
+  euler = new EulerDerivative(pbas, parent->GetLayout()->NewRow(),
+                              name + "_euler", prev_value);
 
-    vx_opti_plot=new DataPlot1D(GetPlotTab()->NewRow(),"vx",-3,3);
-    vx_opti_plot->AddCurve(euler->Matrix()->Element(3));
-    vy_opti_plot=new DataPlot1D(GetPlotTab()->LastRowLastCol(),"vy",-3,3);
-    vy_opti_plot->AddCurve(euler->Matrix()->Element(4));
-    vz_opti_plot=new DataPlot1D(GetPlotTab()->LastRowLastCol(),"vz",-2,2);
-    vz_opti_plot->AddCurve(euler->Matrix()->Element(5));
+  vx_opti_plot = new DataPlot1D(GetPlotTab()->NewRow(), "vx", -3, 3);
+  vx_opti_plot->AddCurve(euler->Matrix()->Element(3));
+  vy_opti_plot = new DataPlot1D(GetPlotTab()->LastRowLastCol(), "vy", -3, 3);
+  vy_opti_plot->AddCurve(euler->Matrix()->Element(4));
+  vz_opti_plot = new DataPlot1D(GetPlotTab()->LastRowLastCol(), "vz", -2, 2);
+  vz_opti_plot->AddCurve(euler->Matrix()->Element(5));
 
-    plot_tab=new Tab(parent->GetTabWidget(),"Mesures (xy) "+ name);
-    xy_plot=new DataPlot2D(plot_tab->NewRow(),"xy","y",-5,5,"x",-5,5);
-        xy_plot->AddCurve(Output()->Element(4,0),Output()->Element(3,0));
+  plot_tab = new Tab(parent->GetTabWidget(), "Mesures (xy) " + name);
+  xy_plot = new DataPlot2D(plot_tab->NewRow(), "xy", "y", -5, 5, "x", -5, 5);
+  xy_plot->AddCurve(Output()->Element(4, 0), Output()->Element(3, 0));
 }
 
-MetaVrpnObject::~MetaVrpnObject() {
-    delete plot_tab;
-}
+MetaVrpnObject::~MetaVrpnObject() { delete plot_tab; }
 
-DataPlot1D* MetaVrpnObject::VxPlot(void) const
-{
-    return vx_opti_plot;
-}
+DataPlot1D *MetaVrpnObject::VxPlot(void) const { return vx_opti_plot; }
 
-DataPlot1D* MetaVrpnObject::VyPlot(void) const
-{
-    return vy_opti_plot;
-}
+DataPlot1D *MetaVrpnObject::VyPlot(void) const { return vy_opti_plot; }
 
-DataPlot1D* MetaVrpnObject::VzPlot(void) const
-{
-    return vz_opti_plot;
-}
+DataPlot1D *MetaVrpnObject::VzPlot(void) const { return vz_opti_plot; }
 
-DataPlot2D* MetaVrpnObject::XyPlot(void) const {
-    return xy_plot;
-}
+DataPlot2D *MetaVrpnObject::XyPlot(void) const { return xy_plot; }
 
-void MetaVrpnObject::GetSpeed(Vector3D &speed) const
-{
-    speed.x=euler->Output(3,0);
-    speed.y=euler->Output(4,0);
-    speed.z=euler->Output(5,0);
+void MetaVrpnObject::GetSpeed(Vector3D &speed) const {
+  speed.x = euler->Output(3, 0);
+  speed.y = euler->Output(4, 0);
+  speed.z = euler->Output(5, 0);
 }
 
Index: trunk/lib/FlairMeta/src/MetaVrpnObject.h
===================================================================
--- trunk/lib/FlairMeta/src/MetaVrpnObject.h	(revision 14)
+++ trunk/lib/FlairMeta/src/MetaVrpnObject.h	(revision 15)
@@ -17,60 +17,53 @@
 #include "io_data.h"
 
-namespace flair
-{
-    namespace core
-    {
-        class Vector3D;
-        class FloatType;
-    }
-    namespace gui
-    {
-        class DataPlot1D;
-        class DataPlot2D;
-        class Tab;
-    }
-    namespace filter
-    {
-        class EulerDerivative;
-        class LowPassFilter;
-    }
-    namespace sensor
-    {
-        class VrpnClient;
-    }
+namespace flair {
+namespace core {
+class Vector3D;
+class FloatType;
+}
+namespace gui {
+class DataPlot1D;
+class DataPlot2D;
+class Tab;
+}
+namespace filter {
+class EulerDerivative;
+class LowPassFilter;
+}
+namespace sensor {
+class VrpnClient;
+}
 }
 
-namespace flair
-{
-namespace meta
-{
+namespace flair {
+namespace meta {
 
-    /*! \class MetaVrpnObject
-    *
-    * \brief Classe haut niveau intégrant un objet VRPN
-    *
-    * Contient un objet VRPN et une dérivée, d'euler.
-    */
-    class MetaVrpnObject: public sensor::VrpnObject {
-        public:
-            MetaVrpnObject(const sensor::VrpnClient *parent,std::string name);
-            MetaVrpnObject(const sensor::VrpnClient *parent,std::string name,uint8_t id);
-            ~MetaVrpnObject();
-            gui::DataPlot1D* VxPlot(void) const;//1,0
-            gui::DataPlot1D* VyPlot(void) const;//1,1
-            gui::DataPlot1D* VzPlot(void) const;//1,2
-            gui::DataPlot2D* XyPlot(void) const;
-            void GetSpeed(core::Vector3D &speed) const;
+/*! \class MetaVrpnObject
+*
+* \brief Classe haut niveau intégrant un objet VRPN
+*
+* Contient un objet VRPN et une dérivée, d'euler.
+*/
+class MetaVrpnObject : public sensor::VrpnObject {
+public:
+  MetaVrpnObject(const sensor::VrpnClient *parent, std::string name);
+  MetaVrpnObject(const sensor::VrpnClient *parent, std::string name,
+                 uint8_t id);
+  ~MetaVrpnObject();
+  gui::DataPlot1D *VxPlot(void) const; // 1,0
+  gui::DataPlot1D *VyPlot(void) const; // 1,1
+  gui::DataPlot1D *VzPlot(void) const; // 1,2
+  gui::DataPlot2D *XyPlot(void) const;
+  void GetSpeed(core::Vector3D &speed) const;
 
-        private:
-            void ConstructorCommon(const sensor::VrpnClient *parent,std::string name);
-            filter::LowPassFilter *pbas;
-            filter::EulerDerivative *euler;
-            gui::DataPlot2D *xy_plot;
-            gui::DataPlot1D *vx_opti_plot,*vy_opti_plot,*vz_opti_plot;
-            gui::Tab* plot_tab;
-            core::FloatType elementDataType;
-
-    };
+private:
+  void ConstructorCommon(const sensor::VrpnClient *parent, std::string name);
+  filter::LowPassFilter *pbas;
+  filter::EulerDerivative *euler;
+  gui::DataPlot2D *xy_plot;
+  gui::DataPlot1D *vx_opti_plot, *vy_opti_plot, *vz_opti_plot;
+  gui::Tab *plot_tab;
+  core::FloatType elementDataType;
+};
 } // end namespace meta
 } // end namespace flair
Index: trunk/lib/FlairMeta/src/SimuX4.cpp
===================================================================
--- trunk/lib/FlairMeta/src/SimuX4.cpp	(revision 14)
+++ trunk/lib/FlairMeta/src/SimuX4.cpp	(revision 15)
@@ -34,33 +34,35 @@
 using namespace flair::actuator;
 
-namespace flair { namespace meta {
+namespace flair {
+namespace meta {
 
-SimuX4::SimuX4(FrameworkManager* parent,string uav_name,int simu_id,filter::UavMultiplex *multiplex) : Uav(parent,uav_name,multiplex) {
+SimuX4::SimuX4(FrameworkManager *parent, string uav_name, int simu_id,
+               filter::UavMultiplex *multiplex)
+    : Uav(parent, uav_name, multiplex) {
 
-    if(multiplex==NULL) SetMultiplex(new X4X8Multiplex(parent,"motors",X4X8Multiplex::X4));
+  if (multiplex == NULL)
+    SetMultiplex(new X4X8Multiplex(parent, "motors", X4X8Multiplex::X4));
 
-    SetBldc(new SimuBldc(GetUavMultiplex(),GetUavMultiplex()->GetLayout(),"motors",GetUavMultiplex()->MotorsCount(),simu_id));
-    SetUsRangeFinder(new SimuUs(parent,"us",simu_id,60));
-    SetAhrs(new SimuAhrs(parent,"imu",simu_id,70));
-    Tab* bat_tab=new Tab(parent->GetTabWidget(),"battery");
-    SetBatteryMonitor(new BatteryMonitor(bat_tab->NewRow(),"battery"));
-    GetBatteryMonitor()->SetBatteryValue(12);
-    SetVerticalCamera(new SimuCamera(parent, "simu_cam_v", 320, 240, 3, simu_id, 10));
+  SetBldc(new SimuBldc(GetUavMultiplex(), GetUavMultiplex()->GetLayout(),
+                       "motors", GetUavMultiplex()->MotorsCount(), simu_id));
+  SetUsRangeFinder(new SimuUs(parent, "us", simu_id, 60));
+  SetAhrs(new SimuAhrs(parent, "imu", simu_id, 70));
+  Tab *bat_tab = new Tab(parent->GetTabWidget(), "battery");
+  SetBatteryMonitor(new BatteryMonitor(bat_tab->NewRow(), "battery"));
+  GetBatteryMonitor()->SetBatteryValue(12);
+  SetVerticalCamera(
+      new SimuCamera(parent, "simu_cam_v", 320, 240, 3, simu_id, 10));
 }
 
-SimuX4::~SimuX4() {
+SimuX4::~SimuX4() {}
 
+void SimuX4::StartSensors(void) {
+  ((SimuAhrs *)GetAhrs())->Start();
+  ((SimuUs *)GetUsRangeFinder())->Start();
+  ((SimuCamera *)GetVerticalCamera())->Start();
+  Uav::StartSensors();
 }
 
-void SimuX4::StartSensors(void) {
-    ((SimuAhrs*)GetAhrs())->Start();
-    ((SimuUs*)GetUsRangeFinder())->Start();
-    ((SimuCamera *)GetVerticalCamera())->Start();
-    Uav::StartSensors();
-}
-
-void SimuX4::SetupVRPNAutoIP(string name) {
-    SetupVRPN("127.0.0.1:3883",name);
-}
+void SimuX4::SetupVRPNAutoIP(string name) { SetupVRPN("127.0.0.1:3883", name); }
 
 } // end namespace meta
Index: trunk/lib/FlairMeta/src/SimuX4.h
===================================================================
--- trunk/lib/FlairMeta/src/SimuX4.h	(revision 14)
+++ trunk/lib/FlairMeta/src/SimuX4.h	(revision 15)
@@ -16,21 +16,20 @@
 #include "Uav.h"
 
-namespace flair
-{
-namespace meta
-{
-    /*! \class SimuX4
-    *
-    * \brief Class defining a simultation x4 uav
-    */
-    class SimuX4 : public Uav {
-        public:
-            //simu_id: 0 if simulating only one UAV
-            //>0 otherwise
-            SimuX4(core::FrameworkManager* parent,std::string uav_name,int simu_id=0,filter::UavMultiplex *multiplex=NULL);
-            ~SimuX4();
-            void StartSensors(void);
-            void SetupVRPNAutoIP(std::string name);
-    };
+namespace flair {
+namespace meta {
+/*! \class SimuX4
+*
+* \brief Class defining a simultation x4 uav
+*/
+class SimuX4 : public Uav {
+public:
+  // simu_id: 0 if simulating only one UAV
+  //>0 otherwise
+  SimuX4(core::FrameworkManager *parent, std::string uav_name, int simu_id = 0,
+         filter::UavMultiplex *multiplex = NULL);
+  ~SimuX4();
+  void StartSensors(void);
+  void SetupVRPNAutoIP(std::string name);
+};
 } // end namespace meta
 } // end namespace flair
Index: trunk/lib/FlairMeta/src/SimuX8.cpp
===================================================================
--- trunk/lib/FlairMeta/src/SimuX8.cpp	(revision 14)
+++ trunk/lib/FlairMeta/src/SimuX8.cpp	(revision 15)
@@ -34,33 +34,35 @@
 using namespace flair::actuator;
 
-namespace flair { namespace meta {
+namespace flair {
+namespace meta {
 
-SimuX8::SimuX8(FrameworkManager* parent,string uav_name,int simu_id,filter::UavMultiplex *multiplex) : Uav(parent,uav_name,multiplex) {
+SimuX8::SimuX8(FrameworkManager *parent, string uav_name, int simu_id,
+               filter::UavMultiplex *multiplex)
+    : Uav(parent, uav_name, multiplex) {
 
-    if(multiplex==NULL) SetMultiplex(new X4X8Multiplex(parent,"motors",X4X8Multiplex::X8));
+  if (multiplex == NULL)
+    SetMultiplex(new X4X8Multiplex(parent, "motors", X4X8Multiplex::X8));
 
-    SetBldc(new SimuBldc(GetUavMultiplex(),GetUavMultiplex()->GetLayout(),"motors",GetUavMultiplex()->MotorsCount(),simu_id));
-    SetUsRangeFinder(new SimuUs(parent,"us",simu_id,60));
-    SetAhrs(new SimuAhrs(parent,"imu",simu_id,70));
-    Tab* bat_tab=new Tab(parent->GetTabWidget(),"battery");
-    SetBatteryMonitor(new BatteryMonitor(bat_tab->NewRow(),"battery"));
-    GetBatteryMonitor()->SetBatteryValue(12);
-    SetVerticalCamera(new SimuCamera(parent, "simu_cam_v", 320, 240, 3, simu_id, 10));
+  SetBldc(new SimuBldc(GetUavMultiplex(), GetUavMultiplex()->GetLayout(),
+                       "motors", GetUavMultiplex()->MotorsCount(), simu_id));
+  SetUsRangeFinder(new SimuUs(parent, "us", simu_id, 60));
+  SetAhrs(new SimuAhrs(parent, "imu", simu_id, 70));
+  Tab *bat_tab = new Tab(parent->GetTabWidget(), "battery");
+  SetBatteryMonitor(new BatteryMonitor(bat_tab->NewRow(), "battery"));
+  GetBatteryMonitor()->SetBatteryValue(12);
+  SetVerticalCamera(
+      new SimuCamera(parent, "simu_cam_v", 320, 240, 3, simu_id, 10));
 }
 
-SimuX8::~SimuX8() {
+SimuX8::~SimuX8() {}
 
+void SimuX8::StartSensors(void) {
+  ((SimuAhrs *)GetAhrs())->Start();
+  ((SimuUs *)GetUsRangeFinder())->Start();
+  ((SimuCamera *)GetVerticalCamera())->Start();
+  Uav::StartSensors();
 }
 
-void SimuX8::StartSensors(void) {
-    ((SimuAhrs*)GetAhrs())->Start();
-    ((SimuUs*)GetUsRangeFinder())->Start();
-    ((SimuCamera *)GetVerticalCamera())->Start();
-    Uav::StartSensors();
-}
-
-void SimuX8::SetupVRPNAutoIP(string name) {
-    SetupVRPN("127.0.0.1:3883",name);
-}
+void SimuX8::SetupVRPNAutoIP(string name) { SetupVRPN("127.0.0.1:3883", name); }
 
 } // end namespace meta
Index: trunk/lib/FlairMeta/src/SimuX8.h
===================================================================
--- trunk/lib/FlairMeta/src/SimuX8.h	(revision 14)
+++ trunk/lib/FlairMeta/src/SimuX8.h	(revision 15)
@@ -16,21 +16,20 @@
 #include "Uav.h"
 
-namespace flair
-{
-namespace meta
-{
-    /*! \class SimuX8
-    *
-    * \brief Class defining a simultation x8 uav
-    */
-    class SimuX8 : public Uav {
-        public:
-            //simu_id: 0 if simulating only one UAV
-            //>0 otherwise
-            SimuX8(core::FrameworkManager* parent,std::string uav_name,int simu_id=0,filter::UavMultiplex *multiplex=NULL);
-            ~SimuX8();
-            void StartSensors(void);
-            void SetupVRPNAutoIP(std::string name);
-    };
+namespace flair {
+namespace meta {
+/*! \class SimuX8
+*
+* \brief Class defining a simultation x8 uav
+*/
+class SimuX8 : public Uav {
+public:
+  // simu_id: 0 if simulating only one UAV
+  //>0 otherwise
+  SimuX8(core::FrameworkManager *parent, std::string uav_name, int simu_id = 0,
+         filter::UavMultiplex *multiplex = NULL);
+  ~SimuX8();
+  void StartSensors(void);
+  void SetupVRPNAutoIP(std::string name);
+};
 } // end namespace meta
 } // end namespace flair
Index: trunk/lib/FlairMeta/src/Uav.cpp
===================================================================
--- trunk/lib/FlairMeta/src/Uav.cpp	(revision 14)
+++ trunk/lib/FlairMeta/src/Uav.cpp	(revision 15)
@@ -38,46 +38,46 @@
 using namespace flair::actuator;
 
-namespace flair { namespace meta {
+namespace flair {
+namespace meta {
 
-Uav::Uav(FrameworkManager* parent,string name,UavMultiplex *multiplex): Object(parent,name) {
-    vrpnclient=NULL;
-    uav_vrpn=NULL;
-    verticalCamera=NULL;
-    this->multiplex=multiplex;
+Uav::Uav(FrameworkManager *parent, string name, UavMultiplex *multiplex)
+    : Object(parent, name) {
+  vrpnclient = NULL;
+  uav_vrpn = NULL;
+  verticalCamera = NULL;
+  this->multiplex = multiplex;
 }
 
-Uav::~Uav() {
-}
+Uav::~Uav() {}
 
 void Uav::SetUsRangeFinder(const UsRangeFinder *inUs) {
-    us=(UsRangeFinder*)inUs;
-    meta_us=new MetaUsRangeFinder(us);
-    getFrameworkManager()->AddDeviceToLog(us);
+  us = (UsRangeFinder *)inUs;
+  meta_us = new MetaUsRangeFinder(us);
+  getFrameworkManager()->AddDeviceToLog(us);
 }
 
 void Uav::SetAhrs(const Ahrs *inAhrs) {
-    ahrs=(Ahrs*)inAhrs;
-    imu=(Imu*)ahrs->GetImu();
-    getFrameworkManager()->AddDeviceToLog(imu);
+  ahrs = (Ahrs *)inAhrs;
+  imu = (Imu *)ahrs->GetImu();
+  getFrameworkManager()->AddDeviceToLog(imu);
 }
 
-void Uav::SetBldc(const Bldc* inBldc) {
-    bldc=(Bldc*)inBldc;
-}
+void Uav::SetBldc(const Bldc *inBldc) { bldc = (Bldc *)inBldc; }
 
-void Uav::SetBatteryMonitor(const BatteryMonitor* inBattery) {
-    battery=(BatteryMonitor*)inBattery;
+void Uav::SetBatteryMonitor(const BatteryMonitor *inBattery) {
+  battery = (BatteryMonitor *)inBattery;
 }
 
 void Uav::SetMultiplex(const UavMultiplex *inMultiplex) {
-    multiplex=(UavMultiplex*)inMultiplex;
-    getFrameworkManager()->AddDeviceToLog(multiplex);
+  multiplex = (UavMultiplex *)inMultiplex;
+  getFrameworkManager()->AddDeviceToLog(multiplex);
 }
 
-void Uav::SetVerticalCamera(const Camera* inVerticalCamera) {
-    verticalCamera=(Camera*)inVerticalCamera;
+void Uav::SetVerticalCamera(const Camera *inVerticalCamera) {
+  verticalCamera = (Camera *)inVerticalCamera;
 }
 /*
-void Uav::SetupVRPNSerial(SerialPort *vrpn_port,string name,int VRPNSerialObjectId) {
+void Uav::SetupVRPNSerial(SerialPort *vrpn_port,string name,int
+VRPNSerialObjectId) {
     vrpnclient=new VrpnClient(getFrameworkManager(),"vrpn",vrpn_port,10000,80);
     uav_vrpn=new MetaVrpnObject(vrpnclient,name,VRPNSerialObjectId);
@@ -87,102 +87,105 @@
 */
 void Uav::SetupVRPNAutoIP(string name) {
-    SetupVRPN("192.168.147.197:3883",name);
+  SetupVRPN("192.168.147.197:3883", name);
 }
 
-void Uav::SetupVRPN(string optitrack_address,string name) {
-    vrpnclient=new VrpnClient(getFrameworkManager(),"vrpn",optitrack_address,10000,80);
-    uav_vrpn=new MetaVrpnObject(vrpnclient,name);
+void Uav::SetupVRPN(string optitrack_address, string name) {
+  vrpnclient = new VrpnClient(getFrameworkManager(), "vrpn", optitrack_address,
+                              10000, 80);
+  uav_vrpn = new MetaVrpnObject(vrpnclient, name);
 
-    getFrameworkManager()->AddDeviceToLog(uav_vrpn);
+  getFrameworkManager()->AddDeviceToLog(uav_vrpn);
 
-    GetAhrs()->YawPlot()->AddCurve(uav_vrpn->State()->Element(2),DataPlot::Green);
-    //GetAhrs()->RollPlot()->AddCurve(uav_vrpn->State()->Element(0),DataPlot::Green);
-    //GetAhrs()->PitchPlot()->AddCurve(uav_vrpn->State()->Element(1),DataPlot::Green);
+  GetAhrs()->YawPlot()->AddCurve(uav_vrpn->State()->Element(2),
+                                 DataPlot::Green);
+  // GetAhrs()->RollPlot()->AddCurve(uav_vrpn->State()->Element(0),DataPlot::Green);
+  // GetAhrs()->PitchPlot()->AddCurve(uav_vrpn->State()->Element(1),DataPlot::Green);
 }
 
-void Uav::StartSensors(void)  {
-    if(vrpnclient!=NULL) {
-        vrpnclient->Start();
-    }
+void Uav::StartSensors(void) {
+  if (vrpnclient != NULL) {
+    vrpnclient->Start();
+  }
 }
 void Uav::UseDefaultPlot(void) {
-    multiplex->UseDefaultPlot();
+  multiplex->UseDefaultPlot();
 
-    if(bldc->HasSpeedMeasurement()) {
-        Tab* plot_tab=new Tab(multiplex->GetTabWidget(),"Speeds");
-        DataPlot1D* plots[4];
-        plots[0]=new DataPlot1D(plot_tab->NewRow(),"front left",0,7000);
-        plots[1]=new DataPlot1D(plot_tab->LastRowLastCol(),"front right",0,7000);
-        plots[2]=new DataPlot1D(plot_tab->NewRow(),"rear left",0,7000);
-        plots[3]=new DataPlot1D(plot_tab->LastRowLastCol(),"rear right",0,7000);
+  if (bldc->HasSpeedMeasurement()) {
+    Tab *plot_tab = new Tab(multiplex->GetTabWidget(), "Speeds");
+    DataPlot1D *plots[4];
+    plots[0] = new DataPlot1D(plot_tab->NewRow(), "front left", 0, 7000);
+    plots[1] =
+        new DataPlot1D(plot_tab->LastRowLastCol(), "front right", 0, 7000);
+    plots[2] = new DataPlot1D(plot_tab->NewRow(), "rear left", 0, 7000);
+    plots[3] =
+        new DataPlot1D(plot_tab->LastRowLastCol(), "rear right", 0, 7000);
 
-        if(bldc->MotorsCount()==8) {
-            for(int i=0;i<4;i++) plots[i]->AddCurve(bldc->Output()->Element(multiplex->MultiplexValue(i),0),DataPlot::Red,"top");
-            for(int i=0;i<4;i++) plots[i]->AddCurve(bldc->Output()->Element(multiplex->MultiplexValue(i+4),0),DataPlot::Blue,"bottom");
-        } else {
-            for(int i=0;i<4;i++) plots[i]->AddCurve(bldc->Output()->Element(multiplex->MultiplexValue(i),0));
-        }
+    if (bldc->MotorsCount() == 8) {
+      for (int i = 0; i < 4; i++)
+        plots[i]->AddCurve(
+            bldc->Output()->Element(multiplex->MultiplexValue(i), 0),
+            DataPlot::Red, "top");
+      for (int i = 0; i < 4; i++)
+        plots[i]->AddCurve(
+            bldc->Output()->Element(multiplex->MultiplexValue(i + 4), 0),
+            DataPlot::Blue, "bottom");
+    } else {
+      for (int i = 0; i < 4; i++)
+        plots[i]->AddCurve(
+            bldc->Output()->Element(multiplex->MultiplexValue(i), 0));
     }
+  }
 
-    if(bldc->HasCurrentMeasurement()) {
-        Tab* plot_tab=new Tab(multiplex->GetTabWidget(),"Currents");
-        DataPlot1D* plots[4];
-        plots[0]=new DataPlot1D(plot_tab->NewRow(),"front left",0,10);
-        plots[1]=new DataPlot1D(plot_tab->LastRowLastCol(),"front right",0,10);
-        plots[2]=new DataPlot1D(plot_tab->NewRow(),"rear left",0,10);
-        plots[3]=new DataPlot1D(plot_tab->LastRowLastCol(),"rear right",0,10);
+  if (bldc->HasCurrentMeasurement()) {
+    Tab *plot_tab = new Tab(multiplex->GetTabWidget(), "Currents");
+    DataPlot1D *plots[4];
+    plots[0] = new DataPlot1D(plot_tab->NewRow(), "front left", 0, 10);
+    plots[1] = new DataPlot1D(plot_tab->LastRowLastCol(), "front right", 0, 10);
+    plots[2] = new DataPlot1D(plot_tab->NewRow(), "rear left", 0, 10);
+    plots[3] = new DataPlot1D(plot_tab->LastRowLastCol(), "rear right", 0, 10);
 
-        if(bldc->MotorsCount()==8) {
-            for(int i=0;i<4;i++) plots[i]->AddCurve(bldc->Output()->Element(multiplex->MultiplexValue(i),1),DataPlot::Red,"top");
-            for(int i=0;i<4;i++) plots[i]->AddCurve(bldc->Output()->Element(multiplex->MultiplexValue(i+4),1),DataPlot::Blue,"bottom");
-        } else {
-            for(int i=0;i<4;i++) plots[i]->AddCurve(bldc->Output()->Element(multiplex->MultiplexValue(i),1));
-        }
+    if (bldc->MotorsCount() == 8) {
+      for (int i = 0; i < 4; i++)
+        plots[i]->AddCurve(
+            bldc->Output()->Element(multiplex->MultiplexValue(i), 1),
+            DataPlot::Red, "top");
+      for (int i = 0; i < 4; i++)
+        plots[i]->AddCurve(
+            bldc->Output()->Element(multiplex->MultiplexValue(i + 4), 1),
+            DataPlot::Blue, "bottom");
+    } else {
+      for (int i = 0; i < 4; i++)
+        plots[i]->AddCurve(
+            bldc->Output()->Element(multiplex->MultiplexValue(i), 1));
     }
+  }
 
-    meta_us->UseDefaultPlot();
-    ahrs->UseDefaultPlot();
+  meta_us->UseDefaultPlot();
+  ahrs->UseDefaultPlot();
 }
 
-UavMultiplex* Uav::GetUavMultiplex(void) const {
-    return multiplex;
+UavMultiplex *Uav::GetUavMultiplex(void) const { return multiplex; }
+
+Bldc *Uav::GetBldc(void) const { return bldc; }
+
+Ahrs *Uav::GetAhrs(void) const { return ahrs; }
+
+Imu *Uav::GetImu(void) const { return imu; }
+
+MetaUsRangeFinder *Uav::GetMetaUsRangeFinder(void) const { return meta_us; }
+
+UsRangeFinder *Uav::GetUsRangeFinder(void) const { return us; }
+
+BatteryMonitor *Uav::GetBatteryMonitor(void) const { return battery; }
+
+VrpnClient *Uav::GetVrpnClient(void) const {
+  if (vrpnclient == NULL)
+    Err("vrpn is not setup, call SetupVRPN before\n");
+  return vrpnclient;
 }
 
-Bldc* Uav::GetBldc(void) const {
-    return bldc;
-}
+MetaVrpnObject *Uav::GetVrpnObject(void) const { return uav_vrpn; }
 
-Ahrs* Uav::GetAhrs(void) const {
-    return ahrs;
-}
-
-Imu* Uav::GetImu(void) const {
-    return imu;
-}
-
-MetaUsRangeFinder* Uav::GetMetaUsRangeFinder(void) const {
-    return meta_us;
-}
-
-UsRangeFinder* Uav::GetUsRangeFinder(void) const {
-    return us;
-}
-
-BatteryMonitor* Uav::GetBatteryMonitor(void) const {
-    return battery;
-}
-
-VrpnClient* Uav::GetVrpnClient(void) const {
-    if(vrpnclient==NULL) Err("vrpn is not setup, call SetupVRPN before\n");
-    return vrpnclient;
-}
-
-MetaVrpnObject* Uav::GetVrpnObject(void) const {
-    return uav_vrpn;
-}
-
-Camera* Uav::GetVerticalCamera(void) const {
-    return verticalCamera;
-}
+Camera *Uav::GetVerticalCamera(void) const { return verticalCamera; }
 
 } // end namespace meta
Index: trunk/lib/FlairMeta/src/Uav.h
===================================================================
--- trunk/lib/FlairMeta/src/Uav.h	(revision 14)
+++ trunk/lib/FlairMeta/src/Uav.h	(revision 15)
@@ -17,84 +17,86 @@
 
 namespace flair {
-    namespace core {
-        class FrameworkManager;
-    }
-    namespace filter {
-        class Ahrs;
-        class UavMultiplex;
-    }
-    namespace actuator {
-        class Bldc;
-    }
-    namespace sensor {
-        class UsRangeFinder;
-        class BatteryMonitor;
-        class VrpnClient;
-        class Imu;
-        class Camera;
-    }
+namespace core {
+class FrameworkManager;
+}
+namespace filter {
+class Ahrs;
+class UavMultiplex;
+}
+namespace actuator {
+class Bldc;
+}
+namespace sensor {
+class UsRangeFinder;
+class BatteryMonitor;
+class VrpnClient;
+class Imu;
+class Camera;
+}
 }
 
 namespace flair {
 namespace meta {
-    class MetaUsRangeFinder;
-    class MetaVrpnObject;
+class MetaUsRangeFinder;
+class MetaVrpnObject;
 
-    /*! \class Uav
-    *
-    * \brief Base class to construct sensors/actuators depending on uav type
-    */
-    class Uav: public core::Object {
-        public:
-        /*
-            typedef enum {
-                None,
-                Auto,//rt serial if hds x4 ou x8, auto ip sinon
-                AutoIP,
-                UserDefinedIP,
-                AutoSerialPort,
-                } VRPNType_t;
+/*! \class Uav
+*
+* \brief Base class to construct sensors/actuators depending on uav type
 */
-            //uav_name: for optitrack
-            Uav(core::FrameworkManager* parent,std::string name,filter::UavMultiplex *multiplex=NULL);
-            ~Uav();
-            void SetupVRPN(std::string optitrack_address,std::string name);
-            //vrpn serial: broken, need to add serial port in uav specific code
-            //void SetupVRPNSerial(core::SerialPort *vrpn_port,std::string name,int VRPNSerialObjectId);
-            virtual void SetupVRPNAutoIP(std::string name);
+class Uav : public core::Object {
+public:
+  /*
+      typedef enum {
+          None,
+          Auto,//rt serial if hds x4 ou x8, auto ip sinon
+          AutoIP,
+          UserDefinedIP,
+          AutoSerialPort,
+          } VRPNType_t;
+*/
+  // uav_name: for optitrack
+  Uav(core::FrameworkManager *parent, std::string name,
+      filter::UavMultiplex *multiplex = NULL);
+  ~Uav();
+  void SetupVRPN(std::string optitrack_address, std::string name);
+  // vrpn serial: broken, need to add serial port in uav specific code
+  // void SetupVRPNSerial(core::SerialPort *vrpn_port,std::string name,int
+  // VRPNSerialObjectId);
+  virtual void SetupVRPNAutoIP(std::string name);
 
-            virtual void StartSensors(void);
-            void UseDefaultPlot(void);
-            actuator::Bldc* GetBldc(void) const;
-            filter::UavMultiplex* GetUavMultiplex(void) const;
-            sensor::Imu* GetImu(void) const;
-            filter::Ahrs* GetAhrs(void) const;
-            MetaUsRangeFinder* GetMetaUsRangeFinder(void) const;
-            sensor::UsRangeFinder* GetUsRangeFinder(void) const;
-            sensor::BatteryMonitor* GetBatteryMonitor(void) const;
-            sensor::VrpnClient* GetVrpnClient(void) const;
-            meta::MetaVrpnObject* GetVrpnObject(void) const;
-            sensor::Camera* GetVerticalCamera(void) const;
+  virtual void StartSensors(void);
+  void UseDefaultPlot(void);
+  actuator::Bldc *GetBldc(void) const;
+  filter::UavMultiplex *GetUavMultiplex(void) const;
+  sensor::Imu *GetImu(void) const;
+  filter::Ahrs *GetAhrs(void) const;
+  MetaUsRangeFinder *GetMetaUsRangeFinder(void) const;
+  sensor::UsRangeFinder *GetUsRangeFinder(void) const;
+  sensor::BatteryMonitor *GetBatteryMonitor(void) const;
+  sensor::VrpnClient *GetVrpnClient(void) const;
+  meta::MetaVrpnObject *GetVrpnObject(void) const;
+  sensor::Camera *GetVerticalCamera(void) const;
 
-        protected:
-            void SetBldc(const actuator::Bldc *bldc);
-            void SetMultiplex(const filter::UavMultiplex *multiplex);
-            void SetAhrs(const filter::Ahrs *ahrs);
-            void SetUsRangeFinder(const sensor::UsRangeFinder *us);
-            void SetBatteryMonitor(const sensor::BatteryMonitor *battery);
-            void SetVerticalCamera(const sensor::Camera *verticalCamera);
+protected:
+  void SetBldc(const actuator::Bldc *bldc);
+  void SetMultiplex(const filter::UavMultiplex *multiplex);
+  void SetAhrs(const filter::Ahrs *ahrs);
+  void SetUsRangeFinder(const sensor::UsRangeFinder *us);
+  void SetBatteryMonitor(const sensor::BatteryMonitor *battery);
+  void SetVerticalCamera(const sensor::Camera *verticalCamera);
 
-        private:
-            sensor::Imu* imu;
-            filter::Ahrs* ahrs;
-            actuator::Bldc* bldc;
-            filter::UavMultiplex *multiplex;
-            sensor::UsRangeFinder* us;
-            MetaUsRangeFinder* meta_us;
-            sensor::VrpnClient *vrpnclient;
-            MetaVrpnObject* uav_vrpn;
-            sensor::BatteryMonitor* battery;
-            sensor::Camera* verticalCamera;
-    };
+private:
+  sensor::Imu *imu;
+  filter::Ahrs *ahrs;
+  actuator::Bldc *bldc;
+  filter::UavMultiplex *multiplex;
+  sensor::UsRangeFinder *us;
+  MetaUsRangeFinder *meta_us;
+  sensor::VrpnClient *vrpnclient;
+  MetaVrpnObject *uav_vrpn;
+  sensor::BatteryMonitor *battery;
+  sensor::Camera *verticalCamera;
+};
 } // end namespace meta
 } // end namespace flair
Index: trunk/lib/FlairMeta/src/UavFactory.cpp
===================================================================
--- trunk/lib/FlairMeta/src/UavFactory.cpp	(revision 14)
+++ trunk/lib/FlairMeta/src/UavFactory.cpp	(revision 15)
@@ -29,32 +29,33 @@
 using namespace flair::meta;
 
-Uav* CreateUav(FrameworkManager* parent,string uav_name,string uav_type,UavMultiplex *multiplex) {
-    /*if(uav_type=="ardrone2") {
+Uav *CreateUav(FrameworkManager *parent, string uav_name, string uav_type,
+               UavMultiplex *multiplex) {
+  /*if(uav_type=="ardrone2") {
         return new ArDrone2(parent,uav_name,multiplex);
-    } else */if(uav_type=="hds_x4") {
-        parent->Err("UAV type %s not yet implemented\n",uav_type.c_str());
-        return NULL;
-    } else if(uav_type=="hds_x8") {
-        return new HdsX8(parent,uav_name,multiplex);
-    } else if(uav_type=="xair") {
-        return new XAir(parent,uav_name,multiplex);
-    } else if(uav_type=="hds_xufo") {
-        parent->Err("UAV type %s not yet implemented\n",uav_type.c_str());
-        return NULL;
-    } else if(uav_type.compare(0,7,"x4_simu")==0) {
-        int simu_id=0;
-        if(uav_type.size()>7) {
-            simu_id=atoi(uav_type.substr (7,uav_type.size()-7).c_str());
-        }
-        return new SimuX4(parent,uav_name,simu_id,multiplex);
-    } else if(uav_type.compare(0,7,"x8_simu") == 0) {
-        int simu_id=0;
-        if(uav_type.size()>7) {
-            simu_id=atoi(uav_type.substr (7,uav_type.size()-7).c_str());
-        }
-        return new SimuX8(parent,uav_name,simu_id,multiplex);
-    } else {
-        parent->Err("UAV type %s unknown\n",uav_type.c_str());
-        return NULL;
+    } else */ if (uav_type == "hds_x4") {
+    parent->Err("UAV type %s not yet implemented\n", uav_type.c_str());
+    return NULL;
+  } else if (uav_type == "hds_x8") {
+    return new HdsX8(parent, uav_name, multiplex);
+  } else if (uav_type == "xair") {
+    return new XAir(parent, uav_name, multiplex);
+  } else if (uav_type == "hds_xufo") {
+    parent->Err("UAV type %s not yet implemented\n", uav_type.c_str());
+    return NULL;
+  } else if (uav_type.compare(0, 7, "x4_simu") == 0) {
+    int simu_id = 0;
+    if (uav_type.size() > 7) {
+      simu_id = atoi(uav_type.substr(7, uav_type.size() - 7).c_str());
     }
+    return new SimuX4(parent, uav_name, simu_id, multiplex);
+  } else if (uav_type.compare(0, 7, "x8_simu") == 0) {
+    int simu_id = 0;
+    if (uav_type.size() > 7) {
+      simu_id = atoi(uav_type.substr(7, uav_type.size() - 7).c_str());
+    }
+    return new SimuX8(parent, uav_name, simu_id, multiplex);
+  } else {
+    parent->Err("UAV type %s unknown\n", uav_type.c_str());
+    return NULL;
+  }
 }
Index: trunk/lib/FlairMeta/src/UavFactory.h
===================================================================
--- trunk/lib/FlairMeta/src/UavFactory.h	(revision 14)
+++ trunk/lib/FlairMeta/src/UavFactory.h	(revision 15)
@@ -21,5 +21,7 @@
 #include <Uav.h>
 
-flair::meta::Uav* CreateUav(flair::core::FrameworkManager* parent,std::string uav_name,std::string uav_type,flair::filter::UavMultiplex *multiplex=NULL);
+flair::meta::Uav *CreateUav(flair::core::FrameworkManager *parent,
+                            std::string uav_name, std::string uav_type,
+                            flair::filter::UavMultiplex *multiplex = NULL);
 
 #endif // UAVFACTORY
Index: trunk/lib/FlairMeta/src/UavStateMachine.cpp
===================================================================
--- trunk/lib/FlairMeta/src/UavStateMachine.cpp	(revision 14)
+++ trunk/lib/FlairMeta/src/UavStateMachine.cpp	(revision 15)
@@ -51,598 +51,658 @@
 using namespace flair::meta;
 
-UavStateMachine::UavStateMachine(Uav* inUav,uint16_t ds3Port):
-        Thread(getFrameworkManager(),"UavStateMachine",50),
-        uav(inUav),failSafeMode(true),flagConnectionLost(false),flagBatteryLow(false),flagZTrajectoryFinished(false) {
-    altitudeState=AltitudeState_t::Stopped;
-    uav->UseDefaultPlot();
-
-    Tab *uavTab=new Tab(getFrameworkManager()->GetTabWidget(),"uav",0);
-    buttonslayout=new GridLayout(uavTab->NewRow(),"buttons");
-    button_kill=new PushButton(buttonslayout->NewRow(),"kill");
-    button_start_log=new PushButton(buttonslayout->NewRow(),"start_log");
-    button_stop_log=new PushButton(buttonslayout->LastRowLastCol(),"stop_log");
-    button_take_off=new PushButton(buttonslayout->NewRow(),"take_off");
-    button_land=new PushButton(buttonslayout->LastRowLastCol(),"land");
-
-    Tab *lawTab=new Tab(getFrameworkManager()->GetTabWidget(),"control laws");
-    TabWidget *tabWidget=new TabWidget(lawTab->NewRow(),"laws");
-    setupLawTab=new Tab(tabWidget,"Setup");
-    graphLawTab=new Tab(tabWidget,"Graphes");
-
-    uRoll=new NestedSat(setupLawTab->At(0,0),"u_roll");
-    uRoll->ConvertSatFromDegToRad();
-    uRoll->UseDefaultPlot(graphLawTab->NewRow());
-
-    uPitch=new NestedSat(setupLawTab->At(0,1),"u_pitch");
-    uPitch->ConvertSatFromDegToRad();
-    uPitch->UseDefaultPlot(graphLawTab->LastRowLastCol());
-
-    uYaw=new Pid(setupLawTab->At(0,2),"u_yaw");
-    uYaw->UseDefaultPlot(graphLawTab->LastRowLastCol());
-
-    uZ=new PidThrust(setupLawTab->At(1,2),"u_z");
-    uZ->UseDefaultPlot(graphLawTab->LastRowLastCol());
-
-    getFrameworkManager()->AddDeviceToLog(uZ);
-    uZ->AddDeviceToLog(uRoll);
-    uZ->AddDeviceToLog(uPitch);
-    uZ->AddDeviceToLog(uYaw);
-
-    joy=new MetaDualShock3(getFrameworkManager(),"dualshock3",ds3Port,30);
-    uav->GetAhrs()->AddPlot(joy->GetReferenceOrientation(),DataPlot::Blue);
-
-    altitudeMode=AltitudeMode_t::Manual;
-    orientationMode=OrientationMode_t::Manual;
-    thrustMode=ThrustMode_t::Default;
-    torqueMode=TorqueMode_t::Default;
-
-    GroupBox* reglagesGroupbox=new GroupBox(uavTab->NewRow(),"takeoff/landing");
-    desiredTakeoffAltitude=new DoubleSpinBox(reglagesGroupbox->NewRow(),"desired takeoff altitude"," m",0,5,0.1,2,1);
-    desiredLandingAltitude=new DoubleSpinBox(reglagesGroupbox->LastRowLastCol(),"desired landing altitude"," m",0,1,0.1,1);
-    altitudeTrajectory=new TrajectoryGenerator1D(uavTab->NewRow(),"alt cons","m");
-    uav->GetMetaUsRangeFinder()->GetZPlot()->AddCurve(altitudeTrajectory->Matrix()->Element(0),DataPlot::Green);
-    uav->GetMetaUsRangeFinder()->GetVzPlot()->AddCurve(altitudeTrajectory->Matrix()->Element(1),DataPlot::Green);
-}
-
-UavStateMachine::~UavStateMachine() {
-}
-
-void UavStateMachine::AddDeviceToControlLawLog(const IODevice* device) {
-    uZ->AddDeviceToLog(device);
-}
-
-void UavStateMachine::AddDataToControlLawLog(const core::io_data* data) {
-    uZ->AddDataToLog(data);
-}
-
-const TargetController *UavStateMachine::GetJoystick(void) const {
-    return joy;
-}
+UavStateMachine::UavStateMachine(Uav *inUav, uint16_t ds3Port)
+    : Thread(getFrameworkManager(), "UavStateMachine", 50), uav(inUav),
+      failSafeMode(true), flagConnectionLost(false), flagBatteryLow(false),
+      flagZTrajectoryFinished(false) {
+  altitudeState = AltitudeState_t::Stopped;
+  uav->UseDefaultPlot();
+
+  Tab *uavTab = new Tab(getFrameworkManager()->GetTabWidget(), "uav", 0);
+  buttonslayout = new GridLayout(uavTab->NewRow(), "buttons");
+  button_kill = new PushButton(buttonslayout->NewRow(), "kill");
+  button_start_log = new PushButton(buttonslayout->NewRow(), "start_log");
+  button_stop_log = new PushButton(buttonslayout->LastRowLastCol(), "stop_log");
+  button_take_off = new PushButton(buttonslayout->NewRow(), "take_off");
+  button_land = new PushButton(buttonslayout->LastRowLastCol(), "land");
+
+  Tab *lawTab = new Tab(getFrameworkManager()->GetTabWidget(), "control laws");
+  TabWidget *tabWidget = new TabWidget(lawTab->NewRow(), "laws");
+  setupLawTab = new Tab(tabWidget, "Setup");
+  graphLawTab = new Tab(tabWidget, "Graphes");
+
+  uRoll = new NestedSat(setupLawTab->At(0, 0), "u_roll");
+  uRoll->ConvertSatFromDegToRad();
+  uRoll->UseDefaultPlot(graphLawTab->NewRow());
+
+  uPitch = new NestedSat(setupLawTab->At(0, 1), "u_pitch");
+  uPitch->ConvertSatFromDegToRad();
+  uPitch->UseDefaultPlot(graphLawTab->LastRowLastCol());
+
+  uYaw = new Pid(setupLawTab->At(0, 2), "u_yaw");
+  uYaw->UseDefaultPlot(graphLawTab->LastRowLastCol());
+
+  uZ = new PidThrust(setupLawTab->At(1, 2), "u_z");
+  uZ->UseDefaultPlot(graphLawTab->LastRowLastCol());
+
+  getFrameworkManager()->AddDeviceToLog(uZ);
+  uZ->AddDeviceToLog(uRoll);
+  uZ->AddDeviceToLog(uPitch);
+  uZ->AddDeviceToLog(uYaw);
+
+  joy = new MetaDualShock3(getFrameworkManager(), "dualshock3", ds3Port, 30);
+  uav->GetAhrs()->AddPlot(joy->GetReferenceOrientation(), DataPlot::Blue);
+
+  altitudeMode = AltitudeMode_t::Manual;
+  orientationMode = OrientationMode_t::Manual;
+  thrustMode = ThrustMode_t::Default;
+  torqueMode = TorqueMode_t::Default;
+
+  GroupBox *reglagesGroupbox =
+      new GroupBox(uavTab->NewRow(), "takeoff/landing");
+  desiredTakeoffAltitude =
+      new DoubleSpinBox(reglagesGroupbox->NewRow(), "desired takeoff altitude",
+                        " m", 0, 5, 0.1, 2, 1);
+  desiredLandingAltitude =
+      new DoubleSpinBox(reglagesGroupbox->LastRowLastCol(),
+                        "desired landing altitude", " m", 0, 1, 0.1, 1);
+  altitudeTrajectory =
+      new TrajectoryGenerator1D(uavTab->NewRow(), "alt cons", "m");
+  uav->GetMetaUsRangeFinder()->GetZPlot()->AddCurve(
+      altitudeTrajectory->Matrix()->Element(0), DataPlot::Green);
+  uav->GetMetaUsRangeFinder()->GetVzPlot()->AddCurve(
+      altitudeTrajectory->Matrix()->Element(1), DataPlot::Green);
+}
+
+UavStateMachine::~UavStateMachine() {}
+
+void UavStateMachine::AddDeviceToControlLawLog(const IODevice *device) {
+  uZ->AddDeviceToLog(device);
+}
+
+void UavStateMachine::AddDataToControlLawLog(const core::io_data *data) {
+  uZ->AddDataToLog(data);
+}
+
+const TargetController *UavStateMachine::GetJoystick(void) const { return joy; }
 
 const Quaternion &UavStateMachine::GetCurrentQuaternion(void) const {
-            return currentQuaternion;
+  return currentQuaternion;
 }
 
 const Vector3D &UavStateMachine::GetCurrentAngularSpeed(void) const {
-    return currentAngularSpeed;
-}
-
-const Uav *UavStateMachine::GetUav(void) const {
-    return uav;
-}
-
-void UavStateMachine::AltitudeValues(float &altitude,float &verticalSpeed) const{
-    FailSafeAltitudeValues(altitude, verticalSpeed);
-}
-
-void UavStateMachine::FailSafeAltitudeValues(float &altitude,float &verticalSpeed) const {
-    altitude=uav->GetMetaUsRangeFinder()->z();
-    verticalSpeed=uav->GetMetaUsRangeFinder()->Vz();
+  return currentAngularSpeed;
+}
+
+const Uav *UavStateMachine::GetUav(void) const { return uav; }
+
+void UavStateMachine::AltitudeValues(float &altitude,
+                                     float &verticalSpeed) const {
+  FailSafeAltitudeValues(altitude, verticalSpeed);
+}
+
+void UavStateMachine::FailSafeAltitudeValues(float &altitude,
+                                             float &verticalSpeed) const {
+  altitude = uav->GetMetaUsRangeFinder()->z();
+  verticalSpeed = uav->GetMetaUsRangeFinder()->Vz();
 }
 
 void UavStateMachine::Run() {
-    WarnUponSwitches(true);
-    uav->StartSensors();
-
-    if(getFrameworkManager()->ErrorOccured()==true) {
-        SafeStop();
-    }
-
-    while(!ToBeStopped()) {
-        SecurityCheck();
-
-        //get controller inputs
-        CheckJoystick();
-        CheckPushButton();
-
-        if(IsPeriodSet()) {
-            WaitPeriod();
-        } else {
-            WaitUpdate(uav->GetAhrs());
-        }
-        needToComputeDefaultTorques=true;
-        needToComputeDefaultThrust=true;
-
-        SignalEvent(Event_t::EnteringControlLoop);
-
-        ComputeOrientation();
-        ComputeAltitude();
-
-        //compute thrust and torques to apply
-        ComputeTorques();
-        ComputeThrust();//logs are added to uz, so it must be updated at last
-
-        // Set torques for roll, pitch and yaw angles (value between -1 and 1). Set thrust (value between 0 and 1)
-        uav->GetUavMultiplex()->SetRoll(-currentTorques.roll);
-        uav->GetUavMultiplex()->SetPitch(-currentTorques.pitch);
-        uav->GetUavMultiplex()->SetYaw(-currentTorques.yaw);
-        uav->GetUavMultiplex()->SetThrust(-currentThrust);//on raisonne en negatif sur l'altitude, a revoir avec les equations
-        uav->GetUavMultiplex()->SetRollTrim(joy->RollTrim());
-        uav->GetUavMultiplex()->SetPitchTrim(joy->PitchTrim());
-        uav->GetUavMultiplex()->SetYawTrim(0);
-        uav->GetUavMultiplex()->Update(GetTime());
-    }
-
-    WarnUponSwitches(false);
+  WarnUponSwitches(true);
+  uav->StartSensors();
+
+  if (getFrameworkManager()->ErrorOccured() == true) {
+    SafeStop();
+  }
+
+  while (!ToBeStopped()) {
+    SecurityCheck();
+
+    // get controller inputs
+    CheckJoystick();
+    CheckPushButton();
+
+    if (IsPeriodSet()) {
+      WaitPeriod();
+    } else {
+      WaitUpdate(uav->GetAhrs());
+    }
+    needToComputeDefaultTorques = true;
+    needToComputeDefaultThrust = true;
+
+    SignalEvent(Event_t::EnteringControlLoop);
+
+    ComputeOrientation();
+    ComputeAltitude();
+
+    // compute thrust and torques to apply
+    ComputeTorques();
+    ComputeThrust(); // logs are added to uz, so it must be updated at last
+
+    // Set torques for roll, pitch and yaw angles (value between -1 and 1). Set
+    // thrust (value between 0 and 1)
+    uav->GetUavMultiplex()->SetRoll(-currentTorques.roll);
+    uav->GetUavMultiplex()->SetPitch(-currentTorques.pitch);
+    uav->GetUavMultiplex()->SetYaw(-currentTorques.yaw);
+    uav->GetUavMultiplex()->SetThrust(-currentThrust); // on raisonne en negatif
+                                                       // sur l'altitude, a
+                                                       // revoir avec les
+                                                       // equations
+    uav->GetUavMultiplex()->SetRollTrim(joy->RollTrim());
+    uav->GetUavMultiplex()->SetPitchTrim(joy->PitchTrim());
+    uav->GetUavMultiplex()->SetYawTrim(0);
+    uav->GetUavMultiplex()->Update(GetTime());
+  }
+
+  WarnUponSwitches(false);
 }
 
 void UavStateMachine::ComputeOrientation(void) {
-    if (failSafeMode) {
-        GetDefaultOrientation()->GetQuaternionAndAngularRates(currentQuaternion, currentAngularSpeed);
+  if (failSafeMode) {
+    GetDefaultOrientation()->GetQuaternionAndAngularRates(currentQuaternion,
+                                                          currentAngularSpeed);
+  } else {
+    GetOrientation()->GetQuaternionAndAngularRates(currentQuaternion,
+                                                   currentAngularSpeed);
+  }
+}
+
+const AhrsData *UavStateMachine::GetOrientation(void) const {
+  return GetDefaultOrientation();
+}
+
+const AhrsData *UavStateMachine::GetDefaultOrientation(void) const {
+  return uav->GetAhrs()->GetDatas();
+}
+
+void UavStateMachine::ComputeAltitude(void) {
+  if (failSafeMode) {
+    FailSafeAltitudeValues(currentAltitude, currentVerticalSpeed);
+  } else {
+    AltitudeValues(currentAltitude, currentVerticalSpeed);
+  }
+}
+
+void UavStateMachine::ComputeReferenceAltitude(float &refAltitude,
+                                               float &refVerticalVelocity) {
+  if (altitudeMode == AltitudeMode_t::Manual) {
+    GetDefaultReferenceAltitude(refAltitude, refVerticalVelocity);
+  } else {
+    GetReferenceAltitude(refAltitude, refVerticalVelocity);
+  }
+}
+
+void UavStateMachine::GetDefaultReferenceAltitude(float &refAltitude,
+                                                  float &refVerticalVelocity) {
+  float zc, dzc;
+
+  switch (altitudeState) {
+  // initiate a takeoff: increase motor speed in open loop (see ComputeThrust)
+  // until we detect a take off of 0.03m (hard coded value) above the ground.
+  case AltitudeState_t::TakingOff: {
+    if (currentAltitude > groundAltitude + 0.03) {
+      altitudeTrajectory->StartTraj(currentAltitude,
+                                    desiredTakeoffAltitude->Value());
+      altitudeState = AltitudeState_t::Stabilized;
+      SignalEvent(Event_t::Stabilized);
+    }
+    break;
+  }
+  // landing, only check if we reach desired landing altitude
+  case AltitudeState_t::StartLanding: {
+    if (altitudeTrajectory->Position() == desiredLandingAltitude->Value()) {
+      // The Uav target altitude has reached its landing value (typically 0)
+      // but the real Uav altitude may not have reach this value yet because of
+      // command delay. Moreover, it
+      // may never exactly reach this value if the ground is not perfectly
+      // leveled (critical case: there's a
+      // deep and narrow hole right in the sensor line of sight). That's why we
+      // have a 2 phases landing strategy.
+      altitudeState = AltitudeState_t::FinishLanding;
+      SignalEvent(Event_t::FinishLanding);
+      joy->SetLedOFF(1); // DualShock3::led1
+    }
+  }
+  // stabilized: check if z trajectory is finished
+  case AltitudeState_t::Stabilized: {
+    if (!altitudeTrajectory->IsRunning() && !flagZTrajectoryFinished) {
+      SignalEvent(Event_t::ZTrajectoryFinished);
+      flagZTrajectoryFinished = true;
+    }
+    if (flagZTrajectoryFinished && desiredTakeoffAltitude->ValueChanged()) {
+      flagZTrajectoryFinished = false;
+      altitudeTrajectory->StartTraj(currentAltitude,
+                                    desiredTakeoffAltitude->Value());
+      joy->SetZRef(0);
+    }
+  }
+  }
+
+  // Récupère les consignes (du joystick dans l'implémentation par défaut). La
+  // consigne joystick est une vitesse ("delta_z", dzc). le zc est calculé par
+  // la manette
+  zc = joy->ZRef(); // a revoir, la position offset devrait se calculer dans le
+                    // generator
+  dzc = joy->DzRef();
+
+  // z control law
+  altitudeTrajectory->SetPositionOffset(zc);
+  altitudeTrajectory->SetSpeedOffset(dzc);
+
+  altitudeTrajectory->Update(GetTime());
+  refAltitude = altitudeTrajectory->Position();
+  refVerticalVelocity = altitudeTrajectory->Speed();
+}
+
+void UavStateMachine::GetReferenceAltitude(float &refAltitude,
+                                           float &refVerticalVelocity) {
+  Thread::Warn("Default GetReferenceAltitude method is not overloaded => "
+               "switching back to safe mode\n");
+  EnterFailSafeMode();
+};
+
+void UavStateMachine::ComputeThrust(void) {
+  if (altitudeMode == AltitudeMode_t::Manual) {
+    currentThrust = ComputeDefaultThrust();
+  } else {
+    currentThrust = ComputeCustomThrust();
+  }
+}
+
+float UavStateMachine::ComputeDefaultThrust(void) {
+  if (needToComputeDefaultThrust) {
+    // compute desired altitude
+    float refAltitude, refVerticalVelocity;
+    ComputeReferenceAltitude(refAltitude, refVerticalVelocity);
+
+    switch (altitudeState) {
+    case AltitudeState_t::TakingOff: {
+      // The progressive increase in motor speed is used to evaluate the motor
+      // speed that compensate the uav weight. This value
+      // will be used as an offset for altitude control afterwards
+      uZ->OffsetStepUp();
+      break;
+    }
+    case AltitudeState_t::StartLanding:
+    case AltitudeState_t::Stabilized: {
+      float p_error = currentAltitude - refAltitude;
+      float d_error = currentVerticalSpeed - refVerticalVelocity;
+      uZ->SetValues(p_error, d_error);
+      break;
+    }
+    // decrease motor speed in open loop until value offset_g , uav should have
+    // already landed or be very close to at this point
+    case AltitudeState_t::FinishLanding: {
+      if (uZ->OffsetStepDown() == false) {
+        StopMotors();
+      }
+      break;
+    }
+    }
+    uZ->Update(GetTime());
+
+    savedDefaultThrust = uZ->Output();
+    needToComputeDefaultThrust = false;
+  }
+
+  return savedDefaultThrust;
+}
+
+float UavStateMachine::ComputeCustomThrust(void) {
+  Thread::Warn("Default GetThrust method is not overloaded => switching back "
+               "to safe mode\n");
+  EnterFailSafeMode();
+  return ComputeDefaultThrust();
+}
+
+const AhrsData *UavStateMachine::ComputeReferenceOrientation(void) {
+  if (orientationMode == OrientationMode_t::Manual) {
+    return GetDefaultReferenceOrientation();
+  } else {
+    return GetReferenceOrientation();
+  }
+}
+
+const AhrsData *UavStateMachine::GetDefaultReferenceOrientation(void) const {
+  // We directly control yaw, pitch, roll angles
+  return joy->GetReferenceOrientation();
+}
+
+const AhrsData *UavStateMachine::GetReferenceOrientation(void) {
+  Thread::Warn("Default GetReferenceOrientation method is not overloaded => "
+               "switching back to safe mode\n");
+  EnterFailSafeMode();
+  return GetDefaultReferenceOrientation();
+}
+
+void UavStateMachine::ComputeTorques(void) {
+  if (torqueMode == TorqueMode_t::Default) {
+    ComputeDefaultTorques(currentTorques);
+  } else {
+    ComputeCustomTorques(currentTorques);
+  }
+}
+
+void UavStateMachine::ComputeDefaultTorques(Euler &torques) {
+  if (needToComputeDefaultTorques) {
+    const AhrsData *refOrientation = ComputeReferenceOrientation();
+    Quaternion refQuaternion;
+    Vector3D refAngularRates;
+    refOrientation->GetQuaternionAndAngularRates(refQuaternion,
+                                                 refAngularRates);
+    Euler refAngles = refQuaternion.ToEuler();
+    Euler currentAngles = currentQuaternion.ToEuler();
+
+    uYaw->SetValues(currentAngles.YawDistanceFrom(refAngles.yaw),
+                    currentAngularSpeed.z - refAngularRates.z);
+    uYaw->Update(GetTime());
+    torques.yaw = uYaw->Output();
+
+    uPitch->SetValues(refAngles.pitch, currentAngles.pitch,
+                      currentAngularSpeed.y);
+    uPitch->Update(GetTime());
+    torques.pitch = uPitch->Output();
+
+    uRoll->SetValues(refAngles.roll, currentAngles.roll, currentAngularSpeed.x);
+    uRoll->Update(GetTime());
+    torques.roll = uRoll->Output();
+
+    savedDefaultTorques = torques;
+    needToComputeDefaultTorques = false;
+  } else {
+    torques = savedDefaultTorques;
+  }
+}
+
+void UavStateMachine::ComputeCustomTorques(Euler &torques) {
+  Thread::Warn("Default ComputeCustomTorques method is not overloaded => "
+               "switching back to safe mode\n");
+  EnterFailSafeMode();
+  ComputeDefaultTorques(torques);
+}
+
+void UavStateMachine::TakeOff(void) {
+  flagZTrajectoryFinished = false;
+
+  if (altitudeState == AltitudeState_t::Stopped) { // &&
+    // GetBatteryMonitor()->IsBatteryLow()==false)
+    // The uav always takes off in fail safe mode
+    EnterFailSafeMode();
+    joy->SetLedOFF(4); // DualShock3::led4
+    joy->SetLedOFF(1); // DualShock3::led1
+    joy->Rumble(0x70);
+    joy->SetZRef(0);
+
+    uZ->SetOffset(); // positionne l'offset de compensation de la gravité à sa
+                     // valeur initiale (station sol)
+
+    uav->GetUavMultiplex()->LockUserInterface();
+    // Active les moteurs. Pouvoir les désactiver permet de pouvoir observer les
+    // consignes moteurs
+    // sans les faire tourner effectivement (en déplaçant à la main le drone)
+    uav->GetBldc()->SetEnabled(true);
+    groundAltitude = currentAltitude;
+    altitudeState = AltitudeState_t::TakingOff;
+
+    SignalEvent(Event_t::TakingOff);
+  } else {
+    joy->ErrorNotify();
+  }
+}
+
+void UavStateMachine::Land(void) {
+  if (altitudeMode != AltitudeMode_t::Manual) {
+    SetAltitudeMode(AltitudeMode_t::Manual);
+  }
+  if (altitudeState == AltitudeState_t::Stabilized) {
+    joy->SetLedOFF(4); // DualShock3::led4
+    joy->Rumble(0x70);
+
+    altitudeTrajectory->StopTraj();
+    joy->SetZRef(0);
+    altitudeTrajectory->StartTraj(
+        currentAltitude,
+        desiredLandingAltitude->Value()); // shouldn't it be groundAltitude?
+    SignalEvent(Event_t::StartLanding);
+    altitudeState = AltitudeState_t::StartLanding;
+  } else {
+    joy->ErrorNotify();
+  }
+}
+
+void UavStateMachine::SignalEvent(Event_t event) {
+  switch (event) {
+  case Event_t::StartLanding:
+    Thread::Info("Altitude: entering 'StartLanding' state\n");
+    break;
+  case Event_t::Stopped:
+    Thread::Info("Altitude: entering 'Stopped' state\n");
+    break;
+  case Event_t::TakingOff:
+    Thread::Info("Altitude: taking off\n");
+    break;
+  case Event_t::Stabilized:
+    Thread::Info("Altitude: entering 'Stabilized' state\n");
+    break;
+  case Event_t::FinishLanding:
+    Thread::Info("Altitude: entering 'FinishLanding' state\n");
+    break;
+  case Event_t::EmergencyStop:
+    Thread::Info("Emergency stop!\n");
+    break;
+  }
+}
+
+void UavStateMachine::EmergencyStop(void) {
+  if (altitudeState != AltitudeState_t::Stopped) {
+    StopMotors();
+    EnterFailSafeMode();
+    joy->Rumble(0x70);
+    SignalEvent(Event_t::EmergencyStop);
+  }
+}
+
+void UavStateMachine::StopMotors(void) {
+  joy->FlashLed(1, 10, 10); // DualShock3::led1
+  uav->GetBldc()->SetEnabled(false);
+  uav->GetUavMultiplex()->UnlockUserInterface();
+  SignalEvent(Event_t::Stopped);
+  altitudeState = AltitudeState_t::Stopped;
+  uav->GetAhrs()->UnlockUserInterface();
+
+  uZ->SetValues(0, 0);
+  uZ->Reset();
+}
+
+GridLayout *UavStateMachine::GetButtonsLayout(void) const {
+  return buttonslayout;
+}
+
+void UavStateMachine::SecurityCheck(void) {
+  MandatorySecurityCheck();
+  ExtraSecurityCheck();
+}
+
+void UavStateMachine::MandatorySecurityCheck(void) {
+  if (getFrameworkManager()->ConnectionLost() && !flagConnectionLost) {
+    flagConnectionLost = true;
+    Thread::Err("Connection lost\n");
+    EnterFailSafeMode();
+    if (altitudeState == AltitudeState_t::Stopped) {
+      SafeStop();
     } else {
-        GetOrientation()->GetQuaternionAndAngularRates(currentQuaternion, currentAngularSpeed);
-    }
-}
-
-const AhrsData *UavStateMachine::GetOrientation(void) const {
-    return GetDefaultOrientation();
-}
-
-const AhrsData *UavStateMachine::GetDefaultOrientation(void) const {
-    return uav->GetAhrs()->GetDatas();
-}
-
-void UavStateMachine::ComputeAltitude(void) {
-    if (failSafeMode) {
-        FailSafeAltitudeValues(currentAltitude, currentVerticalSpeed);
-    } else {
-        AltitudeValues(currentAltitude,currentVerticalSpeed);
-    }
-}
-
-void UavStateMachine::ComputeReferenceAltitude(float &refAltitude, float &refVerticalVelocity) {
-    if (altitudeMode==AltitudeMode_t::Manual) {
-        GetDefaultReferenceAltitude(refAltitude, refVerticalVelocity);
-    } else {
-        GetReferenceAltitude(refAltitude, refVerticalVelocity);
-    }
-}
-
-void UavStateMachine::GetDefaultReferenceAltitude(float &refAltitude, float &refVerticalVelocity) {
-    float zc,dzc;
-
-    switch(altitudeState) {
-        //initiate a takeoff: increase motor speed in open loop (see ComputeThrust) until we detect a take off of 0.03m (hard coded value) above the ground.
-        case AltitudeState_t::TakingOff: {
-            if(currentAltitude>groundAltitude+0.03) {
-                altitudeTrajectory->StartTraj(currentAltitude,desiredTakeoffAltitude->Value());
-                altitudeState=AltitudeState_t::Stabilized;
-                SignalEvent(Event_t::Stabilized);
-            }
-            break;
-        }
-        //landing, only check if we reach desired landing altitude
-        case AltitudeState_t::StartLanding: {
-            if(altitudeTrajectory->Position()==desiredLandingAltitude->Value()) {
-                //The Uav target altitude has reached its landing value (typically 0)
-                // but the real Uav altitude may not have reach this value yet because of command delay. Moreover, it
-                // may never exactly reach this value if the ground is not perfectly leveled (critical case: there's a
-                // deep and narrow hole right in the sensor line of sight). That's why we have a 2 phases landing strategy.
-                altitudeState=AltitudeState_t::FinishLanding;
-                SignalEvent(Event_t::FinishLanding);
-                joy->SetLedOFF(1);//DualShock3::led1
-            }
-        }
-        //stabilized: check if z trajectory is finished
-        case AltitudeState_t::Stabilized: {
-            if(!altitudeTrajectory->IsRunning() && !flagZTrajectoryFinished) {
-                SignalEvent(Event_t::ZTrajectoryFinished);
-                flagZTrajectoryFinished=true;
-            }
-            if(flagZTrajectoryFinished && desiredTakeoffAltitude->ValueChanged()) {
-                flagZTrajectoryFinished=false;
-                altitudeTrajectory->StartTraj(currentAltitude,desiredTakeoffAltitude->Value());
-                joy->SetZRef(0);
-            }
-        }
-    }
-
-    //Récupère les consignes (du joystick dans l'implémentation par défaut). La consigne joystick est une vitesse ("delta_z", dzc). le zc est calculé par la manette
-    zc=joy->ZRef();//a revoir, la position offset devrait se calculer dans le generator
-    dzc=joy->DzRef();
-
-    //z control law
-    altitudeTrajectory->SetPositionOffset(zc);
-    altitudeTrajectory->SetSpeedOffset(dzc);
-
-    altitudeTrajectory->Update(GetTime());
-    refAltitude=altitudeTrajectory->Position();
-    refVerticalVelocity=altitudeTrajectory->Speed();
-}
-
-void UavStateMachine::GetReferenceAltitude(float &refAltitude, float &refVerticalVelocity) {
-    Thread::Warn("Default GetReferenceAltitude method is not overloaded => switching back to safe mode\n");
+      Land();
+    }
+  }
+  if ((altitudeState == AltitudeState_t::TakingOff ||
+       altitudeState == AltitudeState_t::Stabilized) &&
+      uav->GetBatteryMonitor()->IsBatteryLow() && !flagBatteryLow) {
+    flagBatteryLow = true;
+    Printf("Battery Low\n");
     EnterFailSafeMode();
-};
-
-void UavStateMachine::ComputeThrust(void) {
-    if (altitudeMode==AltitudeMode_t::Manual) {
-        currentThrust=ComputeDefaultThrust();
-    } else {
-        currentThrust=ComputeCustomThrust();
-    }
-}
-
-float UavStateMachine::ComputeDefaultThrust(void) {
-    if(needToComputeDefaultThrust) {
-        //compute desired altitude
-        float refAltitude, refVerticalVelocity;
-        ComputeReferenceAltitude(refAltitude, refVerticalVelocity);
-
-        switch(altitudeState) {
-            case AltitudeState_t::TakingOff: {
-                //The progressive increase in motor speed is used to evaluate the motor speed that compensate the uav weight. This value
-                //will be used as an offset for altitude control afterwards
-                uZ->OffsetStepUp();
-                break;
-            }
-            case AltitudeState_t::StartLanding:
-            case AltitudeState_t::Stabilized: {
-                float p_error=currentAltitude-refAltitude;
-                float d_error=currentVerticalSpeed-refVerticalVelocity;
-                uZ->SetValues(p_error,d_error);
-                break;
-            }
-            //decrease motor speed in open loop until value offset_g , uav should have already landed or be very close to at this point
-            case AltitudeState_t::FinishLanding: {
-                if(uZ->OffsetStepDown()==false) {
-                    StopMotors();
-                }
-                break;
-            }
-        }
-        uZ->Update(GetTime());
-
-        savedDefaultThrust=uZ->Output();
-        needToComputeDefaultThrust=false;
-    }
-
-    return savedDefaultThrust;
-}
-
-float UavStateMachine::ComputeCustomThrust(void) {
-    Thread::Warn("Default GetThrust method is not overloaded => switching back to safe mode\n");
-    EnterFailSafeMode();
-    return ComputeDefaultThrust();
-}
-
-const AhrsData* UavStateMachine::ComputeReferenceOrientation(void) {
-    if(orientationMode==OrientationMode_t::Manual) {
-        return GetDefaultReferenceOrientation();
-    } else {
-        return GetReferenceOrientation();
-    }
-}
-
-const AhrsData* UavStateMachine::GetDefaultReferenceOrientation(void) const {
-    // We directly control yaw, pitch, roll angles
-    return joy->GetReferenceOrientation();
-}
-
-const AhrsData* UavStateMachine::GetReferenceOrientation(void) {
-    Thread::Warn("Default GetReferenceOrientation method is not overloaded => switching back to safe mode\n");
-    EnterFailSafeMode();
-    return GetDefaultReferenceOrientation();
-}
-
-void UavStateMachine::ComputeTorques(void) {
-    if(torqueMode==TorqueMode_t::Default) {
-        ComputeDefaultTorques(currentTorques);
-    } else {
-        ComputeCustomTorques(currentTorques);
-    }
-}
-
-void UavStateMachine::ComputeDefaultTorques(Euler &torques) {
-    if(needToComputeDefaultTorques) {
-        const AhrsData *refOrientation=ComputeReferenceOrientation();
-        Quaternion refQuaternion;
-        Vector3D refAngularRates;
-        refOrientation->GetQuaternionAndAngularRates(refQuaternion,refAngularRates);
-        Euler refAngles=refQuaternion.ToEuler();
-        Euler currentAngles=currentQuaternion.ToEuler();
-
-        uYaw->SetValues(currentAngles.YawDistanceFrom(refAngles.yaw),currentAngularSpeed.z-refAngularRates.z);
-        uYaw->Update(GetTime());
-        torques.yaw=uYaw->Output();
-
-        uPitch->SetValues(refAngles.pitch,currentAngles.pitch,currentAngularSpeed.y);
-        uPitch->Update(GetTime());
-        torques.pitch=uPitch->Output();
-
-        uRoll->SetValues(refAngles.roll,currentAngles.roll,currentAngularSpeed.x);
-        uRoll->Update(GetTime());
-        torques.roll=uRoll->Output();
-
-        savedDefaultTorques=torques;
-        needToComputeDefaultTorques=false;
-    } else {
-        torques=savedDefaultTorques;
-    }
-}
-
-void UavStateMachine::ComputeCustomTorques(Euler &torques) {
-    Thread::Warn("Default ComputeCustomTorques method is not overloaded => switching back to safe mode\n");
-    EnterFailSafeMode();
-    ComputeDefaultTorques(torques);
-}
-
-void UavStateMachine::TakeOff(void) {
-    flagZTrajectoryFinished=false;
-
-    if(altitudeState==AltitudeState_t::Stopped) {// && GetBatteryMonitor()->IsBatteryLow()==false)
-        //The uav always takes off in fail safe mode
-        EnterFailSafeMode();
-        joy->SetLedOFF(4);//DualShock3::led4
-        joy->SetLedOFF(1);//DualShock3::led1
-        joy->Rumble(0x70);
-        joy->SetZRef(0);
-
-        uZ->SetOffset(); // positionne l'offset de compensation de la gravité à sa valeur initiale (station sol)
-
-        uav->GetUavMultiplex()->LockUserInterface();
-        //Active les moteurs. Pouvoir les désactiver permet de pouvoir observer les consignes moteurs
-        // sans les faire tourner effectivement (en déplaçant à la main le drone)
-        uav->GetBldc()->SetEnabled(true);
-        groundAltitude=currentAltitude;
-        altitudeState=AltitudeState_t::TakingOff;
-
-        SignalEvent(Event_t::TakingOff);
-    } else {
+    Land();
+  }
+}
+
+void UavStateMachine::CheckJoystick(void) {
+  GenericCheckJoystick();
+  ExtraCheckJoystick();
+}
+
+void UavStateMachine::GenericCheckJoystick(void) {
+  static bool isEmergencyStopButtonPressed = false;
+  static bool isTakeOffButtonPressed = false;
+  static bool isSafeModeButtonPressed = false;
+
+  if (joy->IsButtonPressed(1)) { // select
+    if (!isEmergencyStopButtonPressed) {
+      isEmergencyStopButtonPressed = true;
+      Thread::Info("Emergency stop from joystick\n");
+      EmergencyStop();
+    }
+  } else
+    isEmergencyStopButtonPressed = false;
+
+  if (joy->IsButtonPressed(0)) { // start
+    if (!isTakeOffButtonPressed) {
+      isTakeOffButtonPressed = true;
+      switch (altitudeState) {
+      case AltitudeState_t::Stopped:
+        TakeOff();
+        break;
+      case AltitudeState_t::Stabilized:
+        Land();
+        break;
+      default:
         joy->ErrorNotify();
-    }
-}
-
-void UavStateMachine::Land(void) {
-    if (altitudeMode!=AltitudeMode_t::Manual) {
-        SetAltitudeMode(AltitudeMode_t::Manual);
-    }
-    if(altitudeState==AltitudeState_t::Stabilized) {
-        joy->SetLedOFF(4);//DualShock3::led4
-        joy->Rumble(0x70);
-
-        altitudeTrajectory->StopTraj();
-        joy->SetZRef(0);
-        altitudeTrajectory->StartTraj(currentAltitude,desiredLandingAltitude->Value()); //shouldn't it be groundAltitude?
-        SignalEvent(Event_t::StartLanding);
-        altitudeState=AltitudeState_t::StartLanding;
-    } else {
-        joy->ErrorNotify();
-    }
-}
-
-void UavStateMachine::SignalEvent(Event_t event) {
-    switch(event) {
-    case Event_t::StartLanding:
-        Thread::Info("Altitude: entering 'StartLanding' state\n");
         break;
-    case Event_t::Stopped:
-        Thread::Info("Altitude: entering 'Stopped' state\n");
-        break;
-    case Event_t::TakingOff:
-        Thread::Info("Altitude: taking off\n");
-        break;
-    case Event_t::Stabilized:
-        Thread::Info("Altitude: entering 'Stabilized' state\n");
-        break;
-    case Event_t::FinishLanding:
-        Thread::Info("Altitude: entering 'FinishLanding' state\n");
-        break;
-    case Event_t::EmergencyStop:
-        Thread::Info("Emergency stop!\n");
-        break;
-    }
-}
-
-void UavStateMachine::EmergencyStop(void) {
-    if(altitudeState!=AltitudeState_t::Stopped) {
-        StopMotors();
-        EnterFailSafeMode();
-        joy->Rumble(0x70);
-        SignalEvent(Event_t::EmergencyStop);
-    }
-}
-
-void UavStateMachine::StopMotors(void)
-{
-    joy->FlashLed(1,10,10);//DualShock3::led1
-    uav->GetBldc()->SetEnabled(false);
-    uav->GetUavMultiplex()->UnlockUserInterface();
-    SignalEvent(Event_t::Stopped);
-    altitudeState=AltitudeState_t::Stopped;
-    uav->GetAhrs()->UnlockUserInterface();
-
-    uZ->SetValues(0,0);
-    uZ->Reset();
-}
-
-GridLayout* UavStateMachine::GetButtonsLayout(void) const {
-    return buttonslayout;
-}
-
-void UavStateMachine::SecurityCheck(void) {
-    MandatorySecurityCheck();
-    ExtraSecurityCheck();
-}
-
-void UavStateMachine::MandatorySecurityCheck(void) {
-    if(getFrameworkManager()->ConnectionLost() && !flagConnectionLost) {
-        flagConnectionLost=true;
-        Thread::Err("Connection lost\n");
-        EnterFailSafeMode();
-        if(altitudeState==AltitudeState_t::Stopped) {
-            SafeStop();
-        } else {
-            Land();
-        }
-    }
-    if((altitudeState==AltitudeState_t::TakingOff || altitudeState==AltitudeState_t::Stabilized) && uav->GetBatteryMonitor()->IsBatteryLow() && !flagBatteryLow) {
-        flagBatteryLow=true;
-        Printf("Battery Low\n");
-        EnterFailSafeMode();
-        Land();
-    }
-}
-
-void UavStateMachine::CheckJoystick(void) {
-    GenericCheckJoystick();
-    ExtraCheckJoystick();
-}
-
-void UavStateMachine::GenericCheckJoystick(void) {
-    static bool isEmergencyStopButtonPressed=false;
-    static bool isTakeOffButtonPressed=false;
-    static bool isSafeModeButtonPressed=false;
-
-   if(joy->IsButtonPressed(1)) { //select
-        if (!isEmergencyStopButtonPressed) {
-            isEmergencyStopButtonPressed=true;
-            Thread::Info("Emergency stop from joystick\n");
-            EmergencyStop();
-        }
-    } else isEmergencyStopButtonPressed=false;
-
-    if(joy->IsButtonPressed(0)) { //start
-        if (!isTakeOffButtonPressed) {
-            isTakeOffButtonPressed=true;
-            switch(altitudeState) {
-                case AltitudeState_t::Stopped:
-                    TakeOff();
-                    break;
-                case AltitudeState_t::Stabilized:
-                    Land();
-                    break;
-                default:
-                    joy->ErrorNotify();
-                    break;
-            }
-        }
-    } else isTakeOffButtonPressed=false;
-
-    //cross
-    //gsanahuj:conflict with Majd programs.
-    //check if l1,l2,r1 and r2 are not pressed
-    //to allow a combination in user program
-    if(joy->IsButtonPressed(5) && !joy->IsButtonPressed(6) && !joy->IsButtonPressed(7) && !joy->IsButtonPressed(9) && !joy->IsButtonPressed(10)) {
-        if (!isSafeModeButtonPressed) {
-            isSafeModeButtonPressed=true;
-            Thread::Info("Entering fail safe mode\n");
-            EnterFailSafeMode();
-        }
-    } else isSafeModeButtonPressed=false;
+      }
+    }
+  } else
+    isTakeOffButtonPressed = false;
+
+  // cross
+  // gsanahuj:conflict with Majd programs.
+  // check if l1,l2,r1 and r2 are not pressed
+  // to allow a combination in user program
+  if (joy->IsButtonPressed(5) && !joy->IsButtonPressed(6) &&
+      !joy->IsButtonPressed(7) && !joy->IsButtonPressed(9) &&
+      !joy->IsButtonPressed(10)) {
+    if (!isSafeModeButtonPressed) {
+      isSafeModeButtonPressed = true;
+      Thread::Info("Entering fail safe mode\n");
+      EnterFailSafeMode();
+    }
+  } else
+    isSafeModeButtonPressed = false;
 }
 
 void UavStateMachine::CheckPushButton(void) {
-    GenericCheckPushButton();
-    ExtraCheckPushButton();
+  GenericCheckPushButton();
+  ExtraCheckPushButton();
 }
 
 void UavStateMachine::GenericCheckPushButton(void) {
-    if(button_kill->Clicked()==true) SafeStop();
-    if(button_take_off->Clicked()==true) TakeOff();
-    if(button_land->Clicked()==true) Land();
-    if(button_start_log->Clicked()==true) getFrameworkManager()->StartLog();
-    if(button_stop_log->Clicked()==true) getFrameworkManager()->StopLog();
+  if (button_kill->Clicked() == true)
+    SafeStop();
+  if (button_take_off->Clicked() == true)
+    TakeOff();
+  if (button_land->Clicked() == true)
+    Land();
+  if (button_start_log->Clicked() == true)
+    getFrameworkManager()->StartLog();
+  if (button_stop_log->Clicked() == true)
+    getFrameworkManager()->StopLog();
 }
 
 void UavStateMachine::EnterFailSafeMode(void) {
-    SetAltitudeMode(AltitudeMode_t::Manual);
-    SetOrientationMode(OrientationMode_t::Manual);
-    SetThrustMode(ThrustMode_t::Default);
-    SetTorqueMode(TorqueMode_t::Default);
-
-    GetDefaultOrientation()->GetQuaternionAndAngularRates(currentQuaternion, currentAngularSpeed);
-    joy->SetYawRef(currentQuaternion);
+  SetAltitudeMode(AltitudeMode_t::Manual);
+  SetOrientationMode(OrientationMode_t::Manual);
+  SetThrustMode(ThrustMode_t::Default);
+  SetTorqueMode(TorqueMode_t::Default);
+
+  GetDefaultOrientation()->GetQuaternionAndAngularRates(currentQuaternion,
+                                                        currentAngularSpeed);
+  joy->SetYawRef(currentQuaternion);
+  uYaw->Reset();
+  uPitch->Reset();
+  uRoll->Reset();
+
+  failSafeMode = true;
+  SignalEvent(Event_t::EnteringFailSafeMode);
+}
+
+bool UavStateMachine::ExitFailSafeMode(void) {
+  // only exit fail safe mode if in Stabilized altitude state
+  // gsanahuj: pour la demo inaugurale on ne peut pas etre en failsafe
+  // le ruban perturbe l'us
+  /*
+    if (altitudeState!=AltitudeState_t::Stabilized) {
+        return false;
+    } else*/ {
+    failSafeMode = false;
+    return true;
+  }
+}
+
+bool UavStateMachine::SetTorqueMode(TorqueMode_t const &newTorqueMode) {
+  if ((newTorqueMode == TorqueMode_t::Custom) && (failSafeMode)) {
+    if (!ExitFailSafeMode())
+      return false;
+  }
+  // When transitionning from Custom to Default torque mode, we should reset the
+  // default control laws
+  if ((torqueMode == TorqueMode_t::Custom) &&
+      (newTorqueMode == TorqueMode_t::Default)) {
     uYaw->Reset();
     uPitch->Reset();
     uRoll->Reset();
-
-    failSafeMode=true;
-    SignalEvent(Event_t::EnteringFailSafeMode);
-}
-
-bool UavStateMachine::ExitFailSafeMode(void) {
-    // only exit fail safe mode if in Stabilized altitude state
-    //gsanahuj: pour la demo inaugurale on ne peut pas etre en failsafe
-    //le ruban perturbe l'us
-    /*
-    if (altitudeState!=AltitudeState_t::Stabilized) {
-        return false;
-    } else*/ {
-        failSafeMode=false;
-        return true;
-    }
-}
-
-bool UavStateMachine::SetTorqueMode(TorqueMode_t const &newTorqueMode) {
-    if ((newTorqueMode==TorqueMode_t::Custom) && (failSafeMode)) {
-        if (!ExitFailSafeMode()) return false;
-    }
-    //When transitionning from Custom to Default torque mode, we should reset the default control laws
-    if ((torqueMode==TorqueMode_t::Custom) && (newTorqueMode==TorqueMode_t::Default)) {
-        uYaw->Reset();
-        uPitch->Reset();
-        uRoll->Reset();
-    }
-    torqueMode=newTorqueMode;
-    return true;
+  }
+  torqueMode = newTorqueMode;
+  return true;
 }
 
 bool UavStateMachine::SetAltitudeMode(AltitudeMode_t const &newAltitudeMode) {
-    if ((newAltitudeMode==AltitudeMode_t::Custom) && (failSafeMode)) {
-        if (!ExitFailSafeMode()) return false;
-    }
-    altitudeMode=newAltitudeMode;
-    GotoAltitude(desiredTakeoffAltitude->Value());
-
-    return true;
+  if ((newAltitudeMode == AltitudeMode_t::Custom) && (failSafeMode)) {
+    if (!ExitFailSafeMode())
+      return false;
+  }
+  altitudeMode = newAltitudeMode;
+  GotoAltitude(desiredTakeoffAltitude->Value());
+
+  return true;
 }
 
 bool UavStateMachine::GotoAltitude(float desiredAltitude) {
-    if (altitudeMode!=AltitudeMode_t::Manual) {
-        return false;
-    }
-    altitudeTrajectory->StartTraj(uav->GetMetaUsRangeFinder()->z(),desiredAltitude);
-    return true;
-}
-
-bool UavStateMachine::SetOrientationMode(OrientationMode_t const &newOrientationMode) {
-    if ((newOrientationMode==OrientationMode_t::Custom) && (failSafeMode)) {
-        if (!ExitFailSafeMode()) return false;
-    }
-    //When transitionning from Custom to Manual mode we must reset to yaw reference to the current absolute yaw angle,
-    // overwise the Uav will abruptly change orientation
-    if ((orientationMode==OrientationMode_t::Custom) && (newOrientationMode==OrientationMode_t::Manual)) {
-        joy->SetYawRef(currentQuaternion);
-    }
-    orientationMode=newOrientationMode;
-    return true;
+  if (altitudeMode != AltitudeMode_t::Manual) {
+    return false;
+  }
+  altitudeTrajectory->StartTraj(uav->GetMetaUsRangeFinder()->z(),
+                                desiredAltitude);
+  return true;
+}
+
+bool UavStateMachine::SetOrientationMode(
+    OrientationMode_t const &newOrientationMode) {
+  if ((newOrientationMode == OrientationMode_t::Custom) && (failSafeMode)) {
+    if (!ExitFailSafeMode())
+      return false;
+  }
+  // When transitionning from Custom to Manual mode we must reset to yaw
+  // reference to the current absolute yaw angle,
+  // overwise the Uav will abruptly change orientation
+  if ((orientationMode == OrientationMode_t::Custom) &&
+      (newOrientationMode == OrientationMode_t::Manual)) {
+    joy->SetYawRef(currentQuaternion);
+  }
+  orientationMode = newOrientationMode;
+  return true;
 }
 
 bool UavStateMachine::SetThrustMode(ThrustMode_t const &newThrustMode) {
-    if ((newThrustMode==ThrustMode_t::Custom) && (failSafeMode)) {
-        if (!ExitFailSafeMode()) return false;
-    }
-    thrustMode=newThrustMode;
-    return true;
-}
+  if ((newThrustMode == ThrustMode_t::Custom) && (failSafeMode)) {
+    if (!ExitFailSafeMode())
+      return false;
+  }
+  thrustMode = newThrustMode;
+  return true;
+}
Index: trunk/lib/FlairMeta/src/UavStateMachine.h
===================================================================
--- trunk/lib/FlairMeta/src/UavStateMachine.h	(revision 14)
+++ trunk/lib/FlairMeta/src/UavStateMachine.h	(revision 15)
@@ -26,281 +26,275 @@
 
 namespace flair {
-    namespace core {
-        class FrameworkManager;
-        class AhrsData;
-        class io_data;
-    }
-    namespace gui {
-        class PushButton;
-        class GridLayout;
-        class Tab;
-        class DoubleSpinBox;
-    }
-    namespace filter {
-        class ControlLaw;
-        class NestedSat;
-        class Pid;
-        class PidThrust;
-        class TrajectoryGenerator1D;
-    }
-    namespace sensor {
-        class TargetController;
-    }
-    namespace meta {
-        class MetaDualShock3;
-        class Uav;
-    }
-}
-
-namespace flair { namespace meta {
-
- /*! \class UavStateMachine
+namespace core {
+class FrameworkManager;
+class AhrsData;
+class io_data;
+}
+namespace gui {
+class PushButton;
+class GridLayout;
+class Tab;
+class DoubleSpinBox;
+}
+namespace filter {
+class ControlLaw;
+class NestedSat;
+class Pid;
+class PidThrust;
+class TrajectoryGenerator1D;
+}
+namespace sensor {
+class TargetController;
+}
+namespace meta {
+class MetaDualShock3;
+class Uav;
+}
+}
+
+namespace flair {
+namespace meta {
+
+/*! \class UavStateMachine
 *
 * \brief State machine for UAV
 *
-* thread synchronized with ahrs, unless a period is set with SetPeriodUS or SetPeriodMS
+* thread synchronized with ahrs, unless a period is set with SetPeriodUS or
+*SetPeriodMS
 */
 
-class UavStateMachine : public core::Thread
-{
-    protected:
-        enum class AltitudeMode_t {
-            Manual,
-            Custom
-        };
-        const AltitudeMode_t &GetAltitudeMode(void) const {
-            return altitudeMode;
-        }
-        bool SetAltitudeMode(const AltitudeMode_t &altitudeMode);
-
-        //uses TrajectoryGenerator1D *altitudeTrajectory to go to desiredAltitude
-        //available in mode AltitudeMode_t::Manual
-        //return true if goto is possible
-        bool GotoAltitude(float desiredAltitude);
-
-        enum class OrientationMode_t {
-            Manual,
-            Custom
-        };
-        const OrientationMode_t &GetOrientationMode(void) const {
-            return orientationMode;
-        }
-        bool SetOrientationMode(const OrientationMode_t &orientationMode);
-
-        enum class ThrustMode_t {
-            Default,
-            Custom
-        };
-        const ThrustMode_t &GetThrustMode() const {
-            return thrustMode;
-        }
-        bool SetThrustMode(const ThrustMode_t &thrustMode);
-
-        enum class TorqueMode_t {
-            Default,
-            Custom
-        };
-        const TorqueMode_t &GetTorqueMode(void) const {
-            return torqueMode;
-        }
-        bool SetTorqueMode(const TorqueMode_t &torqueMode);
-
-        enum class Event_t {
-            EnteringFailSafeMode,
-            EnteringControlLoop,
-            StartLanding,
-            FinishLanding,
-            Stopped,
-            TakingOff,
-            EmergencyStop,
-            Stabilized, //as soon as uav is 3cm far from the ground
-            ZTrajectoryFinished,
-        };
-
-        UavStateMachine(meta::Uav* uav,uint16_t ds3Port=20000);
-        ~UavStateMachine();
-
-        const core::Quaternion &GetCurrentQuaternion(void) const;
-
-        const core::Vector3D &GetCurrentAngularSpeed(void) const;
-
-        const meta::Uav *GetUav(void) const;
-
-        void Land(void);
-        void TakeOff(void);
-        void EmergencyStop(void);
-        //! Used to signal an event
-        /*!
-            \param event the event which occured
-        */
-        virtual void SignalEvent(Event_t event);
-
-        virtual const core::AhrsData *GetOrientation(void) const;
-        const core::AhrsData *GetDefaultOrientation(void) const;
-
-        virtual void AltitudeValues(float &z,float &dz) const;//in uav coordinate!
-        void EnterFailSafeMode(void);
-        bool ExitFailSafeMode(void);
-        void FailSafeAltitudeValues(float &z,float &dz) const;//in uav coordinate!
-
-        gui::GridLayout *GetButtonsLayout(void) const;
-        virtual void ExtraSecurityCheck(void){};
-        virtual void ExtraCheckJoystick(void){};
-        virtual void ExtraCheckPushButton(void){};
-
-        void GetDefaultReferenceAltitude(float &refAltitude, float &refVerticalVelocity);
-        virtual void GetReferenceAltitude(float &refAltitude, float &refVerticalVelocity);
-        //float GetDefaultThrustOffset(void);
-        const core::AhrsData *GetDefaultReferenceOrientation(void) const;
-        virtual const core::AhrsData *GetReferenceOrientation(void);
-
-        /*!
-        * \brief Compute Custom Torques
-        *
-        * Reimplement this method to use TorqueMode_t::Custom. \n
-        * This method is called internally by UavStateMachine, do not call it by yourself. \n
-        * See GetTorques if you need torques values.
-        *
-        * \param torques custom torques
-        */
-        virtual void ComputeCustomTorques(core::Euler &torques);
-
-        /*!
-        * \brief Compute Default Torques
-        *
-        * This method is called internally by UavStateMachine when using TorqueMode_t::Default. \n
-        * Torques are only computed once by loop, other calls to this method will use previously computed torques.
-        *
-        * \param torques default torques
-        */
-        void ComputeDefaultTorques(core::Euler &torques);
-
-        /*!
-        * \brief Get Torques
-        *
-        * \return torques current torques
-        */
-        //const core::Euler &GetTorques() const;
-
-        /*!
-        * \brief Compute Custom Thrust
-        *
-        * Reimplement this method to use ThrustMode_t::Custom. \n
-        * This method is called internally by UavStateMachine, do not call it by yourself. \n
-        * See GetThrust if you need thrust value.
-        *
-        * \return custom Thrust
-        */
-        virtual float ComputeCustomThrust(void);
-
-        /*!
-        * \brief Compute Default Thrust
-        *
-        * This method is called internally by UavStateMachine when using ThrustMode_t::Default. \n
-        * Thrust is only computed once by loop, other calls to this method will use previously computed thrust.
-        *
-        * \return default thrust
-        */
-        float ComputeDefaultThrust(void);
-
-        /*!
-        * \brief Get Thrust
-        *
-        * \return current thrust
-        */
-        //float GetThrust() const;
-
-        /*!
-        * \brief Add an IODevice to the control law logs
-        *
-        * The IODevice will be automatically logged among the Uz logs,
-        * if logging is enabled (see IODevice::SetDataToLog, FrameworkManager::StartLog
-        * and FrameworkManager::AddDeviceToLog). \n
-        *
-        * \param device IODevice to log
-        */
-        void AddDeviceToControlLawLog(const core::IODevice* device);
-
-        /*!
-        * \brief Add an io_data to the control law logs
-        *
-        * The io_data will be automatically logged among the Uz logs,
-        * if logging is enabled (see IODevice::SetDataToLog, FrameworkManager::StartLog
-        * and FrameworkManager::AddDeviceToLog). \n
-        *
-        * \param data io_data to log
-        */
-        void AddDataToControlLawLog(const core::io_data* data);
-
-        const sensor::TargetController *GetJoystick(void) const;
-
-        gui::Tab *setupLawTab,*graphLawTab;
-
-    private:
-        /*!
-        \enum AltitudeState_t
-        \brief States of the altitude state machine
-        */
-        enum class AltitudeState_t {
-            Stopped,        /*!< the uav motors are stopped */
-            TakingOff,      /*!< take off initiated. Motors accelerate progressively until the UAV lift up */
-            Stabilized,     /*!< the uav is actively maintaining its altitude */
-            StartLanding,   /*!< landing initiated. Altitude is required to reach the landing altitude (0 by default) */
-            FinishLanding   /*!< motors are gradually stopped */
-        };
-        AltitudeState_t altitudeState;
-        void ProcessAltitudeFiniteStateMachine();
-        void ComputeReferenceAltitude(float &refAltitude, float &refVerticalVelocity);
-
-
-        float groundAltitude; // effective altitude when the uav leaves the ground
-        float currentAltitude,currentVerticalSpeed;
-
-        bool failSafeMode;
-        void SecurityCheck(void);
-        void MandatorySecurityCheck(void);
-        void CheckJoystick();
-        void GenericCheckJoystick();
-        void CheckPushButton(void);
-        void GenericCheckPushButton(void);
-        void Run(void);
-        void StopMotors(void);
-
-        meta::Uav *uav;
-
-        core::Quaternion currentQuaternion;
-        core::Vector3D currentAngularSpeed;
-
-        const core::AhrsData *ComputeReferenceOrientation(void);
-
-        void ComputeOrientation(void);
-        void ComputeAltitude(void);
-
-        void ComputeTorques(void);
-        core::Euler currentTorques,savedDefaultTorques;
-        bool needToComputeDefaultTorques;
-
-        void ComputeThrust(void);
-        float currentThrust,savedDefaultThrust;
-        bool needToComputeDefaultThrust;
-
-        gui::PushButton *button_kill,*button_take_off,*button_land,*button_start_log,*button_stop_log;
-        gui::GridLayout *buttonslayout;
-        gui::DoubleSpinBox *desiredTakeoffAltitude,*desiredLandingAltitude;
-        AltitudeMode_t altitudeMode;
-        OrientationMode_t orientationMode;
-        ThrustMode_t thrustMode;
-        TorqueMode_t torqueMode;
-        bool flagBatteryLow;
-        bool flagConnectionLost;
-        bool flagZTrajectoryFinished;
-        filter::NestedSat *uRoll,*uPitch;
-        filter::Pid *uYaw;
-        filter::PidThrust *uZ;
-
-        MetaDualShock3 *joy;
-        filter::TrajectoryGenerator1D *altitudeTrajectory;
+class UavStateMachine : public core::Thread {
+protected:
+  enum class AltitudeMode_t { Manual, Custom };
+  const AltitudeMode_t &GetAltitudeMode(void) const { return altitudeMode; }
+  bool SetAltitudeMode(const AltitudeMode_t &altitudeMode);
+
+  // uses TrajectoryGenerator1D *altitudeTrajectory to go to desiredAltitude
+  // available in mode AltitudeMode_t::Manual
+  // return true if goto is possible
+  bool GotoAltitude(float desiredAltitude);
+
+  enum class OrientationMode_t { Manual, Custom };
+  const OrientationMode_t &GetOrientationMode(void) const {
+    return orientationMode;
+  }
+  bool SetOrientationMode(const OrientationMode_t &orientationMode);
+
+  enum class ThrustMode_t { Default, Custom };
+  const ThrustMode_t &GetThrustMode() const { return thrustMode; }
+  bool SetThrustMode(const ThrustMode_t &thrustMode);
+
+  enum class TorqueMode_t { Default, Custom };
+  const TorqueMode_t &GetTorqueMode(void) const { return torqueMode; }
+  bool SetTorqueMode(const TorqueMode_t &torqueMode);
+
+  enum class Event_t {
+    EnteringFailSafeMode,
+    EnteringControlLoop,
+    StartLanding,
+    FinishLanding,
+    Stopped,
+    TakingOff,
+    EmergencyStop,
+    Stabilized, // as soon as uav is 3cm far from the ground
+    ZTrajectoryFinished,
+  };
+
+  UavStateMachine(meta::Uav *uav, uint16_t ds3Port = 20000);
+  ~UavStateMachine();
+
+  const core::Quaternion &GetCurrentQuaternion(void) const;
+
+  const core::Vector3D &GetCurrentAngularSpeed(void) const;
+
+  const meta::Uav *GetUav(void) const;
+
+  void Land(void);
+  void TakeOff(void);
+  void EmergencyStop(void);
+  //! Used to signal an event
+  /*!
+      \param event the event which occured
+  */
+  virtual void SignalEvent(Event_t event);
+
+  virtual const core::AhrsData *GetOrientation(void) const;
+  const core::AhrsData *GetDefaultOrientation(void) const;
+
+  virtual void AltitudeValues(float &z, float &dz) const; // in uav coordinate!
+  void EnterFailSafeMode(void);
+  bool ExitFailSafeMode(void);
+  void FailSafeAltitudeValues(float &z, float &dz) const; // in uav coordinate!
+
+  gui::GridLayout *GetButtonsLayout(void) const;
+  virtual void ExtraSecurityCheck(void){};
+  virtual void ExtraCheckJoystick(void){};
+  virtual void ExtraCheckPushButton(void){};
+
+  void GetDefaultReferenceAltitude(float &refAltitude,
+                                   float &refVerticalVelocity);
+  virtual void GetReferenceAltitude(float &refAltitude,
+                                    float &refVerticalVelocity);
+  // float GetDefaultThrustOffset(void);
+  const core::AhrsData *GetDefaultReferenceOrientation(void) const;
+  virtual const core::AhrsData *GetReferenceOrientation(void);
+
+  /*!
+  * \brief Compute Custom Torques
+  *
+  * Reimplement this method to use TorqueMode_t::Custom. \n
+  * This method is called internally by UavStateMachine, do not call it by
+  *yourself. \n
+  * See GetTorques if you need torques values.
+  *
+  * \param torques custom torques
+  */
+  virtual void ComputeCustomTorques(core::Euler &torques);
+
+  /*!
+  * \brief Compute Default Torques
+  *
+  * This method is called internally by UavStateMachine when using
+  *TorqueMode_t::Default. \n
+  * Torques are only computed once by loop, other calls to this method will use
+  *previously computed torques.
+  *
+  * \param torques default torques
+  */
+  void ComputeDefaultTorques(core::Euler &torques);
+
+  /*!
+  * \brief Get Torques
+  *
+  * \return torques current torques
+  */
+  // const core::Euler &GetTorques() const;
+
+  /*!
+  * \brief Compute Custom Thrust
+  *
+  * Reimplement this method to use ThrustMode_t::Custom. \n
+  * This method is called internally by UavStateMachine, do not call it by
+  *yourself. \n
+  * See GetThrust if you need thrust value.
+  *
+  * \return custom Thrust
+  */
+  virtual float ComputeCustomThrust(void);
+
+  /*!
+  * \brief Compute Default Thrust
+  *
+  * This method is called internally by UavStateMachine when using
+  *ThrustMode_t::Default. \n
+  * Thrust is only computed once by loop, other calls to this method will use
+  *previously computed thrust.
+  *
+  * \return default thrust
+  */
+  float ComputeDefaultThrust(void);
+
+  /*!
+  * \brief Get Thrust
+  *
+  * \return current thrust
+  */
+  // float GetThrust() const;
+
+  /*!
+  * \brief Add an IODevice to the control law logs
+  *
+  * The IODevice will be automatically logged among the Uz logs,
+  * if logging is enabled (see IODevice::SetDataToLog,
+  *FrameworkManager::StartLog
+  * and FrameworkManager::AddDeviceToLog). \n
+  *
+  * \param device IODevice to log
+  */
+  void AddDeviceToControlLawLog(const core::IODevice *device);
+
+  /*!
+  * \brief Add an io_data to the control law logs
+  *
+  * The io_data will be automatically logged among the Uz logs,
+  * if logging is enabled (see IODevice::SetDataToLog,
+  *FrameworkManager::StartLog
+  * and FrameworkManager::AddDeviceToLog). \n
+  *
+  * \param data io_data to log
+  */
+  void AddDataToControlLawLog(const core::io_data *data);
+
+  const sensor::TargetController *GetJoystick(void) const;
+
+  gui::Tab *setupLawTab, *graphLawTab;
+
+private:
+  /*!
+  \enum AltitudeState_t
+  \brief States of the altitude state machine
+  */
+  enum class AltitudeState_t {
+    Stopped,      /*!< the uav motors are stopped */
+    TakingOff,    /*!< take off initiated. Motors accelerate progressively until
+                     the UAV lift up */
+    Stabilized,   /*!< the uav is actively maintaining its altitude */
+    StartLanding, /*!< landing initiated. Altitude is required to reach the
+                     landing altitude (0 by default) */
+    FinishLanding /*!< motors are gradually stopped */
+  };
+  AltitudeState_t altitudeState;
+  void ProcessAltitudeFiniteStateMachine();
+  void ComputeReferenceAltitude(float &refAltitude, float &refVerticalVelocity);
+
+  float groundAltitude; // effective altitude when the uav leaves the ground
+  float currentAltitude, currentVerticalSpeed;
+
+  bool failSafeMode;
+  void SecurityCheck(void);
+  void MandatorySecurityCheck(void);
+  void CheckJoystick();
+  void GenericCheckJoystick();
+  void CheckPushButton(void);
+  void GenericCheckPushButton(void);
+  void Run(void);
+  void StopMotors(void);
+
+  meta::Uav *uav;
+
+  core::Quaternion currentQuaternion;
+  core::Vector3D currentAngularSpeed;
+
+  const core::AhrsData *ComputeReferenceOrientation(void);
+
+  void ComputeOrientation(void);
+  void ComputeAltitude(void);
+
+  void ComputeTorques(void);
+  core::Euler currentTorques, savedDefaultTorques;
+  bool needToComputeDefaultTorques;
+
+  void ComputeThrust(void);
+  float currentThrust, savedDefaultThrust;
+  bool needToComputeDefaultThrust;
+
+  gui::PushButton *button_kill, *button_take_off, *button_land,
+      *button_start_log, *button_stop_log;
+  gui::GridLayout *buttonslayout;
+  gui::DoubleSpinBox *desiredTakeoffAltitude, *desiredLandingAltitude;
+  AltitudeMode_t altitudeMode;
+  OrientationMode_t orientationMode;
+  ThrustMode_t thrustMode;
+  TorqueMode_t torqueMode;
+  bool flagBatteryLow;
+  bool flagConnectionLost;
+  bool flagZTrajectoryFinished;
+  filter::NestedSat *uRoll, *uPitch;
+  filter::Pid *uYaw;
+  filter::PidThrust *uZ;
+
+  MetaDualShock3 *joy;
+  filter::TrajectoryGenerator1D *altitudeTrajectory;
 };
-
 };
 };
Index: trunk/lib/FlairMeta/src/XAir.cpp
===================================================================
--- trunk/lib/FlairMeta/src/XAir.cpp	(revision 14)
+++ trunk/lib/FlairMeta/src/XAir.cpp	(revision 15)
@@ -35,40 +35,46 @@
 using namespace flair::actuator;
 
-namespace flair { namespace meta {
+namespace flair {
+namespace meta {
 
-XAir::XAir(FrameworkManager* parent,string uav_name,filter::UavMultiplex *multiplex) : Uav(parent,uav_name,multiplex) {
-    RTDM_I2cPort* i2cport=new RTDM_I2cPort(parent,"rtdm_i2c","rti2c3");
-    RTDM_SerialPort* imu_port=new RTDM_SerialPort(parent,"imu_port","rtser1");
+XAir::XAir(FrameworkManager *parent, string uav_name,
+           filter::UavMultiplex *multiplex)
+    : Uav(parent, uav_name, multiplex) {
+  RTDM_I2cPort *i2cport = new RTDM_I2cPort(parent, "rtdm_i2c", "rti2c3");
+  RTDM_SerialPort *imu_port = new RTDM_SerialPort(parent, "imu_port", "rtser1");
 
-    if(multiplex==NULL) SetMultiplex(new X4X8Multiplex(parent,"motors",X4X8Multiplex::X8));
+  if (multiplex == NULL)
+    SetMultiplex(new X4X8Multiplex(parent, "motors", X4X8Multiplex::X8));
 
-    SetBldc(new AfroBldc(GetUavMultiplex(),GetUavMultiplex()->GetLayout(),"motors",GetUavMultiplex()->MotorsCount(),i2cport));
-    SetUsRangeFinder(new Srf08(parent,"SRF08",i2cport,0x70,60));
-    SetAhrs(new Gx3_25_ahrs(parent,"imu",imu_port,Gx3_25_imu::EulerAnglesAndAngularRates,70));
-    Tab* bat_tab=new Tab(parent->GetTabWidget(),"battery");
-    SetBatteryMonitor(new BatteryMonitor(bat_tab->NewRow(),"battery"));
-    GetBatteryMonitor()->SetBatteryValue(12);
+  SetBldc(new AfroBldc(GetUavMultiplex(), GetUavMultiplex()->GetLayout(),
+                       "motors", GetUavMultiplex()->MotorsCount(), i2cport));
+  SetUsRangeFinder(new Srf08(parent, "SRF08", i2cport, 0x70, 60));
+  SetAhrs(new Gx3_25_ahrs(parent, "imu", imu_port,
+                          Gx3_25_imu::EulerAnglesAndAngularRates, 70));
+  Tab *bat_tab = new Tab(parent->GetTabWidget(), "battery");
+  SetBatteryMonitor(new BatteryMonitor(bat_tab->NewRow(), "battery"));
+  GetBatteryMonitor()->SetBatteryValue(12);
 
-/*
-        if(VRPNType==Auto || VRPNType==AutoSerialPort)
-        {
-            RTDM_SerialPort* vrpn_port=new RTDM_SerialPort(parent,"vrpn_port","rtser3");
+  /*
+          if(VRPNType==Auto || VRPNType==AutoSerialPort)
+          {
+              RTDM_SerialPort* vrpn_port=new
+     RTDM_SerialPort(parent,"vrpn_port","rtser3");
 
-            vrpnclient=new VrpnClient(parent,"vrpn",vrpn_port,10000,80);
-            uav_vrpn=new MetaVrpnObject(vrpnclient,uav_name,VRPNSerialObjectId);
-        }
-*/
-    SetVerticalCamera(new Ps3Eye(parent,"camv",0,50));
+              vrpnclient=new VrpnClient(parent,"vrpn",vrpn_port,10000,80);
+              uav_vrpn=new
+     MetaVrpnObject(vrpnclient,uav_name,VRPNSerialObjectId);
+          }
+  */
+  SetVerticalCamera(new Ps3Eye(parent, "camv", 0, 50));
 }
 
-XAir::~XAir() {
-
-}
+XAir::~XAir() {}
 
 void XAir::StartSensors(void) {
-    ((Gx3_25_ahrs*)GetAhrs())->Start();
-    ((Srf08*)GetUsRangeFinder())->Start();
-    ((Ps3Eye *)GetVerticalCamera())->Start();
-    Uav::StartSensors();
+  ((Gx3_25_ahrs *)GetAhrs())->Start();
+  ((Srf08 *)GetUsRangeFinder())->Start();
+  ((Ps3Eye *)GetVerticalCamera())->Start();
+  Uav::StartSensors();
 }
 
Index: trunk/lib/FlairMeta/src/XAir.h
===================================================================
--- trunk/lib/FlairMeta/src/XAir.h	(revision 14)
+++ trunk/lib/FlairMeta/src/XAir.h	(revision 15)
@@ -16,21 +16,19 @@
 #include "Uav.h"
 
-namespace flair
-{
-namespace meta
-{
-    /*! \class XAir
-    *
-    * \brief Class defining an ardrone2 uav
-    */
-    class XAir : public Uav {
-        public:
-            XAir(core::FrameworkManager* parent,std::string uav_name,filter::UavMultiplex *multiplex=NULL);
-            ~XAir();
-            void StartSensors(void);
+namespace flair {
+namespace meta {
+/*! \class XAir
+*
+* \brief Class defining an ardrone2 uav
+*/
+class XAir : public Uav {
+public:
+  XAir(core::FrameworkManager *parent, std::string uav_name,
+       filter::UavMultiplex *multiplex = NULL);
+  ~XAir();
+  void StartSensors(void);
 
-        private:
-
-    };
+private:
+};
 } // end namespace meta
 } // end namespace flair
Index: trunk/lib/FlairMeta/src/unexported/MetaDualShock3_impl.h
===================================================================
--- trunk/lib/FlairMeta/src/unexported/MetaDualShock3_impl.h	(revision 14)
+++ trunk/lib/FlairMeta/src/unexported/MetaDualShock3_impl.h	(revision 15)
@@ -16,14 +16,11 @@
 #include <IODevice.h>
 
-namespace flair
-{
-    namespace meta
-    {
-        class MetaDualShock3;
-    }
-    namespace filter
-    {
-        class JoyReference;
-    }
+namespace flair {
+namespace meta {
+class MetaDualShock3;
+}
+namespace filter {
+class JoyReference;
+}
 }
 
@@ -32,16 +29,16 @@
 * \brief Classe intégrant la manette DualShock3 et les consignes joystick
 */
-class MetaDualShock3_impl: public flair::core::IODevice
-{
-    public:
-        MetaDualShock3_impl(flair::meta::MetaDualShock3* self,std::string name);
-        ~MetaDualShock3_impl();
-        flair::filter::JoyReference *joy_ref;
+class MetaDualShock3_impl : public flair::core::IODevice {
+public:
+  MetaDualShock3_impl(flair::meta::MetaDualShock3 *self, std::string name);
+  ~MetaDualShock3_impl();
+  flair::filter::JoyReference *joy_ref;
 
-    private:
-        void UpdateFrom(const flair::core::io_data *data);
-        flair::meta::MetaDualShock3* self;
-        bool joy_init;
-        bool wasRollTrimUpButtonPressed,wasRollTrimDownButtonPressed,wasPitchTrimUpButtonPressed,wasPitchTrimDownButtonPressed;
+private:
+  void UpdateFrom(const flair::core::io_data *data);
+  flair::meta::MetaDualShock3 *self;
+  bool joy_init;
+  bool wasRollTrimUpButtonPressed, wasRollTrimDownButtonPressed,
+      wasPitchTrimUpButtonPressed, wasPitchTrimDownButtonPressed;
 };
 
Index: trunk/lib/FlairSensorActuator/src/AfroBldc.cpp
===================================================================
--- trunk/lib/FlairSensorActuator/src/AfroBldc.cpp	(revision 14)
+++ trunk/lib/FlairSensorActuator/src/AfroBldc.cpp	(revision 15)
@@ -30,17 +30,16 @@
 using namespace flair::gui;
 
-namespace flair { namespace actuator {
+namespace flair {
+namespace actuator {
 
-AfroBldc::AfroBldc(const IODevice* parent,Layout* layout,string name,uint8_t motors_count,I2cPort* i2cport) : Bldc(parent,layout,name,motors_count) {
-    pimpl_=new AfroBldc_impl(this,layout,i2cport);
+AfroBldc::AfroBldc(const IODevice *parent, Layout *layout, string name,
+                   uint8_t motors_count, I2cPort *i2cport)
+    : Bldc(parent, layout, name, motors_count) {
+  pimpl_ = new AfroBldc_impl(this, layout, i2cport);
 }
 
-AfroBldc::~AfroBldc() {
-    delete pimpl_;
-}
+AfroBldc::~AfroBldc() { delete pimpl_; }
 
-void AfroBldc::SetMotors(float* values) {
-    pimpl_->SetMotors(values);
-}
+void AfroBldc::SetMotors(float *values) { pimpl_->SetMotors(values); }
 
 } // end namespace actuator
Index: trunk/lib/FlairSensorActuator/src/AfroBldc.h
===================================================================
--- trunk/lib/FlairSensorActuator/src/AfroBldc.h	(revision 14)
+++ trunk/lib/FlairSensorActuator/src/AfroBldc.h	(revision 15)
@@ -16,84 +16,79 @@
 #include "Bldc.h"
 
-namespace flair
-{
-    namespace core
-    {
-        class FrameworkManager;
-        class I2cPort;
-    }
-    namespace sensor
-    {
-        class BatteryMonitor;
-    }
+namespace flair {
+namespace core {
+class FrameworkManager;
+class I2cPort;
+}
+namespace sensor {
+class BatteryMonitor;
+}
 }
 
 class AfroBldc_impl;
 
-namespace flair
-{
-namespace actuator
-{
-    /*! \class AfroBldc
-    *
-    * \brief Class for Mikrokopter's blctrlv2
-    *
-    * blctrlv2 drivers can also monitor the battery level. See GetBatteryMonitor().
-    */
-    class AfroBldc : public Bldc
-    {
-        friend class ::AfroBldc_impl;
+namespace flair {
+namespace actuator {
+/*! \class AfroBldc
+*
+* \brief Class for Mikrokopter's blctrlv2
+*
+* blctrlv2 drivers can also monitor the battery level. See GetBatteryMonitor().
+*/
+class AfroBldc : public Bldc {
+  friend class ::AfroBldc_impl;
 
-        public:
-            /*!
-            * \brief Constructor
-            *
-            * Construct a AfroBldc.
-            *
-            * \param parent parent
-            * \param layout layout
-            * \param name name
-            * \param motors_count number of motors
-            * \param i2cport I2cPort
-            */
-            AfroBldc(const core::IODevice* parent,gui::Layout* layout,std::string name,uint8_t motors_count,core::I2cPort* i2cport);
+public:
+  /*!
+  * \brief Constructor
+  *
+  * Construct a AfroBldc.
+  *
+  * \param parent parent
+  * \param layout layout
+  * \param name name
+  * \param motors_count number of motors
+  * \param i2cport I2cPort
+  */
+  AfroBldc(const core::IODevice *parent, gui::Layout *layout, std::string name,
+           uint8_t motors_count, core::I2cPort *i2cport);
 
-            /*!
-            * \brief Destructor
-            *
-            */
-            ~AfroBldc();
+  /*!
+  * \brief Destructor
+  *
+  */
+  ~AfroBldc();
 
-            /*!
-            * \brief Has speed measurement
-            *
-            * Reimplemented from Bldc. \n
-            *
-            * \return true if it has speed measurement
-            */
-            bool HasSpeedMeasurement(void) const{return false;};
+  /*!
+  * \brief Has speed measurement
+  *
+  * Reimplemented from Bldc. \n
+  *
+  * \return true if it has speed measurement
+  */
+  bool HasSpeedMeasurement(void) const { return false; };
 
-            /*!
-            * \brief Has current measurement
-            *
-            * Reimplemented from Bldc. \n
-            *
-            * \return true if it has current measurement
-            */
-            bool HasCurrentMeasurement(void) const{return false;};
+  /*!
+  * \brief Has current measurement
+  *
+  * Reimplemented from Bldc. \n
+  *
+  * \return true if it has current measurement
+  */
+  bool HasCurrentMeasurement(void) const { return false; };
 
-        private:
-            /*!
-            * \brief Set motors values
-            *
-            * Reimplemented from Bldc. \n
-            * Values size must be the same as MotorsCount()
-            *
-            * \param values motor values
-            */
-            void SetMotors(float* values);
+private:
+  /*!
+  * \brief Set motors values
+  *
+  * Reimplemented from Bldc. \n
+  * Values size must be the same as MotorsCount()
+  *
+  * \param values motor values
+  */
+  void SetMotors(float *values);
 
-            class AfroBldc_impl* pimpl_;
-    };
+  class AfroBldc_impl *pimpl_;
+};
 } // end namespace actuator
 } // end namespace flair
Index: trunk/lib/FlairSensorActuator/src/AfroBldc_impl.cpp
===================================================================
--- trunk/lib/FlairSensorActuator/src/AfroBldc_impl.cpp	(revision 14)
+++ trunk/lib/FlairSensorActuator/src/AfroBldc_impl.cpp	(revision 15)
@@ -34,40 +34,39 @@
 using namespace flair::actuator;
 
-AfroBldc_impl::AfroBldc_impl(AfroBldc* self,Layout *layout,I2cPort* i2cport) {
-    this->self=self;
-    this->i2cport=i2cport;
-    nb_mot=self->MotorsCount();
+AfroBldc_impl::AfroBldc_impl(AfroBldc *self, Layout *layout, I2cPort *i2cport) {
+  this->self = self;
+  this->i2cport = i2cport;
+  nb_mot = self->MotorsCount();
 }
 
-AfroBldc_impl::~AfroBldc_impl() {
+AfroBldc_impl::~AfroBldc_impl() {}
 
+void AfroBldc_impl::SetMotors(float *value) {
+  uint16_t tosend_value[nb_mot];
+
+  for (int i = 0; i < nb_mot; i++)
+    tosend_value[i] = (uint16_t)(MAX_VALUE * value[i]);
+
+  i2cport->GetMutex();
+
+  for (int i = 0; i < nb_mot; i++) {
+    i2cport->SetSlave(BASE_ADDRESS + i);
+    WriteValue(tosend_value[i]);
+  }
+  i2cport->ReleaseMutex();
 }
 
-void AfroBldc_impl::SetMotors(float* value) {
-    uint16_t tosend_value[nb_mot];
+// I2cPort mutex must be taken before calling this function
+void AfroBldc_impl::WriteValue(uint16_t value) {
+  uint8_t tx[2];
+  ssize_t written;
 
-    for(int i=0; i<nb_mot; i++) tosend_value[i]=(uint16_t)(MAX_VALUE*value[i]);
-
-    i2cport->GetMutex();
-
-    for(int i=0; i<nb_mot; i++) {
-        i2cport->SetSlave(BASE_ADDRESS+i);
-        WriteValue(tosend_value[i]);
-    }
-    i2cport->ReleaseMutex();
+  tx[0] = (uint8_t)(value >> 3); // msb
+  tx[1] = (value & 0x07);        // lsb
+  written = i2cport->Write(tx, 2);
+  if (written < 0) {
+    self->Err("rt_dev_write error (%s)\n", strerror(-written));
+  } else if (written != sizeof(tx)) {
+    self->Err("rt_dev_write error %i/%i\n", written, sizeof(tx));
+  }
 }
-
-//I2cPort mutex must be taken before calling this function
-void AfroBldc_impl::WriteValue(uint16_t value) {
-    uint8_t tx[2];
-    ssize_t written;
-
-    tx[0]=(uint8_t)(value>>3);//msb
-    tx[1]=(value&0x07);//lsb
-    written =i2cport->Write(tx, 2);
-    if(written<0) {
-        self->Err("rt_dev_write error (%s)\n",strerror(-written));
-    } else if (written != sizeof(tx)) {
-        self->Err("rt_dev_write error %i/%i\n",written,sizeof(tx));
-    }
-}
Index: trunk/lib/FlairSensorActuator/src/BatteryMonitor.cpp
===================================================================
--- trunk/lib/FlairSensorActuator/src/BatteryMonitor.cpp	(revision 14)
+++ trunk/lib/FlairSensorActuator/src/BatteryMonitor.cpp	(revision 15)
@@ -16,5 +16,4 @@
 /*********************************************************************/
 
-
 #include "BatteryMonitor.h"
 #include <Layout.h>
@@ -26,33 +25,32 @@
 using namespace flair::gui;
 
-namespace flair { namespace sensor {
+namespace flair {
+namespace sensor {
 
-BatteryMonitor::BatteryMonitor(const gui::LayoutPosition* position,string name) : GroupBox(position,name) {
-    battery=new Label(this->NewRow(),"battery");
-    battery_thresh=new DoubleSpinBox(this->LastRowLastCol(),"threshold"," V",0,24,.1,1);
+BatteryMonitor::BatteryMonitor(const gui::LayoutPosition *position, string name)
+    : GroupBox(position, name) {
+  battery = new Label(this->NewRow(), "battery");
+  battery_thresh = new DoubleSpinBox(this->LastRowLastCol(), "threshold", " V",
+                                     0, 24, .1, 1);
 }
 
-BatteryMonitor::~BatteryMonitor() {
+BatteryMonitor::~BatteryMonitor() {}
 
-}
-
-float BatteryMonitor::GetVoltage(void) const {
-    return batteryvalue;
-}
+float BatteryMonitor::GetVoltage(void) const { return batteryvalue; }
 
 bool BatteryMonitor::IsBatteryLow(void) const {
-    if(batteryvalue<battery_thresh->Value())
-        return true;
-    else
-        return false;
+  if (batteryvalue < battery_thresh->Value())
+    return true;
+  else
+    return false;
 }
 
 void BatteryMonitor::SetBatteryValue(float value) {
-    batteryvalue=value;
-    if(value>0) {
-        battery->SetText("battery: %.1fV",value);
-    } else {
-        battery->SetText("battery: unreadable");
-    }
+  batteryvalue = value;
+  if (value > 0) {
+    battery->SetText("battery: %.1fV", value);
+  } else {
+    battery->SetText("battery: unreadable");
+  }
 }
 
Index: trunk/lib/FlairSensorActuator/src/BatteryMonitor.h
===================================================================
--- trunk/lib/FlairSensorActuator/src/BatteryMonitor.h	(revision 14)
+++ trunk/lib/FlairSensorActuator/src/BatteryMonitor.h	(revision 15)
@@ -16,72 +16,67 @@
 #include <GroupBox.h>
 
-namespace flair
-{
-    namespace gui
-    {
-        class LayoutPosition;
-        class Label;
-        class DoubleSpinBox;
-    }
+namespace flair {
+namespace gui {
+class LayoutPosition;
+class Label;
+class DoubleSpinBox;
+}
 }
 
-namespace flair
-{
-namespace sensor
-{
+namespace flair {
+namespace sensor {
 
-    /*! \class BatteryMonitor
-    *
-    * \brief Base class for battery monitor
-    */
+/*! \class BatteryMonitor
+*
+* \brief Base class for battery monitor
+*/
 
-    class BatteryMonitor : public gui::GroupBox
-    {
-        public:
-            /*!
-            * \brief Constructor
-            *
-            * Construct a BatteryMonitor at given position.
-            *
-            * \param position position
-            * \param name name
-            */
-            BatteryMonitor(const gui::LayoutPosition* position,std::string name);
+class BatteryMonitor : public gui::GroupBox {
+public:
+  /*!
+  * \brief Constructor
+  *
+  * Construct a BatteryMonitor at given position.
+  *
+  * \param position position
+  * \param name name
+  */
+  BatteryMonitor(const gui::LayoutPosition *position, std::string name);
 
-            /*!
-            * \brief Destructor
-            *
-            */
-            ~BatteryMonitor();
+  /*!
+  * \brief Destructor
+  *
+  */
+  ~BatteryMonitor();
 
-            /*!
-            * \brief Is batteru low?
-            *
-            * \return true if battery is below threshold
-            *
-            */
-            bool IsBatteryLow(void) const;
+  /*!
+  * \brief Is batteru low?
+  *
+  * \return true if battery is below threshold
+  *
+  */
+  bool IsBatteryLow(void) const;
 
-            /*!
-            * \brief Set battery value
-            *
-            * \param battery value
-            *
-            */
-            void SetBatteryValue(float value);
+  /*!
+  * \brief Set battery value
+  *
+  * \param battery value
+  *
+  */
+  void SetBatteryValue(float value);
 
-            /*!
-            * \brief Get battery voltage
-            *
-            * \return battery voltage
-            *
-            */
-            float GetVoltage(void) const;
+  /*!
+  * \brief Get battery voltage
+  *
+  * \return battery voltage
+  *
+  */
+  float GetVoltage(void) const;
 
-        private:
-            float batteryvalue;
-            gui::DoubleSpinBox *battery_thresh;
-            gui::Label *battery;
-    };
+private:
+  float batteryvalue;
+  gui::DoubleSpinBox *battery_thresh;
+  gui::Label *battery;
+};
 } // end namespace sensor
 } // end namespace flair
Index: trunk/lib/FlairSensorActuator/src/BlCtrlV2.cpp
===================================================================
--- trunk/lib/FlairSensorActuator/src/BlCtrlV2.cpp	(revision 14)
+++ trunk/lib/FlairSensorActuator/src/BlCtrlV2.cpp	(revision 15)
@@ -31,28 +31,20 @@
 using namespace flair::gui;
 
-namespace flair
-{
-namespace actuator
-{
+namespace flair {
+namespace actuator {
 
-BlCtrlV2::BlCtrlV2(const IODevice* parent,Layout* layout,string name,uint8_t motors_count,I2cPort* i2cport) : Bldc(parent,layout,name,motors_count)
-{
-    pimpl_=new BlCtrlV2_impl(this,layout,i2cport);
+BlCtrlV2::BlCtrlV2(const IODevice *parent, Layout *layout, string name,
+                   uint8_t motors_count, I2cPort *i2cport)
+    : Bldc(parent, layout, name, motors_count) {
+  pimpl_ = new BlCtrlV2_impl(this, layout, i2cport);
 }
 
-BlCtrlV2::~BlCtrlV2()
-{
-    delete pimpl_;
+BlCtrlV2::~BlCtrlV2() { delete pimpl_; }
+
+BatteryMonitor *BlCtrlV2::GetBatteryMonitor(void) const {
+  return pimpl_->battery;
 }
 
-BatteryMonitor* BlCtrlV2::GetBatteryMonitor(void) const
-{
-    return pimpl_->battery;
-}
-
-void BlCtrlV2::SetMotors(float* values)
-{
-    pimpl_->SetMotors(values);
-}
+void BlCtrlV2::SetMotors(float *values) { pimpl_->SetMotors(values); }
 
 } // end namespace actuator
Index: trunk/lib/FlairSensorActuator/src/BlCtrlV2.h
===================================================================
--- trunk/lib/FlairSensorActuator/src/BlCtrlV2.h	(revision 14)
+++ trunk/lib/FlairSensorActuator/src/BlCtrlV2.h	(revision 15)
@@ -16,91 +16,86 @@
 #include "Bldc.h"
 
-namespace flair
-{
-    namespace core
-    {
-        class FrameworkManager;
-        class I2cPort;
-    }
-    namespace sensor
-    {
-        class BatteryMonitor;
-    }
+namespace flair {
+namespace core {
+class FrameworkManager;
+class I2cPort;
+}
+namespace sensor {
+class BatteryMonitor;
+}
 }
 
 class BlCtrlV2_impl;
 
-namespace flair
-{
-namespace actuator
-{
-    /*! \class BlCtrlV2
-    *
-    * \brief Class for Mikrokopter's blctrlv2
-    *
-    * blctrlv2 drivers can also monitor the battery level. See GetBatteryMonitor().
-    */
-    class BlCtrlV2 : public Bldc
-    {
-        friend class ::BlCtrlV2_impl;
+namespace flair {
+namespace actuator {
+/*! \class BlCtrlV2
+*
+* \brief Class for Mikrokopter's blctrlv2
+*
+* blctrlv2 drivers can also monitor the battery level. See GetBatteryMonitor().
+*/
+class BlCtrlV2 : public Bldc {
+  friend class ::BlCtrlV2_impl;
 
-        public:
-            /*!
-            * \brief Constructor
-            *
-            * Construct a BlCtrlV2.
-            *
-            * \param parent parent
-            * \param layout layout
-            * \param name name
-            * \param motors_count number of motors
-            * \param i2cport I2cPort
-            */
-            BlCtrlV2(const core::IODevice* parent,gui::Layout* layout,std::string name,uint8_t motors_count,core::I2cPort* i2cport);
+public:
+  /*!
+  * \brief Constructor
+  *
+  * Construct a BlCtrlV2.
+  *
+  * \param parent parent
+  * \param layout layout
+  * \param name name
+  * \param motors_count number of motors
+  * \param i2cport I2cPort
+  */
+  BlCtrlV2(const core::IODevice *parent, gui::Layout *layout, std::string name,
+           uint8_t motors_count, core::I2cPort *i2cport);
 
-            /*!
-            * \brief Destructor
-            *
-            */
-            ~BlCtrlV2();
+  /*!
+  * \brief Destructor
+  *
+  */
+  ~BlCtrlV2();
 
-            /*!
-            * \brief Get battery monitor
-            *
-            * \return BatteryMonitor
-            */
-            sensor::BatteryMonitor* GetBatteryMonitor(void) const;
+  /*!
+  * \brief Get battery monitor
+  *
+  * \return BatteryMonitor
+  */
+  sensor::BatteryMonitor *GetBatteryMonitor(void) const;
 
-            /*!
-            * \brief Has speed measurement
-            *
-            * Reimplemented from Bldc. \n
-            *
-            * \return true if it has speed measurement
-            */
-            bool HasSpeedMeasurement(void) const{return true;};
+  /*!
+  * \brief Has speed measurement
+  *
+  * Reimplemented from Bldc. \n
+  *
+  * \return true if it has speed measurement
+  */
+  bool HasSpeedMeasurement(void) const { return true; };
 
-            /*!
-            * \brief Has current measurement
-            *
-            * Reimplemented from Bldc. \n
-            *
-            * \return true if it has current measurement
-            */
-            bool HasCurrentMeasurement(void) const{return true;};
+  /*!
+  * \brief Has current measurement
+  *
+  * Reimplemented from Bldc. \n
+  *
+  * \return true if it has current measurement
+  */
+  bool HasCurrentMeasurement(void) const { return true; };
 
-        private:
-            /*!
-            * \brief Set motors values
-            *
-            * Reimplemented from Bldc. \n
-            * Values size must be the same as MotorsCount()
-            *
-            * \param values motor values
-            */
-            void SetMotors(float* values);
+private:
+  /*!
+  * \brief Set motors values
+  *
+  * Reimplemented from Bldc. \n
+  * Values size must be the same as MotorsCount()
+  *
+  * \param values motor values
+  */
+  void SetMotors(float *values);
 
-            class BlCtrlV2_impl* pimpl_;
-    };
+  class BlCtrlV2_impl *pimpl_;
+};
 } // end namespace actuator
 } // end namespace flair
Index: trunk/lib/FlairSensorActuator/src/BlCtrlV2_impl.cpp
===================================================================
--- trunk/lib/FlairSensorActuator/src/BlCtrlV2_impl.cpp	(revision 14)
+++ trunk/lib/FlairSensorActuator/src/BlCtrlV2_impl.cpp	(revision 15)
@@ -35,171 +35,176 @@
 using namespace flair::actuator;
 
-BlCtrlV2_impl::BlCtrlV2_impl(BlCtrlV2* self,Layout *layout,I2cPort* i2cport) {
-    this->self=self;
-	this->i2cport=i2cport;
-	last_voltage_time=0;
-
-    DetectMotors();
-    //if(nb_mot!=self->MotorsCount()) self->Err("motors count different from multiplex count\n");
-
-    //BatteryMonitor
-    battery=new BatteryMonitor(layout->NewRow(),"battery");
-
-    //user interface
-    GroupBox *setupgroupbox=new GroupBox(layout->NewRow(),"Motors");
-    poles=new SpinBox(setupgroupbox->NewRow(),"nb poles:",0,255,1,14);
-}
-
-BlCtrlV2_impl::~BlCtrlV2_impl() {
-
-}
-
-void BlCtrlV2_impl::SetMotors(float* value) {
-    uint16_t tosend_value[nb_mot];
-    //stocke dans une variable pour garder le moins longtemps l'i2c (pour ne pas bloquer sur le mutex de l'output)
-    float speeds[nb_mot];
-    float currents[nb_mot];
-
-    for(int i=0;i<nb_mot;i++) tosend_value[i]=(uint16_t)(MAX_VALUE*value[i]);
-
-    i2cport->GetMutex();
-
-    for(int i=0;i<nb_mot;i++) {
-        i2cport->SetSlave(BASE_ADDRESS+i);
-        WriteValue(tosend_value[i]);
+BlCtrlV2_impl::BlCtrlV2_impl(BlCtrlV2 *self, Layout *layout, I2cPort *i2cport) {
+  this->self = self;
+  this->i2cport = i2cport;
+  last_voltage_time = 0;
+
+  DetectMotors();
+  // if(nb_mot!=self->MotorsCount()) self->Err("motors count different from
+  // multiplex count\n");
+
+  // BatteryMonitor
+  battery = new BatteryMonitor(layout->NewRow(), "battery");
+
+  // user interface
+  GroupBox *setupgroupbox = new GroupBox(layout->NewRow(), "Motors");
+  poles = new SpinBox(setupgroupbox->NewRow(), "nb poles:", 0, 255, 1, 14);
+}
+
+BlCtrlV2_impl::~BlCtrlV2_impl() {}
+
+void BlCtrlV2_impl::SetMotors(float *value) {
+  uint16_t tosend_value[nb_mot];
+  // stocke dans une variable pour garder le moins longtemps l'i2c (pour ne pas
+  // bloquer sur le mutex de l'output)
+  float speeds[nb_mot];
+  float currents[nb_mot];
+
+  for (int i = 0; i < nb_mot; i++)
+    tosend_value[i] = (uint16_t)(MAX_VALUE * value[i]);
+
+  i2cport->GetMutex();
+
+  for (int i = 0; i < nb_mot; i++) {
+    i2cport->SetSlave(BASE_ADDRESS + i);
+    WriteValue(tosend_value[i]);
+  }
+
+  for (int i = 0; i < nb_mot; i++) {
+    i2cport->SetSlave(BASE_ADDRESS + i);
+
+    if (i == 0 && GetTime() > (last_voltage_time + 5 * (Time)1000000000)) {
+      // toute les 5 secondes sur moteur 0
+      float voltage;
+      GetCurrentSpeedAndVoltage(currents[i], speeds[i], voltage);
+      battery->SetBatteryValue(voltage);
+      last_voltage_time = GetTime();
+    } else {
+      GetCurrentAndSpeed(currents[i], speeds[i]);
     }
-
-    for(int i=0;i<nb_mot;i++) {
-        i2cport->SetSlave(BASE_ADDRESS+i);
-
-        if(i==0 && GetTime()>(last_voltage_time+5*(Time)1000000000)) {
-            //toute les 5 secondes sur moteur 0
-            float voltage;
-            GetCurrentSpeedAndVoltage(currents[i],speeds[i],voltage);
-            battery->SetBatteryValue(voltage);
-            last_voltage_time=GetTime();
-        } else {
-            GetCurrentAndSpeed(currents[i],speeds[i]);
-        }
+  }
+  // printf("%f %f %f %f\n",speeds[0],speeds[1],speeds[2],speeds[3]);
+  /*
+      if(GetTime()>(last_voltage_time+5*(Time)1000000000))//toute les 5 secondes
+      {
+          i2cport->SetSlave(BASE_ADDRESS);
+          battery->SetBatteryValue(ReadVoltage());
+          last_voltage_time=GetTime();
+      }
+  */
+  i2cport->ReleaseMutex();
+
+  // on prend une fois pour toute le mutex et on fait des accès directs
+  cvmatrix *output = self->output;
+  output->GetMutex();
+  for (int i = 0; i < nb_mot; i++)
+    output->SetValueNoMutex(i, 0, speeds[i]);
+  for (int i = 0; i < nb_mot; i++)
+    output->SetValueNoMutex(i, 1, currents[i]);
+  output->ReleaseMutex();
+}
+
+// I2cPort mutex must be taken before calling this function
+void BlCtrlV2_impl::WriteValue(uint16_t value) {
+  uint8_t tx[2];
+  ssize_t written;
+
+  tx[0] = (uint8_t)(value >> 3); // msb
+  tx[1] = (value & 0x07);
+  ; //+16+8; //pour recuperer la vitesse en premier
+  written = i2cport->Write(tx, 2);
+  if (written < 0) {
+    self->Err("rt_dev_write error (%s)\n", strerror(-written));
+  } else if (written != sizeof(tx)) {
+    self->Err("rt_dev_write error %i/%i\n", written, sizeof(tx));
+  }
+}
+
+// I2cPort mutex must be taken before calling this function
+void BlCtrlV2_impl::GetCurrentAndSpeed(float &current, float &speed) {
+  ssize_t read;
+  uint8_t value[4];
+  read = i2cport->Read(value, sizeof(value));
+
+  if (read < 0) {
+    self->Err("rt_dev_read error (%s)\n", strerror(-read));
+    speed = -1;
+    current = -1;
+  } else if (read != sizeof(value)) {
+    self->Err("rt_dev_read error %i/%i\n", read, sizeof(value));
+    speed = -1;
+    current = -1;
+  } else {
+    current = value[0] / 10.;
+    speed = value[3] * 780. / poles->Value();
+  }
+}
+
+// I2cPort mutex must be taken before calling this function
+void BlCtrlV2_impl::GetCurrentSpeedAndVoltage(float &current, float &speed,
+                                              float &voltage) {
+  ssize_t read;
+  uint8_t value[6];
+  read = i2cport->Read(value, sizeof(value));
+
+  if (read < 0) {
+    self->Err("rt_dev_read error (%s)\n", strerror(-read));
+    speed = -1;
+    voltage = -1;
+    current = -1;
+  } else if (read != sizeof(value)) {
+    self->Err("rt_dev_read error %i/%i\n", read, sizeof(value));
+    speed = -1;
+    voltage = -1;
+    current = -1;
+  } else {
+    current = value[0] / 10.;
+    voltage = value[5] / 10.;
+    speed = value[3] * 780. / poles->Value();
+  }
+}
+
+void BlCtrlV2_impl::DetectMotors(void) {
+  int nb = 0;
+  ssize_t read, nb_write;
+  uint8_t value[3];
+  uint8_t tx[2];
+
+  i2cport->GetMutex();
+
+  for (int i = 0; i < MAX_MOTORS; i++) {
+    // printf("test %i\n",i);
+    i2cport->SetSlave(BASE_ADDRESS + i);
+    tx[0] = 0;
+    tx[1] = 16 + 8; // 16+8 pour recuperer la vitesse
+
+    nb_write = i2cport->Write(tx, 2);
+
+    if (nb_write != sizeof(tx)) {
+      continue;
     }
-//printf("%f %f %f %f\n",speeds[0],speeds[1],speeds[2],speeds[3]);
-/*
-    if(GetTime()>(last_voltage_time+5*(Time)1000000000))//toute les 5 secondes
-    {
-        i2cport->SetSlave(BASE_ADDRESS);
-        battery->SetBatteryValue(ReadVoltage());
-        last_voltage_time=GetTime();
+    nb++;
+  }
+
+  for (int i = 0; i < MAX_MOTORS; i++) {
+    i2cport->SetSlave(BASE_ADDRESS + i);
+    read = i2cport->Read(value, 3);
+
+    if (read != sizeof(value)) {
+      continue;
     }
-*/
-    i2cport->ReleaseMutex();
-
-    //on prend une fois pour toute le mutex et on fait des accès directs
-    cvmatrix* output=self->output;
-    output->GetMutex();
-    for(int i=0;i<nb_mot;i++) output->SetValueNoMutex(i,0,speeds[i]);
-    for(int i=0;i<nb_mot;i++) output->SetValueNoMutex(i,1,currents[i]);
-    output->ReleaseMutex();
-}
-
-//I2cPort mutex must be taken before calling this function
-void BlCtrlV2_impl::WriteValue(uint16_t value) {
-    uint8_t tx[2];
-    ssize_t written;
-
-    tx[0]=(uint8_t)(value>>3);//msb
-    tx[1]=(value&0x07);;//+16+8; //pour recuperer la vitesse en premier
-    written =i2cport->Write(tx, 2);
-    if(written<0) {
-        self->Err("rt_dev_write error (%s)\n",strerror(-written));
-    } else if (written != sizeof(tx)) {
-        self->Err("rt_dev_write error %i/%i\n",written,sizeof(tx));
-    }
-}
-
-//I2cPort mutex must be taken before calling this function
-void BlCtrlV2_impl::GetCurrentAndSpeed(float &current,float &speed) {
-    ssize_t read;
-    uint8_t value[4];
-    read = i2cport->Read(value, sizeof(value));
-
-    if(read<0) {
-        self->Err("rt_dev_read error (%s)\n",strerror(-read));
-        speed=-1;
-        current=-1;
-    } else if (read != sizeof(value)) {
-        self->Err("rt_dev_read error %i/%i\n",read,sizeof(value));
-        speed=-1;
-        current=-1;
-    } else {
-        current=value[0]/10.;
-        speed= value[3]*780./poles->Value();
-    }
-}
-
-//I2cPort mutex must be taken before calling this function
-void BlCtrlV2_impl::GetCurrentSpeedAndVoltage(float &current,float &speed,float &voltage) {
-    ssize_t read;
-    uint8_t value[6];
-    read = i2cport->Read(value, sizeof(value));
-
-    if(read<0) {
-        self->Err("rt_dev_read error (%s)\n",strerror(-read));
-        speed=-1;
-        voltage=-1;
-        current=-1;
-    } else if (read != sizeof(value)) {
-        self->Err("rt_dev_read error %i/%i\n",read,sizeof(value));
-        speed=-1;
-        voltage=-1;
-        current=-1;
-    } else {
-        current=value[0]/10.;
-        voltage=value[5]/10.;
-        speed= value[3]*780./poles->Value();
-    }
-}
-
-void BlCtrlV2_impl::DetectMotors(void) {
-    int nb=0;
-    ssize_t read,nb_write;
-    uint8_t value[3];
-    uint8_t tx[2];
-
-    i2cport->GetMutex();
-
-    for(int i=0;i<MAX_MOTORS;i++) {
-        //printf("test %i\n",i);
-        i2cport->SetSlave(BASE_ADDRESS+i);
-        tx[0]=0;
-        tx[1]=16+8;//16+8 pour recuperer la vitesse
-
-        nb_write = i2cport->Write(tx, 2);
-
-        if (nb_write != sizeof(tx)) {
-            continue;
-        }
-        nb++;
-    }
-
-    for(int i=0;i<MAX_MOTORS;i++) {
-        i2cport->SetSlave(BASE_ADDRESS+i);
-        read = i2cport->Read(value, 3);
-
-        if (read != sizeof(value)) {
-            continue;
-        }
-    }
-
-    i2cport->ReleaseMutex();
-
-    Printf("BlCtrlV2: Dectected motors: %i\n",nb);
-    if(nb==4) {
-        Printf("BlCtrlV2: Configuration X4\n");
-    } else if(nb==8) {
-        Printf("BlCtrlV2: Configuration X8\n");
-    } else {
-        //self->Err("Error, configuration not supported (%i/%i)\n",nb,MAX_MOTORS);
-    }
-
-    nb_mot=nb;
-}
+  }
+
+  i2cport->ReleaseMutex();
+
+  Printf("BlCtrlV2: Dectected motors: %i\n", nb);
+  if (nb == 4) {
+    Printf("BlCtrlV2: Configuration X4\n");
+  } else if (nb == 8) {
+    Printf("BlCtrlV2: Configuration X8\n");
+  } else {
+    // self->Err("Error, configuration not supported (%i/%i)\n",nb,MAX_MOTORS);
+  }
+
+  nb_mot = nb;
+}
Index: trunk/lib/FlairSensorActuator/src/BlCtrlV2_x4_speed.cpp
===================================================================
--- trunk/lib/FlairSensorActuator/src/BlCtrlV2_x4_speed.cpp	(revision 14)
+++ trunk/lib/FlairSensorActuator/src/BlCtrlV2_x4_speed.cpp	(revision 15)
@@ -38,506 +38,453 @@
 using namespace flair::gui;
 
-namespace flair
-{
-namespace actuator
-{
-BlCtrlV2_x4_speed::BlCtrlV2_x4_speed(FrameworkManager* parent,string name,I2cPort* i2cport,uint8_t base_address,uint8_t priority) : Thread(parent,name,priority),IODevice(parent,name)
-{
-    this->i2cport=i2cport;
-	slave_address=base_address;
-	tested_motor=-1;
-	enabled=false;
-	int_av_g=0;
-	int_av_d=0;
-	int_ar_g=0;
-	int_ar_d=0;
-
-	//flight time
-	FILE *file;
-    file=fopen("/etc/flight_time","r");
-    if (file == NULL)
-    {
-        Printf("fichier d'info de vol vide\n");
-        time_sec=0;
+namespace flair {
+namespace actuator {
+BlCtrlV2_x4_speed::BlCtrlV2_x4_speed(FrameworkManager *parent, string name,
+                                     I2cPort *i2cport, uint8_t base_address,
+                                     uint8_t priority)
+    : Thread(parent, name, priority), IODevice(parent, name) {
+  this->i2cport = i2cport;
+  slave_address = base_address;
+  tested_motor = -1;
+  enabled = false;
+  int_av_g = 0;
+  int_av_d = 0;
+  int_ar_g = 0;
+  int_ar_d = 0;
+
+  // flight time
+  FILE *file;
+  file = fopen("/etc/flight_time", "r");
+  if (file == NULL) {
+    Printf("fichier d'info de vol vide\n");
+    time_sec = 0;
+  } else {
+    char ligne[32];
+    fgets(ligne, 32, file);
+    time_sec = atoi(ligne);
+    Printf("temps de vol total: %is = %imin = %ih\n", time_sec, time_sec / 60,
+           time_sec / 3600);
+    fclose(file);
+  }
+
+  // station sol
+  main_tab = new Tab(parent->GetTabWidget(), name);
+  tab = new TabWidget(main_tab->NewRow(), name);
+  Tab *sensor_tab = new Tab(tab, "Reglages");
+  reglages_groupbox = new GroupBox(sensor_tab->NewRow(), name);
+  poles = new SpinBox(reglages_groupbox->NewRow(), "nb poles", 0, 255, 1);
+  kp = new DoubleSpinBox(reglages_groupbox->LastRowLastCol(), "kp", 0., 255,
+                         0.001, 4);
+  ki = new DoubleSpinBox(reglages_groupbox->LastRowLastCol(), "ki", 0., 255,
+                         0.001, 4);
+  min = new SpinBox(reglages_groupbox->NewRow(), "min pwm", 0., 2048, 1);
+  max =
+      new SpinBox(reglages_groupbox->LastRowLastCol(), "max pwm", 0., 2048, 1);
+  test = new SpinBox(reglages_groupbox->LastRowLastCol(), "test value", 0.,
+                     2048, 1);
+  start_value = new SpinBox(reglages_groupbox->NewRow(), "valeur demarrage", 0,
+                            10000, 10);
+  trim = new DoubleSpinBox(reglages_groupbox->LastRowLastCol(), "pas decollage",
+                           0, 1000, .1);
+
+  av_g = new ComboBox(reglages_groupbox->NewRow(), "avant gauche");
+  av_g->AddItem("1");
+  av_g->AddItem("2");
+  av_g->AddItem("3");
+  av_g->AddItem("4");
+  button_avg = new PushButton(reglages_groupbox->LastRowLastCol(), "test avg");
+
+  av_d = new ComboBox(reglages_groupbox->LastRowLastCol(), "avant droite:");
+  av_d->AddItem("1");
+  av_d->AddItem("2");
+  av_d->AddItem("3");
+  av_d->AddItem("4");
+  button_avd = new PushButton(reglages_groupbox->LastRowLastCol(), "test avd");
+
+  ar_g = new ComboBox(reglages_groupbox->NewRow(), "arriere gauche:");
+  ar_g->AddItem("1");
+  ar_g->AddItem("2");
+  ar_g->AddItem("3");
+  ar_g->AddItem("4");
+  button_arg = new PushButton(reglages_groupbox->LastRowLastCol(), "test arg");
+
+  ar_d = new ComboBox(reglages_groupbox->LastRowLastCol(), "arriere droite:");
+  ar_d->AddItem("1");
+  ar_d->AddItem("2");
+  ar_d->AddItem("3");
+  ar_d->AddItem("4");
+  button_ard = new PushButton(reglages_groupbox->LastRowLastCol(), "test ard");
+
+  pas = new ComboBox(reglages_groupbox->NewRow(), "pas helice avant gauche:");
+  pas->AddItem("normal");
+  pas->AddItem("inverse");
+
+  input = new cvmatrix((IODevice *)this, 8, 1, floatType);
+
+  cvmatrix_descriptor *desc = new cvmatrix_descriptor(4, 2);
+  desc->SetElementName(0, 0, "avant gauche");
+  desc->SetElementName(1, 0, "arriere droite");
+  desc->SetElementName(2, 0, "avant droite");
+  desc->SetElementName(3, 0, "arriere gauche");
+
+  desc->SetElementName(0, 1, "cons avant gauche");
+  desc->SetElementName(1, 1, "cons arriere droite");
+  desc->SetElementName(2, 1, "cons avant droite");
+  desc->SetElementName(3, 1, "cons arriere gauche");
+  output = new cvmatrix((IODevice *)this, desc, floatType);
+
+  /*
+
+  //le 3ieme lu est la tension batteire
+          if(i2c_mutex!=NULL) i2c_mutex->GetMutex();
+      uint16_t pwm_moteur;
+      pwm_moteur=0;
+      ssize_t read;
+      uint8_t rx[8];
+      SetSlave(slave_address);
+
+      for(int j=0;j<10;j++)
+      {
+
+
+          WriteValue(pwm_moteur);
+
+
+          read = rt_dev_read(i2c_fd, rx, sizeof(rx));
+
+          if(read<0)
+          {
+              rt_printf("BlCtrlV2_x4_speed::BlCtrlV2_x4_speed: %s, erreur
+  rt_dev_read (%s)\n",IODevice::ObjectName().c_str(),strerror(-read));
+          }
+          else if (read != sizeof(rx))
+          {
+              rt_printf("BlCtrlV2_x4_speed::BlCtrlV2_x4_speed: %s, erreur
+  rt_dev_read %i/2\n",IODevice::ObjectName().c_str(),read);
+
+          }
+          for(int i=0;i<sizeof(rx);i++) printf("%i ",rx[i]);
+
+          printf("\n");
+
+      }
+
+      if(i2c_mutex!=NULL) i2c_mutex->ReleaseMutex();*/
+}
+
+BlCtrlV2_x4_speed::~BlCtrlV2_x4_speed(void) {
+  SafeStop();
+  Join();
+  delete main_tab;
+}
+
+void BlCtrlV2_x4_speed::UseDefaultPlot(void) {
+  Tab *plot_tab = new Tab(tab, "Mesures");
+  DataPlot1D *av_g_plot = new DataPlot1D(plot_tab->NewRow(), "avg", 0, 10000);
+  av_g_plot->AddCurve(output->Element(0, 0));
+  av_g_plot->AddCurve(output->Element(0, 1), DataPlot::Blue);
+  DataPlot1D *av_d_plot =
+      new DataPlot1D(plot_tab->LastRowLastCol(), "avd", 0, 10000);
+  av_d_plot->AddCurve(output->Element(2, 0));
+  av_d_plot->AddCurve(output->Element(2, 1), DataPlot::Blue);
+  DataPlot1D *ar_g_plot = new DataPlot1D(plot_tab->NewRow(), "arg", 0, 10000);
+  ar_g_plot->AddCurve(output->Element(3, 0));
+  ar_g_plot->AddCurve(output->Element(3, 1), DataPlot::Blue);
+  DataPlot1D *ar_d_plot =
+      new DataPlot1D(plot_tab->LastRowLastCol(), "ard", 0, 10000);
+  ar_d_plot->AddCurve(output->Element(1, 0));
+  ar_d_plot->AddCurve(output->Element(1, 1), DataPlot::Blue);
+}
+
+float BlCtrlV2_x4_speed::TrimValue(void) { return (float)trim->Value(); }
+
+int BlCtrlV2_x4_speed::StartValue(void) { return start_value->Value(); }
+
+void BlCtrlV2_x4_speed::Run(void) {
+  WarnUponSwitches(true);
+
+  SetPeriodUS(TAU_US);
+
+  while (!ToBeStopped()) {
+    WaitPeriod();
+
+    Update();
+  }
+
+  WarnUponSwitches(false);
+}
+
+void BlCtrlV2_x4_speed::Update(void) {
+  float u_roll, u_pitch, u_yaw, u_gaz;
+  float trim_roll, trim_pitch, trim_yaw;
+  float pwm[4];
+  uint16_t pwm_moteur[4];
+
+  // on prend une fois pour toute le mutex et on fait des accès directs
+  input->GetMutex();
+
+  u_roll = input->ValueNoMutex(0, 0);
+  u_pitch = input->ValueNoMutex(1, 0);
+  u_yaw = input->ValueNoMutex(2, 0);
+  u_gaz =
+      input->ValueNoMutex(3, 0) +
+      input->ValueNoMutex(7, 0) * input->ValueNoMutex(7, 0); // ugaz+trim*trim
+  trim_roll = input->ValueNoMutex(4, 0);
+  trim_pitch = input->ValueNoMutex(5, 0);
+  trim_yaw = input->ValueNoMutex(6, 0);
+
+  input->ReleaseMutex();
+
+  if (pas->CurrentIndex() == 1) {
+    trim_yaw = -trim_yaw;
+    u_yaw = -u_yaw;
+  }
+
+  // rt_printf("%f %f %f %f\n",u_roll,u_pitch,u_yaw,u_gaz);
+  // if(u_gaz!=0) rt_printf("gaz: %f\n",u_gaz);
+
+  // avant gauche
+  if (u_gaz + u_pitch + u_roll + u_yaw > 0) {
+    pwm[0] = trim_pitch + trim_roll + trim_yaw +
+             sqrtf(u_gaz + u_pitch + u_roll + u_yaw);
+  } else {
+    pwm[0] = trim_pitch + trim_roll + trim_yaw;
+  }
+
+  // arriere gauche
+  if (u_gaz - u_pitch + u_roll - u_yaw > 0) {
+    pwm[3] = -trim_pitch + trim_roll - trim_yaw +
+             sqrtf(u_gaz - u_pitch + u_roll - u_yaw);
+  } else {
+    pwm[3] = -trim_pitch + trim_roll - trim_yaw;
+  }
+
+  // arriere droit
+  if (u_gaz - u_pitch - u_roll + u_yaw > 0) {
+    pwm[1] = -trim_pitch - trim_roll + trim_yaw +
+             sqrtf(u_gaz - u_pitch - u_roll + u_yaw);
+  } else {
+    pwm[1] = -trim_pitch - trim_roll + trim_yaw;
+  }
+
+  // avant droit
+  if (u_gaz + u_pitch - u_roll - u_yaw > 0) {
+    pwm[2] = trim_pitch - trim_roll - trim_yaw +
+             sqrtf(u_gaz + u_pitch - u_roll - u_yaw);
+  } else {
+    pwm[2] = trim_pitch - trim_roll - trim_yaw;
+  }
+
+  int_av_g += ki->Value() * (pwm[0] - speed_av_g);
+  pwm[0] = kp->Value() * (pwm[0] - speed_av_g) + int_av_g;
+
+  int_ar_g += ki->Value() * (pwm[3] - speed_ar_g);
+  pwm[3] = kp->Value() * (pwm[3] - speed_ar_g) + int_ar_g;
+
+  int_ar_d += ki->Value() * (pwm[1] - speed_ar_d);
+  pwm[1] = kp->Value() * (pwm[1] - speed_ar_d) + int_ar_d;
+
+  int_av_d += ki->Value() * (pwm[2] - speed_av_d);
+  pwm[2] = kp->Value() * (pwm[2] - speed_av_d) + int_av_d;
+
+  // rt_printf("%f\n",pwm[0]);
+  for (int i = 0; i < 4; i++)
+    pwm_moteur[i] = SatPWM(pwm[i], min->Value(), max->Value());
+
+  if (button_avg->Clicked() == true) {
+    tested_motor = 0;
+    StartTest();
+  }
+  if (button_avd->Clicked() == true) {
+    tested_motor = 2;
+    StartTest();
+  }
+  if (button_arg->Clicked() == true) {
+    tested_motor = 3;
+    StartTest();
+  }
+  if (button_ard->Clicked() == true) {
+    tested_motor = 1;
+    StartTest();
+  }
+
+  if (tested_motor != -1) {
+    for (int i = 0; i < 4; i++) {
+      pwm_moteur[i] = 0;
     }
-    else
-    {
-        char ligne[32];
-        fgets(ligne, 32, file);
-        time_sec=atoi(ligne);
-        Printf("temps de vol total: %is = %imin = %ih\n",time_sec,time_sec/60,time_sec/3600);
-        fclose(file);
+    pwm_moteur[tested_motor] = (uint16_t)test->Value();
+
+    if (GetTime() > (start_time + 2 * 1000000000))
+      StopTest();
+  }
+
+  i2cport->GetMutex();
+
+  if (enabled == true) {
+    i2cport->SetSlave(slave_address + av_g->CurrentIndex());
+    WriteValue(pwm_moteur[0]);
+
+    i2cport->SetSlave(slave_address + av_d->CurrentIndex());
+    WriteValue(pwm_moteur[2]);
+
+    i2cport->SetSlave(slave_address + ar_g->CurrentIndex());
+    WriteValue(pwm_moteur[3]);
+
+    i2cport->SetSlave(slave_address + ar_d->CurrentIndex());
+    WriteValue(pwm_moteur[1]);
+
+  } else {
+    for (int i = 0; i < 4; i++) {
+      i2cport->SetSlave(slave_address + i);
+      WriteValue(0);
     }
-
-    //station sol
-    main_tab=new Tab(parent->GetTabWidget(),name);
-    tab=new TabWidget(main_tab->NewRow(),name);
-	Tab *sensor_tab=new Tab(tab,"Reglages");
-	reglages_groupbox=new GroupBox(sensor_tab->NewRow(),name);
-            poles=new SpinBox(reglages_groupbox->NewRow(),"nb poles",0,255,1);
-            kp=new DoubleSpinBox(reglages_groupbox->LastRowLastCol(),"kp",0.,255,0.001,4);
-            ki=new DoubleSpinBox(reglages_groupbox->LastRowLastCol(),"ki",0.,255,0.001,4);
-            min=new SpinBox(reglages_groupbox->NewRow(),"min pwm",0.,2048,1);
-            max=new SpinBox(reglages_groupbox->LastRowLastCol(),"max pwm",0.,2048,1);
-            test=new SpinBox(reglages_groupbox->LastRowLastCol(),"test value",0.,2048,1);
-            start_value=new SpinBox(reglages_groupbox->NewRow(),"valeur demarrage",0,10000,10);
-            trim=new DoubleSpinBox(reglages_groupbox->LastRowLastCol(),"pas decollage",0,1000,.1);
-
-            av_g=new ComboBox(reglages_groupbox->NewRow(),"avant gauche");
-            av_g->AddItem("1");
-            av_g->AddItem("2");
-            av_g->AddItem("3");
-            av_g->AddItem("4");
-            button_avg=new PushButton(reglages_groupbox->LastRowLastCol(),"test avg");
-
-            av_d=new ComboBox(reglages_groupbox->LastRowLastCol(),"avant droite:");
-            av_d->AddItem("1");
-            av_d->AddItem("2");
-            av_d->AddItem("3");
-            av_d->AddItem("4");
-            button_avd=new PushButton(reglages_groupbox->LastRowLastCol(),"test avd");
-
-            ar_g=new ComboBox(reglages_groupbox->NewRow(),"arriere gauche:");
-            ar_g->AddItem("1");
-            ar_g->AddItem("2");
-            ar_g->AddItem("3");
-            ar_g->AddItem("4");
-            button_arg=new PushButton(reglages_groupbox->LastRowLastCol(),"test arg");
-
-            ar_d=new ComboBox(reglages_groupbox->LastRowLastCol(),"arriere droite:");
-            ar_d->AddItem("1");
-            ar_d->AddItem("2");
-            ar_d->AddItem("3");
-            ar_d->AddItem("4");
-            button_ard=new PushButton(reglages_groupbox->LastRowLastCol(),"test ard");
-
-            pas=new ComboBox(reglages_groupbox->NewRow(),"pas helice avant gauche:");
-            pas->AddItem("normal");
-            pas->AddItem("inverse");
-
-    input=new cvmatrix((IODevice*)this,8,1,floatType);
-
-    cvmatrix_descriptor* desc=new cvmatrix_descriptor(4,2);
-    desc->SetElementName(0,0,"avant gauche");
-	desc->SetElementName(1,0,"arriere droite");
-	desc->SetElementName(2,0,"avant droite");
-	desc->SetElementName(3,0,"arriere gauche");
-
-	desc->SetElementName(0,1,"cons avant gauche");
-	desc->SetElementName(1,1,"cons arriere droite");
-	desc->SetElementName(2,1,"cons avant droite");
-	desc->SetElementName(3,1,"cons arriere gauche");
-    output=new cvmatrix((IODevice*)this,desc,floatType);
-
-
-
-/*
-
-//le 3ieme lu est la tension batteire
-	if(i2c_mutex!=NULL) i2c_mutex->GetMutex();
-    uint16_t pwm_moteur;
-    pwm_moteur=0;
-    ssize_t read;
-    uint8_t rx[8];
-    SetSlave(slave_address);
-
-    for(int j=0;j<10;j++)
-    {
-
-
-        WriteValue(pwm_moteur);
-
-
-        read = rt_dev_read(i2c_fd, rx, sizeof(rx));
-
-        if(read<0)
-        {
-            rt_printf("BlCtrlV2_x4_speed::BlCtrlV2_x4_speed: %s, erreur rt_dev_read (%s)\n",IODevice::ObjectName().c_str(),strerror(-read));
-        }
-        else if (read != sizeof(rx))
-        {
-            rt_printf("BlCtrlV2_x4_speed::BlCtrlV2_x4_speed: %s, erreur rt_dev_read %i/2\n",IODevice::ObjectName().c_str(),read);
-
-        }
-        for(int i=0;i<sizeof(rx);i++) printf("%i ",rx[i]);
-
-        printf("\n");
-
+    int_av_g = 0;
+    int_av_d = 0;
+    int_ar_g = 0;
+    int_ar_d = 0;
+  }
+
+  i2cport->SetSlave(slave_address + av_g->CurrentIndex());
+  speed_av_g = GetSpeed();
+
+  i2cport->SetSlave(slave_address + av_d->CurrentIndex());
+  speed_av_d = GetSpeed();
+
+  i2cport->SetSlave(slave_address + ar_g->CurrentIndex());
+  speed_ar_g = GetSpeed();
+
+  i2cport->SetSlave(slave_address + ar_d->CurrentIndex());
+  speed_ar_d = GetSpeed();
+
+  i2cport->ReleaseMutex();
+
+  // on prend une fois pour toute le mutex et on fait des accès directs
+  output->GetMutex();
+  output->SetValueNoMutex(0, 0, speed_av_g);
+  output->SetValueNoMutex(1, 0, speed_ar_d);
+  output->SetValueNoMutex(2, 0, speed_av_d);
+  output->SetValueNoMutex(3, 0, speed_ar_g);
+  // rt_printf("%i %i %i
+  // %i\n",pwm_moteur[0],pwm_moteur[1],pwm_moteur[2],pwm_moteur[3]);
+  output->ReleaseMutex();
+
+  output->SetDataTime(GetTime());
+  ProcessUpdate(output);
+}
+
+void BlCtrlV2_x4_speed::StartTest(void) {
+  start_time = GetTime();
+  SetEnabled(true);
+}
+
+void BlCtrlV2_x4_speed::StopTest(void) {
+  SetEnabled(false);
+  tested_motor = -1;
+}
+
+uint16_t BlCtrlV2_x4_speed::SatPWM(float vel_cons, uint16_t min, uint16_t max) {
+  uint16_t sat_value = (uint16_t)vel_cons;
+
+  if (vel_cons > ((float)sat_value + 0.5))
+    sat_value++;
+
+  if (vel_cons < (float)min)
+    sat_value = min;
+  if (vel_cons > (float)max)
+    sat_value = max;
+
+  return sat_value;
+}
+
+void BlCtrlV2_x4_speed::LockUserInterface(void) {
+  reglages_groupbox->setEnabled(false);
+}
+
+void BlCtrlV2_x4_speed::UnlockUserInterface(void) {
+  reglages_groupbox->setEnabled(true);
+}
+
+void BlCtrlV2_x4_speed::SetEnabled(bool status) {
+  enabled = status;
+  if (enabled == true) {
+    LockUserInterface();
+
+    flight_start_time = GetTime();
+  } else {
+    UnlockUserInterface();
+
+    Time now = GetTime();
+    int t_sec;
+    FILE *file;
+    char ligne[32];
+
+    t_sec = (now - flight_start_time) / 1000000000;
+    time_sec += t_sec;
+
+    Printf("temps de vol: %is = %imin\n", t_sec, t_sec / 60);
+    Printf("temps de vol total: %is = %imin = %ih\n", time_sec, time_sec / 60,
+           time_sec / 3600);
+
+    file = fopen("/etc/flight_time", "w");
+    if (file == NULL) {
+      Thread::Err("Erreur a l'ouverture du fichier d'info vol\n");
+    } else {
+      sprintf(ligne, "%i", time_sec);
+      fputs(ligne, file);
+      fclose(file);
     }
-
-    if(i2c_mutex!=NULL) i2c_mutex->ReleaseMutex();*/
-}
-
-BlCtrlV2_x4_speed::~BlCtrlV2_x4_speed(void)
-{
-    SafeStop();
-    Join();
-    delete main_tab;
-}
-
-void BlCtrlV2_x4_speed::UseDefaultPlot(void)
-{
-    Tab *plot_tab=new Tab(tab,"Mesures");
-        DataPlot1D *av_g_plot=new DataPlot1D(plot_tab->NewRow(),"avg",0,10000);
-            av_g_plot->AddCurve(output->Element(0,0));
-            av_g_plot->AddCurve(output->Element(0,1),DataPlot::Blue);
-        DataPlot1D *av_d_plot=new DataPlot1D(plot_tab->LastRowLastCol(),"avd",0,10000);
-            av_d_plot->AddCurve(output->Element(2,0));
-            av_d_plot->AddCurve(output->Element(2,1),DataPlot::Blue);
-        DataPlot1D *ar_g_plot=new DataPlot1D(plot_tab->NewRow(),"arg",0,10000);
-            ar_g_plot->AddCurve(output->Element(3,0));
-            ar_g_plot->AddCurve(output->Element(3,1),DataPlot::Blue);
-        DataPlot1D *ar_d_plot=new DataPlot1D(plot_tab->LastRowLastCol(),"ard",0,10000);
-            ar_d_plot->AddCurve(output->Element(1,0));
-            ar_d_plot->AddCurve(output->Element(1,1),DataPlot::Blue);
-}
-
-float BlCtrlV2_x4_speed::TrimValue(void)
-{
-    return (float)trim->Value();
-}
-
-int BlCtrlV2_x4_speed::StartValue(void)
-{
-    return start_value->Value();
-}
-
-void BlCtrlV2_x4_speed::Run(void)
-{
-    WarnUponSwitches(true);
-
-    SetPeriodUS(TAU_US);
-
-    while(!ToBeStopped())
-    {
-        WaitPeriod();
-
-        Update();
-    }
-
-    WarnUponSwitches(false);
-}
-
-void BlCtrlV2_x4_speed::Update(void)
-{
-    float u_roll,u_pitch,u_yaw,u_gaz;
-    float trim_roll,trim_pitch,trim_yaw;
-    float pwm[4];
-    uint16_t pwm_moteur[4];
-
-
-    //on prend une fois pour toute le mutex et on fait des accès directs
-    input->GetMutex();
-
-    u_roll=input->ValueNoMutex(0,0);
-    u_pitch=input->ValueNoMutex(1,0);
-    u_yaw=input->ValueNoMutex(2,0);
-    u_gaz=input->ValueNoMutex(3,0)+input->ValueNoMutex(7,0)*input->ValueNoMutex(7,0);//ugaz+trim*trim
-    trim_roll=input->ValueNoMutex(4,0);
-    trim_pitch=input->ValueNoMutex(5,0);
-    trim_yaw=input->ValueNoMutex(6,0);
-
-    input->ReleaseMutex();
-
-    if(pas->CurrentIndex()==1)
-    {
-        trim_yaw=-trim_yaw;
-        u_yaw=-u_yaw;
-    }
-
-    //rt_printf("%f %f %f %f\n",u_roll,u_pitch,u_yaw,u_gaz);
-    //if(u_gaz!=0) rt_printf("gaz: %f\n",u_gaz);
-
-    //avant gauche
-    if(u_gaz+u_pitch+u_roll+u_yaw>0)
-    {
-        pwm[0]=trim_pitch+trim_roll+trim_yaw+sqrtf(u_gaz+u_pitch+u_roll+u_yaw);
-    }else
-    {
-        pwm[0]=trim_pitch+trim_roll+trim_yaw;
-    }
-
-    //arriere gauche
-    if(u_gaz-u_pitch+u_roll-u_yaw>0)
-    {
-        pwm[3]=-trim_pitch+trim_roll-trim_yaw+sqrtf(u_gaz-u_pitch+u_roll-u_yaw);
-    }else
-    {
-        pwm[3]=-trim_pitch+trim_roll-trim_yaw;
-    }
-
-    //arriere droit
-    if(u_gaz-u_pitch-u_roll+u_yaw>0)
-    {
-        pwm[1]=-trim_pitch-trim_roll+trim_yaw+sqrtf(u_gaz-u_pitch-u_roll+u_yaw);
-    }else
-    {
-        pwm[1]=-trim_pitch-trim_roll+trim_yaw;
-    }
-
-    //avant droit
-    if(u_gaz+u_pitch-u_roll-u_yaw>0)
-    {
-        pwm[2]=trim_pitch-trim_roll-trim_yaw+sqrtf(u_gaz+u_pitch-u_roll-u_yaw);
-    }else
-    {
-        pwm[2]=trim_pitch-trim_roll-trim_yaw;
-    }
-
-
-    int_av_g+=ki->Value()*(pwm[0]-speed_av_g);
-    pwm[0]=kp->Value()*(pwm[0]-speed_av_g)+int_av_g;
-
-    int_ar_g+=ki->Value()*(pwm[3]-speed_ar_g);
-    pwm[3]=kp->Value()*(pwm[3]-speed_ar_g)+int_ar_g;
-
-    int_ar_d+=ki->Value()*(pwm[1]-speed_ar_d);
-    pwm[1]=kp->Value()*(pwm[1]-speed_ar_d)+int_ar_d;
-
-    int_av_d+=ki->Value()*(pwm[2]-speed_av_d);
-    pwm[2]=kp->Value()*(pwm[2]-speed_av_d)+int_av_d;
-
-//rt_printf("%f\n",pwm[0]);
-    for(int i=0;i<4;i++) pwm_moteur[i]=SatPWM(pwm[i],min->Value(),max->Value());
-
-    if(button_avg->Clicked()==true)
-    {
-        tested_motor=0;
-        StartTest();
-    }
-    if(button_avd->Clicked()==true)
-    {
-        tested_motor=2;
-        StartTest();
-    }
-    if(button_arg->Clicked()==true)
-    {
-        tested_motor=3;
-        StartTest();
-    }
-    if(button_ard->Clicked()==true)
-    {
-        tested_motor=1;
-        StartTest();
-    }
-
-    if(tested_motor!=-1)
-    {
-        for(int i=0;i<4;i++)
-        {
-            pwm_moteur[i]=0;
-        }
-        pwm_moteur[tested_motor]=(uint16_t)test->Value();
-
-        if(GetTime()>(start_time+2*1000000000)) StopTest();
-    }
-
-
-    i2cport->GetMutex();
-
-    if(enabled==true)
-    {
-        i2cport->SetSlave(slave_address+av_g->CurrentIndex());
-        WriteValue(pwm_moteur[0]);
-
-        i2cport->SetSlave(slave_address+av_d->CurrentIndex());
-        WriteValue(pwm_moteur[2]);
-
-        i2cport->SetSlave(slave_address+ar_g->CurrentIndex());
-        WriteValue(pwm_moteur[3]);
-
-        i2cport->SetSlave(slave_address+ar_d->CurrentIndex());
-        WriteValue(pwm_moteur[1]);
-
-    }
-    else
-    {
-        for(int i=0;i<4;i++)
-        {
-            i2cport->SetSlave(slave_address+i);
-            WriteValue(0);
-        }
-        int_av_g=0;
-        int_av_d=0;
-        int_ar_g=0;
-        int_ar_d=0;
-    }
-
-    i2cport->SetSlave(slave_address+av_g->CurrentIndex());
-    speed_av_g=GetSpeed();
-
-    i2cport->SetSlave(slave_address+av_d->CurrentIndex());
-    speed_av_d=GetSpeed();
-
-    i2cport->SetSlave(slave_address+ar_g->CurrentIndex());
-    speed_ar_g=GetSpeed();
-
-    i2cport->SetSlave(slave_address+ar_d->CurrentIndex());
-    speed_ar_d=GetSpeed();
-
-    i2cport->ReleaseMutex();
-
-
-    //on prend une fois pour toute le mutex et on fait des accès directs
-    output->GetMutex();
-    output->SetValueNoMutex(0,0,speed_av_g);
-    output->SetValueNoMutex(1,0,speed_ar_d);
-    output->SetValueNoMutex(2,0,speed_av_d);
-    output->SetValueNoMutex(3,0,speed_ar_g);
-   // rt_printf("%i %i %i %i\n",pwm_moteur[0],pwm_moteur[1],pwm_moteur[2],pwm_moteur[3]);
-    output->ReleaseMutex();
-
-    output->SetDataTime(GetTime());
-    ProcessUpdate(output);
-
-}
-
-void BlCtrlV2_x4_speed::StartTest(void)
-{
-    start_time=GetTime();
-    SetEnabled(true);
-}
-
-void BlCtrlV2_x4_speed::StopTest(void)
-{
-    SetEnabled(false);
-    tested_motor=-1;
-}
-
-uint16_t BlCtrlV2_x4_speed::SatPWM(float vel_cons,uint16_t min,uint16_t max)
-{
-  uint16_t sat_value=(uint16_t)vel_cons;
-
-  if(vel_cons>((float)sat_value+0.5)) sat_value++;
-
-  if(vel_cons<(float)min) sat_value=min;
-  if(vel_cons>(float)max) sat_value=max;
-
-  return sat_value;
-}
-
-void BlCtrlV2_x4_speed::LockUserInterface(void)
-{
-    reglages_groupbox->setEnabled(false);
-}
-
-void BlCtrlV2_x4_speed::UnlockUserInterface(void)
-{
-    reglages_groupbox->setEnabled(true);
-}
-
-void BlCtrlV2_x4_speed::SetEnabled(bool status)
-{
-    enabled=status;
-    if(enabled==true)
-    {
-        LockUserInterface();
-
-        flight_start_time = GetTime();
-    }
-    else
-    {
-        UnlockUserInterface();
-
-        Time now= GetTime();
-        int t_sec;
-        FILE *file;
-        char ligne[32];
-
-        t_sec=(now - flight_start_time)/1000000000;
-        time_sec+=t_sec;
-
-        Printf("temps de vol: %is = %imin\n",t_sec,t_sec/60);
-        Printf("temps de vol total: %is = %imin = %ih\n",time_sec,time_sec/60,time_sec/3600);
-
-        file=fopen("/etc/flight_time","w");
-        if (file == NULL)
-        {
-            Thread::Err("Erreur a l'ouverture du fichier d'info vol\n");
-        }
-        else
-        {
-            sprintf(ligne,"%i",time_sec);
-            fputs(ligne,file);
-            fclose(file);
-        }
-    }
-}
-
-void BlCtrlV2_x4_speed::SetUroll(float value)
-{
-    input->SetValue(0,0,value);
-}
-
-void BlCtrlV2_x4_speed::SetUpitch(float value)
-{
-    input->SetValue(1,0,value);
-}
-
-void BlCtrlV2_x4_speed::SetUyaw(float value)
-{
-    input->SetValue(2,0,value);
-}
-
-void BlCtrlV2_x4_speed::SetUgaz(float value)
-{
-    input->SetValue(3,0,value);
-}
-
-void BlCtrlV2_x4_speed::SetRollTrim(float value)
-{
-    input->SetValue(4,0,value);
-}
-
-void BlCtrlV2_x4_speed::SetPitchTrim(float value)
-{
-    input->SetValue(5,0,value);
-}
-
-void BlCtrlV2_x4_speed::SetYawTrim(float value)
-{
-    input->SetValue(6,0,value);
-}
-
-void BlCtrlV2_x4_speed::SetGazTrim(float value)
-{
-    input->SetValue(7,0,value);
-}
-
-void BlCtrlV2_x4_speed::WriteValue(uint16_t value)
-{
-    unsigned char tx[2];
-    ssize_t written;
-
-    tx[0]=(unsigned char)(value>>3);//msb
-    tx[1]=16+8+(value&0x07);//16+8 pour recuperer la vitesse
-    written = i2cport->Write(tx, 2);
-    if(written<0)
-    {
-        Thread::Err("erreur rt_dev_write (%s)\n",strerror(-written));
-    }
-    else if (written != 2)
-    {
-        Thread::Err("erreur rt_dev_write %i/2\n",written);
-    }
-}
-
-float BlCtrlV2_x4_speed::GetSpeed(void)
-{
-    ssize_t read;
-    uint8_t value;
-    read = i2cport->Read(&value, 1);
-
-    if(read<0)
-    {
-        Thread::Err("erreur rt_dev_read (%s)\n",strerror(-read));
-    }
-    else if (read != 1)
-    {
-        Thread::Err("erreur rt_dev_read %i/2\n",read);
-
-    }
-
-    return value*780./poles->Value();
+  }
+}
+
+void BlCtrlV2_x4_speed::SetUroll(float value) { input->SetValue(0, 0, value); }
+
+void BlCtrlV2_x4_speed::SetUpitch(float value) { input->SetValue(1, 0, value); }
+
+void BlCtrlV2_x4_speed::SetUyaw(float value) { input->SetValue(2, 0, value); }
+
+void BlCtrlV2_x4_speed::SetUgaz(float value) { input->SetValue(3, 0, value); }
+
+void BlCtrlV2_x4_speed::SetRollTrim(float value) {
+  input->SetValue(4, 0, value);
+}
+
+void BlCtrlV2_x4_speed::SetPitchTrim(float value) {
+  input->SetValue(5, 0, value);
+}
+
+void BlCtrlV2_x4_speed::SetYawTrim(float value) {
+  input->SetValue(6, 0, value);
+}
+
+void BlCtrlV2_x4_speed::SetGazTrim(float value) {
+  input->SetValue(7, 0, value);
+}
+
+void BlCtrlV2_x4_speed::WriteValue(uint16_t value) {
+  unsigned char tx[2];
+  ssize_t written;
+
+  tx[0] = (unsigned char)(value >> 3); // msb
+  tx[1] = 16 + 8 + (value & 0x07);     // 16+8 pour recuperer la vitesse
+  written = i2cport->Write(tx, 2);
+  if (written < 0) {
+    Thread::Err("erreur rt_dev_write (%s)\n", strerror(-written));
+  } else if (written != 2) {
+    Thread::Err("erreur rt_dev_write %i/2\n", written);
+  }
+}
+
+float BlCtrlV2_x4_speed::GetSpeed(void) {
+  ssize_t read;
+  uint8_t value;
+  read = i2cport->Read(&value, 1);
+
+  if (read < 0) {
+    Thread::Err("erreur rt_dev_read (%s)\n", strerror(-read));
+  } else if (read != 1) {
+    Thread::Err("erreur rt_dev_read %i/2\n", read);
+  }
+
+  return value * 780. / poles->Value();
 }
 
Index: trunk/lib/FlairSensorActuator/src/BlCtrlV2_x4_speed.h
===================================================================
--- trunk/lib/FlairSensorActuator/src/BlCtrlV2_x4_speed.h	(revision 14)
+++ trunk/lib/FlairSensorActuator/src/BlCtrlV2_x4_speed.h	(revision 15)
@@ -16,5 +16,4 @@
 /*********************************************************************/
 
-
 #ifndef BLCTRLV2_X4_SPEED_H
 #define BLCTRLV2_X4_SPEED_H
@@ -23,96 +22,91 @@
 #include <Thread.h>
 
-namespace flair
-{
-    namespace core
-    {
-        class cvmatrix;
-        class FrameworkManager;
-        class I2cPort;
-
-    }
-    namespace gui
-    {
-        class TabWidget;
-        class Tab;
-        class SpinBox;
-        class DoubleSpinBox;
-        class ComboBox;
-        class PushButton;
-        class GroupBox;
-    }
+namespace flair {
+namespace core {
+class cvmatrix;
+class FrameworkManager;
+class I2cPort;
+}
+namespace gui {
+class TabWidget;
+class Tab;
+class SpinBox;
+class DoubleSpinBox;
+class ComboBox;
+class PushButton;
+class GroupBox;
+}
 }
 
-namespace flair
-{
-namespace actuator
-{
-    class BlCtrlV2_x4_speed : public core::Thread,public core::IODevice
-    {
+namespace flair {
+namespace actuator {
+class BlCtrlV2_x4_speed : public core::Thread, public core::IODevice {
 
-        public:
-            BlCtrlV2_x4_speed(core::FrameworkManager* parent,std::string name,core::I2cPort* i2cport,uint8_t base_address,uint8_t priority);
-            ~BlCtrlV2_x4_speed();
-            void UseDefaultPlot(void);
-            void LockUserInterface(void);
-            void UnlockUserInterface(void);
-            void SetEnabled(bool status);
-            void SetUroll(float value);
-            void SetUpitch(float value);
-            void SetUyaw(float value);
-            void SetUgaz(float value);
-            void SetRollTrim(float value);
-            void SetPitchTrim(float value);
-            void SetYawTrim(float value);
-            void SetGazTrim(float value);
-            float TrimValue(void);
-            int StartValue(void);
+public:
+  BlCtrlV2_x4_speed(core::FrameworkManager *parent, std::string name,
+                    core::I2cPort *i2cport, uint8_t base_address,
+                    uint8_t priority);
+  ~BlCtrlV2_x4_speed();
+  void UseDefaultPlot(void);
+  void LockUserInterface(void);
+  void UnlockUserInterface(void);
+  void SetEnabled(bool status);
+  void SetUroll(float value);
+  void SetUpitch(float value);
+  void SetUyaw(float value);
+  void SetUgaz(float value);
+  void SetRollTrim(float value);
+  void SetPitchTrim(float value);
+  void SetYawTrim(float value);
+  void SetGazTrim(float value);
+  float TrimValue(void);
+  int StartValue(void);
 
-        private:
-            /*!
-            * \brief Update using provided datas
-            *
-            * Reimplemented from IODevice.
-            *
-            * \param data data from the parent to process
-            */
-            void UpdateFrom(core::io_data *data){};
-            void WriteValue(uint16_t value);
-            float GetSpeed(void);
-            void StartTest(void);
-            void StopTest(void);
-            /*!
-            * \brief Run function
-            *
-            * Reimplemented from Thread.
-            *
-            */
-            void Run(void);
-            void Update(void);
-            gui::Tab* main_tab;
-            gui::TabWidget* tab;
-            gui::GroupBox* reglages_groupbox;
-            gui::SpinBox *min,*max,*test;
-            gui::PushButton *button_avg,*button_avd,*button_arg,*button_ard;
-            gui::ComboBox *av_g,*av_d,*ar_g,*ar_d,*pas;
-            gui::DoubleSpinBox *trim,*kp,*ki;
-            gui::SpinBox *start_value,*poles;
-            core::Time start_time,flight_start_time;
-            int time_sec;
-            float speed_av_g,speed_av_d,speed_ar_g,speed_ar_d;
-            float int_av_g,int_av_d,int_ar_g,int_ar_d;
+private:
+  /*!
+  * \brief Update using provided datas
+  *
+  * Reimplemented from IODevice.
+  *
+  * \param data data from the parent to process
+  */
+  void UpdateFrom(core::io_data *data){};
+  void WriteValue(uint16_t value);
+  float GetSpeed(void);
+  void StartTest(void);
+  void StopTest(void);
+  /*!
+  * \brief Run function
+  *
+  * Reimplemented from Thread.
+  *
+  */
+  void Run(void);
+  void Update(void);
+  gui::Tab *main_tab;
+  gui::TabWidget *tab;
+  gui::GroupBox *reglages_groupbox;
+  gui::SpinBox *min, *max, *test;
+  gui::PushButton *button_avg, *button_avd, *button_arg, *button_ard;
+  gui::ComboBox *av_g, *av_d, *ar_g, *ar_d, *pas;
+  gui::DoubleSpinBox *trim, *kp, *ki;
+  gui::SpinBox *start_value, *poles;
+  core::Time start_time, flight_start_time;
+  int time_sec;
+  float speed_av_g, speed_av_d, speed_ar_g, speed_ar_d;
+  float int_av_g, int_av_d, int_ar_g, int_ar_d;
 
-            //matrix
-            core::cvmatrix *input;
-            core::cvmatrix *output;
+  // matrix
+  core::cvmatrix *input;
+  core::cvmatrix *output;
 
-            int tested_motor;
-            core::I2cPort* i2cport;
-            uint8_t slave_address;
+  int tested_motor;
+  core::I2cPort *i2cport;
+  uint8_t slave_address;
 
-            bool enabled;
+  bool enabled;
 
-            uint16_t SatPWM(float vel_cons,uint16_t min,uint16_t max);
-    };
+  uint16_t SatPWM(float vel_cons, uint16_t min, uint16_t max);
+};
 } // end namespace actuator
 } // end namespace flair
Index: trunk/lib/FlairSensorActuator/src/Bldc.cpp
===================================================================
--- trunk/lib/FlairSensorActuator/src/Bldc.cpp	(revision 14)
+++ trunk/lib/FlairSensorActuator/src/Bldc.cpp	(revision 15)
@@ -27,79 +27,67 @@
 using namespace flair::gui;
 
-namespace flair { namespace actuator {
+namespace flair {
+namespace actuator {
 
-Bldc::Bldc(const IODevice* parent,Layout* layout,string name,uint8_t motors_count) : IODevice(parent,name) {
-    pimpl_=new Bldc_impl(this,layout,name,motors_count);
+Bldc::Bldc(const IODevice *parent, Layout *layout, string name,
+           uint8_t motors_count)
+    : IODevice(parent, name) {
+  pimpl_ = new Bldc_impl(this, layout, name, motors_count);
 
-    cvmatrix_descriptor* desc=new cvmatrix_descriptor(motors_count,2);
-    for(int i=0;i<motors_count;i++) {
-        ostringstream speed,current;
-        speed << "speed_" << i;
-        desc->SetElementName(i,0,speed.str());
+  cvmatrix_descriptor *desc = new cvmatrix_descriptor(motors_count, 2);
+  for (int i = 0; i < motors_count; i++) {
+    ostringstream speed, current;
+    speed << "speed_" << i;
+    desc->SetElementName(i, 0, speed.str());
 
-        current << "current_" << i;
-        desc->SetElementName(i,1,current.str());
-    }
+    current << "current_" << i;
+    desc->SetElementName(i, 1, current.str());
+  }
 
-    output=new cvmatrix(this,desc,floatType);
-    AddDataToLog(output);
+  output = new cvmatrix(this, desc, floatType);
+  AddDataToLog(output);
 }
 
-Bldc::Bldc(const Object* parent,string name,uint8_t motors_count) : IODevice(parent,name) {
-    pimpl_=new Bldc_impl(this,motors_count);
+Bldc::Bldc(const Object *parent, string name, uint8_t motors_count)
+    : IODevice(parent, name) {
+  pimpl_ = new Bldc_impl(this, motors_count);
 }
 
-Bldc::~Bldc() {
-    delete pimpl_;
+Bldc::~Bldc() { delete pimpl_; }
+
+void Bldc::UpdateFrom(const io_data *data) { pimpl_->UpdateFrom(data); }
+
+void Bldc::LockUserInterface(void) const { pimpl_->LockUserInterface(); }
+
+void Bldc::UnlockUserInterface(void) const { pimpl_->UnlockUserInterface(); }
+
+Layout *Bldc::GetLayout(void) const { return (Layout *)pimpl_->layout; }
+
+void Bldc::UseDefaultPlot(TabWidget *tabwidget) {
+  pimpl_->UseDefaultPlot(tabwidget);
 }
 
-void Bldc::UpdateFrom(const io_data *data) {
-    pimpl_->UpdateFrom(data);
+uint8_t Bldc::MotorsCount(void) const { return pimpl_->motors_count; }
+
+cvmatrix *Bldc::Output(void) const { return output; }
+
+bool Bldc::AreEnabled(void) const { return pimpl_->are_enabled; }
+
+void Bldc::SetEnabled(bool status) {
+  if (pimpl_->are_enabled != status) {
+    pimpl_->are_enabled = status;
+    if (pimpl_->are_enabled) {
+      LockUserInterface();
+    } else {
+      UnlockUserInterface();
+    }
+  }
 }
 
-void Bldc::LockUserInterface(void) const {
-    pimpl_->LockUserInterface();
-}
-
-void Bldc::UnlockUserInterface(void) const {
-    pimpl_->UnlockUserInterface();
-}
-
-Layout* Bldc::GetLayout(void) const {
-    return (Layout*)pimpl_->layout;
-}
-
-void Bldc::UseDefaultPlot(TabWidget* tabwidget) {
-    pimpl_->UseDefaultPlot(tabwidget);
-}
-
-uint8_t Bldc::MotorsCount(void) const {
-    return pimpl_->motors_count;
-}
-
-cvmatrix *Bldc::Output(void) const {
-    return output;
-}
-
-bool Bldc::AreEnabled(void) const {
-    return pimpl_->are_enabled;
-}
-
-void Bldc::SetEnabled(bool status) {
-    if(pimpl_->are_enabled!=status) {
-        pimpl_->are_enabled=status;
-        if(pimpl_->are_enabled) {
-            LockUserInterface();
-        } else {
-            UnlockUserInterface();
-        }
-    }
-}
-
-void Bldc::SetPower(int motor_id,float value) {
-    //use output mutex to avoid making a new mutex
-    output->GetMutex();
-    pimpl_->power[motor_id]=value;
-    output->ReleaseMutex();
+void Bldc::SetPower(int motor_id, float value) {
+  // use output mutex to avoid making a new mutex
+  output->GetMutex();
+  pimpl_->power[motor_id] = value;
+  output->ReleaseMutex();
 }
 
Index: trunk/lib/FlairSensorActuator/src/Bldc.h
===================================================================
--- trunk/lib/FlairSensorActuator/src/Bldc.h	(revision 14)
+++ trunk/lib/FlairSensorActuator/src/Bldc.h	(revision 15)
@@ -17,174 +17,172 @@
 #include <stdint.h>
 
-namespace flair
-{
-    namespace core
-    {
-        class FrameworkManager;
-        class cvmatrix;
-    }
-    namespace gui
-    {
-        class Layout;
-        class TabWidget;
-    }
+namespace flair {
+namespace core {
+class FrameworkManager;
+class cvmatrix;
+}
+namespace gui {
+class Layout;
+class TabWidget;
+}
 }
 
 class Bldc_impl;
 
-namespace flair
-{
-namespace actuator
-{
-    /*! \class Bldc
-    *
-    * \brief Base class for brushless motors drivers
-    */
-    class Bldc : public core::IODevice
-    {
-        friend class ::Bldc_impl;
+namespace flair {
+namespace actuator {
+/*! \class Bldc
+*
+* \brief Base class for brushless motors drivers
+*/
+class Bldc : public core::IODevice {
+  friend class ::Bldc_impl;
 
-        public:
-            /*!
-            * \brief Constructor
-            *
-            * Construct a Bldc.
-            *
-            * \param parent parent
-            * \param layout layout
-            * \param name name
-            * \param motors_count number of motors
-            */
-            Bldc(const core::IODevice* parent,gui::Layout* layout,std::string name,uint8_t motors_count);
+public:
+  /*!
+  * \brief Constructor
+  *
+  * Construct a Bldc.
+  *
+  * \param parent parent
+  * \param layout layout
+  * \param name name
+  * \param motors_count number of motors
+  */
+  Bldc(const core::IODevice *parent, gui::Layout *layout, std::string name,
+       uint8_t motors_count);
 
-            /*!
-            * \brief Constructor
-            *
-            * Construct a Bldc. \n
-            * This contructor must only be called for a simulated device.
-            *
-            * \param parent parent
-            * \param name name
-            * \param motors_count number of motors
-            */
-            Bldc(const core::Object* parent,std::string name,uint8_t motors_count);
+  /*!
+  * \brief Constructor
+  *
+  * Construct a Bldc. \n
+  * This contructor must only be called for a simulated device.
+  *
+  * \param parent parent
+  * \param name name
+  * \param motors_count number of motors
+  */
+  Bldc(const core::Object *parent, std::string name, uint8_t motors_count);
 
-            /*!
-            * \brief Destructor
-            *
-            */
-            ~Bldc();
+  /*!
+  * \brief Destructor
+  *
+  */
+  ~Bldc();
 
-            /*!
-            * \brief Lock user interface
-            *
-            */
-            void LockUserInterface(void) const;
+  /*!
+  * \brief Lock user interface
+  *
+  */
+  void LockUserInterface(void) const;
 
-            /*!
-            * \brief Unlock user interface
-            *
-            */
-            void UnlockUserInterface(void) const;
+  /*!
+  * \brief Unlock user interface
+  *
+  */
+  void UnlockUserInterface(void) const;
 
-            /*!
-            * \brief Use default plot
-            *
-            * \param tabwidget TabWidget to draw plots
-            */
-            void UseDefaultPlot(gui::TabWidget* tabwidget);
+  /*!
+  * \brief Use default plot
+  *
+  * \param tabwidget TabWidget to draw plots
+  */
+  void UseDefaultPlot(gui::TabWidget *tabwidget);
 
-            /*!
-            * \brief Output from motors
-            *
-            * First column is real speed if available, secund column is current if available
-            *
-            */
-            core::cvmatrix *Output(void) const;
+  /*!
+  * \brief Output from motors
+  *
+  * First column is real speed if available, secund column is current if
+  *available
+  *
+  */
+  core::cvmatrix *Output(void) const;
 
-            /*!
-            * \brief Motors count
-            *
-            * \return number of motors
-            */
-            uint8_t MotorsCount(void) const;
+  /*!
+  * \brief Motors count
+  *
+  * \return number of motors
+  */
+  uint8_t MotorsCount(void) const;
 
-            /*!
-            * \brief Enable motors
-            *
-            * \param true to enable all motors
-            */
-            void SetEnabled(bool status);
+  /*!
+  * \brief Enable motors
+  *
+  * \param true to enable all motors
+  */
+  void SetEnabled(bool status);
 
-            /*!
-            * \brief Are motors enabled?
-            *
-            * \return true if motors are enabled
-            */
-            bool AreEnabled(void) const;
+  /*!
+  * \brief Are motors enabled?
+  *
+  * \return true if motors are enabled
+  */
+  bool AreEnabled(void) const;
 
-            /*!
-            * \brief Set motor power
-            *
-            * Changes the power (from 0 to 1) of a specific motor. \n
-            * By default power is set to 1 for each motor which has no effect. \n
-            * A value <1 will decrease the power of a motor sent to the reimplemented Bldc class through SetMotors. \n
-            * The power value is applied after applying saturation between min value and max value.
-            * So the resulting value cannot be higher than max value
-            * but it can be lower than min value.
-            *
-            * \param motor_id id of the motor
-            * \param value power value (from 0 to 1)
-            *
-            */
-            void SetPower(int motor_id,float value);
+  /*!
+  * \brief Set motor power
+  *
+  * Changes the power (from 0 to 1) of a specific motor. \n
+  * By default power is set to 1 for each motor which has no effect. \n
+  * A value <1 will decrease the power of a motor sent to the reimplemented Bldc
+  *class through SetMotors. \n
+  * The power value is applied after applying saturation between min value and
+  *max value.
+  * So the resulting value cannot be higher than max value
+  * but it can be lower than min value.
+  *
+  * \param motor_id id of the motor
+  * \param value power value (from 0 to 1)
+  *
+  */
+  void SetPower(int motor_id, float value);
 
-            /*!
-            * \brief Layout
-            *
-            * This the same Layout as passed to the constructor
-            *
-            * \return a Layout
-            */
-            gui::Layout* GetLayout(void) const;
+  /*!
+  * \brief Layout
+  *
+  * This the same Layout as passed to the constructor
+  *
+  * \return a Layout
+  */
+  gui::Layout *GetLayout(void) const;
 
-            /*!
-            * \brief Has speed measurement
-            *
-            * \return true if it has speed measurement
-            */
-            virtual bool HasSpeedMeasurement(void) const=0;
+  /*!
+  * \brief Has speed measurement
+  *
+  * \return true if it has speed measurement
+  */
+  virtual bool HasSpeedMeasurement(void) const = 0;
 
-            /*!
-            * \brief Has current measurement
-            *
-            * \return true if it has current measurement
-            */
-            virtual bool HasCurrentMeasurement(void) const=0;
+  /*!
+  * \brief Has current measurement
+  *
+  * \return true if it has current measurement
+  */
+  virtual bool HasCurrentMeasurement(void) const = 0;
 
-        protected:
-            core::cvmatrix *output;
+protected:
+  core::cvmatrix *output;
 
-        private:
-            /*!
-            * \brief Update using provided datas
-            *
-            * Reimplemented from IODevice.
-            *
-            * \param data data from the parent to process
-            */
-            void UpdateFrom(const core::io_data *data);
+private:
+  /*!
+  * \brief Update using provided datas
+  *
+  * Reimplemented from IODevice.
+  *
+  * \param data data from the parent to process
+  */
+  void UpdateFrom(const core::io_data *data);
 
-            /*!
-            * \brief Set motors values
-            *
-            * values size must be the same as MotorsCount()
-            *
-            * \param values set motors values
-            */
-            virtual void SetMotors(float* values)=0;
+  /*!
+  * \brief Set motors values
+  *
+  * values size must be the same as MotorsCount()
+  *
+  * \param values set motors values
+  */
+  virtual void SetMotors(float *values) = 0;
 
-            class Bldc_impl* pimpl_;
-    };
+  class Bldc_impl *pimpl_;
+};
 } // end namespace actuator
 } // end namespace framewor
Index: trunk/lib/FlairSensorActuator/src/Bldc_impl.cpp
===================================================================
--- trunk/lib/FlairSensorActuator/src/Bldc_impl.cpp	(revision 14)
+++ trunk/lib/FlairSensorActuator/src/Bldc_impl.cpp	(revision 15)
@@ -35,168 +35,177 @@
 using namespace flair::actuator;
 
-Bldc_impl::Bldc_impl(Bldc* self,Layout* layout,string name,uint8_t motors_count) {
-    this->self=self;
-    this->motors_count=motors_count;
-    this->layout=layout;
-	are_enabled=false;
-	is_running=false;
-	tested_motor=-1;
-
-    values=(float*)malloc(motors_count*sizeof(float));
-    power=(float*)malloc(motors_count*sizeof(float));
-    for(int i=0;i<motors_count;i++) power[i]=1;
-
-    //station sol
-	GroupBox* groupbox=new GroupBox(layout->NewRow(),"bldc");
-        flight_time=new Label(groupbox->NewRow(),"flight time");
-        min_value=new DoubleSpinBox(groupbox->NewRow(),"min value:",0,1,.1,2);
-        max_value=new DoubleSpinBox(groupbox->LastRowLastCol(),"max value:",0,1,.1,2);
-        test_value=new DoubleSpinBox(groupbox->LastRowLastCol(),"test value:",0,1,0.1);
-
-    int index=0;
-    button_test=(PushButton**)malloc(motors_count*sizeof(PushButton*));
-    for(int i=0;i<motors_count/2;i++) {
-        for(int j=0;j<2;j++) {
-            ostringstream test_name;
-            test_name << "test motor " << index;
-            button_test[index]=new PushButton(groupbox->At(2+i,j),test_name.str());
-            index++;
-        }
-    }
-
-	//flight time
-	FILE *file;
-    file=fopen("/etc/flight_time","r");
+Bldc_impl::Bldc_impl(Bldc *self, Layout *layout, string name,
+                     uint8_t motors_count) {
+  this->self = self;
+  this->motors_count = motors_count;
+  this->layout = layout;
+  are_enabled = false;
+  is_running = false;
+  tested_motor = -1;
+
+  values = (float *)malloc(motors_count * sizeof(float));
+  power = (float *)malloc(motors_count * sizeof(float));
+  for (int i = 0; i < motors_count; i++)
+    power[i] = 1;
+
+  // station sol
+  GroupBox *groupbox = new GroupBox(layout->NewRow(), "bldc");
+  flight_time = new Label(groupbox->NewRow(), "flight time");
+  min_value = new DoubleSpinBox(groupbox->NewRow(), "min value:", 0, 1, .1, 2);
+  max_value =
+      new DoubleSpinBox(groupbox->LastRowLastCol(), "max value:", 0, 1, .1, 2);
+  test_value =
+      new DoubleSpinBox(groupbox->LastRowLastCol(), "test value:", 0, 1, 0.1);
+
+  int index = 0;
+  button_test = (PushButton **)malloc(motors_count * sizeof(PushButton *));
+  for (int i = 0; i < motors_count / 2; i++) {
+    for (int j = 0; j < 2; j++) {
+      ostringstream test_name;
+      test_name << "test motor " << index;
+      button_test[index] =
+          new PushButton(groupbox->At(2 + i, j), test_name.str());
+      index++;
+    }
+  }
+
+  // flight time
+  FILE *file;
+  file = fopen("/etc/flight_time", "r");
+  if (file == NULL) {
+    time_sec = 0;
+  } else {
+    char ligne[32];
+    fgets(ligne, 32, file);
+    time_sec = atoi(ligne);
+    fclose(file);
+  }
+  flight_time->SetText("total flight time: %is = %imin = %ih\n", time_sec,
+                       time_sec / 60, time_sec / 3600);
+}
+
+Bldc_impl::Bldc_impl(Bldc *self, uint8_t motors_count) {
+  this->self = self;
+  this->motors_count = motors_count;
+  values = NULL;
+  button_test = NULL;
+  power = NULL;
+}
+
+Bldc_impl::~Bldc_impl() {
+  if (values != NULL)
+    free(values);
+  if (button_test != NULL)
+    free(button_test);
+  if (power != NULL)
+    free(power);
+}
+
+void Bldc_impl::UseDefaultPlot(TabWidget *tab) {
+  Tab *plot_tab = new Tab(tab, "speeds");
+  plots = new DataPlot1D(plot_tab->NewRow(), "values", 0, 1);
+  for (int i = 0; i < motors_count; i++) {
+    plots->AddCurve(self->output->Element(i));
+  }
+}
+
+void Bldc_impl::UpdateFrom(const io_data *data) {
+  cvmatrix *input = (cvmatrix *)data;
+  bool is_motor_running = false;
+
+  if (values == NULL)
+    return; // nothing to do in simulator
+
+  if (input->Rows() != motors_count) {
+    self->Err("nb motors mismatch\n");
+    return;
+  }
+
+  input->GetMutex();
+  for (int i = 0; i < motors_count; i++) {
+    if (input->ValueNoMutex(i, 0) != 0)
+      is_motor_running = true;
+    if (are_enabled) {
+      // Printf("%i %f %f\n",i,input->ValueNoMutex(i,0),power[i]);
+      values[i] = power[i] * Sat(input->ValueNoMutex(i, 0));
+      // Printf("%i %f\n",i,values[i]);
+    } else {
+      values[i] = 0;
+    }
+  }
+  input->ReleaseMutex();
+
+  if (are_enabled && is_motor_running && !is_running) {
+    flight_start_time = GetTime();
+    is_running = true;
+  }
+  if ((!are_enabled || !is_motor_running) && is_running) {
+    Time now = GetTime();
+    int t_sec;
+    FILE *file;
+    char ligne[32];
+
+    t_sec = (now - flight_start_time) / 1000000000;
+    time_sec += t_sec;
+
+    Printf("temps de vol: %is = %imin\n", t_sec, t_sec / 60);
+    // Printf("temps de vol total: %is = %imin =
+    // %ih\n",time_sec,time_sec/60,time_sec/3600);
+    flight_time->SetText("total flight time: %is = %imin = %ih\n", time_sec,
+                         time_sec / 60, time_sec / 3600);
+
+    file = fopen("/etc/flight_time", "w");
     if (file == NULL) {
-        time_sec=0;
+      Printf("Erreur a l'ouverture du fichier d'info vol\n");
     } else {
-        char ligne[32];
-        fgets(ligne, 32, file);
-        time_sec=atoi(ligne);
-        fclose(file);
-    }
-    flight_time->SetText("total flight time: %is = %imin = %ih\n",time_sec,time_sec/60,time_sec/3600);
-}
-
-Bldc_impl::Bldc_impl(Bldc* self,uint8_t motors_count) {
-    this->self=self;
-    this->motors_count=motors_count;
-    values=NULL;
-    button_test=NULL;
-    power=NULL;
-}
-
-Bldc_impl::~Bldc_impl() {
-    if(values!=NULL) free(values);
-    if(button_test!=NULL) free(button_test);
-    if(power!=NULL) free(power);
-}
-
-void Bldc_impl::UseDefaultPlot(TabWidget* tab) {
-    Tab* plot_tab=new Tab(tab,"speeds");
-    plots=new DataPlot1D(plot_tab->NewRow(),"values",0,1);
-    for(int i=0;i<motors_count;i++) {
-        plots->AddCurve(self->output->Element(i));
-    }
-}
-
-void Bldc_impl::UpdateFrom(const io_data *data) {
-    cvmatrix* input=(cvmatrix*)data;
-    bool is_motor_running=false;
-
-    if(values==NULL) return;//nothing to do in simulator
-
-    if(input->Rows()!=motors_count) {
-        self->Err("nb motors mismatch\n");
-        return;
-    }
-
-    input->GetMutex();
-    for(int i=0;i<motors_count;i++) {
-        if(input->ValueNoMutex(i,0)!=0) is_motor_running=true;
-        if(are_enabled) {
-            //Printf("%i %f %f\n",i,input->ValueNoMutex(i,0),power[i]);
-            values[i]=power[i]*Sat(input->ValueNoMutex(i,0));
-            //Printf("%i %f\n",i,values[i]);
-        } else {
-            values[i]=0;
-        }
-    }
-    input->ReleaseMutex();
-
-    if(are_enabled && is_motor_running && !is_running) {
-        flight_start_time = GetTime();
-        is_running=true;
-    }
-    if((!are_enabled || !is_motor_running) && is_running) {
-        Time now= GetTime();
-        int t_sec;
-        FILE *file;
-        char ligne[32];
-
-        t_sec=(now - flight_start_time)/1000000000;
-        time_sec+=t_sec;
-
-        Printf("temps de vol: %is = %imin\n",t_sec,t_sec/60);
-        //Printf("temps de vol total: %is = %imin = %ih\n",time_sec,time_sec/60,time_sec/3600);
-        flight_time->SetText("total flight time: %is = %imin = %ih\n",time_sec,time_sec/60,time_sec/3600);
-
-        file=fopen("/etc/flight_time","w");
-        if (file == NULL) {
-            Printf("Erreur a l'ouverture du fichier d'info vol\n");
-        } else {
-            sprintf(ligne,"%i",time_sec);
-            fputs(ligne,file);
-            fclose(file);
-        }
-        is_running=false;
-    }
-
-    for(int i=0;i<motors_count;i++) {
-        if(button_test[i]->Clicked()==true) {
-            if(!are_enabled) {
-                tested_motor=i;
-                test_start_time=GetTime();
-                LockUserInterface();
-            } else {
-                self->Warn("testing motor is not possible when enabled\n");
-            }
-        }
-    }
-    if(tested_motor!=-1) {
-        for(int i=0;i<motors_count;i++) {
-            values[i]=0;
-        }
-        values[tested_motor]=test_value->Value();
-
-        if(GetTime()>(test_start_time+2*1000000000)) {
-            tested_motor=-1;
-            UnlockUserInterface();
-        }
-    }
-
-    self->SetMotors(values);
-    self->output->SetDataTime(data->DataTime());
-    self->ProcessUpdate(self->output);
+      sprintf(ligne, "%i", time_sec);
+      fputs(ligne, file);
+      fclose(file);
+    }
+    is_running = false;
+  }
+
+  for (int i = 0; i < motors_count; i++) {
+    if (button_test[i]->Clicked() == true) {
+      if (!are_enabled) {
+        tested_motor = i;
+        test_start_time = GetTime();
+        LockUserInterface();
+      } else {
+        self->Warn("testing motor is not possible when enabled\n");
+      }
+    }
+  }
+  if (tested_motor != -1) {
+    for (int i = 0; i < motors_count; i++) {
+      values[i] = 0;
+    }
+    values[tested_motor] = test_value->Value();
+
+    if (GetTime() > (test_start_time + 2 * 1000000000)) {
+      tested_motor = -1;
+      UnlockUserInterface();
+    }
+  }
+
+  self->SetMotors(values);
+  self->output->SetDataTime(data->DataTime());
+  self->ProcessUpdate(self->output);
 }
 
 float Bldc_impl::Sat(float value) {
-    float result=value;
-
-    if(result<min_value->Value()) {
-        result=min_value->Value();
-    }
-    if(result>max_value->Value()) {
-        result=max_value->Value();
-    }
-
-    return result;
-}
-
-void Bldc_impl::LockUserInterface(void) const {
-    layout->setEnabled(false);
-}
-
-void Bldc_impl::UnlockUserInterface(void) const {
-    layout->setEnabled(true);
-}
+  float result = value;
+
+  if (result < min_value->Value()) {
+    result = min_value->Value();
+  }
+  if (result > max_value->Value()) {
+    result = max_value->Value();
+  }
+
+  return result;
+}
+
+void Bldc_impl::LockUserInterface(void) const { layout->setEnabled(false); }
+
+void Bldc_impl::UnlockUserInterface(void) const { layout->setEnabled(true); }
Index: trunk/lib/FlairSensorActuator/src/Camera.cpp
===================================================================
--- trunk/lib/FlairSensorActuator/src/Camera.cpp	(revision 14)
+++ trunk/lib/FlairSensorActuator/src/Camera.cpp	(revision 15)
@@ -31,81 +31,76 @@
 using namespace flair::gui;
 
-namespace flair { namespace sensor {
+namespace flair {
+namespace sensor {
 
-Camera::Camera(const FrameworkManager* parent,string name,uint16_t width,uint16_t height,cvimage::Type::Format format) : IODevice(parent,name) {
-    plot_tab=NULL;
+Camera::Camera(const FrameworkManager *parent, string name, uint16_t width,
+               uint16_t height, cvimage::Type::Format format)
+    : IODevice(parent, name) {
+  plot_tab = NULL;
 
-    //do not allocate imagedata, allocation is done by the camera
-    output=new cvimage((IODevice*)this,width,height,format,"out",false);
+  // do not allocate imagedata, allocation is done by the camera
+  output = new cvimage((IODevice *)this, width, height, format, "out", false);
 
-    //station sol
-    main_tab=new Tab(parent->GetTabWidget(),name);
-    tab=new TabWidget(main_tab->NewRow(),name);
-	sensor_tab=new Tab(tab,"Setup");
-	setup_groupbox=new GroupBox(sensor_tab->NewRow(),name);
-	setup_layout=new GridLayout(sensor_tab->NewRow(),"setup");
+  // station sol
+  main_tab = new Tab(parent->GetTabWidget(), name);
+  tab = new TabWidget(main_tab->NewRow(), name);
+  sensor_tab = new Tab(tab, "Setup");
+  setup_groupbox = new GroupBox(sensor_tab->NewRow(), name);
+  setup_layout = new GridLayout(sensor_tab->NewRow(), "setup");
 }
 
-Camera::Camera(const IODevice* parent,std::string name) : IODevice(parent,name) {
-    plot_tab=NULL;
-    main_tab=NULL;
-    tab=NULL;
-	sensor_tab=NULL;
-	setup_groupbox=NULL;
+Camera::Camera(const IODevice *parent, std::string name)
+    : IODevice(parent, name) {
+  plot_tab = NULL;
+  main_tab = NULL;
+  tab = NULL;
+  sensor_tab = NULL;
+  setup_groupbox = NULL;
 
-    output=NULL;
+  output = NULL;
 }
 
 Camera::~Camera() {
-    if(main_tab!=NULL) delete main_tab;
+  if (main_tab != NULL)
+    delete main_tab;
 }
 
 DataType const &Camera::GetOutputDataType() const {
-    return output->GetDataType();
+  return output->GetDataType();
 }
 
-GroupBox* Camera::GetGroupBox(void) const {
-    return setup_groupbox;
+GroupBox *Camera::GetGroupBox(void) const { return setup_groupbox; }
+
+GridLayout *Camera::GetLayout(void) const { return setup_layout; }
+
+void Camera::UseDefaultPlot(const core::cvimage *image) {
+  if (tab == NULL) {
+    Err("not applicable for simulation part.\n");
+    return;
+  }
+
+  plot_tab = new Tab(tab, "Picture");
+  Picture *plot = new Picture(plot_tab->NewRow(), ObjectName(), image);
 }
 
-GridLayout* Camera::GetLayout(void) const {
-    return setup_layout;
+Tab *Camera::GetPlotTab(void) const { return plot_tab; }
+
+uint16_t Camera::Width(void) const { return output->GetDataType().GetWidth(); }
+
+uint16_t Camera::Height(void) const {
+  return output->GetDataType().GetHeight();
 }
 
-void Camera::UseDefaultPlot(const core::cvimage *image) {
-    if(tab==NULL) {
-        Err("not applicable for simulation part.\n");
-        return;
-    }
-
-    plot_tab=new Tab(tab,"Picture");
-        Picture* plot=new Picture(plot_tab->NewRow(),ObjectName(),image);
-}
-
-Tab* Camera::GetPlotTab(void) const {
-    return plot_tab;
-}
-
-uint16_t Camera::Width(void) const {
-    return output->GetDataType().GetWidth();
-}
-
-uint16_t Camera::Height(void) const {
-    return output->GetDataType().GetHeight();
-}
-
-core::cvimage* Camera::Output(void) {
-    return output;
-}
+core::cvimage *Camera::Output(void) { return output; }
 
 void Camera::SaveToFile(string filename) const {
-    Printf("saving %s, size %i\n",filename.c_str(),output->img->imageSize);
-    std::ofstream pFile;
-	pFile.open (filename);
-	output->GetMutex();
-	pFile.write(output->img->imageData, output->img->imageSize);
-    output->ReleaseMutex();
+  Printf("saving %s, size %i\n", filename.c_str(), output->img->imageSize);
+  std::ofstream pFile;
+  pFile.open(filename);
+  output->GetMutex();
+  pFile.write(output->img->imageData, output->img->imageSize);
+  output->ReleaseMutex();
 
-	pFile.close();
+  pFile.close();
 }
 
Index: trunk/lib/FlairSensorActuator/src/Camera.h
===================================================================
--- trunk/lib/FlairSensorActuator/src/Camera.h	(revision 14)
+++ trunk/lib/FlairSensorActuator/src/Camera.h	(revision 15)
@@ -18,129 +18,125 @@
 #include <cvimage.h>
 
-namespace flair
-{
-    namespace gui
-    {
-        class GroupBox;
-        class Tab;
-        class TabWidget;
-        class Picture;
-        class GridLayout;
-    }
+namespace flair {
+namespace gui {
+class GroupBox;
+class Tab;
+class TabWidget;
+class Picture;
+class GridLayout;
+}
 }
 
-namespace flair
-{
-namespace sensor
-{
-    /*! \class Camera
-    *
-    * \brief Base class for Camera
-    *
-    * Use this class to define a custom Camera.
-    *
-    */
-    class Camera : public core::IODevice
-    {
-        public:
-            /*!
-            * \brief Constructor
-            *
-            * Construct a Camera.
-            *
-            * \param parent parent
-            * \param name name
-            * \param width width
-            * \param height height
-            * \param format image format
-            */
-            Camera(const core::FrameworkManager* parent,std::string name,uint16_t width,uint16_t height,core::cvimage::Type::Format format);
+namespace flair {
+namespace sensor {
+/*! \class Camera
+*
+* \brief Base class for Camera
+*
+* Use this class to define a custom Camera.
+*
+*/
+class Camera : public core::IODevice {
+public:
+  /*!
+  * \brief Constructor
+  *
+  * Construct a Camera.
+  *
+  * \param parent parent
+  * \param name name
+  * \param width width
+  * \param height height
+  * \param format image format
+  */
+  Camera(const core::FrameworkManager *parent, std::string name, uint16_t width,
+         uint16_t height, core::cvimage::Type::Format format);
 
-            /*!
-            * \brief Constructor
-            *
-            * Construct a Camera. \n
-            * This contructor must only be called for a simulated device.
-            *
-            * \param parent parent
-            * \param name name
-            */
-            Camera(const core::IODevice* parent,std::string name);
+  /*!
+  * \brief Constructor
+  *
+  * Construct a Camera. \n
+  * This contructor must only be called for a simulated device.
+  *
+  * \param parent parent
+  * \param name name
+  */
+  Camera(const core::IODevice *parent, std::string name);
 
-            /*!
-            * \brief Destructor
-            *
-            */
-            ~Camera();
+  /*!
+  * \brief Destructor
+  *
+  */
+  ~Camera();
 
-            /*!
-            * \brief Use default plot
-            *
-            * \param image image to display
-            */
-            void UseDefaultPlot(const core::cvimage *image);
+  /*!
+  * \brief Use default plot
+  *
+  * \param image image to display
+  */
+  void UseDefaultPlot(const core::cvimage *image);
 
-            /*!
-            * \brief get Layout
-            *
-            * \return a Layout available
-            */
-            gui::GridLayout* GetLayout(void) const;
+  /*!
+  * \brief get Layout
+  *
+  * \return a Layout available
+  */
+  gui::GridLayout *GetLayout(void) const;
 
-            /*!
-            * \brief plot tab
-            *
-            * \return plot tab
-            */
-            gui::Tab* GetPlotTab(void) const;
+  /*!
+  * \brief plot tab
+  *
+  * \return plot tab
+  */
+  gui::Tab *GetPlotTab(void) const;
 
-            /*!
-            * \brief Save picture to file
-            *
-            * \param filename filename
-            */
-            void SaveToFile(std::string filename) const;
+  /*!
+  * \brief Save picture to file
+  *
+  * \param filename filename
+  */
+  void SaveToFile(std::string filename) const;
 
-            /*!
-            * \brief Width
-            *
-            * \return width
-            */
-            uint16_t Width(void) const;
+  /*!
+  * \brief Width
+  *
+  * \return width
+  */
+  uint16_t Width(void) const;
 
-            /*!
-            * \brief Height
-            *
-            * \return height
-            */
-            uint16_t Height(void) const;
+  /*!
+  * \brief Height
+  *
+  * \return height
+  */
+  uint16_t Height(void) const;
 
-             /*!
-            * \brief Output matrix
-            *
-            * Output matrix is of the same size as declared in constructor. \n
-            *
-            * \return the output matrix
-            */
-            core::cvimage* Output(void);
+  /*!
+ * \brief Output matrix
+ *
+ * Output matrix is of the same size as declared in constructor. \n
+ *
+ * \return the output matrix
+ */
+  core::cvimage *Output(void);
 
-            core::DataType const &GetOutputDataType() const;
+  core::DataType const &GetOutputDataType() const;
 
-        protected:
-            /*!
-            * \brief get GroupBox
-            *
-            * \return a GroupBox available
-            */
-            gui::GroupBox* GetGroupBox(void) const;
+protected:
+  /*!
+  * \brief get GroupBox
+  *
+  * \return a GroupBox available
+  */
+  gui::GroupBox *GetGroupBox(void) const;
 
-            core::cvimage *output;
+  core::cvimage *output;
 
-        private:
-            gui::Tab *main_tab,*sensor_tab,*plot_tab;
-            gui::TabWidget *tab;
-            gui::GroupBox* setup_groupbox;
-            gui::GridLayout* setup_layout;
-    };
+private:
+  gui::Tab *main_tab, *sensor_tab, *plot_tab;
+  gui::TabWidget *tab;
+  gui::GroupBox *setup_groupbox;
+  gui::GridLayout *setup_layout;
+};
 } // end namespace sensor
 } // end namespace flair
Index: trunk/lib/FlairSensorActuator/src/Controller.cpp
===================================================================
--- trunk/lib/FlairSensorActuator/src/Controller.cpp	(revision 14)
+++ trunk/lib/FlairSensorActuator/src/Controller.cpp	(revision 15)
@@ -19,119 +19,130 @@
 using namespace flair::core;
 
-namespace flair { namespace sensor {
+namespace flair {
+namespace sensor {
 
-RumbleMessage::RumbleMessage(unsigned int leftForce,unsigned int leftTimeout,unsigned int rightForce,unsigned int rightTimeout):Message(sizeof(ControllerAction)+sizeof(leftForce)+sizeof(leftTimeout)+sizeof(rightForce)+sizeof(rightTimeout)) {
-    SetLeftForce(leftForce);
-    SetLeftTimeout(leftTimeout);
-    SetRightForce(rightForce);
-    SetRightTimeout(rightTimeout);
-    buffer[0]=(char)ControllerAction::Rumble;
+RumbleMessage::RumbleMessage(unsigned int leftForce, unsigned int leftTimeout,
+                             unsigned int rightForce, unsigned int rightTimeout)
+    : Message(sizeof(ControllerAction) + sizeof(leftForce) +
+              sizeof(leftTimeout) + sizeof(rightForce) + sizeof(rightTimeout)) {
+  SetLeftForce(leftForce);
+  SetLeftTimeout(leftTimeout);
+  SetRightForce(rightForce);
+  SetRightTimeout(rightTimeout);
+  buffer[0] = (char)ControllerAction::Rumble;
 }
 
 unsigned int RumbleMessage::GetLeftForce() const {
-    unsigned int leftForce;
-    memcpy(&leftForce,buffer+leftForceOffset,sizeof(leftForce));
-    return leftForce;
+  unsigned int leftForce;
+  memcpy(&leftForce, buffer + leftForceOffset, sizeof(leftForce));
+  return leftForce;
 }
 
 unsigned int RumbleMessage::GetLeftTimeout() const {
-    unsigned int leftTimeout;
-    memcpy(&leftTimeout,buffer+leftTimeoutOffset,sizeof(leftTimeout));
-    return leftTimeout;
+  unsigned int leftTimeout;
+  memcpy(&leftTimeout, buffer + leftTimeoutOffset, sizeof(leftTimeout));
+  return leftTimeout;
 }
 
 unsigned int RumbleMessage::GetRightForce() const {
-    unsigned int rightForce;
-    memcpy(&rightForce,buffer+rightForceOffset,sizeof(rightForce));
-    return rightForce;
+  unsigned int rightForce;
+  memcpy(&rightForce, buffer + rightForceOffset, sizeof(rightForce));
+  return rightForce;
 }
 
 unsigned int RumbleMessage::GetRightTimeout() const {
-    unsigned int rightTimeout;
-    memcpy(&rightTimeout,buffer+rightTimeoutOffset,sizeof(rightTimeout));
-    return rightTimeout;
+  unsigned int rightTimeout;
+  memcpy(&rightTimeout, buffer + rightTimeoutOffset, sizeof(rightTimeout));
+  return rightTimeout;
 }
 
 void RumbleMessage::SetLeftForce(unsigned int leftForce) {
-    memcpy(buffer+leftForceOffset,&leftForce,sizeof(leftForce));
+  memcpy(buffer + leftForceOffset, &leftForce, sizeof(leftForce));
 }
 
 void RumbleMessage::SetLeftTimeout(unsigned int leftTimeout) {
-    memcpy(buffer+leftTimeoutOffset,&leftTimeout,sizeof(leftTimeout));
+  memcpy(buffer + leftTimeoutOffset, &leftTimeout, sizeof(leftTimeout));
 }
 
 void RumbleMessage::SetRightForce(unsigned int rightForce) {
-    memcpy(buffer+rightForceOffset,&rightForce,sizeof(rightForce));
+  memcpy(buffer + rightForceOffset, &rightForce, sizeof(rightForce));
 }
 
-void RumbleMessage::SetRightTimeout(unsigned int rightTimeout){
-    memcpy(buffer+rightTimeoutOffset,&rightTimeout,sizeof(rightTimeout));
+void RumbleMessage::SetRightTimeout(unsigned int rightTimeout) {
+  memcpy(buffer + rightTimeoutOffset, &rightTimeout, sizeof(rightTimeout));
 }
 
-SwitchLedMessage::SwitchLedMessage(bool isOn, unsigned int ledId):Message(sizeof(ControllerAction)+sizeof(isOn)+sizeof(ledId)) {
-    if (isOn) SetOn(); else SetOff();
-    SetLedId(ledId);
+SwitchLedMessage::SwitchLedMessage(bool isOn, unsigned int ledId)
+    : Message(sizeof(ControllerAction) + sizeof(isOn) + sizeof(ledId)) {
+  if (isOn)
+    SetOn();
+  else
+    SetOff();
+  SetLedId(ledId);
 }
 
 bool SwitchLedMessage::IsOn() const {
-    bool isOn;
-    memcpy(&isOn,buffer+isOnOffset,sizeof(isOn));
-    return isOn;
+  bool isOn;
+  memcpy(&isOn, buffer + isOnOffset, sizeof(isOn));
+  return isOn;
 }
 
 unsigned int SwitchLedMessage::GetLedId() const {
-    unsigned int ledId;
-    memcpy(&ledId,buffer+ledIdOffset,sizeof(ledId));
-    return ledId;
+  unsigned int ledId;
+  memcpy(&ledId, buffer + ledIdOffset, sizeof(ledId));
+  return ledId;
 }
 
 void SwitchLedMessage::SetOn() {
-    bool isOn=true;
-    memcpy(buffer+isOnOffset,&isOn,sizeof(isOn));
+  bool isOn = true;
+  memcpy(buffer + isOnOffset, &isOn, sizeof(isOn));
 }
 
 void SwitchLedMessage::SetOff() {
-    bool isOn=false;
-    memcpy(buffer+isOnOffset,&isOn,sizeof(isOn));
+  bool isOn = false;
+  memcpy(buffer + isOnOffset, &isOn, sizeof(isOn));
 }
 
 void SwitchLedMessage::SetLedId(unsigned int ledId) {
-    memcpy(buffer+ledIdOffset,&ledId,sizeof(ledId));
+  memcpy(buffer + ledIdOffset, &ledId, sizeof(ledId));
 }
 
-FlashLedMessage::FlashLedMessage(unsigned int ledId,unsigned int onTime,unsigned int offTime):Message(sizeof(ControllerAction)+sizeof(ledId)+sizeof(onTime)+sizeof(offTime)) {
-    SetLedId(ledId);
-    SetOnTime(onTime);
-    SetOffTime(offTime);
+FlashLedMessage::FlashLedMessage(unsigned int ledId, unsigned int onTime,
+                                 unsigned int offTime)
+    : Message(sizeof(ControllerAction) + sizeof(ledId) + sizeof(onTime) +
+              sizeof(offTime)) {
+  SetLedId(ledId);
+  SetOnTime(onTime);
+  SetOffTime(offTime);
 }
 
 unsigned int FlashLedMessage::GetLedId() const {
-    unsigned int ledId;
-    memcpy(&ledId,buffer+ledIdOffset,sizeof(ledId));
-    return ledId;
+  unsigned int ledId;
+  memcpy(&ledId, buffer + ledIdOffset, sizeof(ledId));
+  return ledId;
 }
 
 unsigned int FlashLedMessage::GetOnTime() const {
-    unsigned int onTime;
-    memcpy(&onTime,buffer+onTimeOffset,sizeof(onTime));
-    return onTime;
+  unsigned int onTime;
+  memcpy(&onTime, buffer + onTimeOffset, sizeof(onTime));
+  return onTime;
 }
 
 unsigned int FlashLedMessage::GetOffTime() const {
-    unsigned int offTime;
-    memcpy(&offTime,buffer+offTimeOffset,sizeof(offTime));
-    return offTime;
+  unsigned int offTime;
+  memcpy(&offTime, buffer + offTimeOffset, sizeof(offTime));
+  return offTime;
 }
 
 void FlashLedMessage::SetLedId(unsigned int ledId) {
-    memcpy(buffer+ledIdOffset,&ledId,sizeof(ledId));
+  memcpy(buffer + ledIdOffset, &ledId, sizeof(ledId));
 }
 
 void FlashLedMessage::SetOnTime(unsigned int onTime) {
-    memcpy(buffer+onTimeOffset,&onTime,sizeof(onTime));
+  memcpy(buffer + onTimeOffset, &onTime, sizeof(onTime));
 }
 
 void FlashLedMessage::SetOffTime(unsigned int offTime) {
-    memcpy(buffer+offTimeOffset,&offTime,sizeof(offTime));
+  memcpy(buffer + offTimeOffset, &offTime, sizeof(offTime));
 }
 
Index: trunk/lib/FlairSensorActuator/src/Controller.h
===================================================================
--- trunk/lib/FlairSensorActuator/src/Controller.h	(revision 14)
+++ trunk/lib/FlairSensorActuator/src/Controller.h	(revision 15)
@@ -23,66 +23,72 @@
 
 namespace flair {
-    namespace core {
-        class Message;
-    }
+namespace core {
+class Message;
+}
 }
 
-namespace flair { namespace sensor {
+namespace flair {
+namespace sensor {
 
-    enum class ControllerAction {
-        SetLedOn,
-        SetLedOff,
-        Rumble,
-        FlashLed,
-        Exit
-    };
+enum class ControllerAction { SetLedOn, SetLedOff, Rumble, FlashLed, Exit };
 
-    class RumbleMessage: public core::Message {
-    public:
-        RumbleMessage(unsigned int leftForce,unsigned int leftTimeout,unsigned int rightForce,unsigned int rightTimeout);
-        unsigned int GetLeftForce() const;
-        unsigned int GetLeftTimeout() const;
-        unsigned int GetRightForce() const;
-        unsigned int GetRightTimeout() const;
-        void SetLeftForce(unsigned int leftForce);
-        void SetLeftTimeout(unsigned int leftTimeout);
-        void SetRightForce(unsigned int rightForce);
-        void SetRightTimeout(unsigned int rightTimeout);
-    private:
-        static const unsigned int leftForceOffset=sizeof(ControllerAction);
-        static const unsigned int leftTimeoutOffset=sizeof(ControllerAction)+sizeof(unsigned int);
-        static const unsigned int rightForceOffset=sizeof(ControllerAction)+2*sizeof(unsigned int);
-        static const unsigned int rightTimeoutOffset=sizeof(ControllerAction)+3*sizeof(unsigned int);
-    };
+class RumbleMessage : public core::Message {
+public:
+  RumbleMessage(unsigned int leftForce, unsigned int leftTimeout,
+                unsigned int rightForce, unsigned int rightTimeout);
+  unsigned int GetLeftForce() const;
+  unsigned int GetLeftTimeout() const;
+  unsigned int GetRightForce() const;
+  unsigned int GetRightTimeout() const;
+  void SetLeftForce(unsigned int leftForce);
+  void SetLeftTimeout(unsigned int leftTimeout);
+  void SetRightForce(unsigned int rightForce);
+  void SetRightTimeout(unsigned int rightTimeout);
 
-    class SwitchLedMessage: public core::Message {
-    public:
-        SwitchLedMessage(bool isOn,unsigned int ledId);
-        bool IsOn() const;
-        unsigned int GetLedId() const;
-        void SetOn();
-        void SetOff();
-        void SetLedId(unsigned int ledId);
-    private:
-        static const unsigned int isOnOffset=sizeof(ControllerAction);
-        static const unsigned int ledIdOffset=sizeof(ControllerAction)+sizeof(bool);
-    };
+private:
+  static const unsigned int leftForceOffset = sizeof(ControllerAction);
+  static const unsigned int leftTimeoutOffset =
+      sizeof(ControllerAction) + sizeof(unsigned int);
+  static const unsigned int rightForceOffset =
+      sizeof(ControllerAction) + 2 * sizeof(unsigned int);
+  static const unsigned int rightTimeoutOffset =
+      sizeof(ControllerAction) + 3 * sizeof(unsigned int);
+};
 
-    class FlashLedMessage: public core::Message {
-    public:
-        FlashLedMessage(unsigned int ledId,unsigned int onTime,unsigned int offTime);
-        unsigned int GetLedId() const;
-        unsigned int GetOnTime() const;
-        unsigned int GetOffTime() const;
-        void SetLedId(unsigned int ledId);
-        void SetOnTime(unsigned int onTime);
-        void SetOffTime(unsigned int offTime);
-    private:
-        static const unsigned int ledIdOffset=sizeof(ControllerAction);
-        static const unsigned int onTimeOffset=sizeof(ControllerAction)+sizeof(unsigned int);
-        static const unsigned int offTimeOffset=sizeof(ControllerAction)+2*sizeof(unsigned int);
-    };
+class SwitchLedMessage : public core::Message {
+public:
+  SwitchLedMessage(bool isOn, unsigned int ledId);
+  bool IsOn() const;
+  unsigned int GetLedId() const;
+  void SetOn();
+  void SetOff();
+  void SetLedId(unsigned int ledId);
 
-}}
+private:
+  static const unsigned int isOnOffset = sizeof(ControllerAction);
+  static const unsigned int ledIdOffset =
+      sizeof(ControllerAction) + sizeof(bool);
+};
+
+class FlashLedMessage : public core::Message {
+public:
+  FlashLedMessage(unsigned int ledId, unsigned int onTime,
+                  unsigned int offTime);
+  unsigned int GetLedId() const;
+  unsigned int GetOnTime() const;
+  unsigned int GetOffTime() const;
+  void SetLedId(unsigned int ledId);
+  void SetOnTime(unsigned int onTime);
+  void SetOffTime(unsigned int offTime);
+
+private:
+  static const unsigned int ledIdOffset = sizeof(ControllerAction);
+  static const unsigned int onTimeOffset =
+      sizeof(ControllerAction) + sizeof(unsigned int);
+  static const unsigned int offTimeOffset =
+      sizeof(ControllerAction) + 2 * sizeof(unsigned int);
+};
+}
+}
 
 #endif // CONTROLLER_H
Index: trunk/lib/FlairSensorActuator/src/Gps.cpp
===================================================================
--- trunk/lib/FlairSensorActuator/src/Gps.cpp	(revision 14)
+++ trunk/lib/FlairSensorActuator/src/Gps.cpp	(revision 15)
@@ -38,303 +38,254 @@
 using namespace flair::gui;
 
-namespace flair
-{
-namespace sensor
-{
-
-Gps::Gps(const FrameworkManager* parent,string name,NMEAFlags_t NMEAFlags) : IODevice(parent,name)
-{
-    this->NMEAFlags=NMEAFlags;
-
-    nmea_zero_INFO(&info);
-    nmea_parser_init(&parser);
-    alt_ref=0;
-
-
-    if((NMEAFlags&GGA)==0)
+namespace flair {
+namespace sensor {
+
+Gps::Gps(const FrameworkManager *parent, string name, NMEAFlags_t NMEAFlags)
+    : IODevice(parent, name) {
+  this->NMEAFlags = NMEAFlags;
+
+  nmea_zero_INFO(&info);
+  nmea_parser_init(&parser);
+  alt_ref = 0;
+
+  if ((NMEAFlags & GGA) == 0) {
+    Err("Enable at least GGA sentence\n");
+  }
+
+  int index = 0;
+  if ((NMEAFlags & GGA) != 0) {
+    index += 3;
+  }
+  if ((NMEAFlags & VTG) != 0) {
+    index += 2;
+  }
+  if ((NMEAFlags & GST) != 0) {
+    index += 3;
+  }
+
+  cvmatrix_descriptor *desc = new cvmatrix_descriptor(index, 1);
+  index = 0;
+  if ((NMEAFlags & GGA) != 0) {
+    desc->SetElementName(0, 0, "e");
+    desc->SetElementName(1, 0, "n");
+    desc->SetElementName(2, 0, "u");
+    index += 3;
+  }
+  if ((NMEAFlags & VTG) != 0) {
+    desc->SetElementName(index, 0, "ve");
+    desc->SetElementName(index + 1, 0, "vn");
+    index += 2;
+  }
+  if ((NMEAFlags & GST) != 0) {
+    desc->SetElementName(index, 0, "dev_lat");
+    desc->SetElementName(index + 1, 0, "dev_lon");
+    desc->SetElementName(index + 2, 0, "dev_elv");
+    index += 3;
+  }
+  output = new cvmatrix((IODevice *)this, desc, floatType);
+  AddDataToLog(output);
+
+  // station sol
+  main_tab = new Tab(parent->GetTabWidget(), name);
+  tab = new TabWidget(main_tab->NewRow(), name);
+  sensor_tab = new Tab(tab, "Reglages");
+  GroupBox *reglages_groupbox = new GroupBox(sensor_tab->NewRow(), name);
+  button_ref = new PushButton(reglages_groupbox->NewRow(), "set ref");
+  nb_sat_label = new Label(reglages_groupbox->NewRow(), "nb_sat");
+  fix_label = new Label(reglages_groupbox->LastRowLastCol(), "fix");
+
+  position = new GeoCoordinate((IODevice *)this, "position", 0, 0, 0);
+
+  fix = FixQuality_t::Invalid;
+  nb_sat = 0;
+  take_ref = false;
+  nb_sat_label->SetText("nb_sat: %i", nb_sat);
+  fix_label->SetText("fix: %i", fix);
+}
+
+Gps::~Gps() {
+  nmea_parser_destroy(&parser);
+  delete main_tab;
+}
+
+void Gps::UseDefaultPlot(void) {
+  int index = 0;
+  plot_tab = new Tab(tab, "Mesures");
+
+  if ((NMEAFlags & GGA) != 0) {
+    e_plot = new DataPlot1D(plot_tab->NewRow(), "e", -10, 10);
+    e_plot->AddCurve(output->Element(index));
+    n_plot = new DataPlot1D(plot_tab->LastRowLastCol(), "n", -10, 10);
+    n_plot->AddCurve(output->Element(index + 1));
+    u_plot = new DataPlot1D(plot_tab->LastRowLastCol(), "u", -10, 10);
+    u_plot->AddCurve(output->Element(index + 2));
+    index += 3;
+  }
+  if ((NMEAFlags & VTG) != 0) {
+    ve_plot = new DataPlot1D(plot_tab->NewRow(), "ve", -10, 10);
+    ve_plot->AddCurve(output->Element(index));
+    vn_plot = new DataPlot1D(plot_tab->LastRowLastCol(), "vn", -10, 10);
+    vn_plot->AddCurve(output->Element(index + 1));
+    index += 2;
+  }
+
+  Tab *map_tab = new Tab(tab, "carte");
+  map = new Map(map_tab->NewRow(), "map");
+  map->AddPoint(position, "drone");
+}
+
+DataPlot1D *Gps::EPlot(void) const {
+  if ((NMEAFlags & GGA) != 0) {
+    return e_plot;
+  } else {
+    Err("GGA sentence not requested\n");
+    return NULL;
+  }
+}
+
+DataPlot1D *Gps::NPlot(void) const {
+  if ((NMEAFlags & GGA) != 0) {
+    return n_plot;
+  } else {
+    Err("GGA sentence not requested\n");
+    return NULL;
+  }
+}
+
+DataPlot1D *Gps::UPlot(void) const {
+  if ((NMEAFlags & GGA) != 0) {
+    return u_plot;
+  } else {
+    Err("GGA sentence not requested\n");
+    return NULL;
+  }
+}
+
+DataPlot1D *Gps::VEPlot(void) const {
+  if ((NMEAFlags & VTG) != 0) {
+    return ve_plot;
+  } else {
+    Err("GGA sentence not requested\n");
+    return NULL;
+  }
+}
+
+DataPlot1D *Gps::VNPlot(void) const {
+  if ((NMEAFlags & VTG) != 0) {
+    return vn_plot;
+  } else {
+    Err("GGA sentence not requested\n");
+    return NULL;
+  }
+}
+
+Layout *Gps::GetLayout(void) const { return sensor_tab; }
+
+Tab *Gps::GetPlotTab(void) const { return plot_tab; }
+
+TabWidget *Gps::GetTab(void) const { return tab; }
+
+uint16_t Gps::NbSat(void) const {
+  output->GetMutex();
+  uint16_t result = nb_sat;
+  output->ReleaseMutex();
+  return result;
+}
+
+Gps::FixQuality_t Gps::FixQuality(void) const {
+  output->GetMutex();
+  FixQuality_t result = fix;
+  output->ReleaseMutex();
+  return result;
+}
+
+void Gps::SetRef(void) { take_ref = true; }
+
+void Gps::GetENUPosition(Vector3D *point) {
+  output->GetMutex();
+  point->x = output->ValueNoMutex(0, 0);
+  point->y = output->ValueNoMutex(1, 0);
+  point->z = output->ValueNoMutex(2, 0);
+  output->ReleaseMutex();
+}
+
+void Gps::parseFrame(const char *frame, int frame_size) {
+
+  int result;
+
+  result = nmea_parse(&parser, frame, frame_size, &info);
+  if (result != 1) {
+    Warn("unrecognized nmea sentence\n");
+    Warn("%s\n", frame);
+  }
+
+  result = nmea_parse_GPGGA(frame, frame_size, &pack);
+
+  if (result == 1) {
+    // Printf("%s\n",frame);
+    // Printf("nb:%i fix:%i lat:%f long:%f alt:%f vel:%f
+    // angle:%f\n",pack.satinuse,pack.sig,info.lat,info.lon,info.elv,info.speed*1000./3600.,info.direction);
+    // Printf("lat:%f long:%f\n",pos.lat,pos.lon);
+    output->GetMutex(); // on utilise le mutex de l'output pour fix et nb_sat
+    if ((int)fix != pack.sig) {
+      fix = (FixQuality_t)pack.sig;
+      fix_label->SetText("fix: %i", fix);
+    }
+    if (nb_sat != pack.satinuse) {
+      nb_sat = pack.satinuse;
+      nb_sat_label->SetText("nb_sat: %i", nb_sat);
+    }
+    output->ReleaseMutex();
+
+    nmea_info2pos(&info, &pos);
+    position->SetCoordinates(Euler::ToDegree(pos.lat), Euler::ToDegree(pos.lon),
+                             info.elv);
+
+    if ((info.sig == 2 && alt_ref == 0) || button_ref->Clicked() == true ||
+        take_ref == true) {
+      Printf("prise pos ref\n");
+      lat_ref = pos.lat;
+      long_ref = pos.lon;
+      alt_ref = info.elv;
+      take_ref = false;
+    }
+    // if(alt_ref!=0)
     {
-        Err("Enable at least GGA sentence\n");
-    }
-
-    int index=0;
-    if((NMEAFlags&GGA)!=0)
-    {
-        index+=3;
-    }
-    if((NMEAFlags&VTG)!=0)
-    {
-        index+=2;
-    }
-    if((NMEAFlags&GST)!=0)
-    {
-        index+=3;
-    }
-
-    cvmatrix_descriptor* desc=new cvmatrix_descriptor(index,1);
-    index=0;
-    if((NMEAFlags&GGA)!=0)
-    {
-        desc->SetElementName(0,0,"e");
-        desc->SetElementName(1,0,"n");
-        desc->SetElementName(2,0,"u");
-        index+=3;
-    }
-    if((NMEAFlags&VTG)!=0)
-    {
-        desc->SetElementName(index,0,"ve");
-        desc->SetElementName(index+1,0,"vn");
-        index+=2;
-    }
-    if((NMEAFlags&GST)!=0)
-    {
-        desc->SetElementName(index,0,"dev_lat");
-        desc->SetElementName(index+1,0,"dev_lon");
-        desc->SetElementName(index+2,0,"dev_elv");
-        index+=3;
-    }
-    output=new cvmatrix((IODevice*)this,desc,floatType);
-    AddDataToLog(output);
-
-    //station sol
-    main_tab=new Tab(parent->GetTabWidget(),name);
-    tab=new TabWidget(main_tab->NewRow(),name);
-	sensor_tab=new Tab(tab,"Reglages");
-	GroupBox* reglages_groupbox=new GroupBox(sensor_tab->NewRow(),name);
-        button_ref=new PushButton(reglages_groupbox->NewRow(),"set ref");
-        nb_sat_label=new Label(reglages_groupbox->NewRow(),"nb_sat");
-        fix_label=new Label(reglages_groupbox->LastRowLastCol(),"fix");
-
-    position=new GeoCoordinate((IODevice*)this,"position",0,0,0);
-
-    fix=FixQuality_t::Invalid;
-    nb_sat=0;
-    take_ref=false;
-    nb_sat_label->SetText("nb_sat: %i",nb_sat);
-    fix_label->SetText("fix: %i",fix);
-}
-
-Gps::~Gps()
-{
-    nmea_parser_destroy(&parser);
-    delete main_tab;
-}
-
-void Gps::UseDefaultPlot(void)
-{
-    int index=0;
-    plot_tab=new Tab(tab,"Mesures");
-
-    if((NMEAFlags&GGA)!=0)
-    {
-        e_plot=new DataPlot1D(plot_tab->NewRow(),"e",-10,10);
-            e_plot->AddCurve(output->Element(index));
-        n_plot=new DataPlot1D(plot_tab->LastRowLastCol(),"n",-10,10);
-            n_plot->AddCurve(output->Element(index+1));
-        u_plot=new DataPlot1D(plot_tab->LastRowLastCol(),"u",-10,10);
-            u_plot->AddCurve(output->Element(index+2));
-        index+=3;
-    }
-    if((NMEAFlags&VTG)!=0)
-    {
-        ve_plot=new DataPlot1D(plot_tab->NewRow(),"ve",-10,10);
-            ve_plot->AddCurve(output->Element(index));
-        vn_plot=new DataPlot1D(plot_tab->LastRowLastCol(),"vn",-10,10);
-            vn_plot->AddCurve(output->Element(index+1));
-        index+=2;
-    }
-
-    Tab* map_tab=new Tab(tab,"carte");
-        map=new Map(map_tab->NewRow(),"map");
-            map->AddPoint(position,"drone");
-}
-
-DataPlot1D* Gps::EPlot(void) const
-{
-    if((NMEAFlags&GGA)!=0)
-    {
-        return e_plot;
-    }
-    else
-    {
-        Err("GGA sentence not requested\n");
-        return NULL;
-    }
-}
-
-DataPlot1D* Gps::NPlot(void) const
-{
-    if((NMEAFlags&GGA)!=0)
-    {
-        return n_plot;
-    }
-    else
-    {
-        Err("GGA sentence not requested\n");
-        return NULL;
-    }
-}
-
-DataPlot1D* Gps::UPlot(void) const
-{
-    if((NMEAFlags&GGA)!=0)
-    {
-        return u_plot;
-    }
-    else
-    {
-        Err("GGA sentence not requested\n");
-        return NULL;
-    }
-}
-
-DataPlot1D* Gps::VEPlot(void) const
-{
-    if((NMEAFlags&VTG)!=0)
-    {
-        return ve_plot;
-    }
-    else
-    {
-        Err("GGA sentence not requested\n");
-        return NULL;
-    }
-}
-
-DataPlot1D* Gps::VNPlot(void) const
-{
-    if((NMEAFlags&VTG)!=0)
-    {
-        return vn_plot;
-    }
-    else
-    {
-        Err("GGA sentence not requested\n");
-        return NULL;
-    }
-}
-
-Layout* Gps::GetLayout(void) const
-{
-    return sensor_tab;
-}
-
-Tab* Gps::GetPlotTab(void) const
-{
-    return plot_tab;
-}
-
-TabWidget* Gps::GetTab(void) const
-{
-    return tab;
-}
-
-uint16_t Gps::NbSat(void) const
-{
-    output->GetMutex();
-    uint16_t result=nb_sat;
-    output->ReleaseMutex();
-    return result;
-}
-
-Gps::FixQuality_t Gps::FixQuality(void) const
-{
-    output->GetMutex();
-    FixQuality_t result=fix;
-    output->ReleaseMutex();
-    return result;
-}
-
-void Gps::SetRef(void)
-{
-    take_ref=true;
-}
-
-void Gps::GetENUPosition(Vector3D *point)
-{
-    output->GetMutex();
-    point->x=output->ValueNoMutex(0,0);
-    point->y=output->ValueNoMutex(1,0);
-    point->z=output->ValueNoMutex(2,0);
-    output->ReleaseMutex();
-}
-
-void Gps::parseFrame(const char *frame, int frame_size){
-
-    int result;
-
-    result=nmea_parse(&parser, frame, frame_size, &info);
-    if(result!=1)
-    {
-        Warn("unrecognized nmea sentence\n");
-        Warn("%s\n",frame);
-    }
-
-    result=nmea_parse_GPGGA(frame, frame_size, &pack);
-
-    if(result==1)
-    {
-        //Printf("%s\n",frame);
-        //Printf("nb:%i fix:%i lat:%f long:%f alt:%f vel:%f angle:%f\n",pack.satinuse,pack.sig,info.lat,info.lon,info.elv,info.speed*1000./3600.,info.direction);
-        //Printf("lat:%f long:%f\n",pos.lat,pos.lon);
-        output->GetMutex();//on utilise le mutex de l'output pour fix et nb_sat
-        if((int)fix!=pack.sig)
-        {
-            fix=(FixQuality_t)pack.sig;
-            fix_label->SetText("fix: %i",fix);
-        }
-        if(nb_sat!=pack.satinuse)
-        {
-            nb_sat=pack.satinuse;
-            nb_sat_label->SetText("nb_sat: %i",nb_sat);
-        }
-        output->ReleaseMutex();
-
-
-        nmea_info2pos(&info,&pos);
-        position->SetCoordinates(Euler::ToDegree(pos.lat),Euler::ToDegree(pos.lon),info.elv);
-
-        if((info.sig==2 && alt_ref==0) || button_ref->Clicked()==true || take_ref==true)
-        {
-            Printf("prise pos ref\n");
-            lat_ref=pos.lat;
-            long_ref=pos.lon;
-            alt_ref=info.elv;
-            take_ref=false;
-        }
-        //if(alt_ref!=0)
-        {
-            double x,y,z;
-            double e,n,u;
-            Geographique_2_ECEF(pos.lon,pos.lat,info.elv,x,y,z);
-            ECEF_2_ENU(x,y,z,e, n, u,long_ref,lat_ref,alt_ref);
-            //Printf("lon:%f lat:%f elv:%f\n",pos.lon,pos.lat,info.elv);
-
-            //on prend une fois pour toute le mutex et on fait des accès directs
-            output->GetMutex();
-            output->SetValueNoMutex( 0, 0,e);
-            output->SetValueNoMutex( 1, 0,n);
-            output->SetValueNoMutex( 2, 0,u);
-
-            int index=3;
-            if((NMEAFlags&VTG)!=0)
-            {
-                output->SetValueNoMutex( index, 0,info.speed*1000./3600.*sin(Euler::ToRadian(info.direction)));
-                output->SetValueNoMutex( index+1, 0,info.speed*1000./3600.*cos(Euler::ToRadian(info.direction)));
-                index+=2;
-            }
-            if((NMEAFlags&GST)!=0)
-            {
-                //Thread::Printf("dev_lon:%f dev_lat:%f dev_elv:%f\n",info.dev_lat,info.dev_lon,info.dev_elv);
-                output->SetValueNoMutex( index, 0,info.dev_lat);
-                output->SetValueNoMutex( index+1, 0,info.dev_lon);
-                output->SetValueNoMutex( index+2, 0,info.dev_elv);
-                index+=3;
-            }
-            output->ReleaseMutex();
-
-            output->SetDataTime(GetTime());
-            ProcessUpdate(output);
-        }
-    }
+      double x, y, z;
+      double e, n, u;
+      Geographique_2_ECEF(pos.lon, pos.lat, info.elv, x, y, z);
+      ECEF_2_ENU(x, y, z, e, n, u, long_ref, lat_ref, alt_ref);
+      // Printf("lon:%f lat:%f elv:%f\n",pos.lon,pos.lat,info.elv);
+
+      // on prend une fois pour toute le mutex et on fait des accès directs
+      output->GetMutex();
+      output->SetValueNoMutex(0, 0, e);
+      output->SetValueNoMutex(1, 0, n);
+      output->SetValueNoMutex(2, 0, u);
+
+      int index = 3;
+      if ((NMEAFlags & VTG) != 0) {
+        output->SetValueNoMutex(index, 0,
+                                info.speed * 1000. / 3600. *
+                                    sin(Euler::ToRadian(info.direction)));
+        output->SetValueNoMutex(index + 1, 0,
+                                info.speed * 1000. / 3600. *
+                                    cos(Euler::ToRadian(info.direction)));
+        index += 2;
+      }
+      if ((NMEAFlags & GST) != 0) {
+        // Thread::Printf("dev_lon:%f dev_lat:%f
+        // dev_elv:%f\n",info.dev_lat,info.dev_lon,info.dev_elv);
+        output->SetValueNoMutex(index, 0, info.dev_lat);
+        output->SetValueNoMutex(index + 1, 0, info.dev_lon);
+        output->SetValueNoMutex(index + 2, 0, info.dev_elv);
+        index += 3;
+      }
+      output->ReleaseMutex();
+
+      output->SetDataTime(GetTime());
+      ProcessUpdate(output);
+    }
+  }
 }
 
Index: trunk/lib/FlairSensorActuator/src/Gps.h
===================================================================
--- trunk/lib/FlairSensorActuator/src/Gps.h	(revision 14)
+++ trunk/lib/FlairSensorActuator/src/Gps.h	(revision 15)
@@ -17,223 +17,218 @@
 #include <nmea/nmea.h>
 
-namespace flair
-{
-    namespace core
-    {
-        class cvmatrix;
-        class FrameworkManager;
-        class GeoCoordinate;
-        class Vector3D;
-    }
-    namespace gui
-    {
-        class Layout;
-        class DataPlot1D;
-        class Tab;
-        class TabWidget;
-        class PushButton;
-        class Map;
-        class Label;
-    }
+namespace flair {
+namespace core {
+class cvmatrix;
+class FrameworkManager;
+class GeoCoordinate;
+class Vector3D;
 }
-
-namespace flair
-{
-namespace sensor
-{
-    /*! \class Gps
-    *
-    * \brief Base class for GPS
-    */
-    class Gps : public core::IODevice
-    {
-        public:
-            /*!
-            \enum FixQuality_t
-            \brief Fix qualty indicators
-            */
-            enum class FixQuality_t {
-                Invalid=0,/*!< invalid */
-                Gps=1,/*!< Gps */
-                DGps=2,/*!< Differential Gps */
-                Pps=3,/*!< Pps */
-                Rtk=4,/*!< RTK */
-                RtkFloat=5,/*!< RTK float */
-                Estimated=6,/*!< Estimated */
-                Manual=7,/*!< Manual */
-                Simulation=8,/*!< Simulation */
-                };
-
-            /*!
-            \enum NMEAFlags_t
-            \brief NMEA flags
-            */
-            enum NMEAFlags_t {
-                GGA=0x01,/*!< GGA */
-                VTG=0x02,/*!< VTG */
-                GST=0x04,/*!< GST */
-                };
-
-            /*!
-            * \brief Constructor
-            *
-            * Construct a Gps.
-            *
-            * \param parent parent
-            * \param name name
-            * \param NMEAFlags NMEA sentances to enable
-            */
-            Gps(const core::FrameworkManager* parent,std::string name,NMEAFlags_t NMEAFlags);
-
-            /*!
-            * \brief Destructor
-            *
-            */
-            ~Gps();
-
-            /*!
-            * \brief Use default plot
-            *
-            */
-            void UseDefaultPlot(void);
-
-            /*!
-            * \brief East plot
-            *
-            * \return east plot
-            */
-            gui::DataPlot1D* EPlot(void) const;
-
-            /*!
-            * \brief North plot
-            *
-            * \return north plot
-            */
-            gui::DataPlot1D* NPlot(void) const;
-
-            /*!
-            * \brief Up plot
-            *
-            * \return up plot
-            */
-            gui::DataPlot1D* UPlot(void) const;
-
-            /*!
-            * \brief East velocity plot
-            *
-            * \return east velocity plot
-            */
-            gui::DataPlot1D* VEPlot(void) const;
-
-            /*!
-            * \brief North velocity plot
-            *
-            * \return north velocity plot
-            */
-            gui::DataPlot1D* VNPlot(void) const;
-
-            /*!
-            * \brief Main tab
-            *
-            * \return main tab
-            */
-            gui::TabWidget* GetTab(void) const;
-
-            /*!
-            * \brief Setup Layout
-            *
-            * \return setup Layout
-            */
-            gui::Layout* GetLayout(void) const;
-
-            /*!
-            * \brief Plot tab
-            *
-            * \return plot Tab
-            */
-            gui::Tab* GetPlotTab(void) const;
-
-            /*!
-            * \brief Number of used satellites
-            *
-            * \return number of used satellites
-            */
-            uint16_t NbSat(void) const;
-
-            /*!
-            * \brief Fix Quality
-            *
-            * \return fix quality
-            */
-            FixQuality_t FixQuality(void) const;
-
-            /*!
-            * \brief Set reference for ENU coordinates
-            *
-            * The actual position is used as reference to calculate
-            * ENU coordinates.
-            *
-            * \return fix quality
-            */
-            void SetRef(void);
-
-            /*!
-            * \brief Get ENU position
-            *
-            * \param point to store position
-            */
-            void GetENUPosition(core::Vector3D *point);
-
-        protected:
-            /*!
-            * \brief Parse a NMEA frame
-            *
-            * This function must be called by the reimplemented class. \n
-            * When a frame is parsed, GPS datas are filled.
-            *
-            * \param frame NMEA frame
-            * \param frame_size frame size
-            *
-            */
-            void parseFrame(const char *frame, int frame_size);
-
-            NMEAFlags_t NMEAFlags;
-
-        protected:
-            core::GeoCoordinate *position;
-
-        private:
-            /*!
-            * \brief Update using provided datas
-            *
-            * Reimplemented from IODevice.
-            *
-            * \param data data from the parent to process
-            */
-            void UpdateFrom(const core::io_data *data){};
-
-            gui::Tab *main_tab,*sensor_tab;
-            gui::TabWidget* tab;
-            gui::PushButton *button_ref;
-            gui::DataPlot1D* e_plot;
-            gui::DataPlot1D* n_plot;
-            gui::DataPlot1D* u_plot;
-            gui::DataPlot1D* ve_plot;
-            gui::DataPlot1D* vn_plot;
-            gui::Tab* plot_tab;
-            gui::Map *map;
-            gui::Label *nb_sat_label,*fix_label;
-            uint16_t nb_sat;
-            FixQuality_t fix;
-            bool take_ref;
-            nmeaINFO info;
-            nmeaPARSER parser;
-            nmeaGPGGA pack;
-            nmeaPOS pos;
-            double lat_ref,long_ref,alt_ref;
-
-            //matrix
-            core::cvmatrix *output;
-    };
+namespace gui {
+class Layout;
+class DataPlot1D;
+class Tab;
+class TabWidget;
+class PushButton;
+class Map;
+class Label;
+}
+}
+
+namespace flair {
+namespace sensor {
+/*! \class Gps
+*
+* \brief Base class for GPS
+*/
+class Gps : public core::IODevice {
+public:
+  /*!
+  \enum FixQuality_t
+  \brief Fix qualty indicators
+  */
+  enum class FixQuality_t {
+    Invalid = 0,    /*!< invalid */
+    Gps = 1,        /*!< Gps */
+    DGps = 2,       /*!< Differential Gps */
+    Pps = 3,        /*!< Pps */
+    Rtk = 4,        /*!< RTK */
+    RtkFloat = 5,   /*!< RTK float */
+    Estimated = 6,  /*!< Estimated */
+    Manual = 7,     /*!< Manual */
+    Simulation = 8, /*!< Simulation */
+  };
+
+  /*!
+  \enum NMEAFlags_t
+  \brief NMEA flags
+  */
+  enum NMEAFlags_t {
+    GGA = 0x01, /*!< GGA */
+    VTG = 0x02, /*!< VTG */
+    GST = 0x04, /*!< GST */
+  };
+
+  /*!
+  * \brief Constructor
+  *
+  * Construct a Gps.
+  *
+  * \param parent parent
+  * \param name name
+  * \param NMEAFlags NMEA sentances to enable
+  */
+  Gps(const core::FrameworkManager *parent, std::string name,
+      NMEAFlags_t NMEAFlags);
+
+  /*!
+  * \brief Destructor
+  *
+  */
+  ~Gps();
+
+  /*!
+  * \brief Use default plot
+  *
+  */
+  void UseDefaultPlot(void);
+
+  /*!
+  * \brief East plot
+  *
+  * \return east plot
+  */
+  gui::DataPlot1D *EPlot(void) const;
+
+  /*!
+  * \brief North plot
+  *
+  * \return north plot
+  */
+  gui::DataPlot1D *NPlot(void) const;
+
+  /*!
+  * \brief Up plot
+  *
+  * \return up plot
+  */
+  gui::DataPlot1D *UPlot(void) const;
+
+  /*!
+  * \brief East velocity plot
+  *
+  * \return east velocity plot
+  */
+  gui::DataPlot1D *VEPlot(void) const;
+
+  /*!
+  * \brief North velocity plot
+  *
+  * \return north velocity plot
+  */
+  gui::DataPlot1D *VNPlot(void) const;
+
+  /*!
+  * \brief Main tab
+  *
+  * \return main tab
+  */
+  gui::TabWidget *GetTab(void) const;
+
+  /*!
+  * \brief Setup Layout
+  *
+  * \return setup Layout
+  */
+  gui::Layout *GetLayout(void) const;
+
+  /*!
+  * \brief Plot tab
+  *
+  * \return plot Tab
+  */
+  gui::Tab *GetPlotTab(void) const;
+
+  /*!
+  * \brief Number of used satellites
+  *
+  * \return number of used satellites
+  */
+  uint16_t NbSat(void) const;
+
+  /*!
+  * \brief Fix Quality
+  *
+  * \return fix quality
+  */
+  FixQuality_t FixQuality(void) const;
+
+  /*!
+  * \brief Set reference for ENU coordinates
+  *
+  * The actual position is used as reference to calculate
+  * ENU coordinates.
+  *
+  * \return fix quality
+  */
+  void SetRef(void);
+
+  /*!
+  * \brief Get ENU position
+  *
+  * \param point to store position
+  */
+  void GetENUPosition(core::Vector3D *point);
+
+protected:
+  /*!
+  * \brief Parse a NMEA frame
+  *
+  * This function must be called by the reimplemented class. \n
+  * When a frame is parsed, GPS datas are filled.
+  *
+  * \param frame NMEA frame
+  * \param frame_size frame size
+  *
+  */
+  void parseFrame(const char *frame, int frame_size);
+
+  NMEAFlags_t NMEAFlags;
+
+protected:
+  core::GeoCoordinate *position;
+
+private:
+  /*!
+  * \brief Update using provided datas
+  *
+  * Reimplemented from IODevice.
+  *
+  * \param data data from the parent to process
+  */
+  void UpdateFrom(const core::io_data *data){};
+
+  gui::Tab *main_tab, *sensor_tab;
+  gui::TabWidget *tab;
+  gui::PushButton *button_ref;
+  gui::DataPlot1D *e_plot;
+  gui::DataPlot1D *n_plot;
+  gui::DataPlot1D *u_plot;
+  gui::DataPlot1D *ve_plot;
+  gui::DataPlot1D *vn_plot;
+  gui::Tab *plot_tab;
+  gui::Map *map;
+  gui::Label *nb_sat_label, *fix_label;
+  uint16_t nb_sat;
+  FixQuality_t fix;
+  bool take_ref;
+  nmeaINFO info;
+  nmeaPARSER parser;
+  nmeaGPGGA pack;
+  nmeaPOS pos;
+  double lat_ref, long_ref, alt_ref;
+
+  // matrix
+  core::cvmatrix *output;
+};
 } // end namespace sensor
 } // end namespace framewor
Index: trunk/lib/FlairSensorActuator/src/Gx3_25_imu.cpp
===================================================================
--- trunk/lib/FlairSensorActuator/src/Gx3_25_imu.cpp	(revision 14)
+++ trunk/lib/FlairSensorActuator/src/Gx3_25_imu.cpp	(revision 15)
@@ -25,28 +25,30 @@
 using namespace flair::core;
 
-namespace flair { namespace sensor {
+namespace flair {
+namespace sensor {
 
-Gx3_25_imu::Gx3_25_imu(const FrameworkManager* parent,string name,SerialPort* serialport,Command_t command,uint8_t priority) : Imu(parent,name),Thread(parent,name,priority) {
-    pimpl_=new Gx3_25_imu_impl(this,name,serialport,command,GetGroupBox());
+Gx3_25_imu::Gx3_25_imu(const FrameworkManager *parent, string name,
+                       SerialPort *serialport, Command_t command,
+                       uint8_t priority)
+    : Imu(parent, name), Thread(parent, name, priority) {
+  pimpl_ = new Gx3_25_imu_impl(this, name, serialport, command, GetGroupBox());
 
-    if(command==EulerAnglesAndAngularRates) {
+  if (command == EulerAnglesAndAngularRates) {
 
-    } else if(command==AccelerationAngularRateAndOrientationMatrix) {
-        Thread::Err("oneaxis rotation of rotation matrix is not yet implemented\n");
-    } else {
-        Thread::Err("command not supported (%i)\n",command);
-    }
-    //AddDataToLog(imudata);
+  } else if (command == AccelerationAngularRateAndOrientationMatrix) {
+    Thread::Err("oneaxis rotation of rotation matrix is not yet implemented\n");
+  } else {
+    Thread::Err("command not supported (%i)\n", command);
+  }
+  // AddDataToLog(imudata);
 }
 
 Gx3_25_imu::~Gx3_25_imu() {
-    SafeStop();
-    Join();
-    delete pimpl_;
+  SafeStop();
+  Join();
+  delete pimpl_;
 }
 
-void Gx3_25_imu::Run(void) {
-    pimpl_->Run();
-}
+void Gx3_25_imu::Run(void) { pimpl_->Run(); }
 
 } // end namespace sensor
Index: trunk/lib/FlairSensorActuator/src/Gx3_25_imu.h
===================================================================
--- trunk/lib/FlairSensorActuator/src/Gx3_25_imu.h	(revision 14)
+++ trunk/lib/FlairSensorActuator/src/Gx3_25_imu.h	(revision 15)
@@ -18,69 +18,72 @@
 
 namespace flair {
-    namespace core {
-        class FrameworkManager;
-        class SerialPort;
-    }
+namespace core {
+class FrameworkManager;
+class SerialPort;
+}
 }
 
 class Gx3_25_imu_impl;
 
-namespace flair { namespace sensor {
-    /*! \class Gx3_25_imu
-    *
-    * \brief Class for 3dmgx3-25 Imu
-    */
-    class Gx3_25_imu : public Imu, public core::Thread {
-        friend class ::Gx3_25_imu_impl;
+namespace flair {
+namespace sensor {
+/*! \class Gx3_25_imu
+*
+* \brief Class for 3dmgx3-25 Imu
+*/
+class Gx3_25_imu : public Imu, public core::Thread {
+  friend class ::Gx3_25_imu_impl;
 
-        public:
-            /*!
-            \enum Command_t
-            \brief Command for the continuous mode
-            */
-            enum Command_t{
-                EulerAnglesAndAngularRates=0xcf,/*!< Euler angles and angular rates */
-                AccelerationAngularRateAndOrientationMatrix=0xc8,/*!< Acceleration, angular rate and orientation matrix */
-                };
+public:
+  /*!
+  \enum Command_t
+  \brief Command for the continuous mode
+  */
+  enum Command_t {
+    EulerAnglesAndAngularRates = 0xcf, /*!< Euler angles and angular rates */
+    AccelerationAngularRateAndOrientationMatrix =
+        0xc8, /*!< Acceleration, angular rate and orientation matrix */
+  };
 
-            /*!
-            * \brief Constructor
-            *
-            * Construct a Gx3_25_imu.
-            *
-            * \param parent parent
-            * \param name name
-            * \param serialport SerialPort
-            * \param command command for continuous mode
-            * \param priority priority of the Thread
-            */
-            Gx3_25_imu(const core::FrameworkManager* parent,std::string name,core::SerialPort *serialport,Command_t command,uint8_t priority);
+  /*!
+  * \brief Constructor
+  *
+  * Construct a Gx3_25_imu.
+  *
+  * \param parent parent
+  * \param name name
+  * \param serialport SerialPort
+  * \param command command for continuous mode
+  * \param priority priority of the Thread
+  */
+  Gx3_25_imu(const core::FrameworkManager *parent, std::string name,
+             core::SerialPort *serialport, Command_t command, uint8_t priority);
 
-            /*!
-            * \brief Destructor
-            *
-            */
-            ~Gx3_25_imu();
+  /*!
+  * \brief Destructor
+  *
+  */
+  ~Gx3_25_imu();
 
-        private:
-            /*!
-            * \brief Run function
-            *
-            * Reimplemented from Thread.
-            *
-            */
-            void Run(void);
+private:
+  /*!
+  * \brief Run function
+  *
+  * Reimplemented from Thread.
+  *
+  */
+  void Run(void);
 
-            /*!
-            * \brief Update using provided datas
-            *
-            * Reimplemented from IODevice.
-            *
-            * \param data data from the parent to process
-            */
-            void UpdateFrom(const core::io_data *data){};
+  /*!
+  * \brief Update using provided datas
+  *
+  * Reimplemented from IODevice.
+  *
+  * \param data data from the parent to process
+  */
+  void UpdateFrom(const core::io_data *data){};
 
-            class Gx3_25_imu_impl* pimpl_;
-    };
+  class Gx3_25_imu_impl *pimpl_;
+};
 } // end namespace sensor
 } // end namespace flair
Index: trunk/lib/FlairSensorActuator/src/Gx3_25_imu_impl.cpp
===================================================================
--- trunk/lib/FlairSensorActuator/src/Gx3_25_imu_impl.cpp	(revision 14)
+++ trunk/lib/FlairSensorActuator/src/Gx3_25_imu_impl.cpp	(revision 15)
@@ -38,513 +38,546 @@
 using namespace flair::sensor;
 
-Gx3_25_imu_impl::Gx3_25_imu_impl(Gx3_25_imu* self,string name,SerialPort *serialport,Gx3_25_imu::Command_t command,GroupBox* setupgroupbox) {
-    int err = 0;
-
-    this->self=self;
-    this->command=(uint8_t)command;
-    this->setupgroupbox=setupgroupbox;
-    this->serialport=serialport;
-
-    ahrsData=new AhrsData((Imu*)self);
-
-    //station sol
-    button_bias=new PushButton(setupgroupbox->NewRow(),"gyros bias");
-    data_rate=new SpinBox(setupgroupbox->NewRow(),"data rate (Hz):",1,500,1,200);
-    data_rate_label=new Label(setupgroupbox->LastRowLastCol(),"data_rate");
-    gyro_acc_size=new SpinBox(setupgroupbox->NewRow(),"gyro and acc filter win size:",1,32,1,15);
-    mag_size=new SpinBox(setupgroupbox->LastRowLastCol(),"mag filter win size:",1,32,1,17);
-    up_comp=new SpinBox(setupgroupbox->NewRow(),"up compensation (s):",1,1000,1,10);
-    north_comp=new SpinBox(setupgroupbox->LastRowLastCol(),"north compensation (s):",1,1000,1,10);
-    coning=new CheckBox(setupgroupbox->NewRow(),"enable Coning&Sculling:",true);
-    disable_magn=new CheckBox(setupgroupbox->LastRowLastCol(),"disable magnetometer:",true);
-    disable_north_comp=new CheckBox(setupgroupbox->NewRow(),"disable magnetic north compensation:",false);
-    disable_grav_comp=new CheckBox(setupgroupbox->NewRow(),"disable gravity compensation:",false);
-}
-
-Gx3_25_imu_impl::~Gx3_25_imu_impl() {
-}
+Gx3_25_imu_impl::Gx3_25_imu_impl(Gx3_25_imu *self, string name,
+                                 SerialPort *serialport,
+                                 Gx3_25_imu::Command_t command,
+                                 GroupBox *setupgroupbox) {
+  int err = 0;
+
+  this->self = self;
+  this->command = (uint8_t)command;
+  this->setupgroupbox = setupgroupbox;
+  this->serialport = serialport;
+
+  ahrsData = new AhrsData((Imu *)self);
+
+  // station sol
+  button_bias = new PushButton(setupgroupbox->NewRow(), "gyros bias");
+  data_rate =
+      new SpinBox(setupgroupbox->NewRow(), "data rate (Hz):", 1, 500, 1, 200);
+  data_rate_label = new Label(setupgroupbox->LastRowLastCol(), "data_rate");
+  gyro_acc_size = new SpinBox(setupgroupbox->NewRow(),
+                              "gyro and acc filter win size:", 1, 32, 1, 15);
+  mag_size = new SpinBox(setupgroupbox->LastRowLastCol(),
+                         "mag filter win size:", 1, 32, 1, 17);
+  up_comp = new SpinBox(setupgroupbox->NewRow(), "up compensation (s):", 1,
+                        1000, 1, 10);
+  north_comp = new SpinBox(setupgroupbox->LastRowLastCol(),
+                           "north compensation (s):", 1, 1000, 1, 10);
+  coning =
+      new CheckBox(setupgroupbox->NewRow(), "enable Coning&Sculling:", true);
+  disable_magn = new CheckBox(setupgroupbox->LastRowLastCol(),
+                              "disable magnetometer:", true);
+  disable_north_comp = new CheckBox(
+      setupgroupbox->NewRow(), "disable magnetic north compensation:", false);
+  disable_grav_comp = new CheckBox(setupgroupbox->NewRow(),
+                                   "disable gravity compensation:", false);
+}
+
+Gx3_25_imu_impl::~Gx3_25_imu_impl() {}
 
 void Gx3_25_imu_impl::Run(void) {
-    Time imuTime;
-    ImuData* imuData;
-    self->GetDatas(&imuData);
-
-    self->WarnUponSwitches(true);
-
-    //reset IMU to be sure it is at 115200
-    Printf("Gx3_25_imu::Reset IMU at 921600\n");
-    serialport->SetBaudrate(921600);
-    DeviceReset();
-    self->Thread::SleepMS(100);
-    serialport->FlushInput();
-    serialport->SetBaudrate(115200);
-
-    SetBaudrate(921600);
-    Printf("Gx3_25_imu firmware number: %i\n",FirmwareNumber());
-    PrintModelInfo();
-    SamplingSettings();
-    GyrosBias();
-    //RealignUpNorth(true,true);
-
-    //on provoque les 9 ValueChanged
-    for(int i=0; i<9; i++) {
-        if(data_rate->ValueChanged()==true || disable_magn->ValueChanged()==true ||disable_north_comp->ValueChanged()==true ||disable_grav_comp->ValueChanged()==true ||coning->ValueChanged()==true
-                || gyro_acc_size->ValueChanged()==true || mag_size->ValueChanged()==true ||up_comp->ValueChanged()==true || north_comp->ValueChanged()==true) {
-            if(setupgroupbox->isEnabled()==true) SamplingSettings();
-        }
-    }
-
-    //periode a passer an argument (reglable)
-    //ou plutot laisser la periode geree par le centrale (polling)
-    //self->SetPeriodMS(2);
-    SetContinuousMode(command);
-
-    //_printf("firmware version: %i\n",get_firmware_number());
-
-    while(!self->ToBeStopped()) {
-        if(command==Gx3_25_imu::EulerAnglesAndAngularRates) {
-            uint8_t response[31] = {0};
-            uint8_t *buf=&response[1];
-            GetData(response,sizeof(response),&imuTime);
-
-            Euler eulerAngles;
-            eulerAngles.roll=Dequeue(&buf);
-            eulerAngles.pitch=Dequeue(&buf);
-            eulerAngles.yaw=Dequeue(&buf);
-
-            Vector3D filteredAngRates;
-            filteredAngRates.x=Dequeue(&buf);
-            filteredAngRates.y=Dequeue(&buf);
-            filteredAngRates.z=Dequeue(&buf);
-
-            ahrsData->SetQuaternionAndAngularRates(eulerAngles.ToQuaternion(),filteredAngRates);
-        } else if(command==Gx3_25_imu::AccelerationAngularRateAndOrientationMatrix) {
-            uint8_t response[67] = {0};
-            uint8_t *buf=&response[1];
-            GetData(response,sizeof(response),&imuTime);
-
-            Vector3D rawAcc;
-            rawAcc.x=9.80665*Dequeue(&buf);
-            rawAcc.y=9.80665*Dequeue(&buf);
-            rawAcc.z=9.80665*Dequeue(&buf);
-
-            Vector3D filteredAngRates;
-            filteredAngRates.x=Dequeue(&buf);
-            filteredAngRates.y=Dequeue(&buf);
-            filteredAngRates.z=Dequeue(&buf);
-
-            RotationMatrix matrix;
-            matrix(0,0)=Dequeue(&buf);
-            matrix(0,1)=Dequeue(&buf);
-            matrix(0,2)=Dequeue(&buf);
-            matrix(1,0)=Dequeue(&buf);
-            matrix(1,1)=Dequeue(&buf);
-            matrix(1,2)=Dequeue(&buf);
-            matrix(2,0)=Dequeue(&buf);
-            matrix(2,1)=Dequeue(&buf);
-            matrix(2,2)=Dequeue(&buf);
-
-            ahrsData->SetQuaternionAndAngularRates(matrix.ToEuler().ToQuaternion(),filteredAngRates);
-            imuData->SetRawAcc(rawAcc);
-        }
-
-        //change settings as soon as possible
-        //we assume that new imu datas will not come so fast
-        //so newt message from imu is an ack from the change settings
-        if(button_bias->Clicked()==true) GyrosBias();
-
-        if(data_rate->ValueChanged()==true || disable_magn->ValueChanged()==true ||disable_north_comp->ValueChanged()==true ||disable_grav_comp->ValueChanged()==true ||coning->ValueChanged()==true
-                || gyro_acc_size->ValueChanged()==true || mag_size->ValueChanged()==true ||up_comp->ValueChanged()==true || north_comp->ValueChanged()==true) {
-            if(setupgroupbox->isEnabled()==true) SamplingSettings();
-        }
-
-        imuData->SetDataTime(imuTime);
-        ahrsData->SetDataTime(imuTime);
-        self->UpdateImu();
-        self->ProcessUpdate(ahrsData);
-    }
-    SetContinuousMode(0);
-    SetBaudrate(115200);
-
-    self->WarnUponSwitches(false);
-}
-
-void Gx3_25_imu_impl::GetData(uint8_t* buf,ssize_t buf_size,Time *time) {
+  Time imuTime;
+  ImuData *imuData;
+  self->GetDatas(&imuData);
+
+  self->WarnUponSwitches(true);
+
+  // reset IMU to be sure it is at 115200
+  Printf("Gx3_25_imu::Reset IMU at 921600\n");
+  serialport->SetBaudrate(921600);
+  DeviceReset();
+  self->Thread::SleepMS(100);
+  serialport->FlushInput();
+  serialport->SetBaudrate(115200);
+
+  SetBaudrate(921600);
+  Printf("Gx3_25_imu firmware number: %i\n", FirmwareNumber());
+  PrintModelInfo();
+  SamplingSettings();
+  GyrosBias();
+  // RealignUpNorth(true,true);
+
+  // on provoque les 9 ValueChanged
+  for (int i = 0; i < 9; i++) {
+    if (data_rate->ValueChanged() == true ||
+        disable_magn->ValueChanged() == true ||
+        disable_north_comp->ValueChanged() == true ||
+        disable_grav_comp->ValueChanged() == true ||
+        coning->ValueChanged() == true ||
+        gyro_acc_size->ValueChanged() == true ||
+        mag_size->ValueChanged() == true || up_comp->ValueChanged() == true ||
+        north_comp->ValueChanged() == true) {
+      if (setupgroupbox->isEnabled() == true)
+        SamplingSettings();
+    }
+  }
+
+  // periode a passer an argument (reglable)
+  // ou plutot laisser la periode geree par le centrale (polling)
+  // self->SetPeriodMS(2);
+  SetContinuousMode(command);
+
+  //_printf("firmware version: %i\n",get_firmware_number());
+
+  while (!self->ToBeStopped()) {
+    if (command == Gx3_25_imu::EulerAnglesAndAngularRates) {
+      uint8_t response[31] = {0};
+      uint8_t *buf = &response[1];
+      GetData(response, sizeof(response), &imuTime);
+
+      Euler eulerAngles;
+      eulerAngles.roll = Dequeue(&buf);
+      eulerAngles.pitch = Dequeue(&buf);
+      eulerAngles.yaw = Dequeue(&buf);
+
+      Vector3D filteredAngRates;
+      filteredAngRates.x = Dequeue(&buf);
+      filteredAngRates.y = Dequeue(&buf);
+      filteredAngRates.z = Dequeue(&buf);
+
+      ahrsData->SetQuaternionAndAngularRates(eulerAngles.ToQuaternion(),
+                                             filteredAngRates);
+    } else if (command ==
+               Gx3_25_imu::AccelerationAngularRateAndOrientationMatrix) {
+      uint8_t response[67] = {0};
+      uint8_t *buf = &response[1];
+      GetData(response, sizeof(response), &imuTime);
+
+      Vector3D rawAcc;
+      rawAcc.x = 9.80665 * Dequeue(&buf);
+      rawAcc.y = 9.80665 * Dequeue(&buf);
+      rawAcc.z = 9.80665 * Dequeue(&buf);
+
+      Vector3D filteredAngRates;
+      filteredAngRates.x = Dequeue(&buf);
+      filteredAngRates.y = Dequeue(&buf);
+      filteredAngRates.z = Dequeue(&buf);
+
+      RotationMatrix matrix;
+      matrix(0, 0) = Dequeue(&buf);
+      matrix(0, 1) = Dequeue(&buf);
+      matrix(0, 2) = Dequeue(&buf);
+      matrix(1, 0) = Dequeue(&buf);
+      matrix(1, 1) = Dequeue(&buf);
+      matrix(1, 2) = Dequeue(&buf);
+      matrix(2, 0) = Dequeue(&buf);
+      matrix(2, 1) = Dequeue(&buf);
+      matrix(2, 2) = Dequeue(&buf);
+
+      ahrsData->SetQuaternionAndAngularRates(matrix.ToEuler().ToQuaternion(),
+                                             filteredAngRates);
+      imuData->SetRawAcc(rawAcc);
+    }
+
+    // change settings as soon as possible
+    // we assume that new imu datas will not come so fast
+    // so newt message from imu is an ack from the change settings
+    if (button_bias->Clicked() == true)
+      GyrosBias();
+
+    if (data_rate->ValueChanged() == true ||
+        disable_magn->ValueChanged() == true ||
+        disable_north_comp->ValueChanged() == true ||
+        disable_grav_comp->ValueChanged() == true ||
+        coning->ValueChanged() == true ||
+        gyro_acc_size->ValueChanged() == true ||
+        mag_size->ValueChanged() == true || up_comp->ValueChanged() == true ||
+        north_comp->ValueChanged() == true) {
+      if (setupgroupbox->isEnabled() == true)
+        SamplingSettings();
+    }
+
+    imuData->SetDataTime(imuTime);
+    ahrsData->SetDataTime(imuTime);
+    self->UpdateImu();
+    self->ProcessUpdate(ahrsData);
+  }
+  SetContinuousMode(0);
+  SetBaudrate(115200);
+
+  self->WarnUponSwitches(false);
+}
+
+void Gx3_25_imu_impl::GetData(uint8_t *buf, ssize_t buf_size, Time *time) {
+  ssize_t read = 0;
+  ssize_t written = 0;
+  /*
+      written = serialport->Write(&command, sizeof(command));
+      if(written<0)
+      {
+          self->Thread::Err("Write error (%s)\n",strerror(-written));
+      }
+      else if (written != sizeof(command))
+      {
+          self->Thread::Err("Write error %i/%i\n",written,sizeof(command));
+      }
+  */
+  read = serialport->Read(buf, buf_size);
+  *time = GetTime();
+  if (read < 0) {
+    self->Thread::Err("Read error (%s)\n", strerror(-read));
+  } else if (read != buf_size) {
+    self->Thread::Err("Read error %i/%i\n", read, buf_size);
+  }
+
+  if (CalcChecksum(buf, buf_size) == false) {
+    self->Thread::Err("wrong checksum\n");
+    return;
+  }
+}
+
+float Gx3_25_imu_impl::Dequeue(uint8_t **buf) {
+  union float_4uint8 {
+    float f;
+    uint8_t b[4];
+  } float_value;
+
+  float_value.b[0] = (*buf)[3];
+  float_value.b[1] = (*buf)[2];
+  float_value.b[2] = (*buf)[1];
+  float_value.b[3] = (*buf)[0];
+  (*buf) += sizeof(float);
+
+  return float_value.f;
+}
+
+void Gx3_25_imu_impl::GyrosBias(void) {
+  if (setupgroupbox->isEnabled() == true) { // devrait toujours etre bon
+    uint8_t response[19] = {0};
+    uint8_t command[5];
     ssize_t read = 0;
     ssize_t written = 0;
-    /*
-        written = serialport->Write(&command, sizeof(command));
-        if(written<0)
-        {
-            self->Thread::Err("Write error (%s)\n",strerror(-written));
-        }
-        else if (written != sizeof(command))
-        {
-            self->Thread::Err("Write error %i/%i\n",written,sizeof(command));
-        }
-    */
-    read = serialport->Read(buf,buf_size);
-    *time=GetTime();
-    if(read<0) {
-        self->Thread::Err("Read error (%s)\n",strerror(-read));
-    } else if (read != buf_size) {
-        self->Thread::Err("Read error %i/%i\n",read,buf_size);
-    }
-
-    if(CalcChecksum(buf,buf_size)==false) {
-        self->Thread::Err("wrong checksum\n");
-        return;
-    }
-}
-
-float Gx3_25_imu_impl::Dequeue(uint8_t** buf) {
-    union float_4uint8 {
-        float f;
-        uint8_t b[4];
-    }
-    float_value;
-
-    float_value.b[0]=(*buf)[3];
-    float_value.b[1]=(*buf)[2];
-    float_value.b[2]=(*buf)[1];
-    float_value.b[3]=(*buf)[0];
-    (*buf)+=sizeof(float);
-
-    return float_value.f;
-}
-
-void Gx3_25_imu_impl::GyrosBias(void) {
-    if(setupgroupbox->isEnabled()==true) { //devrait toujours etre bon
-        uint8_t response[19] = {0};
-        uint8_t command[5];
-        ssize_t read = 0;
-        ssize_t written = 0;
-
-        Printf("Gx3_25_imu::gyros_bias: %s\n",self->IODevice::ObjectName().c_str());
-
-        command[0]=0xcd;//entete
-        command[1]=0xc1;//confirm
-        command[2]=0x29;//confirm
-        command[3]=0x27;//time MSB en us
-        command[4]=0x10;//time LSB en us
-
-        written = serialport->Write( &command, sizeof(command));
-        if(written<0) {
-            self->Thread::Err("Write error (%s)\n",strerror(-written));
-        } else if (written != sizeof(command)) {
-            self->Thread::Err("Write error %i/%i\n",written,sizeof(command));
-        }
-
-        self->SleepUS(1.1*(command[3]*256+command[4]));//on fait un sleep un peu plus grand
-
-        read = serialport->Read(&response[0],sizeof(response));
-        if(read<0) {
-            self->Thread::Err("Read error (%s)\n",strerror(-read));
-        } else if (read != sizeof(response)) {
-            self->Thread::Err("Read error %i/%i\n",read,sizeof(response));
-        }
-
-        if(CalcChecksum(response,sizeof(response))==false) {
-            self->Thread::Err("wrong checksum\n");
-            //return -1;
-        }
-
-        Printf("Gx3_25_imu::gyros_bias: %s ok\n",self->IODevice::ObjectName().c_str());
-
-    } else {
-        self->Thread::Err("error locked\n");
-    }
+
+    Printf("Gx3_25_imu::gyros_bias: %s\n",
+           self->IODevice::ObjectName().c_str());
+
+    command[0] = 0xcd; // entete
+    command[1] = 0xc1; // confirm
+    command[2] = 0x29; // confirm
+    command[3] = 0x27; // time MSB en us
+    command[4] = 0x10; // time LSB en us
+
+    written = serialport->Write(&command, sizeof(command));
+    if (written < 0) {
+      self->Thread::Err("Write error (%s)\n", strerror(-written));
+    } else if (written != sizeof(command)) {
+      self->Thread::Err("Write error %i/%i\n", written, sizeof(command));
+    }
+
+    self->SleepUS(1.1 * (command[3] * 256 +
+                         command[4])); // on fait un sleep un peu plus grand
+
+    read = serialport->Read(&response[0], sizeof(response));
+    if (read < 0) {
+      self->Thread::Err("Read error (%s)\n", strerror(-read));
+    } else if (read != sizeof(response)) {
+      self->Thread::Err("Read error %i/%i\n", read, sizeof(response));
+    }
+
+    if (CalcChecksum(response, sizeof(response)) == false) {
+      self->Thread::Err("wrong checksum\n");
+      // return -1;
+    }
+
+    Printf("Gx3_25_imu::gyros_bias: %s ok\n",
+           self->IODevice::ObjectName().c_str());
+
+  } else {
+    self->Thread::Err("error locked\n");
+  }
 }
 
 void Gx3_25_imu_impl::SetContinuousMode(uint8_t continuous_command) {
-    uint8_t response[8] = {0};
-    uint8_t command[4];
-    ssize_t read = 0;
-    ssize_t written = 0;
-
-    command[0]=0xc4;//entete
-    command[1]=0xc1;//confirm
-    command[2]=0x29;//confirm
-    command[3]=continuous_command;
-
-    written = serialport->Write(command,sizeof(command));
-    if(written<0) {
-        self->Thread::Err("Write error (%s)\n",strerror(-written));
+  uint8_t response[8] = {0};
+  uint8_t command[4];
+  ssize_t read = 0;
+  ssize_t written = 0;
+
+  command[0] = 0xc4; // entete
+  command[1] = 0xc1; // confirm
+  command[2] = 0x29; // confirm
+  command[3] = continuous_command;
+
+  written = serialport->Write(command, sizeof(command));
+  if (written < 0) {
+    self->Thread::Err("Write error (%s)\n", strerror(-written));
+  } else if (written != sizeof(command)) {
+    self->Thread::Err("Write error %i/%i\n", written, sizeof(command));
+  }
+
+  read = serialport->Read(response, sizeof(response));
+  if (read < 0) {
+    self->Thread::Err("Read error (%s)\n", strerror(-read));
+  } else if (read != sizeof(response)) {
+    self->Thread::Err("Read error %i/%i\n", read, sizeof(response));
+  }
+
+  if (CalcChecksum(response, sizeof(response)) == false) {
+    self->Thread::Err("wrong checksum\n", self->IODevice::ObjectName().c_str());
+  }
+}
+
+void Gx3_25_imu_impl::SamplingSettings(void) {
+  uint8_t response[19] = {0};
+  uint8_t command[20];
+  uint8_t result;
+  ssize_t read = 0;
+  ssize_t written = 0;
+
+  uint16_t rate = 1000 / data_rate->Value();
+
+  command[0] = 0xdb;               // entete
+  command[1] = 0xa8;               // confirm
+  command[2] = 0xb9;               // confirm
+  command[3] = 1;                  // change values
+  command[4] = (rate >> 8) & 0xff; // data rate MSB
+  command[5] = rate & 0xff;        // data rate LSB
+  result = 0;
+  if (disable_magn->IsChecked() == true)
+    result |= 0x01;
+  if (disable_north_comp->IsChecked() == true)
+    result |= 0x04;
+  if (disable_grav_comp->IsChecked() == true)
+    result |= 0x08;
+
+  command[6] = result;
+  result = 0x01; // Calculate orientation
+  if (coning->IsChecked() == true)
+    result |= 0x02;
+
+  command[7] = result;
+  command[8] = gyro_acc_size->Value();             // gyro acc filter window
+  command[9] = mag_size->Value();                  // mag filter window
+  command[10] = (up_comp->Value() >> 8) & 0xff;    // up comp MSB
+  command[11] = up_comp->Value() & 0xff;           // up comp LSB
+  command[12] = (north_comp->Value() >> 8) & 0xff; // north comp MSB
+  command[13] = north_comp->Value() & 0xff;        // north comp LSB
+  command[14] = 0;                                 // reserved
+  command[15] = 0;                                 // reserved
+  command[16] = 0;                                 // reserved
+  command[17] = 0;                                 // reserved
+  command[18] = 0;                                 // reserved
+  command[19] = 0;                                 // reserved
+
+  written = serialport->Write(&command, sizeof(command));
+  if (written < 0) {
+    self->Thread::Err("Write error (%s)\n", strerror(-written));
+  } else if (written != sizeof(command)) {
+    self->Thread::Err("Write error %i/%i\n", written, sizeof(command));
+  }
+
+  read = serialport->Read(&response[0], sizeof(response));
+  if (read < 0) {
+    self->Thread::Err("Read error (%s)\n", strerror(-read));
+  } else if (read != sizeof(response)) {
+    self->Thread::Err("Read error %i/%i\n", read, sizeof(response));
+  }
+
+  if (CalcChecksum(response, sizeof(response)) == false) {
+    self->Thread::Err("wrong checksum\n", self->IODevice::ObjectName().c_str());
+  } else {
+    data_rate_label->SetText("real: %.2fHz", 1000. / rate);
+  }
+}
+
+void Gx3_25_imu_impl::SetBaudrate(int value) {
+  uint8_t response[10] = {0};
+  uint8_t command[11];
+  ssize_t read = 0;
+  ssize_t written = 0;
+
+  union int32_4uint8 {
+    int32_t i;
+    uint8_t b[4];
+  } baudrate_value;
+
+  baudrate_value.i = value;
+  Printf("Gx3_25_imu::SetBaudrate: %s ->%i\n",
+         self->IODevice::ObjectName().c_str(), baudrate_value.i);
+
+  command[0] = 0xd9; // entete
+  command[1] = 0xc3; // confirm
+  command[2] = 0x55; // confirm
+  command[3] = 1;    // primary uart
+  command[4] = 1;    // chgt temporaire
+  command[5] = baudrate_value.b[3];
+  command[6] = baudrate_value.b[2];
+  command[7] = baudrate_value.b[1];
+  command[8] = baudrate_value.b[0];
+  command[9] = 2;  // uart enabled
+  command[10] = 0; // reserved
+
+  written = serialport->Write(&command, sizeof(command));
+  if (written < 0) {
+    self->Thread::Err("Write error (%s)\n", strerror(-written));
+  } else if (written != sizeof(command)) {
+    self->Thread::Err("Write error %i/%i\n", written, sizeof(command));
+  }
+
+  read = serialport->Read(&response[0], sizeof(response));
+  if (read < 0) {
+    self->Thread::Err("Read error (%s)\n", strerror(-read));
+  } else if (read != sizeof(response)) {
+    self->Thread::Err("Read error %i/%i\n", read, sizeof(response));
+  }
+
+  if (CalcChecksum(response, sizeof(response)) == false) {
+    self->Thread::Err("wrong checksum\n");
+    return;
+  }
+
+  serialport->SetBaudrate(value);
+}
+
+int Gx3_25_imu_impl::FirmwareNumber(void) {
+  uint8_t response[7] = {0};
+  uint8_t command;
+  ssize_t read = 0;
+  ssize_t written = 0;
+  union int32_4uint8 {
+    int32_t i;
+    uint8_t b[4];
+  } value;
+
+  command = 0xe9; // entete
+
+  written = serialport->Write(&command, sizeof(command));
+  if (written < 0) {
+    self->Thread::Err("Write error (%s)\n", strerror(-written));
+  } else if (written != sizeof(command)) {
+    self->Thread::Err("Write error %i/%i\n", written, sizeof(command));
+  }
+
+  read = serialport->Read(&response[0], sizeof(response));
+  if (read < 0) {
+    self->Thread::Err("Read error (%s)\n", strerror(-read));
+  } else if (read != sizeof(response)) {
+    self->Thread::Err("Read error %i/%i\n", read, sizeof(response));
+  }
+
+  if (CalcChecksum(response, sizeof(response)) == false) {
+    self->Thread::Err("wrong checksum\n");
+    return -1;
+  }
+
+  value.b[3] = response[1];
+  value.b[2] = response[2];
+  value.b[1] = response[3];
+  value.b[0] = response[4];
+
+  return value.i;
+}
+
+void Gx3_25_imu_impl::PrintModelInfo(void) {
+  uint8_t response[20] = {0};
+  uint8_t command[2];
+  ssize_t read = 0;
+  ssize_t written = 0;
+
+  for (int i = 0; i < 3; i++) {
+    command[0] = 0xea; // entete
+    command[1] = i;    // entete
+
+    written = serialport->Write(&command, sizeof(command));
+    if (written < 0) {
+      self->Thread::Err("Write error (%s)\n", strerror(-written));
     } else if (written != sizeof(command)) {
-        self->Thread::Err("Write error %i/%i\n",written,sizeof(command));
-    }
-
-    read = serialport->Read(response,sizeof(response));
-    if(read<0) {
-        self->Thread::Err("Read error (%s)\n",strerror(-read));
+      self->Thread::Err("Write error %i/%i\n", written, sizeof(command));
+    }
+
+    read = serialport->Read(&response[0], sizeof(response));
+    if (read < 0) {
+      self->Thread::Err("Read error (%s)\n", strerror(-read));
     } else if (read != sizeof(response)) {
-        self->Thread::Err("Read error %i/%i\n",read,sizeof(response));
-    }
-
-    if(CalcChecksum(response,sizeof(response))==false) {
-        self->Thread::Err("wrong checksum\n",self->IODevice::ObjectName().c_str());
-    }
-}
-
-void Gx3_25_imu_impl::SamplingSettings(void) {
-    uint8_t response[19] = {0};
-    uint8_t command[20];
-    uint8_t result;
-    ssize_t read = 0;
-    ssize_t written = 0;
-
-    uint16_t rate=1000/data_rate->Value();
-
-    command[0]=0xdb;//entete
-    command[1]=0xa8;//confirm
-    command[2]=0xb9;//confirm
-    command[3]=1;//change values
-    command[4]=(rate>>8)&0xff;//data rate MSB
-    command[5]=rate&0xff;//data rate LSB
-    result=0;
-    if(disable_magn->IsChecked()==true) result|=0x01;
-    if(disable_north_comp->IsChecked()==true) result|=0x04;
-    if(disable_grav_comp->IsChecked()==true) result|=0x08;
-
-    command[6]=result;
-    result=0x01;//Calculate orientation
-    if(coning->IsChecked()==true) result|=0x02;
-
-    command[7]=result;
-    command[8]=gyro_acc_size->Value();//gyro acc filter window
-    command[9]=mag_size->Value();//mag filter window
-    command[10]=(up_comp->Value()>>8)&0xff;//up comp MSB
-    command[11]=up_comp->Value()&0xff;//up comp LSB
-    command[12]=(north_comp->Value()>>8)&0xff;//north comp MSB
-    command[13]=north_comp->Value()&0xff;//north comp LSB
-    command[14]=0;//reserved
-    command[15]=0;//reserved
-    command[16]=0;//reserved
-    command[17]=0;//reserved
-    command[18]=0;//reserved
-    command[19]=0;//reserved
-
-    written = serialport->Write(&command, sizeof(command));
-    if(written<0) {
-        self->Thread::Err("Write error (%s)\n",strerror(-written));
-    } else if (written != sizeof(command)) {
-        self->Thread::Err("Write error %i/%i\n",written,sizeof(command));
-    }
-
-    read = serialport->Read(&response[0],sizeof(response));
-    if(read<0) {
-        self->Thread::Err("Read error (%s)\n",strerror(-read));
-    } else if (read != sizeof(response)) {
-        self->Thread::Err("Read error %i/%i\n",read,sizeof(response));
-    }
-
-    if(CalcChecksum(response,sizeof(response))==false) {
-        self->Thread::Err("wrong checksum\n",self->IODevice::ObjectName().c_str());
-    } else {
-        data_rate_label->SetText("real: %.2fHz",1000./rate);
-    }
-}
-
-void Gx3_25_imu_impl::SetBaudrate(int value) {
-    uint8_t response[10] = {0};
-    uint8_t command[11];
-    ssize_t read = 0;
-    ssize_t written = 0;
-
-    union int32_4uint8 {
-        int32_t i;
-        uint8_t b[4];
-    }
-    baudrate_value;
-
-    baudrate_value.i=value;
-    Printf("Gx3_25_imu::SetBaudrate: %s ->%i\n",self->IODevice::ObjectName().c_str(),baudrate_value.i);
-
-    command[0]=0xd9;//entete
-    command[1]=0xc3;//confirm
-    command[2]=0x55;//confirm
-    command[3]=1;//primary uart
-    command[4]=1;//chgt temporaire
-    command[5]=baudrate_value.b[3];
-    command[6]=baudrate_value.b[2];
-    command[7]=baudrate_value.b[1];
-    command[8]=baudrate_value.b[0];
-    command[9]=2;//uart enabled
-    command[10]=0;//reserved
-
-    written = serialport->Write(&command, sizeof(command));
-    if(written<0) {
-        self->Thread::Err("Write error (%s)\n",strerror(-written));
-    } else if (written != sizeof(command)) {
-        self->Thread::Err("Write error %i/%i\n",written,sizeof(command));
-    }
-
-    read = serialport->Read(&response[0],sizeof(response));
-    if(read<0) {
-        self->Thread::Err("Read error (%s)\n",strerror(-read));
-    } else if (read != sizeof(response)) {
-        self->Thread::Err("Read error %i/%i\n",read,sizeof(response));
-    }
-
-    if(CalcChecksum(response,sizeof(response))==false) {
-        self->Thread::Err("wrong checksum\n");
-        return ;
-    }
-
-    serialport->SetBaudrate(value);
-}
-
-int Gx3_25_imu_impl::FirmwareNumber(void) {
-    uint8_t response[7] = {0};
-    uint8_t command;
-    ssize_t read = 0;
-    ssize_t written = 0;
-    union int32_4uint8 {
-        int32_t i;
-        uint8_t b[4];
-    }
-    value;
-
-    command=0xe9;//entete
-
-    written = serialport->Write(&command, sizeof(command));
-    if(written<0) {
-        self->Thread::Err("Write error (%s)\n",strerror(-written));
-    } else if (written != sizeof(command)) {
-        self->Thread::Err("Write error %i/%i\n",written,sizeof(command));
-    }
-
-    read = serialport->Read(&response[0],sizeof(response));
-    if(read<0) {
-        self->Thread::Err("Read error (%s)\n",strerror(-read));
-    } else if (read != sizeof(response)) {
-        self->Thread::Err("Read error %i/%i\n",read,sizeof(response));
-    }
-
-    if(CalcChecksum(response,sizeof(response))==false) {
-        self->Thread::Err("wrong checksum\n");
-        return -1;
-    }
-
-    value.b[3]=response[1];
-    value.b[2]=response[2];
-    value.b[1]=response[3];
-    value.b[0]=response[4];
-
-    return value.i;
-
-}
-
-void Gx3_25_imu_impl::PrintModelInfo(void) {
-    uint8_t response[20] = {0};
-    uint8_t command[2];
-    ssize_t read = 0;
-    ssize_t written = 0;
-
-    for(int i=0; i<3; i++) {
-        command[0]=0xea;//entete
-        command[1]=i;//entete
-
-        written = serialport->Write(&command, sizeof(command));
-        if(written<0) {
-            self->Thread::Err("Write error (%s)\n",strerror(-written));
-        } else if (written != sizeof(command)) {
-            self->Thread::Err("Write error %i/%i\n",written,sizeof(command));
-        }
-
-        read = serialport->Read(&response[0],sizeof(response));
-        if(read<0) {
-            self->Thread::Err("Read error (%s)\n",strerror(-read));
-        } else if (read != sizeof(response)) {
-            self->Thread::Err("Read error %i/%i\n",read,sizeof(response));
-        }
-
-        if(CalcChecksum(response,sizeof(response))==false) {
-            self->Thread::Err("wrong checksum\n");
-            //return -1;
-        }
-
-        char* msg=(char*)(&response[2]);
-        msg[16]=0;
-        switch(i) {
-        case 0:
-            Printf("Gx3_25_imu model number: %s\n",msg);
-            break;
-        case 1:
-            Printf("Gx3_25_imu serial number: %s\n",msg);
-            break;
-        case 2:
-            Printf("Gx3_25_imu model name: %s\n",msg);
-            break;
-        }
-    }
-
-}
-
-void Gx3_25_imu_impl::RealignUpNorth(bool realign_up,bool realign_north) {
-    uint8_t response[7] = {0};
-    uint8_t command[10];
-    ssize_t read = 0;
-    ssize_t written = 0;
-
-    command[0]=0xdd;//entete
-    command[1]=0x54;//confirm
-    command[2]=0x4c;//confirm
-    command[3]=0;//send reply
-    command[4]=255;//up realign
-    command[5]=1;//north realign
-    command[6]=0;//reserved
-    command[7]=0;//reserved
-    command[8]=0;//reserved
-    command[9]=0;//reserved
-
-    written = serialport->Write(&command, sizeof(command));
-    if(written<0) {
-        self->Thread::Err("Write error (%s)\n",strerror(-written));
-    } else if (written != sizeof(command)) {
-        self->Thread::Err("Write error %i/%i\n",written,sizeof(command));
-    }
-
-    read = serialport->Read(&response[0],sizeof(response));
-    if(read<0) {
-        self->Thread::Err("Read error(%s)\n",strerror(-read));
-    } else if (read != sizeof(response)) {
-        self->Thread::Err("Read error %i/%i\n",read,sizeof(response));
-    }
-
-    if(CalcChecksum(response,sizeof(response))==false) {
-        self->Thread::Err("wrong checksum\n");
-    }
+      self->Thread::Err("Read error %i/%i\n", read, sizeof(response));
+    }
+
+    if (CalcChecksum(response, sizeof(response)) == false) {
+      self->Thread::Err("wrong checksum\n");
+      // return -1;
+    }
+
+    char *msg = (char *)(&response[2]);
+    msg[16] = 0;
+    switch (i) {
+    case 0:
+      Printf("Gx3_25_imu model number: %s\n", msg);
+      break;
+    case 1:
+      Printf("Gx3_25_imu serial number: %s\n", msg);
+      break;
+    case 2:
+      Printf("Gx3_25_imu model name: %s\n", msg);
+      break;
+    }
+  }
+}
+
+void Gx3_25_imu_impl::RealignUpNorth(bool realign_up, bool realign_north) {
+  uint8_t response[7] = {0};
+  uint8_t command[10];
+  ssize_t read = 0;
+  ssize_t written = 0;
+
+  command[0] = 0xdd; // entete
+  command[1] = 0x54; // confirm
+  command[2] = 0x4c; // confirm
+  command[3] = 0;    // send reply
+  command[4] = 255;  // up realign
+  command[5] = 1;    // north realign
+  command[6] = 0;    // reserved
+  command[7] = 0;    // reserved
+  command[8] = 0;    // reserved
+  command[9] = 0;    // reserved
+
+  written = serialport->Write(&command, sizeof(command));
+  if (written < 0) {
+    self->Thread::Err("Write error (%s)\n", strerror(-written));
+  } else if (written != sizeof(command)) {
+    self->Thread::Err("Write error %i/%i\n", written, sizeof(command));
+  }
+
+  read = serialport->Read(&response[0], sizeof(response));
+  if (read < 0) {
+    self->Thread::Err("Read error(%s)\n", strerror(-read));
+  } else if (read != sizeof(response)) {
+    self->Thread::Err("Read error %i/%i\n", read, sizeof(response));
+  }
+
+  if (CalcChecksum(response, sizeof(response)) == false) {
+    self->Thread::Err("wrong checksum\n");
+  }
 }
 
 void Gx3_25_imu_impl::DeviceReset(void) {
-    uint8_t command[3];
-    ssize_t written = 0;
-
-    command[0]=0xfe;//entete
-    command[1]=0x9e;//confirm
-    command[2]=0x3a;//confirm
-
-    written = serialport->Write(&command, sizeof(command));
-    if(written<0) {
-        self->Thread::Err("Write error (%s)\n",strerror(-written));
-    } else if (written != sizeof(command)) {
-        self->Thread::Err("Write error %i/%i\n",written,sizeof(command));
-    }
-}
-
-bool Gx3_25_imu_impl::CalcChecksum(uint8_t *buf,int size) {
-    uint16_t tChksum,tResponseChksum;
-
-    tChksum = 0;
-    for (int i = 0; i < size - 2; i++) tChksum += buf[i];
-    // Extract the big-endian checksum from reply
-    tResponseChksum = 0;
-    tResponseChksum = buf[size - 2] << 8;
-    tResponseChksum += buf[size - 1];
-
-    if(tChksum!=tResponseChksum)
-        return false;
-    else
-        return true;
-}
+  uint8_t command[3];
+  ssize_t written = 0;
+
+  command[0] = 0xfe; // entete
+  command[1] = 0x9e; // confirm
+  command[2] = 0x3a; // confirm
+
+  written = serialport->Write(&command, sizeof(command));
+  if (written < 0) {
+    self->Thread::Err("Write error (%s)\n", strerror(-written));
+  } else if (written != sizeof(command)) {
+    self->Thread::Err("Write error %i/%i\n", written, sizeof(command));
+  }
+}
+
+bool Gx3_25_imu_impl::CalcChecksum(uint8_t *buf, int size) {
+  uint16_t tChksum, tResponseChksum;
+
+  tChksum = 0;
+  for (int i = 0; i < size - 2; i++)
+    tChksum += buf[i];
+  // Extract the big-endian checksum from reply
+  tResponseChksum = 0;
+  tResponseChksum = buf[size - 2] << 8;
+  tResponseChksum += buf[size - 1];
+
+  if (tChksum != tResponseChksum)
+    return false;
+  else
+    return true;
+}
Index: trunk/lib/FlairSensorActuator/src/HokuyoUTM30Lx.cpp
===================================================================
--- trunk/lib/FlairSensorActuator/src/HokuyoUTM30Lx.cpp	(revision 14)
+++ trunk/lib/FlairSensorActuator/src/HokuyoUTM30Lx.cpp	(revision 15)
@@ -32,221 +32,220 @@
 using namespace flair::gui;
 
-namespace flair
-{
-namespace sensor
-{
-
-HokuyoUTM30Lx::HokuyoUTM30Lx(const FrameworkManager* parent,string name,SerialPort *serialport,uint8_t priority) : LaserRangeFinder(parent,name), Thread(parent,name,priority)
-{
-    main_tab=new Tab(parent->GetTabWidget(),name);
-	cvmatrix_descriptor* desc=new cvmatrix_descriptor(1081,1);
-    output=new cvmatrix((IODevice*)this,desc,SignedIntegerType(16));
-
-    bufRetMut = new Mutex(reinterpret_cast<Object*>(this),(string)name+"BufRetMut");
-    sendingCmdMut = new Mutex(reinterpret_cast<Object*>(this),(string)name+"SendingCmdMut");
-
-    this->serialport=serialport;
-    serialport->SetRxTimeout(100000000);
-}
-
-HokuyoUTM30Lx::~HokuyoUTM30Lx()
-{
-    delete main_tab;
-    SafeStop();
-    Join();
-}
-
-void HokuyoUTM30Lx::Run(void)
-{
-	/** Debut init **/
-    char c,lastC;
-    int startStep;
-    bool mustDecode=false;
-    stringstream ss;
-    vector<string> ret;
-    lastC=c=0;
-
-	/** Fin init **/
-	resetConfig();
-	startLaser();
-	Printf("Laser started\r\n");
-
-    /** Debut running loop **/
-    WarnUponSwitches(true);
-
-    while(!ToBeStopped())
-    {
-        ss.clear();
-        ss.str("");
-        do{
-            lastC=c;
-            serialport->Read(&c,1);
-            ss << c;
-        }while(!(c=='\n'&&lastC=='\n'));
-        ret=explode(ss.str(),'\n');
-        if(!checkSum(ret.at(1)))
-            perror("Bad Checksum !");
-        if(ret.at(0).substr(0,2)=="MD")
-            mustDecode=true;
-
-        startStep=atoi(ret.at(0).substr(2,4).c_str());
-        ret.erase(ret.begin());
-        bufRetMut->GetMutex();
-        bufRet.push(ret.at(0).substr(0,2));
-        bufRetMut->ReleaseMutex();
-        if(mustDecode){
-            mustDecode=false;
-            ss.clear();
-            ss.str("");
-            do{
-                lastC=c;
-                serialport->Read(&c,1);
-                ss << c;
-            }while(!(c=='\n'&&lastC=='\n'));
-            ret=explode(ss.str(),'\n');
-            ret.erase(ret.begin());
-            ret.erase(ret.begin());
-            if(ret.at(0).size()==5)
-                if(!checkSum(ret.at(0)))
-                    perror("TimeStamp checksum error!");
-            ret.erase(ret.begin());
-            Printf("!post\r\n");
-            ret.pop_back();
-            decodeDatas(ret, startStep);
-        }
+namespace flair {
+namespace sensor {
+
+HokuyoUTM30Lx::HokuyoUTM30Lx(const FrameworkManager *parent, string name,
+                             SerialPort *serialport, uint8_t priority)
+    : LaserRangeFinder(parent, name), Thread(parent, name, priority) {
+  main_tab = new Tab(parent->GetTabWidget(), name);
+  cvmatrix_descriptor *desc = new cvmatrix_descriptor(1081, 1);
+  output = new cvmatrix((IODevice *)this, desc, SignedIntegerType(16));
+
+  bufRetMut =
+      new Mutex(reinterpret_cast<Object *>(this), (string)name + "BufRetMut");
+  sendingCmdMut = new Mutex(reinterpret_cast<Object *>(this),
+                            (string)name + "SendingCmdMut");
+
+  this->serialport = serialport;
+  serialport->SetRxTimeout(100000000);
+}
+
+HokuyoUTM30Lx::~HokuyoUTM30Lx() {
+  delete main_tab;
+  SafeStop();
+  Join();
+}
+
+void HokuyoUTM30Lx::Run(void) {
+  /** Debut init **/
+  char c, lastC;
+  int startStep;
+  bool mustDecode = false;
+  stringstream ss;
+  vector<string> ret;
+  lastC = c = 0;
+
+  /** Fin init **/
+  resetConfig();
+  startLaser();
+  Printf("Laser started\r\n");
+
+  /** Debut running loop **/
+  WarnUponSwitches(true);
+
+  while (!ToBeStopped()) {
+    ss.clear();
+    ss.str("");
+    do {
+      lastC = c;
+      serialport->Read(&c, 1);
+      ss << c;
+    } while (!(c == '\n' && lastC == '\n'));
+    ret = explode(ss.str(), '\n');
+    if (!checkSum(ret.at(1)))
+      perror("Bad Checksum !");
+    if (ret.at(0).substr(0, 2) == "MD")
+      mustDecode = true;
+
+    startStep = atoi(ret.at(0).substr(2, 4).c_str());
+    ret.erase(ret.begin());
+    bufRetMut->GetMutex();
+    bufRet.push(ret.at(0).substr(0, 2));
+    bufRetMut->ReleaseMutex();
+    if (mustDecode) {
+      mustDecode = false;
+      ss.clear();
+      ss.str("");
+      do {
+        lastC = c;
+        serialport->Read(&c, 1);
+        ss << c;
+      } while (!(c == '\n' && lastC == '\n'));
+      ret = explode(ss.str(), '\n');
+      ret.erase(ret.begin());
+      ret.erase(ret.begin());
+      if (ret.at(0).size() == 5)
+        if (!checkSum(ret.at(0)))
+          perror("TimeStamp checksum error!");
+      ret.erase(ret.begin());
+      Printf("!post\r\n");
+      ret.pop_back();
+      decodeDatas(ret, startStep);
     }
-    /** fin running loop **/
-    stopLaser();
-    WarnUponSwitches(false);
-}
-
-
-void HokuyoUTM30Lx::decodeDatas(vector<string> datas, int startStep){
-            stringstream ss;
-            for (unsigned i=0; i<datas.size(); i++){
-                if(datas.at(i).size()!=0){
-                    if(!checkSum(datas.at(i)))
-                        perror("Datas checksum error !");
-                    datas.at(i).erase(datas.at(i).end()-1);
-                    ss << datas.at(i);
-                }
-            }
-            output->GetMutex();
-            for(unsigned i=0;i<1080;i++){
-            //TODO: remettre -1 pour les points non lus
-                output->SetValueNoMutex(i,0,0);
-            }
-            for(unsigned i=0;i<ss.str().size();i+=3){
-                output->SetValueNoMutex(startStep+(i/3),0,decode3car(ss.str().substr(i,3).c_str()));
-            }
-            UpdateFrom(output);
-            ProcessUpdate(output);
-            output->ReleaseMutex();
-
-}
-
-bool HokuyoUTM30Lx::checkSum(string data){
-    return (char)encodeSum(data.substr(0,data.size()-1).c_str(),data.size()-1)==data.at(data.size()-1);
-}
-
-void HokuyoUTM30Lx::startLaser(){
-    string ret = sendCommand("BM");
-    #ifdef VERBOSE
-        if(ret == "00"){
-            cout << "BM: Alright !" << endl;
-        }else if(ret == "01"){
-            cout << "BM: Laser malfunction !" << endl;
-        }else if(ret == "02"){
-            cout << "BM: Laser already started !" << endl;
-        }
-    #endif
-}
-
-void HokuyoUTM30Lx::stopLaser(){
-    sendCommand("QT");
-}
-
-void HokuyoUTM30Lx::resetConfig(){
-    sendCommand("RS");
-}
-
-vector<string> HokuyoUTM30Lx::explode(const string str, char delimiter){
-    istringstream split(str);
-    vector<string> tokens;
-    for (string each; getline(split, each, delimiter); tokens.push_back(each));
-    return tokens;
-}
-
-int HokuyoUTM30Lx::encodeSum(const char* code, int byte) {
-    unsigned char value = 0;
-    int i;
-    for (i = 0; i < byte; ++i) {
-        value+=code[i];
+  }
+  /** fin running loop **/
+  stopLaser();
+  WarnUponSwitches(false);
+}
+
+void HokuyoUTM30Lx::decodeDatas(vector<string> datas, int startStep) {
+  stringstream ss;
+  for (unsigned i = 0; i < datas.size(); i++) {
+    if (datas.at(i).size() != 0) {
+      if (!checkSum(datas.at(i)))
+        perror("Datas checksum error !");
+      datas.at(i).erase(datas.at(i).end() - 1);
+      ss << datas.at(i);
     }
-    value &= 0x3f;
-    value += 0x30;
-    return value;
-}
-
-float HokuyoUTM30Lx::decode2car(const char* data){
-    return ((data[0]-0x30)<<6)|((data[1]-0x30));
-}
-float HokuyoUTM30Lx::decode3car(const char* data){
-    return ((data[0]-0x30)<<12)|((data[1]-0x30)<<6)|((data[2]-0x30));
-}
-float HokuyoUTM30Lx::decode4car(const char* data){
-    return ((data[0]-0x30)<<18)|((data[1]-0x30)<<12)|((data[2]-0x30)<<6)|((data[3]-0x30));
-}
-
-string HokuyoUTM30Lx::sendCommand(string command){
-    char c;
-    string ret="00";
-    c='\n';
-    sendingCmdMut->GetMutex();
-    serialport->Write(command.c_str(),command.size());
-    serialport->Write(&c,1);
-    sendingCmdMut->ReleaseMutex();
-    return ret;
-}
-
-void HokuyoUTM30Lx::getMesure(int startStep, int endStep,int clusterCount, int interval, int scanNumber){
-    stringstream ss;
-    string ret;
-    ss << "MD" << std::setfill('0') << std::setw(4) << startStep << std::setw(4) << endStep << std::setw(2) << clusterCount << std::setw(1) << interval << std::setw(2) << scanNumber;
-    ret = sendCommand(ss.str());
-    #ifdef VERBOSE
-        if(ret == "00"){
-            cout << "MD: Alright !" << endl;
-        }else if(ret == "01"){
-            cout << "MD: Laser malfunction !" << endl;
-        }else if(ret == "02"){
-            cout << "MD: End Step has non-numeric value !" << endl;
-        }else if(ret == "03"){
-            cout << "MD: Cluster Count has non-numeric value !" << endl;
-        }else if(ret == "04"){
-            cout << "MD: End Step is out of range !" << endl;
-        }else if(ret == "05"){
-            cout << "MD: End Step is smaller than Starting Step !" << endl;
-        }else if(ret == "06"){
-            cout << "MD: Scan Interval has non-numeric value !" << endl;
-        }else if(ret == "07"){
-            cout << "MD: Number of Scan has non-numeric value !" << endl;
-        }else if(ret == "98"){
-            cout << "MD: Resumption of process after confirming normal HokuyoUTM30Lx operation." << endl;
-        }else{
-            /* Concerne :
-            21~49 --- Processing stopped to verify the error.
-            50~97 --- Hardware trouble (such as laser, motor malfunctions etc.)*/
-            cout << "MD: Malfunction !" << endl;
-        }
-    #endif
-    }
-cvmatrix* HokuyoUTM30Lx::getDatas(){
-    return output;
-}
-
-void HokuyoUTM30Lx::UseDefaultPlot(void)
-{
-    plot=new RangeFinderPlot(main_tab->NewRow(),"plot","x",-100,100,"y",-0,100,output,-45,225,output->Rows());
+  }
+  output->GetMutex();
+  for (unsigned i = 0; i < 1080; i++) {
+    // TODO: remettre -1 pour les points non lus
+    output->SetValueNoMutex(i, 0, 0);
+  }
+  for (unsigned i = 0; i < ss.str().size(); i += 3) {
+    output->SetValueNoMutex(startStep + (i / 3), 0,
+                            decode3car(ss.str().substr(i, 3).c_str()));
+  }
+  UpdateFrom(output);
+  ProcessUpdate(output);
+  output->ReleaseMutex();
+}
+
+bool HokuyoUTM30Lx::checkSum(string data) {
+  return (char)encodeSum(data.substr(0, data.size() - 1).c_str(),
+                         data.size() - 1) == data.at(data.size() - 1);
+}
+
+void HokuyoUTM30Lx::startLaser() {
+  string ret = sendCommand("BM");
+#ifdef VERBOSE
+  if (ret == "00") {
+    cout << "BM: Alright !" << endl;
+  } else if (ret == "01") {
+    cout << "BM: Laser malfunction !" << endl;
+  } else if (ret == "02") {
+    cout << "BM: Laser already started !" << endl;
+  }
+#endif
+}
+
+void HokuyoUTM30Lx::stopLaser() { sendCommand("QT"); }
+
+void HokuyoUTM30Lx::resetConfig() { sendCommand("RS"); }
+
+vector<string> HokuyoUTM30Lx::explode(const string str, char delimiter) {
+  istringstream split(str);
+  vector<string> tokens;
+  for (string each; getline(split, each, delimiter); tokens.push_back(each))
+    ;
+  return tokens;
+}
+
+int HokuyoUTM30Lx::encodeSum(const char *code, int byte) {
+  unsigned char value = 0;
+  int i;
+  for (i = 0; i < byte; ++i) {
+    value += code[i];
+  }
+  value &= 0x3f;
+  value += 0x30;
+  return value;
+}
+
+float HokuyoUTM30Lx::decode2car(const char *data) {
+  return ((data[0] - 0x30) << 6) | ((data[1] - 0x30));
+}
+float HokuyoUTM30Lx::decode3car(const char *data) {
+  return ((data[0] - 0x30) << 12) | ((data[1] - 0x30) << 6) |
+         ((data[2] - 0x30));
+}
+float HokuyoUTM30Lx::decode4car(const char *data) {
+  return ((data[0] - 0x30) << 18) | ((data[1] - 0x30) << 12) |
+         ((data[2] - 0x30) << 6) | ((data[3] - 0x30));
+}
+
+string HokuyoUTM30Lx::sendCommand(string command) {
+  char c;
+  string ret = "00";
+  c = '\n';
+  sendingCmdMut->GetMutex();
+  serialport->Write(command.c_str(), command.size());
+  serialport->Write(&c, 1);
+  sendingCmdMut->ReleaseMutex();
+  return ret;
+}
+
+void HokuyoUTM30Lx::getMesure(int startStep, int endStep, int clusterCount,
+                              int interval, int scanNumber) {
+  stringstream ss;
+  string ret;
+  ss << "MD" << std::setfill('0') << std::setw(4) << startStep << std::setw(4)
+     << endStep << std::setw(2) << clusterCount << std::setw(1) << interval
+     << std::setw(2) << scanNumber;
+  ret = sendCommand(ss.str());
+#ifdef VERBOSE
+  if (ret == "00") {
+    cout << "MD: Alright !" << endl;
+  } else if (ret == "01") {
+    cout << "MD: Laser malfunction !" << endl;
+  } else if (ret == "02") {
+    cout << "MD: End Step has non-numeric value !" << endl;
+  } else if (ret == "03") {
+    cout << "MD: Cluster Count has non-numeric value !" << endl;
+  } else if (ret == "04") {
+    cout << "MD: End Step is out of range !" << endl;
+  } else if (ret == "05") {
+    cout << "MD: End Step is smaller than Starting Step !" << endl;
+  } else if (ret == "06") {
+    cout << "MD: Scan Interval has non-numeric value !" << endl;
+  } else if (ret == "07") {
+    cout << "MD: Number of Scan has non-numeric value !" << endl;
+  } else if (ret == "98") {
+    cout << "MD: Resumption of process after confirming normal HokuyoUTM30Lx "
+            "operation." << endl;
+  } else {
+    /* Concerne :
+    21~49 --- Processing stopped to verify the error.
+    50~97 --- Hardware trouble (such as laser, motor malfunctions etc.)*/
+    cout << "MD: Malfunction !" << endl;
+  }
+#endif
+}
+cvmatrix *HokuyoUTM30Lx::getDatas() { return output; }
+
+void HokuyoUTM30Lx::UseDefaultPlot(void) {
+  plot = new RangeFinderPlot(main_tab->NewRow(), "plot", "x", -100, 100, "y",
+                             -0, 100, output, -45, 225, output->Rows());
 }
 
Index: trunk/lib/FlairSensorActuator/src/HokuyoUTM30Lx.h
===================================================================
--- trunk/lib/FlairSensorActuator/src/HokuyoUTM30Lx.h	(revision 14)
+++ trunk/lib/FlairSensorActuator/src/HokuyoUTM30Lx.h	(revision 15)
@@ -21,154 +21,150 @@
 #include <vector>
 
-namespace flair
-{
-    namespace core
-    {
-        class cvmatrix;
-        class FrameworkManager;
-        class SerialPort;
-        class Mutex;
-    }
-    namespace gui
-    {
-        class Tab;
-        class TabWidget;
-        class RangeFinderPlot;
-    }
+namespace flair {
+namespace core {
+class cvmatrix;
+class FrameworkManager;
+class SerialPort;
+class Mutex;
+}
+namespace gui {
+class Tab;
+class TabWidget;
+class RangeFinderPlot;
+}
 }
 
-namespace flair
-{
-namespace sensor
-{
-    /*! \class HokuyoUTM30Lx
-    *
-    * \brief Classe intégrant le telemetre laser Hokuyo UTM 30lx
-    */
-    class HokuyoUTM30Lx : public core::Thread, public LaserRangeFinder
-    {
-        public:
+namespace flair {
+namespace sensor {
+/*! \class HokuyoUTM30Lx
+*
+* \brief Classe intégrant le telemetre laser Hokuyo UTM 30lx
+*/
+class HokuyoUTM30Lx : public core::Thread, public LaserRangeFinder {
+public:
+  /*!
+ * \brief Constructor
+ *
+ * Construct a Hokuyo UTM30-Lx.
+ *
+ * \param parent parent
+ * \param name name
+ * \param serialport serialport
+ * \param priority priority of the Thread
+ */
+  HokuyoUTM30Lx(const core::FrameworkManager *parent, std::string name,
+                core::SerialPort *serialport, uint8_t priority);
+  void getMesure(int startStep, int endStep, int clusterCount, int interval,
+                 int scanNumber = 0);
+  core::cvmatrix *getDatas(void);
 
-             /*!
-            * \brief Constructor
-            *
-            * Construct a Hokuyo UTM30-Lx.
-            *
-            * \param parent parent
-            * \param name name
-            * \param serialport serialport
-            * \param priority priority of the Thread
-            */
-            HokuyoUTM30Lx(const core::FrameworkManager* parent,std::string name,core::SerialPort *serialport,uint8_t priority);
-            void getMesure(int startStep, int endStep,int clusterCount, int interval, int scanNumber=0);
-            core::cvmatrix* getDatas(void);
+  /*!
+  * \brief Use default plot
+  *
+  */
+  void UseDefaultPlot(void);
+  /*!
+  * \brief Destructor
+  *
+  */
+  ~HokuyoUTM30Lx();
 
-            /*!
-            * \brief Use default plot
-            *
-            */
-            void UseDefaultPlot(void);
-            /*!
-            * \brief Destructor
-            *
-            */
-            ~HokuyoUTM30Lx();
+private:
+  core::SerialPort *serialport;
+  core::Mutex *bufRetMut;
+  core::Mutex *sendingCmdMut;
+  gui::Tab *main_tab;
+  gui::TabWidget *tab;
+  gui::RangeFinderPlot *plot;
 
-        private:
-            core::SerialPort *serialport;
-            core::Mutex* bufRetMut;
-            core::Mutex* sendingCmdMut;
-            gui::Tab* main_tab;
-            gui::TabWidget* tab;
-            gui::RangeFinderPlot* plot;
+  // matrix
+  core::cvmatrix *output;
 
-            //matrix
-            core::cvmatrix *output;
+  std::queue<std::string> bufRet;
 
-			std::queue<std::string> bufRet;
+  /*!
+  * \brief Run function
+  *
+  * Reimplemented from Thread.
+  *
+  */
+  void Run(void);
+  /*!
+  * \brief Send a command
+  * \param command Command to send (see Hokuyo UTM 30-LX doc for more
+  * informations)
+  * \return Return code
+  */
+  std::string sendCommand(std::string command);
+  /*!
+  * \brief Start the laser
+  *
+  */
+  void startLaser(void);
+  /*!
+  * \brief Stop the laser
+  *
+  */
+  void stopLaser(void);
+  /*!
+* \brief Stop and reset the laser's settings
+*
+*/
+  void resetConfig(void);
+  /*!
+* \brief Decode incomming datas
+* \param datas Datas to decode
+* \param startStep Set the first mesured point
+* Decode mesured points from incoming datas and fill the output matrix
+*/
+  void decodeDatas(std::vector<std::string> datas, int startStep);
+  /*!
+  * \brief Explode a string into a vector
+  * \param str The string to explode
+  * \param delimiter The character separating elements
+  * \return A vector containing the elements
+  */
+  static std::vector<std::string> explode(const std::string str,
+                                          char delimiter);
+  /*!
+* \brief Calculate the checksum
+* \param code Data from which calculate
+* \param byte Data's size
+* \return A character corresponding to the code's checksum
+*/
+  static int encodeSum(const char *code, int byte);
+  /*!
+* \brief Check if a data correspond to its checksum
+* \param data Datas to check
+*/
+  static bool checkSum(std::string data);
+  /*!
+* \brief Decode datas using the 2 character encoding
+* \param data Datas to decode
+* \return Decoded datas
+*/
+  static float decode2car(const char *data);
+  /*!
+* \brief Decode datas using the 3 character encoding
+* \param data Datas to decode
+* \return Decoded datas
+*/
+  static float decode3car(const char *data);
+  /*!
+* \brief Decode datas using the 4 character encoding
+* \param data Datas to decode
+* \return Decoded datas
+*/
+  static float decode4car(const char *data);
 
-            /*!
-            * \brief Run function
-            *
-            * Reimplemented from Thread.
-            *
-            */
-            void Run(void);
-            /*!
-            * \brief Send a command
-            * \param command Command to send (see Hokuyo UTM 30-LX doc for more informations)
-            * \return Return code
-            */
-            std::string sendCommand(std::string command);
-            /*!
-            * \brief Start the laser
-            *
-            */
-            void startLaser(void);
-            /*!
-            * \brief Stop the laser
-            *
-            */
-			void stopLaser(void);
-			/*!
-            * \brief Stop and reset the laser's settings
-            *
-            */
-		    void resetConfig(void);
-		    /*!
-            * \brief Decode incomming datas
-            * \param datas Datas to decode
-            * \param startStep Set the first mesured point
-            * Decode mesured points from incoming datas and fill the output matrix
-            */
-		    void decodeDatas(std::vector<std::string> datas, int startStep);
-            /*!
-            * \brief Explode a string into a vector
-            * \param str The string to explode
-            * \param delimiter The character separating elements
-            * \return A vector containing the elements
-            */
-			static std::vector<std::string> explode(const std::string str, char delimiter);
-			/*!
-            * \brief Calculate the checksum
-            * \param code Data from which calculate
-            * \param byte Data's size
-            * \return A character corresponding to the code's checksum
-            */
-			static int encodeSum(const char* code, int byte);
-			/*!
-            * \brief Check if a data correspond to its checksum
-            * \param data Datas to check
-            */
-			static bool checkSum(std::string data);
-			/*!
-            * \brief Decode datas using the 2 character encoding
-            * \param data Datas to decode
-            * \return Decoded datas
-            */
-			static float decode2car(const char* data);
-			/*!
-            * \brief Decode datas using the 3 character encoding
-            * \param data Datas to decode
-            * \return Decoded datas
-            */
-			static float decode3car(const char* data);
-			/*!
-            * \brief Decode datas using the 4 character encoding
-            * \param data Datas to decode
-            * \return Decoded datas
-            */
-			static float decode4car(const char* data);
-
-			/*!
-            * \brief Update using provided datas
-            *
-            * Reimplemented from IODevice.
-            *
-            * \param data data from the parent to process
-            */
-            void UpdateFrom(const core::io_data *data){};
-
-    };
+  /*!
+* \brief Update using provided datas
+*
+* Reimplemented from IODevice.
+*
+* \param data data from the parent to process
+*/
+  void UpdateFrom(const core::io_data *data){};
+};
 } // end namespace sensor
 } // end namespace framewor
Index: trunk/lib/FlairSensorActuator/src/HostEthController.cpp
===================================================================
--- trunk/lib/FlairSensorActuator/src/HostEthController.cpp	(revision 14)
+++ trunk/lib/FlairSensorActuator/src/HostEthController.cpp	(revision 15)
@@ -11,5 +11,6 @@
 //  version:    $Id: $
 //
-//  purpose:    Base class for host side remote controls that talks to target side through ethernet connection
+//  purpose:    Base class for host side remote controls that talks to target
+//  side through ethernet connection
 //
 //
@@ -37,225 +38,265 @@
 using std::string;
 
-namespace flair
-{
-namespace sensor
-{
-
-HostEthController::HostEthController(const FrameworkManager* parent,string name,string _address,int _port,uint32_t period,uint32_t _bitsPerAxis,uint8_t priority) :
-    Thread(parent,name,priority),IODevice(parent,name),tab(new Tab(parent->GetTabWidget(),name)),axisNumber(0),buttonNumber(0),targetAddress(_address),targetPort(_port),
-    bitsPerAxis(_bitsPerAxis),dataFrameBuffer(NULL),meaningfulDataAvailable(false) {
-    tabWidget=new TabWidget(tab->NewRow(),name);
-
-    const bool blocking=true;
-    controlSocket=new TcpSocket((Thread*)this,"eth controller control socket", blocking, !blocking);
-    dataSocket=new Socket((Thread*)this,"eth controller data socket",_address+":"+std::to_string(_port+1));
-    dataSender=new DataSender((Thread*)this, this, "eth controller data sender thread");
-    dataSender->SetPeriodMS(period);
-    dataSender->Start();
-
-    //test binary
-    /*
-    uint16_t testValue=0b0111011010; //0x1DA
-    char buffer[3]={(char)0b10101011, (char)0b01100101, (char)0b10110110}; // 0xAB65B6
-    writeBits(testValue,10,buffer,7); // 0b1010101 0 11101101 0 0110110 0xAAED36
-    Thread::Info("Debug: buffer after bits written=%X %X\n",buffer[0],buffer[1]);
-    */
-    connectionEstablishedMutex=new Mutex((Thread*)this);
+namespace flair {
+namespace sensor {
+
+HostEthController::HostEthController(const FrameworkManager *parent,
+                                     string name, string _address, int _port,
+                                     uint32_t period, uint32_t _bitsPerAxis,
+                                     uint8_t priority)
+    : Thread(parent, name, priority), IODevice(parent, name),
+      tab(new Tab(parent->GetTabWidget(), name)), axisNumber(0),
+      buttonNumber(0), targetAddress(_address), targetPort(_port),
+      bitsPerAxis(_bitsPerAxis), dataFrameBuffer(NULL),
+      meaningfulDataAvailable(false) {
+  tabWidget = new TabWidget(tab->NewRow(), name);
+
+  const bool blocking = true;
+  controlSocket = new TcpSocket((Thread *)this, "eth controller control socket",
+                                blocking, !blocking);
+  dataSocket = new Socket((Thread *)this, "eth controller data socket",
+                          _address + ":" + std::to_string(_port + 1));
+  dataSender =
+      new DataSender((Thread *)this, this, "eth controller data sender thread");
+  dataSender->SetPeriodMS(period);
+  dataSender->Start();
+
+  // test binary
+  /*
+  uint16_t testValue=0b0111011010; //0x1DA
+  char buffer[3]={(char)0b10101011, (char)0b01100101, (char)0b10110110}; //
+  0xAB65B6
+  writeBits(testValue,10,buffer,7); // 0b1010101 0 11101101 0 0110110 0xAAED36
+  Thread::Info("Debug: buffer after bits written=%X %X\n",buffer[0],buffer[1]);
+  */
+  connectionEstablishedMutex = new Mutex((Thread *)this);
 }
 
 HostEthController::~HostEthController() {
+  SafeStop();
+  Join();
+
+  if (!getFrameworkManager()->ConnectionLost())
+    delete tab;
+}
+
+void HostEthController::DrawUserInterface() {
+  Tab *plotTab = new Tab(tabWidget, "Measures");
+  axisPlot = new DataPlot1D *[axisNumber];
+  for (unsigned int i = 0; i < axisNumber; i++) {
+    // Start a new row or add up to the current row? We try to keep a 4/3 ratio
+    unsigned int columns = sqrt(4.0 * axisNumber / 3.0);
+    LayoutPosition *position;
+    if (i % columns == 0) {
+      position = plotTab->NewRow();
+    } else {
+      position = plotTab->LastRowLastCol();
+    }
+    axisPlot[i] = new DataPlot1D(position, axis->Name(i, 0),
+                                 -(1 << (nativeBitsPerAxis - 1)) * 1.2,
+                                 (1 << (nativeBitsPerAxis - 1)) * 1.5);
+    axisPlot[i]->AddCurve(axis->Element(i));
+  }
+  // we don't plot the button state for now
+}
+
+string HostEthController::GetAxisDescription(unsigned int axis) {
+  return string("axis") + std::to_string(axis);
+}
+
+string HostEthController::GetButtonDescription(unsigned int button) {
+  return string("button") + std::to_string(button);
+}
+
+bool HostEthController::ControllerInitialization() {
+
+  buttonOffset = (axisNumber * bitsPerAxis) / 8;
+  if ((axisNumber * bitsPerAxis) % 8 != 0)
+    buttonOffset++;
+  dataFrameSize = buttonOffset + (buttonNumber / 8) * sizeof(uint8_t);
+  if ((buttonNumber % 8) != 0)
+    dataFrameSize++;
+  dataFrameBuffer = new char[dataFrameSize];
+  return true;
+}
+
+void HostEthController::SendControllerInfo() {
+  // send axis info
+  controlSocket->WriteUInt32((uint32_t)axisNumber, 0);
+  controlSocket->WriteUInt32(bitsPerAxis, 0);
+  for (unsigned int i = 0; i < axisNumber; i++) {
+    // Thread::Info("Debug: sending axis name for axis %d = %s (takes up %d
+    // bytes)\n",i,GetAxisDescription(i).c_str(),GetAxisDescription(i).length());
+    int stringLength = GetAxisDescription(i).length();
+    controlSocket->WriteUInt32((uint32_t)stringLength, 0);
+    controlSocket->SendMessage(GetAxisDescription(i).c_str(), stringLength, 0);
+  }
+
+  // send button info
+  controlSocket->WriteUInt32((uint32_t)buttonNumber, 0);
+  for (unsigned int i = 0; i < buttonNumber; i++) {
+    int stringLength = GetButtonDescription(i).length();
+    controlSocket->WriteUInt32((uint32_t)stringLength, 0);
+    controlSocket->SendMessage(GetButtonDescription(i).c_str(), stringLength,
+                               0);
+  }
+}
+
+bool HostEthController::ConnectedWithTarget() {
+  char message[1024];
+  ssize_t sent, received;
+  static bool connectionEstablished = false;
+
+  connectionEstablishedMutex->GetMutex();
+  if (!connectionEstablished &&
+      controlSocket->Connect(targetPort, targetAddress, 10)) {
+    Thread::Info("Connected to %s:%d\n", targetAddress.c_str(), targetPort);
+    SendControllerInfo();
+    connectionEstablished = true;
+  }
+  connectionEstablishedMutex->ReleaseMutex();
+  return connectionEstablished;
+}
+
+void HostEthController::Run() {
+  static int divider = 0;
+  Message *msgControllerAction = new Message(1024);
+  if (getFrameworkManager()->ErrorOccured() || !ControllerInitialization()) {
     SafeStop();
-    Join();
-
-    if(!getFrameworkManager()->ConnectionLost()) delete tab;
-}
-
-void HostEthController::DrawUserInterface() {
-    Tab* plotTab=new Tab(tabWidget,"Measures");
-    axisPlot=new DataPlot1D *[axisNumber];
-    for (unsigned int i=0; i<axisNumber;i++) {
-        //Start a new row or add up to the current row? We try to keep a 4/3 ratio
-        unsigned int columns=sqrt(4.0*axisNumber/3.0);
-        LayoutPosition *position;
-        if (i%columns==0) {
-            position=plotTab->NewRow();
-        } else {
-            position=plotTab->LastRowLastCol();
+    Thread::Err("Une erreur a eu lieu, on ne lance pas la boucle\n");
+  }
+
+  if (buttonNumber % 8 != 0) {
+    SafeStop();
+    Thread::Err("Button number is not multiple of 8\n");
+  }
+
+  while (!ToBeStopped()) {
+    // Thread::Info("Debug: entering acquisition loop\n");
+    if (getFrameworkManager()->ConnectionLost() == true)
+      SafeStop();
+
+    if (IsDataFrameReady()) { // wait for next data frame
+      meaningfulDataAvailable = true;
+      GetAxisData();
+      GetButtonData();
+
+      if (ConnectedWithTarget()) {
+        // read for commands from the target (remote control state change
+        // requests such as rumble or led on/off)
+        ssize_t bytesReceived =
+            controlSocket->RecvMessage((char *)msgControllerAction->buffer,
+                                       msgControllerAction->bufferSize);
+        if (bytesReceived > 0) {
+          // if the message is a cnx exit request we manage it here, if not it
+          // will be managed by the derived class
+          ControllerAction action;
+          memcpy(&action, msgControllerAction->buffer,
+                 sizeof(ControllerAction));
+          if (action == ControllerAction::Exit) {
+            // Thread::Info("Debug: exit request received from server\n");
+            SafeStop();
+          }
+          ProcessMessage(msgControllerAction);
         }
-        axisPlot[i]=new DataPlot1D(position,axis->Name(i,0),-(1<<(nativeBitsPerAxis-1))*1.2,(1<<(nativeBitsPerAxis-1))*1.5);
-        axisPlot[i]->AddCurve(axis->Element(i));
-    }
-    //we don't plot the button state for now
-}
-
-string HostEthController::GetAxisDescription(unsigned int axis) {
-    return string("axis")+std::to_string(axis);
-}
-
-string HostEthController::GetButtonDescription(unsigned int button) {
-    return string("button")+std::to_string(button);
-}
-
-bool HostEthController::ControllerInitialization() {
-
-    buttonOffset=(axisNumber*bitsPerAxis)/8;
-    if ((axisNumber*bitsPerAxis)%8!=0) buttonOffset++;
-    dataFrameSize=buttonOffset+(buttonNumber/8)*sizeof(uint8_t);
-    if ((buttonNumber%8)!=0) dataFrameSize++;
-    dataFrameBuffer=new char[dataFrameSize];
-    return true;
-}
-
-void HostEthController::SendControllerInfo() {
-    //send axis info
-    controlSocket->WriteUInt32((uint32_t)axisNumber,0);
-    controlSocket->WriteUInt32(bitsPerAxis,0);
-    for (unsigned int i=0; i<axisNumber; i++) {
-        //Thread::Info("Debug: sending axis name for axis %d = %s (takes up %d bytes)\n",i,GetAxisDescription(i).c_str(),GetAxisDescription(i).length());
-        int stringLength=GetAxisDescription(i).length();
-        controlSocket->WriteUInt32((uint32_t)stringLength,0);
-        controlSocket->SendMessage(GetAxisDescription(i).c_str(), stringLength,0);
-    }
-
-    //send button info
-    controlSocket->WriteUInt32((uint32_t)buttonNumber,0);
-    for (unsigned int i=0; i<buttonNumber; i++) {
-        int stringLength=GetButtonDescription(i).length();
-        controlSocket->WriteUInt32((uint32_t)stringLength,0);
-        controlSocket->SendMessage(GetButtonDescription(i).c_str(), stringLength,0);
-    }
-}
-
-bool HostEthController::ConnectedWithTarget() {
-    char message[1024];
-    ssize_t sent,received;
-    static bool connectionEstablished=false;
-
-    connectionEstablishedMutex->GetMutex();
-    if (!connectionEstablished && controlSocket->Connect(targetPort,targetAddress,10)) {
-        Thread::Info("Connected to %s:%d\n", targetAddress.c_str(), targetPort);
-        SendControllerInfo();
-        connectionEstablished=true;
-    }
-    connectionEstablishedMutex->ReleaseMutex();
-    return connectionEstablished;
-}
-
-void HostEthController::Run() {
-    static int divider=0;
-    Message *msgControllerAction=new Message(1024);
-    if(getFrameworkManager()->ErrorOccured()||!ControllerInitialization()) {
-        SafeStop();
-        Thread::Err("Une erreur a eu lieu, on ne lance pas la boucle\n");
-    }
-
-    if(buttonNumber%8!=0) {
-        SafeStop();
-        Thread::Err("Button number is not multiple of 8\n");
-    }
-
-    while(!ToBeStopped()) {
-        //Thread::Info("Debug: entering acquisition loop\n");
-        if(getFrameworkManager()->ConnectionLost()==true) SafeStop();
-
-        if (IsDataFrameReady()) {  //wait for next data frame
-            meaningfulDataAvailable=true;
-            GetAxisData();
-            GetButtonData();
-
-            if (ConnectedWithTarget()) {
-                //read for commands from the target (remote control state change requests such as rumble or led on/off)
-                ssize_t bytesReceived=controlSocket->RecvMessage((char*)msgControllerAction->buffer,msgControllerAction->bufferSize);
-                if(bytesReceived>0) {
-                    //if the message is a cnx exit request we manage it here, if not it will be managed by the derived class
-                    ControllerAction action;
-                    memcpy(&action,msgControllerAction->buffer,sizeof(ControllerAction));
-                    if (action==ControllerAction::Exit) {
-                        //Thread::Info("Debug: exit request received from server\n");
-                        SafeStop();
-                    }
-                    ProcessMessage(msgControllerAction);
-                }
-            }
-        } else {//try to connect even if host is not sending anything
-            ConnectedWithTarget();
-        }
-        //Thread::Info("Debug: exiting acquisition loop\n");
-    }
-}
-
-bool HostEthController::writeBits(uint16_t value,uint8_t valueSizeInBits,char *buffer,uint8_t offsetInBits) {
-    if (valueSizeInBits>16) return false;
-    uint8_t remainingBitsToWrite=valueSizeInBits;
-    //skip first bytes
-    buffer+=offsetInBits/8;
-    offsetInBits-=(offsetInBits/8)*8;
-    while (remainingBitsToWrite>0) {
-        uint8_t remainingBitsInByteBeforeWrite=8-offsetInBits;
-        uint8_t bitsToWrite=remainingBitsToWrite<remainingBitsInByteBeforeWrite?remainingBitsToWrite:remainingBitsInByteBeforeWrite;
-        uint8_t remainingBitsInByteAfterWrite=remainingBitsInByteBeforeWrite-bitsToWrite;
-        //write in the current byte
-        uint8_t byteMask=((1<<bitsToWrite)-1)<<remainingBitsInByteAfterWrite;
-        (*buffer)&=~byteMask;
-        uint16_t valueMask=(1<<remainingBitsToWrite)-1;
-        (*buffer)|=((value&valueMask)>>(remainingBitsToWrite-bitsToWrite))<<remainingBitsInByteAfterWrite;
-        //update state
-        remainingBitsToWrite-=bitsToWrite;
-        offsetInBits=(offsetInBits+bitsToWrite)%8;
-        buffer++;
-    }
-    return true;
+      }
+    } else { // try to connect even if host is not sending anything
+      ConnectedWithTarget();
+    }
+    // Thread::Info("Debug: exiting acquisition loop\n");
+  }
+}
+
+bool HostEthController::writeBits(uint16_t value, uint8_t valueSizeInBits,
+                                  char *buffer, uint8_t offsetInBits) {
+  if (valueSizeInBits > 16)
+    return false;
+  uint8_t remainingBitsToWrite = valueSizeInBits;
+  // skip first bytes
+  buffer += offsetInBits / 8;
+  offsetInBits -= (offsetInBits / 8) * 8;
+  while (remainingBitsToWrite > 0) {
+    uint8_t remainingBitsInByteBeforeWrite = 8 - offsetInBits;
+    uint8_t bitsToWrite = remainingBitsToWrite < remainingBitsInByteBeforeWrite
+                              ? remainingBitsToWrite
+                              : remainingBitsInByteBeforeWrite;
+    uint8_t remainingBitsInByteAfterWrite =
+        remainingBitsInByteBeforeWrite - bitsToWrite;
+    // write in the current byte
+    uint8_t byteMask = ((1 << bitsToWrite) - 1)
+                       << remainingBitsInByteAfterWrite;
+    (*buffer) &= ~byteMask;
+    uint16_t valueMask = (1 << remainingBitsToWrite) - 1;
+    (*buffer) |= ((value & valueMask) >> (remainingBitsToWrite - bitsToWrite))
+                 << remainingBitsInByteAfterWrite;
+    // update state
+    remainingBitsToWrite -= bitsToWrite;
+    offsetInBits = (offsetInBits + bitsToWrite) % 8;
+    buffer++;
+  }
+  return true;
 }
 
 void HostEthController::BuildDataFrame() {
-    //int16_t testValue[4]={-120,-43,27,98}; //0x 88 d5 1b 62
-    for (unsigned int i=0;i<axisNumber;i++) {
-        //We shift value to always be positive (so that division/multiplication by power of 2 can easily be done with bit shifts)
-        uint16_t shiftedNativeAxisValue=axis->Value(i,0)+(1<<(nativeBitsPerAxis-1));
-        //int16_t nativeAxisValue=testValue[i];
-        uint16_t scaledAxisValue;
-        if (bitsPerAxis>nativeBitsPerAxis) {
-            scaledAxisValue=shiftedNativeAxisValue<<(bitsPerAxis-nativeBitsPerAxis);
-        } else {
-            scaledAxisValue=shiftedNativeAxisValue>>(nativeBitsPerAxis-bitsPerAxis);
-        }
-        //Thread::Info("Debug: shiftedNativeAxisValue=%#x, scaled axis value=%#x\n",shiftedNativeAxisValue,scaledAxisValue);
-        unsigned int offsetInBits=i*bitsPerAxis;
-        writeBits(scaledAxisValue,bitsPerAxis,dataFrameBuffer,offsetInBits);
-    }
-    //Thread::Info("Buffer après: %x %x %x\n", dataFrameBuffer[0], dataFrameBuffer[1], dataFrameBuffer[2]);
-
-    int currentButton=0;
-    uint8_t buttonArray[buttonNumber/8];
-    for (unsigned int i=0;i<buttonNumber/8;i++) {
-        buttonArray[i]=0;
-        for(unsigned int j=0;j<8;j++) {
-            bool buttonValue=button->Value(currentButton,0);
-            if(buttonValue) buttonArray[i]+=1<<j;
-            currentButton++;
-        }
-
-        dataSocket->HostToNetwork((char *)&buttonArray[i],sizeof(uint8_t));
-        memcpy(dataFrameBuffer+buttonOffset+i*sizeof(uint8_t),&buttonArray[i],sizeof(uint8_t));
-    }
-}
-
-HostEthController::DataSender::DataSender(Object *parent,HostEthController* _hostEthController,string name,uint8_t priority):Thread(parent,name,priority),hostEthController(_hostEthController) {
-
-}
+  // int16_t testValue[4]={-120,-43,27,98}; //0x 88 d5 1b 62
+  for (unsigned int i = 0; i < axisNumber; i++) {
+    // We shift value to always be positive (so that division/multiplication by
+    // power of 2 can easily be done with bit shifts)
+    uint16_t shiftedNativeAxisValue =
+        axis->Value(i, 0) + (1 << (nativeBitsPerAxis - 1));
+    // int16_t nativeAxisValue=testValue[i];
+    uint16_t scaledAxisValue;
+    if (bitsPerAxis > nativeBitsPerAxis) {
+      scaledAxisValue = shiftedNativeAxisValue
+                        << (bitsPerAxis - nativeBitsPerAxis);
+    } else {
+      scaledAxisValue =
+          shiftedNativeAxisValue >> (nativeBitsPerAxis - bitsPerAxis);
+    }
+    // Thread::Info("Debug: shiftedNativeAxisValue=%#x, scaled axis
+    // value=%#x\n",shiftedNativeAxisValue,scaledAxisValue);
+    unsigned int offsetInBits = i * bitsPerAxis;
+    writeBits(scaledAxisValue, bitsPerAxis, dataFrameBuffer, offsetInBits);
+  }
+  // Thread::Info("Buffer après: %x %x %x\n", dataFrameBuffer[0],
+  // dataFrameBuffer[1], dataFrameBuffer[2]);
+
+  int currentButton = 0;
+  uint8_t buttonArray[buttonNumber / 8];
+  for (unsigned int i = 0; i < buttonNumber / 8; i++) {
+    buttonArray[i] = 0;
+    for (unsigned int j = 0; j < 8; j++) {
+      bool buttonValue = button->Value(currentButton, 0);
+      if (buttonValue)
+        buttonArray[i] += 1 << j;
+      currentButton++;
+    }
+
+    dataSocket->HostToNetwork((char *)&buttonArray[i], sizeof(uint8_t));
+    memcpy(dataFrameBuffer + buttonOffset + i * sizeof(uint8_t),
+           &buttonArray[i], sizeof(uint8_t));
+  }
+}
+
+HostEthController::DataSender::DataSender(Object *parent,
+                                          HostEthController *_hostEthController,
+                                          string name, uint8_t priority)
+    : Thread(parent, name, priority), hostEthController(_hostEthController) {}
 
 void HostEthController::DataSender::Run() {
-    if(getFrameworkManager()->ErrorOccured()==true) {
-        SafeStop();
-    }
-
-    while(!ToBeStopped()) {
-        WaitPeriod();
-        if (hostEthController->meaningfulDataAvailable && hostEthController->ConnectedWithTarget()) {
-            //send the data
-            hostEthController->BuildDataFrame();
-            hostEthController->dataSocket->SendMessage(hostEthController->dataFrameBuffer,hostEthController->dataFrameSize);
-        }
-    }
+  if (getFrameworkManager()->ErrorOccured() == true) {
+    SafeStop();
+  }
+
+  while (!ToBeStopped()) {
+    WaitPeriod();
+    if (hostEthController->meaningfulDataAvailable &&
+        hostEthController->ConnectedWithTarget()) {
+      // send the data
+      hostEthController->BuildDataFrame();
+      hostEthController->dataSocket->SendMessage(
+          hostEthController->dataFrameBuffer, hostEthController->dataFrameSize);
+    }
+  }
 }
 
Index: trunk/lib/FlairSensorActuator/src/HostEthController.h
===================================================================
--- trunk/lib/FlairSensorActuator/src/HostEthController.h	(revision 14)
+++ trunk/lib/FlairSensorActuator/src/HostEthController.h	(revision 15)
@@ -11,5 +11,6 @@
 //  version:    $Id: $
 //
-//  purpose:    Base class for host side remote controls that talks to target side through ethernet connection
+//  purpose:    Base class for host side remote controls that talks to target
+//  side through ethernet connection
 //
 //
@@ -24,85 +25,97 @@
 
 namespace flair {
-    namespace core {
-        class FrameworkManager;
-        class cvmatrix;
-        class TcpSocket;
-        class Socket;
-        class Mutex;
-    }
-    namespace gui {
-        class Tab;
-        class TabWidget;
-        class DataPlot1D;
-    }
+namespace core {
+class FrameworkManager;
+class cvmatrix;
+class TcpSocket;
+class Socket;
+class Mutex;
+}
+namespace gui {
+class Tab;
+class TabWidget;
+class DataPlot1D;
+}
 }
 
-namespace flair { namespace sensor {
-    enum class ControllerAction;
+namespace flair {
+namespace sensor {
+enum class ControllerAction;
 
-    /*! \class HostEthController
-    *
-    * \brief Base Class for host side remote controls that talks to target side through ethernet connection
-    *
-    * There are 2 communication channels:
-    *   - 1 connection with the ground station to display the values. Output for analog sticks is normalized in the range [-1, 1] (float values)
-    *   - 1 connection with the target to send the controller values (and receive controller state modification requests)
-    */
-    class HostEthController : public core::Thread, public core::IODevice {
-    public:
-        HostEthController(const core::FrameworkManager* parent,std::string name,std::string address,int port,uint32_t period=10,uint32_t _bitsPerAxis=7,uint8_t priority=0);
-        ~HostEthController();
-        void DrawUserInterface();
-    protected:
-        std::string controllerName;
-        core::TcpSocket *controlSocket; //connection to the target
-        core::Socket *dataSocket;
-        std::string targetAddress;
-        int targetPort;
-        gui::Tab *tab;
-        gui::TabWidget *tabWidget;
-        virtual bool IsDataFrameReady() { return true;};
-        virtual void CompleteDataFrameGrab() {};
-//        int8_t *datas;
-//        uint8_t dataSize;
-        char *dataFrameBuffer;
-        size_t dataFrameSize;
-        virtual void ProcessMessage(core::Message *controllerAction) {};
+/*! \class HostEthController
+*
+* \brief Base Class for host side remote controls that talks to target side
+*through ethernet connection
+*
+* There are 2 communication channels:
+*   - 1 connection with the ground station to display the values. Output for
+*analog sticks is normalized in the range [-1, 1] (float values)
+*   - 1 connection with the target to send the controller values (and receive
+*controller state modification requests)
+*/
+class HostEthController : public core::Thread, public core::IODevice {
+public:
+  HostEthController(const core::FrameworkManager *parent, std::string name,
+                    std::string address, int port, uint32_t period = 10,
+                    uint32_t _bitsPerAxis = 7, uint8_t priority = 0);
+  ~HostEthController();
+  void DrawUserInterface();
 
-        virtual std::string GetAxisDescription(unsigned int axis);
-        virtual void GetAxisData()=0; //responsible for getting the axis data from the hardware
-        unsigned int axisNumber;
-        core::cvmatrix* axis;
-        gui::DataPlot1D **axisPlot;
-        uint32_t bitsPerAxis;
-        uint32_t nativeBitsPerAxis;
+protected:
+  std::string controllerName;
+  core::TcpSocket *controlSocket; // connection to the target
+  core::Socket *dataSocket;
+  std::string targetAddress;
+  int targetPort;
+  gui::Tab *tab;
+  gui::TabWidget *tabWidget;
+  virtual bool IsDataFrameReady() { return true; };
+  virtual void CompleteDataFrameGrab(){};
+  //        int8_t *datas;
+  //        uint8_t dataSize;
+  char *dataFrameBuffer;
+  size_t dataFrameSize;
+  virtual void ProcessMessage(core::Message *controllerAction){};
 
-        virtual std::string GetButtonDescription(unsigned int button);
-        virtual void GetButtonData()=0; //responsible for getting the button data from the hardware
-        unsigned int buttonNumber;
-        core::cvmatrix* button;
-        uint8_t buttonOffset;
-        bool meaningfulDataAvailable;
+  virtual std::string GetAxisDescription(unsigned int axis);
+  virtual void
+  GetAxisData() = 0; // responsible for getting the axis data from the hardware
+  unsigned int axisNumber;
+  core::cvmatrix *axis;
+  gui::DataPlot1D **axisPlot;
+  uint32_t bitsPerAxis;
+  uint32_t nativeBitsPerAxis;
 
-    private:
-        class DataSender : public core::Thread {
-        public:
-            DataSender(Object* parent,HostEthController* hostEthController,std::string name,uint8_t priority=0);
-            void Run();
-        private:
-            HostEthController* hostEthController;
-        };
-        DataSender *dataSender;
+  virtual std::string GetButtonDescription(unsigned int button);
+  virtual void GetButtonData() = 0; // responsible for getting the button data
+                                    // from the hardware
+  unsigned int buttonNumber;
+  core::cvmatrix *button;
+  uint8_t buttonOffset;
+  bool meaningfulDataAvailable;
 
-        bool ControllerInitialization();
-        bool ConnectedWithTarget();
-        void SendControllerInfo();
-        void Run();
-        void BuildDataFrame();
-        bool writeBits(uint16_t value,uint8_t valueSizeInBits,char *buffer,uint8_t offsetInBits);
-        core::Mutex *connectionEstablishedMutex;
-    };
+private:
+  class DataSender : public core::Thread {
+  public:
+    DataSender(Object *parent, HostEthController *hostEthController,
+               std::string name, uint8_t priority = 0);
+    void Run();
 
-}}
+  private:
+    HostEthController *hostEthController;
+  };
+  DataSender *dataSender;
+
+  bool ControllerInitialization();
+  bool ConnectedWithTarget();
+  void SendControllerInfo();
+  void Run();
+  void BuildDataFrame();
+  bool writeBits(uint16_t value, uint8_t valueSizeInBits, char *buffer,
+                 uint8_t offsetInBits);
+  core::Mutex *connectionEstablishedMutex;
+};
+}
+}
 
 #endif // HOSTETHCONTROLLER_H
Index: trunk/lib/FlairSensorActuator/src/Imu.cpp
===================================================================
--- trunk/lib/FlairSensorActuator/src/Imu.cpp	(revision 14)
+++ trunk/lib/FlairSensorActuator/src/Imu.cpp	(revision 15)
@@ -30,104 +30,100 @@
 using namespace flair::gui;
 
-namespace flair { namespace sensor {
+namespace flair {
+namespace sensor {
 
-Imu::Imu(const FrameworkManager* parent,string name) : IODevice(parent,name) {
-    imuData=new ImuData(this);
+Imu::Imu(const FrameworkManager *parent, string name) : IODevice(parent, name) {
+  imuData = new ImuData(this);
 
-    //station sol
-    mainTab=new Tab(parent->GetTabWidget(),name);
-    tab=new TabWidget(mainTab->NewRow(),name);
-    sensorTab=new Tab(tab,"Reglages");
-	setupGroupbox=new GroupBox(sensorTab->NewRow(),name);
-	rotation=new OneAxisRotation(sensorTab->NewRow(),"post rotation");
+  // station sol
+  mainTab = new Tab(parent->GetTabWidget(), name);
+  tab = new TabWidget(mainTab->NewRow(), name);
+  sensorTab = new Tab(tab, "Reglages");
+  setupGroupbox = new GroupBox(sensorTab->NewRow(), name);
+  rotation = new OneAxisRotation(sensorTab->NewRow(), "post rotation");
 }
 
-Imu::Imu(const IODevice* parent,std::string name) : IODevice(parent,name) {
-    imuData=new ImuData(this);
-    mainTab=NULL;
-    tab=NULL;
-    sensorTab=NULL;
-	setupGroupbox=NULL;
-	rotation=NULL;
+Imu::Imu(const IODevice *parent, std::string name) : IODevice(parent, name) {
+  imuData = new ImuData(this);
+  mainTab = NULL;
+  tab = NULL;
+  sensorTab = NULL;
+  setupGroupbox = NULL;
+  rotation = NULL;
 }
 
 Imu::~Imu() {
-    if(mainTab!=NULL) delete mainTab;
+  if (mainTab != NULL)
+    delete mainTab;
 }
 
-void Imu::GetDatas(ImuData **outImuData) const {
-    *outImuData=imuData;
-}
+void Imu::GetDatas(ImuData **outImuData) const { *outImuData = imuData; }
 void Imu::UpdateImu() {
-    if(rotation==NULL) {
-        Err("not applicable for simulation part.\n");
-        return;
-    }
-    Vector3D rawAcc,rawMag,rawGyr;
-    imuData->GetRawAccMagAndGyr(rawAcc,rawMag,rawGyr);
-    rotation->ComputeRotation(rawAcc);
-    rotation->ComputeRotation(rawGyr);
-    rotation->ComputeRotation(rawMag);
-    imuData->SetRawAccMagAndGyr(rawAcc,rawMag,rawGyr);
+  if (rotation == NULL) {
+    Err("not applicable for simulation part.\n");
+    return;
+  }
+  Vector3D rawAcc, rawMag, rawGyr;
+  imuData->GetRawAccMagAndGyr(rawAcc, rawMag, rawGyr);
+  rotation->ComputeRotation(rawAcc);
+  rotation->ComputeRotation(rawGyr);
+  rotation->ComputeRotation(rawMag);
+  imuData->SetRawAccMagAndGyr(rawAcc, rawMag, rawGyr);
 }
 
-GroupBox* Imu::GetGroupBox(void) const {
-    return setupGroupbox;
-}
+GroupBox *Imu::GetGroupBox(void) const { return setupGroupbox; }
 
-Layout* Imu::GetLayout(void) const {
-    return sensorTab;
-}
+Layout *Imu::GetLayout(void) const { return sensorTab; }
 
 void Imu::LockUserInterface(void) const {
-    if(sensorTab==NULL) {
-        Err("not applicable for simulation part.\n");
-        return;
-    }
-    sensorTab->setEnabled(false);
+  if (sensorTab == NULL) {
+    Err("not applicable for simulation part.\n");
+    return;
+  }
+  sensorTab->setEnabled(false);
 }
 
 void Imu::UnlockUserInterface(void) const {
-    if(sensorTab==NULL) {
-        Err("not applicable for simulation part.\n");
-        return;
-    }
-    sensorTab->setEnabled(true);
+  if (sensorTab == NULL) {
+    Err("not applicable for simulation part.\n");
+    return;
+  }
+  sensorTab->setEnabled(true);
 }
 
 void Imu::UseDefaultPlot(void) {
-    if(tab==NULL) {
-        Err("not applicable for simulation part.\n");
-        return;
-    }
+  if (tab == NULL) {
+    Err("not applicable for simulation part.\n");
+    return;
+  }
 
-    plotTab=new Tab(tab,"IMU");
-    axPlot=new DataPlot1D(plotTab->NewRow(),"acc_x",-10,10);
-    axPlot->AddCurve(imuData->Element(ImuData::RawAx));
-    ayPlot=new DataPlot1D(plotTab->LastRowLastCol(),"acc_y",-10,10);
-    ayPlot->AddCurve(imuData->Element(ImuData::RawAy));
-    azPlot=new DataPlot1D(plotTab->LastRowLastCol(),"acc_z",-10,10);
-    azPlot->AddCurve(imuData->Element(ImuData::RawAz));
+  plotTab = new Tab(tab, "IMU");
+  axPlot = new DataPlot1D(plotTab->NewRow(), "acc_x", -10, 10);
+  axPlot->AddCurve(imuData->Element(ImuData::RawAx));
+  ayPlot = new DataPlot1D(plotTab->LastRowLastCol(), "acc_y", -10, 10);
+  ayPlot->AddCurve(imuData->Element(ImuData::RawAy));
+  azPlot = new DataPlot1D(plotTab->LastRowLastCol(), "acc_z", -10, 10);
+  azPlot->AddCurve(imuData->Element(ImuData::RawAz));
 
-    if(plotTab==NULL) plotTab=new Tab(tab,"IMU");
-    gxPlot=new DataPlot1D(plotTab->NewRow(),"gyr_x",-500,500);
-    gxPlot->AddCurve(imuData->Element(ImuData::RawGxDeg));
-    gyPlot=new DataPlot1D(plotTab->LastRowLastCol(),"gyr_y",-500,500);
-    gyPlot->AddCurve(imuData->Element(ImuData::RawGyDeg));
-    gzPlot=new DataPlot1D(plotTab->LastRowLastCol(),"gyr_z",-500,500);
-    gzPlot->AddCurve(imuData->Element(ImuData::RawGzDeg));
+  if (plotTab == NULL)
+    plotTab = new Tab(tab, "IMU");
+  gxPlot = new DataPlot1D(plotTab->NewRow(), "gyr_x", -500, 500);
+  gxPlot->AddCurve(imuData->Element(ImuData::RawGxDeg));
+  gyPlot = new DataPlot1D(plotTab->LastRowLastCol(), "gyr_y", -500, 500);
+  gyPlot->AddCurve(imuData->Element(ImuData::RawGyDeg));
+  gzPlot = new DataPlot1D(plotTab->LastRowLastCol(), "gyr_z", -500, 500);
+  gzPlot->AddCurve(imuData->Element(ImuData::RawGzDeg));
 
-    if(plotTab==NULL)  plotTab=new Tab(tab,"IMU");
-    mxPlot=new DataPlot1D(plotTab->NewRow(),"mag_x",-500,500);
-    mxPlot->AddCurve(imuData->Element(ImuData::RawMx));
-    myPlot=new DataPlot1D(plotTab->LastRowLastCol(),"mag_y",-500,500);
-    myPlot->AddCurve(imuData->Element(ImuData::RawMy));
-    mzPlot=new DataPlot1D(plotTab->LastRowLastCol(),"mag_z",-500,500);
-    mzPlot->AddCurve(imuData->Element(ImuData::RawMz));
+  if (plotTab == NULL)
+    plotTab = new Tab(tab, "IMU");
+  mxPlot = new DataPlot1D(plotTab->NewRow(), "mag_x", -500, 500);
+  mxPlot->AddCurve(imuData->Element(ImuData::RawMx));
+  myPlot = new DataPlot1D(plotTab->LastRowLastCol(), "mag_y", -500, 500);
+  myPlot->AddCurve(imuData->Element(ImuData::RawMy));
+  mzPlot = new DataPlot1D(plotTab->LastRowLastCol(), "mag_z", -500, 500);
+  mzPlot->AddCurve(imuData->Element(ImuData::RawMz));
 }
 
-Tab* Imu::GetPlotTab(void) const {
-    return plotTab;
-}
+Tab *Imu::GetPlotTab(void) const { return plotTab; }
 
 } // end namespace sensor
Index: trunk/lib/FlairSensorActuator/src/Imu.h
===================================================================
--- trunk/lib/FlairSensorActuator/src/Imu.h	(revision 14)
+++ trunk/lib/FlairSensorActuator/src/Imu.h	(revision 15)
@@ -17,126 +17,127 @@
 
 namespace flair {
-    namespace core {
-        class ImuData;
-        class OneAxisRotation;
-    }
-    namespace gui {
-        class Tab;
-        class TabWidget;
-        class GroupBox;
-        class Layout;
-        class DataPlot1D;
-    }
+namespace core {
+class ImuData;
+class OneAxisRotation;
+}
+namespace gui {
+class Tab;
+class TabWidget;
+class GroupBox;
+class Layout;
+class DataPlot1D;
+}
 }
 
 class Ahrs_impl;
 
-namespace flair { namespace sensor {
-    /*! \class Imu
-    *
-    * \brief Base class for Imu
-    *
-    * Use this class to define a custom Imu.
-    *
-    */
-    class Imu : public core::IODevice {
-        friend class ::Ahrs_impl;
+namespace flair {
+namespace sensor {
+/*! \class Imu
+*
+* \brief Base class for Imu
+*
+* Use this class to define a custom Imu.
+*
+*/
+class Imu : public core::IODevice {
+  friend class ::Ahrs_impl;
 
-        public:
-            /*!
-            * \brief Constructor
-            *
-            * Construct an Imu.
-            *
-            * \param parent parent
-            * \param name name
-            */
-            Imu(const core::FrameworkManager *parent,std::string name);
+public:
+  /*!
+  * \brief Constructor
+  *
+  * Construct an Imu.
+  *
+  * \param parent parent
+  * \param name name
+  */
+  Imu(const core::FrameworkManager *parent, std::string name);
 
-            /*!
-            * \brief Constructor
-            *
-            * Construct an Imu. \n
-            * This contructor must only be called for a simulated device.
-            *
-            * \param parent parent
-            * \param name name
-            */
-            Imu(const core::IODevice *parent,std::string name);
+  /*!
+  * \brief Constructor
+  *
+  * Construct an Imu. \n
+  * This contructor must only be called for a simulated device.
+  *
+  * \param parent parent
+  * \param name name
+  */
+  Imu(const core::IODevice *parent, std::string name);
 
-            /*!
-            * \brief Destructor
-            *
-            */
-            ~Imu();
+  /*!
+  * \brief Destructor
+  *
+  */
+  ~Imu();
 
-            /*!
-            * \brief Setup Layout
-            *
-            * \return setup Layout
-            */
-            gui::Layout *GetLayout(void) const;
+  /*!
+  * \brief Setup Layout
+  *
+  * \return setup Layout
+  */
+  gui::Layout *GetLayout(void) const;
 
-            /*!
-            * \brief Lock user interface
-            *
-            */
-            void LockUserInterface(void) const;
+  /*!
+  * \brief Lock user interface
+  *
+  */
+  void LockUserInterface(void) const;
 
-            /*!
-            * \brief Unlock user interface
-            *
-            */
-            void UnlockUserInterface(void) const;
+  /*!
+  * \brief Unlock user interface
+  *
+  */
+  void UnlockUserInterface(void) const;
 
-            /*!
-            * \brief Use default plot
-            *
-            */
-            void UseDefaultPlot(void);
+  /*!
+  * \brief Use default plot
+  *
+  */
+  void UseDefaultPlot(void);
 
-            /*!
-            * \brief Plot tab
-            *
-            * \return plot Tab
-            */
-            gui::Tab *GetPlotTab(void) const;
+  /*!
+  * \brief Plot tab
+  *
+  * \return plot Tab
+  */
+  gui::Tab *GetPlotTab(void) const;
 
-        protected:
-            /*!
-            * \brief Setup GroupBox
-            *
-            * \return setup GroupBox
-            */
-            gui::GroupBox *GetGroupBox(void) const;
+protected:
+  /*!
+  * \brief Setup GroupBox
+  *
+  * \return setup GroupBox
+  */
+  gui::GroupBox *GetGroupBox(void) const;
 
-            /*!
-            * \brief UpdateImu
-            *
-            * The reimplemented class must call this function as soon as IMU datas are available. \n
-            * It handles the data rotation if it was defined.
-            *
-            */
-            void UpdateImu();
+  /*!
+  * \brief UpdateImu
+  *
+  * The reimplemented class must call this function as soon as IMU datas are
+  *available. \n
+  * It handles the data rotation if it was defined.
+  *
+  */
+  void UpdateImu();
 
-            /*!
-            * \brief Get imu datas
-            *
-            * \param imuData imu datas
-            */
-            void GetDatas(core::ImuData **imuData) const;
+  /*!
+  * \brief Get imu datas
+  *
+  * \param imuData imu datas
+  */
+  void GetDatas(core::ImuData **imuData) const;
 
+private:
+  gui::Tab *mainTab, *sensorTab, *plotTab;
+  gui::TabWidget *tab;
+  gui::GroupBox *setupGroupbox;
+  core::OneAxisRotation *rotation;
+  core::ImuData *imuData;
 
-        private:
-            gui::Tab *mainTab,*sensorTab,*plotTab;
-            gui::TabWidget* tab;
-            gui::GroupBox *setupGroupbox;
-            core::OneAxisRotation* rotation;
-            core::ImuData *imuData;
-
-            gui::DataPlot1D *axPlot,*ayPlot,*azPlot;
-            gui::DataPlot1D *gxPlot,*gyPlot,*gzPlot;
-            gui::DataPlot1D *mxPlot,*myPlot,*mzPlot;
-    };
+  gui::DataPlot1D *axPlot, *ayPlot, *azPlot;
+  gui::DataPlot1D *gxPlot, *gyPlot, *gzPlot;
+  gui::DataPlot1D *mxPlot, *myPlot, *mzPlot;
+};
 } // end namespace sensor
 } // end namespace flair
Index: trunk/lib/FlairSensorActuator/src/LaserRangeFinder.cpp
===================================================================
--- trunk/lib/FlairSensorActuator/src/LaserRangeFinder.cpp	(revision 14)
+++ trunk/lib/FlairSensorActuator/src/LaserRangeFinder.cpp	(revision 15)
@@ -32,62 +32,48 @@
 using namespace flair::gui;
 
-namespace flair { namespace sensor {
+namespace flair {
+namespace sensor {
 
-LaserRangeFinder::LaserRangeFinder(const FrameworkManager* parent,string name) : IODevice(parent,name) {
-    cvmatrix_descriptor* desc=new cvmatrix_descriptor(360,1);
-    output=new cvmatrix(this,desc,floatType);
-    AddDataToLog(output);
+LaserRangeFinder::LaserRangeFinder(const FrameworkManager *parent, string name)
+    : IODevice(parent, name) {
+  cvmatrix_descriptor *desc = new cvmatrix_descriptor(360, 1);
+  output = new cvmatrix(this, desc, floatType);
+  AddDataToLog(output);
 
-    //station sol
-    main_tab=new Tab(parent->GetTabWidget(),name);
-    tab=new TabWidget(main_tab->NewRow(),name);
-    sensor_tab=new Tab(tab,"Reglages");
-    setup_groupbox=new GroupBox(sensor_tab->NewRow(),name);
-
+  // station sol
+  main_tab = new Tab(parent->GetTabWidget(), name);
+  tab = new TabWidget(main_tab->NewRow(), name);
+  sensor_tab = new Tab(tab, "Reglages");
+  setup_groupbox = new GroupBox(sensor_tab->NewRow(), name);
 }
 
-LaserRangeFinder::LaserRangeFinder(const IODevice* parent,std::string name) : IODevice(parent,name)
-{
-    plot_tab=NULL;
-    main_tab=NULL;
-    tab=NULL;
-    sensor_tab=NULL;
-    setup_groupbox=NULL;
+LaserRangeFinder::LaserRangeFinder(const IODevice *parent, std::string name)
+    : IODevice(parent, name) {
+  plot_tab = NULL;
+  main_tab = NULL;
+  tab = NULL;
+  sensor_tab = NULL;
+  setup_groupbox = NULL;
 
-    output=NULL;
+  output = NULL;
 }
 
-LaserRangeFinder::~LaserRangeFinder()
-{
+LaserRangeFinder::~LaserRangeFinder() {}
 
-}
+GroupBox *LaserRangeFinder::GetGroupBox(void) const { return setup_groupbox; }
 
+Layout *LaserRangeFinder::GetLayout(void) const { return sensor_tab; }
 
-GroupBox* LaserRangeFinder::GetGroupBox(void) const
-{
-return setup_groupbox;
-}
+RangeFinderPlot *LaserRangeFinder::GetPlot(void) const { return plot; }
 
-Layout* LaserRangeFinder::GetLayout(void) const
-{
-return sensor_tab;
-}
+void LaserRangeFinder::UseDefaultPlot(void) {
+  if (tab == NULL) {
+    Err("not applicable for simulation part.\n");
+    return;
+  }
 
-
-RangeFinderPlot* LaserRangeFinder::GetPlot(void) const
-{
-return plot;
-}
-
-void LaserRangeFinder::UseDefaultPlot(void)
-{
-    if(tab==NULL)
-    {
-        Err("not applicable for simulation part.\n");
-        return;
-    }
-
-    plot_tab=new Tab(tab,"Mesures");
-    plot=new RangeFinderPlot(plot_tab->NewRow(),"plot","x",-30,30,"y",-30,30,output,0,359,output->Rows());
+  plot_tab = new Tab(tab, "Mesures");
+  plot = new RangeFinderPlot(plot_tab->NewRow(), "plot", "x", -30, 30, "y", -30,
+                             30, output, 0, 359, output->Rows());
 }
 } // end namespace sensor
Index: trunk/lib/FlairSensorActuator/src/LaserRangeFinder.h
===================================================================
--- trunk/lib/FlairSensorActuator/src/LaserRangeFinder.h	(revision 14)
+++ trunk/lib/FlairSensorActuator/src/LaserRangeFinder.h	(revision 15)
@@ -16,124 +16,116 @@
 #include <IODevice.h>
 
-namespace flair
-{
-    namespace core
-    {
-        class FrameworkManager;
-        class cvmatrix;
-
-    }
-    namespace gui
-    {
-        class Tab;
-        class TabWidget;
-        class GroupBox;
-        class Layout;
-        class RangeFinderPlot;
-    }
+namespace flair {
+namespace core {
+class FrameworkManager;
+class cvmatrix;
+}
+namespace gui {
+class Tab;
+class TabWidget;
+class GroupBox;
+class Layout;
+class RangeFinderPlot;
+}
 }
 
-namespace flair
-{
-namespace sensor
-{
-    /*! \class LaserRangeFinder
-    *
-    * \brief Classe generique intégrant les telemetres laser
-    */
-    class LaserRangeFinder : public core::IODevice
-    {
-        public:
-            /*!
-            * \brief Constructor
-            *
-            * Construct a Laser Range Finder.
-            *
-            * \param parent parent
-            * \param name name
-            */
-            LaserRangeFinder(const core::FrameworkManager* parent,std::string name);
-            /*!
-            * \brief Constructor
-            *
-            * Construct a UsRangeFinder. Simulation part.
-            *
-            * \param parent parent
-            * \param name name
-            */
-            LaserRangeFinder(const core::IODevice* parent,std::string name);
-            /*!
-            * \brief Destructor
-            *
-            */
-            ~LaserRangeFinder();
+namespace flair {
+namespace sensor {
+/*! \class LaserRangeFinder
+*
+* \brief Classe generique intégrant les telemetres laser
+*/
+class LaserRangeFinder : public core::IODevice {
+public:
+  /*!
+  * \brief Constructor
+  *
+  * Construct a Laser Range Finder.
+  *
+  * \param parent parent
+  * \param name name
+  */
+  LaserRangeFinder(const core::FrameworkManager *parent, std::string name);
+  /*!
+  * \brief Constructor
+  *
+  * Construct a UsRangeFinder. Simulation part.
+  *
+  * \param parent parent
+  * \param name name
+  */
+  LaserRangeFinder(const core::IODevice *parent, std::string name);
+  /*!
+  * \brief Destructor
+  *
+  */
+  ~LaserRangeFinder();
 
-            /*!
-            * \brief Use default plot
-            *
-            */
-            void UseDefaultPlot(void);
+  /*!
+  * \brief Use default plot
+  *
+  */
+  void UseDefaultPlot(void);
 
-            /*!
-            * \brief Plot
-            *
-            * \return DataPlot1D
-            */
-            gui::RangeFinderPlot* GetPlot(void) const;
+  /*!
+  * \brief Plot
+  *
+  * \return DataPlot1D
+  */
+  gui::RangeFinderPlot *GetPlot(void) const;
 
-            /*!
-            * \brief Setup Layout
-            *
-            * \return a Layout available
-            */
-            gui::Layout* GetLayout(void) const;
+  /*!
+  * \brief Setup Layout
+  *
+  * \return a Layout available
+  */
+  gui::Layout *GetLayout(void) const;
 
-            /*!
-            * \brief Plot tab
-            *
-            * \return plot Tab
-            */
-            gui::Tab* GetPlotTab(void) const;
+  /*!
+  * \brief Plot tab
+  *
+  * \return plot Tab
+  */
+  gui::Tab *GetPlotTab(void) const;
 
-            /*!
-            * \brief Value
-            *
-            * \return output value
-            */
-            float Value(void) const;
+  /*!
+  * \brief Value
+  *
+  * \return output value
+  */
+  float Value(void) const;
 
-        protected:
-        /*!
-            * \brief Output matrix
-            *
-            * \return output matrix
-            */
-            core::cvmatrix *output;
+protected:
+  /*!
+      * \brief Output matrix
+      *
+      * \return output matrix
+      */
+  core::cvmatrix *output;
 
-            /*!
-            * \brief Setup GroupBox
-            *
-            * \return a GroupBox available
-            */
-            gui::GroupBox* GetGroupBox(void) const;
+  /*!
+  * \brief Setup GroupBox
+  *
+  * \return a GroupBox available
+  */
+  gui::GroupBox *GetGroupBox(void) const;
 
-        private:
-            /*!
-            * \brief Update using provided datas
-            *
-            * Reimplemented from IODevice.
-            *
-            * \param data data from the parent to process
-            */
-            void UpdateFrom(const core::io_data *data){};
+private:
+  /*!
+  * \brief Update using provided datas
+  *
+  * Reimplemented from IODevice.
+  *
+  * \param data data from the parent to process
+  */
+  void UpdateFrom(const core::io_data *data){};
 
-            gui::Tab* main_tab;
-            gui::TabWidget *tab;
-            gui::GroupBox* setup_groupbox;
-            gui::Tab* sensor_tab;
-            gui::RangeFinderPlot* plot;
-            gui::Tab* plot_tab;
-
-    };
+  gui::Tab *main_tab;
+  gui::TabWidget *tab;
+  gui::GroupBox *setup_groupbox;
+  gui::Tab *sensor_tab;
+  gui::RangeFinderPlot *plot;
+  gui::Tab *plot_tab;
+};
 } // end namespace sensor
 } // end namespace framewor
Index: trunk/lib/FlairSensorActuator/src/Mb800.cpp
===================================================================
--- trunk/lib/FlairSensorActuator/src/Mb800.cpp	(revision 14)
+++ trunk/lib/FlairSensorActuator/src/Mb800.cpp	(revision 15)
@@ -24,104 +24,94 @@
 using namespace flair::core;
 
-namespace flair
-{
-namespace sensor
-{
+namespace flair {
+namespace sensor {
 
-Mb800::Mb800(const FrameworkManager* parent,string name,SerialPort *serialport,Gps::NMEAFlags_t NMEAFlags,uint8_t priority) : Gps(parent,name,NMEAFlags), Thread(parent,name,priority)
-{
-    this->serialport=serialport;
-    serialport->SetRxTimeout(100000000);
+Mb800::Mb800(const FrameworkManager *parent, string name,
+             SerialPort *serialport, Gps::NMEAFlags_t NMEAFlags,
+             uint8_t priority)
+    : Gps(parent, name, NMEAFlags), Thread(parent, name, priority) {
+  this->serialport = serialport;
+  serialport->SetRxTimeout(100000000);
 }
 
-Mb800::~Mb800()
-{
-    SafeStop();
-    Join();
+Mb800::~Mb800() {
+  SafeStop();
+  Join();
 }
 
-void Mb800::Run(void)
-{
-    /** Debut init **/
-    char response[200] = {0};
-    int size;
+void Mb800::Run(void) {
+  /** Debut init **/
+  char response[200] = {0};
+  int size;
 
-    /** Fin init **/
+  /** Fin init **/
 
-    /** Debut config **/
-    char to_send[]="$PASHS,NME,ALL,A,OFF\r\n";
+  /** Debut config **/
+  char to_send[] = "$PASHS,NME,ALL,A,OFF\r\n";
+  serialport->Write(to_send, sizeof(to_send));
+
+  {
+    char to_send[] = "$PASHS,CPD,AFP,95.0\r\n";
     serialport->Write(to_send, sizeof(to_send));
+  }
+  {
+    char to_send[] = "$PASHS,DIF,PRT,C,RT3\r\n";
+    serialport->Write(to_send, sizeof(to_send));
+  }
 
-    {
-        char to_send[]="$PASHS,CPD,AFP,95.0\r\n";
-        serialport->Write(to_send, sizeof(to_send));
+  if ((NMEAFlags & GGA) != 0) {
+    char to_send[] = "$PASHS,NME,GGA,A,ON,0.05\r\n";
+    size = serialport->Write(to_send, sizeof(to_send));
+    // Printf("ecrit %i\n",size);
+  }
+  if ((NMEAFlags & VTG) != 0) {
+    char to_send[] = "$PASHS,NME,VTG,A,ON,0.05\r\n";
+    size = serialport->Write(to_send, sizeof(to_send));
+    // Printf("%i\n",size);
+  }
+  if ((NMEAFlags & GST) != 0) {
+    char to_send[] = "$PASHS,NME,GST,A,ON,0.05\r\n";
+    size = serialport->Write(to_send, sizeof(to_send));
+    // Printf("%i\n",size);
+  }
+
+  Sync();
+
+  /** Fin config **/
+
+  /** Debut running loop **/
+  WarnUponSwitches(true);
+
+  while (!ToBeStopped()) {
+    SleepMS(10);
+    size = 0;
+    while (!ToBeStopped()) {
+      ssize_t read = serialport->Read(&response[size], 1);
+      if (read < 0) {
+        Thread::Err("erreur Read (%s)\n", strerror(-read));
+      }
+
+      if (response[size] == 0x0a)
+        break;
+      size++;
     }
-    {
-        char to_send[]="$PASHS,DIF,PRT,C,RT3\r\n";
-        serialport->Write(to_send, sizeof(to_send));
-    }
-
-    if((NMEAFlags&GGA)!=0)
-    {
-        char to_send[]="$PASHS,NME,GGA,A,ON,0.05\r\n";
-        size=serialport->Write(to_send, sizeof(to_send));
-        //Printf("ecrit %i\n",size);
-    }
-    if((NMEAFlags&VTG)!=0)
-    {
-        char to_send[]="$PASHS,NME,VTG,A,ON,0.05\r\n";
-        size=serialport->Write(to_send, sizeof(to_send));
-        //Printf("%i\n",size);
-    }
-    if((NMEAFlags&GST)!=0)
-    {
-        char to_send[]="$PASHS,NME,GST,A,ON,0.05\r\n";
-        size=serialport->Write(to_send, sizeof(to_send));
-        //Printf("%i\n",size);
-    }
-
-    Sync();
-
-    /** Fin config **/
-
-    /** Debut running loop **/
-    WarnUponSwitches(true);
-
-    while(!ToBeStopped())
-    {
-        SleepMS(10);
-        size=0;
-        while(!ToBeStopped())
-        {
-            ssize_t read = serialport->Read(&response[size],1);
-            if(read<0)
-            {
-                Thread::Err("erreur Read (%s)\n",strerror(-read));
-            }
-
-            if(response[size]==0x0a) break;
-            size++;
-        }
-        size++;
-        parseFrame(response, size);
-    }
-    /** fin running loop **/
-    WarnUponSwitches(false);
+    size++;
+    parseFrame(response, size);
+  }
+  /** fin running loop **/
+  WarnUponSwitches(false);
 }
 
-void Mb800::Sync(void)
-{
-    char data=0;
-    ssize_t read = 0;
+void Mb800::Sync(void) {
+  char data = 0;
+  ssize_t read = 0;
 
-    //attente fin trame
-    while(data!=0x0a)
-    {
-        read = serialport->Read(&data,1);
-        if(read<0)
-        {
-            Thread::Err("erreur Read (%s)\n",strerror(-read));
-        }
+  // attente fin trame
+  while (data != 0x0a) {
+    read = serialport->Read(&data, 1);
+    if (read < 0) {
+      Thread::Err("erreur Read (%s)\n", strerror(-read));
     }
+  }
 }
 
Index: trunk/lib/FlairSensorActuator/src/Mb800.h
===================================================================
--- trunk/lib/FlairSensorActuator/src/Mb800.h	(revision 14)
+++ trunk/lib/FlairSensorActuator/src/Mb800.h	(revision 15)
@@ -17,64 +17,61 @@
 #include <Gps.h>
 
-namespace flair
-{
-    namespace core
-    {
-        class FrameworkManager;
-        class SerialPort;
-    }
+namespace flair {
+namespace core {
+class FrameworkManager;
+class SerialPort;
+}
 }
 
-namespace flair
-{
-namespace sensor
-{
-    /*! \class Mb800
-    *
-    * \brief Class for mb800 gps receiver
-    */
-    class Mb800 : public core::Thread, public Gps
-    {
-        public:
-            /*!
-            * \brief Constructor
-            *
-            * Construct a Mb800.
-            *
-            * \param parent parent
-            * \param name name
-            * \param serialport serialport
-            * \param NMEAFlags NMEA sentances to enable
-            * \param priority priority of the Thread
-            */
-            Mb800(const core::FrameworkManager* parent,std::string name,core::SerialPort *serialport,Gps::NMEAFlags_t NMEAFlags,uint8_t priority);
+namespace flair {
+namespace sensor {
+/*! \class Mb800
+*
+* \brief Class for mb800 gps receiver
+*/
+class Mb800 : public core::Thread, public Gps {
+public:
+  /*!
+  * \brief Constructor
+  *
+  * Construct a Mb800.
+  *
+  * \param parent parent
+  * \param name name
+  * \param serialport serialport
+  * \param NMEAFlags NMEA sentances to enable
+  * \param priority priority of the Thread
+  */
+  Mb800(const core::FrameworkManager *parent, std::string name,
+        core::SerialPort *serialport, Gps::NMEAFlags_t NMEAFlags,
+        uint8_t priority);
 
-            /*!
-            * \brief Destructor
-            *
-            */
-            ~Mb800();
+  /*!
+  * \brief Destructor
+  *
+  */
+  ~Mb800();
 
-        private:
-            /*!
-            * \brief Update using provided datas
-            *
-            * Reimplemented from IODevice.
-            *
-            * \param data data from the parent to process
-            */
-            void UpdateFrom(const core::io_data *data){};
+private:
+  /*!
+  * \brief Update using provided datas
+  *
+  * Reimplemented from IODevice.
+  *
+  * \param data data from the parent to process
+  */
+  void UpdateFrom(const core::io_data *data){};
 
-            /*!
-            * \brief Run function
-            *
-            * Reimplemented from Thread.
-            *
-            */
-            void Run(void);
+  /*!
+  * \brief Run function
+  *
+  * Reimplemented from Thread.
+  *
+  */
+  void Run(void);
 
-            void Sync(void);
-            core::SerialPort *serialport;
-    };
+  void Sync(void);
+  core::SerialPort *serialport;
+};
 } // end namespace sensor
 } // end namespace framewor
Index: trunk/lib/FlairSensorActuator/src/Novatel.cpp
===================================================================
--- trunk/lib/FlairSensorActuator/src/Novatel.cpp	(revision 14)
+++ trunk/lib/FlairSensorActuator/src/Novatel.cpp	(revision 15)
@@ -24,78 +24,69 @@
 using namespace flair::core;
 
-namespace flair
-{
-namespace sensor
-{
+namespace flair {
+namespace sensor {
 
-Novatel::Novatel(const FrameworkManager* parent,string name,SerialPort *serialport,Gps::NMEAFlags_t NMEAFlags,uint8_t priority) : Gps(parent,name,NMEAFlags), Thread(parent,name,priority)
-{
-    this->serialport=serialport;
+Novatel::Novatel(const FrameworkManager *parent, string name,
+                 SerialPort *serialport, Gps::NMEAFlags_t NMEAFlags,
+                 uint8_t priority)
+    : Gps(parent, name, NMEAFlags), Thread(parent, name, priority) {
+  this->serialport = serialport;
 }
 
-Novatel::~Novatel()
-{
-    SafeStop();
-    Join();
+Novatel::~Novatel() {
+  SafeStop();
+  Join();
 }
 
-void Novatel::Run(void)
-{
-    char response[200] = {0};
-    int size;
-    ssize_t written;
+void Novatel::Run(void) {
+  char response[200] = {0};
+  int size;
+  ssize_t written;
 
-    WarnUponSwitches(true);
+  WarnUponSwitches(true);
 
-    char to_send[]="log gpggalong ontime 0.05\n";
-    written=serialport->Write(to_send, sizeof(to_send));
-    if(written<0)
-    {
-        Thread::Err("erreur write (%s)\n",strerror(-written));
+  char to_send[] = "log gpggalong ontime 0.05\n";
+  written = serialport->Write(to_send, sizeof(to_send));
+  if (written < 0) {
+    Thread::Err("erreur write (%s)\n", strerror(-written));
+  }
+  char to_send2[] = "log gpvtg ontime 0.05\n";
+  written = serialport->Write(to_send2, sizeof(to_send2));
+  if (written < 0) {
+    Thread::Err("erreur write (%s)\n", strerror(-written));
+  }
+
+  Sync();
+
+  while (!ToBeStopped()) {
+    size = 0;
+    while (1) {
+      // ssize_t read = rt_dev_read(uart_fd, &response[size],1);
+      ssize_t Read = serialport->Read(&response[size], 1);
+      if (Read < 0) {
+        Thread::Err("erreur Read (%s)\n", strerror(-Read));
+      }
+      if (response[size] == 0x0a)
+        break;
+      size++;
     }
-    char to_send2[]="log gpvtg ontime 0.05\n";
-    written=serialport->Write(to_send2, sizeof(to_send2));
-    if(written<0)
-    {
-        Thread::Err("erreur write (%s)\n",strerror(-written));
-    }
+    size++;
+    parseFrame(response, size);
+  }
 
-    Sync();
-
-    while(!ToBeStopped())
-    {
-        size=0;
-        while(1)
-        {
-            //ssize_t read = rt_dev_read(uart_fd, &response[size],1);
-            ssize_t Read = serialport->Read(&response[size],1);
-            if(Read<0)
-            {
-                Thread::Err("erreur Read (%s)\n",strerror(-Read));
-            }
-            if(response[size]==0x0a) break;
-            size++;
-        }
-        size++;
-        parseFrame(response, size);
-    }
-
-    WarnUponSwitches(false);
+  WarnUponSwitches(false);
 }
 
-void Novatel::Sync(void)
-{
-    char data=0;
-    ssize_t Read = 0;
+void Novatel::Sync(void) {
+  char data = 0;
+  ssize_t Read = 0;
 
-    //attente fin trame
-    while(data!=0x0a)
-    {
-        Read = serialport->Read(&data,1);
-        if(Read<0)
-        {
-            Thread::Err("erreur Read (%s)\n",strerror(-Read));
-        }
+  // attente fin trame
+  while (data != 0x0a) {
+    Read = serialport->Read(&data, 1);
+    if (Read < 0) {
+      Thread::Err("erreur Read (%s)\n", strerror(-Read));
     }
+  }
 }
 
Index: trunk/lib/FlairSensorActuator/src/Novatel.h
===================================================================
--- trunk/lib/FlairSensorActuator/src/Novatel.h	(revision 14)
+++ trunk/lib/FlairSensorActuator/src/Novatel.h	(revision 15)
@@ -17,64 +17,61 @@
 #include <Gps.h>
 
-namespace flair
-{
-    namespace core
-    {
-        class FrameworkManager;
-        class SerialPort;
-    }
+namespace flair {
+namespace core {
+class FrameworkManager;
+class SerialPort;
+}
 }
 
-namespace flair
-{
-namespace sensor
-{
-    /*! \class Novatel
-    *
-    * \brief Class for Novatel gps receiver
-    */
-    class Novatel : public core::Thread, public Gps
-    {
-        public:
-            /*!
-            * \brief Constructor
-            *
-            * Construct a Novatel.
-            *
-            * \param parent parent
-            * \param name name
-            * \param serialport serialport
-            * \param NMEAFlags NMEA sentances to enable
-            * \param priority priority of the Thread
-            */
-            Novatel(const core::FrameworkManager* parent,std::string name,core::SerialPort *serialport,Gps::NMEAFlags_t NMEAFlags,uint8_t priority);
+namespace flair {
+namespace sensor {
+/*! \class Novatel
+*
+* \brief Class for Novatel gps receiver
+*/
+class Novatel : public core::Thread, public Gps {
+public:
+  /*!
+  * \brief Constructor
+  *
+  * Construct a Novatel.
+  *
+  * \param parent parent
+  * \param name name
+  * \param serialport serialport
+  * \param NMEAFlags NMEA sentances to enable
+  * \param priority priority of the Thread
+  */
+  Novatel(const core::FrameworkManager *parent, std::string name,
+          core::SerialPort *serialport, Gps::NMEAFlags_t NMEAFlags,
+          uint8_t priority);
 
-            /*!
-            * \brief Destructor
-            *
-            */
-            ~Novatel();
+  /*!
+  * \brief Destructor
+  *
+  */
+  ~Novatel();
 
-        private:
-            /*!
-            * \brief Update using provided datas
-            *
-            * Reimplemented from IODevice.
-            *
-            * \param data data from the parent to process
-            */
-            void UpdateFrom(const core::io_data *data){};
+private:
+  /*!
+  * \brief Update using provided datas
+  *
+  * Reimplemented from IODevice.
+  *
+  * \param data data from the parent to process
+  */
+  void UpdateFrom(const core::io_data *data){};
 
-            /*!
-            * \brief Run function
-            *
-            * Reimplemented from Thread.
-            *
-            */
-            void Run(void);
+  /*!
+  * \brief Run function
+  *
+  * Reimplemented from Thread.
+  *
+  */
+  void Run(void);
 
-            core::SerialPort *serialport;
-            void Sync(void);
-    };
+  core::SerialPort *serialport;
+  void Sync(void);
+};
 } // end namespace sensor
 } // end namespace framewor
Index: trunk/lib/FlairSensorActuator/src/Ps3Eye.cpp
===================================================================
--- trunk/lib/FlairSensorActuator/src/Ps3Eye.cpp	(revision 14)
+++ trunk/lib/FlairSensorActuator/src/Ps3Eye.cpp	(revision 15)
@@ -29,16 +29,13 @@
 using namespace flair::gui;
 
-namespace flair
-{
-namespace sensor
-{
+namespace flair {
+namespace sensor {
 
-Ps3Eye::Ps3Eye(const FrameworkManager* parent,string name,int camera_index,uint8_t priority)
-    : V4LCamera(parent,name,camera_index,320,240,cvimage::Type::Format::YUYV,priority) {
+Ps3Eye::Ps3Eye(const FrameworkManager *parent, string name, int camera_index,
+               uint8_t priority)
+    : V4LCamera(parent, name, camera_index, 320, 240,
+                cvimage::Type::Format::YUYV, priority) {}
 
-}
-
-Ps3Eye::~Ps3Eye() {
-}
+Ps3Eye::~Ps3Eye() {}
 
 } // end namespace sensor
Index: trunk/lib/FlairSensorActuator/src/Ps3Eye.h
===================================================================
--- trunk/lib/FlairSensorActuator/src/Ps3Eye.h	(revision 14)
+++ trunk/lib/FlairSensorActuator/src/Ps3Eye.h	(revision 15)
@@ -16,51 +16,46 @@
 #include "V4LCamera.h"
 
-namespace flair
-{
-    namespace core
-    {
-        class cvimage;
-        class FrameworkManager;
-    }
-    namespace gui
-    {
-        class GridLayout;
-        class DoubleSpinBox;
-        class CheckBox;
-    }
+namespace flair {
+namespace core {
+class cvimage;
+class FrameworkManager;
+}
+namespace gui {
+class GridLayout;
+class DoubleSpinBox;
+class CheckBox;
+}
 }
 
-namespace flair
-{
-namespace sensor
-{
-    /*! \class Ps3Eye
-    *
-    * \brief Class for Ps3Eye camera
-    */
-    class Ps3Eye : public V4LCamera
-    {
+namespace flair {
+namespace sensor {
+/*! \class Ps3Eye
+*
+* \brief Class for Ps3Eye camera
+*/
+class Ps3Eye : public V4LCamera {
 
-        public:
-            /*!
-            * \brief Constructor
-            *
-            * Construct a Ps3Eye.
-            *
-            * \param parent parent
-            * \param name name
-            * \param camera_index index of the camera, ie /dev/videox
-            * \param priority priority of the Thread
-            */
-            Ps3Eye(const core::FrameworkManager* parent,std::string name,int camera_index,uint8_t priority);
+public:
+  /*!
+  * \brief Constructor
+  *
+  * Construct a Ps3Eye.
+  *
+  * \param parent parent
+  * \param name name
+  * \param camera_index index of the camera, ie /dev/videox
+  * \param priority priority of the Thread
+  */
+  Ps3Eye(const core::FrameworkManager *parent, std::string name,
+         int camera_index, uint8_t priority);
 
-            /*!
-            * \brief Destructor
-            *
-            */
-            ~Ps3Eye();
+  /*!
+  * \brief Destructor
+  *
+  */
+  ~Ps3Eye();
 
-        private:
-    };
+private:
+};
 } // end namespace sensor
 } // end namespace flair
Index: trunk/lib/FlairSensorActuator/src/RadioReceiver.cpp
===================================================================
--- trunk/lib/FlairSensorActuator/src/RadioReceiver.cpp	(revision 14)
+++ trunk/lib/FlairSensorActuator/src/RadioReceiver.cpp	(revision 15)
@@ -28,59 +28,44 @@
 using namespace flair::gui;
 
-namespace flair
-{
-namespace sensor
-{
+namespace flair {
+namespace sensor {
 
-RadioReceiver::RadioReceiver(const FrameworkManager* parent,string name,unsigned int nb_channels) : IODevice(parent,name)
-{
-    is_connected=false;
-    this->nb_channels=nb_channels;
+RadioReceiver::RadioReceiver(const FrameworkManager *parent, string name,
+                             unsigned int nb_channels)
+    : IODevice(parent, name) {
+  is_connected = false;
+  this->nb_channels = nb_channels;
 
-    //init matrix
-    cvmatrix_descriptor* desc=new cvmatrix_descriptor(nb_channels,1);
-    for(int i=0;i<nb_channels;i++)
-    {
-        ostringstream channel_name;
-        channel_name << "channel " << i;
-        desc->SetElementName(i,0,channel_name.str());
-    }
-    output=new cvmatrix(this,desc,floatType,name);
+  // init matrix
+  cvmatrix_descriptor *desc = new cvmatrix_descriptor(nb_channels, 1);
+  for (int i = 0; i < nb_channels; i++) {
+    ostringstream channel_name;
+    channel_name << "channel " << i;
+    desc->SetElementName(i, 0, channel_name.str());
+  }
+  output = new cvmatrix(this, desc, floatType, name);
 
-     //station sol
-    main_tab=new Tab(parent->GetTabWidget(),name);
-    tab=new TabWidget(main_tab->NewRow(),name);
-    setup_tab=new Tab(tab,"Setup");
+  // station sol
+  main_tab = new Tab(parent->GetTabWidget(), name);
+  tab = new TabWidget(main_tab->NewRow(), name);
+  setup_tab = new Tab(tab, "Setup");
 
-    AddDataToLog(output);
+  AddDataToLog(output);
 }
 
-RadioReceiver::~RadioReceiver()
-{
-    delete main_tab;
+RadioReceiver::~RadioReceiver() { delete main_tab; }
+
+Layout *RadioReceiver::GetLayout(void) const { return setup_tab; }
+
+float RadioReceiver::ChannelValue(unsigned int id) const {
+  if (id < nb_channels) {
+    return output->Value(id, 0);
+  } else {
+    Err("channel %i/%i is out of bound\n", id, nb_channels);
+    return -1;
+  }
 }
 
-Layout* RadioReceiver::GetLayout(void) const
-{
-    return setup_tab;
-}
-
-float RadioReceiver::ChannelValue(unsigned int id) const
-{
-    if(id<nb_channels)
-    {
-        return output->Value(id,0);
-    }
-    else
-    {
-        Err("channel %i/%i is out of bound\n",id,nb_channels);
-        return -1;
-    }
-}
-
-bool RadioReceiver::IsConnected(void) const
-{
-    return is_connected;
-}
+bool RadioReceiver::IsConnected(void) const { return is_connected; }
 
 } // end namespace sensor
Index: trunk/lib/FlairSensorActuator/src/RadioReceiver.h
===================================================================
--- trunk/lib/FlairSensorActuator/src/RadioReceiver.h	(revision 14)
+++ trunk/lib/FlairSensorActuator/src/RadioReceiver.h	(revision 15)
@@ -17,87 +17,82 @@
 #include <stdint.h>
 
-namespace flair
-{
-    namespace core
-    {
-        class FrameworkManager;
-        class cvmatrix;
-    }
-    namespace gui
-    {
-        class Tab;
-        class TabWidget;
-        class Layout;
-    }
+namespace flair {
+namespace core {
+class FrameworkManager;
+class cvmatrix;
+}
+namespace gui {
+class Tab;
+class TabWidget;
+class Layout;
+}
 }
 
-namespace flair
-{
-namespace sensor
-{
-    /*! \class RadioReceiver
-    *
-    * \brief Base class for radio receiver
-    */
-    class RadioReceiver : public core::IODevice
-    {
-        public:
-            /*!
-            * \brief Constructor
-            *
-            * Construct a RadioReceiver.
-            *
-            * \param parent parent
-            * \param name name
-            * \param nb_channels number of supported channels
-            */
-            RadioReceiver(const core::FrameworkManager* parent,std::string name,unsigned int nb_channels);
+namespace flair {
+namespace sensor {
+/*! \class RadioReceiver
+*
+* \brief Base class for radio receiver
+*/
+class RadioReceiver : public core::IODevice {
+public:
+  /*!
+  * \brief Constructor
+  *
+  * Construct a RadioReceiver.
+  *
+  * \param parent parent
+  * \param name name
+  * \param nb_channels number of supported channels
+  */
+  RadioReceiver(const core::FrameworkManager *parent, std::string name,
+                unsigned int nb_channels);
 
-            /*!
-            * \brief Destructor
-            *
-            */
-            ~RadioReceiver();
+  /*!
+  * \brief Destructor
+  *
+  */
+  ~RadioReceiver();
 
-            /*!
-            * \brief get channel value
-            *
-            * \param id channel id
-            * \return value of the channel, between 0 and 1.
-            *  Returns -1 if channel is out of bound
-            */
-            float ChannelValue(unsigned int id) const;
+  /*!
+  * \brief get channel value
+  *
+  * \param id channel id
+  * \return value of the channel, between 0 and 1.
+  *  Returns -1 if channel is out of bound
+  */
+  float ChannelValue(unsigned int id) const;
 
-            /*!
-            * \brief Is transmitter connected?
-            *
-            * \return true if transmitter is connected
-            */
-            bool IsConnected(void) const;
+  /*!
+  * \brief Is transmitter connected?
+  *
+  * \return true if transmitter is connected
+  */
+  bool IsConnected(void) const;
 
-            /*!
-            * \brief Setup Layout
-            *
-            * \return a Layout available
-            */
-            gui::Layout* GetLayout(void) const;
+  /*!
+  * \brief Setup Layout
+  *
+  * \return a Layout available
+  */
+  gui::Layout *GetLayout(void) const;
 
-        private:
-            /*!
-            * \brief Update using provided datas
-            *
-            * Reimplemented from IODevice.
-            *
-            * \param data data from the parent to process
-            */
-            void UpdateFrom(const core::io_data *data){};
+private:
+  /*!
+  * \brief Update using provided datas
+  *
+  * Reimplemented from IODevice.
+  *
+  * \param data data from the parent to process
+  */
+  void UpdateFrom(const core::io_data *data){};
 
-            core::cvmatrix *output;
-            bool is_connected;
-            unsigned int nb_channels;
-            gui::Tab* main_tab;
-            gui::TabWidget* tab;
-            gui::Tab* setup_tab;
-    };
+  core::cvmatrix *output;
+  bool is_connected;
+  unsigned int nb_channels;
+  gui::Tab *main_tab;
+  gui::TabWidget *tab;
+  gui::Tab *setup_tab;
+};
 } // end namespace sensor
 } // end namespace flair
Index: trunk/lib/FlairSensorActuator/src/SimuBldc.cpp
===================================================================
--- trunk/lib/FlairSensorActuator/src/SimuBldc.cpp	(revision 14)
+++ trunk/lib/FlairSensorActuator/src/SimuBldc.cpp	(revision 15)
@@ -29,52 +29,58 @@
 using namespace flair::gui;
 
-namespace flair
-{
-namespace actuator
-{
+namespace flair {
+namespace actuator {
 
-SimuBldc::SimuBldc(const IODevice* parent,Layout* layout,string name,uint8_t motors_count,uint32_t dev_id) :Bldc(parent,layout,name,motors_count)
-{
-    ostringstream dev_name;
-    dev_name << "simu_bldc_" << dev_id;
-    shmem=new SharedMem(this,dev_name.str().c_str(),motors_count*sizeof(float));
+SimuBldc::SimuBldc(const IODevice *parent, Layout *layout, string name,
+                   uint8_t motors_count, uint32_t dev_id)
+    : Bldc(parent, layout, name, motors_count) {
+  ostringstream dev_name;
+  dev_name << "simu_bldc_" << dev_id;
+  shmem =
+      new SharedMem(this, dev_name.str().c_str(), motors_count * sizeof(float));
 
-    GroupBox *groupbox=new GroupBox(layout->NewRow(),"simubldc");
-    k=new DoubleSpinBox(groupbox->NewRow(),"k driver:",0,10000,1);
+  GroupBox *groupbox = new GroupBox(layout->NewRow(), "simubldc");
+  k = new DoubleSpinBox(groupbox->NewRow(), "k driver:", 0, 10000, 1);
 }
 
-SimuBldc::SimuBldc(const Object* parent,string name,uint8_t motors_count,uint32_t dev_id) :Bldc(parent,name,motors_count) {
-    ostringstream dev_name;
-    dev_name << "simu_bldc_" << dev_id;
-    shmem=new SharedMem(this,dev_name.str().c_str(),motors_count*sizeof(float));
+SimuBldc::SimuBldc(const Object *parent, string name, uint8_t motors_count,
+                   uint32_t dev_id)
+    : Bldc(parent, name, motors_count) {
+  ostringstream dev_name;
+  dev_name << "simu_bldc_" << dev_id;
+  shmem =
+      new SharedMem(this, dev_name.str().c_str(), motors_count * sizeof(float));
 
-    //reset values
-    float values[motors_count];
-    for(int i=0;i<motors_count;i++) values[i]=0;
+  // reset values
+  float values[motors_count];
+  for (int i = 0; i < motors_count; i++)
+    values[i] = 0;
 
-    shmem->Write((char*)&values,motors_count*sizeof(float));
+  shmem->Write((char *)&values, motors_count * sizeof(float));
 }
 
-SimuBldc::~SimuBldc() {
+SimuBldc::~SimuBldc() {}
+
+void SimuBldc::SetMotors(float *value) {
+  float values[MotorsCount()];
+
+  for (int i = 0; i < MotorsCount(); i++)
+    values[i] = k->Value() * value[i];
+
+  shmem->Write((char *)&values, MotorsCount() * sizeof(float));
+
+  // on prend une fois pour toute le mutex et on fait des accès directs
+  output->GetMutex();
+  for (int i = 0; i < MotorsCount(); i++)
+    output->SetValueNoMutex(i, 0, values[i]);
+  output->ReleaseMutex();
 }
 
-void SimuBldc::SetMotors(float* value) {
-    float values[MotorsCount()];
+void SimuBldc::GetSpeeds(float *value) const {
+  float values[MotorsCount()];
+  shmem->Read((char *)&values, MotorsCount() * sizeof(float));
 
-    for(int i=0;i<MotorsCount();i++) values[i]=k->Value()*value[i];
-
-    shmem->Write((char*)&values,MotorsCount()*sizeof(float));
-
-    //on prend une fois pour toute le mutex et on fait des accès directs
-    output->GetMutex();
-    for(int i=0;i<MotorsCount();i++) output->SetValueNoMutex(i,0,values[i]);
-    output->ReleaseMutex();
-}
-
-void SimuBldc::GetSpeeds(float* value) const {
-    float values[MotorsCount()];
-    shmem->Read((char*)&values,MotorsCount()*sizeof(float));
-
-    for(int i=0;i<MotorsCount();i++) value[i]=values[i];
+  for (int i = 0; i < MotorsCount(); i++)
+    value[i] = values[i];
 }
 
Index: trunk/lib/FlairSensorActuator/src/SimuBldc.h
===================================================================
--- trunk/lib/FlairSensorActuator/src/SimuBldc.h	(revision 14)
+++ trunk/lib/FlairSensorActuator/src/SimuBldc.h	(revision 15)
@@ -16,103 +16,99 @@
 #include <Bldc.h>
 
-namespace flair
-{
-    namespace core
-    {
-        class SharedMem;
-        class IODevice;
-        class cvmatrix;
-    }
-    namespace gui
-    {
-        class DoubleSpinBox;
-        class Layout;
-    }
+namespace flair {
+namespace core {
+class SharedMem;
+class IODevice;
+class cvmatrix;
+}
+namespace gui {
+class DoubleSpinBox;
+class Layout;
+}
 }
 
-namespace flair
-{
-namespace actuator
-{
-    /*! \class SimuBldc
-    *
-    * \brief Class for a simulation bldc
-    *
-    */
-    class SimuBldc : public Bldc
-    {
-        public:
-            /*!
-            * \brief Constructor
-            *
-            * Construct a SimuBldc. Control part.
-            *
-            * \param parent parent
-            * \param layout layout
-            * \param name name
-            * \param motors_count number of motors
-            * \param dev_id device id
-            */
-            SimuBldc(const core::IODevice* parent,gui::Layout* layout,std::string name,uint8_t motors_count,uint32_t dev_id);
+namespace flair {
+namespace actuator {
+/*! \class SimuBldc
+*
+* \brief Class for a simulation bldc
+*
+*/
+class SimuBldc : public Bldc {
+public:
+  /*!
+  * \brief Constructor
+  *
+  * Construct a SimuBldc. Control part.
+  *
+  * \param parent parent
+  * \param layout layout
+  * \param name name
+  * \param motors_count number of motors
+  * \param dev_id device id
+  */
+  SimuBldc(const core::IODevice *parent, gui::Layout *layout, std::string name,
+           uint8_t motors_count, uint32_t dev_id);
 
-            /*!
-            * \brief Constructor
-            *
-            * Construct a SimuBldc. Simulation part.
-            *
-            * \param parent parent
-            * \param name name
-            * \param motors_count number of motors
-            * \param dev_id device id
-            */
-            SimuBldc(const core::Object* parent,std::string name,uint8_t motors_count,uint32_t dev_id);
+  /*!
+  * \brief Constructor
+  *
+  * Construct a SimuBldc. Simulation part.
+  *
+  * \param parent parent
+  * \param name name
+  * \param motors_count number of motors
+  * \param dev_id device id
+  */
+  SimuBldc(const core::Object *parent, std::string name, uint8_t motors_count,
+           uint32_t dev_id);
 
-            /*!
-            * \brief Destructor
-            *
-            */
-            ~SimuBldc();
+  /*!
+  * \brief Destructor
+  *
+  */
+  ~SimuBldc();
 
-            /*!
-            * \brief Get motors speeds.
-            *
-            * This function should only be used for the simulation part.
-            *
-            * \param value array to store motors speeds
-            */
-            void GetSpeeds(float* value) const;
+  /*!
+  * \brief Get motors speeds.
+  *
+  * This function should only be used for the simulation part.
+  *
+  * \param value array to store motors speeds
+  */
+  void GetSpeeds(float *value) const;
 
-            /*!
-            * \brief Has speed measurement
-            *
-            * Reimplemented from Bldc. \n
-            *
-            * \return true if it has speed measurement
-            */
-            bool HasSpeedMeasurement(void) const{return false;};
+  /*!
+  * \brief Has speed measurement
+  *
+  * Reimplemented from Bldc. \n
+  *
+  * \return true if it has speed measurement
+  */
+  bool HasSpeedMeasurement(void) const { return false; };
 
-            /*!
-            * \brief Has current measurement
-            *
-            * Reimplemented from Bldc. \n
-            *
-            * \return true if it has current measurement
-            */
-            bool HasCurrentMeasurement(void) const{return false;};
+  /*!
+  * \brief Has current measurement
+  *
+  * Reimplemented from Bldc. \n
+  *
+  * \return true if it has current measurement
+  */
+  bool HasCurrentMeasurement(void) const { return false; };
 
-        private:
-            /*!
-            * \brief Set motors values
-            *
-            * Reimplemented from Bldc. \n
-            * Values size must be the same as MotorsCount()
-            *
-            * \param values motor values
-            */
-            void SetMotors(float* value);
+private:
+  /*!
+  * \brief Set motors values
+  *
+  * Reimplemented from Bldc. \n
+  * Values size must be the same as MotorsCount()
+  *
+  * \param values motor values
+  */
+  void SetMotors(float *value);
 
-            core::SharedMem *shmem;
-            gui::DoubleSpinBox *k;
-    };
+  core::SharedMem *shmem;
+  gui::DoubleSpinBox *k;
+};
 } // end namespace actuator
 } // end namespace flair
Index: trunk/lib/FlairSensorActuator/src/SimuCamera.cpp
===================================================================
--- trunk/lib/FlairSensorActuator/src/SimuCamera.cpp	(revision 14)
+++ trunk/lib/FlairSensorActuator/src/SimuCamera.cpp	(revision 15)
@@ -29,55 +29,66 @@
 using namespace flair::gui;
 
-namespace flair { namespace sensor {
+namespace flair {
+namespace sensor {
 
-SimuCamera::SimuCamera(const FrameworkManager* parent,string name,uint16_t width,uint16_t height,uint8_t channels,uint32_t dev_id,uint8_t priority) :Thread(parent,name,priority),Camera(parent,name,width,height,cvimage::Type::Format::BGR) {
-    data_rate=new SpinBox(GetGroupBox()->NewRow(),"data rate"," Hz",1,100,1,50);
+SimuCamera::SimuCamera(const FrameworkManager *parent, string name,
+                       uint16_t width, uint16_t height, uint8_t channels,
+                       uint32_t dev_id, uint8_t priority)
+    : Thread(parent, name, priority),
+      Camera(parent, name, width, height, cvimage::Type::Format::BGR) {
+  data_rate =
+      new SpinBox(GetGroupBox()->NewRow(), "data rate", " Hz", 1, 100, 1, 50);
 
-    buf_size=width*height*channels;
+  buf_size = width * height * channels;
 
-    img=cvCreateImage(cvSize(width,height),IPL_DEPTH_8U,3);
-    output->img->imageData=img->imageData;
+  img = cvCreateImage(cvSize(width, height), IPL_DEPTH_8U, 3);
+  output->img->imageData = img->imageData;
 
-    ostringstream dev_name;
-    dev_name << "simu_cam_" << dev_id;
-    shmem=new SharedMem((Thread*)this,dev_name.str().c_str(),buf_size);
+  ostringstream dev_name;
+  dev_name << "simu_cam_" << dev_id;
+  shmem = new SharedMem((Thread *)this, dev_name.str().c_str(), buf_size);
 }
 
-SimuCamera::SimuCamera(const IODevice* parent,string name,uint16_t width,uint16_t height,uint8_t channels,uint32_t dev_id) : Thread(parent,name,0),Camera(parent,name) {
-    data_rate=NULL;
+SimuCamera::SimuCamera(const IODevice *parent, string name, uint16_t width,
+                       uint16_t height, uint8_t channels, uint32_t dev_id)
+    : Thread(parent, name, 0), Camera(parent, name) {
+  data_rate = NULL;
 
-    ostringstream dev_name;
-    dev_name << "simu_cam_" << dev_id;
-    shmem=new SharedMem((Thread*)this,dev_name.str().c_str(),width*height*channels);
+  ostringstream dev_name;
+  dev_name << "simu_cam_" << dev_id;
+  shmem = new SharedMem((Thread *)this, dev_name.str().c_str(),
+                        width * height * channels);
 }
 
 SimuCamera::~SimuCamera() {
-    SafeStop();
-    Join();
+  SafeStop();
+  Join();
 }
 
 void SimuCamera::Run(void) {
-    if(data_rate==NULL) {
-        Thread::Err("not applicable for simulation part.\n");
-        return;
+  if (data_rate == NULL) {
+    Thread::Err("not applicable for simulation part.\n");
+    return;
+  }
+
+  SetPeriodUS((uint32_t)(1000000. / data_rate->Value()));
+
+  while (!ToBeStopped()) {
+    WaitPeriod();
+
+    if (data_rate->ValueChanged() == true) {
+      SetPeriodUS((uint32_t)(1000000. / data_rate->Value()));
     }
 
-    SetPeriodUS((uint32_t)(1000000./data_rate->Value()));
+    output->GetMutex();
+    shmem->Read((char *)img->imageData, buf_size); // remplacer copie par
+                                                   // échange de pointeur sur
+                                                   // double buffering
+    output->ReleaseMutex();
 
-    while(!ToBeStopped()) {
-        WaitPeriod();
+    output->SetDataTime(GetTime());
 
-        if(data_rate->ValueChanged()==true) {
-            SetPeriodUS((uint32_t)(1000000./data_rate->Value()));
-        }
-
-        output->GetMutex();
-        shmem->Read((char*)img->imageData,buf_size); // remplacer copie par échange de pointeur sur double buffering
-        output->ReleaseMutex();
-
-        output->SetDataTime(GetTime());
-
-        ProcessUpdate(output);
-    }
+    ProcessUpdate(output);
+  }
 }
 
Index: trunk/lib/FlairSensorActuator/src/SimuCamera.h
===================================================================
--- trunk/lib/FlairSensorActuator/src/SimuCamera.h	(revision 14)
+++ trunk/lib/FlairSensorActuator/src/SimuCamera.h	(revision 15)
@@ -18,92 +18,89 @@
 #include <cxcore.h>
 
-namespace flair
-{
-    namespace core
-    {
-        class SharedMem;
-    }
-    namespace gui
-    {
-        class SpinBox;
-    }
+namespace flair {
+namespace core {
+class SharedMem;
+}
+namespace gui {
+class SpinBox;
+}
 }
 
-namespace flair
-{
-namespace sensor
-{
-    /*! \class SimuCamera
-    *
-    * \brief Class for a simulation camera
-    */
-    class SimuCamera : public core::Thread, public Camera
-    {
-        public:
-            /*!
-            * \brief Constructor
-            *
-            * Construct a SimuCamera. Control part.
-            *
-            * \param parent parent
-            * \param name name
-            * \param width width
-            * \param height height
-            * \param channels number of channels
-            * \param dev_id device id
-            * \param priority priority of the Thread
-            */
-            SimuCamera(const core::FrameworkManager* parent,std::string name,uint16_t width,uint16_t height,uint8_t channels,uint32_t dev_id,uint8_t priority);
+namespace flair {
+namespace sensor {
+/*! \class SimuCamera
+*
+* \brief Class for a simulation camera
+*/
+class SimuCamera : public core::Thread, public Camera {
+public:
+  /*!
+  * \brief Constructor
+  *
+  * Construct a SimuCamera. Control part.
+  *
+  * \param parent parent
+  * \param name name
+  * \param width width
+  * \param height height
+  * \param channels number of channels
+  * \param dev_id device id
+  * \param priority priority of the Thread
+  */
+  SimuCamera(const core::FrameworkManager *parent, std::string name,
+             uint16_t width, uint16_t height, uint8_t channels, uint32_t dev_id,
+             uint8_t priority);
 
-            /*!
-            * \brief Constructor
-            *
-            * Construct a SimuCamera. Simulation part.\n
-            * The Thread of this class should not be run.
-            *
-            * \param parent parent
-            * \param name name
-            * \param width width
-            * \param height height
-            * \param channels number of channels
-            * \param dev_id device id
-            */
-            SimuCamera(const core::IODevice* parent,std::string name,uint16_t width,uint16_t height,uint8_t channels,uint32_t dev_id);
+  /*!
+  * \brief Constructor
+  *
+  * Construct a SimuCamera. Simulation part.\n
+  * The Thread of this class should not be run.
+  *
+  * \param parent parent
+  * \param name name
+  * \param width width
+  * \param height height
+  * \param channels number of channels
+  * \param dev_id device id
+  */
+  SimuCamera(const core::IODevice *parent, std::string name, uint16_t width,
+             uint16_t height, uint8_t channels, uint32_t dev_id);
 
-            /*!
-            * \brief Destructor
-            *
-            */
-            ~SimuCamera();
+  /*!
+  * \brief Destructor
+  *
+  */
+  ~SimuCamera();
 
-        protected:
-            /*!
-            * \brief SharedMem to access datas
-            *
-            */
-            core::SharedMem *shmem;
+protected:
+  /*!
+  * \brief SharedMem to access datas
+  *
+  */
+  core::SharedMem *shmem;
 
-        private:
-            /*!
-            * \brief Run function
-            *
-            * Reimplemented from Thread.
-            *
-            */
-            void Run(void);
+private:
+  /*!
+  * \brief Run function
+  *
+  * Reimplemented from Thread.
+  *
+  */
+  void Run(void);
 
-            /*!
-            * \brief Update using provided datas
-            *
-            * Reimplemented from IODevice.
-            *
-            * \param data data from the parent to process
-            */
-            void UpdateFrom(const core::io_data *data){};
+  /*!
+  * \brief Update using provided datas
+  *
+  * Reimplemented from IODevice.
+  *
+  * \param data data from the parent to process
+  */
+  void UpdateFrom(const core::io_data *data){};
 
-            gui::SpinBox *data_rate;
-            size_t buf_size;
-            IplImage* img;
-    };
+  gui::SpinBox *data_rate;
+  size_t buf_size;
+  IplImage *img;
+};
 } // end namespace sensor
 } // end namespace flair
Index: trunk/lib/FlairSensorActuator/src/SimuGps.cpp
===================================================================
--- trunk/lib/FlairSensorActuator/src/SimuGps.cpp	(revision 14)
+++ trunk/lib/FlairSensorActuator/src/SimuGps.cpp	(revision 15)
@@ -24,38 +24,31 @@
 using namespace flair::core;
 
-namespace flair
-{
-namespace sensor
-{
+namespace flair {
+namespace sensor {
 
-SimuGps::SimuGps(const FrameworkManager* parent,string name,Gps::NMEAFlags_t NMEAFlags,uint8_t priority) : Thread(parent,name,priority), Gps(parent,name,NMEAFlags)
-{
+SimuGps::SimuGps(const FrameworkManager *parent, string name,
+                 Gps::NMEAFlags_t NMEAFlags, uint8_t priority)
+    : Thread(parent, name, priority), Gps(parent, name, NMEAFlags) {}
+
+SimuGps::~SimuGps() {
+  SafeStop();
+  Join();
 }
 
-SimuGps::~SimuGps()
-{
-    SafeStop();
-    Join();
+void SimuGps::Run(void) {
+  char response[200] = {0};
+  int size, result;
+  // double lat=0;
+  SetPeriodMS(500);
+  WarnUponSwitches(true);
+
+  while (!ToBeStopped()) {
+    WaitPeriod();
+    position->SetCoordinates(49.402313, 2.795463, 0);
+    //      lat+=.5;
+  }
+
+  WarnUponSwitches(false);
 }
-
-void SimuGps::Run(void)
-{
-    char response[200] = {0};
-    int size,result;
-//double lat=0;
-    SetPeriodMS(500);
-    WarnUponSwitches(true);
-
-    while(!ToBeStopped())
-    {
-        WaitPeriod();
-        position->SetCoordinates(49.402313, 2.795463,0);
-  //      lat+=.5;
-    }
-
-
-    WarnUponSwitches(false);
-}
-
 
 } // end namespace sensor
Index: trunk/lib/FlairSensorActuator/src/SimuGps.h
===================================================================
--- trunk/lib/FlairSensorActuator/src/SimuGps.h	(revision 14)
+++ trunk/lib/FlairSensorActuator/src/SimuGps.h	(revision 15)
@@ -17,59 +17,55 @@
 #include <Gps.h>
 
-namespace flair
-{
-    namespace core
-    {
-        class FrameworkManager;
-    }
+namespace flair {
+namespace core {
+class FrameworkManager;
+}
 }
 
-namespace flair
-{
-namespace sensor
-{
-    /*! \class SimuGps
-    *
-    * \brief Class for a simulation GPS
-    */
-    class SimuGps : public core::Thread, public Gps
-    {
-        public:
-            /*!
-            * \brief Constructor
-            *
-            * Construct a Novatel.
-            *
-            * \param parent parent
-            * \param name name
-            * \param NMEAFlags NMEA sentances to enable
-            * \param priority priority of the Thread
-            */
-            SimuGps(const core::FrameworkManager* parent,std::string name,Gps::NMEAFlags_t NMEAFlags,uint8_t priority);
+namespace flair {
+namespace sensor {
+/*! \class SimuGps
+*
+* \brief Class for a simulation GPS
+*/
+class SimuGps : public core::Thread, public Gps {
+public:
+  /*!
+  * \brief Constructor
+  *
+  * Construct a Novatel.
+  *
+  * \param parent parent
+  * \param name name
+  * \param NMEAFlags NMEA sentances to enable
+  * \param priority priority of the Thread
+  */
+  SimuGps(const core::FrameworkManager *parent, std::string name,
+          Gps::NMEAFlags_t NMEAFlags, uint8_t priority);
 
-            /*!
-            * \brief Destructor
-            *
-            */
-            ~SimuGps();
+  /*!
+  * \brief Destructor
+  *
+  */
+  ~SimuGps();
 
-        private:
-            /*!
-            * \brief Update using provided datas
-            *
-            * Reimplemented from IODevice.
-            *
-            * \param data data from the parent to process
-            */
-            void UpdateFrom(const core::io_data *data){};
+private:
+  /*!
+  * \brief Update using provided datas
+  *
+  * Reimplemented from IODevice.
+  *
+  * \param data data from the parent to process
+  */
+  void UpdateFrom(const core::io_data *data){};
 
-            /*!
-            * \brief Run function
-            *
-            * Reimplemented from Thread.
-            *
-            */
-            void Run(void);
-    };
+  /*!
+  * \brief Run function
+  *
+  * Reimplemented from Thread.
+  *
+  */
+  void Run(void);
+};
 } // end namespace sensor
 } // end namespace framewor
Index: trunk/lib/FlairSensorActuator/src/SimuImu.cpp
===================================================================
--- trunk/lib/FlairSensorActuator/src/SimuImu.cpp	(revision 14)
+++ trunk/lib/FlairSensorActuator/src/SimuImu.cpp	(revision 15)
@@ -31,76 +31,84 @@
 using namespace flair::gui;
 
-namespace flair { namespace sensor {
+namespace flair {
+namespace sensor {
 
-SimuImu::SimuImu(const FrameworkManager* parent,string name,uint32_t dev_id,uint8_t priority) :Imu(parent,name),Thread(parent,name,priority) {
-    data_rate=new SpinBox(GetGroupBox()->NewRow(),"data rate"," Hz",1,500,1,200);
-    ahrsData=new AhrsData((Imu*)this);
+SimuImu::SimuImu(const FrameworkManager *parent, string name, uint32_t dev_id,
+                 uint8_t priority)
+    : Imu(parent, name), Thread(parent, name, priority) {
+  data_rate =
+      new SpinBox(GetGroupBox()->NewRow(), "data rate", " Hz", 1, 500, 1, 200);
+  ahrsData = new AhrsData((Imu *)this);
 
-    ostringstream dev_name;
-    dev_name << "simu_imu_" << dev_id;
-    shmem=new SharedMem((Thread*)this,dev_name.str().c_str(),sizeof(imu_states_t));
+  ostringstream dev_name;
+  dev_name << "simu_imu_" << dev_id;
+  shmem = new SharedMem((Thread *)this, dev_name.str().c_str(),
+                        sizeof(imu_states_t));
 }
 
-SimuImu::SimuImu(const IODevice* parent,string name,uint32_t dev_id) :Imu(parent,name),Thread(parent,name,0) {
-    data_rate=NULL;
+SimuImu::SimuImu(const IODevice *parent, string name, uint32_t dev_id)
+    : Imu(parent, name), Thread(parent, name, 0) {
+  data_rate = NULL;
 
-    ostringstream dev_name;
-    dev_name << "simu_imu_" << dev_id;
-    shmem=new SharedMem((Thread*)this,dev_name.str().c_str(),sizeof(imu_states_t));
+  ostringstream dev_name;
+  dev_name << "simu_imu_" << dev_id;
+  shmem = new SharedMem((Thread *)this, dev_name.str().c_str(),
+                        sizeof(imu_states_t));
 }
 
 SimuImu::~SimuImu() {
-    SafeStop();
-    Join();
+  SafeStop();
+  Join();
 }
 
 void SimuImu::UpdateFrom(const io_data *data) {
-    if(data!=NULL) {
-        cvmatrix *input=(cvmatrix*)data;
-        imu_states_t state;
+  if (data != NULL) {
+    cvmatrix *input = (cvmatrix *)data;
+    imu_states_t state;
 
-        input->GetMutex();
-        state.q0=input->ValueNoMutex(0,0);
-        state.q1=input->ValueNoMutex(1,0);
-        state.q2=input->ValueNoMutex(2,0);
-        state.q3=input->ValueNoMutex(3,0);
-        state.wx=input->ValueNoMutex(7,0);
-        state.wy=input->ValueNoMutex(8,0);
-        state.wz=input->ValueNoMutex(9,0);
-        input->ReleaseMutex();
+    input->GetMutex();
+    state.q0 = input->ValueNoMutex(0, 0);
+    state.q1 = input->ValueNoMutex(1, 0);
+    state.q2 = input->ValueNoMutex(2, 0);
+    state.q3 = input->ValueNoMutex(3, 0);
+    state.wx = input->ValueNoMutex(7, 0);
+    state.wy = input->ValueNoMutex(8, 0);
+    state.wz = input->ValueNoMutex(9, 0);
+    input->ReleaseMutex();
 
-        shmem->Write((char*)&state,sizeof(imu_states_t));
-    }
+    shmem->Write((char *)&state, sizeof(imu_states_t));
+  }
 }
 
 void SimuImu::Run(void) {
-    imu_states_t state;
-    ImuData* imuData;
-    GetDatas(&imuData);
+  imu_states_t state;
+  ImuData *imuData;
+  GetDatas(&imuData);
 
-    if(data_rate==NULL) {
-        Thread::Err("not applicable for simulation part.\n");
-        return;
+  if (data_rate == NULL) {
+    Thread::Err("not applicable for simulation part.\n");
+    return;
+  }
+
+  SetPeriodUS((uint32_t)(1000000. / data_rate->Value()));
+
+  while (!ToBeStopped()) {
+    WaitPeriod();
+
+    if (data_rate->ValueChanged() == true) {
+      SetPeriodUS((uint32_t)(1000000. / data_rate->Value()));
     }
 
-    SetPeriodUS((uint32_t)(1000000./data_rate->Value()));
+    shmem->Read((char *)&state, sizeof(imu_states_t));
+    ahrsData->SetQuaternionAndAngularRates(
+        Quaternion(state.q0, state.q1, state.q2, state.q3),
+        Vector3D(state.wx, state.wy, state.wz));
 
-    while(!ToBeStopped()) {
-        WaitPeriod();
+    imuData->SetDataTime(GetTime());
+    ahrsData->SetDataTime(GetTime());
 
-        if(data_rate->ValueChanged()==true) {
-            SetPeriodUS((uint32_t)(1000000./data_rate->Value()));
-        }
-
-        shmem->Read((char*)&state,sizeof(imu_states_t));
-        ahrsData->SetQuaternionAndAngularRates(Quaternion(state.q0,state.q1,state.q2,state.q3)
-                                               ,Vector3D(state.wx,state.wy,state.wz));
-
-        imuData->SetDataTime(GetTime());
-        ahrsData->SetDataTime(GetTime());
-
-        UpdateImu();
-        ProcessUpdate(ahrsData);
-    }
+    UpdateImu();
+    ProcessUpdate(ahrsData);
+  }
 }
 
Index: trunk/lib/FlairSensorActuator/src/SimuImu.h
===================================================================
--- trunk/lib/FlairSensorActuator/src/SimuImu.h	(revision 14)
+++ trunk/lib/FlairSensorActuator/src/SimuImu.h	(revision 15)
@@ -18,81 +18,83 @@
 
 namespace flair {
-    namespace core     {
-        class SharedMem;
-        class AhrsData;
-    }
-    namespace gui {
-        class SpinBox;
-    }
+namespace core {
+class SharedMem;
+class AhrsData;
+}
+namespace gui {
+class SpinBox;
+}
 }
 
-namespace flair { namespace sensor {
-    /*! \class SimuImu
-    *
-    * \brief Class for a simulation Imu
-    */
-    class SimuImu : public Imu, public core::Thread {
-        public:
-            /*!
-            * \brief Constructor
-            *
-            * Construct a SimuImu. Control part.
-            *
-            * \param parent parent
-            * \param name name
-            * \param dev_id device id
-            * \param priority priority of the Thread
-            */
-            SimuImu(const core::FrameworkManager* parent,std::string name,uint32_t dev_id,uint8_t priority);
+namespace flair {
+namespace sensor {
+/*! \class SimuImu
+*
+* \brief Class for a simulation Imu
+*/
+class SimuImu : public Imu, public core::Thread {
+public:
+  /*!
+  * \brief Constructor
+  *
+  * Construct a SimuImu. Control part.
+  *
+  * \param parent parent
+  * \param name name
+  * \param dev_id device id
+  * \param priority priority of the Thread
+  */
+  SimuImu(const core::FrameworkManager *parent, std::string name,
+          uint32_t dev_id, uint8_t priority);
 
-            /*!
-            * \brief Constructor
-            *
-            * Construct a SimuImu. Simulation part.\n
-            * The Thread of this class should not be run.
-            *
-            * \param parent parent
-            * \param name name
-            * \param dev_id device id
-            */
-            SimuImu(const core::IODevice* parent,std::string name,uint32_t dev_id);
+  /*!
+  * \brief Constructor
+  *
+  * Construct a SimuImu. Simulation part.\n
+  * The Thread of this class should not be run.
+  *
+  * \param parent parent
+  * \param name name
+  * \param dev_id device id
+  */
+  SimuImu(const core::IODevice *parent, std::string name, uint32_t dev_id);
 
-            /*!
-            * \brief Destructor
-            *
-            */
-            ~SimuImu();
+  /*!
+  * \brief Destructor
+  *
+  */
+  ~SimuImu();
 
-        private:
-            /*!
-            * \brief Run function
-            *
-            * Reimplemented from Thread.
-            *
-            */
-            void Run(void);
+private:
+  /*!
+  * \brief Run function
+  *
+  * Reimplemented from Thread.
+  *
+  */
+  void Run(void);
 
-            /*!
-            * \brief Update using provided datas
-            *
-            * Reimplemented from IODevice.
-            *
-            * \param data data from the parent to process
-            */
-            void UpdateFrom(const core::io_data *data);
+  /*!
+  * \brief Update using provided datas
+  *
+  * Reimplemented from IODevice.
+  *
+  * \param data data from the parent to process
+  */
+  void UpdateFrom(const core::io_data *data);
 
-            typedef struct {
-                float q0;
-                float q1;
-                float q2;
-                float q3;
-                float wx;
-                float wy;
-                float wz;
-            } imu_states_t;
-            gui::SpinBox *data_rate;
-            core::SharedMem *shmem;
-            core::AhrsData *ahrsData;
-    };
+  typedef struct {
+    float q0;
+    float q1;
+    float q2;
+    float q3;
+    float wx;
+    float wy;
+    float wz;
+  } imu_states_t;
+  gui::SpinBox *data_rate;
+  core::SharedMem *shmem;
+  core::AhrsData *ahrsData;
+};
 } // end namespace sensor
 } // end namespace flair
Index: trunk/lib/FlairSensorActuator/src/SimuLaser.cpp
===================================================================
--- trunk/lib/FlairSensorActuator/src/SimuLaser.cpp	(revision 14)
+++ trunk/lib/FlairSensorActuator/src/SimuLaser.cpp	(revision 15)
@@ -29,62 +29,58 @@
 using namespace flair::gui;
 
-namespace flair
-{
-namespace sensor
-{
+namespace flair {
+namespace sensor {
 
-SimuLaser::SimuLaser(const FrameworkManager* parent,string name,uint32_t dev_id,uint8_t priority) : Thread(parent,name,priority), LaserRangeFinder(parent,name)
-{
-    data_rate=new SpinBox(GetGroupBox()->NewRow(),"data rate"," Hz",1,500,1,50);
+SimuLaser::SimuLaser(const FrameworkManager *parent, string name,
+                     uint32_t dev_id, uint8_t priority)
+    : Thread(parent, name, priority), LaserRangeFinder(parent, name) {
+  data_rate =
+      new SpinBox(GetGroupBox()->NewRow(), "data rate", " Hz", 1, 500, 1, 50);
 
-    ostringstream dev_name;
-    dev_name << "simu_Laser_" << dev_id;
-    shmem=new SharedMem((Thread*)this,dev_name.str().c_str(),360*sizeof(float)); //****
+  ostringstream dev_name;
+  dev_name << "simu_Laser_" << dev_id;
+  shmem = new SharedMem((Thread *)this, dev_name.str().c_str(),
+                        360 * sizeof(float)); //****
 }
 
-SimuLaser::SimuLaser(const IODevice* parent,string name,uint32_t dev_id) : Thread(parent,name,0), LaserRangeFinder(parent,name)
-{
-    data_rate=NULL;
+SimuLaser::SimuLaser(const IODevice *parent, string name, uint32_t dev_id)
+    : Thread(parent, name, 0), LaserRangeFinder(parent, name) {
+  data_rate = NULL;
 
-    ostringstream dev_name;
-    dev_name << "simu_Laser_" << dev_id;
-    shmem=new SharedMem((Thread*)this,dev_name.str().c_str(),360*sizeof(float));
+  ostringstream dev_name;
+  dev_name << "simu_Laser_" << dev_id;
+  shmem = new SharedMem((Thread *)this, dev_name.str().c_str(),
+                        360 * sizeof(float));
 }
 
-SimuLaser::~SimuLaser()
-{
-    SafeStop();
-    Join();
+SimuLaser::~SimuLaser() {
+  SafeStop();
+  Join();
 }
 
-void SimuLaser::Run(void)
-{
-    float z[360];
+void SimuLaser::Run(void) {
+  float z[360];
 
-    if(data_rate==NULL)
-    {
-        Thread::Err("not applicable for simulation part.\n");
-        return;
+  if (data_rate == NULL) {
+    Thread::Err("not applicable for simulation part.\n");
+    return;
+  }
+
+  SetPeriodUS((uint32_t)(1000000. / data_rate->Value()));
+
+  while (!ToBeStopped()) {
+    WaitPeriod();
+
+    shmem->Read((char *)z, 360 * sizeof(float));
+
+    if (data_rate->ValueChanged() == true) {
+      SetPeriodUS((uint32_t)(1000000. / data_rate->Value()));
     }
-
-    SetPeriodUS((uint32_t)(1000000./data_rate->Value()));
-
-    while(!ToBeStopped())
-    {
-        WaitPeriod();
-
-        shmem->Read((char*)z,360*sizeof(float));
-
-        if(data_rate->ValueChanged()==true)
-        {
-            SetPeriodUS((uint32_t)(1000000./data_rate->Value()));
-        }
-        for(int i=0; i<360; i++)
-        {
-            output->SetValue(i,0,z[i]); //*******
-        }
-        output->SetDataTime(GetTime());
-        ProcessUpdate(output);
+    for (int i = 0; i < 360; i++) {
+      output->SetValue(i, 0, z[i]); //*******
     }
+    output->SetDataTime(GetTime());
+    ProcessUpdate(output);
+  }
 }
 
Index: trunk/lib/FlairSensorActuator/src/SimuLaser.h
===================================================================
--- trunk/lib/FlairSensorActuator/src/SimuLaser.h	(revision 14)
+++ trunk/lib/FlairSensorActuator/src/SimuLaser.h	(revision 15)
@@ -17,84 +17,79 @@
 #include <Thread.h>
 
-namespace flair
-{
-    namespace core
-    {
-        class SharedMem;
-    }
-    namespace gui
-    {
-        class SpinBox;
-    }
+namespace flair {
+namespace core {
+class SharedMem;
+}
+namespace gui {
+class SpinBox;
+}
 }
 
-namespace flair
-{
-namespace sensor
-{
-    /*! \class SimuUs
-    *
-    * \brief Class for a simulation UsRangeFinder
-    */
-    class SimuLaser : public core::Thread, public LaserRangeFinder
-    {
-        public:
-            /*!
-            * \brief Constructor
-            *
-            * Construct a SimuUs. Control part.
-            *
-            * \param parent parent
-            * \param name name
-            * \param dev_id device id
-            * \param priority priority of the Thread
-            */
-            SimuLaser(const core::FrameworkManager* parent,std::string name,uint32_t dev_id,uint8_t priority);
+namespace flair {
+namespace sensor {
+/*! \class SimuUs
+*
+* \brief Class for a simulation UsRangeFinder
+*/
+class SimuLaser : public core::Thread, public LaserRangeFinder {
+public:
+  /*!
+  * \brief Constructor
+  *
+  * Construct a SimuUs. Control part.
+  *
+  * \param parent parent
+  * \param name name
+  * \param dev_id device id
+  * \param priority priority of the Thread
+  */
+  SimuLaser(const core::FrameworkManager *parent, std::string name,
+            uint32_t dev_id, uint8_t priority);
 
-            /*!
-            * \brief Constructor
-            *
-            * Construct a SimuUs. Simulation part.\n
-            * The Thread of this class should not be run.
-            *
-            * \param parent parent
-            * \param name name
-            * \param dev_id device id
-            */
-            SimuLaser(const core::IODevice* parent,std::string name,uint32_t dev_id);
+  /*!
+  * \brief Constructor
+  *
+  * Construct a SimuUs. Simulation part.\n
+  * The Thread of this class should not be run.
+  *
+  * \param parent parent
+  * \param name name
+  * \param dev_id device id
+  */
+  SimuLaser(const core::IODevice *parent, std::string name, uint32_t dev_id);
 
-            /*!
-            * \brief Destructor
-            *
-            */
-            ~SimuLaser();
+  /*!
+  * \brief Destructor
+  *
+  */
+  ~SimuLaser();
 
-        protected:
-            /*!
-            * \brief SharedMem to access datas
-            *
-            */
-            core::SharedMem *shmem;
+protected:
+  /*!
+  * \brief SharedMem to access datas
+  *
+  */
+  core::SharedMem *shmem;
 
-        private:
-            /*!
-            * \brief Update using provided datas
-            *
-            * Reimplemented from IODevice.
-            *
-            * \param data data from the parent to process
-            */
-            void UpdateFrom(const core::io_data *data){};
+private:
+  /*!
+  * \brief Update using provided datas
+  *
+  * Reimplemented from IODevice.
+  *
+  * \param data data from the parent to process
+  */
+  void UpdateFrom(const core::io_data *data){};
 
-            /*!
-            * \brief Run function
-            *
-            * Reimplemented from Thread.
-            *
-            */
-            void Run(void);
+  /*!
+  * \brief Run function
+  *
+  * Reimplemented from Thread.
+  *
+  */
+  void Run(void);
 
-            gui::SpinBox *data_rate;
-    };
+  gui::SpinBox *data_rate;
+};
 } // end namespace sensor
 } // end namespace flair
Index: trunk/lib/FlairSensorActuator/src/SimuUs.cpp
===================================================================
--- trunk/lib/FlairSensorActuator/src/SimuUs.cpp	(revision 14)
+++ trunk/lib/FlairSensorActuator/src/SimuUs.cpp	(revision 15)
@@ -29,60 +29,55 @@
 using namespace flair::gui;
 
-namespace flair
-{
-namespace sensor
-{
+namespace flair {
+namespace sensor {
 
-SimuUs::SimuUs(const FrameworkManager* parent,string name,uint32_t dev_id,uint8_t priority) : Thread(parent,name,priority), UsRangeFinder(parent,name)
-{
-    data_rate=new SpinBox(GetGroupBox()->NewRow(),"data rate"," Hz",1,500,1,50);
+SimuUs::SimuUs(const FrameworkManager *parent, string name, uint32_t dev_id,
+               uint8_t priority)
+    : Thread(parent, name, priority), UsRangeFinder(parent, name) {
+  data_rate =
+      new SpinBox(GetGroupBox()->NewRow(), "data rate", " Hz", 1, 500, 1, 50);
 
-    ostringstream dev_name;
-    dev_name << "simu_us_" << dev_id;
-    shmem=new SharedMem((Thread*)this,dev_name.str().c_str(),sizeof(float));
+  ostringstream dev_name;
+  dev_name << "simu_us_" << dev_id;
+  shmem = new SharedMem((Thread *)this, dev_name.str().c_str(), sizeof(float));
 }
 
-SimuUs::SimuUs(const IODevice* parent,string name,uint32_t dev_id) : Thread(parent,name,0), UsRangeFinder(parent,name)
-{
-    data_rate=NULL;
+SimuUs::SimuUs(const IODevice *parent, string name, uint32_t dev_id)
+    : Thread(parent, name, 0), UsRangeFinder(parent, name) {
+  data_rate = NULL;
 
-    ostringstream dev_name;
-    dev_name << "simu_us_" << dev_id;
-    shmem=new SharedMem((Thread*)this,dev_name.str().c_str(),sizeof(float));
+  ostringstream dev_name;
+  dev_name << "simu_us_" << dev_id;
+  shmem = new SharedMem((Thread *)this, dev_name.str().c_str(), sizeof(float));
 }
 
-SimuUs::~SimuUs()
-{
-    SafeStop();
-    Join();
+SimuUs::~SimuUs() {
+  SafeStop();
+  Join();
 }
 
-void SimuUs::Run(void)
-{
-    float z;
+void SimuUs::Run(void) {
+  float z;
 
-    if(data_rate==NULL)
-    {
-        Thread::Err("not applicable for simulation part.\n");
-        return;
+  if (data_rate == NULL) {
+    Thread::Err("not applicable for simulation part.\n");
+    return;
+  }
+
+  SetPeriodUS((uint32_t)(1000000. / data_rate->Value()));
+
+  while (!ToBeStopped()) {
+    WaitPeriod();
+
+    shmem->Read((char *)&z, sizeof(float));
+
+    if (data_rate->ValueChanged() == true) {
+      SetPeriodUS((uint32_t)(1000000. / data_rate->Value()));
     }
 
-    SetPeriodUS((uint32_t)(1000000./data_rate->Value()));
-
-    while(!ToBeStopped())
-    {
-        WaitPeriod();
-
-        shmem->Read((char*)&z,sizeof(float));
-
-        if(data_rate->ValueChanged()==true)
-        {
-            SetPeriodUS((uint32_t)(1000000./data_rate->Value()));
-        }
-
-        output->SetValue(0,0,z);
-        output->SetDataTime(GetTime());
-        ProcessUpdate(output);
-    }
+    output->SetValue(0, 0, z);
+    output->SetDataTime(GetTime());
+    ProcessUpdate(output);
+  }
 }
 
Index: trunk/lib/FlairSensorActuator/src/SimuUs.h
===================================================================
--- trunk/lib/FlairSensorActuator/src/SimuUs.h	(revision 14)
+++ trunk/lib/FlairSensorActuator/src/SimuUs.h	(revision 15)
@@ -17,84 +17,79 @@
 #include <Thread.h>
 
-namespace flair
-{
-    namespace core
-    {
-        class SharedMem;
-    }
-    namespace gui
-    {
-        class SpinBox;
-    }
+namespace flair {
+namespace core {
+class SharedMem;
+}
+namespace gui {
+class SpinBox;
+}
 }
 
-namespace flair
-{
-namespace sensor
-{
-    /*! \class SimuUs
-    *
-    * \brief Class for a simulation UsRangeFinder
-    */
-    class SimuUs : public core::Thread, public UsRangeFinder
-    {
-        public:
-            /*!
-            * \brief Constructor
-            *
-            * Construct a SimuUs. Control part.
-            *
-            * \param parent parent
-            * \param name name
-            * \param dev_id device id
-            * \param priority priority of the Thread
-            */
-            SimuUs(const core::FrameworkManager* parent,std::string name,uint32_t dev_id,uint8_t priority);
+namespace flair {
+namespace sensor {
+/*! \class SimuUs
+*
+* \brief Class for a simulation UsRangeFinder
+*/
+class SimuUs : public core::Thread, public UsRangeFinder {
+public:
+  /*!
+  * \brief Constructor
+  *
+  * Construct a SimuUs. Control part.
+  *
+  * \param parent parent
+  * \param name name
+  * \param dev_id device id
+  * \param priority priority of the Thread
+  */
+  SimuUs(const core::FrameworkManager *parent, std::string name,
+         uint32_t dev_id, uint8_t priority);
 
-            /*!
-            * \brief Constructor
-            *
-            * Construct a SimuUs. Simulation part.\n
-            * The Thread of this class should not be run.
-            *
-            * \param parent parent
-            * \param name name
-            * \param dev_id device id
-            */
-            SimuUs(const core::IODevice* parent,std::string name,uint32_t dev_id);
+  /*!
+  * \brief Constructor
+  *
+  * Construct a SimuUs. Simulation part.\n
+  * The Thread of this class should not be run.
+  *
+  * \param parent parent
+  * \param name name
+  * \param dev_id device id
+  */
+  SimuUs(const core::IODevice *parent, std::string name, uint32_t dev_id);
 
-            /*!
-            * \brief Destructor
-            *
-            */
-            ~SimuUs();
+  /*!
+  * \brief Destructor
+  *
+  */
+  ~SimuUs();
 
-        protected:
-            /*!
-            * \brief SharedMem to access datas
-            *
-            */
-            core::SharedMem *shmem;
+protected:
+  /*!
+  * \brief SharedMem to access datas
+  *
+  */
+  core::SharedMem *shmem;
 
-        private:
-            /*!
-            * \brief Update using provided datas
-            *
-            * Reimplemented from IODevice.
-            *
-            * \param data data from the parent to process
-            */
-            void UpdateFrom(const core::io_data *data){};
+private:
+  /*!
+  * \brief Update using provided datas
+  *
+  * Reimplemented from IODevice.
+  *
+  * \param data data from the parent to process
+  */
+  void UpdateFrom(const core::io_data *data){};
 
-            /*!
-            * \brief Run function
-            *
-            * Reimplemented from Thread.
-            *
-            */
-            void Run(void);
+  /*!
+  * \brief Run function
+  *
+  * Reimplemented from Thread.
+  *
+  */
+  void Run(void);
 
-            gui::SpinBox *data_rate;
-    };
+  gui::SpinBox *data_rate;
+};
 } // end namespace sensor
 } // end namespace flair
Index: trunk/lib/FlairSensorActuator/src/Srf08.cpp
===================================================================
--- trunk/lib/FlairSensorActuator/src/Srf08.cpp	(revision 14)
+++ trunk/lib/FlairSensorActuator/src/Srf08.cpp	(revision 15)
@@ -30,215 +30,189 @@
 using namespace flair::gui;
 
-namespace flair
-{
-namespace sensor
-{
-
-Srf08::Srf08(const FrameworkManager* parent,string name,I2cPort* i2cport,uint16_t address,uint8_t priority) : Thread(parent,name,priority), UsRangeFinder(parent,name)
-{
-    is_init=false;
-
-    //default values
-    //range 46*43+43=2021mm max (2m)
-    //7:gain=118
-    //range=46;
-    //gain=7;
-
-    this->i2cport=i2cport;
-	this->address=address;
-
-    //station sol
-    gain=new SpinBox(GetGroupBox()->NewRow(),"gain:",0,255,1,8);
-    range=new SpinBox(GetGroupBox()->LastRowLastCol(),"range:",0,255,1,46);
-
-
-    SetRange();
-    SetMaxGain();
-}
-
-Srf08::~Srf08()
-{
-    SafeStop();
-    Join();
-}
-
-void Srf08::Run(void)
-{
-    WarnUponSwitches(true);
-
-    //init srf
+namespace flair {
+namespace sensor {
+
+Srf08::Srf08(const FrameworkManager *parent, string name, I2cPort *i2cport,
+             uint16_t address, uint8_t priority)
+    : Thread(parent, name, priority), UsRangeFinder(parent, name) {
+  is_init = false;
+
+  // default values
+  // range 46*43+43=2021mm max (2m)
+  // 7:gain=118
+  // range=46;
+  // gain=7;
+
+  this->i2cport = i2cport;
+  this->address = address;
+
+  // station sol
+  gain = new SpinBox(GetGroupBox()->NewRow(), "gain:", 0, 255, 1, 8);
+  range = new SpinBox(GetGroupBox()->LastRowLastCol(), "range:", 0, 255, 1, 46);
+
+  SetRange();
+  SetMaxGain();
+}
+
+Srf08::~Srf08() {
+  SafeStop();
+  Join();
+}
+
+void Srf08::Run(void) {
+  WarnUponSwitches(true);
+
+  // init srf
+  SendEcho();
+
+  SetPeriodMS(20);
+
+  while (!ToBeStopped()) {
+    WaitPeriod();
+
+    if (range->ValueChanged() == true)
+      SetRange();
+    if (gain->ValueChanged() == true)
+      SetMaxGain();
+
+    GetEcho();
     SendEcho();
-
-    SetPeriodMS(20);
-
-    while(!ToBeStopped())
-    {
-        WaitPeriod();
-
-        if(range->ValueChanged()==true) SetRange();
-        if(gain->ValueChanged()==true) SetMaxGain();
-
-        GetEcho();
-        SendEcho();
+  }
+
+  WarnUponSwitches(false);
+}
+
+void Srf08::SendEcho(void) {
+  ssize_t written;
+  uint8_t tx[2];
+
+  tx[0] = 0;  // command register
+  tx[1] = 82; // ranging mode in usec
+
+  i2cport->GetMutex();
+
+  i2cport->SetSlave(address);
+  written = i2cport->Write(tx, 2);
+  echo_time = GetTime();
+
+  i2cport->ReleaseMutex();
+
+  if (written < 0) {
+    Thread::Err("erreur rt_dev_write (%s)\n", strerror(-written));
+  } else if (written != 2) {
+    Thread::Err("erreur rt_dev_write %i/2\n", written);
+  }
+}
+
+void Srf08::GetEcho(void) {
+  float z = 0;
+  ssize_t written, read;
+  uint8_t tx, rx[2];
+  tx = 2;
+  uint8_t nb_err = 0;
+
+  // si l'us est bloqué, on attend 1ms de plus
+  while (1) {
+    i2cport->GetMutex();
+    i2cport->SetSlave(address);
+    written = i2cport->Write(&tx, 1);
+
+    if (written < 0) {
+      i2cport->ReleaseMutex();
+      Thread::Err("erreur rt_dev_write (%s)\n", strerror(-written));
+      nb_err++;
+      if (nb_err == 20) {
+        Thread::Err("erreur rt_dev_write (%s), too many errors\n",
+                    strerror(-written));
+        return;
+      }
+      SleepMS(1);
+    } else {
+      read = i2cport->Read(rx, 2);
+      i2cport->ReleaseMutex();
+      // rt_printf("%i %i\n",rx[0],rx[1]);
+      if (read < 0) {
+        if (read != -ETIMEDOUT)
+          Thread::Err("erreur rt_dev_read (%s) %i\n", strerror(-written), read);
+        nb_err++;
+        if (nb_err == 20) {
+          Thread::Err("erreur rt_dev_read (%s), too many errors\n",
+                      strerror(-written));
+          return;
+        }
+        SleepMS(1);
+      } else if (read != 2) {
+        Thread::Err("erreur rt_dev_read %i/2\n", read);
+        return;
+      } else if (read == 2) {
+        break;
+      }
     }
-
-    WarnUponSwitches(false);
-}
-
-void Srf08::SendEcho(void)
-{
-    ssize_t written;
-    uint8_t tx[2];
-
-    tx[0]=0;//command register
-    tx[1]=82;//ranging mode in usec
-
-    i2cport->GetMutex();
-
-    i2cport->SetSlave(address);
-    written = i2cport->Write(tx, 2);
-    echo_time=GetTime();
-
-    i2cport->ReleaseMutex();
-
-    if(written<0)
-    {
-        Thread::Err("erreur rt_dev_write (%s)\n",strerror(-written));
+  }
+
+  // if(z!=-1)
+  // revoir ce filtrage!!!
+  {
+    z = 0.000001 * (float)(rx[0] * 256 + rx[1]) * 344 /
+        2; // d=v*t; v=344m/s, t=t usec/2 (aller retour)
+    // if(z>1) rt_printf("%i %i %f\n",rx[0],rx[1],z);
+    // on ne permet pas 2 mesures consecutives + grandes de 10cm
+    if (fabs(z - z_1) > 0.5 && is_init == true) {
+      Printf("z %f (anc %f) %lld\n", z, z_1, echo_time);
+      Printf("a revoir on suppose le sol plan\n");
+      z = z_1 + (z_1 - z_2); // on suppose que l'on continue a la meme vitesse
     }
-    else if (written != 2)
-    {
-        Thread::Err("erreur rt_dev_write %i/2\n",written);
-    }
-
-}
-
-void Srf08::GetEcho(void)
-{
-    float z=0;
-    ssize_t written,read;
-    uint8_t tx,rx[2];
-    tx=2;
-    uint8_t nb_err=0;
-
-    //si l'us est bloqué, on attend 1ms de plus
-    while(1)
-    {
-        i2cport->GetMutex();
-        i2cport->SetSlave(address);
-        written = i2cport->Write(&tx, 1);
-
-        if(written<0)
-        {
-            i2cport->ReleaseMutex();
-            Thread::Err("erreur rt_dev_write (%s)\n",strerror(-written));
-            nb_err++;
-            if(nb_err==20)
-            {
-                Thread::Err("erreur rt_dev_write (%s), too many errors\n",strerror(-written));
-                return;
-            }
-            SleepMS(1);
-        }
-        else
-        {
-            read = i2cport->Read(rx, 2);
-            i2cport->ReleaseMutex();
-        //rt_printf("%i %i\n",rx[0],rx[1]);
-            if(read<0)
-            {
-                if(read!=-ETIMEDOUT) Thread::Err("erreur rt_dev_read (%s) %i\n",strerror(-written),read);
-                nb_err++;
-                if(nb_err==20)
-                {
-                    Thread::Err("erreur rt_dev_read (%s), too many errors\n",strerror(-written));
-                    return;
-                }
-                SleepMS(1);
-            }
-            else if (read != 2)
-            {
-                Thread::Err("erreur rt_dev_read %i/2\n",read);
-                return;
-            }
-            else if(read==2)
-            {
-                break;
-            }
-        }
-    }
-
-    //if(z!=-1)
-    //revoir ce filtrage!!!
-    {
-        z=0.000001*(float)(rx[0]*256+rx[1])*344/2;//d=v*t; v=344m/s, t=t usec/2 (aller retour)
-//if(z>1) rt_printf("%i %i %f\n",rx[0],rx[1],z);
-        //on ne permet pas 2 mesures consecutives + grandes de 10cm
-        if(fabs(z-z_1)>0.5 && is_init==true)
-        {
-            Printf("z %f (anc %f) %lld\n",z,z_1,echo_time);
-            Printf("a revoir on suppose le sol plan\n");
-            z=z_1+(z_1-z_2);//on suppose que l'on continue a la meme vitesse
-        }
-        output->SetValue(0,0,z);
-        output->SetDataTime(echo_time+(rx[0]*256+rx[1])*1000);
-        ProcessUpdate(output);
-        z_2=z_1;
-        z_1=z;
-        is_init=true;
-    }
-}
-
-
-void Srf08::SetRange(void)
-{
-    ssize_t written;
-    uint8_t tx[2];
-
-    tx[0]=2;//range register
-    tx[1]=range->Value();//range*43+43=dist max en mm
-
-    i2cport->GetMutex();
-
-    i2cport->SetSlave(address);
-    written = i2cport->Write(tx, 2);
-
-    i2cport->ReleaseMutex();
-
-    if(written<0)
-    {
-        Thread::Err("erreur rt_dev_write (%s)\n",strerror(-written));
-    }
-    else if (written != 2)
-    {
-        Thread::Err("erreur rt_dev_write %i/2\n",written);
-    }
-
-}
-
-void Srf08::SetMaxGain(void)
-{
-    ssize_t written;
-    uint8_t tx[2];
-
-    //rt_printf("Srf08::SetMaxGain: %s ->%i\n",IODevice::ObjectName().c_str(),gain->Value());
-
-    tx[0]=1;//max gain register
-    tx[1]=gain->Value();
-
-    i2cport->GetMutex();
-
-    i2cport->SetSlave(address);
-    written = i2cport->Write(tx, 2);
-
-    i2cport->ReleaseMutex();
-
-    if(written<0)
-    {
-        Thread::Err("erreur write (%s)\n",strerror(-written));
-    }
-    else if (written != 2)
-    {
-        Thread::Err("erreur write %i/2\n",written);
-    }
+    output->SetValue(0, 0, z);
+    output->SetDataTime(echo_time + (rx[0] * 256 + rx[1]) * 1000);
+    ProcessUpdate(output);
+    z_2 = z_1;
+    z_1 = z;
+    is_init = true;
+  }
+}
+
+void Srf08::SetRange(void) {
+  ssize_t written;
+  uint8_t tx[2];
+
+  tx[0] = 2;              // range register
+  tx[1] = range->Value(); // range*43+43=dist max en mm
+
+  i2cport->GetMutex();
+
+  i2cport->SetSlave(address);
+  written = i2cport->Write(tx, 2);
+
+  i2cport->ReleaseMutex();
+
+  if (written < 0) {
+    Thread::Err("erreur rt_dev_write (%s)\n", strerror(-written));
+  } else if (written != 2) {
+    Thread::Err("erreur rt_dev_write %i/2\n", written);
+  }
+}
+
+void Srf08::SetMaxGain(void) {
+  ssize_t written;
+  uint8_t tx[2];
+
+  // rt_printf("Srf08::SetMaxGain: %s
+  // ->%i\n",IODevice::ObjectName().c_str(),gain->Value());
+
+  tx[0] = 1; // max gain register
+  tx[1] = gain->Value();
+
+  i2cport->GetMutex();
+
+  i2cport->SetSlave(address);
+  written = i2cport->Write(tx, 2);
+
+  i2cport->ReleaseMutex();
+
+  if (written < 0) {
+    Thread::Err("erreur write (%s)\n", strerror(-written));
+  } else if (written != 2) {
+    Thread::Err("erreur write %i/2\n", written);
+  }
 }
 
Index: trunk/lib/FlairSensorActuator/src/Srf08.h
===================================================================
--- trunk/lib/FlairSensorActuator/src/Srf08.h	(revision 14)
+++ trunk/lib/FlairSensorActuator/src/Srf08.h	(revision 15)
@@ -17,90 +17,86 @@
 #include <UsRangeFinder.h>
 
-namespace flair
-{
-    namespace core
-    {
-        class FrameworkManager;
-        class I2cPort;
-    }
-    namespace gui
-    {
-        class SpinBox;;
-    }
+namespace flair {
+namespace core {
+class FrameworkManager;
+class I2cPort;
+}
+namespace gui {
+class SpinBox;
+;
+}
 }
 
-namespace flair
-{
-namespace sensor
-{
-    /*! \class Srf08
-    *
-    * \brief Class for ultra sonic SRF08
-    */
-    class Srf08 : public core::Thread, public UsRangeFinder
-    {
+namespace flair {
+namespace sensor {
+/*! \class Srf08
+*
+* \brief Class for ultra sonic SRF08
+*/
+class Srf08 : public core::Thread, public UsRangeFinder {
 
-        public:
-            /*!
-            * \brief Constructor
-            *
-            * Construct a SimuUs. Control part.
-            *
-            * \param parent parent
-            * \param name name
-            * \param i2cport i2c port
-            * \param address i2c slave address
-            * \param priority priority of the Thread
-            */
-            Srf08(const core::FrameworkManager* parent,std::string name,core::I2cPort* i2cport,uint16_t address,uint8_t priority);
+public:
+  /*!
+  * \brief Constructor
+  *
+  * Construct a SimuUs. Control part.
+  *
+  * \param parent parent
+  * \param name name
+  * \param i2cport i2c port
+  * \param address i2c slave address
+  * \param priority priority of the Thread
+  */
+  Srf08(const core::FrameworkManager *parent, std::string name,
+        core::I2cPort *i2cport, uint16_t address, uint8_t priority);
 
-            /*!
-            * \brief Destructor
-            *
-            */
-            ~Srf08();
+  /*!
+  * \brief Destructor
+  *
+  */
+  ~Srf08();
 
-            /*!
-            * \brief Set Range
-            *
-            * check datasheet for values
-            */
-            void SetRange(void);
+  /*!
+  * \brief Set Range
+  *
+  * check datasheet for values
+  */
+  void SetRange(void);
 
-            /*!
-            * \brief Set Max Gain
-            *
-            * check datasheet for values
-            */
-            void SetMaxGain(void);
+  /*!
+  * \brief Set Max Gain
+  *
+  * check datasheet for values
+  */
+  void SetMaxGain(void);
 
-        private:
-            /*!
-            * \brief Update using provided datas
-            *
-            * Reimplemented from IODevice.
-            *
-            * \param data data from the parent to process
-            */
-            void UpdateFrom(const core::io_data *data){};
+private:
+  /*!
+  * \brief Update using provided datas
+  *
+  * Reimplemented from IODevice.
+  *
+  * \param data data from the parent to process
+  */
+  void UpdateFrom(const core::io_data *data){};
 
-            /*!
-            * \brief Run function
-            *
-            * Reimplemented from Thread.
-            *
-            */
-            void Run(void);
+  /*!
+  * \brief Run function
+  *
+  * Reimplemented from Thread.
+  *
+  */
+  void Run(void);
 
-            void SendEcho(void);
-            void GetEcho(void);
+  void SendEcho(void);
+  void GetEcho(void);
 
-            bool is_init;
-            core::Time echo_time;
-            float z_1,z_2;
-            gui::SpinBox *gain,*range;
-            uint16_t address;
-            core::I2cPort* i2cport;
-    };
+  bool is_init;
+  core::Time echo_time;
+  float z_1, z_2;
+  gui::SpinBox *gain, *range;
+  uint16_t address;
+  core::I2cPort *i2cport;
+};
 } // end namespace sensor
 } // end namespace flair
Index: trunk/lib/FlairSensorActuator/src/TargetController.cpp
===================================================================
--- trunk/lib/FlairSensorActuator/src/TargetController.cpp	(revision 14)
+++ trunk/lib/FlairSensorActuator/src/TargetController.cpp	(revision 15)
@@ -31,123 +31,132 @@
 using std::string;
 
-namespace flair
-{
-namespace sensor
-{
+namespace flair {
+namespace sensor {
 
-TargetController::TargetController(const FrameworkManager* parent,string name,uint8_t priority) :
-    Thread(parent,name,priority),IODevice(parent,name) {
-    main_tab=new Tab(getFrameworkManager()->GetTabWidget(),name);
-    TabWidget* tab=new TabWidget(main_tab->NewRow(),name);
-    setup_tab=new Tab(tab,"Reglages");
-
+TargetController::TargetController(const FrameworkManager *parent, string name,
+                                   uint8_t priority)
+    : Thread(parent, name, priority), IODevice(parent, name) {
+  main_tab = new Tab(getFrameworkManager()->GetTabWidget(), name);
+  TabWidget *tab = new TabWidget(main_tab->NewRow(), name);
+  setup_tab = new Tab(tab, "Reglages");
 }
 
 TargetController::~TargetController() {
-    SafeStop();
-    Join();
+  SafeStop();
+  Join();
 }
 
 std::string TargetController::GetAxisName(unsigned int axisId) const {
-    return string("axis")+std::to_string(axisId);
+  return string("axis") + std::to_string(axisId);
 }
 
 std::string TargetController::GetButtonName(unsigned int buttonId) const {
-    return string("button")+std::to_string(buttonId);
+  return string("button") + std::to_string(buttonId);
 }
 
 bool TargetController::SetLedOn(unsigned int ledId) {
-    if (!IsControllerActionSupported(ControllerAction::SetLedOn)) return false;
-    SwitchLedMessage *msgLed=new SwitchLedMessage(true,ledId);
-    changeStateQueue.push(msgLed);
-    return true;
+  if (!IsControllerActionSupported(ControllerAction::SetLedOn))
+    return false;
+  SwitchLedMessage *msgLed = new SwitchLedMessage(true, ledId);
+  changeStateQueue.push(msgLed);
+  return true;
 }
 
 bool TargetController::SetLedOff(unsigned int ledId) {
-    if (!IsControllerActionSupported(ControllerAction::SetLedOn)) return false;
-    SwitchLedMessage *msgLed=new SwitchLedMessage(false,ledId);
-    changeStateQueue.push(msgLed);
-    return true;
+  if (!IsControllerActionSupported(ControllerAction::SetLedOn))
+    return false;
+  SwitchLedMessage *msgLed = new SwitchLedMessage(false, ledId);
+  changeStateQueue.push(msgLed);
+  return true;
 }
 
-bool TargetController::Rumble(unsigned int leftForce,unsigned int leftTimeout,unsigned int rightForce,unsigned int rightTimeout) {
-    if (!IsControllerActionSupported(ControllerAction::Rumble)) return false;
-    RumbleMessage *msgRumble=new RumbleMessage(leftForce,leftTimeout,rightForce,rightTimeout);
-    changeStateQueue.push(msgRumble);
-    return true;
+bool TargetController::Rumble(unsigned int leftForce, unsigned int leftTimeout,
+                              unsigned int rightForce,
+                              unsigned int rightTimeout) {
+  if (!IsControllerActionSupported(ControllerAction::Rumble))
+    return false;
+  RumbleMessage *msgRumble =
+      new RumbleMessage(leftForce, leftTimeout, rightForce, rightTimeout);
+  changeStateQueue.push(msgRumble);
+  return true;
 }
 
-bool TargetController::FlashLed(unsigned int ledId,unsigned int onTimeout,unsigned int offTimeout){
-    if (!IsControllerActionSupported(ControllerAction::FlashLed)) return false;
-    FlashLedMessage *msgFlashLed=new FlashLedMessage(ledId,onTimeout,offTimeout);
-    changeStateQueue.push(msgFlashLed);
-    return true;
+bool TargetController::FlashLed(unsigned int ledId, unsigned int onTimeout,
+                                unsigned int offTimeout) {
+  if (!IsControllerActionSupported(ControllerAction::FlashLed))
+    return false;
+  FlashLedMessage *msgFlashLed =
+      new FlashLedMessage(ledId, onTimeout, offTimeout);
+  changeStateQueue.push(msgFlashLed);
+  return true;
 }
 
-float TargetController::GetAxisValue(unsigned int axisId) const{
-    //TODO we'd better throw an exception here
-    if (axis==NULL) return 0;
+float TargetController::GetAxisValue(unsigned int axisId) const {
+  // TODO we'd better throw an exception here
+  if (axis == NULL)
+    return 0;
 
-    axis->GetMutex();
-    float axisValue=axis->Value(axisId, 0);
-    axis->ReleaseMutex();
-    return axisValue;
+  axis->GetMutex();
+  float axisValue = axis->Value(axisId, 0);
+  axis->ReleaseMutex();
+  return axisValue;
 }
 
-bool TargetController::IsButtonPressed(unsigned int buttonId) const{
-    //TODO we'd better throw an exception here
-    if (button==NULL) return false;
+bool TargetController::IsButtonPressed(unsigned int buttonId) const {
+  // TODO we'd better throw an exception here
+  if (button == NULL)
+    return false;
 
-    button->GetMutex();
-    bool buttonValue=button->Value(buttonId, 0);
-    button->ReleaseMutex();
-    return buttonValue;
+  button->GetMutex();
+  bool buttonValue = button->Value(buttonId, 0);
+  button->ReleaseMutex();
+  return buttonValue;
 }
 
 void TargetController::Run() {
-    Message *message;
+  Message *message;
 
-    if(getFrameworkManager()->ErrorOccured()||!ControllerInitialization()) {
+  if (getFrameworkManager()->ErrorOccured() || !ControllerInitialization()) {
+    SafeStop();
+    Thread::Err("An error occured, we don't proceed with the loop.\n");
+  } else {
+
+    axis = new cvmatrix((IODevice *)this, axisNumber, 1, floatType);
+    button =
+        new cvmatrix((IODevice *)this, buttonNumber, 1, SignedIntegerType(8));
+
+    while (!ToBeStopped()) {
+      // Thread::Info("Debug: entering acquisition loop\n");
+      if (getFrameworkManager()->ConnectionLost() == true)
         SafeStop();
-        Thread::Err("An error occured, we don't proceed with the loop.\n");
-    } else {
 
-        axis=new cvmatrix((IODevice *)this,axisNumber,1,floatType);
-        button=new cvmatrix((IODevice *)this,buttonNumber,1,SignedIntegerType(8));
+      if (IsDataFrameReady()) {
+        // Thread::Info("Debug: data frame is ready\n");
 
-        while(!ToBeStopped()) {
-            //Thread::Info("Debug: entering acquisition loop\n");
-            if(getFrameworkManager()->ConnectionLost()==true) SafeStop();
+        AcquireAxisData(*axis);
+        AcquireButtonData(*button);
 
-            if (IsDataFrameReady()) {
-                //Thread::Info("Debug: data frame is ready\n");
+        // send the data
+        axis->SetDataTime(GetTime());
+        ProcessUpdate(axis);
 
-                AcquireAxisData(*axis);
-                AcquireButtonData(*button);
+        // send pending controller state change request(s)
 
-                //send the data
-                axis->SetDataTime(GetTime());
-                ProcessUpdate(axis);
-
-                //send pending controller state change request(s)
-
-                while(changeStateQueue.size()!=0) {
-                    message=changeStateQueue.front();
-                    if (ProcessMessage(message)) {
-                        changeStateQueue.pop();
-                        delete message;
-                    }
-                }
-            } else {
-                //Thread::Info("Debug: relax...\n");
-                usleep(20000); //20ms
-            }
+        while (changeStateQueue.size() != 0) {
+          message = changeStateQueue.front();
+          if (ProcessMessage(message)) {
+            changeStateQueue.pop();
+            delete message;
+          }
         }
+      } else {
+        // Thread::Info("Debug: relax...\n");
+        usleep(20000); // 20ms
+      }
     }
+  }
 }
 
-Tab* TargetController::GetTab() const {
-    return setup_tab;
-}
+Tab *TargetController::GetTab() const { return setup_tab; }
 
 } // end namespace sensor
Index: trunk/lib/FlairSensorActuator/src/TargetController.h
===================================================================
--- trunk/lib/FlairSensorActuator/src/TargetController.h	(revision 14)
+++ trunk/lib/FlairSensorActuator/src/TargetController.h	(revision 15)
@@ -25,72 +25,87 @@
 
 namespace flair {
-    namespace core {
-        class FrameworkManager;
-        class cvmatrix;
-        class Socket;
-        class io_data;
-    }
-    namespace gui {
-        class Tab;
-        class TabWidget;
-        class DataPlot1D;
-    }
+namespace core {
+class FrameworkManager;
+class cvmatrix;
+class Socket;
+class io_data;
+}
+namespace gui {
+class Tab;
+class TabWidget;
+class DataPlot1D;
+}
 }
 
-namespace flair { namespace sensor {
-    enum class ControllerAction;
+namespace flair {
+namespace sensor {
+enum class ControllerAction;
 
-    /*! \class TargetController
-    *
-    * \brief Base Class for target side remote controls
-    *
-    */
-    class TargetController : public core::Thread, public core::IODevice {
-    public:
-        TargetController(const core::FrameworkManager* parent,std::string name,uint8_t priority=0);
-        ~TargetController();
-        //void DrawUserInterface();
-        virtual bool IsConnected() const=0;
-        virtual bool IsDataFrameReady()=0;
-        //axis stuff
-        unsigned int GetAxisNumber() const;
-        virtual std::string GetAxisName(unsigned int axisId) const;
-        float GetAxisValue(unsigned int axisId) const;// always in the range [-1.0,1.0]
-        //button stuff
-        unsigned int GetButtonNumber() const;
-        bool IsButtonPressed(unsigned int buttonId) const;
-        virtual std::string GetButtonName(unsigned int axisId) const;
-        //controller state stuff
-        virtual bool IsControllerActionSupported(ControllerAction action) const {return false;};
-        bool SetLedOn(unsigned int ledId);
-        bool SetLedOff(unsigned int ledId);
-        bool Rumble(unsigned int left_force,unsigned int left_timeout,unsigned int right_force,unsigned int right_timeout);
-        bool FlashLed(unsigned int ledId,unsigned int on_timeout,unsigned int off_timeout);
-        void UpdateFrom(const core::io_data *data){}; //TODO
-        gui::Tab* GetTab(void) const;
+/*! \class TargetController
+*
+* \brief Base Class for target side remote controls
+*
+*/
+class TargetController : public core::Thread, public core::IODevice {
+public:
+  TargetController(const core::FrameworkManager *parent, std::string name,
+                   uint8_t priority = 0);
+  ~TargetController();
+  // void DrawUserInterface();
+  virtual bool IsConnected() const = 0;
+  virtual bool IsDataFrameReady() = 0;
+  // axis stuff
+  unsigned int GetAxisNumber() const;
+  virtual std::string GetAxisName(unsigned int axisId) const;
+  float
+  GetAxisValue(unsigned int axisId) const; // always in the range [-1.0,1.0]
+  // button stuff
+  unsigned int GetButtonNumber() const;
+  bool IsButtonPressed(unsigned int buttonId) const;
+  virtual std::string GetButtonName(unsigned int axisId) const;
+  // controller state stuff
+  virtual bool IsControllerActionSupported(ControllerAction action) const {
+    return false;
+  };
+  bool SetLedOn(unsigned int ledId);
+  bool SetLedOff(unsigned int ledId);
+  bool Rumble(unsigned int left_force, unsigned int left_timeout,
+              unsigned int right_force, unsigned int right_timeout);
+  bool FlashLed(unsigned int ledId, unsigned int on_timeout,
+                unsigned int off_timeout);
+  void UpdateFrom(const core::io_data *data){}; // TODO
+  gui::Tab *GetTab(void) const;
 
-    protected:
-        virtual bool ProcessMessage(core::Message *msg)=0;
-        void QueueMessage(core::Message msg);
-        virtual bool ControllerInitialization()=0;// {return true;};
-        //axis stuff
-        unsigned int axisNumber;
-        core::cvmatrix* axis=NULL;
-        virtual void AcquireAxisData(core::cvmatrix &axis)=0; //responsible for getting the axis data from the hardware
-        uint16_t bitsPerAxis;
-        //button stuff
-        unsigned int buttonNumber;
-        core::cvmatrix* button=NULL;
-        virtual void AcquireButtonData(core::cvmatrix &button)=0; //responsible for getting the button data from the hardware
-        //controller state stuff
-        unsigned int ledNumber;
-    private:
-        void Run();
-        std::queue<core::Message *> changeStateQueue;
-        flair::gui::Tab* main_tab;
-        flair::gui::Tab* setup_tab;
-    };
+protected:
+  virtual bool ProcessMessage(core::Message *msg) = 0;
+  void QueueMessage(core::Message msg);
+  virtual bool ControllerInitialization() = 0; // {return true;};
+  // axis stuff
+  unsigned int axisNumber;
+  core::cvmatrix *axis = NULL;
+  virtual void AcquireAxisData(core::cvmatrix &axis) = 0; // responsible for
+                                                          // getting the axis
+                                                          // data from the
+                                                          // hardware
+  uint16_t bitsPerAxis;
+  // button stuff
+  unsigned int buttonNumber;
+  core::cvmatrix *button = NULL;
+  virtual void AcquireButtonData(core::cvmatrix &button) = 0; // responsible for
+                                                              // getting the
+                                                              // button data
+                                                              // from the
+                                                              // hardware
+  // controller state stuff
+  unsigned int ledNumber;
 
-}}
+private:
+  void Run();
+  std::queue<core::Message *> changeStateQueue;
+  flair::gui::Tab *main_tab;
+  flair::gui::Tab *setup_tab;
+};
+}
+}
 
 #endif // TARGETCONTROLLER_H
Index: trunk/lib/FlairSensorActuator/src/TargetEthController.cpp
===================================================================
--- trunk/lib/FlairSensorActuator/src/TargetEthController.cpp	(revision 14)
+++ trunk/lib/FlairSensorActuator/src/TargetEthController.cpp	(revision 15)
@@ -12,5 +12,6 @@
 //
 //  purpose:    class that gets remote controls through an ethernet connection.
-//              Typical use case: a remote control is plugged in a workstation and sends remote control
+//              Typical use case: a remote control is plugged in a workstation
+//              and sends remote control
 //              data to a distant target (this class) through Wifi//
 //
@@ -32,300 +33,331 @@
 using std::string;
 
-namespace flair
-{
-namespace sensor
-{
-
-TargetEthController::TargetEthController(const FrameworkManager* parent,string name,uint16_t _port,uint8_t priority) :
-    TargetController(parent,name,priority),listeningPort(_port),receiveCurrentPosition(0) {
-    const bool blocking=true;
-    listeningSocket=new TcpSocket(parent,"TEC_listening_socket",blocking,blocking);
-    dataSocket=new Socket(parent,"TEC_data_socket",_port+1); //receiving side
+namespace flair {
+namespace sensor {
+
+TargetEthController::TargetEthController(const FrameworkManager *parent,
+                                         string name, uint16_t _port,
+                                         uint8_t priority)
+    : TargetController(parent, name, priority), listeningPort(_port),
+      receiveCurrentPosition(0) {
+  const bool blocking = true;
+  listeningSocket =
+      new TcpSocket(parent, "TEC_listening_socket", blocking, blocking);
+  dataSocket =
+      new Socket(parent, "TEC_data_socket", _port + 1); // receiving side
 }
 
 TargetEthController::~TargetEthController() {
-    //We are (currently) the server side. We must ask the client side to initiate tcp connexion closing to avoid the server socket
-    //to get stuck in TIME_WAIT state
-    Message msg(32);
-    if (controlSocket) {
-        Message cancelAcquisition(sizeof(ControllerAction));
-        ControllerAction exit=ControllerAction::Exit;
-        memcpy(cancelAcquisition.buffer,&exit,sizeof(ControllerAction));
-        controlSocket->SendMessage(cancelAcquisition.buffer,cancelAcquisition.bufferSize);
-        //We don't expect any more data from the client, we're just waiting for the socket to be closed by the client
-        controlSocket->RecvMessage(msg.buffer,msg.bufferSize);
-    }
-
-    //TargetController calls TargetEthController methods in its run
-    //we must stop the thread now
-    SafeStop();
-    Join();
+  // We are (currently) the server side. We must ask the client side to initiate
+  // tcp connexion closing to avoid the server socket
+  // to get stuck in TIME_WAIT state
+  Message msg(32);
+  if (controlSocket) {
+    Message cancelAcquisition(sizeof(ControllerAction));
+    ControllerAction exit = ControllerAction::Exit;
+    memcpy(cancelAcquisition.buffer, &exit, sizeof(ControllerAction));
+    controlSocket->SendMessage(cancelAcquisition.buffer,
+                               cancelAcquisition.bufferSize);
+    // We don't expect any more data from the client, we're just waiting for the
+    // socket to be closed by the client
+    controlSocket->RecvMessage(msg.buffer, msg.bufferSize);
+  }
+
+  // TargetController calls TargetEthController methods in its run
+  // we must stop the thread now
+  SafeStop();
+  Join();
 }
 
 bool TargetEthController::IsConnected() const {
-    //TODO
-}
-
-bool TargetEthController::IsDataFrameReady(){
-    //read up to the last data
-    ssize_t received;
-    size_t bytesToReceive=dataFrameSize-receiveCurrentPosition;
-    bool fullDatagramReceived=false;
-
-    do {
-        received=dataSocket->RecvMessage(receiveFrameBuffer+receiveCurrentPosition,bytesToReceive,TIME_NONBLOCK);
-        if (received>0) {
-            bytesToReceive-=received;
-            if (bytesToReceive==0) {
-                //a full datagram has been read in receiveFrameBuffer
-                fullDatagramReceived=true;
-                receiveCurrentPosition=0;
-                //we swap the data and reception buffers to avoid copy
-                char *swapFrameBuffer=dataFrameBuffer;
-                dataFrameBuffer=receiveFrameBuffer;
-                receiveFrameBuffer=swapFrameBuffer;
-            }
-        }
-    } while (!received<0);
-
-    return fullDatagramReceived;
-}
-
-uint8_t TargetEthController::getByteOrNull(char *buffer,int byte,size_t bufferSize) {
-    if (byte<bufferSize) return buffer[byte];
-    else return 0;
-}
-
-uint32_t TargetEthController::charBufferToUint32(char *buffer, size_t bufferSize) {
-    union {
-        uint32_t int32;
-        char byte[4];
-    } bitField;
-    if (!IsBigEndian()) {
-        bitField.byte[0]=getByteOrNull(buffer,3,bufferSize);
-        bitField.byte[1]=getByteOrNull(buffer,2,bufferSize);
-        bitField.byte[2]=getByteOrNull(buffer,1,bufferSize);
-        bitField.byte[3]=getByteOrNull(buffer,0,bufferSize);
-    } else {
-        bitField.byte[0]=getByteOrNull(buffer,0,bufferSize);
-        bitField.byte[1]=getByteOrNull(buffer,1,bufferSize);
-        bitField.byte[2]=getByteOrNull(buffer,2,bufferSize);
-        bitField.byte[3]=getByteOrNull(buffer,3,bufferSize);
-    }
-    return bitField.int32;
-}
-
-//read _up_to_16_bits_ in a buffer
-uint16_t TargetEthController::readBits(uint8_t offsetInBits,uint8_t valueSizeInBits,char *buffer,size_t bufferSize) {
-    //parameters check
-    if (valueSizeInBits>16) throw std::range_error("bitfield should be at max 16bits wide");
-    size_t minBufferSize=(offsetInBits+valueSizeInBits)/8;
-    if ((offsetInBits+valueSizeInBits)%8!=0) minBufferSize++;
-    if (bufferSize<minBufferSize) throw std::range_error("buffer too small");
-    //skip first bytes
-    size_t bytesToSkip=offsetInBits/8;
-    buffer+=bytesToSkip;
-    bufferSize-=bytesToSkip;
-    offsetInBits-=bytesToSkip*8;
-    //take care of endianness
-    uint32_t value=charBufferToUint32(buffer,bufferSize);
-    value>>=32-offsetInBits-valueSizeInBits;
-    value&=(1<<valueSizeInBits)-1;
-    return (uint16_t)value;
+  // TODO
+}
+
+bool TargetEthController::IsDataFrameReady() {
+  // read up to the last data
+  ssize_t received;
+  size_t bytesToReceive = dataFrameSize - receiveCurrentPosition;
+  bool fullDatagramReceived = false;
+
+  do {
+    received =
+        dataSocket->RecvMessage(receiveFrameBuffer + receiveCurrentPosition,
+                                bytesToReceive, TIME_NONBLOCK);
+    if (received > 0) {
+      bytesToReceive -= received;
+      if (bytesToReceive == 0) {
+        // a full datagram has been read in receiveFrameBuffer
+        fullDatagramReceived = true;
+        receiveCurrentPosition = 0;
+        // we swap the data and reception buffers to avoid copy
+        char *swapFrameBuffer = dataFrameBuffer;
+        dataFrameBuffer = receiveFrameBuffer;
+        receiveFrameBuffer = swapFrameBuffer;
+      }
+    }
+  } while (!received < 0);
+
+  return fullDatagramReceived;
+}
+
+uint8_t TargetEthController::getByteOrNull(char *buffer, int byte,
+                                           size_t bufferSize) {
+  if (byte < bufferSize)
+    return buffer[byte];
+  else
+    return 0;
+}
+
+uint32_t TargetEthController::charBufferToUint32(char *buffer,
+                                                 size_t bufferSize) {
+  union {
+    uint32_t int32;
+    char byte[4];
+  } bitField;
+  if (!IsBigEndian()) {
+    bitField.byte[0] = getByteOrNull(buffer, 3, bufferSize);
+    bitField.byte[1] = getByteOrNull(buffer, 2, bufferSize);
+    bitField.byte[2] = getByteOrNull(buffer, 1, bufferSize);
+    bitField.byte[3] = getByteOrNull(buffer, 0, bufferSize);
+  } else {
+    bitField.byte[0] = getByteOrNull(buffer, 0, bufferSize);
+    bitField.byte[1] = getByteOrNull(buffer, 1, bufferSize);
+    bitField.byte[2] = getByteOrNull(buffer, 2, bufferSize);
+    bitField.byte[3] = getByteOrNull(buffer, 3, bufferSize);
+  }
+  return bitField.int32;
+}
+
+// read _up_to_16_bits_ in a buffer
+uint16_t TargetEthController::readBits(uint8_t offsetInBits,
+                                       uint8_t valueSizeInBits, char *buffer,
+                                       size_t bufferSize) {
+  // parameters check
+  if (valueSizeInBits > 16)
+    throw std::range_error("bitfield should be at max 16bits wide");
+  size_t minBufferSize = (offsetInBits + valueSizeInBits) / 8;
+  if ((offsetInBits + valueSizeInBits) % 8 != 0)
+    minBufferSize++;
+  if (bufferSize < minBufferSize)
+    throw std::range_error("buffer too small");
+  // skip first bytes
+  size_t bytesToSkip = offsetInBits / 8;
+  buffer += bytesToSkip;
+  bufferSize -= bytesToSkip;
+  offsetInBits -= bytesToSkip * 8;
+  // take care of endianness
+  uint32_t value = charBufferToUint32(buffer, bufferSize);
+  value >>= 32 - offsetInBits - valueSizeInBits;
+  value &= (1 << valueSizeInBits) - 1;
+  return (uint16_t)value;
 }
 
 void TargetEthController::AcquireAxisData(core::cvmatrix &axis) {
-    axis.GetMutex();
-//char testFrameBuffer[3]={(char)0x09,(char)0x59,(char)0xB8};
-    for (unsigned int i=0;i<axisNumber;i++) {
-        uint16_t rawAxisValue=readBits(i*bitsPerAxis,bitsPerAxis,dataFrameBuffer,dataFrameSize);
-//        uint16_t rawAxisValue=readBits(i*bitsPerAxis,bitsPerAxis,testFrameBuffer);
-        uint16_t scale=1<<(bitsPerAxis-1);
-//Thread::Info("RawAxisValue=%d, scale=%d => scaled rawValue=%d, float value)%f\n",rawAxisValue,scale,rawAxisValue-scale,(rawAxisValue-scale)/(float)scale);
-        axis.SetValueNoMutex(i,0,(rawAxisValue-scale)/(float)scale);
-    }
-    axis.ReleaseMutex();
+  axis.GetMutex();
+  // char testFrameBuffer[3]={(char)0x09,(char)0x59,(char)0xB8};
+  for (unsigned int i = 0; i < axisNumber; i++) {
+    uint16_t rawAxisValue =
+        readBits(i * bitsPerAxis, bitsPerAxis, dataFrameBuffer, dataFrameSize);
+    //        uint16_t
+    //        rawAxisValue=readBits(i*bitsPerAxis,bitsPerAxis,testFrameBuffer);
+    uint16_t scale = 1 << (bitsPerAxis - 1);
+    // Thread::Info("RawAxisValue=%d, scale=%d => scaled rawValue=%d, float
+    // value)%f\n",rawAxisValue,scale,rawAxisValue-scale,(rawAxisValue-scale)/(float)scale);
+    axis.SetValueNoMutex(i, 0, (rawAxisValue - scale) / (float)scale);
+  }
+  axis.ReleaseMutex();
 }
 
 void TargetEthController::AcquireButtonData(core::cvmatrix &button) {
-    uint8_t buttonValue;
-    int currentButton=0;
-    button.GetMutex();
-    /*
-    for (unsigned int i=0;i<buttonNumber;i++) {
-        memcpy(&buttonValue,buttonOffset+i*sizeof(bool),sizeof(bool));
-        dataSocket->NetworkToHost((char*)&buttonValue,sizeof(bool));
-        button.SetValueNoMutex(i,0,buttonValue);
-//        if (buttonValue) Thread::Info("Debug: button '%s' pressed\n", GetButtonName(i).c_str());
-    }*/
-    for (unsigned int i=0;i<buttonNumber/8;i++) {
-        memcpy(&buttonValue,dataFrameBuffer+buttonOffset+i*sizeof(uint8_t),sizeof(uint8_t));
-//        dataSocket->NetworkToHost((char*)&buttonValue,sizeof(uint8_t));
-        for(unsigned int j=0;j<8;j++) {
-            button.SetValueNoMutex(currentButton,0,(buttonValue>>j)&0x01);
-            currentButton++;
-        }
-    }
-    button.ReleaseMutex();
-}
-
-string TargetEthController::GetAxisName(unsigned int axisId) const{
-    //TODO: should throw an exception if axisName==NULL or axisId>axisNumber
-    return axisName[axisId];
-}
-
-string TargetEthController::GetButtonName(unsigned int buttonId) const{
-    //TODO: should throw an exception if buttonName==NULL or buttonId>buttonNumber
-    return buttonName[buttonId];
+  uint8_t buttonValue;
+  int currentButton = 0;
+  button.GetMutex();
+  /*
+  for (unsigned int i=0;i<buttonNumber;i++) {
+      memcpy(&buttonValue,buttonOffset+i*sizeof(bool),sizeof(bool));
+      dataSocket->NetworkToHost((char*)&buttonValue,sizeof(bool));
+      button.SetValueNoMutex(i,0,buttonValue);
+//        if (buttonValue) Thread::Info("Debug: button '%s' pressed\n",
+GetButtonName(i).c_str());
+  }*/
+  for (unsigned int i = 0; i < buttonNumber / 8; i++) {
+    memcpy(&buttonValue, dataFrameBuffer + buttonOffset + i * sizeof(uint8_t),
+           sizeof(uint8_t));
+    //        dataSocket->NetworkToHost((char*)&buttonValue,sizeof(uint8_t));
+    for (unsigned int j = 0; j < 8; j++) {
+      button.SetValueNoMutex(currentButton, 0, (buttonValue >> j) & 0x01);
+      currentButton++;
+    }
+  }
+  button.ReleaseMutex();
+}
+
+string TargetEthController::GetAxisName(unsigned int axisId) const {
+  // TODO: should throw an exception if axisName==NULL or axisId>axisNumber
+  return axisName[axisId];
+}
+
+string TargetEthController::GetButtonName(unsigned int buttonId) const {
+  // TODO: should throw an exception if buttonName==NULL or
+  // buttonId>buttonNumber
+  return buttonName[buttonId];
 }
 
 bool TargetEthController::ProcessMessage(Message *msg) {
-    return !(controlSocket->SendMessage(msg->buffer,msg->bufferSize,0)<0);
-}
-
-bool TargetEthController::IsControllerActionSupported(ControllerAction action) const {
-    //TODO: here we should ask the remote side (host). Probably through the control socket
-    switch(action) {
-    case ControllerAction::SetLedOn:
-        return true;
-    case ControllerAction::SetLedOff:
-        return true;
-    case ControllerAction::Rumble:
-        return true;
-    case ControllerAction::FlashLed:
-        return true;
-    default:
+  return !(controlSocket->SendMessage(msg->buffer, msg->bufferSize, 0) < 0);
+}
+
+bool TargetEthController::IsControllerActionSupported(
+    ControllerAction action) const {
+  // TODO: here we should ask the remote side (host). Probably through the
+  // control socket
+  switch (action) {
+  case ControllerAction::SetLedOn:
+    return true;
+  case ControllerAction::SetLedOff:
+    return true;
+  case ControllerAction::Rumble:
+    return true;
+  case ControllerAction::FlashLed:
+    return true;
+  default:
+    return false;
+  }
+}
+
+bool TargetEthController::ControllerInitialization() {
+  char message[1024];
+  ssize_t received;
+  bool connected = false;
+  bool mustReadMore;
+
+  listeningSocket->Listen(listeningPort);
+  Thread::Info("Debug: Listening to port %d\n", listeningPort);
+  // accept incoming connection
+  bool connectionAccepted = false;
+  while (!connectionAccepted) {
+    controlSocket = listeningSocket->Accept(10);
+    if (controlSocket == nullptr) {
+      // Timeout (or error btw)
+      if (ToBeStopped())
         return false;
-    }
-}
-
-bool TargetEthController::ControllerInitialization() {
-    char message[1024];
-    ssize_t received;
-    bool connected=false;
-    bool mustReadMore;
-
-    listeningSocket->Listen(listeningPort);
-    Thread::Info("Debug: Listening to port %d\n",listeningPort);
-                 //accept incoming connection
-    bool connectionAccepted=false;
-    while (!connectionAccepted) {
-        controlSocket=listeningSocket->Accept(10);
-        if (controlSocket==nullptr) {
-            //Timeout (or error btw)
-            if (ToBeStopped()) return false;
-        } else connectionAccepted=true;
-    }
-    Thread::Info("Debug: Connexion accepted\n");
-
-    //get axis stuff
-    bool axisNumberRead=false;
-    while (!axisNumberRead) {
-        try {
-            axisNumber=controlSocket->ReadUInt32(10);
-            //Thread::Info("Debug: axisNumber %d\n", axisNumber);
-            axisNumberRead=true;
-        }
-        catch (std::runtime_error e) {
-            //timeout
-            if (ToBeStopped()) return false;
-        }
-    }
-    bool bitsPerAxisRead=false;
-    while (!bitsPerAxisRead) {
-        try {
-            bitsPerAxis=controlSocket->ReadUInt32(10);
-            //Thread::Info("Debug: bits per axis %d\n", bitsPerAxis);
-            bitsPerAxisRead=true;
-        }
-        catch (std::runtime_error e) {
-            //timeout
-            if (ToBeStopped()) return false;
-        }
-    }
-    axisName=new string[axisNumber];
-    for (unsigned int i=0;i<axisNumber;i++) {
-        //read string size
-        int stringSize;
-        bool stringSizeRead=false;
-        while (!stringSizeRead) {
-            try {
-                stringSize=controlSocket->ReadUInt32(10);
-                stringSizeRead=true;
-            }
-            catch (std::runtime_error e) {
-                //timeout
-                if (ToBeStopped()) return false;
-            }
-        }
-        //read string
-        bool axisNameRead=false;
-        while (!axisNameRead) {
-            try {
-                axisName[i]=controlSocket->ReadString(stringSize,10);
-                axisNameRead=true;
-            }
-            catch (std::runtime_error e) {
-                //timeout
-                if (ToBeStopped()) return false;
-            }
-        }
-        //Thread::Info("Debug: axisName for axis %d %s\n", i, axisName[i].c_str());
-    }
-
-    //get button stuff
-    bool buttonNumberRead=false;
-    while (!buttonNumberRead) {
-        try {
-            buttonNumber=controlSocket->ReadUInt32(10);
-            buttonNumberRead=true;
-        }
-        catch (std::runtime_error e) {
-            //timeout
-            if (ToBeStopped()) return false;
-        }
-    }
-    //Thread::Info("Debug: buttonNumber %d\n", buttonNumber);
-    buttonName=new string[buttonNumber];
-    for (unsigned int i=0;i<buttonNumber;i++) {
-        //read string size
-        int stringSize;
-        bool stringSizeRead=false;
-        while (!stringSizeRead) {
-            try {
-                stringSize=controlSocket->ReadUInt32(10);
-                stringSizeRead=true;
-            }
-            catch (std::runtime_error e) {
-                //timeout
-                if (ToBeStopped()) return false;
-            }
-        }
-        //read string
-        bool buttonNameRead=false;
-        while (!buttonNameRead) {
-            try {
-                buttonName[i]=controlSocket->ReadString(stringSize,10);
-                buttonNameRead=true;
-            }
-            catch (std::runtime_error e) {
-                //timeout
-                if (ToBeStopped()) return false;
-            }
-        }
-        //Thread::Info("Debug: buttonName for button %d %s\n", i, buttonName[i].c_str());
-    }
-
-//    dataFrameSize=axisNumber*sizeof(float)+buttonNumber/8*sizeof(uint8_t);
-    buttonOffset=(axisNumber*bitsPerAxis)/8;
-    if ((axisNumber*bitsPerAxis)%8!=0) buttonOffset++;
-    dataFrameSize=buttonOffset+(buttonNumber/8)*sizeof(uint8_t);
-    if ((buttonNumber%8)!=0) dataFrameSize++;
-    dataFrameBuffer=new char[dataFrameSize];
-    receiveFrameBuffer=new char[dataFrameSize];
-
-    Thread::Info("Controller connected with host side\n");
-    if(buttonNumber%8!=0) Thread::Err("Button number is not multiple of 8\n");
-    return true;
+    } else
+      connectionAccepted = true;
+  }
+  Thread::Info("Debug: Connexion accepted\n");
+
+  // get axis stuff
+  bool axisNumberRead = false;
+  while (!axisNumberRead) {
+    try {
+      axisNumber = controlSocket->ReadUInt32(10);
+      // Thread::Info("Debug: axisNumber %d\n", axisNumber);
+      axisNumberRead = true;
+    } catch (std::runtime_error e) {
+      // timeout
+      if (ToBeStopped())
+        return false;
+    }
+  }
+  bool bitsPerAxisRead = false;
+  while (!bitsPerAxisRead) {
+    try {
+      bitsPerAxis = controlSocket->ReadUInt32(10);
+      // Thread::Info("Debug: bits per axis %d\n", bitsPerAxis);
+      bitsPerAxisRead = true;
+    } catch (std::runtime_error e) {
+      // timeout
+      if (ToBeStopped())
+        return false;
+    }
+  }
+  axisName = new string[axisNumber];
+  for (unsigned int i = 0; i < axisNumber; i++) {
+    // read string size
+    int stringSize;
+    bool stringSizeRead = false;
+    while (!stringSizeRead) {
+      try {
+        stringSize = controlSocket->ReadUInt32(10);
+        stringSizeRead = true;
+      } catch (std::runtime_error e) {
+        // timeout
+        if (ToBeStopped())
+          return false;
+      }
+    }
+    // read string
+    bool axisNameRead = false;
+    while (!axisNameRead) {
+      try {
+        axisName[i] = controlSocket->ReadString(stringSize, 10);
+        axisNameRead = true;
+      } catch (std::runtime_error e) {
+        // timeout
+        if (ToBeStopped())
+          return false;
+      }
+    }
+    // Thread::Info("Debug: axisName for axis %d %s\n", i, axisName[i].c_str());
+  }
+
+  // get button stuff
+  bool buttonNumberRead = false;
+  while (!buttonNumberRead) {
+    try {
+      buttonNumber = controlSocket->ReadUInt32(10);
+      buttonNumberRead = true;
+    } catch (std::runtime_error e) {
+      // timeout
+      if (ToBeStopped())
+        return false;
+    }
+  }
+  // Thread::Info("Debug: buttonNumber %d\n", buttonNumber);
+  buttonName = new string[buttonNumber];
+  for (unsigned int i = 0; i < buttonNumber; i++) {
+    // read string size
+    int stringSize;
+    bool stringSizeRead = false;
+    while (!stringSizeRead) {
+      try {
+        stringSize = controlSocket->ReadUInt32(10);
+        stringSizeRead = true;
+      } catch (std::runtime_error e) {
+        // timeout
+        if (ToBeStopped())
+          return false;
+      }
+    }
+    // read string
+    bool buttonNameRead = false;
+    while (!buttonNameRead) {
+      try {
+        buttonName[i] = controlSocket->ReadString(stringSize, 10);
+        buttonNameRead = true;
+      } catch (std::runtime_error e) {
+        // timeout
+        if (ToBeStopped())
+          return false;
+      }
+    }
+    // Thread::Info("Debug: buttonName for button %d %s\n", i,
+    // buttonName[i].c_str());
+  }
+
+  //    dataFrameSize=axisNumber*sizeof(float)+buttonNumber/8*sizeof(uint8_t);
+  buttonOffset = (axisNumber * bitsPerAxis) / 8;
+  if ((axisNumber * bitsPerAxis) % 8 != 0)
+    buttonOffset++;
+  dataFrameSize = buttonOffset + (buttonNumber / 8) * sizeof(uint8_t);
+  if ((buttonNumber % 8) != 0)
+    dataFrameSize++;
+  dataFrameBuffer = new char[dataFrameSize];
+  receiveFrameBuffer = new char[dataFrameSize];
+
+  Thread::Info("Controller connected with host side\n");
+  if (buttonNumber % 8 != 0)
+    Thread::Err("Button number is not multiple of 8\n");
+  return true;
 }
 
Index: trunk/lib/FlairSensorActuator/src/TargetEthController.h
===================================================================
--- trunk/lib/FlairSensorActuator/src/TargetEthController.h	(revision 14)
+++ trunk/lib/FlairSensorActuator/src/TargetEthController.h	(revision 15)
@@ -12,5 +12,6 @@
 //
 //  purpose:    class that gets remote controls through an ethernet connection.
-//              Typical use case: a remote control is plugged in a workstation and sends remote control
+//              Typical use case: a remote control is plugged in a workstation
+//              and sends remote control
 //              data to a distant target (this class) through Wifi
 //
@@ -24,62 +25,68 @@
 
 namespace flair {
-    namespace core {
-        class FrameworkManager;
-        class cvmatrix;
-        class TcpSocket;
-        class Socket;
-    }
-    namespace gui {
-        class Tab;
-        class TabWidget;
-        class DataPlot1D;
-    }
+namespace core {
+class FrameworkManager;
+class cvmatrix;
+class TcpSocket;
+class Socket;
+}
+namespace gui {
+class Tab;
+class TabWidget;
+class DataPlot1D;
+}
 }
 
-namespace flair { namespace sensor {
-    /*! \class TargetController
-    *
-    * \brief Base Class for target side remote controls
-    *
-    */
-    class TargetEthController : public TargetController {
-    public:
-        TargetEthController(const core::FrameworkManager* parent,std::string name,uint16_t port,uint8_t priority=0);
-        ~TargetEthController();
-        //void DrawUserInterface();
-    protected:
-        bool IsConnected() const;
-        //axis stuff
-        std::string GetAxisName(unsigned int axisId) const;
-        //button stuff
-        std::string GetButtonName(unsigned int axisId) const;
-        //controller state stuff
-        bool ProcessMessage(core::Message *msg);
-        bool IsControllerActionSupported(ControllerAction action) const;
+namespace flair {
+namespace sensor {
+/*! \class TargetController
+*
+* \brief Base Class for target side remote controls
+*
+*/
+class TargetEthController : public TargetController {
+public:
+  TargetEthController(const core::FrameworkManager *parent, std::string name,
+                      uint16_t port, uint8_t priority = 0);
+  ~TargetEthController();
+  // void DrawUserInterface();
+protected:
+  bool IsConnected() const;
+  // axis stuff
+  std::string GetAxisName(unsigned int axisId) const;
+  // button stuff
+  std::string GetButtonName(unsigned int axisId) const;
+  // controller state stuff
+  bool ProcessMessage(core::Message *msg);
+  bool IsControllerActionSupported(ControllerAction action) const;
 
-        bool IsDataFrameReady();
-        void AcquireAxisData(core::cvmatrix &axis); //responsible for getting the axis data from the hardware
-        void AcquireButtonData(core::cvmatrix &button); //responsible for getting the button data from the hardware
+  bool IsDataFrameReady();
+  void AcquireAxisData(core::cvmatrix &axis); // responsible for getting the
+                                              // axis data from the hardware
+  void AcquireButtonData(core::cvmatrix &button); // responsible for getting the
+                                                  // button data from the
+                                                  // hardware
 
-        bool ControllerInitialization();
+  bool ControllerInitialization();
 
-    private:
-        uint16_t readBits(uint8_t offsetInBits,uint8_t valueSizeInBits,char *buffer,size_t bufferSize);
-        uint8_t getByteOrNull(char *buffer,int byte,size_t bufferSize);
-        uint32_t charBufferToUint32(char *buffer, size_t bufferSize);
-        core::TcpSocket *listeningSocket;
-        int listeningPort;
-        core::TcpSocket *controlSocket=NULL;
-        core::Socket *dataSocket;
-        std::string *axisName=NULL;
-        std::string *buttonName=NULL;
-        size_t dataFrameSize;
-        char *dataFrameBuffer;
-        char *receiveFrameBuffer;
-        size_t receiveCurrentPosition;
-        uint8_t buttonOffset;
-    };
-
-}}
+private:
+  uint16_t readBits(uint8_t offsetInBits, uint8_t valueSizeInBits, char *buffer,
+                    size_t bufferSize);
+  uint8_t getByteOrNull(char *buffer, int byte, size_t bufferSize);
+  uint32_t charBufferToUint32(char *buffer, size_t bufferSize);
+  core::TcpSocket *listeningSocket;
+  int listeningPort;
+  core::TcpSocket *controlSocket = NULL;
+  core::Socket *dataSocket;
+  std::string *axisName = NULL;
+  std::string *buttonName = NULL;
+  size_t dataFrameSize;
+  char *dataFrameBuffer;
+  char *receiveFrameBuffer;
+  size_t receiveCurrentPosition;
+  uint8_t buttonOffset;
+};
+}
+}
 
 #endif // TARGETCONTROLLER_H
Index: trunk/lib/FlairSensorActuator/src/UsRangeFinder.cpp
===================================================================
--- trunk/lib/FlairSensorActuator/src/UsRangeFinder.cpp	(revision 14)
+++ trunk/lib/FlairSensorActuator/src/UsRangeFinder.cpp	(revision 15)
@@ -29,88 +29,67 @@
 using namespace flair::gui;
 
-namespace flair
-{
-namespace sensor
-{
+namespace flair {
+namespace sensor {
 
-UsRangeFinder::UsRangeFinder(const FrameworkManager* parent,string name) : IODevice(parent,name)
-{
-    plot_tab=NULL;
+UsRangeFinder::UsRangeFinder(const FrameworkManager *parent, string name)
+    : IODevice(parent, name) {
+  plot_tab = NULL;
 
-    cvmatrix_descriptor* desc=new cvmatrix_descriptor(1,1);
-    desc->SetElementName(0,0,name);
-    output=new cvmatrix(this,desc,floatType);
-    AddDataToLog(output);
+  cvmatrix_descriptor *desc = new cvmatrix_descriptor(1, 1);
+  desc->SetElementName(0, 0, name);
+  output = new cvmatrix(this, desc, floatType);
+  AddDataToLog(output);
 
-    //station sol
-    main_tab=new Tab(parent->GetTabWidget(),name);
-    tab=new TabWidget(main_tab->NewRow(),name);
-	sensor_tab=new Tab(tab,"Reglages");
-	setup_groupbox=new GroupBox(sensor_tab->NewRow(),name);
+  // station sol
+  main_tab = new Tab(parent->GetTabWidget(), name);
+  tab = new TabWidget(main_tab->NewRow(), name);
+  sensor_tab = new Tab(tab, "Reglages");
+  setup_groupbox = new GroupBox(sensor_tab->NewRow(), name);
 }
 
-UsRangeFinder::UsRangeFinder(const IODevice* parent,std::string name) : IODevice(parent,name)
-{
-    plot_tab=NULL;
-    main_tab=NULL;
-    tab=NULL;
-	sensor_tab=NULL;
-	setup_groupbox=NULL;
+UsRangeFinder::UsRangeFinder(const IODevice *parent, std::string name)
+    : IODevice(parent, name) {
+  plot_tab = NULL;
+  main_tab = NULL;
+  tab = NULL;
+  sensor_tab = NULL;
+  setup_groupbox = NULL;
 
-    output=NULL;
+  output = NULL;
 }
 
-UsRangeFinder::~UsRangeFinder()
-{
-    if(main_tab!=NULL) delete main_tab;
+UsRangeFinder::~UsRangeFinder() {
+  if (main_tab != NULL)
+    delete main_tab;
 }
 
-GroupBox* UsRangeFinder::GetGroupBox(void) const
-{
-    return setup_groupbox;
+GroupBox *UsRangeFinder::GetGroupBox(void) const { return setup_groupbox; }
+
+Layout *UsRangeFinder::GetLayout(void) const { return sensor_tab; }
+
+DataPlot1D *UsRangeFinder::GetPlot(void) const { return plot; }
+
+Tab *UsRangeFinder::GetPlotTab(void) const { return plot_tab; }
+
+void UsRangeFinder::UseDefaultPlot(void) {
+  if (tab == NULL) {
+    Err("not applicable for simulation part.\n");
+    return;
+  }
+
+  plot_tab = new Tab(tab, "Mesures");
+  plot = new DataPlot1D(plot_tab->NewRow(), ObjectName(), 0, 2);
+  plot->AddCurve(output->Element(0));
 }
 
-Layout* UsRangeFinder::GetLayout(void) const
-{
-    return sensor_tab;
+void UsRangeFinder::LockUserInterface(void) const {
+  setup_groupbox->setEnabled(false);
 }
 
-DataPlot1D* UsRangeFinder::GetPlot(void) const
-{
-    return plot;
+void UsRangeFinder::UnlockUserInterface(void) const {
+  setup_groupbox->setEnabled(true);
 }
 
-Tab* UsRangeFinder::GetPlotTab(void) const
-{
-    return plot_tab;
-}
-
-void UsRangeFinder::UseDefaultPlot(void)
-{
-    if(tab==NULL)
-    {
-        Err("not applicable for simulation part.\n");
-        return;
-    }
-
-    plot_tab=new Tab(tab,"Mesures");
-        plot=new DataPlot1D(plot_tab->NewRow(),ObjectName(),0,2);
-            plot->AddCurve(output->Element(0));
-}
-
-void UsRangeFinder::LockUserInterface(void) const
-{
-    setup_groupbox->setEnabled(false);
-}
-
-void UsRangeFinder::UnlockUserInterface(void) const
-{
-    setup_groupbox->setEnabled(true);
-}
-
-float UsRangeFinder::Value(void) const
-{
-    return output->Value(0,0);
-}
+float UsRangeFinder::Value(void) const { return output->Value(0, 0); }
 
 } // end namespace sensor
Index: trunk/lib/FlairSensorActuator/src/UsRangeFinder.h
===================================================================
--- trunk/lib/FlairSensorActuator/src/UsRangeFinder.h	(revision 14)
+++ trunk/lib/FlairSensorActuator/src/UsRangeFinder.h	(revision 15)
@@ -16,139 +16,133 @@
 #include <IODevice.h>
 
-namespace flair
-{
-    namespace core
-    {
-        class cvmatrix;
-    }
-    namespace gui
-    {
-        class Tab;
-        class TabWidget;
-        class GroupBox;
-        class Layout;
-        class DataPlot1D;
-    }
+namespace flair {
+namespace core {
+class cvmatrix;
+}
+namespace gui {
+class Tab;
+class TabWidget;
+class GroupBox;
+class Layout;
+class DataPlot1D;
+}
 }
 
-namespace flair
-{
-namespace sensor
-{
-    /*! \class UsRangeFinder
-    *
-    * \brief Base class for UsRangeFinder
-    *
-    * Use this class to define a custom UsRangeFinder.
-    *
-    */
-    class UsRangeFinder : public core::IODevice
-    {
-        public:
-            /*!
-            * \brief Constructor
-            *
-            * Construct a UsRangeFinder. Control part.
-            *
-            * \param parent parent
-            * \param name name
-            */
-            UsRangeFinder(const core::FrameworkManager* parent,std::string name);
+namespace flair {
+namespace sensor {
+/*! \class UsRangeFinder
+*
+* \brief Base class for UsRangeFinder
+*
+* Use this class to define a custom UsRangeFinder.
+*
+*/
+class UsRangeFinder : public core::IODevice {
+public:
+  /*!
+  * \brief Constructor
+  *
+  * Construct a UsRangeFinder. Control part.
+  *
+  * \param parent parent
+  * \param name name
+  */
+  UsRangeFinder(const core::FrameworkManager *parent, std::string name);
 
-            /*!
-            * \brief Constructor
-            *
-            * Construct a UsRangeFinder. Simulation part.
-            *
-            * \param parent parent
-            * \param name name
-            */
-            UsRangeFinder(const core::IODevice* parent,std::string name);
+  /*!
+  * \brief Constructor
+  *
+  * Construct a UsRangeFinder. Simulation part.
+  *
+  * \param parent parent
+  * \param name name
+  */
+  UsRangeFinder(const core::IODevice *parent, std::string name);
 
-            /*!
-            * \brief Destructor
-            *
-            */
-            ~UsRangeFinder();
+  /*!
+  * \brief Destructor
+  *
+  */
+  ~UsRangeFinder();
 
-            /*!
-            * \brief Lock user interface
-            *
-            */
-            void LockUserInterface(void) const;
+  /*!
+  * \brief Lock user interface
+  *
+  */
+  void LockUserInterface(void) const;
 
-            /*!
-            * \brief Unlock user interface
-            *
-            */
-            void UnlockUserInterface(void) const;
+  /*!
+  * \brief Unlock user interface
+  *
+  */
+  void UnlockUserInterface(void) const;
 
-            /*!
-            * \brief Use default plot
-            *
-            * Should no be used for the simulation part.
-            */
-            void UseDefaultPlot(void);
+  /*!
+  * \brief Use default plot
+  *
+  * Should no be used for the simulation part.
+  */
+  void UseDefaultPlot(void);
 
-            /*!
-            * \brief Plot
-            *
-            * \return DataPlot1D
-            */
-            gui::DataPlot1D* GetPlot(void) const;
+  /*!
+  * \brief Plot
+  *
+  * \return DataPlot1D
+  */
+  gui::DataPlot1D *GetPlot(void) const;
 
-            /*!
-            * \brief Setup Layout
-            *
-            * \return a Layout available
-            */
-            gui::Layout* GetLayout(void) const;
+  /*!
+  * \brief Setup Layout
+  *
+  * \return a Layout available
+  */
+  gui::Layout *GetLayout(void) const;
 
-            /*!
-            * \brief Plot tab
-            *
-            * \return plot Tab
-            */
-            gui::Tab* GetPlotTab(void) const;
+  /*!
+  * \brief Plot tab
+  *
+  * \return plot Tab
+  */
+  gui::Tab *GetPlotTab(void) const;
 
-            /*!
-            * \brief Value
-            *
-            * \return output value
-            */
-            float Value(void) const;
+  /*!
+  * \brief Value
+  *
+  * \return output value
+  */
+  float Value(void) const;
 
-        protected:
-            /*!
-            * \brief Output matrix
-            *
-            * \return output matrix
-            */
-            core::cvmatrix *output;
+protected:
+  /*!
+  * \brief Output matrix
+  *
+  * \return output matrix
+  */
+  core::cvmatrix *output;
 
-            /*!
-            * \brief Setup GroupBox
-            *
-            * \return a GroupBox available
-            */
-            gui::GroupBox* GetGroupBox(void) const;
+  /*!
+  * \brief Setup GroupBox
+  *
+  * \return a GroupBox available
+  */
+  gui::GroupBox *GetGroupBox(void) const;
 
-        private:
-            /*!
-            * \brief Update using provided datas
-            *
-            * Reimplemented from IODevice.
-            *
-            * \param data data from the parent to process
-            */
-            void UpdateFrom(const core::io_data *data){};
+private:
+  /*!
+  * \brief Update using provided datas
+  *
+  * Reimplemented from IODevice.
+  *
+  * \param data data from the parent to process
+  */
+  void UpdateFrom(const core::io_data *data){};
 
-            gui::Tab* main_tab;
-            gui::TabWidget *tab;
-            gui::GroupBox* setup_groupbox;
-            gui::Tab* sensor_tab;
-            gui::DataPlot1D* plot;
-            gui::Tab* plot_tab;
-    };
+  gui::Tab *main_tab;
+  gui::TabWidget *tab;
+  gui::GroupBox *setup_groupbox;
+  gui::Tab *sensor_tab;
+  gui::DataPlot1D *plot;
+  gui::Tab *plot_tab;
+};
 } // end namespace sensor
 } // end namespace flair
Index: trunk/lib/FlairSensorActuator/src/V4LCamera.cpp
===================================================================
--- trunk/lib/FlairSensorActuator/src/V4LCamera.cpp	(revision 14)
+++ trunk/lib/FlairSensorActuator/src/V4LCamera.cpp	(revision 15)
@@ -30,172 +30,167 @@
 using namespace flair::gui;
 
-namespace flair
-{
-namespace sensor
-{
+namespace flair {
+namespace sensor {
 
-V4LCamera::V4LCamera(const FrameworkManager* parent,string name,uint8_t camera_index,uint16_t width,uint16_t height,cvimage::Type::Format format,uint8_t priority) : Thread(parent,name,priority), Camera(parent,name,width,height,format)
-{
-    capture = cvCaptureFromCAM(camera_index);//a mettre apres l'init dsp
+V4LCamera::V4LCamera(const FrameworkManager *parent, string name,
+                     uint8_t camera_index, uint16_t width, uint16_t height,
+                     cvimage::Type::Format format, uint8_t priority)
+    : Thread(parent, name, priority),
+      Camera(parent, name, width, height, format) {
+  capture = cvCaptureFromCAM(camera_index); // a mettre apres l'init dsp
 
-    if(capture<0) Thread::Err("cvCaptureFromCAM error\n");
+  if (capture < 0)
+    Thread::Err("cvCaptureFromCAM error\n");
 
-    if(cvSetCaptureProperty(capture,CV_CAP_PROP_FRAME_WIDTH,width)<0) Thread::Err("cvSetCaptureProperty error\n");
-    if(cvSetCaptureProperty(capture,CV_CAP_PROP_FRAME_HEIGHT,height)<0) Thread::Err("cvSetCaptureProperty error\n");
+  if (cvSetCaptureProperty(capture, CV_CAP_PROP_FRAME_WIDTH, width) < 0)
+    Thread::Err("cvSetCaptureProperty error\n");
+  if (cvSetCaptureProperty(capture, CV_CAP_PROP_FRAME_HEIGHT, height) < 0)
+    Thread::Err("cvSetCaptureProperty error\n");
 
-    if(format==cvimage::Type::Format::UYVY)
-    {
-        if(cvSetCaptureProperty(capture,CV_CAP_PROP_FORMAT,V4L2_PIX_FMT_UYVY)<0) Thread::Err("cvSetCaptureProperty error\n");
-    }
-    else if(format==cvimage::Type::Format::YUYV)
-    {
-        if(cvSetCaptureProperty(capture,CV_CAP_PROP_FORMAT,V4L2_PIX_FMT_YUYV)<0) Thread::Err("cvSetCaptureProperty error\n");
-    }
-    else
-    {
-        Thread::Err("format not supported\n");
+  if (format == cvimage::Type::Format::UYVY) {
+    if (cvSetCaptureProperty(capture, CV_CAP_PROP_FORMAT, V4L2_PIX_FMT_UYVY) <
+        0)
+      Thread::Err("cvSetCaptureProperty error\n");
+  } else if (format == cvimage::Type::Format::YUYV) {
+    if (cvSetCaptureProperty(capture, CV_CAP_PROP_FORMAT, V4L2_PIX_FMT_YUYV) <
+        0)
+      Thread::Err("cvSetCaptureProperty error\n");
+  } else {
+    Thread::Err("format not supported\n");
+  }
+
+  // station sol
+  gain = new DoubleSpinBox(GetGroupBox()->NewRow(), "gain:", 0, 1, 0.1);
+  exposure = new DoubleSpinBox(GetGroupBox()->LastRowLastCol(), "exposure:", 0,
+                               1, 0.1);
+  bright =
+      new DoubleSpinBox(GetGroupBox()->LastRowLastCol(), "bright:", 0, 1, 0.1);
+  contrast = new DoubleSpinBox(GetGroupBox()->LastRowLastCol(), "contrast:", 0,
+                               1, 0.1);
+  hue = new DoubleSpinBox(GetGroupBox()->LastRowLastCol(), "hue:", 0, 1, 0.1);
+  sharpness = new DoubleSpinBox(GetGroupBox()->LastRowLastCol(), "sharpness:",
+                                0, 1, 0.1);
+  sat = new DoubleSpinBox(GetGroupBox()->LastRowLastCol(), "saturation:", 0, 1,
+                          0.1);
+  autogain = new CheckBox(GetGroupBox()->NewRow(), "autogain:");
+  autoexposure = new CheckBox(GetGroupBox()->LastRowLastCol(), "autoexposure:");
+  awb = new CheckBox(GetGroupBox()->LastRowLastCol(), "awb:");
+  fps = new Label(GetGroupBox()->NewRow(), "fps");
+}
+
+V4LCamera::~V4LCamera() {
+  SafeStop();
+  Join();
+}
+
+void V4LCamera::Run(void) {
+  Time cam_time, new_time, fpsNow, fpsPrev;
+  IplImage *img; // raw image
+  int fpsCounter = 0;
+
+  // init image old
+  if (!cvGrabFrame(capture)) {
+    Printf("Could not grab a frame\n");
+  }
+  cam_time = GetTime();
+  fpsPrev = cam_time;
+
+  while (!ToBeStopped()) {
+    // fps counter
+    fpsCounter++;
+    if (fpsCounter == 100) {
+      fpsNow = GetTime();
+      fps->SetText("fps: %.1f",
+                   fpsCounter / ((float)(fpsNow - fpsPrev) / 1000000000.));
+      fpsCounter = 0;
+      fpsPrev = fpsNow;
     }
 
-    //station sol
-    gain=new DoubleSpinBox(GetGroupBox()->NewRow(),"gain:",0,1,0.1);
-    exposure=new DoubleSpinBox(GetGroupBox()->LastRowLastCol(),"exposure:",0,1,0.1);
-    bright=new DoubleSpinBox(GetGroupBox()->LastRowLastCol(),"bright:",0,1,0.1);
-    contrast=new DoubleSpinBox(GetGroupBox()->LastRowLastCol(),"contrast:",0,1,0.1);
-    hue=new DoubleSpinBox(GetGroupBox()->LastRowLastCol(),"hue:",0,1,0.1);
-    sharpness=new DoubleSpinBox(GetGroupBox()->LastRowLastCol(),"sharpness:",0,1,0.1);
-    sat=new DoubleSpinBox(GetGroupBox()->LastRowLastCol(),"saturation:",0,1,0.1);
-    autogain=new CheckBox(GetGroupBox()->NewRow(),"autogain:");
-    autoexposure=new CheckBox(GetGroupBox()->LastRowLastCol(),"autoexposure:");
-    awb=new CheckBox(GetGroupBox()->LastRowLastCol(),"awb:");
-    fps=new Label(GetGroupBox()->NewRow(),"fps");
+    // cam properties
+    if (gain->ValueChanged() == true && autogain->Value() == false)
+      SetGain(gain->Value());
+    if (exposure->ValueChanged() == true && autoexposure->Value() == false)
+      SetExposure(exposure->Value());
+    if (bright->ValueChanged() == true)
+      SetBrightness(bright->Value());
+    if (sat->ValueChanged() == true)
+      SetSaturation(sat->Value());
+    if (contrast->ValueChanged() == true)
+      SetContrast(contrast->Value());
+    if (hue->ValueChanged() == true)
+      SetHue(hue->Value());
+    if (sharpness->ValueChanged() == true)
+      cvSetCaptureProperty(capture, CV_CAP_PROP_SHARPNESS, sharpness->Value());
+    if (autogain->ValueChanged() == true) {
+      if (autogain->Value() == true) {
+        gain->setEnabled(false);
+      } else {
+        gain->setEnabled(true);
+        SetGain(gain->Value());
+      }
+      SetAutoGain(autogain->Value());
+    }
+    if (autoexposure->ValueChanged() == true) {
+      if (autoexposure->Value() == true) {
+        exposure->setEnabled(false);
+      } else {
+        exposure->setEnabled(true);
+        SetExposure(exposure->Value());
+      }
+      SetAutoExposure(autoexposure->Value());
+    }
+    if (awb->ValueChanged() == true)
+      cvSetCaptureProperty(capture, CV_CAP_PROP_AWB, awb->Value());
+
+    // cam pictures
+    img = cvRetrieveRawFrame(capture);
+    if (!cvGrabFrame(capture)) {
+      Printf("Could not grab a frame\n");
+    }
+    new_time = GetTime();
+
+    output->GetMutex();
+    output->img->imageData = img->imageData;
+    output->ReleaseMutex();
+
+    output->SetDataTime(cam_time);
+    ProcessUpdate(output);
+
+    cam_time = new_time;
+  }
+
+  cvReleaseCapture(&capture);
 }
 
-V4LCamera::~V4LCamera()
-{
-    SafeStop();
-    Join();
+void V4LCamera::SetAutoGain(bool value) {
+  cvSetCaptureProperty(capture, CV_CAP_PROP_AUTOGAIN, value);
 }
 
-void V4LCamera::Run(void)
-{
-    Time cam_time,new_time,fpsNow,fpsPrev;
-    IplImage* img;//raw image
-    int fpsCounter=0;
-
-    //init image old
-    if(!cvGrabFrame(capture))
-    {
-        Printf("Could not grab a frame\n");
-    }
-    cam_time=GetTime();
-    fpsPrev = cam_time;
-
-    while(!ToBeStopped())
-    {
-        //fps counter
-        fpsCounter++;
-        if(fpsCounter==100) {
-            fpsNow = GetTime();
-            fps->SetText("fps: %.1f",fpsCounter/((float)(fpsNow - fpsPrev)/1000000000.));
-            fpsCounter=0;
-            fpsPrev=fpsNow;
-        }
-
-        //cam properties
-        if(gain->ValueChanged()==true && autogain->Value()==false) SetGain(gain->Value());
-        if(exposure->ValueChanged()==true && autoexposure->Value()==false) SetExposure(exposure->Value());
-        if(bright->ValueChanged()==true) SetBrightness(bright->Value());
-        if(sat->ValueChanged()==true) SetSaturation(sat->Value());
-        if(contrast->ValueChanged()==true) SetContrast(contrast->Value());
-        if(hue->ValueChanged()==true) SetHue(hue->Value());
-        if(sharpness->ValueChanged()==true) cvSetCaptureProperty(capture,CV_CAP_PROP_SHARPNESS,sharpness->Value());
-        if(autogain->ValueChanged()==true)
-        {
-            if(autogain->Value()==true)
-            {
-                gain->setEnabled(false);
-            }
-            else
-            {
-                gain->setEnabled(true);
-                SetGain(gain->Value());
-            }
-            SetAutoGain(autogain->Value());
-        }
-        if(autoexposure->ValueChanged()==true)
-        {
-            if(autoexposure->Value()==true)
-            {
-                exposure->setEnabled(false);
-            }
-            else
-            {
-                exposure->setEnabled(true);
-                SetExposure(exposure->Value());
-            }
-            SetAutoExposure(autoexposure->Value());
-        }
-        if(awb->ValueChanged()==true) cvSetCaptureProperty(capture,CV_CAP_PROP_AWB,awb->Value());
-
-
-        //cam pictures
-        img=cvRetrieveRawFrame(capture);
-        if(!cvGrabFrame(capture))
-        {
-            Printf("Could not grab a frame\n");
-        }
-        new_time=GetTime();
-
-        output->GetMutex();
-        output->img->imageData=img->imageData;
-        output->ReleaseMutex();
-
-        output->SetDataTime(cam_time);
-        ProcessUpdate(output);
-
-        cam_time=new_time;
-    }
-
-    cvReleaseCapture(&capture);
+void V4LCamera::SetAutoExposure(bool value) {
+  Thread::Warn("not implemented in opencv\n");
 }
 
-void V4LCamera::SetAutoGain(bool value)
-{
-    cvSetCaptureProperty(capture,CV_CAP_PROP_AUTOGAIN,value);
+void V4LCamera::SetGain(float value) {
+  cvSetCaptureProperty(capture, CV_CAP_PROP_GAIN, value);
 }
 
-void V4LCamera::SetAutoExposure(bool value)
-{
-    Thread::Warn("not implemented in opencv\n");
+void V4LCamera::SetExposure(float value) {
+  cvSetCaptureProperty(capture, CV_CAP_PROP_EXPOSURE, value);
 }
 
-void V4LCamera::SetGain(float value)
-{
-    cvSetCaptureProperty(capture,CV_CAP_PROP_GAIN,value);
+void V4LCamera::SetBrightness(float value) {
+  cvSetCaptureProperty(capture, CV_CAP_PROP_BRIGHTNESS, value);
 }
 
-void V4LCamera::SetExposure(float value)
-{
-    cvSetCaptureProperty(capture,CV_CAP_PROP_EXPOSURE,value);
+void V4LCamera::SetSaturation(float value) {
+  cvSetCaptureProperty(capture, CV_CAP_PROP_SATURATION, value);
 }
 
-void V4LCamera::SetBrightness(float value)
-{
-    cvSetCaptureProperty(capture,CV_CAP_PROP_BRIGHTNESS,value);
+void V4LCamera::SetHue(float value) {
+  cvSetCaptureProperty(capture, CV_CAP_PROP_HUE, value);
 }
 
-void V4LCamera::SetSaturation(float value)
-{
-    cvSetCaptureProperty(capture,CV_CAP_PROP_SATURATION,value);
-}
-
-void V4LCamera::SetHue(float value)
-{
-    cvSetCaptureProperty(capture,CV_CAP_PROP_HUE,value);
-}
-
-void V4LCamera::SetContrast(float value)
-{
-    cvSetCaptureProperty(capture,CV_CAP_PROP_CONTRAST,value);
+void V4LCamera::SetContrast(float value) {
+  cvSetCaptureProperty(capture, CV_CAP_PROP_CONTRAST, value);
 }
 
Index: trunk/lib/FlairSensorActuator/src/V4LCamera.h
===================================================================
--- trunk/lib/FlairSensorActuator/src/V4LCamera.h	(revision 14)
+++ trunk/lib/FlairSensorActuator/src/V4LCamera.h	(revision 15)
@@ -18,134 +18,131 @@
 #include <highgui.h>
 
-namespace flair
-{
-    namespace core
-    {
-        class cvimage;
-        class FrameworkManager;
-    }
-    namespace gui
-    {
-        class GridLayout;
-        class DoubleSpinBox;
-        class CheckBox;
-        class Label;
-    }
+namespace flair {
+namespace core {
+class cvimage;
+class FrameworkManager;
+}
+namespace gui {
+class GridLayout;
+class DoubleSpinBox;
+class CheckBox;
+class Label;
+}
 }
 
-namespace flair
-{
-namespace sensor
-{
-    /*! \class V4LCamera
-    *
-    * \brief Base class for V4l camera
-    */
-    class V4LCamera : public core::Thread, public Camera
-    {
-        public:
-            /*!
-            * \brief Constructor
-            *
-            * Construct a Camera.
-            *
-            * \param parent parent
-            * \param name name
-            * \param camera_index camera index
-            * \param width width
-            * \param height height
-            * \param format image format
-            * \param priority priority of the Thread
-            */
-            V4LCamera(const core::FrameworkManager* parent,std::string name,uint8_t camera_index,uint16_t width,uint16_t height,core::cvimage::Type::Format format,uint8_t priority);
+namespace flair {
+namespace sensor {
+/*! \class V4LCamera
+*
+* \brief Base class for V4l camera
+*/
+class V4LCamera : public core::Thread, public Camera {
+public:
+  /*!
+  * \brief Constructor
+  *
+  * Construct a Camera.
+  *
+  * \param parent parent
+  * \param name name
+  * \param camera_index camera index
+  * \param width width
+  * \param height height
+  * \param format image format
+  * \param priority priority of the Thread
+  */
+  V4LCamera(const core::FrameworkManager *parent, std::string name,
+            uint8_t camera_index, uint16_t width, uint16_t height,
+            core::cvimage::Type::Format format, uint8_t priority);
 
-            /*!
-            * \brief Destructor
-            *
-            */
-            ~V4LCamera();
+  /*!
+  * \brief Destructor
+  *
+  */
+  ~V4LCamera();
 
-        protected:
-            /*!
-            * \brief Set Gain
-            *
-            * \param value value between 0 and 1
-            */
-            virtual void SetGain(float value);
+protected:
+  /*!
+  * \brief Set Gain
+  *
+  * \param value value between 0 and 1
+  */
+  virtual void SetGain(float value);
 
-            /*!
-            * \brief Set Auto Gain
-            *
-            * \param value value
-            */
-            virtual void SetAutoGain(bool value);
+  /*!
+  * \brief Set Auto Gain
+  *
+  * \param value value
+  */
+  virtual void SetAutoGain(bool value);
 
-            /*!
-            * \brief Set Exposure
-            *
-            * \param value value between 0 and 1
-            */
-            virtual void SetExposure(float value);
+  /*!
+  * \brief Set Exposure
+  *
+  * \param value value between 0 and 1
+  */
+  virtual void SetExposure(float value);
 
-            /*!
-            * \brief Set Auto Exposure
-            *
-            * \param value value
-            */
-            virtual void SetAutoExposure(bool value);
+  /*!
+  * \brief Set Auto Exposure
+  *
+  * \param value value
+  */
+  virtual void SetAutoExposure(bool value);
 
-            /*!
-            * \brief Set Brightness
-            *
-            * \param value value between 0 and 1
-            */
-            virtual void SetBrightness(float value);
+  /*!
+  * \brief Set Brightness
+  *
+  * \param value value between 0 and 1
+  */
+  virtual void SetBrightness(float value);
 
-            /*!
-            * \brief Set Saturation
-            *
-            * \param value value between 0 and 1
-            */
-            virtual void SetSaturation(float value);
+  /*!
+  * \brief Set Saturation
+  *
+  * \param value value between 0 and 1
+  */
+  virtual void SetSaturation(float value);
 
-            /*!
-            * \brief Set Hue
-            *
-            * \param value value between 0 and 1
-            */
-            virtual void SetHue(float value);
+  /*!
+  * \brief Set Hue
+  *
+  * \param value value between 0 and 1
+  */
+  virtual void SetHue(float value);
 
-            /*!
-            * \brief Set Contrast
-            *
-            * \param value value between 0 and 1
-            */
-            virtual void SetContrast(float value);
+  /*!
+  * \brief Set Contrast
+  *
+  * \param value value between 0 and 1
+  */
+  virtual void SetContrast(float value);
 
-        private:
-            /*!
-            * \brief Update using provided datas
-            *
-            * Reimplemented from IODevice.
-            *
-            * \param data data from the parent to process
-            */
-            void UpdateFrom(const core::io_data *data){};
+private:
+  /*!
+  * \brief Update using provided datas
+  *
+  * Reimplemented from IODevice.
+  *
+  * \param data data from the parent to process
+  */
+  void UpdateFrom(const core::io_data *data){};
 
-            /*!
-            * \brief Run function
-            *
-            * Reimplemented from Thread.
-            *
-            */
-            void Run(void);
+  /*!
+  * \brief Run function
+  *
+  * Reimplemented from Thread.
+  *
+  */
+  void Run(void);
 
-            CvCapture* capture;
+  CvCapture *capture;
 
-            gui::Tab* sensor_tab;
-            gui::DoubleSpinBox *bright,*exposure,*gain,*contrast,*hue,*sharpness,*sat;
-            gui::CheckBox *autogain,*awb,*autoexposure;
-            gui::Label *fps;
-    };
+  gui::Tab *sensor_tab;
+  gui::DoubleSpinBox *bright, *exposure, *gain, *contrast, *hue, *sharpness,
+      *sat;
+  gui::CheckBox *autogain, *awb, *autoexposure;
+  gui::Label *fps;
+};
 } // end namespace sensor
 } // end namespace flair
Index: trunk/lib/FlairSensorActuator/src/VrpnClient.cpp
===================================================================
--- trunk/lib/FlairSensorActuator/src/VrpnClient.cpp	(revision 14)
+++ trunk/lib/FlairSensorActuator/src/VrpnClient.cpp	(revision 15)
@@ -26,46 +26,36 @@
 using namespace flair::gui;
 
-namespace flair
-{
-namespace sensor
-{
+namespace flair {
+namespace sensor {
 
-VrpnClient::VrpnClient(const FrameworkManager* parent,string name,string address,uint16_t us_period,uint8_t priority): Thread(parent,name,priority)
-{
-    pimpl_=new VrpnClient_impl(this,name,address,us_period);
+VrpnClient::VrpnClient(const FrameworkManager *parent, string name,
+                       string address, uint16_t us_period, uint8_t priority)
+    : Thread(parent, name, priority) {
+  pimpl_ = new VrpnClient_impl(this, name, address, us_period);
 }
 
-VrpnClient::VrpnClient(const FrameworkManager* parent,string name,SerialPort* serialport,uint16_t us_period,uint8_t priority): Thread(parent,name,priority)
-{
-    pimpl_=new VrpnClient_impl(this,name,serialport,us_period);
+VrpnClient::VrpnClient(const FrameworkManager *parent, string name,
+                       SerialPort *serialport, uint16_t us_period,
+                       uint8_t priority)
+    : Thread(parent, name, priority) {
+  pimpl_ = new VrpnClient_impl(this, name, serialport, us_period);
 }
 
-VrpnClient::~VrpnClient()
-{
-    SafeStop();
-    Join();
+VrpnClient::~VrpnClient() {
+  SafeStop();
+  Join();
 
-    delete pimpl_;
+  delete pimpl_;
 }
 
-Layout* VrpnClient::GetLayout(void) const
-{
-    return (Layout*)(pimpl_->setup_tab);
+Layout *VrpnClient::GetLayout(void) const {
+  return (Layout *)(pimpl_->setup_tab);
 }
 
-TabWidget* VrpnClient::GetTabWidget(void) const
-{
-    return pimpl_->tab;
-}
+TabWidget *VrpnClient::GetTabWidget(void) const { return pimpl_->tab; }
 
-bool VrpnClient::UseXbee(void) const
-{
-    return pimpl_->UseXbee();
-}
+bool VrpnClient::UseXbee(void) const { return pimpl_->UseXbee(); }
 
-void VrpnClient::Run(void)
-{
-    pimpl_->Run();
-}
+void VrpnClient::Run(void) { pimpl_->Run(); }
 
 } // end namespace sensor
Index: trunk/lib/FlairSensorActuator/src/VrpnClient.h
===================================================================
--- trunk/lib/FlairSensorActuator/src/VrpnClient.h	(revision 14)
+++ trunk/lib/FlairSensorActuator/src/VrpnClient.h	(revision 15)
@@ -6,5 +6,6 @@
  * \file VrpnClient.h
  * \brief Class to connect to a Vrpn server
- * \author César Richard, Guillaume Sanahuja, Copyright Heudiasyc UMR UTC/CNRS 7253
+ * \author César Richard, Guillaume Sanahuja, Copyright Heudiasyc UMR UTC/CNRS
+ * 7253
  * \date 2013/04/03
  * \version 4.0
@@ -16,16 +17,13 @@
 #include <Thread.h>
 
-namespace flair
-{
-    namespace core
-    {
-        class FrameworkManager;
-        class SerialPort;
-    }
-    namespace gui
-    {
-        class TabWidget;
-        class Layout;
-    }
+namespace flair {
+namespace core {
+class FrameworkManager;
+class SerialPort;
+}
+namespace gui {
+class TabWidget;
+class Layout;
+}
 }
 
@@ -33,81 +31,81 @@
 class VrpnObject_impl;
 
-namespace flair
-{
-namespace sensor
-{
-    /*! \class VrpnClient
-    *
-    * \brief Class to connect to a Vrpn server
-    */
-    class VrpnClient:public core::Thread
-    {
-        friend class ::VrpnObject_impl;
+namespace flair {
+namespace sensor {
+/*! \class VrpnClient
+*
+* \brief Class to connect to a Vrpn server
+*/
+class VrpnClient : public core::Thread {
+  friend class ::VrpnObject_impl;
 
-        public:
-            /*!
-            * \brief Constructor
-            *
-            * Construct a VrpnClient. Connection is done by IP.
-            *
-            * \param parent parent
-            * \param name name
-            * \param address server address
-            * \param us_period Thread period in us
-            * \param priority priority of the Thread
-            */
-            VrpnClient(const core::FrameworkManager* parent,std::string name,std::string address,uint16_t us_period,uint8_t priority);
+public:
+  /*!
+  * \brief Constructor
+  *
+  * Construct a VrpnClient. Connection is done by IP.
+  *
+  * \param parent parent
+  * \param name name
+  * \param address server address
+  * \param us_period Thread period in us
+  * \param priority priority of the Thread
+  */
+  VrpnClient(const core::FrameworkManager *parent, std::string name,
+             std::string address, uint16_t us_period, uint8_t priority);
 
-            /*!
-            * \brief Constructor
-            *
-            * Construct a VrpnClient. Connection is done by XBee modem.
-            *
-            * \param parent parent
-            * \param name name
-            * \param serialport SerialPort for XBee modem
-            * \param us_period Xbee RX timeout in us
-            * \param priority priority of the Thread
-            */
-            VrpnClient(const core::FrameworkManager* parent,std::string name,core::SerialPort* serialport,uint16_t us_period,uint8_t priority);
+  /*!
+  * \brief Constructor
+  *
+  * Construct a VrpnClient. Connection is done by XBee modem.
+  *
+  * \param parent parent
+  * \param name name
+  * \param serialport SerialPort for XBee modem
+  * \param us_period Xbee RX timeout in us
+  * \param priority priority of the Thread
+  */
+  VrpnClient(const core::FrameworkManager *parent, std::string name,
+             core::SerialPort *serialport, uint16_t us_period,
+             uint8_t priority);
 
-            /*!
-            * \brief Destructor
-            *
-            */
-            ~VrpnClient();
+  /*!
+  * \brief Destructor
+  *
+  */
+  ~VrpnClient();
 
-            /*!
-            * \brief Setup Layout
-            *
-            * \return a Layout available
-            */
-            gui::Layout* GetLayout(void) const;
+  /*!
+  * \brief Setup Layout
+  *
+  * \return a Layout available
+  */
+  gui::Layout *GetLayout(void) const;
 
-            /*!
-            * \brief Setup Tab
-            *
-            * \return a Tab available
-            */
-            gui::TabWidget* GetTabWidget(void) const;
+  /*!
+  * \brief Setup Tab
+  *
+  * \return a Tab available
+  */
+  gui::TabWidget *GetTabWidget(void) const;
 
-            /*!
-            * \brief Is XBee used?
-            *
-            * \return true if connection is based on XBee modem
-            */
-            bool UseXbee(void) const;
+  /*!
+  * \brief Is XBee used?
+  *
+  * \return true if connection is based on XBee modem
+  */
+  bool UseXbee(void) const;
 
-        private:
-            /*!
-            * \brief Run function
-            *
-            * Reimplemented from Thread.
-            *
-            */
-            void Run(void);
+private:
+  /*!
+  * \brief Run function
+  *
+  * Reimplemented from Thread.
+  *
+  */
+  void Run(void);
 
-            class VrpnClient_impl* pimpl_;
-    };
+  class VrpnClient_impl *pimpl_;
+};
 } // end namespace sensor
 } // end namespace flair
Index: trunk/lib/FlairSensorActuator/src/VrpnClient_impl.cpp
===================================================================
--- trunk/lib/FlairSensorActuator/src/VrpnClient_impl.cpp	(revision 14)
+++ trunk/lib/FlairSensorActuator/src/VrpnClient_impl.cpp	(revision 15)
@@ -41,206 +41,182 @@
 using namespace flair::sensor;
 
-VrpnClient_impl::VrpnClient_impl(VrpnClient* self,std::string name,std::string address,uint16_t us_period)
-{
-    this->us_period=us_period;
-    this->self=self;
-    serialport=NULL;
-
-    mutex=new Mutex(self,name);
-
-    connection = vrpn_get_connection_by_name(address.c_str());
-
-    //station sol
-    main_tab=new Tab(getFrameworkManager()->GetTabWidget(),name);
-    tab=new TabWidget(main_tab->NewRow(),name);
-    setup_tab=new Tab(tab,"Reglages");
-
-    rotation_1=new OneAxisRotation(setup_tab->NewRow(),"post rotation 1");
-    rotation_2=new OneAxisRotation(setup_tab->NewRow(),"post rotation 2");
-}
-
-VrpnClient_impl::VrpnClient_impl(VrpnClient* self,std::string name,SerialPort* serialport,uint16_t us_period)
-{
-    this->us_period=us_period;
-    this->self=self;
-    this->serialport=serialport;
-    connection=NULL;
-    mutex=new Mutex(self,name);
-
-    serialport->SetBaudrate(111111);
-    serialport->SetRxTimeout(us_period*1000);
-
-    //station sol
-    main_tab=new Tab(getFrameworkManager()->GetTabWidget(),name);
-    tab=new TabWidget(main_tab->NewRow(),name);
-    setup_tab=new Tab(tab,"Reglages");
-
-    rotation_1=new OneAxisRotation(setup_tab->NewRow(),"post rotation 1");
-    rotation_2=new OneAxisRotation(setup_tab->NewRow(),"post rotation 2");
-}
-
-VrpnClient_impl::~VrpnClient_impl()
-{
-    if(!UseXbee())
-    {
-        //on fait une copie car le delete touche a xbee_objects_copy via RemoveTrackable
-        vector<VrpnObject*> trackables_copy=trackables;
-        for(unsigned int i=0;i<trackables_copy.size();i++) delete trackables_copy.at(i);
-        //trackables.clear();
+VrpnClient_impl::VrpnClient_impl(VrpnClient *self, std::string name,
+                                 std::string address, uint16_t us_period) {
+  this->us_period = us_period;
+  this->self = self;
+  serialport = NULL;
+
+  mutex = new Mutex(self, name);
+
+  connection = vrpn_get_connection_by_name(address.c_str());
+
+  // station sol
+  main_tab = new Tab(getFrameworkManager()->GetTabWidget(), name);
+  tab = new TabWidget(main_tab->NewRow(), name);
+  setup_tab = new Tab(tab, "Reglages");
+
+  rotation_1 = new OneAxisRotation(setup_tab->NewRow(), "post rotation 1");
+  rotation_2 = new OneAxisRotation(setup_tab->NewRow(), "post rotation 2");
+}
+
+VrpnClient_impl::VrpnClient_impl(VrpnClient *self, std::string name,
+                                 SerialPort *serialport, uint16_t us_period) {
+  this->us_period = us_period;
+  this->self = self;
+  this->serialport = serialport;
+  connection = NULL;
+  mutex = new Mutex(self, name);
+
+  serialport->SetBaudrate(111111);
+  serialport->SetRxTimeout(us_period * 1000);
+
+  // station sol
+  main_tab = new Tab(getFrameworkManager()->GetTabWidget(), name);
+  tab = new TabWidget(main_tab->NewRow(), name);
+  setup_tab = new Tab(tab, "Reglages");
+
+  rotation_1 = new OneAxisRotation(setup_tab->NewRow(), "post rotation 1");
+  rotation_2 = new OneAxisRotation(setup_tab->NewRow(), "post rotation 2");
+}
+
+VrpnClient_impl::~VrpnClient_impl() {
+  if (!UseXbee()) {
+    // on fait une copie car le delete touche a xbee_objects_copy via
+    // RemoveTrackable
+    vector<VrpnObject *> trackables_copy = trackables;
+    for (unsigned int i = 0; i < trackables_copy.size(); i++)
+      delete trackables_copy.at(i);
+    // trackables.clear();
+  } else {
+    // on fait une copie car le delete touche a xbee_objects_copy via
+    // RemoveTrackable
+    vector<xbee_object> xbee_objects_copy = xbee_objects;
+    for (unsigned int i = 0; i < xbee_objects_copy.size(); i++)
+      delete xbee_objects_copy.at(i).vrpnobject->self;
+  }
+
+  delete main_tab;
+
+  if (!UseXbee()) {
+    // it will automatically delete connection
+    connection->removeReference();
+  }
+}
+
+void VrpnClient_impl::ComputeRotations(Vector3D &point) {
+  rotation_1->ComputeRotation(point);
+  rotation_2->ComputeRotation(point);
+}
+
+void VrpnClient_impl::ComputeRotations(Quaternion &quat) {
+  rotation_1->ComputeRotation(quat);
+  rotation_2->ComputeRotation(quat);
+}
+
+void VrpnClient_impl::AddTrackable(VrpnObject *obj) {
+  mutex->GetMutex();
+  trackables.push_back(obj);
+  mutex->ReleaseMutex();
+}
+
+void VrpnClient_impl::RemoveTrackable(VrpnObject *obj) {
+  mutex->GetMutex();
+  for (vector<VrpnObject *>::iterator it = trackables.begin();
+       it < trackables.end(); it++) {
+    if (*it == obj) {
+      trackables.erase(it);
+      break;
     }
-    else
-    {
-        //on fait une copie car le delete touche a xbee_objects_copy via RemoveTrackable
-        vector<xbee_object> xbee_objects_copy=xbee_objects;
-        for(unsigned int i=0;i<xbee_objects_copy.size();i++) delete xbee_objects_copy.at(i).vrpnobject->self;
+  }
+  mutex->ReleaseMutex();
+}
+
+void VrpnClient_impl::AddTrackable(VrpnObject_impl *obj, uint8_t id) {
+  xbee_object tmp;
+  tmp.vrpnobject = obj;
+  tmp.id = id;
+  mutex->GetMutex();
+  xbee_objects.push_back(tmp);
+  mutex->ReleaseMutex();
+}
+
+void VrpnClient_impl::RemoveTrackable(VrpnObject_impl *obj) {
+  mutex->GetMutex();
+  for (vector<xbee_object>::iterator it = xbee_objects.begin();
+       it < xbee_objects.end(); it++) {
+    if ((*it).vrpnobject == obj) {
+      xbee_objects.erase(it);
+      break;
     }
-
-    delete main_tab;
-
-    if(!UseXbee())
-    {
-        //it will automatically delete connection
-        connection->removeReference();
+  }
+  mutex->ReleaseMutex();
+}
+
+bool VrpnClient_impl::UseXbee(void) {
+  if (connection == NULL) {
+    return true;
+  } else {
+    return false;
+  }
+}
+
+void VrpnClient_impl::Run(void) {
+  while (!self->ToBeStopped()) {
+    if (UseXbee()) {
+      ssize_t read = 0;
+      uint8_t response[38] = {0};
+
+      read = serialport->Read(response, sizeof(response));
+      if (read > 0 && read != sizeof(response))
+        read += serialport->Read(&response[read], sizeof(response) - read);
+      // int temps=(float)self->GetTime()/(1000*1000);
+      // self->Printf("%i %i %i\n",temps-last,temps,last);
+      // last=temps;
+      if (read < 0) {
+        // self->Warn("erreur rt_dev_read (%s)\n",strerror(-read));
+      } else if (read != sizeof(response)) {
+        self->Warn("erreur rt_dev_read %i/%i\n", read, sizeof(response));
+      } else {
+        // for(ssize_t i=0;i<read;i++) printf("%x ",response[i]);
+        // printf("\n");
+        uint8_t checksum = 0;
+        for (ssize_t i = 3; i < read; i++)
+          checksum += response[i];
+        if (checksum != 255) {
+          self->Err("checksum error\n");
+        } else {
+          vrpn_TRACKERCB t;
+          float pos[3];
+          float quat[4];
+          uint8_t id = response[8];
+
+          mutex->GetMutex();
+          if (id < xbee_objects.size()) {
+            memcpy(pos, &response[9], sizeof(pos));
+            memcpy(quat, &response[9] + sizeof(pos), sizeof(quat));
+            for (int i = 0; i < 3; i++)
+              t.pos[i] = pos[i];
+            for (int i = 0; i < 4; i++)
+              t.quat[i] = quat[i];
+            if (fabs(pos[0] > 10) || fabs(pos[1] > 10) || fabs(pos[2] > 10)) {
+              printf("prob pos %f %f %f\n", pos[0], pos[1], pos[2]);
+            } else {
+              // self->Printf("%i %f %f %f
+              // %f\n",id,pos[0],pos[1],pos[2],(float)self->GetTime()/(1000*1000));
+              VrpnObject_impl::handle_pos(xbee_objects.at(id).vrpnobject, t);
+            }
+          }
+          mutex->ReleaseMutex();
+        }
+      }
+    } else {
+      connection->mainloop();
+      mutex->GetMutex();
+      for (unsigned int i = 0; i < trackables.size(); i++)
+        trackables.at(i)->mainloop();
+      mutex->ReleaseMutex();
+
+      self->SleepUS(us_period);
     }
-}
-
-void VrpnClient_impl::ComputeRotations(Vector3D& point)
-{
-    rotation_1->ComputeRotation(point);
-    rotation_2->ComputeRotation(point);
-}
-
-void VrpnClient_impl::ComputeRotations(Quaternion& quat)
-{
-    rotation_1->ComputeRotation(quat);
-    rotation_2->ComputeRotation(quat);
-}
-
-void VrpnClient_impl::AddTrackable(VrpnObject* obj)
-{
-    mutex->GetMutex();
-    trackables.push_back(obj);
-    mutex->ReleaseMutex();
-}
-
-void VrpnClient_impl::RemoveTrackable(VrpnObject* obj)
-{
-    mutex->GetMutex();
-    for(vector<VrpnObject*>::iterator it=trackables.begin() ; it < trackables.end(); it++ )
-    {
-        if(*it==obj)
-        {
-            trackables.erase (it);
-            break;
-        }
-    }
-    mutex->ReleaseMutex();
-}
-
-void VrpnClient_impl::AddTrackable(VrpnObject_impl* obj,uint8_t id)
-{
-    xbee_object tmp;
-    tmp.vrpnobject=obj;
-    tmp.id=id;
-    mutex->GetMutex();
-    xbee_objects.push_back(tmp);
-    mutex->ReleaseMutex();
-}
-
-void VrpnClient_impl::RemoveTrackable(VrpnObject_impl* obj)
-{
-    mutex->GetMutex();
-    for(vector<xbee_object>::iterator it=xbee_objects.begin() ; it < xbee_objects.end(); it++ )
-    {
-        if((*it).vrpnobject==obj)
-        {
-            xbee_objects.erase (it);
-            break;
-        }
-    }
-    mutex->ReleaseMutex();
-}
-
-bool VrpnClient_impl::UseXbee(void)
-{
-    if(connection==NULL)
-    {
-        return true;
-    }
-    else
-    {
-        return false;
-    }
-}
-
-void VrpnClient_impl::Run(void)
-{
-    while(!self->ToBeStopped())
-    {
-        if(UseXbee())
-        {
-            ssize_t read = 0;
-            uint8_t response[38] = {0};
-
-            read = serialport->Read(response,sizeof(response));
-            if(read>0 && read!=sizeof(response)) read += serialport->Read(&response[read],sizeof(response)-read);
-            //int temps=(float)self->GetTime()/(1000*1000);
-//self->Printf("%i %i %i\n",temps-last,temps,last);
-//last=temps;
-            if(read<0)
-            {
-                //self->Warn("erreur rt_dev_read (%s)\n",strerror(-read));
-            }
-            else if (read != sizeof(response))
-            {
-                self->Warn("erreur rt_dev_read %i/%i\n",read,sizeof(response));
-            }
-            else
-            {
-                //for(ssize_t i=0;i<read;i++) printf("%x ",response[i]);
-                //printf("\n");
-                uint8_t checksum=0;
-                for(ssize_t i=3;i<read;i++) checksum+=response[i];
-                if(checksum!=255)
-                {
-                    self->Err("checksum error\n");
-                }
-                else
-                {
-                    vrpn_TRACKERCB t;
-                    float pos[3];
-                    float quat[4];
-                    uint8_t id=response[8];
-
-                    mutex->GetMutex();
-                    if(id<xbee_objects.size())
-                    {
-                        memcpy(pos,&response[9],sizeof(pos));
-                        memcpy(quat,&response[9]+sizeof(pos),sizeof(quat));
-                        for(int i=0;i<3;i++) t.pos[i]=pos[i];
-                        for(int i=0;i<4;i++) t.quat[i]=quat[i];
-                        if(fabs(pos[0]>10) || fabs(pos[1]>10) || fabs(pos[2]>10))
-                        {
-                            printf("prob pos %f %f %f\n",pos[0],pos[1],pos[2]);
-                        }
-                        else
-                        {
-                            //self->Printf("%i %f %f %f %f\n",id,pos[0],pos[1],pos[2],(float)self->GetTime()/(1000*1000));
-                            VrpnObject_impl::handle_pos(xbee_objects.at(id).vrpnobject,t);
-                        }
-                    }
-                    mutex->ReleaseMutex();
-                }
-            }
-        }
-        else
-        {
-            connection->mainloop();
-            mutex->GetMutex();
-            for(unsigned int i=0;i<trackables.size();i++) trackables.at(i)->mainloop();
-            mutex->ReleaseMutex();
-
-            self->SleepUS(us_period);
-        }
-    }
-}
+  }
+}
Index: trunk/lib/FlairSensorActuator/src/VrpnObject.cpp
===================================================================
--- trunk/lib/FlairSensorActuator/src/VrpnObject.cpp	(revision 14)
+++ trunk/lib/FlairSensorActuator/src/VrpnObject.cpp	(revision 15)
@@ -27,85 +27,55 @@
 using namespace flair::gui;
 
-namespace flair
-{
-namespace sensor
-{
+namespace flair {
+namespace sensor {
 
-VrpnObject::VrpnObject(const VrpnClient *parent,string name,const TabWidget* tab): IODevice(parent,name)
-{
-    pimpl_=new VrpnObject_impl(this,parent,name,-1,tab);
-    AddDataToLog(pimpl_->output);
+VrpnObject::VrpnObject(const VrpnClient *parent, string name,
+                       const TabWidget *tab)
+    : IODevice(parent, name) {
+  pimpl_ = new VrpnObject_impl(this, parent, name, -1, tab);
+  AddDataToLog(pimpl_->output);
 }
 
-VrpnObject::VrpnObject(const VrpnClient *parent,string name,uint8_t id,const TabWidget* tab): IODevice(parent,name)
-{
-    Warn("Creation of object %s with id %i\n",name.c_str(),id);
-    pimpl_=new VrpnObject_impl(this,parent,name,id,tab);
-    AddDataToLog(pimpl_->output);
+VrpnObject::VrpnObject(const VrpnClient *parent, string name, uint8_t id,
+                       const TabWidget *tab)
+    : IODevice(parent, name) {
+  Warn("Creation of object %s with id %i\n", name.c_str(), id);
+  pimpl_ = new VrpnObject_impl(this, parent, name, id, tab);
+  AddDataToLog(pimpl_->output);
 }
 
-VrpnObject::~VrpnObject(void)
-{
-	delete pimpl_;
+VrpnObject::~VrpnObject(void) { delete pimpl_; }
+
+cvmatrix *VrpnObject::Output(void) const { return pimpl_->output; }
+
+cvmatrix *VrpnObject::State(void) const { return pimpl_->state; }
+
+Tab *VrpnObject::GetPlotTab(void) const { return pimpl_->plot_tab; }
+
+DataPlot1D *VrpnObject::xPlot(void) const { return pimpl_->x_plot; }
+
+DataPlot1D *VrpnObject::yPlot(void) const { return pimpl_->y_plot; }
+
+DataPlot1D *VrpnObject::zPlot(void) const { return pimpl_->z_plot; }
+
+Time VrpnObject::GetLastPacketTime(void) const {
+  return pimpl_->output->DataTime();
 }
 
-cvmatrix *VrpnObject::Output(void) const
-{
-    return pimpl_->output;
+bool VrpnObject::IsTracked(unsigned int timeout_ms) const {
+  return pimpl_->IsTracked(timeout_ms);
 }
 
-cvmatrix *VrpnObject::State(void) const
-{
-    return pimpl_->state;
+void VrpnObject::GetEuler(Euler &euler) const { pimpl_->GetEuler(euler); }
+
+void VrpnObject::GetQuaternion(Quaternion &quaternion) const {
+  pimpl_->GetQuaternion(quaternion);
 }
 
-Tab* VrpnObject::GetPlotTab(void) const
-{
-    return pimpl_->plot_tab;
+void VrpnObject::GetPosition(Vector3D &point) const {
+  pimpl_->GetPosition(point);
 }
 
-DataPlot1D* VrpnObject::xPlot(void) const
-{
-    return pimpl_->x_plot;
-}
-
-DataPlot1D* VrpnObject::yPlot(void) const
-{
-    return pimpl_->y_plot;
-}
-
-DataPlot1D* VrpnObject::zPlot(void) const
-{
-    return pimpl_->z_plot;
-}
-
-Time VrpnObject::GetLastPacketTime(void) const
-{
-	return pimpl_->output->DataTime();
-}
-
-bool VrpnObject::IsTracked(unsigned int timeout_ms) const
-{
-    return pimpl_->IsTracked(timeout_ms);
-}
-
-void VrpnObject::GetEuler(Euler &euler) const
-{
-    pimpl_->GetEuler(euler);
-}
-
-void VrpnObject::GetQuaternion(Quaternion &quaternion) const {
-    pimpl_->GetQuaternion(quaternion);
-}
-
-void VrpnObject::GetPosition(Vector3D &point) const
-{
-    pimpl_->GetPosition(point);
-}
-
-void VrpnObject::mainloop(void)
-{
-    pimpl_->mainloop();
-}
+void VrpnObject::mainloop(void) { pimpl_->mainloop(); }
 
 } // end namespace sensor
Index: trunk/lib/FlairSensorActuator/src/VrpnObject.h
===================================================================
--- trunk/lib/FlairSensorActuator/src/VrpnObject.h	(revision 14)
+++ trunk/lib/FlairSensorActuator/src/VrpnObject.h	(revision 15)
@@ -6,5 +6,6 @@
  * \file VrpnObject.h
  * \brief Class for VRPN object
- * \author César Richard, Guillaume Sanahuja, Copyright Heudiasyc UMR UTC/CNRS 7253
+ * \author César Richard, Guillaume Sanahuja, Copyright Heudiasyc UMR UTC/CNRS
+ * 7253
  * \date 2013/04/03
  * \version 4.0
@@ -17,19 +18,16 @@
 #include <stdint.h>
 
-namespace flair
-{
-    namespace core
-    {
-        class cvmatrix;
-        class Vector3D;
-        class Euler;
-        class Quaternion;
-    }
-    namespace gui
-    {
-        class TabWidget;
-        class Tab;
-        class DataPlot1D;
-    }
+namespace flair {
+namespace core {
+class cvmatrix;
+class Vector3D;
+class Euler;
+class Quaternion;
+}
+namespace gui {
+class TabWidget;
+class Tab;
+class DataPlot1D;
+}
 }
 
@@ -37,152 +35,151 @@
 class VrpnClient_impl;
 
-namespace flair
-{
-namespace sensor
-{
-    class VrpnClient;
+namespace flair {
+namespace sensor {
+class VrpnClient;
 
-    /*! \class VrpnObject
-    *
-    * \brief Class for VRPN object
-    */
-    class VrpnObject: public core::IODevice
-    {
-        friend class ::VrpnObject_impl;
-        friend class ::VrpnClient_impl;
+/*! \class VrpnObject
+*
+* \brief Class for VRPN object
+*/
+class VrpnObject : public core::IODevice {
+  friend class ::VrpnObject_impl;
+  friend class ::VrpnClient_impl;
 
-        public:
-            /*!
-            * \brief Constructor
-            *
-            * Construct a VrpnObject. Connection is done by IP.
-            *
-            * \param parent parent
-            * \param name VRPN object name, should be the same as defined in the server
-            * \param tab Tab for the user interface
-            */
-            VrpnObject(const VrpnClient *parent,std::string name,const gui::TabWidget* tab);
+public:
+  /*!
+  * \brief Constructor
+  *
+  * Construct a VrpnObject. Connection is done by IP.
+  *
+  * \param parent parent
+  * \param name VRPN object name, should be the same as defined in the server
+  * \param tab Tab for the user interface
+  */
+  VrpnObject(const VrpnClient *parent, std::string name,
+             const gui::TabWidget *tab);
 
-            /*!
-            * \brief Constructor
-            *
-            * Construct a VrpnObject. Connection is done by IP.
-            *
-            * \param parent parent
-            * \param name name
-            * \param id VRPN object id, should be the same as defined in the server
-            * \param tab Tab for the user interface
-            */
-            VrpnObject(const VrpnClient *parent,std::string name,uint8_t id,const gui::TabWidget* tab);
+  /*!
+  * \brief Constructor
+  *
+  * Construct a VrpnObject. Connection is done by IP.
+  *
+  * \param parent parent
+  * \param name name
+  * \param id VRPN object id, should be the same as defined in the server
+  * \param tab Tab for the user interface
+  */
+  VrpnObject(const VrpnClient *parent, std::string name, uint8_t id,
+             const gui::TabWidget *tab);
 
-            /*!
-            * \brief Destructor
-            *
-            */
-            ~VrpnObject(void);
+  /*!
+  * \brief Destructor
+  *
+  */
+  ~VrpnObject(void);
 
-            /*!
-            * \brief Plot tab
-            *
-            * \return plot Tab
-            */
-            gui::Tab* GetPlotTab(void) const;
+  /*!
+  * \brief Plot tab
+  *
+  * \return plot Tab
+  */
+  gui::Tab *GetPlotTab(void) const;
 
-            /*!
-            * \brief Get Last Packet Time
-            *
-            * \return Time of last received packe
-            */
-            core::Time GetLastPacketTime(void) const;
+  /*!
+  * \brief Get Last Packet Time
+  *
+  * \return Time of last received packe
+  */
+  core::Time GetLastPacketTime(void) const;
 
-            /*!
-            * \brief Is object tracked?
-            *
-            * \param timeout_ms timeout
-            * \return true if object is tracked during timeout_ms time
-            */
-            bool IsTracked(unsigned int timeout_ms) const;
+  /*!
+  * \brief Is object tracked?
+  *
+  * \param timeout_ms timeout
+  * \return true if object is tracked during timeout_ms time
+  */
+  bool IsTracked(unsigned int timeout_ms) const;
 
-            /*!
-            * \brief Get Euler angles
-            *
-            * \param euler output datas
-            */
-            void GetEuler(core::Euler &euler) const;
+  /*!
+  * \brief Get Euler angles
+  *
+  * \param euler output datas
+  */
+  void GetEuler(core::Euler &euler) const;
 
-            /*!
-            * \brief Get Quaternion
-            *
-            * \param quaternion output datas
-            */
-            void GetQuaternion(core::Quaternion &quaternion) const;
-            /*!
-            * \brief Get Position
-            *
-            * \param point output datas
-            */
-            void GetPosition(core::Vector3D &point) const;
+  /*!
+  * \brief Get Quaternion
+  *
+  * \param quaternion output datas
+  */
+  void GetQuaternion(core::Quaternion &quaternion) const;
+  /*!
+  * \brief Get Position
+  *
+  * \param point output datas
+  */
+  void GetPosition(core::Vector3D &point) const;
 
-            /*!
-            * \brief Output matrix
-            *
-            * Matrix is of type float and as follows: \n
-            * (0,0) roll (rad) \n
-            * (1,0) pitch (rad) \n
-            * (2,0) yaw (rad) \n
-            * (3,0) x \n
-            * (4,0) y \n
-            * (5,0) z \n
-            *
-            * \return Output metrix
-            */
-            core::cvmatrix *Output(void) const;
+  /*!
+  * \brief Output matrix
+  *
+  * Matrix is of type float and as follows: \n
+  * (0,0) roll (rad) \n
+  * (1,0) pitch (rad) \n
+  * (2,0) yaw (rad) \n
+  * (3,0) x \n
+  * (4,0) y \n
+  * (5,0) z \n
+  *
+  * \return Output metrix
+  */
+  core::cvmatrix *Output(void) const;
 
-            /*!
-            * \brief State matrix
-            *
-            * Matrix is of type float and as follows: \n
-            * (0,0) roll (deg) \n
-            * (1,0) pitch (deg) \n
-            * (2,0) yaw (deg) \n
-            *
-            * \return State metrix
-            */
-            core::cvmatrix *State(void) const;
+  /*!
+  * \brief State matrix
+  *
+  * Matrix is of type float and as follows: \n
+  * (0,0) roll (deg) \n
+  * (1,0) pitch (deg) \n
+  * (2,0) yaw (deg) \n
+  *
+  * \return State metrix
+  */
+  core::cvmatrix *State(void) const;
 
-            /*!
-            * \brief x plot
-            *
-            * \return x plot
-            */
-            gui::DataPlot1D* xPlot(void) const;
+  /*!
+  * \brief x plot
+  *
+  * \return x plot
+  */
+  gui::DataPlot1D *xPlot(void) const;
 
-            /*!
-            * \brief y plot
-            *
-            * \return y plot
-            */
-            gui::DataPlot1D* yPlot(void) const;
+  /*!
+  * \brief y plot
+  *
+  * \return y plot
+  */
+  gui::DataPlot1D *yPlot(void) const;
 
-            /*!
-            * \brief z plot
-            *
-            * \return z plot
-            */
-            gui::DataPlot1D* zPlot(void) const;
+  /*!
+  * \brief z plot
+  *
+  * \return z plot
+  */
+  gui::DataPlot1D *zPlot(void) const;
 
-        private:
-            /*!
-            * \brief Update using provided datas
-            *
-            * Reimplemented from IODevice.
-            *
-            * \param data data from the parent to process
-            */
-            void UpdateFrom(const core::io_data *data){};
+private:
+  /*!
+  * \brief Update using provided datas
+  *
+  * Reimplemented from IODevice.
+  *
+  * \param data data from the parent to process
+  */
+  void UpdateFrom(const core::io_data *data){};
 
-            void mainloop(void);
-            class VrpnObject_impl* pimpl_;
-    };
+  void mainloop(void);
+  class VrpnObject_impl *pimpl_;
+};
 } // end namespace sensor
 } // end namespace flair
Index: trunk/lib/FlairSensorActuator/src/VrpnObject_impl.cpp
===================================================================
--- trunk/lib/FlairSensorActuator/src/VrpnObject_impl.cpp	(revision 14)
+++ trunk/lib/FlairSensorActuator/src/VrpnObject_impl.cpp	(revision 15)
@@ -39,176 +39,161 @@
 using namespace flair::sensor;
 
-VrpnObject_impl::VrpnObject_impl(VrpnObject* self,const VrpnClient *parent,string name, int id,const TabWidget* tab)
-{
-    this->parent=parent;
-    this->self=self;
+VrpnObject_impl::VrpnObject_impl(VrpnObject *self, const VrpnClient *parent,
+                                 string name, int id, const TabWidget *tab) {
+  this->parent = parent;
+  this->self = self;
 
-    if(id==-1 && parent->UseXbee())
-    {
-        self->Err("erreur aucun identifiant specifie pour la connexion Xbee\n");
-    }
-    if(id!=-1 && !parent->UseXbee())
-    {
-        self->Warn("identifiant pour la connexion Xbee ignore car pas en mode Xbee\n");
-    }
+  if (id == -1 && parent->UseXbee()) {
+    self->Err("erreur aucun identifiant specifie pour la connexion Xbee\n");
+  }
+  if (id != -1 && !parent->UseXbee()) {
+    self->Warn(
+        "identifiant pour la connexion Xbee ignore car pas en mode Xbee\n");
+  }
 
-	if(parent->UseXbee())
-	{
-        parent->pimpl_->AddTrackable(this,id);
-        tracker=NULL;
-	}
-	else
-	{
-	    parent->pimpl_->AddTrackable(self);
-        tracker = new vrpn_Tracker_Remote(name.c_str(), parent->pimpl_->connection);
-        tracker->register_change_handler(this,handle_pos);
-        tracker->shutup=true;
-	}
+  if (parent->UseXbee()) {
+    parent->pimpl_->AddTrackable(this, id);
+    tracker = NULL;
+  } else {
+    parent->pimpl_->AddTrackable(self);
+    tracker = new vrpn_Tracker_Remote(name.c_str(), parent->pimpl_->connection);
+    tracker->register_change_handler(this, handle_pos);
+    tracker->shutup = true;
+  }
 
-	//state
-	cvmatrix_descriptor* desc=new cvmatrix_descriptor(6,1);
-	desc->SetElementName(0,0,"roll");
-	desc->SetElementName(1,0,"pitch");
-	desc->SetElementName(2,0,"yaw");
-	desc->SetElementName(3,0,"x");
-	desc->SetElementName(4,0,"y");
-	desc->SetElementName(5,0,"z");
-	output=new cvmatrix(self,desc,floatType);
+  // state
+  cvmatrix_descriptor *desc = new cvmatrix_descriptor(6, 1);
+  desc->SetElementName(0, 0, "roll");
+  desc->SetElementName(1, 0, "pitch");
+  desc->SetElementName(2, 0, "yaw");
+  desc->SetElementName(3, 0, "x");
+  desc->SetElementName(4, 0, "y");
+  desc->SetElementName(5, 0, "z");
+  output = new cvmatrix(self, desc, floatType);
 
-	desc=new cvmatrix_descriptor(3,1);
-	desc->SetElementName(0,0,"roll");
-	desc->SetElementName(1,0,"pitch");
-	desc->SetElementName(2,0,"yaw");
-	state=new cvmatrix(self,desc,floatType);
+  desc = new cvmatrix_descriptor(3, 1);
+  desc->SetElementName(0, 0, "roll");
+  desc->SetElementName(1, 0, "pitch");
+  desc->SetElementName(2, 0, "yaw");
+  state = new cvmatrix(self, desc, floatType);
 
-	//ui
-	plot_tab=new Tab(tab,"Mesures "+ name);
-        x_plot=new DataPlot1D(plot_tab->NewRow(),"x",-10,10);
-            x_plot->AddCurve(output->Element(3));
-        y_plot=new DataPlot1D(plot_tab->LastRowLastCol(),"y",-10,10);
-            y_plot->AddCurve(output->Element(4));
-        z_plot=new DataPlot1D(plot_tab->LastRowLastCol(),"z",-2,0);
-            z_plot->AddCurve(output->Element(5));
+  // ui
+  plot_tab = new Tab(tab, "Mesures " + name);
+  x_plot = new DataPlot1D(plot_tab->NewRow(), "x", -10, 10);
+  x_plot->AddCurve(output->Element(3));
+  y_plot = new DataPlot1D(plot_tab->LastRowLastCol(), "y", -10, 10);
+  y_plot->AddCurve(output->Element(4));
+  z_plot = new DataPlot1D(plot_tab->LastRowLastCol(), "z", -2, 0);
+  z_plot->AddCurve(output->Element(5));
 }
 
-VrpnObject_impl::~VrpnObject_impl(void)
-{
-    if(tracker!=NULL)//normal
-	{
-	    parent->pimpl_->RemoveTrackable(self);
-        tracker->unregister_change_handler(this,handle_pos);
-        delete tracker;
-	}
-	else//xbee
-	{
-        parent->pimpl_->RemoveTrackable(this);
-	}
-	delete plot_tab;
+VrpnObject_impl::~VrpnObject_impl(void) {
+  if (tracker != NULL) // normal
+  {
+    parent->pimpl_->RemoveTrackable(self);
+    tracker->unregister_change_handler(this, handle_pos);
+    delete tracker;
+  } else // xbee
+  {
+    parent->pimpl_->RemoveTrackable(this);
+  }
+  delete plot_tab;
 }
 
-void VrpnObject_impl::mainloop(void)
-{
-	tracker->mainloop();
+void VrpnObject_impl::mainloop(void) { tracker->mainloop(); }
+
+bool VrpnObject_impl::IsTracked(unsigned int timeout_ms) {
+  output->GetMutex();
+  Time a = GetTime();
+  Time dt = a - output->DataTime();
+  output->ReleaseMutex();
+
+  if (dt > (Time)(timeout_ms * 1000000)) {
+    // self->Printf("%lld %lld %lld
+    // %lld\n",a,output->DataTime(),dt,(Time)(timeout_ms*1000000));
+    return false;
+  } else {
+    return true;
+  }
 }
 
-bool VrpnObject_impl::IsTracked(unsigned int timeout_ms)
-{
-    output->GetMutex();
-    Time a=GetTime();
-    Time dt=a-output->DataTime();
-    output->ReleaseMutex();
-
-    if(dt>(Time)(timeout_ms*1000000))
-    {
-        //self->Printf("%lld %lld %lld %lld\n",a,output->DataTime(),dt,(Time)(timeout_ms*1000000));
-        return false;
-    }
-    else
-    {
-        return true;
-    }
-}
-
-void VrpnObject_impl::GetEuler(Euler &euler)
-{
-    output->GetMutex();
-    euler.roll=output->ValueNoMutex(0,0);
-    euler.pitch=output->ValueNoMutex(1,0);
-    euler.yaw=output->ValueNoMutex(2,0);
-    output->ReleaseMutex();
+void VrpnObject_impl::GetEuler(Euler &euler) {
+  output->GetMutex();
+  euler.roll = output->ValueNoMutex(0, 0);
+  euler.pitch = output->ValueNoMutex(1, 0);
+  euler.yaw = output->ValueNoMutex(2, 0);
+  output->ReleaseMutex();
 }
 
 void VrpnObject_impl::GetQuaternion(Quaternion &quaternion) {
-    output->GetMutex();
-    quaternion.q0=this->quaternion.q0;
-    quaternion.q1=this->quaternion.q1;
-    quaternion.q2=this->quaternion.q2;
-    quaternion.q3=this->quaternion.q3;
-    output->ReleaseMutex();
+  output->GetMutex();
+  quaternion.q0 = this->quaternion.q0;
+  quaternion.q1 = this->quaternion.q1;
+  quaternion.q2 = this->quaternion.q2;
+  quaternion.q3 = this->quaternion.q3;
+  output->ReleaseMutex();
 }
 
-void VrpnObject_impl::GetPosition(Vector3D &point)
-{
-    output->GetMutex();
-    point.x=output->ValueNoMutex(3,0);
-    point.y=output->ValueNoMutex(4,0);
-    point.z=output->ValueNoMutex(5,0);
-    output->ReleaseMutex();
+void VrpnObject_impl::GetPosition(Vector3D &point) {
+  output->GetMutex();
+  point.x = output->ValueNoMutex(3, 0);
+  point.y = output->ValueNoMutex(4, 0);
+  point.z = output->ValueNoMutex(5, 0);
+  output->ReleaseMutex();
 }
 
-void VRPN_CALLBACK VrpnObject_impl::handle_pos(void *userdata, const vrpn_TRACKERCB t)
-{
-    bool is_nan=false;
-	VrpnObject_impl* caller= reinterpret_cast<VrpnObject_impl*>(userdata);
-	Time time=GetTime();
+void VRPN_CALLBACK
+VrpnObject_impl::handle_pos(void *userdata, const vrpn_TRACKERCB t) {
+  bool is_nan = false;
+  VrpnObject_impl *caller = reinterpret_cast<VrpnObject_impl *>(userdata);
+  Time time = GetTime();
 
-    //check if something is nan
-    for(int i=0;i<3;i++)
-    {
-        if(isnan(t.pos[i])==true) is_nan=true;
-    }
-    for(int i=0;i<4;i++)
-    {
-        if(isnan(t.quat[i])==true) is_nan=true;
-    }
-    if(is_nan==true)
-    {
-        caller->self->Warn("data is nan, skipping it (time %lld)\n",time);
-        return;
-    }
+  // check if something is nan
+  for (int i = 0; i < 3; i++) {
+    if (isnan(t.pos[i]) == true)
+      is_nan = true;
+  }
+  for (int i = 0; i < 4; i++) {
+    if (isnan(t.quat[i]) == true)
+      is_nan = true;
+  }
+  if (is_nan == true) {
+    caller->self->Warn("data is nan, skipping it (time %lld)\n", time);
+    return;
+  }
 
-    //on prend une fois pour toute le mutex et on fait des accès directs
-    caller->output->GetMutex();
+  // on prend une fois pour toute le mutex et on fait des accès directs
+  caller->output->GetMutex();
 
-    //warning: t.quat is defined as (qx,qy,qz,qw), which is different from flair::core::Quaternion
-    caller->quaternion.q0=t.quat[3];
-    caller->quaternion.q1=t.quat[0];
-    caller->quaternion.q2=t.quat[1];
-    caller->quaternion.q3=t.quat[2];
-    Vector3D pos((float)t.pos[0],(float)t.pos[1],(float)t.pos[2]);
+  // warning: t.quat is defined as (qx,qy,qz,qw), which is different from
+  // flair::core::Quaternion
+  caller->quaternion.q0 = t.quat[3];
+  caller->quaternion.q1 = t.quat[0];
+  caller->quaternion.q2 = t.quat[1];
+  caller->quaternion.q3 = t.quat[2];
+  Vector3D pos((float)t.pos[0], (float)t.pos[1], (float)t.pos[2]);
 
-    //on effectue les rotation
-    caller->parent->pimpl_->ComputeRotations(pos);
-    caller->parent->pimpl_->ComputeRotations(caller->quaternion);
+  // on effectue les rotation
+  caller->parent->pimpl_->ComputeRotations(pos);
+  caller->parent->pimpl_->ComputeRotations(caller->quaternion);
 
-    Euler euler;
-    caller->quaternion.ToEuler(euler);
-    caller->output->SetValueNoMutex( 0, 0,euler.roll);
-    caller->output->SetValueNoMutex( 1, 0,euler.pitch);
-    caller->output->SetValueNoMutex( 2, 0,euler.yaw);
-    caller->output->SetValueNoMutex( 3, 0,pos.x);
-    caller->output->SetValueNoMutex( 4, 0,pos.y);
-    caller->output->SetValueNoMutex( 5, 0,pos.z);
+  Euler euler;
+  caller->quaternion.ToEuler(euler);
+  caller->output->SetValueNoMutex(0, 0, euler.roll);
+  caller->output->SetValueNoMutex(1, 0, euler.pitch);
+  caller->output->SetValueNoMutex(2, 0, euler.yaw);
+  caller->output->SetValueNoMutex(3, 0, pos.x);
+  caller->output->SetValueNoMutex(4, 0, pos.y);
+  caller->output->SetValueNoMutex(5, 0, pos.z);
 
-    caller->output->SetDataTime(time);
-    caller->output->ReleaseMutex();
+  caller->output->SetDataTime(time);
+  caller->output->ReleaseMutex();
 
-    caller->state->GetMutex();
-    caller->state->SetValueNoMutex( 0, 0,Euler::ToDegree(euler.roll));
-    caller->state->SetValueNoMutex( 1, 0,Euler::ToDegree(euler.pitch));
-    caller->state->SetValueNoMutex(2, 0,Euler::ToDegree(euler.yaw));
-    caller->state->ReleaseMutex();
+  caller->state->GetMutex();
+  caller->state->SetValueNoMutex(0, 0, Euler::ToDegree(euler.roll));
+  caller->state->SetValueNoMutex(1, 0, Euler::ToDegree(euler.pitch));
+  caller->state->SetValueNoMutex(2, 0, Euler::ToDegree(euler.yaw));
+  caller->state->ReleaseMutex();
 
-    caller->self->ProcessUpdate(caller->output);
+  caller->self->ProcessUpdate(caller->output);
 }
-
Index: trunk/lib/FlairSensorActuator/src/XBldc.cpp
===================================================================
--- trunk/lib/FlairSensorActuator/src/XBldc.cpp	(revision 14)
+++ trunk/lib/FlairSensorActuator/src/XBldc.cpp	(revision 15)
@@ -23,20 +23,16 @@
 using namespace flair::gui;
 
-namespace flair
-{
-namespace actuator
-{
+namespace flair {
+namespace actuator {
 
-XBldc::XBldc(const IODevice* parent,Layout* layout,string name,I2cPort* i2cport) : Bldc(parent,layout,name,4) {
-    pimpl_=new XBldc_impl(this,i2cport);
+XBldc::XBldc(const IODevice *parent, Layout *layout, string name,
+             I2cPort *i2cport)
+    : Bldc(parent, layout, name, 4) {
+  pimpl_ = new XBldc_impl(this, i2cport);
 }
 
-XBldc::~XBldc() {
-    delete pimpl_;
-}
+XBldc::~XBldc() { delete pimpl_; }
 
-void XBldc::SetMotors(float* value) {
-    pimpl_->SetMotors(value);
-}
+void XBldc::SetMotors(float *value) { pimpl_->SetMotors(value); }
 
 } // end namespace actuator
Index: trunk/lib/FlairSensorActuator/src/XBldc.h
===================================================================
--- trunk/lib/FlairSensorActuator/src/XBldc.h	(revision 14)
+++ trunk/lib/FlairSensorActuator/src/XBldc.h	(revision 15)
@@ -16,79 +16,74 @@
 #include "Bldc.h"
 
-namespace flair
-{
-    namespace core
-    {
-        class IODevice;
-        class I2cPort;
-    }
-    namespace gui
-    {
-        class Layout;
-    }
+namespace flair {
+namespace core {
+class IODevice;
+class I2cPort;
+}
+namespace gui {
+class Layout;
+}
 }
 
 class XBldc_impl;
 
-namespace flair
-{
-namespace actuator
-{
-    /*! \class XBldc
-    *
-    * \brief Class for Xufo Bldc
-    */
-    class XBldc : public Bldc
-    {
-        public:
-            /*!
-            * \brief Constructor
-            *
-            * Construct a XBldc.
-            *
-            * \param parent parent
-            * \param layout layout
-            * \param name name
-            * \param i2cport i2cport
-            */
-            XBldc(const core::IODevice* parent,gui::Layout* layout,std::string name,core::I2cPort* i2cport);
+namespace flair {
+namespace actuator {
+/*! \class XBldc
+*
+* \brief Class for Xufo Bldc
+*/
+class XBldc : public Bldc {
+public:
+  /*!
+  * \brief Constructor
+  *
+  * Construct a XBldc.
+  *
+  * \param parent parent
+  * \param layout layout
+  * \param name name
+  * \param i2cport i2cport
+  */
+  XBldc(const core::IODevice *parent, gui::Layout *layout, std::string name,
+        core::I2cPort *i2cport);
 
-            /*!
-            * \brief Destructor
-            *
-            */
-            ~XBldc();
+  /*!
+  * \brief Destructor
+  *
+  */
+  ~XBldc();
 
-            /*!
-            * \brief Has speed measurement
-            *
-            * Reimplemented from Bldc. \n
-            *
-            * \return true if it has speed measurement
-            */
-            bool HasSpeedMeasurement(void) const{return false;};
+  /*!
+  * \brief Has speed measurement
+  *
+  * Reimplemented from Bldc. \n
+  *
+  * \return true if it has speed measurement
+  */
+  bool HasSpeedMeasurement(void) const { return false; };
 
-            /*!
-            * \brief Has current measurement
-            *
-            * Reimplemented from Bldc. \n
-            *
-            * \return true if it has current measurement
-            */
-            bool HasCurrentMeasurement(void) const{return false;};
+  /*!
+  * \brief Has current measurement
+  *
+  * Reimplemented from Bldc. \n
+  *
+  * \return true if it has current measurement
+  */
+  bool HasCurrentMeasurement(void) const { return false; };
 
-        private:
-            /*!
-            * \brief Set motors values
-            *
-            * Reimplemented from Bldc. \n
-            * Values size must be the same as MotorsCount()
-            *
-            * \param values motor values
-            */
-            void SetMotors(float* value);
+private:
+  /*!
+  * \brief Set motors values
+  *
+  * Reimplemented from Bldc. \n
+  * Values size must be the same as MotorsCount()
+  *
+  * \param values motor values
+  */
+  void SetMotors(float *value);
 
-            class XBldc_impl* pimpl_;
-    };
+  class XBldc_impl *pimpl_;
+};
 } // end namespace actuator
 } // end namespace flair
Index: trunk/lib/FlairSensorActuator/src/XBldc_impl.cpp
===================================================================
--- trunk/lib/FlairSensorActuator/src/XBldc_impl.cpp	(revision 14)
+++ trunk/lib/FlairSensorActuator/src/XBldc_impl.cpp	(revision 15)
@@ -29,40 +29,40 @@
 using namespace flair::actuator;
 
-XBldc_impl::XBldc_impl(XBldc* self,I2cPort* i2cport) {
-    this->self=self;
-	this->i2cport=i2cport;
+XBldc_impl::XBldc_impl(XBldc *self, I2cPort *i2cport) {
+  this->self = self;
+  this->i2cport = i2cport;
 
-    i2cport->SetTxTimeout(5000000);
+  i2cport->SetTxTimeout(5000000);
 }
 
-XBldc_impl::~XBldc_impl() {
-}
+XBldc_impl::~XBldc_impl() {}
 
-void XBldc_impl::SetMotors(float* value) {
-    uint8_t tosend_value[5];
+void XBldc_impl::SetMotors(float *value) {
+  uint8_t tosend_value[5];
 
-    for(int i=0;i<4;i++) tosend_value[i]=(uint8_t)(MAX_VALUE*value[i]);
+  for (int i = 0; i < 4; i++)
+    tosend_value[i] = (uint8_t)(MAX_VALUE * value[i]);
 
-    ssize_t written;
-    tosend_value[4]=0xaa;
-    for(int i=0;i<4;i++) tosend_value[4]+=tosend_value[i];
-    self->Err("please verify motors adresses\n");
-    //todo faire la procedure changement addresse par la station sol
-/*
-    i2cport->GetMutex();
-    i2cport->SetSlave(BASE_ADDRESS);
+  ssize_t written;
+  tosend_value[4] = 0xaa;
+  for (int i = 0; i < 4; i++)
+    tosend_value[4] += tosend_value[i];
+  self->Err("please verify motors adresses\n");
+  // todo faire la procedure changement addresse par la station sol
+  /*
+      i2cport->GetMutex();
+      i2cport->SetSlave(BASE_ADDRESS);
 
-    written =i2cport->Write(tosend_value, sizeof(tosend_value));
-    if(written<0)
-    {
-        self->Err("rt_dev_write error (%s)\n",strerror(-written));
-    }
-    else if (written != sizeof(tosend_value))
-    {
-        self->Err("rt_dev_write error %i/%i\n",written,sizeof(tosend_value));
-    }
+      written =i2cport->Write(tosend_value, sizeof(tosend_value));
+      if(written<0)
+      {
+          self->Err("rt_dev_write error (%s)\n",strerror(-written));
+      }
+      else if (written != sizeof(tosend_value))
+      {
+          self->Err("rt_dev_write error %i/%i\n",written,sizeof(tosend_value));
+      }
 
-    i2cport->ReleaseMutex();*/
-
+      i2cport->ReleaseMutex();*/
 }
 /*
@@ -94,54 +94,57 @@
 */
 void XBldc_impl::ChangeDirection(uint8_t moteur) {
-    unsigned char tx[4];
-    ssize_t written;
+  unsigned char tx[4];
+  ssize_t written;
 
-    tx[0]=254;
-    tx[1]=moteur;
-    tx[2]=0;
-    tx[3]=234+moteur;
+  tx[0] = 254;
+  tx[1] = moteur;
+  tx[2] = 0;
+  tx[3] = 234 + moteur;
 
-    i2cport->GetMutex();
-    i2cport->SetSlave(BASE_ADDRESS);
+  i2cport->GetMutex();
+  i2cport->SetSlave(BASE_ADDRESS);
 
-    written =i2cport->Write(tx, sizeof(tx));
-    if(written<0) {
-        self->Err("rt_dev_write (%s) error\n",strerror(-written));
-    } else if (written != sizeof(tx)) {
-        self->Err("rt_dev_write %i/%i error\n",written,sizeof(tx));
-    }
+  written = i2cport->Write(tx, sizeof(tx));
+  if (written < 0) {
+    self->Err("rt_dev_write (%s) error\n", strerror(-written));
+  } else if (written != sizeof(tx)) {
+    self->Err("rt_dev_write %i/%i error\n", written, sizeof(tx));
+  }
 
-    i2cport->ReleaseMutex();
+  i2cport->ReleaseMutex();
 }
 
-void XBldc_impl::ChangeAdress(uint8_t old_add,uint8_t new_add) {
-    unsigned char tx[4];
-    ssize_t written;
+void XBldc_impl::ChangeAdress(uint8_t old_add, uint8_t new_add) {
+  unsigned char tx[4];
+  ssize_t written;
 
-    tx[0]=250;
-    tx[1]=old_add;
-    tx[2]=new_add;
-    tx[3]=230+old_add+new_add;
+  tx[0] = 250;
+  tx[1] = old_add;
+  tx[2] = new_add;
+  tx[3] = 230 + old_add + new_add;
 
-    i2cport->GetMutex();
-    i2cport->SetSlave(BASE_ADDRESS);
+  i2cport->GetMutex();
+  i2cport->SetSlave(BASE_ADDRESS);
 
-    written =i2cport->Write(tx, sizeof(tx));
-    if(written<0) {
-        self->Err("rt_dev_write error (%s)\n",strerror(-written));
-    } else if (written != sizeof(tx)) {
-        self->Err("rt_dev_write error %i/%i\n",written,sizeof(tx));
-    }
+  written = i2cport->Write(tx, sizeof(tx));
+  if (written < 0) {
+    self->Err("rt_dev_write error (%s)\n", strerror(-written));
+  } else if (written != sizeof(tx)) {
+    self->Err("rt_dev_write error %i/%i\n", written, sizeof(tx));
+  }
 
-    i2cport->ReleaseMutex();
+  i2cport->ReleaseMutex();
 }
 
-uint8_t XBldc_impl::Sat(float value,uint8_t min,uint8_t max) {
-  uint8_t sat_value=(uint8_t)value;
+uint8_t XBldc_impl::Sat(float value, uint8_t min, uint8_t max) {
+  uint8_t sat_value = (uint8_t)value;
 
-  if(value>((float)sat_value+0.5)) sat_value++;
+  if (value > ((float)sat_value + 0.5))
+    sat_value++;
 
-  if(value<(float)min) sat_value=min;
-  if(value>(float)max) sat_value=max;
+  if (value < (float)min)
+    sat_value = min;
+  if (value > (float)max)
+    sat_value = max;
 
   return sat_value;
Index: trunk/lib/FlairSensorActuator/src/geodesie.cpp
===================================================================
--- trunk/lib/FlairSensorActuator/src/geodesie.cpp	(revision 14)
+++ trunk/lib/FlairSensorActuator/src/geodesie.cpp	(revision 15)
@@ -8,143 +8,158 @@
 
 #ifdef _MSC_VER
-#   pragma warning(disable:4244)
+#pragma warning(disable : 4244)
 #endif //_MSC_VER
 
 namespace Geodesie {
 /// ////////////////////////////////////////////////////////////////////
-Matrice::Matrice(const Matrice & A) {
-    c0_l0=A.c0_l0;c1_l0=A.c1_l0;c2_l0=A.c2_l0;
-    c0_l1=A.c0_l1;c1_l1=A.c1_l1;c2_l1=A.c2_l1;
-    c0_l2=A.c0_l2;c1_l2=A.c1_l2;c2_l2=A.c2_l2;
+Matrice::Matrice(const Matrice &A) {
+  c0_l0 = A.c0_l0;
+  c1_l0 = A.c1_l0;
+  c2_l0 = A.c2_l0;
+  c0_l1 = A.c0_l1;
+  c1_l1 = A.c1_l1;
+  c2_l1 = A.c2_l1;
+  c0_l2 = A.c0_l2;
+  c1_l2 = A.c1_l2;
+  c2_l2 = A.c2_l2;
 }
 /// ////////////////////////////////////////////////////////////////////
 Matrice::Matrice() {
-    c0_l0=0.0;c1_l0=0.0;c2_l0=0.0;
-    c0_l1=0.0;c1_l1=0.0;c2_l1=0.0;
-    c0_l2=0.0;c1_l2=0.0;c2_l2=0.0;
-}
-/// ////////////////////////////////////////////////////////////////////
-void Matrice::Apply(double v0,double v1,double v2, double& Mv0,double& Mv1,double& Mv2) {
-    Mv0 = c0_l0*v0 + c1_l0*v1 + c2_l0*v2;
-    Mv1 = c0_l1*v0 + c1_l1*v1 + c2_l1*v2;
-    Mv2 = c0_l2*v0 + c1_l2*v1 + c2_l2*v2;
+  c0_l0 = 0.0;
+  c1_l0 = 0.0;
+  c2_l0 = 0.0;
+  c0_l1 = 0.0;
+  c1_l1 = 0.0;
+  c2_l1 = 0.0;
+  c0_l2 = 0.0;
+  c1_l2 = 0.0;
+  c2_l2 = 0.0;
+}
+/// ////////////////////////////////////////////////////////////////////
+void Matrice::Apply(double v0, double v1, double v2, double &Mv0, double &Mv1,
+                    double &Mv2) {
+  Mv0 = c0_l0 * v0 + c1_l0 * v1 + c2_l0 * v2;
+  Mv1 = c0_l1 * v0 + c1_l1 * v1 + c2_l1 * v2;
+  Mv2 = c0_l2 * v0 + c1_l2 * v1 + c2_l2 * v2;
 }
 /// ////////////////////////////////////////////////////////////////////
 Matrice ProdMat(const Matrice A, const Matrice B) {
-    Matrice out;
-
-    out.c0_l0=A.c0_l0 * B.c0_l0 + A.c1_l0 * B.c0_l1 + A.c2_l0 * B.c0_l2;
-    out.c1_l0=A.c0_l0 * B.c1_l0 + A.c1_l0 * B.c1_l1 + A.c2_l0 * B.c1_l2;
-    out.c2_l0=A.c0_l0 * B.c2_l0 + A.c1_l0 * B.c2_l1 + A.c2_l0 * B.c2_l2;
-
-    out.c0_l1=A.c0_l1 * B.c0_l0 + A.c1_l1 * B.c0_l1 + A.c2_l1 * B.c0_l2;
-    out.c1_l1=A.c0_l1 * B.c1_l0 + A.c1_l1 * B.c1_l1 + A.c2_l1 * B.c1_l2;
-    out.c2_l1=A.c0_l1 * B.c2_l0 + A.c1_l1 * B.c2_l1 + A.c2_l1 * B.c2_l2;
-
-    out.c0_l2=A.c0_l2 * B.c0_l0 + A.c1_l2 * B.c0_l1 + A.c2_l2 * B.c0_l2;
-    out.c1_l2=A.c0_l2 * B.c1_l0 + A.c1_l2 * B.c1_l1 + A.c2_l2 * B.c1_l2;
-    out.c2_l2=A.c0_l2 * B.c2_l0 + A.c1_l2 * B.c2_l1 + A.c2_l2 * B.c2_l2;
-    return out;
+  Matrice out;
+
+  out.c0_l0 = A.c0_l0 * B.c0_l0 + A.c1_l0 * B.c0_l1 + A.c2_l0 * B.c0_l2;
+  out.c1_l0 = A.c0_l0 * B.c1_l0 + A.c1_l0 * B.c1_l1 + A.c2_l0 * B.c1_l2;
+  out.c2_l0 = A.c0_l0 * B.c2_l0 + A.c1_l0 * B.c2_l1 + A.c2_l0 * B.c2_l2;
+
+  out.c0_l1 = A.c0_l1 * B.c0_l0 + A.c1_l1 * B.c0_l1 + A.c2_l1 * B.c0_l2;
+  out.c1_l1 = A.c0_l1 * B.c1_l0 + A.c1_l1 * B.c1_l1 + A.c2_l1 * B.c1_l2;
+  out.c2_l1 = A.c0_l1 * B.c2_l0 + A.c1_l1 * B.c2_l1 + A.c2_l1 * B.c2_l2;
+
+  out.c0_l2 = A.c0_l2 * B.c0_l0 + A.c1_l2 * B.c0_l1 + A.c2_l2 * B.c0_l2;
+  out.c1_l2 = A.c0_l2 * B.c1_l0 + A.c1_l2 * B.c1_l1 + A.c2_l2 * B.c1_l2;
+  out.c2_l2 = A.c0_l2 * B.c2_l0 + A.c1_l2 * B.c2_l1 + A.c2_l2 * B.c2_l2;
+  return out;
 }
 
 /// ////////////////////////////////////////////////////////////////////
 Matrice TransMat(const Matrice A) {
-    Matrice out;
-    out.c0_l0=A.c0_l0 ; out.c1_l0 = A.c0_l1 ; out.c2_l0 = A.c0_l2 ;
-    out.c0_l1=A.c1_l0 ; out.c1_l1 = A.c1_l1 ; out.c2_l1 = A.c1_l2 ;
-    out.c0_l2=A.c2_l0 ; out.c1_l2 = A.c2_l1 ; out.c2_l2 = A.c2_l2 ;
-    return out;
-}
-
-/// ////////////////////////////////////////////////////////////////////
-void Write(const Matrice A,std::ostream& out) {
-    out<< A.c0_l0<<"\t"<< A.c1_l0<<"\t"<< A.c2_l0<<"\n";
-    out<< A.c0_l1<<"\t"<< A.c1_l1<<"\t"<< A.c2_l1<<"\n";
-    out<< A.c0_l2<<"\t"<< A.c1_l2<<"\t"<< A.c2_l2<<"\n";
-}
-
-/// ////////////////////////////////////////////////////////////////////
-Raf98::~Raf98() {
-    m_dvalues.clear();
-}
+  Matrice out;
+  out.c0_l0 = A.c0_l0;
+  out.c1_l0 = A.c0_l1;
+  out.c2_l0 = A.c0_l2;
+  out.c0_l1 = A.c1_l0;
+  out.c1_l1 = A.c1_l1;
+  out.c2_l1 = A.c1_l2;
+  out.c0_l2 = A.c2_l0;
+  out.c1_l2 = A.c2_l1;
+  out.c2_l2 = A.c2_l2;
+  return out;
+}
+
+/// ////////////////////////////////////////////////////////////////////
+void Write(const Matrice A, std::ostream &out) {
+  out << A.c0_l0 << "\t" << A.c1_l0 << "\t" << A.c2_l0 << "\n";
+  out << A.c0_l1 << "\t" << A.c1_l1 << "\t" << A.c2_l1 << "\n";
+  out << A.c0_l2 << "\t" << A.c1_l2 << "\t" << A.c2_l2 << "\n";
+}
+
+/// ////////////////////////////////////////////////////////////////////
+Raf98::~Raf98() { m_dvalues.clear(); }
 
 //-----------------------------------------------------------------------------
-bool Raf98::Interpol(double longitude, double latitude, double* Hwgs84) const {
-    *Hwgs84 = 0.0;
-    if (m_dvalues.size()==0)
-        return false;
-    const double longitude_min =  -5.5;
-    const double longitude_max =  8.5;
-    if (longitude < longitude_min)
-        return false;
-    if (longitude > longitude_max)
-        return false;
-
-    const double latitude_min =  42;
-    const double latitude_max =  51.5;
-    if (latitude < latitude_min)
-        return false;
-    if (latitude > latitude_max)
-        return false;
-
-    //conversion en position
-    double longPix = (longitude - longitude_min) * 30.;
-    double latPix  = (latitude_max - latitude) * 40.;
-
-    double RestCol,RestLig;
-    double  ColIni,LigIni;
-    RestCol = modf(longPix,&ColIni);
-    RestLig = modf(latPix,&LigIni);
-
-
-    double Zbd = (1.0-RestCol) * (1.0-RestLig) * LitGrille(ColIni  , LigIni  );
-    Zbd += RestCol * (1.0-RestLig) * LitGrille(ColIni+1, LigIni  );
-    Zbd += (1.0-RestCol) *   RestLig  * LitGrille(ColIni  , LigIni+1);
-    Zbd += RestCol * RestLig * LitGrille(ColIni+1, LigIni+1);
-    *Hwgs84 = Zbd;
-
-
-    return true;
-}
-/// ////////////////////////////////////////////////////////////////////
-double Raf98::LitGrille(unsigned int c,unsigned int l) const{
-    const unsigned int w=421;
-    //    const unsigned int h=381;
-    return m_dvalues.at(c+l*w);
-}
-/// ////////////////////////////////////////////////////////////////////
-bool Raf98::Load(const std::string & sin) {
-    std::ifstream in(sin.c_str());
-    unsigned int w = 421;
-    unsigned int h = 381;
-
-    m_dvalues.reserve(w*h);
-
-    char entete[1024];//sur 3 lignes
-    in.getline(entete,1023);
-    in.getline(entete,1023);
-    in.getline(entete,1023);
-
-    char bidon[1024];
-    double val;
-    for (unsigned int i=0; i< h; ++i) {
-        for (unsigned int j=0; j< 52; ++j)  {
-            for (unsigned int k=0; k< 8; ++k) {
-                in >> val;
-                m_dvalues.push_back( val );
-            }
-            in.getline(bidon,1023);
-        }
-        for (unsigned int k=0; k< 5; ++k) {
-            in >> val;
-            m_dvalues.push_back( val );
-        }
-        in.getline(bidon,1023);
-        if (!in.good())         {
-            m_dvalues.clear();
-            return false;
-        }
+bool Raf98::Interpol(double longitude, double latitude, double *Hwgs84) const {
+  *Hwgs84 = 0.0;
+  if (m_dvalues.size() == 0)
+    return false;
+  const double longitude_min = -5.5;
+  const double longitude_max = 8.5;
+  if (longitude < longitude_min)
+    return false;
+  if (longitude > longitude_max)
+    return false;
+
+  const double latitude_min = 42;
+  const double latitude_max = 51.5;
+  if (latitude < latitude_min)
+    return false;
+  if (latitude > latitude_max)
+    return false;
+
+  // conversion en position
+  double longPix = (longitude - longitude_min) * 30.;
+  double latPix = (latitude_max - latitude) * 40.;
+
+  double RestCol, RestLig;
+  double ColIni, LigIni;
+  RestCol = modf(longPix, &ColIni);
+  RestLig = modf(latPix, &LigIni);
+
+  double Zbd = (1.0 - RestCol) * (1.0 - RestLig) * LitGrille(ColIni, LigIni);
+  Zbd += RestCol * (1.0 - RestLig) * LitGrille(ColIni + 1, LigIni);
+  Zbd += (1.0 - RestCol) * RestLig * LitGrille(ColIni, LigIni + 1);
+  Zbd += RestCol * RestLig * LitGrille(ColIni + 1, LigIni + 1);
+  *Hwgs84 = Zbd;
+
+  return true;
+}
+/// ////////////////////////////////////////////////////////////////////
+double Raf98::LitGrille(unsigned int c, unsigned int l) const {
+  const unsigned int w = 421;
+  //    const unsigned int h=381;
+  return m_dvalues.at(c + l * w);
+}
+/// ////////////////////////////////////////////////////////////////////
+bool Raf98::Load(const std::string &sin) {
+  std::ifstream in(sin.c_str());
+  unsigned int w = 421;
+  unsigned int h = 381;
+
+  m_dvalues.reserve(w * h);
+
+  char entete[1024]; // sur 3 lignes
+  in.getline(entete, 1023);
+  in.getline(entete, 1023);
+  in.getline(entete, 1023);
+
+  char bidon[1024];
+  double val;
+  for (unsigned int i = 0; i < h; ++i) {
+    for (unsigned int j = 0; j < 52; ++j) {
+      for (unsigned int k = 0; k < 8; ++k) {
+        in >> val;
+        m_dvalues.push_back(val);
+      }
+      in.getline(bidon, 1023);
     }
-    return in.good();
+    for (unsigned int k = 0; k < 5; ++k) {
+      in >> val;
+      m_dvalues.push_back(val);
+    }
+    in.getline(bidon, 1023);
+    if (!in.good()) {
+      m_dvalues.clear();
+      return false;
+    }
+  }
+  return in.good();
 }
 
@@ -155,189 +170,183 @@
 
 /// ////////////////////////////////////////////////////////////////////
-//ALGO0001
-double Geodesie::LatitueIsometrique(double latitude,double e) {
-    double li;
-    li = log(tan(M_PI_4 + latitude/2.)) + e*log( (1-e*sin(latitude))/(1+e*sin(latitude)) )/2;
-    return li;
-}
-
-/// ////////////////////////////////////////////////////////////////////
-//ALGO0002
-double Geodesie::LatitueIsometrique2Lat(double latitude_iso,double e,double epsilon) {
-    double latitude_i=2*atan(exp(latitude_iso)) - M_PI_2;
-    double latitude_ip1=latitude_i+epsilon*2;
-    while (fabs(latitude_i-latitude_ip1)>epsilon) {
-        latitude_i=latitude_ip1;
-        latitude_ip1=2*atan(
-                    exp(e*0.5*
-                        log(
-                            (1+e*sin(latitude_i))/(1-e*sin(latitude_i))
-                            )
-                        )
-                    *exp(latitude_iso)
-                    ) - M_PI_2;
-    }
-    return latitude_ip1;
-}
-/// ////////////////////////////////////////////////////////////////////
-void Geodesie::Geo2ProjLambert(
-    double lambda,double phi,
-    double n, double c,double e,
-    double lambdac,double xs,double ys,
-    double& X,double& Y)
-{
-    double lat_iso=LatitueIsometrique(phi,e);
-    X=xs+c*exp(-n*lat_iso)*sin(n*(lambda-lambdac));
-    Y=ys-c*exp(-n*lat_iso)*cos(n*(lambda-lambdac));
-}
-/// ////////////////////////////////////////////////////////////////////
-//ALGO0004
-void Geodesie::Proj2GeoLambert(
-    double X,double Y,
-    double n, double c,double e,
-    double lambdac,double xs,double ys,
-    double epsilon,
-    double& lambda,double& phi)
-{
-    double X_xs=X-xs;
-    double ys_Y=ys-Y;
-    double R=sqrt(X_xs*X_xs+ys_Y*ys_Y);
-    double gamma=atan(X_xs/ys_Y);
-    lambda=lambdac+gamma/n;
-    double lat_iso=-1/n*log(fabs(R/c));
-    phi=LatitueIsometrique2Lat(lat_iso,e,epsilon);
+// ALGO0001
+double Geodesie::LatitueIsometrique(double latitude, double e) {
+  double li;
+  li = log(tan(M_PI_4 + latitude / 2.)) +
+       e * log((1 - e * sin(latitude)) / (1 + e * sin(latitude))) / 2;
+  return li;
+}
+
+/// ////////////////////////////////////////////////////////////////////
+// ALGO0002
+double Geodesie::LatitueIsometrique2Lat(double latitude_iso, double e,
+                                        double epsilon) {
+  double latitude_i = 2 * atan(exp(latitude_iso)) - M_PI_2;
+  double latitude_ip1 = latitude_i + epsilon * 2;
+  while (fabs(latitude_i - latitude_ip1) > epsilon) {
+    latitude_i = latitude_ip1;
+    latitude_ip1 = 2 * atan(exp(e * 0.5 * log((1 + e * sin(latitude_i)) /
+                                              (1 - e * sin(latitude_i)))) *
+                            exp(latitude_iso)) -
+                   M_PI_2;
+  }
+  return latitude_ip1;
+}
+/// ////////////////////////////////////////////////////////////////////
+void Geodesie::Geo2ProjLambert(double lambda, double phi, double n, double c,
+                               double e, double lambdac, double xs, double ys,
+                               double &X, double &Y) {
+  double lat_iso = LatitueIsometrique(phi, e);
+  X = xs + c * exp(-n * lat_iso) * sin(n * (lambda - lambdac));
+  Y = ys - c * exp(-n * lat_iso) * cos(n * (lambda - lambdac));
+}
+/// ////////////////////////////////////////////////////////////////////
+// ALGO0004
+void Geodesie::Proj2GeoLambert(double X, double Y, double n, double c, double e,
+                               double lambdac, double xs, double ys,
+                               double epsilon, double &lambda, double &phi) {
+  double X_xs = X - xs;
+  double ys_Y = ys - Y;
+  double R = sqrt(X_xs * X_xs + ys_Y * ys_Y);
+  double gamma = atan(X_xs / ys_Y);
+  lambda = lambdac + gamma / n;
+  double lat_iso = -1 / n * log(fabs(R / c));
+  phi = LatitueIsometrique2Lat(lat_iso, e, epsilon);
 }
 /// ////////////////////////////////////////////////////////////////////
 double Geodesie::ConvMerApp(double longitude) {
-    double phi0_Lambert93 = Deg2Rad(46.5);
-    double lambda0_Lambert93 = Deg2Rad(3.0);
-    double conv=-sin(phi0_Lambert93)*(longitude-lambda0_Lambert93);
-    return  conv;
+  double phi0_Lambert93 = Deg2Rad(46.5);
+  double lambda0_Lambert93 = Deg2Rad(3.0);
+  double conv = -sin(phi0_Lambert93) * (longitude - lambda0_Lambert93);
+  return conv;
 }
 
 ////////////////////////////////////////////////////////////////////
-void Geodesie::Geographique_2_Lambert93(const Raf98& raf98,double lambda,double phi,double he,Matrice in,double& E,double& N,double& h,Matrice& out) {
-    Matrice passage;
-    double conv=Geodesie::ConvMerApp(lambda);
-    double c_=cos(conv);
-    double s_=sin(conv);
-
-    passage.c0_l0 = c_;
-    passage.c0_l1 = s_;
-    passage.c0_l2 =  0.0;
-
-    passage.c1_l0 = -s_;
-    passage.c1_l1 = c_;
-    passage.c1_l2 =  0.0;
-
-    passage.c2_l0 =  0.0;
-    passage.c2_l1 =  0.0;
-    passage.c2_l2 =  1.0;
-
-    out=ProdMat(passage,in);
-    double diff_h;
-    raf98.Interpol(Rad2Deg(lambda),Rad2Deg(phi),&diff_h);
-    h=he-diff_h;
-
-    Geodesie::Geo2ProjLambert(
-                lambda,phi,
-                n_Lambert93,c_Lambert93,e_Lambert93,
-                lambda0_Lambert93,xs_Lambert93,ys_Lambert93,
-                E,N);
+void Geodesie::Geographique_2_Lambert93(const Raf98 &raf98, double lambda,
+                                        double phi, double he, Matrice in,
+                                        double &E, double &N, double &h,
+                                        Matrice &out) {
+  Matrice passage;
+  double conv = Geodesie::ConvMerApp(lambda);
+  double c_ = cos(conv);
+  double s_ = sin(conv);
+
+  passage.c0_l0 = c_;
+  passage.c0_l1 = s_;
+  passage.c0_l2 = 0.0;
+
+  passage.c1_l0 = -s_;
+  passage.c1_l1 = c_;
+  passage.c1_l2 = 0.0;
+
+  passage.c2_l0 = 0.0;
+  passage.c2_l1 = 0.0;
+  passage.c2_l2 = 1.0;
+
+  out = ProdMat(passage, in);
+  double diff_h;
+  raf98.Interpol(Rad2Deg(lambda), Rad2Deg(phi), &diff_h);
+  h = he - diff_h;
+
+  Geodesie::Geo2ProjLambert(lambda, phi, n_Lambert93, c_Lambert93, e_Lambert93,
+                            lambda0_Lambert93, xs_Lambert93, ys_Lambert93, E,
+                            N);
 }
 ////////////////////////////////////////////////////////////////////////
-void Geodesie::Geographique_2_Lambert93(const Raf98& raf98,double lambda,double phi,double he,double& E,double& N,double& h) {
-    Geodesie::Geo2ProjLambert(
-                lambda,phi,
-                n_Lambert93,c_Lambert93,e_Lambert93,
-                lambda0_Lambert93,xs_Lambert93,ys_Lambert93,
-                E,N);
-
-    double diff_h;
-    raf98.Interpol(Rad2Deg(lambda),Rad2Deg(phi),&diff_h);
-    h=he-diff_h;
+void Geodesie::Geographique_2_Lambert93(const Raf98 &raf98, double lambda,
+                                        double phi, double he, double &E,
+                                        double &N, double &h) {
+  Geodesie::Geo2ProjLambert(lambda, phi, n_Lambert93, c_Lambert93, e_Lambert93,
+                            lambda0_Lambert93, xs_Lambert93, ys_Lambert93, E,
+                            N);
+
+  double diff_h;
+  raf98.Interpol(Rad2Deg(lambda), Rad2Deg(phi), &diff_h);
+  h = he - diff_h;
 }
 /**
-    Converts Lambert93 coordinates (East, North, Height) into geographical coordinates in radians (Longitude = Rad2Deg(lambda), Latitude = Rad2Deg(phi), Height)
+    Converts Lambert93 coordinates (East, North, Height) into geographical
+   coordinates in radians (Longitude = Rad2Deg(lambda), Latitude = Rad2Deg(phi),
+   Height)
 */
-void Geodesie::Lambert93_2_Geographique(const Raf98& raf98,double E,double N,double h,double& lambda,double& phi,double& he) {
-    Geodesie::Proj2GeoLambert(
-                E,N,
-                n_Lambert93,c_Lambert93,e_Lambert93,
-                lambda0_Lambert93,xs_Lambert93,ys_Lambert93,
-                0.0000000000000001,
-                lambda,phi);
-
-    double diff_h;
-    raf98.Interpol(Rad2Deg(lambda),Rad2Deg(phi),&diff_h);
-    he=h+diff_h;
+void Geodesie::Lambert93_2_Geographique(const Raf98 &raf98, double E, double N,
+                                        double h, double &lambda, double &phi,
+                                        double &he) {
+  Geodesie::Proj2GeoLambert(E, N, n_Lambert93, c_Lambert93, e_Lambert93,
+                            lambda0_Lambert93, xs_Lambert93, ys_Lambert93,
+                            0.0000000000000001, lambda, phi);
+
+  double diff_h;
+  raf98.Interpol(Rad2Deg(lambda), Rad2Deg(phi), &diff_h);
+  he = h + diff_h;
 }
 ////////////////////////////////////////////////////////////////////////
-void Geodesie::Lambert93_2_Geographique(const Raf98& raf98,double E,double N,double h,Matrice in,double& lambda,double& phi,double& he,Matrice& out) {
-    Geodesie::Proj2GeoLambert(
-                E,N,
-                n_Lambert93,c_Lambert93,e_Lambert93,
-                lambda0_Lambert93,xs_Lambert93,ys_Lambert93,
-                0.0000000000000001,
-                lambda,phi);
-
-    Matrice passage;
-    double conv=Geodesie::ConvMerApp(lambda);
-    double c_=cos(conv);
-    double s_=sin(conv);
-
-    passage.c0_l0 = c_;
-    passage.c0_l1 = -s_;
-    passage.c0_l2 =  0.0;
-
-    passage.c1_l0 = s_;
-    passage.c1_l1 = c_;
-    passage.c1_l2 =  0.0;
-
-    passage.c2_l0 =  0.0;
-    passage.c2_l1 =  0.0;
-    passage.c2_l2 =  1.0;
-
-    out=ProdMat(passage,in);
-
-    double diff_h;
-    raf98.Interpol(Rad2Deg(lambda),Rad2Deg(phi),&diff_h);
-    he=h+diff_h;
+void Geodesie::Lambert93_2_Geographique(const Raf98 &raf98, double E, double N,
+                                        double h, Matrice in, double &lambda,
+                                        double &phi, double &he, Matrice &out) {
+  Geodesie::Proj2GeoLambert(E, N, n_Lambert93, c_Lambert93, e_Lambert93,
+                            lambda0_Lambert93, xs_Lambert93, ys_Lambert93,
+                            0.0000000000000001, lambda, phi);
+
+  Matrice passage;
+  double conv = Geodesie::ConvMerApp(lambda);
+  double c_ = cos(conv);
+  double s_ = sin(conv);
+
+  passage.c0_l0 = c_;
+  passage.c0_l1 = -s_;
+  passage.c0_l2 = 0.0;
+
+  passage.c1_l0 = s_;
+  passage.c1_l1 = c_;
+  passage.c1_l2 = 0.0;
+
+  passage.c2_l0 = 0.0;
+  passage.c2_l1 = 0.0;
+  passage.c2_l2 = 1.0;
+
+  out = ProdMat(passage, in);
+
+  double diff_h;
+  raf98.Interpol(Rad2Deg(lambda), Rad2Deg(phi), &diff_h);
+  he = h + diff_h;
 }
 
 ////////////////////////////////////////////////////////////////////////
-void Geodesie::Geographique_2_ECEF(double longitude,double latitude,double he,double& x,double& y,double& z) {
-    const double n = GRS_a / sqrt(1.0 - pow(GRS_e,2) * pow(sin(latitude),2));
-    x = (n + he) * cos(latitude) * cos(longitude);
-    y = (n + he) * cos(latitude) * sin(longitude);
-    z = (n * (1.0 - pow(GRS_e,2)) + he) * sin(latitude);
+void Geodesie::Geographique_2_ECEF(double longitude, double latitude, double he,
+                                   double &x, double &y, double &z) {
+  const double n = GRS_a / sqrt(1.0 - pow(GRS_e, 2) * pow(sin(latitude), 2));
+  x = (n + he) * cos(latitude) * cos(longitude);
+  y = (n + he) * cos(latitude) * sin(longitude);
+  z = (n * (1.0 - pow(GRS_e, 2)) + he) * sin(latitude);
 }
 
 ////////////////////////////////////////////////////////////////////////
-void Geodesie::ECEF_2_ENU(double x,double y,double z,double& e,double& n,double& u,double lon0,double lat0,double he0) {
-    double slat = std::sin(lat0);
-    double clat = std::cos(lat0);
-    double slon = std::sin(lon0);
-    double clon = std::cos(lon0);
-
-    Geodesie::Matrice C;
-    C.c0_l0 = -slon;
-    C.c1_l0 = clon;
-
-    C.c0_l1 = -clon * slat;
-    C.c1_l1 = -slon * slat;
-    C.c2_l1 = clat;
-
-    C.c0_l2 = clon * clat;
-    C.c1_l2 = slon * clat;
-    C.c2_l2 = slat;
-
-    double x0, y0, z0;
-    Geographique_2_ECEF(lon0,lat0,he0, x0,y0,z0);
-
-    x -= x0;
-    y -= y0;
-    z -= z0;
-
-    C.Apply(x,y,z, e,n,u);
-}
+void Geodesie::ECEF_2_ENU(double x, double y, double z, double &e, double &n,
+                          double &u, double lon0, double lat0, double he0) {
+  double slat = std::sin(lat0);
+  double clat = std::cos(lat0);
+  double slon = std::sin(lon0);
+  double clon = std::cos(lon0);
+
+  Geodesie::Matrice C;
+  C.c0_l0 = -slon;
+  C.c1_l0 = clon;
+
+  C.c0_l1 = -clon * slat;
+  C.c1_l1 = -slon * slat;
+  C.c2_l1 = clat;
+
+  C.c0_l2 = clon * clat;
+  C.c1_l2 = slon * clat;
+  C.c2_l2 = slat;
+
+  double x0, y0, z0;
+  Geographique_2_ECEF(lon0, lat0, he0, x0, y0, z0);
+
+  x -= x0;
+  y -= y0;
+  z -= z0;
+
+  C.Apply(x, y, z, e, n, u);
+}
Index: trunk/lib/FlairSensorActuator/src/unexported/AfroBldc_impl.h
===================================================================
--- trunk/lib/FlairSensorActuator/src/unexported/AfroBldc_impl.h	(revision 14)
+++ trunk/lib/FlairSensorActuator/src/unexported/AfroBldc_impl.h	(revision 15)
@@ -16,5 +16,4 @@
 /*********************************************************************/
 
-
 #ifndef AFROBLDC_IMPL_H
 #define AFROBLDC_IMPL_H
@@ -25,38 +24,34 @@
 #define MAX_MOTORS 8
 
-namespace flair
-{
-    namespace core
-    {
-        class I2cPort;
-    }
-    namespace gui
-    {
-        class SpinBox;
-        class GroupBox;
-        class Layout;
-    }
-    namespace actuator
-    {
-        class AfroBldc;
-    }
-    namespace sensor
-    {
-        class BatteryMonitor;
-    }
+namespace flair {
+namespace core {
+class I2cPort;
+}
+namespace gui {
+class SpinBox;
+class GroupBox;
+class Layout;
+}
+namespace actuator {
+class AfroBldc;
+}
+namespace sensor {
+class BatteryMonitor;
+}
 }
 
-class AfroBldc_impl
-{
-    public:
-        AfroBldc_impl(flair::actuator::AfroBldc* self,flair::gui::Layout *layout,flair::core::I2cPort* i2cport);
-        ~AfroBldc_impl();
-        void SetMotors(float* value);
+class AfroBldc_impl {
+public:
+  AfroBldc_impl(flair::actuator::AfroBldc *self, flair::gui::Layout *layout,
+                flair::core::I2cPort *i2cport);
+  ~AfroBldc_impl();
+  void SetMotors(float *value);
 
-    private:
-        void WriteValue(uint16_t value);//I2cPort mutex must be taken before calling this function
-        int nb_mot;
-        flair::core::I2cPort* i2cport;
-        flair::actuator::AfroBldc* self;
+private:
+  void WriteValue(uint16_t value); // I2cPort mutex must be taken before calling
+                                   // this function
+  int nb_mot;
+  flair::core::I2cPort *i2cport;
+  flair::actuator::AfroBldc *self;
 };
 
Index: trunk/lib/FlairSensorActuator/src/unexported/BlCtrlV2_impl.h
===================================================================
--- trunk/lib/FlairSensorActuator/src/unexported/BlCtrlV2_impl.h	(revision 14)
+++ trunk/lib/FlairSensorActuator/src/unexported/BlCtrlV2_impl.h	(revision 15)
@@ -16,5 +16,4 @@
 /*********************************************************************/
 
-
 #ifndef BLCTRLV2_IMPL_H
 #define BLCTRLV2_IMPL_H
@@ -25,44 +24,45 @@
 #define MAX_MOTORS 8
 
-namespace flair
-{
-    namespace core
-    {
-        class I2cPort;
-    }
-    namespace gui
-    {
-        class SpinBox;
-        class GroupBox;
-        class Layout;
-    }
-    namespace actuator
-    {
-        class BlCtrlV2;
-    }
-    namespace sensor
-    {
-        class BatteryMonitor;
-    }
+namespace flair {
+namespace core {
+class I2cPort;
+}
+namespace gui {
+class SpinBox;
+class GroupBox;
+class Layout;
+}
+namespace actuator {
+class BlCtrlV2;
+}
+namespace sensor {
+class BatteryMonitor;
+}
 }
 
-class BlCtrlV2_impl
-{
-    public:
-        BlCtrlV2_impl(flair::actuator::BlCtrlV2* self,flair::gui::Layout *layout,flair::core::I2cPort* i2cport);
-        ~BlCtrlV2_impl();
-        void SetMotors(float* value);
-        flair::sensor::BatteryMonitor *battery;
-        flair::gui::SpinBox *poles;
+class BlCtrlV2_impl {
+public:
+  BlCtrlV2_impl(flair::actuator::BlCtrlV2 *self, flair::gui::Layout *layout,
+                flair::core::I2cPort *i2cport);
+  ~BlCtrlV2_impl();
+  void SetMotors(float *value);
+  flair::sensor::BatteryMonitor *battery;
+  flair::gui::SpinBox *poles;
 
-    private:
-        void WriteValue(uint16_t value);//I2cPort mutex must be taken before calling this function
-        void DetectMotors(void);
-        void GetCurrentSpeedAndVoltage(float &current,float &speed,float &voltage);//I2cPort mutex must be taken before calling this function
-        void GetCurrentAndSpeed(float &current,float &speed);//I2cPort mutex must be taken before calling this function
-        flair::core::Time last_voltage_time;
-        int nb_mot;
-        flair::core::I2cPort* i2cport;
-        flair::actuator::BlCtrlV2* self;
+private:
+  void WriteValue(uint16_t value); // I2cPort mutex must be taken before calling
+                                   // this function
+  void DetectMotors(void);
+  void GetCurrentSpeedAndVoltage(float &current, float &speed,
+                                 float &voltage); // I2cPort mutex must be taken
+                                                  // before calling this
+                                                  // function
+  void GetCurrentAndSpeed(
+      float &current,
+      float &speed); // I2cPort mutex must be taken before calling this function
+  flair::core::Time last_voltage_time;
+  int nb_mot;
+  flair::core::I2cPort *i2cport;
+  flair::actuator::BlCtrlV2 *self;
 };
 
Index: trunk/lib/FlairSensorActuator/src/unexported/Bldc_impl.h
===================================================================
--- trunk/lib/FlairSensorActuator/src/unexported/Bldc_impl.h	(revision 14)
+++ trunk/lib/FlairSensorActuator/src/unexported/Bldc_impl.h	(revision 15)
@@ -22,49 +22,46 @@
 #include <stdint.h>
 
-namespace flair
-{
-    namespace gui
-    {
-        class DoubleSpinBox;
-        class Layout;
-        class Label;
-        class DataPlot1D;
-        class TabWidget;
-        class PushButton;
-    }
-    namespace actuator
-    {
-        class Bldc;
-    }
+namespace flair {
+namespace gui {
+class DoubleSpinBox;
+class Layout;
+class Label;
+class DataPlot1D;
+class TabWidget;
+class PushButton;
+}
+namespace actuator {
+class Bldc;
+}
 }
 
-class Bldc_impl
-{
-    public:
-        Bldc_impl(flair::actuator::Bldc* self,flair::gui::Layout* layout,std::string name,uint8_t motors_count);
-        Bldc_impl(flair::actuator::Bldc* self,uint8_t motors_count);//simulation
-        ~Bldc_impl();
-        void UpdateFrom(const flair::core::io_data *data);
-        void LockUserInterface(void) const;
-        void UnlockUserInterface(void) const;
-        bool are_enabled;
-        float* power;
-        void UseDefaultPlot(flair::gui::TabWidget* tab);
-        uint8_t motors_count;
-        flair::gui::Layout* layout;
+class Bldc_impl {
+public:
+  Bldc_impl(flair::actuator::Bldc *self, flair::gui::Layout *layout,
+            std::string name, uint8_t motors_count);
+  Bldc_impl(flair::actuator::Bldc *self, uint8_t motors_count); // simulation
+  ~Bldc_impl();
+  void UpdateFrom(const flair::core::io_data *data);
+  void LockUserInterface(void) const;
+  void UnlockUserInterface(void) const;
+  bool are_enabled;
+  float *power;
+  void UseDefaultPlot(flair::gui::TabWidget *tab);
+  uint8_t motors_count;
+  flair::gui::Layout *layout;
 
-    private:
-        float *values;
-        float Sat(float value);
-        flair::actuator::Bldc* self;
-        flair::gui::DoubleSpinBox *min_value,*max_value,*test_value;
-        flair::gui::Label *flight_time;
-        flair::gui::DataPlot1D *plots;
-        flair::core::Time flight_start_time;
-        flair::gui::PushButton **button_test;
-        int time_sec;
-        bool is_running;
-        flair::core::Time test_start_time;
-        int tested_motor;//=-1 if no motor is tested
+private:
+  float *values;
+  float Sat(float value);
+  flair::actuator::Bldc *self;
+  flair::gui::DoubleSpinBox *min_value, *max_value, *test_value;
+  flair::gui::Label *flight_time;
+  flair::gui::DataPlot1D *plots;
+  flair::core::Time flight_start_time;
+  flair::gui::PushButton **button_test;
+  int time_sec;
+  bool is_running;
+  flair::core::Time test_start_time;
+  int tested_motor; //=-1 if no motor is tested
 };
 
Index: trunk/lib/FlairSensorActuator/src/unexported/Gx3_25_imu_impl.h
===================================================================
--- trunk/lib/FlairSensorActuator/src/unexported/Gx3_25_imu_impl.h	(revision 14)
+++ trunk/lib/FlairSensorActuator/src/unexported/Gx3_25_imu_impl.h	(revision 15)
@@ -18,15 +18,15 @@
 
 namespace flair {
-    namespace core {
-        class FrameworkManager;
-        class SerialPort;
-        class AhrsData;
-    }
-    namespace gui {
-        class SpinBox;
-        class CheckBox;
-        class PushButton;
-        class Label;
-    }
+namespace core {
+class FrameworkManager;
+class SerialPort;
+class AhrsData;
+}
+namespace gui {
+class SpinBox;
+class CheckBox;
+class PushButton;
+class Label;
+}
 }
 
@@ -38,33 +38,38 @@
 class Gx3_25_imu_impl {
 
-    public:
-        Gx3_25_imu_impl(flair::sensor::Gx3_25_imu* self,std::string name,flair::core::SerialPort *serialport,flair::sensor::Gx3_25_imu::Command_t command,flair::gui::GroupBox* setupgroupbox);
-        ~Gx3_25_imu_impl();
-        void Run(void);
+public:
+  Gx3_25_imu_impl(flair::sensor::Gx3_25_imu *self, std::string name,
+                  flair::core::SerialPort *serialport,
+                  flair::sensor::Gx3_25_imu::Command_t command,
+                  flair::gui::GroupBox *setupgroupbox);
+  ~Gx3_25_imu_impl();
+  void Run(void);
 
-    private:
-        void DeviceReset(void);
-        void GetData(uint8_t* buf,ssize_t buf_size,flair::core::Time *time);
-        float Dequeue(uint8_t** buf);
-        void GyrosBias(void);
-        void SamplingSettings(void);
-        void SetBaudrate(int value);
-        bool CalcChecksum(uint8_t *buf,int size);
-        int FirmwareNumber(void);
-        void PrintModelInfo(void);
-        void RealignUpNorth(bool realign_up,bool realign_north);
+private:
+  void DeviceReset(void);
+  void GetData(uint8_t *buf, ssize_t buf_size, flair::core::Time *time);
+  float Dequeue(uint8_t **buf);
+  void GyrosBias(void);
+  void SamplingSettings(void);
+  void SetBaudrate(int value);
+  bool CalcChecksum(uint8_t *buf, int size);
+  int FirmwareNumber(void);
+  void PrintModelInfo(void);
+  void RealignUpNorth(bool realign_up, bool realign_north);
 
-        void SetContinuousMode(uint8_t continuous_command);
+  void SetContinuousMode(uint8_t continuous_command);
 
-        flair::gui::GroupBox *setupgroupbox;
-        flair::gui::SpinBox *data_rate,*gyro_acc_size,*mag_size,*up_comp,*north_comp;
-        flair::gui::CheckBox *coning,*disable_magn,*disable_north_comp,*disable_grav_comp;
-        flair::gui::PushButton *button_bias;
-        flair::gui::Label *data_rate_label;
+  flair::gui::GroupBox *setupgroupbox;
+  flair::gui::SpinBox *data_rate, *gyro_acc_size, *mag_size, *up_comp,
+      *north_comp;
+  flair::gui::CheckBox *coning, *disable_magn, *disable_north_comp,
+      *disable_grav_comp;
+  flair::gui::PushButton *button_bias;
+  flair::gui::Label *data_rate_label;
 
-        flair::core::SerialPort *serialport;
-        uint8_t command;
-        flair::sensor::Gx3_25_imu *self;
-        flair::core::AhrsData *ahrsData;
+  flair::core::SerialPort *serialport;
+  uint8_t command;
+  flair::sensor::Gx3_25_imu *self;
+  flair::core::AhrsData *ahrsData;
 };
 
Index: trunk/lib/FlairSensorActuator/src/unexported/VrpnClient_impl.h
===================================================================
--- trunk/lib/FlairSensorActuator/src/unexported/VrpnClient_impl.h	(revision 14)
+++ trunk/lib/FlairSensorActuator/src/unexported/VrpnClient_impl.h	(revision 15)
@@ -22,25 +22,21 @@
 #include <vector>
 
-namespace flair
-{
-    namespace core
-    {
-        class OneAxisRotation;
-        class Vector3D;
-        class Quaternion;
-        class Mutex;
-        class SerialPort;
-    }
-    namespace gui
-    {
-        class TabWidget;
-        class Tab;
-        class Layout;
-    }
-    namespace sensor
-    {
-        class VrpnClient;
-        class VrpnObject;
-    }
+namespace flair {
+namespace core {
+class OneAxisRotation;
+class Vector3D;
+class Quaternion;
+class Mutex;
+class SerialPort;
+}
+namespace gui {
+class TabWidget;
+class Tab;
+class Layout;
+}
+namespace sensor {
+class VrpnClient;
+class VrpnObject;
+}
 }
 
@@ -48,36 +44,37 @@
 class vrpn_Connection;
 
-class VrpnClient_impl
-{
-    public:
-        VrpnClient_impl(flair::sensor::VrpnClient* self,std::string name,std::string address,uint16_t us_period);
-        VrpnClient_impl(flair::sensor::VrpnClient* self,std::string name,flair::core::SerialPort* serialport,uint16_t us_period);
-        ~VrpnClient_impl();
-        void AddTrackable(flair::sensor::VrpnObject* obj);//normal
-        void RemoveTrackable(flair::sensor::VrpnObject* obj);//normal
-        void AddTrackable(VrpnObject_impl* obj,uint8_t id);//xbee
-        void RemoveTrackable(VrpnObject_impl* obj);//xbee
-        void ComputeRotations(flair::core::Vector3D& point);
-        void ComputeRotations(flair::core::Quaternion& quat);
-        bool UseXbee(void);
-        void Run(void);
-        flair::gui::Tab* setup_tab;
-        flair::gui::TabWidget* tab;
-        vrpn_Connection *connection;
+class VrpnClient_impl {
+public:
+  VrpnClient_impl(flair::sensor::VrpnClient *self, std::string name,
+                  std::string address, uint16_t us_period);
+  VrpnClient_impl(flair::sensor::VrpnClient *self, std::string name,
+                  flair::core::SerialPort *serialport, uint16_t us_period);
+  ~VrpnClient_impl();
+  void AddTrackable(flair::sensor::VrpnObject *obj); // normal
+  void RemoveTrackable(flair::sensor::VrpnObject *obj); // normal
+  void AddTrackable(VrpnObject_impl *obj, uint8_t id); // xbee
+  void RemoveTrackable(VrpnObject_impl *obj); // xbee
+  void ComputeRotations(flair::core::Vector3D &point);
+  void ComputeRotations(flair::core::Quaternion &quat);
+  bool UseXbee(void);
+  void Run(void);
+  flair::gui::Tab *setup_tab;
+  flair::gui::TabWidget *tab;
+  vrpn_Connection *connection;
 
-    private:
-        flair::sensor::VrpnClient* self;
-        flair::core::Mutex* mutex;
-        uint16_t us_period;
-        std::vector<flair::sensor::VrpnObject*> trackables;
-        typedef struct xbee_object{
-            VrpnObject_impl* vrpnobject;
-            uint8_t id;
-        } xbee_object;
+private:
+  flair::sensor::VrpnClient *self;
+  flair::core::Mutex *mutex;
+  uint16_t us_period;
+  std::vector<flair::sensor::VrpnObject *> trackables;
+  typedef struct xbee_object {
+    VrpnObject_impl *vrpnobject;
+    uint8_t id;
+  } xbee_object;
 
-        std::vector<xbee_object> xbee_objects;
-        flair::gui::Tab* main_tab;
-        flair::core::OneAxisRotation *rotation_1,*rotation_2;
-        flair::core::SerialPort* serialport;
+  std::vector<xbee_object> xbee_objects;
+  flair::gui::Tab *main_tab;
+  flair::core::OneAxisRotation *rotation_1, *rotation_2;
+  flair::core::SerialPort *serialport;
 };
 
Index: trunk/lib/FlairSensorActuator/src/unexported/VrpnObject_impl.h
===================================================================
--- trunk/lib/FlairSensorActuator/src/unexported/VrpnObject_impl.h	(revision 14)
+++ trunk/lib/FlairSensorActuator/src/unexported/VrpnObject_impl.h	(revision 15)
@@ -25,53 +25,51 @@
 #include "Quaternion.h"
 
-namespace flair
-{
-    namespace core
-    {
-        class cvmatrix;
-        class Vector3D;
-        class Euler;
-    }
-    namespace gui
-    {
-        class TabWidget;
-        class Tab;
-        class DataPlot1D;
-    }
-    namespace sensor
-    {
-        class VrpnClient;
-        class VrpnObject;
-    }
+namespace flair {
+namespace core {
+class cvmatrix;
+class Vector3D;
+class Euler;
+}
+namespace gui {
+class TabWidget;
+class Tab;
+class DataPlot1D;
+}
+namespace sensor {
+class VrpnClient;
+class VrpnObject;
+}
 }
 
-class VrpnObject_impl
-{
-    friend class VrpnClient_impl;
+class VrpnObject_impl {
+  friend class VrpnClient_impl;
 
-    public:
-        VrpnObject_impl(flair::sensor::VrpnObject* self,const flair::sensor::VrpnClient *parent,std::string name,int id,const flair::gui::TabWidget* tab);
-        ~VrpnObject_impl(void);
+public:
+  VrpnObject_impl(flair::sensor::VrpnObject *self,
+                  const flair::sensor::VrpnClient *parent, std::string name,
+                  int id, const flair::gui::TabWidget *tab);
+  ~VrpnObject_impl(void);
 
-        void mainloop(void);
-        void GetEuler(flair::core::Euler &euler);
-        void GetQuaternion(flair::core::Quaternion &quaternion);
-        void GetPosition(flair::core::Vector3D &point);
-        bool IsTracked(unsigned int timeout_ms);
+  void mainloop(void);
+  void GetEuler(flair::core::Euler &euler);
+  void GetQuaternion(flair::core::Quaternion &quaternion);
+  void GetPosition(flair::core::Vector3D &point);
+  bool IsTracked(unsigned int timeout_ms);
 
-        flair::gui::Tab* plot_tab;
-        flair::gui::DataPlot1D* x_plot;
-        flair::gui::DataPlot1D* y_plot;
-        flair::gui::DataPlot1D* z_plot;
-        flair::core::cvmatrix *output,*state;
+  flair::gui::Tab *plot_tab;
+  flair::gui::DataPlot1D *x_plot;
+  flair::gui::DataPlot1D *y_plot;
+  flair::gui::DataPlot1D *z_plot;
+  flair::core::cvmatrix *output, *state;
 
-        static void	VRPN_CALLBACK handle_pos(void *userdata, const vrpn_TRACKERCB t);
+  static void VRPN_CALLBACK handle_pos(void *userdata, const vrpn_TRACKERCB t);
 
-    private:
-        flair::sensor::VrpnObject* self;
-        const flair::sensor::VrpnClient *parent;
-        vrpn_Tracker_Remote* tracker;
-        flair::core::Quaternion quaternion;//todo: quaternion should be included in the output to replace euler angles
-        void Update(void);
+private:
+  flair::sensor::VrpnObject *self;
+  const flair::sensor::VrpnClient *parent;
+  vrpn_Tracker_Remote *tracker;
+  flair::core::Quaternion quaternion; // todo: quaternion should be included in
+                                      // the output to replace euler angles
+  void Update(void);
 };
 
Index: trunk/lib/FlairSensorActuator/src/unexported/XBldc_impl.h
===================================================================
--- trunk/lib/FlairSensorActuator/src/unexported/XBldc_impl.h	(revision 14)
+++ trunk/lib/FlairSensorActuator/src/unexported/XBldc_impl.h	(revision 15)
@@ -16,5 +16,4 @@
 /*********************************************************************/
 
-
 #ifndef XBLDC_IMPL_H
 #define XBLDC_IMPL_H
@@ -23,33 +22,28 @@
 #include <stdint.h>
 
-namespace flair
-{
-    namespace core
-    {
-        class I2cPort;
-    }
-    namespace actuator
-    {
-        class XBldc;
-    }
+namespace flair {
+namespace core {
+class I2cPort;
+}
+namespace actuator {
+class XBldc;
+}
 }
 
+class XBldc_impl {
 
-class XBldc_impl
-{
+public:
+  XBldc_impl(flair::actuator::XBldc *self, flair::core::I2cPort *i2cport);
+  ~XBldc_impl();
+  void UpdateFrom(flair::core::io_data *data);
+  void SetMotors(float *value);
 
-    public:
-        XBldc_impl(flair::actuator::XBldc* self,flair::core::I2cPort* i2cport);
-        ~XBldc_impl();
-        void UpdateFrom(flair::core::io_data *data);
-        void SetMotors(float* value);
-
-    private:
-        uint8_t Sat(float value,uint8_t min,uint8_t max);
-        //void StartTest(uint8_t moteur);
-        void ChangeDirection(uint8_t moteur);
-        void ChangeAdress(uint8_t old_add,uint8_t new_add);
-        flair::actuator::XBldc* self;
-        flair::core::I2cPort* i2cport;
+private:
+  uint8_t Sat(float value, uint8_t min, uint8_t max);
+  // void StartTest(uint8_t moteur);
+  void ChangeDirection(uint8_t moteur);
+  void ChangeAdress(uint8_t old_add, uint8_t new_add);
+  flair::actuator::XBldc *self;
+  flair::core::I2cPort *i2cport;
 };
 
Index: trunk/lib/FlairSensorActuator/src/unexported/geodesie.h
===================================================================
--- trunk/lib/FlairSensorActuator/src/unexported/geodesie.h	(revision 14)
+++ trunk/lib/FlairSensorActuator/src/unexported/geodesie.h	(revision 15)
@@ -13,55 +13,64 @@
 
 #ifndef M_PI
-#   define M_PI 3.14159265358979323846
+#define M_PI 3.14159265358979323846
 #endif
 #ifndef M_PI_2
-#   define M_PI_2 1.57079632679489661923
+#define M_PI_2 1.57079632679489661923
 #endif
 #ifndef M_PI_4
-#   define M_PI_4 0.78539816339744830962
+#define M_PI_4 0.78539816339744830962
 #endif
 
 ////////////////////////////////////////////////////////////////////////
 struct Matrice {
-    Matrice(const Matrice & A);
-    Matrice();
-    void Apply(double v0, double v1, double v2, double & Mv0, double & Mv1, double & Mv2);
-    double c0_l0;double c1_l0;double c2_l0;
-    double c0_l1;double c1_l1;double c2_l1;
-    double c0_l2;double c1_l2;double c2_l2;
+  Matrice(const Matrice &A);
+  Matrice();
+  void Apply(double v0, double v1, double v2, double &Mv0, double &Mv1,
+             double &Mv2);
+  double c0_l0;
+  double c1_l0;
+  double c2_l0;
+  double c0_l1;
+  double c1_l1;
+  double c2_l1;
+  double c0_l2;
+  double c1_l2;
+  double c2_l2;
 }; // class
 
 Matrice TransMat(const Matrice A);
 
-Matrice ProdMat(const Matrice A,const Matrice B);
-void Write(const Matrice A,std::ostream& out);
+Matrice ProdMat(const Matrice A, const Matrice B);
+void Write(const Matrice A, std::ostream &out);
 
 ////////////////////////////////////////////////////////////////////////
 class Raf98 {
-private :
-    std::vector<double> m_dvalues;
-    double LitGrille(unsigned int c,unsigned int l) const;
-public :
-    ~Raf98();
-    Raf98() {}
-    bool Load(const std::string & s);
-    bool Interpol(double longitude/*deg*/, double latitude/*deg*/, double* Hwgs84) const;
+private:
+  std::vector<double> m_dvalues;
+  double LitGrille(unsigned int c, unsigned int l) const;
+
+public:
+  ~Raf98();
+  Raf98() {}
+  bool Load(const std::string &s);
+  bool Interpol(double longitude /*deg*/, double latitude /*deg*/,
+                double *Hwgs84) const;
 }; // class
 ////////////////////////////////////////////////////////////////////////
 
 ////////////////////////////////////////////////////////////////////////
-inline double Deg2Rad(double deg) {return deg*M_PI/180.0;}
-inline double Rad2Deg(double rad) {return rad*180.0/M_PI;}
+inline double Deg2Rad(double deg) { return deg * M_PI / 180.0; }
+inline double Rad2Deg(double rad) { return rad * 180.0 / M_PI; }
 ////////////////////////////////////////////////////////////////////////
 
-const double a_Lambert93=6378137;
-const double f_Lambert93=1 / 298.257222101;
-const double e_Lambert93=sqrt(f_Lambert93*(2-f_Lambert93));
-const double lambda0_Lambert93=Deg2Rad(3.0);//degres
-const double phi0_Lambert93=Deg2Rad(46.5);
-const double phi1_Lambert93=Deg2Rad(44.0);
-const double phi2_Lambert93=Deg2Rad(49.0);//degres
-const double X0_Lambert93=700000;//
-const double Y0_Lambert93=6600000;//
+const double a_Lambert93 = 6378137;
+const double f_Lambert93 = 1 / 298.257222101;
+const double e_Lambert93 = sqrt(f_Lambert93 * (2 - f_Lambert93));
+const double lambda0_Lambert93 = Deg2Rad(3.0); // degres
+const double phi0_Lambert93 = Deg2Rad(46.5);
+const double phi1_Lambert93 = Deg2Rad(44.0);
+const double phi2_Lambert93 = Deg2Rad(49.0); // degres
+const double X0_Lambert93 = 700000;  //
+const double Y0_Lambert93 = 6600000; //
 const double n_Lambert93 = 0.7256077650;
 const double c_Lambert93 = 11754255.426;
@@ -70,13 +79,19 @@
 
 const double GRS_a = 6378137;
-const double GRS_f = 1/298.257222101;
-const double GRS_b = GRS_a*(1-GRS_f);
-const double GRS_e = sqrt((pow(GRS_a,2) - pow(GRS_b,2)) / pow(GRS_a,2));
+const double GRS_f = 1 / 298.257222101;
+const double GRS_b = GRS_a * (1 - GRS_f);
+const double GRS_e = sqrt((pow(GRS_a, 2) - pow(GRS_b, 2)) / pow(GRS_a, 2));
 
 ////////////////////////////////////////////////////////////////////////
-void Geographique_2_Lambert93(const Raf98& raf98,double lambda,double phi,double he,Matrice in,double& E,double& N,double& h,Matrice& out);
-void Geographique_2_Lambert93(const Raf98& raf98,double lambda,double phi,double he,double& E,double& N,double& h);
-void Lambert93_2_Geographique(const Raf98& raf98,double E,double N,double h,double& lambda,double& phi,double& he);
-void Lambert93_2_Geographique(const Raf98& raf98,double E,double N,double h,Matrice in,double& lambda,double& phi,double& he,Matrice& out);
+void Geographique_2_Lambert93(const Raf98 &raf98, double lambda, double phi,
+                              double he, Matrice in, double &E, double &N,
+                              double &h, Matrice &out);
+void Geographique_2_Lambert93(const Raf98 &raf98, double lambda, double phi,
+                              double he, double &E, double &N, double &h);
+void Lambert93_2_Geographique(const Raf98 &raf98, double E, double N, double h,
+                              double &lambda, double &phi, double &he);
+void Lambert93_2_Geographique(const Raf98 &raf98, double E, double N, double h,
+                              Matrice in, double &lambda, double &phi,
+                              double &he, Matrice &out);
 /** Convert from geographique to ECEF.
  * @param[in] longitude Longitude in radian.
@@ -84,5 +99,6 @@
  * @param[in] he Height in meter.
  */
-void Geographique_2_ECEF(double longitude, double latitude, double he, double& x, double& y, double& z);
+void Geographique_2_ECEF(double longitude, double latitude, double he,
+                         double &x, double &y, double &z);
 /** Convert from ECEF two ENU.
  * @param[in] lon0 Longitude of the origin in radian.
@@ -90,25 +106,21 @@
  * @param[in] he0 Height of the origin in radian.
  */
-void ECEF_2_ENU(double x,double y,double z,double& e,double& n,double& u,double lon0,double lat0,double he0);
+void ECEF_2_ENU(double x, double y, double z, double &e, double &n, double &u,
+                double lon0, double lat0, double he0);
 ////////////////////////////////////////////////////////////////////////
 
-//ALGO0001
-double LatitueIsometrique(double latitude,double e);
-//ALGO0002
-double LatitueIsometrique2Lat(double latitude_iso,double e,double epsilon);
+// ALGO0001
+double LatitueIsometrique(double latitude, double e);
+// ALGO0002
+double LatitueIsometrique2Lat(double latitude_iso, double e, double epsilon);
 
-//ALGO0003
-void Geo2ProjLambert(
-    double lambda,double phi,
-    double n, double c,double e,
-    double lambdac,double xs,double ys,
-    double& X,double& Y);
-//ALGO0004
-void Proj2GeoLambert(
-    double X,double Y,
-    double n, double c,double e,
-    double lambdac,double xs,double ys,
-    double epsilon,
-    double& lambda,double& phi);
+// ALGO0003
+void Geo2ProjLambert(double lambda, double phi, double n, double c, double e,
+                     double lambdac, double xs, double ys, double &X,
+                     double &Y);
+// ALGO0004
+void Proj2GeoLambert(double X, double Y, double n, double c, double e,
+                     double lambdac, double xs, double ys, double epsilon,
+                     double &lambda, double &phi);
 
 double ConvMerApp(double longitude);
@@ -118,7 +130,7 @@
 */
 template <typename _T1, typename _T2>
-void cartesianToPolar(const _T1 x, const _T1 y, _T2 & r, _T2 & theta) {
-    r = std::sqrt(x*x + y*y);
-    theta = std::atan2(x, y);
+void cartesianToPolar(const _T1 x, const _T1 y, _T2 &r, _T2 &theta) {
+  r = std::sqrt(x * x + y * y);
+  theta = std::atan2(x, y);
 }
 
@@ -127,29 +139,33 @@
 */
 template <typename _T1, typename _T2>
-void polarToCartesian(const _T1 r, const _T1 theta, _T2 & x, _T2 & y) {
-    x = r * std::cos(theta);
-    y = r * std::sin(theta);
+void polarToCartesian(const _T1 r, const _T1 theta, _T2 &x, _T2 &y) {
+  x = r * std::cos(theta);
+  y = r * std::sin(theta);
 }
 
 /**
-Converts Cartesian (x, y, z) coordinates to spherical coordinates (r, theta, phi)
+Converts Cartesian (x, y, z) coordinates to spherical coordinates (r, theta,
+phi)
 Angles expressed in radians.
 */
 template <typename _T1, typename _T2>
-void cartesianToSpherical(const _T1 x, const _T1 y, const _T1 z, _T2 & r, _T2 & theta, _T2 & phi) {
-    r = std::sqrt(x*x + y*y + z*z);
-    theta = std::acos(z / r);
-    phi = std::atan2(y, x);
+void cartesianToSpherical(const _T1 x, const _T1 y, const _T1 z, _T2 &r,
+                          _T2 &theta, _T2 &phi) {
+  r = std::sqrt(x * x + y * y + z * z);
+  theta = std::acos(z / r);
+  phi = std::atan2(y, x);
 }
 
 /**
-Converts spherical coordinates (r, theta, phi) to Cartesian (x, y, z) coordinates.
+Converts spherical coordinates (r, theta, phi) to Cartesian (x, y, z)
+coordinates.
 Angles expressed in radians.
 */
 template <typename _T1, typename _T2>
-void sphericalToCartesian(const _T1 r, const _T1 theta, const _T1 phi, _T2 & x, _T2 & y, _T2 & z) {
-    x = r * std::sin(theta) * std::cos(phi);
-    y = r * std::sin(theta) * std::sin(phi);
-    z = r * std::cos(theta);
+void sphericalToCartesian(const _T1 r, const _T1 theta, const _T1 phi, _T2 &x,
+                          _T2 &y, _T2 &z) {
+  x = r * std::sin(theta) * std::cos(phi);
+  y = r * std::sin(theta) * std::sin(phi);
+  z = r * std::cos(theta);
 }
 
Index: trunk/lib/FlairSimulator/src/AnimPoursuite.cpp
===================================================================
--- trunk/lib/FlairSimulator/src/AnimPoursuite.cpp	(revision 14)
+++ trunk/lib/FlairSimulator/src/AnimPoursuite.cpp	(revision 15)
@@ -28,121 +28,105 @@
 using namespace scene;
 
-namespace flair
-{
-namespace simulator
-{
+namespace flair {
+namespace simulator {
 
-AnimPoursuite::AnimPoursuite(const ISceneNode* parent,float rotateSpeed , float zoomSpeed )
-{
-    this->parent=parent;
-    this->zoomSpeed=zoomSpeed;
-    this->rotateSpeed=rotateSpeed;
-    currentZoom=100;
-    RotY=20;
-    RotZ=0;
-    Rotating=false;
-    LMouseKey= false;
+AnimPoursuite::AnimPoursuite(const ISceneNode *parent, float rotateSpeed,
+                             float zoomSpeed) {
+  this->parent = parent;
+  this->zoomSpeed = zoomSpeed;
+  this->rotateSpeed = rotateSpeed;
+  currentZoom = 100;
+  RotY = 20;
+  RotZ = 0;
+  Rotating = false;
+  LMouseKey = false;
 }
 
-AnimPoursuite::~AnimPoursuite()
-{
+AnimPoursuite::~AnimPoursuite() {}
 
+void AnimPoursuite::setPositionOffset(vector3df newpos) { pos_offset = newpos; }
+
+void AnimPoursuite::setTargetOffset(vector3df newpos) {
+  target_offset = newpos;
 }
 
-void AnimPoursuite::setPositionOffset(vector3df newpos)
-{
-    pos_offset=newpos;
+float AnimPoursuite::sat(float value) {
+  if (value > 89)
+    value = 89;
+  if (value < -89)
+    value = -89;
+  return value;
 }
 
-void AnimPoursuite::setTargetOffset(vector3df newpos)
-{
-    target_offset=newpos;
+void AnimPoursuite::animateNode(ISceneNode *node, u32 timeMs) {
+  ICameraSceneNode *camera = static_cast<ICameraSceneNode *>(node);
+  vector3df pos;
+
+  float nRotY = RotY;
+  float nRotZ = RotZ;
+
+  if (LMouseKey == true) {
+    if (!Rotating) {
+      RotateStart = MousePos;
+      Rotating = true;
+      nRotY = RotY;
+      nRotZ = RotZ;
+    } else {
+      nRotY += (RotateStart.Y - MousePos.Y) * rotateSpeed;
+      nRotZ += (RotateStart.X - MousePos.X) * rotateSpeed;
+      nRotY = sat(nRotY);
+    }
+  } else if (Rotating) {
+    RotY += (RotateStart.Y - MousePos.Y) * rotateSpeed;
+    RotZ += (RotateStart.X - MousePos.X) * rotateSpeed;
+    RotY = sat(RotY);
+    nRotY = RotY;
+    nRotZ = RotZ;
+    Rotating = false;
+  }
+
+  pos.X = -currentZoom;
+  pos.Y = 0;
+  pos.Z = 0;
+
+  pos.rotateXZBy(-nRotY);
+  pos.rotateXYBy(getSimulator()->Yaw() + nRotZ + parent->getRotation().Z);
+
+  camera->setPosition(parent->getPosition() + pos + pos_offset);
+  camera->setTarget(parent->getPosition() + target_offset);
 }
 
-float AnimPoursuite::sat(float value)
-{
-    if(value>89) value=89;
-    if(value<-89) value=-89;
-    return value;
+ISceneNodeAnimator *AnimPoursuite::createClone(ISceneNode *node,
+                                               ISceneManager *newManager) {
+  return NULL;
 }
 
-void AnimPoursuite::animateNode(ISceneNode* node, u32 timeMs)
-{
-    ICameraSceneNode* camera = static_cast<ICameraSceneNode*>(node);
-    vector3df pos;
+bool AnimPoursuite::MouseMoved(const SEvent &event,
+                               irr::core::position2df MousePos) {
+  if (event.EventType != EET_MOUSE_INPUT_EVENT)
+    return false;
 
-    float nRotY = RotY;
-    float nRotZ = RotZ;
+  switch (event.MouseInput.Event) {
 
-    if (LMouseKey==true)
-    {
-        if (!Rotating)
-        {
-            RotateStart = MousePos;
-            Rotating = true;
-            nRotY = RotY;
-            nRotZ = RotZ;
-        }
-        else
-        {
-            nRotY += (RotateStart.Y - MousePos.Y) * rotateSpeed;
-            nRotZ += (RotateStart.X - MousePos.X) * rotateSpeed;
-            nRotY=sat(nRotY);
-        }
-    }
-    else if (Rotating)
-    {
-        RotY += (RotateStart.Y - MousePos.Y) * rotateSpeed;
-        RotZ += (RotateStart.X - MousePos.X) * rotateSpeed;
-        RotY=sat(RotY);
-        nRotY = RotY;
-        nRotZ = RotZ;
-        Rotating = false;
-    }
+  case EMIE_MOUSE_WHEEL:
+    currentZoom -= event.MouseInput.Wheel * zoomSpeed;
+    if (currentZoom <= 0)
+      currentZoom = zoomSpeed;
+    break;
+  case EMIE_LMOUSE_PRESSED_DOWN:
+    LMouseKey = true;
+    break;
+  case EMIE_LMOUSE_LEFT_UP:
+    LMouseKey = false;
+    break;
+  case EMIE_MOUSE_MOVED:
+    this->MousePos = MousePos;
+    break;
+  default:
+    return false;
+    break;
+  }
 
-    pos.X = -currentZoom;
-    pos.Y=0;
-    pos.Z=0;
-
-    pos.rotateXZBy(-nRotY);
-    pos.rotateXYBy(getSimulator()->Yaw()+nRotZ+parent->getRotation().Z);
-
-    camera->setPosition(parent->getPosition()+pos+pos_offset);
-    camera->setTarget(parent->getPosition()+target_offset);
-}
-
-ISceneNodeAnimator* AnimPoursuite::createClone(ISceneNode* node,
-            ISceneManager* newManager)
-{
-    return NULL;
-}
-
-bool AnimPoursuite::MouseMoved(const SEvent& event,irr::core::position2df MousePos)
-{
-    if (event.EventType != EET_MOUSE_INPUT_EVENT)
-        return false;
-
-    switch(event.MouseInput.Event)
-    {
-
-    case EMIE_MOUSE_WHEEL:
-        currentZoom -= event.MouseInput.Wheel * zoomSpeed;
-        if(currentZoom<=0) currentZoom=zoomSpeed;
-        break;
-    case EMIE_LMOUSE_PRESSED_DOWN:
-        LMouseKey = true;
-        break;
-    case EMIE_LMOUSE_LEFT_UP:
-        LMouseKey= false;
-        break;
-    case EMIE_MOUSE_MOVED:
-        this->MousePos = MousePos;
-        break;
-    default:
-        return false;
-        break;
-    }
-
-    return true;
+  return true;
 }
 
@@ -150,3 +134,3 @@
 } // end namespace flair
 
-#endif //GL
+#endif // GL
Index: trunk/lib/FlairSimulator/src/Blade.cpp
===================================================================
--- trunk/lib/FlairSimulator/src/Blade.cpp	(revision 14)
+++ trunk/lib/FlairSimulator/src/Blade.cpp	(revision 15)
@@ -33,64 +33,59 @@
 using namespace flair::core;
 
-namespace flair
-{
-namespace simulator
-{
+namespace flair {
+namespace simulator {
 
-Blade::Blade(Model* parent,const vector3df& position,bool inverted,s32 id)
-    : ISceneNode(parent->getSceneNode(), getGui()->getSceneManager(), id,position)
-{
-    ISceneManager* mgr=getGui()->getSceneManager();
+Blade::Blade(Model *parent, const vector3df &position, bool inverted, s32 id)
+    : ISceneNode(parent->getSceneNode(), getGui()->getSceneManager(), id,
+                 position) {
+  ISceneManager *mgr = getGui()->getSceneManager();
 
-    const IGeometryCreator *geo;
-    geo=mgr->getGeometryCreator();
-    pale=geo->createCubeMesh(vector3df(63.5,0.5,5));
+  const IGeometryCreator *geo;
+  geo = mgr->getGeometryCreator();
+  pale = geo->createCubeMesh(vector3df(63.5, 0.5, 5));
 
-    float angle;
-    if(inverted==false)
-    {
-        angle=20;
-    }
-    else
-    {
-        angle=-20;
-    }
+  float angle;
+  if (inverted == false) {
+    angle = 20;
+  } else {
+    angle = -20;
+  }
 
-    ITexture* texture=getGui()->getTexture("carbone.jpg");
-    pale_1=new MeshSceneNode(parent, pale, vector3df(-30,0,0),vector3df(-angle+90,0,0),texture);
-    pale_1->setParent(this);
-    pale_2=new MeshSceneNode(parent, pale, vector3df(30,0,0),vector3df(angle+90,0,0),texture);
-    pale_2->setParent(this);
+  ITexture *texture = getGui()->getTexture("carbone.jpg");
+  pale_1 = new MeshSceneNode(parent, pale, vector3df(-30, 0, 0),
+                             vector3df(-angle + 90, 0, 0), texture);
+  pale_1->setParent(this);
+  pale_2 = new MeshSceneNode(parent, pale, vector3df(30, 0, 0),
+                             vector3df(angle + 90, 0, 0), texture);
+  pale_2->setParent(this);
 
-    anim = mgr->createRotationAnimator(vector3df(0.f, 0.f, 0.f));
-    addAnimator(anim);
+  anim = mgr->createRotationAnimator(vector3df(0.f, 0.f, 0.f));
+  addAnimator(anim);
 }
 
-void Blade::OnRegisterSceneNode()
-{
-    if (IsVisible)
-        SceneManager->registerNodeForRendering(this);
+void Blade::OnRegisterSceneNode() {
+  if (IsVisible)
+    SceneManager->registerNodeForRendering(this);
 
-    ISceneNode::OnRegisterSceneNode();
+  ISceneNode::OnRegisterSceneNode();
 }
 
-void Blade::SetRotationSpeed(float value)
-{
-    IAttributes* attribs =getSceneManager()->getFileSystem()->createEmptyAttributes();
+void Blade::SetRotationSpeed(float value) {
+  IAttributes *attribs =
+      getSceneManager()->getFileSystem()->createEmptyAttributes();
 
-    attribs->setAttribute("Type","rotation");
-    attribs->setAttribute("Rotation",vector3df(0.f, 0.f,value));
-    anim->deserializeAttributes(attribs);
+  attribs->setAttribute("Type", "rotation");
+  attribs->setAttribute("Rotation", vector3df(0.f, 0.f, value));
+  anim->deserializeAttributes(attribs);
 
-    attribs->drop();
+  attribs->drop();
 }
 
-void Blade::render()
-{
-    IVideoDriver* driver = SceneManager->getVideoDriver();
-    driver->setTransform(ETS_WORLD, AbsoluteTransformation);
+void Blade::render() {
+  IVideoDriver *driver = SceneManager->getVideoDriver();
+  driver->setTransform(ETS_WORLD, AbsoluteTransformation);
 }
 
 } // end namespace simulator
 } // end namespace flair
-#endif //GL
+#endif // GL
Index: trunk/lib/FlairSimulator/src/Blade.h
===================================================================
--- trunk/lib/FlairSimulator/src/Blade.h	(revision 14)
+++ trunk/lib/FlairSimulator/src/Blade.h	(revision 15)
@@ -20,39 +20,33 @@
 #include <ISceneNode.h>
 
-namespace irr
-{
-    namespace scene
-    {
-        class IMesh;
-    }
+namespace irr {
+namespace scene {
+class IMesh;
+}
 }
 
-namespace flair
-{
-namespace simulator
-{
-    class MeshSceneNode;
-    class Model;
+namespace flair {
+namespace simulator {
+class MeshSceneNode;
+class Model;
 
-    class Blade : public irr::scene::ISceneNode
-    {
-        public:
+class Blade : public irr::scene::ISceneNode {
+public:
+  Blade(Model *parent,
+        const irr::core::vector3df &position = irr::core::vector3df(0, 0, 0),
+        bool inverted = false, irr::s32 id = -1);
+  virtual void OnRegisterSceneNode(void);
+  virtual void render(void);
+  virtual const irr::core::aabbox3d<irr::f32> &getBoundingBox(void) const {
+    return Box;
+  }
+  void SetRotationSpeed(float value);
 
-            Blade(Model* parent,const irr::core::vector3df& position = irr::core::vector3df(0,0,0),bool inverted=false,irr::s32 id=-1);
-            virtual void OnRegisterSceneNode(void);
-            virtual void render(void);
-            virtual const irr::core::aabbox3d<irr::f32>& getBoundingBox(void) const
-            {
-                return Box;
-            }
-            void SetRotationSpeed(float value);
-
-
-        private:
-            irr::scene::IMesh *pale;
-            irr::core::aabbox3d<irr::f32> Box;
-            MeshSceneNode *pale_1,*pale_2;
-            irr::scene::ISceneNodeAnimator *anim;
-    };
+private:
+  irr::scene::IMesh *pale;
+  irr::core::aabbox3d<irr::f32> Box;
+  MeshSceneNode *pale_1, *pale_2;
+  irr::scene::ISceneNodeAnimator *anim;
+};
 } // end namespace simulator
 } // end namespace flair
Index: trunk/lib/FlairSimulator/src/Castle.cpp
===================================================================
--- trunk/lib/FlairSimulator/src/Castle.cpp	(revision 14)
+++ trunk/lib/FlairSimulator/src/Castle.cpp	(revision 15)
@@ -24,23 +24,20 @@
 using namespace flair::core;
 
-namespace flair
-{
-namespace simulator
-{
+namespace flair {
+namespace simulator {
 
-Castle::Castle(const Simulator* parent,int app_width, int app_height,int scene_width, int scene_height,std::string media_path): Gui(parent,"Castle",app_width,app_height,scene_width,scene_height, media_path)
-{
-    //carte
-    std::string file=media_path +"/map-20kdm2.pk3";
-	getDevice()->getFileSystem()->addFileArchive(file.c_str());
-	setMesh("20kdm2.bsp",vector3df(-1400,-65,-1349));
+Castle::Castle(const Simulator *parent, int app_width, int app_height,
+               int scene_width, int scene_height, std::string media_path)
+    : Gui(parent, "Castle", app_width, app_height, scene_width, scene_height,
+          media_path) {
+  // carte
+  std::string file = media_path + "/map-20kdm2.pk3";
+  getDevice()->getFileSystem()->addFileArchive(file.c_str());
+  setMesh("20kdm2.bsp", vector3df(-1400, -65, -1349));
 }
 
-Castle::~Castle()
-{
-
-}
+Castle::~Castle() {}
 
 } // end namespace simulator
 } // end namespace flair
-#endif //GL
+#endif // GL
Index: trunk/lib/FlairSimulator/src/Castle.h
===================================================================
--- trunk/lib/FlairSimulator/src/Castle.h	(revision 14)
+++ trunk/lib/FlairSimulator/src/Castle.h	(revision 15)
@@ -19,17 +19,15 @@
 
 #include <Gui.h>
-namespace flair
-{
-namespace simulator
-{
-    class Castle:public Gui
-    {
-        public:
-            Castle(const flair::simulator::Simulator* parent,int app_width, int app_height,int scene_width, int scene_height,std::string media_path);
-            ~Castle();
+namespace flair {
+namespace simulator {
+class Castle : public Gui {
+public:
+  Castle(const flair::simulator::Simulator *parent, int app_width,
+         int app_height, int scene_width, int scene_height,
+         std::string media_path);
+  ~Castle();
 
-        private:
-
-    };
+private:
+};
 } // end namespace simulator
 } // end namespace flair
Index: trunk/lib/FlairSimulator/src/DiscreteTimeVariable.h
===================================================================
--- trunk/lib/FlairSimulator/src/DiscreteTimeVariable.h	(revision 14)
+++ trunk/lib/FlairSimulator/src/DiscreteTimeVariable.h	(revision 15)
@@ -20,36 +20,29 @@
 #include <stdlib.h>
 
-namespace flair
-{
-namespace simulator
-{
-    template <typename T,size_t size>
-    class DiscreteTimeVariable
-    {
-        public:
-            DiscreteTimeVariable(){};
-            ~DiscreteTimeVariable(){};
-            T& operator[](ssize_t idx)
-            {
-                if(idx>0) idx=0;
-                if(idx<(ssize_t)(-size+1)) idx=-size+1;
-                return array[-idx];
-            }
-            const T&operator[](ssize_t idx) const
-            {
-                return const_cast<T&>(*this)[idx];
-            };
-            void Update(void)
-            {
-                for(int i=size-1;i>0;i--)
-                {
-                    array[i]=array[i-1];
-                }
-            }
+namespace flair {
+namespace simulator {
+template <typename T, size_t size> class DiscreteTimeVariable {
+public:
+  DiscreteTimeVariable(){};
+  ~DiscreteTimeVariable(){};
+  T &operator[](ssize_t idx) {
+    if (idx > 0)
+      idx = 0;
+    if (idx < (ssize_t)(-size + 1))
+      idx = -size + 1;
+    return array[-idx];
+  }
+  const T &operator[](ssize_t idx) const {
+    return const_cast<T &>(*this)[idx];
+  };
+  void Update(void) {
+    for (int i = size - 1; i > 0; i--) {
+      array[i] = array[i - 1];
+    }
+  }
 
-        private:
-            T array[size];
-
-    };
+private:
+  T array[size];
+};
 } // end namespace simulator
 } // end namespace flair
Index: trunk/lib/FlairSimulator/src/GenericObject.cpp
===================================================================
--- trunk/lib/FlairSimulator/src/GenericObject.cpp	(revision 14)
+++ trunk/lib/FlairSimulator/src/GenericObject.cpp	(revision 15)
@@ -37,88 +37,72 @@
 using namespace flair::simulator;
 
-namespace flair
+namespace flair {
+namespace simulator {
+
+GenericObject::GenericObject(Simulator *parent, std::string name,
+                             ISceneManager *sceneManager)
+    : IMeshSceneNode(sceneManager->getRootSceneNode(), sceneManager,
+                     -1) //, IODevice(parent,name)
 {
-namespace simulator
-{
+  setMaterialFlag(EMF_LIGHTING, false);
+  Material = getMaterial(0);
+  // setMaterialTexture(0,sceneManager->getVideoDriver()->getTexture("/home/cesar/igep/uav_dev_svn/trunk/media/nskinbl.jpg"));
+  Material.NormalizeNormals = true;
+  Material.Wireframe = false;
+  Material.Lighting = false;
 
-GenericObject::GenericObject(Simulator* parent,std::string name, ISceneManager* sceneManager) : IMeshSceneNode(sceneManager->getRootSceneNode(), sceneManager, -1)//, IODevice(parent,name)
-{
-    setMaterialFlag(EMF_LIGHTING,false);
-    Material=getMaterial(0);
-    //setMaterialTexture(0,sceneManager->getVideoDriver()->getTexture("/home/cesar/igep/uav_dev_svn/trunk/media/nskinbl.jpg"));
-    Material.NormalizeNormals = true;
-    Material.Wireframe = false;
-    Material.Lighting = false;
-
-    parent->pimpl_->objects.push_back(this);
+  parent->pimpl_->objects.push_back(this);
 }
 
-GenericObject::~GenericObject()
-{
+GenericObject::~GenericObject() {}
 
+void GenericObject::setScale(float value) {
+  ISceneNode::setScale(vector3df(value, value, value));
 }
 
-void GenericObject::setScale(float value)
-{
-    ISceneNode::setScale(vector3df(value,value,value));
+void GenericObject::setScale(vector3df scale) { ISceneNode::setScale(scale); }
+
+ITriangleSelector *GenericObject::TriangleSelector(void) { return selector; }
+
+void GenericObject::OnRegisterSceneNode(void) {
+  if (IsVisible)
+    SceneManager->registerNodeForRendering(this);
+
+  ISceneNode::OnRegisterSceneNode();
 }
 
-void GenericObject::setScale(vector3df scale)
-{
-    ISceneNode::setScale(scale);
+void GenericObject::render(void) {
+  IVideoDriver *driver = SceneManager->getVideoDriver();
+
+  driver->setMaterial(Material);
+
+  driver->setTransform(ETS_WORLD, AbsoluteTransformation);
+  driver->drawMeshBuffer(mesh->getMeshBuffer(0));
 }
 
-ITriangleSelector* GenericObject::TriangleSelector(void)
-{
-    return selector;
+void GenericObject::setMesh(IMesh *mesh) {
+  this->mesh = mesh;
+  box = mesh->getBoundingBox();
+
+  selector = getSceneManager()->createTriangleSelector(mesh, this);
+  setTriangleSelector(selector);
 }
 
-void GenericObject::OnRegisterSceneNode(void)
-{
-    if (IsVisible)
-        SceneManager->registerNodeForRendering(this);
+IMesh *GenericObject::getMesh(void) { return mesh; }
 
-    ISceneNode::OnRegisterSceneNode();
+void GenericObject::setPosition(irr::core::vector3df pos) {
+  ISceneNode::setPosition(ToIrrlichtCoordinates(pos));
 }
 
-void GenericObject::render(void)
-{
-    IVideoDriver* driver = SceneManager->getVideoDriver();
+void GenericObject::setRotation(irr::core::vector3df rotation) {
+  Euler eulerA(rotation.X, rotation.Y, rotation.Z);
+  Euler eulerB;
+  Quaternion quatA, quatB;
+  eulerA.ToQuaternion(quatA);
+  quatB = ToIrrlichtOrientation(quatA);
+  quatB.ToEuler(eulerB);
 
-    driver->setMaterial(Material);
-
-    driver->setTransform(ETS_WORLD, AbsoluteTransformation);
-    driver->drawMeshBuffer(mesh->getMeshBuffer(0));
-}
-
-void GenericObject::setMesh(IMesh* mesh)
-{
-    this->mesh=mesh;
-    box=mesh->getBoundingBox();
-
-    selector = getSceneManager()->createTriangleSelector(mesh,this);
-    setTriangleSelector(selector);
-}
-
-IMesh* GenericObject::getMesh(void)
-{
-    return mesh;
-}
-
-void GenericObject::setPosition(irr::core::vector3df pos)
-{
-    ISceneNode::setPosition(ToIrrlichtCoordinates(pos));
-}
-
-void GenericObject::setRotation(irr::core::vector3df rotation)
-{
-    Euler eulerA(rotation.X,rotation.Y,rotation.Z);
-    Euler eulerB;
-    Quaternion quatA,quatB;
-    eulerA.ToQuaternion(quatA);
-    quatB=ToIrrlichtOrientation(quatA);
-    quatB.ToEuler(eulerB);
-
-    ISceneNode::setRotation(Euler::ToDegree(1)*vector3df(eulerB.roll,eulerB.pitch,eulerB.yaw));
+  ISceneNode::setRotation(Euler::ToDegree(1) *
+                          vector3df(eulerB.roll, eulerB.pitch, eulerB.yaw));
 }
 
Index: trunk/lib/FlairSimulator/src/Gui.cpp
===================================================================
--- trunk/lib/FlairSimulator/src/Gui.cpp	(revision 14)
+++ trunk/lib/FlairSimulator/src/Gui.cpp	(revision 15)
@@ -40,140 +40,134 @@
 
 namespace {
-    flair::simulator::Gui* gui_=NULL;
-    std::vector <std::string> extensions;
-    bool getGlInfo();
+flair::simulator::Gui *gui_ = NULL;
+std::vector<std::string> extensions;
+bool getGlInfo();
 }
 
-namespace flair { namespace simulator {
+namespace flair {
+namespace simulator {
 
-Gui* getGui(void) {
-    return gui_;
+Gui *getGui(void) { return gui_; }
+
+bool noGui(void) {
+  if (gui_ == NULL) {
+    return true;
+  } else {
+    return false;
+  }
 }
 
-bool noGui(void) {
-    if(gui_==NULL) {
-        return true;
-    } else {
-        return false;
+// getGlinfo, code from Song Ho Ahn (song.ahn@gmail.com)
+bool getGlInfo() {
+  char *str = 0;
+  char *tok = 0;
+
+  // get all extensions as a string
+  str = (char *)glGetString(GL_EXTENSIONS);
+
+  // split extensions
+  if (str) {
+    tok = strtok((char *)str, " ");
+    while (tok) {
+      extensions.push_back(tok); // put a extension into struct
+      tok = strtok(0, " ");      // next token
     }
+  } else {
+    printf("cannot get gl extensions\n");
+  }
+
+  // sort extension by alphabetical order
+  std::sort(extensions.begin(), extensions.end());
 }
 
-//getGlinfo, code from Song Ho Ahn (song.ahn@gmail.com)
-bool getGlInfo() {
-    char* str = 0;
-    char* tok = 0;
+// isGlExtensionSupported, code from Song Ho Ahn (song.ahn@gmail.com)
+bool isGlExtensionSupported(const std::string &ext) {
+  if (extensions.size() == 0)
+    getGlInfo();
 
-    // get all extensions as a string
-    str = (char*)glGetString(GL_EXTENSIONS);
+  // search corresponding extension
+  std::vector<std::string>::const_iterator iter = extensions.begin();
+  std::vector<std::string>::const_iterator endIter = extensions.end();
 
-    // split extensions
-    if(str) {
-        tok = strtok((char*)str, " ");
-        while(tok) {
-            extensions.push_back(tok);    // put a extension into struct
-            tok = strtok(0, " ");               // next token
-        }
-    } else {
-        printf("cannot get gl extensions\n");
-    }
-
-    // sort extension by alphabetical order
-    std::sort(extensions.begin(), extensions.end());
+  while (iter != endIter) {
+    if (ext == *iter)
+      return true;
+    else
+      ++iter;
+  }
+  return false;
 }
 
-//isGlExtensionSupported, code from Song Ho Ahn (song.ahn@gmail.com)
-bool isGlExtensionSupported(const std::string& ext) {
-    if(extensions.size()==0) getGlInfo();
+float ToIrrlichtScale(float value) { return value * 100.; }
 
-    // search corresponding extension
-    std::vector<std::string>::const_iterator iter = extensions.begin();
-    std::vector<std::string>::const_iterator endIter = extensions.end();
-
-    while(iter != endIter) {
-        if(ext == *iter)
-            return true;
-        else
-            ++iter;
-    }
-    return false;
-}
-
-float ToIrrlichtScale(float value) {
-    return value*100.;
-}
-
-float ToSimulatorScale(float value) {
-    return value/100.;
-}
+float ToSimulatorScale(float value) { return value / 100.; }
 
 vector3df ToIrrlichtCoordinates(vector3df vect) {
-    return ToIrrlichtScale(1)*vector3df(vect.X,vect.Y,-vect.Z);
+  return ToIrrlichtScale(1) * vector3df(vect.X, vect.Y, -vect.Z);
 }
 
 vector3df ToIrrlichtCoordinates(Vector3D vect) {
-    return ToIrrlichtScale(1)*vector3df(vect.x,vect.y,-vect.z);
+  return ToIrrlichtScale(1) * vector3df(vect.x, vect.y, -vect.z);
 }
 
 Vector3D ToSimulatorCoordinates(vector3df vect) {
-    return ToSimulatorScale(1)*Vector3D(vect.X,vect.Y,-vect.Z);
+  return ToSimulatorScale(1) * Vector3D(vect.X, vect.Y, -vect.Z);
 }
 
 Quaternion ToIrrlichtOrientation(Quaternion quat) {
-    /* original code
-    Euler euler;
-    quat.ToEuler(euler);
-    matrix4 m;
-    m.setRotationRadians(vector3df(0, 0, euler.yaw));
-    matrix4 n;
-    n.setRotationRadians(vector3df(0, -euler.pitch,0));
-    m *= n;
-    n.setRotationRadians(vector3df(-euler.roll, 0, 0));
-    m *= n;
-    */
-    //seems to be equivalent to:
-    return Quaternion(quat.q0,-quat.q1,-quat.q2,quat.q3);
+  /* original code
+  Euler euler;
+  quat.ToEuler(euler);
+  matrix4 m;
+  m.setRotationRadians(vector3df(0, 0, euler.yaw));
+  matrix4 n;
+  n.setRotationRadians(vector3df(0, -euler.pitch,0));
+  m *= n;
+  n.setRotationRadians(vector3df(-euler.roll, 0, 0));
+  m *= n;
+  */
+  // seems to be equivalent to:
+  return Quaternion(quat.q0, -quat.q1, -quat.q2, quat.q3);
 }
 
-Gui::Gui(const Simulator* parent,std::string name,int app_width, int app_height,int scene_width, int scene_height,std::string media_path,E_DRIVER_TYPE driver_type): Object(parent,name,"Gui") {
-    if(gui_!=NULL) Err("Gui should be instanced only one time\n");
-    pimpl_=new Gui_impl(this,app_width,app_height,scene_width,scene_height,media_path,driver_type);
-    gui_=this;
+Gui::Gui(const Simulator *parent, std::string name, int app_width,
+         int app_height, int scene_width, int scene_height,
+         std::string media_path, E_DRIVER_TYPE driver_type)
+    : Object(parent, name, "Gui") {
+  if (gui_ != NULL)
+    Err("Gui should be instanced only one time\n");
+  pimpl_ = new Gui_impl(this, app_width, app_height, scene_width, scene_height,
+                        media_path, driver_type);
+  gui_ = this;
 }
 
-Gui::~Gui() {
-    delete pimpl_;
+Gui::~Gui() { delete pimpl_; }
+
+float Gui::getAspectRatio(void) const {
+  return (float)pimpl_->scene_width / (float)pimpl_->scene_height;
 }
 
-float Gui::getAspectRatio(void) const {
-    return (float)pimpl_->scene_width/(float)pimpl_->scene_height;
+ISceneManager *Gui::getSceneManager(void) const { return pimpl_->smgr; }
+
+void Gui::setMesh(std::string file, vector3df position, vector3df rotation,
+                  vector3df scale) {
+  pimpl_->setMesh(file, position, rotation, scale);
 }
 
-ISceneManager* Gui::getSceneManager(void) const {
-    return pimpl_->smgr;
+vector3df Gui::getRotation(void) const { return pimpl_->node->getRotation(); }
+
+IrrlichtDevice *Gui::getDevice(void) const { return pimpl_->device; }
+
+ITexture *Gui::getTexture(std::string filename) const {
+  filename = pimpl_->media_path + "/" + filename;
+  return pimpl_->driver->getTexture(filename.c_str());
 }
 
-void Gui::setMesh(std::string file,vector3df position,vector3df rotation,vector3df scale) {
-    pimpl_->setMesh(file,position,rotation,scale);
-}
-
-vector3df Gui::getRotation(void) const {
-    return pimpl_->node->getRotation();
-}
-
-IrrlichtDevice *Gui::getDevice(void) const {
-    return pimpl_->device;
-}
-
-ITexture* Gui::getTexture(std::string filename) const {
-    filename=pimpl_->media_path+ "/" +filename;
-    return pimpl_->driver->getTexture(filename.c_str());
-}
-
-IAnimatedMesh* Gui::getMesh(std::string filename) const {
-    filename=pimpl_->media_path+ "/" +filename;
-    return pimpl_->smgr->getMesh(filename.c_str());
+IAnimatedMesh *Gui::getMesh(std::string filename) const {
+  filename = pimpl_->media_path + "/" + filename;
+  return pimpl_->smgr->getMesh(filename.c_str());
 }
 
 } // end namespace simulator
 } // end namespace flair
-#endif //GL
+#endif // GL
Index: trunk/lib/FlairSimulator/src/Gui.h
===================================================================
--- trunk/lib/FlairSimulator/src/Gui.h	(revision 14)
+++ trunk/lib/FlairSimulator/src/Gui.h	(revision 15)
@@ -22,27 +22,22 @@
 #include <vector3d.h>
 
-namespace irr
-{
-    class IrrlichtDevice;
-    namespace video
-    {
-        class ITexture;
-    }
-    namespace scene
-    {
-        class IAnimatedMesh;
-        class ISceneManager;
-    }
+namespace irr {
+class IrrlichtDevice;
+namespace video {
+class ITexture;
+}
+namespace scene {
+class IAnimatedMesh;
+class ISceneManager;
+}
 }
 
-namespace flair
-{
-    namespace core
-    {
-       class Object;
-       class Vector3D;
-       class Euler;
-       class Quaternion;
-    }
+namespace flair {
+namespace core {
+class Object;
+class Vector3D;
+class Euler;
+class Quaternion;
+}
 }
 
@@ -51,103 +46,106 @@
 class Model_impl;
 
-namespace flair
-{
-namespace simulator
-{
-    class Simulator;
+namespace flair {
+namespace simulator {
+class Simulator;
 
-    class Gui: public core::Object
-    {
-        friend class ::Simulator_impl;
+class Gui : public core::Object {
+  friend class ::Simulator_impl;
 
-        public:
-            Gui(const Simulator* parent,std::string name,int app_width, int app_height,int scene_width, int scene_height,std::string media_path,irr::video::E_DRIVER_TYPE driver_type=irr::video::EDT_OPENGL);
-            ~Gui();
-            irr::core::vector3df getRotation(void) const;
-            irr::video::ITexture* getTexture(std::string filename) const;
-            irr::scene::IAnimatedMesh* getMesh(std::string filename) const;
-            irr::scene::ISceneManager* getSceneManager(void) const;
-            float getAspectRatio(void) const;
+public:
+  Gui(const Simulator *parent, std::string name, int app_width, int app_height,
+      int scene_width, int scene_height, std::string media_path,
+      irr::video::E_DRIVER_TYPE driver_type = irr::video::EDT_OPENGL);
+  ~Gui();
+  irr::core::vector3df getRotation(void) const;
+  irr::video::ITexture *getTexture(std::string filename) const;
+  irr::scene::IAnimatedMesh *getMesh(std::string filename) const;
+  irr::scene::ISceneManager *getSceneManager(void) const;
+  float getAspectRatio(void) const;
 
-        protected:
-            irr::IrrlichtDevice *getDevice(void) const;
-            void setMesh(std::string file,irr::core::vector3df position = irr::core::vector3df(0,0,0),irr::core::vector3df rotation= irr::core::vector3df(0,0,0),irr::core::vector3df scale= irr::core::vector3df(1,1,1));
+protected:
+  irr::IrrlichtDevice *getDevice(void) const;
+  void setMesh(std::string file,
+               irr::core::vector3df position = irr::core::vector3df(0, 0, 0),
+               irr::core::vector3df rotation = irr::core::vector3df(0, 0, 0),
+               irr::core::vector3df scale = irr::core::vector3df(1, 1, 1));
 
-        private:
-            Gui_impl *pimpl_;
-    };
+private:
+  Gui_impl *pimpl_;
+};
 
-    /*!
-    * \brief get Gui
-    *
-    * \return the Gui
-    */
-    Gui* getGui(void);
+/*!
+* \brief get Gui
+*
+* \return the Gui
+*/
+Gui *getGui(void);
 
-    bool noGui(void);
+bool noGui(void);
 
-    bool isGlExtensionSupported(const std::string& ext); // check if a extension is supported
+bool isGlExtensionSupported(
+    const std::string &ext); // check if a extension is supported
 
-    /*!
-    * \brief Convert to irrlicht scale
-    *
-    * \param value value in simulator scale
-    *
-    * \return value in irrlicht scale
-    */
-    float ToIrrlichtScale(float value);
+/*!
+* \brief Convert to irrlicht scale
+*
+* \param value value in simulator scale
+*
+* \return value in irrlicht scale
+*/
+float ToIrrlichtScale(float value);
 
-    /*!
-    * \brief Convert to simulator scale
-    *
-    * \param value value in irrlicht scale
-    *
-    * \return value in simulator scale
-    */
-    float ToSimulatorScale(float value);
+/*!
+* \brief Convert to simulator scale
+*
+* \param value value in irrlicht scale
+*
+* \return value in simulator scale
+*/
+float ToSimulatorScale(float value);
 
-    /*!
-    * \brief Convert to irrlicht coordinates
-    *
-    * irrlicht is left handed and as a different scale
-    *
-    * \param vect vector in simulator coordinates
-    *
-    * \return vector in irrlicht coordinates
-    */
-    irr::core::vector3df ToIrrlichtCoordinates(irr::core::vector3df vect);
+/*!
+* \brief Convert to irrlicht coordinates
+*
+* irrlicht is left handed and as a different scale
+*
+* \param vect vector in simulator coordinates
+*
+* \return vector in irrlicht coordinates
+*/
+irr::core::vector3df ToIrrlichtCoordinates(irr::core::vector3df vect);
 
-    /*!
-    * \brief Convert to irrlicht coordinates
-    *
-    * irrlicht is left handed and as a different scale
-    *
-    * \param vect vector in simulator coordinates
-    *
-    * \return vector in irrlicht coordinates
-    */
-    irr::core::vector3df ToIrrlichtCoordinates(core::Vector3D vect);
+/*!
+* \brief Convert to irrlicht coordinates
+*
+* irrlicht is left handed and as a different scale
+*
+* \param vect vector in simulator coordinates
+*
+* \return vector in irrlicht coordinates
+*/
+irr::core::vector3df ToIrrlichtCoordinates(core::Vector3D vect);
 
-    /*!
-    * \brief Convert to simulator coordinates
-    *
-    * irrlicht is left handed and as a different scale
-    *
-    * \param vect vector in irrlicht coordinates
-    *
-    * \return vector in simulator coordinates
-    */
-    core::Vector3D ToSimulatorCoordinates(irr::core::vector3df vect);
+/*!
+* \brief Convert to simulator coordinates
+*
+* irrlicht is left handed and as a different scale
+*
+* \param vect vector in irrlicht coordinates
+*
+* \return vector in simulator coordinates
+*/
+core::Vector3D ToSimulatorCoordinates(irr::core::vector3df vect);
 
-    /*!
-    * \brief Convert to irrlicht orientation
-    *
-    * irrlicht is left handed
-    *
-    * \param quat quaternion in simulator frame
-    *
-    * \return quaternion in irrlicht frame
-    */
-    core::Quaternion ToIrrlichtOrientation(core::Quaternion quat);
+/*!
+* \brief Convert to irrlicht orientation
+*
+* irrlicht is left handed
+*
+* \param quat quaternion in simulator frame
+*
+* \return quaternion in irrlicht frame
+*/
+core::Quaternion ToIrrlichtOrientation(core::Quaternion quat);
 
 } // end namespace simulator
Index: trunk/lib/FlairSimulator/src/Gui_impl.cpp
===================================================================
--- trunk/lib/FlairSimulator/src/Gui_impl.cpp	(revision 14)
+++ trunk/lib/FlairSimulator/src/Gui_impl.cpp	(revision 15)
@@ -37,394 +37,362 @@
 using namespace flair::simulator;
 
-class MyEventReceiver : public IEventReceiver
-{
+class MyEventReceiver : public IEventReceiver {
 public:
-	// This is the one method that we have to implement
-	virtual bool OnEvent(const SEvent& event)
-	{
-		// Remember whether each key is down or up
-		if (event.EventType == EET_KEY_INPUT_EVENT )
-			KeyIsDown[event.KeyInput.Key] = event.KeyInput.PressedDown;
-
-		//Send all other events to camera
-		if (event.EventType == EET_MOUSE_INPUT_EVENT && camera)
-			//return camera->OnEvent(event);
-			return camera->MouseMoved(event,cursorControl->getRelativePosition());
-
-		if(model)
-			return model->OnEvent(event);
-
-		return false;
-	}
-
-	// This is used to check whether a key is being held down
-	virtual bool IsKeyDown(EKEY_CODE keyCode)
-	{
-		if(KeyIsDown[keyCode]==true)
-		{
-			KeyIsDown[keyCode]=false;
-			return true;
-		}
-		else
-		{
-			return false;
-		}
-	}
-
-	MyEventReceiver(ICursorControl* cursorControl)
-	{
-		this->cursorControl=cursorControl;
-		camera=NULL;
-		model=NULL;
-		for (u32 i=0; i<KEY_KEY_CODES_COUNT; ++i)
-			KeyIsDown[i] = false;
-	}
-	void SetCamera(AnimPoursuite* camera)
-	{
-		this->camera=camera;
-	}
-	void SetModel(Model* model)
-	{
-		this->model=model;
-	}
+  // This is the one method that we have to implement
+  virtual bool OnEvent(const SEvent &event) {
+    // Remember whether each key is down or up
+    if (event.EventType == EET_KEY_INPUT_EVENT)
+      KeyIsDown[event.KeyInput.Key] = event.KeyInput.PressedDown;
+
+    // Send all other events to camera
+    if (event.EventType == EET_MOUSE_INPUT_EVENT && camera)
+      // return camera->OnEvent(event);
+      return camera->MouseMoved(event, cursorControl->getRelativePosition());
+
+    if (model)
+      return model->OnEvent(event);
+
+    return false;
+  }
+
+  // This is used to check whether a key is being held down
+  virtual bool IsKeyDown(EKEY_CODE keyCode) {
+    if (KeyIsDown[keyCode] == true) {
+      KeyIsDown[keyCode] = false;
+      return true;
+    } else {
+      return false;
+    }
+  }
+
+  MyEventReceiver(ICursorControl *cursorControl) {
+    this->cursorControl = cursorControl;
+    camera = NULL;
+    model = NULL;
+    for (u32 i = 0; i < KEY_KEY_CODES_COUNT; ++i)
+      KeyIsDown[i] = false;
+  }
+  void SetCamera(AnimPoursuite *camera) { this->camera = camera; }
+  void SetModel(Model *model) { this->model = model; }
 
 private:
-	// We use this array to store the current state of each key
-	bool KeyIsDown[KEY_KEY_CODES_COUNT];
-	AnimPoursuite* camera;
-	Model* model;
-	ICursorControl* cursorControl;
+  // We use this array to store the current state of each key
+  bool KeyIsDown[KEY_KEY_CODES_COUNT];
+  AnimPoursuite *camera;
+  Model *model;
+  ICursorControl *cursorControl;
 };
 
-Gui_impl::Gui_impl(Gui* self,int app_width, int app_height,int scene_width, int scene_height,std::string media_path,E_DRIVER_TYPE driver_type)
-{
-	this->self=self;
-	dbtFile_w=NULL;
-	dbtFile_r=NULL;
-	this->media_path=media_path;
-	this->scene_width=scene_width;
-	this->scene_height=scene_height;
-
-	device =createDevice(driver_type, dimension2d<u32>(app_width, app_height),16, false, false, false);
-	receiver=new MyEventReceiver(device->getCursorControl());
-	device->setEventReceiver(receiver);
-	device->getLogger()->setLogLevel(ELL_NONE);
-
-	device->getCursorControl()->setVisible(false);
-	device->setResizable(false);
-
-	//font = device->getGUIEnvironment()->getBuiltInFont();
-	driver = device->getVideoDriver();
-	smgr = device->getSceneManager();
-
-	smgr->setAmbientLight(video::SColorf(1,1,1));
-
-
-	/*
-    env = device->getGUIEnvironment();
+Gui_impl::Gui_impl(Gui *self, int app_width, int app_height, int scene_width,
+                   int scene_height, std::string media_path,
+                   E_DRIVER_TYPE driver_type) {
+  this->self = self;
+  dbtFile_w = NULL;
+  dbtFile_r = NULL;
+  this->media_path = media_path;
+  this->scene_width = scene_width;
+  this->scene_height = scene_height;
+
+  device = createDevice(driver_type, dimension2d<u32>(app_width, app_height),
+                        16, false, false, false);
+  receiver = new MyEventReceiver(device->getCursorControl());
+  device->setEventReceiver(receiver);
+  device->getLogger()->setLogLevel(ELL_NONE);
+
+  device->getCursorControl()->setVisible(false);
+  device->setResizable(false);
+
+  // font = device->getGUIEnvironment()->getBuiltInFont();
+  driver = device->getVideoDriver();
+  smgr = device->getSceneManager();
+
+  smgr->setAmbientLight(video::SColorf(1, 1, 1));
+
+  /*
+env = device->getGUIEnvironment();
 IGUISkin* skin = env->getSkin();
-	font = env->getFont("./fonthaettenschweiler.bmp");
-
-	if (font)
-		skin->setFont(font);
-
-	// create menu
-
-	IGUIContextMenu* menu = env->addMenu();
-	menu->setMinSize(core::dimension2du(640,20));
-	menu->addItem(L"File", -1, true, true);
-	menu->addItem(L"View", -1, true, true);
-	menu->addItem(L"Camera", -1, true, true);
-	menu->addItem(L"Help", -1, true, true);
-
-	// disable alpha
-
-	for (s32 i=0; i<gui::EGDC_COUNT ; ++i)
-	{
-		video::SColor col = env->getSkin()->getColor((gui::EGUI_DEFAULT_COLOR)i);
-		col.setAlpha(255);
-		env->getSkin()->setColor((gui::EGUI_DEFAULT_COLOR)i, col);
-	}
-	 */
-}
-
-Gui_impl::~Gui_impl()
-{
-	//printf("del Gui_impl\n");
-	device->drop();
-
-	delete receiver;
-	// printf("del Gui_impl ok\n");
-}
-
-void Gui_impl::setMesh(std::string file,vector3df position,vector3df rotation,vector3df scale)
-{
-	IAnimatedMesh* mesh = smgr->getMesh(file.c_str());
-
-	if (!mesh) 	{
-		// model could not be loaded
-        self->Err("Model %s could not be loaded\n",file.c_str());
-        return;
-	}
-
-
-	node = smgr->addOctreeSceneNode(mesh->getMesh(0), 0, -1, 1024);
-	node->setPosition(position);
-	rotation+=irr::core::vector3df(90,0,Euler::ToDegree(getSimulator()->Yaw()));
-	node->setRotation(rotation);
-	for(int i=0; i<node->getMaterialCount();i++){
-		node->getMaterial(i).TextureLayer->TextureWrapU = video::ETC_REPEAT;
-		node->getMaterial(i).TextureLayer->TextureWrapV = video::ETC_REPEAT;
-	}
-	//Ceillig
-	//node->getMaterial(0).getTextureMatrix(0).setTextureScale(scale.X/2.0,scale.Z/2.0);
-	//Walls
-	node->getMaterial(1).getTextureMatrix(0).setTextureScale(1/(scale.Y/2.5),1/(scale.Z/2.5));
-	//Floor
-	node->getMaterial(2).getTextureMatrix(0).setTextureScale(1/(scale.X/20.0),1/(scale.Z/20.0));
-
-	node->setScale(scale);
-	//selector
-	selector = smgr->createOctreeTriangleSelector(node->getMesh(), node, 128);
-	node->setTriangleSelector(selector);
-}
-
-void Gui_impl::RunGui(std::vector<Model*> models,std::vector<GenericObject*> objects)
-{
-	int lastFPS = -1;
-	int cam_id=0;
-
-	receiver->SetCamera(models.at(cam_id)->pimpl_->animator);
-	receiver->SetModel(models.at(cam_id));
-
-	for(size_t i=0;i<models.size();i++)
-	{
-		models.at(i)->Draw();
-	}
-
-	for(size_t i=0;i<models.size();i++)
-	{
-		models.at(i)->pimpl_->MetaTriangleSelector()->addTriangleSelector(selector);
-		for(size_t j=0;j<objects.size();j++)
-		{
-			models.at(i)->pimpl_->MetaTriangleSelector()->addTriangleSelector(objects.at(j)->TriangleSelector());
-		}
-		for(size_t j=0;j<models.size();j++)
-		{
-			if(i==j) continue;
-			models.at(i)->pimpl_->MetaTriangleSelector()->addTriangleSelector(models.at(j)->pimpl_->TriangleSelector());
-		}
-	}
-
-	selector->drop(); // As soon as we're done with the selector, drop it.*/
-
-	//wait all models to be started
-	for(size_t i=0;i<models.size();i++)
-	{
-		models.at(i)->pimpl_->SynchronizationPoint();
-	}
-
-	setWindowCaption(models.at(0),0);
-
-	while(device->run())
-	{
-		if(dbtFile_r!=NULL)//rejeu
-		{
-			takeScreenshot();//on enregistre l'image precedente
-			road_time_t time;
-			road_timerange_t tr = 0;
-			if(read_hdfile(dbtFile_r,(void*)dbtbuf,&time,&tr)!=0)
-			{
-				vector3df vect;
-				char *buf=dbtbuf;
-				for(size_t i=0;i<models.size();i++)
-				{
-					models.at(i)->ReaddbtBuf(buf);
-					buf+=models.at(i)->dbtSize();
-				}
-			}
-			else
-			{
-				//Printf("fin play\n");
-				close_hdfile(dbtFile_r);
-				dbtFile_r=NULL;
-				free(dbtbuf);
-				for(size_t i=0;i<models.size();i++)
-				{
-					models.at(i)->pimpl_->Resume();
-				}
-			}
-		}
-		else//mode normal
-		{
-			for(size_t i=0;i<models.size();i++)
-			{
-				models.at(i)->pimpl_->UpdatePos();
-			}
-		}
-
-		driver->beginScene(true, true, video::SColor(255,200,200,200));
-
-		//vue poursuite
-		smgr->setActiveCamera(models.at(cam_id)->pimpl_->camera);
-		driver->setViewPort(core::rect<s32>(0,0,scene_width,scene_height));
-		smgr->drawAll();//commente voir plus bas
-		/*
-        env->drawAll();
-if (font)
-{
-				font->draw(L"This demo shows that Irrlicht is also capable of drawing 2D graphics.",
-					core::rect<s32>(130,10,300,50),
-					video::SColor(255,255,255,255));
-}
-else
-{
-    printf("err\n");
-}
-device->setWindowCaption(L"toto");*/
-
-		if(dbtFile_r==NULL)//mode normal
-		{
-			for(size_t i=0;i<models.size();i++)
-			{
-				models.at(i)->pimpl_->CheckCollision();
-			}
-		}
-
-		for(size_t i=0;i<models.size();i++)
-		{
-			models.at(i)->ProcessUpdate(NULL);
-		}
-
-		//on fait ca ici, devrait etre un peu plus haut
-		//mais a priori souci avec models.at(i)->pimpl_->CheckCollision(); (setelipsoid?)
-		smgr->setActiveCamera(models.at(cam_id)->pimpl_->camera);
-		driver->setViewPort(core::rect<s32>(0,0,scene_width,scene_height));
-		smgr->drawAll();
-
-		driver->endScene();
-
-		int fps =driver->getFPS();
-		//printf("fps %i\n",fps);
-		if (lastFPS != fps)
-		{
-			setWindowCaption(models.at(cam_id),fps);
-			lastFPS = fps;
-		}
-
-		if(receiver->IsKeyDown(KEY_PRIOR))
-		{
-			cam_id++;
-			if(cam_id>=(int)models.size()) cam_id=0;
-			receiver->SetCamera(models.at(cam_id)->pimpl_->animator);
-			receiver->SetModel(models.at(cam_id));
-			setWindowCaption(models.at(cam_id),fps);
-		}
-		if(receiver->IsKeyDown(KEY_NEXT))
-		{
-			cam_id--;
-			if(cam_id<0) cam_id=models.size()-1;
-			receiver->SetCamera(models.at(cam_id)->pimpl_->animator);
-			receiver->SetModel(models.at(cam_id));
-			setWindowCaption(models.at(cam_id),fps);
-		}
-
-		//enregistrement DBT
-		if(receiver->IsKeyDown(KEY_KEY_R) && dbtFile_w==NULL)
-		{
-			dbtFile_w = inithdFile((char*)"./record.dbt",UAV,dbtSize(models));
-			dbtbuf=(char*)malloc(dbtSize(models));
-		}
-		if(receiver->IsKeyDown(KEY_KEY_S) && dbtFile_w!=NULL)
-		{
-			close_hdfile(dbtFile_w);
-			dbtFile_w=NULL;
-			free(dbtbuf);
-			//rt_printf("stop rec\n");
-		}
-		if(dbtFile_w!=NULL)
-		{
-			Time time=GetTime();
-			vector3df vect;
-			char *buf=dbtbuf;
-
-			for(size_t i=0;i<models.size();i++)
-			{
-				models.at(i)->WritedbtBuf(buf);
-				buf+=models.at(i)->dbtSize();
-			}
-
-			write_hdfile(dbtFile_w,dbtbuf,(road_time_t)(time/1000),(road_timerange_t)(time%1000),dbtSize(models));
-		}
-
-		//lecture dbt
-		if(receiver->IsKeyDown(KEY_KEY_P) && dbtFile_r==NULL)
-		{
-			dbtFile_r = open_hdfile((char*)"./record.dbt",READ_MODE);
-			dbtbuf=(char*)malloc(dbtSize(models));
-			//on suspend les models pour ne pas interferer
-			for(size_t i=0;i<models.size();i++)
-			{
-				models.at(i)->pimpl_->Suspend();
-			}
-		}
-		if(receiver->IsKeyDown(KEY_KEY_S) && dbtFile_r!=NULL)
-		{
-			//rt_printf("stop play\n");
-			close_hdfile(dbtFile_r);
-			dbtFile_r=NULL;
-			free(dbtbuf);
-			//on resume les models
-			for(size_t i=0;i<models.size();i++)
-			{
-				models.at(i)->pimpl_->Resume();
-			}
-		}
-
-	}
-
-	receiver->SetCamera(NULL);
-	receiver->SetModel(NULL);
-
-}
-
-void Gui_impl::setWindowCaption(Object* object, int fps)
-{
-	std::ostringstream text;
-	text << "Cam: " << object->ObjectName().c_str() << ", Kbd: " << object->ObjectName().c_str() << ", FPS: " << fps;
-
-	device->setWindowCaption(stringw(text.str().c_str()).c_str());
-}
-
-void Gui_impl::takeScreenshot(void)
-{
-	static int cpt=0;
-	//get image from the last rendered frame
-	IImage* const image = driver->createScreenShot();
-	if (image) //should always be true, but you never know. ;)
-	{
-		//construct a filename, consisting of local time and file extension
-		c8 filename[64];
-		//snprintf(filename, 64, "screenshot_%u.png", device->getTimer()->getRealTime());
-		snprintf(filename, 64, "screenshot_%u.png", cpt);
-		cpt++;
-		//write screenshot to file
-		if (!driver->writeImageToFile(image, filename))
-			device->getLogger()->log(L"Failed to take screenshot.", ELL_WARNING);
-
-		//Don't forget to drop image since we don't need it anymore.
-		image->drop();
-	}
-}
-
-size_t Gui_impl::dbtSize(std::vector<Model*> models)
-{
-	size_t size=0;
-	for(size_t i=0;i<models.size();i++)
-	{
-		size+=models.at(i)->dbtSize();
-	}
-
-	return size;
-}
-#endif //GL
+  font = env->getFont("./fonthaettenschweiler.bmp");
+
+  if (font)
+          skin->setFont(font);
+
+  // create menu
+
+  IGUIContextMenu* menu = env->addMenu();
+  menu->setMinSize(core::dimension2du(640,20));
+  menu->addItem(L"File", -1, true, true);
+  menu->addItem(L"View", -1, true, true);
+  menu->addItem(L"Camera", -1, true, true);
+  menu->addItem(L"Help", -1, true, true);
+
+  // disable alpha
+
+  for (s32 i=0; i<gui::EGDC_COUNT ; ++i)
+  {
+          video::SColor col =
+env->getSkin()->getColor((gui::EGUI_DEFAULT_COLOR)i);
+          col.setAlpha(255);
+          env->getSkin()->setColor((gui::EGUI_DEFAULT_COLOR)i, col);
+  }
+   */
+}
+
+Gui_impl::~Gui_impl() {
+  // printf("del Gui_impl\n");
+  device->drop();
+
+  delete receiver;
+  // printf("del Gui_impl ok\n");
+}
+
+void Gui_impl::setMesh(std::string file, vector3df position, vector3df rotation,
+                       vector3df scale) {
+  IAnimatedMesh *mesh = smgr->getMesh(file.c_str());
+
+  if (!mesh) {
+    // model could not be loaded
+    self->Err("Model %s could not be loaded\n", file.c_str());
+    return;
+  }
+
+  node = smgr->addOctreeSceneNode(mesh->getMesh(0), 0, -1, 1024);
+  node->setPosition(position);
+  rotation +=
+      irr::core::vector3df(90, 0, Euler::ToDegree(getSimulator()->Yaw()));
+  node->setRotation(rotation);
+  for (int i = 0; i < node->getMaterialCount(); i++) {
+    node->getMaterial(i).TextureLayer->TextureWrapU = video::ETC_REPEAT;
+    node->getMaterial(i).TextureLayer->TextureWrapV = video::ETC_REPEAT;
+  }
+  // Ceillig
+  // node->getMaterial(0).getTextureMatrix(0).setTextureScale(scale.X/2.0,scale.Z/2.0);
+  // Walls
+  node->getMaterial(1).getTextureMatrix(0).setTextureScale(1 / (scale.Y / 2.5),
+                                                           1 / (scale.Z / 2.5));
+  // Floor
+  node->getMaterial(2).getTextureMatrix(0).setTextureScale(
+      1 / (scale.X / 20.0), 1 / (scale.Z / 20.0));
+
+  node->setScale(scale);
+  // selector
+  selector = smgr->createOctreeTriangleSelector(node->getMesh(), node, 128);
+  node->setTriangleSelector(selector);
+}
+
+void Gui_impl::RunGui(std::vector<Model *> models,
+                      std::vector<GenericObject *> objects) {
+  int lastFPS = -1;
+  int cam_id = 0;
+
+  receiver->SetCamera(models.at(cam_id)->pimpl_->animator);
+  receiver->SetModel(models.at(cam_id));
+
+  for (size_t i = 0; i < models.size(); i++) {
+    models.at(i)->Draw();
+  }
+
+  for (size_t i = 0; i < models.size(); i++) {
+    models.at(i)->pimpl_->MetaTriangleSelector()->addTriangleSelector(selector);
+    for (size_t j = 0; j < objects.size(); j++) {
+      models.at(i)->pimpl_->MetaTriangleSelector()->addTriangleSelector(
+          objects.at(j)->TriangleSelector());
+    }
+    for (size_t j = 0; j < models.size(); j++) {
+      if (i == j)
+        continue;
+      models.at(i)->pimpl_->MetaTriangleSelector()->addTriangleSelector(
+          models.at(j)->pimpl_->TriangleSelector());
+    }
+  }
+
+  selector->drop(); // As soon as we're done with the selector, drop it.*/
+
+  // wait all models to be started
+  for (size_t i = 0; i < models.size(); i++) {
+    models.at(i)->pimpl_->SynchronizationPoint();
+  }
+
+  setWindowCaption(models.at(0), 0);
+
+  while (device->run()) {
+    if (dbtFile_r != NULL) // rejeu
+    {
+      takeScreenshot(); // on enregistre l'image precedente
+      road_time_t time;
+      road_timerange_t tr = 0;
+      if (read_hdfile(dbtFile_r, (void *)dbtbuf, &time, &tr) != 0) {
+        vector3df vect;
+        char *buf = dbtbuf;
+        for (size_t i = 0; i < models.size(); i++) {
+          models.at(i)->ReaddbtBuf(buf);
+          buf += models.at(i)->dbtSize();
+        }
+      } else {
+        // Printf("fin play\n");
+        close_hdfile(dbtFile_r);
+        dbtFile_r = NULL;
+        free(dbtbuf);
+        for (size_t i = 0; i < models.size(); i++) {
+          models.at(i)->pimpl_->Resume();
+        }
+      }
+    } else // mode normal
+    {
+      for (size_t i = 0; i < models.size(); i++) {
+        models.at(i)->pimpl_->UpdatePos();
+      }
+    }
+
+    driver->beginScene(true, true, video::SColor(255, 200, 200, 200));
+
+    // vue poursuite
+    smgr->setActiveCamera(models.at(cam_id)->pimpl_->camera);
+    driver->setViewPort(core::rect<s32>(0, 0, scene_width, scene_height));
+    smgr->drawAll(); // commente voir plus bas
+                     /*
+                 env->drawAll();
+                 if (font)
+                 {
+                                     font->draw(L"This demo shows that Irrlicht is also capable
+                 of drawing 2D graphics.",
+                                             core::rect<s32>(130,10,300,50),
+                                             video::SColor(255,255,255,255));
+                 }
+                 else
+                 {
+                 printf("err\n");
+                 }
+                 device->setWindowCaption(L"toto");*/
+
+    if (dbtFile_r == NULL) // mode normal
+    {
+      for (size_t i = 0; i < models.size(); i++) {
+        models.at(i)->pimpl_->CheckCollision();
+      }
+    }
+
+    for (size_t i = 0; i < models.size(); i++) {
+      models.at(i)->ProcessUpdate(NULL);
+    }
+
+    // on fait ca ici, devrait etre un peu plus haut
+    // mais a priori souci avec models.at(i)->pimpl_->CheckCollision();
+    // (setelipsoid?)
+    smgr->setActiveCamera(models.at(cam_id)->pimpl_->camera);
+    driver->setViewPort(core::rect<s32>(0, 0, scene_width, scene_height));
+    smgr->drawAll();
+
+    driver->endScene();
+
+    int fps = driver->getFPS();
+    // printf("fps %i\n",fps);
+    if (lastFPS != fps) {
+      setWindowCaption(models.at(cam_id), fps);
+      lastFPS = fps;
+    }
+
+    if (receiver->IsKeyDown(KEY_PRIOR)) {
+      cam_id++;
+      if (cam_id >= (int)models.size())
+        cam_id = 0;
+      receiver->SetCamera(models.at(cam_id)->pimpl_->animator);
+      receiver->SetModel(models.at(cam_id));
+      setWindowCaption(models.at(cam_id), fps);
+    }
+    if (receiver->IsKeyDown(KEY_NEXT)) {
+      cam_id--;
+      if (cam_id < 0)
+        cam_id = models.size() - 1;
+      receiver->SetCamera(models.at(cam_id)->pimpl_->animator);
+      receiver->SetModel(models.at(cam_id));
+      setWindowCaption(models.at(cam_id), fps);
+    }
+
+    // enregistrement DBT
+    if (receiver->IsKeyDown(KEY_KEY_R) && dbtFile_w == NULL) {
+      dbtFile_w = inithdFile((char *)"./record.dbt", UAV, dbtSize(models));
+      dbtbuf = (char *)malloc(dbtSize(models));
+    }
+    if (receiver->IsKeyDown(KEY_KEY_S) && dbtFile_w != NULL) {
+      close_hdfile(dbtFile_w);
+      dbtFile_w = NULL;
+      free(dbtbuf);
+      // rt_printf("stop rec\n");
+    }
+    if (dbtFile_w != NULL) {
+      Time time = GetTime();
+      vector3df vect;
+      char *buf = dbtbuf;
+
+      for (size_t i = 0; i < models.size(); i++) {
+        models.at(i)->WritedbtBuf(buf);
+        buf += models.at(i)->dbtSize();
+      }
+
+      write_hdfile(dbtFile_w, dbtbuf, (road_time_t)(time / 1000),
+                   (road_timerange_t)(time % 1000), dbtSize(models));
+    }
+
+    // lecture dbt
+    if (receiver->IsKeyDown(KEY_KEY_P) && dbtFile_r == NULL) {
+      dbtFile_r = open_hdfile((char *)"./record.dbt", READ_MODE);
+      dbtbuf = (char *)malloc(dbtSize(models));
+      // on suspend les models pour ne pas interferer
+      for (size_t i = 0; i < models.size(); i++) {
+        models.at(i)->pimpl_->Suspend();
+      }
+    }
+    if (receiver->IsKeyDown(KEY_KEY_S) && dbtFile_r != NULL) {
+      // rt_printf("stop play\n");
+      close_hdfile(dbtFile_r);
+      dbtFile_r = NULL;
+      free(dbtbuf);
+      // on resume les models
+      for (size_t i = 0; i < models.size(); i++) {
+        models.at(i)->pimpl_->Resume();
+      }
+    }
+  }
+
+  receiver->SetCamera(NULL);
+  receiver->SetModel(NULL);
+}
+
+void Gui_impl::setWindowCaption(Object *object, int fps) {
+  std::ostringstream text;
+  text << "Cam: " << object->ObjectName().c_str()
+       << ", Kbd: " << object->ObjectName().c_str() << ", FPS: " << fps;
+
+  device->setWindowCaption(stringw(text.str().c_str()).c_str());
+}
+
+void Gui_impl::takeScreenshot(void) {
+  static int cpt = 0;
+  // get image from the last rendered frame
+  IImage *const image = driver->createScreenShot();
+  if (image) // should always be true, but you never know. ;)
+  {
+    // construct a filename, consisting of local time and file extension
+    c8 filename[64];
+    // snprintf(filename, 64, "screenshot_%u.png",
+    // device->getTimer()->getRealTime());
+    snprintf(filename, 64, "screenshot_%u.png", cpt);
+    cpt++;
+    // write screenshot to file
+    if (!driver->writeImageToFile(image, filename))
+      device->getLogger()->log(L"Failed to take screenshot.", ELL_WARNING);
+
+    // Don't forget to drop image since we don't need it anymore.
+    image->drop();
+  }
+}
+
+size_t Gui_impl::dbtSize(std::vector<Model *> models) {
+  size_t size = 0;
+  for (size_t i = 0; i < models.size(); i++) {
+    size += models.at(i)->dbtSize();
+  }
+
+  return size;
+}
+#endif // GL
Index: trunk/lib/FlairSimulator/src/Man.cpp
===================================================================
--- trunk/lib/FlairSimulator/src/Man.cpp	(revision 14)
+++ trunk/lib/FlairSimulator/src/Man.cpp	(revision 15)
@@ -34,136 +34,123 @@
 using namespace flair::gui;
 
-namespace flair
-{
-namespace simulator
-{
+namespace flair {
+namespace simulator {
 
-Man::Man(const Simulator* parent,std::string name): Model(parent,name)
-{
-    node = getGui()->getSceneManager()->addAnimatedMeshSceneNode(getGui()->getMesh("ninja.b3d"),getSceneNode(),-1,
-                                                                 vector3df(0,0,0),vector3df(90,0,90),vector3df(10,10,10));
+Man::Man(const Simulator *parent, std::string name) : Model(parent, name) {
+  node = getGui()->getSceneManager()->addAnimatedMeshSceneNode(
+      getGui()->getMesh("ninja.b3d"), getSceneNode(), -1, vector3df(0, 0, 0),
+      vector3df(90, 0, 90), vector3df(10, 10, 10));
 
-	node->setFrameLoop(0, 13);
-	node->setAnimationSpeed(0);
-	node->getMaterial(0).NormalizeNormals = true;
-	node->getMaterial(0).Lighting = false;
+  node->setFrameLoop(0, 13);
+  node->setAnimationSpeed(0);
+  node->getMaterial(0).NormalizeNormals = true;
+  node->getMaterial(0).Lighting = false;
 
-	getCamera()->setPositionOffset(vector3df(0,0,100));
-    getCamera()->setTargetOffset(vector3df(0,0,100));
+  getCamera()->setPositionOffset(vector3df(0, 0, 100));
+  getCamera()->setTargetOffset(vector3df(0, 0, 100));
 
-    setTriangleSelector(getGui()->getSceneManager()->createTriangleSelector(node));
-    Box()->addInternalBox(node->getTransformedBoundingBox());
+  setTriangleSelector(
+      getGui()->getSceneManager()->createTriangleSelector(node));
+  Box()->addInternalBox(node->getTransformedBoundingBox());
 
-    Tab *setup_tab=new Tab(GetTabWidget(),"model");
-        t_speed=new DoubleSpinBox(setup_tab->NewRow(),"translational speed (m/s):",0,5,0.1);
-        r_speed=new DoubleSpinBox(setup_tab->NewRow(),"rotational speed (deg/s):",0,180,10);
+  Tab *setup_tab = new Tab(GetTabWidget(), "model");
+  t_speed = new DoubleSpinBox(setup_tab->NewRow(), "translational speed (m/s):",
+                              0, 5, 0.1);
+  r_speed = new DoubleSpinBox(setup_tab->NewRow(), "rotational speed (deg/s):",
+                              0, 180, 10);
 }
 
-Man::~Man()
-{
+Man::~Man() {}
 
+void Man::CalcModel(void) {
+  // compute quaternion from W
+  // Quaternion derivative: dQ = 0.5*(Q*Qw)
+  Quaternion dQ = state[-1].Quat.GetDerivative(state[0].W);
+
+  // Quaternion integration
+  state[0].Quat = state[-1].Quat + dQ * dT();
+  state[0].Quat.Normalize();
+
+  Vector3D dir = state[0].Vel;
+  dir.Rotate(state[0].Quat);
+  state[0].Pos = state[-1].Pos + dT() * dir;
 }
 
-void Man::CalcModel(void)
-{
-    // compute quaternion from W
-    // Quaternion derivative: dQ = 0.5*(Q*Qw)
-    Quaternion dQ=state[-1].Quat.GetDerivative(state[0].W);
+bool Man::OnEvent(const SEvent &event) {
+  if (event.EventType != EET_KEY_INPUT_EVENT)
+    return false;
 
-    // Quaternion integration
-    state[0].Quat = state[-1].Quat +dQ*dT();
-    state[0].Quat.Normalize();
+  if (event.KeyInput.PressedDown == false) {
+    state[0].Vel.x = 0;
+    state[0].W.z = 0;
+    node->setAnimationSpeed(0);
+  } else {
+    switch (event.KeyInput.Key) {
+    case KEY_UP:
+      state[0].Vel.x = t_speed->Value();
+      node->setAnimationSpeed(t_speed->Value() * 10.f);
+      break;
+    case KEY_DOWN:
+      state[0].Vel.x = -t_speed->Value();
+      node->setAnimationSpeed(-t_speed->Value() * 10.f);
+      break;
+    case KEY_LEFT:
+      state[0].W.z = -Euler::ToRadian(r_speed->Value());
+      node->setAnimationSpeed(r_speed->Value() * .15f);
+      break;
+    case KEY_RIGHT:
+      state[0].W.z = Euler::ToRadian(r_speed->Value());
+      node->setAnimationSpeed(-r_speed->Value() * .15f);
+      break;
+    default:
+      return false;
+      break;
+    }
+  }
 
-    Vector3D dir=state[0].Vel;
-    dir.Rotate(state[0].Quat);
-    state[0].Pos=state[-1].Pos+dT()*dir;
+  return true;
 }
 
-bool Man::OnEvent(const SEvent& event)
-{
-    if (event.EventType != EET_KEY_INPUT_EVENT)
-        return false;
+size_t Man::dbtSize(void) const { return 6 * sizeof(float); }
 
-    if(event.KeyInput.PressedDown==false)
-    {
-        state[0].Vel.x=0;
-        state[0].W.z=0;
-        node->setAnimationSpeed(0);
-    }
-    else
-    {
-        switch(event.KeyInput.Key)
-        {
-        case KEY_UP:
-            state[0].Vel.x=t_speed->Value();
-            node->setAnimationSpeed(t_speed->Value()*10.f);
-            break;
-        case KEY_DOWN:
-            state[0].Vel.x=-t_speed->Value();
-            node->setAnimationSpeed(-t_speed->Value()*10.f);
-            break;
-        case KEY_LEFT:
-            state[0].W.z=-Euler::ToRadian(r_speed->Value());
-            node->setAnimationSpeed(r_speed->Value()*.15f);
-            break;
-        case KEY_RIGHT:
-            state[0].W.z=Euler::ToRadian(r_speed->Value());
-            node->setAnimationSpeed(-r_speed->Value()*.15f);
-            break;
-        default:
-            return false;
-            break;
-        }
-    }
-
-    return true;
+void Man::WritedbtBuf(char *dbtbuf) { /*
+                                         float *buf=(float*)dbtbuf;
+                                         vector3df vect=node->getPosition();
+                                         memcpy(buf,&vect.X,sizeof(float));
+                                         buf++;
+                                         memcpy(buf,&vect.Y,sizeof(float));
+                                         buf++;
+                                         memcpy(buf,&vect.Z,sizeof(float));
+                                         buf++;
+                                         vect=node->getRotation();
+                                         memcpy(buf,&vect.X,sizeof(float));
+                                         buf++;
+                                         memcpy(buf,&vect.Y,sizeof(float));
+                                         buf++;
+                                         memcpy(buf,&vect.Z,sizeof(float));
+                                         buf++;*/
 }
 
-size_t Man::dbtSize(void) const
-{
-    return 6*sizeof(float);
-}
-
-void Man::WritedbtBuf(char* dbtbuf)
-{/*
-    float *buf=(float*)dbtbuf;
-    vector3df vect=node->getPosition();
-    memcpy(buf,&vect.X,sizeof(float));
-    buf++;
-    memcpy(buf,&vect.Y,sizeof(float));
-    buf++;
-    memcpy(buf,&vect.Z,sizeof(float));
-    buf++;
-    vect=node->getRotation();
-    memcpy(buf,&vect.X,sizeof(float));
-    buf++;
-    memcpy(buf,&vect.Y,sizeof(float));
-    buf++;
-    memcpy(buf,&vect.Z,sizeof(float));
-    buf++;*/
-}
-
-void Man::ReaddbtBuf(char* dbtbuf)
-{/*
-    float *buf=(float*)dbtbuf;
-    vector3df vect;
-    memcpy(&vect.X,buf,sizeof(float));
-    buf++;
-    memcpy(&vect.Y,buf,sizeof(float));
-    buf++;
-    memcpy(&vect.Z,buf,sizeof(float));
-    buf++;
-    node->setPosition(vect);
-    memcpy(&vect.X,buf,sizeof(float));
-    buf++;
-    memcpy(&vect.Y,buf,sizeof(float));
-    buf++;
-    memcpy(&vect.Z,buf,sizeof(float));
-    buf++;
-    node->setRotation(vect);
-    node->setAnimationSpeed(2.f);*/
+void Man::ReaddbtBuf(char *dbtbuf) { /*
+                                        float *buf=(float*)dbtbuf;
+                                        vector3df vect;
+                                        memcpy(&vect.X,buf,sizeof(float));
+                                        buf++;
+                                        memcpy(&vect.Y,buf,sizeof(float));
+                                        buf++;
+                                        memcpy(&vect.Z,buf,sizeof(float));
+                                        buf++;
+                                        node->setPosition(vect);
+                                        memcpy(&vect.X,buf,sizeof(float));
+                                        buf++;
+                                        memcpy(&vect.Y,buf,sizeof(float));
+                                        buf++;
+                                        memcpy(&vect.Z,buf,sizeof(float));
+                                        buf++;
+                                        node->setRotation(vect);
+                                        node->setAnimationSpeed(2.f);*/
 }
 
 } // end namespace simulator
 } // end namespace flair
-#endif //GL
+#endif // GL
Index: trunk/lib/FlairSimulator/src/Man.h
===================================================================
--- trunk/lib/FlairSimulator/src/Man.h	(revision 14)
+++ trunk/lib/FlairSimulator/src/Man.h	(revision 15)
@@ -20,43 +20,36 @@
 #include <Model.h>
 
-namespace irr
-{
-    namespace scene
-    {
-        class IAnimatedMeshSceneNode;
-    }
+namespace irr {
+namespace scene {
+class IAnimatedMeshSceneNode;
+}
 }
 
-namespace flair
-{
-    namespace gui
-    {
-        class DoubleSpinBox;
-    }
+namespace flair {
+namespace gui {
+class DoubleSpinBox;
+}
 }
 
-namespace flair
-{
-namespace simulator
-{
-    class Simulator;
+namespace flair {
+namespace simulator {
+class Simulator;
 
-    class Man: private Model
-    {
-        public:
-            Man(const Simulator* parent,std::string name);
-            ~Man();
+class Man : private Model {
+public:
+  Man(const Simulator *parent, std::string name);
+  ~Man();
 
-        private:
-            size_t dbtSize(void) const;
-            void WritedbtBuf(char* dbtbuf);
-            void ReaddbtBuf(char* dbtbuf);
-            void CalcModel(void);
-            void AnimateModel(void){};
-            bool OnEvent(const irr::SEvent& event);
+private:
+  size_t dbtSize(void) const;
+  void WritedbtBuf(char *dbtbuf);
+  void ReaddbtBuf(char *dbtbuf);
+  void CalcModel(void);
+  void AnimateModel(void){};
+  bool OnEvent(const irr::SEvent &event);
 
-            irr::scene::IAnimatedMeshSceneNode* node;
-            gui::DoubleSpinBox *t_speed,*r_speed;
-    };
+  irr::scene::IAnimatedMeshSceneNode *node;
+  gui::DoubleSpinBox *t_speed, *r_speed;
+};
 } // end namespace simulator
 } // end namespace flair
Index: trunk/lib/FlairSimulator/src/MeshSceneNode.cpp
===================================================================
--- trunk/lib/FlairSimulator/src/MeshSceneNode.cpp	(revision 14)
+++ trunk/lib/FlairSimulator/src/MeshSceneNode.cpp	(revision 15)
@@ -28,69 +28,52 @@
 using namespace flair::core;
 
-namespace flair
-{
-namespace simulator
-{
+namespace flair {
+namespace simulator {
 
-MeshSceneNode::MeshSceneNode(Model* parent,IMesh* mesh,
-			const vector3df& position ,const vector3df& rotation,
-			ITexture* texture, s32 id ): IMeshSceneNode(parent->getSceneNode(), getGui()->getSceneManager(), id,position,rotation)
-{
-    Material.Wireframe = false;
-    Material.Lighting = false;
+MeshSceneNode::MeshSceneNode(Model *parent, IMesh *mesh,
+                             const vector3df &position,
+                             const vector3df &rotation, ITexture *texture,
+                             s32 id)
+    : IMeshSceneNode(parent->getSceneNode(), getGui()->getSceneManager(), id,
+                     position, rotation) {
+  Material.Wireframe = false;
+  Material.Lighting = false;
 
-    setMesh(mesh);
+  setMesh(mesh);
 
-    if(texture!=NULL)
-    {
-        setMaterialTexture(0,texture);
-    }
+  if (texture != NULL) {
+    setMaterialTexture(0, texture);
+  }
 
-    parent->Box()->addInternalBox(getTransformedBoundingBox());
+  parent->Box()->addInternalBox(getTransformedBoundingBox());
 }
 
+void MeshSceneNode::OnRegisterSceneNode(void) {
+  if (IsVisible)
+    SceneManager->registerNodeForRendering(this);
 
-void MeshSceneNode::OnRegisterSceneNode(void)
-{
-    if (IsVisible)
-        SceneManager->registerNodeForRendering(this);
-
-    ISceneNode::OnRegisterSceneNode();
+  ISceneNode::OnRegisterSceneNode();
 }
 
-void MeshSceneNode::render(void)
-{
-    IVideoDriver* driver = SceneManager->getVideoDriver();
+void MeshSceneNode::render(void) {
+  IVideoDriver *driver = SceneManager->getVideoDriver();
 
-    driver->setMaterial(Material);
-    driver->setTransform(ETS_WORLD, AbsoluteTransformation);
-    driver->drawMeshBuffer(mesh->getMeshBuffer(0));
+  driver->setMaterial(Material);
+  driver->setTransform(ETS_WORLD, AbsoluteTransformation);
+  driver->drawMeshBuffer(mesh->getMeshBuffer(0));
 }
 
+SMaterial &MeshSceneNode::getMaterial(u32 i) { return Material; }
 
-SMaterial& MeshSceneNode::getMaterial(u32 i)
-{
-    return Material;
+void MeshSceneNode::setMesh(IMesh *ptr) {
+  mesh = ptr;
+  Box = mesh->getBoundingBox();
 }
 
-void MeshSceneNode::setMesh(IMesh* ptr)
-{
-    mesh=ptr;
-    Box=mesh->getBoundingBox();
-}
+IMesh *MeshSceneNode::getMesh(void) { return mesh; }
 
-
-IMesh* MeshSceneNode::getMesh(void)
-{
-    return mesh;
-}
-
-
-void MeshSceneNode::setReadOnlyMaterials(bool readonly)
-{
-
-}
+void MeshSceneNode::setReadOnlyMaterials(bool readonly) {}
 
 } // end namespace simulator
 } // end namespace flair
-#endif //GL
+#endif // GL
Index: trunk/lib/FlairSimulator/src/MeshSceneNode.h
===================================================================
--- trunk/lib/FlairSimulator/src/MeshSceneNode.h	(revision 14)
+++ trunk/lib/FlairSimulator/src/MeshSceneNode.h	(revision 15)
@@ -20,47 +20,39 @@
 #include <IMeshSceneNode.h>
 
-namespace flair
-{
-namespace simulator
-{
-    class Model;
+namespace flair {
+namespace simulator {
+class Model;
 
-    class MeshSceneNode : public irr::scene::IMeshSceneNode
-    {
-        public:
-            MeshSceneNode(Model* parent,irr::scene::IMesh* mesh,
-                const irr::core::vector3df& position = irr::core::vector3df(0,0,0),
-                const irr::core::vector3df& rotation = irr::core::vector3df(0,0,0),
-                irr::video::ITexture* texture=NULL, irr::s32 id=-1);
+class MeshSceneNode : public irr::scene::IMeshSceneNode {
+public:
+  MeshSceneNode(
+      Model *parent, irr::scene::IMesh *mesh,
+      const irr::core::vector3df &position = irr::core::vector3df(0, 0, 0),
+      const irr::core::vector3df &rotation = irr::core::vector3df(0, 0, 0),
+      irr::video::ITexture *texture = NULL, irr::s32 id = -1);
 
-            virtual void OnRegisterSceneNode(void);
-            virtual void render(void);
-            virtual const irr::core::aabbox3d<irr::f32>& getBoundingBox() const
-            {
-                return Box;
-            }
-            virtual irr::u32 getMaterialCount(void) const
-            {
-                return 1;
-            }
-            virtual irr::video::SMaterial& getMaterial(irr::u32 i);
-            virtual void setMesh( irr::scene::IMesh* ptr);
-            virtual  irr::scene::IMesh* getMesh(void);
-            virtual void setReadOnlyMaterials(bool readonly);
-            virtual bool isReadOnlyMaterials(void) const
-            {
-                return false;
-            }
-            virtual irr::scene::IShadowVolumeSceneNode* addShadowVolumeSceneNode(const irr::scene::IMesh* shadowMesh=0,
-            irr::s32 id=-1, bool zfailmethod=true, irr::f32 infinity=1000.0f)
-            {
-                return NULL;
-            }
+  virtual void OnRegisterSceneNode(void);
+  virtual void render(void);
+  virtual const irr::core::aabbox3d<irr::f32> &getBoundingBox() const {
+    return Box;
+  }
+  virtual irr::u32 getMaterialCount(void) const { return 1; }
+  virtual irr::video::SMaterial &getMaterial(irr::u32 i);
+  virtual void setMesh(irr::scene::IMesh *ptr);
+  virtual irr::scene::IMesh *getMesh(void);
+  virtual void setReadOnlyMaterials(bool readonly);
+  virtual bool isReadOnlyMaterials(void) const { return false; }
+  virtual irr::scene::IShadowVolumeSceneNode *
+  addShadowVolumeSceneNode(const irr::scene::IMesh *shadowMesh = 0,
+                           irr::s32 id = -1, bool zfailmethod = true,
+                           irr::f32 infinity = 1000.0f) {
+    return NULL;
+  }
 
-        private:
-            irr::scene::IMesh *mesh;
-            irr::core::aabbox3d<irr::f32> Box;
-            irr::video::SMaterial Material;
-    };
+private:
+  irr::scene::IMesh *mesh;
+  irr::core::aabbox3d<irr::f32> Box;
+  irr::video::SMaterial Material;
+};
 } // end namespace simulator
 } // end namespace flair
Index: trunk/lib/FlairSimulator/src/Model.cpp
===================================================================
--- trunk/lib/FlairSimulator/src/Model.cpp	(revision 14)
+++ trunk/lib/FlairSimulator/src/Model.cpp	(revision 15)
@@ -32,28 +32,21 @@
 using namespace flair::gui;
 
-namespace flair
-{
-namespace simulator
-{
+namespace flair {
+namespace simulator {
 
-Model::Model(const Simulator* parent,std::string name) : IODevice(parent,name)
-{
+Model::Model(const Simulator *parent, std::string name)
+    : IODevice(parent, name) {
 #ifdef GL
-    pimpl_=new Model_impl(this,name,getGui()->getSceneManager(),parent->pimpl_);
+  pimpl_ =
+      new Model_impl(this, name, getGui()->getSceneManager(), parent->pimpl_);
 #else
-    pimpl_=new Model_impl(this,name,parent->pimpl_);
+  pimpl_ = new Model_impl(this, name, parent->pimpl_);
 #endif
-    parent->pimpl_->models.push_back(this);
+  parent->pimpl_->models.push_back(this);
 }
 
-Model::~Model()
-{
-    delete pimpl_;
-}
+Model::~Model() { delete pimpl_; }
 #ifdef GL
-ISceneNode* Model::getSceneNode() const
-{
-    return pimpl_;
-}
+ISceneNode *Model::getSceneNode() const { return pimpl_; }
 /*
 only used by dbt, to rewrite using conversion functions (irrlicht <-> simulator)
@@ -64,39 +57,24 @@
 }
 */
-void Model::setScale(float value)
-{
-    pimpl_->setScale(vector3df(value,value,value));
+void Model::setScale(float value) {
+  pimpl_->setScale(vector3df(value, value, value));
 }
 
-aabbox3d<f32> *Model::Box() const
-{
-    return &(pimpl_->box);
+aabbox3d<f32> *Model::Box() const { return &(pimpl_->box); }
+
+AnimPoursuite *Model::getCamera(void) const { return pimpl_->animator; }
+
+void Model::setTriangleSelector(ITriangleSelector *selector) {
+
+  pimpl_->selector = selector;
+  pimpl_->setTriangleSelector(selector);
 }
 
-AnimPoursuite* Model::getCamera(void) const
-{
-    return pimpl_->animator;
-}
-
-void Model::setTriangleSelector(ITriangleSelector* selector) {
-
-    pimpl_->selector=selector;
-    pimpl_->setTriangleSelector(selector);
-}
-
-void Model::setCameraFarValue(float zf) {
-    pimpl_->camera->setFarValue(zf);
-}
+void Model::setCameraFarValue(float zf) { pimpl_->camera->setFarValue(zf); }
 #endif
 
-TabWidget* Model::GetTabWidget(void) const
-{
-    return pimpl_->tabwidget;
-}
+TabWidget *Model::GetTabWidget(void) const { return pimpl_->tabwidget; }
 
-float Model::dT(void) const
-{
-    return pimpl_->dT->Value();
-}
+float Model::dT(void) const { return pimpl_->dT->Value(); }
 
 } // end namespace simulator
Index: trunk/lib/FlairSimulator/src/Model.h
===================================================================
--- trunk/lib/FlairSimulator/src/Model.h	(revision 14)
+++ trunk/lib/FlairSimulator/src/Model.h	(revision 15)
@@ -25,26 +25,21 @@
 #ifdef GL
 #include <aabbox3d.h>
-namespace irr
-{
-    class SEvent;
-    namespace scene
-    {
-        class ISceneManager;
-        class ISceneNode;
-        class ITriangleSelector;
-    }
+namespace irr {
+class SEvent;
+namespace scene {
+class ISceneManager;
+class ISceneNode;
+class ITriangleSelector;
+}
 }
 #endif
 
-namespace flair
-{
-    namespace gui
-    {
-        class TabWidget;
-    }
-    namespace sensor
-    {
-        class SensorGL;
-    }
+namespace flair {
+namespace gui {
+class TabWidget;
+}
+namespace sensor {
+class SensorGL;
+}
 }
 
@@ -53,64 +48,60 @@
 class Model_impl;
 
-namespace flair
-{
-namespace simulator
-{
-    class Simulator;
-    class AnimPoursuite;
+namespace flair {
+namespace simulator {
+class Simulator;
+class AnimPoursuite;
 
-    class Model : public core::IODevice
-    {
-        friend class ::Gui_impl;
-        friend class ::Simulator_impl;
-        friend class ::Model_impl;
-        friend class AnimPoursuite;
-        friend class sensor::SensorGL;
+class Model : public core::IODevice {
+  friend class ::Gui_impl;
+  friend class ::Simulator_impl;
+  friend class ::Model_impl;
+  friend class AnimPoursuite;
+  friend class sensor::SensorGL;
 
-        public:
-            Model(const Simulator* parent,std::string name);
-            virtual ~Model();
+public:
+  Model(const Simulator *parent, std::string name);
+  virtual ~Model();
 
+  typedef struct simu_state {
+    core::Quaternion Quat;
+    core::Vector3D W;
+    core::Vector3D Pos;
+    core::Vector3D Vel;
+  } simu_state_t;
 
-            typedef struct simu_state {
-                core::Quaternion Quat;
-                core::Vector3D W;
-                core::Vector3D Pos;
-                core::Vector3D Vel;
-            } simu_state_t;
+#ifdef GL
+  irr::scene::ISceneNode *getSceneNode() const;
+  irr::core::aabbox3d<irr::f32> *Box() const;
 
-    #ifdef GL
-            irr::scene::ISceneNode* getSceneNode() const;
-            irr::core::aabbox3d<irr::f32>* Box() const;
+  virtual size_t dbtSize(void) const = 0;
+  virtual void Draw(void){};
+  virtual void ExtraDraw(void){};
+  virtual void WritedbtBuf(char *dbtbuf) = 0;
+  virtual void ReaddbtBuf(char *dbtbuf) = 0;
+  virtual bool OnEvent(const irr::SEvent &event) = 0;
 
-            virtual size_t dbtSize(void) const =0;
-            virtual void Draw(void){};
-            virtual void ExtraDraw(void){};
-            virtual void WritedbtBuf(char* dbtbuf)=0;
-            virtual void ReaddbtBuf(char* dbtbuf)=0;
-            virtual bool OnEvent(const irr::SEvent& event)=0;
+  //! Sets the value of the camera's far clipping plane (default: 2000.0f)
+  /** \param zf: New z far value. */
+  void setCameraFarValue(float zf);
+#endif
+  gui::TabWidget *GetTabWidget(void) const;
 
-            //! Sets the value of the camera's far clipping plane (default: 2000.0f)
-            /** \param zf: New z far value. */
-            void setCameraFarValue(float zf);
-    #endif
-            gui::TabWidget* GetTabWidget(void) const;
+protected:
+  DiscreteTimeVariable<simu_state_t, 3> state;
+  float dT(void) const;
+  virtual void CalcModel(void) = 0;
+#ifdef GL
+  AnimPoursuite *getCamera(void) const;
+  virtual void AnimateModel(void) = 0;
+  // void setPosition(core::Vector3D pos);
+  void setScale(float value);
+  void setTriangleSelector(irr::scene::ITriangleSelector *selector);
+#endif
 
-        protected:
-            DiscreteTimeVariable<simu_state_t,3> state;
-            float dT(void) const;
-            virtual void CalcModel(void)=0;
-    #ifdef GL
-            AnimPoursuite* getCamera(void) const;
-            virtual void AnimateModel(void)=0;
-            //void setPosition(core::Vector3D pos);
-            void setScale(float value);
-            void setTriangleSelector(irr::scene::ITriangleSelector* selector);
-    #endif
-
-        private:
-            void UpdateFrom(const core::io_data *data){};
-            class Model_impl* pimpl_;
-    };
+private:
+  void UpdateFrom(const core::io_data *data){};
+  class Model_impl *pimpl_;
+};
 } // end namespace simulator
 } // end namespace flair
Index: trunk/lib/FlairSimulator/src/Model_impl.cpp
===================================================================
--- trunk/lib/FlairSimulator/src/Model_impl.cpp	(revision 14)
+++ trunk/lib/FlairSimulator/src/Model_impl.cpp	(revision 15)
@@ -50,306 +50,293 @@
 
 #ifdef GL
-Model_impl::Model_impl(Model* self,std::string name,ISceneManager* scenemanager,vrpn_Connection_IP* vrpn)
-    :  ISceneNode(scenemanager->getRootSceneNode(), scenemanager, -1),Thread(self,name,50),vrpn_Tracker( name.c_str(), vrpn )
+Model_impl::Model_impl(Model *self, std::string name,
+                       ISceneManager *scenemanager, vrpn_Connection_IP *vrpn)
+    : ISceneNode(scenemanager->getRootSceneNode(), scenemanager, -1),
+      Thread(self, name, 50), vrpn_Tracker(name.c_str(), vrpn)
 
 #else
-Model_impl::Model_impl(Model* self,std::string name,vrpn_Connection_IP* vrpn)
-    : Thread(self,name,50),vrpn_Tracker( name.c_str(), vrpn )
+Model_impl::Model_impl(Model *self, std::string name, vrpn_Connection_IP *vrpn)
+    : Thread(self, name, 50), vrpn_Tracker(name.c_str(), vrpn)
 #endif
 {
-    this->self=self;
-
-#ifdef GL
-    //for sync with gui
-    cond=new ConditionVariable(this,name);
-    sync_count=0;
-
-    //collisions
-    collision_mutex=new Mutex(this);
-    collision_occured=false;
-
-    //selector for collisions
-    selector = getSceneManager()->createTriangleSelectorFromBoundingBox(this);
-    setTriangleSelector(selector);
-    meta_selector = getSceneManager()->createMetaTriangleSelector();
-
-    anim = getSceneManager()->createCollisionResponseAnimator(meta_selector, this,vector3df(1,1,1),vector3df(0,0,0), vector3df(0,0,0));
-    addAnimator(anim);
-
-    //camera
-	camera =getSceneManager()->addCameraSceneNode();
-    camera->setAspectRatio(getGui()->getAspectRatio());//on force a cause du view port
-    camera->setUpVector(vector3df(0,0,1));
-
-    animator=new AnimPoursuite(this);
-    camera->addAnimator(animator);
-    camera->setFarValue(8000);
-
-    position_init=false;
-#endif
-
-    //init user interface
-    Tab* tab=new Tab(getSimulator()->GetTabWidget(),ObjectName());
-    tabwidget=new TabWidget(tab->NewRow(),"tabs");
-    Tab* sampl=new Tab(tabwidget,"sampling");
-    dT=new DoubleSpinBox(sampl->NewRow(),"Tech (s):",0.001,1,0.001,3);
-    Tab* layout=new Tab(tabwidget,"optitrack");
-    enable_opti=new CheckBox(layout->NewRow(),"enabled");
-    Tab* init=new Tab(tabwidget,"init");
-    pos_init=new Vector3DSpinBox(init->NewRow(),"position",-50,50,1);
-    yaw_init=new SpinBox(init->NewRow(),"yaw (deg):",-180,180,10);
-
-    //modele
-    states_mutex=new Mutex(this);
-	self->state[0].Pos=pos_init->Value();
-	self->state[0].Vel.x=0;
-    self->state[0].Vel.y=0;
-    self->state[0].Vel.z=0;
-	self->state[0].Quat=ComputeInitRotation(Quaternion(1,0,0,0));
-    self->state[0].W.x=0;
-    self->state[0].W.y=0;
-    self->state[0].W.z=0;
-
-    self->state[-1]=self->state[0];
-    self->state[-2]=self->state[0];
-
-    cvmatrix_descriptor* desc=new cvmatrix_descriptor(13,1);
-	desc->SetElementName(0,0,"q0");
-	desc->SetElementName(1,0,"q1");
-	desc->SetElementName(2,0,"q2");
-	desc->SetElementName(3,0,"q3");
-	desc->SetElementName(4,0,"x");
-	desc->SetElementName(5,0,"y");
-	desc->SetElementName(6,0,"z");
-	desc->SetElementName(7,0,"wx");
-	desc->SetElementName(8,0,"wy");
-	desc->SetElementName(9,0,"wz");
-	desc->SetElementName(10,0,"vx");
-	desc->SetElementName(11,0,"vy");
-	desc->SetElementName(12,0,"vz");
-    output=new cvmatrix(this,desc,floatType,"state");
-
-    self->AddDataToLog(output);
-}
-
-Model_impl::~Model_impl()
-{
-    SafeStop();
-    Join();
-#ifdef GL
-    remove();//remove ISceneNode
+  this->self = self;
+
+#ifdef GL
+  // for sync with gui
+  cond = new ConditionVariable(this, name);
+  sync_count = 0;
+
+  // collisions
+  collision_mutex = new Mutex(this);
+  collision_occured = false;
+
+  // selector for collisions
+  selector = getSceneManager()->createTriangleSelectorFromBoundingBox(this);
+  setTriangleSelector(selector);
+  meta_selector = getSceneManager()->createMetaTriangleSelector();
+
+  anim = getSceneManager()->createCollisionResponseAnimator(
+      meta_selector, this, vector3df(1, 1, 1), vector3df(0, 0, 0),
+      vector3df(0, 0, 0));
+  addAnimator(anim);
+
+  // camera
+  camera = getSceneManager()->addCameraSceneNode();
+  camera->setAspectRatio(
+      getGui()->getAspectRatio()); // on force a cause du view port
+  camera->setUpVector(vector3df(0, 0, 1));
+
+  animator = new AnimPoursuite(this);
+  camera->addAnimator(animator);
+  camera->setFarValue(8000);
+
+  position_init = false;
+#endif
+
+  // init user interface
+  Tab *tab = new Tab(getSimulator()->GetTabWidget(), ObjectName());
+  tabwidget = new TabWidget(tab->NewRow(), "tabs");
+  Tab *sampl = new Tab(tabwidget, "sampling");
+  dT = new DoubleSpinBox(sampl->NewRow(), "Tech (s):", 0.001, 1, 0.001, 3);
+  Tab *layout = new Tab(tabwidget, "optitrack");
+  enable_opti = new CheckBox(layout->NewRow(), "enabled");
+  Tab *init = new Tab(tabwidget, "init");
+  pos_init = new Vector3DSpinBox(init->NewRow(), "position", -50, 50, 1);
+  yaw_init = new SpinBox(init->NewRow(), "yaw (deg):", -180, 180, 10);
+
+  // modele
+  states_mutex = new Mutex(this);
+  self->state[0].Pos = pos_init->Value();
+  self->state[0].Vel.x = 0;
+  self->state[0].Vel.y = 0;
+  self->state[0].Vel.z = 0;
+  self->state[0].Quat = ComputeInitRotation(Quaternion(1, 0, 0, 0));
+  self->state[0].W.x = 0;
+  self->state[0].W.y = 0;
+  self->state[0].W.z = 0;
+
+  self->state[-1] = self->state[0];
+  self->state[-2] = self->state[0];
+
+  cvmatrix_descriptor *desc = new cvmatrix_descriptor(13, 1);
+  desc->SetElementName(0, 0, "q0");
+  desc->SetElementName(1, 0, "q1");
+  desc->SetElementName(2, 0, "q2");
+  desc->SetElementName(3, 0, "q3");
+  desc->SetElementName(4, 0, "x");
+  desc->SetElementName(5, 0, "y");
+  desc->SetElementName(6, 0, "z");
+  desc->SetElementName(7, 0, "wx");
+  desc->SetElementName(8, 0, "wy");
+  desc->SetElementName(9, 0, "wz");
+  desc->SetElementName(10, 0, "vx");
+  desc->SetElementName(11, 0, "vy");
+  desc->SetElementName(12, 0, "vz");
+  output = new cvmatrix(this, desc, floatType, "state");
+
+  self->AddDataToLog(output);
+}
+
+Model_impl::~Model_impl() {
+  SafeStop();
+  Join();
+#ifdef GL
+  remove(); // remove ISceneNode
 #endif
 }
 
 Quaternion Model_impl::ComputeInitRotation(Quaternion quat_in) {
-    Quaternion yaw_rot_quat;
-    Euler yaw_rot_euler(0,0,Euler::ToRadian(yaw_init->Value()));
-    yaw_rot_euler.ToQuaternion(yaw_rot_quat);
-    return yaw_rot_quat*quat_in;
-}
-
-void Model_impl::mainloop(void)
-{
-    if(enable_opti->Value()==false) return;
-    vrpn_gettimeofday(&_timestamp, NULL);
-    vrpn_Tracker::timestamp = _timestamp;
-
-    //change to vrpn reference
+  Quaternion yaw_rot_quat;
+  Euler yaw_rot_euler(0, 0, Euler::ToRadian(yaw_init->Value()));
+  yaw_rot_euler.ToQuaternion(yaw_rot_quat);
+  return yaw_rot_quat * quat_in;
+}
+
+void Model_impl::mainloop(void) {
+  if (enable_opti->Value() == false)
+    return;
+  vrpn_gettimeofday(&_timestamp, NULL);
+  vrpn_Tracker::timestamp = _timestamp;
+
+  // change to vrpn reference
+  states_mutex->GetMutex();
+  Quaternion quat = getSimulator()->ToVRPNReference(self->state[0].Quat);
+  Vector3D position = getSimulator()->ToVRPNReference(self->state[0].Pos);
+  states_mutex->ReleaseMutex();
+
+  pos[0] = position.x;
+  pos[1] = position.y;
+  pos[2] = position.z;
+  // warning: d_quat is defined as (qx,qy,qz,qw), which is different from
+  // flair::core::Quaternion
+  d_quat[0] = quat.q1;
+  d_quat[1] = quat.q2;
+  d_quat[2] = quat.q3;
+  d_quat[3] = quat.q0;
+
+  char msgbuf[1000];
+
+  d_sensor = 0;
+
+  int len = vrpn_Tracker::encode_to(msgbuf);
+
+  if (d_connection->pack_message(len, _timestamp, position_m_id, d_sender_id,
+                                 msgbuf, vrpn_CONNECTION_LOW_LATENCY)) {
+    fprintf(stderr, "can't write message: tossing\n");
+  }
+
+  server_mainloop();
+}
+
+#ifdef GL
+ITriangleSelector *Model_impl::TriangleSelector(void) { return selector; }
+
+IMetaTriangleSelector *Model_impl::MetaTriangleSelector(void) {
+  return meta_selector;
+}
+
+void Model_impl::UpdatePos(void) {
+  vector3df nodePosition;
+  Quaternion nodeOrientation;
+  Euler euler;
+
+  states_mutex->GetMutex();
+  nodePosition = ToIrrlichtCoordinates(self->state[0].Pos);
+  nodeOrientation = ToIrrlichtOrientation(self->state[0].Quat);
+  states_mutex->ReleaseMutex();
+
+  setPosition(nodePosition);
+
+  nodeOrientation.ToEuler(euler);
+  ISceneNode::setRotation(Euler::ToDegree(1) *
+                          vector3df(euler.roll, euler.pitch, euler.yaw));
+
+  if (position_init == false) {
+    anim->setTargetNode(this); // a faire pour se teleporter sans les collisions
+    position_init = true;
+  }
+
+  self->AnimateModel();
+}
+
+void Model_impl::CheckCollision(void) {
+  // TODO: setEllipsoidRadius should be called in Model::setScale
+  // but we need to call recalculateBoundingBox
+  anim->setEllipsoidRadius(getTransformedBoundingBox().getExtent());
+
+  if (anim->collisionOccurred() == true) {
+    vector3df pos;
+    vector3df pos_rel;
+    vector3df nodePosition;
+    pos = anim->getCollisionPoint();
+    nodePosition = getPosition();
+    pos_rel = pos - nodePosition;
+    // printf("collision %f %f %f\n",pos.X,pos.Y,pos.Z);
+    // printf("drone %f %f %f\n",nodePosition.X,nodePosition.Y,nodePosition.Z);
+    // printf("rel %f %f %f\n",pos_rel.X,pos_rel.Z,pos_rel.Y);
+
+    collision_mutex->GetMutex();
+    collision_occured = true;
+    collision_point = ToSimulatorCoordinates(nodePosition);
+    collision_mutex->ReleaseMutex();
+  }
+}
+
+void Model_impl::CollisionHandler(void) {
+  collision_mutex->GetMutex();
+  if (collision_occured == true) {
+    collision_occured = false;
     states_mutex->GetMutex();
-    Quaternion quat=getSimulator()->ToVRPNReference(self->state[0].Quat);
-    Vector3D position=getSimulator()->ToVRPNReference(self->state[0].Pos);
+    self->state[0].Pos = collision_point;
+    self->state[-1].Pos = self->state[0].Pos;
+    self->state[-2].Pos = self->state[0].Pos;
     states_mutex->ReleaseMutex();
-
-    pos[0]=position.x;
-    pos[1]=position.y;
-    pos[2]=position.z;
-    //warning: d_quat is defined as (qx,qy,qz,qw), which is different from flair::core::Quaternion
-    d_quat[0] = quat.q1;
-    d_quat[1] = quat.q2;
-    d_quat[2] = quat.q3;
-    d_quat[3] = quat.q0;
-
-    char msgbuf[1000];
-
-    d_sensor = 0;
-
-    int  len = vrpn_Tracker::encode_to(msgbuf);
-
-    if (d_connection->pack_message(len, _timestamp, position_m_id, d_sender_id, msgbuf, vrpn_CONNECTION_LOW_LATENCY))
-    {
-        fprintf(stderr,"can't write message: tossing\n");
+  }
+  collision_mutex->ReleaseMutex();
+}
+
+void Model_impl::OnRegisterSceneNode(void) {
+  if (IsVisible)
+    SceneManager->registerNodeForRendering(this);
+
+  ISceneNode::OnRegisterSceneNode();
+}
+
+void Model_impl::render(void) {
+  IVideoDriver *driver = SceneManager->getVideoDriver();
+  driver->setTransform(ETS_WORLD, AbsoluteTransformation);
+}
+
+// le premier arrive attend l'autre
+void Model_impl::SynchronizationPoint() {
+  cond->GetMutex();
+  sync_count++;
+
+  if (sync_count < 2) {
+    cond->CondWait();
+  } else {
+    cond->CondSignal();
+  }
+
+  cond->ReleaseMutex();
+}
+#endif // GL
+
+void Model_impl::Run(void) {
+  // Ask Xenomai to warn us upon switches to secondary mode.
+  WarnUponSwitches(true);
+
+#ifdef GL
+  // synchronize with gui
+  SynchronizationPoint();
+#endif
+
+  SetPeriodMS(dT->Value() * 1000.);
+
+  while (!ToBeStopped()) {
+    if (dT->ValueChanged())
+      SetPeriodMS(dT->Value() * 1000.);
+    WaitPeriod();
+
+#ifdef GL
+    CollisionHandler();
+#endif
+    states_mutex->GetMutex();
+    self->CalcModel();
+
+    output->GetMutex();
+    output->SetValueNoMutex(0, 0, self->state[0].Quat.q0);
+    output->SetValueNoMutex(1, 0, self->state[0].Quat.q1);
+    output->SetValueNoMutex(2, 0, self->state[0].Quat.q2);
+    output->SetValueNoMutex(3, 0, self->state[0].Quat.q3);
+    output->SetValueNoMutex(4, 0, self->state[0].Pos.x);
+    output->SetValueNoMutex(5, 0, self->state[0].Pos.y);
+    output->SetValueNoMutex(6, 0, self->state[0].Pos.z);
+    output->SetValueNoMutex(7, 0, self->state[0].W.x);
+    output->SetValueNoMutex(8, 0, self->state[0].W.y);
+    output->SetValueNoMutex(9, 0, self->state[0].W.z);
+    output->SetValueNoMutex(10, 0, self->state[0].Vel.x);
+    output->SetValueNoMutex(11, 0, self->state[0].Vel.y);
+    output->SetValueNoMutex(12, 0, self->state[0].Vel.z);
+    output->ReleaseMutex();
+    output->SetDataTime(GetTime());
+
+    self->state.Update();
+
+    if (pos_init->ValueChanged() || yaw_init->ValueChanged()) {
+      self->state[-1].Quat = ComputeInitRotation(Quaternion(1, 0, 0, 0));
+      self->state[-2].Quat = ComputeInitRotation(Quaternion(1, 0, 0, 0));
+      self->state[-1].Pos = pos_init->Value();
+      self->state[-2].Pos = self->state[-1].Pos;
+#ifdef GL
+      position_init = false;
+#endif
     }
 
-    server_mainloop();
-}
-
-#ifdef GL
-ITriangleSelector* Model_impl::TriangleSelector(void)
-{
-    return selector;
-}
-
-IMetaTriangleSelector* Model_impl::MetaTriangleSelector(void)
-{
-    return meta_selector;
-}
-
-void Model_impl::UpdatePos(void)
-{
-    vector3df nodePosition;
-    Quaternion nodeOrientation;
-    Euler euler;
-
-    states_mutex->GetMutex();
-    nodePosition=ToIrrlichtCoordinates(self->state[0].Pos);
-    nodeOrientation=ToIrrlichtOrientation(self->state[0].Quat);
     states_mutex->ReleaseMutex();
 
-    setPosition(nodePosition);
-
-    nodeOrientation.ToEuler(euler);
-    ISceneNode::setRotation(Euler::ToDegree(1)*vector3df(euler.roll,euler.pitch,euler.yaw));
-
-    if(position_init==false)
-    {
-        anim->setTargetNode(this); // a faire pour se teleporter sans les collisions
-        position_init=true;
-    }
-
-    self->AnimateModel();
-}
-
-void Model_impl::CheckCollision(void)
-{
-    //TODO: setEllipsoidRadius should be called in Model::setScale
-    //but we need to call recalculateBoundingBox
-    anim->setEllipsoidRadius(getTransformedBoundingBox().getExtent());
-
-    if(anim->collisionOccurred()==true)
-    {
-        vector3df pos;
-        vector3df pos_rel;
-        vector3df nodePosition;
-        pos= anim->getCollisionPoint();
-        nodePosition=getPosition();
-        pos_rel=pos-nodePosition;
-        //printf("collision %f %f %f\n",pos.X,pos.Y,pos.Z);
-        //printf("drone %f %f %f\n",nodePosition.X,nodePosition.Y,nodePosition.Z);
-        //printf("rel %f %f %f\n",pos_rel.X,pos_rel.Z,pos_rel.Y);
-
-        collision_mutex->GetMutex();
-        collision_occured=true;
-        collision_point=ToSimulatorCoordinates(nodePosition);
-        collision_mutex->ReleaseMutex();
-    }
-}
-
-void Model_impl::CollisionHandler(void)
-{
-    collision_mutex->GetMutex();
-    if(collision_occured==true)
-    {
-        collision_occured=false;
-        states_mutex->GetMutex();
-        self->state[0].Pos=collision_point;
-        self->state[-1].Pos=self->state[0].Pos;
-        self->state[-2].Pos=self->state[0].Pos;
-        states_mutex->ReleaseMutex();
-    }
-    collision_mutex->ReleaseMutex();
-}
-
-void Model_impl::OnRegisterSceneNode(void)
-{
-    if (IsVisible)
-        SceneManager->registerNodeForRendering(this);
-
-    ISceneNode::OnRegisterSceneNode();
-}
-
-void Model_impl::render(void)
-{
-    IVideoDriver* driver = SceneManager->getVideoDriver();
-    driver->setTransform(ETS_WORLD, AbsoluteTransformation);
-}
-
-//le premier arrive attend l'autre
-void Model_impl::SynchronizationPoint()
-{
-    cond->GetMutex();
-    sync_count++;
-
-    if (sync_count < 2)
-    {
-         cond->CondWait();
-    }
-    else
-    {
-        cond->CondSignal();
-    }
-
-    cond->ReleaseMutex();
-}
-#endif //GL
-
-void Model_impl::Run(void)
-{
-    // Ask Xenomai to warn us upon switches to secondary mode.
-    WarnUponSwitches(true);
-
-#ifdef GL
-    //synchronize with gui
-    SynchronizationPoint();
-#endif
-
-    SetPeriodMS(dT->Value()*1000.);
-
-    while(!ToBeStopped())
-    {
-        if(dT->ValueChanged()) SetPeriodMS(dT->Value()*1000.);
-        WaitPeriod();
-
-#ifdef GL
-        CollisionHandler();
-#endif
-        states_mutex->GetMutex();
-        self->CalcModel();
-
-        output->GetMutex();
-        output->SetValueNoMutex(0,0,self->state[0].Quat.q0);
-        output->SetValueNoMutex(1,0,self->state[0].Quat.q1);
-        output->SetValueNoMutex(2,0,self->state[0].Quat.q2);
-        output->SetValueNoMutex(3,0,self->state[0].Quat.q3);
-        output->SetValueNoMutex(4,0,self->state[0].Pos.x);
-        output->SetValueNoMutex(5,0,self->state[0].Pos.y);
-        output->SetValueNoMutex(6,0,self->state[0].Pos.z);
-        output->SetValueNoMutex(7,0,self->state[0].W.x);
-        output->SetValueNoMutex(8,0,self->state[0].W.y);
-        output->SetValueNoMutex(9,0,self->state[0].W.z);
-        output->SetValueNoMutex(10,0,self->state[0].Vel.x);
-        output->SetValueNoMutex(11,0,self->state[0].Vel.y);
-        output->SetValueNoMutex(12,0,self->state[0].Vel.z);
-        output->ReleaseMutex();
-        output->SetDataTime(GetTime());
-
-        self->state.Update();
-
-        if(pos_init->ValueChanged() || yaw_init->ValueChanged())
-        {
-            self->state[-1].Quat=ComputeInitRotation(Quaternion(1,0,0,0));
-            self->state[-2].Quat=ComputeInitRotation(Quaternion(1,0,0,0));
-            self->state[-1].Pos=pos_init->Value();
-            self->state[-2].Pos=self->state[-1].Pos;
-#ifdef GL
-            position_init=false;
-#endif
-        }
-
-        states_mutex->ReleaseMutex();
-
-        self->ProcessUpdate(output);
-
-    }
-
-    WarnUponSwitches(false);
-}
+    self->ProcessUpdate(output);
+  }
+
+  WarnUponSwitches(false);
+}
Index: trunk/lib/FlairSimulator/src/Parser.cpp
===================================================================
--- trunk/lib/FlairSimulator/src/Parser.cpp	(revision 14)
+++ trunk/lib/FlairSimulator/src/Parser.cpp	(revision 15)
@@ -23,5 +23,4 @@
 #include "GenericObject.h"
 
-
 using namespace irr;
 using namespace irr::core;
@@ -31,194 +30,198 @@
 using namespace flair::simulator;
 
-//todo: getMeshVect doit plutot donner point3D et euler
-//adaptr le xml et la dtd
-
-namespace flair
-{
-namespace simulator
-{
-Parser::Parser(Simulator* parent,int app_width, int app_height,int scene_width, int scene_height,std::string media_path, std::string xmlFile): Gui(parent,"Parser",app_width,app_height,scene_width,scene_height, media_path)
-{
-	this->media_path = media_path;
-	this->parent = parent;
-	xmlNode        *root_element = NULL;
-	doc = xmlReadFile(xmlFile.c_str(), NULL, 0);
-	xmlDtdPtr dtd = NULL;
-	dtd = xmlParseDTD(NULL,  (const xmlChar *)(media_path.append("/scene.dtd").c_str()));
-
-	if (dtd == NULL)
-	{
-		//xmlGenericError(xmlGenericErrorContext,
-		Err("Could not parse DTD scene.dtd\n");
-	}
-	else
-	{
-		xmlValidCtxt cvp;
-		cvp.userData = (void *) stderr;
-		cvp.error    = (xmlValidityErrorFunc) fprintf;
-		cvp.warning  = (xmlValidityWarningFunc) fprintf;
-		if (!xmlValidateDtd(&cvp, doc, dtd))
-		{
-			//xmlGenericError(xmlGenericErrorContext,
-			Err("Document does not validate against scene.dtd\n");
-		}
-	}
-
-	if (doc == NULL)
-	{
-		Err("error: could not parse file %s\n", xmlFile.c_str());
-	}
-	else
-	{
-		/*
-		 * Get the root element node
-		 */
-		root_element = xmlDocGetRootElement(doc);
-		processElements(root_element);
-    }
-
-}
-
-Parser::~Parser()
-{
-	if(doc!=NULL)
-	{
-		/*
-		 * free the document
-		 */
-		xmlFreeDoc(doc);;
-	}
-	/*
-	 *Free the global variables that may
-	 *have been allocated by the parser.
-	 */
-	xmlCleanupParser();
+// todo: getMeshVect doit plutot donner point3D et euler
+// adaptr le xml et la dtd
+
+namespace flair {
+namespace simulator {
+Parser::Parser(Simulator *parent, int app_width, int app_height,
+               int scene_width, int scene_height, std::string media_path,
+               std::string xmlFile)
+    : Gui(parent, "Parser", app_width, app_height, scene_width, scene_height,
+          media_path) {
+  this->media_path = media_path;
+  this->parent = parent;
+  xmlNode *root_element = NULL;
+  doc = xmlReadFile(xmlFile.c_str(), NULL, 0);
+  xmlDtdPtr dtd = NULL;
+  dtd = xmlParseDTD(NULL,
+                    (const xmlChar *)(media_path.append("/scene.dtd").c_str()));
+
+  if (dtd == NULL) {
+    // xmlGenericError(xmlGenericErrorContext,
+    Err("Could not parse DTD scene.dtd\n");
+  } else {
+    xmlValidCtxt cvp;
+    cvp.userData = (void *)stderr;
+    cvp.error = (xmlValidityErrorFunc)fprintf;
+    cvp.warning = (xmlValidityWarningFunc)fprintf;
+    if (!xmlValidateDtd(&cvp, doc, dtd)) {
+      // xmlGenericError(xmlGenericErrorContext,
+      Err("Document does not validate against scene.dtd\n");
+    }
+  }
+
+  if (doc == NULL) {
+    Err("error: could not parse file %s\n", xmlFile.c_str());
+  } else {
+    /*
+     * Get the root element node
+     */
+    root_element = xmlDocGetRootElement(doc);
+    processElements(root_element);
+  }
+}
+
+Parser::~Parser() {
+  if (doc != NULL) {
+    /*
+     * free the document
+     */
+    xmlFreeDoc(doc);
+    ;
+  }
+  /*
+   *Free the global variables that may
+   *have been allocated by the parser.
+   */
+  xmlCleanupParser();
 }
 
 /* Recursive function that prints the XML structure */
-void Parser::processElements(xmlNode * a_node)
-{
-	xmlNode *cur_node = NULL;
-	for (cur_node = a_node; cur_node; cur_node = cur_node->next)
-	{
-		if(cur_node->type == XML_ELEMENT_NODE)
-		{
-			if(xmlStrEqual(cur_node->name, (xmlChar*) "params"))
-			{
-				processParams(cur_node->children);
-			}
-			else if(xmlStrEqual(cur_node->name, (xmlChar*) "objects"))
-			{
-				processObjects(cur_node->children);
-			}
-			else
-			{
-				processElements(cur_node->children);
-			}
-		}
-	}
-}
-
-void Parser::processObjects(xmlNode * a_node)
-{
-	FILE* fp;
-	std::string fileName;
-	xmlNode *cur_node = NULL;
-
-	const IGeometryCreator *geo;
-
-    geo=getGui()->getSceneManager()->getGeometryCreator();
-
-	for (cur_node = a_node; cur_node; cur_node = cur_node->next)
-	{
-		if(xmlStrEqual(cur_node->name, (xmlChar*) "mesh"))
-		{
-			fileName=this->media_path;
-			fp = NULL;
-			fp = fopen( fileName.append((char*)xmlGetProp(cur_node,(xmlChar*)"model")).c_str(), "rb" );
-			if(fp!=NULL){
-				GenericObject* object = new GenericObject(parent,"Object", getSceneManager());
-				object->setMesh(getGui()->getMesh((char*)xmlGetProp(cur_node,(xmlChar*)"model")));
-				object->setPosition(getMeshVect(cur_node->children,(xmlChar*)"position"));
-				object->setRotation(getMeshVect(cur_node->children,(xmlChar*)"rotation"));
-				object->setScale(getMeshVect(cur_node->children,(xmlChar*)"scale"));
-				object->render();
-			}else{
-				Err("FATAL ERROR : File %s doesn't exist !\r\n",(char*)xmlGetProp(cur_node,(xmlChar*)"model"));
-			}
-		}else if(xmlStrEqual(cur_node->name, (xmlChar*) "cylinder")){
-            GenericObject* object = new GenericObject(parent,"Object", getSceneManager());
-            object->setMesh(geo->createCylinderMesh(ToIrrlichtScale(atof((char*)xmlGetProp(cur_node,(xmlChar*)"radius"))),
-                                                    ToIrrlichtScale(atof((char*)xmlGetProp(cur_node,(xmlChar*)"length"))),
-                                                    atof((char*)xmlGetProp(cur_node,(xmlChar*)"tesselation")),
-                                                    SColor(100, 255, 100, 100)));
-            object->setPosition(getMeshVect(cur_node->children,(xmlChar*)"position"));
-            object->setRotation(getMeshVect(cur_node->children,(xmlChar*)"rotation"));
-            object->setScale(getMeshVect(cur_node->children,(xmlChar*)"scale"));
-            //object->setMaterialTexture(0,getTexture("/home/apeiron/igep/uav_dev_svn/trunk/media/nskinbl.jpg"));
-		    object->setMaterialType( video::EMT_SOLID );
-		    object->render();
-		}else if(xmlStrEqual(cur_node->name, (xmlChar*) "eight")){
-            GenericObject* object = new GenericObject(parent,"Object", getSceneManager());
-            object->setMesh(geo->createCubeMesh(vector3df(atof((char*)xmlGetProp(cur_node,(xmlChar*)"length")),atof((char*)xmlGetProp(cur_node,(xmlChar*)"width")),atof((char*)xmlGetProp(cur_node,(xmlChar*)"eight")))));
-            object->setPosition(getMeshVect(cur_node->children,(xmlChar*)"position"));
-            object->setRotation(getMeshVect(cur_node->children,(xmlChar*)"rotation"));
-            object->setScale(getMeshVect(cur_node->children,(xmlChar*)"scale"));
-		    object->setMaterialType( video::EMT_TRANSPARENT_ALPHA_CHANNEL );
-		    //object->getMaterial(0).Textures[0] = getTexture("/home/apeiron/igep/uav_dev_svn/trunk/media/nskinbl.jpg");
-		    object->setMaterialFlag(EMF_LIGHTING, false);
-		    object->render();
-	}
-	}
-}
-
-void Parser::processParams(xmlNode * a_node)
-{
-
-	xmlNode *cur_node = NULL;
-	for (cur_node = a_node; cur_node; cur_node = cur_node->next)
-	{
-		if(xmlStrEqual(cur_node->name, (xmlChar*) "archive"))
-		{
-			std::string file=media_path + "/" + (char*)xmlGetProp(cur_node,(xmlChar*)"path");
-			getDevice()->getFileSystem()->addFileArchive(file.c_str());
-		}
-		else if(xmlStrEqual(cur_node->name, (xmlChar*) "mesh"))
-		{
-			setMesh((char*)xmlGetProp(cur_node,(xmlChar*)"model"),getSceneVect(cur_node->children,(xmlChar*)"position"),getSceneVect(cur_node->children,(xmlChar*)"rotation"),getSceneVect(cur_node->children,(xmlChar*)"scale",true));
-
-		}
-	}
-}
-//todo rendre un vector3D framework
-//retirer irr::core::vector3df ToIrrlichtCoordinates(irr::core::vector3df vect);
-vector3df Parser::getMeshVect(xmlNode * mesh_node, xmlChar * param)
-{
-	xmlNode *cur_node = NULL;
-	for (cur_node = mesh_node; cur_node; cur_node = cur_node->next)
-	{
-		if(xmlStrEqual(cur_node->name, param)){
-			return vector3df(atof((char*)xmlGetProp(cur_node,(xmlChar*)"x")),atof((char*)xmlGetProp(cur_node,(xmlChar*)"y")),atof((char*)xmlGetProp(cur_node,(xmlChar*)"z")));
-		}
-	}
-	return vector3df(0,0,0);
-}
-
-vector3df Parser::getSceneVect(xmlNode * mesh_node, xmlChar * param, bool isScale)
-{
-	xmlNode *cur_node = NULL;
-	for (cur_node = mesh_node; cur_node; cur_node = cur_node->next)
-	{
-		if(xmlStrEqual(cur_node->name, param)){
-			if(isScale){
-				return vector3df(atof((char*)xmlGetProp(cur_node,(xmlChar*)"x")),atof((char*)xmlGetProp(cur_node,(xmlChar*)"z")),atof((char*)xmlGetProp(cur_node,(xmlChar*)"y")));
-			}
-			return vector3df(atof((char*)xmlGetProp(cur_node,(xmlChar*)"x")),-atof((char*)xmlGetProp(cur_node,(xmlChar*)"z")),atof((char*)xmlGetProp(cur_node,(xmlChar*)"y")));
-		}
-	}
-	return vector3df(0,0,0);
+void Parser::processElements(xmlNode *a_node) {
+  xmlNode *cur_node = NULL;
+  for (cur_node = a_node; cur_node; cur_node = cur_node->next) {
+    if (cur_node->type == XML_ELEMENT_NODE) {
+      if (xmlStrEqual(cur_node->name, (xmlChar *)"params")) {
+        processParams(cur_node->children);
+      } else if (xmlStrEqual(cur_node->name, (xmlChar *)"objects")) {
+        processObjects(cur_node->children);
+      } else {
+        processElements(cur_node->children);
+      }
+    }
+  }
+}
+
+void Parser::processObjects(xmlNode *a_node) {
+  FILE *fp;
+  std::string fileName;
+  xmlNode *cur_node = NULL;
+
+  const IGeometryCreator *geo;
+
+  geo = getGui()->getSceneManager()->getGeometryCreator();
+
+  for (cur_node = a_node; cur_node; cur_node = cur_node->next) {
+    if (xmlStrEqual(cur_node->name, (xmlChar *)"mesh")) {
+      fileName = this->media_path;
+      fp = NULL;
+      fp = fopen(fileName.append((char *)xmlGetProp(
+                                     cur_node, (xmlChar *)"model")).c_str(),
+                 "rb");
+      if (fp != NULL) {
+        GenericObject *object =
+            new GenericObject(parent, "Object", getSceneManager());
+        object->setMesh(getGui()->getMesh(
+            (char *)xmlGetProp(cur_node, (xmlChar *)"model")));
+        object->setPosition(
+            getMeshVect(cur_node->children, (xmlChar *)"position"));
+        object->setRotation(
+            getMeshVect(cur_node->children, (xmlChar *)"rotation"));
+        object->setScale(getMeshVect(cur_node->children, (xmlChar *)"scale"));
+        object->render();
+      } else {
+        Err("FATAL ERROR : File %s doesn't exist !\r\n",
+            (char *)xmlGetProp(cur_node, (xmlChar *)"model"));
+      }
+    } else if (xmlStrEqual(cur_node->name, (xmlChar *)"cylinder")) {
+      GenericObject *object =
+          new GenericObject(parent, "Object", getSceneManager());
+      object->setMesh(geo->createCylinderMesh(
+          ToIrrlichtScale(
+              atof((char *)xmlGetProp(cur_node, (xmlChar *)"radius"))),
+          ToIrrlichtScale(
+              atof((char *)xmlGetProp(cur_node, (xmlChar *)"length"))),
+          atof((char *)xmlGetProp(cur_node, (xmlChar *)"tesselation")),
+          SColor(100, 255, 100, 100)));
+      object->setPosition(
+          getMeshVect(cur_node->children, (xmlChar *)"position"));
+      object->setRotation(
+          getMeshVect(cur_node->children, (xmlChar *)"rotation"));
+      object->setScale(getMeshVect(cur_node->children, (xmlChar *)"scale"));
+      // object->setMaterialTexture(0,getTexture("/home/apeiron/igep/uav_dev_svn/trunk/media/nskinbl.jpg"));
+      object->setMaterialType(video::EMT_SOLID);
+      object->render();
+    } else if (xmlStrEqual(cur_node->name, (xmlChar *)"eight")) {
+      GenericObject *object =
+          new GenericObject(parent, "Object", getSceneManager());
+      object->setMesh(geo->createCubeMesh(
+          vector3df(atof((char *)xmlGetProp(cur_node, (xmlChar *)"length")),
+                    atof((char *)xmlGetProp(cur_node, (xmlChar *)"width")),
+                    atof((char *)xmlGetProp(cur_node, (xmlChar *)"eight")))));
+      object->setPosition(
+          getMeshVect(cur_node->children, (xmlChar *)"position"));
+      object->setRotation(
+          getMeshVect(cur_node->children, (xmlChar *)"rotation"));
+      object->setScale(getMeshVect(cur_node->children, (xmlChar *)"scale"));
+      object->setMaterialType(video::EMT_TRANSPARENT_ALPHA_CHANNEL);
+      // object->getMaterial(0).Textures[0] =
+      // getTexture("/home/apeiron/igep/uav_dev_svn/trunk/media/nskinbl.jpg");
+      object->setMaterialFlag(EMF_LIGHTING, false);
+      object->render();
+    }
+  }
+}
+
+void Parser::processParams(xmlNode *a_node) {
+
+  xmlNode *cur_node = NULL;
+  for (cur_node = a_node; cur_node; cur_node = cur_node->next) {
+    if (xmlStrEqual(cur_node->name, (xmlChar *)"archive")) {
+      std::string file =
+          media_path + "/" + (char *)xmlGetProp(cur_node, (xmlChar *)"path");
+      getDevice()->getFileSystem()->addFileArchive(file.c_str());
+    } else if (xmlStrEqual(cur_node->name, (xmlChar *)"mesh")) {
+      setMesh((char *)xmlGetProp(cur_node, (xmlChar *)"model"),
+              getSceneVect(cur_node->children, (xmlChar *)"position"),
+              getSceneVect(cur_node->children, (xmlChar *)"rotation"),
+              getSceneVect(cur_node->children, (xmlChar *)"scale", true));
+    }
+  }
+}
+// todo rendre un vector3D framework
+// retirer irr::core::vector3df ToIrrlichtCoordinates(irr::core::vector3df
+// vect);
+vector3df Parser::getMeshVect(xmlNode *mesh_node, xmlChar *param) {
+  xmlNode *cur_node = NULL;
+  for (cur_node = mesh_node; cur_node; cur_node = cur_node->next) {
+    if (xmlStrEqual(cur_node->name, param)) {
+      return vector3df(atof((char *)xmlGetProp(cur_node, (xmlChar *)"x")),
+                       atof((char *)xmlGetProp(cur_node, (xmlChar *)"y")),
+                       atof((char *)xmlGetProp(cur_node, (xmlChar *)"z")));
+    }
+  }
+  return vector3df(0, 0, 0);
+}
+
+vector3df Parser::getSceneVect(xmlNode *mesh_node, xmlChar *param,
+                               bool isScale) {
+  xmlNode *cur_node = NULL;
+  for (cur_node = mesh_node; cur_node; cur_node = cur_node->next) {
+    if (xmlStrEqual(cur_node->name, param)) {
+      if (isScale) {
+        return vector3df(atof((char *)xmlGetProp(cur_node, (xmlChar *)"x")),
+                         atof((char *)xmlGetProp(cur_node, (xmlChar *)"z")),
+                         atof((char *)xmlGetProp(cur_node, (xmlChar *)"y")));
+      }
+      return vector3df(atof((char *)xmlGetProp(cur_node, (xmlChar *)"x")),
+                       -atof((char *)xmlGetProp(cur_node, (xmlChar *)"z")),
+                       atof((char *)xmlGetProp(cur_node, (xmlChar *)"y")));
+    }
+  }
+  return vector3df(0, 0, 0);
 }
 
 } // end namespace simulator
 } // end namespace flair
-#endif //GL
+#endif // GL
Index: trunk/lib/FlairSimulator/src/Parser.h
===================================================================
--- trunk/lib/FlairSimulator/src/Parser.h	(revision 14)
+++ trunk/lib/FlairSimulator/src/Parser.h	(revision 15)
@@ -22,29 +22,27 @@
 #include <libxml/tree.h>
 
-namespace flair
-{
-namespace simulator
-{
-class Parser:public Gui
-{
+namespace flair {
+namespace simulator {
+class Parser : public Gui {
 
-/*can create:
-- cylinders: in y axis
+  /*can create:
+  - cylinders: in y axis
 
-*/
-    public:
-        Parser(Simulator* parent,int app_width, int app_height,int scene_width, int scene_height,std::string media_path, std::string xmlFile);
-        ~Parser();
+  */
+public:
+  Parser(Simulator *parent, int app_width, int app_height, int scene_width,
+         int scene_height, std::string media_path, std::string xmlFile);
+  ~Parser();
 
-
-    private:
-        xmlDoc *doc;
-        std::string media_path;
-        Simulator* parent;
-        void processElements(xmlNode * a_node);
-        void processObjects(xmlNode * a_node);
-        void processParams(xmlNode * a_node);
-        irr::core::vector3df getMeshVect(xmlNode * mesh_node, xmlChar * param);
-        irr::core::vector3df getSceneVect(xmlNode * mesh_node, xmlChar * param, bool isScale=false);
+private:
+  xmlDoc *doc;
+  std::string media_path;
+  Simulator *parent;
+  void processElements(xmlNode *a_node);
+  void processObjects(xmlNode *a_node);
+  void processParams(xmlNode *a_node);
+  irr::core::vector3df getMeshVect(xmlNode *mesh_node, xmlChar *param);
+  irr::core::vector3df getSceneVect(xmlNode *mesh_node, xmlChar *param,
+                                    bool isScale = false);
 };
 }
Index: trunk/lib/FlairSimulator/src/SensorGL.cpp
===================================================================
--- trunk/lib/FlairSimulator/src/SensorGL.cpp	(revision 14)
+++ trunk/lib/FlairSimulator/src/SensorGL.cpp	(revision 15)
@@ -25,28 +25,17 @@
 using namespace flair::simulator;
 
-namespace flair
-{
-namespace sensor
-{
+namespace flair {
+namespace sensor {
 
-SensorGL::SensorGL(const Model *parent)
-{
-    collMan =getGui()->getSceneManager()->getSceneCollisionManager();
-    node=parent->Model::pimpl_;
+SensorGL::SensorGL(const Model *parent) {
+  collMan = getGui()->getSceneManager()->getSceneCollisionManager();
+  node = parent->Model::pimpl_;
 }
 
-SensorGL::~SensorGL()
-{
-}
+SensorGL::~SensorGL() {}
 
-ISceneCollisionManager* SensorGL::CollMan(void) const
-{
-    return collMan;
-}
+ISceneCollisionManager *SensorGL::CollMan(void) const { return collMan; }
 
-ISceneNode* SensorGL::Node(void) const
-{
-    return node;
-}
+ISceneNode *SensorGL::Node(void) const { return node; }
 
 } // end namespace simulator
Index: trunk/lib/FlairSimulator/src/SensorGL.h
===================================================================
--- trunk/lib/FlairSimulator/src/SensorGL.h	(revision 14)
+++ trunk/lib/FlairSimulator/src/SensorGL.h	(revision 15)
@@ -18,42 +18,35 @@
 #define SENSORGL_H
 
-namespace irr
-{
-    namespace scene
-    {
-        class ISceneNode;
-        class ISceneCollisionManager;
-    }
+namespace irr {
+namespace scene {
+class ISceneNode;
+class ISceneCollisionManager;
+}
 }
 
-namespace flair
-{
-    namespace simulator
-    {
-        class Model;
-    }
+namespace flair {
+namespace simulator {
+class Model;
+}
 }
 
-namespace flair
-{
-namespace sensor
-{
-    class SensorGL
-    {
-        public:
-            SensorGL(const simulator::Model *parent);
-            virtual ~SensorGL()=0;
+namespace flair {
+namespace sensor {
+class SensorGL {
+public:
+  SensorGL(const simulator::Model *parent);
+  virtual ~SensorGL() = 0;
 
-        protected:
-    #ifdef GL
-            irr::scene::ISceneCollisionManager* CollMan(void) const;
-            irr::scene::ISceneNode* Node(void) const;
-    #endif
-        private:
-    #ifdef GL
-            irr::scene::ISceneCollisionManager* collMan;
-            irr::scene::ISceneNode* node;
-    #endif
-    };
+protected:
+#ifdef GL
+  irr::scene::ISceneCollisionManager *CollMan(void) const;
+  irr::scene::ISceneNode *Node(void) const;
+#endif
+private:
+#ifdef GL
+  irr::scene::ISceneCollisionManager *collMan;
+  irr::scene::ISceneNode *node;
+#endif
+};
 } // end namespace sensor
 } // end namespace flair
Index: trunk/lib/FlairSimulator/src/SimuCameraGL.cpp
===================================================================
--- trunk/lib/FlairSimulator/src/SimuCameraGL.cpp	(revision 14)
+++ trunk/lib/FlairSimulator/src/SimuCameraGL.cpp	(revision 15)
@@ -41,201 +41,190 @@
 using namespace flair::simulator;
 
-namespace flair
-{
-namespace sensor
-{
-
-SimuCameraGL::SimuCameraGL(const Model* parent,std::string name,int width,int height,int x,int y,int dev_id) :SimuCamera(parent,name,width,height,3,dev_id),SensorGL(parent)
-{
-    smgr=getGui()->getSceneManager();
-    camera=smgr->addCameraSceneNode();
-    camera->addAnimator(this);
-    camera->setAspectRatio(4.0f/3.0f);//on force a cause du view port
-
-    this->width=width;
-    this->height=height;
-    this->x=x;
-    this->y=y;
-
-    index = 0;
-
-    buffer=(char*)malloc(width*height*3);
-
-    //user interface
-    Tab* setup_tab=new Tab(parent->GetTabWidget(),name);
-        position=new Vector3DSpinBox(setup_tab->NewRow(),"position",-2,2,.01);
-        direction=new Vector3DSpinBox(setup_tab->NewRow(),"direction",-2,2,.01);
-        up=new Vector3DSpinBox(setup_tab->NewRow(),"up",-2,2,.01);
-        fov=new DoubleSpinBox(setup_tab->NewRow(),"fov:",0,180,5);
-
-    if(strcmp((char*)glGetString(GL_VENDOR),"Intel Open Source Technology Center")==0) {
-        Thread::Warn("disabling cameras output for Intel card (bug with PBO)\n");
-        disable_output=true;
-    } else {
-        disable_output=false;
+namespace flair {
+namespace sensor {
+
+SimuCameraGL::SimuCameraGL(const Model *parent, std::string name, int width,
+                           int height, int x, int y, int dev_id)
+    : SimuCamera(parent, name, width, height, 3, dev_id), SensorGL(parent) {
+  smgr = getGui()->getSceneManager();
+  camera = smgr->addCameraSceneNode();
+  camera->addAnimator(this);
+  camera->setAspectRatio(4.0f / 3.0f); // on force a cause du view port
+
+  this->width = width;
+  this->height = height;
+  this->x = x;
+  this->y = y;
+
+  index = 0;
+
+  buffer = (char *)malloc(width * height * 3);
+
+  // user interface
+  Tab *setup_tab = new Tab(parent->GetTabWidget(), name);
+  position = new Vector3DSpinBox(setup_tab->NewRow(), "position", -2, 2, .01);
+  direction = new Vector3DSpinBox(setup_tab->NewRow(), "direction", -2, 2, .01);
+  up = new Vector3DSpinBox(setup_tab->NewRow(), "up", -2, 2, .01);
+  fov = new DoubleSpinBox(setup_tab->NewRow(), "fov:", 0, 180, 5);
+
+  if (strcmp((char *)glGetString(GL_VENDOR),
+             "Intel Open Source Technology Center") == 0) {
+    Thread::Warn("disabling cameras output for Intel card (bug with PBO)\n");
+    disable_output = true;
+  } else {
+    disable_output = false;
+  }
+
+  if (isGlExtensionSupported("GL_ARB_pixel_buffer_object")) {
+    use_pbo = true;
+    // create 2 pixel buffer objects, you need to delete them when program
+    // exits.
+    // glBufferDataARB with NULL pointer reserves only memory space.
+    pboIds = (GLuint *)malloc(PBO_COUNT * sizeof(GLuint));
+    glGenBuffersARB(PBO_COUNT, pboIds);
+    glBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, pboIds[0]);
+    glBufferDataARB(GL_PIXEL_PACK_BUFFER_ARB, width * height * 3, 0,
+                    GL_STREAM_READ_ARB);
+    glBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, pboIds[1]);
+    glBufferDataARB(GL_PIXEL_PACK_BUFFER_ARB, width * height * 3, 0,
+                    GL_STREAM_READ_ARB);
+
+    glBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, 0);
+  } else {
+    use_pbo = false;
+    Thread::Warn("GL_ARB_pixel_buffer_object is not suppoorted\n");
+  }
+  if (isGlExtensionSupported("GL_PACK_INVERT_MESA")) {
+    invert_pixel = false;
+    Thread::Warn("GL_PACK_INVERT_MESA is suppoorted\n");
+  } else {
+    invert_pixel = true;
+  }
+}
+
+SimuCameraGL::~SimuCameraGL() {
+  free(buffer);
+
+  if (use_pbo) {
+    glDeleteBuffersARB(PBO_COUNT, pboIds);
+    free(pboIds);
+  }
+}
+
+void SimuCameraGL::setNearValue(float zn) { camera->setNearValue(zn); }
+
+void SimuCameraGL::setFarValue(float zf) { camera->setFarValue(zf); }
+
+void SimuCameraGL::UpdateFrom(const io_data *data) {
+  if (noGui() == false && data == NULL) {
+    smgr->setActiveCamera(camera);
+    smgr->getVideoDriver()->setViewPort(rect<s32>(x, y, x + width, y + height));
+    smgr->drawAll();
+    // use_pbo=false;
+    getImage();
+  }
+}
+
+void SimuCameraGL::getImage(void) {
+  if (disable_output)
+    return;
+  // convert from irrlicht top left origin to gl bottom left origin
+  int y = smgr->getVideoDriver()->getScreenSize().Height - height - this->y;
+
+  // We want to read the front buffer to get the latest render finished.
+  Time a = GetTime();
+  glReadBuffer(GL_FRONT);
+  if (use_pbo) // with PBO
+  {
+    // increment current index first then get the next index
+    // "index" is used to read pixels from a framebuffer to a PBO
+    // "nextIndex" is used to process pixels in the other PBO
+    index = (index + 1) % PBO_COUNT;
+    int nextIndex = (index + 1) % PBO_COUNT;
+
+    // copy pixels from framebuffer to PBO
+    // Use offset instead of pointer.
+    // OpenGL should perform asynch DMA transfer, so glReadPixels() will return
+    // immediately.
+    glBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, pboIds[index]);
+    glReadPixels(x, y, width, height, GL_BGR, GL_UNSIGNED_BYTE, 0);
+
+    // map the PBO that contain framebuffer pixels before processing it
+    glBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, pboIds[nextIndex]);
+    GLubyte *src = (GLubyte *)glMapBufferARB(
+        GL_PIXEL_PACK_BUFFER_ARB, GL_READ_WRITE_ARB); // GL_READ_ONLY_ARB);
+    if (src) {
+      putImage((char *)src);
+      glUnmapBufferARB(
+          GL_PIXEL_PACK_BUFFER_ARB); // release pointer to the mapped buffer
     }
-
-    if(isGlExtensionSupported("GL_ARB_pixel_buffer_object"))
-    {
-        use_pbo=true;
-         // create 2 pixel buffer objects, you need to delete them when program exits.
-        // glBufferDataARB with NULL pointer reserves only memory space.
-        pboIds=(GLuint*)malloc(PBO_COUNT*sizeof(GLuint));
-        glGenBuffersARB(PBO_COUNT, pboIds);
-        glBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, pboIds[0]);
-        glBufferDataARB(GL_PIXEL_PACK_BUFFER_ARB, width*height*3, 0, GL_STREAM_READ_ARB);
-        glBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, pboIds[1]);
-        glBufferDataARB(GL_PIXEL_PACK_BUFFER_ARB, width*height*3, 0, GL_STREAM_READ_ARB);
-
-        glBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, 0);
+    glBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, 0);
+  } else {
+    glReadPixels(x, y, width, height, GL_BGR, GL_UNSIGNED_BYTE, buffer);
+    putImage(buffer);
+  }
+
+  glReadBuffer(GL_BACK);
+  Time b = GetTime();
+  Time c = b - a;
+  // printf("%s %f\n",Thread::ObjectName().c_str(),(float)(c/1000000.));
+}
+
+void SimuCameraGL::putImage(char *buf) {
+  if (invert_pixel == true) {
+    // opengl images are horizontally flipped, so we have to fix that here.
+    const s32 pitch = width * 3;
+    char *pixels = buf;
+    char *p2 = pixels + (height - 1) * pitch;
+    char *tmpBuffer = new char[pitch];
+    for (int i = 0; i < height; i += 2) {
+      memcpy(tmpBuffer, pixels, pitch);
+      memcpy(pixels, p2, pitch);
+      memcpy(p2, tmpBuffer, pitch);
+      pixels += pitch;
+      p2 -= pitch;
     }
-    else
-    {
-        use_pbo=false;
-        Thread::Warn("GL_ARB_pixel_buffer_object is not suppoorted\n");
-    }
-    if(isGlExtensionSupported("GL_PACK_INVERT_MESA"))
-    {
-        invert_pixel=false;
-        Thread::Warn("GL_PACK_INVERT_MESA is suppoorted\n");
-    }
-    else
-    {
-        invert_pixel=true;
-    }
-}
-
-SimuCameraGL::~SimuCameraGL()
-{
-    free(buffer);
-
-    if(use_pbo)
-    {
-        glDeleteBuffersARB(PBO_COUNT, pboIds);
-        free(pboIds);
-    }
-}
-
-void SimuCameraGL::setNearValue(float zn) {
-    camera->setNearValue(zn);
-}
-
-
-void SimuCameraGL::setFarValue(float zf) {
-    camera->setFarValue(zf);
-}
-
-
-void SimuCameraGL::UpdateFrom(const io_data *data)
-{
-    if(noGui()==false && data==NULL)
-    {
-        smgr->setActiveCamera(camera);
-        smgr->getVideoDriver()->setViewPort(rect<s32>(x,y,x+width,y+height));
-        smgr->drawAll();
-        //use_pbo=false;
-        getImage();
-    }
-}
-
-void SimuCameraGL::getImage(void)
-{
-    if(disable_output) return;
-    //convert from irrlicht top left origin to gl bottom left origin
-    int y=smgr->getVideoDriver()->getScreenSize().Height-height-this->y;
-
-	// We want to read the front buffer to get the latest render finished.
-	Time a=GetTime();
-	glReadBuffer(GL_FRONT);
-	if(use_pbo) // with PBO
-    {
-        // increment current index first then get the next index
-        // "index" is used to read pixels from a framebuffer to a PBO
-        // "nextIndex" is used to process pixels in the other PBO
-        index = (index + 1) % PBO_COUNT;
-        int nextIndex = (index + 1) % PBO_COUNT;
-
-        // copy pixels from framebuffer to PBO
-        // Use offset instead of pointer.
-        // OpenGL should perform asynch DMA transfer, so glReadPixels() will return immediately.
-        glBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, pboIds[index]);
-        glReadPixels(x,y,width,height, GL_BGR, GL_UNSIGNED_BYTE, 0);
-
-        // map the PBO that contain framebuffer pixels before processing it
-        glBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, pboIds[nextIndex]);
-        GLubyte* src = (GLubyte*)glMapBufferARB(GL_PIXEL_PACK_BUFFER_ARB,GL_READ_WRITE_ARB);//GL_READ_ONLY_ARB);
-        if(src)
-        {
-            putImage((char*)src);
-            glUnmapBufferARB(GL_PIXEL_PACK_BUFFER_ARB);     // release pointer to the mapped buffer
-        }
-        glBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, 0);
-    }
-    else
-    {
-        glReadPixels(x,y,width,height, GL_BGR, GL_UNSIGNED_BYTE, buffer);
-        putImage(buffer);
-    }
-
-	glReadBuffer(GL_BACK);
-	Time b=GetTime();
-	Time c=b-a;
-	//printf("%s %f\n",Thread::ObjectName().c_str(),(float)(c/1000000.));
-}
-
-void SimuCameraGL::putImage(char* buf)
-{
-    if(invert_pixel==true)
-    {
-        // opengl images are horizontally flipped, so we have to fix that here.
-        const s32 pitch=width*3;
-        char* pixels = buf;
-        char* p2 = pixels + (height - 1) * pitch;
-        char* tmpBuffer = new char[pitch];
-        for (int i=0; i < height; i += 2)
-        {
-            memcpy(tmpBuffer, pixels, pitch);
-            memcpy(pixels, p2, pitch);
-            memcpy(p2, tmpBuffer, pitch);
-            pixels += pitch;
-            p2 -= pitch;
-        }
-        delete [] tmpBuffer;
-    }
-
-    shmem->Write(buf,width*height*3);
-}
-
-void SimuCameraGL::animateNode(ISceneNode* node, u32 timeMs)
-{
-    ICameraSceneNode* camera = static_cast<ICameraSceneNode*>(node);
-
-    matrix4 m;
-    m.setRotationDegrees(Node()->getRotation());
-
-    // transform forward vector of camera
-    vector3df frv =ToIrrlichtCoordinates(direction->Value());
-    m.transformVect(frv);
-
-    // transform upvector of camera
-    vector3df upv =ToIrrlichtCoordinates(up->Value());
-    m.transformVect(upv);
-
-    // transform camera offset (thanks to Zeuss for finding it was missing)
-    vector3df offset = ToIrrlichtCoordinates(position->Value());
-    m.transformVect(offset);
-
-    // set camera
-    camera->setPosition(Node()->getPosition() + offset); //position camera in front of the ship
-    camera->setUpVector(upv); //set up vector of camera >> Zeuss - tested with +node->getPostion() and it didnt work, but this works fine.
-    camera->setTarget(Node()->getPosition() + offset+frv); //set target of camera (look at point) >> Zeuss - Dont forget to add the node positiob
-
-    camera->setFOV(Euler::ToRadian(fov->Value()));
-}
-
-ISceneNodeAnimator* SimuCameraGL::createClone(ISceneNode* node,
-            ISceneManager* newManager)
-{
-    return NULL;
+    delete[] tmpBuffer;
+  }
+
+  shmem->Write(buf, width * height * 3);
+}
+
+void SimuCameraGL::animateNode(ISceneNode *node, u32 timeMs) {
+  ICameraSceneNode *camera = static_cast<ICameraSceneNode *>(node);
+
+  matrix4 m;
+  m.setRotationDegrees(Node()->getRotation());
+
+  // transform forward vector of camera
+  vector3df frv = ToIrrlichtCoordinates(direction->Value());
+  m.transformVect(frv);
+
+  // transform upvector of camera
+  vector3df upv = ToIrrlichtCoordinates(up->Value());
+  m.transformVect(upv);
+
+  // transform camera offset (thanks to Zeuss for finding it was missing)
+  vector3df offset = ToIrrlichtCoordinates(position->Value());
+  m.transformVect(offset);
+
+  // set camera
+  camera->setPosition(Node()->getPosition() +
+                      offset); // position camera in front of the ship
+  camera->setUpVector(upv);    // set up vector of camera >> Zeuss - tested with
+  // +node->getPostion() and it didnt work, but this
+  // works fine.
+  camera->setTarget(Node()->getPosition() + offset + frv); // set target of
+                                                           // camera (look at
+                                                           // point) >> Zeuss -
+                                                           // Dont forget to add
+                                                           // the node positiob
+
+  camera->setFOV(Euler::ToRadian(fov->Value()));
+}
+
+ISceneNodeAnimator *SimuCameraGL::createClone(ISceneNode *node,
+                                              ISceneManager *newManager) {
+  return NULL;
 }
 
Index: trunk/lib/FlairSimulator/src/SimuCameraGL.h
===================================================================
--- trunk/lib/FlairSimulator/src/SimuCameraGL.h	(revision 14)
+++ trunk/lib/FlairSimulator/src/SimuCameraGL.h	(revision 15)
@@ -18,67 +18,64 @@
 #include <ISceneNodeAnimator.h>
 
-// in order to get function prototypes from glext.h, define GL_GLEXT_PROTOTYPES before including glext.h
+// in order to get function prototypes from glext.h, define GL_GLEXT_PROTOTYPES
+// before including glext.h
 #define GL_GLEXT_PROTOTYPES
 #include <GL/gl.h>
 
-namespace irr
-{
-    namespace scene
-    {
-        class ICameraSceneNode;
-    }
+namespace irr {
+namespace scene {
+class ICameraSceneNode;
+}
 }
 
-namespace flair
-{
-    namespace gui
-    {
-        class DoubleSpinBox;
-        class Vector3DSpinBox;
-    }
-    namespace simulator
-    {
-        class Model;
-    }
+namespace flair {
+namespace gui {
+class DoubleSpinBox;
+class Vector3DSpinBox;
+}
+namespace simulator {
+class Model;
+}
 }
 
-namespace flair
-{
-namespace sensor
-{
-    /*! \class SimuCameraGL
-    * \brief Class for a simulation camera
-    *
-    */
-    class SimuCameraGL : public SimuCamera, public SensorGL, public irr::scene::ISceneNodeAnimator
-    {
-        public:
-            //top left origin
-            SimuCameraGL(const simulator::Model* parent,std::string name,int width,int height,int x,int y,int dev_id);
-            ~SimuCameraGL();
-            //! Sets the value of the near clipping plane. (default: 1.0f)
-            /** \param zn: New z near value. */
-            void setNearValue(float zn);
+namespace flair {
+namespace sensor {
+/*! \class SimuCameraGL
+* \brief Class for a simulation camera
+*
+*/
+class SimuCameraGL : public SimuCamera,
+                     public SensorGL,
+                     public irr::scene::ISceneNodeAnimator {
+public:
+  // top left origin
+  SimuCameraGL(const simulator::Model *parent, std::string name, int width,
+               int height, int x, int y, int dev_id);
+  ~SimuCameraGL();
+  //! Sets the value of the near clipping plane. (default: 1.0f)
+  /** \param zn: New z near value. */
+  void setNearValue(float zn);
 
-            //! Sets the value of the far clipping plane (default: 2000.0f)
-            /** \param zf: New z far value. */
-            void setFarValue(float zf);
+  //! Sets the value of the far clipping plane (default: 2000.0f)
+  /** \param zf: New z far value. */
+  void setFarValue(float zf);
 
-        private:
-            void UpdateFrom(const core::io_data *data);
-            void animateNode(irr::scene::ISceneNode* node, irr::u32 timeMs);
-            ISceneNodeAnimator* createClone(irr::scene::ISceneNode* node,irr::scene::ISceneManager* newManager=0);
-            void getImage(void);
-            void putImage(char* pixels);
-            irr::scene::ICameraSceneNode* camera;
-            irr::scene::ISceneManager* smgr;
-            gui::Vector3DSpinBox *position,*direction,*up;
-            gui::DoubleSpinBox *fov;
-            int width,height,x,y;
-            char* buffer;
-            bool use_pbo,invert_pixel,disable_output;
-            GLuint *pboIds;
-            int index ;
-    };
+private:
+  void UpdateFrom(const core::io_data *data);
+  void animateNode(irr::scene::ISceneNode *node, irr::u32 timeMs);
+  ISceneNodeAnimator *createClone(irr::scene::ISceneNode *node,
+                                  irr::scene::ISceneManager *newManager = 0);
+  void getImage(void);
+  void putImage(char *pixels);
+  irr::scene::ICameraSceneNode *camera;
+  irr::scene::ISceneManager *smgr;
+  gui::Vector3DSpinBox *position, *direction, *up;
+  gui::DoubleSpinBox *fov;
+  int width, height, x, y;
+  char *buffer;
+  bool use_pbo, invert_pixel, disable_output;
+  GLuint *pboIds;
+  int index;
+};
 } // end namespace simulator
 } // end namespace flair
Index: trunk/lib/FlairSimulator/src/SimuLaserGL.cpp
===================================================================
--- trunk/lib/FlairSimulator/src/SimuLaserGL.cpp	(revision 14)
+++ trunk/lib/FlairSimulator/src/SimuLaserGL.cpp	(revision 15)
@@ -36,69 +36,60 @@
 using namespace flair::simulator;
 
-namespace flair
-{
-namespace sensor
-{
-SimuLaserGL::SimuLaserGL(const Model* parent,std::string name,int dev_id) :SimuLaser(parent,name,dev_id),SensorGL(parent)
-{
-    Tab* setup_tab=new Tab(parent->GetTabWidget(),name);
-            position=new Vector3DSpinBox(setup_tab->NewRow(),"position",-2,2,.01);
-            direction=new Vector3DSpinBox(setup_tab->NewRow(),"direction",-2,2,.01);
-            range=new DoubleSpinBox(setup_tab->NewRow(),"range:",0,30,1);
+namespace flair {
+namespace sensor {
+SimuLaserGL::SimuLaserGL(const Model *parent, std::string name, int dev_id)
+    : SimuLaser(parent, name, dev_id), SensorGL(parent) {
+  Tab *setup_tab = new Tab(parent->GetTabWidget(), name);
+  position = new Vector3DSpinBox(setup_tab->NewRow(), "position", -2, 2, .01);
+  direction = new Vector3DSpinBox(setup_tab->NewRow(), "direction", -2, 2, .01);
+  range = new DoubleSpinBox(setup_tab->NewRow(), "range:", 0, 30, 1);
 }
 
-SimuLaserGL::~SimuLaserGL()
-{
+SimuLaserGL::~SimuLaserGL() {}
 
-}
+void SimuLaserGL::UpdateFrom(const io_data *data) {
+  float value[360];
 
-void SimuLaserGL::UpdateFrom(const io_data *data)
-{
-    float value[360];
+  if (noGui() == false && data == NULL) {
+    for (int i = 0; i < 360; i++) {
+      line3d<f32> ray_laser;         // rayon provenant de l'ultra son
+      vector3df intersection_laser;  // point intersection us avec le sol
+      triangle3df hitTriangle_laser; // triangle intersection us avec le sol
 
-    if(noGui()==false && data==NULL)
-    {
-        for (int i=0; i<360; i++)
-        {
-            line3d<f32> ray_laser;//rayon provenant de l'ultra son
-            vector3df intersection_laser;//point intersection us avec le sol
-            triangle3df hitTriangle_laser;//triangle intersection us avec le sol
+      // get rotation matrix of node - Zeuss must be getRotation not
+      // getRelativeTransformation
+      matrix4 m;
+      matrix4 M;
+      m.setRotationDegrees(Node()->getRotation());
 
-             //get rotation matrix of node - Zeuss must be getRotation not getRelativeTransformation
-            matrix4 m;
-            matrix4 M;
-            m.setRotationDegrees(Node()->getRotation());
+      // Matrice de rotation pour balayage du laser, angle i
+      M.setRotationDegrees(vector3df(0, 0, i));
+      // transform forward vector of us
+      vector3df frv = ToIrrlichtCoordinates(direction->Value());
+      M.transformVect(frv);
+      m.transformVect(frv);
+      frv.normalize();
 
-            //Matrice de rotation pour balayage du laser, angle i
-            M.setRotationDegrees(vector3df(0,0,i));
-            // transform forward vector of us
-            vector3df frv =ToIrrlichtCoordinates(direction->Value());
-            M.transformVect(frv);
-            m.transformVect(frv);
-            frv.normalize();
+      // transform pos vector of us
+      vector3df pos = ToIrrlichtCoordinates(position->Value());
+      m.transformVect(pos);
 
+      ray_laser.start = Node()->getPosition() + pos;
+      ray_laser.end = ray_laser.start + ToIrrlichtScale(range->Value()) * frv;
 
-             // transform pos vector of us
-            vector3df pos =ToIrrlichtCoordinates(position->Value());
-            m.transformVect(pos);
-
-            ray_laser.start =Node()->getPosition() + pos;
-            ray_laser.end = ray_laser.start + ToIrrlichtScale(range->Value())*frv;
-
-            scene::ISceneNode * selectedSceneNode =
-                CollMan()->getSceneNodeAndCollisionPointFromRay(ray_laser,intersection_laser,hitTriangle_laser);
-    // //////////////////////////////////////////
-            if(selectedSceneNode) //
-            {
-                value[i]=ToSimulatorScale(ray_laser.start.getDistanceFrom(intersection_laser));
-            }
-            else
-            {
-                value[i]=-1;
-            }
-
-        }
-        shmem->Write((char*)value,360*sizeof(float));
+      scene::ISceneNode *selectedSceneNode =
+          CollMan()->getSceneNodeAndCollisionPointFromRay(
+              ray_laser, intersection_laser, hitTriangle_laser);
+      // //////////////////////////////////////////
+      if (selectedSceneNode) //
+      {
+        value[i] = ToSimulatorScale(
+            ray_laser.start.getDistanceFrom(intersection_laser));
+      } else {
+        value[i] = -1;
+      }
     }
+    shmem->Write((char *)value, 360 * sizeof(float));
+  }
 }
 
Index: trunk/lib/FlairSimulator/src/SimuLaserGL.h
===================================================================
--- trunk/lib/FlairSimulator/src/SimuLaserGL.h	(revision 14)
+++ trunk/lib/FlairSimulator/src/SimuLaserGL.h	(revision 15)
@@ -17,40 +17,33 @@
 #include <SensorGL.h>
 
-namespace flair
-{
-    namespace gui
-    {
-        class DoubleSpinBox;
-        class Vector3DSpinBox;
-    }
+namespace flair {
+namespace gui {
+class DoubleSpinBox;
+class Vector3DSpinBox;
+}
 }
 
-namespace flair
-{
-    namespace simulator
-    {
-        class Model;
-    }
+namespace flair {
+namespace simulator {
+class Model;
+}
 }
 
-namespace flair
-{
-namespace sensor
-{
-    /*! \class SimuUsGL
-    * \brief Class for a simulation us
-    *
-    */
-    class SimuLaserGL : public SimuLaser, public SensorGL
-    {
-        public:
-            SimuLaserGL(const simulator::Model* parent,std::string name,int dev_id);
-            ~SimuLaserGL();
+namespace flair {
+namespace sensor {
+/*! \class SimuUsGL
+* \brief Class for a simulation us
+*
+*/
+class SimuLaserGL : public SimuLaser, public SensorGL {
+public:
+  SimuLaserGL(const simulator::Model *parent, std::string name, int dev_id);
+  ~SimuLaserGL();
 
-        private:
-            void UpdateFrom(const core::io_data *data);
-            gui::DoubleSpinBox *range;
-            gui::Vector3DSpinBox *position,*direction;
-    };
+private:
+  void UpdateFrom(const core::io_data *data);
+  gui::DoubleSpinBox *range;
+  gui::Vector3DSpinBox *position, *direction;
+};
 } // end namespace sensor
 } // end namespace flair
Index: trunk/lib/FlairSimulator/src/SimuUsGL.cpp
===================================================================
--- trunk/lib/FlairSimulator/src/SimuUsGL.cpp	(revision 14)
+++ trunk/lib/FlairSimulator/src/SimuUsGL.cpp	(revision 15)
@@ -36,66 +36,60 @@
 using namespace flair::simulator;
 
-namespace flair
-{
-namespace sensor
-{
-SimuUsGL::SimuUsGL(const Model* parent,std::string name,int dev_id) :SimuUs(parent,name,dev_id),SensorGL(parent)
-{
-    Tab* setup_tab=new Tab(parent->GetTabWidget(),name);
-            position=new Vector3DSpinBox(setup_tab->NewRow(),"position",-2,2,.01);
-            direction=new Vector3DSpinBox(setup_tab->NewRow(),"direction",-2,2,.01);
-            range=new DoubleSpinBox(setup_tab->NewRow(),"range:",0,6,1);
+namespace flair {
+namespace sensor {
+SimuUsGL::SimuUsGL(const Model *parent, std::string name, int dev_id)
+    : SimuUs(parent, name, dev_id), SensorGL(parent) {
+  Tab *setup_tab = new Tab(parent->GetTabWidget(), name);
+  position = new Vector3DSpinBox(setup_tab->NewRow(), "position", -2, 2, .01);
+  direction = new Vector3DSpinBox(setup_tab->NewRow(), "direction", -2, 2, .01);
+  range = new DoubleSpinBox(setup_tab->NewRow(), "range:", 0, 6, 1);
 }
 
-SimuUsGL::~SimuUsGL()
-{
+SimuUsGL::~SimuUsGL() {}
 
-}
+void SimuUsGL::UpdateFrom(const io_data *data) {
+  float value;
+#ifdef GL
+  if (noGui() == true) {
+#endif
+    // todo: utiliser le placement de l'us dans le drone et sa portée
+    cvmatrix *input = (cvmatrix *)data;
+    value = input->Value(9, 0);
+    shmem->Write((char *)&value, sizeof(float));
+#ifdef GL
+  }
 
-void SimuUsGL::UpdateFrom(const io_data *data)
-{
-    float value;
-#ifdef GL
-    if(noGui()==true)
-    {
-#endif
-        //todo: utiliser le placement de l'us dans le drone et sa portée
-        cvmatrix *input=(cvmatrix*)data;
-        value=input->Value(9,0);
-        shmem->Write((char*)&value,sizeof(float));
-#ifdef GL
+  if (noGui() == false && data == NULL) {
+    line3d<f32> ray_us;         // rayon provenant de l'ultra son
+    vector3df intersection_us;  // point intersection us avec le sol
+    triangle3df hitTriangle_us; // triangle intersection us avec le sol
+
+    // get rotation matrix of node - Zeuss must be getRotation not
+    // getRelativeTransformation
+    matrix4 m;
+    m.setRotationDegrees(Node()->getRotation());
+
+    // transform forward vector of us
+    vector3df frv = ToIrrlichtCoordinates(direction->Value());
+    m.transformVect(frv);
+    frv.normalize();
+
+    // transform pos vector of us
+    vector3df pos = ToIrrlichtCoordinates(position->Value());
+    m.transformVect(pos);
+
+    ray_us.start = Node()->getPosition() + pos;
+    ray_us.end = ray_us.start + ToIrrlichtScale(range->Value()) * frv;
+
+    scene::ISceneNode *selectedSceneNode =
+        CollMan()->getSceneNodeAndCollisionPointFromRay(ray_us, intersection_us,
+                                                        hitTriangle_us);
+
+    if (selectedSceneNode) {
+      float value =
+          ToSimulatorScale(ray_us.start.getDistanceFrom(intersection_us));
+      shmem->Write((char *)&value, sizeof(float));
     }
-
-    if(noGui()==false && data==NULL)
-    {
-        line3d<f32> ray_us;//rayon provenant de l'ultra son
-        vector3df intersection_us;//point intersection us avec le sol
-        triangle3df hitTriangle_us;//triangle intersection us avec le sol
-
-         //get rotation matrix of node - Zeuss must be getRotation not getRelativeTransformation
-        matrix4 m;
-        m.setRotationDegrees(Node()->getRotation());
-
-        // transform forward vector of us
-        vector3df frv =ToIrrlichtCoordinates(direction->Value());
-        m.transformVect(frv);
-        frv.normalize();
-
-         // transform pos vector of us
-        vector3df pos =ToIrrlichtCoordinates(position->Value());
-        m.transformVect(pos);
-
-        ray_us.start =Node()->getPosition() +pos;
-        ray_us.end = ray_us.start + ToIrrlichtScale(range->Value())*frv;
-
-        scene::ISceneNode * selectedSceneNode =
-            CollMan()->getSceneNodeAndCollisionPointFromRay(ray_us,intersection_us,hitTriangle_us);
-
-        if(selectedSceneNode)
-        {
-            float value=ToSimulatorScale(ray_us.start.getDistanceFrom(intersection_us));
-            shmem->Write((char*)&value,sizeof(float));
-        }
-    }
+  }
 #endif
 }
Index: trunk/lib/FlairSimulator/src/SimuUsGL.h
===================================================================
--- trunk/lib/FlairSimulator/src/SimuUsGL.h	(revision 14)
+++ trunk/lib/FlairSimulator/src/SimuUsGL.h	(revision 15)
@@ -17,40 +17,33 @@
 #include <SensorGL.h>
 
-namespace flair
-{
-    namespace gui
-    {
-        class DoubleSpinBox;
-        class Vector3DSpinBox;
-    }
+namespace flair {
+namespace gui {
+class DoubleSpinBox;
+class Vector3DSpinBox;
+}
 }
 
-namespace flair
-{
-    namespace simulator
-    {
-        class Model;
-    }
+namespace flair {
+namespace simulator {
+class Model;
+}
 }
 
-namespace flair
-{
-namespace sensor
-{
-    /*! \class SimuUsGL
-    * \brief Class for a simulation us
-    *
-    */
-    class SimuUsGL : public SimuUs, public SensorGL
-    {
-        public:
-            SimuUsGL(const simulator::Model* parent,std::string name,int dev_id);
-            ~SimuUsGL();
+namespace flair {
+namespace sensor {
+/*! \class SimuUsGL
+* \brief Class for a simulation us
+*
+*/
+class SimuUsGL : public SimuUs, public SensorGL {
+public:
+  SimuUsGL(const simulator::Model *parent, std::string name, int dev_id);
+  ~SimuUsGL();
 
-        private:
-            void UpdateFrom(const core::io_data *data);
-            gui::DoubleSpinBox *range;
-            gui::Vector3DSpinBox *position,*direction;
-    };
+private:
+  void UpdateFrom(const core::io_data *data);
+  gui::DoubleSpinBox *range;
+  gui::Vector3DSpinBox *position, *direction;
+};
 } // end namespace sensor
 } // end namespace flair
Index: trunk/lib/FlairSimulator/src/Simulator.cpp
===================================================================
--- trunk/lib/FlairSimulator/src/Simulator.cpp	(revision 14)
+++ trunk/lib/FlairSimulator/src/Simulator.cpp	(revision 15)
@@ -27,57 +27,46 @@
 using namespace flair::core;
 
-namespace
-{
-    flair::simulator::Simulator* simu=NULL;
+namespace {
+flair::simulator::Simulator *simu = NULL;
 }
 
-namespace flair
-{
-namespace simulator
-{
+namespace flair {
+namespace simulator {
 
-Simulator* getSimulator(void) {
-    return simu;
+Simulator *getSimulator(void) { return simu; }
+
+Simulator::Simulator(string name, int optitrack_mstime, float yaw_deg)
+    : FrameworkManager(name) {
+  if (simu != NULL)
+    Err("Simulator should be instanced only one time\n");
+
+  pimpl_ = new Simulator_impl(this, optitrack_mstime, yaw_deg);
+  simu = this;
 }
 
-Simulator::Simulator(string name,int optitrack_mstime,float yaw_deg): FrameworkManager(name)
-{
-    if(simu!=NULL) Err("Simulator should be instanced only one time\n");
-
-    pimpl_=new Simulator_impl(this,optitrack_mstime,yaw_deg);
-    simu=this;
-}
-
-Simulator::~Simulator()
-{
-    delete pimpl_;
-}
+Simulator::~Simulator() { delete pimpl_; }
 
 Quaternion Simulator::ToVRPNReference(Quaternion quat_in) {
-    Quaternion yaw_rot_quat;
-    Euler yaw_rot_euler(0,0,-pimpl_->yaw_rad);//yaw_rad is vrpn rotation in earth reference
-    yaw_rot_euler.ToQuaternion(yaw_rot_quat);
+  Quaternion yaw_rot_quat;
+  Euler yaw_rot_euler(
+      0, 0, -pimpl_->yaw_rad); // yaw_rad is vrpn rotation in earth reference
+  yaw_rot_euler.ToQuaternion(yaw_rot_quat);
 
-    return yaw_rot_quat*quat_in;
+  return yaw_rot_quat * quat_in;
 }
 
 Vector3D Simulator::ToVRPNReference(Vector3D point_in) {
-    Quaternion yaw_rot_quat;
-    Euler yaw_rot_euler(0,0,-pimpl_->yaw_rad);//yaw_rad is vrpn rotation in earth reference
-    yaw_rot_euler.ToQuaternion(yaw_rot_quat);
-    point_in.Rotate(yaw_rot_quat);
+  Quaternion yaw_rot_quat;
+  Euler yaw_rot_euler(
+      0, 0, -pimpl_->yaw_rad); // yaw_rad is vrpn rotation in earth reference
+  yaw_rot_euler.ToQuaternion(yaw_rot_quat);
+  point_in.Rotate(yaw_rot_quat);
 
-    return point_in;
+  return point_in;
 }
 
-float Simulator::Yaw(void) const
-{
-    return pimpl_->yaw_rad;
-}
+float Simulator::Yaw(void) const { return pimpl_->yaw_rad; }
 
-void Simulator::RunSimu(void)
-{
-    pimpl_->RunSimu();
-}
+void Simulator::RunSimu(void) { pimpl_->RunSimu(); }
 
 } // end namespace simulator
Index: trunk/lib/FlairSimulator/src/Simulator.h
===================================================================
--- trunk/lib/FlairSimulator/src/Simulator.h	(revision 14)
+++ trunk/lib/FlairSimulator/src/Simulator.h	(revision 15)
@@ -24,44 +24,44 @@
 
 namespace flair {
-    namespace core {
-        class Quaternion;
-        class Vector3D;
-    }
+namespace core {
+class Quaternion;
+class Vector3D;
+}
 }
 
-namespace flair
-{
-namespace simulator
-{
-    class Model;
-    class Gui;
+namespace flair {
+namespace simulator {
+class Model;
+class Gui;
 
-    class Simulator: public core::FrameworkManager
-    {
-        friend class Model;
-        friend class Gui;
-        friend class GenericObject;
+class Simulator : public core::FrameworkManager {
+  friend class Model;
+  friend class Gui;
+  friend class GenericObject;
 
-        public:
-            //yaw_deg: rotation of the vrpn coordinate with respect to the earth coordinate, around z axis
-            Simulator(std::string name,int optitrack_mstime=10,float yaw_deg=30);
-            ~Simulator();
-            void RunSimu(void);
-            //get rotation of the vrpn coordinate with respect to the earth coordinate, around z axis; in radians
-            float Yaw(void) const;
-            //compute rotation of the vrpn coordinate with respect to the earth coordinate, around z axis
-            core::Quaternion ToVRPNReference(core::Quaternion quat_in);
-            core::Vector3D ToVRPNReference(core::Vector3D point_in);
+public:
+  // yaw_deg: rotation of the vrpn coordinate with respect to the earth
+  // coordinate, around z axis
+  Simulator(std::string name, int optitrack_mstime = 10, float yaw_deg = 30);
+  ~Simulator();
+  void RunSimu(void);
+  // get rotation of the vrpn coordinate with respect to the earth coordinate,
+  // around z axis; in radians
+  float Yaw(void) const;
+  // compute rotation of the vrpn coordinate with respect to the earth
+  // coordinate, around z axis
+  core::Quaternion ToVRPNReference(core::Quaternion quat_in);
+  core::Vector3D ToVRPNReference(core::Vector3D point_in);
 
-        private:
-            Simulator_impl* pimpl_;
-    };
+private:
+  Simulator_impl *pimpl_;
+};
 
-    /*!
-    * \brief get Simulator
-    *
-    * \return the Simulator
-    */
-    Simulator* getSimulator(void);
+/*!
+* \brief get Simulator
+*
+* \return the Simulator
+*/
+Simulator *getSimulator(void);
 
 } // end namespace simulator
Index: trunk/lib/FlairSimulator/src/Simulator_impl.cpp
===================================================================
--- trunk/lib/FlairSimulator/src/Simulator_impl.cpp	(revision 14)
+++ trunk/lib/FlairSimulator/src/Simulator_impl.cpp	(revision 15)
@@ -29,76 +29,67 @@
 using namespace flair::simulator;
 
-Simulator_impl::Simulator_impl(Simulator* self,int optitrack_mstime,float yaw_deg): vrpn_Connection_IP(), Thread(self,"simulator",1)
-{
-    this->self=self;
-    this->optitrack_mstime=optitrack_mstime;
-    yaw_rad=Euler::ToRadian(yaw_deg);
+Simulator_impl::Simulator_impl(Simulator *self, int optitrack_mstime,
+                               float yaw_deg)
+    : vrpn_Connection_IP(), Thread(self, "simulator", 1) {
+  this->self = self;
+  this->optitrack_mstime = optitrack_mstime;
+  yaw_rad = Euler::ToRadian(yaw_deg);
 }
 
-Simulator_impl::~Simulator_impl()
-{
-    //printf("del Simulator_impl\n");
+Simulator_impl::~Simulator_impl() {
+  // printf("del Simulator_impl\n");
 
-    SafeStop();
-    Join();
+  SafeStop();
+  Join();
 
-    for(size_t i=0;i<models.size();i++)
-    {
-        models.at(i)->pimpl_->SafeStop();
-        models.at(i)->pimpl_->Join();
-        delete models.at(i);
-    }
+  for (size_t i = 0; i < models.size(); i++) {
+    models.at(i)->pimpl_->SafeStop();
+    models.at(i)->pimpl_->Join();
+    delete models.at(i);
+  }
 
 #ifdef GL
-    if(getGui()!=NULL) delete getGui();
+  if (getGui() != NULL)
+    delete getGui();
 #endif
 
-     //printf("del Simulator_impl ok\n");
+  // printf("del Simulator_impl ok\n");
 }
 
-void Simulator_impl::Run(void)
-{
-    SetPeriodMS(optitrack_mstime);
+void Simulator_impl::Run(void) {
+  SetPeriodMS(optitrack_mstime);
 
-    while(ToBeStopped()==false)
-	{
-	    WaitPeriod();
-//printf("%lld\n",GetTime());
-        mainloop();
-        for(size_t i=0;i<models.size();i++)
-        {
-            models.at(i)->pimpl_->mainloop();
-        }
-	}
+  while (ToBeStopped() == false) {
+    WaitPeriod();
+    // printf("%lld\n",GetTime());
+    mainloop();
+    for (size_t i = 0; i < models.size(); i++) {
+      models.at(i)->pimpl_->mainloop();
+    }
+  }
 }
 
+void Simulator_impl::RunSimu(void) {
+  if (models.size() == 0) {
+    self->Err("No model to run\n");
+    return;
+  }
 
-void Simulator_impl::RunSimu(void)
-{
-    if(models.size()==0)
-    {
-        self->Err("No model to run\n");
-        return;
-    }
+  for (size_t i = 0; i < models.size(); i++) {
+    models.at(i)->pimpl_->Start();
+  }
 
-    for(size_t i=0;i<models.size();i++)
-    {
-        models.at(i)->pimpl_->Start();
-    }
-
-    Start();
+  Start();
 
 #ifdef GL
-    if(getGui()!=NULL)
-    {
-        getGui()->pimpl_->RunGui(models,objects);
-    }
-    else
+  if (getGui() != NULL) {
+    getGui()->pimpl_->RunGui(models, objects);
+  } else
 #endif
-    {
-        models.at(0)->pimpl_->Join();
-    }
+  {
+    models.at(0)->pimpl_->Join();
+  }
 
-    SafeStop();
-    Join();
+  SafeStop();
+  Join();
 }
Index: trunk/lib/FlairSimulator/src/X4.cpp
===================================================================
--- trunk/lib/FlairSimulator/src/X4.cpp	(revision 14)
+++ trunk/lib/FlairSimulator/src/X4.cpp	(revision 15)
@@ -31,6 +31,6 @@
 #endif
 
-#define K_MOT 0.4f //blade animation
-#define G (float)9.81 //gravity ( N/(m/s²) )
+#define K_MOT 0.4f    // blade animation
+#define G (float)9.81 // gravity ( N/(m/s²) )
 
 #ifdef GL
@@ -43,240 +43,289 @@
 using namespace flair::actuator;
 
-namespace flair
-{
-namespace simulator
-{
-
-X4::X4(const Simulator* parent,std::string name, int dev_id): Model(parent,name)
-{
-    Tab *setup_tab=new Tab(GetTabWidget(),"model");
-        m=new DoubleSpinBox(setup_tab->NewRow(),"mass (kg):",0,20,0.1);
-        arm_length=new DoubleSpinBox(setup_tab->LastRowLastCol(),"arm length (m):",0,2,0.1);
-        //l_cg=new DoubleSpinBox(setup_tab,"position G (m):",0,2,-0.5,0.5,0.02);//position du centre de gravité/centre de poussé
-        k_mot=new DoubleSpinBox(setup_tab->NewRow(),"k_mot:",0,1,0.001,3);// vitesse rotation² (unité arbitraire) -> force (N)
-        c_mot=new DoubleSpinBox(setup_tab->LastRowLastCol(),"c_mot:",0,1,0.001,3);// vitesse rotation moteur -> couple (N.m/unité arbitraire)
-        f_air_vert=new DoubleSpinBox(setup_tab->NewRow(),"f_air_vert:",0,10,1);//frottements air depl. vertical, aussi utilisé pour les rotations ( N/(m/s) ) (du aux helices en rotation)
-        f_air_lat=new DoubleSpinBox(setup_tab->LastRowLastCol(),"f_air_lat:",0,10,1);//frottements air deplacements lateraux ( N/(m/s) )
-        j_roll=new DoubleSpinBox(setup_tab->NewRow(),"j_roll:",0,1,0.001,5); //moment d'inertie d'un axe (N.m.s²/rad)
-        j_pitch=new DoubleSpinBox(setup_tab->LastRowLastCol(),"j_pitch:",0,1,0.001,5); //moment d'inertie d'un axe (N.m.s²/rad)
-        j_yaw=new DoubleSpinBox(setup_tab->LastRowLastCol(),"j_yaw:",0,1,0.001,5); //moment d'inertie d'un axe (N.m.s²/rad)
-
-    motors=new SimuBldc(this,name,4,dev_id);
-}
-
-X4::~X4()
-{
-    //les objets irrlicht seront automatiquement detruits (moteurs, helices, pales) par parenté
-}
-
-
-#ifdef GL
-
-void X4::Draw(void)
-{
-    //create unite (1m=100cm) UAV; scale will be adapted according to arm_length parameter
-    //note that the frame used is irrlicht one:
-    //left handed, North East Up
-    const IGeometryCreator *geo;
-    geo=getGui()->getSceneManager()->getGeometryCreator();
-
-    //cylinders are aligned with y axis
-    red_arm=geo->createCylinderMesh(2.5,100,16,SColor(0, 255, 0, 0));
-    black_arm=geo->createCylinderMesh(2.5,100,16,SColor(0, 128, 128, 128));
-    motor=geo->createCylinderMesh(7.5,15,16);//,SColor(0, 128, 128, 128));
-    //geo->drop();
-
-    ITexture* texture=getGui()->getTexture("carbone.jpg");
-    fl_arm=new MeshSceneNode(this, red_arm, vector3df(0,0,0),vector3df(0,0,-135));
-    fr_arm=new MeshSceneNode(this, red_arm, vector3df(0,0,0),vector3df(0,0,-45));
-    rl_arm=new MeshSceneNode(this, black_arm, vector3df(0,0,0),vector3df(0,0,135),texture);
-    rr_arm=new MeshSceneNode(this, black_arm, vector3df(0,0,0),vector3df(0,0,45),texture);
-
-    texture=getGui()->getTexture("metal047.jpg");
-    fl_motor=new MeshSceneNode(this, motor, vector3df(70.71,-70.71,2.5),vector3df(90,0,0),texture);
-    fr_motor=new MeshSceneNode(this, motor ,vector3df(70.71,70.71,2.5),vector3df(90,0,0),texture);
-    rl_motor=new MeshSceneNode(this, motor ,vector3df(-70.71,-70.71,2.5),vector3df(90,0,0),texture);
-    rr_motor=new MeshSceneNode(this, motor ,vector3df(-70.71,70.71,2.5),vector3df(90,0,0),texture);
-
-    fl_blade=new Blade(this, vector3df(70.71,-70.71,17.5));
-    fr_blade=new Blade(this, vector3df(70.71,70.71,17.5),true);
-    rl_blade=new Blade(this, vector3df(-70.71,-70.71,17.5),true);
-    rr_blade=new Blade(this, vector3df(-70.71,70.71,17.5));
-
-    motor_speed_mutex=new Mutex(this);
-    for(int i=0;i<4;i++) motor_speed[i]=0;
-    ExtraDraw();
-}
-
-void X4::AnimateModel(void)
-{
-    motor_speed_mutex->GetMutex();
-    fl_blade->SetRotationSpeed(K_MOT*motor_speed[0]);
-    fr_blade->SetRotationSpeed(-K_MOT*motor_speed[1]);
-    rl_blade->SetRotationSpeed(-K_MOT*motor_speed[2]);
-    rr_blade->SetRotationSpeed(K_MOT*motor_speed[3]);
-    motor_speed_mutex->ReleaseMutex();
-
-    //adapt UAV size
-    if(arm_length->ValueChanged()==true)
-    {
-        setScale(arm_length->Value());
-    }
-}
-
-size_t X4::dbtSize(void) const
-{
-    return 6*sizeof(float)+4*sizeof(float);//6ddl+4helices
-}
-
-void X4::WritedbtBuf(char* dbtbuf)
-{/*
-    float *buf=(float*)dbtbuf;
-    vector3df vect=getPosition();
-    memcpy(buf,&vect.X,sizeof(float));
-    buf++;
-    memcpy(buf,&vect.Y,sizeof(float));
-    buf++;
-    memcpy(buf,&vect.Z,sizeof(float));
-    buf++;
-    vect=getRotation();
-    memcpy(buf,&vect.X,sizeof(float));
-    buf++;
-    memcpy(buf,&vect.Y,sizeof(float));
-    buf++;
-    memcpy(buf,&vect.Z,sizeof(float));
-    buf++;
-    memcpy(buf,&motors,sizeof(rtsimu_motors));*/
-}
-
-void X4::ReaddbtBuf(char* dbtbuf)
-{/*
-    float *buf=(float*)dbtbuf;
-    vector3df vect;
-    memcpy(&vect.X,buf,sizeof(float));
-    buf++;
-    memcpy(&vect.Y,buf,sizeof(float));
-    buf++;
-    memcpy(&vect.Z,buf,sizeof(float));
-    buf++;
-    setPosition(vect);
-    memcpy(&vect.X,buf,sizeof(float));
-    buf++;
-    memcpy(&vect.Y,buf,sizeof(float));
-    buf++;
-    memcpy(&vect.Z,buf,sizeof(float));
-    buf++;
-    ((ISceneNode*)(this))->setRotation(vect);
-    memcpy(&motors,buf,sizeof(rtsimu_motors));
-    AnimateModele();*/
-}
-#endif //GL
-
-//states are computed on fixed frame NED
-//x north
-//y east
-//z down
-void X4::CalcModel(void)
-{
-    float fl_speed,fr_speed,rl_speed,rr_speed;
-    float u_roll,u_pitch,u_yaw,u_thrust;
-#ifdef GL
-    motor_speed_mutex->GetMutex();
-#endif //GL
-    motors->GetSpeeds(motor_speed);
-#ifdef GL
-    motor_speed_mutex->ReleaseMutex();
-#endif //GL
-	fl_speed=motor_speed[0];
-	fr_speed=motor_speed[1];
-	rl_speed=motor_speed[2];
-	rr_speed=motor_speed[3];
-
-    /*
-	** ===================================================================
-	**    u roll: roll torque
-	**
-	** ===================================================================
-	*/
-	u_roll=arm_length->Value()*k_mot->Value()*(fl_speed*fl_speed+rl_speed*rl_speed-fr_speed*fr_speed-rr_speed*rr_speed)*sqrtf(2)/2;
-
-    /// Classical Nonlinear model of a quadrotor ( This is the w_x angular speed of the quadri in the body frame). It is a discrete integrator
-	state[0].W.x=(dT()/j_roll->Value())*((j_yaw->Value()-j_pitch->Value())*state[-1].W.y*state[-1].W.z + u_roll) +state[-1].W.x;
-
-	//u_roll=arm_length->Value()*k_mot->Value()*(fl_speed*fl_speed+rl_speed*rl_speed-fr_speed*fr_speed-rr_speed*rr_speed)*sqrtf(2)/2;
-	//state[0].W.x=(dT()/j_roll->Value())*(u_roll-m->Value()*G*l_cg->Value()*sinf(state[-2].W.x)-f_air_vert->Value()*arm_length->Value()*arm_length->Value()*state[-1].W.x)+state[-1].W.x;
-
-	/*
-	** ===================================================================
-	**   u pitch : pitch torque
-	**
-	** ===================================================================
-	*/
-	u_pitch=arm_length->Value()*k_mot->Value()*(fl_speed*fl_speed+fr_speed*fr_speed-rl_speed*rl_speed-rr_speed*rr_speed)*sqrtf(2)/2;
-
-    /// Classical Nonlinear model of a quadrotor ( This is the w_y angular speed of the quadri in the body frame). It is a discrete integrator
-	state[0].W.y=(dT()/j_pitch->Value())*((j_roll->Value()-j_yaw->Value())*state[-1].W.x*state[-1].W.z + u_pitch)+state[-1].W.y;
-
-	//u_pitch=arm_length->Value()*k_mot->Value()*(fl_speed*fl_speed+fr_speed*fr_speed-rl_speed*rl_speed-rr_speed*rr_speed)*sqrtf(2)/2;
-	//state[0].W.y=(dT()/j_pitch->Value())*(u_pitch-m->Value()*G*l_cg->Value()*sinf(state[-2].W.y)-f_air_vert->Value()*arm_length->Value()*arm_length->Value()*state[-1].W.y)+state[-1].W.y;
-
-	/*
-	** ===================================================================
-	**    u yaw : yaw torque
-	**
-	** ===================================================================
-	*/
-	u_yaw=c_mot->Value()*(fl_speed*fl_speed+rr_speed*rr_speed-fr_speed*fr_speed-rl_speed*rl_speed);
-
-    /// Classical Nonlinear model of a quadrotor ( This is the w_z angular speed of the quadri in the body frame). It is a discrete integrator
-	state[0].W.z=(dT()/j_yaw->Value())* u_yaw +state[-1].W.z;
-
-	//u_yaw=c_mot->Value()*(fl_speed*fl_speed+rr_speed*rr_speed-fr_speed*fr_speed-rl_speed*rl_speed);
-	//state[0].W.z=(dT()/j_yaw->Value())*(u_yaw-f_air_lat->Value()*state[-1].W.z)+state[-1].W.z;
-
-    // compute quaternion from W
-    // Quaternion derivative: dQ = 0.5*(Q*Qw)
-    Quaternion dQ=state[-1].Quat.GetDerivative(state[0].W);
-
-    // Quaternion integration
-    state[0].Quat = state[-1].Quat +dQ*dT();
-    state[0].Quat.Normalize();
-
-    // Calculation of the thrust from the reference speed of motors
-	u_thrust=k_mot->Value()*(fl_speed*fl_speed+fr_speed*fr_speed+rl_speed*rl_speed+rr_speed*rr_speed);
-    Vector3D vect(0,0,-u_thrust);
-    vect.Rotate(state[0].Quat);
-
-    /*
-	** ===================================================================
-	**     x double integrator
-	**
-	** ===================================================================
-	*/
-	state[0].Pos.x=(dT()*dT()/m->Value())*(vect.x-f_air_lat->Value()*(state[-1].Pos.x-state[-2].Pos.x)/dT())+2*state[-1].Pos.x-state[-2].Pos.x;
-    state[0].Vel.x=(state[0].Pos.x-state[-1].Pos.x)/dT();
-
-	/*
-	** ===================================================================
-	**     y double integrator
-	**
-	** ===================================================================
-	*/
-	state[0].Pos.y=(dT()*dT()/m->Value())*(vect.y-f_air_lat->Value()*(state[-1].Pos.y-state[-2].Pos.y)/dT())+2*state[-1].Pos.y-state[-2].Pos.y;
-    state[0].Vel.y=(state[0].Pos.y-state[-1].Pos.y)/dT();
-
-	/*
-	** ===================================================================
-	**     z double integrator
-	**
-	** ===================================================================
-	*/
-	state[0].Pos.z=(dT()*dT()/m->Value())*(vect.z+f_air_vert->Value()*(state[-1].Pos.z-state[-2].Pos.z)/dT()+m->Value()*G)+2*state[-1].Pos.z-state[-2].Pos.z;
-    state[0].Vel.z=(state[0].Pos.z-state[-1].Pos.z)/dT();
+namespace flair {
+namespace simulator {
+
+X4::X4(const Simulator *parent, std::string name, int dev_id)
+    : Model(parent, name) {
+  Tab *setup_tab = new Tab(GetTabWidget(), "model");
+  m = new DoubleSpinBox(setup_tab->NewRow(), "mass (kg):", 0, 20, 0.1);
+  arm_length = new DoubleSpinBox(setup_tab->LastRowLastCol(), "arm length (m):",
+                                 0, 2, 0.1);
+  // l_cg=new DoubleSpinBox(setup_tab,"position G
+  // (m):",0,2,-0.5,0.5,0.02);//position du centre de gravité/centre de poussé
+  k_mot =
+      new DoubleSpinBox(setup_tab->NewRow(), "k_mot:", 0, 1, 0.001,
+                        3); // vitesse rotation² (unité arbitraire) -> force (N)
+  c_mot = new DoubleSpinBox(
+      setup_tab->LastRowLastCol(), "c_mot:", 0, 1, 0.001,
+      3); // vitesse rotation moteur -> couple (N.m/unité arbitraire)
+  f_air_vert = new DoubleSpinBox(setup_tab->NewRow(), "f_air_vert:", 0, 10,
+                                 1); // frottements air depl. vertical, aussi
+                                     // utilisé pour les rotations ( N/(m/s) )
+                                     // (du aux helices en rotation)
+  f_air_lat =
+      new DoubleSpinBox(setup_tab->LastRowLastCol(), "f_air_lat:", 0, 10,
+                        1); // frottements air deplacements lateraux ( N/(m/s) )
+  j_roll = new DoubleSpinBox(setup_tab->NewRow(), "j_roll:", 0, 1, 0.001,
+                             5); // moment d'inertie d'un axe (N.m.s²/rad)
+  j_pitch =
+      new DoubleSpinBox(setup_tab->LastRowLastCol(), "j_pitch:", 0, 1, 0.001,
+                        5); // moment d'inertie d'un axe (N.m.s²/rad)
+  j_yaw = new DoubleSpinBox(setup_tab->LastRowLastCol(), "j_yaw:", 0, 1, 0.001,
+                            5); // moment d'inertie d'un axe (N.m.s²/rad)
+
+  motors = new SimuBldc(this, name, 4, dev_id);
+}
+
+X4::~X4() {
+  // les objets irrlicht seront automatiquement detruits (moteurs, helices,
+  // pales) par parenté
+}
+
+#ifdef GL
+
+void X4::Draw(void) {
+  // create unite (1m=100cm) UAV; scale will be adapted according to arm_length
+  // parameter
+  // note that the frame used is irrlicht one:
+  // left handed, North East Up
+  const IGeometryCreator *geo;
+  geo = getGui()->getSceneManager()->getGeometryCreator();
+
+  // cylinders are aligned with y axis
+  red_arm = geo->createCylinderMesh(2.5, 100, 16, SColor(0, 255, 0, 0));
+  black_arm = geo->createCylinderMesh(2.5, 100, 16, SColor(0, 128, 128, 128));
+  motor = geo->createCylinderMesh(7.5, 15, 16); //,SColor(0, 128, 128, 128));
+  // geo->drop();
+
+  ITexture *texture = getGui()->getTexture("carbone.jpg");
+  fl_arm = new MeshSceneNode(this, red_arm, vector3df(0, 0, 0),
+                             vector3df(0, 0, -135));
+  fr_arm = new MeshSceneNode(this, red_arm, vector3df(0, 0, 0),
+                             vector3df(0, 0, -45));
+  rl_arm = new MeshSceneNode(this, black_arm, vector3df(0, 0, 0),
+                             vector3df(0, 0, 135), texture);
+  rr_arm = new MeshSceneNode(this, black_arm, vector3df(0, 0, 0),
+                             vector3df(0, 0, 45), texture);
+
+  texture = getGui()->getTexture("metal047.jpg");
+  fl_motor = new MeshSceneNode(this, motor, vector3df(70.71, -70.71, 2.5),
+                               vector3df(90, 0, 0), texture);
+  fr_motor = new MeshSceneNode(this, motor, vector3df(70.71, 70.71, 2.5),
+                               vector3df(90, 0, 0), texture);
+  rl_motor = new MeshSceneNode(this, motor, vector3df(-70.71, -70.71, 2.5),
+                               vector3df(90, 0, 0), texture);
+  rr_motor = new MeshSceneNode(this, motor, vector3df(-70.71, 70.71, 2.5),
+                               vector3df(90, 0, 0), texture);
+
+  fl_blade = new Blade(this, vector3df(70.71, -70.71, 17.5));
+  fr_blade = new Blade(this, vector3df(70.71, 70.71, 17.5), true);
+  rl_blade = new Blade(this, vector3df(-70.71, -70.71, 17.5), true);
+  rr_blade = new Blade(this, vector3df(-70.71, 70.71, 17.5));
+
+  motor_speed_mutex = new Mutex(this);
+  for (int i = 0; i < 4; i++)
+    motor_speed[i] = 0;
+  ExtraDraw();
+}
+
+void X4::AnimateModel(void) {
+  motor_speed_mutex->GetMutex();
+  fl_blade->SetRotationSpeed(K_MOT * motor_speed[0]);
+  fr_blade->SetRotationSpeed(-K_MOT * motor_speed[1]);
+  rl_blade->SetRotationSpeed(-K_MOT * motor_speed[2]);
+  rr_blade->SetRotationSpeed(K_MOT * motor_speed[3]);
+  motor_speed_mutex->ReleaseMutex();
+
+  // adapt UAV size
+  if (arm_length->ValueChanged() == true) {
+    setScale(arm_length->Value());
+  }
+}
+
+size_t X4::dbtSize(void) const {
+  return 6 * sizeof(float) + 4 * sizeof(float); // 6ddl+4helices
+}
+
+void X4::WritedbtBuf(
+    char *dbtbuf) { /*
+                       float *buf=(float*)dbtbuf;
+                       vector3df vect=getPosition();
+                       memcpy(buf,&vect.X,sizeof(float));
+                       buf++;
+                       memcpy(buf,&vect.Y,sizeof(float));
+                       buf++;
+                       memcpy(buf,&vect.Z,sizeof(float));
+                       buf++;
+                       vect=getRotation();
+                       memcpy(buf,&vect.X,sizeof(float));
+                       buf++;
+                       memcpy(buf,&vect.Y,sizeof(float));
+                       buf++;
+                       memcpy(buf,&vect.Z,sizeof(float));
+                       buf++;
+                       memcpy(buf,&motors,sizeof(rtsimu_motors));*/
+}
+
+void X4::ReaddbtBuf(
+    char *dbtbuf) { /*
+                       float *buf=(float*)dbtbuf;
+                       vector3df vect;
+                       memcpy(&vect.X,buf,sizeof(float));
+                       buf++;
+                       memcpy(&vect.Y,buf,sizeof(float));
+                       buf++;
+                       memcpy(&vect.Z,buf,sizeof(float));
+                       buf++;
+                       setPosition(vect);
+                       memcpy(&vect.X,buf,sizeof(float));
+                       buf++;
+                       memcpy(&vect.Y,buf,sizeof(float));
+                       buf++;
+                       memcpy(&vect.Z,buf,sizeof(float));
+                       buf++;
+                       ((ISceneNode*)(this))->setRotation(vect);
+                       memcpy(&motors,buf,sizeof(rtsimu_motors));
+                       AnimateModele();*/
+}
+#endif // GL
+
+// states are computed on fixed frame NED
+// x north
+// y east
+// z down
+void X4::CalcModel(void) {
+  float fl_speed, fr_speed, rl_speed, rr_speed;
+  float u_roll, u_pitch, u_yaw, u_thrust;
+#ifdef GL
+  motor_speed_mutex->GetMutex();
+#endif // GL
+  motors->GetSpeeds(motor_speed);
+#ifdef GL
+  motor_speed_mutex->ReleaseMutex();
+#endif // GL
+  fl_speed = motor_speed[0];
+  fr_speed = motor_speed[1];
+  rl_speed = motor_speed[2];
+  rr_speed = motor_speed[3];
+
+  /*
+      ** ===================================================================
+      **    u roll: roll torque
+      **
+      ** ===================================================================
+      */
+  u_roll = arm_length->Value() * k_mot->Value() *
+           (fl_speed * fl_speed + rl_speed * rl_speed - fr_speed * fr_speed -
+            rr_speed * rr_speed) *
+           sqrtf(2) / 2;
+
+  /// Classical Nonlinear model of a quadrotor ( This is the w_x angular speed
+  /// of the quadri in the body frame). It is a discrete integrator
+  state[0].W.x =
+      (dT() / j_roll->Value()) *
+          ((j_yaw->Value() - j_pitch->Value()) * state[-1].W.y * state[-1].W.z +
+           u_roll) +
+      state[-1].W.x;
+
+  // u_roll=arm_length->Value()*k_mot->Value()*(fl_speed*fl_speed+rl_speed*rl_speed-fr_speed*fr_speed-rr_speed*rr_speed)*sqrtf(2)/2;
+  // state[0].W.x=(dT()/j_roll->Value())*(u_roll-m->Value()*G*l_cg->Value()*sinf(state[-2].W.x)-f_air_vert->Value()*arm_length->Value()*arm_length->Value()*state[-1].W.x)+state[-1].W.x;
+
+  /*
+  ** ===================================================================
+  **   u pitch : pitch torque
+  **
+  ** ===================================================================
+  */
+  u_pitch = arm_length->Value() * k_mot->Value() *
+            (fl_speed * fl_speed + fr_speed * fr_speed - rl_speed * rl_speed -
+             rr_speed * rr_speed) *
+            sqrtf(2) / 2;
+
+  /// Classical Nonlinear model of a quadrotor ( This is the w_y angular speed
+  /// of the quadri in the body frame). It is a discrete integrator
+  state[0].W.y =
+      (dT() / j_pitch->Value()) *
+          ((j_roll->Value() - j_yaw->Value()) * state[-1].W.x * state[-1].W.z +
+           u_pitch) +
+      state[-1].W.y;
+
+  // u_pitch=arm_length->Value()*k_mot->Value()*(fl_speed*fl_speed+fr_speed*fr_speed-rl_speed*rl_speed-rr_speed*rr_speed)*sqrtf(2)/2;
+  // state[0].W.y=(dT()/j_pitch->Value())*(u_pitch-m->Value()*G*l_cg->Value()*sinf(state[-2].W.y)-f_air_vert->Value()*arm_length->Value()*arm_length->Value()*state[-1].W.y)+state[-1].W.y;
+
+  /*
+  ** ===================================================================
+  **    u yaw : yaw torque
+  **
+  ** ===================================================================
+  */
+  u_yaw = c_mot->Value() * (fl_speed * fl_speed + rr_speed * rr_speed -
+                            fr_speed * fr_speed - rl_speed * rl_speed);
+
+  /// Classical Nonlinear model of a quadrotor ( This is the w_z angular speed
+  /// of the quadri in the body frame). It is a discrete integrator
+  state[0].W.z = (dT() / j_yaw->Value()) * u_yaw + state[-1].W.z;
+
+  // u_yaw=c_mot->Value()*(fl_speed*fl_speed+rr_speed*rr_speed-fr_speed*fr_speed-rl_speed*rl_speed);
+  // state[0].W.z=(dT()/j_yaw->Value())*(u_yaw-f_air_lat->Value()*state[-1].W.z)+state[-1].W.z;
+
+  // compute quaternion from W
+  // Quaternion derivative: dQ = 0.5*(Q*Qw)
+  Quaternion dQ = state[-1].Quat.GetDerivative(state[0].W);
+
+  // Quaternion integration
+  state[0].Quat = state[-1].Quat + dQ * dT();
+  state[0].Quat.Normalize();
+
+  // Calculation of the thrust from the reference speed of motors
+  u_thrust = k_mot->Value() * (fl_speed * fl_speed + fr_speed * fr_speed +
+                               rl_speed * rl_speed + rr_speed * rr_speed);
+  Vector3D vect(0, 0, -u_thrust);
+  vect.Rotate(state[0].Quat);
+
+  /*
+      ** ===================================================================
+      **     x double integrator
+      **
+      ** ===================================================================
+      */
+  state[0].Pos.x =
+      (dT() * dT() / m->Value()) *
+          (vect.x -
+           f_air_lat->Value() * (state[-1].Pos.x - state[-2].Pos.x) / dT()) +
+      2 * state[-1].Pos.x - state[-2].Pos.x;
+  state[0].Vel.x = (state[0].Pos.x - state[-1].Pos.x) / dT();
+
+  /*
+  ** ===================================================================
+  **     y double integrator
+  **
+  ** ===================================================================
+  */
+  state[0].Pos.y =
+      (dT() * dT() / m->Value()) *
+          (vect.y -
+           f_air_lat->Value() * (state[-1].Pos.y - state[-2].Pos.y) / dT()) +
+      2 * state[-1].Pos.y - state[-2].Pos.y;
+  state[0].Vel.y = (state[0].Pos.y - state[-1].Pos.y) / dT();
+
+  /*
+  ** ===================================================================
+  **     z double integrator
+  **
+  ** ===================================================================
+  */
+  state[0].Pos.z =
+      (dT() * dT() / m->Value()) *
+          (vect.z +
+           f_air_vert->Value() * (state[-1].Pos.z - state[-2].Pos.z) / dT() +
+           m->Value() * G) +
+      2 * state[-1].Pos.z - state[-2].Pos.z;
+  state[0].Vel.z = (state[0].Pos.z - state[-1].Pos.z) / dT();
 
 #ifndef GL
-    if(state[0].Pos.z<0) state[0].Pos.z=0;
+  if (state[0].Pos.z < 0)
+    state[0].Pos.z = 0;
 #endif
-
 }
 
Index: trunk/lib/FlairSimulator/src/X4.h
===================================================================
--- trunk/lib/FlairSimulator/src/X4.h	(revision 14)
+++ trunk/lib/FlairSimulator/src/X4.h	(revision 15)
@@ -22,71 +22,62 @@
 #include <stdio.h>
 
-namespace flair
-{
-    namespace core
-    {
-        class Mutex;
-    }
-    namespace gui
-    {
-        class DoubleSpinBox;
-    }
-    namespace actuator
-    {
-        class SimuBldc;
-    }
+namespace flair {
+namespace core {
+class Mutex;
+}
+namespace gui {
+class DoubleSpinBox;
+}
+namespace actuator {
+class SimuBldc;
+}
 }
 
 #ifdef GL
-namespace irr
-{
-    namespace scene
-    {
-        class IMesh;
-    }
+namespace irr {
+namespace scene {
+class IMesh;
+}
 }
 #endif
 
-namespace flair
-{
-namespace simulator
-{
-    class Simulator;
-    class Blade;
-    class MeshSceneNode;
+namespace flair {
+namespace simulator {
+class Simulator;
+class Blade;
+class MeshSceneNode;
 
-    class X4 : public Model
-    {
-        public:
-            X4(const Simulator* parent,std::string name, int dev_id);
-            ~X4();
+class X4 : public Model {
+public:
+  X4(const Simulator *parent, std::string name, int dev_id);
+  ~X4();
 #ifdef GL
-            virtual void Draw(void);
-            virtual void ExtraDraw(void){};
+  virtual void Draw(void);
+  virtual void ExtraDraw(void){};
 
-        protected:
-                    irr::scene::IMesh *red_arm,*black_arm,*motor;
-                    MeshSceneNode *fl_arm,*fr_arm,*rl_arm,*rr_arm;
-                    MeshSceneNode *fl_motor,*fr_motor,*rl_motor,*rr_motor;
-                    Blade *fl_blade,*fr_blade,*rl_blade,*rr_blade;
-                    core::Mutex *motor_speed_mutex;
+protected:
+  irr::scene::IMesh *red_arm, *black_arm, *motor;
+  MeshSceneNode *fl_arm, *fr_arm, *rl_arm, *rr_arm;
+  MeshSceneNode *fl_motor, *fr_motor, *rl_motor, *rr_motor;
+  Blade *fl_blade, *fr_blade, *rl_blade, *rr_blade;
+  core::Mutex *motor_speed_mutex;
 #endif
-        private:
-            void CalcModel(void);
-    #ifdef GL
-            bool OnEvent(const irr::SEvent& event){};
-            void AnimateModel(void);
-            size_t dbtSize(void) const;
-            void WritedbtBuf(char* dbtbuf);
-            void ReaddbtBuf(char* dbtbuf);
-    #endif
+private:
+  void CalcModel(void);
+#ifdef GL
+  bool OnEvent(const irr::SEvent &event){};
+  void AnimateModel(void);
+  size_t dbtSize(void) const;
+  void WritedbtBuf(char *dbtbuf);
+  void ReaddbtBuf(char *dbtbuf);
+#endif
 
-            actuator::SimuBldc *motors;
-            float motor_speed[4];
-            gui::DoubleSpinBox *m,*arm_length,*l_cg;
-            gui::DoubleSpinBox *k_mot,*c_mot;
-            gui::DoubleSpinBox *f_air_vert,*f_air_lat;
-            gui::DoubleSpinBox *j_roll,*j_pitch,*j_yaw;
-    };
+  actuator::SimuBldc *motors;
+  float motor_speed[4];
+  gui::DoubleSpinBox *m, *arm_length, *l_cg;
+  gui::DoubleSpinBox *k_mot, *c_mot;
+  gui::DoubleSpinBox *f_air_vert, *f_air_lat;
+  gui::DoubleSpinBox *j_roll, *j_pitch, *j_yaw;
+};
 } // end namespace simulator
 } // end namespace flair
Index: trunk/lib/FlairSimulator/src/X8.cpp
===================================================================
--- trunk/lib/FlairSimulator/src/X8.cpp	(revision 14)
+++ trunk/lib/FlairSimulator/src/X8.cpp	(revision 15)
@@ -31,6 +31,6 @@
 #endif
 
-#define K_MOT 0.4f //blade animation
-#define G (float)9.81 //gravity ( N/(m/s²) )
+#define K_MOT 0.4f    // blade animation
+#define G (float)9.81 // gravity ( N/(m/s²) )
 
 #ifdef GL
@@ -43,280 +43,347 @@
 using namespace flair::actuator;
 
-namespace flair
-{
-namespace simulator
-{
-
-X8::X8(const Simulator* parent,std::string name, int dev_id): Model(parent,name)
-{
-    Tab *setup_tab=new Tab(GetTabWidget(),"model");
-        m=new DoubleSpinBox(setup_tab->NewRow(),"mass (kg):",0,20,0.1);
-        arm_length=new DoubleSpinBox(setup_tab->LastRowLastCol(),"arm length (m):",0,2,0.1);
-        l_cg=new DoubleSpinBox(setup_tab->LastRowLastCol(),"position G (m):",-0.5,0.5,0.02);//position du centre de gravité/centre de poussé
-        k_mot=new DoubleSpinBox(setup_tab->NewRow(),"k_mot:",0,1,0.001,3);// vitesse rotation² (unité arbitraire) -> force (N)
-        c_mot=new DoubleSpinBox(setup_tab->LastRowLastCol(),"c_mot:",0,1,0.001,3);// vitesse rotation moteur -> couple (N.m/unité arbitraire)
-        f_air_vert=new DoubleSpinBox(setup_tab->NewRow(),"f_air_vert:",0,10,1);//frottements air depl. vertical, aussi utilisé pour les rotations ( N/(m/s) ) (du aux helices en rotation)
-        f_air_lat=new DoubleSpinBox(setup_tab->LastRowLastCol(),"f_air_lat:",0,10,1);//frottements air deplacements lateraux ( N/(m/s) )
-        j_roll=new DoubleSpinBox(setup_tab->NewRow(),"j_roll:",0,1,0.001,5); //moment d'inertie d'un axe (N.m.s²/rad)
-        j_pitch=new DoubleSpinBox(setup_tab->LastRowLastCol(),"j_pitch:",0,1,0.001,5); //moment d'inertie d'un axe (N.m.s²/rad)
-        j_yaw=new DoubleSpinBox(setup_tab->LastRowLastCol(),"j_yaw:",0,1,0.001,5); //moment d'inertie d'un axe (N.m.s²/rad)
-        j_r=new DoubleSpinBox(setup_tab->NewRow(),"j_r:",0,1,0.001);// moment des helices (N.m.s²/rad)
-        sigma=new DoubleSpinBox(setup_tab->LastRowLastCol(),"sigma:",0,1,0.1); // coefficient de perte d efficacite aerodynamique (sans unite)
-        S=new DoubleSpinBox(setup_tab->LastRowLastCol(),"S:",1,2,0.1); // coefficient de forme des helices 1<S=1+Ss/Sprop<2 (sans unite)
-
-    motors=new SimuBldc(this,name,8,dev_id);
-}
-
-void X8::Draw(){
-#ifdef GL
-
-	//create unite (1m=100cm) UAV; scale will be adapted according to arm_length parameter
-    //note that the frame used is irrlicht one:
-    //left handed, North East Up
-
-    const IGeometryCreator *geo;
-    geo=getGui()->getSceneManager()->getGeometryCreator();
-
-    //cylinders are aligned with y axis
-    red_arm=geo->createCylinderMesh(2.5,100,16,SColor(0, 255, 0, 0));
-    black_arm=geo->createCylinderMesh(2.5,100,16,SColor(0, 128, 128, 128));
-    motor=geo->createCylinderMesh(7.5,15,16);//,SColor(0, 128, 128, 128));
-    //geo->drop();
-
-    ITexture* texture=getGui()->getTexture("carbone.jpg");
-    fl_arm=new MeshSceneNode(this, red_arm, vector3df(0,0,0),vector3df(0,0,-135));
-    fr_arm=new MeshSceneNode(this, red_arm, vector3df(0,0,0),vector3df(0,0,-45));
-    rl_arm=new MeshSceneNode(this, black_arm, vector3df(0,0,0),vector3df(0,0,135),texture);
-    rr_arm=new MeshSceneNode(this, black_arm, vector3df(0,0,0),vector3df(0,0,45),texture);
-
-    texture=getGui()->getTexture("metal047.jpg");
-    tfl_motor=new MeshSceneNode(this, motor, vector3df(70.71,-70.71,2.5),vector3df(90,0,0),texture);
-    tfr_motor=new MeshSceneNode(this, motor ,vector3df(70.71,70.71,2.5),vector3df(90,0,0),texture);
-    trl_motor=new MeshSceneNode(this, motor ,vector3df(-70.71,-70.71,2.5),vector3df(90,0,0),texture);
-    trr_motor=new MeshSceneNode(this, motor ,vector3df(-70.71,70.71,2.5),vector3df(90,0,0),texture);
-
-    bfl_motor=new MeshSceneNode(this, motor, vector3df(70.71,-70.71,-17.5),vector3df(90,0,0),texture);
-    bfr_motor=new MeshSceneNode(this, motor ,vector3df(70.71,70.71,-17.5),vector3df(90,0,0),texture);
-    brl_motor=new MeshSceneNode(this, motor ,vector3df(-70.71,-70.71,-17.5),vector3df(90,0,0),texture);
-    brr_motor=new MeshSceneNode(this, motor ,vector3df(-70.71,70.71,-17.5),vector3df(90,0,0),texture);
-
-    tfl_blade=new Blade(this, vector3df(70.71,-70.71,17.5));
-    tfr_blade=new Blade(this, vector3df(70.71,70.71,17.5),true);
-    trl_blade=new Blade(this, vector3df(-70.71,-70.71,17.5),true);
-    trr_blade=new Blade(this, vector3df(-70.71,70.71,17.5));
-
-    bfl_blade=new Blade(this, vector3df(70.71,-70.71,-17.5));
-    bfr_blade=new Blade(this, vector3df(70.71,70.71,-17.5),true);
-    brl_blade=new Blade(this, vector3df(-70.71,-70.71,-17.5),true);
-    brr_blade=new Blade(this, vector3df(-70.71,70.71,-17.5));
-
-    motor_speed_mutex=new Mutex(this);
-    for(int i=0;i<8;i++) motor_speed[i]=0;
-    ExtraDraw();
-    #endif
-}
-
-X8::~X8()
-{
-    //les objets irrlicht seront automatiquement detruits (moteurs, helices, pales) par parenté
-}
-
-#ifdef GL
-void X8::AnimateModel(void)
-{
-    motor_speed_mutex->GetMutex();
-    tfl_blade->SetRotationSpeed(K_MOT*motor_speed[0]);
-    tfr_blade->SetRotationSpeed(-K_MOT*motor_speed[1]);
-    trl_blade->SetRotationSpeed(-K_MOT*motor_speed[2]);
-    trr_blade->SetRotationSpeed(K_MOT*motor_speed[3]);
-
-    bfl_blade->SetRotationSpeed(-K_MOT*motor_speed[4]);
-    bfr_blade->SetRotationSpeed(K_MOT*motor_speed[5]);
-    brl_blade->SetRotationSpeed(K_MOT*motor_speed[6]);
-    brr_blade->SetRotationSpeed(-K_MOT*motor_speed[7]);
-    motor_speed_mutex->ReleaseMutex();
-
-    //adapt UAV size
-    if(arm_length->ValueChanged()==true)
-    {
-        setScale(arm_length->Value());
-    }
-}
-
-size_t X8::dbtSize(void) const
-{
-    return 6*sizeof(float)+4*sizeof(float);//6ddl+4helices
-}
-
-void X8::WritedbtBuf(char* dbtbuf)
-{/*
-    float *buf=(float*)dbtbuf;
-    vector3df vect=getPosition();
-    memcpy(buf,&vect.X,sizeof(float));
-    buf++;
-    memcpy(buf,&vect.Y,sizeof(float));
-    buf++;
-    memcpy(buf,&vect.Z,sizeof(float));
-    buf++;
-    vect=getRotation();
-    memcpy(buf,&vect.X,sizeof(float));
-    buf++;
-    memcpy(buf,&vect.Y,sizeof(float));
-    buf++;
-    memcpy(buf,&vect.Z,sizeof(float));
-    buf++;
-    memcpy(buf,&motors,sizeof(rtsimu_motors));*/
-}
-
-void X8::ReaddbtBuf(char* dbtbuf)
-{/*
-    float *buf=(float*)dbtbuf;
-    vector3df vect;
-    memcpy(&vect.X,buf,sizeof(float));
-    buf++;
-    memcpy(&vect.Y,buf,sizeof(float));
-    buf++;
-    memcpy(&vect.Z,buf,sizeof(float));
-    buf++;
-    setPosition(vect);
-    memcpy(&vect.X,buf,sizeof(float));
-    buf++;
-    memcpy(&vect.Y,buf,sizeof(float));
-    buf++;
-    memcpy(&vect.Z,buf,sizeof(float));
-    buf++;
-    ((ISceneNode*)(this))->setRotation(vect);
-    memcpy(&motors,buf,sizeof(rtsimu_motors));
-    AnimateModele();*/
-}
-#endif //GL
-
-//states are computed on fixed frame NED
-//x north
-//y east
-//z down
-void X8::CalcModel(void)
-{
-    float tfl_speed,tfr_speed,trl_speed,trr_speed;
-    float bfl_speed,bfr_speed,brl_speed,brr_speed;
-    float u_roll,u_pitch,u_yaw,u_thrust;
-    float omega;
-#ifdef GL
-    motor_speed_mutex->GetMutex();
-#endif //GL
-    motors->GetSpeeds(motor_speed);
-#ifdef GL
-    motor_speed_mutex->ReleaseMutex();
-#endif //GL
-	tfl_speed=motor_speed[0];
-	tfr_speed=motor_speed[1];
-	trl_speed=motor_speed[2];
-	trr_speed=motor_speed[3];
-	bfl_speed=motor_speed[4];
-	bfr_speed=motor_speed[5];
-	brl_speed=motor_speed[6];
-	brr_speed=motor_speed[7];
-
-	omega=tfl_speed+brl_speed+trr_speed+bfr_speed-bfl_speed-trl_speed-brr_speed-tfr_speed;
-
-
-    /*
-	** ===================================================================
-	**    u roll: roll torque
-	**
-	** ===================================================================
-	*/
-
-    u_roll=arm_length->Value()*k_mot->Value()*(sigma->Value()*tfl_speed*tfl_speed+bfl_speed*bfl_speed
-                                                +sigma->Value()*trl_speed*trl_speed+brl_speed*brl_speed
-                                                -sigma->Value()*tfr_speed*tfr_speed-bfr_speed*bfr_speed
-                                                -sigma->Value()*trr_speed*trr_speed-brr_speed*brr_speed)*sqrtf(2)/2;
-
-    /// Classical Nonlinear model of a quadrotor ( This is the w_x angular speed of the quadri in the body frame). It is a discrete integrator
-	//state[0].W.x=(dT()/j_roll->Value())*((j_yaw->Value()-j_pitch->Value())*state[-1].W.y*state[-1].W.z-j_r->Value()*state[-1].W.y*omega + u_roll) +state[-1].W.x;//Osamah
-    state[0].W.x=(dT()/j_roll->Value())*((j_pitch->Value()-j_yaw->Value())*state[-1].W.y*state[-1].W.z-j_r->Value()*state[-1].W.y*omega + u_roll) +state[-1].W.x;//Majd
-
-	//state[0].W.x=(dT()/j_roll->Value())*(u_roll-m->Value()*G*l_cg->Value()*sinf(state[-2].W.x)-f_air_vert->Value()*arm_length->Value()*arm_length->Value()*state[-1].W.x)+state[-1].W.x;
-
-	/*
-	** ===================================================================
-	**   u pitch : pitch torque
-	**
-	** ===================================================================
-	*/
-	u_pitch=arm_length->Value()*k_mot->Value()*(sigma->Value()*tfl_speed*tfl_speed+bfl_speed*bfl_speed
-                                             +sigma->Value()*tfr_speed*tfr_speed+bfr_speed*bfr_speed
-                                            -sigma->Value()*trl_speed*trl_speed-brl_speed*brl_speed
-                                             -sigma->Value()*trr_speed*trr_speed-brr_speed*brr_speed)*sqrtf(2)/2;
-
-    /// Classical Nonlinear model of a quadrotor ( This is the w_y angular speed of the quadri in the body frame). It is a discrete integrator
-	//state[0].W.y=(dT()/j_pitch->Value())*((j_roll->Value()-j_yaw->Value())*state[-1].W.x*state[-1].W.z-j_r->Value()*state[-1].W.x*omega + u_pitch)+state[-1].W.y;//Osamah
-    state[0].W.y=(dT()/j_pitch->Value())*((j_yaw->Value()-j_roll->Value())*state[-1].W.x*state[-1].W.z-j_r->Value()*state[-1].W.x*omega + u_pitch)+state[-1].W.y;//Majd
-
-   //state[0].W.y=(dT()/j_pitch->Value())*(u_pitch-m->Value()*G*l_cg->Value()*sinf(state[-2].W.y)-f_air_vert->Value()*arm_length->Value()*arm_length->Value()*state[-1].W.y)+state[-1].W.y;
-
-	/*
-	** ===================================================================
-	**    u yaw : yaw torque
-	**
-	** ===================================================================
-	*/
-	u_yaw=c_mot->Value()*(tfl_speed*tfl_speed-bfl_speed*bfl_speed
-                        +trr_speed*trr_speed-brr_speed*brr_speed
-                        -tfr_speed*tfr_speed+bfr_speed*bfr_speed
-                        -trl_speed*trl_speed+brl_speed*brl_speed);
-
-    /// Classical Nonlinear model of a quadrotor ( This is the w_z angular speed of the quadri in the body frame). It is a discrete integrator
-	//state[0].W.z=(dT()/j_yaw->Value())* u_yaw +state[-1].W.z;//Osamah
-	state[0].W.z=(dT()/j_yaw->Value())*((j_roll->Value()-j_pitch->Value())*state[-1].W.x*state[-1].W.y+u_yaw )+state[-1].W.z;//Majd
-
-	//state[0].W.z=(dT()/j_yaw->Value())*(u_yaw-f_air_lat->Value()*state[-1].W.z)+state[-1].W.z;
-
-    // compute quaternion from W
-    // Quaternion derivative: dQ = 0.5*(Q*Qw)
-    Quaternion dQ=state[-1].Quat.GetDerivative(state[0].W);
-
-    // Quaternion integration
-    state[0].Quat =state[-1].Quat +dQ*dT();
-    state[0].Quat.Normalize();
-
-    // Calculation of the thrust from the reference speed of motors
-    u_thrust=k_mot->Value()*S->Value()*
-       (sigma->Value()*tfl_speed*tfl_speed+sigma->Value()*tfr_speed*tfr_speed+sigma->Value()*trl_speed*trl_speed+sigma->Value()*trr_speed*trr_speed
-       +bfl_speed*bfl_speed+bfr_speed*bfr_speed+brl_speed*brl_speed+brr_speed*brr_speed);
-    Vector3D vect(0,0,-u_thrust);
-    vect.Rotate(state[0].Quat);
-
-    /*
-	** ===================================================================
-	**     x double integrator
-	**
-	** ===================================================================
-	*/
-	state[0].Pos.x=(dT()*dT()/m->Value())*(vect.x-f_air_lat->Value()*(state[-1].Pos.x-state[-2].Pos.x)/dT())+2*state[-1].Pos.x-state[-2].Pos.x;
-    state[0].Vel.x=(state[0].Pos.x-state[-1].Pos.x)/dT();
-
-    /*
-	** ===================================================================
-	**     y double integrator
-	**
-	** ===================================================================
-	*/
-	state[0].Pos.y=(dT()*dT()/m->Value())*(vect.y-f_air_lat->Value()*(state[-1].Pos.y-state[-2].Pos.y)/dT())+2*state[-1].Pos.y-state[-2].Pos.y;
-    state[0].Vel.y=(state[0].Pos.y-state[-1].Pos.y)/dT();
-
-	/*
-	** ===================================================================
-	**     z double integrator
-	**
-	** ===================================================================
-	*/
-	state[0].Pos.z=(dT()*dT()/m->Value())*(vect.z+f_air_vert->Value()*(state[-1].Pos.z-state[-2].Pos.z)/dT()+m->Value()*G)+2*state[-1].Pos.z-state[-2].Pos.z;
-    state[0].Vel.z=(state[0].Pos.z-state[-1].Pos.z)/dT();
+namespace flair {
+namespace simulator {
+
+X8::X8(const Simulator *parent, std::string name, int dev_id)
+    : Model(parent, name) {
+  Tab *setup_tab = new Tab(GetTabWidget(), "model");
+  m = new DoubleSpinBox(setup_tab->NewRow(), "mass (kg):", 0, 20, 0.1);
+  arm_length = new DoubleSpinBox(setup_tab->LastRowLastCol(), "arm length (m):",
+                                 0, 2, 0.1);
+  l_cg = new DoubleSpinBox(
+      setup_tab->LastRowLastCol(), "position G (m):", -0.5, 0.5,
+      0.02); // position du centre de gravité/centre de poussé
+  k_mot =
+      new DoubleSpinBox(setup_tab->NewRow(), "k_mot:", 0, 1, 0.001,
+                        3); // vitesse rotation² (unité arbitraire) -> force (N)
+  c_mot = new DoubleSpinBox(
+      setup_tab->LastRowLastCol(), "c_mot:", 0, 1, 0.001,
+      3); // vitesse rotation moteur -> couple (N.m/unité arbitraire)
+  f_air_vert = new DoubleSpinBox(setup_tab->NewRow(), "f_air_vert:", 0, 10,
+                                 1); // frottements air depl. vertical, aussi
+                                     // utilisé pour les rotations ( N/(m/s) )
+                                     // (du aux helices en rotation)
+  f_air_lat =
+      new DoubleSpinBox(setup_tab->LastRowLastCol(), "f_air_lat:", 0, 10,
+                        1); // frottements air deplacements lateraux ( N/(m/s) )
+  j_roll = new DoubleSpinBox(setup_tab->NewRow(), "j_roll:", 0, 1, 0.001,
+                             5); // moment d'inertie d'un axe (N.m.s²/rad)
+  j_pitch =
+      new DoubleSpinBox(setup_tab->LastRowLastCol(), "j_pitch:", 0, 1, 0.001,
+                        5); // moment d'inertie d'un axe (N.m.s²/rad)
+  j_yaw = new DoubleSpinBox(setup_tab->LastRowLastCol(), "j_yaw:", 0, 1, 0.001,
+                            5); // moment d'inertie d'un axe (N.m.s²/rad)
+  j_r = new DoubleSpinBox(setup_tab->NewRow(), "j_r:", 0, 1,
+                          0.001); // moment des helices (N.m.s²/rad)
+  sigma = new DoubleSpinBox(
+      setup_tab->LastRowLastCol(), "sigma:", 0, 1,
+      0.1); // coefficient de perte d efficacite aerodynamique (sans unite)
+  S = new DoubleSpinBox(
+      setup_tab->LastRowLastCol(), "S:", 1, 2,
+      0.1); // coefficient de forme des helices 1<S=1+Ss/Sprop<2 (sans unite)
+
+  motors = new SimuBldc(this, name, 8, dev_id);
+}
+
+void X8::Draw() {
+#ifdef GL
+
+  // create unite (1m=100cm) UAV; scale will be adapted according to arm_length
+  // parameter
+  // note that the frame used is irrlicht one:
+  // left handed, North East Up
+
+  const IGeometryCreator *geo;
+  geo = getGui()->getSceneManager()->getGeometryCreator();
+
+  // cylinders are aligned with y axis
+  red_arm = geo->createCylinderMesh(2.5, 100, 16, SColor(0, 255, 0, 0));
+  black_arm = geo->createCylinderMesh(2.5, 100, 16, SColor(0, 128, 128, 128));
+  motor = geo->createCylinderMesh(7.5, 15, 16); //,SColor(0, 128, 128, 128));
+  // geo->drop();
+
+  ITexture *texture = getGui()->getTexture("carbone.jpg");
+  fl_arm = new MeshSceneNode(this, red_arm, vector3df(0, 0, 0),
+                             vector3df(0, 0, -135));
+  fr_arm = new MeshSceneNode(this, red_arm, vector3df(0, 0, 0),
+                             vector3df(0, 0, -45));
+  rl_arm = new MeshSceneNode(this, black_arm, vector3df(0, 0, 0),
+                             vector3df(0, 0, 135), texture);
+  rr_arm = new MeshSceneNode(this, black_arm, vector3df(0, 0, 0),
+                             vector3df(0, 0, 45), texture);
+
+  texture = getGui()->getTexture("metal047.jpg");
+  tfl_motor = new MeshSceneNode(this, motor, vector3df(70.71, -70.71, 2.5),
+                                vector3df(90, 0, 0), texture);
+  tfr_motor = new MeshSceneNode(this, motor, vector3df(70.71, 70.71, 2.5),
+                                vector3df(90, 0, 0), texture);
+  trl_motor = new MeshSceneNode(this, motor, vector3df(-70.71, -70.71, 2.5),
+                                vector3df(90, 0, 0), texture);
+  trr_motor = new MeshSceneNode(this, motor, vector3df(-70.71, 70.71, 2.5),
+                                vector3df(90, 0, 0), texture);
+
+  bfl_motor = new MeshSceneNode(this, motor, vector3df(70.71, -70.71, -17.5),
+                                vector3df(90, 0, 0), texture);
+  bfr_motor = new MeshSceneNode(this, motor, vector3df(70.71, 70.71, -17.5),
+                                vector3df(90, 0, 0), texture);
+  brl_motor = new MeshSceneNode(this, motor, vector3df(-70.71, -70.71, -17.5),
+                                vector3df(90, 0, 0), texture);
+  brr_motor = new MeshSceneNode(this, motor, vector3df(-70.71, 70.71, -17.5),
+                                vector3df(90, 0, 0), texture);
+
+  tfl_blade = new Blade(this, vector3df(70.71, -70.71, 17.5));
+  tfr_blade = new Blade(this, vector3df(70.71, 70.71, 17.5), true);
+  trl_blade = new Blade(this, vector3df(-70.71, -70.71, 17.5), true);
+  trr_blade = new Blade(this, vector3df(-70.71, 70.71, 17.5));
+
+  bfl_blade = new Blade(this, vector3df(70.71, -70.71, -17.5));
+  bfr_blade = new Blade(this, vector3df(70.71, 70.71, -17.5), true);
+  brl_blade = new Blade(this, vector3df(-70.71, -70.71, -17.5), true);
+  brr_blade = new Blade(this, vector3df(-70.71, 70.71, -17.5));
+
+  motor_speed_mutex = new Mutex(this);
+  for (int i = 0; i < 8; i++)
+    motor_speed[i] = 0;
+  ExtraDraw();
+#endif
+}
+
+X8::~X8() {
+  // les objets irrlicht seront automatiquement detruits (moteurs, helices,
+  // pales) par parenté
+}
+
+#ifdef GL
+void X8::AnimateModel(void) {
+  motor_speed_mutex->GetMutex();
+  tfl_blade->SetRotationSpeed(K_MOT * motor_speed[0]);
+  tfr_blade->SetRotationSpeed(-K_MOT * motor_speed[1]);
+  trl_blade->SetRotationSpeed(-K_MOT * motor_speed[2]);
+  trr_blade->SetRotationSpeed(K_MOT * motor_speed[3]);
+
+  bfl_blade->SetRotationSpeed(-K_MOT * motor_speed[4]);
+  bfr_blade->SetRotationSpeed(K_MOT * motor_speed[5]);
+  brl_blade->SetRotationSpeed(K_MOT * motor_speed[6]);
+  brr_blade->SetRotationSpeed(-K_MOT * motor_speed[7]);
+  motor_speed_mutex->ReleaseMutex();
+
+  // adapt UAV size
+  if (arm_length->ValueChanged() == true) {
+    setScale(arm_length->Value());
+  }
+}
+
+size_t X8::dbtSize(void) const {
+  return 6 * sizeof(float) + 4 * sizeof(float); // 6ddl+4helices
+}
+
+void X8::WritedbtBuf(
+    char *dbtbuf) { /*
+                       float *buf=(float*)dbtbuf;
+                       vector3df vect=getPosition();
+                       memcpy(buf,&vect.X,sizeof(float));
+                       buf++;
+                       memcpy(buf,&vect.Y,sizeof(float));
+                       buf++;
+                       memcpy(buf,&vect.Z,sizeof(float));
+                       buf++;
+                       vect=getRotation();
+                       memcpy(buf,&vect.X,sizeof(float));
+                       buf++;
+                       memcpy(buf,&vect.Y,sizeof(float));
+                       buf++;
+                       memcpy(buf,&vect.Z,sizeof(float));
+                       buf++;
+                       memcpy(buf,&motors,sizeof(rtsimu_motors));*/
+}
+
+void X8::ReaddbtBuf(
+    char *dbtbuf) { /*
+                       float *buf=(float*)dbtbuf;
+                       vector3df vect;
+                       memcpy(&vect.X,buf,sizeof(float));
+                       buf++;
+                       memcpy(&vect.Y,buf,sizeof(float));
+                       buf++;
+                       memcpy(&vect.Z,buf,sizeof(float));
+                       buf++;
+                       setPosition(vect);
+                       memcpy(&vect.X,buf,sizeof(float));
+                       buf++;
+                       memcpy(&vect.Y,buf,sizeof(float));
+                       buf++;
+                       memcpy(&vect.Z,buf,sizeof(float));
+                       buf++;
+                       ((ISceneNode*)(this))->setRotation(vect);
+                       memcpy(&motors,buf,sizeof(rtsimu_motors));
+                       AnimateModele();*/
+}
+#endif // GL
+
+// states are computed on fixed frame NED
+// x north
+// y east
+// z down
+void X8::CalcModel(void) {
+  float tfl_speed, tfr_speed, trl_speed, trr_speed;
+  float bfl_speed, bfr_speed, brl_speed, brr_speed;
+  float u_roll, u_pitch, u_yaw, u_thrust;
+  float omega;
+#ifdef GL
+  motor_speed_mutex->GetMutex();
+#endif // GL
+  motors->GetSpeeds(motor_speed);
+#ifdef GL
+  motor_speed_mutex->ReleaseMutex();
+#endif // GL
+  tfl_speed = motor_speed[0];
+  tfr_speed = motor_speed[1];
+  trl_speed = motor_speed[2];
+  trr_speed = motor_speed[3];
+  bfl_speed = motor_speed[4];
+  bfr_speed = motor_speed[5];
+  brl_speed = motor_speed[6];
+  brr_speed = motor_speed[7];
+
+  omega = tfl_speed + brl_speed + trr_speed + bfr_speed - bfl_speed -
+          trl_speed - brr_speed - tfr_speed;
+
+  /*
+      ** ===================================================================
+      **    u roll: roll torque
+      **
+      ** ===================================================================
+      */
+
+  u_roll = arm_length->Value() * k_mot->Value() *
+           (sigma->Value() * tfl_speed * tfl_speed + bfl_speed * bfl_speed +
+            sigma->Value() * trl_speed * trl_speed + brl_speed * brl_speed -
+            sigma->Value() * tfr_speed * tfr_speed - bfr_speed * bfr_speed -
+            sigma->Value() * trr_speed * trr_speed - brr_speed * brr_speed) *
+           sqrtf(2) / 2;
+
+  /// Classical Nonlinear model of a quadrotor ( This is the w_x angular speed
+  /// of the quadri in the body frame). It is a discrete integrator
+  // state[0].W.x=(dT()/j_roll->Value())*((j_yaw->Value()-j_pitch->Value())*state[-1].W.y*state[-1].W.z-j_r->Value()*state[-1].W.y*omega
+  // + u_roll) +state[-1].W.x;//Osamah
+  state[0].W.x =
+      (dT() / j_roll->Value()) *
+          ((j_pitch->Value() - j_yaw->Value()) * state[-1].W.y * state[-1].W.z -
+           j_r->Value() * state[-1].W.y * omega + u_roll) +
+      state[-1].W.x; // Majd
+
+  // state[0].W.x=(dT()/j_roll->Value())*(u_roll-m->Value()*G*l_cg->Value()*sinf(state[-2].W.x)-f_air_vert->Value()*arm_length->Value()*arm_length->Value()*state[-1].W.x)+state[-1].W.x;
+
+  /*
+  ** ===================================================================
+  **   u pitch : pitch torque
+  **
+  ** ===================================================================
+  */
+  u_pitch = arm_length->Value() * k_mot->Value() *
+            (sigma->Value() * tfl_speed * tfl_speed + bfl_speed * bfl_speed +
+             sigma->Value() * tfr_speed * tfr_speed + bfr_speed * bfr_speed -
+             sigma->Value() * trl_speed * trl_speed - brl_speed * brl_speed -
+             sigma->Value() * trr_speed * trr_speed - brr_speed * brr_speed) *
+            sqrtf(2) / 2;
+
+  /// Classical Nonlinear model of a quadrotor ( This is the w_y angular speed
+  /// of the quadri in the body frame). It is a discrete integrator
+  // state[0].W.y=(dT()/j_pitch->Value())*((j_roll->Value()-j_yaw->Value())*state[-1].W.x*state[-1].W.z-j_r->Value()*state[-1].W.x*omega
+  // + u_pitch)+state[-1].W.y;//Osamah
+  state[0].W.y =
+      (dT() / j_pitch->Value()) *
+          ((j_yaw->Value() - j_roll->Value()) * state[-1].W.x * state[-1].W.z -
+           j_r->Value() * state[-1].W.x * omega + u_pitch) +
+      state[-1].W.y; // Majd
+
+  // state[0].W.y=(dT()/j_pitch->Value())*(u_pitch-m->Value()*G*l_cg->Value()*sinf(state[-2].W.y)-f_air_vert->Value()*arm_length->Value()*arm_length->Value()*state[-1].W.y)+state[-1].W.y;
+
+  /*
+  ** ===================================================================
+  **    u yaw : yaw torque
+  **
+  ** ===================================================================
+  */
+  u_yaw = c_mot->Value() * (tfl_speed * tfl_speed - bfl_speed * bfl_speed +
+                            trr_speed * trr_speed - brr_speed * brr_speed -
+                            tfr_speed * tfr_speed + bfr_speed * bfr_speed -
+                            trl_speed * trl_speed + brl_speed * brl_speed);
+
+  /// Classical Nonlinear model of a quadrotor ( This is the w_z angular speed
+  /// of the quadri in the body frame). It is a discrete integrator
+  // state[0].W.z=(dT()/j_yaw->Value())* u_yaw +state[-1].W.z;//Osamah
+  state[0].W.z =
+      (dT() / j_yaw->Value()) * ((j_roll->Value() - j_pitch->Value()) *
+                                     state[-1].W.x * state[-1].W.y +
+                                 u_yaw) +
+      state[-1].W.z; // Majd
+
+  // state[0].W.z=(dT()/j_yaw->Value())*(u_yaw-f_air_lat->Value()*state[-1].W.z)+state[-1].W.z;
+
+  // compute quaternion from W
+  // Quaternion derivative: dQ = 0.5*(Q*Qw)
+  Quaternion dQ = state[-1].Quat.GetDerivative(state[0].W);
+
+  // Quaternion integration
+  state[0].Quat = state[-1].Quat + dQ * dT();
+  state[0].Quat.Normalize();
+
+  // Calculation of the thrust from the reference speed of motors
+  u_thrust =
+      k_mot->Value() * S->Value() *
+      (sigma->Value() * tfl_speed * tfl_speed +
+       sigma->Value() * tfr_speed * tfr_speed +
+       sigma->Value() * trl_speed * trl_speed +
+       sigma->Value() * trr_speed * trr_speed + bfl_speed * bfl_speed +
+       bfr_speed * bfr_speed + brl_speed * brl_speed + brr_speed * brr_speed);
+  Vector3D vect(0, 0, -u_thrust);
+  vect.Rotate(state[0].Quat);
+
+  /*
+      ** ===================================================================
+      **     x double integrator
+      **
+      ** ===================================================================
+      */
+  state[0].Pos.x =
+      (dT() * dT() / m->Value()) *
+          (vect.x -
+           f_air_lat->Value() * (state[-1].Pos.x - state[-2].Pos.x) / dT()) +
+      2 * state[-1].Pos.x - state[-2].Pos.x;
+  state[0].Vel.x = (state[0].Pos.x - state[-1].Pos.x) / dT();
+
+  /*
+      ** ===================================================================
+      **     y double integrator
+      **
+      ** ===================================================================
+      */
+  state[0].Pos.y =
+      (dT() * dT() / m->Value()) *
+          (vect.y -
+           f_air_lat->Value() * (state[-1].Pos.y - state[-2].Pos.y) / dT()) +
+      2 * state[-1].Pos.y - state[-2].Pos.y;
+  state[0].Vel.y = (state[0].Pos.y - state[-1].Pos.y) / dT();
+
+  /*
+  ** ===================================================================
+  **     z double integrator
+  **
+  ** ===================================================================
+  */
+  state[0].Pos.z =
+      (dT() * dT() / m->Value()) *
+          (vect.z +
+           f_air_vert->Value() * (state[-1].Pos.z - state[-2].Pos.z) / dT() +
+           m->Value() * G) +
+      2 * state[-1].Pos.z - state[-2].Pos.z;
+  state[0].Vel.z = (state[0].Pos.z - state[-1].Pos.z) / dT();
 
 #ifndef GL
-    if(state[0].Pos.z<0) state[0].Pos.z=0;
+  if (state[0].Pos.z < 0)
+    state[0].Pos.z = 0;
 #endif
-
 }
 
Index: trunk/lib/FlairSimulator/src/X8.h
===================================================================
--- trunk/lib/FlairSimulator/src/X8.h	(revision 14)
+++ trunk/lib/FlairSimulator/src/X8.h	(revision 15)
@@ -21,73 +21,65 @@
 #include <stdint.h>
 
-namespace flair
-{
-    namespace core
-    {
-        class Mutex;
-    }
-    namespace gui
-    {
-        class DoubleSpinBox;
-    }
-    namespace actuator
-    {
-        class SimuBldc;
-    }
+namespace flair {
+namespace core {
+class Mutex;
+}
+namespace gui {
+class DoubleSpinBox;
+}
+namespace actuator {
+class SimuBldc;
+}
 }
 
 #ifdef GL
-namespace irr
-{
-    namespace scene
-    {
-        class IMesh;
-    }
+namespace irr {
+namespace scene {
+class IMesh;
+}
 }
 #endif
 
-namespace flair
-{
-namespace simulator
-{
-    class Simulator;
-    class Blade;
-    class MeshSceneNode;
+namespace flair {
+namespace simulator {
+class Simulator;
+class Blade;
+class MeshSceneNode;
 
-    class X8 : public Model
-    {
-        public:
-            X8(const Simulator* parent,std::string name, int dev_id);
-            ~X8();
-            virtual void Draw(void);
-			virtual void ExtraDraw(void){};
-        protected:
+class X8 : public Model {
+public:
+  X8(const Simulator *parent, std::string name, int dev_id);
+  ~X8();
+  virtual void Draw(void);
+  virtual void ExtraDraw(void){};
+
+protected:
 #ifdef GL
-            irr::scene::IMesh *red_arm,*black_arm,*motor;
-			MeshSceneNode *fl_arm,*fr_arm,*rl_arm,*rr_arm;
-			MeshSceneNode *tfl_motor,*tfr_motor,*trl_motor,*trr_motor;
-			MeshSceneNode *bfl_motor,*bfr_motor,*brl_motor,*brr_motor;
-			Blade *tfl_blade,*tfr_blade,*trl_blade,*trr_blade;
-			Blade *bfl_blade,*bfr_blade,*brl_blade,*brr_blade;
+  irr::scene::IMesh *red_arm, *black_arm, *motor;
+  MeshSceneNode *fl_arm, *fr_arm, *rl_arm, *rr_arm;
+  MeshSceneNode *tfl_motor, *tfr_motor, *trl_motor, *trr_motor;
+  MeshSceneNode *bfl_motor, *bfr_motor, *brl_motor, *brr_motor;
+  Blade *tfl_blade, *tfr_blade, *trl_blade, *trr_blade;
+  Blade *bfl_blade, *bfr_blade, *brl_blade, *brr_blade;
 #endif
-        private:
-            void CalcModel(void);
-    #ifdef GL
-            bool OnEvent(const irr::SEvent& event){};
-            void AnimateModel(void);
-            size_t dbtSize(void) const;
-            void WritedbtBuf(char* dbtbuf);
-            void ReaddbtBuf(char* dbtbuf);
-            core::Mutex *motor_speed_mutex;
-    #endif
+private:
+  void CalcModel(void);
+#ifdef GL
+  bool OnEvent(const irr::SEvent &event){};
+  void AnimateModel(void);
+  size_t dbtSize(void) const;
+  void WritedbtBuf(char *dbtbuf);
+  void ReaddbtBuf(char *dbtbuf);
+  core::Mutex *motor_speed_mutex;
+#endif
 
-            actuator::SimuBldc *motors;
-            float motor_speed[8];
-            gui::DoubleSpinBox *m,*arm_length,*l_cg;
-            gui::DoubleSpinBox *k_mot,*c_mot;
-            gui::DoubleSpinBox *f_air_vert,*f_air_lat;
-            gui::DoubleSpinBox *j_roll,*j_pitch,*j_yaw;
-            gui::DoubleSpinBox *j_r,*sigma,*S;
-    };
+  actuator::SimuBldc *motors;
+  float motor_speed[8];
+  gui::DoubleSpinBox *m, *arm_length, *l_cg;
+  gui::DoubleSpinBox *k_mot, *c_mot;
+  gui::DoubleSpinBox *f_air_vert, *f_air_lat;
+  gui::DoubleSpinBox *j_roll, *j_pitch, *j_yaw;
+  gui::DoubleSpinBox *j_r, *sigma, *S;
+};
 } // end namespace simulator
 } // end namespace flair
Index: trunk/lib/FlairSimulator/src/unexported/AnimPoursuite.h
===================================================================
--- trunk/lib/FlairSimulator/src/unexported/AnimPoursuite.h	(revision 14)
+++ trunk/lib/FlairSimulator/src/unexported/AnimPoursuite.h	(revision 15)
@@ -22,39 +22,35 @@
 #include <vector3d.h>
 
-namespace flair
-{
-namespace simulator
-{
+namespace flair {
+namespace simulator {
 
-    class AnimPoursuite : public irr::scene::ISceneNodeAnimator
-    {
-        public:
-            AnimPoursuite(const irr::scene::ISceneNode* parent,float rotateSpeed = -500.0f, float zoomSpeed = 4.0f);
-            ~AnimPoursuite();
+class AnimPoursuite : public irr::scene::ISceneNodeAnimator {
+public:
+  AnimPoursuite(const irr::scene::ISceneNode *parent,
+                float rotateSpeed = -500.0f, float zoomSpeed = 4.0f);
+  ~AnimPoursuite();
 
-            void animateNode(irr::scene::ISceneNode* node, irr::u32 timeMs);
-            ISceneNodeAnimator* createClone(irr::scene::ISceneNode* node,irr::scene::ISceneManager* newManager=0);
-            bool MouseMoved(const irr::SEvent& event,irr::core::position2df MousePos);
-            void setPositionOffset(irr::core::vector3df newpos);
-            void setTargetOffset(irr::core::vector3df newpos);
+  void animateNode(irr::scene::ISceneNode *node, irr::u32 timeMs);
+  ISceneNodeAnimator *createClone(irr::scene::ISceneNode *node,
+                                  irr::scene::ISceneManager *newManager = 0);
+  bool MouseMoved(const irr::SEvent &event, irr::core::position2df MousePos);
+  void setPositionOffset(irr::core::vector3df newpos);
+  void setTargetOffset(irr::core::vector3df newpos);
 
-        private:
-            virtual bool isEventReceiverEnabled(void) const
-            {
-                return true;
-            }
+private:
+  virtual bool isEventReceiverEnabled(void) const { return true; }
 
-            irr::core::vector3df pos_offset,target_offset;
-            bool LMouseKey;
-            irr::core::position2df RotateStart;
-            irr::core::position2df MousePos;
-            const irr::scene::ISceneNode* parent;
-            bool Rotating;
-            float RotY,RotZ;
-            float rotateSpeed;
-            float zoomSpeed;
-            float currentZoom;
-            float sat(float value);
-    };
+  irr::core::vector3df pos_offset, target_offset;
+  bool LMouseKey;
+  irr::core::position2df RotateStart;
+  irr::core::position2df MousePos;
+  const irr::scene::ISceneNode *parent;
+  bool Rotating;
+  float RotY, RotZ;
+  float rotateSpeed;
+  float zoomSpeed;
+  float currentZoom;
+  float sat(float value);
+};
 
 } // end namespace simulator
Index: trunk/lib/FlairSimulator/src/unexported/GenericObject.h
===================================================================
--- trunk/lib/FlairSimulator/src/unexported/GenericObject.h	(revision 14)
+++ trunk/lib/FlairSimulator/src/unexported/GenericObject.h	(revision 15)
@@ -35,19 +35,16 @@
 #include <Vector3D.h>
 
-
 #include <aabbox3d.h>
 #include <IMeshSceneNode.h>
 
-namespace irr
-{
-    class SEvent;
-    namespace scene
-    {
-        class IMesh;
-        class ISceneManager;
-        class ITriangleSelector;
-        class IMetaTriangleSelector;
-        class ISceneNodeAnimatorCollisionResponse;
-    }
+namespace irr {
+class SEvent;
+namespace scene {
+class IMesh;
+class ISceneManager;
+class ITriangleSelector;
+class IMetaTriangleSelector;
+class ISceneNodeAnimatorCollisionResponse;
+}
 }
 
@@ -55,60 +52,53 @@
 class Simulator_impl;
 
-namespace flair
-{
-namespace core
-{
+namespace flair {
+namespace core {
 class ConditionVariable;
 }
-namespace simulator
-{
+namespace simulator {
 class Simulator;
 class AnimPoursuite;
 
-class GenericObject : public irr::scene::IMeshSceneNode
-{
-    friend class ::Simulator_impl;
+class GenericObject : public irr::scene::IMeshSceneNode {
+  friend class ::Simulator_impl;
 
 public:
-    GenericObject(Simulator* parent,std::string name, irr::scene::ISceneManager* sceneManager);
-    virtual ~GenericObject();
+  GenericObject(Simulator *parent, std::string name,
+                irr::scene::ISceneManager *sceneManager);
+  virtual ~GenericObject();
 
-    //FROM IMPL
-    irr::scene::ITriangleSelector* TriangleSelector(void);
-    irr::core::aabbox3d<irr::f32> box;
-    //END FROM IMPL
+  // FROM IMPL
+  irr::scene::ITriangleSelector *TriangleSelector(void);
+  irr::core::aabbox3d<irr::f32> box;
+  // END FROM IMPL
 
-    irr::scene::ISceneNode* getSceneNode();
-    virtual const irr::core::aabbox3d<irr::f32>& getBoundingBox(void) const
-    {
-        return box;
-    }
+  irr::scene::ISceneNode *getSceneNode();
+  virtual const irr::core::aabbox3d<irr::f32> &getBoundingBox(void) const {
+    return box;
+  }
 
-    void setPosition(irr::core::vector3df position);
-    void setScale(float value);
-    void setScale(irr::core::vector3df scale);
-    void setRotation(irr::core::vector3df rotation);
-    void OnRegisterSceneNode(void);
-    void setMesh(irr::scene::IMesh* mesh);
-    irr::scene::IMesh* getMesh(void);
-    void render(void);
-    virtual void setReadOnlyMaterials(bool readonly){};
-    virtual bool isReadOnlyMaterials(void) const
-    {
-        return false;
-    }
-    virtual irr::scene::IShadowVolumeSceneNode* addShadowVolumeSceneNode(const irr::scene::IMesh* shadowMesh=0,
-            irr::s32 id=-1, bool zfailmethod=true, irr::f32 infinity=1000.0f)
-    {
-        return NULL;
-    }
+  void setPosition(irr::core::vector3df position);
+  void setScale(float value);
+  void setScale(irr::core::vector3df scale);
+  void setRotation(irr::core::vector3df rotation);
+  void OnRegisterSceneNode(void);
+  void setMesh(irr::scene::IMesh *mesh);
+  irr::scene::IMesh *getMesh(void);
+  void render(void);
+  virtual void setReadOnlyMaterials(bool readonly){};
+  virtual bool isReadOnlyMaterials(void) const { return false; }
+  virtual irr::scene::IShadowVolumeSceneNode *
+  addShadowVolumeSceneNode(const irr::scene::IMesh *shadowMesh = 0,
+                           irr::s32 id = -1, bool zfailmethod = true,
+                           irr::f32 infinity = 1000.0f) {
+    return NULL;
+  }
 
 private:
-    void UpdateFrom(core::io_data *data) {};
-    irr::scene::IMesh *mesh;
-    irr::scene::ITriangleSelector* selector;
-    flair::core::ConditionVariable* cond;
-    irr::video::SMaterial Material;
-
+  void UpdateFrom(core::io_data *data){};
+  irr::scene::IMesh *mesh;
+  irr::scene::ITriangleSelector *selector;
+  flair::core::ConditionVariable *cond;
+  irr::video::SMaterial Material;
 };
 } // end namespace simulator
Index: trunk/lib/FlairSimulator/src/unexported/Gui_impl.h
===================================================================
--- trunk/lib/FlairSimulator/src/unexported/Gui_impl.h	(revision 14)
+++ trunk/lib/FlairSimulator/src/unexported/Gui_impl.h	(revision 15)
@@ -24,66 +24,64 @@
 #include <vector3d.h>
 
-namespace irr
-{
-    class IrrlichtDevice;
-    namespace scene
-    {
-        class ISceneManager;
-        class IMeshSceneNode;
-        class ITriangleSelector;
-    }
-    namespace video
-    {
-        class IVideoDriver;
-    }
-    namespace gui
-    {
-        class IGUIFont;
-        class IGUIEnvironment;
-    }
+namespace irr {
+class IrrlichtDevice;
+namespace scene {
+class ISceneManager;
+class IMeshSceneNode;
+class ITriangleSelector;
+}
+namespace video {
+class IVideoDriver;
+}
+namespace gui {
+class IGUIFont;
+class IGUIEnvironment;
+}
 }
 
-namespace flair
-{
-    namespace core
-    {
-        class Object;
-    }
-    namespace simulator
-    {
-        class Model;
-        class GenericObject;
-        class Gui;
-    }
+namespace flair {
+namespace core {
+class Object;
+}
+namespace simulator {
+class Model;
+class GenericObject;
+class Gui;
+}
 }
 
 class MyEventReceiver;
 
-class Gui_impl
-{
-    public:
-        Gui_impl(flair::simulator::Gui* self,int app_width, int app_height,int scene_width, int scene_height,std::string media_path,irr::video::E_DRIVER_TYPE driver_type=irr::video::EDT_OPENGL);
-        ~Gui_impl();
-        void RunGui(std::vector<flair::simulator::Model*> modeles,std::vector<flair::simulator::GenericObject*> objects);
-        void setMesh(std::string file,irr::core::vector3df position = irr::core::vector3df(0,0,0),irr::core::vector3df rotation= irr::core::vector3df(0,0,0),irr::core::vector3df scale= irr::core::vector3df(1,1,1));
+class Gui_impl {
+public:
+  Gui_impl(flair::simulator::Gui *self, int app_width, int app_height,
+           int scene_width, int scene_height, std::string media_path,
+           irr::video::E_DRIVER_TYPE driver_type = irr::video::EDT_OPENGL);
+  ~Gui_impl();
+  void RunGui(std::vector<flair::simulator::Model *> modeles,
+              std::vector<flair::simulator::GenericObject *> objects);
+  void setMesh(std::string file,
+               irr::core::vector3df position = irr::core::vector3df(0, 0, 0),
+               irr::core::vector3df rotation = irr::core::vector3df(0, 0, 0),
+               irr::core::vector3df scale = irr::core::vector3df(1, 1, 1));
 
-        irr::scene::IMeshSceneNode* node;
-        irr::IrrlichtDevice *device;
-        std::string media_path;
-        irr::video::IVideoDriver* driver;
-        irr::scene::ISceneManager* smgr;
-        int scene_width,scene_height;
+  irr::scene::IMeshSceneNode *node;
+  irr::IrrlichtDevice *device;
+  std::string media_path;
+  irr::video::IVideoDriver *driver;
+  irr::scene::ISceneManager *smgr;
+  int scene_width, scene_height;
 
-    private:
-        MyEventReceiver *receiver;
-        irr::scene::ITriangleSelector* selector;
-        irr::gui::IGUIFont* font;
-        irr::gui::IGUIEnvironment* env;
-        void setWindowCaption(flair::core::Object* object, int fps);
-        void takeScreenshot(void);
-        hdfile_t *dbtFile_r,*dbtFile_w;
-        size_t dbtSize(std::vector<flair::simulator::Model*> modeles);
-        char* dbtbuf;
-        flair::simulator::Gui *self;
+private:
+  MyEventReceiver *receiver;
+  irr::scene::ITriangleSelector *selector;
+  irr::gui::IGUIFont *font;
+  irr::gui::IGUIEnvironment *env;
+  void setWindowCaption(flair::core::Object *object, int fps);
+  void takeScreenshot(void);
+  hdfile_t *dbtFile_r, *dbtFile_w;
+  size_t dbtSize(std::vector<flair::simulator::Model *> modeles);
+  char *dbtbuf;
+  flair::simulator::Gui *self;
 };
 
Index: trunk/lib/FlairSimulator/src/unexported/Model_impl.h
===================================================================
--- trunk/lib/FlairSimulator/src/unexported/Model_impl.h	(revision 14)
+++ trunk/lib/FlairSimulator/src/unexported/Model_impl.h	(revision 15)
@@ -23,25 +23,21 @@
 #include "Quaternion.h"
 
-namespace flair
-{
-    namespace core
-    {
-        class cvmatrix;
-        class Mutex;
-        class ConditionVariable;
-    }
-    namespace gui
-    {
-        class TabWidget;
-        class CheckBox;
-        class DoubleSpinBox;
-        class SpinBox;
-        class Vector3DSpinBox;
-    }
-    namespace simulator
-    {
-        class Simulator;
-        class AnimPoursuite;
-    }
+namespace flair {
+namespace core {
+class cvmatrix;
+class Mutex;
+class ConditionVariable;
+}
+namespace gui {
+class TabWidget;
+class CheckBox;
+class DoubleSpinBox;
+class SpinBox;
+class Vector3DSpinBox;
+}
+namespace simulator {
+class Simulator;
+class AnimPoursuite;
+}
 }
 
@@ -50,83 +46,87 @@
 #include <IMeshSceneNode.h>
 
-namespace irr
-{
-    namespace scene
-    {
-        class ISceneManager;
-        class ITriangleSelector;
-        class IMetaTriangleSelector;
-        class ISceneNodeAnimatorCollisionResponse;
-        class ICameraSceneNode;
-    }
+namespace irr {
+namespace scene {
+class ISceneManager;
+class ITriangleSelector;
+class IMetaTriangleSelector;
+class ISceneNodeAnimatorCollisionResponse;
+class ICameraSceneNode;
+}
 }
 #endif
 
 #ifdef GL
-class Model_impl : public irr::scene::ISceneNode,public flair::core::Thread,private vrpn_Tracker
+class Model_impl : public irr::scene::ISceneNode,
+                   public flair::core::Thread,
+                   private vrpn_Tracker
 #else
-class Model_impl : public flair::core::Thread, private vrpn_Tracker
+class Model_impl : public flair::core::Thread,
+                   private vrpn_Tracker
 #endif
-{
-    public:
+                   {
+public:
 #ifdef GL
-        Model_impl(flair::simulator::Model* self,std::string name,irr::scene::ISceneManager* scenemanager,vrpn_Connection_IP* vrpn);
+  Model_impl(flair::simulator::Model *self, std::string name,
+             irr::scene::ISceneManager *scenemanager, vrpn_Connection_IP *vrpn);
 #else
-        Model_impl(flair::simulator::Model* self,std::string name,vrpn_Connection_IP* vrpn);
+  Model_impl(flair::simulator::Model *self, std::string name,
+             vrpn_Connection_IP *vrpn);
 #endif
-        ~Model_impl();
+  ~Model_impl();
 
 #ifdef GL
-        void OnRegisterSceneNode(void);
-        void render(void);
-        void Draw(void){printf("CA MARCHE PAS PUNAISE\r\n");ExtraDraw();};
-        void ExtraDraw(void){printf("nope\r\n");};
+  void OnRegisterSceneNode(void);
+  void render(void);
+  void Draw(void) {
+    printf("CA MARCHE PAS PUNAISE\r\n");
+    ExtraDraw();
+  };
+  void ExtraDraw(void) { printf("nope\r\n"); };
 
-        const irr::core::aabbox3d<irr::f32>& getBoundingBox(void) const
-        {
-            return box;
-        }
-        void UpdatePos(void);
-        void CheckCollision(void);
-        irr::scene::ITriangleSelector* TriangleSelector(void);
-        irr::scene::IMetaTriangleSelector* MetaTriangleSelector(void);
-        irr::core::aabbox3d<irr::f32> box;
-        void SynchronizationPoint();
-        irr::scene::ICameraSceneNode* camera;
-        flair::simulator::AnimPoursuite* animator;
-        irr::scene::ITriangleSelector* selector;
+  const irr::core::aabbox3d<irr::f32> &getBoundingBox(void) const {
+    return box;
+  }
+  void UpdatePos(void);
+  void CheckCollision(void);
+  irr::scene::ITriangleSelector *TriangleSelector(void);
+  irr::scene::IMetaTriangleSelector *MetaTriangleSelector(void);
+  irr::core::aabbox3d<irr::f32> box;
+  void SynchronizationPoint();
+  irr::scene::ICameraSceneNode *camera;
+  flair::simulator::AnimPoursuite *animator;
+  irr::scene::ITriangleSelector *selector;
 #endif
-        void mainloop(void);
+  void mainloop(void);
 
-        flair::gui::TabWidget *tabwidget;
-        flair::gui::DoubleSpinBox *dT;
+  flair::gui::TabWidget *tabwidget;
+  flair::gui::DoubleSpinBox *dT;
 
-    private:
-        flair::gui::Vector3DSpinBox* pos_init;
-        flair::gui::SpinBox *yaw_init;
-        flair::gui::CheckBox *enable_opti;
-        flair::simulator::Model* self;
-        flair::core::cvmatrix* output;
-        flair::core::Mutex *states_mutex;
+private:
+  flair::gui::Vector3DSpinBox *pos_init;
+  flair::gui::SpinBox *yaw_init;
+  flair::gui::CheckBox *enable_opti;
+  flair::simulator::Model *self;
+  flair::core::cvmatrix *output;
+  flair::core::Mutex *states_mutex;
 
-        struct timeval _timestamp;
-        void Run(void);
-        flair::core::Quaternion ComputeInitRotation(flair::core::Quaternion quat_in);
+  struct timeval _timestamp;
+  void Run(void);
+  flair::core::Quaternion ComputeInitRotation(flair::core::Quaternion quat_in);
 #ifdef GL
-        void CollisionHandler(void);
+  void CollisionHandler(void);
 
-        irr::scene::IMetaTriangleSelector* meta_selector;
-        irr::scene::ISceneNodeAnimatorCollisionResponse* anim;
+  irr::scene::IMetaTriangleSelector *meta_selector;
+  irr::scene::ISceneNodeAnimatorCollisionResponse *anim;
 
-        bool position_init;
+  bool position_init;
 
-        flair::core::ConditionVariable* cond;
-        int sync_count;
+  flair::core::ConditionVariable *cond;
+  int sync_count;
 
-        flair::core::Mutex *collision_mutex;
-        bool collision_occured;
-        flair::core::Vector3D collision_point;
+  flair::core::Mutex *collision_mutex;
+  bool collision_occured;
+  flair::core::Vector3D collision_point;
 #endif
-
 };
 
Index: trunk/lib/FlairSimulator/src/unexported/Simulator_impl.h
===================================================================
--- trunk/lib/FlairSimulator/src/unexported/Simulator_impl.h	(revision 14)
+++ trunk/lib/FlairSimulator/src/unexported/Simulator_impl.h	(revision 15)
@@ -21,33 +21,30 @@
 #include <Thread.h>
 
-
-namespace flair
-{
-    namespace simulator
-    {
-        class Simulator;
-        class Model;
-        class GenericObject;
-    }
+namespace flair {
+namespace simulator {
+class Simulator;
+class Model;
+class GenericObject;
+}
 }
 
-class Simulator_impl: public vrpn_Connection_IP, private flair::core::Thread
-{
-    friend class flair::simulator::Model;
-    friend class flair::simulator::GenericObject;
+class Simulator_impl : public vrpn_Connection_IP, private flair::core::Thread {
+  friend class flair::simulator::Model;
+  friend class flair::simulator::GenericObject;
 
-    public:
-        Simulator_impl(flair::simulator::Simulator* self,int optitrack_mstime=10,float yaw_deg=30);
-        ~Simulator_impl();
+public:
+  Simulator_impl(flair::simulator::Simulator *self, int optitrack_mstime = 10,
+                 float yaw_deg = 30);
+  ~Simulator_impl();
 
-        void RunSimu(void);
-        float yaw_rad;
+  void RunSimu(void);
+  float yaw_rad;
 
-    private:
-        void Run(void);
-        flair::simulator::Simulator* self;
-        std::vector<flair::simulator::Model*> models;
-        std::vector<flair::simulator::GenericObject*> objects;
-        int optitrack_mstime;
+private:
+  void Run(void);
+  flair::simulator::Simulator *self;
+  std::vector<flair::simulator::Model *> models;
+  std::vector<flair::simulator::GenericObject *> objects;
+  int optitrack_mstime;
 };
 
Index: trunk/tools/FlairGCS/src/CheckBox.cpp
===================================================================
--- trunk/tools/FlairGCS/src/CheckBox.cpp	(revision 14)
+++ trunk/tools/FlairGCS/src/CheckBox.cpp	(revision 15)
@@ -8,83 +8,57 @@
 #include <QFormLayout>
 
-CheckBox::CheckBox(Layout* parent,int row, int col,QString name,bool value): FormLayout(parent,row,col,name,"CheckBox")
-{
-    checkbox = new QCheckBox();
-    checkbox->setChecked(value);
+CheckBox::CheckBox(Layout *parent, int row, int col, QString name, bool value)
+    : FormLayout(parent, row, col, name, "CheckBox") {
+  checkbox = new QCheckBox();
+  checkbox->setChecked(value);
 
-    checkbox_value=value;
+  checkbox_value = value;
 
-    object_layout->addRow(name,checkbox);
+  object_layout->addRow(name, checkbox);
 
-    connect(checkbox,SIGNAL(toggled(bool)),this, SLOT(valuechanged(bool)));
+  connect(checkbox, SIGNAL(toggled(bool)), this, SLOT(valuechanged(bool)));
 
-    if(checkbox_value==true)
-    {
-        SetValue("1");
-    }
-    else
-    {
-        SetValue("0");
-    }
+  if (checkbox_value == true) {
+    SetValue("1");
+  } else {
+    SetValue("0");
+  }
 }
 
-CheckBox::~CheckBox()
-{
-    delete checkbox;
+CheckBox::~CheckBox() { delete checkbox; }
+
+void CheckBox::SetUptodate(void) {
+  ui_to_var();
+  ui_to_xml();
+  visible_widget->setPalette(black_pal);
 }
 
-void CheckBox::SetUptodate(void)
-{
-    ui_to_var();
-    ui_to_xml();
-    visible_widget->setPalette(black_pal);
+void CheckBox::ui_to_var(void) { checkbox_value = checkbox->isChecked(); }
+
+void CheckBox::ui_to_xml(void) {
+  if (checkbox->isChecked() == true) {
+    SetValue("1");
+  } else {
+    SetValue("0");
+  }
 }
 
-void CheckBox::ui_to_var(void)
-{
-    checkbox_value=checkbox->isChecked();
+void CheckBox::Reset(void) { checkbox->setChecked(checkbox_value); }
+
+void CheckBox::LoadEvent(QDomElement dom) {
+  if (checkbox->isEnabled() == true) {
+    if (dom.attribute("value") == QString("1")) {
+      checkbox->setChecked(true);
+    } else {
+      checkbox->setChecked(false);
+    }
+  }
 }
 
-void CheckBox::ui_to_xml(void)
-{
-    if(checkbox->isChecked()==true)
-    {
-        SetValue("1");
-    }
-    else
-    {
-        SetValue("0");
-    }
+void CheckBox::valuechanged(bool value) {
+  if (value != checkbox_value) {
+    visible_widget->setPalette(red_pal);
+  } else {
+    visible_widget->setPalette(black_pal);
+  }
 }
-
-void CheckBox::Reset(void)
-{
-    checkbox->setChecked(checkbox_value);
-}
-
-void CheckBox::LoadEvent(QDomElement dom)
-{
-    if(checkbox->isEnabled()==true)
-    {
-        if(dom.attribute("value")==QString("1"))
-        {
-            checkbox->setChecked(true);
-        }
-        else
-        {
-            checkbox->setChecked(false);
-        }
-    }
-}
-
-void CheckBox::valuechanged(bool value)
-{
-    if(value!=checkbox_value)
-    {
-        visible_widget->setPalette(red_pal);
-    }
-    else
-    {
-        visible_widget->setPalette(black_pal);
-    }
-}
Index: trunk/tools/FlairGCS/src/CheckBox.h
===================================================================
--- trunk/tools/FlairGCS/src/CheckBox.h	(revision 14)
+++ trunk/tools/FlairGCS/src/CheckBox.h	(revision 15)
@@ -11,25 +11,23 @@
 class QCheckBox;
 
-class CheckBox: public FormLayout
-{
-    Q_OBJECT
+class CheckBox : public FormLayout {
+  Q_OBJECT
 
-    public:
-        CheckBox(Layout* parent,int row, int col,QString name,bool value);
-        ~CheckBox();
+public:
+  CheckBox(Layout *parent, int row, int col, QString name, bool value);
+  ~CheckBox();
 
+private:
+  QCheckBox *checkbox;
+  bool checkbox_value;
+  void SetUptodate(void);
+  void Reset(void);
+  void LoadEvent(QDomElement dom);
 
-    private:
-        QCheckBox* checkbox;
-        bool checkbox_value;
-        void SetUptodate(void);
-        void Reset(void);
-        void LoadEvent(QDomElement dom);
+  void ui_to_var(void);
+  void ui_to_xml(void);
 
-        void ui_to_var(void);
-        void ui_to_xml(void);
-
-    private slots:
-        void valuechanged(bool value);
+private slots:
+  void valuechanged(bool value);
 };
 
Index: trunk/tools/FlairGCS/src/ComboBox.cpp
===================================================================
--- trunk/tools/FlairGCS/src/ComboBox.cpp	(revision 14)
+++ trunk/tools/FlairGCS/src/ComboBox.cpp	(revision 15)
@@ -8,75 +8,57 @@
 #include <QFormLayout>
 
-ComboBox::ComboBox(Layout* parent,int row, int col,QString name,int value): FormLayout(parent,row,col,name,"ComboBox")
-{
-    combobox = new QComboBox();
-    combobox->setCurrentIndex(value);
+ComboBox::ComboBox(Layout *parent, int row, int col, QString name, int value)
+    : FormLayout(parent, row, col, name, "ComboBox") {
+  combobox = new QComboBox();
+  combobox->setCurrentIndex(value);
 
-    combobox_value=value;
+  combobox_value = value;
 
-    object_layout->addRow(name,combobox);
+  object_layout->addRow(name, combobox);
 
-    connect(combobox,SIGNAL(currentIndexChanged(int)),this, SLOT(valuechanged(int)));
+  connect(combobox, SIGNAL(currentIndexChanged(int)), this,
+          SLOT(valuechanged(int)));
 
-    SetValue(QString::number(combobox_value));
+  SetValue(QString::number(combobox_value));
 
-    //pour ne pas faire de doublons qd on ajoute des items
-    SetIsExpandable(true);
+  // pour ne pas faire de doublons qd on ajoute des items
+  SetIsExpandable(true);
 }
 
-ComboBox::~ComboBox()
-{
-    delete combobox;
+ComboBox::~ComboBox() { delete combobox; }
+
+void ComboBox::XmlEvent(QDomElement dom) {
+  if (dom.attribute("item") != "") {
+    QString item = dom.attribute("item");
+    combobox->addItem(item);
+    combobox->setCurrentIndex(combobox_value);
+  }
 }
 
-void ComboBox::XmlEvent(QDomElement dom)
-{
-     if(dom.attribute("item")!="") {
-        QString item=dom.attribute("item");
-        combobox->addItem(item);
-        combobox->setCurrentIndex(combobox_value);
-    }
+void ComboBox::SetUptodate(void) {
+  ui_to_var();
+  ui_to_xml();
+  visible_widget->setPalette(black_pal);
 }
 
-void ComboBox::SetUptodate(void)
-{
-    ui_to_var();
-    ui_to_xml();
-    visible_widget->setPalette(black_pal);
+void ComboBox::ui_to_var(void) { combobox_value = combobox->currentIndex(); }
 
+void ComboBox::ui_to_xml(void) {
+  SetValue(QString::number(combobox->currentIndex()));
 }
 
-void ComboBox::ui_to_var(void)
-{
-    combobox_value=combobox->currentIndex();
+void ComboBox::Reset(void) { combobox->setCurrentIndex(combobox_value); }
+
+void ComboBox::LoadEvent(QDomElement dom) {
+  if (combobox->isEnabled() == true) {
+    combobox->setCurrentIndex((dom.attribute("value")).toInt());
+  }
 }
 
-void ComboBox::ui_to_xml(void)
-{
-    SetValue(QString::number(combobox->currentIndex()));
+void ComboBox::valuechanged(int value) {
+  if (value != combobox_value) {
+    visible_widget->setPalette(red_pal);
+  } else {
+    visible_widget->setPalette(black_pal);
+  }
 }
-
-void ComboBox::Reset(void)
-{
-    combobox->setCurrentIndex(combobox_value);
-}
-
-void ComboBox::LoadEvent(QDomElement dom)
-{
-    if(combobox->isEnabled()==true)
-    {
-        combobox->setCurrentIndex((dom.attribute("value")).toInt());
-    }
-}
-
-void ComboBox::valuechanged(int value)
-{
-    if(value!=combobox_value)
-    {
-        visible_widget->setPalette(red_pal);
-    }
-    else
-    {
-        visible_widget->setPalette(black_pal);
-    }
-}
Index: trunk/tools/FlairGCS/src/ComboBox.h
===================================================================
--- trunk/tools/FlairGCS/src/ComboBox.h	(revision 14)
+++ trunk/tools/FlairGCS/src/ComboBox.h	(revision 15)
@@ -11,25 +11,24 @@
 class Layout;
 
-class ComboBox: public FormLayout
-{
-    Q_OBJECT
+class ComboBox : public FormLayout {
+  Q_OBJECT
 
-    public:
-        ComboBox(Layout* parent,int row, int col,QString name,int value);
-        ~ComboBox();
+public:
+  ComboBox(Layout *parent, int row, int col, QString name, int value);
+  ~ComboBox();
 
-    private:
-        QComboBox* combobox;
-        int combobox_value;
-        void XmlEvent(QDomElement dom);
-        void SetUptodate(void);
-        void Reset(void);
-        void LoadEvent(QDomElement dom);
+private:
+  QComboBox *combobox;
+  int combobox_value;
+  void XmlEvent(QDomElement dom);
+  void SetUptodate(void);
+  void Reset(void);
+  void LoadEvent(QDomElement dom);
 
-        void ui_to_var(void);
-        void ui_to_xml(void);
+  void ui_to_var(void);
+  void ui_to_xml(void);
 
-    private slots:
-        void valuechanged(int value);
+private slots:
+  void valuechanged(int value);
 };
 
Index: trunk/tools/FlairGCS/src/ConnectionLayout.cpp
===================================================================
--- trunk/tools/FlairGCS/src/ConnectionLayout.cpp	(revision 14)
+++ trunk/tools/FlairGCS/src/ConnectionLayout.cpp	(revision 15)
@@ -13,163 +13,161 @@
 #define COMPRESS_CHUNK 1024
 
-
-ConnectionLayout::ConnectionLayout(UdtSocket* socket,QString name): Layout(NULL,name,"root") {
-    isRemoteNameDefined=false;
-    this->socket=socket;
+ConnectionLayout::ConnectionLayout(UdtSocket *socket, QString name)
+    : Layout(NULL, name, "root") {
+  isRemoteNameDefined = false;
+  this->socket = socket;
 }
 
-ConnectionLayout::~ConnectionLayout() {
-}
+ConnectionLayout::~ConnectionLayout() {}
 
-void ConnectionLayout::receive(char* buf,int size) {
-    //printf("trame %x\n",buf[0]);
-    //for(int i=0; i<size;i++) printf("%x ",buf[i]);
-    //printf("\n");
-    switch(buf[0]) {
-        case ZLIB_HEADER: {
-            ssize_t out_size;
-            char* uncompressbuf;
-            uncompressBuffer(buf,size,&uncompressbuf,&out_size);
-            handleUncompressedFrame(uncompressbuf,out_size);
-            free(uncompressbuf);
-            break;
-        }
-        default:
-            handleUncompressedFrame(buf,size);
-    }
-    free(buf);
+void ConnectionLayout::receive(char *buf, int size) {
+  // printf("trame %x\n",buf[0]);
+  // for(int i=0; i<size;i++) printf("%x ",buf[i]);
+  // printf("\n");
+  switch (buf[0]) {
+  case ZLIB_HEADER: {
+    ssize_t out_size;
+    char *uncompressbuf;
+    uncompressBuffer(buf, size, &uncompressbuf, &out_size);
+    handleUncompressedFrame(uncompressbuf, out_size);
+    free(uncompressbuf);
+    break;
+  }
+  default:
+    handleUncompressedFrame(buf, size);
+  }
+  free(buf);
 }
 
 void ConnectionLayout::XmlToSend(QDomDocument doc) {
-    //printf("xml to send\n%s\n",doc.toString().toLocal8Bit().constData());
-//xml to send a mettre dans le manager
-    QMetaObject::invokeMethod(socket,
-                              "write",
-                              Qt::BlockingQueuedConnection,
-                              Q_ARG(const char*,doc.toString().toLocal8Bit().constData()),
-                              Q_ARG(qint64,doc.toString().toLocal8Bit().length()));
-
+  // printf("xml to send\n%s\n",doc.toString().toLocal8Bit().constData());
+  // xml to send a mettre dans le manager
+  QMetaObject::invokeMethod(
+      socket, "write", Qt::BlockingQueuedConnection,
+      Q_ARG(const char *, doc.toString().toLocal8Bit().constData()),
+      Q_ARG(qint64, doc.toString().toLocal8Bit().length()));
 }
 
 void ConnectionLayout::LoadXml(QDomDocument to_parse) {
-    if(!isRemoteNameDefined) {
-        printf("load xml: name not defined!\n");
-        return;
+  if (!isRemoteNameDefined) {
+    printf("load xml: name not defined!\n");
+    return;
+  }
+
+  QDomElement tmp = to_parse.firstChildElement("root");
+  while (tmp.attribute("name") != remoteName && !tmp.isNull())
+    tmp = to_parse.nextSiblingElement("root");
+
+  if (!tmp.isNull()) {
+    XmlWidget::LoadXml(tmp);
+  } else {
+    printf("%s not found in xml file \n", remoteName.toLocal8Bit().constData());
+  }
+}
+
+void ConnectionLayout::handleUncompressedFrame(char *buf, ssize_t size) {
+  switch ((unsigned char)buf[0]) {
+  case XML_HEADER: {
+    QString xml;
+    QDomDocument doc;
+    xml = QString((char *)buf);
+    xml.resize(size);
+
+    // printf("recu %i\n%s\n",size,xml.toLocal8Bit().constData());
+    if (!doc.setContent(xml)) {
+      printf("prob setContent fichier\n");
     }
 
-    QDomElement tmp=to_parse.firstChildElement("root");
-    while(tmp.attribute("name")!=remoteName && !tmp.isNull()) tmp=to_parse.nextSiblingElement("root");
+    if (!isRemoteNameDefined) {
+      isRemoteNameDefined = true;
+      remoteName = doc.firstChildElement("root").attribute("name");
+      setRemoteName(remoteName);
+      SetAttribute("name", remoteName);
+    }
 
-    if(!tmp.isNull()) {
-        XmlWidget::LoadXml(tmp);
-    } else {
-        printf("%s not found in xml file \n",remoteName.toLocal8Bit().constData());
-    }
+    ParseXml(doc.firstChildElement("root").firstChildElement());
+    break;
+  }
+  case DATAS_BIG_ENDIAN: {
+    // for(int i=0;i<size;i++) printf("%x ",buf[i]);
+    // printf("\n");
+    uint16_t period;
+    memcpy(&period, &buf[1], sizeof(uint16_t));
+    period = qFromBigEndian(period);
+    drawDatas(&buf[3], size - 3, period, true);
+    break;
+  }
+  case DATAS_LITTLE_ENDIAN: {
+    // for(int i=0;i<size;i++) printf("%x ",buf[i]);
+    // printf("\n");
+    uint16_t period;
+    memcpy(&period, &buf[1], sizeof(uint16_t));
+    // printf("recu %i period %i\n",size,period);
+    drawDatas(&buf[3], size - 3, period);
+    break;
+  }
+  default:
+    printf("trame non supportée %x\n", buf[0]);
+  }
 }
 
-void ConnectionLayout::handleUncompressedFrame(char *buf,ssize_t size) {
-    switch((unsigned char)buf[0]) {
-        case XML_HEADER: {
-            QString xml;
-            QDomDocument doc;
-            xml=QString((char*)buf);
-            xml.resize(size);
-
-            //printf("recu %i\n%s\n",size,xml.toLocal8Bit().constData());
-            if(!doc.setContent(xml)) {
-                printf("prob setContent fichier\n");
-            }
-
-            if(!isRemoteNameDefined) {
-                isRemoteNameDefined=true;
-                remoteName=doc.firstChildElement("root").attribute("name");
-                setRemoteName(remoteName);
-                SetAttribute("name",remoteName);
-            }
-
-            ParseXml(doc.firstChildElement("root").firstChildElement());
-            break;
-        }
-        case DATAS_BIG_ENDIAN: {
-            //for(int i=0;i<size;i++) printf("%x ",buf[i]);
-            //printf("\n");
-            uint16_t period;
-            memcpy(&period,&buf[1],sizeof(uint16_t));
-            period=qFromBigEndian(period);
-            drawDatas(&buf[3],size-3,period,true);
-            break;
-        }
-        case DATAS_LITTLE_ENDIAN: {
-            //for(int i=0;i<size;i++) printf("%x ",buf[i]);
-            //printf("\n");
-            uint16_t period;
-            memcpy(&period,&buf[1],sizeof(uint16_t));
-            //printf("recu %i period %i\n",size,period);
-            drawDatas(&buf[3],size-3,period);
-            break;
-        }
-        default:
-            printf("trame non supportée %x\n",buf[0]);
-    }
+void ConnectionLayout::removeDataRemote(DataRemote *data) {
+  dataremotes.removeOne(data);
 }
 
-void ConnectionLayout::removeDataRemote(DataRemote* data) {
-    dataremotes.removeOne(data);
+void ConnectionLayout::addDataRemote(DataRemote *data) {
+  dataremotes.append(data);
 }
 
-void ConnectionLayout::addDataRemote(DataRemote* data) {
-    dataremotes.append(data);
+QString ConnectionLayout::getRemoteName() { return remoteName; }
+void ConnectionLayout::drawDatas(char *buf, int buf_size, uint16_t period,
+                                 bool big_endian) {
+  for (int i = 0; i < dataremotes.count(); i++) {
+    dataremotes.at(i)->BufEvent(&buf, &buf_size, period, big_endian);
+  }
 }
 
-QString ConnectionLayout::getRemoteName() {
-    return remoteName;
+int ConnectionLayout::uncompressBuffer(char *in, ssize_t in_size, char **out,
+                                       ssize_t *out_size) {
+  int ret;
+  unsigned have;
+  z_stream strm;
+
+  // allocate inflate state
+  strm.zalloc = Z_NULL;
+  strm.zfree = Z_NULL;
+  strm.opaque = Z_NULL;
+  strm.avail_in = 0;
+  strm.next_in = Z_NULL;
+  ret = inflateInit(&strm);
+  if (ret != Z_OK)
+    return ret;
+
+  *out = (char *)malloc(COMPRESS_CHUNK);
+  if (!(*out))
+    return Z_BUF_ERROR;
+
+  strm.avail_in = in_size;
+  strm.next_in = (unsigned char *)in;
+  strm.avail_out = COMPRESS_CHUNK;
+  strm.next_out = (unsigned char *)*out;
+
+  ret = inflate(&strm, Z_NO_FLUSH);
+  assert(ret != Z_STREAM_ERROR); // state not clobbered
+  switch (ret) {
+  case Z_NEED_DICT:
+    ret = Z_DATA_ERROR; // and fall through
+  case Z_DATA_ERROR:
+  case Z_MEM_ERROR:
+    (void)inflateEnd(&strm);
+    return ret;
+  }
+  have = COMPRESS_CHUNK - strm.avail_out;
+  *out_size = have;
+
+  // printf("%i -> %i\n",in_size,have);
+  // printf("%s\n",*out);
+  // clean up and return
+  (void)inflateEnd(&strm);
+  return ret == Z_STREAM_END ? Z_OK : Z_DATA_ERROR;
 }
-void ConnectionLayout::drawDatas(char* buf,int buf_size,uint16_t period,bool big_endian) {
-    for(int i=0;i<dataremotes.count();i++) {
-        dataremotes.at(i)->BufEvent(&buf,&buf_size,period,big_endian);
-    }
-}
-
-int ConnectionLayout::uncompressBuffer(char *in, ssize_t in_size,char **out,ssize_t *out_size) {
-    int ret;
-    unsigned have;
-    z_stream strm;
-
-    // allocate inflate state
-    strm.zalloc = Z_NULL;
-    strm.zfree = Z_NULL;
-    strm.opaque = Z_NULL;
-    strm.avail_in = 0;
-    strm.next_in = Z_NULL;
-    ret = inflateInit(&strm);
-    if (ret != Z_OK)
-        return ret;
-
-    *out=(char*)malloc(COMPRESS_CHUNK);
-    if(!(*out))
-        return Z_BUF_ERROR;
-
-    strm.avail_in = in_size;
-    strm.next_in = (unsigned char*)in;
-    strm.avail_out = COMPRESS_CHUNK;
-    strm.next_out = (unsigned char*)*out;
-
-    ret = inflate(&strm, Z_NO_FLUSH);
-    assert(ret != Z_STREAM_ERROR);  // state not clobbered
-    switch (ret) {
-    case Z_NEED_DICT:
-        ret = Z_DATA_ERROR;     // and fall through
-    case Z_DATA_ERROR:
-    case Z_MEM_ERROR:
-        (void)inflateEnd(&strm);
-        return ret;
-    }
-    have = COMPRESS_CHUNK- strm.avail_out;
-    *out_size=have;
-
-    //printf("%i -> %i\n",in_size,have);
-    //printf("%s\n",*out);
-    // clean up and return
-    (void)inflateEnd(&strm);
-    return ret == Z_STREAM_END ? Z_OK : Z_DATA_ERROR;
-}
Index: trunk/tools/FlairGCS/src/ConnectionLayout.h
===================================================================
--- trunk/tools/FlairGCS/src/ConnectionLayout.h	(revision 14)
+++ trunk/tools/FlairGCS/src/ConnectionLayout.h	(revision 15)
@@ -11,31 +11,32 @@
 class DataRemote;
 
-class ConnectionLayout:  public Layout
-{
-    Q_OBJECT
+class ConnectionLayout : public Layout {
+  Q_OBJECT
 
-    public:
-        ConnectionLayout(UdtSocket* socket,QString name);
-        ~ConnectionLayout();
-        void XmlToSend(QDomDocument doc);
-        void addDataRemote(DataRemote* data);
-        void removeDataRemote(DataRemote* data);
-        void LoadXml(QDomDocument to_parse);
-        QString getRemoteName();
+public:
+  ConnectionLayout(UdtSocket *socket, QString name);
+  ~ConnectionLayout();
+  void XmlToSend(QDomDocument doc);
+  void addDataRemote(DataRemote *data);
+  void removeDataRemote(DataRemote *data);
+  void LoadXml(QDomDocument to_parse);
+  QString getRemoteName();
 
-    private:
-        static int uncompressBuffer(char *in, ssize_t in_size,char **out,ssize_t *out_size);
-        void handleUncompressedFrame(char *buf,ssize_t size);
-        void drawDatas(char* buf,int buf_size,uint16_t period,bool big_endian=false);
-        bool isRemoteNameDefined;
-        QString remoteName;
-        UdtSocket* socket;
-        QList<DataRemote*> dataremotes;
+private:
+  static int uncompressBuffer(char *in, ssize_t in_size, char **out,
+                              ssize_t *out_size);
+  void handleUncompressedFrame(char *buf, ssize_t size);
+  void drawDatas(char *buf, int buf_size, uint16_t period,
+                 bool big_endian = false);
+  bool isRemoteNameDefined;
+  QString remoteName;
+  UdtSocket *socket;
+  QList<DataRemote *> dataremotes;
 
-    private slots:
-        void receive(char* buf,int  size);
+private slots:
+  void receive(char *buf, int size);
 
-    signals:
-        void setRemoteName(QString name);
+signals:
+  void setRemoteName(QString name);
 };
 
Index: trunk/tools/FlairGCS/src/DataPlot1D.cpp
===================================================================
--- trunk/tools/FlairGCS/src/DataPlot1D.cpp	(revision 14)
+++ trunk/tools/FlairGCS/src/DataPlot1D.cpp	(revision 15)
@@ -10,111 +10,121 @@
 #include <qendian.h>
 
-DataPlot1D::DataPlot1D(Layout* parent,int row, int col,QString title,float ymin, float ymax,bool enabled,int period):
-    ScopeFixedStep(title,ymin,ymax,period/1000.),DataRemote(title,"DataPlot1D",parent,enabled,period) {
+DataPlot1D::DataPlot1D(Layout *parent, int row, int col, QString title,
+                       float ymin, float ymax, bool enabled, int period)
+    : ScopeFixedStep(title, ymin, ymax, period / 1000.),
+      DataRemote(title, "DataPlot1D", parent, enabled, period) {
 
-    setEnabled(enabled);
-    parent->addWidget(this,row,col);
-    visible_widget=this;
+  setEnabled(enabled);
+  parent->addWidget(this, row, col);
+  visible_widget = this;
 }
 
 DataPlot1D::~DataPlot1D() {
-    visible_widget=NULL;//because otherwise xmlwidget will delete it
+  visible_widget = NULL; // because otherwise xmlwidget will delete it
 }
 
 void DataPlot1D::XmlEvent(QDomElement dom) {
-    if(dom.attribute("curve")!="") {
-        QString type=dom.attribute("type");
-        int r=dom.attribute("r").toInt();
-        int g=dom.attribute("g").toInt();
-        int b=dom.attribute("b").toInt();
-        QString name=dom.attribute("curve");
-        addCurve(QPen(QColor(r,g,b,255)),name);
-        datas_type.append(type);
-        if(type=="float") {
-            receivesize+=sizeof(float);
-        } else if(type=="int8_t") {
-            receivesize+=sizeof(int8_t);
-        } else if(type=="int16_t") {
-            receivesize+=sizeof(int16_t);
-        } else {
-            printf("MyDataPlot1D::addCurve unknown type %s\n",type.toLocal8Bit().constData());
-        }
+  if (dom.attribute("curve") != "") {
+    QString type = dom.attribute("type");
+    int r = dom.attribute("r").toInt();
+    int g = dom.attribute("g").toInt();
+    int b = dom.attribute("b").toInt();
+    QString name = dom.attribute("curve");
+    addCurve(QPen(QColor(r, g, b, 255)), name);
+    datas_type.append(type);
+    if (type == "float") {
+      receivesize += sizeof(float);
+    } else if (type == "int8_t") {
+      receivesize += sizeof(int8_t);
+    } else if (type == "int16_t") {
+      receivesize += sizeof(int16_t);
     } else {
-        XmlSetup(dom);
+      printf("MyDataPlot1D::addCurve unknown type %s\n",
+             type.toLocal8Bit().constData());
     }
+  } else {
+    XmlSetup(dom);
+  }
 }
 
 bool DataPlot1D::eventFilter(QObject *o, QEvent *e) {
-    if (  o == canvas() ) {
-        switch(e->type()) {
-            case QEvent::Resize: {
-                //resolution bug taille widgets:
-                setMaximumHeight(parentWidget()->height()/((QGridLayout*)(parentWidget()->layout()))->rowCount());
-                break;
-            }
-            case QEvent::MouseButtonPress: {
-                return mouseEvent((QMouseEvent*)e);
-            }
+  if (o == canvas()) {
+    switch (e->type()) {
+    case QEvent::Resize: {
+      // resolution bug taille widgets:
+      setMaximumHeight(parentWidget()->height() /
+                       ((QGridLayout *)(parentWidget()->layout()))->rowCount());
+      break;
+    }
+    case QEvent::MouseButtonPress: {
+      return mouseEvent((QMouseEvent *)e);
+    }
 
-            default:
-                break;
-        }
+    default:
+      break;
     }
-    return Scope::eventFilter(o, e);
+  }
+  return Scope::eventFilter(o, e);
 }
 
-void DataPlot1D::BufEvent(char **buf,int *buf_size,uint16_t period,bool big_endian)
-{
-    setEnabled(IsEnabled());
-    if(IsEnabled()==false || RefreshRate_ms()!=period) return;
-    double* datas=(double*)malloc(datas_type.count()*sizeof(double));
+void DataPlot1D::BufEvent(char **buf, int *buf_size, uint16_t period,
+                          bool big_endian) {
+  setEnabled(IsEnabled());
+  if (IsEnabled() == false || RefreshRate_ms() != period)
+    return;
+  double *datas = (double *)malloc(datas_type.count() * sizeof(double));
 
-    for(int i=0;i<datas_type.count();i++) {
-        if(datas_type.at(i)=="float") {
-            uint32_t data_raw;
-            float* data=(float*)&data_raw;
-            memcpy((void*)&data_raw,*buf,sizeof(uint32_t));
-            *buf+=sizeof(uint32_t);
-            if(big_endian==true) data_raw=qFromBigEndian(data_raw);
-            datas[i]=*data;
-        } else if(datas_type.at(i)=="int8_t") {
-            int8_t data;
-            memcpy((void*)&data,*buf,sizeof(data));
-            *buf+=sizeof(data);
-            datas[i]=data;
-        } else if(datas_type.at(i)=="int16_t") {
-            int16_t data;
-            memcpy((void*)&data,*buf,sizeof(data));
-            *buf+=sizeof(data);
-            if(big_endian==true) data=qFromBigEndian(data);
-            datas[i]=data;
-        } else {
-            printf("DataPlot1D::BufEvent unknown type %s\n",datas_type.at(i).toLocal8Bit().constData());
-        }
+  for (int i = 0; i < datas_type.count(); i++) {
+    if (datas_type.at(i) == "float") {
+      uint32_t data_raw;
+      float *data = (float *)&data_raw;
+      memcpy((void *)&data_raw, *buf, sizeof(uint32_t));
+      *buf += sizeof(uint32_t);
+      if (big_endian == true)
+        data_raw = qFromBigEndian(data_raw);
+      datas[i] = *data;
+    } else if (datas_type.at(i) == "int8_t") {
+      int8_t data;
+      memcpy((void *)&data, *buf, sizeof(data));
+      *buf += sizeof(data);
+      datas[i] = data;
+    } else if (datas_type.at(i) == "int16_t") {
+      int16_t data;
+      memcpy((void *)&data, *buf, sizeof(data));
+      *buf += sizeof(data);
+      if (big_endian == true)
+        data = qFromBigEndian(data);
+      datas[i] = data;
+    } else {
+      printf("DataPlot1D::BufEvent unknown type %s\n",
+             datas_type.at(i).toLocal8Bit().constData());
     }
+  }
 
-    step_s=period/1000.;
-    plot(datas);
+  step_s = period / 1000.;
+  plot(datas);
 }
 
-//context menu
+// context menu
 bool DataPlot1D::mouseEvent(QMouseEvent *event) {
-    if (event->button() == Qt::RightButton) {
-        QMenu *menu = new QMenu("nom", (QwtPlot*)this);
-        QAction *a,*b,*z;
+  if (event->button() == Qt::RightButton) {
+    QMenu *menu = new QMenu("nom", (QwtPlot *)this);
+    QAction *a, *b, *z;
 
-        a=menu->addAction("reset time view");
-        b=menu->addAction("reset y view");
-        menu->addSeparator();
+    a = menu->addAction("reset time view");
+    b = menu->addAction("reset y view");
+    menu->addSeparator();
 
-        appendmenu(menu);
-        z=execmenu((QwtPlot*)this,menu,event->globalPos());
-        delete menu;
+    appendmenu(menu);
+    z = execmenu((QwtPlot *)this, menu, event->globalPos());
+    delete menu;
 
-        if(z==a) resetXView();
-        if(z==b) resetYView();
+    if (z == a)
+      resetXView();
+    if (z == b)
+      resetYView();
 
-        return true;
-    }
-    return false;
+    return true;
+  }
+  return false;
 }
Index: trunk/tools/FlairGCS/src/DataPlot1D.h
===================================================================
--- trunk/tools/FlairGCS/src/DataPlot1D.h	(revision 14)
+++ trunk/tools/FlairGCS/src/DataPlot1D.h	(revision 15)
@@ -9,23 +9,20 @@
 #include "DataRemote.h"
 
-
 class Layout;
 class QMouseEvent;
 
-class DataPlot1D :  public ScopeFixedStep,public DataRemote
-{
-    public:
-        DataPlot1D(Layout* parent,int row, int col,QString title,float ymin, float ymax,bool enabled,int period);
-        ~DataPlot1D();
+class DataPlot1D : public ScopeFixedStep, public DataRemote {
+public:
+  DataPlot1D(Layout *parent, int row, int col, QString title, float ymin,
+             float ymax, bool enabled, int period);
+  ~DataPlot1D();
 
-    private:
-        void XmlEvent(QDomElement dom);
-        bool eventFilter(QObject *, QEvent *);
-        void BufEvent(char** buf,int *buf_size,uint16_t period,bool big_endian);
-        bool mouseEvent(QMouseEvent *event);
-        QList<QString> datas_type;
-
+private:
+  void XmlEvent(QDomElement dom);
+  bool eventFilter(QObject *, QEvent *);
+  void BufEvent(char **buf, int *buf_size, uint16_t period, bool big_endian);
+  bool mouseEvent(QMouseEvent *event);
+  QList<QString> datas_type;
 };
 
-
 #endif // DATAPLOT1D_H_INCLUDED
Index: trunk/tools/FlairGCS/src/DataPlot2D.cpp
===================================================================
--- trunk/tools/FlairGCS/src/DataPlot2D.cpp	(revision 14)
+++ trunk/tools/FlairGCS/src/DataPlot2D.cpp	(revision 15)
@@ -20,213 +20,195 @@
 #include <qendian.h>
 
-DataPlot2D::DataPlot2D(Layout* parent,int row, int col,QString plot_name,QString x_name,QString y_name,float xmin, float xmax,float ymin, float ymax,bool enabled,int period):
-    DataRemote(plot_name,"DataPlot2D",parent,enabled,period)
-{
-    plot=new QwtPlot(NULL);
-    plot->setEnabled(enabled);
-
-    parent->addWidget(plot,row,col);
-    visible_widget=plot;
-
-    view_size=20;//default 20s
-/*
-    // Disable polygon clipping
-    QwtPainter::setDeviceClipping(false);
-
-    // We don't need the cache here
-    plot->canvas()->setPaintAttribute(QwtPlotCanvas::PaintCached, false);
-    plot->canvas()->setPaintAttribute(QwtPlotCanvas::PaintPacked, false);
-*/
+DataPlot2D::DataPlot2D(Layout *parent, int row, int col, QString plot_name,
+                       QString x_name, QString y_name, float xmin, float xmax,
+                       float ymin, float ymax, bool enabled, int period)
+    : DataRemote(plot_name, "DataPlot2D", parent, enabled, period) {
+  plot = new QwtPlot(NULL);
+  plot->setEnabled(enabled);
+
+  parent->addWidget(plot, row, col);
+  visible_widget = plot;
+
+  view_size = 20; // default 20s
+                  /*
+                      // Disable polygon clipping
+                      QwtPainter::setDeviceClipping(false);
+                  
+                      // We don't need the cache here
+                      plot->canvas()->setPaintAttribute(QwtPlotCanvas::PaintCached, false);
+                      plot->canvas()->setPaintAttribute(QwtPlotCanvas::PaintPacked, false);
+                  */
 #if QT_VERSION >= 0x040000
 #ifdef Q_WS_X11
-    /*
-       Qt::WA_PaintOnScreen is only supported for X11, but leads
-       to substantial bugs with Qt 4.2.x/Windows
-     */
-    plot->canvas()->setAttribute(Qt::WA_PaintOnScreen, true);
+  /*
+     Qt::WA_PaintOnScreen is only supported for X11, but leads
+     to substantial bugs with Qt 4.2.x/Windows
+   */
+  plot->canvas()->setAttribute(Qt::WA_PaintOnScreen, true);
 #endif
 #endif
 
-    alignScales();
-
-    //d_x=new QList<double*>;
-    //d_y=new QList<double*>;
-    datas=new QList<QwtPlotCurve*>;
-    datas_type=new QList<QString>;
-
-    // Assign a title
-    plot->setTitle(plot_name);
-
-    // Axis
-    plot->setAxisTitle(QwtPlot::xBottom, x_name);
-    setXAxisScale(xmin,xmax);
-
-    plot->setAxisTitle(QwtPlot::yLeft, y_name);
-    setYAxisScale(ymin,ymax);
-
-    QwtPlotRescaler* rescaler = new QwtPlotRescaler( plot->canvas() );
-    rescaler->setRescalePolicy( QwtPlotRescaler::Fixed );/*
-    rescaler->setReferenceAxis(QwtPlot::xBottom);
-    rescaler->setAspectRatio(QwtPlot::yLeft, 1.0);*/
-
-    // grid
-    QwtPlotGrid *grid = new QwtPlotGrid;
-    //grid->enableXMin(false);
-    grid->setPen(QPen(Qt::black, 0, Qt::DotLine));
-    //grid->setMinPen(QPen(Qt::gray, 0 , Qt::DotLine));
-    grid->attach(plot);
-
-    //zoomer
-    QwtPlotMagnifier * zoomer = new QwtPlotMagnifier(plot->canvas());
-    zoomer->setMouseButton(Qt::RightButton,Qt::ControlModifier);
-
-    //scroller
-    QwtPlotPanner *scroller =new QwtPlotPanner(plot->canvas());
-
-    //legend
-    QwtLegend* new_legend=new QwtLegend();
-    new_legend->setDefaultItemMode(QwtLegendData::Checkable);
-    plot->insertLegend(new_legend, QwtPlot::BottomLegend);
-
-    connect( new_legend, SIGNAL( checked( const QVariant &, bool, int ) ), SLOT( legendChecked( const QVariant &, bool ) ) );
-
-    plot->canvas()->installEventFilter(this);
-}
-
-DataPlot2D::~DataPlot2D()
-{
-    for(int i=0;i<d_x.count();i++)
-    {
-        free(d_x.at(i));
-        free(d_y.at(i));
-    }
-
-    delete datas;
-    delete datas_type;
-}
-
-void DataPlot2D::XmlEvent(QDomElement dom)
-{
-    if(dom.attribute("curve")!="") {
-        QString type=dom.attribute("type");
-        int r=dom.attribute("r").toInt();
-        int g=dom.attribute("g").toInt();
-        int b=dom.attribute("b").toInt();
-        QString name=dom.attribute("curve");
-        addCurve(QPen(QColor(r,g,b,255)),name,type);
-    } else {
-        XmlSetup(dom);
-    }
-}
-
-bool DataPlot2D::eventFilter(QObject *o, QEvent *e)
-{
-    if (  o == plot->canvas() )
-    {
-        switch(e->type())
-        {
-            case QEvent::MouseButtonPress:
-            {
-                mousePressEvent((QMouseEvent*)e);
-                break;
-            }
-
-            default:
-                break;
-        }
-    }
-    return plot->eventFilter(o, e);
-}
-
-void DataPlot2D::legendChecked( const QVariant &itemInfo, bool on )
-{
-    QwtPlotItem *plotItem = plot->infoToItem( itemInfo );
-    if ( plotItem )
-        showCurve( plotItem, on );
-}
-
-void DataPlot2D::showCurve(QwtPlotItem *item, bool on)
-{
-    item->setVisible(on);
-
-    QwtLegend *lgd = qobject_cast<QwtLegend *>( plot->legend() );
-
-    QList<QWidget *> legendWidgets =
-        lgd->legendWidgets( plot->itemToInfo( item ) );
-
-    if ( legendWidgets.size() == 1 )
-    {
-        QwtLegendLabel *legendLabel =
-            qobject_cast<QwtLegendLabel *>( legendWidgets[0] );
-
-        if ( legendLabel )
-            legendLabel->setChecked( on );
-    }
-
-    plot->replot();
-}
-
-void DataPlot2D::addCurve(QPen pen,QString legend,QString type)
-{
-    double* new_dx;
-    new_dx=(double*)malloc(view_size/refresh_rate*sizeof(double));
-    d_x.append(new_dx);
-    double* new_dy;
-    new_dy=(double*)malloc(view_size/refresh_rate*sizeof(double));
-    d_y.append(new_dy);
-
-    //  Initialize data
-    for (int i = 0; i< view_size/refresh_rate; i++) new_dx[i] = 0;
-    for (int i = 0; i< view_size/refresh_rate; i++) new_dy[i] = 0;
-
-    // Insert new curve
-    QwtPlotCurve* new_data;
-
-    new_data = new QwtPlotCurve(legend);
-    new_data->attach(plot);
-    new_data->setPen(pen);
-    datas->append(new_data);
-
-    showCurve(new_data, true);
-
-    datas_type->append(type);
-    bool tmp=true;
-    datas_first_update.append(tmp);
-
-    // Attach (don't copy) data. Both curves use the same x array.
-    new_data->setRawSamples(new_dx, new_dy, view_size/refresh_rate);
-
-    if(type=="float")
-    {
-        receivesize+=sizeof(float);
-    }
-    else if(type=="int8_t")
-    {
-        receivesize+=sizeof(int8_t);
-    }
-    else if(type=="int16_t")
-    {
-        receivesize+=sizeof(int16_t);
-    }
-    else
-    {
-        printf("DataPlot2D::addCurve unknown type %s\n",type.toLocal8Bit().constData());
-    }
-
-}
-
-void DataPlot2D::setXAxisScale(float xmin,float xmax)
-{
-    xmin_orig=xmin;
-    xmax_orig=xmax;
-    plot->setAxisScale(QwtPlot::xBottom, xmin_orig, xmax_orig);
-
-}
-
-void DataPlot2D::setYAxisScale(float ymin,float ymax)
-{
-    ymin_orig=ymin;
-    ymax_orig=ymax;
-    plot->setAxisScale(QwtPlot::yLeft, ymin_orig, ymax_orig);
+  alignScales();
+
+  // d_x=new QList<double*>;
+  // d_y=new QList<double*>;
+  datas = new QList<QwtPlotCurve *>;
+  datas_type = new QList<QString>;
+
+  // Assign a title
+  plot->setTitle(plot_name);
+
+  // Axis
+  plot->setAxisTitle(QwtPlot::xBottom, x_name);
+  setXAxisScale(xmin, xmax);
+
+  plot->setAxisTitle(QwtPlot::yLeft, y_name);
+  setYAxisScale(ymin, ymax);
+
+  QwtPlotRescaler *rescaler = new QwtPlotRescaler(plot->canvas());
+  rescaler->setRescalePolicy(QwtPlotRescaler::Fixed); /*
+ rescaler->setReferenceAxis(QwtPlot::xBottom);
+ rescaler->setAspectRatio(QwtPlot::yLeft, 1.0);*/
+
+  // grid
+  QwtPlotGrid *grid = new QwtPlotGrid;
+  // grid->enableXMin(false);
+  grid->setPen(QPen(Qt::black, 0, Qt::DotLine));
+  // grid->setMinPen(QPen(Qt::gray, 0 , Qt::DotLine));
+  grid->attach(plot);
+
+  // zoomer
+  QwtPlotMagnifier *zoomer = new QwtPlotMagnifier(plot->canvas());
+  zoomer->setMouseButton(Qt::RightButton, Qt::ControlModifier);
+
+  // scroller
+  QwtPlotPanner *scroller = new QwtPlotPanner(plot->canvas());
+
+  // legend
+  QwtLegend *new_legend = new QwtLegend();
+  new_legend->setDefaultItemMode(QwtLegendData::Checkable);
+  plot->insertLegend(new_legend, QwtPlot::BottomLegend);
+
+  connect(new_legend, SIGNAL(checked(const QVariant &, bool, int)),
+          SLOT(legendChecked(const QVariant &, bool)));
+
+  plot->canvas()->installEventFilter(this);
+}
+
+DataPlot2D::~DataPlot2D() {
+  for (int i = 0; i < d_x.count(); i++) {
+    free(d_x.at(i));
+    free(d_y.at(i));
+  }
+
+  delete datas;
+  delete datas_type;
+}
+
+void DataPlot2D::XmlEvent(QDomElement dom) {
+  if (dom.attribute("curve") != "") {
+    QString type = dom.attribute("type");
+    int r = dom.attribute("r").toInt();
+    int g = dom.attribute("g").toInt();
+    int b = dom.attribute("b").toInt();
+    QString name = dom.attribute("curve");
+    addCurve(QPen(QColor(r, g, b, 255)), name, type);
+  } else {
+    XmlSetup(dom);
+  }
+}
+
+bool DataPlot2D::eventFilter(QObject *o, QEvent *e) {
+  if (o == plot->canvas()) {
+    switch (e->type()) {
+    case QEvent::MouseButtonPress: {
+      mousePressEvent((QMouseEvent *)e);
+      break;
+    }
+
+    default:
+      break;
+    }
+  }
+  return plot->eventFilter(o, e);
+}
+
+void DataPlot2D::legendChecked(const QVariant &itemInfo, bool on) {
+  QwtPlotItem *plotItem = plot->infoToItem(itemInfo);
+  if (plotItem)
+    showCurve(plotItem, on);
+}
+
+void DataPlot2D::showCurve(QwtPlotItem *item, bool on) {
+  item->setVisible(on);
+
+  QwtLegend *lgd = qobject_cast<QwtLegend *>(plot->legend());
+
+  QList<QWidget *> legendWidgets = lgd->legendWidgets(plot->itemToInfo(item));
+
+  if (legendWidgets.size() == 1) {
+    QwtLegendLabel *legendLabel =
+        qobject_cast<QwtLegendLabel *>(legendWidgets[0]);
+
+    if (legendLabel)
+      legendLabel->setChecked(on);
+  }
+
+  plot->replot();
+}
+
+void DataPlot2D::addCurve(QPen pen, QString legend, QString type) {
+  double *new_dx;
+  new_dx = (double *)malloc(view_size / refresh_rate * sizeof(double));
+  d_x.append(new_dx);
+  double *new_dy;
+  new_dy = (double *)malloc(view_size / refresh_rate * sizeof(double));
+  d_y.append(new_dy);
+
+  //  Initialize data
+  for (int i = 0; i < view_size / refresh_rate; i++)
+    new_dx[i] = 0;
+  for (int i = 0; i < view_size / refresh_rate; i++)
+    new_dy[i] = 0;
+
+  // Insert new curve
+  QwtPlotCurve *new_data;
+
+  new_data = new QwtPlotCurve(legend);
+  new_data->attach(plot);
+  new_data->setPen(pen);
+  datas->append(new_data);
+
+  showCurve(new_data, true);
+
+  datas_type->append(type);
+  bool tmp = true;
+  datas_first_update.append(tmp);
+
+  // Attach (don't copy) data. Both curves use the same x array.
+  new_data->setRawSamples(new_dx, new_dy, view_size / refresh_rate);
+
+  if (type == "float") {
+    receivesize += sizeof(float);
+  } else if (type == "int8_t") {
+    receivesize += sizeof(int8_t);
+  } else if (type == "int16_t") {
+    receivesize += sizeof(int16_t);
+  } else {
+    printf("DataPlot2D::addCurve unknown type %s\n",
+           type.toLocal8Bit().constData());
+  }
+}
+
+void DataPlot2D::setXAxisScale(float xmin, float xmax) {
+  xmin_orig = xmin;
+  xmax_orig = xmax;
+  plot->setAxisScale(QwtPlot::xBottom, xmin_orig, xmax_orig);
+}
+
+void DataPlot2D::setYAxisScale(float ymin, float ymax) {
+  ymin_orig = ymin;
+  ymax_orig = ymax;
+  plot->setAxisScale(QwtPlot::yLeft, ymin_orig, ymax_orig);
 }
 
@@ -234,164 +216,165 @@
 //  Set a plain canvas frame and align the scales to it
 //
-void DataPlot2D::alignScales(void)
-{
-    // The code below shows how to align the scales to
-    // the canvas frame, but is also a good example demonstrating
-    // why the spreaded API needs polishing.
-/*
-    plot->canvas()->setFrameStyle(QFrame::Box | QFrame::Plain );
-    plot->canvas()->setLineWidth(1);
-*/
-    for ( int i = 0; i < QwtPlot::axisCnt; i++ )
-    {
-        QwtScaleWidget *scaleWidget = (QwtScaleWidget *)plot->axisWidget(i);
-        if ( scaleWidget )
-            scaleWidget->setMargin(0);
-
-        QwtScaleDraw *scaleDraw = (QwtScaleDraw *)plot->axisScaleDraw(i);
-        if ( scaleDraw )
-            scaleDraw->enableComponent(QwtAbstractScaleDraw::Backbone, false);
-    }
-}
-
-void DataPlot2D::BufEvent(char **buf,int *buf_size,uint16_t period,bool big_endian)
-{
-    plot->setEnabled(IsEnabled());
-    if(IsEnabled()==false || RefreshRate_ms()!=period) return;
-
-    for(int i=0;i<datas->count();i++)
-    {
-        if(datas_type->at(i)=="float")
-        {
-            uint32_t data1_raw;
-            float* data1=(float*)&data1_raw;
-            uint32_t data2_raw;
-            float* data2=(float*)&data2_raw;
-
-            memcpy((void*)&data1_raw,*buf,sizeof(uint32_t));
-            *buf+=sizeof(uint32_t);
-            memcpy((void*)&data2_raw,*buf,sizeof(uint32_t));
-            *buf+=sizeof(uint32_t);
-            if(big_endian==true) data1_raw=qFromBigEndian(data1_raw);
-            if(big_endian==true) data2_raw=qFromBigEndian(data2_raw);
-            plot_data(*data1,*data2,i);
+void DataPlot2D::alignScales(void) {
+  // The code below shows how to align the scales to
+  // the canvas frame, but is also a good example demonstrating
+  // why the spreaded API needs polishing.
+  /*
+      plot->canvas()->setFrameStyle(QFrame::Box | QFrame::Plain );
+      plot->canvas()->setLineWidth(1);
+  */
+  for (int i = 0; i < QwtPlot::axisCnt; i++) {
+    QwtScaleWidget *scaleWidget = (QwtScaleWidget *)plot->axisWidget(i);
+    if (scaleWidget)
+      scaleWidget->setMargin(0);
+
+    QwtScaleDraw *scaleDraw = (QwtScaleDraw *)plot->axisScaleDraw(i);
+    if (scaleDraw)
+      scaleDraw->enableComponent(QwtAbstractScaleDraw::Backbone, false);
+  }
+}
+
+void DataPlot2D::BufEvent(char **buf, int *buf_size, uint16_t period,
+                          bool big_endian) {
+  plot->setEnabled(IsEnabled());
+  if (IsEnabled() == false || RefreshRate_ms() != period)
+    return;
+
+  for (int i = 0; i < datas->count(); i++) {
+    if (datas_type->at(i) == "float") {
+      uint32_t data1_raw;
+      float *data1 = (float *)&data1_raw;
+      uint32_t data2_raw;
+      float *data2 = (float *)&data2_raw;
+
+      memcpy((void *)&data1_raw, *buf, sizeof(uint32_t));
+      *buf += sizeof(uint32_t);
+      memcpy((void *)&data2_raw, *buf, sizeof(uint32_t));
+      *buf += sizeof(uint32_t);
+      if (big_endian == true)
+        data1_raw = qFromBigEndian(data1_raw);
+      if (big_endian == true)
+        data2_raw = qFromBigEndian(data2_raw);
+      plot_data(*data1, *data2, i);
+    } else if (datas_type->at(i) == "int8_t") {
+      int8_t data1, data2;
+      memcpy((void *)&data1, *buf, sizeof(data1));
+      *buf += sizeof(data1);
+      memcpy((void *)&data2, *buf, sizeof(data2));
+      *buf += sizeof(data2);
+      plot_data(data1, data2, i);
+    } else if (datas_type->at(i) == "int16_t") {
+      int16_t data1, data2;
+      memcpy((void *)&data1, *buf, sizeof(data1));
+      *buf += sizeof(data1);
+      memcpy((void *)&data2, *buf, sizeof(data2));
+      *buf += sizeof(data2);
+      plot_data(data1, data2, i);
+    } else {
+      printf("DataPlot1D::DrawDatas type non connu\n");
+    }
+  }
+
+  plot->replot();
+}
+
+void DataPlot2D::plot_data(double data_x, double data_y, int index) {
+  if (index < d_y.count()) {
+    if (datas_first_update.at(index) == false) {
+      // Shift y array left and assign new value to y[view_size/refresh_rate -
+      // 1].
+      for (int j = 0; j < view_size / refresh_rate - 1; j++)
+        d_y.at(index)[j] = d_y.at(index)[j + 1];
+      for (int j = 0; j < view_size / refresh_rate - 1; j++)
+        d_x.at(index)[j] = d_x.at(index)[j + 1];
+      d_y.at(index)[(int)(view_size / refresh_rate) - 1] = data_y;
+      d_x.at(index)[(int)(view_size / refresh_rate) - 1] = data_x;
+    } else {
+      for (int j = 0; j <= view_size / refresh_rate - 1; j++)
+        d_y.at(index)[j] = data_y;
+      for (int j = 0; j <= view_size / refresh_rate - 1; j++)
+        d_x.at(index)[j] = data_x;
+      datas_first_update[index] = false;
+    }
+  }
+}
+
+// context menu
+void DataPlot2D::mousePressEvent(QMouseEvent *event) {
+  if (event->button() == Qt::RightButton) {
+
+    QMenu *menu = new QMenu("nom", plot);
+    // ajout des actions
+    QAction *a, *z, *d;
+
+    a = menu->addAction("reset zoom");
+    menu->addSeparator();
+
+    d = menu->addAction(QString("set view size (%1s)").arg(view_size));
+
+    appendmenu(menu);
+    z = execmenu(plot, menu, event->globalPos());
+    delete menu;
+
+    if (z == a) {
+      // zoom to original size
+      plot->setAxisScale(QwtPlot::yLeft, ymin_orig, ymax_orig);
+      plot->setAxisScale(QwtPlot::xBottom, xmin_orig, xmax_orig);
+    }
+
+    if (z == d) {
+      bool ok;
+      float time = QInputDialog::getInt(
+          plot, QString("Set view size (%1)").arg(plot->title().text()),
+          tr("Value (s):"), view_size, 1, 65535, 10, &ok);
+      if (ok == true) {
+        for (int i = 0; i < datas->count(); i++) {
+          if (time > view_size) {
+            double *buf =
+                (double *)malloc(time / refresh_rate * sizeof(double));
+            d_x[i] = (double *)realloc(d_x.at(i),
+                                       time / refresh_rate * sizeof(double));
+            memcpy(buf, d_x[i], (view_size / refresh_rate) * sizeof(double));
+            memcpy(&d_x[i][(int)(time / refresh_rate) -
+                           (int)(view_size / refresh_rate)],
+                   buf, (view_size / refresh_rate) * sizeof(double));
+            d_y[i] = (double *)realloc(d_y.at(i),
+                                       time / refresh_rate * sizeof(double));
+            memcpy(buf, d_y[i], (view_size / refresh_rate) * sizeof(double));
+            memcpy(&d_y[i][(int)(time / refresh_rate) -
+                           (int)(view_size / refresh_rate)],
+                   buf, (view_size / refresh_rate) * sizeof(double));
+            free(buf);
+            for (int j = 0; j < (int)(time / refresh_rate) -
+                                    (int)(view_size / refresh_rate);
+                 j++) {
+              d_x.at(i)[j] = d_x.at(i)[(int)(time / refresh_rate) -
+                                       (int)(view_size / refresh_rate) + 1];
+              d_y.at(i)[j] = d_y.at(i)[(int)(time / refresh_rate) -
+                                       (int)(view_size / refresh_rate) + 1];
+            }
+          } else {
+            double *buf =
+                (double *)malloc(time / refresh_rate * sizeof(double));
+            memcpy(buf, &d_x[i][(int)(view_size / refresh_rate) -
+                                (int)(time / refresh_rate)],
+                   (time / refresh_rate) * sizeof(double));
+            d_x[i] = (double *)realloc(d_x.at(i),
+                                       time / refresh_rate * sizeof(double));
+            memcpy(d_x[i], buf, (time / refresh_rate) * sizeof(double));
+            memcpy(buf, &d_y[i][(int)(view_size / refresh_rate) -
+                                (int)(time / refresh_rate)],
+                   (time / refresh_rate) * sizeof(double));
+            d_y[i] = (double *)realloc(d_y.at(i),
+                                       time / refresh_rate * sizeof(double));
+            memcpy(d_y[i], buf, (time / refresh_rate) * sizeof(double));
+            free(buf);
+          }
+          datas->at(i)
+              ->setRawSamples(d_x.at(i), d_y.at(i), time / refresh_rate);
         }
-        else if(datas_type->at(i)=="int8_t")
-        {
-            int8_t data1,data2;
-            memcpy((void*)&data1,*buf,sizeof(data1));
-            *buf+=sizeof(data1);
-            memcpy((void*)&data2,*buf,sizeof(data2));
-            *buf+=sizeof(data2);
-            plot_data(data1,data2,i);
-        }
-        else if(datas_type->at(i)=="int16_t")
-        {
-            int16_t data1,data2;
-            memcpy((void*)&data1,*buf,sizeof(data1));
-            *buf+=sizeof(data1);
-            memcpy((void*)&data2,*buf,sizeof(data2));
-            *buf+=sizeof(data2);
-            plot_data(data1,data2,i);
-        }
-        else
-        {
-            printf("DataPlot1D::DrawDatas type non connu\n");
-        }
-    }
-
-    plot->replot();
-}
-
-void DataPlot2D::plot_data(double data_x,double data_y,int index)
-{
-    if(index<d_y.count())
-    {
-        if(datas_first_update.at(index)==false)
-        {
-            // Shift y array left and assign new value to y[view_size/refresh_rate - 1].
-            for ( int j = 0; j < view_size/refresh_rate - 1; j++ ) d_y.at(index)[j] = d_y.at(index)[j+1] ;
-            for ( int j = 0; j < view_size/refresh_rate - 1; j++ ) d_x.at(index)[j] = d_x.at(index)[j+1] ;
-            d_y.at(index)[(int)(view_size/refresh_rate) - 1] = data_y;
-            d_x.at(index)[(int)(view_size/refresh_rate) - 1] = data_x;
-        }
-        else
-        {
-            for ( int j = 0; j <= view_size/refresh_rate - 1; j++ ) d_y.at(index)[j] = data_y;
-            for ( int j = 0; j <= view_size/refresh_rate - 1; j++ ) d_x.at(index)[j] = data_x;
-            datas_first_update[index]=false;
-        }
-    }
-}
-
-
-//context menu
-void DataPlot2D::mousePressEvent(QMouseEvent *event)
-{
-    if (event->button() == Qt::RightButton)
-    {
-
-        QMenu * menu = new QMenu("nom", plot);
-        // ajout des actions
-        QAction *a,*z,*d;
-
-        a=menu->addAction("reset zoom");
-        menu->addSeparator();
-
-        d=menu->addAction(QString("set view size (%1s)").arg(view_size));
-
-        appendmenu(menu);
-        z=execmenu(plot,menu,event->globalPos());
-        delete menu;
-
-        if(z==a)
-        {
-            //zoom to original size
-            plot->setAxisScale(QwtPlot::yLeft, ymin_orig, ymax_orig);
-            plot->setAxisScale(QwtPlot::xBottom, xmin_orig, xmax_orig);
-        }
-
-        if(z==d)
-        {
-            bool ok;
-            float time = QInputDialog::getInt(plot, QString("Set view size (%1)").arg(plot->title().text()),tr("Value (s):"), view_size, 1, 65535, 10, &ok);
-            if(ok==true)
-            {
-                for(int i=0;i<datas->count();i++)
-                {
-                    if(time>view_size)
-                    {
-                        double* buf=(double*)malloc(time/refresh_rate*sizeof(double));
-                        d_x[i]=(double*)realloc(d_x.at(i),time/refresh_rate*sizeof(double));
-                        memcpy(buf,d_x[i],(view_size/refresh_rate)*sizeof(double));
-                        memcpy(&d_x[i][(int)(time/refresh_rate)-(int)(view_size/refresh_rate)],buf,(view_size/refresh_rate)*sizeof(double));
-                        d_y[i]=(double*)realloc(d_y.at(i),time/refresh_rate*sizeof(double));
-                        memcpy(buf,d_y[i],(view_size/refresh_rate)*sizeof(double));
-                        memcpy(&d_y[i][(int)(time/refresh_rate)-(int)(view_size/refresh_rate)],buf,(view_size/refresh_rate)*sizeof(double));
-                        free(buf);
-                        for(int j=0;j<(int)(time/refresh_rate)-(int)(view_size/refresh_rate);j++)
-                        {
-                            d_x.at(i)[j]=d_x.at(i)[(int)(time/refresh_rate)-(int)(view_size/refresh_rate)+1];
-                            d_y.at(i)[j]=d_y.at(i)[(int)(time/refresh_rate)-(int)(view_size/refresh_rate)+1];
-                        }
-                    }
-                    else
-                    {
-                        double* buf=(double*)malloc(time/refresh_rate*sizeof(double));
-                        memcpy(buf,&d_x[i][(int)(view_size/refresh_rate)-(int)(time/refresh_rate)],(time/refresh_rate)*sizeof(double));
-                        d_x[i]=(double*)realloc(d_x.at(i),time/refresh_rate*sizeof(double));
-                        memcpy(d_x[i],buf,(time/refresh_rate)*sizeof(double));
-                        memcpy(buf,&d_y[i][(int)(view_size/refresh_rate)-(int)(time/refresh_rate)],(time/refresh_rate)*sizeof(double));
-                        d_y[i]=(double*)realloc(d_y.at(i),time/refresh_rate*sizeof(double));
-                        memcpy(d_y[i],buf,(time/refresh_rate)*sizeof(double));
-                        free(buf);
-                    }
-                    datas->at(i)->setRawSamples(d_x.at(i), d_y.at(i), time/refresh_rate);
-
-                }
-                view_size=time;
-
-            }
-        }
-    }
-}
+        view_size = time;
+      }
+    }
+  }
+}
Index: trunk/tools/FlairGCS/src/DataPlot2D.h
===================================================================
--- trunk/tools/FlairGCS/src/DataPlot2D.h	(revision 14)
+++ trunk/tools/FlairGCS/src/DataPlot2D.h	(revision 15)
@@ -16,40 +16,40 @@
 class QMouseEvent;
 
-class DataPlot2D :  public DataRemote
-{
-    Q_OBJECT
+class DataPlot2D : public DataRemote {
+  Q_OBJECT
 
-    public:
-        DataPlot2D(Layout* parent,int row, int col,QString plot_name,QString x_name,QString y_name,float xmin, float xmax,float ymin, float ymax,bool enabled,int period);
-        ~DataPlot2D();
-        void addCurve(QPen pen,QString legend,QString type);
+public:
+  DataPlot2D(Layout *parent, int row, int col, QString plot_name,
+             QString x_name, QString y_name, float xmin, float xmax, float ymin,
+             float ymax, bool enabled, int period);
+  ~DataPlot2D();
+  void addCurve(QPen pen, QString legend, QString type);
 
-    protected:
-         void mousePressEvent(QMouseEvent *event);
+protected:
+  void mousePressEvent(QMouseEvent *event);
 
-    private:
-        QwtPlot* plot;
-        void XmlEvent(QDomElement dom);
-        void alignScales(void);
-        void plot_data(double data_x,double data_y,int index);
-        float xmin_orig,xmax_orig,ymin_orig,ymax_orig;
+private:
+  QwtPlot *plot;
+  void XmlEvent(QDomElement dom);
+  void alignScales(void);
+  void plot_data(double data_x, double data_y, int index);
+  float xmin_orig, xmax_orig, ymin_orig, ymax_orig;
 
-        QList<QwtPlotCurve*> *datas;
-        QList<QString> *datas_type;
-        QList<bool> datas_first_update;
-        QList<double*> d_x;
-        QList<double*> d_y;
-        double view_size;//en s
+  QList<QwtPlotCurve *> *datas;
+  QList<QString> *datas_type;
+  QList<bool> datas_first_update;
+  QList<double *> d_x;
+  QList<double *> d_y;
+  double view_size; // en s
 
-        bool eventFilter(QObject *, QEvent *);
-        void setYAxisScale(float ymin,float ymax);
-        void setXAxisScale(float xmin,float xmax);
-        void BufEvent(char** buf,int *buf_size,uint16_t period,bool big_endian);
-        void showCurve(QwtPlotItem *item, bool on);
+  bool eventFilter(QObject *, QEvent *);
+  void setYAxisScale(float ymin, float ymax);
+  void setXAxisScale(float xmin, float xmax);
+  void BufEvent(char **buf, int *buf_size, uint16_t period, bool big_endian);
+  void showCurve(QwtPlotItem *item, bool on);
 
-    private slots:
-        void legendChecked( const QVariant &itemInfo, bool on );
+private slots:
+  void legendChecked(const QVariant &itemInfo, bool on);
 };
 
-
 #endif // DATAPLOT2D_H_INCLUDED
Index: trunk/tools/FlairGCS/src/DataRemote.cpp
===================================================================
--- trunk/tools/FlairGCS/src/DataRemote.cpp	(revision 14)
+++ trunk/tools/FlairGCS/src/DataRemote.cpp	(revision 15)
@@ -10,87 +10,88 @@
 #include "ConnectionLayout.h"
 
-DataRemote::DataRemote(QString name,QString type,XmlWidget* parent,bool enabled,int period):XmlWidget(name,type,parent) {
-    auto_refresh=enabled;
-    is_logging=true;
-    receivesize=0;
-    refresh_rate=(double)period/1000.;
+DataRemote::DataRemote(QString name, QString type, XmlWidget *parent,
+                       bool enabled, int period)
+    : XmlWidget(name, type, parent) {
+  auto_refresh = enabled;
+  is_logging = true;
+  receivesize = 0;
+  refresh_rate = (double)period / 1000.;
 
-    connectionLayout()->addDataRemote(this);
+  connectionLayout()->addDataRemote(this);
 
-    //pour ne pas faire de doublons qd on change la periode
-    SetIsExpandable(true);
+  // pour ne pas faire de doublons qd on change la periode
+  SetIsExpandable(true);
 }
 
-DataRemote::~DataRemote() {
-    connectionLayout()->removeDataRemote(this);
+DataRemote::~DataRemote() { connectionLayout()->removeDataRemote(this); }
+
+void DataRemote::appendmenu(QMenu *menu) {
+  menu->addSeparator();
+
+  b = menu->addAction("auto refresh");
+  b->setCheckable(true);
+  b->setChecked(auto_refresh);
+
+  c = menu->addAction(QString("set refresh rate (%1ms)")
+                          .arg((uint16_t)(qRound(refresh_rate * 1000))));
+  c->setEnabled(auto_refresh);
+  menu->addSeparator();
+
+  d = menu->addAction("log");
+  d->setCheckable(true);
+  d->setChecked(is_logging);
 }
 
-void DataRemote::appendmenu(QMenu * menu) {
-    menu->addSeparator();
+QAction *DataRemote::execmenu(QWidget *parent, QMenu *menu, QPoint point) {
+  QAction *z;
 
-    b=menu->addAction("auto refresh");
-    b->setCheckable(true);
-    b->setChecked(auto_refresh);
+  z = menu->exec(point);
 
-    c=menu->addAction(QString("set refresh rate (%1ms)").arg((uint16_t)(qRound(refresh_rate*1000))));
-    c->setEnabled(auto_refresh);
-    menu->addSeparator();
+  // auto_refresh=b->isChecked();
 
-    d=menu->addAction("log");
-    d->setCheckable(true);
-    d->setChecked(is_logging);
-}
+  if (z == b) {
+    SendPeriod(RefreshRate_ms(), b->isChecked());
+  }
 
-QAction* DataRemote::execmenu(QWidget* parent,QMenu * menu,QPoint point) {
-    QAction *z;
+  if (z == c) {
+    bool ok;
+    // uint16_t time = QInputDialog::getInt(this, QString("Set refresh rate
+    // (%1)").arg(title().text()),tr("Value (ms):"),
+    // (uint16_t)(qRound(refresh_rate*1000)), 1, 65535, 10, &ok);
+    uint16_t time = QInputDialog::getInt(
+        parent, "Set refresh rate ", "Value (ms):",
+        (uint16_t)(qRound(refresh_rate * 1000)), 1, 65535, 10, &ok);
+    if (ok == true && time != qRound(refresh_rate * 1000)) {
+      // refresh_rate=time/1000.;
+      SendPeriod(time, b->isChecked());
+    }
+  }
 
-    z=menu->exec(point);
-
-    //auto_refresh=b->isChecked();
-
-    if(z==b) {
-        SendPeriod(RefreshRate_ms(),b->isChecked());
-    }
-
-    if(z==c) {
-        bool ok;
-        //uint16_t time = QInputDialog::getInt(this, QString("Set refresh rate (%1)").arg(title().text()),tr("Value (ms):"), (uint16_t)(qRound(refresh_rate*1000)), 1, 65535, 10, &ok);
-        uint16_t time = QInputDialog::getInt(parent, "Set refresh rate ","Value (ms):", (uint16_t)(qRound(refresh_rate*1000)), 1, 65535, 10, &ok);
-        if(ok==true && time!=qRound(refresh_rate*1000)) {
-            //refresh_rate=time/1000.;
-            SendPeriod(time,b->isChecked());
-        }
-    }
-
-    return z;
+  return z;
 }
 
 uint16_t DataRemote::RefreshRate_ms(void) {
-    return (uint16_t)(qRound(refresh_rate*1000.));
+  return (uint16_t)(qRound(refresh_rate * 1000.));
 }
 
-bool DataRemote::IsEnabled(void) {
-    return auto_refresh;
+bool DataRemote::IsEnabled(void) { return auto_refresh; }
+
+void DataRemote::SendPeriod(int period, bool auto_refresh) {
+  SetAttribute("period", period);
+  SetAttribute("enabled", auto_refresh);
+
+  connectionLayout()->XmlToSend(XmlDoc());
+
+  RemoveAttribute("period");
+  RemoveAttribute("enabled");
 }
 
-void DataRemote::SendPeriod(int period,bool auto_refresh) {
-    SetAttribute("period", period);
-    SetAttribute("enabled", auto_refresh);
-
-    connectionLayout()->XmlToSend(XmlDoc());
-
-    RemoveAttribute("period");
-    RemoveAttribute("enabled");
-}
-
-int DataRemote::ReceiveSize(void) {
-    return receivesize;
-}
+int DataRemote::ReceiveSize(void) { return receivesize; }
 
 void DataRemote::XmlSetup(QDomElement dom) {
-    refresh_rate=dom.attribute("period").toInt()/1000.;
-    if(dom.attribute("enabled")=="1")
-        auto_refresh=true;
-    else
-        auto_refresh=false;
+  refresh_rate = dom.attribute("period").toInt() / 1000.;
+  if (dom.attribute("enabled") == "1")
+    auto_refresh = true;
+  else
+    auto_refresh = false;
 }
Index: trunk/tools/FlairGCS/src/DataRemote.h
===================================================================
--- trunk/tools/FlairGCS/src/DataRemote.h	(revision 14)
+++ trunk/tools/FlairGCS/src/DataRemote.h	(revision 15)
@@ -13,27 +13,28 @@
 class QAction;
 
-class DataRemote: public XmlWidget
-{
-    public:
-        DataRemote(QString name,QString type,XmlWidget* parent,bool enabled,int period);
-        ~DataRemote();
-        uint16_t RefreshRate_ms(void);
-        bool IsEnabled(void);
-        int ReceiveSize(void);
-        virtual void BufEvent(char** buf,int *buf_size,uint16_t period,bool big_endian)=0;
-        void appendmenu(QMenu * menu);
-        QAction* execmenu(QWidget* parent,QMenu * menu,QPoint point);
+class DataRemote : public XmlWidget {
+public:
+  DataRemote(QString name, QString type, XmlWidget *parent, bool enabled,
+             int period);
+  ~DataRemote();
+  uint16_t RefreshRate_ms(void);
+  bool IsEnabled(void);
+  int ReceiveSize(void);
+  virtual void BufEvent(char **buf, int *buf_size, uint16_t period,
+                        bool big_endian) = 0;
+  void appendmenu(QMenu *menu);
+  QAction *execmenu(QWidget *parent, QMenu *menu, QPoint point);
 
-    protected:
-        bool auto_refresh;
-        bool is_logging;
-        double refresh_rate;//en s
-        int receivesize;
+protected:
+  bool auto_refresh;
+  bool is_logging;
+  double refresh_rate; // en s
+  int receivesize;
 
-        void XmlSetup(QDomElement dom);
+  void XmlSetup(QDomElement dom);
 
-    private:
-        void SendPeriod(int period,bool auto_refresh);
-        QAction *b,*c,*d;
+private:
+  void SendPeriod(int period, bool auto_refresh);
+  QAction *b, *c, *d;
 };
 
Index: trunk/tools/FlairGCS/src/DoubleSpinBox.cpp
===================================================================
--- trunk/tools/FlairGCS/src/DoubleSpinBox.cpp	(revision 14)
+++ trunk/tools/FlairGCS/src/DoubleSpinBox.cpp	(revision 15)
@@ -11,121 +11,108 @@
 #include <QFormLayout>
 
-DoubleSpinBox::DoubleSpinBox(Layout* parent,int row, int col,QString name,QString suffix,QString value,float min,float max,float step,int decimals): FormLayout(parent,row,col,name,"DoubleSpinBox")
-{
-    doublespinbox = new QDoubleSpinBox();
+DoubleSpinBox::DoubleSpinBox(Layout *parent, int row, int col, QString name,
+                             QString suffix, QString value, float min,
+                             float max, float step, int decimals)
+    : FormLayout(parent, row, col, name, "DoubleSpinBox") {
+  doublespinbox = new QDoubleSpinBox();
 
-    doublespinbox->setRange(min,max);
-    doublespinbox->setSingleStep(step);
-    doublespinbox->setDecimals(decimals);
-    if(suffix!="") doublespinbox->setSuffix(suffix);
-    adjust_decimals(value);
-    doublespinbox->setValue(value.toDouble());
-    doublespinbox_value=doublespinbox->cleanText();
+  doublespinbox->setRange(min, max);
+  doublespinbox->setSingleStep(step);
+  doublespinbox->setDecimals(decimals);
+  if (suffix != "")
+    doublespinbox->setSuffix(suffix);
+  adjust_decimals(value);
+  doublespinbox->setValue(value.toDouble());
+  doublespinbox_value = doublespinbox->cleanText();
 
-    //event filter for qdoublespinbox and its child (qlinedit and incremnt qbuttons)
-    doublespinbox->installEventFilter(this);
-    QObjectList o_list = doublespinbox->children();
-    for(int i = 0; i < o_list.length(); i++)
-    {
-        QLineEdit *cast = qobject_cast<QLineEdit*>(o_list[i]);
-        if(cast)
-            cast->installEventFilter(this);
-    }
+  // event filter for qdoublespinbox and its child (qlinedit and incremnt
+  // qbuttons)
+  doublespinbox->installEventFilter(this);
+  QObjectList o_list = doublespinbox->children();
+  for (int i = 0; i < o_list.length(); i++) {
+    QLineEdit *cast = qobject_cast<QLineEdit *>(o_list[i]);
+    if (cast)
+      cast->installEventFilter(this);
+  }
 
-    object_layout->addRow(name,doublespinbox);
+  object_layout->addRow(name, doublespinbox);
 
-    connect(doublespinbox,SIGNAL(valueChanged(const QString &)),this, SLOT(valuechanged(const QString &)));
+  connect(doublespinbox, SIGNAL(valueChanged(const QString &)), this,
+          SLOT(valuechanged(const QString &)));
 
-    SetValue(value);
+  SetValue(value);
 }
 
-DoubleSpinBox::~DoubleSpinBox()
-{
-    delete doublespinbox;
+DoubleSpinBox::~DoubleSpinBox() { delete doublespinbox; }
+
+void DoubleSpinBox::adjust_decimals(QString value) {
+  // auto adjust decimals
+  QLocale locale;
+  value.remove(locale.groupSeparator());
+
+  QStringList parts = value.split(locale.decimalPoint());
+  if (parts.count() == 2) {
+    doublespinbox->setDecimals(parts[1].size());
+  }
 }
 
-void DoubleSpinBox::adjust_decimals(QString value)
-{
-    //auto adjust decimals
-    QLocale locale;
-    value.remove(locale.groupSeparator());
+bool DoubleSpinBox::eventFilter(QObject *object, QEvent *event) {
+  if (object == doublespinbox && event->type() == QEvent::MouseButtonPress) {
+    if (((QMouseEvent *)event)->button() == Qt::RightButton) {
+      QMenu *menu = new QMenu("menu", doublespinbox);
+      QAction *a, *b, *c, *z;
 
-    QStringList parts = value.split(locale.decimalPoint());
-    if(parts.count() == 2)
-    {
-        doublespinbox->setDecimals(parts[1].size());
+      a = menu->addAction("add decimal");
+      b = menu->addAction("remove decimal");
+
+      if (doublespinbox->decimals() == 0)
+        b->setEnabled(false);
+      z = menu->exec(((QMouseEvent *)event)->globalPos());
+
+      if (z == a)
+        doublespinbox->setDecimals(doublespinbox->decimals() + 1);
+      if (z == b)
+        doublespinbox->setDecimals(doublespinbox->decimals() - 1);
+      delete menu;
+      return true;
     }
+  }
+
+  return object->eventFilter(object, event);
 }
 
-bool DoubleSpinBox::eventFilter(QObject *object, QEvent *event)
-{
-    if(object==doublespinbox && event->type()==QEvent::MouseButtonPress)
-    {
-        if (((QMouseEvent*)event)->button() == Qt::RightButton)
-        {
-            QMenu * menu = new QMenu("menu", doublespinbox);
-            QAction *a,*b,*c,*z;
-
-            a=menu->addAction("add decimal");
-            b=menu->addAction("remove decimal");
-
-            if(doublespinbox->decimals()==0) b->setEnabled(false);
-            z=menu->exec(((QMouseEvent*)event)->globalPos());
-
-            if(z==a) doublespinbox->setDecimals(doublespinbox->decimals()+1);
-            if(z==b) doublespinbox->setDecimals(doublespinbox->decimals()-1);
-            delete menu;
-            return true;
-        }
-    }
-
-    return object->eventFilter(object, event);
+void DoubleSpinBox::SetUptodate(void) {
+  ui_to_var();
+  ui_to_xml();
+  visible_widget->setPalette(black_pal);
 }
 
-void DoubleSpinBox::SetUptodate(void)
-{
-    ui_to_var();
-    ui_to_xml();
-    visible_widget->setPalette(black_pal);
+void DoubleSpinBox::ui_to_var(void) {
+  doublespinbox_value = doublespinbox->cleanText();
 }
 
-void DoubleSpinBox::ui_to_var(void)
-{
-    doublespinbox_value=doublespinbox->cleanText();
+void DoubleSpinBox::ui_to_xml(void) { SetValue(doublespinbox->cleanText()); }
+
+void DoubleSpinBox::Reset(void) {
+  // le setvalue fait un arrondi pour l'affichage, la variable n'est donc plus
+  // egale
+  // on reprend la valeur de la boite et on force la couleur a noir
+  adjust_decimals(doublespinbox_value);
+  doublespinbox->setValue(doublespinbox_value.toDouble());
+  doublespinbox_value = doublespinbox->cleanText();
+  visible_widget->setPalette(black_pal);
 }
 
-void DoubleSpinBox::ui_to_xml(void)
-{
-    SetValue(doublespinbox->cleanText());
+void DoubleSpinBox::LoadEvent(QDomElement dom) {
+  if (doublespinbox->isEnabled() == true) {
+    doublespinbox->setValue((dom.attribute("value")).toDouble());
+  }
 }
 
-void DoubleSpinBox::Reset(void)
-{
-    //le setvalue fait un arrondi pour l'affichage, la variable n'est donc plus egale
-    //on reprend la valeur de la boite et on force la couleur a noir
-    adjust_decimals(doublespinbox_value);
-    doublespinbox->setValue(doublespinbox_value.toDouble());
-    doublespinbox_value= doublespinbox->cleanText();
+void DoubleSpinBox::valuechanged(const QString &value) {
+  if (value != doublespinbox_value) {
+    visible_widget->setPalette(red_pal);
+  } else {
     visible_widget->setPalette(black_pal);
-
+  }
 }
-
-void DoubleSpinBox::LoadEvent(QDomElement dom)
-{
-    if(doublespinbox->isEnabled()==true)
-    {
-        doublespinbox->setValue((dom.attribute("value")).toDouble());
-    }
-}
-
-void DoubleSpinBox::valuechanged(const QString &value)
-{
-    if(value!=doublespinbox_value)
-    {
-        visible_widget->setPalette(red_pal);
-    }
-    else
-    {
-        visible_widget->setPalette(black_pal);
-    }
-}
Index: trunk/tools/FlairGCS/src/DoubleSpinBox.h
===================================================================
--- trunk/tools/FlairGCS/src/DoubleSpinBox.h	(revision 14)
+++ trunk/tools/FlairGCS/src/DoubleSpinBox.h	(revision 15)
@@ -11,26 +11,26 @@
 class QDoubleSpinBox;
 
-class DoubleSpinBox: public FormLayout
-{
-    Q_OBJECT
+class DoubleSpinBox : public FormLayout {
+  Q_OBJECT
 
-    public:
-        //handle value as string, becouse double value are not exact
-        DoubleSpinBox(Layout* parent,int row, int col,QString name,QString suffix,QString value,float min,float max,float step,int decimals);
-        ~DoubleSpinBox();
+public:
+  // handle value as string, becouse double value are not exact
+  DoubleSpinBox(Layout *parent, int row, int col, QString name, QString suffix,
+                QString value, float min, float max, float step, int decimals);
+  ~DoubleSpinBox();
 
-    private:
-        QDoubleSpinBox* doublespinbox;
-        QString doublespinbox_value;
-        void SetUptodate(void);
-        void Reset(void);
-        void LoadEvent(QDomElement dom);
-        void ui_to_var(void);
-        void ui_to_xml(void);
-        bool eventFilter(QObject *o, QEvent *e);
-        void adjust_decimals(QString value);
+private:
+  QDoubleSpinBox *doublespinbox;
+  QString doublespinbox_value;
+  void SetUptodate(void);
+  void Reset(void);
+  void LoadEvent(QDomElement dom);
+  void ui_to_var(void);
+  void ui_to_xml(void);
+  bool eventFilter(QObject *o, QEvent *e);
+  void adjust_decimals(QString value);
 
-    private slots:
-        void valuechanged(const QString &value);
+private slots:
+  void valuechanged(const QString &value);
 };
 
Index: trunk/tools/FlairGCS/src/FormLayout.cpp
===================================================================
--- trunk/tools/FlairGCS/src/FormLayout.cpp	(revision 14)
+++ trunk/tools/FlairGCS/src/FormLayout.cpp	(revision 15)
@@ -9,57 +9,56 @@
 #include <QEvent>
 
-FormLayout::FormLayout(Layout* parent,int row, int col,QString name,QString type):XmlWidget(name,type,parent)
-{
-    visible_widget=new QWidget();
+FormLayout::FormLayout(Layout *parent, int row, int col, QString name,
+                       QString type)
+    : XmlWidget(name, type, parent) {
+  visible_widget = new QWidget();
 
-    //create a grid to put label and object
-    visible_widget->setObjectName(name);
+  // create a grid to put label and object
+  visible_widget->setObjectName(name);
 
-    parent->addWidget(visible_widget,row,col);
-    object_layout = new QFormLayout(visible_widget);
-    object_layout->setHorizontalSpacing(2);
-    object_layout->setVerticalSpacing(2);
-    object_layout->setContentsMargins (2,2,2,2);
+  parent->addWidget(visible_widget, row, col);
+  object_layout = new QFormLayout(visible_widget);
+  object_layout->setHorizontalSpacing(2);
+  object_layout->setVerticalSpacing(2);
+  object_layout->setContentsMargins(2, 2, 2, 2);
 
-    visible_widget->installEventFilter(this);
+  visible_widget->installEventFilter(this);
 }
 
-FormLayout::~FormLayout()
-{
+FormLayout::~FormLayout() {}
+
+bool FormLayout::IsUptodate(void) {
+  // si le widget n'est pas enabled, sa palette est differente de rouge (greyed)
+  // donc on renvoit true
+  // permet de ne pas envoyer les modifs d'un widget disabled
+  // if(label->palette()==red_pal) return false;
+  if (visible_widget->palette() == red_pal)
+    return false;
+  return true;
 }
 
-bool FormLayout::IsUptodate(void)
-{
-    //si le widget n'est pas enabled, sa palette est differente de rouge (greyed) donc on renvoit true
-    //permet de ne pas envoyer les modifs d'un widget disabled
-    //if(label->palette()==red_pal) return false;
-    if(visible_widget->palette()==red_pal) return false;
-    return true;
+bool FormLayout::eventFilter(QObject *o, QEvent *e) {
+  if (o == visible_widget) {
+    switch (e->type()) {
+    case QEvent::EnabledChange: {
+      QPalette palette = visible_widget->palette();
+      QPalette result;
+
+      if (palette == red_pal)
+        result = red_pal_greyed;
+      if (palette == red_pal_greyed)
+        result = red_pal;
+      if (palette == black_pal)
+        result = black_pal_greyed;
+      if (palette == black_pal_greyed)
+        result = black_pal;
+
+      visible_widget->setPalette(result);
+    }
+
+    default:
+      break;
+    }
+  }
+  return QObject::eventFilter(o, e);
 }
-
-bool FormLayout::eventFilter(QObject *o, QEvent *e)
-{
-    if (  o == visible_widget )
-    {
-        switch(e->type())
-        {
-            case QEvent::EnabledChange:
-            {
-                QPalette palette=visible_widget->palette();
-                QPalette result;
-
-                if(palette==red_pal) result=red_pal_greyed;
-                if(palette==red_pal_greyed) result=red_pal;
-                if(palette==black_pal) result=black_pal_greyed;
-                if(palette==black_pal_greyed) result=black_pal;
-
-                visible_widget->setPalette(result);
-            }
-
-            default:
-                break;
-        }
-
-    }
-    return QObject::eventFilter(o, e);
-}
Index: trunk/tools/FlairGCS/src/FormLayout.h
===================================================================
--- trunk/tools/FlairGCS/src/FormLayout.h	(revision 14)
+++ trunk/tools/FlairGCS/src/FormLayout.h	(revision 15)
@@ -11,18 +11,17 @@
 class Layout;
 
-class FormLayout: public XmlWidget
-{
+class FormLayout : public XmlWidget {
 
-    public:
-        FormLayout(Layout* parent,int row, int col,QString name,QString type);
-        ~FormLayout();
+public:
+  FormLayout(Layout *parent, int row, int col, QString name, QString type);
+  ~FormLayout();
 
-    private:
-        bool IsUptodate(void);
-        virtual void SetUptodate(void)=0;
-        bool eventFilter(QObject *o, QEvent *e);
+private:
+  bool IsUptodate(void);
+  virtual void SetUptodate(void) = 0;
+  bool eventFilter(QObject *o, QEvent *e);
 
-    protected:
-        QFormLayout* object_layout;
+protected:
+  QFormLayout *object_layout;
 };
 
Index: trunk/tools/FlairGCS/src/GridLayout.cpp
===================================================================
--- trunk/tools/FlairGCS/src/GridLayout.cpp	(revision 14)
+++ trunk/tools/FlairGCS/src/GridLayout.cpp	(revision 15)
@@ -7,19 +7,15 @@
 #include <QGridLayout>
 
-GridLayout::GridLayout(Layout* parent,int row, int col,QString name): Layout(parent,name,"GridLayout")
-{
-    widget = new QWidget();
-    widget->setObjectName(name);
+GridLayout::GridLayout(Layout *parent, int row, int col, QString name)
+    : Layout(parent, name, "GridLayout") {
+  widget = new QWidget();
+  widget->setObjectName(name);
 
-    visible_widget=widget;
+  visible_widget = widget;
 
-    parent->addWidget(widget,row,col);
+  parent->addWidget(widget, row, col);
 
-    widget->setLayout(getQGridLayout());
+  widget->setLayout(getQGridLayout());
 }
 
-
-GridLayout::~GridLayout()
-{
-    widget->setParent(NULL);
-}
+GridLayout::~GridLayout() { widget->setParent(NULL); }
Index: trunk/tools/FlairGCS/src/GridLayout.h
===================================================================
--- trunk/tools/FlairGCS/src/GridLayout.h	(revision 14)
+++ trunk/tools/FlairGCS/src/GridLayout.h	(revision 15)
@@ -8,13 +8,12 @@
 #include "Layout.h"
 
-class GridLayout: public Layout
-{
+class GridLayout : public Layout {
 
-    public:
-        GridLayout(Layout* parent,int row, int col,QString name);
-        ~GridLayout();
+public:
+  GridLayout(Layout *parent, int row, int col, QString name);
+  ~GridLayout();
 
-    private:
-        QWidget* widget;
+private:
+  QWidget *widget;
 };
 
Index: trunk/tools/FlairGCS/src/GroupBox.cpp
===================================================================
--- trunk/tools/FlairGCS/src/GroupBox.cpp	(revision 14)
+++ trunk/tools/FlairGCS/src/GroupBox.cpp	(revision 15)
@@ -7,25 +7,23 @@
 #include <QGridLayout>
 
-GroupBox::GroupBox(Layout* parent,int row, int col,QString name): Layout(parent,name,"GroupBox")
-{
-    //creation et ajout QGroupBox
-    box = new QGroupBox(name);
-    box->setObjectName(name);
+GroupBox::GroupBox(Layout *parent, int row, int col, QString name)
+    : Layout(parent, name, "GroupBox") {
+  // creation et ajout QGroupBox
+  box = new QGroupBox(name);
+  box->setObjectName(name);
 
-    visible_widget=box;
+  visible_widget = box;
 
-    parent->addWidget(box,row,col);
-    //parent->splitter->addWidget(box);
+  parent->addWidget(box, row, col);
+  // parent->splitter->addWidget(box);
 
-    box->setLayout(getQGridLayout());
+  box->setLayout(getQGridLayout());
 }
 
+GroupBox::~GroupBox() {
+  // layout->removeItem(this);//ne semble pas necessaire
 
-GroupBox::~GroupBox()
-{
-    //layout->removeItem(this);//ne semble pas necessaire
-
-    box->setParent(NULL);//sinon le delete layout detruit aussi this
-    //delete layout;
-    //delete box;
+  box->setParent(NULL); // sinon le delete layout detruit aussi this
+  // delete layout;
+  // delete box;
 }
Index: trunk/tools/FlairGCS/src/GroupBox.h
===================================================================
--- trunk/tools/FlairGCS/src/GroupBox.h	(revision 14)
+++ trunk/tools/FlairGCS/src/GroupBox.h	(revision 15)
@@ -10,13 +10,12 @@
 class QGroupBox;
 
-class GroupBox: public Layout
-{
+class GroupBox : public Layout {
 
-    public:
-        GroupBox(Layout* parent,int row, int col,QString name);
-        ~GroupBox();
+public:
+  GroupBox(Layout *parent, int row, int col, QString name);
+  ~GroupBox();
 
-    private:
-        QGroupBox* box;
+private:
+  QGroupBox *box;
 };
 
Index: trunk/tools/FlairGCS/src/Label.cpp
===================================================================
--- trunk/tools/FlairGCS/src/Label.cpp	(revision 14)
+++ trunk/tools/FlairGCS/src/Label.cpp	(revision 15)
@@ -7,24 +7,20 @@
 #include <QLabel>
 
-Label::Label(Layout* parent,int row, int col,QString name):XmlWidget(name,"Label",parent)
-{
+Label::Label(Layout *parent, int row, int col, QString name)
+    : XmlWidget(name, "Label", parent) {
 
-    label = new QLabel();
-    label->setObjectName(name);
-    visible_widget=label;
+  label = new QLabel();
+  label->setObjectName(name);
+  visible_widget = label;
 
-    parent->addWidget(label,row,col);
+  parent->addWidget(label, row, col);
 
-    //pour ne pas faire de doublons qd on change le texte
-    SetIsExpandable(true);
+  // pour ne pas faire de doublons qd on change le texte
+  SetIsExpandable(true);
 }
 
-Label::~Label()
-{
+Label::~Label() {}
 
+void Label::XmlEvent(QDomElement dom) {
+  label->setText(dom.attribute("value"));
 }
-
-void Label::XmlEvent(QDomElement dom)
-{
-    label->setText(dom.attribute("value"));
-}
Index: trunk/tools/FlairGCS/src/Label.h
===================================================================
--- trunk/tools/FlairGCS/src/Label.h	(revision 14)
+++ trunk/tools/FlairGCS/src/Label.h	(revision 15)
@@ -11,15 +11,12 @@
 class QLabel;
 
-class Label: public XmlWidget
-{
-    public:
-        Label(Layout* parent,int row, int col,QString name);
-        ~Label();
+class Label : public XmlWidget {
+public:
+  Label(Layout *parent, int row, int col, QString name);
+  ~Label();
 
-    private:
-        void XmlEvent(QDomElement dom);
-        QLabel *label;
-
-
+private:
+  void XmlEvent(QDomElement dom);
+  QLabel *label;
 };
 
Index: trunk/tools/FlairGCS/src/Landmark.cpp
===================================================================
--- trunk/tools/FlairGCS/src/Landmark.cpp	(revision 14)
+++ trunk/tools/FlairGCS/src/Landmark.cpp	(revision 15)
@@ -11,66 +11,50 @@
 using namespace QtMobility;
 
-Landmark::Landmark(QGraphicsGeoMap *geoMap, const QGeoCoordinate &coordinate,QString name,QString type)
-{
-    geoMap->addMapObject(this);
-    this->geoMap=geoMap;
-    pixmap = new QGeoMapPixmapObject();
-    pixmap->setCoordinate(coordinate);
+Landmark::Landmark(QGraphicsGeoMap *geoMap, const QGeoCoordinate &coordinate,
+                   QString name, QString type) {
+  geoMap->addMapObject(this);
+  this->geoMap = geoMap;
+  pixmap = new QGeoMapPixmapObject();
+  pixmap->setCoordinate(coordinate);
 
-    if(type=="cross")
-    {
-        pixmap->setOffset(QPoint(-16, -16));
-        pixmap->setPixmap(QPixmap(":cross.png"));
-    }
-    else
-    {
-        pixmap->setOffset(QPoint(-2, -30));
-        pixmap->setPixmap(QPixmap(":landmark.png"));
-    }
-    addChildObject(pixmap);
+  if (type == "cross") {
+    pixmap->setOffset(QPoint(-16, -16));
+    pixmap->setPixmap(QPixmap(":cross.png"));
+  } else {
+    pixmap->setOffset(QPoint(-2, -30));
+    pixmap->setPixmap(QPixmap(":landmark.png"));
+  }
+  addChildObject(pixmap);
 
-    QFont font;
-    font.setWeight(QFont::Bold);
-    text = new QGeoMapTextObject(coordinate,name, font, QPoint(0, 10));
-    text->setPen(QPen(Qt::NoPen));
-    text->setBrush(QBrush(Qt::red));
-    addChildObject(text);
+  QFont font;
+  font.setWeight(QFont::Bold);
+  text = new QGeoMapTextObject(coordinate, name, font, QPoint(0, 10));
+  text->setPen(QPen(Qt::NoPen));
+  text->setBrush(QBrush(Qt::red));
+  addChildObject(text);
 }
 
-Landmark::~Landmark()
-{
-    geoMap->removeMapObject(this);
-    clearChildObjects();
+Landmark::~Landmark() {
+  geoMap->removeMapObject(this);
+  clearChildObjects();
 }
 
-void Landmark::setText(QString string)
-{
-    text->setText(string);
+void Landmark::setText(QString string) { text->setText(string); }
+
+void Landmark::setColor(Qt::GlobalColor color) {
+  text->setBrush(QBrush(color));
 }
 
-void Landmark::setColor(Qt::GlobalColor color)
-{
-    text->setBrush(QBrush(color));
+void Landmark::setCoordinate(const QGeoCoordinate &coordinate) {
+  pixmap->setCoordinate(coordinate);
+  text->setCoordinate(coordinate);
 }
 
-void Landmark::setCoordinate(const QGeoCoordinate &coordinate)
-{
-    pixmap->setCoordinate(coordinate);
-    text->setCoordinate(coordinate);
+QGeoCoordinate Landmark::coordinate(void) { return pixmap->coordinate(); }
+
+void Landmark::RemoveLandmark(void) { geoMap->removeMapObject(this); }
+
+void Landmark::AddLandmark(QGraphicsGeoMap *geoMap) {
+  geoMap->addMapObject(this);
+  this->geoMap = geoMap;
 }
-
-QGeoCoordinate Landmark::coordinate(void)
-{
-    return pixmap->coordinate();
-}
-
-void Landmark::RemoveLandmark(void)
-{
-    geoMap->removeMapObject(this);
-}
-
-void Landmark::AddLandmark(QGraphicsGeoMap *geoMap)
-{
-    geoMap->addMapObject(this);
-    this->geoMap=geoMap;
-}
Index: trunk/tools/FlairGCS/src/Landmark.h
===================================================================
--- trunk/tools/FlairGCS/src/Landmark.h	(revision 14)
+++ trunk/tools/FlairGCS/src/Landmark.h	(revision 15)
@@ -10,28 +10,28 @@
 
 namespace QtMobility {
-    class QGraphicsGeoMap;
-    class QGeoMapTextObject;
-    class QGeoMapPixmapObject;
+class QGraphicsGeoMap;
+class QGeoMapTextObject;
+class QGeoMapPixmapObject;
 }
 
-
-class Landmark : public QtMobility::QGeoMapGroupObject
-{
+class Landmark : public QtMobility::QGeoMapGroupObject {
 
 public:
-    Landmark(QtMobility::QGraphicsGeoMap *geoMap,const QtMobility::QGeoCoordinate &coordinate,QString name,QString type="landmark");
-    ~Landmark();
+  Landmark(QtMobility::QGraphicsGeoMap *geoMap,
+           const QtMobility::QGeoCoordinate &coordinate, QString name,
+           QString type = "landmark");
+  ~Landmark();
 
-    QtMobility::QGeoCoordinate coordinate(void);
-    void setCoordinate(const QtMobility::QGeoCoordinate &coordinate);
-    void setText(QString string);
-    void setColor(Qt::GlobalColor color);
-    void RemoveLandmark(void);
-    void AddLandmark(QtMobility::QGraphicsGeoMap *geoMap);
+  QtMobility::QGeoCoordinate coordinate(void);
+  void setCoordinate(const QtMobility::QGeoCoordinate &coordinate);
+  void setText(QString string);
+  void setColor(Qt::GlobalColor color);
+  void RemoveLandmark(void);
+  void AddLandmark(QtMobility::QGraphicsGeoMap *geoMap);
 
 private:
-    QtMobility::QGeoMapTextObject* text;
-    QtMobility::QGeoMapPixmapObject* pixmap;
-    QtMobility::QGraphicsGeoMap *geoMap;
+  QtMobility::QGeoMapTextObject *text;
+  QtMobility::QGeoMapPixmapObject *pixmap;
+  QtMobility::QGraphicsGeoMap *geoMap;
 };
 
Index: trunk/tools/FlairGCS/src/Layout.cpp
===================================================================
--- trunk/tools/FlairGCS/src/Layout.cpp	(revision 14)
+++ trunk/tools/FlairGCS/src/Layout.cpp	(revision 15)
@@ -23,230 +23,242 @@
 #include <QGridLayout>
 
-
-Layout::Layout(QWidget* parent,XmlWidget* xml,QString name,QString type): XmlWidget(name,type,xml) {
-    qgridlayout=new QGridLayout(parent);
-    Constructor(name);
-}
-
-Layout::Layout(Layout* parent,QString name,QString type): XmlWidget(name,type,parent) {
-    qgridlayout=new QGridLayout(new QWidget());
-    Constructor(name);
+Layout::Layout(QWidget *parent, XmlWidget *xml, QString name, QString type)
+    : XmlWidget(name, type, xml) {
+  qgridlayout = new QGridLayout(parent);
+  Constructor(name);
+}
+
+Layout::Layout(Layout *parent, QString name, QString type)
+    : XmlWidget(name, type, parent) {
+  qgridlayout = new QGridLayout(new QWidget());
+  Constructor(name);
 }
 
 void Layout::Constructor(QString name) {
-    visible_widget=qgridlayout->parentWidget();
-    //if(visible_widget==NULL) printf("null\n");
-    qgridlayout->setObjectName(name);
-    //printf("layout\n%s\n",XmlDoc().toString().toLocal8Bit().constData());
-    SetIsContainer(true);
-    SetIsExpandable(true);
-
-    qgridlayout->setHorizontalSpacing(2);
-    qgridlayout->setVerticalSpacing(2);
-    qgridlayout->setContentsMargins (2,2,2,2);
-
-    //splitter = new QSplitter();
-    //addWidget(splitter);
-    /*
-    QWidget *widget = new QWidget();
-    //QHBoxLayout *parentLayout = new QHBoxLayout();
-    widget->setLayout(this);
-    parent->addWidget(widget);
-    //QTabWidget *tabWidget = new QTabWidget();
-    //parentLayout->addWidget(tabWidget);*/
-}
-
-Layout::~Layout() {
-    delete qgridlayout;
-}
+  visible_widget = qgridlayout->parentWidget();
+  // if(visible_widget==NULL) printf("null\n");
+  qgridlayout->setObjectName(name);
+  // printf("layout\n%s\n",XmlDoc().toString().toLocal8Bit().constData());
+  SetIsContainer(true);
+  SetIsExpandable(true);
+
+  qgridlayout->setHorizontalSpacing(2);
+  qgridlayout->setVerticalSpacing(2);
+  qgridlayout->setContentsMargins(2, 2, 2, 2);
+
+  // splitter = new QSplitter();
+  // addWidget(splitter);
+  /*
+  QWidget *widget = new QWidget();
+  //QHBoxLayout *parentLayout = new QHBoxLayout();
+  widget->setLayout(this);
+  parent->addWidget(widget);
+  //QTabWidget *tabWidget = new QTabWidget();
+  //parentLayout->addWidget(tabWidget);*/
+}
+
+Layout::~Layout() { delete qgridlayout; }
 
 void Layout::addWidget(QWidget *widget, int row, int column) {
-    qgridlayout->addWidget(widget,row,column);
-}
-
-QGridLayout* Layout::getQGridLayout() {
-    return qgridlayout;
-}
+  qgridlayout->addWidget(widget, row, column);
+}
+
+QGridLayout *Layout::getQGridLayout() { return qgridlayout; }
 
 void Layout::XmlEvent(QDomElement dom) {
-    XmlWidget* widget=NULL;
-    QString type=dom.tagName();
-    QString name=dom.attribute("name");
-    QString old_name=dom.attribute("old_name");
-    int row=dom.attribute("row").toInt();
-    int col=dom.attribute("col").toInt();
-
-//initially rowCount()=1 and columnCount()=1 but count()=0 !
-    //new row
-    if(row==-1 && col==-1) {
-        row=qgridlayout->rowCount();
-        if(qgridlayout->count()==0) row=0;
-        col=0;
-    }
-    //last row last col
-    if(row==-1 && col==0) {
-        row=qgridlayout->rowCount()-1;
-        int i;
-        for(i=0;i<=qgridlayout->columnCount();i++) {
-            if(qgridlayout->itemAtPosition(row,i)==NULL) break;
-        }
-        col=i;
-    }
-    //if an item already exists at this position, put it on a new row
-    if(qgridlayout->itemAtPosition(row,col)!=NULL) {
-        printf("existe %s\n",name.toLocal8Bit().constData());
-        row=qgridlayout->rowCount();
-    }
-
-    if(type=="TabWidget") {
-        int position=dom.attribute("position").toInt();
-        widget = new TabWidget(this,row,col,name,(QTabWidget::TabPosition)position);
-    }
-    if(type=="GroupBox") {
-        widget = new GroupBox(this,row,col,name);
-    }
-    if(type=="GridLayout") {
-        widget = new GridLayout(this,row,col,name);
-    }
-    if(type=="SpinBox") {
-        int value=dom.attribute("value").toInt();
-        QString suffix=dom.attribute("suffix");
-        int min=dom.attribute("min").toInt();
-        int max=dom.attribute("max").toInt();
-        int step=dom.attribute("step").toInt();
-        widget= new SpinBox(this,row,col,name,suffix,value,min,max,step);
-    }
-    if(type=="DoubleSpinBox") {
-        QString value=dom.attribute("value");
-        QString suffix=dom.attribute("suffix");
-        double min=dom.attribute("min").toDouble();
-        double max=dom.attribute("max").toDouble();
-        double step=dom.attribute("step").toDouble();
-        int decimals=dom.attribute("decimals").toInt();
-        widget= new DoubleSpinBox(this,row,col,name,suffix,value,min,max,step,decimals);
-    }
-    if(type=="Vector3DSpinBox") {
-        QString value[3];
-        value[0]=dom.attribute("value_x");
-        value[1]=dom.attribute("value_y");
-        value[2]=dom.attribute("value_z");
-        double min=dom.attribute("min").toDouble();
-        double max=dom.attribute("max").toDouble();
-        double step=dom.attribute("step").toDouble();
-        int decimals=dom.attribute("decimals").toInt();
-        widget= new Vector3DSpinBox(this,row,col,name,value,min,max,step,decimals);
-    }
-    if(type=="CheckBox") {
-        int value=dom.attribute("value").toInt();
-        widget= new CheckBox(this,row,col,name,value);
-    }
-    if(type=="ComboBox") {
-        int value=dom.attribute("value").toInt();
-        widget= new ComboBox(this,row,col,name,value);
-    }
-    if(type=="PushButton") {
-        widget= new PushButton(this,row,col,name);
-    }
-    if(type=="DataPlot1D") {
-        float ymin=dom.attribute("min").toFloat();
-        float ymax=dom.attribute("max").toFloat();
-        int enabled=dom.attribute("enabled").toInt();
-        int period=dom.attribute("period").toInt();
-        if(enabled==1) {
-            widget = new DataPlot1D(this,row,col,name,ymin,ymax,true,period);
-        } else {
-            widget = new DataPlot1D(this,row,col,name,ymin,ymax,false,100);
-        }
-    }
-    if(type=="DataPlot2D") {
-        float xmin=dom.attribute("xmin").toFloat();
-        float xmax=dom.attribute("xmax").toFloat();
-        float ymin=dom.attribute("ymin").toFloat();
-        float ymax=dom.attribute("ymax").toFloat();
-        QString x_name=dom.attribute("x_name");
-        QString y_name=dom.attribute("y_name");
-        int enabled=dom.attribute("enabled").toInt();
-        int period=dom.attribute("period").toInt();
-        if(enabled==1) {
-            widget = new DataPlot2D(this,row,col,name,x_name,y_name,xmin,xmax,ymin,ymax,true,period);
-        } else {
-            widget = new DataPlot2D(this,row,col,name,x_name,y_name,xmin,xmax,ymin,ymax,false,100);
-        }
-    }
-    if(type=="RangeFinderPlot") {
-        float xmin=dom.attribute("xmin").toFloat();
-        float xmax=dom.attribute("xmax").toFloat();
-        float ymin=dom.attribute("ymin").toFloat();
-        float ymax=dom.attribute("ymax").toFloat();
-        QString x_name=dom.attribute("x_name");
-        QString y_name=dom.attribute("y_name");
-        QString data_type=dom.attribute("type");
-        float start_angle=dom.attribute("start_angle").toFloat();
-        float end_angle=dom.attribute("end_angle").toFloat();
-        uint32_t nb_samples=dom.attribute("nb_samples").toUInt();
-        int enabled=dom.attribute("enabled").toInt();
-        int period=dom.attribute("period").toInt();
-        int invert_axis=dom.attribute("invert_axis").toInt();
-        bool invert_axis_bool;
-        if(invert_axis==0) {
-            invert_axis_bool=false;
-        }else {
-            invert_axis_bool=true;
-        }
-        if(enabled==1) {
-            widget = new RangeFinderPlot(this,row,col,name,x_name,y_name,xmin,xmax,ymin,ymax,start_angle,end_angle,nb_samples,data_type,invert_axis,true,period);
-        } else {
-            widget = new RangeFinderPlot(this,row,col,name,x_name,y_name,xmin,xmax,ymin,ymax,start_angle,end_angle,nb_samples,data_type,invert_axis,false,100);
-        }
-    }
-    if(type=="Picture") {
-        int width=dom.attribute("width").toInt();
-        int height=dom.attribute("height").toInt();
-        int enabled=dom.attribute("enabled").toInt();
-        int period=dom.attribute("period").toInt();
-        if(enabled==1) {
-            widget = new Picture(this,row,col,name,width,height,true,period);
-        } else {
-            widget = new Picture(this,row,col,name,width,height,false,period);
-        }
-    }
-    if(type=="Map") {
-        int period=dom.attribute("period").toInt();
-        int enabled=dom.attribute("enabled").toInt();
-        int i=0;
-        QList<QtMobility::QGeoCoordinate> coordinates;
-        while(dom.hasAttribute("lat" +QString::number(i))) {
-            double latitude=dom.attribute("lat"+QString::number(i)).toDouble();
-            double longitude=dom.attribute("long"+QString::number(i)).toDouble();
-            double alt=dom.attribute("alt"+QString::number(i)).toDouble();
-            QtMobility::QGeoCoordinate coordinate=QtMobility::QGeoCoordinate(latitude,longitude,alt);
-            coordinates.append(coordinate);
-            i++;
-        }
-
-        if(enabled==1) {
-            widget = new Map(this,row,col,name,coordinates,true,period);
-        } else {
-            widget = new Map(this,row,col,name,coordinates,false,period);
-        }
-    }
-    if(type=="TextEdit") {
-        widget= new TextEdit(this,row,col,name);
-    }
-    if(type=="Label") {
-        widget= new Label(this,row,col,name);
-    }
-
-    if(widget!=NULL) {
-        if(old_name!="") {
-            widget->RenamedFrom(old_name);
-        }
-    }
+  XmlWidget *widget = NULL;
+  QString type = dom.tagName();
+  QString name = dom.attribute("name");
+  QString old_name = dom.attribute("old_name");
+  int row = dom.attribute("row").toInt();
+  int col = dom.attribute("col").toInt();
+
+  // initially rowCount()=1 and columnCount()=1 but count()=0 !
+  // new row
+  if (row == -1 && col == -1) {
+    row = qgridlayout->rowCount();
+    if (qgridlayout->count() == 0)
+      row = 0;
+    col = 0;
+  }
+  // last row last col
+  if (row == -1 && col == 0) {
+    row = qgridlayout->rowCount() - 1;
+    int i;
+    for (i = 0; i <= qgridlayout->columnCount(); i++) {
+      if (qgridlayout->itemAtPosition(row, i) == NULL)
+        break;
+    }
+    col = i;
+  }
+  // if an item already exists at this position, put it on a new row
+  if (qgridlayout->itemAtPosition(row, col) != NULL) {
+    printf("existe %s\n", name.toLocal8Bit().constData());
+    row = qgridlayout->rowCount();
+  }
+
+  if (type == "TabWidget") {
+    int position = dom.attribute("position").toInt();
+    widget =
+        new TabWidget(this, row, col, name, (QTabWidget::TabPosition)position);
+  }
+  if (type == "GroupBox") {
+    widget = new GroupBox(this, row, col, name);
+  }
+  if (type == "GridLayout") {
+    widget = new GridLayout(this, row, col, name);
+  }
+  if (type == "SpinBox") {
+    int value = dom.attribute("value").toInt();
+    QString suffix = dom.attribute("suffix");
+    int min = dom.attribute("min").toInt();
+    int max = dom.attribute("max").toInt();
+    int step = dom.attribute("step").toInt();
+    widget = new SpinBox(this, row, col, name, suffix, value, min, max, step);
+  }
+  if (type == "DoubleSpinBox") {
+    QString value = dom.attribute("value");
+    QString suffix = dom.attribute("suffix");
+    double min = dom.attribute("min").toDouble();
+    double max = dom.attribute("max").toDouble();
+    double step = dom.attribute("step").toDouble();
+    int decimals = dom.attribute("decimals").toInt();
+    widget = new DoubleSpinBox(this, row, col, name, suffix, value, min, max,
+                               step, decimals);
+  }
+  if (type == "Vector3DSpinBox") {
+    QString value[3];
+    value[0] = dom.attribute("value_x");
+    value[1] = dom.attribute("value_y");
+    value[2] = dom.attribute("value_z");
+    double min = dom.attribute("min").toDouble();
+    double max = dom.attribute("max").toDouble();
+    double step = dom.attribute("step").toDouble();
+    int decimals = dom.attribute("decimals").toInt();
+    widget = new Vector3DSpinBox(this, row, col, name, value, min, max, step,
+                                 decimals);
+  }
+  if (type == "CheckBox") {
+    int value = dom.attribute("value").toInt();
+    widget = new CheckBox(this, row, col, name, value);
+  }
+  if (type == "ComboBox") {
+    int value = dom.attribute("value").toInt();
+    widget = new ComboBox(this, row, col, name, value);
+  }
+  if (type == "PushButton") {
+    widget = new PushButton(this, row, col, name);
+  }
+  if (type == "DataPlot1D") {
+    float ymin = dom.attribute("min").toFloat();
+    float ymax = dom.attribute("max").toFloat();
+    int enabled = dom.attribute("enabled").toInt();
+    int period = dom.attribute("period").toInt();
+    if (enabled == 1) {
+      widget = new DataPlot1D(this, row, col, name, ymin, ymax, true, period);
+    } else {
+      widget = new DataPlot1D(this, row, col, name, ymin, ymax, false, 100);
+    }
+  }
+  if (type == "DataPlot2D") {
+    float xmin = dom.attribute("xmin").toFloat();
+    float xmax = dom.attribute("xmax").toFloat();
+    float ymin = dom.attribute("ymin").toFloat();
+    float ymax = dom.attribute("ymax").toFloat();
+    QString x_name = dom.attribute("x_name");
+    QString y_name = dom.attribute("y_name");
+    int enabled = dom.attribute("enabled").toInt();
+    int period = dom.attribute("period").toInt();
+    if (enabled == 1) {
+      widget = new DataPlot2D(this, row, col, name, x_name, y_name, xmin, xmax,
+                              ymin, ymax, true, period);
+    } else {
+      widget = new DataPlot2D(this, row, col, name, x_name, y_name, xmin, xmax,
+                              ymin, ymax, false, 100);
+    }
+  }
+  if (type == "RangeFinderPlot") {
+    float xmin = dom.attribute("xmin").toFloat();
+    float xmax = dom.attribute("xmax").toFloat();
+    float ymin = dom.attribute("ymin").toFloat();
+    float ymax = dom.attribute("ymax").toFloat();
+    QString x_name = dom.attribute("x_name");
+    QString y_name = dom.attribute("y_name");
+    QString data_type = dom.attribute("type");
+    float start_angle = dom.attribute("start_angle").toFloat();
+    float end_angle = dom.attribute("end_angle").toFloat();
+    uint32_t nb_samples = dom.attribute("nb_samples").toUInt();
+    int enabled = dom.attribute("enabled").toInt();
+    int period = dom.attribute("period").toInt();
+    int invert_axis = dom.attribute("invert_axis").toInt();
+    bool invert_axis_bool;
+    if (invert_axis == 0) {
+      invert_axis_bool = false;
+    } else {
+      invert_axis_bool = true;
+    }
+    if (enabled == 1) {
+      widget =
+          new RangeFinderPlot(this, row, col, name, x_name, y_name, xmin, xmax,
+                              ymin, ymax, start_angle, end_angle, nb_samples,
+                              data_type, invert_axis, true, period);
+    } else {
+      widget =
+          new RangeFinderPlot(this, row, col, name, x_name, y_name, xmin, xmax,
+                              ymin, ymax, start_angle, end_angle, nb_samples,
+                              data_type, invert_axis, false, 100);
+    }
+  }
+  if (type == "Picture") {
+    int width = dom.attribute("width").toInt();
+    int height = dom.attribute("height").toInt();
+    int enabled = dom.attribute("enabled").toInt();
+    int period = dom.attribute("period").toInt();
+    if (enabled == 1) {
+      widget = new Picture(this, row, col, name, width, height, true, period);
+    } else {
+      widget = new Picture(this, row, col, name, width, height, false, period);
+    }
+  }
+  if (type == "Map") {
+    int period = dom.attribute("period").toInt();
+    int enabled = dom.attribute("enabled").toInt();
+    int i = 0;
+    QList<QtMobility::QGeoCoordinate> coordinates;
+    while (dom.hasAttribute("lat" + QString::number(i))) {
+      double latitude = dom.attribute("lat" + QString::number(i)).toDouble();
+      double longitude = dom.attribute("long" + QString::number(i)).toDouble();
+      double alt = dom.attribute("alt" + QString::number(i)).toDouble();
+      QtMobility::QGeoCoordinate coordinate =
+          QtMobility::QGeoCoordinate(latitude, longitude, alt);
+      coordinates.append(coordinate);
+      i++;
+    }
+
+    if (enabled == 1) {
+      widget = new Map(this, row, col, name, coordinates, true, period);
+    } else {
+      widget = new Map(this, row, col, name, coordinates, false, period);
+    }
+  }
+  if (type == "TextEdit") {
+    widget = new TextEdit(this, row, col, name);
+  }
+  if (type == "Label") {
+    widget = new Label(this, row, col, name);
+  }
+
+  if (widget != NULL) {
+    if (old_name != "") {
+      widget->RenamedFrom(old_name);
+    }
+  }
 }
 
 bool Layout::IsUptodate(void) {
-    for(int i=0;i<childs->count();i++) {
-        if(childs->at(i)->IsUptodate()==false) return false;
-    }
-    return true;
-}
+  for (int i = 0; i < childs->count(); i++) {
+    if (childs->at(i)->IsUptodate() == false)
+      return false;
+  }
+  return true;
+}
Index: trunk/tools/FlairGCS/src/Layout.h
===================================================================
--- trunk/tools/FlairGCS/src/Layout.h	(revision 14)
+++ trunk/tools/FlairGCS/src/Layout.h	(revision 15)
@@ -11,19 +11,18 @@
 class QGridLayout;
 
-class Layout:  public XmlWidget
-{
-    public:
-        Layout(QWidget* parent,XmlWidget* xml,QString name,QString type);
-        Layout(Layout* parent,QString name,QString type);
-        ~Layout();
-        bool IsUptodate(void);
-        void addWidget(QWidget *, int row, int column);
-        QGridLayout* getQGridLayout();
+class Layout : public XmlWidget {
+public:
+  Layout(QWidget *parent, XmlWidget *xml, QString name, QString type);
+  Layout(Layout *parent, QString name, QString type);
+  ~Layout();
+  bool IsUptodate(void);
+  void addWidget(QWidget *, int row, int column);
+  QGridLayout *getQGridLayout();
 
-        //QSplitter *splitter;
-    private:
-        void Constructor(QString name);
-        void XmlEvent(QDomElement dom);
-        QGridLayout* qgridlayout;
+  // QSplitter *splitter;
+private:
+  void Constructor(QString name);
+  void XmlEvent(QDomElement dom);
+  QGridLayout *qgridlayout;
 };
 
Index: trunk/tools/FlairGCS/src/Manager.cpp
===================================================================
--- trunk/tools/FlairGCS/src/Manager.cpp	(revision 14)
+++ trunk/tools/FlairGCS/src/Manager.cpp	(revision 15)
@@ -25,282 +25,303 @@
 
 #ifndef WIN32
-   #include <arpa/inet.h>
+#include <arpa/inet.h>
 #else
-   #include <winsock2.h>
-   #include <ws2tcpip.h>
+#include <winsock2.h>
+#include <ws2tcpip.h>
 #endif
 
 using namespace std;
 
-Manager::Manager(QString name,int port):QWidget() {
-    qRegisterMetaType<QModelIndex>("QModelIndex");//pour le file ui??
-    this->name=name;
-
-    setWindowTitle(name);
-
-    //manager layout
-    managerLayout = new QVBoxLayout;
-    setLayout(managerLayout);
-
-    //tab bar for multiple connections
-    tabBar=new QTabBar();
-    managerLayout->addWidget(tabBar);
-    connect(tabBar, SIGNAL(currentChanged(int)),this, SLOT(tabBarCurrentChanged(int)));
-    currentTab=0;
-
-    //layout boutons
-    button_layout = new QGridLayout();
-    managerLayout->addLayout(button_layout);
-
-    //boutons du button_Layout
-    send_button = new QPushButton("apply all");
-    reset_button = new QPushButton("reset all");
-    load_button = new QPushButton("load all locally");
-    save_button = new QPushButton("save all locally");
-    button_layout->addWidget(send_button,0,0);
-    button_layout->addWidget(reset_button,0,1);
-    button_layout->addWidget(load_button,0,2);
-    button_layout->addWidget(save_button,0,3);
-
-    connect(send_button, SIGNAL(clicked(bool)),this, SLOT(send()));
-    connect(reset_button, SIGNAL(clicked(bool)),this, SLOT(reset()));
-    connect(load_button, SIGNAL(clicked(bool)),this, SLOT(load()));
-    connect(save_button, SIGNAL(clicked(bool)),this, SLOT(save()));
-
-    UDT::startup();
-    serv = UDT::socket(AF_INET, SOCK_DGRAM, 0);
-
-    //for non blocking accept
-    bool blocking = false;
-    UDT::setsockopt(serv, 0, UDT_RCVSYN, &blocking, sizeof(bool));
-
-    sockaddr_in my_addr;
-    my_addr.sin_family = AF_INET;
-    my_addr.sin_port = htons(port);
-    my_addr.sin_addr.s_addr = INADDR_ANY;
-    memset(&(my_addr.sin_zero), '\0', 8);
-
-    if (UDT::ERROR == UDT::bind(serv, (sockaddr*)&my_addr, sizeof(my_addr))) {
-        printf("bind error, %s\n",UDT::getlasterror().getErrorMessage());
-    }
-
-    if (UDT::ERROR == UDT::listen(serv, 1)) {
-        printf("listen error, %s\n",UDT::getlasterror().getErrorMessage());
-    }
-
-    QTimer *timer = new QTimer(this);
-    connect(timer, SIGNAL(timeout()), this, SLOT(acceptConnections()));
-    timer->start(20);
+Manager::Manager(QString name, int port) : QWidget() {
+  qRegisterMetaType<QModelIndex>("QModelIndex"); // pour le file ui??
+  this->name = name;
+
+  setWindowTitle(name);
+
+  // manager layout
+  managerLayout = new QVBoxLayout;
+  setLayout(managerLayout);
+
+  // tab bar for multiple connections
+  tabBar = new QTabBar();
+  managerLayout->addWidget(tabBar);
+  connect(tabBar, SIGNAL(currentChanged(int)), this,
+          SLOT(tabBarCurrentChanged(int)));
+  currentTab = 0;
+
+  // layout boutons
+  button_layout = new QGridLayout();
+  managerLayout->addLayout(button_layout);
+
+  // boutons du button_Layout
+  send_button = new QPushButton("apply all");
+  reset_button = new QPushButton("reset all");
+  load_button = new QPushButton("load all locally");
+  save_button = new QPushButton("save all locally");
+  button_layout->addWidget(send_button, 0, 0);
+  button_layout->addWidget(reset_button, 0, 1);
+  button_layout->addWidget(load_button, 0, 2);
+  button_layout->addWidget(save_button, 0, 3);
+
+  connect(send_button, SIGNAL(clicked(bool)), this, SLOT(send()));
+  connect(reset_button, SIGNAL(clicked(bool)), this, SLOT(reset()));
+  connect(load_button, SIGNAL(clicked(bool)), this, SLOT(load()));
+  connect(save_button, SIGNAL(clicked(bool)), this, SLOT(save()));
+
+  UDT::startup();
+  serv = UDT::socket(AF_INET, SOCK_DGRAM, 0);
+
+  // for non blocking accept
+  bool blocking = false;
+  UDT::setsockopt(serv, 0, UDT_RCVSYN, &blocking, sizeof(bool));
+
+  sockaddr_in my_addr;
+  my_addr.sin_family = AF_INET;
+  my_addr.sin_port = htons(port);
+  my_addr.sin_addr.s_addr = INADDR_ANY;
+  memset(&(my_addr.sin_zero), '\0', 8);
+
+  if (UDT::ERROR == UDT::bind(serv, (sockaddr *)&my_addr, sizeof(my_addr))) {
+    printf("bind error, %s\n", UDT::getlasterror().getErrorMessage());
+  }
+
+  if (UDT::ERROR == UDT::listen(serv, 1)) {
+    printf("listen error, %s\n", UDT::getlasterror().getErrorMessage());
+  }
+
+  QTimer *timer = new QTimer(this);
+  connect(timer, SIGNAL(timeout()), this, SLOT(acceptConnections()));
+  timer->start(20);
 }
 
 Manager::~Manager() {
-    emit killUdtSockets();
-
-    //delete main_layout;
-    UDT::cleanup();
+  emit killUdtSockets();
+
+  // delete main_layout;
+  UDT::cleanup();
 }
 
 void Manager::acceptConnections(void) {
-    static UDTSOCKET first_socket=0;
-    UDTSOCKET socket;
-
-    sockaddr_in their_addr;
-    int namelen = sizeof(their_addr);
-
-    if (UDT::INVALID_SOCK == (socket = UDT::accept(serv, (sockaddr*)&their_addr, &namelen))) {
-        if(UDT::getlasterror().getErrorCode()!=6002)  printf("accept: %s, code %i\n",UDT::getlasterror().getErrorMessage(),UDT::getlasterror().getErrorCode());
-        return;
+  static UDTSOCKET first_socket = 0;
+  UDTSOCKET socket;
+
+  sockaddr_in their_addr;
+  int namelen = sizeof(their_addr);
+
+  if (UDT::INVALID_SOCK ==
+      (socket = UDT::accept(serv, (sockaddr *)&their_addr, &namelen))) {
+    if (UDT::getlasterror().getErrorCode() != 6002)
+      printf("accept: %s, code %i\n", UDT::getlasterror().getErrorMessage(),
+             UDT::getlasterror().getErrorCode());
+    return;
+  } else {
+    printf("connected to %s:%i\n", inet_ntoa(their_addr.sin_addr),
+           their_addr.sin_port);
+
+    if (!first_socket) {
+      first_socket = socket;
+      return;
     } else {
-        printf("connected to %s:%i\n",inet_ntoa(their_addr.sin_addr),their_addr.sin_port);
-
-        if(!first_socket) {
-            first_socket=socket;
-            return;
-        } else {
-            QThread* thread = new QThread(this);
-            UdtSocket* new_udt=new UdtSocket(first_socket,socket,name);
-            new_udt->moveToThread(thread);
-
-            newConnection(new_udt);
-
-            connect(this, SIGNAL(killUdtSockets()),thread, SLOT(quit()));
-            connect(this, SIGNAL(killUdtSockets()),new_udt, SLOT(kill()),Qt::BlockingQueuedConnection);
-
-            connect(thread, SIGNAL(started()), new_udt, SLOT(handleConnections()));
-
-            thread->start();
-            first_socket=0;
-        }
-    }
-}
-
-void Manager::newConnection(UdtSocket* socket) {
-
-    //no tabs to 2 tabs
-    if(connectionsLayout.count()==1) {
-        tabBar->addTab(hiddenTabName);
-        currentTab=0;
-        connectionsWidget.at(0)->show();
-    }
-
-    //layout utilisateur
-    ConnectionLayout* newLayout = new ConnectionLayout(socket,"interface");
-    connectionsLayout.append(newLayout);
-    connect(newLayout, SIGNAL(setRemoteName(QString)),this, SLOT(tabName(QString)));
-    connect(socket, SIGNAL(dataReady(char*,int)),newLayout, SLOT(receive(char*,int)));
-    connect(newLayout, SIGNAL(destroyed(QObject*)),this, SLOT(layoutDestroyed(QObject*)));
-    connect(socket, SIGNAL(destroyed()),newLayout, SLOT(deleteLater()));
-
-    //widget
-    QWidget* newWidget=new QWidget();
-    connectionsWidget.append(newWidget);
-    newWidget->setLayout(newLayout->getQGridLayout());
-    managerLayout->insertWidget(1,newWidget);
-    newWidget->hide();
-
-    if(connectionsLayout.count()==1) {//first connection
-        newWidget->show();
-    } else {//add a tab for the new connection
-        tabBar->addTab("unknown");
-    }
+      QThread *thread = new QThread(this);
+      UdtSocket *new_udt = new UdtSocket(first_socket, socket, name);
+      new_udt->moveToThread(thread);
+
+      newConnection(new_udt);
+
+      connect(this, SIGNAL(killUdtSockets()), thread, SLOT(quit()));
+      connect(this, SIGNAL(killUdtSockets()), new_udt, SLOT(kill()),
+              Qt::BlockingQueuedConnection);
+
+      connect(thread, SIGNAL(started()), new_udt, SLOT(handleConnections()));
+
+      thread->start();
+      first_socket = 0;
+    }
+  }
+}
+
+void Manager::newConnection(UdtSocket *socket) {
+
+  // no tabs to 2 tabs
+  if (connectionsLayout.count() == 1) {
+    tabBar->addTab(hiddenTabName);
+    currentTab = 0;
+    connectionsWidget.at(0)->show();
+  }
+
+  // layout utilisateur
+  ConnectionLayout *newLayout = new ConnectionLayout(socket, "interface");
+  connectionsLayout.append(newLayout);
+  connect(newLayout, SIGNAL(setRemoteName(QString)), this,
+          SLOT(tabName(QString)));
+  connect(socket, SIGNAL(dataReady(char *, int)), newLayout,
+          SLOT(receive(char *, int)));
+  connect(newLayout, SIGNAL(destroyed(QObject *)), this,
+          SLOT(layoutDestroyed(QObject *)));
+  connect(socket, SIGNAL(destroyed()), newLayout, SLOT(deleteLater()));
+
+  // widget
+  QWidget *newWidget = new QWidget();
+  connectionsWidget.append(newWidget);
+  newWidget->setLayout(newLayout->getQGridLayout());
+  managerLayout->insertWidget(1, newWidget);
+  newWidget->hide();
+
+  if (connectionsLayout.count() == 1) { // first connection
+    newWidget->show();
+  } else { // add a tab for the new connection
+    tabBar->addTab("unknown");
+  }
 }
 
 void Manager::tabBarCurrentChanged(int index) {
-    if(index>=0) {
-        connectionsWidget.at(currentTab)->hide();
-        connectionsWidget.at(index)->show();
-        currentTab=index;
-    } else {
-        currentTab=0;
-        connectionsWidget.at(0)->show();
-    }
+  if (index >= 0) {
+    connectionsWidget.at(currentTab)->hide();
+    connectionsWidget.at(index)->show();
+    currentTab = index;
+  } else {
+    currentTab = 0;
+    connectionsWidget.at(0)->show();
+  }
 }
 
 void Manager::tabName(QString name) {
-    int index=connectionsLayout.indexOf((ConnectionLayout*)sender());
-    if(tabBar->count()==0) {
-        hiddenTabName=name;
-    } else {
-        tabBar->setTabText(index,name);
-    }
-}
-
-void Manager::layoutDestroyed(QObject* obj) {
-    int index=connectionsLayout.indexOf((ConnectionLayout*)obj);
-
-    if(tabBar->count()>1) {
-        tabBar->removeTab(index);
-    }
-
-    delete connectionsWidget.at(index);
-    connectionsWidget.removeAt(index);
-    connectionsLayout.removeOne((ConnectionLayout*)obj);
-
-    if(connectionsLayout.count()==1) {
-        hiddenTabName=tabBar->tabText(0);
-        tabBar->removeTab(0);
-    }
+  int index = connectionsLayout.indexOf((ConnectionLayout *)sender());
+  if (tabBar->count() == 0) {
+    hiddenTabName = name;
+  } else {
+    tabBar->setTabText(index, name);
+  }
+}
+
+void Manager::layoutDestroyed(QObject *obj) {
+  int index = connectionsLayout.indexOf((ConnectionLayout *)obj);
+
+  if (tabBar->count() > 1) {
+    tabBar->removeTab(index);
+  }
+
+  delete connectionsWidget.at(index);
+  connectionsWidget.removeAt(index);
+  connectionsLayout.removeOne((ConnectionLayout *)obj);
+
+  if (connectionsLayout.count() == 1) {
+    hiddenTabName = tabBar->tabText(0);
+    tabBar->removeTab(0);
+  }
 }
 
 void Manager::load(void) {
-    QString dir_name= QFileDialog::getExistingDirectory(this, "Select a directory",0,0);
-
-    if(dir_name!="") {
-        for(int i=0;i<connectionsLayout.count();i++) {
-            QFile* file;
-            file = new QFile(dir_name+"/"+connectionsLayout.at(i)->getRemoteName()+".xml");
-            if(!file->open(QIODevice::ReadOnly | QIODevice::Text)) {
-                QMessageBox::warning(this,"Warning","Enable to load "+connectionsLayout.at(i)->getRemoteName()+".xml");
-                continue;
-            }
-
-            QDomDocument doc;
-            QString errorMsg;
-            int errorLine;
-            int errorColumn;
-            if(!doc.setContent(file,&errorMsg,&errorLine,&errorColumn)) {
-                QMessageBox::critical(this,"Error","unable to read " +connectionsLayout.at(i)->getRemoteName()+".xml"
-                                   +" ("+errorMsg + " at " +QString::number(errorLine) +","+QString::number(errorColumn)+")");
-            } else {
-                connectionsLayout.at(i)->LoadXml(doc);
-            }
-            delete file;
-        }
-    }
+  QString dir_name =
+      QFileDialog::getExistingDirectory(this, "Select a directory", 0, 0);
+
+  if (dir_name != "") {
+    for (int i = 0; i < connectionsLayout.count(); i++) {
+      QFile *file;
+      file = new QFile(dir_name + "/" +
+                       connectionsLayout.at(i)->getRemoteName() + ".xml");
+      if (!file->open(QIODevice::ReadOnly | QIODevice::Text)) {
+        QMessageBox::warning(this, "Warning",
+                             "Enable to load " +
+                                 connectionsLayout.at(i)->getRemoteName() +
+                                 ".xml");
+        continue;
+      }
+
+      QDomDocument doc;
+      QString errorMsg;
+      int errorLine;
+      int errorColumn;
+      if (!doc.setContent(file, &errorMsg, &errorLine, &errorColumn)) {
+        QMessageBox::critical(
+            this, "Error",
+            "unable to read " + connectionsLayout.at(i)->getRemoteName() +
+                ".xml" + " (" + errorMsg + " at " + QString::number(errorLine) +
+                "," + QString::number(errorColumn) + ")");
+      } else {
+        connectionsLayout.at(i)->LoadXml(doc);
+      }
+      delete file;
+    }
+  }
 }
 
 void Manager::save(void) {
-    bool isUptodate=true;
-
-    for(int i=0;i<connectionsLayout.count();i++) {
-        if(!connectionsLayout.at(i)->IsUptodate()) {
-            isUptodate=false;
-            break;
-        }
-    }
-
-    if(!isUptodate) {
-        QMessageBox msgBox;
-        msgBox.setText("There are pending modifications");
-        msgBox.setInformativeText("Apply and save?");
-        msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::Cancel);
-        msgBox.setDefaultButton(QMessageBox::Yes);
-        int ret = msgBox.exec();
-
-        switch (ret) {
-           case QMessageBox::Yes:
-               send();
-               break;
-           case QMessageBox::Cancel:
-               return;
-               break;
-           default:
-               // should never be reached
-               break;
-        }
-    }
-
-    //create dirctory for storage
-    QDateTime dateTime = QDateTime::currentDateTime();
-    QString dir_name = "configs_"+dateTime.toString("yyyyMMdd_hhmm")+ "_" + name;
-    if(QDir().exists(dir_name)==true) {
-        dir_name = "configs_"+dateTime.toString("yyyyMMdd_hhmm_ss")+ "_" + name;
-    }
-    QDir().mkdir(dir_name);
-
-    for(int i=0;i<connectionsLayout.count();i++) {
-        QDomDocument* xml=new QDomDocument("remote_ui_xml");
-
-        connectionsLayout.at(i)->GetFullXml((QDomElement*)xml);
-
-        QFile fichier(dir_name+"/"+connectionsLayout.at(i)->getRemoteName()+".xml");
-        QString write_doc = (xml->ownerDocument()).toString();
-
-        if(!fichier.open(QIODevice::WriteOnly)) {
-            fichier.close();
-            QMessageBox::critical(this,"Error","Enable to write XML");
-            continue;
-        }
-        QTextStream stream(&fichier);
-        stream << write_doc; // On utilise l'opérateur << pour écrire write_doc dans le document XML.
-        fichier.close();
-
-        delete xml;
-    }
-
-    QMessageBox::information(this,"save all","saved to ./"+ dir_name);
+  bool isUptodate = true;
+
+  for (int i = 0; i < connectionsLayout.count(); i++) {
+    if (!connectionsLayout.at(i)->IsUptodate()) {
+      isUptodate = false;
+      break;
+    }
+  }
+
+  if (!isUptodate) {
+    QMessageBox msgBox;
+    msgBox.setText("There are pending modifications");
+    msgBox.setInformativeText("Apply and save?");
+    msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::Cancel);
+    msgBox.setDefaultButton(QMessageBox::Yes);
+    int ret = msgBox.exec();
+
+    switch (ret) {
+    case QMessageBox::Yes:
+      send();
+      break;
+    case QMessageBox::Cancel:
+      return;
+      break;
+    default:
+      // should never be reached
+      break;
+    }
+  }
+
+  // create dirctory for storage
+  QDateTime dateTime = QDateTime::currentDateTime();
+  QString dir_name =
+      "configs_" + dateTime.toString("yyyyMMdd_hhmm") + "_" + name;
+  if (QDir().exists(dir_name) == true) {
+    dir_name = "configs_" + dateTime.toString("yyyyMMdd_hhmm_ss") + "_" + name;
+  }
+  QDir().mkdir(dir_name);
+
+  for (int i = 0; i < connectionsLayout.count(); i++) {
+    QDomDocument *xml = new QDomDocument("remote_ui_xml");
+
+    connectionsLayout.at(i)->GetFullXml((QDomElement *)xml);
+
+    QFile fichier(dir_name + "/" + connectionsLayout.at(i)->getRemoteName() +
+                  ".xml");
+    QString write_doc = (xml->ownerDocument()).toString();
+
+    if (!fichier.open(QIODevice::WriteOnly)) {
+      fichier.close();
+      QMessageBox::critical(this, "Error", "Enable to write XML");
+      continue;
+    }
+    QTextStream stream(&fichier);
+    stream << write_doc; // On utilise l'opérateur << pour écrire write_doc dans
+                         // le document XML.
+    fichier.close();
+
+    delete xml;
+  }
+
+  QMessageBox::information(this, "save all", "saved to ./" + dir_name);
 }
 
 void Manager::send(void) {
-    for(int i=0;i<connectionsLayout.count();i++) {
-        QDomDocument doc("remote_ui_xml");
-        connectionsLayout.at(i)->GetUpdateXml((QDomElement*)&doc);
-        //printf("merge\n%s\n",doc.toString().toLocal8Bit().constData());
-
-        connectionsLayout.at(i)->XmlToSend(doc);
-    }
+  for (int i = 0; i < connectionsLayout.count(); i++) {
+    QDomDocument doc("remote_ui_xml");
+    connectionsLayout.at(i)->GetUpdateXml((QDomElement *)&doc);
+    // printf("merge\n%s\n",doc.toString().toLocal8Bit().constData());
+
+    connectionsLayout.at(i)->XmlToSend(doc);
+  }
 }
 
 void Manager::reset() {
-    for(int i=0;i<connectionsLayout.count();i++) connectionsLayout.at(i)->ResetAllChilds();
-}
+  for (int i = 0; i < connectionsLayout.count(); i++)
+    connectionsLayout.at(i)->ResetAllChilds();
+}
Index: trunk/tools/FlairGCS/src/Manager.h
===================================================================
--- trunk/tools/FlairGCS/src/Manager.h	(revision 14)
+++ trunk/tools/FlairGCS/src/Manager.h	(revision 15)
@@ -17,46 +17,43 @@
 class QGridLayout;
 
-class Manager : public QWidget
-{
-    Q_OBJECT
+class Manager : public QWidget {
+  Q_OBJECT
 
-    public:
-        Manager(QString name,int port);
-        ~Manager();
+public:
+  Manager(QString name, int port);
+  ~Manager();
 
-    private:
-        UDTSOCKET serv ;
-        QVBoxLayout *managerLayout;
-        QList<ConnectionLayout*> connectionsLayout;
-        QList<QWidget*> connectionsWidget;
-        QTabBar* tabBar;
-        QString name,hiddenTabName;
-        int currentTab;
+private:
+  UDTSOCKET serv;
+  QVBoxLayout *managerLayout;
+  QList<ConnectionLayout *> connectionsLayout;
+  QList<QWidget *> connectionsWidget;
+  QTabBar *tabBar;
+  QString name, hiddenTabName;
+  int currentTab;
 
-        QPushButton *send_button;
-        QPushButton *reset_button;
-        QPushButton *load_button;
-        QPushButton *save_button;
-        QGridLayout *button_layout;
+  QPushButton *send_button;
+  QPushButton *reset_button;
+  QPushButton *load_button;
+  QPushButton *save_button;
+  QGridLayout *button_layout;
 
-        void newConnection(UdtSocket* socket) ;
+  void newConnection(UdtSocket *socket);
 
-    private slots:
-        void acceptConnections(void);
-        void load(void);
-        void send(void);
-        void save(void);
-        void reset(void);
-        void layoutDestroyed(QObject* obj);
-        void tabBarCurrentChanged(int index);
-        void tabName(QString name);
+private slots:
+  void acceptConnections(void);
+  void load(void);
+  void send(void);
+  void save(void);
+  void reset(void);
+  void layoutDestroyed(QObject *obj);
+  void tabBarCurrentChanged(int index);
+  void tabName(QString name);
 
-    signals:
-        void killUdtSockets(void);
+signals:
+  void killUdtSockets(void);
 
-    protected:
-
+protected:
 };
 
-#endif //MANAGER_H
-
+#endif // MANAGER_H
Index: trunk/tools/FlairGCS/src/Map.cpp
===================================================================
--- trunk/tools/FlairGCS/src/Map.cpp	(revision 14)
+++ trunk/tools/FlairGCS/src/Map.cpp	(revision 15)
@@ -21,322 +21,306 @@
 using namespace QtMobility;
 
-Map::Map(Layout* parent,int row, int col,QString name,QList<QGeoCoordinate> coordinates,bool enabled,int period):
-    DataRemote(name,"Map",parent,enabled,period)
-{
-    visible_widget=new QWidget();
-    visible_widget->setObjectName(name);
-    centeredpoint=0;
-
-    mapTypes[QGraphicsGeoMap::StreetMap] = tr("Street map");
-    mapTypes[QGraphicsGeoMap::SatelliteMapDay] = tr("Satellite map (day)");
-    mapTypes[QGraphicsGeoMap::SatelliteMapNight] = tr("Satellite map (night)");
-    mapTypes[QGraphicsGeoMap::TerrainMap] = tr("Terrain map");
-
-    mapWidget = new MapWidget(this,visible_widget);
-    geoMap = 0;
-
-
-    QVBoxLayout *map_layout = new QVBoxLayout();
-    parent->getQGridLayout()->addLayout(map_layout,row,col);
-    QHBoxLayout *tool_layout = new QHBoxLayout();
-    map_layout->addLayout(tool_layout,0);
-
-    QFormLayout* servicelayout = new QFormLayout();
-    serviceCombo = new QComboBox(visible_widget);
-    servicelayout->addRow("service: ",serviceCombo);
-    QFormLayout* maplayout = new QFormLayout();
-    mapTypeCombo = new QComboBox(visible_widget);
-    maplayout->addRow("map type: ",mapTypeCombo);
-    QFormLayout* proxylayout = new QFormLayout();
-    proxyCombo = new QComboBox(visible_widget);
-    proxylayout->addRow("proxy: ",proxyCombo);
-
-    if(findServices())
-    {
-        tool_layout->addLayout(servicelayout,0);
-        tool_layout->addLayout(maplayout,1);
-        tool_layout->addLayout(proxylayout,2);
-
-        zoomin=new QToolButton(visible_widget);
-        zoomout=new QToolButton(visible_widget);
-        zoomInAction = new QAction(QIcon(QPixmap(":zoomin.png")), tr("Zoom &In"),zoomin);
-        zoomOutAction = new QAction(QIcon(QPixmap(":zoomout.png")), tr("Zoom &Out"),zoomout);
-        zoomin->setDefaultAction(zoomInAction);
-        zoomout->setDefaultAction(zoomOutAction);
-        tool_layout->addWidget(zoomin,3);
-        tool_layout->addWidget(zoomout,4);
-        connect(zoomInAction, SIGNAL(triggered()), this, SLOT(zoomIn()));
-        connect(zoomOutAction, SIGNAL(triggered()), this, SLOT(zoomOut()));
-
-        selectService(0);
-
-        findproxy();
-
-        connect(serviceCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(selectService(int)));
-        connect(mapTypeCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(changeMapType(int)));
-        connect(proxyCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(changeproxy(int)));
-    }
-    else
-    {
-        printf("Error, no services!\n");
-        mapWidget->setEnabled(false);
-    }
-
-    map_layout->addWidget(mapWidget,1);
-    for(int i=0;i<coordinates.size();i++) {
-        mapWidget->AddLandmark((QGeoCoordinate &)coordinates.at(i));
-    }
-}
-
-Map::~Map()
-{
-}
-
-bool Map::findServices(void)
-{
-    QCoreApplication::addLibraryPath(qgetenv("OECORE_HOST_SYSROOT") + "/usr/lib/qt4/");
-
-    QStringList services = QGeoServiceProvider::availableServiceProviders();
-
-    if (services.isEmpty())
-    {
-        QGraphicsTextItem *item = mapWidget->scene()->addText(
-            tr("Failed to find any map services. Please ensure that "
-               "the location services plugins for Qt Mobility are "
-               "installed and, if necessary, set the IGEP_ROOT "
-               "environment variable to the good location."));
-
-        item->setTextWidth(300);
-
-        return false;
-    }
-
-    QMap<QString, QVariant> parameters;
-
-    foreach (QString name, services)
-    {
-
-        parameters["mapping.cache.directory"] = name;
-        parameters["mapping.cache.size"] = QString("500000000");
-
-        QGeoServiceProvider *service = new QGeoServiceProvider(name,parameters);
-
-        if (service->error() != QGeoServiceProvider::NoError) {
-            delete service;
-            continue;
-        }
-
-        QGeoMappingManager *manager = service->mappingManager();
-
-        if (manager)
-        {
-            serviceCombo->addItem(name);
-            managers.append(manager);
-        }
-    }
-
+Map::Map(Layout *parent, int row, int col, QString name,
+         QList<QGeoCoordinate> coordinates, bool enabled, int period)
+    : DataRemote(name, "Map", parent, enabled, period) {
+  visible_widget = new QWidget();
+  visible_widget->setObjectName(name);
+  centeredpoint = 0;
+
+  mapTypes[QGraphicsGeoMap::StreetMap] = tr("Street map");
+  mapTypes[QGraphicsGeoMap::SatelliteMapDay] = tr("Satellite map (day)");
+  mapTypes[QGraphicsGeoMap::SatelliteMapNight] = tr("Satellite map (night)");
+  mapTypes[QGraphicsGeoMap::TerrainMap] = tr("Terrain map");
+
+  mapWidget = new MapWidget(this, visible_widget);
+  geoMap = 0;
+
+  QVBoxLayout *map_layout = new QVBoxLayout();
+  parent->getQGridLayout()->addLayout(map_layout, row, col);
+  QHBoxLayout *tool_layout = new QHBoxLayout();
+  map_layout->addLayout(tool_layout, 0);
+
+  QFormLayout *servicelayout = new QFormLayout();
+  serviceCombo = new QComboBox(visible_widget);
+  servicelayout->addRow("service: ", serviceCombo);
+  QFormLayout *maplayout = new QFormLayout();
+  mapTypeCombo = new QComboBox(visible_widget);
+  maplayout->addRow("map type: ", mapTypeCombo);
+  QFormLayout *proxylayout = new QFormLayout();
+  proxyCombo = new QComboBox(visible_widget);
+  proxylayout->addRow("proxy: ", proxyCombo);
+
+  if (findServices()) {
+    tool_layout->addLayout(servicelayout, 0);
+    tool_layout->addLayout(maplayout, 1);
+    tool_layout->addLayout(proxylayout, 2);
+
+    zoomin = new QToolButton(visible_widget);
+    zoomout = new QToolButton(visible_widget);
+    zoomInAction =
+        new QAction(QIcon(QPixmap(":zoomin.png")), tr("Zoom &In"), zoomin);
+    zoomOutAction =
+        new QAction(QIcon(QPixmap(":zoomout.png")), tr("Zoom &Out"), zoomout);
+    zoomin->setDefaultAction(zoomInAction);
+    zoomout->setDefaultAction(zoomOutAction);
+    tool_layout->addWidget(zoomin, 3);
+    tool_layout->addWidget(zoomout, 4);
+    connect(zoomInAction, SIGNAL(triggered()), this, SLOT(zoomIn()));
+    connect(zoomOutAction, SIGNAL(triggered()), this, SLOT(zoomOut()));
+
+    selectService(0);
+
+    findproxy();
+
+    connect(serviceCombo, SIGNAL(currentIndexChanged(int)), this,
+            SLOT(selectService(int)));
+    connect(mapTypeCombo, SIGNAL(currentIndexChanged(int)), this,
+            SLOT(changeMapType(int)));
+    connect(proxyCombo, SIGNAL(currentIndexChanged(int)), this,
+            SLOT(changeproxy(int)));
+  } else {
+    printf("Error, no services!\n");
+    mapWidget->setEnabled(false);
+  }
+
+  map_layout->addWidget(mapWidget, 1);
+  for (int i = 0; i < coordinates.size(); i++) {
+    mapWidget->AddLandmark((QGeoCoordinate &)coordinates.at(i));
+  }
+}
+
+Map::~Map() {}
+
+bool Map::findServices(void) {
+  QCoreApplication::addLibraryPath(qgetenv("OECORE_HOST_SYSROOT") +
+                                   "/usr/lib/qt4/");
+
+  QStringList services = QGeoServiceProvider::availableServiceProviders();
+
+  if (services.isEmpty()) {
+    QGraphicsTextItem *item = mapWidget->scene()->addText(
+        tr("Failed to find any map services. Please ensure that "
+           "the location services plugins for Qt Mobility are "
+           "installed and, if necessary, set the IGEP_ROOT "
+           "environment variable to the good location."));
+
+    item->setTextWidth(300);
+
+    return false;
+  }
+
+  QMap<QString, QVariant> parameters;
+
+  foreach (QString name, services) {
+
+    parameters["mapping.cache.directory"] = name;
+    parameters["mapping.cache.size"] = QString("500000000");
+
+    QGeoServiceProvider *service = new QGeoServiceProvider(name, parameters);
+
+    if (service->error() != QGeoServiceProvider::NoError) {
+      delete service;
+      continue;
+    }
+
+    QGeoMappingManager *manager = service->mappingManager();
+
+    if (manager) {
+      serviceCombo->addItem(name);
+      managers.append(manager);
+    }
+  }
+
+  return true;
+}
+
+void Map::selectService(int item) {
+  QString name = serviceCombo->currentText();
+
+  QGeoCoordinate coordinate = QGeoCoordinate(0, 0);
+  QGraphicsGeoMap::MapType mapType = QGraphicsGeoMap::StreetMap;
+  int zoomLevel = 1;
+
+  if (geoMap) {
+    coordinate = geoMap->center();
+    mapType = geoMap->mapType();
+    zoomLevel = geoMap->zoomLevel();
+
+    mapWidget->RemoveLandmarks();
+    RemovePoints();
+    geoMap->deleteLater();
+  }
+
+  manager = managers[item];
+  geoMap = new QGraphicsGeoMap(manager);
+
+  mapWidget->AddLandmarks(geoMap);
+  AddPoints(geoMap);
+  geoMap->setCenter(coordinate);
+  geoMap->setMapType(mapType);
+
+  populateMapTypeCombo();
+  updateZoom(zoomLevel);
+
+  mapWidget->setMap(geoMap);
+  connect(geoMap, SIGNAL(zoomLevelChanged(qreal)), this,
+          SLOT(updateZoom(qreal)));
+}
+
+void Map::changeMapType(int index) {
+  geoMap->setMapType(
+      QGraphicsGeoMap::MapType(mapTypeCombo->itemData(index).toInt()));
+}
+
+void Map::populateMapTypeCombo(void) {
+  mapTypeCombo->clear();
+
+  foreach (QGraphicsGeoMap::MapType mapType, geoMap->supportedMapTypes()) {
+    if (mapTypes.contains(mapType))
+      mapTypeCombo->addItem(mapTypes[mapType], QVariant(mapType));
+  }
+
+  if (mapTypeCombo->count() > 0)
+    geoMap->setMapType(
+        QGraphicsGeoMap::MapType(mapTypeCombo->itemData(0).toInt()));
+}
+
+void Map::zoomIn(void) { updateZoom(geoMap->zoomLevel() + 1); }
+
+void Map::zoomOut(void) { updateZoom(geoMap->zoomLevel() - 1); }
+
+void Map::updateZoom(qreal value) {
+  value =
+      qBound(manager->minimumZoomLevel(), value, manager->maximumZoomLevel());
+
+  geoMap->setZoomLevel(value);
+  zoomin->setEnabled(geoMap->zoomLevel() < manager->maximumZoomLevel());
+  zoomout->setEnabled(geoMap->zoomLevel() > manager->minimumZoomLevel());
+}
+
+void Map::findproxy(void) {
+  proxyCombo->addItem("none");
+  proxyCombo->addItem("new");
+  proxyCombo->addItem("proxyweb.utc.fr:3128");
+}
+
+void Map::changeproxy(int index) {
+  if (index == 0) {
+    QNetworkProxy proxy;
+    proxy.setType(QNetworkProxy::NoProxy);
+    QNetworkProxy::setApplicationProxy(proxy);
+  } else if (index == 1) {
+    bool ok;
+    QString text =
+        QInputDialog::getText(visible_widget, tr("New proxy:"), tr("proxy: "),
+                              QLineEdit::Normal, "adress:port", &ok);
+    if (ok == true) {
+      proxyCombo->addItem(text);
+      proxyCombo->setCurrentIndex(proxyCombo->count() - 1);
+    }
+  } else {
+    QStringList string = proxyCombo->itemText(index).split(":");
+    QNetworkProxy proxy;
+    proxy.setType(QNetworkProxy::HttpProxy);
+    proxy.setHostName(string.at(0));
+    proxy.setPort(string.at(1).toInt());
+    QNetworkProxy::setApplicationProxy(proxy);
+    updateZoom(geoMap->zoomLevel()); // refresh
+  }
+}
+
+void Map::SetUptodate(void) {
+  QList<Landmark *> *landmarks = mapWidget->Landmarks();
+  for (int i = 0; i < landmarks->count(); i++) {
+    RemoveAttribute("lat" + QString::number(i));
+    RemoveAttribute("long" + QString::number(i));
+
+    if (mapWidget->LandmarkToSend(i)) {
+      SetAttribute("lat" + QString::number(i),
+                   landmarks->at(i)->coordinate().latitude());
+      SetAttribute("long" + QString::number(i),
+                   landmarks->at(i)->coordinate().longitude());
+    }
+  }
+
+  mapWidget->SetUptodate();
+}
+
+bool Map::IsUptodate(void) { return mapWidget->IsUptodate(); }
+
+void Map::Reset(void) { mapWidget->Reset(); }
+
+void Map::setCenteredPoint(int i) {
+  centeredpoint = i;
+  if (isCentered())
+    geoMap->setCenter(points.at(i)->coordinate());
+}
+
+int Map::centeredPoint(void) { return centeredpoint; }
+
+bool Map::isCentered(void) {
+  if (centeredpoint != -1) {
     return true;
-}
-
-void Map::selectService(int item)
-{
-    QString name = serviceCombo-> currentText ();
-
-    QGeoCoordinate coordinate = QGeoCoordinate(0, 0);
-    QGraphicsGeoMap::MapType mapType = QGraphicsGeoMap::StreetMap;
-    int zoomLevel = 1;
-
-    if (geoMap) {
-        coordinate = geoMap->center();
-        mapType = geoMap->mapType();
-        zoomLevel = geoMap->zoomLevel();
-
-        mapWidget->RemoveLandmarks();
-        RemovePoints();
-        geoMap->deleteLater();
-    }
-
-    manager = managers[item];
-    geoMap = new QGraphicsGeoMap(manager);
-
-    mapWidget->AddLandmarks(geoMap);
-    AddPoints(geoMap);
-    geoMap->setCenter(coordinate);
-    geoMap->setMapType(mapType);
-
-    populateMapTypeCombo();
-    updateZoom(zoomLevel);
-
-    mapWidget->setMap(geoMap);
-    connect(geoMap, SIGNAL(zoomLevelChanged(qreal)), this, SLOT(updateZoom(qreal)));
-}
-
-void Map::changeMapType(int index)
-{
-    geoMap->setMapType(QGraphicsGeoMap::MapType(mapTypeCombo->itemData(index).toInt()));
-}
-
-void Map::populateMapTypeCombo(void)
-{
-    mapTypeCombo->clear();
-
-    foreach (QGraphicsGeoMap::MapType mapType, geoMap->supportedMapTypes()) {
-        if (mapTypes.contains(mapType))
-            mapTypeCombo->addItem(mapTypes[mapType], QVariant(mapType));
-    }
-
-    if (mapTypeCombo->count() > 0)
-        geoMap->setMapType(QGraphicsGeoMap::MapType(mapTypeCombo->itemData(0).toInt()));
-}
-
-void Map::zoomIn(void)
-{
-    updateZoom(geoMap->zoomLevel() + 1);
-}
-
-void Map::zoomOut(void)
-{
-    updateZoom(geoMap->zoomLevel() - 1);
-}
-
-void Map::updateZoom(qreal value)
-{
-    value = qBound(manager->minimumZoomLevel(), value, manager->maximumZoomLevel());
-
-    geoMap->setZoomLevel(value);
-    zoomin->setEnabled(geoMap->zoomLevel() < manager->maximumZoomLevel());
-    zoomout->setEnabled(geoMap->zoomLevel() > manager->minimumZoomLevel());
-}
-
-void Map::findproxy(void)
-{
-    proxyCombo->addItem("none");
-    proxyCombo->addItem("new");
-    proxyCombo->addItem("proxyweb.utc.fr:3128");
-}
-
-void Map::changeproxy(int index)
-{
-    if(index==0)
-    {
-        QNetworkProxy proxy;
-        proxy.setType(QNetworkProxy::NoProxy);
-        QNetworkProxy::setApplicationProxy(proxy);
-    }
-    else if(index==1)
-    {
-        bool ok;
-        QString text = QInputDialog::getText(visible_widget, tr("New proxy:"),
-                                          tr("proxy: "), QLineEdit::Normal,
-                                          "adress:port", &ok);
-        if(ok==true)
-        {
-            proxyCombo->addItem(text);
-            proxyCombo->setCurrentIndex(proxyCombo->count()-1);
-        }
-    }
-    else
-    {
-        QStringList string=proxyCombo->itemText(index).split(":");
-        QNetworkProxy proxy;
-        proxy.setType(QNetworkProxy::HttpProxy);
-        proxy.setHostName(string.at(0));
-        proxy.setPort(string.at(1).toInt());
-        QNetworkProxy::setApplicationProxy(proxy);
-        updateZoom(geoMap->zoomLevel());//refresh
-    }
-}
-
-void Map::SetUptodate(void) {
-    QList<Landmark*> *landmarks=mapWidget->Landmarks();
-    for(int i=0;i<landmarks->count();i++) {
-        RemoveAttribute("lat" +QString::number(i));
-        RemoveAttribute("long" +QString::number(i));
-
-        if(mapWidget->LandmarkToSend(i)) {
-            SetAttribute("lat" +QString::number( i ) ,landmarks->at(i)->coordinate().latitude());
-            SetAttribute("long" +QString::number( i ) ,landmarks->at(i)->coordinate().longitude());
-        }
-    }
-
-    mapWidget->SetUptodate();
-}
-
-bool Map::IsUptodate(void)
-{
-    return mapWidget->IsUptodate();
-}
-
-void Map::Reset(void)
-{
-    mapWidget->Reset();
-}
-
-void Map::setCenteredPoint(int i) {
-    centeredpoint=i;
-    if(isCentered()) geoMap->setCenter(points.at(i)->coordinate());
-}
-
-int Map::centeredPoint(void) {
-    return centeredpoint;
-}
-
-bool Map::isCentered(void) {
-    if(centeredpoint!=-1) {
-        return true;
-    } else {
-        return false;
-    }
+  } else {
+    return false;
+  }
 }
 
 void Map::XmlEvent(QDomElement dom) {
-    if(dom.attribute("point")!="") {
-        receivesize+=3*sizeof(double);
-        if(mapWidget->isEnabled()) {
-            Landmark* landmark=new Landmark(geoMap,QGeoCoordinate(0,0,0),dom.attribute("point"),"cross");
-            landmark->setColor(Qt::black);
-            points.append(landmark);
-            mapWidget->AddPoint(dom.attribute("point"));
-        }
-    } else {
-        XmlSetup(dom);
-    }
-}
-
-void Map::BufEvent(char** buf,int *buf_size,uint16_t period,bool big_endian) {
-    if(IsEnabled()==false || RefreshRate_ms()!=period) return;
-
-    for(int i=0;i<points.count();i++) {
-        qint64 lat_raw;
-        double* lat=(double*)&lat_raw;
-        qint64 longitude_raw;
-        double* longitude=(double*)&longitude_raw;
-        qint64 alt_raw;
-        double* alt=(double*)&alt_raw;
-
-        memcpy(&lat_raw,*buf,sizeof(qint64));
-        *buf+=sizeof(qint64);
-        memcpy(&longitude_raw,*buf,sizeof(qint64));
-        *buf+=sizeof(qint64);
-        memcpy(&alt_raw,*buf,sizeof(qint64));
-        *buf+=sizeof(qint64);
-        if(big_endian==true) lat_raw=qFromBigEndian(lat_raw);
-        if(big_endian==true) longitude_raw=qFromBigEndian(longitude_raw);
-        if(big_endian==true) alt_raw=qFromBigEndian(alt_raw);
-        points.at(i)->setCoordinate(QGeoCoordinate(*lat,*longitude,*alt));
-
-        if(i==centeredpoint) geoMap->setCenter(points.at(i)->coordinate());
-    }
+  if (dom.attribute("point") != "") {
+    receivesize += 3 * sizeof(double);
+    if (mapWidget->isEnabled()) {
+      Landmark *landmark = new Landmark(geoMap, QGeoCoordinate(0, 0, 0),
+                                        dom.attribute("point"), "cross");
+      landmark->setColor(Qt::black);
+      points.append(landmark);
+      mapWidget->AddPoint(dom.attribute("point"));
+    }
+  } else {
+    XmlSetup(dom);
+  }
+}
+
+void Map::BufEvent(char **buf, int *buf_size, uint16_t period,
+                   bool big_endian) {
+  if (IsEnabled() == false || RefreshRate_ms() != period)
+    return;
+
+  for (int i = 0; i < points.count(); i++) {
+    qint64 lat_raw;
+    double *lat = (double *)&lat_raw;
+    qint64 longitude_raw;
+    double *longitude = (double *)&longitude_raw;
+    qint64 alt_raw;
+    double *alt = (double *)&alt_raw;
+
+    memcpy(&lat_raw, *buf, sizeof(qint64));
+    *buf += sizeof(qint64);
+    memcpy(&longitude_raw, *buf, sizeof(qint64));
+    *buf += sizeof(qint64);
+    memcpy(&alt_raw, *buf, sizeof(qint64));
+    *buf += sizeof(qint64);
+    if (big_endian == true)
+      lat_raw = qFromBigEndian(lat_raw);
+    if (big_endian == true)
+      longitude_raw = qFromBigEndian(longitude_raw);
+    if (big_endian == true)
+      alt_raw = qFromBigEndian(alt_raw);
+    points.at(i)->setCoordinate(QGeoCoordinate(*lat, *longitude, *alt));
+
+    if (i == centeredpoint)
+      geoMap->setCenter(points.at(i)->coordinate());
+  }
 }
 
 void Map::RemovePoints(void) {
-    for(int i=0;i<points.count();i++) {
-        points.at(i)->RemoveLandmark();
-    }
+  for (int i = 0; i < points.count(); i++) {
+    points.at(i)->RemoveLandmark();
+  }
 }
 
 void Map::AddPoints(QGraphicsGeoMap *geoMap) {
-    for(int i=0;i<points.count();i++) {
-        points.at(i)->AddLandmark(geoMap);
-    }
-}
+  for (int i = 0; i < points.count(); i++) {
+    points.at(i)->AddLandmark(geoMap);
+  }
+}
Index: trunk/tools/FlairGCS/src/Map.h
===================================================================
--- trunk/tools/FlairGCS/src/Map.h	(revision 14)
+++ trunk/tools/FlairGCS/src/Map.h	(revision 15)
@@ -18,54 +18,53 @@
 
 namespace QtMobility {
-    class QGeoMappingManager;
-    class QGraphicsGeoMap;
-    class QGeoServiceProvider;
+class QGeoMappingManager;
+class QGraphicsGeoMap;
+class QGeoServiceProvider;
 }
 
-class Map: public DataRemote
-{
-    Q_OBJECT
+class Map : public DataRemote {
+  Q_OBJECT
 
-    public:
-        Map(Layout* parent,int row, int col,QString name,QList<QtMobility::QGeoCoordinate> coordinates,bool enabled,int period);
-        ~Map();
-        void setCenteredPoint(int i);
-        int centeredPoint(void);
-        bool isCentered(void);
+public:
+  Map(Layout *parent, int row, int col, QString name,
+      QList<QtMobility::QGeoCoordinate> coordinates, bool enabled, int period);
+  ~Map();
+  void setCenteredPoint(int i);
+  int centeredPoint(void);
+  bool isCentered(void);
 
-    private:
-        MapWidget *mapWidget;
-        QtMobility::QGeoMappingManager *manager;
-        QList<QtMobility::QGeoMappingManager *> managers;
-        QtMobility::QGraphicsGeoMap *geoMap;
-        QtMobility::QGeoServiceProvider *service;
-        QComboBox *mapTypeCombo,*serviceCombo,*proxyCombo;
-        QHash<QtMobility::QGraphicsGeoMap::MapType, QString> mapTypes;
-        QToolButton *zoomin,*zoomout;
-        QAction *zoomInAction;
-        QAction *zoomOutAction;
-        QList<Landmark*> points;
-        int centeredpoint;
+private:
+  MapWidget *mapWidget;
+  QtMobility::QGeoMappingManager *manager;
+  QList<QtMobility::QGeoMappingManager *> managers;
+  QtMobility::QGraphicsGeoMap *geoMap;
+  QtMobility::QGeoServiceProvider *service;
+  QComboBox *mapTypeCombo, *serviceCombo, *proxyCombo;
+  QHash<QtMobility::QGraphicsGeoMap::MapType, QString> mapTypes;
+  QToolButton *zoomin, *zoomout;
+  QAction *zoomInAction;
+  QAction *zoomOutAction;
+  QList<Landmark *> points;
+  int centeredpoint;
 
-        bool findServices(void);
-        void findproxy(void);
-        void populateMapTypeCombo();
-        bool IsUptodate(void);
-        void SetUptodate(void);
-        void Reset(void);
-        void XmlEvent(QDomElement dom);
-        void BufEvent(char** buf,int *buf_size,uint16_t period,bool big_endian);
+  bool findServices(void);
+  void findproxy(void);
+  void populateMapTypeCombo();
+  bool IsUptodate(void);
+  void SetUptodate(void);
+  void Reset(void);
+  void XmlEvent(QDomElement dom);
+  void BufEvent(char **buf, int *buf_size, uint16_t period, bool big_endian);
 
-        void RemovePoints(void);
-        void AddPoints(QtMobility::QGraphicsGeoMap *geoMap);
+  void RemovePoints(void);
+  void AddPoints(QtMobility::QGraphicsGeoMap *geoMap);
 
-    private slots:
-        void changeMapType(int index);
-        void selectService(int index);
-        void changeproxy(int index);
-        void updateZoom(qreal value);
-        void zoomIn(void);
-        void zoomOut(void);
-
+private slots:
+  void changeMapType(int index);
+  void selectService(int index);
+  void changeproxy(int index);
+  void updateZoom(qreal value);
+  void zoomIn(void);
+  void zoomOut(void);
 };
 
Index: trunk/tools/FlairGCS/src/Picture.cpp
===================================================================
--- trunk/tools/FlairGCS/src/Picture.cpp	(revision 14)
+++ trunk/tools/FlairGCS/src/Picture.cpp	(revision 15)
@@ -12,102 +12,88 @@
 #include <QVBoxLayout>
 
-Picture::Picture(Layout* parent,int row, int col,QString name,uint16_t width, uint16_t height,bool enabled,int period):DataRemote(name,"Picture",parent,enabled,period)
-{
-    box = new QGroupBox(name);
-    box->setObjectName(name);
+Picture::Picture(Layout *parent, int row, int col, QString name, uint16_t width,
+                 uint16_t height, bool enabled, int period)
+    : DataRemote(name, "Picture", parent, enabled, period) {
+  box = new QGroupBox(name);
+  box->setObjectName(name);
 
-    parent->addWidget(box,row,col);
+  parent->addWidget(box, row, col);
 
-    label=new QLabel();
+  label = new QLabel();
 
-    layout = new QVBoxLayout;
-    layout->addWidget(label);
-    box->setLayout(layout);
+  layout = new QVBoxLayout;
+  layout->addWidget(label);
+  box->setLayout(layout);
 
-    visible_widget=box;
+  visible_widget = box;
 
-    label->setAlignment(Qt::AlignCenter);
+  label->setAlignment(Qt::AlignCenter);
 
-    im_width=width;
-    im_height=height;
-    label->setMinimumSize(width,height);
-    label->setMaximumSize(width,height);
-    receivesize=width*height;
+  im_width = width;
+  im_height = height;
+  label->setMinimumSize(width, height);
+  label->setMaximumSize(width, height);
+  receivesize = width * height;
 
-    for(int i=0;i<256;i++)
-    {
-        color_table.append(qRgb(i,i,i));
+  for (int i = 0; i < 256; i++) {
+    color_table.append(qRgb(i, i, i));
+  }
+
+  label->installEventFilter(this);
+}
+
+Picture::~Picture() { delete layout; }
+
+void Picture::BufEvent(char **buf, int *buf_size, uint16_t period,
+                       bool big_endian) {
+  if (big_endian)
+    printf("Picture::BufEvent, big endian not handled\n");
+
+  if (IsEnabled() == false || RefreshRate_ms() != period)
+    return;
+
+  if ((*buf_size) >= im_width * im_height) {
+    QImage image = QImage((const uchar *)*buf, im_width, im_height,
+                          QImage::Format_Indexed8); // Format_RGB888);
+    *buf += im_width *im_height;
+    image.setColorTable(color_table);
+
+    label->setPixmap(QPixmap::fromImage(image));
+  } else
+    printf("buffer trop petit\n");
+}
+
+bool Picture::eventFilter(QObject *o, QEvent *e) {
+  if (o == label) {
+    switch (e->type()) {
+    case QEvent::MouseButtonPress: {
+      mousePressEvent((QMouseEvent *)e);
+      break;
     }
 
-    label->installEventFilter(this);
+    default:
+      break;
+    }
+  }
+  return label->eventFilter(o, e);
 }
 
+void Picture::mousePressEvent(QMouseEvent *event) {
 
-Picture::~Picture()
-{
-    delete layout;
+  if (event->x() > 0 && event->x() < label->width() && event->y() > 0 &&
+      event->y() < label->height() && event->button() == Qt::RightButton) {
+
+    QMenu *menu = new QMenu("nom", label);
+    // ajout des actions
+    QAction *a, *z;
+
+    a = menu->addAction("get frame");
+    a->setEnabled(!auto_refresh);
+
+    appendmenu(menu);
+    z = execmenu(label, menu, event->globalPos());
+    delete menu;
+  }
 }
 
-void Picture::BufEvent(char** buf,int *buf_size,uint16_t period,bool big_endian)
-{
-    if(big_endian) printf("Picture::BufEvent, big endian not handled\n");
-
-    if(IsEnabled()==false || RefreshRate_ms()!=period) return;
-
-    if((*buf_size)>=im_width*im_height)
-    {
-        QImage image= QImage((const uchar*)*buf,im_width,im_height,QImage::Format_Indexed8);//Format_RGB888);
-        *buf+=im_width*im_height;
-        image.setColorTable(color_table);
-
-        label->setPixmap(QPixmap::fromImage(image));
-    }
-    else
-        printf("buffer trop petit\n");
-}
-
-bool Picture::eventFilter(QObject *o, QEvent *e)
-{
-    if (  o == label )
-    {
-        switch(e->type())
-        {
-            case QEvent::MouseButtonPress:
-            {
-                mousePressEvent((QMouseEvent*)e);
-                break;
-            }
-
-            default:
-                break;
-        }
-    }
-    return label->eventFilter(o, e);
-}
-
-void Picture::mousePressEvent(QMouseEvent * event)
-{
-
-    if(event->x() > 0 && event->x() < label->width() &&
-       event->y() > 0 && event->y() < label->height() &&
-       event->button() == Qt::RightButton)
-    {
-
-        QMenu * menu = new QMenu("nom", label);
-        // ajout des actions
-        QAction *a,*z;
-
-        a=menu->addAction("get frame");
-        a->setEnabled(!auto_refresh);
-
-        appendmenu(menu);
-        z=execmenu(label,menu,event->globalPos());
-        delete menu;
-
-    }
-}
-
-void Picture::XmlEvent(QDomElement dom)
-{
-    XmlSetup(dom);
-}
+void Picture::XmlEvent(QDomElement dom) { XmlSetup(dom); }
Index: trunk/tools/FlairGCS/src/Picture.h
===================================================================
--- trunk/tools/FlairGCS/src/Picture.h	(revision 14)
+++ trunk/tools/FlairGCS/src/Picture.h	(revision 15)
@@ -17,28 +17,26 @@
 class QVBoxLayout;
 
-class Picture: public DataRemote
-{
-    Q_OBJECT
+class Picture : public DataRemote {
+  Q_OBJECT
 
-    public:
-        Picture(Layout* parent,int row, int col,QString name,uint16_t width, uint16_t height,bool enabled,int period);
-        ~Picture();
+public:
+  Picture(Layout *parent, int row, int col, QString name, uint16_t width,
+          uint16_t height, bool enabled, int period);
+  ~Picture();
 
-    protected:
-        void mousePressEvent(QMouseEvent *event);
+protected:
+  void mousePressEvent(QMouseEvent *event);
 
-    private:
-        QGroupBox* box;
-        QLabel *label;
-        QVBoxLayout *layout;
-        QVector<QRgb> color_table;
-        uint16_t im_width;
-        uint16_t im_height;
+private:
+  QGroupBox *box;
+  QLabel *label;
+  QVBoxLayout *layout;
+  QVector<QRgb> color_table;
+  uint16_t im_width;
+  uint16_t im_height;
 
-        bool eventFilter(QObject *, QEvent *);
-        void BufEvent(char** buf,int *buf_size,uint16_t period,bool big_endian);
-        void XmlEvent(QDomElement dom);
-
-
+  bool eventFilter(QObject *, QEvent *);
+  void BufEvent(char **buf, int *buf_size, uint16_t period, bool big_endian);
+  void XmlEvent(QDomElement dom);
 };
 
Index: trunk/tools/FlairGCS/src/PushButton.cpp
===================================================================
--- trunk/tools/FlairGCS/src/PushButton.cpp	(revision 14)
+++ trunk/tools/FlairGCS/src/PushButton.cpp	(revision 15)
@@ -7,23 +7,19 @@
 #include <QPushButton>
 
-PushButton::PushButton(Layout* parent,int row, int col,QString name):XmlWidget(name,"PushButton",parent)
-{
-    button=new QPushButton(name);
-    parent->addWidget(button,row,col);
+PushButton::PushButton(Layout *parent, int row, int col, QString name)
+    : XmlWidget(name, "PushButton", parent) {
+  button = new QPushButton(name);
+  parent->addWidget(button, row, col);
 
-    SetValue("0");
+  SetValue("0");
 
-    connect(button, SIGNAL(clicked(bool)),this, SLOT(button_clicked(bool)));
+  connect(button, SIGNAL(clicked(bool)), this, SLOT(button_clicked(bool)));
 }
 
-PushButton::~PushButton()
-{
-    delete button;
+PushButton::~PushButton() { delete button; }
+
+void PushButton::button_clicked(bool state) {
+  SetValue("1");
+  connectionLayout()->XmlToSend(XmlDoc());
+  SetValue("0");
 }
-
-void PushButton::button_clicked(bool state)
-{
-    SetValue("1");
-    connectionLayout()->XmlToSend(XmlDoc());
-    SetValue("0");
-}
Index: trunk/tools/FlairGCS/src/PushButton.h
===================================================================
--- trunk/tools/FlairGCS/src/PushButton.h	(revision 14)
+++ trunk/tools/FlairGCS/src/PushButton.h	(revision 15)
@@ -11,18 +11,16 @@
 class Layout;
 
-class PushButton: public XmlWidget
-{
-    Q_OBJECT
+class PushButton : public XmlWidget {
+  Q_OBJECT
 
-    public:
-        PushButton(Layout* parent,int row, int col,QString name);
-        ~PushButton();
+public:
+  PushButton(Layout *parent, int row, int col, QString name);
+  ~PushButton();
 
-    private:
-        QPushButton *button;
+private:
+  QPushButton *button;
 
-    private slots:
-        void button_clicked(bool state);
-
+private slots:
+  void button_clicked(bool state);
 };
 
Index: trunk/tools/FlairGCS/src/RangeFinderPlot.cpp
===================================================================
--- trunk/tools/FlairGCS/src/RangeFinderPlot.cpp	(revision 14)
+++ trunk/tools/FlairGCS/src/RangeFinderPlot.cpp	(revision 15)
@@ -18,264 +18,234 @@
 #include <qmath.h>
 
-RangeFinderPlot::RangeFinderPlot(Layout* parent,int row, int col,QString name,
-                                 QString x_name,QString y_name,
-                                 float xmin, float xmax,float ymin, float ymax,
-                                 float start_angle,float end_angle,uint32_t nb_samples,QString data_type,
-                                 bool invert_axis,bool enabled,int period):
-    DataRemote(name,"RangeFinderPlot",parent,enabled,period)
-{
-    invert_axis=true;
-    this->start_angle=start_angle;
-    this->end_angle=end_angle;
-    this->nb_samples=nb_samples;
-    this->data_type=data_type;
-    this->invert_axis=invert_axis;
-
-    if(data_type=="float")
-    {
-        receivesize=nb_samples*sizeof(float);
-    }
-    else if(data_type=="int8_t")
-    {
-        receivesize=nb_samples*sizeof(int8_t);
-    }
-    else if(data_type=="int16_t")
-    {
-        receivesize=nb_samples*sizeof(int16_t);
-    }
-    else
-    {
-        printf("RangeFinderPlot::RangeFinderPlot unknown type %s\n",data_type.toLocal8Bit().constData());
-    }
-
-
-    plot=new QwtPlot(NULL);
-    plot->setEnabled(enabled);
-    //plot->setAutoReplot( false );
-
-    parent->addWidget(plot,row,col);
-    visible_widget=plot;
-
-    plot->setTitle(name);
-
-    // grid
-    QwtPlotGrid *grid = new QwtPlotGrid;
-    grid->setPen(QPen(Qt::black, 0, Qt::DotLine));
-    grid->attach(plot);
-
-    plot->updateAxes();
-
-    //zoomer
-    QwtPlotMagnifier * zoomer = new QwtPlotMagnifier(plot->canvas());
-    zoomer->setMouseButton(Qt::RightButton,Qt::ControlModifier);
-
-    //scroller
-    QwtPlotPanner *scroller =new QwtPlotPanner(plot->canvas());
-
-    // Axis
-    if(!invert_axis) {
-        plot->setAxisTitle(QwtPlot::xBottom, x_name);
-        setXAxisScale(xmin,xmax);
-
-        plot->setAxisTitle(QwtPlot::yLeft, y_name);
-        setYAxisScale(ymin,ymax);
-    } else {
-        plot->setAxisTitle(QwtPlot::xBottom, y_name);
-        setXAxisScale(ymin,ymax);
-
-        plot->setAxisTitle(QwtPlot::yLeft, x_name);
-        setYAxisScale(xmin,xmax);
-    }
-
-    QwtPlotRescaler* rescaler = new QwtPlotRescaler( plot->canvas() );
-    rescaler->setRescalePolicy( QwtPlotRescaler::Fixed );
-
-    //( void ) new QwtPlotMagnifier( plot->canvas() );
-
-    plot->canvas()->installEventFilter(this);
-
-    for(uint32_t i=0;i<nb_samples;i++)
-    {
-        addTriangle(start_angle+i*(end_angle-start_angle+1)/nb_samples,start_angle+(i+1)*(end_angle-start_angle+1)/nb_samples);
-    }
-}
-
-RangeFinderPlot::~RangeFinderPlot()
-{
-    delete plot;
-}
-
-void RangeFinderPlot::XmlEvent(QDomElement dom)
-{
-    XmlSetup(dom);
-}
-
-bool RangeFinderPlot::eventFilter(QObject *o, QEvent *e)
-{
-    if (o==plot->canvas())
-    {
-        switch(e->type())
-        {
-            case QEvent::MouseButtonPress:
-            {
-                mousePressEvent((QMouseEvent*)e);
-                break;
-            }
-
-            default:
-                break;
-        }
-    }
-    return plot->eventFilter(o, e);
-}
-
+RangeFinderPlot::RangeFinderPlot(Layout *parent, int row, int col, QString name,
+                                 QString x_name, QString y_name, float xmin,
+                                 float xmax, float ymin, float ymax,
+                                 float start_angle, float end_angle,
+                                 uint32_t nb_samples, QString data_type,
+                                 bool invert_axis, bool enabled, int period)
+    : DataRemote(name, "RangeFinderPlot", parent, enabled, period) {
+  invert_axis = true;
+  this->start_angle = start_angle;
+  this->end_angle = end_angle;
+  this->nb_samples = nb_samples;
+  this->data_type = data_type;
+  this->invert_axis = invert_axis;
+
+  if (data_type == "float") {
+    receivesize = nb_samples * sizeof(float);
+  } else if (data_type == "int8_t") {
+    receivesize = nb_samples * sizeof(int8_t);
+  } else if (data_type == "int16_t") {
+    receivesize = nb_samples * sizeof(int16_t);
+  } else {
+    printf("RangeFinderPlot::RangeFinderPlot unknown type %s\n",
+           data_type.toLocal8Bit().constData());
+  }
+
+  plot = new QwtPlot(NULL);
+  plot->setEnabled(enabled);
+  // plot->setAutoReplot( false );
+
+  parent->addWidget(plot, row, col);
+  visible_widget = plot;
+
+  plot->setTitle(name);
+
+  // grid
+  QwtPlotGrid *grid = new QwtPlotGrid;
+  grid->setPen(QPen(Qt::black, 0, Qt::DotLine));
+  grid->attach(plot);
+
+  plot->updateAxes();
+
+  // zoomer
+  QwtPlotMagnifier *zoomer = new QwtPlotMagnifier(plot->canvas());
+  zoomer->setMouseButton(Qt::RightButton, Qt::ControlModifier);
+
+  // scroller
+  QwtPlotPanner *scroller = new QwtPlotPanner(plot->canvas());
+
+  // Axis
+  if (!invert_axis) {
+    plot->setAxisTitle(QwtPlot::xBottom, x_name);
+    setXAxisScale(xmin, xmax);
+
+    plot->setAxisTitle(QwtPlot::yLeft, y_name);
+    setYAxisScale(ymin, ymax);
+  } else {
+    plot->setAxisTitle(QwtPlot::xBottom, y_name);
+    setXAxisScale(ymin, ymax);
+
+    plot->setAxisTitle(QwtPlot::yLeft, x_name);
+    setYAxisScale(xmin, xmax);
+  }
+
+  QwtPlotRescaler *rescaler = new QwtPlotRescaler(plot->canvas());
+  rescaler->setRescalePolicy(QwtPlotRescaler::Fixed);
+
+  //( void ) new QwtPlotMagnifier( plot->canvas() );
+
+  plot->canvas()->installEventFilter(this);
+
+  for (uint32_t i = 0; i < nb_samples; i++) {
+    addTriangle(start_angle + i * (end_angle - start_angle + 1) / nb_samples,
+                start_angle +
+                    (i + 1) * (end_angle - start_angle + 1) / nb_samples);
+  }
+}
+
+RangeFinderPlot::~RangeFinderPlot() { delete plot; }
+
+void RangeFinderPlot::XmlEvent(QDomElement dom) { XmlSetup(dom); }
+
+bool RangeFinderPlot::eventFilter(QObject *o, QEvent *e) {
+  if (o == plot->canvas()) {
+    switch (e->type()) {
+    case QEvent::MouseButtonPress: {
+      mousePressEvent((QMouseEvent *)e);
+      break;
+    }
+
+    default:
+      break;
+    }
+  }
+  return plot->eventFilter(o, e);
+}
 
 //
 //  Set a plain canvas frame and align the scales to it
 //
-void RangeFinderPlot::alignScales(void)
-{
-    // The code below shows how to align the scales to
-    // the canvas frame, but is also a good example demonstrating
-    // why the spreaded API needs polishing.
-/*
-    plot->canvas()->setFrameStyle(QFrame::Box | QFrame::Plain );
-    plot->canvas()->setLineWidth(1);
-*/
-    for ( int i = 0; i < QwtPlot::axisCnt; i++ )
-    {
-        QwtScaleWidget *scaleWidget = (QwtScaleWidget *)plot->axisWidget(i);
-        if ( scaleWidget )
-            scaleWidget->setMargin(0);
-
-        QwtScaleDraw *scaleDraw = (QwtScaleDraw *)plot->axisScaleDraw(i);
-        if ( scaleDraw )
-            scaleDraw->enableComponent(QwtAbstractScaleDraw::Backbone, false);
-    }
-}
-
-void RangeFinderPlot::setXAxisScale(float xmin,float xmax)
-{
-    xmin_orig=xmin;
-    xmax_orig=xmax;
-    plot->setAxisScale(QwtPlot::xBottom, xmin_orig, xmax_orig);
-
-}
-
-void RangeFinderPlot::setYAxisScale(float ymin,float ymax)
-{
-    ymin_orig=ymin;
-    ymax_orig=ymax;
-    plot->setAxisScale(QwtPlot::yLeft, ymin_orig, ymax_orig);
-}
-
-void RangeFinderPlot::BufEvent(char **buf,int *buf_size,uint16_t period,bool big_endian)
-{
-    plot->setEnabled(IsEnabled());
-    if(IsEnabled()==false || RefreshRate_ms()!=period) return;
-
-    for(uint32_t i=0;i<nb_samples;i++)
-    {
-        if(data_type=="float")
-        {
-            uint32_t data_raw;
-            float* data=(float*)&data_raw;
-
-            memcpy((void*)&data_raw,*buf,sizeof(uint32_t));
-            *buf+=sizeof(uint32_t);
-            if(big_endian==true) data_raw=qFromBigEndian(data_raw);
-            SetTriangle(i,*data);
-        }
-        else if(data_type=="int8_t")
-        {
-            int8_t data;
-            memcpy((void*)&data,*buf,sizeof(data));
-            *buf+=sizeof(data);
-            SetTriangle(i,data);
-        }
-        else if(data_type=="int16_t")
-        {
-            int16_t data;
-            memcpy((void*)&data,*buf,sizeof(data));
-            *buf+=sizeof(data);
-            if(big_endian==true) data=qFromBigEndian(data);
-            SetTriangle(i,data);
-        }
-        else
-        {
-            printf("RangeFinderPlot::BufEvent unknown type %s\n",data_type.toLocal8Bit().constData());
-        }
-     }
-
-    plot->replot();
-}
-
-void RangeFinderPlot::addTriangle(float angle_min, float angle_max)
-{
-    QwtPlotShapeItem *item = new QwtPlotShapeItem();
-
-    item->setRenderHint( QwtPlotItem::RenderAntialiased, true );
-    item->attach(plot);
-    triangles.append(item);
-
-}
-
-void RangeFinderPlot::SetTriangle(uint32_t id,float length)
-{
-    QPainterPath path;
-    QPolygonF triangle;
-    float angle_min=start_angle+id*(end_angle-start_angle+1)/nb_samples;
-    float angle_max=start_angle+(id+1)*(end_angle-start_angle+1)/nb_samples;
-
-    if(invert_axis) {
-        angle_min=90-angle_min;
-        angle_max=90-angle_max;
-    }
-
-    triangle += QPointF( 0,0 );
-    triangle += QPointF( length*cos(angle_min*M_PI/180.),length*sin(angle_min*M_PI/180.) );
-    triangle += QPointF( length*cos(angle_max*M_PI/180.),length*sin(angle_max*M_PI/180.) );
-
-    path.addPolygon( triangle );
-
-    path.closeSubpath();
-    triangles.at(id)->setShape(path);
-
-    QColor fillColor = "SandyBrown";
-    fillColor.setAlpha( 200 );
-
-    QPen pen( QColor("SandyBrown"), 1 );
-    pen.setJoinStyle( Qt::MiterJoin );
-    triangles.at(id)->setPen( pen );
-    triangles.at(id)->setBrush( fillColor );
-}
-
-//context menu
-void RangeFinderPlot::mousePressEvent(QMouseEvent *event)
-{
-    if (event->button() == Qt::RightButton)
-    {
-        QMenu *menu = new QMenu("nom", plot);
-        // ajout des actions
-        QAction *a,*z;
-
-        a=menu->addAction("reset y zoom");
-
-        appendmenu(menu);
-        z=execmenu(plot,menu,event->globalPos());
-        delete menu;
-
-        if(z==a)
-        {
-            //zoom to original size
-            if(!invert_axis) {
-                plot->setAxisScale(QwtPlot::yLeft, ymin_orig, ymax_orig);
-            } else {
-                plot->setAxisScale(QwtPlot::yLeft, xmin_orig, xmax_orig);
-            }
-            plot->replot();
-        }
-    }
-}
-
-
+void RangeFinderPlot::alignScales(void) {
+  // The code below shows how to align the scales to
+  // the canvas frame, but is also a good example demonstrating
+  // why the spreaded API needs polishing.
+  /*
+      plot->canvas()->setFrameStyle(QFrame::Box | QFrame::Plain );
+      plot->canvas()->setLineWidth(1);
+  */
+  for (int i = 0; i < QwtPlot::axisCnt; i++) {
+    QwtScaleWidget *scaleWidget = (QwtScaleWidget *)plot->axisWidget(i);
+    if (scaleWidget)
+      scaleWidget->setMargin(0);
+
+    QwtScaleDraw *scaleDraw = (QwtScaleDraw *)plot->axisScaleDraw(i);
+    if (scaleDraw)
+      scaleDraw->enableComponent(QwtAbstractScaleDraw::Backbone, false);
+  }
+}
+
+void RangeFinderPlot::setXAxisScale(float xmin, float xmax) {
+  xmin_orig = xmin;
+  xmax_orig = xmax;
+  plot->setAxisScale(QwtPlot::xBottom, xmin_orig, xmax_orig);
+}
+
+void RangeFinderPlot::setYAxisScale(float ymin, float ymax) {
+  ymin_orig = ymin;
+  ymax_orig = ymax;
+  plot->setAxisScale(QwtPlot::yLeft, ymin_orig, ymax_orig);
+}
+
+void RangeFinderPlot::BufEvent(char **buf, int *buf_size, uint16_t period,
+                               bool big_endian) {
+  plot->setEnabled(IsEnabled());
+  if (IsEnabled() == false || RefreshRate_ms() != period)
+    return;
+
+  for (uint32_t i = 0; i < nb_samples; i++) {
+    if (data_type == "float") {
+      uint32_t data_raw;
+      float *data = (float *)&data_raw;
+
+      memcpy((void *)&data_raw, *buf, sizeof(uint32_t));
+      *buf += sizeof(uint32_t);
+      if (big_endian == true)
+        data_raw = qFromBigEndian(data_raw);
+      SetTriangle(i, *data);
+    } else if (data_type == "int8_t") {
+      int8_t data;
+      memcpy((void *)&data, *buf, sizeof(data));
+      *buf += sizeof(data);
+      SetTriangle(i, data);
+    } else if (data_type == "int16_t") {
+      int16_t data;
+      memcpy((void *)&data, *buf, sizeof(data));
+      *buf += sizeof(data);
+      if (big_endian == true)
+        data = qFromBigEndian(data);
+      SetTriangle(i, data);
+    } else {
+      printf("RangeFinderPlot::BufEvent unknown type %s\n",
+             data_type.toLocal8Bit().constData());
+    }
+  }
+
+  plot->replot();
+}
+
+void RangeFinderPlot::addTriangle(float angle_min, float angle_max) {
+  QwtPlotShapeItem *item = new QwtPlotShapeItem();
+
+  item->setRenderHint(QwtPlotItem::RenderAntialiased, true);
+  item->attach(plot);
+  triangles.append(item);
+}
+
+void RangeFinderPlot::SetTriangle(uint32_t id, float length) {
+  QPainterPath path;
+  QPolygonF triangle;
+  float angle_min =
+      start_angle + id * (end_angle - start_angle + 1) / nb_samples;
+  float angle_max =
+      start_angle + (id + 1) * (end_angle - start_angle + 1) / nb_samples;
+
+  if (invert_axis) {
+    angle_min = 90 - angle_min;
+    angle_max = 90 - angle_max;
+  }
+
+  triangle += QPointF(0, 0);
+  triangle += QPointF(length * cos(angle_min * M_PI / 180.),
+                      length * sin(angle_min * M_PI / 180.));
+  triangle += QPointF(length * cos(angle_max * M_PI / 180.),
+                      length * sin(angle_max * M_PI / 180.));
+
+  path.addPolygon(triangle);
+
+  path.closeSubpath();
+  triangles.at(id)->setShape(path);
+
+  QColor fillColor = "SandyBrown";
+  fillColor.setAlpha(200);
+
+  QPen pen(QColor("SandyBrown"), 1);
+  pen.setJoinStyle(Qt::MiterJoin);
+  triangles.at(id)->setPen(pen);
+  triangles.at(id)->setBrush(fillColor);
+}
+
+// context menu
+void RangeFinderPlot::mousePressEvent(QMouseEvent *event) {
+  if (event->button() == Qt::RightButton) {
+    QMenu *menu = new QMenu("nom", plot);
+    // ajout des actions
+    QAction *a, *z;
+
+    a = menu->addAction("reset y zoom");
+
+    appendmenu(menu);
+    z = execmenu(plot, menu, event->globalPos());
+    delete menu;
+
+    if (z == a) {
+      // zoom to original size
+      if (!invert_axis) {
+        plot->setAxisScale(QwtPlot::yLeft, ymin_orig, ymax_orig);
+      } else {
+        plot->setAxisScale(QwtPlot::yLeft, xmin_orig, xmax_orig);
+      }
+      plot->replot();
+    }
+  }
+}
Index: trunk/tools/FlairGCS/src/RangeFinderPlot.h
===================================================================
--- trunk/tools/FlairGCS/src/RangeFinderPlot.h	(revision 14)
+++ trunk/tools/FlairGCS/src/RangeFinderPlot.h	(revision 15)
@@ -14,37 +14,36 @@
 class QMouseEvent;
 
-class RangeFinderPlot :  public DataRemote
-{
-    Q_OBJECT
+class RangeFinderPlot : public DataRemote {
+  Q_OBJECT
 
-    public:
-        RangeFinderPlot(Layout* parent,int row, int col,QString name,QString x_name,QString y_name,
-                        float xmin, float xmax,float ymin, float ymax,
-                        float start_angle,float end_angle,uint32_t nb_samples,QString data_type,
-                        bool invert_axis,bool enabled,int period);
-        ~RangeFinderPlot();
+public:
+  RangeFinderPlot(Layout *parent, int row, int col, QString name,
+                  QString x_name, QString y_name, float xmin, float xmax,
+                  float ymin, float ymax, float start_angle, float end_angle,
+                  uint32_t nb_samples, QString data_type, bool invert_axis,
+                  bool enabled, int period);
+  ~RangeFinderPlot();
 
-    protected:
-         void mousePressEvent(QMouseEvent *event);
+protected:
+  void mousePressEvent(QMouseEvent *event);
 
-    private:
-        void setYAxisScale(float ymin,float ymax);
-        void setXAxisScale(float xmin,float xmax);
-        void addTriangle(float angle_min, float angle_max);
-        void SetTriangle(uint32_t id,float length);
-        QwtPlot* plot;
-        void XmlEvent(QDomElement dom);
-        void alignScales(void);
-        float xmin_orig,xmax_orig,ymin_orig,ymax_orig;
-        float start_angle,end_angle;
-        uint32_t nb_samples;
-        QString data_type;
-        QList<QwtPlotShapeItem*> triangles;
-        bool invert_axis;
+private:
+  void setYAxisScale(float ymin, float ymax);
+  void setXAxisScale(float xmin, float xmax);
+  void addTriangle(float angle_min, float angle_max);
+  void SetTriangle(uint32_t id, float length);
+  QwtPlot *plot;
+  void XmlEvent(QDomElement dom);
+  void alignScales(void);
+  float xmin_orig, xmax_orig, ymin_orig, ymax_orig;
+  float start_angle, end_angle;
+  uint32_t nb_samples;
+  QString data_type;
+  QList<QwtPlotShapeItem *> triangles;
+  bool invert_axis;
 
-        bool eventFilter(QObject *, QEvent *);
-        void BufEvent(char** buf,int *buf_size,uint16_t period,bool big_endian);
+  bool eventFilter(QObject *, QEvent *);
+  void BufEvent(char **buf, int *buf_size, uint16_t period, bool big_endian);
 };
 
-
 #endif // RANGEFINDERPLOT_H_INCLUDED
Index: trunk/tools/FlairGCS/src/Scope.cpp
===================================================================
--- trunk/tools/FlairGCS/src/Scope.cpp	(revision 14)
+++ trunk/tools/FlairGCS/src/Scope.cpp	(revision 15)
@@ -21,260 +21,283 @@
 #define WHEEL_DIVIDOR 30
 
-Scope::Scope(QString title,float ymin,float ymax,float view_size_s,unsigned int refresh_rate_ms,unsigned int history_size): QwtPlot() {
-    this->ymin=ymin;
-    this->ymax=ymax;
-    this->history_size=history_size;
-    this->view_size_s=view_size_s;
-    orig_view_size_s=view_size_s;
-
-    //scroll bar
-    scrollbar=new ScrollBar(Qt::Horizontal,canvas());
-    connect(scrollbar,SIGNAL(valueChanged(Qt::Orientation,float,float)),this,SLOT(scrollBarMoved(Qt::Orientation,float,float)));
-    scrolling=true;
-
-    //minimum size; sinon widget trop grand
-    setMinimumHeight(10);
-    setMinimumWidth(1);
-
-    alignScales();//is it necessary?
-
-    //  Initialize data
-    elapsed_time_s=0;
-
-    // Assign a title
-    setTitle(title);
-
-    // Axis
-    setAxisTitle(QwtPlot::xBottom, "Time (s)");
-    setAxisScale(QwtPlot::xBottom,0, view_size_s);
-
-    setAxisTitle(QwtPlot::yLeft, "Values");
-    setAxisScale(QwtPlot::yLeft, ymin, ymax);
-
-    // grid
-    QwtPlotGrid *grid = new QwtPlotGrid;
-    grid->setPen(QPen(Qt::black, 0, Qt::DotLine));
-    grid->attach(this);
-
-    //zoomer
-    QwtPlotMagnifier * zoomer = new QwtPlotMagnifier(canvas());
-    zoomer->setWheelModifiers( Qt::ControlModifier );
-    zoomer->setMouseButton(Qt::NoButton);
-    zoomer->setAxisEnabled(xBottom,0);
-
-    //scroller
-    QwtPlotPanner *scroller =new QwtPlotPanner(canvas());
-    scroller->setAxisEnabled(xBottom,0);
-
-    //legend
-    QwtLegend* new_legend=new QwtLegend();
-    new_legend->setDefaultItemMode(QwtLegendData::Checkable);
-    insertLegend(new_legend, QwtPlot::BottomLegend);
-
-    connect( new_legend, SIGNAL( checked( const QVariant &, bool, int ) ), SLOT( legendChecked( const QVariant &, bool ) ) );
-
-    QTimer *timer = new QTimer(this);
-    connect(timer, SIGNAL(timeout()), this, SLOT(replot()));
-    timer->start(refresh_rate_ms);
+Scope::Scope(QString title, float ymin, float ymax, float view_size_s,
+             unsigned int refresh_rate_ms, unsigned int history_size)
+    : QwtPlot() {
+  this->ymin = ymin;
+  this->ymax = ymax;
+  this->history_size = history_size;
+  this->view_size_s = view_size_s;
+  orig_view_size_s = view_size_s;
+
+  // scroll bar
+  scrollbar = new ScrollBar(Qt::Horizontal, canvas());
+  connect(scrollbar, SIGNAL(valueChanged(Qt::Orientation, float, float)), this,
+          SLOT(scrollBarMoved(Qt::Orientation, float, float)));
+  scrolling = true;
+
+  // minimum size; sinon widget trop grand
+  setMinimumHeight(10);
+  setMinimumWidth(1);
+
+  alignScales(); // is it necessary?
+
+  //  Initialize data
+  elapsed_time_s = 0;
+
+  // Assign a title
+  setTitle(title);
+
+  // Axis
+  setAxisTitle(QwtPlot::xBottom, "Time (s)");
+  setAxisScale(QwtPlot::xBottom, 0, view_size_s);
+
+  setAxisTitle(QwtPlot::yLeft, "Values");
+  setAxisScale(QwtPlot::yLeft, ymin, ymax);
+
+  // grid
+  QwtPlotGrid *grid = new QwtPlotGrid;
+  grid->setPen(QPen(Qt::black, 0, Qt::DotLine));
+  grid->attach(this);
+
+  // zoomer
+  QwtPlotMagnifier *zoomer = new QwtPlotMagnifier(canvas());
+  zoomer->setWheelModifiers(Qt::ControlModifier);
+  zoomer->setMouseButton(Qt::NoButton);
+  zoomer->setAxisEnabled(xBottom, 0);
+
+  // scroller
+  QwtPlotPanner *scroller = new QwtPlotPanner(canvas());
+  scroller->setAxisEnabled(xBottom, 0);
+
+  // legend
+  QwtLegend *new_legend = new QwtLegend();
+  new_legend->setDefaultItemMode(QwtLegendData::Checkable);
+  insertLegend(new_legend, QwtPlot::BottomLegend);
+
+  connect(new_legend, SIGNAL(checked(const QVariant &, bool, int)),
+          SLOT(legendChecked(const QVariant &, bool)));
+
+  QTimer *timer = new QTimer(this);
+  connect(timer, SIGNAL(timeout()), this, SLOT(replot()));
+  timer->start(refresh_rate_ms);
 }
 
 Scope::~Scope() {
-    for(int i=0;i<curves.count();i++) {
-        free(curves.at(i)->data_x);
-        free(curves.at(i)->data_y);
-        delete curves.at(i)->plot;
-        free(curves.at(i));
-    }
+  for (int i = 0; i < curves.count(); i++) {
+    free(curves.at(i)->data_x);
+    free(curves.at(i)->data_y);
+    delete curves.at(i)->plot;
+    free(curves.at(i));
+  }
 }
 
 void Scope::resetXView(void) {
-    //setAxisScale(QwtPlot::xBottom,0, orig_view_size_s);
-    changeViewSize(orig_view_size_s);
-}
-
-void Scope::resetYView(void) {
-    setAxisScale(QwtPlot::yLeft, ymin, ymax);
-}
+  // setAxisScale(QwtPlot::xBottom,0, orig_view_size_s);
+  changeViewSize(orig_view_size_s);
+}
+
+void Scope::resetYView(void) { setAxisScale(QwtPlot::yLeft, ymin, ymax); }
 
 bool Scope::eventFilter(QObject *o, QEvent *e) {
-    switch(e->type()) {
-        case QEvent::Resize: {
-            const int fw = ((QwtPlotCanvas *)canvas())->frameWidth();
-
-            QRect rect;
-            rect.setSize(((QResizeEvent *)e)->size());
-            rect.setRect(rect.x() + fw, rect.y() + fw,
-                rect.width() - 2 * fw, rect.height() - 2 * fw);
-
-            scrollbar->setGeometry(0, 0, rect.width(), 10);
-            return true;
-        }
-        case QEvent::Wheel: {
-            //ctrl+wheel is already handled for y zoom
-            if(!(QApplication::keyboardModifiers() & Qt::ControlModifier)) {
-                QWheelEvent *wheelevent = static_cast<QWheelEvent *> (e);
-                if(view_size_s+wheelevent->delta()/WHEEL_DIVIDOR>0) changeViewSize(view_size_s+wheelevent->delta()/WHEEL_DIVIDOR);
-            }
-            return true;
-        }
-        default:
-            break;
-    }
-    return QwtPlot::eventFilter(o, e);
+  switch (e->type()) {
+  case QEvent::Resize: {
+    const int fw = ((QwtPlotCanvas *)canvas())->frameWidth();
+
+    QRect rect;
+    rect.setSize(((QResizeEvent *)e)->size());
+    rect.setRect(rect.x() + fw, rect.y() + fw, rect.width() - 2 * fw,
+                 rect.height() - 2 * fw);
+
+    scrollbar->setGeometry(0, 0, rect.width(), 10);
+    return true;
+  }
+  case QEvent::Wheel: {
+    // ctrl+wheel is already handled for y zoom
+    if (!(QApplication::keyboardModifiers() & Qt::ControlModifier)) {
+      QWheelEvent *wheelevent = static_cast<QWheelEvent *>(e);
+      if (view_size_s + wheelevent->delta() / WHEEL_DIVIDOR > 0)
+        changeViewSize(view_size_s + wheelevent->delta() / WHEEL_DIVIDOR);
+    }
+    return true;
+  }
+  default:
+    break;
+  }
+  return QwtPlot::eventFilter(o, e);
 }
 
 void Scope::changeViewSize(float new_view_size_s) {
-    view_size_s=new_view_size_s;
-
-    if(scrolling==false) {
-        //4 cas: on utilise le temps au milieu de la vue actuelle
-
-        //le temps total est plus petit que le view_size_s, on affiche tout:
-        if(elapsed_time_s<view_size_s) {
-            scrolling=true;
-        } else {
-            double min=(min_scroll+max_scroll)/2-view_size_s/2;
-            double max=(min_scroll+max_scroll)/2+view_size_s/2;
-            //on va du debut jusqu'a view size
-            if( min<0) {
-                min=0;
-                max=view_size_s;
-            }
-            //on va de fin-viewsize jusqu'a la fin
-            if(max>elapsed_time_s) {
-                min=elapsed_time_s-view_size_s;
-                max=elapsed_time_s;
-            }
-            scrollbar->moveSlider(min,max);//move slider coupe le signal, on fait aussi le scrollbar
-            scrollBarMoved(Qt::Horizontal,min,max);
-        }
-    }
-}
-
-void Scope::legendChecked( const QVariant &itemInfo, bool on ) {
-    QwtPlotItem *plotItem=infoToItem(itemInfo);
-    if(plotItem) showCurve( plotItem, on );
+  view_size_s = new_view_size_s;
+
+  if (scrolling == false) {
+    // 4 cas: on utilise le temps au milieu de la vue actuelle
+
+    // le temps total est plus petit que le view_size_s, on affiche tout:
+    if (elapsed_time_s < view_size_s) {
+      scrolling = true;
+    } else {
+      double min = (min_scroll + max_scroll) / 2 - view_size_s / 2;
+      double max = (min_scroll + max_scroll) / 2 + view_size_s / 2;
+      // on va du debut jusqu'a view size
+      if (min < 0) {
+        min = 0;
+        max = view_size_s;
+      }
+      // on va de fin-viewsize jusqu'a la fin
+      if (max > elapsed_time_s) {
+        min = elapsed_time_s - view_size_s;
+        max = elapsed_time_s;
+      }
+      scrollbar->moveSlider(
+          min, max); // move slider coupe le signal, on fait aussi le scrollbar
+      scrollBarMoved(Qt::Horizontal, min, max);
+    }
+  }
+}
+
+void Scope::legendChecked(const QVariant &itemInfo, bool on) {
+  QwtPlotItem *plotItem = infoToItem(itemInfo);
+  if (plotItem)
+    showCurve(plotItem, on);
 }
 
 void Scope::showCurve(QwtPlotItem *item, bool on) {
-    item->setVisible(on);
-
-    QwtLegend *lgd=qobject_cast<QwtLegend*>(legend());
-
-    QList<QWidget*> legendWidgets=lgd->legendWidgets(itemToInfo(item));
-
-    if(legendWidgets.size()==1) {
-        QwtLegendLabel *legendLabel=qobject_cast<QwtLegendLabel*>(legendWidgets[0]);
-
-        if(legendLabel) legendLabel->setChecked( on );
-    }
-}
-
-int Scope::addCurve(QPen pen,QString legend) {
-    Curve* curve=(Curve*)malloc(sizeof(Curve));
-    curve->data_x=(double*)calloc(history_size,sizeof(double));
-    curve->data_y=(double*)calloc(history_size,sizeof(double));
-    curve->index=0;
-    curve->min_index=0;
-    curve->max_index=0;
-
-    // Insert new curve
-    curve->plot=new QwtPlotCurve(legend);
-    curve->plot->attach(this);
-    curve->plot->setPen(pen);
-    curves.append(curve);
-
-    showCurve(curve->plot, true);
-
-    return curves.count()-1;
-}
-
-void Scope::updateCurve(Curve* curve) {
-        if(scrolling==true) {
-        curve->plot->setRawSamples(&curve->data_x[curve->min_index], &curve->data_y[curve->min_index], curve->max_index-curve->min_index);
-    }
-
-    if(curve->index==history_size) {
-        //printf("a revoir qd on arrive a la fin, il faudrait faire un realloc pour rien perdre\n");
-        //attention le setrawdata s'attend a ce que l'adresse change pas, ce qui n'est pas le cas avec lerealloc
-        //il faudra refaire un setrawdata ici
-        curve->index=0;
-        curve->min_index=0;
-        scrolling=true;
-    }
-
-    //determine les index pour la visualisation
-    if(scrolling==true) {
-        curve->max_index=curve->index;
-        computeMinIndex(curve,elapsed_time_s-view_size_s);
-    }
-
-    scrollbar->setBase(0,elapsed_time_s);
-    if(scrolling==true) {
-        scrollbar->moveSlider(elapsed_time_s-view_size_s,elapsed_time_s);
-
-        if(elapsed_time_s<view_size_s) {
-            setAxisScale(QwtPlot::xBottom,0, view_size_s);
-        } else {
-            setAxisScale(QwtPlot::xBottom,elapsed_time_s-view_size_s, elapsed_time_s);
-        }
+  item->setVisible(on);
+
+  QwtLegend *lgd = qobject_cast<QwtLegend *>(legend());
+
+  QList<QWidget *> legendWidgets = lgd->legendWidgets(itemToInfo(item));
+
+  if (legendWidgets.size() == 1) {
+    QwtLegendLabel *legendLabel =
+        qobject_cast<QwtLegendLabel *>(legendWidgets[0]);
+
+    if (legendLabel)
+      legendLabel->setChecked(on);
+  }
+}
+
+int Scope::addCurve(QPen pen, QString legend) {
+  Curve *curve = (Curve *)malloc(sizeof(Curve));
+  curve->data_x = (double *)calloc(history_size, sizeof(double));
+  curve->data_y = (double *)calloc(history_size, sizeof(double));
+  curve->index = 0;
+  curve->min_index = 0;
+  curve->max_index = 0;
+
+  // Insert new curve
+  curve->plot = new QwtPlotCurve(legend);
+  curve->plot->attach(this);
+  curve->plot->setPen(pen);
+  curves.append(curve);
+
+  showCurve(curve->plot, true);
+
+  return curves.count() - 1;
+}
+
+void Scope::updateCurve(Curve *curve) {
+  if (scrolling == true) {
+    curve->plot->setRawSamples(&curve->data_x[curve->min_index],
+                               &curve->data_y[curve->min_index],
+                               curve->max_index - curve->min_index);
+  }
+
+  if (curve->index == history_size) {
+    // printf("a revoir qd on arrive a la fin, il faudrait faire un realloc pour
+    // rien perdre\n");
+    // attention le setrawdata s'attend a ce que l'adresse change pas, ce qui
+    // n'est pas le cas avec lerealloc
+    // il faudra refaire un setrawdata ici
+    curve->index = 0;
+    curve->min_index = 0;
+    scrolling = true;
+  }
+
+  // determine les index pour la visualisation
+  if (scrolling == true) {
+    curve->max_index = curve->index;
+    computeMinIndex(curve, elapsed_time_s - view_size_s);
+  }
+
+  scrollbar->setBase(0, elapsed_time_s);
+  if (scrolling == true) {
+    scrollbar->moveSlider(elapsed_time_s - view_size_s, elapsed_time_s);
+
+    if (elapsed_time_s < view_size_s) {
+      setAxisScale(QwtPlot::xBottom, 0, view_size_s);
     } else {
-        scrollbar->moveSlider(min_scroll,max_scroll);
-    }
+      setAxisScale(QwtPlot::xBottom, elapsed_time_s - view_size_s,
+                   elapsed_time_s);
+    }
+  } else {
+    scrollbar->moveSlider(min_scroll, max_scroll);
+  }
 }
 
 void Scope::alignScales(void) {
-    // The code below shows how to align the scales to
-    // the canvas frame, but is also a good example demonstrating
-    // why the spreaded API needs polishing.
-/*
-    plot->canvas()->setFrameStyle(QFrame::Box | QFrame::Plain );
-    plot->canvas()->setLineWidth(1);
-*/
-    for(int i = 0;i<QwtPlot::axisCnt;i++) {
-        QwtScaleWidget *scaleWidget = (QwtScaleWidget *)axisWidget(i);
-        if(scaleWidget) scaleWidget->setMargin(0);
-
-        QwtScaleDraw *scaleDraw=(QwtScaleDraw *)axisScaleDraw(i);
-        if(scaleDraw) scaleDraw->enableComponent(QwtAbstractScaleDraw::Backbone, false);
-    }
-}
-
-void Scope::scrollBarMoved(Qt::Orientation o, float min, float max)
-{
-    min_scroll=min;
-    max_scroll=max;
-
-    if(max==scrollbar->maxBaseValue()) {
-        scrolling=true;
+  // The code below shows how to align the scales to
+  // the canvas frame, but is also a good example demonstrating
+  // why the spreaded API needs polishing.
+  /*
+      plot->canvas()->setFrameStyle(QFrame::Box | QFrame::Plain );
+      plot->canvas()->setLineWidth(1);
+  */
+  for (int i = 0; i < QwtPlot::axisCnt; i++) {
+    QwtScaleWidget *scaleWidget = (QwtScaleWidget *)axisWidget(i);
+    if (scaleWidget)
+      scaleWidget->setMargin(0);
+
+    QwtScaleDraw *scaleDraw = (QwtScaleDraw *)axisScaleDraw(i);
+    if (scaleDraw)
+      scaleDraw->enableComponent(QwtAbstractScaleDraw::Backbone, false);
+  }
+}
+
+void Scope::scrollBarMoved(Qt::Orientation o, float min, float max) {
+  min_scroll = min;
+  max_scroll = max;
+
+  if (max == scrollbar->maxBaseValue()) {
+    scrolling = true;
+  } else {
+    scrolling = false;
+    setAxisScale(QwtPlot::xBottom, min, max);
+
+    // determine les index pour la visualisation
+    for (int i = 0; i < curves.count(); i++) {
+      computeMinIndex(curves.at(i), min);
+      computeMaxIndex(curves.at(i), max);
+      curves.at(i)->plot->setRawSamples(
+          &curves.at(i)->data_x[curves.at(i)->min_index],
+          &curves.at(i)->data_y[curves.at(i)->min_index],
+          curves.at(i)->max_index - curves.at(i)->min_index);
+    }
+  }
+}
+
+// TODO: faire une dichotomie
+void Scope::computeMinIndex(Curve *curve, float displayed_min_time) {
+  if (curve->data_x[curve->index] > displayed_min_time) {
+    if (curve->data_x[curve->min_index] < displayed_min_time) {
+      while (curve->data_x[curve->min_index] < displayed_min_time &&
+             curve->min_index != curve->index)
+        curve->min_index++;
     } else {
-        scrolling=false;
-        setAxisScale(QwtPlot::xBottom,min,max);
-
-        //determine les index pour la visualisation
-        for(int i=0;i<curves.count();i++) {
-            computeMinIndex(curves.at(i),min);
-            computeMaxIndex(curves.at(i),max);
-            curves.at(i)->plot->setRawSamples(&curves.at(i)->data_x[curves.at(i)->min_index], &curves.at(i)->data_y[curves.at(i)->min_index], curves.at(i)->max_index-curves.at(i)->min_index);
-        }
-    }
-}
-
-//TODO: faire une dichotomie
-void Scope::computeMinIndex(Curve* curve,float displayed_min_time) {
-    if(curve->data_x[curve->index]>displayed_min_time) {
-        if(curve->data_x[curve->min_index]<displayed_min_time) {
-            while(curve->data_x[curve->min_index]<displayed_min_time && curve->min_index!=curve->index) curve->min_index++;
-        } else {
-            while(curve->data_x[curve->min_index]>displayed_min_time && curve->min_index!=0) curve->min_index--;
-        }
-    }
-}
-
-void Scope::computeMaxIndex(Curve* curve,float displayed_max_time) {
-    if(curve->data_x[curve->max_index]<displayed_max_time) {
-        while(curve->data_x[curve->max_index]<displayed_max_time && curve->max_index!=curve->index) curve->max_index++;
-    } else {
-        while(curve->data_x[curve->max_index]>displayed_max_time) curve->max_index--;
-    }
-}
+      while (curve->data_x[curve->min_index] > displayed_min_time &&
+             curve->min_index != 0)
+        curve->min_index--;
+    }
+  }
+}
+
+void Scope::computeMaxIndex(Curve *curve, float displayed_max_time) {
+  if (curve->data_x[curve->max_index] < displayed_max_time) {
+    while (curve->data_x[curve->max_index] < displayed_max_time &&
+           curve->max_index != curve->index)
+      curve->max_index++;
+  } else {
+    while (curve->data_x[curve->max_index] > displayed_max_time)
+      curve->max_index--;
+  }
+}
Index: trunk/tools/FlairGCS/src/Scope.h
===================================================================
--- trunk/tools/FlairGCS/src/Scope.h	(revision 14)
+++ trunk/tools/FlairGCS/src/Scope.h	(revision 15)
@@ -14,48 +14,48 @@
 class QMouseEvent;
 
-class Scope: public QwtPlot {
-    Q_OBJECT
+class Scope : public QwtPlot {
+  Q_OBJECT
 
-    public:
-        Scope(QString title,float ymin, float ymax,float view_size_s=20,unsigned int refresh_rate_ms=40,unsigned int history_size=20000);
-        ~Scope();
-        int addCurve(QPen pen,QString legend);
-        void resetXView(void);
-        void resetYView(void);
+public:
+  Scope(QString title, float ymin, float ymax, float view_size_s = 20,
+        unsigned int refresh_rate_ms = 40, unsigned int history_size = 20000);
+  ~Scope();
+  int addCurve(QPen pen, QString legend);
+  void resetXView(void);
+  void resetYView(void);
 
-    protected:
-        struct Curve {
-            QwtPlotCurve* plot;
-            double* data_x;
-            double* data_y;
-            unsigned int index;
-            unsigned int min_index;
-            unsigned int max_index;
-        };
-        QList<Curve*> curves;
-        float elapsed_time_s;
+protected:
+  struct Curve {
+    QwtPlotCurve *plot;
+    double *data_x;
+    double *data_y;
+    unsigned int index;
+    unsigned int min_index;
+    unsigned int max_index;
+  };
+  QList<Curve *> curves;
+  float elapsed_time_s;
 
-        void updateCurve(Curve* curve);
-        bool eventFilter(QObject *, QEvent *);
+  void updateCurve(Curve *curve);
+  bool eventFilter(QObject *, QEvent *);
 
-    private:
-        float ymin,ymax;
-        float view_size_s,orig_view_size_s;
-        unsigned int history_size;
-        ScrollBar* scrollbar;
-        bool scrolling;
-        float min_scroll,max_scroll;
+private:
+  float ymin, ymax;
+  float view_size_s, orig_view_size_s;
+  unsigned int history_size;
+  ScrollBar *scrollbar;
+  bool scrolling;
+  float min_scroll, max_scroll;
 
-        void alignScales(void);
-        void showCurve(QwtPlotItem *item, bool on);
-        void computeMinIndex(Curve* curve,float displayed_min_time);
-        void computeMaxIndex(Curve* curve,float displayed_max_time);
-        void changeViewSize(float new_view_size_s);
+  void alignScales(void);
+  void showCurve(QwtPlotItem *item, bool on);
+  void computeMinIndex(Curve *curve, float displayed_min_time);
+  void computeMaxIndex(Curve *curve, float displayed_max_time);
+  void changeViewSize(float new_view_size_s);
 
-    private slots:
-        void legendChecked(const QVariant &itemInfo, bool on );
-        void scrollBarMoved(Qt::Orientation o, float min, float max);
+private slots:
+  void legendChecked(const QVariant &itemInfo, bool on);
+  void scrollBarMoved(Qt::Orientation o, float min, float max);
 };
 
-
 #endif // SCOPE_H_INCLUDED
Index: trunk/tools/FlairGCS/src/ScopeFixedStep.cpp
===================================================================
--- trunk/tools/FlairGCS/src/ScopeFixedStep.cpp	(revision 14)
+++ trunk/tools/FlairGCS/src/ScopeFixedStep.cpp	(revision 15)
@@ -7,22 +7,24 @@
 #include <qwt_plot_curve.h>
 
-ScopeFixedStep::ScopeFixedStep(QString title,float ymin,float ymax,float step_s,float view_size_s,unsigned int refresh_rate_ms,unsigned int history_size): Scope(title,ymin,ymax,view_size_s,refresh_rate_ms,history_size) {
-    this->step_s=step_s;
+ScopeFixedStep::ScopeFixedStep(QString title, float ymin, float ymax,
+                               float step_s, float view_size_s,
+                               unsigned int refresh_rate_ms,
+                               unsigned int history_size)
+    : Scope(title, ymin, ymax, view_size_s, refresh_rate_ms, history_size) {
+  this->step_s = step_s;
 }
 
-ScopeFixedStep::~ScopeFixedStep() {
+ScopeFixedStep::~ScopeFixedStep() {}
 
+void ScopeFixedStep::plot(double *value) {
+  elapsed_time_s += step_s;
+  for (int i = 0; i < curves.count(); i++) {
+    Curve *curve = curves.at(i);
+
+    curve->data_x[curve->index] = elapsed_time_s;
+    curve->data_y[curve->index] = value[i];
+    curve->index++;
+
+    updateCurve(curve);
+  }
 }
-
-void ScopeFixedStep::plot(double* value) {
-    elapsed_time_s+=step_s;
-    for(int i=0;i<curves.count();i++) {
-        Curve* curve=curves.at(i);
-
-        curve->data_x[curve->index]=elapsed_time_s;
-        curve->data_y[curve->index]=value[i];
-        curve->index++;
-
-        updateCurve(curve);
-    }
-}
Index: trunk/tools/FlairGCS/src/ScopeFixedStep.h
===================================================================
--- trunk/tools/FlairGCS/src/ScopeFixedStep.h	(revision 14)
+++ trunk/tools/FlairGCS/src/ScopeFixedStep.h	(revision 15)
@@ -8,15 +8,15 @@
 #include <Scope.h>
 
+class ScopeFixedStep : public Scope {
+public:
+  ScopeFixedStep(QString title, float ymin, float ymax, float step_s,
+                 float view_size_s = 20, unsigned int refresh_rate_ms = 40,
+                 unsigned int history_size = 20000);
+  ~ScopeFixedStep();
+  void plot(double *value);
 
-class ScopeFixedStep: public Scope {
-    public:
-        ScopeFixedStep(QString title,float ymin, float ymax,float step_s,float view_size_s=20,unsigned int refresh_rate_ms=40,unsigned int history_size=20000);
-        ~ScopeFixedStep();
-        void plot(double* value);
-
-    protected:
-        float step_s;
+protected:
+  float step_s;
 };
 
-
 #endif // SCOPEFIXEDSTEP_H_INCLUDED
Index: trunk/tools/FlairGCS/src/ScopeVariableStep.cpp
===================================================================
--- trunk/tools/FlairGCS/src/ScopeVariableStep.cpp	(revision 14)
+++ trunk/tools/FlairGCS/src/ScopeVariableStep.cpp	(revision 15)
@@ -8,21 +8,22 @@
 #include <qwt_plot_curve.h>
 
-ScopeVariableStep::ScopeVariableStep(QString title,float ymin,float ymax,float view_size_s,unsigned int refresh_rate_ms,unsigned int history_size): Scope(title,ymin,ymax,view_size_s,refresh_rate_ms,history_size) {
+ScopeVariableStep::ScopeVariableStep(QString title, float ymin, float ymax,
+                                     float view_size_s,
+                                     unsigned int refresh_rate_ms,
+                                     unsigned int history_size)
+    : Scope(title, ymin, ymax, view_size_s, refresh_rate_ms, history_size) {}
 
+ScopeVariableStep::~ScopeVariableStep() {}
+
+void ScopeVariableStep::plot(double value, QTime time,
+                             unsigned int curve_index) {
+  static QTime start_time = QTime::currentTime();
+  Curve *curve = curves.at(curve_index);
+
+  elapsed_time_s = start_time.msecsTo(time) / 1000.;
+  curve->data_x[curve->index] = elapsed_time_s;
+  curve->data_y[curve->index] = value;
+  curve->index++;
+
+  updateCurve(curve);
 }
-
-ScopeVariableStep::~ScopeVariableStep() {
-
-}
-
-void ScopeVariableStep::plot(double value,QTime time,unsigned int curve_index) {
-    static QTime start_time=QTime::currentTime();
-    Curve* curve=curves.at(curve_index);
-
-    elapsed_time_s=start_time.msecsTo(time)/1000.;
-    curve->data_x[curve->index]=elapsed_time_s;
-    curve->data_y[curve->index]=value;
-    curve->index++;
-
-    updateCurve(curve);
-}
Index: trunk/tools/FlairGCS/src/ScopeVariableStep.h
===================================================================
--- trunk/tools/FlairGCS/src/ScopeVariableStep.h	(revision 14)
+++ trunk/tools/FlairGCS/src/ScopeVariableStep.h	(revision 15)
@@ -8,14 +8,14 @@
 #include <Scope.h>
 
-class ScopeVariableStep: public Scope {
-    public:
-        ScopeVariableStep(QString title,float ymin, float ymax,float view_size_s=20,unsigned int refresh_rate_ms=40,unsigned int history_size=20000);
-        ~ScopeVariableStep();
-        void plot(double value,QTime time,unsigned int curve_index=0);
+class ScopeVariableStep : public Scope {
+public:
+  ScopeVariableStep(QString title, float ymin, float ymax,
+                    float view_size_s = 20, unsigned int refresh_rate_ms = 40,
+                    unsigned int history_size = 20000);
+  ~ScopeVariableStep();
+  void plot(double value, QTime time, unsigned int curve_index = 0);
 
-    private:
-
+private:
 };
 
-
 #endif // SCOPEVARIABLESTEP_H_INCLUDED
Index: trunk/tools/FlairGCS/src/Scrollbar.cpp
===================================================================
--- trunk/tools/FlairGCS/src/Scrollbar.cpp	(revision 14)
+++ trunk/tools/FlairGCS/src/Scrollbar.cpp	(revision 15)
@@ -7,167 +7,137 @@
 #include "Scrollbar.h"
 
-ScrollBar::ScrollBar(QWidget * parent):
-    QScrollBar(parent)
-{
-    init();
+ScrollBar::ScrollBar(QWidget *parent) : QScrollBar(parent) { init(); }
+
+ScrollBar::ScrollBar(Qt::Orientation o, QWidget *parent)
+    : QScrollBar(o, parent) {
+  init();
 }
 
-ScrollBar::ScrollBar(Qt::Orientation o,
-        QWidget *parent):
-    QScrollBar(o, parent)
-{
-    init();
+ScrollBar::ScrollBar(float minBase, float maxBase, Qt::Orientation o,
+                     QWidget *parent)
+    : QScrollBar(o, parent) {
+  init();
+  setBase(minBase, maxBase);
+  moveSlider(minBase, maxBase);
 }
 
-ScrollBar::ScrollBar(float minBase, float maxBase,
-        Qt::Orientation o, QWidget *parent):
-    QScrollBar(o, parent)
-{
-    init();
-    setBase(minBase, maxBase);
-    moveSlider(minBase, maxBase);
+void ScrollBar::init(void) {
+  d_inverted = orientation() == Qt::Vertical;
+  d_baseTicks = 1000000;
+  d_minBase = 0.0;
+  d_maxBase = 1.0;
+  moveSlider(d_minBase, d_maxBase);
+
+  connect(this, SIGNAL(sliderMoved(int)), SLOT(catchSliderMoved(int)));
+  connect(this, SIGNAL(valueChanged(int)), SLOT(catchValueChanged(int)));
 }
 
-void ScrollBar::init(void)
-{
-    d_inverted = orientation() == Qt::Vertical;
-    d_baseTicks = 1000000;
-    d_minBase = 0.0;
-    d_maxBase = 1.0;
-    moveSlider(d_minBase, d_maxBase);
-
-    connect(this, SIGNAL(sliderMoved(int)), SLOT(catchSliderMoved(int)));
-    connect(this, SIGNAL(valueChanged(int)), SLOT(catchValueChanged(int)));
+void ScrollBar::setInverted(bool inverted) {
+  if (d_inverted != inverted) {
+    d_inverted = inverted;
+    moveSlider(minSliderValue(), maxSliderValue());
+  }
 }
 
-void ScrollBar::setInverted(bool inverted)
-{
-    if ( d_inverted != inverted )
-    {
-        d_inverted = inverted;
-        moveSlider(minSliderValue(), maxSliderValue());
-    }
+bool ScrollBar::isInverted(void) const { return d_inverted; }
+
+void ScrollBar::setBase(float min, float max) {
+  if (min != d_minBase || max != d_maxBase) {
+    d_minBase = min;
+    d_maxBase = max;
+
+    moveSlider(minSliderValue(), maxSliderValue());
+  }
 }
 
-bool ScrollBar::isInverted(void) const
-{
-    return d_inverted;
+void ScrollBar::moveSlider(float min, float max) {
+  const int sliderTicks =
+      qRound((max - min) / (d_maxBase - d_minBase) * d_baseTicks);
+
+  // setRange initiates a valueChanged of the scrollbars
+  // in some situations. So we block
+  // and unblock the signals.
+
+  blockSignals(true);
+
+  setRange(sliderTicks / 2, d_baseTicks - sliderTicks / 2);
+  int steps = sliderTicks / 200;
+  if (steps <= 0)
+    steps = 1;
+
+  setSingleStep(steps);
+  setPageStep(sliderTicks);
+
+  int tick = mapToTick(min + (max - min) / 2);
+  if (isInverted())
+    tick = d_baseTicks - tick;
+
+  setSliderPosition(tick);
+  blockSignals(false);
 }
 
-void ScrollBar::setBase(float min, float max)
-{
-    if ( min != d_minBase || max != d_maxBase )
-    {
-        d_minBase = min;
-        d_maxBase = max;
+float ScrollBar::minBaseValue(void) const { return d_minBase; }
 
-        moveSlider(minSliderValue(), maxSliderValue());
-    }
+float ScrollBar::maxBaseValue(void) const { return d_maxBase; }
+
+void ScrollBar::sliderRange(int value, float &min, float &max) const {
+  if (isInverted())
+    value = d_baseTicks - value;
+
+  const int visibleTicks = pageStep();
+
+  min = mapFromTick(value - visibleTicks / 2);
+  max = mapFromTick(value + visibleTicks / 2);
 }
 
-void ScrollBar::moveSlider(float min, float max)
-{
-    const int sliderTicks = qRound((max - min) /
-        (d_maxBase - d_minBase) * d_baseTicks);
+float ScrollBar::minSliderValue(void) const {
+  float min, dummy;
+  sliderRange(value(), min, dummy);
 
-    // setRange initiates a valueChanged of the scrollbars
-    // in some situations. So we block
-    // and unblock the signals.
-
-    blockSignals(true);
-
-    setRange(sliderTicks / 2, d_baseTicks - sliderTicks / 2);
-    int steps = sliderTicks / 200;
-    if ( steps <= 0 )
-        steps = 1;
-
-    setSingleStep(steps);
-    setPageStep(sliderTicks);
-
-    int tick = mapToTick(min + (max - min) / 2);
-    if ( isInverted() )
-        tick = d_baseTicks - tick;
-
-    setSliderPosition(tick);
-    blockSignals(false);
+  return min;
 }
 
-float ScrollBar::minBaseValue(void) const
-{
-    return d_minBase;
+float ScrollBar::maxSliderValue(void) const {
+  float max, dummy;
+  sliderRange(value(), dummy, max);
+
+  return max;
 }
 
-float ScrollBar::maxBaseValue(void) const
-{
-    return d_maxBase;
+int ScrollBar::mapToTick(float v) const {
+  return (int)((v - d_minBase) / (d_maxBase - d_minBase) * d_baseTicks);
 }
 
-void ScrollBar::sliderRange(int value, float &min, float &max) const
-{
-    if ( isInverted() )
-        value = d_baseTicks - value;
-
-    const int visibleTicks = pageStep();
-
-    min = mapFromTick(value - visibleTicks / 2);
-    max = mapFromTick(value + visibleTicks / 2);
+float ScrollBar::mapFromTick(int tick) const {
+  return d_minBase + (d_maxBase - d_minBase) * tick / d_baseTicks;
 }
 
-float ScrollBar::minSliderValue(void) const
-{
-    float min, dummy;
-    sliderRange(value(), min, dummy);
-
-    return min;
+void ScrollBar::catchValueChanged(int value) {
+  float min, max;
+  sliderRange(value, min, max);
+  Q_EMIT valueChanged(orientation(), min, max);
 }
 
-float ScrollBar::maxSliderValue(void) const
-{
-    float max, dummy;
-    sliderRange(value(), dummy, max);
-
-    return max;
+void ScrollBar::catchSliderMoved(int value) {
+  float min, max;
+  sliderRange(value, min, max);
+  Q_EMIT sliderMoved(orientation(), min, max);
 }
 
-int ScrollBar::mapToTick(float v) const
-{
-    return (int) ( ( v - d_minBase) / (d_maxBase - d_minBase ) * d_baseTicks );
+int ScrollBar::extent(void) const {
+  QStyleOptionSlider opt;
+  opt.init(this);
+  opt.subControls = QStyle::SC_None;
+  opt.activeSubControls = QStyle::SC_None;
+  opt.orientation = orientation();
+  opt.minimum = minimum();
+  opt.maximum = maximum();
+  opt.sliderPosition = sliderPosition();
+  opt.sliderValue = value();
+  opt.singleStep = singleStep();
+  opt.pageStep = pageStep();
+  opt.upsideDown = invertedAppearance();
+  if (orientation() == Qt::Horizontal)
+    opt.state |= QStyle::State_Horizontal;
+  return style()->pixelMetric(QStyle::PM_ScrollBarExtent, &opt, this);
 }
-
-float ScrollBar::mapFromTick(int tick) const
-{
-    return d_minBase + ( d_maxBase - d_minBase ) * tick / d_baseTicks;
-}
-
-void ScrollBar::catchValueChanged(int value)
-{
-    float min, max;
-    sliderRange(value, min, max);
-    Q_EMIT valueChanged(orientation(), min, max);
-}
-
-void ScrollBar::catchSliderMoved(int value)
-{
-    float min, max;
-    sliderRange(value, min, max);
-    Q_EMIT sliderMoved(orientation(), min, max);
-}
-
-int ScrollBar::extent(void) const
-{
-    QStyleOptionSlider opt;
-    opt.init(this);
-    opt.subControls = QStyle::SC_None;
-    opt.activeSubControls = QStyle::SC_None;
-    opt.orientation = orientation();
-    opt.minimum = minimum();
-    opt.maximum = maximum();
-    opt.sliderPosition = sliderPosition();
-    opt.sliderValue = value();
-    opt.singleStep = singleStep();
-    opt.pageStep = pageStep();
-    opt.upsideDown = invertedAppearance();
-    if (orientation() == Qt::Horizontal)
-        opt.state |= QStyle::State_Horizontal;
-    return style()->pixelMetric(QStyle::PM_ScrollBarExtent, &opt, this);
-}
Index: trunk/tools/FlairGCS/src/Scrollbar.h
===================================================================
--- trunk/tools/FlairGCS/src/Scrollbar.h	(revision 14)
+++ trunk/tools/FlairGCS/src/Scrollbar.h	(revision 15)
@@ -8,49 +8,48 @@
 #include <qscrollbar.h>
 
-class ScrollBar: public QScrollBar
-{
-    Q_OBJECT
+class ScrollBar : public QScrollBar {
+  Q_OBJECT
 
 public:
-    ScrollBar(QWidget *parent = NULL);
-    ScrollBar(Qt::Orientation, QWidget *parent = NULL);
-    ScrollBar(float minBase, float maxBase,
-        Qt::Orientation o, QWidget *parent = NULL);
+  ScrollBar(QWidget *parent = NULL);
+  ScrollBar(Qt::Orientation, QWidget *parent = NULL);
+  ScrollBar(float minBase, float maxBase, Qt::Orientation o,
+            QWidget *parent = NULL);
 
-    void setInverted(bool);
-    bool isInverted(void) const;
+  void setInverted(bool);
+  bool isInverted(void) const;
 
-    float minBaseValue(void) const;
-    float maxBaseValue(void) const;
+  float minBaseValue(void) const;
+  float maxBaseValue(void) const;
 
-    float minSliderValue(void) const;
-    float maxSliderValue(void) const;
+  float minSliderValue(void) const;
+  float maxSliderValue(void) const;
 
-    int extent(void) const;
+  int extent(void) const;
 
 Q_SIGNALS:
-    void sliderMoved(Qt::Orientation, float, float);
-    void valueChanged(Qt::Orientation, float, float);
+  void sliderMoved(Qt::Orientation, float, float);
+  void valueChanged(Qt::Orientation, float, float);
 
 public Q_SLOTS:
-    virtual void setBase(float min, float max);
-    virtual void moveSlider(float min, float max);
+  virtual void setBase(float min, float max);
+  virtual void moveSlider(float min, float max);
 
 protected:
-    void sliderRange(int value, float &min, float &max) const;
-    int mapToTick(float) const;
-    float mapFromTick(int) const;
+  void sliderRange(int value, float &min, float &max) const;
+  int mapToTick(float) const;
+  float mapFromTick(int) const;
 
 private Q_SLOTS:
-    void catchValueChanged(int value);
-    void catchSliderMoved(int value);
+  void catchValueChanged(int value);
+  void catchSliderMoved(int value);
 
 private:
-    void init(void);
+  void init(void);
 
-    bool d_inverted;
-    float d_minBase;
-    float d_maxBase;
-    int d_baseTicks;
+  bool d_inverted;
+  float d_minBase;
+  float d_maxBase;
+  int d_baseTicks;
 };
 
Index: trunk/tools/FlairGCS/src/SpinBox.cpp
===================================================================
--- trunk/tools/FlairGCS/src/SpinBox.cpp	(revision 14)
+++ trunk/tools/FlairGCS/src/SpinBox.cpp	(revision 15)
@@ -8,66 +8,47 @@
 #include <QSpinBox>
 
-SpinBox::SpinBox(Layout* parent,int row, int col,QString name,QString suffix,int value,int min,int max,int step): FormLayout(parent,row,col,name,"SpinBox")
-{
-    spinbox = new QSpinBox();
+SpinBox::SpinBox(Layout *parent, int row, int col, QString name, QString suffix,
+                 int value, int min, int max, int step)
+    : FormLayout(parent, row, col, name, "SpinBox") {
+  spinbox = new QSpinBox();
 
-    spinbox->setRange(min,max);
-    spinbox->setSingleStep(step);
-    spinbox->setValue(value);
-    spinbox->setSuffix(suffix);
-    spinbox_value=value;
+  spinbox->setRange(min, max);
+  spinbox->setSingleStep(step);
+  spinbox->setValue(value);
+  spinbox->setSuffix(suffix);
+  spinbox_value = value;
 
-    object_layout->addRow(name,spinbox);
+  object_layout->addRow(name, spinbox);
 
-    connect(spinbox,SIGNAL(valueChanged(int)),this, SLOT(valuechanged(int)));
+  connect(spinbox, SIGNAL(valueChanged(int)), this, SLOT(valuechanged(int)));
 
-    SetValue(QString::number(spinbox_value));
+  SetValue(QString::number(spinbox_value));
 }
 
-SpinBox::~SpinBox()
-{
-    delete spinbox;
+SpinBox::~SpinBox() { delete spinbox; }
+
+void SpinBox::SetUptodate(void) {
+  ui_to_var();
+  ui_to_xml();
+  visible_widget->setPalette(black_pal);
 }
 
-void SpinBox::SetUptodate(void)
-{
-    ui_to_var();
-    ui_to_xml();
-    visible_widget->setPalette(black_pal);
+void SpinBox::ui_to_var(void) { spinbox_value = spinbox->value(); }
 
+void SpinBox::ui_to_xml(void) { SetValue(QString::number(spinbox->value())); }
+
+void SpinBox::Reset(void) { spinbox->setValue(spinbox_value); }
+
+void SpinBox::LoadEvent(QDomElement dom) {
+  if (spinbox->isEnabled() == true) {
+    spinbox->setValue((dom.attribute("value")).toInt());
+  }
 }
 
-void SpinBox::ui_to_var(void)
-{
-    spinbox_value=spinbox->value();
+void SpinBox::valuechanged(int value) {
+  if (value != spinbox_value) {
+    visible_widget->setPalette(red_pal);
+  } else {
+    visible_widget->setPalette(black_pal);
+  }
 }
-
-void SpinBox::ui_to_xml(void)
-{
-    SetValue(QString::number(spinbox->value()));
-}
-
-void SpinBox::Reset(void)
-{
-    spinbox->setValue(spinbox_value);
-}
-
-void SpinBox::LoadEvent(QDomElement dom)
-{
-    if(spinbox->isEnabled()==true)
-    {
-        spinbox->setValue((dom.attribute("value")).toInt());
-    }
-}
-
-void SpinBox::valuechanged(int value)
-{
-    if(value!=spinbox_value)
-    {
-        visible_widget->setPalette(red_pal);
-    }
-    else
-    {
-        visible_widget->setPalette(black_pal);
-    }
-}
Index: trunk/tools/FlairGCS/src/SpinBox.h
===================================================================
--- trunk/tools/FlairGCS/src/SpinBox.h	(revision 14)
+++ trunk/tools/FlairGCS/src/SpinBox.h	(revision 15)
@@ -11,24 +11,24 @@
 class QSpinBox;
 
-class SpinBox: public FormLayout
-{
-    Q_OBJECT
+class SpinBox : public FormLayout {
+  Q_OBJECT
 
-    public:
-        SpinBox(Layout* parent,int row, int col,QString name,QString suffix,int value,int min,int max,int step);
-        ~SpinBox();
+public:
+  SpinBox(Layout *parent, int row, int col, QString name, QString suffix,
+          int value, int min, int max, int step);
+  ~SpinBox();
 
-    private:
-        QSpinBox* spinbox;
-        int spinbox_value;
-        void SetUptodate(void);
-        void Reset(void);
-        void LoadEvent(QDomElement dom);
+private:
+  QSpinBox *spinbox;
+  int spinbox_value;
+  void SetUptodate(void);
+  void Reset(void);
+  void LoadEvent(QDomElement dom);
 
-        void ui_to_var(void);
-        void ui_to_xml(void);
+  void ui_to_var(void);
+  void ui_to_xml(void);
 
-    private slots:
-        void valuechanged(int value);
+private slots:
+  void valuechanged(int value);
 };
 
Index: trunk/tools/FlairGCS/src/Tab.cpp
===================================================================
--- trunk/tools/FlairGCS/src/Tab.cpp	(revision 14)
+++ trunk/tools/FlairGCS/src/Tab.cpp	(revision 15)
@@ -7,16 +7,15 @@
 #include <QGridLayout>
 
-Tab::Tab(TabWidget* parent,QString name,int position): Layout(new QWidget(),parent,name,"Tab") {
-    parent_tab=parent;
-    onglet = getQGridLayout()->parentWidget();
-    onglet->setObjectName(name);
-    if(position==-1) {
-        parent->tab->addTab(onglet, name);
-    } else {
-        parent->tab->insertTab(position,onglet, name);
-    }
+Tab::Tab(TabWidget *parent, QString name, int position)
+    : Layout(new QWidget(), parent, name, "Tab") {
+  parent_tab = parent;
+  onglet = getQGridLayout()->parentWidget();
+  onglet->setObjectName(name);
+  if (position == -1) {
+    parent->tab->addTab(onglet, name);
+  } else {
+    parent->tab->insertTab(position, onglet, name);
+  }
 }
 
-Tab::~Tab() {
-    parent_tab->tab->removeTab(parent_tab->tab->indexOf(onglet));
-}
+Tab::~Tab() { parent_tab->tab->removeTab(parent_tab->tab->indexOf(onglet)); }
Index: trunk/tools/FlairGCS/src/Tab.h
===================================================================
--- trunk/tools/FlairGCS/src/Tab.h	(revision 14)
+++ trunk/tools/FlairGCS/src/Tab.h	(revision 15)
@@ -10,15 +10,13 @@
 class TabWidget;
 
-class Tab: public Layout
-{
+class Tab : public Layout {
 
-    public:
-        Tab(TabWidget* parent,QString name,int position);
-        ~Tab();
+public:
+  Tab(TabWidget *parent, QString name, int position);
+  ~Tab();
 
-    private:
-        TabWidget *parent_tab;
-        QWidget* onglet;
-
+private:
+  TabWidget *parent_tab;
+  QWidget *onglet;
 };
 
Index: trunk/tools/FlairGCS/src/TabWidget.cpp
===================================================================
--- trunk/tools/FlairGCS/src/TabWidget.cpp	(revision 14)
+++ trunk/tools/FlairGCS/src/TabWidget.cpp	(revision 15)
@@ -10,41 +10,37 @@
 //#include "qledindicator.h"
 
-TabWidget::TabWidget(Layout* parent,int row,int col,QString name,QTabWidget::TabPosition position):XmlWidget(name,"TabWidget",parent)
-{
-    tab=new QTabWidget();
-//tab->setTabShape(QTabWidget::Triangular);
-//tab->setDocumentMode(true);
-    parent->addWidget(tab,row,col);
-    tab->setTabPosition(position);
-    SetIsContainer(true);
-    SetIsExpandable(true);
-    visible_widget=tab;
+TabWidget::TabWidget(Layout *parent, int row, int col, QString name,
+                     QTabWidget::TabPosition position)
+    : XmlWidget(name, "TabWidget", parent) {
+  tab = new QTabWidget();
+  // tab->setTabShape(QTabWidget::Triangular);
+  // tab->setDocumentMode(true);
+  parent->addWidget(tab, row, col);
+  tab->setTabPosition(position);
+  SetIsContainer(true);
+  SetIsExpandable(true);
+  visible_widget = tab;
 
-    //QLedIndicator* led=new QLedIndicator(tab);
-    //tab->setCornerWidget(led,Qt::TopLeftCorner);
+  // QLedIndicator* led=new QLedIndicator(tab);
+  // tab->setCornerWidget(led,Qt::TopLeftCorner);
 }
 
-TabWidget::~TabWidget()
-{
+TabWidget::~TabWidget() {}
+
+void TabWidget::XmlEvent(QDomElement dom) {
+  QString type = dom.tagName();
+  QString name = dom.attribute("name");
+  int position = dom.attribute("position").toInt();
+
+  if (type == "Tab") {
+    Tab *layout = new Tab(this, name, position);
+  }
 }
 
-void TabWidget::XmlEvent(QDomElement dom)
-{
-    QString type=dom.tagName();
-    QString name=dom.attribute("name");
-    int position=dom.attribute("position").toInt();
-
-    if(type=="Tab")
-    {
-        Tab* layout = new Tab(this,name,position);
-    }
+bool TabWidget::IsUptodate(void) {
+  for (int i = 0; i < childs->count(); i++) {
+    if (childs->at(i)->IsUptodate() == false)
+      return false;
+  }
+  return true;
 }
-
-bool TabWidget::IsUptodate(void)
-{
-    for(int i=0;i<childs->count();i++)
-    {
-        if(childs->at(i)->IsUptodate()==false) return false;
-    }
-    return true;
-}
Index: trunk/tools/FlairGCS/src/TabWidget.h
===================================================================
--- trunk/tools/FlairGCS/src/TabWidget.h	(revision 14)
+++ trunk/tools/FlairGCS/src/TabWidget.h	(revision 15)
@@ -11,18 +11,16 @@
 class Layout;
 
-class TabWidget: public XmlWidget
-{
-    friend class Tab;
+class TabWidget : public XmlWidget {
+  friend class Tab;
 
-    public:
-        TabWidget(Layout* parent,int row,int col,QString name,QTabWidget::TabPosition position);
-        ~TabWidget();
-        bool IsUptodate(void);
+public:
+  TabWidget(Layout *parent, int row, int col, QString name,
+            QTabWidget::TabPosition position);
+  ~TabWidget();
+  bool IsUptodate(void);
 
-    private:
-        QTabWidget* tab;
-        void XmlEvent(QDomElement dom);
-
-
+private:
+  QTabWidget *tab;
+  void XmlEvent(QDomElement dom);
 };
 
Index: trunk/tools/FlairGCS/src/TextEdit.cpp
===================================================================
--- trunk/tools/FlairGCS/src/TextEdit.cpp	(revision 14)
+++ trunk/tools/FlairGCS/src/TextEdit.cpp	(revision 15)
@@ -9,29 +9,25 @@
 #include <QTextEdit>
 
-TextEdit::TextEdit(Layout* parent,int row, int col,QString name):XmlWidget(name,"TextEdit",parent)
-{
+TextEdit::TextEdit(Layout *parent, int row, int col, QString name)
+    : XmlWidget(name, "TextEdit", parent) {
 
-    visible_widget = new QWidget();
-    visible_widget->setObjectName(name);
+  visible_widget = new QWidget();
+  visible_widget->setObjectName(name);
 
-    layout = new QGridLayout(visible_widget);
-    clear= new QPushButton("Effacer");
-    text=new QTextEdit();
+  layout = new QGridLayout(visible_widget);
+  clear = new QPushButton("Effacer");
+  text = new QTextEdit();
 
-    layout->addWidget(text,0,0);
-    layout->addWidget(clear,1,0);
+  layout->addWidget(text, 0, 0);
+  layout->addWidget(clear, 1, 0);
 
-    connect(clear, SIGNAL(clicked(bool)),text, SLOT(clear()));
+  connect(clear, SIGNAL(clicked(bool)), text, SLOT(clear()));
 
-    parent->addWidget(visible_widget,row,col);
+  parent->addWidget(visible_widget, row, col);
 }
 
-TextEdit::~TextEdit()
-{
+TextEdit::~TextEdit() {}
 
+void TextEdit::XmlEvent(QDomElement dom) {
+  text->append(dom.attribute("value"));
 }
-
-void TextEdit::XmlEvent(QDomElement dom)
-{
-    text->append(dom.attribute("value"));
-}
Index: trunk/tools/FlairGCS/src/TextEdit.h
===================================================================
--- trunk/tools/FlairGCS/src/TextEdit.h	(revision 14)
+++ trunk/tools/FlairGCS/src/TextEdit.h	(revision 15)
@@ -13,15 +13,14 @@
 class Layout;
 
-class TextEdit: public XmlWidget
-{
-    public:
-        TextEdit(Layout* parent,int row, int col,QString name);
-        ~TextEdit();
+class TextEdit : public XmlWidget {
+public:
+  TextEdit(Layout *parent, int row, int col, QString name);
+  ~TextEdit();
 
-    private:
-        QGridLayout *layout;
-        QPushButton *clear;
-        QTextEdit *text;
-        void XmlEvent(QDomElement dom);
+private:
+  QGridLayout *layout;
+  QPushButton *clear;
+  QTextEdit *text;
+  void XmlEvent(QDomElement dom);
 };
 
Index: trunk/tools/FlairGCS/src/UdtSocket.cpp
===================================================================
--- trunk/tools/FlairGCS/src/UdtSocket.cpp	(revision 14)
+++ trunk/tools/FlairGCS/src/UdtSocket.cpp	(revision 15)
@@ -14,200 +14,216 @@
 
 #ifndef WIN32
-   #include <arpa/inet.h>
+#include <arpa/inet.h>
 #else
-   #include <winsock2.h>
-   #include <ws2tcpip.h>
+#include <winsock2.h>
+#include <ws2tcpip.h>
 #endif
 
 using namespace std;
 
-UdtSocket::UdtSocket(UDTSOCKET file_socket,UDTSOCKET com_socket,QString name): QObject() {
-    this->file_socket=file_socket;
-    this->com_socket=com_socket;
-    this->name=name;
-    stop=false;
-    file_dialog=new file_ui();
-
-    bool blocking = true;
-    UDT::setsockopt(file_socket, 0, UDT_RCVSYN, &blocking, sizeof(bool));
-
-    heartbeat_timer = new QTimer(this);
-    connect(heartbeat_timer, SIGNAL(timeout()), this, SLOT(heartbeat()));
-    heartbeat_timer->start(200);
+UdtSocket::UdtSocket(UDTSOCKET file_socket, UDTSOCKET com_socket, QString name)
+    : QObject() {
+  this->file_socket = file_socket;
+  this->com_socket = com_socket;
+  this->name = name;
+  stop = false;
+  file_dialog = new file_ui();
+
+  bool blocking = true;
+  UDT::setsockopt(file_socket, 0, UDT_RCVSYN, &blocking, sizeof(bool));
+
+  heartbeat_timer = new QTimer(this);
+  connect(heartbeat_timer, SIGNAL(timeout()), this, SLOT(heartbeat()));
+  heartbeat_timer->start(200);
 }
 
 UdtSocket::~UdtSocket() {
-    heartbeat_timer->stop();
-
-    UDT::close(file_socket);
-    UDT::close(com_socket);
-
-    file_dialog->deleteLater();
-}
-
-//send signal to uav, to check connectivity through a watchdog
-//this is necessary because we use udt (udp based), and we cannot check disconnection of ground station
+  heartbeat_timer->stop();
+
+  UDT::close(file_socket);
+  UDT::close(com_socket);
+
+  file_dialog->deleteLater();
+}
+
+// send signal to uav, to check connectivity through a watchdog
+// this is necessary because we use udt (udp based), and we cannot check
+// disconnection of ground station
 void UdtSocket::heartbeat(void) {
-    char data=WATCHDOG_HEADER;
-    write(&data,1);
+  char data = WATCHDOG_HEADER;
+  write(&data, 1);
 }
 
 void UdtSocket::kill(void) {
-    printf("disconnected\n");
-    stop=true;
-    deleteLater();
+  printf("disconnected\n");
+  stop = true;
+  deleteLater();
 }
 
 void UdtSocket::handleConnections(void) {
-    while(!stop) {
-        int eid = UDT::epoll_create();
-        if(eid<0) {
-            printf("epoll_create error: %s\n",UDT::getlasterror().getErrorMessage());
-        }
-
-        if(UDT::epoll_add_usock(eid,file_socket)<0) {
-            if(UDT::getlasterror().getErrorCode()==5004) {
-                printf("epoll_add_usock\n");
-                break;
-            } else {
-                printf("epoll_add_usock error: %s\n",UDT::getlasterror().getErrorMessage());
-            }
-        }
-        if(UDT::epoll_add_usock(eid,com_socket)<0) {
-            if(UDT::getlasterror().getErrorCode()==5004) {
-                printf("epoll_add_usock\n");
-                break;
-            } else {
-                printf("epoll_add_usock error: %s\n",UDT::getlasterror().getErrorMessage());
-            }
-        }
-
-        set<UDTSOCKET> readfds;
-
-        int rv=UDT::epoll_wait(eid, &readfds,NULL, 10) ;
-
-        if(rv == -1) {
-            if(UDT::getlasterror().getErrorCode()!=6003) printf("prob %i\n",UDT::getlasterror().getErrorCode());
-            //printf("wait\n");
-        } else if(rv == 0) {
-            printf("timeout\n"); // a timeout occured
-        } else {
-            /*
-            if(UDT::getlasterror().getErrorCode()==2001) {
-                UDT::epoll_release(eid);
-            }*/
-            for (set<UDTSOCKET>::iterator i = readfds.begin(); i != readfds.end(); i++) {
-                //printf("a\n");
-                if(*i==file_socket) receiveFile();
-                if(*i==com_socket) receiveData();
-            }
-        }
-
-        UDT::epoll_remove_usock(eid,file_socket);
-        UDT::epoll_remove_usock(eid,com_socket);
-        UDT::epoll_release(eid);
-
-        QCoreApplication::processEvents();
-    }
-    kill();
+  while (!stop) {
+    int eid = UDT::epoll_create();
+    if (eid < 0) {
+      printf("epoll_create error: %s\n", UDT::getlasterror().getErrorMessage());
+    }
+
+    if (UDT::epoll_add_usock(eid, file_socket) < 0) {
+      if (UDT::getlasterror().getErrorCode() == 5004) {
+        printf("epoll_add_usock\n");
+        break;
+      } else {
+        printf("epoll_add_usock error: %s\n",
+               UDT::getlasterror().getErrorMessage());
+      }
+    }
+    if (UDT::epoll_add_usock(eid, com_socket) < 0) {
+      if (UDT::getlasterror().getErrorCode() == 5004) {
+        printf("epoll_add_usock\n");
+        break;
+      } else {
+        printf("epoll_add_usock error: %s\n",
+               UDT::getlasterror().getErrorMessage());
+      }
+    }
+
+    set<UDTSOCKET> readfds;
+
+    int rv = UDT::epoll_wait(eid, &readfds, NULL, 10);
+
+    if (rv == -1) {
+      if (UDT::getlasterror().getErrorCode() != 6003)
+        printf("prob %i\n", UDT::getlasterror().getErrorCode());
+      // printf("wait\n");
+    } else if (rv == 0) {
+      printf("timeout\n"); // a timeout occured
+    } else {
+      /*
+      if(UDT::getlasterror().getErrorCode()==2001) {
+          UDT::epoll_release(eid);
+      }*/
+      for (set<UDTSOCKET>::iterator i = readfds.begin(); i != readfds.end();
+           i++) {
+        // printf("a\n");
+        if (*i == file_socket)
+          receiveFile();
+        if (*i == com_socket)
+          receiveData();
+      }
+    }
+
+    UDT::epoll_remove_usock(eid, file_socket);
+    UDT::epoll_remove_usock(eid, com_socket);
+    UDT::epoll_release(eid);
+
+    QCoreApplication::processEvents();
+  }
+  kill();
 }
 
 void UdtSocket::receiveFile(void) {
-    char* recv_buf;
-    int bytesRead;
-    static bool flag_new_seq=true;
-    static QString folder_name;
-
-    //receive file info
-    recv_buf= (char*)malloc(1024);
-    bytesRead = UDT::recvmsg(file_socket,recv_buf,1024);
-
-    if(bytesRead<=0) {
+  char *recv_buf;
+  int bytesRead;
+  static bool flag_new_seq = true;
+  static QString folder_name;
+
+  // receive file info
+  recv_buf = (char *)malloc(1024);
+  bytesRead = UDT::recvmsg(file_socket, recv_buf, 1024);
+
+  if (bytesRead <= 0) {
+    free(recv_buf);
+    return;
+  }
+
+  int size;
+  memcpy(&size, &recv_buf[1], sizeof(int));
+  if (recv_buf[0] == FILE_INFO_BIG_ENDIAN)
+    size = qFromBigEndian(size);
+
+  // printf("file_ui recu %i %x\n",bytesRead,recv_buf[0]);
+  if ((recv_buf[0] == FILE_INFO_LITTLE_ENDIAN ||
+       recv_buf[0] == FILE_INFO_BIG_ENDIAN) &&
+      size > 0) {
+    if (flag_new_seq == true) {
+      // create directory for storage
+      QDateTime dateTime = QDateTime::currentDateTime();
+      folder_name = dateTime.toString("yyyyMMdd_hhmm") + "_" + name;
+      if (QDir().exists(folder_name) == true) {
+        folder_name = dateTime.toString("yyyyMMdd_hhmm_ss") + "_" + name;
+      }
+      QDir().mkdir(folder_name);
+
+      flag_new_seq = false;
+      file_dialog->log("Creating directory " + folder_name);
+    }
+
+    QString file_name =
+        QString::fromAscii((const char *)&recv_buf[5], bytesRead - 5);
+    QString file_path = folder_name + "/" + file_name;
+    file_dialog->log(
+        QString("receiving %1 (%2 bytes)").arg(file_name).arg(size));
+    QFile fichier(file_path);
+
+    if (!fichier.open(QIODevice::WriteOnly)) {
+      file_dialog->log("      could not write to file!");
+    } else {
+      // receive file
+      recv_buf = (char *)realloc((void *)recv_buf, size);
+      bytesRead = UDT::recvmsg(file_socket, recv_buf, size);
+      if (bytesRead != size) {
+        file_dialog->log(QString("      error receiving file! (%1/%2)")
+                             .arg(bytesRead)
+                             .arg(size));
         free(recv_buf);
         return;
-    }
-
+      } else {
+        file_dialog->log("      ok");
+      }
+
+      QDataStream stream(&fichier);
+      stream.writeRawData(recv_buf, size);
+      fichier.close();
+
+      file_dialog->addFile(file_path);
+    }
+
+    free(recv_buf);
+  } else if (recv_buf[0] == END) {
+    file_dialog->endOfFiles();
+    flag_new_seq = true;
+  }
+}
+
+void UdtSocket::receiveData(void) {
+  while (1) {
+    int buf_size;
+    int opt_size;
+    UDT::getsockopt(com_socket, 0, UDT_RCVBUF, &buf_size, &opt_size);
+
+    char *buf = (char *)malloc(buf_size);
     int size;
-    memcpy(&size,&recv_buf[1],sizeof(int));
-    if(recv_buf[0]==FILE_INFO_BIG_ENDIAN) size=qFromBigEndian(size);
-
-    //printf("file_ui recu %i %x\n",bytesRead,recv_buf[0]);
-    if((recv_buf[0]==FILE_INFO_LITTLE_ENDIAN || recv_buf[0]==FILE_INFO_BIG_ENDIAN) && size>0) {
-        if(flag_new_seq==true) {
-            //create directory for storage
-            QDateTime dateTime = QDateTime::currentDateTime();
-            folder_name = dateTime.toString("yyyyMMdd_hhmm")+ "_" + name;
-            if(QDir().exists(folder_name)==true) {
-                folder_name = dateTime.toString("yyyyMMdd_hhmm_ss")+ "_" + name;
-            }
-            QDir().mkdir(folder_name);
-
-            flag_new_seq=false;
-            file_dialog->log("Creating directory " +folder_name);
-        }
-
-        QString file_name= QString::fromAscii((const char*)&recv_buf[5],bytesRead-5);
-        QString file_path=folder_name + "/" + file_name;
-        file_dialog->log(QString("receiving %1 (%2 bytes)").arg(file_name).arg(size));
-        QFile fichier(file_path);
-
-        if(!fichier.open(QIODevice::WriteOnly)) {
-            file_dialog->log("      could not write to file!");
-        } else {
-            //receive file
-            recv_buf= (char*)realloc((void*)recv_buf,size);
-            bytesRead = UDT::recvmsg(file_socket,recv_buf,size);
-            if(bytesRead!=size) {
-                file_dialog->log(QString("      error receiving file! (%1/%2)").arg(bytesRead).arg(size));
-                free(recv_buf);
-                return;
-            } else {
-                file_dialog->log("      ok");
-            }
-
-            QDataStream stream(&fichier);
-            stream.writeRawData(recv_buf,size);
-            fichier.close();
-
-            file_dialog->addFile(file_path);
-        }
-
-        free(recv_buf);
-    } else if(recv_buf[0]==END) {
-        file_dialog->endOfFiles();
-        flag_new_seq=true;
-    }
-}
-
-void UdtSocket::receiveData(void) {
-    while(1) {
-        int buf_size;
-        int opt_size;
-        UDT::getsockopt(com_socket,0,UDT_RCVBUF,&buf_size,&opt_size);
-
-        char* buf=(char*)malloc(buf_size);
-        int size;
-        size = UDT::recvmsg(com_socket,buf, buf_size);
-        buf=(char*)realloc(buf,size+1);
-
-        if(size>0) {
-            buf[size]=0;
-            emit dataReady(buf,size+1);
-        } else {
-            //if(UDT::getlasterror().getErrorCode()!=6002) printf("udt socket: %s\n",UDT::getlasterror().getErrorMessage());
-            free(buf);
-            break;
-        }
-    }
-}
-
-void UdtSocket::write(const char* buf, qint64 size) {
-    //printf("write\n%s\n",buf);
-    qint64 sent=UDT::sendmsg(com_socket,buf,size, -1, true);
-    if(sent!=size) {
-        printf("erreur envoi: %s\n",UDT::getlasterror().getErrorMessage());
-        if(UDT::getlasterror().getErrorCode()==2001) {
-           stop=true;
-        }
-    }
-}
+    size = UDT::recvmsg(com_socket, buf, buf_size);
+    buf = (char *)realloc(buf, size + 1);
+
+    if (size > 0) {
+      buf[size] = 0;
+      emit dataReady(buf, size + 1);
+    } else {
+      // if(UDT::getlasterror().getErrorCode()!=6002) printf("udt socket:
+      // %s\n",UDT::getlasterror().getErrorMessage());
+      free(buf);
+      break;
+    }
+  }
+}
+
+void UdtSocket::write(const char *buf, qint64 size) {
+  // printf("write\n%s\n",buf);
+  qint64 sent = UDT::sendmsg(com_socket, buf, size, -1, true);
+  if (sent != size) {
+    printf("erreur envoi: %s\n", UDT::getlasterror().getErrorMessage());
+    if (UDT::getlasterror().getErrorCode() == 2001) {
+      stop = true;
+    }
+  }
+}
Index: trunk/tools/FlairGCS/src/UdtSocket.h
===================================================================
--- trunk/tools/FlairGCS/src/UdtSocket.h	(revision 14)
+++ trunk/tools/FlairGCS/src/UdtSocket.h	(revision 15)
@@ -12,30 +12,29 @@
 class file_ui;
 
-class UdtSocket : public QObject
-{
-    Q_OBJECT
+class UdtSocket : public QObject {
+  Q_OBJECT
 
-    public:
-        UdtSocket(UDTSOCKET file_socket,UDTSOCKET com_socket,QString name);
-        ~UdtSocket();
+public:
+  UdtSocket(UDTSOCKET file_socket, UDTSOCKET com_socket, QString name);
+  ~UdtSocket();
 
-    private:
-        UDTSOCKET file_socket,com_socket;
-        file_ui* file_dialog;
-        bool stop;
-        QString name;
-        QTimer *heartbeat_timer;
-        void receiveData(void);
-        void receiveFile(void);
+private:
+  UDTSOCKET file_socket, com_socket;
+  file_ui *file_dialog;
+  bool stop;
+  QString name;
+  QTimer *heartbeat_timer;
+  void receiveData(void);
+  void receiveFile(void);
 
-    signals:
-        void dataReady(char*,int size);
+signals:
+  void dataReady(char *, int size);
 
-    public slots:
-        void handleConnections(void);
-        void kill(void);
-        void write(const char* buf, qint64 size);
-    private slots:
-        void heartbeat(void);
+public slots:
+  void handleConnections(void);
+  void kill(void);
+  void write(const char *buf, qint64 size);
+private slots:
+  void heartbeat(void);
 };
 
Index: trunk/tools/FlairGCS/src/Vector3DSpinBox.cpp
===================================================================
--- trunk/tools/FlairGCS/src/Vector3DSpinBox.cpp	(revision 14)
+++ trunk/tools/FlairGCS/src/Vector3DSpinBox.cpp	(revision 15)
@@ -12,159 +12,169 @@
 #include "Layout.h"
 
+Vector3DSpinBox::Vector3DSpinBox(Layout *parent, int row, int col, QString name,
+                                 QString value[3], float min, float max,
+                                 float step, int decimals)
+    : XmlWidget(name, "Vector3DSpinBox", parent) {
+  for (int i = 0; i < 3; i++) {
+    doublespinbox[i].setRange(min, max);
+    doublespinbox[i].setSingleStep(step);
+    doublespinbox[i].setDecimals(decimals);
+  }
 
-Vector3DSpinBox::Vector3DSpinBox(Layout* parent,int row, int col,QString name,QString value[3],float min,float max,float step,int decimals): XmlWidget(name,"Vector3DSpinBox",parent) {
-    for(int i=0;i<3;i++) {
-        doublespinbox[i].setRange(min,max);
-        doublespinbox[i].setSingleStep(step);
-        doublespinbox[i].setDecimals(decimals);
+  adjust_decimals(value);
+
+  for (int i = 0; i < 3; i++) {
+    doublespinbox[i].setValue(value[i].toDouble());
+    doublespinbox_value[i] = doublespinbox[i].cleanText();
+
+    // event filter for qdoublespinbox and its child (qlinedit and incremnt
+    // qbuttons)
+    doublespinbox[i].installEventFilter(this);
+    QObjectList o_list = doublespinbox[i].children();
+    for (int j = 0; j < o_list.length(); j++) {
+      QLineEdit *cast = qobject_cast<QLineEdit *>(o_list[j]);
+      if (cast)
+        cast->installEventFilter(this);
     }
 
-    adjust_decimals(value);
+    connect(&doublespinbox[i], SIGNAL(valueChanged(const QString &)), this,
+            SLOT(valuechanged(const QString &)));
+  }
 
-    for(int i=0;i<3;i++) {
-        doublespinbox[i].setValue(value[i].toDouble());
-        doublespinbox_value[i]=doublespinbox[i].cleanText();
+  SetValues(value);
 
-        //event filter for qdoublespinbox and its child (qlinedit and incremnt qbuttons)
-        doublespinbox[i].installEventFilter(this);
-        QObjectList o_list = doublespinbox[i].children();
-        for(int j = 0; j < o_list.length(); j++) {
-            QLineEdit *cast = qobject_cast<QLineEdit*>(o_list[j]);
-            if(cast)
-                cast->installEventFilter(this);
-        }
+  // creation et ajout QGroupBox
+  box = new QGroupBox(name);
+  box->setObjectName(name);
+  visible_widget = box;
+  parent->addWidget(box, row, col);
+  qgridlayout = new QGridLayout(new QWidget());
+  box->setLayout(qgridlayout);
 
-        connect(&doublespinbox[i],SIGNAL(valueChanged(const QString &)),this, SLOT(valuechanged(const QString &)));
-    }
-
-    SetValues(value);
-
-    //creation et ajout QGroupBox
-    box = new QGroupBox(name);
-    box->setObjectName(name);
-    visible_widget=box;
-    parent->addWidget(box,row,col);
-    qgridlayout=new QGridLayout(new QWidget());
-    box->setLayout(qgridlayout);
-
-    AddElement("x:",0);
-    AddElement("y:",1);
-    AddElement("z:",2);
+  AddElement("x:", 0);
+  AddElement("y:", 1);
+  AddElement("z:", 2);
 }
 
-Vector3DSpinBox::~Vector3DSpinBox() {
+Vector3DSpinBox::~Vector3DSpinBox() {}
+
+void Vector3DSpinBox::SetValues(QString value[3]) {
+  SetAttribute("value_x", value[0]);
+  SetAttribute("value_y", value[1]);
+  SetAttribute("value_z", value[2]);
 }
 
-void Vector3DSpinBox::SetValues(QString value[3]) {
-    SetAttribute("value_x",value[0]);
-    SetAttribute("value_y",value[1]);
-    SetAttribute("value_z",value[2]);
-}
+void Vector3DSpinBox::AddElement(QString name, int index) {
+  QWidget *widget = new QWidget();
+  QFormLayout *object_layout = new QFormLayout(widget);
+  object_layout->setHorizontalSpacing(2);
+  object_layout->setVerticalSpacing(2);
+  object_layout->setContentsMargins(2, 2, 2, 2);
 
-void Vector3DSpinBox::AddElement(QString name,int index) {
-    QWidget* widget=new QWidget();
-    QFormLayout* object_layout = new QFormLayout(widget);
-    object_layout->setHorizontalSpacing(2);
-    object_layout->setVerticalSpacing(2);
-    object_layout->setContentsMargins (2,2,2,2);
+  object_layout->addRow(name, &doublespinbox[index]);
 
-    object_layout->addRow(name,&doublespinbox[index]);
-
-    qgridlayout->addWidget(widget,index,0);
+  qgridlayout->addWidget(widget, index, 0);
 }
 
 void Vector3DSpinBox::adjust_decimals(QString value[3]) {
-    for(int i=0;i<3;i++) {
-        //auto adjust decimals
-        QLocale locale;
-        value[i].remove(locale.groupSeparator());
+  for (int i = 0; i < 3; i++) {
+    // auto adjust decimals
+    QLocale locale;
+    value[i].remove(locale.groupSeparator());
 
-        QStringList parts = value[i].split(locale.decimalPoint());
-        if(parts.count() == 2) {
-            doublespinbox[i].setDecimals(parts[1].size());
-        }
+    QStringList parts = value[i].split(locale.decimalPoint());
+    if (parts.count() == 2) {
+      doublespinbox[i].setDecimals(parts[1].size());
     }
+  }
 }
 
 bool Vector3DSpinBox::eventFilter(QObject *object, QEvent *event) {
-    for(int i=0;i<3;i++) {
-        if(object==&doublespinbox[i] && event->type()==QEvent::MouseButtonPress) {
-            if (((QMouseEvent*)event)->button() == Qt::RightButton) {
-                QMenu * menu = new QMenu("menu", doublespinbox);
-                QAction *a,*b,*c,*z;
+  for (int i = 0; i < 3; i++) {
+    if (object == &doublespinbox[i] &&
+        event->type() == QEvent::MouseButtonPress) {
+      if (((QMouseEvent *)event)->button() == Qt::RightButton) {
+        QMenu *menu = new QMenu("menu", doublespinbox);
+        QAction *a, *b, *c, *z;
 
-                a=menu->addAction("add decimal");
-                b=menu->addAction("remove decimal");
+        a = menu->addAction("add decimal");
+        b = menu->addAction("remove decimal");
 
-                if(doublespinbox[i].decimals()==0) b->setEnabled(false);
-                z=menu->exec(((QMouseEvent*)event)->globalPos());
+        if (doublespinbox[i].decimals() == 0)
+          b->setEnabled(false);
+        z = menu->exec(((QMouseEvent *)event)->globalPos());
 
-                if(z==a) doublespinbox[i].setDecimals(doublespinbox[i].decimals()+1);
-                if(z==b) doublespinbox[i].setDecimals(doublespinbox[i].decimals()-1);
-                delete menu;
-                return true;
-            }
-        }
+        if (z == a)
+          doublespinbox[i].setDecimals(doublespinbox[i].decimals() + 1);
+        if (z == b)
+          doublespinbox[i].setDecimals(doublespinbox[i].decimals() - 1);
+        delete menu;
+        return true;
+      }
     }
-    return object->eventFilter(object, event);
+  }
+  return object->eventFilter(object, event);
 }
 
 void Vector3DSpinBox::SetUptodate(void) {
-    ui_to_var();
-    ui_to_xml();
-    visible_widget->setPalette(black_pal);
+  ui_to_var();
+  ui_to_xml();
+  visible_widget->setPalette(black_pal);
 }
 
 void Vector3DSpinBox::ui_to_var(void) {
-    for(int i=0;i<3;i++) {
-        doublespinbox_value[i]=doublespinbox[i].cleanText();
-    }
+  for (int i = 0; i < 3; i++) {
+    doublespinbox_value[i] = doublespinbox[i].cleanText();
+  }
 }
 
 void Vector3DSpinBox::ui_to_xml(void) {
-    SetAttribute("value_x",doublespinbox[0].cleanText());
-    SetAttribute("value_y",doublespinbox[1].cleanText());
-    SetAttribute("value_z",doublespinbox[2].cleanText());
+  SetAttribute("value_x", doublespinbox[0].cleanText());
+  SetAttribute("value_y", doublespinbox[1].cleanText());
+  SetAttribute("value_z", doublespinbox[2].cleanText());
 }
 
 void Vector3DSpinBox::Reset(void) {
-    //le setvalue fait un arrondi pour l'affichage, la variable n'est donc plus egale
-    //on reprend la valeur de la boite et on force la couleur a noir
-    adjust_decimals(doublespinbox_value);
-    for(int i=0;i<3;i++) {
-        doublespinbox[i].setValue(doublespinbox_value[i].toDouble());
-        doublespinbox_value[i]= doublespinbox[i].cleanText();
-    }
-    visible_widget->setPalette(black_pal);
+  // le setvalue fait un arrondi pour l'affichage, la variable n'est donc plus
+  // egale
+  // on reprend la valeur de la boite et on force la couleur a noir
+  adjust_decimals(doublespinbox_value);
+  for (int i = 0; i < 3; i++) {
+    doublespinbox[i].setValue(doublespinbox_value[i].toDouble());
+    doublespinbox_value[i] = doublespinbox[i].cleanText();
+  }
+  visible_widget->setPalette(black_pal);
 }
 
 void Vector3DSpinBox::LoadEvent(QDomElement dom) {
-    if(doublespinbox[0].isEnabled()) {
-        doublespinbox[0].setValue((dom.attribute("value_x")).toDouble());
-    }
-    if(doublespinbox[1].isEnabled()) {
-        doublespinbox[1].setValue((dom.attribute("value_y")).toDouble());
-    }
-    if(doublespinbox[2].isEnabled()) {
-        doublespinbox[2].setValue((dom.attribute("value_z")).toDouble());
-    }
+  if (doublespinbox[0].isEnabled()) {
+    doublespinbox[0].setValue((dom.attribute("value_x")).toDouble());
+  }
+  if (doublespinbox[1].isEnabled()) {
+    doublespinbox[1].setValue((dom.attribute("value_y")).toDouble());
+  }
+  if (doublespinbox[2].isEnabled()) {
+    doublespinbox[2].setValue((dom.attribute("value_z")).toDouble());
+  }
 }
 
 void Vector3DSpinBox::valuechanged(const QString &value) {
-    for(int i=0;i<3;i++) {
-        if((QDoubleSpinBox*)sender()==&doublespinbox[i] && value!=doublespinbox_value[i]) {
-            visible_widget->setPalette(red_pal);
-            return;
-        }
+  for (int i = 0; i < 3; i++) {
+    if ((QDoubleSpinBox *)sender() == &doublespinbox[i] &&
+        value != doublespinbox_value[i]) {
+      visible_widget->setPalette(red_pal);
+      return;
     }
-    visible_widget->setPalette(black_pal);
+  }
+  visible_widget->setPalette(black_pal);
 }
 
 bool Vector3DSpinBox::IsUptodate(void) {
-    //si le widget n'est pas enabled, sa palette est differente de rouge (greyed) donc on renvoit true
-    //permet de ne pas envoyer les modifs d'un widget disabled
-    //if(label->palette()==red_pal) return false;
-    if(visible_widget->palette()==red_pal) return false;
-    return true;
+  // si le widget n'est pas enabled, sa palette est differente de rouge (greyed)
+  // donc on renvoit true
+  // permet de ne pas envoyer les modifs d'un widget disabled
+  // if(label->palette()==red_pal) return false;
+  if (visible_widget->palette() == red_pal)
+    return false;
+  return true;
 }
-
Index: trunk/tools/FlairGCS/src/Vector3DSpinBox.h
===================================================================
--- trunk/tools/FlairGCS/src/Vector3DSpinBox.h	(revision 14)
+++ trunk/tools/FlairGCS/src/Vector3DSpinBox.h	(revision 15)
@@ -13,31 +13,32 @@
 class QGridLayout;
 
-class Vector3DSpinBox: public XmlWidget
-{
-    Q_OBJECT
+class Vector3DSpinBox : public XmlWidget {
+  Q_OBJECT
 
-    public:
-        //handle value as string, becouse double value are not exact
-        Vector3DSpinBox(Layout* parent,int row, int col,QString name,QString value[3],float min,float max,float step,int decimals);
-        ~Vector3DSpinBox();
+public:
+  // handle value as string, becouse double value are not exact
+  Vector3DSpinBox(Layout *parent, int row, int col, QString name,
+                  QString value[3], float min, float max, float step,
+                  int decimals);
+  ~Vector3DSpinBox();
 
-    private:
-        QGridLayout* qgridlayout;
-        QGroupBox* box;
-        QDoubleSpinBox doublespinbox[3];
-        QString doublespinbox_value[3];
-        void AddElement(QString name,int index);
-        void SetUptodate(void);
-        void SetValues(QString value[3]);
-        void Reset(void);
-        void LoadEvent(QDomElement dom);
-        void ui_to_var(void);
-        void ui_to_xml(void);
-        bool eventFilter(QObject *o, QEvent *e);
-        void adjust_decimals(QString value[3]);
-        bool IsUptodate(void);
+private:
+  QGridLayout *qgridlayout;
+  QGroupBox *box;
+  QDoubleSpinBox doublespinbox[3];
+  QString doublespinbox_value[3];
+  void AddElement(QString name, int index);
+  void SetUptodate(void);
+  void SetValues(QString value[3]);
+  void Reset(void);
+  void LoadEvent(QDomElement dom);
+  void ui_to_var(void);
+  void ui_to_xml(void);
+  bool eventFilter(QObject *o, QEvent *e);
+  void adjust_decimals(QString value[3]);
+  bool IsUptodate(void);
 
-    private slots:
-        void valuechanged(const QString &value);
+private slots:
+  void valuechanged(const QString &value);
 };
 
Index: trunk/tools/FlairGCS/src/XmlWidget.cpp
===================================================================
--- trunk/tools/FlairGCS/src/XmlWidget.cpp	(revision 14)
+++ trunk/tools/FlairGCS/src/XmlWidget.cpp	(revision 15)
@@ -8,326 +8,301 @@
 #include <stdio.h>
 
-XmlWidget::XmlWidget(QString name,QString type,XmlWidget* parent):QObject()
-{
-    childs=new QList<XmlWidget*>;
-    isContainer=false;
-    isExpandable=false;
-    visible_widget=NULL;
-    parent_widget=parent;
-
-    red_pal.setColor( QPalette::Text, QColor(255,0,0) );
-    red_pal.setColor( QPalette::Foreground, QColor(255,0,0) );
-    red_pal_greyed.setColor( QPalette::Text, QColor(128,0,0) );
-    red_pal_greyed.setColor( QPalette::Foreground, QColor(128,0,0) );
-
-    black_pal.setColor( QPalette::Text, QColor(0,0,0) );
-    black_pal.setColor( QPalette::Foreground, QColor(0,0,0) );
-    black_pal_greyed.setColor( QPalette::Text, QColor(128,128,128) );
-    black_pal_greyed.setColor( QPalette::Foreground, QColor(128,128,128) );
-
-    setObjectName(name);
-
-    if(parent!=NULL)
-    {
-        parent->childs->append(this);
-
-        document=parent->document.cloneNode(true).toDocument();
-
-        write_elem = QDomElement(document.createElement(type));
-        write_elem.setAttribute("name", name);
-        //recupere le node le plus profond
-        QDomNode node=document.firstChild();
-        while(node.firstChild().isNull()==false)
-        {
-            node=node.firstChild();
+XmlWidget::XmlWidget(QString name, QString type, XmlWidget *parent)
+    : QObject() {
+  childs = new QList<XmlWidget *>;
+  isContainer = false;
+  isExpandable = false;
+  visible_widget = NULL;
+  parent_widget = parent;
+
+  red_pal.setColor(QPalette::Text, QColor(255, 0, 0));
+  red_pal.setColor(QPalette::Foreground, QColor(255, 0, 0));
+  red_pal_greyed.setColor(QPalette::Text, QColor(128, 0, 0));
+  red_pal_greyed.setColor(QPalette::Foreground, QColor(128, 0, 0));
+
+  black_pal.setColor(QPalette::Text, QColor(0, 0, 0));
+  black_pal.setColor(QPalette::Foreground, QColor(0, 0, 0));
+  black_pal_greyed.setColor(QPalette::Text, QColor(128, 128, 128));
+  black_pal_greyed.setColor(QPalette::Foreground, QColor(128, 128, 128));
+
+  setObjectName(name);
+
+  if (parent != NULL) {
+    parent->childs->append(this);
+
+    document = parent->document.cloneNode(true).toDocument();
+
+    write_elem = QDomElement(document.createElement(type));
+    write_elem.setAttribute("name", name);
+    // recupere le node le plus profond
+    QDomNode node = document.firstChild();
+    while (node.firstChild().isNull() == false) {
+      node = node.firstChild();
+    }
+    node.appendChild(write_elem);
+  } else {
+    document = QDomDocument("remote_ui_xml");
+    write_elem = QDomElement(document.createElement(type));
+    write_elem.setAttribute("name", name);
+    document.appendChild(write_elem);
+  }
+}
+
+XmlWidget::~XmlWidget() {
+  if (parent_widget != NULL)
+    parent_widget->childs->removeOne(this);
+
+  // on efface les widgets enfants
+  // dans le delete child on modifie le child du parent, donc on se refere
+  // toujours au premier
+  while (childs->count() != 0) {
+    delete childs->first();
+  }
+
+  delete childs;
+  if (visible_widget != NULL) {
+    delete visible_widget;
+  }
+}
+
+QString XmlWidget::Name(void) { return write_elem.attribute("name"); }
+
+void XmlWidget::SetIsContainer(bool status) { isContainer = status; }
+
+void XmlWidget::SetIsExpandable(bool status) { isExpandable = status; }
+
+XmlWidget *XmlWidget::GetXmlWidget(QString name, QString type) {
+  // printf("recherche %s
+  // %s\n",name.toLocal8Bit().constData(),type.toLocal8Bit().constData());
+
+  for (int i = 0; i < childs->count(); i++) {
+    // printf("child name
+    // %s\n",childs->at(i)->write_elem.attribute("name").toLocal8Bit().constData());
+    // printf("child tag
+    // %s\n",childs->at(i)->write_elem.tagName().toLocal8Bit().constData());
+    if (childs->at(i)->write_elem.attribute("name") == name &&
+        childs->at(i)->write_elem.tagName() == type)
+      return childs->at(i);
+  }
+  return NULL;
+}
+
+void XmlWidget::ParseXml(QDomElement to_parse) {
+
+  if (to_parse.isNull())
+    return;
+
+  QString type = to_parse.tagName();
+  QString name = to_parse.attribute("name");
+
+  // printf("parse %s
+  // %s\n",type.toLocal8Bit().constData(),name.toLocal8Bit().constData());
+  XmlWidget *match;
+  match = GetXmlWidget(name, type);
+
+  if (match == NULL) {
+    // printf("not match\n");
+    XmlEvent(to_parse);
+  } else {
+    // printf("match\n");
+    // si on a une balise IsEnabled, on ne traite que ca
+    if (match->visible_widget != NULL) {
+      if (to_parse.attribute("IsEnabled") == "0") {
+        match->visible_widget->setEnabled(false);
+        return;
+      }
+      if (to_parse.attribute("IsEnabled") == "1") {
+        match->visible_widget->setEnabled(true);
+        return;
+      }
+    }
+
+    // si on a une balise delete, on ne traite que ca
+    if (to_parse.attribute("Delete") == "1") {
+      // printf("delete flag\n");
+      if (match->isContainer == true && match->childs->count() != 0) {
+        // printf("non vide
+        // %s\n",match->objectName().toLocal8Bit().constData());
+        return;
+      }
+
+      delete match;
+      return;
+    }
+
+    if (to_parse.firstChild().isNull() == true &&
+        match->isExpandable == false) {
+      QString new_name;
+      printf("possible doublon\n");
+      for (int i = 0; i < 65535; i++) {
+        new_name = QString("%1_%2").arg(name).arg(i);
+        bool continuer = false;
+        for (int i = 0; i < childs->count(); i++) {
+          if (childs->at(i)->write_elem.attribute("name") == new_name) {
+            continuer = true;
+            break;
+          }
         }
-        node.appendChild(write_elem);
-    }
-    else
-    {
-        document=QDomDocument("remote_ui_xml");
-        write_elem = QDomElement(document.createElement(type));
-        write_elem.setAttribute("name", name);
-        document.appendChild(write_elem);
-    }
-}
-
-XmlWidget::~XmlWidget()
-{
-    if(parent_widget!=NULL) parent_widget->childs->removeOne(this);
-
-    //on efface les widgets enfants
-    //dans le delete child on modifie le child du parent, donc on se refere toujours au premier
-    while(childs->count()!=0) {
-        delete childs->first();
-    }
-
-    delete childs;
-    if(visible_widget!=NULL) {
-        delete visible_widget;
-    }
-}
-
-QString XmlWidget::Name(void)
-{
-    return  write_elem.attribute("name");
-}
-
-void XmlWidget::SetIsContainer(bool status) {
-    isContainer=status;
-}
-
-void XmlWidget::SetIsExpandable(bool status) {
-    isExpandable=status;
-}
-
-XmlWidget* XmlWidget::GetXmlWidget(QString name,QString type)
-{
-    //printf("recherche %s %s\n",name.toLocal8Bit().constData(),type.toLocal8Bit().constData());
-
-    for(int i=0;i<childs->count();i++)
-    {
-        //printf("child name %s\n",childs->at(i)->write_elem.attribute("name").toLocal8Bit().constData());
-        //printf("child tag %s\n",childs->at(i)->write_elem.tagName().toLocal8Bit().constData());
-        if(childs->at(i)->write_elem.attribute("name")==name && childs->at(i)->write_elem.tagName()==type) return childs->at(i);
-
-    }
-    return NULL;
-}
-
-
-void XmlWidget::ParseXml(QDomElement to_parse) {
-
-    if(to_parse.isNull()) return;
-
-    QString type=to_parse.tagName();
-    QString name=to_parse.attribute("name");
-
-//printf("parse %s %s\n",type.toLocal8Bit().constData(),name.toLocal8Bit().constData());
-    XmlWidget* match;
-    match=GetXmlWidget(name,type);
-
-    if(match==NULL) {
-        //printf("not match\n");
-        XmlEvent(to_parse);
+        if (continuer == false)
+          break;
+      }
+      printf("new_name %s\n", new_name.toLocal8Bit().constData());
+      to_parse.setAttribute("name", new_name);
+      to_parse.setAttribute("old_name", name);
+
+      XmlEvent(to_parse);
+
+      // return -1;//ou retourner le xml a renvoyer pour chager de nom
     } else {
-        //printf("match\n");
-        //si on a une balise IsEnabled, on ne traite que ca
-        if(match->visible_widget!=NULL) {
-            if(to_parse.attribute("IsEnabled")=="0") {
-                match->visible_widget->setEnabled(false);
-                return;
-            }
-            if(to_parse.attribute("IsEnabled")=="1") {
-                match->visible_widget->setEnabled(true);
-                return;
-            }
-        }
-
-        //si on a une balise delete, on ne traite que ca
-        if(to_parse.attribute("Delete")=="1") {
-            //printf("delete flag\n");
-            if(match->isContainer==true && match->childs->count()!=0) {
-                //printf("non vide %s\n",match->objectName().toLocal8Bit().constData());
-                return;
-            }
-
-            delete match;
-            return;
-        }
-
-        if(to_parse.firstChild().isNull()==true && match->isExpandable==false) {
-            QString new_name;
-            printf("possible doublon\n");
-            for(int i=0;i<65535;i++) {
-                new_name=QString("%1_%2").arg(name).arg(i);
-                bool continuer=false;
-                for(int i=0;i<childs->count();i++) {
-                    if(childs->at(i)->write_elem.attribute("name")==new_name) {
-                        continuer=true;
-                        break;
-                    }
-                }
-                if(continuer==false) break;
-            }
-            printf("new_name %s\n",new_name.toLocal8Bit().constData());
-            to_parse.setAttribute("name",new_name);
-            to_parse.setAttribute("old_name",name);
-
-            XmlEvent(to_parse);
-
-            //return -1;//ou retourner le xml a renvoyer pour chager de nom
-        } else {
-            if(to_parse.firstChild().toElement().isNull()) {
-                match->XmlEvent(to_parse);
-                return;
-            } else {
-                match->ParseXml(to_parse.firstChild().toElement());
-            }
-        }
-    }
+      if (to_parse.firstChild().toElement().isNull()) {
+        match->XmlEvent(to_parse);
+        return;
+      } else {
+        match->ParseXml(to_parse.firstChild().toElement());
+      }
+    }
+  }
 }
 
 void XmlWidget::LoadXml(QDomElement to_parse) {
-    if(to_parse.isNull()) return;
-
-    LoadEvent(to_parse);
-
-    QDomElement elem=to_parse.firstChild().toElement();
-
-    while(!elem.isNull()) {
-
-        QString type=elem.tagName();
-        QString name=elem.attribute("name");
-//printf("%s %s\n",type.toLocal8Bit().constData(),name.toLocal8Bit().constData());
-        XmlWidget* match;
-        match=GetXmlWidget(name,type);
-
-        if(match!=NULL) {
-            //printf("match\n");
-            match->LoadXml(elem);
-        }
-        elem=elem.nextSibling().toElement();
-    }
-}
-
-void XmlWidget::GetFullXml(QDomElement* doc) {
-    QDomDocument tmp_doc=XmlDoc();
-    merge((QDomElement*)&tmp_doc,doc);
-
-    for(int i=0;i<childs->count();i++) {
-        childs->at(i)->GetFullXml(doc);
-    }
-}
-
-void XmlWidget::GetUpdateXml(QDomElement* doc) {
-    if(IsUptodate()==false && isContainer==false) {
-        SetUptodate();
-        QDomDocument tmp_doc=XmlDoc();
-        merge((QDomElement*)&tmp_doc,doc);
-    }
-
-    for(int i=0;i<childs->count();i++) {
-        childs->at(i)->GetUpdateXml(doc);
-    }
-}
-
-void XmlWidget::ResetAllChilds(void)
-{
-    Reset();
-    for(int i=0;i<childs->count();i++)
-    {
-        childs->at(i)->ResetAllChilds();
-    }
-}
-
-void XmlWidget::merge(QDomElement* from,QDomElement* into)
-{
-    QDomElement tmp_into,tmp_from;
-    tmp_from=from->firstChildElement();
-
-    while(tmp_from.isNull()==false)
-    {
-        //search corresponding child
-        bool match=false;
-        tmp_into=into->firstChildElement(tmp_from.tagName());
-        while(tmp_into.isNull()==false)
-        {
-            if(tmp_into.attribute("name")==tmp_from.attribute("name"))
-            {
-               merge(&tmp_from,&tmp_into);
-               match=true;
-               break;
-            }
-            tmp_into=tmp_into.nextSiblingElement(tmp_from.tagName());
-        }
-
-        if(match==false)
-        {
-            into->appendChild(tmp_from.cloneNode());
-        }
-
-        tmp_from=tmp_from.nextSiblingElement();
-    }
-}
-
-QDomDocument XmlWidget::XmlDoc(void)
-{
-    return document.cloneNode(true).toDocument();
-}
-
-QDomElement* XmlWidget::AddXmlChild(QString type)
-{
-    QDomElement* elem;
-
-    elem = new QDomElement(document.createElement(type));
-    write_elem.appendChild(*elem);
-
-    return elem;
-}
-
-void XmlWidget::RemoveXmlChild(QDomElement* element)
-{
-    write_elem.removeChild(*element);
-    delete element;
-}
-
-void XmlWidget::ClearDoc(void)
-{
-    document.clear();
-}
-
-void XmlWidget::SetValue(QString value)
-{
-    write_elem.setAttribute("value",value);
-}
-
-void XmlWidget::SetAttribute(const QString& name, const QString& value)
-{
-     write_elem.setAttribute(name,value);
-}
-
-void XmlWidget::SetAttribute(const QString& name, qlonglong value)
-{
-    write_elem.setAttribute(name,value);
-}
-
-void XmlWidget::SetAttribute(const QString& name, qulonglong value)
-{
-    write_elem.setAttribute(name,value);
-}
-
-void XmlWidget::SetAttribute(const QString& name, float value)
-{
-    write_elem.setAttribute(name,value);
-}
-
-void XmlWidget::SetAttribute(const QString& name, double value)
-{
-    write_elem.setAttribute(name,value);
-}
-
-void XmlWidget::RemoveAttribute(const QString& name) {
-    write_elem.removeAttribute(name);
-}
-
-void XmlWidget::RenamedFrom(QString old_name)
-{
-    QString name=write_elem.attribute("name");
-    SetAttribute("name",old_name);
-    SetAttribute("new_name",name);
-    connectionLayout()->XmlToSend(XmlDoc());
-    SetAttribute("name",name);
-    write_elem.removeAttribute("new_name");
-
-}
-
-ConnectionLayout* XmlWidget::connectionLayout(void)
-{
-    if(parent_widget!=NULL) {
-        return (ConnectionLayout*)(parent_widget->connectionLayout());
-    } else {
-        return (ConnectionLayout*)this;
-    }
-}
-
+  if (to_parse.isNull())
+    return;
+
+  LoadEvent(to_parse);
+
+  QDomElement elem = to_parse.firstChild().toElement();
+
+  while (!elem.isNull()) {
+
+    QString type = elem.tagName();
+    QString name = elem.attribute("name");
+    // printf("%s
+    // %s\n",type.toLocal8Bit().constData(),name.toLocal8Bit().constData());
+    XmlWidget *match;
+    match = GetXmlWidget(name, type);
+
+    if (match != NULL) {
+      // printf("match\n");
+      match->LoadXml(elem);
+    }
+    elem = elem.nextSibling().toElement();
+  }
+}
+
+void XmlWidget::GetFullXml(QDomElement *doc) {
+  QDomDocument tmp_doc = XmlDoc();
+  merge((QDomElement *)&tmp_doc, doc);
+
+  for (int i = 0; i < childs->count(); i++) {
+    childs->at(i)->GetFullXml(doc);
+  }
+}
+
+void XmlWidget::GetUpdateXml(QDomElement *doc) {
+  if (IsUptodate() == false && isContainer == false) {
+    SetUptodate();
+    QDomDocument tmp_doc = XmlDoc();
+    merge((QDomElement *)&tmp_doc, doc);
+  }
+
+  for (int i = 0; i < childs->count(); i++) {
+    childs->at(i)->GetUpdateXml(doc);
+  }
+}
+
+void XmlWidget::ResetAllChilds(void) {
+  Reset();
+  for (int i = 0; i < childs->count(); i++) {
+    childs->at(i)->ResetAllChilds();
+  }
+}
+
+void XmlWidget::merge(QDomElement *from, QDomElement *into) {
+  QDomElement tmp_into, tmp_from;
+  tmp_from = from->firstChildElement();
+
+  while (tmp_from.isNull() == false) {
+    // search corresponding child
+    bool match = false;
+    tmp_into = into->firstChildElement(tmp_from.tagName());
+    while (tmp_into.isNull() == false) {
+      if (tmp_into.attribute("name") == tmp_from.attribute("name")) {
+        merge(&tmp_from, &tmp_into);
+        match = true;
+        break;
+      }
+      tmp_into = tmp_into.nextSiblingElement(tmp_from.tagName());
+    }
+
+    if (match == false) {
+      into->appendChild(tmp_from.cloneNode());
+    }
+
+    tmp_from = tmp_from.nextSiblingElement();
+  }
+}
+
+QDomDocument XmlWidget::XmlDoc(void) {
+  return document.cloneNode(true).toDocument();
+}
+
+QDomElement *XmlWidget::AddXmlChild(QString type) {
+  QDomElement *elem;
+
+  elem = new QDomElement(document.createElement(type));
+  write_elem.appendChild(*elem);
+
+  return elem;
+}
+
+void XmlWidget::RemoveXmlChild(QDomElement *element) {
+  write_elem.removeChild(*element);
+  delete element;
+}
+
+void XmlWidget::ClearDoc(void) { document.clear(); }
+
+void XmlWidget::SetValue(QString value) {
+  write_elem.setAttribute("value", value);
+}
+
+void XmlWidget::SetAttribute(const QString &name, const QString &value) {
+  write_elem.setAttribute(name, value);
+}
+
+void XmlWidget::SetAttribute(const QString &name, qlonglong value) {
+  write_elem.setAttribute(name, value);
+}
+
+void XmlWidget::SetAttribute(const QString &name, qulonglong value) {
+  write_elem.setAttribute(name, value);
+}
+
+void XmlWidget::SetAttribute(const QString &name, float value) {
+  write_elem.setAttribute(name, value);
+}
+
+void XmlWidget::SetAttribute(const QString &name, double value) {
+  write_elem.setAttribute(name, value);
+}
+
+void XmlWidget::RemoveAttribute(const QString &name) {
+  write_elem.removeAttribute(name);
+}
+
+void XmlWidget::RenamedFrom(QString old_name) {
+  QString name = write_elem.attribute("name");
+  SetAttribute("name", old_name);
+  SetAttribute("new_name", name);
+  connectionLayout()->XmlToSend(XmlDoc());
+  SetAttribute("name", name);
+  write_elem.removeAttribute("new_name");
+}
+
+ConnectionLayout *XmlWidget::connectionLayout(void) {
+  if (parent_widget != NULL) {
+    return (ConnectionLayout *)(parent_widget->connectionLayout());
+  } else {
+    return (ConnectionLayout *)this;
+  }
+}
Index: trunk/tools/FlairGCS/src/XmlWidget.h
===================================================================
--- trunk/tools/FlairGCS/src/XmlWidget.h	(revision 14)
+++ trunk/tools/FlairGCS/src/XmlWidget.h	(revision 15)
@@ -14,56 +14,59 @@
 class ConnectionLayout;
 
-class XmlWidget:public QObject
-{
-    Q_OBJECT
+class XmlWidget : public QObject {
+  Q_OBJECT
 
-    public:
-        XmlWidget(QString name,QString type,XmlWidget* parent);
-        ~XmlWidget();
-        QDomDocument XmlDoc(void);
-        void ParseXml(QDomElement to_parse);
-        void GetFullXml(QDomElement* doc);
-        void GetUpdateXml(QDomElement* doc);
-        void ResetAllChilds(void);
-        virtual bool IsUptodate(void){return true;};
-        void LoadXml(QDomElement to_parse);
-        void RenamedFrom(QString old_name);
-        QString Name(void);
+public:
+  XmlWidget(QString name, QString type, XmlWidget *parent);
+  ~XmlWidget();
+  QDomDocument XmlDoc(void);
+  void ParseXml(QDomElement to_parse);
+  void GetFullXml(QDomElement *doc);
+  void GetUpdateXml(QDomElement *doc);
+  void ResetAllChilds(void);
+  virtual bool IsUptodate(void) { return true; };
+  void LoadXml(QDomElement to_parse);
+  void RenamedFrom(QString old_name);
+  QString Name(void);
 
-    private:
-        QDomDocument document;
-        QDomElement write_elem;
-        XmlWidget* GetXmlWidget(QString name,QString type);
-        static void merge(QDomElement* from,QDomElement* into);
-        bool isExpandable;//true if we can receive extra frame for this widget (ex combobox, plots, layout)
-        bool isContainer;//true if it can contain other widget (ex layout), isExpandable is also true in this case
-        virtual void SetUptodate(void){};
-        virtual void Reset(void){};
-        XmlWidget* parent_widget;
+private:
+  QDomDocument document;
+  QDomElement write_elem;
+  XmlWidget *GetXmlWidget(QString name, QString type);
+  static void merge(QDomElement *from, QDomElement *into);
+  bool isExpandable; // true if we can receive extra frame for this widget (ex
+                     // combobox, plots, layout)
+  bool isContainer; // true if it can contain other widget (ex layout),
+                    // isExpandable is also true in this case
+  virtual void SetUptodate(void){};
+  virtual void Reset(void){};
+  XmlWidget *parent_widget;
 
-    protected:
-        QList<XmlWidget*> *childs;
-        ConnectionLayout* connectionLayout(void);
-        QWidget* visible_widget;
-        QPalette red_pal,red_pal_greyed;
-        QPalette black_pal,black_pal_greyed;
-        void SetIsContainer(bool status);
-        void SetIsExpandable(bool status);
-        virtual void XmlEvent(QDomElement dom){};
-        virtual void LoadEvent(QDomElement dom){};
-        QDomElement* AddXmlChild(QString type);
-        void RemoveXmlChild(QDomElement* element);
-        void ClearDoc(void);
-        void SetValue(QString value);
-        void SetAttribute(const QString& name, const QString& value);
-        void SetAttribute(const QString& name, qlonglong value);
-        void SetAttribute(const QString& name, qulonglong value);
-        inline void SetAttribute(const QString& name, int value)
-            { SetAttribute(name, qlonglong(value)); }
-        inline void SetAttribute(const QString& name, uint value)
-            { SetAttribute(name, qulonglong(value)); }
-        void SetAttribute(const QString& name, float value);
-        void SetAttribute(const QString& name, double value);
-        void RemoveAttribute(const QString& name);
+protected:
+  QList<XmlWidget *> *childs;
+  ConnectionLayout *connectionLayout(void);
+  QWidget *visible_widget;
+  QPalette red_pal, red_pal_greyed;
+  QPalette black_pal, black_pal_greyed;
+  void SetIsContainer(bool status);
+  void SetIsExpandable(bool status);
+  virtual void XmlEvent(QDomElement dom){};
+  virtual void LoadEvent(QDomElement dom){};
+  QDomElement *AddXmlChild(QString type);
+  void RemoveXmlChild(QDomElement *element);
+  void ClearDoc(void);
+  void SetValue(QString value);
+  void SetAttribute(const QString &name, const QString &value);
+  void SetAttribute(const QString &name, qlonglong value);
+  void SetAttribute(const QString &name, qulonglong value);
+  inline void SetAttribute(const QString &name, int value) {
+    SetAttribute(name, qlonglong(value));
+  }
+  inline void SetAttribute(const QString &name, uint value) {
+    SetAttribute(name, qulonglong(value));
+  }
+  void SetAttribute(const QString &name, float value);
+  void SetAttribute(const QString &name, double value);
+  void RemoveAttribute(const QString &name);
 };
 
Index: trunk/tools/FlairGCS/src/file_ui.cpp
===================================================================
--- trunk/tools/FlairGCS/src/file_ui.cpp	(revision 14)
+++ trunk/tools/FlairGCS/src/file_ui.cpp	(revision 15)
@@ -24,390 +24,381 @@
 
 #ifndef WIN32
-   #include <arpa/inet.h>
+#include <arpa/inet.h>
 #else
-   #include <winsock2.h>
-   #include <ws2tcpip.h>
+#include <winsock2.h>
+#include <ws2tcpip.h>
 #endif
 
-
 using namespace std;
 
-file_ui::file_ui()
-{
-    dialog=new QDialog();
-    dialog->setWindowTitle("log files");
-    QGridLayout *main_layout = new QGridLayout(dialog);
-    ok_button= new QPushButton("Ok",dialog);
-    log_text=new QTextEdit(dialog);
-    log_text->setReadOnly(true);
-    input_text=new QTextEdit(dialog);
-    input_text->setText("add your log comment here");
-    input_cleared=false;
-
-    ok_button->setEnabled(false);
-
-    main_layout->addWidget(log_text,0,0);
-    main_layout->addWidget(input_text,1,0);
-
-    QWidget *widget=new QWidget(dialog);
-    QFormLayout *formLayout = new QFormLayout(widget);
-    csv_combo = new QComboBox(widget);
-    formLayout->addRow(tr("save all log with following base time"), csv_combo);
-    csv_combo->addItem("(no base time)");
-    main_layout->addWidget(widget,2,0);
-    main_layout->addWidget(ok_button,3,0);
-
-    connect(ok_button, SIGNAL(clicked()),this, SLOT(save()), Qt::QueuedConnection);
-    connect(this, SIGNAL(showDialog()),dialog, SLOT(show()), Qt::QueuedConnection);
-    connect(this, SIGNAL(appendToLog(QString)),log_text, SLOT(append(QString)), Qt::QueuedConnection);
-    connect(input_text, SIGNAL(cursorPositionChanged()),this, SLOT(clearInputText()), Qt::QueuedConnection);
-
-    file_names=new QStringList();
-}
-
-file_ui::~file_ui()
-{
-    delete dialog;
-}
-
-void file_ui::log(QString text) {
-    appendToLog(text);
-}
+file_ui::file_ui() {
+  dialog = new QDialog();
+  dialog->setWindowTitle("log files");
+  QGridLayout *main_layout = new QGridLayout(dialog);
+  ok_button = new QPushButton("Ok", dialog);
+  log_text = new QTextEdit(dialog);
+  log_text->setReadOnly(true);
+  input_text = new QTextEdit(dialog);
+  input_text->setText("add your log comment here");
+  input_cleared = false;
+
+  ok_button->setEnabled(false);
+
+  main_layout->addWidget(log_text, 0, 0);
+  main_layout->addWidget(input_text, 1, 0);
+
+  QWidget *widget = new QWidget(dialog);
+  QFormLayout *formLayout = new QFormLayout(widget);
+  csv_combo = new QComboBox(widget);
+  formLayout->addRow(tr("save all log with following base time"), csv_combo);
+  csv_combo->addItem("(no base time)");
+  main_layout->addWidget(widget, 2, 0);
+  main_layout->addWidget(ok_button, 3, 0);
+
+  connect(ok_button, SIGNAL(clicked()), this, SLOT(save()),
+          Qt::QueuedConnection);
+  connect(this, SIGNAL(showDialog()), dialog, SLOT(show()),
+          Qt::QueuedConnection);
+  connect(this, SIGNAL(appendToLog(QString)), log_text, SLOT(append(QString)),
+          Qt::QueuedConnection);
+  connect(input_text, SIGNAL(cursorPositionChanged()), this,
+          SLOT(clearInputText()), Qt::QueuedConnection);
+
+  file_names = new QStringList();
+}
+
+file_ui::~file_ui() { delete dialog; }
+
+void file_ui::log(QString text) { appendToLog(text); }
 
 void file_ui::addFile(QString file_path) {
-    //framework sends dbt file then txt file
-    //when we receive txt, we have both files
-    //and we can convert it to .csv
-    if(file_path.endsWith(".dbt")==true) {
-        QString name=file_path.section('/', -1);//remove path for displaying on combobox
-        csv_combo->addItem(name.replace(QString(".dbt"), QString(".csv")));
-        file_names->append(file_path.replace(QString(".dbt"), QString(".csv")));
-    }
-
-    if(file_path.endsWith(".txt")==true) {
-        dbt2csv(file_path.replace(QString(".txt"), QString(".dbt")));
-    }
-
-    if(file_names->size()==1) {
-        input_cleared=false;
-        showDialog();
-    }
+  // framework sends dbt file then txt file
+  // when we receive txt, we have both files
+  // and we can convert it to .csv
+  if (file_path.endsWith(".dbt") == true) {
+    QString name =
+        file_path.section('/', -1); // remove path for displaying on combobox
+    csv_combo->addItem(name.replace(QString(".dbt"), QString(".csv")));
+    file_names->append(file_path.replace(QString(".dbt"), QString(".csv")));
+  }
+
+  if (file_path.endsWith(".txt") == true) {
+    dbt2csv(file_path.replace(QString(".txt"), QString(".dbt")));
+  }
+
+  if (file_names->size() == 1) {
+    input_cleared = false;
+    showDialog();
+  }
 }
 
 void file_ui::endOfFiles(void) {
-    ok_button->setEnabled(true);
-
-    qint64 max_file_size=0;
-    for(int i=0;i<file_names->count();i++) {
-        QFileInfo info(file_names->at(i));
-        if(info.size()>max_file_size) {
-            max_file_size=info.size();
-            csv_combo->setCurrentIndex(i+1);//first item of combobox is already taken
-        }
-    }
-}
-
-void file_ui::dbt2csv(QString file_path)
-{
-    hdfile_t *dbtFile = NULL;
-    char *data;
-    QStringList data_type;
-
-    QString filename=file_path.section('/', -1);//remove path for displaying on logs
-    appendToLog(QString("converting %1 to csv").arg(filename));
-
-    //open csv file
-    QString csv_filename=file_path;
-    csv_filename.replace(QString(".dbt"), QString(".csv"));
-    QFile csv_file(csv_filename);
-
-    if(!csv_file.open(QIODevice::WriteOnly | QIODevice::Text)) {
-        appendToLog("      error opening csv file!");
-        return;
-    }
-    QTextStream out(&csv_file);
-
-    //open txt file
-    QString txt_filename=file_path;
-    txt_filename.replace(QString(".dbt"), QString(".txt"));
-    QFile txt_file(txt_filename);
-
-    if(!txt_file.open(QIODevice::ReadOnly | QIODevice::Text)) {
-        appendToLog("      error opening txt file!");
-        return;
-    }
-
-    //read txt file
+  ok_button->setEnabled(true);
+
+  qint64 max_file_size = 0;
+  for (int i = 0; i < file_names->count(); i++) {
+    QFileInfo info(file_names->at(i));
+    if (info.size() > max_file_size) {
+      max_file_size = info.size();
+      csv_combo->setCurrentIndex(i +
+                                 1); // first item of combobox is already taken
+    }
+  }
+}
+
+void file_ui::dbt2csv(QString file_path) {
+  hdfile_t *dbtFile = NULL;
+  char *data;
+  QStringList data_type;
+
+  QString filename =
+      file_path.section('/', -1); // remove path for displaying on logs
+  appendToLog(QString("converting %1 to csv").arg(filename));
+
+  // open csv file
+  QString csv_filename = file_path;
+  csv_filename.replace(QString(".dbt"), QString(".csv"));
+  QFile csv_file(csv_filename);
+
+  if (!csv_file.open(QIODevice::WriteOnly | QIODevice::Text)) {
+    appendToLog("      error opening csv file!");
+    return;
+  }
+  QTextStream out(&csv_file);
+
+  // open txt file
+  QString txt_filename = file_path;
+  txt_filename.replace(QString(".dbt"), QString(".txt"));
+  QFile txt_file(txt_filename);
+
+  if (!txt_file.open(QIODevice::ReadOnly | QIODevice::Text)) {
+    appendToLog("      error opening txt file!");
+    return;
+  }
+
+  // read txt file
+  QTextStream txt_in(&txt_file);
+  txt_in.readLine(); // time us
+  txt_in.readLine(); // time ns
+  while (1) {
+    if (txt_in.atEnd() == true)
+      break;
+    QString txt_line = txt_in.readLine();
+    data_type.append(txt_line.section(
+        "(",
+        -1)); // on part de la fin pour trouver la premiere parenthese ouvrante
+    // printf("type %s\n",txt_line.section("(",-1).toLocal8Bit().constData());
+  }
+  txt_file.close();
+
+  dbtFile = open_hdfile(file_path.toLocal8Bit().data(), READ_MODE);
+
+  if (!dbtFile) {
+    appendToLog("      error opening dbt file!");
+    return;
+  }
+  data = (char *)malloc(dbtFile->h.DataSize);
+  if (data == NULL) {
+    appendToLog("      error malloc!");
+    return;
+  }
+
+  bool dataWritten = false;
+  while (1) {
+    road_time_t time;
+    road_timerange_t tr = 0;
+    int offset = 0;
+    QTextStream csv_line;
+
+    if (read_hdfile(dbtFile, (void *)data, &time, &tr) == 0) {
+      break;
+    }
+    dataWritten = true;
+
+    out << time << "," << tr;
+    for (int i = 0; i < data_type.size(); i++) {
+      if (data_type.at(i) == "float)") {
+        float *value = (float *)(data + offset);
+        offset += sizeof(float);
+        out << "," << *value;
+      } else if (data_type.at(i) == "int8_t)") {
+        int8_t *value = (int8_t *)(data + offset);
+        offset += sizeof(int8_t);
+        float fl = (float)*value;
+        out << "," << *value;
+      } else {
+        appendToLog(QString("      unhandled type: %1").arg(data_type.at(i)));
+      }
+    }
+
+    out << "\n";
+  }
+
+  if (!dataWritten) {
+    // empty file!
+    out << "0,0"; // timr
+    for (int i = 0; i < data_type.size(); i++) {
+      out << ",0";
+    }
+    out << "\n";
+  }
+
+  csv_file.close();
+  close_hdfile(dbtFile);
+  if (data != NULL)
+    free(data);
+
+  appendToLog("      ok");
+}
+
+void file_ui::clearInputText(void) {
+  if (input_cleared == false) {
+    input_cleared = true;
+    input_text->clear();
+  }
+}
+
+void file_ui::save(void) {
+  save_comment();
+  if (csv_combo->currentIndex() != 0) {
+    save_csv();
+    save_txt();
+  }
+
+  log_text->clear();
+  input_cleared = true; // avoid clearing it with setText
+  input_text->setText("add your log comment here");
+  file_names->clear();
+  csv_combo->clear();
+  csv_combo->addItem(QString("(no base time)"));
+
+  dialog->setVisible(false);
+  ok_button->setEnabled(false);
+  emit finished();
+}
+
+void file_ui::save_comment(void) {
+  QString folder_name = file_names->at(0).section('/', 0, -2);
+
+  QString filename = folder_name + "/commentaire.txt";
+  QFile file(filename);
+  if (!file.open(QIODevice::WriteOnly | QIODevice::Text))
+    printf("file_ui::save_comment: erreur ouverture fichier %s\n",
+           filename.toLocal8Bit().constData());
+  QTextStream out(&file);
+
+  out << input_text->toPlainText();
+  file.close();
+}
+
+void file_ui::save_csv(void) {
+  // global csv file
+  QString folder_name = file_names->at(0).section('/', 0, -2);
+  QString filename = folder_name + "/all_logs.csv";
+  QFile global_file(filename);
+  if (!global_file.open(QIODevice::WriteOnly | QIODevice::Text))
+    printf("file_ui::save_csv: erreur ouverture fichier %s\n",
+           filename.toLocal8Bit().constData());
+  QTextStream out(&global_file);
+
+  // reference csv file
+  filename = file_names->at(csv_combo->currentIndex() - 1);
+  QFile ref_file(filename);
+  // printf("file_ui::save_csv: ref %s\n",filename.toLocal8Bit().constData());
+  if (!ref_file.open(QIODevice::ReadOnly | QIODevice::Text))
+    printf("file_ui::save_csv: erreur ouverture ficher %s\n",
+           filename.toLocal8Bit().constData());
+
+  // other csv files
+  int j = 0;
+  QFile m_file[file_names->count() - 1];
+  QTextStream m_in[file_names->count() - 1];
+  for (int i = 0; i < file_names->count(); i++) {
+    if (i == csv_combo->currentIndex() - 1)
+      continue;
+    filename = file_names->at(i);
+    m_file[j].setFileName(filename);
+    if (!m_file[j].open(QIODevice::ReadOnly | QIODevice::Text))
+      printf("file_ui::save_csv: erreur ouverture ficher %s\n",
+             filename.toLocal8Bit().constData());
+    m_in[j].setDevice(&m_file[j]);
+    j++;
+  }
+
+  // init
+  QTextStream ref_in(&ref_file);
+  QString m_line[file_names->count() - 1];
+  QString m_line_prev[file_names->count() - 1];
+  for (int i = 0; i < file_names->count() - 1; i++) {
+    m_line[i] = m_in[i].readLine();
+    m_line_prev[i] = m_line[i];
+  }
+
+  // organize csv files in one file
+  while (1) {
+    if (ref_in.atEnd() == true)
+      break;
+    QString ref_line = ref_in.readLine();
+
+    qint64 ref_us = ref_line.section(',', 0, 0).toLongLong();
+    int ref_ns = ref_line.section(',', 1, 1).toInt();
+    // printf("ref %lld %i\n",ref_us,ref_ns);
+
+    for (int i = 0; i < file_names->count() - 1; i++) {
+      qint64 csv_us = m_line[i].section(',', 0, 0).toLongLong();
+      int csv_ns = m_line[i].section(',', 1, 1).toInt();
+      // printf("m %lld %i\n",csv_us,csv_ns);
+
+      while (is_greater(ref_us, csv_us, ref_ns, csv_ns) == true) {
+        m_line_prev[i] = m_line[i];
+        if (m_in[i].atEnd() == true)
+          break;
+        m_line[i] = m_in[i].readLine();
+        csv_us = m_line[i].section(',', 0, 0).toLongLong();
+        csv_ns = m_line[i].section(',', 1, 1).toInt();
+        // printf("m %lld %i\n",csv_us,csv_ns);
+      }
+      csv_us = m_line_prev[i].section(',', 0, 0).toLongLong();
+      csv_ns = m_line_prev[i].section(',', 1, 1).toInt();
+      // printf("m ok %lld %i\n",csv_us,csv_ns);
+
+      ref_line += "," + m_line_prev[i].section(',', 2);
+    }
+
+    out << ref_line << "\n";
+  }
+
+  global_file.close();
+  ref_file.close();
+  for (int i = 0; i < file_names->count() - 1; i++)
+    m_file[i].close();
+}
+
+void file_ui::save_txt(void) {
+  // global txt file
+  QString folder_name = file_names->at(0).section('/', 0, -2);
+  QString filename = folder_name + "/all_logs.txt";
+  QFile global_file(filename);
+  if (!global_file.open(QIODevice::WriteOnly | QIODevice::Text))
+    printf("file_ui::save_txt: erreur ouverture ficher %s\n",
+           filename.toLocal8Bit().constData());
+  QTextStream out(&global_file);
+
+  // reference txt file
+  filename = file_names->at(csv_combo->currentIndex() - 1);
+  filename.replace(QString(".csv"), QString(".txt"));
+  QFile ref_file(filename);
+  if (!ref_file.open(QIODevice::ReadOnly | QIODevice::Text))
+    printf("file_ui::save_txt: erreur ouverture ficher %s\n",
+           filename.toLocal8Bit().constData());
+
+  QTextStream ref_in(&ref_file);
+  QString current_line = ref_in.readLine();
+  int nb_lines = 1;
+  while (current_line != NULL) {
+    out << current_line << "\n";
+    ;
+    current_line = ref_in.readLine();
+    nb_lines++;
+  }
+
+  // other txt files
+  for (int i = 0; i < file_names->count(); i++) {
+    if (i == csv_combo->currentIndex() - 1)
+      continue;
+    filename = file_names->at(i);
+    filename.replace(QString(".csv"), QString(".txt"));
+    QFile txt_file(filename);
+    if (!txt_file.open(QIODevice::ReadOnly | QIODevice::Text))
+      printf("file_ui::save_txt: erreur ouverture ficher %s\n",
+             filename.toLocal8Bit().constData());
     QTextStream txt_in(&txt_file);
-    txt_in.readLine();//time us
-    txt_in.readLine();//time ns
-    while(1)
-    {
-        if(txt_in.atEnd()==true) break;
-        QString txt_line=txt_in.readLine();
-        data_type.append(txt_line.section("(",-1));//on part de la fin pour trouver la premiere parenthese ouvrante
-        //printf("type %s\n",txt_line.section("(",-1).toLocal8Bit().constData());
+    txt_in.readLine(); // time us
+    txt_in.readLine(); // time ns
+    current_line = txt_in.readLine();
+    while (current_line != NULL) {
+      out << nb_lines << ":" << current_line.section(':', 1) << "\n";
+      ;
+      current_line = txt_in.readLine();
+      nb_lines++;
     }
     txt_file.close();
-
-    dbtFile=open_hdfile(file_path.toLocal8Bit().data(),READ_MODE);
-
-    if (!dbtFile)
-    {
-        appendToLog("      error opening dbt file!");
-        return;
-    }
-    data=(char*)malloc(dbtFile->h.DataSize);
-    if(data==NULL)
-    {
-        appendToLog("      error malloc!");
-        return;
-    }
-
-    bool dataWritten=false;
-    while(1)
-    {
-        road_time_t time;
-        road_timerange_t tr = 0;
-        int offset=0;
-        QTextStream csv_line;
-
-        if(read_hdfile(dbtFile,(void*)data,&time,&tr)==0) {
-            break;
-        }
-        dataWritten=true;
-
-        out << time << "," << tr;
-        for(int i=0;i<data_type.size();i++)
-        {
-            if(data_type.at(i)=="float)")
-            {
-                float* value=(float*)(data+offset);
-                offset+=sizeof(float);
-                out << "," << *value;
-            }
-            else if(data_type.at(i)=="int8_t)")
-            {
-                int8_t* value=(int8_t*)(data+offset);
-                offset+=sizeof(int8_t);
-                float fl=(float)*value;
-                out << "," << *value;
-            }
-            else
-            {
-                appendToLog(QString("      unhandled type: %1").arg(data_type.at(i)));
-            }
-        }
-
-        out << "\n";
-    }
-
-    if(!dataWritten) {
-        //empty file!
-        out <<  "0,0";//timr
-        for(int i=0;i<data_type.size();i++) {
-            out << ",0";
-        }
-        out << "\n";
-    }
-
-    csv_file.close();
-    close_hdfile(dbtFile);
-    if(data!=NULL) free(data);
-
-    appendToLog("      ok");
-}
-
-void file_ui::clearInputText(void){
-    if(input_cleared==false) {
-        input_cleared=true;
-        input_text->clear();
-    }
-}
-
-void file_ui::save(void)
-{
-    save_comment();
-    if(csv_combo->currentIndex()!=0)
-    {
-        save_csv();
-        save_txt();
-    }
-
-    log_text->clear();
-    input_cleared=true;//avoid clearing it with setText
-    input_text->setText("add your log comment here");
-    file_names->clear();
-    csv_combo->clear();
-    csv_combo->addItem(QString("(no base time)"));
-
-    dialog->setVisible(false);
-    ok_button->setEnabled(false);
-    emit finished();
-}
-
-void file_ui::save_comment(void)
-{
-    QString folder_name=file_names->at(0).section('/', 0,-2);
-
-    QString filename=folder_name+"/commentaire.txt";
-    QFile file(filename);
-    if(!file.open(QIODevice::WriteOnly | QIODevice::Text)) printf("file_ui::save_comment: erreur ouverture fichier %s\n",filename.toLocal8Bit().constData());
-    QTextStream out(&file);
-
-    out<<input_text->toPlainText();
-    file.close();
-}
-
-void file_ui::save_csv(void)
-{
-    //global csv file
-    QString folder_name=file_names->at(0).section('/', 0,-2);
-    QString filename=folder_name + "/all_logs.csv" ;
-    QFile global_file(filename);
-    if(!global_file.open(QIODevice::WriteOnly | QIODevice::Text)) printf("file_ui::save_csv: erreur ouverture fichier %s\n",filename.toLocal8Bit().constData());
-    QTextStream out(&global_file);
-
-    //reference csv file
-    filename=file_names->at(csv_combo->currentIndex()-1);
-    QFile ref_file(filename);
-    //printf("file_ui::save_csv: ref %s\n",filename.toLocal8Bit().constData());
-    if(!ref_file.open(QIODevice::ReadOnly | QIODevice::Text)) printf("file_ui::save_csv: erreur ouverture ficher %s\n",filename.toLocal8Bit().constData());
-
-    //other csv files
-    int j=0;
-    QFile m_file[file_names->count()-1];
-    QTextStream m_in[file_names->count()-1];
-    for(int i=0;i<file_names->count();i++)
-    {
-        if(i==csv_combo->currentIndex()-1) continue;
-        filename=file_names->at(i);
-        m_file[j].setFileName(filename);
-        if(!m_file[j].open(QIODevice::ReadOnly | QIODevice::Text)) printf("file_ui::save_csv: erreur ouverture ficher %s\n",filename.toLocal8Bit().constData());
-        m_in[j].setDevice(&m_file[j]);
-        j++;
-    }
-
-    //init
-    QTextStream ref_in(&ref_file);
-    QString m_line[file_names->count()-1];
-    QString m_line_prev[file_names->count()-1];
-    for(int i=0;i<file_names->count()-1;i++)
-    {
-        m_line[i]=m_in[i].readLine();
-        m_line_prev[i]=m_line[i];
-    }
-
-    //organize csv files in one file
-    while(1)
-    {
-        if(ref_in.atEnd()==true) break;
-        QString ref_line=ref_in.readLine();
-
-        qint64 ref_us=ref_line.section(',',0,0).toLongLong();
-        int ref_ns=ref_line.section(',',1,1).toInt();
-        //printf("ref %lld %i\n",ref_us,ref_ns);
-
-        for(int i=0;i<file_names->count()-1;i++)
-        {
-            qint64 csv_us=m_line[i].section(',',0,0).toLongLong();
-            int csv_ns=m_line[i].section(',',1,1).toInt();
-            //printf("m %lld %i\n",csv_us,csv_ns);
-
-            while(is_greater(ref_us,csv_us,ref_ns,csv_ns)==true)
-            {
-                m_line_prev[i]=m_line[i];
-                if(m_in[i].atEnd()==true) break;
-                m_line[i]=m_in[i].readLine();
-                csv_us=m_line[i].section(',',0,0).toLongLong();
-                csv_ns=m_line[i].section(',',1,1).toInt();
-                //printf("m %lld %i\n",csv_us,csv_ns);
-            }
-            csv_us=m_line_prev[i].section(',',0,0).toLongLong();
-            csv_ns=m_line_prev[i].section(',',1,1).toInt();
-            //printf("m ok %lld %i\n",csv_us,csv_ns);
-
-            ref_line+="," + m_line_prev[i].section(',',2);
-        }
-
-        out<<ref_line << "\n";
-    }
-
-    global_file.close();
-    ref_file.close();
-    for(int i=0;i<file_names->count()-1;i++) m_file[i].close();
-}
-
-void file_ui::save_txt(void)
-{
-    //global txt file
-    QString folder_name=file_names->at(0).section('/', 0,-2);
-    QString filename=folder_name + "/all_logs.txt";
-    QFile global_file(filename);
-    if(!global_file.open(QIODevice::WriteOnly | QIODevice::Text)) printf("file_ui::save_txt: erreur ouverture ficher %s\n",filename.toLocal8Bit().constData());
-    QTextStream out(&global_file);
-
-    //reference txt file
-    filename=file_names->at(csv_combo->currentIndex()-1);
-    filename.replace(QString(".csv"), QString(".txt"));
-    QFile ref_file(filename);
-    if(!ref_file.open(QIODevice::ReadOnly | QIODevice::Text)) printf("file_ui::save_txt: erreur ouverture ficher %s\n",filename.toLocal8Bit().constData());
-
-    QTextStream ref_in(&ref_file);
-    QString current_line=ref_in.readLine();
-    int nb_lines=1;
-    while(current_line!=NULL)
-    {
-        out<<current_line << "\n";;
-        current_line=ref_in.readLine();
-        nb_lines++;
-    }
-
-    //other txt files
-    for(int i=0;i<file_names->count();i++)
-    {
-        if(i==csv_combo->currentIndex()-1) continue;
-        filename=file_names->at(i);
-        filename.replace(QString(".csv"), QString(".txt"));
-        QFile txt_file(filename);
-        if(!txt_file.open(QIODevice::ReadOnly | QIODevice::Text)) printf("file_ui::save_txt: erreur ouverture ficher %s\n",filename.toLocal8Bit().constData());
-        QTextStream txt_in(&txt_file);
-        txt_in.readLine();//time us
-        txt_in.readLine();//time ns
-        current_line=txt_in.readLine();
-        while(current_line!=NULL)
-        {
-            out<< nb_lines << ":" << current_line.section(':',1) << "\n";;
-            current_line=txt_in.readLine();
-            nb_lines++;
-        }
-        txt_file.close();
-
-    }
-    global_file.close();
-    ref_file.close();
-}
-
-
-bool file_ui::is_greater(qint64 ref_us,qint64 csv_us,int ref_ns,int csv_ns)
-{
-    if(ref_us==csv_us)
-    {
-        if(ref_ns>csv_ns)
-        {
-            return true;
-        }
-        else
-        {
-            return false;
-        }
-    }
-    if(ref_us>csv_us)
-    {
-        return true;
-    }
-    else
-    {
-        return false;
-    }
-}
+  }
+  global_file.close();
+  ref_file.close();
+}
+
+bool file_ui::is_greater(qint64 ref_us, qint64 csv_us, int ref_ns, int csv_ns) {
+  if (ref_us == csv_us) {
+    if (ref_ns > csv_ns) {
+      return true;
+    } else {
+      return false;
+    }
+  }
+  if (ref_us > csv_us) {
+    return true;
+  } else {
+    return false;
+  }
+}
Index: trunk/tools/FlairGCS/src/file_ui.h
===================================================================
--- trunk/tools/FlairGCS/src/file_ui.h	(revision 14)
+++ trunk/tools/FlairGCS/src/file_ui.h	(revision 15)
@@ -15,37 +15,36 @@
 class QCloseEvent;
 
-class file_ui:public QObject
-{
-    Q_OBJECT
+class file_ui : public QObject {
+  Q_OBJECT
 
-    public:
-        file_ui();
-        ~file_ui();
-        void log(QString text);
-        void addFile(QString file_path);
-        void endOfFiles(void);
+public:
+  file_ui();
+  ~file_ui();
+  void log(QString text);
+  void addFile(QString file_path);
+  void endOfFiles(void);
 
-    private:
-        QDialog *dialog;
-        QStringList *file_names;
-        QTextEdit *log_text,*input_text;
-        QPushButton *ok_button;
-        QComboBox *csv_combo;
-        void save_comment(void);
-        void save_csv(void);
-        void save_txt(void);
-        void dbt2csv(QString file_path);
-        bool is_greater(qint64 ref_us,qint64 csv_us,int ref_ns,int csv_ns);
-        void closeEvent(QCloseEvent * e);
-        bool input_cleared;
+private:
+  QDialog *dialog;
+  QStringList *file_names;
+  QTextEdit *log_text, *input_text;
+  QPushButton *ok_button;
+  QComboBox *csv_combo;
+  void save_comment(void);
+  void save_csv(void);
+  void save_txt(void);
+  void dbt2csv(QString file_path);
+  bool is_greater(qint64 ref_us, qint64 csv_us, int ref_ns, int csv_ns);
+  void closeEvent(QCloseEvent *e);
+  bool input_cleared;
 
-    private slots:
-        void save(void);
-        void clearInputText(void);
+private slots:
+  void save(void);
+  void clearInputText(void);
 
-    signals:
-        void showDialog(void);
-        void appendToLog(QString);
-        void finished();
+signals:
+  void showDialog(void);
+  void appendToLog(QString);
+  void finished();
 };
 
Index: trunk/tools/FlairGCS/src/main.cpp
===================================================================
--- trunk/tools/FlairGCS/src/main.cpp	(revision 14)
+++ trunk/tools/FlairGCS/src/main.cpp	(revision 15)
@@ -18,51 +18,51 @@
 int port;
 
-void parseOptions(int argc, char** argv) {
-	try {
-        CmdLine cmd("Command description message", ' ', "0.1");
+void parseOptions(int argc, char **argv) {
+  try {
+    CmdLine cmd("Command description message", ' ', "0.1");
 
-        ValueArg<string> nameArg("n","name","uav name",false,"x4-0","string");
-        cmd.add( nameArg );
+    ValueArg<string> nameArg("n", "name", "uav name", false, "x4-0", "string");
+    cmd.add(nameArg);
 
-        ValueArg<int> portArg("p","port","port number",false,9000,"int");
-        cmd.add( portArg );
+    ValueArg<int> portArg("p", "port", "port number", false, 9000, "int");
+    cmd.add(portArg);
 
-        cmd.parse( argc, argv );
+    cmd.parse(argc, argv);
 
-        // Get the value parsed by each arg.
-        name= nameArg.getValue();
-        port = portArg.getValue();
+    // Get the value parsed by each arg.
+    name = nameArg.getValue();
+    port = portArg.getValue();
 
-	} catch (ArgException &e) {// catch any exceptions
-        cerr << "error: " << e.error() << " for arg " << e.argId() << endl;
-    }
+  } catch (ArgException &e) { // catch any exceptions
+    cerr << "error: " << e.error() << " for arg " << e.argId() << endl;
+  }
 }
 
 int main(int argc, char *argv[]) {
 
-    union {
-        uint32_t i;
-        char c[4];
-    } bint = {0x01020304};
+  union {
+    uint32_t i;
+    char c[4];
+  } bint = {0x01020304};
 
-    if(bint.c[0] == 1) {
-        printf("error, ground station is only compatible with little endian\n");
-        return -1;
-    }
+  if (bint.c[0] == 1) {
+    printf("error, ground station is only compatible with little endian\n");
+    return -1;
+  }
 
-    printf(SVN_REV);
+  printf(SVN_REV);
 
-    parseOptions(argc,argv);
-    printf("listening on port %i\n",port);
+  parseOptions(argc, argv);
+  printf("listening on port %i\n", port);
 
-    qRegisterMetaType<const char*>("const char*");
-    QLocale::setDefault(QLocale::C);
-    QApplication app(argc, argv);
-    app.setStyle(new QCleanlooksStyle);
+  qRegisterMetaType<const char *>("const char*");
+  QLocale::setDefault(QLocale::C);
+  QApplication app(argc, argv);
+  app.setStyle(new QCleanlooksStyle);
 
-    Manager manager(QString::fromStdString(name),port);
+  Manager manager(QString::fromStdString(name), port);
 
-    manager.show();
+  manager.show();
 
-    app.exec();
+  app.exec();
 }
Index: trunk/tools/FlairGCS/src/mapwidget.cpp
===================================================================
--- trunk/tools/FlairGCS/src/mapwidget.cpp	(revision 14)
+++ trunk/tools/FlairGCS/src/mapwidget.cpp	(revision 15)
@@ -57,359 +57,310 @@
 using namespace QtMobility;
 
-MapWidget::MapWidget(Map* map,QWidget *parent)
-    : QGraphicsView(parent) {
-    setCursor(Qt::ArrowCursor);
-    setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
-    setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
-
-    geoMap = 0;
+MapWidget::MapWidget(Map *map, QWidget *parent) : QGraphicsView(parent) {
+  setCursor(Qt::ArrowCursor);
+  setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+  setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+
+  geoMap = 0;
+  dragging = false;
+  pressed = false;
+  landmark_match = NULL;
+  is_uptodate = true;
+  this->map = map;
+
+  m_scene = new QGraphicsScene(this);
+  setScene(m_scene);
+  setMouseTracking(true);
+
+  landmarks = new QList<Landmark *>;
+  landmarks_old = new QList<Landmark *>;
+}
+
+QGraphicsScene *MapWidget::scene(void) const { return m_scene; }
+
+void MapWidget::setMap(QGraphicsGeoMap *geoMap) {
+  m_scene->clear();
+  m_scene->addItem(geoMap);
+  this->geoMap = geoMap;
+  geoMap->resize(m_scene->sceneRect().width(), m_scene->sceneRect().height());
+}
+
+void MapWidget::mousePressEvent(QMouseEvent *event) {
+  if (event->button() == Qt::LeftButton) {
+    pressed = true;
+    dragStartPosition = event->pos();
+    QTimer::singleShot(qApp->startDragTime(), this, SLOT(initDrag()));
+    event->accept();
+  }
+
+  if (event->button() == Qt::RightButton) {
+    QMenu *menu = new QMenu("nom", this);
+
+    if (cursor().shape() != Qt::PointingHandCursor) {
+      QAction *b, *z; //*a,
+      QList<QAction *> go_to_actions;
+      QList<QAction *> centered_actions;
+
+      QMenu *centered_menu = menu->addMenu("centered");
+      for (int i = 0; i < points.count(); i++) {
+        QAction *action = centered_menu->addAction(points.at(i));
+        centered_actions.append(action);
+        action->setCheckable(true);
+        if (map->centeredPoint() == i) {
+          action->setChecked(true);
+        } else {
+          action->setChecked(false);
+        }
+      }
+
+      menu->addSeparator();
+
+      b = menu->addAction("place checkpoint");
+      QMenu *go_to_menu = menu->addMenu("go to");
+      for (int i = 0; i < landmarks->count(); i++) {
+        QAction *action =
+            go_to_menu->addAction(QString("checkpoint %1").arg(i + 1));
+        go_to_actions.append(action);
+      }
+      if (landmarks->count() == 0)
+        go_to_menu->setEnabled(false);
+
+      map->appendmenu(menu);
+      z = map->execmenu(this, menu, event->globalPos());
+
+      for (int i = 0; i < centered_actions.count(); i++) {
+        if (z == centered_actions.at(i)) {
+          if (centered_actions.at(i)->isChecked()) {
+            map->setCenteredPoint(i);
+          } else {
+            map->setCenteredPoint(-1);
+          }
+
+          break;
+        }
+      }
+
+      if (z == b) {
+        Landmark *landmark = new Landmark(
+            geoMap, geoMap->screenPositionToCoordinate(event->pos()),
+            QString("%1").arg(landmarks->count() + 1));
+        landmarks->append(landmark);
+        is_uptodate = false;
+      }
+      for (int i = 0; i < go_to_actions.count(); i++) {
+        if (z == go_to_actions.at(i)) {
+          map->setCenteredPoint(-1);
+          geoMap->setCenter(landmarks->at(i)->coordinate());
+          break;
+        }
+      }
+
+    } else {
+      QAction *a, *z;
+      a = menu->addAction("delete");
+      z = menu->exec(event->globalPos());
+
+      if (z == a) {
+        int i;
+        for (i = 0; i < landmarks->count(); i++) {
+          if (landmarks->at(i)->contains(
+                  geoMap->screenPositionToCoordinate(event->pos()))) {
+            delete landmarks->at(i);
+            landmarks->removeAt(i);
+            break;
+          }
+        }
+        for (int j = i; j < landmarks->count(); j++) {
+          landmarks->at(j)->setText(QString("%1").arg(j + 1));
+        }
+      }
+    }
+
+    delete menu;
+  }
+}
+
+void MapWidget::initDrag(void) {
+  if (pressed && map->isCentered() && landmark_match == NULL) {
+    dragging = true;
+  }
+}
+
+void MapWidget::mouseMoveEvent(QMouseEvent *event) {
+  if (!geoMap)
+    return;
+
+  Qt::CursorShape new_cursor;
+  if (dragging == true) {
+    new_cursor = Qt::ClosedHandCursor;
+  } else {
+    if (map->isCentered()) {
+      if (pressed == true) {
+        new_cursor = Qt::ForbiddenCursor;
+      } else {
+        new_cursor = Qt::ArrowCursor;
+      }
+    } else {
+      new_cursor = Qt::OpenHandCursor;
+    }
+    if (landmark_match != NULL)
+      new_cursor = Qt::PointingHandCursor;
+  }
+
+  for (int i = 0; i < landmarks->count(); i++) {
+    if (landmarks->at(i)
+            ->contains(geoMap->screenPositionToCoordinate(event->pos()))) {
+      if (pressed && landmark_match == NULL) {
+        landmark_match = landmarks->at(i);
+        landmark_match->setColor(Qt::red);
+        is_uptodate = false;
+      }
+      new_cursor = Qt::PointingHandCursor;
+      break;
+    }
+  }
+
+  if (new_cursor != cursor().shape())
+    setCursor(new_cursor);
+
+  QPoint v = event->pos() - dragStartPosition;
+
+  if (dragging) {
+    geoMap->pan(-v.x(), -v.y());
+    dragStartPosition = event->pos();
+
+  } else if (landmark_match != NULL) {
+    landmark_match->setCoordinate(
+        geoMap->screenPositionToCoordinate(event->pos()));
+
+  } else if (pressed && !map->isCentered() &&
+             v.manhattanLength() >= qApp->startDragDistance()) {
+    dragging = true;
+
+  } else {
+    dragStartPosition = event->pos();
+    emit positionChanged(geoMap->screenPositionToCoordinate(event->pos()));
+  }
+
+  event->accept();
+}
+
+void MapWidget::mouseReleaseEvent(QMouseEvent *event) {
+  pressed = false;
+  landmark_match = NULL;
+
+  if (dragging) {
+    QPoint v = event->pos() - dragStartPosition;
+    geoMap->pan(-v.x(), -v.y());
     dragging = false;
-    pressed = false;
-    landmark_match=NULL;
-    is_uptodate=true;
-    this->map=map;
-
-    m_scene = new QGraphicsScene(this);
-    setScene(m_scene);
-    setMouseTracking(true);
-
-    landmarks=new QList<Landmark*>;
-    landmarks_old=new QList<Landmark*>;
-}
-
-QGraphicsScene *MapWidget::scene(void) const
-{
-    return m_scene;
-}
-
-void MapWidget::setMap(QGraphicsGeoMap *geoMap)
-{
-    m_scene->clear();
-    m_scene->addItem(geoMap);
-    this->geoMap = geoMap;
-    geoMap->resize(m_scene->sceneRect().width(), m_scene->sceneRect().height());
-}
-
-void MapWidget::mousePressEvent(QMouseEvent *event)
-{
-    if (event->button() == Qt::LeftButton)
-    {
-        pressed = true;
-        dragStartPosition = event->pos();
-        QTimer::singleShot(qApp->startDragTime(), this, SLOT(initDrag()));
-        event->accept();
-    }
-
-    if (event->button() == Qt::RightButton)
-    {
-        QMenu *menu = new QMenu("nom", this);
-
-        if(cursor().shape()!=Qt::PointingHandCursor)
-        {
-            QAction *b,*z;//*a,
-            QList<QAction*> go_to_actions;
-            QList<QAction*> centered_actions;
-
-            QMenu *centered_menu=menu->addMenu("centered");
-            for(int i=0;i<points.count();i++)
-            {
-                QAction* action=centered_menu->addAction(points.at(i));
-                centered_actions.append(action);
-                action->setCheckable(true);
-                if(map->centeredPoint()==i)
-                {
-                    action->setChecked(true);
-                }
-                else
-                {
-                    action->setChecked(false);
-                }
-            }
-
-            menu->addSeparator();
-
-            b=menu->addAction("place checkpoint");
-            QMenu *go_to_menu=menu->addMenu("go to");
-            for(int i=0;i<landmarks->count();i++)
-            {
-                QAction* action=go_to_menu->addAction(QString("checkpoint %1").arg(i+1));
-                go_to_actions.append(action);
-            }
-            if(landmarks->count()==0) go_to_menu->setEnabled(false);
-
-            map->appendmenu(menu);
-            z=map->execmenu(this,menu,event->globalPos());
-
-            for(int i=0;i<centered_actions.count();i++)
-            {
-                if(z==centered_actions.at(i))
-                {
-                    if(centered_actions.at(i)->isChecked())
-                    {
-                        map->setCenteredPoint(i);
-                    }
-                    else
-                    {
-                        map->setCenteredPoint(-1);
-                    }
-
-                    break;
-                }
-            }
-
-            if(z==b)
-            {
-                Landmark* landmark=new Landmark(geoMap,geoMap->screenPositionToCoordinate(event->pos()),QString("%1").arg(landmarks->count()+1));
-                landmarks->append(landmark);
-                is_uptodate=false;
-            }
-            for(int i=0;i<go_to_actions.count();i++)
-            {
-                if(z==go_to_actions.at(i))
-                {
-                    map->setCenteredPoint(-1);
-                    geoMap->setCenter(landmarks->at(i)->coordinate());
-                    break;
-                }
-            }
-
-        }
-        else
-        {
-            QAction *a,*z;
-            a=menu->addAction("delete");
-            z=menu->exec(event->globalPos());
-
-            if(z==a)
-            {
-                int i;
-                for(i=0;i<landmarks->count();i++)
-                {
-                    if(landmarks->at(i)->contains(geoMap->screenPositionToCoordinate(event->pos())))
-                    {
-                        delete landmarks->at(i);
-                        landmarks->removeAt(i);
-                        break;
-                    }
-                }
-                for(int j=i;j<landmarks->count();j++)
-                {
-                    landmarks->at(j)->setText(QString("%1").arg(j+1));
-                }
-            }
-        }
-
-        delete menu;
-    }
-}
-
-void MapWidget::initDrag(void)
-{
-    if (pressed && map->isCentered() && landmark_match==NULL) {
-        dragging = true;
-    }
-}
-
-void MapWidget::mouseMoveEvent(QMouseEvent *event)
-{
-    if (!geoMap)
-        return;
-
-    Qt::CursorShape new_cursor;
-    if(dragging==true)
-    {
-        new_cursor=Qt::ClosedHandCursor;
-    }
-    else
-    {
-        if(map->isCentered())
-        {
-            if(pressed==true)
-            {
-                new_cursor=Qt::ForbiddenCursor;
-            }
-            else
-            {
-                new_cursor=Qt::ArrowCursor;
-            }
-        }
-        else
-        {
-            new_cursor=Qt::OpenHandCursor;
-        }
-        if(landmark_match!=NULL) new_cursor=Qt::PointingHandCursor;
-    }
-
-
-    for(int i=0;i<landmarks->count();i++)
-    {
-        if(landmarks->at(i)->contains(geoMap->screenPositionToCoordinate(event->pos())))
-        {
-            if(pressed && landmark_match==NULL)
-            {
-                landmark_match=landmarks->at(i);
-                landmark_match->setColor(Qt::red);
-                is_uptodate=false;
-            }
-            new_cursor=Qt::PointingHandCursor;
-            break;
-        }
-    }
-
-    if(new_cursor!=cursor().shape()) setCursor(new_cursor);
-
-    QPoint v = event->pos() - dragStartPosition;
-
-    if (dragging) {
-        geoMap->pan(-v.x(), -v.y());
-        dragStartPosition = event->pos();
-
-    } else if(landmark_match!=NULL){
-        landmark_match->setCoordinate(geoMap->screenPositionToCoordinate(event->pos()));
-
-    } else if (pressed && !map->isCentered() &&
-        v.manhattanLength() >= qApp->startDragDistance()) {
-        dragging = true;
-
-    } else {
-        dragStartPosition = event->pos();
-        emit positionChanged(geoMap->screenPositionToCoordinate(event->pos()));
-    }
-
-    event->accept();
-}
-
-void MapWidget::mouseReleaseEvent(QMouseEvent *event)
-{
-    pressed = false;
-    landmark_match=NULL;
-
-    if (dragging) {
-        QPoint v = event->pos() - dragStartPosition;
-        geoMap->pan(-v.x(), -v.y());
-        dragging = false;
-    }
-
-    event->accept();
-}
-
-void MapWidget::resizeEvent(QResizeEvent *event)
-{
-    if (geoMap) {
-        m_scene->setSceneRect(QRectF(0, 0, event->size().width(), event->size().height()));
-        geoMap->resize(event->size().width(), event->size().height());
-    }
-
-    QGraphicsView::resizeEvent(event);
-}
-
-void MapWidget::wheelEvent(QWheelEvent *event)
-{
-    int steps = event->delta() / 120;
-    int zoom = qBound(geoMap->minimumZoomLevel(), geoMap->zoomLevel() + steps,
-                      geoMap->maximumZoomLevel());
-
-    if (zoom != geoMap->zoomLevel()) geoMap->setZoomLevel(zoom);
-    //if(!centered) geoMap->setCenter(geoMap->screenPositionToCoordinate(event->pos()));
-}
-
-void MapWidget::mouseDoubleClickEvent(QMouseEvent *event)
-{
-    if(!map->isCentered()) geoMap->setCenter(geoMap->screenPositionToCoordinate(event->pos()));
-}
-
-bool MapWidget::IsUptodate(void)
-{
-    return is_uptodate;
-}
-
-void MapWidget::SetUptodate(void)
-{
-    for(int i=0;i<landmarks_old->count();i++)
-    {
-        delete landmarks_old->at(i);
-    }
-    landmarks_old->clear();
-
-    for(int i=0;i<landmarks->count();i++)
-    {
-        landmarks->at(i)->setColor(Qt::white);
-        Landmark* landmark=new Landmark(geoMap,landmarks->at(i)->coordinate(),QString("%1").arg(landmarks->count()+1));
-        landmarks_old->append(landmark);
-        landmarks_old->at(i)->setVisible(false);
-    }
-
-    is_uptodate=true;
-}
-
-void MapWidget::Reset(void)
-{
-    for(int i=0;i<landmarks->count();i++)
-    {
-        delete landmarks->at(i);
-    }
-    landmarks->clear();
-
-    for(int i=0;i<landmarks_old->count();i++)
-    {
-        Landmark* landmark=new Landmark(geoMap,landmarks_old->at(i)->coordinate(),QString("%1").arg(landmarks->count()+1));
-        landmarks->append(landmark);
-        landmarks->at(i)->setColor(Qt::white);
-    }
-
-    is_uptodate=true;
-}
-
-QList<Landmark*>* MapWidget::Landmarks(void)
-{
-    return landmarks;
-}
-
-bool MapWidget::LandmarkToSend(int index)
-{
-    if(index>=landmarks_old->count()) return true;
-
-    if(landmarks->at(index)->coordinate()!=landmarks_old->at(index)->coordinate())
-        return true;
-    else
-        return false;
-}
-void MapWidget::RemoveLandmarks(void)
-{
-    for(int i=0;i<landmarks->count();i++)
-    {
-        landmarks->at(i)->RemoveLandmark();
-    }
-    for(int i=0;i<landmarks_old->count();i++)
-    {
-        landmarks_old->at(i)->RemoveLandmark();
-    }
-}
-
-void MapWidget::AddLandmarks(QGraphicsGeoMap *geoMap)
-{
-    for(int i=0;i<landmarks->count();i++)
-    {
-        landmarks->at(i)->AddLandmark(geoMap);
-    }
-    for(int i=0;i<landmarks_old->count();i++)
-    {
-        landmarks_old->at(i)->AddLandmark(geoMap);
-    }
-}
-
-void MapWidget::AddLandmark(const QGeoCoordinate &coordinate)
-{
-    Landmark* landmark=new Landmark(geoMap,coordinate,QString("%1").arg(landmarks->count()+1));
+  }
+
+  event->accept();
+}
+
+void MapWidget::resizeEvent(QResizeEvent *event) {
+  if (geoMap) {
+    m_scene->setSceneRect(
+        QRectF(0, 0, event->size().width(), event->size().height()));
+    geoMap->resize(event->size().width(), event->size().height());
+  }
+
+  QGraphicsView::resizeEvent(event);
+}
+
+void MapWidget::wheelEvent(QWheelEvent *event) {
+  int steps = event->delta() / 120;
+  int zoom = qBound(geoMap->minimumZoomLevel(), geoMap->zoomLevel() + steps,
+                    geoMap->maximumZoomLevel());
+
+  if (zoom != geoMap->zoomLevel())
+    geoMap->setZoomLevel(zoom);
+  // if(!centered)
+  // geoMap->setCenter(geoMap->screenPositionToCoordinate(event->pos()));
+}
+
+void MapWidget::mouseDoubleClickEvent(QMouseEvent *event) {
+  if (!map->isCentered())
+    geoMap->setCenter(geoMap->screenPositionToCoordinate(event->pos()));
+}
+
+bool MapWidget::IsUptodate(void) { return is_uptodate; }
+
+void MapWidget::SetUptodate(void) {
+  for (int i = 0; i < landmarks_old->count(); i++) {
+    delete landmarks_old->at(i);
+  }
+  landmarks_old->clear();
+
+  for (int i = 0; i < landmarks->count(); i++) {
+    landmarks->at(i)->setColor(Qt::white);
+    Landmark *landmark =
+        new Landmark(geoMap, landmarks->at(i)->coordinate(),
+                     QString("%1").arg(landmarks->count() + 1));
+    landmarks_old->append(landmark);
+    landmarks_old->at(i)->setVisible(false);
+  }
+
+  is_uptodate = true;
+}
+
+void MapWidget::Reset(void) {
+  for (int i = 0; i < landmarks->count(); i++) {
+    delete landmarks->at(i);
+  }
+  landmarks->clear();
+
+  for (int i = 0; i < landmarks_old->count(); i++) {
+    Landmark *landmark =
+        new Landmark(geoMap, landmarks_old->at(i)->coordinate(),
+                     QString("%1").arg(landmarks->count() + 1));
     landmarks->append(landmark);
-    landmark->setColor(Qt::white);
-    landmark=new Landmark(geoMap,coordinate,QString("%1").arg(landmarks_old->count()+1));
-    landmarks_old->append(landmark);
-    landmark->setColor(Qt::white);
-    landmark->setVisible(false);
-}
-
-void MapWidget::AddPoint(QString name)
-{
-    points.append(name);
-}
+    landmarks->at(i)->setColor(Qt::white);
+  }
+
+  is_uptodate = true;
+}
+
+QList<Landmark *> *MapWidget::Landmarks(void) { return landmarks; }
+
+bool MapWidget::LandmarkToSend(int index) {
+  if (index >= landmarks_old->count())
+    return true;
+
+  if (landmarks->at(index)->coordinate() !=
+      landmarks_old->at(index)->coordinate())
+    return true;
+  else
+    return false;
+}
+void MapWidget::RemoveLandmarks(void) {
+  for (int i = 0; i < landmarks->count(); i++) {
+    landmarks->at(i)->RemoveLandmark();
+  }
+  for (int i = 0; i < landmarks_old->count(); i++) {
+    landmarks_old->at(i)->RemoveLandmark();
+  }
+}
+
+void MapWidget::AddLandmarks(QGraphicsGeoMap *geoMap) {
+  for (int i = 0; i < landmarks->count(); i++) {
+    landmarks->at(i)->AddLandmark(geoMap);
+  }
+  for (int i = 0; i < landmarks_old->count(); i++) {
+    landmarks_old->at(i)->AddLandmark(geoMap);
+  }
+}
+
+void MapWidget::AddLandmark(const QGeoCoordinate &coordinate) {
+  Landmark *landmark = new Landmark(geoMap, coordinate,
+                                    QString("%1").arg(landmarks->count() + 1));
+  landmarks->append(landmark);
+  landmark->setColor(Qt::white);
+  landmark = new Landmark(geoMap, coordinate,
+                          QString("%1").arg(landmarks_old->count() + 1));
+  landmarks_old->append(landmark);
+  landmark->setColor(Qt::white);
+  landmark->setVisible(false);
+}
+
+void MapWidget::AddPoint(QString name) { points.append(name); }
Index: trunk/tools/FlairGCS/src/mapwidget.h
===================================================================
--- trunk/tools/FlairGCS/src/mapwidget.h	(revision 14)
+++ trunk/tools/FlairGCS/src/mapwidget.h	(revision 15)
@@ -57,49 +57,48 @@
 using namespace QtMobility;
 
-class MapWidget : public QGraphicsView
-{
-    Q_OBJECT
+class MapWidget : public QGraphicsView {
+  Q_OBJECT
 
-    public:
-        MapWidget(Map* map,QWidget *parent = 0);
-        void setMap(QtMobility::QGraphicsGeoMap *geoMap);
-        QGraphicsScene *scene() const;
-        bool IsUptodate(void);
-        void SetUptodate(void);
-        void Reset(void);
-        QList<Landmark*>* Landmarks(void);
-        bool LandmarkToSend(int index);
-        void AddLandmark(const QGeoCoordinate &coordinate);
-        void RemoveLandmarks(void);
-        void AddLandmarks(QGraphicsGeoMap *geoMap);
-        void AddPoint(QString name);
+public:
+  MapWidget(Map *map, QWidget *parent = 0);
+  void setMap(QtMobility::QGraphicsGeoMap *geoMap);
+  QGraphicsScene *scene() const;
+  bool IsUptodate(void);
+  void SetUptodate(void);
+  void Reset(void);
+  QList<Landmark *> *Landmarks(void);
+  bool LandmarkToSend(int index);
+  void AddLandmark(const QGeoCoordinate &coordinate);
+  void RemoveLandmarks(void);
+  void AddLandmarks(QGraphicsGeoMap *geoMap);
+  void AddPoint(QString name);
 
-    signals:
-        void positionChanged(const QGeoCoordinate &coordinate);
+signals:
+  void positionChanged(const QGeoCoordinate &coordinate);
 
-    protected:
-        void mousePressEvent(QMouseEvent *event);
-        void mouseMoveEvent(QMouseEvent *event);
-        void mouseReleaseEvent(QMouseEvent *event);
-        void resizeEvent(QResizeEvent *event);
-        void wheelEvent(QWheelEvent *event);
-        void mouseDoubleClickEvent(QMouseEvent *event);
+protected:
+  void mousePressEvent(QMouseEvent *event);
+  void mouseMoveEvent(QMouseEvent *event);
+  void mouseReleaseEvent(QMouseEvent *event);
+  void resizeEvent(QResizeEvent *event);
+  void wheelEvent(QWheelEvent *event);
+  void mouseDoubleClickEvent(QMouseEvent *event);
 
-    private slots:
-        void initDrag();
+private slots:
+  void initDrag();
 
-    private:
-        QGraphicsGeoMap *geoMap;
-        bool dragging;
-        QPoint dragStartPosition;
-        bool pressed;
-        bool is_uptodate;
+private:
+  QGraphicsGeoMap *geoMap;
+  bool dragging;
+  QPoint dragStartPosition;
+  bool pressed;
+  bool is_uptodate;
 
-        QGraphicsScene *m_scene;
-        QList<Landmark*> *landmarks;
-        QList<Landmark*> *landmarks_old;
-        QList<QString> points;
-        Landmark *landmark_match;
-        Map* map;
+  QGraphicsScene *m_scene;
+  QList<Landmark *> *landmarks;
+  QList<Landmark *> *landmarks_old;
+  QList<QString> points;
+  Landmark *landmark_match;
+  Map *map;
 };
 
