|
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/cmtpsvcgetserviceinfo.cpp |
|
15 |
|
16 #include <mtp/cmtptypeserviceinfo.h> |
|
17 |
|
18 #include "cmtpsvcgetserviceinfo.h" |
|
19 #include "mmtpservicedataprovider.h" |
|
20 #include "mmtpservicehandler.h" |
|
21 |
|
22 // Class constants. |
|
23 __FLOG_STMT(_LIT8(KComponent, "SvcGetSvcInfo");) |
|
24 |
|
25 EXPORT_C MMTPRequestProcessor* CMTPSvcGetServiceInfo::NewL(MMTPDataProviderFramework& aFramework, |
|
26 MMTPConnection& aConnection, |
|
27 MMTPServiceDataProvider& aDataProvider) |
|
28 { |
|
29 CMTPSvcGetServiceInfo* self = new (ELeave) CMTPSvcGetServiceInfo(aFramework, aConnection, aDataProvider); |
|
30 CleanupStack::PushL(self); |
|
31 self->ConstructL(); |
|
32 CleanupStack::Pop(self); |
|
33 return self; |
|
34 } |
|
35 |
|
36 EXPORT_C CMTPSvcGetServiceInfo::~CMTPSvcGetServiceInfo() |
|
37 { |
|
38 __FLOG(_L8("~CMTPSvcGetServiceInfo - Entry")); |
|
39 delete iServiceInfo; |
|
40 __FLOG(_L8("~CMTPSvcGetServiceInfo - Exit")); |
|
41 __FLOG_CLOSE; |
|
42 } |
|
43 |
|
44 CMTPSvcGetServiceInfo::CMTPSvcGetServiceInfo(MMTPDataProviderFramework& aFramework, MMTPConnection& aConnection, |
|
45 MMTPServiceDataProvider& aDataProvider) : |
|
46 CMTPRequestProcessor(aFramework, aConnection, 0, NULL), iDataProvider(aDataProvider) |
|
47 { |
|
48 } |
|
49 |
|
50 void CMTPSvcGetServiceInfo::ConstructL() |
|
51 { |
|
52 __FLOG_OPEN(KMTPSubsystem, KComponent); |
|
53 __FLOG(_L8("ConstructL - Entry")); |
|
54 iServiceInfo = CMTPTypeServiceInfo::NewL(); |
|
55 __FLOG(_L8("ConstructL - Exit")); |
|
56 } |
|
57 |
|
58 TMTPResponseCode CMTPSvcGetServiceInfo::CheckRequestL() |
|
59 { |
|
60 __FLOG(_L8("CheckRequestL - Entry")); |
|
61 TMTPResponseCode responseCode = CMTPRequestProcessor::CheckRequestL(); |
|
62 if (EMTPRespCodeOK == responseCode) |
|
63 { |
|
64 TUint32 serviceId = Request().Uint32(TMTPTypeRequest::ERequestParameter1); |
|
65 if (serviceId != iDataProvider.ServiceID()) |
|
66 { |
|
67 responseCode = EMTPRespCodeInvalidServiceID; |
|
68 } |
|
69 } |
|
70 __FLOG_VA((_L8("CheckRequestL - Exit with response code = 0x%04X"), responseCode)); |
|
71 return responseCode; |
|
72 } |
|
73 |
|
74 void CMTPSvcGetServiceInfo::ServiceL() |
|
75 { |
|
76 __FLOG(_L8("ServiceL - Entry")); |
|
77 iResponseCode = (iDataProvider.ServiceHandler())->GetServiceInfoL(*iServiceInfo); |
|
78 SendDataL(*iServiceInfo); |
|
79 __FLOG(_L8("ServiceL - Exit")); |
|
80 } |
|
81 |
|
82 TBool CMTPSvcGetServiceInfo::DoHandleResponsePhaseL() |
|
83 { |
|
84 __FLOG(_L8("DoHandleResponsePhaseL - Entry")); |
|
85 TMTPResponseCode responseCode = (iCancelled ? EMTPRespCodeIncompleteTransfer : iResponseCode); |
|
86 SendResponseL(responseCode); |
|
87 __FLOG_VA((_L8("DoHandleResponsePhaseL - Exit with Response Code: 0x%x"), iResponseCode)); |
|
88 return EFalse; |
|
89 } |