serviceproviders/sapi_sysinfo/sysinfoservice/src/sysinfoservice.cpp
changeset 10 fc9cf246af83
parent 5 989d2f495d90
child 23 50974a8b132e
equal deleted inserted replaced
5:989d2f495d90 10:fc9cf246af83
    41 #include <UikonInternalPSKeys.h>
    41 #include <UikonInternalPSKeys.h>
    42 #include <btengsettings.h>
    42 #include <btengsettings.h>
    43 
    43 
    44 #include <usbman.h>
    44 #include <usbman.h>
    45 #include <AknsWallpaperUtils.h>
    45 #include <AknsWallpaperUtils.h>
       
    46 #include <AknUtils.h>
    46 
    47 
    47 #include "sysinfoservice.h"
    48 #include "sysinfoservice.h"
    48 #include "sysinfo.h"
    49 #include "sysinfo.h"
    49 #include "SysInfoUtils.h"
    50 #include "SysInfoUtils.h"
    50 #include "entitykeys.h"
    51 #include "entitykeys.h"
    51 #include "activerequests.h"
    52 #include "activerequests.h"
    52 #include "deviceinfo.h"
    53 #include "deviceinfo.h"
    53 #include "sysrange.h"
    54 #include "sysrange.h"
    54 
    55 
       
    56 #include <string.h>
    55 
    57 
    56 using namespace SysInfo;
    58 using namespace SysInfo;
    57 
    59 
    58 // CONSTANT DECLARATIONS
    60 // CONSTANT DECLARATIONS
    59 const TInt KGranularity(2);
    61 const TInt KGranularity(2);
    60 const TInt KPhoneWlanMacAddressLength = 50;
    62 const TInt KPhoneWlanMacAddressLength = 50;
    61 const TChar KPhoneWlanSeparator (':');
    63 const TChar KPhoneWlanSeparator (':');
       
    64 const TUint KPrimaryCameraDisplayID = 2;
    62 _LIT(KWLanMACDataFormat, "%02x");
    65 _LIT(KWLanMACDataFormat, "%02x");
       
    66 const TInt KPhoneLanguageLength = 20;
       
    67 const TInt KMimeTypeLength = 20;
    63 
    68 
    64 // --------------------------------------------------------------------
    69 // --------------------------------------------------------------------
    65 // CSysInfoService::CSysInfoService()
    70 // CSysInfoService::CSysInfoService()
    66 // C++ default constructor.
    71 // C++ default constructor.
    67 // --------------------------------------------------------------------
    72 // --------------------------------------------------------------------
   338     else if( !aEntity.CompareF(KDevice) )
   343     else if( !aEntity.CompareF(KDevice) )
   339         GetDeviceInfoL(aKey,aOutput);
   344         GetDeviceInfoL(aKey,aOutput);
   340 
   345 
   341     else if( !aEntity.CompareF(KFeatures) )
   346     else if( !aEntity.CompareF(KFeatures) )
   342         GetFeatureInfoL(aKey,aOutput);
   347         GetFeatureInfoL(aKey,aOutput);
       
   348     
       
   349     else if ( !aEntity.CompareF( KCameraInfo ) )
       
   350         GetCameraDataL( aKey,aOutput );
   343 
   351 
   344     else
   352     else
   345         User::Leave(KErrNotFound);
   353         User::Leave(KErrNotFound);
   346     }
   354     }
   347 
   355 
   679         {
   687         {
   680         TInt inputLang = 0;
   688         TInt inputLang = 0;
   681         RepositoryUtil::GetRepositoryKeyL(KCRUidAknFep,
   689         RepositoryUtil::GetRepositoryKeyL(KCRUidAknFep,
   682                                         KAknFepInputTxtLang,inputLang);
   690                                         KAknFepInputTxtLang,inputLang);
   683         aSysData = CStatus::NewL(inputLang);
   691         aSysData = CStatus::NewL(inputLang);
       
   692         }    
       
   693     else if ( !aKey.CompareF( KDisplayLanguage ) )
       
   694         {
       
   695         HBufC* phoneLang = NULL;
       
   696         TBuf<KPhoneLanguageLength> language;
       
   697         TRAP_IGNORE(phoneLang = AknLangUtils::DisplayLanguageTagL());           
       
   698         language.Copy( phoneLang->Des() );
       
   699         delete phoneLang;
       
   700         aSysData = CStringData::NewL( language );
   684         }
   701         }
   685     else if( !aKey.CompareF(KSupportedLanguages) )
   702     else if( !aKey.CompareF(KSupportedLanguages) )
   686         {
   703         {
   687         aSysData = CLanguageList::NewL();
   704         aSysData = CLanguageList::NewL();
   688         }
   705         }
   912     aSysData = CStringList::NewL(usbModesDesArray);
   929     aSysData = CStringList::NewL(usbModesDesArray);
   913     CleanupStack::Pop(usbModesDesArray);
   930     CleanupStack::Pop(usbModesDesArray);
   914     CleanupStack::PopAndDestroy(2,&usbsessn);
   931     CleanupStack::PopAndDestroy(2,&usbsessn);
   915     }
   932     }
   916 
   933 
       
   934 // --------------------------------------------------------------------
       
   935 // CSysInfoService::GetACameraDataL()
       
   936 // Returns the readonly properties of camera - Media Types and Sizes Supported.
       
   937 // returns CSysData.
       
   938 // --------------------------------------------------------------------
       
   939 //
       
   940 void CSysInfoService::GetCameraDataL( TPtrC aKey, CSysData*& aSysData )
       
   941     {
       
   942     if ( !aKey.CompareF( KCameraProperties ) )
       
   943         {
       
   944         CImagingConfigManager* cfgMgr = CImagingConfigManager::NewL();
       
   945         CleanupStack::PushL( cfgMgr );
       
   946         TImageQualitySet set;
       
   947         RPointerArray<CResolution> camResArr( KGranularity );
       
   948         CDesCArray* mimeArray= NULL;
       
   949         mimeArray = new (ELeave) CDesCArrayFlat( KGranularity );
       
   950         CleanupStack::PushL( mimeArray );
       
   951 
       
   952         CCameraResolutionList* resList= NULL;
       
   953         CStringList* mimeList= NULL;
       
   954 
       
   955         TInt totalLevels = cfgMgr->NumberOfImageQualityLevels();
       
   956         CArrayFixFlat<TUint>* levels = new (ELeave) CArrayFixFlat<TUint>( totalLevels );
       
   957         CleanupStack::PushL( levels );
       
   958 
       
   959         cfgMgr->GetImageQualityLevelsL( *levels, KPrimaryCameraDisplayID );
       
   960         TInt numLevels(levels->Count() );
       
   961         for ( int i=0; i<numLevels; i++ )
       
   962             {
       
   963             cfgMgr->GetImageQualitySet( set, levels->At(i), KPrimaryCameraDisplayID );
       
   964             if ( set.iCamcorderVisible > 0 )
       
   965                 {
       
   966                 CResolution* camRes = CResolution::NewL( set.iImageWidth, set.iImageHeight );
       
   967                 CleanupStack::PushL( camRes );
       
   968                 camResArr.AppendL( camRes );
       
   969                 CleanupStack::Pop( camRes );
       
   970 
       
   971                 TText8* mimeType = set.iImageFileMimeType;
       
   972                 TInt length = strlen( (const char *)mimeType );
       
   973                 TPtrC8 mimeTypePtr( mimeType, length );
       
   974                 TBuf8<KMimeTypeLength> mimeTypeBuf = mimeTypePtr;
       
   975                 TBuf16<KMimeTypeLength> imageMimeType;
       
   976                 imageMimeType.Copy( mimeTypeBuf );
       
   977                 mimeArray->AppendL( imageMimeType );
       
   978                 }
       
   979             }
       
   980         resList = CCameraResolutionList::NewL( camResArr ); //Ownership of camResArr is transferred to CCameraResolutionList
       
   981         mimeList = CStringList::NewL( mimeArray ); //Ownership of mimeArray is transferred to CStringList
       
   982         CleanupStack::PopAndDestroy( levels );
       
   983         CleanupStack::Pop( mimeArray );
       
   984         CleanupStack::PopAndDestroy( cfgMgr );
       
   985         camResArr.Reset();
       
   986         aSysData = CCameraInfo::NewL( resList, mimeList ); //Ownership of resList and mimeList is transferred to CCameraInfo
       
   987         }
       
   988     else
       
   989         User::Leave( KErrNotFound );
       
   990     }
       
   991 
   917 // End of file.
   992 // End of file.