1 /* 2 * main.h 3 * 4 * OPAL application source file for EXTREMELY simple Multipoint Conferencing Unit 5 * 6 * Copyright (c) 2008 Vox Lucida Pty. Ltd. 7 * 8 * The contents of this file are subject to the Mozilla Public License 9 * Version 1.0 (the "License"); you may not use this file except in 10 * compliance with the License. You may obtain a copy of the License at 11 * http://www.mozilla.org/MPL/ 12 * 13 * Software distributed under the License is distributed on an "AS IS" 14 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 15 * the License for the specific language governing rights and limitations 16 * under the License. 17 * 18 * The Original Code is Open Phone Abstraction Library. 19 * 20 * The Initial Developer of the Original Code is Equivalence Pty. Ltd. 21 * 22 * Contributor(s): ______________________________________. 23 * 24 * $Revision: 24766 $ 25 * $Author: rjongbloed $ 26 * $Date: 2010-09-30 02:18:52 -0500 (Thu, 30 Sep 2010) $ 27 */ 28 29 #ifndef _OPAL_MCU_MAIN_H 30 #define _OPAL_MCU_MAIN_H 31 32 #if OPAL_HAS_MIXER 33 #else 34 #error Cannot compile MCU test program without OPAL_HAS_MIXER set! 35 #endif 36 37 #if OPAL_IVR 38 #else 39 #error Cannot compile MCU test program without OPAL_IVR set! 40 #endif 41 42 43 class MyManager; 44 class MyMixerEndPoint; 45 46 47 struct MyMixerNodeInfo : public OpalMixerNodeInfo 48 { CloneMyMixerNodeInfo49 virtual OpalMixerNodeInfo * Clone() const { return new MyMixerNodeInfo(*this); } 50 51 PString m_moderatorPIN; 52 }; 53 54 55 class MyMixerConnection : public OpalMixerConnection 56 { 57 PCLASSINFO(MyMixerConnection, OpalMixerConnection); 58 public: 59 MyMixerConnection( 60 PSafePtr<OpalMixerNode> node, 61 OpalCall & call, 62 MyMixerEndPoint & endpoint, 63 void * userData, 64 unsigned options, 65 OpalConnection::StringOptions * stringOptions 66 ); 67 68 virtual bool SendUserInputString(const PString & value); 69 70 protected: 71 MyMixerEndPoint & m_endpoint; 72 PString m_userInput; 73 }; 74 75 76 class MyMixerEndPoint : public OpalMixerEndPoint 77 { 78 PCLASSINFO(MyMixerEndPoint, OpalMixerEndPoint); 79 public: 80 MyMixerEndPoint(MyManager & manager, MyMixerNodeInfo * info); 81 82 virtual OpalMixerConnection * CreateConnection( 83 PSafePtr<OpalMixerNode> node, 84 OpalCall & call, 85 void * userData, 86 unsigned options, 87 OpalConnection::StringOptions * stringOptions 88 ); 89 90 virtual OpalMixerNode * CreateNode( 91 OpalMixerNodeInfo * info ///< Initial info for node 92 ); 93 94 PDECLARE_NOTIFIER(PCLI::Arguments, MyMixerEndPoint, CmdConfAdd); 95 PDECLARE_NOTIFIER(PCLI::Arguments, MyMixerEndPoint, CmdConfList); 96 PDECLARE_NOTIFIER(PCLI::Arguments, MyMixerEndPoint, CmdConfRemove); 97 PDECLARE_NOTIFIER(PCLI::Arguments, MyMixerEndPoint, CmdConfRecord); 98 PDECLARE_NOTIFIER(PCLI::Arguments, MyMixerEndPoint, CmdConfPlay); 99 PDECLARE_NOTIFIER(PCLI::Arguments, MyMixerEndPoint, CmdConfListen); 100 PDECLARE_NOTIFIER(PCLI::Arguments, MyMixerEndPoint, CmdMemberAdd); 101 PDECLARE_NOTIFIER(PCLI::Arguments, MyMixerEndPoint, CmdMemberList); 102 PDECLARE_NOTIFIER(PCLI::Arguments, MyMixerEndPoint, CmdMemberRemove); 103 104 bool CmdConfXXX(PCLI::Arguments & args, PSafePtr<OpalMixerNode> & node, PINDEX argCount); 105 106 MyManager & m_manager; 107 }; 108 109 110 class MyPCSSEndPoint : public OpalPCSSEndPoint 111 { 112 PCLASSINFO(MyPCSSEndPoint, OpalPCSSEndPoint); 113 public: MyPCSSEndPoint(OpalManager & manager)114 MyPCSSEndPoint(OpalManager & manager) 115 : OpalPCSSEndPoint(manager) 116 { 117 } 118 OnShowIncoming(const OpalPCSSConnection & connection)119 virtual PBoolean OnShowIncoming(const OpalPCSSConnection & connection) 120 { 121 return AcceptIncomingCall(connection.GetToken()); 122 } 123 OnShowOutgoing(const OpalPCSSConnection &)124 virtual PBoolean OnShowOutgoing(const OpalPCSSConnection &) 125 { 126 return true; 127 } 128 }; 129 130 131 class MyManager : public OpalManagerConsole 132 { 133 PCLASSINFO(MyManager, OpalManagerConsole) 134 135 public: 136 MyManager(); 137 ~MyManager(); 138 139 virtual void OnEstablishedCall(OpalCall & call); 140 virtual void OnClearedCall(OpalCall & call); 141 142 MyMixerEndPoint * m_mixer; 143 PCLI * m_cli; 144 }; 145 146 147 class ConfOPAL : public PProcess 148 { 149 PCLASSINFO(ConfOPAL, PProcess) 150 151 public: 152 ConfOPAL(); 153 ~ConfOPAL(); 154 155 virtual void Main(); 156 157 private: 158 PDECLARE_NOTIFIER(PCLI::Arguments, ConfOPAL, CmdListCodecs); 159 #if PTRACING 160 PDECLARE_NOTIFIER(PCLI::Arguments, ConfOPAL, CmdTrace); 161 #endif 162 PDECLARE_NOTIFIER(PCLI::Arguments, ConfOPAL, CmdShutDown); 163 PDECLARE_NOTIFIER(PCLI::Arguments, ConfOPAL, CmdQuit); 164 165 MyManager * m_manager; 166 }; 167 168 169 #endif // _OPAL_MCU_MAIN_H 170 171 172 // End of File /////////////////////////////////////////////////////////////// 173