# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1268984439 -7200 # Node ID aabe5387f5cec18063a725e510efedd85c9383f6 # Parent d0791faffa3fa9b06973e18a7ea1c52705f7db3d Revision: 201005 Kit: 201011 diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/apple/S60_RnD_32.phoneplugin/Contents/Info.plist --- a/connectivitymodules/SeCon/apple/S60_RnD_32.phoneplugin/Contents/Info.plist Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +0,0 @@ - - - - - CFBundleDevelopmentRegion - English - CFBundleGetInfoString - Nokia S60-32 v1.0, © Nokia - CFBundleIdentifier - nokia.com.phoneplugin.com.nokia.S6032 - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - Nokia S60-32 - CFBundlePackageType - BNDL - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 556 - IPHPhoneConduitVersion - 597.0 - IPHPhonePluginUID - 367C0F5C-1E53-44A3-AEA5-54D1EEE12F29 - IPHPluginProviderName - Nokia - IPHPluginSupportURL - http://www.nokia.com/support - IPHPublicPluginVersion - 2.0 - - diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/apple/S60_RnD_32.phoneplugin/Contents/Resources/MetaClasses.plist --- a/connectivitymodules/SeCon/apple/S60_RnD_32.phoneplugin/Contents/Resources/MetaClasses.plist Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,329 +0,0 @@ - - - family.com.nokia.S6032 - - InheritsFrom - - family.com.apple.external.all-phones.usb-bt - - Services - - - ServiceName - com.apple.synchro - ServiceClass - IPHSyncMLSyncTransportServiceObexClient - ServiceProperties - - IPHEnginePlist - SyncEngine.plist - SyncProperties2 - PhoneConduit.plist - SyncMLVersion - SyncML11 - SyncMLLargeObjectSupport - - SyncMLNumberOfChangesSupport - - SyncMLRefreshFromServerSupport - - SyncMLRemoteNeedsRelativePaths - - SyncMLBusySignalingSupport - - SyncMLOnlyOneBusySignaling - - SyncMLBusySignalingInterval - 60 - SyncMLSimulateBusySignalingWithEmptySync - - SyncDataClasses - - - com.apple.pimsync.contacts - com.apple.pimsync.calendars - - - DontSyncEventsAfterDateValue.visible - - DontSyncEventsAfterDateValue.default-value - 1month - OnlySyncContactsWithPhoneNumber.visible - - OnlySyncContactsWithPhoneNumber.default-value - - SyncAllDayEventsKey.visible - - SyncAllDayEventsKey.default-value - - DontSyncEventsPriorToDateValue.visible - - DontSyncEventsPriorToDateValue.default-value - 1week - DontSyncEventsPriorToDateIsEnabled.visible - - DontSyncEventsPriorToDateIsEnabled.default-value - - DontSyncEventsAfterDateIsEnabled.visible - - DontSyncEventsAfterDateIsEnabled.default-value - - SyncMLLocalSource - iSync - SyncMLCodec - SyncMLCodecLibWBXML - SyncMLMsgTemporization - 500000 - SyncMLMaxObjSize - 786432 - SyncMLMaxMsgSize - 65535 - BTProtocolService - com.nokia.S6032.protocol.bt.obex.syncml - USBProtocolService - com.nokia.S6032.protocol.usb.obex.syncml - - - - ServiceName - com.nokia.S6032.protocol.usb.obex.syncml - ServiceClass - IPHObexService - ServiceProperties - - ObexTargetUUID - 53 59 4e 43 4d 4c 2d 53 59 4e 43 - ObexTimeOut - 60 - TransportService - com.nokia.S6032.transport.usb.syncml - - - - ServiceName - com.nokia.S6032.protocol.bt.obex.syncml - ServiceClass - IPHObexService - ServiceProperties - - ObexTargetUUID - 53 59 4e 43 4d 4c 2d 53 59 4e 43 - ObexTimeOut - 60 - TransportService - com.nokia.S6032.transport.rfcomm.syncml - - - - ServiceName - com.apple.protocol.usb.AT - ServiceClass - IPHSerialATService - ServiceProperties - - - - ServiceName - com.nokia.S6032.transport.rfcomm.syncml - ServiceClass - IPHRFCOMMChannelService - ServiceProperties - - RFCOMMChannelUUID - 000000020000100080000002ee000002 - - - - ServiceName - com.apple.transport.usb.modem - ServiceClass - IPHUSBCDCChannelService - ServiceProperties - - - - ServiceName - com.nokia.S6032.transport.usb.syncml - ServiceClass - IPHUSBObexChannelService - ServiceProperties - - - - ServiceName - com.apple.pimsync.parser.vCal - ServiceClass - IPHSyncParserService - ServiceProperties - - ParserType - vCal - Encoding - QUOTED-PRINTABLE - FoldingStyle - FoldingNG - Charset - UTF-8 - AllDayEventFormat - AllDayEventFromMidnightTo235900 - vCalRecDropIfUseless - - EscapeSemicolonInNotComponedValues - - EscapeBackslash - - IgnoreProperties - - X-IRMC-LUID - - UntilDateInLocal - - SetUntilTimeWithStartTime - - - - - ServiceName - com.apple.pimsync.parser.vCard - ServiceClass - IPHSyncParserService - ServiceProperties - - ParserType - vCard - Encoding - QUOTED-PRINTABLE - FoldingStyle - FoldingNG - Charset - UTF-8 - EscapeSemicolonInNotComponedValues - - EscapeBackslash - - IgnoreProperties - - X-IRMC-LUID - - PropertyNameMapping - - X-NICKNAME - X-EPOCSECONDNAME - - AddCRLFAfterBase64Folding - - IgnoreSubTypesForThisMainTypes - - CELL - - - - - ServiceName - com.apple.pimsync.contacts - ServiceClass - IPHSyncDataClassService - ServiceProperties - - MimeType - text/x-vcard - ParserService - com.apple.pimsync.parser.vCard - RemoteName - - needsCompanyNameInFirstName - - needsFullAddressInStreetField - - DataClassName - Contacts - needsDeleteAddOnModify - - MaxSyncCmd - 1 - - - - ServiceName - com.apple.pimsync.calendars - ServiceClass - IPHSyncDataClassService - ServiceProperties - - MimeType - text/x-vcalendar - ParserService - com.apple.pimsync.parser.vCal - hasEvent - - RemoteName - - hasAllDayEvents - - hasAllDayFromMidnightTo235900 - - hasVCalRecurrence - - needsToFormatCountToUntilDate - - needsToFormatUntilDateToCount - - hasOneAlarmType - - alarmTypeIsDisplay - - hasTimeZone - - hasTask - - handleAllDayRecurrent - - doNotSyncAlarmIfAfterStartDateTime - - DataClassName - Calendar - allDayInLocalDateTime - - untilDateIsDateOnly - - exDatesAreDateOnly - - doNotSyncAlarmIfCompleted - - dueDateIsDateOnly - - - - - - com.nokia.S6032 - - Identification - - com.apple.usb.vendorid-modelid - 0x0421/0x0500 - com.apple.gmi+gmm - Nokia+Nokia 6290 - - InheritsFrom - - family.com.nokia.S6032 - - Services - - - ServiceName - com.apple.model - ServiceProperties - - ModelName - S60-32 - CompanyName - Nokia - ModelIcon - com.nokia.S6032.tiff - - - - - \ No newline at end of file diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/apple/S60_RnD_32.phoneplugin/Contents/Resources/PhoneConduit.plist --- a/connectivitymodules/SeCon/apple/S60_RnD_32.phoneplugin/Contents/Resources/PhoneConduit.plist Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,534 +0,0 @@ - - - - - Formatting - - com.apple.calendars.Event - - classification - - mappings - - - mappedValue - PUBLIC - originalValue - public - - - mappedValue - PRIVATE - originalValue - private - - - mappedValue - PRIVATE - originalValue - confidential - - - - description - - charsToStrip - \r,\n - maxLength - 500 - - end date - - location - - charsToStrip - \r,\n - maxLength - 255 - - start date - - summary - - charsToStrip - \r,\n - maxLength - 500 - - - com.apple.calendars.Task - - classification - - mappings - - - mappedValue - PUBLIC - originalValue - public - - - mappedValue - PRIVATE - originalValue - private - - - mappedValue - PRIVATE - originalValue - confidential - - - - completion date - - description - - charsToStrip - \r,\n - maxLength - 255 - - due date - - priority - - mappings - - - mappedValue - - originalValue - 0 - - - mappedValue - 1 - originalValue - 1 - - - mappedValue - 2 - originalValue - 2 - - - mappedValue - 3 - originalValue - 3 - - - mappedValue - 4 - originalValue - 4 - - - mappedValue - 5 - originalValue - 5 - - - mappedValue - 6 - originalValue - 6 - - - mappedValue - 7 - originalValue - 7 - - - mappedValue - 8 - originalValue - 8 - - - mappedValue - 9 - originalValue - 9 - - - - status - - mappings - - - mappedValue - DECLINED - originalValue - cancelled - - - mappedValue - NEEDS ACTION - originalValue - needsaction - - - mappedValue - COMPLETED - originalValue - completed - - - mappedValue - ACCEPTED - originalValue - inprocess - - - mappedValue - - originalValue - none - - - - summary - - charsToStrip - \r,\n - maxLength - 255 - - - com.apple.contacts.Contact - - birthday - - company name - - charsToStrip - \r,\n - maxLength - 255 - - department - - charsToStrip - \r,\n - maxLength - 255 - - first name - - charsToStrip - \r,\n - maxLength - 255 - - image - - maxLength - 0 - - job title - - charsToStrip - \r,\n - maxLength - 255 - - last name - - charsToStrip - \r,\n - maxLength - 255 - - middle name - - charsToStrip - \r,\n - maxLength - 255 - - nickname - - charsToStrip - \r,\n - maxLength - 255 - - notes - - maxLength - 1000 - - suffix - - charsToStrip - \r,\n - maxLength - 255 - - title - - charsToStrip - \r,\n - maxLength - 255 - - - com.apple.contacts.Date - - type - - mappings - - - value - - - com.apple.contacts.Email Address - - type - - mappings - - - mappedValue - WORK - originalValue - work - - - mappedValue - HOME - originalValue - home - - - mappedValue - INTERNET - originalValue - other - - - - value - - charsToStrip - \r,\n - maxLength - 255 - - - com.apple.contacts.Phone Number - - type - - mappings - - - mappedValue - WORK - originalValue - work - - - mappedValue - HOME - originalValue - home - - - mappedValue - CELL - originalValue - mobile - - - mappedValue - FAX - originalValue - work fax - - - mappedValue - FAX - originalValue - home fax - - - mappedValue - - originalValue - other - - - mappedValue - - originalValue - main - - - mappedValue - PAGER - originalValue - pager - - - - value - - charsToKeep - 0123456789+#*pw - maxLength - 255 - - - com.apple.contacts.Related Name - - type - - mappings - - - mappedValue - X-CHILDREN - originalValue - child - - - mappedValue - X-SPOUSE - originalValue - spouse - - - mappedValue - X-ASSISTANT - originalValue - assistant - - - - value - - charsToStrip - \r,\n - maxLength - 255 - - - com.apple.contacts.Street Address - - city - - charsToStrip - \r,\n - maxLength - 255 - - country - - charsToStrip - \r,\n - maxLength - 255 - - postal code - - charsToStrip - \r,\n - maxLength - 255 - - state - - charsToStrip - \r,\n - maxLength - 255 - - street - - charsToStrip - \r,\n - maxLength - 255 - - type - - mappings - - - mappedValue - WORK - originalValue - work - - - mappedValue - HOME - originalValue - home - - - mappedValue - - originalValue - other - - - relationshipConstraint - perSubType - relationshipSize - 1 - - - com.apple.contacts.URL - - type - - mappings - - - mappedValue - WORK - originalValue - work - - - mappedValue - HOME - originalValue - home page - - - mappedValue - HOME - originalValue - home - - - mappedValue - - originalValue - other - - - - value - - charsToStrip - \r,\n - maxLength - 500 - - - - - diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/apple/S60_RnD_32.phoneplugin/Contents/Resources/SyncEngine.plist --- a/connectivitymodules/SeCon/apple/S60_RnD_32.phoneplugin/Contents/Resources/SyncEngine.plist Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,151 +0,0 @@ - - - - - Entities - - com.apple.calendars.AudioAlarm - - com.apple.syncservices.RecordEntityName - triggerdate - triggerduration - owner - - com.apple.calendars.Calendar - - com.apple.syncservices.RecordEntityName - title - read only - com.apple.PhoneConduitExtension.uid - - com.apple.calendars.DisplayAlarm - - com.apple.syncservices.RecordEntityName - triggerdate - triggerduration - owner - - com.apple.calendars.Event - - com.apple.syncservices.RecordEntityName - original date - all day - exception dates - calendar - recurrences - main event - detached events - audio alarms - display alarms - start date - location - summary - end date - description - classification - - com.apple.calendars.Recurrence - - com.apple.syncservices.RecordEntityName - frequency - count - until - interval - bymonth - byweeknumber - byyearday - bymonthday - bydayfreq - bydaydays - bysetpos - weekstartday - owner - - com.apple.calendars.Task - - com.apple.syncservices.RecordEntityName - due date is date only - calendar - audio alarms - display alarms - status - summary - completion date - description - due date - classification - priority - - com.apple.contacts.Contact - - com.apple.syncservices.RecordEntityName - title - suffix - image - last name - company name - first name - middle name - job title - nickname - notes - department - birthday - email addresses - phone numbers - URLs - street addresses - related names - dates - - com.apple.contacts.Date - - com.apple.syncservices.RecordEntityName - contact - value - type - - com.apple.contacts.Email Address - - com.apple.syncservices.RecordEntityName - contact - value - type - - com.apple.contacts.Phone Number - - com.apple.syncservices.RecordEntityName - contact - value - type - - com.apple.contacts.Related Name - - com.apple.syncservices.RecordEntityName - contact - value - type - - com.apple.contacts.Street Address - - com.apple.syncservices.RecordEntityName - contact - city - state - street - country - type - postal code - - com.apple.contacts.URL - - com.apple.syncservices.RecordEntityName - contact - value - type - - - Type - device - - diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/apple/S60_RnD_32.phoneplugin/Contents/Resources/com.nokia.S6032.tiff Binary file connectivitymodules/SeCon/apple/S60_RnD_32.phoneplugin/Contents/Resources/com.nokia.S6032.tiff has changed diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/apple/S60_RnD_32.pkg/Contents/Archive.bom Binary file connectivitymodules/SeCon/apple/S60_RnD_32.pkg/Contents/Archive.bom has changed diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/apple/S60_RnD_32.pkg/Contents/Archive.pax.gz Binary file connectivitymodules/SeCon/apple/S60_RnD_32.pkg/Contents/Archive.pax.gz has changed diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/apple/S60_RnD_32.pkg/Contents/Info.plist --- a/connectivitymodules/SeCon/apple/S60_RnD_32.pkg/Contents/Info.plist Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,67 +0,0 @@ - - - - - CFBundleGetInfoString - 0.0, Copyright 2006 Apple Computer, Inc. - CFBundleIdentifier - com.apple.isyncpluginmaker.phoneplugin - CFBundleShortVersionString - 0.0 - IFMajorVersion - 1 - IFMinorVersion - 0 - IFPkgFlagAllowBackRev - - IFPkgFlagAuthorizationAction - AdminAuthorization - IFPkgFlagBackgroundAlignment - topleft - IFPkgFlagBackgroundScaling - none - IFPkgFlagDefaultLocation - / - IFPkgFlagFollowLinks - - IFPkgFlagInstallFat - - IFPkgFlagInstalledSize - 156 - IFPkgFlagIsRequired - - IFPkgFlagOverwritePermissions - - IFPkgFlagRelocatable - - IFPkgFlagRestartAction - NoRestart - IFPkgFlagRootVolumeOnly - - IFPkgFlagUpdateInstalledLanguages - - IFPkgFormatVersion - 0.10000000149011612 - IFRequirementDicts - - - LabelKey - iSync24Label - MessageKey - iSync2XMessage - SpecArgument - /Applications/iSync.app/Contents/Info.plist - SpecProperty - CFBundleVersion - SpecType - plist - TestObject - 500.134 - TestOperator - ge - TitleKey - iSync24Title - - - - diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/apple/S60_RnD_32.pkg/Contents/PkgInfo --- a/connectivitymodules/SeCon/apple/S60_RnD_32.pkg/Contents/PkgInfo Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -pkmkrpkg1 \ No newline at end of file diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/apple/S60_RnD_32.pkg/Contents/Resources/Description.plist --- a/connectivitymodules/SeCon/apple/S60_RnD_32.pkg/Contents/Resources/Description.plist Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,10 +0,0 @@ - - - - - IFPkgDescriptionDescription - Description of a Phone Plug-in - IFPkgDescriptionTitle - the phone plug-in - - diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/apple/S60_RnD_32.pkg/Contents/Resources/English.lproj/ReadMe.rtf --- a/connectivitymodules/SeCon/apple/S60_RnD_32.pkg/Contents/Resources/English.lproj/ReadMe.rtf Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ -{\rtf1\mac\ansicpg10000\cocoartf824\cocoasubrtf410 -{\fonttbl\f0\fswiss\fcharset77 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural - -\f0\fs24 \cf0 This package has been built by Nokia Corporation. It will install a phone plugin to enable iSync support for your phone E60} \ No newline at end of file diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/apple/S60_RnD_32.pkg/Contents/Resources/IFRequirement.strings Binary file connectivitymodules/SeCon/apple/S60_RnD_32.pkg/Contents/Resources/IFRequirement.strings has changed diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/apple/S60_RnD_32.pkg/Contents/Resources/PhonePlugin.info --- a/connectivitymodules/SeCon/apple/S60_RnD_32.pkg/Contents/Resources/PhonePlugin.info Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,17 +0,0 @@ -Title Phone Plug-in -Version -Description -DefaultLocation /Library/PhonePlugins -DeleteWarning - -### Package Flags - -NeedsAuthorization NO -Required YES -Relocatable YES -RequiresReboot NO -UseUserMask NO -OverwritePermissions NO -InstallFat NO -RootVolumeOnly YES -OnlyUpdateInstalledLanguages NO diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/apple/S60_RnD_32.pkg/Contents/Resources/TokenDefinitions.plist --- a/connectivitymodules/SeCon/apple/S60_RnD_32.pkg/Contents/Resources/TokenDefinitions.plist Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,17 +0,0 @@ - - - - - iSyncToken - - - searchPlugin - CommonAppSearch - path - /Applications/iSync.app - identifier - com.apple.isync - - - - diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/apple/S60_RnD_32.pkg/Contents/Resources/Welcome.rtf --- a/connectivitymodules/SeCon/apple/S60_RnD_32.pkg/Contents/Resources/Welcome.rtf Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,17 +0,0 @@ -{\rtf1\mac\ansicpg10000\cocoartf824\cocoasubrtf380 -{\fonttbl\f0\fnil\fcharset77 LucidaGrande-Bold;\f1\fswiss\fcharset77 Helvetica;\f2\fnil\fcharset77 LucidaGrande; -} -{\colortbl;\red255\green255\blue255;\red1\green1\blue1;} -\vieww9000\viewh8400\viewkind0 -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural - -\f0\b\fs24 \cf0 Welcome to the iSync Phone Plug-in for Mac OS X Installer -\f1\b0 \ -\ -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural - -\f2\fs22 \cf0 iSync for Mac OS X is synchronization software that keeps your Address Book contacts and iCal calendar and to-do information in sync between your Mac OS computers and iSync-compatible mobile phones.\ -\ -This installer guides you through the steps necessary to install an iSync Phone Plug-in for Mac OS X. To get started, click Continue. -\f1\fs24 \cf2 \ -} \ No newline at end of file diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/apple/S60_RnD_32.pkg/Contents/Resources/en.lproj/Description.plist --- a/connectivitymodules/SeCon/apple/S60_RnD_32.pkg/Contents/Resources/en.lproj/Description.plist Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,10 +0,0 @@ - - - - - IFPkgDescriptionDescription - - IFPkgDescriptionTitle - 367C0F5C-1E53-44A3-AEA5-54D1EEE12F29-installerRoot - - diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/apple/S60_RnD_32.pkg/Contents/Resources/package_version --- a/connectivitymodules/SeCon/apple/S60_RnD_32.pkg/Contents/Resources/package_version Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2 +0,0 @@ -major: 1 -minor: 0 \ No newline at end of file diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/apple/S60_RnD_32.ppdoc/Icon.tiff Binary file connectivitymodules/SeCon/apple/S60_RnD_32.ppdoc/Icon.tiff has changed diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/apple/S60_RnD_32.ppdoc/InstallerReadMe-en.rtf --- a/connectivitymodules/SeCon/apple/S60_RnD_32.ppdoc/InstallerReadMe-en.rtf Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ -{\rtf1\mac\ansicpg10000\cocoartf824\cocoasubrtf410 -{\fonttbl\f0\fswiss\fcharset77 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural - -\f0\fs24 \cf0 This package has been built by Nokia Corporation. It will install a phone plugin to enable iSync support for your phone E60} \ No newline at end of file diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/apple/S60_RnD_32.ppdoc/Properties.plist --- a/connectivitymodules/SeCon/apple/S60_RnD_32.ppdoc/Properties.plist Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1358 +0,0 @@ - - - - - TramontaneVersion - 597.0 - UUID - 367C0F5C-1E53-44A3-AEA5-54D1EEE12F29 - properties - - BTOptionsDict - - OBEXTimeout - 60 - TransportType - 0 - synchroScriptConnect - - synchroScriptDisconnect - - - UISettingsOptionsDict - - DontSyncEventsAfterDateIsEnabled - - default - 0 - visible - - - DontSyncEventsAfterDateValue - - default - 1month - visible - - - DontSyncEventsPriorToDateIsEnabled - - default - 0 - visible - - - DontSyncEventsPriorToDateValue - - default - 1week - visible - - - OnlySyncContactsWithPhoneNumber - - default - 1 - visible - - - SyncAllDayEventsKey - - default - 0 - visible - - - - USBOptionsDict - - OBEXTimeout - 60 - identificationCDCChannel - 0 - identificationScriptConnect - - identificationScriptDisconnect - - synchroCDCChannel - 1 - synchroOBEXChannel - 0 - synchroScriptConnect - - synchroScriptDisconnect - - useOBEX - - useOtherCDC - - useSameCDC - - - advancedOptionsSettings - - com_apple_pimsync_contacts - - DataClassName - Contacts - MaxAddAndReplaceCmd - 0 - MaxDeleteCmd - 0 - MaxSyncCmd - 1 - needsDeleteAddOnModify - 1 - - com_apple_pimsync_events - - DataClassName - Calendar - MaxAddAndReplaceCmd - 0 - MaxDeleteCmd - 0 - MaxSyncCmd - 0 - allDayInLocalDateTime - 1 - allowedAlarmRelativeValues - - countValueWhenMissing - 0 - defaultUntilDateWhenMissing - - doNotSyncAlarmForADE - - doNotSyncAlarmIfAfterStartDateTime - 1 - dontSyncEventBeforeDate - - exDatesAreDateOnly - - handleMultiDayRecurrent - - hasAllDayMultiDay - - maxMinutesNbDeltaForAlarm - 0 - needsDeleteAddOnModify - 0 - noNewLines - 0 - onlyAsciiCharacters - - syncAlarmOnlyIfSameDayAsADEStartDate - - untilDateIsDateOnly - 1 - - com_apple_pimsync_parser_vCal - - AllDayCategories - REMINDER - EscapeBackslash - 1 - EscapeSemicolonInNotComponedValues - 1 - EscapeStrings - - ExDatesInLocal - - IgnoreProperties - X-IRMC-LUID - PropertyNameMapping - - SetExDateTimeWithEndTime - - SetExDateTimeWithStartTime - - SetUntilTimeWithEndTime - 0 - SetUntilTimeWithStartTime - 1 - TimedCategories - MEETING - UntilDateInLocal - 1 - - com_apple_pimsync_parser_vCard - - AddCRLFAfterBase64Folding - 1 - IgnoreSubTypesForThisMainTypes - CELL - PropertyNameMapping - - - key - X-NICKNAME - value - X-EPOCSECONDNAME - - - - com_apple_pimsync_tasks - - DataClassName - Tasks - MaxAddAndReplaceCmd - 0 - MaxDeleteCmd - 0 - MaxSyncCmd - 0 - completionDateIsDateOnly - - defaultDueDateValueWhenMissing - - defaultDueDateWhenMissing - - doNotSyncAlarmForTask - - doNotSyncAlarmIfCompleted - 1 - dueDateIsDateOnly - - needsDeleteAddOnModify - - setDueDateToCompletionDateIfCompleted - - - com_apple_synchro - - SyncMLCodec - 0 - SyncMLDoNotTryToDetectPhoneDBReset - - SyncMLLocalSource - iSync - SyncMLMaxMsgSize - 65535 - SyncMLMaxObjSize - 786432 - SyncMLMsgTemporization - 500000 - SyncMLNoPropertiesCapabilitiesInDevInf - - SyncMLSendDevInfIntoPutIfNoGetReceived - 0 - SyncMLUseBinaryWBXMLPublicID - - - - calendarsOptionsDict - - Charset - UTF-8 - FoldingStyle - FoldingNG - RemoteName - / - allDayFormat - 3 - eventRecurrenceEndType - 1 - hasAudioAlarm - - hasDisplayAlarm - - hasEvent - - hasTimeZone - 1 - hasVCalRecurrence - - - contactsOptionsDict - - RemoteName - / - firstAndLastNameInSameField - - needsCompanyNameInFirstName - 0 - needsFullAddressInStreetField - - - documentVersion - 556 - extraOptionsSettings - - familyOptionsDict - - BTAvailable - - BluetoothAvailable - - CGMI - Nokia - CGMM - Nokia 6290 - GMI - Nokia - GMM - Nokia 6290 - ModelID - com.nokia.S6032 - Name - S60-32 - PluginProviderName - Nokia - ProductID - 0x0500 - USBAvailable - - VendorID - 0x0421 - connection - 2 - constructorName - Nokia - domainName - nokia.com - fixedDatabasesNames - 0 - pluginVersion - 1.0 - supportURL - http://www.nokia.com/support - useCGMICGMM - - - javaScriptDict - - btObexConnection - - Value - function prepareChannelForProtocol() -{ - // You can customize this function but do NOT change the signature -} - - btObexDisconnection - - Value - function unprepareChannelForProtocol() -{ - // You can customize this function but do NOT change the signature -} - - usbCdcConnection - - Value - function prepareChannelForProtocol() -{ - // You can customize this function but do NOT change the signature -} - - usbCdcDisconnection - - Value - function unprepareChannelForProtocol() -{ - // You can customize this function but do NOT change the signature -} - - usbObexConnection - - Value - function prepareChannelForProtocol() -{ - // You can customize this function but do NOT change the signature -} - - usbObexDisconnection - - Value - function unprepareChannelForProtocol() -{ - // You can customize this function but do NOT change the signature -} - - - notes - - WW91IGNhbiBzYXZlIGFueSBraW5kIG9mIGluZm9ybWF0aW9uIG9uIHRoZSBw - bHVnaW4gaGVyZS4KVGhleSB3b24ndCBiZSBleHBvcnRlZCBpbiB0aGUgcGx1 - Z2luLg== - - syncFieldsSettings - - com_apple_calendars_Event - - classification - - Activated - - mappings - - - activated - - mappedValue - PUBLIC - originalValue - public - - - activated - - mappedValue - PRIVATE - originalValue - private - - - activated - - mappedValue - PRIVATE - originalValue - confidential - - - - description - - Activated - - charsFiltering - 1 - charsToStrip - \r,\n - maxLength - 500 - - end date - - Activated - - - location - - Activated - - charsFiltering - 1 - charsToStrip - \r,\n - maxLength - 255 - - start date - - Activated - - - summary - - Activated - - DontNeedCheckBox - - charsFiltering - 1 - charsToStrip - \r,\n - maxLength - 500 - - - com_apple_calendars_Task - - classification - - Activated - - mappings - - - activated - - mappedValue - PUBLIC - originalValue - public - - - activated - - mappedValue - PRIVATE - originalValue - private - - - activated - - mappedValue - PRIVATE - originalValue - confidential - - - - completion date - - Activated - - - description - - Activated - - charsFiltering - 1 - charsToStrip - \r,\n - maxLength - 255 - - due date - - Activated - - - priority - - Activated - - mappings - - - activated - - originalValue - 0 - - - activated - - mappedValue - 1 - originalValue - 1 - - - activated - - mappedValue - 2 - originalValue - 2 - - - activated - - mappedValue - 3 - originalValue - 3 - - - activated - - mappedValue - 4 - originalValue - 4 - - - activated - - mappedValue - 5 - originalValue - 5 - - - activated - - mappedValue - 6 - originalValue - 6 - - - activated - - mappedValue - 7 - originalValue - 7 - - - activated - - mappedValue - 8 - originalValue - 8 - - - activated - - mappedValue - 9 - originalValue - 9 - - - - status - - Activated - - mappings - - - activated - - mappedValue - DECLINED - originalValue - cancelled - - - activated - - mappedValue - NEEDS ACTION - originalValue - needsaction - - - activated - - mappedValue - COMPLETED - originalValue - completed - - - activated - - mappedValue - ACCEPTED - originalValue - inprocess - - - activated - - mappedValue - - originalValue - none - - - - summary - - Activated - - DontNeedCheckBox - - charsFiltering - 1 - charsToStrip - \r,\n - maxLength - 255 - - - com_apple_contacts_Contact - - birthday - - Activated - - - company name - - Activated - - DontNeedCheckBox - - charsFiltering - 1 - charsToStrip - \r,\n - maxLength - 255 - - department - - Activated - - charsFiltering - 1 - charsToStrip - \r,\n - maxLength - 255 - - first name - - Activated - - DontNeedCheckBox - - charsFiltering - 1 - charsToStrip - \r,\n - maxLength - 255 - - image - - Activated - - maxLength - 0 - - job title - - Activated - - charsFiltering - 1 - charsToStrip - \r,\n - maxLength - 255 - - last name - - Activated - - DontNeedCheckBox - - charsFiltering - 1 - charsToStrip - \r,\n - maxLength - 255 - - middle name - - Activated - - charsFiltering - 1 - charsToStrip - \r,\n - maxLength - 255 - - nickname - - Activated - - charsFiltering - 1 - charsToStrip - \r,\n - maxLength - 255 - - notes - - Activated - - maxLength - 1000 - - suffix - - Activated - - charsFiltering - 1 - charsToStrip - \r,\n - maxLength - 255 - - title - - Activated - - charsFiltering - 1 - charsToStrip - \r,\n - maxLength - 255 - - - com_apple_contacts_Date - - IPSGlobalEntity - - Activated - - - type - - Activated - - mappings - - - activated - - mappedValue - X-ANNIVERSARY - originalValue - anniversary - - - activated - - mappedValue - X-DATE - originalValue - other - - - - value - - Activated - - - - com_apple_contacts_Email Address - - IPSGlobalEntity - - Activated - - - type - - Activated - - mappings - - - activated - - mappedValue - WORK - originalValue - work - - - activated - - mappedValue - HOME - originalValue - home - - - activated - - mappedValue - INTERNET - originalValue - other - - - - value - - Activated - - DontNeedCheckBox - - charsFiltering - 1 - charsToStrip - \r,\n - maxLength - 255 - - - com_apple_contacts_Phone Number - - IPSGlobalEntity - - Activated - - - type - - Activated - - mappings - - - activated - - mappedValue - WORK - originalValue - work - - - activated - - mappedValue - HOME - originalValue - home - - - activated - - mappedValue - CELL - originalValue - mobile - - - activated - - mappedValue - FAX - originalValue - work fax - - - activated - - mappedValue - FAX - originalValue - home fax - - - activated - - mappedValue - - originalValue - other - - - activated - - mappedValue - - originalValue - main - - - activated - - mappedValue - PAGER - originalValue - pager - - - - value - - Activated - - DontNeedCheckBox - - charsFiltering - 2 - charsToKeep - 0123456789+#*pw - maxLength - 255 - - - com_apple_contacts_Related Name - - IPSGlobalEntity - - Activated - - - type - - Activated - - mappings - - - activated - - mappedValue - X-FATHER - originalValue - father - - - activated - - mappedValue - X-MOTHER - originalValue - mother - - - activated - - mappedValue - X-PARENT - originalValue - parent - - - activated - - mappedValue - X-CHILDREN - originalValue - child - - - activated - - mappedValue - X-BROTHER - originalValue - brother - - - activated - - mappedValue - X-SISTER - originalValue - sister - - - activated - - mappedValue - X-FRIEND - originalValue - friend - - - activated - - mappedValue - X-SPOUSE - originalValue - spouse - - - activated - - mappedValue - X-PARTNER - originalValue - partner - - - activated - - mappedValue - X-ASSISTANT - originalValue - assistant - - - activated - - mappedValue - X-MANAGER - originalValue - manager - - - activated - - mappedValue - X-NAME - originalValue - other - - - - value - - Activated - - DontNeedCheckBox - - charsFiltering - 1 - charsToStrip - \r,\n - maxLength - 255 - - - com_apple_contacts_Street Address - - IPSGlobalEntity - - Activated - - - city - - Activated - - charsFiltering - 1 - charsToStrip - \r,\n - maxLength - 255 - - country - - Activated - - charsFiltering - 1 - charsToStrip - \r,\n - maxLength - 255 - - postal code - - Activated - - charsFiltering - 1 - charsToStrip - \r,\n - maxLength - 255 - - state - - Activated - - charsFiltering - 1 - charsToStrip - \r,\n - maxLength - 255 - - street - - Activated - - DontNeedCheckBox - - charsFiltering - 1 - charsToStrip - \r,\n - maxLength - 255 - - type - - Activated - - mappings - - - activated - - mappedValue - WORK - originalValue - work - - - activated - - mappedValue - HOME - originalValue - home - - - activated - - mappedValue - - originalValue - other - - - relationshipLimitKind - 2 - - - com_apple_contacts_URL - - IPSGlobalEntity - - Activated - - - type - - Activated - - mappings - - - activated - - mappedValue - WORK - originalValue - work - - - activated - - mappedValue - HOME - originalValue - home page - - - activated - - mappedValue - HOME - originalValue - home - - - activated - - mappedValue - - originalValue - other - - - - value - - Activated - - DontNeedCheckBox - - charsFiltering - 1 - charsToStrip - \r,\n - maxLength - 500 - - - - syncMLOptionsDict - - SyncMLBusySignalingInterval - 60 - SyncMLBusySignalingSupport - - SyncMLLargeObjectSupport - - SyncMLMaxSyncCmdNbInEncodedMsg - 30 - SyncMLNumberOfChangesSupport - - SyncMLOnlyOneBusySignaling - - SyncMLRefreshFromServerSupport - - SyncMLRemoteNeedsRelativePaths - - SyncMLSimulateBusySignalingWithEmptySync - - SyncMLVersion - SyncML11 - limitSyncCmd - - - tasksOptionsDict - - RemoteName - Tasks - hasDifferentDataclassesForTasksAndEvents - - hasTasks - - - vCalRecSettings - - com_apple_pimsync_events - - handleAllDayRecurrent - - - com_apple_pimsync_parser_vCal - - vCalExDatesSupport - - vCalRecDaily - - vCalRecDailyInterval - - vCalRecDropIfUseless - 1 - vCalRecMaxExDatesNb - 0 - vCalRecMonthlyByDay - - vCalRecMonthlyByDayOnlyOnStartDateMonthDay - - vCalRecMonthlyByDayOnlyOneMonthDay - - vCalRecMonthlyByDayWithMonthDay - - vCalRecMonthlyByPos - - vCalRecMonthlyByPosOnlyOnStartDateWeekDay - - vCalRecMonthlyByPosOnlyOneWeekDay - - vCalRecMonthlyInterval - - vCalRecOnlyForever - - vCalRecWeekly - - vCalRecWeeklyInterval - - vCalRecWeeklyOnlyOnStartDateWeekDay - - vCalRecWeeklyOnlyOneWeekDay - - vCalRecWeeklyWithWeekDay - - vCalRecYearlyByMonth - - vCalRecYearlyByMonthInterval - - vCalRecYearlyByMonthOnlyOnStartDateMonthNumber - - vCalRecYearlyByMonthOnlyOneMonthNumber - - vCalRecYearlyByMonthWithMonthNumber - - - - - version - 0 - - diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/catalogspcconnectivityplugin/bwins/catalogspcconnectivitypluginu.def --- a/connectivitymodules/SeCon/catalogspcconnectivityplugin/bwins/catalogspcconnectivitypluginu.def Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,10 +0,0 @@ -EXPORTS - ??1CCatalogsPCConnectivityPlugin@@UAE@XZ @ 1 NONAME ; CCatalogsPCConnectivityPlugin::~CCatalogsPCConnectivityPlugin(void) - ?Close@CCatalogsPCConnectivityPlugin@@QAEXXZ @ 2 NONAME ; void CCatalogsPCConnectivityPlugin::Close(void) - ?Connect@CCatalogsPCConnectivityPlugin@@QAEHXZ @ 3 NONAME ; int CCatalogsPCConnectivityPlugin::Connect(void) - ?GetDataL@CCatalogsPCConnectivityPlugin@@QAEXAAVTDataType@@AAVCBufFlat@@@Z @ 4 NONAME ; void CCatalogsPCConnectivityPlugin::GetDataL(class TDataType &, class CBufFlat &) - ?NewL@CCatalogsPCConnectivityPlugin@@SAPAV1@XZ @ 5 NONAME ; class CCatalogsPCConnectivityPlugin * CCatalogsPCConnectivityPlugin::NewL(void) - ?NewLC@CCatalogsPCConnectivityPlugin@@SAPAV1@XZ @ 6 NONAME ; class CCatalogsPCConnectivityPlugin * CCatalogsPCConnectivityPlugin::NewLC(void) - ?PutDataL@CCatalogsPCConnectivityPlugin@@QAEXABVTDataType@@ABVCBufFlat@@@Z @ 7 NONAME ; void CCatalogsPCConnectivityPlugin::PutDataL(class TDataType const &, class CBufFlat const &) - ?SupportedMimeTypesL@CCatalogsPCConnectivityPlugin@@QAE?AV?$RPointerArray@VTDataType@@@@XZ @ 8 NONAME ; class RPointerArray CCatalogsPCConnectivityPlugin::SupportedMimeTypesL(void) - diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/catalogspcconnectivityplugin/eabi/catalogspcconnectivitypluginu.def --- a/connectivitymodules/SeCon/catalogspcconnectivityplugin/eabi/catalogspcconnectivitypluginu.def Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,14 +0,0 @@ -EXPORTS - _ZN29CCatalogsPCConnectivityPlugin19SupportedMimeTypesLEv @ 1 NONAME - _ZN29CCatalogsPCConnectivityPlugin4NewLEv @ 2 NONAME - _ZN29CCatalogsPCConnectivityPlugin5CloseEv @ 3 NONAME - _ZN29CCatalogsPCConnectivityPlugin5NewLCEv @ 4 NONAME - _ZN29CCatalogsPCConnectivityPlugin7ConnectEv @ 5 NONAME - _ZN29CCatalogsPCConnectivityPlugin8GetDataLER9TDataTypeR8CBufFlat @ 6 NONAME - _ZN29CCatalogsPCConnectivityPlugin8PutDataLERK9TDataTypeRK8CBufFlat @ 7 NONAME - _ZN29CCatalogsPCConnectivityPluginD0Ev @ 8 NONAME - _ZN29CCatalogsPCConnectivityPluginD1Ev @ 9 NONAME - _ZN29CCatalogsPCConnectivityPluginD2Ev @ 10 NONAME - _ZTI29CCatalogsPCConnectivityPlugin @ 11 NONAME ; ## - _ZTV29CCatalogsPCConnectivityPlugin @ 12 NONAME ; ## - diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/catalogspcconnectivityplugin/group/bld.inf --- a/connectivitymodules/SeCon/catalogspcconnectivityplugin/group/bld.inf Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,23 +0,0 @@ -/* -* Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Build info file for Catalogs PC Connectivity Plugin -* -*/ - - -PRJ_MMPFILES - -catalogspcconnectivityplugin.mmp - - diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/catalogspcconnectivityplugin/group/catalogspcconnectivityplugin.mmp --- a/connectivitymodules/SeCon/catalogspcconnectivityplugin/group/catalogspcconnectivityplugin.mmp Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +0,0 @@ -/* -* Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Project definition file for project Catalogs PC Connectivity -* Plugin -* -*/ - -#include -#include - -TARGET catalogspcconnectivityplugin.dll -TARGETTYPE dll -UID 0x1000008D 0x10207E73 - -CAPABILITY CAP_ECOM_PLUGIN -VENDORID VID_DEFAULT - -SOURCEPATH ../src -SOURCE catalogspcconnectivityplugin.cpp -SOURCE catalogspcconnectivityclient.cpp - -USERINCLUDE ../inc - -// Default system include paths for middleware layer modules. -MW_LAYER_SYSTEMINCLUDE - -LIBRARY euser.lib -LIBRARY apmime.lib - diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/catalogspcconnectivityplugin/inc/catalogspcconnectivityclient.h --- a/connectivitymodules/SeCon/catalogspcconnectivityplugin/inc/catalogspcconnectivityclient.h Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,145 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: This is a client which communicate with the server -* CatalogsEnginePCClientFrontEnd -* -*/ - - -#ifndef R_CATALOGSPCCONNECTIVITYCLIENT_H -#define R_CATALOGSPCCONNECTIVITYCLIENT_H - -#include -#include - -/** - * This client communicate with the server CatalogsEnginePCClientFrontEnd - * - * This class get requests from CatalogsPCConnectivityPlugin. - * Class itself is client in client-server solution. When request - * is received it will start the server (CatalogsEnginePCClientFrontEnd). - * This client class is dummy, the server have all the functionality. - * - * @lib catalogspcconnectivityplugin - * @since S60 v3.1 - */ -class RCatalogsPCConnectivityClient : public RSessionBase - { -public: - - /** - * Constructor - * - * @since S60 v3.1 - */ - RCatalogsPCConnectivityClient(); - - /** - * Destructor - * - * @since S60 v3.1 - */ - ~RCatalogsPCConnectivityClient(); - - /** - * A connection is formed to the Catalogs engine pc client front-end. - * This will start up the front-end server and connect to it - * - * @since S60 v3.1 - * @return TInt Standard error code, KErrNone if connection is formed - * or the connection was formed already - */ - TInt Connect(); - - /** - * The connection to the Catalogs engine front-end is closed - * - * @since S60 v3.1 - */ - void Close(); - - /** - * All MIME types supported by this component can be asked using this method - * - * @since S60 v3.1 - * @return RPointerArray< TDataType > contain all supported MIME types - * RPointerArray TDataTypes have allocated using new, caller - * have to remember to delete them properly - * @exeption Leaves with standard error codes - */ - RPointerArray SupportedMimeTypesL(); - - /** - * A data packet of max length 65535 (0xFFFF) bytes is synchronously - * sent to the Catalogs engine front-end - * Usage: After PutDataL have been called, you have to call GetDataL - * before you can call PutDataL again - * - * @since S60 v3.1 - * @param aMimeType data packet MIME type - * @param aData data buffer to read from - * @exeption Leaves with standard error codes - */ - void PutDataL( const TDataType& aMimeType, - const CBufFlat& aData ); - - /** - * A data packet is synchronously transfered from the Catalogs front-end - * and returned to caller - * Usage: Everytime before calling GetDataL, you have to call PutDataL. - * So you can't call GetData in sequentially. - * - * @since S60 v3.1 - * @param aMimeType data packet MIME type - * @param aData data buffer to write to. Will call ExpandL function - * for aData, but never more than max length 65535 (OxFFFF) - * @return nothing, but parameter aData work as return buffer - * @exeption Leaves with standard error codes - */ - void GetDataL( TDataType& aMimeType, CBufFlat& aData ); - - -private: - -// private functions - - /** - * Returns the earliest version number of the server that we can talk to - * - * @since S60 v3.1 - * @return TVersion Earliest version number we can talk to - */ - TVersion Version() const; - - /** - * Start server if it isn't running already - * - * @since S60 v3.1 - * @return TInt Standard error code, KErrNone if server was running - * already or start was succesfull - */ - TInt StartServer(); - - /** - * Create server process - * - * @since S60 v3.1 - * @return TInt standard error code, KErrNone when creation was success - */ - TInt CreateServerProcess(); - - }; - -#endif // R_CATALOGSPCCONNECTIVITYCLIENT_H - diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/catalogspcconnectivityplugin/inc/catalogspcconnectivitydefines.h --- a/connectivitymodules/SeCon/catalogspcconnectivityplugin/inc/catalogspcconnectivitydefines.h Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Server information that the client needs -* -*/ - - -#include - -/** Server name */ -_LIT( KCatalogsPCConnectivityServerName, - "CatalogsPCConnectivityServer" ); - -/** Semaphore that is used when creating a new server */ -_LIT( KCatalogsPCConnectivityServerSemaphoreName, - "CATALOGSPCCONNECTIVITYSemaphore" ); - -/** File that is passed to the new server-process for execution */ -_LIT( KCatalogsPCConnectivityServerFilename, - "catalogsenginepcclientfrontend" ); - -// Default message slot amount in a session -const TUint KCatalogsPCConnectivityDefaultMessageSlots = 255; - -/** Version numbers */ -const TUint KCatalogsPCConnectivityMajorVersionNumber=1; -const TUint KCatalogsPCConnectivityMinorVersionNumber=0; -const TUint KCatalogsPCConnectivityBuildVersionNumber=0; - -/** Function opcodes used in message passing between client and server */ -enum TCatalogsPCConnectivityServRqst - { - ECatalogsPCConnectivitySupportedMimeTypes = 1, - ECatalogsPCConnectivityPutData, - ECatalogsPCConnectivityGetData, - ECatalogsPCConnectivityGetSize - }; - diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/catalogspcconnectivityplugin/inc/catalogspcconnectivityplugin.h --- a/connectivitymodules/SeCon/catalogspcconnectivityplugin/inc/catalogspcconnectivityplugin.h Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,147 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: This plugin enables the Catalogs PC client to communicate -* with the Catalogs engine -* -*/ - - -#ifndef C_CATALOGSPCCONNECTIVITYPLUGIN_H -#define C_CATALOGSPCCONNECTIVITYPLUGIN_H - -#include "catalogspcconnectivityclient.h" - -/** - * Plugin enables Catalogs PC client to communicate with the Catalogs engine - * - * This class get requests from Catalogs PC client. It passes the requests - * to client CatalogsPCConnectivityClient - * - * @lib catalogspcconnectivityplugin - * @since S60 v3.1 - */ -class CCatalogsPCConnectivityPlugin : public CBase - { -public: - - /** - * Standard symbian object construction first phase - * - * @since S60 v3.1 - * @return CCatalogsPCConnectivityPlugin pointer - */ - IMPORT_C static CCatalogsPCConnectivityPlugin* NewL(); - - /** - * Standard symbian object constructing first phase - * - * @since S60 v3.1 - * @return CCatalogsPCConnectivityPlugin pointer - */ - IMPORT_C static CCatalogsPCConnectivityPlugin* NewLC(); - - /** - * Destructor - * - * @since S60 v3.1 - */ - IMPORT_C virtual ~CCatalogsPCConnectivityPlugin(); - - /** - * A connection is formed to the Catalogs engine pc client front-end. - * This will start up the front-end server and connect to it - * - * @return TInt Standard error code, KErrNone if connection is formed - * @since S60 v3.1 - */ - IMPORT_C TInt Connect(); - - /** - * The connection to the Catalogs engine front-end is closed - * - * @since S60 v3.1 - */ - IMPORT_C void Close(); - - /** - * All MIME types supported by this component can be asked using this method - * - * @return RPointerArray contains all supported MIME types. - * The ownership is transferred to the caller. - * Use ResetAndDestroy method to free all allocated memory - * @exeption Leaves with standard error codes - * @since S60 v3.1 - */ - IMPORT_C RPointerArray SupportedMimeTypesL(); - - /** - * A Data packet of max length 65535 (0xFFFF) bytes is synchronously - * sent to the Catalogs engine front-end. - * Usage: After PutDataL has been called, you must call GetDataL - * before you can call PutDataL again - * - * @param aMimeType Data packet MIME type - * @param aData Data buffer to read from - * @exeption Leaves with standard error codes - * KErrNotSupported if not supported MIME type - * @since S60 v3.1 - */ - IMPORT_C void PutDataL( const TDataType& aMimeType, - const CBufFlat& aData ); - - /** - * A data packet is synchronously transfered from the Catalogs front-end - * and returned to caller - * Usage: Everytime before calling GetDataL, you have to call PutDataL. - * You may not call GetData in sequentially. - * - * @since S60 v3.1 - * @param aMimeType MIME type of the received data packet - * @param aData Data buffer to write to. ExpandL function will be called - * with the correct size for aData, but not more than max length - * 65535 (OxFFFF) - * @return The reference parameters contain the return data - * @exeption Leaves with standard error codes - */ - IMPORT_C void GetDataL( TDataType& aMimeType, CBufFlat& aData ); - - -private: - -// private functions - - - /** - * Constructor - * - * @since S60 v3.1 - */ - CCatalogsPCConnectivityPlugin(); - - /** - * Standard symbian object construction second phase - */ - void ConstructL(); - - -private: // data - - /** - * Client that communicate with the CatalogsEnginePCClientFrontEnd - */ - RCatalogsPCConnectivityClient iClient; - - }; - -#endif // C_CATALOGSPCCONNECTIVITYPLUGIN_H diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/catalogspcconnectivityplugin/src/catalogspcconnectivityclient.cpp --- a/connectivitymodules/SeCon/catalogspcconnectivityplugin/src/catalogspcconnectivityclient.cpp Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,229 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Client that communicate with CatalogsEnginePCClientFrontEnd -* -*/ - - -#include "catalogspcconnectivityclient.h" -#include "catalogspcconnectivitydefines.h" - - -// ======== MEMBER FUNCTIONS ======== - -// --------------------------------------------------------------------------- -// Constructor -// --------------------------------------------------------------------------- -// -RCatalogsPCConnectivityClient::RCatalogsPCConnectivityClient() - { - } - -// --------------------------------------------------------------------------- -// Destructor -// --------------------------------------------------------------------------- -// -RCatalogsPCConnectivityClient::~RCatalogsPCConnectivityClient() - { - } - -// --------------------------------------------------------------------------- -// Start server and create session with server -// --------------------------------------------------------------------------- -// -TInt RCatalogsPCConnectivityClient::Connect() - { - TInt err = StartServer(); - - if ( err == KErrNone ) - { - err = CreateSession( - KCatalogsPCConnectivityServerName, - Version(), - KCatalogsPCConnectivityDefaultMessageSlots ); - } - return err; - } - -// --------------------------------------------------------------------------- -// Close session (After session is closed will server be closed too) -// --------------------------------------------------------------------------- -// -void RCatalogsPCConnectivityClient::Close() - { - RHandleBase::Close(); - } - -// --------------------------------------------------------------------------- -// Give MIME types supported by this Module -// --------------------------------------------------------------------------- -// -RPointerArray RCatalogsPCConnectivityClient:: -SupportedMimeTypesL() - { - RPointerArray supportedMIMEs; - TBool isThereMore = ETrue; - TPckgBuf pckgIsThereMore; - TDataType* tempMIME = 0; - TPckgBuf pckgMIME; - - while( isThereMore ) - { - User::LeaveIfError( SendReceive( - ECatalogsPCConnectivitySupportedMimeTypes, - TIpcArgs( &pckgMIME, &pckgIsThereMore ) ) ); - isThereMore = pckgIsThereMore(); - tempMIME = new( ELeave ) TDataType( pckgMIME() ); - User::LeaveIfError( supportedMIMEs.Append( tempMIME ) ); - } - - return supportedMIMEs; - } - -// --------------------------------------------------------------------------- -// Data package from CatalogsPCConnectivityPlugin -// --------------------------------------------------------------------------- -// -void RCatalogsPCConnectivityClient::PutDataL( - const TDataType& aMimeType, const CBufFlat& aData ) - { - TInt size = aData.Size(); - - RBuf8 desData; - desData.CreateL( size ); - desData.CleanupClosePushL(); - aData.Read( 0, desData, size ); - TPckgBuf pckgMIME( aMimeType ); - - User::LeaveIfError( SendReceive( - ECatalogsPCConnectivityPutData, - TIpcArgs( &pckgMIME, &desData, size ) ) ); - - CleanupStack::Pop(); //desData - desData.Close(); - } - -// --------------------------------------------------------------------------- -// Data request from CatalogsPCConnectivityPlugin -// First ask the size from server, then give correct size CBufFlat -// --------------------------------------------------------------------------- -// -void RCatalogsPCConnectivityClient::GetDataL( - TDataType& aMimeType, CBufFlat& aData ) - { - TPckgBuf pckgSize; - TPckgBuf pckgMIME; - - User::LeaveIfError( SendReceive( - ECatalogsPCConnectivityGetSize, - TIpcArgs( &pckgMIME, &pckgSize ) ) ); - - TInt size = pckgSize(); - aMimeType = pckgMIME(); - - RBuf8 desData; - desData.CreateL( size ); - desData.CleanupClosePushL(); - - User::LeaveIfError( SendReceive( - ECatalogsPCConnectivityGetData, - TIpcArgs( &desData ) ) ); - - aData.Reset(); - aData.ExpandL( 0, size ); - aData.Write( 0, desData, size ); - - CleanupStack::Pop(); //desData - desData.Close(); - } - -// --------------------------------------------------------------------------- -// Return version number -// --------------------------------------------------------------------------- -// -TVersion RCatalogsPCConnectivityClient::Version() const - { - return( TVersion( KCatalogsPCConnectivityMajorVersionNumber, - KCatalogsPCConnectivityMinorVersionNumber, - KCatalogsPCConnectivityBuildVersionNumber ) ); - } - -// --------------------------------------------------------------------------- -// Start server if it isn't running already -// --------------------------------------------------------------------------- -// -TInt RCatalogsPCConnectivityClient::StartServer() - { - // Check if the server is already running - TFindServer findServer( KCatalogsPCConnectivityServerName ); - TFullName name; - - TInt result = findServer.Next( name ); - if ( result == KErrNone ) - { - // Server is running - return KErrNone; - } - - // Create a semaphore so we can wait while the server starts - RSemaphore semaphore; - result = semaphore.CreateGlobal( - KCatalogsPCConnectivityServerSemaphoreName, 0 ); - if ( result != KErrNone ) - { - return result; - } - - // Create new Engine service process - result = CreateServerProcess(); - if ( result != KErrNone ) - { - semaphore.Close(); - return result; - } - - // Wait while the server starts - semaphore.Wait(); - - // Semaphore has been signaled, close and return - semaphore.Close(); - - return KErrNone; - } - -// --------------------------------------------------------------------------- -// Create server process -// --------------------------------------------------------------------------- -// -TInt RCatalogsPCConnectivityClient::CreateServerProcess() - { - - RProcess server; - - TInt result = server.Create( - KCatalogsPCConnectivityServerFilename, KNullDesC ); - if ( result != KErrNone ) - { - return result; - } - - // Resume server thread and close handle - server.Resume(); - server.Close(); - - return KErrNone; - } - - -//end diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/catalogspcconnectivityplugin/src/catalogspcconnectivityplugin.cpp --- a/connectivitymodules/SeCon/catalogspcconnectivityplugin/src/catalogspcconnectivityplugin.cpp Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,139 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: This plugin enables the Catalogs PC client to communicate -* with the Catalogs engine -* -*/ - - - -#include "catalogspcconnectivityplugin.h" - - - -// ======== MEMBER FUNCTIONS ======== - -// --------------------------------------------------------------------------- -// Constructor -// --------------------------------------------------------------------------- -// -CCatalogsPCConnectivityPlugin::CCatalogsPCConnectivityPlugin() - { - } - -// --------------------------------------------------------------------------- -// Empty -// --------------------------------------------------------------------------- -// -void CCatalogsPCConnectivityPlugin::ConstructL() - { - } - - -// --------------------------------------------------------------------------- -// Standard symbian object constructing first phase -// --------------------------------------------------------------------------- -// -EXPORT_C CCatalogsPCConnectivityPlugin* CCatalogsPCConnectivityPlugin::NewL() - { - CCatalogsPCConnectivityPlugin* self = - CCatalogsPCConnectivityPlugin::NewLC(); - CleanupStack::Pop( self ); - return self; - } - - -// --------------------------------------------------------------------------- -// Standard symbian object constructing first phase -// --------------------------------------------------------------------------- -// -EXPORT_C CCatalogsPCConnectivityPlugin* CCatalogsPCConnectivityPlugin::NewLC() - { - CCatalogsPCConnectivityPlugin* self = - new( ELeave ) CCatalogsPCConnectivityPlugin; - CleanupStack::PushL( self ); - self->ConstructL(); - return self; - } - -// --------------------------------------------------------------------------- -// Destructor -// --------------------------------------------------------------------------- -// -EXPORT_C CCatalogsPCConnectivityPlugin::~CCatalogsPCConnectivityPlugin() - { - iClient.Close(); - } - - -// --------------------------------------------------------------------------- -// Connect to Catalogs engine pc client front-end -// --------------------------------------------------------------------------- -// -EXPORT_C TInt CCatalogsPCConnectivityPlugin::Connect() - { - return iClient.Connect(); - } - -// --------------------------------------------------------------------------- -// Close the connection to Catalogs engine pc client front-end -// --------------------------------------------------------------------------- -// -EXPORT_C void CCatalogsPCConnectivityPlugin::Close() - { - iClient.Close(); - } - -// --------------------------------------------------------------------------- -// Give all MIME types supported by this component -// --------------------------------------------------------------------------- -// -EXPORT_C RPointerArray CCatalogsPCConnectivityPlugin:: - SupportedMimeTypesL() - { - return iClient.SupportedMimeTypesL(); - } - -// --------------------------------------------------------------------------- -// Data package from PC Client -// --------------------------------------------------------------------------- -// -EXPORT_C void CCatalogsPCConnectivityPlugin::PutDataL( - const TDataType& aMimeType, const CBufFlat& aData ) - { - iClient.PutDataL( aMimeType, aData ); - } - -// --------------------------------------------------------------------------- -// Data request from PC Client -// --------------------------------------------------------------------------- -// -EXPORT_C void CCatalogsPCConnectivityPlugin::GetDataL( - TDataType& aMimeType, CBufFlat& aData ) - { - iClient.GetDataL( aMimeType, aData ); - } - - -// ======== GLOBAL FUNCTIONS ======== - -// --------------------------------------------------------------------------- -// Dll entry point -// --------------------------------------------------------------------------- -// -GLDEF_C TInt E32Dll() - { - return( KErrNone ); - } - diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/clients/pcconn/bld/bld.inf --- a/connectivitymodules/SeCon/clients/pcconn/bld/bld.inf Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +0,0 @@ -/* -* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* This file provides the information required for building the -* whole of SConPCConnClient -* -*/ - - -PRJ_PLATFORMS -DEFAULT - -PRJ_MMPFILES -../bld/sconpcconnclient.mmp diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/clients/pcconn/bld/def/bwinscwu.def --- a/connectivitymodules/SeCon/clients/pcconn/bld/def/bwinscwu.def Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,9 +0,0 @@ -EXPORTS - ??0RSConPCConnSession@@QAE@XZ @ 1 NONAME ; RSConPCConnSession::RSConPCConnSession(void) - ??1RSConPCConnSession@@QAE@XZ @ 2 NONAME ; RSConPCConnSession::~RSConPCConnSession(void) - ?Close@RSConPCConnSession@@QAEXXZ @ 3 NONAME ; void RSConPCConnSession::Close(void) - ?Connect@RSConPCConnSession@@QAEHXZ @ 4 NONAME ; int RSConPCConnSession::Connect(void) - ?GetPacketL@RSConPCConnSession@@QAEHABVTDesC16@@ABVTDesC8@@AAPAVCBufFlat@@@Z @ 5 NONAME ; int RSConPCConnSession::GetPacketL(class TDesC16 const &, class TDesC8 const &, class CBufFlat * &) - ?PutPacketL@RSConPCConnSession@@QAEHABVTDesC16@@ABVTDesC8@@AAPAVCBufFlat@@@Z @ 6 NONAME ; int RSConPCConnSession::PutPacketL(class TDesC16 const &, class TDesC8 const &, class CBufFlat * &) - ?ResetServer@RSConPCConnSession@@QAEHXZ @ 7 NONAME ; int RSConPCConnSession::ResetServer(void) - diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/clients/pcconn/bld/def/eabiuu.def --- a/connectivitymodules/SeCon/clients/pcconn/bld/def/eabiuu.def Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,11 +0,0 @@ -EXPORTS - _ZN18RSConPCConnSession10GetPacketLERK7TDesC16RK6TDesC8RP8CBufFlat @ 1 NONAME - _ZN18RSConPCConnSession10PutPacketLERK7TDesC16RK6TDesC8RP8CBufFlat @ 2 NONAME - _ZN18RSConPCConnSession11ResetServerEv @ 3 NONAME - _ZN18RSConPCConnSession5CloseEv @ 4 NONAME - _ZN18RSConPCConnSession7ConnectEv @ 5 NONAME - _ZN18RSConPCConnSessionC1Ev @ 6 NONAME - _ZN18RSConPCConnSessionC2Ev @ 7 NONAME - _ZN18RSConPCConnSessionD1Ev @ 8 NONAME - _ZN18RSConPCConnSessionD2Ev @ 9 NONAME - diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/clients/pcconn/bld/sconpcconnclient.mmp --- a/connectivitymodules/SeCon/clients/pcconn/bld/sconpcconnclient.mmp Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,62 +0,0 @@ -/* -* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Client side of PC Connectivity Server-Client -* -*/ - - -// To get the MW_LAYER_SYSTEMINCLUDE-definition -#include -#include - -VENDORID VID_DEFAULT - -CAPABILITY CAP_CLIENT_DLL - -TARGET sconpcconnclient.dll -TARGETTYPE dll - -UID 0x10009D8D 0x101F99F7 - -TARGETPATH sys/bin - -#if defined(ARMCC) -DEFFILE ./def/eabiu -#elif defined(WINSCW) -DEFFILE ./def/bwinscw -#elif defined(WINS) -DEFFILE ./def/bwins -#elif defined(ARM) -DEFFILE ./def/bmarm -#endif - - -SOURCEPATH ../src - -SOURCE sconpcconnclient.cpp - -// Client -USERINCLUDE ../inc -USERINCLUDE ../../../inc - -// Server -USERINCLUDE ../../../servers/pcconn/inc - -// Default system include paths for middleware layer modules. -MW_LAYER_SYSTEMINCLUDE - -LIBRARY euser.lib -LIBRARY estor.lib // RMemWriteStream -LIBRARY efsrv.lib // Rfs, RFile -DEBUGLIBRARY flogger.lib diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/clients/pcconn/inc/sconpcconnclient.h --- a/connectivitymodules/SeCon/clients/pcconn/inc/sconpcconnclient.h Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,79 +0,0 @@ -/* -* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: PC Connectivity client -* -*/ - - -#ifndef __SCONPCCONNCLIENT_H__ -#define __SCONPCCONNCLIENT_H__ - -// ----------------------------------------------------------------------------- -// class RSConPCConnSession - the client session -// ----------------------------------------------------------------------------- -class RSConPCConnSession : public RSessionBase - { -public: - IMPORT_C RSConPCConnSession(); - IMPORT_C ~RSConPCConnSession(); - - /** - * Starts the server and connects to it - * @param none - * @return KerrNone or an error code - */ - IMPORT_C TInt Connect(); - - /** - * Disconnects from the server and terminates the server - * @param none - * @return none - */ - IMPORT_C void Close(); - - /** - * Passes an OBEX Put -message to the server - * @param none - * @return none - */ - IMPORT_C TInt PutPacketL( const TDesC& aNameHeader, - const TDesC8& aTypeHeader, - CBufFlat*& aBuffer ); - - /** - * Passes an OBEX Get -message to the server - * @param none - * @return none - */ - IMPORT_C TInt GetPacketL( const TDesC& aNameHeader, - const TDesC8& aTypeHeader, - CBufFlat*& aBuffer ); - - /** - * Passes an reset -message to the server - * @param none - * @return none - */ - IMPORT_C TInt ResetServer(); - -private: - TVersion Version() const; - TInt LaunchServer(); - TInt CreateAndSendChunkHandle(); - -private: - RChunk iChunk; - }; - -#endif \ No newline at end of file diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/clients/pcconn/src/sconpcconnclient.cpp --- a/connectivitymodules/SeCon/clients/pcconn/src/sconpcconnclient.cpp Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,304 +0,0 @@ -/* -* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: PC Connectivity client -* -*/ - - - -// ----------------------------------------------------------------------------- -// Includes -// ----------------------------------------------------------------------------- -#include -#include - -// Client - server -#include "sconpcconnclient.h" -#include "sconpcconnclientserver.h" -#include "debug.h" - -// ----------------------------------------------------------------------------- -// RSConPCConnSession::RSConPCConnSession() -// Default constructor -// ----------------------------------------------------------------------------- -// -EXPORT_C RSConPCConnSession::RSConPCConnSession() - { - TRACE_FUNC; - } - -// ----------------------------------------------------------------------------- -// RSConPCConnSession::~RSConPCConnSession() -// Default destructor -// ----------------------------------------------------------------------------- -// -EXPORT_C RSConPCConnSession::~RSConPCConnSession() - { - TRACE_FUNC; - } - -// ----------------------------------------------------------------------------- -// RSConPCConnSession::Connect() -// Creates a chunk and server, starts the server connection -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt RSConPCConnSession::Connect() - { - TRACE_FUNC_ENTRY; - - TInt ret ( KErrNone ); - - ret = CreateSession(KSConPCConnServerName,Version()); - - if ( ret == KErrNotFound || ret == KErrServerTerminated ) - { - ret = LaunchServer(); - - if ( ret == KErrNone || ret == KErrAlreadyExists ) - { - ret = CreateSession( KSConPCConnServerName, Version() ); - } - } - - if ( ret == KErrNone ) - { - ret = CreateAndSendChunkHandle(); - if ( ret != KErrNone ) - { - LOGGER_WRITE("CreateAndSendChunkHandle failed, close session"); - Close(); - } - } - - LOGGER_WRITE_1( "RSConPCConnSession::Connect() : returned %d", ret ); - return ret; - } - -// ----------------------------------------------------------------------------- -// RSConPCConnSession::Close() -// Closes the server connection -// ----------------------------------------------------------------------------- -// -EXPORT_C void RSConPCConnSession::Close() - { - TRACE_FUNC_ENTRY; - iChunk.Close(); - RSessionBase::Close(); - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// RSConPCConnSession::Version() -// Returns the version of the client -// ----------------------------------------------------------------------------- -// -TVersion RSConPCConnSession::Version(void) const - { - return (TVersion(KSConPCConnServerVersionMajor, - KSConPCConnServerVersionMinor, - KSConPCConnServerVersionBuild)); - } - -// ----------------------------------------------------------------------------- -// RSConPCConnSession::Version() -// Forwards a PUT -message to the server -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt RSConPCConnSession::PutPacketL( - const TDesC& aNameHeader, const TDesC8& aTypeHeader, CBufFlat*& aBuffer ) - { - TRACE_FUNC_ENTRY; - - if ( !aBuffer ) - { - return KErrArgument; - } - - if ((aBuffer->Size() + aTypeHeader.Size() + - aNameHeader.Size()) > KSConPCConnChunkMaxSize) - { - LOGGER_WRITE( "RSConPCConnSession::PutPacketL() :\ - WBXML document too big" ); - return KErrTooBig; - } - - TInt ret (KErrNone); - iChunk.Adjust( KSConPCConnChunkMaxSize ); - RMemWriteStream buf( iChunk.Base(), iChunk.Size() ); - - buf.WriteInt32L( aNameHeader.Size() ); - buf.WriteL( aNameHeader ); - - buf.WriteInt32L( aTypeHeader.Size() ); - buf.WriteL( aTypeHeader ); - - // WBXML document - buf.WriteInt32L( aBuffer->Size() ); - buf.WriteL( aBuffer->Ptr(0) ); - buf.CommitL(); - buf.Close(); - - TIpcArgs args; - ret = SendReceive ( EPutMessage, args ); - - LOGGER_WRITE_1( "RSConPCConnSession::PutPacketL() : returned %d", ret ); - return ret; - } - -// ----------------------------------------------------------------------------- -// RSConPCConnSession::Version() -// Forwards a GET -message to the server -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt RSConPCConnSession::GetPacketL( - const TDesC& aNameHeader, const TDesC8& aTypeHeader, CBufFlat*& aBuffer ) - { - TRACE_FUNC_ENTRY; - - if ( !aBuffer ) - { - return KErrArgument; - } - - TInt ret (KErrNone); - - iChunk.Adjust( KSConPCConnChunkMaxSize); - RMemWriteStream writeBuf( iChunk.Base(), iChunk.Size() ); - writeBuf.WriteInt32L( aNameHeader.Size() ); - writeBuf.WriteL( aNameHeader ); - - writeBuf.WriteInt32L( aTypeHeader.Size() ); - writeBuf.WriteL( aTypeHeader ); - - writeBuf.CommitL(); - writeBuf.Close(); - - TIpcArgs args; - ret = SendReceive ( EGetMessage, args ); - - if ( ret != KErrNone) - { - LOGGER_WRITE_1( "RSConPCConnSession::GetPacketL() :\ - Send Receive failed with code %d", ret ); - return ret; - }; - - // copy data from the chunk - RMemReadStream readBuf( iChunk.Base(), iChunk.Size() ); - TInt32 length ( 0 ); - - aBuffer->Reset(); - length = readBuf.ReadInt32L(); - - HBufC8* data = HBufC8::NewLC( length ); - TPtr8 dataPtr = data->Des(); - - readBuf.ReadL( dataPtr, length ); - aBuffer->ExpandL( 0, length ); - aBuffer->Write ( 0, dataPtr ); - - readBuf.Close(); - - CleanupStack::PopAndDestroy(); // data; - - LOGGER_WRITE_1( "RSConPCConnSession::GetPacketL()\ - : returned %d", ret ); - return ret; - } - -// ----------------------------------------------------------------------------- -// RSConPCConnSession::Version() -// Forwards a Reset -message to the server -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt RSConPCConnSession::ResetServer() - { - TRACE_FUNC_ENTRY; - TInt ret ( KErrNone ); - TIpcArgs args; - ret = SendReceive ( EResetMessage, args ); - LOGGER_WRITE_1( "RSConPCConnSession::ResetServerL(): ret %d", ret ); - return ret; - } - -// ----------------------------------------------------------------------------- -// RSConPCConnSession::LaunchServer() -// Launches the server -// ----------------------------------------------------------------------------- -// -TInt RSConPCConnSession::LaunchServer() - { - TRACE_FUNC_ENTRY; - TInt ret( KErrNone ); - - // Create server - RProcess p; - ret = p.Create(KSConPCConnServerExe, KNullDesC); - - if ( ret != KErrNone ) - { - // Loading failed. - LOGGER_WRITE_1( "RProcess::Create failed, err: %d", ret ); - return ret; - } - - - TRequestStatus status; - p.Rendezvous( status ); - - if ( status != KRequestPending ) - { - p.Kill(0); // abort startup - p.Close(); - LOGGER_WRITE("Abort startup, return KErrGeneral"); - return KErrGeneral; - } - else - { - p.Resume(); // logon OK - start the server - } - - User::WaitForRequest(status); - - p.Close(); - - LOGGER_WRITE_1( "RSConPCConnSession::LaunchServerL(): returned %d", status.Int() ); - return status.Int(); - } - -// ----------------------------------------------------------------------------- -// RSConPCConnSession::CreateAndSendChunkHandle() -// Creates a chunk and sends a handle to server -// ----------------------------------------------------------------------------- -// -TInt RSConPCConnSession::CreateAndSendChunkHandle() - { - TRACE_FUNC_ENTRY; - TInt err = iChunk.CreateGlobal( KNullDesC, - KSConPCConnChunkSize, - KSConPCConnChunkMaxSize ); - if ( err != KErrNone ) - { - LOGGER_WRITE_1("iChunk.CreateGlobal failed, err: %d", err); - return err; - } - TIpcArgs args; - args.Set( 0, iChunk ); - err = SendReceive( EChunkMessage, args ); - - LOGGER_WRITE_1("RSConPCConnSession::CreateAndSendChunkHandle : returned: %d", err); - return err; - } - -// End of file diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/cntparser/bld/bld.inf --- a/connectivitymodules/SeCon/cntparser/bld/bld.inf Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ -/* -* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Contact Parser Client-Server build information file. -* -*/ - - - -PRJ_PLATFORMS -DEFAULT - - -PRJ_MMPFILES -cntparsersrv.mmp -cntparsersrvexe.mmp - - diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/cntparser/bld/cntparsersrv.mmp --- a/connectivitymodules/SeCon/cntparser/bld/cntparsersrv.mmp Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,60 +0,0 @@ -/* -* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Contact Parser Client -* -*/ - - -// To get the MW_LAYER_SYSTEMINCLUDE-definition -#include -#include - -VENDORID VID_DEFAULT - -CAPABILITY CAP_CLIENT_DLL - -TARGET cntparserserver.dll -TARGETTYPE dll - -UID 0x10009d8d 0x101F99F8 - -#if defined(ARMCC) -DEFFILE ./def/eabiu -#elif defined(WINSCW) -DEFFILE ./def/bwinscw -#elif defined(WINS) -DEFFILE ./def/bwins -#elif defined(ARM) -DEFFILE ./def/bmarm -#endif - -SOURCEPATH ../src -SOURCE cntparserclient.cpp -SOURCE cntparserinfolog.cpp - -USERINCLUDE ../inc -USERINCLUDE ../../inc - -// Default system include paths for middleware layer modules. -MW_LAYER_SYSTEMINCLUDE - -LIBRARY euser.lib -LIBRARY cntmodel.lib -LIBRARY efsrv.lib -LIBRARY estor.lib -LIBRARY versit.lib -LIBRARY vcard.lib -LIBRARY bafl.lib -DEBUGLIBRARY flogger.lib - diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/cntparser/bld/cntparsersrvexe.mmp --- a/connectivitymodules/SeCon/cntparser/bld/cntparsersrvexe.mmp Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ -/* -* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Contact Parser Server -* -*/ - - -// To get the MW_LAYER_SYSTEMINCLUDE-definition -#include -#include - -VENDORID VID_DEFAULT - -CAPABILITY CAP_SERVER - -TARGET cntparserserverexe.exe -TARGETTYPE exe - -UID 0 0x101F99F9 - -SOURCEPATH ../src -SOURCE cntparserserverexe.cpp -SOURCE cntparserserversession.cpp -SOURCE cntparsercollector.cpp - -USERINCLUDE ../inc -USERINCLUDE ../../inc - -// Default system include paths -APP_LAYER_SYSTEMINCLUDE - -LIBRARY euser.lib -LIBRARY cntmodel.lib -LIBRARY efsrv.lib -LIBRARY estor.lib -LIBRARY versit.lib -LIBRARY vcard.lib -LIBRARY bafl.lib -DEBUGLIBRARY flogger.lib diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/cntparser/bld/def/bwinscwu.def --- a/connectivitymodules/SeCon/cntparser/bld/def/bwinscwu.def Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,18 +0,0 @@ -EXPORTS - ??0RCntParserServer@@QAE@XZ @ 1 NONAME ; RCntParserServer::RCntParserServer(void) - ?Cancel@RCntParserServer@@QAEHXZ @ 2 NONAME ; int RCntParserServer::Cancel(void) - ?CancelAll@RCntParserServer@@QAEHXZ @ 3 NONAME ; int RCntParserServer::CancelAll(void) - ?Connect@RCntParserServer@@QAEHXZ @ 4 NONAME ; int RCntParserServer::Connect(void) - ?ContactsParsed@RCntParserServer@@QAEHXZ @ 5 NONAME ; int RCntParserServer::ContactsParsed(void) - ?ContactsSaved@RCntParserServer@@QAEHXZ @ 6 NONAME ; int RCntParserServer::ContactsSaved(void) - ?CreateIrMCL2PhoneBook@RCntParserServer@@QAEHHH@Z @ 7 NONAME ; int RCntParserServer::CreateIrMCL2PhoneBook(int, int) - ?Disconnect@RCntParserServer@@QAEHXZ @ 8 NONAME ; int RCntParserServer::Disconnect(void) - ?MaximumRecords@CCntParserInfoLog@@QBEHXZ @ 9 NONAME ; int CCntParserInfoLog::MaximumRecords(void) const - ?NewL@CCntParserInfoLog@@SAPAV1@XZ @ 10 NONAME ; class CCntParserInfoLog * CCntParserInfoLog::NewL(void) - ?SaveToFileL@CCntParserInfoLog@@QBEXABVTDesC16@@@Z @ 11 NONAME ; void CCntParserInfoLog::SaveToFileL(class TDesC16 const &) const - ?SetMaximumRecords@CCntParserInfoLog@@QAEXH@Z @ 12 NONAME ; void CCntParserInfoLog::SetMaximumRecords(int) - ?SetTotalRecords@CCntParserInfoLog@@QAEXH@Z @ 13 NONAME ; void CCntParserInfoLog::SetTotalRecords(int) - ?TotalNumberOfContacts@RCntParserServer@@QAEHXZ @ 14 NONAME ; int RCntParserServer::TotalNumberOfContacts(void) - ?TotalRecords@CCntParserInfoLog@@QBEHXZ @ 15 NONAME ; int CCntParserInfoLog::TotalRecords(void) const - ?Version@RCntParserServer@@QBE?AVTVersion@@XZ @ 16 NONAME ; class TVersion RCntParserServer::Version(void) const - diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/cntparser/bld/def/eabiuu.def --- a/connectivitymodules/SeCon/cntparser/bld/def/eabiuu.def Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,21 +0,0 @@ -EXPORTS - _ZN16RCntParserServer10DisconnectEv @ 1 NONAME - _ZN16RCntParserServer13ContactsSavedEv @ 2 NONAME - _ZN16RCntParserServer14ContactsParsedEv @ 3 NONAME - _ZN16RCntParserServer21CreateIrMCL2PhoneBookEii @ 4 NONAME - _ZN16RCntParserServer21TotalNumberOfContactsEv @ 5 NONAME - _ZN16RCntParserServer6CancelEv @ 6 NONAME - _ZN16RCntParserServer7ConnectEv @ 7 NONAME - _ZN16RCntParserServer9CancelAllEv @ 8 NONAME - _ZN16RCntParserServerC1Ev @ 9 NONAME - _ZN16RCntParserServerC2Ev @ 10 NONAME - _ZN17CCntParserInfoLog15SetTotalRecordsEi @ 11 NONAME - _ZN17CCntParserInfoLog17SetMaximumRecordsEi @ 12 NONAME - _ZN17CCntParserInfoLog4NewLEv @ 13 NONAME - _ZNK16RCntParserServer7VersionEv @ 14 NONAME - _ZNK17CCntParserInfoLog11SaveToFileLERK7TDesC16 @ 15 NONAME - _ZNK17CCntParserInfoLog12TotalRecordsEv @ 16 NONAME - _ZNK17CCntParserInfoLog14MaximumRecordsEv @ 17 NONAME - _ZTI17CCntParserInfoLog @ 18 NONAME ; ## - _ZTV17CCntParserInfoLog @ 19 NONAME ; ## - diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/cntparser/inc/clientserver.h --- a/connectivitymodules/SeCon/cntparser/inc/clientserver.h Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ -/* -* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Contact Parser Server definitions -* -*/ - - -#ifndef __CLIENTSERVER_H__ -#define __CLIENTSERVER_H__ -#include - -// server name -_LIT(KCntParserName,"Contacts Parser"); - -// A version must be specified when creating a session with the server - -const TUint KCntParserMajorVersionNumber=0; -const TUint KCntParserMinorVersionNumber=1; -const TUint KCntParserBuildVersionNumber=1; - -// opcodes used in message passing between client and server -enum TCntParserRqst - { - ECntParserServerCancel, - ECntParserServerClose, - ECntParserServerCreateIrMCL2, - ECntParserServerTotalNumOfContacts, - ECntParserServerDisconnect, - ECntParserServerCntParsed, - ECntParserServerCntSaved, - ECntParserServerCancelAll - }; - -#endif \ No newline at end of file diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/cntparser/inc/cntparserclient.h --- a/connectivitymodules/SeCon/cntparser/inc/cntparserclient.h Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,56 +0,0 @@ -/* -* Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Contact Parser Client -* -*/ - - - -#if !defined(__CNTPARSERCLIENT_H__) -#define __CNTPARSERCLIENT_H__ - -#include -#include - -enum TCntParserConnection -{ - ECntParserNotConnected, - ECntParserConnected -}; - -//********************************** -//RCntParserServer -//********************************** - -class RCntParserServer : public RSessionBase -{ - public: - IMPORT_C RCntParserServer(); - IMPORT_C TInt Connect(); - IMPORT_C TInt Disconnect(); - IMPORT_C TVersion Version() const; - IMPORT_C TInt CreateIrMCL2PhoneBook(TInt aMaxNumberOfContacts, TBool aForced); - IMPORT_C TInt ContactsParsed(); - IMPORT_C TInt ContactsSaved(); - IMPORT_C TInt TotalNumberOfContacts(); - IMPORT_C TInt Cancel(); //cancels phonebook request - IMPORT_C TInt CancelAll(); //cancels all request - - private: - TCntParserConnection iConnected; -}; - - -#endif - diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/cntparser/inc/cntparsercollector.h --- a/connectivitymodules/SeCon/cntparser/inc/cntparsercollector.h Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,76 +0,0 @@ -/* -* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: CCntParserCollector header -* -*/ - - - -#ifndef __CNTPARSERCOLLECTOR_H__ -#define __CNTPARSERCOLLECTOR_H__ - -#include -#include - -class CCntParserServer; -class CContactDatabase; -class CContactIdArray; -class CCntFilter; -class CVersitTlsData; - -class CCntParserCollector : public CActive -{ - public: - - CCntParserCollector(); - static CCntParserCollector* NewL(CCntParserServer* aServer,CContactDatabase* aCurrentDatabase); - static CCntParserCollector* NewLC(CCntParserServer* aServer,CContactDatabase* aCurrentDatabase); - virtual ~CCntParserCollector(); - void ConstructL(CCntParserServer* aServer,CContactDatabase* aCurrentDatabase); - TInt CreateIrMCL2FileL(const TDesC& aFileName,TInt aMaxNumberOfContacts,TBool aForced); - void PrepareParserL(); - void ParseCntDatabaseL(); - void DoCancel(); - - TInt CurrentItem(); - TInt Count(); - TInt ContactsSaved(); - - protected: - void RunL(); - TInt RunError(TInt aError); - void ExternalizeCurrentContactL(CContactDatabase* aContactsDb,TInt aCurrentItem,TBool ExternalizeEmpty); - void CloseResources(); - void SaveTotalCountL(); - TInt ReadTotalCountL() const; - TBool ContactCountChanged(); - - private: - CContactDatabase* iContactsDb; //Caller has the ownership - TInt iCurrentItem; - TInt iCount; //Contacts in CDB - TInt iMaxNumberOfContacts; //Max contacts to be parsed (MAXIMUM RECORDS in info.log) - RFileWriteStream iWriter; - CContactIdArray* iIds; //List of ID numbers of contacts - CCntParserServer* iServer; //Caller has the ownership - CCntFilter* iFilter; - CVersitTlsData* iVersitTLS; //For speed optimization - TBool iCancel; - TInt iContactsSaved; - TInt iTotalCount; - - RFs iFsSession; -}; - -#endif \ No newline at end of file diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/cntparser/inc/cntparserinfolog.h --- a/connectivitymodules/SeCon/cntparser/inc/cntparserinfolog.h Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ -/* -* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: CCntParserInfoLog header. -* This class is intended to create the INFO.LOG file for RANSI car phone when -* downloading contacts using IrMC L2. The implementation contains only mandatory -* needs and some extension possibilities. This class is RANSI specific and -* should _NOT_ be used by anyone else without a deeper knowledge. -* -*/ - - -#ifndef _CNTPARSERINFOLOG_H_ -#define _CNTPARSERINFOLOG_H_ - - -class CCntParserInfoLog : public CBase -{ - public: - CCntParserInfoLog(); - virtual ~CCntParserInfoLog(); - IMPORT_C static CCntParserInfoLog* NewL(); - void ConstructL(); - - IMPORT_C void SaveToFileL(const TDesC& aFileName) const; - - IMPORT_C void SetTotalRecords(TInt aTotalRecords); - IMPORT_C void SetMaximumRecords(TInt aMaximumRecords); - - IMPORT_C TInt TotalRecords() const; - IMPORT_C TInt MaximumRecords() const; - - private: - - TInt iTotalRecords; - TInt iLastUsedIndex; - TInt iMaximumRecords; -}; - -#endif // _CNTPARSERINFOLOG_H_ diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/cntparser/inc/cntparserserver.h --- a/connectivitymodules/SeCon/cntparser/inc/cntparserserver.h Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,95 +0,0 @@ -/* -* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: CCntParserServer header -* -*/ - - -#ifndef __CNTPARSERSERVER_H__ -#define __CNTPARSERSERVER_H__ - -#include -#include - -class CCntParserCollector; -class CContactDatabase; - -_LIT(KTxtServer,"CntParserServerExe.exe"); - -// needed for creating server thread. -const TUint KDefaultHeapSize=0x10000; - -// reasons for server panic -enum TCntParserServerPanic -{ - EBadRequest, - EBadDescriptor, - EMainSchedulerError, - ESvrCreateServer, - ESvrStartServer, - ECreateTrapCleanup, - ENotImplementedYet, -}; - - -//********************************** -//CCntParserServer -//********************************** -class CCntParserServer : public CServer2 -{ - public: - IMPORT_C static CCntParserServer* NewL(); - IMPORT_C virtual ~CCntParserServer(); - static TInt RunServer(); - static void RunServerL(); - void IncreaseSessionCountL(); - void DecreaseSessionCount(); - void Stop(); - - TInt CreateIrMCL2PhoneBookL(const TDesC& path, TInt aMaxNumberOfContacts,TBool aForced); - void PrepareCollectorL(); - TInt ContactsParsed(); - void CancelPhoneBookRequest(); - void CancelAllPhoneBookRequests(); - TInt TotalNumOfContacts(); - TInt ContactsSaved(); - void Disconnect(); - void CompletePhoneBookRequests(TInt aErr); - void SetRequests(TInt aRequests); - - protected: - virtual CSession2* NewSessionL(const TVersion &aVersion, const RMessage2& aMsg) const; - - - protected: - CCntParserServer(); - - - private: - TInt iSessionCount; - TInt iRequests; //How many PB.VCF requests are ongoing, if 0 collector is canceled - - CCntParserCollector* iCollector; - CContactDatabase* iCurrentDatabase; -}; - -//********************************** -//global functions -//********************************** - -// function to panic the server -GLREF_C void PanicServer(TCntParserServerPanic aPanic); - - -#endif \ No newline at end of file diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/cntparser/inc/cntparserserversession.h --- a/connectivitymodules/SeCon/cntparser/inc/cntparserserversession.h Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,57 +0,0 @@ -/* -* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: CCntParserServerSession header -* -*/ - - -#ifndef __CNTPARSERSERVERSESSION_H__ -#define __CNTPARSERSERVERSESSION_H__ - -#include "clientserver.h" -#include "cntparserclient.h" -#include "cntparserserver.h" -#include "cntparsercollector.h" - -class CCntParserServer; - -//********************************** -//CCntParserServerSession -//********************************** -class CCntParserServerSession : public CSession2 -{ - public: - static CCntParserServerSession* NewL(CCntParserServer* aServer); - virtual ~CCntParserServerSession(); - void ConstructL(CCntParserServer* aServer); - - private: - CCntParserServerSession(); - - public: - virtual void ServiceL(const RMessage2& aMessage); - TInt DispatchMessageL(const RMessage2& aMessage); - void CompletePhoneBookRequest(TInt aErr); - - protected: - // panic the client - void PanicClient(TInt aPanic) const; - - private: - CCntParserServer* iContactsParserSrv; - TBool iPhoneBookRequest; - RMessage2 iPhoneBookRequestMessage; -}; - -#endif \ No newline at end of file diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/cntparser/inc/irmcconsts.h --- a/connectivitymodules/SeCon/cntparser/inc/irmcconsts.h Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -/* -* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Contact Parser constants -* -*/ - - -#ifndef _IRMCCONSTS_H_ -#define _IRMCCONSTS_H_ - -_LIT(KPhoneBookFilename,"c:\\IrMC\\pb.vcf"); -const TInt KMaximumNumberOfContacts=-1; //-1 == all contacts are transferred -const TInt KPBNotUpdated=1; //Must be grater than 0 -const TInt KPerformComplete=2; //Must be grater than 0 and different than KPBNotUpdated - -#endif diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/cntparser/src/cntparserclient.cpp --- a/connectivitymodules/SeCon/cntparser/src/cntparserclient.cpp Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,252 +0,0 @@ -/* -* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: RCntParserServer implementation. -* -*/ - - -// needed for client interface -#include "clientserver.h" -#include "cntparserserver.h" -#include "cntparserclient.h" - -#include "debug.h" - -const TUint KDefaultMessageSlots=4; - - -//------------------------------------------------------------ -// RCntParserServer::RCntParserServer() -//------------------------------------------------------------ -EXPORT_C RCntParserServer::RCntParserServer():iConnected(ECntParserNotConnected) - { - } -//------------------------------------------------------------ -// RCntParserServer::Connect() -//------------------------------------------------------------ -EXPORT_C TInt RCntParserServer::Connect() - { - LOGGER_ENTERFN( "RCntParserServer::Connect()" ); - - TInt r = KErrNone; - - if( iConnected == ECntParserNotConnected ) - { - r = CreateSession( KCntParserName, Version(), KDefaultMessageSlots ); - if(r==KErrNone) - { - iConnected=ECntParserConnected; - } - else - { - RProcess p; - TInt err = p.Create(KTxtServer, KNullDesC); - if ( err != KErrNone ) - { - // Loading failed. - return err; - } - TRequestStatus status; - p.Rendezvous( status ); - if( status != KRequestPending ) - { - p.Kill(0); // abort startup - p.Close(); - return KErrGeneral; // status can be KErrNone: don't return status.Int() - } - else - { - p.Resume(); // logon OK - start the server - } - - User::WaitForRequest( status ); - - if( status != KErrNone ) - { - p.Close(); - return status.Int(); - } - - r = CreateSession( KCntParserName, Version() ); - if( r == KErrNone ) - { - iConnected = ECntParserConnected; - } - p.Close(); - } - } - else - { - r = KErrCouldNotConnect; - } - LOGGER_WRITE_1( "RCntParserServer::Connect() : return %d", r ); - return r; - } -//------------------------------------------------------------ -// RCntParserServer::Disconnect() -//------------------------------------------------------------ -EXPORT_C TInt RCntParserServer::Disconnect() - { - LOGGER_ENTERFN( "RCntParserServer::Disconnect()" ); - - TInt res = KErrNone; - if(iConnected==ECntParserConnected) - { - res = SendReceive( ECntParserServerDisconnect, TIpcArgs(NULL) ); - if( res == KErrNone ) - { - iConnected = ECntParserNotConnected; - RSessionBase::Close(); - } - } - else - { - res = KErrCouldNotDisconnect; - } - LOGGER_WRITE_1( "RCntParserServer::CreateIrMCL2PhoneBook() : return %d", res ); - return res; - } -//------------------------------------------------------------ -// RCntParserServer::Version(void) const -//------------------------------------------------------------ -EXPORT_C TVersion RCntParserServer::Version(void) const - { - return(TVersion(KCntParserMajorVersionNumber,KCntParserMinorVersionNumber,KCntParserBuildVersionNumber)); - } -//------------------------------------------------------------ -// RCntParserServer::CreateIrMCL2PhoneBook(TInt aMaxNumberOfContacts, TBool aForced) -//------------------------------------------------------------ -EXPORT_C int RCntParserServer::CreateIrMCL2PhoneBook(TInt aMaxNumberOfContacts, TBool aForced) - { - LOGGER_ENTERFN( "RCntParserServer::CreateIrMCL2PhoneBook()" ); - TInt res(KErrNone); - if( iConnected == ECntParserConnected ) - { - res = SendReceive(ECntParserServerCreateIrMCL2,TIpcArgs(aMaxNumberOfContacts,aForced)); - } - else - { - res = KErrNotReady; - } - LOGGER_WRITE_1( "RCntParserServer::CreateIrMCL2PhoneBook() : return %d", res ); - return res; - } -//------------------------------------------------------------ -// RCntParserServer::ContactsParsed() -//------------------------------------------------------------ -EXPORT_C TInt RCntParserServer::ContactsParsed() - { - LOGGER_ENTERFN( "RCntParserServer::ContactsParsed()" ); - - TInt res=KErrNone; - if( iConnected == ECntParserConnected ) - { - TPckgBuf pckg; - res = SendReceive(ECntParserServerCntParsed,TIpcArgs(&pckg)); - if( res == KErrNone ) - { - res = pckg(); - } - } - else - { - res = KErrNotReady; - } - LOGGER_WRITE_1( "RCntParserServer::ContactsParsed() : return %d", res ); - return res; - } -//------------------------------------------------------------ -// RCntParserServer::TotalNumberOfContacts() -//------------------------------------------------------------ -EXPORT_C TInt RCntParserServer::TotalNumberOfContacts() - { - LOGGER_ENTERFN( "RCntParserServer::TotalNumberOfContacts()" ); - - TInt res = KErrNone; - if( iConnected == ECntParserConnected ) - { - TPckgBuf pckg; - res = SendReceive(ECntParserServerTotalNumOfContacts,TIpcArgs(&pckg)); - if( res == KErrNone) - { - res = pckg(); - } - } - else - { - res = KErrNotReady; - } - LOGGER_WRITE_1( "RCntParserServer::TotalNumberOfContacts() : return %d", res ); - return res; - } -//------------------------------------------------------------ -// RCntParserServer::Cancel() -//------------------------------------------------------------ -EXPORT_C TInt RCntParserServer::Cancel() - { - LOGGER_ENTERFN( "RCntParserServer::Cancel()" ); - - TInt res = KErrNone; - if( iConnected == ECntParserConnected ) - { - res = SendReceive(ECntParserServerCancel,TIpcArgs(NULL)); - } - else - { - res = KErrCancel; - } - LOGGER_WRITE_1( "RCntParserServer::Cancel() : return %d", res ); - return res; - } -//------------------------------------------------------------ -// RCntParserServer::CancelAll() -//------------------------------------------------------------ -EXPORT_C TInt RCntParserServer::CancelAll() - { - LOGGER_ENTERFN( "RCntParserServer::CancelAll()" ); - - TInt res = KErrNone; - if(iConnected==ECntParserConnected) - { - res = SendReceive(ECntParserServerCancelAll,TIpcArgs(NULL)); - } - else - { - res = KErrCancel; - } - LOGGER_WRITE_1( "RCntParserServer::CancelAll() : return %d", res ); - return res; - } -//------------------------------------------------------------ -// RCntParserServer::ContactsSaved() -//------------------------------------------------------------ -EXPORT_C TInt RCntParserServer::ContactsSaved() - { - LOGGER_ENTERFN( "RCntParserServer::ContactsSaved()" ); - - TInt res = KErrNone; - if( iConnected == ECntParserConnected ) - { - TPckgBuf pckg; - SendReceive(ECntParserServerCntSaved,TIpcArgs(&pckg)); - res = pckg(); - } - else - { - res = KErrNotReady; - } - LOGGER_WRITE_1( "RCntParserServer::ContactsSaved() : return %d", res ); - return res; - } - diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/cntparser/src/cntparsercollector.cpp --- a/connectivitymodules/SeCon/cntparser/src/cntparsercollector.cpp Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,620 +0,0 @@ -/* -* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: CCntParserCollector implementation. -* -*/ - - - -#include -#include -#include - -#include -#include -#include - -#include "cntparsercollector.h" -#include "cntparserserver.h" -#include "irmcconsts.h" -#include "debug.h" - -//Next values are defined in cntdef.h -const TUid typesToBeSearched[]={{KUidContactFieldPhoneNumberValue},{KUidContactFieldFaxValue}}; - -_LIT( KTotalCountFilePath, "count.txt" ); - -_LIT8( KNameProperty, "N" ); -_LIT8( KTelProperty, "TEL" ); - - -//------------------------------------------------------------ -// CCntParserCollector::CCntParserCollector():CActive( 0 ) -//------------------------------------------------------------ -CCntParserCollector::CCntParserCollector():CActive( 0 ) - { - } -//------------------------------------------------------------ -// CCntParserCollector::~CCntParserCollector() -//------------------------------------------------------------ -CCntParserCollector::~CCntParserCollector() - { - LOGGER_ENTERFN( "CntParserCollector::~CCntParserCollector()" ); - - if( iVersitTLS != NULL ) - { - iVersitTLS->VersitTlsDataClose(); //Close reference - } - LOGGER_WRITE( "CntParserCollector: Versit OK!" ); - - iFsSession.Close(); - LOGGER_WRITE( "CntParserCollector: FsSession OK!" ); - iWriter.Close(); - LOGGER_WRITE( "CntParserCollector: iWriter OK!" ); - delete iFilter; - LOGGER_LEAVEFN( "CntParserCollector::~CCntParserCollector()" ); - } -//------------------------------------------------------------ -// CCntParserCollector::NewL(CCntParserServer* aServer,CContactDatabase* aCurrentDatabase) -//------------------------------------------------------------ -CCntParserCollector* CCntParserCollector::NewL(CCntParserServer* aServer,CContactDatabase* aCurrentDatabase) - { - CCntParserCollector* self=NewLC(aServer, aCurrentDatabase); - CleanupStack::Pop(); - return self; - } -//------------------------------------------------------------ -// CCntParserCollector::NewLC(CCntParserServer* aServer,CContactDatabase* aCurrentDatabase) -//------------------------------------------------------------ -CCntParserCollector* CCntParserCollector::NewLC(CCntParserServer* aServer,CContactDatabase* aCurrentDatabase) - { - CCntParserCollector* self=new (ELeave) CCntParserCollector(); - CleanupStack::PushL( self ); - self->ConstructL( aServer, aCurrentDatabase ); - return self; - } -//------------------------------------------------------------ -// CCntParserCollector::ConstructL(CCntParserServer* aServer,CContactDatabase* aCurrentDatabase) -//------------------------------------------------------------ -void CCntParserCollector::ConstructL(CCntParserServer* aServer,CContactDatabase* aCurrentDatabase) - { - LOGGER_WRITE( "CntParserCollector: ConstructL" ); - - CVersitTlsData& VersitTLS = CVersitTlsData::VersitTlsDataL(); //For speed optimization take a reference to TLS, SEE DESTRUCTOR!! - iVersitTLS = &VersitTLS; - - iServer = aServer; - iContactsDb = aCurrentDatabase; - PrepareParserL(); - - CActiveScheduler::Add(this); - } -//------------------------------------------------------------ -// CCntParserCollector::CreateIrMCL2FileL(const TDesC& aFileName, TInt aMaxNumberOfContacts,TBool aForced) -//------------------------------------------------------------ -TInt CCntParserCollector::CreateIrMCL2FileL(const TDesC& aFileName, TInt aMaxNumberOfContacts,TBool aForced) - { - LOGGER_WRITE( "CntParserCollector: CreateIrMCL2FileL" ); - LOGGER_WRITE_1( "CCntParserCollector::CreateIrMCL2FileL aFileName %S", &aFileName ); - - iMaxNumberOfContacts = aMaxNumberOfContacts; - - CContactIdArray* changedItems; - TTime tTime; - - LOGGER_WRITE( "CntParserCollector: CreateIrMCL2FileL: Does the PB.VCF already exist" ); - - //Is there a previously created pb.vcf file? - RFile file; - TInt err = file.Open( iFsSession, aFileName, EFileShareExclusive ); //Open file - if( err == KErrNone ) - { - LOGGER_WRITE( "CntParserCollector: CreateIrMCL2FileL: Yes, when created" ); - file.Modified(tTime); //When modified - } - file.Close(); - - err = iWriter.Open( iFsSession, aFileName, EFileShareExclusive ); //Open stream - CleanupClosePushL( iWriter ); //Yes, this is a member variable, but it's considered - - if( err == KErrPathNotFound ) - { - LOGGER_WRITE( "CntParserCollector: CreateIrMCL2FileL: dir did not exist, creating..." ); - err = iFsSession.MkDir( aFileName ); - LOGGER_WRITE_1( "CCntParserCollector MkDir returned %d", err ); - if ( err == KErrNone ) - { - LOGGER_WRITE( "CntParserCollector: CreateIrMCL2FileL: New file after MkDir" ); - //This is the situation that the file is created for the first time - User::LeaveIfError( iWriter.Create( iFsSession, aFileName, EFileShareExclusive ) ); - LOGGER_WRITE( "CntParserCollector: CreateIrMCL2FileL: New file created after MkDir" ); - CleanupStack::Pop(); //iWriter - ParseCntDatabaseL(); //create IrMC L2 stuff - SaveTotalCountL(); - return KErrNone; //File created normally - } - } - if( err == KErrNotFound ) // file does not exist - create it - { - LOGGER_WRITE( "CntParserCollector: CreateIrMCL2FileL: New file" ); - - //This is the situation that the file is created for the first time - User::LeaveIfError( iWriter.Create( iFsSession, aFileName, EFileShareExclusive ) ); - LOGGER_WRITE( "CntParserCollector: CreateIrMCL2FileL: New file created" ); - CleanupStack::Pop(); //iWriter - ParseCntDatabaseL(); //create IrMC L2 stuff - SaveTotalCountL(); - return KErrNone; //File created normally - } - else - { - if( err != KErrNone ) - { - LOGGER_WRITE_1( "CreateIrMCL2FileL errror leaving %d", err ); - User::Leave(err); - } - iWriter.Close(); - - LOGGER_WRITE( "CntParserCollector: CreateIrMCL2FileL: File exists, any changes in CDB?" ); - //The file exists, but are there any changes? - - changedItems = iContactsDb->ContactsChangedSinceL( tTime ); //Create a contactidarray, user takes the ownership - CleanupStack::PushL(changedItems); - - LOGGER_WRITE_1( "CreateIrMCL2FileL changedItems %d", changedItems->Count() ); - LOGGER_WRITE_1( "CreateIrMCL2FileL aForced %d", aForced ); - //Are there changes in any contact - if( changedItems->Count()!=0 || aForced || ContactCountChanged() ) - { - LOGGER_WRITE( "CntParserCollector: CreateIrMCL2FileL: Changes in CDB, replace existing PB.VCF" ); - - CleanupStack::PopAndDestroy(changedItems); - - //Create pb.vcf - User::LeaveIfError( iWriter.Replace( iFsSession, aFileName, EFileShareExclusive) ); - LOGGER_WRITE( "CntParserCollector: CreateIrMCL2FileL: file replaced" ); - CleanupStack::Pop(); //iWriter - ParseCntDatabaseL(); //create IrMC L2 stuff - SaveTotalCountL(); - return KErrNone; //File created normally - } - - //No changes - CleanupStack::PopAndDestroy(changedItems); - CleanupStack::PopAndDestroy(); - - LOGGER_WRITE( "CntParserCollector: CreateIrMCL2FileL: No Changes in CDB, keep old PB.VCF" ); - } - return KPBNotUpdated; //No error occured, KPBNotUpdated used as return value to tell that the file was not created.. - } -//------------------------------------------------------------ -// CCntParserCollector::ParseCntDatabaseL() -//------------------------------------------------------------ -void CCntParserCollector::ParseCntDatabaseL() - { - LOGGER_WRITE( "CntParserCollector: ParseCntDatabaseL" ); - - iCurrentItem = 0; - iCancel = EFalse; - iContactsSaved = 0; - - //Create owncard (it's always included, even if it's empty) - - TFileName defaultDb; - CContactDatabase::GetDefaultNameL( defaultDb ); - TFileName currentDb; - iContactsDb->GetCurrentDatabase( currentDb ); - - if( defaultDb.CompareF(currentDb) == 0 || currentDb == KNullDesC16 /*|| currentDb.CompareF(KSimDummyDatabase)==0*/) //Is current database also default? - { - LOGGER_WRITE( "CntParserCollector: ParseCntDatabaseL: Using default database" ); - TContactItemId ownCardId = iContactsDb->OwnCardId(); - ExternalizeCurrentContactL( iContactsDb, ownCardId, ETrue); - } - else - { - LOGGER_WRITE( "CntParserCollector: ParseCntDatabaseL: Not using default database" ); - CContactDatabase* db=CContactDatabase::OpenL(); //My contact card is only in default db, so open it - CleanupStack::PushL(db); - - TContactItemId ownCardId = db->OwnCardId(); - ExternalizeCurrentContactL( db, ownCardId, ETrue ); - - CleanupStack::PopAndDestroy( db ); - } - - //Start running RunL method and create everything else.. - TRequestStatus* s = &iStatus; - User::RequestComplete( s, KErrNone ); - SetActive(); - } -//------------------------------------------------------------ -// CCntParserCollector::CloseResources() -//------------------------------------------------------------ -void CCntParserCollector::CloseResources() - { - LOGGER_WRITE( "CntParserCollector: CloseResources: Closing resources (iWriter)" ); - iWriter.Close(); - } -//------------------------------------------------------------ -// CCntParserCollector::PrepareParserL() -//------------------------------------------------------------ -void CCntParserCollector::PrepareParserL() - { - LOGGER_WRITE( "CntParserCollector: PrepareParserL" ); - iFilter = CCntFilter::NewL(); //Filter all contact cards out of others - - iFilter->SetContactFilterTypeALL( EFalse ); - iFilter->SetContactFilterTypeCard( ETrue ); - iContactsDb->FilterDatabaseL( *iFilter ); - - iIds=iFilter->iIds; //Get IDs to filtered contacts - iCount=iIds->Count(); //Get number of contacts to be collected - - User::LeaveIfError( iFsSession.Connect() ); //Connect to the file server - - LOGGER_WRITE_1( "CntParserCollector: PrepareParserL: iCount == %d", iCount); - } -//------------------------------------------------------------ -// CCntParserCollector::RunL() -//------------------------------------------------------------ -void CCntParserCollector::RunL() - { - //MaxNumberOfContacts-1 for OwnCard - if( iCurrentItem < iCount && (iCurrentItem < ( iMaxNumberOfContacts - 1 ) || iMaxNumberOfContacts == -1 ) ) //If no more contacts left or maximum number of contacts already parsed - { - ExternalizeCurrentContactL( iContactsDb, (*iIds)[iCurrentItem], EFalse ); - iCurrentItem++; - TRequestStatus* s = &iStatus; //Let's rerun this RunL method as soon as possible - User::RequestComplete( s, KErrNone ); - SetActive(); - return; - } - iCurrentItem++; //for OwnCard that is created separately - LOGGER_WRITE( "CntParserCollector: RunL: No more items" ); - CloseResources(); - iServer->CompletePhoneBookRequests( KErrNone ); - } -//------------------------------------------------------------ -// CCntParserCollector::ExternalizeCurrentContactL(CContactDatabase* aContactsDb,TInt aCurrentItem,TBool ExternalizeEmpty) -//------------------------------------------------------------ -void CCntParserCollector::ExternalizeCurrentContactL(CContactDatabase* aContactsDb,TInt aCurrentItem,TBool ExternalizeEmpty) - { - CContactItem* ownCard; - - if( aCurrentItem < 0 ) - { - ownCard = CContactCard::NewLC(); - } - else - { - ownCard = aContactsDb->ReadContactLC( aCurrentItem ); //Take a new contact item - } - - CParserVCard* VCard=CParserVCard::NewL(); //Create new VCard - CleanupStack::PushL( VCard ); - - TInt nField = ownCard->CardFields().Find( KUidContactFieldGivenName ); - TInt fField = ownCard->CardFields().Find( KUidContactFieldFamilyName ); - TInt cField = ownCard->CardFields().Find( KUidContactFieldCompanyName ); - - //FOR NAMES - //N: -field always included even if it's empty - CDesC16Array* ValueArray=new (ELeave) CDesCArrayFlat(4); - CleanupStack::PushL( ValueArray ); - CParserPropertyValueCDesCArray* NameValues=new (ELeave) CParserPropertyValueCDesCArray( ValueArray ); - CleanupStack::PushL( NameValues ); - CArrayPtr* parameters=new (ELeave) CArrayPtrFlat(1); - CleanupStack::PushL( parameters ); - - TPtrC fName; - TPtrC nName; - TPtrC cName; - - if( fField != KErrNotFound ) - { - fName.Set( ownCard->CardFields()[fField].TextStorage()->Text() ); - } - if( nField != KErrNotFound ) - { - nName.Set( ownCard->CardFields()[nField].TextStorage()->Text() ); - } - if( cField != KErrNotFound ) - { - cName.Set( ownCard->CardFields()[cField].TextStorage()->Text() ); - } - - if( fName.Length() == 0) - { - fField = KErrNotFound; - } - if(nName.Length()==0) - { - nField = KErrNotFound; - if( fField==KErrNotFound ) - { - ValueArray->AppendL( cName ); - } - else - { - ValueArray->AppendL( fName ); - } - } - else - { - ValueArray->AppendL( fName ); - ValueArray->AppendL( nName ); - } - - VCard->AddPropertyL( CParserProperty::NewL((*NameValues),KNameProperty,parameters) ); //Add name property to VCard (VCard takes the ownership of the property) - CleanupStack::Pop(3); //parameters namevalues valuearray - - TBool isNumber = EFalse; - - TInt typeIndex = 0; - TInt index = -1; //NOTE: +1 added before used first time - - for(;;) //Go through all fields (Number of fields is unknown) - { - index = ownCard->CardFields().FindNext(typesToBeSearched[typeIndex],index+1);//Find next field (of current type) - if( index == KErrNotFound ) //No more phone numbers, move to the next group -> (See TypesToBeSearched) - { - typeIndex++; - if( typeIndex >= (signed) (sizeof(typesToBeSearched) / sizeof(TUid)) ) - { - break; //if no more types to search -> exit FOR-loop - } - - index=ownCard->CardFields().FindNext(typesToBeSearched[typeIndex],0); //Find next field - if( index==KErrNotFound ) - { - break; //No fields -> exit - } - } - - TPtrC number = ownCard->CardFields()[index].TextStorage()->Text(); - if( number.Length() != 0) - { - CDesC16Array* ValueArray2=new (ELeave) CDesCArrayFlat(4); - CleanupStack::PushL( ValueArray2 ); - CParserPropertyValueCDesCArray* NumberValues=new (ELeave) CParserPropertyValueCDesCArray(ValueArray2); - CleanupStack::PushL( NumberValues ); - CArrayPtr* parameters2=new (ELeave) CArrayPtrFlat(1); - CleanupStack::PushL( parameters2 ); - - //Take label name to parameter - - for( TInt i=0;iCardFields()[index].ContentType().FieldTypeCount();i++ ) - { - TFieldType fieldType=ownCard->CardFields()[index].ContentType().FieldType(i); - - if(fieldType==KUidContactFieldVCardMapWORK) parameters2->AppendL(CParserParam::NewL(KVersitParam8Work,KNullDesC8)); - if(fieldType==KUidContactFieldVCardMapHOME) parameters2->AppendL(CParserParam::NewL(KVersitParam8Home,KNullDesC8)); - if(fieldType==KUidContactFieldVCardMapMSG) parameters2->AppendL(CParserParam::NewL(KVersitParam8Msg,KNullDesC8)); - if(fieldType==KUidContactFieldVCardMapVOICE)parameters2->AppendL(CParserParam::NewL(KVersitParam8Voice,KNullDesC8)); - if(fieldType==KUidContactFieldVCardMapFAX) parameters2->AppendL(CParserParam::NewL(KVersitParam8Fax,KNullDesC8)); - if(fieldType==KUidContactFieldVCardMapPREF) parameters2->AppendL(CParserParam::NewL(KVersitParam8Pref,KNullDesC8)); - if(fieldType==KUidContactFieldVCardMapCELL) parameters2->AppendL(CParserParam::NewL(KVersitParam8Cell,KNullDesC8)); - if(fieldType==KUidContactFieldVCardMapPAGER)parameters2->AppendL(CParserParam::NewL(KVersitParam8Pager,KNullDesC8)); - if(fieldType==KUidContactFieldVCardMapBBS) parameters2->AppendL(CParserParam::NewL(KVersitParam8Bbs,KNullDesC8)); - if(fieldType==KUidContactFieldVCardMapMODEM)parameters2->AppendL(CParserParam::NewL(KVersitParam8Modem,KNullDesC8)); - if(fieldType==KUidContactFieldVCardMapCAR) parameters2->AppendL(CParserParam::NewL(KVersitParam8Car,KNullDesC8)); - if(fieldType==KUidContactFieldVCardMapISDN) parameters2->AppendL(CParserParam::NewL(KVersitParam8Isdn,KNullDesC8)); - if(fieldType==KUidContactFieldVCardMapVIDEO)parameters2->AppendL(CParserParam::NewL(KVersitParam8Video,KNullDesC8)); - } - - ValueArray2->AppendL( number ); - VCard->AddPropertyL(CParserProperty::NewL((*NumberValues),KTelProperty,parameters2)); //VCard takes the ownership of the property - isNumber=ETrue; - - CleanupStack::Pop(3); //parameters2 numbervalues valuearray2 - } - } - - if( (nField!=KErrNotFound) || (fField!=KErrNotFound) || (cField!=KErrNotFound) || isNumber || ExternalizeEmpty ) - { - if( !isNumber ) - { - //Create empty TEL field (required by the specs) - - CDesC16Array* ValueArray3=new (ELeave) CDesCArrayFlat(4); - CleanupStack::PushL(ValueArray3); - CParserPropertyValueCDesCArray* NumberValues2=new (ELeave) CParserPropertyValueCDesCArray(ValueArray3); - CleanupStack::PushL(NumberValues2); - CArrayPtr* parameters3=new (ELeave) CArrayPtrFlat(1); - CleanupStack::PushL(parameters3); - - VCard->AddPropertyL(CParserProperty::NewL((*NumberValues2),KTelProperty,parameters3)); //VCard takes the ownership of the property - - CleanupStack::Pop(3); //parameters3 numbervalues valuearray3 - } - - TRAPD( err, VCard->ExternalizeL( iWriter );) //If there are no name or numbers, then no externalizing.. - //if error then only current contact card is discarded, but others will be still collected.. - if( err == KErrNone ) - { - iContactsSaved++; - } - else - { - LOGGER_WRITE( "CntParserCollector: RunL: Error,VCARD _NOT_ saved" ); - } - } - - aContactsDb->CloseContactL( aCurrentItem ); //Close current contact item - - CleanupStack::PopAndDestroy( VCard ); // VCard and all arrays (parameters2, numvervalues, valuearray2) related to this VCard are deleted through the ownership relations - CleanupStack::PopAndDestroy( ownCard ); - } -//------------------------------------------------------------ -// CCntParserCollector::DoCancel() -//------------------------------------------------------------ -void CCntParserCollector::DoCancel() - { - LOGGER_WRITE( "CntParserCollector: DoCancel" ); - CloseResources(); - } -//------------------------------------------------------------ -// CCntParserCollector::RunError(TInt aError) -//------------------------------------------------------------ -TInt CCntParserCollector::RunError( TInt aError ) - { - LOGGER_WRITE( "CntParserCollector: RunError!" ); - CloseResources(); //JIC - - iServer->CompletePhoneBookRequests( aError ); //complete all requests with an error - return KErrNone; - } -//------------------------------------------------------------ -// CCntParserCollector::CurrentItem() -//------------------------------------------------------------ -TInt CCntParserCollector::CurrentItem() - { - return iCurrentItem; - } -//------------------------------------------------------------ -// CCntParserCollector::Count() -//------------------------------------------------------------ -TInt CCntParserCollector::Count() - { - return iCount; - } -//------------------------------------------------------------ -// CCntParserCollector::ContactsSaved() -//------------------------------------------------------------ -TInt CCntParserCollector::ContactsSaved() - { - return iContactsSaved; - } -//------------------------------------------------------------ -// CCntParserCollector::SaveTotalCountL() const -//------------------------------------------------------------ -void CCntParserCollector::SaveTotalCountL() - { - LOGGER_WRITE( "CntParserCollector: SaveTotalCount begin" ); - - if( iContactsDb ) - { - iTotalCount = iContactsDb->CountL(); - LOGGER_WRITE_1( "CntParserCollector: SaveTotalCount iTotalCount %d", iTotalCount ); - } - - RFs Fs; - RFile writer; - User::LeaveIfError(Fs.Connect()); //Connect to the file server - CleanupClosePushL(Fs); - - User::LeaveIfError(Fs.CreatePrivatePath( EDriveC )); - User::LeaveIfError(Fs.SetSessionToPrivate( EDriveC )); - - User::LeaveIfError(writer.Replace(Fs,KTotalCountFilePath,EFileWrite)); //Open file - CleanupClosePushL(writer); - LOGGER_WRITE( "CntParserCollector: SaveTotalCount file replaced" ); - - // Prepare externalized representation of iTotalCount - TBuf8< 256 > countData; - RDesWriteStream writeStream( countData ); - CleanupClosePushL( writeStream ); - writeStream.WriteInt32L( iTotalCount ); - writeStream.CommitL(); - CleanupStack::PopAndDestroy( &writeStream ); - - // Then write them to the file itself - User::LeaveIfError(writer.Write( countData )); - - CleanupStack::PopAndDestroy(); //writer - CleanupStack::PopAndDestroy(); //Fs - - LOGGER_WRITE( "CntParserCollector: SaveTotalCount end" ); - } -//------------------------------------------------------------ -// CCntParserCollector::ReadTotalCountL() const -//------------------------------------------------------------ -TInt CCntParserCollector::ReadTotalCountL() const - { - LOGGER_WRITE( "CntParserCollector: ReadTotalCount begin" ); - TInt total; - RFs Fs; - RFile reader; - User::LeaveIfError(Fs.Connect()); //Connect to the file server - CleanupClosePushL(Fs); - - User::LeaveIfError(Fs.CreatePrivatePath( EDriveC )); - User::LeaveIfError(Fs.SetSessionToPrivate( EDriveC )); - - User::LeaveIfError(reader.Open(Fs,KTotalCountFilePath,EFileRead)); //Open file - CleanupClosePushL(reader); - LOGGER_WRITE( "CntParserCollector: ReadTotalCount file opened" ); - - RFileReadStream readStream(reader); - readStream.PushL(); - - total = readStream.ReadInt32L(); - - LOGGER_WRITE_1( "CntParserCollector: ReadTotalCount total %d", total ); - - CleanupStack::PopAndDestroy(); //readStream - CleanupStack::PopAndDestroy(); //writer - CleanupStack::PopAndDestroy(); //Fs - LOGGER_WRITE( "CntParserCollector: ReadTotalCount end" ); - return total; - } -//------------------------------------------------------------ -// CCntParserCollector::ContactCountChanged() const -//------------------------------------------------------------ -TBool CCntParserCollector::ContactCountChanged() - { - LOGGER_WRITE( "CntParserCollector: ContactCountChanged begin" ); - TInt oldCount = 0; - TInt err( KErrNone ); - - if( iContactsDb ) - { - TRAP( err, iTotalCount = iContactsDb->CountL() ); - if ( err != KErrNone ) - { - LOGGER_WRITE_1( "iContactsDb->CountL leaved: %d", err ); - LOGGER_WRITE( "CntParserCollector: ContactCountChanged ETrue" ); - return ETrue; - } - LOGGER_WRITE_1( "CntParserCollector: ContactCountChanged iTotalCount %d", iTotalCount ); - } - - TRAP( err, oldCount = ReadTotalCountL() ); - - LOGGER_WRITE_1( "CntParserCollector: ContactCountChanged err %d", err ); - LOGGER_WRITE_1( "CntParserCollector: ContactCountChanged oldCount %d", oldCount ); - LOGGER_WRITE_1( "CntParserCollector: ContactCountChanged iTotalCount %d", iTotalCount ); - - if( err == KErrNone ) - { - if( iTotalCount != oldCount ) - { - LOGGER_WRITE( "CntParserCollector: ContactCountChanged ETrue" ); - return ETrue; - } - else - { - LOGGER_WRITE( "CntParserCollector: ContactCountChanged EFalse" ); - return EFalse; - } - } - else - { - LOGGER_WRITE( "CntParserCollector: ContactCountChanged ETrue" ); - return ETrue; - } - } - -// end of file diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/cntparser/src/cntparserinfolog.cpp --- a/connectivitymodules/SeCon/cntparser/src/cntparserinfolog.cpp Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,119 +0,0 @@ -/* -* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: CCntParserInfoLog implementation. -* -*/ - - -#include -#include -#include - -#include "cntparserinfolog.h" - -_LIT8(KNewLine,"\r\n"); - -_LIT8(KMaxRecords,"Maximum-Records:"); -_LIT8(KTotalRecords,"Total-Records:"); - -//------------------------------------------------------------ -// CCntParserInfoLog::CCntParserInfoLog() -//------------------------------------------------------------ -CCntParserInfoLog::CCntParserInfoLog() - { - } - -//------------------------------------------------------------ -// CCntParserInfoLog::~CCntParserInfoLog() -//------------------------------------------------------------ -CCntParserInfoLog::~CCntParserInfoLog() - { - } - -//------------------------------------------------------------ -// CCntParserInfoLog::CCntParserInfoLog::NewL() -//------------------------------------------------------------ -EXPORT_C CCntParserInfoLog* CCntParserInfoLog::NewL() - { - CCntParserInfoLog* self=new (ELeave) CCntParserInfoLog(); - return self; - } - -//------------------------------------------------------------ -// CCntParserInfoLog::SaveToFileL(const TDesC& aFileName) const -//------------------------------------------------------------ -EXPORT_C void CCntParserInfoLog::SaveToFileL( const TDesC& aFileName ) const - { - TInt err = KErrNone; - RFs Fs; - RFile writer; - User::LeaveIfError( Fs.Connect() ); //Connect to the file server - CleanupClosePushL( Fs ); - err = writer.Replace( Fs, aFileName, EFileWrite ); //Open file - CleanupClosePushL( writer ); - - if( err == KErrNone ) - { - writer.Write( KMaxRecords ); - - TBuf8<16> numVal; - numVal.Num( iMaximumRecords ); - writer.Write( numVal ); - - writer.Write( KNewLine ); - - writer.Write( KTotalRecords ); - - TBuf8<16> numVal2; - numVal2.Num( iTotalRecords ); - writer.Write( numVal2 ); - } - - CleanupStack::PopAndDestroy(); //writer - CleanupStack::PopAndDestroy(); //Fs - } - -//------------------------------------------------------------ -// CCntParserInfoLog::SetTotalRecords(TInt aTotalRecords) -//------------------------------------------------------------ -EXPORT_C void CCntParserInfoLog::SetTotalRecords(TInt aTotalRecords) - { - iTotalRecords = aTotalRecords; - } - -//------------------------------------------------------------ -// CCntParserInfoLog::SetMaximumRecords(TInt aMaximumRecords) -//------------------------------------------------------------ -EXPORT_C void CCntParserInfoLog::SetMaximumRecords(TInt aMaximumRecords) - { - iMaximumRecords = aMaximumRecords; - } - -//------------------------------------------------------------ -// CCntParserInfoLog::TotalRecords() const -//------------------------------------------------------------ -EXPORT_C TInt CCntParserInfoLog::TotalRecords() const - { - return iTotalRecords; - } - -//------------------------------------------------------------ -// CCntParserInfoLog::MaximumRecords() const -//------------------------------------------------------------ -EXPORT_C TInt CCntParserInfoLog::MaximumRecords() const - { - return iMaximumRecords; - } - -// end of file diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/cntparser/src/cntparserserverexe.cpp --- a/connectivitymodules/SeCon/cntparser/src/cntparserserverexe.cpp Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,322 +0,0 @@ -/* -* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: CCntParserServer implementation. -* -*/ - - -#include "clientserver.h" -#include "cntparserserver.h" -#include "cntparserserversession.h" -#include "irmcconsts.h" - -#include "debug.h" - -#include - -//------------------------------------------------------------ -// RunServer -//------------------------------------------------------------ -TInt CCntParserServer::RunServer() - { - LOGGER_ENTERFN( "CCntParserServer::RunServer" ); - - CTrapCleanup* cleanup = CTrapCleanup::New(); - TInt ret( KErrNoMemory ); - if( cleanup ) - { - TRAP( ret, CCntParserServer::RunServerL() ); - delete cleanup; - } - if( ret != KErrNone ) - { - // Signal the client that server creation failed - RProcess::Rendezvous( ret ); - } - LOGGER_LEAVEFN( "CCntParserServer::RunServer" ); - return ret; - } -//------------------------------------------------------------ -// RunServerL -//------------------------------------------------------------ -void CCntParserServer::RunServerL() - { - // Create and install the active scheduler we need - LOGGER_ENTERFN( "CCntParserServer::RunServerL" ); - CActiveScheduler *as=new (ELeave)CActiveScheduler; - CleanupStack::PushL( as ); - CActiveScheduler::Install( as ); - - // Create server - CCntParserServer::NewL(); - - // Initialisation complete, now signal the client - User::LeaveIfError( RThread().RenameMe( KTxtServer ) ); - RProcess::Rendezvous( KErrNone ); - - // Ready to run - CActiveScheduler::Start(); - - // Cleanup the scheduler - CleanupStack::PopAndDestroy( as ); - LOGGER_LEAVEFN( "CCntParserServer::RunServerL" ); - } -//------------------------------------------------------------ -// E32Main() -//------------------------------------------------------------ -TInt E32Main() - { - return CCntParserServer::RunServer(); - } -//------------------------------------------------------------ -// PanicServer(TCntParserServerPanic aPanic) -//------------------------------------------------------------ -GLDEF_C void PanicServer(TCntParserServerPanic aPanic) - { - LOGGER_WRITE( "PANIC SERVER!" ); - _LIT(KTxtServerPanic,"Parser server panic"); - User::Panic( KTxtServerPanic, aPanic ); - } - - -//********************************** -//CCntParserServer -//********************************** - -//------------------------------------------------------------ -// CCntParserServer::CCntParserServer() -//------------------------------------------------------------ -CCntParserServer::CCntParserServer() : CServer2( EPriorityStandard ) - { - } -//------------------------------------------------------------ -// CCntParserServer::~CCntParserServer() -//------------------------------------------------------------ -EXPORT_C CCntParserServer::~CCntParserServer() - { - if( iCollector ) - { - iCollector->Cancel(); - } - delete iCollector; - delete iCurrentDatabase; - LOGGER_WRITE( "CntParserServer: DELETED!" ); - } -//------------------------------------------------------------ -// CCntParserServer* CCntParserServer::NewL() -//------------------------------------------------------------ -EXPORT_C CCntParserServer* CCntParserServer::NewL() - { - LOGGER_WRITE( "CntParserServer: NEW" ); - CCntParserServer* pS=new (ELeave) CCntParserServer(); - CleanupStack::PushL(pS); - pS->StartL( KCntParserName ); - CleanupStack::Pop( pS ); - LOGGER_WRITE( "CntParserServer: Created" ); - return pS; - } -//------------------------------------------------------------ -// CCntParserServer::NewSessionL(const TVersion &aVersion, const RMessage2& /*aMsg*/) const -//------------------------------------------------------------ -CSession2* CCntParserServer::NewSessionL(const TVersion &aVersion, const RMessage2& /*aMsg*/) const - { - LOGGER_WRITE( "CntParserServer: NEW SessionL" ); - // check we're the right version - TVersion v( KCntParserMajorVersionNumber,KCntParserMinorVersionNumber,KCntParserBuildVersionNumber ); - if ( !User::QueryVersionSupported( v,aVersion ) ) - User::Leave( KErrNotSupported ); - CCntParserServerSession* self=CCntParserServerSession::NewL( (CCntParserServer*)this ); - return self; - } -//------------------------------------------------------------ -// CCntParserServer::IncreaseSessionCountL() -//------------------------------------------------------------ -void CCntParserServer::IncreaseSessionCountL() - { - LOGGER_WRITE( "CntParserServer: Increase Session Count" ); - iSessionCount++; - if( iSessionCount == 1 ) //If first session, prepare collector - { - PrepareCollectorL(); - } - } -//------------------------------------------------------------ -// CCntParserServer::DecreaseSessionCount() -//------------------------------------------------------------ -void CCntParserServer::DecreaseSessionCount() - { - LOGGER_WRITE( "CntParserServer: Decrease Session Count" ); - iSessionCount--; - if( iSessionCount==0 ) //if last session is disconnected, delete server - { - Stop(); - } - } -//------------------------------------------------------------ -// CCntParserServer::ContactsParsed() -//------------------------------------------------------------ -TInt CCntParserServer::ContactsParsed() - { - return iCollector->CurrentItem(); - } -//------------------------------------------------------------ -// CCntParserServer::TotalNumOfContacts() -//------------------------------------------------------------ -TInt CCntParserServer::TotalNumOfContacts() - { - //After the PrepareCollector is called, the number of contacts can be returned - return iCollector->Count(); - } -//------------------------------------------------------------ -// CCntParserServer::ContactsSaved() -//------------------------------------------------------------ -TInt CCntParserServer::ContactsSaved() - { - return iCollector->ContactsSaved(); - } -//------------------------------------------------------------ -// CCntParserServer::PrepareCollectorL() -//------------------------------------------------------------ -void CCntParserServer::PrepareCollectorL() - { - LOGGER_WRITE( "CntParserServer: Prepare collectorL: Open Contact Database" ); - - TFileName dbFile; - TFileName defaultDb; - - CContactDatabase::GetDefaultNameL( defaultDb ); - - LOGGER_WRITE( "CntParserServer: Prepare collectorL: GetDefault" ); - - iCurrentDatabase=CContactDatabase::OpenL(); - - LOGGER_WRITE( "CntParserServer: Prepare collectorL: OpenDefault" ); - - iCurrentDatabase->GetCurrentDatabase( dbFile ); //Get selected database - - LOGGER_WRITE( "CntParserServer: Prepare collectorL: CompareDefault" ); - - if( dbFile.CompareF(defaultDb)!=0 && dbFile!=KNullDesC16 /*&& dbFile.CompareF(KSimDummyDatabase)!=0*/) //If the selected database is not the default and something is selected - { - LOGGER_WRITE( "CntParserServer: Prepare collectorL: Close Default" ); - delete iCurrentDatabase; - iCurrentDatabase = NULL; - - LOGGER_WRITE( "CntParserServer: Prepare collectorL: OpenSelected" ); - iCurrentDatabase=CContactDatabase::OpenL( dbFile ); //open the selected one - } - - LOGGER_WRITE( "CntParserServer: Prepare collectorL: Is everything ok?" ); - if( !iCurrentDatabase ) - { - User::Leave( KErrNotFound ); - } - - LOGGER_WRITE( "CntParserServer: Prepare collectorL: Create Collector" ); - iCollector = CCntParserCollector::NewL( this,iCurrentDatabase ); - - iRequests = 0; - } -//------------------------------------------------------------ -// CCntParserServer::CreateIrMCL2PhoneBookL() -//------------------------------------------------------------ -TInt CCntParserServer::CreateIrMCL2PhoneBookL(const TDesC& path, TInt aMaxNumberOfContacts,TBool aForced) - { - LOGGER_WRITE( "CntParserServer: CreateIrMCL2PhoneBookL" ); - - TInt err( KErrNone ); - - iRequests++; - if( iRequests == 1 ) - { - LOGGER_WRITE( "CntParserServer: CreateIrMCL2PhoneBookL: Ready to call collector" ); - - err = iCollector->CreateIrMCL2FileL( path,aMaxNumberOfContacts,aForced ); - if( err==KPBNotUpdated ) - { - iRequests = 0; //If the file exists (no parsing), then more requests can be made - } - } - else - { - return KErrNotReady; - } - return err; - } -//------------------------------------------------------------ -// CCntParserServer::CompletePhoneBookRequests() -//------------------------------------------------------------ -void CCntParserServer::CompletePhoneBookRequests(TInt aErr) //Goes through all the sessions and completes the request - { - LOGGER_WRITE( "CntParserServer: Complete phonebook request" ); - iSessionIter.SetToFirst(); - while( iSessionIter!=NULL ) //Go through all sessions - { - ( (CCntParserServerSession*) (iSessionIter++) )->CompletePhoneBookRequest( aErr ); - } - iRequests = 0; //Collector is ready to start again.. - } -//------------------------------------------------------------ -// CCntParserServer::CancelPhoneBookRequest() -//------------------------------------------------------------ -void CCntParserServer::CancelPhoneBookRequest() - { - if( iRequests == 1 ) - { - iCollector->Cancel(); - } - iRequests--; - } -//------------------------------------------------------------ -// CCntParserServer::CancelAllPhoneBookRequests() -//------------------------------------------------------------ -void CCntParserServer::CancelAllPhoneBookRequests() - { - iCollector->Cancel(); - iRequests = 0; - } -//------------------------------------------------------------ -// CCntParserServer::Disconnect() -//------------------------------------------------------------ -void CCntParserServer::Disconnect() - { - LOGGER_WRITE( "CntParserServer: Disconnect" ); - } -//------------------------------------------------------------ -// CCntParserServer::Stop() -//------------------------------------------------------------ -void CCntParserServer::Stop() - { - LOGGER_ENTERFN( "CntParserServer::Stop()" ); - if( iCollector ) - { - iCollector->Cancel(); - } - delete iCollector; - iCollector = NULL; - delete iCurrentDatabase; - iCurrentDatabase = NULL; - CActiveScheduler::Stop(); - LOGGER_LEAVEFN( "CntParserServer::Stop()" ); - } -//------------------------------------------------------------ -// CCntParserServer::SetRequests() -//------------------------------------------------------------ -void CCntParserServer::SetRequests(TInt aRequests) - { - iRequests=aRequests; - } - - - diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/cntparser/src/cntparserserversession.cpp --- a/connectivitymodules/SeCon/cntparser/src/cntparserserversession.cpp Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,219 +0,0 @@ -/* -* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: CCntParserServerSession implementation. -* -*/ - - -#include "cntparserserversession.h" -#include -#include "cntparsercollector.h" -#include "cntparserinfolog.h" -#include "irmcconsts.h" - -#include "debug.h" - -//------------------------------------------------------------ -// CCntParserServerSession::CCntParserServerSession() -//------------------------------------------------------------ -CCntParserServerSession::CCntParserServerSession() - { - } -//------------------------------------------------------------ -// CCntParserServerSession::NewL(CCntParserServer* aServer) -//------------------------------------------------------------ -CCntParserServerSession* CCntParserServerSession::NewL( CCntParserServer* aServer ) - { - LOGGER_ENTERFN( "CntParserServerSession::NewL()" ); - - CCntParserServerSession* self = new( ELeave ) CCntParserServerSession(); - CleanupStack::PushL( self ); - self->ConstructL( aServer ); - CleanupStack::Pop( self ); - LOGGER_LEAVEFN( "CntParserServerSession::NewL()" ); - return self; - } -//------------------------------------------------------------ -// CCntParserServerSession::ConstructL( CCntParserServer* aServer ) -//------------------------------------------------------------ -void CCntParserServerSession::ConstructL( CCntParserServer* aServer ) - { - iContactsParserSrv = aServer; - iContactsParserSrv->IncreaseSessionCountL(); - } -//------------------------------------------------------------ -// CCntParserServerSession::~CCntParserServerSession() -//------------------------------------------------------------ -CCntParserServerSession::~CCntParserServerSession() - { - LOGGER_ENTERFN( "CntParserServerSession::~CCntParserServerSession()" ); - if ( iContactsParserSrv ) - { - iContactsParserSrv->DecreaseSessionCount(); - } - LOGGER_LEAVEFN( "CntParserServerSession::~CCntParserServerSession()" ); - } -//------------------------------------------------------------ -// CCntParserServerSession::ServiceL( const RMessage2& aMessage ) -//------------------------------------------------------------ -void CCntParserServerSession::ServiceL( const RMessage2& aMessage ) - { - LOGGER_WRITE( "CntParserServerSession: ServiceL" ); - - TInt err( KErrNone ); - TInt ret( KErrNone ); - - TRAP( err, ret = DispatchMessageL( aMessage ) ); - - if ( err != KErrNone ) - { - LOGGER_WRITE_1( "CntParserServerSession: ServiceL: Error trapped, complete with ERR code %d", err ); - - iPhoneBookRequest = EFalse; //If requested, then clear request flag - iContactsParserSrv->SetRequests( 0 ); //Reset requests count in server to allow new requests to start.. - aMessage.Complete( err ); //If trap error, complete with it - return; - } - - if ( ret == KErrNone ) - { - LOGGER_WRITE( "CntParserServerSession: ServiceL: No complete" ); - return; - } - - if ( ret == KPerformComplete ) - { - LOGGER_WRITE( "CntParserServerSession: ServiceL: Normal complete" ); - - aMessage.Complete( KErrNone ); - return; - } - - if ( ret == KPBNotUpdated ) - { - LOGGER_WRITE( "CntParserServerSession: ServiceL: Complete (PB not updated)" ); - - iPhoneBookRequest = EFalse; - aMessage.Complete( KPBNotUpdated ); - return; - } - LOGGER_WRITE( "CntParserServerSession: ServiceL: Error, should never come here" ); - aMessage.Complete( KErrGeneral ); - } -//------------------------------------------------------------ -// CCntParserServerSession::CompletePhoneBookRequest( TInt aErr ) -//------------------------------------------------------------ -void CCntParserServerSession::CompletePhoneBookRequest( TInt aErr ) - { - LOGGER_WRITE( "CntParserServerSession: CompletePhoneBookRequest" ); - - if ( iPhoneBookRequest ) //If this session has requested phonebook, then the completion should be done here, as it was not done in ServiceL - { - LOGGER_WRITE( "CntParserServerSession: CompletePhoneBookRequest: collector or cancel" ); - iPhoneBookRequest = EFalse; - iPhoneBookRequestMessage.Complete( aErr ); - } - else - { - LOGGER_WRITE( "CntParserServerSession: CompletePhoneBookRequest: No complete for this session" ); - } - } -//------------------------------------------------------------ -// CCntParserServerSession::DispatchMessageL( const RMessage2 &aMessage ) -//------------------------------------------------------------ -TInt CCntParserServerSession::DispatchMessageL( const RMessage2 &aMessage ) - { - LOGGER_WRITE( "CntParserServerSession: DispatchMessageL" ); - - TInt res( KPerformComplete ); - - switch( aMessage.Function() ) - { - case ECntParserServerCreateIrMCL2: //Create pb.vcf file - { - res = ETrue; - - if ( iPhoneBookRequest == EFalse ) - { - iPhoneBookRequestMessage = aMessage; - iPhoneBookRequest = ETrue; - - TInt sid=aMessage.SecureId(); - TInt MaxNumOfContacts = aMessage.Int0(); - TBool Forced = aMessage.Int1(); - TBuf<8> sidLit; - sidLit.AppendNumFixedWidth( sid, EHex, 8); - TBuf<255> path; - path.Insert( 0, KPhoneBookFilename ); - - res = iContactsParserSrv->CreateIrMCL2PhoneBookL( path, (TInt) MaxNumOfContacts, Forced ); - } - break; - } - case ECntParserServerCntParsed: //How many contacts already parsed - { - TPckgBuf p((TInt) iContactsParserSrv->ContactsParsed()); - aMessage.WriteL( 0, p, 0 ); - break; - } - case ECntParserServerTotalNumOfContacts: //How many contacts total? - { - TPckgBuf p((TInt) iContactsParserSrv->TotalNumOfContacts()); - aMessage.WriteL( 0, p, 0 ); - break; - } - case ECntParserServerDisconnect: //Disconnect session from server - { - iContactsParserSrv->Disconnect(); - break; - } - case ECntParserServerCancel: //Cancel phone book request - { - if (iPhoneBookRequest) - { - iContactsParserSrv->CancelPhoneBookRequest(); - CompletePhoneBookRequest( KErrCancel ); - } - break; - } - case ECntParserServerCntSaved: //How many contacts total? - { - TPckgBuf p((TInt) iContactsParserSrv->ContactsSaved()); - aMessage.WriteL( 0, p, 0 ); - break; - } - case ECntParserServerCancelAll: //Cancel all requests, not just current? - { - iContactsParserSrv->CancelAllPhoneBookRequests(); - break; - } - // requests we don't understand - // so panic the client here, this function also completes the message - default: - { - PanicClient( EBadRequest ); - break; - } - } - return res; - } -//------------------------------------------------------------ -// CCntParserServerSession::PanicClient(TInt aPanic) const -//------------------------------------------------------------ -void CCntParserServerSession::PanicClient(TInt aPanic) const - { - User::Panic( KTxtServer,aPanic ); - } - -// end of file diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/common/conmltask/inc/sconconmltask.h --- a/connectivitymodules/SeCon/common/conmltask/inc/sconconmltask.h Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,597 +0,0 @@ -/* -* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Header file for ConML tasks -* -*/ - - -#ifndef _SCONCONMLTASK_H_ -#define _SCONCONMLTASK_H_ - -#include -#include - -const TInt KSConTaskPartiallyCompleted( 206 ); -const TInt KMaxPackageNameLength = 128; - -enum TSConMethodName - { - ECancel = 0, - EGetDataOwnerStatus, - EGetDataSize, - EGetStatus, - EInstall, - EListDataOwners, - EListInstalledApps, - EListPublicFiles, - ERequestData, - ESetBURMode, - ESetInstParams, - ESupplyData, - EUninstall, - EUpdateDeviceInfo, - EReboot, - EGetMetadata - }; - -enum TSConInstallMode - { - ESilentInstall = 0, - EUnsilentInstall, - EUnknown - }; - -enum TSConUserPerm - { - EPermReadOnly = 0, - EPermNormal - }; - -enum TSConDOType - { - EActiveDataOwner = 1, - EPassiveDataOwner, - EHybridDataOwner - }; - -enum TSConHasFiles - { - ENoFiles = 0, - EPublicFiles, - ESystemFiles, - EPublicSystemFiles - }; - -enum TSConAppType - { - ESisApplication = 0, - ESisAugmentation, - EJavaApplication, - EWidgetApplication - }; - -enum TSConBurMode - { - ESConBurNormal = 1, // 1 BUR mode - normal - ESConBurBackupFull, // 2 BUR mode – backup full - ESConBurBackupPartial, // 3 BUR mode – backup partial - ESConBurRestoreFull, // 4 BUR mode – restore full - ESConBurRestorePartial // 5 BUR mode – restore partial - }; - -enum TSConIncType - { - ESConNoBackup = 0, // 0 No backup - ESConBackupBase = 100, // 100 Backup – base - ESConBackupIncrement = 200 // 200 Backup - increment - }; - -enum TSConTransferDataType - { - ESConRegistrationData = 1, // 1 RegistrationData - ESConPassiveSnapshotData, // 2 Passive snapshot data - ESConPassiveBaseData, // 3 Passive base data - ESConPassiveIncrementalData,// 4 Passive incremental data - ESConActiveSnapshotData, // 5 Active snapshot data - ESConActiveBaseData, // 6 Active base data - ESConActiveIncrementalData, // 7 Active incremental data - ESConSystemData, // 8 System data - ESConSystemSnapshotData // 9 System snapshot data - }; - -enum TSConDataOwnerStatus - { - ESConUnset = 0, // 0 Unset - ESConNotFound, // 1 Not found - ESConReady, // 2 Ready - ESConNotReady, // 3 Not ready - ESConFailed, // 4 Failed - ESConNotConnected, // 5 Not connected - ESConNotImplemented // 6 Not implemented - }; - - - - -//============================================================ -// class CSConReboot declaration -//============================================================ -NONSHARABLE_CLASS( CSConReboot ) : public CBase - { - public: - CSConReboot(); - ~CSConReboot(); - CSConReboot* CopyL(); - - //used only with reply - TBool iComplete; //task complete - TInt iProgress; //task progress - }; - -//============================================================ -// class CSConDataOwner declaration -//============================================================ -NONSHARABLE_CLASS( CSConDataOwner ) : public CBase - { - public: - CSConDataOwner(); - ~CSConDataOwner(); - CSConDataOwner* CopyL(); - - public: - //dataowner type - TSConDOType iType; - //unique identifier - TUid iUid; - //drive list - TDriveList iDriveList; - //package name - TBuf iPackageName; - //requires reboot - TBool iReqReboot; - //has files - TSConHasFiles iHasFiles; - //supports incremental backup - TBool iSupportsInc; - //supports selective backup - TBool iSupportsSel; - //delay to prepare data - TBool iDelayToPrep; - //size - TUint iSize; - //data owner status - TSConDataOwnerStatus iDataOwnStatus; - //transfer data type - TSConTransferDataType iTransDataType; - //Java hash - HBufC* iJavaHash; - }; - -//============================================================ -// class CSConUpdateDeviceInfo declaration -//============================================================ -NONSHARABLE_CLASS( CSConUpdateDeviceInfo ) : public CBase - { - public: - CSConUpdateDeviceInfo(); - ~CSConUpdateDeviceInfo(); - CSConUpdateDeviceInfo* CopyL(); - - TBuf8<3> iVersion; //version number - TBool iInstallSupp; - TBool iUninstallSupp; - TBool iInstParamsSupp; - TBool iInstAppsSupp; - TBool iDataOwnersSupp; - TBool iSetBURModeSupp; - TBool iGetSizeSupp; - TBool iReqDataSupp; - TBool iSupplyDataSupp; - TBool iRebootSupp; - TInt iMaxObjectSize; //kBytes - - //used only with reply - TBool iComplete; //task complete - TInt iProgress; //task progress - }; -//============================================================ -// class CSConInstApp declaration -//============================================================ -NONSHARABLE_CLASS( CSConInstApp ) : public CBase - { - public: - CSConInstApp() {}; - ~CSConInstApp() {}; - CSConInstApp* CopyL(); - - TFileName iName; - TFileName iParentName; - TFileName iVendor; - TFileName iVersion; - TInt64 iSize; - TSConAppType iType; - TUid iUid; - }; - -//============================================================ -// class CSConListInstApps declaration -//============================================================ -NONSHARABLE_CLASS( CSConListInstApps ) : public CBase - { - public: - CSConListInstApps(); - ~CSConListInstApps(); - CSConListInstApps* CopyL(); - - TBool iAllApps; //list all apps - TDriveList iDriveList; //drive list - - //used only with reply - TBool iComplete; //task complete - TInt iProgress; //task progress - - RPointerArray iApps; //installed apps - }; - -//============================================================ -// class CSConGetStatus declaration -//============================================================ -NONSHARABLE_CLASS( CSConGetStatus ) : public CBase - { - public: - TBool iAll; //list all statuses - TInt iTaskId; //task id - }; - -//============================================================ -// class CSConFile declaration -//============================================================ -NONSHARABLE_CLASS( CSConFile ) : public CBase - { - public: - CSConFile(); - ~CSConFile(); - CSConFile* CopyL(); - - TFileName iPath; //file path + name - TBuf iModified; //modified date - TUint iSize; //file size - TSConUserPerm iUserPerm; //user permission - }; - -//============================================================ -// class CSConInstall declaration -//============================================================ -NONSHARABLE_CLASS( CSConInstall ) : public CBase - { - public: - CSConInstall(); - ~CSConInstall(); - - CSConInstall* CopyL(); - - TFileName iPath; //path to file - TSConInstallMode iMode; //install mode - - //used only with reply - TBool iComplete; //task complete - TInt iProgress; //task progress - }; - -//============================================================ -// class CSConUninstall declaration -//============================================================ -NONSHARABLE_CLASS( CSConUninstall ) : public CBase - { - public: - CSConUninstall(); - ~CSConUninstall(); - - CSConUninstall* CopyL(); - - TFileName iName; // application name - TFileName iVendor; // application vendor - TUid iUid; // application uid - TSConAppType iType; // application type - TSConInstallMode iMode; // install mode - - //used only with reply - TBool iComplete; //task complete - TInt iProgress; //task progress - }; - -//============================================================ -// class CSConListDataOwners declaration -//============================================================ -NONSHARABLE_CLASS( CSConListDataOwners ) : public CBase - { - public: - CSConListDataOwners(); - ~CSConListDataOwners(); - CSConListDataOwners* CopyL(); - void DeleteDataOwners(); - - //used only with reply - TBool iComplete; //task complete - TInt iProgress; //task progress - - RPointerArray iDataOwners; //data owners - }; - -//============================================================ -// class CSConSetBURMode declaration -//============================================================ -NONSHARABLE_CLASS( CSConSetBURMode ) : public CBase - { - public: - TDriveList iDriveList; //drive list - TSConBurMode iPartialType; //partial backup type - TSConIncType iIncType; //incremental backup type - - CSConSetBURMode(); - ~CSConSetBURMode(); - CSConSetBURMode* CopyL(); - - //used only with reply - TBool iComplete; //task complete - TInt iProgress; //task progress - }; - -//============================================================ -// class CSConGetDataSize declaration -//============================================================ -NONSHARABLE_CLASS( CSConGetDataSize ) : public CBase - { - public: - CSConGetDataSize(); - ~CSConGetDataSize(); - - CSConGetDataSize* CopyL(); - void DeleteDataOwners(); - - public: - RPointerArray iDataOwners; //data owners - - //used only with reply - TBool iComplete; //task complete - TInt iProgress; //task progress - }; - -//============================================================ -// class CSConListPublicFiles declaration -//============================================================ -NONSHARABLE_CLASS( CSConListPublicFiles ) : public CBase - { - public: - CSConListPublicFiles(); - ~CSConListPublicFiles(); - CSConListPublicFiles* CopyL(); - - public: - RPointerArray iFiles; //data owners - RPointerArray iDataOwners; //data owners - - //used only with reply - TBool iComplete; //task complete - TInt iProgress; //task progress - }; - -//============================================================ -// class CSConRequestData declaration -//============================================================ -NONSHARABLE_CLASS( CSConRequestData ) : public CBase - { - public: - CSConRequestData(); - ~CSConRequestData(); - CSConRequestData* CopyL(); - void DeleteDataAndDataOwner(); - - CSConDataOwner* iDataOwner; //data owner - HBufC8* iBackupData; //backup data - TBool iMoreData; //more data - - //used only with reply - TBool iComplete; //task complete - TInt iProgress; //task progress - }; - -//============================================================ -// class CSConGetDataOwnerStatus declaration -//============================================================ -NONSHARABLE_CLASS( CSConGetDataOwnerStatus ) : public CBase - { - public: - CSConGetDataOwnerStatus(); - ~CSConGetDataOwnerStatus(); - CSConGetDataOwnerStatus* CopyL(); - void DeleteDataOwners(); - - public: - RPointerArray iDataOwners; //data owners - - //used only with reply - TBool iComplete; //task complete - TInt iProgress; //task progress - }; - -//============================================================ -// class CSConSupplyData declaration -//============================================================ -NONSHARABLE_CLASS( CSConSupplyData ) : public CBase - { - public: - CSConSupplyData(); - ~CSConSupplyData(); - CSConSupplyData* CopyL(); - public: - CSConDataOwner* iDataOwner; - HBufC8* iRestoreData; //restore data - TBool iMoreData; //more data - //used only with reply - TBool iComplete; //task complete - TInt iProgress; //task progress - }; - -//============================================================ -// class CSConGetMetadata declaration -//============================================================ -NONSHARABLE_CLASS( CSConGetMetadata ) : public CBase - { - public: - CSConGetMetadata(); - ~CSConGetMetadata(); - CSConGetMetadata* CopyL(); - public: - TFileName iFilename; - HBufC8* iData; //metadata - TBool iMoreData; //more data - //used only with reply - TBool iComplete; //task complete - TInt iProgress; //task progress - }; - -//============================================================ -// class CSConTask declaration -//============================================================ -NONSHARABLE_CLASS( CSConTask ): public CBase - { - public: - /** - * Two-phase constructor - * @return CSConTask instance - */ - static CSConTask* NewL( TSConMethodName aMethod ); - static CSConTask* NewLC( TSConMethodName aMethod ); - - CSConTask(); - ~CSConTask(); - TSConMethodName GetServiceId() const; - CSConTask* CopyL() const; - TBool GetComplete(); - void SetCompleteValue( TBool aValue ); - TBool GetCompleteValue(); - void SetProgressValue( TInt aValue ); - private: - - void ConstructL( TSConMethodName aMethod ); - public: - //Task - //service id - TSConMethodName iMethod; - //task number - TInt iTaskId; - - //DeviceInfo -params - CSConUpdateDeviceInfo* iDevInfoParams; - //ListInstalledTasks -params - CSConListInstApps* iListAppsParams; - //GetStatus -params - CSConGetStatus* iGetStatusParams; - //Install -params - CSConInstall* iInstallParams; - //Uninstall -params - CSConUninstall* iUninstallParams; - //SetBURMode -params - CSConSetBURMode* iBURModeParams; - //GetDataSize -params - CSConGetDataSize* iGetDataSizeParams; - //RequestData -params - CSConRequestData* iRequestDataParams; - //GetDataOwnerStatus -params - CSConGetDataOwnerStatus* iGetDataOwnerParams; - //SupplyData -params - CSConSupplyData* iSupplyDataParams; - //ListPublicFiles -params - CSConListPublicFiles* iPubFilesParams; - //ListDataOwners -params - CSConListDataOwners* iListDataOwnersParams; - //Reboot -params - CSConReboot* iRebootParams; - //GetMetadata -params - CSConGetMetadata* iGetMetadataParams; - - TInt iCancelTaskId; - TBool iCancelTaskAll; - }; - -//============================================================ -// class CSConTaskReply declaration -//============================================================ -NONSHARABLE_CLASS( CSConTaskReply ) : public CBase - { - public: - CSConTaskReply(); - CSConTaskReply( TSConMethodName aMethod ); - ~CSConTaskReply(); - void InitializeL( const CSConTask& aTask ); - void InitializeL( TSConMethodName aMethod, - TInt aProgress, TBool aComplete ); - CSConTaskReply* CopyAndFreeL(); - void CleanTaskData(); - - public: - //task id number - TInt iTaskId; - //method type - TSConMethodName iMethod; - - //DeviceInfo -params - CSConUpdateDeviceInfo* iDevInfoParams; - //ListInstalledTasks -params - CSConListInstApps* iListAppsParams; - //GetStatus -params - CSConGetStatus* iGetStatusParams; - //Install -params - CSConInstall* iInstallParams; - //Uninstall -params - CSConUninstall* iUninstallParams; - //SetBURMode -params - CSConSetBURMode* iBURModeParams; - //GetDataSize -params - CSConGetDataSize* iGetDataSizeParams; - //RequestData -params - CSConRequestData* iRequestDataParams; - //GetDataOwnerStatus -params - CSConGetDataOwnerStatus* iGetDataOwnerParams; - //SupplyData -params - CSConSupplyData* iSupplyDataParams; - //ListPublicFiles -params - CSConListPublicFiles* iPubFilesParams; - //ListDataOwners -params - CSConListDataOwners* iListDataOwnersParams; - //Reboot -params - CSConReboot* iRebootParams; - //GetMetadata -params - CSConGetMetadata* iGetMetadataParams; - }; - -//============================================================ -// class CSConStatusReply declaration -//============================================================ -NONSHARABLE_CLASS( CSConStatusReply ): public CBase - { - public: - CSConStatusReply(); - ~CSConStatusReply(); - - public: - TBool iNoTasks; //no active tasks - RPointerArray iTasks; - }; - -#endif - -// End of file - diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/common/conmltask/src/sconconmltask.cpp --- a/connectivitymodules/SeCon/common/conmltask/src/sconconmltask.cpp Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1684 +0,0 @@ -/* -* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: ConML Task implementations -* -*/ - - -// INCLUDE FILES - -#include "sconconmltask.h" - -// ----------------------------------------------------------------------------- -// CSConReboot::CSConReboot() -// -// ----------------------------------------------------------------------------- -// -CSConReboot::CSConReboot() : iComplete( EFalse ), iProgress( 0 ) - { - } - -// ----------------------------------------------------------------------------- -// CSConReboot::~CSConReboot() -// -// ----------------------------------------------------------------------------- -// -CSConReboot::~CSConReboot() - { - } - -// ----------------------------------------------------------------------------- -// CSConReboot::Copy() -// -// ----------------------------------------------------------------------------- -// -CSConReboot* CSConReboot::CopyL() - { - CSConReboot* copy = new (ELeave) CSConReboot(); - copy->iComplete = iComplete; - copy->iProgress = iProgress; - return copy; - } - -// ----------------------------------------------------------------------------- -// CSConDataOwner::CSConDataOwner() -// -// ----------------------------------------------------------------------------- -// -CSConDataOwner::CSConDataOwner() - { - iHasFiles = ENoFiles; - iJavaHash = NULL; - iUid.iUid = 0; - - //Initialize iDriveList with zeros - iDriveList.Fill( '\x0' ); - } - -// ----------------------------------------------------------------------------- -// CSConDataOwner::~CSConDataOwner() -// -// ----------------------------------------------------------------------------- -// -CSConDataOwner::~CSConDataOwner() - { - delete iJavaHash; - iJavaHash = NULL; - } - -// ----------------------------------------------------------------------------- -// CSConDataOwner::Copy() -// -// ----------------------------------------------------------------------------- -// -CSConDataOwner* CSConDataOwner::CopyL() - { - CSConDataOwner* copy = new (ELeave) CSConDataOwner(); - copy->iType = iType; - copy->iUid = iUid; - copy->iDriveList.Copy( iDriveList ); - copy->iPackageName = iPackageName; - copy->iReqReboot = iReqReboot; - copy->iHasFiles = iHasFiles; - copy->iSupportsInc = iSupportsInc; - copy->iSupportsSel = iSupportsSel; - copy->iDelayToPrep = iDelayToPrep; - copy->iSize = iSize; - copy->iDataOwnStatus = iDataOwnStatus; - copy->iTransDataType = iTransDataType; - - if ( iJavaHash ) - { - if ( copy->iJavaHash ) - { - delete copy->iJavaHash; - copy->iJavaHash = NULL; - } - copy->iJavaHash = iJavaHash->Alloc(); - } - - return copy; - } - -// ----------------------------------------------------------------------------- -// CSConUpdateDeviceInfo::CSConUpdateDeviceInfo() -// -// ----------------------------------------------------------------------------- -// -CSConUpdateDeviceInfo::CSConUpdateDeviceInfo() : - iInstallSupp(EFalse), iUninstallSupp(EFalse), - iInstParamsSupp(EFalse), iInstAppsSupp(EFalse), - iDataOwnersSupp(EFalse), iSetBURModeSupp(EFalse), - iGetSizeSupp(EFalse), iReqDataSupp(EFalse), - iSupplyDataSupp(EFalse), iRebootSupp(EFalse), - iComplete( EFalse ), iProgress( 0 ) - { - } - -// ----------------------------------------------------------------------------- -// CSConUpdateDeviceInfo::~CSConUpdateDeviceInfo() -// -// ----------------------------------------------------------------------------- -// -CSConUpdateDeviceInfo::~CSConUpdateDeviceInfo() - { - } - -// ----------------------------------------------------------------------------- -// CSConUpdateDeviceInfo::Copy() -// -// ----------------------------------------------------------------------------- -// -CSConUpdateDeviceInfo* CSConUpdateDeviceInfo::CopyL() - { - CSConUpdateDeviceInfo* copy = new (ELeave) CSConUpdateDeviceInfo(); - copy->iVersion.Copy( iVersion ); - copy->iInstallSupp = iInstallSupp; - copy->iUninstallSupp = iUninstallSupp; - copy->iInstParamsSupp = iInstParamsSupp; - copy->iInstAppsSupp = iInstAppsSupp; - copy->iDataOwnersSupp = iDataOwnersSupp; - copy->iSetBURModeSupp = iSetBURModeSupp; - copy->iGetSizeSupp = iGetSizeSupp; - copy->iReqDataSupp = iReqDataSupp; - copy->iSupplyDataSupp = iSupplyDataSupp; - copy->iMaxObjectSize = iMaxObjectSize; - copy->iRebootSupp = iRebootSupp; - copy->iComplete = iComplete; - copy->iProgress = iProgress; - - return copy; - } - -// ----------------------------------------------------------------------------- -// CSConInstApp::Copy() -// -// ----------------------------------------------------------------------------- -// -CSConInstApp* CSConInstApp::CopyL() - { - CSConInstApp* copy = new (ELeave) CSConInstApp(); - - copy->iName.Copy( iName ); - copy->iParentName.Copy( iParentName ); - copy->iVendor.Copy( iVendor ); - copy->iVersion.Copy( iVersion ); - copy->iSize = iSize; - copy->iType = iType; - copy->iUid = iUid; - - return copy; - } - -// ----------------------------------------------------------------------------- -// CSConListInstApps::CSConListInstApps() -// -// ----------------------------------------------------------------------------- -// -CSConListInstApps::CSConListInstApps() : iComplete( EFalse ), iProgress( 0 ) - { - //Initialize iDriveList with zeros - iDriveList.Fill( '\x0' ); - } - -// ----------------------------------------------------------------------------- -// CSConListInstApps::~CSConListInstApps() -// -// ----------------------------------------------------------------------------- -// -CSConListInstApps::~CSConListInstApps() - { - iApps.ResetAndDestroy(); - iApps.Close(); - } - -// ----------------------------------------------------------------------------- -// CSConListInstApps::CopyL() -// -// ----------------------------------------------------------------------------- -// -CSConListInstApps* CSConListInstApps::CopyL() - { - CSConListInstApps* copy = new (ELeave) CSConListInstApps(); - copy->iAllApps = iAllApps; - copy->iDriveList = iDriveList; - - copy->iComplete = iComplete; - copy->iProgress = iProgress; - - for( TInt i = 0; i < iApps.Count(); i++ ) - { - copy->iApps.Append( iApps[i]->CopyL() ); - } - - return copy; - } - -// ----------------------------------------------------------------------------- -// CSConFile::CSConFile -// -// ----------------------------------------------------------------------------- -// -CSConFile::CSConFile() - { - } - -// ----------------------------------------------------------------------------- -// CSConFile::~CSConFile -// -// ----------------------------------------------------------------------------- -// -CSConFile::~CSConFile() - { - - } - -// ----------------------------------------------------------------------------- -// CSConFile::Copy() -// -// ----------------------------------------------------------------------------- -// -CSConFile* CSConFile::CopyL() - { - CSConFile* copy = new (ELeave) CSConFile(); - - copy->iPath.Copy( iPath ); - copy->iModified.Copy( iModified ); - copy->iSize = iSize; - copy->iUserPerm = iUserPerm; - - return copy; - } - -// ----------------------------------------------------------------------------- -// CSConInstall::CSConInstall() -// -// ----------------------------------------------------------------------------- -// -CSConInstall::CSConInstall() : iMode( EUnknown ), iComplete( EFalse ), iProgress( 0 ) - { - } - -// ----------------------------------------------------------------------------- -// CSConInstall::~CSConInstall() -// -// ----------------------------------------------------------------------------- -// -CSConInstall::~CSConInstall() - { - } - -// ----------------------------------------------------------------------------- -// CSConInstall::CopyL() -// -// ----------------------------------------------------------------------------- -// -CSConInstall* CSConInstall::CopyL() - { - CSConInstall* copy = new (ELeave) CSConInstall(); - copy->iPath = iPath; - copy->iMode = iMode; - - copy->iComplete = iComplete; - copy->iProgress = iProgress; - - return copy; - } - -// ----------------------------------------------------------------------------- -// CSConUninstall::CSConUninstall() -// -// ----------------------------------------------------------------------------- -// -CSConUninstall::CSConUninstall() : iMode( EUnknown ), iComplete( EFalse ), iProgress( 0 ) - { - } - -// ----------------------------------------------------------------------------- -// CSConUninstall::~CSConUninstall() -// -// ----------------------------------------------------------------------------- -// -CSConUninstall::~CSConUninstall() - { - } - -// ----------------------------------------------------------------------------- -// CSConUninstall::Copy() -// -// ----------------------------------------------------------------------------- -// -CSConUninstall* CSConUninstall::CopyL() - { - CSConUninstall* copy = new (ELeave) CSConUninstall(); - copy->iName = iName; - copy->iVendor = iVendor; - copy->iUid = iUid; - copy->iMode = iMode; - - copy->iComplete = iComplete; - copy->iProgress = iProgress; - - return copy; - } - -// ----------------------------------------------------------------------------- -// CSConListDataOwners::CSConListDataOwners() -// -// ----------------------------------------------------------------------------- -// -CSConListDataOwners::CSConListDataOwners() : iComplete( EFalse ), iProgress( 0 ) - { - } - -// ----------------------------------------------------------------------------- -// CSConListDataOwners::~CSConListDataOwners() -// -// ----------------------------------------------------------------------------- -// -CSConListDataOwners::~CSConListDataOwners() - { - iDataOwners.ResetAndDestroy(); - iDataOwners.Close(); - } - -// ----------------------------------------------------------------------------- -// CSConListDataOwners::CopyL() -// -// ----------------------------------------------------------------------------- -// -CSConListDataOwners* CSConListDataOwners::CopyL() - { - CSConListDataOwners* copy = new (ELeave) CSConListDataOwners(); - CleanupStack::PushL( copy ); - for( TInt i = 0; i < iDataOwners.Count(); i++ ) - { - copy->iDataOwners.Append( iDataOwners[i]->CopyL() ); - } - CleanupStack::Pop( copy ); - - copy->iComplete = iComplete; - copy->iProgress = iProgress; - - return copy; - } - -// ----------------------------------------------------------------------------- -// CSConListDataOwners::DeleteDataOwners() -// -// ----------------------------------------------------------------------------- -// -void CSConListDataOwners::DeleteDataOwners() - { - iDataOwners.ResetAndDestroy(); - iDataOwners.Close(); - } - -// ----------------------------------------------------------------------------- -// CCSConSetBURMode::CSConSetBURMode() -// -// ----------------------------------------------------------------------------- -// -CSConSetBURMode::CSConSetBURMode() : iComplete( EFalse ), iProgress( 0 ) - { - //Initialize iDriveList with zeros - iDriveList.Fill( '\x0' ); - } - -// ----------------------------------------------------------------------------- -// CSConSetBURMode::~CSConSetBURMode() -// -// ----------------------------------------------------------------------------- -// -CSConSetBURMode::~CSConSetBURMode() - { - } - -// ----------------------------------------------------------------------------- -// CSConSetBURMode::Copy() -// -// ----------------------------------------------------------------------------- -// -CSConSetBURMode* CSConSetBURMode::CopyL() - { - CSConSetBURMode* copy = new (ELeave) CSConSetBURMode(); - copy->iDriveList.Copy( iDriveList ); - copy->iPartialType = iPartialType; - copy->iIncType = iIncType; - - copy->iComplete = iComplete; - copy->iProgress = iProgress; - - return copy; - } - -// ----------------------------------------------------------------------------- -// CSConGetDataSize::CSConGetDataSize() -// -// ----------------------------------------------------------------------------- -// -CSConGetDataSize::CSConGetDataSize() : iComplete( EFalse ), iProgress( 0 ) - { - } - -// ----------------------------------------------------------------------------- -// CSConGetDataSize::~CSConGetDataSize() -// -// ----------------------------------------------------------------------------- -// -CSConGetDataSize::~CSConGetDataSize() - { - iDataOwners.ResetAndDestroy(); - iDataOwners.Close(); - } - -// ----------------------------------------------------------------------------- -// CSConGetDataSize::Copy() -// -// ----------------------------------------------------------------------------- -// -CSConGetDataSize* CSConGetDataSize::CopyL() - { - CSConGetDataSize* copy = new (ELeave) CSConGetDataSize(); - CleanupStack::PushL( copy ); - for( TInt i = 0; i < iDataOwners.Count(); i++ ) - { - copy->iDataOwners.Append( iDataOwners[i]->CopyL() ); - } - CleanupStack::Pop( copy ); - copy->iComplete = iComplete; - copy->iProgress = iProgress; - - return copy; - } - -// ----------------------------------------------------------------------------- -// CSConGetDataSize::DeleteDataOwners() -// -// ----------------------------------------------------------------------------- -// -void CSConGetDataSize::DeleteDataOwners() - { - iDataOwners.ResetAndDestroy(); - iDataOwners.Close(); - } - -// ----------------------------------------------------------------------------- -// CSConListPublicFiles::CSConListPublicFiles() -// -// ----------------------------------------------------------------------------- -// -CSConListPublicFiles::CSConListPublicFiles() : iComplete( EFalse ), iProgress( 0 ) - { - } - -// ----------------------------------------------------------------------------- -// CSConListPublicFiles::~CSConListPublicFiles() -// -// ----------------------------------------------------------------------------- -// -CSConListPublicFiles::~CSConListPublicFiles() - { - iFiles.ResetAndDestroy(); - iFiles.Close(); - - iDataOwners.ResetAndDestroy(); - iDataOwners.Close(); - } - -// ----------------------------------------------------------------------------- -// CSConListPublicFiles::CopyL() -// -// ----------------------------------------------------------------------------- -// -CSConListPublicFiles* CSConListPublicFiles::CopyL() - { - CSConListPublicFiles* copy = new (ELeave) CSConListPublicFiles(); - CleanupStack::PushL( copy ); - for( TInt i = 0; i < iFiles.Count(); i++ ) - { - copy->iFiles.Append( iFiles[i]->CopyL() ); - } - - for( TInt j = 0; j < iDataOwners.Count(); j++ ) - { - copy->iDataOwners.Append( iDataOwners[j]->CopyL() ); - } - CleanupStack::Pop( copy ); - - copy->iComplete = iComplete; - copy->iProgress = iProgress; - - return copy; - } - -// ----------------------------------------------------------------------------- -// CSConRequestData::CSConRequestData() -// -// ----------------------------------------------------------------------------- -// -CSConRequestData::CSConRequestData() : iDataOwner( NULL ), iBackupData( NULL ), - iMoreData( EFalse ), iComplete( EFalse ), iProgress( 0 ) - { - iDataOwner = new CSConDataOwner(); - } - -// ----------------------------------------------------------------------------- -// CSConRequestData::~CSConRequestData() -// -// ----------------------------------------------------------------------------- -// -CSConRequestData::~CSConRequestData() - { - if ( iDataOwner ) - { - delete iDataOwner; - iDataOwner = NULL; - } - - if ( iBackupData ) - { - delete iBackupData; - iBackupData = NULL; - } - } - -// ----------------------------------------------------------------------------- -// CSConRequestData::Copy() -// -// ----------------------------------------------------------------------------- -// -CSConRequestData* CSConRequestData::CopyL() - { - CSConRequestData* copy = new (ELeave) CSConRequestData(); - - if ( iDataOwner ) - { - if ( copy->iDataOwner ) - { - delete copy->iDataOwner; - copy->iDataOwner = NULL; - } - copy->iDataOwner = iDataOwner->CopyL(); - } - - copy->iComplete = iComplete; - copy->iProgress = iProgress; - - if ( iBackupData ) - { - if ( copy->iBackupData ) - { - delete copy->iBackupData; - copy->iBackupData = NULL; - } - copy->iBackupData = iBackupData->Alloc(); - } - - copy->iMoreData = iMoreData; - - return copy; - } - -// ----------------------------------------------------------------------------- -// CSConRequestData::DeleteDataAndDataOwner() -// -// ----------------------------------------------------------------------------- -// -void CSConRequestData::DeleteDataAndDataOwner() - { - if ( iDataOwner ) - { - delete iDataOwner; - iDataOwner = NULL; - } - - if ( iBackupData ) - { - delete iBackupData; - iBackupData = NULL; - } - } - -// ----------------------------------------------------------------------------- -// CSConGetDataOwnerStatus::CSConGetDataOwnerStatus() -// -// ----------------------------------------------------------------------------- -// -CSConGetDataOwnerStatus::CSConGetDataOwnerStatus() : iComplete( EFalse ), iProgress( 0 ) - { - } - -// ----------------------------------------------------------------------------- -// CSConGetDataOwnerStatus::~CSConGetDataOwnerStatus() -// -// ----------------------------------------------------------------------------- -// -CSConGetDataOwnerStatus::~CSConGetDataOwnerStatus() - { - iDataOwners.ResetAndDestroy(); - iDataOwners.Close(); - } - -// ----------------------------------------------------------------------------- -// CSConGetDataOwnerStatus::Copy() -// -// ----------------------------------------------------------------------------- -// -CSConGetDataOwnerStatus* CSConGetDataOwnerStatus::CopyL() - { - CSConGetDataOwnerStatus* copy = new (ELeave) CSConGetDataOwnerStatus(); - CleanupStack::PushL( copy ); - for( TInt i = 0; i < iDataOwners.Count(); i++ ) - { - copy->iDataOwners.Append( iDataOwners[i]->CopyL() ); - } - CleanupStack::Pop( copy ); - - copy->iComplete = iComplete; - copy->iProgress = iProgress; - - return copy; - } - -// ----------------------------------------------------------------------------- -// CSConGetDataOwnerStatus::DeleteDataOwners() -// -// ----------------------------------------------------------------------------- -// -void CSConGetDataOwnerStatus::DeleteDataOwners() - { - iDataOwners.ResetAndDestroy(); - iDataOwners.Close(); - } - -// ----------------------------------------------------------------------------- -// CSConSupplyData::CSConSupplyData() -// -// ----------------------------------------------------------------------------- -// -CSConSupplyData::CSConSupplyData() : iDataOwner( NULL ), iRestoreData( NULL ), - iComplete( EFalse ), iProgress( 0 ) - { - iDataOwner = new CSConDataOwner(); - } - -// ----------------------------------------------------------------------------- -// CSConSupplyData::~CSConSupplyData() -// -// ----------------------------------------------------------------------------- -// -CSConSupplyData::~CSConSupplyData() - { - if ( iDataOwner ) - { - delete iDataOwner; - iDataOwner = NULL; - } - - if ( iRestoreData ) - { - delete iRestoreData; - iRestoreData = NULL; - } - } - -// ----------------------------------------------------------------------------- -// CSConSupplyData::Copy() -// -// ----------------------------------------------------------------------------- -// -CSConSupplyData* CSConSupplyData::CopyL() - { - CSConSupplyData* copy = new (ELeave) CSConSupplyData(); - CleanupStack::PushL( copy ); - - copy->iComplete = iComplete; - copy->iProgress = iProgress; - - if ( iDataOwner ) - { - if ( copy->iDataOwner ) - { - delete copy->iDataOwner; - copy->iDataOwner = NULL; - } - - copy->iDataOwner = iDataOwner->CopyL(); - } - CleanupStack::Pop( copy ); - - if ( iRestoreData ) - { - if ( copy->iRestoreData ) - { - delete copy->iRestoreData; - copy->iRestoreData = NULL; - } - - copy->iRestoreData = iRestoreData->Alloc(); - } - - copy->iMoreData = iMoreData; - - return copy; - } - -// ----------------------------------------------------------------------------- -// CSConGetMetadata::CSConGetMetadata() -// -// ----------------------------------------------------------------------------- -// -CSConGetMetadata::CSConGetMetadata() : iData( NULL ), - iMoreData( EFalse ), iComplete( EFalse ), iProgress( 0 ) - { - } - -// ----------------------------------------------------------------------------- -// CSConGetMetadata::~CSConGetMetadata() -// -// ----------------------------------------------------------------------------- -// -CSConGetMetadata::~CSConGetMetadata() - { - if ( iData ) - { - delete iData; - iData = NULL; - } - } - -// ----------------------------------------------------------------------------- -// CSConGetMetadata::Copy() -// -// ----------------------------------------------------------------------------- -// -CSConGetMetadata* CSConGetMetadata::CopyL() - { - CSConGetMetadata* copy = new (ELeave) CSConGetMetadata(); - - copy->iFilename = iFilename; - - if ( iData ) - { - if ( copy->iData ) - { - delete copy->iData; - copy->iData = NULL; - } - - copy->iData = iData->Alloc(); - } - - copy->iMoreData = iMoreData; - copy->iComplete = iComplete; - copy->iProgress = iProgress; - - return copy; - } - - -// ----------------------------------------------------------------------------- -// CSConTask::NewL( TSConMethodName aMethod ) -// -// ----------------------------------------------------------------------------- -// -CSConTask* CSConTask::NewL( TSConMethodName aMethod ) - { - CSConTask* self = NewLC( aMethod ); - CleanupStack::Pop( self ); - return self; - } - -// ----------------------------------------------------------------------------- -// CSConTask::NewLC( TSConMethodName aMethod ) -// -// ----------------------------------------------------------------------------- -// -CSConTask* CSConTask::NewLC( TSConMethodName aMethod ) - { - CSConTask* self = new (ELeave) CSConTask(); - CleanupStack::PushL( self ); - self->ConstructL( aMethod ); - return self; - } - -// ----------------------------------------------------------------------------- -// CSConTask::ConstructL( TSConMethodName aMethod ) -// Initializes member data -// ----------------------------------------------------------------------------- -// -void CSConTask::ConstructL( TSConMethodName aMethod ) - { - iMethod = aMethod; - - switch( aMethod ) - { - case ECancel : - break; - case EGetDataOwnerStatus : - iGetDataOwnerParams = new (ELeave) CSConGetDataOwnerStatus(); - break; - case EGetDataSize : - iGetDataSizeParams = new (ELeave) CSConGetDataSize(); - break; - case EGetStatus : - iGetStatusParams = new (ELeave) CSConGetStatus(); - break; - case EInstall : - iInstallParams = new (ELeave) CSConInstall(); - break; - case EListDataOwners : - iListDataOwnersParams = new (ELeave) CSConListDataOwners(); - break; - case EListInstalledApps : - iListAppsParams = new (ELeave) CSConListInstApps(); - break; - case EListPublicFiles : - iPubFilesParams = new (ELeave) CSConListPublicFiles(); - break; - case ERequestData : - iRequestDataParams = new (ELeave) CSConRequestData(); - break; - case ESetBURMode : - iBURModeParams = new (ELeave) CSConSetBURMode(); - break; - case ESetInstParams : - break; - case ESupplyData : - iSupplyDataParams = new (ELeave) CSConSupplyData(); - break; - case EUninstall : - iUninstallParams = new (ELeave) CSConUninstall(); - break; - case EUpdateDeviceInfo : - iDevInfoParams = new (ELeave) CSConUpdateDeviceInfo(); - break; - case EReboot : - iRebootParams = new (ELeave) CSConReboot(); - break; - case EGetMetadata : - iGetMetadataParams = new (ELeave) CSConGetMetadata(); - break; - default : - break; - } - } -// ----------------------------------------------------------------------------- -// CSConTask::CSConTask() -// -// ----------------------------------------------------------------------------- -// -CSConTask::CSConTask() - { - } - -// ----------------------------------------------------------------------------- -// CSConTask::~CSConTask() -// -// ----------------------------------------------------------------------------- -// -CSConTask::~CSConTask() - { - delete iDevInfoParams; - delete iListAppsParams; - delete iGetStatusParams; - delete iInstallParams; - delete iUninstallParams; - delete iBURModeParams; - delete iGetDataSizeParams; - delete iRequestDataParams; - delete iGetDataOwnerParams; - delete iSupplyDataParams; - delete iPubFilesParams; - delete iListDataOwnersParams; - delete iRebootParams; - delete iGetMetadataParams; - } - -// ----------------------------------------------------------------------------- -// CSConTask::GetServiceId() const -// -// ----------------------------------------------------------------------------- -// -TSConMethodName CSConTask::GetServiceId() const - { - return iMethod; - } - -// ----------------------------------------------------------------------------- -// CSConTask::Copy() const -// -// ----------------------------------------------------------------------------- -// -CSConTask* CSConTask::CopyL() const - { - CSConTask* copy = new (ELeave) CSConTask(); - copy->iMethod = iMethod; - - if ( iDevInfoParams ) - { - copy->iDevInfoParams = iDevInfoParams->CopyL(); - } - if ( iListAppsParams ) - { - copy->iListAppsParams = iListAppsParams->CopyL(); - } - if ( iGetStatusParams ) - { - - } - if ( iInstallParams ) - { - copy->iInstallParams = iInstallParams->CopyL(); - } - if ( iUninstallParams ) - { - copy->iUninstallParams = iUninstallParams->CopyL(); - } - if ( iBURModeParams ) - { - copy->iBURModeParams = iBURModeParams->CopyL(); - } - if ( iGetDataSizeParams ) - { - copy->iGetDataSizeParams = iGetDataSizeParams->CopyL(); - } - if ( iRequestDataParams ) - { - copy->iRequestDataParams = iRequestDataParams->CopyL(); - } - if ( iGetDataOwnerParams ) - { - copy->iGetDataOwnerParams = iGetDataOwnerParams->CopyL(); - } - if ( iSupplyDataParams ) - { - copy->iSupplyDataParams = iSupplyDataParams->CopyL(); - } - if ( iPubFilesParams ) - { - copy->iPubFilesParams = iPubFilesParams->CopyL(); - } - if ( iListDataOwnersParams ) - { - copy->iListDataOwnersParams = iListDataOwnersParams->CopyL(); - } - if ( iRebootParams ) - { - copy->iRebootParams = iRebootParams->CopyL(); - } - if ( iGetMetadataParams ) - { - copy->iGetMetadataParams = iGetMetadataParams->CopyL(); - } - - return copy; - } - -// ----------------------------------------------------------------------------- -// CSConTask::GetComplete() -// -// ----------------------------------------------------------------------------- -// -TBool CSConTask::GetComplete() - { - TBool complete( EFalse ); - - switch( iMethod ) - { - case EInstall : - complete = this->iInstallParams->iComplete; - break; - case EUninstall : - complete = this->iUninstallParams->iComplete; - break; - case EListInstalledApps : - complete = this->iListAppsParams->iComplete; - break; - case ESetInstParams : - break; - case ESetBURMode : - complete = this->iBURModeParams->iComplete; - break; - case EListPublicFiles : - complete = this->iPubFilesParams->iComplete; - break; - case EListDataOwners : - complete = this->iListDataOwnersParams->iComplete; - break; - case EGetDataSize : - complete = this->iGetDataSizeParams->iComplete; - break; - case EReboot : - complete = this->iRebootParams->iComplete; - break; - case ERequestData : - //If task is partially completed, - //it can be removed from the queue - if ( this->iRequestDataParams->iProgress == KSConTaskPartiallyCompleted ) - { - complete = ETrue; - } - else - { - complete = this->iRequestDataParams->iComplete; - } - - break; - case EGetDataOwnerStatus : - complete = this->iGetDataOwnerParams->iComplete; - break; - case ESupplyData : - //If task is partially completed, - //it can be removed from the queue - if ( this->iSupplyDataParams->iProgress == KSConTaskPartiallyCompleted ) - { - complete = ETrue; - } - else - { - complete = this->iSupplyDataParams->iComplete; - } - - break; - case EGetMetadata : - complete = this->iGetMetadataParams->iComplete; - break; - default : - break; - } - - return complete; - } - -// ----------------------------------------------------------------------------- -// CSConTask::SetCompleteValue( TBool aValue ) -// -// ----------------------------------------------------------------------------- -// -void CSConTask::SetCompleteValue( TBool aValue ) - { - switch( iMethod ) - { - case EInstall : - this->iInstallParams->iComplete = aValue; - break; - case EUninstall : - this->iUninstallParams->iComplete = aValue; - break; - case EListInstalledApps : - this->iListAppsParams->iComplete = aValue; - break; - case ESetInstParams : - this->iInstallParams->iComplete = aValue; - break; - case ESetBURMode : - this->iBURModeParams->iComplete = aValue; - break; - case EListPublicFiles : - this->iPubFilesParams->iComplete = aValue; - break; - case EListDataOwners : - this->iListDataOwnersParams->iComplete = aValue; - break; - case EGetDataSize : - this->iGetDataSizeParams->iComplete = aValue; - break; - case EReboot : - this->iRebootParams->iComplete = aValue; - break; - case ERequestData : - this->iRequestDataParams->iComplete = aValue; - break; - case EGetDataOwnerStatus : - this->iGetDataOwnerParams->iComplete = aValue; - break; - case ESupplyData : - this->iSupplyDataParams->iComplete = aValue; - break; - case EGetMetadata : - this->iGetMetadataParams->iComplete = aValue; - break; - default: - break; - } - } - -// ----------------------------------------------------------------------------- -// CSConTask::GetCompleteValue() -// -// ----------------------------------------------------------------------------- -// -TBool CSConTask::GetCompleteValue() - { - TBool complete( EFalse ); - - switch( iMethod ) - { - case EInstall : - complete = this->iInstallParams->iComplete; - break; - case EUninstall : - complete = this->iUninstallParams->iComplete; - break; - case EListInstalledApps : - complete = this->iListAppsParams->iComplete; - break; - case ESetInstParams : - complete = this->iInstallParams->iComplete; - break; - case ESetBURMode : - complete = this->iBURModeParams->iComplete; - break; - case EListPublicFiles : - complete = this->iPubFilesParams->iComplete; - break; - case EListDataOwners : - complete = this->iListDataOwnersParams->iComplete; - break; - case EGetDataSize : - complete = this->iGetDataSizeParams->iComplete; - break; - case EReboot : - complete = this->iRebootParams->iComplete; - break; - case ERequestData : - if ( this->iRequestDataParams->iProgress != KSConTaskPartiallyCompleted ) - { - complete = this->iRequestDataParams->iComplete; - } - else - { - complete = ETrue; - } - - break; - case EGetDataOwnerStatus : - complete = this->iGetDataOwnerParams->iComplete; - break; - case ESupplyData : - if ( this->iSupplyDataParams->iProgress != KSConTaskPartiallyCompleted ) - { - complete = this->iSupplyDataParams->iComplete; - } - else - { - complete = ETrue; - } - break; - case EGetMetadata : - complete = this->iGetMetadataParams->iComplete; - break; - default: - break; - } - return complete; - } - -// ----------------------------------------------------------------------------- -// CSConTask::SetProgressValue( TInt aValue ) -// -// ----------------------------------------------------------------------------- -// -void CSConTask::SetProgressValue( TInt aValue ) - { - switch( iMethod ) - { - case EInstall : - this->iInstallParams->iProgress = aValue; - break; - case EUninstall : - this->iUninstallParams->iProgress = aValue; - break; - case EListInstalledApps : - this->iListAppsParams->iProgress = aValue; - break; - case ESetInstParams : - this->iInstallParams->iProgress = aValue; - break; - case ESetBURMode : - this->iBURModeParams->iProgress = aValue; - break; - case EListPublicFiles : - this->iPubFilesParams->iProgress = aValue; - break; - case EListDataOwners : - this->iListDataOwnersParams->iProgress = aValue; - break; - case EGetDataSize : - this->iGetDataSizeParams->iProgress = aValue; - break; - case EReboot : - this->iRebootParams->iProgress = aValue; - break; - case ERequestData : - this->iRequestDataParams->iProgress = aValue; - break; - case EGetDataOwnerStatus : - this->iGetDataOwnerParams->iProgress = aValue; - break; - case ESupplyData : - this->iSupplyDataParams->iProgress = aValue; - break; - case EGetMetadata : - this->iGetMetadataParams->iProgress = aValue; - break; - default: - break; - } - } - -// ----------------------------------------------------------------------------- -// CSConTaskReply::CSConTaskReply() -// -// ----------------------------------------------------------------------------- -// -CSConTaskReply::CSConTaskReply() - { - } - -// ----------------------------------------------------------------------------- -// CSConTaskReply::CSConTaskReply( TSConMethodName aMethod ) -// -// ----------------------------------------------------------------------------- -// -CSConTaskReply::CSConTaskReply( TSConMethodName aMethod ) - { - iMethod = aMethod; - switch( aMethod ) - { - case ECancel : - break; - case EGetDataOwnerStatus : - iGetDataOwnerParams = new CSConGetDataOwnerStatus(); - break; - case EGetDataSize : - iGetDataSizeParams = new CSConGetDataSize(); - break; - case EGetStatus : - iGetStatusParams = new CSConGetStatus(); - break; - case EInstall : - iInstallParams = new CSConInstall(); - break; - case EListDataOwners : - iListDataOwnersParams = new CSConListDataOwners(); - break; - case EListInstalledApps : - iListAppsParams = new CSConListInstApps(); - break; - case EListPublicFiles : - iPubFilesParams = new CSConListPublicFiles(); - break; - case ERequestData : - iRequestDataParams = new CSConRequestData(); - break; - case ESetBURMode : - iBURModeParams = new CSConSetBURMode(); - break; - case ESetInstParams : - break; - case ESupplyData : - iSupplyDataParams = new CSConSupplyData(); - break; - case EUninstall : - iUninstallParams = new CSConUninstall(); - break; - case EUpdateDeviceInfo : - iDevInfoParams = new CSConUpdateDeviceInfo(); - break; - case EReboot : - iRebootParams = new CSConReboot(); - break; - case EGetMetadata : - iGetMetadataParams = new CSConGetMetadata(); - break; - default : - break; - } - } - -// ----------------------------------------------------------------------------- -// CSConTaskReply::~CSConTaskReply() -// -// ----------------------------------------------------------------------------- -// -CSConTaskReply::~CSConTaskReply() - { - delete iDevInfoParams; - delete iListAppsParams; - delete iGetStatusParams; - delete iInstallParams; - delete iUninstallParams; - delete iBURModeParams; - delete iGetDataSizeParams; - delete iRequestDataParams; - delete iGetDataOwnerParams; - delete iSupplyDataParams; - delete iPubFilesParams; - delete iListDataOwnersParams; - delete iRebootParams; - delete iGetMetadataParams; - } - -// ----------------------------------------------------------------------------- -// CSConTaskReply::Initialize( const CSConTask& aTask ) -// -// ----------------------------------------------------------------------------- -// -void CSConTaskReply::InitializeL( const CSConTask& aTask ) - { - iTaskId = aTask.iTaskId; - iMethod = aTask.iMethod; - - if ( iMethod == EInstall ) - { - if ( iInstallParams ) - { - delete iInstallParams; - iInstallParams = NULL; - } - iInstallParams = aTask.iInstallParams->CopyL(); - } - else if ( iMethod == EListInstalledApps ) - { - if ( iListAppsParams ) - { - delete iListAppsParams; - iListAppsParams = NULL; - } - - iListAppsParams = aTask.iListAppsParams->CopyL(); - } - else if ( iMethod == EUninstall ) - { - if ( iUninstallParams ) - { - delete iUninstallParams; - iUninstallParams = NULL; - } - - iUninstallParams = aTask.iUninstallParams->CopyL(); - } - else if ( iMethod == ESetBURMode ) - { - if ( iBURModeParams ) - { - delete iBURModeParams; - iBURModeParams = NULL; - } - - iBURModeParams = aTask.iBURModeParams->CopyL(); - } - else if ( iMethod == EListPublicFiles ) - { - if ( iPubFilesParams ) - { - delete iPubFilesParams; - iPubFilesParams = NULL; - } - - iPubFilesParams = aTask.iPubFilesParams->CopyL(); - } - else if ( iMethod == EListDataOwners ) - { - if ( iListDataOwnersParams ) - { - delete iListDataOwnersParams; - iListDataOwnersParams = NULL; - } - - iListDataOwnersParams = aTask.iListDataOwnersParams->CopyL(); - } - else if ( iMethod == EGetDataSize ) - { - if ( iGetDataSizeParams ) - { - delete iGetDataSizeParams; - iGetDataSizeParams = NULL; - } - - iGetDataSizeParams = aTask.iGetDataSizeParams->CopyL(); - } - else if ( iMethod == EReboot ) - { - if ( iRebootParams ) - { - delete iRebootParams; - iRebootParams = NULL; - } - } - else if ( iMethod == ERequestData ) - { - if ( iRequestDataParams ) - { - delete iRequestDataParams; - iRequestDataParams = NULL; - } - - iRequestDataParams = aTask.iRequestDataParams->CopyL(); - } - else if ( iMethod == EGetDataOwnerStatus ) - { - if ( iGetDataOwnerParams ) - { - delete iGetDataOwnerParams; - iGetDataOwnerParams = NULL; - } - - iGetDataOwnerParams = aTask.iGetDataOwnerParams->CopyL(); - } - else if ( iMethod == ESupplyData ) - { - if ( iSupplyDataParams ) - { - delete iSupplyDataParams; - iSupplyDataParams = NULL; - } - - iSupplyDataParams = aTask.iSupplyDataParams->CopyL(); - } - else if ( iMethod == EGetMetadata ) - { - if ( iGetMetadataParams ) - { - delete iGetMetadataParams; - iGetMetadataParams = NULL; - } - - iGetMetadataParams = aTask.iGetMetadataParams->CopyL(); - } - } - -// ----------------------------------------------------------------------------- -// CSConTaskReply::Initialize( TSConMethodName aMethod, -// TInt aProgress, TBool aComplete ) -// -// ----------------------------------------------------------------------------- -// -void CSConTaskReply::InitializeL( TSConMethodName aMethod, - TInt aProgress, TBool aComplete ) - { - iMethod = aMethod; - if ( aMethod == EUpdateDeviceInfo ) - { - if ( !iDevInfoParams ) - { - iDevInfoParams = new (ELeave) CSConUpdateDeviceInfo(); - } - - iDevInfoParams->iComplete = aComplete; - iDevInfoParams->iProgress = aProgress; - } - else if ( aMethod == EReboot ) - { - if ( !iRebootParams ) - { - iRebootParams = new (ELeave) CSConReboot(); - } - - iRebootParams->iComplete = aComplete; - iRebootParams->iProgress = aProgress; - } - else if ( aMethod == EGetMetadata ) - { - if ( !iGetMetadataParams ) - { - iGetMetadataParams = new (ELeave) CSConGetMetadata(); - } - - iGetMetadataParams->iComplete = aComplete; - iGetMetadataParams->iProgress = aProgress; - } - } - -// ----------------------------------------------------------------------------- -// CSConTaskReply::CopyAndFree() -// -// ----------------------------------------------------------------------------- -// -CSConTaskReply* CSConTaskReply::CopyAndFreeL() - { - CSConTaskReply* copy = new (ELeave) CSConTaskReply(); - copy->iTaskId = iTaskId; - copy->iMethod = iMethod; - - if ( iDevInfoParams ) - { - copy->iDevInfoParams = iDevInfoParams->CopyL(); - - //free allocated memory - delete iDevInfoParams; - iDevInfoParams = NULL; - } - if ( iListAppsParams ) - { - copy->iListAppsParams = iListAppsParams->CopyL(); - - //free allocated memory - delete iListAppsParams; - iListAppsParams = NULL; - } - if ( iInstallParams ) - { - copy->iInstallParams = iInstallParams->CopyL(); - - //free allocated memory - delete iInstallParams; - iInstallParams = NULL; - } - if ( iUninstallParams ) - { - copy->iUninstallParams = iUninstallParams->CopyL(); - - //free allocated memory - delete iUninstallParams; - iUninstallParams = NULL; - } - if ( iBURModeParams ) - { - copy->iBURModeParams = iBURModeParams->CopyL(); - - //free allocated memory - delete iBURModeParams; - iBURModeParams = NULL; - } - if ( iGetDataSizeParams ) - { - copy->iGetDataSizeParams = iGetDataSizeParams->CopyL(); - - //free allocated memory - delete iGetDataSizeParams; - iGetDataSizeParams = NULL; - } - if ( iRequestDataParams ) - { - copy->iRequestDataParams = iRequestDataParams->CopyL(); - - //free allocated memory - delete iRequestDataParams; - iRequestDataParams = NULL; - } - if ( iGetDataOwnerParams ) - { - copy->iGetDataOwnerParams = iGetDataOwnerParams->CopyL(); - - //free allocated memory - delete iGetDataOwnerParams; - iGetDataOwnerParams = NULL; - } - if ( iSupplyDataParams ) - { - copy->iSupplyDataParams = iSupplyDataParams->CopyL(); - - //free allocated memory - delete iSupplyDataParams; - iSupplyDataParams = NULL; - } - if ( iPubFilesParams ) - { - copy->iPubFilesParams = iPubFilesParams->CopyL(); - - //free allocated memory - delete iPubFilesParams; - iPubFilesParams = NULL; - } - if ( iListDataOwnersParams ) - { - copy->iListDataOwnersParams = iListDataOwnersParams->CopyL(); - - //free allocated memory - delete iListDataOwnersParams; - iListDataOwnersParams = NULL; - } - if ( iRebootParams ) - { - copy->iRebootParams = iRebootParams->CopyL(); - - //free allocated memory - delete iRebootParams; - iRebootParams = NULL; - } - if ( iGetMetadataParams ) - { - copy->iGetMetadataParams = iGetMetadataParams->CopyL(); - - //free allocated memory - delete iGetMetadataParams; - iGetMetadataParams = NULL; - } - - return copy; - } - -// ----------------------------------------------------------------------------- -// CSConTaskReply::CleanTaskData() -// -// ----------------------------------------------------------------------------- -// -void CSConTaskReply::CleanTaskData() - { - switch( iMethod ) - { - case EGetDataSize : - if ( iGetDataSizeParams ) - { - this->iGetDataSizeParams->DeleteDataOwners(); - } - break; - case EGetDataOwnerStatus : - if ( iGetDataOwnerParams ) - { - this->iGetDataOwnerParams->DeleteDataOwners(); - } - break; - case EListDataOwners : - if ( iListDataOwnersParams ) - { - this->iListDataOwnersParams->DeleteDataOwners(); - } - break; - case ERequestData : - if ( iRequestDataParams ) - { - this->iRequestDataParams->DeleteDataAndDataOwner(); - } - break; - default : - break; - } - } - -// ----------------------------------------------------------------------------- -// CSConStatusReply::CSConStatusReply() -// -// ----------------------------------------------------------------------------- -// -CSConStatusReply::CSConStatusReply() : iNoTasks( EFalse ) - { - } - -// ----------------------------------------------------------------------------- -// CSConStatusReply::~CSConStatusReply() -// -// ----------------------------------------------------------------------------- -// -CSConStatusReply::~CSConStatusReply() - { - iTasks.ResetAndDestroy(); - iTasks.Close(); - }; - -// End of file diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/group/bld.inf --- a/connectivitymodules/SeCon/group/bld.inf Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ -/* -* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Build info file for SeCon -* -*/ - -#include - -#include "../catalogspcconnectivityplugin/group/bld.inf" -#include "../cntparser/bld/bld.inf" -#include "../services/csc/bld/bld.inf" -#include "../services/ftp/bld/bld.inf" -#include "../services/pcd/bld/bld.inf" -#include "../wbxml/conmlhandler/bld/bld.inf" -#include "../servers/pcconn/bld/bld.inf" -#include "../clients/pcconn/bld/bld.inf" -#include "../plugins/pcconn/bld/bld.inf" -#include "../plugins/ftp/bld/bld.inf" -#include "../plugins/hapticsconnplugin/group/bld.inf" - -PRJ_EXPORTS - -// Export stub files -stubs/secon_stub.SIS /epoc32/data/z/system/install/secon_stub.SIS -stubs/sconpcconnplugin_stub.SIS /epoc32/data/z/system/install/sconpcconnplugin_stub.SIS -stubs/sconftpplugin_stub.SIS /epoc32/data/z/system/install/sconftpplugin_stub.SIS - -../rom/sconpcd.iby CORE_MW_LAYER_IBY_EXPORT_PATH(sconpcd.iby) -../rom/sconpcconnplugin.iby CORE_MW_LAYER_IBY_EXPORT_PATH(sconpcconnplugin.iby) -../rom/sconpcconnclientserver.iby CORE_MW_LAYER_IBY_EXPORT_PATH(sconpcconnclientserver.iby) -../rom/sconftpresources.iby LANGUAGE_MW_LAYER_IBY_EXPORT_PATH(sconftpresources.iby) -../rom/sconftpplugin.iby CORE_MW_LAYER_IBY_EXPORT_PATH(sconftpplugin.iby) -../rom/sconftp.iby CORE_MW_LAYER_IBY_EXPORT_PATH(sconftp.iby) -../rom/sconcsc.iby CORE_MW_LAYER_IBY_EXPORT_PATH(sconcsc.iby) -../rom/cntparser.iby CORE_MW_LAYER_IBY_EXPORT_PATH(cntparser.iby) - diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/group/stubs/createstubs.bat --- a/connectivitymodules/SeCon/group/stubs/createstubs.bat Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,19 +0,0 @@ -rem -rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -rem All rights reserved. -rem This component and the accompanying materials are made available -rem under the terms of "Eclipse Public License v1.0" -rem which accompanies this distribution, and is available -rem at the URL "http://www.eclipse.org/legal/epl-v10.html". -rem -rem Initial Contributors: -rem Nokia Corporation - initial contribution. -rem -rem Contributors: -rem -rem Description: Batch file for creating needed stub files. -rem - -makesis -s sconftpplugin_stub.pkg -makesis -s sconpcconnplugin_stub.pkg -makesis -s secon_stub.pkg diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/group/stubs/sconftpplugin_stub.SIS Binary file connectivitymodules/SeCon/group/stubs/sconftpplugin_stub.SIS has changed diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/group/stubs/sconftpplugin_stub.pkg --- a/connectivitymodules/SeCon/group/stubs/sconftpplugin_stub.pkg Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -; -; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -; All rights reserved. -; This component and the accompanying materials are made available -; under the terms of "Eclipse Public License v1.0" -; which accompanies this distribution, and is available -; at the URL "http://www.eclipse.org/legal/epl-v10.html". -; -; Initial Contributors: -; Nokia Corporation - initial contribution. -; -; Contributors: -; -; Description: Sis-stub file for FTP Plugin -; -; Languages -&EN - -; Header -#{"FTP Plugin"},(0x101F9686),1,0,0, TYPE=SA - -; Localised Vendor name -%{"Nokia"} - -; Unique Vendor name -:"Nokia" - -; Files to install -""-"z:\resource\plugins\sconftpplugin.rsc" -""-"z:\sys\bin\sconftpplugin.dll" diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/group/stubs/sconpcconnplugin_stub.SIS Binary file connectivitymodules/SeCon/group/stubs/sconpcconnplugin_stub.SIS has changed diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/group/stubs/sconpcconnplugin_stub.pkg --- a/connectivitymodules/SeCon/group/stubs/sconpcconnplugin_stub.pkg Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -; -; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -; All rights reserved. -; This component and the accompanying materials are made available -; under the terms of "Eclipse Public License v1.0" -; which accompanies this distribution, and is available -; at the URL "http://www.eclipse.org/legal/epl-v10.html". -; -; Initial Contributors: -; Nokia Corporation - initial contribution. -; -; Contributors: -; -; Description: Sis-stub file for PCConn Plugin -; -; Languages -&EN - -; Header -#{"PCConn Plugin"},(0x101F9688),1,0,0, TYPE=SA - -; Localised Vendor name -%{"Nokia"} - -; Unique Vendor name -:"Nokia" - -; Files to install -""-"z:\resource\plugins\sconpcconnplugin.rsc" -""-"z:\sys\bin\sconpcconnplugin.dll" diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/group/stubs/secon_stub.SIS Binary file connectivitymodules/SeCon/group/stubs/secon_stub.SIS has changed diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/group/stubs/secon_stub.pkg --- a/connectivitymodules/SeCon/group/stubs/secon_stub.pkg Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,38 +0,0 @@ -; -; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -; All rights reserved. -; This component and the accompanying materials are made available -; under the terms of "Eclipse Public License v1.0" -; which accompanies this distribution, and is available -; at the URL "http://www.eclipse.org/legal/epl-v10.html". -; -; Initial Contributors: -; Nokia Corporation - initial contribution. -; -; Contributors: -; -; Description: Sis-stub file for Service Controllers -; -; Languages -&EN - -; Header -#{"Service Controllers"},(0x101F99F6),1,0,0, TYPE=SA - -; Localised Vendor name -%{"Nokia"} - -; Unique Vendor name -:"Nokia" - -; Files to install -""-"z:\sys\bin\sconpcconnserver.exe" -""-"z:\sys\bin\sconpcconnclient.dll" -""-"z:\sys\bin\sconpcd.dll" -""-"z:\resource\sconftp.r??" -""-"z:\sys\bin\sconftp.dll" -""-"z:\sys\bin\sconcsc.dll" -""-"z:\sys\bin\sconconmlhandler.dll" -""-"z:\sys\bin\catalogspcconnectivityplugin.dll" -""-"z:\sys\bin\cntparserserver.dll" -""-"z:\sys\bin\cntparserserverexe.exe" diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/inc/debug.h --- a/connectivitymodules/SeCon/inc/debug.h Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,128 +0,0 @@ -/* -* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Debug utility for SeCon components. -* -*/ - - -#ifndef _SECON_DEBUG_H -#define _SECON_DEBUG_H - -#ifdef _DEBUG - - #ifdef __WINS__ - // Enable file logging - #define __FLOGGING__ - #endif //__WINS__ - - #include - #ifdef __FLOGGING__ - #include - #include - #endif - - NONSHARABLE_CLASS(TOverflowTruncate16) : public TDes16Overflow - { - public: - void Overflow(TDes16& /*aDes*/) {} - }; - - NONSHARABLE_CLASS(TOverflowTruncate8) : public TDes8Overflow - { - public: - void Overflow(TDes8& /*aDes*/) {} - }; - - _LIT( KLogDir, "SECON" ); - _LIT( KLogFile, "SeconDebug.txt" ); - - _LIT(KTracePrefix16, "[SeCon] "); - _LIT8(KTracePrefix8, "[SeCon] "); - _LIT8(KFuncEntryFormat8, "%S : Begin"); - _LIT8(KFuncExitFormat8, "%S : End"); - _LIT8(KFuncReturnFormat8, "%S : End, return: %d"); - _LIT8(KFuncFormat8, "><%S"); - - const TInt KMaxLogLineLength = 512; - - // old function loggin macros - #define LOGGER_ENTERFN( name ) {TRACE_FUNC_ENTRY;} - #define LOGGER_LEAVEFN( name ) {TRACE_FUNC_EXIT;} - - #define LOGGER_WRITE( text ) {_LIT( KTemp, text ); FPrint( KTemp );} - #define LOGGER_WRITE_1( text,par1 ) {_LIT( KTemp, text ); FPrint( KTemp, par1 );} - #define LOGGER_WRITE8_1( text,par1 ) {_LIT8( KTemp, text ); FPrint( KTemp, par1 );} - #define LOGGER_WRITE_2( text,par1,par2 ) {_LIT( KTemp, text ); FPrint( KTemp, par1, par2 );} - #define LOGGER_WRITE_3( text,par1,par2,par3 ) {_LIT( KTemp, text ); FPrint( KTemp, par1, par2, par3 );} - - // New function logging macros - #define TRACE_FUNC_ENTRY {TPtrC8 ptr8((TUint8*)__PRETTY_FUNCTION__); FPrint(KFuncEntryFormat8, &ptr8);} - #define TRACE_FUNC_EXIT {TPtrC8 ptr8((TUint8*)__PRETTY_FUNCTION__); FPrint(KFuncExitFormat8, &ptr8);} - #define TRACE_FUNC {TPtrC8 ptr8((TUint8*)__PRETTY_FUNCTION__); FPrint(KFuncFormat8, &ptr8);} - - #define TRACE_FUNC_RET( number ) {TPtrC8 ptr8((TUint8*)__PRETTY_FUNCTION__); FPrint(KFuncReturnFormat8, &ptr8, number);} - // Declare the FPrint function - inline void FPrint( TRefByValue aFmt, ...) - { - VA_LIST list; - VA_START(list,aFmt); - #ifdef __FLOGGING__ - RFileLogger::WriteFormat( KLogDir, KLogFile, EFileLoggingModeAppend, aFmt, list ); - #endif - TBuf16 theFinalString; - theFinalString.Append(KTracePrefix16); - TOverflowTruncate16 overflow; - theFinalString.AppendFormatList(aFmt,list,&overflow); - RDebug::Print(theFinalString); - } - - // Declare the FPrint function - inline void FPrint(TRefByValue aFmt, ...) - { - VA_LIST list; - VA_START(list, aFmt); - #ifdef __FLOGGING__ - RFileLogger::WriteFormat(KLogDir, KLogFile, EFileLoggingModeAppend, aFmt, list); - #endif - TOverflowTruncate8 overflow; - TBuf8 buf8; - buf8.Append(KTracePrefix8); - buf8.AppendFormatList(aFmt, list, &overflow); - TBuf16 buf16(buf8.Length()); - buf16.Copy(buf8); - TRefByValue tmpFmt(_L("%S")); - RDebug::Print(tmpFmt, &buf16); - } -#else - - // No loggings --> reduced code size - - #define LOGGER_ENTERFN( name ) - #define LOGGER_LEAVEFN( name ) - #define LOGGER_WRITE( text ) - #define LOGGER_WRITE_1( text, par1 ) - #define LOGGER_WRITE8_1( text, par1 ) - #define LOGGER_WRITE_2( text, par1, par2 ) - #define LOGGER_WRITE_3( text, par1, par2, par3 ) - #define TRACE_FUNC_ENTRY - #define TRACE_FUNC_EXIT - #define TRACE_FUNC - #define TRACE_FUNC_RET( number ) - -#endif //_DEBUG - -#endif // SECON_DEBUG_H - -// End of file - diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/plugins/ftp/bld/bld.inf --- a/connectivitymodules/SeCon/plugins/ftp/bld/bld.inf Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,23 +0,0 @@ -/* -* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: File Transfer Profile Plug-in build information file. -* -*/ - - -PRJ_PLATFORMS -DEFAULT - -PRJ_MMPFILES -sconftpplugin.mmp diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/plugins/ftp/bld/def/bwinscwU.DEF --- a/connectivitymodules/SeCon/plugins/ftp/bld/def/bwinscwU.DEF Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -EXPORTS - ?ImplementationGroupProxy@@YAPBUTImplementationProxy@@AAH@Z @ 1 NONAME ; struct TImplementationProxy const * ImplementationGroupProxy(int &) - diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/plugins/ftp/bld/def/eabiU.DEF --- a/connectivitymodules/SeCon/plugins/ftp/bld/def/eabiU.DEF Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -EXPORTS - _Z24ImplementationGroupProxyRi @ 1 NONAME - _ZTI14CSConFTPplugin @ 2 NONAME ; ## - _ZTV14CSConFTPplugin @ 3 NONAME ; ## - diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/plugins/ftp/bld/sconftpplugin.mmp --- a/connectivitymodules/SeCon/plugins/ftp/bld/sconftpplugin.mmp Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,57 +0,0 @@ -/* -* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: File Transfer Profile Plug-in -* -*/ - - -// To get the MW_LAYER_SYSTEMINCLUDE-definition -#include -#include - -VENDORID VID_DEFAULT - -CAPABILITY CAP_ECOM_PLUGIN - -TARGET sconftpplugin.dll -TARGETTYPE PLUGIN - -UID 0x10009D8D 0x101F9686 - -SOURCEPATH ../src - -SOURCE sconftpplugin.cpp -SOURCE proxy.cpp -SOURCE sconftppluginutils.cpp -SOURCE sconservicetimer.cpp -SOURCE sconshutdownwatcher.cpp - -START RESOURCE 101f9686.rss - TARGET sconftpplugin.rsc -END - -// Default system include paths for middleware layer modules. -MW_LAYER_SYSTEMINCLUDE - -USERINCLUDE ../inc -USERINCLUDE ../../../inc -USERINCLUDE ../../../services/ftp/inc - -DEBUGLIBRARY flogger.lib -LIBRARY euser.lib -LIBRARY irobex.lib -LIBRARY ecom.lib -LIBRARY efsrv.lib -LIBRARY bluetooth.lib -LIBRARY esock.lib diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/plugins/ftp/inc/sconftpplugin.h --- a/connectivitymodules/SeCon/plugins/ftp/inc/sconftpplugin.h Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,194 +0,0 @@ -/* -* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: File Transfer Profile Plug-in header file -* -*/ - - -#ifndef _SCONFTPPLUGIN_H -#define _SCONFTPPLUGIN_H - -#include -#include - -#include "sconshutdownwatcher.h" - -// forward declaration -class CSConFTP; -class CSConServiceTimer; -// CLASS DECLARATION - -/* -* File Transfer Profile Plugin class -* -*/ - -class CSConFTPplugin : public CSrcsInterface, public MObexServerNotify, - public MShutdownObserver - { - public: - static CSConFTPplugin* NewL(); - ~CSConFTPplugin(); - - /** - * Returns active status of OBEX session - * @return ETrue if session is active, else EFalse - */ - TBool IsOBEXActive(); - - /** - * Device is shutting down, abort connection. - */ - void NotifyShutdown(); - - private: - /** - * Loads sconftp.dll module - * @return none - */ - void LoadFTPDllL(); - /** - * Closes initialized services - * @return none - */ - void Disconnect(); - /** - * Removes spaces and nulls from the end of the string - * @param aDes String to be formatted - * @return none - */ - void TrimRightSpaceAndNull( TDes8& aDes ) const; - /** - * Current used transfer media (IR,USB,BT) - * @param aMediaType Enumeration indicating the media type - * @return none - */ - void SetMediaType( TSrcsMediaType aMediaType ); - /** - * MObexServerNotify implementation - * @param aError Error code - * @return none - */ - void ErrorIndication( TInt aError ); - /** - * MObexServerNotify implementation - * @return none - */ - void TransportUpIndication(); - /** - * MObexServerNotify implementation - * @return none - */ - void TransportDownIndication(); - /** - * MObexServerNotify implementation - * @param aRemoteInfo Structure containing information used during OBEX - * connection - * @param aInfo Further information about the requested connection - * @return System wide error code that indicates the success of the connection - */ - TInt ObexConnectIndication( const TObexConnectInfo& aRemoteInfo, - const TDesC8& aInfo ); - /** - * MObexServerNotify implementation - * @param aInfo Contains information about the disconnection - * @return none - */ - void ObexDisconnectIndication( const TDesC8& aInfo ); - /** - * MObexServerNotify implementation - * @return CObexBaseObject-derived object, which the object being put - * will be parsed into. - */ - CObexBufObject* PutRequestIndication(); - /** - * MObexServerNotify implementation - * @return System wide error code that indicates the success of the - * PUT packet operation. - */ - TInt PutPacketIndication(); - /** - * MObexServerNotify implementation - * @return System wide error code that indicates the success of the - * PUT packet operation. - */ - TInt PutCompleteIndication(); - /** - * MObexServerNotify implementation - * @param aRequiredObject Details about the object the remote client - * has requested - * @returnObject to return to the client - */ - CObexBufObject* GetRequestIndication( CObexBaseObject - *aRequiredObject ); - /** - * MObexServerNotify implementation - * @return System wide error code that indicates the success of the - * GET packet operation. - */ - TInt GetPacketIndication(); - /** - * MObexServerNotify implementation - * @return System wide error code that indicates the success of the - * GET packet operation. - */ - TInt GetCompleteIndication(); - /** - * MObexServerNotify implementation - * @param aPathInfo SETPATH command parameters - * @param aInfo Not currently used - * @return System wide error code indicating the success of the - * setpath command. - */ - TInt SetPathIndication( const CObex::TSetPathInfo& aPathInfo, - const TDesC8& aInfo ); - /** - * SetObexServer - * @param aObexServer pass obex server pointer to sevice controller - * @return System wide error code. - */ - TInt SetObexServer( CObexServer* aObexServer ); - /** - * MObexServerNotify implementation - * @return none - */ - void AbortIndication(); - - void ConstructL(); - CSConFTPplugin(); - - private: - RLibrary iFTPlib; - CObexBufObject* iObject; - CBufFlat* iBuffer; - CSConFTP* iFTPHandler; - TInt iPutError; - TBool iSessionActive; - CSConServiceTimer* iServiceTimer; - TBool iStartTimer; - TSrcsMediaType iMediaType; - CObexFileObject* iFileObject; - TBool iPutPacketIndicationCalled; - CShutdownWatcher* iShutdownWatcher; - TBool iShutdownInProgress; - CObexServer* iObexServer; - RSocketServ iSocketServer; - RBTPhysicalLinkAdapter iLinkAdapter; - private: - // Friend class is used,because existing impelentation has been working - // properly. Avoiding re-design. - friend class CSConServiceTimer; - }; - -#endif // SCONPCCONNPLUGIN_H diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/plugins/ftp/inc/sconftppluginutils.h --- a/connectivitymodules/SeCon/plugins/ftp/inc/sconftppluginutils.h Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,37 +0,0 @@ -/* -* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: File Transfer Profile Plug-in Utils header -* -*/ - - -#ifndef _SCONFTPPLUGINUTILS_H -#define _SCONFTPPLUGINUTILS_H - -#include -//============================================================ -// Class TFTPpluginUtils declaration -//============================================================ -class TFTPpluginUtils - { - public: - /** - * Converts Symbian error code to OBEX error code - * @param aError The error code - * @return The converted error code - */ - static TInt ConvertFTPResponseCode( TInt aError ); - }; - -#endif // _SCONFTPPLUGINUTILS_H \ No newline at end of file diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/plugins/ftp/inc/sconservicetimer.h --- a/connectivitymodules/SeCon/plugins/ftp/inc/sconservicetimer.h Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,61 +0,0 @@ -/* -* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: File Transfer Profile Plug-in Service Timer Header file -* -*/ - - -#ifndef _SCONSERVICETIMER_H -#define _SCONSERVICETIMER_H - -#include - -class CSConFTPplugin; - - -//============================================================ -// Class CSConServiceTimer declaration -//============================================================ - -NONSHARABLE_CLASS ( CSConServiceTimer ) : public CActive - { - public: - CSConServiceTimer( CSConFTPplugin* aEngine, TInt aValue ); - void ConstructL(); - ~CSConServiceTimer(); - - /** - * Starts the timer - * @return none - */ - void StartTimer(); - /** - * Stops the timer - * @return none - */ - void StopTimer(); - - private: - void DoCancel(); - void RunL(); - - private: - RTimer iTimer; - CSConFTPplugin* iEngine; - TInt iValue; - }; - -#endif //_SCONSERVICETIMER_H - -// End of file diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/plugins/ftp/inc/sconshutdownwatcher.h --- a/connectivitymodules/SeCon/plugins/ftp/inc/sconshutdownwatcher.h Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,66 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Power shutdown -watcher header file -* -*/ - - -#ifndef _SCONSHUTDOWNWATCHER_H -#define _SCONSHUTDOWNWATCHER_H - - -#include -#include - -//============================================================ -// Class MShutdownObserver declaration -//============================================================ -class MShutdownObserver - { -public: - virtual void NotifyShutdown()=0; - }; - -//============================================================ -// Class CShutdownWatcher declaration -//============================================================ -NONSHARABLE_CLASS ( CShutdownWatcher ) : public CActive - { - public: - static CShutdownWatcher* NewL( MShutdownObserver* aObserver ); - ~CShutdownWatcher(); - - /** - * Starts to watch shutdown status - * @return none - */ - void StartShutdownWatcher(); - - private: - //construct/destruct - CShutdownWatcher( MShutdownObserver* aObserver ); - void ConstructL(); - - // from CActive - void DoCancel(); - void RunL(); - - private: - MShutdownObserver* iObserver; - RProperty iProperty; - }; - -#endif //_SCONSHUTDOWNWATCHER_H - -// End of file \ No newline at end of file diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/plugins/ftp/src/101f9686.rss --- a/connectivitymodules/SeCon/plugins/ftp/src/101f9686.rss Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,68 +0,0 @@ -/* -* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: File Transfer Profile Plug-in resource file -* -*/ - - -#include "ecom/registryinfo.rh" - -// Declares info for two implementations -RESOURCE REGISTRY_INFO theInfo - { - // UID for the DLL - dll_uid = 0x101F9686; - // Declare array of interface info - interfaces = - { - INTERFACE_INFO - { - // UID of interface that is implemented - interface_uid = 0x101F7C8C; - implementations = - { - // Info for CSConFTPplugin - IMPLEMENTATION_INFO - { - implementation_uid = 0x101F9687; - version_no = 1; - display_name = "OBEX File Transfer"; - default_data = "OBEX/BT"; - - // - // opaque_data contains parameters used by following API calls in SRCS: - // 1. Setup USB interface string descriptor in Unicode; - // 2. TInt CObex::SetLocalWho(const TDesC8& aInfo); - // 3. TInt CBTConnection::RegisterSecuritySettingsL( TUint aService, - // TInt aProtocol, - // TInt aChannel, - // TBool aAuthenticate, - // TBool aAuthorise, - // TBool aEncrypt ); - // opaque_data = "@0||@1||@2||@3||@4||@5||@6" - // @0 aStrDesc e.g. "OBEX File Transfer" - // @1 aInfo e.g. KFolderBrowsingID, "\xF9\xEC\x7B\xC4\x95\x3C\x11\xd2\x98\x4E\x52\x54\x00\xDC\x9E\x09" - // @2 aService e.g. KBTSecurityUidFileTransfer, 0x1106 - // @3 aProtocol e.g. KSolBtRFCOMM, 0x1013 - // @4 aAuthenticate e.g. EFalse, 0 - // @5 aAuthorise e.g. EFalse, 0 - // @6 aEncrypt e.g. EFalse, 0 - // - opaque_data = "OBEX File Transfer||\xF9\xEC\x7B\xC4\x95\x3C\x11\xd2\x98\x4E\x52\x54\x00\xDC\x9E\x09||0x1106||0x1013||1||1||1"; - } - }; - } - }; - } - diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/plugins/ftp/src/proxy.cpp --- a/connectivitymodules/SeCon/plugins/ftp/src/proxy.cpp Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,42 +0,0 @@ -/* -* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: File Transfer Profile Plug-in proxy implementation -* -*/ - - -// INCLUDE FILES - -#include -#include - -#include "sconftpplugin.h" - -const TImplementationProxy ImplementationTable[] = - { - IMPLEMENTATION_PROXY_ENTRY(0x101F9687, CSConFTPplugin::NewL) - }; - -// ----------------------------------------------------------------------------- -// TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) -// Exported proxy for instantiation method resolution -// ----------------------------------------------------------------------------- -// -EXPORT_C const TImplementationProxy* ImplementationGroupProxy( - TInt& aTableCount) - { - aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); - - return ImplementationTable; - } diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/plugins/ftp/src/sconftpplugin.cpp --- a/connectivitymodules/SeCon/plugins/ftp/src/sconftpplugin.cpp Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,880 +0,0 @@ -/* -* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: File Transfer Profile Plug-in implementation -* -*/ - - -// INCLUDE FILES - -#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS -#include -#endif -#include "sconftpplugin.h" -#include "sconftp.h" -#include "sconftppluginutils.h" -#include "sconservicetimer.h" -#include "debug.h" - - -// CONSTANTS -_LIT(KSConFTPLibName, "sconftp.dll"); -const TInt KSConFTPUidValue = 0x10009D8D; -const TUid KSConFTPUid = {KSConFTPUidValue}; - -// Folder listing type from IrObex specification -_LIT8( KSConFolderListType, "x-obex/folder-listing" ); - -_LIT( K_C_ROOT, "C:\\" ); -const TInt KSConBufSize = 262144; // 256KB -// Time (in milliseconds) for the timer -const TInt KSConTimeOutValue = 60000000; -// Flags used to indicate SetPath commands -const TInt KSConNULLSetPath = 0x00; - -const TInt KSConHeaderMaxLength = 256; - -// ============================= MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CSConFTPplugin::NewL() -// Two-phase constructor -// ----------------------------------------------------------------------------- -// -CSConFTPplugin* CSConFTPplugin::NewL() - { - TRACE_FUNC_ENTRY; - CSConFTPplugin* self = new ( ELeave ) CSConFTPplugin(); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - TRACE_FUNC_EXIT; - return( self ); - } - -// ----------------------------------------------------------------------------- -// CSConFTPplugin::~CSConFTPplugin() -// Destructor -// ----------------------------------------------------------------------------- -// -CSConFTPplugin::~CSConFTPplugin() - { - TRACE_FUNC_ENTRY; - - // Disconnect from services. - Disconnect(); - - if ( iFTPHandler ) - { - delete iFTPHandler; - iFTPHandler = NULL; - iFTPlib.Close(); - } - - delete iBuffer; - iBuffer = NULL; - delete iObject; - iObject = NULL; - - if ( iServiceTimer ) - { - iServiceTimer->Cancel(); - } - - delete iServiceTimer; - iServiceTimer = NULL; - - if ( iFileObject ) - { - delete iFileObject; - iFileObject = NULL; - } - - - delete iShutdownWatcher; - iShutdownWatcher = NULL; - - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConFTPplugin::IsOBEXActive() -// Returns active status of OBEX session -// ----------------------------------------------------------------------------- -// -TBool CSConFTPplugin::IsOBEXActive() - { - TRACE_FUNC; - return iSessionActive; - } - -// ----------------------------------------------------------------------------- -// CSConFTPplugin::NotifyShutdown() -// System is shutting down -// ----------------------------------------------------------------------------- -// -void CSConFTPplugin::NotifyShutdown() - { - TRACE_FUNC; - iShutdownInProgress = ETrue; - } - -// ----------------------------------------------------------------------------- -// CSConFTPplugin::LoadFTPDllL() -// Loads sconftp.dll module -// ----------------------------------------------------------------------------- -// -void CSConFTPplugin::LoadFTPDllL() - { - TRACE_FUNC_ENTRY; - // Dynamically load DLL - User::LeaveIfError( iFTPlib.Load( KSConFTPLibName ) ); - if ( iFTPlib.Type()[1] != KSConFTPUid ) - { - LOGGER_WRITE( "KSConFTPUidValue incorrect" ); - iFTPlib.Close(); - User::Leave( KErrNotFound ); - } - TSConCreateCSConFTPFunc CreateCSConFTPL = - (TSConCreateCSConFTPFunc)iFTPlib.Lookup(1); - iFTPHandler = (CSConFTP*)CreateCSConFTPL(); - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConFTPplugin::Disconnect() -// Closes initialized services -// ----------------------------------------------------------------------------- -// -void CSConFTPplugin::Disconnect() - { - TRACE_FUNC_ENTRY; - - iLinkAdapter.Close(); - iSocketServer.Close(); - - if ( iStartTimer != EFalse ) - { - iServiceTimer->Cancel(); - iServiceTimer->StartTimer(); - } - - delete iObject; - iObject = NULL; - - if ( iFileObject ) - { - delete iFileObject; - iFileObject = NULL; - } - if ( iFTPHandler ) - { - delete iFTPHandler; - iFTPHandler = NULL; - iFTPlib.Close(); - } - - TRACE_FUNC_EXIT - } - -// ----------------------------------------------------------------------------- -// CSConFTPplugin::ErrorIndication( TInt aError ) -// MObexServerNotify implementation -// ----------------------------------------------------------------------------- -// -void CSConFTPplugin::ErrorIndication( TInt aError ) - { - TRACE_FUNC_ENTRY; - LOGGER_WRITE_1( "aError : %d", aError ); - - if ( iFTPHandler ) - { - iFTPHandler->AbortFileTransfer( iObject ); - } - - if ( iObject ) - { - delete iObject; - iObject = NULL; - } - - if ( iFileObject ) - { - iFileObject->Reset(); - delete iFileObject; - iFileObject = NULL; - } - - // Keep compiler happy - (void)aError; - - delete iShutdownWatcher; - iShutdownWatcher = NULL; - - if ( iLinkAdapter.IsOpen() ) - { - // Cancel ActivateActiveRequester & allow going to low power mode - TInt err2 = iLinkAdapter.CancelLowPowerModeRequester(); - LOGGER_WRITE_1( "iLinkAdapter.CancelLowPowerModeRequester() err: %d", err2 ); - } - - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConFTPplugin::AbortIndication() -// MObexServerNotify implementation -// ----------------------------------------------------------------------------- -// -void CSConFTPplugin::AbortIndication() - { - TRACE_FUNC_ENTRY; - if ( iFTPHandler ) - { - iFTPHandler->AbortFileTransfer( iObject ); - } - - if ( iObject ) - { - delete iObject; - iObject = NULL; - } - - if ( iFileObject ) - { - iFileObject->Reset(); - delete iFileObject; - iFileObject = NULL; - } - - delete iShutdownWatcher; - iShutdownWatcher = NULL; - - if ( iLinkAdapter.IsOpen() ) - { - // Cancel ActivateActiveRequester & allow going to low power mode - TInt err = iLinkAdapter.CancelLowPowerModeRequester(); - LOGGER_WRITE_1( "iLinkAdapter.CancelLowPowerModeRequester() err: %d", err ); - } - - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConFTPplugin::TransportUpIndication() -// MObexServerNotify implementation -// ----------------------------------------------------------------------------- -// -void CSConFTPplugin::TransportUpIndication() - { - TRACE_FUNC; - } - -// ----------------------------------------------------------------------------- -// CSConFTPplugin::ObexConnectIndication( const TObexConnectInfo& aRemoteInfo, -// const TDesC8& aInfo ) -// MObexServerNotify implementation -// ----------------------------------------------------------------------------- -// -TInt CSConFTPplugin::ObexConnectIndication( - const TObexConnectInfo& /*aRemoteInfo*/, - const TDesC8& /*aInfo*/ ) - { - TRACE_FUNC_ENTRY; - TInt err( KErrNone ); - iStartTimer = ETrue; - - if ( iMediaType == ESrcsMediaBT && iObexServer ) - { - TSockAddr remoteAddr; - iObexServer->RemoteAddr( remoteAddr ); - - TBTSockAddr btSockAddr( remoteAddr ); - TBTDevAddr devAddr = btSockAddr.BTAddr(); - - err = iSocketServer.Connect(); - LOGGER_WRITE_1("iSocketServer.Connect err: %d", err ); - if ( !err ) - { - err = iLinkAdapter.Open( iSocketServer, devAddr ); - LOGGER_WRITE_1("iLinkAdapter.Open err: %d", err ); - } - // Ignore all BT link errors - err = KErrNone; - } - - if ( err == KErrNone && !iFTPHandler ) - { - TRAP( err, LoadFTPDllL() ); - LOGGER_WRITE_1( "LoadFTPDllL returned : %d", err ); - } - - if ( err == KErrNone ) - { - iFTPHandler->SetProfile( EStandard ); - LOGGER_WRITE( "CSConFTPplugin::ObexConnectIndication() : iServiceTimer->StopTimer()" ); - iServiceTimer->Cancel(); - iServiceTimer->StopTimer(); - } - - TRACE_FUNC_EXIT; - LOGGER_WRITE_1( "CSConFTPplugin::ObexConnectIndication returned %d", err ); - return TFTPpluginUtils::ConvertFTPResponseCode( err ); - } - -// ----------------------------------------------------------------------------- -// CSConFTPplugin::ObexDisconnectIndication( const TDesC8& ) -// MObexServerNotify implementation -// ----------------------------------------------------------------------------- -// -void CSConFTPplugin::ObexDisconnectIndication( const TDesC8& ) - { - TRACE_FUNC_ENTRY; - Disconnect(); - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConFTPplugin::TransportDownIndication() -// MObexServerNotify implementation -// ----------------------------------------------------------------------------- -// -void CSConFTPplugin::TransportDownIndication() - { - TRACE_FUNC_ENTRY; - Disconnect(); - if ( iBuffer ) - { - iBuffer->Reset(); - } - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConFTPplugin::PutRequestIndication() -// MObexServerNotify implementation -// ----------------------------------------------------------------------------- -// -CObexBufObject* CSConFTPplugin::PutRequestIndication() - { - TRACE_FUNC_ENTRY; - TInt ret( KErrNone ); - TInt err( KErrNone ); - iPutError = KErrNone; - - if ( iBuffer ) - { - iBuffer->Reset(); - } - - if ( iObject ) - { - delete iObject; - iObject = NULL; - } - - TRAP( err, iObject = CObexBufObject::NewL ( iBuffer ) ); - - if ( err != KErrNone ) - { - return NULL; - } - - if ( !iFTPHandler ) - { - LOGGER_WRITE( "Creating iFTPHandler has failed" ); - return NULL; - } - - TRAP( err, ret = iFTPHandler->PutFileObjectInitL( iObject, iBuffer ) ); - - if ( err != KErrNone ) - { - LOGGER_WRITE_1( "iFTPHandler->PutFileObjectInitL() leaves: %d", err ); - return NULL; - } - if ( ret != KErrNone ) - { - LOGGER_WRITE_1( "PutFileObjectInitL failed - returning error in next PutPacketIndication : %d", ret ); - iPutError = ret; - } - iPutPacketIndicationCalled = EFalse; - - if ( !iShutdownWatcher ) - { - TRAP( err, iShutdownWatcher = CShutdownWatcher::NewL( this ) ); - if ( err == KErrNone ) - { - iShutdownWatcher->StartShutdownWatcher(); - } - else - { - LOGGER_WRITE_1( "CShutdownWatcher::NewL leaves: %d", err ); - } - } - - if ( iLinkAdapter.IsOpen() ) - { - // request active BT mode (high power mode) - err = iLinkAdapter.ActivateActiveRequester(); - LOGGER_WRITE_1( "iLinkAdapter.ActivateActiveRequester() err: %d", err ); - } - - TRACE_FUNC_EXIT; - return( iObject ); - } - -// ----------------------------------------------------------------------------- -// CSConFTPplugin::PutPacketIndication() -// MObexServerNotify implementation -// ----------------------------------------------------------------------------- -// -TInt CSConFTPplugin::PutPacketIndication() - { - TRACE_FUNC_ENTRY; - TInt ret( KErrNone ); - - // always normal file transfer - if ( (TInt)iObject->Length() > 0 ) - { - if ( !iPutPacketIndicationCalled ) - { - // This is first check, need to check only once - TFileName path; - iFTPHandler->GetPath( path ); - if ( path.CompareF( K_C_ROOT ) == 0 ) - { - // path forbidden - ret = KErrAccessDenied; - } - else - { - if ( iPutError != KErrNone ) - { - ret = iPutError; - LOGGER_WRITE_1( "CSConFTPplugin::PutPacketIndication() : PutError : %d", iPutError ); - } - else - { - // check required free space - // if filesize is small ( <65k ) it fits into one package and its already saved to filesystem. - // if file is larger, need to check is there enought free space in device. - - const TUint32 filesize = iObject->Length(); - LOGGER_WRITE_1( "CSConFTPplugin::PutPacketIndication() filesize %d", filesize ); - LOGGER_WRITE_1( "CSConFTPplugin::PutPacketIndication() iObject->BytesReceived() %d", iObject->BytesReceived() ); - if ( filesize > iObject->BytesReceived() ) - { - LOGGER_WRITE( "CSConFTPplugin::PutPacketIndication() : check freespace" ); - // file does not fit into one obex packet, check is there enought free space in current drive - if ( iFTPHandler->IsCurrentDiskSpaceBelowCritical( filesize ) ) - { - LOGGER_WRITE( "CSConFTPplugin::PutPacketIndication() : returning KErrNoMemory" ); - ret = KErrNoMemory; - } - } - } - } - } - - if ( iShutdownInProgress ) - { - LOGGER_WRITE( "ShutdownInProgress, abort" ); - ret = KErrDisconnected; - } - } - - if ( !iPutPacketIndicationCalled ) - { - // Need to check only once - iPutPacketIndicationCalled = ETrue; - - //Check if filename is too long. - TFileName path; - iFTPHandler->GetPath( path ); - if ( ret == KErrNone && path.Length() + iObject->Name().Length() > KMaxFileName ) - { - LOGGER_WRITE_1( "Name length overflow! : %d", path.Length() + iObject->Name().Length() ); - ret = KErrBadName; - } - } - - if ( ret != KErrNone ) - { - if ( iFTPHandler ) - { - iFTPHandler->AbortFileTransfer( iObject ); - } - - delete iObject; - iObject = NULL; - - if ( iLinkAdapter.IsOpen() ) - { - // Cancel ActivateActiveRequester & allow going to low power mode - TInt err = iLinkAdapter.CancelLowPowerModeRequester(); - LOGGER_WRITE_1( "iLinkAdapter.CancelLowPowerModeRequester() err: %d", err ); - } - } - - LOGGER_WRITE_1( "CSConFTPplugin::PutPacketIndication returned: %d", ret ); - return TFTPpluginUtils::ConvertFTPResponseCode( ret ); - } - -// ----------------------------------------------------------------------------- -// CSConFTPplugin::PutCompleteIndication() -// MObexServerNotify implementation -// ----------------------------------------------------------------------------- -// -TInt CSConFTPplugin::PutCompleteIndication() - { - TRACE_FUNC_ENTRY; - TInt ret( KErrNone ); - TInt err( KErrNone ); - - if ( iLinkAdapter.IsOpen() ) - { - // Cancel ActivateActiveRequester & allow going to low power mode - TInt err2 = iLinkAdapter.CancelLowPowerModeRequester(); - LOGGER_WRITE_1( "iLinkAdapter.CancelLowPowerModeRequester() err: %d", err2 ); - } - - TObexHeaderMask validHdrs = iObject->ValidHeaders(); - TTime time = iObject->Time(); - - // shutdownWatcher is not needed anymore - delete iShutdownWatcher; - iShutdownWatcher = NULL; - - TInt size = iObject->BytesReceived(); - - if (!(validHdrs & KObexHdrTime)) - { - LOGGER_WRITE( "CSConFTPplugin::PutCompleteIndication() no valid time header received - using hometime" ); - time.HomeTime(); - TRAP( ret, iObject->SetTimeL(time) ); - LOGGER_WRITE_1( "CSConFTPplugin::PutCompleteIndication SetTimeL %d", ret ); - } - - if ( ( validHdrs & KObexHdrBody ) || ( validHdrs & KObexHdrEndOfBody ) ) - { - LOGGER_WRITE_1( "CSConFTPplugin::PutCompleteIndication : number of received bytes %d", size ); - TSConUsedMedia media( ESConNoMedia ); - - switch ( iMediaType ) - { - case ESrcsMediaBT: - media = ESConBTMedia; - break; - case ESrcsMediaIrDA: - media = ESConIRMedia; - break; - case ESrcsMediaUSB: - media = ESConUSBMedia; - break; - default: - media = ESConNoMedia; - break; - } - iFTPHandler->SetUsedMedia( media ); - - TRAP( ret, err = - this->iFTPHandler->PutFileObjectFinalizeL( iObject ) ); - LOGGER_WRITE_1( "CSConFTPplugin::PutCompleteIndication :PutFileObjectL %d", ret ); - } - else - { - LOGGER_WRITE( "CSConFTPplugin::PutCompleteIndication() : Delete starts" ); - TRAP( ret, err = this->iFTPHandler->DeleteObjectL( iObject->Name() ) ); - LOGGER_WRITE_1( "CSConFTPplugin::PutCompleteIndication : DeleteObjectL %d", ret ); - } - - if ( iObject ) - { - delete iObject; - iObject = NULL; - } - - iFTPHandler->DeleteTempFile(); - - if ( ret != KErrNone ) - { - LOGGER_WRITE_1( "CSConFTPplugin::PutCompleteIndication : returned %d", ret ); - return TFTPpluginUtils::ConvertFTPResponseCode( ret ); - } - - LOGGER_WRITE_1( "CSConFTPplugin::PutCompleteIndication : returned %d", err ); - return TFTPpluginUtils::ConvertFTPResponseCode( err ); - } - -// ----------------------------------------------------------------------------- -// CSConFTPplugin::GetRequestIndication( CObexBaseObject* aRequiredObject ) -// MObexServerNotify implementation -// ----------------------------------------------------------------------------- -// -CObexBufObject* CSConFTPplugin::GetRequestIndication( - CObexBaseObject* aRequiredObject ) - { - TRACE_FUNC_ENTRY; - CObexBufObject* bufObject(NULL); - if ( aRequiredObject->Type().Length() > KSConHeaderMaxLength ) - { - LOGGER_WRITE("TypeHeader too big"); - return NULL; - } - if ( aRequiredObject->Name().Length() > KMaxFileName ) - { - LOGGER_WRITE("NameHeader is too long"); - return NULL; - } - TInt ret( KErrNone ); - TInt err( KErrNone ); - TBuf8 typeHeader( aRequiredObject->Type() ); - TrimRightSpaceAndNull( typeHeader ); - LOGGER_WRITE8_1("type: %S", &typeHeader); - LOGGER_WRITE_1("name: %S", &aRequiredObject->Name()); - - iBuffer->Reset(); - - delete iObject; - iObject = NULL; - - TRAP( err, iObject = CObexBufObject::NewL ( iBuffer ) ); - if ( err != KErrNone ) - { - return NULL; - } - - // Client requests folder listing - if ( typeHeader == KSConFolderListType ) - { - LOGGER_WRITE( "Client requests folder listning" ); - if ( !iFTPHandler ) - { - LOGGER_WRITE( "Creating iFTPHandler has failed" ); - return NULL; - } - - TRAP( err, ret = iFTPHandler->GetFolderObjectL( iObject ) ); - LOGGER_WRITE_1( "iFTPHandler->GetFolderObjectL() returned: %d", ret ); - if ( err == KErrNone && ret == KErrNone ) - { - bufObject = iObject; - } - else - { - LOGGER_WRITE_1( "CSConFTPplugin::GetRequestIndication : Leavecode returned %d", err ); - return NULL; - } - } - - // Client requests a file - else - { - if ( iFileObject ) - { - delete iFileObject; - iFileObject = NULL; - } - - TRAP( err, iFileObject = CObexFileObject::NewL() ); - if ( err != KErrNone ) - { - LOGGER_WRITE( "Creating iFileObject has failed" ); - return NULL; - } - iFileObject->Reset(); - TRAP( err, iFileObject->SetNameL( aRequiredObject->Name() ) ); - - if ( err == KErrNone ) - { - if ( !iFTPHandler ) - { - LOGGER_WRITE( "CSConFTPplugin::GetRequestIndication() Creating iFTPHandler has failed" ); - return NULL; - } - - TRAP( err, ret = - this->iFTPHandler->GetFileObjectL( iFileObject ) ); - LOGGER_WRITE_1( "CSConFTPplugin::GetRequestIndication : GetFileObjectL returned %d", ret ); - } - if ( err == KErrNone && ret == KErrNone ) - { - bufObject = (CObexBufObject*)iFileObject; - } - else - { - LOGGER_WRITE_1( "CSConFTPplugin::GetRequestIndication : Leavecode %d", err ); - return NULL; - } - } - if ( bufObject && iLinkAdapter.IsOpen() ) - { - // request active BT mode (high power mode) - err = iLinkAdapter.ActivateActiveRequester(); - LOGGER_WRITE_1( "iLinkAdapter.ActivateActiveRequester() err: %d", err ); - } - return bufObject; - } - -// ----------------------------------------------------------------------------- -// CSConFTPplugin::GetPacketIndication() -// MObexServerNotify implementation -// ----------------------------------------------------------------------------- -// -TInt CSConFTPplugin::GetPacketIndication() - { - TRACE_FUNC; - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// CSConFTPplugin::GetCompleteIndication() -// MObexServerNotify implementation -// ----------------------------------------------------------------------------- -// -TInt CSConFTPplugin::GetCompleteIndication() - { - TRACE_FUNC_ENTRY; - if ( iLinkAdapter.IsOpen() ) - { - // Cancel ActivateActiveRequester & allow going to low power mode - TInt err = iLinkAdapter.CancelLowPowerModeRequester(); - LOGGER_WRITE_1( "iLinkAdapter.CancelLowPowerModeRequester() err: %d", err ); - } - - TInt ret( KErrNone ); - if ( iFileObject ) - { - iFileObject->Reset(); - delete iFileObject; - iFileObject = NULL; - } - - LOGGER_WRITE_1( "CSConFTPplugin::GetCompleteIndication() : returned %d", ret ); - return ret; - } - -// ----------------------------------------------------------------------------- -// CSConFTPplugin::SetPathIndication( const CObex::TSetPathInfo& aPathInfo, -// const TDesC8& aInfo ) -// MObexServerNotify implementation -// ----------------------------------------------------------------------------- -// -TInt CSConFTPplugin::SetPathIndication( const CObex::TSetPathInfo& aPathInfo, - const TDesC8& /*aInfo*/ ) - { - TRACE_FUNC_ENTRY; - TInt ret( KErrNone ); - TInt err( KErrNone ); - - if ( !iFTPHandler ) - { - LOGGER_WRITE( "Creating iFTPHandler has failed" ); - return TFTPpluginUtils::ConvertFTPResponseCode( KErrNoMemory ); - } - - if ( aPathInfo.iFlags == KSConNULLSetPath ) - { - TRAP( err, ret = this->iFTPHandler->CreateFolderL( aPathInfo.iName ) ); - } - else - { - TRAP( err, ret = this->iFTPHandler->SetPathL( aPathInfo.iName, - aPathInfo.iFlags ) ); - } - - if ( err != KErrNone ) - { - LOGGER_WRITE_1( "CSConFTPplugin::SetPathIndication : returned %d", err ); - return TFTPpluginUtils::ConvertFTPResponseCode( err ); - } - LOGGER_WRITE_1( "CSConFTPplugin::SetPathIndication : returned %d", ret ); - return TFTPpluginUtils::ConvertFTPResponseCode( ret ); - } - -// ----------------------------------------------------------------------------- -// CSConFTPplugin::TrimRightSpaceAndNull( TDes8& aDes ) const -// Removes spaces and nulls from the end of the string -// ----------------------------------------------------------------------------- -// -void CSConFTPplugin::TrimRightSpaceAndNull( TDes8& aDes ) const - { - TRACE_FUNC; - aDes.TrimRight(); - if ( aDes.Length() > 0 ) - { - if ( !aDes[aDes.Length() - 1] ) - { - aDes.SetLength( aDes.Length() - 1 ); - } - } - } - -// ----------------------------------------------------------------------------- -// CSConFTPplugin::SetMediaType ( TSrcsMediaType aMediaType ) -// Current used transfer media (IR,USB,BT) -// ----------------------------------------------------------------------------- -// -void CSConFTPplugin::SetMediaType ( TSrcsMediaType aMediaType ) - { - TRACE_FUNC; - iMediaType = aMediaType; - } - -// ----------------------------------------------------------------------------- -// CSConFTPplugin::CSConFTPplugin() -// Constructor -// ----------------------------------------------------------------------------- -// -CSConFTPplugin::CSConFTPplugin() - { - TRACE_FUNC; - iBuffer = NULL; - iObject = NULL; - iFileObject = NULL; - iSessionActive = EFalse; - } - -// ----------------------------------------------------------------------------- -// CSConFTPplugin::ConstructL() -// Initializes member data -// ----------------------------------------------------------------------------- -// -void CSConFTPplugin::ConstructL() - { - TRACE_FUNC_ENTRY; - iBuffer = CBufFlat::NewL( KSConBufSize ); - iObject = CObexBufObject::NewL ( iBuffer ); - iServiceTimer = new (ELeave) CSConServiceTimer( this, KSConTimeOutValue ); - iServiceTimer->ConstructL(); - CActiveScheduler::Add( iServiceTimer ); - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConFTPplugin::SetObexServer( CObexServer* aObexServer ) -// SetObexServer -// ----------------------------------------------------------------------------- -// -TInt CSConFTPplugin::SetObexServer( CObexServer* aObexServer ) - { - iObexServer = aObexServer; - TInt ret = iObexServer->Start(this); - LOGGER_WRITE_1( "CSConFTPplugin::SetObexServer() ret: %d", ret ); - return ret; - } - -// End of file - diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/plugins/ftp/src/sconftppluginutils.cpp --- a/connectivitymodules/SeCon/plugins/ftp/src/sconftppluginutils.cpp Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,129 +0,0 @@ -/* -* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: File Transfer Profile Plug-in utilities -* -*/ - - -// INCLUDE FILES -#include -#include "sconftppluginutils.h" -#include "debug.h" - -// ============================= MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// TFTPpluginUtils::ConvertFTPResponseCode( TInt aError ) -// Converts Symbian error code to OBEX error code -// ----------------------------------------------------------------------------- -// -TInt TFTPpluginUtils::ConvertFTPResponseCode( TInt aError ) - { - LOGGER_WRITE_1( "TFTPpluginUtils::ConvertFTPResponseCode : begin Code %d", aError ); - TInt obexErr ( KErrIrObexRespBadRequest ); - switch( aError ) - { - case KErrNone: - obexErr = KErrNone; - break; - case KErrNotFound: - obexErr = KErrIrObexRespNotFound; - break; - case KErrGeneral: - case KErrCancel: - obexErr = KErrIrObexRespBadRequest; - break; - case KErrNoMemory: - obexErr = KErrIrObexRespDatabaseFull; - break; - case KErrNotSupported: - obexErr = KErrIrObexRespNotImplemented; - break; - case KErrArgument: - case KErrTotalLossOfPrecision: - case KErrBadHandle: - case KErrOverflow: - case KErrUnderflow: - case KErrAlreadyExists: - obexErr = KErrIrObexRespConflict; - break; - case KErrPathNotFound: - case KErrDied: - obexErr = KErrIrObexRespNotFound; - break; - case KErrInUse: - obexErr = KErrIrObexRespTimedOut; - break; - case KErrServerTerminated: - obexErr = KErrIrObexRespNotFound; - break; - case KErrServerBusy: - case KErrCompletion: - case KErrNotReady: - case KErrUnknown: - case KErrCorrupt: - obexErr = KErrIrObexRespForbidden; - break; - case KErrAccessDenied: - case KErrLocked: - obexErr = KErrIrObexRespUnauthorized; - break; - case KErrWrite: - case KErrDisMounted: - case KErrEof: - obexErr = KErrIrObexRespForbidden; - break; - case KErrDiskFull: - obexErr = KErrIrObexRespDatabaseFull; - break; - case KErrBadDriver: - case KErrBadName: - obexErr = KErrIrObexRespPreCondFailed; - break; - case KErrCommsLineFail: - case KErrCommsFrame: - case KErrCommsOverrun: - case KErrCommsParity: - case KErrTimedOut: - case KErrCouldNotConnect: - case KErrCouldNotDisconnect: - case KErrBadLibraryEntryPoint: - case KErrBadDescriptor: - case KErrAbort: - obexErr = KErrIrObexRespForbidden; - break; - case KErrTooBig: - obexErr = KErrIrObexRespReqEntityTooLarge; - break; - case KErrDivideByZero: - case KErrBadPower: - case KErrDirFull: - case KErrHardwareNotAvailable: - obexErr = KErrIrObexRespForbidden; - break; - case KErrDisconnected: // System is shutting down - obexErr = KErrIrObexRespMethodNotAllowed; - break; - default: - obexErr = KErrIrObexRespBadRequest; - break; - }; - LOGGER_WRITE_1( "TFTPpluginUtils::ConvertFTPResponseCode : returned %d", obexErr ); - return obexErr; -}; - -//End of file - - - diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/plugins/ftp/src/sconservicetimer.cpp --- a/connectivitymodules/SeCon/plugins/ftp/src/sconservicetimer.cpp Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,119 +0,0 @@ -/* -* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: File Transfer Profile Plug-in Service Timer implementation -* -*/ - - -// INCLUDE FILES - -#include "sconservicetimer.h" -#include "sconftpplugin.h" -#include "debug.h" - -// ============================= MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CSConServiceTimer::CSConServiceTimer( CSConFTPplugin* aEngine, TInt aValue ) -// Constuctor -// ----------------------------------------------------------------------------- -// -CSConServiceTimer::CSConServiceTimer( CSConFTPplugin* aEngine, TInt aValue ) - : CActive( EPriorityStandard ), iEngine( aEngine ), iValue( aValue ) {} - -// ----------------------------------------------------------------------------- -// CSConServiceTimer::ConstructL() -// Initializes member data -// ----------------------------------------------------------------------------- -// -void CSConServiceTimer::ConstructL() - { - LOGGER_ENTERFN( "CSConServiceTimer::ConstructL()" ); - // create a thread-relative timer - User::LeaveIfError( iTimer.CreateLocal() ); - LOGGER_LEAVEFN( "CSConServiceTimer::ConstructL()" ); - } - -// ----------------------------------------------------------------------------- -// CSConServiceTimer::~CSConServiceTimer() -// Destructor -// ----------------------------------------------------------------------------- -// -CSConServiceTimer::~CSConServiceTimer() - { - LOGGER_ENTERFN( "CSConServiceTimer::~CSConServiceTimer()" ); - iTimer.Close(); - LOGGER_LEAVEFN( "CSConServiceTimer::~CSConServiceTimer()" ); - } - -// ----------------------------------------------------------------------------- -// CSConServiceTimer::~CSConServiceTimer() -// Starts the timer -// ----------------------------------------------------------------------------- -// -void CSConServiceTimer::StartTimer() - { - LOGGER_ENTERFN( "CSConServiceTimer::StartTimer()" ); - if( !IsActive() ) - { - LOGGER_WRITE( "CSConServiceTimer::StartTimer() : !IsActive()" ); - iTimer.After( iStatus, TTimeIntervalMicroSeconds32( iValue ) ); - iEngine->iSessionActive = ETrue; - SetActive(); - LOGGER_WRITE( "CSConServiceTimer::StartTimer() : SetActive()" ); - } - LOGGER_LEAVEFN( "CSConServiceTimer::StartTimer()" ); - } - -// ----------------------------------------------------------------------------- -// CSConServiceTimer::StopTimer() -// StopTimer() -// ----------------------------------------------------------------------------- -// -void CSConServiceTimer::StopTimer() - { - LOGGER_ENTERFN( "CSConServiceTimer::StopTimer()" ); - iEngine->iSessionActive = ETrue; - LOGGER_WRITE( "CSConServiceTimer::StopTimer() : iSessionActive = ETrue" ); - LOGGER_LEAVEFN( "CSConServiceTimer::StopTimer()" ); - } - -// ----------------------------------------------------------------------------- -// CSConServiceTimer::DoCancel() -// Cancels the timer -// ----------------------------------------------------------------------------- -// -void CSConServiceTimer::DoCancel() - { - LOGGER_ENTERFN( "CSConServiceTimer::DoCancel()" ); - iTimer.Cancel(); - LOGGER_LEAVEFN( "CSConServiceTimer::DoCancel()" ); - } - -// ----------------------------------------------------------------------------- -// CSConServiceTimer::RunL() -// Executed when timer is triggered -// ----------------------------------------------------------------------------- -// -void CSConServiceTimer::RunL() - { - LOGGER_ENTERFN( "CSConServiceTimer::RunL()" ); - iEngine->iSessionActive = EFalse; - LOGGER_WRITE( "CSConServiceTimer::RunL() : iSessionActive = EFalse" ); - iEngine->iStartTimer = EFalse; - LOGGER_WRITE( "CSConServiceTimer::RunL() : iStartTimer = EFalse " ); - LOGGER_LEAVEFN( "CSConServiceTimer::RunL()" ); - } - -// End of file diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/plugins/ftp/src/sconshutdownwatcher.cpp --- a/connectivitymodules/SeCon/plugins/ftp/src/sconshutdownwatcher.cpp Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,153 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Power shutdown -watcher implementation -* -*/ - - -// INCLUDE FILES - -#include "sconshutdownwatcher.h" -#include "debug.h" - -#include - - - -// ============================= MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CShutdownWatcher::NewL( MShutdownObserver* aObserver ) -// Two-phase constructor -// ----------------------------------------------------------------------------- -// -CShutdownWatcher* CShutdownWatcher::NewL( MShutdownObserver* aObserver ) - { - LOGGER_ENTERFN( "CShutdownWatcher::NewL()" ); - CShutdownWatcher* self = new (ELeave) CShutdownWatcher( aObserver ); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(self); - LOGGER_LEAVEFN( "CShutdownWatcher::NewL()" ); - return self; - } - -// ----------------------------------------------------------------------------- -// CShutdownWatcher::~CShutdownWatcher() -// Destructor -// ----------------------------------------------------------------------------- -// -CShutdownWatcher::~CShutdownWatcher() - { - LOGGER_ENTERFN( "CShutdownWatcher::~CShutdownWatcher()" ); - Cancel(); - iProperty.Close(); - LOGGER_LEAVEFN( "CShutdownWatcher::~CShutdownWatcher()" ); - } - -// ----------------------------------------------------------------------------- -// CShutdownWatcher::StartShutdownWatcher() -// Starts to watch shutdown status -// ----------------------------------------------------------------------------- -// -void CShutdownWatcher::StartShutdownWatcher() - { - LOGGER_ENTERFN( "CShutdownWatcher::StartShutdownWatcher()" ); - TInt status; - TInt err = iProperty.Get( KPSUidStartup, KPSGlobalSystemState, status ); - LOGGER_WRITE_2( "CShutdownWatcher::StartShutdownWatcher() :\ - err %d, KPSGlobalSystemState status %d", err, status); - if ( err == KErrNone ) - { - if ( status == ESwStateShuttingDown ) - { - LOGGER_WRITE( "Call NotifyShutdown" ); - iObserver->NotifyShutdown(); - return; - } - } - - err = iProperty.Attach( KPSUidStartup, KPSGlobalSystemState ); - LOGGER_WRITE_1( "CShutdownWatcher::StartShutdownWatcher() :\ - iProperty.Attach( KPSUidStartup, KPSGlobalSystemState ) : err %d", err ); - iProperty.Subscribe( iStatus ); - LOGGER_WRITE( "CShutdownWatcher::StartShutdownWatcher() :\ - iProperty.Subscribe( iStatus ) : ok" ); - SetActive(); - - LOGGER_LEAVEFN( "CShutdownWatcher::StartShutdownWatcher()" ); - } - -// ----------------------------------------------------------------------------- -// CShutdownWatcher::DoCancel() -// Executed when CActive is canceled. -// ----------------------------------------------------------------------------- -// -void CShutdownWatcher::DoCancel() - { - LOGGER_ENTERFN( "CShutdownWatcher::DoCancel()" ); - iProperty.Cancel(); - LOGGER_LEAVEFN( "CShutdownWatcher::DoCancel()" ); - } - -// ----------------------------------------------------------------------------- -// CShutdownWatcher::RunL() -// Executed when disk watcher is triggered -// ----------------------------------------------------------------------------- -// -void CShutdownWatcher::RunL() - { - LOGGER_ENTERFN( "CShutdownWatcher::RunL()" ); - TInt status; - iProperty.Get( status ); - LOGGER_WRITE_1( "CShutdownWatcher::RunL() : status %d", status ); - - if ( status == ESwStateShuttingDown ) - { - LOGGER_WRITE( "Call NotifyShutdown" ); - iObserver->NotifyShutdown(); - return; - } - - iProperty.Cancel(); - iProperty.Close(); - - LOGGER_LEAVEFN( "CShutdownWatcher::RunL()" ); - } - - -// ----------------------------------------------------------------------------- -// CShutdownWatcher::CShutdownWatcher( MShutdownObserver* aObserver ) -// Default constructor -// ----------------------------------------------------------------------------- -// -CShutdownWatcher::CShutdownWatcher( MShutdownObserver* aObserver ) -: CActive(EPriorityStandard), - iObserver(aObserver) - { - } - -// ----------------------------------------------------------------------------- -// CShutdownWatcher::ConstructL() -// Initializes member data -// ----------------------------------------------------------------------------- -// -void CShutdownWatcher::ConstructL() - { - LOGGER_ENTERFN( "CShutdownWatcher::ConstructL()" ); - CActiveScheduler::Add(this); - LOGGER_LEAVEFN( "CShutdownWatcher::ConstructL()" ); - } - -// End of file diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/plugins/hapticsconnplugin/data/2001FE54.rss --- a/connectivitymodules/SeCon/plugins/hapticsconnplugin/data/2001FE54.rss Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,74 +0,0 @@ -/* -* Copyright (c) 2001 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Plugin info file. -* -*/ - - -#include "ecom/registryinfo.rh" - -// Declares info for two implementations -RESOURCE REGISTRY_INFO theInfo - { - // UID for the DLL - dll_uid = 0x2001FE54; - // Declare array of interface info - interfaces = - { - INTERFACE_INFO - { - // UID of interface that is implemented - interface_uid = 0x101F7C8C; - implementations = - { - IMPLEMENTATION_INFO - { - implementation_uid = 0x2001FE53; - version_no = 1; - display_name = "Haptics Bridge"; - default_data = "OBEX/USB||OBEX/BT"; - // - // opaque_data contains parameters used by following API calls in SRCS: - // 1. Setup USB interface string descriptor in Unicode; - // 2. TInt CObex::SetLocalWho(const TDesC8& aInfo); - // 3. TInt CBTConnection::RegisterSecuritySettingsL( TUint aService, - // TInt aProtocol, - // TInt aChannel, - // TBool aAuthenticate, - // TBool aAuthorise, - // TBool aEncrypt ); - // opaque_data = "@0||@1||@2||@3||@4||@5||@6" - // @0 aStrDesc e.g. "PC Connectivity" - // @1 aInfo e.g. KFolderBrowsingID, "\xF9\xEC\x7B\xC4\x95\x3C\x11\xd2\x98\x4E\x52\x54\x00\xDC\x9E\x09" - // @2 aService e.g. KBTSecurityUidFileTransfer, 0x1106 - // @3 aProtocol e.g. KSolBtRFCOMM, 0x1013 - // @4 aAuthenticate e.g. EFalse, 0 - // @5 aAuthorise e.g. EFalse, 0 - // @6 aEncrypt e.g. EFalse, 0 - // - opaque_data = "Haptics Bridge|"\ - "|\xF9\xEC\x7B\xC4\x95\x3C\x11\xd2\x98\x4E\x52\x54\x00\xDC\x9E\x09|"\ - "|0x2001E2B5|"\ - "|0x1013|"\ - "|0|"\ - "|1|"\ - "|0|"\ - "|0xffff|"\ - "|0xffff"; - } - }; - } - }; - } - diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/plugins/hapticsconnplugin/group/bld.inf --- a/connectivitymodules/SeCon/plugins/hapticsconnplugin/group/bld.inf Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Haptics connection plugin build file. -* -*/ - -#include - -PRJ_PLATFORMS -DEFAULT - -PRJ_EXPORTS -../rom/hapticsconnplugin.iby CORE_IBY_EXPORT_PATH(mw, hapticsconnplugin.iby) - -PRJ_MMPFILES -hapticsconnplugin.mmp - diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/plugins/hapticsconnplugin/group/hapticsconnplugin.mmp --- a/connectivitymodules/SeCon/plugins/hapticsconnplugin/group/hapticsconnplugin.mmp Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,58 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Haptics connection plugin project definition file. -* -*/ - - -#include -#include - -VENDORID VID_DEFAULT - -CAPABILITY CAP_ECOM_PLUGIN - -TARGET hapticsconnplugin.dll -TARGETTYPE PLUGIN - -UID 0x10009D8D 0x2001FE54 - -SOURCEPATH ../src - -SOURCE hapticsconnplugin.cpp -SOURCE hapticsconntimer.cpp -SOURCE hapticsmsghandler.cpp -SOURCE hapticsbridgeclient.cpp -SOURCE proxy.cpp - -SOURCEPATH ../data - -START RESOURCE 2001FE54.rss - TARGET hapticsconnplugin.rsc -END - -MW_LAYER_SYSTEMINCLUDE -SYSTEMINCLUDE /epoc32/include/stdapis - -USERINCLUDE ../inc - -LIBRARY flogger.lib -LIBRARY euser.lib -LIBRARY ecom.lib -LIBRARY efsrv.lib -LIBRARY avkon.lib -LIBRARY bafl.lib -LIBRARY platformenv.lib -LIBRARY irobex.lib -LIBRARY hwrmhapticspacketizer.lib diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/plugins/hapticsconnplugin/inc/hapticsbridgeclient.h --- a/connectivitymodules/SeCon/plugins/hapticsconnplugin/inc/hapticsbridgeclient.h Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,101 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Client interface to haptics server for haptics bridge -* commands. -* -*/ - - -#ifndef C_HAPTICSBRIDGECLIENT_H -#define C_HAPTICSBRIDGECLIENT_H - -#include - -class CHWRMHapticsPacketizer; - -class RHapticsBridgeClient : public RSessionBase -{ -public: - /** - * Constructor - */ - RHapticsBridgeClient(); - - /** - * Destructor - */ - virtual ~RHapticsBridgeClient(); - -public: - /** - * Create a connection to haptics server. - */ - TInt Connect(); - - /** - * Close the connection to haptics server. - */ - void Close(); - - /** - * Send message to haptics server. - * @param aReqData Data request to be sent to haptics server. - * @param aRetDataPckg Returned data from haptics server. - * @return KErrNone if sent succesfully, otherwise system wide error code. - */ - TInt SendBridgeBuffer( const TDesC8& aReqData, TDes8& aRetDataPckg ); - - /** - * Sends a message clean-up commend to haptics server. - */ - void CleanUp(); - - -private: - - /** - * Returns the version of the haptics server. - * @return Version. - */ - TVersion ServerVersion() const; - - /** - * Starts the server process if it is not already running. - * @return KErrNone on success, otherwise a system error code. - */ - TInt StartServer() const; - - /** - * Handles the device opening request. - * @param aResponse Reference to a descriptor containing the response - * received from haptics server. - */ - void HandleOpenDeviceResponseL( const TDesC8& aResponse ); - - /** - * Opens the haptic effect ("vibra") device. - * @return KErrNone on success, otherwise a system error code. - */ - TInt OpenHapticsDevice(); - -private: - - /** - * Haptic packetizer. - * Owned. - */ - CHWRMHapticsPacketizer* iPacketizer; -}; - -#endif // C_HAPTICSBRIDGECLIENT_H \ No newline at end of file diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/plugins/hapticsconnplugin/inc/hapticsconnplugin.h --- a/connectivitymodules/SeCon/plugins/hapticsconnplugin/inc/hapticsconnplugin.h Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,66 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Haptics OBEX connection plugin. -* -*/ - - -#ifndef C_HAPTICSCONNPLUGIN_H -#define C_HAPTICSCONNPLUGIN_H - -#include -#include - -class CHapticsMsgHandler; - -class CHapticsConnPlugin : public CSrcsInterface - { - public: - /** - * 2-phased constructor. - */ - static CHapticsConnPlugin* NewL(); - - /** - * Destructor. - */ - virtual ~CHapticsConnPlugin(); - - /** - * From CSrcsInterface. - * @see CSrcsInterface. - */ - TBool IsOBEXActive(); - - private: - /** - * 2nd phase constructor. - */ - void ConstructL(); - - /** - * Constructor. - */ - CHapticsConnPlugin(); - - private: - /** - * Component to handle messages between file systen and - * haptics server. - * Own. - */ - CHapticsMsgHandler* iMsgHandler; - }; - -#endif // C_HAPTICSCONNPLUGIN_H \ No newline at end of file diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/plugins/hapticsconnplugin/inc/hapticsconntimer.h --- a/connectivitymodules/SeCon/plugins/hapticsconnplugin/inc/hapticsconntimer.h Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,71 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Connection shutdown timer for haptics server connection. -* -*/ - - -#ifndef C_HAPTICSCONNTIMER_H -#define C_HAPTICSCONNTIMER_H - -#include - -#include "hapticsmsghandler.h" - -NONSHARABLE_CLASS ( CHapticsConnTimer ) : public CTimer - { - public: - /** - * 2-phased constructor. - */ - static CHapticsConnTimer* NewL( MHapticsConnectionShutdown* aCallback ); - - /** - * Destructor. - */ - virtual ~CHapticsConnTimer(); - - /** - * Starts the timer - */ - void Start(); - - private: // From CActive. - /** - * Notifies client on timeout. - */ - void RunL(); - - private: - /** - * Constructor. - */ - CHapticsConnTimer( MHapticsConnectionShutdown* aCallback ); - - /** - * 2nd phase constructor. - */ - void ConstructL(); - - private: - /** - * Callback interface to notify about timeout. - * Not own. - */ - MHapticsConnectionShutdown* iCallback; - }; - -#endif // C_HAPTICSCONNTIMER_H - -// End of file diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/plugins/hapticsconnplugin/inc/hapticsconntrace.h --- a/connectivitymodules/SeCon/plugins/hapticsconnplugin/inc/hapticsconntrace.h Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,113 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Haptics conn plugin debug trace macro definition header file. -* -*/ -#ifndef HAPTICSCONNTRACE_H -#define HAPTICSCONNTRACE_H - -#include -#include -#include -#include -#include - -/** - * Writes formatted string data to a file using RFileLogger. - * - * @param aFmt Value-referenced descriptor containing the formatted string. - */ -inline void HwrmWriteFormat( TRefByValue aFmt, ... ) - { - _LIT( KDir, "Hwrm" ); - _LIT( KName, "Hwres.log" ); - - // take the ellipsis parameters - VA_LIST args; - VA_START( args, aFmt ); - RFileLogger::WriteFormat( KDir, KName, EFileLoggingModeAppend, aFmt, args ); - VA_END( args ); - } - -/** - * Writes data dump in hex format in "[ 00 01 FF ]" style. - * - * @param aPrefix Descriptor containing the string to be appended in - * front of the actual data dump. - * @param aData An 8-bit descriptor containing the data buffer for which - * the data dump is written. - */ -inline void DataDumpTrace( const TDesC& aPrefix, const TDesC8& aData ) - { - _LIT( KSATraceDataDumpStart, " [ " ); - _LIT( KSATraceDataDumpLineAlign, " " ); - _LIT( KSATraceDataDumpStop, " ] " ); - _LIT( KSATraceDataDumpValue, "%02x " ); - const TInt KSASDataDumpTraceBytesPerLine = 10; - - HBufC* buffer = HBufC::New( 255 ); - - if ( buffer != NULL ) - { - buffer->Des().Copy( aPrefix ); - buffer->Des().Append( KSATraceDataDumpStart ); - for ( TInt i = 0; i < aData.Length(); i++) - { - buffer->Des().AppendFormat( KSATraceDataDumpValue, aData[i] ); - - if( ( i % KSASDataDumpTraceBytesPerLine == ( KSASDataDumpTraceBytesPerLine - 1 ) ) && - ( i + 1 < aData.Length() ) ) - { - RDebug::Print( buffer->Des() ); - - buffer->Des().Copy( aPrefix); - buffer->Des().Append( KSATraceDataDumpLineAlign ); - } - } - buffer->Des().Append( KSATraceDataDumpStop ); - - RDebug::Print( buffer->Des() ); - - } - - delete buffer; - } - -#ifdef _DEBUG - - #ifdef USE_FILE_LOGGING - - #define COMPONENT_TRACE( a ) HwrmWriteFormat a - #define API_TRACE( a ) HwrmWriteFormat a - #define DATADUMP_TRACE( a, b ) - - #else - - #define COMPONENT_TRACE( a ) RDebug::Print a - #define API_TRACE( a ) RDebug::Print a - #define DATADUMP_TRACE( a, b ) DataDumpTrace( a, b ) - - #endif // #ifdef USE_FILE_LOGGING - -#else // #ifdef _DEBUG - - #define COMPONENT_TRACE( a ) - #define API_TRACE( a ) - #define DATADUMP_TRACE( a, b ) - -#endif //#ifdef _DEBUG -#endif //#ifndef HAPTICSCONNTRACE_H - - -// End of File diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/plugins/hapticsconnplugin/inc/hapticsmsghandler.h --- a/connectivitymodules/SeCon/plugins/hapticsconnplugin/inc/hapticsmsghandler.h Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,136 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Handles messaging between file system and haptics -* client interface. -* -*/ - - -#ifndef C_HAPTICSMSGHANDLER_H -#define C_HAPTICSMSGHANDLER_H - -#include -#include -#include - -#include "hapticsbridgeclient.h" - -class CHapticsConnTimer; - -/** - * Interface to notify about connection timeout. - */ -class MHapticsConnectionShutdown - { - public: - /** - * Called to notify about connection timeout. - */ - virtual void NotifyShutdown() = 0; - - }; - -/** - * Helper class for Bridge functionality for handling RFs (File Session) - * change notifications for VibeTonz request file. - * - * @since S60 5.1 - */ -class CHapticsMsgHandler : public CActive, - public MHapticsConnectionShutdown - { -public: - /** - * 2-phased constructor. - */ - static CHapticsMsgHandler* NewL(); - - /** - * Destructor - */ - virtual ~CHapticsMsgHandler(); - - /** - * Method for starting the listening for change notifications - */ - void StartNotifier(); - - /** - * From MHapticsConnectionShutdown. - * Called to notify about connection timeout. - */ - void NotifyShutdown(); - -protected: // From CActive. - /** - * @see CActive - */ - void RunL(); - /** - * @see CActive - */ - TInt RunError(TInt aError); - /** - * @see CActive - */ - void DoCancel(); - -private: - - /** - * Constructor - */ - CHapticsMsgHandler(); - - /** - * Two-phase construction ConstructL - */ - void ConstructL(); - - /** - * Method for connecting to file system. Also sets the paths and - * creates directories (if not already exists). - */ - void ConnectToFilesystemL(); - - /** - * Helper for clearing the possible left-over request file from - * previous runs. - */ - void ClearRequestFile(); - -private: // data - - /** - * File server session through which all file server related - * services are requested. - */ - RFs iFs; - - /** - * Buffer for the request file data - */ - HBufC8* iReqBuf; - - /** - * The RHapticsBridgeClient object that is responsible for further - * handling of received Bridge commands - */ - RHapticsBridgeClient iClient; - - CHapticsConnTimer* iConnectionTimeout; - - }; - -#endif // C_HAPTICSMSGHANDLER_H diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/plugins/hapticsconnplugin/rom/hapticsconnplugin.iby --- a/connectivitymodules/SeCon/plugins/hapticsconnplugin/rom/hapticsconnplugin.iby Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: IBY file for Haptics conn plugin. -* -*/ - - -#ifndef HAPTICSCONNPLUGIN_IBY -#define HAPTICSCONNPLUGIN_IBY - -#include - -ECOM_PLUGIN(hapticsconnplugin.dll,hapticsconnplugin.rsc) - -#endif // HAPTICSCONNPLUGIN_IBY diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/plugins/hapticsconnplugin/src/hapticsbridgeclient.cpp --- a/connectivitymodules/SeCon/plugins/hapticsconnplugin/src/hapticsbridgeclient.cpp Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,317 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Client interface to haptics server for haptics bridge -* commands. -* -*/ - - -#include -#include -#include // KDC_PROGRAMS_DIR -#include -#include -#include - -#include "hapticsbridgeclient.h" -#include "hapticsconntrace.h" - -const TInt KServerVersionMajor = 1; -const TInt KServerVersionMinor = 1; -const TInt KServerVersionBuild = 1; -_LIT( KServerProcessName, "!hwrmhapticsserver" ); -_LIT( KServerExeName, "hwrmhapticsserver.exe" ); -const TInt KAsyncMsgSlots = 10; - -const TInt KHWRMHapticsServiceCommand = 2001; -const TInt KHWRMHapticsOpenActuatorCommand = 2004; -const TInt KHWRMHapticsCleanupCommand = 2008; -const TInt KHWRMHapticsBridgeCommand = 2011; - -// -------------------------------------------------------------------------- -// Simple constructor -// -// -------------------------------------------------------------------------- -// -RHapticsBridgeClient::RHapticsBridgeClient() - { - TRAP_IGNORE( iPacketizer = - CHWRMHapticsPacketizer::NewL( EHWRMLogicalActuatorAny ) ); - } - -// -------------------------------------------------------------------------- -// Simple destructor -// -// -------------------------------------------------------------------------- -// -RHapticsBridgeClient::~RHapticsBridgeClient() - { - delete iPacketizer; - } - -// -------------------------------------------------------------------------- -// Method for connecting (creating a new session) with Haptics Server -// -// -------------------------------------------------------------------------- -// -TInt RHapticsBridgeClient::Connect() - { - COMPONENT_TRACE( ( _L( "RHapticsBridgeClient::Connect()" ) ) ); - TInt ret = CreateSession( KServerProcessName, - ServerVersion(), - KAsyncMsgSlots ); - if ( ret != KErrNone ) - { - ret = StartServer(); - if ( ret == KErrNone ) - { - ret = CreateSession( KServerProcessName, - ServerVersion(), - KAsyncMsgSlots ); - COMPONENT_TRACE(_L("RHapticsBridgeClient::Connect(), Session created")); - } - } - - // Initialize server components. - if ( ret == KErrNone ) - { - ret = SendReceive( KHWRMHapticsServiceCommand ); - } - - // Open the haptic effect ("vibra") device. - if ( ret == KErrNone ) - { - ret = OpenHapticsDevice(); - } - - - COMPONENT_TRACE( ( _L( "RHapticsBridgeClient::Connect - return(%d)" ), ret ) ); - return ret; - } - -// -------------------------------------------------------------------------- -// Method for starting Haptics Server (if not already running) -// -// -------------------------------------------------------------------------- -// -TInt RHapticsBridgeClient::StartServer() const - { - COMPONENT_TRACE( ( _L( "RHapticsBridgeClient::StartServer()" ) ) ); - - TParse parser; - parser.Set( KServerExeName, &KDC_PROGRAMS_DIR, NULL ); - - RProcess server; - TInt ret = server.Create( parser.FullName(), KNullDesC ); - - if ( ret != KErrNone ) // Loading failed. - { - return ret; - } - - TRequestStatus status; - server.Rendezvous( status ); - - if ( status != KRequestPending ) - { - server.Kill( 0 ); // Abort startup. - server.Close(); - return KErrGeneral; - } - else - { - server.Resume(); // Logon OK - start the server. - } - - User::WaitForRequest( status ); - server.Close(); - - COMPONENT_TRACE( ( _L( "RHapticsBridgeClient::StartServer() - return %d" ), status.Int() ) ); - return status.Int(); - } - -// -------------------------------------------------------------------------- -// Method for closing session to haptics server. -// -// -------------------------------------------------------------------------- -// -void RHapticsBridgeClient::Close() - { - RSessionBase::Close(); - } - -// -------------------------------------------------------------------------- -// Getter method for server version. -// -// -------------------------------------------------------------------------- -// -TVersion RHapticsBridgeClient::ServerVersion() const - { - return TVersion( KServerVersionMajor, - KServerVersionMinor, - KServerVersionBuild ); - } - -// -------------------------------------------------------------------------- -// Method for sending commands to Haptics Server. -// -// -------------------------------------------------------------------------- -// -TInt RHapticsBridgeClient::SendBridgeBuffer( const TDesC8& aReqData, TDes8& aRetDataPckg ) - { - COMPONENT_TRACE( ( _L( "RHapticsBridgeClient::SendBridgeBufferL() - Begin" ) ) ); - - TInt retVal( KErrDisconnected ); - if ( iHandle ) - { - TInt vibeStatus(0); - TPckg vibeStatusPckg( vibeStatus ); - retVal = SendReceive( KHWRMHapticsBridgeCommand, - TIpcArgs( &aReqData, - &vibeStatusPckg, - &aRetDataPckg ) ); - - if ( retVal == KErrNone ) - { - TRAP( retVal, HandleOpenDeviceResponseL( aRetDataPckg ) ); - } - } - - COMPONENT_TRACE( ( _L( "RHapticsBridgeClient::SendBridgeBufferL() - End (%d)" ), retVal ) ); - return retVal; - } - -// -------------------------------------------------------------------------- -// Method for cleaning up session to Haptics Server. -// -// -------------------------------------------------------------------------- -// -void RHapticsBridgeClient::CleanUp() - { - COMPONENT_TRACE( ( _L( "RHapticsBridgeClient::CleanUp() - Begin" ) ) ); - if ( iHandle ) - { - SendReceive ( KHWRMHapticsCleanupCommand ); - } - COMPONENT_TRACE( ( _L( "RHapticsBridgeClient::CleanUp() - End" ) ) ); - } - -// -------------------------------------------------------------------------- -// Method for handling Open Device responses (basically for requesting the -// setting of the license key). -// -// -------------------------------------------------------------------------- -// -void RHapticsBridgeClient::HandleOpenDeviceResponseL( const TDesC8& aResponse ) - { - COMPONENT_TRACE( ( _L( "RHapticsBridgeClient::HandleOpenDeviceResponse() - Begin" ) ) ); - TInt err( KErrNone ); - if ( !iPacketizer ) - { - COMPONENT_TRACE( ( _L( "RHapticsBridgeClient::HandleOpenDeviceResponse() - No Packetizer!" ) ) ); - User::Leave( KErrGeneral ); - } - else - { - const TUint8* pRsp ( aResponse.Ptr() ); - if ( 0x12 == pRsp[0] && 0x00 == pRsp[1] && 0x00 == pRsp[2] ) - { - COMPONENT_TRACE( ( _L( "RHapticsBridgeClient::HandleOpenDeviceResponse() - OPEN DEVICE RESPONSE handling" ) ) ); - iPacketizer->DecodeMessageL( aResponse, err ); - if ( !err ) - { - RBuf8 reqBuf; - err = iPacketizer->EncSetPlatformLicenseKeyReq( - iPacketizer->DeviceHandle(), reqBuf ); - if ( !err ) - { - TBuf8<50> dummyRetBuf; - TInt dummyStatus; - TPckg dummyStatusPckg( dummyStatus ); - err = SendReceive( KHWRMHapticsBridgeCommand, - TIpcArgs ( &reqBuf, - &dummyStatusPckg, - &dummyRetBuf ) ); - COMPONENT_TRACE( ( _L( "RHapticsBridgeClient::HandleOpenDeviceResponse() - Sent set license command (%d)"), err ) ); - } - reqBuf.Close(); - } - User::LeaveIfError( err ); - } - } - COMPONENT_TRACE( ( _L( "RHapticsBridgeClient::HandleOpenDeviceResponse() - End" ) ) ); - } - - -// -------------------------------------------------------------------------- -// Method for opening haptics device. This is needed since there's possibility -// that no other haptics client has opened the device prior to this bridge -// connectivity. This method also call set license key, i.e., completes the -// device opening. -// -// -------------------------------------------------------------------------- -// -TInt RHapticsBridgeClient::OpenHapticsDevice() - { - COMPONENT_TRACE( ( _L( "RHapticsBridgeClient::OpenHapticsDevice - Begin" ) ) ); - TInt err( KErrGeneral ); - if ( iPacketizer ) - { - RBuf8 openDevReqBuf; - RBuf8 setLicenseReqBuf; - TBuf8<50> setLicenseRspBuf; - TInt dummyStatus; - TPckg dummyStatusPckg( dummyStatus ); - - err = iPacketizer->EncOpenDeviceReq( EHWRMLogicalActuatorAny, - openDevReqBuf ); - - COMPONENT_TRACE( ( _L( "RHapticsBridgeClient::OpenHapticsDevice - EncOpenDevice (%d)" ), err ) ); - if ( !err ) - { - TInt deviceHandle; - TPckg deviceHandlePckg( deviceHandle ); - err = SendReceive( KHWRMHapticsOpenActuatorCommand, - TIpcArgs ( &openDevReqBuf, - &deviceHandlePckg, - EHWRMLogicalActuatorAny ) ); - COMPONENT_TRACE( ( _L( "RHapticsBridgeClient::OpenHapticsDevice - Send OpenDevice (%d)" ), err ) ); - COMPONENT_TRACE( ( _L( "RHapticsBridgeClient::OpenHapticsDevice - Device handle = %d" ), deviceHandle ) ); - if ( !err ) - { - err = iPacketizer->EncSetPlatformLicenseKeyReq( - deviceHandle, setLicenseReqBuf ); - COMPONENT_TRACE( ( _L( "RHapticsBridgeClient::OpenHapticsDevice - EncSetEmptyLicenseKey (%d)" ), err ) ); - if ( !err ) - { - TBuf8<50> dummyRspBuf; - TInt dummyStatus; - TPckg dummyStatusPckg( dummyStatus ); - err = SendReceive( KHWRMHapticsBridgeCommand, - TIpcArgs ( &setLicenseReqBuf, - &dummyStatusPckg, - &dummyRspBuf ) ); - COMPONENT_TRACE( ( _L( "RHapticsBridgeClient::OpenHapticsDevice - Send SetLicense (%d)" ), err ) ); - } - } - } - - openDevReqBuf.Close(); - setLicenseReqBuf.Close(); - } - COMPONENT_TRACE( ( _L( "RHapticsBridgeClient::OpenHapticsDevice - End (err=%d)" ),err ) ); - return err; - } - -// eof diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/plugins/hapticsconnplugin/src/hapticsconnplugin.cpp --- a/connectivitymodules/SeCon/plugins/hapticsconnplugin/src/hapticsconnplugin.cpp Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,84 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Haptics OBEX connection plugin. -* -*/ - - -#include "hapticsconnplugin.h" -#include "hapticsmsghandler.h" -#include "hapticsconntrace.h" - -// ----------------------------------------------------------------------------- -// CHapticsConnPlugin::NewL() -// Two-phase constructing -// ----------------------------------------------------------------------------- -// -CHapticsConnPlugin* CHapticsConnPlugin::NewL() - { - COMPONENT_TRACE( ( _L( "CHapticsConnPlugin::NewL - Begin" ) ) ); - CHapticsConnPlugin* self = new ( ELeave ) CHapticsConnPlugin(); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - COMPONENT_TRACE( ( _L( "CHapticsConnPlugin::NewL - End" ) ) ); - return( self ); - } - -// ----------------------------------------------------------------------------- -// CHapticsConnPlugin::ConstructL() -// -// ----------------------------------------------------------------------------- -// -void CHapticsConnPlugin::ConstructL() - { - COMPONENT_TRACE( ( _L( "CHapticsConnPlugin::ConstructL() - Begin" ) ) ); - iMsgHandler = CHapticsMsgHandler::NewL(); - iMsgHandler->StartNotifier(); - COMPONENT_TRACE( ( _L( "CHapticsConnPlugin::ConstructL() - End" ))); - } - -// ----------------------------------------------------------------------------- -// CHapticsConnPlugin::~CHapticsConnPlugin() -// Destructor -// ----------------------------------------------------------------------------- -// -CHapticsConnPlugin::~CHapticsConnPlugin() - { - COMPONENT_TRACE( ( _L( "CHapticsConnPlugin::~CHapticsConnPlugin() - Begin" ) ) ); - delete iMsgHandler; - COMPONENT_TRACE( ( _L( "CHapticsConnPlugin::~CHapticsConnPlugin() - End" ) ) ); - } - -// ----------------------------------------------------------------------------- -// CHapticsConnPlugin::CHapticsConnPlugin() -// Constructor -// ----------------------------------------------------------------------------- -// -CHapticsConnPlugin::CHapticsConnPlugin() - { - } - -// ----------------------------------------------------------------------------- -// CHapticsConnPlugin::IsOBEXActive() -// -// ----------------------------------------------------------------------------- -// -TBool CHapticsConnPlugin::IsOBEXActive() - { - COMPONENT_TRACE( ( _L( "CHapticsConnPlugin::IsOBEXActive" ) )); - return ETrue; - } - -// End of file diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/plugins/hapticsconnplugin/src/hapticsconntimer.cpp --- a/connectivitymodules/SeCon/plugins/hapticsconnplugin/src/hapticsconntimer.cpp Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,81 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Connection shutdown timer for haptics server connection. -* -*/ - - -#include "hapticsconntimer.h" - -const TInt KHapticsConnectionTimeout = 30000000; // 30 sec. - -// --------------------------------------------------------------------------- -// Two phased constructor. -// --------------------------------------------------------------------------- -// -CHapticsConnTimer* CHapticsConnTimer::NewL( MHapticsConnectionShutdown* aCallback ) - { - CHapticsConnTimer* self = new ( ELeave ) CHapticsConnTimer(aCallback); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - return self; - } - -// --------------------------------------------------------------------------- -// Destructor. -// --------------------------------------------------------------------------- -// -CHapticsConnTimer::~CHapticsConnTimer() - { - } - -// --------------------------------------------------------------------------- -// Activates this timer. -// --------------------------------------------------------------------------- -// -void CHapticsConnTimer::Start() - { - After( KHapticsConnectionTimeout ); - } - -// --------------------------------------------------------------------------- -// Constructor of the shutdown timer. -// --------------------------------------------------------------------------- -// -CHapticsConnTimer::CHapticsConnTimer( MHapticsConnectionShutdown* aCallback ) - : CTimer( EPriorityStandard ), iCallback(aCallback) - { - CActiveScheduler::Add( this ); - } - -// --------------------------------------------------------------------------- -// Second phase construction. -// --------------------------------------------------------------------------- -// -void CHapticsConnTimer::ConstructL() - { - CTimer::ConstructL(); - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CHapticsConnTimer::RunL() - { - iCallback->NotifyShutdown(); - } - -// End of File diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/plugins/hapticsconnplugin/src/hapticsmsghandler.cpp --- a/connectivitymodules/SeCon/plugins/hapticsconnplugin/src/hapticsmsghandler.cpp Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,255 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Handles messaging between file system and haptics -* client interface. -* -*/ - - -#include -#include -#include -#include - -#include "hapticsmsghandler.h" -#include "hapticsconntimer.h" -#include "hapticsconntrace.h" - -_LIT( KVibeTonzFolder,"VibeTonz\\" ); -_LIT( KSourceFileName,"VibeTonzDataReq" ); -_LIT( KTargetFileName,"VibeTonzDataRsp" ); - -// --------------------------------------------------------------------------- -// CHapticsMsgHandler* CHapticsMsgHandler::NewL() -// --------------------------------------------------------------------------- -// -CHapticsMsgHandler* CHapticsMsgHandler::NewL() - { - CHapticsMsgHandler* self = new (ELeave) CHapticsMsgHandler(); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - return self; - } - -// --------------------------------------------------------------------------- -// Default C++ constructor -// --------------------------------------------------------------------------- -// -CHapticsMsgHandler::CHapticsMsgHandler () : CActive( EPriorityStandard ) - { - } - -// --------------------------------------------------------------------------- -// void CHapticsMsgHandler::ConstructL() -// --------------------------------------------------------------------------- -// -void CHapticsMsgHandler::ConstructL() - { - COMPONENT_TRACE( ( _L( "CHapticsMsgHandler::ConstructL - Begin") ) ); - CActiveScheduler::Add( this ); - ConnectToFilesystemL(); - iConnectionTimeout = CHapticsConnTimer::NewL(this); - COMPONENT_TRACE( ( _L( "CHapticsMsgHandler::ConstructL - End") ) ); - } - -// --------------------------------------------------------------------------- -// CHapticsMsgHandler::~CHapticsMsgHandler() -// --------------------------------------------------------------------------- -// -CHapticsMsgHandler::~CHapticsMsgHandler() - { - Cancel(); - - if ( iConnectionTimeout ) - { - iConnectionTimeout->Cancel(); - delete iConnectionTimeout; - } - - delete iReqBuf; - - iClient.Close(); - iFs.Close(); - } - -// --------------------------------------------------------------------------- -// void ClearRequestFile() -// --------------------------------------------------------------------------- -// -void CHapticsMsgHandler::ClearRequestFile() - { - COMPONENT_TRACE( ( _L( "CHapticsMsgHandler::ClearRequestFile - Begin") ) ); - - TFindFile findDataFile( iFs ); - - TFileName sourcefile = PathInfo::PhoneMemoryRootPath(); - sourcefile.Append( PathInfo::OthersPath() ); - sourcefile.Append( KVibeTonzFolder ); - sourcefile.Append( KSourceFileName ); - - if( findDataFile.FindByDir( sourcefile, KNullDesC ) == KErrNone ) - { - COMPONENT_TRACE( _L("CHapticsMsgHandler::ClearRequestFile - Deleting REQ file") ); - iFs.Delete( KSourceFileName ); - } - COMPONENT_TRACE( ( _L( "CHapticsMsgHandler::ClearRequestFile - End") ) ); - } -// --------------------------------------------------------------------------- -// void ConnectToFilesystem() -// --------------------------------------------------------------------------- -// -void CHapticsMsgHandler::ConnectToFilesystemL() - { - COMPONENT_TRACE( ( _L( "CHapticsMsgHandler::ConnectToFilesystemL - Begin") ) ); - User::LeaveIfError( iFs.Connect() ); - - TFileName sessionPath = PathInfo::PhoneMemoryRootPath(); - sessionPath.Append( PathInfo::OthersPath() ); - sessionPath.Append( KVibeTonzFolder ); - TBool folderExists = BaflUtils::FolderExists( iFs, sessionPath ); - - if( folderExists ) - { - User::LeaveIfError( iFs.SetSessionPath( sessionPath ) ); - ClearRequestFile(); - } - else - { - User::LeaveIfError( iFs.MkDir( sessionPath ) ); - User::LeaveIfError( iFs.SetSessionPath( sessionPath ) ); - } - COMPONENT_TRACE( ( _L( "CHapticsMsgHandler::ConnectToFilesystemL - End") ) ); - } - -// --------------------------------------------------------------------------- -// CHapticsMsgHandler::StartNotifier() -// --------------------------------------------------------------------------- -// -void CHapticsMsgHandler::StartNotifier() - { - COMPONENT_TRACE( ( _L( "CHapticsMsgHandler::StartNotifier - Begin" ) ) ); - if ( !IsActive() ) - { - TFileName sessionPath = PathInfo::PhoneMemoryRootPath(); - sessionPath.Append( PathInfo::OthersPath() ); - sessionPath.Append( KVibeTonzFolder ); - iFs.NotifyChange( ENotifyAll, iStatus, sessionPath ); - SetActive(); - COMPONENT_TRACE( ( _L( "CHapticsMsgHandler::StartNotifier - Started" ) ) ); - } - COMPONENT_TRACE( ( _L( "CHapticsMsgHandler::StartNotifier - End" ) ) ); - } - -// --------------------------------------------------------------------------- -// CHapticsMsgHandler::RunL() -// --------------------------------------------------------------------------- -// -void CHapticsMsgHandler::RunL() - { - COMPONENT_TRACE( ( _L( "CHapticsMsgHandler::RunL - Begin" ) ) ); - - StartNotifier(); // re-subscribe for change notifications. - - TFindFile findDataFile(iFs); - TFileName sourcefileName = PathInfo::PhoneMemoryRootPath(); - sourcefileName.Append( PathInfo::OthersPath() ); - sourcefileName.Append( KVibeTonzFolder ); - sourcefileName.Append( KSourceFileName ); - - if( findDataFile.FindByDir( sourcefileName, KNullDesC ) == KErrNone ) - { - COMPONENT_TRACE( ( _L("CHapticsMsgHandler::RunL - found request file") ) ); - - RFile sourceFile; - TInt sourceFileSize; - - User::LeaveIfError( sourceFile.Open( iFs, sourcefileName, EFileShareAny ) ); - CleanupClosePushL( sourceFile ); - sourceFile.Size( sourceFileSize ); - - iReqBuf = HBufC8::NewL( sourceFileSize ); - TPtr8 reqBufPtr = iReqBuf->Des(); - sourceFile.Read( reqBufPtr ); - CleanupStack::PopAndDestroy( &sourceFile ); - - ClearRequestFile(); - - DATADUMP_TRACE( _L("CHapticsMsgHandler::RunL - request data dump:"), reqBufPtr ); - - if ( !iClient.Handle() ) - { - User::LeaveIfError( iClient.Connect() ); - } - - TBuf8<256> retData; - TInt bridgeErr = iClient.SendBridgeBuffer( reqBufPtr, retData ); - - delete iReqBuf; - iReqBuf = NULL; - - if ( bridgeErr == KErrNone ) - { - iConnectionTimeout->Cancel(); - iConnectionTimeout->Start(); - - DATADUMP_TRACE( _L("CHapticsMsgHandler::RunL - response data dump:"), retData ); - RFile targetFile; - targetFile.Replace( iFs, KTargetFileName, EFileWrite ); - targetFile.Write( retData ); - targetFile.Close(); - } - } - COMPONENT_TRACE( ( _L( "CHapticsMsgHandler::RunL - End" ) ) ); - } - -// ----------------------------------------------------------------------------- -// -// -// ----------------------------------------------------------------------------- -// -TInt CHapticsMsgHandler::RunError( TInt aError ) - { - COMPONENT_TRACE( ( _L( "CHapticsMsgHandler::RunError: %d" ), aError ) ); - return aError; - } - -// ----------------------------------------------------------------------------- -// -// -// ----------------------------------------------------------------------------- -// -void CHapticsMsgHandler::DoCancel() - { - COMPONENT_TRACE( ( _L( "Inside CHapticsMsgHandler::DoCancel" ) ) ); - if ( IsActive() ) - { - iFs.NotifyChangeCancel( iStatus ); - } - } - -// ----------------------------------------------------------------------------- -// CHapticsConnPlugin::CHapticsConnPlugin() -// Constructor -// ----------------------------------------------------------------------------- -// -void CHapticsMsgHandler::NotifyShutdown() - { - COMPONENT_TRACE( ( _L( "CHapticsMsgHandler::NotifyShutdown - Begin" ) ) ); - iClient.CleanUp(); - iClient.Close(); - COMPONENT_TRACE( ( _L( "CHapticsMsgHandler::NotifyShutdown - End" ) ) ); - } - -// end of file diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/plugins/hapticsconnplugin/src/proxy.cpp --- a/connectivitymodules/SeCon/plugins/hapticsconnplugin/src/proxy.cpp Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Implementation proxy for haptics connection plugin. -* -*/ - - -#include -#include - -#include "hapticsconnplugin.h" - -// Map the interface UIDs to implementation factory functions -const TImplementationProxy ImplementationTable[] = - { - IMPLEMENTATION_PROXY_ENTRY( 0x2001FE53, CHapticsConnPlugin::NewL ) - }; - -// Exported proxy for instantiation method resolution -EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) - { - aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); - - return ImplementationTable; - } - -// End of file - - diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/plugins/pcconn/bld/bld.inf --- a/connectivitymodules/SeCon/plugins/pcconn/bld/bld.inf Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,23 +0,0 @@ -/* -* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: PC Connectivity Plug-in build information file. -* -*/ - - -PRJ_PLATFORMS -DEFAULT - -PRJ_MMPFILES -sconpcconnplugin.mmp diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/plugins/pcconn/bld/def/bwinscwu.def --- a/connectivitymodules/SeCon/plugins/pcconn/bld/def/bwinscwu.def Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -EXPORTS - ?ImplementationGroupProxy@@YAPBUTImplementationProxy@@AAH@Z @ 1 NONAME ; struct TImplementationProxy const * ImplementationGroupProxy(int &) - diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/plugins/pcconn/bld/def/eabiu.def --- a/connectivitymodules/SeCon/plugins/pcconn/bld/def/eabiu.def Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -EXPORTS - _Z24ImplementationGroupProxyRi @ 1 NONAME - _ZTI17CSConPCConnplugin @ 2 NONAME ; ## - _ZTV17CSConPCConnplugin @ 3 NONAME ; ## - diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/plugins/pcconn/bld/sconpcconnplugin.mmp --- a/connectivitymodules/SeCon/plugins/pcconn/bld/sconpcconnplugin.mmp Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,64 +0,0 @@ -/* -* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: PC Connectivity Plug-in MMP file -* -*/ - - -// To get the MW_LAYER_SYSTEMINCLUDE-definition -#include -#include - -VENDORID VID_DEFAULT - -CAPABILITY CAP_ECOM_PLUGIN - -TARGET sconpcconnplugin.dll -TARGETTYPE PLUGIN - -UID 0x10009D8D 0x101F9688 - -SOURCEPATH ../src - -SOURCE sconpcconnplugin.cpp -SOURCE proxy.cpp -SOURCE sconpcconnpluginutils.cpp -SOURCE sconservicetimer.cpp -SOURCE sconshutdownwatcher.cpp - -START RESOURCE 101f9688.rss - TARGET sconpcconnplugin.rsc -END - -// Default system include paths for middleware layer modules. -MW_LAYER_SYSTEMINCLUDE - -USERINCLUDE ../inc -USERINCLUDE ../../../inc -USERINCLUDE ../../../clients/pcconn/inc -USERINCLUDE ../../../servers/pcconn/inc -USERINCLUDE ../../../services/ftp/inc -USERINCLUDE ../../../catalogspcconnectivityplugin/inc - -DEBUGLIBRARY flogger.lib -LIBRARY sconpcconnclient.lib -LIBRARY euser.lib -LIBRARY irobex.lib -LIBRARY ecom.lib -LIBRARY efsrv.lib -LIBRARY bafl.lib -LIBRARY catalogspcconnectivityplugin.lib -LIBRARY apmime.lib -LIBRARY bluetooth.lib -LIBRARY esock.lib diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/plugins/pcconn/inc/sconpcconnplugin.h --- a/connectivitymodules/SeCon/plugins/pcconn/inc/sconpcconnplugin.h Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,234 +0,0 @@ -/* -* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: PC Connectivity plugin header file -* -*/ - -#ifndef _SCONPCCONNPLUGIN_H -#define _SCONPCCONNPLUGIN_H - -#include -#include -#include - -#include "sconpcconnclient.h" -#include "sconshutdownwatcher.h" - -// forward declaration -class CSConFTP; -class CSConServiceTimer; -class CCatalogsPCConnectivityPlugin; - - - -class CSConPCConnplugin : public CSrcsInterface, public MObexServerNotify, - public MShutdownObserver - { - public: - static CSConPCConnplugin* NewL(); - virtual ~CSConPCConnplugin(); - - /** - * Returns active status of OBEX session - * @return ETrue if session is active, else EFalse - */ - TBool IsOBEXActive(); - - /** - * Device is shutting down, abort connection. - */ - void NotifyShutdown(); - - private: - /** - * Loads sconftp.dll module - * @return none - */ - void LoadFTPDllL(); - /** - * Closes initialized services - * @return none - */ - void Disconnect(); - /** - * Removes spaces and nulls from the end of the string - * @param aDes String to be formatted - * @return none - */ - void TrimRightSpaceAndNull( TDes8& aDes ) const; - /** - * Current used transfer media (IR,USB,BT) - * @param aMediaType Enumeration indicating the media type - * @return none - */ - void SetMediaType( TSrcsMediaType aMediaType ); - /** - * MObexServerNotify implementation - * @param aError Error code - * @return none - */ - void ErrorIndication( TInt aError ); - /** - * MObexServerNotify implementation - * @return none - */ - void TransportUpIndication(); - /** - * MObexServerNotify implementation - * @return none - */ - void TransportDownIndication(); - /** - * MObexServerNotify implementation - * @param aRemoteInfo Structure containing information used during OBEX - * connection - * @param aInfo Further information about the requested connection - * @return System wide error code that indicates the success of the connection - */ - TInt ObexConnectIndication( const TObexConnectInfo& aRemoteInfo, - const TDesC8& aInfo ); - /** - * MObexServerNotify implementation - * @param aInfo Contains information about the disconnection - * @return none - */ - void ObexDisconnectIndication( const TDesC8& aInfo ); - /** - * MObexServerNotify implementation - * @return CObexBaseObject-derived object, which the object being put - * will be parsed into. - */ - CObexBufObject* PutRequestIndication(); - /** - * MObexServerNotify implementation - * @return System wide error code that indicates the success of the - * PUT packet operation. - */ - TInt PutPacketIndication(); - /** - * MObexServerNotify implementation - * @return System wide error code that indicates the success of the - * PUT packet operation. - */ - TInt PutCompleteIndication(); - /** - * MObexServerNotify implementation - * @param aRequiredObject Details about the object the remote client - * has requested - * @returnObject to return to the client - */ - CObexBufObject* GetRequestIndication( CObexBaseObject - *aRequiredObject ); - /** - * MObexServerNotify implementation - * @return System wide error code that indicates the success of the - * GET packet operation. - */ - TInt GetPacketIndication(); - /** - * MObexServerNotify implementation - * @return System wide error code that indicates the success of the - * GET packet operation. - */ - TInt GetCompleteIndication(); - /** - * MObexServerNotify implementation - * @param aPathInfo SETPATH command parameters - * @param aInfo Not currently used - * @return System wide error code indicating the success of the - * setpath command. - */ - TInt SetPathIndication( const CObex::TSetPathInfo& aPathInfo, - const TDesC8& aInfo ); - /** - * SetObexServer - * @param aObexServer pass obex server pointer to sevice controller - * @return System wide error code. - */ - TInt SetObexServer( CObexServer* aObexServer ); - /** - * MObexServerNotify implementation - * @return none - */ - void AbortIndication(); - /** - * Checks if mime type belongs to Catalogs - * @return TBool - */ - TBool IsCatalogsMimeType( TDataType aMime ); - - void ConstructL(); - CSConPCConnplugin(); - - /** - * Handles PCD object. Used for advanced file handling. - * @param aDescriptionHeader Contains command code and destination filename - * @param aNameHeader Source filename - * @return System wide error code. - */ - TInt HandlePCDObjectPut( const TDesC& aDescriptionHeader, const TDesC& aNameHeader ); - - /** - * Get Capbility object or ConML message from PCConnServer - * @param aNameHeader Name information. - * @param aTypeHeader Object type header. ConML or Capability object type - * @return none - */ - void HandleGetPCConnObjectL( const TDesC& aNameHeader, const TDesC8& aTypeHeader ); - - /** - * Get Catalogs object - * @param aTypeHeader Object type header. - * @return none - */ - void HandleGetCatalogsObjectL( const TDesC8& aTypeHeader ); - - /** - * Get file object - * @param aNameHeader requested filename. - * @return none - */ - void HandleGetFileObjectL( const TDesC& aNameHeader ); - - private: - RLibrary iFTPlib; - CObexBufObject* iObject; - CBufFlat* iBuffer; - CSConFTP* iFTPHandler; - TInt iPutError; - TBool iSessionActive; - CSConServiceTimer* iServiceTimer; - TBool iStartTimer; - TSrcsMediaType iMediaType; - CObexFileObject* iFileObject; - RSConPCConnSession iPCConnSession; - TBool iPCConnSessionConnected; - CCatalogsPCConnectivityPlugin* iCatalogs; - TBool iCatalogsConnected; - HBufC8* iCatalogsMimeType; - RPointerArray iMimeArray; - TBool iCatalogsMimeTypesExist; - TBool iPutPacketIndicationCalled; - CShutdownWatcher* iShutdownWatcher; - TBool iShutdownInProgress; - CObexServer* iObexServer; - RSocketServ iSocketServer; - RBTPhysicalLinkAdapter iLinkAdapter; - private: - // Friend class is used,because existing impelentation has been working - // properly. Avoiding re-design. - friend class CSConServiceTimer; - }; - -#endif // SCONPCCONNPLUGIN_H \ No newline at end of file diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/plugins/pcconn/inc/sconpcconnpluginutils.h --- a/connectivitymodules/SeCon/plugins/pcconn/inc/sconpcconnpluginutils.h Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ -/* -* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: PC Connectivity Plug-in Utils header -* -*/ - - -#ifndef _SCONPCCONNPLUGINUTILS_H -#define _SCONPCCONNPLUGINUTILS_H - -#include -//============================================================ -// Class TPCConnpluginUtils declaration -//============================================================ -class TPCConnpluginUtils - { - public: - /** - * Converts Symbian error code to OBEX error code - * @param aError The error code - * @return The converted error code - */ - static TInt ConvertPCDResponseCode( TInt aError ); - /** - * Converts Symbian error code to OBEX error code - * @param aError The error code - * @return The converted error code - */ - static TInt ConvertFTPResponseCode( TInt aError ); - - /** - * Converts Symbian error code to OBEX error code - * @param aError The error code - * @return The converted error code - */ - static TInt ConvertObexMoveResponseCode( TInt aError ); - }; - -#endif //_SCONPCCONNPLUGINUTILS_H - -// End of file - diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/plugins/pcconn/inc/sconservicetimer.h --- a/connectivitymodules/SeCon/plugins/pcconn/inc/sconservicetimer.h Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,61 +0,0 @@ -/* -* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: PC Connectivity Plug-in Service Timer Header file -* -*/ - - -#ifndef _SCONSERVICETIMER_H -#define _SCONSERVICETIMER_H - -#include - -class CSConPCConnplugin; - - -//============================================================ -// Class CSConServiceTimer declaration -//============================================================ - -NONSHARABLE_CLASS ( CSConServiceTimer ) : public CActive - { - public: - CSConServiceTimer( CSConPCConnplugin* aEngine, TInt aValue ); - void ConstructL(); - ~CSConServiceTimer(); - - /** - * Starts the timer - * @return none - */ - void StartTimer(); - /** - * Stops the timer - * @return none - */ - void StopTimer(); - - private: - void DoCancel(); - void RunL(); - - private: - RTimer iTimer; - CSConPCConnplugin* iEngine; - TInt iValue; - }; - -#endif //_SCONSERVICETIMER_H - -// End of file diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/plugins/pcconn/inc/sconshutdownwatcher.h --- a/connectivitymodules/SeCon/plugins/pcconn/inc/sconshutdownwatcher.h Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,66 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Power shutdown -watcher header file -* -*/ - - -#ifndef _SCONSHUTDOWNWATCHER_H -#define _SCONSHUTDOWNWATCHER_H - - -#include -#include - -//============================================================ -// Class MShutdownObserver declaration -//============================================================ -class MShutdownObserver - { -public: - virtual void NotifyShutdown()=0; - }; - -//============================================================ -// Class CShutdownWatcher declaration -//============================================================ -NONSHARABLE_CLASS ( CShutdownWatcher ) : public CActive - { - public: - static CShutdownWatcher* NewL( MShutdownObserver* aObserver ); - ~CShutdownWatcher(); - - /** - * Starts to watch shutdown status - * @return none - */ - void StartShutdownWatcher(); - - private: - //construct/destruct - CShutdownWatcher( MShutdownObserver* aObserver ); - void ConstructL(); - - // from CActive - void DoCancel(); - void RunL(); - - private: - MShutdownObserver* iObserver; - RProperty iProperty; - }; - -#endif //_SCONSHUTDOWNWATCHER_H - -// End of file \ No newline at end of file diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/plugins/pcconn/src/101f9688.rss --- a/connectivitymodules/SeCon/plugins/pcconn/src/101f9688.rss Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,68 +0,0 @@ -/* -* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: PC Connectivity Plug-in resource file -* -*/ - - -#include "ecom/registryinfo.rh" - -// Declares info for two implementations -RESOURCE REGISTRY_INFO theInfo - { - // UID for the DLL - dll_uid = 0x101F9688; - // Declare array of interface info - interfaces = - { - INTERFACE_INFO - { - // UID of interface that is implemented - interface_uid = 0x101F7C8C; - implementations = - { - // Info for CSConPCConnplugin - IMPLEMENTATION_INFO - { - implementation_uid = 0x101F9689; - version_no = 1; - display_name = "PC Suite Services"; - default_data = "OBEX/USB||OBEX/BT||OBEX/IrDA"; - - // - // opaque_data contains parameters used by following API calls in SRCS: - // 1. Setup USB interface string descriptor in Unicode; - // 2. TInt CObex::SetLocalWho(const TDesC8& aInfo); - // 3. TInt CBTConnection::RegisterSecuritySettingsL( TUint aService, - // TInt aProtocol, - // TInt aChannel, - // TBool aAuthenticate, - // TBool aAuthorise, - // TBool aEncrypt ); - // opaque_data = "@0||@1||@2||@3||@4||@5||@6" - // @0 aStrDesc e.g. "PC Connectivity" - // @1 aInfo e.g. KFolderBrowsingID, "\xF9\xEC\x7B\xC4\x95\x3C\x11\xd2\x98\x4E\x52\x54\x00\xDC\x9E\x09" - // @2 aService e.g. KBTSecurityUidFileTransfer, 0x1106 - // @3 aProtocol e.g. KSolBtRFCOMM, 0x1013 - // @4 aAuthenticate e.g. EFalse, 0 - // @5 aAuthorise e.g. EFalse, 0 - // @6 aEncrypt e.g. EFalse, 0 - // - opaque_data = "PC Suite Services||\xF9\xEC\x7B\xC4\x95\x3C\x11\xd2\x98\x4E\x52\x54\x00\xDC\x9E\x09||0x000050050000100080000002EE000001||0x1013||1||1||1||0xffff||0xffff"; - } - }; - } - }; - } - diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/plugins/pcconn/src/proxy.cpp --- a/connectivitymodules/SeCon/plugins/pcconn/src/proxy.cpp Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,41 +0,0 @@ -/* -* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: PC Connectivity Plug-in proxy implementation -* -*/ - - - -#include -#include - -#include "sconpcconnplugin.h" - -// Map the interface UIDs to implementation factory functions -const TImplementationProxy ImplementationTable[] = - { - IMPLEMENTATION_PROXY_ENTRY(0x101F9689, CSConPCConnplugin::NewL) - }; - -// Exported proxy for instantiation method resolution -EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) - { - aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); - - return ImplementationTable; - } - -// End of file - - diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/plugins/pcconn/src/sconpcconnplugin.cpp --- a/connectivitymodules/SeCon/plugins/pcconn/src/sconpcconnplugin.cpp Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1254 +0,0 @@ -/* -* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: PC Connectivity Plug-in implementation -* -*/ - - -// INCLUDE FILES - -#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS -#include -#endif -#include "sconpcconnplugin.h" -#include "sconftp.h" -#include "sconpcconnpluginutils.h" -#include "sconservicetimer.h" -#include "catalogspcconnectivityplugin.h" -#include "debug.h" - - -// CONSTANTS -_LIT(KSConFTPLibName, "sconftp.dll"); -const TInt KSConFTPUidValue = 0x10009D8D; -const TUid KSConFTPUid = {KSConFTPUidValue}; - -// Folder listing type from IrObex specification -_LIT8( KSConFolderListType, "x-obex/folder-listing" ); -// Folder listing type from IrObex specification -_LIT8( KSConCapabilityObjectType, "x-obex/capability" ); -// PCD types -_LIT8( KSConPCDObjectType, "application/vnd.nokia.pcd" ); -_LIT8( KSConPCDXMLObjectType, "application/vnd.nokia.conml+xml" ); -_LIT8( KSConPCDWBXMLObjectType, "application/vnd.nokia.conml+wbxml" ); -_LIT8( KSConPCDXMLObjectType2, "application/vnd.nokia.pcd+xml" ); -_LIT8( KSConPCDWBXMLObjectType2, "application/vnd.nokia.pcd+wbxml" ); -_LIT( K_C_ROOT, "C:\\" ); - -// PCD header commands -const TInt KSCon_PCD_TAG = 0x003A; -const TInt KSCon_PCD_CMD_COPY = 0x0037; -const TInt KSCon_PCD_CMD_MOVE_OR_RENAME = 0x0038; -const TInt KSCon_PCD_CMD_SET_PERMISSION = 0x0039; -// PCD header parameters -const TInt KSCon_PCD_PAR_FULL_PERMISSION = 0x0040; -const TInt KSCon_PCD_PAR_READ_ONLY_PERMISSION = 0x0041; - - -const TInt KSConBufSize = 262144; // 256KB -// Time (in milliseconds) for the timer -const TInt KSConTimeOutValue = 180000000; -// Flags used to indicate SetPath commands -const TInt KSConNULLSetPath = 0x00; - -const TInt KSConHeaderMaxLength = 256; - -// ============================= MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CSConPCConnplugin::NewL() -// Two-phase constructing -// ----------------------------------------------------------------------------- -// -CSConPCConnplugin* CSConPCConnplugin::NewL() - { - TRACE_FUNC_ENTRY; - CSConPCConnplugin* self = new ( ELeave ) CSConPCConnplugin(); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - TRACE_FUNC_EXIT; - return( self ); - } - -// ----------------------------------------------------------------------------- -// CSConPCConnplugin::~CSConPCConnplugin() -// Destructor -// ----------------------------------------------------------------------------- -// -CSConPCConnplugin::~CSConPCConnplugin() - { - TRACE_FUNC_ENTRY; - - // Disconnect from services. - Disconnect(); - - delete iBuffer; - iBuffer = NULL; - - if ( iServiceTimer ) - { - iServiceTimer->Cancel(); - } - - delete iServiceTimer; - iServiceTimer = NULL; - - delete iCatalogs; - iCatalogs = NULL; - delete iCatalogsMimeType; - iCatalogsMimeType = NULL; - - iMimeArray.Reset(); - iMimeArray.Close(); - - delete iShutdownWatcher; - iShutdownWatcher = NULL; - - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConPCConnplugin::IsOBEXActive() -// Returns active status of OBEX session -// ----------------------------------------------------------------------------- -// -TBool CSConPCConnplugin::IsOBEXActive() - { - TRACE_FUNC; - return iSessionActive; - } - -// ----------------------------------------------------------------------------- -// CSConPCConnplugin::NotifyShutdown() -// System is shutting down -// ----------------------------------------------------------------------------- -// -void CSConPCConnplugin::NotifyShutdown() - { - TRACE_FUNC; - iShutdownInProgress = ETrue; - } - -// ----------------------------------------------------------------------------- -// CSConPCConnplugin::LoadFTPDllL() -// Loads sconftp.dll module -// ----------------------------------------------------------------------------- -// -void CSConPCConnplugin::LoadFTPDllL() - { - TRACE_FUNC_ENTRY; - // Dynamically load DLL - User::LeaveIfError( iFTPlib.Load( KSConFTPLibName ) ); - if ( iFTPlib.Type()[1] != KSConFTPUid ) - { - LOGGER_WRITE( "KSConFTPUidValue incorrect" ); - iFTPlib.Close(); - User::Leave( KErrNotFound ); - } - TSConCreateCSConFTPFunc CreateCSConFTPL = - (TSConCreateCSConFTPFunc)iFTPlib.Lookup(1); - iFTPHandler = (CSConFTP*)CreateCSConFTPL(); - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConPCConnplugin::Disconnect() -// Closes initialized services -// ----------------------------------------------------------------------------- -// -void CSConPCConnplugin::Disconnect() - { - TRACE_FUNC_ENTRY; - - iLinkAdapter.Close(); - iSocketServer.Close(); - - //Disconnect from server - iPCConnSession.Close(); - iPCConnSessionConnected = EFalse; - - if ( iStartTimer != EFalse ) - { - iServiceTimer->Cancel(); - iServiceTimer->StartTimer(); - } - - delete iObject; - iObject = NULL; - - if ( iFTPHandler ) - { - delete iFTPHandler; - iFTPHandler = NULL; - iFTPlib.Close(); - } - if ( iFileObject ) - { - delete iFileObject; - iFileObject = NULL; - } - if ( iCatalogsConnected ) - { - iCatalogs->Close(); - iCatalogsConnected = EFalse; - iCatalogsMimeTypesExist = EFalse; - } - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConPCConnplugin::ErrorIndication( TInt aError ) -// MObexServerNotify implementation -// ----------------------------------------------------------------------------- -// -void CSConPCConnplugin::ErrorIndication( TInt aError ) - { - TRACE_FUNC_ENTRY; - LOGGER_WRITE_1( "aError : %d", aError ); - - if ( iFTPHandler ) - { - iFTPHandler->AbortFileTransfer( iObject ); - } - - if ( iObject ) - { - delete iObject; - iObject = NULL; - } - - if ( iFileObject ) - { - iFileObject->Reset(); - delete iFileObject; - iFileObject = NULL; - } - - if ( iPCConnSessionConnected ) - { - iPCConnSession.ResetServer(); - } - - // Keep compiler happy - (void)aError; - - delete iShutdownWatcher; - iShutdownWatcher = NULL; - - if ( iLinkAdapter.IsOpen() ) - { - // Cancel ActivateActiveRequester & allow going to low power mode - TInt err = iLinkAdapter.CancelLowPowerModeRequester(); - LOGGER_WRITE_1( "iLinkAdapter.CancelLowPowerModeRequester() err: %d", err ); - } - - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConPCConnplugin::AbortIndication() -// MObexServerNotify implementation -// ----------------------------------------------------------------------------- -// -void CSConPCConnplugin::AbortIndication() - { - TRACE_FUNC_ENTRY; - - if ( iFTPHandler ) - { - iFTPHandler->AbortFileTransfer( iObject ); - } - - if ( iObject ) - { - delete iObject; - iObject = NULL; - } - - if ( iFileObject ) - { - iFileObject->Reset(); - delete iFileObject; - iFileObject = NULL; - } - - if ( iPCConnSessionConnected ) - { - iPCConnSession.ResetServer(); - } - - delete iShutdownWatcher; - iShutdownWatcher = NULL; - - if ( iLinkAdapter.IsOpen() ) - { - // Cancel ActivateActiveRequester & allow going to low power mode - TInt err = iLinkAdapter.CancelLowPowerModeRequester(); - LOGGER_WRITE_1( "iLinkAdapter.CancelLowPowerModeRequester() err: %d", err ); - } - - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConPCConnplugin::TransportUpIndication() -// MObexServerNotify implementation -// ----------------------------------------------------------------------------- -// -void CSConPCConnplugin::TransportUpIndication() - { - TRACE_FUNC; - } - -// ----------------------------------------------------------------------------- -// CSConPCConnplugin::ObexConnectIndication( const TObexConnectInfo& -// aRemoteInfo, const TDesC8& aInfo ) -// MObexServerNotify implementation -// ----------------------------------------------------------------------------- -// -TInt CSConPCConnplugin::ObexConnectIndication( const TObexConnectInfo& - /*aRemoteInfo*/, const TDesC8& /*aInfo*/ ) - { - TRACE_FUNC_ENTRY; - TInt err( KErrNone ); - TInt catalogsErr( KErrNone ); - iStartTimer = ETrue; - - if ( iMediaType == ESrcsMediaBT && iObexServer ) - { - TSockAddr remoteAddr; - iObexServer->RemoteAddr( remoteAddr ); - - TBTSockAddr btSockAddr( remoteAddr ); - TBTDevAddr devAddr = btSockAddr.BTAddr(); - - err = iSocketServer.Connect(); - LOGGER_WRITE_1("iSocketServer.Connect err: %d", err ); - if ( !err ) - { - err = iLinkAdapter.Open( iSocketServer, devAddr ); - LOGGER_WRITE_1("iLinkAdapter.Open err: %d", err ); - } - // Ignore all BT link errors - err = KErrNone; - } - - //Connect to server - if ( !iPCConnSessionConnected ) - { - LOGGER_WRITE("Try to connect to iPCConnSession"); - err = iPCConnSession.Connect(); - LOGGER_WRITE_1( "iPCConnSession.Connect returned : %d", err ); - if ( err == KErrNone ) - { - iPCConnSessionConnected = ETrue; - } - } - - if ( err == KErrNone && !iFTPHandler ) - { - TRAP( err, LoadFTPDllL() ); - LOGGER_WRITE_1( "LoadFTPDllL returned : %d", err ); - } - - if ( err == KErrNone ) - { - iFTPHandler->SetProfile( EProprietary ); - LOGGER_WRITE( "iServiceTimer->StopTimer()" ); - iServiceTimer->Cancel(); - iServiceTimer->StopTimer(); - } - - if ( !iCatalogsConnected ) - { - LOGGER_WRITE( "CSConPCConnplugin::ObexConnectIndication() before iCatalogs->Connect()" ); - catalogsErr = iCatalogs->Connect(); - LOGGER_WRITE_1( "CSConPCConnplugin::ObexConnectIndication() iCatalogs->Connect() err: %d", catalogsErr ); - if ( catalogsErr == KErrNone ) - { - LOGGER_WRITE( "CSConPCConnplugin::ObexConnectIndication() iCatalogs->Connect() success" ); - iCatalogsConnected = ETrue; - TRAPD( ret, iMimeArray = iCatalogs->SupportedMimeTypesL() ); - if ( ret == KErrNone ) - { - LOGGER_WRITE_1( "iCatalogs->SupportedMimeTypesL count: %d", iMimeArray.Count() ); - iCatalogsMimeTypesExist = ETrue; - } - } - } - TRACE_FUNC_EXIT; - return TPCConnpluginUtils::ConvertFTPResponseCode( err ); - } - -// ----------------------------------------------------------------------------- -// CSConPCConnplugin::ObexDisconnectIndication( const TDesC8& ) -// MObexServerNotify implementation -// ----------------------------------------------------------------------------- -// -void CSConPCConnplugin::ObexDisconnectIndication( const TDesC8& ) - { - TRACE_FUNC_ENTRY; - Disconnect(); - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConPCConnplugin::TransportDownIndication() -// MObexServerNotify implementation -// ----------------------------------------------------------------------------- -// -void CSConPCConnplugin::TransportDownIndication() - { - TRACE_FUNC_ENTRY; - Disconnect(); - if ( iBuffer ) - { - iBuffer->Reset(); - } - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConPCConnplugin::PutRequestIndication() -// MObexServerNotify implementation -// ----------------------------------------------------------------------------- -// -CObexBufObject* CSConPCConnplugin::PutRequestIndication() - { - TRACE_FUNC_ENTRY; - TInt ret( KErrNone ); - TInt err( KErrNone ); - iPutError = KErrNone; - - if ( iBuffer ) - { - iBuffer->Reset(); - } - - if ( iObject ) - { - delete iObject; - iObject = NULL; - } - - TRAP( err, iObject = CObexBufObject::NewL ( iBuffer ) ); - - if ( err != KErrNone ) - { - return NULL; - } - - if ( !iFTPHandler ) - { - LOGGER_WRITE( "Creating iFTPHandler has failed" ); - return NULL; - } - - TRAP( err, ret = iFTPHandler->PutFileObjectInitL( iObject, iBuffer ) ); - - if ( err != KErrNone ) - { - LOGGER_WRITE_1( "iFTPHandler->PutFileObjectInitL() leaves: %d", err ); - return NULL; - } - if ( ret != KErrNone ) - { - LOGGER_WRITE_1( "PutFileObjectInitL failed - returning error in next PutPacketIndication : %d", ret ); - iPutError = ret; - } - iPutPacketIndicationCalled = EFalse; - - if ( !iShutdownWatcher ) - { - TRAP( err, iShutdownWatcher = CShutdownWatcher::NewL( this ) ); - if ( err == KErrNone ) - { - iShutdownWatcher->StartShutdownWatcher(); - } - else - { - LOGGER_WRITE_1( "CShutdownWatcher::NewL leaves: %d", err ); - } - } - - if ( iLinkAdapter.IsOpen() ) - { - // request active BT mode (high power mode) - err = iLinkAdapter.ActivateActiveRequester(); - LOGGER_WRITE_1( "iLinkAdapter.ActivateActiveRequester() err: %d", err ); - } - - TRACE_FUNC_EXIT; - return( iObject ); - } - -// ----------------------------------------------------------------------------- -// CSConPCConnplugin::PutPacketIndication() -// MObexServerNotify implementation -// ----------------------------------------------------------------------------- -// -TInt CSConPCConnplugin::PutPacketIndication() - { - TRACE_FUNC_ENTRY; - TInt ret( KErrNone ); - - TBool catalogsMime( EFalse ); - if ( iObject->Type().Length() > KSConHeaderMaxLength ) - { - LOGGER_WRITE("TypeHeader too big, return KErrNotSupported"); - return TPCConnpluginUtils::ConvertFTPResponseCode( KErrNotSupported ); - } - TBuf8 typeHeader( iObject->Type() ); - TrimRightSpaceAndNull( typeHeader ); - - if ( iCatalogsConnected && IsCatalogsMimeType( TDataType( typeHeader ) ) ) - { - catalogsMime = ETrue; - } - - if ( (TInt)iObject->Length() > 0 - && typeHeader != KSConPCDWBXMLObjectType - && typeHeader != KSConPCDWBXMLObjectType2 - && !catalogsMime - && typeHeader != KSConPCDObjectType ) - { - // normal file transfer - if ( !iPutPacketIndicationCalled ) - { - // This is first check, need to check only once - - TFileName path; - iFTPHandler->GetPath( path ); - if ( path.CompareF( K_C_ROOT ) == 0 ) - { - // path forbidden - ret = KErrAccessDenied; - } - else - { - if ( iPutError != KErrNone ) - { - ret = iPutError; - LOGGER_WRITE_1( "CSConPCConnplugin::PutPacketIndication() : PutError : %d", iPutError ); - } - else - { - // check required free space - // if filesize is small ( <65k ) it fits into one package and its already saved to filesystem. - // if file is larger, need to check is there enought free space in device. - - const TUint32 filesize = iObject->Length(); - LOGGER_WRITE_1( "CSConPCConnplugin::PutPacketIndication() filesize %d", filesize ); - LOGGER_WRITE_1( "CSConPCConnplugin::PutPacketIndication() iObject->BytesReceived() %d", iObject->BytesReceived() ); - if ( filesize > iObject->BytesReceived() ) - { - LOGGER_WRITE( "CSConPCConnplugin::PutPacketIndication() : check freespace" ); - // file does not fit into one obex packet, check is there enought free space in current drive - if ( iFTPHandler->IsCurrentDiskSpaceBelowCritical( filesize ) ) - { - LOGGER_WRITE( "CSConPCConnplugin::PutPacketIndication() : returning KErrNoMemory" ); - ret = KErrNoMemory; - } - } - } - } - } - - if ( iShutdownInProgress ) - { - LOGGER_WRITE( "ShutdownInProgress, abort" ); - ret = KErrDisconnected; - } - } - - if ( !iPutPacketIndicationCalled ) - { - // Need to check only once - iPutPacketIndicationCalled = ETrue; - - //Check if filename is too long. - TFileName path; - iFTPHandler->GetPath( path ); - if ( ret == KErrNone && path.Length() + iObject->Name().Length() > KMaxFileName ) - { - LOGGER_WRITE_1( "Name length overflow! : %d", path.Length() + iObject->Name().Length() ); - ret = KErrBadName; - } - } - - if ( ret != KErrNone ) - { - if ( iFTPHandler ) - { - iFTPHandler->AbortFileTransfer( iObject ); - } - - delete iObject; - iObject = NULL; - - if ( iLinkAdapter.IsOpen() ) - { - // Cancel ActivateActiveRequester & allow going to low power mode - TInt err = iLinkAdapter.CancelLowPowerModeRequester(); - LOGGER_WRITE_1( "iLinkAdapter.CancelLowPowerModeRequester() err: %d", err ); - } - } - - LOGGER_WRITE_1( "CSConPCConnplugin::PutPacketIndication(): ret %d", ret ); - return TPCConnpluginUtils::ConvertFTPResponseCode( ret ); - } - -// ----------------------------------------------------------------------------- -// CSConPCConnplugin::PutCompleteIndication() -// MObexServerNotify implementation -// ----------------------------------------------------------------------------- -// -TInt CSConPCConnplugin::PutCompleteIndication() - { - TRACE_FUNC_ENTRY; - TInt ret( KErrNone ); - TInt err( KErrNone ); - - if ( iLinkAdapter.IsOpen() ) - { - // Cancel ActivateActiveRequester & allow going to low power mode - TInt err2 = iLinkAdapter.CancelLowPowerModeRequester(); - LOGGER_WRITE_1( "iLinkAdapter.CancelLowPowerModeRequester() err: %d", err2 ); - } - - if ( iObject->Type().Length() > KSConHeaderMaxLength ) - { - LOGGER_WRITE("TypeHeader too big, return KErrNotSupported"); - delete iObject; - iObject = NULL; - - iFTPHandler->DeleteTempFile(); - return TPCConnpluginUtils::ConvertPCDResponseCode( KErrNotSupported ); - } - if ( iObject->Name().Length() > KSConHeaderMaxLength ) - { - LOGGER_WRITE("NameHeader too big, return KErrNotSupported"); - delete iObject; - iObject = NULL; - - iFTPHandler->DeleteTempFile(); - return TPCConnpluginUtils::ConvertPCDResponseCode( KErrNotSupported ); - } - - // check if ConML signal is received - TBuf8 typeHeader( iObject->Type() ); - TBuf nameHeader( iObject->Name() ); - TrimRightSpaceAndNull( typeHeader ); - LOGGER_WRITE8_1("type: %S", &typeHeader); - LOGGER_WRITE_1("name: %S", &nameHeader); - LOGGER_WRITE_1("description: %S", &iObject->Description()); - TInt size = iObject->BytesReceived(); - TTime time = iObject->Time(); - - // shutdownWatcher is not needed anymore - delete iShutdownWatcher; - iShutdownWatcher = NULL; - - if ( IsCatalogsMimeType( TDataType( typeHeader ) ) ) - { - if ( iCatalogsConnected ) - { - LOGGER_WRITE( "iCatalogs->PutDataL" ); - TRAP( err, iCatalogs->PutDataL( typeHeader, *iBuffer ) ); - LOGGER_WRITE_1( "iCatalogs->PutDataL : %d", err ); - if ( err == KErrServerTerminated ) - { - err = iCatalogs->Connect(); - LOGGER_WRITE_1( "CSConPCConnplugin::PutCompleteIndication() iCatalogs->Connect() err: %d", err ); - if ( err == KErrNone ) - { - LOGGER_WRITE( "iCatalogs->PutDataL" ); - TRAP( err, iCatalogs->PutDataL( typeHeader, *iBuffer ) ); - LOGGER_WRITE_1( "iCatalogs->PutDataL : %d", err ); - } - } - } - else - { - LOGGER_WRITE( "Catalogs mime type recognised - failing due no connection" ); - err = KErrNotSupported; - } - - delete iObject; - iObject = NULL; - - iFTPHandler->DeleteTempFile(); - return TPCConnpluginUtils::ConvertPCDResponseCode( err ); - } - - if ( typeHeader == KSConPCDObjectType ) - { - LOGGER_WRITE( "CSConPCConnplugin::PutCompleteIndication KSConPCDObjectType" ); - err = HandlePCDObjectPut( iObject->Description(), iObject->Name() ); - delete iObject; - iObject = NULL; - - iFTPHandler->DeleteTempFile(); - LOGGER_WRITE_1( "CSConPCConnplugin::PutCompleteIndication() end, err: %d", err ); - return TPCConnpluginUtils::ConvertObexMoveResponseCode( err ); - } - - if ( typeHeader != KSConPCDWBXMLObjectType && - typeHeader != KSConPCDWBXMLObjectType2 ) - { - TObexHeaderMask validHdrs = iObject->ValidHeaders(); - if ( ( validHdrs & KObexHdrBody ) || ( validHdrs & KObexHdrEndOfBody ) ) - { - LOGGER_WRITE( "CSConPCConnplugin::PutCompleteIndication() normal filetransfer" ); - LOGGER_WRITE_1( "Number of received bytes : %d", size ); - TSConUsedMedia media( ESConNoMedia ); - - switch( iMediaType ) - { - case ESrcsMediaBT : - media = ESConBTMedia; - break; - case ESrcsMediaIrDA : - media = ESConIRMedia; - break; - case ESrcsMediaUSB : - media = ESConUSBMedia; - break; - default : - media = ESConNoMedia; - break; - } - - iFTPHandler->SetUsedMedia( media ); - - TRAP( ret, err = iFTPHandler->PutFileObjectFinalizeL( iObject ) ); - LOGGER_WRITE_1( "PutFileObjectL() returned : %d", ret ); - } - else - { - LOGGER_WRITE( "Delete starts" ); - TRAP( ret, err = iFTPHandler->DeleteObjectL( iObject->Name() ) ); - LOGGER_WRITE_1( "DeleteObjectL() returned : %d", ret ); - } - } - - delete iObject; - iObject = NULL; - - if ( typeHeader == KSConPCDWBXMLObjectType || - typeHeader == KSConPCDWBXMLObjectType2 ) - { - LOGGER_WRITE( "CSConPCConnplugin::PutCompleteIndication() ReadWBXMLDataL" ); - TRAP( ret, err = iFTPHandler->ReadWBXMLDataL( iBuffer ) ); - - if ( err == KErrNone && ret == KErrNone ) - { - TRAP( ret, err = iPCConnSession.PutPacketL( nameHeader, - typeHeader, iBuffer ) ); - LOGGER_WRITE_1( "iPCConnSession.PutPacketL() leaveCode : %d", ret ); - LOGGER_WRITE_1( "iPCConnSession.PutPacketL() returned : %d", err ); - } - - iFTPHandler->DeleteTempFile(); - - return TPCConnpluginUtils::ConvertPCDResponseCode( err ); - } - - iFTPHandler->DeleteTempFile(); - - TRACE_FUNC_EXIT; - if ( ret != KErrNone ) - { - return TPCConnpluginUtils::ConvertFTPResponseCode( ret ); - } - return TPCConnpluginUtils::ConvertFTPResponseCode( err ); - } - -// ----------------------------------------------------------------------------- -// CSConPCConnplugin::GetRequestIndication( CObexBaseObject* aRequiredObject ) -// MObexServerNotify implementation -// ----------------------------------------------------------------------------- -// -CObexBufObject* CSConPCConnplugin::GetRequestIndication( CObexBaseObject* - aRequiredObject ) - { - TRACE_FUNC_ENTRY; - CObexBufObject* bufObject(NULL); - if ( aRequiredObject->Type().Length() > KSConHeaderMaxLength ) - { - LOGGER_WRITE("TypeHeader too big"); - return NULL; - } - if ( aRequiredObject->Name().Length() > KMaxFileName ) - { - LOGGER_WRITE("NameHeader is too long"); - return NULL; - } - TInt ret( KErrNone ); - TInt err( KErrNone ); - TBuf8 typeHeader( aRequiredObject->Type() ); - TrimRightSpaceAndNull( typeHeader ); - LOGGER_WRITE8_1("type: %S", &typeHeader); - LOGGER_WRITE_1("name: %S", &aRequiredObject->Name()); - - iBuffer->Reset(); - - delete iObject; - iObject = NULL; - - TRAP( err, iObject = CObexBufObject::NewL ( iBuffer ) ); - if ( err != KErrNone ) - { - return NULL; - } - - // Client requests folder listing - if ( typeHeader == KSConFolderListType ) - { - LOGGER_WRITE( "Client requests folder listning" ); - if ( !iFTPHandler ) - { - LOGGER_WRITE( "Creating iFTPHandler has failed" ); - return NULL; - } - - TRAP( err, ret = iFTPHandler->GetFolderObjectL( iObject ) ); - LOGGER_WRITE_1( "iFTPHandler->GetFolderObjectL() returned: %d", ret ); - if ( err == KErrNone && ret == KErrNone ) - { - bufObject = iObject; - } - else - { - return NULL; - } - } - // Client requests capability object or ConML packet - else if ( typeHeader == KSConCapabilityObjectType - || typeHeader == KSConPCDWBXMLObjectType - || typeHeader == KSConPCDWBXMLObjectType2) - { - LOGGER_WRITE( "Client requests capability object or ConML packet" ); - // HandleGetPCConnObjectL will set some data to iObject, or leaves if error occurs - TRAP( err, HandleGetPCConnObjectL( aRequiredObject->Name(), typeHeader ) ); - - if ( err == KErrNone ) - { - bufObject = iObject; - } - else - { - LOGGER_WRITE_1("Get PCConn object failed, err: %d", err); - return NULL; - } - } - // Client requests file conversion - else if ( typeHeader == KSConPCDObjectType ) - { - LOGGER_WRITE("request of KSConPCDObjectType is not supported.") - return NULL; - } - // catalogs - else if ( IsCatalogsMimeType( TDataType( typeHeader ) ) ) - { - TRAP( err, HandleGetCatalogsObjectL( typeHeader ) ); - if ( err == KErrNone ) - { - bufObject = iObject; - } - else - { - LOGGER_WRITE_1("Get catalogs object failed, err: %d", err); - return NULL; - } - } - // Client requests file - else - { - LOGGER_WRITE( "Client requests file" ); - TRAP( err, HandleGetFileObjectL( aRequiredObject->Name() ) ); - if ( err == KErrNone ) - { - bufObject = (CObexBufObject*)iFileObject; - } - else - { - LOGGER_WRITE_1("Get file object failed, err: %d", err); - return NULL; - } - } - if ( bufObject && iLinkAdapter.IsOpen() ) - { - // request active BT mode (high power mode) - err = iLinkAdapter.ActivateActiveRequester(); - LOGGER_WRITE_1( "iLinkAdapter.ActivateActiveRequester() err: %d", err ); - } - return bufObject; - } - -// ----------------------------------------------------------------------------- -// CSConPCConnplugin::GetPacketIndication() -// MObexServerNotify implementation -// ----------------------------------------------------------------------------- -// -TInt CSConPCConnplugin::GetPacketIndication() - { - TRACE_FUNC; - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// CSConPCConnplugin::GetCompleteIndication() -// MObexServerNotify implementation -// ----------------------------------------------------------------------------- -// -TInt CSConPCConnplugin::GetCompleteIndication() - { - TRACE_FUNC_ENTRY; - if ( iLinkAdapter.IsOpen() ) - { - // Cancel ActivateActiveRequester & allow going to low power mode - TInt err = iLinkAdapter.CancelLowPowerModeRequester(); - LOGGER_WRITE_1( "iLinkAdapter.CancelLowPowerModeRequester() err: %d", err ); - } - - TInt ret( KErrNone ); - if ( iFileObject ) - { - iFileObject->Reset(); - delete iFileObject; - iFileObject = NULL; - } - - LOGGER_WRITE_1( "CSConPCConnplugin::GetCompleteIndication() : returned %d", ret ); - return ret; - } - -// ----------------------------------------------------------------------------- -// CSConPCConnplugin::SetPathIndication( const CObex::TSetPathInfo& aPathInfo, -// const TDesC8& aInfo ) -// MObexServerNotify implementation -// ----------------------------------------------------------------------------- -// -TInt CSConPCConnplugin::SetPathIndication( const CObex::TSetPathInfo& aPathInfo, - const TDesC8& /*aInfo*/ ) - { - TRACE_FUNC_ENTRY; - TInt ret( KErrNone ); - TInt err( KErrNone ); - - if ( !iFTPHandler ) - { - LOGGER_WRITE( "Creating iFTPHandler has failed" ); - return TPCConnpluginUtils::ConvertFTPResponseCode( KErrNoMemory ); - } - - if ( aPathInfo.iFlags == KSConNULLSetPath ) - { - TRAP( err, ret = this->iFTPHandler->CreateFolderL( aPathInfo.iName ) ); - } - else - { - TRAP( err, ret = this->iFTPHandler->SetPathL( aPathInfo.iName, - aPathInfo.iFlags ) ); - } - - if ( err != KErrNone ) - { - LOGGER_WRITE_1( "CSConPCConnplugin::SetPathIndication : returned %d", err ); - return TPCConnpluginUtils::ConvertFTPResponseCode( err ); - } - LOGGER_WRITE_1( "CSConPCConnplugin::SetPathIndication : returned %d", ret ); - return TPCConnpluginUtils::ConvertFTPResponseCode( ret ); - } - -// ----------------------------------------------------------------------------- -// CSConPCConnplugin::TrimRightSpaceAndNull( TDes8& aDes ) const -// Removes spaces and nulls from the end of the string -// ----------------------------------------------------------------------------- -// -void CSConPCConnplugin::TrimRightSpaceAndNull( TDes8& aDes ) const - { - TRACE_FUNC; - aDes.TrimRight(); - if ( aDes.Length() > 0 ) - { - if ( !aDes[aDes.Length() - 1] ) - { - aDes.SetLength( aDes.Length() - 1 ); - } - } - } - -// ----------------------------------------------------------------------------- -// CSConPCConnplugin::SetMediaType( TSrcsMediaType aMediaType ) -// Current used transfer media (IR,USB,BT) -// ----------------------------------------------------------------------------- -// -void CSConPCConnplugin::SetMediaType( TSrcsMediaType aMediaType ) - { - TRACE_FUNC; - iMediaType = aMediaType; - } -// ----------------------------------------------------------------------------- -// CSConPCConnplugin::TBool IsCatalogsMimeType( TDataType aMime ) -// Checks if mime type belogs to Catalogs -// ----------------------------------------------------------------------------- -// -TBool CSConPCConnplugin::IsCatalogsMimeType( TDataType aMime ) - { - TRACE_FUNC_ENTRY; - TBool result = EFalse; - - if ( !iCatalogsConnected - && aMime.Des8() != KSConPCDObjectType - && aMime.Des8() != KSConPCDXMLObjectType - && aMime.Des8() != KSConPCDWBXMLObjectType - && aMime.Des8() != KSConPCDXMLObjectType2 - && aMime.Des8() != KSConPCDWBXMLObjectType2 - ) - { - // Catalogs never connected and not secon mime type - // Try to connect to catalogs to get catalogstypes - TInt catalogsErr = iCatalogs->Connect(); - LOGGER_WRITE_1( "CSConPCConnplugin::IsCatalogsMimeType() iCatalogs->Connect() err: %d", catalogsErr ); - if ( catalogsErr == KErrNone ) - { - LOGGER_WRITE( "CSConPCConnplugin::IsCatalogsMimeType() iCatalogs->Connect() success" ); - iCatalogsConnected = ETrue; - TRAPD( ret, iMimeArray = iCatalogs->SupportedMimeTypesL() ); - if ( ret == KErrNone ) - { - LOGGER_WRITE_1( "iCatalogs->SupportedMimeTypesL count: %d", iMimeArray.Count() ); - iCatalogsMimeTypesExist = ETrue; - } - } - } - - if ( iCatalogsMimeTypesExist ) - { - // Compare to supported values - for ( TInt j = 0; j < iMimeArray.Count(); j++ ) - { - if ( (*iMimeArray[j]) == aMime ) - { - LOGGER_WRITE( "CSConPCConnplugin::IsCatalogsMimeTypeL returns TRUE" ); - result = ETrue; - break; - } - } - } - TRACE_FUNC_EXIT; - return result; - } - -// ----------------------------------------------------------------------------- -// CSConPCConnplugin::CSConPCConnplugin() -// Default constructor -// ----------------------------------------------------------------------------- -// -CSConPCConnplugin::CSConPCConnplugin() - { - TRACE_FUNC; - iBuffer = NULL; - iObject = NULL; - iFileObject = NULL; - iSessionActive = EFalse; - } - -// ----------------------------------------------------------------------------- -// CSConPCConnplugin::ConstructL() -// Initializes member data -// ----------------------------------------------------------------------------- -// -void CSConPCConnplugin::ConstructL() - { - TRACE_FUNC_ENTRY; - iBuffer = CBufFlat::NewL( KSConBufSize ); - iObject = CObexBufObject::NewL ( iBuffer ); - iServiceTimer = new (ELeave) CSConServiceTimer( this, KSConTimeOutValue ); - iServiceTimer->ConstructL(); - CActiveScheduler::Add( iServiceTimer ); - - // catalogs - iCatalogs = CCatalogsPCConnectivityPlugin::NewL(); - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConPCConnplugin::SetObexServer( CObexServer* aObexServer ) -// SetObexServer -// ----------------------------------------------------------------------------- -// -TInt CSConPCConnplugin::SetObexServer( CObexServer* aObexServer ) - { - iObexServer = aObexServer; - TInt ret = iObexServer->Start(this); - LOGGER_WRITE_1( "CSConPCConnplugin::SetObexServer() ret: %d", ret ); - return ret; - } - -// ----------------------------------------------------------------------------- -// CSConPCConnplugin::HandlePCDObjectPut -// Handles PCD object. Used for advanced file handling. -// ----------------------------------------------------------------------------- -// -TInt CSConPCConnplugin::HandlePCDObjectPut( const TDesC& aDescriptionHeader, - const TDesC& aNameHeader ) - { - TRACE_FUNC_ENTRY; - TInt err( KErrNotSupported); - if ( aDescriptionHeader.Length() >= 3 ) - { - TInt commandTag = aDescriptionHeader[0]; - TInt commandID = aDescriptionHeader[1]; - TInt commandParam1 = aDescriptionHeader[2]; - - TPtrC destination; - if ( aDescriptionHeader.Length() >= 3 ) - { - destination.Set( aDescriptionHeader.Mid(3) ); - } - TPtrC source; - if ( aNameHeader.Length() >= 1 ) - { - // remove ":" character from beginning - source.Set( aNameHeader.Mid(1) ); - } - - if ( commandTag == KSCon_PCD_TAG ) - { - LOGGER_WRITE( "CSConPCConnplugin::HandlePCDObjectPut KSCon_PCD_TAG found" ); - switch (commandID) - { - case KSCon_PCD_CMD_COPY: - err = iFTPHandler->CopyFile( source, destination ); - break; - - case KSCon_PCD_CMD_MOVE_OR_RENAME: - err = iFTPHandler->MoveFile( source, destination ); - break; - - case KSCon_PCD_CMD_SET_PERMISSION: - if ( commandParam1 == KSCon_PCD_PAR_FULL_PERMISSION ) - { - err = iFTPHandler->SetReadOnly( source, EFalse ); - } - else if ( commandParam1 == KSCon_PCD_PAR_READ_ONLY_PERMISSION ) - { - err = iFTPHandler->SetReadOnly( source, ETrue ); - } - else - { - err = KErrNotSupported; - } - break; - - default: - LOGGER_WRITE( "CSConPCConnplugin::HandlePCDObjectPut unknown commandID" ); - err = KErrNotSupported; - break; - } - - } - - } - TRACE_FUNC_EXIT; - return err; - } - -// ----------------------------------------------------------------------------- -// CSConPCConnplugin::HandleGetPCConnObjectL -// Get Capbility object or ConML message from PCConnServer -// ----------------------------------------------------------------------------- -// -void CSConPCConnplugin::HandleGetPCConnObjectL( const TDesC& aNameHeader, - const TDesC8& aTypeHeader ) - { - TRACE_FUNC_ENTRY; - if ( !iPCConnSessionConnected ) - { - LOGGER_WRITE( "ERROR, iPCConnSession was not connected" ); - User::Leave( KErrNotReady ); - } - TInt err = iPCConnSession.GetPacketL( aNameHeader, aTypeHeader, iBuffer ); - LOGGER_WRITE_1( "iPCConnSession.GetPacketL() returned: %d", err ); - User::LeaveIfError( err ); - iObject->SetDataBufL( iBuffer ); - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConPCConnplugin::HandleGetCatalogsObjectL -// Get Catalogs object -// ----------------------------------------------------------------------------- -// -void CSConPCConnplugin::HandleGetCatalogsObjectL( const TDesC8& aTypeHeader ) - { - TRACE_FUNC_ENTRY; - TInt err(KErrNone); - if ( !iCatalogsConnected ) - { - LOGGER_WRITE( "catalogs mime type recognised - failing due to no connection" ); - User::Leave( KErrNotReady ); - } - else - { - LOGGER_WRITE( "iCatalogs->GetDataL" ); - TDataType mime( aTypeHeader ); - TRAP( err, iCatalogs->GetDataL( mime, *iBuffer ) ); - LOGGER_WRITE_1( "iCatalogs->GetDataL : %d", err ); - if ( err == KErrServerTerminated ) - { - // server was terminated, try to reconnect - err = iCatalogs->Connect(); - LOGGER_WRITE_1( "iCatalogs->Connect() err: %d", err ); - User::LeaveIfError( err ); - LOGGER_WRITE( "iCatalogs->GetDataL" ); - iCatalogs->GetDataL( mime, *iBuffer ); - } - } - User::LeaveIfError( err ); - iObject->SetDataBufL( iBuffer ); - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConPCConnplugin::HandleGetFileObjectL -// Get file object -// ----------------------------------------------------------------------------- -// -void CSConPCConnplugin::HandleGetFileObjectL( const TDesC& aNameHeader ) - { - TRACE_FUNC_ENTRY; - delete iFileObject; - iFileObject = NULL; - iFileObject = CObexFileObject::NewL(); - - iFileObject->Reset(); - iFileObject->SetNameL( aNameHeader ); - - if ( !iFTPHandler ) - { - LOGGER_WRITE( "Creating iFTPHandler has failed" ); - User::Leave( KErrNotReady ); - } - - TInt err = iFTPHandler->GetFileObjectL( iFileObject ); - User::LeaveIfError( err ); - TRACE_FUNC_EXIT; - } - -// End of file diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/plugins/pcconn/src/sconpcconnpluginutils.cpp --- a/connectivitymodules/SeCon/plugins/pcconn/src/sconpcconnpluginutils.cpp Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,274 +0,0 @@ -/* -* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: PC Connectivity Plug-in Utils implementation -* -*/ - - -// INCLUDE FILES -#include -#include "sconpcconnpluginutils.h" -#include "debug.h" - -// ============================= MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// TPCConnpluginUtils::ConvertFTPResponseCode( TInt aError ) -// Converts Symbian error code to OBEX error code -// ----------------------------------------------------------------------------- -// -TInt TPCConnpluginUtils::ConvertFTPResponseCode( TInt aError ) - { - LOGGER_WRITE_1( "TPCConnpluginUtils::ConvertFTPResponseCode( TInt aError )\ - : begin, aError: %d", aError ); - TInt obexErr ( KErrIrObexRespBadRequest ); - switch( aError ) - { - case KErrNone: - obexErr = KErrNone; - break; - case KErrNotFound: - obexErr = KErrIrObexRespNotFound; - break; - case KErrGeneral: - case KErrCancel: - obexErr = KErrIrObexRespBadRequest; - break; - case KErrNoMemory: - obexErr = KErrIrObexRespDatabaseFull; - break; - case KErrNotSupported: - obexErr = KErrIrObexRespNotImplemented; - break; - case KErrArgument: - case KErrTotalLossOfPrecision: - case KErrBadHandle: - case KErrOverflow: - case KErrUnderflow: - case KErrAlreadyExists: - obexErr = KErrIrObexRespConflict; - break; - case KErrPathNotFound: - case KErrDied: - obexErr = KErrIrObexRespNotFound; - break; - case KErrInUse: - obexErr = KErrIrObexRespTimedOut; - break; - case KErrServerTerminated: - obexErr = KErrIrObexRespNotFound; - break; - case KErrServerBusy: - case KErrCompletion: - case KErrNotReady: - case KErrUnknown: - case KErrCorrupt: - obexErr = KErrIrObexRespForbidden; - break; - case KErrAccessDenied: - case KErrLocked: - obexErr = KErrIrObexRespUnauthorized; - break; - case KErrWrite: - case KErrDisMounted: - case KErrEof: - obexErr = KErrIrObexRespForbidden; - break; - case KErrDiskFull: - obexErr = KErrIrObexRespDatabaseFull; - break; - case KErrBadDriver: - case KErrBadName: - obexErr = KErrIrObexRespPreCondFailed; - break; - case KErrCommsLineFail: - case KErrCommsFrame: - case KErrCommsOverrun: - case KErrCommsParity: - case KErrTimedOut: - case KErrCouldNotConnect: - case KErrCouldNotDisconnect: - case KErrBadLibraryEntryPoint: - case KErrBadDescriptor: - case KErrAbort: - obexErr = KErrIrObexRespForbidden; - break; - case KErrTooBig: - obexErr = KErrIrObexRespReqEntityTooLarge; - break; - case KErrDivideByZero: - case KErrBadPower: - case KErrDirFull: - case KErrHardwareNotAvailable: - obexErr = KErrIrObexRespForbidden; - break; - case KErrDisconnected: // System is shutting down - obexErr = KErrIrObexRespMethodNotAllowed; - break; - default: - obexErr = KErrIrObexRespBadRequest; - break; - }; - LOGGER_WRITE_1( "TPCConnpluginUtils::ConvertFTPResponseCode( \ - TInt aError ) returned : %d", obexErr ); - return obexErr; -}; - -// ----------------------------------------------------------------------------- -// TPCConnpluginUtils::ConvertPCDResponseCode( TInt aError ) -// Converts Symbian error code to OBEX error code -// ----------------------------------------------------------------------------- -// -TInt TPCConnpluginUtils::ConvertPCDResponseCode( TInt aError ) - { - LOGGER_WRITE_1( "TPCConnpluginUtils::ConvertPCDResponseCode( TInt \ - aError ) : begin, aError: %d", aError ); - - TInt obexErr ( KErrIrObexRespInternalError ); - switch( aError ) - { - case KErrNone: - obexErr = KErrNone; - break; - case KErrNotFound: - obexErr = KErrIrObexRespNotFound; - break; - case KErrGeneral: - case KErrCancel: - obexErr = KErrIrObexRespInternalError; - break; - case KErrNoMemory: - obexErr = KErrIrObexRespDatabaseFull; - break; - case KErrNotSupported: - obexErr = KErrIrObexRespUnsupMediaType; - break; - case KErrArgument: - case KErrTotalLossOfPrecision: - case KErrBadHandle: - case KErrOverflow: - case KErrUnderflow: - obexErr = KErrIrObexRespPreCondFailed; - break; - case KErrAlreadyExists: - obexErr = KErrIrObexRespConflict; - break; - case KErrPathNotFound: - case KErrDied: - case KErrInUse: - obexErr = KErrIrObexRespTimedOut; - break; - case KErrServerTerminated: - obexErr = KErrIrObexRespPreCondFailed; - break; - case KErrServerBusy: - obexErr = KErrIrObexRespConflict; - break; - case KErrCompletion: - case KErrNotReady: - case KErrUnknown: - case KErrCorrupt: - obexErr = KErrIrObexRespInternalError; - break; - case KErrAccessDenied: - case KErrLocked: - obexErr = KErrIrObexRespUnauthorized; - break; - case KErrWrite: - case KErrDisMounted: - case KErrEof: - obexErr = KErrIrObexRespInternalError; - break; - case KErrDiskFull: - obexErr = KErrIrObexRespDatabaseFull; - break; - case KErrBadDriver: - case KErrBadName: - obexErr = KErrIrObexRespNotFound; - break; - case KErrCommsLineFail: - case KErrCommsFrame: - case KErrCommsOverrun: - case KErrCommsParity: - case KErrTimedOut: - case KErrCouldNotConnect: - case KErrCouldNotDisconnect: - case KErrBadLibraryEntryPoint: - case KErrBadDescriptor: - case KErrAbort: - case KErrTooBig: - case KErrDivideByZero: - case KErrBadPower: - case KErrDirFull: - case KErrHardwareNotAvailable: - obexErr = KErrIrObexRespInternalError; - break; - default: - obexErr = KErrIrObexRespInternalError; - break; - }; - LOGGER_WRITE_1( "TPCConnpluginUtils::ConvertPCDResponseCode(\ - TInt aError ) returned : %d", obexErr ); - return obexErr; -}; - -// ----------------------------------------------------------------------------- -// TPCConnpluginUtils::ConvertObexMoveResponseCode( TInt aError ) -// Converts Symbian error code to OBEX error code -// ----------------------------------------------------------------------------- -// -TInt TPCConnpluginUtils::ConvertObexMoveResponseCode( TInt aError ) - { - LOGGER_WRITE_1( "TPCConnpluginUtils::ConvertObexMoveResponseCode( TInt \ - aError ) : begin, aError: %d", aError ); - - TInt obexErr ( KErrIrObexRespInternalError ); - switch( aError ) - { - case KErrNone: - obexErr = KErrIrObexRespSuccess; - break; - case KErrNotFound: - case KErrPathNotFound: - obexErr = KErrIrObexRespNotFound; - break; - case KErrAccessDenied: - obexErr = KErrIrObexRespForbidden; - break; - case KErrNoMemory: - case KErrDiskFull: - obexErr = KErrIrObexRespDatabaseFull; - break; - case KErrInUse: - case KErrLocked: - obexErr = KErrIrObexRespConflict; - break; - case KErrNotSupported: - obexErr = KErrIrObexRespNotImplemented; - break; - case KErrAlreadyExists: - obexErr = KErrIrObexRespNotModified; - break; - - default: - obexErr = KErrIrObexRespInternalError; - break; - }; - LOGGER_WRITE_1( "TPCConnpluginUtils::ConvertObexMoveResponseCode(\ - TInt aError ) returned : %d", obexErr ); - return obexErr; -}; - -//End of file - diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/plugins/pcconn/src/sconservicetimer.cpp --- a/connectivitymodules/SeCon/plugins/pcconn/src/sconservicetimer.cpp Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,119 +0,0 @@ -/* -* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: PC Connectivity Plug-in Service Timer implementation -* -*/ - - -// INCLUDE FILES - -#include "sconservicetimer.h" -#include "sconpcconnplugin.h" -#include "debug.h" - -// ============================= MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CSConServiceTimer::CSConServiceTimer( CSConPCConnplugin* aEngine, TInt aValue ) -// Constuctor -// ----------------------------------------------------------------------------- -// -CSConServiceTimer::CSConServiceTimer( CSConPCConnplugin* aEngine, TInt aValue ) - : CActive( EPriorityStandard ), iEngine( aEngine ), iValue( aValue ) {} - -// ----------------------------------------------------------------------------- -// CSConServiceTimer::ConstructL() -// Initializes member data -// ----------------------------------------------------------------------------- -// -void CSConServiceTimer::ConstructL() - { - LOGGER_ENTERFN( "CSConServiceTimer::ConstructL()" ); - // create a thread-relative timer - User::LeaveIfError( iTimer.CreateLocal() ); - LOGGER_LEAVEFN( "CSConServiceTimer::ConstructL()" ); - } - -// ----------------------------------------------------------------------------- -// CSConServiceTimer::~CSConServiceTimer() -// Destructor -// ----------------------------------------------------------------------------- -// -CSConServiceTimer::~CSConServiceTimer() - { - LOGGER_ENTERFN( "CSConServiceTimer::~CSConServiceTimer()" ); - iTimer.Close(); - LOGGER_LEAVEFN( "CSConServiceTimer::~CSConServiceTimer()" ); - } - -// ----------------------------------------------------------------------------- -// CSConServiceTimer::~CSConServiceTimer() -// Starts the timer -// ----------------------------------------------------------------------------- -// -void CSConServiceTimer::StartTimer() - { - LOGGER_ENTERFN( "CSConServiceTimer::StartTimer()" ); - if( !IsActive() ) - { - LOGGER_WRITE( "CSConServiceTimer::StartTimer() : !IsActive()" ); - iTimer.After( iStatus, TTimeIntervalMicroSeconds32( iValue ) ); - iEngine->iSessionActive = ETrue; - SetActive(); - LOGGER_WRITE( "CSConServiceTimer::StartTimer() : SetActive()" ); - } - LOGGER_LEAVEFN( "CSConServiceTimer::StartTimer()" ); - } - -// ----------------------------------------------------------------------------- -// CSConServiceTimer::StopTimer() -// StopTimer() -// ----------------------------------------------------------------------------- -// -void CSConServiceTimer::StopTimer() - { - LOGGER_ENTERFN( "CSConServiceTimer::StopTimer()" ); - iEngine->iSessionActive = ETrue; - LOGGER_WRITE( "CSConServiceTimer::StopTimer() : iSessionActive = ETrue" ); - LOGGER_LEAVEFN( "CSConServiceTimer::StopTimer()" ); - } - -// ----------------------------------------------------------------------------- -// CSConServiceTimer::DoCancel() -// Cancels the timer -// ----------------------------------------------------------------------------- -// -void CSConServiceTimer::DoCancel() - { - LOGGER_ENTERFN( "CSConServiceTimer::DoCancel()" ); - iTimer.Cancel(); - LOGGER_LEAVEFN( "CSConServiceTimer::DoCancel()" ); - } - -// ----------------------------------------------------------------------------- -// CSConServiceTimer::RunL() -// Executed when timer is triggered -// ----------------------------------------------------------------------------- -// -void CSConServiceTimer::RunL() - { - LOGGER_ENTERFN( "CSConServiceTimer::RunL()" ); - iEngine->iSessionActive = EFalse; - LOGGER_WRITE( "CSConServiceTimer::RunL() : iSessionActive = EFalse" ); - iEngine->iStartTimer = EFalse; - LOGGER_WRITE( "CSConServiceTimer::RunL() : iStartTimer = EFalse " ); - LOGGER_LEAVEFN( "CSConServiceTimer::RunL()" ); - } - -// End of file diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/plugins/pcconn/src/sconshutdownwatcher.cpp --- a/connectivitymodules/SeCon/plugins/pcconn/src/sconshutdownwatcher.cpp Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,153 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Power shutdown -watcher implementation -* -*/ - - -// INCLUDE FILES - -#include "sconshutdownwatcher.h" -#include "debug.h" - -#include - - - -// ============================= MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CShutdownWatcher::NewL( MShutdownObserver* aObserver ) -// Two-phase constructor -// ----------------------------------------------------------------------------- -// -CShutdownWatcher* CShutdownWatcher::NewL( MShutdownObserver* aObserver ) - { - LOGGER_ENTERFN( "CShutdownWatcher::NewL()" ); - CShutdownWatcher* self = new (ELeave) CShutdownWatcher( aObserver ); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(self); - LOGGER_LEAVEFN( "CShutdownWatcher::NewL()" ); - return self; - } - -// ----------------------------------------------------------------------------- -// CShutdownWatcher::~CShutdownWatcher() -// Destructor -// ----------------------------------------------------------------------------- -// -CShutdownWatcher::~CShutdownWatcher() - { - LOGGER_ENTERFN( "CShutdownWatcher::~CShutdownWatcher()" ); - Cancel(); - iProperty.Close(); - LOGGER_LEAVEFN( "CShutdownWatcher::~CShutdownWatcher()" ); - } - -// ----------------------------------------------------------------------------- -// CShutdownWatcher::StartShutdownWatcher() -// Starts to watch shutdown status -// ----------------------------------------------------------------------------- -// -void CShutdownWatcher::StartShutdownWatcher() - { - LOGGER_ENTERFN( "CShutdownWatcher::StartShutdownWatcher()" ); - TInt status; - TInt err = iProperty.Get( KPSUidStartup, KPSGlobalSystemState, status ); - LOGGER_WRITE_2( "CShutdownWatcher::StartShutdownWatcher() :\ - err %d, KPSGlobalSystemState status %d",err, status); - if ( err == KErrNone ) - { - if ( status == ESwStateShuttingDown ) - { - LOGGER_WRITE( "Call NotifyShutdown" ); - iObserver->NotifyShutdown(); - return; - } - } - - err = iProperty.Attach( KPSUidStartup, KPSGlobalSystemState ); - LOGGER_WRITE_1( "CShutdownWatcher::StartShutdownWatcher() :\ - iProperty.Attach( KPSUidStartup, KPSGlobalSystemState ) : err %d", err ); - iProperty.Subscribe( iStatus ); - LOGGER_WRITE( "CShutdownWatcher::StartShutdownWatcher() :\ - iProperty.Subscribe( iStatus ) : ok" ); - SetActive(); - - LOGGER_LEAVEFN( "CShutdownWatcher::StartShutdownWatcher()" ); - } - -// ----------------------------------------------------------------------------- -// CShutdownWatcher::DoCancel() -// Executed when CActive is canceled. -// ----------------------------------------------------------------------------- -// -void CShutdownWatcher::DoCancel() - { - LOGGER_ENTERFN( "CShutdownWatcher::DoCancel()" ); - iProperty.Cancel(); - LOGGER_LEAVEFN( "CShutdownWatcher::DoCancel()" ); - } - -// ----------------------------------------------------------------------------- -// CShutdownWatcher::RunL() -// Executed when disk watcher is triggered -// ----------------------------------------------------------------------------- -// -void CShutdownWatcher::RunL() - { - LOGGER_ENTERFN( "CShutdownWatcher::RunL()" ); - TInt status; - iProperty.Get( status ); - LOGGER_WRITE_1( "CShutdownWatcher::RunL() : status %d", status ); - - if ( status == ESwStateShuttingDown ) - { - LOGGER_WRITE( "Call NotifyShutdown" ); - iObserver->NotifyShutdown(); - return; - } - - iProperty.Cancel(); - iProperty.Close(); - - LOGGER_LEAVEFN( "CShutdownWatcher::RunL()" ); - } - - -// ----------------------------------------------------------------------------- -// CShutdownWatcher::CShutdownWatcher( MShutdownObserver* aObserver ) -// Default constructor -// ----------------------------------------------------------------------------- -// -CShutdownWatcher::CShutdownWatcher( MShutdownObserver* aObserver ) -: CActive(EPriorityStandard), - iObserver(aObserver) - { - } - -// ----------------------------------------------------------------------------- -// CShutdownWatcher::ConstructL() -// Initializes member data -// ----------------------------------------------------------------------------- -// -void CShutdownWatcher::ConstructL() - { - LOGGER_ENTERFN( "CShutdownWatcher::ConstructL()" ); - CActiveScheduler::Add(this); - LOGGER_LEAVEFN( "CShutdownWatcher::ConstructL()" ); - } - -// End of file diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/rom/cntparser.iby --- a/connectivitymodules/SeCon/rom/cntparser.iby Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,21 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Image description file for Contact Parser Client and Server. -* -*/ - - -file=ABI_DIR\BUILD_DIR\cntparserserverexe.exe PROGRAMS_DIR\cntparserserverexe.exe -file=ABI_DIR\BUILD_DIR\cntparserserver.dll SHARED_LIB_DIR\cntparserserver.dll - diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/rom/sconcsc.iby --- a/connectivitymodules/SeCon/rom/sconcsc.iby Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -/* -* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Image description file for project SConCSC -* -*/ - - -#ifndef __SCONCSC_IBY__ -#define __SCONCSC_IBY__ -//file content - -file=ABI_DIR\BUILD_DIR\sconcsc.dll SHARED_LIB_DIR\sconcsc.dll -data=ZPRIVATE\101F99F6\capability\101F9698.xml PRIVATE\101F99F6\capability\101F9698.xml -data=ZPRIVATE\101F99F6\capability\fwdcomp.xml PRIVATE\101F99F6\capability\fwdcomp.xml -data=ZPRIVATE\101F99F6\capability\101F99F6.xml PRIVATE\101F99F6\capability\101F99F6.xml -#endif diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/rom/sconftp.iby --- a/connectivitymodules/SeCon/rom/sconftp.iby Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Image description file for CSConFTP -* -*/ - - -#ifndef __SCONFTP_IBY__ -#define __SCONFTP_IBY__ -//file content - -file=ABI_DIR\BUILD_DIR\sconftp.dll SHARED_LIB_DIR\sconftp.dll - -#endif diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/rom/sconftpplugin.iby --- a/connectivitymodules/SeCon/rom/sconftpplugin.iby Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Image description file for FTPplugin -* -*/ - - -#ifndef __SCONFTP_PLUGIN_IBY__ -#define __SCONFTP_PLUGIN_IBY__ -//file content - -ECOM_PLUGIN(sconftpplugin.dll,101F9686.RSC) - -#endif diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/rom/sconftpresources.iby --- a/connectivitymodules/SeCon/rom/sconftpresources.iby Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,23 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Image description file for SConFTP resources. -* -*/ - -#ifndef __SCONFTP_RESOURCE_IBY__ -#define __SCONFTP_RESOURCE_IBY__ - -data=DATAZ_\RESOURCE_FILES_DIR\sconftp.rsc RESOURCE_FILES_DIR\sconftp.rsc - -#endif \ No newline at end of file diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/rom/sconpcconnclientserver.iby --- a/connectivitymodules/SeCon/rom/sconpcconnclientserver.iby Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +0,0 @@ -/* -* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Image description file for project PCCONNClientServer -* -*/ - - -#ifndef __SCONPCCONNCLIENTSERVER_IBY__ -#define __SCONPCCONNCLIENTSERVER_IBY__ -//file content - -file=ABI_DIR\BUILD_DIR\sconconmlhandler.dll SHARED_LIB_DIR\sconconmlhandler.dll - -file=ABI_DIR\BUILD_DIR\sconpcconnserver.exe PROGRAMS_DIR\sconpcconnserver.exe -file=ABI_DIR\BUILD_DIR\sconpcconnclient.dll SHARED_LIB_DIR\sconpcconnclient.dll - -// stub files -data=ZSYSTEM\install\secon_stub.sis system\install\secon_stub.sis -data=ZSYSTEM\install\sconpcconnplugin_stub.sis system\install\sconpcconnplugin_stub.sis -data=ZSYSTEM\install\sconftpplugin_stub.sis system\install\sconftpplugin_stub.sis - -#endif diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/rom/sconpcconnplugin.iby --- a/connectivitymodules/SeCon/rom/sconpcconnplugin.iby Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Image description file for PC Connectivity Plug-in. -* -*/ -#ifndef __SCONPCCONN_PLUGIN_IBY__ -#define __SCONPCCONN_PLUGIN_IBY__ -//file content - -ECOM_PLUGIN(sconpcconnplugin.dll,101F9688.RSC) - -file=ABI_DIR\BUILD_DIR\catalogspcconnectivityplugin.dll SHARED_LIB_DIR\catalogspcconnectivityplugin.dll - -#endif diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/rom/sconpcd.iby --- a/connectivitymodules/SeCon/rom/sconpcd.iby Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Image description file for SConPCD. -* -*/ -#ifndef __SCONPCD_IBY__ -#define __SCONPCD_IBY__ -//file content - -file=ABI_DIR\BUILD_DIR\sconpcd.dll system\libs\sconpcd.dll - -data=ZPRIVATE\10202D56\sbeconfig.xml PRIVATE\10202D56\sbeconfig.xml - -#endif diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/servers/pcconn/bld/bld.inf --- a/connectivitymodules/SeCon/servers/pcconn/bld/bld.inf Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +0,0 @@ -/* -* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Build information file for project PCConnServer -* -*/ - - -PRJ_EXPORTS - - -PRJ_PLATFORMS -DEFAULT - -PRJ_MMPFILES -sconpcconnserver.mmp diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/servers/pcconn/bld/sconpcconnserver.mmp --- a/connectivitymodules/SeCon/servers/pcconn/bld/sconpcconnserver.mmp Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,61 +0,0 @@ -/* -* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: PC Connectivity Server -* -*/ - - -// To get the MW_LAYER_SYSTEMINCLUDE-definition -#include -#include - -VENDORID VID_DEFAULT - -CAPABILITY CAP_SERVER TrustedUI - -TARGET sconpcconnserver.exe -TARGETTYPE exe - -EPOCSTACKSIZE 49152 -EPOCHEAPSIZE 0x10000 0x800000 - -UID 0 0x101F99F6 - -// Server -SOURCEPATH ../src -SOURCE sconpcconnserver.cpp - -// ConML -SOURCEPATH ../../../wbxml/conmlhandler/src -SOURCE sconconmldtd.cpp -SOURCE sconxmlelement.cpp - -SOURCEPATH ../../../common/conmltask/src -SOURCE sconconmltask.cpp - -USERINCLUDE ../inc -USERINCLUDE ../../../inc -USERINCLUDE ../../../common/conmltask/inc -USERINCLUDE ../../../services/pcd/inc -USERINCLUDE ../../../services/csc/inc -USERINCLUDE ../../../wbxml/conmlhandler/inc - -// Default system include paths for middleware layer modules. -MW_LAYER_SYSTEMINCLUDE - -LIBRARY euser.lib -LIBRARY estor.lib // RMemWriteStream, RMemReadStream -LIBRARY efsrv.lib // Rfs, RFile -LIBRARY charconv.lib // For Unicode conversion -DEBUGLIBRARY flogger.lib diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/servers/pcconn/inc/sconpcconnclientserver.h --- a/connectivitymodules/SeCon/servers/pcconn/inc/sconpcconnclientserver.h Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,70 +0,0 @@ -/* -* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: PC Connectivity server client -* -*/ - - - - -#ifndef __SCONPCCONNCLIENTSERVER_H__ -#define __SCONPCCONNCLIENTSERVER_H__ - -#include - -// for debugging ConML messages and capability objects -//#define DEBUG_XML - - -// reasons for server panic -enum TPCConnServPanic - { - E_BadRequest = 1, - E_DispatchRequest, - E_InvalidClient, - E_CleanupCreate, - E_MainSchedulerError - }; - - -// server related constants -_LIT( KSConPCConnServerName,"SConPCConnServer" ); -_LIT( KSConPCConnServerExe, "SConPCConnServer.exe" ); - -// client -_LIT( KSConPCConnClientDll, "SConPCConnClient.dll" ); - - -// Chunk -const TUint KSConPCConnChunkSize = 128; -const TUint KSConPCConnChunkMaxSize = 65536; -const TUint KSConPCConnBufferMaxSize = 65000; - -// Version number -const TUint KSConPCConnServerVersionMajor = 1; -const TUint KSConPCConnServerVersionMinor = 0; -const TUint KSConPCConnServerVersionBuild = 1; - - -// Function codes - -enum TRequest -{ - EPutMessage, - EGetMessage, - EResetMessage, - EChunkMessage -}; - -#endif // __SCONPCCONNCLIENTSERVER_H__ diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/servers/pcconn/inc/sconpcconnserver.h --- a/connectivitymodules/SeCon/servers/pcconn/inc/sconpcconnserver.h Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,237 +0,0 @@ -/* -* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: PC Connectivity server -* -*/ - - -#ifndef __SCONPCCONNSERVER_H__ -#define __SCONPCCONNSERVER_H__ - -#include "sconconmlhandler.h" -#include "sconconmltask.h" - - -class CSConPCD; -class CSConCSC; -class CSConConMLParser; - -const TUint KSConDefaultHeapSize=0x10000; -const TInt KSConFirstDrive = 65; - -_LIT8 ( KParamNameSilent, "Silent" ); - - -// PCD Handler Dll -_LIT(KSConPCDLibName, "sconpcd.dll"); -const TInt KSConPCDUidValue = 0x10009D8D; -const TUid KSConPCDUid = {KSConPCDUidValue}; - -// CSC Handler Dll -_LIT(KSConCSCLibName, "sconcsc.dll"); -const TInt KSConCSCUidValue = 0x10009D8D; -const TUid KSConCSCUid = {KSConCSCUidValue}; - -// ConML Handler Dll -_LIT (KSConConMLHandlerLibName, "sconconmlhandler.dll"); -const TInt KSConConMLHandlerUidValue = 0x10009D8D; -const TUid KSConConMLHandlerUid = {KSConConMLHandlerUidValue}; - -// debug file for put and get messages -_LIT ( KSConConMLDebugFile, "c:\\data\\handler_result.txt"); - -// Secure ids -_LIT_SECURE_ID(KSConPCConnClientSecureId,0x101F7C87); - -// PCD types -_LIT8( KSConPCDXMLObjectType, "application/vnd.nokia.conml+xml" ); -_LIT8( KSConPCDXMLObjectType2, "application/vnd.nokia.pcd+xml" ); -_LIT8( KSConPCDWBXMLObjectType, "application/vnd.nokia.conml+wbxml" ); -_LIT8( KSConPCDWBXMLObjectType2, "application/vnd.nokia.pcd+wbxml" ); - -// CSC types -_LIT8( KSConCapabilityObjectType, "x-obex/capability" ); - -// Drives -_LIT( KSConNoDrive, "\x0" ); -_LIT( KSConDriveExists, "\x1" ); - -// user permissions -_LIT8( KSConPermReadOnly, "R" ); -_LIT8( KSConPermNormal, "RW" ); -// Java hash id for ConML -_LIT8( KSConJavaHashId, "JAVA_"); - -_LIT8( KSConAppInfoSeparator, "#" ); - -//********************************** -//CSConPCConnServer - PC Connectivity Server -//********************************** - -class CSConPCConnServer : public CServer2 - { -public: - // From CServer2 - IMPORT_C static CSConPCConnServer* NewLC(); - IMPORT_C ~CSConPCConnServer(); - - /** - * Function to start the server - * @param none - * @return Error code - */ - static TInt RunServer(); - - /** - * Function to start the server - * @param none - * @return none - */ - static void RunServerL(); - - /** - * Increments session count. - * @param none - * @return none - */ - void IncSessionCount(); - - /** - * Decrements session count. - * When count reaches zero, stops active scheduler - * @param none - * @return none - */ - void DecSessionCount(); - - -protected: - virtual CSession2* NewSessionL( const TVersion &aVersion, - const RMessage2& aMessage) const; - -private: - CSConPCConnServer(); - - TInt iSessionCount; - - }; - -//********************************** -//CSConPCConnSession - Server session class, handles the requested operations -//********************************** -class CSConPCConnSession : public CSession2, public MWBXMLConMLCallback - { - -public: - static CSConPCConnSession* NewL(CSConPCConnServer& aServer); - - /** - * From CSession2 - */ - void ServiceL( const RMessage2 &aMessage); - -private: - void DispatchRequestL( const RMessage2 &aMessage); - void LoadPCDDllL(); - void LoadCSCDllL(); - void LoadConMLHandlerDllL(); - -protected: - // Callback funktion for WBXML parsing - void ConMLL ( ConML_ConMLPtr_t aContent ); - -private: - void ConstructL(); - CSConPCConnSession ( CSConPCConnServer& aServer); - ~CSConPCConnSession(); - - TInt HandlePutMessageL(); - TInt HandleGetMessageL(); - TInt HandleWBXMLGetRequestL( const TDesC& aFileName ); - TInt HandleResetMessage(); - TInt HandleChunkMessage( const RMessage2& aMessage ); - TInt OptionsFromExecuteL ( ConML_ExecutePtr_t aContent ); - TInt TaskCancelL(ConML_CancelPtr_t aContent); - TInt TaskGetStatusL(ConML_GetStatusPtr_t aContent ); - TInt TaskInstallL( ConML_InstallPtr_t aContent ); - TInt TaskUnInstallL( ConML_UnInstallPtr_t aContent ); - void SplitL( const TDesC8& aText, const TChar aSeparator, RArray& aArray ); - TInt TaskListInstalledAppsL( ConML_ListInstalledAppsPtr_t aContent ); - TInt TaskListDataOwnersL(); - TInt TaskSetBURModeL( ConML_SetBURModePtr_t aContent ); - TInt TaskGetDataSizeL( ConML_GetDataSizePtr_t aContent ); - TInt TaskRequestDataL( ConML_RequestDataPtr_t aContent ); - TInt TaskUpdateDeviceInfoL( ConML_UpdateDeviceInfoPtr_t aContent ); - TInt TaskListPublicFilesL( ConML_ListPublicFilesPtr_t aContent ); - TInt TaskGetDataOwnerStatusL( ConML_GetDataOwnerStatusPtr_t aContent ); - TInt TaskSupplyDataL ( ConML_SupplyDataPtr_t aContent ); - TInt TaskRebootL(); - TInt TaskGetMetadataL( ConML_GetMetadataPtr_t aContent ); - void AppendStatusL( ConML_ConMLPtr_t aContent, CSConStatusReply* reply ); - void AppendUpdateDeviceInfoResultsL( ConML_ResultsPtr_t aContent, - CSConUpdateDeviceInfo* aResult ); - void AppendSetBURModeResultsL ( ConML_ResultsPtr_t aContent, - CSConSetBURMode* aResult ); - void AppendListInstalledAppsResultsL ( ConML_ResultsPtr_t aContent, - CSConListInstApps* aResult ); - void AppendListPublicFilesResultsL ( ConML_ResultsPtr_t aContent, - CSConListPublicFiles* aResult ); - void AppendRequestDataResultsL( ConML_ResultsPtr_t aContent, - CSConRequestData* aResult ); - void AppendSupplyDataResultsL( ConML_ResultsPtr_t aContent, - CSConSupplyData* aResult ); - void AppendInstallResultsL( ConML_ResultsPtr_t aContent, - CSConInstall* aResult ); - void AppendUninstallResultsL( ConML_ResultsPtr_t aContent, - CSConUninstall* aResult ); - void AppendListDataOwnersResultsL ( ConML_ResultsPtr_t aContent, - CSConListDataOwners* aResult ); - void AppendGetDataOwnerStatusResultsL ( ConML_ResultsPtr_t aContent, - CSConGetDataOwnerStatus* aResult ); - void AppendGetDataSizeResultsL ( ConML_ResultsPtr_t aContent, - CSConGetDataSize* aResult ); - void AppendGetMetadataResultsL ( ConML_ResultsPtr_t aContent, - CSConGetMetadata* aResult ); - void AppendProgressL ( ConML_ResultsPtr_t aContent, TInt progress ); - void AppendDrivesL( ConML_DrivesPtr_t aContent, TDriveList aDrives ); - TDriveList DriveList( ConML_DriveListPtr_t aContent ); - TDesC8& IntToDesLC( const TInt& anInt); - TDesC8& DriveNumToDesLC( const TInt& anInt ); - TDesC8& BufToDesLC( const TDesC& aBuf ); - TDesC8& UidToDesLC( const TUid& aUid ); - TUid DesToUid ( const TDesC8& aDes ); - TInt DesToInt( const TDesC8& aDes); - TBool HasDrives( TDriveList& aDrive ); - TDesC8& HashToDesLC( const TDesC& aBuf ); - TPtr DesToHashLC( const TDesC8& aDes ); - TBool IsJavaHash( const TDesC8& aDes ); - -// data -private: - CSConPCConnServer& iServer; - - RLibrary iPCDlib; - RLibrary iCSClib; - RLibrary iConMLHandlerLib; - - CSConPCD* iPCDHandler; - CSConCSC* iCSCHandler; - CSConConMLHandler* iConMLHandler; - - RChunk iChunk; - CBufFlat* iBuffer; - TInt iResult; - }; - -#endif // __SCONPCCONNSERVER_H__ diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/servers/pcconn/src/sconpcconnserver.cpp --- a/connectivitymodules/SeCon/servers/pcconn/src/sconpcconnserver.cpp Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2725 +0,0 @@ -/* -* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: PC Connectivity server -* -*/ - - -#include // For RMemReadStream -#include - -#include "sconpcconnclientserver.h" -#include "sconpcconnserver.h" -#include "sconpcd.h" -#include "sconcsc.h" -#include "sconconmlhandler.h" -#include "debug.h" - -#ifdef DEBUG_XML -#include -_LIT8( KTimeFormat, "%02d:%02d:%02d.%03d" ); -_LIT8( KXmlBegin, "\nXML:\n" ); -#endif - -_LIT( KSCONGetMetadataRequest, "METADATA:" ); - -//------------------------------------------------------------ -// Global functions -//------------------------------------------------------------ - -// ----------------------------------------------------------------------------- -// E32Main() -// Entry point -// ----------------------------------------------------------------------------- -// -TInt E32Main() - { - TRACE_FUNC_ENTRY; - __UHEAP_MARK; - TInt error( KErrNone ); - error = CSConPCConnServer::RunServer(); - __UHEAP_MARKEND; - TRACE_FUNC_EXIT; - return error; - } - -// ----------------------------------------------------------------------------- -// PanicServer() -// Panics the server with panic reason aPanic -// ----------------------------------------------------------------------------- -// -GLDEF_C void PanicServer(TPCConnServPanic aPanic) - { - LOGGER_WRITE_1( "CSConPCConnSession::PanicServer() : Panic code %d", aPanic ); - _LIT(KTxtServerPanic,"PCConn server panic"); - User::Panic(KTxtServerPanic,aPanic); - } - -// ----------------------------------------------------------------------------- -// CSConPCConnServer::CSConPCConnServer () -// Default constructor - can not leave -// ----------------------------------------------------------------------------- -// -CSConPCConnServer::CSConPCConnServer () : CServer2( EPriorityStandard) - { - LOGGER_WRITE( "* * * * CSConPCConnServer * * * *" ); - } - -// ----------------------------------------------------------------------------- -// CSConPCConnServer::~CSConPCConnServer() -// Default destructor -// ----------------------------------------------------------------------------- -// -EXPORT_C CSConPCConnServer::~CSConPCConnServer() - { - TRACE_FUNC; - } - -// ----------------------------------------------------------------------------- -// CSConPCConnServer::NewLC() -// Creates a new instance of CSConPCConnServer -// ----------------------------------------------------------------------------- -// -EXPORT_C CSConPCConnServer* CSConPCConnServer::NewLC() - { - TRACE_FUNC_ENTRY; - CSConPCConnServer* self = new (ELeave) CSConPCConnServer(); - CleanupStack::PushL( self ); - self->StartL( KSConPCConnServerName ); - TRACE_FUNC_EXIT; - return self; - } - -// ----------------------------------------------------------------------------- -// CSConPCConnServer::NewSessionL() -// Creates a new session to the client -// ----------------------------------------------------------------------------- -// -CSession2* CSConPCConnServer::NewSessionL( - const TVersion &aVersion, const RMessage2& /*aMessage*/ ) const - { - TRACE_FUNC_ENTRY; - - // check version - TVersion version( KSConPCConnServerVersionMajor, - KSConPCConnServerVersionMinor, - KSConPCConnServerVersionBuild); - - if (!User::QueryVersionSupported(version, aVersion)) - { - User::Leave(KErrNotSupported); - } - - // check client identity - RThread client; - Message().Client( client ); - TSecureId clientId = client.SecureId(); - - if ( clientId != KSConPCConnClientSecureId ) - { - LOGGER_WRITE( "CSConPCConnServer::NewSessionL() : Secure ID does not match" ); - User::Leave( KErrAccessDenied ); - } - - TRACE_FUNC_EXIT; - return CSConPCConnSession::NewL( *CONST_CAST( CSConPCConnServer*, this)); - } - -// ----------------------------------------------------------------------------- -// CSConPCConnServer::RunServer() -// Starts the server -// ----------------------------------------------------------------------------- -// -TInt CSConPCConnServer::RunServer() - { - TRACE_FUNC_ENTRY; - - CTrapCleanup* cleanup = CTrapCleanup::New(); - TInt ret = KErrNoMemory; - if( cleanup ) - { - TRAP( ret, CSConPCConnServer::RunServerL( ) ); - delete cleanup; - } - if( ret != KErrNone ) - { - // Signal the client that server creation failed - RProcess::Rendezvous( ret ); - } - TRACE_FUNC_EXIT; - return ret; - } - -// ----------------------------------------------------------------------------- -// CSConPCConnServer::RunServerL() -// Starts the server -// ----------------------------------------------------------------------------- -// -void CSConPCConnServer::RunServerL() - { - // Create and install the active scheduler we need - TRACE_FUNC_ENTRY; - CActiveScheduler *as=new (ELeave)CActiveScheduler; - CleanupStack::PushL( as ); - CActiveScheduler::Install( as ); - - // Create server - CSConPCConnServer* server = CSConPCConnServer::NewLC(); - - // Initialisation complete, now signal the client - User::LeaveIfError( RThread().RenameMe( KSConPCConnServerName ) ); - RProcess::Rendezvous( KErrNone ); - - // Ready to run - CActiveScheduler::Start(); - - // Cleanup the scheduler - CleanupStack::PopAndDestroy( 2, as ); - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConPCConnServer::IncSessionCount() -// Increments session count -// ----------------------------------------------------------------------------- -// -void CSConPCConnServer::IncSessionCount() - { - TRACE_FUNC_ENTRY; - iSessionCount++; - LOGGER_WRITE_1( "There are now %d sessions", iSessionCount ); - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConPCConnServer::DecSessionCount() -// Decrements session count -// ----------------------------------------------------------------------------- -// -void CSConPCConnServer::DecSessionCount() - { - TRACE_FUNC_ENTRY; - iSessionCount--; - LOGGER_WRITE_1( "There are still %d sessions", iSessionCount ); - if ( iSessionCount < 1 ) - { - Cancel(); - CActiveScheduler::Stop(); - } - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConPCConnSession::CSConPCConnSession() -// Default constructor -// ----------------------------------------------------------------------------- -// -CSConPCConnSession::CSConPCConnSession ( - CSConPCConnServer& aServer ) : iServer (aServer) - { - TRACE_FUNC_ENTRY; - iServer.IncSessionCount(); - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConPCConnSession::CSConPCConnSession() -// Default destructor - frees resources -// ----------------------------------------------------------------------------- -// -CSConPCConnSession::~CSConPCConnSession() - { - TRACE_FUNC_ENTRY; - - iServer.DecSessionCount(); - - if ( iConMLHandler ) - { - delete iConMLHandler; - iConMLHandler = NULL; - iConMLHandlerLib.Close(); - } - - if ( iPCDHandler ) - { - delete iPCDHandler; - iPCDHandler = NULL; - iPCDlib.Close(); - } - - if ( iCSCHandler ) - { - delete iCSCHandler; - iCSCHandler = NULL; - iCSClib.Close(); - } - - if ( iBuffer ) - { - delete iBuffer; - iBuffer = NULL; - } - - iChunk.Close(); - - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConPCConnSession::NewL() -// Creates a new instance of CSConPCConnSession -// ----------------------------------------------------------------------------- -// -EXPORT_C CSConPCConnSession *CSConPCConnSession::NewL( - CSConPCConnServer& aServer) - { - TRACE_FUNC_ENTRY; - CSConPCConnSession* self = new ( ELeave ) CSConPCConnSession(aServer); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - TRACE_FUNC_EXIT; - return self; - } - -// ----------------------------------------------------------------------------- -// CSConPCConnSession::ConstructL() -// 2nd phase constructor -// ----------------------------------------------------------------------------- -// -void CSConPCConnSession::ConstructL() - { - TRACE_FUNC_ENTRY; - TInt ret ( KErrNone ); - iResult = KErrNone; - -#ifdef DEBUG_XML - // create log file - RFs fs; - User::LeaveIfError( fs.Connect () ); - CleanupClosePushL( fs ); - - RFile file; - TInt err = file.Create ( fs, KSConConMLDebugFile, EFileWrite ); - if( err == KErrNone ) - { - // file created, close it - file.Close(); - } - - CleanupStack::PopAndDestroy( &fs ); -#endif - - // initialize buffer - iBuffer = CBufFlat::NewL ( KSConPCConnBufferMaxSize ); - - // load handlers - if ( !iPCDHandler ) - { - TRAP( ret, LoadPCDDllL() ); - if ( ret != KErrNone) - { - LOGGER_WRITE_1( "CSConPCConnSession::ConstructL() : PCD load failed with error code %d", ret ); - User::Leave( ret ); - } - } - - if ( !iCSCHandler ) - { - TRAP( ret, LoadCSCDllL() ); - if ( ret != KErrNone) - { - LOGGER_WRITE_1( "CSConPCConnSession::ConstructL() : CSC dll load failed with error code %d", ret ); - User::Leave ( ret ); - } - } - - // Load parser - if ( !iConMLHandler ) - { - TRAPD( ret, LoadConMLHandlerDllL() ); - if ( ret != KErrNone) - { - LOGGER_WRITE_1( "CSConPCConnSession::ConstructL() : Parser dll load failed with error code %d", ret ); - User::Leave ( ret ); - } - } - - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConPCConnSession::ServiceL() -// Gets the client's request -// ----------------------------------------------------------------------------- -// -void CSConPCConnSession::ServiceL( const RMessage2 &aMessage) - { - TRACE_FUNC_ENTRY; - TRAPD(err,DispatchRequestL(aMessage) ); - if ( err != KErrNone ) - { - LOGGER_WRITE_1( "CSConPCConnSession::ServiceL() : leave code %d", err ); - PanicServer( E_DispatchRequest ); - } - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConPCConnSession::DispatchRequestL() -// Identifies an IPC command from the client -// ----------------------------------------------------------------------------- -// -void CSConPCConnSession::DispatchRequestL(const RMessage2 &aMessage) - { - TRACE_FUNC_ENTRY; - - TInt ret (KErrNone); - - switch (aMessage.Function()) - { - case EPutMessage: - LOGGER_WRITE( "CSConPCConnSession::DispatchRequestL() : EPutMessage" ); - ret = HandlePutMessageL(); - break; - - case EGetMessage: - LOGGER_WRITE( "CSConPCConnSession::DispatchRequestL() : EGetMessage" ); - ret = HandleGetMessageL(); - break; - - case EResetMessage: - LOGGER_WRITE( "CSConPCConnSession::DispatchRequestL() : EResetMessage" ); - ret = HandleResetMessage(); - break; - - case EChunkMessage: - LOGGER_WRITE( "CSConPCConnSession::DispatchRequestL() : EChunkMessage" ); - ret = HandleChunkMessage( aMessage ); - break; - - default: - PanicServer (E_BadRequest); - break; - } - - aMessage.Complete( ret ); - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConPCConnSession::HandlePutMessageL() -// Handles a PUT -type message from the client -// ----------------------------------------------------------------------------- -// -TInt CSConPCConnSession::HandlePutMessageL() - { - TRACE_FUNC_ENTRY; - LOGGER_WRITE_1( "CSConPCConnSession::HandlePutMessageL() : begin : Heap count : %d", User::Heap().Count() ); - TInt ret ( KErrNone ); - - if ( !iPCDHandler ) - { - TRAP( ret, LoadPCDDllL() ); - if ( ret != KErrNone) - { - LOGGER_WRITE_1( "CSConPCConnSession::HandlePutMessageL (): PCD dll load failed with error code %d", ret ); - return ( ret ); - } - } - - if ( ! iConMLHandler ) - { - TRAP ( ret, LoadConMLHandlerDllL() ); - if ( ret != KErrNone ) - { - LOGGER_WRITE_1( "CSConPCConnSession::HandlePutMessageL (): ConML Handler dll load failed with error code %d", ret ); - return ( ret ); - } - } - - TInt length ( 0 ); - - RMemReadStream buf( iChunk.Base(), iChunk.Size() ); - - - iBuffer->Reset(); - - length = buf.ReadInt32L(); - HBufC8* name = HBufC8::NewLC( length ); - TPtr8 namePtr = name->Des(); - buf.ReadL( namePtr, length); - - length = buf.ReadInt32L(); - HBufC8* type = HBufC8::NewLC( length ); - TPtr8 typePtr = type->Des(); - buf.ReadL( typePtr, length); - - // WBXML Document - length = buf.ReadInt32L(); - HBufC8* data = HBufC8::NewLC( length ); - TPtr8 dataPtr = data->Des(); - - buf.ReadL( dataPtr, length ); - iBuffer->ResizeL( length ); - iBuffer->Write( 0, dataPtr ); - - buf.Close(); - -#ifdef DEBUG_XML - RFs fs; - User::LeaveIfError( fs.Connect() ); - CleanupClosePushL( fs ); - - RFile file; - if ( file.Open( fs, KSConConMLDebugFile, EFileWrite ) == KErrNone ) - { - RFileWriteStream fws; - TInt fileSize; - file.Size( fileSize ); - - TTime now; - now.HomeTime(); - TDateTime time = now.DateTime(); - TBuf8<16> timeLine; - timeLine.Format (KTimeFormat, time.Hour(), time.Minute(), - time.Second(), time.MicroSecond() ); - - fws.Attach( file, fileSize ); - fws.PushL(); - fws.WriteL( timeLine ); - _LIT8( KPutMessage, "__________PUT-MESSAGE \nWBXML:\n" ); - fws.WriteL( KPutMessage ); - fws.WriteL( iBuffer->Ptr(0), iBuffer->Size() ); - TRAP_IGNORE( fws.CommitL() ); - fws.Close(); - - CleanupStack::PopAndDestroy( &fws ); - } - file.Close(); - CleanupStack::PopAndDestroy( &fs ); -#endif - - if ( ( typePtr.Compare( KSConPCDWBXMLObjectType ) == KErrNone) || - ( typePtr.Compare( KSConPCDWBXMLObjectType2 )== KErrNone) ) - { - LOGGER_WRITE( "CSConPCConnSession::HandlePutMessageL() : Object type PCD " ); - TRAPD( err, ret = iConMLHandler->ParseDocumentL( *iBuffer, this ) ); - if ( err != KErrNone ) - { - ret = err; - } - if ( ret == KErrNone ) - { - // Possible error code returned from PCCS - ret = iResult; - } - } - else - { - LOGGER_WRITE( "Object type not regognized " ); - ret = KErrNotSupported; - } - CleanupStack::PopAndDestroy( data ); - CleanupStack::PopAndDestroy( type ); - CleanupStack::PopAndDestroy( name ); - LOGGER_WRITE_1( "CSConPCConnSession::HandlePutMessageL() end : Heap count : %d", User::Heap().Count() ); - LOGGER_WRITE_1( "CSConPCConnSession::HandlePutMessageL() : returned %d", ret ); - return ret; - } - -// ----------------------------------------------------------------------------- -// CSConPCConnSession::HandleGetMessageL() -// Handles a GET -type message from the client -// ----------------------------------------------------------------------------- -// -TInt CSConPCConnSession::HandleGetMessageL() - { - TRACE_FUNC_ENTRY; - TInt ret ( KErrNone ); - - if ( !iCSCHandler ) - { - TRAP( ret, LoadCSCDllL() ); - if ( ret != KErrNone) - { - LOGGER_WRITE_1( "CSConPCConnSession::HandleGetMessageL() : CSC dll load failed with error code %d", ret ); - return ret; - } - } - - TInt32 length ( 0 ); - RMemReadStream readBuf( iChunk.Base(), iChunk.Size() ); - iBuffer->Reset(); - - length = readBuf.ReadInt32L(); - HBufC8* name = HBufC8::NewLC( length ); - TPtr8 namePtr8 = name->Des(); - readBuf.ReadL( namePtr8, length); - namePtr8.SetLength( length ); - LOGGER_WRITE8_1("namePtr: %S", &namePtr8); - - const TUint8* ptr8 = namePtr8.Ptr(); - const TUint16* ptr16 = reinterpret_cast( ptr8 ); - TPtrC namePtr; - namePtr.Set( ptr16, length/2 ); - - length = readBuf.ReadInt32L(); - HBufC8* type = HBufC8::NewLC( length ); - TPtr8 typePtr = type->Des(); - readBuf.ReadL( typePtr, length); - - readBuf.Close(); - - if ( typePtr.Compare( KSConCapabilityObjectType ) == KErrNone ) - { - ret = iCSCHandler->CapabilityObject( *iBuffer ); - -#ifdef DEBUG_XML - RFs fs; - User::LeaveIfError(fs.Connect()); - CleanupClosePushL(fs); - - RFile file; - if ( file.Open(fs, KSConConMLDebugFile, EFileWrite ) == KErrNone ) - { - RFileWriteStream fws; - TInt fileSize; - file.Size ( fileSize ); - TTime now; - now.HomeTime(); - TDateTime time = now.DateTime(); - TBuf8<16> timeLine; - timeLine.Format( KTimeFormat, time.Hour(), time.Minute(), - time.Second(), time.MicroSecond() ); - - fws.Attach ( file, fileSize); - fws.PushL(); - fws.WriteL( timeLine ); - _LIT8( KGetMessage, "__________GET -MESSAGE - Capability Object \n " ); - fws.WriteL( KGetMessage ); - fws.WriteL( iBuffer->Ptr(0), iBuffer->Size() ); - TRAP_IGNORE( fws.CommitL() ); - fws.Close(); - - CleanupStack::PopAndDestroy( &fws ); - } - file.Close(); - CleanupStack::PopAndDestroy( &fs ); -#endif - - } - else if ( typePtr.CompareC( KSConPCDWBXMLObjectType) == KErrNone ) - { - ret = HandleWBXMLGetRequestL( namePtr ); - } - else - { - LOGGER_WRITE( "CSConPCConnSession::HandleGetMessageL() : Header type not regognized " ); - ret = KErrNotSupported; - } - - CleanupStack::PopAndDestroy( 2 ); // name, type - - if ( ret != KErrNone ) - { - return ret; - } - - length = iBuffer->Size(); - - if ( sizeof(TInt32) + length > iChunk.Size() ) - { - // need to resize chunk - TInt err = iChunk.Adjust( sizeof(TInt32) + length ); - LOGGER_WRITE_2("iChunk.Adjust( %d ) err: %d", sizeof(TInt32) + length, err); - if ( err ) - { - iBuffer->Reset(); - LOGGER_WRITE_1( "CSConPCConnSession::HandleGetMessageL() : returned %d", ret ); - return err; - } - } - - // copy data to chunk - RMemWriteStream writeBuf ( iChunk.Base(), iChunk.Size() ); - - if ( length > 0 ) - { - writeBuf.WriteInt32L( length ); - writeBuf.WriteL( iBuffer->Ptr(0), length ); - writeBuf.CommitL(); - } - else - { - writeBuf.WriteInt32L( 0 ); - } - writeBuf.CommitL(); - writeBuf.Close(); - iBuffer->Reset(); - LOGGER_WRITE_1( "CSConPCConnSession::HandleGetMessageL() : returned %d", ret ); - return ( ret ); - } - -// ----------------------------------------------------------------------------- -// CSConPCConnSession::HandleWBXMLGetRequestL() -// Handles a ConML(wbxml) Get request from the client -// ----------------------------------------------------------------------------- -// -TInt CSConPCConnSession::HandleWBXMLGetRequestL( const TDesC& aFileName ) - { - TRACE_FUNC_ENTRY; - TInt ret(KErrNone); - if ( aFileName.Find(KSCONGetMetadataRequest) == 0 ) - { - // ConML get metadata request --> Create metadata task - LOGGER_WRITE( "ConML GetMetadataRequest" ); - TPtrC filename = aFileName.Mid( KSCONGetMetadataRequest().Length() ); - - TSConMethodName method ( EGetMetadata ); - CSConTask* task = CSConTask::NewLC( method ); - - if ( filename.Length() > task->iGetMetadataParams->iFilename.MaxLength() ) - { - User::Leave( KErrTooBig ); - } - task->iGetMetadataParams->iFilename = filename; - - ret = iPCDHandler->PutTaskL( task ); - CleanupStack::Pop( task ); - LOGGER_WRITE_1("iPCDHandler->PutTaskL ret: %d", ret); - } - else if ( aFileName.Length() > 0 ) - { - LOGGER_WRITE("Error: aFilename does not match to any definitions"); - TRACE_FUNC_RET( KErrArgument ); - return KErrArgument; - } - - // Get reply - LOGGER_WRITE( "CSConPCConnSession::HandleGetMessageL() before ConML GetReplyL" ); - CSConStatusReply* reply = iPCDHandler->GetReply(); - CleanupStack::PushL( reply ); - - ConML_ConMLPtr_t content = new ( ELeave ) ConML_ConML_t(); - CleanupStack::PushL( content ); - - AppendStatusL( content, reply ); - ret = iConMLHandler->GenerateDocument( content ); - - CleanupStack::PopAndDestroy( content ); - CleanupStack::PopAndDestroy( reply ); - - TPtrC8 ptr( iConMLHandler->WBXMLDocument() ); - LOGGER_WRITE_1("ptr.Size(): %d", ptr.Size()); - iBuffer->ResizeL( ptr.Size() ); - iBuffer->Write( 0, ptr ); - -#ifdef DEBUG_XML - RFile file; - if ( file.Open( iFs, KSConConMLDebugFile, EFileWrite) == KErrNone ) - { - RFileWriteStream fws; - TInt fileSize; - file.Size ( fileSize ); - fws.Attach ( file, fileSize); - fws.PushL(); - TTime now; - now.HomeTime(); - TDateTime time = now.DateTime(); - TBuf8<16> timeLine; - timeLine.Format( KTimeFormat, time.Hour(), time.Minute(), - time.Second(), time.MicroSecond() ); - - fws.WriteL( timeLine ); - _LIT8( KGetMessage, "__________GET -MESSAGE" ); - fws.WriteL( KGetMessage ); - fws.WriteL(KXmlBegin); - fws.WriteL(iConMLHandler->XMLDocument().Ptr(), - iConMLHandler->XMLDocument().Length()); - fws.WriteL(_L("\n\n")); - TRAP_IGNORE( fws.CommitL() ); - fws.Close(); - CleanupStack::PopAndDestroy( &fws ); - } - - file.Close(); -#endif - TRACE_FUNC_RET(ret); - return ret; - } - -// ----------------------------------------------------------------------------- -// CSConPCConnSession::HandleResetMessage() -// Resets the PCCS service -// ----------------------------------------------------------------------------- -// -TInt CSConPCConnSession::HandleResetMessage() - { - TRACE_FUNC_ENTRY; - TInt ret ( KErrNone ); - - // reset PCD - if ( iPCDHandler ) - { - iPCDHandler->ResetPCD(); - } - - LOGGER_WRITE_1( "CSConPCConnSession::HandleResetMessage() : ret %d", ret ); - return ret; - } - -// ----------------------------------------------------------------------------- -// CSConPCConnSession::HandleChunkMessage( const RMessage2& aMessage ) -// Receives the chunk handle from the client -// ----------------------------------------------------------------------------- -// -TInt CSConPCConnSession::HandleChunkMessage( const RMessage2& aMessage ) - { - TRACE_FUNC_ENTRY; - TInt ret ( KErrNone ); - - ret = iChunk.Open( aMessage, 0, EFalse ); - - LOGGER_WRITE_1( "CSConPCConnSession::HandleChunkMessageL() : ret %d", ret ); - return ret; - } - -// ----------------------------------------------------------------------------- -// CSConPCConnSession::LoadPCDDllL() -// Loads the PCCS service -// ----------------------------------------------------------------------------- -// -void CSConPCConnSession::LoadPCDDllL() - { - TRACE_FUNC_ENTRY; - - // Dynamically load DLL - User::LeaveIfError( iPCDlib.Load( KSConPCDLibName ) ); - if( iPCDlib.Type()[1] != KSConPCDUid ) - { - LOGGER_WRITE( "CSConPCConnSession::LoadPCDDllL() : KSConPCDUidValue incorrect..." ); - iPCDlib.Close(); - User::Leave( KErrNotFound ); - } - TSConCreateCSConPCDFunc CreateCSConPCDL = - (TSConCreateCSConPCDFunc)iPCDlib.Lookup(1); - - iPCDHandler = (CSConPCD*)CreateCSConPCDL(); - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConPCConnSession::LoadCSCDllL() -// Loads the CSC service -// ----------------------------------------------------------------------------- -// -void CSConPCConnSession::LoadCSCDllL() - { - TRACE_FUNC_ENTRY; - // Dynamically load DLL - User::LeaveIfError( iCSClib.Load( KSConCSCLibName ) ); - if( iCSClib.Type()[1] != KSConCSCUid ) - { - LOGGER_WRITE( "CSConPCConnSession::LoadCSCDllL() : KSConCSCUidValue incorrect" ); - iCSClib.Close(); - User::Leave( KErrNotFound ); - } - TSConCreateCSConCSCFunc CreateCSConCSCL = - (TSConCreateCSConCSCFunc)iCSClib.Lookup(1); - - iCSCHandler = (CSConCSC*)CreateCSConCSCL(); - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConPCConnSession::LoadConMLHandlerDllL() -// Loads the ConML handler -// ----------------------------------------------------------------------------- -// -void CSConPCConnSession::LoadConMLHandlerDllL() - { - TRACE_FUNC_ENTRY; - // Dynamically load DLL - User::LeaveIfError( iConMLHandlerLib.Load( KSConConMLHandlerLibName ) ); - if ( iConMLHandlerLib.Type()[1] != KSConConMLHandlerUid ) - { - LOGGER_WRITE( "CSConPCConnSession::LoadConMLHandlerDllL() : KSConConMLHandlerUidValue incorrect" ); - iConMLHandlerLib.Close(); - User::Leave( KErrNotFound ); - } - TSConCreateCSConConMLHandlerFunc CreateCSConConMLHandlerL = - (TSConCreateCSConConMLHandlerFunc)iConMLHandlerLib.Lookup(1); - - iConMLHandler = (CSConConMLHandler*)CreateCSConConMLHandlerL(); - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConPCConnSession::ConMLL() -// Callback function for ConML handler - parsed data processing starts -// ----------------------------------------------------------------------------- -// -void CSConPCConnSession::ConMLL( ConML_ConMLPtr_t aContent ) - { - TRACE_FUNC_ENTRY; - TInt ret ( KErrNone ); - -#ifdef DEBUG_XML - iConMLHandler->GenerateDocument( aContent ); - RFs fs; - User::LeaveIfError(fs.Connect()); - CleanupClosePushL(fs); - RFile file; - - if ( file.Open(fs, KSConConMLDebugFile, EFileWrite) == KErrNone ) - { - RFileWriteStream fws; - TInt fileSize; - file.Size( fileSize ); - fws.Attach ( file, fileSize ); - fws.PushL(); - - TTime now; - now.HomeTime(); - TDateTime time = now.DateTime(); - TBuf8<16> timeLine; - timeLine.Format (KTimeFormat, time.Hour(), time.Minute(), - time.Second(), time.MicroSecond() ); - - fws.WriteL( timeLine ); - _LIT8( KPutMessage, "__________PUT-MESSAGE" ); - fws.WriteL( KPutMessage ); - fws.WriteL( KXmlBegin ); - fws.WriteL( iConMLHandler->XMLDocument().Ptr(), - iConMLHandler->XMLDocument().Length()); - fws.WriteL(_L("\n\n")); - TRAP_IGNORE( fws.CommitL() ); - fws.Close(); - CleanupStack::PopAndDestroy( &fws ); - } - file.Close(); - CleanupStack::PopAndDestroy( &fs ); - -#endif - - - if ( aContent ) - { - if ( aContent->execute ) - { - ret = OptionsFromExecuteL( aContent->execute ); - } - else if ( aContent->cancel ) - { - ret = TaskCancelL( aContent->cancel ); - } - else if ( aContent->getStatus ) - { - ret = TaskGetStatusL ( aContent->getStatus ); - } - else - { - LOGGER_WRITE( "CSConPCConnSession::ConML() : No appropriate content in ConML -element " ); - ret = KErrArgument; - } - } - else - { - ret = KErrArgument; - } - - // store result for later use - iResult = ret; - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConPCConnSession::OptionsFromExecuteL() -// Handles data of an execute -element -// ----------------------------------------------------------------------------- -// -TInt CSConPCConnSession::OptionsFromExecuteL(ConML_ExecutePtr_t aContent ) - { - TRACE_FUNC_ENTRY; - - TInt ret ( KErrNone ); - if ( aContent->updateDeviceInfo ) - { - ret = TaskUpdateDeviceInfoL( aContent->updateDeviceInfo); - } - else if ( aContent->listInstalledApps ) - { - ret = TaskListInstalledAppsL( aContent->listInstalledApps); - } - else if ( aContent->install ) - { - ret = TaskInstallL( aContent->install ); - } - else if ( aContent->unInstall ) - { - ret = TaskUnInstallL( aContent->unInstall ); - } - else if ( aContent->listDataOwners ) - { - ret = TaskListDataOwnersL(); - } - else if ( aContent->setBurMode ) - { - ret = TaskSetBURModeL( aContent->setBurMode ); - } - else if ( aContent->getDataSize ) - { - ret = TaskGetDataSizeL( aContent->getDataSize ); - } - else if ( aContent->requestData ) - { - ret = TaskRequestDataL( aContent->requestData ); - } - else if ( aContent->listPublicFiles ) - { - ret = TaskListPublicFilesL( aContent->listPublicFiles ); - } - else if ( aContent->reboot ) - { - ret = TaskRebootL(); - } - else if ( aContent->getDataOwnerStatus ) - { - ret = TaskGetDataOwnerStatusL( aContent->getDataOwnerStatus ); - } - else if ( aContent->supplyData ) - { - ret = TaskSupplyDataL( aContent->supplyData ); - } - else if ( aContent->getMetadata ) - { - ret = TaskGetMetadataL( aContent->getMetadata ); - } - else - { - LOGGER_WRITE( "CSConPCConnSession::OptionsFromExecute() : No content " ); - ret = KErrNotSupported; - } - LOGGER_WRITE_1( "CSConPCConnSession::OptionsFromExecute() : returned %d", ret ); - return ret; - } - -// ----------------------------------------------------------------------------- -// CSConPCConnSession::TaskCancelL(ConML_CancelPtr_t aContent) -// Sends a Cancel -task to PCCS service -// ----------------------------------------------------------------------------- -// -TInt CSConPCConnSession::TaskCancelL( ConML_CancelPtr_t aContent ) - { - TRACE_FUNC_ENTRY; - TInt ret ( KErrNone ); - TSConMethodName method ( ECancel ); - CSConTask* task = CSConTask::NewLC( method ); - if ( aContent->all ) - { - task->iCancelTaskAll = ETrue; - } - if ( aContent->id ) - { - task->iCancelTaskId = ( DesToInt( aContent->id->Data() )); - } - ret = iPCDHandler->PutTaskL( task ); - CleanupStack::Pop( task ); - LOGGER_WRITE_1( "CSConPCConnSession::TaskCancelL() : returned %d", ret ); - return ret; - } - - -// ----------------------------------------------------------------------------- -// CSConPCConnSession::TaskGetStatusL() -// Sends a Get Status -task to PCCS service -// ----------------------------------------------------------------------------- -// -TInt CSConPCConnSession::TaskGetStatusL( ConML_GetStatusPtr_t aContent ) - { - TRACE_FUNC_ENTRY; - TInt ret ( KErrNone ); - TSConMethodName method ( EGetStatus ); - CSConTask* task = CSConTask::NewLC( method ); - if ( aContent->all ) - { - task->iGetStatusParams->iAll = ETrue; - } - if ( aContent->id) - { - task->iGetStatusParams->iTaskId = ( DesToInt( aContent->id->Data() )); - } - ret = iPCDHandler->PutTaskL( task ); - CleanupStack::Pop( task ); - LOGGER_WRITE_1( "CSConPCConnSession::TaskGetStatusL() : returned %d", ret ); - return ret; - } - -// ----------------------------------------------------------------------------- -// CSConPCConnSession::TaskInstallL() -// Sends an Install -task to PCCS service -// ----------------------------------------------------------------------------- -// -TInt CSConPCConnSession::TaskInstallL( ConML_InstallPtr_t aContent ) - { - TRACE_FUNC_ENTRY; - TInt ret ( KErrNone ); - TSConMethodName method ( EInstall ); - CSConTask* task = CSConTask::NewLC( method); - task->iInstallParams->iMode = EUnknown; - if ( aContent->name ) - { - // Unicode conversion from 8-bit to 16-bit - CnvUtfConverter::ConvertToUnicodeFromUtf8(task->iInstallParams->iPath, - aContent->name->Data()); - } - if ( aContent->instParams ) - { - if ( aContent->instParams->param ) - { - for ( ConML_ParamListPtr_t p = aContent->instParams->param; - p && p->data; p = p->next) - { - LOGGER_WRITE( "CSConPCConnSession::TaskInstallL() : Parameters found " ); - if ( p->data->name ) - { - LOGGER_WRITE( "CSConPCConnSession::TaskInstallL() : name param found " ); - TPtrC8 silent(KParamNameSilent); - - TInt comp = Mem::Compare((TUint8*)p->data->name->content, (TInt)p->data->name->length, silent.Ptr(), silent.Length()); - if( comp == 0) - { - // "Silent"-param found - LOGGER_WRITE( "CSConPCConnSession::TaskInstallL() : Silent-param found " ); - if ( p->data->value ) - { - TPtrC8 dataValue((TUint8*)p->data->value->content, (TInt)p->data->value->length); - TInt value = DesToInt( dataValue ); - if (value == 1) - { - LOGGER_WRITE( "CSConPCConnSession::TaskInstallL() : ESilentInstall " ); - task->iInstallParams->iMode = ESilentInstall; - } - else if( value == 0 ) - { - LOGGER_WRITE( "CSConPCConnSession::TaskInstallL() : EUnsilentInstall " ); - task->iInstallParams->iMode = EUnsilentInstall; - } - } - } - } - } - } - } - ret = iPCDHandler->PutTaskL( task ); - CleanupStack::Pop( task ); - LOGGER_WRITE_1( "CSConPCConnSession::TaskInstallL() : returned %d", ret ); - return ret; - } - -// ----------------------------------------------------------------------------- -// CSConPCConnSession::TaskUnInstallL() -// Sends an Uninstall -task to PCCS service -// ----------------------------------------------------------------------------- -// -TInt CSConPCConnSession::TaskUnInstallL( ConML_UnInstallPtr_t aContent ) - { - TRACE_FUNC_ENTRY; - TInt ret ( KErrNone ); - TSConMethodName method ( EUninstall ); - CSConTask* task = CSConTask::NewLC( method ); - task->iUninstallParams->iMode = EUnknown; - - if ( aContent->applications->application) - { - for ( ConML_ApplicationListPtr_t p = - aContent->applications->application; p && p->data; p = p->next ) - { - if ( p->data ) - { - if ( p->data->name ) - { - // get application name - HBufC* nameBuf = CnvUtfConverter::ConvertToUnicodeFromUtf8L( p->data->name->Data() ); - task->iUninstallParams->iName.Copy( nameBuf->Des() ); - delete nameBuf; - nameBuf = NULL; - } - if ( p->data->uid ) - { - // parse uid: UID # Type # Size # Version # Vendor # Parent app. name # - // only UID and Vendor are needed from whole uid-field. - LOGGER_WRITE( "CSConPCConnSession::TaskUnInstallL() : start parsing uid " ); - - TPtrC8 buf( p->data->uid->Data() ); - - RArray arr(6); - CleanupClosePushL( arr ); - TBuf8<1> separator(KSConAppInfoSeparator); - - SplitL(buf, separator[0], arr); - if ( arr.Count() >= 5 ) - { - task->iUninstallParams->iUid = DesToUid( arr[0] ); - task->iUninstallParams->iType = (TSConAppType)DesToInt( arr[1] ); - HBufC* vendorBuf = CnvUtfConverter::ConvertToUnicodeFromUtf8L( arr[4] ); - task->iUninstallParams->iVendor.Copy( vendorBuf->Des() ); - delete vendorBuf; - vendorBuf = NULL; - } - CleanupStack::PopAndDestroy( &arr ); - - - } // endif p->data->uid - } - } - } - - if ( aContent->instParams) - { - if ( aContent->instParams->param ) - { - for ( ConML_ParamListPtr_t p = aContent->instParams->param; - p && p->data; p = p->next ) - { - LOGGER_WRITE( "CSConPCConnSession::TaskUnInstallL() : Parameters found " ); - if ( p->data->name ) - { - LOGGER_WRITE( "CSConPCConnSession::TaskUnInstallL() : name param found " ); - TPtrC8 silent(KParamNameSilent); - - TInt comp = Mem::Compare((TUint8*)p->data->name->content, (TInt)p->data->name->length, silent.Ptr(), silent.Length()); - if( comp == 0) - { - // "Silent"-param found - LOGGER_WRITE( "CSConPCConnSession::TaskUnInstallL() : Silent-param found " ); - if ( p->data->value ) - { - TPtrC8 dataValue((TUint8*)p->data->value->content, (TInt)p->data->value->length); - TInt value = DesToInt( dataValue ); - if ( value == 1 ) - { - LOGGER_WRITE( "CSConPCConnSession::TaskUnInstallL() : ESilentInstall " ); - task->iUninstallParams->iMode = ESilentInstall; - } - else if ( value == 0 ) - { - LOGGER_WRITE( "CSConPCConnSession::TaskUnInstallL() : EUnsilentInstall " ); - task->iUninstallParams->iMode = EUnsilentInstall; - } - } - } - } - } - } - } - ret = iPCDHandler->PutTaskL( task ); - CleanupStack::Pop( task ); - LOGGER_WRITE_1( "CSConPCConnSession::TaskUnInstallL() : returned %d", ret ); - return ret; - } - -// ----------------------------------------------------------------------------- -// CSConPCConnSession::SplitL(const TDesC& aText, const TChar aSeparator, -// RArray& aArray) -// Function splits string (eg "name1, name2, name3") into substrings. -// ----------------------------------------------------------------------------- -// -void CSConPCConnSession::SplitL(const TDesC8& aText, const TChar aSeparator, - RArray& aArray) - { - TRACE_FUNC_ENTRY; - TPtrC8 ptr; - ptr.Set(aText); - - for (;;) - { - TInt pos=ptr.Locate(aSeparator); - if (pos==KErrNotFound) - { - aArray.AppendL(ptr); - break; - } - - TPtrC8 subStr=ptr.Left(pos); // get pos characters starting from position 0 - aArray.AppendL(subStr); - - if (!(ptr.Length()>pos+1)) - { - break; - } - - ptr.Set(ptr.Mid(pos+1));// get all characters starting from position pos+1 - } - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConPCConnSession::TaskListInstalledAppsL() -// Sends a List installed apps -task to PCCS service -// ----------------------------------------------------------------------------- -// -TInt CSConPCConnSession::TaskListInstalledAppsL( - ConML_ListInstalledAppsPtr_t aContent ) - { - TRACE_FUNC_ENTRY; - TInt ret ( KErrNone ); - TSConMethodName method ( EListInstalledApps ); - CSConTask* task = CSConTask::NewLC( method ); - if( aContent-> drives ) - { - task->iListAppsParams->iDriveList = DriveList( aContent->drives->drive); - } - if ( aContent->all ) - { - task->iListAppsParams->iAllApps = ETrue; - } - ret = iPCDHandler->PutTaskL( task ); - CleanupStack::Pop( task ); - LOGGER_WRITE_1( "CSConPCConnSession::TaskListInstalledAppsL() : returned %d", ret); - return ret; - } - -// ----------------------------------------------------------------------------- -// CSConPCConnSession::TaskListDataOwnersL() -// Sends a List data owners -task to PCCS service -// ----------------------------------------------------------------------------- -// -TInt CSConPCConnSession::TaskListDataOwnersL() - { - TRACE_FUNC_ENTRY; - TInt ret ( KErrNone ); - TSConMethodName method ( EListDataOwners ); - CSConTask* task = CSConTask::NewLC( method ); - ret = iPCDHandler->PutTaskL( task ); - CleanupStack::Pop( task ); - LOGGER_WRITE_1( "CSConPCConnSession::TaskListDataOwnersL() : returned %d", ret ); - return ret; - } - -// ----------------------------------------------------------------------------- -// CSConPCConnSession::TaskSetBURModeL() -// Sends a Set BUR mode -task to PCCS service -// ----------------------------------------------------------------------------- -// -TInt CSConPCConnSession::TaskSetBURModeL(ConML_SetBURModePtr_t aContent ) - { - TRACE_FUNC_ENTRY; - TInt ret ( KErrNone ); - TSConMethodName method ( ESetBURMode ); - CSConTask* task = CSConTask::NewLC( method ); - if ( aContent->drives ) - { - task->iBURModeParams->iDriveList = DriveList( aContent->drives->drive); - } - if ( aContent->partialType ) - { - TInt intValue = DesToInt( aContent->partialType->Data() ); - task->iBURModeParams->iPartialType = static_cast (intValue) ; - } - if ( aContent->incType ) - { - TInt intValue = DesToInt( aContent->incType->Data() ); - task->iBURModeParams->iIncType = static_cast (intValue) ; - } - ret = iPCDHandler->PutTaskL( task ); - CleanupStack::Pop( task ); - LOGGER_WRITE_1( "CSConPCConnSession::TaskSetBURModeL() : returned %d", ret ); - return ret; - } - -// ----------------------------------------------------------------------------- -// CSConPCConnSession::TaskGetDataSizeL() -// Sends a Get data size -task to PCCS service -// ----------------------------------------------------------------------------- -// -TInt CSConPCConnSession::TaskGetDataSizeL(ConML_GetDataSizePtr_t aContent ) - { - TRACE_FUNC_ENTRY; - TInt ret ( KErrNone ); - TSConMethodName method ( EGetDataSize ); - CSConTask* task = CSConTask::NewLC( method ); - if ( aContent->dataOwners ) - { - for ( ConML_SIDListPtr_t p = aContent->dataOwners->sid; - p && p->data; p=p->next ) - { - CSConDataOwner* dataOwner = new (ELeave) CSConDataOwner(); - if ( p->data->type ) - { - dataOwner->iType = TSConDOType (DesToInt( - p->data->type->Data() )); - } - if (p->data->uid ) - { - if( !IsJavaHash( p->data->uid->Data() ) ) - { - dataOwner->iUid = DesToUid( p->data->uid->Data() ); - } - else - { - TPtr hashPtr = DesToHashLC( p->data->uid->Data() ); - dataOwner->iJavaHash = HBufC::NewL( hashPtr.Size() ); - dataOwner->iJavaHash->Des().Copy( hashPtr ); - CleanupStack::PopAndDestroy(); //DesToHashLC() - } - } - if ( p->data->drives ) - { - dataOwner->iDriveList = DriveList ( p->data->drives->drive ); - } - if ( p->data->transferDataType ) - { - TInt intValue = DesToInt( p->data->transferDataType->Data() ); - dataOwner->iTransDataType = static_cast (intValue); - } - task->iGetDataSizeParams->iDataOwners.Append( dataOwner ); - } - } - ret = iPCDHandler->PutTaskL( task ); - CleanupStack::Pop( task ); - LOGGER_WRITE_1( "CSConPCConnSession::TaskGetDataSizeL() : returned %d", ret ); - return ret; - } - -// ----------------------------------------------------------------------------- -// CSConPCConnSession::TaskRequestDataL() -// Sends a Request data -task to PCCS service -// ----------------------------------------------------------------------------- -// -TInt CSConPCConnSession::TaskRequestDataL(ConML_RequestDataPtr_t aContent ) - { - TRACE_FUNC_ENTRY; - TInt ret ( KErrNone ); - TSConMethodName method ( ERequestData ); - CSConTask* task = CSConTask::NewLC( method ); - if ( aContent ) - { - if ( aContent->sid ) - { - for ( ConML_SIDListPtr_t p=aContent->sid; p && p->data; p=p->next ) - { - if ( p->data->type ) - { - task->iRequestDataParams->iDataOwner->iType = - TSConDOType ( DesToInt ( p->data->type->Data() ) ); - } - if ( p->data->uid ) - { - if( !IsJavaHash( p->data->uid->Data() ) ) - { - task->iRequestDataParams->iDataOwner->iUid = DesToUid( - p->data->uid->Data() ); - } - else - { - TPtr hashPtr = DesToHashLC( p->data->uid->Data() ); - task->iRequestDataParams->iDataOwner->iJavaHash = HBufC::NewL( hashPtr.Size() ); - task->iRequestDataParams->iDataOwner->iJavaHash->Des().Copy( hashPtr ); - CleanupStack::PopAndDestroy(); //DesToHashLC() - } - } - if ( p->data->drives ) - { - task->iRequestDataParams->iDataOwner->iDriveList = - DriveList ( p->data->drives->drive ); - } - if ( p->data->transferDataType ) - { - TInt intValue = DesToInt( p->data->transferDataType->Data() ); - task->iRequestDataParams->iDataOwner->iTransDataType = - static_cast (intValue); - } - } - } - } - ret = iPCDHandler->PutTaskL( task ); - CleanupStack::Pop( task ); - LOGGER_WRITE_1( "CSConPCConnSession::TaskRequestDataL() : returned %d", ret ); - return ret; - } - -// ----------------------------------------------------------------------------- -// CSConPCConnSession::TaskUpdateDeviceInfoL() -// Sends a Update device info -task to PCCS service -// ----------------------------------------------------------------------------- -// -TInt CSConPCConnSession::TaskUpdateDeviceInfoL( - ConML_UpdateDeviceInfoPtr_t aContent ) - { - TRACE_FUNC_ENTRY; - TInt ret ( KErrNone ); - TSConMethodName method ( EUpdateDeviceInfo ); - CSConTask* task = CSConTask::NewLC( method ); - - if ( aContent->deviceInfo) - { - ConML_DeviceInfoPtr_t dPtr = aContent->deviceInfo; - if ( dPtr->version ) - { - task->iDevInfoParams->iVersion.Copy( dPtr->version->Data()); - } - if ( dPtr->maxObjectSize ) - { - task->iDevInfoParams->iMaxObjectSize = DesToInt( - dPtr->maxObjectSize->Data()); - } - if ( dPtr->supportedMethods ) - { - ConML_SupportedMethodsPtr_t smPtr = dPtr->supportedMethods; - if ( smPtr->install ) - { - task->iDevInfoParams->iInstallSupp = ETrue; - } - if ( smPtr->unInstall ) - { - task->iDevInfoParams->iUninstallSupp = ETrue; - } - if ( smPtr->listInstalledApps ) - { - task->iDevInfoParams->iInstAppsSupp = ETrue; - } - if ( smPtr->listDataOwners ) - { - task->iDevInfoParams->iDataOwnersSupp = ETrue; - } - if ( smPtr->setBurMode ) - { - task->iDevInfoParams->iSetBURModeSupp = ETrue; - } - if ( smPtr->getDataSize ) - { - task->iDevInfoParams->iGetSizeSupp = ETrue; - } - if ( smPtr->requestData ) - { - task->iDevInfoParams->iReqDataSupp = ETrue; - } - if ( smPtr->supplyData ) - { - task->iDevInfoParams->iSupplyDataSupp = ETrue; - } - if ( smPtr->reboot ) - { - task->iDevInfoParams->iRebootSupp = ETrue; - } - } - } - ret = iPCDHandler->PutTaskL( task ); - CleanupStack::Pop( task ); - LOGGER_WRITE_1( "CSConPCConnSession::TaskUpdateDeviceInfoL() : returned %d", ret ); - return ret; - } - -// ----------------------------------------------------------------------------- -// CSConPCConnSession::TaskListPublicFilesL() -// Sends a List public files -task to PCCS service -// ----------------------------------------------------------------------------- -// -TInt CSConPCConnSession::TaskListPublicFilesL( - ConML_ListPublicFilesPtr_t aContent ) - { - TRACE_FUNC_ENTRY; - TInt ret ( KErrNone ); - TSConMethodName method ( EListPublicFiles ); - CSConTask* task = CSConTask::NewLC( method ); - if ( aContent->sid ) - { - for ( ConML_SIDListPtr_t p = aContent->sid; p && p->data; p = p->next ) - { - CSConDataOwner* dataOwner = new (ELeave) CSConDataOwner(); - - if ( p->data->type ) - { - dataOwner->iType = TSConDOType ( DesToInt( - p->data->type->Data() ) ); - } - if ( p->data->uid ) - { - if( !IsJavaHash( p->data->uid->Data() ) ) - { - dataOwner->iUid = DesToUid( p->data->uid->Data() ); - } - else - { - TPtr hashPtr = DesToHashLC( p->data->uid->Data() ); - dataOwner->iJavaHash = HBufC::NewL( hashPtr.Size() ); - dataOwner->iJavaHash->Des().Copy( hashPtr ); - CleanupStack::PopAndDestroy(); //DesToHashLC() - } - } - if ( p->data->drives ) - { - dataOwner->iDriveList = DriveList ( p->data->drives->drive ); - } - if ( p->data->packageInfo && p->data->packageInfo->name ) - { - // Unicode conversion from 8-bit to 16-bit - CnvUtfConverter::ConvertToUnicodeFromUtf8( - dataOwner->iPackageName, - p->data->packageInfo->name->Data()); - } - task->iPubFilesParams->iDataOwners.Append( dataOwner ); - } - } - ret = iPCDHandler->PutTaskL( task ); - CleanupStack::Pop( task ); - LOGGER_WRITE_1( "CSConPCConnSession::TaskListPublicFilesL() : returned %d", ret ); - return ret; - } - -// ----------------------------------------------------------------------------- -// CSConPCConnSession::TaskSupplyDataL() -// Sends a Supply data -task to PCCS service -// ----------------------------------------------------------------------------- -// -TInt CSConPCConnSession::TaskSupplyDataL ( ConML_SupplyDataPtr_t aContent ) - { - TRACE_FUNC_ENTRY; - TInt ret ( KErrNone ); - TSConMethodName method ( ESupplyData ); - CSConTask* task = CSConTask::NewLC( method ); - if (aContent ) - { - for ( ConML_SIDListPtr_t p = aContent->sid; p && p->data; p = p->next ) - { - if ( p->data->type ) - { - task->iSupplyDataParams->iDataOwner->iType = - TSConDOType ( DesToInt( p->data->type->Data() ) ); - } - if ( p->data->uid ) - { - if( !IsJavaHash( p->data->uid->Data() ) ) - { - task->iSupplyDataParams->iDataOwner->iUid = DesToUid( - p->data->uid->Data() ); - } - else - { - TPtr hashPtr = DesToHashLC( p->data->uid->Data() ); - task->iSupplyDataParams->iDataOwner->iJavaHash = HBufC::NewL( hashPtr.Size() ); - task->iSupplyDataParams->iDataOwner->iJavaHash->Des().Copy( hashPtr ); - CleanupStack::PopAndDestroy(); //DesToHashLC() - } - } - if ( p->data->drives ) - { - task->iSupplyDataParams->iDataOwner->iDriveList = - DriveList ( p->data->drives->drive ); - } - if ( p->data->transferDataType ) - { - TInt intValue = DesToInt ( p->data->transferDataType->Data() ); - task->iSupplyDataParams->iDataOwner->iTransDataType = - static_cast (intValue); - } - if ( p->data->data ) - { - task->iSupplyDataParams->iRestoreData = HBufC8::NewL( - p->data->data->Data().Size() ); - *task->iSupplyDataParams->iRestoreData = p->data->data->Data(); - } - if ( p->data->moreData ) - { - task->iSupplyDataParams->iMoreData = ETrue; - } - else - { - task->iSupplyDataParams->iMoreData = EFalse; - } - } - } - ret = iPCDHandler->PutTaskL( task ); - CleanupStack::Pop( task ); - LOGGER_WRITE_1( "CSConPCConnSession::TaskSupplyDataL() : returned %d", ret ); - return ret; -} - -// ----------------------------------------------------------------------------- -// CSConPCConnSession::TaskGetDataOwnerStatusL() -// Sends a Get data owner status -task to PCCS service -// ----------------------------------------------------------------------------- -// -TInt CSConPCConnSession::TaskGetDataOwnerStatusL - ( ConML_GetDataOwnerStatusPtr_t aContent ) - { - TRACE_FUNC_ENTRY; - TInt ret ( KErrNone ); - TSConMethodName method ( EGetDataOwnerStatus ); - CSConTask* task = CSConTask::NewLC( method ); - - if ( aContent->dataOwners ) - { - for ( ConML_SIDListPtr_t p = aContent->dataOwners->sid; - p && p->data; p=p->next ) - { - CSConDataOwner* dataOwner = new (ELeave) CSConDataOwner(); - if ( p->data->type ) - { - dataOwner->iType = TSConDOType (DesToInt( - p->data->type->Data() )); - } - if ( p->data->uid ) - { - if( !IsJavaHash( p->data->uid->Data() ) ) - { - dataOwner->iUid = DesToUid( p->data->uid->Data() ); - } - else - { - TPtr hashPtr = DesToHashLC( p->data->uid->Data() ); - dataOwner->iJavaHash = HBufC::NewL( hashPtr.Size() ); - dataOwner->iJavaHash->Des().Copy( hashPtr ); - CleanupStack::PopAndDestroy(); //DesToHashLC() - } - } - task->iGetDataOwnerParams->iDataOwners.Append( dataOwner ); - } - } - ret = iPCDHandler->PutTaskL( task ); - CleanupStack::Pop( task ); - LOGGER_WRITE_1( "CSConPCConnSession::TaskGetDataOwnerStatusL() : returned %d", ret ); - return ret; - } - -// ----------------------------------------------------------------------------- -// CSConPCConnSession::TaskRebootL() -// Sends a Reboot -task to PCCS service -// ----------------------------------------------------------------------------- -// -TInt CSConPCConnSession::TaskRebootL( ) - { - TRACE_FUNC_ENTRY; - TInt ret ( KErrNone ); - TSConMethodName method ( EReboot ); - CSConTask* task = CSConTask::NewLC( method ); - ret = iPCDHandler->PutTaskL( task ); - CleanupStack::Pop( task ); - LOGGER_WRITE_1( "CSConPCConnSession::TaskRebootL() : returned %d", ret ); - return ret; - } - -// ----------------------------------------------------------------------------- -// CSConPCConnSession::TaskGetMetadataL() -// Sends a GetMetadata -task to PCCS service -// ----------------------------------------------------------------------------- -// -TInt CSConPCConnSession::TaskGetMetadataL( ConML_GetMetadataPtr_t aContent ) - { - TRACE_FUNC_ENTRY; - TInt ret ( KErrNone ); - TSConMethodName method ( EGetMetadata ); - CSConTask* task = CSConTask::NewLC( method ); - if( aContent ) - { - if ( aContent->filename ) - { - // Unicode conversion from 8-bit to 16-bit - CnvUtfConverter::ConvertToUnicodeFromUtf8(task->iGetMetadataParams->iFilename, - aContent->filename->Data()); - } - } - ret = iPCDHandler->PutTaskL( task ); - CleanupStack::Pop( task ); - LOGGER_WRITE_1( "CSConPCConnSession::TaskGetMetadataL() : returned %d", ret ); - return ret; - } - -// ----------------------------------------------------------------------------- -// CSConPCConnSession::TaskRebootL() -// Appends a status element from the reply data of PCCS -// ----------------------------------------------------------------------------- -// -void CSConPCConnSession::AppendStatusL( - ConML_ConMLPtr_t aContent, CSConStatusReply* reply ) - { - TRACE_FUNC_ENTRY; - - if ( !reply ) - { - LOGGER_WRITE( "CSConPCConnSession::AppendStatus() : No data in reply!" ); - return; - } - aContent->status = new ( ELeave ) ConML_Status_t(); - - if ( reply->iTasks.Count() > 0 ) - { - for ( TInt i=0; i < reply->iTasks.Count(); i ++) - { - ConML_TaskListPtr_t task = new ( ELeave ) ConML_TaskList_t(); - CleanupStack::PushL( task ); - GenericListAddL ( &aContent->status->task, task ); - CleanupStack::Pop(); // task - - task->data = new ( ELeave ) ConML_Task_t(); - task->data->id = new ( ELeave ) pcdata_t(); - task->data->id->SetDataL ( IntToDesLC(reply->iTasks[i]->iTaskId) ); - CleanupStack::PopAndDestroy(); // IntToDesLC - TSConMethodName method ( reply->iTasks[i]->iMethod ); - - switch ( method ) - { - case EUpdateDeviceInfo: - task->data->updateDeviceInfo = - new ( ELeave ) ConML_UpdateDeviceInfo_t(); - task->data->updateDeviceInfo->results = - new ( ELeave ) ConML_Results_t(); - AppendUpdateDeviceInfoResultsL( - task->data->updateDeviceInfo->results, - reply->iTasks[i]->iDevInfoParams ); - break; - - case ESetBURMode: - task->data->setBurMode = - new ( ELeave ) ConML_SetBURMode_t(); - task->data->setBurMode->results = - new ( ELeave) ConML_Results_t(); - AppendSetBURModeResultsL( - task->data->setBurMode->results, - reply->iTasks[i]->iBURModeParams ); - break; - - case EListInstalledApps: - task->data->listInstalledApps = - new ( ELeave ) ConML_ListInstalledApps_t(); - task->data->listInstalledApps->results = - new ( ELeave ) ConML_Results_t(); - AppendListInstalledAppsResultsL( - task->data->listInstalledApps->results, - reply->iTasks[i]->iListAppsParams); - break; - - case EInstall: - task->data->install = new ( ELeave ) ConML_Install_t(); - task->data->install->results = - new ( ELeave ) ConML_Results_t(); - AppendInstallResultsL( - task->data->install->results, - reply->iTasks[i]->iInstallParams ); - break; - - case EUninstall: - task->data->unInstall = new ( ELeave ) ConML_UnInstall_t(); - task->data->unInstall->results = - new ( ELeave ) ConML_Results_t(); - AppendUninstallResultsL( - task->data->unInstall->results, - reply->iTasks[i]->iUninstallParams ); - break; - - case EListDataOwners: - task->data->listDataOwners = - new ( ELeave ) ConML_ListDataOwners_t(); - task->data->listDataOwners->results = - new ( ELeave ) ConML_Results_t(); - AppendListDataOwnersResultsL( - task->data->listDataOwners->results, - reply->iTasks[i]->iListDataOwnersParams ); - break; - - case EGetDataOwnerStatus: - task->data->getDataOwnerStatus = - new ( ELeave ) ConML_GetDataOwnerStatus_t(); - task->data->getDataOwnerStatus->results = - new ( ELeave ) ConML_Results_t(); - AppendGetDataOwnerStatusResultsL( - task->data->getDataOwnerStatus->results, - reply->iTasks[i]->iGetDataOwnerParams); - break; - - case EGetDataSize: - task->data->getDataSize = - new ( ELeave ) ConML_GetDataSize_t(); - task->data->getDataSize->results = - new ( ELeave ) ConML_Results_t(); - AppendGetDataSizeResultsL( - task->data->getDataSize->results, - reply->iTasks[i]->iGetDataSizeParams ); - break; - - case EListPublicFiles: - task->data->listPublicFiles = - new ( ELeave ) ConML_ListPublicFiles_t(); - task->data->listPublicFiles->results = - new ( ELeave ) ConML_Results_t(); - AppendListPublicFilesResultsL ( - task->data->listPublicFiles->results, - reply->iTasks[i]->iPubFilesParams ); - break; - - case ERequestData: - task->data->requestData = - new ( ELeave ) ConML_RequestData_t(); - task->data->requestData->results = - new ( ELeave ) ConML_Results_t(); - AppendRequestDataResultsL( - task->data->requestData->results, - reply->iTasks[i]->iRequestDataParams ); - break; - - case ESupplyData: - task->data->supplyData = - new ( ELeave ) ConML_SupplyData_t(); - task->data->supplyData->results = - new ( ELeave ) ConML_Results_t(); - AppendSupplyDataResultsL ( - task->data->supplyData->results, - reply->iTasks[i]->iSupplyDataParams ); - break; - - case EGetMetadata: - task->data->getMetadata = - new ( ELeave ) ConML_GetMetadata_t(); - task->data->getMetadata->results = - new ( ELeave ) ConML_Results_t(); - AppendGetMetadataResultsL ( - task->data->getMetadata->results, - reply->iTasks[i]->iGetMetadataParams ); - break; - - default: - LOGGER_WRITE_1( "CSConPCConnSession:: AppendStatus() : Unknown method %d ", method ); - break; - } - } - } - else - { - LOGGER_WRITE( "CSConPCConnSession::AppendStatus() : No Task " ); - } - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConPCConnSession::AppendUpdateDeviceInfoResultsL() -// Appends a update device info -element from the reply data of PCCS -// ----------------------------------------------------------------------------- -// -void CSConPCConnSession::AppendUpdateDeviceInfoResultsL - ( ConML_ResultsPtr_t aContent, CSConUpdateDeviceInfo* aResult ) - { - TRACE_FUNC_ENTRY; - if ( aResult ) - { - if ( aResult->iComplete ) - { - aContent->complete = new ( ELeave ) pcdata_t(); - } - AppendProgressL ( aContent, aResult->iProgress ); - - aContent->deviceInfo = new ( ELeave ) ConML_DeviceInfo_t(); - aContent->deviceInfo->version = new ( ELeave ) pcdata_t(); - aContent->deviceInfo->version->SetDataL ( aResult->iVersion ); - - aContent->deviceInfo->supportedMethods = - new ( ELeave ) ConML_SupportedMethods_t(); - - if ( aResult->iInstallSupp ) - { - aContent->deviceInfo->supportedMethods->install = - new ( ELeave ) pcdata_t(); - } - if ( aResult->iUninstallSupp ) - { - aContent->deviceInfo->supportedMethods->unInstall = - new ( ELeave ) pcdata_t(); - } - if ( aResult->iInstAppsSupp ) - { - aContent->deviceInfo->supportedMethods->listInstalledApps = - new ( ELeave ) pcdata_t(); - } - if ( aResult->iDataOwnersSupp ) - { - aContent->deviceInfo->supportedMethods->listDataOwners = - new ( ELeave ) pcdata_t(); - } - if ( aResult->iSetBURModeSupp ) - { - aContent->deviceInfo->supportedMethods->setBurMode = - new ( ELeave ) pcdata_t(); - } - if ( aResult->iGetSizeSupp ) - { - aContent->deviceInfo->supportedMethods->getDataSize = - new ( ELeave ) pcdata_t(); - } - if ( aResult->iReqDataSupp ) - { - aContent->deviceInfo->supportedMethods->requestData = - new (ELeave ) pcdata_t(); - } - if ( aResult->iSupplyDataSupp ) - { - aContent->deviceInfo->supportedMethods->supplyData = - new ( ELeave ) pcdata_t(); - } - if ( aResult->iRebootSupp ) - { - aContent->deviceInfo->supportedMethods->reboot = - new ( ELeave ) pcdata_t(); - } - aContent->deviceInfo->maxObjectSize = new ( ELeave ) pcdata_t(); - aContent->deviceInfo->maxObjectSize->SetDataL ( IntToDesLC( - aResult->iMaxObjectSize )); - CleanupStack::PopAndDestroy(); // IntToDesLC - } - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConPCConnSession::AppendSetBURModeResultsL() -// Appends a Set BUR mode -element from the reply data of PCCS -// ----------------------------------------------------------------------------- -// -void CSConPCConnSession::AppendSetBURModeResultsL ( - ConML_ResultsPtr_t aContent, CSConSetBURMode* aResult ) - { - TRACE_FUNC_ENTRY; - if ( aResult ) - { - if ( aResult->iComplete ) - { - aContent->complete = new ( ELeave ) pcdata_t(); - } - AppendProgressL ( aContent, aResult->iProgress ); - } - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConPCConnSession::AppendListInstalledAppsResultsL() -// Appends a List installed apps -element from the reply data of PCCS -// ----------------------------------------------------------------------------- -// -void CSConPCConnSession::AppendListInstalledAppsResultsL ( - ConML_ResultsPtr_t aContent, CSConListInstApps* aResult ) - { - TRACE_FUNC_ENTRY; - - if ( aResult ) - { - if ( aResult->iComplete ) - { - aContent->complete = new ( ELeave ) pcdata_t(); - } - AppendProgressL ( aContent, aResult->iProgress ); - - if ( aResult->iApps.Count() > 0 ) - { - // 5 * KMaxFileName should be enought - // ( 4 items of TFileName and uid + type + size + 6* "#" ) - HBufC8* buf = HBufC8::NewLC( 5 * KMaxFileName ); - TPtr8 ptrBuf = buf->Des(); - - aContent->applications = new ( ELeave ) ConML_Applications_t(); - for ( TInt i=0; iiApps.Count(); i++) - { - ConML_ApplicationListPtr_t app = - new ( ELeave )ConML_ApplicationList_t(); - CleanupStack::PushL ( app ); - GenericListAddL ( &aContent->applications->application, app ); - CleanupStack::Pop(); // app - - app->data = new ( ELeave ) ConML_Application_t(); - app->data->name = new ( ELeave ) pcdata_t(); - app->data->name->SetDataL( BufToDesLC( - aResult->iApps[i]->iName)); - CleanupStack::PopAndDestroy(); // BufToDesLC - - // create uid: UID # Type # Size # Version # Vendor # Parent app. name # - LOGGER_WRITE( "CSConPCConnSession::AppendListInstalledAppsResultsL() : Create Uid" ); - - ptrBuf.Copy( UidToDesLC( aResult->iApps[i]->iUid ) ); - CleanupStack::PopAndDestroy(); // UidToDesLC - - ptrBuf.Append( KSConAppInfoSeparator ); - - ptrBuf.Append( IntToDesLC(aResult->iApps[i]->iType )); - CleanupStack::PopAndDestroy(); // IntToDesLC - - ptrBuf.Append( KSConAppInfoSeparator ); - - ptrBuf.Append( IntToDesLC(aResult->iApps[i]->iSize ) ); - CleanupStack::PopAndDestroy(); // IntToDesLC - - ptrBuf.Append( KSConAppInfoSeparator ); - ptrBuf.Append( aResult->iApps[i]->iVersion ); - - ptrBuf.Append( KSConAppInfoSeparator ); - ptrBuf.Append( BufToDesLC( aResult->iApps[i]->iVendor ) ); - CleanupStack::PopAndDestroy(); // BufToDesLC - - ptrBuf.Append( KSConAppInfoSeparator ); - ptrBuf.Append( BufToDesLC( aResult->iApps[i]->iParentName ) ); - CleanupStack::PopAndDestroy(); // BufToDesLC - - ptrBuf.Append( KSConAppInfoSeparator ); - - LOGGER_WRITE( "CSConPCConnSession::AppendListInstalledAppsResultsL() : set data" ); - app->data->uid = new ( ELeave ) pcdata_t(); - app->data->uid->SetDataL( *buf ); - - LOGGER_WRITE( "CSConPCConnSession::AppendListInstalledAppsResultsL() : Info added" ); - } - CleanupStack::PopAndDestroy(buf); - } - } - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConPCConnSession::AppendListPublicFilesResultsL() -// Appends a List public files -element from the reply data of PCCS -// ----------------------------------------------------------------------------- -// -void CSConPCConnSession::AppendListPublicFilesResultsL ( - ConML_ResultsPtr_t aContent, CSConListPublicFiles* aResult ) - { - TRACE_FUNC_ENTRY; - if ( aResult ) - { - if ( aResult->iComplete ) - { - aContent->complete = new ( ELeave ) pcdata_t(); - } - AppendProgressL ( aContent, aResult->iProgress ); - - if ( aResult->iFiles.Count() > 0 ) - { - aContent->files = new ( ELeave ) ConML_Files_t(); - for ( TInt i=0;iiFiles.Count(); i++ ) - { - ConML_FileListPtr_t file = new ( ELeave ) ConML_FileList_t(); - CleanupStack::PushL( file ); - GenericListAddL ( &aContent->files->file, file ); - CleanupStack::Pop(); // file - - file->data = new ( ELeave ) ConML_File_t(); - file->data->name = new ( ELeave ) pcdata_t(); - file->data->name->SetDataL( BufToDesLC ( - aResult->iFiles[i]->iPath ) ); - CleanupStack::PopAndDestroy(); // BufToDesLC - - file->data->modified = new ( ELeave ) pcdata_t(); - file->data->modified->SetDataL( BufToDesLC ( - aResult->iFiles[i]->iModified ) ); - CleanupStack::PopAndDestroy(); // BufToDesLC - - file->data->size = new ( ELeave ) pcdata_t(); - file->data->size->SetDataL( IntToDesLC ( - aResult->iFiles[i]->iSize ) ); - CleanupStack::PopAndDestroy(); // IntToDesLC - - file->data->userPerm = new ( ELeave ) pcdata_t(); - switch ( aResult->iFiles[i]->iUserPerm ) - { - case EPermReadOnly: - file->data->userPerm->SetDataL ( KSConPermReadOnly ); - break; - - case EPermNormal: - file->data->userPerm->SetDataL ( KSConPermNormal ); - break; - - default: - LOGGER_WRITE( "CSConPCConnSession:: AppendListPublicFilesResultsL() : Unknown userPerm! " ); - break; - } - } - } - } - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConPCConnSession::AppendRequestDataResultsL() -// Appends a Request data -element from the reply data of PCCS -// ----------------------------------------------------------------------------- -// -void CSConPCConnSession::AppendRequestDataResultsL( - ConML_ResultsPtr_t aContent, CSConRequestData* aResult ) - { - TRACE_FUNC_ENTRY; - if ( aResult ) - { - if ( aResult->iComplete ) - { - aContent->complete = new ( ELeave ) pcdata_t(); - } - AppendProgressL ( aContent, aResult->iProgress ); - - if ( aResult->iMoreData ) - { - aContent->moreData = new ( ELeave ) pcdata_t(); - } - if ( aResult->iBackupData ) - { - aContent->data = new ( ELeave ) pcdata_t(); - aContent->data->SetDataL( aResult->iBackupData->Des() ); - } - } - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConPCConnSession::AppendSupplyDataResultsL() -// Appends a Supply data -element from the reply data of PCCS -// ----------------------------------------------------------------------------- -// -void CSConPCConnSession::AppendSupplyDataResultsL( - ConML_ResultsPtr_t aContent, CSConSupplyData* aResult ) - { - TRACE_FUNC_ENTRY; - if ( aResult ) - { - if ( aResult->iComplete ) - { - aContent->complete = new ( ELeave ) pcdata_t(); - } - AppendProgressL( aContent, aResult->iProgress ); - } - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConPCConnSession::AppendInstallResultsL() -// Appends an Install -element from the reply data of PCCS -// ----------------------------------------------------------------------------- -// -void CSConPCConnSession::AppendInstallResultsL( - ConML_ResultsPtr_t aContent, CSConInstall* aResult ) - { - TRACE_FUNC_ENTRY; - if ( aResult ) - { - if ( aResult->iComplete ) - { - aContent->complete = new ( ELeave ) pcdata_t(); - } - AppendProgressL( aContent, aResult->iProgress ); - } - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConPCConnSession::AppendUninstallResultsL() -// Appends an Uninstall -element from the reply data of PCCS -// ----------------------------------------------------------------------------- -// -void CSConPCConnSession::AppendUninstallResultsL( - ConML_ResultsPtr_t aContent, CSConUninstall* aResult ) - { - TRACE_FUNC_ENTRY; - if ( aResult ) - { - if ( aResult->iComplete ) - { - LOGGER_WRITE( "CSConPCConnSession::AppendUninstallResultsL() Complete" ); - aContent->complete = new ( ELeave ) pcdata_t(); - } - LOGGER_WRITE_1( "CSConPCConnSession::AppendUninstallResultsL() iProgress: %d", aResult->iProgress ); - AppendProgressL( aContent, aResult->iProgress ); - } - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConPCConnSession::AppendListDataOwnersResultsL() -// Appends a List data owners -element from the reply data of PCCS -// ----------------------------------------------------------------------------- -// -void CSConPCConnSession::AppendListDataOwnersResultsL ( - ConML_ResultsPtr_t aContent, CSConListDataOwners* aResult ) - { - TRACE_FUNC_ENTRY; - if ( aResult ) - { - if ( aResult->iComplete ) - { - aContent->complete = new ( ELeave ) pcdata_t(); - } - AppendProgressL( aContent, aResult->iProgress ); - - if ( aResult->iDataOwners.Count() > 0 ) - { - aContent->dataOwners = new ( ELeave ) ConML_DataOwners_t(); - for ( TInt i=0; i < aResult->iDataOwners.Count(); i ++) - { - ConML_SIDListPtr_t sid = new ( ELeave ) ConML_SIDList_t(); - CleanupStack::PushL( sid ); - GenericListAddL ( &aContent->dataOwners->sid, sid ); - CleanupStack::Pop(); - - sid->data = new ( ELeave ) ConML_SID_t(); - - sid->data->type = new ( ELeave ) pcdata_t(); - sid->data->type->SetDataL ( IntToDesLC ( - aResult->iDataOwners[i]->iType) ); - CleanupStack::PopAndDestroy(); // IntToDesLC - - sid->data->uid = new ( ELeave ) pcdata_t(); - - if( aResult->iDataOwners[i]->iUid.iUid ) - { - sid->data->uid->SetDataL ( UidToDesLC ( - aResult->iDataOwners[i]->iUid ) ); - CleanupStack::PopAndDestroy(); // UidToDesLC - } - - if( aResult->iDataOwners[i]->iJavaHash ) - { - sid->data->uid->SetDataL ( HashToDesLC ( - aResult->iDataOwners[i]->iJavaHash->Des() ) ); - CleanupStack::PopAndDestroy(); // HashToDesLC - } - - if ( HasDrives ( aResult->iDataOwners[i]->iDriveList ) ) - { - sid->data->drives = new ( ELeave ) ConML_Drives_t(); - AppendDrivesL ( sid->data->drives, - aResult->iDataOwners[i]->iDriveList ); - } - - if ( aResult->iDataOwners[i]->iPackageName.Length() > 0 ) - { - sid->data->packageInfo = - new ( ELeave ) ConML_PackageInfo_t(); - sid->data->packageInfo->name = new ( ELeave ) pcdata_t(); - sid->data->packageInfo->name->SetDataL ( BufToDesLC ( - aResult->iDataOwners[i]->iPackageName ) ); - - CleanupStack::PopAndDestroy(); // BufToDesLC - } - - if ( aResult->iDataOwners[i]->iHasFiles || - aResult->iDataOwners[i]->iSupportsInc || - aResult->iDataOwners[i]->iDelayToPrep || - aResult->iDataOwners[i]->iReqReboot ) - { - sid->data->burOptions = new ( ELeave ) ConML_BUROptions_t(); - if ( aResult->iDataOwners[i]->iHasFiles ) - { - sid->data->burOptions->hasFiles = - new ( ELeave ) pcdata_t(); - sid->data->burOptions->hasFiles->SetDataL( IntToDesLC( - aResult->iDataOwners[i]->iHasFiles )); - - CleanupStack::PopAndDestroy(); // IntToDesLC - } - if ( aResult->iDataOwners[i]->iSupportsInc ) - { - sid->data->burOptions->supportsInc = - new ( ELeave ) pcdata_t(); - } - if ( aResult->iDataOwners[i]->iDelayToPrep ) - { - sid->data->burOptions->delayToPrepareData = - new ( ELeave ) pcdata_t(); - } - if ( aResult->iDataOwners[i]->iReqReboot ) - { - sid->data->burOptions->requiresReboot = - new ( ELeave ) pcdata_t(); - } - } - } - } - } - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConPCConnSession::AppendGetDataOwnerStatusResultsL() -// Appends a Get data owner status -element from the reply data of PCCS -// ----------------------------------------------------------------------------- -// -void CSConPCConnSession::AppendGetDataOwnerStatusResultsL - ( ConML_ResultsPtr_t aContent, CSConGetDataOwnerStatus* aResult ) - { - TRACE_FUNC_ENTRY; - if ( aResult ) - { - if ( aResult->iComplete ) - { - aContent->complete = new ( ELeave ) pcdata_t(); - } - AppendProgressL( aContent, aResult->iProgress ); - - if ( aResult->iDataOwners.Count() > 0 ) - { - aContent->dataOwners = new ( ELeave ) ConML_DataOwners_t(); - for ( TInt i=0; i < aResult->iDataOwners.Count(); i ++) - { - ConML_SIDListPtr_t sid = new ( ELeave ) ConML_SIDList_t(); - CleanupStack::PushL( sid ); - GenericListAddL ( &aContent->dataOwners->sid, sid ); - CleanupStack::Pop(); - - sid->data = new ( ELeave ) ConML_SID_t(); - - sid->data->type = new ( ELeave ) pcdata_t(); - sid->data->type->SetDataL ( IntToDesLC ( - aResult->iDataOwners[i]->iType) ); - CleanupStack::PopAndDestroy(); // IntToDesLC - - sid->data->uid = new ( ELeave ) pcdata_t(); - sid->data->uid->SetDataL ( UidToDesLC ( - aResult->iDataOwners[i]->iUid ) ); - CleanupStack::PopAndDestroy(); // UidToDesLC - - sid->data->dataOwnerStatus = new ( ELeave ) pcdata_t(); - sid->data->dataOwnerStatus->SetDataL ( IntToDesLC( - aResult->iDataOwners[i]->iDataOwnStatus )); - - CleanupStack::PopAndDestroy(); // IntToDesLC - } - } - } - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConPCConnSession::AppendGetDataSizeResultsL() -// Appends a Get data owner size -element from the reply data of PCCS -// ----------------------------------------------------------------------------- -// -void CSConPCConnSession::AppendGetDataSizeResultsL ( - ConML_ResultsPtr_t aContent, CSConGetDataSize* aResult ) - { - TRACE_FUNC_ENTRY; - if ( aResult ) - { - if ( aResult->iComplete ) - { - aContent->complete = new ( ELeave ) pcdata_t(); - } - AppendProgressL( aContent, aResult->iProgress ); - - if ( aResult->iDataOwners.Count() > 0 ) - { - aContent->dataOwners = new ( ELeave ) ConML_DataOwners_t(); - - for ( TInt i=0; i< aResult->iDataOwners.Count(); i++ ) - { - ConML_SIDListPtr_t sid = new ( ELeave ) ConML_SIDList_t(); - CleanupStack::PushL( sid ); - GenericListAddL ( &aContent->dataOwners->sid, sid ); - CleanupStack::Pop(); - - sid->data = new ( ELeave ) ConML_SID_t(); - - sid->data->type = new ( ELeave ) pcdata_t(); - sid->data->type->SetDataL ( IntToDesLC ( - aResult->iDataOwners[i]->iType) ); - CleanupStack::PopAndDestroy(); // IntToDesLC - - sid->data->uid = new ( ELeave ) pcdata_t(); - - if( aResult->iDataOwners[i]->iUid.iUid ) - { - sid->data->uid->SetDataL ( UidToDesLC ( - aResult->iDataOwners[i]->iUid ) ); - CleanupStack::PopAndDestroy(); // UidToDesLC - } - - if( aResult->iDataOwners[i]->iJavaHash ) - { - sid->data->uid->SetDataL ( HashToDesLC ( - aResult->iDataOwners[i]->iJavaHash->Des() ) ); - CleanupStack::PopAndDestroy(); // HashToDesLC - } - - if ( HasDrives ( aResult->iDataOwners[i]->iDriveList ) ) - { - sid->data->drives = new ( ELeave ) ConML_Drives_t(); - AppendDrivesL ( sid->data->drives, - aResult->iDataOwners[i]->iDriveList ); - } - - sid->data->size = new ( ELeave ) pcdata_t(); - sid->data->size->SetDataL( IntToDesLC( - aResult->iDataOwners[i]->iSize ) ); - CleanupStack::PopAndDestroy(); // IntToDesLC - - sid->data->transferDataType = new ( ELeave ) pcdata_t(); - sid->data->transferDataType->SetDataL( IntToDesLC( - aResult->iDataOwners[i]->iTransDataType ) ); - - CleanupStack::PopAndDestroy(); // IntToDesLC - } - } - } - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConPCConnSession::AppendGetMetadataResultsL() -// Appends a GetMetadata -element from the reply data of PCCS -// ----------------------------------------------------------------------------- -// -void CSConPCConnSession::AppendGetMetadataResultsL( - ConML_ResultsPtr_t aContent, CSConGetMetadata* aResult ) - { - TRACE_FUNC_ENTRY; - - if ( aResult ) - { - if ( aResult->iComplete ) - { - aContent->complete = new ( ELeave ) pcdata_t(); - - // add filename only if task is completed - aContent->filename = new ( ELeave ) pcdata_t(); - aContent->filename->SetDataL( BufToDesLC(aResult->iFilename ) ); - CleanupStack::PopAndDestroy(); // BufToDesLC - } - AppendProgressL( aContent, aResult->iProgress ); - - if ( aResult->iData ) - { - aContent->data = new ( ELeave ) pcdata_t(); - aContent->data->SetDataL( aResult->iData->Des() ); - } - - if ( aResult->iMoreData ) - { - aContent->moreData = new ( ELeave ) pcdata_t(); - } - } - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConPCConnSession::AppendProgressL() -// Appends a Progress -element from the reply data of PCCS -// ----------------------------------------------------------------------------- -// -void CSConPCConnSession::AppendProgressL ( - ConML_ResultsPtr_t aContent, TInt progress ) - { - TRACE_FUNC_ENTRY; - aContent->progress = new ( ELeave ) ConML_Progress_t(); - aContent->progress->value = new ( ELeave ) pcdata_t(); - aContent->progress->value->SetDataL ( IntToDesLC ( progress )); - CleanupStack::PopAndDestroy(); // IntToDesLC - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConPCConnSession::AppendDrivesL() -// Appends a Drives -element from the reply data of PCCS -// ----------------------------------------------------------------------------- -// -void CSConPCConnSession::AppendDrivesL( - ConML_DrivesPtr_t aContent, TDriveList aDrives ) - { - TRACE_FUNC_ENTRY; - - for ( TInt i = 0; idrive, drive ); - CleanupStack::Pop(); // drive - - drive->data = new ( ELeave ) ConML_Drive_t(); - drive->data->name = new ( ELeave ) pcdata_t(); - drive->data->name->SetDataL( DriveNumToDesLC(i+KSConFirstDrive )); - CleanupStack::PopAndDestroy(); // IntToDesLC - } - } - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConPCConnSession::DriveList() -// Converts an Drives -element to TDriveList -// ----------------------------------------------------------------------------- -// -TDriveList CSConPCConnSession::DriveList( ConML_DriveListPtr_t aContent ) - { - TBuf8 driveBuf; - TDriveList driveList; - - for ( ConML_DriveListPtr_t p = aContent; p && p->data; p = p->next ) - { - if ( p->data->name ) - { - driveBuf.Append( p->data->name->Data() ); - } - } - - for ( TInt i = 0; iDes(); - ptrBuf.Num(anInt); - return *buf; - } - -// ----------------------------------------------------------------------------- -// CSConPCConnSession::DriveNumToDesLC() -// Convers a drive number to equivalent drive letter -// ----------------------------------------------------------------------------- -// -TDesC8& CSConPCConnSession::DriveNumToDesLC( const TInt& anInt ) - { - TChar mark ( anInt ); - HBufC8* buf = HBufC8::NewLC(1); - TPtr8 ptrBuf = buf->Des(); - ptrBuf.Append(mark); - return *buf; - } - -// ----------------------------------------------------------------------------- -// CSConPCConnSession::BufToDesLC() -// converts a buffer to descriptor -// ----------------------------------------------------------------------------- -// -TDesC8& CSConPCConnSession::BufToDesLC( const TDesC& aBuf) - { - HBufC8* buf = CnvUtfConverter::ConvertFromUnicodeToUtf8L( aBuf ); - CleanupStack::PushL( buf ); - return *buf; - } - -// ----------------------------------------------------------------------------- -// CSConPCConnSession::UidToDesLC() -// converts an UID to a descriptor -// ----------------------------------------------------------------------------- -// -TDesC8& CSConPCConnSession::UidToDesLC( const TUid& aUid ) - { - HBufC8* buf = HBufC8::NewLC(10); - TPtr8 ptrBuf = buf->Des(); - ptrBuf.Copy (aUid.Name().Mid(1, 8) ); - return *buf; - } - -// ----------------------------------------------------------------------------- -// CSConPCConnSession::DesToUid() -// converts a descriptor to a UID value -// ----------------------------------------------------------------------------- -// -TUid CSConPCConnSession::DesToUid ( const TDesC8& aDes ) - { - TLex8 lex( aDes ); - TUint32 value; - lex.Val( value, EHex ); - TUid uid = TUid::Uid( value ); - return uid; - } - -// ----------------------------------------------------------------------------- -// CSConPCConnSession::DesToInt() -// converts a descriptor to a integer value -// ----------------------------------------------------------------------------- -// -TInt CSConPCConnSession::DesToInt( const TDesC8& aDes) - { - TLex8 lex(aDes); - TInt value = 0; - lex.Val(value); - return value; - } - -// ----------------------------------------------------------------------------- -// CSConPCConnSession::HasDrives() -// Returns ETrue if at least one drive is found from the given TDriveList -// ----------------------------------------------------------------------------- -// -TBool CSConPCConnSession::HasDrives( TDriveList& aDrive ) - { - TBool hasDrives ( EFalse ); - for ( TInt i = 0; iDes(); - // Unicode conversion from 16-bit to 8-bit - CnvUtfConverter::ConvertFromUnicodeToUtf8(ptrBuf, aBuf); - //Add JAVA_ identifier to the begining of the hash - ptrBuf.Insert(0, KSConJavaHashId); - return *buf; - } -// ----------------------------------------------------------------------------- -// CSConPCConnSession::DesToHashLC() -// converts descriptor to Java hash -// ----------------------------------------------------------------------------- -// -TPtr CSConPCConnSession::DesToHashLC( const TDesC8& aDes ) - { - HBufC* buf = HBufC::NewLC(aDes.Size()); - TPtr ptrBuf = buf->Des(); - // Unicode conversion from 8-bit to 16-bit - CnvUtfConverter::ConvertToUnicodeFromUtf8(ptrBuf, aDes); - //Delete JAVA_ - ptrBuf.Delete(0, KSConJavaHashId().Length()); - return ptrBuf; - } -// ----------------------------------------------------------------------------- -// CSConPCConnSession::IsJavaHash() -// Returns ETrue if descriptor is Java hash, else EFalse -// ----------------------------------------------------------------------------- -// -TBool CSConPCConnSession::IsJavaHash( const TDesC8& aDes ) - { - if ( aDes.FindC(KSConJavaHashId) == 0 ) - { - return ETrue; - } - else - { - return EFalse; - } - } - diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/services/csc/bld/101F9698.xml Binary file connectivitymodules/SeCon/services/csc/bld/101F9698.xml has changed diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/services/csc/bld/101F99F6.xml Binary file connectivitymodules/SeCon/services/csc/bld/101F99F6.xml has changed diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/services/csc/bld/bld.inf --- a/connectivitymodules/SeCon/services/csc/bld/bld.inf Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,38 +0,0 @@ -/* -* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Capability Object Module bld.inf file -* -*/ - - -#include - -PRJ_PLATFORMS -DEFAULT - -PRJ_EXPORTS -./101F9698.xml /epoc32/data/Z/private/101F99F6/capability/101F9698.xml -./fwdcomp.xml /epoc32/data/Z/private/101F99F6/capability/fwdcomp.xml -./101F99F6.xml /epoc32/data/Z/private/101F99F6/capability/101F99F6.xml - -./101F9698.xml /epoc32/RELEASE/winscw/udeb/Z/private/101F99F6/capability/101F9698.xml -./fwdcomp.xml /epoc32/RELEASE/winscw/udeb/Z/private/101F99F6/capability/fwdcomp.xml -./101F99F6.xml /epoc32/RELEASE/winscw/udeb/Z/private/101F99F6/capability/101F99F6.xml - - -PRJ_MMPFILES - -sconcsc.mmp - - diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/services/csc/bld/def/bwinscwu.def --- a/connectivitymodules/SeCon/services/csc/bld/def/bwinscwu.def Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -EXPORTS - ?CreateCSConCSCL@@YAPAVCSConCSC@@XZ @ 1 NONAME ; class CSConCSC * CreateCSConCSCL(void) - diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/services/csc/bld/def/eabiuu.def --- a/connectivitymodules/SeCon/services/csc/bld/def/eabiuu.def Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -EXPORTS - _Z15CreateCSConCSCLv @ 1 NONAME - _ZTI8CSConCSC @ 2 NONAME ; ## - _ZTV8CSConCSC @ 3 NONAME ; ## - diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/services/csc/bld/fwdcomp.xml Binary file connectivitymodules/SeCon/services/csc/bld/fwdcomp.xml has changed diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/services/csc/bld/sconcsc.mmp --- a/connectivitymodules/SeCon/services/csc/bld/sconcsc.mmp Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,80 +0,0 @@ -/* -* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Capability Object Module mmp file -* -*/ - - -// To get the MW_LAYER_SYSTEMINCLUDE-definition -#include -#include - -VENDORID VID_DEFAULT - -CAPABILITY CAP_GENERAL_DLL - -TARGETPATH sys/bin - -TARGET sconcsc.dll -TARGETTYPE DLL -UID 0x10009D8D 0x101F9698 - -#if defined(ARMCC) -DEFFILE ./def/eabiu -#elif defined(WINSCW) -DEFFILE ./def/bwinscw -#elif defined(WINS) -DEFFILE ./def/bwins -#elif defined(ARM) -DEFFILE ./def/bmarm -#endif - -SOURCEPATH ../src -SOURCE sconcsc.cpp -SOURCE capinfo.cpp -SOURCE caputils.cpp -SOURCE caplist.cpp -SOURCE stringlist.cpp -SOURCE capparser.cpp -SOURCE sconsyncservice.cpp -SOURCE sconversioninfo.cpp - -USERINCLUDE ../inc -USERINCLUDE ../../../inc - -// Default system include paths for middleware layer modules. -//MW_LAYER_SYSTEMINCLUDE -APP_LAYER_SYSTEMINCLUDE - -DEBUGLIBRARY flogger.lib -LIBRARY euser.lib -LIBRARY efsrv.lib -LIBRARY bafl.lib -LIBRARY sysutil.lib -LIBRARY etel.lib -LIBRARY etelmm.lib -LIBRARY hal.lib -LIBRARY platformenv.lib -LIBRARY charconv.lib -LIBRARY customapi.lib -LIBRARY centralrepository.lib -LIBRARY apgrfx.lib -LIBRARY apparc.lib -LIBRARY sisregistryclient.lib -LIBRARY SyncMLClientAPI.lib -LIBRARY javaregistryclient.lib -LIBRARY sysversioninfo.lib -LIBRARY Etel3rdParty.lib -LIBRARY platformver.lib - diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/services/csc/inc/capability.h --- a/connectivitymodules/SeCon/services/csc/inc/capability.h Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,483 +0,0 @@ -/* -* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Capability service controller -* -*/ - - -#ifndef _CAPABILITY_H_ -#define _CAPABILITY_H_ - -#include - -// -// string sizes -// -const TInt KBufSize(128); -const TInt KTagSize(64); -const TInt KMaxSize(512); - -const TInt KNestingLimit(10); - -// -// this directory contains xml-format files for -// Service-elements -// -_LIT(KCapabilityDirC, "c:\\private\\101F99F6\\capability\\"); -_LIT(KCapabilityDirCImport, "c:\\private\\101F99F6\\import\\"); -_LIT(KCapabilityDirZ, "z:\\private\\101F99F6\\capability\\"); - -// -// folder service constants -// -_LIT(KFolderServiceName, "Folder-Browsing"); -_LIT(KFolderServiceUid, "F9EC7BC4-953c-11d2-984E-525400DC9E09"); -_LIT(KFolderServiceVersion, "1.0"); -_LIT(KFolderServiceType, "x-obex/folder-listing"); -_LIT(KFolderMemoryTypeTag, "MemType"); -_LIT(KFolderNameTag, "Folder"); - -_LIT(KFolderImages, "Images"); -_LIT(KFolderGraphics, "Graphics"); -_LIT(KFolderTones, "Tones"); -_LIT(KFolderMusic, "Music"); -_LIT(KFolderVideos, "Videos"); -_LIT(KFolderInstalls, "Installs"); - -_LIT( KSyncSolutionsServiceName, "SyncSolutions" ); -_LIT( KSyncSolutionsServiceVersion, "1.0" ); -_LIT( KSyncCalendar, "Calendar" ); -_LIT( KSyncContacts, "Contacts" ); -_LIT( KSyncSms, "Sms" ); -_LIT( KSyncBookmark, "Bookmark" ); - -_LIT( KDesktopSync, "DesktopSync" ); - -enum TFolderTypes - { - EFolderImages, - EFolderGraphics, - EFolderTones, - EFolderMusic, - EFolderVideos, - EFolderInstalls - }; - - -// -// misc capabily document strings -// -_LIT(KServiceHeader, ""); -_LIT(KXmlVersion, ""); -_LIT(KComment1, ""); -_LIT(KDocType, ""); -_LIT(KRootBegin, ""); -_LIT(KRootEnd, ""); -_LIT(KCommentBegin, ""); -_LIT(KFormatText, " "); -_LIT(KXmlExtension, ".xml"); - - -// -// manufacturers -// -_LIT(KManufacturerNokia, "Nokia"); -_LIT(KManufacturerEricsson, "Ericsson"); -_LIT(KManufacturerMotorola, "Motorola"); -_LIT(KManufacturerPanasonic, "Panasonic"); -_LIT(KManufacturerPsion, "Psion"); -_LIT(KManufacturerIntel, "Intel"); -_LIT(KManufacturerCogent, "Cogent"); -_LIT(KManufacturerCirrus, "Cirrus"); -_LIT(KManufacturerLinkup, "Linkup"); -_LIT(KManufacturerTexasInstruments, "TexasInstruments"); - - -// -// media types (TMediaType in e32std.h) -// -_LIT(KMediaMMC, "MMC"); // memory card -_LIT(KMediaFlash, "DEV"); // device memory - -// -// TElementType contains all element types used in -// capabilty xml document -// -// -enum TElementType - { - ECapability, - EGeneral, - EManufacturer, - EModel, - ESN, - EOEM, - ESW, - EFW, - EHW, - ELanguage, - EMemory, - EMemType, - ELocation, - EFree, - EUsed, - EShared, - EFileSize, - EFolderSize, - EFileNLen, - EFolderNLen, - ECaseSenN, - - EExt, - EXNam, - EXVal, - - EObject, - EType, - EName_Ext, - ESize, - - EAccess, - EProtocol, - EEndpoint, - ETarget, - - EInbox, - EService, - EName, - EUUID, - EVersion, - - EAttVersion, - EAttDate, - - EAttCurrentNetwork, - EAttHomeNetwork, - EAttCountryCode - }; - - - - -// -// KXmlTokens contains all tokens (=tags) used in -// capabilty xml document -// -// - -typedef const TText* TTag; -NONSHARABLE_STRUCT( TXmlToken ) - { - TInt id; - TTag tag; - }; - -const TXmlToken KXmlTokens[] = - { - {ECapability, _S("Capability")}, - {EGeneral, _S("General")}, - {EManufacturer, _S("Manufacturer")}, - {EModel, _S("Model")}, - {ESN, _S("SN")}, - {EOEM, _S("OEM")}, - {ESW, _S("SW")}, - {EFW, _S("FW")}, - {EHW, _S("HW")}, - {ELanguage, _S("Language")}, - {EMemory, _S("Memory")}, - {EMemType, _S("MemType")}, - {ELocation, _S("Location")}, - {EFree, _S("Free")}, - {EUsed, _S("Used")}, - {EShared, _S("Shared")}, - {EFileSize, _S("FileSize")}, - {EFolderSize, _S("FolderSize")}, - {EFileNLen, _S("FileNLen")}, - {EFolderNLen, _S("FolderNLen")}, - {ECaseSenN, _S("CaseSenN")}, - {EExt, _S("Ext")}, - {EXNam, _S("XNam")}, - {EXVal, _S("XVal")}, - {EObject, _S("Object")}, - {EType, _S("Type")}, - {EName_Ext, _S("Name_Ext")}, - {ESize, _S("Size")}, - {EAccess, _S("Access")}, - {EProtocol, _S("Protocol")}, - {EEndpoint, _S("Endpoint")}, - {ETarget, _S("Target")}, - {EInbox, _S("Inbox")}, - {EService, _S("Service")}, - {EName, _S("Name")}, - {EUUID, _S("UUID")}, - {EVersion, _S("Version")}, - {EXNam, _S("XNam")}, - {EXVal, _S("XVal")}, - {EAttVersion, _S("Version")}, - {EAttDate, _S("Date")}, - {EAttCurrentNetwork,_S("CurrentNetwork")}, - {EAttHomeNetwork, _S("HomeNetwork")}, - {EAttCountryCode, _S("CountryCode")} - }; - -#define NUMXMLTOKENS (sizeof(KXmlTokens)/sizeof(TXmlToken)) - - - - -// -// string array to convert symbian TLanguage enums to -// ISO 639 language codes -// -// See "http://www.sil.org/iso639-3/default.asp" -// - -typedef const TText* TLangString; -NONSHARABLE_STRUCT( TLangStringStruct ) - { - TInt id; - TLangString lang; - }; - -/** - * Language mapping table. - */ -const TLangStringStruct KLangStrings[] = - { - {ELangEnglish, _S("en")}, - {ELangFrench, _S("fr")}, - {ELangGerman, _S("de")}, - {ELangSpanish, _S("es")}, - {ELangItalian, _S("it")}, - {ELangSwedish, _S("sv")}, - {ELangDanish, _S("da")}, - {ELangNorwegian, _S("no")}, - {ELangFinnish, _S("fi")}, - - {ELangAmerican, _S("en_US")}, - {ELangSwissFrench, _S("fr_CH")}, - {ELangSwissGerman, _S("de_CH")}, - {ELangPortuguese, _S("pt")}, - {ELangTurkish, _S("tr")}, - {ELangIcelandic, _S("is")}, - {ELangRussian, _S("ru")}, - {ELangHungarian, _S("hu")}, - {ELangDutch, _S("nl")}, - - {ELangBelgianFlemish, _S("nl_BE")}, - {ELangAustralian, _S("aus")}, - {ELangBelgianFrench, _S("fr_BE")}, - {ELangAustrian, _S("de_AT")}, - {ELangNewZealand, _S("en_NZ")}, - {ELangInternationalFrench, _S("fr")}, - {ELangCzech, _S("cs")}, - {ELangSlovak, _S("sk")}, - {ELangPolish, _S("pl")}, - - {ELangSlovenian, _S("sl")}, - {ELangTaiwanChinese, _S("zh_TW")}, - {ELangHongKongChinese, _S("zh_HK")}, - {ELangPrcChinese, _S("zh_CN")}, - {ELangJapanese, _S("ja")}, - {ELangThai, _S("th")}, - {ELangAfrikaans, _S("af")}, - {ELangAlbanian, _S("sq")}, - {ELangAmharic, _S("am")}, - - {ELangArabic, _S("ar")}, - {ELangArmenian, _S("hy")}, - {ELangTagalog, _S("tl")}, - {ELangBelarussian, _S("be")}, - {ELangBengali, _S("bn")}, - {ELangBulgarian, _S("bg")}, - {ELangBurmese, _S("my")}, - {ELangCatalan, _S("ca")}, - {ELangCroatian, _S("hr")}, - - {ELangCanadianEnglish, _S("en_CA")}, - {ELangInternationalEnglish, _S("en")}, - {ELangSouthAfricanEnglish, _S("en_ZA")}, - {ELangEstonian, _S("et")}, - {ELangFarsi, _S("fa")}, - {ELangCanadianFrench, _S("fr_CA")}, - {ELangScotsGaelic, _S("gd")}, - {ELangGeorgian, _S("ka")}, - {ELangGreek, _S("el")}, - - {ELangCyprusGreek, _S("el_CY")}, - {ELangGujarati, _S("gu")}, - {ELangHebrew, _S("he")}, - {ELangHindi, _S("hi")}, - {ELangIndonesian, _S("id")}, - {ELangIrish, _S("ga")}, - {ELangSwissItalian, _S("it_CH")}, - {ELangKannada, _S("kn")}, - {ELangKazakh, _S("kk")}, - - {ELangKhmer, _S("km")}, - {ELangKorean, _S("ko")}, - {ELangLao, _S("lo")}, - {ELangLatvian, _S("lv")}, - {ELangLithuanian, _S("lt")}, - {ELangMacedonian, _S("mk")}, - {ELangMalay, _S("ms")}, - {ELangMalayalam, _S("ml")}, - {ELangMarathi, _S("mr")}, - - {ELangMoldavian, _S("mo")}, - {ELangMongolian, _S("mn")}, - {ELangNorwegianNynorsk, _S("nn")}, - {ELangBrazilianPortuguese, _S("pt_BR")}, - {ELangPunjabi, _S("pa")}, - {ELangRomanian, _S("ro")}, - {ELangSerbian, _S("sr")}, - {ELangSinhalese, _S("si")}, - {ELangSomali, _S("so")}, - - {ELangInternationalSpanish, _S("es")}, - {ELangLatinAmericanSpanish, _S("es_US")}, - {ELangSwahili, _S("sw")}, - {ELangFinlandSwedish, _S("sv_FI")}, - {ELangReserved1, _S("en")}, - {ELangTamil, _S("ta")}, - {ELangTelugu, _S("te")}, - {ELangTibetan, _S("bo")}, - {ELangTigrinya, _S("ti")}, - - {ELangCyprusTurkish, _S("tr_CY")}, - {ELangTurkmen, _S("tk")}, - {ELangUkrainian, _S("uk")}, - {ELangUrdu, _S("ur")}, - {ELangReserved2, _S("en")}, - {ELangVietnamese, _S("vi")}, - {ELangWelsh, _S("cy")}, - {ELangZulu, _S("zu")}, - {ELangOther, _S("other")}, - - {ELangManufacturerEnglish, _S("en")}, - {ELangSouthSotho, _S("st")}, - {ELangBasque, _S("eu")}, - {ELangGalician, _S("gl")}, - {ELangJavanese, _S("jv")}, - {ELangMaithili, _S("bh")}, - {ELangAzerbaijani_Latin, _S("az")}, - {ELangAzerbaijani_Cyrillic, _S("az")}, - {ELangOriya, _S("or")}, - {ELangBhojpuri, _S("bh")}, - {ELangSundanese, _S("su")}, - {ELangKurdish_Latin, _S("ku")}, - {ELangKurdish_Arabic, _S("ku")}, - {ELangPashto, _S("ps")}, - {ELangHausa, _S("ha")}, - {ELangOromo, _S("om")}, - {ELangUzbek_Latin, _S("uz")}, - {ELangUzbek_Cyrillic, _S("uz")}, - {ELangSindhi_Arabic, _S("sd")}, - {ELangSindhi_Devanagari, _S("sd")}, - {ELangYoruba, _S("yo")}, - {ELangCebuano, _S("ceb")}, - {ELangIgbo, _S("ig")}, - {ELangMalagasy, _S("mg")}, - {ELangNepali, _S("ne")}, - {ELangAssamese, _S("as")}, - {ELangShona, _S("sn")}, - {ELangZhuang, _S("za")}, - {ELangMadurese, _S("mad")}, - - {ELangEnglish_Apac, _S("en")}, - {ELangEnglish_Taiwan, _S("en")}, - {ELangEnglish_HongKong, _S("en")}, - {ELangEnglish_Prc, _S("en")}, - {ELangEnglish_Japan, _S("en")}, - {ELangEnglish_Thailand, _S("en")}, - - {ELangFulfulde, _S("ff")}, - {ELangTamazight, _S("ber")}, - {ELangBolivianQuechua, _S("qu")}, - {ELangPeruQuechua, _S("qu")}, - {ELangEcuadorQuechua, _S("qu")}, - {ELangTajik_Cyrillic, _S("tg")}, - {ELangTajik_PersoArabic, _S("tg")}, - {ELangNyanja, _S("ny")}, - {ELangHaitianCreole, _S("ht")}, - {ELangLombard, _S("lmo")}, - {ELangKoongo, _S("kg")}, - {ELangAkan, _S("ak")}, - {ELangHmong, _S("hmn")}, - {ELangYi, _S("ii")}, - {ELangTshiluba, _S("lu")}, - {ELangIlocano, _S("ilo")}, - {ELangUyghur, _S("ug")}, - {ELangNeapolitan, _S("nap")}, - {ELangRwanda, _S("rw")}, - {ELangXhosa, _S("xh")}, - {ELangBalochi, _S("bal")}, - {ElangHiligaynon, _S("hil")}, - {ELangMinangkabau, _S("min")}, - {ELangMakhuwa, _S("vmw")}, - {ELangSantali, _S("sat")}, - {ELangGikuyu, _S("ki")}, - {ELangMoore, _S("mos")}, - {ELangGuarani, _S("gnHI")}, - {ELangRundi, _S("ru")}, - {ELangRomani_Latin, _S("rom")}, - {ELangRomani_Cyrillic, _S("rom")}, - {ELangTswana, _S("tn")}, - {ELangKanuri, _S("kr")}, - {ELangKashmiri_Devanagari, _S("ks")}, - {ELangKashmiri_PersoArabic, _S("ks")}, - {ELangUmbundu, _S("umb")}, - {ELangKonkani, _S("kok")}, - {ELangBalinese, _S("ban")}, - {ELangNorthernSotho, _S("nso")}, - {ELangWolof, _S("wo")}, - {ELangBemba, _S("bmy")}, - {ELangTsonga, _S("ts")}, - {ELangYiddish, _S("yi")}, - {ELangKirghiz, _S("ky")}, - {ELangGanda, _S("lg")}, - {ELangSoga, _S("xog")}, - {ELangMbundu, _S("kmb")}, - {ELangBambara, _S("bm")}, - {ELangCentralAymara, _S("ay")}, - {ELangZarma, _S("dje")}, - {ELangLingala, _S("ln")}, - {ELangBashkir, _S("ba")}, - {ELangChuvash, _S("cv")}, - {ELangSwati, _S("ss")}, - {ELangTatar, _S("tt")}, - {ELangSouthernNdebele, _S("nr")}, - {ELangSardinian, _S("sc")}, - {ELangScots, _S("sco")}, - {ELangMeitei, _S("mni")}, - {ELangWalloon, _S("wa")}, - {ELangKabardian, _S("kbd")}, - {ELangMazanderani, _S("mzn")}, - {ELangGilaki, _S("glk")}, - {ELangShan, _S("shn")}, - {ELangLuyia, _S("luy")}, - {ELanguageLuo, _S("luo")}, - {ELangSukuma, _S(" suk")}, - {ELangAceh, _S("ace")}, - {ELangMalay_Apac, _S("ms")} - }; - -#define NUMLANGSTRINGS (sizeof(KLangStrings)/sizeof(TLangStringStruct)) - - - - -#endif // capability.h - diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/services/csc/inc/capinfo.h --- a/connectivitymodules/SeCon/services/csc/inc/capinfo.h Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,94 +0,0 @@ -/* -* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Capability service controller -* -*/ - - -#ifndef _CAPINFO_H_ -#define _CAPINFO_H_ - -#include -#include - -#include "caputils.h" - -// -// CCapInfo creates capability document -// -// - -class CCapList; -class CStringList; -class TSConSolutionInfo; -class CSconVersionInfo; - -NONSHARABLE_CLASS( CCapInfo ) : public CBase -{ -public: - static CCapInfo* NewL(); - ~CCapInfo(); -private: - CCapInfo(); - void ConstructL(); - -public: - void CapabilityDocumentL( CBufFlat* aBuf ); - -private: - CCapList* CapList(); - void SetCapabilityBuf( CBufFlat* aBuf ); - - void GeneralInfoL(); - void MemoryInfoL(); - void WriteMemoryInfoL( TMemoryInfo& aInfo ); - void ServiceInfoL( const TDesC& aDir, const RArray& aExcludeList, - RArray& aFilesAdded ); - void FolderServiceL(); - - void SyncSolutionsServiceL(); - void WriteSyncSolutionsServiceL( const TSConSolutionInfo& aCalendar, - const TSConSolutionInfo& aContact, - const TSConSolutionInfo& aSms, - const TSConSolutionInfo& aBookmark ); - void WriteSolutionTagL( const TDesC& aContentName, const TSConSolutionInfo& aSolution ); - - void WriteFolderL( const TDesC& aType, const TDesC& aFullName, const TDesC& aMemory ); - - void WriteValueL( TInt aId, const TDesC& aValue ); - void WriteBigValueL( TInt aId, const TDesC& aValue ); - void WriteValueL( TInt aId, TInt64 aValue ); - void WriteTagL( TInt aId, TInt aType ); - void WriteAttributeL( TInt aId, const TDesC& aVersion, const TDesC& aDate ); - void WriteL( const TDesC& aText ); - - void WriteFromListL( CStringList* aList ); - void WriteNewLineL(); - - void FormatElement( TDes& aText ); - void AddFormatText( TDes& aText, TInt aNum ) const; - -private: - RFs iFsSession; // has - CCapList* iCapList; // has - HBufC8* iHeapBuf; // has - TBuf iBuf; - TIdStack iIdStack; - - CBufFlat* iCapabilityBuf; // uses - CSconVersionInfo* iSconInfo; -}; - -#endif // CCapability - diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/services/csc/inc/caplist.h --- a/connectivitymodules/SeCon/services/csc/inc/caplist.h Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,107 +0,0 @@ -/* -* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: CCapList header file. -* -*/ - - -#ifndef _CAPLIST_H_ -#define _CAPLIST_H_ - -// INCLUDES - -#include -#include -#include "stringlist.h" - -// -// Class CCapList -// -NONSHARABLE_CLASS( CCapList ) : public CBase -{ -public: - /** - * Two-phase constructor. - * @return CCapList instance - */ - static CCapList* NewL(); - /** - * Destructor - * @return none - */ - ~CCapList(); - -private: - /** - * Constructor - * @return none - */ - CCapList(); - /** - * Initializes the member data - * @return none - */ - void ConstructL(); - /** - * Operator = - * @param aList The data to be copied - * @return none - */ - void operator=(const CCapList& aList); // not allowed - -public: - /** - * Returns the list - * @return The CStringList object - */ - CStringList* List(); - -public: - /** - * Find element - * @param aId - * @param aType - * @param aIndex (Default=0) - * @return position - */ - TInt Find(TInt aId, TInt aType, TInt aIndex=0); - /** - * Find from mark - * @param aId - * @param aType - * @return position - */ - TInt FindFromMark(TInt aId, TInt aType); - /** - * Finds service xml-file identification header. This header must be the first - * line in every service file. - * @return ETrue if service header found - */ - TBool FindServiceHeader(); - /** - * Find service - * @param aList The source list - * @return ETrue if Service is found - */ - TBool FindServiceL(CStringList* aList); - -private: - CStringList* iList; // has -}; - -#endif - -// End of file - - diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/services/csc/inc/capparser.h --- a/connectivitymodules/SeCon/services/csc/inc/capparser.h Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,296 +0,0 @@ -/* -* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: CapParser header file -* -*/ - - - -#ifndef _CAPPARSER_H_ -#define _CAPPARSER_H_ - -// INCLUDES - -#include -#include - -// -// Class CapParser -// -NONSHARABLE_CLASS( CapParser ) - { - -public: - /** - * Parses element's id and type (eg. "" -> EMemory, EElementBegin) - * @param aText - * @param aId - * @param aType - * @return none - */ - static void ParseElement(const TDesC& aText, TInt& aId, TInt& aType); - -public: - /** - * Constructs element with value (eg. "23456"). - * @param aText - * @param aId - * @param aValue - * @return none - */ - static void MakeElementL(TDes& aText, TInt aId, const TDesC& aValue); - /** - * Constructs element without value (eg. "" or ""). - * @param aText - * @param aId - * @param aType - * @return none - */ - static void MakeElementL(TDes& aText, TInt aId, TInt aType); - /** - * Constructs element with attributes "Version" and "Date"(eg. - * ""). - * @param aText - * @param aId - * @param aVersion - * @param aDate - * @return none - */ - static void MakeElementL(TDes& aText, TInt aId, const TDesC& aVersion, - const TDesC& aDate); - /** - * Constructs element with attributes - * @param aText - * @param aId - * @param aAttributes - * @return none - */ - static void MakeElementL(TDes& aText, TInt aId, CDesCArrayFlat* aAttributes); - -public: - /** - * Returns capability element id (eg. EMemory). - * @param aText - * @return none - */ - static TInt ElementId(const TDesC& aText); - /** - * Returns capability element tag (eg. "Memory"). - * @param aText - * @param aId - * @return none - */ - static void GetTagL(TDes& aText, TInt aId); - -private: - /** - * Replaces special characters to xml compliant. - * @param aText - * @param aValue - * @return none - */ - static void ReplaceSpecialCharsL( TDes& aText, const TDesC& aValue ); - }; - - -// -// Class TXmlParser -// -NONSHARABLE_CLASS( TXmlParser ) - { - -public: - enum TElementType - { - EElementValue, - EElementBegin, - EElementEnd, - EElementEmpty, - EElementAtt, - EElementComment, - EElementVersion, - EElementDocType, - EElementUnknown - }; - - -public: - /** - * Sets a tag - * @param aText The tag - * @return none - */ - void Set(const TDesC& aText); - /** - * Returns type - * @return type - */ - TInt Type() const; - /** - * Returns a pointer to a tag - * @return The tag pointer - */ - TPtrC Tag() const; - /** - * Gets the tag - * @param aText The tag buffer - * @return none - */ - void GetTag(TDes& aText) const; - -private: - /** - * Parses value (eg. en) - * @return Operation success - */ - TBool ElementValue(); - /** - * Parses beginning tag (eg. ) - * @return Operation success - */ - TBool ElementBegin(); - /** - * Parses ending tag (eg. ) - * @return Operation success - */ - TBool ElementEnd(); - /** - * Parses empty element (eg. ) - * @return Operation success - */ - TBool ElementEmpty(); - /** - * Parses attribute element (eg. ) - * Note: Attribute values cannot contain equals (=) or quotations (") - * @return Operation success - */ - TBool ElementAtt(); - /** - * Identifies comment element (""). - * @return Operation success - */ - TBool ElementComment(); - /** - * Parses unknown elements - * @return Operation success - */ - TBool ElementUnknown(); - /** - * Identifies version element ("") - * @return Operation success - */ - TBool ElementVersion(); - /** - * Identifies document type element - * (""). - * @return Operation success - */ - TBool ElementDocType(); - -private: - /** - * Inits the parser - * @return none - */ - void Init(); - /** - * Parses xml-element. - * @return none - */ - void Parse(); - -public: - /** - * Validates the character - * @param aChar The char to be validated. - * @return ETrue if the char is valid - */ - static TBool ValidChar(const TChar aChar); - /** - * Validates the tag - * @param aText The tag to be validated. - * @return ETrue if the tag is valid - */ - static TBool ValidTag(const TDesC& aText); - /** - * Returns the number of characters (aChar) - * @param aText The buffer - * @param aChar The character - * @return The number of characters - */ - static TInt Count(const TDesC& aText, const TChar aChar); - /** - * Returns the position of the first non space character - * @param aText The buffer - * @return The position - */ - static TInt FirstNonSpace(const TDesC& aText); - /** - * Returns the position of the last non space character - * @param aText The buffer - * @return The position - */ - static TInt LastNonSpace(const TDesC& aText); - /** - * Function returns a sub-string between aPos1 and aPos2 - * @param aText The buffer - * @param aText Start position - * @param aText End position - * @return The pointer to the substring - */ - static TPtrC SubStr(const TDesC& aText, TInt aPos1, TInt aPos2); - /** - * Function performs string copy with length checking. - * @param aTarget Target buffer - * @param aSource Source buffer - * @return none - */ - static void StrCopy(TDes& aTarget, const TDesC& aSource); - -private: - /** - * Returns a string - * @return A pointer to a string - */ - TPtrC Str() const; - /** - * Trimmer function - * @return none - */ - void TrimOriginal(); - /** - * Function returns sub string between aPos1 and aPos2 - * @param aPos1 Start position - * @param aPos2 End posiotion - * @return none - */ - TPtrC SubStr(TInt pos1, TInt pos2); - -private: - TPtrC iOriginal; - TPtrC iText; - TPtrC iTag; - TPtrC iValue; - TInt iType; - - TInt iSlash; - TInt iFirst; - TInt iLast; - }; - -#endif - -// End of file - - diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/services/csc/inc/caputils.h --- a/connectivitymodules/SeCon/services/csc/inc/caputils.h Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,252 +0,0 @@ -/* -* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: CapUtil header file -* -*/ - - -// INCLUDES - -#ifndef _CAPUTILS_H_ -#define _CAPUTILS_H_ - -#include "capability.h" - -class RFs; - -// -// TMemoryInfo -// -NONSHARABLE_CLASS( TMemoryInfo ) - { -public: - TChar iDriveLetter; - TInt iDriveNum; - TBuf<16> iLocation; - TInt64 iFree; - TInt64 iUsed; - TBool iShared; - TInt64 iFileSize; - TInt64 iFolderSize; - TInt iFileNameSize; - TInt iFolderNameSize; - TBool iCaseSensitivity; - TUint iDriveStatus; - TInt iMemNr; - }; - -// -// CapUtil -// -NONSHARABLE_CLASS( CapUtil ) - { -public: - /** - * Gets default root path from pathinfo. - * @param aText - * @param aType - * @return none - */ - static void GetDefaultRootPathL( RFs& aFs, TDes& aRootPath ); - - /** - * Gets memory type. - * @param aFs - * @param aMemoryType - * @param aDrive - * @return none - */ - static void GetMemoryType( RFs& aFs, TDes& aMemoryType, const TInt aDrive ); - - /** - * Gets language - * @param aText - * @return none - */ - static void GetLanguage( TDes& aText ); - - /** - * Gets SW version, SW version date and device model from SysUtil. - * @param aVersion SW version - * @param aDate SW date - * @param aModel Device model - * @return none - */ - static void GetSWVersionL( TDes& aVersion, TDes& aDate, TDes& aModel ); - - /** - * Gets phone manufacturer from HAL. In case manufacturer is not known, - * empty value is used. - * @param aText Manufacturer - * @return none - */ - static void GetManufacturer( TDes& aText ); - - /** - * Get memory information for one drive. - * @param aFs RFs handle - * @param aDriveNumber drive number - * @param aInfo Memory information - * @return none - */ - static void GetMemoryInfoL( const RFs& aFs, const TInt aDriveNumber, TMemoryInfo& aInfo ); - - /** - * Initializes TMemoryInfo. - * @param aInfo TMemoryInfo to be initialized - * @return none - */ - static void InitMemoryInfo( TMemoryInfo& aInfo ); - - /** - * Get language string for aId. - * @param aId Language id - * @param aText Language text - * @return none - */ - static void GetLanguageString( TLanguage aId, TDes& aText ); - - /** - * Finds all files in aDir. - * @param aFs RFs handle - * @param aDir Directory - * @param aList List of files in directory - * @return none - */ - static void GetFileListL( const RFs& aFs, const TDesC& aDir, - RArray& aList ); - - - /** - * Gets operator name, country code, network ID - * @param aLongName - * @param aCountryCode - * @param aNetworkID - * @return none - */ - static void GetOperatorNameL( TDes& aLongName, TDes& aCountryCode, TDes& aNetworkID ); - - /** - * Creates a panic - * @param aReason Panic code - * @return none - */ - static void Panic( TInt aReason ); - - /** - * String copy with lenght check. - * @param aTarget Target string - * @param aSource Source string - * @return none - */ - static void StrCopy( TDes& aTarget, const TDesC& aSource ); - - /** - * Function converts ínteger to string. - * @param aText string - * @param aNum integer - * @return none - */ - static void IntToStr( TDes& aText, TInt64 aNum ); - - /** - * Function converts string to integer. If string cannot be converted, - * error code is returned. - * @param aText string - * @param aNum integer - * @return error code - */ - static TInt StrToInt( const TDesC& aText, TInt& aNum ); - - /** - * Function splits string (eg "name1, name2, name3") into substrings. - * @param aText string - * @param aSeparator separator character - * @param aArray substrings - * @return none - */ - static void SplitL( const TDesC& aText, const TChar aSeparator, - RArray& aArray ); - - /** - * Constructs capability date as string - * @param aText string - * @param aTime time object - * @return none - */ - static void CapabilityDate( TDes& aText, const TTime aTime ); - - /** - * Function parses date string of the format "dd-mm-yy". - * @param aText string - * @return time object - */ - static TTime ParseDateL( const TDesC& aText ); - - /** - * Function return TMonth presentation of integer - * @param aNum - * @return TMonth object - */ - static TMonth Month( TInt aNum ); - - /** - * Function checks file extension. - * @param aFile File name - * @param aExt extension - * @return boolean - */ - static TBool CheckFileType( const TDesC& aFile, const TDesC& aExt ); - }; - -// -// TIdStack -// -NONSHARABLE_CLASS( TIdStack ) - { -public: - - /** - * Push id to the stack - * @param aId Id number - * @return none - */ - void Push( TInt aId ); - - /** - * Pop id from the stack - * @return id - */ - TInt Pop(); - - /** - * Size of the stack - * @return size - */ - TInt Size() const; - - /** - * Reset the stack. - * @return none - */ - void Reset(); - -private: - TInt iPos; - TFixedArray iArray; - }; - -#endif // CapUtils.h - -// End of file diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/services/csc/inc/sconcsc.h --- a/connectivitymodules/SeCon/services/csc/inc/sconcsc.h Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,61 +0,0 @@ -/* -* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: CSConCSC header file -* -*/ - - -// INCLUDES - -#ifndef _SCONCSC_H_ -#define _SCONCSC_H_ - -#include - -class CCapInfo; - -//============================================================ -// Class CSConCSC declaration -//============================================================ -class CSConCSC : public CBase -{ -public: - static CSConCSC* NewL(); - ~CSConCSC(); - -public: - // Creates capability object and places it into aBuf. - // Returns system error code - virtual TInt CapabilityObject( CBufFlat& aBuf ); - -private: - void CapabilityObjectL( CBufFlat& aBuf ); - - CSConCSC(); - virtual void ConstructL(); - -private: // data - CCapInfo* iCapInfo; - -}; - -IMPORT_C CSConCSC* CreateCSConCSCL(); -typedef CSConCSC* (*TSConCreateCSConCSCFunc) (); - - -#endif // SCONCSC - -// End of file - - diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/services/csc/inc/sconsyncservice.h --- a/connectivitymodules/SeCon/services/csc/inc/sconsyncservice.h Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,116 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: CSConSyncService header file. -* -*/ - - -#ifndef _SCONSYNCSERVICE_H_ -#define _SCONSYNCSERVICE_H_ - -#include -#include // RApaLsSession -#include - - -class TApaAppInfo; -class RApaLsSession; -class CRepository; - - -class TSConSolutionInfo - { - public: - TSConSolutionInfo():iTime(0){} - public: - TFileName iSolutionName; - TUint iUid; - TTime iTime; - }; - -/** - * This class provides information about active sync solutions. - * - * @code - * CSConSyncService *syncService = CSConSyncService::NewLC(); - * SConSolutionInfo solutionInfo; - * syncService->GetSolutionL( KSeconCalendarUid, solutionInfo ); - * CleanupStack::PopAndDestroy( syncService ); - * @endcode - * - * @since S60 v5.0 - */ -NONSHARABLE_CLASS( CSConSyncService ) : public CBase - { - public: - static CSConSyncService* NewLC(); - ~CSConSyncService(); - - /** - * Populate SolutionInfo according to content type. - * - * @since S60 v5.0 - * @param aSeconContentType Contenttype to be readed - * @param aSolutionInfo contains founded solution info, - * solution info is empty if not found - * @return none - */ - void GetSolutionL( const TUint aSeconContentType, TSConSolutionInfo& aSolutionInfo ); - - private: - - CSConSyncService(); - void ConstructL(); - - // Return correct providerId according to content type. - TSmlDataProviderId ProviderId( const TUint32 aSeconContentType ) const; - - // Parse time from text - TInt ParseTimestamp( TTime& aTime, const TDesC& aTimestamp ) const; - - // Get application caption. - void GetApplicationCaptionL( TDes& aCaption, const TUid aAppUid ); - - // Search UID from installed applications, return app caption - void GetInstPackageCaptionL( TDes& aCaption, const TUid aPackageUid ); - - // Gets last used profile for selected provider - void GetLastUsedProfileNameL( TDes& aProfileName, TTime& aTime, - const TSmlDataProviderId& aDataProviderId ); - - // Gets last sync time for certain profile and provider. - void GetLastSyncTimeL( TTime& aTime, const TSmlProfileId aSyncProfileId, - const TSmlDataProviderId aDataProviderId ); - - // Gets provider task id from profile - void GetProviderTaskL( TSmlTaskId& aProviderTask, - RSyncMLDataSyncProfile& aSyncProfile, - const TSmlDataProviderId aDataProviderId ) const; - - // Gets latest historyJob where task is correct. - const CSyncMLHistoryJob* LatestHistoryJob( RSyncMLHistoryLog& aHistoryLog, - TInt aTaskId ) const; - - // Returns ETrue if task exists in HistoryJob. - TBool TaskExist( const CSyncMLHistoryJob* aHistoryJob, TInt aTaskId ) const; - - private: // data - TBool iApaSessionConnected; - RApaLsSession iApaSession; - TBool iSyncSessionOpened; - RSyncMLSession iSyncSession; - CRepository* iRepository; - }; - -#endif // _SCONSYNCSERVICE_H_ diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/services/csc/inc/sconversioninfo.h --- a/connectivitymodules/SeCon/services/csc/inc/sconversioninfo.h Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,116 +0,0 @@ -/* -* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Handles version fetching -* -*/ - - -#ifndef SCONVERSIONINFO_H_ -#define SCONVERSIONINFO_H_ - -#include -#include -#include -#include -#include - -const TInt KSconSWVersionSize = 50; -const TInt KSconDateSize = 16; -const TInt KMaxLangSize = 5; - -NONSHARABLE_CLASS( CSconVersionInfo ) : public CBase -{ -public: - CSconVersionInfo(); - ~CSconVersionInfo(); - - static CSconVersionInfo* NewL(); - - /** - * - * @param aFs RFs session - * @return none. - */ - void FetchInfoL( RFs& aFs ); - - /** - * Is all data ready. - * @return ETrue if FetchInfoL has been called succesfully. - */ - TBool IsReady(); - - /** - * Get symbian version. FetchInfoL must be called first - * @param aSymbianVersion symbian version - * @return error code. - */ - TInt GetSymbianVersion( SysVersionInfo::TSymbianOSVersion& aSymbianVersion ); - - /** - * Get S60 platform version. FetchInfoL must be called first - * @param aS60Version S60 platform version - * @return error code. - */ - TInt GetS60Version( VersionInfo::TPlatformVersion& aS60Version ); - -public: // data - - /** Contains the manufacturer name. For example "Nokia". */ - HBufC* iManufacturer; - - /** Contains the phone model sales name. For example "N01". */ - HBufC* iModel; - - /** Contains the product code name. For example "RM-1". */ - HBufC* iProduct; - - /** Contains the product revision. For example "01". */ - HBufC* iRevision; - - TBuf< KSconDateSize > iDate; - - HBufC* iSWVersion; - - /** Phone serial number (IMEI or ESN), in character string format. */ - HBufC* iSerialNumber; - - TBuf iLanguage; - - HBufC* iSysVersionInfo; - - HBufC* iLangVersion; - - HBufC* iLangSWVersion; - - HBufC* iOPVersion; - - TSize iScreenSize; - - HBufC* iProductCode; - - TInt iDesktopSyncError; - TInt iDesktopSync; - -private: - TBool iInfoFetched; // ETrue if FetchInfoL has been called succesfully. - - TInt iSymbianVersionError; - SysVersionInfo::TSymbianOSVersion iSymbianVersion; - - TInt iS60VersionError; - VersionInfo::TPlatformVersion iS60Version; - -}; - -#endif /*SCONVERSIONINFO_H_*/ diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/services/csc/inc/stringlist.h --- a/connectivitymodules/SeCon/services/csc/inc/stringlist.h Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,142 +0,0 @@ -/* -* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: CStringList header file -* -*/ - - -#ifndef _STRINGLIST_H_ -#define _STRINGLIST_H_ - -// INCLUDES - -#include -#include // for CDesCArrayFlat -#include - -// -// CStringList is used for storing lines of text. -// -NONSHARABLE_CLASS( CStringList ) : public CBase -{ -public: - /** - * Two-phase constructor. The created instance is placed to cleanup stack - * @param aFileName Default KNullDesC - * @return CStringList instance - */ - static CStringList* NewLC(); - /** - * Two-phase constructor. - * @param aFileName Default KNullDesC - * @return CStringList instance - */ - static CStringList* NewL(); - /** - * Destructor - * @return none - */ - ~CStringList(); - -public: - /** - * Returns the count of lines - * @return The count - */ - TInt Count() const; - /** - * Returns pointer to the string - * @param aIndex The position - * @return String pointer - */ - TPtrC16 ReadPtr(TInt aIndex); - /** - * Copies a string / strings - * @param aSource Source buffer - * @param aStart A start position - * @param aStop A stop position - * @return none - */ - void CopyL(CStringList* aSource, TInt aStart, TInt aStop); - /** - * Resets iLines - * @return none - */ - void Reset(); - /** - * Returns the mark - * @return Mark value - */ - TInt Mark() const; - /** - * Sets mark - * @param aMark The mark value - * @return none - */ - void SetMark(TInt aMark); - /** - * Read strings from file. - * @param aText The tag buffer - * @return none - */ - void ReadFromFileL( RFs& aFs, const TDesC& aName ); - -private: - /** - * Default constuctor - * @return none - */ - CStringList(); - /** - * Initializes member data - * @param aFileName The file name - * @return none - */ - void ConstructL(); - /** - * Creates a panic - * @param aPanic Panic code - * @return none - */ - void Panic(TInt aPanic) const; - /** - * Copies the string - * @param aTarget Target string - * @param aSource Source string - * @return ETrue if successful - */ - TBool StrCopy(TDes& aTarget, const TDesC& aSource) const; - /** - * Writes a string - * @param aText The string - * @return none - */ - void WriteL(const TDesC& aText); - /** - * Internalizes from file - * @param aFileName The name of the file - * @return none - */ - void InternalizeL( RFs& aFs, const TDesC& aFileName ); - -private: - TInt iMark; - CDesCArrayFlat* iLines; -}; - -#endif - -// End of file - - diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/services/csc/src/capinfo.cpp --- a/connectivitymodules/SeCon/services/csc/src/capinfo.cpp Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1031 +0,0 @@ -/* -* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: CCapInfo implementation -* -*/ - - -// INCLUDE FILES - -#include -#include -#include // for PathInfo::SoundsPath -#include -#include "sconsyncservice.h" -#include "capinfo.h" -#include "caplist.h" -#include "capparser.h" -#include "caputils.h" -#include "stringlist.h" -#include "sconversioninfo.h" -#include "debug.h" - - -_LIT8( KLineFeed, "\r\n" ); - -const TInt KDefaultArrayGranularity = 5; - - -// ============================= MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CCapInfo::NewL() -// Two-phase constructor -// ----------------------------------------------------------------------------- -// -CCapInfo* CCapInfo::NewL() - { - TRACE_FUNC_ENTRY; - CCapInfo* self = new (ELeave) CCapInfo(); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop(self); - TRACE_FUNC_EXIT; - return self; - } - -// ----------------------------------------------------------------------------- -// CCapInfo::~CCapInfo() -// Destructor -// ----------------------------------------------------------------------------- -// -CCapInfo::~CCapInfo() - { - TRACE_FUNC_ENTRY; - iFsSession.Close(); - delete iHeapBuf; - delete iCapList; - delete iSconInfo; - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CCapInfo::CapabilityDocumentL(CBufFlat* aBuf) -// Creates capability xml document end places it in aBuf -// ----------------------------------------------------------------------------- -// -void CCapInfo::CapabilityDocumentL(CBufFlat* aBuf) - { - TRACE_FUNC_ENTRY; - TInt err( KErrNone ); - - // set buffer where capability document is written - SetCapabilityBuf( aBuf ); - - WriteL( KXmlVersion ); - WriteL( KComment1 ); - WriteL( KDocType ); - WriteL( KRootBegin ); - - - // - // general - // - TRAP( err, GeneralInfoL() ); - if ( err != KErrNone ) - { - LOGGER_WRITE_1( "GeneralInfoL failed : %d", err ); - User::Leave( err ); - } - - - // - // services - // - // Search service files first from C-drive, and then from Z - // Do not add same files twice. - - RArray excludeList( KDefaultArrayGranularity ); - CleanupClosePushL( excludeList ); - RArray filesAdded( KDefaultArrayGranularity ); - CleanupClosePushL( filesAdded ); - - //read service files from C Import folder - TRAP( err, ServiceInfoL( KCapabilityDirCImport, excludeList, filesAdded ) ); - LOGGER_WRITE_1( "ServiceInfoL(KCapabilityDirCImport) returned : %d", err ); - for ( TInt i=0; iFetchInfoL( iFsSession )); - LOGGER_WRITE_1("sconInfo->FetchInfoL() Leaved: %d", err); - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CCapInfo::CCapInfo() -// Constuctor -// ----------------------------------------------------------------------------- -// -CCapInfo::CCapInfo() - { - } - -// ----------------------------------------------------------------------------- -// CCapInfo::CapList() -// Returns caplist -// ----------------------------------------------------------------------------- -// -CCapList* CCapInfo::CapList() - { - TRACE_FUNC; - __ASSERT_DEBUG(iCapList, CapUtil::Panic(KErrGeneral)); - return iCapList; - } - -// ----------------------------------------------------------------------------- -// CCapInfo::SetCapabilityBuf( CBufFlat* aBuf ) -// Set capability buffer -// ----------------------------------------------------------------------------- -// -void CCapInfo::SetCapabilityBuf( CBufFlat* aBuf ) - { - TRACE_FUNC; - iCapabilityBuf=aBuf; - } - -// ----------------------------------------------------------------------------- -// CCapInfo::GeneralInfoL() -// Write general device capability information. -// ----------------------------------------------------------------------------- -// -void CCapInfo::GeneralInfoL() - { - TRACE_FUNC_ENTRY; - TInt err( KErrNone ); - TBuf buf; - TBuf longName; - TBuf coutryCode; - TBuf networkID; - - WriteTagL(EGeneral, TXmlParser::EElementBegin); - - if ( !iSconInfo->IsReady() ) - { - LOGGER_WRITE("iSconInfo wasn't ready, call iSconInfo->FetchInfoL"); - iSconInfo->FetchInfoL( iFsSession ); - } - - if ( iSconInfo->iManufacturer ) - { - WriteValueL( EManufacturer, *iSconInfo->iManufacturer ); - } - - if ( iSconInfo->iProduct ) - { - WriteValueL( EModel, *iSconInfo->iProduct ); - } - - // serial number - if ( iSconInfo->iSerialNumber ) - { - WriteValueL( ESN, *iSconInfo->iSerialNumber ); - } - - // software version - if ( iSconInfo->iSWVersion ) - { - WriteAttributeL( ESW, *iSconInfo->iSWVersion, iSconInfo->iDate ); - } - - // language - WriteValueL( ELanguage, iSconInfo->iLanguage ); - - // this must succeed - do not trap - MemoryInfoL(); - - // Operator - TRAP( err, CapUtil::GetOperatorNameL( longName, coutryCode, networkID ) ); - LOGGER_WRITE_1( "CapUtil::GGetOperatorNameL returned : %d", err ); - if( err == KErrNone ) - { - LOGGER_WRITE_3( "CSConFsHandler::GetOperatorNameL longName = %S coutryCode = %S networkID = %S", &longName, &coutryCode, &networkID ); - _LIT( KNetworkInfo, "NetworkInfo" ); - _LIT( KCurrentNetwork, "CurrentNetwork=" ); - _LIT( KCountryCode, "CountryCode=" ); - _LIT( KNetworkID, "NetworkID=" ); - - WriteTagL( EExt, TXmlParser::EElementBegin ); - WriteValueL( EXNam, KNetworkInfo ); - - // write CurrentNetwork - buf.Copy( KCurrentNetwork ); - buf.Append( longName ); - WriteValueL( EXVal, buf ); - - // write CountryCode - buf.Copy( KCountryCode ); - buf.Append( coutryCode ); - WriteValueL( EXVal, buf ); - - // write NetworkID - buf.Copy( KNetworkID ); - buf.Append( networkID ); - WriteValueL( EXVal, buf ); - - WriteTagL( EExt, TXmlParser::EElementEnd ); - } - - if ( iSconInfo->iModel ) - { - // print modelname (phone model sales name. For example "N01".) - WriteTagL( EExt, TXmlParser::EElementBegin ); - _LIT(KModelName, "ModelName"); - WriteValueL( EXNam, KModelName ); - WriteValueL( EXVal, *iSconInfo->iModel ); - WriteTagL( EExt, TXmlParser::EElementEnd ); - } - - if ( iSconInfo->iProductCode ) - { - // print productcode - WriteTagL( EExt, TXmlParser::EElementBegin ); - _LIT( KProductCode, "ProductCode" ); - WriteValueL( EXNam, KProductCode ); - WriteValueL( EXVal, *iSconInfo->iProductCode ); - WriteTagL( EExt, TXmlParser::EElementEnd ); - } - - - // print advanced info - WriteTagL( EExt, TXmlParser::EElementBegin ); - _LIT(KAdvancedDeviceInfo, "AdvancedDeviceInfo"); - WriteValueL( EXNam, KAdvancedDeviceInfo ); - - TBuf temp; - - if ( iSconInfo->iRevision ) - { - // product revision. For example "01" - _LIT( KRevision, "Revision=" ); - temp.Copy( KRevision ); - temp.Append( *iSconInfo->iRevision ); - LOGGER_WRITE_1( "CCapInfo::GeneralInfoL() : %S ", &temp ); - WriteValueL( EXVal, temp ); - } - - - if ( iSconInfo->iSysVersionInfo ) - { - _LIT( KFWVersion, "FWVersion=" ); - temp.Copy( KFWVersion ); - temp.Append( *iSconInfo->iSysVersionInfo ); - LOGGER_WRITE_1( "CCapInfo::GeneralInfoL() : %S ", &temp ); - WriteValueL( EXVal, temp ); - } - - SysVersionInfo::TSymbianOSVersion osVersion; - err = iSconInfo->GetSymbianVersion( osVersion ); - LOGGER_WRITE_1("TSymbianOSVersion info error: %d", err) - if ( !err ) - { - // Now osVersion contains the Symbian OS version information - _LIT( KSymbianOSVersion, "SymbianOSVersion=%d.%d" ); - temp.Format( KSymbianOSVersion, - osVersion.iMajorVersion, - osVersion.iMinorVersion ); - LOGGER_WRITE_1( "CCapInfo::GeneralInfoL() : %S ", &temp ); - - WriteValueL( EXVal, temp ); - } - - VersionInfo::TPlatformVersion platformVersion; - err = iSconInfo->GetS60Version( platformVersion ); - if ( !err ) - { - _LIT( KS60Version, "S60PlatformVersion=%d.%d" ); - temp.Format( KS60Version, - platformVersion.iMajorVersion, - platformVersion.iMinorVersion ); - LOGGER_WRITE_1( "CCapInfo::GeneralInfoL() : %S ", &temp ); - WriteValueL( EXVal, temp ); - } - - - if ( iSconInfo->iLangVersion ) - { - _LIT( KLangVersion, "LangVersion=" ); - temp.Copy( KLangVersion ); - temp.Append( *iSconInfo->iLangVersion ); - LOGGER_WRITE_1( "CCapInfo::GeneralInfoL() : %S ", &temp ); - WriteValueL( EXVal, temp ); - } - - if ( iSconInfo->iLangSWVersion ) - { - _LIT( KLangSWVersion, "LangSWVersion=" ); - temp.Copy( KLangSWVersion ); - temp.Append( *iSconInfo->iLangSWVersion ); - LOGGER_WRITE_1( "CCapInfo::GeneralInfoL() : %S ", &temp ); - WriteValueL( EXVal, temp ); - } - - if ( iSconInfo->iOPVersion ) - { - // CustomerVersion - _LIT( KOPVersion, "OPVersion=" ); - temp.Copy( KOPVersion ); - temp.Append( *iSconInfo->iOPVersion ); - LOGGER_WRITE_1( "CCapInfo::GeneralInfoL() : %S ", &temp ); - WriteValueL( EXVal, temp ); - } - - // screen size - LOGGER_WRITE_2("Size, width: %d, height: %d", - iSconInfo->iScreenSize.iWidth, - iSconInfo->iScreenSize.iHeight ); - _LIT( KWidth, "ScreenWidth=%d" ); - _LIT( KHeight, "ScreenHeight=%d" ); - - temp.Format( KWidth, iSconInfo->iScreenSize.iWidth ); - WriteValueL( EXVal, temp ); - - temp.Format( KHeight, iSconInfo->iScreenSize.iHeight ); - WriteValueL( EXVal, temp ); - - WriteTagL( EExt, TXmlParser::EElementEnd ); - // end of advanced info - - WriteTagL(EGeneral, TXmlParser::EElementEnd); - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CCapInfo::MemoryInfoL() -// Create memory info for all drives (RAM excluded). -// ----------------------------------------------------------------------------- -// -void CCapInfo::MemoryInfoL() - { - TRACE_FUNC_ENTRY; - - TMemoryInfo info; - TInt devDriveCount = 0; - TInt mmcDriveCount = 0; - - //Write all drivers to folderlisting object - TDriveList driveList; - // Get all drives that are visible to the user. - TInt driveCount; - User::LeaveIfError( DriveInfo::GetUserVisibleDrives( iFsSession, driveList, driveCount ) ); - - for( TInt i = EDriveA; i < KMaxDrives; i++ ) - { - if( driveList[i] ) - { - TUint driveStatus; - TInt err = DriveInfo::GetDriveStatus( iFsSession, i, driveStatus ); - if( err ) - { - LOGGER_WRITE_1( "CCapInfo::MemoryInfoL() : DriveInfo::GetDriveStatus: %d", i); - continue; - } - - if( !(driveStatus & DriveInfo::EDrivePresent ) - || driveStatus & DriveInfo::EDriveCorrupt - || (driveStatus & DriveInfo::EDriveRemote) ) - { - LOGGER_WRITE_1( "skip drive %d", i); - continue; - } - - TRAP( err, CapUtil::GetMemoryInfoL( iFsSession, i, info )); - if ( err ) - { - LOGGER_WRITE_1( "CapUtil::GetMemoryInfoL() : Leaved with: %d", err); - continue; - } - - info.iDriveStatus = driveStatus; - if( driveStatus & DriveInfo::EDriveInternal ) - { - // if internal (DEV) drive, save drive number - devDriveCount++; - info.iMemNr = devDriveCount; - } - else if ( driveStatus & DriveInfo::EDriveRemovable ) - { - // if removable (MMC) drive, save drive number - mmcDriveCount++; - info.iMemNr = mmcDriveCount; - } - else - { - // was not internal or removable, skip. - LOGGER_WRITE( "CCapInfo::MemoryInfoL() : not internal or removable, skip." ); - continue; - } - - WriteMemoryInfoL(info); - - } - } - - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CCapInfo::MemoryInfoL(TMemoryInfo& aInfo) -// Create memory info for all drives (RAM excluded). -// ----------------------------------------------------------------------------- -// -void CCapInfo::WriteMemoryInfoL(TMemoryInfo& aInfo) - { - TRACE_FUNC_ENTRY; - TBuf buf; - - WriteTagL(EMemory, TXmlParser::EElementBegin); - - if( aInfo.iDriveStatus & DriveInfo::EDriveInternal ) - { - buf = KMediaFlash; - } - else - { - buf = KMediaMMC; // memory card (MMC) - } - - if( aInfo.iMemNr > 1 ) - { - // append memory number DEV2, MMC2.. - buf.AppendNum( aInfo.iMemNr ); - } - - WriteValueL(EMemType, buf); - WriteValueL(ELocation, aInfo.iLocation); - WriteValueL(EFree, aInfo.iFree); - WriteValueL(EUsed, aInfo.iUsed); - - WriteValueL(EFileNLen, aInfo.iFileNameSize); - - WriteTagL(EMemory, TXmlParser::EElementEnd); - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CCapInfo::ServiceInfoL(const TDesC& aDir) -// Reads service xml-files from directory and writes them into capability -// document. -// ----------------------------------------------------------------------------- -// -void CCapInfo::ServiceInfoL(const TDesC& aDir, const RArray& aExcludeList, - RArray& aFilesAdded) - { - TRACE_FUNC_ENTRY; - CCapList* capList=CapList(); - - RArray array( KDefaultArrayGranularity ); - CleanupClosePushL(array); - - CStringList* stringList=CStringList::NewLC(); - - CapUtil::GetFileListL(iFsSession, aDir, array); - - _LIT(KFormat, "%S%S"); - TFileName name; - TInt count=array.Count(); - for (TInt i=0; iList()->Reset(); - capList->List()->ReadFromFileL( iFsSession, name ); - if (capList->FindServiceL(stringList)) - { - WriteNewLineL(); - WriteFromListL(stringList); - - User::LeaveIfError( aFilesAdded.Append(array[i]) ); - LOGGER_WRITE_1( "File '%S' added to list", &array[i] ); - } - } - } - - CleanupStack::PopAndDestroy(stringList); - CleanupStack::PopAndDestroy(&array); - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CCapInfo::FolderServiceL() -// Writes folder service. Notice that this service is created in code because -// pathinfo component is used to get folder names. -// ----------------------------------------------------------------------------- -// -void CCapInfo::FolderServiceL() - { - TRACE_FUNC_ENTRY; - TBuf rootPath; - TBuf memoryType(KNullDesC); - TFileName folderName; - _LIT( KFormat, "%S%S" ); - - WriteNewLineL(); - WriteTagL(EService, TXmlParser::EElementBegin); - - WriteValueL(EName, KFolderServiceName); - WriteValueL(EUUID, KFolderServiceUid); - WriteValueL(EVersion, KFolderServiceVersion); - - WriteTagL(EObject, TXmlParser::EElementBegin); - WriteValueL(EType, KFolderServiceType); - WriteTagL(EObject, TXmlParser::EElementEnd); - TInt drive; - TInt err; - - CapUtil::GetDefaultRootPathL( iFsSession, rootPath ); - if( rootPath.Length() > 0 ) - { - err = iFsSession.CharToDrive( rootPath[0], drive ); - if( err == KErrNone ) - { - CapUtil::GetMemoryType( iFsSession, memoryType, drive ); - } - } - - // EFolderImages - folderName.Format( KFormat, &rootPath, &PathInfo::ImagesPath() ); - WriteFolderL( KFolderImages, folderName, memoryType ); - - // EFolderGraphics - folderName.Format( KFormat, &rootPath, &PathInfo::ImagesPath() ); - WriteFolderL(KFolderGraphics, folderName, memoryType); - - // EFolderTones - folderName.Format( KFormat, &rootPath, &PathInfo::DigitalSoundsPath() ); - WriteFolderL(KFolderTones, folderName, memoryType); - - // EFolderMusic - folderName.Format( KFormat, &rootPath, &PathInfo::SoundsPath() ); - WriteFolderL(KFolderMusic, folderName, memoryType); - - // EFolderVideos - folderName.Format( KFormat, &rootPath, &PathInfo::VideosPath() ); - WriteFolderL(KFolderVideos, folderName, memoryType); - - // EFolderInstalls - folderName.Format( KFormat, &rootPath, &PathInfo::InstallsPath() ); - WriteFolderL(KFolderInstalls, folderName, memoryType); - - - WriteTagL(EService, TXmlParser::EElementEnd); - WriteNewLineL(); - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CCapInfo::SyncSolutionsServiceL() -// Reads last used syncSolutions from cenrep and writes to capability object -// ----------------------------------------------------------------------------- -// -void CCapInfo::SyncSolutionsServiceL() - { - TRACE_FUNC_ENTRY; - TSConSolutionInfo calendar; - TSConSolutionInfo contact; - TSConSolutionInfo sms; - TSConSolutionInfo bookmark; - - CSConSyncService *syncService = CSConSyncService::NewLC(); - syncService->GetSolutionL( KSeconCalendarUid, calendar ); - syncService->GetSolutionL( KSeconContactsUid, contact ); - syncService->GetSolutionL( KSeconSmsUid, sms ); - syncService->GetSolutionL( KSeconBookmarkUid, bookmark ); - CleanupStack::PopAndDestroy( syncService ); - - WriteSyncSolutionsServiceL( calendar, contact, sms, bookmark ); - - TRACE_FUNC_EXIT; - } - - -// ----------------------------------------------------------------------------- -// CCapInfo::WriteSyncSolutionsServiceL() -// Writes SyncSolutionsService data to capability object. -// ----------------------------------------------------------------------------- -// -void CCapInfo::WriteSyncSolutionsServiceL( const TSConSolutionInfo& aCalendar, - const TSConSolutionInfo& aContact, - const TSConSolutionInfo& aSms, - const TSConSolutionInfo& aBookmark) - { - TRACE_FUNC_ENTRY; - - WriteTagL( EService, TXmlParser::EElementBegin ); - - WriteValueL( EName, KSyncSolutionsServiceName ); - WriteValueL( EVersion, KSyncSolutionsServiceVersion ); - - if ( aCalendar.iUid != 0 ) - { - WriteSolutionTagL( KSyncCalendar, aCalendar ); - } - - if ( aContact.iUid != 0 ) - { - WriteSolutionTagL( KSyncContacts, aContact ); - } - - if ( aSms.iUid != 0 ) - { - WriteSolutionTagL( KSyncSms, aSms ); - } - - if ( aBookmark.iUid != 0 ) - { - WriteSolutionTagL( KSyncBookmark, aBookmark ); - } - - /* - * - * DesktopSync - * - * - * - */ - if ( !iSconInfo->iDesktopSyncError ) - { - WriteTagL( EExt, TXmlParser::EElementBegin ); - WriteValueL( EXNam, KDesktopSync ); - - TBuf buffer; - buffer.AppendNum( iSconInfo->iDesktopSync ); - - WriteValueL( EXVal, buffer ); - WriteTagL( EExt, TXmlParser::EElementEnd ); - } - - - - WriteTagL( EService, TXmlParser::EElementEnd ); - TRACE_FUNC_EXIT; - } - - - -// ----------------------------------------------------------------------------- -// CCapInfo::WriteSolutionTagL() -// Writes SyncSolutionsService solution data to capability object. -// ----------------------------------------------------------------------------- -// -void CCapInfo::WriteSolutionTagL( const TDesC& aContentName, - const TSConSolutionInfo& aSolution ) - { - TRACE_FUNC_ENTRY; - _LIT( KFormatUID, "UID=0x%08x" ); - _LIT( KFormatName, "Name=%S" ); - _LIT( KFormatDate, "Timestamp=%04d%02d%02dT%02d%02d%02dZ" ); - - WriteTagL( EExt, TXmlParser::EElementBegin ); - WriteValueL( EXNam, aContentName ); - - TFileName temp; - temp.Format( KFormatUID, aSolution.iUid ); - WriteValueL( EXVal, temp ); - - temp.Format( KFormatName, &aSolution.iSolutionName ); - WriteValueL( EXVal, temp ); - - if ( aSolution.iTime.Int64() != 0 ) - { - // write time - TDateTime time = aSolution.iTime.DateTime(); - temp.Format( KFormatDate, time.Year(), time.Month() + 1, - time.Day() + 1, time.Hour(), time.Minute(), time.Second() ); - WriteValueL( EXVal, temp ); - - } - - - WriteTagL( EExt, TXmlParser::EElementEnd ); - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CCapInfo::WriteFolderL(const TDesC& aType, const TDesC& aFullName, -// const TDesC& aMemory) -// Writes one folder name element. -// ----------------------------------------------------------------------------- -// -void CCapInfo::WriteFolderL(const TDesC& aType, const TDesC& aFullName, - const TDesC& aMemory) - { - TRACE_FUNC_ENTRY; - _LIT(KFormat, "%S=%S"); - - TBuf buf; - const TInt KReservedSize = 10; - if ( aFullName.Length() + KReservedSize > KBufSize ) - { - return; - } - buf.Format(KFormat, &KFolderNameTag, &aFullName); - - - WriteTagL(EExt, TXmlParser::EElementBegin); - - WriteValueL(EXNam, aType); - WriteValueL(EXVal, buf); - - buf.Format(KFormat, &KFolderMemoryTypeTag, &aMemory); - WriteValueL(EXVal, buf); - - - WriteTagL(EExt, TXmlParser::EElementEnd); - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CCapInfo::WriteL(const TDesC& aText) -// Writes one element to capability buffer. -// ----------------------------------------------------------------------------- -// -void CCapInfo::WriteL(const TDesC& aText) - { - if (aText.Length() > iBuf.MaxLength()) - { - User::Leave(KErrTooBig); - } - - - iBuf=aText; - iBuf.Trim(); - FormatElement(iBuf); - TPtr8 ptr = iHeapBuf->Des(); - - if ( iBuf.Length()+2 > ptr.MaxLength() ) - { - User::Leave(KErrTooBig); - } - - //unicode conversion - HBufC8* convBuf = HBufC8::NewLC( iBuf.Size() ); - TPtr8 convPtr = convBuf->Des(); - - CnvUtfConverter::ConvertFromUnicodeToUtf8(convPtr, iBuf); - - ptr.Copy(convPtr); - ptr.Append( KLineFeed ); // linefeed - - CleanupStack::PopAndDestroy( convBuf ); - - TInt pos=iCapabilityBuf->Size(); - iCapabilityBuf->InsertL(pos, ptr); - - iBuf=KNullDesC; - } - -void CCapInfo::WriteNewLineL() - { - TInt pos=iCapabilityBuf->Size(); - iCapabilityBuf->InsertL(pos, KLineFeed ); - } - -// ----------------------------------------------------------------------------- -// CCapInfo::WriteValueL(TInt aId, const TDesC& aValue) -// Constructs element with value (eg en) -// ----------------------------------------------------------------------------- -// -void CCapInfo::WriteValueL(TInt aId, const TDesC& aValue) - { - // empty values not written to capability object - if (aValue.Length()<1) - { - LOGGER_WRITE( "WriteValueL: value is empty" ); - return; - } - - TBuf buf; - - TRAPD(err, CapParser::MakeElementL(buf, aId, aValue)); - if (err==KErrNone) - { - WriteL(buf); - } - else if (err==KErrTooBig) - { - WriteBigValueL(aId, aValue); - } - else - { - User::Leave(err); - } - - } - -// ----------------------------------------------------------------------------- -// CCapInfo::WriteBigValueL(TInt aId, const TDesC& aValue) -// Constructs element with value -// ----------------------------------------------------------------------------- -// -void CCapInfo::WriteBigValueL(TInt aId, const TDesC& aValue) - { - HBufC* hBuf=HBufC::NewL(aValue.Length()+KBufSize); - CleanupStack::PushL(hBuf); - - TPtr pBuf(hBuf->Des()); - CapParser::MakeElementL(pBuf, aId, aValue); - WriteL(*hBuf); - - CleanupStack::PopAndDestroy(hBuf); - } - -// ----------------------------------------------------------------------------- -// CCapInfo::WriteValueL(TInt aId, TInt64 aValue) -// Constructs element with integer value -// ----------------------------------------------------------------------------- -// -void CCapInfo::WriteValueL(TInt aId, TInt64 aValue) - { - TBuf buf; - TBuf value; - CapUtil::IntToStr(value, aValue); - CapParser::MakeElementL(buf, aId, value); - WriteL(buf); - } - -// ----------------------------------------------------------------------------- -// CCapInfo::WriteTagL(TInt aId, TInt aType) -// Constructs element without value (eg ) -// ----------------------------------------------------------------------------- -// -void CCapInfo::WriteTagL(TInt aId, TInt aType) - { - TBuf buf; - CapParser::MakeElementL(buf, aId, aType); - WriteL(buf); - } - -// ----------------------------------------------------------------------------- -// CCapInfo::WriteAttributeL(TInt aId, const TDesC& aVersion, const TDesC& aDate) -// Constructs element with attributes "Version" and "Date" -// (eg ) -// ----------------------------------------------------------------------------- -// -void CCapInfo::WriteAttributeL(TInt aId, const TDesC& aVersion, - const TDesC& aDate) - { - // empty values not written to capability object - if (aVersion.Length()<1 && aDate.Length()<1) - { - LOGGER_WRITE( "WriteAttributeL: attributes are empty" ); - return; - } - - TBuf buf; - CapParser::MakeElementL(buf, aId, aVersion, aDate); - WriteL(buf); - } - -// ----------------------------------------------------------------------------- -// CCapInfo::WriteFromListL(CStringList* aList) -// Writes elements from list to capability buffer. -// ----------------------------------------------------------------------------- -// -void CCapInfo::WriteFromListL(CStringList* aList) - { - TInt count=aList->Count(); - - for (TInt i=0; iReadPtr(i)); - } - } - -// ----------------------------------------------------------------------------- -// CCapInfo::FormatElement(TDes& aText) -// Function adds indentation spaces to capability elements to improve -// readability. -// ----------------------------------------------------------------------------- -// -void CCapInfo::FormatElement(TDes& aText) - { - TXmlParser parser; - - parser.Set(aText); - TInt type=parser.Type(); - TBuf tag; - parser.GetTag(tag); - - if (type==TXmlParser::EElementEnd) - { - TInt id1=CapParser::ElementId(tag); - TInt id2=iIdStack.Pop(); - - __ASSERT_DEBUG(id1==id2, CapUtil::Panic(KErrGeneral)); - id1=0; - id2=0; - } - - AddFormatText(aText, iIdStack.Size()); - - if (type==TXmlParser::EElementBegin) - { - TInt id1=CapParser::ElementId(tag); - iIdStack.Push(id1); - } - } - -// ----------------------------------------------------------------------------- -// CCapInfo::AddFormatText( TDes& aText, TInt aNum ) const -// Adds format text -// ----------------------------------------------------------------------------- -// -void CCapInfo::AddFormatText( TDes& aText, TInt aNum ) const - { - TBuf buf; - buf = KNullDesC; - - if ( aNum > KNestingLimit ) - { - aNum = KNestingLimit; - } - - for ( TInt i=0; ibuf.Length() ) - { - aText.Insert( 0, buf ); - } - } - -// End of file - - diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/services/csc/src/caplist.cpp --- a/connectivitymodules/SeCon/services/csc/src/caplist.cpp Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,228 +0,0 @@ -/* -* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: CCapList implementation -* -*/ - - -// INCLUDE FILES - -#include "caplist.h" -#include "caputils.h" -#include "capparser.h" -#include "capability.h" -#include "debug.h" - -// ============================= MEMBER FUNCTIONS =============================== - - -// ----------------------------------------------------------------------------- -// CCapList::NewL() -// Two-phase constructor. -// ----------------------------------------------------------------------------- -// -CCapList* CCapList::NewL() - { - TRACE_FUNC_ENTRY; - CCapList* self = new(ELeave) CCapList(); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - TRACE_FUNC_EXIT; - return self; - } - -// ----------------------------------------------------------------------------- -// CCapList::~CCapList() -// Gets phone serial number from etel. -// ----------------------------------------------------------------------------- -// -CCapList::~CCapList() - { - TRACE_FUNC_ENTRY; - delete iList; - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CCapList::CCapList() -// Constructor -// ----------------------------------------------------------------------------- -// -CCapList::CCapList() - { - } - -// ----------------------------------------------------------------------------- -// CCapList::ConstructL() -// Initializes the member data -// ----------------------------------------------------------------------------- -// -void CCapList::ConstructL() - { - TRACE_FUNC_ENTRY; - iList = CStringList::NewL(); - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CCapList::List() -// Returns the list -// ----------------------------------------------------------------------------- -// -CStringList* CCapList::List() - { - __ASSERT_DEBUG(iList, CapUtil::Panic(KErrGeneral)); - return iList; - } - -// ----------------------------------------------------------------------------- -// CCapList::FindFromMark(TInt aId, TInt aType) -// Find from mark -// ----------------------------------------------------------------------------- -// -TInt CCapList::FindFromMark(TInt aId, TInt aType) - { - TRACE_FUNC_ENTRY; - TInt mark = List()->Mark(); - TInt count= List()->Count(); - - if ( mark >= count ) - { - return KErrNotFound; - } - - TInt index=Find(aId, aType, mark); - if ( index == KErrNotFound ) - { - LOGGER_WRITE_1( "CCapList::FindFromMark(TInt aId, TInt aType) returned : %d", KErrNotFound ); - return KErrNotFound; - } - - - __ASSERT_DEBUG(index>=mark, CapUtil::Panic(KErrGeneral)); - - List()->SetMark(index+1); - LOGGER_WRITE_1( "CCapList::FindFromMark(TInt aId, TInt aType) returned : %d", index ); - return index; - } - -// ----------------------------------------------------------------------------- -// CCapList::FindServiceHeader() -// Finds service xml-file identification header. This header must be the first -// line in every service file. -// ----------------------------------------------------------------------------- -// -TBool CCapList::FindServiceHeader() - { - TRACE_FUNC_ENTRY; - if (List()->Count()<1) - { - LOGGER_WRITE( "CCapList::FindServiceHeader() : returned EFalse" ); - return EFalse; - } - - TBuf buf; - TPtrC ptr=List()->ReadPtr(0); - CapUtil::StrCopy(buf, ptr); - buf.Trim(); - if (buf.Compare(KServiceHeader)==0) - { - LOGGER_WRITE( "CCapList::FindServiceHeader() : returned ETrue" ); - return ETrue; - } - else - { - LOGGER_WRITE( "CCapList::FindServiceHeader() : returned EFalse" ); - return EFalse; - } - } - -// ----------------------------------------------------------------------------- -// CCapList::FindServiceL(CStringList* aList) -// Find service -// ----------------------------------------------------------------------------- -// -TBool CCapList::FindServiceL(CStringList* aList) - { - TRACE_FUNC_ENTRY; - aList->Reset(); - List()->SetMark(0); - - if (!FindServiceHeader()) - { - LOGGER_WRITE( "CCapList::FindServiceL(CStringList* aList) : returned EFalse" ); - return EFalse; - } - - - for (;;) - { - TInt start=FindFromMark(EService, TXmlParser::EElementBegin); - TInt stop=FindFromMark(EService, TXmlParser::EElementEnd); - - if (start==KErrNotFound || stop==KErrNotFound || start>=stop) - { - break; - } - - aList->CopyL(List(), start, stop); - } - - if (aList->Count()>0) - { - LOGGER_WRITE( "CCapList::FindServiceL(CStringList* aList) : returned ETrue" ); - return ETrue; - } - - LOGGER_WRITE( "CCapList::FindServiceL(CStringList* aList) : returned EFalse" ); - return EFalse; - } - -// ----------------------------------------------------------------------------- -// CCapList::Find(TInt aId, TInt aType, TInt aIndex) -// Find element -// ----------------------------------------------------------------------------- -// -TInt CCapList::Find(TInt aId, TInt aType, TInt aIndex) - { - TInt count=List()->Count(); - if (aIndex<0 || aIndex>=count) - { - CapUtil::Panic(KErrArgument); - } - - for (TInt i=aIndex; iReadPtr(i); - - TInt id=0; - TInt type=0; - - CapParser::ParseElement(ptr, id, type); - if (type==TXmlParser::EElementUnknown) - { - continue; // invalid capability element - } - - if (id==aId && aType==type) - { - return i; - } - } - return KErrNotFound; - } - - -// End of files diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/services/csc/src/capparser.cpp --- a/connectivitymodules/SeCon/services/csc/src/capparser.cpp Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,766 +0,0 @@ -/* -* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: CapParser implementation -* -*/ - - -// INCLUDE FILES - -#include "capparser.h" -#include "caputils.h" - -const char KFind1 = '&'; -const char KFind2 = '<'; -const char KFind3 = '>'; -const char KFind4 = '"'; -const char KFind5 = '\''; - -_LIT( KReplace1, "&" ); -_LIT( KReplace2, "<" ); -_LIT( KReplace3, ">" ); -_LIT( KReplace4, """ ); -_LIT( KReplace5, "'" ); - -// ============================= MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CapParser::GetTagL(TDes& aText, TInt aId) -// Returns capability element tag (eg. "Memory") -// ----------------------------------------------------------------------------- -// -void CapParser::GetTagL(TDes& aText, TInt aId) - { - aText=KNullDesC; - - TInt count=NUMXMLTOKENS; - for (TInt i=0; ibuf; - TInt count=NUMXMLTOKENS; - for (TInt i=0; i" -> EMemory, EElementBegin) -// ----------------------------------------------------------------------------- -// -void CapParser::ParseElement(const TDesC& aText, TInt& aId, TInt& aType) - { - TXmlParser parse; - aId=KErrNotFound; - - parse.Set(aText); - aType=parse.Type(); - if (aType==TXmlParser::EElementUnknown) - { - return; - } - - TPtrC ptr=parse.Tag(); - aId=ElementId(ptr); - } - -// ----------------------------------------------------------------------------- -// CapParser::MakeElementL(TDes& aText, TInt aId, const TDesC& aValue) -// Constructs element with value (eg. "23456"). -// ----------------------------------------------------------------------------- -// -void CapParser::MakeElementL(TDes& aText, TInt aId, const TDesC& aValue) - { - aText=KNullDesC; - ReplaceSpecialCharsL( aText, aValue ); - - TBuf buf; - MakeElementL( buf, aId, TXmlParser::EElementBegin ); - - TInt len = aText.Length() + buf.Length() + buf.Length() + 1; - if ( len > aText.MaxLength()) - { - User::Leave(KErrTooBig); - } - - aText.Insert( 0, buf ); - MakeElementL( buf, aId, TXmlParser::EElementEnd ); - aText.Append( buf ); - } - -// ----------------------------------------------------------------------------- -// CapParser::MakeElementL(TDes& aText, TInt aId, TInt aType) -// Constructs element without value (eg. "" or ""). -// ----------------------------------------------------------------------------- -// -void CapParser::MakeElementL(TDes& aText, TInt aId, TInt aType) - { - _LIT(KFormat1, "<%S>"); - _LIT(KFormat2, ""); - _LIT(KFormat3, "<%S/>"); - - aText=KNullDesC; - TBuf buf; - GetTagL(buf, aId); - - switch(aType) - { - case TXmlParser::EElementBegin: - aText.Format(KFormat1, &buf); - break; - case TXmlParser::EElementEnd: - aText.Format(KFormat2, &buf); - break; - case TXmlParser::EElementEmpty: - aText.Format(KFormat3, &buf); - break; - default: - CapUtil::Panic(KErrArgument); - break; - } - } - -// ----------------------------------------------------------------------------- -// CapParser::MakeElementL(TDes& aText, TInt aId, const TDesC& aVersion, -// const TDesC& aDate) -// Constructs element with attributes "Version" and "Date"(eg. -// ""). -// ----------------------------------------------------------------------------- -// -void CapParser::MakeElementL(TDes& aText, TInt aId, const TDesC& aVersion, - const TDesC& aDate) - { - _LIT(KFormat1, "<%S %S=\"%S\" %S=\"%S\"/>"); - _LIT(KFormat2, "<%S %S=\"%S\"/>"); - - aText=KNullDesC; - - TBuf element; - TBuf versionTag; - TBuf dateTag; - - GetTagL(element, aId); - GetTagL(versionTag, EAttVersion); - GetTagL(dateTag, EAttDate); - - if (aDate.Length()>0) - { - aText.Format(KFormat1, &element, &versionTag, &aVersion, &dateTag, - &aDate); - } - else - { - aText.Format(KFormat2, &element, &versionTag, &aVersion); - } - } - -// ----------------------------------------------------------------------------- -// CapParser::ReplaceSpecialCharsL( TDes& aText, const TDesC& aValue ) -// Replaces special characters to xml compliant. -// ----------------------------------------------------------------------------- -// -void CapParser::ReplaceSpecialCharsL( TDes& aText, const TDesC& aValue ) - { - if ( aValue.Length() > aText.MaxLength() ) - { - User::Leave(KErrTooBig); - } - aText.Copy( aValue ); - - //Replace special characters - for( TInt i = 0; i < aText.Length(); i++ ) - { - switch( aText[i] ) - { - case KFind1: - if ( aText.Length()+KReplace1().Length()-1 > aText.MaxLength() ) - { - User::Leave(KErrTooBig); - } - aText.Replace( i, 1, KReplace1 ); - i+=KReplace1().Length()-1; - break; - case KFind2: - if ( aText.Length()+KReplace2().Length()-1 > aText.MaxLength() ) - { - User::Leave(KErrTooBig); - } - aText.Replace( i, 1, KReplace2 ); - i+=KReplace2().Length()-1; - break; - case KFind3: - if ( aText.Length()+KReplace3().Length()-1 > aText.MaxLength() ) - { - User::Leave(KErrTooBig); - } - aText.Replace( i, 1, KReplace3 ); - i+=KReplace3().Length()-1; - break; - case KFind4: - if ( aText.Length()+KReplace4().Length()-1 > aText.MaxLength() ) - { - User::Leave(KErrTooBig); - } - aText.Replace( i, 1, KReplace4 ); - i+=KReplace4().Length()-1; - break; - case KFind5: - if ( aText.Length()+KReplace5().Length()-1 > aText.MaxLength() ) - { - User::Leave(KErrTooBig); - } - aText.Replace( i, 1, KReplace5 ); - i+=KReplace5().Length()-1; - break; - default: - break; - } - } - } - -// ----------------------------------------------------------------------------- -// TXmlParser::Set(const TDesC& aText) -// Sets a tag -// ----------------------------------------------------------------------------- -// -void TXmlParser::Set(const TDesC& aText) - { - iOriginal.Set(aText); - TrimOriginal(); - Init(); - Parse(); - } - -// ----------------------------------------------------------------------------- -// TXmlParser::Init() -// Inits the parser -// ----------------------------------------------------------------------------- -// -void TXmlParser::Init() - { - iType=EElementUnknown; - iTag.Set(KNullDesC); - iValue.Set(KNullDesC); - } - -// ----------------------------------------------------------------------------- -// TXmlParser::GetTag(TDes& aText) const -// Gets the tag -// ----------------------------------------------------------------------------- -// -void TXmlParser::GetTag(TDes& aText) const - { - StrCopy(aText, iTag); - } - -// ----------------------------------------------------------------------------- -// TXmlParser::Tag() const -// Returns a pointer to a tag -// ----------------------------------------------------------------------------- -// -TPtrC TXmlParser::Tag() const - { - return iTag; - } - -// ----------------------------------------------------------------------------- -// TXmlParser::Type() const -// Returns type -// ----------------------------------------------------------------------------- -// -TInt TXmlParser::Type() const - { - return iType; - } - -// ----------------------------------------------------------------------------- -// TXmlParser::Parse() -// Parses xml-element. -// ----------------------------------------------------------------------------- -// -void TXmlParser::Parse() - { - iType=EElementUnknown; - - // this must be the first check - if (ElementUnknown()) - { - return; - } - - if (ElementBegin()) - { - return; - } - - if (ElementEnd()) - { - return; - } - - if (ElementValue()) - { - return; - } - - if (ElementComment()) - { - return; - } - - if (ElementDocType()) - { - return; - } - - if (ElementVersion()) - { - return; - } - - if (ElementEmpty()) - { - return; - } - - if (ElementAtt()) - { - return; - } - } - -// ----------------------------------------------------------------------------- -// TXmlParser::ElementUnknown() -// Parses unknown elements -// ----------------------------------------------------------------------------- -// -TBool TXmlParser::ElementUnknown() - { - TPtrC str=Str(); - TInt len=str.Length(); - const TInt KXmlElementMinLength = 3; - if ( len < KXmlElementMinLength ) - { - return ETrue; // too short to be xml element - } - - - iFirst=str.Locate('<'); - iLast=str.LocateReverse('>'); - iSlash=str.LocateReverse('/'); - - if (iFirst!=0 || iLast!=len-1) - { - return ETrue; // first char must be "<" and last ">" - } - - return EFalse; - } - -// ----------------------------------------------------------------------------- -// TXmlParser::ElementBegin() -// Parses beginning tag (eg. ) -// ----------------------------------------------------------------------------- -// -TBool TXmlParser::ElementBegin() - { - TPtrC str=Str(); - - if (iSlash!=KErrNotFound) - { - return EFalse; - } - - // remove possible attributes - TInt pos=str.Locate(' '); - if (pos==KErrNotFound) - { - pos=iLast; - } - - TPtrC ptr=SubStr(iFirst, pos); - - if (!ValidTag(ptr)) - { - return EFalse; - } - - iType=EElementBegin; - iTag.Set(ptr); - - return ETrue; - } - -// ----------------------------------------------------------------------------- -// TXmlParser::ElementEnd() -// Parses ending tag (eg. ) -// ----------------------------------------------------------------------------- -// -TBool TXmlParser::ElementEnd() - { - if (iSlash!=iFirst+1) - { - return EFalse; - } - - TPtrC ptr=SubStr(iSlash, iLast); - if (!ValidTag(ptr)) - { - return EFalse; - } - - iType=EElementEnd; - iTag.Set(ptr); - return ETrue; - } - -// ----------------------------------------------------------------------------- -// TXmlParser::ElementValue() -// Parses value (eg. en) -// ----------------------------------------------------------------------------- -// -TBool TXmlParser::ElementValue() - { - TPtrC str=Str(); - - TInt pos1=str.Locate('>'); - TInt pos2=str.LocateReverse('<'); - - if (pos1) -// ----------------------------------------------------------------------------- -// -TBool TXmlParser::ElementEmpty() - { - if (iSlash!=iLast-1) - { - return EFalse; - } - - TPtrC ptr=SubStr(iFirst, iSlash); - if (!ValidTag(ptr)) - { - return EFalse; - } - - iType=EElementEmpty; - iTag.Set(ptr); - return ETrue; - } - -// ----------------------------------------------------------------------------- -// TXmlParser::ElementVersion() -// Identifies version element ("") -// ----------------------------------------------------------------------------- -// -TBool TXmlParser::ElementVersion() - { - TPtrC str=Str(); - - if ( str.Length()>=3 && str[1]=='?' && str[2]=='x') - { - iType=EElementVersion; - return ETrue; - } - return EFalse; - } - -// ----------------------------------------------------------------------------- -// TXmlParser::ElementDocType() -// Identifies document type element -// (""). -// ----------------------------------------------------------------------------- -// -TBool TXmlParser::ElementDocType() - { - TPtrC str=Str(); - const TInt KElementMinLength = 10; - if ( str.Length() < KElementMinLength ) - { - return EFalse; - } - - if (str[1]=='!' && str[2]=='D' && str[3]=='O' && str[4]=='C') - { - iType=EElementDocType; - return ETrue; - } - return EFalse; - } - -// ----------------------------------------------------------------------------- -// TXmlParser::ElementComment() -// Identifies comment element (""). -// ----------------------------------------------------------------------------- -// -TBool TXmlParser::ElementComment() - { - TPtrC str=Str(); - - if (str.Length()<7) - { - return EFalse; - } - - if (str[1]=='!' && str[2]=='-' && str[3]=='-') - { - iType=EElementComment; - return ETrue; - } - - return EFalse; - } - -// ----------------------------------------------------------------------------- -// TXmlParser::ElementAtt() -// Parses attribute element (eg. ) -// Note: Attribute values cannot contain equals (=) or quotations (") -// ----------------------------------------------------------------------------- -// -TBool TXmlParser::ElementAtt() - { - TPtrC str=Str(); - TInt num1=Count(str, '='); - TInt num2=Count(str, '"'); - TInt pos=str.Locate(' '); // find end of tag - - if (iSlash==iLast-1 && num1>0 && num2==(2*num1) && pos!=KErrNotFound) - { - TPtrC ptr1=SubStr(iFirst, pos); - if (!ValidTag(ptr1)) - { - return EFalse; - } - - iType=EElementAtt; - iTag.Set(ptr1); - TPtrC ptr2=SubStr(pos, iSlash); - iValue.Set(ptr2); - return ETrue; - } - return EFalse; - } - -// ----------------------------------------------------------------------------- -// TXmlParser::Str() const -// Locates the position of the given character -// ----------------------------------------------------------------------------- -// -TPtrC TXmlParser::Str() const - { - return iText; - } - -// ----------------------------------------------------------------------------- -// TXmlParser::FirstNonSpace(const TDesC& aText) -// Returns the position of the first non space character -// ----------------------------------------------------------------------------- -// -TInt TXmlParser::FirstNonSpace(const TDesC& aText) - { - TInt len=aText.Length(); - for (TInt i=0; i=0; i--) - { - TChar c=aText[i]; - if (!c.IsSpace()) - { - return i; - } - } - return KErrNotFound; - } - -// ----------------------------------------------------------------------------- -// TXmlParser::SubStr(const TDesC& aText, TInt pos1, TInt pos2) -// Function returns a sub-string between aPos1 and aPos2 -// ----------------------------------------------------------------------------- -// -TPtrC TXmlParser::SubStr(const TDesC& aText, TInt pos1, TInt pos2) - { - if (pos1<0 || pos2>=aText.Length() || pos1>=pos2) - { - return TPtrC(); // return empty descriptor - } - - TInt len=pos2-pos1; - return aText.Mid(pos1+1, len-1); - } - -// ----------------------------------------------------------------------------- -// TXmlParser::SubStr(TInt pos1, TInt pos2) -// Function returns a sub-string between aPos1 and aPos2 -// ----------------------------------------------------------------------------- -// -TPtrC TXmlParser::SubStr(TInt pos1, TInt pos2) - { - TPtrC str=Str(); - return SubStr(str, pos1, pos2); - } - -// ----------------------------------------------------------------------------- -// TXmlParser::StrCopy(TDes& aTarget, const TDesC& aSource) -// Function performs string copy with length checking. -// ----------------------------------------------------------------------------- -// -void TXmlParser::StrCopy(TDes& aTarget, const TDesC& aSource) - { - TInt len=aTarget.MaxLength(); - if(lenfirst+1) - { - TPtrC ptr=iOriginal.Mid(first, last-first+1); - iText.Set(ptr); - } - } - -// ----------------------------------------------------------------------------- -// TXmlParser::ValidChar(const TChar aChar) -// Validates the character -// ----------------------------------------------------------------------------- -// -TBool TXmlParser::ValidChar(const TChar aChar) - { - if (aChar >= 'A' && aChar <= 'Z') - { - return ETrue; - } - if (aChar >= 'a' && aChar <= 'z') - { - return ETrue; - } - - return EFalse; - } - -// ----------------------------------------------------------------------------- -// TXmlParser::ValidTag(const TDesC& aText) -// Validates the tag -// ----------------------------------------------------------------------------- -// -TBool TXmlParser::ValidTag(const TDesC& aText) - { - TInt len=aText.Length(); - for (TInt i=0; i -#include -#include -#include -#include // for etel -#include // for etel -#include -#include -#include -#include -#include - -#include "caputils.h" -#include "capability.h" -#include "debug.h" - -const TInt KPackageSize = 65536; -const TInt KDefaultArrayGranularity = 5; -// ============================= MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CapUtil::GetDefaultRootPathL( RFs& aFs, TDes& aRootPath ) -// Gets default root path -// ----------------------------------------------------------------------------- -// -void CapUtil::GetDefaultRootPathL( RFs& aFs, TDes& aRootPath ) - { - TRACE_FUNC_ENTRY; - // Use the default mass storage if it is internal drive - TInt msDrive; - User::LeaveIfError( DriveInfo::GetDefaultDrive( DriveInfo::EDefaultMassStorage, msDrive ) ); - LOGGER_WRITE_1("drive: %d", msDrive); - - TUint msStatus( 0 ); - TInt err = DriveInfo::GetDriveStatus( aFs, msDrive, msStatus ); - LOGGER_WRITE_1("DriveInfo::GetDriveStatus err: %d", err); - - // if no errors, also check drive status - if( !err && !( msStatus & DriveInfo::EDrivePresent ) - || msStatus & DriveInfo::EDriveCorrupt ) - { - LOGGER_WRITE( "Internal mass storage not present or corrupted" ); - err = KErrNotFound; - } - - if ( !err && ( msStatus & DriveInfo::EDriveInternal ) ) - { - // Use internal mass storage - LOGGER_WRITE( "Use internal mass storage" ); - User::LeaveIfError( PathInfo::GetRootPath( aRootPath, msDrive ) ); - } - else - { - // Use phone memory - LOGGER_WRITE( "Use phone memory" ); - StrCopy( aRootPath, PathInfo::PhoneMemoryRootPath() ); - } - LOGGER_WRITE_1( "rootPath: %S", &aRootPath ); - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CapUtil::GetMemoryType( RFs& aFs, TDes& aMemoryType, const TInt aDrive ) -// Gets drive memory type -// ----------------------------------------------------------------------------- -// -void CapUtil::GetMemoryType( RFs& aFs, TDes& aMemoryType, const TInt aDrive ) - { - TRACE_FUNC_ENTRY; - LOGGER_WRITE_1("aDrive: %d", aDrive); - aMemoryType = KNullDesC; - TUint driveStatus; - TInt err = DriveInfo::GetDriveStatus( aFs, aDrive, driveStatus ); - if( err ) - { - LOGGER_WRITE_1( "CapUtil::GetMemoryType() : DriveInfo::GetDriveStatus err: %d", err ); - return; - } - // search internal or removable drives - TBool searchInternalDrives; - if( driveStatus & DriveInfo::EDriveInternal ) - { - aMemoryType = KMediaFlash; - searchInternalDrives = ETrue; - } - else - { - aMemoryType = KMediaMMC; - searchInternalDrives = EFalse; - } - - TInt typeNumber(0); - TInt driveCount; - TDriveList driveList; - - err = DriveInfo::GetUserVisibleDrives( aFs, driveList, driveCount ); - if( err ) - { - LOGGER_WRITE_1( "CapUtil::GetMemoryType() : DriveInfo::GetUserVisibleDrives err: %d", err ); - return; - } - - for( TInt i = EDriveA; i <= aDrive; i++ ) - { - if( driveList[i] ) - { - TUint driveStatus; - err = DriveInfo::GetDriveStatus( aFs, i, driveStatus ); - if( err ) - { - LOGGER_WRITE_1( "CapUtil::GetMemoryType() : DriveInfo::GetDriveStatus err: %d", err ); - continue; - } - - if( !(driveStatus & DriveInfo::EDrivePresent ) - || driveStatus & DriveInfo::EDriveCorrupt ) - { - LOGGER_WRITE( "not present or corrupted" ); - continue; - } - - if( driveStatus & DriveInfo::EDriveInternal ) - { - if( searchInternalDrives ) - { - typeNumber++; - } - } - else if( driveStatus & DriveInfo::EDriveRemovable ) - { - if( !searchInternalDrives ) - { - typeNumber++; - } - } - } - } - - if( typeNumber > 1 ) - { - aMemoryType.AppendNum( typeNumber ); - } - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CapUtil::GetOperatornameL(TDes& aLongName, TDes& aCountryCode, TDes& aNetworkID) -// Gets phone operator name, country code, networkID. -// ----------------------------------------------------------------------------- -// -void CapUtil::GetOperatorNameL(TDes& aLongName, TDes& aCountryCode, TDes& aNetworkID) - { - TRACE_FUNC_ENTRY; - TUint32 networkCaps; - RTelServer::TPhoneInfo phoneInfo; - - RTelServer server; - RMobilePhone mobilePhone; - User::LeaveIfError( server.Connect() ); - CleanupClosePushL( server ); - - TInt numPhones; - User::LeaveIfError( server.EnumeratePhones( numPhones ) ); - server.GetPhoneInfo( 0, phoneInfo ); - - User::LeaveIfError( mobilePhone.Open( server, phoneInfo.iName ) ); - CleanupClosePushL( mobilePhone ); - User::LeaveIfError( mobilePhone.GetNetworkCaps( networkCaps ) ); - - RMobilePhone::TMobilePhoneNetworkInfoV1 mobilePhoneNetworkInfo; - RMobilePhone::TMobilePhoneNetworkInfoV1Pckg mobilePhoneNetworkInfoPckg( - mobilePhoneNetworkInfo ); - RMobilePhone::TMobilePhoneLocationAreaV1 mobilePhoneLocationArea; - - if (networkCaps & RMobilePhone::KCapsGetCurrentNetwork) - { - TRequestStatus status; - mobilePhone.GetCurrentNetwork( - status, mobilePhoneNetworkInfoPckg, mobilePhoneLocationArea ); - User::WaitForRequest( status ); - User::LeaveIfError( status.Int() ); - } - - CleanupStack::PopAndDestroy( &mobilePhone ); - CleanupStack::PopAndDestroy( &server ); - StrCopy( aLongName, mobilePhoneNetworkInfo.iLongName ); - StrCopy( aCountryCode, mobilePhoneNetworkInfo.iCountryCode ); - StrCopy( aNetworkID, mobilePhoneNetworkInfo.iNetworkId ); - - TRACE_FUNC_EXIT; - } -// ----------------------------------------------------------------------------- -// CapUtil::GetManufacturer(TDes& aText) -// Gets phone manufacturer from HAL. In case manufacturer is not known, -// ----------------------------------------------------------------------------- -// -void CapUtil::GetManufacturer(TDes& aText) - { - TRACE_FUNC_ENTRY; - TInt num(KErrNotFound); - - HAL::Get(HALData::EManufacturer, num); - - switch (num) - { - case HALData::EManufacturer_Ericsson: - aText=KManufacturerEricsson; - break; - case HALData::EManufacturer_Motorola: - aText=KManufacturerMotorola; - break; - case HALData::EManufacturer_Nokia: - aText=KManufacturerNokia; - break; - case HALData::EManufacturer_Panasonic: - aText=KManufacturerPanasonic; - break; - case HALData::EManufacturer_Psion: - aText=KManufacturerPsion; - break; - case HALData::EManufacturer_Intel: - aText=KManufacturerIntel; - break; - case HALData::EManufacturer_Cogent: - aText=KManufacturerCogent; - break; - case HALData::EManufacturer_Cirrus: - aText=KManufacturerCirrus; - break; - case HALData::EManufacturer_Linkup: - aText=KManufacturerLinkup; - break; - case HALData::EManufacturer_TexasInstruments: - aText=KManufacturerTexasInstruments; - break; - default: - aText=KNullDesC; - break; - } - - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CapUtil::GetLanguage(TDes& aText) -// Gets language -// ----------------------------------------------------------------------------- -// -void CapUtil::GetLanguage(TDes& aText) - { - TRACE_FUNC_ENTRY; - TLanguage lang=User::Language(); - GetLanguageString(lang, aText); - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CapUtil::GetSWVersionL(TDes& aVersion, TDes& aDate, TDes& aModel) -// Gets SW version, SW version date and device model from SysUtil. -// ----------------------------------------------------------------------------- -// -void CapUtil::GetSWVersionL(TDes& aVersion, TDes& aDate, TDes& aModel) - { - TRACE_FUNC_ENTRY; - TBuf buf; - aVersion=KNullDesC; - aDate=KNullDesC; - aModel=KNullDesC; - - User::LeaveIfError( SysUtil::GetSWVersion( buf ) ); - RArray arr(KDefaultArrayGranularity); - CleanupClosePushL( arr ); - - CapUtil::SplitL(buf, '\n', arr); - const TInt KFieldsToFind = 3; - if ( arr.Count() < KFieldsToFind ) - { - User::Leave( KErrNotFound ); - } - - StrCopy( aVersion, arr[0] ); - aVersion.Trim(); - - StrCopy(aModel,arr[2]); - aModel.Trim(); - - TBuf date; - StrCopy(date, arr[1]); - TTime t; - t.UniversalTime(); // this is to avoid warnings - TRAPD( err, t = ParseDateL( date ) ); - if ( err == KErrNone ) - { - CapabilityDate( aDate, t ); - } - - CleanupStack::PopAndDestroy( &arr ); - - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CapUtil::InitMemoryInfo(TMemoryInfo& aInfo) -// Initializes TMemoryInfo. -// ----------------------------------------------------------------------------- -// -void CapUtil::InitMemoryInfo(TMemoryInfo& aInfo) - { - aInfo.iDriveNum = KErrNotFound; - aInfo.iDriveLetter = KNoChar; - aInfo.iLocation = KNullDesC; - aInfo.iFree = KErrNotFound; - aInfo.iUsed = KErrNotFound; - aInfo.iShared = EFalse; - aInfo.iFileSize = KErrNotFound; - aInfo.iFolderSize = KErrNotFound; - aInfo.iFileNameSize = KMaxFileName; // TFileName 256 - aInfo.iFolderNameSize = KMaxFileName; // TFileName 256 - aInfo.iCaseSensitivity = EFalse; - } - -// ----------------------------------------------------------------------------- -// CapUtil::GetMemoryInfoL( const RFs& aFs, TInt aDriveNumber, TMemoryInfo& aInfo ) -// Get memory information for one drive. -// ----------------------------------------------------------------------------- -// -void CapUtil::GetMemoryInfoL( const RFs& aFs, const TInt aDriveNumber, TMemoryInfo& aInfo ) - { - TRACE_FUNC_ENTRY; - LOGGER_WRITE_1(" aDriveNumber: %d", aDriveNumber); - - TVolumeInfo volumeInfo; - TDriveInfo driveInfo; - - InitMemoryInfo( aInfo ); - - User::LeaveIfError( aFs.Drive(driveInfo, aDriveNumber) ); - if ( driveInfo.iDriveAtt == (TUint)KDriveAbsent ) - { - LOGGER_WRITE(" iDriveAtt == (TUint)KDriveAbsent, Leave KErrNotFound"); - User::Leave( KErrNotFound ); - } - - User::LeaveIfError( aFs.Volume(volumeInfo, aDriveNumber) ); - - User::LeaveIfError( aFs.DriveToChar(aDriveNumber, aInfo.iDriveLetter) ); - aInfo.iDriveNum = aDriveNumber; - aInfo.iLocation.Append( aInfo.iDriveLetter ); - aInfo.iLocation.Append( KDriveDelimiter ); - aInfo.iLocation.Append( KPathDelimiter ); - aInfo.iFree = volumeInfo.iFree; - aInfo.iUsed = volumeInfo.iSize - volumeInfo.iFree; - - // set free memory up to critical level for all drives - CRepository* repository = CRepository::NewLC( KCRUidDiskLevel ); - TInt criticalLevel(0); - User::LeaveIfError( repository->Get( KDiskCriticalThreshold, criticalLevel ) ); - CleanupStack::PopAndDestroy( repository ); - criticalLevel += KPackageSize; // add obex package size to critical level - LOGGER_WRITE_1( "CapUtil::GetMemoryInfoL() criticalLevel: %d", criticalLevel ) ; - if ( aInfo.iFree > criticalLevel ) - { - aInfo.iFree = aInfo.iFree - criticalLevel; - } - else - { - aInfo.iFree = 0; - } - - aInfo.iFileSize = aInfo.iFree; - aInfo.iFolderSize = aInfo.iFree; - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CapUtil::GetFileListL( RFs& aFs, const TDesC& aDir, -// RArray& aList) -// Finds all files in aDir. -// ----------------------------------------------------------------------------- -// -void CapUtil::GetFileListL( const RFs& aFs, const TDesC& aDir, - RArray& aList) - { - TRACE_FUNC_ENTRY; - - aList.Reset(); - - CDir* dir( NULL ); - User::LeaveIfError( aFs.GetDir( aDir, KEntryAttMatchMask, ESortByName, dir ) ); - CleanupStack::PushL( dir ); - - for ( TInt i=0; i < dir->Count(); ++i ) - { - TEntry entry = (*dir)[i]; - if ( !entry.IsDir() ) - { - User::LeaveIfError( aList.Append( entry.iName ) ); - } - } - CleanupStack::PopAndDestroy( dir ); - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CapUtil::CheckFileType(const TDesC& aFile, const TDesC& aExt) -// Function checks file extension. -// ----------------------------------------------------------------------------- -// -TBool CapUtil::CheckFileType(const TDesC& aFile, const TDesC& aExt) - { - TRACE_FUNC_ENTRY; - TParse parse; - parse.Set(aFile, NULL, NULL); - TPtrC ptr=parse.Ext(); - - TBuf buf1; - TBuf buf2; - - buf1=ptr; - buf2=aExt; - - buf1.LowerCase(); - buf2.LowerCase(); - - if (buf1.Compare(buf2)==0) - { - LOGGER_WRITE( "CapUtil::CheckFileType(const TDesC& aFile, const TDesC& aExt) : returned ETrue" ); - return ETrue; - } - - else - { - LOGGER_WRITE( "CapUtil::CheckFileType(const TDesC& aFile, const TDesC& aExt) : returned EFalse" ); - return EFalse; - } - } - -// ----------------------------------------------------------------------------- -// CapUtil::GetLanguageString(TLanguage aId, TDes& aText) -// Get language string for aId. -// ----------------------------------------------------------------------------- -// -void CapUtil::GetLanguageString(TLanguage aId, TDes& aText) - { - TRACE_FUNC_ENTRY; - aText=KNullDesC; - - TInt count=NUMLANGSTRINGS; - for (TInt i=0; i& aArray) -// Function splits string (eg "name1, name2, name3") into substrings. -// ----------------------------------------------------------------------------- -// -void CapUtil::SplitL(const TDesC& aText, const TChar aSeparator, - RArray& aArray) - { - TRACE_FUNC_ENTRY; - TPtrC ptr; - ptr.Set(aText); - - for (;;) - { - TInt pos=ptr.Locate(aSeparator); - if (pos==KErrNotFound) - { - aArray.AppendL(ptr); - break; - } - - TPtrC subStr=ptr.Left(pos); // get pos characters starting from position 0 - aArray.AppendL(subStr); - - if (!(ptr.Length()>pos+1)) - { - break; - } - - ptr.Set(ptr.Mid(pos+1));// get all characters starting from position pos+1 - } - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CapUtil::ParseDateL(const TDesC& aText) -// Function parses date string of the format "dd-mm-yy". -// ----------------------------------------------------------------------------- -// -TTime CapUtil::ParseDateL(const TDesC& aText) - { - TRACE_FUNC_ENTRY; - RArray arr(KDefaultArrayGranularity); - CleanupClosePushL( arr ); - - CapUtil::SplitL( aText, '-', arr ); - if ( arr.Count() != 3 ) - { - User::Leave( KErrNotSupported ); - } - - TInt day; - TInt month; - TInt year; - - User::LeaveIfError( StrToInt(arr[0], day) ); - User::LeaveIfError( StrToInt(arr[1], month) ); - User::LeaveIfError( StrToInt(arr[2], year) ); - - TDateTime td; - TMonth month2 = Month( month ); - // if year is defined as two digit, add currect millenium for it - const TInt KDefaultMillenium = 2000; - if ( year < KDefaultMillenium ) - { - year = year + KDefaultMillenium; - } - - - User::LeaveIfError( td.Set(year, month2, day-1, 0, 0, 0, 0) ); - - CleanupStack::PopAndDestroy( &arr ); - - TTime t(td); - TRACE_FUNC_EXIT; - return t; -} - -// ----------------------------------------------------------------------------- -// CapUtil::Month(TInt aNum) -// Function return TMonth presentation of integer -// ----------------------------------------------------------------------------- -// -TMonth CapUtil::Month(TInt aNum) - { - TRACE_FUNC_ENTRY; - __ASSERT_DEBUG(aNum>=1 && aNum<=12, Panic(KErrArgument)); - - switch (aNum) - { - case 1: return EJanuary; - case 2: return EFebruary; - case 3: return EMarch; - case 4: return EApril; - case 5: return EMay; - case 6: return EJune; - case 7: return EJuly; - case 8: return EAugust; - case 9: return ESeptember; - case 10: return EOctober; - case 11: return ENovember; - case 12: return EDecember; - default: return EJanuary; - } - } - -// ----------------------------------------------------------------------------- -// CapUtil::CapabilityDate(TDes& aText, const TTime aTime) -// Constructs capability date as string -// ----------------------------------------------------------------------------- -// -void CapUtil::CapabilityDate(TDes& aText, const TTime aTime) - { - TRACE_FUNC_ENTRY; - _LIT(KFormat,"%04d%02d%02dT%02d%02d%02dZ"); - - TDateTime dt=aTime.DateTime(); - aText.Format(KFormat, dt.Year(), dt.Month()+1, dt.Day()+1, dt.Hour(), - dt.Minute(), dt.Second()); - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// TIdStack::Pop() -// Pop id from the stack -// ----------------------------------------------------------------------------- -// -TInt TIdStack::Pop() - { - if (iPos<0) - { - LOGGER_WRITE( "TIdStack::Pop() returned KErrNotFound" ); - return KErrNotFound; - } - - TInt id=iArray[iPos]; - iPos--; - return id; - } - -// ----------------------------------------------------------------------------- -// TIdStack::Push( TInt aId ) -// Push id to the stack -// ----------------------------------------------------------------------------- -// -void TIdStack::Push( TInt aId ) - { - if ( Size() >= KNestingLimit ) - { - return; - } - - iPos++; - iArray[iPos] = aId; - } - -// ----------------------------------------------------------------------------- -// TIdStack::Size() const -// Size of the stack -// ----------------------------------------------------------------------------- -// -TInt TIdStack::Size() const - { - return iPos+1; - } - -// ----------------------------------------------------------------------------- -// TIdStack::Reset() -// Reset the stack. -// ----------------------------------------------------------------------------- -// -void TIdStack::Reset() - { - iArray.Reset(); - iPos=-1; - } - -// End of file diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/services/csc/src/sconcsc.cpp --- a/connectivitymodules/SeCon/services/csc/src/sconcsc.cpp Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,122 +0,0 @@ -/* -* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: CSConCSC implementation -* -*/ - - -// -// This program creates a polymorphic interface DLL that is used -// to create capability object -// - -// INCLUDE FILES - -#include -#include - -#include "sconcsc.h" -#include "capinfo.h" -#include "debug.h" - -// ============================= MEMBER FUNCTIONS =============================== - - -// ----------------------------------------------------------------------------- -// CreateCSConCSCL() -// Function to construct CSConCSC object. Note that this function -// is exported at ordinal 1 and is not a member of any class. -// ----------------------------------------------------------------------------- -// -EXPORT_C CSConCSC* CreateCSConCSCL() - { - TRACE_FUNC; - return CSConCSC::NewL(); - } - - -// ----------------------------------------------------------------------------- -// CSConCSC::NewL() -// Two-phase constructor -// ----------------------------------------------------------------------------- -// -CSConCSC* CSConCSC::NewL() - { - TRACE_FUNC_ENTRY; - CSConCSC* self = new (ELeave) CSConCSC(); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - TRACE_FUNC_EXIT; - return self; - } - -// ----------------------------------------------------------------------------- -// CSConCSC::~CSConCSC() -// Destructor -// ----------------------------------------------------------------------------- -// -CSConCSC::~CSConCSC() - { - TRACE_FUNC_ENTRY; - delete iCapInfo; - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConCSC::CapabilityObject(CBufFlat& aBuf) -// Creates a capability object data and sets data into aBuf. -// ----------------------------------------------------------------------------- -// -TInt CSConCSC::CapabilityObject(CBufFlat& aBuf) - { - TRACE_FUNC_ENTRY; - TRAPD(err, CSConCSC::CapabilityObjectL(aBuf)); - LOGGER_WRITE_1( "CSConCSC::CapabilityObject(CBufFlat& aBuf) : returned %d", err ); - return err; - } - -// ----------------------------------------------------------------------------- -// CSConCSC::ConstructL() -// Initializes member data -// ----------------------------------------------------------------------------- -// -void CSConCSC::ConstructL() - { - iCapInfo = CCapInfo::NewL(); - } - -// ----------------------------------------------------------------------------- -// CSConCSC::CSConCSC() -// Default constructor -// ----------------------------------------------------------------------------- -// -CSConCSC::CSConCSC() - { - } - -// ----------------------------------------------------------------------------- -// CSConCSC::CapabilityObjectL(CBufFlat& aBuf) -// Creates a capability object data and sets data into aBuf. -// ----------------------------------------------------------------------------- -// -void CSConCSC::CapabilityObjectL(CBufFlat& aBuf) - { - TRACE_FUNC_ENTRY; - iCapInfo->CapabilityDocumentL( &aBuf ); - TRACE_FUNC_EXIT; - } - -// End of file - diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/services/csc/src/sconsyncservice.cpp --- a/connectivitymodules/SeCon/services/csc/src/sconsyncservice.cpp Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,505 +0,0 @@ -/* -* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: CSConSyncService implementation. -* -*/ - - -// Includes -#include -#include - -#include // for searching app name from installer -#include -#include -#include -using namespace Java; - -#include "sconsyncservice.h" -#include "capability.h" -#include "debug.h" - -// Constants -const TInt KDsAppUi = 0x101F6DE4; // NSmlDSSync.exe -const TSmlDataProviderId KCalendarId = 0x101f6dde; -const TSmlDataProviderId KContactsId = 0x101f6ddd; -const TSmlDataProviderId KSmsId = 0x10206b5c; -const TSmlDataProviderId KBookmarkId = 0x102751ba; - -const TInt KDateFormatLength(16); - -// ----------------------------------------------------------------------------- -// CSConSyncService::NewLC() -// ----------------------------------------------------------------------------- -// -CSConSyncService* CSConSyncService::NewLC() - { - TRACE_FUNC_ENTRY; - CSConSyncService* self = new (ELeave) CSConSyncService(); - CleanupStack::PushL( self ); - self->ConstructL(); - TRACE_FUNC_EXIT; - return self; - } - -// ----------------------------------------------------------------------------- -// CSConSyncService::CSConSyncService() -// ----------------------------------------------------------------------------- -// -CSConSyncService::CSConSyncService() - { - } - -// ----------------------------------------------------------------------------- -// CSConSyncService::~CSConSyncService() -// ----------------------------------------------------------------------------- -// -CSConSyncService::~CSConSyncService() - { - TRACE_FUNC_ENTRY; - if ( iApaSessionConnected ) - { - iApaSession.Close(); - } - if ( iSyncSessionOpened ) - { - iSyncSession.Close(); - } - delete iRepository; - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConSyncService::ConstructL() -// ----------------------------------------------------------------------------- -// -void CSConSyncService::ConstructL() - { - iRepository = CRepository::NewL( KCRUidSecon ); - } - -// ----------------------------------------------------------------------------- -// CSConSyncService::GetSolutionL() -// Populate SolutionInfo according to content type. -// ----------------------------------------------------------------------------- -// -void CSConSyncService::GetSolutionL( const TUint aSeconContentType, - TSConSolutionInfo& aSolutionInfo ) - { - TRACE_FUNC_ENTRY; - TInt appUid; - User::LeaveIfError( iRepository->Get( aSeconContentType, appUid )); - LOGGER_WRITE_2( "repository readed ok, uid: %d, hex:%x", appUid, appUid ); - - aSolutionInfo.iUid = appUid; - if ( aSolutionInfo.iUid == KDsAppUi ) - { - // read profile name - LOGGER_WRITE( "Search correct profile" ); - GetLastUsedProfileNameL( aSolutionInfo.iSolutionName, - aSolutionInfo.iTime, ProviderId( aSeconContentType ) ); - } - else if ( aSolutionInfo.iUid != 0 ) - { - LOGGER_WRITE( "Search correct application name" ); - TUid appUid = {aSolutionInfo.iUid}; - GetApplicationCaptionL( aSolutionInfo.iSolutionName, appUid ); - - // get solution timestamp - TBuf timeBuffer; - // Timestamp is stored always in next to Uid value on cenrep - TInt err = iRepository->Get( aSeconContentType+1, timeBuffer ); - - LOGGER_WRITE_1( "iRepository->Get(time) err: %d", err ); - if ( err == KErrNone ) - { - err = ParseTimestamp( aSolutionInfo.iTime, timeBuffer ); - LOGGER_WRITE_1( "ParseTimestamp err: %d", err ); - } - } - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConSyncService::ProviderId() -// Return correct providerId according to content type. -// ----------------------------------------------------------------------------- -// -TSmlDataProviderId CSConSyncService::ProviderId( const TUint32 aSeconContentType ) const - { - TSmlDataProviderId providerId(KErrNotFound); - switch (aSeconContentType) - { - case KSeconCalendarUid: - providerId = KCalendarId; - break; - case KSeconContactsUid: - providerId = KContactsId; - break; - case KSeconSmsUid: - providerId = KSmsId; - break; - case KSeconBookmarkUid: - providerId = KBookmarkId; - break; - default: - LOGGER_WRITE_1( "Invalid content type: %d", aSeconContentType ); - } - return providerId; - } - -// ----------------------------------------------------------------------------- -// CSConSyncService::ParseTimestamp() -// Parses timestamp to TTime format -// ----------------------------------------------------------------------------- -// -TInt CSConSyncService::ParseTimestamp( TTime& aTime, const TDesC& aTimestamp ) const - { - // timestamp must be in following format: - // YYYYMMDDTHHMMSSZ - // MM=1..12, DD=1..number of days in month, HH=0..23, MM;SS=0..59 - // Example 20071224T162215Z = 24.12.2007, 16:22:15 UTC time - - if ( aTimestamp.Length() != KDateFormatLength ) - { - LOGGER_WRITE_1( "aTimestamp.Length(): %d", aTimestamp.Length() ); - return KErrArgument; - } - - TPtrC temp; - temp.Set(aTimestamp.Ptr()); - - TLex lex(temp.Mid(0,4)); - TInt year; - TInt month; - TInt day; - TInt hour; - TInt minute; - TInt second; - TInt err = lex.Val( year ); - if (err != KErrNone) return err; - - lex = temp.Mid(4,2); - err = lex.Val( month ); - if ( err != KErrNone) return err; - month--; - - lex = temp.Mid(6,2); - err = lex.Val( day ); - if (err != KErrNone) return err; - day--; - - lex = temp.Mid(9,2); - err = lex.Val( hour ); - if (err != KErrNone) return err; - - lex = temp.Mid(11,2); - err = lex.Val( minute ); - if (err != KErrNone) return err; - - lex = temp.Mid(13,2); - err = lex.Val( second ); - if (err != KErrNone) return err; - - TDateTime parsedTime; - err = parsedTime.Set(year, (TMonth)month, day, hour, minute, second, 0); - if (err != KErrNone) return err; - - aTime = parsedTime; - return err; - } - -// ----------------------------------------------------------------------------- -// CSConSyncService::GetApplicationCaptionL() -// Get application caption. -// ----------------------------------------------------------------------------- -// -void CSConSyncService::GetApplicationCaptionL( TDes& aCaption, const TUid aAppUid ) - { - TRACE_FUNC_ENTRY; - - TInt err(KErrNotReady); - // connect to RApaLsSession, if not yet ready - if ( !iApaSessionConnected ) - { - err = iApaSession.Connect(); - if ( err == KErrNone ) - { - iApaSessionConnected = ETrue; - } - } - - // Get application caption using RApaLsSession::GetAppInfo - TApaAppInfo appInfo; - if ( iApaSessionConnected ) - { - err = iApaSession.GetAppInfo( appInfo ,aAppUid ); - } - - LOGGER_WRITE_1( "GetAppInfo err: %d", err ); - if ( err == KErrNone ) - { - aCaption = appInfo.iCaption; - } - else - { - // Caption does not exist, search application name from installer - GetInstPackageCaptionL( aCaption, aAppUid ); - } - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConSyncService::GetInstPackageCaptionL() -// Search UID from installed applications, return app caption -// ----------------------------------------------------------------------------- -// -void CSConSyncService::GetInstPackageCaptionL( TDes& aCaption, const TUid aPackageUid ) - { - TRACE_FUNC_ENTRY; - LOGGER_WRITE("Name not found, search from installer"); - // Search application name from Installer. - Swi::RSisRegistrySession sisRegistry; - User::LeaveIfError( sisRegistry.Connect() ); - CleanupClosePushL( sisRegistry ); - - //Check if uid belongs to SIS package - if( sisRegistry.IsInstalledL( aPackageUid ) ) - { - LOGGER_WRITE("SIS package found"); - Swi::RSisRegistryEntry entry; - CleanupClosePushL(entry); - User::LeaveIfError( entry.Open( sisRegistry, aPackageUid ) ); - aCaption.Copy( *entry.PackageNameL() ); - CleanupStack::PopAndDestroy( &entry ); - } - else - { - // not sis app, might be java app. - LOGGER_WRITE("SIS package not found"); - CJavaRegistry* javaRegistry = CJavaRegistry::NewLC( ); - TBool entryExist = javaRegistry->RegistryEntryExistsL( aPackageUid ); - if ( entryExist ) - { - CJavaRegistryEntry* entry = javaRegistry->RegistryEntryL( aPackageUid ); - if ( entry ) - { - aCaption.Copy( entry->Name() ); - delete entry; - } - } - - CleanupStack::PopAndDestroy( javaRegistry ); - } - - CleanupStack::PopAndDestroy( &sisRegistry ); - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConSyncService::GetLastUsedProfileNameL() -// Gets last used profile for selected provider -// ----------------------------------------------------------------------------- -// -void CSConSyncService::GetLastUsedProfileNameL( TDes& aProfileName, TTime& aTime, - const TSmlDataProviderId& aDataProviderId ) - { - TRACE_FUNC_ENTRY; - if ( !iSyncSessionOpened ) - { - iSyncSession.OpenL(); - iSyncSessionOpened = ETrue; - } - RArray profiles; - CleanupClosePushL( profiles ); - iSyncSession.ListProfilesL(profiles, ESmlDataSync ); - TSmlProfileId lastSyncProfile(KErrNotFound); - TTime lastSyncTime(0); - LOGGER_WRITE_1( "Profiles count: %d", profiles.Count() ); - for (TInt i=0; i lastSyncTime ) - { - LOGGER_WRITE_1( "New record, profile: %d",profiles[i]); - lastSyncTime = syncTime; - lastSyncProfile = profiles[i]; - } - } - CleanupStack::PopAndDestroy( &profiles ); - LOGGER_WRITE_1( "lastSyncProfile: %d", lastSyncProfile ); - if ( lastSyncProfile != KErrNotFound ) - { - aTime = lastSyncTime; - RSyncMLDataSyncProfile syncProfile; - syncProfile.OpenL( iSyncSession, lastSyncProfile, ESmlOpenRead ); - TPtrC displayName = syncProfile.DisplayName(); - aProfileName.Copy( displayName ); - syncProfile.Close(); - } - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConSyncService::GetLastSyncTimeL() -// Gets last sync time for certain profile and provider. -// ----------------------------------------------------------------------------- -// -void CSConSyncService::GetLastSyncTimeL( TTime& aTime, const TSmlProfileId aSyncProfileId, - const TSmlDataProviderId aDataProviderId ) - { - TRACE_FUNC_ENTRY; - LOGGER_WRITE_1( "aSyncProfileId: %d", aSyncProfileId ); - LOGGER_WRITE_1( "aDataProviderId: 0x%08x", aDataProviderId ); - if ( !iSyncSessionOpened ) - { - LOGGER_WRITE("iSyncSession is not opened, Leave!"); - User::Leave( KErrNotReady ); - } - - RSyncMLDataSyncProfile syncProfile; - syncProfile.OpenL( iSyncSession, aSyncProfileId, ESmlOpenRead ); - CleanupClosePushL( syncProfile ); - LOGGER_WRITE( "syncProfile opened OK" ); - - TSmlTaskId providerTask; - GetProviderTaskL( providerTask, syncProfile, aDataProviderId ); - if ( providerTask != KErrNone ) - { - RSyncMLHistoryLog historyLog; - historyLog.OpenL( iSyncSession, aSyncProfileId ); - CleanupClosePushL( historyLog ); - historyLog.SortEntries(CSyncMLHistoryEntry::ESortByTime); - LOGGER_WRITE_1( "historyLog.Count: %d", historyLog.Count() ); - const CSyncMLHistoryJob* historyJob = LatestHistoryJob( historyLog, providerTask ); - if ( historyJob ) - { - aTime = historyJob->TimeStamp(); -#ifdef _DEBUG - TDateTime timeStamp = historyJob->TimeStamp().DateTime(); - _LIT(KDateFormat, " (%04d%02d%02dT%02d%02d%02d)"); - const TInt KDateFormatLength(20); - TBuf tempdate; - tempdate.Format(KDateFormat, timeStamp.Year(), timeStamp.Month()+1, timeStamp.Day()+1, - timeStamp.Hour(), timeStamp.Minute(), timeStamp.Second()); - LOGGER_WRITE_1("history found, TimeStamp: %S", &tempdate); -#endif - } - - CleanupStack::PopAndDestroy( &historyLog ); - } - CleanupStack::PopAndDestroy( &syncProfile ); - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConSyncService::GetProviderTaskL() -// Gets provider task id from profile -// ----------------------------------------------------------------------------- -// -void CSConSyncService::GetProviderTaskL( TSmlTaskId& aProviderTask, - RSyncMLDataSyncProfile& aSyncProfile, - const TSmlDataProviderId aDataProviderId ) const - { - TRACE_FUNC_ENTRY; - aProviderTask = KErrNotFound; - - RArray tasks; - CleanupClosePushL( tasks ); - - aSyncProfile.ListTasksL( tasks ); - LOGGER_WRITE_1( "tasks.Count: %d", tasks.Count() ); - - for ( TInt i=0; i=0; i-- ) - { - const CSyncMLHistoryEntry& entry = aHistoryLog[i]; - const CSyncMLHistoryJob* jobEntry = CSyncMLHistoryJob::DynamicCast(&entry); - if ( jobEntry ) - { - if ( TaskExist(jobEntry, aTaskId) ) - { - LOGGER_WRITE( "history job found" ); - TRACE_FUNC_EXIT; - return jobEntry; - } - } - } - LOGGER_WRITE( "history job not found" ); - TRACE_FUNC_EXIT; - return NULL; - } - - // ----------------------------------------------------------------------------- - // CSConSyncService::TaskExist() - // Returns ETrue if task exists in HistoryJob. - // ----------------------------------------------------------------------------- - // -TBool CSConSyncService::TaskExist( const CSyncMLHistoryJob* aHistoryJob, TInt aTaskId ) const - { - TRACE_FUNC_ENTRY; - TInt taskCount = aHistoryJob->TaskCount(); - for ( TInt i=0; iTaskAt(i); - - if ( taskInfo.iTaskId == aTaskId ) - { - LOGGER_WRITE( "task exists." ); - TRACE_FUNC_EXIT; - return ETrue; - } - } - TRACE_FUNC_EXIT; - return EFalse; - } - diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/services/csc/src/sconversioninfo.cpp --- a/connectivitymodules/SeCon/services/csc/src/sconversioninfo.cpp Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,276 +0,0 @@ -/* -* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: CSconVersionInfo implementation. -* -*/ - - -#include "sconversioninfo.h" - -#include -#include -#include // read imsi -#include -#include -#include -#include - -#include "caputils.h" -#include "debug.h" - -CSconVersionInfo::CSconVersionInfo() - { - iSymbianVersionError = KErrNotReady; - iS60VersionError = KErrNotReady; - } - -CSconVersionInfo::~CSconVersionInfo() - { - delete iManufacturer; - delete iModel; - delete iProduct; - delete iRevision; - delete iSWVersion; - delete iSerialNumber; - delete iSysVersionInfo; - delete iLangVersion; - delete iLangSWVersion; - delete iOPVersion; - delete iProductCode; - } - -CSconVersionInfo* CSconVersionInfo::NewL() - { - CSconVersionInfo* self = new (ELeave) CSconVersionInfo; - return self; - } - -// ----------------------------------------------------------------------------- -// CSconVersionInfo::FetchInfoL() -// fetch device info -// ----------------------------------------------------------------------------- -// -void CSconVersionInfo::FetchInfoL( RFs& aFs ) - { - TRACE_FUNC_ENTRY; - - iSymbianVersionError = SysVersionInfo::GetVersionInfo( iSymbianVersion, aFs ); - iS60VersionError = VersionInfo::GetVersion( iS60Version, aFs ); - - TBuf info; - TBuf productBuf; - TInt err(KErrNone); - delete iSWVersion; - iSWVersion = NULL; - delete iProduct; - iProduct = NULL; - // get SW version, SW version date and model - TRAP( err, CapUtil::GetSWVersionL( info, iDate, productBuf ) ); - iSWVersion = info.AllocL(); - iProduct = productBuf.AllocL(); - LOGGER_WRITE_1("CapUtil::GetSWVersionL err: %d", err); - - - SysVersionInfo::TProductVersion productVersion; - TInt sysVersionError = SysVersionInfo::GetVersionInfo( productVersion, aFs ); - LOGGER_WRITE_1( "SysVersionInfo::GetVersionInfo returned : %d", sysVersionError ); - - // Use TelServer to get IMEI and also other info if SysVersionInfo is not supported - RTelServer telServer; - User::LeaveIfError( telServer.Connect() ); - CleanupClosePushL( telServer ); - RTelServer::TPhoneInfo teleinfo; - User::LeaveIfError( telServer.GetPhoneInfo( 0, teleinfo ) ); - RMobilePhone phone; - User::LeaveIfError( phone.Open( telServer, teleinfo.iName ) ); - CleanupClosePushL( phone ); - User::LeaveIfError(phone.Initialise()); - TUint32 teleidentityCaps; - phone.GetIdentityCaps( teleidentityCaps ); - RMobilePhone::TMobilePhoneIdentityV1 telid; - TRequestStatus status; - phone.GetPhoneId( status, telid ); - User::WaitForRequest( status ); - if ( status == KErrNone ) - { - if ( sysVersionError ) - { - LOGGER_WRITE("Use info from TMobilePhoneIdentityV1"); - delete iModel; - iModel = NULL; - delete iRevision; - iRevision = NULL; - - // phone model sales name. For example "N01". - iModel = telid.iModel.AllocL(); - // product revision. For example "01" - iRevision = telid.iRevision.AllocL(); - } - delete iSerialNumber; - iSerialNumber = NULL; - // Phone serial number (IMEI or ESN), in character string format. - iSerialNumber = telid.iSerialNumber.AllocL(); - } - - CleanupStack::PopAndDestroy( &phone ); - CleanupStack::PopAndDestroy( &telServer ); - - if ( sysVersionError == KErrNone ) - { - // use information from SysVersionInfo instead of previous APIs. - LOGGER_WRITE("Using SysVersionInfo"); - - // phone model sales name. For example "N01". - delete iModel; - iModel = NULL; - iModel = productVersion.iModel.AllocL(); - // product revision. For example "01" - delete iRevision; - iRevision = NULL; - iRevision = productVersion.iRevision.AllocL(); - // manufacturer name. For example "Nokia" - delete iManufacturer; - iManufacturer = NULL; - iManufacturer = productVersion.iManufacturer.AllocL(); - // product code name. For example "RM-1" - delete iProduct; - iProduct = NULL; - iProduct = productVersion.iProduct.AllocL(); - } - else - { - CapUtil::GetManufacturer( info ); - delete iManufacturer; - iManufacturer = NULL; - iManufacturer = info.AllocL(); - } - - CapUtil::GetLanguage( iLanguage ); - - - err = SysVersionInfo::GetVersionInfo( SysVersionInfo::EFWVersion, info, aFs ); - delete iSysVersionInfo; - iSysVersionInfo = NULL; - if ( !err ) - { - iSysVersionInfo = info.AllocL(); - } - - err = SysUtil::GetLangVersion( info ); - delete iLangVersion; - iLangVersion = NULL; - if ( !err ) - { - iLangVersion = info.AllocL(); - } - - sysVersionError = SysUtil::GetLangSWVersion( info ); - delete iLangSWVersion; - iLangSWVersion = NULL; - if ( !sysVersionError ) - { - iLangSWVersion = info.AllocL(); - } - - sysVersionError = SysVersionInfo::GetVersionInfo( SysVersionInfo::EOPVersion, info, aFs ); - delete iOPVersion; - iOPVersion = NULL; - if ( !sysVersionError ) - { - iOPVersion = info.AllocL(); - } - - - sysVersionError = SysVersionInfo::GetVersionInfo( SysVersionInfo::EProductCode, info, aFs ); - delete iProductCode; - iProductCode = NULL; - if ( !sysVersionError ) - { - iProductCode = info.AllocL(); - } - - // screen size - TPckgBuf siBuf; - UserSvr::ScreenInfo(siBuf); - TScreenInfoV01& si=siBuf(); - iScreenSize = si.iScreenSize; - - - // read DesktopSync key value - CRepository* repository(NULL); - TRAP( iDesktopSyncError, repository = CRepository::NewL( KCRUidDSDCMOConfig )); - if ( !iDesktopSyncError ) - { - iDesktopSyncError = repository->Get( KNsmlDesktopSync, iDesktopSync ); - LOGGER_WRITE_1("iDesktopSyncError: %d", iDesktopSyncError ); - LOGGER_WRITE_1("iDesktopSync: %d", iDesktopSync ); - delete repository; - } - else - { - LOGGER_WRITE_1("Could not create CRepository, err: %d", iDesktopSyncError ); - } - - - - iInfoFetched = ETrue; - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSconVersionInfo::IsReady() -// -// ----------------------------------------------------------------------------- -// -TBool CSconVersionInfo::IsReady() - { - return iInfoFetched; - } - -// ----------------------------------------------------------------------------- -// CSconVersionInfo::GetSymbianVersion() -// Get Symbian OS version -// ----------------------------------------------------------------------------- -// -TInt CSconVersionInfo::GetSymbianVersion( SysVersionInfo::TSymbianOSVersion& aSymbianVersion ) - { - if ( iSymbianVersionError ) - { - return iSymbianVersionError; - } - else - { - aSymbianVersion = iSymbianVersion; - return KErrNone; - } - } - -// ----------------------------------------------------------------------------- -// CSconVersionInfo::GetS60Version() -// Get S60 platform version -// ----------------------------------------------------------------------------- -// -TInt CSconVersionInfo::GetS60Version( VersionInfo::TPlatformVersion& aS60Version ) - { - if ( iS60VersionError ) - { - return iS60VersionError; - } - else - { - aS60Version = iS60Version; - return KErrNone; - } - } - diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/services/csc/src/stringlist.cpp --- a/connectivitymodules/SeCon/services/csc/src/stringlist.cpp Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,277 +0,0 @@ -/* -* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: CStringList implementation -* -*/ - - -// INCLUDE FILES - -#include "stringlist.h" -#include "capability.h" -#include "debug.h" - -const TInt KMaxStringlistSize( 1000 ); - -// ============================= MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CStringList::NewL() -// Two-phase constructor. -// ----------------------------------------------------------------------------- -// -CStringList* CStringList::NewL() - { - TRACE_FUNC_ENTRY; - CStringList* self = CStringList::NewLC(); - CleanupStack::Pop( self ); - TRACE_FUNC_EXIT; - return self; - } - -// ----------------------------------------------------------------------------- -// CStringList::NewLC() -// Two-phase constructor. The created instance is placed to cleanup stack -// ----------------------------------------------------------------------------- -// -CStringList* CStringList::NewLC() - { - TRACE_FUNC_ENTRY; - CStringList* self = new ( ELeave ) CStringList(); - CleanupStack::PushL( self ); - self->ConstructL(); - TRACE_FUNC_EXIT; - return self; - } - -// ----------------------------------------------------------------------------- -// CStringList::CStringList() -// Default constuctor -// ----------------------------------------------------------------------------- -// -CStringList::CStringList() - { - TRACE_FUNC; - } - -// ----------------------------------------------------------------------------- -// CStringList::~CStringList() -// Destructor -// ----------------------------------------------------------------------------- -// -CStringList::~CStringList() - { - TRACE_FUNC_ENTRY; - delete iLines; - iLines = NULL; - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CStringList::ConstructL() -// Initializes member data -// ----------------------------------------------------------------------------- -// -void CStringList::ConstructL() - { - TRACE_FUNC_ENTRY; - const TInt KDefaultArrayGranularity = 10; - iLines = new (ELeave) CDesCArrayFlat(KDefaultArrayGranularity); - SetMark(0); - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CStringList::Count() const -// Returns the count of lines -// ----------------------------------------------------------------------------- -// -TInt CStringList::Count() const - { - return iLines->Count(); - } - -// ----------------------------------------------------------------------------- -// CStringList::Panic(TInt aPanic) const -// Creates a panic -// ----------------------------------------------------------------------------- -// -#ifdef _DEBUG -void CStringList::Panic(TInt aPanic) const -#else -void CStringList::Panic(TInt /*aPanic*/) const -#endif - { - TRACE_FUNC_ENTRY; -#ifdef _DEBUG - _LIT(KPanicCategory,"CStringList"); - - User::Panic(KPanicCategory, aPanic); -#endif - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CStringList::Reset() -// Resets iLines -// ----------------------------------------------------------------------------- -// -void CStringList::Reset() - { - iLines->Reset(); - } - -// ----------------------------------------------------------------------------- -// CStringList::WriteL(const TDesC& aText) -// Writes a string -// ----------------------------------------------------------------------------- -// -void CStringList::WriteL(const TDesC& aText) - { - iLines->AppendL(aText); - } - -// ----------------------------------------------------------------------------- -// CStringList::ReadPtr(TInt aIndex) -// Returns pointer to the string -// ----------------------------------------------------------------------------- -// -TPtrC16 CStringList::ReadPtr(TInt aIndex) - { - if (aIndex<0 || aIndex>=Count()) - { - Panic(KErrArgument); - } - - return iLines->MdcaPoint(aIndex); - } - -// ----------------------------------------------------------------------------- -// CStringList::CopyL(CStringList* aSource, TInt aStart, TInt aStop) -// Copies a string / strings -// ----------------------------------------------------------------------------- -// -void CStringList::CopyL(CStringList* aSource, TInt aStart, TInt aStop) - { - if (aStart<0 || aStop>=aSource->Count() || aStart>aStop) - { - Panic(KErrArgument); - } - - for (TInt i=aStart; i<=aStop; i++) - { - WriteL(aSource->ReadPtr(i)); - } - } - -// ----------------------------------------------------------------------------- -// CStringList::StrCopy(TDes& aTarget, const TDesC& aSource) const -// Copies the string -// ----------------------------------------------------------------------------- -// -TBool CStringList::StrCopy(TDes& aTarget, const TDesC& aSource) const - { - TInt len=aTarget.MaxLength(); - if(len buffer; - TInt count(0); - for (;;) - { - count++; - if ( count > KMaxStringlistSize ) - { - break; - } - - buffer = KNullDesC; - - // - // Read seems to read chars until newline is reached or - // the descriptor is full. In case descriptor becomes full, - // err is KErrTooBig and next read starts from the next line. - // - TInt err = textFile.Read( buffer ); - if ( err == KErrEof ) - { - break; - } - - if ( err != KErrNone ) - { - User::Leave( err ); - } - - iLines->AppendL( buffer ); - } - - CleanupStack::PopAndDestroy( &file ); // file - } - - -// ----------------------------------------------------------------------------- -// CStringList::Mark() const -// Returns the mark -// ----------------------------------------------------------------------------- -// -TInt CStringList::Mark() const - { - return iMark; - } - -// ----------------------------------------------------------------------------- -// CStringList::SetMark(TInt aMark) -// Sets mark -// ----------------------------------------------------------------------------- -// -void CStringList::SetMark(TInt aMark) - { - iMark=aMark; - } - -// End of files diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/services/ftp/bld/bld.inf --- a/connectivitymodules/SeCon/services/ftp/bld/bld.inf Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -/* -* Copyright (c) 2004-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: File Transfer Controller build file. -* -*/ - -#include - -PRJ_PLATFORMS -DEFAULT - -PRJ_EXPORTS -../loc/sconftp.loc MW_LAYER_LOC_EXPORT_PATH(sconftp.loc) - -PRJ_MMPFILES -../bld/sconftp.mmp diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/services/ftp/bld/def/bwinscwu.def --- a/connectivitymodules/SeCon/services/ftp/bld/def/bwinscwu.def Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -EXPORTS - ?CreateCSConFTPL@@YAPAVCSConFTP@@XZ @ 1 NONAME ; class CSConFTP * CreateCSConFTPL(void) - diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/services/ftp/bld/def/eabiuu.def --- a/connectivitymodules/SeCon/services/ftp/bld/def/eabiuu.def Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -EXPORTS - _Z15CreateCSConFTPLv @ 1 NONAME - _ZTI8CSConFTP @ 2 NONAME ; ## - _ZTV8CSConFTP @ 3 NONAME ; ## - diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/services/ftp/bld/sconftp.mmp --- a/connectivitymodules/SeCon/services/ftp/bld/sconftp.mmp Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,75 +0,0 @@ -/* -* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: File Transfer Controller mmp file -* -*/ - - -// To get the MW_LAYER_SYSTEMINCLUDE-definition -#include -#include - -VENDORID VID_DEFAULT - -CAPABILITY CAP_GENERAL_DLL - -TARGET sconftp.dll -TARGETTYPE DLL - -UID 0x10009D8D 0x101F968A - -#if defined(ARMCC) -DEFFILE ./def/eabiu -#elif defined(WINSCW) -DEFFILE ./def/bwinscw -#elif defined(WINS) -DEFFILE ./def/bwins -#elif defined(ARM) -DEFFILE ./def/bmarm -#endif - -SOURCEPATH ../src -SOURCE sconfshandler.cpp -SOURCE sconftp.cpp -SOURCE sconinboxhandler.cpp - -USERINCLUDE ../../../inc -USERINCLUDE ../inc -USERINCLUDE ../../../cntparser/inc - - -APP_LAYER_SYSTEMINCLUDE - - -START RESOURCE ../src/sconftp.rss -HEADER -TARGETPATH RESOURCE_FILES_DIR -LANGUAGE_IDS -END - - -LIBRARY efsrv.lib // For File server -LIBRARY euser.lib // Base library -LIBRARY IrObex.lib // For Object exchange -LIBRARY obexutils.lib -LIBRARY msgs.lib // For Inbox entry -LIBRARY charconv.lib // For Unicode conversion -LIBRARY bafl.lib // Basic Application Framework Library -LIBRARY commonengine.lib // For resource reader -LIBRARY platformenv.lib // For pathinfo -LIBRARY CntParserServer.lib // for contacts -LIBRARY directorylocalizer.lib // For localizing directories -LIBRARY sysutil.lib -LIBRARY centralrepository.lib -DEBUGLIBRARY flogger.lib // For debug logging diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/services/ftp/inc/sconconstants.h --- a/connectivitymodules/SeCon/services/ftp/inc/sconconstants.h Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +0,0 @@ -/* -* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Common constants for PC Connectivity -* -*/ - - -#ifndef __SCONCONSTANTS_H -#define __SCONCONSTANTS_H - -enum TSConProfile - { - EStandard = 0, - EProprietary, - EOther - }; - -enum TSConUsedMedia - { - ESConNoMedia = 0, - ESConIRMedia, - ESConBTMedia, - ESConUSBMedia - }; - -#endif // __SCONCONSTANTS_H - -// End of file diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/services/ftp/inc/sconconsts.h --- a/connectivitymodules/SeCon/services/ftp/inc/sconconsts.h Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,97 +0,0 @@ -/* -* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Constant definitions for File Transfer Controller -* -*/ - - -#ifndef _SCONCONSTS_H_ -#define _SCONCONSTS_H_ - -_LIT( K_C_ROOT, "C:\\" ); - -// Following folders on MMC are exluded from folder listing -_LIT( KSConResource, "resource\\" ); // resource folder on MMC -_LIT( KSConSys, "sys\\" ); // sys folder on MMC -_LIT( KSConPrivate, "private\\" ); // private folder on MMC -_LIT( KSConSystem, "system\\" ); // system folder on MMC - -// Suite needs access to SuiteConf.xml file -_LIT( KSConAllowedPath, "Z:\\Private\\101F7C87" ); - -// For folder listing -_LIT8( KSConXmlDocBegin, - "\n\n ]>\n\n" ); -_LIT8( KSConXmlParentFolder, " \n" ); -_LIT8( KSConXmlFileNameBegin," \n" ); -_LIT8( KSConXmlFolderListEnd,"" ); -_LIT8( KSConDriveCName,"C:" ); -_LIT8( KSConDriveZName,"Z:" ); -_LIT8( KSConFolderListType, "x-obex/folder-listing" ); - -const TInt KSConMemTypeMaxLength = 5; -_LIT8( KSConMemoryTypeDev, "DEV" ); // prefix for device memory -_LIT8( KSConMemoryTypeMmc, "MMC" ); // prefix for MMC memory - -// Date field format -_LIT( KSConXmlDate, "%F%Y%M%DT%H%T%SZ" ); -const TInt KSConDateMaxLength = 16; - -//File extensions -_LIT( KSConEpocWordExt, ".ewd" ); -_LIT( KSConEpocSheetExt, ".sht" ); - -_LIT8( KFind1,"&" ); -_LIT8( KReplace1, "&" ); -_LIT8( KReplace2, "<" ); -_LIT8( KReplace3, ">" ); -_LIT8( KReplace4, """ ); -_LIT8( KReplace5, "'" ); - -_LIT( KSConResourceName, "z:\\Resource\\sconftp.rsc" ); - -const TInt KSConBufSize = 1024; -const TInt KSConSetPathDontCreate = 0x01; // Flags used to indicate SetPath commands -const TInt KSConSetPathRoot = 0x02; // Flags used to indicate SetPath commands -const TInt KSConSetPathForward = 0x02; // Flags used to indicate SetPath commands -const TInt KSConSetPathBack = 0x03; // Flags used to indicate SetPath commands -const TInt KSConXmlBufSize = 30; -const TInt KSConDriveNameLength = 2; -const TInt KSConMaxMimeTypeLength = 25; -const TInt KSConBufferSize = 262144; // 256KB - -const TUid KSConSheetUid = { 0x10003a7d }; // Sheet document uid -const TUid KSConWordUid = { 0x10003a64 }; // Word document uid - -const TInt KDriveLength = 3; - -#endif - diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/services/ftp/inc/sconfshandler.h --- a/connectivitymodules/SeCon/services/ftp/inc/sconfshandler.h Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,172 +0,0 @@ -/* -* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: CSConFSHandler header file -* -*/ - - -#ifndef _SCONFSHANDLER_H_ -#define _SCONFSHANDLER_H_ - -// INCLUDES - -#include -#include - - -// FORWARD DECLARATIONS -class CDirectoryLocalizer; - - -//============================================================ -// Class CSConFsHandler declaration -//============================================================ -NONSHARABLE_CLASS( CSConFsHandler ) : public CBase - { - public: - static CSConFsHandler* NewL( RFs& aFs ); - ~CSConFsHandler(); - /** - * Parses folder and file listing from specified directory - * @param aBuffer Buffer to store the folder list - * @param aPathName Folder path - * @param aMemNumber memory number (1= DEV or MMC, 2= DEV2 or MMC2..) - * @return KErrNone if no errors, else system wide error codes. - */ - TInt ParseFolderListL( CBufFlat* aBuffer, const TPtrC aPathName, - const TInt aMemNumber ); - /** - * Gets a file object - * @param aBuffer CObexFileObject object where the file will be stored - * @param aPathName The path of the file - * @param aFileName The name of the file - * @return KErrNone if no errors, else system wide error codes. - */ - TInt GetFileObjectL( CObexFileObject*& aBuffer, const TPtrC aPathName, - const TPtrC aFileName ); - /** - * Stores a file object - * @param aFullPathName The full path and name of the file - * @param aTime The time stamp of the file - * @param aTempFileName Data temp file - * @return KErrNone if no errors, else system wide error codes. - */ - TInt SaveFileObjectL( const TPtrC aFullPathName, const TTime aTime, - const TPtrC aTempFileName ); - /** - * Validates the file name - * @param aName File name to be validated - * @return KErrNone if no errors, else system wide error codes. - */ - TInt ValidateFileName( const TPtrC aName ); - /** - * Creates a folder - * @param aFolderPath The name and the path of the folder - * @return KErrNone if no errors, else system wide error codes. - */ - TInt CreateFolderL( const TPtrC aFolderPath ); - /** - * Removes a folder or a file - * @param aFullPath The path and name of the object - * @return KErrNone if no errors, else system wide error codes. - */ - TInt DeleteObjectL( const TPtrC aFullPath ); - - /** - * Copy or Move file/folder - * @param aSource - * @param aTarget - * @param aUseCopyCommand if ETrue does copy, else does move. - * @return none. - */ - void DoCopyOrMoveFileL( const TDesC& aSource, const TDesC& aTarget, - const TBool aUseCopyCommand ); - - /** - * Check if folder can be showed - * @param aFullPath The path of the object - * @return ETrue if folder exists and can be showed. - */ - TBool IsFolderVisible( const TDesC& aFullPath ); - - private: - CSConFsHandler( RFs& aFs ); - void ConstructL(); - /** - * Updates the name of the data folder from a localized string - * @param none - * @return none - */ - void GetDataPathNameL(); - - /** - * Check if folder is read only - * @param aFullPath The path of the object - * @return ETrue if folder is read only, or if folder does not exist - */ - TBool IsFolderReadOnly( const TDesC& aFullPath ) const; - /** - * Check if folder can be deleted - * @param aFullPath The path of the object - * @return ETrue if folder can be deleted - */ - TBool IsFolderDeletable( const TDesC& aFullPath ) const; - /** - * Get parent folder - * @param aFullPath The folder full path with or without backlash ending - * @param aParent The founded parent folder with backlash - * @return KErrNone if parent folder founded - */ - TInt GetParentFolder( const TDesC& aFullPath, TDes& aParent); - - /** - * Get folder (and subfolders) size - * @param aFullPath The folder full path with backlash ending - * @return folder total size - */ - TInt64 GetFolderSizeL( const TDesC& aFullPath ); - - /** - * Replaces all special characters to xml compliant ones - * @param aDes characters to be checked and replaced - */ - void ReplaceSpecialChars( TDes8& aDes ); - - /** - * Check if folder is exluded and cannot be shown to user - * @param aFullPath The full path with backlash ending - * @return ETrue if folder is exluded - */ - TBool IsExludedPath( const TDesC& aFullPath ) const; - - /** - * Prints folder information to obex-folder-list - */ - void PrintFolderL( CBufFlat* aBuffer, TInt& aOffset, const TDesC& aParentPath, - const TDesC8& aMemType, const TEntry& aFolderEntry ); - /** - * Prints file information to obex-folder-list - */ - void PrintFileL( CBufFlat* aBuffer, TInt& aOffset, const TEntry& aFileEntry ); - - private: - RFs& iFs; // not own - CDirectoryLocalizer* iLocalizer; - TBuf8 iDataPathName; // Localized data path - }; - -#endif - -// End of file - diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/services/ftp/inc/sconftp.h --- a/connectivitymodules/SeCon/services/ftp/inc/sconftp.h Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,261 +0,0 @@ -/* -* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: CSConFTP header file -* -*/ - - -#ifndef _SCONFTP_H_ -#define _SCONFTP_H_ - -// INCLUDES - -#include -#include - -#include "sconconstants.h" - -class CSConInboxHandler; -class CSConFsHandler; - -//============================================================ -// Class CSConFTP declaration -//============================================================ -class CSConFTP : public CBase - { - public: - // construct / destruct - static CSConFTP* NewL(); - ~CSConFTP(); - - // methods - /** - * Gets object that contains folder listing from inbox or file system - * @param aObject CObexBufObject object - * @return KErrNone if no errors, else system wide error codes. - */ - virtual TInt GetFolderObjectL( CObexBufObject*& aObject ); - - /** - * Gets object that contains a file from file system - * @param aFileObject CObexFileObject object - * @return KErrNone if no errors, else system wide error codes. - */ - virtual TInt GetFileObjectL( CObexFileObject*& aFileObject ); - - /** - * Initializes the receiving from the client. - * @param aObject CObexBufObject object - * @param aObject CBufFlat object - * @return KErrNone if no error, else system wide error codes. - */ - virtual TInt PutFileObjectInitL( CObexBufObject*& aObject, - CBufFlat*& aBuffer ); - - /** - * Stores the relayed file object to inbox or file system. - * @param aObject CObexBufObject object - * @return KErrNone if no error, else system wide error codes. - */ - virtual TInt PutFileObjectFinalizeL( CObexBufObject*& aObject ); - - /** - * Changes the current path. The path can point to inbox or file system - * @param aPathName The name of the new path - * @param aFlags Flag value of OBEX Setpath operation - * @return KErrNone if no error, else system wide error codes. - */ - virtual TInt SetPathL( const TPtrC aPathName, const TUint8 aFlags ); - - /** - * Creates a new folder to file system - * @param aFolderName The name of the folder to be created - * @return KErrNone if no error, else system wide error codes. - */ - virtual TInt CreateFolderL( const TPtrC aFolderName ); - - /** - * Deletes file/folder from inbox or file system - * @param aObjectName The name of the object (file or folder) to be created - * @return KErrNone if no error, else system wide error codes. - */ - virtual TInt DeleteObjectL( const TPtrC aObjectName ); - - /** - * Gets the current path - * @param aPath The name of the current path - * @return KErrNone if no error, else system wide error codes. - */ - virtual TInt GetPath( TDes& aPath ); - - /** - * Abort file transfer - * @param aObject The OBEX stack object which will reseted - * @return KErrNone if no error, else system wide error codes. - */ - virtual TInt AbortFileTransfer( CObexBufObject*& aObject ); - - /** - * Set used transfer profile - * @param aProfile The profile id - * @return none - */ - virtual void SetProfile( TSConProfile aProfile ); - - /** - * Set backup status - * @param aValue Is backup started or not - * @return none - */ - virtual void SetBackupStarted( TBool aValue ); - - /** - * Set the used media information - * @param aMedia The media which is currently used - * @return none - */ - virtual void SetUsedMedia( TSConUsedMedia aMedia ); - - /** - * Check is current drive space below critical level - * @param aFilesize, additional free space needed - * @return ETrue if below critical - */ - virtual TBool IsCurrentDiskSpaceBelowCritical( TUint32 aFilesize = 0 ); - - /** - * Read received ConML protocol packet - * @param aBuffer The buffer for the data - * @return KErrNone if no error, else system wide error codes. - */ - virtual TInt ReadWBXMLDataL( CBufFlat*& aBuffer ); - - /** - * Delete OBEX stack's temp file - * @param none - * @return KErrNone if no error, else system wide error codes. - */ - virtual void DeleteTempFile(); - - /** - * Move or rename file/folder - * @param aSource - * @param aTarget - * @return KErrNone if no error, else system wide error codes. - */ - virtual TInt MoveFile( const TDesC& aSource, const TDesC& aTarget ); - - /** - * Copy file/folder - * @param aSource - * @param aTarget - * @return KErrNone if no error, else system wide error codes. - */ - virtual TInt CopyFile( const TDesC& aSource, const TDesC& aTarget ); - - /** - * Set read-only attribute to file or folder - * @param aTarget file or folder fullname - * @param aReadOnly set read-only permission to ETrue or EFalse - * @return KErrNone if no error, else system wide error codes. - */ - virtual TInt SetReadOnly( const TDesC& aTarget, const TBool aReadOnly ); - - /** - * Set hidden attribute to file or folder - * @param aTarget file or folder fullname - * @param aHidden set read-only permission to ETrue or EFalse - * @return KErrNone if no error, else system wide error codes. - */ - virtual TInt SetHidden( const TDesC& aTarget, const TBool aHidden ); - - private: - // methods - /** - * Get absolute path from given relative foldername - * @param aFolderName relative or absolute filename - * @param aFullPath return absolete path of file/folder - * @return KErrNone if no error, else system wide error codes. - */ - virtual TInt GetAbsolutePath( const TDesC& aFolderName, TDes& aFullPath ); - - /** - * Checks if user can see/access to the drive - * @param aDriveNumber drive to be tested - * @return ETrue if user can see drive. - */ - TBool IsDriveVisible( const TInt aDriveNumber ); - - /** - * Checks if user access to the current volume - * @param none - * @return ETrue if volume is ok. - */ - TBool IsCurrentVolumeOK(); - - /** - * Go to (sub)directory - * @param aPath (sub)directory - * @param aFlags used to check if new folder(s) should be created - * @return KErrNone if no error, else system wide error codes. - */ - TInt SetPathForwardL( const TPtrC aPath, const TUint8 aFlags ); - - /** - * Go to parent directory - * @param aPath subdirectory under parent (additional) - * @return KErrNone if no error, else system wide error codes. - */ - TInt SetPathBackwardL( const TPtrC aPath ); - - /** - * Get volume name (Memory card name) - * @param aDriveNumber drive where to read - * @param aVolumeName if name found return volume name, else localised string - * @return KErrNone if no error, else system wide error codes. - */ - TInt GetVolumeNameL(const TInt aDriveNumber, TDes8& aVolumeName); - - /** - * Updates drive information (iCurrentDrive and iCurrentDriveTypeNumber) - * @param none - * @return none, leaves if error occurs. - */ - void UpdateDriveTypeInfoL(); - - CSConFTP(); - virtual void ConstructL(); - - private: - CSConInboxHandler* iSConInboxHandler; // Object saving-fetching - CBufFlat* iBuffer; // Temporary buffer - CSConFsHandler* iSConFsHandler; // Object saving-fetching - TBuf iPathName; // Path - TFileName iTempFileName; // Temp file name - RFs iFs; - TSConProfile iProfile; // Used profile - TBool iBackupStarted; - TSConUsedMedia iMedia; - TInt iCurrentDrive; - TInt iCurrentDriveTypeNumber; // DEV=1, DEV2=2, MMC=1, MMC2=2. - TInt iCriticalDiskLevel; - }; - - IMPORT_C CSConFTP* CreateCSConFTPL(); - typedef CSConFTP* (*TSConCreateCSConFTPFunc) (); - - -#endif // SCONFTP - -// End of file diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/services/ftp/inc/sconinboxhandler.h --- a/connectivitymodules/SeCon/services/ftp/inc/sconinboxhandler.h Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,84 +0,0 @@ -/* -* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: CSConInboxHandler header file -* -*/ - - -#ifndef _SCONINBOXHANDLER_H_ -#define _SCONINBOXHANDLER_H_ - -// INCLUDES - -#include -#include -#include - - -//============================================================ -// Class CSConInboxHandler declaration -//============================================================ -NONSHARABLE_CLASS( CSConInboxHandler ) : public CBase, MMsvSessionObserver - { - public: - static CSConInboxHandler* NewL(); - virtual ~CSConInboxHandler(); - - /** - * Creates an attachment to device's Inbox - * @param aObject CObexBufObject object - * @return KErrNone if no errors, else system wide error codes. - */ - TInt CreateInboxAttachmentL( CObexBufObject*& aObject, - CBufFlat*& aBuffer ); - /** - * Saves the object to the Inbox - * @param aObject CObexBufObject object - * @return KErrNone if no errors, else system wide error codes. - */ - TInt SaveObjToInboxL( CObexBufObject*& aObject ); - /** - * Aborts the storing operation - * @param aObject CObexBufObject object - * @return KErrNone if no errors, else system wide error codes. - */ - TInt AbortInboxOperation( CObexBufObject*& aObject ); - /** - * Implementation of MMsvSessionObserver::HandleSessionEventL - * @param aEvent Indicates the event type. - * @param aArg1 Event type-specific argument value - * @param aArg2 Event type-specific argument value - * @param aArg3 Event type-specific argument value - * @return none - */ - void HandleSessionEventL( TMsvSessionEvent aEvent, - TAny* aArg1, - TAny* aArg2, - TAny* aArg3 ); - - private: - CSConInboxHandler(); - - TInt GetMessageCenterDriveL(); - - private: - TInt iDrive; - TMsvId iMsvIdParent; - TMsvId iMsvIdAttach; - RFile iFile; -}; - -#endif - -// End of file diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/services/ftp/loc/sconftp.loc --- a/connectivitymodules/SeCon/services/ftp/loc/sconftp.loc Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +0,0 @@ -/* -* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Localization file for csconftp -* -*/ - - -//d:Default name for device -//l:list_double_pane_t2_cp2 -#define qtn_secon_device "Phone" - -//d:Default name for memory card -//l:list_double_pane_t2_cp2 -#define qtn_secon_mmc "Memory card" - -//d:Default name for mass storage -//l:None -//r:3.2 -#define qtn_secon_mass_storage "Mass memory" - -//d:Default name for data folder -//l:None -//r:3.2 -#define qtn_secon_data_folder "Personal files" - -// d: Value in a PC Suite dialog showing program details -// l: None -// r: 3.2 -#define qtn_secon_unknown_supplier "Unknown" diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/services/ftp/src/sconfshandler.cpp --- a/connectivitymodules/SeCon/services/ftp/src/sconfshandler.cpp Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1497 +0,0 @@ -/* -* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: File Transfer Controller implementation -* -*/ - - -// INCLUDE FILES -#include -#include -#include -#include // to get backup/restore mode -#include -#include -#include -#include - -#include "sconfshandler.h" -#include "sconconsts.h" -#include "irmcconsts.h" -#include "cntparserclient.h" -#include "cntparserinfolog.h" -#include "debug.h" - -_LIT(KPhoneBookIrMCL2Request,"telecom/pb.vcf"); -_LIT(KInfoLogIrMCL2Request,"telecom/pb/info.log"); -_LIT(KInfoLogIrMCL2File,"IrMC\\info.log"); -_LIT(KInfoLogPathAndFileName,"c:\\IrMC\\info.log"); -_LIT(KPbPathAndFileName,"c:\\IrMC\\pb.vcf"); - -// ============================= MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CSConFsHandler::NewL() -// Two-phase constructor -// ----------------------------------------------------------------------------- -// -CSConFsHandler* CSConFsHandler::NewL( RFs& aFs ) - { - TRACE_FUNC_ENTRY; - CSConFsHandler* self = new (ELeave) CSConFsHandler( aFs ); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - TRACE_FUNC_EXIT; - return self; - } - -// ----------------------------------------------------------------------------- -// CSConFsHandler::~CSConFsHandler() -// Destructor -// ----------------------------------------------------------------------------- -// -CSConFsHandler::~CSConFsHandler() - { - TRACE_FUNC_ENTRY; - delete iLocalizer; - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConFsHandler::ParseFolderListL( CBufFlat* aBuffer, const TPtrC aPathName -// , const TInt aMemNumber ) -// Parses folder and file listing from specified directory -// ----------------------------------------------------------------------------- -// -TInt CSConFsHandler::ParseFolderListL( CBufFlat* aBuffer, const TPtrC aPathName, - const TInt aMemNumber ) - { - TRACE_FUNC_ENTRY; - LOGGER_WRITE_1( "CSConFsHandler::ParseFolderListL aPathName = %S", &aPathName ); - if( aPathName.Length() == 0 ) - { - LOGGER_WRITE( "CSConFsHandler::ParseFolderListL( CBufFlat* aBuffer, const TPtrC aPathName ) : No path" ); - return KErrArgument; - } - - if( aPathName.Length() > KDriveLength && !BaflUtils::FolderExists( iFs, aPathName ) ) - { - LOGGER_WRITE( "CSConFsHandler::ParseFolderListL( CBufFlat* aBuffer, const TPtrC aPathName ) : Current folder doesn't exist any more" ); - return KErrNotFound; - } - - TInt driveNumber; - TInt err = iFs.CharToDrive(aPathName[0], driveNumber); - if( err ) - { - LOGGER_WRITE_1( "CSConFsHandler::ParseFolderListL : CharToDrive err: %d", err ); - return KErrNotFound; - } - TUint driveStatus; - err = DriveInfo::GetDriveStatus( iFs, driveNumber, driveStatus); - if( err ) - { - LOGGER_WRITE_1( "CSConFsHandler::ParseFolderListL : DriveInfo::GetDriveStatus err: %d", err ); - return KErrNotFound; - } - - // check mem type (DEV, DEV2, MMC, MMC2..) - TBuf8 memType; - if( driveStatus & DriveInfo::EDriveInternal ) - { - memType.Copy( KSConMemoryTypeDev ); - if( aMemNumber > 1 ) - { - memType.AppendNum(aMemNumber); - } - } - else if( driveStatus & DriveInfo::EDriveRemovable ) - { - memType.Copy( KSConMemoryTypeMmc ); - if( aMemNumber > 1 ) - { - memType.AppendNum(aMemNumber); - } - } - - CDir *entryList = 0; - CDir *dirList = 0; - - // show only normal files and folders - TUint entryAttMask = KEntryAttNormal; - - - // get folders and files - err = iFs.GetDir( aPathName, entryAttMask, ESortByName, - entryList, dirList ); - - if ( err ) - { - LOGGER_WRITE_1( "ParseFolderListL GetDir returned: %d", err ); - return err; - } - - CleanupStack::PushL( entryList ); - CleanupStack::PushL( dirList ); - - TInt offset = 0; - - LOGGER_WRITE( "CSConFsHandler::ParseFolderList XML creation" ); - //Create folder XML - aBuffer->ResizeL( KSConXmlDocBegin().Length() ); - aBuffer->Write( offset, KSConXmlDocBegin ); - offset += KSConXmlDocBegin().Length(); - - aBuffer->ExpandL( offset, KSConXmlParentFolder().Length() ); - aBuffer->Write( offset, KSConXmlParentFolder ); - offset += KSConXmlParentFolder().Length(); - - HBufC* fullNameBuf = HBufC::NewLC( KMaxPath ); - TPtr fullName = fullNameBuf->Des(); - - // Print folders to folder listing object - for( TInt i = 0; i < dirList->Count(); i++ ) - { - const TEntry entry = ( *dirList )[i]; - - fullName.Copy( aPathName ); - fullName.Append( entry.iName ); - fullName.Append( KPathDelimiter ); - - // show path if not exluded - TBool proceed = !IsExludedPath( fullName ); - if ( proceed ) - { - PrintFolderL( aBuffer, offset, fullName, memType, entry ); - } - } - CleanupStack::PopAndDestroy( fullNameBuf ); - CleanupStack::PopAndDestroy( dirList ); - - LOGGER_WRITE("Print files"); - // Print files to folder listing object - for( TInt j = 0; j < entryList->Count(); j++ ) - { - const TEntry entry = ( *entryList )[j]; - PrintFileL( aBuffer, offset, entry ); - } - LOGGER_WRITE("files printed"); - //Write the end of XML - aBuffer->ExpandL( offset, KSConXmlFolderListEnd().Length() ); - aBuffer->Write( offset, KSConXmlFolderListEnd ); - aBuffer->Compress(); - - CleanupStack::PopAndDestroy( entryList ); - - LOGGER_WRITE_1( "CSConFsHandler::ParseFolderListL() : returned %d", err ); - return err; - } - - -// ----------------------------------------------------------------------------- -// CSConFsHandler::PrintFolderL -// Prints folder entry to folder listing object -// ----------------------------------------------------------------------------- -// -void CSConFsHandler::PrintFolderL( CBufFlat* aBuffer, TInt& aOffset, const TDesC& aFullPath, - const TDesC8& aMemType, const TEntry& aFolderEntry ) - { - TRACE_FUNC_ENTRY; - // initialize Localizer - iLocalizer->SetFullPath( aFullPath ); - - TBool dataPath( EFalse ); - if ( aFullPath.CompareF( PathInfo::PhoneMemoryRootPath() ) == 0 ) // datapath - { - // printable folder is C:\Data (Localized) - dataPath = ETrue; - } - - // print foldername - aBuffer->ExpandL( aOffset, KSConXmlFolderNameBegin().Length() ); - aBuffer->Write( aOffset, KSConXmlFolderNameBegin ); - aOffset += KSConXmlFolderNameBegin().Length(); - - HBufC8* folderBuf = HBufC8::NewLC( KMaxFileName ); - TPtr8 folderName = folderBuf->Des(); - User::LeaveIfError( - CnvUtfConverter::ConvertFromUnicodeToUtf8( folderName, aFolderEntry.iName ) ); - - //Replace special characters - ReplaceSpecialChars( folderName ); - - aBuffer->ExpandL( aOffset, folderName.Length() ); - aBuffer->Write( aOffset, folderName ); - aOffset += folderName.Length(); - - CleanupStack::PopAndDestroy( folderBuf ); - - // print modified time - TBuf modifiedTime; - TTime time = aFolderEntry.iModified; - time.FormatL( modifiedTime, KSConXmlDate ); - - TBuf8 modifiedTime8; - User::LeaveIfError( - CnvUtfConverter::ConvertFromUnicodeToUtf8( modifiedTime8, modifiedTime ) ); - - aBuffer->ExpandL( aOffset, KSConXmlModified().Length() ); - aBuffer->Write( aOffset, KSConXmlModified ); - aOffset += KSConXmlModified().Length(); - - aBuffer->ExpandL( aOffset, modifiedTime8.Length() ); - aBuffer->Write( aOffset, modifiedTime8 ); - aOffset += modifiedTime8.Length(); - - // print attributes - aBuffer->ExpandL( aOffset, KSConXmlUserAttributes().Length() ); - aBuffer->Write( aOffset, KSConXmlUserAttributes ); - aOffset += KSConXmlUserAttributes().Length(); - - // Add user-perm info - if( aFolderEntry.IsReadOnly() ) - { - aBuffer->ExpandL( aOffset, - KSConXmlUserEntryReadOnly().Length() ); - aBuffer->Write( aOffset, KSConXmlUserEntryReadOnly ); - aOffset += KSConXmlUserEntryReadOnly().Length(); - } - else if( iLocalizer->IsLocalized() || dataPath ) // delete disabled - { - aBuffer->ExpandL( aOffset, - KSConXmlUserEntryDrive().Length() ); - aBuffer->Write( aOffset, KSConXmlUserEntryDrive ); - aOffset += KSConXmlUserEntryDrive().Length(); - } - else - { - aBuffer->ExpandL( aOffset, - KSConXmlUserEntryArchive().Length() ); - aBuffer->Write( aOffset, KSConXmlUserEntryArchive ); - aOffset += KSConXmlUserEntryArchive().Length(); - } - - - // print memory type - aBuffer->ExpandL( aOffset, KSConXmlMemoryType().Length() ); - aBuffer->Write( aOffset, KSConXmlMemoryType ); - aOffset += KSConXmlMemoryType().Length(); - - aBuffer->ExpandL( aOffset, aMemType.Length() ); - aBuffer->Write( aOffset, aMemType ); - aOffset += aMemType.Length(); - - // print label if exists - if( iLocalizer->IsLocalized() ) - { - //get localized folder name - HBufC8* labelBuf = - CnvUtfConverter::ConvertFromUnicodeToUtf8L( iLocalizer->LocalizedName() ); - CleanupStack::PushL( labelBuf ); - TPtrC8 label = labelBuf->Des(); - //memory label - aBuffer->ExpandL( aOffset, - KSConXmlMemoryLabel().Length() ); - aBuffer->Write( aOffset, KSConXmlMemoryLabel ); - aOffset += KSConXmlMemoryLabel().Length(); - - aBuffer->ExpandL( aOffset, label.Length() ); - aBuffer->Write( aOffset, label ); - aOffset += label.Length(); - - CleanupStack::PopAndDestroy( labelBuf ); - } - if ( dataPath ) // datapath - { - //memory label - aBuffer->ExpandL( aOffset, - KSConXmlMemoryLabel().Length() ); - aBuffer->Write( aOffset, KSConXmlMemoryLabel ); - aOffset += KSConXmlMemoryLabel().Length(); - - aBuffer->ExpandL( aOffset, iDataPathName.Length() ); - aBuffer->Write( aOffset, iDataPathName ); - aOffset += iDataPathName.Length(); - } - // print ending - aBuffer->ExpandL( aOffset, KSConXmlFileEnd().Length() ); - aBuffer->Write( aOffset, KSConXmlFileEnd ); - aOffset += KSConXmlFileEnd().Length(); - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConFsHandler::PrintFileL -// Prints file entry to folder listing object -// ----------------------------------------------------------------------------- -// -void CSConFsHandler::PrintFileL( CBufFlat* aBuffer, TInt& aOffset, const TEntry& aFileEntry ) - { - LOGGER_WRITE_1("CSConFsHandler::PrintFileL, filename: %S", &aFileEntry.iName ); - HBufC8* fileBuf = HBufC8::NewLC( KMaxFileName ); - TPtr8 fileName = fileBuf->Des(); - - User::LeaveIfError( - CnvUtfConverter::ConvertFromUnicodeToUtf8( fileName, aFileEntry.iName ) ); - - //Replace special characters - ReplaceSpecialChars( fileName ); - - // print filename - aBuffer->ExpandL( aOffset, KSConXmlFileNameBegin().Length() ); - aBuffer->Write( aOffset, KSConXmlFileNameBegin ); - aOffset += KSConXmlFileNameBegin().Length(); - - aBuffer->ExpandL( aOffset, fileName.Length() ); - aBuffer->Write( aOffset, fileName ); - aOffset += fileName.Length(); - - // print size - aBuffer->ExpandL( aOffset, KSConXmlSize().Length() ); - aBuffer->Write( aOffset, KSConXmlSize ); - aOffset += KSConXmlSize().Length(); - - fileName.Delete( 0, fileName.Length() ); // re-use fileName descriptor - fileName.AppendNum( aFileEntry.iSize ); - aBuffer->ExpandL( aOffset, fileName.Length() ); - aBuffer->Write( aOffset, fileName ); - aOffset += fileName.Length(); - - CleanupStack::PopAndDestroy( fileBuf ); - - // print modified - TBuf modifiedTime; - TTime time = aFileEntry.iModified; - time.FormatL( modifiedTime, KSConXmlDate ); - - TBuf8 modifiedTime8; - User::LeaveIfError( - CnvUtfConverter::ConvertFromUnicodeToUtf8( modifiedTime8, modifiedTime ) ); - - - aBuffer->ExpandL( aOffset, KSConXmlModified().Length() ); - aBuffer->Write( aOffset, KSConXmlModified ); - aOffset += KSConXmlModified().Length(); - - aBuffer->ExpandL( aOffset, modifiedTime8.Length() ); - aBuffer->Write( aOffset, modifiedTime8 ); - aOffset += modifiedTime8.Length(); - - // attributes - aBuffer->ExpandL( aOffset, KSConXmlUserAttributes().Length() ); - aBuffer->Write( aOffset, KSConXmlUserAttributes ); - aOffset += KSConXmlUserAttributes().Length(); - - if( aFileEntry.IsSystem() ) - { - aBuffer->ExpandL( aOffset, - KSConXmlUserEntryReadOnly().Length() ); - aBuffer->Write( aOffset, KSConXmlUserEntryReadOnly ); - aOffset += KSConXmlUserEntryReadOnly().Length(); - } - else if( aFileEntry.IsReadOnly() ) - { - LOGGER_WRITE("was readonly" ); - aBuffer->ExpandL( aOffset, - KSConXmlUserEntryReadOnly().Length() ); - aBuffer->Write( aOffset, KSConXmlUserEntryReadOnly ); - aOffset += KSConXmlUserEntryReadOnly().Length(); - } - else - { - aBuffer->ExpandL( aOffset, - KSConXmlUserEntryArchive().Length() ); - aBuffer->Write( aOffset, KSConXmlUserEntryArchive ); - aOffset += KSConXmlUserEntryArchive().Length(); - } - - - //Word document - if ( aFileEntry.iType.IsPresent( KSConWordUid ) || - aFileEntry.iName.Find( KSConEpocWordExt ) == aFileEntry.iName.Length() - 4 ) - { - aBuffer->ExpandL( aOffset, KSConXmlType().Length() ); - aBuffer->Write( aOffset, KSConXmlType ); - aOffset += KSConXmlType().Length(); - - aBuffer->ExpandL( aOffset, KSConXmlTypeWord().Length() ); - aBuffer->Write( aOffset, KSConXmlTypeWord ); - aOffset += KSConXmlTypeWord().Length(); - } - //Sheet document - else if ( aFileEntry.iType.IsPresent( KSConSheetUid ) || - aFileEntry.iName.Find( KSConEpocSheetExt ) == aFileEntry.iName.Length() - 4 ) - { - aBuffer->ExpandL( aOffset, KSConXmlType().Length() ); - aBuffer->Write( aOffset, KSConXmlType ); - aOffset += KSConXmlType().Length(); - - aBuffer->ExpandL( aOffset, KSConXmlTypeSheet().Length() ); - aBuffer->Write( aOffset, KSConXmlTypeSheet ); - aOffset += KSConXmlTypeSheet().Length(); - } - - aBuffer->ExpandL( aOffset, KSConXmlFileEnd().Length() ); - aBuffer->Write( aOffset, KSConXmlFileEnd ); - aOffset += KSConXmlFileEnd().Length(); - } - -// ----------------------------------------------------------------------------- -// CSConFsHandler::GetFileObjectL( CObexFileObject*& aFileObject, -// const TPtrC aPathName, const TPtrC aFileName ) -// Gets a file object -// ----------------------------------------------------------------------------- -// -TInt CSConFsHandler::GetFileObjectL( CObexFileObject*& aFileObject, - const TPtrC aPathName, const TPtrC aFileName ) - { - TRACE_FUNC_ENTRY; - LOGGER_WRITE_2( "CSConFsHandler::GetFileObjectL aFileName = %S aPathName = %S", &aFileName, &aPathName ); - - TInt ret( KErrNone ); - - if( ( aPathName.Length() == 0 || aFileName.Length() == 0 ) && - !( aFileName==KPhoneBookIrMCL2Request || - aFileName==KInfoLogIrMCL2Request ) ) - { - return KErrArgument; - } - - if( aPathName.Length() + aFileName.Length() > KMaxFileName ) - { - return KErrAbort; - } - - HBufC* pathBuf = HBufC::NewLC( KMaxFileName ); - TPtr pathBufPtr = pathBuf->Des(); - - /*These modifiactions are mean to catch an IrMC L2 request. - If the request is made, then the requested phonebook file and - info log -file are created. Path and filename is also changed - to point to these created files.*/ - if( aFileName == KPhoneBookIrMCL2Request || - aFileName == KInfoLogIrMCL2Request ) - { - LOGGER_WRITE( "CSConFsHandler: IrMC L2 request!" ); - TInt err; - TInt status; - TInt contactsSaved = 0; - RCntParserServer cntParserServer; - - err = cntParserServer.Connect(); - if( err != KErrNone ) - { - LOGGER_WRITE( "CSConFsHandler: Cannot connect to the cntparserserver, ABORT!" ); - - CleanupStack::PopAndDestroy( pathBuf ); - return KErrAbort; - } - - LOGGER_WRITE( "CSConFsHandler: Time to call CreateIrMCL2PhoneBook" ); - TBool force = ( aFileName == KInfoLogIrMCL2Request ); - status=cntParserServer.CreateIrMCL2PhoneBook( KMaximumNumberOfContacts, - force ); - LOGGER_WRITE_1( "CntParserServer.CreateIrMCL2PhoneBook returned %d", status ); - - //Check how many vcards were saved - contactsSaved = cntParserServer.ContactsSaved(); - LOGGER_WRITE_1( "CntParserServer.ContactsSaved returned %d", contactsSaved ); - - err = cntParserServer.Disconnect(); - LOGGER_WRITE_1( "CntParserServer.Disconnect() %d", err ); - if( err != KErrNone ) - { - CleanupStack::PopAndDestroy( pathBuf ); - return KErrAbort; - } - //save info.log, if pb.vcf has changed (Note: KPBNotUpdated is returned - // if no changes made to pb.vcf) - if( status == KErrNone ) - { - LOGGER_WRITE( "CSConFsHandler: Create info.log" ); - - CCntParserInfoLog* infoLog=CCntParserInfoLog::NewL(); - CleanupStack::PushL( infoLog ); - //see KMaximumNumberOfContacts for more details - infoLog->SetMaximumRecords( contactsSaved ); - infoLog->SetTotalRecords( contactsSaved ); - TFileName privatepath( K_C_ROOT ); - privatepath.Append( KInfoLogIrMCL2File ); - infoLog->SaveToFileL( privatepath ); - CleanupStack::PopAndDestroy( infoLog ); - } - - if( aFileName == KInfoLogIrMCL2Request ) - { - //Changes filename and path to info.log - pathBufPtr.Copy( KInfoLogPathAndFileName ); - } - else - { - //Changes filename and path to pb.vcf - pathBufPtr.Copy( KPbPathAndFileName ); - } - } - else - { - pathBufPtr.Copy( aPathName ); - pathBufPtr.Append( aFileName ); - } - - LOGGER_WRITE( "CSConFsHandler::GetFileObjectL() : aFileObject->InitFromFileL( pathBufPtr )" ); - TRAP( ret, aFileObject->InitFromFileL( pathBufPtr ) ); - LOGGER_WRITE( "CSConFsHandler::GetFileObjectL() : aFileObject->InitFromFileL( pathBufPtr ) ok" ); - - CleanupStack::PopAndDestroy( pathBuf ); - - LOGGER_WRITE_1( "CSConFsHandler::GetFileObjectL( CObexFileObject*& aFileObject, const TPtrC aPathName, const TPtrC aFileName ) : returned %d", ret ); - return ret; - } - -// ----------------------------------------------------------------------------- -// CSConFsHandler::SaveFileObjectL( const TPtrC aFullPathName, const TTime aTime, -// const TPtrC aTempFileName ) -// Stores a file object -// ----------------------------------------------------------------------------- -// -TInt CSConFsHandler::SaveFileObjectL( const TPtrC aFullPathName, - const TTime aTime, const TPtrC aTempFileName ) - { - TRACE_FUNC_ENTRY; - LOGGER_WRITE_2( "CSConFsHandler::SaveFileObjectL aFullPathName = %S aTempFileName = %S", &aFullPathName, &aTempFileName ); - - TInt ret( KErrNone ); - - if( aFullPathName.Length() == 0 ) - { - iFs.Delete( aTempFileName ); - return KErrPathNotFound; - } - - ret = ValidateFileName( aFullPathName ); - - if( ret == KErrNone ) - { - TUint attr; - TInt err = iFs.Att( BaflUtils::DriveAndPathFromFullName(aFullPathName), attr ); - if ( err == KErrNone && attr & KEntryAttReadOnly ) - { - // folder is read only, permission denied - iFs.Delete( aTempFileName ); - ret = KErrAccessDenied; - } - else if( !BaflUtils::FileExists( iFs, aFullPathName ) ) - { - // file does not exist, rename. - ret = iFs.Rename( aTempFileName, aFullPathName ); - - if( ret == KErrNone ) - { - ret = iFs.SetModified( aFullPathName, aTime ); - ret = KErrNone; - } - else - { - iFs.Delete( aTempFileName ); - } - } - else - { - LOGGER_WRITE( "CSConFsHandler::SaveFileObjectL() file exists. replace" ); - // file exists. Replace if not read-only file. - TUint attr; - ret = iFs.Att( aFullPathName, attr ); - // Check permissions - if( ret == KErrNone && ( attr == KEntryAttNormal || - attr == KEntryAttArchive ) && !(attr & KEntryAttReadOnly) ) - { - ret = iFs.Replace( aTempFileName, aFullPathName ); - LOGGER_WRITE_1( "CSConFsHandler::SaveFileObjectL() iFs.Replace ret %d", ret); - //Set correct time stamp - if( ret == KErrNone ) - { - ret = iFs.SetModified( aFullPathName, aTime ); - ret = KErrNone; - } - else - { - iFs.Delete( aTempFileName ); - } - } - else - { - LOGGER_WRITE( "CSConFsHandler::SaveFileObjectL() no permissions" ); - iFs.Delete( aTempFileName ); - ret = KErrAccessDenied; - } - } - } - else - { - iFs.Delete( aTempFileName ); - } - - LOGGER_WRITE_1( "CSConFsHandler::SaveFileObjectL() : returned %d", ret ); - return ret; - } - -// ----------------------------------------------------------------------------- -// CSConFsHandler::ValidateFileName( const TPtrC aName ) -// Validates the file name -// ----------------------------------------------------------------------------- -// -TInt CSConFsHandler::ValidateFileName( const TPtrC aName ) - { - TInt ret( KErrNone ); - - if( !iFs.IsValidName( aName ) ) - { - ret = KErrBadName; - } - - LOGGER_WRITE_1( "CSConFsHandler::ValidateFileName( const TPtrC aName ) : returned %d", ret ); - return ret; - } - -// ----------------------------------------------------------------------------- -// CSConFsHandler::CreateFolderL( const TPtrC aFolderPath ) -// Creates a folder -// ----------------------------------------------------------------------------- -// -TInt CSConFsHandler::CreateFolderL( const TPtrC aFolderPath ) - { - TRACE_FUNC_ENTRY; - - TInt ret( KErrNone ); - - if( aFolderPath.Length() == 0 ) - { - return KErrArgument; - } - if( aFolderPath.Length() > KMaxPath ) - { - return KErrAbort; - } - if( BaflUtils::PathExists( iFs, aFolderPath ) ) - { - return KErrAlreadyExists; - } - // get restore mode - TBool restoreInProgress( EFalse ); - RProperty backupProperty; - TInt burState( 0 ); - TInt burErr = backupProperty.Get( KUidSystemCategory, conn::KUidBackupRestoreKey, burState ); - const conn::TBURPartType partType = - static_cast< conn::TBURPartType >( burState & conn::KBURPartTypeMask ); - if( burErr == KErrNone && - ( partType == conn::EBURRestorePartial || partType == conn::EBURRestoreFull ) ) - { - // restore mode - LOGGER_WRITE( "CSConFsHandler::CreateFolderL() restore mode" ); - restoreInProgress = ETrue; - } - - // check permissions if not restore mode - if ( !restoreInProgress ) - { - if ( IsExludedPath( aFolderPath ) ) - { - // user has no access to this folder - LOGGER_WRITE( "CSConFsHandler::CreateFolderL() KErrAccessDenied" ); - return KErrAccessDenied; - } - - // user can create whole folder path at once and we need to check that - // user has permission to create folders. We need to find first folder that - // should be created, and see if parent folder has read-only permission. - - HBufC* fullPath = HBufC::NewLC( KMaxFileName ); - TPtr fullPathPtr = fullPath->Des(); - - fullPathPtr.Copy(aFolderPath); - TBool parentFound(EFalse); - LOGGER_WRITE( "CSConFsHandler::CreateFolder() start loop" ); - TInt err(KErrNone); - while (!parentFound && err==KErrNone) - { - err = GetParentFolder( fullPathPtr, fullPathPtr ); - if( err == KErrNone ) - { - if (BaflUtils::PathExists( iFs, fullPathPtr )) - { - parentFound = ETrue; - TUint attr; - ret = iFs.Att( fullPathPtr, attr ); - if ( ret == KErrNone && (attr & KEntryAttReadOnly || attr & KEntryAttSystem) ) - { - // parent folder is read-only - LOGGER_WRITE( "CSConFsHandler::CreateFolderL() KErrAccessDenied" ); - err = KErrAccessDenied; - } - } - } - } - - CleanupStack::PopAndDestroy( fullPath ); - if ( err == KErrAccessDenied ) - { - return KErrAccessDenied; - } - } - - ret = iFs.MkDirAll( aFolderPath ); - LOGGER_WRITE_1( "CSConFsHandler::CreateFolderL( const TPtrC aFolderPath ) : returned %d", ret ); - return ret; - } - -// ----------------------------------------------------------------------------- -// CSConFsHandler::DeleteObjectL( const TPtrC aFullPath ) -// Removes a folder or a file -// ----------------------------------------------------------------------------- -// -TInt CSConFsHandler::DeleteObjectL( const TPtrC aFullPath ) - { - TRACE_FUNC_ENTRY; - LOGGER_WRITE_1("aFullPath: %S", &aFullPath); - TInt ret( KErrNone ); - - if( aFullPath.Length() == 0 ) - { - return KErrArgument; - } - - if( aFullPath.Length() > KMaxFileName ) - { - return KErrAbort; - } - - TUint attr; - // get source folder permissions. - ret = iFs.Att( BaflUtils::DriveAndPathFromFullName(aFullPath), attr ); - if ( ret == KErrNone && (attr & KEntryAttReadOnly || attr & KEntryAttSystem ) ) - { - return KErrAccessDenied; - } - - - // Check file/folder permissions - ret = iFs.Att( aFullPath, attr ); - if ( ret == KErrNone && ( attr & KEntryAttReadOnly || attr & KEntryAttSystem ) ) - { - return KErrAccessDenied; - } - - TBool isFolder(EFalse); - ret = BaflUtils::IsFolder( iFs, aFullPath, isFolder ); - - if( isFolder && ret == KErrNone ) - { - HBufC* fullPath = HBufC::NewLC( KMaxFileName ); - TPtr fullPathPtr = fullPath->Des(); - - fullPathPtr.Copy( aFullPath ); - //check if there is a slash at the end - if( fullPathPtr.LocateReverse( KPathDelimiter ) != fullPathPtr.Length()-1 ) - { - fullPathPtr.Append( KPathDelimiter ); - } - - if ( !IsFolderVisible( fullPathPtr ) ) - { - LOGGER_WRITE("folder was not visible"); - CleanupStack::PopAndDestroy( fullPath ); - return KErrNotFound; - } - else if ( !IsFolderDeletable( fullPathPtr ) ) - { - LOGGER_WRITE("folder was not deletable"); - CleanupStack::PopAndDestroy( fullPath ); - return KErrAccessDenied; - } - - ret = iFs.RmDir( fullPathPtr ); - LOGGER_WRITE_1("iFs.RmDir err: %d", ret); - //delete non-empty folder - if( ret != KErrNone ) - { - CFileMan* fileMan = CFileMan::NewL( iFs ); - CleanupStack::PushL( fileMan ); - // if directory contains read-only files, those files are not deleted - // and KErrAccessDenied is returned. - ret = fileMan->RmDir( fullPathPtr ); - LOGGER_WRITE_1("fileMan->RmDir err: %d", ret); - CleanupStack::PopAndDestroy( fileMan ); //fileman - } - if( ret == KErrNone ) - { - // check is delete operation really succesfully completed - if( BaflUtils::PathExists( iFs, fullPathPtr ) ) - { - // Folder still exist, return error - // KErrBadName mapped to precondition failed error. - ret = KErrBadName; - } - } - CleanupStack::PopAndDestroy( fullPath ); //fullPath - } - else if (ret == KErrNone) - { - // deleting file - if ( IsExludedPath( aFullPath ) ) - { - LOGGER_WRITE("Cannot delete from specified folder, return KErrAccessDenied"); - ret = KErrAccessDenied; - } - else - { - ret = iFs.Delete( aFullPath ); - } - } - - - - LOGGER_WRITE_1( "CSConFsHandler::DeleteObjectL() : returned %d", ret ); - return ret; - } - - -// ----------------------------------------------------------------------------- -// CSConFsHandler::CopyOrMoveFile() -// Copy or Move file/folder. -// ----------------------------------------------------------------------------- -// -void CSConFsHandler::DoCopyOrMoveFileL( const TDesC& aSource, const TDesC& aTarget, - const TBool aUseCopyCommand) - { - TRACE_FUNC_ENTRY; - TInt lastError(KErrNone); - TBool isFolder; - - if( !iFs.IsValidName( aSource ) || !iFs.IsValidName( aTarget ) ) - { - LOGGER_WRITE( "CSConFsHandler::DoCopyOrMoveFileL : Not valid name" ); - User::Leave( KErrBadName ); - } - - // will leave if source (file/folder) does not exists. - User::LeaveIfError( BaflUtils::IsFolder(iFs, aSource, isFolder ) ); - - // Check source file/folder permissions - TUint attr; - User::LeaveIfError( iFs.Att( aSource, attr ) ); - if ( !aUseCopyCommand && (attr & KEntryAttReadOnly || attr & KEntryAttSystem ) ) - { - LOGGER_WRITE( "CSConFsHandler::DoCopyOrMoveFileL : no permissions, abort" ); - User::Leave( KErrAccessDenied ); - } - - HBufC* sourceFolderBuf = HBufC::NewLC( KMaxFileName ); - TPtr sourceFolder = sourceFolderBuf->Des(); - HBufC* targetFolderBuf = HBufC::NewLC( KMaxFileName ); - TPtr targetFolder = targetFolderBuf->Des(); - - sourceFolder.Copy( BaflUtils::DriveAndPathFromFullName(aSource) ); - targetFolder.Copy( BaflUtils::DriveAndPathFromFullName(aTarget) ); - - - // check disk space - TInt driveNumber; - - User::LeaveIfError( iFs.CharToDrive(targetFolder[0], driveNumber) ); - - TVolumeInfo volumeInfo; - TInt err = iFs.Volume(volumeInfo, driveNumber); - if( err != KErrNone ) - { - LOGGER_WRITE_1( "CSConFsHandler::DoCopyOrMoveFileL : iFs.Volume err %d", err ); - User::Leave( KErrNotFound ); - } - - if( !isFolder ) - { - // file handling routines - if( !IsFolderVisible( aSource ) ) - { - LOGGER_WRITE( "CSConFsHandler::DoCopyOrMoveFileL : Current folder doesn't exist" ); - User::Leave( KErrNotFound ); - } - else if( !aUseCopyCommand && IsFolderReadOnly( sourceFolder ) ) - { - LOGGER_WRITE( "CSConFsHandler::DoCopyOrMoveFileL : folder read only, abort" ); - User::Leave( KErrAccessDenied ); - } - - // source file is ok, check target - - if( !IsFolderVisible( targetFolder ) ) - { - LOGGER_WRITE( "CSConFsHandler::DoCopyOrMoveFileL : Current target file/folder doesn't exist" ); - User::Leave( KErrNotFound ); - } - else if( IsFolderReadOnly( targetFolder ) ) - { - LOGGER_WRITE( "CSConFsHandler::DoCopyOrMoveFileL : folder read only, abort" ); - User::Leave( KErrAccessDenied ); - } - else - { - TBool diskFull( EFalse ); - TEntry fileEntry; - User::LeaveIfError( iFs.Entry( aSource, fileEntry ) ); - if ( SysUtil::DiskSpaceBelowCriticalLevelL( &iFs, fileEntry.iSize, driveNumber ) ) - { - diskFull = ETrue; - } - - // target ok, ready to copy or move - CFileMan* fileMan=CFileMan::NewL(iFs); - CleanupStack::PushL(fileMan); - - if( aUseCopyCommand ) - { - if( diskFull ) - { - LOGGER_WRITE( "CSConFsHandler::DoCopyOrMoveFileL : disk full" ); - User::Leave( KErrDiskFull ); - } - LOGGER_WRITE( "CSConFsHandler::DoCopyOrMoveFileL : Copy file" ); - User::LeaveIfError( fileMan->Copy( aSource, aTarget, 0 ) ); - } - else - { - if( aSource.Find( aTarget.Left(2) ) == KErrNone) - { - // same drive - LOGGER_WRITE( "CSConFsHandler::DoCopyOrMoveFileL : Rename file" ); - User::LeaveIfError( fileMan->Rename( aSource, aTarget, 0 ) ); - } - else - { - // different drive - if( diskFull ) - { - LOGGER_WRITE( "CSConFsHandler::DoCopyOrMoveFileL : disk full" ); - User::Leave( KErrDiskFull ); - } - LOGGER_WRITE( "CSConFsHandler::DoCopyOrMoveFileL : copy file" ); - User::LeaveIfError( fileMan->Copy( aSource, aTarget, 0 ) ); - - LOGGER_WRITE( "CSConFsHandler::DoCopyOrMoveFileL : delete original" ); - User::LeaveIfError( fileMan->Delete( aSource, 0 ) ); - } - } - CleanupStack::PopAndDestroy( fileMan ); // fileMan - } - } - else - { - // set trailing backslash after the final directory name - HBufC* tmpSourceBuf = HBufC::NewLC( KMaxFileName ); - TPtr tmpSourcePtr = tmpSourceBuf->Des(); - HBufC* tmpTargetBuf = HBufC::NewLC( KMaxFileName ); - TPtr tmpTargetPtr = tmpTargetBuf->Des(); - - tmpSourcePtr.Copy( aSource ); - if( tmpSourcePtr.LocateReverse( KPathDelimiter ) != tmpSourcePtr.Length()-1 ) - { - tmpSourcePtr.Append( KPathDelimiter ); - } - - tmpTargetPtr.Copy( aTarget ); - if( tmpTargetPtr.LocateReverse( KPathDelimiter ) != tmpTargetPtr.Length()-1 ) - { - tmpTargetPtr.Append( KPathDelimiter ); - } - - if( !IsFolderVisible( tmpSourcePtr ) ) - { - LOGGER_WRITE( "CSConFsHandler::DoCopyOrMoveFileL : Current folder doesn't exist" ); - User::Leave( KErrNotFound ); - } - else if( !aUseCopyCommand && IsFolderReadOnly( sourceFolder ) ) - { - LOGGER_WRITE( "CSConFsHandler::DoCopyOrMoveFileL : sourcefolder read only, abort" ); - User::Leave( KErrAccessDenied ); - } - else if( !aUseCopyCommand && !IsFolderDeletable( tmpSourcePtr ) ) - { - LOGGER_WRITE( "CSConFsHandler::DoCopyOrMoveFileL : source folder read only, abort" ); - User::Leave( KErrAccessDenied ); - } - else if( !IsFolderVisible( targetFolder ) ) - { - LOGGER_WRITE( "CSConFsHandler::DoCopyOrMoveFileL : Current target base-folder doesn't exist" ); - User::Leave( KErrNotFound ); - } - else if( IsFolderReadOnly( targetFolder) ) - { - LOGGER_WRITE( "CSConFsHandler::DoCopyOrMoveFileL : target folder read only, abort" ); - User::Leave( KErrAccessDenied ); - } - else if( BaflUtils::FolderExists(iFs, tmpTargetPtr ) ) - { - LOGGER_WRITE( "CSConFsHandler::DoCopyOrMoveFileL : target folder exist, abort" ); - User::Leave( KErrAlreadyExists ); - } - else if ( tmpTargetPtr.Find( tmpSourcePtr ) == KErrNone ) - { - LOGGER_WRITE( "CSConFsHandler::DoCopyOrMoveFileL : conflict, abort" ); - User::Leave( KErrInUse ); - } - else - { - // is folder empty - TBool emptyFolder( ETrue ); - CDir *entryList = 0; - CDir *dirList = 0; - - User::LeaveIfError( iFs.GetDir( tmpSourcePtr, KEntryAttNormal, EDirsAnyOrder, - entryList, dirList ) ); - if( entryList->Count() > 0 || dirList->Count() > 0 ) - { - emptyFolder = EFalse; - } - - delete entryList; - delete dirList; - - // get folder size - TBool diskFull( EFalse ); - if( !emptyFolder ) - { - TInt64 folderSize = GetFolderSizeL(tmpSourcePtr); - LOGGER_WRITE_1( "CSConFsHandler::DoCopyOrMoveFileL : folderSize: %d", folderSize ); - if ( SysUtil::DiskSpaceBelowCriticalLevelL( &iFs, folderSize, driveNumber ) ) - { - diskFull = ETrue; - } - } - - - CFileMan* fileMan = CFileMan::NewL(iFs); - CleanupStack::PushL(fileMan); - - // ready to copy or move - if( aUseCopyCommand ) - { - LOGGER_WRITE( "CSConFsHandler::DoCopyOrMoveFileL : Copy folder" ); - if( emptyFolder ) - { - // folder is empty, can't copy folder. Create new empty folder. - User::LeaveIfError( iFs.MkDir( tmpTargetPtr ) ); - } - else - { - // folder not empty - if( diskFull ) - { - LOGGER_WRITE( "CSConFsHandler::DoCopyOrMoveFileL : disk full" ); - User::Leave( KErrDiskFull ); - } - - User::LeaveIfError( - fileMan->Copy( aSource, aTarget, CFileMan::ERecurse ) ); - if( lastError == KErrNone ) - { - lastError = fileMan->GetLastError(); - } - } - - TUint attr; - TInt err = iFs.Att( tmpSourcePtr, attr ); - if ( err == KErrNone && (attr & KEntryAttReadOnly ) ) - { - //set read only attribute - err = iFs.SetAtt( tmpTargetPtr, KEntryAttReadOnly, KEntryAttArchive ); - if (err != KErrNone) - { - // can't set attribute - LOGGER_WRITE_1( "CSConFsHandler::DoCopyOrMoveFileL : iFs.SetAtt err: %d",err ); - } - } - } - else - { - if( aSource.FindF( aTarget.Left(2) ) == KErrNone) - { - // same drive - LOGGER_WRITE( "CSConFsHandler::DoCopyOrMoveFileL : Rename folder" ); - User::LeaveIfError( fileMan->Rename( aSource, aTarget, 0 ) ); - } - else - { - // different drive - if( diskFull ) - { - LOGGER_WRITE( "CSConFsHandler::DoCopyOrMoveFileL : disk full" ); - User::Leave( KErrDiskFull ); - } - - LOGGER_WRITE( "CSConFsHandler::DoCopyOrMoveFileL : Copy folder" ); - if( emptyFolder ) - { - // folder is empty, can't copy empty folder. Create empty folder. - User::LeaveIfError( iFs.MkDir( tmpTargetPtr ) ); - } - else - { - User::LeaveIfError( - fileMan->Copy( aSource, aTarget, CFileMan::ERecurse ) ); - } - // copy completed, delete original folder. - LOGGER_WRITE( "CSConFsHandler::DoCopyOrMoveFileL : delete original" ); - User::LeaveIfError( fileMan->RmDir( tmpSourcePtr ) ); - // check was delete operation succesfully completed - if( BaflUtils::PathExists( iFs, tmpSourcePtr ) ) - { - // Folder still exist, return error - lastError = KErrAccessDenied; - } - } - } - CleanupStack::PopAndDestroy(fileMan); // fileMan - } - CleanupStack::PopAndDestroy(tmpTargetBuf); // tmpTargetBuf - CleanupStack::PopAndDestroy(tmpSourceBuf); // tmpSourceBuf - } - - CleanupStack::PopAndDestroy( targetFolderBuf ); - CleanupStack::PopAndDestroy( sourceFolderBuf ); - - if( lastError != KErrNone ) - { - LOGGER_WRITE_1( "CSConFTP::DoCopyOrMoveFileL() : lastError: %d", lastError ); - User::Leave( lastError ); - } - - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConFsHandler::IsFolderVisible() -// Check if folder can be showed -// ----------------------------------------------------------------------------- -// -TBool CSConFsHandler::IsFolderVisible( const TDesC& aFullPath ) - { - TRACE_FUNC_ENTRY; - LOGGER_WRITE_1( "aFullPath: %S", &aFullPath ); - TBool visible(EFalse); - - if( !BaflUtils::FolderExists( iFs, aFullPath ) ) - { - LOGGER_WRITE( "CSConFsHandler::IsFolderVisible() notExist ret EFalse" ); - return EFalse; - } - - // don't show if folder is exluded - visible = !IsExludedPath( aFullPath ); - LOGGER_WRITE_1( "CSConFsHandler::IsFolderVisible() : end, ret %d", (TInt)visible ); - return visible; - } - -// ----------------------------------------------------------------------------- -// CSConFsHandler::IsFolderReadOnly() -// Check if folder is read only (system folder) -// ----------------------------------------------------------------------------- -// -TBool CSConFsHandler::IsFolderReadOnly( const TDesC& aFullPath ) const - { - TRACE_FUNC_ENTRY; - LOGGER_WRITE_1( "aFullPath: %S", &aFullPath ); - TBool readOnly(EFalse); - - // C-drive root is read only, but there are some exceptions - - readOnly = IsExludedPath( aFullPath ); - - if ( aFullPath.CompareF( K_C_ROOT ) == 0 ) - { - // Root of C-drive is read-only - LOGGER_WRITE("Root of C-Drive is read only"); - readOnly = ETrue; - } - - // Check folder permissions - TUint attr; - TInt err = iFs.Att( aFullPath, attr ); - LOGGER_WRITE_1("iFs.Att err: %d", err); - if ( err == KErrNone && (attr & KEntryAttReadOnly || attr & KEntryAttSystem ) ) - { - LOGGER_WRITE("Folder is readonly"); - readOnly = ETrue; - } - - LOGGER_WRITE_1( "CSConFsHandler::IsFolderReadOnly() : end, ret %d", (TInt)readOnly ); - return readOnly; - } - -// ----------------------------------------------------------------------------- -// CSConFsHandler::IsFolderDeletable() -// Check if folder can be deleted. Localized folders cannot delete. -// In C-drive folders can be deleted only from under C:\\Data\\ -// ----------------------------------------------------------------------------- -// -TBool CSConFsHandler::IsFolderDeletable( const TDesC& aFullPath ) const - { - TRACE_FUNC_ENTRY; - LOGGER_WRITE_1( "aFullPath: %S", &aFullPath ); - TBool deleteAllowed(ETrue); - TPath PhoneMem( PathInfo::PhoneMemoryRootPath() ); // "C:\\Data\\" - - if ( aFullPath.CompareF( PhoneMem ) == 0 ) - { - // C:\\Data\\ - LOGGER_WRITE( "CSConFsHandler::IsFolderDeletable() datapath, ret EFalse" ); - deleteAllowed = EFalse; - } - else if ( IsExludedPath( aFullPath ) ) - { - deleteAllowed = EFalse; - } - - iLocalizer->SetFullPath( aFullPath ); - if ( iLocalizer->IsLocalized() ) // delete disabled - { - // Cannot delete localized paths (default paths) - deleteAllowed = EFalse; - } - - LOGGER_WRITE_1( "CSConFsHandler::IsFolderDeletable() : end, ret %d", (TInt)deleteAllowed ); - return deleteAllowed; - } - -// ----------------------------------------------------------------------------- -// CSConFsHandler::GetParentFolder( const TPtrC aFullPath, TDes& aParent) -// Get parent folder -// ----------------------------------------------------------------------------- -// -TInt CSConFsHandler::GetParentFolder( const TDesC& aFullPath, TDes& aParent) - { - TRACE_FUNC_ENTRY; - if (aFullPath.LocateReverse(KPathDelimiter) == aFullPath.Length()-1 ) - { - // remove backlash - aParent.Copy(aFullPath.Left(aFullPath.Length()-1)); - } - else - { - aParent.Copy(aFullPath); - } - - TInt pos = aParent.LocateReverse(KPathDelimiter); - if (pos != KErrNotFound) - { - aParent.Copy(aParent.Left(pos+1)); - LOGGER_WRITE( "CSConFsHandler::GetParentFolder : end KErrNone" ); - return KErrNone; - } - else - { - LOGGER_WRITE_1( "CSConFsHandler::GetParentFolder : end err %d", pos); - return pos; - } - } - -// ----------------------------------------------------------------------------- -// CSConFsHandler::CSConFsHandler() -// Constructor -// ----------------------------------------------------------------------------- -// -CSConFsHandler::CSConFsHandler( RFs& aFs ) : iFs(aFs) - { - TRACE_FUNC; - } - -// ----------------------------------------------------------------------------- -// CSConFsHandler::ConstructL() -// Initializes member data -// ----------------------------------------------------------------------------- -// -void CSConFsHandler::ConstructL() - { - TRACE_FUNC_ENTRY; - iLocalizer = CDirectoryLocalizer::NewL(); - - GetDataPathNameL(); - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConFsHandler::GetDataPathNameL() -// Updates the name of the data folder from a localized string -// ----------------------------------------------------------------------------- -// -void CSConFsHandler::GetDataPathNameL() - { - TRACE_FUNC_ENTRY; - //Read memory string and convert it - TFileName file( KSConResourceName ); - - BaflUtils::NearestLanguageFile( iFs, file ); - - CStringResourceReader* reader = CStringResourceReader::NewL( file ); - CleanupStack::PushL( reader ); - - CnvUtfConverter::ConvertFromUnicodeToUtf8( iDataPathName, - reader->ReadResourceString( R_SECON_DATA_FOLDER ) ); - - CleanupStack::PopAndDestroy( reader ); - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConFsHandler::GetFolderSizeL() -// Get folder (and subfolders) size -// ----------------------------------------------------------------------------- -// -TInt64 CSConFsHandler::GetFolderSizeL( const TDesC& aFullPath ) - { - TRACE_FUNC_ENTRY; - LOGGER_WRITE_1( "aFullPath: %S", &aFullPath ); - TInt64 totalSize(0); - CDir* dir( NULL ); - - User::LeaveIfError( iFs.GetDir(aFullPath, KEntryAttMatchMask, ESortByName, dir) ); - CleanupStack::PushL(dir); - for( TInt i=0; iCount(); ++i ) - { - TEntry entry = (*dir)[i]; - if( !entry.IsDir() ) - { - // file - totalSize += entry.iSize; - } - else - { - // folder - HBufC* subfolderBuf = HBufC::NewLC( KMaxPath ); - TPtr subfolderPtr = subfolderBuf->Des(); - - subfolderPtr.Copy(aFullPath); - subfolderPtr.Append(entry.iName); - subfolderPtr.Append( KPathDelimiter ); - - LOGGER_WRITE( "CSConFsHandler::GetFolderSizeL() : get subfolder size" ); - totalSize += GetFolderSizeL( subfolderPtr ); - CleanupStack::PopAndDestroy( subfolderBuf ); - } - } - CleanupStack::PopAndDestroy(dir); - TRACE_FUNC_EXIT; - return totalSize; - } - -// ----------------------------------------------------------------------------- -// CSConFsHandler::ReplaceSpecialChars() -// Replace special characters to xml compliant -// ----------------------------------------------------------------------------- -// -void CSConFsHandler::ReplaceSpecialChars( TDes8& aDes ) - { - for( TInt i = 0; i < aDes.Length(); i++ ) - { - switch( aDes[i] ) - { - case '&': - aDes.Delete( i, 1 ); - aDes.Insert( i, KReplace1 ); - break; - case '<': - aDes.Delete( i, 1 ); - aDes.Insert( i, KReplace2 ); - break; - case '>': - aDes.Delete( i, 1 ); - aDes.Insert( i, KReplace3 ); - break; - case '"': - aDes.Delete( i, 1 ); - aDes.Insert( i, KReplace4 ); - break; - case '\'': - aDes.Delete( i, 1 ); - aDes.Insert( i, KReplace5 ); - break; - default: - break; - } - } - } - -// ----------------------------------------------------------------------------- -// CSConFsHandler::IsExludedPath() -// Some folders are exluded from user access -// ----------------------------------------------------------------------------- -// -TBool CSConFsHandler::IsExludedPath( const TDesC& aFullPath ) const - { - TInt exluded(ETrue); - LOGGER_WRITE_1( "aFullPath: %S", &aFullPath ); - TPath mmcRoot( PathInfo::MemoryCardRootPath() ); - if ( aFullPath.Length() == KDriveLength ) - { - // root paths not exluded - exluded = EFalse; - } - else if ( aFullPath.FindF( K_C_ROOT ) == 0 ) - { - if ( aFullPath.FindF( PathInfo::PhoneMemoryRootPath() ) == 0 ) - { - // C:\\Data is visible, not exluded - exluded = EFalse; - } - else { - // other paths on C-drive are exluded - LOGGER_WRITE_1("CSConFsHandler::IsExludedPath() Path '%S' is not visible to user", &aFullPath); - exluded = ETrue; - } - } - // hide undesired folders from E: root level - else if( aFullPath.CompareF( mmcRoot ) == 0 ) - { - if ( aFullPath.FindF( KSConSys ) == KDriveLength ) - { - LOGGER_WRITE( "hiding mmcRoot KSConSys" ); - exluded = ETrue; - } - else if( aFullPath.FindF( KSConResource ) == KDriveLength ) - { - LOGGER_WRITE( "hiding mmcRoot KSConResource" ); - exluded = ETrue; - } - else if( aFullPath.FindF( KSConPrivate ) == KDriveLength ) - { - LOGGER_WRITE( "mmcRoot KSConPrivate" ); - exluded = ETrue; - } - else if( aFullPath.FindF( KSConSystem ) == KDriveLength ) - { - LOGGER_WRITE( "hiding mmcRoot KSConSystem" ); - exluded = ETrue; - } - } - // end of E: root level handling - else - { - // don't exlude paths from other drives - exluded = EFalse; - } - return exluded; - } - -// End of file - - diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/services/ftp/src/sconftp.cpp --- a/connectivitymodules/SeCon/services/ftp/src/sconftp.cpp Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1591 +0,0 @@ -/* -* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: File Transfer Controller implementation -* -*/ - - -// INCLUDE FILES - -#include -#include -#include -#include -#include -#include -#include - -#include "debug.h" -#include "sconftp.h" -#include "sconfshandler.h" -#include "sconinboxhandler.h" -#include "sconconsts.h" - -const TInt KPackageSize = 65536; - -// ============================= MEMBER FUNCTIONS =============================== - - -// ----------------------------------------------------------------------------- -// CreateCSConFTPL() -// Entry to CSConFTP -// ----------------------------------------------------------------------------- -// -EXPORT_C CSConFTP* CreateCSConFTPL() - { - TRACE_FUNC; - return CSConFTP::NewL(); - } - -// ----------------------------------------------------------------------------- -// CSConFTP::NewL() -// Two-phase constructor -// ----------------------------------------------------------------------------- -// -CSConFTP* CSConFTP::NewL() - { - TRACE_FUNC_ENTRY; - CSConFTP* self = new (ELeave) CSConFTP(); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - TRACE_FUNC_EXIT; - return self; - } - -// ----------------------------------------------------------------------------- -// CSConFTP::~CSConFTP() -// Destructor -// ----------------------------------------------------------------------------- -// -CSConFTP::~CSConFTP() - { - TRACE_FUNC_ENTRY; - delete iSConInboxHandler; - iSConInboxHandler = NULL; - delete iSConFsHandler; - iSConFsHandler = NULL; - delete iBuffer; - iBuffer = NULL; - - iFs.Delete( iTempFileName ); - iFs.Close(); - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConFTP::GetFolderObjectL( CObexBufObject*& aObjectList ) -// Gets object that contains folder listing from inbox or file system -// ----------------------------------------------------------------------------- -// -TInt CSConFTP::GetFolderObjectL( CObexBufObject*& aObjectList ) - { - TRACE_FUNC_ENTRY; - - TInt ret( KErrNone ); - TInt offset = 0; - TChar driveLetter; - TBuf8 tmpBuf8; - - iBuffer->Reset(); - - //default folder list - lists all available drives, inbox - if( iPathName.Length() == 0 ) - { - TInt devDriveCount = 0; - TInt mmcDriveCount = 0; - - iBuffer->ResizeL( KSConXmlDocBegin().Length() ); - iBuffer->Write( offset, KSConXmlDocBegin ); - offset += KSConXmlDocBegin().Length(); - - //Write all drivers to folderlisting object - TDriveList driveList; - // Get all drives that are visible to the user. - TInt driveCount; - User::LeaveIfError( DriveInfo::GetUserVisibleDrives( iFs, driveList, driveCount ) ); - - for( TInt i = EDriveA; i < KMaxDrives; i++ ) - { - if( driveList[i] ) - { - TUint driveStatus; - User::LeaveIfError( DriveInfo::GetDriveStatus( iFs, i, driveStatus ) ); - LOGGER_WRITE_1( "DriveInfo for drive: %d", i); - - if( !(driveStatus & DriveInfo::EDrivePresent ) - || driveStatus & DriveInfo::EDriveCorrupt - || (driveStatus & DriveInfo::EDriveRemote) ) - { - LOGGER_WRITE_1( "skip drive %d", i); - continue; - } - - User::LeaveIfError( iFs.DriveToChar( i, driveLetter ) ); - - //Letter to uppercase form. - driveLetter.UpperCase(); - - //Folder begin - iBuffer->ExpandL( offset, - KSConXmlFolderNameBegin().Length() ); - iBuffer->Write( offset, KSConXmlFolderNameBegin ); - offset += KSConXmlFolderNameBegin().Length(); - - iBuffer->ExpandL( offset, KSConDriveCName().Length() ); - - tmpBuf8.Delete( 0, tmpBuf8.Length() ); - tmpBuf8.Append( driveLetter ); - tmpBuf8.Append( KDriveDelimiter ); - - iBuffer->Write( offset, tmpBuf8 ); - offset += KSConDriveNameLength; - - //permission - iBuffer->ExpandL( offset, - KSConXmlUserAttributes().Length() ); - iBuffer->Write( offset, KSConXmlUserAttributes ); - offset += KSConXmlUserAttributes().Length(); - if( driveStatus & DriveInfo::EDriveInternal && devDriveCount==0 ) - { - //permission always R for first internal drive - iBuffer->ExpandL( offset, - KSConXmlUserEntryReadOnly().Length() ); - iBuffer->Write( offset, KSConXmlUserEntryReadOnly ); - offset += KSConXmlUserEntryReadOnly().Length(); - } - else - { - //permission always RW - iBuffer->ExpandL( offset, - KSConXmlUserEntryDrive().Length() ); - iBuffer->Write( offset, KSConXmlUserEntryDrive ); - offset += KSConXmlUserEntryDrive().Length(); - } - - //memory type - iBuffer->ExpandL( offset, - KSConXmlMemoryType().Length() ); - iBuffer->Write( offset, KSConXmlMemoryType ); - offset += KSConXmlMemoryType().Length(); - if( driveStatus & DriveInfo::EDriveInternal ) - { - LOGGER_WRITE( "DriveInfo::EDriveInternal" ); - // DEV type - devDriveCount++; - if( devDriveCount > 1 ) - { - // DEV2 - TBuf8 memType; - memType.Copy( KSConMemoryTypeDev ); - memType.AppendNum(devDriveCount); - iBuffer->ExpandL( offset, memType.Length() ); - iBuffer->Write( offset, memType ); - offset += memType.Length(); - } - else - { - // DEV - iBuffer->ExpandL( offset, - KSConMemoryTypeDev().Length() ); - iBuffer->Write( offset, KSConMemoryTypeDev ); - offset += KSConMemoryTypeDev().Length(); - } - } - if( driveStatus & DriveInfo::EDriveRemovable ) - { - LOGGER_WRITE( "DriveInfo::EDriveRemovable" ); - // MMC type - mmcDriveCount++; - if( mmcDriveCount > 1 ) - { - // MMC2 - TBuf8 memType; - memType.Copy( KSConMemoryTypeMmc ); - memType.AppendNum(mmcDriveCount); - iBuffer->ExpandL( offset, memType.Length() ); - iBuffer->Write( offset, memType ); - offset += memType.Length(); - } - else - { - // MMC - iBuffer->ExpandL( offset, - KSConMemoryTypeMmc().Length() ); - iBuffer->Write( offset, KSConMemoryTypeMmc ); - offset += KSConMemoryTypeMmc().Length(); - } - } - - //memory label - iBuffer->ExpandL( offset, - KSConXmlMemoryLabel().Length() ); - iBuffer->Write( offset, KSConXmlMemoryLabel ); - offset += KSConXmlMemoryLabel().Length(); - - TInt err( KErrNotFound ); - TBuf8 volumeName; - if( driveStatus & DriveInfo::EDriveRemovable || devDriveCount == 1 ) - { - // get Volume name for C-drive(Phone) and E-drive(MMC) - err = GetVolumeNameL( i, volumeName ); - } - else - { - // Get localized name for DEV2 (Mass memory) - //Read memory string and convert it - TFileName file( KSConResourceName ); - - BaflUtils::NearestLanguageFile( iFs, file ); - - CStringResourceReader* reader = CStringResourceReader::NewL( file ); - - CnvUtfConverter::ConvertFromUnicodeToUtf8( volumeName, - reader->ReadResourceString( R_SECON_VALUE_MASS_STORAGE ) ); - - delete reader; - err = KErrNone; - } - - if ( err == KErrNone ) - { - iBuffer->ExpandL( offset, - volumeName.Length() ); - iBuffer->Write( offset, volumeName ); - offset += volumeName.Length(); - } - - //Write the end of filelist to folderlisting object - iBuffer->ExpandL( offset, KSConXmlFileEnd().Length() ); - iBuffer->Write( offset, KSConXmlFileEnd ); - offset += KSConXmlFileEnd().Length(); - } - } - //Write the end of folderlist to folderlisting object - iBuffer->ExpandL( offset, KSConXmlFolderListEnd().Length() ); - iBuffer->Write( offset, KSConXmlFolderListEnd ); - iBuffer->Compress(); - } - else - { - if( IsCurrentVolumeOK() ) - { - ret = iSConFsHandler->ParseFolderListL( iBuffer, iPathName, iCurrentDriveTypeNumber ); - } - else - { - ret = KErrNotFound; - } - } - - //Put data to aObjectList - delete aObjectList; - aObjectList = NULL; - - aObjectList = CObexBufObject::NewL( iBuffer ); - aObjectList->SetTypeL( KSConFolderListType ); - aObjectList->SetLengthL( iBuffer->Size() ); - - LOGGER_WRITE_1( "CSConFTP::GetFolderObjectL( CObexBufObject*& aObjectList ) : returned %d", ret ); - return ret; - } - -// ----------------------------------------------------------------------------- -// CSConFTP::GetFileObjectL( CObexFileObject*& aFileObject ) -// Gets object that contains a file from file system -// ----------------------------------------------------------------------------- -// -TInt CSConFTP::GetFileObjectL( CObexFileObject*& aFileObject ) - { - TRACE_FUNC_ENTRY; - - TInt ret( KErrNone ); - - if( aFileObject->Name().Length() == 0 ) - { - return KErrBadName; - } - - // check is current drive ok - if( iPathName.Length() > 0 ) - { - TPath path( KSConAllowedPath ); - path.Append( KPathDelimiter ); - if( iPathName.CompareF( path ) != 0 ) - { - // was normal path (not KSConAllowedPath) - if( !IsCurrentVolumeOK() ) - { - return KErrNotFound; - } - } - } - - HBufC* nameBuf = HBufC::NewLC( KMaxFileName ); - TPtr namePtr = nameBuf->Des(); - namePtr.Append( aFileObject->Name() ); - - if( namePtr.LocateReverse( KPathDelimiter ) == namePtr.Length()-1 ) - { - namePtr.Delete( namePtr.Length()-1, 1 ); - } - - ret = iSConFsHandler->GetFileObjectL( aFileObject, iPathName, namePtr ); - - CleanupStack::PopAndDestroy( nameBuf ); - - LOGGER_WRITE_1( "CSConFTP::GetFileObjectL() : returned %d", ret ); - return ret; - } - -// ----------------------------------------------------------------------------- -// CSConFTP::PutFileObjectInitL( CObexBufObject*& aObject, -// CBufFlat*& aBuffer ) -// Initializes the receiving from the client. -// ----------------------------------------------------------------------------- -// -TInt CSConFTP::PutFileObjectInitL( CObexBufObject*& aObject, - CBufFlat*& aBuffer ) - { - TRACE_FUNC_ENTRY; - TInt ret( KErrNone ); - - RFile file; - - TBool lowMemory = IsCurrentDiskSpaceBelowCritical(); - - //if Inbox then save temp file to default drive - if( iPathName.Length() == 0 ) - { - //When proprietary profile (PC Suite), doesn't allow to use Inbox - if( iProfile == EProprietary ) - { - LOGGER_WRITE( "CSConFTP::PutFileObjectInitL() : iProfile EProprietary" ); - ret = file.Temp( iFs, PathInfo::PhoneMemoryRootPath(), iTempFileName, - EFileWrite | EFileShareExclusive ); - file.Close(); - - if( ret == KErrNone ) - { - delete aObject; - aObject = CObexBufObject::NewL( NULL ); - - if( aBuffer ) - { - aBuffer->Reset(); - delete aBuffer; - } - - aBuffer = CBufFlat::NewL( KSConBufferSize ); - aBuffer->ResizeL( KSConBufferSize ); - - TObexFilenameBackedBuffer bufferdetails( *aBuffer, iTempFileName, - CObexBufObject::EDoubleBuffering ); - aObject->SetDataBufL( bufferdetails ); - } - } - else - { - LOGGER_WRITE( "CSConFTP::PutFileObjectInitL() : not EProprietary" ); - if( lowMemory ) - { - // do not even try to save - LOGGER_WRITE( "CSConFTP::PutFileObjectInitL() : disk full" ); - ret = KErrNoMemory; - } - else - { - ret = iSConInboxHandler->CreateInboxAttachmentL( aObject, aBuffer ); - } - } - - return ret; - } - else - { - LOGGER_WRITE_1("iPathName: %S", &iPathName); - // check is current drive ok - if( !IsCurrentVolumeOK() ) - { - LOGGER_WRITE( "CSConFTP::PutFileObjectInitL() : drive not visible" ); - ret = KErrNotFound; - } - else - { - ret = file.Temp( iFs, iPathName, iTempFileName, EFileWrite | - EFileShareExclusive ); - } - } - - file.Close(); - - if( ret == KErrNone ) - { - delete aObject; - aObject = CObexBufObject::NewL( NULL ); - - if( aBuffer ) - { - aBuffer->Reset(); - delete aBuffer; - } - - aBuffer = CBufFlat::NewL( KSConBufferSize ); - aBuffer->ResizeL( KSConBufferSize ); - - TObexFilenameBackedBuffer bufferdetails( *aBuffer, iTempFileName, - CObexBufObject::EDoubleBuffering ); - aObject->SetDataBufL( bufferdetails ); - - if( lowMemory ) - { - // return error. it's up to pccon/ftp plugin howto handle it.. - LOGGER_WRITE( "CSConFTP::PutFileObjectInitL() : low memory" ); - ret = KErrNoMemory; - } - } - - LOGGER_WRITE_1( "CSConFTP::PutFileObjectInitL( CObexBufObject*& aObject, CBufFlat*& aBuffer ) : returned %d", ret ); - return ret; - } - -// ----------------------------------------------------------------------------- -// CSConFTP::PutFileObjectFinalizeL( CObexBufObject*& aObject ) -// Stores the relayed file object to inbox or file system. -// ----------------------------------------------------------------------------- -// -TInt CSConFTP::PutFileObjectFinalizeL( CObexBufObject*& aObject ) - { - TRACE_FUNC_ENTRY; - TInt ret( KErrNone ); - - // if iPathName is not defined trying to save to inbox, no need to call IsCurrentVolumeOK() - if( iPathName.Length() > 0 && !IsCurrentVolumeOK() ) - { - // Memory card removed - LOGGER_WRITE( "CSConFTP::PutFileObjectFinalizeL() : disk err, return KErrNotFound" ); - return KErrNotFound; - } - else if ( iPathName.Length() + aObject->Name().Length() > KMaxFileName ) - { - LOGGER_WRITE( "CSConFTP::PutFileObjectFinalizeL() : Too long filename, return KErrBadName"); - return KErrBadName; - } - - TBool lowMemory = IsCurrentDiskSpaceBelowCritical(); - if ( lowMemory ) - { - LOGGER_WRITE( "CSConFTP::PutFileObjectFinalizeL() : Low memory, return KErrNoMemory"); - return KErrNoMemory; - } - - HBufC* fullPathBuf = HBufC::NewLC( KMaxFileName ); - TPtr fullPathPtr = fullPathBuf->Des(); - fullPathPtr.Copy( iPathName ); - fullPathPtr.Append( aObject->Name() ); - - // Save to inbox if path is not set. - if( iPathName.Length() == 0 ) - { - LOGGER_WRITE( "CSConFTP::PutFileObjectFinalizeL before SaveObjectToInbox" ); - ret = iSConInboxHandler->SaveObjToInboxL( aObject ); - LOGGER_WRITE_1( "CSConFTP::PutFileObjectFinalize SaveObjectToInbox returned %d", ret ); - } - else if( iPathName.CompareF( K_C_ROOT ) == 0 ) - { - // Saving to root of C:\ is not allowed - ret = KErrAccessDenied; - } - //Save to file system - else - { - TTime time = aObject->Time(); - - // UTC offset - time -= User::UTCOffset(); - - delete aObject; - aObject = NULL; - - ret = iSConFsHandler->SaveFileObjectL( fullPathPtr, time, - iTempFileName ); - } - - CleanupStack::PopAndDestroy( fullPathBuf ); - - LOGGER_WRITE_1( "CSConFTP::PutFileObjectFinalizeL( CObexBufObject*& aObject ) : returned %d", ret ); - - return ret; - } - -// ----------------------------------------------------------------------------- -// CSConFTP::SetPathL( const TPtrC aPath, const TUint8 aFlags ) -// Changes the current path. The path can point to inbox or file system -// ----------------------------------------------------------------------------- -// -TInt CSConFTP::SetPathL( const TPtrC aPath, const TUint8 aFlags ) - { - TRACE_FUNC_ENTRY; - LOGGER_WRITE_1( "aPath: %S", &aPath ); - TInt ret( KErrNone ); - - if( ( aPath.Length() > 0 && aFlags != KSConSetPathRoot ) - || ( iPathName.Length() == KDriveLength && aFlags == KSConSetPathBack) ) - { - // check is current drive ok - if( !IsCurrentVolumeOK() ) - { - LOGGER_WRITE( "CSConFTP::SetPathL() : drive not found" ); - return KErrNotFound; - } - } - - ret = KErrNotFound; - - //path forward, deny access to forbidden directories and drives - if( aPath.Length() > 0 - && ( iPathName.Length() + aPath.Length() < KMaxFileName ) - && ( aFlags == KSConSetPathForward || aFlags == KSConSetPathDontCreate ) ) - { - ret = SetPathForwardL( aPath, aFlags ); - } - //path backward - else if( aFlags == KSConSetPathBack ) - { - ret = SetPathBackwardL( aPath ); - } - //path root - else if( aPath.Length() == 0 && aFlags == KSConSetPathRoot ) - { - LOGGER_WRITE( "CSConFTP::SetPathL() : KSConSetPathRoot" ); - if( iPathName.Length() > 0 ) - { - iPathName.Delete( 0, iPathName.Length() ); - } - iCurrentDrive = KErrNotFound; - ret = KErrNone; - } - - if( ret == KErrNone ) - { - // drive may have changed, update info - UpdateDriveTypeInfoL(); - } - - LOGGER_WRITE_1( "CSConFTP::CSConFTP::SetPathL( const TPtrC aPath, const TUint8 aFlags ) : returned %d", ret ); - return ret; - } - -// ----------------------------------------------------------------------------- -// CSConFTP::SetPathForwardL( const TPtrC aPath, const TUint8 aFlags ) -// Set path forward -// ----------------------------------------------------------------------------- -// -TInt CSConFTP::SetPathForwardL( const TPtrC aPath, const TUint8 aFlags ) - { - TRACE_FUNC_ENTRY; - TInt ret(KErrNone); - HBufC* fullPath = HBufC::NewLC( KMaxFileName ); - TPtr fullPathPtr = fullPath->Des(); - - if( iPathName.Length() == 0 ) - { - fullPathPtr.Copy( aPath ); - } - else - { - fullPathPtr.Copy( iPathName ); - fullPathPtr.Append( aPath ); - } - LOGGER_WRITE_1( "fullPathPtr: %S", &fullPathPtr ); - // now fullpath is new path - // check validity - if( fullPathPtr.Length() < 2 || fullPathPtr[1] != KDriveDelimiter ) - { - LOGGER_WRITE( "CSConFTP::SetPathForwardL() : not valid name" ); - CleanupStack::PopAndDestroy( fullPath ); - return KErrNotFound; - } - - if( fullPathPtr.CompareF( KSConAllowedPath ) == 0 ) - { - // Always access to PC Suite configuration file on ROM - LOGGER_WRITE( "CSConFTP::SetPathForwardL() : KSConAllowedPath" ); - iPathName.Copy( fullPathPtr ); - if( iPathName[iPathName.Length()-1] != KPathDelimiter ) - { - iPathName.Append( KPathDelimiter ); - } - - CleanupStack::PopAndDestroy( fullPath ); - return KErrNone; - } - - // check drive - TInt driveNumber; - TInt err = iFs.CharToDrive( fullPathPtr[0], driveNumber ); - if( err != KErrNone || !IsDriveVisible( driveNumber ) ) - { - LOGGER_WRITE( "CSConFTP::SetPathForwardL() : drive err" ); - CleanupStack::PopAndDestroy( fullPath ); - return KErrNotFound; - } - - // check folder and create it if needed - if( fullPathPtr.Length() > 2 ) - { - TBool isFolder = EFalse; - err = BaflUtils::IsFolder( iFs, fullPathPtr, isFolder ); - if( err != KErrNone ) - { - isFolder = EFalse; - } - LOGGER_WRITE_1( "CSConFTP::SetPathForwardL() IsFolder: %d", (TInt)isFolder ); - - if( !isFolder ) - { - //if "Don't create" is 1 - if( aFlags & 2 ) - { - ret = KErrNotFound; - } - else - { - CreateFolderL( fullPathPtr ); - ret = KErrNone; - } - } - else - { - ret = KErrNone; - } - } - else - { - ret = KErrNone; - } - - if( ret == KErrNone ) - { - iPathName.Copy( fullPathPtr ); - - if( iPathName[iPathName.Length()-1] != KPathDelimiter ) - { - iPathName.Append( KPathDelimiter ); - } - } - - CleanupStack::PopAndDestroy( fullPath ); - LOGGER_WRITE_1( "CSConFTP::SetPathForwardL() : end, ret: %d", ret ); - return ret; - - } - -// ----------------------------------------------------------------------------- -// CSConFTP::SetPathBackwardL( const TPtrC aPath ) -// Set path backward -// ----------------------------------------------------------------------------- -// -TInt CSConFTP::SetPathBackwardL( const TPtrC aPath ) - { - TRACE_FUNC_ENTRY; - TInt ret(KErrNotFound); - if( iPathName.Length() == 0 ) - { - // already in root, exit - LOGGER_WRITE( "CSConFTP::SetPathBackwardL() : already in root" ); - LOGGER_WRITE_1( "CSConFTP::SetPathBackwardL() : end, ret: %d", ret ); - return ret; - } - TInt pos; - TBool isFolder(EFalse); - HBufC* fullPath = HBufC::NewLC( KMaxFileName ); - TPtr fullPathPtr = fullPath->Des(); - - //no directory/folder name - if( aPath.Length() == 0 ) - { - LOGGER_WRITE( "CSConFTP::SetPathBackwardL() : no new path, goto parent" ); - iPathName.Delete( iPathName.Length()-1, 1 ); - pos = iPathName.LocateReverse( KPathDelimiter ); - iPathName.Delete( pos+1, iPathName.Length()-pos ); - ret = KErrNone; - } - //if folder name - else if( aPath.Locate( KDriveDelimiter ) != 1 && iPathName.Length() > KDriveLength ) - { - LOGGER_WRITE( "CSConFTP::SetPathBackwardL() : goto parent and new path" ); - fullPathPtr.Copy( iPathName ); - fullPathPtr.Delete( fullPathPtr.Length()-1, 1 ); - pos = fullPathPtr.LocateReverse( KPathDelimiter ); - fullPathPtr.Delete( pos+1, fullPathPtr.Length()-pos ); - fullPathPtr.Append( aPath ); - - if( fullPathPtr.CompareF( KSConAllowedPath ) == 0 ) - { - // Always access to PC Suite configuration file on ROM - isFolder = ETrue; - } - else - { - TInt driveNumber; - TInt err = iFs.CharToDrive(fullPathPtr[0], driveNumber); - if( err != KErrNone ) - { - LOGGER_WRITE( "CSConFTP::SetPathForwardL() : drive err" ); - isFolder = EFalse; - } - else if( !IsDriveVisible(driveNumber) ) - { - isFolder = EFalse; - } - else - { - // drive ok, check folder. - err = BaflUtils::IsFolder( iFs, fullPathPtr, isFolder ); - if( err != KErrNone ) - { - isFolder = EFalse; - } - } - } - - if( isFolder ) - { - iPathName.Copy( fullPathPtr ); - - if( aPath.LocateReverse( KPathDelimiter ) != aPath.Length()-1 ) - { - iPathName.Append( KPathDelimiter ); - } - - ret = KErrNone; - } - else - { - ret = KErrNotFound; - } - - } - //drive - else if( aPath.Locate( KDriveDelimiter ) == 1 ) - { - fullPathPtr.Copy( aPath ); - if( fullPathPtr.LocateReverse( KPathDelimiter ) - != fullPathPtr.Length()-1 ) - { - fullPathPtr.Append( KPathDelimiter ); - } - - TFileName tempPath( KSConAllowedPath ); - tempPath.Append(KPathDelimiter); - if( fullPathPtr.CompareF( tempPath ) == 0 ) - { - // Always access to PC Suite configuration file on ROM - isFolder = ETrue; - } - else - { - TInt driveNumber; - TInt err = iFs.CharToDrive(fullPathPtr[0], driveNumber); - if( err != KErrNone ) - { - LOGGER_WRITE( "CSConFTP::SetPathForwardL() : drive err" ); - isFolder = EFalse; - } - else if( !IsDriveVisible(driveNumber) ) - { - isFolder = EFalse; - } - else - { - // drive ok, check folder. - err = BaflUtils::IsFolder( iFs, fullPathPtr, isFolder ); - if( err != KErrNone ) - { - isFolder = EFalse; - } - } - } - - if( isFolder ) - { - iPathName.Copy( fullPathPtr ); - - if( aPath.LocateReverse( KPathDelimiter ) != aPath.Length()-1 ) - { - iPathName.Append( KPathDelimiter ); - } - - ret = KErrNone; - } - else - { - ret = KErrNotFound; - } - } - CleanupStack::PopAndDestroy( fullPath ); - LOGGER_WRITE_1( "CSConFTP::SetPathBackwardL() : end, ret: %d", ret ); - return ret; - } - -// ----------------------------------------------------------------------------- -// CSConFTP::CreateFolderL( const TPtrC aFolderName ) -// Creates a new folder to file system -// ----------------------------------------------------------------------------- -// -TInt CSConFTP::CreateFolderL( const TPtrC aFolderName ) - { - TRACE_FUNC_ENTRY; - LOGGER_WRITE_1( "aFolderName: %S", &aFolderName ); - TInt ret( KErrNone ); - if( aFolderName.Length() == 0 ) - { - return KErrArgument; - } - - HBufC* pathBuf = HBufC::NewLC( KMaxFileName ); - TPtr pathBufPtr = pathBuf->Des(); - //absolute folder path - if( aFolderName.Length() > 1 && aFolderName[1] == KDriveDelimiter ) - { - if ( iPathName.Length()>0 ) - { - LOGGER_WRITE( "CSConFTP::CreateFolderL() : KErrBadName" ); - CleanupStack::PopAndDestroy( pathBuf ); - return KErrBadName; - } - pathBufPtr.Copy( aFolderName ); - } - else - { - pathBufPtr.Copy( iPathName ); - pathBufPtr.Append( aFolderName ); - } - - if( !iFs.IsValidName( pathBufPtr ) ) - { - ret = KErrBadName; - } - else - { - // check drive - TInt driveNumber; - ret = iFs.CharToDrive(pathBufPtr[0], driveNumber); - if( ret != KErrNone || !IsDriveVisible(driveNumber) ) - { - LOGGER_WRITE( "CSConFTP::CreateFolderL() : drive err" ); - ret = KErrNotFound; - } - } - - if ( ret == KErrNone ) - { - if( pathBufPtr.LocateReverse( KPathDelimiter ) != pathBufPtr.Length()-1 ) - { - pathBufPtr.Append( KPathDelimiter ); - } - ret = iSConFsHandler->CreateFolderL( pathBufPtr ); - } - - if( ret == KErrNone || ret == KErrAlreadyExists ) - { - ret = SetPathL( aFolderName, KSConSetPathForward ); - } - - CleanupStack::PopAndDestroy( pathBuf ); - - LOGGER_WRITE_1( "CSConFTP::CreateFolderL( const TPtrC aFolderName ) : returned %d", ret ); - - return ret; - } - -// ----------------------------------------------------------------------------- -// CSConFTP::DeleteObjectL( const TPtrC aObjectName ) -// Deletes file/folder from inbox or file system -// ----------------------------------------------------------------------------- -// -TInt CSConFTP::DeleteObjectL( const TPtrC aObjectName ) - { - TRACE_FUNC_ENTRY; - LOGGER_WRITE_1( "aObjectName: %S", &aObjectName ); - TInt ret( KErrNone ); - TFileName tmpTarget; - HBufC* targetBuf = HBufC::NewLC( KMaxFileName ); - TPtr target = targetBuf->Des(); - - //absolute folder path - if( aObjectName.Length() > 1 && aObjectName[1] == KDriveDelimiter ) - { - if ( iPathName.Length()>0 ) - { - LOGGER_WRITE( "CSConFTP::DeleteObjectL() : KErrBadName" ); - CleanupStack::PopAndDestroy( targetBuf ); - return KErrBadName; - } - target.Copy( aObjectName ); - } - else - { - target.Copy( iPathName ); - target.Append( aObjectName ); - } - - if( !iFs.IsValidName( target ) ) - { - ret = KErrBadName; - } - else - { - TInt driveNumber; - ret = iFs.CharToDrive(target[0], driveNumber); - if( ret != KErrNone || !IsDriveVisible(driveNumber) ) - { - LOGGER_WRITE( "CSConFTP::DeleteObjectL() : drive err" ); - ret = KErrNotFound; - } - } - - - if ( ret == KErrNone ) - { - ret = iSConFsHandler->DeleteObjectL( target ); - } - - CleanupStack::PopAndDestroy( targetBuf ); - - LOGGER_WRITE_1( "CSConFTP::DeleteObjectL( const TPtrC aObjectName ) : returned %d", ret ); - return ret; - } - -// ----------------------------------------------------------------------------- -// CSConFTP::GetPath( TDes& aPath ) -// Gets the current path -// ----------------------------------------------------------------------------- -// -TInt CSConFTP::GetPath( TDes& aPath ) - { - TRACE_FUNC; - aPath.Copy( iPathName ); - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// CSConFTP::AbortFileTransfer( CObexBufObject*& aObject ) -// Abort file transfer -// ----------------------------------------------------------------------------- -// -TInt CSConFTP::AbortFileTransfer( CObexBufObject*& aObject ) - { - TRACE_FUNC_ENTRY; - TInt err( KErrNone ); - - if( iPathName.Length() == 0 ) - { - iSConInboxHandler->AbortInboxOperation( aObject ); - } - - //aObject has to be deleted, otherwise the temp file is locked - delete aObject; - aObject = NULL; - - err = iFs.Delete( iTempFileName ); - - LOGGER_WRITE_1( "CSConFTP::AbortFileTransfer( CObexBufObject*& aObject ) : iFs.Delete() err: %d", err ); - return err; - } - -// ----------------------------------------------------------------------------- -// CSConFTP::SetProfile( TInt aProfile ) -// Set used transfer profile -// ----------------------------------------------------------------------------- -// -void CSConFTP::SetProfile( TSConProfile aProfile ) - { - TRACE_FUNC; - iProfile = aProfile; - } - -// ----------------------------------------------------------------------------- -// CSConFTP::SetBackupStarted( TBool aValue ) -// Set backup status -// ----------------------------------------------------------------------------- -// -void CSConFTP::SetBackupStarted( TBool aValue ) - { - TRACE_FUNC; - iBackupStarted = aValue; - } - -// ----------------------------------------------------------------------------- -// CSConFTP::SetUsedMedia( TSConUsedMedia aMedia ) -// Set the used media information -// ----------------------------------------------------------------------------- -// -void CSConFTP::SetUsedMedia( TSConUsedMedia aMedia ) - { - TRACE_FUNC; - iMedia = aMedia; - } - -// ----------------------------------------------------------------------------- -// CSConFTP::IsCurrentDiskSpaceBelowCritical( TUint32 aFilesize ) -// Check is current disk space below critical level. -// ----------------------------------------------------------------------------- -// -TBool CSConFTP::IsCurrentDiskSpaceBelowCritical( TUint32 aFilesize ) - { - TRACE_FUNC_ENTRY; - LOGGER_WRITE_1( "aFilesize: %d", aFilesize ); - TInt drive; - TInt err; - - if( iCurrentDrive != KErrNotFound ) - { - drive = iCurrentDrive; - } - else - { - LOGGER_WRITE( "CSConFTP::IsCurrentDiskSpaceBelowCritical() : drive not specified, use default drive" ); - err = DriveInfo::GetDefaultDrive( DriveInfo::EDefaultPhoneMemory, drive ); - if( err ) - { - LOGGER_WRITE_1( "CSConFTP::IsCurrentDiskSpaceBelowCriticaL() : DriveInfo::GetDefaultDrive err %d", err ); - return ETrue; //exit - } - } - - // check disk space - LOGGER_WRITE_1( "drive: %d", drive ); - TVolumeInfo volumeInfo; - err = iFs.Volume(volumeInfo, drive); - if( err != KErrNone ) - { - LOGGER_WRITE_1( "CSConFTP::IsCurrentDiskSpaceBelowCritical() : iFs.Volume err %d", err ); - LOGGER_WRITE( "CSConFTP::IsCurrentDiskSpaceBelowCritical() : End" ); - return ETrue; //exit - } - LOGGER_WRITE_1( "volumeInfo.iFree: %Ld", volumeInfo.iFree ); - TBool diskLevelCritical( EFalse ); - if ( volumeInfo.iFree - aFilesize <= iCriticalDiskLevel ) - { - // Can not write the data, there's not enough free space on disk. - diskLevelCritical = ETrue; - } - - LOGGER_WRITE_1( "CSConFTP::IsCurrentDiskSpaceBelowCritical() : ret %d", - (TInt)diskLevelCritical ); - return diskLevelCritical; - } - -// ----------------------------------------------------------------------------- -// CSConFTP::ReadWBXMLDataL( CBufFlat*& aBuffer ) -// Read received ConML protocol packet -// ----------------------------------------------------------------------------- -// -TInt CSConFTP::ReadWBXMLDataL( CBufFlat*& aBuffer ) - { - TRACE_FUNC_ENTRY; - TInt ret( KErrNone ); - - RFile file; - TInt fileSize; - - ret = file.Open( iFs, iTempFileName, EFileRead|EFileShareAny ); - CleanupClosePushL( file ); - if( ret == KErrNone ) - { - file.Size( fileSize ); - - delete aBuffer; - aBuffer = NULL; - - HBufC8* wbxmlDataBuf = HBufC8::NewLC( fileSize ); - TPtr8 wbxmlDataPtr = wbxmlDataBuf->Des(); - - file.Read( wbxmlDataPtr ); - - aBuffer = CBufFlat::NewL( KSConBufSize ); - aBuffer->ExpandL( 0, fileSize ); - aBuffer->Write( 0, wbxmlDataPtr ); - - CleanupStack::PopAndDestroy( wbxmlDataBuf ); - } - CleanupStack::PopAndDestroy( &file ); - LOGGER_WRITE_1( "CSConFTP::ReadWBXMLData( CBufFlat*& aBuffer ) : WBXML packet size: %d", fileSize ); - - LOGGER_WRITE_1( "CSConFTP::ReadWBXMLData( CBufFlat*& aBuffer ) : returned %d", ret ); - return ret; - } - -// ----------------------------------------------------------------------------- -// CSConFTP::DeleteTempFile() -// Delete OBEX stack's temp file -// ----------------------------------------------------------------------------- -// -void CSConFTP::DeleteTempFile() - { - TRACE_FUNC_ENTRY; - iFs.Delete( iTempFileName ); - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConFTP::MoveFile() -// Move file/folder -// ----------------------------------------------------------------------------- -// -TInt CSConFTP::MoveFile(const TDesC& aSource, const TDesC& aTarget) - { - TRACE_FUNC_ENTRY; - TInt err; - TFileName tmpSource; - TFileName tmpTarget; - err = GetAbsolutePath( aSource, tmpSource ); - if( err == KErrNone ) - { - err = GetAbsolutePath( aTarget, tmpTarget ); - } - - if( err == KErrNone ) - { - TInt sourceDrive; - TInt targetDrive; - - err = iFs.CharToDrive( tmpSource[0], sourceDrive ); - TInt err2 = iFs.CharToDrive( tmpTarget[0], targetDrive ); - - if( err != KErrNone || err2 != KErrNone - || !IsDriveVisible( sourceDrive ) - || !IsDriveVisible( targetDrive ) ) - { - // drive not visible to user - err = KErrNotFound; - } - } - - if( err == KErrNone ) - { - TRAP( err, - iSConFsHandler->DoCopyOrMoveFileL( tmpSource, tmpTarget, EFalse ) ); - } - - LOGGER_WRITE_1( "CSConFTP::MoveFile() : end, err: %d", err ); - return err; - } - -// ----------------------------------------------------------------------------- -// CSConFTP::CopyFile() -// Copy file/folder -// ----------------------------------------------------------------------------- -// -TInt CSConFTP::CopyFile(const TDesC& aSource, const TDesC& aTarget) - { - TRACE_FUNC_ENTRY; - TInt err; - TFileName tmpSource; - TFileName tmpTarget; - err = GetAbsolutePath( aSource, tmpSource ); - if (err == KErrNone) - { - err = GetAbsolutePath( aTarget, tmpTarget ); - } - - if( err == KErrNone ) - { - TInt sourceDrive; - TInt targetDrive; - - err = iFs.CharToDrive( tmpSource[0], sourceDrive ); - TInt err2 = iFs.CharToDrive( tmpTarget[0], targetDrive ); - - if( err != KErrNone || err2 != KErrNone - || !IsDriveVisible( sourceDrive ) - || !IsDriveVisible( targetDrive ) ) - { - // drive not visible to user - err = KErrNotFound; - } - } - - if (err == KErrNone) - { - TRAP( err, - iSConFsHandler->DoCopyOrMoveFileL( tmpSource, tmpTarget, ETrue ) ); - } - - LOGGER_WRITE_1( "CSConFTP::CopyFile() : end, ret: %d", err ); - return err; - } - -// ----------------------------------------------------------------------------- -// CSConFTP::SetReadOnly() -// Set read-only permissions to file or folder -// ----------------------------------------------------------------------------- -// -TInt CSConFTP::SetReadOnly(const TDesC& aTarget, const TBool aReadOnly) - { - TRACE_FUNC_ENTRY; - TInt err; - TFileName tmpTarget; - err = GetAbsolutePath( aTarget, tmpTarget ); - if( err != KErrNone ) - { - return err; - } - else - { - TInt targetDrive; - err = iFs.CharToDrive( tmpTarget[0], targetDrive ); - - if( err != KErrNone - || !IsDriveVisible( targetDrive ) ) - { - // drive not visible to user - return KErrNotFound; - } - } - - TBool isFolder(EFalse); - err = BaflUtils::IsFolder( iFs, tmpTarget, isFolder ); - if ( err == KErrNone && isFolder ) - { - tmpTarget.Append(KPathDelimiter); - } - if ( !iSConFsHandler->IsFolderVisible( tmpTarget ) ) - { - // folder is not visible to user - err = KErrAccessDenied; - } - else - { - if( aReadOnly ) - { - err = iFs.SetAtt( tmpTarget, KEntryAttReadOnly, KEntryAttArchive ); - } - else - { - err = iFs.SetAtt( tmpTarget, KEntryAttNormal, KEntryAttReadOnly ); - } - } - - LOGGER_WRITE_1( "CSConFTP::SetReadOnly() : ret: %d", err ); - return err; - } - -// ----------------------------------------------------------------------------- -// CSConFTP::SetHidden() -// Set hidden permissions to file or folder -// ----------------------------------------------------------------------------- -// -TInt CSConFTP::SetHidden( const TDesC& /*aTarget*/, const TBool /*aHidden*/ ) - { - // This is currently not supported. - LOGGER_WRITE("CSConFTP::SetHidden return KErrNotSupported"); - return KErrNotSupported; - } - -// ----------------------------------------------------------------------------- -// CSConFTP::GetAbsolutePath() -// Get absolute path from relative file/folder -// ----------------------------------------------------------------------------- -// -TInt CSConFTP::GetAbsolutePath( const TDesC& aFolderName, TDes &aFullPath ) - { - if (aFolderName.Length() == 0) - { - return KErrBadName; - } - //absolute folder path - if( aFolderName.Length() > 1 && aFolderName[1] == KDriveDelimiter ) - { - aFullPath.Copy( aFolderName ); - } - // relative to the root folder - else if( aFolderName[0] == KPathDelimiter ) - { - if( iPathName.Length() < 2 ) - { - return KErrBadName; - } - aFullPath.Copy( iPathName.Left(2) ); - aFullPath.Append( aFolderName ); - } - // relative to the current folder - else - { - aFullPath.Copy( iPathName ); - if( aFullPath.LocateReverse( KPathDelimiter ) != aFullPath.Length()-1 ) - { - aFullPath.Append( KPathDelimiter ); - } - aFullPath.Append( aFolderName ); - // no need to check internal root, because iPathName is real target. - } - - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// CSConFTP::CSConFTP() -// Default constructor -// ----------------------------------------------------------------------------- -// -CSConFTP::CSConFTP() : iProfile( EStandard ), iCurrentDrive( KErrNotFound ) - { - } - -// ----------------------------------------------------------------------------- -// CSConFTP::ConstructL() -// Initializes member data -// ----------------------------------------------------------------------------- -// -void CSConFTP::ConstructL() - { - TRACE_FUNC_ENTRY; - - iBuffer = CBufFlat::NewL( KSConBufSize ); - User::LeaveIfError( iFs.Connect() ); - iSConFsHandler = CSConFsHandler::NewL( iFs ); - iSConInboxHandler = CSConInboxHandler::NewL(); - - CRepository* repository = CRepository::NewLC( KCRUidDiskLevel ); - User::LeaveIfError( repository->Get( KDiskCriticalThreshold, iCriticalDiskLevel ) ); - CleanupStack::PopAndDestroy( repository ); - // inlcude package size - iCriticalDiskLevel += KPackageSize; - LOGGER_WRITE_1( "criticalLevel: %d", iCriticalDiskLevel ); - - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConFTP::GetVolumeNameL() -// Get volume name -// ----------------------------------------------------------------------------- -// -TInt CSConFTP::GetVolumeNameL(const TInt aDriveNumber, TDes8& aVolumeName) - { - TRACE_FUNC_ENTRY; - TVolumeInfo volumeInfo; - TInt ret = iFs.Volume( volumeInfo, aDriveNumber ); - - if ( ret == KErrNone) - { - CnvUtfConverter::ConvertFromUnicodeToUtf8( aVolumeName, - volumeInfo.iName ); - //Replace special characters - for( TInt i = 0; i < aVolumeName.Length(); i++ ) - { - switch( aVolumeName[i] ) - { - case '&': - aVolumeName.Delete( i, 1 ); - aVolumeName.Insert( i, KReplace1 ); - break; - case '<': - aVolumeName.Delete( i, 1 ); - aVolumeName.Insert( i, KReplace2 ); - break; - case '>': - aVolumeName.Delete( i, 1 ); - aVolumeName.Insert( i, KReplace3 ); - break; - case '"': - aVolumeName.Delete( i, 1 ); - aVolumeName.Insert( i, KReplace4 ); - break; - case '\'': - aVolumeName.Delete( i, 1 ); - aVolumeName.Insert( i, KReplace5 ); - break; - default: - break; - } - } - - //No name - if( aVolumeName.Length() == 0 ) - { - LOGGER_WRITE( "Volume has no name, use default localized name" ); - //Read memory string and convert it - TFileName file( KSConResourceName ); - - BaflUtils::NearestLanguageFile( iFs, file ); - - CStringResourceReader* reader = CStringResourceReader::NewL( file ); - CleanupStack::PushL( reader ); - TUint driveStatus; - User::LeaveIfError( DriveInfo::GetDriveStatus( iFs, aDriveNumber, driveStatus ) ); - if( driveStatus & DriveInfo::EDriveRemovable ) - { - // read default MMC name - CnvUtfConverter::ConvertFromUnicodeToUtf8( aVolumeName, - reader->ReadResourceString( R_SECON_VALUE_MMC ) ); - } - else - { - // read default DEV name - CnvUtfConverter::ConvertFromUnicodeToUtf8( aVolumeName, - reader->ReadResourceString( R_SECON_VALUE_DEVICE ) ); - } - CleanupStack::PopAndDestroy( reader ); - } - } - LOGGER_WRITE_1("GetVolumeNameL returned: %d", ret); - return ret; - } - -// ----------------------------------------------------------------------------- -// CSConFTP::IsDriveVisible() -// Check is drive visible for user -// ----------------------------------------------------------------------------- -// -TBool CSConFTP::IsDriveVisible( const TInt aDriveNumber ) - { - TUint driveStatus; - TInt err = DriveInfo::GetDriveStatus( iFs, aDriveNumber, driveStatus); - if( err ) - { - LOGGER_WRITE_1( "CSConFTP::IsDriveVisible() : DriveInfo::GetDriveStatus err: %d", err ); - return EFalse; - } - if( driveStatus & DriveInfo::EDriveRemote ) - { - LOGGER_WRITE( "CSConFTP::IsDriveVisible() : remote drive" ); - return EFalse; - } - if( !(driveStatus & DriveInfo::EDriveUserVisible) ) - { - LOGGER_WRITE( "CSConFTP::IsDriveVisible() : not visible" ); - return EFalse; - } - if( !(driveStatus & DriveInfo::EDrivePresent ) ) - { - LOGGER_WRITE( "CSConFTP::IsDriveVisible() : not present" ); - return EFalse; - } - if( driveStatus & DriveInfo::EDriveCorrupt ) - { - LOGGER_WRITE( "CSConFTP::IsDriveVisible() : corrupted" ); - return EFalse; - } - else - { - return ETrue; - } - } - -// ----------------------------------------------------------------------------- -// CSConFTP::UpdateDriveTypeInfoL() -// Test is current volume still ok. -// ----------------------------------------------------------------------------- -// -TBool CSConFTP::IsCurrentVolumeOK() - { - if( iCurrentDrive == KErrNotFound ) - { - LOGGER_WRITE( "CSConFTP::IsCurrentVolumeOK() : not set" ); - return EFalse; - } - - TUint driveStatus; - TInt err = DriveInfo::GetDriveStatus( iFs, iCurrentDrive, driveStatus); - if( err ) - { - LOGGER_WRITE_1( "CSConFTP::IsCurrentVolumeOK() : DriveInfo::GetDriveStatus err: %d", err ); - return EFalse; - } - if( !(driveStatus & DriveInfo::EDrivePresent )) - { - LOGGER_WRITE( "CSConFTP::IsCurrentVolumeOK() : not present" ); - return EFalse; - } - if( driveStatus & DriveInfo::EDriveCorrupt ) - { - LOGGER_WRITE( "CSConFTP::IsCurrentVolumeOK() : corrupted" ); - return EFalse; - } - else - { - return ETrue; - } - } - -// ----------------------------------------------------------------------------- -// CSConFTP::UpdateDriveTypeInfoL() -// Updates drive information (iCurrentDrive and iCurrentDriveTypeNumber) -// ----------------------------------------------------------------------------- -// -void CSConFTP::UpdateDriveTypeInfoL() - { - TRACE_FUNC_ENTRY; - TInt driveNumber; - iCurrentDriveTypeNumber = 0; - - if( iPathName.Length() == 0 ) - { - LOGGER_WRITE( "CSConFTP::UpdateDriveTypeInfoL() : drive not specified" ); - iCurrentDrive = KErrNotFound; - return; - } - - User::LeaveIfError( iFs.CharToDrive(iPathName[0], driveNumber) ); - iCurrentDrive = driveNumber; - - TUint driveStatus; - User::LeaveIfError( DriveInfo::GetDriveStatus( iFs, iCurrentDrive, driveStatus ) ); - // if true, search internal drives, else search removable drives - TBool searchInternalDrives = (driveStatus & DriveInfo::EDriveInternal); - - TInt driveCount; - TDriveList driveList; - - User::LeaveIfError( DriveInfo::GetUserVisibleDrives( iFs, driveList, driveCount ) ); - - for( TInt i = EDriveA; i <= iCurrentDrive; i++ ) - { - if( driveList[i] ) - { - TUint driveStatus; - User::LeaveIfError( DriveInfo::GetDriveStatus( iFs, i, driveStatus ) ); - - if( !(driveStatus & DriveInfo::EDrivePresent ) - || driveStatus & DriveInfo::EDriveCorrupt ) - { - LOGGER_WRITE( "not present or corrupted" ); - continue; - } - - if( driveStatus & DriveInfo::EDriveInternal ) - { - if( searchInternalDrives ) - { - iCurrentDriveTypeNumber++; - } - } - else if( driveStatus & DriveInfo::EDriveRemovable ) - { - if( !searchInternalDrives ) - { - iCurrentDriveTypeNumber++; - } - } - } - } - TRACE_FUNC_EXIT; - } - -// End of file - diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/services/ftp/src/sconftp.rss --- a/connectivitymodules/SeCon/services/ftp/src/sconftp.rss Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,41 +0,0 @@ -/* -* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Resource file for sconftp.dll -* -*/ - - -// ----------------------------------------------------------------------------- -// RESOURCE IDENTIFIER -// ----------------------------------------------------------------------------- -// -NAME SFTP - -// ----------------------------------------------------------------------------- -// INCLUDE FILES -// ----------------------------------------------------------------------------- -// -#include -#include - -#include - - -RESOURCE RSS_SIGNATURE { } - -RESOURCE TBUF r_secon_value_device { buf = qtn_secon_device; } -RESOURCE TBUF r_secon_value_mmc { buf = qtn_secon_mmc; } -RESOURCE TBUF r_secon_value_mass_storage { buf = qtn_secon_mass_storage; } -RESOURCE TBUF r_secon_data_folder { buf = qtn_secon_data_folder; } -RESOURCE TBUF r_secon_unknown_supplier { buf = qtn_secon_unknown_supplier; } diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/services/ftp/src/sconinboxhandler.cpp --- a/connectivitymodules/SeCon/services/ftp/src/sconinboxhandler.cpp Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,199 +0,0 @@ -/* -* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: File Transfer Controller implementation -* -*/ - - -// INCLUDE FILES -#include -#include // BT Message Uid - -#include "sconinboxhandler.h" -#include "debug.h" -#include "sconconsts.h" - - -// ============================= MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CSConInboxHandler::NewL() -// Two-phase constructor -// ----------------------------------------------------------------------------- -// -CSConInboxHandler* CSConInboxHandler::NewL() - { - TRACE_FUNC_ENTRY; - CSConInboxHandler* self = new (ELeave) CSConInboxHandler(); - - TRACE_FUNC_EXIT; - return self; - } - -// ----------------------------------------------------------------------------- -// CSConInboxHandler::~CSConInboxHandler() -// Default destructor -// ----------------------------------------------------------------------------- -// -CSConInboxHandler::~CSConInboxHandler() - { - TRACE_FUNC; - } - -// ----------------------------------------------------------------------------- -// CSConInboxHandler::CreateInboxAttachmentL( CObexBufObject*& aObject, -// CBufFlat*& aBuffer ) -// Creates an attachment to device's Inbox -// ----------------------------------------------------------------------------- -// -TInt CSConInboxHandler::CreateInboxAttachmentL( CObexBufObject*& aObject, - CBufFlat*& aBuffer ) - { - TRACE_FUNC_ENTRY; - TInt ret( KErrNone ); - iDrive = GetMessageCenterDriveL(); - - delete aObject; - aObject = CObexBufObject::NewL( NULL ); - - iFile = RFile(); - - TRAP( ret, TObexUtilsMessageHandler::CreateInboxAttachmentL( aObject, - KUidMsgTypeBt, iMsvIdParent, iFile ) ); - - if( aBuffer ) - { - aBuffer->Reset(); - delete aBuffer; - } - - aBuffer = CBufFlat::NewL( KSConBufferSize ); - aBuffer->ResizeL( KSConBufferSize ); - - TObexRFileBackedBuffer bufferdetails( *aBuffer, iFile, - CObexBufObject::EDoubleBuffering ); - aObject->SetDataBufL( bufferdetails ); - LOGGER_WRITE_1( "CSConInboxHandler::CreateInboxAttachmentL() : returned %d", ret ); - return ret; - } - -// ----------------------------------------------------------------------------- -// CSConInboxHandler::SaveObjToInboxL( CObexBufObject*& aObject ) -// Saves the object to the Inbox -// ----------------------------------------------------------------------------- -// -TInt CSConInboxHandler::SaveObjToInboxL( CObexBufObject*& aObject ) - { - TRACE_FUNC_ENTRY; - TInt ret( KErrNone ); - - if( iDrive == EDriveE ) - { - ret = TObexUtilsMessageHandler::GetMmcFileSystemStatus(); - LOGGER_WRITE_1( "GetMmcFileSystemStatus returned %d", ret ); - } - else - { - ret = TObexUtilsMessageHandler::GetFileSystemStatus(); - LOGGER_WRITE_1( "GetFileSystemStatus returned %d", ret ); - } - - if( ret == KErrNone ) - { - TInt tempDrive = GetMessageCenterDriveL(); - - if( tempDrive == iDrive ) - { - LOGGER_WRITE_1( "before SaveObjToInboxL in SaveObjToInboxL %d", ret ); - TRAP( ret, TObexUtilsMessageHandler::SaveObjToInboxL( aObject, - iFile, iMsvIdParent ) ); - LOGGER_WRITE_1( "after SaveObjToInboxL in SaveObjToInboxL %d", ret ); - } - else - { - ret = KErrGeneral; - } - - if( ret != KErrNone ) - { - LOGGER_WRITE_1( "before RemoveInboxEntriesL in SaveObjToInboxL %d", ret ); - TObexUtilsMessageHandler::RemoveInboxEntriesL( aObject, - iMsvIdParent ); - LOGGER_WRITE_1( "after RemoveInboxEntriesL in SaveObjToInboxL %d", ret ); - } - } - - LOGGER_WRITE_1( "CSConInboxHandler::SaveObjToInboxL( CObexBufObject* aObject ) : returned %d", ret ); - return ret; - } - -// ----------------------------------------------------------------------------- -// CSConInboxHandler::AbortInboxOperation( CObexBufObject*& aObject ) -// Aborts the storing operation -// ----------------------------------------------------------------------------- -// -TInt CSConInboxHandler::AbortInboxOperation( CObexBufObject*& aObject ) - { - TRACE_FUNC_ENTRY; - TInt ret( KErrNone ); - TRAP( ret, TObexUtilsMessageHandler::RemoveInboxEntriesL( aObject, - iMsvIdParent ) ); - LOGGER_WRITE_1( "CSConInboxHandler::AbortInboxOperation() returned %d", ret ); - return ret; - } - -// ----------------------------------------------------------------------------- -// CSConInboxHandler::GetMessageCenterDriveL() -// Returns the current message center drive -// ----------------------------------------------------------------------------- -// -TInt CSConInboxHandler::GetMessageCenterDriveL() - { - TRACE_FUNC_ENTRY; - TInt drive; - CMsvSession* msvSession = CMsvSession::OpenSyncL( *this ); - CleanupStack::PushL( msvSession ); - TDriveUnit driveUnit = msvSession->CurrentDriveL(); - drive = driveUnit.operator TInt(); - CleanupStack::PopAndDestroy( msvSession ); - LOGGER_WRITE_1( "CSConInboxHandler::GetMessageCenterDriveL() returned %d", drive ); - return drive; - } - -// ----------------------------------------------------------------------------- -// CSConInboxHandler::HandleSessionEventL( TMsvSessionEvent aEvent, -// TAny* aArg1, -// TAny* aArg2, -// TAny* aArg3 ) -// Implementation of MMsvSessionObserver::HandleSessionEventL -// ----------------------------------------------------------------------------- -// -void CSConInboxHandler::HandleSessionEventL( TMsvSessionEvent /*aEvent*/, - TAny* /*aArg1*/, - TAny* /*aArg2*/, - TAny* /*aArg3*/ ) - { - } - -// ----------------------------------------------------------------------------- -// CSConInboxHandler::CSConInboxHandler() -// Default constructor -// ----------------------------------------------------------------------------- -// -CSConInboxHandler::CSConInboxHandler() - { - } - -// End of file - diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/services/pcd/bld/bld.inf --- a/connectivitymodules/SeCon/services/pcd/bld/bld.inf Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -/* -* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* This file provides the information required for building the -* whole of a SConPCD -* -*/ - - - -PRJ_PLATFORMS -DEFAULT - -PRJ_EXPORTS -./sbeconfig.xml /epoc32/data/Z/private/10202D56/sbeconfig.xml - -PRJ_MMPFILES -sconpcd.mmp - diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/services/pcd/bld/def/bwinscwu.def --- a/connectivitymodules/SeCon/services/pcd/bld/def/bwinscwu.def Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -EXPORTS - ?CreateCSConPCDL@@YAPAVCSConPCD@@XZ @ 1 NONAME ; class CSConPCD * CreateCSConPCDL(void) - diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/services/pcd/bld/def/eabiuu.def --- a/connectivitymodules/SeCon/services/pcd/bld/def/eabiuu.def Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -EXPORTS - _Z15CreateCSConPCDLv @ 1 NONAME - _ZTI8CSConPCD @ 2 NONAME ; ## - _ZTV8CSConPCD @ 3 NONAME ; ## - diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/services/pcd/bld/sbeconfig.xml --- a/connectivitymodules/SeCon/services/pcd/bld/sbeconfig.xml Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/services/pcd/bld/sconpcd.mmp --- a/connectivitymodules/SeCon/services/pcd/bld/sconpcd.mmp Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,88 +0,0 @@ -/* -* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: PC Connectivity Signaling Module -* -*/ - - -// To get the MW_LAYER_SYSTEMINCLUDE-definition -#include -#include - -VENDORID VID_DEFAULT - -CAPABILITY CAP_GENERAL_DLL - -TARGETPATH sys/bin - -TARGET sconpcd.dll -TARGETTYPE DLL -UID 0x10009D8D 0x101F968B - -#if defined(ARMCC) -DEFFILE ./def/eabiu -#elif defined(WINSCW) -DEFFILE ./def/bwinscw -#elif defined(WINS) -DEFFILE ./def/bwins -#elif defined(ARM) -DEFFILE ./def/bmarm -#endif - -SOURCEPATH ../src -SOURCE sconpcd.cpp -SOURCE sconqueue.cpp -SOURCE sconinstqueue.cpp -SOURCE sconbrqueue.cpp -SOURCE sconinstaller.cpp -SOURCE sconbackuprestore.cpp -SOURCE sconsbeclient.cpp -SOURCE sconpcdutility.cpp -SOURCE sconmetadata.cpp -SOURCE sconvideoparser.cpp -SOURCE cscontimeout.cpp - -SOURCEPATH ../../../common/conmltask/src -SOURCE sconconmltask.cpp - -USERINCLUDE ../inc -USERINCLUDE ../../../inc -USERINCLUDE ../../../common/conmltask/inc - -// Default system include paths -APP_LAYER_SYSTEMINCLUDE - - -LIBRARY euser.lib -LIBRARY swinstcli.lib -LIBRARY sbeclient.lib -LIBRARY sisregistryclient.lib -LIBRARY javaregistryclient.lib -LIBRARY platformenv.lib -LIBRARY efsrv.lib -LIBRARY sysutil.lib -LIBRARY commonengine.lib // For resource reader -LIBRARY WidgetRegistryClient.lib -LIBRARY metadatautility.lib -LIBRARY exiflib.lib -LIBRARY charconv.lib -LIBRARY caf.lib // for Content Access -LIBRARY MediaClientVideo.lib // for CVideoPlayerUtility -LIBRARY ws32.lib // for RWsSession -LIBRARY TNEEngine.lib // for CTNEVideoClipInfo -LIBRARY ImageConversion.lib // for CImageEncoder -LIBRARY MMFControllerFramework.lib // for CMMFMetaDataEntry -LIBRARY bafl.lib // for BaflUtils -DEBUGLIBRARY flogger.lib -// End of file diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/services/pcd/inc/cscontimeout.h --- a/connectivitymodules/SeCon/services/pcd/inc/cscontimeout.h Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,56 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: CSconTimeOut declaration -* -*/ - - -#ifndef CSCONTIMEOUT_H -#define CSCONTIMEOUT_H - -#include // For CActive, link against: euser.lib -#include // For RTimer, link against: euser.lib - -class MTimeOutObserver - { -public: - virtual void TimeOut() = 0; - }; - -NONSHARABLE_CLASS( CSconTimeOut ) : public CActive - { -public: - // Cancel and destroy - ~CSconTimeOut(); - static CSconTimeOut* NewL( MTimeOutObserver& aTimeOutObserver ); - -public: - // Function for making the timeout request - void Start(TTimeIntervalMicroSeconds32 aDelay); - -private: - CSconTimeOut( MTimeOutObserver& aTimeOutObserver ); - void ConstructL(); - -private: // From CActive - void RunL(); - void DoCancel(); - TInt RunError(TInt aError); - -private: - RTimer iTimer; // Provides async timing service - MTimeOutObserver& iTimeOutObserver; - }; - -#endif // CSCONTIMEOUT_H diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/services/pcd/inc/sconbackuprestore.h --- a/connectivitymodules/SeCon/services/pcd/inc/sconbackuprestore.h Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,113 +0,0 @@ -/* -* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: CSConBackupRestore header file -* -*/ - - -#ifndef _SCONBACKUPRESTORE_H_ -#define _SCONBACKUPRESTORE_H_ - -// INCLUDES - -#include -#include - -class CSConSBEClient; -class CSConBackupRestoreQueue; -class RFs; - -//============================================================ -// Class CSConBackupRestore declaration -//============================================================ -NONSHARABLE_CLASS( CSConBackupRestore ): public CActive - { - public: - /** - * Two-phase constructor - * @param aQueue The address of CSConBackupRestoreQueue - * @param aMaxObjectSize Max object size - * @param aFs aReference to RFs connection. - * @return CSConBackupRestore instance - */ - static CSConBackupRestore* NewL( - CSConBackupRestoreQueue* aQueue, - const TInt aMaxObjectSize, RFs& aFs ); - /** - * Destructor - * @return none - */ - ~CSConBackupRestore(); - - /** - * Starts backup-restore task - * @param aTaskId The task number - * @return none - */ - void StartBackupRestore( TInt aTaskId ); - /** - * Stops executing backup-restore task - * @param aTaskId - * @return none - */ - void StopBackupRestore( TInt aTaskId ); - /** - * Resets backup - * @return none - */ - void Reset(); - - /** - * Returns the active status of the backup-restore - * @return ETrue if backup-restore is active, else EFalse - */ - TBool BackupRestoreActive() const; - - private: - /** - * Constructor - * @param aQueue The address of CSConBackupRestoreQueue - * @param aFs aReference to RFs connection. - * @return none - */ - CSConBackupRestore( CSConBackupRestoreQueue* aQueue, RFs& aFs ); - /** - * Initializes member data - * @param aMaxObjectSize Max object size - * @return none - */ - void ConstructL( const TInt aMaxObjectSize ); - /** - * Implementation of CActive::DoCancel() - * @return none - */ - void DoCancel(); - /** - * Implementation of CActive::RunL() - * @return none - */ - void RunL(); - - private: - CSConBackupRestoreQueue* iQueue; - CSConSBEClient* iSBEClient; - TInt iCurrentTask; - TInt iMaxObjectSize; - TBool iBackupRestoreActive; - RFs& iFs; - }; - -#endif // _SCONBACKUPRESTORE_H_ - -// End of file diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/services/pcd/inc/sconbrqueue.h --- a/connectivitymodules/SeCon/services/pcd/inc/sconbrqueue.h Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,124 +0,0 @@ -/* -* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Backup-Restore Queue header file -* -*/ - - -#ifndef _SCONBRQUEUE_H_ -#define _SCONBRQUEUE_H_ - -#include "sconqueue.h" - -class CSConTaskQueue; - -//============================================================ -// Class CSConBackupRestoreQueue declaration -//============================================================ -NONSHARABLE_CLASS ( CSConBackupRestoreQueue ) : public CActive, public CSConTaskQueue - { - public: - /** - * Two-phase constructor - * @param aMaxObjectSize Max object size - * @param aFs aReference to RFs connection. - * @return CSConBackupRestoreQueue instance - */ - static CSConBackupRestoreQueue* NewL( const TInt aMaxObjectSize, RFs& aFs ); - /** - * Destructor - * @return CSConBackupRestoreQueue instance - */ - ~CSConBackupRestoreQueue(); - /** - * Adds a new task to queue - * @param aNewTask A new task to be added - * @param aTaskId The task number - * @return KErrNone if no errors, else system wide error codes - */ - TInt AddNewTask( CSConTask*& aNewTask, TInt aTaskId ); - /** - * Cancels a task - * @param aTask The task number - * @param aAllTasks If ETrue => cancel all tasks - * @param aStatus The reply - * @return none - */ - void CancelTask( TInt aTask, TBool aAllTasks ); - /** - * Resets the queue - * @return none - */ - void Reset(); - /** - * An address pointer to another queue - * @param aTaskQueue The address to another queue - * @return none - */ - virtual void QueueAddress( CSConInstallerQueue*& aTaskQueue ); - /** - * Returns the task type - * @param aTaskId The task number - * @return task type - */ - TSConMethodName GetTaskMethodL( TInt aTaskId ); - - private: - /** - * Constructor - * @return none - */ - CSConBackupRestoreQueue(); - /** - * Initializes member data - * @param aMaxObjectSize Max object size - * @param aFs aReference to RFs connection. - * @return none - */ - void ConstructL( const TInt aMaxObjectSize, RFs& aFs ); - /** - * Polls queue - * @return none - */ - void PollQueue(); - /** - * Starts queue polling - * @return none - */ - void StartQueue(); - /** - * Stops queue polling - * @return none - */ - void StopQueue(); - /** - * Implementation of CActive::DoCancel() - * @return none - */ - void DoCancel(); - /** - * Implementation of CActive::RunL() - * @return none - */ - void RunL(); - - private: - CSConBackupRestore* iBackupRestore; - CSConInstallerQueue* iInstQueueAddress; - }; - - -#endif - -// End of file diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/services/pcd/inc/sconinstaller.h --- a/connectivitymodules/SeCon/services/pcd/inc/sconinstaller.h Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,120 +0,0 @@ -/* -* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: CSConAppInstaller header file -* -*/ - - -#ifndef _SCONINSTALLER_H_ -#define _SCONINSTALLER_H_ - -// INCLUDES - -#include -#include -#include - -#include "sconinstqueue.h" - -class CSConUninstall; - -//============================================================ -// Class CSConAppInstaller declaration -//============================================================ -NONSHARABLE_CLASS ( CSConAppInstaller ): public CActive - { - public: - /** - * Constructor - * @param aQueue The address of CSConInstallerQueu - * @return none - */ - CSConAppInstaller( CSConInstallerQueue* aQueue, RFs& aFs ); - - /** - * Destructor - * @return none - */ - ~CSConAppInstaller(); - - /** - * Starts the installer task - * @param aTaskId Task number - * @return none - */ - void StartInstaller( TInt& aTaskId ); - /** - * Stops the installer task - * @return none - */ - void StopInstaller( TInt& aTaskId ); - - /** - * Returns the active status of the installer - * @return ETrue if installer is active, else EFalse - */ - TBool InstallerActive() const; - - private: - /** - * Implementation of CActive::DoCancel() - * @return none - */ - void DoCancel(); - /** - * Implementation of CActive::RunL() - * @return none - */ - void RunL(); - /** - * Executes ListInstalledApps task - * @return none - */ - void ProcessListInstalledAppsL(); - /** - * Execures UnInstall task - * @param CSConUninstall uninstall params - * @return none - */ - void ProcessUninstallL( const CSConUninstall& aUninstallParams ); - - void UninstallSisL( const CSConUninstall& aUninstallParams ); - void UninstallJavaL( const TUid& aUid, const TSConInstallMode aMode ); - void UninstallWidget( const TUid& aUid, const TSConInstallMode aMode ); - void DeleteFile( const TDesC& aPath ); - - private: - enum TInstallerState - { - EIdle = 0, - EInstalling, - ESilentInstalling, - EUninstalling, - ESilentUninstalling, - ECustomUninstalling, - ESilentCustomUnistalling, - EListingInstalledApps - }; - TInstallerState iInstallerState; - CSConInstallerQueue* iQueue; // Not owned - SwiUI::RSWInstLauncher iSWInst; - SwiUI::TInstallOptions iOptions; - SwiUI::TInstallOptionsPckg iOptionsPckg; - TInt iCurrentTask; - RFs& iFs; - }; - -#endif // _SCONINSTALLER_H_ - -// End of file diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/services/pcd/inc/sconinstqueue.h --- a/connectivitymodules/SeCon/services/pcd/inc/sconinstqueue.h Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,104 +0,0 @@ -/* -* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Installer Queue header file -* -*/ - - -#ifndef _SCONINSTQUEUE_H_ -#define _SCONINSTQUEUE_H_ - -#include "sconqueue.h" - - -//============================================================ -// Class CSConInstallerQueue declaration -//============================================================ -NONSHARABLE_CLASS ( CSConInstallerQueue ): public CActive, public CSConTaskQueue - { - public: - /** - * Two-phase constructor - * @return CSConInstallerQueue instance - */ - static CSConInstallerQueue* NewL( RFs& aFs ); - /** - * Destructor - * @return none - */ - ~CSConInstallerQueue(); - - /** - * Cancels a task - * @param aTask The task number - * @param aAllTasks If ETrue => cancel all tasks - * @param aStatus The reply - * @return none - */ - void CancelTask( TInt aTask, TBool aAllTasks ); - - /** - * An address pointer to another queue - * @param aTaskQueue The address to another queue - * @return none - */ - void QueueAddress( CSConBackupRestoreQueue*& aTaskQueue ); - - private: - /** - * Constructor - * @return none - */ - CSConInstallerQueue( RFs& aFs ); - /** - * Initializes member data - * @return none - */ - void ConstructL(); - /** - * Polls queue - * @return none - */ - void PollQueue(); - /** - * Starts queue polling - * @return none - */ - void StartQueue(); - /** - * Stops queue polling - * @return none - */ - void StopQueue(); - /** - * Implementation of CActive::DoCancel() - * @return none - */ - void DoCancel(); - /** - * Implementation of CActive::RunL() - * @return none - */ - void RunL(); - - private: - CSConAppInstaller* iInstaller; - CSConBackupRestoreQueue* iBRQueueAddress; - RFs& iFs; - }; - - -#endif - -// End of file diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/services/pcd/inc/sconmetadata.h --- a/connectivitymodules/SeCon/services/pcd/inc/sconmetadata.h Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,148 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: SConMetadata header file -* -*/ - - -#ifndef _SCONMETADATA_H_ -#define _SCONMETADATA_H_ - -#include - -class CSConTask; -class CExifRead; -class CExifTag; -//============================================================ -// Class CSConMetadata declaration -//============================================================ -NONSHARABLE_CLASS( SConMetadata ) - { - public: - - /** - * Start processing metadata task - * @param aTask used task - * @param aFs aReference to RFs connection. - * @return none - */ - static void ProcessTask( CSConTask& aTask, RFs& aFs ); - - private: - - /** - * Get audio metadata to task - * @return none - */ - static void GetAudioMetadataL( CSConTask& aTask ); - - /** - * Get video metadata to task - * @param aFs aReference to RFs connection. - * @return none - */ - static void GetVideoMetadataL( CSConTask& aTask, RFs& aFs ); - - /** - * parse exif field - * @return HBufC8* parsed data. Leaves if not found - */ - static HBufC8* GetExifTagL( CExifRead* aReader, const TUint8 aTagID ) ; - - /** - * Parse TUint32 value from aData - * @return TUint32 value - */ - static TUint32 ReadTUint32( const TDesC8& aData ); - - /** - * Read data from file - * @param aFs aReference to RFs connection. - * @return file data - */ - static HBufC8* GetFileDataLC( const TDesC& aFilename, RFs& aFs ); - - /** - * Get exif metadata to task - * @param aFs aReference to RFs connection. - * @return none - */ - static void ReadExifDataL( CSConTask& aTask, RFs& aFs ); - - /** - * Convert latidute/longitude tag to TReal64 value - * @return KErrNone if successfully converted - */ - static TInt ConvertRationalTag( const CExifTag& aTag, TDes& aPosDegrees ); - - /** - * Get latidute value from Exif - * @param aExifRead ExifReader used to read - * @param aLatitude readed latidute - * @return KErrNone if found - */ - static TInt GetExifGPSLatitudeL( CExifRead& aExifRead, TDes& aLatitude ); - - /** - * Get longitude value from Exif - * @param aExifRead ExifReader used to read - * @param aLongitude readed longitude - * @return KErrNone if found - */ - static TInt GetExifGPSLongitudeL( CExifRead& aExifRead, TDes& aLongitude ); - - /** - * Get altidute value from Exif - * @param aExifRead ExifReader used to read - * @param aAltidute readed altidute - * @return KErrNone if found - */ - static TInt GetExifGPSAltiduteL( CExifRead& aExifRead, TDes& aAltidute ); - - /** - * Appends data field to buffer - * @return none - */ - static void AppendUtf8DataFieldL( CBufFlat* aBuffer, const TPtrC aAppendData, - const TUint8 aFieldId ); - - /** - * Appends data field to buffer - * @return none - */ - static void AppendByteDataFieldL( CBufFlat* aBuffer, const TPtrC8 aAppendData, - const TUint8 aFieldId ); - - /** - * Writes TUint32 value to buffer - * @return none - */ - static void WriteTUint32( CBufFlat* aBuffer, TInt offset, TUint32 aValue ); - - /** - * Appends data field to buffer - * @return none - */ - static void AppendTUintDataFieldL( CBufFlat* aBuffer, TUint32 aValue, - const TUint8 aFieldId ); - - /** - * Get AudioFieldId - * @return TUint8 - */ - static TUint8 AudioFieldId( const TMetaDataFieldId fieldId ); - - }; - -#endif // _SCONMETADATA_H_ diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/services/pcd/inc/sconmetadatafielddefs.h --- a/connectivitymodules/SeCon/services/pcd/inc/sconmetadatafielddefs.h Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,128 +0,0 @@ -/* -* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Metadata field definitions -* -*/ - - -#ifndef _SCONMETADATAFIELDDEFS_H_ -#define _SCONMETADATAFIELDDEFS_H_ - -// Content type header -const TUint8 KSconMetadataHeaderAudio( 0x01 ); -const TUint8 KSconMetadataHeaderExif ( 0x02 ); -const TUint8 KSconMetadataHeaderVideo( 0x03 ); - -const TUint8 KSconMetadataHeaderVersion ( 0x02 ); // format version = 2 - -// fields for audio -const TUint8 KSconAudioID3Version ( 0x01 ); -const TUint8 KSconAudioTitle ( 0x02 ); -const TUint8 KSconAudioArtist ( 0x03 ); -const TUint8 KSconAudioAlbum ( 0x04 ); -const TUint8 KSconAudioYear ( 0x05 ); -const TUint8 KSconAudioComment ( 0x06 ); -const TUint8 KSconAudioAlbumTrack ( 0x07 ); -const TUint8 KSconAudioGenre ( 0x08 ); -const TUint8 KSconAudioComposer ( 0x09 ); -const TUint8 KSconAudioCopyright ( 0x0a ); -const TUint8 KSconAudioOriginalArtist( 0x0b ); -const TUint8 KSconAudioUrl ( 0x0c ); -const TUint8 KSconAudioUserUrl ( 0x0d ); -const TUint8 KSconAudioJpeg ( 0x0e ); -const TUint8 KSconAudioVendor ( 0x0f ); -const TUint8 KSconAudioRating ( 0x10 ); -const TUint8 KSconAudioUniqueFileIdentifier( 0x11 ); -const TUint8 KSconAudioDuration ( 0x12 ); -const TUint8 KSconAudioDate ( 0x13 ); - -// fields for exif -const TUint8 KSconExifThumbnail ( 0x01 ); -const TUint8 KSconExifDescription ( 0x02 ); -const TUint8 KSconExifMake ( 0x03 ); -const TUint8 KSconExifModel ( 0x04 ); -const TUint8 KSconExifDateTime ( 0x05 ); -const TUint8 KSconExifSoftware ( 0x06 ); -const TUint8 KSconExifCopyright ( 0x07 ); -const TUint8 KSconExifOrientation ( 0x08 ); -const TUint8 KSconExifXResolution1 ( 0x09 ); -const TUint8 KSconExifXResolution2 ( 0x0a ); -const TUint8 KSconExifYResolution1 ( 0x0b ); -const TUint8 KSconExifYResolution2 ( 0x0c ); -const TUint8 KSconExifResolutionUnit ( 0x0d ); -const TUint8 KSconExifYCbCrPositioning ( 0x0e ); -const TUint8 KSconExifIsoSpeedRatings ( 0x0f ); -const TUint8 KSconExifDateTimeOriginal ( 0x10 ); -const TUint8 KSconExifDateTimeDigitized ( 0x11 ); -const TUint8 KSconExifMakerNote ( 0x12 ); -const TUint8 KSconExifUserComment ( 0x13 ); -const TUint8 KSconExifRelatedSoundFile ( 0x14 ); -const TUint8 KSconExifExposureTime1 ( 0x15 ); -const TUint8 KSconExifExposureTime2 ( 0x16 ); -const TUint8 KSconExifComponentsConfiguration ( 0x17 ); -const TUint8 KSconExifFlash ( 0x18 ); -const TUint8 KSconExifColorSpace ( 0x19 ); -const TUint8 KSconExifPixelXDimension ( 0x1a ); -const TUint8 KSconExifPixelYDimension ( 0x1b ); -const TUint8 KSconExifExposureMode ( 0x1c ); -const TUint8 KSconExifWhiteBalance ( 0x1d ); -const TUint8 KSconExifSceneCaptureType ( 0x1e ); -const TUint8 KSconExifExposureProgram ( 0x1f ); -const TUint8 KSconExifApertureValue1 ( 0x20 ); -const TUint8 KSconExifApertureValue2 ( 0x21 ); -const TUint8 KSconExifExposureBiasValue1 ( 0x22 ); -const TUint8 KSconExifExposureBiasValue2 ( 0x23 ); -const TUint8 KSconExifMeteringMode ( 0x24 ); -const TUint8 KSconExifLightSource ( 0x25 ); -const TUint8 KSconExifFileSource ( 0x26 ); -const TUint8 KSconExifDigitalZoomRatio1 ( 0x27 ); -const TUint8 KSconExifDigitalZoomRatio2 ( 0x28 ); -const TUint8 KSconExifContrast ( 0x29 ); -const TUint8 KSconExifSaturation ( 0x2a ); -const TUint8 KSconExifSharpness ( 0x2b ); -const TUint8 KSconExifExifVersion ( 0x2c ); -const TUint8 KSconExifFlashPixVersion ( 0x2d ); -const TUint8 KSconExifThumbXResolution1 ( 0x2e ); -const TUint8 KSconExifThumbXResolution2 ( 0x2f ); -const TUint8 KSconExifThumbYResolution1 ( 0x30 ); -const TUint8 KSconExifThumbYResolution2 ( 0x31 ); -const TUint8 KSconExifThumbResolutionUnit ( 0x32 ); -const TUint8 KSconExifThumbCompression ( 0x33 ); -const TUint8 KSconExifThumbJpegInterchangeFormat ( 0x34 ); -const TUint8 KSconExifThumbJpegInterchangeFormatLength ( 0x35 ); -const TUint8 KSconExifShutterSpeedValue1 ( 0x36 ); -const TUint8 KSconExifShutterSpeedValue2 ( 0x37 ); -const TUint8 KSconExifBrightnessValue1 ( 0x38 ); -const TUint8 KSconExifBrightnessValue2 ( 0x39 ); -const TUint8 KSconExifCustomRendered ( 0x3a ); -const TUint8 KSconExifGainControl ( 0x3b ); -const TUint8 KSconExifGpsVersion ( 0x3c ); -const TUint8 KSconExifGPSLatitude ( 0x3d ); -const TUint8 KSconExifGPSLongitude ( 0x3e ); -const TUint8 KSconExifGPSAltitude ( 0x3f ); -const TUint8 KSconExifBitDepth ( 0x40 ); - -// fields for video -const TUint8 KSconVideoFormat ( 0x01 ); -const TUint8 KSconVideoFrameRate ( 0x02 ); -const TUint8 KSconVideoFrameSizeWidth ( 0x03 ); -const TUint8 KSconVideoFrameSizeHeight ( 0x04 ); -const TUint8 KSconVideoVideoBitRate ( 0x05 ); -const TUint8 KSconVideoAudioBitRate ( 0x06 ); -const TUint8 KSconVideoDuration ( 0x07 ); -const TUint8 KSconVideoThumbnail ( 0x08 ); -const TUint8 KSconVideoAudioStreamMimetype ( 0x09 ); -const TUint8 KSconVideoVideoStreamMimetype ( 0x0a ); - -#endif // _SCONMETADATAFIELDDEFS_H_ diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/services/pcd/inc/sconpcd.h --- a/connectivitymodules/SeCon/services/pcd/inc/sconpcd.h Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,163 +0,0 @@ -/* -* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: CSConPCD service header -* -*/ - - -#ifndef _SCONPCD_H_ -#define _SCONPCD_H_ - -// INCLUDES - -#include -#include - -#include "sconconmltask.h" - -class CSConInstallerQueue; -class CSConBackupRestoreQueue; - -enum TSConLastConMLOperation - { - ENoTask = 0, - EPutTask, - EGetReply - }; - -//============================================================ -// Class CSConPCD declaration -//============================================================ -class CSConPCD : public CBase - { - public: - /** - * Two-phase constructor - * @return CSConPCD instance - */ - static CSConPCD* NewL(); - /** - * Destructor - * @return none - */ - ~CSConPCD(); - /** - * Receives a new task - * @param aTask A new task - * @return KErrNone if no errors, else system wide error codes - */ - virtual TInt PutTaskL( CSConTask*& aTask ); - /** - * Returns a reply to previous PutTaskL operation - * @return CSConStatusReply if reply exists, else return NULL - */ - virtual CSConStatusReply* GetReply(); - /** - * Resets the module to the initial state - * @return none - */ - virtual void ResetPCD(); - - private: - /** - * Collects a status of a specified task / all tasks - * @param aTask The number of the specified task - * @param aAll If ETrue => receive status of all tasks - * @return KErrNone if no errors, else system wide error codes - */ - TInt GetStatusL( TInt aTask, TBool aAll ); - - /** - * Cancels a specified task / all tasks - * @param aTask The number of the specified task - * @param aAll If ETrue => receive status of all tasks - * @return KErrNone if no errors, else system wide error codes - */ - TInt CancelL( TInt aTask, TBool aAll ); - - /** - * Fills a reply with predefined supported task -information - * @param aTask The task - * @return KErrNone if no errors, else system wide error codes - */ - TInt SupportedInstTaskL( CSConTask* aTask ); - - /** - * Fills a reply with predefined supported task -information - * @param aTask The task - * @return KErrNone if no errors, else system wide error codes - */ - TInt SupportedBRTaskL( CSConTask* aTask ); - - /** - * Fills a reply with predefined Reboot task -information - * @param aTask The task - * @return KErrNone if no errors, else system wide error codes - */ - TInt RebootTaskL( const CSConTask* aTask ); - - /** - * Fills a reply with predefined GetMetadata task -information - * @param aTask The task - * @return none - */ - void GetMetadataTaskL( CSConTask& aTask ); - - /** - * Creates a reply for UpdateDeviceInfo task - * @param aMaxObjectSize A max object size to be used - * @return none - */ - TInt UpdateDeviceInfoL( TInt aMaxObjectSize ); - /** - * Gets the current max object size - * @param aClientObjectSize The object size of the client - * @return the max object size - */ - TInt GetMaxObjectSize( TInt aClientObjectSize ) const; - - /** - * Stores a reply - * @param aReply The reply to be stored - * @return none - */ - void StoreReply( CSConStatusReply*& aReply ); - - /** - * Constructor - * @return none - */ - CSConPCD(); - /** - * Initializes member data - * @return none - */ - virtual void ConstructL(); - - private: - CSConInstallerQueue* iInstallerQueue; - CSConBackupRestoreQueue* iBackupRestoreQueue; - CSConStatusReply* iLatestReply; - TInt iTaskNumber; - TInt iMaxObjectSize; - TSConLastConMLOperation iLastOperation; - RFs iFs; - }; - - IMPORT_C CSConPCD* CreateCSConPCDL(); - typedef CSConPCD* (*TSConCreateCSConPCDFunc) (); - -#endif // SCONPCD - -// End of file diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/services/pcd/inc/sconpcdconsts.h --- a/connectivitymodules/SeCon/services/pcd/inc/sconpcdconsts.h Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,90 +0,0 @@ -/* -* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: CSConPCD constants -* -*/ - - -#ifndef _SCONPCDCONSTS_H -#define _SCONPCDCONSTS_H - -// Timer value used for queue polling -const TInt KSConTimerValue( 20000 ); -// ConML Status code: Task completed -const TInt KSConCodeTaskCompleted( 200 ); -// ConML Status code: Task created -const TInt KSConCodeTaskCreated( 201 ); -// ConML Status code: Task prcosessing started -const TInt KSConCodeProcessingStarted( 202 ); -// ConML Status code: Task partially completed -const TInt KSConCodeTaskPartiallyCompleted( 206 ); -// ConML Status code: Not found -const TInt KSConCodeNotFound( 404 ); -// ConML Status code: Conflict -const TInt KSConCodeConflict( 409 ); -// ConML Status code: Not supported -const TInt KSConCodeNotSupported( 501 ); -// ConML Status code: Incompatible version -const TInt KSConCodeIncompatible( 507 ); -// ConML Status code: Cancelled -const TInt KSConCodeCancelled( 514 ); -// ConML Status code: No memory -const TInt KSConCodeNoMemory( 420 ); - -// ConML Status codes in installer errorcases -const TInt KSConCodeInstErrUserCancel = KSConCodeCancelled; // User cancelled the operation -const TInt KSConCodeInstErrFileCorrupted = 600; // File is corrupted -const TInt KSConCodeInstErrInsufficientMemory = KSConCodeNoMemory; // Insufficient free memory in the drive to perform the operation -const TInt KSConCodeInstErrPackageNotSupported = KSConCodeIncompatible; // Installation of the package is not supported -const TInt KSConCodeInstErrSecurityFailure = 601; // Package cannot be installed due to security error -const TInt KSConCodeInstErrMissingDependency = 602; // Package cannot be installed due to missing dependency -const TInt KSConCodeInstErrFileInUse = 603; // Mandatory file is in use and prevents the operation -const TInt KSConCodeInstErrGeneralError = 604; // Unknown error -const TInt KSConCodeInstErrNoRights = 605; // The package has no rights to perform the operation -const TInt KSConCodeInstErrNetworkFailure = 606; // Indicates that network failure aborted the operation -const TInt KSConCodeInstErrBusy = 607; // Installer is busy doing some other operation -const TInt KSConCodeInstErrAccessDenied = 608; // Target location of package is not accessible -const TInt KSConCodeInstUpgradeError = 609; // The package is an invalid upgrade - -struct SDeviceInfo - { - TSConMethodName method; - TBool support; - }; - -// Supported Backup/Restore and Install methods -const SDeviceInfo KSupportedMethods[] = - { - { EInstall, ETrue }, - { EUninstall, ETrue }, - { EListInstalledApps, ETrue }, - { EListDataOwners, ETrue }, - { ESetBURMode, ETrue }, - { ESetInstParams, ETrue }, - { EGetDataSize, ETrue }, - { ERequestData, ETrue }, - { ESupplyData, ETrue }, - { EReboot, EFalse } // reboot not supported anymore (3.2 ->) - }; - -// Supported ConML version -_LIT8( KCONMLVERSION, "2.0" ); -// SIS mime type for installer -_LIT8( KSISMIMEType, "x-epoc/x-sisx-app" ); -// Java mime type for installer -_LIT8( KMidletMIMEType, "application/java-archive" ); - -#endif - -// End of file diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/services/pcd/inc/sconpcdutility.h --- a/connectivitymodules/SeCon/services/pcd/inc/sconpcdutility.h Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ -/* -* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: SConPcdUtility header file -* -*/ - - -#ifndef __CSCONPCDUTILITY_H__ -#define __CSCONPCDUTILITY_H__ - - -class CSConTask; -class CSConInstApp; -class CSConListInstApps; -//============================================================ -// Class TSConPcdUtility declaration -//============================================================ -NONSHARABLE_CLASS ( SConPcdUtility ) - { - public: // Methods - - static void ProcessListInstalledAppsL( CSConTask*& aTask ); - - private: // Methods - static void AppendInstalledSisL( CSConListInstApps& aListInstApps ); - static void AppendInstalledJavaL( CSConListInstApps& aListInstApps ); - static void AppendInstalledWidgetsL( CSConListInstApps& aListInstApps ); - - /** - * Checks if package is installed to selected drive - * @param aSelectedDriveList selected drives - * @param aInstalledDrives package drivemask - * @return ETrue if package is installed to one of the drives on aDriveList - */ - static TBool IsInstalledToSelectedDrive( const TDriveList& aSelectedDriveList, TUint aInstalledDrives ); - - }; - -#endif // __CSCONPCDUTILITY_H__ diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/services/pcd/inc/sconqueue.h --- a/connectivitymodules/SeCon/services/pcd/inc/sconqueue.h Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,154 +0,0 @@ -/* -* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Queue header file -* -*/ - - -#ifndef _SCONQUEUE_H_ -#define _SCONQUEUE_H_ - -// INCLUDES - -#include -#include - -#include "sconconmltask.h" - -class CSConAppInstaller; -class CSConBackupRestore; -class CSConInstallerQueue; -class CSConBackupRestoreQueue; - -//============================================================ -// Class CSConTaskQueue declaration -//============================================================ -NONSHARABLE_CLASS ( CSConTaskQueue ) - { - public: - /** - * Destructor - * @return none - */ - virtual ~CSConTaskQueue(); - /** - * Returns the status of a specified task / all tasks - * @param aTask The task number - * @param aAllTasks If ETrue => Receive status of all tasks - * @param aStatus The reply - * @return none - */ - virtual void GetQueueStatusL( TInt aTask, TBool aAllTasks, - CSConStatusReply*& aStatus ); - /** - * Adds a new task to queue - * @param aNewTask A new task to be added - * @param aTaskId The task number - * @return KErrNone if no errors, else system wide error codes - */ - virtual TInt AddNewTask( CSConTask*& aNewTask, TInt aTaskId ); - /** - * Set the task to completed -mode - * @param aTask The task number - * @param aError The task error code - * @return none - */ - virtual void CompleteTask( TInt aTask, TInt aError ); - /** - * Set the task progress value - * @param aTask The task number - * @param aProgressValue The progress value - * @return none - */ - virtual void SetTaskProgress( TInt aTask, TInt aProgressValue ); - /** - * Receives a specified task - * @param aTaskId The task number - * @param aTask The address to the task - * @return KErrNone if no errors, else system wide error codes - */ - virtual TInt GetTask( TInt aTaskId, CSConTask*& aTask ); - /** - * Removes a task from the queue - * @param aTask The task number - * @return none - */ - virtual void RemoveTask( TInt aTask ); - /** - * Cancels a task - * @param aTask The task number - * @param aAllTasks If ETrue => cancel all tasks - * @return none - */ - virtual void CancelTask( TInt aTask, TBool aAllTasks ); - /** - * The status of the process - * @return ETrue if process active, else EFalse - */ - virtual TBool QueueProcessActive() const; - /** - * Changes the status of the queue process - * @return none - */ - virtual void ChangeQueueProcessStatus(); - /** - * Resets the queue - * @return none - */ - virtual void Reset(); - /** - * Compares task numbers - * @param aFirst The first task - * @param aSecon The second task - * @return -1 if the first task number is smaller than the second, - * 1 the first task number is greater than the second, 0 if task - * numbers are equal - */ - static TInt Compare( const CSConTask& aFirst, - const CSConTask& aSecond ); - /** - * Matches the task numbers - * @param aFirst The first task - * @param aSecon The second task - * @return ETrue if task numbers match, else EFalse - */ - static TBool Match( const CSConTask& aFirst, - const CSConTask& aSecond ); - - private: - /** - * Pure virtual function for starting the queue observation - * @return none - */ - virtual void StartQueue() = 0; - /** - * Pure virtual function for stoping the queue observation - * @return none - */ - virtual void StopQueue() = 0; - /** - * Pure virtual function for polling the queue - * @return none - */ - virtual void PollQueue() = 0; - - protected: - RPointerArray iQueue; - RTimer iTimer; - TBool iQueueProcessActive; - }; - -#endif - -// End of file diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/services/pcd/inc/sconsbeclient.h --- a/connectivitymodules/SeCon/services/pcd/inc/sconsbeclient.h Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,234 +0,0 @@ -/* -* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: CSConSBEClient header file -* -*/ - - -#ifndef _SCONSBECLIENT_H_ -#define _SCONSBECLIENT_H_ - -// INCLUDES -#include -#include "sconconmltask.h" - -using namespace conn; - -//============================================================ -// Class CSConSBEClient declaration -//============================================================ -NONSHARABLE_CLASS ( CSConSBEClient ) : public CActive - { - public: - /** - * Two-phase constructor - * @param aMaxObjectSize Max object size - * @param aFs aReference to RFs connection. - * @return CSConSBEClient instance - */ - static CSConSBEClient* NewL( const TInt aMaxObjectSize, RFs& aFs ); - /** - * Destructor - * @return none - */ - ~CSConSBEClient(); - /** - * Set backup/restore mode - * @param aStatus TRequestStatus of the request - * @param aTask Task parameters - * @return none - */ - void SetBURMode( TRequestStatus& aStatus, CSConTask*& aTask ); - /** - * Lists public files from data owners - * @param aStatus TRequestStatus of the request - * @param aTask Task parameters - * @return none - */ - void ListPublicFiles( TRequestStatus& aStatus, CSConTask*& aTask ); - /** - * Lists participant data owners - * @param aStatus TRequestStatus of the request - * @param aTask Task parameters - * @return none - */ - void ListDataOwners( TRequestStatus& aStatus, CSConTask*& aTask ); - /** - * Lists data sizes from data owners - * @param aStatus TRequestStatus of the request - * @param aTask Task parameters - * @return none - */ - void GetDataSize( TRequestStatus& aStatus, CSConTask*& aTask ); - /** - * Request a data from a data owner - * @param aStatus TRequestStatus of the request - * @param aTask Task parameters - * @return none - */ - void RequestData( TRequestStatus& aStatus, CSConTask*& aTask ); - /** - * Lists the status of data owners - * @param aStatus TRequestStatus of the request - * @param aTask Task parameters - * @return none - */ - void GetDataOwnerStatus( TRequestStatus& aStatus, CSConTask*& aTask ); - /** - * Supplies a data to a data owner - * @param aStatus TRequestStatus of the request - * @param aTask Task parameters - * @return none - */ - void SupplyData( TRequestStatus& aStatus, CSConTask*& aTask ); - - private: - /** - * Constructor - * @paran aMaxObjectSize Max object size - * @param aFs aReference to RFs connection. - * @return none - */ - CSConSBEClient( const TInt aMaxObjectSize, RFs& aFs ); - - /** - * Implementation of CActive::DoCancel() - * @return none - */ - void DoCancel(); - /** - * Implementation of CActive::RunL() - * @return none - */ - void RunL(); - - /** - * Executes SetBURMode task - * @return none - */ - void ProcessSetBURModeL(); - /** - * Executes ListPublicFiles task - * @return none - */ - void ProcessListPublicFilesL(); - /** - * Executes ListDataOwners task - * @return none - */ - void ProcessListDataOwnersL(); - /** - * Executes GetDataSize task - * @return none - */ - void ProcessGetDataSizeL(); - /** - * Executes RequestData task - * @return KErrNone if no erros. Else system wide error codes. - */ - TInt ProcessRequestDataL(); - /** - * Executes GetDataOwnerStatus task - * @return none - */ - void ProcessGetDataOwnerStatusL(); - /** - * Executes SupplyData task - * @return KErrNone if no errors. Else system wide error codes. - */ - TInt ProcessSupplyDataL(); - /** - * Maps TInt drive number to TDriveNumber - * @param aDrive Drive number as TInt - * @return drive number as TDriveNumber - */ - TDriveNumber GetDriveNumber( const TInt& aDrive ) const; - /** - * Filters the drive list - * @param aDriveList Drive list to be filtered - * @return none - */ - void FilterDriveList( TDriveList& aDriveList ) const; - /** - * Matches the uids - * @param aFirst The first uid - * @param aSecon The second uid - * @return ETrue if uids match, else EFalse - */ - static TBool Match( const TUid& aFirst, - const TUid& aSecond ); - /** - * Handle error received from Secure Backup Engine - * @param aErr Error code from Secure Backup Engine - * @return none - */ - void HandleSBEErrorL( TInt& aErr ); - - /** - * Appends public files to CSConFile array. - * @param aFiles source files to append - * @param aSconFiles dataowner list where to add - * @return none - */ - void AppendFilesToFilelistL( const RFileArray& aFiles, RPointerArray& aSconFiles ); - - /** - * Gets Package dataowner size - * @param aPackageId dataowner - * @param TDriveList drives to include - * @param TPackageDataType package data type - * @return dataowner data size in specified drives - */ - TUint PackageDataSizeL( TUid aPackageId, const TDriveList& aDriveList, - TPackageDataType aPackageDataType ) const; - - /** - * Gets Sid dataowner size - * @param aSid dataowner - * @param TDriveList drives to include - * @param TTransferDataType transfer data type - * @return dataowner data size in specified drives - */ - TUint SidDataSizeL( TUid aSid, const TDriveList& aDriveList, - TTransferDataType aTransferDataType ) const; - - /** - * Gets Java dataowner size - * @param aJavaHash Java hash value - * @param TDriveList drives to include - * @return dataowner data size in specified drives - */ - TUint JavaDataSizeL( const TDesC& aJavaHash, const TDriveList& aDriveList ) const; - - private: - CSBEClient* iSBEClient; - TRequestStatus* iCallerStatus; - TBool iProcessComplete; - TInt iProcessIndex; - TInt iMaxObjectSize; - - CSConTask* iCurrentTask; - TInt iDataPos; - TBool iDataLeft; - TPtrC8 iDataPtr; - TBool iLastChunk; - TBool iBURModeNormal; - TBool iRestoreMode; - RFs& iFs; - TBool iAllSnapshotsSuppliedCalled; - }; - -#endif - -// End of file diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/services/pcd/inc/sconvideoparser.h --- a/connectivitymodules/SeCon/services/pcd/inc/sconvideoparser.h Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,162 +0,0 @@ -/* -* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: CSConVideoParser header file -* -*/ - - -#ifndef SCONVIDEOPARSER_H -#define SCONVIDEOPARSER_H - -// INCLUDES -#include -#include -#include -#include -#include "cscontimeout.h" - -// FORWARD DECLARATIONS -class CVideoOperationObserver; -class CVideoPlayerUtility; - -// CLASS DECLARATION - -//============================================================ -// Class CSConVideoParser declaration -//============================================================ -NONSHARABLE_CLASS( CSConVideoParser ) : public CBase, - public MVideoPlayerUtilityObserver, - public MTNEVideoClipInfoObserver, - public MTNEVideoClipThumbObserver, - private MTimeOutObserver -{ -public: // Constructors and destructor - - ~CSConVideoParser(); - static CSConVideoParser* NewLC(); - - /** - * Opens file - * @return none - */ - void OpenFileL( const RFs& aFs, const TDesC& aFilename ); - - /** - * Get video thumbnail - * @return video thumbnail in jpeg format, - * return KNullDesC8 if thumbain could not found - */ - const TDesC8& Thumbnail() const; - - /** - * Get video frame rate - * @return video frame rate frames/sec - */ - TReal32 VideoFrameRateL() const; - - /** - * Get video frame size - * @return none - */ - void VideoFrameSizeL(TSize& aSize) const; - - /** - * Get video format - * @return video format mimetype (example: video/mp4v-es) - */ - const TDesC8& VideoFormatMimeTypeL() const; - - /** - * Get videostream bitrate - * @return video bitrate bits/sec - */ - TInt VideoBitRateL() const; - - /** - * Get audiostream bitrate - * @return audio bitrate bits/sec - */ - TInt AudioBitRateL() const; - - /** - * Get video duration - * @return video duration in milliseconds. - */ - TInt DurationL() const; - - /** - * Get videostream bitrate - * @return videostream mimetype - */ - const TDesC& VideoMimeTypeL(); - - /** - * Get audiostream mimetype - * @return audiostream mimetype - */ - const TDesC& AudioMimeTypeL(); - -protected: // from base classes - /** @see MVideoPlayerUtilityObserver::MvpuoOpenComplete */ - void MvpuoOpenComplete(TInt aError); - - /** @see MVideoPlayerUtilityObserver::MvpuoPrepareComplete */ - void MvpuoPrepareComplete(TInt aError); - - /** @see MVideoPlayerUtilityObserver::MvpuoFrameReady */ - void MvpuoFrameReady(CFbsBitmap& aFrame,TInt aError); - - /** @see MVideoPlayerUtilityObserver::MvpuoPlayComplete */ - void MvpuoPlayComplete(TInt aError); - - /** @see MVideoPlayerUtilityObserver::MvpuoEvent */ - void MvpuoEvent(const TMMFEvent& aEvent); - - /** @see MTNEVideoClipInfoObserver::NotifyVideoClipInfoReady */ - void NotifyVideoClipInfoReady(CTNEVideoClipInfo& aInfo, TInt aError); - - void NotifyVideoClipThumbCompleted(CTNEVideoClipInfo& aInfo, - TInt aError, - CFbsBitmap* aThumb); - - /** @see MTimeOutObserver::TimeOut */ - void TimeOut(); - -private: - - CSConVideoParser(); - void ConstructL(); - -private: // data - CVideoPlayerUtility* iVideoUtil; - CTNEVideoClipInfo* iVideoClip; - - RWsSession iWsSession; - CWsScreenDevice* iScreen; - TRequestStatus* iCallerStatus; - CActiveSchedulerWait iWait; - CSconTimeOut* iTimeOut; - - HBufC8* iThumbnail; - HBufC* iVideoMimeType; - HBufC* iAudioMimeType; - - TBool iVideoUtilReady; - TBool iVideoClipReady; - TInt iVideoUtilErr; - TInt iVideoClipErr; -}; - -#endif // SCONVIDEOPARSER_H - diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/services/pcd/src/cscontimeout.cpp --- a/connectivitymodules/SeCon/services/pcd/src/cscontimeout.cpp Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,69 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: CSconTimeOut implementation -* -*/ - - -#include "cscontimeout.h" - -CSconTimeOut::CSconTimeOut( MTimeOutObserver& aTimeOutObserver ) : - CActive(EPriorityStandard), // Standard priority - iTimeOutObserver(aTimeOutObserver) - { - } - - -CSconTimeOut* CSconTimeOut::NewL( MTimeOutObserver& aTimeOutObserver ) - { - CSconTimeOut* self = new (ELeave) CSconTimeOut( aTimeOutObserver ); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - return self; - } - -void CSconTimeOut::ConstructL() - { - User::LeaveIfError(iTimer.CreateLocal()); // Initialize timer - CActiveScheduler::Add(this); // Add to scheduler - } - -CSconTimeOut::~CSconTimeOut() - { - Cancel(); // Cancel any request, if outstanding - iTimer.Close(); // Destroy the RTimer object - } - -void CSconTimeOut::DoCancel() - { - iTimer.Cancel(); - } - -void CSconTimeOut::Start(TTimeIntervalMicroSeconds32 aDelay) - { - Cancel(); // Cancel any request, just to be sure - iTimer.After(iStatus, aDelay); // Set for later - SetActive(); // Tell scheduler a request is active - } - -void CSconTimeOut::RunL() - { - iTimeOutObserver.TimeOut(); - } - -TInt CSconTimeOut::RunError(TInt aError) - { - return aError; - } diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/services/pcd/src/sconbackuprestore.cpp --- a/connectivitymodules/SeCon/services/pcd/src/sconbackuprestore.cpp Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,222 +0,0 @@ -/* -* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: CSConBackupRestore implementation -* -*/ - - -// INCLUDE FILES -#include - -#include "sconbackuprestore.h" -#include "sconsbeclient.h" -#include "sconbrqueue.h" -#include "sconpcdconsts.h" - -#include "debug.h" - -// ============================= MEMBER FUNCTIONS =============================== - - -// ----------------------------------------------------------------------------- -// CSConBackupRestore* CSConBackupRestore::NewL( CSConBackupRestoreQueue* aQueue, -// cost TInt& aMaxObjectSize ) -// Two-phase constructor -// ----------------------------------------------------------------------------- -// -CSConBackupRestore* CSConBackupRestore::NewL( CSConBackupRestoreQueue* aQueue, - const TInt aMaxObjectSize, RFs& aFs ) - { - TRACE_FUNC_ENTRY; - CSConBackupRestore* self = new (ELeave) CSConBackupRestore( aQueue, aFs ); - CleanupStack::PushL( self ); - self->ConstructL( aMaxObjectSize ); - CleanupStack::Pop( self ); - TRACE_FUNC_EXIT; - return self; - } - -// ----------------------------------------------------------------------------- -// CSConBackupRestore::CSConBackupRestore( CSConBackupRestoreQueue* aQueue ) -// Constructor -// ----------------------------------------------------------------------------- -// -CSConBackupRestore::CSConBackupRestore( CSConBackupRestoreQueue* aQueue, RFs& aFs ) : - CActive( EPriorityStandard ), iQueue( aQueue ), iFs( aFs ) - { - } - -// ----------------------------------------------------------------------------- -// CSConBackupRestore::ConstructL( const TInt aMaxObjectSize ) -// Initializes member data -// ----------------------------------------------------------------------------- -// -void CSConBackupRestore::ConstructL( const TInt aMaxObjectSize ) - { - iMaxObjectSize = aMaxObjectSize; - iSBEClient = CSConSBEClient::NewL( aMaxObjectSize, iFs ); - CActiveScheduler::Add( iSBEClient ); - } - -// ----------------------------------------------------------------------------- -// CSConBackupRestore::~CSConBackupRestore() -// Destructor -// ----------------------------------------------------------------------------- -// -CSConBackupRestore::~CSConBackupRestore() - { - TRACE_FUNC_ENTRY; - if( iSBEClient ) - { - if( iSBEClient->IsActive() ) - { - iSBEClient->Cancel(); - } - - delete iSBEClient; - iSBEClient = NULL; - } - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConBackupRestore::StartBackupRestore( TInt aTaskId ) -// Starts backup-restore task -// ----------------------------------------------------------------------------- -// -void CSConBackupRestore::StartBackupRestore( TInt aTaskId ) - { - iBackupRestoreActive = ETrue; - CSConTask* task = NULL; - - TInt ret = iQueue->GetTask( aTaskId, task ); - - if( aTaskId > 0 && ret != KErrNotFound ) - { - iCurrentTask = aTaskId; - iQueue->SetTaskProgress( aTaskId, KSConCodeProcessingStarted ); - } - - switch( task->GetServiceId() ) - { - case ESetBURMode : - iQueue->ChangeQueueProcessStatus(); - iSBEClient->SetBURMode( iStatus, task ); - break; - case EListPublicFiles : - iSBEClient->ListPublicFiles( iStatus, task ); - break; - case EListDataOwners : - iSBEClient->ListDataOwners( iStatus, task ); - break; - case EGetDataSize : - iSBEClient->GetDataSize( iStatus, task ); - break; - case ERequestData : - iSBEClient->RequestData( iStatus, task ); - break; - case EGetDataOwnerStatus : - iSBEClient->GetDataOwnerStatus( iStatus, task ); - break; - case ESupplyData : - iSBEClient->SupplyData( iStatus, task ); - break; - default : - break; - } - - SetActive(); - } - -// ----------------------------------------------------------------------------- -// CSConBackupRestore::StopBackupRestore( TInt aTaskId ) -// Stops executing backup-restore task -// ----------------------------------------------------------------------------- -// -void CSConBackupRestore::StopBackupRestore( TInt aTaskId ) - { - TRACE_FUNC_ENTRY; - //if the task is active, do cancel - if( iCurrentTask == aTaskId ) - { - iBackupRestoreActive = EFalse; - iSBEClient->Cancel(); - } - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConBackupRestore::Reset() -// Resets backup -// ----------------------------------------------------------------------------- -// -void CSConBackupRestore::Reset() - { - TRACE_FUNC_ENTRY; - if( iSBEClient ) - { - if( iSBEClient->IsActive() ) - { - iSBEClient->Cancel(); - } - - delete iSBEClient; - iSBEClient = NULL; - } - - TRAPD( err, iSBEClient = CSConSBEClient::NewL( iMaxObjectSize, iFs ) ); - - if( err == KErrNone ) - { - CActiveScheduler::Add( iSBEClient ); - } - - iBackupRestoreActive = EFalse; - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConBackupRestore::BackupRestoreActive() -// returns backup-restore activity status -// ----------------------------------------------------------------------------- -// -TBool CSConBackupRestore::BackupRestoreActive() const - { - return iBackupRestoreActive; - } -// ----------------------------------------------------------------------------- -// CSConBackupRestore::DoCancel() -// Implementation of CActive::DoCancel() -// ----------------------------------------------------------------------------- -// -void CSConBackupRestore::DoCancel() - { - TRACE_FUNC; - } - -// ----------------------------------------------------------------------------- -// CSConBackupRestore::RunL() -// Implementation of CActive::RunL() -// ----------------------------------------------------------------------------- -// -void CSConBackupRestore::RunL() - { - TRACE_FUNC_ENTRY; - - iQueue->CompleteTask( iCurrentTask, iStatus.Int() ); - iBackupRestoreActive = EFalse; - TRACE_FUNC_EXIT; - } - -// End of file diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/services/pcd/src/sconbrqueue.cpp --- a/connectivitymodules/SeCon/services/pcd/src/sconbrqueue.cpp Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,266 +0,0 @@ -/* -* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Backup-Restore Queue implementation -* -*/ - - -// INCLUDE FILES -#include "sconbrqueue.h" -#include "sconbackuprestore.h" -#include "sconpcdconsts.h" -#include "sconinstqueue.h" -#include "debug.h" - -// ----------------------------------------------------------------------------- -// CSConBackupRestoreQueue::NewL( const TInt aMaxObjectSize ) -// Two-phase constructor -// ----------------------------------------------------------------------------- -// -CSConBackupRestoreQueue* CSConBackupRestoreQueue::NewL( const TInt aMaxObjectSize, RFs& aFs ) - { - TRACE_FUNC_ENTRY; - CSConBackupRestoreQueue* self = new (ELeave) CSConBackupRestoreQueue(); - CleanupStack::PushL( self ); - self->ConstructL( aMaxObjectSize, aFs ); - CleanupStack::Pop( self ); - TRACE_FUNC_EXIT; - return self; - } - -// ----------------------------------------------------------------------------- -// CSConBackupRestoreQueue::CSConBackupRestoreQueue() -// Destructor -// ----------------------------------------------------------------------------- -// -CSConBackupRestoreQueue::CSConBackupRestoreQueue() : - CActive( EPriorityStandard ) - { - } - -// ----------------------------------------------------------------------------- -// CSConBackupRestoreQueue::ConstructL( const TInt aMaxObjectSize ) -// Initializes member data -// ----------------------------------------------------------------------------- -// -void CSConBackupRestoreQueue::ConstructL( const TInt aMaxObjectSize, RFs& aFs ) - { - TRACE_FUNC_ENTRY; - iBackupRestore = CSConBackupRestore::NewL( this, aMaxObjectSize, aFs ); - CActiveScheduler::Add( iBackupRestore ); - User::LeaveIfError( iTimer.CreateLocal() ); - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConBackupRestoreQueue::~CSConBackupRestoreQueue() -// Destructor -// ----------------------------------------------------------------------------- -// -CSConBackupRestoreQueue::~CSConBackupRestoreQueue() - { - TRACE_FUNC_ENTRY; - Cancel(); - if( iBackupRestore ) - { - delete iBackupRestore; - iBackupRestore = NULL; - } - - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConBackupRestoreQueue::StartQueue() -// Starts queue polling -// ----------------------------------------------------------------------------- -// -void CSConBackupRestoreQueue::StartQueue() - { - TRACE_FUNC_ENTRY; - if( IsActive() ) - { - Cancel(); - } - - iTimer.After( iStatus, KSConTimerValue ); - SetActive(); - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConBackupRestoreQueue::StopQueue() -// Stops queue polling -// ----------------------------------------------------------------------------- -// -void CSConBackupRestoreQueue::StopQueue() - { - TRACE_FUNC_ENTRY; - iTimer.Cancel(); - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConBackupRestoreQueue::AddNewTask( CSConTask*& aNewTask, TInt aTaskId ) -// Adds a new task to queue -// ----------------------------------------------------------------------------- -// -TInt CSConBackupRestoreQueue::AddNewTask( CSConTask*& aNewTask, TInt aTaskId ) - { - LOGGER_WRITE_1( "CSConBackupRestoreQueue::AddNewTask aTaskId: %d", aTaskId ); - TInt ret( KErrNone ); - - aNewTask->iTaskId = aTaskId; - - //Set progress value "task accepted for execution" - aNewTask->SetProgressValue( KSConCodeTaskCreated ); - aNewTask->SetCompleteValue( EFalse ); - - //For RequestData and SupplyData - if( iQueue.Find( aNewTask, CSConTaskQueue::Match ) != KErrNotFound ) - { - RemoveTask( aTaskId ); - } - - if( iQueue.Count() == 0 ) - { - StartQueue(); - } - - ret = iQueue.InsertInOrder( aNewTask, CSConTaskQueue::Compare ); - LOGGER_WRITE_1( "CSConBackupRestoreQueue::AddNewTask() : returned %d", ret ); - return ret; - } - -// ----------------------------------------------------------------------------- -// CSConBackupRestoreQueue::CancelTask( TInt aTask, TBool aAllTasks ) -// Cancels a task -// ----------------------------------------------------------------------------- -// -void CSConBackupRestoreQueue::CancelTask( TInt aTask, TBool aAllTasks ) - { - TRACE_FUNC_ENTRY; - //Stop backup/restore - if( aTask && !aAllTasks ) - { - LOGGER_WRITE_1("CSConBackupRestoreQueue::CancelTask - Cancel task: %d", aTask); - iBackupRestore->StopBackupRestore( aTask ); - } - - if( aAllTasks ) - { - LOGGER_WRITE("CSConBackupRestoreQueue::CancelTask - Cancel All"); - iBackupRestore->Cancel(); - iBackupRestore->Reset(); - } - - CSConTaskQueue::CancelTask( aTask, aAllTasks ); - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConBackupRestoreQueue::Reset() -// Resets the queue -// ----------------------------------------------------------------------------- -// -void CSConBackupRestoreQueue::Reset() - { - TRACE_FUNC_ENTRY; - CSConTaskQueue::Reset(); - iBackupRestore->Reset(); - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConBackupRestoreQueue::QueueAddress( CSConInstallerQueue*& aTaskQueue ) -// An address pointer to another queue -// ----------------------------------------------------------------------------- -// -void CSConBackupRestoreQueue::QueueAddress( CSConInstallerQueue*& aTaskQueue ) - { - TRACE_FUNC; - iInstQueueAddress = aTaskQueue; - } - -// ----------------------------------------------------------------------------- -// CSConBackupRestoreQueue::GetTaskMethod( TInt& aTaskId ) -// Returns the task type -// ----------------------------------------------------------------------------- -// -TSConMethodName CSConBackupRestoreQueue::GetTaskMethodL( TInt aTaskId ) - { - TRACE_FUNC_ENTRY; - CSConTask* task = NULL; - CSConTaskQueue::GetTask( aTaskId, task ); - LOGGER_WRITE_1( "CSConBackupRestoreQueue::GetTaskMethodL( TInt aTaskId ) : returned %d", - task->GetServiceId() ); - return task->GetServiceId(); - } - -// ----------------------------------------------------------------------------- -// CSConBackupRestoreQueue::PollQueue() -// Polls queue -// ----------------------------------------------------------------------------- -// -void CSConBackupRestoreQueue::PollQueue() - { - // find and start next task if BR and installer is inactive - if( !iBackupRestore->BackupRestoreActive() - && !iInstQueueAddress->QueueProcessActive() ) - { - //find next task - for( TInt i = 0; i < iQueue.Count(); i++ ) - { - TBool complete = iQueue[i]->GetCompleteValue(); - - if( complete == EFalse ) - { - iBackupRestore->StartBackupRestore( - iQueue[i]->iTaskId ); - i = iQueue.Count() + 1; // jump out from loop - } - } - } - } - -// ----------------------------------------------------------------------------- -// Implementation of CActive::DoCancel() -// Entry to CSConPCD -// ----------------------------------------------------------------------------- -// -void CSConBackupRestoreQueue::DoCancel() - { - TRACE_FUNC_ENTRY; - iTimer.Cancel(); - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// Implementation of CActive::RunL() -// Entry to CSConPCD -// ----------------------------------------------------------------------------- -// -void CSConBackupRestoreQueue::RunL() - { - TRACE_FUNC_ENTRY; - LOGGER_WRITE_1( "There are still %d tasks in this queue", iQueue.Count() ); - if( iQueue.Count() > 0 ) - { - PollQueue(); - StartQueue(); - } - TRACE_FUNC_EXIT; - } - -// End of file diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/services/pcd/src/sconinstaller.cpp --- a/connectivitymodules/SeCon/services/pcd/src/sconinstaller.cpp Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,528 +0,0 @@ -/* -* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: CSConAppInstaller implementation -* -*/ - - -// INCLUDE FILES - -#include -#include -#include -#include -#include -#include -#include - -using namespace Java; - -#include "debug.h" -#include "sconinstaller.h" -#include "sconpcdconsts.h" -#include "sconpcdutility.h" - -_LIT8( KWidgetMimeType, "application/x-nokia-widget"); - -const TInt KSConSeConUidValue = 0x101f99f6; -const TUid KSConSeConUid = {KSConSeConUidValue}; - -// ============================= MEMBER FUNCTIONS =============================== - - -// ----------------------------------------------------------------------------- -// CSConAppInstaller::CSConAppInstaller( CSConInstallerQueue* aQueue ) -// Constructor -// ----------------------------------------------------------------------------- -// -CSConAppInstaller::CSConAppInstaller( CSConInstallerQueue* aQueue, RFs& aFs ) : - CActive( EPriorityStandard ), iQueue( aQueue ), iFs( aFs ) - { - TRACE_FUNC; - } - -// ----------------------------------------------------------------------------- -// CSConAppInstaller::~CSConAppInstaller() -// Destructor -// ----------------------------------------------------------------------------- -// -CSConAppInstaller::~CSConAppInstaller() - { - TRACE_FUNC; - iSWInst.Close(); - } - -// ----------------------------------------------------------------------------- -// CSConAppInstaller::StartInstaller( TInt& aTaskId ) -// Starts the installer task -// ----------------------------------------------------------------------------- -// -void CSConAppInstaller::StartInstaller( TInt& aTaskId ) - { - TRACE_FUNC_ENTRY; - CSConTask* task = NULL; - TRequestStatus* status = NULL; - TInt err( KErrNone ); - - TInt ret = iQueue->GetTask( aTaskId, task ); - - if( aTaskId > 0 && ret != KErrNotFound ) - { - if ( iInstallerState != EIdle || IsActive() ) - { - LOGGER_WRITE("WARNING! SConAppInstaller was not on idle state!"); - iQueue->CompleteTask( aTaskId, KErrInUse ); - TRACE_FUNC_EXIT; - return; - } - - - iCurrentTask = aTaskId; - iQueue->SetTaskProgress( aTaskId, KSConCodeProcessingStarted ); - - switch( task->GetServiceId() ) - { - case EInstall : - iQueue->ChangeQueueProcessStatus(); - err = iSWInst.Connect(); - - if( err == KErrNone ) - { - if ( task->iInstallParams->iMode == ESilentInstall ) - { - LOGGER_WRITE( "Begin silent installation.. " ); - iOptions.iUntrusted = SwiUI::EPolicyNotAllowed; - iOptions.iOCSP = SwiUI::EPolicyNotAllowed; - iOptionsPckg = iOptions; - iInstallerState = ESilentInstalling; - iSWInst.SilentInstall( iStatus, task->iInstallParams->iPath, iOptionsPckg ); - } - else - { - LOGGER_WRITE( "Begin to install.. " ); - iInstallerState = EInstalling; - iSWInst.Install( iStatus, task->iInstallParams->iPath ); - } - } - - break; - case EUninstall : - iQueue->ChangeQueueProcessStatus(); - err = iSWInst.Connect(); - - if( err == KErrNone ) - { - LOGGER_WRITE( "Begin to uninstall.. " ); - - TRAP( err, ProcessUninstallL( *task->iUninstallParams ) ); - if( err != KErrNone ) - { - LOGGER_WRITE_1( "StartInstaller ProcessUninstallL err: %d", err ); - status = &iStatus; - User::RequestComplete( status, err ); - } - } - - break; - case EListInstalledApps : - iQueue->ChangeQueueProcessStatus(); - iInstallerState = EListingInstalledApps; - TRAP( err, ProcessListInstalledAppsL() ); - status = &iStatus; - User::RequestComplete( status, err ); - break; - default : - break; - } - - SetActive(); - } - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConAppInstaller::StopInstaller( TInt& aTaskId ) -// Stops the installer task -// ----------------------------------------------------------------------------- -// -void CSConAppInstaller::StopInstaller( TInt& aTaskId ) - { - TRACE_FUNC_ENTRY; - //If the task is the current task, cancel it first - if( iCurrentTask == aTaskId ) - { - Cancel(); - iSWInst.Close(); - } - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// TBool CSConAppInstaller::InstallerActive() -// returns installer activity status -// ----------------------------------------------------------------------------- -// -TBool CSConAppInstaller::InstallerActive() const - { - if ( iInstallerState == EIdle ) - { - return EFalse; - } - else - { - return ETrue; - } - } - -// ----------------------------------------------------------------------------- -// CSConAppInstaller::DoCancel() -// Implementation of CActive::DoCancel() -// ----------------------------------------------------------------------------- -// -void CSConAppInstaller::DoCancel() - { - TRACE_FUNC_ENTRY; - - switch (iInstallerState) - { - case EInstalling: - LOGGER_WRITE("Cancel normal install"); - iSWInst.CancelAsyncRequest( SwiUI::ERequestInstall ); - break; - case ESilentInstalling: - LOGGER_WRITE("Cancel silent install"); - iSWInst.CancelAsyncRequest( SwiUI::ERequestSilentInstall ); - break; - case EUninstalling: - LOGGER_WRITE("Cancel normal uninstall"); - iSWInst.CancelAsyncRequest( SwiUI::ERequestUninstall ); - break; - case ESilentUninstalling: - LOGGER_WRITE("Cancel silent uninstall"); - iSWInst.CancelAsyncRequest( SwiUI::ERequestSilentUninstall ); - break; - case ECustomUninstalling: - LOGGER_WRITE("Cancel custom uninstall"); - iSWInst.CancelAsyncRequest( SwiUI::ERequestCustomUninstall ); - break; - case ESilentCustomUnistalling: - LOGGER_WRITE("Cancel silent custom uninstall"); - iSWInst.CancelAsyncRequest( SwiUI::ERequestSilentCustomUninstall ); - break; - default: - LOGGER_WRITE("WARNING! Unknown state"); - break; - } - iInstallerState = EIdle; - - // find and complete current task - CSConTask* task = NULL; - TInt ret = iQueue->GetTask( iCurrentTask, task ); - - if ( iCurrentTask > 0 && ret != KErrNotFound ) - { - - switch( task->GetServiceId() ) - { - case EInstall : - iQueue->CompleteTask( iCurrentTask, KErrCancel ); - break; - case EUninstall : - iQueue->CompleteTask( iCurrentTask, KErrCancel ); - break; - default : - break; - } - } - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConAppInstaller::RunL() -// Implementation of CActive::RunL() -// ----------------------------------------------------------------------------- -// -void CSConAppInstaller::RunL() - { - TRACE_FUNC_ENTRY; - iInstallerState = EIdle; - iSWInst.Close(); - iQueue->ChangeQueueProcessStatus(); - TInt err( iStatus.Int() ); - LOGGER_WRITE_1( "CSConAppInstaller::RunL() iStatus.Int() : returned %d", err ); - - CSConTask* task = NULL; - TInt taskErr = iQueue->GetTask( iCurrentTask, task ); - - LOGGER_WRITE_1( "CSConAppInstaller::RunL() GetTask %d", taskErr ); - - if( taskErr == KErrNone ) - { - if( task->GetServiceId() == EInstall && err == KErrNone ) - { - LOGGER_WRITE( "CSConAppInstaller::RunL() : before DeleteFile" ); - //delete sis after succesfull install - DeleteFile( task->iInstallParams->iPath ); - } - } - - iQueue->CompleteTask( iCurrentTask, err ); - TRACE_FUNC_EXIT; - } - - -// ----------------------------------------------------------------------------- -// CSConAppInstaller::ProcessUninstallL( const CSConUninstall& aUninstallParams ) -// Execures UnInstall task -// ----------------------------------------------------------------------------- -// -void CSConAppInstaller::ProcessUninstallL( const CSConUninstall& aUninstallParams ) - { - TRACE_FUNC_ENTRY; - LOGGER_WRITE_1( "aUid: 0x%08x", aUninstallParams.iUid.iUid ); - LOGGER_WRITE_1( "aName: %S", &aUninstallParams.iName ); - LOGGER_WRITE_1( "aVendor: %S", &aUninstallParams.iVendor ); - LOGGER_WRITE_1( "aType: %d", aUninstallParams.iType ); - LOGGER_WRITE_1( "aMode: %d", aUninstallParams.iMode ); - switch ( aUninstallParams.iType ) - { - case ESisApplication: - case ESisAugmentation: - UninstallSisL( aUninstallParams ); - break; - case EJavaApplication: - UninstallJavaL( aUninstallParams.iUid, - aUninstallParams.iMode); - break; - case EWidgetApplication: - UninstallWidget( aUninstallParams.iUid, - aUninstallParams.iMode ); - break; - default: - User::Leave( KErrNotSupported ); - } - - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConAppInstaller::UninstallSisL( const CSConUninstall& aUninstallParams ) -// Uninstall sis package or augmentation -// ----------------------------------------------------------------------------- -// -void CSConAppInstaller::UninstallSisL( const CSConUninstall& aUninstallParams ) - { - TRACE_FUNC_ENTRY; - - if ( aUninstallParams.iUid == KSConSeConUid ) - { - LOGGER_WRITE("Cannot uninstall itself, leave"); - // cannot uninstall itself - User::Leave( SwiUI::KSWInstErrFileInUse ); - } - - Swi::RSisRegistrySession sisRegistry; - User::LeaveIfError( sisRegistry.Connect() ); - CleanupClosePushL( sisRegistry ); - //Check if uid belongs to SIS package - if( !sisRegistry.IsInstalledL( aUninstallParams.iUid ) ) - { - CleanupStack::PopAndDestroy( &sisRegistry ); - User::Leave( KErrNotFound ); - } - - Swi::RSisRegistryEntry entry; - CleanupClosePushL(entry); - User::LeaveIfError( entry.Open( sisRegistry, aUninstallParams.iUid ) ); - if ( aUninstallParams.iType == ESisAugmentation ) - { - // augmentation pkg - LOGGER_WRITE( "CSConAppInstaller::ProcessUninstallL ESisAugmentation" ); - - TBool augmentationFound(EFalse); - // Get possible augmentations - RPointerArray augPackages; - CleanupResetAndDestroyPushL( augPackages ); - entry.AugmentationsL( augPackages ); - for ( TInt j( 0 ); j < augPackages.Count() && !augmentationFound; j++ ) - { - Swi::RSisRegistryEntry augmentationEntry; - CleanupClosePushL( augmentationEntry ); - augmentationEntry.OpenL( sisRegistry, *augPackages[j] ); - - HBufC* augPackageName = augmentationEntry.PackageNameL(); - CleanupStack::PushL( augPackageName ); - HBufC* augUniqueVendorName = augmentationEntry.UniqueVendorNameL(); - CleanupStack::PushL( augUniqueVendorName ); - - if ( !augmentationEntry.IsInRomL() - && augmentationEntry.IsPresentL() - && aUninstallParams.iName.Compare( *augPackageName ) == 0 - && aUninstallParams.iVendor.Compare( *augUniqueVendorName ) == 0 ) - { - // Correct augmentation found, uninstall it. - augmentationFound = ETrue; - TInt augmentationIndex = augPackages[j]->Index(); - LOGGER_WRITE_1( "CSConAppInstaller::ProcessUninstallL augmentationIndex %d", augmentationIndex ); - - SwiUI::TOpUninstallIndexParam params; - params.iUid = aUninstallParams.iUid; - params.iIndex = augmentationIndex; - SwiUI::TOpUninstallIndexParamPckg pckg( params ); - SwiUI::TOperation operation( SwiUI::EOperationUninstallIndex ); - if( aUninstallParams.iMode == ESilentInstall ) - { - LOGGER_WRITE( "CSConAppInstaller::ProcessUninstallL : silent aug-sis-uninstall" ); - SwiUI::TUninstallOptionsPckg options; - iInstallerState = ESilentCustomUnistalling; - iSWInst.SilentCustomUninstall( iStatus, operation, options, pckg, KSISMIMEType ); - } - else - { - LOGGER_WRITE( "CSConAppInstaller::ProcessUninstallL : unsilent aug-sis-uninstall" ) - iInstallerState = ECustomUninstalling; - iSWInst.CustomUninstall( iStatus, operation, pckg, KSISMIMEType ); - } - } - CleanupStack::PopAndDestroy( augUniqueVendorName ); - CleanupStack::PopAndDestroy( augPackageName ); - CleanupStack::PopAndDestroy( &augmentationEntry ); - } - CleanupStack::PopAndDestroy( &augPackages ); - - if ( !augmentationFound ) - { - LOGGER_WRITE( "CSConAppInstaller::ProcessUninstallL augmentation not found -> Leave" ); - User::Leave( KErrNotFound ); - } - } - else - { - // Only uninstall if not in rom and is present - if ( !entry.IsInRomL() && entry.IsPresentL() ) - { - if ( aUninstallParams.iMode == ESilentInstall ) - { - LOGGER_WRITE( "CSConAppInstaller::ProcessUninstallL : silent sis-uninstall" ); - SwiUI::TUninstallOptionsPckg options; - iInstallerState = ESilentUninstalling; - iSWInst.SilentUninstall( iStatus, aUninstallParams.iUid, options, KSISMIMEType ); - } - else - { - LOGGER_WRITE( "CSConAppInstaller::ProcessUninstallL : unsilent sis-uninstall" ) - iInstallerState = EUninstalling; - iSWInst.Uninstall( iStatus, aUninstallParams.iUid, KSISMIMEType ); - } - } - else - { - LOGGER_WRITE( "CSConAppInstaller::ProcessUninstallL sis not present -> Leave" ); - User::Leave( KErrNotFound ); - } - } - - CleanupStack::PopAndDestroy( &entry ); - CleanupStack::PopAndDestroy( &sisRegistry ); - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConAppInstaller::UninstallJavaL( const TUid& aUid, const TSConInstallMode aMode ) -// Uninstall java package -// ----------------------------------------------------------------------------- -// -void CSConAppInstaller::UninstallJavaL( const TUid& aUid, const TSConInstallMode aMode ) - { - TRACE_FUNC_ENTRY; - CJavaRegistry* javaRegistry = CJavaRegistry::NewLC( ); - TBool entryExist = javaRegistry->RegistryEntryExistsL( aUid ); - CleanupStack::PopAndDestroy( javaRegistry ); - - if( entryExist ) - { - if( aMode == ESilentInstall ) - { - LOGGER_WRITE( "CSConAppInstaller::UninstallJavaL : silent midlet-uninstall" ) - SwiUI::TUninstallOptionsPckg options; - iInstallerState = ESilentUninstalling; - iSWInst.SilentUninstall( iStatus, aUid, options, KMidletMIMEType ); - } - else - { - LOGGER_WRITE( "CSConAppInstaller::UninstallJavaL : unsilent midlet-uninstall" ) - iInstallerState = EUninstalling; - iSWInst.Uninstall( iStatus, aUid, KMidletMIMEType ); - } - } - else - { - LOGGER_WRITE( "CSConAppInstaller::UninstallJavaL java entry does not exist -> Leave" ) - User::Leave( KErrNotFound ); - } - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConAppInstaller::UninstallWidget( const TUid& aUid, const TSConInstallMode aMode ) -// Uninstall widget -// ----------------------------------------------------------------------------- -// -void CSConAppInstaller::UninstallWidget( const TUid& aUid, const TSConInstallMode aMode ) - { - TRACE_FUNC_ENTRY; - if( aMode == ESilentInstall ) - { - LOGGER_WRITE( "CSConAppInstaller::UninstallWidget : silent uninstall" ) - SwiUI::TUninstallOptionsPckg options; - iInstallerState = ESilentUninstalling; - iSWInst.SilentUninstall( iStatus, aUid, options, KWidgetMimeType ); - } - else - { - LOGGER_WRITE( "CSConAppInstaller::UninstallWidget : unsilent uninstall" ) - iInstallerState = EUninstalling; - iSWInst.Uninstall( iStatus, aUid, KWidgetMimeType ); - } - TRACE_FUNC_EXIT; - } - - -//-------------------------------------------------------------------------------- -//void CSConAppInstaller::ProcessListInstalledAppsL() -//-------------------------------------------------------------------------------- -// -void CSConAppInstaller::ProcessListInstalledAppsL() - { - TRACE_FUNC_ENTRY; - - CSConTask* task = NULL; - User::LeaveIfError( iQueue->GetTask( iCurrentTask, task ) ); - - SConPcdUtility::ProcessListInstalledAppsL( task ); - - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConAppInstaller::DeleteFile( const TDesC& aPath ) -// Deletes a file -// ----------------------------------------------------------------------------- -// -void CSConAppInstaller::DeleteFile( const TDesC& aPath ) - { - TRACE_FUNC; - iFs.Delete( aPath ); - } -// End of file diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/services/pcd/src/sconinstqueue.cpp --- a/connectivitymodules/SeCon/services/pcd/src/sconinstqueue.cpp Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,202 +0,0 @@ -/* -* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Installer Queue implementation -* -*/ - - -// INCLUDE FILES -#include "sconinstqueue.h" -#include "sconbrqueue.h" -#include "sconinstaller.h" -#include "sconpcdconsts.h" -#include "debug.h" - -// ============================= MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CCSConInstallerQueue* CSConInstallerQueue::NewL() -// Two-phase constructor -// ----------------------------------------------------------------------------- -// -CSConInstallerQueue* CSConInstallerQueue::NewL( RFs& aFs ) - { - TRACE_FUNC_ENTRY; - CSConInstallerQueue* self = new (ELeave) CSConInstallerQueue( aFs ); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - TRACE_FUNC_EXIT; - return self; - } - -// ----------------------------------------------------------------------------- -// CSConInstallerQueue::CSConInstallerQueue() -// Constructor -// ----------------------------------------------------------------------------- -// -CSConInstallerQueue::CSConInstallerQueue( RFs& aFs ) : CActive( EPriorityStandard ), iFs( aFs ) - { - } - -// ----------------------------------------------------------------------------- -// CSConInstallerQueue::ConstructL() -// Initializes member data -// ----------------------------------------------------------------------------- -// -void CSConInstallerQueue::ConstructL() - { - TRACE_FUNC_ENTRY; - iInstaller = new (ELeave) CSConAppInstaller( this, iFs ); - CActiveScheduler::Add( iInstaller ); - User::LeaveIfError( iTimer.CreateLocal() ); - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConInstallerQueue::~CSConInstallerQueue() -// Destructor -// ----------------------------------------------------------------------------- -// -CSConInstallerQueue::~CSConInstallerQueue() - { - TRACE_FUNC_ENTRY; - Cancel(); - if( iInstaller ) - { - iInstaller->Cancel(); - delete iInstaller; - iInstaller = NULL; - } - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConInstallerQueue::StartQueue() -// Starts queue polling -// ----------------------------------------------------------------------------- -// -void CSConInstallerQueue::StartQueue() - { - TRACE_FUNC; - if( IsActive() ) - { - Cancel(); - } - - iTimer.After( iStatus, KSConTimerValue ); - SetActive(); - } - -// ----------------------------------------------------------------------------- -// CSConInstallerQueue::StartQueue() -// Stops queue polling -// ----------------------------------------------------------------------------- -// -void CSConInstallerQueue::StopQueue() - { - TRACE_FUNC_ENTRY; - iTimer.Cancel(); - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConInstallerQueue::CancelTask( TInt aTask, TBool aAllTasks ) -// Cancels a task -// ----------------------------------------------------------------------------- -// -void CSConInstallerQueue::CancelTask( TInt aTask, TBool aAllTasks ) - { - TRACE_FUNC_ENTRY; - //Stop the installer - if( aTask && !aAllTasks ) - { - iInstaller->StopInstaller( aTask ); - } - - if( aAllTasks ) - { - iInstaller->Cancel(); - } - CSConTaskQueue::CancelTask( aTask, aAllTasks ); - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConInstallerQueue::QueueAddress( CSConBackupRestoreQueue*& aTaskQueue ) -// An address pointer to another queue -// ----------------------------------------------------------------------------- -// -void CSConInstallerQueue::QueueAddress( CSConBackupRestoreQueue*& aTaskQueue ) - { - TRACE_FUNC; - iBRQueueAddress = aTaskQueue; - } - -// ----------------------------------------------------------------------------- -// CSConInstallerQueue::PollQueue() -// Polls queue -// ----------------------------------------------------------------------------- -// -void CSConInstallerQueue::PollQueue() - { - TRACE_FUNC_ENTRY; - // find and start next task if installer and BR is inactive - if( !iInstaller->InstallerActive() - && !iBRQueueAddress->QueueProcessActive() ) - { - //find next task - for( TInt i = 0; i < iQueue.Count(); i++ ) - { - TBool complete = iQueue[i]->GetCompleteValue(); - - if( complete == EFalse ) - { - iInstaller->StartInstaller( iQueue[i]->iTaskId ); - i = iQueue.Count() + 1; // jump out from loop - } - } - } - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConInstallerQueue::DoCancel() -// Implementation of CActive::DoCancel() -// ----------------------------------------------------------------------------- -// -void CSConInstallerQueue::DoCancel() - { - TRACE_FUNC; - iTimer.Cancel(); - } - -// ----------------------------------------------------------------------------- -// CSConInstallerQueue::RunL() -// Implementation of CActive::RunL() -// ----------------------------------------------------------------------------- -// -void CSConInstallerQueue::RunL() - { - TRACE_FUNC_ENTRY; - LOGGER_WRITE_1( "There are still %d tasks in this queue", iQueue.Count() ); - if( iQueue.Count() > 0 ) - { - PollQueue(); - StartQueue(); - } - TRACE_FUNC_EXIT; - } - -// End of file diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/services/pcd/src/sconmetadata.cpp --- a/connectivitymodules/SeCon/services/pcd/src/sconmetadata.cpp Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1351 +0,0 @@ -/* -* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: SConMetadata implementation -* -*/ - - -// INCLUDE FILES - -#include // for CnvUtfConverter -#include -#include -#include -#include -#include -#include -#include - -#include "sconmetadata.h" -#include "sconconmltask.h" -#include "sconpcdconsts.h" -#include "sconvideoparser.h" -#include "debug.h" -#include "sconmetadatafielddefs.h" - - - -const TInt KBufferSize(1024); -// Size of buffer to load from file start to get EXIF thumbnail -const TInt KJpegLoadBufferSize = 65536; // 64k - - -const TUint32 KFieldMaxLength = 0xFFFFFFFF; // four bytes reserved for "length" information - -// GPS related Exif IDs -const TUint16 KGPSLatitudeRef = 0x01; -const TUint16 KGPSLatitude = 0x02; -const TUint16 KGPSLongitudeRef = 0x03; -const TUint16 KGPSLongitude = 0x04; -const TUint16 KGPSAltitudeRef = 0x05; -const TUint16 KGPSAltitude = 0x06; - - -// extensions for exif parser -_LIT(KJpgExt, ".jpg"); -_LIT(KJpegExt, ".jpeg"); -// extensions for audio metadata parser -_LIT(KAacExt, ".aac"); -_LIT(KMp3Ext, ".mp3"); -_LIT(KMp4Ext, ".mp4"); -_LIT(KWmaExt, ".wma"); -// extensions for video metadata parser -_LIT(KM4aExt, ".m4a"); -_LIT(K3gpExt, ".3gp"); - - -// ============================= MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// SConMetadata::ProcessTask() -// ProcessTask -// ----------------------------------------------------------------------------- -// -void SConMetadata::ProcessTask( CSConTask& aTask, RFs& aFs ) - { - TRACE_FUNC_ENTRY; - TInt err(KErrNone); - if ( aTask.GetServiceId() == EGetMetadata ) - { - LOGGER_WRITE_1( "SConMetadata::ProcessTask() : file %S", - &aTask.iGetMetadataParams->iFilename ); - -#ifdef _DEBUG - LOGGER_WRITE( "start.. " ); - TTimeIntervalMicroSeconds sec; - TTime start; - TTime end; - start.HomeTime(); -#endif - - TParsePtrC filename( aTask.iGetMetadataParams->iFilename ); - - if ( filename.Ext().CompareF( KJpgExt ) == 0 - || filename.Ext().CompareF( KJpegExt ) == 0 ) - { - // jpg file, try to read exif - LOGGER_WRITE( "jpg file, Try to read exif" ); - TRAP( err, ReadExifDataL( aTask, aFs ) ); - } - else if ( filename.Ext().CompareF( KMp4Ext ) == 0 - || filename.Ext().CompareF( K3gpExt ) == 0 ) - { - LOGGER_WRITE( "Try to read video" ); - TRAP( err, GetVideoMetadataL( aTask, aFs ) ); - } - else if ( filename.Ext().CompareF( KAacExt ) == 0 - || filename.Ext().CompareF( KM4aExt ) == 0 - || filename.Ext().CompareF( KMp3Ext ) == 0 - || filename.Ext().CompareF( KWmaExt ) == 0 ) - { - - // audio file, try to read audio - LOGGER_WRITE( "Try to read audio" ); - TRAP( err, GetAudioMetadataL( aTask ) ); - } - else - { - LOGGER_WRITE( "File extension not supported" ); - err = KErrNotSupported; - } - -#ifdef _DEBUG - end.HomeTime(); - sec = end.MicroSecondsFrom( start ); - - LOGGER_WRITE_1( "trapErr %d", err ); - LOGGER_WRITE_1( "duration: %Ld", sec.Int64() ); -#endif - } - else - { - LOGGER_WRITE( "SConMetadata::ProcessTask() : not supported" ); - err = KErrNotSupported; - } - - LOGGER_WRITE( "SConMetadata::ProcessTask() : CompleteTask" ); - - TInt progress( KSConCodeTaskCompleted ); - TBool complete ( ETrue ); - switch( err ) - { - case KErrNone : - progress = KSConCodeTaskCompleted; - break; - case KErrNotFound : - case KErrBadName : - progress = KSConCodeNotFound; - break; - default : - progress = KSConCodeConflict; - break; - } - - aTask.SetCompleteValue( complete ); - aTask.SetProgressValue( progress ); - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// SConMetadata::GetAudioMetadataL() -// Read audio metadata -// ----------------------------------------------------------------------------- -// -void SConMetadata::GetAudioMetadataL( CSConTask& aTask ) - { - TRACE_FUNC_ENTRY; - CMetaDataUtility* metadataUtil = CMetaDataUtility::NewL(); - CleanupStack::PushL( metadataUtil ); - - LOGGER_WRITE( "SConMetadata::GetAudioMetadataL() : OpenFileL" ); - metadataUtil->OpenFileL( aTask.iGetMetadataParams->iFilename ); - - TInt count = metadataUtil->MetaDataCount(); - LOGGER_WRITE_1( "SConMetadata::GetAudioMetadataL() : MetaDataCount %d", count ); - if ( count > 0 ) - { - const CMetaDataFieldContainer& fields = metadataUtil->MetaDataFieldsL(); - count = fields.Count(); - - CBufFlat* buffer = CBufFlat::NewL( KBufferSize ); - CleanupStack::PushL( buffer ); - buffer->Reset(); - - - TInt offset(0); - // write object header - // Item type (1 byte) + Version (1 byte) = 2 bytes - buffer->ExpandL( offset, 2 ); - - // header id - TUint8 value( KSconMetadataHeaderAudio ); - buffer->Write( offset, TPtrC8(&value, 1) ); - offset++; - - // header version - value = KSconMetadataHeaderVersion; - buffer->Write( offset, TPtrC8(&value, 1) ); - offset++; - - // Add ID3 field - value = metadataUtil->ID3Version(); - AppendTUintDataFieldL( buffer, value, KSconAudioID3Version ); - - TMetaDataFieldId fieldId; - TPtrC fieldData; - - for ( TInt i = 0; i < count; i++ ) - { - // get field id - fields.FieldIdAt( i , fieldId ); - LOGGER_WRITE_2( "AudioFieldId( %d ): 0x%02x", i, fieldId ); - - if ( fieldId == EMetaDataJpeg ) - { - TPtrC8 field8( fields.Field8( fieldId ) ); - AppendByteDataFieldL( - buffer, - field8, - AudioFieldId( fieldId ) ); - } - else - { - // get field data and add UTF-8 formatted text to buffer - fieldData.Set( fields.At( i , fieldId ) ); - AppendUtf8DataFieldL( buffer, fieldData, AudioFieldId( fieldId ) ); - } - - } - - if ( buffer->Size() > 0 ) - { - LOGGER_WRITE_1( "SConMetadata::GetAudioMetadataL() : buffer->Size() %d", buffer->Size() ); - if ( aTask.iGetMetadataParams->iData ) - { - delete aTask.iGetMetadataParams->iData; - aTask.iGetMetadataParams->iData = NULL; - } - //Initialize the task data buffer - aTask.iGetMetadataParams->iData = HBufC8::NewL( buffer->Size() ); - TPtr8 dataPtr = aTask.iGetMetadataParams->iData->Des(); - - buffer->Read( 0, dataPtr, buffer->Size() ); - LOGGER_WRITE_1( "SConMetadata::GetAudioMetadataL() dataPtr len: %d", dataPtr.Length()); - } - CleanupStack::PopAndDestroy( buffer ); - } - - CleanupStack::PopAndDestroy( metadataUtil ); - - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// SConMetadata::GetVideoMetadataL() -// Read video metadata -// ----------------------------------------------------------------------------- -// -void SConMetadata::GetVideoMetadataL( CSConTask& aTask, RFs& aFs ) - { - TRACE_FUNC_ENTRY; - CBufFlat* buffer = CBufFlat::NewL( KBufferSize ); - CleanupStack::PushL( buffer ); - buffer->Reset(); - - TInt offset(0); - // write object header - // Item type (1 byte) + Version (1 byte) = 2 bytes - buffer->ExpandL( offset, 2 ); - - // header id - TUint8 value( KSconMetadataHeaderVideo ); - buffer->Write( offset, TPtrC8(&value, 1) ); - offset++; - - // header version - value = KSconMetadataHeaderVersion; - buffer->Write( offset, TPtrC8(&value, 1) ); - offset++; - - - CSConVideoParser* videoParser = CSConVideoParser::NewLC(); - - videoParser->OpenFileL( aFs, aTask.iGetMetadataParams->iFilename ); - LOGGER_WRITE( "Open completed" ); - - const TUint KFormatMaxLength = 100; - TBuf formatMimeType; - formatMimeType.Copy( videoParser->VideoFormatMimeTypeL() ); - LOGGER_WRITE_1( "formatMimeType: %S", &formatMimeType); - AppendUtf8DataFieldL( buffer, formatMimeType, KSconVideoFormat ); - - // we can't use TReal format, so convert frame rate to frames/ms (or 1000 frames/s) - TReal32 frameRate = videoParser->VideoFrameRateL(); - const TUint KFrameRateMultiplier = 1000; - TInt frm = frameRate * KFrameRateMultiplier; - LOGGER_WRITE_1( "frameRate: %f", frameRate ); - LOGGER_WRITE_1( "frm: %d", frm ); - AppendTUintDataFieldL( buffer, frm, KSconVideoFrameRate ); - - TSize size; - videoParser->VideoFrameSizeL( size ); - LOGGER_WRITE_2( "VideoFrameSizeL: %d, %d", size.iWidth, size.iHeight); - AppendTUintDataFieldL( buffer, size.iWidth, KSconVideoFrameSizeWidth ); - AppendTUintDataFieldL( buffer, size.iHeight, KSconVideoFrameSizeHeight ); - - - - const TUint8 KSconVideoAudioStreamMimetype ( 0x09 ); - const TUint8 KSconVideoVideoStreamMimetype ( 0x0a ); - - TInt videoBitRate = videoParser->VideoBitRateL(); - LOGGER_WRITE_1( "videoBitRate: %d", videoBitRate); - AppendTUintDataFieldL( buffer, videoBitRate, KSconVideoVideoBitRate ); - - TInt audioBitRate = videoParser->AudioBitRateL(); - LOGGER_WRITE_1( "audioBitRate: %d", audioBitRate); - AppendTUintDataFieldL( buffer, audioBitRate, KSconVideoAudioBitRate ); - - TInt durationMs = videoParser->DurationL(); - LOGGER_WRITE_1( "duration ms: %d", durationMs); - AppendTUintDataFieldL( buffer, durationMs, KSconVideoDuration ); - - TPtrC8 thumbnail = videoParser->Thumbnail(); - if ( thumbnail.Length() > 0 ) - { - AppendByteDataFieldL( buffer, thumbnail, KSconVideoThumbnail ); - } - - TPtrC audioMimeType = videoParser->AudioMimeTypeL(); - if ( audioMimeType.Length() > 0 ) - { - AppendUtf8DataFieldL( buffer, audioMimeType, KSconVideoAudioStreamMimetype ); - } - - TPtrC videoMimeType = videoParser->VideoMimeTypeL(); - if ( videoMimeType.Length() > 0 ) - { - AppendUtf8DataFieldL( buffer, formatMimeType, KSconVideoVideoStreamMimetype ); - } - - CleanupStack::PopAndDestroy( videoParser ); - LOGGER_WRITE( "videoParser deleted" ); - - - if ( buffer->Size() > 0 ) - { - if ( aTask.iGetMetadataParams->iData ) - { - delete aTask.iGetMetadataParams->iData; - aTask.iGetMetadataParams->iData = NULL; - } - //Initialize the task data buffer - aTask.iGetMetadataParams->iData = HBufC8::NewL( buffer->Size() ); - TPtr8 dataPtr = aTask.iGetMetadataParams->iData->Des(); - - buffer->Read( 0, dataPtr, buffer->Size() ); - } - CleanupStack::PopAndDestroy( buffer ); - - - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// SConMetadata::AudioFieldId() -// Map TMetaDataFieldId to KSconAudio field id -// ----------------------------------------------------------------------------- -// -TUint8 SConMetadata::AudioFieldId( const TMetaDataFieldId fieldId ) - { - TUint8 ret(NULL); - switch( fieldId ) - { - case EMetaDataSongTitle : - ret = KSconAudioTitle; - break; - case EMetaDataArtist : - ret = KSconAudioArtist; - break; - case EMetaDataAlbum : - ret = KSconAudioAlbum; - break; - case EMetaDataYear : - ret = KSconAudioYear; - break; - case EMetaDataComment : - ret = KSconAudioComment; - break; - case EMetaDataAlbumTrack : - ret = KSconAudioAlbumTrack; - break; - case EMetaDataGenre : - ret = KSconAudioGenre; - break; - case EMetaDataComposer : - ret = KSconAudioComposer; - break; - case EMetaDataCopyright : - ret = KSconAudioCopyright; - break; - case EMetaDataOriginalArtist : - ret = KSconAudioOriginalArtist; - break; - case EMetaDataUrl : - ret = KSconAudioUrl; - break; - case EMetaDataUserUrl : - ret = KSconAudioUserUrl; - break; - case EMetaDataJpeg : - ret = KSconAudioJpeg; - break; - case EMetaDataVendor : - ret = KSconAudioVendor; - break; - case EMetaDataRating : - ret = KSconAudioRating; - break; - case EMetaDataUniqueFileIdentifier : - ret = KSconAudioUniqueFileIdentifier; - break; - case EMetaDataDuration : - ret = KSconAudioDuration; - break; - case EMetaDataDate : - ret = KSconAudioDate; - break; - default : - LOGGER_WRITE( "SConMetadata::AudioFieldId : ERR field not defined!" ); - break; - } - return ret; - } - - -// ----------------------------------------------------------------------------- -// SConMetadata::GetExifTagL( CExifRead* aReader, const TUint8 aTagID ) -// This function is used to read exif data that might leave. -// ----------------------------------------------------------------------------- -// -HBufC8* SConMetadata::GetExifTagL( CExifRead* aReader, const TUint8 aTagID ) - { - TRACE_FUNC_ENTRY; - LOGGER_WRITE_1( " aTagID: 0x%02x", aTagID ); - HBufC8* tempBuf( NULL ); - - switch( aTagID ) - { - case KSconExifThumbnail: - tempBuf = aReader->GetThumbnailL(); - break; - case KSconExifDescription: - tempBuf = aReader->GetImageDescriptionL(); - break; - case KSconExifMake: - tempBuf = aReader->GetMakeL(); - break; - case KSconExifModel: - tempBuf = aReader->GetModelL(); - break; - case KSconExifDateTime: - tempBuf = aReader->GetDateTimeL(); - break; - case KSconExifSoftware: - tempBuf = aReader->GetSoftwareL(); - break; - case KSconExifCopyright: - tempBuf = aReader->GetCopyrightL(); - break; - case KSconExifIsoSpeedRatings: - tempBuf = aReader->GetIsoSpeedRatingsL(); - if ( tempBuf ) - { - TInt isoSpeed = ReadTUint32( tempBuf->Des() ); - LOGGER_WRITE_1(" isoSpeed: %d", isoSpeed); - delete tempBuf; - - const TInt maxLength(5); - // no need to push on cleanupstack as leave cannot - // happen before returning tempBuf. - tempBuf = HBufC8::NewL(maxLength); - TPtr8 temp = tempBuf->Des(); - temp.Num( isoSpeed ); - } - break; - case KSconExifDateTimeOriginal: - tempBuf = aReader->GetDateTimeOriginalL(); - break; - case KSconExifDateTimeDigitized: - tempBuf = aReader->GetDateTimeDigitizedL(); - break; - case KSconExifMakerNote: - // makernote contents are up to the manufacturer - // not needed. - User::Leave( KErrNotSupported ); - break; - case KSconExifUserComment: - tempBuf = aReader->GetUserCommentL(); - break; - case KSconExifRelatedSoundFile: - tempBuf = aReader->GetRelatedSoundFileL(); - break; - default: - User::Leave( KErrNotSupported ); - } - TRACE_FUNC_EXIT; - return tempBuf; - } - -// ----------------------------------------------------------------------------- -// SConMetadata::ReadTUint32() -// Convert 8-bit binary data to unsigned integer -// ----------------------------------------------------------------------------- -// -TUint32 SConMetadata::ReadTUint32( const TDesC8& aData ) - { - TRACE_FUNC_ENTRY; - TUint32 result = 0; - TUint8 c; - - for (TInt i=aData.Length()-1; i>=0; i--) - { - c = aData[i]; - result = (result << 8) | c; - } - - LOGGER_WRITE_1( "SConMetadata::ReadTUint32() : returned %d ", result ); - return result; - } - -// ----------------------------------------------------------------------------- -// SConMetadata::GetFileDataLC() -// Read data from file -// ----------------------------------------------------------------------------- -// -HBufC8* SConMetadata::GetFileDataLC( const TDesC& aFilename, RFs& aFs ) - { - TRACE_FUNC_ENTRY; - RFile file; - - User::LeaveIfError( file.Open( aFs, aFilename, - EFileRead | EFileShareReadersOnly ) ); - CleanupClosePushL( file ); - - LOGGER_WRITE( "SConMetadata::GetFileDataLC() : file opened" ); - - TInt dataSize(0); - ContentAccess::CContent* content; - content = ContentAccess::CContent::NewLC( file ); - ContentAccess::CData* data = content->OpenContentLC( ContentAccess::EPeek ); - data->DataSizeL(dataSize); - - LOGGER_WRITE( "SConMetadata::GetFileDataLC() : content opened" ); - // Read 64k from the beginning of the file - if ( dataSize > KJpegLoadBufferSize ) - { - dataSize = KJpegLoadBufferSize; - } - HBufC8* readBuffer = HBufC8::NewLC( dataSize ); - TPtr8 readPtr = readBuffer->Des(); - User::LeaveIfError( data->Read( readPtr, dataSize ) ); - - LOGGER_WRITE( "SConMetadata::GetFileDataLC() : data readed" ); - CleanupStack::Pop( readBuffer ); - CleanupStack::PopAndDestroy( data ); - CleanupStack::PopAndDestroy( content ); - CleanupStack::PopAndDestroy( &file ); - - CleanupStack::PushL( readBuffer ); - - return readBuffer; - } - -// ----------------------------------------------------------------------------- -// SConMetadata::ReadExifDataL() -// Read Exif data -// ----------------------------------------------------------------------------- -// -void SConMetadata::ReadExifDataL( CSConTask& aTask, RFs& aFs ) - { - TRACE_FUNC_ENTRY; - - // read data from file - HBufC8* jpegReadBuffer = GetFileDataLC( aTask.iGetMetadataParams->iFilename, aFs ); - - CExifRead* reader = CExifRead::NewL( - *jpegReadBuffer, CExifRead::ENoJpeg | CExifRead::ENoTagChecking ); - - LOGGER_WRITE( "SConMetadata::ReadExifDataL() : reader created" ); - CleanupStack::PopAndDestroy( jpegReadBuffer ); - CleanupStack::PushL( reader ); - - - CBufFlat* buffer = CBufFlat::NewL( KBufferSize ); - CleanupStack::PushL( buffer ); - buffer->Reset(); - - - TInt offset(0); - // header id (1 byte) + head.version (1 byte) = 2 bytes - - buffer->ExpandL( offset, 2 ); - - // header id - TUint8 value( KSconMetadataHeaderExif ); - buffer->Write( offset, TPtrC8(&value, 1) ); - offset++; - - // header version - value = KSconMetadataHeaderVersion; - buffer->Write( offset, TPtrC8(&value, 1) ); - offset++; - - - HBufC8* tempBuf(NULL); - - TInt err; - - for ( TInt tagID = KSconExifThumbnail; tagID < KSconExifGpsVersion; tagID++ ) - { - // GetExifTagL function is used only to tags that leaves if data is not found - TRAP( err, tempBuf = GetExifTagL( reader, tagID ) ); - if ( !err ) - { - LOGGER_WRITE("write to buffer"); - CleanupStack::PushL( tempBuf ); - AppendByteDataFieldL( buffer, tempBuf->Des(), tagID ); - CleanupStack::PopAndDestroy( tempBuf ); - tempBuf = NULL; - } - else - { - LOGGER_WRITE_1( "GetExifTagL Leave code %d", err ); - } - } - - - TUint16 value16a; - TUint32 value32a; - TUint32 value32b; - TInt32 val32a; - TInt32 val32b; - - // Orientation - err = reader->GetOrientation( value16a ); - if ( !err ) - { - AppendTUintDataFieldL( buffer, value16a, KSconExifOrientation ); - } - - // XResolution - err = reader->GetXResolution( value32a, value32b ); - if ( !err ) - { - AppendTUintDataFieldL( buffer, value32a, KSconExifXResolution1 ); - AppendTUintDataFieldL( buffer, value32b, KSconExifXResolution2 ); - } - - // YResolution - err = reader->GetYResolution( value32a, value32b ); - if ( !err ) - { - AppendTUintDataFieldL( buffer, value32a, KSconExifYResolution1 ); - AppendTUintDataFieldL( buffer, value32b, KSconExifYResolution2 ); - } - - // ResolutionUnit - err = reader->GetResolutionUnit( value16a ); - if ( !err ) - { - AppendTUintDataFieldL( buffer, value16a, KSconExifResolutionUnit ); - } - - // YCbCrPositioning - err = reader->GetYCbCrPositioning( value16a ); - if ( !err ) - { - AppendTUintDataFieldL( buffer, value16a, KSconExifYCbCrPositioning ); - } - - // YCbCrPositioning - err = reader->GetYCbCrPositioning( value16a ); - if ( !err ) - { - AppendTUintDataFieldL( buffer, value16a, KSconExifYCbCrPositioning ); - } - - - // ExposureTime - err = reader->GetExposureTime( value32a, value32b ); - if ( !err ) - { - AppendTUintDataFieldL( buffer, value32a, KSconExifExposureTime1 ); - AppendTUintDataFieldL( buffer, value32b, KSconExifExposureTime2 ); - } - - // ComponentsConfiguration - TUint8 value8a; - TUint8 value8b; - TUint8 value8c; - TUint8 value8d; - err = reader->GetComponentsConfiguration( value8a, value8b, value8c, value8d ); - if ( !err ) - { - TInt offset; - offset = buffer->Size(); - - // field ID (1 byte) + field lenght (4 bytes) + field data (4bytes) = 9 bytes - buffer->ExpandL( offset, 9 ); - - // field id (one byte) - TUint8 fieldId( KSconExifComponentsConfiguration ); - buffer->Write( offset, TPtrC8( &fieldId, 1 ) ); - offset++; - - // field lenght - WriteTUint32( buffer, offset, 4); - offset += 4; - - buffer->Write( offset, TPtrC8(&value8a, 1) ); - offset++; - buffer->Write( offset, TPtrC8(&value8b, 1) ); - offset++; - buffer->Write( offset, TPtrC8(&value8c, 1) ); - offset++; - buffer->Write( offset, TPtrC8(&value8d, 1) ); - offset++; - } - - // Flash - err = reader->GetFlash( value16a ); - if ( !err ) - { - AppendTUintDataFieldL( buffer, value16a, KSconExifFlash ); - } - - // ColorSpace - err = reader->GetColorSpace( value16a ); - if ( !err ) - { - AppendTUintDataFieldL( buffer, value16a, KSconExifColorSpace ); - } - - // PixelXDimension - err = reader->GetPixelXDimension( value32a ); - if ( !err ) - { - AppendTUintDataFieldL( buffer, value32a, KSconExifPixelXDimension ); - } - - // PixelYDimension - err = reader->GetPixelYDimension( value32a ); - if ( !err ) - { - AppendTUintDataFieldL( buffer, value32a, KSconExifPixelYDimension ); - } - - // ExposureMode - err = reader->GetExposureMode( value16a ); - if ( !err ) - { - AppendTUintDataFieldL( buffer, value16a, KSconExifExposureMode ); - } - - // WhiteBalance - err = reader->GetWhiteBalance( value16a ); - if ( !err ) - { - AppendTUintDataFieldL( buffer, value16a, KSconExifWhiteBalance ); - } - - // SceneCaptureType - err = reader->GetSceneCaptureType( value16a ); - if ( !err ) - { - AppendTUintDataFieldL( buffer, value16a, KSconExifSceneCaptureType ); - } - - // ExposureProgram - err = reader->GetExposureProgram( value16a ); - if ( !err ) - { - AppendTUintDataFieldL( buffer, value16a, KSconExifExposureProgram ); - } - - // GetApertureValue - err = reader->GetApertureValue( value32a, value32b ); - if ( !err ) - { - AppendTUintDataFieldL( buffer, value32a, KSconExifApertureValue1 ); - AppendTUintDataFieldL( buffer, value32b, KSconExifApertureValue2 ); - } - - // GetExposureBiasValue - err = reader->GetExposureBiasValue( val32a, val32b ); - if ( !err ) - { - value32a = val32a; - value32b = val32b; - AppendTUintDataFieldL( buffer, value32a, KSconExifExposureBiasValue1 ); - AppendTUintDataFieldL( buffer, value32b, KSconExifExposureBiasValue2 ); - } - - // GetMeteringMode - err = reader->GetMeteringMode( value16a ); - if ( !err ) - { - AppendTUintDataFieldL( buffer, value16a, KSconExifMeteringMode ); - } - - // GetLightSource - err = reader->GetLightSource( value16a ); - if ( !err ) - { - AppendTUintDataFieldL( buffer, value16a, KSconExifLightSource ); - } - - // GetFileSource - TInt8 val8; - err = reader->GetFileSource( val8 ); - if ( !err ) - { - value8a = val8; - AppendTUintDataFieldL( buffer, value8a, KSconExifFileSource ); - } - - // GetDigitalZoomRatio - err = reader->GetDigitalZoomRatio( value32a, value32b ); - if ( !err ) - { - AppendTUintDataFieldL( buffer, value32a, KSconExifDigitalZoomRatio1 ); - AppendTUintDataFieldL( buffer, value32b, KSconExifDigitalZoomRatio2 ); - } - - // GetContrast - err = reader->GetContrast( value16a ); - if ( !err ) - { - AppendTUintDataFieldL( buffer, value16a, KSconExifContrast ); - } - - // GetSaturation - err = reader->GetSaturation( value16a ); - if ( !err ) - { - AppendTUintDataFieldL( buffer, value16a, KSconExifSaturation ); - } - - // GetSharpness - err = reader->GetSharpness( value16a ); - if ( !err ) - { - AppendTUintDataFieldL( buffer, value16a, KSconExifSharpness ); - } - - // GetExifVersion - err = reader->GetExifVersion( value32a ); - if ( !err ) - { - AppendTUintDataFieldL( buffer, value32a, KSconExifExifVersion ); - } - - // GetFlashPixVersion - err = reader->GetFlashPixVersion( value32a ); - if ( !err ) - { - AppendTUintDataFieldL( buffer, value32a, KSconExifFlashPixVersion ); - } - - // GetThumbnailXResolution - err = reader->GetThumbnailXResolution( value32a, value32b ); - if ( !err ) - { - AppendTUintDataFieldL( buffer, value32a, KSconExifThumbXResolution1 ); - AppendTUintDataFieldL( buffer, value32b, KSconExifThumbXResolution2 ); - } - - // GetThumbnailYResolution - err = reader->GetThumbnailYResolution( value32a, value32b ); - if ( !err ) - { - AppendTUintDataFieldL( buffer, value32a, KSconExifThumbYResolution1 ); - AppendTUintDataFieldL( buffer, value32b, KSconExifThumbYResolution2 ); - } - - // GetThumbnailResolutionUnit - err = reader->GetThumbnailResolutionUnit( value16a ); - if ( !err ) - { - AppendTUintDataFieldL( buffer, value16a, KSconExifThumbResolutionUnit ); - } - - // GetThumbnailCompression - err = reader->GetThumbnailCompression( value16a ); - if ( !err ) - { - AppendTUintDataFieldL( buffer, value16a, KSconExifThumbCompression ); - } - - // GetJpegInterchangeFormat - err = reader->GetJpegInterchangeFormat( value32a ); - if ( !err ) - { - AppendTUintDataFieldL( buffer, value32a, KSconExifThumbJpegInterchangeFormat ); - } - - // GetJpegInterchangeFormatLength - err = reader->GetJpegInterchangeFormatLength( value32a ); - if ( !err ) - { - AppendTUintDataFieldL( buffer, value32a, KSconExifThumbJpegInterchangeFormatLength ); - } - - // GetShutterSpeedValue - err = reader->GetShutterSpeedValue( val32a, val32b ); - if ( !err ) - { - value32a = val32a; - value32b = val32b; - AppendTUintDataFieldL( buffer, value32a, KSconExifShutterSpeedValue1 ); - AppendTUintDataFieldL( buffer, value32b, KSconExifShutterSpeedValue2 ); - } - - // GetBrightnessValue - err = reader->GetBrightnessValue( val32a, val32b ); - if ( !err ) - { - value32a = val32a; - value32b = val32b; - AppendTUintDataFieldL( buffer, value32a, KSconExifBrightnessValue1 ); - AppendTUintDataFieldL( buffer, value32b, KSconExifBrightnessValue2 ); - } - - // GetCustomRendered - err = reader->GetCustomRendered( value16a ); - if ( !err ) - { - AppendTUintDataFieldL( buffer, value16a, KSconExifCustomRendered ); - } - - // GetGainControl - err = reader->GetGainControl( value16a ); - if ( !err ) - { - AppendTUintDataFieldL( buffer, value16a, KSconExifGainControl ); - } - - // GetGpsVersion - err = reader->GetGpsVersion( value32a ); - if ( !err ) - { - AppendTUintDataFieldL( buffer, value32a, KSconExifGpsVersion ); - } - - // Get GPS coordinates - const TUint KCoordinatesMaxLength = 50; - TBuf gpsInfo; - // Latidute - err = GetExifGPSLatitudeL( *reader, gpsInfo ); - if ( !err ) - { - AppendUtf8DataFieldL( buffer, gpsInfo ,KSconExifGPSLatitude ); - } - - // Longitude - err = GetExifGPSLongitudeL( *reader, gpsInfo ); - if ( !err ) - { - AppendUtf8DataFieldL( buffer, gpsInfo ,KSconExifGPSLongitude ); - } - - // Altidute - err = GetExifGPSAltiduteL( *reader, gpsInfo ); - if ( !err ) - { - AppendUtf8DataFieldL( buffer, gpsInfo ,KSconExifGPSAltitude ); - } - - LOGGER_WRITE( "SConMetadata::ReadExifDataL() : All data collected" ); - - if ( buffer->Size() > 0 ) - { - LOGGER_WRITE_1( "SConMetadata::ReadExifDataL() : buffer->Size() %d", buffer->Size() ); - if ( aTask.iGetMetadataParams->iData ) - { - delete aTask.iGetMetadataParams->iData; - aTask.iGetMetadataParams->iData = NULL; - } - //Initialize the task data buffer - aTask.iGetMetadataParams->iData = HBufC8::NewL( buffer->Size() ); - TPtr8 dataPtr = aTask.iGetMetadataParams->iData->Des(); - - buffer->Read( 0, dataPtr, buffer->Size() ); - LOGGER_WRITE_1( "SConMetadata::ReadExifDataL() dataPtr len: %d", dataPtr.Length()); - } - CleanupStack::PopAndDestroy( buffer ); - - LOGGER_WRITE( "SConMetadata::ReadExifDataL() : task updated" ); - - CleanupStack::PopAndDestroy( reader ); - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// void SConMetadata::ConvertRationalTag( const CExifTag& aTag, TDes& aPosDegrees ) -// parses degrees, minutes and seconds from CExifTag and converts it to string format -// ----------------------------------------------------------------------------- -// -TInt SConMetadata::ConvertRationalTag( const CExifTag& aTag, TDes& aPosDegrees ) - { - TRACE_FUNC_ENTRY; - TInt numer(0); - TInt denom(0); - TReal64 degrees(0); - TReal64 minutes(0); - TReal64 seconds(0); - - const TUint8* ratData = aTag.Data().Ptr(); - for ( TUint y=0; y < aTag.TagInfo().iDataCount; y++ ) - { - numer = 0; - denom = 0; - Mem::Copy(&numer, ratData + ((y * 2) * sizeof(numer)), sizeof(numer)); - Mem::Copy(&denom, ratData + (((y * 2) + 1) * sizeof(numer)), sizeof(denom)); - - if ( y == 0 )// degrees - { - degrees = numer/denom; - } - else if ( y == 1 )// minutes - { - minutes = numer/denom; - } - else if ( y == 2 )// seconds - { - seconds = numer/denom; - } - } - _LIT(KFormat, "%.0f°%.0f'%.2f\"" ); - aPosDegrees.Format( KFormat, degrees, minutes, seconds ); - TRACE_FUNC_EXIT; - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// void SConMetadata::GetExifGPSLatitudeL( CExifRead& aExifRead, TDes& aLatitude ) -// Read latidute from ExifReader -// ----------------------------------------------------------------------------- -// -TInt SConMetadata::GetExifGPSLatitudeL( CExifRead& aExifRead, TDes& aLatitude ) - { - TRACE_FUNC_ENTRY; - TInt ret(KErrNone); - if ( aExifRead.TagExists( KGPSLatitudeRef, EIfdGps ) - && aExifRead.TagExists( KGPSLatitude, EIfdGps) ) - { - // get latidute - const CExifTag* lat = aExifRead.GetTagL( - EIfdGps, - KGPSLatitude ); - User::LeaveIfError( ConvertRationalTag( *lat, aLatitude ) ); - if ( aLatitude.Length()+2 > aLatitude.MaxLength() ) - { - User::Leave( KErrTooBig ); - } - - // south or north - const CExifTag* latRef = aExifRead.GetTagL( - EIfdGps, - KGPSLatitudeRef ); - _LIT8( KNorthTagDef8, "N" ); - _LIT( KNorth, "N " ); - _LIT( KSouth, "S " ); - if ( latRef->Data().Find( KNorthTagDef8 ) != KErrNotFound ) - { - aLatitude.Insert( 0, KNorth ); - } - else - { - aLatitude.Insert( 0, KSouth ); - } - } - else - { - ret=KErrNotFound; - } - TRACE_FUNC_EXIT; - return ret; - } - -// ----------------------------------------------------------------------------- -// void SConMetadata::GetExifGPSLongitudeL( CExifRead& aExifRead, TDes& aLongitude ) -// Read longitude from ExifReader -// ----------------------------------------------------------------------------- -// -TInt SConMetadata::GetExifGPSLongitudeL( CExifRead& aExifRead, TDes& aLongitude ) - { - TRACE_FUNC_ENTRY; - TInt ret(KErrNone); - if ( aExifRead.TagExists( KGPSLongitudeRef, EIfdGps ) - && aExifRead.TagExists( KGPSLongitude, EIfdGps) ) - { - // get longitude - const CExifTag* lon = aExifRead.GetTagL( - EIfdGps, - KGPSLongitude ); - User::LeaveIfError( ConvertRationalTag( *lon, aLongitude ) ); - if ( aLongitude.Length()+2 > aLongitude.MaxLength() ) - { - User::Leave( KErrTooBig ); - } - - // east or west - const CExifTag* lonref = aExifRead.GetTagL( - EIfdGps, - KGPSLongitudeRef ); - _LIT8( KEastTagDef8, "E" ); - _LIT( KEast, "E " ); - _LIT( KWest, "W " ); - if ( lonref->Data().Find( KEastTagDef8 ) != KErrNotFound ) - { - aLongitude.Insert( 0, KEast ); - } - else - { - aLongitude.Insert( 0, KWest ); - } - } - else - { - ret = KErrNotFound; - } - TRACE_FUNC_EXIT; - return ret; - } - -// ----------------------------------------------------------------------------- -// void SConMetadata::GetExifGPSAltiduteL( CExifRead& aExifRead, TDes& aAltidute ) -// Read altidute from ExifReader -// ----------------------------------------------------------------------------- -// -TInt SConMetadata::GetExifGPSAltiduteL( CExifRead& aExifRead, TDes& aAltidute ) - { - TRACE_FUNC_ENTRY; - - TInt ret(KErrNone); - if ( aExifRead.TagExists( KGPSAltitudeRef, EIfdGps ) - && aExifRead.TagExists( KGPSAltitude, EIfdGps) ) - { - if ( aAltidute.MaxLength() < 5 ) - { - User::Leave( KErrTooBig ); - } - - // get altidute - const CExifTag* alt = aExifRead.GetTagL( - EIfdGps, - KGPSAltitude ); - const TUint8* ratData = alt->Data().Ptr(); - - TInt numer; - TInt denom; - Mem::Copy(&numer, ratData , sizeof(numer)); - Mem::Copy(&denom, ratData + (sizeof(numer)), sizeof(denom)); - - TReal32 tmp = numer / denom; - - // sea level - const CExifTag* altref = aExifRead.GetTagL( - EIfdGps, - KGPSAltitudeRef ); - _LIT8( KAltSealevelDef8, "1" ); - if ( altref->Data().Find( KAltSealevelDef8 ) != KErrNotFound ) - { - // seaLevelReference -> negative value - tmp *= -1; - } - TRealFormat format; - format.iType = KRealFormatFixed; - format.iPlaces=1; - User::LeaveIfError( aAltidute.Num( tmp, format ) ); - } - else - { - ret = KErrNotFound; - } - TRACE_FUNC_EXIT; - return ret; - } - -// ----------------------------------------------------------------------------- -// void SConMetadata::AppendUtf8DataFieldL( CBufFlat* aBuffer, -// const TPtrC aAppendData, const TUint8 aFieldId ) -// Write 8bit field id value, data length (32bit) and UTF8 data to buffer -// ----------------------------------------------------------------------------- -// -void SConMetadata::AppendUtf8DataFieldL( CBufFlat* aBuffer, - const TPtrC aAppendData, const TUint8 aFieldId ) - { - TRACE_FUNC_ENTRY; - LOGGER_WRITE_1( "aFieldId: 0x%02x", aFieldId); - HBufC8* tempBuf = HBufC8::NewLC( aAppendData.Size() ); - TPtr8 temp = tempBuf->Des(); - - CnvUtfConverter::ConvertFromUnicodeToUtf8( temp, aAppendData ); - LOGGER_WRITE_1( "lenght: %d", temp.Length() ); - - if ( temp.Length() > KFieldMaxLength ) - { - LOGGER_WRITE("Data length is too big, field skipped"); - CleanupStack::PopAndDestroy( tempBuf ); - return; - } - - TInt offset; - offset = aBuffer->Size(); - // field ID (1 byte) + field lenght (4 bytes) + field data - aBuffer->ExpandL( offset, temp.Length() + 5 ); - - // field id (one byte) - aBuffer->Write( offset, TPtrC8(&aFieldId, 1) ); - offset++; - - WriteTUint32( aBuffer, offset, temp.Length()); - offset += 4; - - // field data - aBuffer->Write( offset, temp, temp.Length() ); - offset += temp.Length(); - - CleanupStack::PopAndDestroy( tempBuf ); - - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// void SConMetadata::AppendByteDataFieldL( CBufFlat* aBuffer, -// const TPtrC8 aAppendData, const TUint8 aFieldId ) -// Write 8bit field id value, data length (32bit) and n*8bit data to buffer -// ----------------------------------------------------------------------------- -// -void SConMetadata::AppendByteDataFieldL( CBufFlat* aBuffer, - const TPtrC8 aAppendData, const TUint8 aFieldId ) - { - TRACE_FUNC_ENTRY; - LOGGER_WRITE_1( "aFieldId: 0x%02x", aFieldId); - LOGGER_WRITE_1( "lenght: %d", aAppendData.Length() ); - if ( aAppendData.Length() > KFieldMaxLength ) - { - LOGGER_WRITE("Data length is too big, field skipped"); - return; - } - TInt offset; - offset = aBuffer->Size(); - - // field id (1) + field len (4) + datalen = 5 + datalen - aBuffer->ExpandL( offset, aAppendData.Length() + 5 ); - - // field id (one byte) - aBuffer->Write( offset, TPtrC8(&aFieldId, 1) ); - offset++; - - // field data length (32bit unsigned integer, two byte) - WriteTUint32( aBuffer, offset, aAppendData.Length() ); - offset += 4; - - // field data - aBuffer->Write( offset, aAppendData ); - offset += aAppendData.Length(); - - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// void SConMetadata::AppendTUintDataFieldL( CBufFlat* aBuffer, -// const TUint32 aValue, const TUint8 aFieldId ) -// Write 8bit field id value, data length (16bit) and n*8bit data to buffer -// ----------------------------------------------------------------------------- -// -void SConMetadata::AppendTUintDataFieldL( CBufFlat* aBuffer, - TUint32 aValue, const TUint8 aFieldId ) - { - TRACE_FUNC_ENTRY; - LOGGER_WRITE_1( "aFieldId: 0x%02x", aFieldId); - LOGGER_WRITE_1( "aValue dec: %u", aValue); - TInt offset; - offset = aBuffer->Size(); - TInt dataLen(1); - TUint8 temp[4]; - TInt i(0); - - temp[i] = aValue & 0xFF; - - aValue >>= 8; - while( aValue > 0 ) - { - i++; - temp[i] = aValue & 0xFF; - aValue >>= 8; - dataLen++; - } - // field id (1) + field len (4) + datalen = 5 + datalen - aBuffer->ExpandL( offset, 5 + dataLen ); - - // field id (one byte) - aBuffer->Write( offset, TPtrC8(&aFieldId, 1) ); - offset++; - - // field data length (32bit unsigned integer, two byte) - WriteTUint32( aBuffer, offset, dataLen ); - offset += 4; - - // field data - for( TInt i = dataLen-1; i>=0; i-- ) - { - aBuffer->Write( offset, TPtrC8(&temp[i], 1) ); - offset++; - } - - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// void SConMetadata::WriteTUint32( CBufFlat* aBuffer, TInt offset, TUint32 aValue ) -// Write 32bit unsigned integer value to buffer. -// ----------------------------------------------------------------------------- -// -void SConMetadata::WriteTUint32( CBufFlat* aBuffer, TInt offset, TUint32 aValue ) - { - TUint8 temp[4]; - TInt i(0); - - temp[i] = aValue & 0xFF; - - aValue >>= 8; - for ( TInt i=1; i<4; i++ ) - { - temp[i] = aValue & 0xFF; - aValue >>= 8; - } - - // high to low - for ( TInt i=3; i>=0; i-- ) - { - aBuffer->Write( offset, TPtrC8(&temp[i], 1) ); - offset++; - } - } - -// End of file diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/services/pcd/src/sconpcd.cpp --- a/connectivitymodules/SeCon/services/pcd/src/sconpcd.cpp Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,586 +0,0 @@ -/* -* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: CSConPCD implementation -* -*/ - - -// INCLUDE FILES - -#include "sconpcd.h" -#include "sconpcdconsts.h" -#include "sconinstqueue.h" -#include "sconbrqueue.h" -#include "sconmetadata.h" -#include "debug.h" - -// ============================= MEMBER FUNCTIONS =============================== - - -// ----------------------------------------------------------------------------- -// CreateCSConPCDL() -// Entry to CSConPCD -// ----------------------------------------------------------------------------- -// -EXPORT_C CSConPCD* CreateCSConPCDL() - { - TRACE_FUNC; - return CSConPCD::NewL(); - } - -// ----------------------------------------------------------------------------- -// CSConPCD::NewL() -// Two-phase constructor -// ----------------------------------------------------------------------------- -// -CSConPCD* CSConPCD::NewL() - { - TRACE_FUNC_ENTRY; - CSConPCD* self = new (ELeave) CSConPCD(); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - TRACE_FUNC_EXIT; - return self; - } - -// ----------------------------------------------------------------------------- -// CSConPCD::CSConPCD() -// Constructor -// ----------------------------------------------------------------------------- -// -CSConPCD::CSConPCD() : iInstallerQueue( NULL ), iBackupRestoreQueue( NULL ), - iLatestReply(NULL), iTaskNumber( 0 ), iMaxObjectSize( 65536 ), - iLastOperation( ENoTask ) - { - TRACE_FUNC; - } - -// ----------------------------------------------------------------------------- -// CSConPCD::ConstructL() -// Initializes member data -// ----------------------------------------------------------------------------- -// -void CSConPCD::ConstructL() - { - TRACE_FUNC_ENTRY; - User::LeaveIfError( iFs.Connect() ); - iInstallerQueue = CSConInstallerQueue::NewL( iFs ); - iBackupRestoreQueue = CSConBackupRestoreQueue::NewL( iMaxObjectSize, iFs ); - iInstallerQueue->QueueAddress( iBackupRestoreQueue ); - iBackupRestoreQueue->QueueAddress( iInstallerQueue ); - - if ( !CActiveScheduler::Current() ) - { - CActiveScheduler* scheduler = new (ELeave) CActiveScheduler(); - CActiveScheduler::Install( scheduler ); - } - CActiveScheduler::Add( iInstallerQueue ); - CActiveScheduler::Add( iBackupRestoreQueue ); - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConPCD::~CSConPCD() -// Destructor -// ----------------------------------------------------------------------------- -// -CSConPCD::~CSConPCD() - { - TRACE_FUNC_ENTRY; - if ( iInstallerQueue ) - { - iInstallerQueue->Cancel(); - delete iInstallerQueue; - iInstallerQueue = NULL; - } - - if ( iBackupRestoreQueue ) - { - iBackupRestoreQueue->Cancel(); - delete iBackupRestoreQueue; - iBackupRestoreQueue = NULL; - } - - if ( iLatestReply ) - { - delete iLatestReply; - iLatestReply = NULL; - } - - iFs.Close(); - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConPCD::PutTaskL( CSConTask* aTask ) -// Receives a new task -// ----------------------------------------------------------------------------- -// -TInt CSConPCD::PutTaskL( CSConTask*& aTask ) - { - TRACE_FUNC_ENTRY; - TInt ret( KErrNone ); - TInt maxObjectSize( 0 ); - - if ( iLastOperation == EPutTask ) - { - LOGGER_WRITE( "CSConPCD::PutTaskL() : Two Puts in a row -> Reset()" ); - ResetPCD(); - } - else - { - LOGGER_WRITE( "CSConPCD::PutTaskL() : Protocol procedure ok" ); - iLastOperation = EPutTask; - } - - switch( aTask->GetServiceId() ) - { - case ECancel : - ret = CancelL( aTask->iCancelTaskId, aTask->iCancelTaskAll ); - delete aTask; - break; - case EGetDataOwnerStatus : - ret = SupportedBRTaskL( aTask ); - break; - case EGetDataSize : - ret = SupportedBRTaskL( aTask ); - break; - case EGetStatus : - ret = GetStatusL( aTask->iGetStatusParams->iTaskId, - aTask->iGetStatusParams->iAll ); - delete aTask; - break; - case EInstall : - ret = SupportedInstTaskL( aTask ); - break; - case EListDataOwners : - ret = SupportedBRTaskL( aTask ); - break; - case EListInstalledApps : - ret = SupportedInstTaskL( aTask ); - break; - case EListPublicFiles : - ret = SupportedBRTaskL( aTask ); - break; - case ERequestData : - ret = SupportedBRTaskL( aTask ); - break; - case ESetBURMode : - ret = SupportedBRTaskL( aTask ); - break; - case ESetInstParams : - ret = SupportedInstTaskL( aTask ); - break; - case ESupplyData : - ret = SupportedBRTaskL( aTask ); - break; - case EUninstall : - ret = SupportedInstTaskL( aTask ); - break; - case EUpdateDeviceInfo : - maxObjectSize = aTask->iDevInfoParams->iMaxObjectSize; - ret = UpdateDeviceInfoL( maxObjectSize ); - iTaskNumber++; - delete aTask; - break; - case EReboot : - RebootTaskL( aTask ); - delete aTask; - break; - case EGetMetadata : - ret = KErrNone; - GetMetadataTaskL( *aTask ); - delete aTask; - break; - default : - break; - } - LOGGER_WRITE_1( "CSConPCD::PutTaskL() : returned %d", ret ); - return ret; - } - -// ----------------------------------------------------------------------------- -// CSConPCD::GetReply() -// Returns a reply to previous PutTaskL operation -// ----------------------------------------------------------------------------- -// -CSConStatusReply* CSConPCD::GetReply() - { - TRACE_FUNC_ENTRY; - - if ( iLastOperation == EGetReply ) - { - LOGGER_WRITE( "CSConPCD::GetReply() : Two Gets in a row -> Reset()" ); - ResetPCD(); - } - else - { - LOGGER_WRITE( "CSConPCD::GetReply() : Protocol procedure ok" ); - iLastOperation = EGetReply; - } - CSConStatusReply* reply = iLatestReply; - iLatestReply = NULL; - TRACE_FUNC_EXIT; - return reply; - } - -// ----------------------------------------------------------------------------- -// CSConPCD::ResetPCD() -// Resets the module to the initial state -// ----------------------------------------------------------------------------- -// -void CSConPCD::ResetPCD() - { - TRACE_FUNC_ENTRY; - if ( iInstallerQueue ) - { - LOGGER_WRITE( "CSConPCD::ResetPCD() : Reseting installer queue" ); - iInstallerQueue->Reset(); - } - - if ( iBackupRestoreQueue ) - { - LOGGER_WRITE( "CSConPCD::ResetPCD() : Reseting backup queue" ); - iBackupRestoreQueue->Reset(); - } - - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConPCD::SupportedInstTaskL( CSConTask* aTask ) -// Fills a reply with predefined supported task -information -// ----------------------------------------------------------------------------- -// -TInt CSConPCD::SupportedInstTaskL( CSConTask* aTask ) - { - TRACE_FUNC_ENTRY; - TInt ret( KErrNone ); - iTaskNumber++; - ret = iInstallerQueue->AddNewTask( aTask, iTaskNumber ); - - //Get status for this task - TBool all( EFalse ); - CSConStatusReply* reply = new (ELeave) CSConStatusReply(); - CleanupStack::PushL( reply ); - iInstallerQueue->GetQueueStatusL( iTaskNumber, all, reply ); - CleanupStack::Pop( reply ); - - StoreReply( reply ); - - LOGGER_WRITE_1( "CSConPCD::SupportedInstTaskL() : returned %d", ret ); - return ret; - } - -// ----------------------------------------------------------------------------- -// CSConPCD::SupportedBRTask( CSConTask* aTask ) -// Fills a reply with predefined supported task -information -// ----------------------------------------------------------------------------- -// -TInt CSConPCD::SupportedBRTaskL( CSConTask* aTask ) - { - TRACE_FUNC_ENTRY; - TInt ret( KErrNone ); - - TInt taskId; - - taskId = ++iTaskNumber; - - ret = iBackupRestoreQueue->AddNewTask( aTask, taskId ); - LOGGER_WRITE_1( "iBackupRestoreQueue->AddNewTask : ret %d", ret ); - //Get status for this task - TBool all( EFalse ); - CSConStatusReply* reply = new (ELeave) CSConStatusReply(); - CleanupStack::PushL( reply ); - iBackupRestoreQueue->GetQueueStatusL( iTaskNumber, all, reply ); - CleanupStack::Pop( reply ); - - StoreReply( reply ); - - TRACE_FUNC_EXIT; - return ret; - } - - -// ----------------------------------------------------------------------------- -// CSConPCD::RebootTask( const CSConTask* aTask ) -// Fills a reply with predefined unsupported task -information -// ----------------------------------------------------------------------------- -// -TInt CSConPCD::RebootTaskL( const CSConTask* aTask ) - { - TRACE_FUNC_ENTRY; - TInt ret( KErrNotSupported ); - iTaskNumber++; - TSConMethodName method( aTask->GetServiceId() ); - CSConStatusReply* reply = new (ELeave) CSConStatusReply(); - CleanupStack::PushL( reply ); - CSConTaskReply* taskReply = new (ELeave) CSConTaskReply(); - CleanupStack::PushL( taskReply ); - - TBool complete( ETrue ); - taskReply->InitializeL( method, KSConCodeNotSupported, complete ); - taskReply->iTaskId = iTaskNumber; - - reply->iNoTasks = EFalse; - User::LeaveIfError( reply->iTasks.Append( taskReply ) ); - CleanupStack::Pop( taskReply ); - - StoreReply( reply ); - CleanupStack::Pop( reply ); - - LOGGER_WRITE_1( "CSConPCD::RebootTask() : returned %d", ret ); - return ret; - } - -// ----------------------------------------------------------------------------- -// CSConPCD::GetMetadataTask( const CSConTask* aTask ) -// Fills a reply with predefined GetMetadata task -information -// ----------------------------------------------------------------------------- -// -void CSConPCD::GetMetadataTaskL( CSConTask& aTask ) - { - TRACE_FUNC_ENTRY; - - aTask.iTaskId = ++iTaskNumber; - - //Set progress value "task accepted for execution" - aTask.SetProgressValue( KSConCodeTaskCreated ); - aTask.SetCompleteValue( EFalse ); - - SConMetadata::ProcessTask( aTask, iFs ); - - //Get status for this task - - CSConStatusReply* reply = new (ELeave) CSConStatusReply(); - CleanupStack::PushL( reply ); - CSConTaskReply* taskReply = new (ELeave) CSConTaskReply(); - CleanupStack::PushL( taskReply ); - taskReply->InitializeL( aTask ); - User::LeaveIfError( reply->iTasks.Append( taskReply ) ); - CleanupStack::Pop( taskReply ); - - if ( !aTask.GetComplete() ) - { - // clean all unneccessary data from the reply packet - taskReply->CleanTaskData(); - } - - - StoreReply( reply ); - CleanupStack::Pop( reply ); - - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConPCD::GetStatus( TInt aTask, TBool aAll ) -// Collects a status of a specified task / all tasks -// ----------------------------------------------------------------------------- -// -TInt CSConPCD::GetStatusL( TInt aTask, TBool aAll ) - { - TRACE_FUNC_ENTRY; - TInt ret( KErrNone ); - - // create mergeReply object. Store installer and br replys here. - CSConStatusReply* mergeReply = new (ELeave) CSConStatusReply(); - CleanupStack::PushL( mergeReply ); - - - CSConStatusReply* brReply = new (ELeave) CSConStatusReply(); - CleanupStack::PushL( brReply ); - iBackupRestoreQueue->GetQueueStatusL( aTask, aAll, brReply ); - - - // Create installerReply and populate it - CSConStatusReply* installerReply = new (ELeave) CSConStatusReply(); - CleanupStack::PushL( installerReply ); - iInstallerQueue->GetQueueStatusL( aTask, aAll, installerReply ); - - if ( !installerReply->iNoTasks || !brReply->iNoTasks ) - { - mergeReply->iNoTasks = EFalse; - } - else - { - mergeReply->iNoTasks = ETrue; - } - - for ( TInt i = 0; i < installerReply->iTasks.Count(); i++ ) - { - mergeReply->iTasks.Append( installerReply->iTasks[i]->CopyAndFreeL() ); - } - - // installer replys are copied to mergereply, delete installerReply - CleanupStack::PopAndDestroy( installerReply ); - - // do same for br reply - for ( TInt j = 0; j < brReply->iTasks.Count(); j++ ) - { - mergeReply->iTasks.Append( brReply->iTasks[j]->CopyAndFreeL() ); - } - - CleanupStack::PopAndDestroy( brReply ); - - CleanupStack::Pop( mergeReply ); - // store reply - StoreReply( mergeReply ); - - LOGGER_WRITE_1( "CSConPCD::GetStatus() : returned %d", ret ); - return ret; - } - -// ----------------------------------------------------------------------------- -// CSConPCD::Cancel( TInt aTask, TBool aAll ) -// Cancels a specified task / all tasks -// ----------------------------------------------------------------------------- -// -TInt CSConPCD::CancelL( TInt aTask, TBool aAll ) - { - TRACE_FUNC_ENTRY; - TInt ret( KErrNone ); - - CSConStatusReply* reply = new (ELeave) CSConStatusReply(); - iInstallerQueue->CancelTask( aTask, aAll ); - iBackupRestoreQueue->CancelTask( aTask, aAll ); - - reply->iNoTasks = ETrue; - - StoreReply( reply ); - - LOGGER_WRITE_1( "CSConPCD::CancelL() : returned %d", ret ); - return ret; - } - -// ----------------------------------------------------------------------------- -// CSConPCD::StoreReply( CSConStatusReply*& aReply ) -// Stores a reply -// ----------------------------------------------------------------------------- -// -void CSConPCD::StoreReply( CSConStatusReply*& aReply ) - { - TRACE_FUNC_ENTRY; - if ( iLatestReply ) - { - delete iLatestReply; - iLatestReply = NULL; - } - - iLatestReply = aReply; - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConPCD::UpdateDeviceInfo( TInt aMaxObjectSize ) -// Creates a reply for UpdateDeviceInfo task -// ----------------------------------------------------------------------------- -// -TInt CSConPCD::UpdateDeviceInfoL( TInt aMaxObjectSize ) - { - TRACE_FUNC_ENTRY; - TInt ret( KErrNone ); - TSConMethodName method( EUpdateDeviceInfo ); - - CSConStatusReply* reply = new (ELeave) CSConStatusReply(); - CleanupStack::PushL( reply ); - CSConTaskReply* taskReply = new (ELeave) CSConTaskReply(); - CleanupStack::PushL( taskReply ); - - - TBool complete( ETrue ); - TInt progress( KSConCodeTaskCompleted ); - - taskReply->InitializeL( method, progress, complete ); - taskReply->iTaskId = iTaskNumber; - - TInt arrayLength = sizeof KSupportedMethods / sizeof KSupportedMethods[0]; - - for ( TInt i = 0; i < arrayLength; i++ ) - { - switch( KSupportedMethods[i].method ) - { - case EGetDataSize : - taskReply->iDevInfoParams->iGetSizeSupp = - KSupportedMethods[i].support; - break; - case EInstall : - taskReply->iDevInfoParams->iInstallSupp = - KSupportedMethods[i].support; - break; - case EListDataOwners : - taskReply->iDevInfoParams->iDataOwnersSupp = - KSupportedMethods[i].support; - break; - case EListInstalledApps : - taskReply->iDevInfoParams->iInstAppsSupp = - KSupportedMethods[i].support; - break; - case ERequestData : - taskReply->iDevInfoParams->iReqDataSupp = - KSupportedMethods[i].support; - break; - case ESetBURMode : - taskReply->iDevInfoParams->iSetBURModeSupp = - KSupportedMethods[i].support; - break; - case ESetInstParams : - taskReply->iDevInfoParams->iInstParamsSupp = - KSupportedMethods[i].support; - break; - case ESupplyData : - taskReply->iDevInfoParams->iSupplyDataSupp = - KSupportedMethods[i].support; - break; - case EUninstall : - taskReply->iDevInfoParams->iUninstallSupp = - KSupportedMethods[i].support; - break; - case EReboot : - taskReply->iDevInfoParams->iRebootSupp = - KSupportedMethods[i].support; - break; - default : - break; - } - } - - taskReply->iDevInfoParams->iVersion.Copy( KCONMLVERSION ); - taskReply->iDevInfoParams->iMaxObjectSize = - GetMaxObjectSize( aMaxObjectSize ); - - reply->iNoTasks = EFalse; - - User::LeaveIfError( reply->iTasks.Append( taskReply ) ); - StoreReply( reply ); - - CleanupStack::Pop( taskReply ); - CleanupStack::Pop( reply ); - LOGGER_WRITE_1( "CSConPCD::UpdateDeviceInfo() : returned %d", ret ); - return ret; - } - -// ----------------------------------------------------------------------------- -// CSConPCD::GetMaxObjectSize( TInt /*aClientObjectSize*/ ) const -// Gets the current max object size -// ----------------------------------------------------------------------------- -// -TInt CSConPCD::GetMaxObjectSize( TInt /*aClientObjectSize*/ ) const - { - LOGGER_WRITE_1( "CSConPCD::GetMaxObjectSize() : returned %d", iMaxObjectSize ); - return iMaxObjectSize; - } - -// End of file diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/services/pcd/src/sconpcdutility.cpp --- a/connectivitymodules/SeCon/services/pcd/src/sconpcdutility.cpp Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,411 +0,0 @@ -/* -* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: SConPcdUtility implementation -* -*/ - - -// CLASS HEADER -#include -#include -#include -#include -#include -#include -#include -#include -#include // Resource to be read header - -using namespace Java; - -#include "debug.h" -#include "sconpcdutility.h" -#include "sconconmltask.h" - -// localized "unknown vendor". -_LIT( KSConResourceName, "z:\\Resource\\sconftp.rsc" ); - - - -// METHODS -//---------------------------------------------------------------------------- -// void SConPcdUtility::ProcessListInstalledAppsL( CSConTask*& aTask ) -//---------------------------------------------------------------------------- -// -void SConPcdUtility::ProcessListInstalledAppsL( CSConTask*& aTask ) - { - TRACE_FUNC_ENTRY; - - LOGGER_WRITE_1("iAllApps: %d",(TInt)aTask->iListAppsParams->iAllApps); - LOGGER_WRITE8_1("driveList: %S", &aTask->iListAppsParams->iDriveList); - - AppendInstalledSisL( *aTask->iListAppsParams ); - AppendInstalledJavaL( *aTask->iListAppsParams ); - AppendInstalledWidgetsL( *aTask->iListAppsParams ); - - TRACE_FUNC_EXIT; - } - -//---------------------------------------------------------------------------- -// void SConPcdUtility::AppendInstalledSisL( RPointerArray &aApps ) -// Appends installed sis packages and augmentations to aApps array. -//---------------------------------------------------------------------------- -// -void SConPcdUtility::AppendInstalledSisL( CSConListInstApps& aListInstApps ) - { - TRACE_FUNC_ENTRY; - // Get installed applications from sis registry - Swi::RSisRegistrySession sisRegistry; - CleanupClosePushL( sisRegistry ); - User::LeaveIfError( sisRegistry.Connect() ); - - RArray uids; - CleanupClosePushL(uids); - sisRegistry.InstalledUidsL( uids ); - - - //Read package information - for( TInt i = 0; i < uids.Count(); i++ ) - { - Swi::RSisRegistryEntry entry; - CleanupClosePushL(entry); - User::LeaveIfError( entry.Open( sisRegistry, uids[i] ) ); - - TBool showIt( EFalse ); - if ( aListInstApps.iAllApps ) - { - // show all apps -param defined, exlude stubs on ROM - if ( !entry.IsInRomL() ) - { - showIt = ETrue; - } - } - else - { - // show if installed one of the specified drives - // don't exlude stubs on ROM - showIt = IsInstalledToSelectedDrive( aListInstApps.iDriveList, - entry.InstalledDrivesL() ); - } - - // Only show if not in rom - if ( showIt && entry.IsPresentL() ) - { - // Add the created object to the list - LOGGER_WRITE_1( "SConPcdUtility::ProcessListInstalledAppsL : add pkg, index %d", i ); - CSConInstApp* app = new (ELeave) CSConInstApp(); - CleanupStack::PushL( app ); - - HBufC* temp = entry.PackageNameL(); - TPtrC tempPtr = temp->Des(); - LOGGER_WRITE_1("PackageNameL: %S", &tempPtr); - CleanupStack::PushL( temp ); - if ( temp->Length() > app->iName.MaxLength() ) - { - User::Leave( KErrTooBig ); - } - app->iName.Copy( *temp ); - CleanupStack::PopAndDestroy( temp ); - temp = NULL; - - temp = entry.UniqueVendorNameL(); - CleanupStack::PushL( temp ); - if ( temp->Length() > app->iVendor.MaxLength() ) - { - User::Leave( KErrTooBig ); - } - app->iVendor.Copy( *temp ); - CleanupStack::PopAndDestroy( temp ); - temp = NULL; - - app->iVersion.Copy( entry.VersionL().Name() ); - app->iType = ESisApplication; - app->iSize = entry.SizeL(); - app->iUid = entry.UidL(); - - User::LeaveIfError( aListInstApps.iApps.Append( app ) ); - CleanupStack::Pop( app ); - } - - // Get possible augmentations - RPointerArray augPackages; - CleanupResetAndDestroyPushL( augPackages ); - entry.AugmentationsL( augPackages ); - for ( TInt j( 0 ); j < augPackages.Count(); j++ ) - { - Swi::RSisRegistryEntry augmentationEntry; - CleanupClosePushL( augmentationEntry ); - augmentationEntry.OpenL( sisRegistry, *augPackages[j] ); - - TBool showIt( EFalse ); - if ( aListInstApps.iAllApps ) - { - // show all apps -param defined, exlude stubs on ROM - if ( !augmentationEntry.IsInRomL() ) - { - showIt = ETrue; - } - } - else - { - // show if installed one of the specified drives - // don't exlude stubs on ROM - showIt = IsInstalledToSelectedDrive( aListInstApps.iDriveList, - augmentationEntry.InstalledDrivesL() ); - } - - // Only show if not in rom - if ( showIt && augmentationEntry.IsPresentL() ) - { - CSConInstApp* augApp = new (ELeave) CSConInstApp(); - CleanupStack::PushL( augApp ); - augApp->iName.Copy( augPackages[j]->Name() ); - - HBufC* temp = entry.PackageNameL(); - CleanupStack::PushL( temp ); - if ( temp->Length() > augApp->iParentName.MaxLength() ) - { - User::Leave( KErrTooBig ); - } - augApp->iParentName.Copy( *temp ); - CleanupStack::PopAndDestroy( temp ); - temp = NULL; - - augApp->iVendor.Copy( augPackages[j]->Vendor() ); - augApp->iVersion.Copy( augmentationEntry.VersionL().Name() ); - augApp->iType = ESisAugmentation; - augApp->iSize = augmentationEntry.SizeL(); - augApp->iUid = augmentationEntry.UidL(); - - LOGGER_WRITE_1( "SConPcdUtility::ProcessListInstalledAppsL : add augmentation, index: %d", j ); - LOGGER_WRITE_1( "SConPcdUtility::ProcessListInstalledAppsL : add augmentation, basepkg: %d", i ); - TInt augindex = augPackages[j]->Index(); - LOGGER_WRITE_1( "SConPcdUtility::ProcessListInstalledAppsL : augindex: %d",augindex ); - User::LeaveIfError( aListInstApps.iApps.Append( augApp ) ); - CleanupStack::Pop( augApp ); - } - CleanupStack::PopAndDestroy( &augmentationEntry ); - } - CleanupStack::PopAndDestroy( &augPackages ); - CleanupStack::PopAndDestroy( &entry ); - } - - CleanupStack::PopAndDestroy(&uids); - CleanupStack::PopAndDestroy(&sisRegistry); - TRACE_FUNC_EXIT; - } - -//---------------------------------------------------------------------------- -// void SConPcdUtility::AppendInstalledJavaL( RPointerArray &aApps ) -// Appends installed java packages to aApps array. -//---------------------------------------------------------------------------- -// -void SConPcdUtility::AppendInstalledJavaL( CSConListInstApps& aListInstApps ) - { - TRACE_FUNC_ENTRY; - CJavaRegistry* javaRegistry = CJavaRegistry::NewLC( ); - RArray packageUids; - CleanupClosePushL( packageUids ); - javaRegistry->GetRegistryEntryUidsL( /*EGeneralPackage,*/ packageUids ); - LOGGER_WRITE_1("packageUids.Count(): %d", packageUids.Count()); - for (TInt i=0; iRegistryEntryL( packageUids[i] ); - if ( entry ) - { - CleanupStack::PushL( entry ); - if ( entry->Type() >= EGeneralPackage && entry->Type() < EGeneralApplication ) - { - // entry was correct type - CJavaRegistryPackageEntry* packageEntry = ( CJavaRegistryPackageEntry* ) entry; - - // check do we need to filter it out - TBool showIt( EFalse ); - if ( aListInstApps.iAllApps ) - { - showIt = ETrue; - } - else - { - TDriveNumber drive = packageEntry->Drive(); - if ( aListInstApps.iDriveList.Length() > drive - && aListInstApps.iDriveList[ drive ] ) - { - showIt = ETrue; - } - } - - if ( showIt ) - { - CSConInstApp* app = new (ELeave) CSConInstApp(); - CleanupStack::PushL( app ); - // Get Uid, name, type, vendor - app->iUid = packageEntry->Uid(); - app->iName.Copy ( packageEntry->Name() ); - LOGGER_WRITE_1( "Name: %S", &app->iName ); - app->iType = EJavaApplication; - - // Get version - TAppVersion midletVersion( packageEntry->Version() ); - TVersion verType(midletVersion.iMajor, midletVersion.iMinor, midletVersion.iBuild); - app->iVersion.Copy( verType.Name() ); - - // Get vendor - if ( entry->NumberOfCertificateChains() > 0 && packageEntry->Vendor().Length() > 0 ) - { - app->iVendor.Copy( packageEntry->Vendor() ); - } - else - { - // untrusted applications do not have certificates. - // if the application has a certificate, it is installed either as - // trusted or not installed at all. - - // unknown vendor - TFileName myFileName( KSConResourceName ); - CStringResourceReader* resReader = CStringResourceReader::NewL( myFileName ); - TPtrC bufUnknownSuplier; - bufUnknownSuplier.Set( resReader->ReadResourceString( R_SECON_UNKNOWN_SUPPLIER ) ); - - app->iVendor.Copy( bufUnknownSuplier ); - - delete resReader; - } - - // Get size - app->iSize = packageEntry->UsedUserDiskSpace(); - - User::LeaveIfError( aListInstApps.iApps.Append( app ) ); - CleanupStack::Pop( app ); - } - } - CleanupStack::PopAndDestroy( entry ); - } - } - - CleanupStack::PopAndDestroy( &packageUids ); - CleanupStack::PopAndDestroy( javaRegistry ); - TRACE_FUNC_EXIT; - } - -//---------------------------------------------------------------------------- -// void SConPcdUtility::AppendInstalledWidgetsL( RPointerArray &aApps ) -// Appends installed widgets to aApps array. -//---------------------------------------------------------------------------- -// -void SConPcdUtility::AppendInstalledWidgetsL( CSConListInstApps& aListInstApps ) - { - TRACE_FUNC_ENTRY; - RWidgetRegistryClientSession widgetSession; - CleanupClosePushL( widgetSession ); - User::LeaveIfError( widgetSession.Connect() ); - - // Get the list of installed widgets - RWidgetInfoArray widgetInfoArr; - CleanupClosePushL( widgetInfoArr ); - widgetSession.InstalledWidgetsL( widgetInfoArr ); - - for ( TInt i = 0; i < widgetInfoArr.Count(); i++ ) - { - CWidgetInfo *item = widgetInfoArr[i]; - CleanupStack::PushL( item ); - - - TBool showIt( EFalse ); - if ( aListInstApps.iAllApps ) - { - // show all apps -param defined - showIt = ETrue; - } - else - { - TDriveUnit locationDrive = item->iDriveName->Des(); - // show if installed one of the specified drives - if ( aListInstApps.iDriveList.Length() > locationDrive - && aListInstApps.iDriveList[locationDrive] ) - { - showIt = ETrue; - } - } - - if ( showIt ) - { - - CSConInstApp* app = new (ELeave) CSConInstApp(); - CleanupStack::PushL( app ); - app->iName.Copy( *(item->iBundleName) ); - app->iType = EWidgetApplication; - app->iSize = item->iFileSize; - app->iUid = item->iUid; - - CWidgetPropertyValue* propValue = widgetSession.GetWidgetPropertyValueL( - item->iUid, EBundleVersion ); - if ( propValue && propValue->iType == EWidgetPropTypeString ) - { - app->iVersion.Copy( *(propValue->iValue.s) ); - } - delete propValue; - propValue = NULL; - - User::LeaveIfError( aListInstApps.iApps.Append( app ) ); - CleanupStack::Pop( app ); // ownership transferred, do not delete - } - CleanupStack::PopAndDestroy( item ); - } - User::LeaveIfError( widgetSession.Disconnect() ); - - CleanupStack::PopAndDestroy( &widgetInfoArr ); - CleanupStack::PopAndDestroy( &widgetSession ); - TRACE_FUNC_EXIT; - } - -// --------------------------------------------------------- -// SConPcdUtility::IsInstalledToSelectedDrive -// Solve highest drive from aInstalledDrives and check -// if that drive is selected -// --------------------------------------------------------- -// -TBool SConPcdUtility::IsInstalledToSelectedDrive( const TDriveList& aSelectedDriveList, TUint aInstalledDrives ) - { - TInt locationDrive; - if( aInstalledDrives ) - { - // Select the highest drive as location drive - TInt drive = EDriveA; - while( aInstalledDrives >>= 1 ) - { - drive++; - } - locationDrive = drive; - } - else - { - // No installed files, select C: as location drive - locationDrive = EDriveC; - } - - if ( aSelectedDriveList.Length() > locationDrive && aSelectedDriveList[locationDrive] ) - { - LOGGER_WRITE("SConPcdUtility::IsInstalledToSelectedDrive : return ETrue"); - return ETrue; - } - else - { - LOGGER_WRITE("SConPcdUtility::IsInstalledToSelectedDrive : return EFalse"); - return EFalse; - } - } -// END OF FILE diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/services/pcd/src/sconqueue.cpp --- a/connectivitymodules/SeCon/services/pcd/src/sconqueue.cpp Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,442 +0,0 @@ -/* -* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Queue implementation -* -*/ - - -// INCLUDE FILES - -#include "sconqueue.h" -#include "sconpcdconsts.h" -#include "debug.h" -#include // installer errors - -// ============================= MEMBER FUNCTIONS =============================== - - -// ----------------------------------------------------------------------------- -// CSConTaskQueue::~CSConTaskQueue() -// Destructor -// ----------------------------------------------------------------------------- -// -CSConTaskQueue::~CSConTaskQueue() - { - TRACE_FUNC; - iQueue.ResetAndDestroy(); - iQueue.Close(); - iTimer.Close(); - } - -// ----------------------------------------------------------------------------- -// CSConTaskQueue::GetQueueStatus( TInt aTask, TBool aAllTasks, -// CSConStatusReply*& aStatus ) -// Returns the status of a specified task / all tasks -// ----------------------------------------------------------------------------- -// -void CSConTaskQueue::GetQueueStatusL( TInt aTask, TBool aAllTasks, - CSConStatusReply*& aStatus ) - { - RArray completedTasks; - CleanupClosePushL( completedTasks ); - if ( aAllTasks ) - { - //if there are tasks - if ( iQueue.Count() > 0 ) - { - //set iNoTasks as EFalse - aStatus->iNoTasks = EFalse; - for ( TInt i = 0; i < iQueue.Count(); i++ ) - { - //Fill reply object - CSConTaskReply* taskReply = new (ELeave) CSConTaskReply(); - CleanupStack::PushL( taskReply ); - taskReply->InitializeL( *iQueue[i] ); - User::LeaveIfError( aStatus->iTasks.Append( taskReply ) ); - CleanupStack::Pop( taskReply ); - TBool complete = iQueue[i]->GetComplete(); - - //Collect completed task numbers to array for deleting - if ( complete ) - { - completedTasks.Append( iQueue[i]->iTaskId ); - } - //Otherwise clean all unneccessary data from the reply packet - else - { - taskReply->CleanTaskData(); - } - } - } - else - { - //no task in the queue - aStatus->iNoTasks = ETrue; - } - - //Remove completed tasks from queue - for ( TInt j = 0; j < completedTasks.Count(); j++ ) - { - RemoveTask( completedTasks[j] ); - } - } - else if ( aTask > 0 ) - { - CSConTask* temp = new (ELeave) CSConTask(); - temp->iTaskId = aTask; - TInt index = iQueue.Find( temp, CSConTaskQueue::Match ); - delete temp; - - TBool complete = EFalse; - CSConTaskReply* taskReply(NULL); - - if ( index != KErrNotFound ) - { - aStatus->iNoTasks = EFalse; - //Fill reply object - taskReply = new (ELeave) CSConTaskReply(); - CleanupStack::PushL( taskReply ); - taskReply->InitializeL( *iQueue[index] ); - User::LeaveIfError( aStatus->iTasks.Append( taskReply ) ); - CleanupStack::Pop( taskReply ); - complete = iQueue[index]->GetComplete(); - } - else - { - //no task in the queue - aStatus->iNoTasks = ETrue; - } - - //Delete completed tasks from queue - if ( complete ) - { - RemoveTask( aTask ); - } - //Otherwise clean all unneccessary data from the reply packet - else if ( taskReply ) - { - taskReply->CleanTaskData(); - } - } - else - { - //no task in the queue - aStatus->iNoTasks = ETrue; - } - CleanupStack::PopAndDestroy( &completedTasks ); // close - } - -// ----------------------------------------------------------------------------- -// CSConTaskQueue::AddNewTask( CSConTask*& aNewTask, TInt aTaskId ) -// Adds a new task to queue -// ----------------------------------------------------------------------------- -// -TInt CSConTaskQueue::AddNewTask( CSConTask*& aNewTask, TInt aTaskId ) - { - TInt ret( KErrNone ); - - aNewTask->iTaskId = aTaskId; - - //Set progress value "task accepted for execution" - aNewTask->SetProgressValue( KSConCodeTaskCreated ); - aNewTask->SetCompleteValue( EFalse ); - - if ( iQueue.Count() == 0 ) - { - StartQueue(); - } - ret = iQueue.InsertInOrder( aNewTask, CSConTaskQueue::Compare ); - return ret; - } - -// ----------------------------------------------------------------------------- -// CSConTaskQueue::CompleteTask( TInt aTask, TInt aError ) -// Set the task to completed -mode -// ----------------------------------------------------------------------------- -// -void CSConTaskQueue::CompleteTask( TInt aTask, TInt aError ) - { - LOGGER_WRITE_1( "CSConTaskQueue::CompleteTask aError: %d", aError ); - TInt index( KErrNotFound ); - - CSConTask* temp = new CSConTask(); - temp->iTaskId = aTask; - index = iQueue.Find( temp, CSConTaskQueue::Match ); - delete temp; - - if ( index != KErrNotFound ) - { - TBool complete( ETrue ); - TBool notComplete( EFalse ); - TInt progress( KSConCodeTaskCompleted ); - - switch( aError ) - { - case KErrNone : - iQueue[index]->SetCompleteValue( complete ); - progress = KSConCodeTaskCompleted; - break; - case KErrNotFound : - iQueue[index]->SetCompleteValue( complete ); - progress = KSConCodeNotFound; - break; - case KErrCompletion : - iQueue[index]->SetCompleteValue( notComplete ); - progress = KSConCodeTaskPartiallyCompleted; - break; - - // installer specific errors - case SwiUI::KSWInstErrUserCancel: - LOGGER_WRITE("User cancelled the operation"); - iQueue[index]->SetCompleteValue( complete ); - progress = KSConCodeInstErrUserCancel; - break; - case SwiUI::KSWInstErrFileCorrupted: - LOGGER_WRITE("File is corrupted"); - iQueue[index]->SetCompleteValue( complete ); - progress = KSConCodeInstErrFileCorrupted; - break; - case SwiUI::KSWInstErrInsufficientMemory: - LOGGER_WRITE("Insufficient free memory in the drive to perform the operation"); - iQueue[index]->SetCompleteValue( complete ); - progress = KSConCodeInstErrInsufficientMemory; - break; - case SwiUI::KSWInstErrPackageNotSupported: - LOGGER_WRITE("Installation of the package is not supported"); - iQueue[index]->SetCompleteValue( complete ); - progress = KSConCodeInstErrPackageNotSupported; - break; - case SwiUI::KSWInstErrSecurityFailure: - LOGGER_WRITE("Package cannot be installed due to security error"); - iQueue[index]->SetCompleteValue( complete ); - progress = KSConCodeInstErrSecurityFailure; - break; - case SwiUI::KSWInstErrMissingDependency: - LOGGER_WRITE("Package cannot be installed due to missing dependency"); - iQueue[index]->SetCompleteValue( complete ); - progress = KSConCodeInstErrMissingDependency; - break; - case SwiUI::KSWInstErrFileInUse: - LOGGER_WRITE("Mandatory file is in use and prevents the operation"); - iQueue[index]->SetCompleteValue( complete ); - progress = KSConCodeInstErrFileInUse; - break; - case SwiUI::KSWInstErrGeneralError: - LOGGER_WRITE("Unknown error"); - iQueue[index]->SetCompleteValue( complete ); - progress = KSConCodeInstErrGeneralError; - break; - case SwiUI::KSWInstErrNoRights: - LOGGER_WRITE("The package has no rights to perform the operation"); - iQueue[index]->SetCompleteValue( complete ); - progress = KSConCodeInstErrNoRights; - break; - case SwiUI::KSWInstErrNetworkFailure: - LOGGER_WRITE("Indicates that network failure aborted the operation"); - iQueue[index]->SetCompleteValue( complete ); - progress = KSConCodeInstErrNetworkFailure; - break; - case SwiUI::KSWInstErrBusy: - LOGGER_WRITE("Installer is busy doing some other operation"); - iQueue[index]->SetCompleteValue( complete ); - progress = KSConCodeInstErrBusy; - break; - case SwiUI::KSWInstErrAccessDenied: - LOGGER_WRITE("Target location of package is not accessible"); - iQueue[index]->SetCompleteValue( complete ); - progress = KSConCodeInstErrAccessDenied; - break; - case SwiUI::KSWInstUpgradeError: - LOGGER_WRITE("The package is an invalid upgrade"); - iQueue[index]->SetCompleteValue( complete ); - progress = KSConCodeInstUpgradeError; - break; - - default : - iQueue[index]->SetCompleteValue( complete ); - progress = KSConCodeConflict; - break; - } - - iQueue[index]->SetProgressValue( progress ); - } - StartQueue(); - } - -// ----------------------------------------------------------------------------- -// CSConTaskQueue::SetTaskProgress( TInt aTask, TInt aProgressValue ) -// Set the task progress value -// ----------------------------------------------------------------------------- -// -void CSConTaskQueue::SetTaskProgress( TInt aTask, TInt aProgressValue ) - { - TInt index( KErrNotFound ); - - CSConTask* temp = new CSConTask(); - temp->iTaskId = aTask; - index = iQueue.Find( temp, CSConTaskQueue::Match ); - delete temp; - - if ( index != KErrNotFound ) - { - iQueue[index]->SetProgressValue( aProgressValue ); - } - } - -// ----------------------------------------------------------------------------- -// CSConTaskQueue::GetTask( TInt aTaskId, CSConTask*& aTask ) -// Receives a specified task -// ----------------------------------------------------------------------------- -// -TInt CSConTaskQueue::GetTask( TInt aTaskId, CSConTask*& aTask ) - { - TInt ret( KErrNone ); - TInt index; - - CSConTask* temp = new CSConTask(); - temp->iTaskId = aTaskId; - index = iQueue.Find( temp, CSConTaskQueue::Match ); - delete temp; - - if ( index != KErrNotFound ) - { - aTask = iQueue[index]; - } - else - { - ret = KErrNotFound; - } - return ret; - } - -// ----------------------------------------------------------------------------- -// CSConTaskQueue::RemoveTask( TInt aTask ) -// Removes a task from the queue -// ----------------------------------------------------------------------------- -// -void CSConTaskQueue::RemoveTask( TInt aTask ) - { - TInt index( KErrNotFound ); - - CSConTask* temp = new CSConTask(); - temp->iTaskId = aTask; - index = iQueue.Find( temp, CSConTaskQueue::Match ); - delete temp; - - if ( index != KErrNotFound ) - { - delete iQueue[index]; - iQueue.Remove( index ); - iQueue.Compress(); - } - - if ( iQueue.Count() == 0 ) - { - StopQueue(); - iQueue.Reset(); - } - } - -// ----------------------------------------------------------------------------- -// CSConTaskQueue::CancelTask( TInt aTask, TBool aAllTasks ) -// Cancels a task -// ----------------------------------------------------------------------------- -// -void CSConTaskQueue::CancelTask( TInt aTask, TBool aAllTasks ) - { - TRACE_FUNC_ENTRY; - - //Remove the task from the queue - if ( aTask > 0 && !aAllTasks ) - { - RemoveTask( aTask ); - } - - //Remove all tasks from the queue - if ( aAllTasks ) - { - iQueue.ResetAndDestroy(); - } - - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConTaskQueue::QueueProcessActive() -// The status of the process -// ----------------------------------------------------------------------------- -// -TBool CSConTaskQueue::QueueProcessActive() const - { - return iQueueProcessActive; - } - -// ----------------------------------------------------------------------------- -// CSConTaskQueue::ChangeQueueProcessStatus() -// Changes the status of the queue process -// ----------------------------------------------------------------------------- -// -void CSConTaskQueue::ChangeQueueProcessStatus() - { - iQueueProcessActive = !iQueueProcessActive; - } - -// ----------------------------------------------------------------------------- -// CSConTaskQueue::Reset() -// Resets the queue -// ----------------------------------------------------------------------------- -// -void CSConTaskQueue::Reset() - { - TRACE_FUNC_ENTRY; - iTimer.Cancel(); - iQueue.ResetAndDestroy(); - TRACE_FUNC_EXIT; - } - -// --------------------------------------------------------- -// CSConTaskQueue::Compare( const CSConTask& aFirst, -// const CSConTask& aSecond ) -// Compares task numbers -// --------------------------------------------------------- -TInt CSConTaskQueue::Compare( const CSConTask& aFirst, - const CSConTask& aSecond ) - { - if ( aFirst.iTaskId < aSecond.iTaskId ) - { - return -1; - } - else if ( aFirst.iTaskId > aSecond.iTaskId ) - { - return 1; - } - - return 0; - } - -// ----------------------------------------------------------------------------- -// CSConTaskQueue::Match( const CSConTask& aFirst, const CSConTask& aSecond ) -// Matches the task numbers -// ----------------------------------------------------------------------------- -// -TInt CSConTaskQueue::Match( const CSConTask& aFirst, const CSConTask& aSecond ) - { - if ( aFirst.iTaskId == aSecond.iTaskId ) - { - return ETrue; - } - - return EFalse; - } -// End of file diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/services/pcd/src/sconsbeclient.cpp --- a/connectivitymodules/SeCon/services/pcd/src/sconsbeclient.cpp Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1725 +0,0 @@ -/* -* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: CSConSBEClient implementation -* -*/ - - -// INCLUDE FILES - -#include -#include - -#include "sconsbeclient.h" -#include "debug.h" - - -_LIT( KSConNoDrive, "\x0" ); -_LIT( KSConDriveExists, "\x1" ); -// ============================= MEMBER FUNCTIONS ============================== - -// ----------------------------------------------------------------------------- -// CSConSBEClient::NewL( cosnt TInt aMaxObjectSize ) -// Two-phase constructor -// ----------------------------------------------------------------------------- -// -CSConSBEClient* CSConSBEClient::NewL( const TInt aMaxObjectSize, RFs& aFs ) - { - TRACE_FUNC; - CSConSBEClient* self = new (ELeave) CSConSBEClient( aMaxObjectSize, aFs ); - return self; - } - -// ----------------------------------------------------------------------------- -// CSConSBEClient::CSConSBEClient( const TInt aMaxObjectSize ) -// Constructor -// ----------------------------------------------------------------------------- -// -CSConSBEClient::CSConSBEClient( const TInt aMaxObjectSize, RFs& aFs ) : - CActive( EPriorityStandard ), iSBEClient(NULL), - iProcessComplete(EFalse), iProcessIndex( 0 ), iDataPos( 0 ), - iDataLeft( EFalse ), iBURModeNormal( ETrue ), - iRestoreMode( EFalse ), iFs( aFs ) - { - iMaxObjectSize = aMaxObjectSize; - } - -// ----------------------------------------------------------------------------- -// CSConSBEClient::~CSConSBEClient() -// Initializes member data -// ----------------------------------------------------------------------------- -// -CSConSBEClient::~CSConSBEClient() - { - TRACE_FUNC_ENTRY; - TInt err( KErrNone ); - - if( !iBURModeNormal && iSBEClient ) - { - TDriveList driveList; - - for( TInt i = 0; iSetBURModeL( driveList, EBURNormal, ENoBackup ) ); - } - - if( iSBEClient ) - { - delete iSBEClient; - iSBEClient = NULL; - } - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConSBEClient::SetBURMode( TRequestStatus& aStatus, CSConTask*& aTask ) -// Set backup/restore mode -// ----------------------------------------------------------------------------- -// -void CSConSBEClient::SetBURMode( TRequestStatus& aStatus, CSConTask*& aTask ) - { - TRACE_FUNC_ENTRY; - iCallerStatus = &aStatus; - *iCallerStatus = KRequestPending; - - iCurrentTask = aTask; - - TRequestStatus* status = &iStatus; - User::RequestComplete( status, KErrNone ); - SetActive(); - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConSBEClient::ListPublicFiles( TRequestStatus& aStatus, -// CSConTask*& aTask ) -// Lists public files from data owners -// ----------------------------------------------------------------------------- -// -void CSConSBEClient::ListPublicFiles( TRequestStatus& aStatus, - CSConTask*& aTask ) - { - TRACE_FUNC_ENTRY; - iCallerStatus = &aStatus; - *iCallerStatus = KRequestPending; - - iCurrentTask = aTask; - - TRequestStatus* status = &iStatus; - User::RequestComplete( status, KErrNone ); - SetActive(); - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConSBEClient::ListDataOwners( TRequestStatus& aStatus, CSConTask*& aTask ) -// Lists participant data owners -// ----------------------------------------------------------------------------- -// -void CSConSBEClient::ListDataOwners( TRequestStatus& aStatus, CSConTask*& aTask ) - { - TRACE_FUNC_ENTRY; - iCallerStatus = &aStatus; - *iCallerStatus = KRequestPending; - - iCurrentTask = aTask; - - TRequestStatus* status = &iStatus; - User::RequestComplete( status, KErrNone ); - SetActive(); - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConSBEClient::GetDataSize( TRequestStatus& aStatus, CSConTask*& aTask ) -// Lists data sizes from data owners -// ----------------------------------------------------------------------------- -// -void CSConSBEClient::GetDataSize( TRequestStatus& aStatus, CSConTask*& aTask ) - { - TRACE_FUNC_ENTRY; - iCallerStatus = &aStatus; - *iCallerStatus = KRequestPending; - - iCurrentTask = aTask; - - TRequestStatus* status = &iStatus; - User::RequestComplete( status, KErrNone ); - SetActive(); - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConSBEClient::RequestData( TRequestStatus& aStatus, CSConTask*& aTask ) -// Request a data from a data owner -// ----------------------------------------------------------------------------- -// -void CSConSBEClient::RequestData( TRequestStatus& aStatus, CSConTask*& aTask ) - { - TRACE_FUNC_ENTRY; - iCallerStatus = &aStatus; - *iCallerStatus = KRequestPending; - - iCurrentTask = aTask; - - TRequestStatus* status = &iStatus; - User::RequestComplete( status, KErrNone ); - SetActive(); - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConSBEClient::GetDataOwnerStatus( TRequestStatus& aStatus, -// CSConTask*& aTask ) -// Lists the status of data owners -// ----------------------------------------------------------------------------- -// -void CSConSBEClient::GetDataOwnerStatus( TRequestStatus& aStatus, - CSConTask*& aTask ) - { - TRACE_FUNC_ENTRY; - iCallerStatus = &aStatus; - *iCallerStatus = KRequestPending; - - iCurrentTask = aTask; - - TRequestStatus* status = &iStatus; - User::RequestComplete( status, KErrNone ); - SetActive(); - - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConSBEClient::SupplyData( TRequestStatus& aStatus, CSConTask*& aTask ) -// Supplies a data to a data owner -// ----------------------------------------------------------------------------- -// -void CSConSBEClient::SupplyData( TRequestStatus& aStatus, CSConTask*& aTask ) - { - TRACE_FUNC_ENTRY; - iCallerStatus = &aStatus; - *iCallerStatus = KRequestPending; - - iCurrentTask = aTask; - - TRequestStatus* status = &iStatus; - User::RequestComplete( status, KErrNone ); - SetActive(); - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConSBEClient::DoCancel() -// Implementation of CActive::DoCancel() -// ----------------------------------------------------------------------------- -// -void CSConSBEClient::DoCancel() - { - TRACE_FUNC; - } - -// ----------------------------------------------------------------------------- -// CSConSBEClient::RunL() -// Implementation of CActive::RunL() -// ----------------------------------------------------------------------------- -// -void CSConSBEClient::RunL() - { - TRACE_FUNC_ENTRY; - TInt err( KErrNone ); - TInt ret( KErrNone ); - - //Initialize a connection to the backup server - if( !iSBEClient ) - { - iSBEClient = CSBEClient::NewL(); - } - - switch( iCurrentTask->GetServiceId() ) - { - case ESetBURMode : - LOGGER_WRITE( "CSConSBEClient::RunL() : ESetBURMode" ); - TRAP( err, ProcessSetBURModeL() ); - LOGGER_WRITE_1( "CSConSBEClient::RunL() : ProcessSetBURModeL() : returned %d", err ); - HandleSBEErrorL( err ); - User::RequestComplete( iCallerStatus, err ); - break; - case EListPublicFiles : - LOGGER_WRITE( "CSConSBEClient::RunL() : EListPublicFiles" ); - TRAP( err, ProcessListPublicFilesL() ); - LOGGER_WRITE_1( "CSConSBEClient::RunL() : ProcessListPublicFilesL() : returned %d", err ); - HandleSBEErrorL( err ); - User::RequestComplete( iCallerStatus, err ); - break; - case EListDataOwners : - LOGGER_WRITE( "CSConSBEClient::RunL() : EListDataOwners" ); - TRAP( err, ProcessListDataOwnersL() ); - LOGGER_WRITE_1( "CSConSBEClient::RunL() : ProcessListDataOwnersL() : returned %d", err ); - HandleSBEErrorL( err ); - User::RequestComplete( iCallerStatus, err ); - break; - case EGetDataSize : - LOGGER_WRITE( "CSConSBEClient::RunL() : EGetDataSize" ); - TRAP( err, ProcessGetDataSizeL() ); - LOGGER_WRITE_1( "CSConSBEClient::RunL() : ProcessGetDataSizeL() : returned %d", err ); - HandleSBEErrorL( err ); - User::RequestComplete( iCallerStatus, err ); - break; - case ERequestData : - LOGGER_WRITE( "CSConSBEClient::RunL() : ERequestData" ); - TRAP( err, ret = ProcessRequestDataL() ); - LOGGER_WRITE_1( "CSConSBEClient::RunL() : ProcessRequestDataL() : returned %d", err ); - HandleSBEErrorL( err ); - - if( err == KErrNone ) - { - err = ret; - } - - User::RequestComplete( iCallerStatus, err ); - break; - case EGetDataOwnerStatus : - LOGGER_WRITE( "CSConSBEClient::RunL() : EGetDataOwnerStatus" ); - TRAP( err, ProcessGetDataOwnerStatusL() ); - LOGGER_WRITE_1( "CSConSBEClient::RunL() : ProcessGetDataOwnerStatusL() : returned %d", err ); - HandleSBEErrorL( err ); - User::RequestComplete( iCallerStatus, err ); - break; - case ESupplyData : - LOGGER_WRITE( "CSConSBEClient::RunL() : ESupplyData" ); - TRAP( err, ret = ProcessSupplyDataL() ); - LOGGER_WRITE_1( "CSConSBEClient::RunL() : SupplyDataL() : returned %d", err ); - HandleSBEErrorL( err ); - - if( err == KErrNone ) - { - err = ret; - } - - User::RequestComplete( iCallerStatus, err ); - break; - default : - LOGGER_WRITE( "CSConSBEClient::RunL() : ERROR! Unknown!" ); - break; - } - - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConSBEClient::ProcessSetBURModeL() -// Executes SetBURMode task -// ----------------------------------------------------------------------------- -// -void CSConSBEClient::ProcessSetBURModeL() - { - TRACE_FUNC_ENTRY; - - iAllSnapshotsSuppliedCalled = EFalse; - - TDriveList driveList = iCurrentTask->iBURModeParams->iDriveList; - - TBURPartType partialType = EBURUnset; - iRestoreMode = EFalse; - - switch( iCurrentTask->iBURModeParams->iPartialType ) - { - case ESConBurNormal : - partialType = EBURNormal; - break; - case ESConBurBackupFull : - partialType = EBURBackupFull; - break; - case ESConBurBackupPartial : - partialType = EBURBackupPartial; - break; - case ESConBurRestoreFull : - partialType = EBURRestoreFull; - iRestoreMode = ETrue; - break; - case ESConBurRestorePartial : - partialType = EBURRestorePartial; - iRestoreMode = ETrue; - break; - default : - partialType = EBURUnset; - break; - } - - TBackupIncType incType = ENoBackup; - - switch( iCurrentTask->iBURModeParams->iIncType ) - { - case ESConNoBackup : - incType = ENoBackup; - break; - case ESConBackupBase : - incType = EBackupBase; - break; - case ESConBackupIncrement : - incType = EBackupIncrement; - break; - default : - incType = ENoBackup; - break; - } - - iSBEClient->SetBURModeL( driveList, partialType, incType ); - - if( partialType != EBURNormal ) - { - iBURModeNormal = EFalse; - } - else - { - iBURModeNormal = ETrue; - } - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConSBEClient::ProcessListPublicFilesL() -// Executes ListPublicFiles task -// ----------------------------------------------------------------------------- -// -void CSConSBEClient::ProcessListPublicFilesL() - { - TRACE_FUNC_ENTRY; - //Get the secure id - TSecureId sid = iCurrentTask->iPubFilesParams->iDataOwners[0]->iUid; - TSecureId packageSid; - LOGGER_WRITE_1("DO: 0x%08x", sid.iId); - TPtrC packageName(KNullDesC); - const TUint KSConUidLength = 8; // 8 digits (hex) - const TUint KSConUidPrefixLength = 3; // prefix is '#0x' - - TInt packageNameLength = iCurrentTask->iPubFilesParams->iDataOwners[0]->iPackageName.Length(); - - if ( packageNameLength > KSConUidLength ) - { - // remove uid from package name - packageName.Set( - iCurrentTask->iPubFilesParams->iDataOwners[0]-> - iPackageName.Left( packageNameLength - (KSConUidLength + KSConUidPrefixLength) ) ); - LOGGER_WRITE_1("PackageName: %S", &packageName ); - - TPtrC sidPtr( iCurrentTask->iPubFilesParams->iDataOwners[0]-> - iPackageName.Right( KSConUidLength ) ); - TLex lex(sidPtr); - TInt err = lex.Val( packageSid.iId, EHex ); - if ( err ) - { - LOGGER_WRITE_1("lex.Val error: %d", err); - packageName.Set( KNullDesC ); - packageSid.iId = 0; - } - LOGGER_WRITE_1("packageSid: 0x%08x", packageSid.iId ); - } - - //Get the drive list - TDriveList driveList = - iCurrentTask->iPubFilesParams->iDataOwners[0]->iDriveList; - - RFileArray files; - CleanupClosePushL( files ); - //Go through all the drives in the list - for( TInt i = 0; i < KMaxDrives; i++ ) - { - if( driveList[i] ) - { - //Get files from the drive - TDriveNumber driveNumber = GetDriveNumber( i ); - LOGGER_WRITE_1("driveNumber: %d", driveNumber); - - LOGGER_WRITE("List public files using CSBSecureId"); - CSBSecureId* secureId = CSBSecureId::NewL( sid ); - CleanupStack::PushL( secureId ); - - TRAPD( err, iSBEClient->PublicFileListL( driveNumber, *secureId, files ) ); - - if( err != KErrNone && err != KErrNotFound ) - { - LOGGER_WRITE_1("iSBEClient->PublicFileListL leaved: %d", err); - User::LeaveIfError( err ); - } - - CleanupStack::PopAndDestroy( secureId ); - LOGGER_WRITE_1("public files: %d", files.Count()); - AppendFilesToFilelistL( files, iCurrentTask->iPubFilesParams->iFiles) ; - - if ( packageName.Length() > 0 ) - { - LOGGER_WRITE("Append files registered to packages. Using CSBPackageId"); - - CSBPackageId* packageId = CSBPackageId::NewL( - iCurrentTask->iPubFilesParams->iDataOwners[0]->iUid, - packageSid, - packageName ); - CleanupStack::PushL( packageId ); - - TRAPD( err, iSBEClient->PublicFileListL( driveNumber, *packageId, files ) ); - if( err != KErrNone && err != KErrNotFound ) - { - LOGGER_WRITE_1("iSBEClient->PublicFileListL leaved: %d", err); - User::LeaveIfError( err ); - } - CleanupStack::PopAndDestroy( packageId ); - - LOGGER_WRITE_1("public files: %d", files.Count()); - AppendFilesToFilelistL( files, iCurrentTask->iPubFilesParams->iFiles) ; - } - - files.Reset(); - } - } - CleanupStack::PopAndDestroy( &files ); - TRACE_FUNC_EXIT; - } - - -// ----------------------------------------------------------------------------- -// CSConSBEClient::ProcessListDataOwnersL() -// Executes ListDataOwners task -// ----------------------------------------------------------------------------- -// -void CSConSBEClient::ProcessListDataOwnersL() - { - TRACE_FUNC_ENTRY; - TBool includeToList( ETrue ); - RPointerArray dataOwners; - RArray packageArray; - CleanupResetAndDestroyPushL( dataOwners ); - CleanupClosePushL( packageArray ); - - iSBEClient->ListOfDataOwnersL( dataOwners ); - LOGGER_WRITE_1( "dataOwners count: %d", dataOwners.Count() ); - - - for( TInt i = 0; i < dataOwners.Count(); i++ ) - { - LOGGER_WRITE_2("handling do: %d, count: %d", i, dataOwners.Count()); - CSConDataOwner* dataOwner = new (ELeave) CSConDataOwner(); - // default values - TSecureId sid( 0 ); - includeToList = ETrue; - - TCommonBURSettings commonOptions = dataOwners[i]->CommonSettings(); - TPassiveBURSettings passiveOptions = dataOwners[i]->PassiveSettings(); - TActiveBURSettings activeOptions = dataOwners[i]->ActiveSettings(); - - //active, passive or hybrid? (common) - if( commonOptions & EActiveBUR && commonOptions & EPassiveBUR ) - { - dataOwner->iType = EHybridDataOwner; - } - else if( commonOptions & EActiveBUR ) - { - dataOwner->iType = EActiveDataOwner; - } - else if( commonOptions & EPassiveBUR ) - { - dataOwner->iType = EPassiveDataOwner; - } - - //requires reboot? (common) - if( commonOptions & ERequiresReboot ) - { - dataOwner->iReqReboot = ETrue; - } - else - { - dataOwner->iReqReboot = EFalse; - } - - //has system files? (common) - if( commonOptions & EHasSystemFiles ) - { - dataOwner->iHasFiles = ESystemFiles; - } - - //supports selective? (common) - if( commonOptions & ESupportsSelective ) - { - dataOwner->iSupportsSel = ETrue; - } - else - { - dataOwner->iSupportsSel = EFalse; - } - - //has public files? (passive) - if( passiveOptions & EHasPublicFiles ) - { - if( dataOwner->iHasFiles == ESystemFiles ) - { - dataOwner->iHasFiles = EPublicSystemFiles; - } - else - { - dataOwner->iHasFiles = EPublicFiles; - } - } - - //supports incremental? (active and passive) - if( activeOptions & EActiveSupportsInc || - passiveOptions & EPassiveSupportsInc ) - { - dataOwner->iSupportsInc = ETrue; - } - else - { - dataOwner->iSupportsInc = EFalse; - } - - //delay to prepare data? (active) - if( activeOptions & EDelayToPrepareData ) - { - dataOwner->iDelayToPrep = ETrue; - } - else - { - dataOwner->iDelayToPrep = EFalse; - } - - //fill drivelist - dataOwner->iDriveList = dataOwners[i]->DriveList(); - //filter the drive list - FilterDriveList( dataOwner->iDriveList ); - - CSBGenericDataType* genericData = &( dataOwners[i]->Identifier() ); - TSBDerivedType derived = genericData->DerivedTypeL(); - - if( derived == ESIDDerivedType ) - { - //Uif of the data owner - CSBSecureId* secureId = CSBSecureId::NewL( genericData ); - CleanupStack::PushL( secureId ); - sid = secureId->SecureIdL(); - - dataOwner->iUid.iUid = (TInt32)sid.iId; - LOGGER_WRITE_1("ESIDDerivedType, sid: 0x%08x", dataOwner->iUid.iUid ); - - CleanupStack::PopAndDestroy( secureId ); - } - else if( derived == EPackageDerivedType ) - { - //Package name and uid of the data owner - CSBPackageId* packageId = CSBPackageId::NewL( genericData ); - CleanupStack::PushL( packageId ); - - dataOwner->iPackageName = packageId->PackageNameL(); - dataOwner->iUid.iUid = packageId->PackageIdL().iUid; - LOGGER_WRITE_1("EPackageDerivedType, uid: 0x%08x", dataOwner->iUid.iUid ); - sid = packageId->SecureIdL(); - LOGGER_WRITE_1("sid: 0x%08x", sid.iId ); - - // owerload the package name, also add sid information. - _LIT(KSidFormat, "#0x%08x"); - const TInt KSidFormatLength = 11; - TBuf sidFormat; - sidFormat.Format( KSidFormat, sid.iId ); - if ( dataOwner->iPackageName.Length() + sidFormat.Length() - <= dataOwner->iPackageName.MaxLength() ) - { - dataOwner->iPackageName.Append( sidFormat ); - } - else - { - LOGGER_WRITE("WARNING: Package name too long, sid not included."); - } - - LOGGER_WRITE_1("Package name: %S", &dataOwner->iPackageName ); - if( sid ) - { - //Find if the package is already included to dataowner list - if( packageArray.Find( packageId->PackageIdL(), - CSConSBEClient::Match ) != KErrNotFound ) - { - LOGGER_WRITE("dataowner was already included to list"); - //Don't include dataowner to list again - includeToList = EFalse; - } - else - { - //Store package's id for filtering - LOGGER_WRITE_1( "Storing package id for filtering, uid: 0x%08x", dataOwner->iUid.iUid ); - packageArray.Append( dataOwner->iUid ); - } - } - - CleanupStack::PopAndDestroy( packageId ); - } - else if( derived == EJavaDerivedType ) - { - //Hash - CSBJavaId* javaId = CSBJavaId::NewL( genericData ); - CleanupStack::PushL( javaId ); - - //Initialize with hash data length and copy hash - dataOwner->iJavaHash = HBufC::NewL( javaId->SuiteHashL().Length() ); - dataOwner->iJavaHash->Des().Copy( javaId->SuiteHashL() ); - - //For ConML: set as passive package - dataOwner->iType = EPassiveDataOwner; - dataOwner->iPackageName.Copy( javaId->SuiteNameL() ); - -#ifdef _DEBUG - LOGGER_WRITE("EJavaDerivedType" ); - LOGGER_WRITE_1("Package name: %S", &dataOwner->iPackageName ); - TPtrC hash( dataOwner->iJavaHash->Des() ); - LOGGER_WRITE_1("JavaHash: %S", &hash ); -#endif - - CleanupStack::PopAndDestroy( javaId ); - } - else - { - LOGGER_WRITE("Unknown type, ignored from list" ); - //Unknown type => ignore from list - includeToList = EFalse; - } - - if( includeToList ) - { - LOGGER_WRITE_1( "Appending to list, uid: 0x%08x", dataOwner->iUid.iUid ); - iCurrentTask->iListDataOwnersParams->iDataOwners.Append( dataOwner ); - } - - if( sid ) - { - LOGGER_WRITE_1( "Appending package sid to list, sid: 0x%08x", sid.iId ); - CSConDataOwner* packageDataOwner = dataOwner->CopyL(); - //Clear package name - packageDataOwner->iPackageName = KNullDesC(); - //Add sid - packageDataOwner->iUid.iUid = sid.iId; - iCurrentTask->iListDataOwnersParams->iDataOwners.Append( packageDataOwner ); - } - - if( !includeToList ) - { - //Not included to list => delete memory allocation - delete dataOwner; - } - } - - packageArray.Reset(); - CleanupStack::PopAndDestroy( &packageArray ); - CleanupStack::PopAndDestroy( &dataOwners ); - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConSBEClient::ProcessGetDataSizeL() -// Executes GetDataSize task -// ----------------------------------------------------------------------------- -// -void CSConSBEClient::ProcessGetDataSizeL() - { - TRACE_FUNC_ENTRY; - - if ( !iAllSnapshotsSuppliedCalled ) - { - TInt err(KErrNone); - // we have to call AllSnapshotsSupplied() to inform active - // data owners to start prepare their base data. - TRAP( err, iSBEClient->AllSnapshotsSuppliedL() ); - LOGGER_WRITE_1( "AllSnapshotsSuppliedL() leaved: %d", err ); - iAllSnapshotsSuppliedCalled = ETrue; - } - - - TBool packageData( EFalse ); - - //Calculate data size for every data owner received from the task - for( TInt i = 0; i < iCurrentTask->iGetDataSizeParams->iDataOwners.Count(); - i++ ) - { - packageData = EFalse; - CSConDataOwner* dataOwner = - iCurrentTask->iGetDataSizeParams->iDataOwners[i]; - - TTransferDataType tdt( ERegistrationData ); - TPackageDataType pdt( ESystemData ); - - LOGGER_WRITE_2( "ProcessGetDataSizeL DO %d of %d", i, iCurrentTask->iGetDataSizeParams->iDataOwners.Count() ); - LOGGER_WRITE_1( "ProcessGetDataSizeL SID 0x%08x", dataOwner->iUid ); - switch( dataOwner->iTransDataType ) - { - case ESConRegistrationData : - LOGGER_WRITE( "CSConSBEClient::ProcessGetDataSize() : ERegistrationData" ); - tdt = ERegistrationData; - break; - case ESConPassiveSnapshotData : - LOGGER_WRITE( "CSConSBEClient::ProcessGetDataSize() : EPassiveSnapshotData" ); - tdt = EPassiveSnapshotData; - break; - case ESConPassiveBaseData : - LOGGER_WRITE( "CSConSBEClient::ProcessGetDataSize() : EPassiveBaseData" ); - tdt = EPassiveBaseData; - break; - case ESConPassiveIncrementalData : - LOGGER_WRITE( "CSConSBEClient::ProcessGetDataSize() : EPassiveIncrementalData" ); - tdt = EPassiveIncrementalData; - break; - case ESConActiveSnapshotData : - LOGGER_WRITE( "CSConSBEClient::ProcessGetDataSize() : EActiveSnapshotData" ); - tdt = EActiveSnapshotData; - break; - case ESConActiveBaseData : - LOGGER_WRITE( "CSConSBEClient::ProcessGetDataSize() : EActiveBaseData" ); - tdt = EActiveBaseData; - break; - case ESConActiveIncrementalData : - LOGGER_WRITE( "CSConSBEClient::ProcessGetDataSize() : EActiveIncrementalData" ); - tdt = EActiveIncrementalData; - break; - case ESConSystemData : - LOGGER_WRITE( "CSConSBEClient::ProcessGetDataSize() : ESystemData" ); - pdt = ESystemData; - packageData = ETrue; - break; - case ESConSystemSnapshotData : - LOGGER_WRITE( "CSConSBEClient::ProcessGetDataSize() : ESystemSnapshotData" ); - pdt = ESystemSnapshotData; - packageData = ETrue; - break; - default : - break; - } - - if( packageData && !dataOwner->iJavaHash ) - { - dataOwner->iSize = PackageDataSizeL( dataOwner->iUid, dataOwner->iDriveList, pdt ); - } - else if( !dataOwner->iJavaHash ) - { - dataOwner->iSize = SidDataSizeL( dataOwner->iUid, dataOwner->iDriveList, tdt ); - } - else - { - dataOwner->iSize = JavaDataSizeL( dataOwner->iJavaHash->Des(), - dataOwner->iDriveList ); - } - } - - TRACE_FUNC_EXIT; - } - - -// ----------------------------------------------------------------------------- -// CSConSBEClient::ProcessRequestDataL() -// Executes RequestData task -// ----------------------------------------------------------------------------- -// -TInt CSConSBEClient::ProcessRequestDataL() - { - TRACE_FUNC_ENTRY; - TInt ret( KErrNone ); - - if( iMaxObjectSize <= 1 ) - { - User::Leave( KErrGeneral ); - } - - TBool packageData = EFalse; - TTransferDataType transferDataType( ERegistrationData ); - TPackageDataType packageDataType( ESystemSnapshotData ); - LOGGER_WRITE_1("CSConSBEClient::ProcessRequestDataL() iTransDataType: %d", - (TInt)iCurrentTask->iRequestDataParams->iDataOwner->iTransDataType); - - switch( iCurrentTask->iRequestDataParams->iDataOwner->iTransDataType ) - { - case ESConRegistrationData : - transferDataType = ERegistrationData; - break; - case ESConPassiveSnapshotData : - transferDataType = EPassiveSnapshotData; - break; - case ESConPassiveBaseData : - transferDataType = EPassiveBaseData; - break; - case ESConPassiveIncrementalData : - transferDataType = EPassiveIncrementalData; - break; - case ESConActiveSnapshotData : - transferDataType = EActiveSnapshotData; - break; - case ESConActiveBaseData : - transferDataType = EActiveBaseData; - break; - case ESConActiveIncrementalData : - transferDataType = EActiveIncrementalData; - break; - case ESConSystemData : - packageDataType = ESystemData; - packageData = ETrue; - break; - case ESConSystemSnapshotData: - packageDataType = ESystemSnapshotData; - packageData = ETrue; - break; - default : - break; - } - - - //Get the drive number - TDriveNumber driveNumber = EDriveC; - TDriveList driveList = iCurrentTask->iRequestDataParams-> - iDataOwner->iDriveList; - - for( TInt i = 0; i < KMaxDrives; i++ ) - { - if( driveList[i] ) - { - driveNumber = GetDriveNumber( i ); - break; - } - } - - //Get UID, SID or Java hash - TUid uid; - TSecureId sid; - - uid.iUid = 0; - sid.iId = 0; - - if( packageData && !iCurrentTask->iRequestDataParams->iDataOwner->iJavaHash ) - { - uid = iCurrentTask->iRequestDataParams->iDataOwner->iUid; - LOGGER_WRITE_1("CSConSBEClient::ProcessRequestDataL() uid: 0x%08x", uid.iUid); - } - else if( !iCurrentTask->iRequestDataParams->iDataOwner->iJavaHash ) - { - sid = iCurrentTask->iRequestDataParams->iDataOwner->iUid; - LOGGER_WRITE_1("CSConSBEClient::ProcessRequestDataL() sid: 0x%08x", sid.iId); - } - - CSBPackageTransferType* ptt( NULL ); - CSBSIDTransferType* stt( NULL ); - CSBJavaTransferType* jtt( NULL ); - - LOGGER_WRITE_1( "CSConSBEClient::ProcessRequestDataL() : \ - Begin - Data left: %d", iDataLeft ); - LOGGER_WRITE_1( "CSConSBEClient::ProcessRequestDataL() : \ - Begin - Package data: %d", packageData ); - LOGGER_WRITE_1( "CSConSBEClient::ProcessRequestDataL() : \ - Begin - iDataPos: %d", iDataPos ); - - //Are there old data left to be transfered? - if( !iDataLeft ) - { - //No data left, request more from the server - if( packageData && !iCurrentTask->iRequestDataParams->iDataOwner->iJavaHash ) - { - ptt = CSBPackageTransferType::NewL( uid, driveNumber, - packageDataType ); - CleanupStack::PushL( ptt ); - LOGGER_WRITE( "iSBEClient->RequestDataL( ptt ) : start" ); - TRequestStatus status; - iSBEClient->RequestDataL( *ptt, status ); - User::WaitForRequest( status ); - LOGGER_WRITE( "iSBEClint->RequestDataL( ptt ) : stop" ); - - LOGGER_WRITE_1( "CSConSBEClient::ProcessRequestDataL() : status.Int() %d", status.Int() ); - User::LeaveIfError( status.Int() ); - - //Get the data and store the handle - CSBGenericTransferType* gtt = NULL; - LOGGER_WRITE( "iDataPtr.Set( iSBEClient->TransferDataInfoL( gtt, iSBEDataLeft ) : start" ); - iDataPtr.Set( iSBEClient->TransferDataInfoL( gtt, iLastChunk ) ); - LOGGER_WRITE( "iDataPtr.Set( iSBEClient->TransferDataInfoL( gtt, iSBEDataLeft ) : stop" ); - LOGGER_WRITE_1( "CSConSBEClient::ProcessRequestDataL() :\ - Received data size %d", iDataPtr.Length() ); - LOGGER_WRITE_1( "CSConSBEClient::ProcessRequestDataL() :\ - Received from DO 0x%08x", uid ); - LOGGER_WRITE_1( "CSConSBEClient::ProcessRequestDataL() :\ - Is last chunk %d", iLastChunk ); - LOGGER_WRITE_1( "CSConSBEClient::ProcessRequestDataL() :\ - Transfertype %d", iCurrentTask->iRequestDataParams->iDataOwner->iTransDataType ); - - if( gtt ) - { - delete gtt; - } - - CleanupStack::PopAndDestroy( ptt ); - } - else if( !iCurrentTask->iRequestDataParams->iDataOwner->iJavaHash ) - { - stt = CSBSIDTransferType::NewL( sid, driveNumber, transferDataType ); - CleanupStack::PushL( stt ); - LOGGER_WRITE( "iSBEClient->RequestDataL( stt ) : start" ); - TRequestStatus status; - iSBEClient->RequestDataL( *stt, status ); - User::WaitForRequest( status ); - LOGGER_WRITE( "iSBEClient->RequestDataL( stt ) : stop" ); - - LOGGER_WRITE_1( "CSConSBEClient::ProcessRequestDataL() :\ - status.Int() %d", status.Int() ); - User::LeaveIfError( status.Int() ); - - //Get the data and store the handle - CSBGenericTransferType* gtt = NULL; - LOGGER_WRITE( "iDataPtr.Set( iSBEClient->TransferDataInfoL( gtt, iSBEDataLeft ) : start" ); - iDataPtr.Set( iSBEClient->TransferDataInfoL( gtt, iLastChunk ) ); - LOGGER_WRITE( "iDataPtr.Set( iSBEClient->TransferDataInfoL( gtt, iSBEDataLeft ) : stop" ); - LOGGER_WRITE_1( "CSConSBEClient::ProcessRequestDataL() :\ - Received data size %d", iDataPtr.Length() ); - LOGGER_WRITE_1( "CSConSBEClient::ProcessRequestDataL() :\ - Is last chunk %d", iLastChunk ); - LOGGER_WRITE_1( "CSConSBEClient::ProcessRequestDataL() :\ - Transfertype %d", - iCurrentTask->iRequestDataParams->iDataOwner->iTransDataType ); - - if( gtt ) - { - delete gtt; - } - - CleanupStack::PopAndDestroy( stt ); - } - else - { - TPtr javaHashPtr = iCurrentTask->iRequestDataParams->iDataOwner->iJavaHash->Des(); - - //When ESystemData is requested, request EJavaMIDlet - if( packageDataType == ESystemData ) - { - jtt = CSBJavaTransferType::NewL( javaHashPtr, driveNumber, EJavaMIDlet ); - } - //When EPassiveBaseData is requested, request EJavaMIDletData - else if( transferDataType == EPassiveBaseData ) - { - jtt = CSBJavaTransferType::NewL( javaHashPtr, driveNumber, EJavaMIDletData ); - } - - if( packageDataType == ESystemData || transferDataType == EPassiveBaseData ) - { - CleanupStack::PushL( jtt ); - LOGGER_WRITE( "iSBEClient->RequestDataL( jtt ) : start" ); - TRequestStatus status; - iSBEClient->RequestDataL( *jtt, status ); - User::WaitForRequest( status ); - LOGGER_WRITE( "iSBEClient->RequestDataL( jtt ) : stop" ); - - LOGGER_WRITE_1( "CSConSBEClient::ProcessRequestDataL() :\ - status.Int() %d", status.Int() ); - User::LeaveIfError( status.Int() ); - - //Get the data and store the handle - CSBGenericTransferType* gtt = NULL; - LOGGER_WRITE( "iDataPtr.Set( iSBEClient->TransferDataInfoL( gtt, iSBEDataLeft ) : start" ); - iDataPtr.Set( iSBEClient->TransferDataInfoL( gtt, iLastChunk ) ); - LOGGER_WRITE( "iDataPtr.Set( iSBEClient->TransferDataInfoL( gtt, iSBEDataLeft ): stop" ); - LOGGER_WRITE_1( "CSConSBEClient::ProcessRequestDataL() :\ - Received data size %d", iDataPtr.Length() ); - LOGGER_WRITE_1( "CSConSBEClient::ProcessRequestDataL() :\ - Is last chunk %d", iLastChunk ); - LOGGER_WRITE_1( "CSConSBEClient::ProcessRequestDataL() :\ - Transfertype %d", - iCurrentTask->iRequestDataParams->iDataOwner->iTransDataType ); - - if( gtt ) - { - delete gtt; - } - - CleanupStack::PopAndDestroy( jtt ); - } - else - { - //No data - iDataPtr.Set( KNullDesC8 ); - iLastChunk = ETrue; - } - } - } - - TInt dataBufLength = iDataPtr.Length(); - LOGGER_WRITE_1( "CSConSBEClient::ProcessRequestDataL() : \ - Data received: %d", dataBufLength ); - - TInt maxLength = iMaxObjectSize - 1024; - LOGGER_WRITE_1( "CSConSBEClient::ProcessRequestDataL() : \ - Max length: %d", maxLength ); - - if( iCurrentTask->iRequestDataParams->iBackupData ) - { - delete iCurrentTask->iRequestDataParams->iBackupData; - iCurrentTask->iRequestDataParams->iBackupData = NULL; - } - - //Initialize the task data buffer - iCurrentTask->iRequestDataParams->iBackupData = HBufC8::NewL( maxLength ); - //Get descriptor task's buffer - TPtr8 backupDataPtr = iCurrentTask->iRequestDataParams->iBackupData->Des(); - - TInt copyPos = 0; - - //Copy data to task buffer - for( ; iDataPos < dataBufLength && copyPos < maxLength; - iDataPos++ ) - { - backupDataPtr.Append( iDataPtr[iDataPos] ); - copyPos++; - } - - LOGGER_WRITE_1( "CSConSBEClient::ProcessRequestDataL() : \ - End - copyPos: %d", copyPos ); - LOGGER_WRITE_1( "CSConSBEClient::ProcessRequestDataL() : \ - End - iDataPos: %d", iDataPos ); - - //Are there more data left in the buffer - if( iDataPos < dataBufLength ) - { - LOGGER_WRITE( "iSBEClient->RequestDataL( stt ) : There is more data in buffer" ); - iDataLeft = ETrue; - iCurrentTask->iRequestDataParams->iMoreData = ETrue; - //Another task is needed to transfer the data to the client - ret = KErrCompletion; - } - else - { - //Check if the backup server has more data from the dataowner - if( !iLastChunk ) - { - iCurrentTask->iRequestDataParams->iMoreData = ETrue; - //Another task is needed to transfer the data to the client - ret = KErrCompletion; - LOGGER_WRITE( "iSBEClient->RequestDataL( stt ) : There are more data available from SBE" ); - } - else - { - iCurrentTask->iRequestDataParams->iMoreData = EFalse; - } - - iDataPos = 0; - iDataLeft = EFalse; - } - - LOGGER_WRITE_1( "CSConSBEClient::ProcessRequestDataL() : returned %d", ret ); - return ret; - } - -// ----------------------------------------------------------------------------- -// CSConSBEClient::ProcessGetDataOwnerStatusL() -// Executes GetDataOwnerStatus task -// ----------------------------------------------------------------------------- -// -void CSConSBEClient::ProcessGetDataOwnerStatusL() - { - TRACE_FUNC_ENTRY; - - //If restore-mode, call AllSystemFilesRestored() - if( iRestoreMode ) - { - LOGGER_WRITE( "CSConSBEClient::ProcessGetDataOwnerStatusL() : iSBEClient->AllSystemFilesRestored() start" ); - iSBEClient->AllSystemFilesRestored(); - LOGGER_WRITE( "CSConSBEClient::ProcessGetDataOwnerStatusL() : iSBEClient->AllSystemFilesRestored() end" ); - } - - RSIDStatusArray sidStatus; - CleanupClosePushL(sidStatus); - - for( TInt i = 0; i < iCurrentTask->iGetDataOwnerParams->iDataOwners.Count(); - i++ ) - { - CSConDataOwner* dataOwner = - iCurrentTask->iGetDataOwnerParams->iDataOwners[i]; - TSecureId sid( dataOwner->iUid ); - TDataOwnerStatus dataOwnerStatus = EUnset; - TInt dataOwnerError = 0; - - TDataOwnerAndStatus dataOwnerAndStatus( sid, dataOwnerStatus, - dataOwnerError ); - - sidStatus.Append( dataOwnerAndStatus ); - } - - iSBEClient->SIDStatusL( sidStatus ); - - for( TInt j = 0; j < sidStatus.Count(); j++ ) - { - switch( sidStatus[j].iStatus ) - { - case EUnset : - iCurrentTask->iGetDataOwnerParams->iDataOwners[j]-> - iDataOwnStatus = ESConUnset; - break; - case EDataOwnerNotFound : - iCurrentTask->iGetDataOwnerParams->iDataOwners[j]-> - iDataOwnStatus = ESConNotFound; - break; - case EDataOwnerReady : - iCurrentTask->iGetDataOwnerParams->iDataOwners[j]-> - iDataOwnStatus = ESConReady; - break; - case EDataOwnerNotReady : - iCurrentTask->iGetDataOwnerParams->iDataOwners[j]-> - iDataOwnStatus = ESConNotReady; - break; - case EDataOwnerFailed : - iCurrentTask->iGetDataOwnerParams->iDataOwners[j]-> - iDataOwnStatus = ESConFailed; - break; - case EDataOwnerNotConnected : - iCurrentTask->iGetDataOwnerParams->iDataOwners[j]-> - iDataOwnStatus = ESConNotConnected; - break; - case EDataOwnerReadyNoImpl : - iCurrentTask->iGetDataOwnerParams->iDataOwners[j]-> - iDataOwnStatus = ESConNotImplemented; - break; - default : - break; - } - } - sidStatus.Reset(); - CleanupStack::PopAndDestroy( &sidStatus ); - - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConSBEClient::ProcessSupplyDataL() -// Executes SupplyData task -// ----------------------------------------------------------------------------- -// -TInt CSConSBEClient::ProcessSupplyDataL() - { - TRACE_FUNC_ENTRY; - TBool packageData = EFalse; - TBool lastChunk = ETrue; - TTransferDataType transferDataType( ERegistrationData ); - TPackageDataType packageDataType( ESystemSnapshotData ); - LOGGER_WRITE_1("CSConSBEClient::ProcessSupplyDataL() iTransDataType: %d", - (TInt)iCurrentTask->iSupplyDataParams->iDataOwner->iTransDataType); - switch( iCurrentTask->iSupplyDataParams->iDataOwner->iTransDataType ) - { - case ESConRegistrationData : - transferDataType = ERegistrationData; - break; - case ESConPassiveSnapshotData : - transferDataType = EPassiveSnapshotData; - break; - case ESConPassiveBaseData : - transferDataType = EPassiveBaseData; - break; - case ESConPassiveIncrementalData : - transferDataType = EPassiveIncrementalData; - break; - case ESConActiveSnapshotData : - transferDataType = EActiveSnapshotData; - break; - case ESConActiveBaseData : - transferDataType = EActiveBaseData; - break; - case ESConActiveIncrementalData : - transferDataType = EActiveIncrementalData; - break; - case ESConSystemData : - packageDataType = ESystemData; - packageData = ETrue; - break; - case ESConSystemSnapshotData: - packageDataType = ESystemSnapshotData; - packageData = ETrue; - break; - default : - break; - } - - //Get the drive number - TDriveNumber driveNumber = EDriveC; - TDriveList driveList = iCurrentTask->iSupplyDataParams->iDataOwner-> - iDriveList; - - for( TInt i = 0; i < KMaxDrives; i++ ) - { - if( driveList[i] ) - { - driveNumber = GetDriveNumber( i ); - break; - } - } - - //Get UID or SID - TUid uid; - TSecureId sid; - - uid.iUid = 0; - sid.iId = 0; - - if( packageData && !iCurrentTask->iSupplyDataParams->iDataOwner->iJavaHash ) - { - uid = iCurrentTask->iSupplyDataParams->iDataOwner->iUid; - LOGGER_WRITE_1( "CSConSBEClient::ProcessSupplyDataL() uid: 0x%08x", uid.iUid ); - } - else if( !iCurrentTask->iSupplyDataParams->iDataOwner->iJavaHash ) - { - sid = iCurrentTask->iSupplyDataParams->iDataOwner->iUid; - LOGGER_WRITE_1( "CSConSBEClient::ProcessSupplyDataL() sid: 0x%08x", sid.iId ); - } - - - if( packageData && !iCurrentTask->iSupplyDataParams->iDataOwner->iJavaHash ) - { - CSBPackageTransferType* ptt = CSBPackageTransferType::NewL( uid, driveNumber, - packageDataType ); - CleanupStack::PushL( ptt ); - - //Write restore data to chunk - LOGGER_WRITE( "iSBEClient->TransferDataAddressL().Copy() : start" ); - LOGGER_WRITE_1( "CSConSBEClient::ProcessSupplyDataL() :\ - Received data length: %d", iCurrentTask->iSupplyDataParams->iRestoreData->Length() ); - iSBEClient->TransferDataAddressL().Copy( iCurrentTask-> - iSupplyDataParams->iRestoreData->Des() ); - LOGGER_WRITE( "iSBEClient->TransferDataAddressL().Copy()" ); - - delete iCurrentTask->iSupplyDataParams->iRestoreData; - iCurrentTask->iSupplyDataParams->iRestoreData = NULL; - - //Supply data - lastChunk = !( iCurrentTask->iSupplyDataParams->iMoreData ); - LOGGER_WRITE( "iSBEClient->SupplyDataL( ptt, lastChunk ) : start" ); - TRequestStatus status; - iSBEClient->SupplyDataL( *ptt, lastChunk, status ); - User::WaitForRequest( status ); - LOGGER_WRITE( "iSBEClient->SupplyDataL( ptt, lastChunk ) : stop" ); - - User::LeaveIfError( status.Int() ); - - CleanupStack::PopAndDestroy( ptt ); - } - else if( !iCurrentTask->iSupplyDataParams->iDataOwner->iJavaHash ) - { - CSBSIDTransferType* stt = CSBSIDTransferType::NewL( sid, driveNumber, transferDataType ); - CleanupStack::PushL( stt ); - - //Write restore data to chunk - LOGGER_WRITE( "iSBEClient->TransferDataAddressL().Copy() : start" ); - LOGGER_WRITE_1( "CSConSBEClient::ProcessSupplyDataL() : Received data length: %d", - iCurrentTask->iSupplyDataParams->iRestoreData->Length() ); - iSBEClient->TransferDataAddressL().Copy( iCurrentTask-> - iSupplyDataParams->iRestoreData->Des() ); - LOGGER_WRITE( "iSBEClient->TransferDataAddressL().Copy()" ); - - delete iCurrentTask->iSupplyDataParams->iRestoreData; - iCurrentTask->iSupplyDataParams->iRestoreData = NULL; - - //Supply data - lastChunk = !( iCurrentTask->iSupplyDataParams->iMoreData ); - LOGGER_WRITE( "iSBEClient->SupplyDataL( stt, lastChunk ) : start" ); - TRequestStatus status; - iSBEClient->SupplyDataL( *stt, lastChunk, status ); - User::WaitForRequest( status ); - LOGGER_WRITE( "iSBEClient->SupplyDataL( stt, lastChunk ) : stop" ); - - User::LeaveIfError( status.Int() ); - - CleanupStack::PopAndDestroy( stt ); - } - else - { - TPtr javaHashPtr = iCurrentTask->iSupplyDataParams->iDataOwner->iJavaHash->Des(); - CSBJavaTransferType* jtt( NULL ); - if( packageDataType == ESystemData ) - { - LOGGER_WRITE( "iSBEClient->SupplyDataL java ESystemData" ); - jtt = CSBJavaTransferType::NewL( javaHashPtr, driveNumber, EJavaMIDlet ); - } - else if( transferDataType == EPassiveBaseData ) - { - LOGGER_WRITE( "iSBEClient->SupplyDataL java EPassiveBaseData" ); - jtt = CSBJavaTransferType::NewL( javaHashPtr, driveNumber, EJavaMIDletData ); - } - - if( packageDataType == ESystemData || transferDataType == EPassiveBaseData ) - { - CleanupStack::PushL( jtt ); - //Write restore data to chunk - LOGGER_WRITE( "iSBEClient->TransferDataAddressL().Copy() : start" ); - LOGGER_WRITE_1( "CSConSBEClient::ProcessSupplyDataL() : Received data length: %d", - iCurrentTask->iSupplyDataParams->iRestoreData->Length() ); - iSBEClient->TransferDataAddressL().Copy( iCurrentTask-> - iSupplyDataParams->iRestoreData->Des() ); - LOGGER_WRITE( "iSBEClient->TransferDataAddressL().Copy()" ); - - delete iCurrentTask->iSupplyDataParams->iRestoreData; - iCurrentTask->iSupplyDataParams->iRestoreData = NULL; - - //Supply data - lastChunk = !( iCurrentTask->iSupplyDataParams->iMoreData ); - LOGGER_WRITE( "iSBEClient->SupplyDataL( jtt, lastChunk ) : start" ); - TRequestStatus status; - iSBEClient->SupplyDataL( *jtt, lastChunk, status ); - User::WaitForRequest( status ); - LOGGER_WRITE( "iSBEClient->SupplyDataL( jtt, lastChunk ) : stop" ); - - User::LeaveIfError( status.Int() ); - - CleanupStack::PopAndDestroy( jtt ); - } - } - - TInt ret( KErrNone ); - - if( !lastChunk ) - { - ret = KErrCompletion; - } - - LOGGER_WRITE_1( "CSConSBEClient::ProcessSupplyDataL() : returned %d", ret ); - return ret; - } - -// ----------------------------------------------------------------------------- -// CSConSBEClient::GetDriveNumber( const TInt& aDrive ) const -// Maps TInt drive number to TDriveNumber -// ----------------------------------------------------------------------------- -// -TDriveNumber CSConSBEClient::GetDriveNumber( const TInt& aDrive ) const - { - TDriveNumber driveNumber; - switch( aDrive ) - { - case 0 : - driveNumber = EDriveA; - break; - case 1 : - driveNumber = EDriveB; - break; - case 2 : - driveNumber = EDriveC; - break; - case 3 : - driveNumber = EDriveD; - break; - case 4 : - driveNumber = EDriveE; - break; - case 5 : - driveNumber = EDriveF; - break; - case 6 : - driveNumber = EDriveG; - break; - case 7 : - driveNumber = EDriveH; - break; - case 8 : - driveNumber = EDriveI; - break; - case 9 : - driveNumber = EDriveJ; - break; - case 10 : - driveNumber = EDriveK; - break; - case 11 : - driveNumber = EDriveL; - break; - case 12 : - driveNumber = EDriveM; - break; - case 13 : - driveNumber = EDriveN; - break; - case 14 : - driveNumber = EDriveO; - break; - case 15 : - driveNumber = EDriveP; - break; - case 16 : - driveNumber = EDriveQ; - break; - case 17 : - driveNumber = EDriveR; - break; - case 18 : - driveNumber = EDriveS; - break; - case 19 : - driveNumber = EDriveT; - break; - case 20 : - driveNumber = EDriveU; - break; - case 21 : - driveNumber = EDriveV; - break; - case 22 : - driveNumber = EDriveW; - break; - case 23 : - driveNumber = EDriveX; - break; - case 24 : - driveNumber = EDriveY; - break; - case 25 : - driveNumber = EDriveZ; - break; - default : - driveNumber = EDriveC; - break; - } - - return driveNumber; - } - -// ----------------------------------------------------------------------------- -// CSConSBEClient::FilterDriveList( TDriveList& aDriveList ) const -// Filters the drive list -// ----------------------------------------------------------------------------- -// -void CSConSBEClient::FilterDriveList( TDriveList& aDriveList ) const - { - TDriveInfo info; - - for ( TInt i = 0; i < aDriveList.Length(); i++ ) - { - if ( aDriveList[i] ) - { - iFs.Drive( info, i ); -#ifdef __WINS__ - if ( i == EDriveD ) - { - LOGGER_WRITE( "EDriveD skipped on WINS build" ); - aDriveList[i] = '\x0'; - } -#else - if ( info.iType == EMediaRam ) - { - aDriveList[i] = '\x0'; - } -#endif - } - } - - } - -// ----------------------------------------------------------------------------- -// CSConSBEClient::Match( const CSConTask& aFirst, const CSConTask& aSecond ) -// Matches the uids -// ----------------------------------------------------------------------------- -// -TInt CSConSBEClient::Match( const TUid& aFirst, const TUid& aSecond ) - { - if( aFirst == aSecond ) - { - return ETrue; - } - - return EFalse; - } - -// ----------------------------------------------------------------------------- -// CSConSBEClient::HandleSBEErrorL( TInt& aErr ) -// Handle error received from Secure Backup Engine -// ----------------------------------------------------------------------------- -// -void CSConSBEClient::HandleSBEErrorL( TInt& aErr ) - { - TRACE_FUNC_ENTRY; - LOGGER_WRITE_1( " aErr: %d", aErr ); - if( aErr == KErrServerTerminated ) - { - LOGGER_WRITE( "Re-connecting to SBE..." ); - //Session has been terminated, recreate it.. - delete iSBEClient; - iSBEClient = NULL; - iSBEClient = CSBEClient::NewL(); - } - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConSBEClient::AppendFilesToFilelistL() -// Appends files from RFileArray to RPointerArray -// ----------------------------------------------------------------------------- -// -void CSConSBEClient::AppendFilesToFilelistL( const RFileArray& aFiles, RPointerArray& aSconFiles ) - { - TRACE_FUNC_ENTRY; - _LIT( KSConXmlDate, "%F%Y%M%DT%H%T%SZ" ); - for( TInt j = 0; j < aFiles.Count(); j++ ) - { - CSConFile* fileInfo = new (ELeave) CSConFile(); - CleanupStack::PushL( fileInfo ); - fileInfo->iPath = aFiles[j].iName; - LOGGER_WRITE_1("file: %S", &fileInfo->iPath ); - - fileInfo->iSize = aFiles[j].iSize; - - switch( aFiles[j].iAtt ) - { - case KEntryAttNormal : - fileInfo->iUserPerm = EPermNormal; - break; - case KEntryAttReadOnly : - fileInfo->iUserPerm = EPermReadOnly; - break; - default : - fileInfo->iUserPerm = EPermNormal; - break; - } - - TTime time( aFiles[j].iModified ); - HBufC* timeBuf = HBufC::NewLC( KMaxTimeFormatSpec ); - TPtr timePtr = timeBuf->Des(); - time.FormatL( timePtr, KSConXmlDate ); - - fileInfo->iModified.Copy( timePtr ); - - CleanupStack::PopAndDestroy( timeBuf ); - - aSconFiles.Append( fileInfo ); - CleanupStack::Pop( fileInfo ); - } - TRACE_FUNC_EXIT; - } - - -// ----------------------------------------------------------------------------- -// CSConSBEClient::PackageDataSizeL() -// Gets Package dataowner size -// ----------------------------------------------------------------------------- -// -TUint CSConSBEClient::PackageDataSizeL( TUid aPackageId, const TDriveList& aDriveList, - TPackageDataType aPackageDataType ) const - { - TUint dataSize(0); - //Ask data size from every drive - for( TInt j = 0; j < KMaxDrives; j++ ) - { - if( aDriveList[j] ) - { - CSBPackageTransferType* ptt( NULL ); - TDriveNumber driveNumber = GetDriveNumber( j ); - LOGGER_WRITE_1( "Drive %d", driveNumber ); - ptt = CSBPackageTransferType::NewL( aPackageId, driveNumber, aPackageDataType ); - CleanupStack::PushL( ptt ); - //Get the size and store it to a variable - TRAPD( err, dataSize += iSBEClient->ExpectedDataSizeL( *ptt ) ); - CleanupStack::PopAndDestroy( ptt ); - LOGGER_WRITE_1( "ExpectedDataSizeL returned for package %d", err ); - if( err != KErrNone && err != KErrNotFound ) - { - LOGGER_WRITE_1( "ExpectedDataSizeL LEAVE %d", err ); - User::Leave( err ); - } - } - } - return dataSize; - } - -// ----------------------------------------------------------------------------- -// CSConSBEClient::SidDataSizeL() -// Gets Sid (SecureId) dataowner size -// ----------------------------------------------------------------------------- -// -TUint CSConSBEClient::SidDataSizeL( TUid aSid, const TDriveList& aDriveList, - TTransferDataType aTransferDataType ) const - { - TUint dataSize(0); - //Ask data size from every drive - for( TInt j = 0; j < KMaxDrives; j++ ) - { - if( aDriveList[j] ) - { - CSBSIDTransferType* stt( NULL ); - TDriveNumber driveNumber = GetDriveNumber( j ); - LOGGER_WRITE_1( "Drive %d", driveNumber ); - stt = CSBSIDTransferType::NewL( aSid, driveNumber, aTransferDataType ); - CleanupStack::PushL( stt ); - //Get the size and store it to a variable - TRAPD( err, dataSize += iSBEClient->ExpectedDataSizeL( *stt ) ); - CleanupStack::PopAndDestroy( stt ); - LOGGER_WRITE_1( "ExpectedDataSizeL returned for DO %d", err ); - if( err != KErrNone && err != KErrNotFound ) - { - LOGGER_WRITE_1( "ExpectedDataSizeL LEAVE %d", err ); - User::Leave( err ); - } - } - } - return dataSize; - } - -// ----------------------------------------------------------------------------- -// CSConSBEClient::JavaDataSizeL() -// Gets Java dataowner size -// ----------------------------------------------------------------------------- -// -TUint CSConSBEClient::JavaDataSizeL( const TDesC& aJavaHash, const TDriveList& aDriveList ) const - { - TUint dataSize(0); - //Ask data size from every drive - for( TInt j = 0; j < KMaxDrives; j++ ) - { - if( aDriveList[j] ) - { - CSBJavaTransferType* jtt( NULL ); - - TDriveNumber driveNumber = GetDriveNumber( j ); - LOGGER_WRITE_1( "Drive %d", driveNumber ); - jtt = CSBJavaTransferType::NewL( aJavaHash, - driveNumber, - EJavaMIDlet ); - CleanupStack::PushL( jtt ); - //Get the size and store it to a variable - TRAPD( err, dataSize += iSBEClient->ExpectedDataSizeL( *jtt ) ); - CleanupStack::PopAndDestroy( jtt ); - LOGGER_WRITE_1( "ExpectedDataSizeL returned for Java(EJavaMIDlet) DO %d", err ); - if( err != KErrNone && err != KErrNotFound ) - { - LOGGER_WRITE_1( "ExpectedDataSizeL LEAVE %d", err ); - User::Leave( err ); - } - - jtt = NULL; - jtt = CSBJavaTransferType::NewL( aJavaHash, - driveNumber, - EJavaMIDletData ); - CleanupStack::PushL( jtt ); - //Get the size and store it to a variable - TRAP( err, dataSize += iSBEClient->ExpectedDataSizeL( *jtt ) ); - CleanupStack::PopAndDestroy( jtt ); - LOGGER_WRITE_1( "ExpectedDataSizeL returned for Java(EJavaMIDletData) DO %d", err ); - if( err != KErrNone && err != KErrNotFound ) - { - LOGGER_WRITE_1( "ExpectedDataSizeL LEAVE %d", err ); - User::Leave( err ); - } - } - } - - return dataSize; - } -// End of file diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/services/pcd/src/sconvideoparser.cpp --- a/connectivitymodules/SeCon/services/pcd/src/sconvideoparser.cpp Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,534 +0,0 @@ -/* -* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: CSConVideoParser implementation -* -*/ - - -#include -#include -#include -#include "sconvideoparser.h" -#include "debug.h" - -_LIT( KMimeType, "MimeType" ); -_LIT8( KImageEncoderMimeType, "image/jpeg" ); -_LIT( KMimeTypeAudio, "audio/*" ); -_LIT( KMimeTypeVideo, "video/*" ); - -const TInt KVideoClipTimeout( 10000000 ); // 10 sec. - -// ----------------------------------------------------------------------------- -// CSConVideoParser::CSConVideoParser() -// ----------------------------------------------------------------------------- -// -CSConVideoParser::CSConVideoParser() - { - } - -// ----------------------------------------------------------------------------- -// CSConVideoParser::~CSConVideoParser() -// Destructor -// ----------------------------------------------------------------------------- -// -CSConVideoParser::~CSConVideoParser() - { - TRACE_FUNC_ENTRY; - delete iTimeOut; - if ( iVideoClip ) - { - iVideoClip->CancelThumb(); - } - delete iVideoClip; - - if ( iVideoUtil ) - { - iVideoUtil->Close(); - } - delete iVideoUtil; - delete iScreen; - iWsSession.Close(); - - delete iThumbnail; - delete iVideoMimeType; - delete iAudioMimeType; - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConVideoParser::NewLC() -// ----------------------------------------------------------------------------- -// -CSConVideoParser* CSConVideoParser::NewLC() - { - CSConVideoParser* self = new (ELeave)CSConVideoParser(); - CleanupStack::PushL( self ); - self->ConstructL(); - return self; - } - -// ----------------------------------------------------------------------------- -// CSConVideoParser::ConstructL() -// Constructor -// ----------------------------------------------------------------------------- -// -void CSConVideoParser::ConstructL() - { - TRACE_FUNC_ENTRY; - - User::LeaveIfError( iWsSession.Connect() ); - - iScreen = new(ELeave) CWsScreenDevice( iWsSession ); - iScreen->Construct(); - - RWindowGroup wg( iWsSession ); - User::LeaveIfError( wg.Construct(reinterpret_cast(&wg), EFalse) ); - CleanupClosePushL( wg ); - - CWindowGc* gc; - User::LeaveIfError( iScreen->CreateContext(gc) ); - CleanupStack::PushL(gc); - - RWindow window( iWsSession ); - User::LeaveIfError( window.Construct(wg, reinterpret_cast(&wg) + 1) ); - CleanupClosePushL( window ); - - TRect temp(0,0,320,240); // dummy parameter - iVideoUtil = CVideoPlayerUtility::NewL(*this, EMdaPriorityNormal, EMdaPriorityPreferenceNone, iWsSession, *(iScreen), window, temp, temp); - - CleanupStack::PopAndDestroy( &window ); - CleanupStack::PopAndDestroy( gc ); - CleanupStack::PopAndDestroy( &wg ); - - iTimeOut = CSconTimeOut::NewL( *this ); - - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConVideoParser::OpenFileL( const RFs& aFs, const TDesC& aFileName ) -// Opens video file -// ----------------------------------------------------------------------------- -// -void CSConVideoParser::OpenFileL( const RFs& aFs, const TDesC& aFileName ) - { - TRACE_FUNC_ENTRY; - - iVideoUtilReady = EFalse; - iVideoClipReady = EFalse; - iVideoUtilErr = KErrNone; - iVideoClipErr = KErrNone; - - delete iThumbnail; - iThumbnail = NULL; - delete iVideoMimeType; - iVideoMimeType=NULL; - delete iAudioMimeType; - iAudioMimeType=NULL; - - if ( iVideoClip ) - { - iVideoClip->CancelThumb(); - delete iVideoClip; - iVideoClip = NULL; - } - if ( iVideoUtil ) - { - iVideoUtil->Close(); - } - - TBool fileExist = BaflUtils::FileExists( aFs, aFileName ); - if ( !fileExist ) - { - User::Leave( KErrNotFound ); - } - - iVideoClip = CTNEVideoClipInfo::NewL( aFileName, *this ); - - iVideoUtil->OpenFileL( aFileName ); - - - LOGGER_WRITE("iWait.Start()"); - iWait.Start(); - - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConVideoParser::Thumbnail() -// returns video thumbnail in jpg format -// ----------------------------------------------------------------------------- -// -const TDesC8& CSConVideoParser::Thumbnail() const - { - TRACE_FUNC; - if ( !iThumbnail ) - { - return KNullDesC8; - } - return *iThumbnail; - } - -// ----------------------------------------------------------------------------- -// CSConVideoParser::VideoFrameRateL() -// returns video frame rate -// ----------------------------------------------------------------------------- -// -TReal32 CSConVideoParser::VideoFrameRateL() const - { - TRACE_FUNC; - if ( !iVideoUtil ) - { - User::Leave( KErrNotReady ); - } - return iVideoUtil->VideoFrameRateL(); - } - -// ----------------------------------------------------------------------------- -// CSConVideoParser::VideoFrameSizeL() -// returns video frame size -// ----------------------------------------------------------------------------- -// -void CSConVideoParser::VideoFrameSizeL(TSize& aSize) const - { - TRACE_FUNC; - if ( !iVideoUtil ) - { - User::Leave( KErrNotReady ); - } - return iVideoUtil->VideoFrameSizeL( aSize ); - } - -// ----------------------------------------------------------------------------- -// CSConVideoParser::VideoFormatMimeTypeL() -// returns video format -// ----------------------------------------------------------------------------- -// -const TDesC8& CSConVideoParser::VideoFormatMimeTypeL() const - { - TRACE_FUNC; - if ( !iVideoUtil ) - { - User::Leave( KErrNotReady ); - } - return iVideoUtil->VideoFormatMimeType(); - } - -// ----------------------------------------------------------------------------- -// CSConVideoParser::VideoBitRateL() -// returns videostream bitrate -// ----------------------------------------------------------------------------- -// -TInt CSConVideoParser::VideoBitRateL() const - { - TRACE_FUNC; - if ( !iVideoUtil ) - { - User::Leave( KErrNotReady ); - } - return iVideoUtil->VideoBitRateL(); - } - -// ----------------------------------------------------------------------------- -// CSConVideoParser::AudioBitRateL() -// returns audiostream bitrate -// ----------------------------------------------------------------------------- -// -TInt CSConVideoParser::AudioBitRateL() const - { - TRACE_FUNC; - if ( !iVideoUtil ) - { - User::Leave( KErrNotReady ); - } - return iVideoUtil->AudioBitRateL(); - } - -// ----------------------------------------------------------------------------- -// CSConVideoParser::DurationL() -// returns video duration in milliseconds -// ----------------------------------------------------------------------------- -// -TInt CSConVideoParser::DurationL() const - { - TRACE_FUNC; - if ( !iVideoUtil ) - { - User::Leave( KErrNotReady ); - } - return iVideoUtil->DurationL().Int64()/1000; - } - -// ----------------------------------------------------------------------------- -// CSConVideoParser::VideoMimeTypeL() -// returns video mime type -// ----------------------------------------------------------------------------- -// -const TDesC& CSConVideoParser::VideoMimeTypeL() - { - TRACE_FUNC; - if ( !iVideoUtil ) - { - User::Leave( KErrNotReady ); - } - delete iVideoMimeType; - iVideoMimeType = NULL; - - TInt metadataEntries = iVideoUtil->NumberOfMetaDataEntriesL(); - LOGGER_WRITE_1( "metadataEntries: %d", metadataEntries); - - for (TInt i=0; i < metadataEntries ; i++) - { - CMMFMetaDataEntry* entry = iVideoUtil->MetaDataEntryL(i); - CleanupStack::PushL( entry ); - if ( entry->Name().Compare( KMimeType ) == 0 ) - { - if ( entry->Value().MatchF( KMimeTypeVideo ) == 0 ) - { - LOGGER_WRITE_1( "video mimetype found: %S", &entry->Value()); - iVideoMimeType = HBufC::NewL(entry->Value().Length()); - TPtr videoMimeTypePtr = iVideoMimeType->Des(); - videoMimeTypePtr.Copy( entry->Value() ); - CleanupStack::PopAndDestroy( entry ); - return *iVideoMimeType; - } - } - CleanupStack::PopAndDestroy( entry ); - } - return KNullDesC; - } - -// ----------------------------------------------------------------------------- -// CSConVideoParser::AudioMimeTypeL() -// returns audio mime type -// ----------------------------------------------------------------------------- -// -const TDesC& CSConVideoParser::AudioMimeTypeL() - { - TRACE_FUNC; - if ( !iVideoUtil ) - { - User::Leave( KErrNotReady ); - } - delete iAudioMimeType; - iAudioMimeType = NULL; - TInt metadataEntries = iVideoUtil->NumberOfMetaDataEntriesL(); - LOGGER_WRITE_1( "metadataEntries: %d", metadataEntries); - - for (TInt i=0; i < metadataEntries ; i++) - { - CMMFMetaDataEntry* entry = iVideoUtil->MetaDataEntryL(i); - CleanupStack::PushL( entry ); - - if ( entry->Name().Compare( KMimeType ) == 0 ) - { - if ( entry->Value().MatchF( KMimeTypeAudio ) == 0 ) - { - LOGGER_WRITE_1( "video mimetype found: %S", &entry->Value()); - iAudioMimeType = HBufC::NewL(entry->Value().Length()); - TPtr audioMimeTypePtr = iAudioMimeType->Des(); - audioMimeTypePtr.Copy( entry->Value() ); - CleanupStack::PopAndDestroy( entry ); - return *iAudioMimeType; - } - } - CleanupStack::PopAndDestroy( entry ); - } - return KNullDesC; - } - -// ----------------------------------------------------------------------------- -// CSConVideoParser::MvpuoOpenComplete( TInt aError ) -// MVideoPlayerUtilityObserver implementation -// ----------------------------------------------------------------------------- -// -void CSConVideoParser::MvpuoOpenComplete( TInt aError ) - { - TRACE_FUNC_ENTRY; - LOGGER_WRITE_1( "aError: %d", aError ); - if ( aError == KErrNone ) - { - iVideoUtil->Prepare(); - } - else - { - iVideoUtilReady = ETrue; - iVideoUtilErr = aError; - } - - if ( iVideoUtilReady && iVideoClipReady ) - { - LOGGER_WRITE("AsyncStop"); - iWait.AsyncStop(); - } - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConVideoParser::MvpuoPrepareComplete( TInt aError ) -// MVideoPlayerUtilityObserver implementation -// ----------------------------------------------------------------------------- -// -void CSConVideoParser::MvpuoPrepareComplete( TInt aError ) - { - TRACE_FUNC_ENTRY; - LOGGER_WRITE_1( "aError: %d", aError ); - - iVideoUtilReady = ETrue; - iVideoUtilErr = aError; - - if ( iVideoUtilReady && iVideoClipReady ) - { - LOGGER_WRITE("AsyncStop"); - iWait.AsyncStop(); - } - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConVideoParser::MvpuoFrameReady() -// MVideoPlayerUtilityObserver implementation -// ----------------------------------------------------------------------------- -// -void CSConVideoParser::MvpuoFrameReady( CFbsBitmap& /*aFrame*/,TInt /*aError*/ ) - { - } - -// ----------------------------------------------------------------------------- -// CSConVideoParser::MvpuoPlayComplete() -// MVideoPlayerUtilityObserver implementation -// ----------------------------------------------------------------------------- -// -void CSConVideoParser::MvpuoPlayComplete( TInt /*aError*/ ) - { - } - -// ----------------------------------------------------------------------------- -// CSConVideoParser::MvpuoEvent() -// MVideoPlayerUtilityObserver implementation -// ----------------------------------------------------------------------------- -// -void CSConVideoParser::MvpuoEvent( const TMMFEvent& /*aEvent*/ ) - { - } - -// ----------------------------------------------------------------------------- -// CSConVideoParser::NotifyVideoClipInfoReady(CTNEVideoClipInfo& aInfo, TInt aError) -// MTNEVideoClipInfoObserver implementation -// ----------------------------------------------------------------------------- -// -void CSConVideoParser::NotifyVideoClipInfoReady(CTNEVideoClipInfo& aInfo, TInt aError) - { - TRACE_FUNC_ENTRY; - LOGGER_WRITE_1("aError: %d", aError); - if ( aError == KErrNone ) - { - TSize resolution(320,240); - TRAPD( err, aInfo.GetThumbL(*this,KBestThumbIndex, &resolution ) ); - - if ( err ) - { - LOGGER_WRITE_1("aInfo.GetThumbL err: %d", err); - iVideoClipReady = ETrue; - iVideoClipErr = err; - } - else - { - LOGGER_WRITE("Start timeout"); - iTimeOut->Start( KVideoClipTimeout ); - } - } - else - { - iVideoClipReady = ETrue; - iVideoClipErr = aError; - } - - if ( iVideoUtilReady && iVideoClipReady ) - { - LOGGER_WRITE("AsyncStop"); - iWait.AsyncStop(); - } - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConVideoParser::NotifyVideoClipThumbCompleted() -// MTNEVideoClipInfoObserver implementation -// ----------------------------------------------------------------------------- -// -void CSConVideoParser::NotifyVideoClipThumbCompleted(CTNEVideoClipInfo& /*aInfo*/, - TInt aError, - CFbsBitmap* aThumb) - { - TRACE_FUNC_ENTRY; - LOGGER_WRITE_1("aError: %d", aError); - iTimeOut->Cancel(); - if ( aError == KErrNone) - { - delete iThumbnail; - iThumbnail = NULL; - LOGGER_WRITE("create CImageEncoder"); - CImageEncoder* encoder = NULL; - TRAPD( err, encoder = CImageEncoder::DataNewL( iThumbnail, KImageEncoderMimeType, CImageEncoder::EOptionAlwaysThread ) ); - LOGGER_WRITE_1("err: %d", err ); - if ( err == KErrNone ) - { - LOGGER_WRITE("Start Convert"); - TRequestStatus status; - encoder->Convert( &status, *aThumb, NULL ); - - User::WaitForRequest( status ); - LOGGER_WRITE_1("Convert status: %d", status.Int()); - LOGGER_WRITE_1("buf Length: %d", iThumbnail->Length()); - err = status.Int(); - } - delete encoder; - } - delete aThumb; - iVideoClipReady = ETrue; - iVideoClipErr = aError; - - if ( iVideoUtilReady && iVideoClipReady ) - { - LOGGER_WRITE("AsyncStop"); - iWait.AsyncStop(); - } - - TRACE_FUNC_EXIT; - } - -// ----------------------------------------------------------------------------- -// CSConVideoParser::TimeOut() -// Called when timeout has occured, cancels videoclip generation -// ----------------------------------------------------------------------------- -// -void CSConVideoParser::TimeOut() - { - TRACE_FUNC_ENTRY; - if ( !iVideoClipReady ) - { - iVideoClip->CancelThumb(); - LOGGER_WRITE("videoclip cancelled"); - iVideoClipReady = ETrue; - iVideoClipErr = KErrCancel; - } - - if ( iVideoUtilReady && iVideoClipReady ) - { - LOGGER_WRITE("AsyncStop"); - iWait.AsyncStop(); - } - TRACE_FUNC_EXIT; - } diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/wbxml/conmlhandler/bld/bld.inf --- a/connectivitymodules/SeCon/wbxml/conmlhandler/bld/bld.inf Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -/* -* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: ConML parser and generator -* This file provides the information required for building the -* whole of a SConConMLHandler -* -*/ - - - -PRJ_PLATFORMS -DEFAULT - -PRJ_MMPFILES -sconconmlhandler.mmp - diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/wbxml/conmlhandler/bld/def/bwinscwu.def --- a/connectivitymodules/SeCon/wbxml/conmlhandler/bld/def/bwinscwu.def Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -EXPORTS - ?CreateCSConConMLHandlerL@@YAPAVCSConConMLHandler@@XZ @ 1 NONAME ; class CSConConMLHandler * CreateCSConConMLHandlerL(void) - diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/wbxml/conmlhandler/bld/def/eabiu.def --- a/connectivitymodules/SeCon/wbxml/conmlhandler/bld/def/eabiu.def Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,7 +0,0 @@ -EXPORTS - _Z24CreateCSConConMLHandlerLv @ 1 NONAME - _ZTI13CXMLWorkspace @ 2 NONAME ; ## - _ZTI17CSConConMLHandler @ 3 NONAME ; ## - _ZTV13CXMLWorkspace @ 4 NONAME ; ## - _ZTV17CSConConMLHandler @ 5 NONAME ; ## - diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/wbxml/conmlhandler/bld/sconconmlhandler.mmp --- a/connectivitymodules/SeCon/wbxml/conmlhandler/bld/sconconmlhandler.mmp Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,59 +0,0 @@ -/* -* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: ConML Parser and generator -* -*/ - - -// To get the MW_LAYER_SYSTEMINCLUDE-definition -#include - -VENDORID VID_DEFAULT -CAPABILITY CAP_GENERAL_DLL - -TARGETPATH sys/bin - -TARGET sconconmlhandler.dll -TARGETTYPE DLL -UID 0x10009D8D 0x101F99FA - -#if defined(ARMCC) -DEFFILE ./def/eabi -#elif defined(WINSCW) -DEFFILE ./def/bwinscw -#elif defined(WINS) -DEFFILE ./def/bwins -#elif defined(ARM) -DEFFILE ./def/bmarm -#endif - -SOURCEPATH ../src -SOURCE sconconmlhandler.cpp -SOURCE sconxmlelement.cpp -SOURCE sconconmlgenerator.cpp -SOURCE sconconmldtd.cpp -SOURCE sconxmlworkspace.cpp - -USERINCLUDE ../inc -USERINCLUDE ../../../inc - -// Default system include paths for middleware layer modules. -MW_LAYER_SYSTEMINCLUDE -SYSTEMINCLUDE /epoc32/include/libc - -LANG SC - -LIBRARY euser.lib -LIBRARY estor.lib -DEBUGLIBRARY flogger.lib diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/wbxml/conmlhandler/inc/sconconmldtd.h --- a/connectivitymodules/SeCon/wbxml/conmlhandler/inc/sconconmldtd.h Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,750 +0,0 @@ -/* -* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: ConML parser/generator -* -*/ - - -#ifndef __SCONCONMLDTD_H__ -#define __SCONCONMLDTD_H__ - -#include "sconxmlelement.h" - -typedef void *voidPtr_t; -typedef long memSize_t; - -typedef enum - { - SML_PCDATA_UNDEFINED = 0, - SML_PCDATA_STRING, // String type - SML_PCDATA_OPAQUE, // Opaque type - SML_PCDATA_EXTENSION, // Extention type - SML_PCDATA_CDATA // XML CDATA type - } pcdataType_t; - -typedef enum - { - SML_EXT_UNDEFINED = 0, - } pcdataExtension_t; - -// ----------------------------------------------------------------------------- -// GenericListAddL -// ----------------------------------------------------------------------------- -template -void GenericListAddL( T* aList, T aNewItem ) - { - if( *aList == 0 ) - { - *aList = aNewItem; - } - else - { - T c; - for( c = *aList; c->next; c = c->next ) - {}; - c->next = aNewItem; - } - } - -// ----------------------------------------------------------------------------- -// pcdata_s -// ----------------------------------------------------------------------------- -typedef NONSHARABLE_STRUCT( pcdata_s ) : public CXMLElement - { -public: - pcdataType_t contentType; // The type of data - pcdataExtension_t extension; // PCData Extension type - memSize_t length; // length of the data - voidPtr_t content; // Pointer to the data itself -public: - pcdata_s(); - ~pcdata_s(); - pcdata_s( const pcdataType_t aType, - const pcdataExtension_t aExt = SML_EXT_UNDEFINED ); - void FreeContent(); - void SetDataL( const TDesC8& aData ); - TPtrC8 Data() const; - void TruncateL( TInt aConsumed ); - } *pcdataPtr_t, pcdata_t; - -// ----------------------------------------------------------------------------- -// pcdata_list_s -// ----------------------------------------------------------------------------- -typedef NONSHARABLE_STRUCT( pcdata_list_s ) : public CBase - { - pcdataPtr_t data; - struct pcdata_list_s *next; - - pcdata_list_s(); - ~pcdata_list_s(); - } *pcdataListPtr_t, pcdataList_t; - -// ----------------------------------------------------------------------------- -// ConML_Param_s -// ----------------------------------------------------------------------------- -typedef NONSHARABLE_STRUCT( ConML_Param_s ) : public CXMLElement - { -public: - pcdataPtr_t name; - pcdataPtr_t value; -public: - ConML_Param_s(); - ~ConML_Param_s(); - CXMLElement* BeginElementL - ( TUint8 aTag, const TXMLElementParams& aParams = TXMLElementParams() ); - }*ConML_ParamPtr_t, ConML_Param_t; - -// ----------------------------------------------------------------------------- -// ConML_ParamList_s -// ----------------------------------------------------------------------------- -typedef NONSHARABLE_STRUCT( ConML_ParamList_s ) : public CBase - { -public: - ConML_ParamPtr_t data; - struct ConML_ParamList_s *next; -public: - ConML_ParamList_s(); - ~ConML_ParamList_s(); - }*ConML_ParamListPtr_t, ConML_ParamList_t; - -// ----------------------------------------------------------------------------- -// ConML_InstParams_s -// ----------------------------------------------------------------------------- -typedef NONSHARABLE_STRUCT( ConML_InstParams_s ) : public CXMLElement - { -public: - ConML_ParamListPtr_t param; -public: - ConML_InstParams_s(); - ~ConML_InstParams_s(); - CXMLElement* BeginElementL - ( TUint8 aTag, const TXMLElementParams& aParams = TXMLElementParams() ); - }*ConML_InstParamsPtr_t, ConML_InstParams_t; - -// ----------------------------------------------------------------------------- -// ConML_Progress_s -// ----------------------------------------------------------------------------- -typedef NONSHARABLE_STRUCT( ConML_Progress_s ) : public CXMLElement - { -public: - pcdataPtr_t value; -public: - ConML_Progress_s(); - ~ConML_Progress_s(); - CXMLElement* BeginElementL - ( TUint8 aTag, const TXMLElementParams& aParams = TXMLElementParams() ); - }*ConML_ProgressPtr_t, ConML_Progress_t; - -// ----------------------------------------------------------------------------- -// ConML_Application_s -// ----------------------------------------------------------------------------- -typedef NONSHARABLE_STRUCT( ConML_Application_s ) : public CXMLElement - { -public: - pcdataPtr_t name; - pcdataPtr_t uid; -public: - ConML_Application_s(); - ~ConML_Application_s(); - CXMLElement* BeginElementL - ( TUint8 aTag, const TXMLElementParams& aParams = TXMLElementParams() ); - }*ConML_ApplicationPtr_t, ConML_Application_t; - -// ----------------------------------------------------------------------------- -// ConML_ApplicationList_s -// ----------------------------------------------------------------------------- - -typedef NONSHARABLE_STRUCT( ConML_ApplicationList_s ) : public CBase - { -public: - ConML_ApplicationPtr_t data; - struct ConML_ApplicationList_s *next; -public: - ConML_ApplicationList_s(); - ~ConML_ApplicationList_s(); - }*ConML_ApplicationListPtr_t, ConML_ApplicationList_t; - -// ----------------------------------------------------------------------------- -// ConML_Applications_s -// ----------------------------------------------------------------------------- -typedef NONSHARABLE_STRUCT( ConML_Applications_s ) : public CXMLElement - { -public: - ConML_ApplicationListPtr_t application; - -public: - ConML_Applications_s(); - ~ConML_Applications_s(); - CXMLElement* BeginElementL - ( TUint8 aTag, const TXMLElementParams& aParams = TXMLElementParams() ); - }*ConML_ApplicationsPtr_t, ConML_Applications_t; - -// ----------------------------------------------------------------------------- -// ConML_Drive_s -// ----------------------------------------------------------------------------- -typedef NONSHARABLE_STRUCT( ConML_Drive_s ) : public CXMLElement - { -public: - pcdataPtr_t name; -public: - ConML_Drive_s(); - ~ConML_Drive_s(); - CXMLElement* BeginElementL - ( TUint8 aTag, const TXMLElementParams& aParams = TXMLElementParams() ); - }*ConML_DrivePtr_t, ConML_Drive_t; - -// ----------------------------------------------------------------------------- -// ConML_DriveList_s -// ----------------------------------------------------------------------------- -typedef NONSHARABLE_STRUCT( ConML_DriveList_s ) : public CBase - { -public: - ConML_DrivePtr_t data; - struct ConML_DriveList_s *next; -public: - ConML_DriveList_s(); - ~ConML_DriveList_s(); - }*ConML_DriveListPtr_t, ConML_DriveList_t; - -// ----------------------------------------------------------------------------- -// ConML_Drives_s -// ----------------------------------------------------------------------------- -typedef NONSHARABLE_STRUCT( ConML_Drives_s ) : public CXMLElement - { -public: - ConML_DriveListPtr_t drive; -public: - ConML_Drives_s(); - ~ConML_Drives_s(); - CXMLElement* BeginElementL - ( TUint8 aTag, const TXMLElementParams& aParams = TXMLElementParams() ); - }*ConML_DrivesPtr_t, ConML_Drives_t; - -// ----------------------------------------------------------------------------- -// ConML_BUROptions_s -// ----------------------------------------------------------------------------- -typedef NONSHARABLE_STRUCT( ConML_BUROptions_s ) : public CXMLElement - { -public: - pcdataPtr_t requiresReboot; - pcdataPtr_t hasFiles; - pcdataPtr_t supportsInc; - pcdataPtr_t delayToPrepareData; -public: - ConML_BUROptions_s(); - ~ConML_BUROptions_s(); - CXMLElement* BeginElementL - ( TUint8 aTag, const TXMLElementParams& aParams = TXMLElementParams() ); - }*ConML_BUROptionsPtr_t, ConML_BUROptions_t; - -// ----------------------------------------------------------------------------- -// ConML_PackageInfo_s -// ----------------------------------------------------------------------------- -typedef NONSHARABLE_STRUCT( ConML_PackageInfo_s ) : public CXMLElement - { -public: - pcdataPtr_t name; -public: - ConML_PackageInfo_s(); - ~ConML_PackageInfo_s(); - CXMLElement* BeginElementL - ( TUint8 aTag, const TXMLElementParams& aParams = TXMLElementParams() ); - }*ConML_PackageInfoPtr_t, ConML_PackageInfo_t; - -// ----------------------------------------------------------------------------- -// ConML_SID_s -// ----------------------------------------------------------------------------- -typedef NONSHARABLE_STRUCT( ConML_SID_s ) : public CXMLElement - { -public: - pcdataPtr_t type; - pcdataPtr_t uid; - ConML_DrivesPtr_t drives; - ConML_PackageInfoPtr_t packageInfo; - ConML_BUROptionsPtr_t burOptions; - pcdataPtr_t size; - pcdataPtr_t transferDataType; - pcdataPtr_t data; - pcdataPtr_t moreData; - pcdataPtr_t dataOwnerStatus; - -public: - ConML_SID_s(); - ~ConML_SID_s(); - CXMLElement* BeginElementL - ( TUint8 aTag, const TXMLElementParams& aParams = TXMLElementParams() ); - }*ConML_SIDPtr_t, ConML_SID_t; - -// ----------------------------------------------------------------------------- -// ConML_SIDList_s -// ----------------------------------------------------------------------------- -typedef NONSHARABLE_STRUCT( ConML_SIDList_s ) : public CBase - { -public: - ConML_SIDPtr_t data; - struct ConML_SIDList_s *next; -public: - ConML_SIDList_s(); - ~ConML_SIDList_s(); - }*ConML_SIDListPtr_t, ConML_SIDList_t; - -// ----------------------------------------------------------------------------- -// ConML_SupportedMethods_s -// ----------------------------------------------------------------------------- -typedef NONSHARABLE_STRUCT( ConML_SupportedMethods_s ) : public CXMLElement - { -public: - pcdataPtr_t install; - pcdataPtr_t unInstall; - pcdataPtr_t setInstParams; - pcdataPtr_t listInstalledApps; - pcdataPtr_t listDataOwners; - pcdataPtr_t setBurMode; - pcdataPtr_t getDataSize; - pcdataPtr_t requestData; - pcdataPtr_t supplyData; - pcdataPtr_t reboot; -public: - ConML_SupportedMethods_s(); - ~ConML_SupportedMethods_s(); - CXMLElement* BeginElementL - ( TUint8 aTag, const TXMLElementParams& aParams = TXMLElementParams() ); - }*ConML_SupportedMethodsPtr_t, ConML_SupportedMethods_t; - -// ----------------------------------------------------------------------------- -// ConML_DeviceInfo_s -// ----------------------------------------------------------------------------- -typedef NONSHARABLE_STRUCT( ConML_DeviceInfo_s ) : public CXMLElement - { -public: - pcdataPtr_t version; - ConML_SupportedMethodsPtr_t supportedMethods; - pcdataPtr_t maxObjectSize; -public: - ConML_DeviceInfo_s(); - ~ConML_DeviceInfo_s(); - CXMLElement* BeginElementL - ( TUint8 aTag, const TXMLElementParams& aParams = TXMLElementParams() ); - }*ConML_DeviceInfoPtr_t, ConML_DeviceInfo_t; - -// ----------------------------------------------------------------------------- -// ConML_File_s -// ----------------------------------------------------------------------------- -typedef NONSHARABLE_STRUCT( ConML_File_s ) : public CXMLElement - { -public: - pcdataPtr_t name; - pcdataPtr_t modified; - pcdataPtr_t size; - pcdataPtr_t userPerm; -public: - ConML_File_s(); - ~ConML_File_s(); - CXMLElement* BeginElementL - ( TUint8 aTag, const TXMLElementParams& aParams = TXMLElementParams() ); - }*ConML_FilePtr_t, ConML_File_t; - -// ----------------------------------------------------------------------------- -// ConML_FileList_s -// ----------------------------------------------------------------------------- -typedef NONSHARABLE_STRUCT( ConML_FileList_s ) : public CBase - { -public: - ConML_FilePtr_t data; - struct ConML_FileList_s *next; -public: - ConML_FileList_s(); - ~ConML_FileList_s(); - }*ConML_FileListPtr_t, ConML_FileList_t; - -// ----------------------------------------------------------------------------- -// ConML_Files_s -// ----------------------------------------------------------------------------- -typedef NONSHARABLE_STRUCT( ConML_Files_s ) : public CXMLElement - { -public: - ConML_FileListPtr_t file; -public: - ConML_Files_s(); - ~ConML_Files_s(); - CXMLElement* BeginElementL - ( TUint8 aTag, const TXMLElementParams& aParams = TXMLElementParams() ); - }*ConML_FilesPtr_t, ConML_Files_t; - -// ----------------------------------------------------------------------------- -// ConML_DataOwners_s -// ----------------------------------------------------------------------------- -typedef NONSHARABLE_STRUCT( ConML_DataOwners_s ) : public CXMLElement - { -public: - ConML_SIDListPtr_t sid; -public: - ConML_DataOwners_s(); - ~ConML_DataOwners_s(); - CXMLElement* BeginElementL - ( TUint8 aTag, const TXMLElementParams& aParams = TXMLElementParams() ); - }*ConML_DataOwnersPtr_t, ConML_DataOwners_t; - -// ----------------------------------------------------------------------------- -// ConML_Results_s -// ----------------------------------------------------------------------------- -typedef NONSHARABLE_STRUCT( ConML_Results_s ) : public CXMLElement - { -public: - pcdataPtr_t complete; - ConML_ProgressPtr_t progress; - ConML_ApplicationsPtr_t applications; - ConML_DataOwnersPtr_t dataOwners; - pcdataPtr_t filename; - pcdataPtr_t moreData; - pcdataPtr_t data; - ConML_DeviceInfoPtr_t deviceInfo; - ConML_FilesPtr_t files; -public: - ConML_Results_s(); - ~ConML_Results_s(); - CXMLElement* BeginElementL - ( TUint8 aTag, const TXMLElementParams& aParams = TXMLElementParams() ); - }*ConML_ResultsPtr_t, ConML_Results_t; - -// ----------------------------------------------------------------------------- -// ConML_Install_s -// ----------------------------------------------------------------------------- -typedef NONSHARABLE_STRUCT( ConML_Install_s ) : public CXMLElement - { -public: - pcdataPtr_t name; - ConML_InstParamsPtr_t instParams; - ConML_ResultsPtr_t results; -public: - ConML_Install_s(); - ~ConML_Install_s(); - CXMLElement* BeginElementL - ( TUint8 aTag, const TXMLElementParams& aParams = TXMLElementParams() ); - }*ConML_InstallPtr_t, ConML_Install_t; - -// ----------------------------------------------------------------------------- -// ConML_UnInstall_s -// ----------------------------------------------------------------------------- -typedef NONSHARABLE_STRUCT( ConML_UnInstall_s ) : public CXMLElement - { -public: - ConML_ApplicationsPtr_t applications; - ConML_InstParamsPtr_t instParams; - ConML_ResultsPtr_t results; -public: - ConML_UnInstall_s(); - ~ConML_UnInstall_s(); - CXMLElement* BeginElementL - ( TUint8 aTag, const TXMLElementParams& aParams = TXMLElementParams() ); - }*ConML_UnInstallPtr_t, ConML_UnInstall_t; - -// ----------------------------------------------------------------------------- -// ConML_ListInstalledApps_s -// ----------------------------------------------------------------------------- -typedef NONSHARABLE_STRUCT( ConML_ListInstalledApps_s ) : public CXMLElement - { -public: - ConML_DrivesPtr_t drives; - pcdataPtr_t all; - ConML_ResultsPtr_t results; -public: - ConML_ListInstalledApps_s(); - ~ConML_ListInstalledApps_s(); - CXMLElement* BeginElementL - ( TUint8 aTag, const TXMLElementParams& aParams = TXMLElementParams() ); - }*ConML_ListInstalledAppsPtr_t, ConML_ListInstalledApps_t; - -// ----------------------------------------------------------------------------- -// ConML_ListDataOwners_s -// ----------------------------------------------------------------------------- -typedef NONSHARABLE_STRUCT( ConML_ListDataOwners_s ) : public CXMLElement - { -public: - ConML_ResultsPtr_t results; -public: - ConML_ListDataOwners_s(); - ~ConML_ListDataOwners_s(); - CXMLElement* BeginElementL - ( TUint8 aTag, const TXMLElementParams& aParams = TXMLElementParams() ); - }*ConML_ListDataOwnersPtr_t, ConML_ListDataOwners_t; - -// ----------------------------------------------------------------------------- -// ConML_SetBURMode_s -// ----------------------------------------------------------------------------- -typedef NONSHARABLE_STRUCT( ConML_SetBURMode_s ) : public CXMLElement - { -public: - ConML_DrivesPtr_t drives; - pcdataPtr_t partialType; - pcdataPtr_t incType; - ConML_ResultsPtr_t results; -public: - ConML_SetBURMode_s(); - ~ConML_SetBURMode_s(); - CXMLElement* BeginElementL - ( TUint8 aTag, const TXMLElementParams& aParams = TXMLElementParams() ); - }*ConML_SetBURModePtr_t, ConML_SetBURMode_t; - -// ----------------------------------------------------------------------------- -// ConML_GetDataSize_s -// ----------------------------------------------------------------------------- -typedef NONSHARABLE_STRUCT( ConML_GetDataSize_s ) : public CXMLElement - { -public: - ConML_DataOwnersPtr_t dataOwners; - ConML_ResultsPtr_t results; -public: - ConML_GetDataSize_s(); - ~ConML_GetDataSize_s(); - CXMLElement* BeginElementL - ( TUint8 aTag, const TXMLElementParams& aParams = TXMLElementParams() ); - }*ConML_GetDataSizePtr_t, ConML_GetDataSize_t; - -// ----------------------------------------------------------------------------- -// ConML_RequestData_s -// ----------------------------------------------------------------------------- -typedef NONSHARABLE_STRUCT( ConML_RequestData_s ) : public CXMLElement - { -public: - ConML_SIDListPtr_t sid; - ConML_ResultsPtr_t results; -public: - ConML_RequestData_s(); - ~ConML_RequestData_s(); - CXMLElement* BeginElementL - ( TUint8 aTag, const TXMLElementParams& aParams = TXMLElementParams() ); - }*ConML_RequestDataPtr_t, ConML_RequestData_t; - -// ----------------------------------------------------------------------------- -// ConML_UpdateDeviceInfo_s -// ----------------------------------------------------------------------------- -typedef NONSHARABLE_STRUCT( ConML_UpdateDeviceInfo_s ) : public CXMLElement - { -public: - ConML_DeviceInfoPtr_t deviceInfo; - ConML_ResultsPtr_t results; -public: - ConML_UpdateDeviceInfo_s(); - ~ConML_UpdateDeviceInfo_s(); - CXMLElement* BeginElementL - ( TUint8 aTag, const TXMLElementParams& aParams = TXMLElementParams() ); - }*ConML_UpdateDeviceInfoPtr_t, ConML_UpdateDeviceInfo_t; - -// ----------------------------------------------------------------------------- -// ConML_ListPublicFiles_s -// ----------------------------------------------------------------------------- -typedef NONSHARABLE_STRUCT( ConML_ListPublicFiles_s ) : public CXMLElement - { -public: - ConML_ResultsPtr_t results; - ConML_SIDListPtr_t sid; -public: - ConML_ListPublicFiles_s(); - ~ConML_ListPublicFiles_s(); - CXMLElement* BeginElementL - ( TUint8 aTag, const TXMLElementParams& aParams = TXMLElementParams() ); - }*ConML_ListPublicFilesPtr_t, ConML_ListPublicFiles_t; - -// ----------------------------------------------------------------------------- -// ConML_SupplyData_s -// ----------------------------------------------------------------------------- -typedef NONSHARABLE_STRUCT( ConML_SupplyData_s ) : public CXMLElement - { -public: - ConML_SIDListPtr_t sid; - ConML_ResultsPtr_t results; -public: - ConML_SupplyData_s(); - ~ConML_SupplyData_s(); - CXMLElement* BeginElementL - ( TUint8 aTag, const TXMLElementParams& aParams = TXMLElementParams() ); - }*ConML_SupplyDataPtr_t, ConML_SupplyData_t; - -// ----------------------------------------------------------------------------- -// ConML_GetDataOwnerStatus_s -// ----------------------------------------------------------------------------- -typedef NONSHARABLE_STRUCT( ConML_GetDataOwnerStatus_s ) : public CXMLElement - { -public: - ConML_DataOwnersPtr_t dataOwners; - ConML_ResultsPtr_t results; -public: - ConML_GetDataOwnerStatus_s(); - ~ConML_GetDataOwnerStatus_s(); - CXMLElement* BeginElementL - ( TUint8 aTag, const TXMLElementParams& aParams = TXMLElementParams() ); - }*ConML_GetDataOwnerStatusPtr_t, ConML_GetDataOwnerStatus_t; - -// ----------------------------------------------------------------------------- -// ConML_GetMetadata_s -// ----------------------------------------------------------------------------- -typedef NONSHARABLE_STRUCT( ConML_GetMetadata_s ) : public CXMLElement - { -public: - pcdataPtr_t filename; - ConML_ResultsPtr_t results; -public: - ConML_GetMetadata_s(); - ~ConML_GetMetadata_s(); - CXMLElement* BeginElementL - ( TUint8 aTag, const TXMLElementParams& aParams = TXMLElementParams() ); - }*ConML_GetMetadataPtr_t, ConML_GetMetadata_t; - -// ----------------------------------------------------------------------------- -// ConML_Execute_s -// ----------------------------------------------------------------------------- -typedef NONSHARABLE_STRUCT( ConML_Execute_s ) : public CXMLElement - { -public: - pcdataPtr_t id; - ConML_InstallPtr_t install; - ConML_UnInstallPtr_t unInstall; - ConML_ListInstalledAppsPtr_t listInstalledApps; - ConML_ListDataOwnersPtr_t listDataOwners; - ConML_SetBURModePtr_t setBurMode; - ConML_GetDataSizePtr_t getDataSize; - ConML_RequestDataPtr_t requestData; - ConML_UpdateDeviceInfoPtr_t updateDeviceInfo; - ConML_ListPublicFilesPtr_t listPublicFiles; - ConML_SupplyDataPtr_t supplyData; - pcdataPtr_t reboot; - ConML_GetDataOwnerStatusPtr_t getDataOwnerStatus; - ConML_GetMetadataPtr_t getMetadata; -public: - ConML_Execute_s(); - ~ConML_Execute_s(); - CXMLElement* BeginElementL - ( TUint8 aTag, const TXMLElementParams& aParams = TXMLElementParams() ); - }*ConML_ExecutePtr_t, ConML_Execute_t; - -// ----------------------------------------------------------------------------- -// ConML_GetStatus_s -// ----------------------------------------------------------------------------- -typedef NONSHARABLE_STRUCT( ConML_GetStatus_s ) : public CXMLElement - { -public: - pcdataPtr_t id; - pcdataPtr_t all; -public: - ConML_GetStatus_s(); - ~ConML_GetStatus_s(); - CXMLElement* BeginElementL - ( TUint8 aTag, const TXMLElementParams& aParams = TXMLElementParams() ); - }*ConML_GetStatusPtr_t, ConML_GetStatus_t; - -// ----------------------------------------------------------------------------- -// ConML_Cancel_s -// ----------------------------------------------------------------------------- -typedef NONSHARABLE_STRUCT( ConML_Cancel_s ) : public CXMLElement - { -public: - pcdataPtr_t id; - pcdataPtr_t all; -public: - ConML_Cancel_s(); - ~ConML_Cancel_s(); - CXMLElement* BeginElementL - ( TUint8 aTag, const TXMLElementParams& aParams = TXMLElementParams() ); - }*ConML_CancelPtr_t, ConML_Cancel_t; - -// ----------------------------------------------------------------------------- -// ConML_Reboot_s -// ----------------------------------------------------------------------------- -typedef NONSHARABLE_STRUCT( ConML_Reboot_s ) : public CXMLElement - { -public: - ConML_ResultsPtr_t results; -public: - ConML_Reboot_s(); - ~ConML_Reboot_s(); - CXMLElement* BeginElementL - ( TUint8 aTag, const TXMLElementParams& aParams = TXMLElementParams() ); - }*ConML_RebootPtr_t, ConML_Reboot_t; - -// ----------------------------------------------------------------------------- -// ConML_Task_s -// ----------------------------------------------------------------------------- -typedef NONSHARABLE_STRUCT( ConML_Task_s ) : public CXMLElement - { -public: - pcdataPtr_t id; - ConML_InstallPtr_t install; - ConML_UnInstallPtr_t unInstall; - ConML_ListInstalledAppsPtr_t listInstalledApps; - ConML_ListDataOwnersPtr_t listDataOwners; - ConML_SetBURModePtr_t setBurMode; - ConML_GetDataSizePtr_t getDataSize; - ConML_RequestDataPtr_t requestData; - ConML_UpdateDeviceInfoPtr_t updateDeviceInfo; - ConML_ListPublicFilesPtr_t listPublicFiles; - ConML_GetDataOwnerStatusPtr_t getDataOwnerStatus; - ConML_SupplyDataPtr_t supplyData; - ConML_RebootPtr_t reboot; - ConML_GetMetadataPtr_t getMetadata; -public: - ConML_Task_s(); - ~ConML_Task_s(); - CXMLElement* BeginElementL - ( TUint8 aTag, const TXMLElementParams& aParams = TXMLElementParams() ); - }*ConML_TaskPtr_t, ConML_Task_t; - -// ----------------------------------------------------------------------------- -// ConML_TaskList_s -// ----------------------------------------------------------------------------- -typedef NONSHARABLE_STRUCT( ConML_TaskList_s ) : public CBase - { -public: - ConML_TaskPtr_t data; - struct ConML_TaskList_s *next; -public: - ConML_TaskList_s(); - ~ConML_TaskList_s(); - }*ConML_TaskListPtr_t, ConML_TaskList_t; - -// ----------------------------------------------------------------------------- -// ConML_Status_s -// ----------------------------------------------------------------------------- -typedef NONSHARABLE_STRUCT( ConML_Status_s ) : public CXMLElement - { -public: - ConML_TaskListPtr_t task; -public: - ConML_Status_s(); - ~ConML_Status_s(); - CXMLElement* BeginElementL - ( TUint8 aTag, const TXMLElementParams& aParams = TXMLElementParams() ); - }*ConML_StatusPtr_t, ConML_Status_t; - -// ----------------------------------------------------------------------------- -// ConML_ConML_s -// ----------------------------------------------------------------------------- -typedef NONSHARABLE_STRUCT( ConML_ConML_s ) : public CXMLElement - { -public: - ConML_ExecutePtr_t execute; - ConML_GetStatusPtr_t getStatus; - ConML_CancelPtr_t cancel; - ConML_StatusPtr_t status; - -public: - ConML_ConML_s(); - ~ConML_ConML_s(); - TBool NeedsCleanup() const; - CXMLElement* BeginElementL - ( TUint8 aTag, const TXMLElementParams& aParams = TXMLElementParams() ); - CXMLElement::TAction EndElementL( TAny* aCallbacks, TUint8 aTag ); - } *ConML_ConMLPtr_t, ConML_ConML_t; - -#endif // __SCONCONMLDTD_H__ diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/wbxml/conmlhandler/inc/sconconmlgenerator.h --- a/connectivitymodules/SeCon/wbxml/conmlhandler/inc/sconconmlgenerator.h Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,232 +0,0 @@ -/* -* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: ConML parser/generator -* -*/ - - -#ifndef __SCONCONMLGENERATOR_H__ -#define __SCONCONMLGENERATOR_H__ - -// ----------------------------------------------------------------------------- -// Includes -// ----------------------------------------------------------------------------- -#include "sconxmlelement.h" -#include "sconconmldtd.h" -#include "sconconmltags.h" -#include "sconwbxmldefs.h" -#include "sconxmlworkspace.h" - -// ----------------------------------------------------------------------------- -// MWBXMLConMLCallback - Call back for parsed data -// ----------------------------------------------------------------------------- -class MWBXMLConMLCallback - { -public: - /** - * Call back function for delivering the parsed data - * @param aContent contains the parsed data - * @return none - */ - - virtual void ConMLL( ConML_ConMLPtr_t aContent ) = 0; - }; - -// ----------------------------------------------------------------------------- -// TWBXMLContentFormat -// ----------------------------------------------------------------------------- -enum TWBXMLContentFormat - { - EWBXMLContentFormatOpaque, - EWBXMLContentFormatInlineString - }; - -// ----------------------------------------------------------------------------- -// CSConConMLGenerator - Generates XBXML and XML documents -// ----------------------------------------------------------------------------- -NONSHARABLE_CLASS( CSConConMLGenerator ) : public CBase - { -public: - - static CSConConMLGenerator* NewL(); - ~CSConConMLGenerator(); - - /** - * Returns the generated WBXML document - * @param none - * @return the document as TPtrC8 - */ - TPtrC8 WBXMLDocument(); - - /** - * Returns the generated XML document - * @param none - * @return the document as TPtrC8 - */ - TPtrC8 XMLDocument(); - - - // WBXML Parser - - /** - * Sets the callback function to call after parsing - * @param aCallback callback function to call when parsing finished - * @return none - */ - void SetCallback ( MWBXMLConMLCallback* aCallbakc ); - - /** - * Starts the document after header has been parsed - * @param aVersion - version of WBXML document - * @param aPublicId - public ID of WBXML document as known public ID - * @param aCharset - Character set of WBXML document - * @return none - */ - void StartDocument( TUint8 aVersion, TInt32 aPublicId, TUint32 aCharset ); - - /** - * Starts the document after header has been parsed - * @param aVersion - version of WBXML document - * @param aPublicIdStr - public ID of WBXML document as a inline string - * @param aCharset - Character set of WBXML document - * @return none - */ - void StartDocument( - TUint8 aVersion, const TDesC8& aPublicIdStr, TUint32 aCharset ); - - /** - * Starts a new element in the document - * @param aTag - Tag of the element - * @return none - */ - void StartElementL( TWBXMLTag aTag ); - - /** - * Starts a character data in the document - * @param aBuffer - Character data - * @return none - */ - void CharactersL( const TDesC8& aBuffer ); - - /** - * Document has been parsed - the end of document - * @param none - * @return none - */ - void EndDocument(); - - /** - * End tag of an element has been found - * @param aTag - tag of the element to be closed - * @return none - */ - void EndElementL( TWBXMLTag aTag ); - - // Generator - - /** - * Starts the generation of a document - * @param aContent - data for the document - * @return none - */ - TInt GenerateConMLDocument ( ConML_ConMLPtr_t aContent ); - -private: - - // WBXML Generator - void WriteMUint32L( TUint32 aValue ); - void WriteOpaqueDataL( const TDesC8& aData ); - void WriteInlineStringL( const TDesC8& aData ); - - // XML Generator - void IndentL(); - TPtrC8 TranslateElement( TUint8 aElement ); - - // WBXML / XML Generator - void BeginDocumentL( TUint8 aVersion, TInt32 aPublicId, TUint32 aCharset, - const TDesC8& aStringTbl = TPtrC8() ); - void BeginElementL( TUint8 aElement, TBool aHasContent = EFalse, - TBool aHasAttributes = EFalse ); - void EndElementL(); - void AddElementL( - TUint8 aElement, const TDesC8& aContent, - const TWBXMLContentFormat aFormat = EWBXMLContentFormatOpaque ); - void AppendPCDataL( TUint8 aElement, pcdataPtr_t aContent ); - void AppendConMLL( ConML_ConMLPtr_t aContent ); - void AppendExecuteL( ConML_ExecutePtr_t aContent ); - void AppendSupplyDataL( ConML_SupplyDataPtr_t aContent ); - void AppendInstallL( ConML_InstallPtr_t aContent ); - void AppendCancelL ( ConML_CancelPtr_t aContent ); - void AppendStatusL ( ConML_StatusPtr_t aContent ); - void AppendGetStatusL( ConML_GetStatusPtr_t aContent ); - void AppendRebootL( ConML_RebootPtr_t aContent ); - void AppendTaskL( ConML_TaskPtr_t aContent ); - void AppendTaskListL( ConML_TaskListPtr_t aContent ); - void AppendUnInstallL( ConML_UnInstallPtr_t aContent ); - void AppendListInstalledAppsL ( ConML_ListInstalledAppsPtr_t aContent ); - void AppendListDataOwnersL ( ConML_ListDataOwnersPtr_t aContent ); - void AppendBUROptionsL( ConML_BUROptionsPtr_t aContent ); - void AppendSetBURModeL( ConML_SetBURModePtr_t aContent ); - void AppendGetDataSizeL( ConML_GetDataSizePtr_t aContent ); - void AppendRequestDataL( ConML_RequestDataPtr_t aContent ); - void AppendUpdateDeviceInfoL( ConML_UpdateDeviceInfoPtr_t aContent ); - void AppendListPublicFilesL( ConML_ListPublicFilesPtr_t aContent ); - void AppendApplicationL( ConML_ApplicationPtr_t aContent ); - void AppendApplicationListL( ConML_ApplicationListPtr_t aContent ); - void AppendApplicationsL( ConML_ApplicationsPtr_t aContent ); - void AppendParamL( ConML_ParamPtr_t aContent ); - void AppendParamListL( ConML_ParamListPtr_t aContent ); - void AppendInstParamsL( ConML_InstParamsPtr_t aContent ); - void AppendProgressL( ConML_ProgressPtr_t aContent ); - void AppendResultsL( ConML_ResultsPtr_t aContent ); - void AppendDriveL( ConML_DrivePtr_t aContent ); - void AppendDriveListL( ConML_DriveListPtr_t aContent ); - void AppendDrivesL( ConML_DrivesPtr_t aContent ); - void AppendDataOwnersL( ConML_DataOwnersPtr_t aContent ); - void AppendPackageInfoL ( ConML_PackageInfoPtr_t aContent ); - void AppendSIDL( ConML_SIDPtr_t aContent ); - void AppendSIDListL( ConML_SIDListPtr_t aContent ); - void AppendDeviceInfoL( ConML_DeviceInfoPtr_t aContent ); - void AppendFilesL( ConML_FilesPtr_t aContent ); - void AppendSupportedMethodsL( ConML_SupportedMethodsPtr_t aContent ); - void AppendFileListL( ConML_FileListPtr_t aContent ); - void AppendFileL( ConML_FilePtr_t aContent ); - void AppendGetDataOwnerStatusL( ConML_GetDataOwnerStatusPtr_t aContent ); - void AppendGetMetadataL( ConML_GetMetadataPtr_t aContent ); - - TInt HandleResult( TInt aResult, TInt aTreshold = 0 ); - -private: - void ConstructL(); - CSConConMLGenerator(); - void AddElement( CXMLElement* aElement ); - -private: - // Parser - CXMLStack* iCmdStack; - CXMLStack* iCleanupStack; - MWBXMLConMLCallback* iCallback; - - // Generator workspaces - CXMLWorkspace* iWBXMLWorkspace; - CXMLWorkspace* iXMLWorkspace; - - // XML - RArray iElemStack; - TInt iInitialIndentLevel; - TBool iDontNewLine; - TBool iDontIndent; - }; - -#endif // __SCONCONMLGENERATOR_H__ diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/wbxml/conmlhandler/inc/sconconmlhandler.h --- a/connectivitymodules/SeCon/wbxml/conmlhandler/inc/sconconmlhandler.h Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,123 +0,0 @@ -/* -* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: ConML parser/generator -* -*/ - - -#ifndef _SCONCONMLHANDLER_H -#define _SCONCONMLHANDLER_H - -// ----------------------------------------------------------------------------- -// Includes -// ----------------------------------------------------------------------------- -#include "sconconmlgenerator.h" -#include "sconwbxmldefs.h" -#include "sconconmlhandlererror.h" -#include "sconconmldtd.h" - -// ----------------------------------------------------------------------------- -// Definitions and constants -// ----------------------------------------------------------------------------- - -_LIT8(KWBXMLNull, "\x00"); - -const TInt KSConBufferGranularity( 32 ); -const TInt KSConDefaultDocumentSize( 2048 ); - -// ----------------------------------------------------------------------------- -// TWBXMLStackItem -// ----------------------------------------------------------------------------- -NONSHARABLE_STRUCT( TWBXMLStackItem ) - { -public: - inline TWBXMLStackItem( TUint8 aTag ); - inline TUint8 Tag() const; - -private: - TUint8 iTag; - }; - -#include "sconwbxmlparser.inl" - -// ----------------------------------------------------------------------------- -// CSConConMLHandler - WBXML parsing -// ----------------------------------------------------------------------------- -class CSConConMLHandler : public CBase - { -public: - static CSConConMLHandler* NewL(); - ~CSConConMLHandler(); - - /** - * Starts the parsing of a WBXML document - * @param aInput - the WBXML document to be parsed - * @param aCallback - Call back function to call - * after the document is parsed - * @return An error code - */ - virtual TInt ParseDocumentL( CBufFlat& aInput, - MWBXMLConMLCallback* aCallback ); - - /** - * Starts the generating of a WBXML and XML document - * @param aContent - the data to be generated into the document - * @return An error code - */ - virtual TInt GenerateDocument( ConML_ConMLPtr_t aContent ); - - /** - * Returns the generated document in XML -format - * @param none - * @return The document as TPtrC8 - */ - virtual TPtrC8 XMLDocument(); - - /** - * Returns the generated document in WBXML -format - * @param none - * @return The document as TPtrC8 - */ - virtual TPtrC8 WBXMLDocument(); - -private: - CSConConMLHandler(); - void ConstructL(); - - TInt ParseL(); - TConMLParserError DoParseDocumentHeaderL(); - TConMLParserError DoParseDocumentBodyL(); - TUint8 ReadUint8L(); - TUint32 ReadMUint32L(); - TPtrC8 ReadStrIL(); - TPtrC8 StringTableString( TUint32 aIndex ); - void ReadStringTableL(); - TPtrC8 ReadOpaqueL(); - void HandleElementL( TUint8 aId ); - -private: - CSConConMLGenerator* iGenerator; - HBufC8* iStringTable; - CBufBase* iBuffer; - TBool iHeaderParsed; - RArray< TUint > iElemStack; - TInt iPos; - CBufFlat* iParseBuffer; - MWBXMLConMLCallback* iCallback; - }; - - IMPORT_C CSConConMLHandler* CreateCSConConMLHandlerL(); - typedef CSConConMLHandler* (*TSConCreateCSConConMLHandlerFunc) (); - -#endif diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/wbxml/conmlhandler/inc/sconconmlhandlererror.h --- a/connectivitymodules/SeCon/wbxml/conmlhandler/inc/sconconmlhandlererror.h Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ -/* -* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: ConML parser/generator -* -*/ - - -#ifndef __SCONCONMLHANDLERERROR_H__ -#define __SCONCONMLHANDLERERROR_H__ - -// ----------------------------------------------------------------------------- -// Parser error base -// ----------------------------------------------------------------------------- - -#define PERRBASE 0x2000 - -enum TConMLParserError - { - KWBXMLParserErrorOk = 0, - KWBXMLParserErrorEof = PERRBASE, - KWBXMLParserErrorEofTooEarly, - KWBXMLParserErrorInvalidTag, - KWBXMLParserErrorWrongWBXMLVersion, - KWBXMLParserErrorWrongPublicId, - KWBXMLParserErrorinvalidDocument - }; - -#define GERRBASE 0x3000 - -enum TWBXMLGeneratorError - { - KWBXMLGeneratorOk = 0, - KWBXMLGeneratorBufferFull = GERRBASE - }; - -#endif // __SCONCONMLHANDLERERROR_H__ \ No newline at end of file diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/wbxml/conmlhandler/inc/sconconmltags.h --- a/connectivitymodules/SeCon/wbxml/conmlhandler/inc/sconconmltags.h Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,120 +0,0 @@ -/* -* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: ConML parser/generator -* -*/ - - - -#ifndef __SCONCONMLTAGS_H__ -#define __SCONCONMLTAGS_H__ - -// ----------------------------------------------------------------------------- -// Constants -// ----------------------------------------------------------------------------- -const TInt32 KSConConMLPublicId = 0x8F; -const TUint8 KSConConMLVersion = 0x02; -const TUint32 KSConConMLUTF8 = 0x6a; - -_LIT8(KSConConMLPublicIdStr, "-//CONML//DTD ConML 1.0//EN"); - -// ----------------------------------------------------------------------------- -// TConMLTags -// ----------------------------------------------------------------------------- -enum TConMLTags - { - EConMLAll = 5, - EConMLApplication, - EConMLApplications, - EConMLBUROptions, - EConMLCancel, - EConMLComplete, - EConML, - EConMLData, - EConMLDataOwners, - EConMLDataOwnerStatus, - EConMLDelayToPrepareData, - EConMLDeviceInfo, - EConMLDrive, - EConMLDrives, - EConMLExecute, - EConMLFile, - EConMLFiles, - EConMLGetDataOwnerStatus, - EConMLGetDataSize, - EConMLGetStatus, - EConMLHasFiles, - EConMLID, - EConMLIncType, - EConMLInstall, - EConMLInstParams, - EConMLListDataOwners, - EConMLListInstalledApps, - EConMLListPublicFiles, - EConMLMaxObjectSize, - EConMLModified, - EConMLMoreData, - EConMLName, - EConMLPackageInfo, - EConMLParam, - EConMLPartialType, - EConMLProgress, - EConMLReboot, - EConMLRequestData, - EConMLRequiresReboot, - EConMLResults, - EConMLSetBURMode, - EConMLSetInstParams, - EConMLSID, - EConMLSize, - EConMLStatus, - EConMLSupplyData, - EConMLSupportedMethods, - EConMLSupportsInc, - EConMLTask, - EConMLTransferDataType, - EConMLType, - EConMLUID, - EConMLUnInstall, - EConMLUpdateDeviceInfo, - EConMLUserPerm, - EConMLValue, - EConMLVersion, - EConMLGetMetadata, - EConMLFilename - }; -// ----------------------------------------------------------------------------- -_LIT8( KConMLElements, - "<0>|<1>|<2>|<3>|<4>|All|Application|Applications|BUROptions|Cancel" - "|Complete|ConML|Data|DataOwners|DataOwnerStatus|DelayToPrepareData" - "|DeviceInfo|Drive|Drives|Execute|File|Files|GetDataOwnerStatus" - "|GetDataSize|GetStatus|HasFiles|ID|IncType|Install|InstParams" - "|ListDataOwners|ListInstalledApps|ListPublicFiles|MaxObjectSize|" - "Modified|MoreData|Name|PackageInfo|Param|PartialType|Progress|" - "Reboot|RequestData|RequiresReboot|Results|SetBURMode|SetInstParams|SID|" - "Size|Status|SupplyData|SupportedMethods|SupportsInc|Task|" - "TransferDataType|Type|UID|UnInstall|UpdateDeviceInfo|UserPerm|" - "Value|Version|GetMetadata|Filename" ); - -_LIT8(KXMLTagStart, "<"); -_LIT8(KXMLTagStartEndTag, ""); -_LIT8(KXMLTagEnd, ">"); -_LIT8(KXMLElemenentSeparator, "|"); -_LIT8(KXMLNamespaceBegin, " xmlns='"); -_LIT8(KXMLNamespaceEnd, "'"); -_LIT8(KXMLIndent, " "); -_LIT8(KXMLNewLine, "\r\n"); - -#endif \ No newline at end of file diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/wbxml/conmlhandler/inc/sconwbxmldefs.h --- a/connectivitymodules/SeCon/wbxml/conmlhandler/inc/sconwbxmldefs.h Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,41 +0,0 @@ -/* -* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: ConML parser/generator -* -*/ - - -#ifndef __SCONWBXMLDEFS_H__ -#define __SCONWBXMLDEFS_H__ - -// ----------------------------------------------------------------------------- -// Typedefs -// ----------------------------------------------------------------------------- -typedef TUint8 TWBXMLTag; - -// ----------------------------------------------------------------------------- -// Constants -// ----------------------------------------------------------------------------- -const TWBXMLTag SWITCH_PAGE = 0; -const TWBXMLTag END = 1; -const TWBXMLTag ENTITY = 2; -const TWBXMLTag STR_I = 3; -const TWBXMLTag LITERAL = 4; -const TWBXMLTag OPAQUE = 0xc3; - -const TUint8 KWBXMLHasAttributes = (1<<7); -const TUint8 KWBXMLHasContent = (1<<6); - - -#endif // __SCONWBXMLDEFS_H__ \ No newline at end of file diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/wbxml/conmlhandler/inc/sconwbxmlparser.inl --- a/connectivitymodules/SeCon/wbxml/conmlhandler/inc/sconwbxmlparser.inl Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: ConML parser/generator -* -*/ - - -#ifndef __SCONWBXMLPARSER_INL__ -#define __SCONWBXMLPARSER_INL__ - - -inline TWBXMLStackItem::TWBXMLStackItem( TUint8 aTag ) : iTag(aTag) - { - } - -inline TUint8 TWBXMLStackItem::Tag() const - { - return iTag; - } - -#endif // __SCONWBXMLPARSER_INL__ diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/wbxml/conmlhandler/inc/sconxmlelement.h --- a/connectivitymodules/SeCon/wbxml/conmlhandler/inc/sconxmlelement.h Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,137 +0,0 @@ -/* -* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: ConML parser/generator -* -*/ - - -#ifndef __SCONXMLELEMENT_H__ -#define __SCONXMLELEMENT_H__ - -// ----------------------------------------------------------------------------- -// Includes -// ----------------------------------------------------------------------------- - -#include -#include "sconxmlstack.h" - -// ----------------------------------------------------------------------------- -// Class forwards -// ----------------------------------------------------------------------------- -class MWBXMLConMLCallback; -struct TXMLElementParams; - -// ----------------------------------------------------------------------------- -// CXMLElement - Base class for XML -elements -// ----------------------------------------------------------------------------- -NONSHARABLE_CLASS( CXMLElement ) : public CBase - { -public: - enum TAction - { - ENone, - EPop, - EPopAndDestroy // Pop from stack, callback, delete - }; - - /** - * Sets the data of an element - * @param aData - Data of the element - * @return none - */ - virtual void SetDataL( const TDesC8& aData ); - - /** - * Returns data of an element - * @param none - * @return Data of the element as TPtrC8 - */ - virtual TPtrC8 Data() const; - - /** - * Validates an element's instance - * @param none - * @return ETrue if element current instance is valid, - * EFalse if not - */ - virtual TBool Validate(); - - /** - * Checks if instance needs cleanup - * @param none - * @return ETrue if instance pushed into - * parser's cleanupstack , EFalse if not - */ - virtual TBool NeedsCleanup() const; - - /** - * Offers a new element to this element - * @param aTag - tag of the element to be started - * @param aParams - Element parameters - * @return new Element instance as CXMLElement - */ - virtual CXMLElement* BeginElementL( - TUint8 aTag, const TXMLElementParams& aParams ); - - /** - * Offers a new element to this element - * @param aTag - tag of the element to be started - * @param aParams - Element parameters - * @return new Element instance as CXMLElement - */ - virtual TAction EndElementL( TAny* aCallbacks, TUint8 aTag ); - }; - -// ----------------------------------------------------------------------------- -// TElementParams -// ----------------------------------------------------------------------------- -NONSHARABLE_STRUCT( TXMLElementParams ) - { -public: - inline TXMLElementParams(); - TXMLElementParams( - TAny* aCallbacks, - CXMLStack* aCmdStack = 0, - CXMLStack* aCleanupStack = 0 ); - - /** - * Returns the call back function of parameters - * @param nonoe - * @return call back function as TAny - */ - inline TAny* Callbacks() const; - - /** - * Returns the command stack of the parameters - * @param none - * @return command stack as CXMLStack - */ - inline CXMLStack* CmdStack() const; - - /** - * Returns the clean up stack of the parameters - * @param none - * @return clean up stack as CXMLStack - */ - inline CXMLStack* CleanupStack() const; - -private: - TAny* iCallbacks; - CXMLStack* iCmdStack; - CXMLStack* iCleanupStack; - }; - -#include "sconxmlelement.inl" - -#endif // __SCONXMLELEMENT_H__ \ No newline at end of file diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/wbxml/conmlhandler/inc/sconxmlelement.inl --- a/connectivitymodules/SeCon/wbxml/conmlhandler/inc/sconxmlelement.inl Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ -/* -* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: ConML parser/generator -* -*/ - - -#ifndef __SCONXMLELEMENT_INL__ -#define __SCONXMLELEMENT_INL__ - -// ------------------------------------------------------------------------------------------------ -inline TXMLElementParams::TXMLElementParams() : iCallbacks(0), iCmdStack(0), iCleanupStack(0) - { - } - -// ------------------------------------------------------------------------------------------------ -inline TAny* TXMLElementParams::Callbacks() const - { - return iCallbacks; - } - -// ------------------------------------------------------------------------------------------------ -inline CXMLStack* TXMLElementParams::CmdStack() const - { - return iCmdStack; - } - -// ------------------------------------------------------------------------------------------------ -inline CXMLStack* TXMLElementParams::CleanupStack() const - { - return iCleanupStack; - } - -#endif // __SCONXMLELEMENT_INL__ \ No newline at end of file diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/wbxml/conmlhandler/inc/sconxmlstack.h --- a/connectivitymodules/SeCon/wbxml/conmlhandler/inc/sconxmlstack.h Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,85 +0,0 @@ -/* -* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: ConML parser/generator -* -*/ - - -#ifndef __SCONXMLSTACK_H__ -#define __SCONXMLSTACK_H__ - -// ----------------------------------------------------------------------------- -// CNSmlStack - Stack for WBXML / XML elements -// ---------------------------------------------------------------------------- - -template -class CXMLStack : public CBase - { -public: - static inline CXMLStack* NewL(); - inline ~CXMLStack(); - - /** - * Removes latest item from the stack - * @param none - * @return none - */ - inline T* Pop(); - - /** - * Return the latest item from the stack - * @param none - * @return the item - */ - inline T* Top(); - - /** - * Adds an item to the stack - * @param none - * @return none - */ - inline void Push( T* aItem ); - - /** - * Returns the number of items in the stack - * @param none - * @return number of items as TInt - */ - inline TInt Count(); - - /** - * Resets the stack - * @param none - * @return none - */ - inline void Reset(); - - /** - * Resets and destroys the stack - * @param none - * @return none - */ - inline void ResetAndDestroy(); - - -protected: - inline CXMLStack(); - -private: - RPointerArray* iStack; - }; - -#include "sconxmlstack.inl" - -#endif // __SCONXMLSTACK_H__ \ No newline at end of file diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/wbxml/conmlhandler/inc/sconxmlstack.inl --- a/connectivitymodules/SeCon/wbxml/conmlhandler/inc/sconxmlstack.inl Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,99 +0,0 @@ -/* -* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: ConML parser/generator -* -*/ - - -#ifndef __SCONXMLSTACK_INL__ -#define __SCONXMLSTACK_INL__ - - -// ------------------------------------------------------------------------------------------------ -// CXMLStack -// ------------------------------------------------------------------------------------------------ -template -inline CXMLStack::CXMLStack() - { - } - -// ------------------------------------------------------------------------------------------------ -template -inline CXMLStack::~CXMLStack() - { - iStack->ResetAndDestroy(); - delete iStack; - } - -// ------------------------------------------------------------------------------------------------ -template -inline CXMLStack* CXMLStack::NewL() - { - CXMLStack* self = new (ELeave) CXMLStack(); - CleanupStack::PushL(self); - self->iStack = new (ELeave) RPointerArray(); - CleanupStack::Pop(); // self - return self; - } - -// ------------------------------------------------------------------------------------------------ -template -inline T* CXMLStack::Pop() - { - T* temp = iStack->operator[](iStack->Count() - 1); - iStack->Remove(iStack->Count() - 1); - return temp; - } - -// ------------------------------------------------------------------------------------------------ -template -inline T* CXMLStack::Top() - { - if( Count() > 0 ) - { - return iStack->operator[](iStack->Count() - 1); - } - return 0; - } - -// ------------------------------------------------------------------------------------------------ -template -inline void CXMLStack::Push( T* aItem ) - { - iStack->Append(aItem); - } - -// ------------------------------------------------------------------------------------------------ -template -inline TInt CXMLStack::Count() - { - return iStack->Count(); - } - -// ------------------------------------------------------------------------------------------------ -template -inline void CXMLStack::Reset() - { - iStack->Reset(); - } - -// ------------------------------------------------------------------------------------------------ -template -inline void CXMLStack::ResetAndDestroy() - { - iStack->ResetAndDestroy(); - } - -#endif // __SCONXMLSTACK_INL__ - diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/wbxml/conmlhandler/inc/sconxmlworkspace.h --- a/connectivitymodules/SeCon/wbxml/conmlhandler/inc/sconxmlworkspace.h Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,120 +0,0 @@ -/* -* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: ConML parser/generator -* -*/ - - -#ifndef __SCONXMLWORKSPACE_H__ -#define __SCONXMLWORKSPACE_H__ - -// ----------------------------------------------------------------------------- -// Includes -// ----------------------------------------------------------------------------- -#include - -// ----------------------------------------------------------------------------- -// CXMLWorkspace - workspace for WBXML / XML -documents -// ----------------------------------------------------------------------------- -class CXMLWorkspace : public CBase - { -public: - ~CXMLWorkspace(); - static CXMLWorkspace* NewL(); - - // transaction handling - /** - * Function to Begin transaction - * @param none - * @return none - */ - void BeginTransaction(); - - /** - * Commits the transactions done - * @param none - * @return none - */ - void CommitAll(); - - /** - * Commits the latest transacion done - * @param none - * @return KErrNone or an error code - */ - TInt Commit(); - - /** - * Deletes the latest transacion done - * @param none - * @return KErrNone or an error code - */ - TInt Rollback(); - - /** - * Resets the buffer - * @param none - * @return KErrNone or an error code - */ - void Reset(); - - /** - * Writes to the buffer - * @param none - * @return none - */ - void WriteL( const TDesC8& aData ); - void WriteL( const TUint8 aData ); - - /** - * Returns the buffer - * @param none - * @return the buffer - */ - TPtrC8 Buffer(); - - /** - * Returns the free space left in the buffer - * @param none - * @return free space of the buffer - */ - TInt FreeSize(); - - /** - * Returns the maximum size of the buffer - * @param none - * @return Buffer maximum size - */ - TInt MaxSize(); - - /** - * Returns the size of the buffer space used - * @param none - * @return Size of the buffer used - */ - TInt Size(); - -protected: - void ConstructL(); - -private: - void Delete( TInt aPos, TInt aLength ); - CXMLWorkspace(); -private: - CBufFlat* iBuffer; - RArray* iTransactions; - }; - -#endif // __SCONXMLWORKSPACE_H__ - diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/wbxml/conmlhandler/src/sconconmldtd.cpp --- a/connectivitymodules/SeCon/wbxml/conmlhandler/src/sconconmldtd.cpp Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1783 +0,0 @@ -/* -* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: ConML parser/generator -* -*/ - - -#include "sconconmldtd.h" -#include "sconconmltags.h" -#include "sconconmlhandler.h" -#include "sconconmlhandlererror.h" -#include "debug.h" - -// ----------------------------------------------------------------------------- -// Macros -// ----------------------------------------------------------------------------- -#define CHECK_NO_DUPLICATE(a) if( a ) { User::Leave( KWBXMLParserErrorinvalidDocument ); } - -// ----------------------------------------------------------------------------- -// pcdata_s -// ----------------------------------------------------------------------------- -pcdata_s::pcdata_s( const pcdataType_t aType, const pcdataExtension_t aExt ) - : contentType(aType), extension(aExt) - { - } - -pcdata_s::pcdata_s() : contentType(SML_PCDATA_OPAQUE), - extension(SML_EXT_UNDEFINED) - { - } - -pcdata_s::~pcdata_s() - { - FreeContent(); - } - -void pcdata_s::FreeContent() - { - User::Free(content); - content = 0; - } - -void pcdata_s::SetDataL( const TDesC8& aData ) - { - FreeContent(); - length = aData.Length(); - content = User::AllocL(length); - Mem::Copy(content, aData.Ptr(), length); - } - -TPtrC8 pcdata_s::Data() const - { - return TPtrC8((TUint8*)content, length); - } - -void pcdata_s::TruncateL( TInt aConsumed ) - { - HBufC8* buffer = TPtrC8((TUint8*)content + aConsumed, - length - aConsumed).AllocLC(); - SetDataL(*buffer); - CleanupStack::PopAndDestroy(); // buffer - } - -pcdata_list_s::pcdata_list_s() - { - } - -pcdata_list_s::~pcdata_list_s() - { - delete data; - delete next; - } - -// ----------------------------------------------------------------------------- -// AddDriveL -// ----------------------------------------------------------------------------- -CXMLElement* AddDriveL( ConML_DriveListPtr_t* aList ) - { - ConML_DriveListPtr_t itemL = new ( ELeave ) ConML_DriveList_t(); - CleanupStack::PushL( itemL ); - itemL->data = new ( ELeave ) ConML_Drive_t(); - GenericListAddL(aList, itemL); - CleanupStack::Pop(); // itemL - return itemL->data; - } - -// ----------------------------------------------------------------------------- -// AddSIDL -// ----------------------------------------------------------------------------- -CXMLElement* AddSIDL( ConML_SIDListPtr_t * aList ) - { - ConML_SIDListPtr_t itemL = new ( ELeave ) ConML_SIDList_t(); - CleanupStack::PushL( itemL ); - itemL->data = new ( ELeave ) ConML_SID_t(); - GenericListAddL(aList, itemL); - CleanupStack::Pop(); // itemL - return itemL->data; - } - -// ----------------------------------------------------------------------------- -// AddFileL -// ----------------------------------------------------------------------------- -CXMLElement* AddFileL( ConML_FileListPtr_t * aList ) - { - ConML_FileListPtr_t itemL = new ( ELeave ) ConML_FileList_t(); - CleanupStack::PushL( itemL ); - itemL->data = new ( ELeave ) ConML_File_t(); - GenericListAddL(aList, itemL); - CleanupStack::Pop(); // itemL - return itemL->data; - } - -// ----------------------------------------------------------------------------- -// AddApplicationL -// ----------------------------------------------------------------------------- -CXMLElement* AddApplicationL( ConML_ApplicationListPtr_t * aList ) - { - ConML_ApplicationListPtr_t itemL = new ( ELeave ) ConML_ApplicationList_t(); - CleanupStack::PushL( itemL ); - itemL->data = new ( ELeave ) ConML_Application_t(); - GenericListAddL(aList, itemL); - CleanupStack::Pop(); // itemL - return itemL->data; - } - -// ----------------------------------------------------------------------------- -// AddTaskL -// ----------------------------------------------------------------------------- -CXMLElement* AddTaskL( ConML_TaskListPtr_t * aList ) - { - ConML_TaskListPtr_t itemL = new ( ELeave ) ConML_TaskList_t(); - CleanupStack::PushL( itemL ); - itemL->data = new ( ELeave ) ConML_Task_t(); - GenericListAddL(aList, itemL); - CleanupStack::Pop(); // itemL - return itemL->data; - } - -// ----------------------------------------------------------------------------- -// AddParamL -// ----------------------------------------------------------------------------- -CXMLElement* AddParamL( ConML_ParamListPtr_t * aList ) - { - ConML_ParamListPtr_t itemL = new ( ELeave ) ConML_ParamList_t(); - CleanupStack::PushL( itemL ); - itemL->data = new ( ELeave ) ConML_Param_t(); - GenericListAddL(aList, itemL); - CleanupStack::Pop(); // itemL - return itemL->data; - } - -// ----------------------------------------------------------------------------- -// ConML_Drive_s -// ----------------------------------------------------------------------------- -ConML_Drive_s::ConML_Drive_s() - { - } - -ConML_Drive_s::~ConML_Drive_s() - { - delete name; - } - -CXMLElement* ConML_Drive_s::BeginElementL( - TUint8 aTag, const TXMLElementParams& /*aParams*/ ) - { - switch ( aTag ) - { - case EConMLName: - CHECK_NO_DUPLICATE ( name ); - name = new ( ELeave ) pcdata_t(); - return name; - - default: - LOGGER_WRITE_1( "ConML_Drive_s::BeginElement() : Unknown element %02x", aTag ); - User::Leave( KWBXMLParserErrorInvalidTag ); - } - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// ConML_DriveList_s -// ----------------------------------------------------------------------------- -ConML_DriveList_s::ConML_DriveList_s() - { - } - -ConML_DriveList_s::~ConML_DriveList_s() - { - delete data; - delete next; - } - -// ----------------------------------------------------------------------------- -// ConML_Drives_s -// ----------------------------------------------------------------------------- -ConML_Drives_s::ConML_Drives_s() - { - } - -ConML_Drives_s::~ConML_Drives_s() - { - delete drive; - } - -CXMLElement* ConML_Drives_s::BeginElementL( - TUint8 aTag, const TXMLElementParams& /*aParams*/ ) - { - switch ( aTag ) - { - case EConMLDrive: - return AddDriveL ( &drive ); - - default: - LOGGER_WRITE_1( "ConML_Drives_s::BeginElement()\ - : Unknown element %02x ", aTag ); - User::Leave( KWBXMLParserErrorInvalidTag ); - } - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// ConML_BUROptions_s -// ----------------------------------------------------------------------------- -ConML_BUROptions_s::ConML_BUROptions_s() - { - } - -ConML_BUROptions_s::~ConML_BUROptions_s() - { - delete requiresReboot; - delete hasFiles; - delete supportsInc; - delete delayToPrepareData; - } - -CXMLElement* ConML_BUROptions_s::BeginElementL ( - TUint8 aTag, const TXMLElementParams& /*aParams*/ ) - { - switch ( aTag ) - { - case EConMLRequiresReboot: - CHECK_NO_DUPLICATE ( requiresReboot ); - requiresReboot = new ( ELeave ) pcdata_t(); - return requiresReboot; - - case EConMLHasFiles: - CHECK_NO_DUPLICATE ( hasFiles ); - hasFiles = new ( ELeave ) pcdata_t(); - return hasFiles; - - case EConMLSupportsInc: - CHECK_NO_DUPLICATE ( supportsInc ); - supportsInc = new ( ELeave ) pcdata_t(); - return supportsInc; - - case EConMLDelayToPrepareData: - CHECK_NO_DUPLICATE ( delayToPrepareData ); - delayToPrepareData = new ( ELeave ) pcdata_t(); - return delayToPrepareData; - - default: - LOGGER_WRITE_1( "ConML_BUROptions_s::BeginElement()\ - : Unknown element %02x ", aTag ); - User::Leave( KWBXMLParserErrorInvalidTag ); - } - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// ConML_PackageInfo_s -// ----------------------------------------------------------------------------- -ConML_PackageInfo_s::ConML_PackageInfo_s() - { - } - -ConML_PackageInfo_s::~ConML_PackageInfo_s() - { - delete name; - } - -CXMLElement* ConML_PackageInfo_s::BeginElementL( - TUint8 aTag, const TXMLElementParams& /*aParams*/ ) - { - switch ( aTag ) - { - case EConMLName: - CHECK_NO_DUPLICATE ( name ) - name = new ( ELeave ) pcdata_t(); - return name; - - default: - LOGGER_WRITE_1( "ConML_PackageInfo_s::BeginElement()\ - : Unknown element %02x ", aTag ); - User::Leave( KWBXMLParserErrorInvalidTag ); - } - return KErrNone; - } - - -// ----------------------------------------------------------------------------- -// ConML_SID_s -// ----------------------------------------------------------------------------- -ConML_SID_s::ConML_SID_s() - { - } - -ConML_SID_s::~ConML_SID_s() - { - delete type; - delete uid; - delete drives; - delete packageInfo; - delete burOptions; - delete size; - delete transferDataType; - delete data; - delete moreData; - delete dataOwnerStatus; - } - -CXMLElement* ConML_SID_s::BeginElementL( - TUint8 aTag, const TXMLElementParams& /*aParams*/ ) - { - switch ( aTag ) - { - case EConMLType: - CHECK_NO_DUPLICATE ( type ); - type = new ( ELeave ) pcdata_t(); - return type; - - case EConMLUID: - CHECK_NO_DUPLICATE ( uid ) - uid = new ( ELeave ) pcdata_t(); - return uid; - - case EConMLDrives: - drives = new ( ELeave ) ConML_Drives_t(); - return drives; - - case EConMLPackageInfo: - CHECK_NO_DUPLICATE ( packageInfo ); - packageInfo = new ( ELeave ) ConML_PackageInfo_t(); - return packageInfo; - - case EConMLBUROptions: - CHECK_NO_DUPLICATE ( burOptions ) - burOptions = new ( ELeave ) ConML_BUROptions_t(); - return burOptions; - - case EConMLSize: - CHECK_NO_DUPLICATE ( size ); - size = new ( ELeave ) pcdata_t(); - return size; - - case EConMLTransferDataType: - CHECK_NO_DUPLICATE ( transferDataType ); - transferDataType = new ( ELeave ) pcdata_t(); - return transferDataType; - - case EConMLData: - CHECK_NO_DUPLICATE ( data ); - data = new ( ELeave ) pcdata_t(); - return data; - - case EConMLMoreData: - CHECK_NO_DUPLICATE ( moreData ); - moreData = new ( ELeave ) pcdata_t(); - return moreData; - - case EConMLDataOwnerStatus: - CHECK_NO_DUPLICATE ( dataOwnerStatus ); - dataOwnerStatus = new ( ELeave ) pcdata_t(); - return dataOwnerStatus; - - default: - LOGGER_WRITE_1( "ConML_SID_s::BeginElement()\ - : Unknown element %02x ", aTag ); - User::Leave( KWBXMLParserErrorInvalidTag ); - } - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// ConML_SIDList_s -// ----------------------------------------------------------------------------- -ConML_SIDList_s::ConML_SIDList_s() - { - } - -ConML_SIDList_s::~ConML_SIDList_s() - { - delete data; - delete next; - } - -// ----------------------------------------------------------------------------- -// ConML_DataOwners_s -// ----------------------------------------------------------------------------- -ConML_DataOwners_s::ConML_DataOwners_s() - { - } - -ConML_DataOwners_s::~ConML_DataOwners_s() - { - delete sid; - } - -CXMLElement* ConML_DataOwners_s::BeginElementL( - TUint8 aTag, const TXMLElementParams& /*aParams*/ ) - { - switch ( aTag ) - { - case EConMLSID: - return AddSIDL( &sid ); - - default: - LOGGER_WRITE_1( "ConML_DataOwners_s::BeginElement()\ - : Unknown element %02x ", aTag); - User::Leave( KWBXMLParserErrorInvalidTag ); - } - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// ConML_Application_s -// ----------------------------------------------------------------------------- -ConML_Application_s::ConML_Application_s() - { - } - -ConML_Application_s::~ConML_Application_s() - { - delete name; - delete uid; - } - -CXMLElement* ConML_Application_s::BeginElementL( - TUint8 aTag, const TXMLElementParams& /*aParams*/ ) - { - switch ( aTag ) - { - case EConMLName: - CHECK_NO_DUPLICATE ( name ); - name = new ( ELeave ) pcdata_t(); - return name; - - case EConMLUID: - CHECK_NO_DUPLICATE ( uid ); - uid = new ( ELeave ) pcdata_t(); - return uid; - - default: - LOGGER_WRITE_1( "ConML_Application_s::BeginElement()\ - : Unknown element %02x ", aTag ); - User::Leave( KWBXMLParserErrorInvalidTag ); - } - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// ConML_ApplicationList_s -// ----------------------------------------------------------------------------- -ConML_ApplicationList_s::ConML_ApplicationList_s() - { - } - -ConML_ApplicationList_s::~ConML_ApplicationList_s() - { - delete data; - delete next; - } - -// ----------------------------------------------------------------------------- -// ConML_Applications_s -// ----------------------------------------------------------------------------- -ConML_Applications_s::ConML_Applications_s() - { - } - -ConML_Applications_s::~ConML_Applications_s() - { - delete application; - } - -CXMLElement* ConML_Applications_s::BeginElementL( - TUint8 aTag, const TXMLElementParams& /*aParams*/ ) - { - switch ( aTag ) - { - case EConMLApplication: - return AddApplicationL( &application ); - - default: - LOGGER_WRITE_1( "ConML_DataOwners_s::BeginElement()\ - : Unknown element %02x ", aTag ); - User::Leave( KWBXMLParserErrorInvalidTag ); - } - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// ConML_SupportedMethod_s -// ----------------------------------------------------------------------------- -ConML_SupportedMethods_s::ConML_SupportedMethods_s() - { - } - -ConML_SupportedMethods_s::~ConML_SupportedMethods_s() - { - delete install; - delete unInstall; - delete setInstParams; - delete listInstalledApps; - delete listDataOwners; - delete setBurMode; - delete getDataSize; - delete requestData; - delete supplyData; - delete reboot; - } - -CXMLElement* ConML_SupportedMethods_s::BeginElementL( - TUint8 aTag, const TXMLElementParams& /*aParams*/ ) - { - switch ( aTag ) - { - case EConMLInstall: - CHECK_NO_DUPLICATE ( install ); - install = new ( ELeave ) pcdata_t(); - return install; - - case EConMLUnInstall: - CHECK_NO_DUPLICATE ( unInstall ); - unInstall = new ( ELeave ) pcdata_t(); - return unInstall; - - case EConMLListInstalledApps: - CHECK_NO_DUPLICATE ( listInstalledApps ); - listInstalledApps = new ( ELeave ) pcdata_t(); - return listInstalledApps; - - case EConMLListDataOwners: - CHECK_NO_DUPLICATE ( listDataOwners ); - listDataOwners = new ( ELeave ) pcdata_t(); - return listDataOwners; - - case EConMLSetBURMode: - CHECK_NO_DUPLICATE ( setBurMode ); - setBurMode = new ( ELeave ) pcdata_t(); - return setBurMode; - - case EConMLGetDataSize: - CHECK_NO_DUPLICATE ( getDataSize ); - getDataSize = new ( ELeave ) pcdata_t(); - return getDataSize; - - case EConMLRequestData: - CHECK_NO_DUPLICATE ( requestData ); - requestData = new ( ELeave ) pcdata_t(); - return requestData; - - case EConMLSupplyData: - CHECK_NO_DUPLICATE (supplyData ); - supplyData = new ( ELeave ) pcdata_t(); - return supplyData; - - case EConMLReboot: - CHECK_NO_DUPLICATE ( reboot ); - reboot = new ( ELeave ) pcdata_t(); - return reboot; - - default: - LOGGER_WRITE_1( "ConML_SupportedMethods_s::\ - BeginElement() : Unknown element %02x ", aTag ); - User::Leave( KWBXMLParserErrorInvalidTag ); - } - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// ConML_DeviceInfo_s -// ----------------------------------------------------------------------------- -ConML_DeviceInfo_s::ConML_DeviceInfo_s() - { - } - -ConML_DeviceInfo_s::~ConML_DeviceInfo_s() - { - delete version; - delete supportedMethods; - delete maxObjectSize; - } - -CXMLElement* ConML_DeviceInfo_s::BeginElementL( - TUint8 aTag, const TXMLElementParams& /*aParams*/ ) - { - switch ( aTag ) - { - case EConMLVersion: - CHECK_NO_DUPLICATE (version); - version = new ( ELeave ) pcdata_t(); - return version; - - case EConMLSupportedMethods: - CHECK_NO_DUPLICATE ( supportedMethods); - supportedMethods = new ( ELeave ) ConML_SupportedMethods_t(); - return supportedMethods; - - case EConMLMaxObjectSize: - CHECK_NO_DUPLICATE ( maxObjectSize ); - maxObjectSize = new ( ELeave ) pcdata_t(); - return maxObjectSize; - - default: - LOGGER_WRITE_1( "ConML_DeviceInfo_s::BeginElement()\ - : Unknown element %d", aTag ); - User::Leave( KWBXMLParserErrorInvalidTag ); - } - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// ConML_DeviceInfo_s -// ----------------------------------------------------------------------------- -ConML_File_s::ConML_File_s() - { - } - -ConML_File_s::~ConML_File_s() - { - delete name; - delete modified; - delete size; - delete userPerm; - } - -CXMLElement* ConML_File_s::BeginElementL( - TUint8 aTag, const TXMLElementParams& /*aParams*/ ) - { - switch ( aTag ) - { - case EConMLName: - CHECK_NO_DUPLICATE ( name ); - name = new ( ELeave ) pcdata_t(); - return name; - - case EConMLModified: - CHECK_NO_DUPLICATE ( modified ); - modified = new ( ELeave ) pcdata_t(); - return modified; - - case EConMLSize: - CHECK_NO_DUPLICATE ( size ); - size = new ( ELeave ) pcdata_t(); - return size; - - case EConMLUserPerm: - CHECK_NO_DUPLICATE ( userPerm ); - userPerm = new ( ELeave ) pcdata_t(); - return userPerm; - - default: - LOGGER_WRITE_1( "ConML_File_s::BeginElement()\ - : Unknown element %d", aTag ); - User::Leave( KWBXMLParserErrorInvalidTag ); - } - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// ConML_FileList_s -// ----------------------------------------------------------------------------- -ConML_FileList_s::ConML_FileList_s() - { - } - -ConML_FileList_s::~ConML_FileList_s() - { - delete data; - delete next; - } - -// ----------------------------------------------------------------------------- -// ConML_Files_s -// ----------------------------------------------------------------------------- -ConML_Files_s::ConML_Files_s() - { - } - -ConML_Files_s::~ConML_Files_s() - { - delete file; - } - -CXMLElement* ConML_Files_s::BeginElementL( - TUint8 aTag, const TXMLElementParams& /*aParams*/ ) - { - switch ( aTag ) - { - case EConMLFile: - return AddFileL( &file ); - - default: - LOGGER_WRITE_1( "ConML_File_s::BeginElement()\ - : Unknown element %02x ", aTag ); - User::Leave( KWBXMLParserErrorInvalidTag ); - } - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// ConML_Progress_s -// ----------------------------------------------------------------------------- -ConML_Progress_s::ConML_Progress_s() - { - } - -// ----------------------------------------------------------------------------- -// ~ConML_Progress_s -// ----------------------------------------------------------------------------- -ConML_Progress_s::~ConML_Progress_s() - { - delete value; - } - -CXMLElement* ConML_Progress_s::BeginElementL( - TUint8 aTag, const TXMLElementParams& /*aParams*/ ) - { - switch ( aTag ) - { - case EConMLValue: - CHECK_NO_DUPLICATE ( value ); - value = new ( ELeave ) pcdata_t(); - return value; - - default: - LOGGER_WRITE_1( "ConML_Progress_s::BeginElement()\ - : Unknown element %02x ", aTag ); - User::Leave( KWBXMLParserErrorInvalidTag ); - } - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// ConML_Results_s -// ----------------------------------------------------------------------------- -ConML_Results_s::ConML_Results_s() - { - } - -ConML_Results_s::~ConML_Results_s() - { - delete complete; - delete progress; - delete applications; - delete dataOwners; - delete filename; - delete moreData; - delete data; - delete deviceInfo; - delete files; - } - -CXMLElement* ConML_Results_s::BeginElementL( - TUint8 aTag, const TXMLElementParams& /*aParams*/ ) - { - switch ( aTag ) - { - case EConMLComplete: - CHECK_NO_DUPLICATE ( complete ); - complete = new ( ELeave ) pcdata_t(); - return complete; - - case EConMLProgress: - CHECK_NO_DUPLICATE ( progress ); - progress = new ( ELeave ) ConML_Progress_t(); - return progress; - - case EConMLApplications: - CHECK_NO_DUPLICATE ( applications ); - applications = new ( ELeave ) ConML_Applications_t(); - return applications; - - case EConMLDataOwners: - CHECK_NO_DUPLICATE ( dataOwners ); - dataOwners = new ( ELeave ) ConML_DataOwners_t(); - return dataOwners; - - case EConMLMoreData: - CHECK_NO_DUPLICATE ( moreData ); - moreData = new ( ELeave ) pcdata_t(); - return moreData; - - case EConMLData: - CHECK_NO_DUPLICATE ( data ); - data = new ( ELeave ) pcdata_t(); - return data; - - case EConMLDeviceInfo: - CHECK_NO_DUPLICATE ( deviceInfo ) - deviceInfo = new ( ELeave ) ConML_DeviceInfo_t(); - return deviceInfo; - - case EConMLFiles: - CHECK_NO_DUPLICATE ( files ) - files = new ( ELeave ) ConML_Files_t(); - return files; - - default: - LOGGER_WRITE_1( "ConML_Results_s::BeginElement()\ - : Unknown element %02x ", aTag); - User::Leave( KWBXMLParserErrorInvalidTag ); - } - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// ConML_Param_s -// ----------------------------------------------------------------------------- -ConML_Param_s::ConML_Param_s() - { - } - -ConML_Param_s::~ConML_Param_s() - { - delete name; - delete value; - } - -CXMLElement* ConML_Param_s::BeginElementL( - TUint8 aTag, const TXMLElementParams& /*aParams*/ ) - { - switch ( aTag ) - { - case EConMLName: - CHECK_NO_DUPLICATE ( name ); - name = new ( ELeave ) pcdata_t(); - return name; - - case EConMLValue: - CHECK_NO_DUPLICATE ( value ); - value = new ( ELeave ) pcdata_t(); - return value; - - default: - LOGGER_WRITE_1( "ConML_Param_s::BeginElement()\ - : Unknown element %02x ", aTag ); - User::Leave( KWBXMLParserErrorInvalidTag ); - } - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// ConML_ParamList_s -// ----------------------------------------------------------------------------- -ConML_ParamList_s::ConML_ParamList_s() - { - } - -ConML_ParamList_s::~ConML_ParamList_s() - { - delete data; - delete next; - } - -// ----------------------------------------------------------------------------- -// ConML_InstParams_s -// ----------------------------------------------------------------------------- -ConML_InstParams_s::ConML_InstParams_s() - { - } - -ConML_InstParams_s::~ConML_InstParams_s() - { - delete param; - } - -CXMLElement* ConML_InstParams_s::BeginElementL( - TUint8 aTag, const TXMLElementParams& /*aParams*/ ) - { - switch ( aTag ) - { - case EConMLParam: - return AddParamL( ¶m ); - - default: - LOGGER_WRITE_1( "ConML_InstParams_s::BeginElement()\ - : Unknown element %02x ", aTag); - User::Leave( KWBXMLParserErrorInvalidTag ); - } - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// ConML_UnInstall_s -// ----------------------------------------------------------------------------- -ConML_UnInstall_s::ConML_UnInstall_s() - { - } - -ConML_UnInstall_s::~ConML_UnInstall_s() - { - delete applications; - delete instParams; - delete results; - } - -CXMLElement* ConML_UnInstall_s::BeginElementL( - TUint8 aTag, const TXMLElementParams& /*aParams*/ ) - { - switch ( aTag ) - { - case EConMLApplications: - CHECK_NO_DUPLICATE ( applications ); - applications = new ( ELeave ) ConML_Applications_t(); - return applications; - - case EConMLInstParams: - CHECK_NO_DUPLICATE ( instParams ); - instParams = new ( ELeave ) ConML_InstParams_t(); - return instParams; - - case EConMLResults: - CHECK_NO_DUPLICATE ( results ); - results = new ( ELeave ) ConML_Results_t(); - return results; - - default: - LOGGER_WRITE_1( "ConML_UnInstall_s::BeginElement()\ - : Unknown element %02x ", aTag); - User::Leave( KWBXMLParserErrorInvalidTag ); - } - return KErrNone; - } - - -// ----------------------------------------------------------------------------- -// ConML_ListDataOwners_s -// ----------------------------------------------------------------------------- -ConML_ListDataOwners_s::ConML_ListDataOwners_s() - { - } - -ConML_ListDataOwners_s::~ConML_ListDataOwners_s() - { - delete results; - } - -CXMLElement* ConML_ListDataOwners_s::BeginElementL( - TUint8 aTag, const TXMLElementParams& /*aParams*/ ) - { - switch ( aTag ) - { - case EConMLResults: - CHECK_NO_DUPLICATE ( results ); - results = new ( ELeave ) ConML_Results_t(); - return results; - - default: - LOGGER_WRITE_1( "ConML_ListDataOwners_s::BeginElement()\ - : Unknown element %02x ", aTag ); - User::Leave( KWBXMLParserErrorInvalidTag ); - } - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// ConML_Install_s -// ----------------------------------------------------------------------------- -ConML_Install_s::ConML_Install_s() - { - } - -ConML_Install_s::~ConML_Install_s() - { - delete name; - delete instParams; - delete results; - } - -CXMLElement* ConML_Install_s::BeginElementL( - TUint8 aTag, const TXMLElementParams& /*aParams*/ ) - { - switch ( aTag ) - { - case EConMLName: - CHECK_NO_DUPLICATE ( name ); - name = new ( ELeave ) pcdata_t(); - return name; - - case EConMLInstParams: - CHECK_NO_DUPLICATE ( instParams ); - instParams = new ( ELeave ) ConML_InstParams_t(); - return instParams; - - case EConMLResults: - CHECK_NO_DUPLICATE ( results ); - results = new ( ELeave ) ConML_Results_t(); - return results; - - default: - LOGGER_WRITE_1( "ConML_Install_s::BeginElement()\ - : Unknown element %02x ", aTag ); - User::Leave( KWBXMLParserErrorInvalidTag ); - } - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// ConML_ListInstalledApps -// ----------------------------------------------------------------------------- -ConML_ListInstalledApps_s::ConML_ListInstalledApps_s() - { - } - -ConML_ListInstalledApps_s::~ConML_ListInstalledApps_s() - { - delete drives; - delete all; - delete results; - } - -CXMLElement* ConML_ListInstalledApps_s::BeginElementL( - TUint8 aTag, const TXMLElementParams& /*aParams*/ ) - { - switch ( aTag ) - { - case EConMLDrives: - CHECK_NO_DUPLICATE ( drives ); - drives = new ( ELeave ) ConML_Drives_t(); - return drives; - - case EConMLAll: - CHECK_NO_DUPLICATE ( all ); - all = new ( ELeave ) pcdata_t(); - return all; - - case EConMLResults: - CHECK_NO_DUPLICATE ( results ); - results = new ( ELeave ) ConML_Results_t(); - return results; - - default: - LOGGER_WRITE_1( "ConML_ListInstalledApps_s::\ - BeginElement() : Unknown element %02x ", aTag ); - User::Leave( KWBXMLParserErrorInvalidTag ); - } - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// ConML_SetBURMode_s -// ----------------------------------------------------------------------------- -ConML_SetBURMode_s::ConML_SetBURMode_s() - { - } - -ConML_SetBURMode_s::~ConML_SetBURMode_s() - { - delete drives; - delete partialType; - delete incType; - delete results; - } - -CXMLElement* ConML_SetBURMode_s::BeginElementL( - TUint8 aTag, const TXMLElementParams& /*aParams*/ ) - { - switch ( aTag ) - { - case EConMLDrives: - drives = new ( ELeave ) ConML_Drives_t(); - return drives; - - case EConMLPartialType: - CHECK_NO_DUPLICATE ( partialType ); - partialType = new ( ELeave ) pcdata_t(); - return partialType; - - case EConMLIncType: - CHECK_NO_DUPLICATE ( incType ); - incType = new ( ELeave ) pcdata_t(); - return incType; - - case EConMLResults: - CHECK_NO_DUPLICATE ( results ); - results = new ( ELeave ) ConML_Results_t(); - return results; - - default: - LOGGER_WRITE_1( "ConML_SetBURMode_s::BeginElement()\ - : Unknown element %02x ", aTag ); - User::Leave( KWBXMLParserErrorInvalidTag ); - } - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// ConML_GetDataSize_s -// ----------------------------------------------------------------------------- -ConML_GetDataSize_s::ConML_GetDataSize_s() - { - } - -ConML_GetDataSize_s::~ConML_GetDataSize_s() - { - delete dataOwners; - delete results; - } - -CXMLElement* ConML_GetDataSize_s::BeginElementL( - TUint8 aTag, const TXMLElementParams& /*aParams*/ ) - { - switch ( aTag ) - { - case EConMLDataOwners: - CHECK_NO_DUPLICATE ( dataOwners ); - dataOwners = new ( ELeave ) ConML_DataOwners_t(); - return dataOwners; - - case EConMLResults: - CHECK_NO_DUPLICATE ( results ); - results = new ( ELeave ) ConML_Results_t(); - return results; - - default: - LOGGER_WRITE_1( "ConML_GetDataSize_s::BeginElement()\ - : Unknown element %02x ", aTag); - User::Leave( KWBXMLParserErrorInvalidTag ); - } - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// ConML_RequestData_s -// ----------------------------------------------------------------------------- -ConML_RequestData_s::ConML_RequestData_s() - { - } - -ConML_RequestData_s::~ConML_RequestData_s() - { - delete sid; - delete results; - } - -CXMLElement* ConML_RequestData_s::BeginElementL( - TUint8 aTag, const TXMLElementParams& /*aParams*/ ) - { - switch ( aTag ) - { - case EConMLSID: - return AddSIDL( &sid ); - - case EConMLResults: - CHECK_NO_DUPLICATE ( results ); - results = new ( ELeave ) ConML_Results_t(); - return results; - - default: - LOGGER_WRITE_1( "ConML_RequestData_s::BeginElement()\ - : Unknown element %02x ", aTag ); - User::Leave( KWBXMLParserErrorInvalidTag ); - } - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// ConML_UpdateDeviceInfo_s -// ----------------------------------------------------------------------------- -ConML_UpdateDeviceInfo_s::ConML_UpdateDeviceInfo_s() - { - } - -ConML_UpdateDeviceInfo_s::~ConML_UpdateDeviceInfo_s() - { - delete deviceInfo; - delete results; - } - -CXMLElement* ConML_UpdateDeviceInfo_s::BeginElementL( - TUint8 aTag, const TXMLElementParams& /*aParams*/ ) - { - switch ( aTag ) - { - case EConMLDeviceInfo: - CHECK_NO_DUPLICATE ( deviceInfo ) - deviceInfo = new ( ELeave ) ConML_DeviceInfo_t(); - return deviceInfo; - - case EConMLResults: - CHECK_NO_DUPLICATE ( results ) - results = new ( ELeave ) ConML_Results_t(); - return results; - - default: - LOGGER_WRITE_1( "ConML_UpdateDeviceInfo_s::\ - BeginElement() : Unknown element %02x ", aTag ); - User::Leave( KWBXMLParserErrorInvalidTag ); - } - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// ConML_ListPublicFiles_s -// ----------------------------------------------------------------------------- -ConML_ListPublicFiles_s::ConML_ListPublicFiles_s() - { - } - -ConML_ListPublicFiles_s::~ConML_ListPublicFiles_s() - { - delete results; - delete sid; - } - -CXMLElement* ConML_ListPublicFiles_s::BeginElementL( - TUint8 aTag, const TXMLElementParams& /*aParams*/ ) - { - switch ( aTag ) - { - case EConMLResults: - CHECK_NO_DUPLICATE ( results ); - results = new ( ELeave ) ConML_Results_t(); - return results; - - case EConMLSID: - return AddSIDL ( &sid ); - - default: - LOGGER_WRITE_1( "ConML_ListPublicFiles_s::\ - BeginElement() : Unknown element %02x ", aTag ); - User::Leave( KWBXMLParserErrorInvalidTag ); - } - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// ConML_Task_s -// ----------------------------------------------------------------------------- -ConML_GetDataOwnerStatus_s::ConML_GetDataOwnerStatus_s() - { - } - -ConML_GetDataOwnerStatus_s::~ConML_GetDataOwnerStatus_s() - { - delete dataOwners; - delete results; - } - -CXMLElement* ConML_GetDataOwnerStatus_s::BeginElementL( - TUint8 aTag, const TXMLElementParams& /*aParams*/ ) - { - switch ( aTag ) - { - case EConMLResults: - CHECK_NO_DUPLICATE ( results ); - results = new ( ELeave ) ConML_Results_t(); - return results; - - case EConMLDataOwners: - CHECK_NO_DUPLICATE ( dataOwners ); - dataOwners = new ( ELeave ) ConML_DataOwners_t(); - return dataOwners; - - default: - LOGGER_WRITE_1( "ConML_GetDataOwnerStatus_s::\ - BeginElement() : Unknown element %02x ", aTag ); - User::Leave( KWBXMLParserErrorInvalidTag ); - } - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// ConML_GetMetadata_s -// ----------------------------------------------------------------------------- -ConML_GetMetadata_s::ConML_GetMetadata_s() - { - } - -ConML_GetMetadata_s::~ConML_GetMetadata_s() - { - delete filename; - delete results; - } - -CXMLElement* ConML_GetMetadata_s::BeginElementL( - TUint8 aTag, const TXMLElementParams& /*aParams*/ ) - { - switch ( aTag ) - { - case EConMLResults: - CHECK_NO_DUPLICATE ( results ); - results = new ( ELeave ) ConML_Results_t(); - return results; - - case EConMLFilename: - CHECK_NO_DUPLICATE ( filename ); - filename = new ( ELeave ) pcdata_t(); - return filename; - - default: - LOGGER_WRITE_1( "ConML_GetMetadata_s::\ - BeginElement() : Unknown element %02x ", aTag ); - User::Leave( KWBXMLParserErrorInvalidTag ); - } - return KErrNone; - } - - -// ----------------------------------------------------------------------------- -// ConML_Reboot_s -// ----------------------------------------------------------------------------- -ConML_Reboot_s::ConML_Reboot_s() - { - } - -ConML_Reboot_s::~ConML_Reboot_s() - { - delete results; - } - -CXMLElement* ConML_Reboot_s::BeginElementL( - TUint8 aTag, const TXMLElementParams& /*aParams*/ ) - { - switch ( aTag ) - { - case EConMLResults: - CHECK_NO_DUPLICATE ( results ); - results = new ( ELeave ) ConML_Results_t(); - return results; - - default: - LOGGER_WRITE_1( "ConML_Reboot_s::BeginElementL()\ - : Unknown element %d ", aTag ); - User::Leave ( KWBXMLParserErrorInvalidTag ); - } - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// ConML_Task_s -// ----------------------------------------------------------------------------- -ConML_Task_s::ConML_Task_s() - { - } - -ConML_Task_s::~ConML_Task_s() - { - delete id; - delete install; - delete unInstall; - delete listInstalledApps; - delete listDataOwners; - delete setBurMode; - delete getDataSize; - delete requestData; - delete updateDeviceInfo; - delete listPublicFiles; - delete getDataOwnerStatus; - delete supplyData; - delete reboot; - delete getMetadata; - } - -CXMLElement* ConML_Task_s::BeginElementL( - TUint8 aTag, const TXMLElementParams& /*aParams*/ ) - { - switch ( aTag ) - { - case EConMLID: - CHECK_NO_DUPLICATE ( id ) - id = new ( ELeave ) pcdata_t(); - return id; - - case EConMLInstall: - CHECK_NO_DUPLICATE ( install ); - install = new ( ELeave ) ConML_Install_t(); - return install; - - case EConMLUnInstall: - CHECK_NO_DUPLICATE ( unInstall ); - unInstall = new ( ELeave ) ConML_UnInstall_t(); - return unInstall; - - case EConMLListInstalledApps: - CHECK_NO_DUPLICATE ( listInstalledApps ); - listInstalledApps = new ( ELeave ) ConML_ListInstalledApps_t(); - return listInstalledApps; - - case EConMLListDataOwners: - CHECK_NO_DUPLICATE ( listDataOwners ); - listDataOwners = new ( ELeave ) ConML_ListDataOwners_t(); - return listDataOwners; - - case EConMLSetBURMode: - CHECK_NO_DUPLICATE ( setBurMode ); - setBurMode = new ( ELeave ) ConML_SetBURMode_t(); - return setBurMode; - - case EConMLGetDataSize: - CHECK_NO_DUPLICATE ( getDataSize ); - getDataSize = new ( ELeave ) ConML_GetDataSize_t(); - return getDataSize; - - case EConMLRequestData: - CHECK_NO_DUPLICATE ( requestData ) - requestData = new ( ELeave ) ConML_RequestData_t(); - return requestData; - - case EConMLUpdateDeviceInfo: - CHECK_NO_DUPLICATE ( updateDeviceInfo ); - updateDeviceInfo = new ( ELeave ) ConML_UpdateDeviceInfo_t(); - return updateDeviceInfo; - - case EConMLListPublicFiles: - CHECK_NO_DUPLICATE ( listPublicFiles ); - listPublicFiles = new ( ELeave ) ConML_ListPublicFiles_t(); - return listPublicFiles; - - case EConMLGetDataOwnerStatus: - CHECK_NO_DUPLICATE ( getDataOwnerStatus ); - getDataOwnerStatus = new ( ELeave ) ConML_GetDataOwnerStatus_t(); - return getDataOwnerStatus; - - case EConMLSupplyData: - CHECK_NO_DUPLICATE ( supplyData ); - supplyData = new ( ELeave ) ConML_SupplyData_t(); - return supplyData; - - case EConMLReboot: - CHECK_NO_DUPLICATE ( reboot ); - reboot = new ( ELeave ) ConML_Reboot_t(); - return reboot; - case EConMLGetMetadata: - CHECK_NO_DUPLICATE ( getMetadata ); - getMetadata = new ( ELeave ) ConML_GetMetadata_t(); - return getMetadata; - - default: - LOGGER_WRITE_1( "ConML_Task_s::BeginElement()\ - : Unknown element %02x ", aTag ); - User::Leave( KWBXMLParserErrorInvalidTag ); - } - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// ConML_TaskList_s -// ----------------------------------------------------------------------------- -ConML_TaskList_s::ConML_TaskList_s() - { - } - -ConML_TaskList_s::~ConML_TaskList_s() - { - delete data; - delete next; - } - -// ----------------------------------------------------------------------------- -// ConML_Status_s -// ----------------------------------------------------------------------------- -ConML_Status_s::ConML_Status_s() - { - } - -ConML_Status_s::~ConML_Status_s() - { - delete task; - } - -CXMLElement* ConML_Status_s::BeginElementL( - TUint8 aTag, const TXMLElementParams& /*aParams*/ ) - { - switch ( aTag ) - { - case EConMLTask: - return AddTaskL( &task ); - - default: - LOGGER_WRITE_1( "ConML_Status_s::BeginElement()\ - : Unknown element %02x ", aTag ); - User::Leave( KWBXMLParserErrorInvalidTag ); - } - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// ConML_Cancel_s -// ----------------------------------------------------------------------------- -ConML_Cancel_s::ConML_Cancel_s() - { - } - -ConML_Cancel_s::~ConML_Cancel_s() - { - delete id; - delete all; - } - -CXMLElement* ConML_Cancel_s::BeginElementL( - TUint8 aTag, const TXMLElementParams& /*aParams*/ ) - { - switch ( aTag ) - { - case EConMLID: - CHECK_NO_DUPLICATE ( id ); - id = new ( ELeave ) pcdata_t(); - return id; - - case EConMLAll: - CHECK_NO_DUPLICATE ( all ); - all = new ( ELeave ) pcdata_t(); - return all; - - default: - LOGGER_WRITE_1( "ConML_Cancel_s::BeginElement()\ - : Unknown element %02x ", aTag ); - User::Leave( KWBXMLParserErrorInvalidTag ); - } - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// ConML_GetStatus_s -// ----------------------------------------------------------------------------- -ConML_GetStatus_s::ConML_GetStatus_s() - { - } - -ConML_GetStatus_s::~ConML_GetStatus_s() - { - delete id; - delete all; - } - -CXMLElement* ConML_GetStatus_s::BeginElementL( - TUint8 aTag, const TXMLElementParams& /*aParams*/ ) - { - switch ( aTag ) - { - case EConMLID: - CHECK_NO_DUPLICATE ( id ); - id = new ( ELeave ) pcdata_t(); - return id; - - case EConMLAll: - CHECK_NO_DUPLICATE ( all ); - all = new ( ELeave ) pcdata_t(); - return all; - - default: - LOGGER_WRITE_1( "ConML_GetStatus_s::BeginElement()\ - : Unknown element %02x ", aTag ); - User::Leave( KWBXMLParserErrorInvalidTag ); - } - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// ConML_SupplyData_s -// ----------------------------------------------------------------------------- -ConML_SupplyData_s::ConML_SupplyData_s() - { - } - -ConML_SupplyData_s::~ConML_SupplyData_s() - { - delete sid; - delete results; - } - -CXMLElement* ConML_SupplyData_s::BeginElementL( - TUint8 aTag, const TXMLElementParams& /*aParams*/ ) - { - switch ( aTag ) - { - case EConMLSID: - return AddSIDL ( &sid ); - - case EConMLResults: - results = new ( ELeave ) ConML_Results_t(); - return results; - - default: - LOGGER_WRITE_1( "ConML_SupplyData_s::BeginElement() :\ - Unknown element %02x ", aTag ); - User::Leave( KWBXMLParserErrorInvalidTag ); - } - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// ConML_Execute_ -// ----------------------------------------------------------------------------- -ConML_Execute_s::ConML_Execute_s() - { - } - -ConML_Execute_s::~ConML_Execute_s() - { - delete id; - delete install; - delete unInstall; - delete listInstalledApps; - delete listDataOwners; - delete setBurMode; - delete getDataSize; - delete requestData; - delete updateDeviceInfo; - delete listPublicFiles; - delete supplyData; - delete reboot; - delete getDataOwnerStatus; - delete getMetadata; - } - -CXMLElement* ConML_Execute_s::BeginElementL( - TUint8 aTag, const TXMLElementParams& /*aParams*/ ) - { - - switch ( aTag ) - { - case EConMLID: - CHECK_NO_DUPLICATE ( id ); - id = new ( ELeave ) pcdata_t(); - return id; - - case EConMLInstall: - CHECK_NO_DUPLICATE ( install ); - install = new ( ELeave ) ConML_Install_t(); - return install; - - case EConMLUpdateDeviceInfo: - CHECK_NO_DUPLICATE (updateDeviceInfo); - updateDeviceInfo = new ( ELeave ) ConML_UpdateDeviceInfo_t(); - return updateDeviceInfo; - - case EConMLUnInstall: - CHECK_NO_DUPLICATE ( unInstall ); - unInstall = new ( ELeave ) ConML_UnInstall_t(); - return unInstall; - - case EConMLListInstalledApps: - CHECK_NO_DUPLICATE ( listInstalledApps ); - listInstalledApps = new ( ELeave ) ConML_ListInstalledApps_t(); - return listInstalledApps; - - case EConMLListDataOwners: - CHECK_NO_DUPLICATE ( listDataOwners ); - listDataOwners = new ( ELeave ) ConML_ListDataOwners_t(); - return listDataOwners; - - case EConMLSetBURMode: - CHECK_NO_DUPLICATE ( setBurMode ); - setBurMode = new ( ELeave ) ConML_SetBURMode_t(); - return setBurMode; - - case EConMLGetDataSize: - CHECK_NO_DUPLICATE ( getDataSize ); - getDataSize = new ( ELeave ) ConML_GetDataSize_t(); - return getDataSize; - - case EConMLRequestData: - CHECK_NO_DUPLICATE ( requestData ); - requestData = new ( ELeave ) ConML_RequestData_t(); - return requestData; - - case EConMLListPublicFiles: - CHECK_NO_DUPLICATE ( listPublicFiles ); - listPublicFiles = new ( ELeave ) ConML_ListPublicFiles_t(); - return listPublicFiles; - - case EConMLSupplyData: - CHECK_NO_DUPLICATE ( supplyData ); - supplyData = new ( ELeave ) ConML_SupplyData_t(); - return supplyData; - - case EConMLReboot: - CHECK_NO_DUPLICATE ( reboot ); - reboot = new ( ELeave ) pcdata_t(); - return reboot; - - case EConMLGetDataOwnerStatus: - CHECK_NO_DUPLICATE ( getDataOwnerStatus ); - getDataOwnerStatus = new ( ELeave ) ConML_GetDataOwnerStatus_t(); - return getDataOwnerStatus; - - case EConMLGetMetadata: - CHECK_NO_DUPLICATE ( getMetadata ); - getMetadata = new ( ELeave ) ConML_GetMetadata_t(); - return getMetadata; - - default: - LOGGER_WRITE_1( "ConML_Execute_s::BeginElement()\ - : Unknown element %02x ", aTag ); - User::Leave( KWBXMLParserErrorInvalidTag ); - } - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// ConML_ConML_s -// ----------------------------------------------------------------------------- -ConML_ConML_s::ConML_ConML_s() - { - } - -ConML_ConML_s::~ConML_ConML_s() - { - delete execute; - delete getStatus; - delete cancel; - delete status; - } - -CXMLElement* ConML_ConML_s::BeginElementL( - TUint8 aTag, const TXMLElementParams& /*aParams*/ ) - { - switch( aTag ) - { - case EConMLExecute: - CHECK_NO_DUPLICATE( execute ); - execute = new (ELeave) ConML_Execute_t(); - return execute; - - case EConMLGetStatus: - CHECK_NO_DUPLICATE ( getStatus ); - getStatus = new ( ELeave) ConML_GetStatus_t(); - return getStatus; - - case EConMLCancel: - CHECK_NO_DUPLICATE ( cancel ); - cancel = new ( ELeave ) ConML_Cancel_t(); - return cancel; - - case EConMLStatus: - CHECK_NO_DUPLICATE ( status ) - status = new ( ELeave ) ConML_Status_t(); - return status; - - default: - LOGGER_WRITE_1( "ConML_ConML_s::BeginElement()\ - : Unknown element %02x ", aTag ); - User::Leave( KWBXMLParserErrorInvalidTag ); - } - return KErrNone; - } - -CXMLElement::TAction ConML_ConML_s::EndElementL( TAny* aCallbacks, TUint8 aTag ) - { - switch( aTag) - { - case EConML: - ((MWBXMLConMLCallback*) aCallbacks)->ConMLL(this); - return EPopAndDestroy; - - default: - return EPop; - } - } - -TBool ConML_ConML_s::NeedsCleanup() const - { - return ETrue; - } - - - - diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/wbxml/conmlhandler/src/sconconmlgenerator.cpp --- a/connectivitymodules/SeCon/wbxml/conmlhandler/src/sconconmlgenerator.cpp Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1285 +0,0 @@ -/* -* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: ConML parser/generator -* -*/ - -// ----------------------------------------------------------------------------- -// Includes -// ----------------------------------------------------------------------------- -#include "sconconmlgenerator.h" -#include "sconconmlhandlererror.h" -#include "sconconmldtd.h" -#include "sconxmlelement.h" -#include "debug.h" - -// ----------------------------------------------------------------------------- -// CSConConMLGenerator -// ----------------------------------------------------------------------------- -CSConConMLGenerator::CSConConMLGenerator() - { - } - -// ----------------------------------------------------------------------------- -// ~CSConConMLGenerator -// ----------------------------------------------------------------------------- -CSConConMLGenerator::~CSConConMLGenerator() - { - if (iCmdStack) - { - iCmdStack->Reset(); - delete iCmdStack; - iCmdStack = NULL; - } - - if ( iWBXMLWorkspace ) - { - delete iWBXMLWorkspace; - iWBXMLWorkspace = NULL; - } - - if ( iXMLWorkspace ) - { - delete iXMLWorkspace; - iXMLWorkspace = NULL; - } - - if (iCleanupStack) - { - iCleanupStack->ResetAndDestroy(); - delete iCleanupStack; - iCleanupStack = NULL; - } - - iElemStack.Close(); - } - -// ----------------------------------------------------------------------------- -// NewL -// ----------------------------------------------------------------------------- -CSConConMLGenerator* CSConConMLGenerator::NewL () - { - LOGGER_ENTERFN( "CSConConMLGenerator::NewL()" ); - CSConConMLGenerator* self = new ( ELeave ) CSConConMLGenerator(); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(); // self - LOGGER_LEAVEFN( "CSConConMLGenerator::NewL()" ); - return self; - } - -// ----------------------------------------------------------------------------- -// ConstructL -// ----------------------------------------------------------------------------- -void CSConConMLGenerator::ConstructL() - { - LOGGER_ENTERFN( "CSConConMLGenerator::ConstructL()" ); - iCmdStack = CXMLStack::NewL(); - iCleanupStack = CXMLStack::NewL(); - iWBXMLWorkspace = CXMLWorkspace::NewL(); - iXMLWorkspace = CXMLWorkspace::NewL(); - LOGGER_LEAVEFN( "CSConConMLGenerator::ConstructL()" ); - } - -// ----------------------------------------------------------------------------- -// SetCallbacks -// ----------------------------------------------------------------------------- -void CSConConMLGenerator::SetCallback ( MWBXMLConMLCallback* aCallback ) - { - LOGGER_ENTERFN( "CSConConMLGenerator::SetCallbacks()" ); - iCallback = aCallback; - LOGGER_LEAVEFN( "CSConConMLGenerator::SetCallbacks()" ); - } - -// ----------------------------------------------------------------------------- -// StartDocument -// ----------------------------------------------------------------------------- -void CSConConMLGenerator::StartDocument( - TUint8 /*aVersion*/, TInt32 /*aPublicId*/, TUint32 /*aCharset*/ ) - { - LOGGER_ENTERFN( "CSConConMLGenerator::StartDocumentL()" ); - iCmdStack->Reset(); - LOGGER_LEAVEFN( "CSConConMLGenerator::StartDocumentL()" ); - } - -// ----------------------------------------------------------------------------- -// StartDocument -// ----------------------------------------------------------------------------- -void CSConConMLGenerator::StartDocument( - TUint8 /*aVersion*/, const TDesC8& /*aPublicIdStr*/, TUint32 /*aCharset*/ ) - { - LOGGER_ENTERFN( "CSConConMLGenerator::StartDocumentL()" ); - iCmdStack->Reset(); - LOGGER_LEAVEFN( "CSConConMLGenerator::StartDocumentL()" ); - } - -// ----------------------------------------------------------------------------- -// StartElementL -// ----------------------------------------------------------------------------- -void CSConConMLGenerator::StartElementL( TWBXMLTag aTag ) - { - LOGGER_ENTERFN( "CSConConMLGenerator::StartElementL()" ); - if( iCmdStack->Top() != 0 ) - { - AddElement(iCmdStack->Top()->BeginElementL( - aTag, TXMLElementParams(iCallback, iCmdStack, iCleanupStack ) ) ); - } - else - { - if( aTag == EConML ) - { - AddElement(new (ELeave) ConML_ConML_t()); - } - else - { - LOGGER_WRITE( "CSConConMLGenerator::StartElementL() : Leave KWBXMLParserErrorInvalidTag" ); - User::Leave(KWBXMLParserErrorInvalidTag); - } - } - LOGGER_LEAVEFN( "CSConConMLGenerator::StartElementL()" ); - } - -// ----------------------------------------------------------------------------- -// AddElement -// ----------------------------------------------------------------------------- -void CSConConMLGenerator::AddElement( CXMLElement* aElement ) - { - LOGGER_ENTERFN( "CSConConMLGenerator::AddElement()" ); - if( aElement ) - { - iCmdStack->Push(aElement); - if( aElement->NeedsCleanup() ) - { - iCleanupStack->Push(aElement); - } - } - LOGGER_LEAVEFN( "CSConConMLGenerator::AddElement()" ); - } - -// ----------------------------------------------------------------------------- -// CharactersL -// ----------------------------------------------------------------------------- -void CSConConMLGenerator::CharactersL( const TDesC8& aBuffer ) - { - LOGGER_ENTERFN( "CSConConMLGenerator::CharactersL()" ); - if( iCmdStack->Top() != 0 ) - { - iCmdStack->Top()->SetDataL(aBuffer); - } - else - { - LOGGER_WRITE( "CSConConMLGenerator::CharactersL() : Leave KWBXMLParserErrorInvalidTag" ); - User::Leave(KWBXMLParserErrorInvalidTag); - } - LOGGER_LEAVEFN( "CSConConMLGenerator::CharactersL()" ); - } - -// ----------------------------------------------------------------------------- -// EndElementL -// ----------------------------------------------------------------------------- -void CSConConMLGenerator::EndElementL( TWBXMLTag aTag ) - { - LOGGER_ENTERFN( "CSConConMLGenerator::EndElementL()" ); - if( iCmdStack->Top() != 0 ) - { - CXMLElement::TAction action = iCmdStack->Top()->EndElementL( - iCallback, aTag ); - if( action != CXMLElement::ENone ) - { - CXMLElement* elem = iCmdStack->Pop(); - if( iCleanupStack->Top() == elem ) - { - iCleanupStack->Pop(); - } - if( action == CXMLElement::EPopAndDestroy ) - { - delete elem; - } - } - } - LOGGER_LEAVEFN( "CSConConMLGenerator::EndElementL()" ); - } - -// ----------------------------------------------------------------------------- -// WriteMUint32L -// ----------------------------------------------------------------------------- -void CSConConMLGenerator::WriteMUint32L( TUint32 aValue ) - { - LOGGER_ENTERFN( "CSConConMLGenerator::WriteMUint32L()" ); - TUint8 temp[5]; - TInt i(4); - - temp[i--] = TUint8(aValue & 0x7F); - aValue >>= 7; - while( aValue > 0 ) - { - temp[i--] = TUint8((aValue & 0x7F) | 0x80); - aValue >>= 7; - } - - while( i < 4 ) - { - iWBXMLWorkspace->WriteL(temp[++i]); - } - LOGGER_LEAVEFN( "CSConConMLGenerator::WriteMUint32L()" ); - } - -// ----------------------------------------------------------------------------- -// WriteOpaqueDataL -// ----------------------------------------------------------------------------- -void CSConConMLGenerator::WriteOpaqueDataL( const TDesC8& aData ) - { - LOGGER_ENTERFN( "CSConConMLGenerator::WriteOpaqueDataL()" ); - iWBXMLWorkspace->WriteL( OPAQUE ); - WriteMUint32L( aData.Size() ); - iWBXMLWorkspace->WriteL( aData ); - iXMLWorkspace->WriteL( aData ); - LOGGER_LEAVEFN( "CSConConMLGenerator::WriteOpaqueDataL()" ); - } - -// ----------------------------------------------------------------------------- -// WriteInlineStringL -// ----------------------------------------------------------------------------- -void CSConConMLGenerator::WriteInlineStringL( const TDesC8& aData ) - { - LOGGER_ENTERFN( "CSConConMLGenerator::WriteInlineStringL()" ); - iWBXMLWorkspace->WriteL( STR_I ); - iWBXMLWorkspace->WriteL( aData ); - iWBXMLWorkspace->WriteL( 0 ); - iXMLWorkspace->WriteL( aData ); - LOGGER_LEAVEFN( "CSConConMLGenerator::WriteInlineStringL()" ); - } - -// ----------------------------------------------------------------------------- -// IndentL -// ----------------------------------------------------------------------------- -void CSConConMLGenerator::IndentL() - { - LOGGER_ENTERFN( "CSConConMLGenerator::IndentL()" ); - for( TInt i = 0; i < iElemStack.Count() + iInitialIndentLevel; i++ ) - { - iXMLWorkspace->WriteL(KXMLIndent()); - } - LOGGER_LEAVEFN( "CSConConMLGenerator::IndentL()" ); - } - -// ----------------------------------------------------------------------------- -// TranslateElement -// ----------------------------------------------------------------------------- -TPtrC8 CSConConMLGenerator::TranslateElement( TUint8 aElement ) - { - LOGGER_ENTERFN( "CSConConMLGenerator::TranslateElement()" ); - TPtrC8 buf( KConMLElements ); - while( aElement-- ) - { - TInt pos = buf.Find(KXMLElemenentSeparator()); - if( pos == KErrNotFound ) - { - return TPtrC8(); - } - buf.Set(buf.Right(buf.Length() - pos - 1)); - } - - TInt pos = buf.Find(KXMLElemenentSeparator()); - - if( pos != KErrNotFound ) - { - buf.Set(buf.Left(pos)); - } - LOGGER_LEAVEFN( "CSConConMLGenerator::TranslateElement()" ); - return buf; - } - -// ----------------------------------------------------------------------------- -// EndDocument -// ----------------------------------------------------------------------------- -void CSConConMLGenerator::EndDocument() - { - LOGGER_ENTERFN( "CSConConMLGenerator::EndDocument()" ); - LOGGER_LEAVEFN( "CSConConMLGenerator::EndDocument()" ); - } - - -// ----------------------------------------------------------------------------- -// GenerateConMLDocument -// ----------------------------------------------------------------------------- -TInt CSConConMLGenerator::GenerateConMLDocument ( ConML_ConMLPtr_t aContent ) - { - LOGGER_ENTERFN( "CSConConMLGenerator::GenerateConMLDocument()" ); - iWBXMLWorkspace->Reset(); - iWBXMLWorkspace->BeginTransaction(); - iXMLWorkspace->Reset(); - iXMLWorkspace->BeginTransaction(); - TRAPD(result, AppendConMLL(aContent)); - LOGGER_WRITE_1( "CSConConMLGenerator::GenerateConMLDocument()\ - : returned %d", result ); - return HandleResult(result); - } - -// ----------------------------------------------------------------------------- -// AppendConMLL -// ----------------------------------------------------------------------------- -void CSConConMLGenerator::AppendConMLL( ConML_ConMLPtr_t aContent ) - { - LOGGER_ENTERFN( "CSConConMLGenerator::AppendConMLL()" ); - BeginDocumentL(KSConConMLVersion, KSConConMLPublicId, KSConConMLUTF8); - BeginElementL(EConML, ETrue); - AppendExecuteL( aContent->execute ); - AppendGetStatusL( aContent->getStatus ); - AppendCancelL( aContent->cancel ); - AppendStatusL( aContent->status ); - EndElementL(); // EConML - LOGGER_LEAVEFN( "CSConConMLGenerator::AppendConMLL()" ); - } - -// ----------------------------------------------------------------------------- -// AppendExecuteL -// ----------------------------------------------------------------------------- -void CSConConMLGenerator::AppendExecuteL( ConML_ExecutePtr_t aContent ) - { - LOGGER_ENTERFN( "CSConConMLGenerator::AppendExecuteL()" ); - if ( aContent ) - { - BeginElementL( EConMLExecute, ETrue ); - AppendPCDataL( EConMLID, aContent->id ); - AppendInstallL( aContent->install ); - AppendUnInstallL( aContent->unInstall ); - AppendListInstalledAppsL( aContent->listInstalledApps ); - AppendListDataOwnersL( aContent->listDataOwners ); - AppendSetBURModeL( aContent->setBurMode ); - AppendGetDataSizeL( aContent->getDataSize ); - AppendRequestDataL( aContent->requestData ); - AppendUpdateDeviceInfoL( aContent->updateDeviceInfo ); - AppendListPublicFilesL( aContent->listPublicFiles ); - AppendSupplyDataL( aContent->supplyData ); - AppendGetDataOwnerStatusL( aContent->getDataOwnerStatus ); - AppendGetMetadataL( aContent->getMetadata ); - - if ( aContent->reboot ) - { - BeginElementL( EConMLReboot ); - } - EndElementL(); // EConMLExecute - } - LOGGER_LEAVEFN( "CSConConMLGenerator::AppendExecuteL()" ); - } - -// ----------------------------------------------------------------------------- -// AppendSupplyDataL -// ----------------------------------------------------------------------------- -void CSConConMLGenerator::AppendSupplyDataL( ConML_SupplyDataPtr_t aContent ) - { - LOGGER_ENTERFN( "CSConConMLGenerator::AppendSupplyDataL()" ); - if ( aContent ) - { - BeginElementL( EConMLSupplyData, ETrue ); - AppendSIDListL( aContent->sid ); - AppendResultsL( aContent->results ); - EndElementL(); // EConMLSupplyData - } - LOGGER_LEAVEFN( "CSConConMLGenerator::AppendSupplyDataL()" ); - } -// ----------------------------------------------------------------------------- -// AppendInstallL -// ----------------------------------------------------------------------------- -void CSConConMLGenerator::AppendInstallL( ConML_InstallPtr_t aContent ) - { - LOGGER_ENTERFN( "CSConConMLGenerator::AppendInstallL()" ); - if ( aContent) - { - BeginElementL( EConMLInstall, ETrue ); - AppendPCDataL( EConMLName, aContent->name ); - if ( aContent->instParams) - { - if ( aContent->instParams->param ) - { - AppendInstParamsL( aContent->instParams ); - } - else - { - BeginElementL( EConMLInstParams ); - } - } - AppendResultsL( aContent->results ); - EndElementL(); // EConMLInstall - } - LOGGER_LEAVEFN( "CSConConMLGenerator::AppendInstallL()" ); - } - -// ----------------------------------------------------------------------------- -// AppendCancelL -// ----------------------------------------------------------------------------- -void CSConConMLGenerator::AppendCancelL ( ConML_CancelPtr_t aContent ) - { - LOGGER_ENTERFN( "CSConConMLGenerator::AppendCancelL()" ); - if ( aContent ) - { - BeginElementL( EConMLCancel, ETrue ); - AppendPCDataL ( EConMLID, aContent->id ); - AppendPCDataL( EConMLAll, aContent->all); - EndElementL(); // EConMLCancel - } - LOGGER_LEAVEFN( "CSConConMLGenerator::AppendCancelL()" ); - } - -// ----------------------------------------------------------------------------- -// AppendStatusL -// ----------------------------------------------------------------------------- -void CSConConMLGenerator::AppendStatusL ( ConML_StatusPtr_t aContent ) - { - LOGGER_ENTERFN( "CSConConMLGenerator::AppendStatusL()" ); - if ( aContent ) - { - if ( aContent->task ) - { - BeginElementL( EConMLStatus, ETrue ); - AppendTaskListL( aContent->task ); - EndElementL(); // EConMLStatus - } - else - { - BeginElementL( EConMLStatus ); - } - } - LOGGER_LEAVEFN( "CSConConMLGenerator::AppendStatusL()" ); - } - -// ----------------------------------------------------------------------------- -// AppendGetStatusL -// ----------------------------------------------------------------------------- -void CSConConMLGenerator::AppendGetStatusL( ConML_GetStatusPtr_t aContent ) - { - LOGGER_ENTERFN( "CSConConMLGenerator::AppendGetStatusL()" ); - if ( aContent ) - { - BeginElementL( EConMLGetStatus, ETrue ); - AppendPCDataL( EConMLID, aContent->id); - if ( aContent->all ) - { - BeginElementL( EConMLAll ); - } - EndElementL(); // EConMLGetStatus - } - LOGGER_ENTERFN( "CSConConMLGenerator::AppendGetStatusL()" ); - } - -// ----------------------------------------------------------------------------- -// AppendRebootL -// ----------------------------------------------------------------------------- -void CSConConMLGenerator::AppendRebootL( ConML_RebootPtr_t aContent ) - { - if ( aContent ) - { - BeginElementL( EConMLReboot, ETrue ); - AppendResultsL( aContent->results ); - EndElementL(); // EConMLReboot - } - } - -// ----------------------------------------------------------------------------- -// AppendTaskL -// ----------------------------------------------------------------------------- -void CSConConMLGenerator::AppendTaskL( ConML_TaskPtr_t aContent ) - { - LOGGER_ENTERFN( "CSConConMLGenerator::AppendTaskL()" ); - if ( aContent ) - { - BeginElementL( EConMLTask, ETrue ); - AppendPCDataL( EConMLID, aContent->id ); - AppendInstallL(aContent->install ); - AppendUnInstallL( aContent->unInstall ); - AppendListInstalledAppsL ( aContent->listInstalledApps ); - AppendListDataOwnersL ( aContent->listDataOwners ); - AppendSetBURModeL ( aContent->setBurMode ); - AppendGetDataSizeL ( aContent->getDataSize ); - AppendRequestDataL ( aContent->requestData ); - AppendUpdateDeviceInfoL ( aContent->updateDeviceInfo); - AppendListPublicFilesL ( aContent->listPublicFiles ); - AppendGetDataOwnerStatusL( aContent->getDataOwnerStatus ); - AppendSupplyDataL( aContent->supplyData ); - AppendRebootL( aContent->reboot ); - AppendGetMetadataL( aContent->getMetadata ); - EndElementL(); - } - LOGGER_LEAVEFN( "CSConConMLGenerator::AppendTaskL()" ); - } - -// ----------------------------------------------------------------------------- -// AppendTaskListL -// ----------------------------------------------------------------------------- -void CSConConMLGenerator::AppendTaskListL( ConML_TaskListPtr_t aContent ) - { - LOGGER_ENTERFN( "CSConConMLGenerator::AppendTaskListL()" ); - for ( ConML_TaskListPtr_t p = aContent; p && p->data; p=p->next ) - { - AppendTaskL( p->data ); - } - LOGGER_LEAVEFN( "CSConConMLGenerator::AppendTaskListL()" ); - } - -// ----------------------------------------------------------------------------- -// AppendListInstalledAppsL -// ----------------------------------------------------------------------------- -void CSConConMLGenerator::AppendListInstalledAppsL ( - ConML_ListInstalledAppsPtr_t aContent ) - { - LOGGER_ENTERFN( "CSConConMLGenerator::AppendListInstalledAppsL()" ); - if ( aContent ) - { - BeginElementL( EConMLListInstalledApps, ETrue ); - AppendDrivesL( aContent->drives ); - if ( aContent ->all ) - { - BeginElementL( EConMLAll ); - } - AppendResultsL( aContent->results ); - EndElementL(); // EConMLListInstalledApps - } - LOGGER_LEAVEFN( "CSConConMLGenerator::AppendListInstalledAppsL()" ); - } - -// ----------------------------------------------------------------------------- -// AppendListDataOwnersL -// ----------------------------------------------------------------------------- -void CSConConMLGenerator::AppendListDataOwnersL ( - ConML_ListDataOwnersPtr_t aContent ) - { - LOGGER_ENTERFN( "CSConConMLGenerator::AppendListDataOwnersL()" ); - if ( aContent ) - { - if ( aContent->results ) - { - BeginElementL( EConMLListDataOwners, ETrue ); - AppendResultsL( aContent->results ); - EndElementL(); // EConMLListDataOwners - } - else - { - BeginElementL( EConMLListDataOwners ); - } - } - LOGGER_LEAVEFN( "CSConConMLGenerator::AppendListDataOwnersL()" ); - } - -// ----------------------------------------------------------------------------- -// CSConConMLGanerator::AppendBUROptionsL -// ----------------------------------------------------------------------------- -void CSConConMLGenerator::AppendBUROptionsL( ConML_BUROptionsPtr_t aContent ) - { - LOGGER_ENTERFN( "CSConConMLGenerator::AppendBUROptionsL()" ); - if ( aContent ) - { - BeginElementL( EConMLBUROptions, ETrue ); - if ( aContent->requiresReboot ) - { - BeginElementL( EConMLRequiresReboot ); - } - if ( aContent->hasFiles ) - { - AppendPCDataL( EConMLHasFiles, aContent->hasFiles ); - } - if ( aContent->supportsInc ) - { - BeginElementL( EConMLSupportsInc ); - } - if ( aContent->delayToPrepareData ) - { - BeginElementL( EConMLDelayToPrepareData ); - } - EndElementL(); // EConMLBUROptions - } - LOGGER_LEAVEFN( "CSConConMLGenerator::AppendBUROptionsL()" ); - } - -// ----------------------------------------------------------------------------- -// AppendSetBURModeL -// ----------------------------------------------------------------------------- -void CSConConMLGenerator::AppendSetBURModeL( ConML_SetBURModePtr_t aContent ) - { - LOGGER_ENTERFN( "CSConConMLGenerator::AppendSetBURModeL()" ); - if ( aContent ) - { - BeginElementL( EConMLSetBURMode, ETrue ); - AppendDrivesL( aContent->drives ); - AppendPCDataL( EConMLPartialType, aContent->partialType ); - AppendPCDataL( EConMLIncType, aContent->incType ); - AppendResultsL( aContent->results ); - EndElementL(); //EConMLSetBURMode - } - LOGGER_LEAVEFN( "CSConConMLGenerator::AppendSetBURModeL()" ); - } - -// ----------------------------------------------------------------------------- -// AppendUnInstallL -// ----------------------------------------------------------------------------- -void CSConConMLGenerator::AppendUnInstallL( ConML_UnInstallPtr_t aContent ) - { - LOGGER_ENTERFN( "CSConConMLGenerator::AppendUnInstallL()" ); - if ( aContent ) - { - BeginElementL( EConMLUnInstall, ETrue ); - AppendApplicationsL( aContent->applications ); - AppendInstParamsL( aContent->instParams ); - AppendResultsL( aContent->results ); - EndElementL(); // EConMLUnInstall - } - LOGGER_LEAVEFN( "CSConConMLGenerator::AppendUnInstallL()" ); - } - -// ----------------------------------------------------------------------------- -// AppendGetDataSizeL -// ----------------------------------------------------------------------------- -void CSConConMLGenerator::AppendGetDataSizeL( ConML_GetDataSizePtr_t aContent ) - { - LOGGER_ENTERFN( "CSConConMLGenerator::AppendGetDataSizeL()" ); - if ( aContent ) - { - BeginElementL( EConMLGetDataSize, ETrue ); - AppendDataOwnersL( aContent->dataOwners ); - AppendResultsL( aContent->results ); - EndElementL(); //EConMLGetDataSize - } - LOGGER_LEAVEFN( "CSConConMLGenerator::AppendGetDataSizeL()" ); - } - -// ----------------------------------------------------------------------------- -// AppendRequestDataL -// ----------------------------------------------------------------------------- -void CSConConMLGenerator::AppendRequestDataL( ConML_RequestDataPtr_t aContent ) - { - LOGGER_ENTERFN( "CSConConMLGenerator::AppendRequestDataL()" ); - if ( aContent ) - { - BeginElementL( EConMLRequestData, ETrue ); - AppendSIDListL( aContent->sid ); - AppendResultsL( aContent->results ); - EndElementL();//EConMLRequestData - } - LOGGER_LEAVEFN( "CSConConMLGenerator::AppendRequestDataL()" ); - } - -// ----------------------------------------------------------------------------- -// AppendUpdateDeviceInfoL -// ----------------------------------------------------------------------------- -void CSConConMLGenerator::AppendUpdateDeviceInfoL( - ConML_UpdateDeviceInfoPtr_t aContent ) - { - LOGGER_ENTERFN( "CSConConMLGenerator::AppendUpdateDeviceInfoL()" ); - if ( aContent ) - { - BeginElementL(EConMLUpdateDeviceInfo, ETrue); - AppendDeviceInfoL( aContent-> deviceInfo ); - AppendResultsL( aContent->results ); - EndElementL();// EConMLUpdateDeviceInfo - } - LOGGER_LEAVEFN( "CSConConMLGenerator::AppendUpdateDeviceInfoL()" ); - } - -// ----------------------------------------------------------------------------- -// AppendListPublicFilesL -// ----------------------------------------------------------------------------- -void CSConConMLGenerator::AppendListPublicFilesL( - ConML_ListPublicFilesPtr_t aContent ) - { - LOGGER_ENTERFN( "CSConConMLGenerator::AppendListPublicFilesL()" ); - if ( aContent ) - { - BeginElementL( EConMLListPublicFiles, ETrue ); - AppendSIDListL ( aContent->sid ); - AppendResultsL( aContent->results ); - EndElementL(); // EConMLListPublicFiles - } - LOGGER_LEAVEFN( "CSConConMLGenerator::AppendListPublicFilesL()" ); - } - -// ----------------------------------------------------------------------------- -// AppendApplicationL -// ----------------------------------------------------------------------------- -void CSConConMLGenerator::AppendApplicationL( ConML_ApplicationPtr_t aContent ) - { - LOGGER_ENTERFN( "CSConConMLGenerator::AppendApplicationL()" ); - if ( aContent ) - { - BeginElementL(EConMLApplication, ETrue ); - AppendPCDataL( EConMLName, aContent->name ); - AppendPCDataL( EConMLUID, aContent->uid ); - EndElementL(); //EConMLApplication - } - LOGGER_LEAVEFN( "CSConConMLGenerator::AppendApplicationL()" ); - } - -// ----------------------------------------------------------------------------- -// AppendApplicationListL -// ----------------------------------------------------------------------------- -void CSConConMLGenerator::AppendApplicationListL( - ConML_ApplicationListPtr_t aContent ) - { - LOGGER_ENTERFN( "CSConConMLGenerator::AppendApplicationListL()" ); - for ( ConML_ApplicationListPtr_t p = aContent; p && p->data; p = p->next ) - { - AppendApplicationL( p->data ); - } - LOGGER_LEAVEFN( "CSConConMLGenerator::AppendApplicationListL()" ); - } - -// ----------------------------------------------------------------------------- -// AppendApplicationsL -// ----------------------------------------------------------------------------- -void CSConConMLGenerator::AppendApplicationsL( - ConML_ApplicationsPtr_t aContent ) - { - LOGGER_ENTERFN( "CSConConMLGenerator::AppendApplicationsL()" ); - if ( aContent ) - { - BeginElementL( EConMLApplications, ETrue ); - AppendApplicationListL( aContent->application ); - EndElementL(); // EConMLApplications - } - LOGGER_LEAVEFN( "CSConConMLGenerator::AppendApplicationsL()" ); - } - -// ----------------------------------------------------------------------------- -// AppendParamL -// ----------------------------------------------------------------------------- -void CSConConMLGenerator::AppendParamL( ConML_ParamPtr_t aContent ) - { - LOGGER_ENTERFN( "CSConConMLGenerator::AppendParamL()" ); - if ( aContent ) - { - BeginElementL( EConMLParam, ETrue ); - AppendPCDataL( EConMLName, aContent->name ); - AppendPCDataL( EConMLValue, aContent->value ); - EndElementL(); // EConMLParam - } - LOGGER_LEAVEFN( "CSConConMLGenerator::AppendParamL()" ); - } - -// ----------------------------------------------------------------------------- -// AppendParamListL -// ----------------------------------------------------------------------------- -void CSConConMLGenerator::AppendParamListL( ConML_ParamListPtr_t aContent ) - { - LOGGER_ENTERFN( "CSConConMLGenerator::AppendParamListL()" ); - for ( ConML_ParamListPtr_t p = aContent; p && p->data; p = p->next ) - { - AppendParamL( p-> data ); - } - LOGGER_LEAVEFN( "CSConConMLGenerator::AppendParamListL()" ); - } - -// ----------------------------------------------------------------------------- -// AppendInstParamsL -// ----------------------------------------------------------------------------- -void CSConConMLGenerator::AppendInstParamsL( ConML_InstParamsPtr_t aContent ) - { - LOGGER_ENTERFN( "CSConConMLGenerator::AppendInstParamsLionsL()" ); - if ( aContent ) - { - BeginElementL( EConMLInstParams, ETrue ); - AppendParamListL( aContent->param ); - EndElementL(); //EConMLInstParams - } - LOGGER_LEAVEFN( "CSConConMLGenerator::AppendInstParamsL()" ); - } - -// ----------------------------------------------------------------------------- -// AppendProgressL -// ----------------------------------------------------------------------------- -void CSConConMLGenerator::AppendProgressL( ConML_ProgressPtr_t aContent ) - { - LOGGER_ENTERFN( "CSConConMLGenerator::AppendProgressL()" ); - if ( aContent ) - { - BeginElementL( EConMLProgress, ETrue ); - AppendPCDataL( EConMLValue, aContent->value ); - EndElementL(); // EconMLProgress - } - LOGGER_LEAVEFN( "CSConConMLGenerator::AppendProgressL()" ); - } - -// ----------------------------------------------------------------------------- -// AppendResultsL -// ----------------------------------------------------------------------------- -void CSConConMLGenerator::AppendResultsL( ConML_ResultsPtr_t aContent ) - { - LOGGER_ENTERFN( "CSConConMLGenerator::AppendResultsL()" ); - if ( aContent ) - { - BeginElementL( EConMLResults, ETrue ); - if ( aContent->complete ) - { - BeginElementL( EConMLComplete ); - } - AppendProgressL( aContent->progress ); - AppendApplicationsL( aContent->applications ); - AppendDataOwnersL( aContent->dataOwners ); - if ( aContent->filename ) - { - AppendPCDataL( EConMLFilename, aContent->filename ); - } - AppendPCDataL( EConMLData, aContent->data ); - if ( aContent->moreData ) - { - BeginElementL( EConMLMoreData ); - } - AppendDeviceInfoL( aContent->deviceInfo ); - AppendFilesL( aContent->files ); - EndElementL(); //EConMLResults - } - LOGGER_LEAVEFN( "CSConConMLGenerator::AppendResultsL()" ); - } - -// ----------------------------------------------------------------------------- -// AppendDriveL -// ----------------------------------------------------------------------------- -void CSConConMLGenerator::AppendDriveL( ConML_DrivePtr_t aContent ) - { - LOGGER_ENTERFN( "CSConConMLGenerator::AppendDriveL()" ); - if ( aContent ) - { - BeginElementL( EConMLDrive, ETrue ); - AppendPCDataL( EConMLName, aContent->name ); - EndElementL(); //EConMLDrive - } - LOGGER_LEAVEFN( "CSConConMLGenerator::AppendDriveL()" ); - } - -// ----------------------------------------------------------------------------- -// AppendDriveListL -// ----------------------------------------------------------------------------- -void CSConConMLGenerator::AppendDriveListL( ConML_DriveListPtr_t aContent ) - { - LOGGER_ENTERFN( "CSConConMLGenerator::AppendDriveListL()" ); - for ( ConML_DriveListPtr_t p = aContent; p && p->data; p=p->next ) - { - AppendDriveL( p->data ); - } - LOGGER_LEAVEFN( "CSConConMLGenerator::AppendDriveListL()" ); - } - -// ----------------------------------------------------------------------------- -// AppendDrivesL -// ----------------------------------------------------------------------------- -void CSConConMLGenerator::AppendDrivesL( ConML_DrivesPtr_t aContent ) - { - LOGGER_ENTERFN( "CSConConMLGenerator::AppendDrivesL()" ); - if ( aContent ) - { - BeginElementL( EConMLDrives, ETrue ); - AppendDriveListL( aContent->drive ); - EndElementL(); // EConMLDrives - } - LOGGER_LEAVEFN( "CSConConMLGenerator::AppendDrivesL()" ); - } - -// ----------------------------------------------------------------------------- -// AppendDataOwnersL -// ----------------------------------------------------------------------------- -void CSConConMLGenerator::AppendDataOwnersL( ConML_DataOwnersPtr_t aContent ) - { - LOGGER_ENTERFN( "CSConConMLGenerator::AppendDataOwnersL()" ); - if ( aContent ) - { - BeginElementL( EConMLDataOwners, ETrue ); - AppendSIDListL( aContent->sid ); - EndElementL(); //EConMLDataOwners - } - LOGGER_LEAVEFN( "CSConConMLGenerator::AppendDataOwnersL()" ); - } - -// ----------------------------------------------------------------------------- -// AppendGetDataOwnerStatusL -// ----------------------------------------------------------------------------- -void CSConConMLGenerator::AppendGetDataOwnerStatusL - ( ConML_GetDataOwnerStatusPtr_t aContent ) - { - LOGGER_ENTERFN( "CSConConMLGenerator::AppendDataOwnerStatusL()" ); - if ( aContent) - { - BeginElementL( EConMLGetDataOwnerStatus, ETrue ); - AppendDataOwnersL( aContent->dataOwners ); - AppendResultsL( aContent->results ); - EndElementL(); // EconMLGetDataOwnerStatus - } - LOGGER_ENTERFN( "CSConConMLGenerator::AppendDataOwnerStatusL()" ); - } - -// ----------------------------------------------------------------------------- -// AppendGetMetadataL -// ----------------------------------------------------------------------------- -void CSConConMLGenerator::AppendGetMetadataL - ( ConML_GetMetadataPtr_t aContent ) - { - LOGGER_ENTERFN( "CSConConMLGenerator::AppendGetMetadataL()" ); - if ( aContent) - { - BeginElementL( EConMLGetMetadata, ETrue ); - AppendPCDataL( EConMLFilename, aContent->filename ); - AppendResultsL( aContent->results ); - EndElementL(); // EConMLGetMetadata - } - LOGGER_ENTERFN( "CSConConMLGenerator::AppendGetMetadataL()" ); - } - -// ----------------------------------------------------------------------------- -// AppendPackageInfoL -// ----------------------------------------------------------------------------- -void CSConConMLGenerator::AppendPackageInfoL ( ConML_PackageInfoPtr_t aContent ) - { - if ( aContent ) - { - BeginElementL( EConMLPackageInfo, ETrue ); - AppendPCDataL( EConMLName, aContent->name ); - EndElementL(); // EConMLPackageInfo - } - } - -// ----------------------------------------------------------------------------- -// AppendSIDL -// ----------------------------------------------------------------------------- -void CSConConMLGenerator::AppendSIDL( ConML_SIDPtr_t aContent ) - { - LOGGER_ENTERFN( "CSConConMLGenerator::AppendSIDL()" ); - if ( aContent ) - { - BeginElementL( EConMLSID, ETrue ); - AppendPCDataL( EConMLType, aContent->type ); - AppendPCDataL( EConMLUID, aContent->uid ); - AppendPCDataL( EConMLDataOwnerStatus, aContent->dataOwnerStatus ); - AppendDrivesL( aContent->drives ); - if ( aContent->size ) - { - AppendPCDataL( EConMLSize, aContent->size ); - } - AppendPackageInfoL( aContent->packageInfo ); - AppendBUROptionsL( aContent->burOptions ); - AppendPCDataL( EConMLTransferDataType, aContent->transferDataType ); - AppendPCDataL( EConMLData, aContent->data ); - if ( aContent->moreData) - { - BeginElementL(EConMLMoreData ); - } - EndElementL(); // EconMLSID - } - LOGGER_LEAVEFN( "CSConConMLGenerator::AppendSIDL()" ); - } - -// ----------------------------------------------------------------------------- -// AppendSIDListL -// ----------------------------------------------------------------------------- -void CSConConMLGenerator::AppendSIDListL( ConML_SIDListPtr_t aContent ) - { - LOGGER_LEAVEFN( "CSConConMLGenerator::AppendSIDListL()" ); - for ( ConML_SIDListPtr_t p = aContent; p && p->data; p=p->next ) - { - AppendSIDL( p->data ); - } - LOGGER_LEAVEFN( "CSConConMLGenerator::AppendSIDListL()" ); - } - -// ----------------------------------------------------------------------------- -// AppendDeviceInfoL -// ----------------------------------------------------------------------------- -void CSConConMLGenerator::AppendDeviceInfoL( ConML_DeviceInfoPtr_t aContent ) - { - LOGGER_ENTERFN( "CSConConMLGenerator::AppendDeviceInfoL()" ); - if ( aContent ) - { - BeginElementL( EConMLDeviceInfo, ETrue ); - AppendPCDataL( EConMLVersion, aContent->version ); - AppendSupportedMethodsL ( aContent->supportedMethods ); - AppendPCDataL(EConMLMaxObjectSize, aContent->maxObjectSize ); - EndElementL(); // EConMLDeviceInfo - } - LOGGER_LEAVEFN( "CSConConMLGenerator::AppendDeviceInfoL()" ); - } - -// ----------------------------------------------------------------------------- -// AppendFilesL -// ----------------------------------------------------------------------------- -void CSConConMLGenerator::AppendFilesL( ConML_FilesPtr_t aContent ) - { - LOGGER_ENTERFN( "CSConConMLGenerator::AppendFilesL()" ); - if ( aContent ) - { - BeginElementL( EConMLFiles, ETrue ); - AppendFileListL( aContent->file ); - EndElementL(); // EConMLFiles - } - LOGGER_LEAVEFN( "CSConConMLGenerator::AppendFilesL()" ); - } - -// ----------------------------------------------------------------------------- -// AppendSupportedMethodsL -// ----------------------------------------------------------------------------- -void CSConConMLGenerator::AppendSupportedMethodsL - ( ConML_SupportedMethodsPtr_t aContent ) - { - LOGGER_ENTERFN( "CSConConMLGenerator::AppendSupportedMethodsL()" ); - if ( aContent ) - { - BeginElementL( EConMLSupportedMethods, ETrue ); - if ( aContent->install ) - { - BeginElementL( EConMLInstall ); - } - if ( aContent->unInstall ) - { - BeginElementL( EConMLUnInstall ); - } - if ( aContent->listInstalledApps ) - { - BeginElementL( EConMLListInstalledApps ); - } - if ( aContent->listDataOwners ) - { - BeginElementL( EConMLListDataOwners ); - } - if ( aContent->setBurMode ) - { - BeginElementL( EConMLSetBURMode ); - } - if ( aContent->getDataSize ) - { - BeginElementL( EConMLGetDataSize ); - } - if ( aContent->requestData ) - { - BeginElementL( EConMLRequestData ); - } - if ( aContent->supplyData ) - { - BeginElementL( EConMLSupplyData ); - } - if ( aContent->reboot ) - { - BeginElementL( EConMLReboot ); - } - EndElementL(); // EConMLSupportedMethods - } - LOGGER_LEAVEFN( "CSConConMLGenerator::AppendSupportedMethodsL()" ); - } - -// ----------------------------------------------------------------------------- -// AppendFileListL -// ----------------------------------------------------------------------------- -void CSConConMLGenerator::AppendFileListL( ConML_FileListPtr_t aContent ) - { - LOGGER_ENTERFN( "CSConConMLGenerator::AppendFileListL()" ); - if ( aContent ) - { - for ( ConML_FileListPtr_t p = aContent; p && p->data; p = p->next ) - { - AppendFileL(p->data ); - } - } - LOGGER_LEAVEFN( "CSConConMLGenerator::AppendFileListL()" ); - } - -// ----------------------------------------------------------------------------- -// AppendFileL -// ----------------------------------------------------------------------------- -void CSConConMLGenerator::AppendFileL( ConML_FilePtr_t aContent ) - { - LOGGER_ENTERFN( "CSConConMLGenerator::AppendFileL()" ); - if ( aContent ) - { - BeginElementL( EConMLFile, ETrue ); - AppendPCDataL( EConMLName, aContent->name ); - AppendPCDataL( EConMLModified, aContent->modified ); - AppendPCDataL( EConMLSize, aContent->size ); - AppendPCDataL( EConMLUserPerm, aContent->userPerm ); - EndElementL(); // EConMLFile - } - LOGGER_LEAVEFN( "CSConConMLGenerator::AppendFileL()" ); - } - -// ----------------------------------------------------------------------------- -// HandleResult -// ----------------------------------------------------------------------------- -TInt CSConConMLGenerator::HandleResult( TInt aResult, TInt aTreshold ) - { - LOGGER_ENTERFN( "CSConConMLGenerator::HandleResult()" ); - switch( aResult ) - { - case KErrNone: - if( iWBXMLWorkspace->FreeSize() < aTreshold ) - { - iWBXMLWorkspace->Rollback(); - return KWBXMLGeneratorBufferFull; - } - iWBXMLWorkspace->Commit(); - return KWBXMLGeneratorOk; - - case KErrTooBig: - iWBXMLWorkspace->Rollback(); - return KWBXMLGeneratorBufferFull; - } - LOGGER_WRITE_1( "CSConConMLGenerator::HandleResult()\ - : returned %d", aResult); - return aResult; - } - -// ----------------------------------------------------------------------------- -// BeginDocumentL -// ----------------------------------------------------------------------------- -void CSConConMLGenerator::BeginDocumentL( - TUint8 aVersion, - TInt32 aPublicId, - TUint32 aCharset, - const TDesC8& aStringTbl ) - { - LOGGER_ENTERFN( "CSConConMLGenerator::BeginDocumentL()" ); - iWBXMLWorkspace->WriteL(aVersion); - - if( aPublicId <= 0 ) - { - iWBXMLWorkspace->WriteL(0); - WriteMUint32L(-aPublicId); - } - else - { - WriteMUint32L(aPublicId); - } - WriteMUint32L(aCharset); - WriteMUint32L(aStringTbl.Size()); - iWBXMLWorkspace->WriteL(aStringTbl); - LOGGER_LEAVEFN( "CSConConMLGenerator::BeginDocumentL()" ); - } - -// ----------------------------------------------------------------------------- -// BeginElementL -// ----------------------------------------------------------------------------- -void CSConConMLGenerator::BeginElementL( - TUint8 aElement, TBool aHasContent, TBool aHasAttributes ) - { - LOGGER_ENTERFN( "CSConConMLGenerator::BeginElementL()" ); - IndentL(); - iXMLWorkspace->WriteL(KXMLTagStart()); - iXMLWorkspace->WriteL(TranslateElement(aElement)); - - if( aHasAttributes ) - { - aElement |= KWBXMLHasAttributes; - } - - if( aHasContent ) - { - iXMLWorkspace->WriteL(KXMLTagEnd()); - iElemStack.Insert(aElement, 0); - aElement |= KWBXMLHasContent; - } - else - { - iXMLWorkspace->WriteL(KXMLTagEndNoContent()); - } - - if( !iDontNewLine ) - { - iXMLWorkspace->WriteL(KXMLNewLine()); - } - iDontNewLine = EFalse; - - WriteMUint32L(aElement); - LOGGER_LEAVEFN( "CSConConMLGenerator::BeginElementL()" ); - } - -// ----------------------------------------------------------------------------- -// EndElementL -// ----------------------------------------------------------------------------- -void CSConConMLGenerator::EndElementL() - { - LOGGER_ENTERFN( "CSConConMLGenerator::EndElementL()" ); - TUint8 elem = iElemStack[0]; - iElemStack.Remove(0); - if( !iDontIndent ) - { - IndentL(); - } - iDontIndent = EFalse; - iXMLWorkspace->WriteL(KXMLTagStartEndTag()); - iXMLWorkspace->WriteL(TranslateElement(elem)); - iXMLWorkspace->WriteL(KXMLTagEnd()); - iXMLWorkspace->WriteL(KXMLNewLine()); - - iWBXMLWorkspace->WriteL(END); - - LOGGER_LEAVEFN( "CSConConMLGenerator::EndElementL()" ); - } - -// ----------------------------------------------------------------------------- -// AddElementL -// ----------------------------------------------------------------------------- -void CSConConMLGenerator::AddElementL( - TUint8 aElement, const TDesC8& aContent, const TWBXMLContentFormat aFormat ) - { - LOGGER_ENTERFN( "CSConConMLGenerator::AddElementL()" ); - iDontNewLine = ETrue; - BeginElementL(aElement, ETrue); - if( aFormat == EWBXMLContentFormatOpaque ) - { - WriteOpaqueDataL(aContent); - } - else - { - WriteInlineStringL(aContent); - } - iDontIndent = ETrue; - EndElementL(); - LOGGER_LEAVEFN( "CSConConMLGenerator::AddElementL()" ); - } - -// ----------------------------------------------------------------------------- -// AppendPCDataL -// ----------------------------------------------------------------------------- -void CSConConMLGenerator::AppendPCDataL( TUint8 aElement, pcdataPtr_t aContent ) - { - LOGGER_ENTERFN( "CSConConMLGenerator::AppendPCDataL()" ); - if( !aContent ) - { - return; - } - - if( aContent->contentType == SML_PCDATA_OPAQUE ) - { - AddElementL(aElement, - TPtrC8((TUint8*)aContent->content, - aContent->length)); - } - else - { - LOGGER_WRITE( "CSConConMLGenerator::AppendPCDataL() : Data type not Opaque - ignoring " ); - } - LOGGER_LEAVEFN( "CSConConMLGenerator::AppendPCDataL()" ); - } - -// ----------------------------------------------------------------------------- -// WBXMLDocument -// ----------------------------------------------------------------------------- -TPtrC8 CSConConMLGenerator::WBXMLDocument() - { - LOGGER_ENTERFN( "CSConConMLGenerator::WBXMLDocument()" ); - LOGGER_LEAVEFN( "CSConConMLGenerator::WBXMLDocument()" ); - return iWBXMLWorkspace->Buffer(); - } - -// ----------------------------------------------------------------------------- -// XMLDocument -// ----------------------------------------------------------------------------- -TPtrC8 CSConConMLGenerator::XMLDocument() - { - LOGGER_ENTERFN( "CSConConMLGenerator::XMLDocument()" ); - LOGGER_LEAVEFN( "CSConConMLGenerator::XMLDocument()" ); - return iXMLWorkspace->Buffer(); - } diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/wbxml/conmlhandler/src/sconconmlhandler.cpp --- a/connectivitymodules/SeCon/wbxml/conmlhandler/src/sconconmlhandler.cpp Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,474 +0,0 @@ -/* -* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: ConML parser/generator -* -*/ - - -// ----------------------------------------------------------------------------- -// Includes -// ----------------------------------------------------------------------------- -#include - -#include "sconconmlhandler.h" -#include "debug.h" - -// ----------------------------------------------------------------------------- -// CreateCSConConMLHandlerL -// Creates a new instance of CSConConMLHandler -// ----------------------------------------------------------------------------- -// -EXPORT_C CSConConMLHandler* CreateCSConConMLHandlerL() - { - LOGGER_ENTERFN( "CreateCSConConMLHandlerL()" ); - LOGGER_LEAVEFN( "CreateCSConConMLHandlerL()" ); - return CSConConMLHandler::NewL(); - } - -// ----------------------------------------------------------------------------- -// CSConConMLHandler::CSConConMLHandler() -// Default constructor -// ----------------------------------------------------------------------------- -// -CSConConMLHandler::CSConConMLHandler() - { - } - -// ----------------------------------------------------------------------------- -// CSConConMLHandler::CSConConMLHandler() -// Default constructor -// ----------------------------------------------------------------------------- -// -CSConConMLHandler::~CSConConMLHandler() - { - LOGGER_ENTERFN( "CSConConMLHandler::~CSConConMLHandler()" ); - - if ( iParseBuffer ) - { - LOGGER_WRITE( "CSConConMLHandler::~CSConConMLHandler() : phase 1/4 " ); - delete iParseBuffer; - iParseBuffer = NULL; - } - - if ( iBuffer ) - { - LOGGER_WRITE( "CSConConMLHandler::~CSConConMLHandler() : phase 2/4 " ); - delete iBuffer; - iBuffer = NULL; - } - - if ( iGenerator ) - { - LOGGER_WRITE( "CSConConMLHandler::~CSConConMLHandler() : phase 3/4 " ); - delete iGenerator; - iGenerator = NULL; - } - - if ( iStringTable ) - { - LOGGER_WRITE( "CSConConMLHandler::~CSConConMLHandler() : phase 4/4 " ); - delete iStringTable; - iStringTable = NULL; - } - - iElemStack.Close(); - - LOGGER_LEAVEFN( "CSConConMLHandler::~CSConConMLHandler()" ); - } - -// ----------------------------------------------------------------------------- -// CSConConMLHandler::CSConConMLHaNewL() -// Creates a new instance of CSConConMLHandler -// ----------------------------------------------------------------------------- -// -CSConConMLHandler* CSConConMLHandler::NewL() - { - LOGGER_ENTERFN( "CSConConMLHandler::NewL()" ); - CSConConMLHandler* self = new ( ELeave ) CSConConMLHandler(); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(); // self - LOGGER_LEAVEFN( "CSConConMLHandler::NewL()" ); - return self; - } - -// ----------------------------------------------------------------------------- -// CSConConMLHandler::ConstructL() -// 2nd phase constructor -// ----------------------------------------------------------------------------- -// -void CSConConMLHandler::ConstructL() - { - LOGGER_ENTERFN( "CSConConMLHandler::ConstructL()" ); - iGenerator = CSConConMLGenerator::NewL(); - iBuffer = CBufFlat::NewL( KSConBufferGranularity ); - iParseBuffer = CBufFlat::NewL( KSConDefaultDocumentSize ); - LOGGER_LEAVEFN( "CSConConMLHandler::ConstructL()" ); - } - -// ----------------------------------------------------------------------------- -// CSConConMLHandler::ParseDocumentL() -// Handles the document parsing, document in aInput -// ----------------------------------------------------------------------------- -// -TInt CSConConMLHandler::ParseDocumentL( - CBufFlat& aInput, MWBXMLConMLCallback* aCallback ) - { - LOGGER_ENTERFN( "CSConConMLHandler::ParseDocument()" ); - TInt ret ( KErrNone ); - - iPos = 0; - iParseBuffer->Reset(); - iParseBuffer->ResizeL( aInput.Size() ); - iParseBuffer->Write( 0, aInput.Ptr(0) ); - iHeaderParsed = EFalse; - iGenerator->SetCallback( aCallback ); - - while (ret == KWBXMLParserErrorOk ) - { - ret = ParseL(); - } - - if ( ret == KWBXMLParserErrorEof ) - { - ret = KErrNone; - } - LOGGER_WRITE_1( "CSConConMLHandler::ParseDocument()\ - returned %d", ret ); - return ( ret ); - } - -// ----------------------------------------------------------------------------- -// CSConConMLHandler::GenerateDocument() -// Starts the generating of a document -// ----------------------------------------------------------------------------- -// -TInt CSConConMLHandler::GenerateDocument( ConML_ConMLPtr_t aContent ) - { - LOGGER_ENTERFN( "CSConConMLHandler::GenerateDocument()" ); - iGenerator->GenerateConMLDocument ( aContent ); - LOGGER_LEAVEFN( "CSConConMLHandler::GenerateDocument()" ); - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// CSConConMLHandler::WBXMLDocument() -// Returns the generated WBXML -document -// ----------------------------------------------------------------------------- -// -TPtrC8 CSConConMLHandler::WBXMLDocument() - { - LOGGER_ENTERFN( "CSConConMLHandler::WBXMLDocument()" ); - LOGGER_LEAVEFN( "CSConConMLHandler::WBXMLDocument()" ); - return iGenerator->WBXMLDocument(); - } - -// ----------------------------------------------------------------------------- -// CSConConMLHandler::XMLDocument() -// Returns the generated XML -document -// ----------------------------------------------------------------------------- -// -TPtrC8 CSConConMLHandler::XMLDocument() - { - LOGGER_ENTERFN( "CSConConMLHandler::XMLDocument()" ); - LOGGER_LEAVEFN( "CSConConMLHandler::XMLDocument()" ); - return iGenerator->XMLDocument(); - } - -// ----------------------------------------------------------------------------- -// CSConConMLHandler::ParseL() -// Parses the next document tag / header if not parsed yet -// ----------------------------------------------------------------------------- -// -TInt CSConConMLHandler::ParseL() - { - LOGGER_ENTERFN( "CSConConMLHandler::ParseL()" ); - if( !iHeaderParsed ) - { - TConMLParserError result(KWBXMLParserErrorOk); - TRAPD(err, result = DoParseDocumentHeaderL()); - if( err == KErrEof ) - { - LOGGER_WRITE( "CSConConMLHandler::ParseL() : KWBXMLParserErrorEofTooEarly " ); - return KWBXMLParserErrorEofTooEarly; - } - return result; - } - LOGGER_LEAVEFN( "CSConConMLHandler::ParseL()" ); - return DoParseDocumentBodyL(); - } - -// ----------------------------------------------------------------------------- -// CSConConMLHandler::DoParseDocumentHeaderL() -// Parses the document header -// ----------------------------------------------------------------------------- -// -TConMLParserError CSConConMLHandler::DoParseDocumentHeaderL() - { - LOGGER_ENTERFN( "CSConConMLParser::DoParseDocumentHeaderL()" ); - iHeaderParsed = ETrue; - - // Version - TUint8 version = ReadUint8L(); - - // PublicId - TInt32 publicId = ReadMUint32L(); - - if( publicId == 0 ) - { - publicId = ReadMUint32L(); - } - else - { - publicId = -publicId; - } - - // Charset - TUint32 charSet = ReadMUint32L(); - - // String table - ReadStringTableL(); - - // Document begins now - if( publicId < 0 ) - { - iGenerator->StartDocument(version, -publicId, charSet); - } - else - { - iGenerator->StartDocument(version, - StringTableString(publicId), charSet); - } - LOGGER_LEAVEFN( "CSConConMLHandler::DoParseDocumentHeaderL()" ); - return KWBXMLParserErrorOk; - } - -// ----------------------------------------------------------------------------- -// CSConConMLHandler::DoParseDocumentBodyL() -// Parses the next element of the document -// ----------------------------------------------------------------------------- -// -TConMLParserError CSConConMLHandler::DoParseDocumentBodyL() - { - LOGGER_ENTERFN( "CSConConMLHandler::DoParseDocumentBodyL()" ); - TUint8 id(0); - TRAPD(err, id = ReadUint8L()); - - if( err != KErrNone ) - { - if( err == KErrEof ) - { - iGenerator->EndDocument(); - if( iElemStack.Count() > 0 ) - { - LOGGER_WRITE( "CSConConMLHandler::DoParseDocumentBodyL() : KWBXMLParserErrorEofTooEarly " ); - return KWBXMLParserErrorEofTooEarly; - } - return KWBXMLParserErrorEof; - } - User::Leave(err); - } - - switch (id) - { - case END: - { - if( !iElemStack.Count() ) - { - LOGGER_WRITE( "CSConConMLHandler::DoParseDocumentBodyL() : KWBXMLParserErrorinvalidDocument " ); - User::Leave( KWBXMLParserErrorinvalidDocument ); - } - TUint8 tag( iElemStack.operator[](iElemStack.Count() - 1 )); - iGenerator->EndElementL( tag ); - iElemStack.Remove(iElemStack.Count() - 1); - } - break; - - case STR_I: - iGenerator->CharactersL(ReadStrIL()); - break; - - case OPAQUE: - iGenerator->CharactersL(ReadOpaqueL()); - break; - - default: - HandleElementL(id); - break; - } - LOGGER_LEAVEFN( "CSConConMLHandler::DoParseDocumentBodyL()" ); - return KWBXMLParserErrorOk; - } - -// ----------------------------------------------------------------------------- -// CSConConMLHandler::ReadUint8L() -// Reads one byte from the document -// ----------------------------------------------------------------------------- -// -TUint8 CSConConMLHandler::ReadUint8L() - { - LOGGER_ENTERFN( "CSConConMLHandler::ReadUint8L()" ); - if ( iPos == iParseBuffer->Size()) - { - User::Leave ( KErrEof ); - } - TUint8 value; - HBufC8* data = HBufC8::NewLC( sizeof(TUint8) ); - TPtr8 ptr = data->Des(); - iParseBuffer->Read(iPos, ptr, sizeof(TUint8)); - iPos+= sizeof(TUint8); - value = ptr[0]; - CleanupStack::PopAndDestroy(1); //data - LOGGER_WRITE_1( "CSConConMLHandler::ReadUint8L()\ - : returned %d ", value ); - return value; - } - -// ----------------------------------------------------------------------------- -// CSConConMLHandler::ReadMUint32L() -// Reads multibyte coding from the document -// ----------------------------------------------------------------------------- -// -TUint32 CSConConMLHandler::ReadMUint32L() - { - LOGGER_ENTERFN( "CSConConMLHandler::ReadMUint32L()" ); - TUint32 result = 0; - TUint8 c; - - do { - c = ReadUint8L(); - result = (result << 7) | (c & 0x7f); - } while ( c & 0x80 ); - - LOGGER_WRITE_1( "CSConConMLHandler::ReadMUint32L()\ - : returned %d ", result ); - return result; - } - -// ----------------------------------------------------------------------------- -// CSConConMLHandler::ReadStrIL() -// Reads string data from the document -// ----------------------------------------------------------------------------- -// -TPtrC8 CSConConMLHandler::ReadStrIL() - { - LOGGER_ENTERFN( "CSConConMLHandler::ReadStrIL()" ); - iBuffer->Reset(); - RBufWriteStream bws(*iBuffer); - TUint8 c; - while( (c = ReadUint8L()) != 0 ) - { - bws.WriteUint8L(c); - } - bws.CommitL(); - LOGGER_LEAVEFN( "CSConConMLParser::ReadStrIL()" ); - return iBuffer->Ptr(0); - } - -// ----------------------------------------------------------------------------- -// CSConConMLHandler::ReadStringTableL() -// Handles the document's string table -// ----------------------------------------------------------------------------- -// -void CSConConMLHandler::ReadStringTableL() - { - LOGGER_ENTERFN( "CSConConMLHandler::ReadStringTableL()" ); - delete iStringTable; - iStringTable = NULL; - TUint32 strTblLen = ReadMUint32L(); - - if( strTblLen > 0 ) - { - if( iPos+strTblLen > iParseBuffer->Size()) - { - LOGGER_WRITE( "CSConConMLHandler::ReadStringTableL() : LEAVE KErrEof " ); - User::Leave ( KErrEof ); - } - iStringTable = HBufC8::NewL(strTblLen); - TPtr8 ptr = iStringTable->Des(); - iParseBuffer->Read(iPos, ptr, strTblLen); - iPos+=strTblLen; - } - LOGGER_LEAVEFN( "CSConConMLHandler::ReadStringTableL()" ); - } - -// ----------------------------------------------------------------------------- -// CSConConMLHandler::StringTableString() -// Returns a value from the string table according to the given index -// ----------------------------------------------------------------------------- -// -TPtrC8 CSConConMLHandler::StringTableString( TUint32 aIndex ) - { - LOGGER_ENTERFN( "CSConConMLHandler::StringTableString()" ); - TPtrC8 temp(iStringTable->Mid(aIndex)); - TInt pos = temp.Find(KWBXMLNull()); - if( pos != KErrNotFound ) - { - temp.Set(temp.Left(pos)); - } - LOGGER_LEAVEFN( "CSConConMLHandler::StringTableString()" ); - return temp; - } - -// ----------------------------------------------------------------------------- -// CSConConMLHandler::HandleElementL() -// Starts a new element in the document -// ----------------------------------------------------------------------------- -// -void CSConConMLHandler::HandleElementL( TUint8 aId ) - { - LOGGER_ENTERFN( "CSConConMLHandler::HandleElementL()" ); - TUint8 tag(TUint8(aId & 0x3f)); - - iGenerator->StartElementL( tag ); - - if( aId & 0x40 ) - { - iElemStack.Append( tag ); - } - else - { - iGenerator->EndElementL(tag); - } - LOGGER_LEAVEFN( "CSConConMLHandler::HandleElementL()" ); - } - -// ----------------------------------------------------------------------------- -// CSConConMLHandler::ReadOpaqueL() -// Reads opaque data from the document -// ----------------------------------------------------------------------------- -// -TPtrC8 CSConConMLHandler::ReadOpaqueL() - { - LOGGER_ENTERFN( "CSConConMLHandler::ReadOpaqueL()" ); - iBuffer->Reset(); - RBufWriteStream bws(*iBuffer); - TUint32 length = ReadMUint32L(); - if( iPos+length > iParseBuffer->Size()) - { - LOGGER_WRITE( "CSConConMLHandler::ReadOpaqueL() : LEAVE KErrEof " ); - User::Leave ( KErrEof ); - } - HBufC8* data = HBufC8::NewLC( length ); - TPtr8 ptr = data->Des(); - iParseBuffer->Read( iPos, ptr, length ); - iPos+= length; - bws.WriteL(ptr, length); - bws.CommitL(); - CleanupStack::PopAndDestroy(1); // data - - LOGGER_LEAVEFN( "CSConConMLHandler::ReadOpaqueL()" ); - return iBuffer->Ptr(0); - } - diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/wbxml/conmlhandler/src/sconxmlelement.cpp --- a/connectivitymodules/SeCon/wbxml/conmlhandler/src/sconxmlelement.cpp Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,77 +0,0 @@ -/* -* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: ConML parser/generator -* -*/ - - -// ----------------------------------------------------------------------------- -// Includes -// ----------------------------------------------------------------------------- - -#include "sconxmlelement.h" -#include "sconconmldtd.h" - -// ----------------------------------------------------------------------------- -// TElementParams -// ----------------------------------------------------------------------------- -TXMLElementParams::TXMLElementParams( - TAny* aCallbacks, - CXMLStack* aCmdStack, - CXMLStack* aCleanupStack ) : - iCallbacks(aCallbacks), - iCmdStack(aCmdStack), - iCleanupStack(aCleanupStack) - { - } - -// ----------------------------------------------------------------------------- -// CXMLElement -// ----------------------------------------------------------------------------- -CXMLElement* CXMLElement::BeginElementL( - TUint8 /*aTag*/, const TXMLElementParams& /*Params*/ ) - { - return 0; - } - -// ----------------------------------------------------------------------------- -CXMLElement::TAction CXMLElement::EndElementL( TAny* /*aCallbacks*/, - TUint8 /*aTag*/ ) - { - return EPop; - } - - -// ----------------------------------------------------------------------------- -TBool CXMLElement::NeedsCleanup() const - { - return EFalse; - } - -// ----------------------------------------------------------------------------- -void CXMLElement::SetDataL( const TDesC8& /*aData*/ ) - { - } - -// ----------------------------------------------------------------------------- -TPtrC8 CXMLElement::Data() const - { - return TPtrC8(); - } - -// ----------------------------------------------------------------------------- -TBool CXMLElement::Validate() - { - return ETrue; - } diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/SeCon/wbxml/conmlhandler/src/sconxmlworkspace.cpp --- a/connectivitymodules/SeCon/wbxml/conmlhandler/src/sconxmlworkspace.cpp Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,175 +0,0 @@ -/* -* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: ConML parser/generator -* -*/ - - -// ----------------------------------------------------------------------------- -// Includes -// ----------------------------------------------------------------------------- -#include "sconxmlworkspace.h" - -// ----------------------------------------------------------------------------- -// CXMLWorkspace -// ----------------------------------------------------------------------------- -CXMLWorkspace::CXMLWorkspace() - { - } - -// ----------------------------------------------------------------------------- -// NewL -// ----------------------------------------------------------------------------- -CXMLWorkspace* CXMLWorkspace::NewL() - { - CXMLWorkspace* self = new (ELeave) CXMLWorkspace(); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(); // self - return self; - } - -// ----------------------------------------------------------------------------- -// ConstructL -// ----------------------------------------------------------------------------- -void CXMLWorkspace::ConstructL() - { - iBuffer = CBufFlat::NewL(32); - iTransactions = new (ELeave) RArray(); - } - -// ----------------------------------------------------------------------------- -// ~CXMLWorkspace -// ----------------------------------------------------------------------------- -CXMLWorkspace::~CXMLWorkspace() - { - delete iBuffer; - if( iTransactions ) - { - iTransactions->Reset(); - } - delete iTransactions; - } - -// ----------------------------------------------------------------------------- -// BeginTransaction -// ----------------------------------------------------------------------------- -void CXMLWorkspace::BeginTransaction() - { - iTransactions->Append(Size()); - } - -// ----------------------------------------------------------------------------- -// Commit -// ----------------------------------------------------------------------------- -TInt CXMLWorkspace::Commit() - { - if( iTransactions->Count() == 0 ) - { - return KErrGeneral; - } - iTransactions->Remove(iTransactions->Count() - 1); - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// CommitAll -// ----------------------------------------------------------------------------- -void CXMLWorkspace::CommitAll() - { - iTransactions->Reset(); - } - -// ----------------------------------------------------------------------------- -// Rollback -// ----------------------------------------------------------------------------- -TInt CXMLWorkspace::Rollback() - { - if( iTransactions->Count() == 0 ) - { - return KErrGeneral; - } - TUint begin = iTransactions->operator[](iTransactions->Count() - 1); - Delete(begin, Size() - begin); - iTransactions->Remove(iTransactions->Count() - 1); - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// Reset -// ----------------------------------------------------------------------------- -void CXMLWorkspace::Reset() - { - iBuffer->Reset(); - } - -// ----------------------------------------------------------------------------- -// WriteL -// ----------------------------------------------------------------------------- -void CXMLWorkspace::WriteL( const TDesC8& aData ) - { - TRAPD(err, iBuffer->InsertL(iBuffer->Size(), aData)); - if( err != KErrNone ) - { - User::Leave(KErrTooBig); - } - } - -// ----------------------------------------------------------------------------- -// WriteL -// ----------------------------------------------------------------------------- -void CXMLWorkspace::WriteL( const TUint8 aData ) - { - WriteL(TPtrC8(&aData, 1)); - } - -// ----------------------------------------------------------------------------- -// Buffer -// ----------------------------------------------------------------------------- -TPtrC8 CXMLWorkspace::Buffer() - { - return iBuffer->Ptr(0); - } - -// ----------------------------------------------------------------------------- -// FreeSize -// ----------------------------------------------------------------------------- -TInt CXMLWorkspace::FreeSize() - { - return (KMaxTInt32 - Size()); - } - -// ----------------------------------------------------------------------------- -// MaxSize -// ----------------------------------------------------------------------------- -TInt CXMLWorkspace::MaxSize() - { - return KMaxTInt32; - } - -// ----------------------------------------------------------------------------- -// Size -// ----------------------------------------------------------------------------- -TInt CXMLWorkspace::Size() - { - return iBuffer->Size(); - } - -// ----------------------------------------------------------------------------- -// Delete -// ----------------------------------------------------------------------------- -void CXMLWorkspace::Delete( TInt aPos, TInt aLength ) - { - iBuffer->Delete(aPos, aLength); - } diff -r d0791faffa3f -r aabe5387f5ce connectivitymodules/group/bld.inf --- a/connectivitymodules/group/bld.inf Tue Feb 02 01:11:40 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,19 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Build information file -* -*/ - - -#include "../SeCon/group/bld.inf" diff -r d0791faffa3f -r aabe5387f5ce group/bld.inf --- a/group/bld.inf Tue Feb 02 01:11:40 2010 +0200 +++ b/group/bld.inf Fri Mar 19 09:40:39 2010 +0200 @@ -18,4 +18,3 @@ #include "../remoteconn_plat/group/bld.inf" -#include "../connectivitymodules/group/bld.inf" diff -r d0791faffa3f -r aabe5387f5ce mtpdataproviders/mtpfileandfolderdp/inc/cmtpfiledp.h --- a/mtpdataproviders/mtpfileandfolderdp/inc/cmtpfiledp.h Tue Feb 02 01:11:40 2010 +0200 +++ b/mtpdataproviders/mtpfileandfolderdp/inc/cmtpfiledp.h Fri Mar 19 09:40:39 2010 +0200 @@ -27,6 +27,7 @@ #include "mtpdebug.h" #include "rmtpfiledpsingletons.h" #include "rmtpdpsingletons.h" +#include "rmtpframework.h" class CMTPFileDpExclusionMgr; class CMTPFSEnumerator; @@ -117,6 +118,8 @@ TInt iActiveProcessor; TBool iActiveProcessorRemoved; + + RMTPFramework iSingletons; }; diff -r d0791faffa3f -r aabe5387f5ce mtpdataproviders/mtpfileandfolderdp/src/cmtpfiledp.cpp --- a/mtpdataproviders/mtpfileandfolderdp/src/cmtpfiledp.cpp Tue Feb 02 01:11:40 2010 +0200 +++ b/mtpdataproviders/mtpfileandfolderdp/src/cmtpfiledp.cpp Fri Mar 19 09:40:39 2010 +0200 @@ -28,6 +28,7 @@ #include "mtpfiledpconst.h" #include "mtpfiledppanic.h" #include "mtpfiledpprocessor.h" +#include "cmtpdataprovidercontroller.h" // Class constants static const TInt KArrayGranularity = 3; @@ -63,6 +64,7 @@ iActiveProcessors.Close(); iDpSingletons.Close(); iFileDPSingletons.Close(); + iSingletons.Close(); delete iFileEnumerator; delete iExclusionMgr; __FLOG(_L8("~CMTPFileDataProvider - Exit")); @@ -135,12 +137,12 @@ { __FLOG(_L8("StartObjectEnumerationL - Entry")); - iExclusionMgr->AppendFormatExclusionListL(); - iDpSingletons.MTPUtility().FormatExtensionMapping(); iPendingEnumerations.AppendL(aStorageId); if (iPendingEnumerations.Count() == 1) { - iFileEnumerator->StartL(iPendingEnumerations[KActiveEnumeration]); + CMTPDataProviderController& dpController(iSingletons.DpController()); + TBool bOnlyScanRoot = ( (dpController.EnumerateState() == CMTPDataProviderController::EEnumeratingFrameworkObjects) && (dpController.NeedEnumeratingPhase2()) ); + iFileEnumerator->StartL(iPendingEnumerations[KActiveEnumeration], bOnlyScanRoot); } __FLOG(_L8("StartObjectEnumerationL - Exit")); } @@ -148,6 +150,8 @@ void CMTPFileDataProvider::StartStorageEnumerationL() { __FLOG(_L8("StartStorageEnumerationL - Entry")); + iExclusionMgr->AppendFormatExclusionListL(); + iDpSingletons.MTPUtility().FormatExtensionMapping(); Framework().StorageEnumerationCompleteL(); __FLOG(_L8("StartStorageEnumerationL - Exit")); } @@ -220,7 +224,9 @@ iPendingEnumerations.Remove(KActiveEnumeration); if (iPendingEnumerations.Count()) { - iFileEnumerator->StartL(iPendingEnumerations[KActiveEnumeration]); + CMTPDataProviderController& dpController(iSingletons.DpController()); + TBool bOnlyScanRoot = ( (dpController.EnumerateState() == CMTPDataProviderController::EEnumeratingFrameworkObjects) && (dpController.NeedEnumeratingPhase2()) ); + iFileEnumerator->StartL(iPendingEnumerations[KActiveEnumeration], bOnlyScanRoot); } __FLOG(_L8("HandleEnumerationCompletedL - Exit")); } @@ -246,6 +252,7 @@ __FLOG(_L8("ConstructL - Entry")); iDpSingletons.OpenL(Framework()); iFileDPSingletons.OpenL(Framework()); + iSingletons.OpenL(); iExclusionMgr = CMTPFileDpExclusionMgr::NewL(Framework()); iDpSingletons.SetExclusionMgrL(*iExclusionMgr); diff -r d0791faffa3f -r aabe5387f5ce mtpdataproviders/mtpimagedp/group/mtpimagedp.mmp --- a/mtpdataproviders/mtpimagedp/group/mtpimagedp.mmp Tue Feb 02 01:11:40 2010 +0200 +++ b/mtpdataproviders/mtpimagedp/group/mtpimagedp.mmp Fri Mar 19 09:40:39 2010 +0200 @@ -67,6 +67,7 @@ SOURCE mtpimagedprequestprocessor.cpp SOURCE cmtpimagedpsetobjectprotection.cpp SOURCE cmtpimagedprenameobject.cpp +SOURCE cmtpimagedpnewpicturesnotifier.cpp // ECOM resource START RESOURCE mtpimagedp.rss diff -r d0791faffa3f -r aabe5387f5ce mtpdataproviders/mtpimagedp/inc/cmtpimagedp.h --- a/mtpdataproviders/mtpimagedp/inc/cmtpimagedp.h Tue Feb 02 01:11:40 2010 +0200 +++ b/mtpdataproviders/mtpimagedp/inc/cmtpimagedp.h Fri Mar 19 09:40:39 2010 +0200 @@ -39,8 +39,10 @@ class CMTPImageDpMdeObserver; class CRepository; class CMTPImageDpRenameObject; +class CMTPImageDpNewPicturesNotifier; const TInt KMaxExtNameLength = 4; +const TInt KMaxMimeNameLength = 10; /** Implements the picture data provider plugin. @@ -59,11 +61,14 @@ CMTPImageDpThumbnailCreator& ThumbnailManager() const; CRepository& Repository() const; - TMTPFormatCode FindFormatL(const TDesC& aExtension); + TMTPFormatCode FindFormat(const TDesC& aExtension); + const TDesC& FindMimeType(const TDesC& aExtension); TBool GetCacheParentHandle(const TDesC& aParentPath, TUint32& aParentHandle); void SetCacheParentHandle(const TDesC& aParentPath, TUint32 aParentHandle); void AppendDeleteObjectsArrayL(const TDesC& aSuid); void HandleDeleteObjectsArray(); + void IncreaseNewPictures(TInt aCount); + void DecreaseNewPictures(TInt aCount); public: // From CMTPDataProviderPlugin void Cancel(); @@ -109,6 +114,7 @@ CMTPImageDpMdeObserver* iMdeObserver; CRepository* iRepository; CMTPImageDpRenameObject* iRenameObject; + CMTPImageDpNewPicturesNotifier* iNewPicNotifier; /** The active request processors table. @@ -116,13 +122,16 @@ RPointerArray iActiveProcessors; /** - * contain the image mapping of extenstion to formatcode + * contain the mapping image'extension to formatcode */ RHashMap, TMTPFormatCode> iFormatMappings; - SMTPImageDpParentCache iParentCache; + /** + * contain the mapping image's extension to mime type + */ + RHashMap, TBuf > iMimeMappings; - TUint iPrePictures; + SMTPImageDpParentCache iParentCache; TInt iActiveProcessor; TBool iActiveProcessorRemoved; diff -r d0791faffa3f -r aabe5387f5ce mtpdataproviders/mtpimagedp/inc/cmtpimagedpcopyobject.h --- a/mtpdataproviders/mtpimagedp/inc/cmtpimagedpcopyobject.h Tue Feb 02 01:11:40 2010 +0200 +++ b/mtpdataproviders/mtpimagedp/inc/cmtpimagedpcopyobject.h Fri Mar 19 09:40:39 2010 +0200 @@ -75,6 +75,7 @@ TUint32 iNewParentHandle; TUint32 iStorageId; TFileName iNewFileName; + MMTPDataProviderFramework& iFramework; CMTPImageDataProvider& iDataProvider; /* diff -r d0791faffa3f -r aabe5387f5ce mtpdataproviders/mtpimagedp/inc/cmtpimagedpgetobject.h --- a/mtpdataproviders/mtpimagedp/inc/cmtpimagedpgetobject.h Tue Feb 02 01:11:40 2010 +0200 +++ b/mtpdataproviders/mtpimagedp/inc/cmtpimagedpgetobject.h Fri Mar 19 09:40:39 2010 +0200 @@ -25,6 +25,7 @@ class CMTPTypeFile; class CMTPImageDataProvider; +class MMTPDataProviderFramework; /** Defines file data provider GetObject request processor @@ -56,6 +57,7 @@ */ __FLOG_DECLARATION_MEMBER_MUTABLE; + MMTPDataProviderFramework& iFramework; CMTPTypeFile* iFileObject; CMTPImageDataProvider& iDataProvider; }; diff -r d0791faffa3f -r aabe5387f5ce mtpdataproviders/mtpimagedp/inc/cmtpimagedpgetobjectpropdesc.h --- a/mtpdataproviders/mtpimagedp/inc/cmtpimagedpgetobjectpropdesc.h Tue Feb 02 01:11:40 2010 +0200 +++ b/mtpdataproviders/mtpimagedp/inc/cmtpimagedpgetobjectpropdesc.h Fri Mar 19 09:40:39 2010 +0200 @@ -67,7 +67,8 @@ void ServiceRepresentativeSampleFormatL(); void ServiceRepresentativeSampleSizeL(); void ServiceRepresentativeSampleHeightL(); - void ServiceRepresentativeSampleWidthL(); + void ServiceRepresentativeSampleWidthL(); + void ServiceRepresentativeSampleDataL(); void ServiceNonConsumableL(); TUint16 GetPropertyGroupNumber(const TUint16 aPropCode) const; diff -r d0791faffa3f -r aabe5387f5ce mtpdataproviders/mtpimagedp/inc/cmtpimagedpgetobjectpropvalue.h --- a/mtpdataproviders/mtpimagedp/inc/cmtpimagedpgetobjectpropvalue.h Tue Feb 02 01:11:40 2010 +0200 +++ b/mtpdataproviders/mtpimagedp/inc/cmtpimagedpgetobjectpropvalue.h Fri Mar 19 09:40:39 2010 +0200 @@ -30,6 +30,7 @@ class TMTPTypeUint64; class TMTPTypeUint128; class CMTPTypeString; +class CMTPTypeArray; class CMTPImageDataProvider; @@ -70,6 +71,7 @@ void ServiceRepresentativeSampleSizeL(); void ServiceRepresentativeSampleHeightL(); void ServiceRepresentativeSampleWidthL(); + void ServiceRepresentativeSampleDataL(); void ServiceNonConsumableL(); private: @@ -80,6 +82,7 @@ TMTPTypeUint64 iMTPTypeUint64; TMTPTypeUint128 iMTPTypeUint128; CMTPTypeString* iMTPTypeString; + CMTPTypeArray* iMTPTypeArray; CMTPObjectMetaData* iObjectMeta; /** diff -r d0791faffa3f -r aabe5387f5ce mtpdataproviders/mtpimagedp/inc/cmtpimagedpgetthumb.h --- a/mtpdataproviders/mtpimagedp/inc/cmtpimagedpgetthumb.h Tue Feb 02 01:11:40 2010 +0200 +++ b/mtpdataproviders/mtpimagedp/inc/cmtpimagedpgetthumb.h Fri Mar 19 09:40:39 2010 +0200 @@ -57,7 +57,7 @@ */ __FLOG_DECLARATION_MEMBER_MUTABLE; CMTPImageDataProvider& imgDp; - CMTPTypeOpaqueData* iThumb; + CMTPTypeOpaqueData* iThumb; CMTPObjectMetaData* iObjectMeta; }; diff -r d0791faffa3f -r aabe5387f5ce mtpdataproviders/mtpimagedp/inc/cmtpimagedpmdeobserver.h --- a/mtpdataproviders/mtpimagedp/inc/cmtpimagedpmdeobserver.h Tue Feb 02 01:11:40 2010 +0200 +++ b/mtpdataproviders/mtpimagedp/inc/cmtpimagedpmdeobserver.h Fri Mar 19 09:40:39 2010 +0200 @@ -64,7 +64,7 @@ const RArray& aObjectIdArray); void ProcessMdeNotificationL(const RArray& aObjectIdArray, TObserverNotificationType aType); - void CreateMetadataL(const CMdEObject& aMdeObject, CMTPObjectMetaData& aMetaData); + void CreateMetadataL(const TParsePtrC& aParse, TMTPFormatCode aFormat, TUint32 aParentHandle, CMTPObjectMetaData& aMetaData); private: /** diff -r d0791faffa3f -r aabe5387f5ce mtpdataproviders/mtpimagedp/inc/cmtpimagedpnewpicturesnotifier.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mtpdataproviders/mtpimagedp/inc/cmtpimagedpnewpicturesnotifier.h Fri Mar 19 09:40:39 2010 +0200 @@ -0,0 +1,50 @@ +// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +/** + @file + @internalTechnology +*/ + +#ifndef CMTPIMAGEDPNEWPICTURENOTIFIER_H +#define CMTPIMAGEDPNEWPICTURENOTIFIER_H + +#include + +class CMTPImageDpNewPicturesNotifier : public CTimer + { +public: + + static CMTPImageDpNewPicturesNotifier* NewL(); + virtual ~CMTPImageDpNewPicturesNotifier(); + + void SetNewPictures(TInt aValue); + void IncreaseCount(TInt aValue); + void DecreaseCount(TInt aValue); + +private: // From CTimer + + void RunL(); + +private: + + CMTPImageDpNewPicturesNotifier(); + void ConstructL(); + +private: + TInt iNewPictures; + }; + +#endif // CMTPIMAGEDPNEWPICTURENOTIFIER_H diff -r d0791faffa3f -r aabe5387f5ce mtpdataproviders/mtpimagedp/inc/cmtpimagedpobjectpropertymgr.h --- a/mtpdataproviders/mtpimagedp/inc/cmtpimagedpobjectpropertymgr.h Tue Feb 02 01:11:40 2010 +0200 +++ b/mtpdataproviders/mtpimagedp/inc/cmtpimagedpobjectpropertymgr.h Fri Mar 19 09:40:39 2010 +0200 @@ -41,6 +41,9 @@ class CFileStore; class CMTPTypeString; class CMTPObjectMetaData; +class CMTPImageDataProvider; +class CMTPTypeOpaqueData; +class CMTPTypeArray; /** Manage picture object properties @@ -52,7 +55,7 @@ { public: - static CMTPImageDpObjectPropertyMgr* NewL(MMTPDataProviderFramework& aFramework); + static CMTPImageDpObjectPropertyMgr* NewL(MMTPDataProviderFramework& aFramework, CMTPImageDataProvider& aDataProvider); ~CMTPImageDpObjectPropertyMgr(); void SetCurrentObjectL(CMTPObjectMetaData& aObjectInfo, TBool aRequireForModify, TBool aSaveToCache = EFalse); @@ -67,12 +70,16 @@ void GetPropertyL(TMTPObjectPropertyCode aProperty, TUint32& aValue); void GetPropertyL(TMTPObjectPropertyCode aProperty, TUint64& aValue); void GetPropertyL(TMTPObjectPropertyCode aProperty, TMTPTypeUint128& aValue); - void GetPropertyL(TMTPObjectPropertyCode aProperty, CMTPTypeString& aValue); + void GetPropertyL(TMTPObjectPropertyCode aProperty, CMTPTypeString& aValue); + void GetPropertyL(TMTPObjectPropertyCode aProperty, CMTPTypeArray& aValue); //clear the cache void ClearCacheL(); void ConvertMTPTimeStr2TTimeL(const TDesC& aTimeString, TTime& aModifiedTime) const; + void StoreThunmnail(TUint aHandle, HBufC8* aData); + HBufC8* Thumbnail(TUint aHandle); + public: void SetMdeSessionError(TInt aError); CMdESession& MdeSession(); @@ -82,7 +89,7 @@ void HandleSessionError(CMdESession& aSession, TInt aError); private: - CMTPImageDpObjectPropertyMgr(MMTPDataProviderFramework& aFramework); + CMTPImageDpObjectPropertyMgr(MMTPDataProviderFramework& aFramework, CMTPImageDataProvider& aDataProvider); void ConstructL(MMTPDataProviderFramework& aFramework); TBool GetYear(const TDesC& aDateString, TInt& aYear) const; @@ -96,9 +103,11 @@ void SetProperty2CacheL(TMTPObjectPropertyCode aProperty, TAny* aValue); void GetPropertyFromMdsL(TMTPObjectPropertyCode aProperty, TAny* aValue); - TUint32 ParseImageFileL(const TDesC& aUri, TMTPObjectPropertyCode aPropCode); void RemoveProperty(CMdEObject& aObject, CMdEPropertyDef& aPropDef); + void OpenMdeObjectL(); + void ClearThumnailCache(); + private: //define property cache object @@ -177,21 +186,38 @@ static const TElementMetaData KElements[]; }; + /** + * Thumbnail cache used for winlogo test + */ + struct TThumbnailCache + { + TUint iObjectHandle; + HBufC8* iThumbnailData; + }; + private: /** FLOGGER debug trace member variable. */ __FLOG_DECLARATION_MEMBER_MUTABLE; + MMTPDataProviderFramework& iFramework; + CMTPImageDataProvider& iDataProvider; CActiveSchedulerWait* iActiveSchedulerWait; CMdESession* iMetaDataSession; TInt iMdeSessionError; - CMdEObject* iObject; + CMdEObject* iObject;//used for read properties from MdS RFs& iFs; MMTPObjectMgr& iObjectMgr; CMTPObjectMetaData* iObjectInfo; //not owned TBool iCacheHit;//flag to indicate cache is available + TBool iNeedParse;//flag to indicate whether we need to parse image file by our self + + /* + * Cache thumbnail, thumbnail size is inconsistent in winlogo test + */ + TThumbnailCache iThumbnailCache; /** * Cache the latest image properties which PC send to device, diff -r d0791faffa3f -r aabe5387f5ce mtpdataproviders/mtpimagedp/inc/cmtpimagedpthumbnailcreator.h --- a/mtpdataproviders/mtpimagedp/inc/cmtpimagedpthumbnailcreator.h Tue Feb 02 01:11:40 2010 +0200 +++ b/mtpdataproviders/mtpimagedp/inc/cmtpimagedpthumbnailcreator.h Fri Mar 19 09:40:39 2010 +0200 @@ -35,6 +35,8 @@ #include "mtpdebug.h" +class CMTPImageDataProvider; + #define MTPTHUMBSCALING // CLASS DECLARATION @@ -54,7 +56,7 @@ * @param None. * @return An instance of CMTPImageDpThumbnailCreator. */ - static CMTPImageDpThumbnailCreator* NewL(); + static CMTPImageDpThumbnailCreator* NewL(CMTPImageDataProvider& aDataProvider); /** * C++ destructor. @@ -62,16 +64,7 @@ ~CMTPImageDpThumbnailCreator(); public: - - /** - * Gets a thumbnail from the image. - * @since S60 3.2 - * @param aSession, Reference to file server. - * @param aFileName, Name of the image file. Caller must ensure that the referenced object exists until the asynchronous call is completed. - * @param aThumbName, Name of the thumbnail file to be created. Caller must ensure that the referenced object exists until the asynchronous call is completed. - * @param aGetThumbnailStatus, status when - */ - void GetThumbnailL(const TDesC& aFileName, CMTPTypeOpaqueData& aThumbName, TInt& result); + void GetThumbnailL(const TDesC& aFileName, HBufC8*& aDestinationData, TInt& result); void ClearThumbnailData(); @@ -105,7 +98,7 @@ /** * Default C++ constructor. Not used. */ - CMTPImageDpThumbnailCreator(); + CMTPImageDpThumbnailCreator(CMTPImageDataProvider& aDataProvider); /** * 2nd phase constructor. @@ -124,6 +117,8 @@ EGetted, EScaling, EEncoding} iState; + + CMTPImageDataProvider& iDataProvider; TThumbnailRequestId iCurrentReq; TInt* iCreationErr; CFbsBitmap* iBitmap; @@ -134,7 +129,6 @@ HBufC8* iData; CThumbnailManager* iThumbMgr; CThumbnailObjectSource* iObjectSource; - CMTPTypeOpaqueData* iBuffer; //not owned CActiveSchedulerWait* iActiveSchedulerWait; }; diff -r d0791faffa3f -r aabe5387f5ce mtpdataproviders/mtpimagedp/inc/mtpimagedpconst.h --- a/mtpdataproviders/mtpimagedp/inc/mtpimagedpconst.h Tue Feb 02 01:11:40 2010 +0200 +++ b/mtpdataproviders/mtpimagedp/inc/mtpimagedpconst.h Fri Mar 19 09:40:39 2010 +0200 @@ -26,14 +26,16 @@ #include #include // for __FLOG debugging -// for thumb creation -const TUint32 KThumbWidht=160; -const TUint32 KThumbHeigth=120; +/* + * [Thumbnail SIZE]: performance improvement + */ +const TUint32 KThumbWidht=104;//avoid to scale width to 160 +const TUint32 KThumbHeigth=74;//avoid to scale width to 120 const TUint32 KThumbCompressedSize=KThumbWidht * KThumbHeigth * 4; // from TNM const TUint32 KThumbFormatCode = 0x3801; const TUint32 KFileSizeMax = 10 * 1000 * 1000; +const TUint32 KImageDpNotifyDelay = 1000000 * 15;// set delay time, in microseconds, default is 15s. -_LIT(KJpegMimeType, "image/jpeg"); _LIT8(KPtpMimeJPEG, "image/jpeg"); /** @@ -95,6 +97,7 @@ EMTPObjectPropCodeRepresentativeSampleSize, EMTPObjectPropCodeRepresentativeSampleHeight, EMTPObjectPropCodeRepresentativeSampleWidth, + EMTPObjectPropCodeRepresentativeSampleData, EMTPObjectPropCodeNonConsumable }; @@ -130,7 +133,8 @@ EMTPObjectPropCodeRepresentativeSampleFormat, EMTPObjectPropCodeRepresentativeSampleSize, EMTPObjectPropCodeRepresentativeSampleHeight, - EMTPObjectPropCodeRepresentativeSampleWidth + EMTPObjectPropCodeRepresentativeSampleWidth, + EMTPObjectPropCodeRepresentativeSampleData }; /** @@ -161,6 +165,13 @@ const TText* iExtension; }; +struct SMTPExtensionMimeTypeMapping + { + public: + const TText* iExtension; + const TText* iMimeType; + }; + // Note when adding extensions: // same value for iExtension can be in the file only once, // values for iFormatCode code can be multiple times @@ -173,9 +184,26 @@ static const SMTPValidCodeExtensionMapping KMTPValidCodeExtensionMappings[] = { - {EMTPFormatCodeEXIFJPEG, CASTING("jpg")}, // jpeg - {EMTPFormatCodeEXIFJPEG, CASTING("jpe")}, // jpeg - {EMTPFormatCodeEXIFJPEG, CASTING("jpeg")} // jpeg + {EMTPFormatCodeEXIFJPEG, CASTING("jpg")}, // jpeg + {EMTPFormatCodeEXIFJPEG, CASTING("jpe")}, // jpeg + {EMTPFormatCodeEXIFJPEG, CASTING("jpeg")}, // jpeg +// {EMTPFormatCodeBMP, CASTING("bmp")}, // bmp +// {EMTPFormatCodeGIF, CASTING("gif")}, // gif +// {EMTPFormatCodePNG, CASTING("png")}, // png +// {EMTPFormatCodeTIFF, CASTING("tif")}, // tiff, TNM does not support +// {EMTPFormatCodeTIFF, CASTING("tiff")}, // tiff, TNM does not support + }; + +static const SMTPExtensionMimeTypeMapping KMTPExtensionMimeTypeMappings[] = + { + {CASTING("jpg"), CASTING("image/jpeg")}, // jpeg + {CASTING("jpe"), CASTING("image/jpeg")}, // jpeg + {CASTING("jpeg"), CASTING("image/jpeg")}, // jpeg +// {CASTING("bmp"), CASTING("image/bmp")}, // bmp +// {CASTING("gif"), CASTING("image/gif")}, // gif +// {CASTING("png"), CASTING("image/png")}, // png +// {CASTING("tif"), CASTING("image/tiff")}, // tiff, TNM does not support +// {CASTING("tiff"), CASTING("image/tiff")}, // tiff, TNM does not support }; /** diff -r d0791faffa3f -r aabe5387f5ce mtpdataproviders/mtpimagedp/inc/mtpimagedputilits.h --- a/mtpdataproviders/mtpimagedp/inc/mtpimagedputilits.h Tue Feb 02 01:11:40 2010 +0200 +++ b/mtpdataproviders/mtpimagedp/inc/mtpimagedputilits.h Fri Mar 19 09:40:39 2010 +0200 @@ -47,13 +47,24 @@ static TUint32 FindParentHandleL(MMTPDataProviderFramework& aFramework, CMTPImageDataProvider& aDataProvider, const TDesC& aFullPath); /** - * Calculate the new pictures value and set RProperty. - - @param aDataProvider The image data provider reference - @param aNewPics The new pictures count - @param aSetRProperty Whether should set RProperty value to notify all subscribers. + * determine whether the object is new + */ + static TBool IsNewPicture(const CMTPObjectMetaData& aMetadata); + + /** + * update object status to old */ - static void UpdateNewPicturesValue(CMTPImageDataProvider& aDataProvider, TInt aNewPics, TBool aSetRProperty); + static void UpdateObjectStatusToOldL(MMTPDataProviderFramework& aFramework, CMTPObjectMetaData& aMetadata); + + /** + * query thumbnail size from metadata of object + */ + static TInt GetThumbnailSize(const CMTPObjectMetaData& aMetadata); + + /** + * update object thumbnail size + */ + static void UpdateObjectThumbnailSizeL(MMTPDataProviderFramework& aFramework, CMTPObjectMetaData& aMetadata, TInt aThumbnailSize); }; #endif MTPIMAGEDPUTILITS_H diff -r d0791faffa3f -r aabe5387f5ce mtpdataproviders/mtpimagedp/src/cmtpimagedp.cpp --- a/mtpdataproviders/mtpimagedp/src/cmtpimagedp.cpp Tue Feb 02 01:11:40 2010 +0200 +++ b/mtpdataproviders/mtpimagedp/src/cmtpimagedp.cpp Fri Mar 19 09:40:39 2010 +0200 @@ -29,6 +29,7 @@ #include #include #include +#include #include #include "cmtpimagedp.h" @@ -40,6 +41,7 @@ #include "mtpimagedputilits.h" #include "cmtpimagedpmdeobserver.h" #include "cmtpimagedprenameobject.h" +#include "cmtpimagedpnewpicturesnotifier.h" __FLOG_STMT(_LIT8(KComponent,"CMTPImageDataProvider");) @@ -80,6 +82,7 @@ CMTPDataProviderPlugin(aParams), iActiveProcessors(KArrayGranularity), iFormatMappings(&TBuf16Hash, &TBuf16Ident), + iMimeMappings(&TBuf16Hash, &TBuf16Ident), iActiveProcessor(-1), iEnumerated(EFalse), iDeleteObjectsArray(KDeleteObjectGranularity) @@ -94,10 +97,11 @@ __FLOG_OPEN(KMTPSubsystem, KComponent); __FLOG(_L8(">> CMTPImageDataProvider::ConstructL")); - iPropertyMgr = CMTPImageDpObjectPropertyMgr::NewL(Framework()); - iThumbnailManager = CMTPImageDpThumbnailCreator::NewL(); + iPropertyMgr = CMTPImageDpObjectPropertyMgr::NewL(Framework(), *this); + iThumbnailManager = CMTPImageDpThumbnailCreator::NewL(*this); iMdeObserver = CMTPImageDpMdeObserver::NewL(Framework(), *this); iMdeObserver->SubscribeForChangeNotificationL(); + iNewPicNotifier = CMTPImageDpNewPicturesNotifier::NewL(); //Setup central repository connection const TUint32 KUidMTPImageRepositoryValue(0x2001FCA2); @@ -111,6 +115,13 @@ iFormatMappings.Insert(KMTPValidCodeExtensionMappings[i].iExtension, KMTPValidCodeExtensionMappings[i].iFormatCode); } + //Initialize hash map of extension to mime type + count = sizeof(KMTPExtensionMimeTypeMappings) / sizeof(KMTPExtensionMimeTypeMappings[0]); + for(TInt i(0); iClearCacheL(); + __FLOG(_L8("<< SessionClosedL")); } @@ -552,19 +596,10 @@ /** * Get image object count from framework and calculate the new pictures */ - TUint curPictures = QueryImageObjectCountL(); - TInt newPictures = curPictures - iPrePictures; - - __FLOG_2(_L16("CMTPImageDpEnumerator::CompleteEnumeration - Previous Pics:%d, New Pics: %d"), iPrePictures, newPictures); - if (newPictures >= 0) - { - MTPImageDpUtilits::UpdateNewPicturesValue(*this, newPictures, ETrue); - } - else - { - MTPImageDpUtilits::UpdateNewPicturesValue(*this, 0, ETrue); - } - + TUint newPictures = QueryImageObjectCountL(); + RProperty::Set(TUid::Uid(KMTPServerUID), KMTPNewPicKey, newPictures); + iNewPicNotifier->SetNewPictures(newPictures); + __FLOG_1(_L16("CMTPImageDpEnumerator::CompleteEnumeration - New Pics: %d"), newPictures); iEnumerated = EFalse; } @@ -593,12 +628,39 @@ /** Find format code according to its extension name */ -TMTPFormatCode CMTPImageDataProvider::FindFormatL(const TDesC& aExtension) +TMTPFormatCode CMTPImageDataProvider::FindFormat(const TDesC& aExtension) { TMTPFormatCode* ret = iFormatMappings.Find(aExtension); - User::LeaveIfNull(ret); + if (ret == NULL) + { + return EMTPFormatCodeUndefined; + } + else + { + return *ret; + } + } + +/** + Find mime type according to its extension name +*/ +const TDesC& CMTPImageDataProvider::FindMimeType(const TDesC& aExtension) + { + /** + * copy file extension by insensitive case + */ + TBuf extension; + extension.CopyLC(aExtension); - return *ret; + const TDesC* ret = iMimeMappings.Find(extension); + if (ret == NULL) + { + return KNullDesC; + } + else + { + return *ret; + } } /** @@ -606,8 +668,40 @@ */ TUint CMTPImageDataProvider::QueryImageObjectCountL() { - TMTPObjectMgrQueryParams params(KMTPStorageAll, EMTPFormatCodeEXIFJPEG, KMTPHandleNone); - return Framework().ObjectMgr().CountL(params); + RMTPObjectMgrQueryContext context; + RArray handles; + TMTPObjectMgrQueryParams params(KMTPStorageAll, KMTPFormatsAll, KMTPHandleNone, Framework().DataProviderId()); + CleanupClosePushL(context); + CleanupClosePushL(handles); + + do + { + /* + * Speed up query performance, avoid to duplicated copy object handle between RArrays + */ + Framework().ObjectMgr().GetObjectHandlesL(params, context, handles); + } + while (!context.QueryComplete()); + + CMTPObjectMetaData* objMetadata = CMTPObjectMetaData::NewLC(); + + TUint newPictures = 0; + TInt count = handles.Count(); + for (TInt i(0); i> IncreaseNewPictures New Pictures: %d"), aCount)); + + iNewPicNotifier->IncreaseCount(aCount); + + __FLOG(_L8("<< IncreaseNewPictures ")); + } + +void CMTPImageDataProvider::DecreaseNewPictures(TInt aCount) + { + __FLOG_VA((_L16(">> DecreaseNewPictures New Pictures: %d"), aCount)); + + iNewPicNotifier->DecreaseCount(aCount); + + __FLOG(_L8("<< DecreaseNewPictures ")); + } diff -r d0791faffa3f -r aabe5387f5ce mtpdataproviders/mtpimagedp/src/cmtpimagedpcopyobject.cpp --- a/mtpdataproviders/mtpimagedp/src/cmtpimagedpcopyobject.cpp Tue Feb 02 01:11:40 2010 +0200 +++ b/mtpdataproviders/mtpimagedp/src/cmtpimagedpcopyobject.cpp Fri Mar 19 09:40:39 2010 +0200 @@ -85,6 +85,7 @@ */ CMTPImageDpCopyObject::CMTPImageDpCopyObject(MMTPDataProviderFramework& aFramework, MMTPConnection& aConnection,CMTPImageDataProvider& aDataProvider) : CMTPRequestProcessor(aFramework, aConnection, sizeof(KMTPCopyObjectPolicy)/sizeof(TMTPRequestElementInfo), KMTPCopyObjectPolicy), + iFramework(aFramework), iDataProvider(aDataProvider) { __FLOG_OPEN(KMTPSubsystem, KComponent); @@ -193,6 +194,13 @@ SetPreviousPropertiesL(aNewFileName); iFramework.ObjectMgr().InsertObjectL(*iTargetObjectInfo); + //check object whether it is a new image object + if (MTPImageDpUtilits::IsNewPicture(*iTargetObjectInfo)) + { + //increate new pictures count + iDataProvider.IncreaseNewPictures(1); + } + __FLOG(_L8("<< CMTPImageDpCopyObject::CopyFileL")); CleanupStack::Pop(this); return iTargetObjectInfo->Uint(CMTPObjectMetaData::EHandle); @@ -261,7 +269,7 @@ TVolumeInfo volumeInfo; User::LeaveIfError(iFramework.Fs().Volume(volumeInfo, drive)); - if(volumeInfo.iFree < fileEntry.iSize) + if(volumeInfo.iFree < fileEntry.FileSize()) { result = EMTPRespCodeStoreFull; } @@ -295,6 +303,7 @@ iTargetObjectInfo = CMTPObjectMetaData::NewL(); iTargetObjectInfo->SetUint(CMTPObjectMetaData::EDataProviderId, iSrcObjectInfo->Uint(CMTPObjectMetaData::EDataProviderId)); iTargetObjectInfo->SetUint(CMTPObjectMetaData::EFormatCode, iSrcObjectInfo->Uint(CMTPObjectMetaData::EFormatCode)); + iTargetObjectInfo->SetUint(CMTPObjectMetaData::EFormatSubCode, iSrcObjectInfo->Uint(CMTPObjectMetaData::EFormatSubCode)); iTargetObjectInfo->SetDesCL(CMTPObjectMetaData::EName, iSrcObjectInfo->DesC(CMTPObjectMetaData::EName)); iTargetObjectInfo->SetUint(CMTPObjectMetaData::ENonConsumable, iSrcObjectInfo->Uint(CMTPObjectMetaData::ENonConsumable)); iTargetObjectInfo->SetUint(CMTPObjectMetaData::EParentHandle, iNewParentHandle); diff -r d0791faffa3f -r aabe5387f5ce mtpdataproviders/mtpimagedp/src/cmtpimagedpdeleteobject.cpp --- a/mtpdataproviders/mtpimagedp/src/cmtpimagedpdeleteobject.cpp Tue Feb 02 01:11:40 2010 +0200 +++ b/mtpdataproviders/mtpimagedp/src/cmtpimagedpdeleteobject.cpp Fri Mar 19 09:40:39 2010 +0200 @@ -238,8 +238,13 @@ iDataProvider.AppendDeleteObjectsArrayL(iObjectMeta->DesC(CMTPObjectMetaData::ESuid)); case KErrNone: //add for test - __FLOG(_L8("KErrNone")); - iFramework.ObjectMgr().RemoveObjectL( iObjectMeta->Uint(CMTPObjectMetaData::EHandle )); + __FLOG(_L8("KErrNone")); + //if the image object is new, we should update new picture count + if (MTPImageDpUtilits::IsNewPicture(*iObjectMeta)) + { + iDataProvider.DecreaseNewPictures(1); + } + iFramework.ObjectMgr().RemoveObjectL( iObjectMeta->Uint(CMTPObjectMetaData::EHandle )); iObjectsNotDelete--; iResponseCode = EMTPRespCodePartialDeletion; break; @@ -261,6 +266,15 @@ { __FLOG(_L8(">> CMTPImageDpDeleteObject::StartL")); + if(iCancelled) + { + __FLOG(_L8("Cancell the delete")); + CMTPRequestProcessor::SendResponseL(EMTPRespCodeTransactionCancelled); + iObjectsToDelete.Reset(); + iCancelled = EFalse; + return; + } + TInt numObjectsToDelete = iObjectsToDelete.Count(); if ( numObjectsToDelete > 0 ) diff -r d0791faffa3f -r aabe5387f5ce mtpdataproviders/mtpimagedp/src/cmtpimagedpgetobject.cpp --- a/mtpdataproviders/mtpimagedp/src/cmtpimagedpgetobject.cpp Tue Feb 02 01:11:40 2010 +0200 +++ b/mtpdataproviders/mtpimagedp/src/cmtpimagedpgetobject.cpp Fri Mar 19 09:40:39 2010 +0200 @@ -77,7 +77,8 @@ Standard c++ constructor */ CMTPImageDpGetObject::CMTPImageDpGetObject(MMTPDataProviderFramework& aFramework, MMTPConnection& aConnection, CMTPImageDataProvider& aDataProvider) : - CMTPRequestProcessor(aFramework, aConnection, sizeof(KMTPGetObjectPolicy)/sizeof(TMTPRequestElementInfo), KMTPGetObjectPolicy), + CMTPRequestProcessor(aFramework, aConnection, sizeof(KMTPGetObjectPolicy)/sizeof(TMTPRequestElementInfo), KMTPGetObjectPolicy), + iFramework(aFramework), iDataProvider(aDataProvider) { @@ -106,7 +107,7 @@ __ASSERT_DEBUG(objectInfo, Panic(EMTPImageDpObjectNull)); BuildFileObjectL(objectInfo->DesC(CMTPObjectMetaData::ESuid)); - SendDataL(*iFileObject); + SendDataL(*iFileObject); __FLOG(_L8("<< CMTPImageDpGetObject::ServiceL")); } @@ -126,22 +127,22 @@ TBool CMTPImageDpGetObject::DoHandleCompletingPhaseL() { - __FLOG(_L8(" CMTPImageDpGetObject::DoHandleResponsePhaseL - Entry")); - TInt currentNewPics = 0; - iDataProvider.Repository().Get(ENewImagesCount, currentNewPics); - if (currentNewPics != 0) + __FLOG(_L8(" CMTPImageDpGetObject::DoHandleResponsePhaseL - Entry")); + + /** + * end-user does not cancel the operation, we think the getobject operation is successful. + */ + if (!iCancelled) { - /** - Zero the new pictures of RProperty. - Because we think the end-use has import all pictures as long as MTP receive one getobject operation - - There are two different phases to collect new pictures: - 1. In enumeration phase, calculate new pictures value from MSS in one go. - 2. After enumeration phase, dynamically calculate new pictures value from MdS by Notifications - */ - iDataProvider.Repository().Set(ENewImagesCount, 0); - RProperty::Set(TUid::Uid(KMTPServerUID), KMTPNewPicKey, 0); - } + TUint32 objectHandle = Request().Uint32(TMTPTypeRequest::ERequestParameter1); + CMTPObjectMetaData* objectInfo = iRequestChecker->GetObjectInfo(objectHandle); + if (MTPImageDpUtilits::IsNewPicture(*objectInfo)) + { + //update new picture status + MTPImageDpUtilits::UpdateObjectStatusToOldL(iFramework, *objectInfo); + iDataProvider.DecreaseNewPictures(1); + } + } __FLOG(_L8("CMTPImageDpGetObject::DoHandleResponsePhaseL - Exit")); return CMTPRequestProcessor::DoHandleCompletingPhaseL(); diff -r d0791faffa3f -r aabe5387f5ce mtpdataproviders/mtpimagedp/src/cmtpimagedpgetobjectpropdesc.cpp --- a/mtpdataproviders/mtpimagedp/src/cmtpimagedpgetobjectpropdesc.cpp Tue Feb 02 01:11:40 2010 +0200 +++ b/mtpdataproviders/mtpimagedp/src/cmtpimagedpgetobjectpropdesc.cpp Fri Mar 19 09:40:39 2010 +0200 @@ -170,6 +170,9 @@ case EMTPObjectPropCodeRepresentativeSampleWidth: ServiceRepresentativeSampleWidthL(); break; + case EMTPObjectPropCodeRepresentativeSampleData: + ServiceRepresentativeSampleDataL(); + break; case EMTPObjectPropCodeNonConsumable: ServiceNonConsumableL(); break; @@ -404,6 +407,19 @@ CleanupStack::PopAndDestroy(expectedForm); } +void CMTPImageDpGetObjectPropDesc::ServiceRepresentativeSampleDataL() + { + CMTPTypeObjectPropDesc::TPropertyInfo info; + info.iDataType = EMTPTypeAUINT8; + info.iFormFlag = CMTPTypeObjectPropDesc::EByteArrayForm; + info.iGetSet = CMTPTypeObjectPropDesc::EReadOnly; + + const TUint32 KMaxLength = 0x0000FFFF; + TMTPTypeUint32 expectedForm(KMaxLength); + + iObjectProperty = CMTPTypeObjectPropDesc::NewL(EMTPObjectPropCodeRepresentativeSampleData, info, &expectedForm); + } + void CMTPImageDpGetObjectPropDesc::ServiceNonConsumableL() { CMTPTypeObjectPropDescEnumerationForm* expectedForm = CMTPTypeObjectPropDescEnumerationForm::NewL(EMTPTypeUINT8); diff -r d0791faffa3f -r aabe5387f5ce mtpdataproviders/mtpimagedp/src/cmtpimagedpgetobjectproplist.cpp --- a/mtpdataproviders/mtpimagedp/src/cmtpimagedpgetobjectproplist.cpp Tue Feb 02 01:11:40 2010 +0200 +++ b/mtpdataproviders/mtpimagedp/src/cmtpimagedpgetobjectproplist.cpp Fri Mar 19 09:40:39 2010 +0200 @@ -373,6 +373,17 @@ } break; + case EMTPObjectPropCodeRepresentativeSampleData: + { + CMTPTypeArray* value = CMTPTypeArray::NewLC(EMTPTypeAUINT8); + iPropertyMgr.GetPropertyL(TMTPObjectPropertyCode(aPropCode), *value); + CMTPTypeObjectPropListElement& propElem = iPropertyList->ReservePropElemL(aHandle, propCode); + propElem.SetArrayL(CMTPTypeObjectPropListElement::EValue, *value); + iPropertyList->CommitPropElemL(propElem); + CleanupStack::PopAndDestroy(value); + } + break; + case EMTPObjectPropCodeObjectSize: { TUint64 value; diff -r d0791faffa3f -r aabe5387f5ce mtpdataproviders/mtpimagedp/src/cmtpimagedpgetobjectpropvalue.cpp --- a/mtpdataproviders/mtpimagedp/src/cmtpimagedpgetobjectpropvalue.cpp Tue Feb 02 01:11:40 2010 +0200 +++ b/mtpdataproviders/mtpimagedp/src/cmtpimagedpgetobjectpropvalue.cpp Fri Mar 19 09:40:39 2010 +0200 @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -64,6 +65,7 @@ CMTPImageDpGetObjectPropValue::~CMTPImageDpGetObjectPropValue() { delete iMTPTypeString; + delete iMTPTypeArray; delete iObjectMeta; __FLOG_CLOSE; } @@ -86,6 +88,7 @@ void CMTPImageDpGetObjectPropValue::ConstructL() { iMTPTypeString = CMTPTypeString::NewL(); + iMTPTypeArray = CMTPTypeArray::NewL(EMTPTypeAUINT8); iObjectMeta = CMTPObjectMetaData::NewL(); } @@ -181,6 +184,9 @@ case EMTPObjectPropCodeRepresentativeSampleWidth: ServiceRepresentativeSampleWidthL(); break; + case EMTPObjectPropCodeRepresentativeSampleData: + ServiceRepresentativeSampleDataL(); + break; case EMTPObjectPropCodeNonConsumable: ServiceNonConsumableL(); break; @@ -333,6 +339,13 @@ SendDataL(iMTPTypeUint32); } +void CMTPImageDpGetObjectPropValue::ServiceRepresentativeSampleDataL() + { + iObjectPropertyMgr.GetPropertyL(EMTPObjectPropCodeRepresentativeSampleData, *iMTPTypeArray); + + SendDataL(*iMTPTypeArray); + } + void CMTPImageDpGetObjectPropValue::ServiceNonConsumableL() { TUint8 nonConsumable; diff -r d0791faffa3f -r aabe5387f5ce mtpdataproviders/mtpimagedp/src/cmtpimagedpgetpartialobject.cpp --- a/mtpdataproviders/mtpimagedp/src/cmtpimagedpgetpartialobject.cpp Tue Feb 02 01:11:40 2010 +0200 +++ b/mtpdataproviders/mtpimagedp/src/cmtpimagedpgetpartialobject.cpp Fri Mar 19 09:40:39 2010 +0200 @@ -122,7 +122,7 @@ TEntry fileEntry; User::LeaveIfError(iFs.Entry(iObjectMeta->DesC(CMTPObjectMetaData::ESuid), fileEntry)); - if((iOffset < fileEntry.iSize)) + if((iOffset < fileEntry.FileSize())) { result = ETrue; } diff -r d0791faffa3f -r aabe5387f5ce mtpdataproviders/mtpimagedp/src/cmtpimagedpgetthumb.cpp --- a/mtpdataproviders/mtpimagedp/src/cmtpimagedpgetthumb.cpp Tue Feb 02 01:11:40 2010 +0200 +++ b/mtpdataproviders/mtpimagedp/src/cmtpimagedpgetthumb.cpp Fri Mar 19 09:40:39 2010 +0200 @@ -58,7 +58,7 @@ CMTPImageDpGetThumb::~CMTPImageDpGetThumb() { __FLOG(_L8(">> CMTPImageDpGetThumb::~CMTPImageDpGetThumb")); - delete iThumb; + delete iThumb; delete iObjectMeta; __FLOG(_L8("<< CMTPImageDpGetThumb::~CMTPImageDpGetThumb")); __FLOG_CLOSE; @@ -80,7 +80,7 @@ { __FLOG_OPEN(KMTPSubsystem, KComponent); __FLOG(_L8("CMTPImageDpGetThumb::ConstructL")); - iThumb = CMTPTypeOpaqueData::NewL(); + iThumb = CMTPTypeOpaqueData::NewL(); iObjectMeta = CMTPObjectMetaData::NewL(); __FLOG(_L8("CMTPImageDpGetThumb::ConstructL")); } @@ -102,17 +102,30 @@ { __FLOG(_L8(">> CMTPImageDpGetThumb::ServiceL")); TInt err = KErrNone; - TEntry fileEntry; - User::LeaveIfError(iFramework.Fs().Entry(iObjectMeta->DesC(CMTPObjectMetaData::ESuid), fileEntry)); - imgDp.ThumbnailManager().GetThumbMgr()->SetFlagsL(CThumbnailManager::EDefaultFlags); - if(fileEntry.iSize > KFileSizeMax) + //at first, try to query thumbnail from property manager + HBufC8* thumbnailData = imgDp.PropertyMgr().Thumbnail(iObjectMeta->Uint(CMTPObjectMetaData::EHandle)); + if (thumbnailData == NULL) { - __FLOG(_L8(">> CMTPImageDpGetThumb::ServiceL, fileEntry.iSize > KFileSizeMax")); - imgDp.ThumbnailManager().GetThumbMgr()->SetFlagsL(CThumbnailManager::EDoNotCreate); + __FLOG(_L8("CMTPImageDpGetThumb::ServiceL- fail to query thumbnail from cache")); + TEntry fileEntry; + + User::LeaveIfError(iFramework.Fs().Entry(iObjectMeta->DesC(CMTPObjectMetaData::ESuid), fileEntry)); + imgDp.ThumbnailManager().GetThumbMgr()->SetFlagsL(CThumbnailManager::EDefaultFlags); + if(fileEntry.FileSize() > KFileSizeMax) + { + __FLOG(_L8(">> CMTPImageDpGetThumb::ServiceL, fileEntry.FileSize() > KFileSizeMax")); + imgDp.ThumbnailManager().GetThumbMgr()->SetFlagsL(CThumbnailManager::EDoNotCreate); + } + + imgDp.ThumbnailManager().GetThumbnailL(iObjectMeta->DesC(CMTPObjectMetaData::ESuid), thumbnailData, err); + User::LeaveIfError(err); + User::LeaveIfNull(thumbnailData); + + //Transfer ownership of thumbnailData to Property Manager + imgDp.PropertyMgr().StoreThunmnail(iObjectMeta->Uint(CMTPObjectMetaData::EHandle), thumbnailData); } - imgDp.ThumbnailManager().GetThumbnailL(iObjectMeta->DesC(CMTPObjectMetaData::ESuid), *iThumb, err); - User::LeaveIfError(err); + iThumb->Write(*thumbnailData); SendDataL(*iThumb); __FLOG(_L8("<< CMTPImageDpGetThumb::ServiceL")); } diff -r d0791faffa3f -r aabe5387f5ce mtpdataproviders/mtpimagedp/src/cmtpimagedpmdeobserver.cpp --- a/mtpdataproviders/mtpimagedp/src/cmtpimagedpmdeobserver.cpp Tue Feb 02 01:11:40 2010 +0200 +++ b/mtpdataproviders/mtpimagedp/src/cmtpimagedpmdeobserver.cpp Fri Mar 19 09:40:39 2010 +0200 @@ -71,23 +71,20 @@ __FLOG_CLOSE; } -void CMTPImageDpMdeObserver::CreateMetadataL(const CMdEObject& aMdeObject, CMTPObjectMetaData& aMetaData) +void CMTPImageDpMdeObserver::CreateMetadataL(const TParsePtrC& aParse, TMTPFormatCode aFormat, TUint32 aParentHandle, CMTPObjectMetaData& aMetaData) { - const TDesC& uri = aMdeObject.Uri(); - TParsePtrC parse(uri); - TMTPFormatCode format = iDataProvider.FindFormatL(parse.Ext().Mid(1)); - TInt32 storageId = MTPImageDpUtilits::FindStorage(iFramework, uri); - TUint32 parentHandle = MTPImageDpUtilits::FindParentHandleL(iFramework, iDataProvider, uri); - + TInt32 storageId = MTPImageDpUtilits::FindStorage(iFramework, aParse.FullName()); + + __FLOG_VA((_L16("Addition - New Image:%S"), &aParse.FullName())); aMetaData.SetUint(CMTPObjectMetaData::EDataProviderId, iFramework.DataProviderId()); - aMetaData.SetUint(CMTPObjectMetaData::EFormatCode, format); + aMetaData.SetUint(CMTPObjectMetaData::EFormatCode, aFormat); aMetaData.SetUint(CMTPObjectMetaData::EStorageId, storageId); - aMetaData.SetDesCL(CMTPObjectMetaData::ESuid, uri); - aMetaData.SetUint(CMTPObjectMetaData::EParentHandle, parentHandle); - aMetaData.SetDesCL(CMTPObjectMetaData::EName, parse.Name()); + aMetaData.SetDesCL(CMTPObjectMetaData::ESuid, aParse.FullName()); + aMetaData.SetUint(CMTPObjectMetaData::EParentHandle, aParentHandle); + aMetaData.SetDesCL(CMTPObjectMetaData::EName, aParse.Name()); //Increate the new pictures variable - ++iNewPics; + ++iNewPics; } void CMTPImageDpMdeObserver::ProcessMdeNotificationL(const RArray& aObjectIdArray, TObserverNotificationType /*aType*/) @@ -109,26 +106,51 @@ continue; } CleanupStack::PushL(mdeObject); + __FLOG_VA((_L16("Addition - ObjectId:%u, URI:%S"), aObjectIdArray[i], &mdeObject->Uri())); - TUint32 handle = iFramework.ObjectMgr().HandleL(mdeObject->Uri()); - if (handle == KMTPHandleNone) + //filter out all image files other jpeg files + TParsePtrC parse(mdeObject->Uri()); + TMTPFormatCode format = iDataProvider.FindFormat(parse.Ext().Mid(1)); + if (format != EMTPFormatCodeUndefined) { - CMTPObjectMetaData* object = CMTPObjectMetaData::NewLC(); - CreateMetadataL(*mdeObject, *object); - iFramework.ObjectMgr().InsertObjectL(*object); - __FLOG_VA((_L16("Addition - Handle:%u, ObjectId:%u, URI:%S"), object->Uint(CMTPObjectMetaData::EHandle), aObjectIdArray[i], &mdeObject->Uri())); - - TMTPTypeEvent event; - event.SetUint16(TMTPTypeEvent::EEventCode, EMTPEventCodeObjectAdded); - event.SetUint32(TMTPTypeEvent::EEventSessionID, KMTPSessionAll); - event.SetUint32(TMTPTypeEvent::EEventTransactionID, KMTPTransactionIdNone); - - TUint32 handle = object->Uint(CMTPObjectMetaData::EHandle); - event.SetUint32(TMTPTypeEvent::EEventParameter1, handle); - iFramework.SendEventL(event); - __FLOG_VA((_L8("ProcessMdeNotificationL - EMTPEventCodeObjectAdd, object handle:%u"), handle)); - - CleanupStack::PopAndDestroy(object);//object + TUint32 handle = iFramework.ObjectMgr().HandleL(mdeObject->Uri()); + if (handle == KMTPHandleNone) + { + /** + * Try to find parent handle of new image file + * if we can't find parent handle we should issue a notification to framework, let framework to enumerate new folder if need + */ + TUint32 parentHandle = MTPImageDpUtilits::FindParentHandleL(iFramework, iDataProvider, parse.FullName()); + if (parentHandle == KMTPHandleNone) + { + __FLOG_VA((_L16("Notify framework - URI:%S"), &mdeObject->Uri())); + TMTPNotificationParamsFolderChange param = {mdeObject->Uri()}; + iFramework.NotifyFrameworkL(EMTPAddFolder, ¶m); + + //try to get parent handle if framework complete it's tasks + parentHandle = MTPImageDpUtilits::FindParentHandleL(iFramework, iDataProvider, parse.FullName()); + __FLOG_VA((_L16("Framework enumeration parent handle:%u"), parentHandle)); + } + + if (parentHandle != KMTPHandleNone) + { + CMTPObjectMetaData* object = CMTPObjectMetaData::NewLC(); + CreateMetadataL(parse, format, parentHandle, *object); + iFramework.ObjectMgr().InsertObjectL(*object); + __FLOG_VA((_L16("Addition - New Handle:%u"), object->Uint(CMTPObjectMetaData::EHandle))); + + TMTPTypeEvent event; + event.SetUint16(TMTPTypeEvent::EEventCode, EMTPEventCodeObjectAdded); + event.SetUint32(TMTPTypeEvent::EEventSessionID, KMTPSessionAll); + event.SetUint32(TMTPTypeEvent::EEventTransactionID, KMTPTransactionIdNone); + + TUint32 handle = object->Uint(CMTPObjectMetaData::EHandle); + event.SetUint32(TMTPTypeEvent::EEventParameter1, handle); + iFramework.SendEventL(event); + __FLOG_VA((_L8("ProcessMdeNotificationL - EMTPEventCodeObjectAdd, object handle:%u"), handle)); + CleanupStack::PopAndDestroy(object);//object + } + } } CleanupStack::PopAndDestroy(mdeObject);//mdeObject @@ -165,7 +187,7 @@ if (iNewPics > 0) { __FLOG_1(_L16("CMTPImageDpMdeObserver::CMTPImageDpMdeObserver - New Pics: %u"), iNewPics); - MTPImageDpUtilits::UpdateNewPicturesValue(iDataProvider, iNewPics, ETrue); + iDataProvider.IncreaseNewPictures(iNewPics); iNewPics = 0; } @@ -188,8 +210,8 @@ //Only subscribe add observer CMdELogicCondition* addCondition = CMdELogicCondition::NewLC(ELogicConditionOperatorAnd); - CMdEPropertyDef& itemTypePropDef = imageObjDef.GetPropertyDefL(MdeConstants::Object::KItemTypeProperty); - addCondition->AddPropertyConditionL(itemTypePropDef, ETextPropertyConditionCompareEndsWith, _L("jpeg")); + CMdEPropertyDef& itemTypePropDef = imageObjDef.GetPropertyDefL(MdeConstants::Object::KItemTypeProperty); + addCondition->AddObjectConditionL(imageObjDef); mdeSession.AddObjectObserverL(*this, addCondition, ENotifyAdd); CleanupStack::Pop(addCondition); diff -r d0791faffa3f -r aabe5387f5ce mtpdataproviders/mtpimagedp/src/cmtpimagedpmoveobject.cpp --- a/mtpdataproviders/mtpimagedp/src/cmtpimagedpmoveobject.cpp Tue Feb 02 01:11:40 2010 +0200 +++ b/mtpdataproviders/mtpimagedp/src/cmtpimagedpmoveobject.cpp Fri Mar 19 09:40:39 2010 +0200 @@ -281,7 +281,7 @@ TVolumeInfo volumeInfo; User::LeaveIfError(iFramework.Fs().Volume(volumeInfo, drive)); - if(volumeInfo.iFree < fileEntry.iSize) + if(volumeInfo.iFree < fileEntry.FileSize()) { result = EMTPRespCodeStoreFull; } diff -r d0791faffa3f -r aabe5387f5ce mtpdataproviders/mtpimagedp/src/cmtpimagedpnewpicturesnotifier.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mtpdataproviders/mtpimagedp/src/cmtpimagedpnewpicturesnotifier.cpp Fri Mar 19 09:40:39 2010 +0200 @@ -0,0 +1,97 @@ +// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +/** + @file + @internalTechnology +*/ + +#include + +#include "cmtpimagedp.h" +#include "mtpimagedpconst.h" +#include "cmtpimagedpnewpicturesnotifier.h" + +CMTPImageDpNewPicturesNotifier* CMTPImageDpNewPicturesNotifier::NewL() + { + CMTPImageDpNewPicturesNotifier* self = new (ELeave) CMTPImageDpNewPicturesNotifier(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +/** +Destructor. +*/ +CMTPImageDpNewPicturesNotifier::~CMTPImageDpNewPicturesNotifier() + { + Cancel(); + } + +void CMTPImageDpNewPicturesNotifier::SetNewPictures(TInt aValue) + { + iNewPictures = aValue; + } + +void CMTPImageDpNewPicturesNotifier::IncreaseCount(TInt aValue) + { + Cancel();//cancel the latest timer if we have + iNewPictures += aValue; + RProperty::Set(TUid::Uid(KMTPServerUID), KMTPNewPicKey, iNewPictures); + } + +void CMTPImageDpNewPicturesNotifier::DecreaseCount(TInt aValue) + { + iNewPictures -= aValue; + + Cancel();//cancel the latest timer if we have + if (iNewPictures > 0) + { + After(KImageDpNotifyDelay); + } + else + { + /** + * if the new pictures is equal to zero, then directly set RProperty' value + */ + iNewPictures = 0; + RProperty::Set(TUid::Uid(KMTPServerUID), KMTPNewPicKey, iNewPictures); + } + } + +void CMTPImageDpNewPicturesNotifier::RunL() + { + RProperty::Set(TUid::Uid(KMTPServerUID), KMTPNewPicKey, iNewPictures); + } + +/** +Constructor +*/ +CMTPImageDpNewPicturesNotifier::CMTPImageDpNewPicturesNotifier() : + CTimer(EPriorityNormal) + { + + } + +/** +Second phase constructor. +*/ +void CMTPImageDpNewPicturesNotifier::ConstructL() + { + CTimer::ConstructL(); + CActiveScheduler::Add(this); + } + diff -r d0791faffa3f -r aabe5387f5ce mtpdataproviders/mtpimagedp/src/cmtpimagedpobjectpropertymgr.cpp --- a/mtpdataproviders/mtpimagedp/src/cmtpimagedpobjectpropertymgr.cpp Tue Feb 02 01:11:40 2010 +0200 +++ b/mtpdataproviders/mtpimagedp/src/cmtpimagedpobjectpropertymgr.cpp Fri Mar 19 09:40:39 2010 +0200 @@ -26,11 +26,13 @@ #include #include #include +#include #include #include #include #include +#include #include #include #include @@ -38,7 +40,9 @@ #include #include +#include "cmtpimagedp.h" #include "cmtpimagedpobjectpropertymgr.h" +#include "cmtpimagedpthumbnailcreator.h" #include "mtpimagedppanic.h" #include "mtpimagedputilits.h" #include "mtpimagedpconst.h" @@ -114,6 +118,7 @@ void CMTPImageDpObjectPropertyMgr::CMTPImagePropertiesCache::ResetL() { + iObjectHandle = KMTPHandleNone; SetUint(EImagePixWidth, 0); SetUint(EImagePixHeight, 0); SetUint(EImageBitDepth, 0); @@ -157,16 +162,18 @@ iObjectHandle = aObjectHandle; } -CMTPImageDpObjectPropertyMgr* CMTPImageDpObjectPropertyMgr::NewL(MMTPDataProviderFramework& aFramework) +CMTPImageDpObjectPropertyMgr* CMTPImageDpObjectPropertyMgr::NewL(MMTPDataProviderFramework& aFramework, CMTPImageDataProvider& aDataProvider) { - CMTPImageDpObjectPropertyMgr* self = new (ELeave) CMTPImageDpObjectPropertyMgr(aFramework); + CMTPImageDpObjectPropertyMgr* self = new (ELeave) CMTPImageDpObjectPropertyMgr(aFramework, aDataProvider); CleanupStack::PushL(self); self->ConstructL(aFramework); CleanupStack::Pop(self); return self; } -CMTPImageDpObjectPropertyMgr::CMTPImageDpObjectPropertyMgr(MMTPDataProviderFramework& aFramework) : +CMTPImageDpObjectPropertyMgr::CMTPImageDpObjectPropertyMgr(MMTPDataProviderFramework& aFramework, CMTPImageDataProvider& aDataProvider) : + iFramework(aFramework), + iDataProvider(aDataProvider), iFs(aFramework.Fs()), iObjectMgr(aFramework.ObjectMgr()) { @@ -196,6 +203,7 @@ delete iObject; delete iMetaDataSession; delete iActiveSchedulerWait; + delete iThumbnailCache.iThumbnailData; __FLOG(_L8("CMTPImageDpObjectPropertyMgr::~CMTPImageDpObjectPropertyMgr - Exit")); __FLOG_CLOSE; } @@ -218,18 +226,20 @@ iCacheHit = ETrue; } else - { + { iCacheHit = EFalse; + + /** + * if cache miss, we should clear the cache content + */ + ClearCacheL(); - CMdENamespaceDef& defaultNamespace = iMetaDataSession->GetDefaultNamespaceDefL(); - CMdEObjectDef& imageObjDef = defaultNamespace.GetObjectDefL( MdeConstants::Image::KImageObject ); + //need parse image file by our self if fail to get properties from MdS + iNeedParse = ETrue; + + //clear previous Mde object delete iObject; - iObject = NULL; - - //if we can not open MdS object for getting properties, we will not get properites which stored in MdS - TFileName uri; - uri.CopyLC(iObjectInfo->DesC(CMTPObjectMetaData::ESuid)); - TRAP_IGNORE((iObject = iMetaDataSession->GetObjectL(uri, imageObjDef))); + iObject = NULL; } } else @@ -357,7 +367,7 @@ { TTime modifiedTime; ConvertMTPTimeStr2TTimeL(aValue, modifiedTime); - iFs.SetModified(iObjectInfo->DesC(CMTPObjectMetaData::ESuid), modifiedTime); + iFs.SetModified(iObjectInfo->DesC(CMTPObjectMetaData::ESuid), modifiedTime); } break; @@ -413,7 +423,9 @@ } break; default: - GetPropertyFromMdsL(aProperty, &aValue); + aValue = 0;//initialization + //ingore the failure if we can't get properties form MdS + TRAP_IGNORE(GetPropertyFromMdsL(aProperty, &aValue)); break; } __FLOG(_L8("<< CMTPImageDpObjectPropertyMgr::GetPropertyL")); @@ -434,20 +446,66 @@ aValue = iObjectInfo->Uint(CMTPObjectMetaData::EParentHandle); break; - case EMTPObjectPropCodeRepresentativeSampleSize: - aValue = KThumbCompressedSize; - break; + case EMTPObjectPropCodeRepresentativeSampleSize: + aValue = MTPImageDpUtilits::GetThumbnailSize(*iObjectInfo); + if (aValue == 0) + { + __FLOG_VA((_L16("Query smaple size from MdS - URI:%S"), &iObjectInfo->DesC(CMTPObjectMetaData::ESuid))); + ClearThumnailCache(); + /** + * try to query thumbnail from TNM, and then store thumbnail to cache + */ + TEntry fileEntry; + TInt err = iFs.Entry(iObjectInfo->DesC(CMTPObjectMetaData::ESuid), fileEntry); + if (err == KErrNone) + { + iDataProvider.ThumbnailManager().GetThumbMgr()->SetFlagsL(CThumbnailManager::EDefaultFlags); + if(fileEntry.FileSize() > KFileSizeMax) + { + iDataProvider.ThumbnailManager().GetThumbMgr()->SetFlagsL(CThumbnailManager::EDoNotCreate); + } + + /** + * trap the leave to avoid return general error when PC get object property list + */ + TRAP(err, iDataProvider.ThumbnailManager().GetThumbnailL(iObjectInfo->DesC(CMTPObjectMetaData::ESuid), iThumbnailCache.iThumbnailData, err)); + if (err == KErrNone) + { + iThumbnailCache.iObjectHandle = iObjectInfo->Uint(CMTPObjectMetaData::EHandle); + if (iThumbnailCache.iThumbnailData != NULL) + { + aValue = static_cast(iThumbnailCache.iThumbnailData->Size()); + } + + if (aValue > 0) + { + //update metadata column + MTPImageDpUtilits::UpdateObjectThumbnailSizeL(iFramework, *iObjectInfo, aValue); + } + else + { + //trigger initiator to re-query thumbnail again if the thumbnail size of response is zero + aValue = KThumbCompressedSize; + } + + __FLOG_VA((_L16("Cache miss:GetThumbnailSize - URI:%S, Size:%u"), &iObjectInfo->DesC(CMTPObjectMetaData::ESuid), aValue)); + } + } + } + break; case EMTPObjectPropCodeRepresentativeSampleHeight: aValue = KThumbHeigth; - break; + break; case EMTPObjectPropCodeRepresentativeSampleWidth: aValue = KThumbWidht; - break; + break; default: - GetPropertyFromMdsL(aProperty, &aValue); + aValue = 0;//initialization + //ingore the failure if we can't get properties form MdS + TRAP_IGNORE(GetPropertyFromMdsL(aProperty, &aValue)); break; } __FLOG(_L8("<< CMTPImageDpObjectPropertyMgr::GetPropertyL")); @@ -522,149 +580,205 @@ break; default: - GetPropertyFromMdsL(aProperty, &aValue); + //ingore the failure if we can't get properties form MdS + TRAP_IGNORE(GetPropertyFromMdsL(aProperty, &aValue)); break; } __FLOG(_L8("<< CMTPImageDpObjectPropertyMgr::GetPropertyL")); } +void CMTPImageDpObjectPropertyMgr::GetPropertyL(TMTPObjectPropertyCode aProperty, CMTPTypeArray& aValue) + { + __FLOG(_L8(">> CMTPImageDpObjectPropertyMgr::GetPropertyL -- SmapleData")); + + if (aProperty == EMTPObjectPropCodeRepresentativeSampleData) + { + HBufC8* tnBuf = Thumbnail(iObjectInfo->Uint(CMTPObjectMetaData::EHandle)); + if (tnBuf != NULL) + { + aValue.SetByDesL(*tnBuf); + } + else + { + ClearThumnailCache(); + /** + * try to query thumbnail from TNM, and then store thumbnail to cache + */ + TEntry fileEntry; + TInt err = iFs.Entry(iObjectInfo->DesC(CMTPObjectMetaData::ESuid), fileEntry); + if (err == KErrNone) + { + iDataProvider.ThumbnailManager().GetThumbMgr()->SetFlagsL(CThumbnailManager::EDefaultFlags); + if(fileEntry.FileSize() > KFileSizeMax) + { + iDataProvider.ThumbnailManager().GetThumbMgr()->SetFlagsL(CThumbnailManager::EDoNotCreate); + } + + /** + * trap the leave to avoid return general error when PC get object property list + */ + TRAP(err, iDataProvider.ThumbnailManager().GetThumbnailL(iObjectInfo->DesC(CMTPObjectMetaData::ESuid), iThumbnailCache.iThumbnailData, err)); + if (err == KErrNone) + { + TInt size = MTPImageDpUtilits::GetThumbnailSize(*iObjectInfo); + iThumbnailCache.iObjectHandle = iObjectInfo->Uint(CMTPObjectMetaData::EHandle); + if (iThumbnailCache.iThumbnailData != NULL) + { + aValue.SetByDesL(*iThumbnailCache.iThumbnailData); + if (size == 0) + { + //update metadata column + MTPImageDpUtilits::UpdateObjectThumbnailSizeL(iFramework, *iObjectInfo, iThumbnailCache.iThumbnailData->Size()); + __FLOG_VA((_L16("Cache miss:GetThumbnailSize - URI:%S, Size:%u"), &iObjectInfo->DesC(CMTPObjectMetaData::ESuid), size)); + } + } + } + } + } + } + else + { + User::Leave(EMTPRespCodeObjectPropNotSupported); + } + } + void CMTPImageDpObjectPropertyMgr::GetPropertyFromMdsL(TMTPObjectPropertyCode aProperty, TAny* aValue) { __FLOG(_L8(">> CMTPImageDpObjectPropertyMgr::GetPropertyFromMdsL")); TInt err = KErrNone; - CMdENamespaceDef& defaultNamespace = iMetaDataSession->GetDefaultNamespaceDefL(); - CMdEObjectDef& imageObjDef = defaultNamespace.GetObjectDefL( MdeConstants::Image::KImageObject ); - CMdEProperty* mdeProperty = NULL; - switch (aProperty) - { - case EMTPObjectPropCodeDateCreated: + + if (iCacheHit) { - if (iCacheHit) + /** + * The object hit the cache, so we query properties from cache + */ + switch (aProperty) { - (*(static_cast(aValue))).SetL(iPropertiesCache->DesC(CMTPImageDpObjectPropertyMgr::CMTPImagePropertiesCache::EDateCreated)); + case EMTPObjectPropCodeDateCreated: + (*(static_cast(aValue))).SetL(iPropertiesCache->DesC(CMTPImageDpObjectPropertyMgr::CMTPImagePropertiesCache::EDateCreated)); + break; + + case EMTPObjectPropCodeWidth: + *static_cast(aValue) = iPropertiesCache->Uint(CMTPImageDpObjectPropertyMgr::CMTPImagePropertiesCache::EImagePixWidth); + break; + + case EMTPObjectPropCodeHeight: + *static_cast(aValue) = iPropertiesCache->Uint(CMTPImageDpObjectPropertyMgr::CMTPImagePropertiesCache::EImagePixHeight); + break; + + case EMTPObjectPropCodeImageBitDepth: + *static_cast(aValue) = iPropertiesCache->Uint(CMTPImageDpObjectPropertyMgr::CMTPImagePropertiesCache::EImageBitDepth); + break; + + default: + //nothing to do + break; } - else if (iObject) + } + else + { + /** + * The object miss cache, so we should open Mde object to query properties + */ + OpenMdeObjectL(); + + CMdENamespaceDef& defaultNamespace = iMetaDataSession->GetDefaultNamespaceDefL(); + CMdEObjectDef& imageObjDef = defaultNamespace.GetObjectDefL( MdeConstants::Image::KImageObject ); + CMdEProperty* mdeProperty = NULL; + + switch (aProperty) { - CMdEPropertyDef& creationDatePropDef = imageObjDef.GetPropertyDefL(MdeConstants::Object::KCreationDateProperty); - TInt err = iObject->Property( creationDatePropDef, mdeProperty ); - if (err >= KErrNone) - { - TBuf timeValue; - // locale independent YYYYMMSSThhmmss, as required by the MTP spec - _LIT(KTimeFormat, "%F%Y%M%DT%H%T%S"); - mdeProperty->TimeValueL().FormatL(timeValue, KTimeFormat); - (*(static_cast(aValue))).SetL(timeValue); + case EMTPObjectPropCodeDateCreated: + { + if (iObject) + { + CMdEPropertyDef& creationDatePropDef = imageObjDef.GetPropertyDefL(MdeConstants::Object::KCreationDateProperty); + TInt err = iObject->Property( creationDatePropDef, mdeProperty ); + if (err >= KErrNone) + { + TBuf timeValue; + // locale independent YYYYMMSSThhmmss, as required by the MTP spec + _LIT(KTimeFormat, "%F%Y%M%DT%H%T%S"); + mdeProperty->TimeValueL().FormatL(timeValue, KTimeFormat); + (*(static_cast(aValue))).SetL(timeValue); + + __FLOG_VA((_L16("GetPropertyFromMdsL - from MdS: URI:%S, DateCreated:%S"), &iObjectInfo->DesC(CMTPObjectMetaData::ESuid), &timeValue)); + } } } - } - break; - - case EMTPObjectPropCodeWidth: - { - if (iCacheHit) + break; + + case EMTPObjectPropCodeWidth: { - *static_cast(aValue) = iPropertiesCache->Uint(CMTPImageDpObjectPropertyMgr::CMTPImagePropertiesCache::EImagePixWidth); - } - else if (iObject) - { - CMdEPropertyDef& imageWidthPropDef = imageObjDef.GetPropertyDefL(MdeConstants::MediaObject::KWidthProperty); - err = iObject->Property( imageWidthPropDef, mdeProperty ); - if (err >= KErrNone) + if (iObject) { - TUint16 width = mdeProperty->Uint16ValueL(); - if (width > 0) + CMdEPropertyDef& imageWidthPropDef = imageObjDef.GetPropertyDefL(MdeConstants::MediaObject::KWidthProperty); + err = iObject->Property( imageWidthPropDef, mdeProperty ); + if (err >= KErrNone) { - *static_cast(aValue) = width; + *static_cast(aValue) = mdeProperty->Uint16ValueL(); } else { - *static_cast(aValue) = ParseImageFileL(iObject->Uri(), EMTPObjectPropCodeWidth); + *static_cast(aValue) = 0; } } else { - *static_cast(aValue) = ParseImageFileL(iObject->Uri(), EMTPObjectPropCodeWidth); + *static_cast(aValue) = 0; } } - else - { - *static_cast(aValue) = 0; - } - } - break; - - case EMTPObjectPropCodeHeight: - { - if (iCacheHit) + break; + + case EMTPObjectPropCodeHeight: { - *static_cast(aValue) = iPropertiesCache->Uint(CMTPImageDpObjectPropertyMgr::CMTPImagePropertiesCache::EImagePixHeight); - } - else if (iObject) - { - CMdEPropertyDef& imageHeightPropDef = imageObjDef.GetPropertyDefL(MdeConstants::MediaObject::KHeightProperty); - err = iObject->Property( imageHeightPropDef, mdeProperty ); - if (err >= KErrNone) + if (iObject) { - TUint16 height = mdeProperty->Uint16ValueL(); - if (height > 0) + CMdEPropertyDef& imageHeightPropDef = imageObjDef.GetPropertyDefL(MdeConstants::MediaObject::KHeightProperty); + err = iObject->Property( imageHeightPropDef, mdeProperty ); + if (err >= KErrNone) { - *static_cast(aValue) = height; + *static_cast(aValue) = mdeProperty->Uint16ValueL(); } else { - *static_cast(aValue) = ParseImageFileL(iObject->Uri(), EMTPObjectPropCodeHeight); + *static_cast(aValue) = 0; } } else { - *static_cast(aValue) = ParseImageFileL(iObject->Uri(), EMTPObjectPropCodeHeight); + *static_cast(aValue) = 0; } } - else - { - *static_cast(aValue) = 0; - } - } - break; - - case EMTPObjectPropCodeImageBitDepth: - { - if (iCacheHit) + break; + + case EMTPObjectPropCodeImageBitDepth: { - *static_cast(aValue) = iPropertiesCache->Uint(CMTPImageDpObjectPropertyMgr::CMTPImagePropertiesCache::EImageBitDepth); - } - else if (iObject) - { - CMdEPropertyDef& imageBitDepth = imageObjDef.GetPropertyDefL(MdeConstants::Image::KBitsPerSampleProperty); - err = iObject->Property( imageBitDepth, mdeProperty ); - if (err >= KErrNone) + if (iObject) { - TUint16 bitDepth = mdeProperty->Uint16ValueL(); - if (bitDepth > 0) + CMdEPropertyDef& imageBitDepth = imageObjDef.GetPropertyDefL(MdeConstants::Image::KBitsPerSampleProperty); + err = iObject->Property( imageBitDepth, mdeProperty ); + if (err >= KErrNone) { - *static_cast(aValue) = bitDepth; + *static_cast(aValue) = mdeProperty->Uint16ValueL(); } else { - *static_cast(aValue) = ParseImageFileL(iObject->Uri(), EMTPObjectPropCodeImageBitDepth); - } + *static_cast(aValue) = 0; + } } else { - *static_cast(aValue) = ParseImageFileL(iObject->Uri(), EMTPObjectPropCodeImageBitDepth); - } + *static_cast(aValue) = 0; + } + } + break; + + default: + //nothing to do + break; } - else - { - *static_cast(aValue) = 0; - } - } - break; - - default: - //nothing to do - break; } __FLOG(_L8("<< CMTPImageDpObjectPropertyMgr::GetPropertyFromMdsL")); } @@ -781,7 +895,7 @@ ||!GetMinute(aTimeString,minute) ||!GetSecond(aTimeString,second) ||!GetTenthSecond(aTimeString,tenthSecond)) - { + { User::Leave(KErrArgument); } else @@ -803,93 +917,30 @@ } } -TUint32 CMTPImageDpObjectPropertyMgr::ParseImageFileL(const TDesC& aUri, TMTPObjectPropertyCode aPropCode) +/** + * Store thumbnail into cache + */ +void CMTPImageDpObjectPropertyMgr::StoreThunmnail(TUint aHandle, HBufC8* aData) { - TUint32 result = 0; - TInt err = KErrNone; - const TInt K64Kb = 65536; + ClearThumnailCache(); - HBufC8* buffer = HBufC8::NewLC(K64Kb); - TPtr8 myImagePtr = buffer->Des(); - err = iFs.ReadFileSection(aUri, 0, myImagePtr, K64Kb); - if (err != KErrNone) - { - CleanupStack::PopAndDestroy(buffer); - return result; - } - - CBufferedImageDecoder *decoder = CBufferedImageDecoder::NewL(iFs); - CleanupStack::PushL(decoder); - - decoder->OpenL(myImagePtr, CImageDecoder::TOptions( CImageDecoder::EPreferFastDecode | CImageDecoder::EOptionIgnoreExifMetaData)); - if (decoder->ValidDecoder()) + iThumbnailCache.iObjectHandle = aHandle; + iThumbnailCache.iThumbnailData = aData; + } + +/** + * Get thumbnail from cache + */ +HBufC8* CMTPImageDpObjectPropertyMgr::Thumbnail(TUint aHandle) + { + if (iThumbnailCache.iObjectHandle == aHandle) { - const TFrameInfo& info = decoder->FrameInfo(); - - switch (aPropCode) - { - case EMTPObjectPropCodeWidth: - result = info.iOverallSizeInPixels.iWidth; - break; - - case EMTPObjectPropCodeHeight: - result = info.iOverallSizeInPixels.iHeight; - break; - - case EMTPObjectPropCodeImageBitDepth: - result = info.iBitsPerPixel; - break; - - default: - // nothing to do - break; - } - - /** - * Open MdE object for update image object properties after parsing - */ - CMdENamespaceDef& defaultNamespace = iMetaDataSession->GetDefaultNamespaceDefL(); - CMdEObjectDef& imageObjDef = defaultNamespace.GetObjectDefL(MdeConstants::Image::KImageObject); - CMdEPropertyDef& imageWidthPropDef = imageObjDef.GetPropertyDefL(MdeConstants::MediaObject::KWidthProperty); - CMdEPropertyDef& imageHeightPropDef = imageObjDef.GetPropertyDefL(MdeConstants::MediaObject::KHeightProperty); - CMdEPropertyDef& imageBitDepth = imageObjDef.GetPropertyDefL(MdeConstants::Image::KBitsPerSampleProperty); - - //update current object properties - TUint16 width = info.iOverallSizeInPixels.iWidth; - RemoveProperty(*iObject, imageWidthPropDef); - iObject->AddUint16PropertyL(imageWidthPropDef, width); - - TUint16 height = info.iOverallSizeInPixels.iHeight; - RemoveProperty(*iObject, imageHeightPropDef); - iObject->AddUint16PropertyL(imageHeightPropDef, height); - - TUint16 bitsPerPixel = info.iBitsPerPixel; - RemoveProperty(*iObject, imageBitDepth); - iObject->AddUint16PropertyL(imageBitDepth, bitsPerPixel); - - CMdEObject* updateObject = NULL; - TRAP(err, updateObject = iMetaDataSession->OpenObjectL(iObject->Id(), imageObjDef)); - if (err == KErrNone && updateObject != NULL) - { - CleanupStack::PushL(updateObject); - - RemoveProperty(*updateObject, imageWidthPropDef); - updateObject->AddUint16PropertyL(imageWidthPropDef, width); - - RemoveProperty(*updateObject, imageHeightPropDef); - updateObject->AddUint16PropertyL(imageHeightPropDef, height); - - RemoveProperty(*updateObject, imageBitDepth); - updateObject->AddUint16PropertyL(imageBitDepth, bitsPerPixel); - - iMetaDataSession->CommitObjectL(*updateObject); - CleanupStack::PopAndDestroy(updateObject); - } + return iThumbnailCache.iThumbnailData; } - - CleanupStack::PopAndDestroy(2);// decoder, buffer - - return result; + else + { + return NULL; + } } /** @@ -933,3 +984,27 @@ { iPropertiesCache->ResetL(); } + +void CMTPImageDpObjectPropertyMgr::OpenMdeObjectL() + { + if (iObject == NULL) + { + __FLOG_VA((_L16("OpenMdeObjectL - URI = %S"), &iObjectInfo->DesC(CMTPObjectMetaData::ESuid))); + + CMdENamespaceDef& defaultNamespace = iMetaDataSession->GetDefaultNamespaceDefL(); + CMdEObjectDef& imageObjDef = defaultNamespace.GetObjectDefL( MdeConstants::Image::KImageObject ); + + //if we can not open MdS object for getting properties, we will not get properites which stored in MdS + TFileName uri; + uri.CopyLC(iObjectInfo->DesC(CMTPObjectMetaData::ESuid)); + TRAP_IGNORE((iObject = iMetaDataSession->GetObjectL(uri, imageObjDef))); + } + } + +void CMTPImageDpObjectPropertyMgr::ClearThumnailCache() + { + delete iThumbnailCache.iThumbnailData; + iThumbnailCache.iThumbnailData = NULL; + + iThumbnailCache.iObjectHandle = KMTPHandleNone; + } diff -r d0791faffa3f -r aabe5387f5ce mtpdataproviders/mtpimagedp/src/cmtpimagedpsendobjectinfo.cpp --- a/mtpdataproviders/mtpimagedp/src/cmtpimagedpsendobjectinfo.cpp Tue Feb 02 01:11:40 2010 +0200 +++ b/mtpdataproviders/mtpimagedp/src/cmtpimagedpsendobjectinfo.cpp Fri Mar 19 09:40:39 2010 +0200 @@ -848,7 +848,7 @@ if (err != KErrNone) { //add Suid to deleteobjectlist - iDataProvider.AppendDeleteObjectsArrayL(iFullPath); + TRAP_IGNORE(iDataProvider.AppendDeleteObjectsArrayL(iFullPath)); } } @@ -1166,6 +1166,12 @@ responseCode = EMTPRespCodeInvalidObjectPropFormat; } break; + case EMTPObjectPropCodeRepresentativeSampleData: + if (aElement.Uint16L(CMTPTypeObjectPropListElement::EDatatype) != EMTPTypeAUINT8) + { + responseCode = EMTPRespCodeInvalidObjectPropFormat; + } + break; case EMTPObjectPropCodeNonConsumable: if (aElement.Uint16L(CMTPTypeObjectPropListElement::EDatatype) != EMTPTypeUINT8) { @@ -1188,7 +1194,9 @@ void CMTPImageDpSendObjectInfo::ReserveObjectL() { __FLOG(_L8("CMTPImageDpSendObjectInfo::ReserveObjectL - Entry")); - + const TInt objectStatusBitmask = 0x8000;//the most significant bit represents importing flag + + iReceivedObject->SetUint(CMTPObjectMetaData::EFormatSubCode, objectStatusBitmask);//mark object imported due to it sent by PC iReceivedObject->SetUint(CMTPObjectMetaData::EStorageId, iStorageId); iFramework.ObjectMgr().ReserveObjectHandleL(*iReceivedObject, iObjectSize); diff -r d0791faffa3f -r aabe5387f5ce mtpdataproviders/mtpimagedp/src/cmtpimagedpsetobjectproplist.cpp --- a/mtpdataproviders/mtpimagedp/src/cmtpimagedpsetobjectproplist.cpp Tue Feb 02 01:11:40 2010 +0200 +++ b/mtpdataproviders/mtpimagedp/src/cmtpimagedpsetobjectproplist.cpp Fri Mar 19 09:40:39 2010 +0200 @@ -162,7 +162,8 @@ case EMTPObjectPropCodeRepresentativeSampleSize: case EMTPObjectPropCodeRepresentativeSampleHeight: case EMTPObjectPropCodeRepresentativeSampleWidth: - case EMTPObjectPropCodeDateCreated: + case EMTPObjectPropCodeRepresentativeSampleData: + case EMTPObjectPropCodeDateCreated: responseCode = EMTPRespCodeAccessDenied; break; diff -r d0791faffa3f -r aabe5387f5ce mtpdataproviders/mtpimagedp/src/cmtpimagedpsetobjectpropvalue.cpp --- a/mtpdataproviders/mtpimagedp/src/cmtpimagedpsetobjectpropvalue.cpp Tue Feb 02 01:11:40 2010 +0200 +++ b/mtpdataproviders/mtpimagedp/src/cmtpimagedpsetobjectpropvalue.cpp Fri Mar 19 09:40:39 2010 +0200 @@ -99,7 +99,8 @@ || aObjectPropCode == EMTPObjectPropCodeRepresentativeSampleFormat || aObjectPropCode == EMTPObjectPropCodeRepresentativeSampleSize || aObjectPropCode == EMTPObjectPropCodeRepresentativeSampleHeight - || aObjectPropCode == EMTPObjectPropCodeRepresentativeSampleWidth) + || aObjectPropCode == EMTPObjectPropCodeRepresentativeSampleWidth + || aObjectPropCode == EMTPObjectPropCodeRepresentativeSampleData) { returnCode = ETrue; } diff -r d0791faffa3f -r aabe5387f5ce mtpdataproviders/mtpimagedp/src/cmtpimagedpthumbnailcreator.cpp --- a/mtpdataproviders/mtpimagedp/src/cmtpimagedpthumbnailcreator.cpp Tue Feb 02 01:11:40 2010 +0200 +++ b/mtpdataproviders/mtpimagedp/src/cmtpimagedpthumbnailcreator.cpp Fri Mar 19 09:40:39 2010 +0200 @@ -30,6 +30,7 @@ #include "cmtpimagedpthumbnailcreator.h" #include "mtpimagedpconst.h" #include "mtpimagedputilits.h" +#include "cmtpimagedp.h" __FLOG_STMT(_LIT8(KComponent,"CMTPImageDpThumbnailCreator");) // -------------------------------------------------------------------------- @@ -37,9 +38,9 @@ // 2-phased constructor. // -------------------------------------------------------------------------- // -CMTPImageDpThumbnailCreator* CMTPImageDpThumbnailCreator::NewL() +CMTPImageDpThumbnailCreator* CMTPImageDpThumbnailCreator::NewL(CMTPImageDataProvider& aDataProvider) { - CMTPImageDpThumbnailCreator* self= new (ELeave) CMTPImageDpThumbnailCreator(); + CMTPImageDpThumbnailCreator* self= new (ELeave) CMTPImageDpThumbnailCreator(aDataProvider); CleanupStack::PushL(self); self->ConstructL(); CleanupStack::Pop(self); @@ -82,8 +83,9 @@ // C++ constructor. // -------------------------------------------------------------------------- // -CMTPImageDpThumbnailCreator::CMTPImageDpThumbnailCreator(): -CActive(EPriorityStandard) +CMTPImageDpThumbnailCreator::CMTPImageDpThumbnailCreator(CMTPImageDataProvider& aDataProvider): + CActive(EPriorityStandard), + iDataProvider(aDataProvider) { __FLOG_OPEN(KMTPSubsystem, KComponent); __FLOG(_L8("CMTPImageDpThumbnailCreator::CMTPImageDpThumbnailCreator(), begin")); @@ -100,7 +102,7 @@ { __FLOG(_L8("CMTPImageDpThumbnailCreator::ConstructL(), begin")); iThumbMgr = CThumbnailManager::NewL( *this ); - iThumbMgr->SetThumbnailSizeL( EFullScreenThumbnailSize ); + iThumbMgr->SetThumbnailSizeL( EGridThumbnailSize ); #ifdef MTPTHUMBSCALING iScaler = CBitmapScaler::NewL(); #endif @@ -171,10 +173,6 @@ __FLOG_VA((_L8("CMTPImageDpThumbnailCreator::RunL(),EDoNotCreate; iState %d"), iState)); delete iData; iData = HBufC8::NewL(1); - iBuffer->Write(*iData); - } - else{ - iBuffer->Write(*iData); } __FLOG_VA((_L8("<< CMTPImageDpThumbnailCreator::RunL(),iBuffer->Write(*iData); iState %d"), iState)); @@ -215,15 +213,27 @@ // // -------------------------------------------------------------------------- // -void CMTPImageDpThumbnailCreator::GetThumbnailL(const TDesC& aFileName, CMTPTypeOpaqueData& aThumbName, TInt& result) +void CMTPImageDpThumbnailCreator::GetThumbnailL(const TDesC& aFileName, HBufC8*& aDestinationData, TInt& result) { __FLOG(_L8(">> CMtpImageDphumbnailCreator::GetThumbnailL()")); - iBuffer = &aThumbName; GetThumbL(aFileName); - iCreationErr = &result; //reset the err flag + iCreationErr = &result; //reset the err flag *iCreationErr = KErrNone; __FLOG(_L8("<< CMTPImageDpThumbnailCreator::CreateThumbnailL()")); iActiveSchedulerWait->Start(); + + /** + * transfer the ownership of iData if query successfully + */ + if (*iCreationErr == KErrNone) + { + aDestinationData = iData; + iData = NULL; + } + else + { + aDestinationData = NULL; + } } // -------------------------------------------------------------------------- @@ -250,7 +260,11 @@ delete iObjectSource; iObjectSource = NULL; - iObjectSource = CThumbnailObjectSource::NewL(aFileName, KJpegMimeType); + TParsePtrC parse(aFileName); + const TDesC& mimeType = iDataProvider.FindMimeType(parse.Ext().Mid(1)); + __FLOG_VA((_L16("CMtpImageDphumbnailCreator::GetThumbL() - FileName:%S, MimeType:%S"), &aFileName, &mimeType)); + + iObjectSource = CThumbnailObjectSource::NewL(aFileName, mimeType); iCurrentReq = iThumbMgr->GetThumbnailL( *iObjectSource ); iState = EGetting; __FLOG(_L8("<< CMtpImageDphumbnailCreator::GetThumbL()")); @@ -267,7 +281,16 @@ __FLOG(_L8("CMTPImageDpThumbnailCreator::ScaleBitmapL(), begin")); TSize size( KThumbWidht, KThumbHeigth ); // size 160x120 // Resize image to thumbnail size - iScaler->Scale( &iStatus, *iBitmap, size ); +// iScaler->Scale( &iStatus, *iBitmap, size ); + + /** + * [Thumbnail SIZE]: performance improvement + * comments scaling code, but it breaks PTP spect. + * so if we meet any break of compatible test, we should re-scale thumbnail size + */ + TRequestStatus* status = &iStatus; + User::RequestComplete( status, KErrNone ); + SetActive(); __FLOG(_L8("CMTPImageDpThumbnailCreator::ScaleBitmapL(), end")); } @@ -309,7 +332,7 @@ if (aError == KErrNone) { TRAP_IGNORE(iThumbMgr->SetFlagsL(CThumbnailManager::EDefaultFlags)); - delete iBitmap; + delete iBitmap; // Claim ownership of the bitmap instance for later use iBitmap = aThumbnail.DetachBitmap(); #ifdef MTPTHUMBSCALING @@ -322,7 +345,8 @@ { __FLOG(_L8("CMTPImageDpThumbnailCreator::ThumbnailReady(),EDoNotCreate, KErrNotFound")); iState = EEncoding; - iThumbMgr->CreateThumbnails(*iObjectSource); + //don't trigger TNM to create thumbnail if image files are too big + //iThumbMgr->CreateThumbnails(*iObjectSource); aError = KErrNone; } iStatus=KRequestPending; diff -r d0791faffa3f -r aabe5387f5ce mtpdataproviders/mtpimagedp/src/mtpimagedpgetformatcapabilities.cpp --- a/mtpdataproviders/mtpimagedp/src/mtpimagedpgetformatcapabilities.cpp Tue Feb 02 01:11:40 2010 +0200 +++ b/mtpdataproviders/mtpimagedp/src/mtpimagedpgetformatcapabilities.cpp Fri Mar 19 09:40:39 2010 +0200 @@ -169,6 +169,14 @@ CleanupStack::Pop(1, desc); CleanupStack::PopAndDestroy(expectedForm); + const TUint32 KMaxLength = 0x0000FFFF; + TMTPTypeUint32 maxLengthForm(KMaxLength); + info.iDataType = EMTPTypeAUINT8; + info.iFormFlag = CMTPTypeObjectPropDesc::EByteArrayForm; + desc = CMTPTypeObjectPropDesc::NewLC(EMTPObjectPropCodeRepresentativeSampleData, info, &maxLengthForm); + frmCap->AppendL(desc); + CleanupStack::Pop(1, desc); + info.iDataType = EMTPTypeUINT16; info.iFormFlag = CMTPTypeObjectPropDesc::EEnumerationForm; CMTPTypeObjectPropDescEnumerationForm* expectedEnumForm = CMTPTypeObjectPropDescEnumerationForm::NewL(EMTPTypeUINT16); diff -r d0791faffa3f -r aabe5387f5ce mtpdataproviders/mtpimagedp/src/mtpimagedputilits.cpp --- a/mtpdataproviders/mtpimagedp/src/mtpimagedputilits.cpp Tue Feb 02 01:11:40 2010 +0200 +++ b/mtpdataproviders/mtpimagedp/src/mtpimagedputilits.cpp Fri Mar 19 09:40:39 2010 +0200 @@ -30,6 +30,20 @@ #include "mtpimagedputilits.h" #include "cmtpimagedp.h" +/* + * The most significant bit represents whether the image object has been imported. + * 0 means does not be imported + * 1 means has been imported + */ +#define IMAGE_OBJECT_STATUS_BITMASK 0x8000 + +/** + * The other left bits represent the thumbnail size of image object. + * The type of EFormatSubCode column is UINT16, so these bits are enought for thumbnail size. + * e.g. The image file of 57M bytes only has 2440 bytes of thumbnail. + */ +#define IMAGE_OBJECT_THUMBNAIL_SIZE_BITMASK 0x7fff + TMTPResponseCode MTPImageDpUtilits::VerifyObjectHandleL(MMTPDataProviderFramework& aFramework, const TMTPTypeUint32& aHandle, CMTPObjectMetaData& aMetaData) { if (!aFramework.ObjectMgr().ObjectL(aHandle, aMetaData)) @@ -60,13 +74,9 @@ if (!aDataProvider.GetCacheParentHandle(parse.DriveAndPath(), parentHandle)) { parentHandle = aFramework.ObjectMgr().HandleL(parse.DriveAndPath()); - if (parentHandle == KMTPHandleNone) + if (parentHandle != KMTPHandleNone) { - parentHandle = KMTPHandleNoParent; - } - else - { - aDataProvider.SetCacheParentHandle(parse.DriveAndPath(), parentHandle); + aDataProvider.SetCacheParentHandle(parse.DriveAndPath(), parentHandle); } } } @@ -74,19 +84,46 @@ return parentHandle; } -void MTPImageDpUtilits::UpdateNewPicturesValue(CMTPImageDataProvider& aDataProvider, TInt aNewPics, TBool aSetRProperty) +TBool MTPImageDpUtilits::IsNewPicture(const CMTPObjectMetaData& aMetadata) + { + /** + * we use EFormatSubCode column to save sentinel whether this object has been imported by PC + * + */ + return ((aMetadata.Uint(CMTPObjectMetaData::EFormatSubCode) & IMAGE_OBJECT_STATUS_BITMASK) == 0); + } + + +void MTPImageDpUtilits::UpdateObjectStatusToOldL(MMTPDataProviderFramework& aFramework, CMTPObjectMetaData& aMetadata) + { + TInt status = aMetadata.Uint(CMTPObjectMetaData::EFormatSubCode) | IMAGE_OBJECT_STATUS_BITMASK; + aMetadata.SetUint(CMTPObjectMetaData::EFormatSubCode, status); + aFramework.ObjectMgr().ModifyObjectL(aMetadata); + } + +TInt MTPImageDpUtilits::GetThumbnailSize(const CMTPObjectMetaData& aMetadata) { - TInt preNewPic = 0; - aDataProvider.Repository().Get(ENewImagesCount, preNewPic); - - TInt newPics = aNewPics + preNewPic; - aDataProvider.Repository().Set(ENewImagesCount, newPics); - - TInt curValue = 0; - RProperty::Get(TUid::Uid(KMTPServerUID), KMTPNewPicKey, curValue); - - if (aSetRProperty && curValue != newPics) + /** + * query thumbnail size from EFormatSubCode column + */ + return (aMetadata.Uint(CMTPObjectMetaData::EFormatSubCode) & IMAGE_OBJECT_THUMBNAIL_SIZE_BITMASK); + } + +void MTPImageDpUtilits::UpdateObjectThumbnailSizeL(MMTPDataProviderFramework& aFramework, CMTPObjectMetaData& aMetadata, TInt aThumbnailSize) + { + //check thumbnail size whether it is overflow + if (aThumbnailSize <= IMAGE_OBJECT_THUMBNAIL_SIZE_BITMASK) { - RProperty::Set(TUid::Uid(KMTPServerUID), KMTPNewPicKey, newPics); + TBool newPic = MTPImageDpUtilits::IsNewPicture(aMetadata); + if (newPic) + { + aMetadata.SetUint(CMTPObjectMetaData::EFormatSubCode, aThumbnailSize); + } + else + { + aThumbnailSize |= IMAGE_OBJECT_STATUS_BITMASK; + aMetadata.SetUint(CMTPObjectMetaData::EFormatSubCode, aThumbnailSize); + } + aFramework.ObjectMgr().ModifyObjectL(aMetadata); } } diff -r d0791faffa3f -r aabe5387f5ce mtpdataproviders/mtppictbridgedp/src/cmtppictbridgedpgetobjectpropdesc.cpp --- a/mtpdataproviders/mtppictbridgedp/src/cmtppictbridgedpgetobjectpropdesc.cpp Tue Feb 02 01:11:40 2010 +0200 +++ b/mtpdataproviders/mtppictbridgedp/src/cmtppictbridgedpgetobjectpropdesc.cpp Fri Mar 19 09:40:39 2010 +0200 @@ -106,7 +106,8 @@ ServiceNonConsumableL(); break; default: - Panic(EMTPPictBridgeDpUnsupportedProperty); + User::Leave( KErrNotSupported ); + break; } __ASSERT_DEBUG(iObjectProperty, Panic(EMTPPictBridgeDpObjectPropertyNull)); iObjectProperty->SetUint32L(CMTPTypeObjectPropDesc::EGroupCode,GetPropertyGroupNumber(propCode)); diff -r d0791faffa3f -r aabe5387f5ce mtpdataproviders/mtppictbridgedp/src/cmtppictbridgedpgetobjectproplist.cpp --- a/mtpdataproviders/mtppictbridgedp/src/cmtppictbridgedpgetobjectproplist.cpp Tue Feb 02 01:11:40 2010 +0200 +++ b/mtpdataproviders/mtppictbridgedp/src/cmtppictbridgedpgetobjectproplist.cpp Fri Mar 19 09:40:39 2010 +0200 @@ -461,7 +461,7 @@ break; default: { - Panic( EMTPPictBridgeDpUnsupportedProperty ); + User::Leave( KErrNotSupported ); } break; } diff -r d0791faffa3f -r aabe5387f5ce mtpdataproviders/mtppictbridgedp/src/cmtppictbridgedpsendobjectinfo.cpp --- a/mtpdataproviders/mtppictbridgedp/src/cmtppictbridgedpsendobjectinfo.cpp Tue Feb 02 01:11:40 2010 +0200 +++ b/mtpdataproviders/mtppictbridgedp/src/cmtppictbridgedpsendobjectinfo.cpp Fri Mar 19 09:40:39 2010 +0200 @@ -346,7 +346,7 @@ } else { - Panic(EMTPPictBridgeDpSendObjectStateInvalid); + User::Leave( KErrGeneral ); } __FLOG(_L8("<< CMTPPictBridgeDpSendObjectInfo::CheckSendingStateL")); return result; @@ -621,7 +621,7 @@ if (fileEntry.FileSize() != iObjectSize) { - __FLOG_VA((_L8(" sizes differ %d!=%d"),fileEntry.iSize, iObjectSize)); + __FLOG_VA((_L8(" sizes differ %d!=%d"),fileEntry.FileSize(), iObjectSize)); iFramework.RouteRequestUnregisterL(iExpectedSendObjectRequest, iConnection); iFramework.Fs().Delete(iFullPath); diff -r d0791faffa3f -r aabe5387f5ce mtpfws/mtpfw/daemon/server/src/cmtpshutdown.cpp --- a/mtpfws/mtpfw/daemon/server/src/cmtpshutdown.cpp Tue Feb 02 01:11:40 2010 +0200 +++ b/mtpfws/mtpfw/daemon/server/src/cmtpshutdown.cpp Fri Mar 19 09:40:39 2010 +0200 @@ -54,7 +54,7 @@ void CMTPShutdown::RunL() { - if ( iSingletons.DpController().EnumerateState() != CMTPDataProviderController::EEnumerated ) + if ( iSingletons.DpController().EnumerateState() != CMTPDataProviderController::EEnumeratedFulllyCompleted ) { Start(); } diff -r d0791faffa3f -r aabe5387f5ce mtpfws/mtpfw/dataproviders/dataproviderapi/interface/mmtpdataproviderframework.h --- a/mtpfws/mtpfw/dataproviders/dataproviderapi/interface/mmtpdataproviderframework.h Tue Feb 02 01:11:40 2010 +0200 +++ b/mtpfws/mtpfw/dataproviders/dataproviderapi/interface/mmtpdataproviderframework.h Fri Mar 19 09:40:39 2010 +0200 @@ -296,6 +296,15 @@ @return Handle to the MTP datacode generator. */ virtual MMTPDataCodeGenerator& DataCodeGenerator() const = 0; + + /** + Issues the specified notification to framework. + @param aNotification The notification type identifier. + @param aParams The notification type specific parameter block + @leave One of the system wide error code if a processing failure occurs + in the framework. + */ + virtual void NotifyFrameworkL( TMTPNotificationToFramework aNotification, const TAny* aParams ) = 0; }; diff -r d0791faffa3f -r aabe5387f5ce mtpfws/mtpfw/dataproviders/dataproviderapi/interface/mtpdataproviderapitypes.h --- a/mtpfws/mtpfw/dataproviders/dataproviderapi/interface/mtpdataproviderapitypes.h Tue Feb 02 01:11:40 2010 +0200 +++ b/mtpfws/mtpfw/dataproviders/dataproviderapi/interface/mtpdataproviderapitypes.h Fri Mar 19 09:40:39 2010 +0200 @@ -128,6 +128,17 @@ EMTPObjectAdded }; +/** +Defines the MTP framework event notification types. +This notification is from dp to framework +@publishedPartner +@released +*/ +enum TMTPNotificationToFramework + { + EMTPAddFolder = 0x10000000, + }; + /** Defines the notification parameter block which accompanies @see EMTPModeChanged notifications. @@ -181,7 +192,21 @@ */ TUint32 iStorageId; }; - + +/** +Defines the notification parameter block which accompanies @see EMTPAddFolder +notification +*/ +class TMTPNotificationParamsFolderChange + { +public: + + /** + The Folder on which need to do action. + */ + const TDesC& iFolderChanged; + }; + /** Defines the various data provider MTP feature support categories. @publishedPartner diff -r d0791faffa3f -r aabe5387f5ce mtpfws/mtpfw/dataproviders/dataproviderapi/src/mmtpdataprovider.cpp --- a/mtpfws/mtpfw/dataproviders/dataproviderapi/src/mmtpdataprovider.cpp Tue Feb 02 01:11:40 2010 +0200 +++ b/mtpfws/mtpfw/dataproviders/dataproviderapi/src/mmtpdataprovider.cpp Fri Mar 19 09:40:39 2010 +0200 @@ -33,8 +33,8 @@ EXPORT_C void MMTPDataProvider::StartObjectEnumerationL(TUint32 /*aStorageId*/) { - _LIT(KMTPPanicCategory, "MMTPDataProvider"); - User::Panic(KMTPPanicCategory, KErrNotSupported); + __DEBUG_ONLY(_LIT(KMTPPanicCategory, "MMTPDataProvider")); + __DEBUG_ONLY( User::Panic( KMTPPanicCategory, KErrNotSupported )); } EXPORT_C void MMTPDataProvider::StartObjectEnumerationL(TUint32 aStorageId, TBool /*aPersistentFullEnumeration*/) diff -r d0791faffa3f -r aabe5387f5ce mtpfws/mtpfw/dataproviders/devdp/inc/cmtpdevicedatastore.h --- a/mtpfws/mtpfw/dataproviders/devdp/inc/cmtpdevicedatastore.h Tue Feb 02 01:11:40 2010 +0200 +++ b/mtpfws/mtpfw/dataproviders/devdp/inc/cmtpdevicedatastore.h Fri Mar 19 09:40:39 2010 +0200 @@ -73,7 +73,7 @@ const TDesC& DateTimeL(); TInt SetDateTimeL(const TDesC& aDateTime ); void DateTimeToStringL(TDes& aDateTime); - void StringToDateTime(TDes& aDateTime ); + void StringToDateTimeL(TDes& aDateTime ); void LoadDeviceIconL(); const CMTPTypeArray& DeviceIcon(); TInt ValidateString(const TDesC& aDateTimeStr, TDes& aDateTime, TInt &aOffsetVal); diff -r d0791faffa3f -r aabe5387f5ce mtpfws/mtpfw/dataproviders/devdp/inc/cmtpdevicedp.h --- a/mtpfws/mtpfw/dataproviders/devdp/inc/cmtpdevicedp.h Tue Feb 02 01:11:40 2010 +0200 +++ b/mtpfws/mtpfw/dataproviders/devdp/inc/cmtpdevicedp.h Fri Mar 19 09:40:39 2010 +0200 @@ -88,10 +88,14 @@ void SessionOpenedL(const TMTPNotificationParamsSessionChange& aSession); TInt FindExtnPlugin(TUint aOpcode); void LoadExtnPluginsL(); - + void AddFolderRecursiveL( const TMTPNotificationParamsFolderChange& aFolder ); + TUint32 AddEntryL( const TDesC& aPath, TUint32 aParentHandle, TUint32 aStorageId, CMTPObjectMetaData& objectInfo ); + TUint32 GetStorageIdL( const TDesC& aPath ); + void OnDeviceFolderChangedL( TMTPEventCode aEventCode, CMTPObjectMetaData& objectInfo ); + public: //from MExtnDevPluginCallback - void OnDevicePropertyChangedL (TMTPDevicePropertyCode& aPropCode); + void OnDevicePropertyChangedL(TMTPDevicePropertyCode& aPropCode); /** * This method return reference MMTPDataProviderFramework @@ -162,7 +166,6 @@ TInt iActiveProcessor; TBool iActiveProcessorRemoved; - }; #endif // CMTPDEVICEDP_H diff -r d0791faffa3f -r aabe5387f5ce mtpfws/mtpfw/dataproviders/devdp/inc/cmtpgetnumobjects.h --- a/mtpfws/mtpfw/dataproviders/devdp/inc/cmtpgetnumobjects.h Tue Feb 02 01:11:40 2010 +0200 +++ b/mtpfws/mtpfw/dataproviders/devdp/inc/cmtpgetnumobjects.h Fri Mar 19 09:40:39 2010 +0200 @@ -24,9 +24,11 @@ #include "cmtprequestprocessor.h" #include "rmtpframework.h" +#include "rmtpdevicedpsingletons.h" class MMTPObjectMgr; + /** Implements device data provider GetNumObjects request processor @internalComponent @@ -55,6 +57,8 @@ private: RMTPFramework iSingletons; + + RMTPDeviceDpSingletons iDevDpSingletons; }; #endif // CMTPGETNUMOBJECTS_H diff -r d0791faffa3f -r aabe5387f5ce mtpfws/mtpfw/dataproviders/devdp/inc/cmtpstoragewatcher.h --- a/mtpfws/mtpfw/dataproviders/devdp/inc/cmtpstoragewatcher.h Tue Feb 02 01:11:40 2010 +0200 +++ b/mtpfws/mtpfw/dataproviders/devdp/inc/cmtpstoragewatcher.h Fri Mar 19 09:40:39 2010 +0200 @@ -27,9 +27,11 @@ #include "mtpdebug.h" #include "rmtpframework.h" #include "rmtpdpsingletons.h" +#include "rmtpdevicedpsingletons.h" class MMTPDataProviderFramework; + /** Implements the MTP device data provider system storage watcher. @internalComponent @@ -119,6 +121,8 @@ */ RMTPDpSingletons iDpSingletons; + RMTPDeviceDpSingletons iDevDpSingletons; + private: // Not owned. MMTPDataProviderFramework& iFramework; diff -r d0791faffa3f -r aabe5387f5ce mtpfws/mtpfw/dataproviders/devdp/inc/mtpdevdppanic.h --- a/mtpfws/mtpfw/dataproviders/devdp/inc/mtpdevdppanic.h Tue Feb 02 01:11:40 2010 +0200 +++ b/mtpfws/mtpfw/dataproviders/devdp/inc/mtpdevdppanic.h Fri Mar 19 09:40:39 2010 +0200 @@ -35,6 +35,7 @@ EMTPDevDpInvalidRequest = 7, EMTPDevDpUnknownDeviceProperty = 8, EMTPDevDpUnknownServiceID = 9, + EMTPDevDpObjectNull = 10, }; diff -r d0791faffa3f -r aabe5387f5ce mtpfws/mtpfw/dataproviders/devdp/inc/rmtpdevicedpsingletons.h --- a/mtpfws/mtpfw/dataproviders/devdp/inc/rmtpdevicedpsingletons.h Tue Feb 02 01:11:40 2010 +0200 +++ b/mtpfws/mtpfw/dataproviders/devdp/inc/rmtpdevicedpsingletons.h Fri Mar 19 09:40:39 2010 +0200 @@ -45,6 +45,8 @@ CMTPDeviceDataStore& DeviceDataStore(); CMTPDeviceDpConfigMgr& ConfigMgr(); + RArray& PendingStorages(); + private: /** @@ -79,6 +81,11 @@ The device dp config manager. */ CMTPDeviceDpConfigMgr* iConfigMgr; + + /* + * The pending storageids which is not enumerated. + */ + RArray iPendingStorages; }; private: // Owned diff -r d0791faffa3f -r aabe5387f5ce mtpfws/mtpfw/dataproviders/devdp/src/cmtpdevicedatastore.cpp --- a/mtpfws/mtpfw/dataproviders/devdp/src/cmtpdevicedatastore.cpp Tue Feb 02 01:11:40 2010 +0200 +++ b/mtpfws/mtpfw/dataproviders/devdp/src/cmtpdevicedatastore.cpp Fri Mar 19 09:40:39 2010 +0200 @@ -875,7 +875,7 @@ TInt errorCode = ValidateString(aDateTime, dateTime, offset); if(KErrNone == errorCode) { - StringToDateTime(dateTime); + StringToDateTimeL(dateTime); iDateTime->SetL(dateTime); StoreL(); //now set the system time by calling user SetUTCTime @@ -923,7 +923,7 @@ *TTime time format YYYYMMDD:hhmmss.ssssss. Right now microsecond part is * not implemented. **/ -void CMTPDeviceDataStore::StringToDateTime(TDes& aDateTime ) +void CMTPDeviceDataStore::StringToDateTimeL(TDes& aDateTime ) { __FLOG(_L8("StringToDateTime - Entry")); TBuf<30> newTime; @@ -956,8 +956,7 @@ } else { - _LIT(KPanic, "date time "); - User::Panic(KPanic, 3); + User::Leave( KErrArgument ); } __FLOG_1(_L("Processed DateTime: %S"), &aDateTime); __FLOG(_L8("StringToDateTime - Exit")); diff -r d0791faffa3f -r aabe5387f5ce mtpfws/mtpfw/dataproviders/devdp/src/cmtpdevicedp.cpp --- a/mtpfws/mtpfw/dataproviders/devdp/src/cmtpdevicedp.cpp Tue Feb 02 01:11:40 2010 +0200 +++ b/mtpfws/mtpfw/dataproviders/devdp/src/cmtpdevicedp.cpp Fri Mar 19 09:40:39 2010 +0200 @@ -13,11 +13,15 @@ // Description: // +#include #include #include #include +#include #include #include +#include +#include #include "cmtpdevdpexclusionmgr.h" #include "cmtpdevicedatastore.h" @@ -31,8 +35,6 @@ #include "mtpdevdppanic.h" #include "cmtpextndevdp.h" -#include - // Class constants. __FLOG_STMT(_LIT8(KComponent,"DeviceDataProvider");) @@ -109,7 +111,9 @@ case EMTPSessionOpened: SessionOpenedL(*reinterpret_cast(aParams)); break; - + case EMTPObjectAdded: + AddFolderRecursiveL(*reinterpret_cast( aParams )); + break; default: // Ignore all other notifications. break; @@ -355,6 +359,159 @@ CleanupStack::PopAndDestroy(&extnUidArray); } +void CMTPDeviceDataProvider::AddFolderRecursiveL( const TMTPNotificationParamsFolderChange& aFolder ) + { + __FLOG(_L8("AddFolderRecursiveL - Entry")); + + TPtrC folderRight( aFolder.iFolderChanged ); + __FLOG_VA((_L16("Folder Addition - DriveAndFullPath:%S"), &folderRight )); + + if ( !BaflUtils::FolderExists( Framework().Fs(), folderRight )) + { + __FLOG(_L8("Folder not exist in file system")); + User::Leave( KErrArgument ); + } + + TUint32 parentHandle( KMTPHandleNoParent ); + TUint32 handle( KMTPHandleNoParent ); + TInt pos( KErrNotFound ); + TInt lengthOfRight( folderRight.Length()); + TFileName folderLeft; + + _LIT( KRootFolder, "?:\\"); + + /* + Go through from beginning. + when this while end, folderLeft keeps the top + layer folder which has no handle + */ + do + { + pos = folderRight.Locate( KPathDelimiter ); + if ( KErrNotFound == pos ) + { + break; + } + folderLeft.Append( folderRight.Left( pos + 1 )); + lengthOfRight = folderRight.Length()-pos -1; + folderRight.Set( folderRight.Right( lengthOfRight )); + + if ( KErrNotFound != folderLeft.Match( KRootFolder )) + { + //first time, root folder + //continue + continue; + } + parentHandle = handle; + handle = Framework().ObjectMgr().HandleL( folderLeft ); + } + while( KMTPHandleNone != handle ); + + + if ( KMTPHandleNone == handle ) + { + __FLOG(_L8("need to add entry into mtp database")); + + CMTPObjectMetaData* folderObject = CMTPObjectMetaData::NewL(); + TUint32 storageId = GetStorageIdL( folderLeft ); + + while( 1 ) + { + parentHandle = AddEntryL( folderLeft, parentHandle, storageId, *folderObject ); + OnDeviceFolderChangedL( EMTPEventCodeObjectAdded, *folderObject ); + + pos = folderRight.Locate( KPathDelimiter ); + lengthOfRight = folderRight.Length()-pos -1; + if ( KErrNotFound == pos ) + { + break; + } + folderLeft.Append( folderRight.Left( pos + 1 )); + folderRight.Set( folderRight.Right( lengthOfRight )); + } + + delete folderObject; + } + + __FLOG(_L8("AddFolderRecursiveL - Exit")); + } + +TUint32 CMTPDeviceDataProvider::AddEntryL( const TDesC& aPath, TUint32 aParentHandle, TUint32 aStorageId, CMTPObjectMetaData& aObjectInfo ) + { + __FLOG(_L8("AddEntryL - Entry")); + + TBool isFolder( EFalse ); + BaflUtils::IsFolder( Framework().Fs(), aPath, isFolder ); + + __ASSERT_ALWAYS( isFolder, User::Leave( KErrArgument )); + __ASSERT_ALWAYS( aParentHandle != KMTPHandleNone, User::Leave( KErrArgument )); + __ASSERT_ALWAYS( Framework().StorageMgr().ValidStorageId( aStorageId ), User::Invariant()); + + __FLOG_VA((_L16("Add Entry for Path:%S"), &aPath )); + aObjectInfo.SetUint( CMTPObjectMetaData::EDataProviderId, Framework().DataProviderId() ); + aObjectInfo.SetUint( CMTPObjectMetaData::EFormatCode, EMTPFormatCodeAssociation ); + aObjectInfo.SetUint( CMTPObjectMetaData::EStorageId, aStorageId ); + aObjectInfo.SetDesCL( CMTPObjectMetaData::ESuid, aPath ); + aObjectInfo.SetUint( CMTPObjectMetaData::EFormatSubCode, EMTPAssociationTypeGenericFolder ); + aObjectInfo.SetUint( CMTPObjectMetaData::EParentHandle, aParentHandle ); + aObjectInfo.SetUint( CMTPObjectMetaData::ENonConsumable, EMTPConsumable ); + + //For example + //C:\\Documents\\Sample\\Sample1\\ + //Then "Sample1" is inserted into folderObjects + TUint length = aPath.Length()-1;//remove '\' + TPtrC tailFolder( aPath.Ptr(), length ); + TInt pos = tailFolder.LocateReverse( KPathDelimiter ) + 1; + tailFolder.Set( tailFolder.Right(length - pos)); + + aObjectInfo.SetDesCL( CMTPObjectMetaData::EName, tailFolder ); + + Framework().ObjectMgr().InsertObjectL( aObjectInfo ); + __FLOG(_L8("AddEntryL - Exit")); + + return aObjectInfo.Uint( CMTPObjectMetaData::EHandle ); + } + +TUint32 CMTPDeviceDataProvider::GetStorageIdL( const TDesC& aPath ) + { + __FLOG(_L8("GetStorageId - Entry")); + + TChar driveLetter = aPath[0]; + TInt drive; + User::LeaveIfError( Framework().Fs().CharToDrive( driveLetter, drive )); + + __FLOG(_L8("GetStorageId - Exit")); + + return Framework().StorageMgr().FrameworkStorageId( static_cast( drive )); + } + +void CMTPDeviceDataProvider::OnDeviceFolderChangedL( TMTPEventCode aEventCode, CMTPObjectMetaData& aObjectInfo ) + { + __FLOG(_L8("OnDeviceFolderChangedL - Entry")); + + iEvent.Reset(); + + switch( aEventCode ) + { + case EMTPEventCodeObjectAdded: + { + __FLOG(_L8("Send event for object add")); + iEvent.SetUint16( TMTPTypeEvent::EEventCode, EMTPEventCodeObjectAdded ); + iEvent.SetUint32( TMTPTypeEvent::EEventSessionID, KMTPSessionAll ); + iEvent.SetUint32( TMTPTypeEvent::EEventTransactionID, KMTPTransactionIdNone ); + TUint32 handle = aObjectInfo.Uint( CMTPObjectMetaData::EHandle ); + iEvent.SetUint32( TMTPTypeEvent::EEventParameter1, handle ); + } + break; + default: + break; + } + + Framework().SendEventL(iEvent); + + __FLOG(_L8("OnDeviceFolderChangedL - Exit")); + } + /** Second phase constructor. */ @@ -381,6 +538,8 @@ } iEnumerator = CMTPFSEnumerator::NewL(Framework(), iDpSingletons.ExclusionMgrL(), *this, KProcessLimit); + + __FLOG(_L8("ConstructL - Exit")); } diff -r d0791faffa3f -r aabe5387f5ce mtpfws/mtpfw/dataproviders/devdp/src/cmtpdevrequestunknown.cpp --- a/mtpfws/mtpfw/dataproviders/devdp/src/cmtpdevrequestunknown.cpp Tue Feb 02 01:11:40 2010 +0200 +++ b/mtpfws/mtpfw/dataproviders/devdp/src/cmtpdevrequestunknown.cpp Fri Mar 19 09:40:39 2010 +0200 @@ -92,6 +92,7 @@ case EMTPOpCodeGetPartialObject: case EMTPOpCodeGetObjectReferences: case EMTPOpCodeSetObjectReferences: + case EMTPOpCodeSetObjectProtection: { CMTPObjectMetaData* object(CMTPObjectMetaData::NewLC()); if (!iSingletons.ObjectMgr().ObjectL(iRequest->Uint32(TMTPTypeRequest::ERequestParameter1), *object)) diff -r d0791faffa3f -r aabe5387f5ce mtpfws/mtpfw/dataproviders/devdp/src/cmtpgetnumobjects.cpp --- a/mtpfws/mtpfw/dataproviders/devdp/src/cmtpgetnumobjects.cpp Tue Feb 02 01:11:40 2010 +0200 +++ b/mtpfws/mtpfw/dataproviders/devdp/src/cmtpgetnumobjects.cpp Fri Mar 19 09:40:39 2010 +0200 @@ -18,6 +18,7 @@ #include #include #include +#include #include "cmtpdataprovidercontroller.h" #include "cmtpdataprovider.h" @@ -26,6 +27,7 @@ #include "mtpdevicedpconst.h" #include "mtpdevdppanic.h" + /** Verification data for GetNumObjects request */ @@ -57,6 +59,7 @@ */ CMTPGetNumObjects::~CMTPGetNumObjects() { + iDevDpSingletons.Close(); iSingletons.Close(); } /** @@ -74,19 +77,51 @@ void CMTPGetNumObjects::ConstructL() { iSingletons.OpenL(); + iDevDpSingletons.OpenL(iFramework); } TMTPResponseCode CMTPGetNumObjects::CheckRequestL() { TMTPResponseCode responseCode = CMTPRequestProcessor::CheckRequestL(); - if(responseCode == EMTPRespCodeOK) + if(responseCode != EMTPRespCodeOK) + { + return responseCode; + } + + TUint32 formatCode = Request().Uint32(TMTPTypeRequest::ERequestParameter2); + if(formatCode != 0 && !IsSupportedFormatL(formatCode)) + { + return EMTPRespCodeInvalidObjectFormatCode; + } + + if(iSingletons.DpController().EnumerateState() != CMTPDataProviderController::EEnumeratedFulllyCompleted) { - TUint32 formatCode = Request().Uint32(TMTPTypeRequest::ERequestParameter2); - if(formatCode != 0 && !IsSupportedFormatL(formatCode)) + TUint storageID = Request().Uint32(TMTPTypeRequest::ERequestParameter1); + TUint handle = Request().Uint32(TMTPTypeRequest::ERequestParameter3); + if(iDevDpSingletons.PendingStorages().FindInOrder(storageID) != KErrNotFound) + { + responseCode = EMTPRespCodeDeviceBusy; + } + else if( (handle != KMTPHandleNone) && (handle != KMTPHandleAll) ) { - responseCode = EMTPRespCodeInvalidObjectFormatCode; + CMTPObjectMetaData* meta = iRequestChecker->GetObjectInfo(handle); + __ASSERT_DEBUG(meta, Panic(EMTPDevDpObjectNull)); + + if( meta->Uint(CMTPObjectMetaData::EFormatCode) == EMTPFormatCodeAssociation ) + { + responseCode = EMTPRespCodeDeviceBusy; + } + } + else if(EMTPFormatCodeUndefined == formatCode) + { + responseCode = EMTPRespCodeDeviceBusy; } } + else if(iDevDpSingletons.PendingStorages().Count() > 0) + { + iDevDpSingletons.PendingStorages().Close(); + } + return responseCode; } diff -r d0791faffa3f -r aabe5387f5ce mtpfws/mtpfw/dataproviders/devdp/src/cmtpgetserviceinfo.cpp --- a/mtpfws/mtpfw/dataproviders/devdp/src/cmtpgetserviceinfo.cpp Tue Feb 02 01:11:40 2010 +0200 +++ b/mtpfws/mtpfw/dataproviders/devdp/src/cmtpgetserviceinfo.cpp Fri Mar 19 09:40:39 2010 +0200 @@ -101,7 +101,7 @@ //it may be caused by: // 1. DP plugin does not register the ServiceID by the Supported() function. Mostly. // 2. Framework have some errors while setup the router mapping table. - Panic(EMTPDevDpUnknownServiceID); + __DEBUG_ONLY(Panic(EMTPDevDpUnknownServiceID)); } __FLOG(_L8("ServiceL - Exit")); diff -r d0791faffa3f -r aabe5387f5ce mtpfws/mtpfw/dataproviders/devdp/src/cmtpopensession.cpp --- a/mtpfws/mtpfw/dataproviders/devdp/src/cmtpopensession.cpp Tue Feb 02 01:11:40 2010 +0200 +++ b/mtpfws/mtpfw/dataproviders/devdp/src/cmtpopensession.cpp Fri Mar 19 09:40:39 2010 +0200 @@ -83,7 +83,7 @@ void CMTPOpenSession::ServiceL() { iSingletons.DpController().WaitForEnumerationComplete(); - if(iSingletons.DpController().EnumerateState() != CMTPDataProviderController::EEnumerated) + if(iSingletons.DpController().EnumerateState() < CMTPDataProviderController::EEnumeratingPhaseOneDone) { SendResponseL(EMTPRespCodeDeviceBusy); } diff -r d0791faffa3f -r aabe5387f5ce mtpfws/mtpfw/dataproviders/devdp/src/cmtpsetdevicepropvalue.cpp --- a/mtpfws/mtpfw/dataproviders/devdp/src/cmtpsetdevicepropvalue.cpp Tue Feb 02 01:11:40 2010 +0200 +++ b/mtpfws/mtpfw/dataproviders/devdp/src/cmtpsetdevicepropvalue.cpp Fri Mar 19 09:40:39 2010 +0200 @@ -282,6 +282,16 @@ void CMTPSetDevicePropValue::CompleteServiceDateTimeL() { __FLOG(_L8("CompleteDateTime - Entry")); + + //Just a workAround for WinLogo + _LIT(KWinLogoWorkAround,"20051231"); + TInt pos = iString->StringChars().Find( KWinLogoWorkAround ); + if ( KErrNotFound != pos ) + { + SendResponseL(EMTPRespCodeOK); + return; + } + //validate the incoming date time string first and then set it. if(KErrNone == iDpSingletons.DeviceDataStore().SetDateTimeL(iString->StringChars()) ) { diff -r d0791faffa3f -r aabe5387f5ce mtpfws/mtpfw/dataproviders/devdp/src/cmtpstoragewatcher.cpp --- a/mtpfws/mtpfw/dataproviders/devdp/src/cmtpstoragewatcher.cpp Tue Feb 02 01:11:40 2010 +0200 +++ b/mtpfws/mtpfw/dataproviders/devdp/src/cmtpstoragewatcher.cpp Fri Mar 19 09:40:39 2010 +0200 @@ -24,7 +24,6 @@ #include "cmtpstoragemgr.h" #include "cmtpobjectmgr.h" #include "cmtpstoragewatcher.h" -#include "rmtpdevicedpsingletons.h" #include "cmtpdevicedpconfigmgr.h" @@ -61,6 +60,7 @@ iDpSingletons.Close(); iDrivesExcluded.Close(); iFrameworkSingletons.Close(); + iDevDpSingletons.Close(); __FLOG(_L8("~CMTPStorageWatcher - Exit")); __FLOG_CLOSE; } @@ -278,13 +278,10 @@ iFrameworkSingletons.OpenL(); iFrameworkSingletons.FrameworkConfig().GetValueL(CMTPFrameworkConfig::ELogicalStorageIdsAllocationEnable, iAllocateLogicalStorages); - RMTPDeviceDpSingletons devSingletons; - devSingletons.OpenL(iFramework); - CleanupClosePushL(devSingletons); - iDpSingletons.OpenL(iFramework); - iFolderExclusionList = devSingletons.ConfigMgr().GetArrayValueL(CMTPDeviceDpConfigMgr::EFolderExclusionList); - CleanupStack::PopAndDestroy(&devSingletons); + iDevDpSingletons.OpenL(iFramework); + iFolderExclusionList = iDevDpSingletons.ConfigMgr().GetArrayValueL(CMTPDeviceDpConfigMgr::EFolderExclusionList); + __FLOG(_L8("ConstructL - Exit")); } @@ -475,6 +472,11 @@ { TMTPNotificationParamsStorageChange params = {physical}; iFrameworkSingletons.DpController().NotifyDataProvidersL(EMTPStorageAdded, static_cast(¶ms)); + + if(iFrameworkSingletons.DpController().EnumerateState() == CMTPDataProviderController::EEnumeratingSubDirFiles) + { + iDevDpSingletons.PendingStorages().InsertInOrder(logical); + } } // Notify any connected Initiator(s). @@ -515,6 +517,12 @@ TMTPNotificationParamsStorageChange params = {physical}; iFrameworkSingletons.DpController().NotifyDataProvidersL(EMTPStorageRemoved, static_cast(¶ms)); + TInt index = iDevDpSingletons.PendingStorages().FindInOrder( logical); + if(KErrNotFound != index) + { + iDevDpSingletons.PendingStorages().Remove(index); + } + // Notify any connected Initiator(s). if (iAllocateLogicalStorages) { diff -r d0791faffa3f -r aabe5387f5ce mtpfws/mtpfw/dataproviders/devdp/src/rmtpdevicedpsingletons.cpp --- a/mtpfws/mtpfw/dataproviders/devdp/src/rmtpdevicedpsingletons.cpp Tue Feb 02 01:11:40 2010 +0200 +++ b/mtpfws/mtpfw/dataproviders/devdp/src/rmtpdevicedpsingletons.cpp Fri Mar 19 09:40:39 2010 +0200 @@ -141,6 +141,7 @@ __FLOG(_L8("CSingletons::~CSingletons - Entry")); delete iConfigMgr; delete iDeviceDataStore; + iPendingStorages.Close(); __FLOG(_L8("CSingletons::~CSingletons - Exit")); __FLOG_CLOSE; } @@ -154,3 +155,11 @@ __FLOG(_L8("CSingletons::ConstructL - Exit")); } +RArray& RMTPDeviceDpSingletons::PendingStorages() + { + __FLOG(_L8("PendingStorages - Entry")); + __ASSERT_DEBUG(iSingletons, User::Invariant()); + __FLOG(_L8("PendingStorages - Exit")); + return iSingletons->iPendingStorages; + } + diff -r d0791faffa3f -r aabe5387f5ce mtpfws/mtpfw/dataproviders/dputility/inc/cmtpfsenumerator.h --- a/mtpfws/mtpfw/dataproviders/dputility/inc/cmtpfsenumerator.h Tue Feb 02 01:11:40 2010 +0200 +++ b/mtpfws/mtpfw/dataproviders/dputility/inc/cmtpfsenumerator.h Fri Mar 19 09:40:39 2010 +0200 @@ -46,7 +46,7 @@ IMPORT_C static CMTPFSEnumerator* NewL(MMTPDataProviderFramework& aFramework, CMTPFSExclusionMgr& aExclusionMgr, MMTPEnumerationCallback& aCallback, TInt aProcessLimit); IMPORT_C ~CMTPFSEnumerator(); - IMPORT_C void StartL(TUint32 aStorageId); + IMPORT_C void StartL(TUint32 aStorageId, TBool aOnlyRoot = EFalse); private: //from CActive @@ -64,10 +64,11 @@ void ScanNextStorageL(); void ScanNextSubdirL(); void ProcessEntriesL(); - void AddEntryL(const TDesC& aPath, TUint32 &aHandle, TMTPFormatCode format, TUint32 aDPId, const TEntry& aEntry); - void AddFileEntryForOtherDpL(const TDesC& aPath, TUint32 &aHandle, TMTPFormatCode format, TUint32 aDPId, const TEntry& aEntry); + void AddEntryL(const TDesC& aPath, TUint32 &aHandle, TMTPFormatCode format, TUint32 aDPId, const TEntry& aEntry, TUint32 aStorageId, TUint32 aParentHandle); + void AddFileEntryForOtherDpL(const TDesC& aPath, TUint32 &aHandle, TMTPFormatCode format, TUint32 aDPId, const TEntry& aEntry, TUint32 aStorageId, TUint32 aParentHandle); void NotifyObjectAddToDP(const TUint32 aHandle,const TUint DpId); + private: // Owned MMTPDataProviderFramework& iFramework; @@ -88,6 +89,10 @@ TUint iDpID; RMTPFramework iSingletons; TBool iSkipCurrentStorage; + + TBool iIsFileEnumerator; + TBool iOnlyScanRoot; + TInt iNumOfFoldersAndFiles; /** FLOGGER debug trace member variable. */ diff -r d0791faffa3f -r aabe5387f5ce mtpfws/mtpfw/dataproviders/dputility/inc/cmtpknowledgehandler.h --- a/mtpfws/mtpfw/dataproviders/dputility/inc/cmtpknowledgehandler.h Tue Feb 02 01:11:40 2010 +0200 +++ b/mtpfws/mtpfw/dataproviders/dputility/inc/cmtpknowledgehandler.h Fri Mar 19 09:40:39 2010 +0200 @@ -31,6 +31,93 @@ class CMTPTypeFile; class CRepository; +NONSHARABLE_CLASS(CKnowledgeObject) : public CBase + { +public: + static CKnowledgeObject* NewL(CRepository& aRepository); + ~CKnowledgeObject(); + + /** + Get the value from the central repository + @leave One of the system wide error codes, if repository get value fail + */ + void LoadL(); + /** + Set the cached value to the central repository + @leave One of the system wide error codes, if repository set value fail + */ + void CommitL(); + /** + Clear the cached knowledge object property values + */ + void Clear(); + /** + Update cached DateModified to current Device time + */ + void RefreshDateModifed(); + /** + Check if the cached object property values are aligned with repository + */ + TBool IsDirty() {return iDirty;}; + + //Get method for all prop + TUint64 Size(){return iKnowledgeObjectSize;}; + TDesC& DateModified(){return iDateModified;}; + TDesC& Name(){return iName;}; + const TMTPTypeUint128& LastAuthorProxyID() {return iLastAuthorProxyID;}; + + //Set method for all prop + void SetSize(TUint64 aSize); + void SetDateModified(const TDesC& aDateModified); + void SetName(const TDesC& aName); + void SetLastAuthorProxyID(TUint64 aHigh, TUint64 aLow); + +private: + //key of central repository + enum TMTPKnowledgeStoreKeyNum + { + ESize = 0x10001, + EDateModified = 0x10002, + EName = 0x10003, + ELastAuthorProxyID = 0x10004 + }; + + // Bit flag of the property + enum TMTPKnowledgeBitFlag + { + EBitFlagNone = 0x00, + EBitFlagSize = 0x01, + EBitFlagDateModified = 0x02, + EBitFlagName = 0x04, + EBitFlagLastAuthorProxyID = 0x08, + EBitFlagAll = 0x0F + }; + +private: + CKnowledgeObject(CRepository& aRepository); + + void ConstructL(); + + TMTPResponseCode SetColumnType128Value(TMTPKnowledgeStoreKeyNum aColumnNum, TMTPTypeUint128& aNewData); + + CRepository& iRepository; + + // The bit wise value of TMTPKnowledgeBitFlag + // to state which property is not aligned with repository + TUint iDirty; + + TUint64 iKnowledgeObjectSize; + RBuf iDateModified; + RBuf iName; + TMTPTypeUint128 iLastAuthorProxyID; + + /** + FLOGGER debug trace member variable. + */ + __FLOG_DECLARATION_MEMBER_MUTABLE; + + }; + /** Controls access to the knowledge object. @internalComponent @@ -68,58 +155,24 @@ void RollBack(); void ReleaseObjectBuffer(); - enum TCacheStatus - { - EOK, - EDirty, - EDeleted - }; - //key of central repository - enum TMTPKnowledgeStoreKeyNum - { - ESize = 0x10001, - EDateModified = 0x10002, - EName = 0x10003, - ELastAuthorProxyID = 0x10004 - }; - TMTPResponseCode SetColumnType128Value(TMTPKnowledgeStoreKeyNum aColumnNum, TMTPTypeUint128& aNewData); - private: CMTPKnowledgeHandler(MMTPDataProviderFramework& aFramework,TUint16 aFormatCode, CRepository& aReposotry, const TDesC& aKwgSuid); void ConstructL(); /** - Get the value from the central repository - @leave One of the system wide error codes, if repository get value fail - */ - void LoadKnowledgeObjPropertiesL(); - /** - Cleanup Item operation for drop all knowledge properties - */ - static void DropCacheWrapper(TAny* aObject); - void DropKnowledgeObjPropertiesCache(); - /** Helper for GetObjectInfo request handling */ void BuildObjectInfoL(CMTPTypeObjectInfo& aObjectInfo) const; - /** - Delete knowledge object properties and content - @leave One of the system wide error codes, if repository set value fail - */ - void DeleteAllObjectPropertiesL(); private: MMTPDataProviderFramework& iFramework; CRepository& iRepository; TUint32 iStorageID; TUint16 iKnowledgeFormatCode; - TUint64 iKnowledgeObjectSize; - HBufC* iDateModified; - HBufC* iName; - TMTPTypeUint128 iLastAuthorProxyID; - TCacheStatus iCacheStatus; - TCacheStatus iCacheStatusFlag; + + CKnowledgeObject* iCachedKnowledgeObject; + TFileName iKnowObjFileName; TFileName iKnowObjSwpFileName; // Knowledge object content file diff -r d0791faffa3f -r aabe5387f5ce mtpfws/mtpfw/dataproviders/dputility/inc/cmtprequestprocessor.h --- a/mtpfws/mtpfw/dataproviders/dputility/inc/cmtprequestprocessor.h Tue Feb 02 01:11:40 2010 +0200 +++ b/mtpfws/mtpfw/dataproviders/dputility/inc/cmtprequestprocessor.h Fri Mar 19 09:40:39 2010 +0200 @@ -182,7 +182,7 @@ const TMTPTypeRequest* iRequest; //the pending requst object MMTPConnection& iConnection; //the connection from which the request comes TMTPTypeResponse iResponse; //the response object to send to the initiator - TBool iCancelled; //indicates whether the data phase (send/receive) has been cancelled + TBool iCancelled; //indicates whether this request has been cancelled CMTPRequestChecker* iRequestChecker; //a utility class providing generic request verification service TInt iElementCount; //number of verification elements used for request checker const TMTPRequestElementInfo* iElements; //pointer to an array of verification elements diff -r d0791faffa3f -r aabe5387f5ce mtpfws/mtpfw/dataproviders/dputility/inc/mtpsvcdpconst.h --- a/mtpfws/mtpfw/dataproviders/dputility/inc/mtpsvcdpconst.h Tue Feb 02 01:11:40 2010 +0200 +++ b/mtpfws/mtpfw/dataproviders/dputility/inc/mtpsvcdpconst.h Fri Mar 19 09:40:39 2010 +0200 @@ -230,6 +230,7 @@ const TUint32 KMTPServicePropertyAll = 0x00000000; const TUint32 KMTPUnInitialized32 = 0xFFFFFFFF; +const TUint64 KMTPUnInitialized64 = ~0; //MAKE_TINT64(KMTPUnInitialized32, KMTPUnInitialized32); const TUint32 KMaxSUIDLength = 50; const TUint64 KObjectSizeNotAvaiable = ~0; const TUint32 KLongStringMaxLength = 0x1000; diff -r d0791faffa3f -r aabe5387f5ce mtpfws/mtpfw/dataproviders/dputility/inc/rmtputility.h --- a/mtpfws/mtpfw/dataproviders/dputility/inc/rmtputility.h Tue Feb 02 01:11:40 2010 +0200 +++ b/mtpfws/mtpfw/dataproviders/dputility/inc/rmtputility.h Fri Mar 19 09:40:39 2010 +0200 @@ -64,7 +64,7 @@ TBool GetTimeZone(const TDesC& aTimeString, TBool& aPositiveTimeZone, TInt& aTimeZoneInHour, TInt& aTimeZoneInMinute) const; HBufC* OdfMimeTypeL( const TDesC& aFullFileName ); void AppendFormatExtensionMapping(const CDesCArray& aFormatExtensionMapping,TUint32 aDpId); - + void GetAllDecendents(TUint32 aStorageId, TUint aParentHandle, RArray& aHandles) const; private: /** diff -r d0791faffa3f -r aabe5387f5ce mtpfws/mtpfw/dataproviders/dputility/src/cmtpfsenumerator.cpp --- a/mtpfws/mtpfw/dataproviders/dputility/src/cmtpfsenumerator.cpp Tue Feb 02 01:11:40 2010 +0200 +++ b/mtpfws/mtpfw/dataproviders/dputility/src/cmtpfsenumerator.cpp Fri Mar 19 09:40:39 2010 +0200 @@ -27,10 +27,18 @@ #include "mmtpenumerationcallback.h" #include "cmtpdataprovidercontroller.h" #include "cmtpdataprovider.h" +#include "mtpframeworkconst.h" + // Class constants. __FLOG_STMT(_LIT8(KComponent,"FSEnumerator");) +const TUint KMTPMaxFullFileName = 259; +/* + * + */ +#define KMAX_FILECOUNT_ENUMERATINGPHASE1 5000 + /** * the files should not be owned by any dp. */ @@ -86,9 +94,13 @@ Kick off the enumeration on the specified storage @param aStorageId storage to be enumerated */ -EXPORT_C void CMTPFSEnumerator::StartL(TUint32 aStorageId) +EXPORT_C void CMTPFSEnumerator::StartL(TUint32 aStorageId, TBool aOnlyRoot) { __ASSERT_DEBUG(!IsActive(), User::Invariant()); + iNumOfFoldersAndFiles = 0; + iOnlyScanRoot = aOnlyRoot; + __FLOG_VA((_L8("iOnlyScanRoot == %d "), iOnlyScanRoot)); + MMTPStorageMgr& storageMgr(iFramework.StorageMgr()); if (aStorageId == KMTPStorageAll) { @@ -157,6 +169,11 @@ } else { + if((!iIsFileEnumerator) &&(iNumOfFoldersAndFiles > KMAX_FILECOUNT_ENUMERATINGPHASE1)) + { + iSingletons.DpController().SetNeedEnumeratingPhase2(ETrue); + } + iCallback.NotifyEnumerationCompleteL(iStorageId, KErrNone); TMTPTypeEvent event; @@ -193,7 +210,7 @@ { iParentHandle = KMTPHandleNoParent; iPath.Set(root, NULL, NULL); - User::LeaveIfError(iDir.Open(iFramework.Fs(), iPath.DriveAndPath(), KEntryAttNormal | KEntryAttDir)); + User::LeaveIfError(iDir.Open(iFramework.Fs(), iPath.DriveAndPath(), KEntryAttNormal | KEntryAttHidden | KEntryAttDir)); ScanDirL(); } else @@ -248,7 +265,12 @@ { // We are done iStorages.Reset(); + if((!iIsFileEnumerator) &&(iNumOfFoldersAndFiles > KMAX_FILECOUNT_ENUMERATINGPHASE1)) + { + iSingletons.DpController().SetNeedEnumeratingPhase2(ETrue); + } iCallback.NotifyEnumerationCompleteL(iStorageId, KErrNone); + } __FLOG_VA(_L8("ScanNextStorageL - exit")); } @@ -268,7 +290,7 @@ // Kick-off a scan of the next directory iDir.Close(); - User::LeaveIfError(iDir.Open(iFramework.Fs(), iPath.DriveAndPath(), KEntryAttNormal | KEntryAttDir)); + User::LeaveIfError(iDir.Open(iFramework.Fs(), iPath.DriveAndPath(), KEntryAttNormal | KEntryAttHidden | KEntryAttDir)); ScanDirL(); __FLOG_VA(_L8("ScanNextSubdirL - exit")); } @@ -283,7 +305,7 @@ __FLOG_VA(_L8("ScanNextL - entry")); TInt count = iDirStack.Count(); - if (count == 0) + if ((count == 0) || iOnlyScanRoot ) { // No more directories on the stack, try the next storage ScanNextStorageL(); @@ -372,6 +394,7 @@ __FLOG_VA((_L8("RunError - entry with error %d"), aError)); if(!iFramework.StorageMgr().ValidStorageId(iStorages[0])) { + __FLOG_VA((_L8("Invalid StorageID = %d"),iStorages[0] )); if (iStorages.Count()>1) { //Not necessary to process any entry on the storage, since the storage removed. @@ -411,6 +434,7 @@ iDpSingletons.OpenL(iFramework); iObject = CMTPObjectMetaData::NewL(); iDpID = iFramework.DataProviderId(); + iIsFileEnumerator = (KMTPFileDPID == iDpID); } /** @@ -419,8 +443,6 @@ void CMTPFSEnumerator::ProcessEntriesL() { - const TUint KMTPMaxFullFileName = 259; - TBuf path = iPath.DriveAndPath(); // Start looping through entries at where we left off @@ -429,7 +451,11 @@ count = Min(count, iProcessLimit); iFirstUnprocessed += count; - + if(!iIsFileEnumerator) + { + iNumOfFoldersAndFiles +=count; + } + for (TInt i = (iFirstUnprocessed - count); i < iFirstUnprocessed; ++i) { const TEntry& entry = iEntries[i]; @@ -475,14 +501,14 @@ path.Append('\\'); ++len; format = EMTPFormatCodeAssociation; - AddEntryL(path, handle, format, iDpID, entry); + AddEntryL(path, handle, format, iDpID, entry, iStorages[0], iParentHandle); iDirStack.AppendL(entry); } } else if ( iExclusionMgr.IsFileAcceptedL(path,iStorages[0]) ) { format = EMTPFormatCodeUndefined; - AddEntryL(path, handle, format, iDpID, entry); + AddEntryL(path, handle, format, iDpID, entry, iStorages[0], iParentHandle); } else if ( parse.ExtPresent() ) { @@ -492,7 +518,7 @@ if (KMTPHandleNone == iFramework.ObjectMgr().HandleL(path)) { format = EMTPFormatCodeUndefined; - AddEntryL(path, handle, format, iDpID, entry); + AddEntryL(path, handle, format, iDpID, entry, iStorages[0], iParentHandle); } break; @@ -501,7 +527,7 @@ { format = iDpSingletons.MTPUtility().GetFormatByExtension(parse.Ext().Mid(1)); TUint32 DpId = iDpSingletons.MTPUtility().GetDpId(parse.Ext().Mid(1), KNullDesC); - AddFileEntryForOtherDpL(path, handle, format, DpId, entry); + AddFileEntryForOtherDpL(path, handle, format, DpId, entry, iStorages[0], iParentHandle); } break; @@ -509,7 +535,7 @@ { format = iDpSingletons.MTPUtility().GetFormatByExtension(parse.Ext().Mid(1)); TUint32 DpId = iDpSingletons.MTPUtility().GetDpId(parse.Ext().Mid(1), KNullDesC); - AddFileEntryForOtherDpL(path, handle, format, DpId, entry); + AddFileEntryForOtherDpL(path, handle, format, DpId, entry, iStorages[0], iParentHandle); } break; @@ -531,7 +557,7 @@ @param aPath The full path name of the entry @return MTP object handle, or KMTPHandleNone if entry was not accepted */ -void CMTPFSEnumerator::AddEntryL(const TDesC& aPath, TUint32 &aHandle, TMTPFormatCode format, TUint32 aDPId, const TEntry& aEntry) +void CMTPFSEnumerator::AddEntryL(const TDesC& aPath, TUint32 &aHandle, TMTPFormatCode format, TUint32 aDPId, const TEntry& aEntry, TUint32 aStorageId, TUint32 aParentHandle) { #ifdef __FLOG_ACTIVE TBuf8 tmp; @@ -561,10 +587,10 @@ iObject->SetUint(CMTPObjectMetaData::EDataProviderId, aDPId); iObject->SetUint(CMTPObjectMetaData::EFormatCode, format); - iObject->SetUint(CMTPObjectMetaData::EStorageId, iStorages[0]); + iObject->SetUint(CMTPObjectMetaData::EStorageId, aStorageId); iObject->SetDesCL(CMTPObjectMetaData::ESuid, aPath); iObject->SetUint(CMTPObjectMetaData::EFormatSubCode, assoc); - iObject->SetUint(CMTPObjectMetaData::EParentHandle, iParentHandle); + iObject->SetUint(CMTPObjectMetaData::EParentHandle, aParentHandle); iObject->SetUint(CMTPObjectMetaData::ENonConsumable, EMTPConsumable); iObject->SetDesCL(CMTPObjectMetaData::EName, name); iFramework.ObjectMgr().InsertObjectL(*iObject); @@ -572,7 +598,7 @@ __FLOG_VA(_L8("AddEntryL - exit")); } -void CMTPFSEnumerator::AddFileEntryForOtherDpL(const TDesC& aPath, TUint32 &aHandle, TMTPFormatCode format, TUint32 aDPId, const TEntry& /*aEntry*/) +void CMTPFSEnumerator::AddFileEntryForOtherDpL(const TDesC& aPath, TUint32 &aHandle, TMTPFormatCode format, TUint32 aDPId, const TEntry& /*aEntry*/, TUint32 aStorageId, TUint32 aParentHandle) { #ifdef __FLOG_ACTIVE TBuf8 tmp; @@ -589,10 +615,10 @@ iObject->SetUint(CMTPObjectMetaData::EDataProviderId, aDPId); iObject->SetUint(CMTPObjectMetaData::EFormatCode, format); - iObject->SetUint(CMTPObjectMetaData::EStorageId, iStorages[0]); + iObject->SetUint(CMTPObjectMetaData::EStorageId, aStorageId); iObject->SetDesCL(CMTPObjectMetaData::ESuid, aPath); iObject->SetUint(CMTPObjectMetaData::EFormatSubCode, assoc); - iObject->SetUint(CMTPObjectMetaData::EParentHandle, iParentHandle); + iObject->SetUint(CMTPObjectMetaData::EParentHandle, aParentHandle); iObject->SetUint(CMTPObjectMetaData::ENonConsumable, EMTPConsumable); iObject->SetDesCL(CMTPObjectMetaData::EName, name); iFramework.ObjectMgr().InsertObjectL(*iObject); @@ -604,3 +630,4 @@ iSingletons.DpController().NotifyDataProvidersL(DpId,EMTPObjectAdded,(TAny*)&aHandle); } + diff -r d0791faffa3f -r aabe5387f5ce mtpfws/mtpfw/dataproviders/dputility/src/cmtpfullenumservicehandler.cpp --- a/mtpfws/mtpfw/dataproviders/dputility/src/cmtpfullenumservicehandler.cpp Tue Feb 02 01:11:40 2010 +0200 +++ b/mtpfws/mtpfw/dataproviders/dputility/src/cmtpfullenumservicehandler.cpp Fri Mar 19 09:40:39 2010 +0200 @@ -197,23 +197,12 @@ case EMTPServicePropertyFilterType: { - CMTPTypeObjectPropDescEnumerationForm* expectedForm - = CMTPTypeObjectPropDescEnumerationForm::NewL(EMTPTypeUINT8); - CleanupStack::PushL(expectedForm); - expectedForm->AppendSupportedValueL(TMTPTypeUint8(EMTPSyncSvcFilterNone)); - expectedForm->AppendSupportedValueL(TMTPTypeUint8(EMTPSyncSvcFilterContactsWithPhone)); - expectedForm->AppendSupportedValueL(TMTPTypeUint8(EMTPSyncSvcFilterTaskActive)); - expectedForm->AppendSupportedValueL(TMTPTypeUint8(EMTPSyncSvcFilterCalendarWindowWithRecurrence)); - - servicePropDesc = CMTPTypeServicePropDesc::NewL( + servicePropDesc = CMTPTypeServicePropDesc::NewLC( aServicePropertyCode, EMTPTypeUINT8, CMTPTypeObjectPropDesc::EReadWrite, - CMTPTypeObjectPropDesc::EEnumerationForm, - expectedForm); - // Form can be NULL, so need destroy here for MTPType object here. - CleanupStack::PopAndDestroy(expectedForm); - CleanupStack::PushL(servicePropDesc); + CMTPTypeObjectPropDesc::ENone, + NULL); break; } case EMTPServicePropertySyncObjectReferences: diff -r d0791faffa3f -r aabe5387f5ce mtpfws/mtpfw/dataproviders/dputility/src/cmtpgetobjectpropdesc.cpp --- a/mtpfws/mtpfw/dataproviders/dputility/src/cmtpgetobjectpropdesc.cpp Tue Feb 02 01:11:40 2010 +0200 +++ b/mtpfws/mtpfw/dataproviders/dputility/src/cmtpgetobjectpropdesc.cpp Fri Mar 19 09:40:39 2010 +0200 @@ -158,7 +158,8 @@ ServiceNonConsumableL(); break; default: - Panic(EMTPDpUnsupportedProperty); + User::Leave( KErrNotSupported ); + break; } __ASSERT_DEBUG(iObjectProperty, Panic(EMTPDpObjectPropertyNull)); iObjectProperty->SetUint32L(CMTPTypeObjectPropDesc::EGroupCode,GetPropertyGroupNumber(propCode)); diff -r d0791faffa3f -r aabe5387f5ce mtpfws/mtpfw/dataproviders/dputility/src/cmtpgetobjectproplist.cpp --- a/mtpfws/mtpfw/dataproviders/dputility/src/cmtpgetobjectproplist.cpp Tue Feb 02 01:11:40 2010 +0200 +++ b/mtpfws/mtpfw/dataproviders/dputility/src/cmtpgetobjectproplist.cpp Fri Mar 19 09:40:39 2010 +0200 @@ -449,7 +449,7 @@ } break; default: - Panic(EMTPDpUnsupportedProperty); + User::Leave( KErrNotSupported ); break; } } diff -r d0791faffa3f -r aabe5387f5ce mtpfws/mtpfw/dataproviders/dputility/src/cmtpgetobjectpropvalue.cpp --- a/mtpfws/mtpfw/dataproviders/dputility/src/cmtpgetobjectpropvalue.cpp Tue Feb 02 01:11:40 2010 +0200 +++ b/mtpfws/mtpfw/dataproviders/dputility/src/cmtpgetobjectpropvalue.cpp Fri Mar 19 09:40:39 2010 +0200 @@ -166,7 +166,8 @@ ServiceNonConsumableL(); break; default: - Panic(EMTPDpUnsupportedProperty); + User::Leave( KErrNotSupported ); + break; } } @@ -201,7 +202,7 @@ void CMTPGetObjectPropValue::ServiceObjectSizeL() { - iMTPTypeUint64.Set(iFileEntry.iSize); + iMTPTypeUint64.Set(iFileEntry.FileSize()); SendDataL(iMTPTypeUint64); } diff -r d0791faffa3f -r aabe5387f5ce mtpfws/mtpfw/dataproviders/dputility/src/cmtpgetpartialobject.cpp --- a/mtpfws/mtpfw/dataproviders/dputility/src/cmtpgetpartialobject.cpp Tue Feb 02 01:11:40 2010 +0200 +++ b/mtpfws/mtpfw/dataproviders/dputility/src/cmtpgetpartialobject.cpp Fri Mar 19 09:40:39 2010 +0200 @@ -111,7 +111,7 @@ TEntry fileEntry; User::LeaveIfError(iFramework.Fs().Entry(iObjectInfo->DesC(CMTPObjectMetaData::ESuid), fileEntry)); - if((iOffset >= fileEntry.iSize)) + if((iOffset >= fileEntry.FileSize())) { result = EMTPRespCodeInvalidParameter; } diff -r d0791faffa3f -r aabe5387f5ce mtpfws/mtpfw/dataproviders/dputility/src/cmtpknowledgehandler.cpp --- a/mtpfws/mtpfw/dataproviders/dputility/src/cmtpknowledgehandler.cpp Tue Feb 02 01:11:40 2010 +0200 +++ b/mtpfws/mtpfw/dataproviders/dputility/src/cmtpknowledgehandler.cpp Fri Mar 19 09:40:39 2010 +0200 @@ -39,6 +39,183 @@ _LIT(KMTPKnowledgeObjFileName, "mtp_knowledgeobj.dat"); _LIT(KMTPKnowledgeObjSwpFileName, "mtp_knowledgeobj.swp"); + +CKnowledgeObject* CKnowledgeObject::NewL(CRepository& aRepository) + { + CKnowledgeObject *self = new (ELeave) CKnowledgeObject(aRepository); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +CKnowledgeObject::CKnowledgeObject(CRepository& aRepository) : iRepository(aRepository) + { + + } +CKnowledgeObject::~CKnowledgeObject() + { + __FLOG(_L8("~CKnowledgeObject - Entry")); + iDateModified.Close(); + iName.Close(); + __FLOG(_L8("~CKnowledgeObject - Exit")); + __FLOG_CLOSE; + } +void CKnowledgeObject::ConstructL() + { + __FLOG_OPEN(KMTPSubsystem, KComponent); + __FLOG(_L8("CKnowledgeObject Construct - Entry")); + iKnowledgeObjectSize = KObjectSizeNotAvaiable; + iDateModified.CreateL(KDateTimeMaxLength); + iName.CreateL(KNameMaxLength); + iLastAuthorProxyID.Set(KMTPUnInitialized64, KMTPUnInitialized64); + iDirty = EBitFlagAll; + __FLOG(_L8("CKnowledgeObject Construct - Exit")); + } + +void CKnowledgeObject::LoadL() + { + __FLOG(_L8("CKnowledgeObject LoadL - Entry")); + // Load ObjectSize + TInt objSize; + User::LeaveIfError(iRepository.Get(ESize, objSize)); + iKnowledgeObjectSize = objSize; + + // Load DateModify + iDateModified.Zero(); + User::LeaveIfError(iRepository.Get(EDateModified, iDateModified)); + + // Load Name + iName.Zero(); + User::LeaveIfError(iRepository.Get(EName, iName)); + + // Load LastAuthorProxyID: + TPtr8 writeBuf(NULL, 0); //walkaroud for the TMTPTypeUint128 + iLastAuthorProxyID.FirstWriteChunk(writeBuf); + User::LeaveIfError(iRepository.Get(ELastAuthorProxyID, writeBuf)); + iDirty = EBitFlagNone; + __FLOG(_L8("CKnowledgeObject LoadL - Exit")); + return; + } + + +void CKnowledgeObject::Clear() + { + __FLOG(_L8("CKnowledgeObject Clear - Entry")); + iKnowledgeObjectSize = KObjectSizeNotAvaiable; + iDateModified.Zero(); + iName.Zero(); + iLastAuthorProxyID.Set(KMTPUnInitialized64, KMTPUnInitialized64); + iDirty = EBitFlagAll; + __FLOG(_L8("CKnowledgeObject Clear - Exit")); + } + +void CKnowledgeObject::SetSize(TUint64 aSize) + { + iKnowledgeObjectSize = aSize; + iDirty |= EBitFlagSize; + } + +void CKnowledgeObject::SetDateModified(const TDesC& /*aDateModified*/) + { + /** + * DateModifed will be auto updated when commit. If PC set this prop, it will be ignored. + * If someday PC want to force the DateModifed be saved, the following code piece should + * be opened, and add check in commit when save DateModified. + *iDateModified.Copy(aDateModified); + *iDirty |= EBitFlagDateModified; + **/ + } + +void CKnowledgeObject::SetName(const TDesC& aName) + { + iName.Copy(aName); + iDirty |= EBitFlagName; + } + +void CKnowledgeObject::SetLastAuthorProxyID(TUint64 aHigh, TUint64 aLow) + { + iLastAuthorProxyID.Set(aHigh, aLow); + iDirty |= EBitFlagLastAuthorProxyID; + } + +void CKnowledgeObject::CommitL() + { + __FLOG(_L8("CKnowledgeObject CommitL - Entry")); + if (EBitFlagSize == (iDirty & EBitFlagSize)) + { + // TUint64 -> TInt, some capability is lost, + // anyway, it's enough for knowledge object. + User::LeaveIfError(iRepository.Set(ESize, (TInt)iKnowledgeObjectSize)); + } + + if (EBitFlagName == (iDirty & EBitFlagName)) + { + User::LeaveIfError(iRepository.Set(EName, iName)); + } + + if (EBitFlagLastAuthorProxyID == (iDirty & EBitFlagLastAuthorProxyID)) + { + if (EMTPRespCodeOK != SetColumnType128Value(ELastAuthorProxyID, iLastAuthorProxyID)) + { + User::Leave(KErrGeneral); + } + } + + // update DateModified to be the time of Commit + RefreshDateModifed(); + User::LeaveIfError(iRepository.Set(EDateModified, iDateModified)); + + iDirty = EBitFlagNone; + __FLOG(_L8("CKnowledgeObject KnowledgeObject CommitL - Exit")); + return; + } + +TMTPResponseCode CKnowledgeObject::SetColumnType128Value(TMTPKnowledgeStoreKeyNum aColumnNum, TMTPTypeUint128& aNewData) + { + __FLOG(_L8("CKnowledgeObject SetColumnType128ValueL - Entry")); + TInt ret; + TMTPResponseCode responseCode = EMTPRespCodeOK; + TBuf8 data; + data.FillZ(data.MaxLength()); + TUint64 upperValue = aNewData.UpperValue(); + TUint64 lowerValue = aNewData.LowerValue(); + + /** + Least significant 64-bit buffer offset. + */ + const TInt KMTPTypeUint128OffsetLS = 0; + /** + Most significant 64-bit buffer offset. + */ + const TInt KMTPTypeUint128OffsetMS = 8; + + memcpy(&data[KMTPTypeUint128OffsetMS], &upperValue, sizeof(upperValue)); + memcpy(&data[KMTPTypeUint128OffsetLS], &lowerValue, sizeof(lowerValue)); + + ret = iRepository.Set(aColumnNum, data); + if (KErrNone != ret) + { + responseCode = EMTPRespCodeGeneralError; + } + __FLOG_VA((_L8("CKnowledgeObject SetColumnType128ValueL - Exit with responseCode = 0x%04X"), responseCode)); + return responseCode; + } + + +void CKnowledgeObject::RefreshDateModifed() + { + __FLOG(_L8("CKnowledgeObject RefreshDateModifed - Entry")); + //get current time + TTime now; + now.UniversalTime(); + _LIT(KFormat,"%F%Y%M%DT%H%T%SZ"); + iDateModified.Zero(); + now.FormatL(iDateModified, KFormat); + __FLOG(_L8("CKnowledgeObject RefreshDateModifed - Exit")); + return; + } + EXPORT_C CMTPKnowledgeHandler* CMTPKnowledgeHandler::NewL(MMTPDataProviderFramework& aFramework, TUint16 aFormatCode, CRepository& aReposotry, const TDesC& aKwgSuid) { @@ -52,18 +229,16 @@ EXPORT_C CMTPKnowledgeHandler::~CMTPKnowledgeHandler() { __FLOG(_L8("~CMTPKnowledgeHandler - Entry")); - delete iDateModified; - delete iName; delete iKnowledgeObj; delete iKnowledgeSwpBuffer; + delete iCachedKnowledgeObject; __FLOG(_L8("~CMTPKnowledgeHandler - Exit")); __FLOG_CLOSE; } CMTPKnowledgeHandler::CMTPKnowledgeHandler(MMTPDataProviderFramework& aFramework, TUint16 aFormatCode, CRepository& aReposotry, const TDesC& aKwgSuid) : - iFramework(aFramework), iRepository(aReposotry), iKnowledgeFormatCode(aFormatCode), - iKnowledgeObjectSize(KObjectSizeNotAvaiable), iCacheStatus(EOK), iSuid(aKwgSuid) + iFramework(aFramework), iRepository(aReposotry), iKnowledgeFormatCode(aFormatCode), iSuid(aKwgSuid) { } @@ -93,7 +268,9 @@ User::LeaveIfError(iFramework.Fs().Delete(iKnowObjSwpFileName)); } - LoadKnowledgeObjPropertiesL(); + // create and load knowledge object properties + iCachedKnowledgeObject = CKnowledgeObject::NewL(iRepository); + iCachedKnowledgeObject->LoadL(); __FLOG(_L8("ConstructL - Exit")); } @@ -105,26 +282,11 @@ void CMTPKnowledgeHandler::CommitL() { __FLOG(_L8("CommitL - Entry")); - User::LeaveIfError(iRepository.StartTransaction(CRepository::EReadWriteTransaction)); iRepository.CleanupCancelTransactionPushL(); - if(iKnowledgeObjectSize != KObjectSizeNotAvaiable) - { - User::LeaveIfError(iRepository.Set(ESize, (TInt)iKnowledgeObjectSize)); - } - if(iDateModified) - { - User::LeaveIfError(iRepository.Set(EDateModified, *iDateModified)); - } - if(iName) - { - User::LeaveIfError(iRepository.Set(EName, *iName)); - } - if (EMTPRespCodeOK != SetColumnType128Value(ELastAuthorProxyID, iLastAuthorProxyID)) - { - User::Leave(KErrGeneral); - } + iCachedKnowledgeObject->CommitL(); + // Close all knowledge file and reset pointer. if (iKnowledgeObj) { @@ -144,10 +306,11 @@ User::LeaveIfError(iFramework.Fs().Replace(iKnowObjSwpFileName, iKnowObjFileName)); } // If swp file isn't exsited, that means 0 sized object received, need do nothing. - + TUint32 keyInfo; User::LeaveIfError(iRepository.CommitTransaction(keyInfo)); CleanupStack::Pop(&iRepository); + __FLOG(_L8("CommitL - Exit")); } @@ -160,80 +323,21 @@ void CMTPKnowledgeHandler::RollBack() { __FLOG(_L8("Rollback - Entry")); - TRAP_IGNORE(LoadKnowledgeObjPropertiesL()); + iCachedKnowledgeObject->Clear(); + TRAP_IGNORE(iCachedKnowledgeObject->LoadL()); __FLOG(_L8("Rollback - Exit")); } EXPORT_C void CMTPKnowledgeHandler::GetObjectSuidL(TDes& aSuid) const { __FLOG(_L8("GetObjectSuidL - Entry")); - if(iKnowledgeObjectSize != KObjectSizeNotAvaiable) + if(iCachedKnowledgeObject->Size() != KObjectSizeNotAvaiable) { aSuid.Append(iSuid); } __FLOG(_L8("GetObjectSuidL - Exit")); } -void CMTPKnowledgeHandler::LoadKnowledgeObjPropertiesL() - { - __FLOG(_L8("LoadKnowledgeObjPropertiesL - Entry")); - iCacheStatus = EOK; - iCacheStatusFlag = EDirty; - TCleanupItem cacheDroper(DropCacheWrapper, this); - CleanupStack::PushL(cacheDroper); - TInt objSize; - User::LeaveIfError(iRepository.Get(ESize, objSize)); - iKnowledgeObjectSize = objSize; - - // Load DateModify - delete iDateModified; - iDateModified = NULL; - iDateModified = HBufC::NewL(KDateTimeMaxLength); - TPtr ptrDate(iDateModified->Des()); - User::LeaveIfError(iRepository.Get(EDateModified, ptrDate)); - - // Load Name - delete iName; - iName = NULL; - iName = HBufC::NewL(KNameMaxLength); - TPtr ptrName(iName->Des()); - User::LeaveIfError(iRepository.Get(EName, ptrName)); - - // Load LastAuthorProxyID: - TPtr8 writeBuf(NULL, 0); //walkaroud for the TMTPTypeUint128 - iLastAuthorProxyID.FirstWriteChunk(writeBuf); - User::LeaveIfError(iRepository.Get(ELastAuthorProxyID, writeBuf)); - CleanupStack::Pop(this); - // Doesn't load object content to cache beacause it can grow up to 100KB - __FLOG(_L8("LoadKnowledgeObjPropertiesL - Exit")); - } - -void CMTPKnowledgeHandler::DropCacheWrapper(TAny* aObject) - { - reinterpret_cast(aObject)->DropKnowledgeObjPropertiesCache(); - } - -void CMTPKnowledgeHandler::DropKnowledgeObjPropertiesCache() - { - __FLOG(_L8("DropKnowledgeObjPropertiesCache - Entry")); - iCacheStatus = iCacheStatusFlag; - iKnowledgeObjectSize = KObjectSizeNotAvaiable; - - // Load DateModify - delete iDateModified; - iDateModified = NULL; - - // Load Name - delete iName; - iName = NULL; - - // Reset LastAuthorProxyID - TMTPTypeUint128 tmp(MAKE_TINT64(KMTPUnInitialized32, KMTPUnInitialized32), - MAKE_TINT64(KMTPUnInitialized32, KMTPUnInitialized32)); - iLastAuthorProxyID.Set(tmp.UpperValue(), tmp.LowerValue()); - __FLOG(_L8("DropKnowledgeObjPropertiesCache - Exit")); - } - TMTPResponseCode CMTPKnowledgeHandler::SendObjectInfoL(const CMTPTypeObjectInfo& aObjectInfo, TUint32& aParentHandle, TDes& aSuid) { __FLOG(_L("SendObjectInfoL - Entry")); @@ -245,21 +349,22 @@ else { //if there's a read error reread - if(EDirty == iCacheStatus) + if(iCachedKnowledgeObject->IsDirty()) { - LoadKnowledgeObjPropertiesL(); + __FLOG(_L8("Warning: The cached knowledge is dirty")); + iCachedKnowledgeObject->Clear(); + iCachedKnowledgeObject->LoadL(); } //already has a knowledge object - if(iKnowledgeObjectSize != KObjectSizeNotAvaiable) + if(iCachedKnowledgeObject->Size() != KObjectSizeNotAvaiable) { responseCode = EMTPRespCodeAccessDenied; } else { - iKnowledgeObjectSize = aObjectInfo.Uint32L(CMTPTypeObjectInfo::EObjectCompressedSize); - delete iDateModified; - iDateModified = NULL; - iDateModified = aObjectInfo.StringCharsL(CMTPTypeObjectInfo::EDateModified).AllocL(); + iCachedKnowledgeObject->Clear(); + iCachedKnowledgeObject->SetSize(aObjectInfo.Uint32L(CMTPTypeObjectInfo::EObjectCompressedSize)); + // DateModified will be updated when commit. aSuid = iSuid; } } @@ -280,18 +385,21 @@ { //if there's a read error reread aParentHandle = KMTPHandleNoParent; - if(EDirty == iCacheStatus) + if(iCachedKnowledgeObject->IsDirty()) { - LoadKnowledgeObjPropertiesL(); + __FLOG(_L8("Warning: The cached knowledge is dirty")); + iCachedKnowledgeObject->Clear(); + iCachedKnowledgeObject->LoadL(); } //already has a knowledge object - if(iKnowledgeObjectSize != KObjectSizeNotAvaiable) + if(iCachedKnowledgeObject->Size() != KObjectSizeNotAvaiable) { responseCode = EMTPRespCodeAccessDenied; } else { - iKnowledgeObjectSize = aObjectSize; + iCachedKnowledgeObject->Clear(); + iCachedKnowledgeObject->SetSize(aObjectSize); aSuid = iSuid; } } @@ -307,6 +415,12 @@ CMTPTypeObjectPropListElement* propertyElement = NULL; TUint32 aHandle = aObjectMetaData.Uint(CMTPObjectMetaData::EHandle); + if(iCachedKnowledgeObject->IsDirty()) + { + __FLOG(_L8("Warning: The cached knowledge is dirty")); + iCachedKnowledgeObject->LoadL(); + } + switch (aPropertyCode) { case EMTPGenObjPropCodeParentID: @@ -319,9 +433,9 @@ case EMTPGenObjPropCodeName: { propertyElement = &(aPropList.ReservePropElemL(aHandle, aPropertyCode)); - if (iName && iName->Length() > 0) + if (iCachedKnowledgeObject->Name().Length() > 0) { - propertyElement->SetStringL(CMTPTypeObjectPropListElement::EValue, *iName); + propertyElement->SetStringL(CMTPTypeObjectPropListElement::EValue, iCachedKnowledgeObject->Name()); } else { @@ -349,10 +463,10 @@ case EMTPGenObjPropCodeObjectSize: { - if (iKnowledgeObjectSize != ~0) + if (iCachedKnowledgeObject->Size() != KObjectSizeNotAvaiable) { propertyElement = &(aPropList.ReservePropElemL(aHandle, aPropertyCode)); - propertyElement->SetUint64L(CMTPTypeObjectPropListElement::EValue,iKnowledgeObjectSize); + propertyElement->SetUint64L(CMTPTypeObjectPropListElement::EValue, iCachedKnowledgeObject->Size()); } break; } @@ -380,34 +494,24 @@ case EMTPGenObjPropCodeDateModified: { - propertyElement = &(aPropList.ReservePropElemL(aHandle, aPropertyCode)); - if(iDateModified && iDateModified->Length() > 0) - { - propertyElement->SetStringL(CMTPTypeObjectPropListElement::EValue, *iDateModified); - } - else + if(iCachedKnowledgeObject->DateModified().Length() == 0) { - TTime now; - now.UniversalTime(); - const TInt KMaxTimeStringSize = 50; - TBuf dateTimeBuf; - _LIT(KFormat,"%F%Y%M%DT%H%T%S"); - now.FormatL(dateTimeBuf, KFormat); - propertyElement->SetStringL(CMTPTypeObjectPropListElement::EValue, dateTimeBuf); + iCachedKnowledgeObject->RefreshDateModifed(); } + propertyElement = &(aPropList.ReservePropElemL(aHandle, aPropertyCode)); + propertyElement->SetStringL(CMTPTypeObjectPropListElement::EValue, iCachedKnowledgeObject->DateModified()); break; } case EMTPSvcObjPropCodeLastAuthorProxyID: { - const TMTPTypeUint128 unInitValue(MAKE_TUINT64(KMTPUnInitialized32, KMTPUnInitialized32), - MAKE_TUINT64(KMTPUnInitialized32, KMTPUnInitialized32)); - if(!unInitValue.Equal(iLastAuthorProxyID)) + if ((iCachedKnowledgeObject->LastAuthorProxyID().UpperValue() != KMTPUnInitialized64) + && (iCachedKnowledgeObject->LastAuthorProxyID().LowerValue() !=KMTPUnInitialized64)) { propertyElement = &(aPropList.ReservePropElemL(aHandle, aPropertyCode)); propertyElement->SetUint128L(CMTPTypeObjectPropListElement::EValue, - iLastAuthorProxyID.UpperValue(), - iLastAuthorProxyID.LowerValue()); + iCachedKnowledgeObject->LastAuthorProxyID().UpperValue(), + iCachedKnowledgeObject->LastAuthorProxyID().LowerValue()); } break; } @@ -437,43 +541,27 @@ switch (propertyCode) { case EMTPGenObjPropCodeObjectSize: - if(aOperationCode == EMTPOpCodeSetObjectPropList) - { - ret = iRepository.Set(ESize, (TInt)aElement.Uint64L(CMTPTypeObjectPropListElement::EValue)); - } - iKnowledgeObjectSize = aElement.Uint64L(CMTPTypeObjectPropListElement::EValue); + { + iCachedKnowledgeObject->SetSize(aElement.Uint64L(CMTPTypeObjectPropListElement::EValue)); break; - + } case EMTPGenObjPropCodeDateModified: - if(aOperationCode == EMTPOpCodeSetObjectPropList) - { - ret = iRepository.Set(EDateModified, aElement.StringL(CMTPTypeObjectPropListElement::EValue)); - } - delete iDateModified; - iDateModified = NULL; - iDateModified = aElement.StringL(CMTPTypeObjectPropListElement::EValue).AllocL(); + { + // DateModified will be updated when Commit + iCachedKnowledgeObject->SetDateModified(aElement.StringL(CMTPTypeObjectPropListElement::EValue)); break; - + } case EMTPGenObjPropCodeName: - if(aOperationCode == EMTPOpCodeSetObjectPropList) - { - ret = iRepository.Set(EName, aElement.StringL(CMTPTypeObjectPropListElement::EValue)); - } - delete iName; - iName = NULL; - iName = aElement.StringL(CMTPTypeObjectPropListElement::EValue).AllocL(); + { + iCachedKnowledgeObject->SetName(aElement.StringL(CMTPTypeObjectPropListElement::EValue)); break; - + } case EMTPSvcObjPropCodeLastAuthorProxyID: { TUint64 high_value = 0; TUint64 low_value = 0; aElement.Uint128L(CMTPTypeObjectPropListElement::EValue, high_value, low_value); - if(aOperationCode == EMTPOpCodeSetObjectPropList) - { - responseCode = SetColumnType128Value(ELastAuthorProxyID, iLastAuthorProxyID); - } - iLastAuthorProxyID.Set(high_value, low_value); + iCachedKnowledgeObject->SetLastAuthorProxyID(high_value, low_value); break; } @@ -494,16 +582,31 @@ TMTPResponseCode CMTPKnowledgeHandler::DeleteObjectL(const CMTPObjectMetaData& /*aObjectMetaData*/) { __FLOG(_L8("DeleteObjectL - Entry")); - iCacheStatusFlag = EDirty; - TCleanupItem cacheDroper(DropCacheWrapper, this); - CleanupStack::PushL(cacheDroper); + + User::LeaveIfError(iRepository.StartTransaction(CRepository::EReadWriteTransaction)); + iRepository.CleanupCancelTransactionPushL(); + // Delete obejct properties in transaction, if leave, mgr will rollback all properties. - DeleteAllObjectPropertiesL(); - CleanupStack::Pop(this); - // Drop all cached properties. - iCacheStatusFlag = EDeleted; - CMTPKnowledgeHandler::DropCacheWrapper(this); - LoadKnowledgeObjPropertiesL(); + iCachedKnowledgeObject->Clear(); + iCachedKnowledgeObject->CommitL(); + + // Reset knowledgeobject pointer and close the file. + if (iKnowledgeObj) + { + delete iKnowledgeObj; + iKnowledgeObj = NULL; + } + + // Keep file delete is atomic. + if (BaflUtils::FileExists(iFramework.Fs(), iKnowObjFileName)) + { + User::LeaveIfError(iFramework.Fs().Delete(iKnowObjFileName)); + } + + TUint32 keyInfo; + User::LeaveIfError(iRepository.CommitTransaction(keyInfo)); + CleanupStack::Pop(&iRepository); + __FLOG(_L8("DeleteObjectL - Exit")); return EMTPRespCodeOK; } @@ -538,19 +641,12 @@ switch (aPropertyCode) { case EMTPGenObjPropCodeDateModified: - delete iDateModified; - iDateModified = NULL; - if (KErrNone != iRepository.Set(EDateModified, KEmptyContent16)) - { - responseCode = EMTPRespCodeGeneralError; - } + // DateModified will be updated when Commit + iCachedKnowledgeObject->SetDateModified(KEmptyContent16); break; case EMTPSvcObjPropCodeLastAuthorProxyID: { - TMTPTypeUint128 tmp(MAKE_TINT64(KMTPUnInitialized32, KMTPUnInitialized32), - MAKE_TINT64(KMTPUnInitialized32, KMTPUnInitialized32)); - iLastAuthorProxyID.Set(tmp.UpperValue(), tmp.LowerValue()); - responseCode = SetColumnType128Value(ELastAuthorProxyID, iLastAuthorProxyID); + iCachedKnowledgeObject->SetLastAuthorProxyID(KMTPUnInitialized64, KMTPUnInitialized64); break; } @@ -594,7 +690,7 @@ aObjectInfo.SetUint16L(CMTPTypeObjectInfo::EObjectFormat, iKnowledgeFormatCode); // Not use aObjectInfo.SetUint16L(CMTPTypeObjectInfo::EProtectionStatus, 0x0000); - aObjectInfo.SetUint32L(CMTPTypeObjectInfo::EObjectCompressedSize, iKnowledgeObjectSize); + aObjectInfo.SetUint32L(CMTPTypeObjectInfo::EObjectCompressedSize, iCachedKnowledgeObject->Size()); aObjectInfo.SetUint16L(CMTPTypeObjectInfo::EThumbFormat, 0); aObjectInfo.SetUint32L(CMTPTypeObjectInfo::EThumbCompressedSize, 0); aObjectInfo.SetUint32L(CMTPTypeObjectInfo::EThumbPixWidth, 0); @@ -615,7 +711,7 @@ TMTPResponseCode CMTPKnowledgeHandler::GetObjectInfoL(const CMTPObjectMetaData& /*aObjectMetaData*/, CMTPTypeObjectInfo& aObjectInfo) { __FLOG(_L8("GetObjectInfoL - Entry")); - if(iKnowledgeObjectSize != KObjectSizeNotAvaiable) + if(iCachedKnowledgeObject->Size() != KObjectSizeNotAvaiable) { BuildObjectInfoL(aObjectInfo); } @@ -624,42 +720,6 @@ } -void CMTPKnowledgeHandler::DeleteAllObjectPropertiesL() - { - __FLOG(_L8("DeleteAllObjectPropertiesL - Entry")); - User::LeaveIfError(iRepository.StartTransaction(CRepository::EReadWriteTransaction)); - iRepository.CleanupCancelTransactionPushL(); - User::LeaveIfError(iRepository.Set(EDateModified, KEmptyContent16)); - User::LeaveIfError(iRepository.Set(EName, KEmptyContent16)); - User::LeaveIfError(iRepository.Set(ESize, static_cast(KObjectSizeNotAvaiable))); - - TMTPTypeUint128 tmp(MAKE_TINT64(KMTPUnInitialized32, KMTPUnInitialized32), - MAKE_TINT64(KMTPUnInitialized32, KMTPUnInitialized32)); - if (EMTPRespCodeOK != SetColumnType128Value(ELastAuthorProxyID, tmp)) - { - User::Leave(KErrGeneral); - } - // Reset knowledgeobject pointer and close the file. - if (iKnowledgeObj) - { - delete iKnowledgeObj; - iKnowledgeObj = NULL; - } - - // Keep file delete is atomic. - if (BaflUtils::FileExists(iFramework.Fs(), iKnowObjFileName)) - { - User::LeaveIfError(iFramework.Fs().Delete(iKnowObjFileName)); - } - - TUint32 keyInfo; - User::LeaveIfError(iRepository.CommitTransaction(keyInfo)); - CleanupStack::Pop(&iRepository); - - __FLOG(_L8("DeleteAllObjectPropertiesL - Exit")); - return; - } - void CMTPKnowledgeHandler::ReleaseObjectBuffer() { __FLOG(_L8("ReleaseObjectBuffer - Entry")); @@ -678,42 +738,11 @@ { return EMTPRespCodeGeneralError; } - aObjectSize = iKnowledgeObjectSize; + aObjectSize = iCachedKnowledgeObject->Size(); __FLOG(_L8("GetObjectSizeL - Exit")); return EMTPRespCodeOK; } -TMTPResponseCode CMTPKnowledgeHandler::SetColumnType128Value(TMTPKnowledgeStoreKeyNum aColumnNum, TMTPTypeUint128& aNewData) - { - __FLOG(_L8("SetColumnType128ValueL - Entry")); - TInt ret; - TMTPResponseCode responseCode = EMTPRespCodeOK; - TBuf8 data; - data.FillZ(data.MaxLength()); - TUint64 upperValue = aNewData.UpperValue(); - TUint64 lowerValue = aNewData.LowerValue(); - - /** - Least significant 64-bit buffer offset. - */ - const TInt KMTPTypeUint128OffsetLS = 0; - /** - Most significant 64-bit buffer offset. - */ - const TInt KMTPTypeUint128OffsetMS = 8; - - memcpy(&data[KMTPTypeUint128OffsetMS], &upperValue, sizeof(upperValue)); - memcpy(&data[KMTPTypeUint128OffsetLS], &lowerValue, sizeof(lowerValue)); - - ret = iRepository.Set(aColumnNum, data); - if (KErrNone != ret) - { - responseCode = EMTPRespCodeGeneralError; - } - __FLOG_VA((_L8("SetColumnType128ValueL - Exit with responseCode = 0x%04X"), responseCode)); - return responseCode; - } - TMTPResponseCode CMTPKnowledgeHandler::GetAllObjectPropCodeByGroupL(TUint32 aGroupId, RArray& aPropCodes) { __FLOG(_L8("GetAllObjectPropCodeByGroupL - Entry")); @@ -749,3 +778,5 @@ __FLOG(_L8("GetAllObjectPropCodeByGroupL - Exit")); return responseCode; } + + diff -r d0791faffa3f -r aabe5387f5ce mtpfws/mtpfw/dataproviders/dputility/src/cmtpsendobjectinfo.cpp --- a/mtpfws/mtpfw/dataproviders/dputility/src/cmtpsendobjectinfo.cpp Tue Feb 02 01:11:40 2010 +0200 +++ b/mtpfws/mtpfw/dataproviders/dputility/src/cmtpsendobjectinfo.cpp Fri Mar 19 09:40:39 2010 +0200 @@ -365,7 +365,7 @@ } else { - Panic(EMTPDpSendObjectStateInvalid); + User::Leave( KErrGeneral ); } __FLOG(_L8("CheckSendingState - Exit")); return result; diff -r d0791faffa3f -r aabe5387f5ce mtpfws/mtpfw/dataproviders/dputility/src/cmtpsetobjectpropvalue.cpp --- a/mtpfws/mtpfw/dataproviders/dputility/src/cmtpsetobjectpropvalue.cpp Tue Feb 02 01:11:40 2010 +0200 +++ b/mtpfws/mtpfw/dataproviders/dputility/src/cmtpsetobjectpropvalue.cpp Fri Mar 19 09:40:39 2010 +0200 @@ -208,7 +208,8 @@ //No break sentance, goto Panic } default: - Panic(EMTPDpUnsupportedProperty); + User::Leave( KErrNotSupported ); + break; } } @@ -310,7 +311,8 @@ default: - Panic(EMTPDpUnsupportedProperty); + User::Leave( KErrNotSupported ); + break; } SendResponseL(responseCode); diff -r d0791faffa3f -r aabe5387f5ce mtpfws/mtpfw/dataproviders/dputility/src/rmtputility.cpp --- a/mtpfws/mtpfw/dataproviders/dputility/src/rmtputility.cpp Tue Feb 02 01:11:40 2010 +0200 +++ b/mtpfws/mtpfw/dataproviders/dputility/src/rmtputility.cpp Fri Mar 19 09:40:39 2010 +0200 @@ -434,94 +434,122 @@ return 1; } - void RMTPUtility::RenameAllChildrenL(TUint32 aStorageId, TUint32 aParentHandle, const TDesC& aNewFolderName, const TDesC& aOldFolderName) { __FLOG(_L8("RenameAllChildrenL - Entry")); - - RMTPObjectMgrQueryContext context; - RArray handles; - TMTPObjectMgrQueryParams params(aStorageId, KMTPFormatsAll, aParentHandle); - CleanupClosePushL(context); - CleanupClosePushL(handles); - - CMTPObjectMetaData* objectInfo(CMTPObjectMetaData::NewLC()); - TInt count = 0; - TEntry entry; - - do - { - iFramework->ObjectMgr().GetObjectHandlesL(params, context, handles); - count = handles.Count(); - - for(TInt i(0); (i < count); i++) - { - if (!iFramework->ObjectMgr().ObjectL(handles[i], *objectInfo)) - { - User::Leave(KErrCorrupt); - } - - /** - * [SP-Format-0x3002]Special processing for PictBridge DP which own 6 dps file with format 0x3002, - * but it does not really own the format 0x3002. - * - * Make the same behavior betwen 0x3000 and 0x3002. - */ - if( (objectInfo->Uint(CMTPObjectMetaData::EFormatCode) != EMTPFormatCodeAssociation) - && (objectInfo->Uint(CMTPObjectMetaData::EFormatCode) != EMTPFormatCodeUndefined) - && (objectInfo->Uint(CMTPObjectMetaData::EFormatCode) != EMTPFormatCodeScript) ) - continue; + + CMTPObjectMetaData* objectInfo(CMTPObjectMetaData::NewLC()); + TInt count = 0; + RArray handles; + CleanupClosePushL(handles); + GetAllDecendents(aStorageId, aParentHandle, handles); + count = handles.Count(); + + TEntry entry; + for(TInt i(0); (i < count); ++i) + { + if (!iFramework->ObjectMgr().ObjectL(handles[i], *objectInfo)) + { + User::Leave(KErrCorrupt); + } + + /** + * [SP-Format-0x3002]Special processing for PictBridge DP which own 6 dps file with format 0x3002, + * but it does not really own the format 0x3002. + * + * Make the same behavior betwen 0x3000 and 0x3002. + */ + if( (objectInfo->Uint(CMTPObjectMetaData::EFormatCode) != EMTPFormatCodeAssociation) + && (objectInfo->Uint(CMTPObjectMetaData::EFormatCode) != EMTPFormatCodeUndefined) + && (objectInfo->Uint(CMTPObjectMetaData::EFormatCode) != EMTPFormatCodeScript) ) + continue; - RBuf entryName; - entryName.CreateL(KMaxFileName); - entryName.CleanupClosePushL(); - entryName = objectInfo->DesC(CMTPObjectMetaData::ESuid); - - RBuf rightPartName; - rightPartName.CreateL(KMaxFileName); - rightPartName.CleanupClosePushL(); - rightPartName = entryName.Right(entryName.Length() - aOldFolderName.Length()); - - if ((aNewFolderName.Length() + rightPartName.Length()) > entryName.MaxLength()) - { - entryName.ReAllocL(aNewFolderName.Length() + rightPartName.Length()); - } - - entryName.Zero(); - entryName.Append(aNewFolderName); - entryName.Append(rightPartName); - - if (KErrNone != iFramework->Fs().Entry(entryName, entry)) - { - // Skip objects that don't use the file path as SUID. - CleanupStack::PopAndDestroy(&entryName); - continue; - } - - // Recursively update all this object's children. - // The maximum recursion depth is as deep as the association hierarchy. - RenameAllChildrenL(objectInfo->Uint(CMTPObjectMetaData::EStorageId), objectInfo->Uint(CMTPObjectMetaData::EHandle), entryName, objectInfo->DesC(CMTPObjectMetaData::ESuid) ); - - TFileName oldfilename(objectInfo->DesC(CMTPObjectMetaData::ESuid)); - objectInfo->SetDesCL(CMTPObjectMetaData::ESuid, entryName); - iFramework->ObjectMgr().ModifyObjectL(*objectInfo); - - if(objectInfo->Uint(CMTPObjectMetaData::EFormatCode) == EMTPFormatCodeAssociation) - { - //Send the Rename notification - TMTPNotificationParamsHandle param = { handles[i], oldfilename}; - iSingleton.DpController().NotifyDataProvidersL(EMTPRenameObject, static_cast(¶m)); - } - CleanupStack::PopAndDestroy(2); // rightPartName, entryName - } - } - while (!context.QueryComplete()); - - CleanupStack::PopAndDestroy(3);//objectInfo; &handles; &context + RBuf entryName; + entryName.CreateL(KMaxFileName); + entryName.CleanupClosePushL(); + entryName = objectInfo->DesC(CMTPObjectMetaData::ESuid); + + RBuf rightPartName; + rightPartName.CreateL(KMaxFileName); + rightPartName.CleanupClosePushL(); + rightPartName = entryName.Right(entryName.Length() - aOldFolderName.Length()); + + if ((aNewFolderName.Length() + rightPartName.Length()) > entryName.MaxLength()) + { + entryName.ReAllocL(aNewFolderName.Length() + rightPartName.Length()); + } + + entryName.Zero(); + entryName.Append(aNewFolderName); + entryName.Append(rightPartName); + + if (KErrNone != iFramework->Fs().Entry(entryName, entry)) + { + // Skip objects that don't use the file path as SUID. + CleanupStack::PopAndDestroy(&entryName); + continue; + } + + TFileName oldfilename(objectInfo->DesC(CMTPObjectMetaData::ESuid)); + objectInfo->SetDesCL(CMTPObjectMetaData::ESuid, entryName); + iFramework->ObjectMgr().ModifyObjectL(*objectInfo); + + if(objectInfo->Uint(CMTPObjectMetaData::EFormatCode) == EMTPFormatCodeAssociation) + { + //Send the Rename notification + TMTPNotificationParamsHandle param = { handles[i], oldfilename}; + iSingleton.DpController().NotifyDataProvidersL(EMTPRenameObject, static_cast(¶m)); + } + + CleanupStack::PopAndDestroy(2); // rightPartName, entryName + } + + CleanupStack::PopAndDestroy(2); //objectInfo; &handles; __FLOG(_L8("RenameAllChildrenL - Exit")); } +void RMTPUtility::GetAllDecendents(TUint32 aStorageId, TUint aParentHandle, RArray& aHandles) const + { + TInt index = 0; + TBool firstLevel = ETrue; + + do + { + TUint parentHandle; + if (firstLevel) + { + parentHandle = aParentHandle; //Get the first level children handles + firstLevel = EFalse; + } + else + { + parentHandle = aHandles[index]; + ++index; + } + + RMTPObjectMgrQueryContext context; + RArray childrenHandles; + TMTPObjectMgrQueryParams params(aStorageId, KMTPFormatsAll, parentHandle); + CleanupClosePushL(context); + CleanupClosePushL(childrenHandles); + + do + { + iFramework->ObjectMgr().GetObjectHandlesL(params, context, childrenHandles); + TInt count = childrenHandles.Count(); + for (TUint i = 0; i < count; ++i) + { + aHandles.Append(childrenHandles[i]); + } + } + while (!context.QueryComplete()); + CleanupStack::PopAndDestroy(2); //&childrenHandles; &context + } + while(index < aHandles.Count()); + + } + HBufC* RMTPUtility::OdfMimeTypeL( const TDesC& aFullPath ) { HBufC* mimebuf = NULL; diff -r d0791faffa3f -r aabe5387f5ce mtpfws/mtpfw/dataproviders/proxydp/inc/cmtpdeleteobject.h --- a/mtpfws/mtpfw/dataproviders/proxydp/inc/cmtpdeleteobject.h Tue Feb 02 01:11:40 2010 +0200 +++ b/mtpfws/mtpfw/dataproviders/proxydp/inc/cmtpdeleteobject.h Fri Mar 19 09:40:39 2010 +0200 @@ -45,7 +45,8 @@ private: // From CMTPRequestProcessor void ServiceL(); - + TMTPResponseCode CheckRequestL(); + private: // From MMTPTransactionProxy void ProxyReceiveDataL(MMTPType& aData, const TMTPTypeRequest& aRequest, MMTPConnection& aConnection, TRequestStatus& aStatus); diff -r d0791faffa3f -r aabe5387f5ce mtpfws/mtpfw/dataproviders/proxydp/inc/cmtpmoveobject.h --- a/mtpfws/mtpfw/dataproviders/proxydp/inc/cmtpmoveobject.h Tue Feb 02 01:11:40 2010 +0200 +++ b/mtpfws/mtpfw/dataproviders/proxydp/inc/cmtpmoveobject.h Fri Mar 19 09:40:39 2010 +0200 @@ -95,7 +95,6 @@ RBuf iNewParent; TUint32 iStorageId; CDesCArray* iPathToCreate; - static const TMTPRequestElementInfo KMTPMoveObjectPolicy[]; CMTPObjectBrowser* iObjBrowser; RArray< TUint32 > iHandles; diff -r d0791faffa3f -r aabe5387f5ce mtpfws/mtpfw/dataproviders/proxydp/inc/cmtpobjectbrowser.h --- a/mtpfws/mtpfw/dataproviders/proxydp/inc/cmtpobjectbrowser.h Tue Feb 02 01:11:40 2010 +0200 +++ b/mtpfws/mtpfw/dataproviders/proxydp/inc/cmtpobjectbrowser.h Fri Mar 19 09:40:39 2010 +0200 @@ -58,6 +58,15 @@ void GetRootObjectHandlesL( TUint32 aCurDepth, TUint32 aFormatCode, TUint32 aDepth, const TBrowseCallback& aBrowseCallback ) const; void GetObjectHandlesTreeL( TUint32 aCurDepth, TUint32 aFormatCode, TUint32 aDepth, TUint32 aParentHandle, const TBrowseCallback& aBrowseCallback ) const; + /** + * This function retrives all the object handles with the format code of aFormatCode. + * + * If aFormatCode == KMTPFormatsAll, only Legacy dp's object handles are returned. Object + * Handles of service dp's will not be returned. + * + */ + void GetAllObjectHandlesL( TUint32 aFormatCode,const TBrowseCallback& aBrowseCallback ) const; + private: __FLOG_DECLARATION_MEMBER_MUTABLE; diff -r d0791faffa3f -r aabe5387f5ce mtpfws/mtpfw/dataproviders/proxydp/src/cmtpcopyobject.cpp --- a/mtpfws/mtpfw/dataproviders/proxydp/src/cmtpcopyobject.cpp Tue Feb 02 01:11:40 2010 +0200 +++ b/mtpfws/mtpfw/dataproviders/proxydp/src/cmtpcopyobject.cpp Fri Mar 19 09:40:39 2010 +0200 @@ -27,6 +27,17 @@ const TUint KInvalidDpId = 0xFF; /** +Verification data for the CopyObject request +*/ +const TMTPRequestElementInfo KMTPCopyObjectPolicy[] = + { + {TMTPTypeRequest::ERequestParameter1, EMTPElementTypeObjectHandle, EMTPElementAttrFileOrDir, 0, 0, 0}, + {TMTPTypeRequest::ERequestParameter2, EMTPElementTypeStorageId, EMTPElementAttrWrite, 0, 0, 0}, + {TMTPTypeRequest::ERequestParameter3, EMTPElementTypeObjectHandle, EMTPElementAttrDir | EMTPElementAttrWrite, 1, 0, 0} + }; + + +/** Two-phase construction method @param aFramework The data provider framework @param aConnection The connection from which the request comes @@ -61,7 +72,7 @@ Constructor */ CMTPCopyObject::CMTPCopyObject(MMTPDataProviderFramework& aFramework, MMTPConnection& aConnection) : - CMTPRequestProcessor(aFramework, aConnection, 0, NULL) + CMTPRequestProcessor(aFramework, aConnection, sizeof(KMTPCopyObjectPolicy)/sizeof(TMTPRequestElementInfo), KMTPCopyObjectPolicy) { __FLOG_OPEN( KMTPSubsystem, KComponent ); __FLOG( _L8("+/-Ctor") ); diff -r d0791faffa3f -r aabe5387f5ce mtpfws/mtpfw/dataproviders/proxydp/src/cmtpdeleteobject.cpp --- a/mtpfws/mtpfw/dataproviders/proxydp/src/cmtpdeleteobject.cpp Tue Feb 02 01:11:40 2010 +0200 +++ b/mtpfws/mtpfw/dataproviders/proxydp/src/cmtpdeleteobject.cpp Fri Mar 19 09:40:39 2010 +0200 @@ -35,6 +35,14 @@ const TUint KInvalidDpId = 0xFF; /** +Verification data for the DeleteObject request +*/ +const TMTPRequestElementInfo KMTPDeleteObjectPolicy[] = + { + { TMTPTypeRequest::ERequestParameter1, EMTPElementTypeObjectHandle, (EMTPElementAttrDir | EMTPElementAttrWrite), 1, KMTPHandleAll, 0 } + }; + +/** Two-phase construction method @param aFramework The data provider framework @param aConnection The connection from which the request comes @@ -67,7 +75,7 @@ Constructor */ CMTPDeleteObject::CMTPDeleteObject(MMTPDataProviderFramework& aFramework, MMTPConnection& aConnection) : - CMTPRequestProcessor(aFramework, aConnection, 0, NULL), + CMTPRequestProcessor(aFramework, aConnection, sizeof(KMTPDeleteObjectPolicy)/sizeof(TMTPRequestElementInfo), KMTPDeleteObjectPolicy), iDeletedObjectsNumber(0) { __FLOG_OPEN( KMTPSubsystem, KComponent ); @@ -86,6 +94,19 @@ __FLOG( _L8("-ConstructL") ); } +TMTPResponseCode CMTPDeleteObject::CheckRequestL() + { + __FLOG(_L8("CheckRequestL - Entry")); + TMTPResponseCode responseCode = CMTPRequestProcessor::CheckRequestL(); + if ((EMTPRespCodeOK == responseCode) && (iSingletons.DpController().EnumerateState() == CMTPDataProviderController::EEnumeratingSubDirFiles)) + { + responseCode = EMTPRespCodeDeviceBusy; + } + + __FLOG_VA((_L8("CheckRequestL - Exit with responseCode = 0x%04X"), responseCode)); + return responseCode; + } + /** DeleteObject request handler */ @@ -158,11 +179,21 @@ if ( iStatus == KErrNone ) { - NextObjectHandleL(); - if ( iOwnerDp != KInvalidDpId ) + //First check if the operation has been cancelled or not + if(iCancelled) { - CMTPDataProvider& dp = iSingletons.DpController().DataProviderL( iOwnerDp ); - dp.ExecuteProxyRequestL( iCurrentRequest, Connection(), *this ); + __FLOG(_L8("Initiator cancell delete, send response with cancelled code ")); + SendResponseL(EMTPRespCodeTransactionCancelled); + iCancelled = EFalse; + } + else + { + NextObjectHandleL(); + if ( iOwnerDp != KInvalidDpId ) + { + CMTPDataProvider& dp = iSingletons.DpController().DataProviderL( iOwnerDp ); + dp.ExecuteProxyRequestL( iCurrentRequest, Connection(), *this ); + } } } else @@ -209,6 +240,7 @@ iHandles.Reset(); iCurrentHandle = 0; iDeletedObjectsNumber = 0; + MMTPType::CopyL( Request(), iCurrentRequest ); CMTPObjectBrowser::TBrowseCallback callback = { CMTPDeleteObject::OnBrowseObjectL, this }; diff -r d0791faffa3f -r aabe5387f5ce mtpfws/mtpfw/dataproviders/proxydp/src/cmtpgetobjectproplist.cpp --- a/mtpfws/mtpfw/dataproviders/proxydp/src/cmtpgetobjectproplist.cpp Tue Feb 02 01:11:40 2010 +0200 +++ b/mtpfws/mtpfw/dataproviders/proxydp/src/cmtpgetobjectproplist.cpp Fri Mar 19 09:40:39 2010 +0200 @@ -33,6 +33,15 @@ __FLOG_STMT( _LIT8( KComponent,"PrxyGetObjPrpLst" ); ) const TUint KInvalidDpId = 0xFF; + +/** +Verification data for the GetObjectPropList request +*/ +const TMTPRequestElementInfo KMTPGetObjectPropListPolicy[] = + { + { TMTPTypeRequest::ERequestParameter1, EMTPElementTypeObjectHandle, EMTPElementAttrNone, 2, KMTPHandleAll, KMTPHandleNone} + }; + /** Factory method. @param aFramework The data provider framework @@ -126,7 +135,7 @@ __ASSERT_DEBUG((( (iRequest == &aRequest) || ( &iCurrentRequest == &aRequest ) ) && (&iConnection == &aConnection)), Panic(EMTPNotSameRequestProxy)); TUint16 response = iResponse.Uint16(TMTPTypeResponse::EResponseCode); - if(( EMTPRespCodeGroupNotSupported == response) || (EMTPRespCodeSpecificationByGroupUnsupported == response)) + if(( EMTPRespCodeGroupNotSupported == response) || (EMTPRespCodeSpecificationByGroupUnsupported == response) || ( EMTPRespCodeObjectPropNotSupported == response)) { response = EMTPRespCodeOK; iResponse.SetUint16(TMTPTypeResponse::EResponseCode, response); @@ -178,7 +187,7 @@ Constructor. */ CMTPGetObjectPropList::CMTPGetObjectPropList(MMTPDataProviderFramework& aFramework, MMTPConnection& aConnection) : - CMTPRequestProcessor(aFramework, aConnection, 0, NULL) + CMTPRequestProcessor(aFramework, aConnection, sizeof(KMTPGetObjectPropListPolicy)/sizeof(TMTPRequestElementInfo), KMTPGetObjectPropListPolicy) { __FLOG_OPEN( KMTPSubsystem, KComponent ); __FLOG( _L8("+/-Ctor") ); @@ -248,18 +257,7 @@ if ( 0 == iHandles.Count() ) { - if ( handle==KMTPHandleNone && depth==0 ) - { - SendDataL( *iObjectPropList ); - } - else if ( fmtCode != KMTPFormatsAll ) - { - SendResponseL(EMTPRespCodeSpecificationByFormatUnsupported); - } - else if ( handle != KMTPHandleAll ) - { - SendResponseL(EMTPRespCodeInvalidObjectHandle); - } + SendDataL( *iObjectPropList ); } else { diff -r d0791faffa3f -r aabe5387f5ce mtpfws/mtpfw/dataproviders/proxydp/src/cmtpmoveobject.cpp --- a/mtpfws/mtpfw/dataproviders/proxydp/src/cmtpmoveobject.cpp Tue Feb 02 01:11:40 2010 +0200 +++ b/mtpfws/mtpfw/dataproviders/proxydp/src/cmtpmoveobject.cpp Fri Mar 19 09:40:39 2010 +0200 @@ -32,7 +32,7 @@ /** Verification data for the MoveObject request */ -const TMTPRequestElementInfo CMTPMoveObject::KMTPMoveObjectPolicy[] = +const TMTPRequestElementInfo KMTPMoveObjectPolicy[] = { {TMTPTypeRequest::ERequestParameter1, EMTPElementTypeObjectHandle, EMTPElementAttrFileOrDir | EMTPElementAttrWrite, 0, 0, 0}, {TMTPTypeRequest::ERequestParameter2, EMTPElementTypeStorageId, EMTPElementAttrWrite, 0, 0, 0}, diff -r d0791faffa3f -r aabe5387f5ce mtpfws/mtpfw/dataproviders/proxydp/src/cmtpobjectbrowser.cpp --- a/mtpfws/mtpfw/dataproviders/proxydp/src/cmtpobjectbrowser.cpp Tue Feb 02 01:11:40 2010 +0200 +++ b/mtpfws/mtpfw/dataproviders/proxydp/src/cmtpobjectbrowser.cpp Fri Mar 19 09:40:39 2010 +0200 @@ -56,6 +56,7 @@ { case KMTPHandleAll: GetObjectHandlesL( 0, KMTPStorageAll, aFormatCode, KMaxTUint, KMTPHandleNoParent, aBrowseCallback ); + break; case KMTPHandleNone: GetRootObjectHandlesL( 0, aFormatCode, aDepth, aBrowseCallback ); @@ -88,7 +89,16 @@ RMTPObjectMgrQueryContext context; RArray< TUint > handles; - TMTPObjectMgrQueryParams params( aStorageId, aFormatCode, aParentHandle ); + TMTPObjectMgrQueryParams params( aStorageId, KMTPFormatsAll, aParentHandle ); + // if parenthandle = 0, depth >0 and != ffffffff, for service dp, + // 1. there is no tree structure + // 2. KMTPFormatsAll may make the low lever api filter the handls of service dp. + if( (aFormatCode >= EMTPFormatCodeVendorExtStart)&&(aFormatCode <= EMTPFormatCodeVendorExtEnd) ) + { + params.iFormatCode = aFormatCode ; + } + + CleanupClosePushL( context ); CleanupClosePushL( handles ); @@ -107,7 +117,13 @@ { for ( TUint i = 0; i < handleCount; i++ ) { - aBrowseCallback.iCallback( aBrowseCallback.iContext, handles[i], aCurDepth ); + //before insert the handle to th result list , check it's format. + iDpFw.ObjectMgr().ObjectL( handles[i], *iObjMetaCache ); + if ( (KMTPFormatsAll == aFormatCode) || ( aFormatCode == iObjMetaCache->Uint( CMTPObjectMetaData::EFormatCode )) ) + { + aBrowseCallback.iCallback( aBrowseCallback.iContext, handles[i], aCurDepth ); + } + } } } @@ -123,16 +139,18 @@ { __FLOG_VA( ( _L8("+GetFolderObjectHandlesL( %d, 0x%08X, %d, 0x%08X )"), aCurDepth, aFormatCode, aDepth, aParentHandle ) ); - if ( 0 == aDepth ) - { - aBrowseCallback.iCallback( aBrowseCallback.iContext, aParentHandle, aCurDepth ); - } - else + if ( aDepth > 0) { GetObjectHandlesL( aCurDepth + 1, KMTPStorageAll, aFormatCode, aDepth - 1, aParentHandle, aBrowseCallback ); - aBrowseCallback.iCallback( aBrowseCallback.iContext, aParentHandle, aCurDepth ); } + //before insert the handle to th result list , check it's format. + iDpFw.ObjectMgr().ObjectL( aParentHandle, *iObjMetaCache ); + if ( (KMTPFormatsAll == aFormatCode) || ( aFormatCode == iObjMetaCache->Uint( CMTPObjectMetaData::EFormatCode )) ) + { + aBrowseCallback.iCallback( aBrowseCallback.iContext, aParentHandle, aCurDepth ); + } + __FLOG( _L8("-GetFolderObjectHandlesL") ); } @@ -140,19 +158,14 @@ { __FLOG_VA( ( _L8("+GetRootObjectHandlesL( %d, 0x%08X, %d )"), aCurDepth, aFormatCode, aDepth ) ); - switch ( aDepth ) - { - case KMaxTUint: - GetObjectHandlesL( aCurDepth, KMTPStorageAll, aFormatCode, aDepth, KMTPHandleNoParent, aBrowseCallback ); - break; - case 0: - // do nothing - break; - default: - GetObjectHandlesL( aCurDepth, KMTPStorageAll, aFormatCode, aDepth, KMTPHandleNoParent, aBrowseCallback ); - break; + if( aDepth > 0) + { + // attention: aDepth should be reduced by 1 here + GetObjectHandlesL( aCurDepth, KMTPStorageAll, aFormatCode, aDepth-1, KMTPHandleNoParent, aBrowseCallback ); } + // if aDepth == 0, no handles should be returned. + __FLOG( _L8("-GetRootObjectHandlesL") ); } @@ -169,9 +182,13 @@ { GetFolderObjectHandlesL( aCurDepth, aFormatCode, aDepth, aParentHandle, aBrowseCallback ); } + else if ( (KMTPFormatsAll == aFormatCode) || ( aFormatCode == iObjMetaCache->Uint( CMTPObjectMetaData::EFormatCode )) ) + { + aBrowseCallback.iCallback( aBrowseCallback.iContext, aParentHandle, aCurDepth ); + } else { - aBrowseCallback.iCallback( aBrowseCallback.iContext, aParentHandle, aCurDepth ); + // format doesn't match, do nothing } #ifdef __FLOG_ACTIVE __FLOG_1( _L8("recursion_depth: %d"), aCurDepth ); @@ -181,4 +198,45 @@ __FLOG( _L8("-GetObjectHandlesTreeL") ); } +/** + * This function retrives all the object handles with the format code of aFormatCode. + * + * If aFormatCode == KMTPFormatsAll, only Legacy dp's object handles are returned. Object + * Handles of service dp's will not be returned. + * + */ +void CMTPObjectBrowser::GetAllObjectHandlesL(TUint32 aFormatCode,const TBrowseCallback& aBrowseCallback ) const + { + __FLOG( _L8("CMTPObjectBrowser::GetAllObjectHandles-----entry") ); + + RMTPObjectMgrQueryContext context; + RArray< TUint > handles; + TMTPObjectMgrQueryParams params( KMTPStorageAll, aFormatCode, KMTPHandleNone ); + + + CleanupClosePushL( context ); + CleanupClosePushL( handles ); + + do + { + iDpFw.ObjectMgr().GetObjectHandlesL( params, context, handles ); + TUint handleCount = handles.Count(); + + for ( TUint i = 0; i < handleCount; i++ ) + { + /* the argument aCurDepth of the callback is set to 0, since the call back never use this argument. + * If aCurDepth is used later, this arugment shoud be changed to the valid value. + */ + aBrowseCallback.iCallback( aBrowseCallback.iContext, handles[i], 0 ); + } + + } + while ( !context.QueryComplete() ); + + CleanupStack::PopAndDestroy( &handles ); + CleanupStack::PopAndDestroy( &context ); + + __FLOG( _L8("CMTPObjectBrowser::GetAllObjectHandles------exit") ); + } + diff -r d0791faffa3f -r aabe5387f5ce mtpfws/mtpfw/datatypes/interface/cmtptypefile.h --- a/mtpfws/mtpfw/datatypes/interface/cmtptypefile.h Tue Feb 02 01:11:40 2010 +0200 +++ b/mtpfws/mtpfw/datatypes/interface/cmtptypefile.h Fri Mar 19 09:40:39 2010 +0200 @@ -33,6 +33,43 @@ */ class CMTPTypeFile : public CActive, public MMTPType { + +class CFileWriter : public CActive + { +public: + + static CFileWriter* NewL(RFile& aFile, RBuf8& aWriteBuf); + /* + * Get the buffer for transport to receive data. + */ + void GetWriteBuf(TPtr8& aChunk); + /* + * Get the file write result. + */ + TInt GetResult() const; + /* + * Issue a async request to write aLength Data + * + */ + void Write(TInt aLength); + /* + * Wait until the async write complete. + */ + void WaitForWriteComplete(); + void RunL(); + ~CFileWriter(); + +private: + void DoCancel(); + CFileWriter(RFile& aFile, RBuf8& aBuf); + void ConstructL(); + +private: + TInt iWriteResult; + RFile& iFile; + RBuf8& iBuf; + }; + public: IMPORT_C static CMTPTypeFile* NewL(RFs& aFs, const TDesC& aFileName, TFileMode aFileMode); @@ -167,6 +204,14 @@ TInt64 iOffSet; mutable TInt64 iByteSent; + /* + * Use the writer to controll buffer1 write. + */ + CFileWriter *iFileWriter1; + /* + * Use the writer to controll buffer2 write. + */ + CFileWriter *iFileWriter2; }; diff -r d0791faffa3f -r aabe5387f5ce mtpfws/mtpfw/datatypes/src/cmtptypefile.cpp --- a/mtpfws/mtpfw/datatypes/src/cmtptypefile.cpp Tue Feb 02 01:11:40 2010 +0200 +++ b/mtpfws/mtpfw/datatypes/src/cmtptypefile.cpp Fri Mar 19 09:40:39 2010 +0200 @@ -32,6 +32,80 @@ const TUint KUSBHeaderLen = 12; + + +CMTPTypeFile::CFileWriter* CMTPTypeFile::CFileWriter::NewL(RFile& aFile, RBuf8& aWriteBuf) + { + CFileWriter *self = new(ELeave)CFileWriter(aFile, aWriteBuf); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +void CMTPTypeFile::CFileWriter::GetWriteBuf(TPtr8& aChunk) + { + WaitForWriteComplete(); + aChunk.Set(&iBuf[0], 0, iBuf.MaxLength()); + } + +TInt CMTPTypeFile::CFileWriter::GetResult() const + { + return iWriteResult; + } + +void CMTPTypeFile::CFileWriter::Write(TInt aLength) + { + iFile.Write(iBuf, aLength, iStatus); + SetActive(); + } + +void CMTPTypeFile::CFileWriter::WaitForWriteComplete() + { + /* + * We didn't want to cancel the file write here. + * But we need to wait until the file write complete. + * The Cancel() function of CActive will do the wait until the file write complete. + * If the Write already complete and the RunL() invoked there's nothing happened in the Cancel(). + */ + Cancel(); + //Have to save the result. + iWriteResult = iStatus.Int(); + } + +void CMTPTypeFile::CFileWriter::RunL() + { + //Have to save the result. + iWriteResult = iStatus.Int(); + } + + +CMTPTypeFile::CFileWriter::~CFileWriter() + { + WaitForWriteComplete(); //make sure all async request complete + if(iWriteResult != KErrNone) + { + iFile.SetSize(0); + } + } + + +void CMTPTypeFile::CFileWriter::DoCancel() + { + //We didn't really want to cancel the file write, so we do nothing here + } + + +CMTPTypeFile::CFileWriter::CFileWriter(RFile& aFile, RBuf8& aBuf):CActive(EPriorityStandard), iWriteResult(KErrNone), iFile(aFile), iBuf(aBuf) + { + } + + +void CMTPTypeFile::CFileWriter::ConstructL() + { + CActiveScheduler::Add(this); + } + /** MTP file object data type factory method. @param aFs The handle of an active file server session. @@ -88,13 +162,9 @@ */ EXPORT_C CMTPTypeFile::~CMTPTypeFile() { - if(iCurrentCommitChunk.Length() != 0) - { - ToggleRdWrBuffer(); - } - + delete iFileWriter1; + delete iFileWriter2; iFile.Close(); - iBuffer1.Close(); iBuffer2.Close(); Cancel(); @@ -133,6 +203,8 @@ User::LeaveIfError(iFile.SetSize(aSize)); iCurrentFileSetSize = aSize; } + iFileWriter1 = CFileWriter::NewL(iFile, iBuffer1); + iFileWriter2 = CFileWriter::NewL(iFile, iBuffer2); } /** @@ -311,19 +383,14 @@ TInt err(iFile.Seek(ESeekStart, pos)); if (err == KErrNone) { - //Because USB HS's transmission rate is several time faster than the rate of writting data into File System. - //If the first packet is a full chunk size packet, then the writting of that data will not start until the full-chunk - //sized packet is received. Here we intentionly reduce the first packet size to 1/4 of the full chunk size, therefore, - //the start of writting data into File system will start only after 1/4 of the full chunk size data is received. - //This can make the writting of data to FS start earlier. - aChunk.Set(&iBuffer1[0], 0, iBuffer1.MaxLength()); + iFileWriter1->GetWriteBuf(aChunk); iWriteSequenceState = EInProgress; //this chunk is going to be used by Transport to write data into it, and when it is full, transport - //will call back CommitChunkL(), at that time, the EFalse means it already contains data in it. + //will call back CommitChunkL(), at that time, the ETrue means it already contains data in it. //it is ready for reading data from it. //This is a initial value for it to trigger the double-buffering mechanism. - iBuffer1AvailForWrite = EFalse; + iBuffer1AvailForWrite = ETrue; } return err; @@ -342,11 +409,11 @@ {//toggle between buffer 1 and buffer 2 here. if(iBuffer1AvailForWrite) { - aChunk.Set(&iBuffer1[0], 0, iBuffer1.MaxLength()); + iFileWriter1->GetWriteBuf(aChunk); } else { - aChunk.Set(&iBuffer2[0], 0, iBuffer2.MaxLength()); + iFileWriter2->GetWriteBuf(aChunk); } } @@ -402,51 +469,43 @@ EXPORT_C MMTPType* CMTPTypeFile::CommitChunkL(TPtr8& aChunk) { - if(iFileRdWrError) - { - return NULL; - } - if(0 == aChunk.Length()) - { - ToggleRdWrBuffer(); - return NULL; - } + if(iFileRdWrError) + { + return NULL; + } iCurrentCommitChunk.Set(aChunk); - if(iRemainingDataSize> iCurrentCommitChunk.Length()) - {//This is NOT the last chunk, we issue an active object to commit it to File system. - iRemainingDataSize -= iCurrentCommitChunk.Length(); - /* - if (!IsActive()) - { - //Since the writting data into file sever will take a long time, will issue a dedicated Active Object to do that. - SetActive(); - TRequestStatus* thisAO = &iStatus; - User::RequestComplete(thisAO, KErrNone); - } - else - { - //This is a very extreme cases, it only occurs when the following assumption is met - //1. USB received buffer1 and already call this CommitChunkL(), therefore, the ActiveObject has completed itself, and USB then use another buffer to - //receive the data. - //2. Somehow, this active object is not scheduled to be running even after the USB already fill out the other buffer. - //3. USB's active object is scheduled to be running prior to the last File active object(this should not happen if ActiveScheduler follow the priority scheduler). - //4. USB call this function again to commit the other data buffer. - //5. Then it find the previous active is not scheduled to run. - //in single-core platform, the code rely on the CActiveScheduler to guarantee the first active call which has higher priority to be running firstly before - //the 2nd USB active. but for multi-core platform, this should be re-evaluated . - iFileRdWrError = ETrue;//if it really discard the incoming recevied file. - //__FLOG(_L8("\nThe program should not arrive here !!!!!\n")); - } - */ + { + iRemainingDataSize -= iCurrentCommitChunk.Length(); } else - {//This is the last chunk, we synchronous commit it + { iRemainingDataSize = 0; - ToggleRdWrBuffer(); - return NULL; + } + //wait until previous write complete + if(iBuffer1AvailForWrite) + { + iFileWriter2->WaitForWriteComplete(); + iFileRdWrError = (iFileWriter2->GetResult() != KErrNone); + } + else + { + iFileWriter1->WaitForWriteComplete(); + iFileRdWrError = (iFileWriter1->GetResult() != KErrNone); } - return this; + ToggleRdWrBuffer(); + if(iRemainingDataSize <= 0) //last chunk need wait the write complete + { + iFileWriter1->WaitForWriteComplete(); + iFileWriter2->WaitForWriteComplete(); + if(iFileWriter1->GetResult() != KErrNone || iFileWriter2->GetResult() != KErrNone) + { + iFile.SetSize(0); + iFileRdWrError = ETrue; + } + } + + return NULL; } //for partial @@ -590,17 +649,20 @@ } else { - err = iFile.Write(iCurrentCommitChunk); - if (err != KErrNone) - {// file Write failed, this means we cannot successfully received this file but however, we cannot disrupt a current DIOR phase according to MTP spec. - // We should continue to receive the data and discard this data, only after the data phase is finished can we send back an error response - //to Initiator. Therefore, we pretend to continue to write this data into file, and let final processor to check the file size and then give back a - //corresponding error code to MTP initiator. - iFileRdWrError = ETrue; - iFile.SetSize(0); + if(iBuffer1AvailForWrite) + { + iFileWriter1->Write(iCurrentCommitChunk.Length()); + } + else + { + iFileWriter2->Write(iCurrentCommitChunk.Length()); } } } + else + { + iFile.SetSize(0); + } iCurrentCommitChunk.Zero(); } else diff -r d0791faffa3f -r aabe5387f5ce mtpfws/mtpfw/group/mtpframework.mmp --- a/mtpfws/mtpfw/group/mtpframework.mmp Tue Feb 02 01:11:40 2010 +0200 +++ b/mtpfws/mtpfw/group/mtpframework.mmp Fri Mar 19 09:40:39 2010 +0200 @@ -91,6 +91,8 @@ LIBRARY efsrv.lib LIBRARY estor.lib LIBRARY euser.lib +LIBRARY bluetooth.lib +LIBRARY usbman.lib LIBRARY mtpdatatypes.lib LIBRARY mtpdataproviderapi.lib diff -r d0791faffa3f -r aabe5387f5ce mtpfws/mtpfw/inc/cmtpconnection.h --- a/mtpfws/mtpfw/inc/cmtpconnection.h Tue Feb 02 01:11:40 2010 +0200 +++ b/mtpfws/mtpfw/inc/cmtpconnection.h Fri Mar 19 09:40:39 2010 +0200 @@ -90,7 +90,7 @@ IMPORT_C void SessionClosedL(TUint32 aSessionMTPId); IMPORT_C void SessionOpenedL(TUint32 aSessionMTPId); IMPORT_C TInt GetDataReceiveResult() const; - void ConnectionSuspended(); + TBool ConnectionSuspended(); void ConnectionResumedL(MMTPTransportConnection& aTransportConnection); void TransactionCompleteL(const TMTPTypeRequest& aRequest); @@ -116,7 +116,7 @@ void SendDataCompleteL(TInt aErr, const MMTPType& aData, const TMTPTypeRequest& aRequest); void SendEventCompleteL(TInt aErr, const TMTPTypeEvent& aEvent); void SendResponseCompleteL(TInt aErr, const TMTPTypeResponse& aResponse, const TMTPTypeRequest& aRequest); - void Unbind(MMTPTransportConnection& aConnection); + void Unbind(MMTPTransportConnection& aConnection); private: @@ -132,6 +132,7 @@ TUint ActiveSessions() const; void CloseAllSessions(); void CloseSession(TUint aIdx); + void CompleteCloseConnection(); CMTPSession& SessionL(const TMTPTypeFlatBase& aDataset, TInt aSessionIdElementNo) const; static TInt SessionOrder(const TUint32* aL, const CMTPSession& aR); diff -r d0791faffa3f -r aabe5387f5ce mtpfws/mtpfw/inc/cmtpconnectionmgr.h --- a/mtpfws/mtpfw/inc/cmtpconnectionmgr.h Tue Feb 02 01:11:40 2010 +0200 +++ b/mtpfws/mtpfw/inc/cmtpconnectionmgr.h Fri Mar 19 09:40:39 2010 +0200 @@ -23,8 +23,10 @@ #define CMTPCONNECTIONMGR_H #include +#include #include "mmtpconnectionmgr.h" #include "mtpdebug.h" +#include "mtp/rmtpclient.h" class CMTPConnection; class CMTPTransportPlugin; @@ -54,6 +56,7 @@ IMPORT_C CMTPConnection& ConnectionL(TUint aConnectionId) const; TUint ConnectionCount() const; CMTPConnection& operator[](TInt aIndex) const; + void ConnectionCloseComplete(const TUint& aConnUid); IMPORT_C void StartTransportL(TUid aTransport); IMPORT_C void StartTransportL(TUid aTransport, const TAny* aParameter); IMPORT_C void QueueTransportL( TUid aTransport, const TAny* aParameter ); @@ -63,13 +66,12 @@ IMPORT_C void StopTransports(); IMPORT_C TInt TransportCount() const; IMPORT_C TUid TransportUid(); - - + IMPORT_C void SetBTResumeParameter(const TBTDevAddr& aBTAddr, const TUint16& aPSMPort); + private: // From MMTPConnectionMgr - void ConnectionClosed(MMTPTransportConnection& aTransportConnection); + TBool ConnectionClosed(MMTPTransportConnection& aTransportConnection); void ConnectionOpenedL(MMTPTransportConnection& aTransportConnection); - TBool DeleteConnection(TUint aConnectionId); TUid ClientSId(); private: @@ -104,6 +106,11 @@ CAsyncCallBack* iTransportTrigger; /** + * It will store the bluetooth address of remote device. + */ + TMTPBTRemoteDevice iRemoteDevice; + + /** FLOGGER debug trace member variable. */ __FLOG_DECLARATION_MEMBER_MUTABLE; diff -r d0791faffa3f -r aabe5387f5ce mtpfws/mtpfw/inc/cmtpdataprovider.h --- a/mtpfws/mtpfw/inc/cmtpdataprovider.h Tue Feb 02 01:11:40 2010 +0200 +++ b/mtpfws/mtpfw/inc/cmtpdataprovider.h Fri Mar 19 09:40:39 2010 +0200 @@ -124,6 +124,7 @@ MMTPStorageMgr& StorageMgr() const; RFs& Fs() const; MMTPDataCodeGenerator& DataCodeGenerator() const; + void NotifyFrameworkL( TMTPNotificationToFramework aNotification, const TAny* aParams ); private: // From CActive diff -r d0791faffa3f -r aabe5387f5ce mtpfws/mtpfw/inc/cmtpdataprovidercontroller.h --- a/mtpfws/mtpfw/inc/cmtpdataprovidercontroller.h Tue Feb 02 01:11:40 2010 +0200 +++ b/mtpfws/mtpfw/inc/cmtpdataprovidercontroller.h Fri Mar 19 09:40:39 2010 +0200 @@ -62,7 +62,9 @@ EEnumeratingDataProviderStorages = 3, EEnumeratingFrameworkObjects = 4, EEnumeratingDataProviderObjects = 5, - EEnumerated = 6, + EEnumeratingPhaseOneDone = 6, + EEnumeratingSubDirFiles = 7, //Only File DP care the status. + EEnumeratedFulllyCompleted = 8, }; public: @@ -90,6 +92,9 @@ IMPORT_C void WaitForEnumerationComplete(); TBool FreeEnumerationWaiter(); + + IMPORT_C void SetNeedEnumeratingPhase2(TBool aNeed); + IMPORT_C TBool NeedEnumeratingPhase2() const; private: // From CActive void DoCancel(); @@ -115,7 +120,7 @@ static void ImplementationsCleanup(TAny* aData); static TInt ImplementationsLinearOrderUid(const TUid* aUid, const CImplementationInformation& aObject); static TInt ImplementationsLinearOrderUid(const CImplementationInformation& aL, const CImplementationInformation& aR); - + private: // Owned /** FLOGGER debug trace member variable. @@ -208,11 +213,12 @@ opensession waiter */ CActiveSchedulerWait *iOpenSessionWaiter; - - /** - Flag for Create DBSnapshot - */ - TUint8 iFlagDb; + + /* + The number of folders and files that will be enumerated. + */ + TBool iNeedEnumeratingPhase2; + TUint32 iNeedEnumeratingPhase2StorageId; }; diff -r d0791faffa3f -r aabe5387f5ce mtpfws/mtpfw/src/cmtpconnection.cpp --- a/mtpfws/mtpfw/src/cmtpconnection.cpp Tue Feb 02 01:11:40 2010 +0200 +++ b/mtpfws/mtpfw/src/cmtpconnection.cpp Fri Mar 19 09:40:39 2010 +0200 @@ -93,10 +93,6 @@ delete link; } - if (iTransportConnection != NULL) - { - iTransportConnection->Unbind(*this); - } iSessions.ResetAndDestroy(); //close the property iProperty.Close(); @@ -108,14 +104,6 @@ } /** -Unbinds the Transport Connection -*/ -void CMTPConnection::Unbind(MMTPTransportConnection& /*aConnection*/) - { - iTransportConnection = NULL; - } - -/** Initiates MTP transaction data phase processing for initiator-to-responder data flows. This method should only be invoked when the MTP transaction phase state is ERequestPhase. This is an asynchronous method. @@ -351,45 +339,47 @@ * Signals the connection is suspended, the connection state is set to EStateShutdown which * means that all the current transaction will not be able to send/receive any data via the * connection + * @return ETrue - there is an active transaction currently, and Connection will suspend when it finishes + * EFalse - No active transaction, connection suspends immediately. */ -void CMTPConnection::ConnectionSuspended() +TBool CMTPConnection::ConnectionSuspended() { __FLOG(_L8("ConnectionSuspended - Entry")); + TBool ret = EFalse; TUint currentState = State(); - if (currentState!=EStateShutdown && currentState!=EStateErrorShutdown) + if (currentState != EStateShutdown) { - SetState(EStateShutdown); - - if (iTransportConnection != NULL) - { - iTransportConnection->Unbind(*this); - iTransportConnection = NULL; - } - PublishConnState(EDisconnectedFromHost); - - if (ActiveSessions() == 0) + if (ActiveSessions() == 0 || currentState == EStateErrorShutdown) { - CloseAllSessions(); - iSessions.Reset(); - iSingletons.Close(); + CompleteCloseConnection(); + ret = ETrue; } - else - { - //some session may be in data or response phase, complete them and set transaction phase to ECompletingPhase. - const TUint count(iSessions.Count()); - for (TUint i(0); (i < count); i++) - { - if (iSessions[i]->TransactionPhase() & (EDataIToRPhase|EDataRToIPhase|EResponsePhase)) - { - iSessions[i]->SetTransactionPhase(ECompletingPhase); - iSessions[i]->CompletePendingRequest(KErrCancel); - } - } - } + + SetState(EStateShutdown); + PublishConnState(EDisconnectedFromHost); } __FLOG(_L8("ConnectionSuspended - Exit")); + return ret; + } + +void CMTPConnection::CompleteCloseConnection() + { + __FLOG(_L8("CompleteCloseConnection - Entry")); + + CloseAllSessions(); + iSessions.Reset(); + if (iTransportConnection != NULL) + { + iTransportConnection->Unbind(*this); + } + + //notify ConnectionMgr and corresponding transports of completion of connection close + iSingletons.ConnectionMgr().ConnectionCloseComplete(iConnectionId); + iSingletons.Close(); + + __FLOG(_L8("CompleteCloseConnection - Exit")); } /* @@ -439,24 +429,18 @@ if (ValidFrameworkRequest(&session, KValidPhases, NULL)) { session.SetTransactionPhase(EIdlePhase); - if (State() == EStateShutdown) - { - if (ActiveSessions() == 0) - { - CloseAllSessions(); - iSessions.Reset(); - iSingletons.Close(); - - // Move the log here because ShutdownComplete will delete this object. - __FLOG(_L8("TransactionCompleteL - Exit")); - } - } - else + + if (iTransportConnection != NULL) { iTransportConnection->TransactionCompleteL(aRequest); - __FLOG(_L8("TransactionCompleteL - Exit")); + } + + if (State() == EStateShutdown && ActiveSessions() == 0) + { + CompleteCloseConnection(); } } + __FLOG(_L8("TransactionCompleteL - Exit")); } TUint CMTPConnection::ConnectionId() const @@ -700,6 +684,11 @@ __FLOG(_L8("SendResponseCompleteL - Exit")); } +void CMTPConnection::Unbind(MMTPTransportConnection& /*aConnection*/) + { + iTransportConnection = NULL; + } + TMTPTransactionPhase CMTPConnection::TransactionPhaseL(TUint32 aMTPId) const { diff -r d0791faffa3f -r aabe5387f5ce mtpfws/mtpfw/src/cmtpconnectionmgr.cpp --- a/mtpfws/mtpfw/src/cmtpconnectionmgr.cpp Tue Feb 02 01:11:40 2010 +0200 +++ b/mtpfws/mtpfw/src/cmtpconnectionmgr.cpp Fri Mar 19 09:40:39 2010 +0200 @@ -13,6 +13,8 @@ // Description: // +#include +#include #include "cmtpconnectionmgr.h" #include "cmtpconnection.h" @@ -93,9 +95,59 @@ return iTransportUid; } +void CMTPConnectionMgr::ConnectionCloseComplete(const TUint& /*aConnUid*/) + { + __FLOG(_L8("ConnectionCloseComplete - Entry")); + ResumeSuspendedTransport(); + __FLOG(_L8("ConnectionCloseComplete - exit")); + } + EXPORT_C void CMTPConnectionMgr::StartTransportL(TUid aTransport) { - StartTransportL( aTransport, NULL ); + + TInt32 bluetoothUid = 0x10286FCB; + + RUsb usb; + User::LeaveIfError(usb.Connect()); + TInt usbMode; + TUsbServiceState usbStat; + TInt err = usb.GetCurrentPersonalityId(usbMode); + __FLOG_1(_L8("The return value of GetCurrentPersonalityId is %d"), err); + + err = usb.GetServiceState(usbStat); + __FLOG_1(_L8("The return value of GetServiceState is %d"), err); + + usb.Close(); + + __FLOG_1(_L8("The current usb mode is %d"), usbMode); + __FLOG_1(_L8("The current usb service state is %d"), usbStat); + + TInt massStorageMode = 0x02; + + if(usbMode == massStorageMode && usbStat != EUsbServiceIdle) + { + __FLOG(_L8("StartTransportL without parameter!")); + StartTransportL( aTransport, NULL ); + return; + } + + + + //When USB plug out, BT will start Master mode to reconnect remote device. Else BT will start slave mode to listen connection. + if(aTransport.iUid == bluetoothUid && iRemoteDevice.iDeviceAddr != 0 && aTransport != iTransportUid) + { + __FLOG(_L8("StartTransportL with parameter!")); + TMTPBTRemoteDeviceBuf tmpdata(iRemoteDevice); + StartTransportL( aTransport, &tmpdata ); + iRemoteDevice.iDeviceAddr = 0; + iRemoteDevice.iDeviceServicePort = 0; + } + else + { + __FLOG(_L8("StartTransportL without parameter!")); + StartTransportL( aTransport, NULL ); + } + } /** @@ -110,33 +162,70 @@ */ EXPORT_C void CMTPConnectionMgr::StartTransportL(TUid aTransport, const TAny* aParameter) { - __FLOG(_L8("StartTransportL - Entry")); - + __FLOG(_L8("StartTransportL - Entry")); + + TInt32 bluetoothUid = 0x10286FCB; + if (iTransport) { + __FLOG(_L8("The transport is not none.")); if (aTransport != iTransportUid) { // Multiple transports not currently supported. + __FLOG(_L8("Multiple transports are not supported now!")); User::Leave(KErrNotSupported); } + else + { + __FLOG_1(_L8("Relaunch the transport 0x%X"), iTransportUid.iUid); + if(aTransport.iUid == bluetoothUid) + { + iTransport->Stop(*this); + delete iTransport; + + iTransport = CMTPTransportPlugin::NewL(aTransport, aParameter); + + TRAPD(err, iTransport->StartL(*this)); + if (err != KErrNone) + { + __FLOG_VA( ( _L8("StartTransportL error, error code = %d"), err) ); + delete iTransport; + iTransport = NULL; + User::Leave(err); + } + iTransportUid = aTransport; + + iTransportCount++; + } + + } } else { - + __FLOG(_L8("begin start transport.")); iTransport = CMTPTransportPlugin::NewL(aTransport, aParameter); TRAPD(err, iTransport->StartL(*this)); - if (err != KErrNone) - { - __FLOG_VA( ( _L8("StartTransportL error, error code = %d"), err) ); - delete iTransport; - iTransport = NULL; - User::Leave(err); - } + if (err != KErrNone) + { + __FLOG_VA( ( _L8("StartTransportL error, error code = %d"), err) ); + delete iTransport; + iTransport = NULL; + User::Leave(err); + } iTransportUid = aTransport; - + iTransportCount++; - UnsuspendTransport( iTransportUid ); + + if(iTransportUid.iUid != bluetoothUid) + { + UnsuspendTransport( iTransportUid ); + } + else + { + //Suspend BT transport to handle switching with Mass Storage + SuspendTransportL( iTransportUid); + } } __FLOG(_L8("StartTransportL - Exit")); @@ -181,6 +270,15 @@ { __FLOG(_L8("StopTransport - Entry")); + + __FLOG_1(_L8("aTransport is 0x%X"), aTransport.iUid); + __FLOG_1(_L8("iTransportUid is 0x%X"), aTransport.iUid); + + if ( aByBearer ) + { + UnsuspendTransport( aTransport ); + } + if ( ( iTransport ) && ( aTransport == iTransportUid ) ) { if ( !aByBearer ) @@ -192,14 +290,8 @@ iTransport = NULL; iTransportUid = KNullUid; iTransportCount--; - - } - if ( aByBearer ) - { - UnsuspendTransport( aTransport ); - } - + __FLOG(_L8("StopTransport - Exit")); } @@ -224,10 +316,28 @@ */ EXPORT_C TInt CMTPConnectionMgr::TransportCount() const { - return iTransportCount; + return iTransportCount; } -void CMTPConnectionMgr::ConnectionClosed(MMTPTransportConnection& aTransportConnection) +/* +Record the remote device bluetooth address when connection setup. +*/ +EXPORT_C void CMTPConnectionMgr::SetBTResumeParameter(const TBTDevAddr& aBTAddr, const TUint16& aPSMPort) + { + TInt64 addr(0); + TUint8 i(0); + addr += aBTAddr[i++]; + for(; iConnectionSuspended(); - - ResumeSuspendedTransport(); __FLOG(_L8("ConnectionClosed - Exit")); + return connection->ConnectionSuspended(); } void CMTPConnectionMgr::ConnectionOpenedL(MMTPTransportConnection& aTransportConnection) @@ -267,26 +375,6 @@ __FLOG(_L8("ConnectionOpenedL - Exit")); } -TBool CMTPConnectionMgr::DeleteConnection(TUint aConnectionId) - { - __FLOG(_L8("DeleteConnection - Entry")); - - TBool ret = EFalse; - TInt idx = ConnectionFind(aConnectionId); - - if (idx != KErrNotFound) - { - CMTPConnection* connection(iConnections[idx]); - iConnections.Remove(idx); - delete connection; - ret = ETrue; - } - - __FLOG(_L8("DeleteConnection - Entry")); - - return ret; - } - EXPORT_C TUid CMTPConnectionMgr::ClientSId() { return iSecureId; @@ -299,7 +387,9 @@ iShutdownConnectionIdx(KErrNotFound), iTransportUid(KNullUid) { - __FLOG_OPEN(KMTPSubsystem, KComponent); + __FLOG_OPEN(KMTPSubsystem, KComponent); + iRemoteDevice.iDeviceAddr = 0; + iRemoteDevice.iDeviceServicePort = 0; } /** @@ -378,9 +468,14 @@ { __FLOG( _L8("+ResumeSuspendedTransport") ); const TInt count = iSuspendedTransports.Count(); + __FLOG_1(_L8("The count number is %d"), count); + __FLOG_1(_L8("The transportport id is 0x%X"), iTransportUid.iUid); + + TInt32 bluetoothUid = 0x10286FCB; + if ( ( count > 0 ) // If the transport was just switched and suspended, it shouldn't be resumed. - && ( iTransportUid != iSuspendedTransports[count-1] ) ) + && (( iTransportUid != iSuspendedTransports[count-1] ) || iTransportUid.iUid == bluetoothUid)) { __FLOG( _L8("Found suspended transport(s).") ); if ( !iTransportTrigger ) diff -r d0791faffa3f -r aabe5387f5ce mtpfws/mtpfw/src/cmtpdataprovider.cpp --- a/mtpfws/mtpfw/src/cmtpdataprovider.cpp Tue Feb 02 01:11:40 2010 +0200 +++ b/mtpfws/mtpfw/src/cmtpdataprovider.cpp Fri Mar 19 09:40:39 2010 +0200 @@ -481,6 +481,28 @@ return iSingletons.DataCodeGenerator(); } +void CMTPDataProvider::NotifyFrameworkL( TMTPNotificationToFramework aNotification, const TAny* aParams ) + { + __FLOG(_L8("NotifyFrameworkL - Entry")); + + __ASSERT_DEBUG( aParams, User::Invariant()); + + switch ( aNotification ) + { + case EMTPAddFolder: + { + TUint deviceDpId = iSingletons.DpController().DeviceDpId(); + iSingletons.DpController().NotifyDataProvidersL( deviceDpId, EMTPObjectAdded, aParams ); + } + break; + default: + __FLOG(_L8("Ignore other notification")); + break; + } + + __FLOG(_L8("NotifyFrameworkL - Exit")); + } + void CMTPDataProvider::DoCancel() { __FLOG_VA((_L8("DoCancel - Entry, data provider %d "), iId)); @@ -529,6 +551,18 @@ { iImplementation->Cancel(); } + else if (status == KErrAbort) + { + if (iCurrentRequest != NULL) + { + TMTPTypeEvent event; + event.SetUint16(TMTPTypeEvent::EEventCode, EMTPEventCodeCancelTransaction); + event.SetUint32(TMTPTypeEvent::EEventSessionID, iCurrentRequest->Uint32(TMTPTypeRequest::ERequestSessionID) ); + event.SetUint32(TMTPTypeEvent::EEventTransactionID, iCurrentRequest->Uint32(TMTPTypeRequest::ERequestTransactionID) ); + + iImplementation->ProcessEventL(event ,*iCurrentConnection); + } + } if (iErrorRecovery != KErrNone) @@ -558,7 +592,7 @@ } } - else if (iSingletons.DpController().EnumerateState() != CMTPDataProviderController::EEnumerated) + else if (iSingletons.DpController().EnumerateState() < CMTPDataProviderController::EEnumeratingPhaseOneDone) { __FLOG(_L8("DP Enumeration is not complete")); @@ -603,12 +637,15 @@ iTimer.After(iStatus, TTimeIntervalMicroSeconds32(KWaitForEnumeration)); SetActive(); iTimerActive = ETrue; - break; - case ECompletingPhase: - TransactionCompleteL(*iCurrentRequest, *iCurrentConnection); - break; - default: - break; + break; + case EResponsePhase: + iImplementation->ProcessRequestPhaseL(iCurrentTransactionPhase, *iCurrentRequest, *iCurrentConnection); + break; + case ECompletingPhase: + TransactionCompleteL(*iCurrentRequest, *iCurrentConnection); + break; + default: + break; } } } diff -r d0791faffa3f -r aabe5387f5ce mtpfws/mtpfw/src/cmtpdataprovidercontroller.cpp --- a/mtpfws/mtpfw/src/cmtpdataprovidercontroller.cpp Tue Feb 02 01:11:40 2010 +0200 +++ b/mtpfws/mtpfw/src/cmtpdataprovidercontroller.cpp Fri Mar 19 09:40:39 2010 +0200 @@ -236,7 +236,7 @@ iEnumeratingStorages.AppendL(params->iStorageId); // Only schedule the operation start if there is not one currently underway. - if (iEnumerationState == EEnumerated) + if (iEnumerationState == EEnumeratedFulllyCompleted) { iNextDpId = iDpIdDeviceDp; iEnumerationState = EEnumeratingFrameworkObjects; @@ -385,7 +385,7 @@ */ EXPORT_C void CMTPDataProviderController::WaitForEnumerationComplete() { - if(EnumerateState() != CMTPDataProviderController::EEnumerated) + if((EnumerateState() < CMTPDataProviderController::EEnumeratingPhaseOneDone) && ( !iOpenSessionWaiter->IsStarted())) { iOpenSessionWaiter->Start(); } @@ -406,6 +406,7 @@ void CMTPDataProviderController::EnumerationStateChangedL(const CMTPDataProvider& aDp) { __FLOG(_L8("EnumerationStateChangedL - Entry")); + __FLOG_VA((_L8("Entry iEnumerationState: 0x%x iNextDpId: %d"), iEnumerationState, iNextDpId)); switch (iEnumerationState) { case EEnumeratingFrameworkStorages: @@ -463,27 +464,42 @@ break; case KMTPImplementationUidFileDp: - iSingletons.ObjectMgr().RemoveNonPersistentObjectsL(aDp.DataProviderId()); - // No other data providers - iNextDpId = 0; - iEnumeratingStorages.Remove(0); - if (iEnumeratingStorages.Count() == 0) - { - // No queued enumerations. - iSingletons.ObjectMgr().ObjectStore().CleanDBSnapshotL(); - iEnumerationState = EEnumerated; - Cancel(); - if(iOpenSessionWaiter->IsStarted()) - { - iOpenSessionWaiter->AsyncStop(); - } - } - else - { - // Queued enumerations. - iNextDpId = iDpIdDeviceDp; - Schedule(); - } + // No other data providers + if(NeedEnumeratingPhase2()) + { + iEnumerationState = EEnumeratingSubDirFiles; + if(iOpenSessionWaiter->IsStarted()) + { + iOpenSessionWaiter->AsyncStop(); + } + //Schedule FildDP to enumerate the files in sub-dir + iNextDpId = iDpIdFileDp; + Schedule(); + } + else + { + iNextDpId = 0; + iEnumeratingStorages.Remove(0); + if (iEnumeratingStorages.Count() == 0) + { + iSingletons.ObjectMgr().RemoveNonPersistentObjectsL(aDp.DataProviderId()); + iEnumerationState = EEnumeratedFulllyCompleted; + iSingletons.ObjectMgr().ObjectStore().CleanDBSnapshotL(); + + Cancel(); + if(iOpenSessionWaiter->IsStarted()) + { + iOpenSessionWaiter->AsyncStop(); + } + } + else + { + // Queued enumerations. + iNextDpId = iDpIdDeviceDp; + Schedule(); + } + } + } break; @@ -496,9 +512,23 @@ if ((iEnumeratingDps.Count() == 0) && iDpIdArrayIndex >= iDataProviderIds.Count()) { // Enumeration complete. - iNextDpId = 0; iNextDpId = iDpIdFileDp; iEnumerationState = EEnumeratingFrameworkObjects; + + if ( ( iEnumeratingStorages.Count() > 1 ) &&(KErrNotFound != iEnumeratingStorages.Find(KMTPStorageAll)) ) + { + const TUint storageid = iEnumeratingStorages[0]; + iEnumeratingStorages.Remove(0); + if(KMTPStorageAll == storageid) + { + iEnumeratingStorages.Append(KMTPStorageAll); + } + + if(iEnumeratingStorages[0] != KMTPStorageAll) + { + iNextDpId = iDpIdDeviceDp; + } + } } else { @@ -511,13 +541,39 @@ Schedule(); break; + case EEnumeratingSubDirFiles: + { + if(aDp.ImplementationUid().iUid == KMTPImplementationUidFileDp) + { + iSingletons.ObjectMgr().RemoveNonPersistentObjectsL(aDp.DataProviderId()); + iNextDpId = 0; + iEnumeratingStorages.Remove(0); + if(iEnumeratingStorages.Count() == 0) + { + iSingletons.DpController().SetNeedEnumeratingPhase2(EFalse); + iEnumerationState = EEnumeratedFulllyCompleted; + iSingletons.ObjectMgr().ObjectStore().CleanDBSnapshotL(); + } + else //removable card plug in + { + iNextDpId = iDpIdDeviceDp; + iEnumerationState = EEnumeratingFrameworkObjects; + Schedule(); + } + } + } + break; + + case EEnumeratedFulllyCompleted: case EUnenumerated: case EEnumerationStarting: - case EEnumerated: + case EEnumeratingPhaseOneDone: default: __DEBUG_ONLY(User::Invariant()); break; } + + __FLOG_VA((_L8("Exit iEnumerationState: 0x%x, iNextDpId: %d, UID=0x%x"), iEnumerationState, iNextDpId, aDp.ImplementationUid().iUid)); __FLOG(_L8("EnumerationStateChangedL - Exit")); } @@ -556,8 +612,6 @@ iNextDpId = iDpIdDeviceDp; iEnumerationState = EEnumeratingFrameworkObjects; - - Schedule(); } break; @@ -573,7 +627,7 @@ iEnumeratingStorages.Remove(0); if (iEnumeratingStorages.Count() == 0) { - iEnumerationState = EEnumerated; + iEnumerationState = EEnumeratedFulllyCompleted; } else { @@ -591,21 +645,22 @@ { iSingletons.ObjectMgr().ObjectStore().EstablishDBSnapshotL(storageId); } - else + else { - const CMTPStorageMetaData& storage(iSingletons.StorageMgr().StorageL(storageId)); - if(storage.Uint(CMTPStorageMetaData::EStorageSystemType) == CMTPStorageMetaData::ESystemTypeDefaultFileSystem) - { - const RArray& logicalIds(storage.UintArray(CMTPStorageMetaData::EStorageLogicalIds)); - const TUint KCountLogicalIds(logicalIds.Count()); - for (TUint i(0); (i < KCountLogicalIds); i++) - { - __FLOG_VA((_L8("Establish snapshot for storage: 0x%x"), storageId)); - iSingletons.ObjectMgr().ObjectStore().EstablishDBSnapshotL(storageId); - } - } + const CMTPStorageMetaData& storage(iSingletons.StorageMgr().StorageL(storageId)); + if(storage.Uint(CMTPStorageMetaData::EStorageSystemType) == CMTPStorageMetaData::ESystemTypeDefaultFileSystem) + { + const RArray& logicalIds(storage.UintArray(CMTPStorageMetaData::EStorageLogicalIds)); + const TUint KCountLogicalIds(logicalIds.Count()); + for (TUint i(0); (i < KCountLogicalIds); i++) + { + __FLOG_VA((_L8("Establish snapshot for storage: 0x%x"), logicalIds[i])); + iSingletons.ObjectMgr().ObjectStore().EstablishDBSnapshotL(logicalIds[i]); + } + } } } + EnumerateDataProviderObjectsL(iNextDpId); } } @@ -624,11 +679,19 @@ iEnumeratingDps.InsertInOrderL(currentDp); EnumerateDataProviderObjectsL(currentDp); } + + __FLOG_VA((_L8("iDpIdArrayIndex = %d, KLoadedDps = %d"), iDpIdArrayIndex, KLoadedDps)); } break; + case EEnumeratingSubDirFiles: + { + EnumerateDataProviderObjectsL(iNextDpId); + } + break; + case EEnumeratedFulllyCompleted: case EUnenumerated: - case EEnumerated: + case EEnumeratingPhaseOneDone: default: __DEBUG_ONLY(User::Invariant()); break; @@ -666,7 +729,7 @@ break; case EUnenumerated: - case EEnumerated: + case EEnumeratingPhaseOneDone: default: User::Invariant(); break; @@ -709,7 +772,7 @@ iMode = (TMTPOperationalMode)tMTPMode; CreateRegistrySessionAndEntryL(); - iFlagDb = 0; + SetNeedEnumeratingPhase2(EFalse); iOpenSessionWaiter = new(ELeave) CActiveSchedulerWait(); __FLOG(_L8("ConstructL - Exit")); @@ -1148,3 +1211,18 @@ iSisSession.Close(); } +EXPORT_C void CMTPDataProviderController::SetNeedEnumeratingPhase2(TBool aNeed) + { + __FLOG(_L8("SetNeedEnumeratingPhase2 - Entry")); + __FLOG_VA((_L8("Need = %d"), aNeed)); + + iNeedEnumeratingPhase2 = aNeed; + + __FLOG(_L8("SetNeedEnumeratingPhase2 - Exit")); + } + +EXPORT_C TBool CMTPDataProviderController::NeedEnumeratingPhase2() const + { + return iNeedEnumeratingPhase2; + } + diff -r d0791faffa3f -r aabe5387f5ce mtpfws/mtpfw/src/cmtpobjectstore.cpp --- a/mtpfws/mtpfw/src/cmtpobjectstore.cpp Tue Feb 02 01:11:40 2010 +0200 +++ b/mtpfws/mtpfw/src/cmtpobjectstore.cpp Fri Mar 19 09:40:39 2010 +0200 @@ -280,17 +280,23 @@ void CMTPObjectStore::CommitReservedObjectHandleL(CMTPObjectMetaData& aObject) { + TFileName suid; + suid.CopyLC(aObject.DesC(CMTPObjectMetaData::ESuid)); + TUint32 handle = HandleL(suid); + if (handle != KMTPHandleNone) + { + __FLOG(_L8("CommitReserverd leave for duplicate suid.")); + User::Leave(KErrAlreadyExists); + } + TUint32 suidHash = DefaultHash::Des16(suid); + //After the PutL called the cursor's position is not well defined. iCachedHandle = 0; iCachedSuidHash = 0; TInt64 id = iHandleAllocator->NextPOUIDL(); aObject.SetUint(CMTPObjectMetaData::EIdentifier, id); - TFileName suid; - suid.CopyLC(aObject.DesC(CMTPObjectMetaData::ESuid)); - TUint32 suidHash = DefaultHash::Des16(suid); - - TUint32 handle = aObject.Uint(CMTPObjectMetaData::EHandle); + handle = aObject.Uint(CMTPObjectMetaData::EHandle); CleanupStack::PushL(TCleanupItem(CMTPObjectStore::DBUpdateFailRecover, &iBatched)); iBatched.InsertL(); iBatched.SetColL(EObjectStoreHandleId, handle); @@ -385,6 +391,7 @@ TBool needToInsert = EFalse; TBool needUpdateOwner = EFalse; TUint dpId(aObject.Uint(CMTPObjectMetaData::EDataProviderId)); + TFileName suid; suid.CopyLC(aObject.DesC(CMTPObjectMetaData::ESuid)); TUint32 suidHash = DefaultHash::Des16(suid); @@ -392,7 +399,7 @@ TUint32 handle = KMTPHandleNone, handleInDB = KMTPHandleAll; TInt64 id = 0; // Check if the dp is enumerating - if (iSingletons.DpController().EnumerateState() != CMTPDataProviderController::EEnumerated && iCacheExist) + if (iSingletons.DpController().EnumerateState() != CMTPDataProviderController::EEnumeratedFulllyCompleted && iCacheExist) { //it is in the object enumeration phase. // if it's see if we have an object with the same SUID @@ -438,7 +445,8 @@ } else { - User::Leave(KErrAlreadyExists); + //while enumerating, we ignore the repeatedly INSERT operations. + //User::Leave(KErrAlreadyExists); } } } @@ -556,6 +564,14 @@ if (LocateByHandleL(handle)) { + //To avoid this modification will not generate duplicate SUID + TUint32 handle2 = HandleL(suid); + if (handle2 != KMTPHandleNone && handle2 != handle) + { + __FLOG(_L8("ModifyObjectL leave for duplicate suid.")); + User::Leave(KErrAlreadyExists); + } + //After the PutL called the cursor's position is not well defined. iCachedHandle = 0; iCachedSuidHash = 0; @@ -686,7 +702,7 @@ { if (LocateByHandleL(aHandle.Value())) { - if (iSingletons.DpController().EnumerateState() != CMTPDataProviderController::EEnumerated && + if (iSingletons.DpController().EnumerateState() != CMTPDataProviderController::EEnumeratedFulllyCompleted && IsMediaFormat(iBatched.ColUint16(EObjectStoreFormatCode))) { iMtpDeltaDataMgr->UpdateDeltaDataTableL(iBatched.ColInt64(EObjectStorePOUID), CMtpDeltaDataMgr::EDeleted); @@ -702,7 +718,7 @@ { if(LocateBySuidL(aSuid)) { - if (iSingletons.DpController().EnumerateState() != CMTPDataProviderController::EEnumerated && + if (iSingletons.DpController().EnumerateState() != CMTPDataProviderController::EEnumeratedFulllyCompleted && IsMediaFormat(iBatched_SuidHashID.ColUint16(EObjectStoreFormatCode))) { iMtpDeltaDataMgr->UpdateDeltaDataTableL(iBatched_SuidHashID.ColInt64(EObjectStorePOUID), CMtpDeltaDataMgr::EDeleted); diff -r d0791faffa3f -r aabe5387f5ce mtpfws/mtpfw/src/cmtpparserrouter.cpp --- a/mtpfws/mtpfw/src/cmtpparserrouter.cpp Tue Feb 02 01:11:40 2010 +0200 +++ b/mtpfws/mtpfw/src/cmtpparserrouter.cpp Fri Mar 19 09:40:39 2010 +0200 @@ -39,7 +39,8 @@ /** CMTPParserRouter panic codes. */ -_LIT(KMTPPanicCategory, "CMTPParserRouter"); + + enum TMTPPanicReasons { EMTPPanicRoutingConflict = 0 @@ -49,9 +50,10 @@ Produces a "CMTPParserRouter" category panic. @param aReason The panic code. */ -LOCAL_C void Panic(TInt aReason) +LOCAL_C void Panic(TInt __DEBUG_ONLY(aReason)) { - User::Panic(KMTPPanicCategory, aReason); + __DEBUG_ONLY(_LIT(KMTPPanicCategory, "CMTPParserRouter")); + __DEBUG_ONLY(User::Panic(KMTPPanicCategory, aReason)); } /** @@ -1839,44 +1841,39 @@ const TUint KObjectFormatCode(params1.Param(TRoutingParameters::EParamFormatCode)); const TUint KObjectFormatSubCode(params1.Param(TRoutingParameters::EParamFormatSubCode)); const TUint KObjectPropCode(params1.Param(TRoutingParameters::EParamObjectPropCode)); - if ((KObjectHandle == KMTPHandleAll) || - (KObjectHandle == KMTPHandleAllRootLevel)) + const TUint KDepth(params1.Request().Uint32(TMTPTypeRequest::ERequestParameter5)); + if ( KDepth==0 ) { - // All objects or all root level objects. - if (KObjectFormatCode == KMTPFormatsAll) + if ((KObjectHandle == KMTPHandleAll) || + (KObjectHandle == KMTPHandleAllRootLevel)) { SelectSubTypeRoutingL(ESubTypeOperationCode, aRoutingSubTypes, aValidationSubTypes, aParams); } - else + else if (KObjectHandle != KMTPHandleNone) { - SelectSubTypeRoutingL(ESubTypeFormatCodeOperationCode, aRoutingSubTypes, aValidationSubTypes, aParams); - } + if( (KObjectFormatCode == EMTPFormatCodeAssociation) && (KObjectFormatSubCode == EMTPAssociationTypeGenericFolder) ) + { + if ( params1.Param(TRoutingParameters::EFlagRoutingTypes) & ETypeFramework ) + { + SelectSubTypeRoutingL(ESubTypeDpProxy, aRoutingSubTypes, aValidationSubTypes, aParams); + } + else + { + SelectSubTypeRoutingL(ESubTypeStorageTypeOperationCode, aRoutingSubTypes, aValidationSubTypes, aParams); + SelectSubTypeRoutingL(ESubTypeOwnerObject, aRoutingSubTypes, aValidationSubTypes, aParams); + } + } + else + { + SelectSubTypeRoutingL(ESubTypeOwnerObject, aRoutingSubTypes, aValidationSubTypes, aParams); + } + } } - else if (KObjectHandle != KMTPHandleNone) + else { - if( (KObjectFormatCode == EMTPFormatCodeAssociation) && (KObjectFormatSubCode == EMTPAssociationTypeGenericFolder) ) - { - if ( params1.Param(TRoutingParameters::EFlagRoutingTypes) & ETypeFramework ) - { - SelectSubTypeRoutingL(ESubTypeDpProxy, aRoutingSubTypes, aValidationSubTypes, aParams); - } - else - { - SelectSubTypeRoutingL(ESubTypeStorageTypeOperationCode, aRoutingSubTypes, aValidationSubTypes, aParams); - SelectSubTypeRoutingL(ESubTypeOwnerObject, aRoutingSubTypes, aValidationSubTypes, aParams); - } - } - else - { - SelectSubTypeRoutingL(ESubTypeOwnerObject, aRoutingSubTypes, aValidationSubTypes, aParams); - } - } + SelectSubTypeRoutingL(ESubTypeOperationCode, aRoutingSubTypes, aValidationSubTypes, aParams); + } - - if (KObjectPropCode != KMTPObjectPropCodeAll) - { - SelectSubTypeValidationL(ESubTypeObjectPropCode, aValidationSubTypes); - } } __FLOG(_L8("GetRoutingSubTypesGetObjectPropListRequestL, Exit")); } diff -r d0791faffa3f -r aabe5387f5ce mtpfws/mtpfw/transports/transportapi/inc/mmtpconnectionmgr.h --- a/mtpfws/mtpfw/transports/transportapi/inc/mmtpconnectionmgr.h Tue Feb 02 01:11:40 2010 +0200 +++ b/mtpfws/mtpfw/transports/transportapi/inc/mmtpconnectionmgr.h Fri Mar 19 09:40:39 2010 +0200 @@ -39,8 +39,13 @@ Signals that an MTP transport layer connection has become unavailable. @param aTransportConnection Interface handle of the MTP transport layer connection instance. + @return ETrue means MTP framework successfully cleanup ts env and can accept + another ConnectionOpendedL call. EFalse means there is a transaction alive currently, + ConnectionOpenedL must not be called until MMTPTransportConnection::TransactionCompleteL is called. + @see MMTPConnectionMgr::ConnectionOpenedL() + @see MMTPTransportConnection::TransactionCompleteL() */ - virtual void ConnectionClosed(MMTPTransportConnection& aTransportConnection) = 0; + virtual TBool ConnectionClosed(MMTPTransportConnection& aTransportConnection) = 0; /** Signals that an MTP transport layer connection has become available. @@ -56,4 +61,4 @@ virtual TUid ClientSId()=0; }; -#endif // MMTPCONNECTIONMGR_H \ No newline at end of file +#endif // MMTPCONNECTIONMGR_H diff -r d0791faffa3f -r aabe5387f5ce mtptransports/mtpptpiptransport/ptpipplugin/src/cptpipconnection.cpp --- a/mtptransports/mtpptpiptransport/ptpipplugin/src/cptpipconnection.cpp Tue Feb 02 01:11:40 2010 +0200 +++ b/mtptransports/mtpptpiptransport/ptpipplugin/src/cptpipconnection.cpp Fri Mar 19 09:40:39 2010 +0200 @@ -68,6 +68,11 @@ delete iPTPIPCommandContainer; delete iPTPIPDataContainer; delete iPTPIPEventContainer; + + if (iProtocolLayer != NULL) + { + iProtocolLayer->Unbind(*this); + } iNullBuffer.Close(); diff -r d0791faffa3f -r aabe5387f5ce mtptransports/mtpusbtransport/usbsic_imp/inc/cmtpusbconnection.h --- a/mtptransports/mtpusbtransport/usbsic_imp/inc/cmtpusbconnection.h Tue Feb 02 01:11:40 2010 +0200 +++ b/mtptransports/mtpusbtransport/usbsic_imp/inc/cmtpusbconnection.h Fri Mar 19 09:40:39 2010 +0200 @@ -150,7 +150,7 @@ void ResumeConnectionL(); void StartConnectionL(); - void StopConnection(); + TBool StopConnection(); void SuspendConnectionL(); void StartUsbL(); @@ -418,6 +418,12 @@ TBool iIsCancelReceived; /** + A flag to reflect if a Host initiated cancel transaction + is triggered. + */ + TBool iIsResetRequestSignaled; + + /** FLOGGER debug trace member variable. */ __FLOG_DECLARATION_MEMBER_MUTABLE; diff -r d0791faffa3f -r aabe5387f5ce mtptransports/mtpusbtransport/usbsic_imp/src/cmtpusbconnection.cpp --- a/mtptransports/mtpusbtransport/usbsic_imp/src/cmtpusbconnection.cpp Tue Feb 02 01:11:40 2010 +0200 +++ b/mtptransports/mtpusbtransport/usbsic_imp/src/cmtpusbconnection.cpp Fri Mar 19 09:40:39 2010 +0200 @@ -78,7 +78,7 @@ CMTPUsbConnection::~CMTPUsbConnection() { __FLOG(_L8("~CMTPUsbConnection - Entry")); - + // Terminate all endpoint data transfer activity. StopConnection(); @@ -91,11 +91,13 @@ StopUsb(); iNullBuffer.Close(); - if (iProtocolLayer) - { - iProtocolLayer->Unbind(*this); - } + if (iProtocolLayer != NULL) + { + BoundProtocolLayer().Unbind(*this); + } + iProtocolLayer = NULL; + __FLOG(_L8("~CMTPUsbConnection - Exit")); __FLOG_CLOSE; } @@ -331,21 +333,27 @@ __FLOG(_L8("TransactionCompleteL - Entry")); __FLOG_VA((_L8("DeviceState: 0x%x TransactionState: 0x%x"), iDeviceStatusCode, iBulkTransactionState)); - - if (iBulkTransactionState != ERequestPhase) - { - // Update the transaction state. - SetBulkTransactionState(EIdlePhase); - - // Update the device status - SetDeviceStatus(EMTPUsbDeviceStatusOK); - - // Clear the cancel flag. - iIsCancelReceived = EFalse; - - // Initiate the next request phase bulk data receive sequence. - InitiateBulkRequestSequenceL(); - } + + if (iBulkTransactionState != ERequestPhase) + { + // Update the transaction state. + SetBulkTransactionState(EIdlePhase); + // Update the device status + SetDeviceStatus(EMTPUsbDeviceStatusOK); + // Clear the cancel flag. + iIsCancelReceived = EFalse; + + if (ConnectionOpen()) + { + // Initiate the next request phase bulk data receive sequence. + InitiateBulkRequestSequenceL(); + } + else if (iIsResetRequestSignaled) + { + iIsResetRequestSignaled = EFalse; + StartConnectionL(); + } + } __FLOG(_L8("TransactionCompleteL - Exit")); } @@ -587,8 +595,7 @@ { TUint16 containerType(iUsbBulkContainer->Uint16L(CMTPUsbContainer::EContainerType)); -#ifdef _DEBUG - +#ifdef _DEBUG TUint16 transactionID(iUsbBulkContainer->Uint32L(CMTPUsbContainer::ETransactionID)); RDebug::Print(_L("Time Stamp is :%d"), User::TickCount()); RDebug::Print(_L("the container Type is 0x%x, the transaction ID is 0x%x\n"), containerType,transactionID); @@ -906,6 +913,8 @@ CMTPUsbConnection::CMTPUsbConnection(MMTPConnectionMgr& aConnectionMgr) : CActive(EPriorityStandard), iEndpointInfo(KEndpointMetaData, EMTPUsbEpNumEndpoints), + iIsCancelReceived(EFalse), + iIsResetRequestSignaled(EFalse), iConnectionMgr(&aConnectionMgr) { CActiveScheduler::Add(this); @@ -1233,7 +1242,7 @@ void CMTPUsbConnection::ProcessControlRequestDeviceResetL(const TMTPUsbControlRequestSetup& /*aRequest*/) { __FLOG(_L8("ProcessControlRequestDeviceResetL - Entry")); - + // Clear stalled endpoints and re-open connection BulkEndpointsStallClearL(); StartConnectionL(); @@ -1243,9 +1252,18 @@ sequence and initiate the next control request sequence. */ static_cast(iEndpoints[EMTPUsbEpControl])->SendControlRequestStatus(); - StopConnection(); + TBool connIsStopped = StopConnection(); InitiateControlRequestSequenceL(); - StartConnectionL(); + + if (connIsStopped) + { + StartConnectionL(); + } + else + { + iIsResetRequestSignaled = ETrue; + } + __FLOG(_L8("ProcessControlRequestDeviceResetL - Exit")); } @@ -1261,8 +1279,7 @@ TUint offset = 0; for(TUint i(EMTPUsbEpControl); iConnectionOpenedL(*this); + iConnectionMgr->ConnectionOpenedL(*this); SetConnectionState(EOpen); + SetDeviceStatus(EMTPUsbDeviceStatusOK); InitiateBulkRequestSequenceL(); } __FLOG(_L8("StartConnectionL - Exit")); @@ -1661,10 +1664,11 @@ /** Halts USB MTP device class processing. */ -void CMTPUsbConnection::StopConnection() +TBool CMTPUsbConnection::StopConnection() { __FLOG(_L8("StopConnection - Entry")); + TBool ret = ETrue; // Stop all data transfer activity. DataEndpointsStop(); @@ -1672,13 +1676,16 @@ if (ConnectionOpen()) { __FLOG(_L8("Notifying protocol layer connection closed")); - iConnectionMgr->ConnectionClosed(*this); + ret = iConnectionMgr->ConnectionClosed(*this); SetBulkTransactionState(EUndefined); SetConnectionState(EIdle); SetSuspendState(ENotSuspended); + SetDeviceStatus(EMTPUsbDeviceStatusBusy); } __FLOG(_L8("StopConnection - Exit")); + + return ret; } /** @@ -1706,7 +1713,7 @@ */ void CMTPUsbConnection::StartUsbL() { - __FLOG(_L8("StartUsbL - Exit")); + __FLOG(_L8("StartUsbL - Entry")); // Open the USB device interface. User::LeaveIfError(iLdd.Open(KDefaultUsbClientController)); diff -r d0791faffa3f -r aabe5387f5ce obex/obexprotocol/obex/public/obexbase.h --- a/obex/obexprotocol/obex/public/obexbase.h Tue Feb 02 01:11:40 2010 +0200 +++ b/obex/obexprotocol/obex/public/obexbase.h Fri Mar 19 09:40:39 2010 +0200 @@ -164,10 +164,17 @@ IMPORT_C TBool IsConnected() const; IMPORT_C TBool IsStrictPeer() const; IMPORT_C const TObexConnectInfo& LocalInfo() const; - IMPORT_C TInt SetLocalWho(const TDesC8& aInfo); - IMPORT_C const TObexConnectInfo& RemoteInfo() const; - IMPORT_C void SuppressAuthenticationHeaderElements(TObexSuppressedAuthElements aSuppressedObexAuthElements); + IMPORT_C TInt SetLocalWho(const TDesC8& aInfo); + IMPORT_C const TObexConnectInfo& RemoteInfo() const; + IMPORT_C void SuppressAuthenticationHeaderElements(TObexSuppressedAuthElements aSuppressedObexAuthElements); +public: // Implementation of MObexNotify Interface (No longer used) + virtual void Process(CObexPacket& aPacket); + virtual void Error(TInt aError); + virtual void TransportUp(); + virtual void TransportDown(TBool aForceTransportDeletion); + +public: virtual void UserPasswordL( const TDesC& aPassword) = 0; IMPORT_C void RemoteAddr(TSockAddr& anAddr); @@ -181,12 +188,6 @@ void NotifyTransportUp(); void NotifyTransportDown(TBool); -public: // Implementation of MObexNotify Interface (No longer used) - virtual void Process(CObexPacket& aPacket); - virtual void Error(TInt aError) ; - virtual void TransportUp(); - virtual void TransportDown(TBool aForceTransportDeletion); - protected: CObex(); virtual void ConstructL(TObexTransportInfo& aObexTransportInfo); diff -r d0791faffa3f -r aabe5387f5ce obex/obexprotocol/obexusbtransport/src/usbconn.cpp --- a/obex/obexprotocol/obexusbtransport/src/usbconn.cpp Tue Feb 02 01:11:40 2010 +0200 +++ b/obex/obexprotocol/obexusbtransport/src/usbconn.cpp Fri Mar 19 09:40:39 2010 +0200 @@ -1056,6 +1056,15 @@ maxSize = maxPacketSize; } dataifc2().iEndpointData[KTransmitEndpoint - 1].iSize = maxSize; + + // Allocate dma if requested and the device support resource allocation scheme version 2 + // for resource allocation scheme version1, refer to AllocateDma() + if (iRequestDmaOnInEndpoint && + ((dCaps().iFeatureWord1 & KUsbDevCapsFeatureWord1_EndpointResourceAllocV2) != 0)) + { + dataifc2().iEndpointData[KTransmitEndpoint - 1].iFeatureWord1 |= KUsbcEndpointInfoFeatureWord1_DMA; + } + foundIn = ETrue; } else if (!foundOut && (caps->iTypesAndDir & KBulkOutFlags) == KBulkOutFlags) @@ -1068,6 +1077,15 @@ maxSize = maxPacketSize; } dataifc2().iEndpointData[KReceiveEndpoint - 1].iSize = maxSize; + + //Allocate dma here if requested and the device support resource allocation scheme version 2 + // for resource allocation scheme version1, refer to AllocateDma() + if (iRequestDmaOnOutEndpoint && + ((dCaps().iFeatureWord1 & KUsbDevCapsFeatureWord1_EndpointResourceAllocV2) != 0)) + { + dataifc2().iEndpointData[KReceiveEndpoint - 1].iFeatureWord1 |= KUsbcEndpointInfoFeatureWord1_DMA; + } + foundOut = ETrue; } } @@ -1155,6 +1173,14 @@ { LOG_FUNC + TUsbDeviceCaps dCaps; + iUsb.DeviceCaps(dCaps); + if ((dCaps().iFeatureWord1 & KUsbDevCapsFeatureWord1_EndpointResourceAllocV2) != 0) + { + // for resource allocation version2, refer to CObexUsbHandler::RegInterfacesL() + return; + } + if (iRequestDmaOnInEndpoint) { TInt err = iUsb.AllocateEndpointResource(KTransmitEndpoint, EUsbcEndpointResourceDMA);