spandsp  0.0.6
private/v18.h
1 /*
2  * SpanDSP - a series of DSP components for telephony
3  *
4  * private/v18.h - V.18 text telephony for the deaf.
5  *
6  * Written by Steve Underwood <steveu@coppice.org>
7  *
8  * Copyright (C) 2004-2009 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 #if !defined(_SPANDSP_PRIVATE_V18_H_)
27 #define _SPANDSP_PRIVATE_V18_H_
28 
30 {
31  /*! \brief TRUE if we are the calling modem */
33  int mode;
34  put_msg_func_t put_msg;
35  void *user_data;
36 
37  union
38  {
39  queue_state_t queue;
40  uint8_t buf[QUEUE_STATE_T_SIZE(128)];
41  } queue;
42  tone_gen_descriptor_t alert_tone_desc;
43  tone_gen_state_t alert_tone_gen;
44  fsk_tx_state_t fsktx;
45  dtmf_tx_state_t dtmftx;
46  async_tx_state_t asynctx;
47  int baudot_tx_shift;
48  int tx_signal_on;
49  int byte_no;
50 
51  fsk_rx_state_t fskrx;
52  dtmf_rx_state_t dtmfrx;
53  int baudot_rx_shift;
54  int consecutive_ones;
55  uint8_t rx_msg[256 + 1];
56  int rx_msg_len;
57  int bit_pos;
58  int in_progress;
59 
60  /*! \brief Error and flow logging control */
62 };
63 
64 #endif
65 /*- End of file ------------------------------------------------------------*/
v18_encode_dtmf
int v18_encode_dtmf(v18_state_t *s, char dtmf[], const char msg[])
Convert a text string to a V.18 DTMF string.
Definition: v18.c:387
tone_generate.h
dtmf_rx_init
dtmf_rx_state_t * dtmf_rx_init(dtmf_rx_state_t *s, digits_rx_callback_t callback, void *user_data)
Initialise a DTMF receiver context.
Definition: dtmf.c:407
v18_mode_to_str
const char * v18_mode_to_str(int mode)
Return a short name for an V.18 mode.
Definition: v18.c:915
queue_state_s
Definition: private/queue.h:34
BAUDOT_LETTER_SHIFT
#define BAUDOT_LETTER_SHIFT
Definition: v18.c:124
modem_connect_tones.h
QUEUE_WRITE_ATOMIC
#define QUEUE_WRITE_ATOMIC
Definition: queue.h:48
v18_init
v18_state_t * v18_init(v18_state_t *s, int calling_party, int mode, put_msg_func_t put_msg, void *user_data)
Initialise a V.18 context.
Definition: v18.c:826
SIG_STATUS_CARRIER_UP
@ SIG_STATUS_CARRIER_UP
The carrier signal is up. This merely indicates that carrier energy has been seen....
Definition: async.h:58
v18_state_s
Definition: private/v18.h:30
async.h
dtmf_tx
int dtmf_tx(dtmf_tx_state_t *s, int16_t amp[], int max_samples)
Generate a buffer of DTMF tones.
Definition: dtmf.c:501
v18_free
int v18_free(v18_state_t *s)
Release a V.18 context.
Definition: v18.c:908
v18.h
signal_status_to_str
const char * signal_status_to_str(int status)
Convert a signal status to a short text description.
Definition: async.c:42
SPAN_DECLARE_NONSTD
SPAN_DECLARE_NONSTD(int) async_tx_get_bit(void *user_data)
Get the next bit of a transmitted serial bit stream.
queue_read_byte
int queue_read_byte(queue_state_t *s)
Read a byte from a queue.
Definition: queue.c:188
complex.h
ASYNC_PARITY_EVEN
@ ASYNC_PARITY_EVEN
Definition: async.h:135
v18_state_s::logging
logging_state_t logging
Error and flow logging control.
Definition: private/v18.h:61
v18_put
int v18_put(v18_state_t *s, const char msg[], int len)
Put a string to a V.18 context's input buffer.
Definition: v18.c:779
async_tx_state_s
Definition: private/async.h:35
ASYNC_PARITY_NONE
@ ASYNC_PARITY_NONE
Definition: async.h:133
queue_init
queue_state_t * queue_init(queue_state_t *s, int len, int flags)
Initialise a queue.
Definition: queue.c:394
SIG_STATUS_CARRIER_DOWN
@ SIG_STATUS_CARRIER_DOWN
The carrier signal has dropped.
Definition: async.h:54
v18_decode_dtmf
int v18_decode_dtmf(v18_state_t *s, char msg[], const char dtmf[])
Convert a V.18 DTMF string to a text string.
Definition: v18.c:408
queue.h
tone_gen_descriptor_s
Definition: private/tone_generate.h:43
span_log
int span_log(logging_state_t *s, int level, const char *format,...)
Generate a log entry.
Definition: logging.c:84
dtmf_to_ascii_s
Definition: v18.c:127
v18_state_s::calling_party
int calling_party
TRUE if we are the calling modem.
Definition: private/v18.h:32
dtmf_tx_init
dtmf_tx_state_t * dtmf_tx_init(dtmf_tx_state_t *s)
Initialise a DTMF tone generator context.
Definition: dtmf.c:565
v18_release
int v18_release(v18_state_t *s)
Release a V.18 context.
Definition: v18.c:902
fsk_rx_init
fsk_rx_state_t * fsk_rx_init(fsk_rx_state_t *s, const fsk_spec_t *spec, int framing_mode, put_bit_func_t put_bit, void *user_data)
Initialise an FSK modem receive context.
Definition: fsk.c:314
async_tx_init
async_tx_state_t * async_tx_init(async_tx_state_t *s, int data_bits, int parity, int stop_bits, int use_v14, get_byte_func_t get_byte, void *user_data)
Initialise an asynchronous data transmit context.
Definition: async.c:208
queue_write
int queue_write(queue_state_t *s, const uint8_t *buf, int len)
Write bytes to a queue.
Definition: queue.c:214
fsk_tx_init
fsk_tx_state_t * fsk_tx_init(fsk_tx_state_t *s, const fsk_spec_t *spec, get_bit_func_t get_bit, void *user_data)
Initialise an FSK modem transmit context.
Definition: fsk.c:153
fsk.h
QUEUE_READ_ATOMIC
#define QUEUE_READ_ATOMIC
Definition: queue.h:45
logging.h
BAUDOT_FIGURE_SHIFT
#define BAUDOT_FIGURE_SHIFT
Definition: v18.c:122
v8.h
put_msg_func_t
void(* put_msg_func_t)(void *user_data, const uint8_t *msg, int len)
Definition: async.h:93
dtmf_rx_state_s
Definition: private/dtmf.h:51
fsk_tx_state_s
Definition: private/fsk.h:34
tone_gen_state_s
Definition: private/tone_generate.h:54
dtmf_tx_state_s
Definition: private/dtmf.h:34
dtmf_rx
int dtmf_rx(dtmf_rx_state_t *s, const int16_t amp[], int samples)
Process a block of received DTMF audio samples.
Definition: dtmf.c:102
logging_state_s
Definition: private/logging.h:34
modem_connect_tones.h
fsk_rx_state_s
Definition: private/fsk.h:59
dds.h