localconnectivityservice/headset/inc/finder.h
branchRCL_3
changeset 20 4a793f564d72
parent 19 0aa8cc770c8a
child 21 74aa6861c87d
equal deleted inserted replaced
19:0aa8cc770c8a 20:4a793f564d72
     1 /*
       
     2 * Copyright (c) 2004-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 "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 headset field finder 
       
    15  *
       
    16 */
       
    17 
       
    18 #ifndef T_FINDER_H
       
    19 #define T_FINDER_H
       
    20 
       
    21 #include <e32std.h>
       
    22 #include "hidreportroot.h"
       
    23 
       
    24 /**
       
    25  * Headset finder
       
    26  *
       
    27  * Field finder for the consumer/multimedia keys field.
       
    28  *
       
    29  */
       
    30 class THeadsetFinder : public MHidFieldFinder
       
    31     {
       
    32 public:
       
    33     // From MHidFieldFinder
       
    34     /**
       
    35      * From MHidFieldFinder
       
    36      * Called by THidFieldSearch::SearchL() during traversal of the
       
    37      * report descriptor tree when a CCollection is encountered. It
       
    38      * will be called once, and only once, for every CCollection in the
       
    39      * descriptor. It is not called for the root collection
       
    40      * (the CReportRoot).
       
    41      *     
       
    42      * @param aCollection A pointer to the collection object.     
       
    43      * @return ETrue if the contents of this collection (any child CField
       
    44      *         or CCollection objects) should be examined.  A driver would return
       
    45      *         EFalse if a collection was not of a compatible type, for
       
    46      *         example if the usage page was inappropriate.
       
    47      */
       
    48     virtual TBool BeginCollection( const CCollection *aCollection );
       
    49 
       
    50     /**
       
    51      * From MHidFieldFinder
       
    52      * Called by THidFieldSearch::SearchL() during traversal of the
       
    53      * report descriptor tree when all CFields and child CCollections
       
    54      * of a CCollection have been examined.  It will be called once,
       
    55      * and only once, for every CCollection in the descriptor. It is
       
    56      * not called for the root collection (the CReportRoot).
       
    57      *     
       
    58      * @param aCollection Collection pointer
       
    59      * @return ETrue if the search (tree traversal) should
       
    60      *         continue. A driver returns EFalse if it has finished examining
       
    61      *         the whole descriptor, in general this will be if it has
       
    62      *         established that it is compatible with the report descriptor.
       
    63      */
       
    64     virtual TBool EndCollection( const CCollection *aCollection );
       
    65 
       
    66     /**
       
    67      * From MHidFieldFinder
       
    68      * Called once for each CField in a CCollection by
       
    69      * THidFieldSearch::SearchL() during the traversal of a report
       
    70      * descriptor tree.
       
    71      *     
       
    72      * @param aField THe pointer to field     
       
    73      */
       
    74     virtual void Field( const CField* aField );
       
    75 
       
    76 public:
       
    77 
       
    78     /** 
       
    79      * Constructor 
       
    80      */
       
    81     THeadsetFinder();
       
    82 
       
    83     /**
       
    84      * Check whether supported fields has been found.
       
    85      *     
       
    86      * @return ETrue if it has.
       
    87      */
       
    88     TBool Found() const;
       
    89 
       
    90     /**
       
    91      * Check whether a given field contains the consumer usages.
       
    92      *     
       
    93      * @param aField Pointer to the field to test.
       
    94      * @return ETrue if it does.
       
    95      */
       
    96     TBool IsConsumer( const CField* aField ) const;
       
    97 
       
    98     /**
       
    99      * Check whether a given field contains the telephony usages.
       
   100      *     
       
   101      * @param aField Pointer to the field to test.
       
   102      * @return ETrue if it does.
       
   103      */
       
   104     TBool IsTelephony( const CField* aField ) const;
       
   105 
       
   106     /**
       
   107      * Reset the field pointer array
       
   108      *
       
   109      */
       
   110     void EmptyList();
       
   111 
       
   112     /**
       
   113      * Returns number of supported fields.
       
   114      *
       
   115      * @return Field count
       
   116      */
       
   117     TInt FieldCount();
       
   118 
       
   119     /**
       
   120      * Read the field pointer from array at specified index
       
   121      *     
       
   122      * @param aIndex Index to the field pointer array
       
   123      * @return Pointer to the desired field
       
   124      */
       
   125     CField* GetFieldAtIndex( TInt aIndex );
       
   126 
       
   127 private:
       
   128 
       
   129     /**
       
   130      *  Pointer to the top level application collection being searched. 
       
   131      *  Not own.
       
   132      */
       
   133     const CCollection* iAppCollection;
       
   134 
       
   135     /**
       
   136      *  Array of field pointers:
       
   137      *  Not own.
       
   138      */
       
   139     RPointerArray<CField> iFieldList;
       
   140     };
       
   141 #endif