private/fax_modems.h

Go to the documentation of this file.
00001 /*
00002  * SpanDSP - a series of DSP components for telephony
00003  *
00004  * private/fax_modems.h - definitions for the analogue modem set for fax processing
00005  *
00006  * Written by Steve Underwood <steveu@coppice.org>
00007  *
00008  * Copyright (C) 2008 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_FAX_MODEMS_H_)
00029 #define _SPANDSP_PRIVATE_FAX_MODEMS_H_
00030 
00031 /*!
00032     The set of modems needed for FAX, plus the auxilliary stuff, like tone generation.
00033 */
00034 struct fax_modems_state_s
00035 {
00036     /*! TRUE is talker echo protection should be sent for the image modems */
00037     int use_tep;
00038 
00039     /*! If TRUE, transmit silence when there is nothing else to transmit. If FALSE return only
00040         the actual generated audio. Note that this only affects untimed silences. Timed silences
00041         (e.g. the 75ms silence between V.21 and a high speed modem) will alway be transmitted as
00042         silent audio. */
00043     int transmit_on_idle;
00044 
00045     /*! \brief An HDLC context used when transmitting HDLC messages. */
00046     hdlc_tx_state_t hdlc_tx;
00047     /*! \brief An HDLC context used when receiving HDLC messages. */
00048     hdlc_rx_state_t hdlc_rx;
00049     /*! \brief A V.21 FSK modem context used when transmitting HDLC over V.21
00050                messages. */
00051     fsk_tx_state_t v21_tx;
00052     /*! \brief A V.21 FSK modem context used when receiving HDLC over V.21
00053                messages. */
00054     fsk_rx_state_t v21_rx;
00055     /*! \brief A V.17 modem context used when sending FAXes at 7200bps, 9600bps
00056                12000bps or 14400bps */
00057     v17_tx_state_t v17_tx;
00058     /*! \brief A V.29 modem context used when receiving FAXes at 7200bps, 9600bps
00059                12000bps or 14400bps */
00060     v17_rx_state_t v17_rx;
00061     /*! \brief A V.29 modem context used when sending FAXes at 7200bps or
00062                9600bps */
00063     v29_tx_state_t v29_tx;
00064     /*! \brief A V.29 modem context used when receiving FAXes at 7200bps or
00065                9600bps */
00066     v29_rx_state_t v29_rx;
00067     /*! \brief A V.27ter modem context used when sending FAXes at 2400bps or
00068                4800bps */
00069     v27ter_tx_state_t v27ter_tx;
00070     /*! \brief A V.27ter modem context used when receiving FAXes at 2400bps or
00071                4800bps */
00072     v27ter_rx_state_t v27ter_rx;
00073     /*! \brief Used to insert timed silences. */
00074     silence_gen_state_t silence_gen;
00075     /*! \brief CED or CNG generator */
00076     modem_connect_tones_tx_state_t connect_tx;
00077     /*! \brief CED or CNG detector */
00078     modem_connect_tones_rx_state_t connect_rx;
00079     /*! \brief */
00080     dc_restore_state_t dc_restore;
00081 
00082     /*! \brief The currently select receiver type */
00083     int current_rx_type;
00084     /*! \brief The currently select transmitter type */
00085     int current_tx_type;
00086 
00087     /*! \brief TRUE if a carrier is present. Otherwise FALSE. */
00088     int rx_signal_present;
00089     /*! \brief TRUE if a modem has trained correctly. */
00090     int rx_trained;
00091     /*! \brief TRUE if an HDLC frame has been received correctly. */
00092     int rx_frame_received;
00093 
00094     /*! The current receive signal handler */
00095     span_rx_handler_t *rx_handler;
00096     /*! The current receive missing signal fill-in handler */
00097     span_rx_fillin_handler_t *rx_fillin_handler;
00098     void *rx_user_data;
00099 
00100     /*! The current transmit signal handler */
00101     span_tx_handler_t *tx_handler;
00102     void *tx_user_data;
00103 
00104     /*! The next transmit signal handler, for two stage transmit operations.
00105         E.g. a short silence followed by a modem signal. */
00106     span_tx_handler_t *next_tx_handler;
00107     void *next_tx_user_data;
00108 
00109     /*! The current bit rate of the transmitter. */
00110     int tx_bit_rate;
00111     /*! The current bit rate of the receiver. */
00112     int rx_bit_rate;
00113 
00114     /*! If TRUE, transmission is in progress */
00115     int transmit;
00116     /*! \brief Audio logging file handle for received audio. */
00117     int audio_rx_log;
00118     /*! \brief Audio logging file handle for transmitted audio. */
00119     int audio_tx_log;
00120     /*! \brief Error and flow logging control */
00121     logging_state_t logging;
00122 };
00123 
00124 #endif
00125 /*- End of file ------------------------------------------------------------*/