Changeset 269 in flair-src for trunk/tools/FlairGCS/src/UdtSocket.cpp


Ignore:
Timestamp:
Oct 4, 2018, 1:53:11 PM (3 years ago)
Author:
Sanahuja Guillaume
Message:

flairgcs:
speed up processing time when receiving datas from uav
triger watchdog while receiving datas from uav
(avoids connection lost in uav)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/FlairGCS/src/UdtSocket.cpp

    r258 r269  
    6666// disconnection of ground station
    6767void UdtSocket::heartbeat(void) {
     68  //printf("h %s %i.%i\n",name.toLocal8Bit().constData(),QTime::currentTime().second(),QTime::currentTime().msec());
    6869  char data = WATCHDOG_HEADER;
    6970  quint64 sent=write(&data, 1,HEARTBEAT_TIMER,true);
     
    161162    } else if(readfds==socket && num==1 && rv==1) {
    162163      int size;
     164      QTime initTime;
     165      initTime.start();
    163166      do {
     167        //we are in "infinite" loop, so let the heartbeat run if needed
     168        if(initTime.elapsed()>HEARTBEAT_TIMER) {
     169          initTime.start();
     170          //do not use error check of heartbeat() method: (otherwise, closes com too early)
     171          char data = WATCHDOG_HEADER;
     172          UDT::sendmsg(socket, &data, 1, HEARTBEAT_TIMER, true);
     173        }
     174       
    164175        size=UDT::recvmsg(socket, buf, buf_size);
    165176     
Note: See TracChangeset for help on using the changeset viewer.