|
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: Implementation of CVmbxSimStoreObserver class. |
|
15 * |
|
16 */ |
|
17 |
|
18 // INCLUDE FILES |
|
19 #include <etelmmcs.h> |
|
20 #include "vmbxsimstoreobserver.h" |
|
21 #include "vmbxsimhandler.h" |
|
22 #include "vmbxlogger.h" |
|
23 |
|
24 // ============================ MEMBER FUNCTIONS =============================== |
|
25 |
|
26 // ----------------------------------------------------------------------------- |
|
27 // CVmbxSimStoreObserver::CVmbxSimStoreObserver |
|
28 // C++ default constructor can NOT contain any code, that |
|
29 // might leave. |
|
30 // ----------------------------------------------------------------------------- |
|
31 // |
|
32 CVmbxSimStoreObserver::CVmbxSimStoreObserver( CVmbxSimHandler& aSimHandler, |
|
33 MVmbxSimStoreObserver& aObserver ) |
|
34 : CActive( EPriorityStandard ), |
|
35 iSimHandler( aSimHandler ), |
|
36 iObserver( aObserver ) |
|
37 { |
|
38 VMBLOGSTRING( "VMBX:CVmbxSimStoreObserver::CVmbxSimStoreObserver =>" ); |
|
39 CActiveScheduler::Add( this ); |
|
40 VMBLOGSTRING( "VMBX:CVmbxSimStoreObserver::CVmbxSimStoreObserver <=" ); |
|
41 } |
|
42 |
|
43 // ----------------------------------------------------------------------------- |
|
44 // CVmbxSimStoreObserver::~CVmbxSimStoreObserver |
|
45 // Destructor |
|
46 // ----------------------------------------------------------------------------- |
|
47 // |
|
48 CVmbxSimStoreObserver::~CVmbxSimStoreObserver() |
|
49 { |
|
50 VMBLOGSTRING( "VMBX:CVmbxSimStoreObserver::~CVmbxSimStoreObserver =>" ); |
|
51 Cancel(); |
|
52 VMBLOGSTRING( "VMBX:CVmbxSimStoreObserver::~CVmbxSimStoreObserver <=" ); |
|
53 } |
|
54 |
|
55 // ----------------------------------------------------------------------------- |
|
56 // CVmbxSimStoreObserver::NewL |
|
57 // Symbian 2nd phase constructor can leave. |
|
58 // ----------------------------------------------------------------------------- |
|
59 // |
|
60 CVmbxSimStoreObserver* CVmbxSimStoreObserver::NewL( |
|
61 CVmbxSimHandler& aSimHandler, MVmbxSimStoreObserver& aObserver ) |
|
62 { |
|
63 VMBLOGSTRING( "VMBX: CVmbxSimStoreObserver::NewL =>" ); |
|
64 CVmbxSimStoreObserver* self = |
|
65 new( ELeave ) CVmbxSimStoreObserver( aSimHandler, aObserver ); |
|
66 CleanupStack::PushL( self ); |
|
67 self->ConstructL(); |
|
68 CleanupStack::Pop( self ); |
|
69 VMBLOGSTRING( "VMBX: CVmbxSimStoreObserver::NewL <=" ); |
|
70 return self; |
|
71 } |
|
72 |
|
73 // ----------------------------------------------------------------------------- |
|
74 // CVmbxSimStoreObserver::ConstructL |
|
75 // Symbian 2nd phase constructor can leave. |
|
76 // ----------------------------------------------------------------------------- |
|
77 // |
|
78 void CVmbxSimStoreObserver::ConstructL() |
|
79 { |
|
80 VMBLOGSTRING( "VMBX: CVmbxSimStoreObserver::ConstructL =>" ); |
|
81 ActivateL(); |
|
82 VMBLOGSTRING( "VMBX: CVmbxSimStoreObserver::ConstructL <=" ); |
|
83 } |
|
84 |
|
85 // ----------------------------------------------------------------------------- |
|
86 // CVmbxSimStoreObserver::Activate |
|
87 // |
|
88 // ----------------------------------------------------------------------------- |
|
89 // |
|
90 void CVmbxSimStoreObserver::ActivateL() |
|
91 { |
|
92 VMBLOGSTRING( "VMBX:CVmbxSimStoreObserver::ActivateL =>" ); |
|
93 if ( !IsActive() ) |
|
94 { |
|
95 iSimHandler.NotifyStoreEvent( iStatus, iEvents, iIndex ); |
|
96 SetActive(); |
|
97 } |
|
98 else |
|
99 { |
|
100 User::Leave( KErrInUse ); |
|
101 } |
|
102 VMBLOGSTRING( "VMBX:CVmbxSimStoreObserver::ActivateL <=" ); |
|
103 } |
|
104 |
|
105 // ----------------------------------------------------------------------------- |
|
106 // CVmbxSimStoreObserver::RunL |
|
107 // ----------------------------------------------------------------------------- |
|
108 // |
|
109 void CVmbxSimStoreObserver::RunL() |
|
110 { |
|
111 VMBLOGSTRING( "VMBX:CVmbxSimStoreObserver::RunL =>" ); |
|
112 // Activate the notication again |
|
113 ActivateL(); |
|
114 iObserver.HandleSimStoreChanged(); |
|
115 VMBLOGSTRING( "VMBX:CVmbxSimStoreObserver::RunL <=" ); |
|
116 } |
|
117 |
|
118 // ----------------------------------------------------------------------------- |
|
119 // CVmbxSimStoreObserver::DoCancel |
|
120 // ----------------------------------------------------------------------------- |
|
121 // |
|
122 void CVmbxSimStoreObserver::DoCancel() |
|
123 { |
|
124 VMBLOGSTRING( "VMBX:CVmbxSimStoreObserver::DoCancel =>" ); |
|
125 if ( IsActive() ) |
|
126 { |
|
127 iSimHandler.CancelAsyncRequest( EMobilePhoneStoreNotifyStoreEvent ); |
|
128 } |
|
129 VMBLOGSTRING( "VMBX:CVmbxSimStoreObserver::DoCancel <=" ); |
|
130 } |
|
131 |
|
132 //End of file |