spandsp 0.0.6

private/ademco_contactid.h
Go to the documentation of this file.
1/*
2 * SpanDSP - a series of DSP components for telephony
3 *
4 * private/ademco_contactid.h - Ademco ContactID alarm protocol
5 *
6 * Written by Steve Underwood <steveu@coppice.org>
7 *
8 * Copyright (C) 2012 Steve Underwood
9 *
10 * All rights reserved.
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 2.1,
14 * as published by the Free Software Foundation.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License for more details.
20 *
21 * You should have received a copy of the GNU Lesser General Public
22 * License along with this program; if not, write to the Free Software
23 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 */
25
26/*! \file */
27
28#if !defined(_SPANDSP_PRIVATE_ADEMCO_CONTACTID_H_)
29#define _SPANDSP_PRIVATE_ADEMCO_CONTACTID_H_
30
31 struct ademco_contactid_receiver_state_s
32{
33 ademco_contactid_report_func_t callback;
34 void *callback_user_data;
35
36 int step;
37 int remaining_samples;
38 uint32_t tone_phase;
39 int32_t tone_phase_rate;
40 int16_t tone_level;
41 dtmf_rx_state_t dtmf;
42
43 char rx_digits[16 + 1];
44 int rx_digits_len;
45
46 /*! \brief Error and flow logging control */
47 logging_state_t logging;
48};
49
50 struct ademco_contactid_sender_state_s
51{
52 tone_report_func_t callback;
53 void *callback_user_data;
54
55 int step;
56 int remaining_samples;
57
58 dtmf_tx_state_t dtmf;
59#if defined(SPANDSP_USE_FIXED_POINT)
60 /*! Minimum acceptable tone level for detection. */
61 int32_t threshold;
62 /*! The accumlating total energy on the same period over which the Goertzels work. */
63 int32_t energy;
64#else
65 /*! Minimum acceptable tone level for detection. */
66 float threshold;
67 /*! The accumlating total energy on the same period over which the Goertzels work. */
68 float energy;
69#endif
70 goertzel_state_t tone_1400;
71 goertzel_state_t tone_2300;
72 /*! The current sample number within a processing block. */
73 int current_sample;
74
75 /*! \brief A buffer to save the sent message, in case we need to retry. */
76 char tx_digits[16 + 1];
77 int tx_digits_len;
78 /*! \brief The number of consecutive retries. */
79 int tries;
80
81 int tone_state;
82 int duration;
83 int last_hit;
84 int in_tone;
85 int clear_to_send;
86 int timer;
87
88 int busy;
89
90 /*! \brief Error and flow logging control */
91 logging_state_t logging;
92};
93
94#endif
95/*- End of file ------------------------------------------------------------*/
logging_state_t
struct logging_state_s logging_state_t
Definition logging.h:75
ademco_contactid_receiver_state_s
Definition private/ademco_contactid.h:32
ademco_contactid_receiver_state_s::logging
logging_state_t logging
Error and flow logging control.
Definition private/ademco_contactid.h:47
ademco_contactid_sender_state_s
Definition private/ademco_contactid.h:51
ademco_contactid_sender_state_s::tx_digits
char tx_digits[16+1]
A buffer to save the sent message, in case we need to retry.
Definition private/ademco_contactid.h:76
ademco_contactid_sender_state_s::energy
float energy
Definition private/ademco_contactid.h:68
ademco_contactid_sender_state_s::logging
logging_state_t logging
Error and flow logging control.
Definition private/ademco_contactid.h:91
ademco_contactid_sender_state_s::tries
int tries
The number of consecutive retries.
Definition private/ademco_contactid.h:79
ademco_contactid_sender_state_s::threshold
float threshold
Definition private/ademco_contactid.h:66
ademco_contactid_sender_state_s::current_sample
int current_sample
Definition private/ademco_contactid.h:73