|
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 // Send-receive class abstracts the media used by subscribers to send / receive messages |
|
15 // |
|
16 |
|
17 #ifndef __TRACECORESENDRECEIVE_H__ |
|
18 #define __TRACECORESENDRECEIVE_H__ |
|
19 |
|
20 |
|
21 // Include files |
|
22 #include <kernel/kernel.h> |
|
23 #include "TraceCoreMediaIfCallback.h" |
|
24 #include "TraceCoreMessageSender.h" |
|
25 |
|
26 |
|
27 // Forward declarations |
|
28 class DTraceCoreMediaIf; |
|
29 class DTraceCorePluginIf; |
|
30 class MTraceCoreMessageReceiver; |
|
31 |
|
32 |
|
33 /** |
|
34 * Send-receive class abstracts the media used by subscribers to send / receive messages |
|
35 */ |
|
36 NONSHARABLE_CLASS( DTraceCoreSendReceive ) : public DBase, public MTraceCoreMediaIfCallback, public MTraceCoreMessageSender |
|
37 { |
|
38 public: |
|
39 |
|
40 /** |
|
41 * Constructor |
|
42 */ |
|
43 DTraceCoreSendReceive(); |
|
44 |
|
45 /** |
|
46 * Destructor |
|
47 */ |
|
48 ~DTraceCoreSendReceive(); |
|
49 |
|
50 /** |
|
51 * Initializes this sender / receiver |
|
52 * |
|
53 * @param aReceiver Interface where incoming messages are routed |
|
54 */ |
|
55 TInt Init( MTraceCoreMessageReceiver& aReceiver ); |
|
56 |
|
57 /** |
|
58 * Gets the media interface that is used by media writer |
|
59 */ |
|
60 inline DTraceCoreMediaIf* GetMediaWriterIf(); |
|
61 |
|
62 /** |
|
63 * Gets the media plug-in interface or NULL if it does not exist |
|
64 */ |
|
65 inline DTraceCorePluginIf* GetPluginIf(); |
|
66 |
|
67 private: |
|
68 |
|
69 /** |
|
70 * MTraceCoreMediaIfCallback implementation for incoming messages |
|
71 * |
|
72 * @param aMsg The message that was received |
|
73 * @return KErrNotFound if the message id was not found (not subscribed), KErrNone if found |
|
74 */ |
|
75 TInt MessageReceived( TTraceMessage &aMsg ); |
|
76 |
|
77 /** |
|
78 * Set Sender Media |
|
79 * |
|
80 * @param Sender media |
|
81 */ |
|
82 TInt SetSenderMedia( DTraceCoreMediaIf* aSenderMedia ); |
|
83 |
|
84 /** |
|
85 * MTraceCoreMessageSender implementation for outgoing messages |
|
86 * |
|
87 * @param aMessage The message to be sent |
|
88 */ |
|
89 TInt SendMessage( TTraceMessage &aMessage ); |
|
90 |
|
91 /** |
|
92 * Initializes a media interface |
|
93 */ |
|
94 TInt InitMediaInterface( DTraceCoreMediaIf* aMediaIf ); |
|
95 |
|
96 /** |
|
97 * Creates the media interfaces |
|
98 */ |
|
99 TInt CreateInterfaces(); |
|
100 |
|
101 /** |
|
102 * Deletes the media interfaces |
|
103 */ |
|
104 void DeleteInterfaces(); |
|
105 |
|
106 private: |
|
107 |
|
108 /** |
|
109 * Media interfaces that receive data. |
|
110 */ |
|
111 RPointerArray< DTraceCoreMediaIf > iMediaInterfaces; |
|
112 |
|
113 /** |
|
114 * Plug-in interface |
|
115 */ |
|
116 DTraceCorePluginIf* iPluginInterface; |
|
117 |
|
118 /** |
|
119 * Media interface for sending data |
|
120 */ |
|
121 DTraceCoreMediaIf* iSendInterface; |
|
122 |
|
123 /** |
|
124 * Media interface used by the media writer |
|
125 */ |
|
126 DTraceCoreMediaIf* iMediaWriterInterface; |
|
127 |
|
128 /** |
|
129 * Target for incoming messages |
|
130 */ |
|
131 MTraceCoreMessageReceiver* iReceiver; |
|
132 }; |
|
133 |
|
134 #endif |
|
135 |
|
136 #include "TraceCoreSendReceive.inl" |
|
137 |
|
138 // End of File |