1 /** @file |
|
2 * Copyright (c) 2005-2006 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: Implementation of CServer2 |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_CUPNPAVCPENGINE_H |
|
20 #define C_CUPNPAVCPENGINE_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32base.h> |
|
24 #include "upnpavcpengine.pan" |
|
25 |
|
26 // FORWARD DECLARATIONS |
|
27 class CUpnpAVCPEngineSession; |
|
28 class CUpnpAVCPManager; |
|
29 |
|
30 // CLASS DECLARATION |
|
31 /** |
|
32 * Simple imlementatation of server from |
|
33 * Symbian Client/Server architecture. |
|
34 * |
|
35 * @since Series 60 3.1 |
|
36 */ |
|
37 class CUpnpAVCPEngine: public CServer2 |
|
38 { |
|
39 public : |
|
40 /** |
|
41 * Two-phased constructor. |
|
42 */ |
|
43 static CUpnpAVCPEngine* NewLC(); |
|
44 /** |
|
45 * Destructor. |
|
46 */ |
|
47 ~CUpnpAVCPEngine(); |
|
48 /** |
|
49 * Register new server-side session |
|
50 * it is used for manage life-time of server |
|
51 */ |
|
52 void IncrementSessions(CUpnpAVCPEngineSession* aObserver); |
|
53 /** |
|
54 * Unregister new server-side session |
|
55 * it is used for manage life-time of server |
|
56 */ |
|
57 void DecrementSessions(CUpnpAVCPEngineSession* aObserver); |
|
58 /** |
|
59 * Function stars server, creates CleanupStack and |
|
60 * executes ThreadFunctionL() in TRAP |
|
61 */ |
|
62 static TInt ThreadFunction( TAny* aStarted ); |
|
63 /** |
|
64 * Function creates CActiveScheduler, CUpnpAVCPEngine and starts server. |
|
65 */ |
|
66 static void ThreadFunctionL(); |
|
67 |
|
68 protected: // From CActive |
|
69 /** |
|
70 * From CActive notify about leaves in CService2::ServiceL |
|
71 */ |
|
72 TInt RunError( TInt aError ); |
|
73 |
|
74 private: // New methods |
|
75 /** |
|
76 * C++ default constructor. |
|
77 */ |
|
78 CUpnpAVCPEngine( TInt aPriority ); |
|
79 /** |
|
80 * Symbian 2nd phase constructor. |
|
81 */ |
|
82 void ConstructL() ; |
|
83 /** |
|
84 * Panic client thread |
|
85 * |
|
86 * @param aMessage message to be panic |
|
87 * @param aReason panic code |
|
88 */ |
|
89 static void PanicClient( const RMessage2& aMessage, TAVCPEnginePanic aReason ); |
|
90 /** |
|
91 * Panic server |
|
92 * |
|
93 * @param aPanic panic code |
|
94 */ |
|
95 static void PanicServer( TAVCPEnginePanic aPanic ); |
|
96 |
|
97 private: // From CServer |
|
98 /** |
|
99 * From CActive notify about leaves in ServiceL |
|
100 */ |
|
101 CSession2* NewSessionL( const TVersion& aVersion, const RMessage2& aMessage ) const; |
|
102 |
|
103 private: // Data |
|
104 // count of session |
|
105 TInt iSessionCount; |
|
106 // AVCP manager |
|
107 CUpnpAVCPManager* iAVCPManger; |
|
108 }; |
|
109 |
|
110 |
|
111 #endif // C_CUPNPAVCPENGINE_H |
|