bluetoothengine/btaudioman/inc/BTAccClient.h
changeset 0 f63038272f30
child 6 6a29d5ad0713
equal deleted inserted replaced
-1:000000000000 0:f63038272f30
       
     1 /*
       
     2 * Copyright (c) 2005 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: 
       
    15 *        BT Accessory Server's client API declaration. Starts server 
       
    16 *        and creates a session with server if necessary. 
       
    17 *
       
    18 *
       
    19 */
       
    20 
       
    21 
       
    22 #ifndef BTACCCLIENT_H
       
    23 #define BTACCCLIENT_H
       
    24 
       
    25 #include <bt_sock.h>
       
    26 #include "BTAccInfo.h"
       
    27 #include "btaccTypes.h"
       
    28 
       
    29 
       
    30 // CLASS DECLARATION
       
    31 
       
    32 /**
       
    33 * RBTAccClient, the client class. 
       
    34 * An RSessionBase sends messages to the server with the function
       
    35 * RSessionBase::SendReceive(); specifying an opcode and and array of argument 
       
    36 * pointers. Functions in derived classes, such as RBTAccServer::ManageServices(), 
       
    37 * are wrappers for different calls to SendReceive().
       
    38 */
       
    39 class RBTAccClient : public RSessionBase
       
    40     {
       
    41 public:
       
    42     
       
    43     /**
       
    44     * Connects to Bluetooth audio accessory
       
    45     * @param    aStatus the request status, KErrNone if the connection is successful, a Symbian 
       
    46     *           error code otherwise, specifically:
       
    47     *           KErrNotSupported if the device doesn't support any BT audio profile;
       
    48     *           KErrAlreadyExists if the request is rejected due to other existing connections.
       
    49     * @param    aAddrBuf the package buf of the device address
       
    50     * @param    aDiagnostic will contain the conflict connections if connecting fails due to existing connections.
       
    51     *           Otherwise will contain the connected profile (type TProfiles)
       
    52     */
       
    53     void ConnectToAccessory(TRequestStatus& aStatus, const TBTDevAddrPckgBuf& aAddrBuf, TDes8& aDiagnostic);
       
    54 
       
    55     /**
       
    56     * Cancel Connection attempt to Bluetooth audio accessory
       
    57     * @param    aDevice Bluetooth address of the device
       
    58     * @return   TInt indicating the success of call.      
       
    59     */
       
    60     void CancelConnectToAccessory();
       
    61 
       
    62     /**
       
    63     * Disconnects Bluetooth audio accessory
       
    64     * @param    aStatus the request status, KErrNone if the operation is successful, a Symbian 
       
    65     *           error code otherwise
       
    66     * @param    aAddrBuf the package buf of the device address
       
    67     * @param    aDiagnostic will contain the disconnected profile (type TProfiles)
       
    68     */
       
    69     void DisconnectAccessory(TRequestStatus& aStatus, const TBTDevAddrPckgBuf& aAddrBuf, TDes8& aDiagnostic);
       
    70 
       
    71 
       
    72     TInt GetConnections(TDes8& aAddrs, TInt aProfile);
       
    73 
       
    74     /**
       
    75     * Disconnects all connection gracefully.
       
    76     * This is called internally when BTAudioMan is going to be destroyed.
       
    77     */
       
    78     void DisconnectAllGracefully(TRequestStatus& aStatus);
       
    79     
       
    80     void NotifyConnectionStatus(TProfileStatusPckg& aPckg, TRequestStatus& aStatus);
       
    81     
       
    82     void CancelNotifyConnectionStatus();
       
    83     
       
    84     /**
       
    85     * Checks if this is connecting or has been connected to the specified device
       
    86     * 
       
    87     * @param aAddr the specified BD address
       
    88     */
       
    89     TInt IsConnected(const TBTDevAddr& aAddr) const;
       
    90 
       
    91     /**
       
    92     * 
       
    93     */
       
    94     void GetInfoOfConnectedAcc(TPckg<TAccInfo>& aInfoPckg, TRequestStatus& aStatus ); 
       
    95     
       
    96 
       
    97     /**
       
    98     * Transfer audio to phone
       
    99     * @param    None
       
   100     * @return   TInt indicating the success of call.      
       
   101     */
       
   102     TInt AudioToPhone();
       
   103 
       
   104     /**
       
   105     * Routes the audio paths from the phone to the accessory from which they
       
   106     * have been earlier on moved to the phone with the audio to phone 
       
   107     * operation. In practice also reconnects to the accessory.
       
   108     * @param aStatus            When the request completes contains the 
       
   109     *                           success status of the operation.
       
   110     * @return                   None.
       
   111     */
       
   112     void AudioToAccessory( TRequestStatus& aStatus );
       
   113 
       
   114     /**
       
   115     * Cancels the audio to accessory operation.
       
   116     * Note that if this request is made after the point when it is not 
       
   117     * possible to cancel the actual operation any more, the audio paths 
       
   118     * might still be routed to the accessory again.
       
   119     * @param                    TRequestStatus status to be cancelled.
       
   120     * @return                   None.
       
   121     */
       
   122     void CancelAudioToAccessory();
       
   123     
       
   124 public: // Functions from base classes
       
   125 
       
   126     /**
       
   127     * From RSessionBase informs current version
       
   128     * @param    None
       
   129     * @return   Version information about the server
       
   130     */
       
   131     TVersion Version() const;
       
   132 
       
   133     /**
       
   134     * From RSessionBase connect to the server
       
   135     * @param    None
       
   136     * @return   Error/success code
       
   137     */
       
   138     TInt Connect();
       
   139 
       
   140 private:    // Data
       
   141     };
       
   142 
       
   143 #endif  // BTACCCLIENT_H
       
   144 // End of File