bluetoothengine/bteng/btbearer/inc/btpluginnotifier.h
changeset 0 f63038272f30
child 22 613943a21004
equal deleted inserted replaced
-1:000000000000 0:f63038272f30
       
     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:  This is the BT bearer plugin  notifier header file.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef __BTPLUGINNOTIFIER_H__
       
    20 #define __BTPLUGINNOTIFIER_H__
       
    21 
       
    22 
       
    23 #include <e32base.h>
       
    24 #include <btserversdkcrkeys.h>
       
    25 #include <locodbearerpluginparams.h>      
       
    26 #include <centralrepository.h>      
       
    27 #include <locodbearer.h>
       
    28 
       
    29 
       
    30 /**
       
    31  *  BT Plug in module for local connectivity daemon.
       
    32  *
       
    33  *  This active object checks BT state from central repository and start 
       
    34  *  watching BT ON/OFF state. If BT is ON, it connects to BTEngine server.
       
    35  *  It  continues to watch the key and when it has changed, it notifies 
       
    36  *  the daemon through its callback function.
       
    37  *
       
    38  *  @lib btbearer.lib
       
    39  *  @since S60 v3.2
       
    40  */
       
    41 NONSHARABLE_CLASS( CBTPluginNotifier ) : public CActive
       
    42     {
       
    43 
       
    44 public:
       
    45 
       
    46     /**  Enumeration of CenRep key types */
       
    47     enum TCenRepKeyType
       
    48         {
       
    49         EKeyInt,
       
    50         EKeyReal,
       
    51         EKeyBinary,
       
    52         EKeyString
       
    53         };
       
    54         
       
    55     /**
       
    56      * Two-phase constructor
       
    57      *
       
    58      * @param aObserver Reference to the callback class.
       
    59      * @param aUid The UID that identifies the repository.
       
    60      * @param aKeyType Key type.
       
    61      * @param aId The ID of the key.
       
    62      * @return CBTPluginNotifier Initialized object.
       
    63      */
       
    64 	static CBTPluginNotifier* NewL( MLocodBearerPluginObserver& aObserver, 
       
    65 	                                TUid aUid, TCenRepKeyType aKeyType, 
       
    66 	                                TUint32 aId );
       
    67 
       
    68     /**
       
    69      * Destructor
       
    70      */
       
    71 	virtual ~CBTPluginNotifier();
       
    72 
       
    73 private:
       
    74 
       
    75     /**
       
    76      * C++ default constructor
       
    77      */
       
    78     CBTPluginNotifier( MLocodBearerPluginObserver& Param, TUid aUid, 
       
    79 	                   TCenRepKeyType aKeyType, TUint32 aId );
       
    80 
       
    81     /**
       
    82      * Symbian 2nd-phase constructor
       
    83      */
       
    84     void ConstructL();
       
    85 
       
    86     /**
       
    87      * Subscribes to the change of central repository keys
       
    88      *
       
    89      * @since S60 v3.2
       
    90      */
       
    91     void SubscribeL();
       
    92 
       
    93 // from base class CActive
       
    94 
       
    95     /**
       
    96      * From CActive.
       
    97      * Called by the active scheduler when our subscription 
       
    98      * to the setting has been cancelled.
       
    99      *
       
   100      * @since S60 v3.2
       
   101      */
       
   102     void DoCancel();
       
   103 
       
   104     /**
       
   105      * From CActive.
       
   106      * Called by the active scheduler when the status has changed.
       
   107      *
       
   108      * @since S60 v3.2
       
   109      */
       
   110     void RunL();
       
   111     
       
   112     /**
       
   113      * From CActive
       
   114      * Called by the active scheduler when RunL() leaves, aError contains the leave code.
       
   115      * 
       
   116      * @since S60 5.0
       
   117      */
       
   118     int RunError(TInt aError);
       
   119     
       
   120 private: // data
       
   121 
       
   122     /**
       
   123      * The UID that identifies the setting category.
       
   124      */
       
   125     TUid iUid;
       
   126 
       
   127     /**
       
   128      * ID for BT power state in the central repository
       
   129      */
       
   130     TUint32 iId;
       
   131 
       
   132     /**
       
   133      * Central repository key type
       
   134      */
       
   135     TCenRepKeyType iKeyType;
       
   136 
       
   137     /**
       
   138      * Reference to the observer.
       
   139      */
       
   140     MLocodBearerPluginObserver& iHandler;
       
   141 
       
   142     /**
       
   143      * Session with the central repository.
       
   144      * Own.
       
   145      */
       
   146     CRepository* iSession;
       
   147 
       
   148     };
       
   149 
       
   150 
       
   151 #endif  // __BTPLUGINNOTIFIER_H__