|
1 /* |
|
2 * Copyright (c) 2007 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: Implements the class CSPEtelIncomingCallMonitor |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "cspetelincomingcallmonitor.h" |
|
20 #include "csplogger.h" |
|
21 #include "cspcall.h" |
|
22 #include "cspconsts.h" |
|
23 |
|
24 |
|
25 // --------------------------------------------------------------------------- |
|
26 // CSPEtelIncomingCallMonitor::NewL. |
|
27 // --------------------------------------------------------------------------- |
|
28 // |
|
29 CSPEtelIncomingCallMonitor* CSPEtelIncomingCallMonitor::NewL( |
|
30 MCSPIncomingCallObserver& aObserver, |
|
31 RMobileLine& aLine, |
|
32 RCSPLineContainer::TCSPLineId aLineId ) |
|
33 { |
|
34 CSPLOGSTRING(CSPOBJECT, "CSPEtelIncomingCallMonitor::NewL <"); |
|
35 CSPEtelIncomingCallMonitor* self = new ( ELeave ) CSPEtelIncomingCallMonitor( |
|
36 aObserver, aLine, aLineId ); |
|
37 CSPLOGSTRING(CSPOBJECT, "CSPEtelIncomingCallMonitor::NewL >"); |
|
38 return self; |
|
39 } |
|
40 |
|
41 // --------------------------------------------------------------------------- |
|
42 // Destructs the object by canceling first ongoing monitoring. |
|
43 // --------------------------------------------------------------------------- |
|
44 // |
|
45 CSPEtelIncomingCallMonitor::~CSPEtelIncomingCallMonitor( ) |
|
46 { |
|
47 CSPLOGSTRING(CSPOBJECT, |
|
48 "CSPEtelIncomingCallMonitor::~CSPEtelIncomingCallMonitor" ); |
|
49 Cancel(); |
|
50 } |
|
51 |
|
52 // --------------------------------------------------------------------------- |
|
53 // Starts the monitor. |
|
54 // --------------------------------------------------------------------------- |
|
55 // |
|
56 void CSPEtelIncomingCallMonitor::StartMonitoring() |
|
57 { |
|
58 CSPLOGSTRING(CSPINT, "CSPEtelIncomingCallMonitor::StartMonitoring"); |
|
59 |
|
60 if ( !IsActive() ) |
|
61 { |
|
62 CSPLOGSTRING( CSPINT, |
|
63 "CSPEtelIncomingCallMonitor::StartMonitoring NotifyIncomingCall"); |
|
64 iCallName.Zero(); |
|
65 iLine.NotifyIncomingCall( iStatus, iCallName ); |
|
66 SetActive(); |
|
67 } |
|
68 else |
|
69 { |
|
70 CSPLOGSTRING( CSPERROR, |
|
71 "CSPEtelIncomingCallMonitor::StartMonitoring Error already active"); |
|
72 } |
|
73 } |
|
74 // --------------------------------------------------------------------------- |
|
75 // From CActive. |
|
76 // Handles line status change notifying. |
|
77 // --------------------------------------------------------------------------- |
|
78 // |
|
79 void CSPEtelIncomingCallMonitor::RunL() |
|
80 { |
|
81 CSPLOGSTRING(CSPINT, "CSPEtelIncomingCallMonitor::RunL <") |
|
82 |
|
83 if ( iStatus == KErrNone ) |
|
84 { |
|
85 iIncomingCallObserver.IncomingCallArrived( iLine, iCallName, |
|
86 iLineId ); |
|
87 // Continue monitoring |
|
88 StartMonitoring(); |
|
89 } |
|
90 else |
|
91 { |
|
92 CSPLOGSTRING2( CSPERROR, "CSPEtelIncomingCallMonitor::RunL: Error \ |
|
93 from RMobileLine: %d", iStatus.Int() ); |
|
94 } |
|
95 |
|
96 CSPLOGSTRING(CSPREQEND, "CSPEtelIncomingCallMonitor::RunL >"); |
|
97 } |
|
98 |
|
99 // --------------------------------------------------------------------------- |
|
100 // From CActive |
|
101 // Canceling functionality. |
|
102 // --------------------------------------------------------------------------- |
|
103 // |
|
104 void CSPEtelIncomingCallMonitor::DoCancel() |
|
105 { |
|
106 CSPLOGSTRING( CSPINT, "CSPEtelIncomingCallMonitor::DoCancel" ); |
|
107 |
|
108 if ( iStatus == KRequestPending ) |
|
109 { |
|
110 CSPLOGSTRING( CSPINT, |
|
111 "CSPEtelIncomingCallMonitor::DoCancel Canceling pending request.." ); |
|
112 iLine.NotifyIncomingCallCancel(); |
|
113 } |
|
114 } |
|
115 |
|
116 // --------------------------------------------------------------------------- |
|
117 // Constructs the monitor. |
|
118 // --------------------------------------------------------------------------- |
|
119 // |
|
120 CSPEtelIncomingCallMonitor::CSPEtelIncomingCallMonitor( |
|
121 MCSPIncomingCallObserver& aObserver, |
|
122 RMobileLine& aLine, |
|
123 RCSPLineContainer::TCSPLineId aLineId ) : |
|
124 CActive( EPriorityStandard + 2 ), |
|
125 iIncomingCallObserver( aObserver ), |
|
126 iLine( aLine ), |
|
127 iLineId( aLineId ) |
|
128 { |
|
129 CSPLOGSTRING(CSPOBJECT, |
|
130 "CSPEtelIncomingCallMonitor::CSPEtelIncomingCallMonitor" ); |
|
131 CActiveScheduler::Add( this ); |
|
132 } |
|
133 |
|
134 // End of File |