|
1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #ifndef __CMDCUSTOMCOMMAND_H__ |
|
17 #define __CMDCUSTOMCOMMAND_H__ |
|
18 |
|
19 #include "ssmdeferrablecommand.h" |
|
20 |
|
21 class TSsmCommandParameters; |
|
22 class RReadStream; |
|
23 class MSsmCustomCommand; |
|
24 class CSsmCustomCommandInfo; |
|
25 class CSsmCustomCommandEnv; |
|
26 |
|
27 /** |
|
28 Function prototype for the custom command ordinal |
|
29 @internalComponent |
|
30 @released |
|
31 */ |
|
32 typedef MSsmCustomCommand* (*CustomCmdFunctionType)(void); |
|
33 |
|
34 /** |
|
35 Built-in command for executing a custom command |
|
36 @internalComponent |
|
37 @released |
|
38 @panic KPanicCmdCustomCommand, EInvalidRunLAction The internal state of the dll execution became corrupted during processing of the command |
|
39 @panic KPanicCmdCustomCommand, ENoCustomCommandObject The internal custom command object was not loaded or initialised properly before being used |
|
40 @see CSsmCustomCommandInfo |
|
41 @see MSsmCustomCommand |
|
42 */ |
|
43 NONSHARABLE_CLASS (CCmdCustomCommand) : public CSsmDeferrableCommand |
|
44 { |
|
45 public: |
|
46 static CCmdCustomCommand* NewL(RReadStream& aReadStream); |
|
47 static CCmdCustomCommand* NewL(TCmdErrorSeverity aSeverity, TSsmExecutionBehaviour aExecutionBehaviour, const CSsmCustomCommandInfo& aInfo); |
|
48 #ifdef SYMBIAN_SSM_FLEXIBLE_MERGE |
|
49 static CCmdCustomCommand* NewL(TCmdErrorSeverity aSeverity, TSsmExecutionBehaviour aExecutionBehaviour, const CSsmCustomCommandInfo& aInfo, const TUint16 aPriority); |
|
50 #endif |
|
51 static CCmdCustomCommand* NewL(TSsmCommandParameters& aCommandParameters); |
|
52 //Must be used only by CLE to reconstruct the command |
|
53 static CCmdCustomCommand* NewLC(const CCmdCustomCommand& aCmdCustomCommand, CSsmCommandUtilProvider* aUtilProvider); |
|
54 ~CCmdCustomCommand(); |
|
55 |
|
56 // from MSsmCommand |
|
57 TSsmCommandType Type() const; |
|
58 void ExternalizeL(RWriteStream& aWriteStream) const; |
|
59 void Execute(TRequestStatus& aStatus); |
|
60 void ExecuteCancel(); |
|
61 void Release(); |
|
62 CSsmCustomCommandInfo& SsmCustomCommandInfo() const {return *iInfo;} |
|
63 |
|
64 private: |
|
65 // Custom command state enumerations |
|
66 enum TCustomCmdAction |
|
67 { |
|
68 EPrepareDll = 0, |
|
69 EInitialiseDll, |
|
70 EExecuteMethod, |
|
71 EClose |
|
72 }; |
|
73 |
|
74 CCmdCustomCommand(); |
|
75 CCmdCustomCommand(TCmdErrorSeverity aSeverity, TSsmExecutionBehaviour aExecutionBehaviour); |
|
76 #ifdef SYMBIAN_SSM_FLEXIBLE_MERGE |
|
77 CCmdCustomCommand(TCmdErrorSeverity aSeverity, TSsmExecutionBehaviour aExecutionBehaviour, const TUint16 aPriority); |
|
78 #endif |
|
79 void InternalizeL(RReadStream& aReadStream); |
|
80 void ConstructL(RReadStream& aReadStream); |
|
81 void ConstructL(const CSsmCustomCommandInfo& aInfo); |
|
82 void ConstructL(TSsmCommandParameters& aCommandParameters); |
|
83 void ConstructL(const CCmdCustomCommand& aCmdCustomCommand, CSsmCommandUtilProvider* aUtilProvider); |
|
84 void PrepareCustomCmdL(); |
|
85 void InitialiseCmdL(); |
|
86 void MoveToNextStateL(TInt aError, TCustomCmdAction aNextState, TBool aCompleteRequest=ETrue); |
|
87 void ValidateL(); |
|
88 static TInt MaxSupportedVersion(); |
|
89 void WriteHandleToFileL(TInt aHandle); |
|
90 |
|
91 protected: |
|
92 // from CActive |
|
93 void RunL(); |
|
94 void DoCancel(); |
|
95 TInt RunError(TInt aError); |
|
96 |
|
97 private: |
|
98 CSsmCustomCommandInfo* iInfo; // custom command plugin info |
|
99 TCustomCmdAction iAction; // internal state iterator |
|
100 RLibrary iLibrary; // interface to the load library API |
|
101 MSsmCustomCommand* iCustomCommand; // the actual interface to the custom command |
|
102 TInt iAttempts; // count of unsuccessful attempts |
|
103 TBool iLoaded; // whether custom command dll loaded or not |
|
104 CSsmCustomCommandEnv* iCmdEnv; // custom command environment passed during initialisation |
|
105 }; |
|
106 |
|
107 #endif // __CMDCUSTOMCOMMAND_H__ |