114
|
1 |
/*
|
|
2 |
* Copyright (c) 2008 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 |
#include <ecom/implementationproxy.h>
|
|
21 |
#include <liwgenericparam.hrh>
|
|
22 |
|
|
23 |
#include "mcsconstants.h"
|
|
24 |
#include "mcsdsinterface.h"
|
|
25 |
#include "mcsmcinterface.h"
|
|
26 |
#include "mcsservicehandler.h"
|
|
27 |
#include "serviceerrno.h"
|
|
28 |
|
|
29 |
// ---------------------------------------------------------
|
|
30 |
// Two-phased constructor.
|
|
31 |
// ---------------------------------------------------------
|
|
32 |
//
|
|
33 |
CMCSServiceHandler* CMCSServiceHandler::NewL()
|
|
34 |
{
|
|
35 |
return new(ELeave) CMCSServiceHandler();
|
|
36 |
}
|
|
37 |
|
|
38 |
// ---------------------------------------------------------
|
|
39 |
// Constructor.
|
|
40 |
// ---------------------------------------------------------
|
|
41 |
//
|
|
42 |
CMCSServiceHandler::CMCSServiceHandler()
|
|
43 |
{
|
|
44 |
}
|
|
45 |
|
|
46 |
// ---------------------------------------------------------
|
|
47 |
// Called by the LIW framework to initialise necessary information
|
|
48 |
// from the Service Handler. This method is called when the consumer makes
|
|
49 |
//the attach operation.
|
|
50 |
// ---------------------------------------------------------
|
|
51 |
//
|
|
52 |
void CMCSServiceHandler::InitialiseL(
|
|
53 |
MLiwNotifyCallback& /*aFrameworkCallback*/,
|
|
54 |
const RCriteriaArray& aInterest)
|
|
55 |
{
|
|
56 |
TInt count = aInterest.Count();
|
|
57 |
for(TInt index = 0; index < count ; index++)
|
|
58 |
{
|
|
59 |
if(aInterest[index]->ContentType() == KMCSService)
|
|
60 |
return;
|
|
61 |
}
|
|
62 |
|
|
63 |
User::Leave( SErrNotFound );
|
|
64 |
}
|
|
65 |
|
|
66 |
// ---------------------------------------------------------
|
|
67 |
// Executes generic service commands included in criteria
|
|
68 |
// ---------------------------------------------------------
|
|
69 |
//
|
|
70 |
void CMCSServiceHandler::HandleServiceCmdL(
|
|
71 |
const TInt& aCmdId,
|
|
72 |
const CLiwGenericParamList& aInParamList,
|
|
73 |
CLiwGenericParamList& aOutParamList,
|
|
74 |
TUint /*aCmdOptions*/,
|
|
75 |
const MLiwNotifyCallback* /*aCallback*/)
|
|
76 |
{
|
|
77 |
if ( aCmdId == KLiwCmdAsStr )
|
|
78 |
{
|
|
79 |
TInt pos = 0;
|
|
80 |
const TLiwGenericParam* content = aInParamList.FindFirst( pos, KContentName );
|
|
81 |
const TLiwGenericParam* cmd = aInParamList.FindFirst( pos, KGenericParamID );
|
|
82 |
if ( content && cmd )
|
|
83 |
{
|
|
84 |
TPtrC cmdName;
|
|
85 |
TPtrC8 cmdPtr;
|
|
86 |
cmdName.Set(content->Value().AsDes());
|
|
87 |
cmd->Value().Get(cmdPtr);
|
|
88 |
|
|
89 |
if( cmdPtr == KMCSDataSourceInterface()) // IDataSource
|
|
90 |
{
|
|
91 |
CMCSDSInterface* mcsDSInterface = CMCSDSInterface::NewL(cmdName);
|
|
92 |
CleanupStack::PushL( mcsDSInterface );
|
|
93 |
aOutParamList.AppendL(TLiwGenericParam(KMCSDataSourceInterface,
|
|
94 |
TLiwVariant(mcsDSInterface)));
|
|
95 |
CleanupStack::Pop( mcsDSInterface );
|
|
96 |
}
|
|
97 |
else if(cmdPtr == KMCSMenuContentInterface()) // IMenuContent
|
|
98 |
{
|
|
99 |
CMCSMCInterface* mcsMCInterface = CMCSMCInterface::NewL(cmdName);
|
|
100 |
CleanupStack::PushL( mcsMCInterface );
|
|
101 |
aOutParamList.AppendL(TLiwGenericParam(KMCSMenuContentInterface,
|
|
102 |
TLiwVariant(mcsMCInterface)));
|
|
103 |
CleanupStack::Pop( mcsMCInterface );
|
|
104 |
}
|
|
105 |
else
|
|
106 |
{
|
|
107 |
aOutParamList.AppendL(TLiwGenericParam(LIW::EGenericParamError,
|
|
108 |
TLiwVariant((TInt32)SErrInvalidServiceArgument)));
|
|
109 |
}
|
|
110 |
|
|
111 |
}
|
|
112 |
else
|
|
113 |
{
|
|
114 |
aOutParamList.AppendL(TLiwGenericParam(LIW::EGenericParamError,
|
|
115 |
TLiwVariant((TInt32)SErrInvalidServiceArgument)));
|
|
116 |
}
|
|
117 |
}
|
|
118 |
}
|
|
119 |
|
|
120 |
// ---------------------------------------------------------
|
|
121 |
// Map the interface UIDs to implementation factory functions
|
|
122 |
// ---------------------------------------------------------
|
|
123 |
//
|
|
124 |
const TImplementationProxy ImplementationTable[] =
|
|
125 |
{
|
|
126 |
IMPLEMENTATION_PROXY_ENTRY(0x2001242D, CMCSServiceHandler::NewL),
|
|
127 |
IMPLEMENTATION_PROXY_ENTRY(0x2001242E, CMCSServiceHandler::NewL)
|
|
128 |
|
|
129 |
};
|
|
130 |
|
|
131 |
// ---------------------------------------------------------
|
|
132 |
// Exported proxy for instantiation method resolution
|
|
133 |
// ---------------------------------------------------------
|
|
134 |
//
|
|
135 |
EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
|
|
136 |
{
|
|
137 |
aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
|
|
138 |
return ImplementationTable;
|
|
139 |
}
|