Changeset 440 in flair-src for trunk/lib/FlairCore/src/ui_com.cpp


Ignore:
Timestamp:
Aug 25, 2021, 4:41:21 PM (4 months ago)
Author:
Sanahuja Guillaume
Message:

up

File:
1 edited

Legend:

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

    r439 r440  
    319319      }
    320320
     321      //test to push datas
     322      for (size_t i = 0; i < data_to_send.size(); i++) {
     323        if (data_to_send.at(i)->SendPeriod() == resume_period && data_to_send.at(i)->IsEnabled() == true) {
     324          PushDatasToSend(data_to_send.at(i));
     325        }
     326      }
     327      //end test
     328     
    321329      // on planifie la prochaine execution
    322330      for (size_t i = 0; i < data_to_send.size(); i++) {
     
    344352  }
    345353}
     354
     355
     356//called with send_mutex locked
     357//in nrt
     358//TODO: RT part has to put datas in pipe, then useer thread call this
     359void ui_com::PushDatasToSend(const SendData *data_to_send) {
     360  PushedData_t* ptr=NULL;
     361  //check if we already have one buffer for this couple period/nb_buffering
     362  for (size_t i = 0; i < PushedDatas.size(); i++) {
     363      if (PushedDatas.at(i).period==data_to_send->SendPeriod() && PushedDatas.at(i).nb_buffering==data_to_send->NbBuffering()) {
     364          Printf("match item %i, period %i nb buff %i\n",i,data_to_send->SendPeriod(),data_to_send->NbBuffering());
     365          ptr=&PushedDatas.at(i);
     366        }
     367  }
     368  //otherwire create new one
     369  if(ptr==NULL) {
     370    printf("no match\n");
     371    PushedData_t tmp;
     372    tmp.period=data_to_send->SendPeriod();
     373    tmp.nb_buffering=data_to_send->NbBuffering();
     374    tmp.size=0;
     375    tmp.buf=NULL;
     376    PushedDatas.push_back(tmp);
     377    ptr=&PushedDatas.back();
     378  }
     379   
     380  ptr->buf=(char*)realloc(ptr->buf,ptr->size+data_to_send->SendSize());
     381 
     382  data_to_send->CopyDatas(ptr->buf+ptr->size);
     383  ptr->size+=data_to_send->SendSize();
     384  Printf("nb buffered %i\n",ptr->size);
     385//TODO: savoir quand a fait tous les nb buffers
     386  Printf("pushed size %i period %i nb buffering %i\n",data_to_send->SendSize(),data_to_send->SendPeriod(),data_to_send->NbBuffering());
     387}
     388
     389
    346390#ifdef __XENO__
    347391void *ui_com::user_thread(void *arg) {
Note: See TracChangeset for help on using the changeset viewer.