|
1 /* |
|
2 * Copyright (c) 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: Context publishing helper dll |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef HGCONTEXTUTILITYBASE_H |
|
20 #define HGCONTEXTUTILITYBASE_H |
|
21 |
|
22 #include <e32base.h> |
|
23 #include <bamdesca.h> |
|
24 |
|
25 class CHgContextUtilityImpl; |
|
26 |
|
27 /** |
|
28 * Utility base class to publish and access context through the Context Framework. |
|
29 * @lib hgcontextutility.lib |
|
30 */ |
|
31 class CHgContextUtilityBase : public CBase |
|
32 { |
|
33 public: |
|
34 /** |
|
35 * Publishes context. |
|
36 * Also defines the context if it has not been defined. |
|
37 * Publishing empty value is not allowed, however such errors are ignored |
|
38 * here so the function will not leave when CFW responds with KErrArgument. |
|
39 * The security policy for the context will be set to require |
|
40 * LocalServices capability. |
|
41 * @param aContextType context type, source is always KHgCFSource |
|
42 * @param aContextData value for the context |
|
43 */ |
|
44 IMPORT_C void PublishContextL( const TDesC& aContextType, |
|
45 const TDesC& aContextData ); |
|
46 |
|
47 /** |
|
48 * Publishes context, the value will contain all the strings |
|
49 * from the given array, typically by using some separator character. |
|
50 * @see PublishContextL |
|
51 * @param aContextType context type, source is always KHgCFSource |
|
52 * @param aContextData value for the context will be a combined |
|
53 * version of all the strings from this array |
|
54 */ |
|
55 IMPORT_C void PublishContextL( const TDesC& aContextType, |
|
56 const MDesCArray& aContextData ); |
|
57 |
|
58 /** |
|
59 * Publishes context but only after a short interval, using a timer. |
|
60 * If it is called again before the timer expires then the timer |
|
61 * is restarted (and so the previous pending value is never published). |
|
62 * @param aContextType context type, source is always KHgCFSource |
|
63 * @param aContextData value for the context |
|
64 * @param aDelay delay for the timer, in microseconds |
|
65 */ |
|
66 IMPORT_C void PublishContextDelayedL( const TDesC& aContextType, |
|
67 const TDesC& aContextData, const TTimeIntervalMicroSeconds32& aDelay ); |
|
68 |
|
69 /** |
|
70 * Overload for delayed publishing of a value combined from multiple strings. |
|
71 * @param aContextType context type |
|
72 * @param aContextData string array |
|
73 * @param aDelay delay for the timer, in microseconds |
|
74 */ |
|
75 IMPORT_C void PublishContextDelayedL( const TDesC& aContextType, |
|
76 const MDesCArray& aContextData, const TTimeIntervalMicroSeconds32& aDelay ); |
|
77 |
|
78 /** |
|
79 * Requests the given context and returns the value for the |
|
80 * first result. Returns NULL if not found. |
|
81 * @param aContextType context type, the source is always KHgCFSource |
|
82 */ |
|
83 IMPORT_C HBufC* GetContextL( const TDesC& aContextType ); |
|
84 |
|
85 /** |
|
86 * Requests the given context and returns the value for the |
|
87 * first result. Returns NULL if not found. |
|
88 * @param aContextSource context source |
|
89 * @param aContextType context type |
|
90 */ |
|
91 IMPORT_C HBufC* GetContextL( const TDesC& aContextSource, |
|
92 const TDesC& aContextType ); |
|
93 |
|
94 protected: |
|
95 CHgContextUtilityBase(); |
|
96 ~CHgContextUtilityBase(); |
|
97 void BaseConstructL(); |
|
98 CHgContextUtilityImpl* iImpl; |
|
99 }; |
|
100 |
|
101 #endif /* HGCONTEXTUTILITYBASE_H */ |