bluetoothmgmt/bluetoothclientlib/inc/pairing.h
changeset 0 29b1cd4cb562
child 23 5b153be919d4
equal deleted inserted replaced
-1:000000000000 0:29b1cd4cb562
       
     1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 /**
       
    17  @file
       
    18  @publishedPartner
       
    19  @released
       
    20 */
       
    21 
       
    22 #ifndef PAIRING_H
       
    23 #define PAIRING_H
       
    24 
       
    25 #include <e32std.h>
       
    26 #include <bt_sock.h>
       
    27 
       
    28 /**
       
    29 The UID indicating the dedicated bonding service request.
       
    30 */
       
    31 const TUid KBluetoothDedicatedBondingUid = {0x10286491};
       
    32 
       
    33 /**
       
    34 Represents a connection to the pairing server inside the Bluetooth
       
    35 stack.  This provides the conduit for other pairing related actitivies.
       
    36 */
       
    37 NONSHARABLE_CLASS(RBluetoothPairingServer)
       
    38 	: private RSessionBase
       
    39 	{
       
    40 public:
       
    41 	IMPORT_C RBluetoothPairingServer();
       
    42 	IMPORT_C TVersion Version() const;
       
    43 	IMPORT_C TInt Connect();
       
    44 	IMPORT_C void Close();
       
    45 	
       
    46 public:
       
    47 	RSessionBase& Session();
       
    48 	
       
    49 private:
       
    50 	// This data padding has been added to help prevent future binary compatibility breaks	
       
    51 	// Neither iPadding1 nor iPadding2 have been zero'd because they are currently not used
       
    52 	TUint32		iPadding1;
       
    53 	TUint32		iPadding2;
       
    54 	};
       
    55 
       
    56 /**
       
    57 This class provides the facilities to initiate a dedicated bonding request.
       
    58 */
       
    59 NONSHARABLE_CLASS(RBluetoothDedicatedBondingInitiator)
       
    60 	: private RSubSessionBase
       
    61 	{
       
    62 public:
       
    63 	IMPORT_C RBluetoothDedicatedBondingInitiator();
       
    64 	IMPORT_C void Start(RBluetoothPairingServer& aPairingServer, const TBTDevAddr& aAddr, TRequestStatus& aStatus);
       
    65 	IMPORT_C void Close();
       
    66 	
       
    67 private:
       
    68 	TPckgBuf<TBTDevAddr>	iDedicatedBondAddress;
       
    69 	// This data padding has been added to help prevent future binary compatibility breaks	
       
    70 	// Neither iPadding1 nor iPadding2 have been zero'd because they are currently not used
       
    71 	TUint32		iPadding1;
       
    72 	TUint32		iPadding2;
       
    73 	};
       
    74 
       
    75 /**
       
    76 This class provides facilities related to Bluetooth Out-Of-Band pairing.
       
    77 It provides functions for retrieving local OOB data that is to be sent
       
    78 to remote devices, and also facilities for providing remote OOB data that 
       
    79 has been received.
       
    80 */
       
    81 NONSHARABLE_CLASS(RBluetoothOobData)
       
    82 	: private RSubSessionBase
       
    83 	{
       
    84 public:
       
    85 	IMPORT_C RBluetoothOobData();
       
    86 	IMPORT_C TInt Open(RBluetoothPairingServer& aPairingServer);
       
    87 	IMPORT_C void Close();
       
    88 	
       
    89 	// Local OOB Functions
       
    90 	IMPORT_C void RefreshLocalOobData();
       
    91 	IMPORT_C void ReadLocalOobData(TBluetoothSimplePairingHash& aHash, TBluetoothSimplePairingRandomizer& aRandomizer, TRequestStatus& aStatus);
       
    92 	IMPORT_C void CancelReadLocalOobData();
       
    93 	
       
    94 	// Remote OOB Functions
       
    95 	IMPORT_C TInt ProvideRemoteOobData(const TBTDevAddr& aAddr, const TBluetoothSimplePairingHash& aHash, const TBluetoothSimplePairingRandomizer& aRandomizer);
       
    96 	IMPORT_C TInt ProvideRemoteOobData(const TBTDevAddr& aAddr, const TBluetoothSimplePairingHash& aHash);
       
    97 	IMPORT_C TInt ProvideRemoteOobData(const TDesC8& aData);
       
    98 	IMPORT_C void ClearRemoteOobData(const TBTDevAddr& aAddr);
       
    99 
       
   100 private:
       
   101 	// This data padding has been added to help prevent future binary compatibility breaks	
       
   102 	// Neither iPadding1 nor iPadding2 have been zero'd because they are currently not used
       
   103 	TUint32		iPadding1;
       
   104 	TUint32		iPadding2;
       
   105 	};
       
   106 
       
   107 /**
       
   108 Class used to retrieve results of Bluetooth simple pairing attempts.
       
   109 The pairing result session is used to obtain results of simple pairing attempts 
       
   110 using the Numeric Comparison or Passkey Entry association models.
       
   111 */
       
   112 NONSHARABLE_CLASS(RBluetoothPairingResult)
       
   113 	: private RSubSessionBase
       
   114 	{
       
   115 public:
       
   116 	IMPORT_C RBluetoothPairingResult();
       
   117 	
       
   118 	IMPORT_C TInt Open(RBluetoothPairingServer& aPairingServer);
       
   119 	IMPORT_C void Close();
       
   120 	
       
   121 	IMPORT_C void SimplePairingResult(TBTDevAddr& aAddr, TRequestStatus& aStatus);
       
   122 	IMPORT_C void CancelSimplePairingResult();
       
   123 	
       
   124 private:
       
   125 	TPtr8			iDeviceAddressBuffer;
       
   126 	TRequestStatus*	iRequest;
       
   127 	// This data padding has been added to help prevent future binary compatibility breaks	
       
   128 	// Neither iPadding1 nor iPadding2 have been zero'd because they are currently not used
       
   129 	TUint32		iPadding1;
       
   130 	TUint32		iPadding2;
       
   131 	};
       
   132 
       
   133 /**
       
   134 Class used to retrieve results of local Bluetooth authentication attempts.
       
   135 The authentication result session is used to obtain results of authentication complete events, 
       
   136 which are generated for both simple and legacy pairing attempts.
       
   137 */
       
   138 NONSHARABLE_CLASS(RBluetoothAuthenticationResult)
       
   139 	: private RSubSessionBase
       
   140 	{
       
   141 public:
       
   142 	IMPORT_C RBluetoothAuthenticationResult();
       
   143 
       
   144 	IMPORT_C TInt Open(RBluetoothPairingServer& aPairingServer);
       
   145 	IMPORT_C void Close();
       
   146 
       
   147 	IMPORT_C void AuthenticationResult(TBTDevAddr& aAddr, TRequestStatus& aStatus);
       
   148 	IMPORT_C void CancelAuthenticationResult();
       
   149 
       
   150 private:
       
   151 	TPtr8			iDeviceAddressBuffer;
       
   152 	TRequestStatus*	iRequest;
       
   153 	// This data padding has been added to help prevent future binary compatibility breaks
       
   154 	// Neither iPadding1 nor iPadding2 have been zero'd because they are currently not used
       
   155 	TUint32		iPadding1;
       
   156 	TUint32		iPadding2;
       
   157 	};
       
   158 
       
   159 /**
       
   160 Pairing Server client panic category.
       
   161 */
       
   162 _LIT(KPairingServerPanicCat, "PairingSrv");
       
   163 
       
   164 /**
       
   165 Pairing Server client panic reasons
       
   166 */
       
   167 enum TPairingServerPanicReason
       
   168 	{
       
   169 	EPairingServerBadDescriptor,
       
   170 	EPairingServerBadSubSessionHandle,
       
   171 	EPairingServerDedicatedBondAlreadyIssued,
       
   172 	EPairingServerReadLocalOobDataOutstanding,
       
   173 	EPairingServerSessionAlreadyConnected,
       
   174 	EPairingServerSessionNotConnected,
       
   175 	EPairingServerOobDataSessionAlreadyOpen,
       
   176 	EPairingServerOobDataSessionNotOpen,
       
   177 	EPairingServerDedicatedBondAlreadyInProgress,
       
   178 	EPairingServerSimplePairingResultSessionAlreadyOpen,
       
   179 	EPairingServerSimplePairingResultRequestOutstanding,
       
   180 	EPairingServerAuthenticationResultSessionAlreadyOpen,
       
   181 	EPairingServerAuthenticationResultRequestOutstanding,
       
   182 	};
       
   183 
       
   184 
       
   185 #endif // PAIRING_H