Changeset 443 in flair-src for trunk


Ignore:
Timestamp:
Sep 9, 2021, 5:06:34 PM (3 months ago)
Author:
Sanahuja Guillaume
Message:

update buffering (gcs part)

Location:
trunk
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/FlairCore/src/ui_com.cpp

    r442 r443  
    320320        // for(int i=0;i<offset;i++) printf("%x ",send_buffer[i]);
    321321        // printf("\n");
    322         Send(send_buffer, offset,resume_period);
     322        //Send(send_buffer, offset,resume_period);
    323323      }
    324324
     
    393393  if(ptr->actual_size>=ptr->final_size) {//par securité on test aussi le cas ou supérieur
    394394      Printf("ready to send\n");
     395      SendNRT(ptr->buf, ptr->actual_size,ptr->period);
    395396      //clean
    396397      ptr->actual_size=0;
  • trunk/tools/FlairGCS/src/ConnectionLayout.cpp

    r436 r443  
    4848  }
    4949  case DATA_BIG_ENDIAN: {
    50     // for(int i=0;i<size;i++) fprintf(stderr,"%x ",buf[i]);
    51     // fprintf(stderr,"\n");
    5250    uint16_t period;
    5351    memcpy(&period, &buf[1], sizeof(uint16_t));
    5452    period = qFromBigEndian(period);
    55     drawDatas(&buf[3], size - 3, period, true);
     53    drawDatas(&buf[3], size - 3, period, 1,true);
    5654    break;
    5755  }
    5856  case DATA_LITTLE_ENDIAN: {
    59     // for(int i=0;i<size;i++) fprintf(stderr,"%x ",buf[i]);
    60     // fprintf(stderr,"\n");
    6157    uint16_t period;
    6258    memcpy(&period, &buf[1], sizeof(uint16_t));
    63     // fprintf(stderr,"recu %i period %i\n",size,period);
    64     drawDatas(&buf[3], size - 3, period);
     59    drawDatas(&buf[3], size - 3, period,1);
     60    break;
     61  }
     62  case MULTIPLE_DATA_LITTLE_ENDIAN: {
     63    uint16_t period;
     64    uint16_t nb_buffering;
     65    memcpy(&period, buf+sizeof(char), sizeof(uint16_t));
     66    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);
     68    drawDatas(buf+sizeof(char)+sizeof(uint16_t)+sizeof(uint16_t), size - sizeof(char)+sizeof(uint16_t)+sizeof(uint16_t), period, nb_buffering);
    6569    break;
    6670  }
     
    111115QString ConnectionLayout::getName() { return name; }
    112116
    113 void ConnectionLayout::drawDatas(char *buf, int buf_size, uint16_t period,
    114                                  bool big_endian) {
    115   for (int i = 0; i < dataremotes.count(); i++) {
    116     dataremotes.at(i)->BufEvent(&buf, &buf_size, period, big_endian);
    117   }
     117void ConnectionLayout::drawDatas(char *buf, int buf_size, uint16_t period,uint16_t nb_buffering, bool big_endian) {
     118    for (int i = 0; i < nb_buffering; i++) {
     119        for (int j = 0; j < dataremotes.count(); j++) {
     120            dataremotes.at(j)->BufEvent(&buf, &buf_size, period, nb_buffering, big_endian);
     121        }
     122    }
    118123}
    119124
  • trunk/tools/FlairGCS/src/ConnectionLayout.h

    r436 r443  
    2727 
    2828private:
    29   void drawDatas(char *buf, int buf_size, uint16_t period,
     29  void drawDatas(char *buf, int buf_size, uint16_t period,uint16_t nb_buffering,
    3030                 bool big_endian = false);
    3131  QString name;
  • trunk/tools/FlairGCS/src/DataPlot1D.cpp

    r437 r443  
    7676}
    7777
    78 void DataPlot1D::BufEvent(char **buf, int *buf_size, uint16_t period,
     78void DataPlot1D::BufEvent(char **buf, int *buf_size, uint16_t period,uint16_t nb_buffering,
    7979                          bool big_endian) {
    8080  setEnabled(IsEnabled());
    81   if (IsEnabled() == false || RefreshRate_ms() != period)
    82     return;
     81  if (IsEnabled() == false || RefreshRate_ms() != period) return;
    8382  double *datas = (double *)malloc(datas_type.count() * sizeof(double));
    8483
     
    8988      memcpy((void *)&data_raw, *buf, sizeof(uint32_t));
    9089      *buf += sizeof(uint32_t);
    91       if (big_endian == true)
    92         data_raw = qFromBigEndian(data_raw);
     90      if (big_endian == true) data_raw = qFromBigEndian(data_raw);
    9391      datas[i] = *data;
    9492    } else if (datas_type.at(i) == "int8_t") {
     
    10199      memcpy((void *)&data, *buf, sizeof(data));
    102100      *buf += sizeof(data);
    103       if (big_endian == true)
    104         data = qFromBigEndian(data);
     101      if (big_endian == true) data = qFromBigEndian(data);
    105102      datas[i] = data;
    106103    } else {
    107       fprintf(stderr,"DataPlot1D::BufEvent unknown type %s\n",
    108              datas_type.at(i).toLocal8Bit().constData());
     104      fprintf(stderr,"DataPlot1D::BufEvent unknown type %s\n",datas_type.at(i).toLocal8Bit().constData());
    109105    }
    110106  }
  • trunk/tools/FlairGCS/src/DataPlot1D.h

    r437 r443  
    2121  void XmlEvent(QDomElement *dom);
    2222  bool eventFilter(QObject *, QEvent *);
    23   void BufEvent(char **buf, int *buf_size, uint16_t period, 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

    r437 r443  
    251251}
    252252
    253 void DataPlot2D::BufEvent(char **buf, int *buf_size, uint16_t period, bool big_endian) {
     253void DataPlot2D::BufEvent(char **buf, int *buf_size, uint16_t period, uint16_t nb_buffering,bool big_endian) {
    254254 
    255255  if (IsEnabled() == false || RefreshRate_ms() != period)
  • trunk/tools/FlairGCS/src/DataPlot2D.h

    r437 r443  
    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, 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.h

    r437 r443  
    2121  bool IsEnabled(void);
    2222  int ReceiveSize(void);
    23   virtual void BufEvent(char **buf, int *buf_size, uint16_t period,
    24                         bool big_endian) = 0;
     23  virtual void BufEvent(char **buf, int *buf_size, uint16_t period,uint16_t nb_buffering, bool big_endian) = 0;
    2524  void appendmenu(QMenu *menu);
    2625  QAction *execmenu(QWidget *parent, QMenu *menu, QPoint point);
  • trunk/tools/FlairGCS/src/Map.cpp

    r437 r443  
    287287}
    288288
    289 void Map::BufEvent(char **buf, int *buf_size, uint16_t period,
     289void Map::BufEvent(char **buf, int *buf_size, uint16_t period,uint16_t nb_buffering,
    290290                   bool big_endian) {
    291291  if (IsEnabled() == false || RefreshRate_ms() != period)
  • trunk/tools/FlairGCS/src/Map.h

    r437 r443  
    5757  void Reset(void);
    5858  void XmlEvent(QDomElement *dom);
    59   void BufEvent(char **buf, int *buf_size, uint16_t period, 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

    r437 r443  
    4545Picture::~Picture() { delete layout; }
    4646
    47 void Picture::BufEvent(char **buf, int *buf_size, uint16_t period,
     47void Picture::BufEvent(char **buf, int *buf_size, uint16_t period,uint16_t nb_buffering,
    4848                       bool big_endian) {
    4949  if (big_endian)
  • trunk/tools/FlairGCS/src/Picture.h

    r437 r443  
    3737
    3838  bool eventFilter(QObject *, QEvent *);
    39   void BufEvent(char **buf, int *buf_size, uint16_t period, 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

    r437 r443  
    148148}
    149149
    150 void RangeFinderPlot::BufEvent(char **buf, int *buf_size, uint16_t period,
     150void RangeFinderPlot::BufEvent(char **buf, int *buf_size, uint16_t period,uint16_t nb_buffering,
    151151                               bool big_endian) {
    152152  plot->setEnabled(IsEnabled());
  • trunk/tools/FlairGCS/src/RangeFinderPlot.h

    r437 r443  
    4444
    4545  bool eventFilter(QObject *, QEvent *);
    46   void BufEvent(char **buf, int *buf_size, uint16_t period, 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/UdtSocket.cpp

    r399 r443  
    225225            case DATA_BIG_ENDIAN:
    226226            case DATA_LITTLE_ENDIAN:
    227               emit dataReady(buf, size );
     227            case MULTIPLE_DATA_BIG_ENDIAN:
     228            case MULTIPLE_DATA_LITTLE_ENDIAN:
     229              emit dataReady(buf, size);
    228230              break;
    229231            case CLOSING_CONNECTION:
  • trunk/tools/FlairGCS/src/UsSensorPlot.cpp

    r437 r443  
    184184}
    185185
    186 void UsSensorPlot::BufEvent(char **buf, int *buf_size, uint16_t period,bool big_endian) {
     186void UsSensorPlot::BufEvent(char **buf, int *buf_size, uint16_t period,uint16_t nb_buffering,bool big_endian) {
    187187  plot->setEnabled(IsEnabled());
    188188  if (IsEnabled() == false || RefreshRate_ms() != period)
  • trunk/tools/FlairGCS/src/UsSensorPlot.h

    r437 r443  
    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, 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.