|
1 /* |
|
2 * Copyright (c) 2005-2006 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: This is client interface class for chared objects MusAvailability Plug-in |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // USER |
|
21 #include "musunittesting.h" |
|
22 #include "musavasharedobject.h" |
|
23 #include "musavasip.h" |
|
24 #include "musavasipobserver.h" |
|
25 #include "musavaconnectionmonitor.h" |
|
26 #include "musavanetworkregistrationstatus.h" |
|
27 #include "musavanetworkmodestatus.h" |
|
28 #include "muslogger.h" |
|
29 #include "musavailabilityplugin.hrh" |
|
30 |
|
31 // SYSTEM |
|
32 #include <e32base.h> |
|
33 #include <sip.h> |
|
34 |
|
35 CMusAvaSharedObject* CMusAvaSharedObject::iSelf = 0; |
|
36 TInt CMusAvaSharedObject::iSelfCounter = 0; |
|
37 |
|
38 // ----------------------------------------------------------------------------- |
|
39 // Delete singleton object |
|
40 // ----------------------------------------------------------------------------- |
|
41 // |
|
42 void CMusAvaSharedObject::DeleteSingleton() |
|
43 { |
|
44 MUS_LOG( "mus: [MUSAVA] -> CMusAvaSharedObject::DeleteSingleton" ) |
|
45 iSelfCounter--; |
|
46 if( !iSelfCounter ) |
|
47 { |
|
48 delete iSelf; |
|
49 iSelf = NULL; |
|
50 } |
|
51 MUS_LOG1( "mus: [MUSAVA] <- CMusAvaSharedObject::DeleteSingleton count=%d",\ |
|
52 iSelfCounter ) |
|
53 } |
|
54 |
|
55 // ----------------------------------------------------------------------------- |
|
56 // Returns singleton object |
|
57 // ----------------------------------------------------------------------------- |
|
58 // |
|
59 CMusAvaSharedObject* CMusAvaSharedObject::GetSingletonL() |
|
60 { |
|
61 MUS_LOG( "mus: [MUSAVA] -> CMusAvaSharedObject::GetSingletonL" ) |
|
62 if(!iSelf) |
|
63 { |
|
64 iSelf = CMusAvaSharedObject::NewL(); |
|
65 MUS_LOG1( "mus: [MUSAVA] <- CMusAvaSharedObject::GetSingletonL\ |
|
66 count=%d",iSelfCounter ) |
|
67 } |
|
68 else |
|
69 { |
|
70 MUS_LOG1( "mus: [MUSAVA] <- CMusAvaSharedObject::GetSingletonL\ |
|
71 count=%d",iSelfCounter ) |
|
72 } |
|
73 iSelfCounter++; |
|
74 return iSelf; |
|
75 } |
|
76 |
|
77 // ----------------------------------------------------------------------------- |
|
78 // Two-phased constructor. |
|
79 // ------------------------------------------------------------------------- |
|
80 // |
|
81 CMusAvaSharedObject* CMusAvaSharedObject::NewL( ) |
|
82 { |
|
83 MUS_LOG( "mus: [MUSAVA] -> CMusAvaSharedObject::NewL" ) |
|
84 CMusAvaSharedObject* self = new (ELeave) CMusAvaSharedObject; |
|
85 CleanupStack::PushL (self); |
|
86 self->ConstructL(); |
|
87 CleanupStack::Pop( self ); |
|
88 MUS_LOG( "mus: [MUSAVA] <- CMusAvaSharedObject::NewL" ) |
|
89 return self; |
|
90 } |
|
91 |
|
92 // ------------------------------------------------------------------------- |
|
93 // C++ Constructor |
|
94 // ------------------------------------------------------------------------- |
|
95 // |
|
96 CMusAvaSharedObject::CMusAvaSharedObject() |
|
97 { |
|
98 |
|
99 } |
|
100 |
|
101 // ------------------------------------------------------------------------- |
|
102 // Symbian second-phase constructor. |
|
103 // ------------------------------------------------------------------------- |
|
104 // |
|
105 void CMusAvaSharedObject::ConstructL() |
|
106 { |
|
107 iMusAvaSip = CMusAvaSip::NewL(); |
|
108 iConnectionMonitor = CMusAvaConnectionMonitor::NewL( *this ); |
|
109 iNetworkRegistrationStatus = CMusAvaNetworkRegistrationStatus::NewL( ); |
|
110 iNetworkModeStatus = CMusAvaNetworkModeStatus::NewL(); |
|
111 } |
|
112 |
|
113 // ----------------------------------------------------------------------------- |
|
114 // C++ destructor. |
|
115 // ----------------------------------------------------------------------------- |
|
116 // |
|
117 CMusAvaSharedObject::~CMusAvaSharedObject() |
|
118 { |
|
119 MUS_LOG( "mus: [MUSAVA] -> CMusAvaSharedObject::~CMusAvaSharedObject" ) |
|
120 delete iMusAvaSip; |
|
121 delete iConnectionMonitor; |
|
122 delete iNetworkRegistrationStatus; |
|
123 delete iNetworkModeStatus; |
|
124 MUS_LOG( "mus: [MUSAVA] <- CMusAvaSharedObject::~CMusAvaSharedObject" ) |
|
125 } |
|
126 |
|
127 // ------------------------------------------------------------------------- |
|
128 // Returns CMusAvaConnectionMonitor object |
|
129 // ------------------------------------------------------------------------- |
|
130 // |
|
131 CMusAvaConnectionMonitor& CMusAvaSharedObject::ConnectionMonitor() |
|
132 { |
|
133 return *iConnectionMonitor; |
|
134 } |
|
135 |
|
136 // ------------------------------------------------------------------------- |
|
137 // Returns CSip object |
|
138 // ------------------------------------------------------------------------- |
|
139 // |
|
140 CSIP& CMusAvaSharedObject::Sip() |
|
141 { |
|
142 return iMusAvaSip->Sip(); |
|
143 } |
|
144 |
|
145 // ------------------------------------------------------------------------- |
|
146 // Returns CMusAvaSip object |
|
147 // ------------------------------------------------------------------------- |
|
148 // |
|
149 CMusAvaSip& CMusAvaSharedObject::MusAvaSip() |
|
150 { |
|
151 return *iMusAvaSip; |
|
152 } |
|
153 // ------------------------------------------------------------------------- |
|
154 // Returns CMusAvaNetworkRegistrationStatus object |
|
155 // ------------------------------------------------------------------------- |
|
156 // |
|
157 CMusAvaNetworkRegistrationStatus& CMusAvaSharedObject::MusAvaTelephonyStatus() |
|
158 { |
|
159 return *iNetworkRegistrationStatus; |
|
160 } |
|
161 |
|
162 // ------------------------------------------------------------------------- |
|
163 // Returns CMusAvaNetworkModeStatus object |
|
164 // ------------------------------------------------------------------------- |
|
165 // |
|
166 CMusAvaNetworkModeStatus& CMusAvaSharedObject::NetworkModeStatus() |
|
167 { |
|
168 return *iNetworkModeStatus; |
|
169 } |
|
170 |
|
171 |
|
172 |
|
173 |
|
174 |