|
1 /* |
|
2 * Copyright (c) 2008-2008 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: CCFContextService class declaration. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CFCONTEXTSERVICE_H |
|
20 #define CFCONTEXTSERVICE_H |
|
21 |
|
22 // SYSTEM INCLUDE FILES |
|
23 #include <cfcontextobject.h> |
|
24 #include <cfcontextquery.h> |
|
25 #include <cfcontextsubscription.h> |
|
26 |
|
27 // USER INCLUDE FILES |
|
28 #include "cfservicebase.h" |
|
29 |
|
30 // FORWARD DECLARATIONS |
|
31 |
|
32 // DATA TYPES |
|
33 |
|
34 // CLASS DECLARATION |
|
35 class CCFContextSubscriptionListener; |
|
36 class CCFServerMessageListener; |
|
37 class CCFContextDataObject; |
|
38 |
|
39 /** |
|
40 * Context service class. |
|
41 * |
|
42 * @lib cfclient.lib |
|
43 * @since S60 5.0 |
|
44 */ |
|
45 NONSHARABLE_CLASS( CCFContextService ): public CCFServiceBase |
|
46 { |
|
47 public: |
|
48 |
|
49 /** |
|
50 * Symbian two phased constructors. |
|
51 * |
|
52 * @since S60 5.0 |
|
53 * @param None. |
|
54 * @return CCFContextService |
|
55 */ |
|
56 static CCFContextService* NewL( RCFClientSession& aSession, |
|
57 MCFListener& aListener ); |
|
58 static CCFContextService* NewLC( RCFClientSession& aSession, |
|
59 MCFListener& aListener ); |
|
60 |
|
61 /** |
|
62 * C++ destructor. |
|
63 */ |
|
64 virtual ~CCFContextService( ); |
|
65 |
|
66 public: |
|
67 |
|
68 // @see CCFClient |
|
69 void PublishContextL( CCFContextObject& aContext ); |
|
70 |
|
71 // @see CCFClient |
|
72 void PublishContextL( CCFContextObject& aContext, |
|
73 CCFContextDataObject& aData ); |
|
74 |
|
75 // @see CCFClient |
|
76 void SubscribeContextL( CCFContextSubscription& aSubscription ); |
|
77 |
|
78 // @see CCFClient |
|
79 void UnsubscribeContextL( |
|
80 CCFContextSubscription& aSubscription); |
|
81 |
|
82 // @see CCFClient |
|
83 void RequestContextL( CCFContextQuery& aContextQuery, |
|
84 RContextObjectArray& aRequestResults); |
|
85 |
|
86 // @see CCFClient |
|
87 void RequestContextSetL( RContextQueryArray& aContextQuerySet, |
|
88 RContextObjectArray& aRequestResults); |
|
89 |
|
90 // @see CCFClient |
|
91 TInt DefineContext( const TDesC& aContextSource, |
|
92 const TDesC& aContextType, |
|
93 const TSecurityPolicy& aReadSecurityPolicy, |
|
94 const TSecurityPolicy& aWriteSecurityPolicy ); |
|
95 |
|
96 // @see CCFClient |
|
97 TInt InstallContextSourceSetting( const TDesC& aSettingFilename, |
|
98 const TUid& aContextSourceUid ); |
|
99 |
|
100 // @see CCFClient |
|
101 TInt UninstallContextSourceSetting( const TDesC& aSettingFilename, |
|
102 const TUid& aContextSourceUid ); |
|
103 |
|
104 // @see CCFClient |
|
105 TInt UninstallContextSourceSettings( const TUid& aContextSourceUid ); |
|
106 |
|
107 private: |
|
108 |
|
109 // Checks is context is legal |
|
110 TBool IsContextLegalForAdd( const CCFContextObject& aContext ); |
|
111 |
|
112 // Checks is context data is legal |
|
113 TInt IsContextDataLegalForAdd( const CCFContextDataObject& aContextData ); |
|
114 |
|
115 // Read context objects from request stream |
|
116 void ReadStreamContextObjectL( const TDesC8& aData, |
|
117 RContextObjectArray& aArray ); |
|
118 |
|
119 // Stream context subscription |
|
120 HBufC8* WriteStreamContextSubscriptionLC( |
|
121 CCFContextSubscription& aSubscription ); |
|
122 |
|
123 // Stream context object |
|
124 HBufC8* WriteStreamContextObjectLC( CCFContextObject& aContext ); |
|
125 |
|
126 // Stream context query array |
|
127 HBufC8* WriteStreamContextQueryLC( RContextQueryArray& aQueryArray ); |
|
128 |
|
129 // Stream context query array |
|
130 HBufC8* WriteStreamContextQueryLC( CCFContextQuery& aQuery ); |
|
131 |
|
132 // Stream context data object |
|
133 HBufC8* WriteStreamContextDataObjectLC( |
|
134 CCFContextDataObject& aContextData ); |
|
135 |
|
136 private: |
|
137 |
|
138 CCFContextService( RCFClientSession& aSession, MCFListener& aListener ); |
|
139 void ConstructL( ); |
|
140 |
|
141 private: // Data |
|
142 |
|
143 /** Request buffer dynamic size */ |
|
144 TInt iRequestBufferSize; |
|
145 |
|
146 /** Context data object maximum size **/ |
|
147 TInt iContextDataMaxSize; |
|
148 |
|
149 /** Context subscription listener */ |
|
150 CCFContextSubscriptionListener* iContextSubscriptionListener; |
|
151 |
|
152 /** Server message listener */ |
|
153 CCFServerMessageListener* iServerMessageListener; |
|
154 }; |
|
155 |
|
156 #endif // CFCONTEXTSERVICE_H |
|
157 |