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