|
1 /* |
|
2 * Copyright (c) 2007-2007 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 #ifndef C_VOIPEVENTLOG_H |
|
20 #define C_VOIPEVENTLOG_H |
|
21 |
|
22 |
|
23 #include <e32base.h> |
|
24 |
|
25 class CVoipEventLogEngine; |
|
26 class CVoipErrorEntry; |
|
27 |
|
28 /** |
|
29 * VoIP event log API class |
|
30 * CVoipEventLog is responsible for writing and reading error information |
|
31 * from central repository |
|
32 * The maximu error count is saved in cenrep ini file, if there are more errors |
|
33 * than maximum count, old error is overwritten. |
|
34 * |
|
35 * @code |
|
36 * _LIT( KErrorText, "something wrong, man!" ); |
|
37 * CVoipEventLog* eventLog = CVoipEventLog::NewLC(); |
|
38 * CVoipErrorEntry* entry = CVoipErrorEntry::NewLC(); |
|
39 * entry->SetErrorCode( -1 ); |
|
40 * User::LeaveIfError( entry->SetErrorText( KErrorText )); |
|
41 * TInt err = eventLog->WriteError( *entry ); |
|
42 * User::LeaveIfError( err ); |
|
43 * CleanupStack::PopAndDestroy( entry ); |
|
44 * CleanupStack::PopAndDestroy( eventLog ); |
|
45 * @endcode |
|
46 * |
|
47 * @lib voipeventlog.lib |
|
48 * @since S60 v3.2 |
|
49 */ |
|
50 NONSHARABLE_CLASS(CVoipEventLog) : public CBase |
|
51 { |
|
52 public: |
|
53 |
|
54 /** |
|
55 * Two-phased constructor. |
|
56 */ |
|
57 IMPORT_C static CVoipEventLog* NewL(); |
|
58 IMPORT_C static CVoipEventLog* NewLC(); |
|
59 |
|
60 /** |
|
61 * Destructor. |
|
62 */ |
|
63 IMPORT_C ~CVoipEventLog(); |
|
64 |
|
65 /** |
|
66 * Writes an error data to event log |
|
67 * |
|
68 * @since S60 v3.2 |
|
69 * @param aErrorEntry Error information |
|
70 * @return error code |
|
71 */ |
|
72 IMPORT_C TInt WriteError( const CVoipErrorEntry& aErrorEntry ); |
|
73 |
|
74 /** |
|
75 * Writes an error code to event log |
|
76 * this function only writes the error code, no other infomration |
|
77 * @since S60 v3.2 |
|
78 * @param aErrorCode VoIP error identification |
|
79 * @return error code |
|
80 */ |
|
81 IMPORT_C TInt WriteError( TInt aErrorCode ); |
|
82 |
|
83 /** |
|
84 * Reads error count from the log |
|
85 * |
|
86 * @since S60 v3.2 |
|
87 * @return if it is positive, it means error count, if it is negative, it means error code |
|
88 */ |
|
89 IMPORT_C TInt ErrorCount() const; |
|
90 |
|
91 /** |
|
92 * Reads an error information from the log |
|
93 * |
|
94 * @since S60 v3.2 |
|
95 * @param aIndex the index of error to be read, 0 means latest error index |
|
96 * @param aErrorEntry in return, error information corresponding to aIndex |
|
97 * @return error code |
|
98 */ |
|
99 IMPORT_C TInt ReadError( TInt aIndex, CVoipErrorEntry& aErrorEntry ) const; |
|
100 |
|
101 /** |
|
102 * Clear all voip error entries from the log |
|
103 * |
|
104 * @since S60 v3.2 |
|
105 * @return error code |
|
106 */ |
|
107 IMPORT_C TInt ResetLog (); |
|
108 |
|
109 private: |
|
110 |
|
111 /** |
|
112 * C++ default constructor. |
|
113 */ |
|
114 CVoipEventLog(); |
|
115 |
|
116 /** |
|
117 * By default Symbian 2nd phase constructor is private. |
|
118 */ |
|
119 void ConstructL(); |
|
120 |
|
121 /** |
|
122 * Writes an error data to event log |
|
123 * this is leave function |
|
124 * |
|
125 * @since S60 v3.2 |
|
126 * @param aErrorEntry Error information |
|
127 */ |
|
128 void DoWriteErrorL( const CVoipErrorEntry& aErrorEntry ); |
|
129 |
|
130 /** |
|
131 * Writes an error code to event log |
|
132 * this is leave function |
|
133 * @since S60 v3.2 |
|
134 * @param aErrorCode VoIP error identification |
|
135 */ |
|
136 void DoWriteErrorL( TInt aErrorCode ); |
|
137 |
|
138 |
|
139 private: // data |
|
140 |
|
141 /** |
|
142 * CVoipEventLogEngine instance |
|
143 */ |
|
144 CVoipEventLogEngine* iEngine; |
|
145 |
|
146 }; |
|
147 |
|
148 #endif // C_VOIPEVENTLOG_H |