networkprotocolmodules/networkprotocolmodule/LbsProtocolModule/inc/cconfigmanager.h
changeset 0 9cfd9a3ee49c
equal deleted inserted replaced
-1:000000000000 0:9cfd9a3ee49c
       
     1 // Copyright (c) 2006-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 // This file defines the class that manages configuration of
       
    15 // Test Protocol Module operation.
       
    16 // 
       
    17 //
       
    18 
       
    19 /**
       
    20  @file
       
    21  @internalComponent
       
    22  @test
       
    23 */
       
    24 
       
    25 #ifndef __CCONFIGMANAGER_H__
       
    26 #define __CCONFIGMANAGER_H__
       
    27 
       
    28 #include <e32base.h>
       
    29 
       
    30 // Table index values
       
    31 #define KMoLr				0
       
    32 #define KMtLr				1
       
    33 #define KEmergency			2
       
    34 #define KX3pLow				3
       
    35 #define KX3pMid				4
       
    36 #define KX3pHi				5
       
    37 #define KMaxOperationTypes	6
       
    38 
       
    39 /** Central repository UID
       
    40 This identifies the external data source for decision data
       
    41 */
       
    42 #define KMyRepositoryUid	0x10281D6F
       
    43 
       
    44 /** Default decision 
       
    45 Used if a decision value is not provided by external data, and also 
       
    46 if a caller specifies an invalid type of current or new operation.
       
    47 */
       
    48 #define KDefaultDecision EConflictRejectNew
       
    49 
       
    50 
       
    51 /** Configuration Manager
       
    52 This class manages the configuration of Test Protocol Module operation in
       
    53 relation to how to handle conflicting services.
       
    54 
       
    55 The class provides a method for the protocol manager to call in order
       
    56 to generate a decision for handling a new operation, with due consideration
       
    57 of any current active operation.
       
    58 
       
    59 Conflict decisions are taken from a Decision Table which is initialised from an
       
    60 external data source during construction. The table is represented as a matrix 
       
    61 of decisions organised in rows and columns, representing current operation
       
    62 and new operation, respectively. The UID (unique identifiers) for the external
       
    63 data items are shown in this representation of the table.
       
    64 
       
    65                          New
       
    66                         Operation -->
       
    67     
       
    68                         MOLR MTLR EMRG X3Pl X3Pm X3Ph
       
    69                         -----------------------------
       
    70    Current        MOLR |  1 |  2 |  3 |  4 |  5 |  6 |
       
    71    Operation           |----|----|----|----|----|----|
       
    72       |           MTLR |  7 |  8 |  9 | 10 | 11 | 12 |
       
    73       |                |----|----|----|----|----|----|
       
    74       v           EMRG | 13 | 14 | 15 | 16 | 17 | 18 |
       
    75                        |----|----|----|----|----|----|
       
    76                   X3Pl | 19 | 20 | 21 | 22 | 23 | 24 |
       
    77                        |----|----|----|----|----|----|
       
    78                   X3Pm | 25 | 26 | 27 | 28 | 29 | 30 |
       
    79                        |----|----|----|----|----|----|
       
    80                   X3Ph | 31 | 32 | 33 | 34 | 35 | 36 |
       
    81                         -----------------------------
       
    82 
       
    83 X3Pl = low priority X3P
       
    84 X3Pm = medium priority X3P
       
    85 X3Ph = high priority X3P
       
    86 
       
    87 To retrieve a decision this class performs a table look-up according to the 
       
    88 current operation and new operation specified by the caller. The index is
       
    89 calculated using row and column values according to the operation types.
       
    90 Note: the table index equates to (UID value - 1)
       
    91 
       
    92 */
       
    93 NONSHARABLE_CLASS(CConfigManager) : public CBase
       
    94 	{
       
    95 public:
       
    96 
       
    97 	enum TConflictResult
       
    98 		{
       
    99 		EConflictNone,
       
   100 		EConflictRejectNew,
       
   101 		EConflictQueueNew,
       
   102 		EConflictCancelCurrent,
       
   103 		EConflictQueueCurrent
       
   104 		};
       
   105 
       
   106 	enum TConflictOp
       
   107 		{
       
   108 		EOpNone,
       
   109 		EOpMoLr, // MO-LR
       
   110 		EOpNbLr, // Net Based Loc
       
   111 		EOpMtLr, // MT-LR
       
   112 		EOpNiLr, // Net Induced
       
   113 		EOpX3p   // X3P
       
   114 		};
       
   115 
       
   116 	enum TConflictPriority
       
   117 		{
       
   118 		EPriorityNone,
       
   119 		EPriorityLow,
       
   120 		EPriorityMedium,
       
   121 		EPriorityHigh,
       
   122 		EPriorityEmergency
       
   123 		};
       
   124 
       
   125 	class TConflictOperation
       
   126 		{
       
   127 		public:
       
   128 		TConflictOp iOperation;
       
   129 		TConflictPriority iPriority;
       
   130 		};
       
   131 
       
   132 public:
       
   133 
       
   134 	static CConfigManager* NewL();
       
   135 	~CConfigManager();
       
   136 
       
   137 	TConflictResult ConflictDecision(const TConflictOperation& aCurrentOp, 
       
   138 										const TConflictOperation& aNewOp) const;
       
   139 
       
   140 private:
       
   141 
       
   142 	CConfigManager();
       
   143 	void ConstructL();
       
   144 	void LoadDecisionDataL();
       
   145 
       
   146 	TInt DecisionTableIndex(const TConflictOperation& aOperation) const;
       
   147 
       
   148 private:
       
   149 
       
   150 	RArray<TConflictResult> iDecisionTable;
       
   151 
       
   152 	};
       
   153 
       
   154 #endif // __CCONFIGMANAGER_H__