Changeset 122 in flair-src for trunk/lib/FlairSensorActuator
- Timestamp:
- Jan 6, 2017, 1:56:26 PM (8 years ago)
- Location:
- trunk/lib/FlairSensorActuator/src
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/FlairSensorActuator/src/Camera.cpp
r121 r122 24 24 #include <DataPlot1D.h> 25 25 #include <Picture.h> 26 #include <Buffer.h>27 26 #include <highgui.h> 28 27 #include <fstream> … … 39 38 : IODevice(parent, name) { 40 39 plot_tab = NULL; 41 jpgBuffer=NULL;42 40 logFormat=LogFormat::NONE; 43 41 … … 63 61 64 62 output = NULL; 65 jpgBuffer=NULL;66 63 logFormat=LogFormat::NONE; 67 64 } … … 80 77 break; 81 78 case LogFormat::JPG: 82 if(jpgBuffer==NULL) { 83 jpgBuffer=new Buffer(this,"jpg_bufer"); 84 AddDataToLog(jpgBuffer); 85 }else{ 86 Warn("log format already defined\n"); 87 } 79 Warn("logging cvimage to jpeg\n"); 80 Warn("jpeg are not included in classical dbt file, as dbt does not handle variable length\n"); 88 81 break; 82 default: 83 Warn("LogFormat unknown\n"); 89 84 } 90 85 } … … 119 114 120 115 void Camera::ProcessUpdate(core::io_data* data) { 121 switch(logFormat) { 122 case LogFormat::JPG: 123 ajouter compression jpg 124 break; 116 if(getFrameworkManager()->IsLogging() && getFrameworkManager()->IsDeviceLogged(this)) { 117 switch(logFormat) { 118 case LogFormat::JPG: 119 IplImage *img=((cvimage*)data)->img; 120 //dspSaveToJpeg(img,"toto"); 121 break; 122 } 125 123 } 126 124 IODevice::ProcessUpdate(data); -
trunk/lib/FlairSensorActuator/src/Camera.h
r121 r122 25 25 class Picture; 26 26 class GridLayout; 27 }28 namespace core {29 class Buffer;30 27 } 31 28 } … … 163 160 gui::GridLayout *setup_layout; 164 161 LogFormat logFormat; 165 core::Buffer *jpgBuffer;166 162 }; 167 163 } // end namespace sensor -
trunk/lib/FlairSensorActuator/src/VrpnClient.cpp
r15 r122 26 26 using namespace flair::gui; 27 27 28 namespace { 29 flair::sensor::VrpnClient *singleton = NULL; 30 } 31 32 28 33 namespace flair { 29 34 namespace sensor { 30 35 31 VrpnClient::VrpnClient(const FrameworkManager *parent, string name, 36 VrpnClient *GetVrpnClient(void) { return singleton; } 37 38 VrpnClient::VrpnClient(string name, 32 39 string address, uint16_t us_period, uint8_t priority) 33 : Thread(parent, name, priority) { 40 : Thread(getFrameworkManager(), name, priority) { 41 if (singleton != NULL) { 42 Err("VrpnClient must be instanced only one time\n"); 43 return; 44 } 45 46 singleton = this; 34 47 pimpl_ = new VrpnClient_impl(this, name, address, us_period); 35 48 } 36 49 37 VrpnClient::VrpnClient( const FrameworkManager *parent,string name,50 VrpnClient::VrpnClient(string name, 38 51 SerialPort *serialport, uint16_t us_period, 39 52 uint8_t priority) 40 : Thread(parent, name, priority) { 53 : Thread(getFrameworkManager(), name, priority) { 54 if (singleton != NULL) { 55 Err("VrpnClient must be instanced only one time\n"); 56 return; 57 } 58 59 singleton = this; 41 60 pimpl_ = new VrpnClient_impl(this, name, serialport, us_period); 42 61 } -
trunk/lib/FlairSensorActuator/src/VrpnClient.h
r15 r122 18 18 19 19 namespace flair { 20 namespace core { 21 class FrameworkManager; 22 class SerialPort; 23 } 24 namespace gui { 25 class TabWidget; 26 class Layout; 27 } 20 namespace core { 21 class SerialPort; 22 } 23 namespace gui { 24 class TabWidget; 25 class Layout; 26 } 28 27 } 29 28 … … 35 34 /*! \class VrpnClient 36 35 * 37 * \brief Class to connect to a Vrpn server 36 * \brief Class to connect to a Vrpn server. The Thread is created with 37 * the FrameworkManager as parent. FrameworkManager must be created before. 38 * Only one instance of this class is allowed by program. 38 39 */ 39 40 class VrpnClient : public core::Thread { … … 46 47 * Construct a VrpnClient. Connection is done by IP. 47 48 * 48 * \param parent parent49 49 * \param name name 50 50 * \param address server address … … 52 52 * \param priority priority of the Thread 53 53 */ 54 VrpnClient( const core::FrameworkManager *parent,std::string name,54 VrpnClient(std::string name, 55 55 std::string address, uint16_t us_period, uint8_t priority); 56 56 … … 60 60 * Construct a VrpnClient. Connection is done by XBee modem. 61 61 * 62 * \param parent parent63 62 * \param name name 64 63 * \param serialport SerialPort for XBee modem … … 66 65 * \param priority priority of the Thread 67 66 */ 68 VrpnClient( const core::FrameworkManager *parent,std::string name,67 VrpnClient(std::string name, 69 68 core::SerialPort *serialport, uint16_t us_period, 70 69 uint8_t priority); … … 108 107 class VrpnClient_impl *pimpl_; 109 108 }; 109 110 /*! 111 * \brief get VrpnClient 112 * 113 * \return the VrpnClient 114 */ 115 VrpnClient *GetVrpnClient(void); 116 110 117 } // end namespace sensor 111 118 } // end namespace flair -
trunk/lib/FlairSensorActuator/src/VrpnObject.cpp
r15 r122 30 30 namespace sensor { 31 31 32 VrpnObject::VrpnObject( const VrpnClient *parent,string name,32 VrpnObject::VrpnObject(string name, 33 33 const TabWidget *tab) 34 : IODevice( parent, name) {35 pimpl_ = new VrpnObject_impl(this, parent,name, -1, tab);34 : IODevice(GetVrpnClient(), name) { 35 pimpl_ = new VrpnObject_impl(this, name, -1, tab); 36 36 AddDataToLog(pimpl_->output); 37 37 } 38 38 39 VrpnObject::VrpnObject( const VrpnClient *parent,string name, uint8_t id,39 VrpnObject::VrpnObject(string name, uint8_t id, 40 40 const TabWidget *tab) 41 : IODevice( parent, name) {41 : IODevice(GetVrpnClient(), name) { 42 42 Warn("Creation of object %s with id %i\n", name.c_str(), id); 43 pimpl_ = new VrpnObject_impl(this, parent,name, id, tab);43 pimpl_ = new VrpnObject_impl(this, name, id, tab); 44 44 AddDataToLog(pimpl_->output); 45 45 } -
trunk/lib/FlairSensorActuator/src/VrpnObject.h
r15 r122 19 19 20 20 namespace flair { 21 namespace core {22 class cvmatrix;23 class Vector3D;24 class Euler;25 class Quaternion;26 }27 namespace gui {28 class TabWidget;29 class Tab;30 class DataPlot1D;31 }21 namespace core { 22 class cvmatrix; 23 class Vector3D; 24 class Euler; 25 class Quaternion; 26 } 27 namespace gui { 28 class TabWidget; 29 class Tab; 30 class DataPlot1D; 31 } 32 32 } 33 33 … … 41 41 /*! \class VrpnObject 42 42 * 43 * \brief Class for VRPN object 43 * \brief Class for VRPN object. The IODevice is created with 44 * the VrpnClient as parent. VrpnClient must be created before. 44 45 */ 45 46 class VrpnObject : public core::IODevice { … … 53 54 * Construct a VrpnObject. Connection is done by IP. 54 55 * 55 * \param parent parent56 56 * \param name VRPN object name, should be the same as defined in the server 57 57 * \param tab Tab for the user interface 58 58 */ 59 VrpnObject( const VrpnClient *parent,std::string name,59 VrpnObject(std::string name, 60 60 const gui::TabWidget *tab); 61 61 … … 65 65 * Construct a VrpnObject. Connection is done by IP. 66 66 * 67 * \param parent parent68 67 * \param name name 69 68 * \param id VRPN object id, should be the same as defined in the server 70 69 * \param tab Tab for the user interface 71 70 */ 72 VrpnObject( const VrpnClient *parent,std::string name, uint8_t id,71 VrpnObject(std::string name, uint8_t id, 73 72 const gui::TabWidget *tab); 74 73 -
trunk/lib/FlairSensorActuator/src/VrpnObject_impl.cpp
r15 r122 39 39 using namespace flair::sensor; 40 40 41 VrpnObject_impl::VrpnObject_impl(VrpnObject *self, const VrpnClient *parent,41 VrpnObject_impl::VrpnObject_impl(VrpnObject *self, 42 42 string name, int id, const TabWidget *tab) { 43 this->parent = parent;43 parent = GetVrpnClient(); 44 44 this->self = self; 45 45 46 if(parent==NULL) { 47 self->Err("VrpnClient must be instanced before creating VrpnObject\n"); 48 return; 49 } 46 50 if (id == -1 && parent->UseXbee()) { 47 51 self->Err("erreur aucun identifiant specifie pour la connexion Xbee\n"); -
trunk/lib/FlairSensorActuator/src/unexported/VrpnObject_impl.h
r15 r122 26 26 27 27 namespace flair { 28 namespace core {29 class cvmatrix;30 class Vector3D;31 class Euler;32 }33 namespace gui {34 class TabWidget;35 class Tab;36 class DataPlot1D;37 }38 namespace sensor {39 class VrpnClient;40 class VrpnObject;41 }28 namespace core { 29 class cvmatrix; 30 class Vector3D; 31 class Euler; 32 } 33 namespace gui { 34 class TabWidget; 35 class Tab; 36 class DataPlot1D; 37 } 38 namespace sensor { 39 class VrpnClient; 40 class VrpnObject; 41 } 42 42 } 43 43 … … 47 47 public: 48 48 VrpnObject_impl(flair::sensor::VrpnObject *self, 49 const flair::sensor::VrpnClient *parent,std::string name,49 std::string name, 50 50 int id, const flair::gui::TabWidget *tab); 51 51 ~VrpnObject_impl(void);
Note:
See TracChangeset
for help on using the changeset viewer.