- Timestamp:
- Aug 24, 2021, 5:33:19 PM (3 years ago)
- Location:
- trunk
- Files:
-
- 28 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/FlairCore/src/DoubleSpinBox.cpp
r15 r437 24 24 25 25 DoubleSpinBox::DoubleSpinBox(const LayoutPosition *position, string name, 26 double min, double max, double step, int decimals,26 double min, double max, double step, uint16_t decimals, 27 27 double default_value) 28 28 : Box(position, name, "DoubleSpinBox") { … … 46 46 DoubleSpinBox::DoubleSpinBox(const LayoutPosition *position, string name, 47 47 string suffix, double min, double max, double step, 48 int decimals, double default_value)48 uint16_t decimals, double default_value) 49 49 : Box(position, name, "DoubleSpinBox") { 50 50 // update value from xml file -
trunk/lib/FlairCore/src/DoubleSpinBox.h
r15 r437 43 43 */ 44 44 DoubleSpinBox(const LayoutPosition *position, std::string name, double min, 45 double max, double step, int decimals = 2,45 double max, double step, uint16_t decimals = 2, 46 46 double default_value = 0); 47 47 … … 63 63 DoubleSpinBox(const LayoutPosition *position, std::string name, 64 64 std::string suffix, double min, double max, double step, 65 int decimals = 2, double default_value = 0);65 uint16_t decimals = 2, double default_value = 0); 66 66 67 67 /*! -
trunk/lib/FlairCore/src/SendData.cpp
r15 r437 30 30 31 31 SendData::SendData(const LayoutPosition *position, string name, string type, 32 uint16_t default_periodms, bool default_enabled )32 uint16_t default_periodms, bool default_enabled, uint16_t default_nb_buffering) 33 33 : Widget(position->getLayout(), name, type) { 34 34 pimpl_ = new SendData_impl(); … … 39 39 pimpl_->send_period = default_periodms; 40 40 pimpl_->is_enabled = default_enabled; 41 pimpl_->nb_buffering = default_nb_buffering; 41 42 42 43 SetVolatileXmlProp("row", position->Row()); … … 46 47 GetPersistentXmlProp("enabled", pimpl_->is_enabled); 47 48 SetPersistentXmlProp("enabled", pimpl_->is_enabled); 49 GetPersistentXmlProp("nb_buf", pimpl_->nb_buffering); 50 SetPersistentXmlProp("nb_buf", pimpl_->nb_buffering); 48 51 49 52 delete position; … … 67 70 68 71 void SendData::XmlEvent(void) { 69 uint16_t send_period ;72 uint16_t send_period,nb_buffering; 70 73 bool is_enabled; 71 74 bool something_changed = false; 72 75 73 if (GetPersistentXmlProp("period", send_period) && 74 GetPersistentXmlProp("enabled", is_enabled)) { 76 if (GetPersistentXmlProp("period", send_period) && GetPersistentXmlProp("enabled", is_enabled) && GetPersistentXmlProp("nb_buf", nb_buffering)) { 75 77 if (send_period != SendPeriod()) 76 78 something_changed = true; 77 79 if (is_enabled != IsEnabled()) 80 something_changed = true; 81 } 82 83 if (GetPersistentXmlProp("nb_buf", nb_buffering)) { 84 if (nb_buffering != NbBuffering()) 78 85 something_changed = true; 79 86 } … … 84 91 SetSendPeriod(send_period); 85 92 SetEnabled(is_enabled); 93 SetNbBuffering(nb_buffering); 86 94 87 95 getFrameworkManager()->UpdateSendData(this); … … 91 99 SetVolatileXmlProp("period", send_period); 92 100 SetVolatileXmlProp("enabled", is_enabled); 101 SetVolatileXmlProp("nb_buf", nb_buffering); 93 102 SendXml(); 94 103 … … 102 111 103 112 uint16_t SendData::SendPeriod(void) const { return pimpl_->send_period; } 113 114 uint16_t SendData::NbBuffering(void) const { return pimpl_->nb_buffering; } 104 115 105 116 bool SendData::IsEnabled(void) const { return pimpl_->is_enabled; } … … 116 127 void SendData::SetSendPeriod(uint16_t value) { pimpl_->send_period = value; } 117 128 129 void SendData::SetNbBuffering(uint16_t value) { pimpl_->nb_buffering = value; } 130 118 131 } // end namespace core 119 132 } // end namespace flair -
trunk/lib/FlairCore/src/SendData.h
r15 r437 34 34 */ 35 35 SendData(const LayoutPosition *position, std::string name, std::string type, 36 uint16_t default_periodms = 100, bool default_enabled = false );36 uint16_t default_periodms = 100, bool default_enabled = false, uint16_t default_nb_buffering=1); 37 37 38 38 /*! … … 54 54 uint16_t SendPeriod(void) const; // in ms 55 55 bool IsEnabled(void) const; 56 uint16_t NbBuffering(void) const; 56 57 57 58 protected: … … 88 89 89 90 void SetSendPeriod(uint16_t value); 91 void SetNbBuffering(uint16_t value); 90 92 void SetEnabled(bool value); 91 93 -
trunk/lib/FlairCore/src/Vector3DSpinBox.cpp
r167 r437 26 26 Vector3DSpinBox::Vector3DSpinBox(const LayoutPosition *position, string name, 27 27 double min, double max, double step, 28 int decimals, core::Vector3Df default_value)28 uint16_t decimals, core::Vector3Df default_value) 29 29 : Box(position, name, "Vector3DSpinBox") { 30 30 // update value from xml file -
trunk/lib/FlairCore/src/Vector3DSpinBox.h
r199 r437 43 43 */ 44 44 Vector3DSpinBox(const LayoutPosition *position, std::string name, double min, 45 double max, double step, int decimals = 2,45 double max, double step, uint16_t decimals = 2, 46 46 core::Vector3Df default_value = core::Vector3Df(0, 0, 0)); 47 47 -
trunk/lib/FlairCore/src/unexported/SendData_impl.h
r15 r437 30 30 size_t send_size; 31 31 uint16_t send_period; 32 uint16_t nb_buffering; 32 33 }; 33 34 -
trunk/tools/FlairGCS/src/ComboBox.cpp
r269 r437 8 8 #include <QFormLayout> 9 9 10 ComboBox::ComboBox(Layout *parent, int row, int col, QString name, int value)10 ComboBox::ComboBox(Layout *parent, int row, int col, QString name, uint16_t value) 11 11 : FormLayout(parent, row, col, name, "ComboBox") { 12 12 combobox = new QComboBox(); -
trunk/tools/FlairGCS/src/ComboBox.h
r269 r437 15 15 16 16 public: 17 ComboBox(Layout *parent, int row, int col, QString name, int value);17 ComboBox(Layout *parent, int row, int col, QString name, uint16_t value); 18 18 ~ComboBox(); 19 19 20 20 private: 21 21 QComboBox *combobox; 22 int combobox_value;22 uint16_t combobox_value; 23 23 void XmlEvent(QDomElement *dom); 24 24 void SetUptodate(void); -
trunk/tools/FlairGCS/src/DataPlot1D.cpp
r436 r437 13 13 14 14 DataPlot1D::DataPlot1D(Layout *parent, int row, int col, QString title, 15 float ymin, float ymax, bool enabled, int period)15 float ymin, float ymax, bool enabled, uint16_t period, uint16_t nb_buffering) 16 16 : ScopeFixedStep(title, ymin, ymax, period / 1000.), 17 DataRemote(title, "DataPlot1D", parent, enabled, period ) {17 DataRemote(title, "DataPlot1D", parent, enabled, period, nb_buffering) { 18 18 19 19 setEnabled(enabled); -
trunk/tools/FlairGCS/src/DataPlot1D.h
r269 r437 15 15 public: 16 16 DataPlot1D(Layout *parent, int row, int col, QString title, float ymin, 17 float ymax, bool enabled, int period);17 float ymax, bool enabled, uint16_t period, uint16_t nb_buffering=1); 18 18 ~DataPlot1D(); 19 19 -
trunk/tools/FlairGCS/src/DataPlot2D.cpp
r269 r437 22 22 DataPlot2D::DataPlot2D(Layout *parent, int row, int col, QString plot_name, 23 23 QString x_name, QString y_name, float xmin, float xmax, 24 float ymin, float ymax, bool enabled, int period)25 : DataRemote(plot_name, "DataPlot2D", parent, enabled, period ) {24 float ymin, float ymax, bool enabled, uint16_t period, uint16_t nb_buffering) 25 : DataRemote(plot_name, "DataPlot2D", parent, enabled, period, nb_buffering) { 26 26 plot = new QwtPlot(NULL); 27 27 plot->setEnabled(enabled); -
trunk/tools/FlairGCS/src/DataPlot2D.h
r269 r437 22 22 DataPlot2D(Layout *parent, int row, int col, QString plot_name, 23 23 QString x_name, QString y_name, float xmin, float xmax, float ymin, 24 float ymax, bool enabled, int period);24 float ymax, bool enabled, uint16_t period, uint16_t nb_buffering=1); 25 25 ~DataPlot2D(); 26 26 void addCurve(QPen pen, QString legend, QString type); -
trunk/tools/FlairGCS/src/DataRemote.cpp
r436 r437 10 10 11 11 DataRemote::DataRemote(QString name, QString type, XmlWidget *parent, 12 bool enabled, int period)12 bool enabled, uint16_t period, uint16_t nb_buffering) 13 13 : XmlWidget(name, type, parent) { 14 14 auto_refresh = enabled; … … 16 16 receivesize = 0; 17 17 refresh_rate = (double)period / 1000.; 18 18 this->nb_buffering=nb_buffering; 19 19 20 connectionLayout()->addDataRemote(this); 20 21 … … 28 29 menu->addSeparator(); 29 30 30 autoRefresh = menu->addAction("auto refresh");31 autoRefresh->setCheckable(true);32 autoRefresh->setChecked(auto_refresh);31 SetAutoRefresh = menu->addAction("auto refresh"); 32 SetAutoRefresh->setCheckable(true); 33 SetAutoRefresh->setChecked(auto_refresh); 33 34 34 35 setRefreshRate = menu->addAction(QString("set refresh rate (%1ms)") 35 36 .arg((uint16_t)(qRound(refresh_rate * 1000)))); 36 37 setRefreshRate->setEnabled(auto_refresh); 38 39 menu->addSeparator(); 40 setNbBuffering = menu->addAction(QString("set nb buffering (%1)").arg(nb_buffering)); 41 37 42 /* menu->addSeparator(); 38 43 … … 48 53 action = menu->exec(point); 49 54 50 if (action == autoRefresh) {51 SendPeriod(RefreshRate_ms(), autoRefresh->isChecked());55 if (action == SetAutoRefresh) { 56 SendPeriod(RefreshRate_ms(), SetAutoRefresh->isChecked()); 52 57 } 53 58 … … 58 63 parent, "Set refresh rate ", "Value (ms):", 59 64 (uint16_t)(qRound(refresh_rate * 1000)), 1, 65535, 10, &ok); 60 if (ok == true&& time != qRound(refresh_rate * 1000)) {65 if (ok && time != qRound(refresh_rate * 1000)) { 61 66 // refresh_rate=time/1000.; 62 SendPeriod(time, autoRefresh->isChecked()); 67 SendPeriod(time, SetAutoRefresh->isChecked()); 68 } 69 } 70 71 if (action == setNbBuffering) { 72 bool ok; 73 74 uint16_t nb_buffering = QInputDialog::getInt( 75 parent, "Set nb buffering ", "Value :", 76 this->nb_buffering, 1, 65535, 10, &ok); 77 if (ok && nb_buffering !=this->nb_buffering) { 78 SendNbBuffering(nb_buffering); 63 79 } 64 80 } … … 73 89 bool DataRemote::IsEnabled(void) { return auto_refresh; } 74 90 75 void DataRemote::SendPeriod( int period, bool auto_refresh) {91 void DataRemote::SendPeriod(uint16_t period, bool auto_refresh) { 76 92 RemoveAllAttributes(); 77 93 … … 83 99 } 84 100 101 void DataRemote::SendNbBuffering(uint16_t nb_buffering) { 102 RemoveAllAttributes(); 103 104 SetAttribute("nb_buf", nb_buffering); 105 connectionLayout()->XmlToSend(XmlDoc()); 106 RemoveAttribute("nb_buf"); 107 } 108 85 109 int DataRemote::ReceiveSize(void) { return receivesize; } 86 110 87 111 void DataRemote::XmlSetup(QDomElement *dom) { 88 refresh_rate = dom->attribute("period").toInt() / 1000.; 112 refresh_rate = dom->attribute("period").toUShort() / 1000.; 113 nb_buffering = dom->attribute("nb_buf").toUShort(); 89 114 if (dom->attribute("enabled") == "1") 90 115 auto_refresh = true; -
trunk/tools/FlairGCS/src/DataRemote.h
r269 r437 16 16 public: 17 17 DataRemote(QString name, QString type, XmlWidget *parent, bool enabled, 18 int period);18 uint16_t period, uint16_t nb_buffering=1); 19 19 ~DataRemote(); 20 20 uint16_t RefreshRate_ms(void); … … 31 31 double refresh_rate; // en s 32 32 int receivesize; 33 uint16_t nb_buffering; 33 34 34 35 void XmlSetup(QDomElement *dom); 35 36 36 37 private: 37 void SendPeriod(int period, bool auto_refresh); 38 QAction *autoRefresh, *setRefreshRate; 38 void SendPeriod(uint16_t period, bool auto_refresh); 39 void SendNbBuffering(uint16_t nb_buffering); 40 QAction *SetAutoRefresh, *setRefreshRate,*setNbBuffering; 39 41 //QAction **log;//todo implement this feature (log directly in gcs, in case of uav program crash) 40 42 }; -
trunk/tools/FlairGCS/src/DoubleSpinBox.cpp
r269 r437 13 13 DoubleSpinBox::DoubleSpinBox(Layout *parent, int row, int col, QString name, 14 14 QString suffix, QString value, float min, 15 float max, float step, int decimals)15 float max, float step, uint16_t decimals) 16 16 : FormLayout(parent, row, col, name, "DoubleSpinBox") { 17 17 doublespinbox = new QDoubleSpinBox(); -
trunk/tools/FlairGCS/src/DoubleSpinBox.h
r269 r437 17 17 // handle value as string, becouse double value are not exact 18 18 DoubleSpinBox(Layout *parent, int row, int col, QString name, QString suffix, 19 QString value, float min, float max, float step, int decimals);19 QString value, float min, float max, float step, uint16_t decimals); 20 20 ~DoubleSpinBox(); 21 21 -
trunk/tools/FlairGCS/src/Layout.cpp
r269 r437 127 127 double max = dom->attribute("max").toDouble(); 128 128 double step = dom->attribute("step").toDouble(); 129 int decimals = dom->attribute("decimals").toInt();129 uint16_t decimals = dom->attribute("decimals").toUShort(); 130 130 widget = new DoubleSpinBox(this, row, col, name, suffix, value, min, max, 131 131 step, decimals); … … 139 139 double max = dom->attribute("max").toDouble(); 140 140 double step = dom->attribute("step").toDouble(); 141 int decimals = dom->attribute("decimals").toInt();141 uint16_t decimals = dom->attribute("decimals").toUShort(); 142 142 widget = new Vector3DSpinBox(this, row, col, name, value, min, max, step, 143 143 decimals); … … 148 148 } 149 149 if (type == "ComboBox") { 150 int value = dom->attribute("value").toInt();150 uint16_t value = dom->attribute("value").toUShort(); 151 151 widget = new ComboBox(this, row, col, name, value); 152 152 } … … 158 158 float ymax = dom->attribute("max").toFloat(); 159 159 int enabled = dom->attribute("enabled").toInt(); 160 int period = dom->attribute("period").toInt(); 161 if (enabled == 1) { 162 widget = new DataPlot1D(this, row, col, name, ymin, ymax, true, period); 163 } else { 164 widget = new DataPlot1D(this, row, col, name, ymin, ymax, false, 100); 160 uint16_t period = dom->attribute("period").toUShort(); 161 uint16_t nb_buffering = dom->attribute("nb_buf").toUShort(); 162 if (enabled == 1) { 163 widget = new DataPlot1D(this, row, col, name, ymin, ymax, true, period,nb_buffering); 164 } else { 165 widget = new DataPlot1D(this, row, col, name, ymin, ymax, false, 100,nb_buffering); 165 166 } 166 167 } … … 173 174 QString y_name = dom->attribute("y_name"); 174 175 int enabled = dom->attribute("enabled").toInt(); 175 int period = dom->attribute("period").toInt(); 176 uint16_t period = dom->attribute("period").toUShort(); 177 uint16_t nb_buffering = dom->attribute("nb_buf").toUShort(); 176 178 if (enabled == 1) { 177 179 widget = new DataPlot2D(this, row, col, name, x_name, y_name, xmin, xmax, 178 ymin, ymax, true, period );180 ymin, ymax, true, period,nb_buffering); 179 181 } else { 180 182 widget = new DataPlot2D(this, row, col, name, x_name, y_name, xmin, xmax, 181 ymin, ymax, false, 100 );183 ymin, ymax, false, 100,nb_buffering); 182 184 } 183 185 } … … 187 189 QString y_name = dom->attribute("y_name"); 188 190 int enabled = dom->attribute("enabled").toInt(); 189 int period = dom->attribute("period").toInt();191 uint16_t period = dom->attribute("period").toUShort(); 190 192 QString type = dom->attribute("type"); 191 193 int samples = dom->attribute("samples").toInt(); … … 210 212 uint32_t nb_samples = dom->attribute("nb_samples").toUInt(); 211 213 int enabled = dom->attribute("enabled").toInt(); 212 int period = dom->attribute("period").toInt();214 uint16_t period = dom->attribute("period").toUShort(); 213 215 int invert_axis = dom->attribute("invert_axis").toInt(); 214 216 bool invert_axis_bool; … … 234 236 int height = dom->attribute("height").toInt(); 235 237 int enabled = dom->attribute("enabled").toInt(); 236 int period = dom->attribute("period").toInt();238 uint16_t period = dom->attribute("period").toUShort(); 237 239 if (enabled == 1) { 238 240 widget = new Picture(this, row, col, name, width, height, true, period); … … 242 244 } 243 245 if (type == "Map") { 244 int period = dom->attribute("period").toInt();246 uint16_t period = dom->attribute("period").toUShort(); 245 247 int enabled = dom->attribute("enabled").toInt(); 246 248 int i = 0; -
trunk/tools/FlairGCS/src/Map.cpp
r269 r437 24 24 25 25 Map::Map(Layout *parent, int row, int col, QString name, 26 QList<QGeoCoordinate> coordinates, bool enabled, int period)26 QList<QGeoCoordinate> coordinates, bool enabled, uint16_t period) 27 27 : DataRemote(name, "Map", parent, enabled, period) { 28 28 visible_widget = new QWidget(); -
trunk/tools/FlairGCS/src/Map.h
r269 r437 30 30 public: 31 31 Map(Layout *parent, int row, int col, QString name, 32 QList<QtMobility::QGeoCoordinate> coordinates, bool enabled, int period);32 QList<QtMobility::QGeoCoordinate> coordinates, bool enabled, uint16_t period); 33 33 ~Map(); 34 34 void setCenteredPoint(int i); -
trunk/tools/FlairGCS/src/Picture.cpp
r269 r437 13 13 14 14 Picture::Picture(Layout *parent, int row, int col, QString name, uint16_t width, 15 uint16_t height, bool enabled, int period)15 uint16_t height, bool enabled, uint16_t period) 16 16 : DataRemote(name, "Picture", parent, enabled, period) { 17 17 box = new QGroupBox(name); -
trunk/tools/FlairGCS/src/Picture.h
r269 r437 22 22 public: 23 23 Picture(Layout *parent, int row, int col, QString name, uint16_t width, 24 uint16_t height, bool enabled, int period);24 uint16_t height, bool enabled, uint16_t period); 25 25 ~Picture(); 26 26 -
trunk/tools/FlairGCS/src/RangeFinderPlot.cpp
r269 r437 23 23 float start_angle, float end_angle, 24 24 uint32_t nb_samples, QString data_type, 25 bool invert_axis, bool enabled, int period)25 bool invert_axis, bool enabled, uint16_t period) 26 26 : DataRemote(name, "RangeFinderPlot", parent, enabled, period) { 27 27 invert_axis = true; -
trunk/tools/FlairGCS/src/RangeFinderPlot.h
r269 r437 22 22 float ymin, float ymax, float start_angle, float end_angle, 23 23 uint32_t nb_samples, QString data_type, bool invert_axis, 24 bool enabled, int period);24 bool enabled, uint16_t period); 25 25 ~RangeFinderPlot(); 26 26 -
trunk/tools/FlairGCS/src/UsSensorPlot.cpp
r269 r437 24 24 25 25 UsSensorPlot::UsSensorPlot(Layout *parent, int row, int col, QString plot_name, 26 QString y_name, float ymin, float ymax, uint32_t nbSamples,QString datasType,bool enabled, int period)26 QString y_name, float ymin, float ymax, uint32_t nbSamples,QString datasType,bool enabled, uint16_t period) 27 27 : DataRemote(plot_name, "UsSensorPlot", parent, enabled, period) { 28 28 visible_widget = new QWidget(); -
trunk/tools/FlairGCS/src/UsSensorPlot.h
r269 r437 23 23 public: 24 24 UsSensorPlot(Layout *parent, int row, int col, QString plot_name, 25 QString y_name, float ymin,float ymax, uint32_t nbSamples,QString datasType,bool enabled, int period);25 QString y_name, float ymin,float ymax, uint32_t nbSamples,QString datasType,bool enabled, uint16_t period); 26 26 ~UsSensorPlot(); 27 27 -
trunk/tools/FlairGCS/src/Vector3DSpinBox.cpp
r269 r437 13 13 Vector3DSpinBox::Vector3DSpinBox(Layout *parent, int row, int col, QString name, 14 14 QString value[3], float min, float max, 15 float step, int decimals)15 float step, uint16_t decimals) 16 16 : XmlWidget(name, "Vector3DSpinBox", parent) { 17 17 for (int i = 0; i < 3; i++) { -
trunk/tools/FlairGCS/src/Vector3DSpinBox.h
r269 r437 20 20 Vector3DSpinBox(Layout *parent, int row, int col, QString name, 21 21 QString value[3], float min, float max, float step, 22 int decimals);22 uint16_t decimals); 23 23 ~Vector3DSpinBox(); 24 24
Note:
See TracChangeset
for help on using the changeset viewer.