|
1 /* |
|
2 * Copyright (c) 2009 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 //head files for symbian |
|
19 #include <e32def.h> |
|
20 #include <e32std.h> |
|
21 #include <eikdef.h> |
|
22 #include <ctsydomainpskeys.h> |
|
23 |
|
24 //private head files |
|
25 #include "irsystemeventobserverinterface.h" |
|
26 #include "irpropertyobserver.h" |
|
27 #include "irpropertychangeao.h" |
|
28 #include "irqlogger.h" |
|
29 |
|
30 |
|
31 CIRPropertyObserver::CIRPropertyObserver(MIRPropertyObserverInterface* aObserver) : |
|
32 iCallStatusObserver(NULL),iIsCallActive(EFalse),iPropertyObserver(aObserver) |
|
33 { |
|
34 LOG_METHOD; |
|
35 Q_ASSERT(aObserver!=NULL); |
|
36 } |
|
37 |
|
38 void CIRPropertyObserver::ConstructL() |
|
39 { |
|
40 LOG_METHOD; |
|
41 |
|
42 TInt callStatus = 0 ; |
|
43 TBool sucess = EFalse; |
|
44 |
|
45 iCallStatusObserver = CIRPropertyChangeAO::NewL(this, KPSUidCtsyCallInformation, KCTsyCallState); |
|
46 iCallStatusObserver->ActivateL(); |
|
47 |
|
48 sucess = iCallStatusObserver->ValueInt(callStatus); |
|
49 if( sucess ) |
|
50 { |
|
51 iIsCallActive = ( callStatus > EPSCTsyCallStateNone ); |
|
52 } |
|
53 else |
|
54 { |
|
55 iIsCallActive = EFalse; |
|
56 } |
|
57 } |
|
58 |
|
59 CIRPropertyObserver::~CIRPropertyObserver() |
|
60 { |
|
61 delete iCallStatusObserver; |
|
62 iCallStatusObserver = NULL; |
|
63 } |
|
64 |
|
65 |
|
66 CIRPropertyObserver* CIRPropertyObserver::NewL(MIRPropertyObserverInterface* aObserver) |
|
67 { |
|
68 LOG_METHOD; |
|
69 CIRPropertyObserver* self = NewLC(aObserver); |
|
70 CleanupStack::Pop(self); |
|
71 return self; |
|
72 } |
|
73 |
|
74 CIRPropertyObserver* CIRPropertyObserver::NewLC(MIRPropertyObserverInterface* aObserver) |
|
75 { |
|
76 CIRPropertyObserver* self = new (ELeave) CIRPropertyObserver(aObserver); |
|
77 CleanupStack::PushL(self); |
|
78 self->ConstructL(); |
|
79 return self; |
|
80 } |
|
81 |
|
82 TBool CIRPropertyObserver::IsCallActive() const |
|
83 { |
|
84 return iIsCallActive; |
|
85 } |
|
86 |
|
87 void CIRPropertyObserver::HandlePropertyChangeL(const TUid& aCategory, |
|
88 const TUint aKey, const TInt aValue) |
|
89 { |
|
90 LOG_FORMAT( "HandlePropertyChangeL_ENTRY. aKey = %d, aValue = %d", aKey, aValue); |
|
91 if (aCategory == KPSUidCtsyCallInformation && aKey == KCTsyCallState) |
|
92 { |
|
93 if ((!iIsCallActive) && (aValue > EPSCTsyCallStateNone)) |
|
94 { |
|
95 iIsCallActive = ETrue; |
|
96 iPropertyObserver->callIsActivated(); |
|
97 } |
|
98 else if ((iIsCallActive) && (aValue <= EPSCTsyCallStateNone)) |
|
99 { |
|
100 iIsCallActive = EFalse; |
|
101 iPropertyObserver->callIsDeactivated(); |
|
102 } |
|
103 } |
|
104 } |
|
105 |
|
106 void CIRPropertyObserver::HandlePropertyChangeErrorL(const TUid& aCategory, |
|
107 const TUint aKey, const TInt aError) |
|
108 { |
|
109 LOG_METHOD; |
|
110 Q_UNUSED(aCategory); |
|
111 Q_UNUSED(aKey); |
|
112 iPropertyObserver->errorCallback(aError); |
|
113 } |