spandsp 3.0.0
private/data_modems.h
Go to the documentation of this file.
1/*
2 * SpanDSP - a series of DSP components for telephony
3 *
4 * private/data_modems.h - definitions for the analogue modem set for data processing
5 *
6 * Written by Steve Underwood <steveu@coppice.org>
7 *
8 * Copyright (C) 2011 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_DATA_MODEMS_H_)
29#define _SPANDSP_PRIVATE_DATA_MODEMS_H_
30
31/*!
32 The set of modems needed for data, plus the auxilliary stuff, like tone generation.
33*/
35{
36 bool calling_party;
37 /*! True is talker echo protection should be sent for the modems which support this */
38 bool use_tep;
39
40 /*! If true, transmit silence when there is nothing else to transmit. If false return only
41 the actual generated audio. Note that this only affects untimed silences. Timed silences
42 (e.g. the 75ms silence between V.21 and a high speed modem) will alway be transmitted as
43 silent audio. */
45
46 /*! \brief The number of data bits per character. */
47 int16_t data_bits;
48 /*! \brief The type of parity. */
49 int16_t parity;
50 /*! \brief The number of stop bits. */
51 int16_t stop_bits;
52
53 at_state_t at_state;
54 data_modems_control_handler_t modem_control_handler;
55 void *modem_control_user_data;
56 span_get_bit_func_t get_bit;
57 void *get_user_data;
58 span_put_bit_func_t put_bit;
59 void *put_user_data;
60
61 void *user_data;
62
63 span_put_msg_func_t put_msg;
64 span_get_msg_func_t get_msg;
65
66 v42_state_t v42;
67 v42bis_state_t v42bis;
68
69 int use_v14;
70 async_tx_state_t async_tx;
71 async_rx_state_t async_rx;
72
73 /*! \brief Samples elapsed in the current call */
74 int64_t call_samples;
75
76 union
77 {
78 v8_state_t v8;
79 struct
80 {
81 /*! \brief Tone generator */
83 /*! \brief Tone detector */
85 } tones;
86 struct
87 {
88 /*! \brief FSK transmit modem context used for 103, V.21 and V.23. */
90 /*! \brief FSK receive modem context used for 103, V.21 and V.23. */
92 } fsk;
93 /*! \brief V.22bis modem context */
95#if defined(SPANDSP_SUPPORT_V32BIS)
96 /*! \brief V.32bis modem context */
97 v32bis_state_t v32bis;
98#endif
99#if defined(SPANDSP_SUPPORT_V34)
100 /*! \brief V.22bis modem context */
101 v34_state_t v34;
102#endif
103 /*! \brief Used to insert timed silences. */
104 silence_gen_state_t silence_gen;
105 } modems;
106 /*! \brief */
107 dc_restore_state_t dc_restore;
108
109 int current_modem;
110 int queued_modem;
111 int queued_baud_rate;
112 int queued_bit_rate;
113
114 /*! \brief The currently select receiver type */
116 /*! \brief The currently select transmitter type */
118
119 /*! \brief True if a carrier is present. Otherwise false. */
121 /*! \brief True if a modem has trained correctly. */
123 /*! \brief True if an HDLC frame has been received correctly. */
125
126 /*! The current receive signal handler */
127 span_rx_handler_t rx_handler;
128 /*! The current receive missing signal fill-in handler */
129 span_rx_fillin_handler_t rx_fillin_handler;
130 void *rx_user_data;
131
132 /*! The current transmit signal handler */
133 span_tx_handler_t tx_handler;
134 void *tx_user_data;
135
136 /*! \brief Audio logging file handle for received audio. */
138 /*! \brief Audio logging file handle for transmitted audio. */
140 /*! \brief Error and flow logging control */
142};
143
144#endif
145/*- End of file ------------------------------------------------------------*/
int(* span_get_bit_func_t)(void *user_data)
Definition async.h:127
int(* span_get_msg_func_t)(void *user_data, uint8_t *msg, int max_len)
Definition async.h:111
void(* span_put_bit_func_t)(void *user_data, int bit)
Definition async.h:123
struct async_rx_state_s async_rx_state_t
Definition async.h:146
struct async_tx_state_s async_tx_state_t
Definition async.h:139
void(* span_put_msg_func_t)(void *user_data, const uint8_t *msg, int len)
Definition async.h:107
struct fsk_rx_state_s fsk_rx_state_t
Definition fsk.h:146
struct fsk_tx_state_s fsk_tx_state_t
Definition fsk.h:137
struct logging_state_s logging_state_t
Definition logging.h:72
struct modem_connect_tones_tx_state_s modem_connect_tones_tx_state_t
Definition modem_connect_tones.h:99
struct modem_connect_tones_rx_state_s modem_connect_tones_rx_state_t
Definition modem_connect_tones.h:105
Definition private/data_modems.h:35
bool rx_trained
True if a modem has trained correctly.
Definition private/data_modems.h:122
int16_t data_bits
The number of data bits per character.
Definition private/data_modems.h:47
bool rx_signal_present
True if a carrier is present. Otherwise false.
Definition private/data_modems.h:120
int audio_rx_log
Audio logging file handle for received audio.
Definition private/data_modems.h:137
silence_gen_state_t silence_gen
Used to insert timed silences.
Definition private/data_modems.h:104
logging_state_t logging
Error and flow logging control.
Definition private/data_modems.h:141
int current_rx_type
The currently select receiver type.
Definition private/data_modems.h:115
int audio_tx_log
Audio logging file handle for transmitted audio.
Definition private/data_modems.h:139
bool transmit_on_idle
Definition private/data_modems.h:44
modem_connect_tones_tx_state_t tx
Tone generator.
Definition private/data_modems.h:82
int16_t parity
The type of parity.
Definition private/data_modems.h:49
v22bis_state_t v22bis
V.22bis modem context.
Definition private/data_modems.h:94
span_rx_fillin_handler_t rx_fillin_handler
Definition private/data_modems.h:129
span_tx_handler_t tx_handler
Definition private/data_modems.h:133
int16_t stop_bits
The number of stop bits.
Definition private/data_modems.h:51
span_rx_handler_t rx_handler
Definition private/data_modems.h:127
bool use_tep
Definition private/data_modems.h:38
modem_connect_tones_rx_state_t rx
Tone detector.
Definition private/data_modems.h:84
int current_tx_type
The currently select transmitter type.
Definition private/data_modems.h:117
bool rx_frame_received
True if an HDLC frame has been received correctly.
Definition private/data_modems.h:124
int64_t call_samples
Samples elapsed in the current call.
Definition private/data_modems.h:74
Definition dc_restore.h:58
struct v22bis_state_s v22bis_state_t
Definition v22bis.h:83
struct v32bis_state_s v32bis_state_t
Definition v32bis.h:58
struct v34_state_s v34_state_t
Definition v34.h:79