|
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: defines CUpnpConnManagerSession |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef C_CUPNPCONNMANAGERSESSION_H |
|
19 #define C_CUPNPCONNMANAGERSESSION_H |
|
20 |
|
21 #include <e32base.h> |
|
22 #include "upnpconnmanagercommon.h" |
|
23 #include "upnpconnectionmanagernetworkevent.h" |
|
24 |
|
25 class CUpnpConnectionManager; |
|
26 class CUpnpConnManagerEngine; |
|
27 |
|
28 /** |
|
29 * An instance of class CUpnpConnManagerSession is created for each client |
|
30 * @since S60 5.0 |
|
31 */ |
|
32 class CUpnpConnManagerSession : public CSession2 |
|
33 { |
|
34 |
|
35 public: // New methods |
|
36 |
|
37 /** |
|
38 * Create a CUpnpConnManagerSession object using two phase construction, |
|
39 * and return a pointer to the created object |
|
40 * @param aEngine the message handler engine |
|
41 * @result pointer to new session |
|
42 */ |
|
43 static CUpnpConnManagerSession* NewL( CUpnpConnManagerEngine& aEngine ); |
|
44 |
|
45 /** |
|
46 * Create a CUpnpConnManagerSession object using two phase construction, |
|
47 * and return a pointer to the created object |
|
48 * (leaving a pointer to the object on the cleanup stack) |
|
49 * @param anEngine the message handler engine |
|
50 * @result pointer to new session |
|
51 */ |
|
52 static CUpnpConnManagerSession* NewLC( CUpnpConnManagerEngine& aEngine ); |
|
53 |
|
54 /** |
|
55 * Destroy the object and release all memory objects |
|
56 */ |
|
57 virtual ~CUpnpConnManagerSession(); |
|
58 |
|
59 public: // From CSession |
|
60 |
|
61 /** |
|
62 * Called after a service request from client; from class CSession |
|
63 * @param aMessage message from client (containing requested operation and any data) |
|
64 */ |
|
65 void ServiceL( const RMessage2& aMessage ); |
|
66 |
|
67 /** |
|
68 * Cancels subscription for network events |
|
69 */ |
|
70 void CancelSubscription(); |
|
71 |
|
72 /** |
|
73 * Called when WLan Lost occurs or someone stops the connection |
|
74 */ |
|
75 void WLanLostOccuredL(); |
|
76 |
|
77 /** |
|
78 * Called when interface IP Address has changed |
|
79 * @param new address |
|
80 */ |
|
81 void AddressChangeOccuredL( TInetAddr& aAddr ); |
|
82 |
|
83 /** |
|
84 * Returns value of iSessionUseConnection variable |
|
85 */ |
|
86 TBool SessionUseConnection(); |
|
87 |
|
88 /** |
|
89 * Called when connection was closed by server |
|
90 */ |
|
91 void ConnectionClosedL(); |
|
92 |
|
93 private: // New methods |
|
94 |
|
95 /** |
|
96 * Perform the first phase of two phase construction |
|
97 * @param aServer the message handler server |
|
98 * @param aEngine the message handler engine |
|
99 */ |
|
100 CUpnpConnManagerSession( CUpnpConnManagerEngine& aEngine ); |
|
101 |
|
102 /** |
|
103 * Causes the client thread to panic |
|
104 * @param panic code |
|
105 */ |
|
106 void PanicClient( const RMessage2& aMessage, TInt aPanic ) const; |
|
107 |
|
108 private: |
|
109 |
|
110 // Events service functions |
|
111 TInt EventEnsureStartRConnectionL( const RMessage2& aMessage ); |
|
112 void EventIsRConnectionStartedL( const RMessage2& aMessage ); |
|
113 void EventSubscribeToNetworkEventL( const RMessage2& aMessage ); |
|
114 void EventCancelSubscribeToNetworkEvent( ); |
|
115 void EventActiveIapL( const RMessage2& aMessage ); |
|
116 void EventLocalAddressL( const RMessage2& aMessage ); |
|
117 |
|
118 // Conpletions of NetworkEvent events |
|
119 void WLanLostCompleteL(); |
|
120 void AddressChangeCompleteL(); |
|
121 void ConnectionClosedCompleteL(); |
|
122 |
|
123 private: |
|
124 |
|
125 /* @var iEngine Reference to the message handler engine */ |
|
126 CUpnpConnManagerEngine& iConnEngine; |
|
127 |
|
128 /* @var iSubsriberMessage subscriber's message */ |
|
129 RMessage2 iSubscriberMessage; |
|
130 |
|
131 /* @var iLastEvent the last network event */ |
|
132 TUpnpConnectionManagerNetworkEvent iLastEvent; |
|
133 |
|
134 /* @var iSessionUseConnection Indicates if session called EnsureStart() */ |
|
135 TBool iSessionUseConnection; |
|
136 |
|
137 }; |
|
138 |
|
139 #endif // C_CUPNPCONNMANAHERSESSION_H |