|
1 /* |
|
2 * Copyright (c) 2002 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 the License "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: CSysInfoProvider class implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <ecom/implementationproxy.h> |
|
20 |
|
21 #include "sysinfoprovider.h" |
|
22 #include "sysinfointerface.h" |
|
23 #include "sysinfoaiwparams.hrh" |
|
24 #include "errormsgs.h" |
|
25 #include "../../inc/serviceerrno.h" |
|
26 |
|
27 using namespace LIW ; |
|
28 using namespace sysinfoaiwparams; |
|
29 //CONSTANTS |
|
30 _LIT8(KCmdName,"cmd"); |
|
31 |
|
32 // ============================ MEMBER FUNCTIONS =============================== |
|
33 |
|
34 // ----------------------------------------------------------------------------- |
|
35 // CSysInfoProvider::NewL() |
|
36 // Two-phased constructor. |
|
37 // ----------------------------------------------------------------------------- |
|
38 // |
|
39 CSysInfoProvider* CSysInfoProvider::NewL() |
|
40 { |
|
41 return new (ELeave) CSysInfoProvider(); |
|
42 } |
|
43 |
|
44 // ----------------------------------------------------------------------------- |
|
45 // CSysInfoProvider::CSysInfoProvider() |
|
46 // C++ default constructor can NOT contain any code, that might leave. |
|
47 // ----------------------------------------------------------------------------- |
|
48 // |
|
49 CSysInfoProvider :: CSysInfoProvider() |
|
50 { |
|
51 } |
|
52 |
|
53 // ----------------------------------------------------------------------------- |
|
54 // CSysInfoProvider::~CSysInfoProvider() |
|
55 // Destructor. |
|
56 // ----------------------------------------------------------------------------- |
|
57 // |
|
58 CSysInfoProvider :: ~CSysInfoProvider() |
|
59 { |
|
60 } |
|
61 |
|
62 // ----------------------------------------------------------------------------- |
|
63 // CSysInfoProvider::InitialiseL(MLiwNotifyCallback& /*aFrameworkCallback*/, |
|
64 // const RCriteriaArray& aInterest) |
|
65 // Called by the AIW framework to initialise provider with necessary information |
|
66 // from the Service Handler. |
|
67 // ----------------------------------------------------------------------------- |
|
68 // |
|
69 void CSysInfoProvider::InitialiseL(MLiwNotifyCallback& /*aFrameworkCallback*/, |
|
70 const RCriteriaArray& /*aInterest*/) |
|
71 { |
|
72 } |
|
73 |
|
74 // ----------------------------------------------------------------------------- |
|
75 // CSysInfoProvider::HandleServiceCmdL(const TInt& aCmdId, |
|
76 // const CLiwGenericParamList& aInParamList, |
|
77 // CLiwGenericParamList& aOutParamList, |
|
78 // TUint aCmdOptions, |
|
79 // const MLiwNotifyCallback* aCallback) |
|
80 // Called by the AIW framework to initialise provider with necessary information |
|
81 // from the Service Handler. |
|
82 // ----------------------------------------------------------------------------- |
|
83 // |
|
84 void CSysInfoProvider::HandleServiceCmdL( const TInt& aCmdId, |
|
85 const CLiwGenericParamList& aInParamList, |
|
86 CLiwGenericParamList& aOutParamList, |
|
87 TUint aCmdOptions, |
|
88 const MLiwNotifyCallback* /*aCallback*/ ) |
|
89 { |
|
90 // Cancel bit must always be checked. Support can be implemented if necessary. |
|
91 if ( aCmdOptions & KLiwOptCancel ) |
|
92 { |
|
93 return; |
|
94 } |
|
95 TPtrC8 CmdName; |
|
96 const TLiwGenericParam* cmd; |
|
97 if ( aCmdId == KLiwCmdAsStr ) |
|
98 { |
|
99 TInt pos = 0; |
|
100 cmd = aInParamList.FindFirst(pos,KCmdName); |
|
101 if ( NULL != cmd ) |
|
102 { |
|
103 CmdName.Set( cmd->Value().AsData() ); |
|
104 } |
|
105 } |
|
106 |
|
107 if ( CmdName == KIDataSource ) |
|
108 { |
|
109 //Create interface pointer and return the output param |
|
110 CSysInfoInterface* interface = CSysInfoInterface::NewL(); |
|
111 CleanupStack::PushL(interface); |
|
112 aOutParamList.AppendL(TLiwGenericParam(KErrorCode, |
|
113 TLiwVariant((TInt32)KErrNone))); |
|
114 aOutParamList.AppendL(TLiwGenericParam(KIDataSource, |
|
115 TLiwVariant(interface))); |
|
116 CleanupStack::Pop(interface); |
|
117 } |
|
118 else |
|
119 { |
|
120 aOutParamList.AppendL(TLiwGenericParam(KErrorCode, |
|
121 TLiwVariant((TInt32)SErrServiceNotSupported))); |
|
122 aOutParamList.AppendL(TLiwGenericParam(KErrorMsg, |
|
123 TLiwVariant(KErrInterfaceNotSupported))); |
|
124 } |
|
125 } |
|
126 |
|
127 // |
|
128 // Rest of the file is for ECom initialization. |
|
129 // |
|
130 |
|
131 // Map the interface UIDs to implementation factory functions |
|
132 const TImplementationProxy ImplementationTable[] = |
|
133 { |
|
134 IMPLEMENTATION_PROXY_ENTRY( 0x2000CFBF, CSysInfoProvider::NewL ) |
|
135 }; |
|
136 |
|
137 // --------------------------------------------------------- |
|
138 // Exported proxy for instantiation method resolution |
|
139 // --------------------------------------------------------- |
|
140 // |
|
141 EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount ) |
|
142 { |
|
143 aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); |
|
144 return ImplementationTable; |
|
145 } |