|
1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // Name : CSatNotifySimSessonEnd.cpp |
|
15 // Part of : Common SIM ATK TSY / commonsimatktsy |
|
16 // Sim session end notification functionality of Sat Tsy |
|
17 // Version : 1.0 |
|
18 // |
|
19 |
|
20 |
|
21 |
|
22 //INCLUDES |
|
23 #include "CSatTsy.h" // Main tsy class header |
|
24 #include "CSatNotifySimSessionEnd.h" // Class header |
|
25 #include "CSatNotificationsTsy.h" // Tsy class header |
|
26 #include "CSatDataPackage.h" // Parameter packing |
|
27 #include "TfLogger.h" // For TFLOGSTRING |
|
28 #include "CSatTsyReqHandleStore.h" // Request handle class |
|
29 #include "CBerTlv.h" // Ber Tlv data handling |
|
30 #include "TSatUtility.h" // (U)SIM Status constants |
|
31 |
|
32 // ----------------------------------------------------------------------------- |
|
33 // CSatNotifySimSessionEnd::NewL |
|
34 // Two-phased constructor. |
|
35 // ----------------------------------------------------------------------------- |
|
36 // |
|
37 CSatNotifySimSessionEnd* CSatNotifySimSessionEnd::NewL |
|
38 ( |
|
39 CSatNotificationsTsy* aNotificationsTsy |
|
40 ) |
|
41 { |
|
42 TFLOGSTRING("CSAT: CSatNotifySimSessionEnd::NewL"); |
|
43 CSatNotifySimSessionEnd* const satNotifySimSessionEnd = |
|
44 new ( ELeave ) CSatNotifySimSessionEnd( aNotificationsTsy ); |
|
45 CleanupStack::PushL( satNotifySimSessionEnd ); |
|
46 satNotifySimSessionEnd->ConstructL(); |
|
47 CleanupStack::Pop( satNotifySimSessionEnd ); |
|
48 TFLOGSTRING("CSAT: CSatNotifySimSessionEnd::NewL, end of method"); |
|
49 return satNotifySimSessionEnd; |
|
50 } |
|
51 |
|
52 // ----------------------------------------------------------------------------- |
|
53 // CSatNotifySimSessionEnd::~CSatNotifySimSessionEnd |
|
54 // Destructor |
|
55 // ----------------------------------------------------------------------------- |
|
56 // |
|
57 CSatNotifySimSessionEnd::~CSatNotifySimSessionEnd |
|
58 ( |
|
59 // None |
|
60 ) |
|
61 { |
|
62 TFLOGSTRING("CSAT: CSatNotifySimSessionEnd::~CSatNotifySimSessionEnd"); |
|
63 } |
|
64 |
|
65 // ----------------------------------------------------------------------------- |
|
66 // CSatNotifySimSessionEnd::CSatNotifySimSessionEnd |
|
67 // Default C++ constructor |
|
68 // ----------------------------------------------------------------------------- |
|
69 // |
|
70 CSatNotifySimSessionEnd::CSatNotifySimSessionEnd |
|
71 ( |
|
72 CSatNotificationsTsy* aNotificationsTsy |
|
73 ) : iNotificationsTsy ( aNotificationsTsy ) |
|
74 { |
|
75 // None |
|
76 } |
|
77 |
|
78 // ----------------------------------------------------------------------------- |
|
79 // CSatNotifySimSessionEnd::ConstructL |
|
80 // Symbian 2nd phase constructor |
|
81 // ----------------------------------------------------------------------------- |
|
82 // |
|
83 void CSatNotifySimSessionEnd::ConstructL |
|
84 ( |
|
85 // None |
|
86 ) |
|
87 { |
|
88 TFLOGSTRING("CSAT: CSatNotifySimSessionEnd::ConstructL, does nothing"); |
|
89 } |
|
90 |
|
91 // ----------------------------------------------------------------------------- |
|
92 // CSatNotifySimSessionEnd::Notify |
|
93 // Save the request handle type for notification requested by ETel server |
|
94 // ----------------------------------------------------------------------------- |
|
95 // |
|
96 TInt CSatNotifySimSessionEnd::Notify |
|
97 ( |
|
98 const TTsyReqHandle aTsyReqHandle, |
|
99 const TDataPackage& /*aPackage*/ |
|
100 ) |
|
101 { |
|
102 TFLOGSTRING("CSAT: CSatNotifySimSessionEnd::Notify"); |
|
103 // Save the request handle |
|
104 iNotificationsTsy->iSatTsy->SaveReqHandle( aTsyReqHandle, |
|
105 CSatTsy::ESatNotifyProactiveSimSessionEndReqType ); |
|
106 // Check if requested notification is already pending |
|
107 iNotificationsTsy->NotifySatReadyForNotification( |
|
108 KEndOfTheProactiveSession ); |
|
109 |
|
110 return KErrNone; |
|
111 } |
|
112 |
|
113 // ----------------------------------------------------------------------------- |
|
114 // CSatNotifySimSessionEnd::CancelNotification |
|
115 // This method cancels an outstanding asynchronous |
|
116 // NotifySimSessionEnd request. |
|
117 // ----------------------------------------------------------------------------- |
|
118 // |
|
119 TInt CSatNotifySimSessionEnd::CancelNotification |
|
120 ( |
|
121 const TTsyReqHandle aTsyReqHandle |
|
122 ) |
|
123 { |
|
124 TFLOGSTRING("CSAT: CSatNotifySimSessionEnd::CancelNotification"); |
|
125 |
|
126 // Reset the request handle |
|
127 TTsyReqHandle reqHandle = |
|
128 iNotificationsTsy->iSatReqHandleStore->ResetTsyReqHandle( |
|
129 CSatTsy::ESatNotifyProactiveSimSessionEndReqType ); |
|
130 // Complete the request with KErrCancel |
|
131 iNotificationsTsy->iSatTsy->ReqCompleted( aTsyReqHandle, KErrCancel ); |
|
132 return KErrNone; |
|
133 } |
|
134 |
|
135 // ----------------------------------------------------------------------------- |
|
136 // CSatNotifySimSessionEnd::CompleteNotifyL |
|
137 // Complete Sim Session End notification to the client |
|
138 // ----------------------------------------------------------------------------- |
|
139 // |
|
140 TInt CSatNotifySimSessionEnd::CompleteNotifyL |
|
141 ( |
|
142 CSatDataPackage* aDataPackage, |
|
143 TInt aErrorCode |
|
144 ) |
|
145 { |
|
146 TFLOGSTRING("CSAT: CSatNotifySimSessionEnd::CompleteNotifyL"); |
|
147 |
|
148 // Unpack data |
|
149 TUint8 sw1; |
|
150 TUint8 sw2; |
|
151 aDataPackage->UnPackData( sw1, sw2 ); |
|
152 if ( KSw1NormalEnding == sw1 && KSw2NormalEnding == sw2 ) |
|
153 { |
|
154 // Reset req handle. Returns the deleted req handle |
|
155 TTsyReqHandle reqHandle = |
|
156 iNotificationsTsy->iSatReqHandleStore->ResetTsyReqHandle( |
|
157 CSatTsy::ESatNotifyProactiveSimSessionEndReqType ); |
|
158 |
|
159 // In case the request was ongoing, complete the request to the client. |
|
160 if ( CSatTsy::ESatReqHandleUnknown != reqHandle ) |
|
161 { |
|
162 TFLOGSTRING("CSAT: CSatNotifySimSessionEnd::CompleteNotifyL, \ |
|
163 SIM SESSION END"); |
|
164 iNotificationsTsy->iSatTsy->ReqCompleted( reqHandle, aErrorCode ); |
|
165 } |
|
166 } |
|
167 |
|
168 return KErrNone; |
|
169 } |
|
170 |
|
171 // End of file |