|
1 /* |
|
2 * Copyright (c) 2006 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 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef C_ALFGENCOMPONENT_H |
|
21 #define C_ALFGENCOMPONENT_H |
|
22 |
|
23 #include <e32std.h> |
|
24 #include <e32base.h> |
|
25 |
|
26 class CAlfEnv; |
|
27 class CAlfMessageObserver; |
|
28 |
|
29 class MAlfAsyncOpObserver |
|
30 { |
|
31 public: |
|
32 virtual void AlfAsyncOpCompleted(TInt aCommandId, TInt aStatus) = 0; |
|
33 }; |
|
34 |
|
35 /** |
|
36 * Generalisation of component command interface |
|
37 * |
|
38 * @lib alfclient.lib |
|
39 * @since S60 v3.2 |
|
40 */ |
|
41 NONSHARABLE_CLASS( CAlfGenComponent ): public CBase |
|
42 { |
|
43 public: |
|
44 |
|
45 /** |
|
46 * |
|
47 * |
|
48 */ |
|
49 IMPORT_C static CAlfGenComponent* NewL( |
|
50 CAlfEnv& aEnv, |
|
51 TInt aImplementationId, |
|
52 TInt aImplementationUid, |
|
53 const TDesC8& aConstructionParams); |
|
54 |
|
55 /** |
|
56 * Destructor |
|
57 */ |
|
58 IMPORT_C ~CAlfGenComponent(); |
|
59 |
|
60 /** |
|
61 * Performs syncronous command and returns value of success, can be any system wide error code |
|
62 */ |
|
63 IMPORT_C TInt DoSynchronousCmd( TUint aOp, |
|
64 const TDesC8& aInputBuf, TDes8& aOutBuf); |
|
65 |
|
66 /** |
|
67 * Sends a command without waiting for the reply from the server. |
|
68 * Commands sent through this API can be batched as well. If the batching |
|
69 * fails (or disabled) the DoSynchronousCmd will be called automatically. |
|
70 * |
|
71 * @param aOp Command indentifier |
|
72 * @param aInputBuf Input buffer. The function will take copy of the |
|
73 * buffer content and delete it when the batch buffer is |
|
74 * flushed. |
|
75 * |
|
76 * @return Symbian OS error code. |
|
77 */ |
|
78 IMPORT_C TInt DoCmdNoReply( TUint aOp, const TDesC8& aInputBuf ); |
|
79 |
|
80 /** |
|
81 * Performs syncronous command. Given observer will be notified on success of operation via call back |
|
82 * Caller must ensure that buffers exist when command is under progress. |
|
83 * |
|
84 * @return command id which can be used for cancelling the command |
|
85 */ |
|
86 IMPORT_C TInt DoAsynchronousCmdL(TUint aOp, const TDesC8& aInputBuf, |
|
87 TDes8& aOutBuf, MAlfAsyncOpObserver* aObserver); |
|
88 /** |
|
89 * Cancel specificied asynchronous command. |
|
90 * To cancel all pending requests, use Cancel() from base class |
|
91 * |
|
92 * @param aCmdId a command to be cancelled |
|
93 */ |
|
94 IMPORT_C void CancelAsynchCmd(TInt aCmdId); |
|
95 |
|
96 /** |
|
97 * Unique identifier of this component, returns zero if not generated yet |
|
98 */ |
|
99 IMPORT_C TInt Identifier(); |
|
100 |
|
101 /** |
|
102 * Called when asynchronous command completed. This call deletes |
|
103 * the object. |
|
104 * @param aMessageObserver Message which was completed. |
|
105 */ |
|
106 void CommandCompleted( CAlfMessageObserver* aMessageObserver ); |
|
107 |
|
108 |
|
109 private: |
|
110 CAlfGenComponent(CAlfEnv& aEnv); |
|
111 void ConstructL( |
|
112 TInt aImplementationId, |
|
113 TInt aImplementationUid, |
|
114 const TDesC8& aConstructionParams); |
|
115 |
|
116 private: // data |
|
117 CAlfEnv& iEnv; |
|
118 class TPrivateData; |
|
119 TPrivateData* iData; |
|
120 }; |
|
121 |
|
122 |
|
123 #endif // C_ALFGENCOMPONENT_H |