|
1 // Copyright (c) 2007-2009 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 // ULogger commands |
|
15 // |
|
16 // |
|
17 |
|
18 /** |
|
19 @file |
|
20 @internalTechnology |
|
21 @prototype |
|
22 */ |
|
23 |
|
24 #ifndef ULOGGERCOMMANDS_H_ |
|
25 #define ULOGGERCOMMANDS_H_ |
|
26 |
|
27 #include <e32base.h> |
|
28 |
|
29 /** Ulogger command line syntax description. |
|
30 ULogger is used to configure and enable/disable logging of trace data on device. |
|
31 |
|
32 SYNOPSIS: ulogger [-rqtvhioH][-edl <config_options>...][-fsSoicbmn]... |
|
33 |
|
34 DESCRIPTION: |
|
35 ULogger groups the commands into execution and configuration commands |
|
36 where options -rqtvhH belong to the former group and -edlbnmfsSoic to the latter. |
|
37 Execution commands: -rqtvhioH, require no other arguments. |
|
38 Configuration commands are further divided into: |
|
39 -edl, these require one of the following options '-fsSoic' |
|
40 to be present, these will fail if too many or missing options are given. |
|
41 -fsSoicbmn, these will apply the arguments depending on provided option -edl. |
|
42 |
|
43 OPTIONS |
|
44 Execution commands: |
|
45 -r Start logging (Run) |
|
46 -q Stop logging (Quit) |
|
47 -t Restart (restarT) while logging, to update configurations |
|
48 -v Verbose mode, will list all results, or silent mode is |
|
49 assumed and only error codes will be returned |
|
50 -h List of options. |
|
51 -o List active output plugin. |
|
52 -i List active input plugin. |
|
53 -H This man page. |
|
54 -? The version of this tool and most usefull commands. |
|
55 |
|
56 Configuration commands: |
|
57 -e <-fsSoicbmn options> ... Enable/set either of option -fsSoicbmn |
|
58 -d <-fsSoic options> ... Disable/delete either of option -fsSoic |
|
59 -l <-fsSoicbmn options> ... List either of option -fsSoicbmn |
|
60 -f [<filter> ...] Enable/disable/list primary filter 0-255 |
|
61 -s [<filter> ...] Enable/disable/list secondary filter 0-4294967295 |
|
62 -S Enable/disable/list secondary filtering. |
|
63 Enable to filter on secondary filters, |
|
64 Disable to log all traces irrespective of secondary filter. |
|
65 By default filtering is enabled. |
|
66 -o [<filename>] Enable/disable an output plugin, list all output plugins |
|
67 -i [<filename>] Enable/disable an input plugin, list all input plugins |
|
68 -c [<filename> <config> ...] Enable(set)/delete/list plugin configurations. |
|
69 First argument must be the name of the configuration |
|
70 to be changed and any following arguments are treated as values of |
|
71 this configuration. The configuration keyword can not use any white |
|
72 characters (e.g. space or tabulation key). |
|
73 -b [<size> ...] Buffer size, 1-1024 Kb rounded up to nearest page size, 4Kb. |
|
74 -n [<size> ...] Notification size, 0-1024 Kb rounded up to nearest page size, 4Kb. |
|
75 -m [<mode> ...] Buffer mode, 'circular' or 'straight'. Default is straight. |
|
76 */ |
|
77 |
|
78 |
|
79 //ulogger commands |
|
80 _LIT(KCmdEnable, "e"); |
|
81 _LIT(KCmdDisable, "d"); |
|
82 _LIT(KCmdList, "l"); |
|
83 _LIT(KCmdPrimaryFilter, "f"); |
|
84 _LIT(KCmdSecondaryFilter, "s"); |
|
85 _LIT(KCmdSecondaryFilterToggle, "S"); |
|
86 _LIT(KCmdOutputPlugin, "o"); |
|
87 _LIT(KCmdInputPlugin, "i"); |
|
88 _LIT(KCmdPluginConfigurations, "c"); |
|
89 _LIT(KCmdBuffer, "b"); |
|
90 _LIT(KCmdNotification, "n"); |
|
91 _LIT(KCmdBufferMode, "m"); |
|
92 _LIT(KCmdVerboseMode, "v"); |
|
93 _LIT(KCmdStart, "r"); |
|
94 _LIT(KCmdStop, "q"); |
|
95 _LIT(KCmdRestart, "t"); |
|
96 _LIT(KCmdHelp, "h"); |
|
97 _LIT(KCmdMan, "H"); |
|
98 _LIT(KCmdVersion, "?"); |
|
99 _LIT(KCmdIndicator, "-"); |
|
100 _LIT(KCmdAll, "all"); |
|
101 _LIT(KCmdBufferModeCircular, "circular"); |
|
102 _LIT(KCmdBufferModeStraight, "straight"); |
|
103 |
|
104 |
|
105 /** |
|
106 @internalTechnology |
|
107 @prototype |
|
108 */ |
|
109 enum TCommand |
|
110 { |
|
111 EUnknown = 0, |
|
112 ERunAsService, // function not yet implemented in server! |
|
113 EDontRunAsService, // function not yet implemented in server! |
|
114 EStart, |
|
115 EStop, |
|
116 ERestart, |
|
117 ESetPrimaryFilter, |
|
118 EGetPrimaryFilters, |
|
119 ERemovePrimaryFilter, |
|
120 ESetSecondaryFilter, |
|
121 EGetSecondaryFilters, |
|
122 ERemoveSecondaryFilter, |
|
123 EGetSecondaryFiltering, |
|
124 EEnableSecondaryFiltering, |
|
125 EDisableSecondaryFiltering, |
|
126 ESetActivePlugin, |
|
127 EGetActivePlugin, |
|
128 EGetInstalledPlugins, |
|
129 ESetActiveInputPlugin, |
|
130 EGetActiveInputPlugin, |
|
131 EDeactivateInputPlugin, |
|
132 EGetInputPlugins, |
|
133 ESetPluginSettings, |
|
134 EGetPluginSettings, |
|
135 ERemovePluginSettings, |
|
136 EResizeTraceBuffer, |
|
137 EGetTraceBufferSize, |
|
138 ESetDataNotificationSize, |
|
139 EGetDataNotificationSize, |
|
140 ESetBufferMode, |
|
141 EGetBufferMode, |
|
142 EHelp, |
|
143 EManPage, |
|
144 EVersion |
|
145 }; |
|
146 |
|
147 /** |
|
148 @internalTechnology |
|
149 @prototype |
|
150 */ |
|
151 class TCommandLookup |
|
152 { |
|
153 public: |
|
154 TCommandLookup(const TDesC* aMainCommand, const TDesC* aSubCommand, const TCommand aCommand) |
|
155 : iMainCommand(aMainCommand), iSubCommand(aSubCommand), iCommand(aCommand) |
|
156 {} |
|
157 |
|
158 //data |
|
159 const TDesC* iMainCommand; |
|
160 const TDesC* iSubCommand; |
|
161 TCommand iCommand; |
|
162 }; |
|
163 |
|
164 |
|
165 /** |
|
166 Interface to execute command. |
|
167 |
|
168 @internalTechnology |
|
169 @prototype |
|
170 */ |
|
171 class MCommandImpl |
|
172 { |
|
173 public: |
|
174 virtual TInt DoCommandL(TCommand aCommand, const RArray<TPtrC>& aValues) = 0; |
|
175 }; |
|
176 |
|
177 |
|
178 /** |
|
179 This is a utility class to parse command line arguments and to generate accurate event |
|
180 to execute required command. |
|
181 To use this class properly, MCommandImpl interface must be implemented and pointer to it |
|
182 must be passed during object construction. |
|
183 |
|
184 @internalTechnology |
|
185 @prototype |
|
186 */ |
|
187 class CCommand : public CBase |
|
188 { |
|
189 public: |
|
190 IMPORT_C static CCommand* NewL(MCommandImpl* aCommandImpl); |
|
191 IMPORT_C static CCommand* NewLC(MCommandImpl* aCommandImpl); |
|
192 IMPORT_C ~CCommand(); |
|
193 IMPORT_C void ConstructL(); |
|
194 IMPORT_C TInt HandleCommandL(const RArray<TPtrC>& aArgs); |
|
195 |
|
196 |
|
197 private: |
|
198 CCommand(MCommandImpl* aCommandImpl); |
|
199 TInt PrepareCommandL(RArray<TPtrC>& aArgs); |
|
200 |
|
201 //data |
|
202 MCommandImpl* iCommandImpl; |
|
203 TBool iVerbose; |
|
204 RArray<TCommandLookup> iCommandsLookup; |
|
205 }; |
|
206 |
|
207 #endif /*ULOGGERCOMMANDS_H_*/ |