|
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: Monitor UUI messages. |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "csplogger.h" |
|
19 #include "cspuuimonitor.h" |
|
20 #include "mcspuusmessageobserver.h" |
|
21 |
|
22 // ======== MEMBER FUNCTIONS ======== |
|
23 |
|
24 // --------------------------------------------------------------------------- |
|
25 // Constructor |
|
26 // --------------------------------------------------------------------------- |
|
27 // |
|
28 CSPUUIMonitor::CSPUUIMonitor( |
|
29 RMobileCall& aCall, |
|
30 MCSPUUSMessageObserver& aUUIHandler ) |
|
31 : CActive( CActive::EPriorityStandard ), |
|
32 iCall( aCall ), |
|
33 iObserver( aUUIHandler ) |
|
34 { |
|
35 CActiveScheduler::Add( this ); |
|
36 } |
|
37 |
|
38 |
|
39 // --------------------------------------------------------------------------- |
|
40 // Second phase constructor |
|
41 // --------------------------------------------------------------------------- |
|
42 // |
|
43 void CSPUUIMonitor::ConstructL() |
|
44 { |
|
45 } |
|
46 |
|
47 // --------------------------------------------------------------------------- |
|
48 // Static constructor |
|
49 // --------------------------------------------------------------------------- |
|
50 // |
|
51 CSPUUIMonitor* CSPUUIMonitor::NewL( |
|
52 RMobileCall& aCall, |
|
53 MCSPUUSMessageObserver& aUUIHandler ) |
|
54 { |
|
55 CSPUUIMonitor* self = |
|
56 new( ELeave ) CSPUUIMonitor( aCall, aUUIHandler ); |
|
57 CleanupStack::PushL( self ); |
|
58 self->ConstructL(); |
|
59 CleanupStack::Pop( self ); |
|
60 return self; |
|
61 } |
|
62 |
|
63 // --------------------------------------------------------------------------- |
|
64 // Destructor |
|
65 // --------------------------------------------------------------------------- |
|
66 // |
|
67 CSPUUIMonitor::~CSPUUIMonitor() |
|
68 { |
|
69 Cancel(); |
|
70 } |
|
71 |
|
72 // --------------------------------------------------------------------------- |
|
73 // Starts monitoring the UUI messages. |
|
74 // --------------------------------------------------------------------------- |
|
75 // |
|
76 void CSPUUIMonitor::StartMonitor() |
|
77 { |
|
78 CSPLOGSTRING(CSPOBJECT, "CSPUUIMonitor::StartMonitor"); |
|
79 Cancel(); |
|
80 iCall.ReceiveUUI( iStatus, iUUI ); |
|
81 SetActive(); |
|
82 } |
|
83 |
|
84 // --------------------------------------------------------------------------- |
|
85 // From class CActive |
|
86 // Cancels out standign request |
|
87 // --------------------------------------------------------------------------- |
|
88 // |
|
89 void CSPUUIMonitor::DoCancel() |
|
90 { |
|
91 iCall.CancelAsyncRequest( EMobileCallReceiveUUI ) ; |
|
92 } |
|
93 |
|
94 // --------------------------------------------------------------------------- |
|
95 // From class CActive |
|
96 // Notifies observer. |
|
97 // --------------------------------------------------------------------------- |
|
98 // |
|
99 void CSPUUIMonitor::RunL() |
|
100 { |
|
101 CSPLOGSTRING2(CSPINT, "CSPUUIMonitor::RunL %d iStatus", iStatus.Int() ); |
|
102 if( iStatus == KErrNone ) |
|
103 { |
|
104 iObserver.UUSMessageReceived( iUUI ); |
|
105 StartMonitor(); |
|
106 } |
|
107 else if( iStatus != KErrNotSupported ) |
|
108 { |
|
109 StartMonitor(); |
|
110 } |
|
111 } |