56
|
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 |
// Base class for subscribers of TraceCore
|
|
15 |
//
|
|
16 |
|
|
17 |
#ifndef __TRACECORESUBSCRIBER_H__
|
|
18 |
#define __TRACECORESUBSCRIBER_H__
|
|
19 |
|
|
20 |
#ifdef __KERNEL_MODE__
|
|
21 |
// Include files
|
|
22 |
#include <kernel/kernel.h>
|
|
23 |
#endif // __KERNEL_MODE__
|
|
24 |
|
|
25 |
/**
|
|
26 |
* Header format
|
|
27 |
*/
|
|
28 |
enum TMessageHeaderFormat
|
|
29 |
{
|
|
30 |
/**
|
|
31 |
* Proprietary Format (Header Format 0 is also considered as proprietary)
|
|
32 |
*/
|
|
33 |
EMessageHeaderFormatProprietary = 1,
|
|
34 |
EMessageHeaderFormatOst = 2
|
|
35 |
|
|
36 |
};
|
|
37 |
|
|
38 |
|
|
39 |
/**
|
|
40 |
* Trace Message
|
|
41 |
*/
|
|
42 |
class TTraceMessage
|
|
43 |
{
|
|
44 |
public:
|
|
45 |
TMessageHeaderFormat iMsgFormat;
|
|
46 |
TDesC8 *iHeader;
|
|
47 |
TDesC8 *iData;
|
|
48 |
TUint8 iMessageId;
|
|
49 |
};
|
|
50 |
|
|
51 |
#ifdef __KERNEL_MODE__
|
|
52 |
|
|
53 |
// Forward declarations
|
|
54 |
class MTraceCoreMessageSender;
|
|
55 |
|
|
56 |
/**
|
|
57 |
* Base class for subscribers of TraceCore
|
|
58 |
*/
|
|
59 |
class DTraceCoreSubscriber : public DBase
|
|
60 |
{
|
|
61 |
public:
|
|
62 |
|
|
63 |
/**
|
|
64 |
* Constructor
|
|
65 |
*/
|
|
66 |
IMPORT_C DTraceCoreSubscriber();
|
|
67 |
|
|
68 |
/**
|
|
69 |
* Destructor
|
|
70 |
*/
|
|
71 |
IMPORT_C ~DTraceCoreSubscriber();
|
|
72 |
|
|
73 |
/**
|
|
74 |
* Subscribes to a message by message ID / protocol ID
|
|
75 |
* depending of the header format. First byte of aMessageID is always used
|
|
76 |
* for header format.
|
|
77 |
*
|
|
78 |
* @param aMessageId The message ID to be subscribed
|
|
79 |
* @param aMsgFormat Message format e.g. EMessageHeaderFormatOst
|
|
80 |
*/
|
|
81 |
IMPORT_C TInt Subscribe( TUint32 aMessageID, TMessageHeaderFormat aHeaderFormat );
|
|
82 |
|
|
83 |
/**
|
|
84 |
* Subscribes to message ID
|
|
85 |
*
|
|
86 |
* @param aMessageId The ID to subscribe
|
|
87 |
*/
|
|
88 |
IMPORT_C TInt Subscribe( TUint32 aMessageID );
|
|
89 |
|
|
90 |
/**
|
|
91 |
* Unsubscribes from message ID
|
|
92 |
*
|
|
93 |
* @param aMessageId The ID to unsubscribe
|
|
94 |
*/
|
|
95 |
IMPORT_C void Unsubscribe( TUint32 aMessageID );
|
|
96 |
|
|
97 |
/**
|
|
98 |
* Callback function for messages
|
|
99 |
*/
|
|
100 |
virtual void MessageReceived( TTraceMessage &aMsg ) = 0;
|
|
101 |
|
|
102 |
/**
|
|
103 |
* Sets the message sender interface. This is called during Subscribe
|
|
104 |
*/
|
|
105 |
void SetMessageSender( MTraceCoreMessageSender& aMessageSender );
|
|
106 |
|
|
107 |
private:
|
|
108 |
|
|
109 |
/**
|
|
110 |
* Unsubscribes all message ID's of this subscriber. Called from destructor
|
|
111 |
*/
|
|
112 |
void Unsubscribe();
|
|
113 |
|
|
114 |
protected:
|
|
115 |
|
|
116 |
/**
|
|
117 |
* Message sender interface
|
|
118 |
*/
|
|
119 |
MTraceCoreMessageSender* iMessageSender;
|
|
120 |
};
|
|
121 |
|
|
122 |
#endif // __KERNEL_MODE__
|
|
123 |
|
|
124 |
#endif // __TRACECORESUBSCRIBER_H__
|
|
125 |
|
|
126 |
// End of File
|