rtl_433/include/rtl_433.h
2020-03-16 11:28:59 +01:00

100 lines
2.6 KiB
C

/** @file
Definition of r_cfg application structure.
*/
#ifndef INCLUDE_RTL_433_H_
#define INCLUDE_RTL_433_H_
#include <stdint.h>
#include "list.h"
#include <time.h>
#define DEFAULT_SAMPLE_RATE 250000
#define DEFAULT_FREQUENCY 433920000
#define DEFAULT_HOP_TIME (60*10)
#define DEFAULT_ASYNC_BUF_NUMBER 0 // Force use of default value (librtlsdr default: 15)
#define DEFAULT_BUF_LENGTH (16 * 32 * 512) // librtlsdr default
#define FSK_PULSE_DETECTOR_LIMIT 800000000
#define MINIMAL_BUF_LENGTH 512
#define MAXIMAL_BUF_LENGTH (256 * 16384)
#define SIGNAL_GRABBER_BUFFER (12 * DEFAULT_BUF_LENGTH)
#define MAX_FREQS 32
#define INPUT_LINE_MAX 8192 /**< enough for a complete textual bitbuffer (25*256) */
struct sdr_dev;
struct r_device;
typedef enum {
CONVERT_NATIVE,
CONVERT_SI,
CONVERT_CUSTOMARY
} conversion_mode_t;
typedef enum {
REPORT_TIME_DEFAULT,
REPORT_TIME_DATE,
REPORT_TIME_SAMPLES,
REPORT_TIME_UNIX,
REPORT_TIME_ISO,
REPORT_TIME_OFF,
} time_mode_t;
typedef struct r_cfg {
char *dev_query;
char *gain_str;
char *settings_str;
int ppm_error;
uint32_t out_block_size;
char const *test_data;
list_t in_files;
char const *in_filename;
int do_exit;
int do_exit_async;
int frequencies;
int frequency_index;
uint32_t frequency[MAX_FREQS];
uint32_t center_frequency;
int fsk_pulse_detect_mode;
int hop_times;
int hop_time[MAX_FREQS];
time_t hop_start_time;
int duration;
time_t stop_time;
int after_successful_events_flag;
uint32_t samp_rate;
uint64_t input_pos;
uint32_t bytes_to_read;
struct sdr_dev *dev;
int grab_mode;
int verbosity; ///< 0=normal, 1=verbose, 2=verbose decoders, 3=debug decoders, 4=trace decoding.
int verbose_bits;
conversion_mode_t conversion_mode;
int report_meta;
int report_protocol;
time_mode_t report_time;
int report_time_hires;
int report_time_tz;
int report_time_utc;
int report_description;
int report_stats;
int stats_interval;
int stats_now;
time_t stats_time;
int no_default_devices;
struct r_device *devices;
uint16_t num_r_devices;
char *output_tag;
list_t output_handler;
struct dm_state *demod;
char const *sr_filename;
int sr_execopen;
int old_model_keys;
/* stats*/
unsigned frames_count; ///< stats counter for interval
unsigned frames_fsk; ///< stats counter for interval
unsigned frames_events; ///< stats counter for interval
} r_cfg_t;
#endif /* INCLUDE_RTL_433_H_ */