- Timestamp:
- Sep 10, 2021, 2:37:55 PM (3 years ago)
- Location:
- trunk
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/FlairCore/src/ui_com.cpp
r443 r444 389 389 dataToSend->CopyDatas(ptr->buf+ptr->actual_size); 390 390 ptr->actual_size+=dataToSend->SendSize(); 391 Printf("nb buffered %i/%i\n",ptr->actual_size,ptr->final_size);392 Printf("pushed size %i period %i nb buffering %i\n",dataToSend->SendSize(),dataToSend->SendPeriod(),dataToSend->NbBuffering());391 //Printf("nb buffered %i/%i\n",ptr->actual_size,ptr->final_size); 392 //Printf("pushed size %i period %i nb buffering %i\n",dataToSend->SendSize(),dataToSend->SendPeriod(),dataToSend->NbBuffering()); 393 393 if(ptr->actual_size>=ptr->final_size) {//par securité on test aussi le cas ou supérieur 394 Printf("ready to send\n");394 //Printf("ready to send\n"); 395 395 SendNRT(ptr->buf, ptr->actual_size,ptr->period); 396 396 //clean … … 615 615 if(bufSize!=0) bufSize+=sizeof(char)+sizeof(uint16_t)+sizeof(uint16_t);//header+period+nb_buffering 616 616 if(bufSize!=(*pushedDatasIterator).final_size && bufSize!=0) { 617 Printf("change buf size %i->%i\n",(*pushedDatasIterator).final_size,bufSize);617 //Printf("change buf size %i->%i\n",(*pushedDatasIterator).final_size,bufSize); 618 618 (*pushedDatasIterator).actual_size=0; 619 619 (*pushedDatasIterator).final_size=bufSize; … … 622 622 } 623 623 if(bufSize==0) { 624 Printf("delete buf\n");624 //Printf("delete buf\n"); 625 625 free((*pushedDatasIterator).buf); 626 626 pushedDatasIterator = pushedDatas.erase(pushedDatasIterator); … … 635 635 for (size_t i = 0; i < pushedDatas.size(); i++) { 636 636 if (pushedDatas.at(i).period==obj->SendPeriod() && pushedDatas.at(i).nb_buffering==obj->NbBuffering()) { 637 Printf("match item %i, period %i nb buff %i\n",i,obj->SendPeriod(),obj->NbBuffering());637 //Printf("match item %i, period %i nb buff %i\n",i,obj->SendPeriod(),obj->NbBuffering()); 638 638 match=true; 639 639 } … … 641 641 //create new one 642 642 if(!match) { 643 printf("no match\n");643 //printf("no match\n"); 644 644 PushedData_t tmp; 645 645 tmp.period=obj->SendPeriod(); … … 648 648 tmp.final_size=0; 649 649 for (size_t i = 0; i < datasToSend.size(); i++) { 650 Printf("data %i/%i %i %i\n",i,datasToSend.size(),datasToSend.at(i)->SendPeriod() ,datasToSend.at(i)->NbBuffering());650 //Printf("data %i/%i %i %i\n",i,datasToSend.size(),datasToSend.at(i)->SendPeriod() ,datasToSend.at(i)->NbBuffering()); 651 651 if (datasToSend.at(i)->IsEnabled() && datasToSend.at(i)->SendPeriod() == obj->SendPeriod() && datasToSend.at(i)->NbBuffering()==obj->NbBuffering()) { 652 652 tmp.final_size+=datasToSend.at(i)->SendSize(); 653 Printf("add %i\n",datasToSend.at(i)->SendSize());653 //Printf("add %i\n",datasToSend.at(i)->SendSize()); 654 654 } 655 655 } 656 656 tmp.final_size*=obj->NbBuffering(); 657 657 tmp.final_size+=sizeof(char)+sizeof(uint16_t)+sizeof(uint16_t);//header+period+nb_buffering 658 printf("final size %i\n",tmp.final_size);658 //printf("final size %i\n",tmp.final_size); 659 659 tmp.buf=(char*)malloc(tmp.final_size); 660 660 if(tmp.buf!=NULL) { … … 665 665 } 666 666 } 667 Printf("nb buf %i\n",pushedDatas.size());667 //Printf("nb buf %i\n",pushedDatas.size()); 668 668 return; 669 669 } … … 688 688 689 689 void ui_com::UpdateDataToSendBufferSize(const SendData *obj) { 690 if(!obj->IsEnabled()) return; 691 690 692 send_mutex->GetMutex(); 691 693 -
trunk/tools/FlairGCS/src/ConnectionLayout.cpp
r443 r444 60 60 break; 61 61 } 62 case MULTIPLE_DATA_BIG_ENDIAN: { 63 uint16_t period; 64 uint16_t nb_buffering; 65 memcpy(&period, buf+sizeof(char), sizeof(uint16_t)); 66 period = qFromBigEndian(period); 67 memcpy(&nb_buffering,buf+sizeof(char)+sizeof(uint16_t), sizeof(uint16_t)); 68 nb_buffering = qFromBigEndian(nb_buffering); 69 //fprintf(stderr,"recu %i, period %i, nb_buff %i\n",size,period,nb_buffering); 70 drawDatas(buf+sizeof(char)+sizeof(uint16_t)+sizeof(uint16_t), size - sizeof(char)+sizeof(uint16_t)+sizeof(uint16_t), period, nb_buffering,true); 71 break; 72 } 62 73 case MULTIPLE_DATA_LITTLE_ENDIAN: { 63 74 uint16_t period; … … 65 76 memcpy(&period, buf+sizeof(char), sizeof(uint16_t)); 66 77 memcpy(&nb_buffering,buf+sizeof(char)+sizeof(uint16_t), sizeof(uint16_t)); 67 fprintf(stderr,"recu %i, period %i, nb_buff %i\n",size,period,nb_buffering);78 //fprintf(stderr,"recu %i, period %i, nb_buff %i\n",size,period,nb_buffering); 68 79 drawDatas(buf+sizeof(char)+sizeof(uint16_t)+sizeof(uint16_t), size - sizeof(char)+sizeof(uint16_t)+sizeof(uint16_t), period, nb_buffering); 69 80 break; … … 118 129 for (int i = 0; i < nb_buffering; i++) { 119 130 for (int j = 0; j < dataremotes.count(); j++) { 120 dataremotes.at(j)->BufEvent(&buf, &buf_size, period, nb_buffering, 131 dataremotes.at(j)->BufEvent(&buf, &buf_size, period, nb_buffering,big_endian); 121 132 } 122 133 } -
trunk/tools/FlairGCS/src/DataPlot1D.cpp
r443 r444 76 76 } 77 77 78 void DataPlot1D::BufEvent(char **buf, int *buf_size, uint16_t period,uint16_t nb_buffering, 79 bool big_endian) { 78 void DataPlot1D::BufEvent(char **buf, int *buf_size, uint16_t period,uint16_t nb_buffering,bool big_endian) { 80 79 setEnabled(IsEnabled()); 81 if (IsEnabled() == false || RefreshRate_ms() != period ) return;80 if (IsEnabled() == false || RefreshRate_ms() != period || NbBuffering()!=nb_buffering) return; 82 81 double *datas = (double *)malloc(datas_type.count() * sizeof(double)); 83 82 -
trunk/tools/FlairGCS/src/DataPlot1D.h
r443 r444 21 21 void XmlEvent(QDomElement *dom); 22 22 bool eventFilter(QObject *, QEvent *); 23 void BufEvent(char **buf, int *buf_size, uint16_t period, 23 void BufEvent(char **buf, int *buf_size, uint16_t period,uint16_t nb_buffering,bool big_endian); 24 24 bool mouseEvent(QMouseEvent *event); 25 25 QList<QString> datas_type; -
trunk/tools/FlairGCS/src/DataPlot2D.cpp
r443 r444 251 251 } 252 252 253 void DataPlot2D::BufEvent(char **buf, int *buf_size, uint16_t period, 253 void DataPlot2D::BufEvent(char **buf, int *buf_size, uint16_t period,uint16_t nb_buffering,bool big_endian) { 254 254 255 if (IsEnabled() == false || RefreshRate_ms() != period) 256 return; 255 if (IsEnabled() == false || RefreshRate_ms() != period || NbBuffering()!=nb_buffering) return; 257 256 258 257 for (int i = 0; i < datas->count(); i++) { -
trunk/tools/FlairGCS/src/DataPlot2D.h
r443 r444 46 46 void setYAxisScale(float ymin, float ymax); 47 47 void setXAxisScale(float xmin, float xmax); 48 void BufEvent(char **buf, int *buf_size, uint16_t period,uint16_t nb_buffering, 48 void BufEvent(char **buf, int *buf_size, uint16_t period,uint16_t nb_buffering,bool big_endian); 49 49 void showCurve(QwtPlotItem *item, bool on); 50 50 -
trunk/tools/FlairGCS/src/DataRemote.cpp
r437 r444 87 87 } 88 88 89 uint16_t DataRemote::NbBuffering(void) { 90 return nb_buffering; 91 } 92 89 93 bool DataRemote::IsEnabled(void) { return auto_refresh; } 90 94 … … 107 111 } 108 112 109 int DataRemote::ReceiveSize(void) { return receivesize; }110 111 113 void DataRemote::XmlSetup(QDomElement *dom) { 112 114 refresh_rate = dom->attribute("period").toUShort() / 1000.; -
trunk/tools/FlairGCS/src/DataRemote.h
r443 r444 18 18 uint16_t period, uint16_t nb_buffering=1); 19 19 ~DataRemote(); 20 virtual void BufEvent(char **buf, int *buf_size, uint16_t period,uint16_t nb_buffering,bool big_endian) = 0; 21 22 protected: 23 int receivesize; 24 double refresh_rate; // en s 25 26 void XmlSetup(QDomElement *dom); 20 27 uint16_t RefreshRate_ms(void); 28 uint16_t NbBuffering(void); 21 29 bool IsEnabled(void); 22 int ReceiveSize(void);23 virtual void BufEvent(char **buf, int *buf_size, uint16_t period,uint16_t nb_buffering, bool big_endian) = 0;24 30 void appendmenu(QMenu *menu); 25 31 QAction *execmenu(QWidget *parent, QMenu *menu, QPoint point); 26 27 protected:28 bool auto_refresh;29 bool is_logging;30 double refresh_rate; // en s31 int receivesize;32 uint16_t nb_buffering;33 34 void XmlSetup(QDomElement *dom);35 32 36 33 private: 37 34 void SendPeriod(uint16_t period, bool auto_refresh); 38 35 void SendNbBuffering(uint16_t nb_buffering); 36 bool is_logging; 37 bool auto_refresh; 38 uint16_t nb_buffering; 39 39 QAction *SetAutoRefresh, *setRefreshRate,*setNbBuffering; 40 40 //QAction **log;//todo implement this feature (log directly in gcs, in case of uav program crash) -
trunk/tools/FlairGCS/src/Map.cpp
r443 r444 287 287 } 288 288 289 void Map::BufEvent(char **buf, int *buf_size, uint16_t period,uint16_t nb_buffering, 290 bool big_endian) { 291 if (IsEnabled() == false || RefreshRate_ms() != period) 292 return; 289 void Map::BufEvent(char **buf, int *buf_size, uint16_t period,uint16_t nb_buffering,bool big_endian) { 290 if (IsEnabled() == false || RefreshRate_ms() != period || NbBuffering()!=nb_buffering) return; 293 291 294 292 for (int i = 0; i < points.count(); i++) { -
trunk/tools/FlairGCS/src/Map.h
r443 r444 57 57 void Reset(void); 58 58 void XmlEvent(QDomElement *dom); 59 void BufEvent(char **buf, int *buf_size, uint16_t period,uint16_t nb_buffering, 59 void BufEvent(char **buf, int *buf_size, uint16_t period,uint16_t nb_buffering,bool big_endian); 60 60 61 61 void RemovePoints(void); -
trunk/tools/FlairGCS/src/Picture.cpp
r443 r444 45 45 Picture::~Picture() { delete layout; } 46 46 47 void Picture::BufEvent(char **buf, int *buf_size, uint16_t period,uint16_t nb_buffering, 48 bool big_endian) { 47 void Picture::BufEvent(char **buf, int *buf_size, uint16_t period,uint16_t nb_buffering,bool big_endian) { 49 48 if (big_endian) 50 49 fprintf(stderr,"Picture::BufEvent, big endian not handled\n"); 51 50 52 if (IsEnabled() == false || RefreshRate_ms() != period) 53 return; 51 if (IsEnabled() == false || RefreshRate_ms() != period || NbBuffering()!=nb_buffering) return; 54 52 55 53 if ((*buf_size) >= im_width * im_height) { … … 89 87 90 88 a = menu->addAction("get frame"); 91 a->setEnabled(! auto_refresh);89 a->setEnabled(!IsEnabled()); 92 90 93 91 appendmenu(menu); -
trunk/tools/FlairGCS/src/Picture.h
r443 r444 37 37 38 38 bool eventFilter(QObject *, QEvent *); 39 void BufEvent(char **buf, int *buf_size, uint16_t period,uint16_t nb_buffering, 39 void BufEvent(char **buf, int *buf_size, uint16_t period,uint16_t nb_buffering,bool big_endian); 40 40 void XmlEvent(QDomElement *dom); 41 41 }; -
trunk/tools/FlairGCS/src/RangeFinderPlot.cpp
r443 r444 148 148 } 149 149 150 void RangeFinderPlot::BufEvent(char **buf, int *buf_size, uint16_t period,uint16_t nb_buffering, 151 bool big_endian) { 150 void RangeFinderPlot::BufEvent(char **buf, int *buf_size, uint16_t period,uint16_t nb_buffering,bool big_endian) { 152 151 plot->setEnabled(IsEnabled()); 153 if (IsEnabled() == false || RefreshRate_ms() != period) 154 return; 152 if (IsEnabled() == false || RefreshRate_ms() != period || NbBuffering()!=nb_buffering) return; 155 153 156 154 for (uint32_t i = 0; i < nb_samples; i++) { -
trunk/tools/FlairGCS/src/RangeFinderPlot.h
r443 r444 44 44 45 45 bool eventFilter(QObject *, QEvent *); 46 void BufEvent(char **buf, int *buf_size, uint16_t period, 46 void BufEvent(char **buf, int *buf_size, uint16_t period,uint16_t nb_buffering,bool big_endian); 47 47 }; 48 48 -
trunk/tools/FlairGCS/src/UsSensorPlot.cpp
r443 r444 186 186 void UsSensorPlot::BufEvent(char **buf, int *buf_size, uint16_t period,uint16_t nb_buffering,bool big_endian) { 187 187 plot->setEnabled(IsEnabled()); 188 if (IsEnabled() == false || RefreshRate_ms() != period) 189 return; 188 if (IsEnabled() == false || RefreshRate_ms() != period || NbBuffering()!=nb_buffering) return; 190 189 191 190 measure_t measure; -
trunk/tools/FlairGCS/src/UsSensorPlot.h
r443 r444 57 57 void setYAxisScale(float ymin, float ymax); 58 58 void setXAxisScale(float xmin, float xmax); 59 void BufEvent(char **buf, int *buf_size, uint16_t period, 59 void BufEvent(char **buf, int *buf_size, uint16_t period,uint16_t nb_buffering,bool big_endian); 60 60 void plotMeasure(int index); 61 61
Note:
See TracChangeset
for help on using the changeset viewer.