|
1 // Copyright (c) 2008-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 provides the implementation of the class that manages |
|
15 // conflict control of SUPL Protocol Module. |
|
16 // |
|
17 // |
|
18 |
|
19 /** |
|
20 @file |
|
21 @internalTechnology |
|
22 @deprecated |
|
23 */ |
|
24 |
|
25 |
|
26 #include <centralrepository.h> |
|
27 #include "suplconflictmanager.h" |
|
28 #include "supldevloggermacros.h" |
|
29 |
|
30 /** Static constructor. |
|
31 @return A new instance of the CSuplConflictManager class |
|
32 */ |
|
33 CSuplConflictManager* CSuplConflictManager::NewL() |
|
34 { |
|
35 SUPLLOG(ELogP1, "CSuplConflictManager::NewL() Begin\n"); |
|
36 CSuplConflictManager* self = new (ELeave) CSuplConflictManager(); |
|
37 CleanupStack::PushL(self); |
|
38 self->ConstructL(); |
|
39 SUPLLOG(ELogP1, "CSuplConflictManager::NewL() End\n"); |
|
40 CleanupStack::Pop(self); |
|
41 return self; |
|
42 } |
|
43 |
|
44 |
|
45 /** Standard constructor. |
|
46 */ |
|
47 CSuplConflictManager::CSuplConflictManager() |
|
48 { |
|
49 SUPLLOG(ELogP1, "CSuplConflictManager::CSuplConflictManager() Begin\n"); |
|
50 SUPLLOG(ELogP1, "CSuplConflictManager::CSuplConflictManager() End\n"); |
|
51 } |
|
52 |
|
53 |
|
54 /** Standard destructor. |
|
55 */ |
|
56 CSuplConflictManager::~CSuplConflictManager() |
|
57 { |
|
58 SUPLLOG(ELogP1, "CSuplConflictManager::~CSuplConflictManager() Begin\n"); |
|
59 iDecisionTable.Close(); |
|
60 SUPLLOG(ELogP1, "CSuplConflictManager::~CSuplConflictManager() End\n"); |
|
61 } |
|
62 |
|
63 |
|
64 /** Private second-stage constructor. |
|
65 */ |
|
66 void CSuplConflictManager::ConstructL() |
|
67 { |
|
68 SUPLLOG(ELogP1, "CSuplConflictManager::ConstructL() Begin\n"); |
|
69 SUPLLOG(ELogP1, "CSuplConflictManager::ConstructL() End\n"); |
|
70 } |
|
71 |
|
72 |
|
73 /** Get conflict decision. |
|
74 Generates a conflict decision based on the nature of a current operation, |
|
75 and the nature of a new operation. |
|
76 |
|
77 The conflict rules are as follow: |
|
78 |
|
79 - Only procedure, either MO-LR or MT-LR is allowed to be active at a time. |
|
80 - A new SUPL INIT is ignored and discarded if either MO-LR or MT-LR are in progress. |
|
81 - SelfLocateRequest when MT-LR is in progress terminates MT-LR and starts MO-LR. |
|
82 - SelfLocateRequest(sessId2) when MO-LR (sessId1) is in progress, the second request is rejected |
|
83 |
|
84 @param aActiveServiceMask Services currently in progress in the Protocol Module (MoLr, MtLr,...) |
|
85 @param aNewOperation The new service for which a decision is required |
|
86 @param aNewOperationOptions Options about aNewOperation that affect the conflict decision (mode, new client,...) |
|
87 @param aIsAssistanceDataNeeded Boolean that is 'true' when the new service needs assistance data from the network. |
|
88 @return TConflictDecision The conflict decision: |
|
89 |
|
90 EConflictNone - This implies there is no current operation |
|
91 and the new operation is simply started |
|
92 EConflictRejectNew - The new operation is rejected and any |
|
93 current operation proceeds unaffected |
|
94 EConflictCancelCurrent - The current operation is cancelled and |
|
95 the new operation is started |
|
96 EConflictAdoptNewSessionId - The current self location operation proceeds |
|
97 but it adopts the session Id of the new operation. |
|
98 */ |
|
99 CSuplConflictManager::TConflictResult CSuplConflictManager::ConflictDecision(const MLbsNetworkProtocolObserver::TLbsNetProtocolServiceMask& aActiveServiceMask, |
|
100 const MLbsNetworkProtocolObserver::TLbsNetProtocolService& aNewOperation, |
|
101 const TLbsNetPosRequestOptionsBase& /*aNewOperationOptions*/) const |
|
102 { |
|
103 SUPLLOG(ELogP1, "CSuplConflictManager::ConflictDecision() Begin\n"); |
|
104 |
|
105 TConflictResult result = EConflictNone; |
|
106 |
|
107 switch (aNewOperation) |
|
108 { |
|
109 case MLbsNetworkProtocolObserver::EServiceMobileTerminated: |
|
110 // reject new MTLR request if any other procedure is in progress |
|
111 if (MLbsNetworkProtocolObserver::EServiceNone != aActiveServiceMask) |
|
112 result = EConflictRejectNew; |
|
113 break; |
|
114 |
|
115 case MLbsNetworkProtocolObserver::EServiceNetworkLocation: |
|
116 case MLbsNetworkProtocolObserver::EServiceSelfLocation: |
|
117 if (aNewOperation & aActiveServiceMask) |
|
118 { |
|
119 // Reject the new session. |
|
120 result = EConflictRejectNew; |
|
121 } |
|
122 else if (MLbsNetworkProtocolObserver::EServiceMobileTerminated & aActiveServiceMask) |
|
123 { |
|
124 // terminate the MTLR before starting the new procedure |
|
125 result = EConflictCancelCurrent; |
|
126 } |
|
127 } |
|
128 |
|
129 SUPLLOG(ELogP1, "CSuplConflictManager::ConflictDecision() End\n"); |
|
130 return result; |
|
131 } |