154 else |
158 else |
155 { |
159 { |
156 aBatteryLevel = KMTPDefaultBatteryLevel; |
160 aBatteryLevel = KMTPDefaultBatteryLevel; |
157 SetRequestComplete(*iPendingStatus, KErrNone); |
161 SetRequestComplete(*iPendingStatus, KErrNone); |
158 } |
162 } |
159 __FLOG(_L8("BatteryLevel - Exit")); |
163 OstTraceFunctionExit0( CMTPDEVICEDATASTORE_BATTERYLEVELL_EXIT ); |
160 } |
164 } |
161 |
165 |
162 /** |
166 /** |
163 Provides the MTP device friendly name. |
167 Provides the MTP device friendly name. |
164 @return The MTP device friendly name. |
168 @return The MTP device friendly name. |
165 */ |
169 */ |
166 const TDesC& CMTPDeviceDataStore::DeviceFriendlyName() const |
170 const TDesC& CMTPDeviceDataStore::DeviceFriendlyName() const |
167 { |
171 { |
168 __FLOG(_L8("DeviceFriendlyName - Entry")); |
172 OstTraceFunctionEntry0( CMTPDEVICEDATASTORE_DEVICEFRIENDLYNAME_ENTRY ); |
169 __FLOG(_L8("DeviceFriendlyName - Exit")); |
173 OstTraceFunctionExit0( CMTPDEVICEDATASTORE_DEVICEFRIENDLYNAME_EXIT ); |
170 return iDeviceFriendlyName->StringChars(); |
174 return iDeviceFriendlyName->StringChars(); |
171 } |
175 } |
172 |
176 |
173 /** |
177 /** |
174 Provides the default MTP device friendly name. |
178 Provides the default MTP device friendly name. |
175 @return The default MTP device friendly name. |
179 @return The default MTP device friendly name. |
176 */ |
180 */ |
177 const TDesC& CMTPDeviceDataStore::DeviceFriendlyNameDefault() const |
181 const TDesC& CMTPDeviceDataStore::DeviceFriendlyNameDefault() const |
178 { |
182 { |
179 __FLOG(_L8("DeviceFriendlyNameDefault - Entry")); |
183 OstTraceFunctionEntry0( CMTPDEVICEDATASTORE_DEVICEFRIENDLYNAMEDEFAULT_ENTRY ); |
180 __FLOG(_L8("DeviceFriendlyNameDefault - Exit")); |
184 OstTraceFunctionExit0( CMTPDEVICEDATASTORE_DEVICEFRIENDLYNAMEDEFAULT_EXIT ); |
181 return *iDeviceFriendlyNameDefault; |
185 return *iDeviceFriendlyNameDefault; |
182 } |
186 } |
183 |
187 |
184 /** |
188 /** |
185 Provides the device firmware version identifier |
189 Provides the device firmware version identifier |
186 @return The device firmware version identifier . |
190 @return The device firmware version identifier . |
187 */ |
191 */ |
188 const TDesC& CMTPDeviceDataStore::DeviceVersion() const |
192 const TDesC& CMTPDeviceDataStore::DeviceVersion() const |
189 { |
193 { |
190 __FLOG(_L8("DeviceVersion - Entry")); |
194 OstTraceFunctionEntry0( CMTPDEVICEDATASTORE_DEVICEVERSION_ENTRY ); |
191 __FLOG(_L8("DeviceVersion - Exit")); |
195 OstTraceFunctionExit0( CMTPDEVICEDATASTORE_DEVICEVERSION_EXIT ); |
192 return iDeviceVersion; |
196 return iDeviceVersion; |
193 } |
197 } |
194 |
198 |
195 /** |
199 /** |
196 Provides the device manufacturer name. |
200 Provides the device manufacturer name. |
197 @return The device manufacturer name. |
201 @return The device manufacturer name. |
198 */ |
202 */ |
199 const TDesC& CMTPDeviceDataStore::Manufacturer() const |
203 const TDesC& CMTPDeviceDataStore::Manufacturer() const |
200 { |
204 { |
201 __FLOG(_L8("Manufacturer - Entry")); |
205 OstTraceFunctionEntry0( CMTPDEVICEDATASTORE_MANUFACTURER_ENTRY ); |
202 __ASSERT_DEBUG(Enumerated(), Panic(EMTPDevDpInvalidState)); |
206 __ASSERT_DEBUG(Enumerated(), Panic(EMTPDevDpInvalidState)); |
203 __FLOG(_L8("Manufacturer - Exit")); |
207 OstTraceFunctionExit0( CMTPDEVICEDATASTORE_MANUFACTURER_EXIT ); |
204 return iPhoneIdV1.iManufacturer; |
208 return iPhoneIdV1.iManufacturer; |
205 } |
209 } |
206 |
210 |
207 /** |
211 /** |
208 Provides the device model identifier. |
212 Provides the device model identifier. |
209 @return The device model identifier. |
213 @return The device model identifier. |
210 */ |
214 */ |
211 const TDesC& CMTPDeviceDataStore::Model() const |
215 const TDesC& CMTPDeviceDataStore::Model() const |
212 { |
216 { |
213 __FLOG(_L8("Model - Entry")); |
217 OstTraceFunctionEntry0( CMTPDEVICEDATASTORE_MODEL_ENTRY ); |
214 __ASSERT_DEBUG(Enumerated(), Panic(EMTPDevDpInvalidState)); |
218 __ASSERT_DEBUG(Enumerated(), Panic(EMTPDevDpInvalidState)); |
215 __FLOG(_L8("Model - Exit")); |
219 OstTraceFunctionExit0( CMTPDEVICEDATASTORE_MODEL_EXIT ); |
216 return iPhoneIdV1.iModel; |
220 return iPhoneIdV1.iModel; |
217 } |
221 } |
218 |
222 |
219 /** |
223 /** |
220 Provides the MTP Vendor Extension string. |
224 Provides the MTP Vendor Extension string. |
221 @return The MTP Vendor Extension string. |
225 @return The MTP Vendor Extension string. |
222 */ |
226 */ |
223 const TDesC& CMTPDeviceDataStore::MTPExtensions() const |
227 const TDesC& CMTPDeviceDataStore::MTPExtensions() const |
224 { |
228 { |
225 __FLOG(_L8("MTPExtensions - Entry")); |
229 OstTraceFunctionEntry0( CMTPDEVICEDATASTORE_MTPEXTENSIONS_ENTRY ); |
226 __FLOG(_L8("MTPExtensions - Exit")); |
230 OstTraceFunctionExit0( CMTPDEVICEDATASTORE_MTPEXTENSIONS_EXIT ); |
227 return iMTPExtensions; |
231 return iMTPExtensions; |
228 } |
232 } |
229 |
233 |
230 /** |
234 /** |
231 Provides the device serial number. |
235 Provides the device serial number. |
232 @return The device serial number. |
236 @return The device serial number. |
233 */ |
237 */ |
234 const TDesC& CMTPDeviceDataStore::SerialNumber() const |
238 const TDesC& CMTPDeviceDataStore::SerialNumber() const |
235 { |
239 { |
236 __FLOG(_L8("SerialNumber - Entry")); |
240 OstTraceFunctionEntry0( CMTPDEVICEDATASTORE_SERIALNUMBER_ENTRY ); |
237 __ASSERT_DEBUG(Enumerated(), Panic(EMTPDevDpInvalidState)); |
241 __ASSERT_DEBUG(Enumerated(), Panic(EMTPDevDpInvalidState)); |
238 __FLOG(_L8("SerialNumber - Exit")); |
242 OstTraceFunctionExit0( CMTPDEVICEDATASTORE_SERIALNUMBER_EXIT ); |
239 return iPhoneIdV1.iSerialNumber; |
243 return iPhoneIdV1.iSerialNumber; |
240 } |
244 } |
241 |
245 |
242 /** |
246 /** |
243 Provides the MTP synchronisation partner name. |
247 Provides the MTP synchronisation partner name. |
244 @return The MTP synchronisation partner name. |
248 @return The MTP synchronisation partner name. |
245 */ |
249 */ |
246 const TDesC& CMTPDeviceDataStore::SynchronisationPartner() const |
250 const TDesC& CMTPDeviceDataStore::SynchronisationPartner() const |
247 { |
251 { |
248 __FLOG(_L8("SynchronisationPartner - Entry")); |
252 OstTraceFunctionEntry0( CMTPDEVICEDATASTORE_SYNCHRONISATIONPARTNER_ENTRY ); |
249 __FLOG(_L8("SynchronisationPartner - Exit")); |
253 OstTraceFunctionExit0( CMTPDEVICEDATASTORE_SYNCHRONISATIONPARTNER_EXIT ); |
250 return iSynchronisationPartner->StringChars(); |
254 return iSynchronisationPartner->StringChars(); |
251 } |
255 } |
252 |
256 |
253 /** |
257 /** |
254 Provides the default MTP synchronisation partner name. |
258 Provides the default MTP synchronisation partner name. |
255 @return The default MTP synchronisation partner name. |
259 @return The default MTP synchronisation partner name. |
256 */ |
260 */ |
257 const TDesC& CMTPDeviceDataStore::SynchronisationPartnerDefault() const |
261 const TDesC& CMTPDeviceDataStore::SynchronisationPartnerDefault() const |
258 { |
262 { |
259 __FLOG(_L8("SynchronisationPartnerDefault - Entry")); |
263 OstTraceFunctionEntry0( CMTPDEVICEDATASTORE_SYNCHRONISATIONPARTNERDEFAULT_ENTRY ); |
260 __FLOG(_L8("SynchronisationPartnerDefault - Exit")); |
264 OstTraceFunctionExit0( CMTPDEVICEDATASTORE_SYNCHRONISATIONPARTNERDEFAULT_EXIT ); |
261 return *iSyncPartnerNameDefault; |
265 return *iSyncPartnerNameDefault; |
262 } |
266 } |
263 |
267 |
264 /** |
268 /** |
265 Sets the MTP device friendly name. |
269 Sets the MTP device friendly name. |
266 @param aName The new MTP device friendly name. |
270 @param aName The new MTP device friendly name. |
267 @leave One of the system wide error codes, if a processing failure occurs. |
271 @leave One of the system wide error codes, if a processing failure occurs. |
268 */ |
272 */ |
269 void CMTPDeviceDataStore::SetDeviceFriendlyNameL(const TDesC& aName) |
273 void CMTPDeviceDataStore::SetDeviceFriendlyNameL(const TDesC& aName) |
270 { |
274 { |
271 __FLOG(_L8("SetDeviceFriendlyNameL - Entry")); |
275 OstTraceFunctionEntry0( CMTPDEVICEDATASTORE_SETDEVICEFRIENDLYNAMEL_ENTRY ); |
272 iDeviceFriendlyName->SetL(aName); |
276 iDeviceFriendlyName->SetL(aName); |
273 StoreL(); |
277 StoreL(); |
274 __FLOG(_L8("SetDeviceFriendlyNameL - Exit")); |
278 OstTraceFunctionExit0( CMTPDEVICEDATASTORE_SETDEVICEFRIENDLYNAMEL_EXIT ); |
275 } |
279 } |
276 |
280 |
277 /** |
281 /** |
278 Sets the synchronisation partner name. |
282 Sets the synchronisation partner name. |
279 @param aName The new MTP synchronisation partner name. |
283 @param aName The new MTP synchronisation partner name. |
280 @leave One of the system wide error codes, if a processing failure occurs. |
284 @leave One of the system wide error codes, if a processing failure occurs. |
281 */ |
285 */ |
282 void CMTPDeviceDataStore::SetSynchronisationPartnerL(const TDesC& aName) |
286 void CMTPDeviceDataStore::SetSynchronisationPartnerL(const TDesC& aName) |
283 { |
287 { |
284 __FLOG(_L8("SetSynchronisationPartnerL - Entry")); |
288 OstTraceFunctionEntry0( CMTPDEVICEDATASTORE_SETSYNCHRONISATIONPARTNERL_ENTRY ); |
285 iSynchronisationPartner->SetL(aName); |
289 iSynchronisationPartner->SetL(aName); |
286 StoreL(); |
290 StoreL(); |
287 __FLOG(_L8("SetSynchronisationPartnerL - Exit")); |
291 OstTraceFunctionExit0( CMTPDEVICEDATASTORE_SETSYNCHRONISATIONPARTNERL_EXIT ); |
288 } |
292 } |
289 |
293 |
290 /** |
294 /** |
291 Initiates the MTP device data provider's device information data store |
295 Initiates the MTP device data provider's device information data store |
292 enumeration sequence. The sequence is concluded when ObjectEnumerationCompleteL |
296 enumeration sequence. The sequence is concluded when ObjectEnumerationCompleteL |
543 iDateTime = CMTPTypeString::NewL(dateTimeString); |
549 iDateTime = CMTPTypeString::NewL(dateTimeString); |
544 |
550 |
545 //11 Device Icon property, Load the icon into Auint Atrray |
551 //11 Device Icon property, Load the icon into Auint Atrray |
546 LoadDeviceIconL(); |
552 LoadDeviceIconL(); |
547 |
553 |
548 __FLOG(_L8("ConstructL - Exit")); |
554 OstTraceFunctionExit0( CMTPDEVICEDATASTORE_CONSTRUCTL_EXIT ); |
549 } |
555 } |
550 |
556 |
551 /** |
557 /** |
552 Indicates if the device information data store is in the EEnumerated state. |
558 Indicates if the device information data store is in the EEnumerated state. |
553 @return ETrue if the device data store state is enumerated, otherwiese EFalse. |
559 @return ETrue if the device data store state is enumerated, otherwiese EFalse. |
554 */ |
560 */ |
555 TBool CMTPDeviceDataStore::Enumerated() const |
561 TBool CMTPDeviceDataStore::Enumerated() const |
556 { |
562 { |
557 __FLOG(_L8("Enumerated - Entry")); |
563 OstTraceFunctionEntry0( CMTPDEVICEDATASTORE_ENUMERATED_ENTRY ); |
558 TInt32 state(State()); |
564 TInt32 state(State()); |
559 __FLOG(_L8("Enumerated - Exit")); |
565 OstTraceFunctionExit0( CMTPDEVICEDATASTORE_ENUMERATED_EXIT ); |
560 return (state & EEnumerated); |
566 return (state & EEnumerated); |
561 } |
567 } |
562 |
568 |
563 /** |
569 /** |
564 Externalizes device properties to the device property store. |
570 Externalizes device properties to the device property store. |
565 @param aWriteStream the stream to externalize the device properties |
571 @param aWriteStream the stream to externalize the device properties |
566 @leave One of the system wide error codes, if a processing failure occurs. |
572 @leave One of the system wide error codes, if a processing failure occurs. |
567 */ |
573 */ |
568 void CMTPDeviceDataStore::ExternalizeL(RWriteStream& aWriteStream) const |
574 void CMTPDeviceDataStore::ExternalizeL(RWriteStream& aWriteStream) const |
569 { |
575 { |
570 __FLOG(_L8("ExternalizeL - Entry")); |
576 OstTraceFunctionEntry0( CMTPDEVICEDATASTORE_EXTERNALIZEL_ENTRY ); |
571 aWriteStream.WriteInt32L(KMTPDevicePropertyStoreVersion); |
577 aWriteStream.WriteInt32L(KMTPDevicePropertyStoreVersion); |
572 aWriteStream << DeviceFriendlyName(); |
578 aWriteStream << DeviceFriendlyName(); |
573 aWriteStream << SynchronisationPartner(); |
579 aWriteStream << SynchronisationPartner(); |
574 __FLOG(_L8("ExternalizeL - Exit")); |
580 OstTraceFunctionExit0( CMTPDEVICEDATASTORE_EXTERNALIZEL_EXIT ); |
575 } |
581 } |
576 |
582 |
577 /** |
583 /** |
578 Internalises device properties from the device property store. |
584 Internalises device properties from the device property store. |
579 @param aReadStream The device property store input data stream. |
585 @param aReadStream The device property store input data stream. |
580 @leave One of the system wide error codes, if a processing failure occurs. |
586 @leave One of the system wide error codes, if a processing failure occurs. |
581 */ |
587 */ |
582 void CMTPDeviceDataStore::InternalizeL(RReadStream& aReadStream) |
588 void CMTPDeviceDataStore::InternalizeL(RReadStream& aReadStream) |
583 { |
589 { |
584 __FLOG(_L8("InternalizeL - Entry")); |
590 OstTraceFunctionEntry0( CMTPDEVICEDATASTORE_INTERNALIZEL_ENTRY ); |
585 RBuf buf; |
591 RBuf buf; |
586 buf.CleanupClosePushL(); |
592 buf.CleanupClosePushL(); |
587 |
593 |
588 /* |
594 /* |
589 Read the device property store version. This is present for future |
595 Read the device property store version. This is present for future |
600 buf.CreateL(aReadStream, KMTPMaxStringCharactersLength); |
606 buf.CreateL(aReadStream, KMTPMaxStringCharactersLength); |
601 iSynchronisationPartner->SetL(buf); |
607 iSynchronisationPartner->SetL(buf); |
602 buf.Close(); |
608 buf.Close(); |
603 |
609 |
604 CleanupStack::Pop(); //buf |
610 CleanupStack::Pop(); //buf |
605 __FLOG(_L8("InternalizeL - Exit")); |
611 OstTraceFunctionExit0( CMTPDEVICEDATASTORE_INTERNALIZEL_EXIT ); |
606 } |
612 } |
607 |
613 |
608 /** |
614 /** |
609 Provides the full pathname of the device property store. |
615 Provides the full pathname of the device property store. |
610 @return The full pathname of the device property store. |
616 @return The full pathname of the device property store. |
611 */ |
617 */ |
612 const TDesC& CMTPDeviceDataStore::PropertyStoreName() |
618 const TDesC& CMTPDeviceDataStore::PropertyStoreName() |
613 { |
619 { |
614 __FLOG(_L8("PropertyStoreName - Entry")); |
620 OstTraceFunctionEntry0( CMTPDEVICEDATASTORE_PROPERTYSTORENAME_ENTRY ); |
615 if (iPropertyStoreName.Length() == 0) |
621 if (iPropertyStoreName.Length() == 0) |
616 { |
622 { |
617 iSingletons.Fs().PrivatePath(iPropertyStoreName); |
623 iSingletons.Fs().PrivatePath(iPropertyStoreName); |
618 iPropertyStoreName.Insert(0, KMTPDevicePropertyStoreDrive); |
624 iPropertyStoreName.Insert(0, KMTPDevicePropertyStoreDrive); |
619 iPropertyStoreName.Append(KMTPNoBackupFolder); |
625 iPropertyStoreName.Append(KMTPNoBackupFolder); |
620 iPropertyStoreName.Append(KMTPDevicePropertyStoreFileName); |
626 iPropertyStoreName.Append(KMTPDevicePropertyStoreFileName); |
621 } |
627 } |
622 |
628 |
623 __FLOG(_L8("PropertyStoreName - Exit")); |
629 OstTraceFunctionExit0( CMTPDEVICEDATASTORE_PROPERTYSTORENAME_EXIT ); |
624 return iPropertyStoreName; |
630 return iPropertyStoreName; |
625 } |
631 } |
626 |
632 |
627 /** |
633 /** |
628 Query all dps for the MTP Vendor extensions set. |
634 Query all dps for the MTP Vendor extensions set. |
629 @return ETrue if finished querying all the dps, otherwise EFalse. |
635 @return ETrue if finished querying all the dps, otherwise EFalse. |
630 */ |
636 */ |
631 void CMTPDeviceDataStore::AppendMTPExtensionSetsL(TBool& aCompleted) |
637 void CMTPDeviceDataStore::AppendMTPExtensionSetsL(TBool& aCompleted) |
632 { |
638 { |
633 __FLOG(_L8("AppendMTPExtensionSetsL - Entry")); |
639 OstTraceFunctionEntry0( CMTPDEVICEDATASTORE_APPENDMTPEXTENSIONSETSL_ENTRY ); |
634 CMTPDataProviderController& dps(iSingletons.DpController()); |
640 CMTPDataProviderController& dps(iSingletons.DpController()); |
635 const TInt count = Min<TInt>(iCurrentDpIndex + KExtensionSetIterationRunLength, dps.Count()); |
641 const TInt count = Min<TInt>(iCurrentDpIndex + KExtensionSetIterationRunLength, dps.Count()); |
636 aCompleted = EFalse; |
642 aCompleted = EFalse; |
637 CDesCArraySeg* extensions = new (ELeave) CDesCArraySeg(KExtensionSetGranularity); |
643 CDesCArraySeg* extensions = new (ELeave) CDesCArraySeg(KExtensionSetGranularity); |
638 CleanupStack::PushL(extensions); |
644 CleanupStack::PushL(extensions); |
670 if(!aCompleted && iCurrentDpIndex >= dps.Count()) |
677 if(!aCompleted && iCurrentDpIndex >= dps.Count()) |
671 { |
678 { |
672 aCompleted = ETrue; |
679 aCompleted = ETrue; |
673 } |
680 } |
674 |
681 |
675 __FLOG(_L8("AppendMTPExtensionSetsL - Exit")); |
682 OstTraceFunctionExit0( CMTPDEVICEDATASTORE_APPENDMTPEXTENSIONSETSL_EXIT ); |
676 } |
683 } |
677 |
684 |
678 /** |
685 /** |
679 Loads device properties from the device property store. |
686 Loads device properties from the device property store. |
680 @leave One of the system wide error codes, if a processing failure occurs. |
687 @leave One of the system wide error codes, if a processing failure occurs. |
681 */ |
688 */ |
682 void CMTPDeviceDataStore::RestoreL() |
689 void CMTPDeviceDataStore::RestoreL() |
683 { |
690 { |
684 __FLOG(_L8("RestoreL - Entry")); |
691 OstTraceFunctionEntry0( CMTPDEVICEDATASTORE_RESTOREL_ENTRY ); |
685 RFs& fs(iSingletons.Fs()); |
692 RFs& fs(iSingletons.Fs()); |
686 if(BaflUtils::FileExists(fs, PropertyStoreName())) |
693 if(BaflUtils::FileExists(fs, PropertyStoreName())) |
687 { |
694 { |
688 CFileStore* store(CDirectFileStore::OpenLC(fs, PropertyStoreName(), EFileRead)); |
695 CFileStore* store(CDirectFileStore::OpenLC(fs, PropertyStoreName(), EFileRead)); |
689 RStoreReadStream instream; |
696 RStoreReadStream instream; |
690 instream.OpenLC(*store, store->Root()); |
697 instream.OpenLC(*store, store->Root()); |
691 InternalizeL(instream); |
698 InternalizeL(instream); |
692 CleanupStack::PopAndDestroy(2, store); // instream, store |
699 CleanupStack::PopAndDestroy(2, store); // instream, store |
693 } |
700 } |
694 __FLOG(_L8("RestoreL - Exit")); |
701 OstTraceFunctionExit0( CMTPDEVICEDATASTORE_RESTOREL_EXIT ); |
695 } |
702 } |
696 |
703 |
697 /** |
704 /** |
698 Schedules the device information data store to transition to the specified state. |
705 Schedules the device information data store to transition to the specified state. |
699 @param aState The new data stream state. |
706 @param aState The new data stream state. |
700 */ |
707 */ |
701 void CMTPDeviceDataStore::Schedule(TInt32 aState) |
708 void CMTPDeviceDataStore::Schedule(TInt32 aState) |
702 { |
709 { |
703 __FLOG(_L8("Schedule - Entry")); |
710 OstTraceFunctionEntry0( CMTPDEVICEDATASTORE_SCHEDULE_ENTRY ); |
704 SetState(aState); |
711 SetState(aState); |
705 SetRequestPending(iStatus); |
712 SetRequestPending(iStatus); |
706 SetActive(); |
713 SetActive(); |
707 SetRequestComplete(iStatus,KErrNone); |
714 SetRequestComplete(iStatus,KErrNone); |
708 __FLOG(_L8("Schedule - Exit")); |
715 OstTraceFunctionExit0( CMTPDEVICEDATASTORE_SCHEDULE_EXIT ); |
709 } |
716 } |
710 |
717 |
711 /** |
718 /** |
712 Completes the supplied asynchronous request completion status. |
719 Completes the supplied asynchronous request completion status. |
713 */ |
720 */ |
714 void CMTPDeviceDataStore::SetRequestComplete(TRequestStatus& aRequest, TUint aErr) |
721 void CMTPDeviceDataStore::SetRequestComplete(TRequestStatus& aRequest, TUint aErr) |
715 { |
722 { |
716 __FLOG(_L8("CompleteRequest - Entry")); |
723 OstTraceFunctionEntry0( CMTPDEVICEDATASTORE_SETREQUESTCOMPLETE_ENTRY ); |
717 TRequestStatus* status(&aRequest); |
724 TRequestStatus* status(&aRequest); |
718 User::RequestComplete(status, aErr); |
725 User::RequestComplete(status, aErr); |
719 __FLOG(_L8("CompleteRequest - Exit")); |
726 OstTraceFunctionExit0( CMTPDEVICEDATASTORE_SETREQUESTCOMPLETE_EXIT ); |
720 } |
727 } |
721 |
728 |
722 |
729 |
723 /** |
730 /** |
724 Initialises the supplied asynchronous request completion status. |
731 Initialises the supplied asynchronous request completion status. |
725 */ |
732 */ |
726 void CMTPDeviceDataStore::SetRequestPending(TRequestStatus& aRequest) |
733 void CMTPDeviceDataStore::SetRequestPending(TRequestStatus& aRequest) |
727 { |
734 { |
728 __FLOG(_L8("SetRequestPending - Entry")); |
735 OstTraceFunctionEntry0( CMTPDEVICEDATASTORE_SETREQUESTPENDING_ENTRY ); |
729 aRequest = KRequestPending; |
736 aRequest = KRequestPending; |
730 __FLOG(_L8("SetRequestPending - Exit")); |
737 OstTraceFunctionExit0( CMTPDEVICEDATASTORE_SETREQUESTPENDING_EXIT ); |
731 } |
738 } |
732 |
739 |
733 /** |
740 /** |
734 Sets the device information data store state variable. |
741 Sets the device information data store state variable. |
735 @param aState The new data stream state. |
742 @param aState The new data stream state. |
736 */ |
743 */ |
737 void CMTPDeviceDataStore::SetState(TInt32 aState) |
744 void CMTPDeviceDataStore::SetState(TInt32 aState) |
738 { |
745 { |
739 __FLOG(_L8("SetState - Entry")); |
746 OstTraceFunctionEntry0( CMTPDEVICEDATASTORE_SETSTATE_ENTRY ); |
740 iState = ((EEnumerated & iState) | aState); |
747 iState = ((EEnumerated & iState) | aState); |
741 __FLOG_VA((_L8("State set to 0x%08X"), iState)); |
748 OstTrace1(TRACE_NORMAL, CMTPDEVICEDATASTORE_SETSTATE, |
742 __FLOG(_L8("SetState - Exit")); |
749 "State set to 0x%08X", iState); |
|
750 OstTraceFunctionExit0( CMTPDEVICEDATASTORE_SETSTATE_EXIT ); |
743 } |
751 } |
744 |
752 |
745 /** |
753 /** |
746 Provides the device information data store state variable value. |
754 Provides the device information data store state variable value. |
747 @return The device information data store state variable value. |
755 @return The device information data store state variable value. |
748 */ |
756 */ |
749 TInt32 CMTPDeviceDataStore::State() const |
757 TInt32 CMTPDeviceDataStore::State() const |
750 { |
758 { |
751 __FLOG(_L8("State - Entry")); |
759 OstTraceFunctionEntry0( CMTPDEVICEDATASTORE_STATE_ENTRY ); |
752 __FLOG_VA((_L8("State = 0x%08X"), iState)); |
760 OstTrace1(TRACE_NORMAL, CMTPDEVICEDATASTORE_STATE, |
753 __FLOG(_L8("State - Exit")); |
761 "State = 0x%08X", iState); |
|
762 OstTraceFunctionExit0( CMTPDEVICEDATASTORE_STATE_EXIT ); |
754 return iState; |
763 return iState; |
755 } |
764 } |
756 |
765 |
757 /** |
766 /** |
758 Stores device properties in the device property store. |
767 Stores device properties in the device property store. |
759 @leave One of the system wide error codes, if a processing failure occurs. |
768 @leave One of the system wide error codes, if a processing failure occurs. |
760 */ |
769 */ |
761 void CMTPDeviceDataStore::StoreL() |
770 void CMTPDeviceDataStore::StoreL() |
762 { |
771 { |
763 __FLOG(_L8("StoreL - Entry")); |
772 OstTraceFunctionEntry0( CMTPDEVICEDATASTORE_STOREL_ENTRY ); |
764 CFileStore* store(CDirectFileStore::ReplaceLC(iSingletons.Fs(), PropertyStoreName(), EFileWrite)); |
773 CFileStore* store(CDirectFileStore::ReplaceLC(iSingletons.Fs(), PropertyStoreName(), EFileWrite)); |
765 store->SetTypeL(KDirectFileStoreLayoutUid); |
774 store->SetTypeL(KDirectFileStoreLayoutUid); |
766 RStoreWriteStream outstream; |
775 RStoreWriteStream outstream; |
767 TStreamId id = outstream.CreateLC(*store); |
776 TStreamId id = outstream.CreateLC(*store); |
768 ExternalizeL(outstream); |
777 ExternalizeL(outstream); |
769 outstream.CommitL(); |
778 outstream.CommitL(); |
770 CleanupStack::PopAndDestroy(&outstream); |
779 CleanupStack::PopAndDestroy(&outstream); |
771 store->SetRootL(id); |
780 store->SetRootL(id); |
772 store->CommitL(); |
781 store->CommitL(); |
773 CleanupStack::PopAndDestroy(store); |
782 CleanupStack::PopAndDestroy(store); |
774 __FLOG(_L8("StoreL - Exit")); |
783 OstTraceFunctionExit0( CMTPDEVICEDATASTORE_STOREL_EXIT ); |
775 } |
784 } |
776 |
785 |
777 /** |
786 /** |
778 Formats the specified serial number as a valid MTP Serial Number string. The |
787 Formats the specified serial number as a valid MTP Serial Number string. The |
779 MTP specification recommends that the serial number always be represented as |
788 MTP specification recommends that the serial number always be represented as |
780 exactly 32 characters, with leading zeros as required. |
789 exactly 32 characters, with leading zeros as required. |
781 */ |
790 */ |
782 void CMTPDeviceDataStore::StoreFormattedSerialNumber(const TDesC& aSerialNo) |
791 void CMTPDeviceDataStore::StoreFormattedSerialNumber(const TDesC& aSerialNo) |
783 { |
792 { |
784 __FLOG(_L8("FormatSerialNumber - Entry")); |
793 OstTraceFunctionEntry0( CMTPDEVICEDATASTORE_STOREFORMATTEDSERIALNUMBER_ENTRY ); |
785 TBuf<KMTPSerialNumberLength> formatted; |
794 TBuf<KMTPSerialNumberLength> formatted; |
786 if (aSerialNo.Length() < KMTPSerialNumberLength) |
795 if (aSerialNo.Length() < KMTPSerialNumberLength) |
787 { |
796 { |
788 formatted = aSerialNo; |
797 formatted = aSerialNo; |
789 } |
798 } |
797 } |
806 } |
798 |
807 |
799 // Store the formatted serial number. |
808 // Store the formatted serial number. |
800 iPhoneIdV1.iSerialNumber = formatted; |
809 iPhoneIdV1.iSerialNumber = formatted; |
801 |
810 |
802 __FLOG(_L8("FormatSerialNumber - Exit")); |
811 OstTraceFunctionExit0( CMTPDEVICEDATASTORE_STOREFORMATTEDSERIALNUMBER_EXIT ); |
803 } |
812 } |
804 |
813 |
805 /** |
814 /** |
806 * Get method for Session initiator version info(0xD406). |
815 * Get method for Session initiator version info(0xD406). |
807 * |
816 * |
808 * @return TDesC& : session initiator version info |
817 * @return TDesC& : session initiator version info |
809 */ |
818 */ |
810 const TDesC& CMTPDeviceDataStore::SessionInitiatorVersionInfo() const |
819 const TDesC& CMTPDeviceDataStore::SessionInitiatorVersionInfo() const |
811 { |
820 { |
812 __FLOG(_L8("SessionInitiatorVersionInfo - Entry:Exit")); |
821 OstTraceFunctionEntry0( CMTPDEVICEDATASTORE_SESSIONINITIATORVERSIONINFO_ENTRY ); |
|
822 OstTraceFunctionExit0( CMTPDEVICEDATASTORE_SESSIONINITIATORVERSIONINFO_EXIT ); |
813 return iSessionInitiatorVersionInfo->StringChars(); |
823 return iSessionInitiatorVersionInfo->StringChars(); |
814 } |
824 } |
815 |
825 |
816 /** |
826 /** |
817 * Get method for Session initiator version info Default value. |
827 * Get method for Session initiator version info Default value. |
818 * |
828 * |
819 * @return TDesC& : session initiator version info default. |
829 * @return TDesC& : session initiator version info default. |
820 */ |
830 */ |
821 const TDesC& CMTPDeviceDataStore::SessionInitiatorVersionInfoDefault() const |
831 const TDesC& CMTPDeviceDataStore::SessionInitiatorVersionInfoDefault() const |
822 { |
832 { |
823 __FLOG(_L8("SessionInitiatorVersionInfoDefault - Entry:Exit")); |
833 OstTraceFunctionEntry0( CMTPDEVICEDATASTORE_SESSIONINITIATORVERSIONINFODEFAULT_ENTRY ); |
|
834 OstTraceFunctionExit0( CMTPDEVICEDATASTORE_SESSIONINITIATORVERSIONINFODEFAULT_EXIT ); |
824 return KDefaultSessionInitiatorVersionInfo; |
835 return KDefaultSessionInitiatorVersionInfo; |
825 } |
836 } |
826 |
837 |
827 /** |
838 /** |
828 * Set method for Session initiator version info(0xD406). |
839 * Set method for Session initiator version info(0xD406). |
829 * |
840 * |
830 * @Param TDesC& : session initiator version info from the initiator |
841 * @Param TDesC& : session initiator version info from the initiator |
831 */ |
842 */ |
832 void CMTPDeviceDataStore::SetSessionInitiatorVersionInfoL(const TDesC& aVerInfo) |
843 void CMTPDeviceDataStore::SetSessionInitiatorVersionInfoL(const TDesC& aVerInfo) |
833 { |
844 { |
834 __FLOG(_L8("SetDeviceFriendlyNameL - Entry")); |
845 OstTraceFunctionEntry0( CMTPDEVICEDATASTORE_SETSESSIONINITIATORVERSIONINFOL_ENTRY ); |
835 iSessionInitiatorVersionInfo->SetL(aVerInfo); |
846 iSessionInitiatorVersionInfo->SetL(aVerInfo); |
836 StoreL(); |
847 StoreL(); |
837 __FLOG(_L8("SetDeviceFriendlyNameL - Exit")); |
848 OstTraceFunctionExit0( CMTPDEVICEDATASTORE_SETSESSIONINITIATORVERSIONINFOL_EXIT ); |
838 } |
849 } |
839 |
850 |
840 /** |
851 /** |
841 * Get method for PerceivedDeviceTypeDefault(0x00000000 Generic). |
852 * Get method for PerceivedDeviceTypeDefault(0x00000000 Generic). |
842 * |
853 * |
843 * @return TUint32: return value for PerceivedDeviceTypeDefault |
854 * @return TUint32: return value for PerceivedDeviceTypeDefault |
844 */ |
855 */ |
845 TUint32 CMTPDeviceDataStore::PerceivedDeviceTypeDefault() const |
856 TUint32 CMTPDeviceDataStore::PerceivedDeviceTypeDefault() const |
846 { |
857 { |
847 __FLOG(_L8("SessionInitiatorVersionInfoDefault - Entry:Exit")); |
858 OstTraceFunctionEntry0( CMTPDEVICEDATASTORE_PERCEIVEDDEVICETYPEDEFAULT_ENTRY ); |
|
859 OstTraceFunctionExit0( CMTPDEVICEDATASTORE_PERCEIVEDDEVICETYPEDEFAULT_EXIT ); |
848 return DefaultPerceivedDeviceType; |
860 return DefaultPerceivedDeviceType; |
849 } |
861 } |
850 |
862 |
851 /** |
863 /** |
852 * Get method for PerceivedDeviceType(0x00000003 Mobile Handset). |
864 * Get method for PerceivedDeviceType(0x00000003 Mobile Handset). |
1028 { |
1051 { |
1029 case 'T': |
1052 case 'T': |
1030 case 't': |
1053 case 't': |
1031 if(i != pos) |
1054 if(i != pos) |
1032 { |
1055 { |
1033 __FLOG_1(_L8("Invalid. 'T' encountered at offset %d"), i); |
1056 OstTrace1(TRACE_NORMAL, DUP2_CMTPDEVICEDATASTORE_VALIDATESTRING, |
1034 //error char at rong position |
1057 "Invalid. 'T' encountered at offset %d", i); |
|
1058 //error char at rong position |
1035 errCode = KErrGeneral; |
1059 errCode = KErrGeneral; |
1036 }//else fine |
1060 }//else fine |
1037 break; |
1061 break; |
1038 case 'Z': |
1062 case 'Z': |
1039 case 'z': |
1063 case 'z': |
1040 aOffsetVal = 0; |
1064 aOffsetVal = 0; |
1041 aDateTime.Copy(aDateTimeStr.Mid(0, i)); |
1065 aDateTime.Copy(aDateTimeStr.Mid(0, i)); |
1042 //error char at wrong position |
1066 //error char at wrong position |
1043 if(i <KMinDateTimeLength) |
1067 if(i <KMinDateTimeLength) |
1044 { |
1068 { |
1045 __FLOG_1(_L8("Invalid. 'Z' encountered at offset %d"), i); |
1069 OstTrace1(TRACE_NORMAL, DUP3_CMTPDEVICEDATASTORE_VALIDATESTRING, |
|
1070 "Invalid. 'Z' encountered at offset %d", i); |
1046 //error char at wrong position |
1071 //error char at wrong position |
1047 errCode = KErrGeneral; |
1072 errCode = KErrGeneral; |
1048 }//else fine |
1073 }//else fine |
1049 break; |
1074 break; |
1050 case '+': |
1075 case '+': |
1051 case '-': |
1076 case '-': |
1052 if(i < KMinDateTimeLength) |
1077 if(i < KMinDateTimeLength) |
1053 { |
1078 { |
1054 //error char at wrong position |
1079 //error char at wrong position |
1055 errCode = KErrGeneral; |
1080 errCode = KErrGeneral; |
1056 __FLOG_1(_L8("Invalid. '+/-' encountered at offset %d"), i); |
1081 OstTrace1(TRACE_NORMAL, DUP4_CMTPDEVICEDATASTORE_VALIDATESTRING, |
|
1082 "Invalid. '+/-' encountered at offset %d", i); |
1057 break; |
1083 break; |
1058 } |
1084 } |
1059 else |
1085 else |
1060 { |
1086 { |
1061 const TInt KHoursDigits = 2; |
1087 const TInt KHoursDigits = 2; |
1072 TLex minuteOffsetLex(aDateTimeStr.Mid(i+KHoursDigits+1, KMinutesDigits)); |
1098 TLex minuteOffsetLex(aDateTimeStr.Mid(i+KHoursDigits+1, KMinutesDigits)); |
1073 minuteOffsetLex.Val(minuteOffset); |
1099 minuteOffsetLex.Val(minuteOffset); |
1074 if ((hourOffset > 23) || (minuteOffset > 59)) |
1100 if ((hourOffset > 23) || (minuteOffset > 59)) |
1075 { |
1101 { |
1076 errCode = KErrGeneral; |
1102 errCode = KErrGeneral; |
1077 __FLOG_2(_L8("Invalid. Hour(%d) or Minute(%d) offset out of range."), hourOffset, minuteOffset); |
1103 OstTraceExt2(TRACE_NORMAL, DUP5_CMTPDEVICEDATASTORE_VALIDATESTRING, |
|
1104 "Invalid. Hour(%d) or Minute(%d) offset out of range.", hourOffset, minuteOffset); |
1078 break; |
1105 break; |
1079 } |
1106 } |
1080 |
1107 |
1081 |
1108 |
1082 aOffsetVal = (hourOffset * KSecondsPerHour) + (minuteOffset * KSecondsPerMinute); |
1109 aOffsetVal = (hourOffset * KSecondsPerHour) + (minuteOffset * KSecondsPerMinute); |
1083 if ('-' == aDateTimeStr[i]) |
1110 if ('-' == aDateTimeStr[i]) |
1084 { |
1111 { |
1085 aOffsetVal = -aOffsetVal; |
1112 aOffsetVal = -aOffsetVal; |
1086 } |
1113 } |
1087 __FLOG_1(_L8("Info: Timezone offset %d seconds"), aOffsetVal); |
1114 OstTrace1(TRACE_NORMAL, DUP6_CMTPDEVICEDATASTORE_VALIDATESTRING, |
|
1115 "Info: Timezone offset %d seconds", aOffsetVal); |
1088 } |
1116 } |
1089 |
1117 |
1090 break; |
1118 break; |
1091 case '.': |
1119 case '.': |
1092 case '\0': |
1120 case '\0': |
1093 if(i < KMinDateTimeLength) |
1121 if(i < KMinDateTimeLength) |
1094 { |
1122 { |
1095 //error char at wrong position |
1123 //error char at wrong position |
1096 errCode = KErrGeneral; |
1124 errCode = KErrGeneral; |
1097 __FLOG_1(_L8("Invalid. '.' or NULL at offset %d"), i); |
1125 OstTrace1(TRACE_NORMAL, DUP7_CMTPDEVICEDATASTORE_VALIDATESTRING, |
|
1126 "Invalid. '.' or NULL at offset %d", i); |
1098 } |
1127 } |
1099 break; |
1128 break; |
1100 default : |
1129 default : |
1101 //wrong char |
1130 //wrong char |
1102 errCode = KErrGeneral; |
1131 errCode = KErrGeneral; |
1103 __FLOG_2(_L8("Invalid. Character %04x at offset %d"), aDateTimeStr[i], i); |
1132 OstTraceExt2(TRACE_NORMAL, DUP8_CMTPDEVICEDATASTORE_VALIDATESTRING, |
|
1133 "Invalid. Character %04x at offset %d", aDateTimeStr[i], i); |
1104 break; |
1134 break; |
1105 } |
1135 } |
1106 } |
1136 } |
1107 if(KErrNone != errCode) |
1137 if(KErrNone != errCode) |
1108 { |
1138 { |
1109 __FLOG_2(_L("Processed date: %S, TimeZone: %ds ahead"), &aDateTimeStr, aOffsetVal); |
1139 OstTraceExt2(TRACE_NORMAL, DUP9_CMTPDEVICEDATASTORE_VALIDATESTRING, |
1110 __FLOG_1(_L8("ValidateString - Exit %d"), errCode); |
1140 "Processed date: %S, TimeZone: %ds ahead", aDateTimeStr, aOffsetVal); |
|
1141 OstTrace1(TRACE_NORMAL, DUP10_CMTPDEVICEDATASTORE_VALIDATESTRING, |
|
1142 "ValidateString - Exit %d", errCode); |
|
1143 OstTraceFunctionExit0( CMTPDEVICEDATASTORE_VALIDATESTRING_EXIT ); |
1111 return errCode; |
1144 return errCode; |
1112 } |
1145 } |
1113 } |
1146 } |
1114 } |
1147 } |
1115 __FLOG_2(_L("Processed date: %S, TimeZone: %ds ahead"), &aDateTimeStr, aOffsetVal); |
1148 OstTraceExt2(TRACE_NORMAL, DUP11_CMTPDEVICEDATASTORE_VALIDATESTRING, |
1116 __FLOG_1(_L8("ValidateString - Exit %d"), errCode); |
1149 "Processed date: %S, TimeZone: %ds ahead", aDateTimeStr, aOffsetVal); |
|
1150 OstTrace1(TRACE_NORMAL, DUP12_CMTPDEVICEDATASTORE_VALIDATESTRING, |
|
1151 "ValidateString - Exit %d", errCode); |
|
1152 OstTraceFunctionExit0( DUP1_CMTPDEVICEDATASTORE_VALIDATESTRING_EXIT ); |
1117 return errCode; |
1153 return errCode; |
1118 } |
1154 } |
1119 |
1155 |
1120 /** |
1156 /** |
1121 *This method is to load/Store the deviceIcon to the CMTPTypeArray iDeviceIcon |
1157 *This method is to load/Store the deviceIcon to the CMTPTypeArray iDeviceIcon |