- Timestamp:
- Jun 21, 2016, 3:48:18 PM (9 years ago)
- Location:
- trunk/tools/FlairGCS/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/FlairGCS/src/ConnectionLayout.cpp
r15 r30 12 12 13 13 #define COMPRESS_CHUNK 1024 14 #define RX_TIME 5000 14 15 15 16 ConnectionLayout::ConnectionLayout(UdtSocket *socket, QString name) … … 17 18 isRemoteNameDefined = false; 18 19 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); 19 25 } 20 26 21 ConnectionLayout::~ConnectionLayout() {} 27 ConnectionLayout::~ConnectionLayout() { 28 receive_timer->stop(); 29 } 30 31 void 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 } 22 36 23 37 void ConnectionLayout::receive(char *buf, int size) { 38 total_received+=size-1; 24 39 // printf("trame %x\n",buf[0]); 25 40 // for(int i=0; i<size;i++) printf("%x ",buf[i]); -
trunk/tools/FlairGCS/src/ConnectionLayout.h
r15 r30 6 6 #define CONNECTIONLAYOUT_H 7 7 8 #include <QTimer> 8 9 #include "Layout.h" 9 10 … … 33 34 UdtSocket *socket; 34 35 QList<DataRemote *> dataremotes; 36 unsigned int total_received; 37 QTimer *receive_timer; 35 38 36 39 private slots: 37 40 void receive(char *buf, int size); 41 void computeRxRate(void); 38 42 39 43 signals: 40 44 void setRemoteName(QString name); 45 void computedRxRate(float rxRate); 41 46 }; 42 47 -
trunk/tools/FlairGCS/src/Manager.cpp
r15 r30 38 38 39 39 setWindowTitle(name); 40 40 //statusBar()->showMessage(tr("Ready to serve")); 41 41 // manager layout 42 42 managerLayout = new QVBoxLayout; … … 69 69 connect(save_button, SIGNAL(clicked(bool)), this, SLOT(save())); 70 70 71 status=new QStatusBar(); 72 status->setSizeGripEnabled(false); 73 button_layout->addWidget(status, 1,0); 74 71 75 UDT::startup(); 72 76 serv = UDT::socket(AF_INET, SOCK_DGRAM, 0); … … 155 159 connect(newLayout, SIGNAL(setRemoteName(QString)), this, 156 160 SLOT(tabName(QString))); 161 connect(newLayout, SIGNAL(computedRxRate(float)), this, 162 SLOT(printRxRates(float))); 157 163 connect(socket, SIGNAL(dataReady(char *, int)), newLayout, 158 164 SLOT(receive(char *, int))); … … 172 178 } else { // add a tab for the new connection 173 179 tabBar->addTab("unknown"); 180 } 181 } 182 183 void Manager::printRxRates(float rxRate) { 184 int index = connectionsLayout.indexOf((ConnectionLayout *)sender()); 185 186 if (tabBar->count() == 0) { 187 status->showMessage(tr("rx rate %1 kB/s").arg(rxRate,0,'f',3)); 188 } else if (index==tabBar->currentIndex()) { 189 status->showMessage(tr("%1 rx rate %2 kB/s").arg(tabBar->tabText(index)).arg(rxRate,0,'f',3)); 174 190 } 175 191 } … … 209 225 hiddenTabName = tabBar->tabText(0); 210 226 tabBar->removeTab(0); 227 } 228 229 if (connectionsLayout.count() == 0) { 230 status->showMessage(""); 211 231 } 212 232 } -
trunk/tools/FlairGCS/src/Manager.h
r15 r30 9 9 #include <udt.h> 10 10 #include <qdom.h> 11 #include <QStatusBar> 11 12 12 13 class UdtSocket; … … 38 39 QPushButton *save_button; 39 40 QGridLayout *button_layout; 41 QStatusBar *status; 40 42 41 43 void newConnection(UdtSocket *socket); … … 50 52 void tabBarCurrentChanged(int index); 51 53 void tabName(QString name); 54 void printRxRates(float rxRate); 52 55 53 56 signals: -
trunk/tools/FlairGCS/src/UdtSocket.cpp
r20 r30 70 70 if (UDT::epoll_add_usock(eid, file_socket) < 0) { 71 71 if (UDT::getlasterror().getErrorCode() == 5004) { 72 printf("epoll_add_usock \n");72 printf("epoll_add_usock error\n"); 73 73 break; 74 74 } else { … … 79 79 if (UDT::epoll_add_usock(eid, com_socket) < 0) { 80 80 if (UDT::getlasterror().getErrorCode() == 5004) { 81 printf("epoll_add_usock \n");81 printf("epoll_add_usock error\n"); 82 82 break; 83 83 } else {
Note:
See TracChangeset
for help on using the changeset viewer.