commsfwtools/preparedefaultcommsdatabase/inc/CommsDat.h
changeset 0 dfb7c4ff071f
equal deleted inserted replaced
-1:000000000000 0:dfb7c4ff071f
       
     1 // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // Constants for use in storing comms data via CommsDat
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file
       
    20  @publishedAll
       
    21  @released
       
    22 */
       
    23 
       
    24 
       
    25 #if (!defined COMMSDAT_H)
       
    26 #define       COMMSDAT_H
       
    27 
       
    28 #include <comms-infras/metatype.h>
       
    29 #include <e32property.h>
       
    30 
       
    31 
       
    32 namespace CommsDat
       
    33 {
       
    34 
       
    35 /**
       
    36 Use this constant for Debug panic calls
       
    37 
       
    38 @publishedAll
       
    39 @released
       
    40 */
       
    41 _LIT(KCommsDatName,"CommsDat");
       
    42 
       
    43 /**
       
    44 Use this constant for Debug panic calls
       
    45 
       
    46 @publishedAll
       
    47 @released
       
    48 */
       
    49 enum
       
    50 	{
       
    51 	ECommitBeforeOpenTransaction = 1,
       
    52 	ERollBackBeforeOpenTransaction = 2,
       
    53 	ESessionClosed = 3,
       
    54 	ENotifierNotCreated = 4,
       
    55     EWrongAPPrioritySelPolRecord = 5,
       
    56     EWrongIAPServiceType = 6,
       
    57     EInvalidIAP = 7
       
    58 	};
       
    59 	
       
    60 using namespace Meta;
       
    61 
       
    62 //
       
    63 // VERSION INFO
       
    64 //
       
    65 /* Please note:
       
    66  * ------------ 
       
    67  * Concrete schema version should be used in the client applicaiton (curently available
       
    68  * KCDVersion1_1 or KCDVersion1_2). 
       
    69  * 
       
    70  * Until the 9.5 release there was only one schema version, KCDVersion1_1, which was 
       
    71  * available. From the 9.5 relase there is a possibility to use other schema version,
       
    72  * KCDVersion1_2. Important that it's still possible to use the KCVersion1_1 
       
    73  * constant, and use the deprecated records/tables, - CommsDat will invoke it's 
       
    74  * mapping functionality in this case to be backward compatible. 
       
    75  * 
       
    76  * For backward compatibility reason the KCDLatestVersion and KCDCurrentVersion 
       
    77  * constants are mapped to the KCDVersion1_1 constant. These constants are 
       
    78  * deprecated.
       
    79  * 
       
    80  * ! PLEASE USE EXPLICIT SCHEMA VERSION WHEN CREATING A COMMSDAT SESSION OBJECT !
       
    81  */
       
    82 
       
    83 /**
       
    84 Versions of the dataset in use
       
    85 
       
    86 Initial Version 
       
    87 @publishedAll
       
    88 @released
       
    89 */
       
    90 
       
    91 #define KCDVersion1_1               TVersion(1,1,1)
       
    92 
       
    93 #ifdef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY
       
    94 /**
       
    95 Some elements in Version KCDVersion1_1 now deprecated
       
    96 These elements will be mapped if the client starts a session with KCDVersion1_1
       
    97 They will be ignored or rejected as not supported if client starts a session with 
       
    98 KCDVersion1_2
       
    99 
       
   100 @publishedAll
       
   101 @released
       
   102 */
       
   103 #define KCDVersion1_2               TVersion(1,2,1)
       
   104 #endif
       
   105 
       
   106 /**
       
   107 For BC reasons this constant maps to the KCDVersion1_1 dataschema version.
       
   108 
       
   109 @publishedAll
       
   110 @deprecated
       
   111 */
       
   112 #define KCDLatestVersion            KCDVersion1_1
       
   113 
       
   114 /**
       
   115 For BC reasons this constant maps to the KCDVersion1_1 dataschema version.
       
   116 
       
   117 @publishedAll
       
   118 @deprecated
       
   119 */
       
   120 #define KCDCurrentVersion           KCDVersion1_1
       
   121 
       
   122 
       
   123 //
       
   124 //  Attribute Flags
       
   125 //
       
   126 
       
   127 /**
       
   128 Access control attribute flags.
       
   129 When these are SET in the mask the attribute is obeyed
       
   130 When they are CLEARED from the mask, the attribute is ignored
       
   131 By default attributes are obeyed.
       
   132 
       
   133 @publishedAll
       
   134 @released
       
   135 */
       
   136 typedef enum
       
   137 {
       
   138   ECDNoWriteButDelete = 0x0000010,     // R/W Read Only but deleteable      Caller should explicitly choose to modify
       
   139                                        //                                   Enforced by convention only, not with Platform Security
       
   140   ECDHidden           = 0x0000020,     // R/W Read-Write Hidden data        Not policed - hides public utility info such as default values
       
   141                                        //                                   Enforced by convention only, not with Platform Security  
       
   142   ECDPrivate          = 0x0000040,     // R/W Read-Write Private data       For sensitive user data such as passwords
       
   143                                        //                                   Policed at storage server API with platsec capability
       
   144   ECDProtectedWrite   = 0x0000080,     // W   Write-Protected data          To allow data to be read only to most clients but modifiable by a few privileged clients
       
   145                                        //                                   Policed at storage server API with platsec capability
       
   146 } TCDAttributeFlags;
       
   147 
       
   148 //
       
   149 // Masks for Element Type info
       
   150 //
       
   151 
       
   152 
       
   153 /**
       
   154 Mask to use to hide attribute reserved bits
       
   155 
       
   156 @publishedAll
       
   157 @released
       
   158 */
       
   159 #define KCDMaskHideAttrAndRes       0xffffff00
       
   160 
       
   161 
       
   162 /**
       
   163 Mask to use to show reserved bits
       
   164 
       
   165 @publishedAll
       
   166 @released
       
   167 */
       
   168 #define KCDMaskShowRes              0x8000000f
       
   169 
       
   170 
       
   171 /**
       
   172 Mask to use to hide reserved bits
       
   173 
       
   174 @publishedAll
       
   175 @released
       
   176 */
       
   177 #define KCDMaskHideRes              0x7ffffff0
       
   178 
       
   179 
       
   180 /**
       
   181 T x x   Mask to show Table Type info
       
   182 
       
   183 @publishedAll
       
   184 @released
       
   185 */
       
   186 #define KCDMaskShowRecordType       0x7f800000
       
   187 
       
   188 
       
   189 /**
       
   190 x C x   Mask to show Column Type 
       
   191 
       
   192 @publishedAll
       
   193 @released
       
   194 */
       
   195 #define KCDMaskShowFieldType        0x007f0000
       
   196 
       
   197 
       
   198 /**
       
   199 T C x   Mask to show Table and Column Type 
       
   200 
       
   201 @publishedAll
       
   202 @released
       
   203 */
       
   204 #define KCDMaskShowType             0x7fff0000
       
   205 
       
   206 
       
   207 /**
       
   208 T x R   Mask to show Record id
       
   209 
       
   210 @publishedAll - don't use this.  Replace with KCDMaskShowRecordId
       
   211 @deprecated
       
   212 */
       
   213 #define KCDMaskShowInstance         0x0000ff00
       
   214 
       
   215 
       
   216 /**
       
   217 T x R   Mask to show Record id
       
   218 Use in place of KCDMaskShowInstance
       
   219 @publishedAll
       
   220 @released
       
   221 */
       
   222 #define KCDMaskShowRecordId         0x0000ff00
       
   223 
       
   224 
       
   225 /**
       
   226 T C R   Mask to show Field instance without attributes or reserved bits
       
   227 
       
   228 @publishedAll
       
   229 @released
       
   230 */
       
   231 #define KCDMaskShowField            0x7fffff00
       
   232 
       
   233 
       
   234 /**
       
   235 T x R   Mask to show Record Type and Record Id without column type, attributes or reserved bits
       
   236 
       
   237 @publishedAll
       
   238 @released
       
   239 */
       
   240 #define KCDMaskShowRecordTypeAndId  (KCDMaskShowRecordType | KCDMaskShowRecordId)
       
   241 
       
   242 /**
       
   243 x C R   Mask to show Column Type and Record Id without Record type, attributes or reserved bits
       
   244 
       
   245 @publishedAll
       
   246 @released
       
   247 */
       
   248 #define KCDMaskShowColumnTypeAndRecordId  (KCDMaskShowFieldType |  KCDMaskShowRecordId)
       
   249 
       
   250 
       
   251 /**
       
   252 Mask to show Attributes
       
   253 
       
   254 @publishedAll
       
   255 @released
       
   256 */
       
   257 #define KCDMaskShowAttributes       0x000000f0
       
   258 
       
   259 /**
       
   260 Mask to use to show attributes and reserved bits
       
   261 
       
   262 @publishedAll
       
   263 @released
       
   264 */
       
   265 #define KCDMaskShowAttrAndRes       0x000000ff
       
   266 
       
   267 
       
   268 /**
       
   269 Id for the Initial record in a record set
       
   270 
       
   271 @publishedAll
       
   272 @released
       
   273 */
       
   274 #define KCDInitialRecordId			0x00000100
       
   275 
       
   276 
       
   277 /**
       
   278 Id for the Initial table in the database
       
   279 
       
   280 @publishedAll
       
   281 @released
       
   282 */
       
   283 #define KCDInitialTableId			0x00800000
       
   284 
       
   285 
       
   286 /**
       
   287 Id for the Initial User defined table in the database
       
   288 clients have 64 table ids available to them
       
   289 
       
   290 @publishedAll
       
   291 @released
       
   292 */
       
   293 #define KCDInitialUDefRecordType   0x5F800000
       
   294 
       
   295 
       
   296 /**
       
   297 Id for the Last User defined table in the database.
       
   298 
       
   299 @publishedAll
       
   300 @released
       
   301 */
       
   302 #define KCDLastUDefRecordType      0x7F800000
       
   303 
       
   304 
       
   305 /**
       
   306 Id for the Initial column in a record set
       
   307 
       
   308 @publishedAll
       
   309 @released
       
   310 */
       
   311 #define KCDInitialColumnId			0x00010000
       
   312 
       
   313 
       
   314 /**
       
   315 T C 0   location for default field values
       
   316 
       
   317 @publishedAll
       
   318 @released
       
   319 */
       
   320 #define KCDDefaultRecord            0x00000000
       
   321 
       
   322 
       
   323 /**
       
   324 Combine with table id and Column id to give the location of column type info
       
   325 
       
   326 @publishedAll
       
   327 @released
       
   328 */
       
   329 #define KCDColumnTypeInfo           0x0000ff00
       
   330 
       
   331 
       
   332 
       
   333 /**
       
   334 Combine with table id to give request for a new record in a table.
       
   335 The table must already exist.
       
   336 
       
   337 @publishedAll
       
   338 @released
       
   339 */
       
   340 #define KCDNewRecordRequest			0x807f0001
       
   341 
       
   342 
       
   343 /**
       
   344 Combined with CMDBField, it finds the TableId given the table name
       
   345 
       
   346 @publishedAll
       
   347 @released
       
   348 */
       
   349 #define KCDMaskGenericTableName			0x007fff00
       
   350 
       
   351 
       
   352 
       
   353 /**
       
   354 Maximum number of tables that can be created in one repository
       
   355 
       
   356 @publishedAll
       
   357 @released
       
   358 */
       
   359 #define KCDMaxTables                254
       
   360 
       
   361 
       
   362 /**
       
   363 Maximum number of User defined tables that can be created in one repository
       
   364 
       
   365 @publishedAll
       
   366 @released
       
   367 */
       
   368 #define KCDMaxUserDefTables         64
       
   369 
       
   370 
       
   371 /**
       
   372 Maximum number of columns that can be created in one table
       
   373 
       
   374 @publishedAll
       
   375 @released
       
   376 */
       
   377 #define KCDMaxColumns               126  
       
   378 
       
   379 
       
   380 /**
       
   381 Maximum number of records that can be stored in one table
       
   382 
       
   383 @publishedAll
       
   384 @released
       
   385 */
       
   386 #define KCDMaxRecords               254
       
   387 
       
   388 
       
   389 /**
       
   390 Maximum number of characters in a field name
       
   391 
       
   392 @publishedAll
       
   393 @released
       
   394 */
       
   395 #define KCDMaxFieldNameLength        64
       
   396 
       
   397 
       
   398 /**
       
   399 Macro for interaction with netmeta
       
   400 @publishedAll
       
   401 @released
       
   402 */
       
   403 #define X_REGISTER_ATTRIBUTE( thisMetaClass, var, metaType ) \
       
   404  { _FOFF( thisMetaClass, var ), Meta::metaType##VisitorFactoryL },
       
   405 
       
   406 
       
   407 #define EXP_DATA_VTABLE \
       
   408  IMPORT_C virtual Meta::SVDataTableEntry const* GetVDataTable() const;	\
       
   409  IMPORT_C virtual TUint8* GetAttribPtr(const TInt aOffset) const;	\
       
   410  IMPORT_C static Meta::SVDataTableEntry const* GetVDataTableStatic(); \
       
   411  static const Meta::SVDataTableEntry iVDataTable[];
       
   412 
       
   413 
       
   414 /**
       
   415 Macros used to implement virtual functions from MMetaData interface and construct the v data table
       
   416 @publishedAll
       
   417 @released
       
   418 */
       
   419 #define EXP_START_ATTRIBUTE_TABLE( thisMetaClass, uid, typeId ) \
       
   420  EXPORT_C Meta::SVDataTableEntry const* thisMetaClass::GetVDataTable() const { return &iVDataTable[0]; };	\
       
   421  EXPORT_C TUint8* thisMetaClass::GetAttribPtr(const TInt aOffset) const { return (TUint8*)this + aOffset; };	\
       
   422  EXPORT_C Meta::SVDataTableEntry const* thisMetaClass::GetVDataTableStatic() { return &iVDataTable[0]; }; \
       
   423  const Meta::SVDataTableEntry thisMetaClass::iVDataTable[] = { \
       
   424  { uid, reinterpret_cast<Meta::TMetaTypeNewL>(typeId) },
       
   425 
       
   426 
       
   427 /**
       
   428 @publishedAll
       
   429 @released
       
   430 */
       
   431 typedef enum
       
   432 {
       
   433 	EText,          //< Text field - descriptor with a maximum length of 50 unicode characters.
       
   434  	EDesC8,         //< Buffer of TUInt8. Maximum length is 1024 * 8. 
       
   435  	EUint32,		//< Unsigned 32 bit integer field.
       
   436  	EInt,			//< Signed integer field
       
   437  	EBool,			//< Boolean field
       
   438  	EMedText,       //< Text field - descriptor with a maximum length of 256 unicode characters.
       
   439  	ELongText, 		//< Text field - descriptor with a maximum length of 1024 unicode characters.
       
   440     ELink			//< This field is an integer that identifies a record in another table.
       
   441 
       
   442 } TCDFieldValueTypes;
       
   443 
       
   444 /**
       
   445 Flag to indicate change in field
       
   446 Not for use in database.  Just with fields
       
   447 
       
   448 @publishedAll
       
   449 */
       
   450 #define KCDChangedFlag      0x00000001
       
   451     
       
   452 } //end namespace CommsDat
       
   453 
       
   454 #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
       
   455 #include <commsdat_internal.h>
       
   456 #include <commsdat_partner.h>
       
   457 #endif
       
   458 
       
   459 #endif