|
1 // Copyright (c) 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 contains CLtsyCallInformationManager which manager call information |
|
15 // |
|
16 |
|
17 //system include |
|
18 |
|
19 //user include |
|
20 #include "ltsycallinformationmanager.h" |
|
21 #include "ltsycommondefine.h" |
|
22 #include "athangupcommandrecords.h" |
|
23 #include "mslogger.h" |
|
24 |
|
25 CLtsyCallInformationManager* CLtsyCallInformationManager::NewL() |
|
26 { |
|
27 LOGTEXT(_L8("[Ltsy CallControl] Starting CLtsyCallInformationManager::NewL()")); |
|
28 |
|
29 CLtsyCallInformationManager* self = CLtsyCallInformationManager::NewLC(); |
|
30 CleanupStack::Pop(self); |
|
31 return self; |
|
32 } |
|
33 |
|
34 CLtsyCallInformationManager* CLtsyCallInformationManager::NewLC() |
|
35 { |
|
36 LOGTEXT(_L8("[Ltsy CallControl] Starting CLtsyCallInformationManager::NewLC()")); |
|
37 |
|
38 CLtsyCallInformationManager* self = new (ELeave) CLtsyCallInformationManager; |
|
39 CleanupStack::PushL(self); |
|
40 self->ConstructL(); |
|
41 return self; |
|
42 } |
|
43 |
|
44 CLtsyCallInformationManager::~CLtsyCallInformationManager() |
|
45 { |
|
46 LOGTEXT(_L8("[Ltsy CallControl] Starting CLtsyCallInformationManager::~CLtsyCallInformationManager()")); |
|
47 |
|
48 delete iHangupCommandRecords; |
|
49 } |
|
50 |
|
51 CLtsyCallInformationManager::CLtsyCallInformationManager() |
|
52 { |
|
53 LOGTEXT(_L8("[Ltsy CallControl] Starting CLtsyCallInformationManager::CLtsyCallInformationManager()")); |
|
54 //Init call id |
|
55 iCallInfo[1].SetCallId(1); |
|
56 iCallInfo[2].SetCallId(2); |
|
57 iCallInfo[3].SetCallId(3); |
|
58 iCallInfo[4].SetCallId(4); |
|
59 iCallInfo[5].SetCallId(5); |
|
60 iCallInfo[6].SetCallId(6); |
|
61 iCallInfo[7].SetCallId(7); |
|
62 |
|
63 //Init incoming call flag |
|
64 iIncomingCallFlag = EFalse; |
|
65 } |
|
66 |
|
67 void CLtsyCallInformationManager::ConstructL() |
|
68 { |
|
69 LOGTEXT(_L8("[Ltsy CallControl] Starting CLtsyCallInformationManager::ConstructL()")); |
|
70 |
|
71 //Create hang up call command records |
|
72 iHangupCommandRecords = CATHangupCommandRecords::NewL(); |
|
73 } |
|
74 |
|
75 void CLtsyCallInformationManager::ResetCallInformationByCallId(TInt aCallId) |
|
76 { |
|
77 LOGTEXT(_L8("[Ltsy CallControl] Starting CLtsyCallInformationManager::ResetCallInformationByCallId()")); |
|
78 |
|
79 ASSERT((aCallId >= KLtsyMinCallId) && (aCallId <= KLtsyMaxCallId)); |
|
80 |
|
81 iCallInfo[aCallId].SetCallIdIsUsedInfo(TLtsyCallInformation::ENotUsed); |
|
82 iCallInfo[aCallId].SetCallDirection(TLtsyCallInformation::EUnknownDirection); |
|
83 iCallInfo[aCallId].SetCallState(TLtsyCallInformation::EUnknownState); |
|
84 iCallInfo[aCallId].SetCallMode(TLtsyCallInformation::EUnKnowCall); |
|
85 iCallInfo[aCallId].SetConferenceCall(TLtsyCallInformation::EUnknownIsConference); |
|
86 iCallInfo[aCallId].SetMobileTelNum(KNullDesC8); |
|
87 iCallInfo[aCallId].SetAddressType(-1); |
|
88 iCallInfo[aCallId].SetMobileName(KNullDesC8); |
|
89 iCallInfo[aCallId].SetEmergencyCallFlag(EFalse); |
|
90 } |
|
91 |
|
92 void CLtsyCallInformationManager::ResetAllCalInformation() |
|
93 { |
|
94 LOGTEXT(_L8("[Ltsy CallControl] Starting CLtsyCallInformationManager::ResetAllCalInformation()")); |
|
95 |
|
96 for (TInt n = KLtsyMinCallId; n <= KLtsyMaxCallId; n++) |
|
97 { |
|
98 ResetCallInformationByCallId(n); |
|
99 } |
|
100 } |
|
101 |
|
102 TLtsyCallInformation& CLtsyCallInformationManager::GetCallInformationByCallId(TInt aCallId) |
|
103 { |
|
104 LOGTEXT(_L8("[Ltsy CallControl] Starting CLtsyCallInformationManager::GetCallInformationByCallId()")); |
|
105 |
|
106 ASSERT((aCallId >= KLtsyMinCallId) && (aCallId <= KLtsyMaxCallId)); |
|
107 |
|
108 return iCallInfo[aCallId]; |
|
109 } |
|
110 |
|
111 TInt CLtsyCallInformationManager::FindUnUesedCallId() const |
|
112 { |
|
113 LOGTEXT(_L8("[Ltsy CallControl] Starting CLtsyCallInformationManager::FindUnUesedCallId()")); |
|
114 |
|
115 for (TInt n = KLtsyMinCallId; n <= KLtsyMaxCallId; n++) |
|
116 { |
|
117 if (iCallInfo[n].GetCallIdIsUsedInfo() == TLtsyCallInformation::ENotUsed) |
|
118 { |
|
119 return n; |
|
120 } |
|
121 } |
|
122 return KErrNotFound; |
|
123 } |
|
124 |
|
125 TBool CLtsyCallInformationManager::IsHaveUsedCallId() const |
|
126 { |
|
127 LOGTEXT(_L8("[Ltsy CallControl] Starting CLtsyCallInformationManager::FindIsHaveUsedCallId()")); |
|
128 |
|
129 for (TInt n = KLtsyMinCallId; n <= KLtsyMaxCallId; n++) |
|
130 { |
|
131 if (iCallInfo[n].GetCallIdIsUsedInfo() == TLtsyCallInformation::EUsed) |
|
132 { |
|
133 return ETrue; |
|
134 } |
|
135 } |
|
136 return EFalse; |
|
137 } |
|
138 |
|
139 void CLtsyCallInformationManager::SetIncomingCallFlag(TBool aIncomingCallFlag) |
|
140 { |
|
141 iIncomingCallFlag = aIncomingCallFlag; |
|
142 } |
|
143 |
|
144 TBool CLtsyCallInformationManager::GetIncomingCallFlag() const |
|
145 { |
|
146 return iIncomingCallFlag; |
|
147 } |
|
148 |
|
149 TInt CLtsyCallInformationManager::FindIncomingCallId() const |
|
150 { |
|
151 for (TInt n = KLtsyMinCallId; n <= KLtsyMaxCallId; n++) |
|
152 { |
|
153 if (iCallInfo[n].GetCallIdIsUsedInfo() == TLtsyCallInformation::EUsed && |
|
154 iCallInfo[n].GetCallState() == TLtsyCallInformation::EInComingCall) |
|
155 { |
|
156 return n; |
|
157 } |
|
158 } |
|
159 return KErrNotFound; |
|
160 } |
|
161 |
|
162 TInt CLtsyCallInformationManager::FindEmergencyCallId() const |
|
163 { |
|
164 for (TInt n = KLtsyMinCallId; n <= KLtsyMaxCallId; n++) |
|
165 { |
|
166 if ((iCallInfo[n].GetCallIdIsUsedInfo() == TLtsyCallInformation::EUsed) && |
|
167 iCallInfo[n].GetEmergencyCallFlag()) |
|
168 { |
|
169 return n; |
|
170 } |
|
171 } |
|
172 return KErrNotFound; |
|
173 } |
|
174 |
|
175 TInt CLtsyCallInformationManager::FindDialingOrAlertingCallId() const |
|
176 { |
|
177 for (TInt n = KLtsyMinCallId; n <= KLtsyMaxCallId; n++) |
|
178 { |
|
179 if (iCallInfo[n].GetCallIdIsUsedInfo() == TLtsyCallInformation::EUsed && |
|
180 ((iCallInfo[n].GetCallState() == TLtsyCallInformation::EDialingCall) || |
|
181 (iCallInfo[n].GetCallState() == TLtsyCallInformation::EAlertingCall))) |
|
182 { |
|
183 return n; |
|
184 } |
|
185 } |
|
186 return KErrNotFound; |
|
187 } |
|
188 |
|
189 TInt CLtsyCallInformationManager::FindWaitingCallId() const |
|
190 { |
|
191 for (TInt n = KLtsyMinCallId; n <= KLtsyMaxCallId; n++) |
|
192 { |
|
193 if (iCallInfo[n].GetCallIdIsUsedInfo() == TLtsyCallInformation::EUsed && |
|
194 iCallInfo[n].GetCallState() == TLtsyCallInformation::EWaitingCall) |
|
195 { |
|
196 return n; |
|
197 } |
|
198 } |
|
199 return KErrNotFound; |
|
200 } |
|
201 |
|
202 // --------------------------------------------------------------------------- |
|
203 // CLtsyCallInformationManager::GetHangupCommandRecords |
|
204 // other items were commented in a header |
|
205 // --------------------------------------------------------------------------- |
|
206 CATHangupCommandRecords& CLtsyCallInformationManager::GetHangupCommandRecords() |
|
207 { |
|
208 return (*iHangupCommandRecords); |
|
209 } |
|
210 |
|
211 //End of file |