accessoryservices/tspclientmapper/inc/tspclientmapperimpl.h
changeset 0 4e1aa6a622a0
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:  This API is used for creating mappings between remote
       
    15 *                 control clients.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #ifndef TSPCLIENTMAPPERIMPL_H
       
    21 #define TSPCLIENTMAPPERIMPL_H
       
    22 
       
    23 // INCLUDES
       
    24 #include <e32base.h>
       
    25 #include <e32std.h>
       
    26 #include <tspclientmapper.h>
       
    27 
       
    28 // FORWARD DECLARATIONS
       
    29 // CLASS DECLARATION
       
    30 
       
    31 /**
       
    32 * @since S60 5.0
       
    33 */
       
    34 NONSHARABLE_CLASS( CTspClientMapperImpl ): public CTspClientMapper 
       
    35   {
       
    36   
       
    37 public:
       
    38     
       
    39     /**
       
    40     * Default Constructor 
       
    41     */
       
    42     CTspClientMapperImpl();
       
    43     
       
    44     
       
    45     
       
    46     /**
       
    47     * Default Destructor 
       
    48     */
       
    49     virtual ~CTspClientMapperImpl();
       
    50     
       
    51     /**
       
    52     * Symbian two phased constructor.
       
    53     */
       
    54     static CTspClientMapperImpl* NewL();
       
    55     
       
    56 public: 
       
    57 
       
    58     /**
       
    59     * This function is used to set a target client for TSP. This way Target
       
    60     * Selector Plugin creates a mapping to the correct client.
       
    61     *
       
    62     * @param    aMappingType @see TspClientMappingType
       
    63     * @param    aProcessId is the process identifier of the client
       
    64     */
       
    65     void SetTspTargetClient( 
       
    66         TTspClientMappingType aMappingType,
       
    67         TProcessId aProcessId );
       
    68     
       
    69     /**
       
    70     * This function is used to set a TSP target client for another type then it
       
    71     * was originally set for. This way targets don't have to be removed from
       
    72     * one type and then added to another.
       
    73     *
       
    74     * @param    aMappingType is the type this client has to be set for
       
    75     * @param    aProcessId is the process identifier of the client
       
    76     * @leave    KErrNotSupported if invalid mapping type. KErrNotFound if this
       
    77     *           ProcessId is not found from any of the arrays.
       
    78     */
       
    79     TInt SetTspTargetClientToOtherType( 
       
    80         TTspClientMappingType aMappingType,
       
    81         TProcessId aProcessId );
       
    82     
       
    83     /**
       
    84     * This function is used to remove a target client from TSP. This way Target
       
    85     * Selector Plugin creates a mapping to the correct client.
       
    86     *
       
    87     * @param    aMappingType @see TspClientMappingType
       
    88     * @param    aProcessId is the process identifier of the client
       
    89     * @return   KErrNotSupported if invalid mapping type or KErrNotFound if
       
    90     *           this process id is not defined for this type.
       
    91     */
       
    92     TInt RemoveTspTargetClient(  
       
    93         TTspClientMappingType aMappingType,
       
    94         TProcessId aProcessId );
       
    95     
       
    96     
       
    97     
       
    98 private:
       
    99     
       
   100     friend class CRemConTspController;
       
   101     
       
   102     /**
       
   103     * Default Constructor 
       
   104     */
       
   105     void ConstructL();
       
   106     
       
   107     /**
       
   108     * This function is used to get the audio clients that are currently
       
   109     * playing audio. The function is used by TSP.
       
   110     *
       
   111     * @param    aMappingType @see TspClientMappingType
       
   112     * @param    aPidArray is given as a reference. The playing audio clients
       
   113     *           are added to this array.
       
   114     * @return   aPidArray is returned with the asked process identifiers.
       
   115     */
       
   116     TInt GetTspTargetClients(  
       
   117         TTspClientMappingType aMappingType,
       
   118         RArray<TProcessId>& aPidArray );
       
   119     
       
   120     void OpenMutexL();
       
   121     
       
   122     void CloseMutex();
       
   123     
       
   124 private:
       
   125     /**
       
   126     * Synchronizes access to client array.
       
   127     */
       
   128     RMutex iMutex;
       
   129     
       
   130     /**
       
   131     * A helper class for managing acces to mutex.
       
   132     */
       
   133     class TTspClientMapperSynch
       
   134         {
       
   135         public:
       
   136             TTspClientMapperSynch( RMutex& aMutex );
       
   137             ~TTspClientMapperSynch();
       
   138         private:
       
   139             TTspClientMapperSynch();
       
   140             RMutex& iMutex;
       
   141         };
       
   142     };
       
   143 
       
   144 #endif // TSPCLIENTMAPPERIMPL_H
       
   145 
       
   146 // End of File