1 // Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies). |
1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). |
2 // All rights reserved. |
2 // All rights reserved. |
3 // This component and the accompanying materials are made available |
3 // This component and the accompanying materials are made available |
4 // under the terms of "Eclipse Public License v1.0" |
4 // under the terms of "Eclipse Public License v1.0" |
5 // which accompanies this distribution, and is available |
5 // which accompanies this distribution, and is available |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
18 // |
18 // |
19 |
19 |
20 |
20 |
21 |
21 |
22 //INCLUDES |
22 //INCLUDES |
23 |
|
24 #include "OstTraceDefinitions.h" |
|
25 #ifdef OST_TRACE_COMPILER_IN_USE |
|
26 #include "CSatNotifyGetChannelStatusTraces.h" |
|
27 #endif |
|
28 |
|
29 #include <satcs.h> // Etel SAT IPC definitions |
23 #include <satcs.h> // Etel SAT IPC definitions |
30 #include "CSatTsy.h" // Tsy class header |
24 #include "CSatTsy.h" // Tsy class header |
31 #include "CSatNotifyGetChannelStatus.h" // Class header |
25 #include "CSatNotifyGetChannelStatus.h" // Class header |
32 #include "CSatNotificationsTsy.h" // Tsy class header |
26 #include "CSatNotificationsTsy.h" // Tsy class header |
33 #include "CBerTlv.h" // Ber Tlv data handling |
27 #include "CBerTlv.h" // Ber Tlv data handling |
34 #include "TTlv.h" // TTlv class |
28 #include "TTlv.h" // TTlv class |
35 #include "CSatDataPackage.h" // Parameter packing |
29 #include "CSatDataPackage.h" // Parameter packing |
|
30 #include "TfLogger.h" // For TFLOGSTRING |
36 #include "TSatUtility.h" // Utilities |
31 #include "TSatUtility.h" // Utilities |
37 #include "CSatTsyReqHandleStore.h" // Request handle class |
32 #include "CSatTsyReqHandleStore.h" // Request handle class |
38 #include "cmmmessagemanagerbase.h" // Message manager class for forwarding req. |
33 #include "cmmmessagemanagerbase.h" // Message manager class for forwarding req. |
39 |
34 |
40 // ----------------------------------------------------------------------------- |
35 // ----------------------------------------------------------------------------- |
45 CSatNotifyGetChannelStatus* CSatNotifyGetChannelStatus::NewL |
40 CSatNotifyGetChannelStatus* CSatNotifyGetChannelStatus::NewL |
46 ( |
41 ( |
47 CSatNotificationsTsy* aNotificationsTsy |
42 CSatNotificationsTsy* aNotificationsTsy |
48 ) |
43 ) |
49 { |
44 { |
50 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYGETCHANNELSTATUS_NEWL_1, "CSAT: CSatNotifyGetChannelStatus::NewL"); |
45 TFLOGSTRING("CSAT: CSatNotifyGetChannelStatus::NewL"); |
51 CSatNotifyGetChannelStatus* const satNotifyGetChannelStatus = |
46 CSatNotifyGetChannelStatus* const satNotifyGetChannelStatus = |
52 new ( ELeave ) CSatNotifyGetChannelStatus( aNotificationsTsy ); |
47 new ( ELeave ) CSatNotifyGetChannelStatus( aNotificationsTsy ); |
53 CleanupStack::PushL( satNotifyGetChannelStatus ); |
48 CleanupStack::PushL( satNotifyGetChannelStatus ); |
54 satNotifyGetChannelStatus->ConstructL(); |
49 satNotifyGetChannelStatus->ConstructL(); |
55 CleanupStack::Pop( satNotifyGetChannelStatus ); |
50 CleanupStack::Pop( satNotifyGetChannelStatus ); |
56 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYGETCHANNELSTATUS_NEWL_2, "CSAT: CSatNotifyGetChannelStatus::NewL, end of method"); |
51 TFLOGSTRING("CSAT: CSatNotifyGetChannelStatus::NewL, end of method"); |
57 return satNotifyGetChannelStatus; |
52 return satNotifyGetChannelStatus; |
58 } |
53 } |
59 |
54 |
60 // ----------------------------------------------------------------------------- |
55 // ----------------------------------------------------------------------------- |
61 // CSatNotifyGetChannelStatus::~CSatNotifyGetChannelStatus |
56 // CSatNotifyGetChannelStatus::~CSatNotifyGetChannelStatus |
65 CSatNotifyGetChannelStatus::~CSatNotifyGetChannelStatus |
60 CSatNotifyGetChannelStatus::~CSatNotifyGetChannelStatus |
66 ( |
61 ( |
67 // None |
62 // None |
68 ) |
63 ) |
69 { |
64 { |
70 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYGETCHANNELSTATUS_DTOR_1, "CSAT: CSatNotifyGetChannelStatus::~CSatNotifyGetChannelStatus"); |
65 TFLOGSTRING("CSAT: CSatNotifyGetChannelStatus::~CSatNotifyGetChannelStatus" |
|
66 ); |
71 } |
67 } |
72 |
68 |
73 // ----------------------------------------------------------------------------- |
69 // ----------------------------------------------------------------------------- |
74 // CSatNotifyGetChannelStatus::CSatNotifyGetChannelStatus |
70 // CSatNotifyGetChannelStatus::CSatNotifyGetChannelStatus |
75 // Default C++ constructor |
71 // Default C++ constructor |
91 void CSatNotifyGetChannelStatus::ConstructL |
87 void CSatNotifyGetChannelStatus::ConstructL |
92 ( |
88 ( |
93 // None |
89 // None |
94 ) |
90 ) |
95 { |
91 { |
96 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYGETCHANNELSTATUS_CONSTRUCTL_1, "CSAT: CSatNotifyGetChannelStatus::ConstructL, does nothing"); |
92 TFLOGSTRING("CSAT: CSatNotifyGetChannelStatus::ConstructL, does nothing"); |
97 } |
93 } |
98 |
94 |
99 // ----------------------------------------------------------------------------- |
95 // ----------------------------------------------------------------------------- |
100 // CSatNotifyGetChannelStatus::Notify |
96 // CSatNotifyGetChannelStatus::Notify |
101 // This request allows a client to be notified of a GET CHANNEL STATUS proactive |
97 // This request allows a client to be notified of a GET CHANNEL STATUS proactive |
106 ( |
102 ( |
107 const TTsyReqHandle aTsyReqHandle, |
103 const TTsyReqHandle aTsyReqHandle, |
108 const TDataPackage& aPackage |
104 const TDataPackage& aPackage |
109 ) |
105 ) |
110 { |
106 { |
111 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYGETCHANNELSTATUS_NOTIFY_1, "CSAT: CSatNotifyGetChannelStatus::Notify"); |
107 TFLOGSTRING("CSAT: CSatNotifyGetChannelStatus::Notify"); |
112 // Save data pointers to client side for completion |
108 // Save data pointers to client side for completion |
113 iGetChannelStatusRspV2Pckg = reinterpret_cast<RSat::TGetChannelStatusV2Pckg*>( |
109 iGetChannelStatusRspV2Pckg = reinterpret_cast<RSat::TGetChannelStatusV2Pckg*>( |
114 aPackage.Des1n() ); |
110 aPackage.Des1n() ); |
115 // Save the request handle |
111 // Save the request handle |
116 iNotificationsTsy->iSatTsy->SaveReqHandle( aTsyReqHandle, |
112 iNotificationsTsy->iSatTsy->SaveReqHandle( aTsyReqHandle, |
129 TInt CSatNotifyGetChannelStatus::CancelNotification |
125 TInt CSatNotifyGetChannelStatus::CancelNotification |
130 ( |
126 ( |
131 const TTsyReqHandle aTsyReqHandle |
127 const TTsyReqHandle aTsyReqHandle |
132 ) |
128 ) |
133 { |
129 { |
134 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYGETCHANNELSTATUS_CANCELNOTIFICATION_1, "CSAT: CSatNotifyGetChannelStatus::CancelNotification"); |
130 TFLOGSTRING("CSAT: CSatNotifyGetChannelStatus::CancelNotification"); |
135 // Reset the request handle |
131 // Reset the request handle |
136 TTsyReqHandle reqHandle = iNotificationsTsy->iSatReqHandleStore-> |
132 TTsyReqHandle reqHandle = iNotificationsTsy->iSatReqHandleStore-> |
137 ResetTsyReqHandle( CSatTsy::ESatNotifyGetChannelStatusPCmdReqType ); |
133 ResetTsyReqHandle( CSatTsy::ESatNotifyGetChannelStatusPCmdReqType ); |
138 // Reset the data pointers |
134 // Reset the data pointers |
139 iGetChannelStatusRspV2Pckg = NULL; |
135 iGetChannelStatusRspV2Pckg = NULL; |
152 ( |
148 ( |
153 CSatDataPackage* aDataPackage, |
149 CSatDataPackage* aDataPackage, |
154 TInt aErrorCode |
150 TInt aErrorCode |
155 ) |
151 ) |
156 { |
152 { |
157 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYGETCHANNELSTATUS_COMPLETENOTIFYL_1, "CSAT: CSatNotifyGetChannelStatus::CompleteNotifyL"); |
153 TFLOGSTRING("CSAT: CSatNotifyGetChannelStatus::CompleteNotifyL"); |
158 |
154 |
159 TInt ret( KErrNone ); |
155 TInt ret( KErrNone ); |
160 // Unpack parameters |
156 // Unpack parameters |
161 TPtrC8* data; |
157 TPtrC8* data; |
162 aDataPackage->UnPackData( &data ); |
158 aDataPackage->UnPackData( &data ); |
179 if ( CSatTsy::ESatReqHandleUnknown != reqHandle ) |
175 if ( CSatTsy::ESatReqHandleUnknown != reqHandle ) |
180 { |
176 { |
181 // Complete right away if error has occured, otherwise continue.. |
177 // Complete right away if error has occured, otherwise continue.. |
182 if ( KErrNone == aErrorCode ) |
178 if ( KErrNone == aErrorCode ) |
183 { |
179 { |
184 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYGETCHANNELSTATUS_COMPLETENOTIFYL_2, "CSAT: CSatNotifyGetChannelStatus::CompleteNotifyL aErrorCode: %d", aErrorCode ); |
180 TFLOGSTRING2("CSAT: CSatNotifyGetChannelStatus::CompleteNotifyL\ |
|
181 aErrorCode: %d", aErrorCode ); |
185 // Fill the Get Channel status structure |
182 // Fill the Get Channel status structure |
186 RSat::TGetChannelStatusV2& channelStatusV2 = |
183 RSat::TGetChannelStatusV2& channelStatusV2 = |
187 ( *iGetChannelStatusRspV2Pckg )(); |
184 ( *iGetChannelStatusRspV2Pckg )(); |
188 |
185 |
189 // Store transaction ID |
186 // Store transaction ID |
195 } |
192 } |
196 iNotificationsTsy->iSatTsy->ReqCompleted( reqHandle, ret ); |
193 iNotificationsTsy->iSatTsy->ReqCompleted( reqHandle, ret ); |
197 } |
194 } |
198 else |
195 else |
199 { |
196 { |
200 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYGETCHANNELSTATUS_COMPLETENOTIFYL_3, "CSAT: CSatNotifyGetChannelStatus::CompleteNotifyL Request not ongoing"); |
197 TFLOGSTRING("CSAT: CSatNotifyGetChannelStatus::CompleteNotifyL\ |
|
198 Request not ongoing"); |
201 // Request not on, returning response immediately |
199 // Request not on, returning response immediately |
202 TBuf16<1> additionalInfo; |
200 TBuf16<1> additionalInfo; |
203 additionalInfo.Append( RSat::KNoSpecificMeProblem ); |
201 additionalInfo.Append( RSat::KNoSpecificMeProblem ); |
204 CreateTerminalRespL( pCmdNumber, RSat::KMeUnableToProcessCmd, |
202 CreateTerminalRespL( pCmdNumber, RSat::KMeUnableToProcessCmd, |
205 additionalInfo ); |
203 additionalInfo ); |
217 TInt CSatNotifyGetChannelStatus::TerminalResponseL |
215 TInt CSatNotifyGetChannelStatus::TerminalResponseL |
218 ( |
216 ( |
219 TDes8* aRsp |
217 TDes8* aRsp |
220 ) |
218 ) |
221 { |
219 { |
222 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYGETCHANNELSTATUS_TERMINALRESPONSEL_1, "CSAT: CSatNotifyGetChannelStatus::TerminalResponseL"); |
220 TFLOGSTRING("CSAT: CSatNotifyGetChannelStatus::TerminalResponseL"); |
223 TInt ret( KErrNone ); |
221 TInt ret( KErrNone ); |
224 |
222 |
225 TBuf16<RSat::KAdditionalInfoMaxSize> additionalInfo; |
223 TBuf16<RSat::KAdditionalInfoMaxSize> additionalInfo; |
226 |
224 |
227 RSat::TGetChannelStatusRspV2Pckg* aRspPckg = |
225 RSat::TGetChannelStatusRspV2Pckg* aRspPckg = |
241 && ( RSat::KCmdTypeNotUnderstood != rspV2.iGeneralResult ) |
239 && ( RSat::KCmdTypeNotUnderstood != rspV2.iGeneralResult ) |
242 && ( RSat::KCmdDataNotUnderstood != rspV2.iGeneralResult ) |
240 && ( RSat::KCmdDataNotUnderstood != rspV2.iGeneralResult ) |
243 && ( RSat::KCmdNumberNotKnown != rspV2.iGeneralResult ) |
241 && ( RSat::KCmdNumberNotKnown != rspV2.iGeneralResult ) |
244 && ( RSat::KErrorRequiredValuesMissing != rspV2.iGeneralResult ) ) |
242 && ( RSat::KErrorRequiredValuesMissing != rspV2.iGeneralResult ) ) |
245 { |
243 { |
246 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYGETCHANNELSTATUS_TERMINALRESPONSEL_2, "CSAT: CSatNotifyGetChannelStatus::TerminalResponseL, Invalid General Result"); |
244 TFLOGSTRING("CSAT: CSatNotifyGetChannelStatus::TerminalResponseL,\ |
|
245 Invalid General Result"); |
247 // Invalid general result |
246 // Invalid general result |
248 ret = KErrCorrupt; |
247 ret = KErrCorrupt; |
249 } |
248 } |
250 |
249 |
251 if ( ( RSat::KChannelStatusInfo == rspV2.iInfoType ) |
250 if ( ( RSat::KChannelStatusInfo == rspV2.iInfoType ) |
252 || ( RSat::KMeProblem == rspV2.iInfoType ) ) |
251 || ( RSat::KMeProblem == rspV2.iInfoType ) ) |
253 { |
252 { |
254 if ( !rspV2.iAdditionalInfo.Length() ) |
253 if ( !rspV2.iAdditionalInfo.Length() ) |
255 { |
254 { |
256 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYGETCHANNELSTATUS_TERMINALRESPONSEL_3, "CSAT: CSatNotifyGetChannelStatus::TerminalResponseL, Invalid Additional Info"); |
255 TFLOGSTRING("CSAT: CSatNotifyGetChannelStatus::TerminalResponseL,\ |
|
256 Invalid Additional Info"); |
257 ret = KErrCorrupt; |
257 ret = KErrCorrupt; |
258 } |
258 } |
259 else |
259 else |
260 { |
260 { |
261 additionalInfo.Copy(rspV2.iAdditionalInfo); |
261 additionalInfo.Copy(rspV2.iAdditionalInfo); |
285 TUint8 aPCmdNumber, |
285 TUint8 aPCmdNumber, |
286 TUint8 aGeneralResult, |
286 TUint8 aGeneralResult, |
287 const TDesC16& aAdditionalInfo |
287 const TDesC16& aAdditionalInfo |
288 ) |
288 ) |
289 { |
289 { |
290 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYGETCHANNELSTATUS_CREATETERMINALRESPL_1, "CSAT: CSatMessHandler::CreateTerminalRespL"); |
290 TFLOGSTRING("CSAT: CSatMessHandler::CreateTerminalRespL"); |
291 TTlv tlvSpecificData; |
291 TTlv tlvSpecificData; |
292 // Append general result tag |
292 // Append general result tag |
293 tlvSpecificData.AddTag( KTlvResultTag ); |
293 tlvSpecificData.AddTag( KTlvResultTag ); |
294 // Append general result |
294 // Append general result |
295 tlvSpecificData.AddByte( aGeneralResult ); |
295 tlvSpecificData.AddByte( aGeneralResult ); |
317 tlvSpecificData.AddByte( static_cast<TUint8>( aAdditionalInfo[i] ) ); |
317 tlvSpecificData.AddByte( static_cast<TUint8>( aAdditionalInfo[i] ) ); |
318 } |
318 } |
319 } |
319 } |
320 else |
320 else |
321 { |
321 { |
322 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYGETCHANNELSTATUS_CREATETERMINALRESPL_2, "CSAT: CSatMessHandler::CreateTerminalRespL - mandatory channel status missing"); |
322 TFLOGSTRING("CSAT: CSatMessHandler::CreateTerminalRespL - \ |
|
323 mandatory channel status missing"); |
323 } |
324 } |
324 |
325 |
325 // Prepare data |
326 // Prepare data |
326 iNotificationsTsy->iTerminalRespData.iPCmdNumber = aPCmdNumber; |
327 iNotificationsTsy->iTerminalRespData.iPCmdNumber = aPCmdNumber; |
327 TPtrC8 data = tlvSpecificData.GetDataWithoutTopLevelTag(); |
328 TPtrC8 data = tlvSpecificData.GetDataWithoutTopLevelTag(); |