tracesrv/tracecore/btrace_handler/inc/TraceCoreNotifier.h
changeset 56 aa2539c91954
equal deleted inserted replaced
54:a151135b0cf9 56:aa2539c91954
       
     1 // Copyright (c) 2007-2010 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 // Registers / unregisters notification receivers and send notifications 
       
    15 // to them when needed.
       
    16 // 
       
    17 
       
    18 #ifndef __TRACECORENOTIFIER_H__
       
    19 #define __TRACECORENOTIFIER_H__
       
    20 
       
    21 
       
    22 // Include files
       
    23 #include <kernel/kernel.h>
       
    24 #include <opensystemtrace_types.h>
       
    25 
       
    26 // Forward declarations
       
    27 class MTraceCoreNotificationReceiver;
       
    28 
       
    29 /**
       
    30  * Notification receiver item
       
    31  */
       
    32 NONSHARABLE_CLASS( TNotificationReceiverItem )
       
    33     {
       
    34 public:
       
    35 
       
    36     /**
       
    37      * Component ID
       
    38      */
       
    39     TUint32 iComponentID;
       
    40     
       
    41     /**
       
    42      * Group ID
       
    43      */
       
    44     TUint32 iGroupID;
       
    45 
       
    46     /**
       
    47      * The notification receiver associated with the component id and group id
       
    48      */
       
    49     MTraceCoreNotificationReceiver* iReceiver;
       
    50     };
       
    51 
       
    52 
       
    53 /**
       
    54  * Notification receiver receives subscriptions and delegates messages to them
       
    55  */
       
    56 NONSHARABLE_CLASS( DTraceCoreNotifier ) : public DBase
       
    57     {
       
    58 public:
       
    59 		
       
    60     /**
       
    61     * Constructor
       
    62     */
       
    63     DTraceCoreNotifier();
       
    64     
       
    65     /**
       
    66     * Destructor
       
    67     */
       
    68     ~DTraceCoreNotifier();
       
    69     
       
    70     /**
       
    71     * Register notification receiver
       
    72     *
       
    73     * @param aItem The properties of the notification receiver
       
    74     */
       
    75 	TInt RegisterNotificationReceiver( TNotificationReceiverItem& aItem );
       
    76 	
       
    77 	/**
       
    78 	* Unregister notification receiver
       
    79     *
       
    80 	* @param aItem The properties of the notification receiver
       
    81 	*/
       
    82 	void UnregisterNotificationReceiver( TNotificationReceiverItem& aItem );
       
    83 	
       
    84 	/**
       
    85 	* Unregister all traces of given notification receiver
       
    86 	*
       
    87 	* @param aNotificationReceiver The notification receiver to be unregistered
       
    88 	*/
       
    89 	void UnregisterNotificationReceiver( MTraceCoreNotificationReceiver& aNotificationReceiver );
       
    90 
       
    91 	/**
       
    92 	* Get defined component's registered group IDs
       
    93 	*
       
    94 	* @param aComponentID The component id
       
    95 	* @param aGroupIDs Array for registered group IDs
       
    96 	*/
       
    97 	void GetComponentRegisteredGroupIDs( TUint32 aComponentID, RArray< TUint >& aGroupIDs );
       
    98 		
       
    99 	/**
       
   100 	* Callback when trace is activated
       
   101 	*
       
   102 	* @param aComponentID The component id
       
   103 	* @param aGroupId The group id 
       
   104 	*/
       
   105     void TraceActivated( TUint32 aComponentId, TUint16 aGroupId );
       
   106     
       
   107     /**
       
   108 	* Callback when trace is deactivated
       
   109 	*
       
   110 	* @param aComponentID The component id
       
   111 	* @param aGroupId The group id 
       
   112 	*/
       
   113     void TraceDeactivated( TUint32 aComponentId, TUint16 aGroupId );
       
   114 
       
   115     /**
       
   116      * Callback when there is a trace error
       
   117      * 
       
   118      * @param aComponentId The component ID
       
   119      * @param aGroupId The group ID    
       
   120      * @param aError The reason for error
       
   121      */
       
   122     void TraceError( TUint32 aComponentId, TUint32 aGroupId, TInt aError  );
       
   123 
       
   124 private:
       
   125 	
       
   126     /**
       
   127     * Active subscriptions
       
   128     */
       
   129 	RArray< TNotificationReceiverItem > iNotificationReceiverItems;
       
   130 	
       
   131     /**
       
   132     * Notifies immediately if group was activated
       
   133     *
       
   134     * @param aComponentID The component id
       
   135     * @param aGroupId The group id 
       
   136     */
       
   137     void NotifyImmediately( TUint32 aComponentId, TGroupId aGroupId );
       
   138     
       
   139     };
       
   140 
       
   141 #endif
       
   142 
       
   143 // End of File