spandsp  3.0.0
modem_connect_tones.c File Reference
#include <inttypes.h>
#include <stdlib.h>
#include <memory.h>
#include "spandsp/stdbool.h"
#include "floating_fudge.h"
#include <stdio.h>
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/fast_convert.h"
#include "spandsp/logging.h"
#include "spandsp/complex.h"
#include "spandsp/dds.h"
#include "spandsp/tone_detect.h"
#include "spandsp/tone_generate.h"
#include "spandsp/super_tone_rx.h"
#include "spandsp/power_meter.h"
#include "spandsp/async.h"
#include "spandsp/fsk.h"
#include "spandsp/modem_connect_tones.h"
#include "spandsp/private/power_meter.h"
#include "spandsp/private/fsk.h"
#include "spandsp/private/modem_connect_tones.h"

Macros

#define HDLC_FRAMING_OK_THRESHOLD   5
 

Functions

const char * modem_connect_tone_to_str (int tone)
 
int modem_connect_tones_tx (modem_connect_tones_tx_state_t *s, int16_t amp[], int len)
 Generate a block of modem connect tones samples. More...
 
modem_connect_tones_tx_state_tmodem_connect_tones_tx_init (modem_connect_tones_tx_state_t *s, int tone_type)
 Initialise an instance of the modem connect tones generator. More...
 
int modem_connect_tones_tx_release (modem_connect_tones_tx_state_t *s)
 Release an instance of the modem connect tones generator. More...
 
int modem_connect_tones_tx_free (modem_connect_tones_tx_state_t *s)
 Free an instance of the modem connect tones generator. More...
 
int modem_connect_tones_rx (modem_connect_tones_rx_state_t *s, const int16_t amp[], int len)
 Process a block of samples through an instance of the modem connect tones detector. More...
 
int modem_connect_tones_rx_fillin (modem_connect_tones_rx_state_t *s, int len)
 Fake processing of a missing block of received modem connect tone samples. More...
 
int modem_connect_tones_rx_get (modem_connect_tones_rx_state_t *s)
 Test if a modem_connect tone has been detected. More...
 
modem_connect_tones_rx_state_tmodem_connect_tones_rx_init (modem_connect_tones_rx_state_t *s, int tone_type, tone_report_func_t tone_callback, void *user_data)
 Initialise an instance of the modem connect tones detector. More...
 
int modem_connect_tones_rx_release (modem_connect_tones_rx_state_t *s)
 Release an instance of the modem connect tones detector. More...
 
int modem_connect_tones_rx_free (modem_connect_tones_rx_state_t *s)
 Free an instance of the modem connect tones detector. More...
 

Function Documentation

int modem_connect_tones_rx ( modem_connect_tones_rx_state_t s,
const int16_t  amp[],
int  len 
)

Process a block of samples through an instance of the modem connect tones detector.

Parameters
sThe context.
ampAn array of signal samples.
lenThe number of samples in the array.
Returns
The number of unprocessed samples.

References fsk_rx(), MODEM_CONNECT_TONES_ANS, MODEM_CONNECT_TONES_ANS_PR, MODEM_CONNECT_TONES_ANSAM, MODEM_CONNECT_TONES_ANSAM_PR, MODEM_CONNECT_TONES_BELL_ANS, MODEM_CONNECT_TONES_CALLING_TONE, MODEM_CONNECT_TONES_FAX_CED_OR_PREAMBLE, MODEM_CONNECT_TONES_FAX_CNG, MODEM_CONNECT_TONES_FAX_PREAMBLE, and MODEM_CONNECT_TONES_NONE.

Referenced by v8_rx().

int modem_connect_tones_rx_fillin ( modem_connect_tones_rx_state_t s,
int  len 
)

Fake processing of a missing block of received modem connect tone samples.

Fake processing of a missing block of received modem connect tone samples (e.g due to packet loss).

Parameters
sThe context.
lenThe number of samples to fake.
Returns
The number of samples unprocessed.
int modem_connect_tones_rx_free ( modem_connect_tones_rx_state_t s)

Free an instance of the modem connect tones detector.

Parameters
sThe context.
Returns
0 for OK, else -1.
int modem_connect_tones_rx_get ( modem_connect_tones_rx_state_t s)

Test if a modem_connect tone has been detected.

Parameters
sThe context.
Returns
The code for the detected tone.

References MODEM_CONNECT_TONES_NONE.

Referenced by v8_rx().

modem_connect_tones_rx_state_t* modem_connect_tones_rx_init ( modem_connect_tones_rx_state_t s,
int  tone_type,
tone_report_func_t  tone_callback,
void *  user_data 
)

Initialise an instance of the modem connect tones detector.

Parameters
sThe context.
tone_typeThe type of connect tone being tested for.
tone_callbackAn optional callback routine, used to report tones
user_dataAn opaque pointer passed to the callback routine,
Returns
A pointer to the context.

References fsk_rx_init(), fsk_rx_signal_cutoff(), MODEM_CONNECT_TONES_ANS, MODEM_CONNECT_TONES_ANS_PR, MODEM_CONNECT_TONES_ANSAM, MODEM_CONNECT_TONES_ANSAM_PR, MODEM_CONNECT_TONES_FAX_CED_OR_PREAMBLE, MODEM_CONNECT_TONES_FAX_PREAMBLE, and MODEM_CONNECT_TONES_NONE.

int modem_connect_tones_rx_release ( modem_connect_tones_rx_state_t s)

Release an instance of the modem connect tones detector.

Parameters
sThe context.
Returns
0 for OK, else -1.
int modem_connect_tones_tx ( modem_connect_tones_tx_state_t s,
int16_t  amp[],
int  len 
)

Generate a block of modem connect tones samples.

Parameters
sThe context.
ampAn array of signal samples.
lenThe number of samples to generate.
Returns
The number of samples generated.

References dds_mod(), MODEM_CONNECT_TONES_ANS, MODEM_CONNECT_TONES_ANS_PR, MODEM_CONNECT_TONES_ANSAM, MODEM_CONNECT_TONES_ANSAM_PR, MODEM_CONNECT_TONES_BELL_ANS, MODEM_CONNECT_TONES_CALLING_TONE, and MODEM_CONNECT_TONES_FAX_CNG.

Referenced by v8_tx().

int modem_connect_tones_tx_free ( modem_connect_tones_tx_state_t s)

Free an instance of the modem connect tones generator.

Parameters
sThe context.
Returns
0 for OK, else -1.
int modem_connect_tones_tx_release ( modem_connect_tones_tx_state_t s)

Release an instance of the modem connect tones generator.

Parameters
sThe context.
Returns
0 for OK, else -1.