author | mikaruus <mika.a.ruuskanen@nokia.com> |
Wed, 21 Apr 2010 14:29:55 +0300 | |
changeset 8 | 6295dc2169f3 |
parent 5 | 8ccc39f9d787 |
child 9 | 8486d82aef45 |
permissions | -rw-r--r-- |
0 | 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 the License "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: |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
||
19 |
/***************************************************************************** |
|
20 |
R&D NOTES ARE: |
|
21 |
TODO: Something needs to be done |
|
22 |
TBR: Something could be removed between TBR's |
|
23 |
*****************************************************************************/ |
|
24 |
||
25 |
// INCLUDE FILES |
|
26 |
#include <iscapi.h> // For RIscApi |
|
27 |
#include "iaduserapitrace.h" // For C_TRACE... |
|
28 |
#include "iadinternaldefinitions.h" // For EIAD |
|
29 |
#include "iadnokiadefinitions.h" // For EIADCustom |
|
30 |
#include "OstTraceDefinitions.h" |
|
31 |
#ifdef OST_TRACE_COMPILER_IN_USE |
|
32 |
#include "isaapiTraces.h" |
|
33 |
#endif |
|
34 |
||
35 |
// EXTERNAL DATA STRUCTURES |
|
36 |
||
37 |
// EXTERNAL FUNCTION PROTOTYPES |
|
38 |
||
39 |
// CONSTANTS |
|
40 |
||
41 |
// MACROS |
|
42 |
||
43 |
// LOCAL CONSTANTS AND MACROS |
|
44 |
const TUint8 KOneParam( 1 ); |
|
45 |
const TUint8 KTwoParams( 2 ); |
|
46 |
const TUint8 KThreeParams( 3 ); |
|
47 |
||
48 |
const TUint8 KFirstParam( 0 ); |
|
49 |
const TUint8 KSecondParam( 1 ); |
|
50 |
const TUint8 KThirdParam( 2 ); |
|
51 |
const TInt KInfoLength( 1 ); |
|
52 |
||
53 |
// MODULE DATA STRUCTURES |
|
54 |
||
55 |
// LOCAL FUNCTION PROTOTYPES |
|
56 |
||
57 |
// FORWARD DECLARATIONS |
|
58 |
||
59 |
// ============================ MEMBER FUNCTIONS =============================== |
|
60 |
||
61 |
// ----------------------------------------------------------------------------- |
|
62 |
// RIscApi::RIscApi |
|
63 |
// C++ default constructor can NOT contain any code, that |
|
64 |
// might leave. |
|
65 |
// ----------------------------------------------------------------------------- |
|
66 |
// |
|
67 |
EXPORT_C RIscApi::RIscApi() |
|
68 |
:iNeededLen( NULL, 0 ), |
|
69 |
iNeededDataLen( NULL, 0 ), |
|
70 |
iConnectionStatus( NULL, 0 ), |
|
71 |
iFlowControlStatus( NULL, 0 ), |
|
72 |
iOpen( EFalse ), |
|
73 |
iChannelNumber( KNotInitializedChannel ) |
|
74 |
{ |
|
75 |
OstTrace0( TRACE_NORMAL, RISCAPI_RISCAPI_ENTRY, "<>RIscApi::RIscApi" ); |
|
76 |
||
77 |
C_TRACE( ( _T( "RIscApi::RIscApi <->" ) ) ); |
|
78 |
||
79 |
} |
|
80 |
||
81 |
||
82 |
EXPORT_C RIscApi::~RIscApi() |
|
83 |
{ |
|
84 |
OstTraceExt1( TRACE_NORMAL, DUP1_RISCAPI_RISCAPI_ENTRY, ">RIscApi::~RIscApi;iChannelNumber=%hx", iChannelNumber ); |
|
85 |
||
86 |
C_TRACE( ( _T( "RIscApi::~RIscApi 0x%x ->" ), iChannelNumber ) ); |
|
87 |
Close(); |
|
88 |
C_TRACE( ( _T( "RIscApi::~RIscApi 0x%x <-" ), iChannelNumber ) ); |
|
89 |
||
90 |
OstTrace0( TRACE_NORMAL, DUP1_RISCAPI_RISCAPI_EXIT, "<RIscApi::~RIscApi" ); |
|
91 |
} |
|
92 |
||
93 |
||
94 |
// ----------------------------------------------------------------------------- |
|
95 |
// RIscApi::Initialize |
|
96 |
// Initialize the ISC Interface |
|
97 |
// ( other items were commented in a header ). |
|
98 |
// ----------------------------------------------------------------------------- |
|
99 |
// |
|
100 |
EXPORT_C void RIscApi::InitializeModemInterface( |
|
101 |
TRequestStatus& aStatus |
|
102 |
) |
|
103 |
{ |
|
104 |
OstTraceExt2( TRACE_NORMAL, RISCAPI_INITIALIZEMODEMINTERFACE_ENTRY, ">RIscApi::InitializeModemInterface;aStatus=%x;iChannelNumber=%hx", ( TUint )&( aStatus ), iChannelNumber ); |
|
105 |
||
106 |
C_TRACE( ( _T( "RIscApi::InitializeModemInterface 0x%x 0x%x ->" ), iChannelNumber, &aStatus ) ); |
|
107 |
TRACE_ASSERT_ALWAYS; |
|
108 |
TRequestStatus* status = &aStatus; |
|
109 |
User::RequestComplete( status, KErrNone ); |
|
110 |
C_TRACE( ( _T( "RIscApi::InitializeModemInterfaceL 0x%x <-" ), iChannelNumber ) ); |
|
111 |
||
112 |
OstTrace0( TRACE_NORMAL, RISCAPI_INITIALIZEMODEMINTERFACE_EXIT, "<RIscApi::InitializeModemInterface" ); |
|
113 |
} |
|
114 |
||
115 |
// ----------------------------------------------------------------------------- |
|
116 |
// RIscApi::InitializeCancel |
|
117 |
// Cancel ISC Initialization sequence |
|
118 |
// ( other items were commented in a header ). |
|
119 |
// ----------------------------------------------------------------------------- |
|
120 |
// |
|
121 |
EXPORT_C void RIscApi::InitializeCancel( |
|
122 |
// None |
|
123 |
) |
|
124 |
{ |
|
125 |
OstTrace0( TRACE_NORMAL, RISCAPI_INITIALIZECANCEL_ENTRY, ">RIscApi::InitializeCancel" ); |
|
126 |
||
127 |
C_TRACE( ( _T( "RIscApi::InitializeCancel ->" ) ) ); |
|
128 |
TRACE_ASSERT_ALWAYS; |
|
129 |
C_TRACE( ( _T( "RIscApi::InitializeCancel <-" ) ) ); |
|
130 |
||
131 |
OstTrace0( TRACE_NORMAL, RISCAPI_INITIALIZECANCEL_EXIT, "<RIscApi::InitializeCancel" ); |
|
132 |
} |
|
133 |
||
134 |
// ----------------------------------------------------------------------------- |
|
135 |
// RIscApi::LoadL |
|
136 |
// Load required drivers using Isc_config.ini file |
|
137 |
// ( other items were commented in a header ). |
|
138 |
// ----------------------------------------------------------------------------- |
|
139 |
// |
|
140 |
void RIscApi::LoadL( |
|
141 |
const TDesC8&, //aMultiplexerInit, // Multiplexer init. |
|
142 |
const TDesC8& //aDataTransmissionInit // Datatransmission init. |
|
143 |
) const |
|
144 |
{ |
|
145 |
OstTrace0( TRACE_NORMAL, RISCAPI_LOADL_ENTRY, ">RIscApi::LoadL" ); |
|
146 |
||
147 |
||
148 |
C_TRACE( ( _T( "RIscApi::LoadL ->" ) ) ); |
|
149 |
TRACE_ASSERT_ALWAYS; |
|
150 |
C_TRACE( ( _T( "RIscApi::LoadL <-" ) ) ); |
|
151 |
||
152 |
OstTrace0( TRACE_NORMAL, RISCAPI_LOADL_EXIT, "<RIscApi::LoadL" ); |
|
153 |
} |
|
154 |
||
155 |
// ----------------------------------------------------------------------------- |
|
156 |
// RIscApi::Open |
|
157 |
// Open ISC channel asyncronously |
|
158 |
// ( other items were commented in a header ). |
|
159 |
// ----------------------------------------------------------------------------- |
|
160 |
// |
|
161 |
EXPORT_C void RIscApi::Open( |
|
162 |
const TUint16 aChannelNumber, |
|
163 |
TRequestStatus& aStatus, |
|
164 |
TOwnerType aType, |
|
165 |
const TDesC8* aOpenParams |
|
166 |
) |
|
167 |
{ |
|
168 |
OstTraceExt4( TRACE_NORMAL, RISCAPI_OPEN_ENTRY, ">RIscApi::Open;aChannelNumber=%hu;aStatus=%x;aType=%x;aOpenParams=%x", aChannelNumber, ( TUint )&( aStatus ), ( TUint )&( aType ), ( TUint )( aOpenParams ) ); |
|
169 |
||
170 |
C_TRACE( ( _T( "RIscApi::Open 0x%x, 0x%x, 0x%x, 0x%x this 0x%x ->" ), |
|
171 |
aChannelNumber, &aStatus, aType, aOpenParams, this ) ); |
|
172 |
// Driver is tried to load everytime. |
|
173 |
TInt loadStatus( User::LoadLogicalDevice( KNameOfIsaAccessDriverLdd ) ); |
|
174 |
C_TRACE( ( _T( "RIscApi::Open devicedriver loaded %d" ), loadStatus ) ); |
|
175 |
ASSERT_PANIC_ALWAYS( ( KErrNone == loadStatus || KErrAlreadyExists == loadStatus), EIADDriverLoadFailed ); |
|
176 |
TInt error( KErrInUse ); |
|
177 |
if( KNotInitializedChannel == iChannelNumber ) |
|
178 |
{ |
|
8
6295dc2169f3
New release based on our 2010wk15 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
5
diff
changeset
|
179 |
HBufC8* buffer = NULL; |
6295dc2169f3
New release based on our 2010wk15 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
5
diff
changeset
|
180 |
TRAPD( err, buffer = HBufC8::NewL( KInfoLength ) ); |
6295dc2169f3
New release based on our 2010wk15 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
5
diff
changeset
|
181 |
ASSERT_PANIC_ALWAYS( err == KErrNone, KErrNoMemory ); |
6295dc2169f3
New release based on our 2010wk15 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
5
diff
changeset
|
182 |
|
6295dc2169f3
New release based on our 2010wk15 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
5
diff
changeset
|
183 |
TPtr8 info = buffer->Des(); |
0 | 184 |
ASSERT_PANIC_ALWAYS( ( aChannelNumber < EIADNokiaLastUserChannel ), EIADChannelNumberOutofRange ); |
185 |
C_TRACE( ( _T( "RIscApi::Open ldd" ) ) ); |
|
186 |
OstTrace0( TRACE_NORMAL, RISCAPI_OPEN, "RIscApi::Open ldd" ); |
|
187 |
info.Append( aChannelNumber ); |
|
188 |
error = DoCreate( KIADDriverName, |
|
189 |
TVersion(), |
|
190 |
KNullUnit, |
|
191 |
NULL, |
|
192 |
&info, |
|
193 |
aType ); |
|
8
6295dc2169f3
New release based on our 2010wk15 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
5
diff
changeset
|
194 |
delete buffer; |
0 | 195 |
} |
196 |
if( KErrNone != error ) |
|
197 |
{ |
|
198 |
C_TRACE( ( _T( "RIscApi::Open - failed 0x%x error %d" ), aChannelNumber, error ) ); |
|
199 |
OstTraceExt2( TRACE_NORMAL, RISCAPI_OPEN_FAILED, "RIscApi::Open - failed;aChannelNumber=%hx;error=%d", aChannelNumber, error ); |
|
200 |
||
201 |
TRequestStatus* ptrStatus = &aStatus; |
|
202 |
User::RequestComplete( ptrStatus, error ); |
|
203 |
} |
|
204 |
else |
|
205 |
{ |
|
206 |
C_TRACE( ( _T( "RIscApi::Open iChannelNumber %d aChannelNumber %d " ), iChannelNumber, aChannelNumber ) ); |
|
207 |
OstTraceExt2( TRACE_NORMAL, DUP1_RISCAPI_OPEN, "RIscApi::Open;iChannelNumber=%hx;aChannelNumber=%hx", iChannelNumber, aChannelNumber ); |
|
208 |
aStatus = KRequestPending; |
|
5
8ccc39f9d787
New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
209 |
TRequestStatus status = KRequestPending; |
0 | 210 |
TAny* params[ KThreeParams ]; |
5
8ccc39f9d787
New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
211 |
params[ KFirstParam ] = reinterpret_cast< TAny* >( &status ); |
0 | 212 |
params[ KSecondParam ] = reinterpret_cast< TAny* >( &iChannelNumber ); |
213 |
// If opened with resource (aOpenParams). |
|
214 |
params[ KThirdParam ] = reinterpret_cast< TAny* >( const_cast<TDesC8*>( aOpenParams ) ); |
|
215 |
error = DoControl( EIADAsyncOpen, params ); |
|
216 |
TRACE_ASSERT_ALWAYS_COND( KErrNone == error ); |
|
5
8ccc39f9d787
New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
217 |
User::WaitForRequest(status); |
0 | 218 |
// In case of KErrAlreadyExists as a result to open we must close the handle after open. |
5
8ccc39f9d787
New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
219 |
if( status.Int() == KErrAlreadyExists ) |
0 | 220 |
{ |
221 |
C_TRACE( ( _T( "RIscApi::Open close handle KErrAlreadyExists" ) ) ); |
|
222 |
OstTraceExt1( TRACE_NORMAL, RISCAPI_OPEN_ALREADY_EXIST, "RIscApi::Open;aChannelNumber=%hx", aChannelNumber ); |
|
223 |
RHandleBase::Close(); |
|
224 |
} |
|
5
8ccc39f9d787
New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
225 |
TRequestStatus* statusPtr=&aStatus; |
8ccc39f9d787
New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
226 |
|
8ccc39f9d787
New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
227 |
User::RequestComplete(statusPtr, status.Int()); |
0 | 228 |
} |
229 |
C_TRACE( ( _T( "RIscApi::Open <-" ) ) ); |
|
230 |
||
231 |
OstTrace0( TRACE_NORMAL, RISCAPI_OPEN_EXIT, "<RIscApi::Open" ); |
|
232 |
} |
|
233 |
||
234 |
#if (NCP_COMMON_SOS_VERSION_SUPPORT >= SOS_VERSION_95) |
|
235 |
EXPORT_C TInt RIscApi::Loan( |
|
236 |
const TUint16 aChannelNumber, |
|
237 |
TOwnerType aHandleType |
|
238 |
// None |
|
239 |
) |
|
240 |
{ |
|
241 |
||
242 |
C_TRACE( ( _T( "RIscApi::Loan 0x%x ->" ), iChannelNumber ) ); |
|
243 |
OstTraceExt1( TRACE_NORMAL, RISCAPI_LOAN_ENTRY, ">RIscApi::Loan;iChannelNumber=%hx", iChannelNumber ); |
|
244 |
// TODO: panic if open? |
|
245 |
// PanicIfNotOpen(); |
|
246 |
// Driver is tried to load everytime. |
|
247 |
TInt loadStatus( User::LoadLogicalDevice( KNameOfIsaAccessDriverLdd ) ); |
|
248 |
C_TRACE( ( _T( "RIscApi::Open devicedriver loaded %d" ), loadStatus ) ); |
|
249 |
OstTrace1( TRACE_NORMAL, DUY1_RISCAPI_LOAN, "RIscApi::Loan;loaded=%d", loadStatus ); |
|
250 |
ASSERT_PANIC_ALWAYS( ( KErrNone == loadStatus || KErrAlreadyExists == loadStatus), EIADDriverLoadFailed ); |
|
251 |
TInt error( KErrInUse ); |
|
252 |
if( KNotInitializedChannel == iChannelNumber ) |
|
253 |
{ |
|
254 |
TBuf8<KInfoLength> info; |
|
255 |
ASSERT_PANIC_ALWAYS( ( aChannelNumber < EIADNokiaLastUserChannel ), EIADChannelNumberOutofRange ); |
|
256 |
C_TRACE( ( _T( "RIscApi::Loan ldd" ) ) ); |
|
257 |
info.Append( aChannelNumber ); |
|
258 |
error = DoCreate( KIADDriverName, |
|
259 |
TVersion(), |
|
260 |
KNullUnit, |
|
261 |
NULL, |
|
262 |
&info, |
|
263 |
aHandleType ); |
|
264 |
} |
|
265 |
if( KErrNone == error ) |
|
266 |
{ |
|
267 |
C_TRACE( ( _T( "RIscApi::Loan iChannelNumber %d aChannelNumber %d " ), iChannelNumber, aChannelNumber ) ); |
|
268 |
OstTraceExt2( TRACE_NORMAL, DUY2_RISCAPI_LOAN, "RIscApi::Loan;iChannelNumber=%d;aChannelNumber=%d", iChannelNumber, aChannelNumber ); |
|
269 |
TAny* params[ KOneParam ]; |
|
270 |
params[ KFirstParam ] = reinterpret_cast< TAny* >( &iChannelNumber ); |
|
271 |
error = DoControl( EIADLoan, params ); |
|
272 |
TRACE_ASSERT_ALWAYS_COND( KErrNone == error ); |
|
273 |
if( KErrNone != error ) |
|
274 |
{ |
|
275 |
C_TRACE( ( _T( "RIscApi::Loan loan failed. closing the handle.." ) ) ); |
|
276 |
OstTrace0( TRACE_NORMAL, DUY3_RISCAPI_LOAN, "RIscApi::Loan loan failed. closing the handle.." ); |
|
277 |
RHandleBase::Close(); |
|
278 |
} |
|
279 |
} |
|
280 |
TRACE_ASSERT_ALWAYS_COND( KErrNone == error ); |
|
281 |
OstTraceExt1( TRACE_NORMAL, RISCAPI_LOAN_EXIT, "<RIscApi::Loan;iChannelNumber=%hx", iChannelNumber ); |
|
282 |
C_TRACE( ( _T( "RIscApi::Loan 0x%x %d<-" ), iChannelNumber, error ) ); |
|
283 |
return error; |
|
284 |
||
285 |
} |
|
286 |
||
287 |
EXPORT_C void RIscApi::ReturnLoan( |
|
288 |
const TUint16 // aChannelNumber |
|
289 |
// None |
|
290 |
) |
|
291 |
{ |
|
292 |
||
293 |
C_TRACE( ( _T( "RIscApi::ReturnLoan 0x%x ->" ), iChannelNumber ) ); |
|
294 |
OstTraceExt1( TRACE_NORMAL, RISCAPI_RETURNLOAN_ENTRY, ">RIscApi::Loan;iChannelNumber=%hx", iChannelNumber ); |
|
295 |
PanicIfNotOpen(); |
|
296 |
if( iChannelNumber < EIADNokiaLastUserChannel ) |
|
297 |
{ |
|
298 |
TInt ret( DoControl( EIADReturnLoan ) ); |
|
299 |
ASSERT_PANIC_ALWAYS( KErrNone == ret, EIADReturnLoan ); |
|
300 |
iChannelNumber = KNotInitializedChannel; |
|
301 |
RHandleBase::Close();// Close the channel handle. |
|
302 |
} |
|
303 |
OstTraceExt1( TRACE_NORMAL, RISCAPI_RETURNLOAN_EXIT, "<RIscApi::Loan;iChannelNumber=%hx", iChannelNumber ); |
|
304 |
C_TRACE( ( _T( "RIscApi::ReturnLoan 0x%x %d<-" ), iChannelNumber ) ); |
|
305 |
||
306 |
} |
|
307 |
#endif |
|
308 |
||
309 |
// ----------------------------------------------------------------------------- |
|
310 |
// RIscApi::OpenCancel |
|
311 |
// Cancel asynchronous channel opening |
|
312 |
// ( other items were commented in a header ). |
|
313 |
// ----------------------------------------------------------------------------- |
|
314 |
// |
|
315 |
EXPORT_C void RIscApi::OpenCancel( |
|
316 |
// None |
|
317 |
) |
|
318 |
{ |
|
319 |
OstTraceExt1( TRACE_NORMAL, RISCAPI_OPENCANCEL_ENTRY, ">RIscApi::OpenCancel;iChannelNumber=%hx", iChannelNumber ); |
|
320 |
||
321 |
C_TRACE( ( _T( "RIscApi::OpenCancel 0x%x ->" ), iChannelNumber ) ); |
|
322 |
PanicIfNotOpen(); |
|
323 |
DoCancel( EIADAsyncOpen ); |
|
324 |
Close(); |
|
325 |
C_TRACE( ( _T( "RIscApi::OpenCancel 0x%x <-" ), iChannelNumber ) ); |
|
326 |
||
327 |
OstTrace0( TRACE_NORMAL, RISCAPI_OPENCANCEL_EXIT, "<RIscApi::OpenCancel" ); |
|
328 |
} |
|
329 |
||
330 |
// ----------------------------------------------------------------------------- |
|
331 |
// RIscApi::Close |
|
332 |
// Close ISC Channel |
|
333 |
// ( other items were commented in a header ). |
|
334 |
// ----------------------------------------------------------------------------- |
|
335 |
// |
|
336 |
EXPORT_C void RIscApi::Close( |
|
337 |
// None |
|
338 |
) |
|
339 |
{ |
|
340 |
OstTraceExt1( TRACE_NORMAL, RISCAPI_CLOSE_ENTRY, ">RIscApi::Close;iChannelNumber=%hx", iChannelNumber ); |
|
341 |
||
342 |
||
343 |
C_TRACE( ( _T( "RIscApi::Close 0x%x 0x%x ->" ), iChannelNumber, this ) ); |
|
344 |
if( iChannelNumber < EIADNokiaLastUserChannel ) |
|
345 |
{ |
|
346 |
PanicIfNotOpen(); |
|
347 |
TInt ret( DoControl( EIADClose ) ); |
|
348 |
ASSERT_PANIC_ALWAYS( KErrNone == ret, EIADCloseFailed ); |
|
349 |
iChannelNumber = KNotInitializedChannel; |
|
350 |
C_TRACE( ( _T( "RIscApi::Close close handle" ) ) ); |
|
351 |
OstTrace0( TRACE_NORMAL, RISCAPI_CLOSE, "RIscApi::Close close handle" ); |
|
352 |
RHandleBase::Close(); |
|
353 |
} |
|
354 |
else |
|
355 |
{ |
|
356 |
C_TRACE((_T("RIscApi::Close error: channel number out of range"))); |
|
357 |
OstTrace0( TRACE_NORMAL, DUP1_RISCAPI_CLOSE, "RIscApi::Close channelnumber out of range" ); |
|
358 |
// TRACE_ASSERT_ALWAYS; TODO: Trace assert? |
|
359 |
} |
|
360 |
C_TRACE( ( _T( "RIscApi::Close 0x%x <-" ), iChannelNumber ) ); |
|
361 |
||
362 |
OstTrace0( TRACE_NORMAL, RISCAPI_CLOSE_EXIT, "<RIscApi::Close" ); |
|
363 |
} |
|
364 |
||
365 |
// ----------------------------------------------------------------------------- |
|
366 |
// RIscApi::Close |
|
367 |
// Close ISC Channel |
|
368 |
// ( other items were commented in a header ). |
|
369 |
// ----------------------------------------------------------------------------- |
|
370 |
// |
|
371 |
EXPORT_C void RIscApi::Close( |
|
372 |
TRequestStatus& aStatus |
|
373 |
) |
|
374 |
{ |
|
375 |
OstTraceExt2( TRACE_NORMAL, DUP1_RISCAPI_CLOSE_ENTRY, ">RIscApi::Close;aStatus=%x;iChannelNumber=%hx", ( TUint )&( aStatus ), iChannelNumber ); |
|
376 |
||
377 |
C_TRACE( ( _T( "RIscApi::Close 0x%x 0x%x ->" ), iChannelNumber, &aStatus ) ); |
|
378 |
if( iChannelNumber < EIADNokiaLastUserChannel ) |
|
379 |
{ |
|
380 |
PanicIfNotOpen(); |
|
381 |
aStatus = KRequestPending; |
|
382 |
TAny* params[ KOneParam ]; |
|
383 |
params[ KFirstParam ] = reinterpret_cast< TAny* >( &aStatus ); |
|
384 |
TInt ret( DoControl( EIADAsyncClose, params ) ); |
|
385 |
ASSERT_PANIC_ALWAYS( KErrNone == ret, EIADCloseFailed ); |
|
386 |
iChannelNumber = KNotInitializedChannel; |
|
387 |
C_TRACE( ( _T( "RIscApi::Close a close handle" ) ) ); |
|
388 |
RHandleBase::Close();// Added handle close |
|
389 |
} |
|
390 |
else |
|
391 |
{ |
|
392 |
C_TRACE((_T("RIscApi::Close error: channel number out of range"))); |
|
393 |
TRequestStatus* ptrStatus = &aStatus; |
|
394 |
User::RequestComplete( ptrStatus, KErrNotReady ); |
|
395 |
} |
|
396 |
C_TRACE( ( _T( "RIscApi::Close 0x%x 0x%x <-" ), iChannelNumber, &aStatus ) ); |
|
397 |
||
398 |
OstTrace0( TRACE_NORMAL, DUP1_RISCAPI_CLOSE_EXIT, "<RIscApi::Close" ); |
|
399 |
} |
|
400 |
||
401 |
// ----------------------------------------------------------------------------- |
|
402 |
// RIscApi::ResetBuffers |
|
403 |
// Resets buffers. |
|
404 |
// ( other items were commented in a header ). |
|
405 |
// ----------------------------------------------------------------------------- |
|
406 |
// |
|
407 |
EXPORT_C void RIscApi::ResetBuffers( |
|
408 |
// None |
|
409 |
) |
|
410 |
{ |
|
411 |
OstTraceExt1( TRACE_NORMAL, RISCAPI_RESETBUFFERS_ENTRY, ">RIscApi::ResetBuffers;iChannelNumber=%hx", iChannelNumber ); |
|
412 |
||
413 |
C_TRACE( ( _T( "RIscApi::ResetBuffers 0x%x ->" ), iChannelNumber ) ); |
|
414 |
PanicIfNotOpen(); |
|
415 |
TRACE_ASSERT_ALWAYS_COND( KErrNone == DoControl( EIADResetQueues ) ); |
|
416 |
C_TRACE( ( _T( "RIscApi::ResetBuffers <-" ) ) ); |
|
417 |
||
418 |
OstTrace0( TRACE_NORMAL, RISCAPI_RESETBUFFERS_EXIT, "<RIscApi::ResetBuffers" ); |
|
419 |
} |
|
420 |
||
421 |
// ----------------------------------------------------------------------------- |
|
422 |
// RIscApi::Send |
|
423 |
// Send data to Domestic OS ( asynchronous ) |
|
424 |
// ( other items were commented in a header ). |
|
425 |
// ----------------------------------------------------------------------------- |
|
426 |
// |
|
427 |
EXPORT_C void RIscApi::Send( |
|
428 |
TRequestStatus& aStatus, |
|
429 |
const TDesC8& aData |
|
430 |
) |
|
431 |
{ |
|
432 |
OstTraceExt2( TRACE_NORMAL, RISCAPI_SEND_ENTRY, ">RIscApi::Send;aStatus=%x;aData=%x", ( TUint )&( aStatus ), ( TUint )&( aData ) ); |
|
433 |
||
434 |
C_TRACE( ( _T( "RIscApi::Send a 0x%x 0x%x 0x%x this 0x%x ->" ), |
|
435 |
iChannelNumber, &aStatus, &aData, this ) ); |
|
436 |
PanicIfNotOpen(); |
|
437 |
TAny* params[ KTwoParams ]; |
|
438 |
params[ KFirstParam ] = reinterpret_cast<TAny*>( &aStatus ); |
|
439 |
params[ KSecondParam ] = reinterpret_cast<TAny*>( const_cast<TDesC8*>( &aData )); |
|
440 |
aStatus = KRequestPending; |
|
441 |
DoControl( EIADAsyncSend, params ); |
|
442 |
C_TRACE( ( _T( "RIscApi::Send <-" ) ) ); |
|
443 |
||
444 |
OstTrace0( TRACE_NORMAL, RISCAPI_SEND_EXIT, "<RIscApi::Send" ); |
|
445 |
} |
|
446 |
||
447 |
// ----------------------------------------------------------------------------- |
|
448 |
// RIscApi::Send |
|
449 |
// Send data to Domestic OS ( synchronous ) |
|
450 |
// ( other items were commented in a header ). |
|
451 |
// ----------------------------------------------------------------------------- |
|
452 |
// |
|
453 |
EXPORT_C TInt RIscApi::Send( |
|
454 |
const TDesC8& aData |
|
455 |
) |
|
456 |
{ |
|
457 |
OstTraceExt2( TRACE_NORMAL, DUP1_RISCAPI_SEND_ENTRY, ">RIscApi::Send;aData=%x;iChannelNumber=%hx", ( TUint )&( aData ), iChannelNumber ); |
|
458 |
||
459 |
C_TRACE( ( _T( "RIscApi::Send 0x%x 0x%x 0x%x ->" ), iChannelNumber, &aData, this ) ); |
|
460 |
PanicIfNotOpen(); |
|
461 |
TAny* params[ KOneParam ]; |
|
462 |
params[ KFirstParam ] = reinterpret_cast<TAny*>( &( const_cast<TDesC8&>( aData ) ) ); |
|
463 |
TInt error( DoControl( EIADSend, params ) ); |
|
464 |
C_TRACE( ( _T( "RIscApi::Send 0x%x 0x%x 0x%x %d <-" ), iChannelNumber, &aData, this, error ) ); |
|
465 |
||
466 |
OstTrace1( TRACE_NORMAL, DUP1_RISCAPI_SEND_EXIT, "<RIscApi::Send;return=%d", error ); |
|
467 |
return error; |
|
468 |
} |
|
469 |
||
470 |
// ----------------------------------------------------------------------------- |
|
471 |
// RIscApi::SendCancel |
|
472 |
// Cancel asynchronous Send request |
|
473 |
// ( other items were commented in a header ). |
|
474 |
// ----------------------------------------------------------------------------- |
|
475 |
// |
|
476 |
EXPORT_C void RIscApi::SendCancel( |
|
477 |
// None |
|
478 |
) |
|
479 |
{ |
|
480 |
OstTraceExt1( TRACE_NORMAL, RISCAPI_SENDCANCEL_ENTRY, ">RIscApi::SendCancel;iChannelNumber=%hx", iChannelNumber ); |
|
481 |
||
482 |
C_TRACE( ( _T( "RIscApi::SendCancel 0x%x ->" ), iChannelNumber ) ); |
|
483 |
PanicIfNotOpen(); |
|
484 |
DoCancel( EIADAsyncSend ); |
|
485 |
C_TRACE( ( _T( "RIscApi::SendCancel <-" ) ) ); |
|
486 |
||
487 |
OstTrace0( TRACE_NORMAL, RISCAPI_SENDCANCEL_EXIT, "<RIscApi::SendCancel"); |
|
488 |
} |
|
489 |
||
490 |
// ----------------------------------------------------------------------------- |
|
491 |
// RIscApi::Receive |
|
492 |
// Receive data from Domestic OS |
|
493 |
// ( other items were commented in a header ). |
|
494 |
// ----------------------------------------------------------------------------- |
|
495 |
// |
|
496 |
EXPORT_C void RIscApi::Receive( |
|
497 |
TRequestStatus& aStatus, |
|
498 |
TDes8& aData, |
|
499 |
TUint16& aNeededBufLen |
|
500 |
) |
|
501 |
{ |
|
502 |
OstTraceExt4( TRACE_NORMAL, RISCAPI_RECEIVE_ENTRY, ">RIscApi::Receive;aStatus=%x;aData=%x;aNeededBufLen=%hu;iChannelNumber=%hx", ( TUint )&( aStatus ), ( TUint )&( aData ), aNeededBufLen, iChannelNumber ); |
|
503 |
||
504 |
C_TRACE( ( _T( "RIscApi::Receive 0x%x, 0x%x, 0x%x 0x%x this 0x%x ->" ), &aStatus, &aData, aNeededBufLen, iChannelNumber, this ) ); |
|
505 |
PanicIfNotOpen(); |
|
506 |
TAny* params[ KThreeParams ]; |
|
507 |
// Set status pending, just in case client haven't done it. |
|
508 |
aStatus = KRequestPending; |
|
509 |
params[ KFirstParam ] = reinterpret_cast<TAny*>( &aStatus ); |
|
510 |
params[ KSecondParam ] = reinterpret_cast<TAny*>( &aData ); |
|
511 |
params[ KThirdParam ] = reinterpret_cast<TAny*>( &aNeededBufLen ); |
|
512 |
DoControl( EIADAsyncReceive, params ); |
|
513 |
C_TRACE( ( _T( "RIscApi::Receive 0x%x this 0x%x <-" ), iChannelNumber, this ) ); |
|
514 |
||
515 |
OstTrace0( TRACE_NORMAL, RISCAPI_RECEIVE_EXIT, "<RIscApi::Receive" ); |
|
516 |
} |
|
517 |
||
518 |
// ----------------------------------------------------------------------------- |
|
519 |
// RIscApi::ReceiveCancel |
|
520 |
// Cancel data receiving from Domestic OS |
|
521 |
// ( other items were commented in a header ). |
|
522 |
// ----------------------------------------------------------------------------- |
|
523 |
// |
|
524 |
EXPORT_C void RIscApi::ReceiveCancel( |
|
525 |
// None |
|
526 |
) |
|
527 |
{ |
|
528 |
OstTraceExt1( TRACE_NORMAL, RISCAPI_RECEIVECANCEL_ENTRY, ">RIscApi::ReceiveCancel;iChannelNumber=%hx", iChannelNumber ); |
|
529 |
||
530 |
C_TRACE( ( _T( "RIscApi::ReceiveCancel 0x%x ->"), iChannelNumber ) ); |
|
531 |
PanicIfNotOpen(); |
|
532 |
DoCancel( EIADAsyncReceive ); |
|
533 |
C_TRACE( ( _T( "RIscApi::ReceiveCancel <-") ) ); |
|
534 |
||
535 |
OstTrace0( TRACE_NORMAL, RISCAPI_RECEIVECANCEL_EXIT, "<RIscApi::ReceiveCancel" ); |
|
536 |
} |
|
537 |
||
538 |
// ----------------------------------------------------------------------------- |
|
539 |
// RIscApi::DataReceiveCancel |
|
540 |
// Cancel data receiving from Domestic OS |
|
541 |
// ( other items were commented in a header ). |
|
542 |
// ----------------------------------------------------------------------------- |
|
543 |
// |
|
544 |
EXPORT_C void RIscApi::DataReceiveCancel( |
|
545 |
// None |
|
546 |
) |
|
547 |
{ |
|
548 |
OstTraceExt1( TRACE_NORMAL, RISCAPI_DATARECEIVECANCEL_ENTRY, ">RIscApi::DataReceiveCancel;iChannelNumber=%hx", iChannelNumber ); |
|
549 |
||
550 |
C_TRACE( ( _T( "RIscApi::DataReceiveCancel 0x%x ->" ), iChannelNumber ) ); |
|
551 |
PanicIfNotOpen(); |
|
552 |
DoCancel( EIADAsyncDataReceive ); |
|
553 |
C_TRACE( ( _T( "RIscApi::DataReceiveCancel <-" ) ) ); |
|
554 |
||
555 |
OstTrace0( TRACE_NORMAL, RISCAPI_DATARECEIVECANCEL_EXIT, "<RIscApi::DataReceiveCancel" ); |
|
556 |
} |
|
557 |
||
558 |
// ----------------------------------------------------------------------------- |
|
559 |
// RIscApi::ConnectionStatus |
|
560 |
// Get the current connection status |
|
561 |
// ( other items were commented in a header ). |
|
562 |
// ----------------------------------------------------------------------------- |
|
563 |
// |
|
564 |
EXPORT_C TInt RIscApi::ConnectionStatus( |
|
565 |
// None |
|
566 |
) |
|
567 |
{ |
|
568 |
OstTraceExt1( TRACE_NORMAL, RISCAPI_CONNECTIONSTATUS_ENTRY, ">RIscApi::ConnectionStatus;iChannelNumber=%hx", iChannelNumber ); |
|
569 |
||
570 |
C_TRACE( ( _T( "RIscApi::ConnectionStatus 0x%x ->" ), iChannelNumber ) ); |
|
571 |
PanicIfNotOpen(); |
|
572 |
TInt connStatus( DoControl( EIADGetConnectionStatus ) ); |
|
573 |
C_TRACE( ( _T( "RIscApi::ConnectionStatus 0x%x %d <-" ), iChannelNumber, connStatus ) ); |
|
574 |
||
575 |
OstTrace1( TRACE_NORMAL, RISCAPI_CONNECTIONSTATUS_EXIT, "<RIscApi::ConnectionStatus;return=%d", connStatus ); |
|
576 |
return connStatus; |
|
577 |
} |
|
578 |
||
579 |
// ----------------------------------------------------------------------------- |
|
580 |
// RIscApi::NotifyConnectionStatus |
|
581 |
// Listen for connection status changes |
|
582 |
// ( other items were commented in a header ). |
|
583 |
// ----------------------------------------------------------------------------- |
|
584 |
// |
|
585 |
EXPORT_C void RIscApi::NotifyConnectionStatus( |
|
586 |
TRequestStatus& aStatus, |
|
587 |
TInt& aConnectionStatus |
|
588 |
) |
|
589 |
{ |
|
590 |
OstTraceExt3( TRACE_NORMAL, RISCAPI_NOTIFYCONNECTIONSTATUS_ENTRY, ">RIscApi::NotifyConnectionStatus;aStatus=%x;aConnectionStatus=%d;iChannelNumber=%hx", ( TUint )&( aStatus ), aConnectionStatus, iChannelNumber ); |
|
591 |
||
592 |
C_TRACE( ( _T( "RIscApi::NotifyConnectionStatus 0x%x, 0x%x 0x%x ->" ), &aStatus, aConnectionStatus, iChannelNumber ) ); |
|
593 |
PanicIfNotOpen(); |
|
594 |
TAny* params[ KTwoParams ]; |
|
595 |
aStatus = KRequestPending; |
|
596 |
params[ KFirstParam ] = reinterpret_cast<TAny*>( &aStatus ); |
|
597 |
params[ KSecondParam ] = reinterpret_cast<TAny*>( &aConnectionStatus ); |
|
598 |
DoControl( EIADAsyncNotifyConnectionStatus, params ); |
|
599 |
C_TRACE( ( _T( "RIscApi::NotifyConnectionStatus <-" ) ) ); |
|
600 |
||
601 |
OstTrace0( TRACE_NORMAL, RISCAPI_NOTIFYCONNECTIONSTATUS_EXIT, "<RIscApi::NotifyConnectionStatus" ); |
|
602 |
} |
|
603 |
||
604 |
// ----------------------------------------------------------------------------- |
|
605 |
// RIscApi::NotifyConnectionStatusCancel |
|
606 |
// Stop listening for connection status changes |
|
607 |
// ( other items were commented in a header ). |
|
608 |
// ----------------------------------------------------------------------------- |
|
609 |
// |
|
610 |
EXPORT_C void RIscApi::NotifyConnectionStatusCancel( |
|
611 |
// None |
|
612 |
) |
|
613 |
{ |
|
614 |
OstTraceExt1( TRACE_NORMAL, RISCAPI_NOTIFYCONNECTIONSTATUSCANCEL_ENTRY, ">RIscApi::NotifyConnectionStatusCancel;iChannelNumber=%hx", iChannelNumber ); |
|
615 |
||
616 |
C_TRACE( ( _T( "RIscApi::NotifyConnectionStatusCancel 0x%x ->" ), iChannelNumber ) ); |
|
617 |
PanicIfNotOpen(); |
|
618 |
DoCancel( EIADAsyncNotifyConnectionStatus ); |
|
619 |
C_TRACE( ( _T( "RIscApi::NotifyConnectionStatusCancel 0x%x <-" ), iChannelNumber ) ); |
|
620 |
||
621 |
OstTrace0( TRACE_NORMAL, RISCAPI_NOTIFYCONNECTIONSTATUSCANCEL_EXIT, "<RIscApi::NotifyConnectionStatusCancel" ); |
|
622 |
} |
|
623 |
||
624 |
||
625 |
// ----------------------------------------------------------------------------- |
|
626 |
// RIscApi::CustomFunction |
|
627 |
// Asynchronous API extension function |
|
628 |
// ( other items were commented in a header ). |
|
629 |
// ----------------------------------------------------------------------------- |
|
630 |
// |
|
631 |
EXPORT_C void RIscApi::CustomFunction( |
|
632 |
TRequestStatus& aStatus, |
|
633 |
const TUint16 aOperation, |
|
634 |
TAny* aParameters |
|
635 |
) |
|
636 |
{ |
|
637 |
OstTraceExt4( TRACE_NORMAL, RISCAPI_CUSTOMFUNCTION_ENTRY, ">RIscApi::CustomFunction;aStatus=%x;aOperation=%hu;aParameters=%x;iChannelNumber=%hx", ( TUint )&( aStatus ), aOperation, ( TUint )( aParameters ), iChannelNumber ); |
|
638 |
||
639 |
C_TRACE( ( _T( "RIscApi::CustomFunction a %d 0x%x 0x%x 0x%x 0x%x ->"), aOperation, aParameters, &aStatus, iChannelNumber, this ) ); |
|
640 |
PanicIfNotOpen(); |
|
641 |
TAny* params[ KTwoParams ]; |
|
642 |
aStatus = KRequestPending; |
|
643 |
params[ KFirstParam ] = reinterpret_cast<TAny*>( &aStatus ); |
|
644 |
params[ KSecondParam ] = aParameters; |
|
645 |
TUint16 operation( 0xffff ); |
|
646 |
switch( aOperation ) |
|
647 |
{ |
|
648 |
case EIADCustomAsyncSubscribeIndications: |
|
649 |
{ |
|
650 |
operation = EIADAsyncSubscribeIndications; |
|
651 |
break; |
|
652 |
} |
|
653 |
case EIADCustomAsyncSubscribeIndications32Bit: |
|
654 |
{ |
|
655 |
operation = EIADAsyncSubscribeIndications32Bit; |
|
656 |
break; |
|
657 |
} |
|
658 |
case EIADCustomAsyncSendIndication: |
|
659 |
{ |
|
660 |
operation = EIADAsyncSendIndication; |
|
661 |
break; |
|
662 |
} |
|
663 |
default: |
|
664 |
{ |
|
665 |
ASSERT_PANIC_ALWAYS( 0, EIADWrongCustomFunction ); |
|
666 |
break; |
|
667 |
} |
|
668 |
} |
|
669 |
DoControl( operation, params ); |
|
670 |
C_TRACE( ( _T( "RIscApi::CustomFunction %d 0x%x 0x%x 0x%x 0x%x <-"), aOperation, aParameters, &aStatus, iChannelNumber, this ) ); |
|
671 |
||
672 |
OstTrace0( TRACE_NORMAL, RISCAPI_CUSTOMFUNCTION_EXIT, "<RIscApi::CustomFunction" ); |
|
673 |
} |
|
674 |
||
675 |
// ----------------------------------------------------------------------------- |
|
676 |
// RIscApi::CustomFunction |
|
677 |
// Synchronous API extension function |
|
678 |
// ( other items were commented in a header ). |
|
679 |
// ----------------------------------------------------------------------------- |
|
680 |
// |
|
681 |
EXPORT_C TInt RIscApi::CustomFunction( |
|
682 |
const TUint16 aOperation, |
|
683 |
TAny* aParameters |
|
684 |
) |
|
685 |
{ |
|
686 |
OstTraceExt3( TRACE_NORMAL, DUP1_RISCAPI_CUSTOMFUNCTION_ENTRY, ">RIscApi::CustomFunction;aOperation=%hu;aParameters=%x;iChannelNumber=%hx", aOperation, ( TUint )( aParameters ), iChannelNumber ); |
|
687 |
||
688 |
C_TRACE( ( _T( "RIscApi::CustomFunction %d 0x%x 0x%x 0x%x ->"), aOperation, aParameters, iChannelNumber, this ) ); |
|
689 |
PanicIfNotOpen(); |
|
690 |
TAny* params[ KOneParam ]; |
|
691 |
params[ KFirstParam ] = aParameters; |
|
692 |
TUint16 operation( 0xffff ); |
|
693 |
switch( aOperation ) |
|
694 |
{ |
|
695 |
case EIADCustomSubscribeIndications: |
|
696 |
{ |
|
697 |
operation = EIADSubscribeIndications; |
|
698 |
break; |
|
699 |
} |
|
700 |
case EIADCustomSubscribeIndications32Bit: |
|
701 |
{ |
|
702 |
operation = EIADSubscribeIndications32Bit; |
|
703 |
break; |
|
704 |
} |
|
705 |
case EIADCustomSendIndication: |
|
706 |
{ |
|
707 |
operation = EIADSendIndication; |
|
708 |
break; |
|
709 |
} |
|
710 |
default: |
|
711 |
{ |
|
712 |
ASSERT_PANIC_ALWAYS( 0, EIADWrongCustomFunction ); |
|
713 |
break; |
|
714 |
} |
|
715 |
} |
|
716 |
TInt error( DoControl( operation, params ) ); |
|
717 |
C_TRACE( ( _T( "RIscApi::CustomFunction %d 0x%x %d 0x%x <-" ), aOperation, iChannelNumber, error, this ) ); |
|
718 |
||
719 |
OstTrace1( TRACE_NORMAL, DUP1_RISCAPI_CUSTOMFUNCTION_EXIT, "<RIscApi::CustomFunction;return=%d", error ); |
|
720 |
return error; |
|
721 |
} |
|
722 |
||
723 |
// ----------------------------------------------------------------------------- |
|
724 |
// RIscApi::CustomFunctionCancel |
|
725 |
// Cancel the execution of the asynchronous API extension function |
|
726 |
// ( other items were commented in a header ). |
|
727 |
// ----------------------------------------------------------------------------- |
|
728 |
// |
|
729 |
EXPORT_C void RIscApi::CustomFunctionCancel( |
|
730 |
const TUint16 aOperation |
|
731 |
) |
|
732 |
{ |
|
733 |
OstTraceExt2( TRACE_NORMAL, RISCAPI_CUSTOMFUNCTIONCANCEL_ENTRY, ">RIscApi::CustomFunctionCancel;aOperation=%hu;iChannelNumber=%hx", aOperation, iChannelNumber ); |
|
734 |
||
735 |
C_TRACE( ( _T( "RIscApi::CustomFunctionCancel 0x%x 0x%x ->" ), aOperation, iChannelNumber ) ); |
|
736 |
PanicIfNotOpen(); |
|
737 |
TUint16 operation( 0xffff ); |
|
738 |
switch( aOperation ) |
|
739 |
{ |
|
740 |
case EIADCancelCustomAsyncSubscribeIndications: |
|
741 |
{ |
|
742 |
operation = EIADAsyncSubscribeIndications; |
|
743 |
break; |
|
744 |
} |
|
745 |
case EIADCancelCustomAsyncSubscribeIndications32Bit: |
|
746 |
{ |
|
747 |
operation = EIADAsyncSubscribeIndications32Bit; |
|
748 |
break; |
|
749 |
} |
|
750 |
case EIADCancelCustomAsyncSendIndication: |
|
751 |
{ |
|
752 |
operation = EIADAsyncSendIndication; |
|
753 |
break; |
|
754 |
} |
|
755 |
default: |
|
756 |
{ |
|
757 |
ASSERT_PANIC_ALWAYS( 0, EIADWrongCustomFunction ); |
|
758 |
break; |
|
759 |
} |
|
760 |
} |
|
761 |
DoCancel( operation ); |
|
762 |
C_TRACE( ( _T( "RIscApi::CustomFunctionCancel <-" ) ) ); |
|
763 |
||
764 |
OstTrace0( TRACE_NORMAL, RISCAPI_CUSTOMFUNCTIONCANCEL_EXIT, "<RIscApi::CustomFunctionCancel" ); |
|
765 |
} |
|
766 |
||
767 |
// ----------------------------------------------------------------------------- |
|
768 |
// RIscApi::DataSend |
|
769 |
// Send data to Domestic OS ( asynchronous ) |
|
770 |
// ( other items were commented in a header ). |
|
771 |
// ----------------------------------------------------------------------------- |
|
772 |
// |
|
773 |
EXPORT_C void RIscApi::DataSend( |
|
774 |
TRequestStatus& aStatus, |
|
775 |
const TDesC8& aData |
|
776 |
) |
|
777 |
{ |
|
778 |
OstTraceExt3( TRACE_NORMAL, RISCAPI_DATASEND_ENTRY, ">RIscApi::DataSend;aStatus=%x;aData=%x;iChannelNumber=%hx", ( TUint )&( aStatus ), ( TUint )&( aData ), iChannelNumber ); |
|
779 |
||
780 |
C_TRACE( ( _T( "RIscApi::DataSend a 0x%x 0x%x 0x%x ->" ), &aStatus, &aData, iChannelNumber ) ); |
|
781 |
PanicIfNotOpen(); |
|
782 |
TAny* params[ KTwoParams ]; |
|
783 |
params[ KFirstParam ] = reinterpret_cast<TAny*>( &aStatus ); |
|
784 |
params[ KSecondParam ] = reinterpret_cast<TAny*>( const_cast<TDesC8*>( &aData )); |
|
785 |
aStatus = KRequestPending; |
|
786 |
DoControl( EIADAsyncDataSend, params ); |
|
787 |
C_TRACE( ( _T( "RIscApi::DataSend <-" ) ) ); |
|
788 |
||
789 |
OstTrace0( TRACE_NORMAL, RISCAPI_DATASEND_EXIT, "<RIscApi::DataSend" ); |
|
790 |
} |
|
791 |
||
792 |
// ----------------------------------------------------------------------------- |
|
793 |
// RIscApi::DataSend |
|
794 |
// Send data to Domestic OS ( synchronous ) |
|
795 |
// ( other items were commented in a header ). |
|
796 |
// ----------------------------------------------------------------------------- |
|
797 |
// |
|
798 |
EXPORT_C TInt RIscApi::DataSend( |
|
799 |
const TDesC8& aData |
|
800 |
) |
|
801 |
{ |
|
802 |
OstTraceExt2( TRACE_NORMAL, DUP1_RISCAPI_DATASEND_ENTRY, ">RIscApi::DataSend;aData=%x;iChannelNumber=%hx", ( TUint )&( aData ), iChannelNumber ); |
|
803 |
||
804 |
C_TRACE( ( _T( "RIscApi::DataSend 0x%x 0x%x" ), &aData, iChannelNumber ) ); |
|
805 |
PanicIfNotOpen(); |
|
806 |
TAny* params[ KOneParam ]; |
|
807 |
params[ KFirstParam ] = reinterpret_cast<TAny*>( &( const_cast<TDesC8&>( aData ) ) ); |
|
808 |
TInt error( DoControl( EIADDataSend, params ) ); |
|
809 |
C_TRACE( ( _T( "RIscApi::DataSend %d <-" ), error ) ); |
|
810 |
||
811 |
OstTrace1( TRACE_NORMAL, DUP1_RISCAPI_DATASEND_EXIT, "<RIscApi::DataSend;return=%d", error ); |
|
812 |
return error; |
|
813 |
} |
|
814 |
||
815 |
// ----------------------------------------------------------------------------- |
|
816 |
// RIscApi::DataSendCancel |
|
817 |
// Cancel asynchronous DataSend request |
|
818 |
// ( other items were commented in a header ). |
|
819 |
// ----------------------------------------------------------------------------- |
|
820 |
// |
|
821 |
EXPORT_C void RIscApi::DataSendCancel( |
|
822 |
// None |
|
823 |
) |
|
824 |
{ |
|
825 |
OstTraceExt1( TRACE_NORMAL, RISCAPI_DATASENDCANCEL_ENTRY, ">RIscApi::DataSendCancel;iChannelNumber=%hx", iChannelNumber ); |
|
826 |
||
827 |
C_TRACE( ( _T( "RIscApi::DataSendCancel 0x%x ->" ), iChannelNumber ) ); |
|
828 |
PanicIfNotOpen(); |
|
829 |
DoCancel( EIADAsyncDataSend ); |
|
830 |
C_TRACE( ( _T( "RIscApi::DataSendCancel <-" ) ) ); |
|
831 |
||
832 |
OstTrace0( TRACE_NORMAL, RISCAPI_DATASENDCANCEL_EXIT, "<RIscApi::DataSendCancel" ); |
|
833 |
} |
|
834 |
||
835 |
// ----------------------------------------------------------------------------- |
|
836 |
// RIscApi::DataReceive |
|
837 |
// Receive data from Domestic OS |
|
838 |
// ( other items were commented in a header ). |
|
839 |
// ----------------------------------------------------------------------------- |
|
840 |
// |
|
841 |
EXPORT_C void RIscApi::DataReceive( |
|
842 |
TRequestStatus& aStatus, |
|
843 |
TDes8& aData, |
|
844 |
TUint16& aNeededBufLen |
|
845 |
) |
|
846 |
{ |
|
847 |
OstTraceExt4( TRACE_NORMAL, RISCAPI_DATARECEIVE_ENTRY, ">RIscApi::DataReceive;aStatus=%x;aData=%x;aNeededBufLen=%hu;iChannelNumber=%hx", ( TUint )&( aStatus ), ( TUint )&( aData ), aNeededBufLen, iChannelNumber ); |
|
848 |
||
849 |
C_TRACE( ( _T( "RIscApi::DataReceive 0x%x 0x%x 0x%x 0x%x ->" ), &aStatus, &aData, aNeededBufLen, iChannelNumber ) ); |
|
850 |
PanicIfNotOpen(); |
|
851 |
TAny* params[ KThreeParams ]; |
|
852 |
// Set status pending, just in case client haven't done it. |
|
853 |
aStatus = KRequestPending; |
|
854 |
params[ KFirstParam ] = reinterpret_cast<TAny*>( &aStatus ); |
|
855 |
params[ KSecondParam ] = reinterpret_cast<TAny*>( &aData ); |
|
856 |
params[ KThirdParam ] = reinterpret_cast<TAny*>( &aNeededBufLen ); |
|
857 |
DoControl( EIADAsyncDataReceive, params ); |
|
858 |
C_TRACE( ( _T( "RIscApi::DataReceive 0x%x <-" ), iChannelNumber ) ); |
|
859 |
||
860 |
OstTrace0( TRACE_NORMAL, RISCAPI_DATARECEIVE_EXIT, "<RIscApi::DataReceive" ); |
|
861 |
} |
|
862 |
||
863 |
// ----------------------------------------------------------------------------- |
|
864 |
// RIscApi::FlowControlStatus |
|
865 |
// Get the current flow control status ( in uplink-direction ) |
|
866 |
// ( other items were commented in a header ). |
|
867 |
// ----------------------------------------------------------------------------- |
|
868 |
// |
|
869 |
EXPORT_C TInt RIscApi::FlowControlStatus( |
|
870 |
// None |
|
871 |
) |
|
872 |
{ |
|
873 |
OstTraceExt1( TRACE_NORMAL, RISCAPI_FLOWCONTROLSTATUS_ENTRY, ">RIscApi::FlowControlStatus;iChannelNumber=%hx", iChannelNumber ); |
|
874 |
||
875 |
||
876 |
C_TRACE( ( _T( "RIscApi::FlowControlStatus 0x%x ->" ), iChannelNumber ) ); |
|
877 |
PanicIfNotOpen(); |
|
878 |
TInt error( DoControl( EIADGetFlowControlStatus ) ); |
|
879 |
C_TRACE( ( _T( "RIscApi::FlowControlStatus 0x%x %d <-" ), iChannelNumber, error ) ); |
|
880 |
||
881 |
OstTrace1( TRACE_NORMAL, RISCAPI_FLOWCONTROLSTATUS_EXIT, "<RIscApi::FlowControlStatus;return=%d", error ); |
|
882 |
return error; |
|
883 |
} |
|
884 |
||
885 |
||
886 |
// ----------------------------------------------------------------------------- |
|
887 |
// RIscApi::NotifyFlowControl |
|
888 |
// Listen for flow control status changes |
|
889 |
// ( other items were commented in a header ). |
|
890 |
// ----------------------------------------------------------------------------- |
|
891 |
// |
|
892 |
EXPORT_C void RIscApi::NotifyFlowControl( |
|
893 |
TRequestStatus& aStatus, |
|
894 |
TInt& aFlowControlStatus |
|
895 |
) |
|
896 |
{ |
|
897 |
OstTraceExt3( TRACE_NORMAL, RISCAPI_NOTIFYFLOWCONTROL_ENTRY, ">RIscApi::NotifyFlowControl;aStatus=%x;aFlowControlStatus=%d;iChannelNumber=%hx", ( TUint )&( aStatus ), aFlowControlStatus, iChannelNumber ); |
|
898 |
||
899 |
C_TRACE( ( _T( "RIscApi::NotifyFlowControl 0x%x 0x%x ch 0x%x ->" ), |
|
900 |
&aStatus, aFlowControlStatus, iChannelNumber ) ); |
|
901 |
PanicIfNotOpen(); |
|
902 |
TAny* params[ KTwoParams ]; |
|
903 |
aStatus = KRequestPending; |
|
904 |
params[ KFirstParam ] = reinterpret_cast<TAny*>( &aStatus ); |
|
905 |
params[ KSecondParam ] = reinterpret_cast<TAny*>( &aFlowControlStatus ); |
|
906 |
DoControl( EIADAsyncNotifyFlowControlStatus, params ); |
|
907 |
C_TRACE( ( _T( "RIscApi::NotifyFlowControl <-" ) ) ); |
|
908 |
||
909 |
OstTrace0( TRACE_NORMAL, RISCAPI_NOTIFYFLOWCONTROL_EXIT, "<RIscApi::NotifyFlowControl" ); |
|
910 |
} |
|
911 |
||
912 |
||
913 |
// ----------------------------------------------------------------------------- |
|
914 |
// RIscApi::NotifyFlowControlCancel |
|
915 |
// Stop listening for flow control status changes |
|
916 |
// ( other items were commented in a header ). |
|
917 |
// ----------------------------------------------------------------------------- |
|
918 |
// |
|
919 |
EXPORT_C void RIscApi::NotifyFlowControlCancel( |
|
920 |
// None |
|
921 |
) |
|
922 |
{ |
|
923 |
OstTraceExt1( TRACE_NORMAL, RISCAPI_NOTIFYFLOWCONTROLCANCEL_ENTRY, ">RIscApi::NotifyFlowControlCancel;iChannelNumber=%hx", iChannelNumber ); |
|
924 |
||
925 |
C_TRACE( ( _T( "RIscApi::NotifyFlowControlCancel 0x%x -> "), iChannelNumber ) ); |
|
926 |
PanicIfNotOpen(); |
|
927 |
DoCancel( EIADAsyncNotifyFlowControlStatus ); |
|
928 |
C_TRACE( ( _T( "RIscApi::NotifyFlowControlCancel 0x%x <-"), iChannelNumber ) ); |
|
929 |
||
930 |
OstTrace0( TRACE_NORMAL, RISCAPI_NOTIFYFLOWCONTROLCANCEL_EXIT, "<RIscApi::NotifyFlowControlCancel" ); |
|
931 |
} |
|
932 |
||
933 |
// ----------------------------------------------------------------------------- |
|
934 |
// RIscApi::MaximumDataSize |
|
935 |
// Get maximun data size ( for sending and receiving ) |
|
936 |
// ( other items were commented in a header ). |
|
937 |
// ----------------------------------------------------------------------------- |
|
938 |
// |
|
939 |
EXPORT_C TInt RIscApi::MaximumDataSize( |
|
940 |
// None |
|
941 |
) |
|
942 |
{ |
|
943 |
OstTraceExt1( TRACE_NORMAL, RISCAPI_MAXIMUMDATASIZE_ENTRY, ">RIscApi::MaximumDataSize;iChannelNumber=%hx", iChannelNumber ); |
|
944 |
||
945 |
C_TRACE( ( _T( "RIscApi::MaximumDataSize 0x%x ->" ), iChannelNumber ) ); |
|
946 |
PanicIfNotOpen(); |
|
947 |
TInt returnCode( DoControl( EIADGetMaxDataSize ) ); |
|
948 |
// If positive the maximum amount of data in ISI or data message to be send |
|
949 |
// If negative, one of the error codes. TODO: add to documentation, check possible error codes. |
|
950 |
C_TRACE( ( _T( "RIscApi::MaximumDataSize 0x%x %d <-" ), iChannelNumber, returnCode ) ); |
|
951 |
||
952 |
OstTrace1( TRACE_NORMAL, RISCAPI_MAXIMUMDATASIZE_EXIT, "<RIscApi::MaximumDataSize;return=%d", returnCode ); |
|
953 |
return returnCode; |
|
954 |
} |
|
955 |
||
956 |
// ----------------------------------------------------------------------------- |
|
957 |
// RIscApi::GetChannelInfo |
|
958 |
// Get channel info from multiplexer |
|
959 |
// ( other items were commented in a header ). |
|
960 |
// ----------------------------------------------------------------------------- |
|
961 |
// |
|
962 |
EXPORT_C TInt RIscApi::GetChannelInfo( |
|
963 |
const TUint16 aChannel, |
|
964 |
TDes8& aInfo |
|
965 |
) |
|
966 |
{ |
|
967 |
OstTraceExt3( TRACE_NORMAL, RISCAPI_GETCHANNELINFO_ENTRY, ">RIscApi::GetChannelInfo;aChannel=%hu;aInfo=%x;iChannelNumber=%hx", aChannel, ( TUint )&( aInfo ), iChannelNumber ); |
|
968 |
||
969 |
C_TRACE( ( _T( "RIscApi::GetChannelInfo 0x%x 0x%x ->" ), aChannel, &aInfo ) ); |
|
970 |
PanicIfNotOpen(); |
|
971 |
const TInt KChannelInfoMax( 2 ); |
|
972 |
TInt error( aInfo.MaxLength() >= KChannelInfoMax ? KErrNone : KErrArgument ); |
|
973 |
// TODO: Returns information of user channels only, not possible to get information |
|
974 |
// about kernel channels at the moment. |
|
975 |
// TODO: error if channel is out of range? |
|
976 |
if( KErrArgument != error ) |
|
977 |
{ |
|
978 |
aInfo.SetLength( KChannelInfoMax ); |
|
979 |
aInfo[ KFirstParam ] = static_cast<TUint8>( aChannel >> 8 ); |
|
980 |
aInfo[ KSecondParam ] = static_cast<TUint8>( aChannel ); |
|
981 |
} |
|
982 |
C_TRACE( ( _T( "RIscApi::GetChannelInfo 0x%x 0x%x %d <-" ), aChannel, &aInfo, error ) ); |
|
983 |
||
984 |
OstTrace1( TRACE_NORMAL, RISCAPI_GETCHANNELINFO_EXIT, "<RIscApi::GetChannelInfo;return=%d", error ); |
|
985 |
return error; |
|
986 |
} |
|
987 |
||
988 |
// ----------------------------------------------------------------------------- |
|
989 |
// IscApi::PanicIfNotOpen |
|
990 |
// Panic if channel is not opened yet |
|
991 |
// ( other items were commented in a header ). |
|
992 |
// ----------------------------------------------------------------------------- |
|
993 |
// |
|
994 |
void RIscApi::PanicIfNotOpen( |
|
995 |
// None |
|
996 |
) const |
|
997 |
{ |
|
998 |
//OstTraceExt1( TRACE_NORMAL, RISCAPI_PANICIFNOTOPEN_ENTRY, ">RIscApi::PanicIfNotOpen;iChannelNumber=%hx", iChannelNumber ); |
|
999 |
||
1000 |
C_TRACE( ( _T( "RIscApi::PanicIfNotOpen 0x%x>" ), iChannelNumber ) ); |
|
1001 |
ASSERT_PANIC_ALWAYS( KNotInitializedChannel != iChannelNumber, EIADChannelNotOpen ); |
|
1002 |
C_TRACE( ( _T( "RIscApi::PanicIfNotOpen<" )) ); |
|
1003 |
||
1004 |
//OstTrace0( TRACE_NORMAL, RISCAPI_PANICIFNOTOPEN_EXIT, "<RIscApi::PanicIfNotOpen" ); |
|
1005 |
} |
|
1006 |
||
1007 |
// End of File |