|
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 the Classes CUpnpSubscriberLibrary |
|
15 * MUpnpSubscriberLibraryObserver |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #ifndef C_CUPNPSUBSCRIBERLIBRARY_H |
|
21 #define C_CUPNPSUBSCRIBERLIBRARY_H |
|
22 |
|
23 // INCLUDES |
|
24 |
|
25 //#include "upnpsubscriberlibraryelement.h" |
|
26 |
|
27 #include "upnptimeoutelement.h" |
|
28 #include "upnperrors.h" |
|
29 |
|
30 |
|
31 // FORWARD DECLARATIONS |
|
32 |
|
33 class CUpnpGenaMessage; |
|
34 class CUpnpStateVariable; |
|
35 class MUpnpSubscriberLibraryObserver; |
|
36 class CUpnpSubscriberLibraryElement; |
|
37 // CLASS DECLARATION |
|
38 |
|
39 /** |
|
40 * The Subscriber Library main class. |
|
41 * This class contains an array of subscriber library elements |
|
42 * (of type CUpnpSubscriberLibraryElement). This list is maintained up-to-date |
|
43 * by received subsription GENA messages. Every element in the library has |
|
44 * a timeout. If subscription isn't renewed, it is removed from the library |
|
45 * after subscription timeout is expired. A subsriber is also removed, |
|
46 * if it send a unsubsription message. |
|
47 * |
|
48 * @since Series60 2.6 |
|
49 */ |
|
50 class CUpnpSubscriberLibrary : public CBase, public MUpnpTimeoutElementParent |
|
51 { |
|
52 public: // Constructors and destructor |
|
53 |
|
54 /** |
|
55 * Two-phased constructor. |
|
56 * @param aObserver |
|
57 * @return The new instance. |
|
58 */ |
|
59 static CUpnpSubscriberLibrary* NewL( MUpnpSubscriberLibraryObserver& aObserver ); |
|
60 |
|
61 /** |
|
62 * Destructor. |
|
63 */ |
|
64 virtual ~CUpnpSubscriberLibrary(); |
|
65 |
|
66 public: // New functions |
|
67 |
|
68 /** |
|
69 * Adds a new subscriber or renews an existing. |
|
70 * @since Series60 2.6 |
|
71 * @param aMessage GENA-message. |
|
72 * @param aElement CUpnpSubscriberLibraryElement. |
|
73 * @return TUpnpErrorCode. |
|
74 */ |
|
75 TUpnpErrorCode AddInfoL( CUpnpGenaMessage* aMessage, |
|
76 CUpnpSubscriberLibraryElement** aElement ); |
|
77 |
|
78 /** |
|
79 * Find SID |
|
80 * @since Series60 2.6 |
|
81 * @param aSid SID of an subscriber |
|
82 * @return Index number. If SID isn't found KErrNotFound is returned. |
|
83 */ |
|
84 TInt Find( const TDesC8& aSid ); |
|
85 |
|
86 /** |
|
87 * Returns subscriber library. |
|
88 * @since Series60 2.6 |
|
89 * @return Array of subscriber library elements. |
|
90 */ |
|
91 RPointerArray<CUpnpSubscriberLibraryElement> SubscriberLibrary() const; |
|
92 |
|
93 /** |
|
94 * Remove subscriber |
|
95 * @since Series60 2.6 |
|
96 * @param aSid SID of an subscriber to be removed. |
|
97 * @return EHttpOk if succeed, EPreconditionFailed if not. |
|
98 */ |
|
99 TUpnpErrorCode Remove( const TDesC8& aSid ); |
|
100 |
|
101 public: // From MUpnpTimeoutElementParent |
|
102 |
|
103 /** |
|
104 * Timeout callback function |
|
105 * @since Series60 2.6 |
|
106 * @param aElement The element whose timeout has ran out |
|
107 */ |
|
108 void TimeoutExpiredL( CUpnpTimeoutElement* aElement ); |
|
109 |
|
110 private: // Constructors |
|
111 |
|
112 /** |
|
113 * C++ default constructor. |
|
114 * @param aObserver Observer. |
|
115 */ |
|
116 CUpnpSubscriberLibrary( MUpnpSubscriberLibraryObserver& aObserver ); |
|
117 |
|
118 /** |
|
119 * By default Symbian 2nd phase constructor is private. |
|
120 */ |
|
121 void ConstructL(); |
|
122 |
|
123 private: |
|
124 |
|
125 // Subscribe library observer, not owned |
|
126 MUpnpSubscriberLibraryObserver& iObserver; |
|
127 |
|
128 // List of subscriber library elements, owned |
|
129 RPointerArray<CUpnpSubscriberLibraryElement> iElementArray; |
|
130 }; |
|
131 |
|
132 #endif // C_CUPNPSUBSCRIBERLIBRARY_H |
|
133 |
|
134 //End of File |