b6b2996b76e1b0f0e403b4be40430a445bc0873c
Stefan Schuermans implemnted operator connect...

Stefan Schuermans authored 12 years ago

1) /* Blinker
Stefan Schuermans update copyright years

Stefan Schuermans authored 10 years ago

2)    Copyright 2011-2014 Stefan Schuermans <stefan@blinkenarea.org>
Stefan Schuermans implemnted operator connect...

Stefan Schuermans authored 12 years ago

3)    Copyleft GNU public license - http://www.gnu.org/copyleft/gpl.html
4)    a blinkenarea.org project */
5) 
6) #ifndef BLINKER_OPSPLITTER_H
7) #define BLINKER_OPSPLITTER_H
8) 
9) #include <map>
10) #include <string>
11) 
Stefan Schuermans implemented single mode for...

Stefan Schuermans authored 12 years ago

12) #include "BoolFile.h"
Stefan Schuermans implemnted operator connect...

Stefan Schuermans authored 12 years ago

13) #include "Directory.h"
14) #include "File.h"
15) #include "ListTracker.h"
16) #include "Mgrs.h"
17) #include "Module.h"
18) #include "NameFile.h"
19) #include "OpConn.h"
20) #include "OpConnIf.h"
21) #include "OpReqIf.h"
22) #include "SettingFile.h"
23) #include "Time.h"
24) #include "TimeCallee.h"
Stefan Schuermans limit number of connections...

Stefan Schuermans authored 12 years ago

25) #include "UIntFile.h"
Stefan Schuermans implemnted operator connect...

Stefan Schuermans authored 12 years ago

26) 
27) namespace Blinker {
28) 
29) /// operator connection splitter
30) class OpSplitter: public Module, public OpReqIf, public TimeCallee
31) {
32) protected:
33)   /// extension to be called
34)   class Extension;
35) 
36)   /// extension list tracker
37)   typedef ListTracker<OpSplitter, Extension, Directory> ExtListTracker;
38) 
39)   /// map of extensions to call (extension name -> module name)
40)   typedef std::map<std::string, std::string> ExtMap;
41) 
42)   /// type for locally handles connection
43)   struct Local {
44)     std::string m_number;   ///< extension number dialed so far
45)     bool        m_sendPlay; ///< if to send a play request
Stefan Schuermans implemented single mode for...

Stefan Schuermans authored 12 years ago

46)     bool        m_close;    ///< if to close connection as soon as possible
Stefan Schuermans implemnted operator connect...

Stefan Schuermans authored 12 years ago

47)   };
48) 
49)   /**
50)    * @brief map of local connections,
51)    *        contains all incoming connections as key for which no
52)    *        outgoing connection is available
53)    */
54)   typedef std::map<OpConn *, Local> MapLocal;
55) 
56)   /**
57)    * @brief map from incoming to outgoing connections,
58)    *        contains all incoming connectes as key for which a corresponding
59)    *        outgoing connection is available
60)    */
61)   typedef std::map<OpConn *, OpConn *> MapInOut;
62) 
63)   /// map from outgoing to incoming connections
64)   typedef std::map<OpConn *, OpConn *> MapOutIn;
65) 
66) public:
67)   /**
68)    * @brief constructor
69)    * @param[in] name module name
70)    * @param[in] mgrs managers
71)    * @param[in] dirBase base directory
72)    */
73)   OpSplitter(const std::string &name, Mgrs &mgrs, const Directory &dirBase);
74) 
75)   /// virtual destructor
76)   virtual ~OpSplitter();
77) 
78) private:
79)   /// copy constructor disabled
80)   OpSplitter(const OpSplitter &that);
81) 
82)   /// assignment operator disabled
83)   const OpSplitter & operator=(const OpSplitter &that);
84) 
85) public:
86)   /// check for update of configuration
87)   virtual void updateConfig();
88) 
89)   /// callback when requested time reached
90)   virtual void timeCall();
91) 
92)   /**
93)    * @brief check if accepting new operator connction is possible
94)    * @param[in] name operator interface name
95)    * @return if accepting new connection is possible
96)    */
97)   virtual bool acceptNewOpConn(const std::string &name);
98) 
99)   /**
100)    * @brief new operator connection
101)    * @param[in] name operator interface name
102)    * @param[in] pConn operator connection object
103)    *
104)    * The new connection may not yet be used for sending inside this callback.
105)    */
106)   virtual void newOpConn(const std::string &name, OpConn *pConn);
107) 
108)   /**
109)    * @brief key command received on operator connection
110)    * @param[in] pConn operator connection object
111)    * @param[in] key key that was pressed
112)    */
113)   virtual void opConnRecvKey(OpConn *pConn, char key);
114) 
115)   /**
116)    * @brief play command received on operator connection
117)    * @param[in] pConn operator connection object
118)    * @param[in] sound name of sound to play
119)    */
120)   virtual void opConnRecvPlay(OpConn *pConn, const std::string &sound);
121) 
122)   /**
123)    * @brief operator connection is closed
124)    * @param[in] pConn operator connection object
125)    *
126)    * The connection may not be used for sending any more in this callback.
127)    */
128)   virtual void opConnClose(OpConn *pConn);
129) 
130) protected:
131)   /**
132)    * @brief create new local connection
133)    * @param[in] pConn connection to make local
Stefan Schuermans implemented single mode for...

Stefan Schuermans authored 12 years ago

134)    * @param[in] close if to close connection as soon as possible
Stefan Schuermans implemnted operator connect...

Stefan Schuermans authored 12 years ago

135)    */
Stefan Schuermans implemented single mode for...

Stefan Schuermans authored 12 years ago

136)   void newLocal(OpConn *pConn, bool close = false);
Stefan Schuermans implemnted operator connect...

Stefan Schuermans authored 12 years ago

137) 
138)   /**
139)    * @brief a key has been pressed for a local connection
140)    * @param[in] itLocal local connection
141)    * @param[in] key the key pressed
142)    */
143)   void localKey(MapLocal::iterator itLocal, char key);
144) 
145)   /**
146)    * @brief call extension dialed over local connection
147)    * @param[in] itLocal local connection
148)    */
149)   void callExtension(MapLocal::iterator itLocal);
150) 
151) protected:
152)   NameFile       m_fileSound;      ///< file containing sound name
Stefan Schuermans limit number of connections...

Stefan Schuermans authored 12 years ago

153)   UIntFile       m_fileMaxConn;    ///< file containing max. number of conn.
Stefan Schuermans implemented single mode for...

Stefan Schuermans authored 12 years ago

154)   BoolFile       m_fileSingle;     ///< file containing single mode config
155)   std::string    m_singleOp;       ///< operator intf. to call in single mode