|
1 /** @file |
|
2 * Copyright (c) Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * Declares MessageHandler Class |
|
16 * |
|
17 */ |
|
18 |
|
19 #ifndef C_CUPNPMESSAGEHANDLER_H |
|
20 #define C_CUPNPMESSAGEHANDLER_H |
|
21 |
|
22 // INCLUDES |
|
23 |
|
24 #include <e32base.h> |
|
25 #include "upnpmessagehandlerengineobserver.h" |
|
26 #include "upnpmessagehandler.pan" |
|
27 #include "upnpmessagehandlerobserver.h" |
|
28 #include <upnpsymbianserverbase.h> |
|
29 |
|
30 |
|
31 // FORWARD DECLARATIONS |
|
32 |
|
33 class CUpnpMessageHandlerEngine; |
|
34 |
|
35 // CLASS DECLARATION |
|
36 |
|
37 /** |
|
38 *brief The main class of Message Handler. |
|
39 * |
|
40 * An instance of class CUpnpMessageHandler is the main server class. Message Handler |
|
41 * is used to send and receive SSDP messages. CUpnpMessageHandler owns |
|
42 * CUpnpMessageHandlerEngine object that is used as engine class of main functionalities |
|
43 * of Message Handler. |
|
44 */ |
|
45 |
|
46 class CUpnpMessageHandler : public CUpnpSymbianServerBase, |
|
47 public MMessageHandlerEngineObserver |
|
48 { |
|
49 public: |
|
50 // New methods |
|
51 |
|
52 /** |
|
53 * Create a CUpnpMessageHandler object using two phase construction, |
|
54 * and return a pointer to the created object, leaving a pointer to the |
|
55 * object on the cleanup stack |
|
56 * @result pointer to created CUpnpMessageHandler object |
|
57 */ |
|
58 static CUpnpSymbianServerBase* NewLC(); |
|
59 |
|
60 /** |
|
61 * Destroy the object and release all memory objects |
|
62 */ |
|
63 ~CUpnpMessageHandler(); |
|
64 |
|
65 /** |
|
66 * Informs every Observer (every session) that the device list has changed |
|
67 */ |
|
68 void DeviceListUpdateL(); |
|
69 |
|
70 /** |
|
71 * Add Observer (session) to the list |
|
72 */ |
|
73 void AddObserverL( MMessageHandlerObserver* aObserver ); |
|
74 |
|
75 /** |
|
76 * Removes Observer (session) from list |
|
77 */ |
|
78 void RemoveObserver( MMessageHandlerObserver* aObserver ); |
|
79 |
|
80 /** |
|
81 * Tests if SSDP servers are started |
|
82 */ |
|
83 TBool IsSsdpStarted(); |
|
84 |
|
85 /** |
|
86 * Getter of starting error |
|
87 */ |
|
88 TInt StartingError(); |
|
89 |
|
90 /** |
|
91 * Setter of SSDP state |
|
92 */ |
|
93 void SetSsdpStarted( TBool aStarted ); |
|
94 |
|
95 private: |
|
96 // New methods |
|
97 |
|
98 /** |
|
99 * Performs the first phase of two phase construction |
|
100 */ |
|
101 CUpnpMessageHandler(); |
|
102 |
|
103 /** |
|
104 * Performs the second phase construction of a CUpnpMessageHandler object |
|
105 */ |
|
106 void ConstructL(); |
|
107 |
|
108 /** |
|
109 * callback from observer |
|
110 */ |
|
111 void IPListChange(); |
|
112 |
|
113 /** |
|
114 * Returns sessions |
|
115 */ |
|
116 TDblQueIter< CSession2 >& Sessions(); |
|
117 |
|
118 private: |
|
119 // From CServer |
|
120 |
|
121 /** |
|
122 * Create a time server session, and return a pointer to the created object |
|
123 * @param aVersion the client version |
|
124 * @result pointer to new session |
|
125 */ |
|
126 CSession2 * NewSessionL( const RMessage2& aMessage ) const; |
|
127 |
|
128 private: // from CUpnpSymbianServerBase |
|
129 |
|
130 /** |
|
131 * Return name of a server |
|
132 * @result name of a server |
|
133 */ |
|
134 const TDesC& ServerName() const; |
|
135 |
|
136 /** |
|
137 * Returns version that is supported by this server. |
|
138 */ |
|
139 virtual TVersion SupportedVersion() const; |
|
140 |
|
141 /** |
|
142 * Process any errors |
|
143 * @param aError the leave code reported. |
|
144 * @result return KErrNone if leave is handled |
|
145 */ |
|
146 TInt RunError( TInt aError ); |
|
147 |
|
148 private: |
|
149 |
|
150 // pointer to engine |
|
151 CUpnpMessageHandlerEngine* iEngine; |
|
152 |
|
153 // observers array |
|
154 RPointerArray<MMessageHandlerObserver> iObservers; |
|
155 |
|
156 // starting flag |
|
157 TBool iSsdpStarted; |
|
158 |
|
159 // start error flag |
|
160 TInt iStartingError; |
|
161 }; |
|
162 |
|
163 #endif // C_CUPNPMESSAGEHANDLER_H |