|
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 // |
|
15 |
|
16 /** |
|
17 @file |
|
18 @publishedPartner |
|
19 */ |
|
20 |
|
21 |
|
22 #include "cmtpextndevdpplugin.h" |
|
23 |
|
24 static const TInt KDefaultValue = 55; |
|
25 |
|
26 CDevDpReferncePlugin* CDevDpReferncePlugin::NewL() |
|
27 { |
|
28 CDevDpReferncePlugin* self = new(ELeave) CDevDpReferncePlugin; |
|
29 CleanupStack::PushL(self); |
|
30 self->ConstructL(); |
|
31 CleanupStack::Pop(self); |
|
32 return self; |
|
33 } |
|
34 |
|
35 void CDevDpReferncePlugin::ConstructL() |
|
36 { |
|
37 iData = new(ELeave) TMTPTypeUint32(); |
|
38 } |
|
39 |
|
40 |
|
41 void CDevDpReferncePlugin::Supported(TMTPSupportCategory /*aCategory*/ ,RArray <TUint>& aArray, TMTPOperationalMode aMode) |
|
42 { |
|
43 if(KMTPModeMTP == aMode) |
|
44 { |
|
45 aArray.Append(EMTPDevicePropCodePlaybackObject ); // 0xD411, |
|
46 } |
|
47 } |
|
48 |
|
49 |
|
50 CDevDpReferncePlugin::CDevDpReferncePlugin() |
|
51 { |
|
52 } |
|
53 |
|
54 CDevDpReferncePlugin::~CDevDpReferncePlugin() |
|
55 { |
|
56 delete iData; |
|
57 delete iPropDesc; |
|
58 } |
|
59 |
|
60 /** |
|
61 returns the default value |
|
62 */ |
|
63 TInt CDevDpReferncePlugin::GetDevPropertyL (const TMTPDevicePropertyCode aPropCode, MMTPType** aMMTPType) |
|
64 { |
|
65 TInt errorCode = KErrNone; |
|
66 switch(aPropCode) |
|
67 { |
|
68 case EMTPDevicePropCodePlaybackObject: |
|
69 iData->Set(KDefaultValue); |
|
70 *aMMTPType = iData; |
|
71 break; |
|
72 default: |
|
73 errorCode = KErrNotFound; |
|
74 break; |
|
75 } |
|
76 return errorCode; |
|
77 } |
|
78 |
|
79 TInt CDevDpReferncePlugin::GetDevPropertyDescL (const TMTPDevicePropertyCode aPropCode, MMTPType** aMMTPType) |
|
80 { |
|
81 TInt errorCode = KErrNone; |
|
82 |
|
83 switch (aPropCode) |
|
84 { |
|
85 case EMTPDevicePropCodePlaybackObject: |
|
86 delete iPropDesc; |
|
87 iPropDesc = NULL; |
|
88 iPropDesc = CMTPTypeDevicePropDesc::NewL(EMTPDevicePropCodePlaybackObject, 1, 0, NULL); |
|
89 iPropDesc->SetUint32L(CMTPTypeDevicePropDesc::EFactoryDefaultValue, 0); |
|
90 iPropDesc->SetUint32L(CMTPTypeDevicePropDesc::ECurrentValue, 1); |
|
91 *aMMTPType = iPropDesc; |
|
92 break; |
|
93 default: |
|
94 errorCode = KErrNotFound; |
|
95 break; |
|
96 } |
|
97 return errorCode; |
|
98 } |
|
99 /** |
|
100 called from ServiceL allocates the container for receiving data. |
|
101 */ |
|
102 TInt CDevDpReferncePlugin::GetDevicePropertyContainerL(TMTPDevicePropertyCode aPropCode, MMTPType** aMmtpType) |
|
103 { |
|
104 TInt errorCode = KErrNone; |
|
105 iPropCode = aPropCode; |
|
106 switch (aPropCode) |
|
107 { |
|
108 case EMTPDevicePropCodePlaybackObject: |
|
109 { |
|
110 *aMmtpType = iData; |
|
111 } |
|
112 break; |
|
113 |
|
114 default: |
|
115 errorCode = KErrNotFound; |
|
116 break; |
|
117 } |
|
118 return errorCode; |
|
119 } |
|
120 |
|
121 |
|
122 TMTPResponseCode CDevDpReferncePlugin::SetDevicePropertyL() |
|
123 { |
|
124 TInt errorCode = KErrNone; |
|
125 switch (iPropCode) |
|
126 { |
|
127 case EMTPDevicePropCodePlaybackObject: |
|
128 { |
|
129 //if extension plugin supports more than one property. then add member a variable to |
|
130 //store the incoming value in it. |
|
131 TUint int1 = (iData->Value()); |
|
132 } |
|
133 break; |
|
134 |
|
135 default: |
|
136 errorCode = KErrNotFound; |
|
137 break; |
|
138 } |
|
139 |
|
140 if(errorCode == KErrNone) |
|
141 { |
|
142 return EMTPRespCodeOK; |
|
143 } |
|
144 else |
|
145 { |
|
146 return EMTPRespCodeOperationNotSupported; |
|
147 } |
|
148 } |
|
149 |
|
150 |
|
151 TInt CDevDpReferncePlugin::ResetDevPropertyL(TMTPDevicePropertyCode aPropCode) |
|
152 { |
|
153 TInt errorCode = KErrNone; |
|
154 switch (aPropCode) |
|
155 { |
|
156 case EMTPDevicePropCodePlaybackObject: |
|
157 { |
|
158 iData->Set(KDefaultValue);// setting to default value |
|
159 } |
|
160 break; |
|
161 default: |
|
162 errorCode = KErrNotFound; |
|
163 break; |
|
164 } |
|
165 return errorCode; |
|
166 } |
|
167 |