Ignore:
Timestamp:
Jun 21, 2016, 3:48:18 PM (5 years ago)
Author:
Sanahuja Guillaume
Message:

show rx rate in GCS

File:
1 edited

Legend:

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

    r15 r30  
    1212
    1313#define COMPRESS_CHUNK 1024
     14#define RX_TIME 5000
    1415
    1516ConnectionLayout::ConnectionLayout(UdtSocket *socket, QString name)
     
    1718  isRemoteNameDefined = false;
    1819  this->socket = socket;
     20
     21  total_received=0;
     22  receive_timer = new QTimer(this);
     23  connect(receive_timer, SIGNAL(timeout()), this, SLOT(computeRxRate()));
     24  receive_timer->start(RX_TIME);
    1925}
    2026
    21 ConnectionLayout::~ConnectionLayout() {}
     27ConnectionLayout::~ConnectionLayout() {
     28  receive_timer->stop();
     29}
     30
     31void ConnectionLayout::computeRxRate(void) {
     32  float receive_rate=((float)total_received/(RX_TIME/1000))/1000;//in Ko/s
     33  total_received=0;
     34  computedRxRate(receive_rate);
     35}
    2236
    2337void ConnectionLayout::receive(char *buf, int size) {
     38  total_received+=size-1;
    2439  // printf("trame %x\n",buf[0]);
    2540  // for(int i=0; i<size;i++) printf("%x ",buf[i]);
Note: See TracChangeset for help on using the changeset viewer.