|
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: |
|
15 * This file contains the class declarations for the plugin service and callback APIs. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 /** |
|
23 @file |
|
24 @publishedPartner |
|
25 @released |
|
26 */ |
|
27 |
|
28 |
|
29 #ifndef HWRMPLUGINSERVICE_H |
|
30 #define HWRMPLUGINSERVICE_H |
|
31 |
|
32 |
|
33 // INCLUDES |
|
34 #include <e32base.h> |
|
35 |
|
36 /** ECOM Plugin interface UID |
|
37 @publishedPartner |
|
38 @released |
|
39 */ |
|
40 const TUid KCHWRMPluginServiceInterfaceUid = { 0x10205028 }; |
|
41 |
|
42 /** |
|
43 * Callback interface for the HWRM plugins. |
|
44 * Used to return data and/or error codes from an asynchronous plugin calls. |
|
45 * invoked by the HWRM server. |
|
46 * |
|
47 @publishedPartner |
|
48 @released |
|
49 */ |
|
50 class MHWRMPluginCallback |
|
51 { |
|
52 public: |
|
53 /** |
|
54 * Method to return data in response to a message from a HWRM plugin. |
|
55 * Related ProcessCommandL call must return before this method can |
|
56 * be called. |
|
57 * |
|
58 * @param aCommandId Command ID for which the response comes |
|
59 * @param aTransId Unique transcation identifier of the original command |
|
60 * @param aData Data returned from call. |
|
61 * Data package contents are defined by command. |
|
62 * @leave Standard Symbian leaves if there are any problems handling response. |
|
63 */ |
|
64 virtual void ProcessResponseL( const TInt aCommandId, |
|
65 const TUint8 aTransId, |
|
66 TDesC8& aData ) = 0; |
|
67 |
|
68 /** |
|
69 * Method to notify events to a HWRM plugin. |
|
70 * Note: No implementation yet. |
|
71 * |
|
72 * @param aIndId An indication ID |
|
73 * @param aData Data associated with the event ID. |
|
74 * |
|
75 */ |
|
76 virtual void EventL( const TUint32 aIndId, |
|
77 TDesC8& aData ) = 0; |
|
78 }; |
|
79 |
|
80 |
|
81 /** |
|
82 * Plugin interface class to be implemented by adaptation. |
|
83 * Responsible for invoking the adaptation implementation of |
|
84 * each command and cancelling the command. |
|
85 * |
|
86 @publishedPartner |
|
87 @released |
|
88 */ |
|
89 class CHWRMPluginService : public CBase |
|
90 { |
|
91 public: // construction and destruction |
|
92 |
|
93 /** |
|
94 * Constructor method for instance. |
|
95 * Uses ECom to find correct instance. |
|
96 * |
|
97 * @param aMatch Determines the API that the loaded plugin implements. |
|
98 * @param aResponseCallback Pointer to plugin callback handler. |
|
99 * @leave Standard Symbian leaves. |
|
100 */ |
|
101 inline static CHWRMPluginService* NewL(const TDesC8& aMatch, |
|
102 MHWRMPluginCallback* aResponseCallback); |
|
103 |
|
104 /** |
|
105 * Destructor |
|
106 */ |
|
107 inline virtual ~CHWRMPluginService(); |
|
108 |
|
109 |
|
110 public: |
|
111 /** |
|
112 * Method to invoke a particular command in the plugin. |
|
113 * Response to method is returned via separate ProcessResponseL |
|
114 * call. Call to ProcessResponseL is done after the call to |
|
115 * ProcessCommandL returns. Plugin must be able to handle another |
|
116 * ProcessCommandL before ProcessResponseL is called for previous |
|
117 * call(s) (i.e. multiple clients are attempting to access resource |
|
118 * simultaneously). If ProcessCommandL leaves, no corresponding |
|
119 * ProcessResponseL is expected. |
|
120 * |
|
121 * @param aCommandId Command ID |
|
122 * @param aTransId Transaction ID |
|
123 * @param aData Data associated with command. |
|
124 * Data package contents are defined by command. |
|
125 * Some commands require no data and pass |
|
126 * empty buffer as aData; |
|
127 * @leave KErrGeneral or command specific leaves. |
|
128 */ |
|
129 virtual void ProcessCommandL( const TInt aCommandId, |
|
130 const TUint8 aTransId, |
|
131 TDesC8& aData ) = 0; |
|
132 |
|
133 /** |
|
134 * Method to cancel a particular command. The corresponding |
|
135 * ProcessResponseL will not be called for cancelled commands, |
|
136 * whether cancel was successful or not. |
|
137 * |
|
138 * @param aTransId Transaction ID |
|
139 * @param aCommandId Command ID to optionally double check with the |
|
140 * transaction ID |
|
141 * @leave Standard Symbian leaves. HWRM will consider |
|
142 * transaction canceled even if this method leaves. |
|
143 */ |
|
144 virtual void CancelCommandL( const TUint8 aTransId, |
|
145 const TInt aCommandId) = 0; |
|
146 |
|
147 |
|
148 |
|
149 |
|
150 protected: |
|
151 |
|
152 /** |
|
153 * Destructor identifier to be used with ECom framework. |
|
154 */ |
|
155 TUid iDestructorIDKey; |
|
156 |
|
157 /** |
|
158 * Callback pointer to be used with responses to commands. |
|
159 * This pointer is not owned by this class. |
|
160 */ |
|
161 MHWRMPluginCallback* iResponseCallback; // not owned |
|
162 |
|
163 }; |
|
164 |
|
165 #include <hwrm/hwrmpluginservice.inl> |
|
166 |
|
167 |
|
168 #endif // HWRMPLUGINSERVICE_H |
|
169 |
|
170 // End of File |