Remove oldmodel option
This commit is contained in:
parent
5197b82d5c
commit
c19179434e
10 changed files with 22 additions and 43 deletions
|
@ -369,7 +369,7 @@ E.g. -X "n=doorbell,m=OOK_PWM,s=400,l=800,r=7000,g=1000,match={24}0xa9878c,repea
|
||||||
|
|
||||||
|
|
||||||
= Meta information option =
|
= Meta information option =
|
||||||
[-M time[:<options>]|protocol|level|stats|bits|oldmodel] Add various metadata to every output line.
|
[-M time[:<options>]|protocol|level|stats|bits] Add various metadata to every output line.
|
||||||
Use "time" to add current date and time meta data (preset for live inputs).
|
Use "time" to add current date and time meta data (preset for live inputs).
|
||||||
Use "time:rel" to add sample position meta data (preset for read-file and stdin).
|
Use "time:rel" to add sample position meta data (preset for read-file and stdin).
|
||||||
Use "time:unix" to show the seconds since unix epoch as time meta data.
|
Use "time:unix" to show the seconds since unix epoch as time meta data.
|
||||||
|
@ -385,7 +385,6 @@ E.g. -X "n=doorbell,m=OOK_PWM,s=400,l=800,r=7000,g=1000,match={24}0xa9878c,repea
|
||||||
Use "stats[:[<level>][:<interval>]]" to report statistics (default: 600 seconds).
|
Use "stats[:[<level>][:<interval>]]" to report statistics (default: 600 seconds).
|
||||||
level 0: no report, 1: report successful devices, 2: report active devices, 3: report all
|
level 0: no report, 1: report successful devices, 2: report active devices, 3: report all
|
||||||
Use "bits" to add bit representation to code outputs (for debug).
|
Use "bits" to add bit representation to code outputs (for debug).
|
||||||
Note: You can use "oldmodel" to get the old model keys. This will be removed shortly.
|
|
||||||
|
|
||||||
|
|
||||||
= Read file option =
|
= Read file option =
|
||||||
|
|
|
@ -111,7 +111,7 @@ analyze_pulses false
|
||||||
#out_block_size
|
#out_block_size
|
||||||
|
|
||||||
# as command line option:
|
# as command line option:
|
||||||
# [-M time[:<options>]|protocol|level|stats|bits|oldmodel] Add various metadata to every output line.
|
# [-M time[:<options>]|protocol|level|stats|bits] Add various metadata to every output line.
|
||||||
# Use "time" to add current date and time meta data (preset for live inputs).
|
# Use "time" to add current date and time meta data (preset for live inputs).
|
||||||
# Use "time:rel" to add sample position meta data (preset for read-file and stdin).
|
# Use "time:rel" to add sample position meta data (preset for read-file and stdin).
|
||||||
# Use "time:unix" to show the seconds since unix epoch as time meta data.
|
# Use "time:unix" to show the seconds since unix epoch as time meta data.
|
||||||
|
@ -125,7 +125,6 @@ analyze_pulses false
|
||||||
# Use "level" to add Modulation, Frequency, RSSI, SNR, and Noise meta data.
|
# Use "level" to add Modulation, Frequency, RSSI, SNR, and Noise meta data.
|
||||||
# Use "stats[:[<level>][:<interval>]]" to report statistics (default: 600 seconds).
|
# Use "stats[:[<level>][:<interval>]]" to report statistics (default: 600 seconds).
|
||||||
# level 0: no report, 1: report successful devices, 2: report active devices, 3: report all
|
# level 0: no report, 1: report successful devices, 2: report active devices, 3: report all
|
||||||
# Use "oldmodel" to use to old model keys. This will be removed shortly.
|
|
||||||
report_meta level
|
report_meta level
|
||||||
report_meta stats
|
report_meta stats
|
||||||
report_meta time:usec
|
report_meta time:usec
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
# JSON Data fields
|
# JSON Data fields
|
||||||
|
|
||||||
See also the discussion and rationale in https://github.com/merbanan/rtl_433/pull/827
|
See also the discussion and rationale in https://github.com/merbanan/rtl_433/pull/827
|
||||||
Note that you can use `-M oldmodel` to still get the legacy names for a short while.
|
|
||||||
|
|
||||||
## Message Data
|
## Message Data
|
||||||
These fields are the primary data fields containing the most basic message data and used to identify the specific device.
|
These fields are the primary data fields containing the most basic message data and used to identify the specific device.
|
||||||
|
|
|
@ -496,7 +496,7 @@ Without any `-F` option the default is KV output. Use `-F null` to remove that d
|
||||||
### Meta information
|
### Meta information
|
||||||
|
|
||||||
```
|
```
|
||||||
[-M time[:<options>]|protocol|level|stats|bits|oldmodel]
|
[-M time[:<options>]|protocol|level|stats|bits]
|
||||||
Add various metadata to every output line.
|
Add various metadata to every output line.
|
||||||
```
|
```
|
||||||
- Use `time` to add current date and time meta data (preset for live inputs).
|
- Use `time` to add current date and time meta data (preset for live inputs).
|
||||||
|
|
|
@ -13,6 +13,6 @@
|
||||||
#include "decoder_util.h"
|
#include "decoder_util.h"
|
||||||
|
|
||||||
/* TODO: temporary allow to change to new style model keys */
|
/* TODO: temporary allow to change to new style model keys */
|
||||||
#define _X(n, o) (decoder->old_model_keys ? (o) : (n))
|
#define _X(n, o) ((0) ? (o) : (n))
|
||||||
|
|
||||||
#endif /* INCLUDE_DECODER_H_ */
|
#endif /* INCLUDE_DECODER_H_ */
|
||||||
|
|
|
@ -57,7 +57,6 @@ typedef struct r_device {
|
||||||
char **fields; ///< List of fields this decoder produces; required for CSV output. NULL-terminated.
|
char **fields; ///< List of fields this decoder produces; required for CSV output. NULL-terminated.
|
||||||
|
|
||||||
/* public for each decoder */
|
/* public for each decoder */
|
||||||
int old_model_keys; ///< TODO: temporary allow to change to old style model keys
|
|
||||||
int verbose;
|
int verbose;
|
||||||
int verbose_bits;
|
int verbose_bits;
|
||||||
void (*output_fn)(struct r_device *decoder, struct data *data);
|
void (*output_fn)(struct r_device *decoder, struct data *data);
|
||||||
|
|
|
@ -95,7 +95,6 @@ typedef struct r_cfg {
|
||||||
struct dm_state *demod;
|
struct dm_state *demod;
|
||||||
char const *sr_filename;
|
char const *sr_filename;
|
||||||
int sr_execopen;
|
int sr_execopen;
|
||||||
int old_model_keys;
|
|
||||||
/* stats*/
|
/* stats*/
|
||||||
time_t frames_since; ///< stats start time
|
time_t frames_since; ///< stats start time
|
||||||
unsigned frames_count; ///< stats counter for interval
|
unsigned frames_count; ///< stats counter for interval
|
||||||
|
|
|
@ -352,7 +352,7 @@ Specify host/port for syslog with e.g. \-F syslog:127.0.0.1:1514
|
||||||
.RE
|
.RE
|
||||||
.SS "Meta information option"
|
.SS "Meta information option"
|
||||||
.TP
|
.TP
|
||||||
[ \fB\-M\fI time[:<options>]|protocol|level|stats|bits|oldmodel\fP ]
|
[ \fB\-M\fI time[:<options>]|protocol|level|stats|bits\fP ]
|
||||||
Add various metadata to every output line.
|
Add various metadata to every output line.
|
||||||
.RS
|
.RS
|
||||||
Use "time" to add current date and time meta data (preset for live inputs).
|
Use "time" to add current date and time meta data (preset for live inputs).
|
||||||
|
@ -399,9 +399,6 @@ Use "stats[:[<level>][:<interval>]]" to report statistics (default: 600 seconds)
|
||||||
.RS
|
.RS
|
||||||
Use "bits" to add bit representation to code outputs (for debug).
|
Use "bits" to add bit representation to code outputs (for debug).
|
||||||
.RE
|
.RE
|
||||||
.RS
|
|
||||||
Note: You can use "oldmodel" to get the old model keys. This will be removed shortly.
|
|
||||||
.RE
|
|
||||||
.SS "Read file option"
|
.SS "Read file option"
|
||||||
.TP
|
.TP
|
||||||
[ \fB\-r\fI <filename>\fP ]
|
[ \fB\-r\fI <filename>\fP ]
|
||||||
|
|
|
@ -227,8 +227,6 @@ void register_protocol(r_cfg_t *cfg, r_device *r_dev, char *arg)
|
||||||
p->verbose = cfg->verbosity > 0 ? cfg->verbosity - 1 : 0;
|
p->verbose = cfg->verbosity > 0 ? cfg->verbosity - 1 : 0;
|
||||||
p->verbose_bits = cfg->verbose_bits;
|
p->verbose_bits = cfg->verbose_bits;
|
||||||
|
|
||||||
p->old_model_keys = cfg->old_model_keys; // TODO: temporary allow to change to new style model keys
|
|
||||||
|
|
||||||
p->output_fn = data_acquired_handler;
|
p->output_fn = data_acquired_handler;
|
||||||
p->output_ctx = cfg;
|
p->output_ctx = cfg;
|
||||||
|
|
||||||
|
@ -374,11 +372,9 @@ char const **well_known_output_fields(r_cfg_t *cfg)
|
||||||
/** Convert CSV keys according to selected conversion mode. Replacement is static but in-place. */
|
/** Convert CSV keys according to selected conversion mode. Replacement is static but in-place. */
|
||||||
static char const **convert_csv_fields(r_cfg_t *cfg, char const **fields)
|
static char const **convert_csv_fields(r_cfg_t *cfg, char const **fields)
|
||||||
{
|
{
|
||||||
if (!cfg->old_model_keys) {
|
|
||||||
for (char const **p = fields; *p; ++p) {
|
for (char const **p = fields; *p; ++p) {
|
||||||
if (!strcmp(*p, "battery")) *p = "battery_ok";
|
if (!strcmp(*p, "battery")) *p = "battery_ok";
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (cfg->conversion_mode == CONVERT_SI) {
|
if (cfg->conversion_mode == CONVERT_SI) {
|
||||||
for (char const **p = fields; *p; ++p) {
|
for (char const **p = fields; *p; ++p) {
|
||||||
|
@ -557,7 +553,6 @@ void data_acquired_handler(r_device *r_dev, data_t *data)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// replace textual battery key with numerical battery key
|
// replace textual battery key with numerical battery key
|
||||||
if (!cfg->old_model_keys) {
|
|
||||||
for (data_t *d = data; d; d = d->next) {
|
for (data_t *d = data; d; d = d->next) {
|
||||||
if ((d->type == DATA_STRING) && !strcmp(d->key, "battery")) {
|
if ((d->type == DATA_STRING) && !strcmp(d->key, "battery")) {
|
||||||
free(d->key);
|
free(d->key);
|
||||||
|
@ -571,7 +566,6 @@ void data_acquired_handler(r_device *r_dev, data_t *data)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (cfg->conversion_mode == CONVERT_SI) {
|
if (cfg->conversion_mode == CONVERT_SI) {
|
||||||
for (data_t *d = data; d; d = d->next) {
|
for (data_t *d = data; d; d = d->next) {
|
||||||
|
|
|
@ -253,7 +253,7 @@ static void help_meta(void)
|
||||||
{
|
{
|
||||||
term_help_printf(
|
term_help_printf(
|
||||||
"\t\t= Meta information option =\n"
|
"\t\t= Meta information option =\n"
|
||||||
" [-M time[:<options>]|protocol|level|stats|bits|oldmodel] Add various metadata to every output line.\n"
|
" [-M time[:<options>]|protocol|level|stats|bits] Add various metadata to every output line.\n"
|
||||||
"\tUse \"time\" to add current date and time meta data (preset for live inputs).\n"
|
"\tUse \"time\" to add current date and time meta data (preset for live inputs).\n"
|
||||||
"\tUse \"time:rel\" to add sample position meta data (preset for read-file and stdin).\n"
|
"\tUse \"time:rel\" to add sample position meta data (preset for read-file and stdin).\n"
|
||||||
"\tUse \"time:unix\" to show the seconds since unix epoch as time meta data.\n"
|
"\tUse \"time:unix\" to show the seconds since unix epoch as time meta data.\n"
|
||||||
|
@ -268,8 +268,7 @@ static void help_meta(void)
|
||||||
"\tUse \"level\" to add Modulation, Frequency, RSSI, SNR, and Noise meta data.\n"
|
"\tUse \"level\" to add Modulation, Frequency, RSSI, SNR, and Noise meta data.\n"
|
||||||
"\tUse \"stats[:[<level>][:<interval>]]\" to report statistics (default: 600 seconds).\n"
|
"\tUse \"stats[:[<level>][:<interval>]]\" to report statistics (default: 600 seconds).\n"
|
||||||
"\t level 0: no report, 1: report successful devices, 2: report active devices, 3: report all\n"
|
"\t level 0: no report, 1: report successful devices, 2: report active devices, 3: report all\n"
|
||||||
"\tUse \"bits\" to add bit representation to code outputs (for debug).\n"
|
"\tUse \"bits\" to add bit representation to code outputs (for debug).\n");
|
||||||
"\tNote: You can use \"oldmodel\" to get the old model keys. This will be removed shortly.\n");
|
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -966,9 +965,9 @@ static void parse_conf_option(r_cfg_t *cfg, int opt, char *arg)
|
||||||
else if (!strcasecmp(arg, "description"))
|
else if (!strcasecmp(arg, "description"))
|
||||||
cfg->report_description = 1;
|
cfg->report_description = 1;
|
||||||
else if (!strcasecmp(arg, "newmodel"))
|
else if (!strcasecmp(arg, "newmodel"))
|
||||||
cfg->old_model_keys = 0;
|
fprintf(stderr, "newmodel option (-M) is deprecated.\n");
|
||||||
else if (!strcasecmp(arg, "oldmodel"))
|
else if (!strcasecmp(arg, "oldmodel"))
|
||||||
cfg->old_model_keys = 1;
|
fprintf(stderr, "oldmodel option (-M) is deprecated.\n");
|
||||||
else if (!strncasecmp(arg, "stats", 5)) {
|
else if (!strncasecmp(arg, "stats", 5)) {
|
||||||
// there also should be options to set wether to flush on report
|
// there also should be options to set wether to flush on report
|
||||||
char *p = arg_param(arg);
|
char *p = arg_param(arg);
|
||||||
|
@ -1302,12 +1301,6 @@ int main(int argc, char **argv) {
|
||||||
|
|
||||||
parse_conf_args(cfg, argc, argv);
|
parse_conf_args(cfg, argc, argv);
|
||||||
|
|
||||||
// warn if still using old model keys
|
|
||||||
if (cfg->old_model_keys) {
|
|
||||||
fprintf(stderr,
|
|
||||||
"\n\tWarning: Using deprecated old model keys (\"-M oldmodel\"). This will be removed shortly.\n\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
// add all remaining positional arguments as input files
|
// add all remaining positional arguments as input files
|
||||||
while (argc > optind) {
|
while (argc > optind) {
|
||||||
add_infile(cfg, argv[optind++]);
|
add_infile(cfg, argv[optind++]);
|
||||||
|
|
Loading…
Add table
Reference in a new issue