|
1 // Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #ifndef __ASSRVDATAPOOL_H__ |
|
17 #define __ASSRVDATAPOOL_H__ |
|
18 |
|
19 // System includes |
|
20 #include <s32strm.h> |
|
21 |
|
22 // User includes |
|
23 #include "ASSrvAlarmQueueObserver.h" |
|
24 |
|
25 // Classes referenced |
|
26 class CASSrvServerWideData; |
|
27 |
|
28 |
|
29 // |
|
30 // ----> CASSrvDataPool (header) |
|
31 // |
|
32 /** |
|
33 * Responsible for maintaining the assocation between AlarmIds and their arbitrary |
|
34 * data. |
|
35 */ |
|
36 class CASSrvDataPool : public CBase, public MASSrvAlarmQueueObserver |
|
37 { |
|
38 // |
|
39 public: // STATIC CONSTRUCT / DESTRUCT |
|
40 // |
|
41 static CASSrvDataPool* NewL(CASSrvServerWideData& aServerWideData); |
|
42 ~CASSrvDataPool(); |
|
43 |
|
44 // |
|
45 private: // INTERNAL CONSTRUCT |
|
46 // |
|
47 CASSrvDataPool(CASSrvServerWideData& aServerWideData); |
|
48 void ConstructL(); |
|
49 |
|
50 // |
|
51 public: // ACCESS |
|
52 // |
|
53 |
|
54 TBool DataPoolContainsEntry(TAlarmId aAlarmId) const; |
|
55 |
|
56 const TDesC8& DataPoolEntry(TAlarmId aAlarmId) const; |
|
57 |
|
58 void DataPoolAddDataL(TAlarmId aAlarmId, HBufC8* aData); |
|
59 |
|
60 void DataPoolRemoveDataL(TAlarmId aAlarmId); |
|
61 |
|
62 // |
|
63 public: // STORE FRAMEWORK |
|
64 // |
|
65 |
|
66 void InternalizeL(RReadStream& aStream); |
|
67 |
|
68 void ExternalizeL(RWriteStream& aStream) const; |
|
69 |
|
70 void ApplyInternalizedData(TBool aUseNewData); |
|
71 |
|
72 // |
|
73 private: // FROM MASSrvAlarmQueueObserver |
|
74 // |
|
75 |
|
76 void MAlarmQueueObserverHandleEvent(TASSrvAlarmQueueEvent aEvent, TAlarmId aAlarmId); |
|
77 |
|
78 // |
|
79 private: // INTERNAL |
|
80 // |
|
81 |
|
82 /** |
|
83 * Access the server wide data |
|
84 */ |
|
85 inline CASSrvServerWideData& ServerData() const { return iServerWideData; } |
|
86 |
|
87 TInt FindEntry(TAlarmId aAlarmId) const; |
|
88 |
|
89 // |
|
90 private: // INTERNAL CLASSES |
|
91 // |
|
92 |
|
93 // |
|
94 // ----> CASSrvAlarmDataMapplet (header) |
|
95 // |
|
96 /** |
|
97 * Implements a relationship between alarm id and alarm data |
|
98 */ |
|
99 class CASSrvAlarmDataMapplet : public CBase |
|
100 { |
|
101 // |
|
102 public: // STATIC CONSTRUCT / DESTRUCT |
|
103 // |
|
104 static CASSrvAlarmDataMapplet* NewLC(TAlarmId aAlarmId, HBufC8* aAlarmData); |
|
105 ~CASSrvAlarmDataMapplet(); |
|
106 |
|
107 // |
|
108 private: // INTERNAL CONSTRUCT |
|
109 // |
|
110 CASSrvAlarmDataMapplet(TAlarmId aAlarmId, HBufC8* aAlarmData); |
|
111 |
|
112 // |
|
113 public: // ACCESS |
|
114 // |
|
115 |
|
116 /** |
|
117 * Return the alarm id |
|
118 */ |
|
119 inline TAlarmId Id() const { return iAlarmId; } |
|
120 |
|
121 /** |
|
122 * Return a reference to the alarm data for this entry |
|
123 */ |
|
124 inline const TDesC8& Data() const { return *iAlarmData; } |
|
125 |
|
126 // |
|
127 private: // INTERNAL CONSTRUCT |
|
128 // |
|
129 |
|
130 /** |
|
131 * The alarm id |
|
132 */ |
|
133 TAlarmId iAlarmId; |
|
134 |
|
135 /** |
|
136 * The alarm data |
|
137 */ |
|
138 HBufC8* iAlarmData; |
|
139 }; |
|
140 |
|
141 // |
|
142 private: // MEMBER DATA |
|
143 // |
|
144 |
|
145 /** |
|
146 * A handle to the server wide data. |
|
147 */ |
|
148 CASSrvServerWideData& iServerWideData; |
|
149 |
|
150 /** |
|
151 * The list of mappings between Alarm Id's and their associated arbitrary data. |
|
152 */ |
|
153 RPointerArray<CASSrvAlarmDataMapplet> iDataEntries; |
|
154 |
|
155 /** |
|
156 * Buffer for Internalize to read in The list of mappings between Alarm Id's |
|
157 * and their associated arbitrary data. |
|
158 */ |
|
159 RPointerArray<CASSrvAlarmDataMapplet> iInternalizeDataEntries; |
|
160 }; |
|
161 |
|
162 #endif |