-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcmdline.h
More file actions
319 lines (295 loc) · 19.8 KB
/
cmdline.h
File metadata and controls
319 lines (295 loc) · 19.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
/** @file cmdline.h
* @brief The header file for the command line option parser
* generated by GNU Gengetopt version 2.22.6
* http://www.gnu.org/software/gengetopt.
* DO NOT modify this file, since it can be overwritten
* @author GNU Gengetopt by Lorenzo Bettini */
#ifndef CMDLINE_H
#define CMDLINE_H
/* If we use autoconf. */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdio.h> /* for FILE */
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#ifndef CMDLINE_PARSER_PACKAGE
/** @brief the program name (used for printing errors) */
#define CMDLINE_PARSER_PACKAGE "SerialInterfacer"
#endif
#ifndef CMDLINE_PARSER_PACKAGE_NAME
/** @brief the complete program name (used for help and version) */
#define CMDLINE_PARSER_PACKAGE_NAME "SerialInterfacer"
#endif
#ifndef CMDLINE_PARSER_VERSION
/** @brief the program version */
#define CMDLINE_PARSER_VERSION "v1.1, Nov. 2018 [Jack J. Miller, University of Oxford]"
#endif
/** @brief Where the command line options are stored */
struct gengetopt_args_info
{
const char *help_help; /**< @brief Print help and exit help description. */
const char *full_help_help; /**< @brief Print help, including hidden options, and exit help description. */
const char *version_help; /**< @brief Print version and exit help description. */
int verbose_flag; /**< @brief Debugging verbosity (default=off). */
const char *verbose_help; /**< @brief Debugging verbosity help description. */
char * device_arg; /**< @brief Serial port device to use (default='/dev/null'). */
char * device_orig; /**< @brief Serial port device to use original value given at command line. */
const char *device_help; /**< @brief Serial port device to use help description. */
int list_devices_flag; /**< @brief List found serial devices for debugging purposes (specify a dummy -d=Path) (default=off). */
const char *list_devices_help; /**< @brief List found serial devices for debugging purposes (specify a dummy -d=Path) help description. */
int heater_on_flag; /**< @brief Turn on the heater (Be careful!) (default=off). */
const char *heater_on_help; /**< @brief Turn on the heater (Be careful!) help description. */
int heater_off_flag; /**< @brief Turn the heater off (default=off). */
const char *heater_off_help; /**< @brief Turn the heater off help description. */
int get_heater_state_flag; /**< @brief See if the heater is on or off (default=off). */
const char *get_heater_state_help; /**< @brief See if the heater is on or off help description. */
float set_heater_power_limit_arg; /**< @brief Live dangerously by increasing the maximum heater power (a percentage between 0/100). */
char * set_heater_power_limit_orig; /**< @brief Live dangerously by increasing the maximum heater power (a percentage between 0/100) original value given at command line. */
const char *set_heater_power_limit_help; /**< @brief Live dangerously by increasing the maximum heater power (a percentage between 0/100) help description. */
int get_heater_power_limit_flag; /**< @brief Get the heater power limit (default=off). */
const char *get_heater_power_limit_help; /**< @brief Get the heater power limit help description. */
int get_heater_power_flag; /**< @brief Get the current heater power (as a percentage) (default=off). */
const char *get_heater_power_help; /**< @brief Get the current heater power (as a percentage) help description. */
float set_heater_power_arg; /**< @brief Set the current heater power (as a percentage). */
char * set_heater_power_orig; /**< @brief Set the current heater power (as a percentage) original value given at command line. */
const char *set_heater_power_help; /**< @brief Set the current heater power (as a percentage) help description. */
int check_heater_flag; /**< @brief Check to see if the heater is overheating (default=off). */
const char *check_heater_help; /**< @brief Check to see if the heater is overheating help description. */
int get_gas_flow_rate_flag; /**< @brief Return the gas flow rate in l/hr (default=off). */
const char *get_gas_flow_rate_help; /**< @brief Return the gas flow rate in l/hr help description. */
float set_gas_flow_rate_arg; /**< @brief Set the gas flow rate to one of 16 values between 0 and 2000 l/hr. NB: 0 disables the heater.. */
char * set_gas_flow_rate_orig; /**< @brief Set the gas flow rate to one of 16 values between 0 and 2000 l/hr. NB: 0 disables the heater. original value given at command line. */
const char *set_gas_flow_rate_help; /**< @brief Set the gas flow rate to one of 16 values between 0 and 2000 l/hr. NB: 0 disables the heater. help description. */
int read_temperature_flag; /**< @brief Read temperature (default=off). */
const char *read_temperature_help; /**< @brief Read temperature help description. */
float set_temperature_setpoint_arg; /**< @brief Set the temperature setpoint. */
char * set_temperature_setpoint_orig; /**< @brief Set the temperature setpoint original value given at command line. */
const char *set_temperature_setpoint_help; /**< @brief Set the temperature setpoint help description. */
int get_temperature_setpoint_flag; /**< @brief Get the current temperature setpoint (default=off). */
const char *get_temperature_setpoint_help; /**< @brief Get the current temperature setpoint help description. */
int get_ln2_heater_state_flag; /**< @brief Get the LN2 heater state (on/off) (default=off). */
const char *get_ln2_heater_state_help; /**< @brief Get the LN2 heater state (on/off) help description. */
int set_ln2_heater_state_arg; /**< @brief Turn on/off the LN2 heater (1=on). */
char * set_ln2_heater_state_orig; /**< @brief Turn on/off the LN2 heater (1=on) original value given at command line. */
const char *set_ln2_heater_state_help; /**< @brief Turn on/off the LN2 heater (1=on) help description. */
int get_ln2_heater_power_flag; /**< @brief Get the LN2 heater power (default=off). */
const char *get_ln2_heater_power_help; /**< @brief Get the LN2 heater power help description. */
float set_ln2_heater_power_arg; /**< @brief Set the LN2 heater power (as a percentage). */
char * set_ln2_heater_power_orig; /**< @brief Set the LN2 heater power (as a percentage) original value given at command line. */
const char *set_ln2_heater_power_help; /**< @brief Set the LN2 heater power (as a percentage) help description. */
int check_ln2_heater_flag; /**< @brief Check the LN2 tank to see if it is okay, needs a refil, or is empty (default=off). */
const char *check_ln2_heater_help; /**< @brief Check the LN2 tank to see if it is okay, needs a refil, or is empty help description. */
int enable_PID_control_flag; /**< @brief Enable the PID control of temperature to the setpoint (default=off). */
const char *enable_PID_control_help; /**< @brief Enable the PID control of temperature to the setpoint help description. */
int manual_mode_flag; /**< @brief Set the device into manual heater power mode (default=off). */
const char *manual_mode_help; /**< @brief Set the device into manual heater power mode help description. */
int get_mode_flag; /**< @brief Return the current PID / Manual control mode
(default=off). */
const char *get_mode_help; /**< @brief Return the current PID / Manual control mode
help description. */
float set_proportional_band_arg; /**< @brief Set the P part of PID. */
char * set_proportional_band_orig; /**< @brief Set the P part of PID original value given at command line. */
const char *set_proportional_band_help; /**< @brief Set the P part of PID help description. */
int get_proportional_band_flag; /**< @brief Get the P part of PID (default=off). */
const char *get_proportional_band_help; /**< @brief Get the P part of PID help description. */
float set_integral_time_arg; /**< @brief Set the I part of PID. */
char * set_integral_time_orig; /**< @brief Set the I part of PID original value given at command line. */
const char *set_integral_time_help; /**< @brief Set the I part of PID help description. */
int get_integral_time_flag; /**< @brief Get the I part of PID (default=off). */
const char *get_integral_time_help; /**< @brief Get the I part of PID help description. */
float set_differential_time_arg; /**< @brief Set the D part of PID. */
char * set_differential_time_orig; /**< @brief Set the D part of PID original value given at command line. */
const char *set_differential_time_help; /**< @brief Set the D part of PID help description. */
int get_differential_time_flag; /**< @brief Get the D in the PID
(default=off). */
const char *get_differential_time_help; /**< @brief Get the D in the PID
help description. */
int get_high_cutback_flag; /**< @brief Get the high cutback value (default=off). */
const char *get_high_cutback_help; /**< @brief Get the high cutback value help description. */
float set_high_cutback_arg; /**< @brief Set the high cutback value. */
char * set_high_cutback_orig; /**< @brief Set the high cutback value original value given at command line. */
const char *set_high_cutback_help; /**< @brief Set the high cutback value help description. */
int get_low_cutback_flag; /**< @brief Get the low cutback value (default=off). */
const char *get_low_cutback_help; /**< @brief Get the low cutback value help description. */
float set_low_cutback_arg; /**< @brief Set the low cutback value. */
char * set_low_cutback_orig; /**< @brief Set the low cutback value original value given at command line. */
const char *set_low_cutback_help; /**< @brief Set the low cutback value help description. */
int get_adaptive_tune_level_flag; /**< @brief Get the adaptive tune level (K) (default=off). */
const char *get_adaptive_tune_level_help; /**< @brief Get the adaptive tune level (K) help description. */
float set_adaptive_tune_level_arg; /**< @brief Set the adaptive tune level (K). */
char * set_adaptive_tune_level_orig; /**< @brief Set the adaptive tune level (K) original value given at command line. */
const char *set_adaptive_tune_level_help; /**< @brief Set the adaptive tune level (K) help description. */
int lock_keypad_arg; /**< @brief Unlock (1) or lock (0) the Eurotherm keypad. */
char * lock_keypad_orig; /**< @brief Unlock (1) or lock (0) the Eurotherm keypad original value given at command line. */
const char *lock_keypad_help; /**< @brief Unlock (1) or lock (0) the Eurotherm keypad help description. */
int get_eurotherm_status_flag; /**< @brief Get the status of the Eurotherm controller (alarming or not) (default=off). */
const char *get_eurotherm_status_help; /**< @brief Get the status of the Eurotherm controller (alarming or not) help description. */
int status_all_flag; /**< @brief Return the status of everything that is a status (default=off). */
const char *status_all_help; /**< @brief Return the status of everything that is a status help description. */
int check_sensor_break_flag; /**< @brief Check to see if the Thermocouples are broken (default=off). */
const char *check_sensor_break_help; /**< @brief Check to see if the Thermocouples are broken help description. */
unsigned int help_given ; /**< @brief Whether help was given. */
unsigned int full_help_given ; /**< @brief Whether full-help was given. */
unsigned int version_given ; /**< @brief Whether version was given. */
unsigned int verbose_given ; /**< @brief Whether verbose was given. */
unsigned int device_given ; /**< @brief Whether device was given. */
unsigned int list_devices_given ; /**< @brief Whether list-devices was given. */
unsigned int heater_on_given ; /**< @brief Whether heater-on was given. */
unsigned int heater_off_given ; /**< @brief Whether heater-off was given. */
unsigned int get_heater_state_given ; /**< @brief Whether get-heater-state was given. */
unsigned int set_heater_power_limit_given ; /**< @brief Whether set-heater-power-limit was given. */
unsigned int get_heater_power_limit_given ; /**< @brief Whether get-heater-power-limit was given. */
unsigned int get_heater_power_given ; /**< @brief Whether get-heater-power was given. */
unsigned int set_heater_power_given ; /**< @brief Whether set-heater-power was given. */
unsigned int check_heater_given ; /**< @brief Whether check-heater was given. */
unsigned int get_gas_flow_rate_given ; /**< @brief Whether get-gas-flow-rate was given. */
unsigned int set_gas_flow_rate_given ; /**< @brief Whether set-gas-flow-rate was given. */
unsigned int read_temperature_given ; /**< @brief Whether read-temperature was given. */
unsigned int set_temperature_setpoint_given ; /**< @brief Whether set-temperature-setpoint was given. */
unsigned int get_temperature_setpoint_given ; /**< @brief Whether get-temperature-setpoint was given. */
unsigned int get_ln2_heater_state_given ; /**< @brief Whether get-ln2-heater-state was given. */
unsigned int set_ln2_heater_state_given ; /**< @brief Whether set-ln2-heater-state was given. */
unsigned int get_ln2_heater_power_given ; /**< @brief Whether get-ln2-heater-power was given. */
unsigned int set_ln2_heater_power_given ; /**< @brief Whether set-ln2-heater-power was given. */
unsigned int check_ln2_heater_given ; /**< @brief Whether check-ln2-heater was given. */
unsigned int enable_PID_control_given ; /**< @brief Whether enable-PID-control was given. */
unsigned int manual_mode_given ; /**< @brief Whether manual-mode was given. */
unsigned int get_mode_given ; /**< @brief Whether get-mode was given. */
unsigned int set_proportional_band_given ; /**< @brief Whether set-proportional-band was given. */
unsigned int get_proportional_band_given ; /**< @brief Whether get-proportional-band was given. */
unsigned int set_integral_time_given ; /**< @brief Whether set-integral-time was given. */
unsigned int get_integral_time_given ; /**< @brief Whether get-integral-time was given. */
unsigned int set_differential_time_given ; /**< @brief Whether set-differential-time was given. */
unsigned int get_differential_time_given ; /**< @brief Whether get-differential-time was given. */
unsigned int get_high_cutback_given ; /**< @brief Whether get-high-cutback was given. */
unsigned int set_high_cutback_given ; /**< @brief Whether set-high-cutback was given. */
unsigned int get_low_cutback_given ; /**< @brief Whether get-low-cutback was given. */
unsigned int set_low_cutback_given ; /**< @brief Whether set-low-cutback was given. */
unsigned int get_adaptive_tune_level_given ; /**< @brief Whether get-adaptive-tune-level was given. */
unsigned int set_adaptive_tune_level_given ; /**< @brief Whether set-adaptive-tune-level was given. */
unsigned int lock_keypad_given ; /**< @brief Whether lock-keypad was given. */
unsigned int get_eurotherm_status_given ; /**< @brief Whether get-eurotherm-status was given. */
unsigned int status_all_given ; /**< @brief Whether status-all was given. */
unsigned int check_sensor_break_given ; /**< @brief Whether check-sensor-break was given. */
} ;
/** @brief The additional parameters to pass to parser functions */
struct cmdline_parser_params
{
int override; /**< @brief whether to override possibly already present options (default 0) */
int initialize; /**< @brief whether to initialize the option structure gengetopt_args_info (default 1) */
int check_required; /**< @brief whether to check that all required options were provided (default 1) */
int check_ambiguity; /**< @brief whether to check for options already specified in the option structure gengetopt_args_info (default 0) */
int print_errors; /**< @brief whether getopt_long should print an error message for a bad option (default 1) */
} ;
/** @brief the purpose string of the program */
extern const char *gengetopt_args_info_purpose;
/** @brief the usage string of the program */
extern const char *gengetopt_args_info_usage;
/** @brief the description string of the program */
extern const char *gengetopt_args_info_description;
/** @brief all the lines making the help output */
extern const char *gengetopt_args_info_help[];
/** @brief all the lines making the full help output (including hidden options) */
extern const char *gengetopt_args_info_full_help[];
/**
* The command line parser
* @param argc the number of command line options
* @param argv the command line options
* @param args_info the structure where option information will be stored
* @return 0 if everything went fine, NON 0 if an error took place
*/
int cmdline_parser (int argc, char **argv,
struct gengetopt_args_info *args_info);
/**
* The command line parser (version with additional parameters - deprecated)
* @param argc the number of command line options
* @param argv the command line options
* @param args_info the structure where option information will be stored
* @param override whether to override possibly already present options
* @param initialize whether to initialize the option structure my_args_info
* @param check_required whether to check that all required options were provided
* @return 0 if everything went fine, NON 0 if an error took place
* @deprecated use cmdline_parser_ext() instead
*/
int cmdline_parser2 (int argc, char **argv,
struct gengetopt_args_info *args_info,
int override, int initialize, int check_required);
/**
* The command line parser (version with additional parameters)
* @param argc the number of command line options
* @param argv the command line options
* @param args_info the structure where option information will be stored
* @param params additional parameters for the parser
* @return 0 if everything went fine, NON 0 if an error took place
*/
int cmdline_parser_ext (int argc, char **argv,
struct gengetopt_args_info *args_info,
struct cmdline_parser_params *params);
/**
* Save the contents of the option struct into an already open FILE stream.
* @param outfile the stream where to dump options
* @param args_info the option struct to dump
* @return 0 if everything went fine, NON 0 if an error took place
*/
int cmdline_parser_dump(FILE *outfile,
struct gengetopt_args_info *args_info);
/**
* Save the contents of the option struct into a (text) file.
* This file can be read by the config file parser (if generated by gengetopt)
* @param filename the file where to save
* @param args_info the option struct to save
* @return 0 if everything went fine, NON 0 if an error took place
*/
int cmdline_parser_file_save(const char *filename,
struct gengetopt_args_info *args_info);
/**
* Print the help
*/
void cmdline_parser_print_help(void);
/**
* Print the full help (including hidden options)
*/
void cmdline_parser_print_full_help(void);
/**
* Print the version
*/
void cmdline_parser_print_version(void);
/**
* Initializes all the fields a cmdline_parser_params structure
* to their default values
* @param params the structure to initialize
*/
void cmdline_parser_params_init(struct cmdline_parser_params *params);
/**
* Allocates dynamically a cmdline_parser_params structure and initializes
* all its fields to their default values
* @return the created and initialized cmdline_parser_params structure
*/
struct cmdline_parser_params *cmdline_parser_params_create(void);
/**
* Initializes the passed gengetopt_args_info structure's fields
* (also set default values for options that have a default)
* @param args_info the structure to initialize
*/
void cmdline_parser_init (struct gengetopt_args_info *args_info);
/**
* Deallocates the string fields of the gengetopt_args_info structure
* (but does not deallocate the structure itself)
* @param args_info the structure to deallocate
*/
void cmdline_parser_free (struct gengetopt_args_info *args_info);
/**
* Checks that all the required options were specified
* @param args_info the structure to check
* @param prog_name the name of the program that will be used to print
* possible errors
* @return
*/
int cmdline_parser_required (struct gengetopt_args_info *args_info,
const char *prog_name);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* CMDLINE_H */