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 | namespace gui { |
---|
22 | class LayoutPosition; |
---|
23 | |
---|
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); |
---|
37 | |
---|
38 | /*! |
---|
39 | * \brief Destructor |
---|
40 | * |
---|
41 | */ |
---|
42 | virtual ~SendData(); |
---|
43 | |
---|
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; |
---|
52 | |
---|
53 | size_t SendSize(void) const; |
---|
54 | uint16_t SendPeriod(void) const; // in ms |
---|
55 | bool IsEnabled(void) const; |
---|
56 | |
---|
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); |
---|
67 | |
---|
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; |
---|
76 | |
---|
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); |
---|
88 | |
---|
89 | void SetSendPeriod(uint16_t value); |
---|
90 | void SetEnabled(bool value); |
---|
91 | |
---|
92 | class SendData_impl *pimpl_; |
---|
93 | }; |
---|
94 | |
---|
95 | } // end namespace core |
---|
96 | } // end namespace flair |
---|
97 | |
---|
98 | #endif // SENDDATA_H |
---|