author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Thu, 17 Dec 2009 09:09:50 +0200 | |
changeset 26 | 5d0ec8b709be |
parent 23 | 50974a8b132e |
permissions | -rw-r--r-- |
5 | 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 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: |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
||
19 |
||
23
50974a8b132e
Revision: 200945
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
20 |
#include <ecom/implementationproxy.h> |
5 | 21 |
|
22 |
#include "calendarinterface.h" |
|
23 |
#include "calendarservicehandler.h" |
|
24 |
#include "serviceerrno.h" |
|
25 |
#include "calendarconstants.h" |
|
26 |
||
27 |
using namespace LIW; |
|
28 |
||
29 |
_LIT8(KCalendarInterface, "IDataSource"); |
|
30 |
_LIT8(KCalendarService, "Service.Calendar"); |
|
31 |
_LIT8(KCommand, "cmd"); |
|
32 |
||
33 |
// --------------------------------------------------------- |
|
34 |
// Two-phased constructor. |
|
35 |
// --------------------------------------------------------- |
|
36 |
// |
|
37 |
CCalendarServiceHandler* CCalendarServiceHandler::NewL() |
|
38 |
{ |
|
39 |
return new(ELeave) CCalendarServiceHandler(); |
|
40 |
} |
|
41 |
||
42 |
// --------------------------------------------------------- |
|
43 |
// Constructor. |
|
44 |
// --------------------------------------------------------- |
|
45 |
// |
|
46 |
CCalendarServiceHandler::CCalendarServiceHandler() |
|
47 |
{ |
|
48 |
} |
|
49 |
||
50 |
// --------------------------------------------------------- |
|
51 |
// Called by the LIW framework to initialise necessary information |
|
52 |
// from the Service Handler. This method is called when the consumer makes |
|
53 |
//the attach operation. |
|
54 |
// --------------------------------------------------------- |
|
55 |
// |
|
56 |
void CCalendarServiceHandler::InitialiseL( |
|
57 |
MLiwNotifyCallback& /*aFrameworkCallback*/, |
|
58 |
const RCriteriaArray& aInterest) |
|
59 |
{ |
|
60 |
TInt count = aInterest.Count(); |
|
61 |
for(TInt index = 0; index < count ; index++) |
|
62 |
{ |
|
63 |
if(aInterest[index]->ContentType() == KCalendarService) |
|
64 |
return; |
|
65 |
} |
|
66 |
||
67 |
User::Leave( SErrNotFound ); |
|
68 |
} |
|
69 |
||
70 |
// --------------------------------------------------------- |
|
71 |
// Executes generic service commands included in criteria |
|
72 |
// --------------------------------------------------------- |
|
73 |
// |
|
74 |
void CCalendarServiceHandler::HandleServiceCmdL( |
|
75 |
const TInt& aCmdId, |
|
76 |
const CLiwGenericParamList& aInParamList, |
|
77 |
CLiwGenericParamList& aOutParamList, |
|
78 |
TUint /*aCmdOptions*/, |
|
79 |
const MLiwNotifyCallback* /*aCallback*/) |
|
80 |
{ |
|
81 |
TPtrC8 cmdName; |
|
82 |
TPtrC errmsg(KNullDesC); |
|
83 |
||
84 |
if ( aCmdId == KLiwCmdAsStr ) |
|
85 |
{ |
|
86 |
TInt pos = 0; |
|
87 |
const TLiwGenericParam* cmd = aInParamList.FindFirst( pos, KCommand ); |
|
88 |
if ( cmd ) |
|
89 |
{ |
|
90 |
cmdName.Set(cmd->Value().AsData()); |
|
91 |
} |
|
92 |
else |
|
93 |
{ |
|
94 |
errmsg.Set(_L("Calendar:Interface name missing")); |
|
95 |
aOutParamList.AppendL(TLiwGenericParam(KErrorMessage,TLiwVariant(errmsg))); |
|
96 |
aOutParamList.AppendL(TLiwGenericParam( KErrorCode, TLiwVariant( TInt32( SErrInvalidServiceArgument ) ) ) ); |
|
97 |
} |
|
98 |
} |
|
99 |
||
100 |
if ( cmdName == KCalendarInterface ) |
|
101 |
{ |
|
102 |
CCalendarInterface* calInterface = CCalendarInterface::NewL(); |
|
103 |
CleanupStack::PushL( calInterface ); |
|
104 |
aOutParamList.AppendL(TLiwGenericParam(KCalendarInterface, TLiwVariant(calInterface))); |
|
105 |
CleanupStack::Pop( calInterface ); |
|
106 |
} |
|
107 |
else |
|
108 |
{ |
|
109 |
aOutParamList.AppendL(TLiwGenericParam(KErrorCode, TLiwVariant((TInt32)SErrInvalidServiceArgument))); |
|
110 |
aOutParamList.AppendL(TLiwGenericParam( KErrorMessage, |
|
111 |
TLiwVariant(_L("Calendar:Interface not supported")))); |
|
112 |
} |
|
113 |
} |
|
114 |
||
115 |
// --------------------------------------------------------- |
|
116 |
// Map the interface UIDs to implementation factory functions |
|
117 |
// --------------------------------------------------------- |
|
118 |
// |
|
119 |
const TImplementationProxy ImplementationTable[] = |
|
120 |
{ |
|
121 |
IMPLEMENTATION_PROXY_ENTRY(0x2000CFBD, CCalendarServiceHandler::NewL) |
|
122 |
}; |
|
123 |
||
124 |
// --------------------------------------------------------- |
|
125 |
// Exported proxy for instantiation method resolution |
|
126 |
// --------------------------------------------------------- |
|
127 |
// |
|
128 |
EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) |
|
129 |
{ |
|
130 |
aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); |
|
131 |
return ImplementationTable; |
|
132 |
} |