1 /* |
|
2 * Copyright (c) 2002-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: Handler for the SS Additional Info notification |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "csatsendssadditionalinfohandler.h" |
|
20 #include "CSendSsHandler.h" |
|
21 #include "SatLog.h" |
|
22 |
|
23 // ================= MEMBER FUNCTIONS ========================================== |
|
24 |
|
25 // The class constructor. |
|
26 CSatSendSsAdditionalInfoHandler::CSatSendSsAdditionalInfoHandler( |
|
27 TInt aPriority, RMmCustomAPI& aPhone, |
|
28 CSendSSHandler* aDispatcher ) |
|
29 : CActive( aPriority ), iPhone( aPhone ), |
|
30 iDispatcher( aDispatcher ) |
|
31 { |
|
32 LOG( SIMPLE, |
|
33 "CSatSendSsAdditionalInfoHandler::CSatSendSsAdditionalInfoHandler \ |
|
34 calling" ) |
|
35 |
|
36 // Add to active scheduler |
|
37 CActiveScheduler::Add( this ); |
|
38 |
|
39 LOG( SIMPLE, |
|
40 "CSatSendSsAdditionalInfoHandler::CSatSendSsAdditionalInfoHandler \ |
|
41 exiting" ) |
|
42 } |
|
43 |
|
44 // Destructor |
|
45 CSatSendSsAdditionalInfoHandler::~CSatSendSsAdditionalInfoHandler() |
|
46 { |
|
47 LOG( SIMPLE, |
|
48 "CSatSendSsAdditionalInfoHandler::~CSatSendSsAdditionalInfoHandler \ |
|
49 calling" ) |
|
50 |
|
51 // Cancel any outstanding requests. |
|
52 Cancel(); |
|
53 |
|
54 iDispatcher = NULL; |
|
55 |
|
56 LOG( SIMPLE, |
|
57 "CSatSendSsAdditionalInfoHandler::~CSatSendSsAdditionalInfoHandler \ |
|
58 exiting" ) |
|
59 } |
|
60 |
|
61 // ----------------------------------------------------------------------------- |
|
62 // CSatSendSsAdditionalInfoHandler::NewL |
|
63 // ----------------------------------------------------------------------------- |
|
64 // |
|
65 CSatSendSsAdditionalInfoHandler* CSatSendSsAdditionalInfoHandler::NewL( |
|
66 RMmCustomAPI& aPhone, CSendSSHandler* aDispatcher ) |
|
67 { |
|
68 LOG( SIMPLE, "CSatSendSsAdditionalInfoHandler::NewL calling" ) |
|
69 |
|
70 // Perform construction |
|
71 CSatSendSsAdditionalInfoHandler* self = |
|
72 new ( ELeave ) CSatSendSsAdditionalInfoHandler( |
|
73 EPriorityStandard, aPhone, aDispatcher ); |
|
74 |
|
75 LOG( SIMPLE, "CSatSendSsAdditionalInfoHandler::NewL exiting" ) |
|
76 return self; |
|
77 } |
|
78 |
|
79 // ----------------------------------------------------------------------------- |
|
80 // CSatSendSsAdditionalInfoHandler::Start |
|
81 // Starts the handler. |
|
82 // ----------------------------------------------------------------------------- |
|
83 // |
|
84 void CSatSendSsAdditionalInfoHandler::Start() |
|
85 { |
|
86 LOG( SIMPLE, "CSatSendSsAdditionalInfoHandler::Start calling" ) |
|
87 |
|
88 // Clear the IPC package |
|
89 RMmCustomAPI::TSsAdditionalInfo temp; |
|
90 iSsAdditionalInfo = temp; |
|
91 |
|
92 if ( !IsActive() ) |
|
93 { |
|
94 LOG( SIMPLE, "CSatSendSsAdditionalInfoHandler::Start set active" ) |
|
95 // Request the notification. |
|
96 iPhone.SsAdditionalInfoNotification( iStatus, iSsAdditionalInfo ); |
|
97 // Set to active so that requests can be received. |
|
98 SetActive(); |
|
99 } |
|
100 |
|
101 LOG( SIMPLE, "CSatSendSsAdditionalInfoHandler::Start exiting" ) |
|
102 } |
|
103 |
|
104 // ----------------------------------------------------------------------------- |
|
105 // CSatSendSsAdditionalInfoHandler::RunL |
|
106 // Handles the command. |
|
107 // ----------------------------------------------------------------------------- |
|
108 // |
|
109 void CSatSendSsAdditionalInfoHandler::RunL() |
|
110 { |
|
111 LOG( SIMPLE, "CSatSendSsAdditionalInfoHandler::RunL calling" ) |
|
112 |
|
113 TBuf16<RSat::KAdditionalInfoMaxSize> additionalInfo; |
|
114 LOG2( SIMPLE, "CSatSendSsAdditionalInfoHandler::RunL iStatus: %d", |
|
115 iStatus.Int() ) |
|
116 // Check the status of the asnychronous operation |
|
117 if ( iStatus == KErrNone ) |
|
118 { |
|
119 additionalInfo.Append( iSsAdditionalInfo.iOperationCode ); |
|
120 TInt i = 0; |
|
121 while ( i < iSsAdditionalInfo.iAdditionalInfo.Length() |
|
122 && additionalInfo.Length() < RSat::KAdditionalInfoMaxSize ) |
|
123 { |
|
124 additionalInfo.Append( iSsAdditionalInfo.iAdditionalInfo[i++] ); |
|
125 } |
|
126 LOG2( SIMPLE, "CSatSendSsAdditionalInfoHandler::RunL i: %d", i ) |
|
127 } |
|
128 |
|
129 iDispatcher->DispatchSsAdditionalInfo( additionalInfo ); |
|
130 |
|
131 if ( KErrNone == iStatus.Int() ) |
|
132 { |
|
133 // Renew the notification request. |
|
134 Start(); |
|
135 } |
|
136 |
|
137 LOG( SIMPLE, "CSatSendSsAdditionalInfoHandler::RunL exiting" ) |
|
138 } |
|
139 |
|
140 // ----------------------------------------------------------------------------- |
|
141 // CSatSendSsAdditionalInfoHandler::DoCancel |
|
142 // Cancels the pending request. |
|
143 // ----------------------------------------------------------------------------- |
|
144 // |
|
145 void CSatSendSsAdditionalInfoHandler::DoCancel() |
|
146 { |
|
147 LOG( SIMPLE, "CSatSendSsAdditionalInfoHandler::DoCancel calling" ) |
|
148 |
|
149 // Cancel the outstanding request. |
|
150 iPhone.CancelAsyncRequest( ECustomSsAdditionalInfoNotificationIPC ); |
|
151 |
|
152 LOG( SIMPLE, "CSatSendSsAdditionalInfoHandler::DoCancel exiting" ) |
|
153 } |
|
154 |
|
155 // End of File |
|