Changeset 294 in flair-src for trunk/lib/FlairSensorActuator/src
- Timestamp:
- Jan 9, 2019, 3:38:32 PM (6 years ago)
- Location:
- trunk/lib/FlairSensorActuator/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/FlairSensorActuator/src/VrpnClient.cpp
r232 r294 39 39 : Thread(getFrameworkManager(), name, priority) { 40 40 if (singleton != NULL) { 41 Err("VrpnClient must be instanced only one time\n"); 42 return; 41 SimpleWarn("VrpnClient should be instanced only one time!\n"); 42 SimpleWarn("Next calls to GetVrpnClient() will return the first created VrpnClient (%s)\n",singleton->ObjectName().c_str()); 43 } else { 44 singleton = this; 43 45 } 44 46 45 singleton = this;46 47 pimpl_ = new VrpnClient_impl(this, name, address); 47 48 } … … 52 53 : Thread(getFrameworkManager(), name, priority) { 53 54 if (singleton != NULL) { 54 Err("VrpnClient must be instanced only one time\n"); 55 return; 55 SimpleWarn("VrpnClient should be instanced only one time!\n"); 56 SimpleWarn("Next calls to GetVrpnClient() will return the first created VrpnClient (%s)\n",singleton->ObjectName().c_str()); 57 } else { 58 singleton = this; 56 59 } 57 58 singleton = this; 60 59 61 pimpl_ = new VrpnClient_impl(this, name, serialport, us_period); 60 62 } -
trunk/lib/FlairSensorActuator/src/VrpnClient_impl.cpp
r232 r294 41 41 std::string address) { 42 42 this->self = self; 43 this->address = address; 43 44 serialport = NULL; 44 45 isConnected=false; … … 55 56 rotation_1 = new OneAxisRotation(setup_tab->NewRow(), "post rotation 1",OneAxisRotation::PreRotation); 56 57 rotation_2 = new OneAxisRotation(setup_tab->NewRow(), "post rotation 2",OneAxisRotation::PreRotation); 58 59 Printf("Connecting to VRPN server on %s\n",address.c_str()); 57 60 } 58 61 … … 75 78 rotation_1 = new OneAxisRotation(setup_tab->NewRow(), "post rotation 1",OneAxisRotation::PreRotation); 76 79 rotation_2 = new OneAxisRotation(setup_tab->NewRow(), "post rotation 2",OneAxisRotation::PreRotation); 80 81 Printf("Connecting to VRPN server on %s\n",serialport->ObjectName().c_str()); 77 82 } 78 83 … … 172 177 // self->Warn("erreur rt_dev_read (%s)\n",strerror(-read)); 173 178 } else if (read != sizeof(response)) { 174 self->Warn(" erreur rt_dev_read%i/%i\n", read, sizeof(response));179 self->Warn("serial read error %i/%i\n", read, sizeof(response)); 175 180 } else { 176 181 // for(ssize_t i=0;i<read;i++) printf("%x ",response[i]); … … 209 214 if(connection->connected()==vrpn_true && !isConnected) { 210 215 isConnected=true; 211 Printf("VRPN connected \n");216 Printf("VRPN connected to %s\n",address.c_str()); 212 217 } 213 218 if(connection->connected()==vrpn_false && isConnected) { 214 219 isConnected=false; 215 Printf("VRPN disconnected \n");220 Printf("VRPN disconnected to %s\n",address.c_str()); 216 221 } 217 222 //timeout in mainloop is not well handled if not connected... … … 219 224 //this is when trackables callbacks are called: 220 225 if(connection->mainloop(&timeout)!=0) { 221 self->Warn("connection dropped \n");226 self->Warn("connection dropped from\n",address.c_str()); 222 227 } 223 228 //printf("%lld\n",GetTime()/(1000*1000)); -
trunk/lib/FlairSensorActuator/src/unexported/VrpnClient_impl.h
r167 r294 77 77 flair::core::SerialPort *serialport; 78 78 bool isConnected;//only for ip connection, not for xbee 79 std::string address; 79 80 }; 80 81
Note:
See TracChangeset
for help on using the changeset viewer.