|
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: Defines class CNcnPublishAndSubscribeObserver. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef NCNPUBLISHANDSUBSCRIBEOBSERVER_H |
|
21 #define NCNPUBLISHANDSUBSCRIBEOBSERVER_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32base.h> |
|
25 #include <e32property.h> |
|
26 #include "NcnSubscribeHandler.h" |
|
27 |
|
28 // CLASS DECLARATION |
|
29 class CNcnModelBase; |
|
30 class CNcnSubscriber; |
|
31 |
|
32 /** |
|
33 * Listens to the Phone idle status and other Properties |
|
34 * through the Publish and Subscribe session. |
|
35 */ |
|
36 class CNcnPublishAndSubscribeObserver : public CBase, public MNcnSubscribeHandler |
|
37 { |
|
38 public: // Constructors and destructor |
|
39 |
|
40 /** |
|
41 * C++ default constructor. |
|
42 */ |
|
43 CNcnPublishAndSubscribeObserver( CNcnModelBase* aModel ); |
|
44 |
|
45 /** |
|
46 * Two-phased constructor. |
|
47 */ |
|
48 static CNcnPublishAndSubscribeObserver* NewL( CNcnModelBase* aModel ); |
|
49 |
|
50 /** |
|
51 * Destructor. |
|
52 */ |
|
53 virtual ~CNcnPublishAndSubscribeObserver(); |
|
54 |
|
55 public: |
|
56 |
|
57 /* |
|
58 * Through this Publish and Subscribe is notified about state changes. |
|
59 * @param aCategory Property category. |
|
60 * @param aVariable The Property to be set |
|
61 * @param aState The value to be set for the aVariable Property |
|
62 */ |
|
63 void NotifyPublishAndSubscribe( const TUid& aCategory, TUint aVariable, const TInt aState ); |
|
64 |
|
65 public: //from base classes |
|
66 |
|
67 /** |
|
68 * Through this method the Property subscribers notify of Property changes |
|
69 * @param aCategory The category of the property to be observed |
|
70 * @param aKey The subkey of the property to be observed |
|
71 */ |
|
72 void HandlePropertyChangedL( const TUid& aCategory, TInt aKey ); |
|
73 |
|
74 private: |
|
75 |
|
76 /** |
|
77 * By default Symbian OS constructor is private. |
|
78 */ |
|
79 void ConstructL(); |
|
80 |
|
81 // By default, prohibit copy constructor |
|
82 CNcnPublishAndSubscribeObserver( const CNcnPublishAndSubscribeObserver& ); |
|
83 // Prohibit assigment operator |
|
84 CNcnPublishAndSubscribeObserver& operator= ( const CNcnPublishAndSubscribeObserver& ); |
|
85 |
|
86 /** |
|
87 * Determine idle state. |
|
88 * Reads iAutolockStatus, iCurrentCallStatus and iPhoneIdleState and informs |
|
89 * model about the idle status |
|
90 */ |
|
91 void DetermineIdleState(); |
|
92 |
|
93 private: // Data |
|
94 |
|
95 // Property subscribers |
|
96 CNcnSubscriber* iSimChangedSubscriber; |
|
97 CNcnSubscriber* iPhoneIdleSubscriber; |
|
98 CNcnSubscriber* iAutolockSubscriber; |
|
99 CNcnSubscriber* iCurrentCallSubscriber; |
|
100 CNcnSubscriber* iSimUsableSubscriber; |
|
101 |
|
102 // A pointer to the event monitor. |
|
103 CNcnModelBase* iModel; |
|
104 |
|
105 // Stores the phone idle state status |
|
106 TInt iPhoneIdleState; |
|
107 |
|
108 // Stores the autolock status |
|
109 TInt iAutolockStatus; |
|
110 |
|
111 // Stores the current call status |
|
112 TInt iCurrentCallStatus; |
|
113 }; |
|
114 |
|
115 #endif // NCNPUBLISHANDSUBSCRIBEOBSERVER_H |
|
116 |
|
117 // End of File |