|
1 // Copyright (c) 2006-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 @internalComponent |
|
19 */ |
|
20 |
|
21 #ifndef CMTPDEVICEDATASTORE_H |
|
22 #define CMTPDEVICEDATASTORE_H |
|
23 |
|
24 #include <e32base.h> |
|
25 #include <etel3rdparty.h> |
|
26 #include <mtp/tmtptypeuint32.h> |
|
27 #include <mtp/cmtptypearray.h> |
|
28 |
|
29 #include "mtpdebug.h" |
|
30 #include "rmtpframework.h" |
|
31 #include "mmtpdevdpextn.h" |
|
32 #include"cmtpextndevdp.h" |
|
33 |
|
34 class CMTPTypeString; |
|
35 class MMTPEnumerationCallback; |
|
36 class RFs; |
|
37 class RReadStream; |
|
38 class RWriteStream; |
|
39 |
|
40 /** |
|
41 Implements the MTP device data provider's device information data store. |
|
42 @internalComponent |
|
43 */ |
|
44 class CMTPDeviceDataStore : public CActive |
|
45 { |
|
46 |
|
47 public: |
|
48 |
|
49 static CMTPDeviceDataStore* NewL(); |
|
50 ~CMTPDeviceDataStore(); |
|
51 |
|
52 TBool RequestPending() const; |
|
53 void BatteryLevelL(TRequestStatus& aStatus, TUint& aBatteryLevel); |
|
54 const TDesC& DeviceFriendlyName() const; |
|
55 const TDesC& DeviceFriendlyNameDefault() const; |
|
56 const TDesC& DeviceVersion() const; |
|
57 const TDesC& Manufacturer() const; |
|
58 const TDesC& Model() const; |
|
59 const TDesC& MTPExtensions() const; |
|
60 const TDesC& SerialNumber() const; |
|
61 const TDesC& SynchronisationPartner() const; |
|
62 const TDesC& SynchronisationPartnerDefault() const; |
|
63 |
|
64 void SetDeviceFriendlyNameL(const TDesC& aName); |
|
65 void SetSynchronisationPartnerL(const TDesC& aName); |
|
66 |
|
67 void StartEnumerationL(TUint32 aStorageId, MMTPEnumerationCallback& aCallback); |
|
68 const TDesC& SessionInitiatorVersionInfo() const; |
|
69 const TDesC& SessionInitiatorVersionInfoDefault() const; |
|
70 void SetSessionInitiatorVersionInfoL(const TDesC& aName); |
|
71 TUint32 PerceivedDeviceTypeDefault() const; |
|
72 TUint32 PerceivedDeviceType() const; |
|
73 const TDesC& DateTimeL(); |
|
74 TInt SetDateTimeL(const TDesC& aDateTime ); |
|
75 void DateTimeToStringL(TDes& aDateTime); |
|
76 void StringToDateTime(TDes& aDateTime ); |
|
77 void LoadDeviceIconL(); |
|
78 const CMTPTypeArray& DeviceIcon(); |
|
79 TInt ValidateString(const TDesC& aDateTimeStr, TDes& aDateTime, TInt &aOffsetVal); |
|
80 |
|
81 |
|
82 |
|
83 /*utility methods */ |
|
84 void SetSupportedDevicePropertiesL(RArray<TUint> &aSupportedDevProps); |
|
85 const CMTPTypeArray & GetSupportedDeviceProperties(); |
|
86 void SetExtnDevicePropDp(MExtnDevicePropDp* aExtnDevicePropDp); |
|
87 MExtnDevicePropDp* ExtnDevicePropDp(); |
|
88 |
|
89 private: // Form CActive |
|
90 |
|
91 void DoCancel(); |
|
92 TInt RunError(TInt aError); |
|
93 void RunL(); |
|
94 void CheckDeviceIconProperties( RArray<TUint> &aSupportedDeviceProperties); |
|
95 |
|
96 private: |
|
97 |
|
98 CMTPDeviceDataStore(); |
|
99 void ConstructL(); |
|
100 |
|
101 TBool Enumerated() const; |
|
102 void ExternalizeL(RWriteStream& aWriteStream) const; |
|
103 void InternalizeL(RReadStream& aReadStream); |
|
104 const TDesC& PropertyStoreName(); |
|
105 void AppendMTPExtensionSetsL(TBool& aCompleted); |
|
106 void RestoreL(); |
|
107 void Schedule(TInt32 aState); |
|
108 void SetRequestComplete(TRequestStatus& aRequest, TUint aErr); |
|
109 void SetRequestPending(TRequestStatus& aRequest); |
|
110 void SetState(TInt32 aState); |
|
111 TInt32 State() const; |
|
112 void StoreL(); |
|
113 void StoreFormattedSerialNumber(const TDesC& aSerialNo); |
|
114 |
|
115 private: // Owned |
|
116 |
|
117 enum TState |
|
118 { |
|
119 EUndefined = 0x00000000, |
|
120 EEnumeratingDevicePropertyStore = 0x00000001, |
|
121 EEnumeratingDeviceVersion = 0x00000002, |
|
122 EEnumeratingPhoneId = 0x00000003, |
|
123 EEnumeratingBatteryLevel = 0x00000004, |
|
124 EEnumeratingVendorExtensions = 0x00000005, |
|
125 EEnumerated = 0x80000000, |
|
126 EEnumeratedBatteryLevel = 0x80000004, |
|
127 }; |
|
128 |
|
129 private: // Owned |
|
130 |
|
131 /** |
|
132 FLOGGER debug trace member variable. |
|
133 */ |
|
134 __FLOG_DECLARATION_MEMBER_MUTABLE; |
|
135 |
|
136 CTelephony::TBatteryInfoV1 iBatteryInfoV1; |
|
137 CTelephony::TBatteryInfoV1Pckg iBatteryInfoV1Pckg; |
|
138 CMTPTypeString* iDeviceFriendlyName; |
|
139 RBuf iDeviceVersion; |
|
140 RMTPFramework iSingletons; |
|
141 RBuf iMTPExtensions; |
|
142 CTelephony::TPhoneIdV1 iPhoneIdV1; |
|
143 CTelephony::TPhoneIdV1Pckg iPhoneIdV1Pckg; |
|
144 TFileName iPropertyStoreName; |
|
145 RBuf iSerialNumber; |
|
146 TInt32 iState; |
|
147 TUint32 iStorageId; |
|
148 CMTPTypeString* iSynchronisationPartner; |
|
149 CTelephony* iTelephony; |
|
150 HBufC* iDeviceFriendlyNameDefault; |
|
151 HBufC* iSyncPartnerNameDefault; |
|
152 TInt iCurrentDpIndex; |
|
153 //HBufC* iSessionInitiatorVersionInfoDefault; |
|
154 CMTPTypeString* iSessionInitiatorVersionInfo; |
|
155 TMTPTypeUint32 iPerceivedDeviceType; |
|
156 CMTPTypeString* iDateTime; |
|
157 CMTPTypeArray* iDeviceIcon; |
|
158 |
|
159 // this array is to store all supported device properties. |
|
160 CMTPTypeArray* iSupportedDevProArray; |
|
161 TUint8 iFormatOreder; |
|
162 |
|
163 private: // Not owned. |
|
164 |
|
165 MMTPEnumerationCallback* iCallback; |
|
166 TRequestStatus* iPendingStatus; |
|
167 TUint* iPendingBatteryLevel; |
|
168 |
|
169 MExtnDevicePropDp* iExtnDevicePropDp; |
|
170 }; |
|
171 |
|
172 #endif // CMTPDEVICEDATASTORE_H |