Symbian
Symbian OS Library

SYMBIAN OS V9.3

[Index] [Spacer] [Previous] [Next]



MTP Framework - Central Repository Configuration

Certain MTP configuration settings are stored in the Central Repository. Typically they are used to determine how the device appears to the PC.

An MTP Central Repository file, containing default values for each of the settings, is created by the device manufacturer and built into the ROM. The values may be updated at run time by the MTP server only. Other components may read them.

An example Central Repository file for MTP.

# Copyright (c) 2006 Symbian Software Ltd. All rights reserved.
#
# MTP CentRep ini file 
#

# Header
cenrep
version 1

[platsec]
# Any client can read values, only the MTP server can write values. 
# 0x102827A2 is the UID of the MTP server - this value must be specified in decimal: 271067042.
cap_rd = AlwaysPass sid_wr = 271067042

[main]
# settings:
# 0x00000000 - Device friendly name: string
# 0x00000001 - Synchronization partner name: string
# 0x00000002 - Default storage drive: int
# 0x00000003 - RAM drive metadata storage flag: bool (Reserved for future use) 
# 0x0001XXXX - Excluded storage drives: array of int
0x00000000     string    "Symbian MTP Device"      0
0x00000001    string       "Symbian MTP Sync Partner"     0
0x00000002    int       8                  0
0x00000003    int       0                  0
0x00010000    int       2                  0
0x00010001    int       4                  0
0x00010002    int       10              0


Reading values from the Repository

Settings may be retrieved from the Central Repository using CMTPConfigMgr. Simply instantiate an instance of the class and use it to get the value(s) of the settings that you require. The settings are enumerated using CMTPConfigMgr::TSettings.

//
//  Copyright (c) Symbian Software Ltd 2006.  All rights reserved.
//


class CMTPConfigMgr : public CBase
    {
public:

    enum TSetting
        {
        /**
        Defines the device friendly name setting - descriptor.
        */        
        ESettingDeviceFriendlyName = 0x00000000,
        
        /**
        Defines the synchronization partner name setting - descriptor.
        */        
        ESettingSynchronizationPartnerName = 0x00000001,

        /**
        Defines the default storage drive setting - TUint.
        */        
        EStateDefaultStorageDrive = 0x00000002,

        /**
        Defines the RAM drive metadata storage flag setting - TBool.
        */        
        EStateRamDriveMetadataStorageFlag = 0x00000003,
        
        /**
        Defines the excluded storage drives setting - RArray<TUint>.
        Note that the large value reflects the way arrays are stored in CentRep. 
        This value works in conjunction with a mask that defines what portion of the value 
        differentiates between array settings and what portion differentiates between the 
        values of a given array setting.
        */        
        EStateExcludedStorageDrives = 0x00010000
        };
public:

    static CMTPConfigMgr* NewL();
    ~CMTPConfigMgr();
        
public:

    IMPORT_C void GetValueL(TSetting aSetting, TDes& aValue) const;
    IMPORT_C HBufC* ValueL(TSetting aSetting) const;
    IMPORT_C void GetValueL(TSetting aSetting, TUint& aValue) const;
    IMPORT_C void GetValueL(TSetting aSetting, TBool& aValue) const;
    IMPORT_C void GetValueL(TSetting aSetting, RArray<TUint>& aArray) const;
   
private:

    CMTPConfigMgr();
    void ConstructL();

private:

    CRepository* iRepository;
    
    };

[Top]


Creating a new setting

A new value may be added to the ini file (group\10282FCC.txt). Obviously this is only possible before the ROM is built.

To make the new setting accessible a new definition must be added to CMTPConfigMgr::TSetting. It may also be necessary, depending on the type of the value, to add a new GetValueL() function to CMTPConfigMgr.

To test that your new setting works properly you will need to update the te_frameworktest TEF project appropriately to exercise it. This will include adding a default value for the new setting to the test ini file.