|
1 /* |
|
2 * Copyright (c) 2006 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: ?description |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_CATALOGSLOGGERMSGQUEUEOBSERVER_H |
|
20 #define C_CATALOGSLOGGERMSGQUEUEOBSERVER_H |
|
21 |
|
22 |
|
23 #include <e32base.h> |
|
24 #include <e32msgqueue.h> |
|
25 #include <f32file.h> |
|
26 |
|
27 #include "catalogsdebugdefs.h" |
|
28 #include "osmobexsender.h" |
|
29 |
|
30 class CCatalogsLoggerAppUi; |
|
31 |
|
32 _LIT( KCatalogsLoggerFileName, "\\logs\\catalogs\\debuglogger.log" ); |
|
33 _LIT( KCatalogsNewLine, "\n" ); |
|
34 |
|
35 const TInt KCatalogsLoggerNrOfSlots = 100; |
|
36 |
|
37 /** |
|
38 * ?one_line_short_description |
|
39 * |
|
40 * ?more_complete_description |
|
41 * |
|
42 * @lib ?library |
|
43 * @since S60 ?S60_version *** for example, S60 v3.0 |
|
44 */ |
|
45 class CCatalogsLoggerMsgQueueObserver : public CActive, public MOsmObexSenderObserver |
|
46 { |
|
47 public: |
|
48 static CCatalogsLoggerMsgQueueObserver* NewL(); |
|
49 |
|
50 static CCatalogsLoggerMsgQueueObserver* NewLC(); |
|
51 |
|
52 virtual ~CCatalogsLoggerMsgQueueObserver(); |
|
53 void StartLogging(); |
|
54 void StopLogging(); |
|
55 inline TBool IsLogging() |
|
56 { |
|
57 return iIsLogging; |
|
58 } |
|
59 |
|
60 /** |
|
61 * Sends the log file over Bluetooth |
|
62 */ |
|
63 void SendFileL(); |
|
64 |
|
65 /** |
|
66 * Clears the log file |
|
67 * |
|
68 * @return System wide error code |
|
69 */ |
|
70 TInt ClearLog(); |
|
71 |
|
72 void Flush(); |
|
73 |
|
74 inline TInt FunCounter() const { return iFunCounter; } |
|
75 inline TInt LogDrive() const { return iLogFileName[0] == 'e' ? EDriveE : EDriveC; } |
|
76 |
|
77 void SetEnableFlags( TInt aFlags ); |
|
78 |
|
79 TUint CurrentChunkOffset(); |
|
80 TPtrC8 LastData( TUint aMaxSize ); |
|
81 |
|
82 protected: |
|
83 |
|
84 // from base class CActive |
|
85 |
|
86 /** |
|
87 * From CActive. |
|
88 * Handles request completion. |
|
89 * |
|
90 * @since S60 ?S60_version |
|
91 * @param ?arg1 ?description |
|
92 */ |
|
93 void RunL(); |
|
94 |
|
95 /** |
|
96 * From CActive. |
|
97 * Cancels outstanding request. |
|
98 * |
|
99 * @since S60 ?S60_version |
|
100 * @param ?arg1 ?description |
|
101 */ |
|
102 void DoCancel(); |
|
103 |
|
104 protected: |
|
105 |
|
106 // From MOsmObexSenderObserver |
|
107 |
|
108 void ObexFileSent(); |
|
109 void ObexDisconnected( TInt aError, TInt aState ); |
|
110 |
|
111 private: |
|
112 |
|
113 CCatalogsLoggerMsgQueueObserver(); |
|
114 void ConstructL(); |
|
115 |
|
116 private: // data |
|
117 RMsgQueue<TInt> iMsgQueue; |
|
118 |
|
119 // Obex sender for sending the log file over bluetooth |
|
120 TInt iObexSendError; |
|
121 COsmObexSender* iObexSender; |
|
122 RFs iFs; |
|
123 RFile iLogFile; |
|
124 RChunk iChunk1; |
|
125 RChunk iChunk2; |
|
126 RMutex iChunkMutex; |
|
127 RSemaphore iChunkWriteSemaphore; |
|
128 TInt iLastChunk; |
|
129 TInt iFunCounter; |
|
130 TFileName iLogFileName; |
|
131 TBool iIsLogging; |
|
132 TInt iEnableFlags; |
|
133 }; |
|
134 |
|
135 #endif // C_CATALOGSLOGGERMSGQUEUEOBSERVER_H |
|
136 |