|
1 // Copyright (c) 2008-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 // mw/remoteconn/mtpfws/mtpfw/dataproviders/dputility/src/cmtpsvcdeleteserviceproplist.cpp |
|
15 |
|
16 #include <mtp/cmtptypedeleteserviceproplist.h> |
|
17 #include <mtp/tmtptypedatapair.h> |
|
18 |
|
19 #include "cmtpsvcdeleteserviceproplist.h" |
|
20 #include "mmtpservicedataprovider.h" |
|
21 #include "mmtpservicehandler.h" |
|
22 |
|
23 __FLOG_STMT (_LIT8(KComponent, "SvcDelSvcPList");) |
|
24 |
|
25 EXPORT_C MMTPRequestProcessor* CMTPSvcDeleteServicePropList::NewL(MMTPDataProviderFramework& aFramework, |
|
26 MMTPConnection& aConnection, |
|
27 MMTPServiceDataProvider& aDataProvider) |
|
28 { |
|
29 CMTPSvcDeleteServicePropList* self = new (ELeave) CMTPSvcDeleteServicePropList(aFramework, aConnection,aDataProvider); |
|
30 CleanupStack::PushL(self); |
|
31 self->ConstructL(); |
|
32 CleanupStack::Pop(self); |
|
33 return self; |
|
34 } |
|
35 |
|
36 EXPORT_C CMTPSvcDeleteServicePropList::~CMTPSvcDeleteServicePropList() |
|
37 { |
|
38 __FLOG(_L8("~CMTPSvcDeleteServicePropList - Entry")); |
|
39 delete iDeleteServicePropList; |
|
40 __FLOG(_L8("~CMTPSvcDeleteServicePropList - Exit")); |
|
41 __FLOG_CLOSE; |
|
42 } |
|
43 |
|
44 CMTPSvcDeleteServicePropList::CMTPSvcDeleteServicePropList(MMTPDataProviderFramework& aFramework, |
|
45 MMTPConnection& aConnection, |
|
46 MMTPServiceDataProvider& aDataProvider) : |
|
47 CMTPRequestProcessor(aFramework, aConnection, 0, NULL), iDataProvider(aDataProvider) |
|
48 { |
|
49 } |
|
50 |
|
51 void CMTPSvcDeleteServicePropList::ConstructL() |
|
52 { |
|
53 __FLOG_OPEN(KMTPSubsystem, KComponent); |
|
54 __FLOG(_L8("ConstructL - Entry")); |
|
55 iDeleteServicePropList = CMTPTypeDeleteServicePropList::NewL(); |
|
56 __FLOG(_L8("ConstructL - Exit")); |
|
57 } |
|
58 |
|
59 TMTPResponseCode CMTPSvcDeleteServicePropList::CheckRequestL() |
|
60 { |
|
61 __FLOG(_L8("CheckRequestL - Entry")); |
|
62 TMTPResponseCode responseCode = CMTPRequestProcessor::CheckRequestL(); |
|
63 if (EMTPRespCodeOK == responseCode) |
|
64 { |
|
65 TUint32 serviceId = Request().Uint32(TMTPTypeRequest::ERequestParameter1); |
|
66 if (serviceId != iDataProvider.ServiceID()) |
|
67 { |
|
68 responseCode = EMTPRespCodeInvalidServiceID; |
|
69 } |
|
70 } |
|
71 __FLOG_VA((_L8("CheckRequestL - Exit with responseCode = 0x%04X"), responseCode)); |
|
72 return responseCode; |
|
73 } |
|
74 |
|
75 void CMTPSvcDeleteServicePropList::ServiceL() |
|
76 { |
|
77 __FLOG(_L8("ServiceL - Entry")); |
|
78 //Recieve the data from the property list |
|
79 ReceiveDataL(*iDeleteServicePropList); |
|
80 __FLOG(_L8("ServiceL - Exit")); |
|
81 } |
|
82 |
|
83 TBool CMTPSvcDeleteServicePropList::DoHandleResponsePhaseL() |
|
84 { |
|
85 __FLOG(_L8("DoHandleResponsePhaseL - Entry")); |
|
86 TMTPResponseCode responseCode = EMTPRespCodeOK; |
|
87 TUint32 parameter = 0; |
|
88 const TUint count = iDeleteServicePropList->NumberOfElements(); |
|
89 for (TUint i = 0; i < count && responseCode == EMTPRespCodeOK; i++) |
|
90 { |
|
91 TMTPTypeDataPair& element = iDeleteServicePropList->ElementL(i); |
|
92 |
|
93 if (iDataProvider.ServiceID() != element.Uint32(TMTPTypeDataPair::EOwnerHandle)) |
|
94 { |
|
95 parameter = i; |
|
96 responseCode = EMTPRespCodeInvalidServiceID; |
|
97 break; |
|
98 } |
|
99 |
|
100 TUint16 propertyCode = element.Uint16(TMTPTypeDataPair::EDataCode); |
|
101 responseCode = iDataProvider.ServiceHandler()->DeleteServicePropertyL(propertyCode); |
|
102 if (EMTPRespCodeOK != responseCode) |
|
103 { |
|
104 parameter = i; |
|
105 break; |
|
106 } |
|
107 } |
|
108 SendResponseL(responseCode, 1, ¶meter); |
|
109 __FLOG_VA((_L8("DoHandleResponsePhaseL - Exit responseCode = 0x%04X, failed index = %u"), responseCode, parameter)); |
|
110 return EFalse; |
|
111 } |
|
112 |
|
113 TBool CMTPSvcDeleteServicePropList::HasDataphase() const |
|
114 { |
|
115 return ETrue; |
|
116 } |