Changeset 444 in flair-src for trunk/tools


Ignore:
Timestamp:
Sep 10, 2021, 2:37:55 PM (3 years ago)
Author:
Sanahuja Guillaume
Message:

update buffering (gcs part)
seems to work!

Location:
trunk/tools/FlairGCS/src
Files:
15 edited

Legend:

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

    r443 r444  
    6060    break;
    6161  }
     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  }
    6273  case MULTIPLE_DATA_LITTLE_ENDIAN: {
    6374    uint16_t period;
     
    6576    memcpy(&period, buf+sizeof(char), sizeof(uint16_t));
    6677    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);
    6879    drawDatas(buf+sizeof(char)+sizeof(uint16_t)+sizeof(uint16_t), size - sizeof(char)+sizeof(uint16_t)+sizeof(uint16_t), period, nb_buffering);
    6980    break;
     
    118129    for (int i = 0; i < nb_buffering; i++) {
    119130        for (int j = 0; j < dataremotes.count(); j++) {
    120             dataremotes.at(j)->BufEvent(&buf, &buf_size, period, nb_buffering, big_endian);
     131            dataremotes.at(j)->BufEvent(&buf, &buf_size, period, nb_buffering,big_endian);
    121132        }
    122133    }
  • trunk/tools/FlairGCS/src/DataPlot1D.cpp

    r443 r444  
    7676}
    7777
    78 void DataPlot1D::BufEvent(char **buf, int *buf_size, uint16_t period,uint16_t nb_buffering,
    79                           bool big_endian) {
     78void DataPlot1D::BufEvent(char **buf, int *buf_size, uint16_t period,uint16_t nb_buffering,bool big_endian) {
    8079  setEnabled(IsEnabled());
    81   if (IsEnabled() == false || RefreshRate_ms() != period) return;
     80  if (IsEnabled() == false || RefreshRate_ms() != period || NbBuffering()!=nb_buffering) return;
    8281  double *datas = (double *)malloc(datas_type.count() * sizeof(double));
    8382
  • trunk/tools/FlairGCS/src/DataPlot1D.h

    r443 r444  
    2121  void XmlEvent(QDomElement *dom);
    2222  bool eventFilter(QObject *, QEvent *);
    23   void BufEvent(char **buf, int *buf_size, uint16_t period, uint16_t nb_buffering,bool big_endian);
     23  void BufEvent(char **buf, int *buf_size, uint16_t period,uint16_t nb_buffering,bool big_endian);
    2424  bool mouseEvent(QMouseEvent *event);
    2525  QList<QString> datas_type;
  • trunk/tools/FlairGCS/src/DataPlot2D.cpp

    r443 r444  
    251251}
    252252
    253 void DataPlot2D::BufEvent(char **buf, int *buf_size, uint16_t period, uint16_t nb_buffering,bool big_endian) {
     253void DataPlot2D::BufEvent(char **buf, int *buf_size, uint16_t period,uint16_t nb_buffering,bool big_endian) {
    254254 
    255   if (IsEnabled() == false || RefreshRate_ms() != period)
    256     return;
     255  if (IsEnabled() == false || RefreshRate_ms() != period || NbBuffering()!=nb_buffering) return;
    257256
    258257  for (int i = 0; i < datas->count(); i++) {
  • trunk/tools/FlairGCS/src/DataPlot2D.h

    r443 r444  
    4646  void setYAxisScale(float ymin, float ymax);
    4747  void setXAxisScale(float xmin, float xmax);
    48   void BufEvent(char **buf, int *buf_size, uint16_t period,uint16_t nb_buffering, bool big_endian);
     48  void BufEvent(char **buf, int *buf_size, uint16_t period,uint16_t nb_buffering,bool big_endian);
    4949  void showCurve(QwtPlotItem *item, bool on);
    5050
  • trunk/tools/FlairGCS/src/DataRemote.cpp

    r437 r444  
    8787}
    8888
     89uint16_t DataRemote::NbBuffering(void) {
     90   return nb_buffering;
     91}
     92
    8993bool DataRemote::IsEnabled(void) { return auto_refresh; }
    9094
     
    107111}
    108112
    109 int DataRemote::ReceiveSize(void) { return receivesize; }
    110 
    111113void DataRemote::XmlSetup(QDomElement *dom) {
    112114  refresh_rate = dom->attribute("period").toUShort() / 1000.;
  • trunk/tools/FlairGCS/src/DataRemote.h

    r443 r444  
    1818             uint16_t period, uint16_t nb_buffering=1);
    1919  ~DataRemote();
     20  virtual void BufEvent(char **buf, int *buf_size, uint16_t period,uint16_t nb_buffering,bool big_endian) = 0;
     21
     22protected:
     23  int receivesize;
     24  double refresh_rate; // en s
     25 
     26  void XmlSetup(QDomElement *dom);
    2027  uint16_t RefreshRate_ms(void);
     28  uint16_t NbBuffering(void);
    2129  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;
    2430  void appendmenu(QMenu *menu);
    2531  QAction *execmenu(QWidget *parent, QMenu *menu, QPoint point);
    26 
    27 protected:
    28   bool auto_refresh;
    29   bool is_logging;
    30   double refresh_rate; // en s
    31   int receivesize;
    32   uint16_t nb_buffering;
    33 
    34   void XmlSetup(QDomElement *dom);
    3532
    3633private:
    3734  void SendPeriod(uint16_t period, bool auto_refresh);
    3835  void SendNbBuffering(uint16_t nb_buffering);
     36  bool is_logging;
     37  bool auto_refresh;
     38  uint16_t nb_buffering;
    3939  QAction *SetAutoRefresh, *setRefreshRate,*setNbBuffering;
    4040  //QAction **log;//todo implement this feature (log directly in gcs, in case of uav program crash)
  • trunk/tools/FlairGCS/src/Map.cpp

    r443 r444  
    287287}
    288288
    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;
     289void 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;
    293291
    294292  for (int i = 0; i < points.count(); i++) {
  • trunk/tools/FlairGCS/src/Map.h

    r443 r444  
    5757  void Reset(void);
    5858  void XmlEvent(QDomElement *dom);
    59   void BufEvent(char **buf, int *buf_size, uint16_t period,uint16_t nb_buffering, bool big_endian);
     59  void BufEvent(char **buf, int *buf_size, uint16_t period,uint16_t nb_buffering,bool big_endian);
    6060
    6161  void RemovePoints(void);
  • trunk/tools/FlairGCS/src/Picture.cpp

    r443 r444  
    4545Picture::~Picture() { delete layout; }
    4646
    47 void Picture::BufEvent(char **buf, int *buf_size, uint16_t period,uint16_t nb_buffering,
    48                        bool big_endian) {
     47void Picture::BufEvent(char **buf, int *buf_size, uint16_t period,uint16_t nb_buffering,bool big_endian) {
    4948  if (big_endian)
    5049    fprintf(stderr,"Picture::BufEvent, big endian not handled\n");
    5150
    52   if (IsEnabled() == false || RefreshRate_ms() != period)
    53     return;
     51  if (IsEnabled() == false || RefreshRate_ms() != period || NbBuffering()!=nb_buffering) return;
    5452
    5553  if ((*buf_size) >= im_width * im_height) {
     
    8987
    9088    a = menu->addAction("get frame");
    91     a->setEnabled(!auto_refresh);
     89    a->setEnabled(!IsEnabled());
    9290
    9391    appendmenu(menu);
  • trunk/tools/FlairGCS/src/Picture.h

    r443 r444  
    3737
    3838  bool eventFilter(QObject *, QEvent *);
    39   void BufEvent(char **buf, int *buf_size, uint16_t period,uint16_t nb_buffering, bool big_endian);
     39  void BufEvent(char **buf, int *buf_size, uint16_t period,uint16_t nb_buffering,bool big_endian);
    4040  void XmlEvent(QDomElement *dom);
    4141};
  • trunk/tools/FlairGCS/src/RangeFinderPlot.cpp

    r443 r444  
    148148}
    149149
    150 void RangeFinderPlot::BufEvent(char **buf, int *buf_size, uint16_t period,uint16_t nb_buffering,
    151                                bool big_endian) {
     150void RangeFinderPlot::BufEvent(char **buf, int *buf_size, uint16_t period,uint16_t nb_buffering,bool big_endian) {
    152151  plot->setEnabled(IsEnabled());
    153   if (IsEnabled() == false || RefreshRate_ms() != period)
    154     return;
     152 if (IsEnabled() == false || RefreshRate_ms() != period || NbBuffering()!=nb_buffering) return;
    155153
    156154  for (uint32_t i = 0; i < nb_samples; i++) {
  • trunk/tools/FlairGCS/src/RangeFinderPlot.h

    r443 r444  
    4444
    4545  bool eventFilter(QObject *, QEvent *);
    46   void BufEvent(char **buf, int *buf_size, uint16_t period, uint16_t nb_buffering,bool big_endian);
     46  void BufEvent(char **buf, int *buf_size, uint16_t period,uint16_t nb_buffering,bool big_endian);
    4747};
    4848
  • trunk/tools/FlairGCS/src/UsSensorPlot.cpp

    r443 r444  
    186186void UsSensorPlot::BufEvent(char **buf, int *buf_size, uint16_t period,uint16_t nb_buffering,bool big_endian) {
    187187  plot->setEnabled(IsEnabled());
    188   if (IsEnabled() == false || RefreshRate_ms() != period)
    189     return;
     188  if (IsEnabled() == false || RefreshRate_ms() != period || NbBuffering()!=nb_buffering) return;
    190189   
    191190  measure_t measure;
  • trunk/tools/FlairGCS/src/UsSensorPlot.h

    r443 r444  
    5757  void setYAxisScale(float ymin, float ymax);
    5858  void setXAxisScale(float xmin, float xmax);
    59   void BufEvent(char **buf, int *buf_size, uint16_t period, uint16_t nb_buffering,bool big_endian);
     59  void BufEvent(char **buf, int *buf_size, uint16_t period,uint16_t nb_buffering,bool big_endian);
    6060  void plotMeasure(int index);
    6161 
Note: See TracChangeset for help on using the changeset viewer.