bluetoothengine/btnotif/btnotifsrv/src/btnotifbasepairinghandler.cpp
changeset 31 a0ea99b6fa53
child 40 997690c3397a
equal deleted inserted replaced
30:df7a93ede42e 31:a0ea99b6fa53
       
     1 /*
       
     2 * Copyright (c) 2010 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 *
       
    16 */
       
    17 
       
    18 #include "btnotifpairingmanager.h"
       
    19 #include "btnotifbasepairinghandler.h"
       
    20 
       
    21 // ======== MEMBER FUNCTIONS ========
       
    22 
       
    23 // ---------------------------------------------------------------------------
       
    24 // C++ default constructor
       
    25 // ---------------------------------------------------------------------------
       
    26 //
       
    27 CBTNotifBasePairingHandler::CBTNotifBasePairingHandler( CBTNotifPairingManager& aParent, const TBTDevAddr& aAddr)
       
    28     : iAddr( aAddr ), iParent( aParent )
       
    29     {
       
    30     }
       
    31 
       
    32 // ---------------------------------------------------------------------------
       
    33 // Symbian 2nd-phase constructor
       
    34 // ---------------------------------------------------------------------------
       
    35 //
       
    36 void CBTNotifBasePairingHandler::BaseConstructL( )
       
    37     {
       
    38     iActive = CBtSimpleActive::NewL( *this, 0 );  
       
    39     }
       
    40 
       
    41 // ---------------------------------------------------------------------------
       
    42 // Destructor
       
    43 // ---------------------------------------------------------------------------
       
    44 //
       
    45 CBTNotifBasePairingHandler::~CBTNotifBasePairingHandler()
       
    46     {
       
    47     delete iActive;
       
    48     }
       
    49 
       
    50 // ---------------------------------------------------------------------------
       
    51 // Message passes through only if the result is for the same device this 
       
    52 // object is for.
       
    53 // ---------------------------------------------------------------------------
       
    54 //
       
    55 void CBTNotifBasePairingHandler::HandlePairServerResult( const TBTDevAddr& aAddr, TInt aResult )
       
    56     {
       
    57     if ( aAddr == iAddr )
       
    58         {
       
    59          DoHandlePairServerResult( aResult );
       
    60         }
       
    61     }
       
    62 
       
    63 // ---------------------------------------------------------------------------
       
    64 // Message passes through only if the result is for the same device this 
       
    65 // object is for.
       
    66 // ---------------------------------------------------------------------------
       
    67 //
       
    68 void CBTNotifBasePairingHandler::HandleRegistryNewPairedEvent( const TBTNamelessDevice& aDev )
       
    69     {
       
    70     if ( aDev.Address() == iAddr )
       
    71         {
       
    72         DoHandleRegistryNewPairedEvent( aDev );
       
    73         }
       
    74     }
       
    75 
       
    76 // ---------------------------------------------------------------------------
       
    77 // Default impl of virtual function. do nothing
       
    78 // ---------------------------------------------------------------------------
       
    79 //
       
    80 void CBTNotifBasePairingHandler::CancelOutgoingPair()
       
    81     {
       
    82     }
       
    83 
       
    84 // ---------------------------------------------------------------------------
       
    85 // Default impl does not offer a known PIN code for pairing 
       
    86 // ---------------------------------------------------------------------------
       
    87 //
       
    88 void CBTNotifBasePairingHandler::GetPinCode(
       
    89         TBTPinCode& aPin, const TBTDevAddr& aAddr, TInt aMinPinLength )
       
    90     {
       
    91     aPin().iLength = 0;
       
    92     (void) aAddr;
       
    93     (void) aMinPinLength;
       
    94     }
       
    95 
       
    96 // ---------------------------------------------------------------------------
       
    97 // Invalidate iPairResultSet
       
    98 // ---------------------------------------------------------------------------
       
    99 //
       
   100 void CBTNotifBasePairingHandler::UnSetPairResult()
       
   101     {
       
   102     iPairResultSet = EFalse;
       
   103     }
       
   104 
       
   105 // ---------------------------------------------------------------------------
       
   106 // Save the result and validate the flag
       
   107 // ---------------------------------------------------------------------------
       
   108 //
       
   109 void CBTNotifBasePairingHandler::SetPairResult( TInt aResult )
       
   110     {
       
   111     iPairResult = aResult;
       
   112     iPairResultSet = ETrue;
       
   113     }
       
   114 
       
   115 // ---------------------------------------------------------------------------
       
   116 // Returns the flag
       
   117 // ---------------------------------------------------------------------------
       
   118 //
       
   119 TBool CBTNotifBasePairingHandler::IsPairResultSet()
       
   120     {
       
   121     return iPairResultSet;
       
   122     }
       
   123 
       
   124 
       
   125 
       
   126