|
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/cmtpsvcgetstorageinfo.cpp |
|
15 |
|
16 #include <mtp/mmtpdataproviderframework.h> |
|
17 #include <mtp/mmtpobjectmgr.h> |
|
18 #include <mtp/cmtptypestorageinfo.h> |
|
19 #include <mtp/cmtptypestring.h> |
|
20 #include <mtp/mmtpstoragemgr.h> |
|
21 |
|
22 #include "cmtpsvcgetstorageinfo.h" |
|
23 #include "mmtpservicedataprovider.h" |
|
24 |
|
25 __FLOG_STMT(_LIT8(KComponent,"SvcGetStgInfo");) |
|
26 |
|
27 EXPORT_C MMTPRequestProcessor* CMTPSvcGetStorageInfo::NewL( |
|
28 MMTPDataProviderFramework& aFramework, |
|
29 MMTPConnection& aConnection, |
|
30 MMTPServiceDataProvider& aDataProvider) |
|
31 { |
|
32 CMTPSvcGetStorageInfo* self = new (ELeave) CMTPSvcGetStorageInfo(aFramework, aConnection, aDataProvider); |
|
33 CleanupStack::PushL(self); |
|
34 self->ConstructL(); |
|
35 CleanupStack::Pop(self); |
|
36 return self; |
|
37 } |
|
38 |
|
39 EXPORT_C CMTPSvcGetStorageInfo::~CMTPSvcGetStorageInfo() |
|
40 { |
|
41 __FLOG(_L8("~CMTPSvcGetStorageInfo - Entry")); |
|
42 delete iStorageInfo; |
|
43 __FLOG(_L8("~CMTPSvcGetStorageInfo - Exit")); |
|
44 __FLOG_CLOSE; |
|
45 } |
|
46 |
|
47 CMTPSvcGetStorageInfo::CMTPSvcGetStorageInfo( |
|
48 MMTPDataProviderFramework& aFramework, |
|
49 MMTPConnection& aConnection, |
|
50 MMTPServiceDataProvider& aDataProvider) |
|
51 : CMTPRequestProcessor(aFramework, aConnection, 0, NULL), iDataProvider(aDataProvider) |
|
52 { |
|
53 } |
|
54 |
|
55 /** |
|
56 GetStorageInfo request handler |
|
57 Build storage info data set and send the data to the initiator |
|
58 */ |
|
59 void CMTPSvcGetStorageInfo::ConstructL() |
|
60 { |
|
61 __FLOG_OPEN(KMTPSubsystem, KComponent); |
|
62 __FLOG(_L8("ConstructL - Entry")); |
|
63 iStorageInfo = CMTPTypeStorageInfo::NewL(); |
|
64 __FLOG(_L8("ConstructL - Exit")); |
|
65 } |
|
66 |
|
67 void CMTPSvcGetStorageInfo::ServiceL() |
|
68 { |
|
69 __FLOG(_L8("ServiceL - Entry")); |
|
70 iDataProvider.GetStorageInfoL(*iStorageInfo); |
|
71 SendDataL(*iStorageInfo); |
|
72 __FLOG(_L8("ServiceL - Exit")); |
|
73 } |
|
74 |
|
75 TMTPResponseCode CMTPSvcGetStorageInfo::CheckRequestL() |
|
76 { |
|
77 __FLOG(_L8("CheckRequestL - Entry")); |
|
78 TMTPResponseCode responseCode = CMTPRequestProcessor::CheckRequestL(); |
|
79 if (EMTPRespCodeOK == responseCode) |
|
80 { |
|
81 TUint32 storageID = Request().Uint32(TMTPTypeRequest::ERequestParameter1); |
|
82 if (storageID != iDataProvider.StorageId()) |
|
83 { |
|
84 responseCode = EMTPRespCodeInvalidStorageID; |
|
85 } |
|
86 } |
|
87 __FLOG_VA((_L8("CheckRequestL Exit with response code = 0x%04X"), responseCode)); |
|
88 return responseCode; |
|
89 } |