|
1 /* |
|
2 * Copyright (c) 2004 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: Monitors call status. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef CVTCTLCALLSTATUSMONITOR_H |
|
21 #define CVTCTLCALLSTATUSMONITOR_H |
|
22 |
|
23 // INCLUDES |
|
24 |
|
25 #include "MVtCtlCallControl.h" |
|
26 #include <e32base.h> |
|
27 #include <etelmm.h> |
|
28 |
|
29 /** |
|
30 * Array for resolving call status (TMobileCallStatus) transition validity. |
|
31 * Transition to lower value is not possible with exception to 0 priority |
|
32 * (always possible to go to idle state). Initial state is EStatusUnknown. |
|
33 */ |
|
34 static const TInt KVtCtlStatusTransitionPriorities[] = |
|
35 { |
|
36 1, // EStatusUnknown |
|
37 0, // EStatusIdle, possible from any |
|
38 2, // EStatusDialling |
|
39 2, // EStatusRinging |
|
40 3, // EStatusAnswering |
|
41 3, // EStatusConnecting |
|
42 4, // EStatusConnected |
|
43 5, // EStatusDisconnecting |
|
44 // Status values below are not valid in video calls => should not happen. |
|
45 5, // EStatusDisconnectingWithInband |
|
46 0, // EStatusReconnectPending |
|
47 0, // EStatusHold |
|
48 0, // EStatusWaitingAlternatingCallSwitch |
|
49 0, // EStatusTransferring |
|
50 0 // EStatusTransferAlerting |
|
51 }; |
|
52 |
|
53 // FORWARD DECLARATIONS |
|
54 class MVtCtlCallStatusObserver; |
|
55 |
|
56 // CLASS DECLARATION |
|
57 |
|
58 /** |
|
59 * Monitor for call status |
|
60 * |
|
61 * @lib CSCallCtrl |
|
62 * @since 2.6 |
|
63 */ |
|
64 NONSHARABLE_CLASS( CVtCtlCallStatusMonitor ) : public CActive |
|
65 { |
|
66 public: // Constructors and destructor |
|
67 |
|
68 /** |
|
69 * C++ constructor. |
|
70 * @param aCall call subsession |
|
71 * @param aObserver call status observer |
|
72 */ |
|
73 /***************************************************** |
|
74 * Series 60 Customer / ETel |
|
75 * Series 60 ETel API |
|
76 *****************************************************/ |
|
77 CVtCtlCallStatusMonitor( |
|
78 RMobileCall& aCall, |
|
79 MVtCtlCallStatusObserver& aObserver ); |
|
80 |
|
81 /** |
|
82 * Destructor. |
|
83 */ |
|
84 virtual ~CVtCtlCallStatusMonitor(); |
|
85 |
|
86 public: // New functions |
|
87 |
|
88 /** |
|
89 * Starts monitoring |
|
90 */ |
|
91 void Start(); |
|
92 |
|
93 private: // From CActive |
|
94 |
|
95 /** |
|
96 * Cancel monitoring. |
|
97 */ |
|
98 virtual void DoCancel(); |
|
99 |
|
100 /** |
|
101 * Handles call status change. |
|
102 */ |
|
103 virtual void RunL(); |
|
104 |
|
105 /** |
|
106 * Handles leave in RunL. |
|
107 * @param aError error code |
|
108 * @return KErrNone |
|
109 */ |
|
110 virtual TInt RunError( TInt aError ); |
|
111 |
|
112 public: // New functions |
|
113 |
|
114 /** |
|
115 * Maps Etel status to internal state |
|
116 * @param aStatus mobile call status |
|
117 * @return session state, see TVtCtlState |
|
118 */ |
|
119 /***************************************************** |
|
120 * Series 60 Customer / ETel |
|
121 * Series 60 ETel API |
|
122 *****************************************************/ |
|
123 static MVtCtlCallControl::TVtCtlState MapState( |
|
124 const RMobileCall::TMobileCallStatus aStatus ); |
|
125 |
|
126 /** |
|
127 * Checks if call state transition specified by arguments is legal. |
|
128 * @param aNewState proposed new call state |
|
129 * @param aCurrentState current call state |
|
130 * @return ETrue if transition is valid |
|
131 */ |
|
132 static TBool IsLegalNewState( |
|
133 const RMobileCall::TMobileCallStatus aNewState, |
|
134 const RMobileCall::TMobileCallStatus aCurrentState ); |
|
135 |
|
136 private: // Data |
|
137 |
|
138 // Data call |
|
139 /***************************************************** |
|
140 * Series 60 Customer / ETel |
|
141 * Series 60 ETel API |
|
142 *****************************************************/ |
|
143 RMobileCall& iCall; |
|
144 |
|
145 // Observer for call status changes |
|
146 MVtCtlCallStatusObserver& iObserver; |
|
147 |
|
148 // Call status and previous status |
|
149 /***************************************************** |
|
150 * Series 60 Customer / ETel |
|
151 * Series 60 ETel API |
|
152 *****************************************************/ |
|
153 RMobileCall::TMobileCallStatus iCallStatus; |
|
154 RMobileCall::TMobileCallStatus iPreviousStatus; |
|
155 }; |
|
156 |
|
157 #endif // CVTCTLCALLSTATUSMONITOR_H |
|
158 |
|
159 // End of File |