Index: trunk/lib/FlairSensorActuator/src/Camera.cpp
===================================================================
--- trunk/lib/FlairSensorActuator/src/Camera.cpp	(revision 121)
+++ trunk/lib/FlairSensorActuator/src/Camera.cpp	(revision 122)
@@ -24,5 +24,4 @@
 #include <DataPlot1D.h>
 #include <Picture.h>
-#include <Buffer.h>
 #include <highgui.h>
 #include <fstream>
@@ -39,5 +38,4 @@
     : IODevice(parent, name) {
   plot_tab = NULL;
-	jpgBuffer=NULL;
 	logFormat=LogFormat::NONE;
 
@@ -63,5 +61,4 @@
 
   output = NULL;
-	jpgBuffer=NULL;
 	logFormat=LogFormat::NONE;
 }
@@ -80,11 +77,9 @@
 			break;
 		case LogFormat::JPG:
-			if(jpgBuffer==NULL) {
-				jpgBuffer=new Buffer(this,"jpg_bufer");
-				AddDataToLog(jpgBuffer);
-			}else{
-				Warn("log format already defined\n");
-			}
+				Warn("logging cvimage to jpeg\n");
+				Warn("jpeg are not included in classical dbt file, as dbt does not handle variable length\n");
 			break;
+		default:
+			Warn("LogFormat unknown\n");
 	}
 }
@@ -119,8 +114,11 @@
 
 void Camera::ProcessUpdate(core::io_data* data) {
-	switch(logFormat) {
-		case LogFormat::JPG:
-				ajouter compression jpg
-			break;
+	if(getFrameworkManager()->IsLogging() && getFrameworkManager()->IsDeviceLogged(this)) {
+		switch(logFormat) {
+			case LogFormat::JPG:
+					IplImage *img=((cvimage*)data)->img;
+					//dspSaveToJpeg(img,"toto");
+				break;
+		}
 	}
 	IODevice::ProcessUpdate(data);
Index: trunk/lib/FlairSensorActuator/src/Camera.h
===================================================================
--- trunk/lib/FlairSensorActuator/src/Camera.h	(revision 121)
+++ trunk/lib/FlairSensorActuator/src/Camera.h	(revision 122)
@@ -25,7 +25,4 @@
 		class Picture;
 		class GridLayout;
-	}
-	namespace core {
-		class Buffer;
 	}
 }
@@ -163,5 +160,4 @@
   gui::GridLayout *setup_layout;
 	LogFormat logFormat;
-	core::Buffer *jpgBuffer;
 };
 } // end namespace sensor
Index: trunk/lib/FlairSensorActuator/src/VrpnClient.cpp
===================================================================
--- trunk/lib/FlairSensorActuator/src/VrpnClient.cpp	(revision 121)
+++ trunk/lib/FlairSensorActuator/src/VrpnClient.cpp	(revision 122)
@@ -26,17 +26,36 @@
 using namespace flair::gui;
 
+namespace {
+  flair::sensor::VrpnClient *singleton = NULL;
+}
+
+
 namespace flair {
 namespace sensor {
 
-VrpnClient::VrpnClient(const FrameworkManager *parent, string name,
+VrpnClient *GetVrpnClient(void) { return singleton; }
+	
+VrpnClient::VrpnClient(string name,
                        string address, uint16_t us_period, uint8_t priority)
-    : Thread(parent, name, priority) {
+    : Thread(getFrameworkManager(), name, priority) {
+	if (singleton != NULL) {
+    Err("VrpnClient must be instanced only one time\n");
+    return;
+  }
+
+  singleton = this;
   pimpl_ = new VrpnClient_impl(this, name, address, us_period);
 }
 
-VrpnClient::VrpnClient(const FrameworkManager *parent, string name,
+VrpnClient::VrpnClient(string name,
                        SerialPort *serialport, uint16_t us_period,
                        uint8_t priority)
-    : Thread(parent, name, priority) {
+    : Thread(getFrameworkManager(), name, priority) {
+	if (singleton != NULL) {
+    Err("VrpnClient must be instanced only one time\n");
+    return;
+  }
+
+  singleton = this;
   pimpl_ = new VrpnClient_impl(this, name, serialport, us_period);
 }
Index: trunk/lib/FlairSensorActuator/src/VrpnClient.h
===================================================================
--- trunk/lib/FlairSensorActuator/src/VrpnClient.h	(revision 121)
+++ trunk/lib/FlairSensorActuator/src/VrpnClient.h	(revision 122)
@@ -18,12 +18,11 @@
 
 namespace flair {
-namespace core {
-class FrameworkManager;
-class SerialPort;
-}
-namespace gui {
-class TabWidget;
-class Layout;
-}
+	namespace core {
+		class SerialPort;
+	}
+	namespace gui {
+		class TabWidget;
+		class Layout;
+	}
 }
 
@@ -35,5 +34,7 @@
 /*! \class VrpnClient
 *
-* \brief Class to connect to a Vrpn server
+* \brief Class to connect to a Vrpn server. The Thread is created with 
+*  the FrameworkManager as parent. FrameworkManager must be created before.
+* Only one instance of this class is allowed by program.
 */
 class VrpnClient : public core::Thread {
@@ -46,5 +47,4 @@
   * Construct a VrpnClient. Connection is done by IP.
   *
-  * \param parent parent
   * \param name name
   * \param address server address
@@ -52,5 +52,5 @@
   * \param priority priority of the Thread
   */
-  VrpnClient(const core::FrameworkManager *parent, std::string name,
+  VrpnClient(std::string name,
              std::string address, uint16_t us_period, uint8_t priority);
 
@@ -60,5 +60,4 @@
   * Construct a VrpnClient. Connection is done by XBee modem.
   *
-  * \param parent parent
   * \param name name
   * \param serialport SerialPort for XBee modem
@@ -66,5 +65,5 @@
   * \param priority priority of the Thread
   */
-  VrpnClient(const core::FrameworkManager *parent, std::string name,
+  VrpnClient(std::string name,
              core::SerialPort *serialport, uint16_t us_period,
              uint8_t priority);
@@ -108,4 +107,12 @@
   class VrpnClient_impl *pimpl_;
 };
+
+/*!
+* \brief get VrpnClient
+*
+* \return the VrpnClient
+*/
+VrpnClient *GetVrpnClient(void);
+
 } // end namespace sensor
 } // end namespace flair
Index: trunk/lib/FlairSensorActuator/src/VrpnObject.cpp
===================================================================
--- trunk/lib/FlairSensorActuator/src/VrpnObject.cpp	(revision 121)
+++ trunk/lib/FlairSensorActuator/src/VrpnObject.cpp	(revision 122)
@@ -30,16 +30,16 @@
 namespace sensor {
 
-VrpnObject::VrpnObject(const VrpnClient *parent, string name,
+VrpnObject::VrpnObject(string name,
                        const TabWidget *tab)
-    : IODevice(parent, name) {
-  pimpl_ = new VrpnObject_impl(this, parent, name, -1, tab);
+    : IODevice(GetVrpnClient(), name) {
+  pimpl_ = new VrpnObject_impl(this, name, -1, tab);
   AddDataToLog(pimpl_->output);
 }
 
-VrpnObject::VrpnObject(const VrpnClient *parent, string name, uint8_t id,
+VrpnObject::VrpnObject(string name, uint8_t id,
                        const TabWidget *tab)
-    : IODevice(parent, name) {
+    : IODevice(GetVrpnClient(), name) {
   Warn("Creation of object %s with id %i\n", name.c_str(), id);
-  pimpl_ = new VrpnObject_impl(this, parent, name, id, tab);
+  pimpl_ = new VrpnObject_impl(this, name, id, tab);
   AddDataToLog(pimpl_->output);
 }
Index: trunk/lib/FlairSensorActuator/src/VrpnObject.h
===================================================================
--- trunk/lib/FlairSensorActuator/src/VrpnObject.h	(revision 121)
+++ trunk/lib/FlairSensorActuator/src/VrpnObject.h	(revision 122)
@@ -19,15 +19,15 @@
 
 namespace flair {
-namespace core {
-class cvmatrix;
-class Vector3D;
-class Euler;
-class Quaternion;
-}
-namespace gui {
-class TabWidget;
-class Tab;
-class DataPlot1D;
-}
+	namespace core {
+		class cvmatrix;
+		class Vector3D;
+		class Euler;
+		class Quaternion;
+	}
+	namespace gui {
+		class TabWidget;
+		class Tab;
+		class DataPlot1D;
+	}
 }
 
@@ -41,5 +41,6 @@
 /*! \class VrpnObject
 *
-* \brief Class for VRPN object
+* \brief Class for VRPN object. The IODevice is created with 
+*  the VrpnClient as parent. VrpnClient must be created before.
 */
 class VrpnObject : public core::IODevice {
@@ -53,9 +54,8 @@
   * 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,
+  VrpnObject(std::string name,
              const gui::TabWidget *tab);
 
@@ -65,10 +65,9 @@
   * 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,
+  VrpnObject(std::string name, uint8_t id,
              const gui::TabWidget *tab);
 
Index: trunk/lib/FlairSensorActuator/src/VrpnObject_impl.cpp
===================================================================
--- trunk/lib/FlairSensorActuator/src/VrpnObject_impl.cpp	(revision 121)
+++ trunk/lib/FlairSensorActuator/src/VrpnObject_impl.cpp	(revision 122)
@@ -39,9 +39,13 @@
 using namespace flair::sensor;
 
-VrpnObject_impl::VrpnObject_impl(VrpnObject *self, const VrpnClient *parent,
+VrpnObject_impl::VrpnObject_impl(VrpnObject *self,
                                  string name, int id, const TabWidget *tab) {
-  this->parent = parent;
+  parent = GetVrpnClient();
   this->self = self;
 
+	if(parent==NULL) {
+		self->Err("VrpnClient must be instanced before creating VrpnObject\n");
+		return;
+	}
   if (id == -1 && parent->UseXbee()) {
     self->Err("erreur aucun identifiant specifie pour la connexion Xbee\n");
Index: trunk/lib/FlairSensorActuator/src/unexported/VrpnObject_impl.h
===================================================================
--- trunk/lib/FlairSensorActuator/src/unexported/VrpnObject_impl.h	(revision 121)
+++ trunk/lib/FlairSensorActuator/src/unexported/VrpnObject_impl.h	(revision 122)
@@ -26,18 +26,18 @@
 
 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 core {
+		class cvmatrix;
+		class Vector3D;
+		class Euler;
+	}
+	namespace gui {
+		class TabWidget;
+		class Tab;
+		class DataPlot1D;
+	}
+	namespace sensor {
+		class VrpnClient;
+		class VrpnObject;
+	}
 }
 
@@ -47,5 +47,5 @@
 public:
   VrpnObject_impl(flair::sensor::VrpnObject *self,
-                  const flair::sensor::VrpnClient *parent, std::string name,
+                  std::string name,
                   int id, const flair::gui::TabWidget *tab);
   ~VrpnObject_impl(void);
