|
1 /* |
|
2 * Copyright (c) 2005-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: This class just checks whether videosharing sip profile exist |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #include "musavasipprofileavailability.h" |
|
21 #include "musavaavailabilityobserver.h" |
|
22 #include "musunittesting.h" |
|
23 #include "musavaobserver.h" |
|
24 #include "musavaavailability.h" |
|
25 #include "musavasharedobject.h" |
|
26 #include "muslogger.h" |
|
27 #include "musavasip.h" |
|
28 #include <e32base.h> |
|
29 |
|
30 |
|
31 |
|
32 // -------------------------------------------------------------------------- |
|
33 // Symbian two-phase constructor |
|
34 // -------------------------------------------------------------------------- |
|
35 // |
|
36 CMusAvaSipprofileAvailability* CMusAvaSipprofileAvailability::NewL( |
|
37 MMusAvaAvailabilityObserver& aObserver) |
|
38 { |
|
39 MUS_LOG( "mus: [MUSAVA] -> CMusAvaSipprofileAvailability::NewL " ) |
|
40 CMusAvaSipprofileAvailability* self = |
|
41 CMusAvaSipprofileAvailability::NewLC( |
|
42 aObserver); |
|
43 CleanupStack::Pop( self ); |
|
44 MUS_LOG( "mus: [MUSAVA] <- CMusAvaSipprofileAvailability::NewL " ) |
|
45 return self; |
|
46 } |
|
47 |
|
48 |
|
49 // ------------------------------------------------------------------------- |
|
50 // Two-phased constructor. |
|
51 // ------------------------------------------------------------------------- |
|
52 // |
|
53 CMusAvaSipprofileAvailability* CMusAvaSipprofileAvailability::NewLC( |
|
54 MMusAvaAvailabilityObserver& aObserver) |
|
55 { |
|
56 MUS_LOG( "mus: [MUSAVA] -> CMusAvaSipprofileAvailability::NewLC " ) |
|
57 CMusAvaSipprofileAvailability* self = |
|
58 new (ELeave) CMusAvaSipprofileAvailability( |
|
59 aObserver); |
|
60 CleanupStack::PushL (self); |
|
61 self->ConstructL(); |
|
62 MUS_LOG( "mus: [MUSAVA] <- CMusAvaSipprofileAvailability::NewLC " ) |
|
63 return self; |
|
64 } |
|
65 |
|
66 |
|
67 // --------------------------------------------------------------------------- |
|
68 // Destructor. |
|
69 // --------------------------------------------------------------------------- |
|
70 // |
|
71 CMusAvaSipprofileAvailability::~CMusAvaSipprofileAvailability() |
|
72 { |
|
73 MUS_LOG( "mus: [MUSAVA] -> CMusAvaSipprofileAvailability::\ |
|
74 ~CMusAvaSipprofileAvailability " ) |
|
75 if( iSharedObj )iSharedObj->DeleteSingleton(); |
|
76 MUS_LOG( "mus: [MUSAVA] <- CMusAvaSipprofileAvailability::\ |
|
77 ~CMusAvaSipprofileAvailability " ) |
|
78 |
|
79 } |
|
80 |
|
81 |
|
82 // --------------------------------------------------------------------------- |
|
83 // Symbian 2nd phase constructor can leave. |
|
84 // --------------------------------------------------------------------------- |
|
85 // |
|
86 void CMusAvaSipprofileAvailability::ConstructL() |
|
87 { |
|
88 MUS_LOG( "mus: [MUSAVA] -> CMusAvaSipprofileAvailability::ConstructL " ) |
|
89 iSharedObj = CMusAvaSharedObject::GetSingletonL(); |
|
90 SetProfileState(); |
|
91 MUS_LOG( "mus: [MUSAVA] <- CMusAvaSipprofileAvailability::ConstructL " ) |
|
92 } |
|
93 |
|
94 |
|
95 // ------------------------------------------------------------------------- |
|
96 // Constructor. |
|
97 // ------------------------------------------------------------------------- |
|
98 // |
|
99 CMusAvaSipprofileAvailability::CMusAvaSipprofileAvailability( |
|
100 MMusAvaAvailabilityObserver& aObserver) |
|
101 :CMusAvaAvailability( aObserver ) |
|
102 { |
|
103 } |
|
104 |
|
105 |
|
106 // ------------------------------------------------------------------------- |
|
107 // Executes for the master - salve pattern. |
|
108 // ------------------------------------------------------------------------- |
|
109 // |
|
110 void CMusAvaSipprofileAvailability::DoExecuteL() |
|
111 { |
|
112 MUS_LOG( "mus: [MUSAVA] -> CMusAvaSipprofileAvailability::DoExecuteL " ) |
|
113 SetProfileState(); |
|
114 SetState( iState ); |
|
115 MUS_LOG( "mus: [MUSAVA] <- CMusAvaSipprofileAvailability::DoExecuteL " ) |
|
116 } |
|
117 |
|
118 |
|
119 // ------------------------------------------------------------------------- |
|
120 // Stop the execution. |
|
121 // ------------------------------------------------------------------------- |
|
122 // |
|
123 void CMusAvaSipprofileAvailability::Stop() |
|
124 { |
|
125 MUS_LOG( "mus: [MUSAVA] -> CMusAvaSipprofileAvailability::Stop" ) |
|
126 SetState( MMusAvaObserver::EMusAvaStatusNotExecuted ); |
|
127 MUS_LOG( "mus: [MUSAVA] <- CMusAvaSipprofileAvailability::Stop" ) |
|
128 } |
|
129 |
|
130 |
|
131 // ------------------------------------------------------------------------- |
|
132 // CMusAvaSipprofileAvailability::Name |
|
133 // |
|
134 // ------------------------------------------------------------------------- |
|
135 // |
|
136 MMusAvaObserver::TAvailabilityName CMusAvaSipprofileAvailability::Name() |
|
137 { |
|
138 return MMusAvaObserver::EMusAvaNameSipprofileExist; |
|
139 } |
|
140 |
|
141 // ------------------------------------------------------------------------- |
|
142 // CMusAvaSipprofileAvailability::IsProfileExist. |
|
143 // ------------------------------------------------------------------------- |
|
144 // |
|
145 TBool CMusAvaSipprofileAvailability::IsProfileExist() |
|
146 { |
|
147 MUS_LOG( "mus: [MUSAVA] -> CMusAvaSipprofileAvailability::IsProfileExist ") |
|
148 TBool bExist = EFalse ; |
|
149 if ( iSharedObj->MusAvaSip().CreateSipProfile() ) |
|
150 { |
|
151 TUint32 profileId; |
|
152 TInt err = iSharedObj->MusAvaSip().SipProfileId( profileId ); |
|
153 if( err == KErrNotFound ) |
|
154 { |
|
155 MUS_LOG( "mus: [MUSAVA] No Sip profile " ) |
|
156 bExist = EFalse ; |
|
157 } |
|
158 else |
|
159 { |
|
160 MUS_LOG( "mus: [MUSAVA] Fetch profile " ) |
|
161 bExist = ETrue ; |
|
162 } |
|
163 } |
|
164 MUS_LOG1( "mus: [MUSAVA] <- CMusAvaSipprofileAvailability::IsProfileExist\ |
|
165 = %d",bExist) |
|
166 return bExist; |
|
167 } |
|
168 |
|
169 |
|
170 // ------------------------------------------------------------------------- |
|
171 // CMusAvaSipprofileAvailability::SetProfileState |
|
172 // |
|
173 // ------------------------------------------------------------------------- |
|
174 // |
|
175 void CMusAvaSipprofileAvailability::SetProfileState() |
|
176 { |
|
177 MUS_LOG( "mus: [MUSAVA] -> CMusAvaSipprofileAvailability::SetProfileState ") |
|
178 if ( IsProfileExist() ) |
|
179 { |
|
180 iState = MMusAvaObserver::EMusAvaStatusAvailable; |
|
181 } |
|
182 else |
|
183 { |
|
184 iState = MMusAvaObserver::EMusAvaStatusNoSipProfile ; |
|
185 } |
|
186 MUS_LOG( "mus: [MUSAVA] <- CMusAvaSipprofileAvailability::SetProfileState ") |
|
187 } |