AudioManager  7.5.11
Native Application Runtime Environment
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
CAmTelnetMenuHelper.h
Go to the documentation of this file.
1 
25 // Local header
26 #ifndef CAMTELNETMENUHELPER_H_
27 #define CAMTELNETMENUHELPER_H_
28 
29 // Standard header
30 #include <iostream>
31 #include <queue>
32 #include <map>
33 #include <string>
34 #include <sstream>
35 #include <vector>
36 #include <sys/socket.h>
37 #include "audiomanagertypes.h"
38 
39 namespace am
40 {
41 
42 class CAmTelnetServer;
43 class IAmDatabaseHandler;
44 class CAmCommandSender;
45 class CAmRoutingSender;
46 class CAmControlSender;
47 class CAmCommandReceiver;
48 class CAmRoutingReceiver;
49 class CAmControlReceiver;
50 
51 class CAmRouter;
52 class CAmSocketHandler;
53 
58 {
59 public:
60 
62  {
64  };
65 
66  CAmTelnetMenuHelper(CAmSocketHandler *iSocketHandler, CAmCommandSender *iCommandSender, CAmCommandReceiver *iCommandReceiver, CAmRoutingSender *iRoutingSender, CAmRoutingReceiver *iRoutingReceiver, CAmControlSender *iControlSender, CAmControlReceiver *iControlReceiver, IAmDatabaseHandler *iDatabasehandler, CAmRouter *iRouter, CAmTelnetServer *iTelnetServer);
67 
69 
70  void newSocketConnection(int filedescriptor);
71 
72  void socketConnectionsClosed(int filedescriptor);
73 
74  void enterCmdQueue(std::queue<std::string> &CmdQueue, int &filedescriptor);
75 
76 private:
77 
78  void createCommandMaps();
79  void sendError(int & filedescriptor, std::string error_string);
80  void sendTelnetLine(int & filedescriptor, std::stringstream &line);
81  void sendCurrentCmdPrompt(int &filedescriptor);
82 
83  // COMMON commands
84  static void oneStepBackCommand(std::queue<std::string> & CmdQueue, int & filedescriptor);
85  void oneStepBackCommandExec(std::queue<std::string> & CmdQueue, int & filedescriptor);
86  static void exitCommand(std::queue<std::string> & CmdQueue, int & filedescriptor);
87  void exitCommandExec(std::queue<std::string> & CmdQueue, int & filedescriptor);
88  static void helpCommand(std::queue<std::string> & CmdQueue, int & filedescriptor);
89  void helpCommandExec(std::queue<std::string> & CmdQueue, int & filedescriptor);
90 
91  // ROOT commands
92  static void rootGetCommand(std::queue<std::string> & CmdQueue, int & filedescriptor);
93  void rootGetCommandExec(std::queue<std::string> & CmdQueue, int & filedescriptor);
94  static void rootSetCommand(std::queue<std::string> & CmdQueue, int & filedescriptor);
95  void rootSetCommandExec(std::queue<std::string> & CmdQueue, int & filedescriptor);
96  static void rootListCommand(std::queue<std::string> & CmdQueue, int & filedescriptor);
97  void rootListCommandExec(std::queue<std::string> & CmdQueue, int & filedescriptor);
98  static void rootInfoCommand(std::queue<std::string> & CmdQueue, int & filedescriptor);
99  void rootInfoCommandExec(std::queue<std::string> & CmdQueue, int & filedescriptor);
100 
101  // LIST commands
102  static void listConnectionsCommand(std::queue<std::string> & CmdQueue, int & filedescriptor);
103  void listConnectionsCommandExec(std::queue<std::string> & CmdQueue, int & filedescriptor);
104  static void listSourcesCommand(std::queue<std::string> & CmdQueue, int & filedescriptor);
105  void listSourcesCommandExec(std::queue<std::string> & CmdQueue, int & filedescriptor);
106  static void listSinksCommands(std::queue<std::string> & CmdQueue, int & filedescriptor);
107  void listSinksCommandsExec(std::queue<std::string> & CmdQueue, int & filedescriptor);
108  static void listCrossfaders(std::queue<std::string> & CmdQueue, int & filedescriptor);
109  void listCrossfadersExec(std::queue<std::string> & CmdQueue, int & filedescriptor);
110  static void listDomainsCommand(std::queue<std::string> & CmdQueue, int & filedescriptor);
111  void listDomainsCommandExec(std::queue<std::string> & CmdQueue, int & filedescriptor);
112  static void listGatewaysCommand(std::queue<std::string> & CmdQueue, int & filedescriptor);
113  void listGatewaysCommandExec(std::queue<std::string> & CmdQueue, int & filedescriptor);
114  static void listPluginsCommand(std::queue<std::string> & CmdQueue, int & filedescriptor);
115  void listPluginsCommandExec(std::queue<std::string> & CmdQueue, int & filedescriptor);
116  static void listMainConnectionsCommand(std::queue<std::string> & CmdQueue, int & filedescriptor);
117  void listMainConnectionsCommandExec(std::queue<std::string> & CmdQueue, int & filedescriptor);
118  static void listMainSourcesCommand(std::queue<std::string> & CmdQueue, int & filedescriptor);
119  void listMainSourcesCommandExec(std::queue<std::string> & CmdQueue, int & filedescriptor);
120  static void listMainSinksCommand(std::queue<std::string> & CmdQueue, int & filedescriptor);
121  void listMainSinksCommandExec(std::queue<std::string> & CmdQueue, int & filedescriptor);
122 
123  // SET commands
124  static void setRoutingCommand(std::queue<std::string> & CmdQueue, int & filedescriptor);
125  void setRoutingCommandExec(std::queue<std::string> & CmdQueue, int & filedescriptor);
126  static void setConnection(std::queue<std::string> & CmdQueue, int & filedescriptor);
127  void setConnectionExec(std::queue<std::string> & CmdQueue, int & filedescriptor);
128  static void setDisconnectConnId(std::queue<std::string> & CmdQueue, int & filedescriptor);
129  void setDisconnectConnIdExec(std::queue<std::string> & CmdQueue, int & filedescriptor);
130  static void setSourceSoundProperties(std::queue<std::string> & CmdQueue, int & filedescriptor);
131  void setSourceSoundPropertiesExec(std::queue<std::string> & CmdQueue, int & filedescriptor);
132  static void setSinkSoundProperty(std::queue<std::string> & CmdQueue, int & filedescriptor);
133  void setSinkSoundPropertyExec(std::queue<std::string> & CmdQueue, int & filedescriptor);
134  static void setSinkVolume(std::queue<std::string> & CmdQueue, int & filedescriptor);
135  void setSinkVolumeExec(std::queue<std::string> & CmdQueue, int & filedescriptor);
136  static void setVolumeStep(std::queue<std::string> & CmdQueue, int & filedescriptor);
137  void setVolumeStepExec(std::queue<std::string> & CmdQueue, int & filedescriptor);
138  static void setSinkMuteState(std::queue<std::string> & CmdQueue, int & filedescriptor);
139  void setSinkMuteStateExec(std::queue<std::string> & CmdQueue, int & filedescriptor);
140  static void setSourceSoundProperty(std::queue<std::string> & CmdQueue, int & filedescriptor);
141  void setSourceSoundPropertyExec(std::queue<std::string> & CmdQueue, int & filedescriptor);
142 
143  // GET commands
144  static void getRoutingCommand(std::queue<std::string> & CmdQueue, int & filedescriptor);
145  void getRoutingCommandExec(std::queue<std::string> & CmdQueue, int & filedescriptor);
146  static void getSenderversionCommand(std::queue<std::string> & CmdQueue, int & filedescriptor);
147  void getSenderversionCommandExec(std::queue<std::string> & CmdQueue, int & filedescriptor);
148  static void getReceiverversionCommand(std::queue<std::string> & CmdQueue, int & filedescriptor);
149  void getReceiverversionCommandExec(std::queue<std::string> & CmdQueue, int & filedescriptor);
150 
151  // INFO commands
152  static void infoSystempropertiesCommand(std::queue<std::string> & CmdQueue, int & filedescriptor);
153  void infoSystempropertiesCommandExec(std::queue<std::string> & CmdQueue, int & filedescriptor);
154  static void infoDumpCommand(std::queue<std::string>& CmdQueue, int& filedescriptor);
155  void infoDumpCommandExec(std::queue<std::string>& CmdQueue, int& filedescriptor);
156 
157 private:
158 
159  typedef void (*pCommandPrototype)(std::queue<std::string>& msg, int & filedescriptor);
160 
161  struct sCommandPrototypeInfo
162  {
163  std::string info;
164  pCommandPrototype CommandPrototype;
165 
166  // default contructor to set NULL
167  sCommandPrototypeInfo() :
168  info(""), CommandPrototype(NULL)
169  {
170  }
171 
172  // a small contructor
173  sCommandPrototypeInfo(std::string MyInfo, pCommandPrototype MyCommandPrototype) :
174  info(MyInfo), CommandPrototype(MyCommandPrototype)
175  {
176  }
177  };
178 
179  typedef std::map<std::string, sCommandPrototypeInfo> tCommandMap;
180  std::map<int, EMainState> mCurrentMainStateMap;
181 
182  static CAmTelnetMenuHelper* instance;
183  CAmTelnetServer *mpTelenetServer;
184  CAmSocketHandler *mpSocketHandler;
185  CAmCommandSender *mpCommandSender;
186  CAmCommandReceiver *mpCommandReceiver;
187  CAmRoutingSender *mpRoutingSender;
188  CAmRoutingReceiver *mpRoutingReceiver;
189  CAmControlSender *mpControlSender;
190  CAmControlReceiver *mpControlReceiver;
191  IAmDatabaseHandler *mpDatabasehandler;
192  CAmRouter *mpRouter;
193 
194  tCommandMap mRootCommands;
195  tCommandMap mListCommands;
196  tCommandMap mGetCommands;
197  tCommandMap mSetCommands;
198  tCommandMap mInfoCommands;
199 
200 };
201 // class CAmTelnetMenuHelper
202 }// namespace am
203 
204 #endif // CAMTELNETMENUHELPER_H_
Implements the RoutingSendInterface.
This class realizes the command Interface.
Implements an autorouting algorithm for connecting sinks and sources via different audio domains...
Definition: CAmRouter.h:152
This class is used to receive all commands from the control interface.
The am::CAmSocketHandler implements a mainloop for the AudioManager.
CAmTelnetMenuHelper(CAmSocketHandler *iSocketHandler, CAmCommandSender *iCommandSender, CAmCommandReceiver *iCommandReceiver, CAmRoutingSender *iRoutingSender, CAmRoutingReceiver *iRoutingReceiver, CAmControlSender *iControlSender, CAmControlReceiver *iControlReceiver, IAmDatabaseHandler *iDatabasehandler, CAmRouter *iRouter, CAmTelnetServer *iTelnetServer)
void socketConnectionsClosed(int filedescriptor)
Implements the Receiving side of the RoutingPlugins.
helper class for CAmTelnetServer
void newSocketConnection(int filedescriptor)
sends data to the commandInterface, takes the file of the library that needs to be loaded ...
This class handles and abstracts the database.
Implements a telnetserver that can be used to connect to the audiomanager, retrieve some information ...
void enterCmdQueue(std::queue< std::string > &CmdQueue, int &filedescriptor)
Copyright (C) 2012 - 2014, BMW AG.
This class is used to send data to the CommandInterface.