|
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: Media Server session |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef C_CUPNPMEDIASERVERSESSION_H |
|
21 #define C_CUPNPMEDIASERVERSESSION_H |
|
22 |
|
23 |
|
24 |
|
25 // INCLUDES |
|
26 #include "upnpmediaserver.h" |
|
27 #include "upnpmediaserverglobals.h" |
|
28 #include "upnpmediaserverobserver.h" |
|
29 |
|
30 #include <e32base.h> |
|
31 |
|
32 |
|
33 // FORWARD DECLARATIONS |
|
34 class CUpnpObject; |
|
35 class CUpnpItemList; |
|
36 class CUpnpBrowseCriteria; |
|
37 class CUpnpMediaServerEventHandler; |
|
38 // CLASS DECLARATION |
|
39 |
|
40 /** |
|
41 An instance of class CUpnpMediaServerSession is created for each client |
|
42 */ |
|
43 class CUpnpMediaServerSession : public CSession2 |
|
44 { |
|
45 public: // New methods |
|
46 /** |
|
47 * Create a CUpnpMediaServerSession object using two phase construction, |
|
48 * and return a pointer to the created object |
|
49 * @result pointer to new session |
|
50 */ |
|
51 static CUpnpMediaServerSession* NewL(CUpnpMediaServer* aServer); |
|
52 |
|
53 /** |
|
54 * Create a CUpnpMediaServerSession object using two phase construction, |
|
55 * and return a pointer to the created object |
|
56 * @result pointer to new session |
|
57 */ |
|
58 static CUpnpMediaServerSession* NewLC(CUpnpMediaServer* aServer); |
|
59 |
|
60 /** |
|
61 * Destroy the object and release all memory objects |
|
62 */ |
|
63 virtual ~CUpnpMediaServerSession(); |
|
64 |
|
65 /** |
|
66 * Notify client about status change |
|
67 */ |
|
68 void StatusChanged(); |
|
69 |
|
70 public: // From CSession |
|
71 /** |
|
72 * Called after a service request from client; from class CSession |
|
73 * @param aMessage message from client (containing requested operation and any data) |
|
74 */ |
|
75 void ServiceL( const RMessage2& aMessage ); |
|
76 |
|
77 private: // New methods |
|
78 |
|
79 /** |
|
80 * Perform the first phase of two phase construction |
|
81 */ |
|
82 CUpnpMediaServerSession(CUpnpMediaServer* aServer); |
|
83 |
|
84 /** |
|
85 * Perform the second phase construction of a CUpnpMediaServerSession object |
|
86 */ |
|
87 void ConstructL() ; |
|
88 |
|
89 /** |
|
90 * Causes the client thread to panic |
|
91 * @param panic code |
|
92 */ |
|
93 void PanicClient( const RMessage2& aMessage, TInt aPanic ) const; |
|
94 |
|
95 private: |
|
96 void ReadObjFromMessageL( const RMessage2& aMessage, TInt aSlot, CUpnpObject* aObj ); |
|
97 void ReadItemFromMessageL( const RMessage2& aMessage, TInt aSlot, CUpnpItem* aItem ); |
|
98 void ReadObjFromMessageL( const RMessage2& aMessage, TInt aSlot, CUpnpItemList* aItemList ) ; |
|
99 void ReadObjFromMessageL( const RMessage2& aMessage, TInt aSlot, |
|
100 CUpnpBrowseCriteria* aBrowseCriteria ); |
|
101 |
|
102 // functions for various events from client |
|
103 void EventMediaServerStatusL( const RMessage2& aMessage ); |
|
104 void EventMediaServerStartL( const RMessage2& aMessage ); |
|
105 void EventMediaServerStop( const RMessage2& aMessage ); |
|
106 void EventMediaServerStopSilent( const RMessage2& aMessage ); |
|
107 void EventMediaServerSetFriendlyNameL( const RMessage2& aMessage ); |
|
108 void EventMediaServerRestartL( const RMessage2& aMessage ); |
|
109 void EventMediaServerShareItemL( const RMessage2& aMessage ) ; |
|
110 void EventMediaServerShareContainerL( const RMessage2& aMessage ) ; |
|
111 void EventMediaServerShareItemListL( const RMessage2& aMessage ); |
|
112 void EventMediaServerGetShareItemResultL( const RMessage2& aMessage ); |
|
113 void EventMediaServerGetShareContainerResultL( const RMessage2& aMessage ); |
|
114 void EventMediaServerGetShareItemListResultL( const RMessage2& aMessage ); |
|
115 void EventMediaServerUnshareRootL( const RMessage2& aMessage ); |
|
116 void EventMediaServerUnshareItemL( const RMessage2& aMessage ); |
|
117 void EventMediaServerUnshareContainerL( const RMessage2& aMessage ); |
|
118 void EventMediaServerGetSharedItemL( const RMessage2& aMessage ); |
|
119 void EventMediaServerGetGetSharedItemResultL( const RMessage2& aMessage ); |
|
120 void EventMediaServerGetSharedContainerL( const RMessage2& aMessage ); |
|
121 void EventMediaServerGetGetSharedContainerResultL( const RMessage2& aMessage ); |
|
122 void ReadIdsFromMessageL( const RMessage2& aMessage, TInt aSlot, RArray<TInt>& aObjIds ); |
|
123 void EventMediaServerUnshareItemListL( const RMessage2& aMessage ); |
|
124 void EventMediaServerGetSharedItemListL( const RMessage2& aMessage ); |
|
125 void EventMediaServerGetGetSharedItemListResultL( const RMessage2& aMessage ); |
|
126 void EventMediaServerGetSharedContainerListL( const RMessage2& aMessage ); |
|
127 void EventMediaServerGetGetSharedContainerListResultL( const RMessage2& aMessage ); |
|
128 void EventMediaServerStartOfflineL( const RMessage2& aMessage ); |
|
129 void EventMediaServerGetIpAndPortL( const RMessage2& aMessage ); |
|
130 void EventSetUploadDirectoryL(const RMessage2& aMessage ); |
|
131 void EventAddIconL( const RMessage2& aMessage ); |
|
132 void EventUpdateIconL( const RMessage2& aMessage ); |
|
133 void EventRemoveIconL( const RMessage2& aMessage ); |
|
134 void EventRemoveIconsL( const RMessage2& aMessage ); |
|
135 |
|
136 void EventMediaServerShareReferenceL( const RMessage2& aMessage ); |
|
137 void EventMediaServerShareReferenceListL( const RMessage2& aMessage ); |
|
138 void EventMediaServerStatusChange( const RMessage2& aMessage ); |
|
139 void EventMediaServerStatusChangeCancel( const RMessage2& aMessage ); |
|
140 |
|
141 private: |
|
142 |
|
143 /** @var iMediaServer pointer to Media Server */ |
|
144 CUpnpMediaServer* iMediaServer; |
|
145 HBufC8* iResponseBuffer; |
|
146 TInt iRespLength; |
|
147 TPckg<TInt> iRespLengthPkg; |
|
148 TInt iRespExecStatus; |
|
149 TPckg<TInt> iRespExecStatusPkg; |
|
150 |
|
151 CUpnpMediaServerEventHandler* iEventHandler; |
|
152 RMessage2 iStatusMessage; |
|
153 }; |
|
154 |
|
155 #endif // C_CUPNPMEDIASERVERSESSION_H |