bluetoothengine/btnotif/inc/btnotiflock.h
branchRCL_3
changeset 56 9386f31cc85b
parent 0 f63038272f30
equal deleted inserted replaced
55:613943a21004 56:9386f31cc85b
       
     1 /*
       
     2 * Copyright (c) 2006 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:  Implements getting/setting notifier locks on BT devices
       
    15 *               from/to P&S KBTNotifierLocks from btengprivatepskeys.h.
       
    16 *
       
    17 */
       
    18 
       
    19 #ifndef BTNOTIFIERLOCK_H
       
    20 #define BTNOTIFIERLOCK_H
       
    21 
       
    22 #include <bttypes.h>
       
    23 #include <btengprivatepskeys.h>
       
    24 
       
    25 /**
       
    26  *  BT Notifier lock identifiers 
       
    27  *  @since S60 v5.1
       
    28  */
       
    29 
       
    30 enum TBTNotifLockId
       
    31     {
       
    32     /**
       
    33      * None
       
    34      */
       
    35     EBTNotifierLockNone = 0x00,
       
    36     
       
    37     /**
       
    38      * notifier is asking or going to ask if user wants to set device trusted.
       
    39      */
       
    40     EBTNotiferLockPairedDeviceSetting = 0x01,
       
    41     
       
    42     /**
       
    43      * notifer is asking or going to ask user if he wants to accept connection request
       
    44      * from the device.
       
    45      */
       
    46     EBTNotifierLockAuthorizeConnectRequest = 0x02,
       
    47     };
       
    48 
       
    49 /**
       
    50  * the notifier lock status on a BT device.
       
    51  * This lock mechanism uses by btui, bteng and btnotif to ensure the order of 
       
    52  * user interaction when a device is been paired.
       
    53  */
       
    54 NONSHARABLE_CLASS( TBTNotifLock)
       
    55     {
       
    56 public:
       
    57     
       
    58     /**
       
    59      * default constructor.  iAddr is initialized to zero BT address and iLocks is set to 0  
       
    60      */
       
    61     inline TBTNotifLock();
       
    62     
       
    63     /**
       
    64      * constructor to the specified value.
       
    65      * @param aAddr the address of the BT device this object is for.
       
    66      * @param aLocks one or more lock identifiers
       
    67      */
       
    68     inline TBTNotifLock(const TBTDevAddr& aAddr, TInt aLocks);
       
    69     
       
    70     /**
       
    71      * gets the target device address.
       
    72      * @return the target device address
       
    73      */
       
    74     inline const TBTDevAddr& Addr() const;
       
    75     
       
    76     /**
       
    77      * Gets the locks on the device.
       
    78      */
       
    79     inline TInt Locks() const;
       
    80     
       
    81     /**
       
    82      * Gets the modifiable locks on the device
       
    83      */
       
    84     inline TInt& Locks();
       
    85 
       
    86 private:
       
    87     
       
    88     /**
       
    89      * the BT device this object is for
       
    90      */
       
    91     TBTDevAddr iAddr;
       
    92     
       
    93     /**
       
    94      * the lock status, logical OR of one or more TBTNotifLockId values
       
    95      */
       
    96     TInt iLocks;
       
    97     };
       
    98 
       
    99 NONSHARABLE_CLASS( TBTNotifLockPublish )
       
   100     {
       
   101 public:
       
   102 
       
   103     /**
       
   104      * gets from P&S KBTNotifierLocks the locks for a device.
       
   105      * 
       
   106      * @param aLocks contains the locks for the device at return
       
   107      * @param aAddr the address of the device which the locks are for
       
   108      */
       
   109     inline static void GetNotifLocks( TInt& aLocks, const TBTDevAddr& aAddr );
       
   110 
       
   111     /**
       
   112      * gets from P&S KBTNotifierLocks the locks for a device.
       
   113      * 
       
   114      * @aProperty the property instance which has been attached to key KBTNotifierLocks. 
       
   115      * @param aLocks contains the locks for the device at return
       
   116      * @param aAddr the address of the device which the locks are for
       
   117      */
       
   118     inline static void GetNotifLocks(RProperty& aProperty, TInt& aLocks, 
       
   119             const TBTDevAddr& aAddr );
       
   120     
       
   121     /**
       
   122      * Publishes locks to P&S KBTNotifierLocks.
       
   123      * 
       
   124      * @param aLocks the locks to be published
       
   125      * @param aAddr the address of the device which the locks are for
       
   126      */
       
   127     inline static void AddNotifLocks( TInt aLocks, const TBTDevAddr& aAddr );    
       
   128     
       
   129     /**
       
   130      * Publishes locks to P&S KBTNotifierLocks.
       
   131      * @aProperty the property instance which has been attached to key KBTNotifierLocks. 
       
   132      * @param aLocks the locks to be published
       
   133      * @param aAddr the address of the device which the locks are for
       
   134      */
       
   135     inline static void AddNotifLocks(RProperty& aProperty, TInt aLocks, 
       
   136             const TBTDevAddr& aAddr );    
       
   137     
       
   138     /**
       
   139      * Deletes locks from P&S KBTNotifierLocks.
       
   140      * @param aLocks the locks to be deleted
       
   141      * @param aAddr the address of the device which the locks are for     
       
   142      */
       
   143     inline static void DeleteNotifLocks( TInt aLocks, 
       
   144             const TBTDevAddr& aAddr );    
       
   145     
       
   146     /**
       
   147      * Deletes locks from P&S KBTNotifierLocks.
       
   148      * @aProperty the property instance which has been attached to key KBTNotifierLocks.  
       
   149      * @param aLocks the locks to be deleted
       
   150      * @param aAddr the address of the device which the locks are for     
       
   151      */
       
   152     inline static void DeleteNotifLocks(RProperty& aProperty, TInt aLocks, 
       
   153             const TBTDevAddr& aAddr );    
       
   154     };
       
   155 
       
   156 #include "btnotiflock.inl"
       
   157 
       
   158 #endif // BTNOTIFIERLOCK_H