|
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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include <ctsydomainpskeys.h> |
|
21 |
|
22 #include "vuiccalldetector.h" |
|
23 #include "vuimcalldetectorobserver.h" |
|
24 |
|
25 #include "rubydebug.h" |
|
26 |
|
27 // --------------------------------------------------------------------------- |
|
28 // CCallDetector::NewL |
|
29 // |
|
30 // --------------------------------------------------------------------------- |
|
31 // |
|
32 CCallDetector* CCallDetector::NewL( MCallDetectorObserver* aObserver ) |
|
33 { |
|
34 RUBY_DEBUG_BLOCK( "CCallDetector::NewL" ); |
|
35 |
|
36 CCallDetector* self = new( ELeave ) CCallDetector( aObserver ); |
|
37 CleanupStack::PushL( self ); |
|
38 self->ConstructL(); |
|
39 CleanupStack::Pop( self ); |
|
40 return self; |
|
41 } |
|
42 |
|
43 // --------------------------------------------------------------------------- |
|
44 // Destructor |
|
45 // |
|
46 // --------------------------------------------------------------------------- |
|
47 // |
|
48 CCallDetector::~CCallDetector() |
|
49 { |
|
50 RUBY_DEBUG0( "CCallDetector::~CCallDetector" ); |
|
51 |
|
52 Cancel(); |
|
53 iTsyProperty.Close(); |
|
54 } |
|
55 |
|
56 // --------------------------------------------------------------------------- |
|
57 // CCallDetector::RequestNotification |
|
58 // |
|
59 // --------------------------------------------------------------------------- |
|
60 // |
|
61 void CCallDetector::RequestNotification() |
|
62 { |
|
63 RUBY_DEBUG0( "CCallDetector::RequestNotification" ); |
|
64 |
|
65 iTsyProperty.Subscribe( iStatus ); |
|
66 SetActive(); |
|
67 } |
|
68 |
|
69 // --------------------------------------------------------------------------- |
|
70 // Constructor |
|
71 // |
|
72 // --------------------------------------------------------------------------- |
|
73 // |
|
74 CCallDetector::CCallDetector( MCallDetectorObserver* aObserver ) |
|
75 : CActive( EPriorityStandard ), iObserver( aObserver ) |
|
76 { |
|
77 } |
|
78 |
|
79 // --------------------------------------------------------------------------- |
|
80 // CCallDetector::ConstructL |
|
81 // |
|
82 // --------------------------------------------------------------------------- |
|
83 // |
|
84 void CCallDetector::ConstructL() |
|
85 { |
|
86 User::LeaveIfError( iTsyProperty.Attach( KPSUidCtsyCallInformation, KCTsyCallState ) ); |
|
87 CActiveScheduler::Add( this ); |
|
88 } |
|
89 |
|
90 // --------------------------------------------------------------------------- |
|
91 // CCallDetector::RunL |
|
92 // Called when the voice line status changes. |
|
93 // --------------------------------------------------------------------------- |
|
94 // |
|
95 void CCallDetector::RunL() |
|
96 { |
|
97 TInt status = iStatus.Int(); |
|
98 |
|
99 RequestNotification(); |
|
100 |
|
101 if ( status == KErrNone ) |
|
102 { |
|
103 TInt status; |
|
104 iTsyProperty.Get( status ); |
|
105 |
|
106 if ( status != EPSCTsyCallStateNone ) |
|
107 { |
|
108 iObserver->CallDetectedL(); |
|
109 } |
|
110 } |
|
111 } |
|
112 |
|
113 // --------------------------------------------------------------------------- |
|
114 // CCallDetector::DoCancel |
|
115 // |
|
116 // --------------------------------------------------------------------------- |
|
117 // |
|
118 void CCallDetector::DoCancel() |
|
119 { |
|
120 RUBY_DEBUG0( "CCallDetector::DoCancel" ); |
|
121 |
|
122 iTsyProperty.Cancel(); |
|
123 } |
|
124 |
|
125 // End of File |
|
126 |