inc/mdscommoninternal.h
changeset 0 c53acadfccc6
child 3 b73a2e62868f
equal deleted inserted replaced
-1:000000000000 0:c53acadfccc6
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Common message definitions and utilities for MDS internal use
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef MDSCOMMONINTERNAL_H
       
    20 #define MDSCOMMONINTERNAL_H
       
    21 
       
    22 #include <mdccommon.h>
       
    23 
       
    24 
       
    25 //                           X:[<UID>]<database-name>.db
       
    26 _LIT( KMdsSqlDbDefaultName, "C:[200009f3]metadata.sq" );
       
    27 _LIT( KMdsSqlDbDefaultPath, "C:\\private\\10281E17\\[200009f3]metadata.sq" );
       
    28 _LIT( KMdsSqlDbBackupPath, "C:\\private\\200009F5\\[200009f3]metadata.sq" );
       
    29 
       
    30 // default import metadata file
       
    31 _LIT( KMdsDefaultImportFile, "C:\\private\\200009f3\\defaultimportfile.mde" );
       
    32 _LIT( KMdsDefaultRomImportFile, "Z:\\private\\200009f3\\defaultimportfile.mde" );
       
    33 
       
    34 // schema file version
       
    35 const TInt KSchemaFileMajorVersion = 2;
       
    36 const TInt KSchemaFileMinorVersion = 0;
       
    37 
       
    38 const TDefId KDefaultNamespaceDefId = 1;
       
    39 
       
    40 const TDefId KBaseObjectDefId = 1;
       
    41 
       
    42 const TUint32 KBaseObjectBasicValueColumnOffset = 8;
       
    43 
       
    44 const TInt KMaxUintValueLength   = 10;
       
    45 const TInt KMaxUint64ValueLength = 20;
       
    46 
       
    47 _LIT( KMdSServerName,"MdSServer" ); // Server name
       
    48 _LIT( KSchemaChunkName, "MdSSchema" );
       
    49 
       
    50 _LIT( KCMediaIdKey, "CDriveMediaId" );
       
    51 
       
    52 // The server version. A version must be specified when
       
    53 // creating a session with the server.
       
    54 const TUint KMdSServMajorVersionNumber=2;
       
    55 const TUint KMdSServMinorVersionNumber=5;
       
    56 const TUint KMdSServBuildVersionNumber=0;
       
    57 
       
    58 
       
    59 const TUint32 KNokiaVendorId = 52487775;
       
    60 
       
    61 // P&S stuff
       
    62 static _LIT_SECURITY_POLICY_PASS(KAllowAllPolicy);
       
    63 static _LIT_SECURITY_POLICY_C1(KPowerMgmtPolicy,ECapabilityPowerMgmt);
       
    64 
       
    65 const TUid KMdSPSShutdown = { 0x20022E94 };
       
    66 const TUid KHarvesterPSShutdown = { 0x200009F5 };
       
    67 const TUid KWatchdogPSShutdown = { 0x20022E93 };
       
    68 
       
    69 const TInt KShutdown = 0x00000002;
       
    70 
       
    71 //Locktype for query
       
    72 enum TMdCQueryLockType
       
    73 	{
       
    74 	EGet,
       
    75 	ELock	
       
    76 	};
       
    77 
       
    78 //
       
    79 // Common enumerations in client/server messages
       
    80 //
       
    81 // Server requests
       
    82 enum TMdEServRqst
       
    83     {
       
    84     EShutdown = 0,         	// shut down the session
       
    85     EAdd,					// add items
       
    86     ERemove,				// remove items
       
    87     EFind,              	// finds in sync
       
    88     EAsyncFind,         	// finds asynchronously
       
    89     EContinueAsyncFind, 	// continues existing asynchronous find, fetches next set
       
    90     ECancelFind,        	// cancels asynchronous find
       
    91     ECancelObject,      	// cancels opened object
       
    92     ECheckObject,			// get object's "base" values
       
    93     EUpdate,		      	// update items
       
    94     ERegister,          	// registers an object to be notified
       
    95     EListen,            	// listens for events for a registered profile
       
    96     EUnregister,        	// unregisters for no more notifications
       
    97     EGetData,           	// (transfers data server->client)
       
    98     EImportMetadata,    	// starts metadata importing
       
    99     EAsyncImportMetadata,	// starts asynchronous metadata importing
       
   100     EExportMetadata,		// starts metadata exporting
       
   101     EAsyncExportMetadata,	// starts asynchronous metadata exporting
       
   102     EImportSchema,      	// starts schema importing
       
   103     EAddRelationDef,		// Add new relation
       
   104     EAddEventDef,			// Add new event
       
   105     EAddMemoryCard,			// Add new memory card's media ID
       
   106     EGetMemoryCard,			// Get latest memory card's media ID
       
   107     ECheckMemoryCard,		// Check if there is already  memory card with given media ID
       
   108     ESetMedia,				// Set media's media ID, drive and present state to DB
       
   109     EGetMedia,				// Get media's drive and present state from DB
       
   110     EGetPresentMedias,		// Get present medias' media IDs, drives and present states from DB
       
   111     ESetFileToPresent,		// Set file to present state
       
   112     ESetFilesToPresent,		// Set files to present state
       
   113     ESetFilesToNotPresent,	// Set all files, which media ID is given, to not present state
       
   114     ERemoveFilesNotPresent,	// Remove all objects, which are in not present state, with given media ID
       
   115     EGetSchemaVersion,		// Get schema version's major and minor version
       
   116     ESetObjectToPresentByGuid,					// Set object to "present" state by GUID
       
   117     ESetHarvestingPrioritizationChunk,			// Set global harvester prioritization chunk
       
   118     EAddHarvestingPrioritizationObserver,		// Add harvester prioritization observer
       
   119     ECancelHarvestingPrioritizationObserver,	// Cancel harvester prioritization observer
       
   120     EChangePath,            // Change path of objects
       
   121     ESetPending,    		// Set pending flag to objects
       
   122     EResetPending,			// Reset pending flag to objects
       
   123     EGetPendingCount,		// Get count of objects with pending flag
       
   124     EGetPending,			// Get objects with pending flag
       
   125     EResetDB,              	// Reset database (works only in DEBUG build)
       
   126     EChangeMediaId,			// Change C-drive media id and update objects
       
   127     EUnknownMdEServRqst     // handle for unknown requests
       
   128     };
       
   129 
       
   130 // Server request arguments for 
       
   131 // EAddRelationDef and EAddEventDef
       
   132 enum TMdEServRqstArgsAddDef
       
   133 	{
       
   134 	EAddDefArgNamespaceId = 0,
       
   135 	EAddDefArgDefName     = 1
       
   136 	};
       
   137 	
       
   138 // Server request arguments for 
       
   139 // EFind, EAsyncFind, EContinueAsyncFind and ECancelFind
       
   140 enum TMdEServRqstArgsFind
       
   141 	{
       
   142 	EFindArgQueryId         = 0,
       
   143 	EFindArgConditions      = 1,
       
   144 	EFindArgResulBufferSize = 2,
       
   145 	EFindArgNotifyCount     = 3
       
   146 	};
       
   147 
       
   148 enum TMdEServRqstArgsCheckObject
       
   149 	{
       
   150 	ECheckObjectArgType           = 0,
       
   151 	ECheckObjectArgTypeValue      = 1,
       
   152 	ECheckObjectArgNamespaceDefId = 2,
       
   153 	ECheckObjectArgObject         = 3
       
   154 	};
       
   155 
       
   156 enum TMdECheckObjectType
       
   157 	{
       
   158 	ECheckObjectByUri,
       
   159 	ECheckObjectById,
       
   160 	ECheckObjectByIds
       
   161 	};
       
   162 
       
   163 // Server request arguments for 
       
   164 // ESetObjectToPresentByGuid
       
   165 enum TMdEServRqstArgsSetObjectToPresentByGuid
       
   166 	{
       
   167 	ESetObjectToPresentByGuidArgGuidHigh = 0,
       
   168 	ESetObjectToPresentByGuidArgGuidLow  = 1
       
   169 	};
       
   170 	
       
   171 // Server request responses
       
   172 enum TMdEServRqstComplete
       
   173 	{
       
   174     EAsyncFindSetReady  = 1000, // set complete
       
   175     EAsyncFindComplete,         // whole find complete
       
   176     ELoadSchema,        		// fetches schema to client
       
   177 
       
   178     /*ENotifyAdded,               // notification: item added
       
   179     ENotifyRemoved,             // notification: item removed
       
   180     ENotifyModified,            // notification: item modified
       
   181     ENotifyObjectPresent,       // notification: object set to present
       
   182     ENotifyObjectNotPresent,    // notification: object set to not present
       
   183     ENotifyRelationPresent,     // notification: relation set to present
       
   184     ENotifyRelationNotPresent,  // notification: relation set to not present
       
   185     ENotifySchemaAdded,         // notification: schema added
       
   186     */
       
   187 	};
       
   188 		
       
   189 	
       
   190 // MdE user levels
       
   191 enum TUserLevel
       
   192     {
       
   193     EUserLevelNone,
       
   194     EUserLevelNormal,
       
   195     EUserLevelDeviceAccess
       
   196     };
       
   197 
       
   198 enum TMdEObjectFlags
       
   199 	{
       
   200 	EMdEObjectFlagNone                 = 0x00000000, // no flags set
       
   201 	EMdEObjectFlagNotPresent           = 0x00000001, // object is marked as not present
       
   202 	EMdEObjectFlagRemoved              = 0x00000002, // object is marked as removed
       
   203 	EMdEObjectFlagFreetexts            = 0x00000004, // object has freetext(s)
       
   204 	EMdEObjectFlagConfidential         = 0x00000008, // object is confidential
       
   205 	EMdEObjectFlagPlaceholder          = 0x00000010, // object is placeholder
       
   206 	EMdEObjectFlagStartUpNotPresent    = 0x00000020, // object is marked as start up not present
       
   207 	EMdEObjectFlagContext              = 0x00000040, // object is context object
       
   208 	EMdEObjectFlagGarbage              = 0x00000080, // object is marked to be removed by garbage collector
       
   209 	
       
   210 	EMdeObjectFlagPending			   = 0x00000100, // composing to binary is pending for this object
       
   211 	
       
   212 	EMdEObjectFlagModObject            = 0x00010000, // object modifications
       
   213 	EMdEObjectFlagModProperty          = 0x00020000, // one of properties modifications
       
   214 	EMdEObjectFlagModFreeText          = 0x00040000, // one of freetext modifications
       
   215 	EMdEObjectFlagModOpen              = 0x00080000, // open for modifications
       
   216 	
       
   217 	EMdEObjectFlagAutoLock             = 0x00100000, // open for modifications
       
   218 	};
       
   219 
       
   220 enum TMdERelationFlags
       
   221 	{
       
   222 	EMdERelationFlagNone           = 0x00000000, // no flags set
       
   223 	EMdERelationFlagNotPresent     = 0x00000001, // relation's object is not present
       
   224 	EMdERelationFlagDeleted        = 0x00000002, // relation's object is marked as removed
       
   225 	EMdERelationFlagGarbageDeleted = 0x00080000, // relation's object is marked to be removed by garbage collector
       
   226 	};
       
   227 
       
   228 enum TMdEPropertyFlags
       
   229 	{
       
   230 	EPropertyReadOnly   = 0x01,
       
   231 	EPropertyMandatory  = 0x02,
       
   232 	};
       
   233 
       
   234 enum TMdEPropertyModFlags
       
   235 	{
       
   236 	EMdEPropertyModNone   = 0x00,
       
   237 	EMdEPropertyModChange = 0x01,
       
   238 	EMdEPropertyModRemove = 0x02,
       
   239 	};
       
   240 	
       
   241 enum TMdSObserverNotificationType
       
   242 	{
       
   243 	EObjectNotifyAdd          = 0x00000001,
       
   244 	EObjectNotifyModify       = 0x00000002,
       
   245 	EObjectNotifyRemove       = 0x00000004,
       
   246 
       
   247 	EObjectNotifyPresent      = 0x00000010,
       
   248 	EObjectNotifyNotPresent   = 0x00000020,
       
   249 	
       
   250 	ERelationNotifyAdd        = 0x00000100,
       
   251 	ERelationNotifyModify     = 0x00000200,
       
   252 	ERelationNotifyRemove     = 0x00000400,
       
   253 
       
   254 	ERelationNotifyPresent    = 0x00001000,
       
   255 	ERelationNotifyNotPresent = 0x00002000,
       
   256 
       
   257 	//ERelationItemNotifyAdd    = 0x00010000,
       
   258 	//ERelationItemNotifyModify = 0x00020000,
       
   259 	ERelationItemNotifyRemove = 0x00040000,
       
   260 	
       
   261 	
       
   262 	EEventNotifyAdd           = 0x00100000,
       
   263 	EEventNotifyRemove        = 0x00200000,
       
   264 	
       
   265 	ESchemaModify             = 0x01000000,
       
   266 	
       
   267 	// 0x80000000 is not allowed (signed number is negative)
       
   268 	};
       
   269 
       
   270 // File info
       
   271 struct TMdSFileInfo
       
   272 	{
       
   273 	/** Last modification time. */
       
   274 	TInt64 iModifiedTime;
       
   275 
       
   276 	/** File size in bytes. */
       
   277 	TUint32 iSize;
       
   278 	};
       
   279 
       
   280 /** Storage state flags.  */
       
   281 enum TStoredFlags
       
   282 	{
       
   283 	EStoredFlagsNone  = 0x0000,
       
   284 	EStoredFlagsDB    = 0x0001, // data stored in DB
       
   285 	EStoredFlagsTable = 0x0002, // table is stored in DB
       
   286 	EStoredFlagsC2P   = 0x0004, // data is stored in Col2Prop table
       
   287 	};
       
   288 
       
   289 /**
       
   290  * Query's internal optimization flags
       
   291  */
       
   292 enum TInternalOptimizationFlags
       
   293 	{
       
   294 	EContainsObjectCondition     = 0x00000001,
       
   295 	EContainsRelationCondition   = 0x00000002,
       
   296 	EContainsEventCondition      = 0x00000004,
       
   297 	EContainsFreetextCondition   = 0x00000008,
       
   298 	EContainsNotPresentCondition = 0x00000010,
       
   299 	EContainsObjectLocking       = 0x00000020,
       
   300 	EContainsPlaceholdersOnly    = 0x00000040
       
   301 	};
       
   302 
       
   303 struct TMdEMediaInfo
       
   304 	{
       
   305 	TUint32 iMediaId;
       
   306 	TChar iDrive;
       
   307 	};
       
   308 	
       
   309 /**
       
   310  * File present states.
       
   311  * Values must be between 0 and 255.
       
   312  */
       
   313 enum TFilePresentStates
       
   314 	{
       
   315 	EMdsNotFound = 0,
       
   316 	EMdsNormal,
       
   317 	EMdsPlaceholder,
       
   318 	EMdsModified
       
   319 	};
       
   320 	
       
   321 struct TMdSMediaIdAndCount
       
   322 	{
       
   323 	TUint32 iMediaId;
       
   324 	TUint32 iCount;
       
   325 	};	
       
   326 	
       
   327 #endif //MDSCOMMONINTERNAL_H