|
1 /* |
|
2 * Copyright (c) 2006-2009 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: Definition of the Context plug-in ECom interface. |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef CCONTEXTPLUGIN_H |
|
19 #define CCONTEXTPLUGIN_H |
|
20 |
|
21 #include <e32base.h> |
|
22 #include <implementationinformation.h> |
|
23 |
|
24 // forward declarations |
|
25 class CMdEObject; |
|
26 class CMdESession; |
|
27 class CHarvesterData; |
|
28 |
|
29 /** Uid for this interface */ |
|
30 const TUid KCContextPluginInterfaceUid = { 0x200009F7 }; |
|
31 |
|
32 class MContextPluginObserver |
|
33 { |
|
34 public: |
|
35 /** |
|
36 * A pure virtual method intended to inform about completion of context |
|
37 * plug-in initialization. Symbian error codes are used. |
|
38 * |
|
39 * @param aErrorCode Error code for error occurred during initialization. |
|
40 */ |
|
41 virtual void PluginInitializationStatus( TInt aErrorCode ) = 0; |
|
42 |
|
43 /** |
|
44 * A pure virtual method intended to inform about context snapshot taking completion. |
|
45 * Symbian error codes are used. |
|
46 * |
|
47 * @param aErrorCode Error code for error occurred while taking the snapshot. |
|
48 */ |
|
49 virtual void PluginSnapshotStatus( CHarvesterData* aHD ) = 0; |
|
50 }; |
|
51 |
|
52 |
|
53 /** |
|
54 * This class implements the context plugin interface. |
|
55 */ |
|
56 class CContextPlugin : public CBase |
|
57 { |
|
58 public: |
|
59 |
|
60 /** |
|
61 * Creates an implementation of a desired implementation defined by the parameter. |
|
62 * |
|
63 * @param aUid |
|
64 * @return A pointer to the created plug-in. |
|
65 */ |
|
66 IMPORT_C static CContextPlugin* NewL( const TUid& aUid ); |
|
67 |
|
68 /** |
|
69 * Destroys the implementation. This is virtual method |
|
70 * and this class is not intended for derivation, so not exported. |
|
71 */ |
|
72 IMPORT_C virtual ~CContextPlugin(); |
|
73 |
|
74 /** |
|
75 * Lists all available implementations which implement this interface. |
|
76 * |
|
77 * @param[out] aImplInfoArray A list of existing implementations of the interface. |
|
78 */ |
|
79 IMPORT_C static void ListImplementationsL( RImplInfoPtrArray& aImplInfoArray ); |
|
80 |
|
81 /** |
|
82 * A pure virtual interface method to initialize the plug-in. |
|
83 * |
|
84 * @param aObserver An interface class to inform about initialization completion. |
|
85 */ |
|
86 virtual void Init( MContextPluginObserver& aObserver ) = 0; |
|
87 |
|
88 /** |
|
89 * Set a pointer to MdESession. |
|
90 * Session is used to store harvested context data. |
|
91 * |
|
92 * @param aSession Session pointer to set. |
|
93 */ |
|
94 virtual void SetMdeSession( CMdESession& aSession ) = 0; |
|
95 |
|
96 /** |
|
97 * This pure virtual method takes the context snapshot for one metadata object |
|
98 * and writes the information to the object received as parameter. |
|
99 * The observer will be informed about the status of the operation. |
|
100 * |
|
101 * @param aObserver An interface class to inform about finishing context snapshot. |
|
102 * @param aMetadataObject An object to take the snapshot for. |
|
103 */ |
|
104 virtual void ContextSnapshot( MContextPluginObserver& aObserver, CHarvesterData& aHD ) = 0; |
|
105 |
|
106 /** |
|
107 * This pure virtual method takes the context snapshot for several |
|
108 * metadata object and writes the information to the all the objects received as parameter. |
|
109 * The observer will be informed about the status of the operation. |
|
110 * |
|
111 * @param aObserver An interface class to inform about finishing context snapshot. |
|
112 * @param aMetadataObjectArray Array of objects to take the snapshot for. |
|
113 */ |
|
114 virtual void ContextSnapshot( MContextPluginObserver& aObserver, |
|
115 RPointerArray<CHarvesterData>& aHDArray ) = 0; |
|
116 |
|
117 private: // data |
|
118 |
|
119 /** |
|
120 * Instance identifier key. When instance of an implementation is created |
|
121 * by ECOM framework, the framework will assign UID for it. |
|
122 * The UID is used in destructor to notify framework that this instance is |
|
123 * being destroyed and resources can be released. |
|
124 */ |
|
125 TUid iDtor_ID_Key; |
|
126 }; |
|
127 |
|
128 #endif // CCONTEXTPLUGIN_H |