| 1 | // %flair:license{
|
---|
| 2 | // This file is part of the Flair framework distributed under the
|
---|
| 3 | // CECILL-C License, Version 1.0.
|
---|
| 4 | // %flair:license}
|
---|
| 5 | /*!
|
---|
| 6 | * \file SendData.h
|
---|
| 7 | * \brief Abstract class for sending datas to ground station
|
---|
| 8 | * \author Guillaume Sanahuja, Copyright Heudiasyc UMR UTC/CNRS 7253
|
---|
| 9 | * \date 2012/03/07
|
---|
| 10 | * \version 4.0
|
---|
| 11 | */
|
---|
| 12 |
|
---|
| 13 | #ifndef SENDDATA_H
|
---|
| 14 | #define SENDDATA_H
|
---|
| 15 |
|
---|
| 16 | #include <Widget.h>
|
---|
| 17 |
|
---|
| 18 | class SendData_impl;
|
---|
| 19 |
|
---|
| 20 | namespace flair
|
---|
| 21 | {
|
---|
| 22 | namespace gui
|
---|
| 23 | {
|
---|
| 24 | class LayoutPosition;
|
---|
| 25 |
|
---|
| 26 | /*! \class SendData
|
---|
| 27 | *
|
---|
| 28 | * \brief Abstract class for sending datas to ground station
|
---|
| 29 | *
|
---|
| 30 | */
|
---|
| 31 | class SendData: public Widget
|
---|
| 32 | {
|
---|
| 33 | public:
|
---|
| 34 | /*!
|
---|
| 35 | * \brief Constructor
|
---|
| 36 | *
|
---|
| 37 | */
|
---|
| 38 | SendData(const LayoutPosition* position,std::string name,std::string type,uint16_t default_periodms=100,bool default_enabled=false);
|
---|
| 39 |
|
---|
| 40 | /*!
|
---|
| 41 | * \brief Destructor
|
---|
| 42 | *
|
---|
| 43 | */
|
---|
| 44 | virtual ~SendData();
|
---|
| 45 |
|
---|
| 46 | /*!
|
---|
| 47 | * \brief Copy datas to specified buffer
|
---|
| 48 | *
|
---|
| 49 | * This method must be reimplemented, in order to send datas to ground station.
|
---|
| 50 | *
|
---|
| 51 | * \param buf output buffer
|
---|
| 52 | */
|
---|
| 53 | virtual void CopyDatas(char* buf) const =0;
|
---|
| 54 |
|
---|
| 55 | size_t SendSize(void) const;
|
---|
| 56 | uint16_t SendPeriod(void) const; // in ms
|
---|
| 57 | bool IsEnabled(void) const;
|
---|
| 58 |
|
---|
| 59 | protected:
|
---|
| 60 |
|
---|
| 61 | /*!
|
---|
| 62 | * \brief Notify that SenData's datas have changed
|
---|
| 63 | *
|
---|
| 64 | * This method must be called when the datas have changed. \n
|
---|
| 65 | * Normally, it occurs when a curve is added to a plot for example. \n
|
---|
| 66 | * This method automatically blocks and unblocks the communication.
|
---|
| 67 | *
|
---|
| 68 | */
|
---|
| 69 | void SetSendSize(size_t value);
|
---|
| 70 |
|
---|
| 71 | /*!
|
---|
| 72 | * \brief Extra Xml event
|
---|
| 73 | *
|
---|
| 74 | * This method must be reimplemented to handle extra xml event. \n
|
---|
| 75 | * It is automatically called when something changed from
|
---|
| 76 | * ground station, through XmlEvent method. \n
|
---|
| 77 | */
|
---|
| 78 | virtual void ExtraXmlEvent(void)=0;
|
---|
| 79 |
|
---|
| 80 | private:
|
---|
| 81 | /*!
|
---|
| 82 | * \brief XmlEvent from ground station
|
---|
| 83 | *
|
---|
| 84 | * Reimplemented from Widget. \n
|
---|
| 85 | * This method handles period and enabled properties of the SendData. \n
|
---|
| 86 | * Then it calls ExtraXmlEvent to handle specific xml events of reimplemented class.
|
---|
| 87 | *
|
---|
| 88 | */
|
---|
| 89 | void XmlEvent(void);
|
---|
| 90 |
|
---|
| 91 | void SetSendPeriod(uint16_t value);
|
---|
| 92 | void SetEnabled(bool value);
|
---|
| 93 |
|
---|
| 94 | class SendData_impl* pimpl_;
|
---|
| 95 | };
|
---|
| 96 |
|
---|
| 97 | } // end namespace core
|
---|
| 98 | } // end namespace flair
|
---|
| 99 |
|
---|
| 100 | #endif // SENDDATA_H
|
---|