baf52dacd8003c3ac6d43bfef7073aae9e871e3b
Stefan Schuermans MCUF sender module implemented

Stefan Schuermans authored 13 years ago

1) /* Blinker
2)    Copyright 2011 Stefan Schuermans <stefan@blinkenarea.org>
3)    Copyleft GNU public license - http://www.gnu.org/copyleft/gpl.html
4)    a blinkenarea.org project */
5) 
Stefan Schuermans namespace for preprocessor...

Stefan Schuermans authored 12 years ago

6) #ifndef BLINKER_SENDER_H
7) #define BLINKER_SENDER_H
Stefan Schuermans MCUF sender module implemented

Stefan Schuermans authored 13 years ago

8) 
9) #include <list>
Stefan Schuermans implemented dynamic destina...

Stefan Schuermans authored 12 years ago

10) #include <map>
Stefan Schuermans MCUF sender module implemented

Stefan Schuermans authored 13 years ago

11) #include <string>
12) 
Stefan Schuermans implemented dynamic destina...

Stefan Schuermans authored 12 years ago

13) #include <BlinkenLib/BlinkenProto.h>
Stefan Schuermans MCUF sender module implemented

Stefan Schuermans authored 13 years ago

14) #include <BlinkenLib/BlinkenFrame.h>
15) 
16) #include "Directory.h"
17) #include "File.h"
Stefan Schuermans implemented specialized set...

Stefan Schuermans authored 12 years ago

18) #include "InStreamFile.h"
Stefan Schuermans implemented dynamic destina...

Stefan Schuermans authored 12 years ago

19) #include "IoCallee.h"
Stefan Schuermans put all managers in one str...

Stefan Schuermans authored 12 years ago

20) #include "Mgrs.h"
Stefan Schuermans MCUF sender module implemented

Stefan Schuermans authored 13 years ago

21) #include "Module.h"
Stefan Schuermans converted sender to use lis...

Stefan Schuermans authored 12 years ago

22) #include "ListTracker.h"
Stefan Schuermans simplified sender module a...

Stefan Schuermans authored 12 years ago

23) #include "Protocol.h"
Stefan Schuermans implemented specialized set...

Stefan Schuermans authored 12 years ago

24) #include "ProtocolFile.h"
Stefan Schuermans MCUF sender module implemented

Stefan Schuermans authored 13 years ago

25) #include "SettingFile.h"
26) #include "StreamRecv.h"
Stefan Schuermans implemented dynamic destina...

Stefan Schuermans authored 12 years ago

27) #include "Time.h"
Stefan Schuermans now repeating frames after...

Stefan Schuermans authored 13 years ago

28) #include "TimeCallee.h"
Stefan Schuermans MCUF sender module implemented

Stefan Schuermans authored 13 years ago

29) 
30) namespace Blinker {
31) 
32) /// stream sender
33) template<typename ADDR, typename SOCK>
Stefan Schuermans implemented dynamic destina...

Stefan Schuermans authored 12 years ago

34) class Sender: public IoCallee, public Module, public StreamRecv,
35)               public TimeCallee
Stefan Schuermans MCUF sender module implemented

Stefan Schuermans authored 13 years ago

36) {
37) protected:
Stefan Schuermans implemented specialized set...

Stefan Schuermans authored 12 years ago

38)   /// type for address setting file
39)   typedef SettingFile<ADDR> AddrFile;
40) 
Stefan Schuermans MCUF sender module implemented

Stefan Schuermans authored 13 years ago

41)   /// static destination
Stefan Schuermans sender static destination n...

Stefan Schuermans authored 12 years ago

42)   class Dest;
43) 
Stefan Schuermans converted sender to use lis...

Stefan Schuermans authored 12 years ago

44)   /// static destination list tracker
45)   typedef ListTracker<Sender, Dest, Directory> DestListTracker;
Stefan Schuermans MCUF sender module implemented

Stefan Schuermans authored 13 years ago

46) 
Stefan Schuermans implemented dynamic destina...

Stefan Schuermans authored 12 years ago

47)   /// dynamic destinations: address -> time of last request
48)   typedef std::map<ADDR, Time> DynDests;
49) 
Stefan Schuermans MCUF sender module implemented

Stefan Schuermans authored 13 years ago

50) public:
51)   /**
52)    * @brief constructor
Stefan Schuermans put all managers in one str...

Stefan Schuermans authored 12 years ago

53)    * @param[in] mgrs managers
Stefan Schuermans MCUF sender module implemented

Stefan Schuermans authored 13 years ago

54)    * @param[in] dirBase base directory
55)    */
Stefan Schuermans put all managers in one str...

Stefan Schuermans authored 12 years ago

56)   Sender(Mgrs &mgrs, const Directory &dirBase);
Stefan Schuermans MCUF sender module implemented

Stefan Schuermans authored 13 years ago

57) 
58)   /// virtual destructor
59)   virtual ~Sender();
60) 
61) private:
62)   /// copy constructor disabled
63)   Sender(const Sender &that);
64) 
65)   /// assignment operator disabled
66)   const Sender & operator=(const Sender &that);
67) 
68) public:
69)   /// check for update of configuration
70)   virtual void updateConfig();
71) 
72)   /**
73)    * @brief set current frame
Stefan Schuermans added stream name to stream...

Stefan Schuermans authored 12 years ago

74)    * @param[in] stream stream name
Stefan Schuermans merged frame processing wit...

Stefan Schuermans authored 12 years ago

75)    * @param[in] pFrame current frame (NULL for none)
Stefan Schuermans MCUF sender module implemented

Stefan Schuermans authored 13 years ago

76)    */
Stefan Schuermans added stream name to stream...

Stefan Schuermans authored 12 years ago

77)   virtual void setFrame(const std::string &stream, stBlinkenFrame *pFrame);
Stefan Schuermans MCUF sender module implemented

Stefan Schuermans authored 13 years ago

78) 
Stefan Schuermans fixed comment typo

Stefan Schuermans authored 12 years ago

79)   /// callback when requested time reached
Stefan Schuermans now repeating frames after...

Stefan Schuermans authored 13 years ago

80)   virtual void timeCall();
81) 
Stefan Schuermans implemented dynamic destina...

Stefan Schuermans authored 12 years ago

82)   /**
83)    * @brief callback when I/O object is readable
84)    * @param[in] io I/O object that is readable
85)    */
86)   virtual void ioReadCall(Io *io);
87) 
88)   /**
89)    * @brief callback when I/O object is writable
90)    * @param[in] io I/O object that is writable
91)    */
92)   virtual void ioWriteCall(Io *io);
93) 
Stefan Schuermans MCUF sender module implemented

Stefan Schuermans authored 13 years ago

94) protected:
Stefan Schuermans simplified sender module a...

Stefan Schuermans authored 12 years ago

95)   /// (re-)read protocol
96)   void readProto();
Stefan Schuermans sender static destination n...

Stefan Schuermans authored 12 years ago

97) 
Stefan Schuermans MCUF sender module implemented

Stefan Schuermans authored 13 years ago

98)   /// create socket and bind it
99)   void createSock();
100) 
101)   /// destroy socket
102)   void destroySock();
103) 
Stefan Schuermans implemented dynamic destina...

Stefan Schuermans authored 12 years ago

104)   /// remove timed-out dynamic destinations
105)   void removeTimedOutDynDests();
106) 
Stefan Schuermans simplified implementation o...

Stefan Schuermans authored 12 years ago

107)   /// send current protocol data to all destinations
108)   void sendAllProto();
Stefan Schuermans added stream name to stream...

Stefan Schuermans authored 12 years ago

109) 
110)   /// send "no frame" to all destinations
111)   void sendAllNoFrame();
112) 
113)   /**
114)    * @brief send data to static/dynamic destinations
Stefan Schuermans sender static destination n...

Stefan Schuermans authored 12 years ago

115)    * @param[in] data *pData protocol data to send
Stefan Schuermans added stream name to stream...

Stefan Schuermans authored 12 years ago

116)    */
Stefan Schuermans simplified sender module a...

Stefan Schuermans authored 12 years ago

117)   void sendDests(const std::string *pData);
Stefan Schuermans added stream name to stream...

Stefan Schuermans authored 12 years ago

118) 
Stefan Schuermans MCUF sender module implemented

Stefan Schuermans authored 13 years ago

119)   /**
Stefan Schuermans simplified implementation o...

Stefan Schuermans authored 12 years ago

120)    * @brief send protocol data to address
Stefan Schuermans typo

Stefan Schuermans authored 12 years ago

121)    * @param[in] data protocol data of frame (empty if unknown)
Stefan Schuermans MCUF sender module implemented

Stefan Schuermans authored 13 years ago

122)    * @param[in] addr address to send to
123)    */
Stefan Schuermans simplified implementation o...

Stefan Schuermans authored 12 years ago

124)   void sendProto(const std::string &data, const ADDR &addr) const;
Stefan Schuermans MCUF sender module implemented

Stefan Schuermans authored 13 years ago

125) 
126)   /**
Stefan Schuermans now repeating frames after...

Stefan Schuermans authored 13 years ago

127)    * @brief convert frame to protocol data
Stefan Schuermans merged frame processing wit...

Stefan Schuermans authored 12 years ago

128)    * @param[in] pFrame frame (NULL for none)
Stefan Schuermans typo

Stefan Schuermans authored 12 years ago

129)    * @param[out] data protocol data
Stefan Schuermans MCUF sender module implemented

Stefan Schuermans authored 13 years ago

130)    */
Stefan Schuermans simplified sender module a...

Stefan Schuermans authored 12 years ago

131)   void frame2data(stBlinkenFrame *pFrame, std::string &data) const;
Stefan Schuermans now repeating frames after...

Stefan Schuermans authored 13 years ago

132) 
Stefan Schuermans implemented dynamic destina...

Stefan Schuermans authored 12 years ago

133)   /// receive data from socket
134)   void receiveFromSock();
Stefan Schuermans MCUF sender module implemented

Stefan Schuermans authored 13 years ago

135) 
136) protected:
Stefan Schuermans converted sender to use lis...

Stefan Schuermans authored 12 years ago

137)   InStreamFile    m_fileInStream;    ///< input stream name file
138)   AddrFile        m_fileBind;        ///< bind address file
139)   ProtocolFile    m_fileProtocol;    ///< protocol file
140)   SOCK            *m_pSock;          ///< socket to use for sending streams
141)   DestListTracker m_destListTracker; ///< static destinations tracker
142)   DynDests        m_dynDests;        ///< dynamic destinations
Stefan Schuermans 80 char reformatting

Stefan Schuermans authored 12 years ago

143)   std::string     m_noFrameData;     /**< "no frame" protocol data
144)                                           (empty if unknown) */
145)   std::string     m_data;            /**< current protocol data
146)                                           (empty if unknown) */
Stefan Schuermans MCUF sender module implemented

Stefan Schuermans authored 13 years ago

147) }; // class Sender
148) 
149) } // namespace Blinker
150) 
Stefan Schuermans namespace for preprocessor...

Stefan Schuermans authored 12 years ago

151) #endif // #ifndef BLINKER_SENDER_H