- Merged with upstream version
[rtl-433.git] / include / rtl_433.h~
1 #ifndef INCLUDE_RTL_433_H_
2 #define INCLUDE_RTL_433_H_
3
4 #include <errno.h>
5 #include <signal.h>
6 #include <string.h>
7 #include <stdio.h>
8 #include <stdlib.h>
9 #include <time.h>
10 #include <stdint.h>
11
12 #ifndef _WIN32
13 #include <unistd.h>
14 #else
15 #include <Windows.h>
16 #include <io.h>
17 #include <fcntl.h>
18 #include "getopt/getopt.h"
19 #endif
20
21 #define DEFAULT_SAMPLE_RATE     250000
22 #define DEFAULT_FREQUENCY       433920000
23 #define DEFAULT_HOP_TIME        (60*10)
24 #define DEFAULT_HOP_EVENTS      2
25 #define DEFAULT_ASYNC_BUF_NUMBER    32
26 #define DEFAULT_BUF_LENGTH      (16 * 16384)
27 #define DEFAULT_LEVEL_LIMIT     10000
28 #define DEFAULT_DECIMATION_LEVEL 0
29 #define MINIMAL_BUF_LENGTH      512
30 #define MAXIMAL_BUF_LENGTH      (256 * 16384)
31 #define FILTER_ORDER            1
32 #define MAX_PROTOCOLS           15
33 #define SIGNAL_GRABBER_BUFFER   (12 * DEFAULT_BUF_LENGTH)
34 #define BITBUF_COLS             34
35 #define BITBUF_ROWS             50
36
37 /* Supported modulation types */
38 #define     OOK_PWM_D           1   /* Pulses are of the same length, the distance varies */
39 #define     OOK_PWM_P           2   /* The length of the pulses varies */
40 #define     OOK_MANCHESTER      3       /* Manchester code */
41
42 typedef struct {
43     unsigned int    id;
44     char            name[256];
45     unsigned int    modulation;
46     unsigned int    short_limit;
47     unsigned int    long_limit;
48     unsigned int    reset_limit;
49     int     (*json_callback)(uint8_t bits_buffer[BITBUF_ROWS][BITBUF_COLS],int16_t bits_per_row[BITBUF_ROWS]) ;
50 } r_device;
51
52 extern int debug_output;
53 int debug_callback(uint8_t buffer[BITBUF_ROWS][BITBUF_COLS], int16_t bits_per_row[BITBUF_ROWS]);
54
55 #endif /* INCLUDE_RTL_433_H_ */