spandsp 0.0.6

fax_modems.h
Go to the documentation of this file.
1/*
2 * SpanDSP - a series of DSP components for telephony
3 *
4 * fax_modems.h - definitions for the analogue modem set for fax processing
5 *
6 * Written by Steve Underwood <steveu@coppice.org>
7 *
8 * Copyright (C) 2008 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_FAX_MODEMS_H_)
29#define _SPANDSP_FAX_MODEMS_H_
30
31 enum
32{
33 FAX_MODEM_NONE = -1,
34 FAX_MODEM_FLUSH = 0,
35 FAX_MODEM_SILENCE_TX,
36 FAX_MODEM_SILENCE_RX,
37 FAX_MODEM_CED_TONE,
38 FAX_MODEM_CNG_TONE,
39 FAX_MODEM_NOCNG_TONE,
40 FAX_MODEM_V21_TX,
41 FAX_MODEM_V17_TX,
42 FAX_MODEM_V27TER_TX,
43 FAX_MODEM_V29_TX,
44 FAX_MODEM_V21_RX,
45 FAX_MODEM_V17_RX,
46 FAX_MODEM_V27TER_RX,
47 FAX_MODEM_V29_RX
48};
49
50/*!
51 The set of modems needed for FAX, plus the auxilliary stuff, like tone generation.
52*/
53 typedef struct fax_modems_state_s fax_modems_state_t;
54
55#if defined(__cplusplus)
56 extern "C"
57{
58#endif
59
60/*! Convert a FAX modem type to a short text description.
61 \brief Convert a FAX modem type to a short text description.
62 \param modem The modem code.
63 \return A pointer to the description. */
64SPAN_DECLARE(const char *) fax_modem_to_str(int modem);
65
66/* N.B. the following are currently a work in progress */
67 SPAN_DECLARE_NONSTD(int) fax_modems_v17_v21_rx(void *user_data, const int16_t amp[], int len);
68 SPAN_DECLARE_NONSTD(int) fax_modems_v27ter_v21_rx(void *user_data, const int16_t amp[], int len);
69 SPAN_DECLARE_NONSTD(int) fax_modems_v29_v21_rx(void *user_data, const int16_t amp[], int len);
70 SPAN_DECLARE_NONSTD(int) fax_modems_v17_v21_rx_fillin(void *user_data, int len);
71 SPAN_DECLARE_NONSTD(int) fax_modems_v27ter_v21_rx_fillin(void *user_data, int len);
72 SPAN_DECLARE_NONSTD(int) fax_modems_v29_v21_rx_fillin(void *user_data, int len);
73
74 SPAN_DECLARE_NONSTD(void) fax_modems_hdlc_tx_frame(void *user_data, const uint8_t *msg, int len);
75
76SPAN_DECLARE(void) fax_modems_start_rx_modem(fax_modems_state_t *s, int which);
77
78SPAN_DECLARE(void) fax_modems_set_tep_mode(fax_modems_state_t *s, int use_tep);
79
80SPAN_DECLARE(int) fax_modems_restart(fax_modems_state_t *s);
81
82/*! Get a pointer to the logging context associated with a FAX modems context.
83 \brief Get a pointer to the logging context associated with a FAX modems context.
84 \param s The FAX modems context.
85 \return A pointer to the logging context, or NULL.
86*/
87SPAN_DECLARE(logging_state_t *) fax_modems_get_logging_state(fax_modems_state_t *s);
88
89SPAN_DECLARE(fax_modems_state_t *) fax_modems_init(fax_modems_state_t *s,
90 int use_tep,
91 hdlc_frame_handler_t hdlc_accept,
92 hdlc_underflow_handler_t hdlc_tx_underflow,
93 put_bit_func_t non_ecm_put_bit,
94 get_bit_func_t non_ecm_get_bit,
95 tone_report_func_t tone_callback,
96 void *user_data);
97
98SPAN_DECLARE(int) fax_modems_release(fax_modems_state_t *s);
99
100SPAN_DECLARE(int) fax_modems_free(fax_modems_state_t *s);
101
102#if defined(__cplusplus)
103}
104#endif
105
106#endif
107/*- End of file ------------------------------------------------------------*/
put_bit_func_t
void(* put_bit_func_t)(void *user_data, int bit)
Definition async.h:105
SPAN_DECLARE_NONSTD
SPAN_DECLARE_NONSTD(void) async_rx_put_bit(void *user_data
Accept a bit from a received serial bit stream.
get_bit_func_t
int(* get_bit_func_t)(void *user_data)
Definition async.h:108
fax_modems_get_logging_state
logging_state_t * fax_modems_get_logging_state(fax_modems_state_t *s)
Get a pointer to the logging context associated with a FAX modems context.
Definition fax_modems.c:323
fax_modem_to_str
const char * fax_modem_to_str(int modem)
Convert a FAX modem type to a short text description.
Definition fax_modems.c:89
fax_modems_state_t
struct fax_modems_state_s fax_modems_state_t
Definition fax_modems.h:53
logging_state_t
struct logging_state_s logging_state_t
Definition logging.h:75
fax_modems_state_s
Definition private/fax_modems.h:35