Changeset 249 in flair-src for trunk


Ignore:
Timestamp:
Jun 27, 2018, 11:45:33 AM (7 years ago)
Author:
Bayard Gildas
Message:

bug #36 solved

Location:
trunk/lib/FlairSensorActuator/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/FlairSensorActuator/src/TargetController.cpp

    r246 r249  
    112112
    113113void TargetController::Run() {
    114   SetPeriodMS(20);; //50Hz
    115114
    116115  Message *message;
     
    118117  //if (getFrameworkManager()->ErrorOccured() || !ControllerInitialization()) {
    119118  if (!ControllerInitialization()) {
    120     SafeStop();
     119//    SafeStop();
    121120    Thread::Err("An error occured, we don't proceed with the loop.\n");
    122121  } else {
    123 
    124122    axis = new Matrix((IODevice *)this, axisNumber, 1, floatType);
    125123    button =
    126124        new Matrix((IODevice *)this, buttonNumber, 1, SignedIntegerType(8));
    127125
     126    SetPeriodMS(20); //50Hz
    128127    while (!ToBeStopped()) {
    129128      // Thread::Info("Debug: entering acquisition loop\n");
     
    139138
    140139        // send pending controller state change request(s)
    141 
    142140        while (changeStateQueue.size() != 0) {
    143141          message = changeStateQueue.front();
  • trunk/lib/FlairSensorActuator/src/TargetEthController.cpp

    r238 r249  
    235235  Thread::Info("Debug: Listening to port %d\n", listeningPort);
    236236  // accept incoming connection
    237   bool connectionAccepted = false;
    238   while (!connectionAccepted) {
     237  while (!controlSocket) {
    239238    try {
    240239      controlSocket = listeningSocket->Accept(100000000);
    241240    } catch (std::logic_error &e) {
    242       Thread::Err(e.what());
    243       return false;
     241      Thread::Err("%s\n",e.what());
     242      if (ToBeStopped())
     243        return false;
    244244    } catch (std::runtime_error e) {
    245245      // timeout
    246       if (ToBeStopped())
    247         return false;
    248     }
    249     if (controlSocket == nullptr) {
    250       return false;
    251     } else
    252       connectionAccepted = true;
     246      //Thread::Err("%s\n",e.what());
     247      if (ToBeStopped())
     248        return false;
     249    }
    253250  }
    254251  Thread::Info("Debug: Connexion accepted\n");
  • trunk/lib/FlairSensorActuator/src/TargetEthController.h

    r214 r249  
    7777  core::TcpSocket *listeningSocket;
    7878  int listeningPort;
    79   core::TcpSocket *controlSocket = NULL;
     79  core::TcpSocket *controlSocket = nullptr;
    8080  core::UdpSocket *dataSocket;
    81   std::string *axisName = NULL;
    82   std::string *buttonName = NULL;
     81  std::string *axisName = nullptr;
     82  std::string *buttonName = nullptr;
    8383  size_t dataFrameSize;
    8484  char *dataFrameBuffer;
Note: See TracChangeset for help on using the changeset viewer.