0
|
1 |
/*
|
|
2 |
* Copyright (c) 2004-2005 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:
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
#ifndef ECMTCLIENT_H
|
|
21 |
#define ECMTCLIENT_H
|
|
22 |
|
|
23 |
// INCLUDES
|
|
24 |
#include <e32base.h>
|
|
25 |
|
|
26 |
// FORWARD DECLARATIONS
|
|
27 |
class CEcmtServerListener;
|
|
28 |
class MEcmtServerObserver;
|
|
29 |
|
|
30 |
// CONSTANTS
|
|
31 |
/**
|
|
32 |
* Formatted message maximum length
|
|
33 |
*/
|
|
34 |
const TInt KFormatMaxSize = 256;
|
|
35 |
|
|
36 |
/**
|
|
37 |
* A handle to a session with Ecmt server.
|
|
38 |
* This class provides methods for sending textual data to the
|
|
39 |
* System Output Diagnostic view on the connected PC.
|
|
40 |
* @ingroup EcmtClient
|
|
41 |
*/
|
|
42 |
class REcmt : public RSessionBase
|
|
43 |
{
|
|
44 |
public: // New functions
|
|
45 |
|
|
46 |
/**
|
|
47 |
* Constructor.
|
|
48 |
*/
|
|
49 |
IMPORT_C REcmt();
|
|
50 |
|
|
51 |
/**
|
|
52 |
* Destructor.
|
|
53 |
*/
|
|
54 |
IMPORT_C ~REcmt();
|
|
55 |
|
|
56 |
/**
|
|
57 |
* Connects the client process to the Ecmt server. To end the session,
|
|
58 |
* use the Close() method.
|
|
59 |
* @return KErrNone if succesfull otherwise one of the system-wide error codes.
|
|
60 |
*/
|
|
61 |
IMPORT_C TInt Connect( );
|
|
62 |
|
|
63 |
/**
|
|
64 |
* Closes the session and frees any allocated resources.
|
|
65 |
*/
|
|
66 |
IMPORT_C void Close( );
|
|
67 |
|
|
68 |
/**
|
|
69 |
* This member is internal and not intended for use.
|
|
70 |
* This member leaves immediately with KErrNotSupported.
|
|
71 |
* @deprecated
|
|
72 |
*/
|
|
73 |
IMPORT_C void SetServerObserverL( MEcmtServerObserver* aObserver );
|
|
74 |
|
|
75 |
/**
|
|
76 |
* Writes text data to the System Output Diagnostic view on the connected PC.
|
|
77 |
* @param aText Text to be written.
|
|
78 |
*/
|
|
79 |
IMPORT_C void Write( const TDesC16& aText );
|
|
80 |
|
|
81 |
/**
|
|
82 |
* Writes text data to the System Output Diagnostic view on the connected PC.
|
|
83 |
* The text can include formatting directives (\%d, \%c, ...) which are then filled
|
|
84 |
* with the following parameters. The maximum length of the message after formatting
|
|
85 |
* is defined by KFormatMazSize.
|
|
86 |
* @param aText Text to be written.
|
|
87 |
* @param ... Values used for formatting.
|
|
88 |
*/
|
|
89 |
IMPORT_C void WriteFormat(TRefByValue<const TDesC16> aFmt,...);
|
|
90 |
|
|
91 |
/**
|
|
92 |
* This member is internal and not intended for use.
|
|
93 |
*
|
|
94 |
* Sends a binary message to the specified UID (plugin, core).
|
|
95 |
*/
|
|
96 |
IMPORT_C void Send( const TUint uid, const TDesC8& aText );
|
|
97 |
|
|
98 |
/**
|
|
99 |
* This member is internal and not intended for use.
|
|
100 |
*
|
|
101 |
* Sets this client as a recipient for messages.
|
|
102 |
*/
|
|
103 |
IMPORT_C void SetServerObserverL( TUid aUid, MEcmtServerObserver* aObserver );
|
|
104 |
|
|
105 |
/**
|
|
106 |
* Writes text data to the System Output Diagnostic view on the connected PC.
|
|
107 |
* Unlike Write(), doesn't require Connect() before or Close() after calling this.
|
|
108 |
* @param aText Text to be written.
|
|
109 |
*/
|
|
110 |
IMPORT_C static void SWrite( const TDesC16& aText );
|
|
111 |
|
|
112 |
/**
|
|
113 |
* Writes text data to the System Output Diagnostic view on the connected PC.
|
|
114 |
* The text can include formatting directives (\%d, \%c, ...) which are then filled
|
|
115 |
* with the following parameters. The maximum length of the message after formatting
|
|
116 |
* is defined by KFormatMazSize.
|
|
117 |
* Unlike WriteFormat(), doesn't require Connect() before or Close() after calling this.
|
|
118 |
* @param aText Text to be written.
|
|
119 |
* @param ... Values used for formatting.
|
|
120 |
*/
|
|
121 |
IMPORT_C static void SWriteFormat(TRefByValue<const TDesC16> aFmt,...);
|
|
122 |
|
|
123 |
/**
|
|
124 |
* Closes the REcmt session used by SWrite() and
|
|
125 |
* SWriteFormat(). If those funcions are called, also SClose()
|
|
126 |
* must be called in order to avoid memory allocation errors.
|
|
127 |
*/
|
|
128 |
IMPORT_C static void SClose();
|
|
129 |
|
|
130 |
private:
|
|
131 |
static REcmt* GetServer();
|
|
132 |
|
|
133 |
/**
|
|
134 |
* Requests a message.
|
|
135 |
*/
|
|
136 |
void RequestServerNotification( TDes8& aDes, TRequestStatus& aStatus );
|
|
137 |
|
|
138 |
/**
|
|
139 |
* Cancels the message request.
|
|
140 |
*/
|
|
141 |
void CancelRequestServerNotification( );
|
|
142 |
|
|
143 |
private:
|
|
144 |
MEcmtServerObserver* iObserver;
|
|
145 |
CEcmtServerListener* iServerListener;
|
|
146 |
friend class CEcmtServerListener;
|
|
147 |
};
|
|
148 |
#endif
|
|
149 |
// End of File
|