devicesrv_plat/accessory_policy_usb_audio_api/inc/accpolaudiounitbase.h
changeset 0 4e1aa6a622a0
child 21 ccb4f6b3db21
equal deleted inserted replaced
-1:000000000000 0:4e1aa6a622a0
       
     1 /*
       
     2  * Copyright (c) 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:  Base class for audio unit objects.
       
    15  *
       
    16  */
       
    17 
       
    18 #ifndef ACCPOLAUDIOUNITBASE_H
       
    19 #define ACCPOLAUDIOUNITBASE_H
       
    20 
       
    21 // SYSTEM INCLUDES
       
    22 #include <accpolobjectbase.h>
       
    23 #include <accpolobjecttypes.h>
       
    24 
       
    25 // FORWARD DECLARATIONS
       
    26 class CAccPolAudioControlBase;
       
    27 
       
    28 /**
       
    29  *  Base class for audio unit objects.
       
    30  *
       
    31  *  @accpolaudiodevicetopology.lib
       
    32  */
       
    33 NONSHARABLE_CLASS ( CAccPolAudioUnitBase ) : public CAccPolObjectBase
       
    34     {
       
    35 public:
       
    36 
       
    37     /**
       
    38      * Destructor.
       
    39      */
       
    40     virtual ~CAccPolAudioUnitBase();
       
    41 
       
    42     /**
       
    43      * Assign operator for audio unit base class.
       
    44      *
       
    45      * @param CAccPolAudioUnitBase, Const reference to base class to be copied.
       
    46      * @return CAccPolAudioUnitBase, Reference to object pointer.
       
    47      */
       
    48     IMPORT_C CAccPolAudioUnitBase& operator= ( const CAccPolAudioUnitBase& );
       
    49 
       
    50     /**
       
    51      * Returns the audio unit Id.
       
    52      *
       
    53      * @return TUint8, Value of the audio unit Id.
       
    54      */
       
    55     IMPORT_C TUint8 UnitId() const;
       
    56 
       
    57     /**
       
    58      * Returns the source Id.
       
    59      *
       
    60      * in USB case, Id where this audio unit is linked.
       
    61      * If audio unit cointains more than one Source Ids then the first item of the
       
    62      * source Ids list is returned. Use GetSourceIds method to get list of source Ids.
       
    63      *
       
    64      * @return TUint8, Value of the source Id.
       
    65      */
       
    66     IMPORT_C TUint8 SourceId() const;
       
    67 
       
    68     /**
       
    69      * Returns an array which contains list of source Ids.
       
    70      *
       
    71      * in USB case, Id(s) where this audio unit is linked.
       
    72      *
       
    73      * @param aSourceIds, Array which inludes source Ids.
       
    74      * @return void
       
    75      */
       
    76     IMPORT_C void GetSourceIds( RArray<TInt>& aSourceIds ) const;
       
    77 
       
    78     /**
       
    79      * Returns the source Id count.
       
    80      *
       
    81      * @return TInt, Source Id count.
       
    82      */
       
    83     IMPORT_C TInt SourceIdCount() const;
       
    84 
       
    85     /**
       
    86      * Source Id to store for this audio unit.
       
    87      *
       
    88      * @param aSourceId, Source Id to be stored.
       
    89      * @return void.
       
    90      */
       
    91     IMPORT_C void AddSourceIdL( TUint8 aSourceId );
       
    92 
       
    93     /**
       
    94      * Get an audio control object according to the object type and channel number.
       
    95      *
       
    96      * @param aObjectType object type, Following object types are supported EAccPolAudioVolumeControlObject,
       
    97      *                                                                      EAccPolAudioMuteControlObject,
       
    98      *                                                                      EAccPolAudioInputControlObject.
       
    99      * @param aChannel, Channel number. See accpolaudiotopologytypes.h.
       
   100      * @param aAudioControl, On return contains an audio control object if found, otherwise NULL.
       
   101      * @return Tbool, ETrue if audio control object found, otherwise EFalse.
       
   102      */
       
   103     IMPORT_C TBool GetAudioControlL( TTopologyConObjectType aObjectType,
       
   104         TUint32 aChannel,
       
   105         CAccPolAudioControlBase*& aAudioControl ) const;
       
   106 
       
   107     /**
       
   108      * Get a channel spesific audio control objects.
       
   109      *
       
   110      * @param aChannel, Channel number. See accpolaudiotopologytypes.h.
       
   111      * @param aAudioControls, On return contains an audio control objects.
       
   112      * If audio control objects not found empty array is returned.
       
   113      * @return void.
       
   114      */
       
   115     IMPORT_C void GetAudioControlsL( TUint32 aChannel,
       
   116         RPointerArray<CAccPolAudioControlBase>& aAudioControls ) const;
       
   117 
       
   118     /**
       
   119      * Gets all audio control objects of this audio unit.
       
   120      *
       
   121      * @param aAudioControls on return, contains the audio control objects. If any of an audio control objects not found
       
   122      *        empty array is returned.
       
   123      * @return void.
       
   124      */
       
   125     IMPORT_C void GetAudioControlsL( RPointerArray<CAccPolAudioControlBase>& aAudioControls ) const;
       
   126 
       
   127     /**
       
   128      * Get a next audio unit object where this audio unit is linked.
       
   129      *
       
   130      * If audio unit cointains several source id links then the first linked audio unit is returned.
       
   131      *
       
   132      * @param aAudioUnit, On return contains the audio unit object if found, otherwise NULL.
       
   133      * @return Tbool, ETrue if audio unit object found, otherwise EFalse.
       
   134      */
       
   135     IMPORT_C TBool GetNextAudioUnitL( CAccPolAudioUnitBase*& aAudioUnit ) const;
       
   136 
       
   137     /**
       
   138      * Get a previous audio unit object where this audio unit is linked.
       
   139      *
       
   140      * @param aAudioUnit, On return contains the audio unit object if found, otherwise NULL.
       
   141      * @return Tbool, ETrue if audio unit object found, otherwise EFalse.
       
   142      */
       
   143     IMPORT_C TBool GetPreviousAudioUnitL( CAccPolAudioUnitBase*& aAudioUnit ) const;
       
   144 
       
   145     /**
       
   146      * Get a list of audio units where this audio unit is linked.
       
   147      *
       
   148      * @param aAudioUnits, On return contains an audio unit objects.
       
   149      * If any of an audio unit objects not found empty array is returned.
       
   150      * @return void.
       
   151      */
       
   152     IMPORT_C void GetAudioUnitListL( RPointerArray<CAccPolAudioUnitBase>& aAudioUnits ) const;
       
   153 
       
   154     /**
       
   155      * Add an audio control object for this audio unit.
       
   156      *
       
   157      * @param aAudioControl an audio control object to be stored.
       
   158      * @return void.
       
   159      */
       
   160     IMPORT_C void AddControlL( CAccPolAudioControlBase& aAudioControl );
       
   161 
       
   162 public:
       
   163 
       
   164     /**
       
   165      * Returns the previous audio unit Id ( internal use only ).
       
   166      */
       
   167     TUint8 PreviousUnitId() const;
       
   168 
       
   169     /**
       
   170      * Sets the previous audio unit Id ( internal use only ).
       
   171      */
       
   172     void SetPreviousUnitId( TUint8 aPreUnitId );
       
   173 
       
   174 protected:
       
   175 
       
   176     /**
       
   177      * Externalize audio control base class.
       
   178      *
       
   179      * @param aStream, Write stream object.
       
   180      * @return void.
       
   181      */
       
   182     IMPORT_C void ExternalizeAudioUnitBaseL( RWriteStream& aStream ) const;
       
   183 
       
   184     /**
       
   185      * Internalize audio control base class.
       
   186      *
       
   187      * @param aStream, Read stream object.
       
   188      * @return void.
       
   189      */
       
   190     IMPORT_C void InternalizeAudioUnitBaseL( RReadStream& aStream );
       
   191 
       
   192 protected:
       
   193 
       
   194     /**
       
   195      * C++ default constructor.
       
   196      */
       
   197     CAccPolAudioUnitBase( const TTopologyConObjectType aObjecType,
       
   198         CAccPolObjectCon* aObject = NULL );
       
   199 
       
   200     /**
       
   201      * C++ constructor.
       
   202      */
       
   203     CAccPolAudioUnitBase ( const TUint8 aUnitId,
       
   204         const TTopologyConObjectType aObjecType );
       
   205 
       
   206     /**
       
   207      * C++ constructor.
       
   208      */
       
   209     CAccPolAudioUnitBase ( const TUint8 aUnitId,
       
   210         const TUint8 aSourceId,
       
   211         const TTopologyConObjectType aObjecType );
       
   212 
       
   213 private:
       
   214     void CopyL ( const CAccPolAudioUnitBase& aAudioUnitBaseObject );
       
   215     
       
   216 private:
       
   217 
       
   218     /**
       
   219      * Audio unit Id.
       
   220      */
       
   221     TUint8 iUnitId;
       
   222 
       
   223     /**
       
   224      * Audio unit Source Ids.
       
   225      */
       
   226     RArray<TInt> iSourceId;
       
   227 
       
   228     /**
       
   229      * Previous audio unit Id.
       
   230      */
       
   231     TUint8 iPreUnitId;
       
   232 
       
   233     /**
       
   234      * Control objects of this audio unit.
       
   235      */
       
   236     RPointerArray<CAccPolAudioControlBase> iAudioControls;
       
   237     };
       
   238 
       
   239 #endif // ACCPOLAUDIOUNITBASE_H