fax_tester.h File Reference

Go to the source code of this file.

## Classes

struct | faxtester_state_s

## Typedefs

typedef struct faxtester_state_s | faxtester_state_t
typedef void(* | faxtester_flush_handler_t) (faxtester_state_t *s, void *user_data, int which)
typedef void(* | faxtester_real_time_frame_handler_t) (faxtester_state_t *s, void *user_data, int direction, const uint8_t *msg, int len)
| FAX tester real time frame handler.
typedef void(* | faxtester_front_end_step_complete_handler_t) (faxtester_state_t *s, void *user_data)

## Functions

int | faxtester_rx (faxtester_state_t *s, int16_t *amp, int len)
| Apply T.30 receive processing to a block of audio samples.
int | faxtester_tx (faxtester_state_t *s, int16_t *amp, int max_len)
| Apply T.30 transmit processing to generate a block of audio samples.
void | faxtester_set_tx_type (void *user_data, int type, int bit_rate, int short_train, int use_hdlc)
void | faxtester_set_rx_type (void *user_data, int type, int bit_rate, int short_train, int use_hdlc)
void | faxtest_set_rx_silence (faxtester_state_t *s)
void | faxtester_send_hdlc_flags (faxtester_state_t *s, int flags)
void | faxtester_send_hdlc_msg (faxtester_state_t *s, const uint8_t *msg, int len, int crc_ok)
void | faxtester_set_flush_handler (faxtester_state_t *s, faxtester_flush_handler_t handler, void *user_data)
void | faxtester_set_transmit_on_idle (faxtester_state_t *s, int transmit_on_idle)
| Select whether silent audio will be sent when FAX transmit is idle.
void | faxtester_set_tep_mode (faxtester_state_t *s, int use_tep)
| Select whether TEP will be sent for the image modems.
void | faxtester_set_real_time_frame_handler (faxtester_state_t *s, faxtester_real_time_frame_handler_t handler, void *user_data)
void | faxtester_set_front_end_step_complete_handler (faxtester_state_t *s, faxtester_front_end_step_complete_handler_t handler, void *user_data)
void | faxtester_set_front_end_step_timeout_handler (faxtester_state_t *s, faxtester_front_end_step_complete_handler_t handler, void *user_data)
void | faxtester_set_timeout (faxtester_state_t *s, int timeout)
void | faxtester_set_non_ecm_image_buffer (faxtester_state_t *s, const uint8_t *buf, int len)
void | faxtester_set_ecm_image_buffer (faxtester_state_t *s, const uint8_t *buf, int len, int block, int frame_size, int crc_hit)
faxtester_state_t * | faxtester_init (faxtester_state_t *s, int calling_party)
| Initialise a FAX context.
int | faxtester_release (faxtester_state_t *s)
| Release a FAX context.
int | faxtester_free (faxtester_state_t *s)
| Free a FAX context.

## Typedef Documentation

## faxtester_real_time_frame_handler_t

typedef void(* faxtester_real_time_frame_handler_t) (faxtester_state_t *s, void *user_data, int direction, const uint8_t *msg, int len)

FAX tester real time frame handler.

FAX tester real time frame handler.

Parameters

  s | The FAX tester context.
  user_data | An opaque pointer.
  direction | TRUE for incoming, FALSE for outgoing.
  msg | The HDLC message.
  len | The length of the message.

## Function Documentation

## faxtester_free()

int faxtester_free | ( | faxtester_state_t * | s | ) |

Free a FAX context.

Free a FAX context.

Parameters

  s | The FAX tester context.

Returns
  0 for OK, else -1.

## faxtester_init()

faxtester_state_t * faxtester_init | ( | faxtester_state_t * | s,
|  | int | calling_party )

Initialise a FAX context.

Initialise a FAX context.

Parameters

  s | The FAX tester context.
  calling_party | TRUE if the context is for a calling party. FALSE if the context is for an answering party.

Returns
  A pointer to the FAX context, or NULL if there was a problem.

References faxtester_state_s::logging.

## faxtester_release()

int faxtester_release | ( | faxtester_state_t * | s | ) |

Release a FAX context.

Release a FAX context.

Parameters

  s | The FAX tester context.

Returns
  0 for OK, else -1.

## faxtester_rx()

int faxtester_rx | ( | faxtester_state_t * | s,
|  | int16_t * | amp,
|  | int | len )

Apply T.30 receive processing to a block of audio samples.

Apply T.30 receive processing to a block of audio samples.

Parameters

  s | The FAX tester context.
  amp | The audio sample buffer.
  len | The number of samples in the buffer.

Returns
  The number of samples unprocessed. This should only be non-zero if the software has reached the end of the FAX call.

References fax_modems_state_s::rx_handler, and fax_modems_state_s::rx_signal_present.

## faxtester_set_tep_mode()

void faxtester_set_tep_mode | ( | faxtester_state_t * | s,
|  | int | use_tep )

Select whether TEP will be sent for the image modems.

Select whether talker echo protection tone will be sent for the image modems.

Parameters

  s | The FAX tester context.
  use_tep | TRUE if TEP should be sent.

References fax_modems_state_s::use_tep.

## faxtester_set_transmit_on_idle()

void faxtester_set_transmit_on_idle | ( | faxtester_state_t * | s,
|  | int | transmit_on_idle )

Select whether silent audio will be sent when FAX transmit is idle.

Select whether silent audio will be sent when FAX transmit is idle.

Parameters

  s | The FAX tester context.
  transmit_on_idle | TRUE if silent audio should be output when the FAX transmitter is idle. FALSE to transmit zero length audio when the FAX transmitter is idle. The default behaviour is FALSE.

References fax_modems_state_s::transmit_on_idle.

## faxtester_tx()

int faxtester_tx | ( | faxtester_state_t * | s,
|  | int16_t * | amp,
|  | int | max_len )

Apply T.30 transmit processing to generate a block of audio samples.

Apply T.30 transmit processing to generate a block of audio samples.

Parameters

  s | The FAX tester context.
  amp | The audio sample buffer.
  max_len | The number of samples to be generated.

Returns
  The number of samples actually generated. This will be zero when there is nothing to send.

References faxtester_state_s::transmit, fax_modems_state_s::transmit_on_idle, and fax_modems_state_s::tx_handler.