|
1 /* |
|
2 * Copyright (c) 2004-2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: HID field search |
|
15 * |
|
16 */ |
|
17 |
|
18 #include <e32std.h> |
|
19 |
|
20 #include "tGenericHIDAPI.h" |
|
21 |
|
22 // ======== MEMBER FUNCTIONS ======== |
|
23 |
|
24 // --------------------------------------------------------------------------- |
|
25 // NewLC |
|
26 // --------------------------------------------------------------------------- |
|
27 // |
|
28 CtGenericHIDAPI* CtGenericHIDAPI::NewLC() |
|
29 { |
|
30 CtGenericHIDAPI* self = new (ELeave) CtGenericHIDAPI(); |
|
31 CleanupStack::PushL(self); |
|
32 self->ConstructL(); |
|
33 return self; |
|
34 } |
|
35 |
|
36 // --------------------------------------------------------------------------- |
|
37 // NewL |
|
38 // --------------------------------------------------------------------------- |
|
39 // |
|
40 CtGenericHIDAPI* CtGenericHIDAPI::NewL() |
|
41 { |
|
42 CtGenericHIDAPI* self = NewLC(); |
|
43 CleanupStack::Pop(); |
|
44 return self; |
|
45 } |
|
46 // --------------------------------------------------------------------------- |
|
47 // Constructor |
|
48 // --------------------------------------------------------------------------- |
|
49 // |
|
50 CtGenericHIDAPI::CtGenericHIDAPI() |
|
51 { |
|
52 } |
|
53 // --------------------------------------------------------------------------- |
|
54 // Destructor |
|
55 // --------------------------------------------------------------------------- |
|
56 // |
|
57 CtGenericHIDAPI::~CtGenericHIDAPI() |
|
58 { |
|
59 delete iHidDriver; |
|
60 iFieldList.Close(); |
|
61 delete iGenHID; |
|
62 } |
|
63 // --------------------------------------------------------------------------- |
|
64 // ConstructL() |
|
65 // --------------------------------------------------------------------------- |
|
66 // |
|
67 void CtGenericHIDAPI::ConstructL() |
|
68 { |
|
69 iGenHID = CGenericHid::NewL( this ); |
|
70 iDriverAcces=iGenHID; |
|
71 |
|
72 iHidDriver = CHidDriver::NewL(TUid::Uid(0xE000B187),iGenHID); |
|
73 } |
|
74 // --------------------------------------------------------------------------- |
|
75 // ConnectL() |
|
76 // --------------------------------------------------------------------------- |
|
77 // |
|
78 void CtGenericHIDAPI::ConnectL(TInt aConnectionId, const TDesC8& aDescriptor) |
|
79 { |
|
80 TInt16 ret = iGenHID->ConnectedL( aConnectionId, aDescriptor ); |
|
81 ret = iGenHID->DriverActive( aConnectionId , CHidTransport::EActive); |
|
82 |
|
83 //todo retval |
|
84 } |
|
85 |
|
86 // --------------------------------------------------------------------------- |
|
87 // DisconnectL() |
|
88 // --------------------------------------------------------------------------- |
|
89 // |
|
90 void CtGenericHIDAPI::DisconnectL(TInt aConnectionId ) |
|
91 { |
|
92 TInt16 ret = iGenHID->Disconnected( aConnectionId ); |
|
93 //todo retval |
|
94 } |
|
95 |
|
96 // --------------------------------------------------------------------------- |
|
97 // DataInL() |
|
98 // --------------------------------------------------------------------------- |
|
99 // |
|
100 TInt CtGenericHIDAPI::DataInL(TInt aConnectionId, const TDesC8& aDescriptor) |
|
101 { |
|
102 TInt16 ret = iGenHID->DataIn(aConnectionId, CHidTransport::EHidChannelInt, aDescriptor); |
|
103 return ret; |
|
104 } |
|
105 |
|
106 // --------------------------------------------------------------------------- |
|
107 // RunCountryCodeL() |
|
108 // --------------------------------------------------------------------------- |
|
109 // |
|
110 TInt CtGenericHIDAPI::RunCountryCodeL() |
|
111 { |
|
112 TInt16 countryCode = iGenHID->CountryCodeL(0); |
|
113 if(countryCode != 0) |
|
114 return KErrNotFound; |
|
115 |
|
116 return KErrNone; |
|
117 } |
|
118 |
|
119 // --------------------------------------------------------------------------- |
|
120 // RunVendorIdL() |
|
121 // --------------------------------------------------------------------------- |
|
122 // |
|
123 TInt CtGenericHIDAPI::RunVendorIdL() |
|
124 { |
|
125 TUint vendorId = iGenHID->VendorIdL(0); |
|
126 if(vendorId != 0x0421) |
|
127 return KErrNotFound; |
|
128 return KErrNone; |
|
129 } |
|
130 |
|
131 // --------------------------------------------------------------------------- |
|
132 // RunProductIdL() |
|
133 // --------------------------------------------------------------------------- |
|
134 // |
|
135 TInt CtGenericHIDAPI::RunProductIdL() |
|
136 { |
|
137 TUint productId = iGenHID->ProductIdL(0); |
|
138 if(productId != 0x0083) |
|
139 return KErrNotFound; |
|
140 |
|
141 return KErrNone; |
|
142 } |
|
143 |
|
144 // --------------------------------------------------------------------------- |
|
145 // RunSetProtocol() |
|
146 // --------------------------------------------------------------------------- |
|
147 // |
|
148 TInt CtGenericHIDAPI::RunSetProtocolL() |
|
149 { |
|
150 iGenHID->SetProtocolL(0,0,MDriverAccess::EReport,iHidDriver); |
|
151 return KErrNone; |
|
152 } |
|
153 |
|
154 // --------------------------------------------------------------------------- |
|
155 // RunGetProtocoL() |
|
156 // --------------------------------------------------------------------------- |
|
157 // |
|
158 TInt CtGenericHIDAPI::RunGetProtocoL() |
|
159 { |
|
160 iGenHID->GetProtocolL(0,0); |
|
161 return KErrNone; |
|
162 } |
|
163 |
|
164 // --------------------------------------------------------------------------- |
|
165 // RunGetReportL() |
|
166 // --------------------------------------------------------------------------- |
|
167 // |
|
168 TInt CtGenericHIDAPI::RunGetReportL() |
|
169 { |
|
170 iGenHID->GetReportL(0, 0 ,0 , 0); |
|
171 return KErrNone; |
|
172 } |
|
173 |
|
174 // --------------------------------------------------------------------------- |
|
175 // RunSetReportL() |
|
176 // --------------------------------------------------------------------------- |
|
177 // |
|
178 TInt CtGenericHIDAPI::RunSetReportL(const TDesC8& aDescriptor) |
|
179 { |
|
180 iGenHID->SetReportL(0,0, MDriverAccess::EOutput, aDescriptor,0, iHidDriver); |
|
181 return KErrNone; |
|
182 } |
|
183 |
|
184 // --------------------------------------------------------------------------- |
|
185 // GetDataOutL() |
|
186 // --------------------------------------------------------------------------- |
|
187 // |
|
188 TInt CtGenericHIDAPI::RunDataOutL(const TDesC8& aDescriptor) |
|
189 { |
|
190 iGenHID->DataOutL( 0, 0, aDescriptor, 0); |
|
191 return KErrNone; |
|
192 } |
|
193 |
|
194 // --------------------------------------------------------------------------- |
|
195 // GetGetIdleL() |
|
196 // --------------------------------------------------------------------------- |
|
197 // |
|
198 TInt CtGenericHIDAPI::GetGetIdleL() |
|
199 { |
|
200 iGenHID->GetIdleL(0, 0, 0); |
|
201 return KErrNone; |
|
202 } |
|
203 |
|
204 // --------------------------------------------------------------------------- |
|
205 // RunSetIdleL() |
|
206 // --------------------------------------------------------------------------- |
|
207 // |
|
208 TInt CtGenericHIDAPI::RunSetIdleL() |
|
209 { |
|
210 iGenHID->SetIdleL(0, 10, 0, 0, iHidDriver); |
|
211 return KErrNone; |
|
212 } |
|
213 |
|
214 // --------------------------------------------------------------------------- |
|
215 // GetCommandResultL() |
|
216 // --------------------------------------------------------------------------- |
|
217 // |
|
218 TInt CtGenericHIDAPI::GetCommandResultL() |
|
219 { |
|
220 iGenHID->CommandResult(0, 1); |
|
221 return KErrNone; |
|
222 } |
|
223 |
|
224 // --------------------------------------------------------------------------- |
|
225 // GetReportDescriptorL() |
|
226 // --------------------------------------------------------------------------- |
|
227 // |
|
228 TInt CtGenericHIDAPI::GetReportDescriptorL() |
|
229 { |
|
230 CReportRoot* tmp=iGenHID->ReportDescriptor(0); |
|
231 if(tmp == NULL) |
|
232 return KErrNotFound; |
|
233 |
|
234 return KErrNone; |
|
235 } |
|
236 |
|
237 // --------------------------------------------------------------------------- |
|
238 // CreateReportGeneratorL |
|
239 // --------------------------------------------------------------------------- |
|
240 // |
|
241 TInt CtGenericHIDAPI::CreateReportGeneratorL() |
|
242 { |
|
243 CReportRoot* tmp=iGenHID->ReportDescriptor(0); |
|
244 |
|
245 if(tmp == NULL) |
|
246 return KErrNotFound; |
|
247 |
|
248 iReportGenerator = CReportGenerator::NewL(tmp, 0, CField::EInput); |
|
249 |
|
250 if(iReportGenerator == NULL) |
|
251 return KErrNotFound; |
|
252 |
|
253 return KErrNone; |
|
254 } |
|
255 |
|
256 // --------------------------------------------------------------------------- |
|
257 // DeleteReportGeneratorL() |
|
258 // --------------------------------------------------------------------------- |
|
259 // |
|
260 TInt CtGenericHIDAPI::DeleteReportGeneratorL() |
|
261 { |
|
262 delete iReportGenerator; |
|
263 iReportGenerator = NULL; |
|
264 return KErrNone; |
|
265 } |
|
266 |
|
267 // --------------------------------------------------------------------------- |
|
268 // ReportGeneratorReport() |
|
269 // --------------------------------------------------------------------------- |
|
270 // |
|
271 TInt CtGenericHIDAPI::ReportGeneratorReport() |
|
272 { |
|
273 iReportGenerator->Report(); |
|
274 //todo check return value??? |
|
275 return KErrNone; |
|
276 } |
|
277 |
|
278 // --------------------------------------------------------------------------- |
|
279 // ReportGeneratorReport() |
|
280 // --------------------------------------------------------------------------- |
|
281 // |
|
282 TInt CtGenericHIDAPI::ReportGeneratorSetFieldL( TBool aIsArray, TBool aOutOfRange, TBool aFieldNull, TBool aFieldCountZero, TBool aExistingUsageId, TBool aBadIndex ) |
|
283 { |
|
284 CField* field = CreateCFieldL(); |
|
285 |
|
286 TInt usageId = EConsumerUsageVolumeInc;//233;//0xE9 |
|
287 TInt indexOffset = 0; |
|
288 |
|
289 if(aBadIndex != EFalse) |
|
290 { |
|
291 indexOffset = 1000; |
|
292 } |
|
293 |
|
294 if(aExistingUsageId == EFalse) |
|
295 { |
|
296 usageId = EConsumerUsagePlayPause;//205 |
|
297 field->SetUsageRange(0,255); |
|
298 } |
|
299 |
|
300 if(aIsArray == EFalse) |
|
301 { |
|
302 field->SetAttributes(KFieldAttributeVariable); |
|
303 if(field->IsArray() != EFalse) |
|
304 { |
|
305 return KErrGeneral; |
|
306 } |
|
307 } |
|
308 else |
|
309 { |
|
310 field->SetAttributes(!KFieldAttributeVariable); |
|
311 if(field->IsArray() == EFalse) |
|
312 { |
|
313 return KErrGeneral; |
|
314 } |
|
315 } |
|
316 |
|
317 field->SetLogicalMax(10); |
|
318 if(aOutOfRange != EFalse) |
|
319 { |
|
320 field->SetLogicalMin(5); |
|
321 } |
|
322 |
|
323 if(aFieldCountZero != EFalse) |
|
324 { |
|
325 field->SetCount(0); |
|
326 } |
|
327 |
|
328 const CField* constField; |
|
329 if(aFieldNull == EFalse) |
|
330 { |
|
331 constField = (const CField*)field; |
|
332 } |
|
333 else |
|
334 { |
|
335 constField = NULL; |
|
336 } |
|
337 TInt16 ret = iReportGenerator->SetField(constField, usageId, 1, indexOffset); |
|
338 return ret; |
|
339 } |
|
340 |
|
341 // ----------------------------------------------------------------------------- |
|
342 // CtGenericHid::CreateReportTranslatorL |
|
343 // ----------------------------------------------------------------------------- |
|
344 // |
|
345 TInt CtGenericHIDAPI::CreateReportTranslatorL( const TDesC8& aDescriptor, TBool aIsArray, TBool aFieldNull, TBool aFieldCountZero) |
|
346 { |
|
347 CField* field = CreateCFieldL(); |
|
348 |
|
349 |
|
350 if(aIsArray == EFalse) |
|
351 { |
|
352 field->SetAttributes(KFieldAttributeVariable); |
|
353 if(field->IsArray() != EFalse) |
|
354 { |
|
355 return KErrGeneral; |
|
356 } |
|
357 } |
|
358 else |
|
359 { |
|
360 field->SetAttributes(!KFieldAttributeVariable); |
|
361 if(field->IsArray() == EFalse) |
|
362 { |
|
363 return KErrGeneral; |
|
364 } |
|
365 } |
|
366 |
|
367 /* field->SetLogicalMax(10); |
|
368 if(aOutOfRange != EFalse) |
|
369 { |
|
370 field->SetLogicalMin(5); |
|
371 }*/ |
|
372 |
|
373 if(aFieldCountZero != EFalse) |
|
374 { |
|
375 field->SetCount(0); |
|
376 } |
|
377 |
|
378 const CField* constField; |
|
379 if(aFieldNull == EFalse) |
|
380 { |
|
381 constField = (const CField*)field; |
|
382 } |
|
383 else |
|
384 { |
|
385 constField = NULL; |
|
386 } |
|
387 |
|
388 |
|
389 |
|
390 |
|
391 //const CField* field = CreateConstCFieldL(); |
|
392 iTranslator = new (ELeave) TReportTranslator(aDescriptor, constField); |
|
393 return KErrNone; |
|
394 } |
|
395 |
|
396 // ----------------------------------------------------------------------------- |
|
397 // CtGenericHid::CreateReportTranslator_FieldNullL |
|
398 // ----------------------------------------------------------------------------- |
|
399 // |
|
400 /*TInt CtGenericHIDAPI::CreateReportTranslator_FieldNullL( const TDesC8& aDescriptor ) |
|
401 { |
|
402 const CField* field = NULL; |
|
403 iTranslator = new (ELeave) TReportTranslator(aDescriptor, field); |
|
404 return KErrNone; |
|
405 }*/ |
|
406 |
|
407 // ----------------------------------------------------------------------------- |
|
408 // CtGenericHid::DeleteReportTranslatorL |
|
409 // ----------------------------------------------------------------------------- |
|
410 // |
|
411 TInt CtGenericHIDAPI::DeleteReportTranslatorL( ) |
|
412 { |
|
413 delete iTranslator; |
|
414 iTranslator =NULL; |
|
415 return KErrNone; |
|
416 } |
|
417 |
|
418 // ----------------------------------------------------------------------------- |
|
419 // CtGenericHid::ReportTranslatorGetValueL |
|
420 // ----------------------------------------------------------------------------- |
|
421 // |
|
422 TInt CtGenericHIDAPI::ReportTranslatorGetValueL() |
|
423 { |
|
424 //todo if |
|
425 TInt value = 0; |
|
426 TInt res = iTranslator->GetValue(value,EConsumerUsageVolumeInc); |
|
427 |
|
428 return res; |
|
429 } |
|
430 |
|
431 // ----------------------------------------------------------------------------- |
|
432 // CtGenericHid::ReportTranslatorValueL |
|
433 // ----------------------------------------------------------------------------- |
|
434 // |
|
435 TInt CtGenericHIDAPI::ReportTranslatorValueL() |
|
436 { |
|
437 TInt value = iTranslator->ValueL(EConsumerUsageVolumeInc); |
|
438 |
|
439 return KErrNone; |
|
440 } |
|
441 |
|
442 // ----------------------------------------------------------------------------- |
|
443 // CtGenericHid::ReportTranslatorGetUsageIdL |
|
444 // ----------------------------------------------------------------------------- |
|
445 // |
|
446 TInt CtGenericHIDAPI::ReportTranslatorGetUsageIdL( TBool aBadControlIndex ) |
|
447 { |
|
448 TInt id; |
|
449 TInt index = 0; |
|
450 |
|
451 if(aBadControlIndex != EFalse) |
|
452 { |
|
453 index = -1;//bad index |
|
454 } |
|
455 //todo if |
|
456 TInt ret = iTranslator->GetUsageId(id,index); |
|
457 |
|
458 return ret; |
|
459 } |
|
460 |
|
461 // ----------------------------------------------------------------------------- |
|
462 // CtGenericHid::ReportTranslatorUsageIdL |
|
463 // ----------------------------------------------------------------------------- |
|
464 // |
|
465 TInt CtGenericHIDAPI::ReportTranslatorUsageIdL( ) |
|
466 { |
|
467 TInt value = iTranslator->UsageIdL(0); |
|
468 |
|
469 return KErrNone; |
|
470 } |
|
471 |
|
472 // ----------------------------------------------------------------------------- |
|
473 // CtGenericHid::ReportTranslatorRawValueL |
|
474 // ----------------------------------------------------------------------------- |
|
475 // |
|
476 TInt CtGenericHIDAPI::ReportTranslatorRawValueL( ) |
|
477 { |
|
478 TInt value = iTranslator->RawValueL(0); |
|
479 |
|
480 return KErrNone; |
|
481 } |
|
482 |
|
483 // ----------------------------------------------------------------------------- |
|
484 // CtGenericHid::ReportTranslatorCountL |
|
485 // ----------------------------------------------------------------------------- |
|
486 // |
|
487 TInt CtGenericHIDAPI::ReportTranslatorCountL( ) |
|
488 { |
|
489 TInt count =iTranslator->Count(); |
|
490 //todo if, retval |
|
491 return KErrNone; |
|
492 } |
|
493 |
|
494 // ----------------------------------------------------------------------------- |
|
495 // CtGenericHid::CollectiontypeL |
|
496 // ----------------------------------------------------------------------------- |
|
497 // |
|
498 TInt CtGenericHIDAPI::CollectiontypeL( ) |
|
499 { |
|
500 CReportRoot* tmp=iGenHID->ReportDescriptor(0); |
|
501 User::LeaveIfNull(tmp); |
|
502 TUint32 type=tmp->Type(); |
|
503 //todo check type? |
|
504 return KErrNone; |
|
505 } |
|
506 |
|
507 // ----------------------------------------------------------------------------- |
|
508 // CtGenericHid::CollectionIsPhysicalL |
|
509 // ----------------------------------------------------------------------------- |
|
510 // |
|
511 TInt CtGenericHIDAPI::CollectionIsPhysicalL( ) |
|
512 { |
|
513 CReportRoot* tmp=iGenHID->ReportDescriptor(0); |
|
514 User::LeaveIfNull(tmp); |
|
515 TBool result=tmp->IsPhysical(); |
|
516 |
|
517 return KErrNone; |
|
518 } |
|
519 |
|
520 // ----------------------------------------------------------------------------- |
|
521 // CtGenericHid::CollectionIsLogicalL |
|
522 // ----------------------------------------------------------------------------- |
|
523 // |
|
524 TInt CtGenericHIDAPI::CollectionIsLogicalL( ) |
|
525 { |
|
526 CReportRoot* tmp=iGenHID->ReportDescriptor(0); |
|
527 User::LeaveIfNull(tmp); |
|
528 TBool result=tmp->IsLogical(); |
|
529 |
|
530 return KErrNone; |
|
531 } |
|
532 |
|
533 // ----------------------------------------------------------------------------- |
|
534 // CtGenericHid::CollectionIsReportL |
|
535 // ----------------------------------------------------------------------------- |
|
536 // |
|
537 TInt CtGenericHIDAPI::CollectionIsReportL( ) |
|
538 { |
|
539 CReportRoot* tmp=iGenHID->ReportDescriptor(0); |
|
540 User::LeaveIfNull(tmp); |
|
541 TBool result=tmp->IsReport(); |
|
542 |
|
543 return KErrNone; |
|
544 } |
|
545 |
|
546 // ----------------------------------------------------------------------------- |
|
547 // CtGenericHid::CollectionIsNamedArrayL |
|
548 // ----------------------------------------------------------------------------- |
|
549 // |
|
550 TInt CtGenericHIDAPI::CollectionIsNamedArrayL( ) |
|
551 { |
|
552 CReportRoot* tmp=iGenHID->ReportDescriptor(0); |
|
553 User::LeaveIfNull(tmp); |
|
554 TBool result =tmp->IsNamedArray(); |
|
555 |
|
556 return KErrNone; |
|
557 } |
|
558 |
|
559 // ----------------------------------------------------------------------------- |
|
560 // CtGenericHid::CollectionIsUsageSwitchL |
|
561 // ----------------------------------------------------------------------------- |
|
562 // |
|
563 TInt CtGenericHIDAPI::CollectionIsUsageSwitchL( ) |
|
564 { |
|
565 CReportRoot* tmp=iGenHID->ReportDescriptor(0); |
|
566 User::LeaveIfNull(tmp); |
|
567 TBool resul = tmp->IsUsageSwitch(); |
|
568 |
|
569 return KErrNone; |
|
570 } |
|
571 |
|
572 // ----------------------------------------------------------------------------- |
|
573 // CtGenericHid::CollectionIsUsageModifierL |
|
574 // ----------------------------------------------------------------------------- |
|
575 // |
|
576 TInt CtGenericHIDAPI::CollectionIsUsageModifierL( ) |
|
577 { |
|
578 CReportRoot* tmp=iGenHID->ReportDescriptor(0); |
|
579 User::LeaveIfNull(tmp); |
|
580 TInt result = tmp->IsUsageModifier(); |
|
581 |
|
582 return KErrNone; |
|
583 } |
|
584 |
|
585 // ----------------------------------------------------------------------------- |
|
586 // CtGenericHid::CollectionIsApplicationL |
|
587 // ----------------------------------------------------------------------------- |
|
588 // |
|
589 TInt CtGenericHIDAPI::CollectionIsApplicationL( ) |
|
590 { |
|
591 CReportRoot* tmp=iGenHID->ReportDescriptor(0); |
|
592 User::LeaveIfNull(tmp); |
|
593 TInt result = tmp->IsApplication(); |
|
594 |
|
595 return KErrNone; |
|
596 } |
|
597 |
|
598 // ----------------------------------------------------------------------------- |
|
599 // CtGenericHid::CollectionUsagePageL |
|
600 // ----------------------------------------------------------------------------- |
|
601 // |
|
602 TInt CtGenericHIDAPI::CollectionUsagePageL( ) |
|
603 { |
|
604 CReportRoot* tmp=iGenHID->ReportDescriptor(0); |
|
605 User::LeaveIfNull(tmp); |
|
606 TInt result = tmp->UsagePage(); |
|
607 |
|
608 return KErrNone; |
|
609 } |
|
610 |
|
611 // ----------------------------------------------------------------------------- |
|
612 // CtGenericHid::CollectionUsageL |
|
613 // ----------------------------------------------------------------------------- |
|
614 // |
|
615 TInt CtGenericHIDAPI::CollectionUsageL( ) |
|
616 { |
|
617 CReportRoot* tmp=iGenHID->ReportDescriptor(0); |
|
618 User::LeaveIfNull(tmp); |
|
619 TInt result = tmp->Usage(); |
|
620 |
|
621 return KErrNone; |
|
622 } |
|
623 |
|
624 // ----------------------------------------------------------------------------- |
|
625 // CtGenericHid::CollectionCollectionCountL |
|
626 // ----------------------------------------------------------------------------- |
|
627 // |
|
628 TInt CtGenericHIDAPI::CollectionCollectionCountL( ) |
|
629 { |
|
630 CReportRoot* tmp=iGenHID->ReportDescriptor(0); |
|
631 User::LeaveIfNull(tmp); |
|
632 TInt result = tmp->CollectionCount(); |
|
633 |
|
634 return KErrNone; |
|
635 } |
|
636 |
|
637 // ----------------------------------------------------------------------------- |
|
638 // CtGenericHid::CollectionFieldCountL |
|
639 // ----------------------------------------------------------------------------- |
|
640 // |
|
641 TInt CtGenericHIDAPI::CollectionFieldCountL( ) |
|
642 { |
|
643 CReportRoot* tmp=iGenHID->ReportDescriptor(0); |
|
644 User::LeaveIfNull(tmp); |
|
645 TInt result = tmp->FieldCount(); |
|
646 |
|
647 return KErrNone; |
|
648 } |
|
649 |
|
650 // ----------------------------------------------------------------------------- |
|
651 // CtGenericHid::CollectionCollectionByIndexL |
|
652 // ----------------------------------------------------------------------------- |
|
653 // |
|
654 TInt CtGenericHIDAPI::CollectionCollectionByIndexL( TBool aPresent ) |
|
655 { |
|
656 CReportRoot* tmp=iGenHID->ReportDescriptor(0); |
|
657 User::LeaveIfNull(tmp); |
|
658 TInt index; |
|
659 |
|
660 index = (aPresent != EFalse) ? 0 : -1; |
|
661 |
|
662 const CCollection* result = tmp->CollectionByIndex(index); |
|
663 |
|
664 if(aPresent != EFalse && result == NULL) |
|
665 return KErrGeneral; |
|
666 |
|
667 if(aPresent == EFalse && result != NULL) |
|
668 return KErrGeneral; |
|
669 |
|
670 return KErrNone; |
|
671 } |
|
672 |
|
673 // ----------------------------------------------------------------------------- |
|
674 // CtGenericHid::CollectionFieldByIndexL |
|
675 // ----------------------------------------------------------------------------- |
|
676 // |
|
677 TInt CtGenericHIDAPI::CollectionFieldByIndexL( ) |
|
678 { |
|
679 CReportRoot* tmp=iGenHID->ReportDescriptor(0); |
|
680 User::LeaveIfNull(tmp); |
|
681 const CField* result = tmp->FieldByIndex(-1); |
|
682 |
|
683 if(result != NULL) |
|
684 return KErrGeneral; |
|
685 //todo if |
|
686 |
|
687 return KErrNone; |
|
688 } |
|
689 |
|
690 // ----------------------------------------------------------------------------- |
|
691 // CtGenericHid::ReportrootReportSizeBytes |
|
692 // ----------------------------------------------------------------------------- |
|
693 // |
|
694 TInt CtGenericHIDAPI::ReportrootReportSizeBytes( ) |
|
695 { |
|
696 CReportRoot* tmp=iGenHID->ReportDescriptor(0); |
|
697 User::LeaveIfNull(tmp); |
|
698 TInt16 size = tmp->ReportSizeBytes(0,CField::EInput); |
|
699 |
|
700 return KErrNone; |
|
701 } |
|
702 |
|
703 // --------------------------------------------------------------------------- |
|
704 // FieldLogicalMaxL() |
|
705 // --------------------------------------------------------------------------- |
|
706 // |
|
707 TInt CtGenericHIDAPI::FieldLogicalMaxL( )//todo remove |
|
708 { |
|
709 CField* field = CreateCFieldL(); |
|
710 const TInt max = 5; |
|
711 field->SetLogicalMax(max); |
|
712 TInt ret = field->LogicalMax(); |
|
713 if(ret != max) |
|
714 return KErrGeneral; |
|
715 |
|
716 return KErrNone; |
|
717 } |
|
718 |
|
719 // --------------------------------------------------------------------------- |
|
720 // FieldPhysicalMinL() |
|
721 // --------------------------------------------------------------------------- |
|
722 // |
|
723 TInt CtGenericHIDAPI::FieldPhysicalMinL( )//todo remove |
|
724 { |
|
725 CField* field = CreateCFieldL(); |
|
726 const TInt min = 0; |
|
727 field->SetPhysicalMin(min); |
|
728 TInt ret = field->PhysicalMin(); |
|
729 if(ret != min) |
|
730 return KErrGeneral; |
|
731 |
|
732 return KErrNone; |
|
733 } |
|
734 |
|
735 // --------------------------------------------------------------------------- |
|
736 // FieldPhysicalMaxL() |
|
737 // --------------------------------------------------------------------------- |
|
738 // |
|
739 TInt CtGenericHIDAPI::FieldPhysicalMaxL( )//todo remove |
|
740 { |
|
741 CField* field = CreateCFieldL(); |
|
742 const TInt max = 5; |
|
743 field->SetPhysicalMax(max); |
|
744 TInt ret=field->PhysicalMax(); |
|
745 if(ret != max) |
|
746 return KErrGeneral; |
|
747 |
|
748 return KErrNone; |
|
749 } |
|
750 |
|
751 // --------------------------------------------------------------------------- |
|
752 // FieldUnitL() |
|
753 // --------------------------------------------------------------------------- |
|
754 // |
|
755 TInt CtGenericHIDAPI::FieldUnitL( ) |
|
756 { |
|
757 CField* field = CreateCFieldL(); |
|
758 TInt unit = 5; |
|
759 field->SetUnit(unit); |
|
760 TInt ret = field->Unit(); |
|
761 if(ret != unit) |
|
762 return KErrGeneral; |
|
763 |
|
764 return KErrNone; |
|
765 } |
|
766 |
|
767 // --------------------------------------------------------------------------- |
|
768 // FieldUnitExponentL() |
|
769 // --------------------------------------------------------------------------- |
|
770 // |
|
771 TInt CtGenericHIDAPI::FieldUnitExponentL( ) |
|
772 { |
|
773 CField* field = CreateCFieldL(); |
|
774 TInt unitExponent = 5; |
|
775 field->SetUnitExponent(unitExponent); |
|
776 TInt ret = field->UnitExponent(); |
|
777 if(ret != unitExponent) |
|
778 return KErrGeneral; |
|
779 |
|
780 return KErrNone; |
|
781 } |
|
782 |
|
783 // --------------------------------------------------------------------------- |
|
784 // FieldCountL() |
|
785 // --------------------------------------------------------------------------- |
|
786 // |
|
787 TInt CtGenericHIDAPI::FieldCountL( ) |
|
788 { |
|
789 CField* field = CreateCFieldL(); |
|
790 TInt count = 5; |
|
791 field->SetCount(count); |
|
792 TInt ret = field->Count(); |
|
793 if(ret != count) |
|
794 return KErrGeneral; |
|
795 |
|
796 return KErrNone; |
|
797 } |
|
798 |
|
799 // --------------------------------------------------------------------------- |
|
800 // FieldSizeL() |
|
801 // --------------------------------------------------------------------------- |
|
802 // |
|
803 TInt CtGenericHIDAPI::FieldSizeL( ) |
|
804 { |
|
805 CField* field = CreateCFieldL(); |
|
806 TInt size = 5; |
|
807 field->SetSize(size); |
|
808 TInt ret = field->Size(); |
|
809 if(ret != size) |
|
810 return KErrGeneral; |
|
811 |
|
812 return KErrNone; |
|
813 } |
|
814 |
|
815 // --------------------------------------------------------------------------- |
|
816 // FieldOffsetL() |
|
817 // --------------------------------------------------------------------------- |
|
818 // |
|
819 TInt CtGenericHIDAPI::FieldOffsetL(TBool setReport ) |
|
820 { |
|
821 CField* field = CreateCFieldL(); |
|
822 |
|
823 if(setReport != EFalse) |
|
824 { |
|
825 field->SetReportId(5); |
|
826 } |
|
827 |
|
828 TInt offset = 5; |
|
829 field->SetOffset(offset); |
|
830 TInt ret = field->Offset(); |
|
831 |
|
832 if(setReport != EFalse) |
|
833 { |
|
834 offset += KSizeOfByte; |
|
835 } |
|
836 |
|
837 if(ret != offset) |
|
838 return KErrGeneral; |
|
839 |
|
840 return KErrNone; |
|
841 } |
|
842 |
|
843 // --------------------------------------------------------------------------- |
|
844 // FieldReportIdL() |
|
845 // --------------------------------------------------------------------------- |
|
846 // |
|
847 TInt CtGenericHIDAPI::FieldReportIdL( ) |
|
848 { |
|
849 CField* field = CreateCFieldL(); |
|
850 TInt reportId = 5; |
|
851 field->SetReportId(reportId); |
|
852 TInt ret = field->ReportId(); |
|
853 if(ret != reportId) |
|
854 return KErrGeneral; |
|
855 |
|
856 return KErrNone; |
|
857 } |
|
858 |
|
859 // --------------------------------------------------------------------------- |
|
860 // FieldIsInReportL() |
|
861 // --------------------------------------------------------------------------- |
|
862 // |
|
863 TInt CtGenericHIDAPI::FieldIsInReportL( ) |
|
864 { |
|
865 CField* field = CreateCFieldL(); |
|
866 TInt reportId = 5; |
|
867 field->SetReportId(reportId); |
|
868 TBool ret = field->IsInReport(reportId); |
|
869 if(!ret) |
|
870 return KErrGeneral; |
|
871 |
|
872 return KErrNone; |
|
873 } |
|
874 |
|
875 // --------------------------------------------------------------------------- |
|
876 // FieldDesignatorIndexL() |
|
877 // --------------------------------------------------------------------------- |
|
878 // |
|
879 TInt CtGenericHIDAPI::FieldDesignatorIndexL( ) |
|
880 { |
|
881 CField* field = CreateCFieldL(); |
|
882 TInt designatorIndex = 5; |
|
883 field->SetDesignatorIndex(designatorIndex); |
|
884 TInt ret = field->DesignatorIndex(); |
|
885 if(ret != designatorIndex) |
|
886 return KErrGeneral; |
|
887 |
|
888 return KErrNone; |
|
889 } |
|
890 |
|
891 // --------------------------------------------------------------------------- |
|
892 // FieldStringIndexL() |
|
893 // --------------------------------------------------------------------------- |
|
894 // |
|
895 TInt CtGenericHIDAPI::FieldStringIndexL( ) |
|
896 { |
|
897 CField* field = CreateCFieldL(); |
|
898 TInt stringIndex = 5; |
|
899 field->SetStringIndex(stringIndex); |
|
900 TInt ret = field->StringIndex(); |
|
901 if(ret != stringIndex) |
|
902 return KErrGeneral; |
|
903 |
|
904 return KErrNone; |
|
905 } |
|
906 |
|
907 // --------------------------------------------------------------------------- |
|
908 // FieldUsagePageL() |
|
909 // --------------------------------------------------------------------------- |
|
910 // |
|
911 TInt CtGenericHIDAPI::FieldUsagePageL( ) |
|
912 { |
|
913 CField* field = CreateCFieldL(); |
|
914 TInt usagePage = 5; |
|
915 field->SetUsagePage(usagePage); |
|
916 TInt ret = field->UsagePage(); |
|
917 if(ret != usagePage) |
|
918 return KErrGeneral; |
|
919 |
|
920 return KErrNone; |
|
921 } |
|
922 |
|
923 // --------------------------------------------------------------------------- |
|
924 // FieldHasUsageL() |
|
925 // --------------------------------------------------------------------------- |
|
926 // |
|
927 TInt CtGenericHIDAPI::FieldHasUsageL( ) |
|
928 { |
|
929 CField* field = CreateCFieldL(); |
|
930 TInt usage = 233; |
|
931 field->AddUsageL(usage); |
|
932 TBool ret = field->HasUsage(usage); |
|
933 if(!ret) |
|
934 return KErrGeneral; |
|
935 //todo check EFalse |
|
936 return KErrNone; |
|
937 } |
|
938 |
|
939 // --------------------------------------------------------------------------- |
|
940 // FieldUsageArrayL() |
|
941 // --------------------------------------------------------------------------- |
|
942 // |
|
943 TInt CtGenericHIDAPI::FieldUsageArrayL( ) |
|
944 { |
|
945 CField* field = CreateCFieldL(); |
|
946 TInt usage = 233; |
|
947 field->AddUsageL(usage); |
|
948 TArray<TInt> usageArray = field->UsageArray(); |
|
949 |
|
950 if(usageArray[0] != usage) |
|
951 return KErrGeneral; |
|
952 |
|
953 return KErrNone; |
|
954 } |
|
955 |
|
956 // --------------------------------------------------------------------------- |
|
957 // FieldUsageL() |
|
958 // --------------------------------------------------------------------------- |
|
959 // |
|
960 TInt CtGenericHIDAPI::FieldUsageL( ) |
|
961 { |
|
962 CField* field = CreateCFieldL(); |
|
963 TInt usage = 233; |
|
964 field->AddUsageL(usage); |
|
965 TInt ret = field->Usage(0); |
|
966 |
|
967 if(ret != usage) |
|
968 return KErrGeneral; |
|
969 |
|
970 return KErrNone; |
|
971 } |
|
972 |
|
973 // --------------------------------------------------------------------------- |
|
974 // FieldUsageCountL() |
|
975 // --------------------------------------------------------------------------- |
|
976 // |
|
977 TInt CtGenericHIDAPI::FieldUsageCountL( ) |
|
978 { |
|
979 CField* field = CreateCFieldL(); |
|
980 TInt firstCount = field->UsageCount(); |
|
981 TInt usage = 233; |
|
982 field->AddUsageL(usage); |
|
983 TInt secondCount = field->UsageCount(); |
|
984 |
|
985 if(secondCount != firstCount+1) |
|
986 return KErrGeneral; |
|
987 |
|
988 return KErrNone; |
|
989 } |
|
990 |
|
991 // --------------------------------------------------------------------------- |
|
992 // FieldClearUsageListL() |
|
993 // --------------------------------------------------------------------------- |
|
994 // |
|
995 TInt CtGenericHIDAPI::FieldClearUsageListL( ) |
|
996 { |
|
997 CField* field = CreateCFieldL(); |
|
998 TInt usage = 233; |
|
999 field->AddUsageL(usage); |
|
1000 TInt ret = field->UsageCount(); |
|
1001 |
|
1002 if(ret == 0) |
|
1003 return KErrGeneral; |
|
1004 |
|
1005 field->ClearUsageList(); |
|
1006 ret = field->UsageCount(); |
|
1007 if(ret != 0) |
|
1008 return KErrGeneral; |
|
1009 |
|
1010 return KErrNone; |
|
1011 } |
|
1012 |
|
1013 // --------------------------------------------------------------------------- |
|
1014 // FieldLastUsageL() |
|
1015 // --------------------------------------------------------------------------- |
|
1016 // |
|
1017 TInt CtGenericHIDAPI::FieldLastUsageL( TBool empty ) |
|
1018 { |
|
1019 CField* field = CreateCFieldL(); |
|
1020 //todo if - without add |
|
1021 TInt usage = 233; |
|
1022 |
|
1023 if(empty != EFalse) |
|
1024 { |
|
1025 field->ClearUsageList(); |
|
1026 usage = 0; |
|
1027 } |
|
1028 else |
|
1029 { |
|
1030 field->AddUsageL(usage); |
|
1031 } |
|
1032 |
|
1033 TInt ret = field->LastUsage(); |
|
1034 |
|
1035 if(ret != usage) |
|
1036 return KErrGeneral; |
|
1037 |
|
1038 return KErrNone; |
|
1039 } |
|
1040 |
|
1041 // --------------------------------------------------------------------------- |
|
1042 // FieldAttributesL() |
|
1043 // --------------------------------------------------------------------------- |
|
1044 // |
|
1045 TInt CtGenericHIDAPI::FieldAttributesL( ) |
|
1046 { |
|
1047 CField* field = CreateCFieldL(); |
|
1048 TUint32 attributes = KFieldAttributeConstant; |
|
1049 field->SetAttributes(attributes); |
|
1050 TUint32 ret = field->Attributes(); |
|
1051 if(ret != attributes) |
|
1052 return KErrGeneral; |
|
1053 |
|
1054 return KErrNone; |
|
1055 } |
|
1056 |
|
1057 // --------------------------------------------------------------------------- |
|
1058 // FieldTypeL() |
|
1059 // --------------------------------------------------------------------------- |
|
1060 // |
|
1061 TInt CtGenericHIDAPI::FieldTypeL( ) |
|
1062 { |
|
1063 CField* field = CreateCFieldL(); |
|
1064 CField::TType type = CField::EInput; |
|
1065 field->SetType(type); |
|
1066 CField::TType ret = field->Type(); |
|
1067 if(ret != type) |
|
1068 return KErrGeneral; |
|
1069 |
|
1070 return KErrNone; |
|
1071 } |
|
1072 |
|
1073 // --------------------------------------------------------------------------- |
|
1074 // FieldIsVariableL() |
|
1075 // --------------------------------------------------------------------------- |
|
1076 // |
|
1077 TInt CtGenericHIDAPI::FieldIsVariableL( ) |
|
1078 { |
|
1079 CField* field = CreateCFieldL(); |
|
1080 TUint32 attributes = KFieldAttributeVariable; |
|
1081 field->SetAttributes(attributes); |
|
1082 TBool ret = field->IsVariable(); |
|
1083 if(!ret) |
|
1084 return KErrGeneral; |
|
1085 |
|
1086 return KErrNone; |
|
1087 } |
|
1088 |
|
1089 // --------------------------------------------------------------------------- |
|
1090 // FieldIsArrayL() |
|
1091 // --------------------------------------------------------------------------- |
|
1092 // |
|
1093 TInt CtGenericHIDAPI::FieldIsArrayL( ) |
|
1094 { |
|
1095 CField* field = CreateCFieldL(); |
|
1096 TUint32 attributes = KFieldAttributeVariable; |
|
1097 field->SetAttributes(attributes); |
|
1098 TBool ret = field->IsArray(); |
|
1099 if(ret) |
|
1100 return KErrGeneral; |
|
1101 |
|
1102 return KErrNone; |
|
1103 } |
|
1104 |
|
1105 // --------------------------------------------------------------------------- |
|
1106 // FieldIsConstantL() |
|
1107 // --------------------------------------------------------------------------- |
|
1108 // |
|
1109 TInt CtGenericHIDAPI::FieldIsConstantL( ) |
|
1110 { |
|
1111 CField* field = CreateCFieldL(); |
|
1112 TUint32 attributes = KFieldAttributeConstant; |
|
1113 field->SetAttributes(attributes); |
|
1114 TBool ret = field->IsConstant(); |
|
1115 if(!ret) |
|
1116 return KErrGeneral; |
|
1117 |
|
1118 return KErrNone; |
|
1119 } |
|
1120 |
|
1121 // --------------------------------------------------------------------------- |
|
1122 // FieldIsDataL() |
|
1123 // --------------------------------------------------------------------------- |
|
1124 // |
|
1125 TInt CtGenericHIDAPI::FieldIsDataL( ) |
|
1126 { |
|
1127 CField* field = CreateCFieldL(); |
|
1128 TUint32 attributes = KFieldAttributeConstant; |
|
1129 field->SetAttributes(attributes); |
|
1130 TBool ret = field->IsData(); |
|
1131 if(ret) |
|
1132 return KErrGeneral; |
|
1133 |
|
1134 return KErrNone; |
|
1135 } |
|
1136 |
|
1137 // --------------------------------------------------------------------------- |
|
1138 // FieldSetLogicalMinL() |
|
1139 // --------------------------------------------------------------------------- |
|
1140 // |
|
1141 TInt CtGenericHIDAPI::FieldSetLogicalMinL() |
|
1142 { |
|
1143 CField* field = CreateCFieldL(); |
|
1144 |
|
1145 TInt value = 0; |
|
1146 field->SetLogicalMin(value); |
|
1147 |
|
1148 TInt ret = field->LogicalMin(); |
|
1149 if(ret != value) |
|
1150 return KErrGeneral; |
|
1151 |
|
1152 return KErrNone; |
|
1153 } |
|
1154 |
|
1155 // --------------------------------------------------------------------------- |
|
1156 // FieldSetLogicalMaxL() |
|
1157 // --------------------------------------------------------------------------- |
|
1158 // |
|
1159 TInt CtGenericHIDAPI::FieldSetLogicalMaxL( ) |
|
1160 { |
|
1161 CField* field = CreateCFieldL(); |
|
1162 TInt value = 10; |
|
1163 field->SetLogicalMax(value); |
|
1164 |
|
1165 TInt ret = field->LogicalMax(); |
|
1166 if(ret != value) |
|
1167 return KErrGeneral; |
|
1168 |
|
1169 return KErrNone; |
|
1170 } |
|
1171 |
|
1172 // --------------------------------------------------------------------------- |
|
1173 // FieldSetPhysicalMinL() |
|
1174 // --------------------------------------------------------------------------- |
|
1175 // |
|
1176 TInt CtGenericHIDAPI::FieldSetPhysicalMinL( ) |
|
1177 { |
|
1178 CField* field = CreateCFieldL(); |
|
1179 TInt value = 0; |
|
1180 field->SetPhysicalMin(value); |
|
1181 TInt ret = field->PhysicalMin(); |
|
1182 if(ret != value) |
|
1183 return KErrGeneral; |
|
1184 |
|
1185 return KErrNone; |
|
1186 } |
|
1187 |
|
1188 // --------------------------------------------------------------------------- |
|
1189 // FieldSetPhysicalMaxL() |
|
1190 // --------------------------------------------------------------------------- |
|
1191 // |
|
1192 TInt CtGenericHIDAPI::FieldSetPhysicalMaxL( ) |
|
1193 { |
|
1194 CField* field = CreateCFieldL(); |
|
1195 TInt value = 2; |
|
1196 field->SetPhysicalMax(value); |
|
1197 TInt ret = field->PhysicalMax(); |
|
1198 if(ret != value) |
|
1199 return KErrGeneral; |
|
1200 |
|
1201 return KErrNone; |
|
1202 } |
|
1203 |
|
1204 // --------------------------------------------------------------------------- |
|
1205 // FieldSetDesignatorMinL() |
|
1206 // --------------------------------------------------------------------------- |
|
1207 // |
|
1208 TInt CtGenericHIDAPI::FieldSetDesignatorMinL( ) |
|
1209 { |
|
1210 CField* field = CreateCFieldL(); |
|
1211 TInt value = 0; |
|
1212 field->SetDesignatorMin(value); |
|
1213 TInt ret = field->DesignatorMin(); |
|
1214 if(ret != value) |
|
1215 return KErrGeneral; |
|
1216 |
|
1217 return KErrNone; |
|
1218 } |
|
1219 |
|
1220 // --------------------------------------------------------------------------- |
|
1221 // FieldSetDesignatorMaxL() |
|
1222 // --------------------------------------------------------------------------- |
|
1223 // |
|
1224 TInt CtGenericHIDAPI::FieldSetDesignatorMaxL( ) |
|
1225 { |
|
1226 CField* field = CreateCFieldL(); |
|
1227 TInt value = 2; |
|
1228 field->SetDesignatorMax(value); |
|
1229 TInt ret = field->DesignatorMax(); |
|
1230 if(ret != value) |
|
1231 return KErrGeneral; |
|
1232 |
|
1233 return KErrNone; |
|
1234 } |
|
1235 |
|
1236 // --------------------------------------------------------------------------- |
|
1237 // FieldSetUsageMinL() |
|
1238 // --------------------------------------------------------------------------- |
|
1239 // |
|
1240 TInt CtGenericHIDAPI::FieldSetUsageMinL( ) |
|
1241 { |
|
1242 CField* field = CreateCFieldL(); |
|
1243 TInt value = 0; |
|
1244 field->SetUsageMin(value); |
|
1245 TInt ret = field->UsageMin(); |
|
1246 if(ret != value) |
|
1247 return KErrGeneral; |
|
1248 |
|
1249 return KErrNone; |
|
1250 } |
|
1251 |
|
1252 // --------------------------------------------------------------------------- |
|
1253 // FieldSetUsageMaxL() |
|
1254 // --------------------------------------------------------------------------- |
|
1255 // |
|
1256 TInt CtGenericHIDAPI::FieldSetUsageMaxL( ) |
|
1257 { |
|
1258 CField* field = CreateCFieldL(); |
|
1259 TInt value = 2; |
|
1260 field->SetUsageMax(value); |
|
1261 TInt ret = field->UsageMax(); |
|
1262 if(ret != value) |
|
1263 return KErrGeneral; |
|
1264 |
|
1265 return KErrNone; |
|
1266 } |
|
1267 |
|
1268 // --------------------------------------------------------------------------- |
|
1269 // FieldSetStringMinL() |
|
1270 // --------------------------------------------------------------------------- |
|
1271 // |
|
1272 TInt CtGenericHIDAPI::FieldSetStringMinL( ) |
|
1273 { |
|
1274 CField* field = CreateCFieldL(); |
|
1275 TInt value = 0; |
|
1276 field->SetStringMin(value); |
|
1277 TInt ret = field->StringMin(); |
|
1278 if(ret != value) |
|
1279 return KErrGeneral; |
|
1280 |
|
1281 return KErrNone; |
|
1282 } |
|
1283 // --------------------------------------------------------------------------- |
|
1284 // FieldSetStringMaxL() |
|
1285 // --------------------------------------------------------------------------- |
|
1286 // |
|
1287 TInt CtGenericHIDAPI::FieldSetStringMaxL( ) |
|
1288 { |
|
1289 CField* field = CreateCFieldL(); |
|
1290 TInt value = 2; |
|
1291 field->SetStringMax(value); |
|
1292 TInt ret = field->StringMax(); |
|
1293 if(ret != value) |
|
1294 return KErrGeneral; |
|
1295 |
|
1296 return KErrNone; |
|
1297 } |
|
1298 |
|
1299 // --------------------------------------------------------------------------- |
|
1300 // FieldSetLogicalRangeL() |
|
1301 // --------------------------------------------------------------------------- |
|
1302 // |
|
1303 TInt CtGenericHIDAPI::FieldSetLogicalRangeL( ) |
|
1304 { |
|
1305 CField* field = CreateCFieldL(); |
|
1306 TInt min = 0; |
|
1307 TInt max = 5; |
|
1308 field->SetLogicalRange(min,max); |
|
1309 TInt retMin = field->LogicalMin(); |
|
1310 TInt retMax = field->LogicalMax(); |
|
1311 if(min != retMin || max != retMax) |
|
1312 return KErrGeneral; |
|
1313 |
|
1314 return KErrNone; |
|
1315 } |
|
1316 |
|
1317 // --------------------------------------------------------------------------- |
|
1318 // FieldSetUsageRangeL() |
|
1319 // --------------------------------------------------------------------------- |
|
1320 // |
|
1321 TInt CtGenericHIDAPI::FieldSetUsageRangeL( ) |
|
1322 { |
|
1323 CField* field = CreateCFieldL(); |
|
1324 TInt min = 0; |
|
1325 TInt max = 5; |
|
1326 field->SetUsageRange(min,max); |
|
1327 TInt retMin = field->UsageMin(); |
|
1328 TInt retMax = field->UsageMax(); |
|
1329 if(min != retMin || max != retMax) |
|
1330 return KErrGeneral; |
|
1331 |
|
1332 return KErrNone; |
|
1333 } |
|
1334 |
|
1335 // --------------------------------------------------------------------------- |
|
1336 // FieldSetPhysicalRangeL() |
|
1337 // --------------------------------------------------------------------------- |
|
1338 // |
|
1339 TInt CtGenericHIDAPI::FieldSetPhysicalRangeL( ) |
|
1340 { |
|
1341 CField* field = CreateCFieldL(); |
|
1342 TInt min = 0; |
|
1343 TInt max = 5; |
|
1344 field->SetPhysicalRange(min,max); |
|
1345 TInt retMin = field->PhysicalMin(); |
|
1346 TInt retMax = field->PhysicalMax(); |
|
1347 if(min != retMin || max != retMax) |
|
1348 return KErrGeneral; |
|
1349 |
|
1350 return KErrNone; |
|
1351 } |
|
1352 |
|
1353 // --------------------------------------------------------------------------- |
|
1354 // FieldSetStringRangeL() |
|
1355 // --------------------------------------------------------------------------- |
|
1356 // |
|
1357 TInt CtGenericHIDAPI::FieldSetStringRangeL( ) |
|
1358 { |
|
1359 CField* field = CreateCFieldL(); |
|
1360 TInt min = 0; |
|
1361 TInt max = 5; |
|
1362 field->SetStringRange(min,max); |
|
1363 TInt retMin = field->StringMin(); |
|
1364 TInt retMax = field->StringMax(); |
|
1365 if(min != retMin || max != retMax) |
|
1366 return KErrGeneral; |
|
1367 |
|
1368 return KErrNone; |
|
1369 } |
|
1370 |
|
1371 // --------------------------------------------------------------------------- |
|
1372 // FieldSetDesignatorRangeL() |
|
1373 // --------------------------------------------------------------------------- |
|
1374 // |
|
1375 TInt CtGenericHIDAPI::FieldSetDesignatorRangeL( ) |
|
1376 { |
|
1377 CField* field = CreateCFieldL(); |
|
1378 TInt min = 0; |
|
1379 TInt max = 5; |
|
1380 field->SetDesignatorRange(min,max); |
|
1381 TInt retMin = field->DesignatorMin(); |
|
1382 TInt retMax = field->DesignatorMax(); |
|
1383 if(min != retMin || max != retMax) |
|
1384 return KErrGeneral; |
|
1385 |
|
1386 return KErrNone; |
|
1387 } |
|
1388 |
|
1389 // --------------------------------------------------------------------------- |
|
1390 // FieldIsInputL() |
|
1391 // --------------------------------------------------------------------------- |
|
1392 // |
|
1393 TInt CtGenericHIDAPI::FieldIsInputL( ) |
|
1394 { |
|
1395 CField* field = CreateCFieldL(); |
|
1396 CField::TType type = CField::EInput; |
|
1397 field->SetType(type); |
|
1398 TBool ret = field->IsInput(); |
|
1399 if(!ret) |
|
1400 return KErrGeneral; |
|
1401 //todo check EFalse |
|
1402 return KErrNone; |
|
1403 } |
|
1404 |
|
1405 // --------------------------------------------------------------------------- |
|
1406 // FieldIsOutputL() |
|
1407 // --------------------------------------------------------------------------- |
|
1408 // |
|
1409 TInt CtGenericHIDAPI::FieldIsOutputL( ) |
|
1410 { |
|
1411 CField* field = CreateCFieldL(); |
|
1412 CField::TType type = CField::EOutput; |
|
1413 field->SetType(type); |
|
1414 TBool ret = field->IsOutput(); |
|
1415 if(!ret) |
|
1416 return KErrGeneral; |
|
1417 //todo check EFalse |
|
1418 return KErrNone; |
|
1419 } |
|
1420 |
|
1421 // --------------------------------------------------------------------------- |
|
1422 // FieldIsFeatureL() |
|
1423 // --------------------------------------------------------------------------- |
|
1424 // |
|
1425 TInt CtGenericHIDAPI::FieldIsFeatureL( ) |
|
1426 { |
|
1427 CField* field = CreateCFieldL(); |
|
1428 CField::TType type = CField::EFeature; |
|
1429 field->SetType(type); |
|
1430 TBool ret = field->IsFeature(); |
|
1431 if(!ret) |
|
1432 return KErrGeneral; |
|
1433 //todo check EFalse |
|
1434 return KErrNone; |
|
1435 } |
|
1436 |
|
1437 // --------------------------------------------------------------------------- |
|
1438 // CountryCodeL() |
|
1439 // --------------------------------------------------------------------------- |
|
1440 // |
|
1441 TUint CtGenericHIDAPI::CountryCodeL(TInt /*aConnID*/) |
|
1442 { |
|
1443 return 0; |
|
1444 } |
|
1445 |
|
1446 // --------------------------------------------------------------------------- |
|
1447 // VendorIdL |
|
1448 // --------------------------------------------------------------------------- |
|
1449 // |
|
1450 TUint CtGenericHIDAPI::VendorIdL(TInt /*aConnID*/) |
|
1451 { |
|
1452 return 0x0421; |
|
1453 } |
|
1454 |
|
1455 // --------------------------------------------------------------------------- |
|
1456 // ProductIdL |
|
1457 // --------------------------------------------------------------------------- |
|
1458 // |
|
1459 TUint CtGenericHIDAPI::ProductIdL(TInt /*aConnID*/) |
|
1460 { |
|
1461 return 0x0083; |
|
1462 } |
|
1463 |
|
1464 // --------------------------------------------------------------------------- |
|
1465 // GetProtocolL |
|
1466 // --------------------------------------------------------------------------- |
|
1467 // |
|
1468 void CtGenericHIDAPI::GetProtocolL(TInt /*aConnID*/, TUint16 /*aInterface*/) |
|
1469 { |
|
1470 } |
|
1471 |
|
1472 // --------------------------------------------------------------------------- |
|
1473 // SetProtocolL |
|
1474 // --------------------------------------------------------------------------- |
|
1475 // |
|
1476 void CtGenericHIDAPI::SetProtocolL(TInt /*aConnID*/, TUint16 /*aValue*/, |
|
1477 TUint16 /*aInterface*/) |
|
1478 { |
|
1479 } |
|
1480 |
|
1481 // --------------------------------------------------------------------------- |
|
1482 // GetReportL |
|
1483 // --------------------------------------------------------------------------- |
|
1484 // |
|
1485 void CtGenericHIDAPI::GetReportL(TInt /*aConnID*/, TUint8 /*aReportType*/, |
|
1486 TUint8 /*aReportID*/, TUint16 /*aInterface*/, TUint16 /*aLength*/) |
|
1487 { |
|
1488 } |
|
1489 |
|
1490 // --------------------------------------------------------------------------- |
|
1491 // SetReportL |
|
1492 // --------------------------------------------------------------------------- |
|
1493 // |
|
1494 void CtGenericHIDAPI::SetReportL(TInt /*aConnID*/, TUint8 /*aReportType*/,TUint8 /*aReportID*/, |
|
1495 TUint16 /*aInterface*/, const TDesC8& /*aReport*/) |
|
1496 { |
|
1497 } |
|
1498 |
|
1499 // --------------------------------------------------------------------------- |
|
1500 // DataOutL() |
|
1501 // --------------------------------------------------------------------------- |
|
1502 // |
|
1503 void CtGenericHIDAPI::DataOutL(TInt /*aConnID*/, TUint8 /*aReportID*/, |
|
1504 TUint16 /*aInterface*/, const TDesC8& /*aReport*/) |
|
1505 { |
|
1506 } |
|
1507 |
|
1508 // --------------------------------------------------------------------------- |
|
1509 // GetIdleL |
|
1510 // --------------------------------------------------------------------------- |
|
1511 // |
|
1512 void CtGenericHIDAPI::GetIdleL(TInt /*aConnID*/, TUint8 /*aReportID*/, |
|
1513 TUint16 /*aInterface*/) |
|
1514 { |
|
1515 } |
|
1516 |
|
1517 // --------------------------------------------------------------------------- |
|
1518 // SetIdleL |
|
1519 // --------------------------------------------------------------------------- |
|
1520 // |
|
1521 void CtGenericHIDAPI::SetIdleL(TInt /*aConnID*/, TUint8 /*aDuration*/, TUint8 /*aReportID*/, |
|
1522 TUint16 /*aInterface*/) |
|
1523 { |
|
1524 } |
|
1525 |
|
1526 const CField* CtGenericHIDAPI::CreateConstCFieldL() |
|
1527 { |
|
1528 CReportRoot* tmp=iGenHID->ReportDescriptor(0); |
|
1529 User::LeaveIfNull(tmp); |
|
1530 const CCollection* collection = tmp->CollectionByIndex(0); |
|
1531 if(collection == NULL) |
|
1532 User::Leave(KErrGeneral); |
|
1533 const CField* field=collection->FieldByIndex(0); |
|
1534 return field; |
|
1535 } |
|
1536 |
|
1537 CField* CtGenericHIDAPI::CreateCFieldL() |
|
1538 { |
|
1539 return (CField*)CreateConstCFieldL(); |
|
1540 } |