spandsp
3.0.0
|
#include <inttypes.h>
#include <stdlib.h>
#include <stdio.h>
#include <fcntl.h>
#include <time.h>
#include <memory.h>
#include <string.h>
#include <ctype.h>
#include "spandsp/stdbool.h"
#include "floating_fudge.h"
#include <assert.h>
#include <tiffio.h>
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/logging.h"
#include "spandsp/bit_operations.h"
#include "spandsp/bitstream.h"
#include "spandsp/dc_restore.h"
#include "spandsp/queue.h"
#include "spandsp/power_meter.h"
#include "spandsp/complex.h"
#include "spandsp/tone_detect.h"
#include "spandsp/tone_generate.h"
#include "spandsp/async.h"
#include "spandsp/crc.h"
#include "spandsp/hdlc.h"
#include "spandsp/vector_int.h"
#include "spandsp/silence_gen.h"
#include "spandsp/super_tone_rx.h"
#include "spandsp/fsk.h"
#include "spandsp/modem_connect_tones.h"
#include "spandsp/v8.h"
#include "spandsp/v29tx.h"
#include "spandsp/v29rx.h"
#include "spandsp/v27ter_tx.h"
#include "spandsp/v27ter_rx.h"
#include "spandsp/v17tx.h"
#include "spandsp/v17rx.h"
#include "spandsp/timezone.h"
#include "spandsp/t4_rx.h"
#include "spandsp/t4_tx.h"
#include "spandsp/t30.h"
#include "spandsp/t30_logging.h"
#include "spandsp/t38_core.h"
#include "spandsp/at_interpreter.h"
#include "spandsp/fax_modems.h"
#include "spandsp/t31.h"
#include "spandsp/t30_fcf.h"
#include "spandsp/private/logging.h"
#include "spandsp/private/bitstream.h"
#include "spandsp/private/t38_core.h"
#include "spandsp/private/silence_gen.h"
#include "spandsp/private/power_meter.h"
#include "spandsp/private/fsk.h"
#include "spandsp/private/modem_connect_tones.h"
#include "spandsp/private/v8.h"
#include "spandsp/private/v17tx.h"
#include "spandsp/private/v17rx.h"
#include "spandsp/private/v27ter_tx.h"
#include "spandsp/private/v27ter_rx.h"
#include "spandsp/private/v29tx.h"
#include "spandsp/private/v29rx.h"
#include "spandsp/private/hdlc.h"
#include "spandsp/private/fax_modems.h"
#include "spandsp/private/at_interpreter.h"
#include "spandsp/private/t31.h"
Macros | |
#define | US_PER_TX_CHUNK 30000 |
#define | INDICATOR_TX_COUNT 3 |
#define | DATA_TX_COUNT 1 |
#define | DATA_END_TX_COUNT 3 |
#define | DEFAULT_DTE_TIMEOUT 5 |
#define | MAX_OCTETS_PER_UNPACED_CHUNK 300 |
#define | MID_RX_TIMEOUT 15000 |
#define | HDLC_FRAMING_OK_THRESHOLD 5 |
Typedefs | |
typedef const char *(* | at_cmd_service_t) (t31_state_t *s, const char *cmd) |
Functions | |
int | t31_t38_send_timeout (t31_state_t *s, int samples) |
void | t31_call_event (t31_state_t *s, int event) |
int | t31_at_rx_free_space (t31_state_t *s) |
Return the amount of free space in the AT COMMAND BUFFER. More... | |
int | t31_at_rx (t31_state_t *s, const char *t, int len) |
int | t31_rx (t31_state_t *s, int16_t amp[], int len) |
Process a block of received T.31 modem audio samples. More... | |
int | t31_rx_fillin (t31_state_t *s, int len) |
Fake processing of a missing block of received T.31 modem audio samples. More... | |
int | t31_tx (t31_state_t *s, int16_t amp[], int max_len) |
Generate a block of T.31 modem audio samples. More... | |
void | t31_set_transmit_on_idle (t31_state_t *s, bool transmit_on_idle) |
Select whether silent audio will be sent when transmit is idle. More... | |
void | t31_set_tep_mode (t31_state_t *s, bool use_tep) |
Select whether TEP mode will be used. More... | |
void | t31_set_t38_config (t31_state_t *s, bool without_pacing) |
Select whether T.38 data will be paced. More... | |
void | t31_set_mode (t31_state_t *s, bool t38_mode) |
Set audio or T.38 mode. More... | |
logging_state_t * | t31_get_logging_state (t31_state_t *s) |
Get a pointer to the logging context associated with a T.31 context. More... | |
at_state_t * | t31_get_at_state (t31_state_t *s) |
Get a pointer to the AT interpreter context associated with a T.31 context. More... | |
t38_core_state_t * | t31_get_t38_core_state (t31_state_t *s) |
Get a pointer to the T.38 core context associated with a T.31 context. More... | |
t31_state_t * | t31_init (t31_state_t *s, at_tx_handler_t at_tx_handler, void *at_tx_user_data, t31_modem_control_handler_t modem_control_handler, void *modem_control_user_data, t38_tx_packet_handler_t tx_t38_packet_handler, void *tx_t38_packet_user_data) |
Initialise a T.31 context. More... | |
int | t31_release (t31_state_t *s) |
Release a T.31 context. More... | |
int | t31_free (t31_state_t *s) |
Release a T.31 context. More... | |
#define DATA_END_TX_COUNT 3 |
The number of transmissions of terminating data IFP packets
#define DATA_TX_COUNT 1 |
The number of transmissions of data IFP packets
#define DEFAULT_DTE_TIMEOUT 5 |
The default DTE timeout, in seconds
#define INDICATOR_TX_COUNT 3 |
The number of transmissions of indicator IFP packets
#define US_PER_TX_CHUNK 30000 |
The default number of milliseconds per transmitted IFP when sending bulk T.38 data
int t31_at_rx_free_space | ( | t31_state_t * | s | ) |
Return the amount of free space in the AT COMMAND BUFFER.
Return the amount of free space in the AT COMMAND BUFFER.
s | The T.31 modem context. |
References t31_state_s::in_bytes, t31_state_s::non_ecm_tx, and t31_state_s::out_bytes.
int t31_free | ( | t31_state_t * | s | ) |
Release a T.31 context.
Free a T.31 context.
s | The T.31 context. |
References t31_release().
at_state_t* t31_get_at_state | ( | t31_state_t * | s | ) |
Get a pointer to the AT interpreter context associated with a T.31 context.
Get a pointer to the AT interpreter context associated with a T.31 context.
s | The T.31 context. |
logging_state_t* t31_get_logging_state | ( | t31_state_t * | s | ) |
Get a pointer to the logging context associated with a T.31 context.
Get a pointer to the logging context associated with a T.31 context.
s | The T.31 context. |
References t31_state_s::logging.
t38_core_state_t* t31_get_t38_core_state | ( | t31_state_t * | s | ) |
Get a pointer to the T.38 core context associated with a T.31 context.
Get a pointer to the T.38 core context associated with a T.31 context.
s | The T.31 context. |
References t31_t38_front_end_state_t::t38.
t31_state_t* t31_init | ( | t31_state_t * | s, |
at_tx_handler_t | at_tx_handler, | ||
void * | at_tx_user_data, | ||
t31_modem_control_handler_t | modem_control_handler, | ||
void * | modem_control_user_data, | ||
t38_tx_packet_handler_t | tx_t38_packet_handler, | ||
void * | tx_t38_packet_user_data | ||
) |
Initialise a T.31 context.
Initialise a T.31 context. This must be called before the first use of the context, to initialise its contents.
s | The T.31 context. |
at_tx_handler | A callback routine to handle AT interpreter channel output. |
at_tx_user_data | An opaque pointer passed in called to at_tx_handler. |
modem_control_handler | A callback routine to handle control of the modem (off-hook, etc). |
modem_control_user_data | An opaque pointer passed in called to modem_control_handler. |
tx_t38_packet_handler | ??? |
tx_t38_packet_user_data | ??? |
int t31_release | ( | t31_state_t * | s | ) |
Release a T.31 context.
Release a T.31 context.
s | The T.31 context. |
Referenced by t31_free().
int t31_rx | ( | t31_state_t * | s, |
int16_t | amp[], | ||
int | len | ||
) |
Process a block of received T.31 modem audio samples.
Process a block of received T.31 modem audio samples.
s | The T.31 modem context. |
amp | The audio sample buffer. |
len | The number of samples in the buffer. |
int t31_rx_fillin | ( | t31_state_t * | s, |
int | len | ||
) |
Fake processing of a missing block of received T.31 modem audio samples.
Fake processing of a missing block of received T.31 modem audio samples (e.g due to packet loss).
s | The T.31 modem context. |
len | The number of samples to fake. |
References t31_state_s::call_samples.
void t31_set_mode | ( | t31_state_t * | s, |
bool | t38_mode | ||
) |
Set audio or T.38 mode.
Set audio or T.38 mode.
s | The T.31 modem context. |
t38_mode | True for T.38 mode operation. False for audio mode operation. |
void t31_set_t38_config | ( | t31_state_t * | s, |
bool | without_pacing | ||
) |
Select whether T.38 data will be paced.
Select whether T.38 data will be paced as it is transmitted.
s | The T.31 modem context. |
without_pacing | True if data is to be sent as fast as possible. False if it is to be paced. |
References DATA_END_TX_COUNT, DATA_TX_COUNT, INDICATOR_TX_COUNT, t31_t38_front_end_state_t::t38, T38_PACKET_CATEGORY_CONTROL_DATA, T38_PACKET_CATEGORY_CONTROL_DATA_END, T38_PACKET_CATEGORY_IMAGE_DATA, T38_PACKET_CATEGORY_IMAGE_DATA_END, T38_PACKET_CATEGORY_INDICATOR, t38_set_redundancy_control(), t31_t38_front_end_state_t::us_per_tx_chunk, and US_PER_TX_CHUNK.
void t31_set_tep_mode | ( | t31_state_t * | s, |
bool | use_tep | ||
) |
Select whether TEP mode will be used.
Select whether TEP mode will be used (or time allowed for it (when transmitting).
s | The T.31 modem context. |
use_tep | True if TEP is to be used. |
References fax_modems_state_s::use_tep.
void t31_set_transmit_on_idle | ( | t31_state_t * | s, |
bool | transmit_on_idle | ||
) |
Select whether silent audio will be sent when transmit is idle.
Select whether silent audio will be sent when transmit is idle.
s | The T.31 modem context. |
transmit_on_idle | True if silent audio should be output when the transmitter is idle. False to transmit zero length audio when the transmitter is idle. The default behaviour is false. |
References fax_modems_state_s::transmit_on_idle.
int t31_tx | ( | t31_state_t * | s, |
int16_t | amp[], | ||
int | max_len | ||
) |
Generate a block of T.31 modem audio samples.
Generate a block of T.31 modem audio samples.
s | The T.31 modem context. |
amp | The audio sample buffer. |
max_len | The number of samples to be generated. |