bluetoothengine/btpbap/inc/Pbapplugin.h
changeset 0 f63038272f30
equal deleted inserted replaced
-1:000000000000 0:f63038272f30
       
     1 /*
       
     2 * Copyright (c) 2007-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 is the btpbap ecom plugin class declaration.
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef BTPBAPPLUGIN_H
       
    19 #define BTPBAPPLUGIN_H
       
    20 
       
    21 #include <e32base.h>
       
    22 #include <btengplugin.h>
       
    23 #include <pbapcli.h>
       
    24 #include "DisconnectHelper.h"    
       
    25 
       
    26     
       
    27 /**
       
    28  *  BTPBAP plugin class
       
    29  *
       
    30  *  This is the CBTEngPlugin implementation
       
    31  *  @since S60 v3.2
       
    32  */
       
    33 NONSHARABLE_CLASS ( CPBAPplugin ) : public CBTEngPlugin,  
       
    34                                     public MDisconnectionCallback 
       
    35     {
       
    36 public:
       
    37 
       
    38 
       
    39     /**
       
    40      * Two-phased constructor.     
       
    41      */
       
    42     static CPBAPplugin* NewL();
       
    43 
       
    44     /**
       
    45      * Destructor.
       
    46      */    
       
    47     ~CPBAPplugin();
       
    48     
       
    49     
       
    50     /**
       
    51      * From CBTEngPlugin.
       
    52      * Sets the observer for receiving connection events through the 
       
    53      * MBTEngPluginObserver interface. This method MUST be called 
       
    54      * before any command is given to the plug-in
       
    55      *
       
    56      * @since S60 v3.2
       
    57      * @param aObserver The observer of connection events.
       
    58      */
       
    59      void SetObserver( MBTEngPluginObserver* aObserver );
       
    60 
       
    61     /**
       
    62      * From CBTEngPlugin.
       
    63      * Gets the list of profiles implemented by this plug-in.
       
    64      * Profiles are identified by the SDP Service Class UUID (short form), 
       
    65      * as assigned by the Bluetooth SIG.
       
    66      *
       
    67      * @since S60 v3.2
       
    68      * @param aProfiles Array of integers identifying the BT profiles 
       
    69      *                  implemented by this plug-in.
       
    70      */
       
    71      void GetSupportedProfiles( RProfileArray& aProfiles );
       
    72 
       
    73     /**
       
    74      * From CBTEngPlugin.
       
    75      * Indicates if this plug-in implements the specified profiles.
       
    76      * Profiles are identified by the SDP Service Class UUID (short form), 
       
    77      * as assigned by the Bluetooth SIG.
       
    78      *
       
    79      * @since S60 v3.2
       
    80      * @param aProfile Integer identifying the BT profile.
       
    81      * @return ETrue if the plug-in implements the requested profile, 
       
    82      *               otherwise EFalse.
       
    83      */
       
    84      TBool IsProfileSupported( const TBTProfile aProfile ) const ;
       
    85 
       
    86     /**
       
    87      * From CBTEngPlugin.
       
    88      * Instructs the plug-in to create a service-level connection 
       
    89      * with the specified Bluetooth address.
       
    90      *
       
    91      * This is an asynchronous operation; on completion, the plug-in informs 
       
    92      * the observer by calling MBTEngPluginObserver::ConnectComplete with 
       
    93      * the appropriate error code.
       
    94      *
       
    95      * @since S60 v3.2
       
    96      * @param aAddr The BT device address identifying a remote device.
       
    97      * @return KErrNone on success, otherwise an appropriate error code.
       
    98      */
       
    99      TInt Connect( const TBTDevAddr& aAddr );
       
   100 
       
   101     /**
       
   102      * From CBTEngPlugin.
       
   103      * Instructs the plug-in to cancel the creation a service-level 
       
   104      * connection with the specified Bluetooth address.
       
   105      *
       
   106      * In addition, as this is part of an asynchronous operation, the plug-in 
       
   107      * completes the outstanding asyncronous request status with KErrCancel.
       
   108      *
       
   109      * @since S60 v3.2
       
   110      * @param aAddr The BT device address identifying a remote device.
       
   111      */
       
   112      void CancelConnect( const TBTDevAddr& aAddr );
       
   113 
       
   114     /**
       
   115      * From CBTEngPlugin.
       
   116      * Instructs the plug-in to create a service-level connection 
       
   117      * with the specified Bluetooth address.
       
   118      *
       
   119      * This is an asynchronous operation; on completion, the plug-in informs 
       
   120      * the observer by calling MBTEngPluginObserver::DisconnectComplete with 
       
   121      * the appropriate error code.
       
   122      *
       
   123      *
       
   124      * @since S60 v3.2
       
   125      * @param aAddr The BT device address identifying a remote device.
       
   126      *              In case the address is the NULL address, the plug-in is
       
   127      *              expected to disconnect all its connections.
       
   128      * @param aDiscType The type of disconnection; 
       
   129      *                  EGraceful for graceful (normal) disconnection, 
       
   130      *                  EImmediate for immediate (forced) disconnection.
       
   131      * @return KErrNone on success, otherwise an appropriate error code.
       
   132      */
       
   133      TInt Disconnect( const TBTDevAddr& aAddr, 
       
   134                               TBTDisconnectType aDiscType );
       
   135    
       
   136    /**
       
   137     * From CBTEngPlugin.
       
   138     * Gets the addresses of the connected devices for the specified profile.
       
   139     *
       
   140     * @since S60 v3.2
       
   141     * @param aAddrArray On return, holds the Bluetooth device addresses 
       
   142     *                   of the connected Bluetooth devices for the 
       
   143     *                   requested profile.
       
   144     * @param aConnectedProfile The profile for which the existing 
       
   145     *                          connections are requested.
       
   146     * @return None.
       
   147     */
       
   148     void GetConnections( RBTDevAddrArray& aAddrArray, 
       
   149                                   TBTProfile aConnectedProfile );
       
   150 
       
   151     /**
       
   152      * From CBTEngPlugin.
       
   153      * Indicates if this plug-in has a service-level connection 
       
   154      * with the specified Bluetooth address.
       
   155      *
       
   156      * @since S60 v3.2
       
   157      * @param aAddr The BT device address identifying a remote device.
       
   158      * @return The status of the connection according to the TConnectionStatus
       
   159      *         enumeration. EConnecting is interpreted that at least one 
       
   160      *         incoming connection request has been completed, but that not 
       
   161      *         all service-level connections have been fully established.
       
   162      */
       
   163     TBTEngConnectionStatus IsConnected( const TBTDevAddr& aAddr );
       
   164 
       
   165 
       
   166 private:
       
   167     
       
   168     
       
   169     /**
       
   170      * From MDisconnectionCallback.
       
   171      * Callback function for completing asynchronous disconnection request
       
   172      *
       
   173      * @since S60 v3.2    
       
   174      */ 
       
   175     void CompleteDisconnection();  
       
   176     
       
   177 private:
       
   178 
       
   179     CPBAPplugin();
       
   180     
       
   181     void ConstructL();
       
   182     
       
   183 private: // data 
       
   184 
       
   185     /*
       
   186      * Callback interface for completing asynchronous
       
   187      * disconnection event.
       
   188      * Not own.
       
   189      */
       
   190     MBTEngPluginObserver* iObserver;
       
   191     
       
   192     /*
       
   193      * Pbap server client session     
       
   194      */
       
   195     RPbapSession          iBPAP;
       
   196     
       
   197     /*
       
   198      * Helper class for asynchronous  disconnection
       
   199      * Own.
       
   200      */
       
   201     CDisconnectHelper*    iDisconnectHelper;
       
   202     
       
   203     /*
       
   204      * BT device address to be disconnected     
       
   205      */
       
   206     TBTDevAddr            iAddr;
       
   207     };
       
   208 #endif // BTPBAPPLUGIN