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