1 /* |
|
2 * Copyright (c) 2007 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: SIMPLE Protocol implementation for Presence Framework |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 #ifndef C_SIMPLEPLUGINDATA_H |
|
22 #define C_SIMPLEPLUGINDATA_H |
|
23 |
|
24 |
|
25 // Includes |
|
26 #include <e32std.h> |
|
27 |
|
28 class MXIMPObjectFactory; |
|
29 class MXIMPIdentity; |
|
30 |
|
31 class MPresenceObjectFactory; |
|
32 class MSimpleDocument; |
|
33 class MPresenceInfo; |
|
34 class MSimplePresenceList; |
|
35 class MPresenceInfoFieldCollection; |
|
36 class MPersonPresenceInfo; |
|
37 class MPresenceInfoFieldValueEnum; |
|
38 class MSimpleElement; |
|
39 class MPresenceInfoFieldValueText; |
|
40 |
|
41 |
|
42 /** |
|
43 * CSimplePluginData |
|
44 * |
|
45 * This provides data conversion between SIMPLE Engine and PrFw data strcutres. |
|
46 * |
|
47 * @lib simplexmlutils |
|
48 * @since s60 v5.0 |
|
49 */ |
|
50 NONSHARABLE_CLASS(CSimplePluginData) : public CBase |
|
51 { |
|
52 public: |
|
53 |
|
54 static CSimplePluginData* NewL( ); |
|
55 |
|
56 static CSimplePluginData* NewLC(); |
|
57 |
|
58 virtual ~CSimplePluginData(); |
|
59 |
|
60 /** |
|
61 * Convert to engine notification to MPresenceInfo |
|
62 * @param aPresenceFactory PrFw Presence Factory |
|
63 * @param aDocument notification |
|
64 * @param aPrInfo PrFW info structure [out] |
|
65 */ |
|
66 static void NotifyToPrInfoL( |
|
67 MPresenceObjectFactory& aPresenceFactory, |
|
68 MSimpleDocument& aDocument, |
|
69 MPresenceInfo& aPrInfo ); |
|
70 |
|
71 /** |
|
72 * Convert to engine list notification to MPresenceInfo elements |
|
73 * @param aFactory PrFw Factory |
|
74 * @param aPresenceFactory PrFw Presence Factory |
|
75 * @param aList notification |
|
76 * @param aEntities array of PrFW info structure [out] |
|
77 * @param aTerminated array of PrFW info structure for terminated entities [out] |
|
78 * @param aFullList ETrue if full state list [out] |
|
79 */ |
|
80 static void NotifyListToPrInfoL( |
|
81 MXIMPObjectFactory& aFactory, |
|
82 MPresenceObjectFactory& aPresenceFactory, |
|
83 MSimplePresenceList& aList, |
|
84 RPointerArray<MPresenceInfo>& aEntities, |
|
85 RPointerArray<MXIMPIdentity>& aActives, |
|
86 RPointerArray<MXIMPIdentity>& aTerminated, |
|
87 TBool& aFullList ); |
|
88 |
|
89 /** |
|
90 * Converts MPersonPresenceInfo to MSimpleDocument elements |
|
91 * @param aInfo Person's presence info [in] |
|
92 * @param aDocument PIDF document containing Person's presence info [out] |
|
93 * @param aSipId Person's SIP indetity |
|
94 */ |
|
95 static void AddPrPersToSimpleDocumentL( |
|
96 const MPersonPresenceInfo* aInfo, |
|
97 MSimpleDocument& aDocument, |
|
98 const TDesC8& aSipId ); |
|
99 |
|
100 |
|
101 private: |
|
102 |
|
103 CSimplePluginData(); |
|
104 |
|
105 void ConstructL( ); |
|
106 |
|
107 static void UserOverridingWillingnessToPrFwL( |
|
108 MPresenceObjectFactory& aPresenceFactory, |
|
109 MSimpleElement* aElement, |
|
110 MPresenceInfoFieldCollection& aCollection ); |
|
111 |
|
112 static void UserStatusIconToPrFwL( |
|
113 MPresenceObjectFactory& aPresenceFactory, |
|
114 MSimpleElement* aElement, |
|
115 MPresenceInfoFieldCollection& aCollection, |
|
116 MSimpleDocument& aDocument ); |
|
117 |
|
118 static void UserNoteToPrFwL( |
|
119 MPresenceObjectFactory& aPresenceFactory, |
|
120 MSimpleElement* aElement, |
|
121 MPresenceInfoFieldCollection& aCollection ); |
|
122 |
|
123 static void CollectAllPresentitiesL( |
|
124 RPointerArray<MPresenceInfo>& aEntities, |
|
125 RPointerArray<MXIMPIdentity>& aActives, |
|
126 RPointerArray<MSimpleDocument>& aDocs, |
|
127 MXIMPObjectFactory& aFactory, |
|
128 MPresenceObjectFactory& aPresenceFactory ); |
|
129 |
|
130 /** |
|
131 * Add terminated instances into array |
|
132 * @param aTerminated list of PrFw indetities [OUT] |
|
133 * @param aElems RLS meta data list entry elements |
|
134 * @param aFactory PrFw Factory |
|
135 */ |
|
136 static void CollectTerminatedPresentitiesL( |
|
137 RPointerArray<MXIMPIdentity>& aTerminated, |
|
138 RPointerArray<MSimpleElement>& aElems, |
|
139 MXIMPObjectFactory& aFactory ); |
|
140 |
|
141 /** |
|
142 * Search the latest timestamp in the elements |
|
143 * @param aElems element array |
|
144 * @retun position of the latest element in the element array. KErrNotFound if not found. |
|
145 */ |
|
146 static TInt SearchLatestTimestampL( |
|
147 RPointerArray<MSimpleElement>& aElems ); |
|
148 |
|
149 /** |
|
150 * Add availability info into SIMPLE document |
|
151 * @param aText new value [IN] |
|
152 * @param aPersElem personal data to be modified [OUT] |
|
153 */ |
|
154 static void AddPrPersAvailabilityToDocL( |
|
155 const MPresenceInfoFieldValueText* aText, |
|
156 MSimpleElement* aPersElem ); |
|
157 |
|
158 /** |
|
159 * Check if the current element is terminated instance. |
|
160 * If yes then add the aUri into aTerminated |
|
161 * @param aTerminated list of PrFw indetities [OUT] |
|
162 * @param aElem current element |
|
163 * @param aUri8 corresponding sip entity URI |
|
164 * @param aFactory PrFw Factory |
|
165 */ |
|
166 static void SearchTerminatedInstanceL( |
|
167 RPointerArray<MXIMPIdentity>& aTerminated, |
|
168 MSimpleElement* aElem, |
|
169 const TDesC8* aUri8, |
|
170 MXIMPObjectFactory& aFactory ); |
|
171 |
|
172 |
|
173 |
|
174 }; |
|
175 |
|
176 |
|
177 |
|
178 #endif // C_SIMPLEPLUGINDATA_H |
|