File: rtl_433.h

package info (click to toggle)
rtl-433 25.12-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,192 kB
  • sloc: ansic: 55,982; cpp: 3,263; python: 2,544; php: 55; javascript: 43; sh: 18; makefile: 16
file content (136 lines) | stat: -rw-r--r-- 4,303 bytes parent folder | download | duplicates (2)
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
/** @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>
#include <signal.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;
struct mg_mgr;

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 enum {
    DEVICE_MODE_QUIT,
    DEVICE_MODE_RESTART,
    DEVICE_MODE_PAUSE,
    DEVICE_MODE_MANUAL,
} device_mode_t;

typedef enum {
    DEVICE_STATE_STOPPED,
    DEVICE_STATE_STARTING,
    DEVICE_STATE_GRACE,
    DEVICE_STATE_STARTED,
} device_state_t;

typedef struct r_cfg {
    device_mode_t dev_mode; ///< Input device run mode
    device_state_t dev_state; ///< Input device run state
    char *dev_query;
    char const *dev_info;
    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 in_replay;
    volatile sig_atomic_t hop_now;
    volatile sig_atomic_t exit_async;
    volatile sig_atomic_t exit_code; ///< 0=no err, 1=params or cmd line err, 2=sdr device read error, 3=usb init error, 5=USB error (reset), other=other error
    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; ///< Signal grabber mode: 0=off, 1=all, 2=unknown, 3=known
    int raw_mode; ///< Raw pulses printing mode: 0=off, 1=all, 2=unknown, 3=known
    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_noise;
    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;
    volatile sig_atomic_t stats_now;
    time_t stats_time;
    int no_default_devices;
    struct r_device *devices;
    uint16_t num_r_devices;
    list_t data_tags;
    list_t output_handler;
    list_t raw_handler;
    int has_logout;
    struct dm_state *demod;
    char const *sr_filename;
    int sr_execopen;
    int watchdog; ///< SDR acquire stall watchdog
    /* global stats */
    time_t running_since;           ///< program start time statistic
    unsigned total_frames_count;    ///< total frames recieved statistic
    unsigned total_frames_squelch;  ///< total frames with noise only statistic
    unsigned total_frames_ook;      ///< total frames with ook demod statistic
    unsigned total_frames_fsk;      ///< total frames with fsk demod statistic
    unsigned total_frames_events;   ///< total frames with decoder events statistic
    /* sdr stats */
    time_t sdr_since; ///< time of last SDR connect statistic
    /* per report interval stats */
    time_t frames_since;    ///< time at start of report interval statistic
    unsigned frames_ook;    ///< counter of ook demods for report interval statistic
    unsigned frames_fsk;    ///< counter of fsk demods for report interval statistic
    unsigned frames_events; ///< counter of decoder events for report interval statistic
    struct mg_mgr *mgr;
} r_cfg_t;

#endif /* INCLUDE_RTL_433_H_ */