bluetooth/btstack/secman/simplepairingresult.h
changeset 0 29b1cd4cb562
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 #ifndef SIMPLEPAIRINGRESULT_H
       
    17 #define SIMPLEPAIRINGRESULT_H
       
    18 
       
    19 #include <e32base.h>
       
    20 #include <bttypes.h>
       
    21 #include "internaltypes.h"
       
    22 
       
    23 /**
       
    24 This constant defines the maximum number of simple pairing results
       
    25 that are queued up in the system.  If the list grows above this
       
    26 size then older results will be dropped and lost.
       
    27 */
       
    28 const TInt KSimplePairingResultListMaxSize = 10;
       
    29 
       
    30 /**
       
    31 This constant defines the maximum number of authentication results
       
    32 that are queued up in the system.  If the list grows above this
       
    33 size then older results will be dropped and lost.
       
    34 */
       
    35 const TInt KAuthenticationResultListMaxSize = 10;
       
    36 
       
    37 
       
    38 NONSHARABLE_CLASS(TBluetoothSecurityResult)
       
    39 	{
       
    40 public:
       
    41 	TBluetoothSecurityResult(const TBTDevAddr& aDevAddr, TInt aResult);
       
    42 
       
    43 	const TBTDevAddr& DeviceAddress() const;
       
    44 	TInt Result() const;
       
    45 
       
    46 public:
       
    47 	TBTDblQueLink	iLink;
       
    48 
       
    49 private:
       
    50 	TBTDevAddr	iDeviceAddress;
       
    51 	TInt		iResult;
       
    52 	};
       
    53 
       
    54 class MBluetoothSecurityResultObserver
       
    55 	{
       
    56 public:
       
    57 	virtual TInt MbsroResult(const TBTDevAddr& aDevAddr, TInt aResult) = 0;
       
    58 	};
       
    59 
       
    60 NONSHARABLE_CLASS(CBluetoothSecurityResultList)
       
    61 	: public CBase
       
    62 	{
       
    63 public:
       
    64 	~CBluetoothSecurityResultList();
       
    65 
       
    66 	void NewResult(const TBTDevAddr& aDevAddr, TInt aResult);
       
    67 
       
    68 	void RegisterObserverL(MBluetoothSecurityResultObserver& aObserver);
       
    69 	void ReleaseObserver(MBluetoothSecurityResultObserver& aObserver);
       
    70 
       
    71 	void ReturnResult();
       
    72 	void CancelReturn();
       
    73 
       
    74 protected:
       
    75 	CBluetoothSecurityResultList(TInt aMaxListCount);
       
    76 	void ConstructL();
       
    77 
       
    78 private:
       
    79 	MBluetoothSecurityResultObserver*	iObserver;
       
    80 	TBool								iOutstandingNotification;
       
    81 
       
    82 	TDblQue<TBluetoothSecurityResult>	iResultList;
       
    83 	TInt								iListCount;
       
    84 	TInt								iMaxListCount;
       
    85 	};
       
    86 
       
    87 
       
    88 NONSHARABLE_CLASS(CSimplePairingResultList)
       
    89 	: public CBluetoothSecurityResultList
       
    90 	{
       
    91 public:
       
    92 	static CSimplePairingResultList* NewL();
       
    93 
       
    94 private:
       
    95 	CSimplePairingResultList();
       
    96 	};
       
    97 
       
    98 NONSHARABLE_CLASS(CAuthenticationResultList)
       
    99 	: public CBluetoothSecurityResultList
       
   100 	{
       
   101 public:
       
   102 	static CAuthenticationResultList* NewL();
       
   103 
       
   104 private:
       
   105 	CAuthenticationResultList();
       
   106 	};
       
   107 
       
   108 _LIT(KBluetoothSecListFaultCat, "SecListFault");
       
   109 enum TBluetoothSecListFault
       
   110 	{
       
   111 	EResultListCountMismatch,
       
   112 	ENoBoundObserver,
       
   113 	ENullResultListEntry,
       
   114 	ENotificationAlreadyOutstanding,
       
   115 	};
       
   116 
       
   117 #endif // SIMPLEPAIRINGRESULT_H