bluetoothengine/bthid/bthidclient/inc/bthidclient.h
changeset 0 f63038272f30
child 11 a42ed326b458
equal deleted inserted replaced
-1:000000000000 0:f63038272f30
       
     1 /*
       
     2 * Copyright (c) 2008 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:  BTHID Server client API
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef BTHIDCLIENT_H
       
    20 #define BTHIDCLIENT_H
       
    21 
       
    22 #include <e32base.h>
       
    23 #include <btdevice.h>
       
    24 #include <btmanclient.h>
       
    25 #include "bthidtypes.h"
       
    26 #include "btengconstants.h"
       
    27 
       
    28 /*!
       
    29  State changes of a Bluetooth HID connection
       
    30  */
       
    31 enum TBTHidConnState
       
    32     {
       
    33     EBTDeviceConnected, /*!< Device connected */
       
    34     EBTDeviceLinkLost, /*!< Device link lost */
       
    35     EBTDeviceLinkRestored, /*!< Device link restored */
       
    36     EBTDeviceDisconnected, /*!< Device disconnected */
       
    37     EBTDeviceUnplugged, /*!< Device unplugged */
       
    38     EBTDeviceAnotherExist
       
    39     /*!< Another Device Connection already exist */
       
    40     };
       
    41 
       
    42 /*!
       
    43  BT HID Device connection state details.
       
    44  */
       
    45 class THIDStateUpdate
       
    46     {
       
    47 public:
       
    48     /*! HID Device Bluetooth Address. */
       
    49     TBTDevAddr iDeviceAddress;
       
    50 
       
    51     /*! New Connection State. */
       
    52     TBTHidConnState iState;
       
    53     };
       
    54 typedef TPckgBuf<THIDStateUpdate> THIDStateUpdateBuf;
       
    55 
       
    56 /*!
       
    57  Provides the client-side interface to the server session.
       
    58  */
       
    59 
       
    60 NONSHARABLE_CLASS( RBTHidClient ) : public RSessionBase
       
    61     {
       
    62 public:
       
    63     /*!
       
    64      Connect to the server and create a session.
       
    65      @result System error code.
       
    66      */
       
    67     IMPORT_C TInt Connect();
       
    68 
       
    69     /*!
       
    70      Get the version number.
       
    71      @result The client version.
       
    72      */
       
    73     IMPORT_C TVersion Version() const;
       
    74 
       
    75     /*!
       
    76      Issue a connect request to the server.
       
    77      @param aParams The connection parameters.
       
    78      @param aDiagnostic Returned BT device address in case of conflict.
       
    79      @param aStatus A TRequestStatus object to be used for async comms.
       
    80      */
       
    81     IMPORT_C void ConnectDevice(const TBTDevAddrPckgBuf& aAddrBuf,
       
    82             TDes8& aDiagnostic, TRequestStatus& aStatus);
       
    83 
       
    84     /*!
       
    85      Issue an update request to the server.
       
    86      @param aUpdateParams Update buffer to be filled by the server.
       
    87      @param aDiagnostic Returned BT device address in case of conflict.
       
    88      @param aStatus A TRequestStatus object to be used for async comms.
       
    89      */
       
    90     IMPORT_C void NotifyStatusChange(THIDStateUpdateBuf& aUpdateParams,
       
    91             TDes8& aDiagnostic, TRequestStatus& aStatus);
       
    92 
       
    93     /*!
       
    94      Issue a disconnect request to the server.
       
    95      @param aAddress The BT address of the device to disconnect.
       
    96      @param aStatus A TRequestStatus object to be used for async comms.
       
    97      */
       
    98     IMPORT_C void DisconnectDevice(const TBTDevAddrPckgBuf& aAddrBuf,
       
    99             TBTDisconnectType aDiscType, TRequestStatus& aStatus);
       
   100 
       
   101     /*!
       
   102      Cancels an outstanding connect request with the server.
       
   103      */
       
   104     IMPORT_C void CancelConnectDevice() const;
       
   105 
       
   106     /*!
       
   107      Cancels an outstanding update request with the server.
       
   108      */
       
   109     IMPORT_C void CancelNotifyStatusChange() const;
       
   110 
       
   111     /*!
       
   112      Issue a disconnect request to the server.
       
   113      Release all the HID connections.
       
   114      @param aStatus A TRequestStatus object to be used for async comms.
       
   115      */
       
   116     IMPORT_C void DisconnectAllGracefully(TRequestStatus& aStatus);
       
   117 
       
   118     /*!
       
   119      Return HID device connection status in service level
       
   120      @param aBDaddr BT address of the device to retrieve.
       
   121      */
       
   122     IMPORT_C TInt IsConnected(const TBTDevAddr& aBDaddr);
       
   123 
       
   124     /*!
       
   125      Return HID device connection status in service level
       
   126      @param aAddrs Descriptor of BT addresses of connected devices
       
   127      @param aProfile Profile for connection  
       
   128      */
       
   129     IMPORT_C void GetConnections(TDes8& aAddrs, TInt aProfile);
       
   130 
       
   131     };
       
   132 
       
   133 #endif  // BTHIDCLIENT_H
       
   134 // End of File