00001 /* 00002 * SpanDSP - a series of DSP components for telephony 00003 * 00004 * private/ademco_contactid.h - Ademco ContactID alarm protocol 00005 * 00006 * Written by Steve Underwood <steveu@coppice.org> 00007 * 00008 * Copyright (C) 2012 Steve Underwood 00009 * 00010 * All rights reserved. 00011 * 00012 * This program is free software; you can redistribute it and/or modify 00013 * it under the terms of the GNU Lesser General Public License version 2.1, 00014 * as published by the Free Software Foundation. 00015 * 00016 * This program is distributed in the hope that it will be useful, 00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00019 * GNU Lesser General Public License for more details. 00020 * 00021 * You should have received a copy of the GNU Lesser General Public 00022 * License along with this program; if not, write to the Free Software 00023 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00024 */ 00025 00026 /*! \file */ 00027 00028 #if !defined(_SPANDSP_PRIVATE_ADEMCO_CONTACTID_H_) 00029 #define _SPANDSP_PRIVATE_ADEMCO_CONTACTID_H_ 00030 00031 struct ademco_contactid_receiver_state_s 00032 { 00033 ademco_contactid_report_func_t callback; 00034 void *callback_user_data; 00035 00036 int step; 00037 int remaining_samples; 00038 uint32_t tone_phase; 00039 int32_t tone_phase_rate; 00040 int16_t tone_level; 00041 dtmf_rx_state_t dtmf; 00042 00043 char rx_digits[16 + 1]; 00044 int rx_digits_len; 00045 00046 /*! \brief Error and flow logging control */ 00047 logging_state_t logging; 00048 }; 00049 00050 struct ademco_contactid_sender_state_s 00051 { 00052 tone_report_func_t callback; 00053 void *callback_user_data; 00054 00055 int step; 00056 int remaining_samples; 00057 00058 dtmf_tx_state_t dtmf; 00059 #if defined(SPANDSP_USE_FIXED_POINT) 00060 /*! Minimum acceptable tone level for detection. */ 00061 int32_t threshold; 00062 /*! The accumlating total energy on the same period over which the Goertzels work. */ 00063 int32_t energy; 00064 #else 00065 /*! Minimum acceptable tone level for detection. */ 00066 float threshold; 00067 /*! The accumlating total energy on the same period over which the Goertzels work. */ 00068 float energy; 00069 #endif 00070 goertzel_state_t tone_1400; 00071 goertzel_state_t tone_2300; 00072 /*! The current sample number within a processing block. */ 00073 int current_sample; 00074 00075 /*! \brief A buffer to save the sent message, in case we need to retry. */ 00076 char tx_digits[16 + 1]; 00077 int tx_digits_len; 00078 /*! \brief The number of consecutive retries. */ 00079 int tries; 00080 00081 int tone_state; 00082 int duration; 00083 int last_hit; 00084 int in_tone; 00085 int clear_to_send; 00086 int timer; 00087 00088 int busy; 00089 00090 /*! \brief Error and flow logging control */ 00091 logging_state_t logging; 00092 }; 00093 00094 #endif 00095 /*- End of file ------------------------------------------------------------*/
1.6.1