modem_connect_tones.c File Reference
`#include <inttypes.h>`
`#include <stdlib.h>`
`#include <memory.h>`
`#include "floating_fudge.h"`
`#include <stdio.h>`
`#include "spandsp/telephony.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/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)
modem_connect_tones_tx_state_t * | modem_connect_tones_tx_init (modem_connect_tones_tx_state_t *s, int tone_type)
| Initialise an instance of the modem connect tones generator.
int | modem_connect_tones_tx_release (modem_connect_tones_tx_state_t *s)
| Release an instance of the modem connect tones generator.
int | modem_connect_tones_tx_free (modem_connect_tones_tx_state_t *s)
| Free an instance of the modem connect tones generator.
int | modem_connect_tones_rx (modem_connect_tones_rx_state_t *s, const int16_t amp[], int len)
int | modem_connect_tones_rx_get (modem_connect_tones_rx_state_t *s)
| Test if a modem_connect tone has been detected.
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.
int | modem_connect_tones_rx_release (modem_connect_tones_rx_state_t *s)
| Release an instance of the modem connect tones detector.
int | modem_connect_tones_rx_free (modem_connect_tones_rx_state_t *s)
| Free an instance of the modem connect tones detector.

## Function Documentation

## modem_connect_tones_rx_free()

int modem_connect_tones_rx_free | ( | modem_connect_tones_rx_state_t * | s | ) |

Free an instance of the modem connect tones detector.

Parameters

  s | The context.

Returns
  0 for OK, else -1.

## modem_connect_tones_rx_get()

int modem_connect_tones_rx_get | ( | modem_connect_tones_rx_state_t * | s | ) |

Test if a modem_connect tone has been detected.

Parameters

  s | The context.

Returns
  TRUE if tone is detected, else FALSE.

References modem_connect_tones_rx_state_s::hit, and MODEM_CONNECT_TONES_NONE.

## modem_connect_tones_rx_init()

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

  s | The context.
  tone_type | The type of connect tone being tested for.
  tone_callback | An optional callback routine, used to report tones
  user_data | An opaque pointer passed to the callback routine,

Returns
  A pointer to the context.

References modem_connect_tones_rx_state_s::am_level, modem_connect_tones_rx_state_s::callback_data, modem_connect_tones_rx_state_s::channel_level, modem_connect_tones_rx_state_s::flags_seen, modem_connect_tones_rx_state_s::framing_ok_announced, fsk_rx_init(), fsk_rx_signal_cutoff(), modem_connect_tones_rx_state_s::good_cycles, modem_connect_tones_rx_state_s::hit, 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, MODEM_CONNECT_TONES_NONE, modem_connect_tones_rx_state_s::notch_level, modem_connect_tones_rx_state_s::num_bits, modem_connect_tones_rx_state_s::raw_bit_stream, modem_connect_tones_rx_state_s::tone_callback, modem_connect_tones_rx_state_s::tone_cycle_duration, modem_connect_tones_rx_state_s::tone_present, modem_connect_tones_rx_state_s::tone_type, modem_connect_tones_rx_state_s::v21rx, modem_connect_tones_rx_state_s::z15hz_1, and modem_connect_tones_rx_state_s::znotch_1.

## modem_connect_tones_rx_release()

int modem_connect_tones_rx_release | ( | modem_connect_tones_rx_state_t * | s | ) |

Release an instance of the modem connect tones detector.

Parameters

  s | The context.

Returns
  0 for OK, else -1.

## modem_connect_tones_tx_free()

int modem_connect_tones_tx_free | ( | modem_connect_tones_tx_state_t * | s | ) |

Free an instance of the modem connect tones generator.

Parameters

  s | The context.

Returns
  0 for OK, else -1.

## modem_connect_tones_tx_init()

modem_connect_tones_tx_state_t * modem_connect_tones_tx_init | ( | modem_connect_tones_tx_state_t * | s,
|  | int | tone_type )

Initialise an instance of the modem connect tones generator.

Parameters

  s | The context.

References dds_phase_rate(), dds_scaling_dbm0(), modem_connect_tones_tx_state_s::duration_timer, modem_connect_tones_tx_state_s::hop_timer, 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.

## modem_connect_tones_tx_release()

int modem_connect_tones_tx_release | ( | modem_connect_tones_tx_state_t * | s | ) |

Release an instance of the modem connect tones generator.

Parameters

  s | The context.

Returns
  0 for OK, else -1.