|
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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef CUPNPSSDPHANDLERUP_H |
|
21 #define CUPNPSSDPHANDLERUP_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32std.h> |
|
25 #include <e32base.h> |
|
26 #include "upnpssdphandlerbase.h" |
|
27 #include "upnpmsearchtimer.h" |
|
28 |
|
29 |
|
30 |
|
31 // CLASS DECLARATION |
|
32 class CUpnpDeviceLibrary; |
|
33 class CUpnpSsdpServer; |
|
34 class CUpnpNotifyTimer; |
|
35 |
|
36 |
|
37 // CONST DECLARATION |
|
38 const TInt KMXTimeBuffer = 10; |
|
39 |
|
40 |
|
41 // CLASS DECLARATION |
|
42 |
|
43 /** |
|
44 * CUpnpSsdpHandlerUp handles the state when ssdp servers |
|
45 * are up and running. |
|
46 */ |
|
47 class CUpnpSsdpHandlerUp : public CUpnpSsdpHandlerBase, |
|
48 public MUpnpNotifyTimerObserver |
|
49 { |
|
50 public: |
|
51 // Constructors and destructor |
|
52 |
|
53 /** |
|
54 * Destructor. |
|
55 */ |
|
56 ~CUpnpSsdpHandlerUp(); |
|
57 |
|
58 /** |
|
59 * Two-phased constructor. |
|
60 */ |
|
61 static CUpnpSsdpHandlerUp* NewL( MUpnpSsdpServerObserver& aSsdpServerObserver ); |
|
62 |
|
63 /** |
|
64 * Starts two ssdp servers - unicast and multicast |
|
65 * aSocketServ - reference to socket server session |
|
66 */ |
|
67 virtual void StartL( RSocketServ& aSocketServ ); |
|
68 |
|
69 |
|
70 /** |
|
71 * Stops two ssdp servers |
|
72 */ |
|
73 virtual void Stop(); |
|
74 |
|
75 /** |
|
76 * Starts sending ssdp m-search messages |
|
77 * aSearchString - The SSDP search string, that is placed to the |
|
78 * ST header of the SSDP message. |
|
79 * aMX - list of MX times for messages |
|
80 */ |
|
81 virtual void SsdpSearchL( const TDesC8& aSearchString, TDesC8& aMX ); |
|
82 |
|
83 /** |
|
84 * Stops two ssdp servers |
|
85 */ |
|
86 virtual void AdvertiseDeviceL( TInt aLive, CUpnpDeviceLibraryElement& aElement ); |
|
87 |
|
88 /** |
|
89 * Informs if start method was performed |
|
90 */ |
|
91 virtual TBool IsStarted(); |
|
92 |
|
93 /** |
|
94 * Method for address change event |
|
95 */ |
|
96 virtual void AddressChangeL( TInetAddr& aAddress ); |
|
97 |
|
98 /** |
|
99 * Increments control point session count |
|
100 */ |
|
101 TInt AddLocalControlPoint( ); |
|
102 |
|
103 /** |
|
104 * Decrements control point session count |
|
105 */ |
|
106 TInt RemoveLocalControlPoint( ); |
|
107 |
|
108 private: // from MUpnpNotifyTimerObserver |
|
109 |
|
110 void TimerEventL( CUpnpNotifyTimer* aTimer ); |
|
111 |
|
112 private: |
|
113 |
|
114 /** |
|
115 * Constructor for performing 1st stage construction |
|
116 */ |
|
117 CUpnpSsdpHandlerUp( MUpnpSsdpServerObserver& aSsdpServerObserver ); |
|
118 |
|
119 /** |
|
120 * EPOC default constructor for performing 2nd stage construction |
|
121 */ |
|
122 void ConstructL(); |
|
123 |
|
124 void ClearTimers(); |
|
125 |
|
126 private: |
|
127 |
|
128 // Unicast SSDP server instance |
|
129 CUpnpSsdpServer* iSsdpServer; |
|
130 |
|
131 // Multicast SSDP server instance |
|
132 CUpnpSsdpServer* iMulticastSsdpServer; |
|
133 |
|
134 // timers array |
|
135 RPointerArray<CUpnpMSearchTimer> iTimers; |
|
136 |
|
137 // Local control points counter |
|
138 TInt iCPCounter; |
|
139 |
|
140 }; |
|
141 |
|
142 #endif // CUPNPSSDPHANDLERUP_H |