Changeset 15 in flair-src for trunk/lib/FlairCore/src/SendData.cpp


Ignore:
Timestamp:
Apr 8, 2016, 3:40:57 PM (6 years ago)
Author:
Bayard Gildas
Message:

sources reformatted with flair-format-dir script

File:
1 edited

Legend:

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

    r2 r15  
    2626using namespace flair::core;
    2727
    28 namespace flair
    29 {
    30 namespace gui
    31 {
     28namespace flair {
     29namespace gui {
    3230
    33 SendData::SendData(const LayoutPosition* position,string name,string type,uint16_t default_periodms,bool default_enabled) :Widget(position->getLayout(),name,type) {
    34     pimpl_=new SendData_impl();
     31SendData::SendData(const LayoutPosition *position, string name, string type,
     32                   uint16_t default_periodms, bool default_enabled)
     33    : Widget(position->getLayout(), name, type) {
     34  pimpl_ = new SendData_impl();
    3535
    36     pimpl_->send_size=0;
     36  pimpl_->send_size = 0;
    3737
    38     //default refesh rate: (ms)
    39     pimpl_->send_period=default_periodms;
    40     pimpl_->is_enabled=default_enabled;
     38  // default refesh rate: (ms)
     39  pimpl_->send_period = default_periodms;
     40  pimpl_->is_enabled = default_enabled;
    4141
    42     SetVolatileXmlProp("row",position->Row());
    43     SetVolatileXmlProp("col",position->Col());
    44     GetPersistentXmlProp("period",pimpl_->send_period);
    45     SetPersistentXmlProp("period",pimpl_->send_period);
    46     GetPersistentXmlProp("enabled",pimpl_->is_enabled);
    47     SetPersistentXmlProp("enabled",pimpl_->is_enabled);
     42  SetVolatileXmlProp("row", position->Row());
     43  SetVolatileXmlProp("col", position->Col());
     44  GetPersistentXmlProp("period", pimpl_->send_period);
     45  SetPersistentXmlProp("period", pimpl_->send_period);
     46  GetPersistentXmlProp("enabled", pimpl_->is_enabled);
     47  SetPersistentXmlProp("enabled", pimpl_->is_enabled);
    4848
    49     delete position;
     49  delete position;
    5050
    51     if(getUiCom()!=NULL) {
    52         //register SendData for sending to ground station
    53         getUiCom()->AddSendData(this);
    54         //resume if necessary
    55         getUiCom()->UpdateSendData(this);
    56     }
     51  if (getUiCom() != NULL) {
     52    // register SendData for sending to ground station
     53    getUiCom()->AddSendData(this);
     54    // resume if necessary
     55    getUiCom()->UpdateSendData(this);
     56  }
    5757}
    5858
    5959SendData::~SendData() {
    60     if(getUiCom()!=NULL) {
    61         //unregister SendData for sending to ground station
    62         getUiCom()->RemoveSendData(this);
    63     }
     60  if (getUiCom() != NULL) {
     61    // unregister SendData for sending to ground station
     62    getUiCom()->RemoveSendData(this);
     63  }
    6464
    65     delete pimpl_;
     65  delete pimpl_;
    6666}
    6767
    6868void SendData::XmlEvent(void) {
    69     uint16_t send_period;
    70     bool is_enabled;
    71     bool something_changed=false;
     69  uint16_t send_period;
     70  bool is_enabled;
     71  bool something_changed = false;
    7272
    73     if(GetPersistentXmlProp("period",send_period) && GetPersistentXmlProp("enabled",is_enabled)) {
    74         if(send_period!=SendPeriod()) something_changed=true;
    75         if(is_enabled!=IsEnabled()) something_changed=true;
    76     }
     73  if (GetPersistentXmlProp("period", send_period) &&
     74      GetPersistentXmlProp("enabled", is_enabled)) {
     75    if (send_period != SendPeriod())
     76      something_changed = true;
     77    if (is_enabled != IsEnabled())
     78      something_changed = true;
     79  }
    7780
    78     if(something_changed) {
    79         getFrameworkManager()->BlockCom();
     81  if (something_changed) {
     82    getFrameworkManager()->BlockCom();
    8083
    81         SetSendPeriod(send_period);
    82         SetEnabled(is_enabled);
     84    SetSendPeriod(send_period);
     85    SetEnabled(is_enabled);
    8386
    84         getFrameworkManager()->UpdateSendData(this);
     87    getFrameworkManager()->UpdateSendData(this);
    8588
    86         //ack pour la station sol
    87         //period and enabled are already in persistent prop
    88         SetVolatileXmlProp("period",send_period);
    89         SetVolatileXmlProp("enabled",is_enabled);
    90         SendXml();
     89    // ack pour la station sol
     90    // period and enabled are already in persistent prop
     91    SetVolatileXmlProp("period", send_period);
     92    SetVolatileXmlProp("enabled", is_enabled);
     93    SendXml();
    9194
    92         getFrameworkManager()->UnBlockCom();
    93     }
     95    getFrameworkManager()->UnBlockCom();
     96  }
    9497
    95     ExtraXmlEvent();
     98  ExtraXmlEvent();
    9699}
    97100
    98 size_t SendData::SendSize(void) const {
    99     return pimpl_->send_size;
     101size_t SendData::SendSize(void) const { return pimpl_->send_size; }
     102
     103uint16_t SendData::SendPeriod(void) const { return pimpl_->send_period; }
     104
     105bool SendData::IsEnabled(void) const { return pimpl_->is_enabled; }
     106
     107void SendData::SetEnabled(bool value) { pimpl_->is_enabled = value; }
     108
     109void SendData::SetSendSize(size_t value) {
     110  pimpl_->send_size = value;
     111
     112  if (getUiCom() != NULL)
     113    getUiCom()->UpdateDataToSendSize();
    100114}
    101115
    102 uint16_t SendData::SendPeriod(void) const {
    103     return pimpl_->send_period;
    104 }
    105 
    106 bool SendData::IsEnabled(void) const {
    107     return pimpl_->is_enabled;
    108 }
    109 
    110 void SendData::SetEnabled(bool value) {
    111     pimpl_->is_enabled=value;
    112 }
    113 
    114 void SendData::SetSendSize(size_t value) {
    115     pimpl_->send_size=value;
    116 
    117     if(getUiCom()!=NULL) getUiCom()->UpdateDataToSendSize();
    118 }
    119 
    120 void SendData::SetSendPeriod(uint16_t value) {
    121     pimpl_->send_period=value;
    122 }
     116void SendData::SetSendPeriod(uint16_t value) { pimpl_->send_period = value; }
    123117
    124118} // end namespace core
Note: See TracChangeset for help on using the changeset viewer.