1 /* |
|
2 * Copyright (c) 2007 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: Back Stepping Service Provider |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <ecom/implementationproxy.h> |
|
20 #include <liwcommon.h> |
|
21 |
|
22 #include "bsserviceprovider.h" |
|
23 #include "bsserviceconstants.h" |
|
24 #include "bsserviceinterface.h" |
|
25 |
|
26 using namespace LIW; |
|
27 |
|
28 // ======== LOCAL FUNCTIONS ========= |
|
29 |
|
30 // --------------------------------------------------------------------------- |
|
31 // Map the interface UIDs to implementation factory functions |
|
32 // --------------------------------------------------------------------------- |
|
33 // |
|
34 const TImplementationProxy ImplementationTable[] = |
|
35 { |
|
36 IMPLEMENTATION_PROXY_ENTRY( KBSServiceImplUid, CBSServiceProvider::NewL ) |
|
37 }; |
|
38 |
|
39 // --------------------------------------------------------------------------- |
|
40 // Exported proxy for instantiation method resolution |
|
41 // --------------------------------------------------------------------------- |
|
42 // |
|
43 EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) |
|
44 { |
|
45 aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); |
|
46 return ImplementationTable; |
|
47 } |
|
48 |
|
49 // ======== MEMBER FUNCTIONS ======== |
|
50 |
|
51 // --------------------------------------------------------------------------- |
|
52 // |
|
53 // --------------------------------------------------------------------------- |
|
54 // |
|
55 CBSServiceProvider::CBSServiceProvider() |
|
56 { |
|
57 } |
|
58 |
|
59 // --------------------------------------------------------------------------- |
|
60 // |
|
61 // --------------------------------------------------------------------------- |
|
62 // |
|
63 CBSServiceProvider* CBSServiceProvider::NewL() |
|
64 { |
|
65 return new (ELeave) CBSServiceProvider(); |
|
66 } |
|
67 |
|
68 // --------------------------------------------------------------------------- |
|
69 // |
|
70 // --------------------------------------------------------------------------- |
|
71 // |
|
72 CBSServiceProvider::~CBSServiceProvider() |
|
73 { |
|
74 } |
|
75 |
|
76 // --------------------------------------------------------------------------- |
|
77 // |
|
78 // --------------------------------------------------------------------------- |
|
79 // |
|
80 void CBSServiceProvider::InitialiseL( |
|
81 MLiwNotifyCallback& /*aFrameworkCallback*/, const RCriteriaArray& /*aInterest*/) |
|
82 { |
|
83 } |
|
84 |
|
85 // --------------------------------------------------------------------------- |
|
86 // |
|
87 // --------------------------------------------------------------------------- |
|
88 // |
|
89 void CBSServiceProvider::HandleServiceCmdL( const TInt& aCmdId, |
|
90 const CLiwGenericParamList& aInParamList, |
|
91 CLiwGenericParamList& aOutParamList, TUint aCmdOptions, |
|
92 const MLiwNotifyCallback* aCallback ) |
|
93 |
|
94 { |
|
95 if ( (aCallback ) || (aCmdOptions ) ) |
|
96 { |
|
97 // report error if request is anything other than synchronous |
|
98 // or user sends a callback parameter |
|
99 HandleErrorL( aOutParamList, KErrNotSupported ); |
|
100 return; |
|
101 } |
|
102 |
|
103 TPtrC8 cmdName; |
|
104 const TLiwGenericParam* cmd= NULL; |
|
105 if ( aCmdId == KLiwCmdAsStr ) |
|
106 { |
|
107 TInt pos( 0); |
|
108 cmd = aInParamList.FindFirst( pos, KGenericParamServiceCmdIDStr ); |
|
109 if ( cmd ) |
|
110 { |
|
111 cmdName.Set( cmd->Value().AsData( ) ); |
|
112 } |
|
113 else |
|
114 { |
|
115 HandleErrorL( aOutParamList, KErrArgument ); |
|
116 } |
|
117 } |
|
118 else |
|
119 { |
|
120 HandleErrorL( aOutParamList, KErrNotSupported ); |
|
121 } |
|
122 |
|
123 if ( !cmdName.CompareF( KBSInterface ) ) |
|
124 { |
|
125 // create interface pointer and return the output param |
|
126 CBSServiceInterface* ifp = CBSServiceInterface::NewLC( ); |
|
127 aOutParamList.AppendL( TLiwGenericParam( KBSInterface, |
|
128 TLiwVariant( ifp ) ) ); |
|
129 CleanupStack::Pop( ifp ); |
|
130 return; |
|
131 } |
|
132 else |
|
133 { |
|
134 HandleErrorL( aOutParamList, KErrNotSupported ); |
|
135 } |
|
136 } |
|
137 |
|
138 // --------------------------------------------------------------------------- |
|
139 // |
|
140 // --------------------------------------------------------------------------- |
|
141 // |
|
142 void CBSServiceProvider::HandleErrorL( CLiwGenericParamList& aOutParamList, |
|
143 const TInt aError ) |
|
144 { |
|
145 aOutParamList.AppendL( TLiwGenericParam( EGenericParamError, |
|
146 TLiwVariant( aError ) ) ); |
|
147 } |
|