bluetoothengine/bteng/inc/btengsrvpluginmgr.h
changeset 0 f63038272f30
equal deleted inserted replaced
-1:000000000000 0:f63038272f30
       
     1 /*
       
     2 * Copyright (c) 2006 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:  Helper class for BTEng server to manage and interface with
       
    15 *                the profile plug-ins the profile plug-ins.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 #ifndef BTENGSRVPLUGINMGR_H
       
    22 #define BTENGSRVPLUGINMGR_H
       
    23 
       
    24 #include "btengclientserver.h"
       
    25 #include "btengplugin.h"
       
    26 
       
    27 class CBTEngServer;
       
    28 class TEComResolverParams;
       
    29 typedef RPointerArray<CImplementationInformation> RImplInfoPtrArray;
       
    30 typedef RPointerArray<CBTEngPlugin> RPluginPtrArray;
       
    31 
       
    32 /**  ?description */
       
    33 //const ?type ?constant_var = ?constant;
       
    34 
       
    35 
       
    36 /**
       
    37  *  ?one_line_short_description
       
    38  *
       
    39  *  ?more_complete_description
       
    40  *
       
    41  *  @lib ?library
       
    42  *  @since S60 v3.2
       
    43  */
       
    44 NONSHARABLE_CLASS( CBTEngSrvPluginMgr ) : public CBase, 
       
    45                                           public MBTEngPluginObserver
       
    46     {
       
    47 
       
    48 public:
       
    49 
       
    50     /**
       
    51      * Two-phase constructor
       
    52      */
       
    53     static CBTEngSrvPluginMgr* NewL( CBTEngServer* aServer );
       
    54 
       
    55     /**
       
    56      * Destructor
       
    57      */
       
    58     virtual ~CBTEngSrvPluginMgr();
       
    59 
       
    60     /**
       
    61      * ?description
       
    62      *
       
    63      * @since S60 v3.2
       
    64      * @param ?arg1 ?description
       
    65      */
       
    66     void ProcessCommandL( const RMessage2& aMessage );
       
    67 
       
    68     /**
       
    69      * ?description
       
    70      *
       
    71      * @since S60 v3.2
       
    72      */
       
    73     void DisconnectAllPlugins();
       
    74 
       
    75     /**
       
    76      * ?description
       
    77      *
       
    78      * @since S60 v3.2
       
    79      * @param aParams Selection parameters for loading a specific plugin.
       
    80      *                If it is empty (zero-length descriptor), 
       
    81      *                all plug-ins are loaded.
       
    82      */
       
    83     void LoadProfilePluginsL( const TEComResolverParams aParams );
       
    84 
       
    85     /**
       
    86      * ?description
       
    87      *
       
    88      * @since S60 v3.2
       
    89      * @return The number of ECom plug-ins still to load.
       
    90      */
       
    91     TInt LoadPluginL();
       
    92 
       
    93     /**
       
    94      * ?description
       
    95      *
       
    96      * @since S60 v3.2
       
    97      */
       
    98     void UnloadProfilePlugins();
       
    99 
       
   100     /**
       
   101      * ?description
       
   102      *
       
   103      * @since S60 v3.2
       
   104      * @param ?arg1 ?description
       
   105      */
       
   106     void LoadBTSapPluginL();
       
   107 
       
   108     /**
       
   109      * ?description
       
   110      *
       
   111      * @since S60 v3.2
       
   112      * @param ?arg1 ?description
       
   113      */
       
   114     void UnloadBTSapPlugin();
       
   115     
       
   116     /**
       
   117     * Disconnects the profile specified by aProfile
       
   118     * Currently used only when emergency call is created for disconnecting SAP
       
   119      *
       
   120      * @since S60 v3.2
       
   121      * @param ?arg1 ?description
       
   122      */
       
   123     void DisconnectProfile( TBTProfile aProfile );
       
   124 	
       
   125     /**
       
   126      * Checks if any audio connection is established
       
   127      *
       
   128      * @since S60 v5.0
       
   129      * @return ETrue if any audio connection is established
       
   130      */
       
   131     TBool CheckAudioConnectionsL();
       
   132 	
       
   133     /**
       
   134      * Returns the service (limited to services managed in bteng scope)
       
   135      * level connection status of the specified device.
       
   136      *
       
   137      * @param aAddr the address of the device
       
   138      * @return one of TBTEngConnectionStatus enums
       
   139      */
       
   140     TBTEngConnectionStatus IsDeviceConnected( const TBTDevAddr& aAddr );    
       
   141     
       
   142 // from base class MBTEngPluginObserver
       
   143 
       
   144     /**
       
   145      * From MBTEngPluginObserver.
       
   146      * ?description
       
   147      *
       
   148      * @since S60 v3.2
       
   149      * @param ?arg1 ?description
       
   150      */
       
   151     virtual void ConnectComplete( const TBTDevAddr& aAddr, 
       
   152                                    TBTProfile aProfile, TInt aErr, 
       
   153                                    RBTDevAddrArray* aConflicts = NULL );
       
   154 
       
   155     /**
       
   156      * From MBTEngPluginObserver.
       
   157      * ?description
       
   158      *
       
   159      * @since S60 v3.2
       
   160      * @param ?arg1 ?description
       
   161      */
       
   162     virtual void DisconnectComplete( const TBTDevAddr& aAddr, 
       
   163                                       TBTProfile aProfile, TInt aErr );
       
   164 
       
   165 private:
       
   166 
       
   167     /**
       
   168      * C++ default constructor
       
   169      */
       
   170     CBTEngSrvPluginMgr( CBTEngServer* aServer );
       
   171 
       
   172     /**
       
   173      * Symbian 2nd-phase constructor
       
   174      */
       
   175     void ConstructL();
       
   176 
       
   177     /**
       
   178      * ?description
       
   179      *
       
   180      * @since S60 v3.2
       
   181      * @param ?arg1 ?description
       
   182      * @return ?description
       
   183      */
       
   184     TInt Connect( const TBTDevAddr& aAddr, const TBTDeviceClass& aDeviceClass );
       
   185 
       
   186     /**
       
   187      * ?description
       
   188      *
       
   189      * @since S60 v3.2
       
   190      * @param ?arg1 ?description
       
   191      * @return ?description
       
   192      */
       
   193     TInt CancelConnect( const TBTDevAddr& aAddr );
       
   194 
       
   195     /**
       
   196      * ?description
       
   197      *
       
   198      * @since S60 v3.2
       
   199      * @param ?arg1 ?description
       
   200      * @return ?description
       
   201      */
       
   202     TInt Disconnect( const TBTDevAddr& aAddr, TBTDisconnectType aDiscType );
       
   203 
       
   204 
       
   205     /**
       
   206      * ?description
       
   207      *
       
   208      * @since S60 v5.1
       
   209      * @param aDeviceClass Device class of the remote device is used if 
       
   210      *                      no EIR data of this device exists.
       
   211      * @param aAddr The address of remote device is used to get EIR data.
       
   212      *              Firstly use the service UUIDs in EIR data to determine if 
       
   213      *              the remote device is connectable or not. 
       
   214      * @return The index of plugin in the plugin array, which supports the 
       
   215      *              profiles via device class, 
       
   216      *          . 
       
   217      */
       
   218     TInt GetConnectablePluginIndex( const TBTDeviceClass& aDeviceClass, const TBTDevAddr& aAddr = TBTDevAddr() );
       
   219 
       
   220     /**
       
   221      * ?description
       
   222      *
       
   223      * @since S60 v3.2
       
   224      * @param ?arg1 ?description
       
   225      * @return ?description
       
   226      */
       
   227     TInt GetConnectedAddresses( RBTDevAddrArray& aAddrArray, TBTProfile aProfile );
       
   228 
       
   229     /**
       
   230      * Checks from feature manager and central repository if the requested
       
   231      * feature is supported and enabled.
       
   232      *
       
   233      * @since S60 v3.2
       
   234      * @param aProfile The profile to check if it is supported and enabled.
       
   235      */
       
   236     TBool CheckFeatureEnabledL( TInt aProfile );
       
   237 
       
   238     /**
       
   239      * Maps a Clasee of Device to a profile identifier (UUID short form).
       
   240      *
       
   241      * @since S60 v3.2
       
   242      * @param aProfile The profile to map to a feature.
       
   243      */
       
   244     static TBTProfile MapDeviceClassToProfile( const TBTDeviceClass& aDeviceClass );
       
   245 
       
   246     /**
       
   247      * Maps a profile identifier (UUID short form) to a feature 
       
   248      * to check from the feature manager.
       
   249      *
       
   250      * @since S60 v3.2
       
   251      * @param aProfile The profile to map to a feature.
       
   252      */
       
   253     static TInt MapProfileToFeature( TInt aProfile );
       
   254     
       
   255     /**
       
   256      * Connectable if the UUID in Eir data is supported by plugins.
       
   257      *
       
   258      * @since S60 v5.1
       
   259      * @return The first index of plugin supporting specified UUID.
       
   260      */
       
   261     TInt GetConnectablePluginIndexByEir();
       
   262     
       
   263     /**
       
   264      * Get Eir data of device in cache.
       
   265      * 
       
   266      * @since S60 v5.1
       
   267      * @param aAddr The address of remote device
       
   268      * @return Symbian error code
       
   269      */
       
   270     TInt DoGetEirData( const TBTDevAddr& aAddr );
       
   271     
       
   272     /**
       
   273      * Utility function to check if profile supported by plugins.
       
   274      * 
       
   275      * @param aProfile The profile to check
       
   276      * @return The index of the first plugin in plugin array  
       
   277      *         supporting this profile, KErrNotFound if not supported.
       
   278      */
       
   279     TInt GetFirstPluginOfProfileSupported( TBTProfile aProfile );
       
   280 	
       
   281 	/** 
       
   282 	Returns ETrue if the specified plugin is to be loaded in the current 
       
   283 	'Enterprise Disabling of Bluetooth' mode, EFalse otherwise. 
       
   284 	@param The implementation UID of the plugin we want to know whether should 
       
   285 	be elided for Enterprise Disabling of Bluetooth reasons.
       
   286 	@return See description.
       
   287 	*/
       
   288 	TBool FilterByEnterpriseDisablementModeL(TUid aUid) const;	
       
   289     
       
   290 private: // data
       
   291 
       
   292     /**
       
   293      * Array of pointers to ECom plug-in information objects.
       
   294      */
       
   295     RImplInfoPtrArray iPluginInfoArray;
       
   296 
       
   297     /**
       
   298      * Array of pointers to the BTEng ECom plug-ins loaded by BTEng.
       
   299      */
       
   300     RPluginPtrArray iPluginArray;
       
   301 
       
   302     /**
       
   303      * The server instance.
       
   304      * Not own.
       
   305      */
       
   306     CBTEngServer* iServer;
       
   307     
       
   308     /**
       
   309      * Hose Resolver to get cached EIR.
       
   310      * Own.
       
   311      */    
       
   312     RHostResolver iHostResolver;
       
   313     
       
   314     /**
       
   315      * used for getting cached EIR.
       
   316      */
       
   317     TInquirySockAddr iInquirySockAddr;
       
   318 
       
   319     /**
       
   320      * Entry to store inquiry result.
       
   321      */
       
   322     TNameEntry iNameEntry;
       
   323     
       
   324     /**
       
   325      * Container of UUIDs, gotten from Eir data.
       
   326      * Own.
       
   327      */
       
   328     RExtendedInquiryResponseUUIDContainer iUuidContainter;
       
   329     };
       
   330 
       
   331 
       
   332 //#include "?include_file.inl"
       
   333 
       
   334 
       
   335 #endif // BTENGSRVPLUGINMGR_H