spandsp 3.0.0
fax_tester.c File Reference
#include <inttypes.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <strings.h>
#include <ctype.h>
#include "floating_fudge.h"
#include <assert.h>
#include <fcntl.h>
#include <time.h>
#include <unistd.h>
#include "spandsp.h"
#include "fax_utils.h"
#include "fax_tester.h"

Classes

struct  xml_node_parms_s
 

Macros

#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES
 
#define HDLC_FRAMING_OK_THRESHOLD   5
 

Functions

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)
 
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 faxtest_set_rx_silence (faxtester_state_t *s)
 
void faxtester_set_rx_type (void *user_data, int type, int bit_rate, int short_train, int use_hdlc)
 
void faxtester_set_tx_type (void *user_data, int type, int bit_rate, int short_train, int use_hdlc)
 
void faxtester_set_timeout (faxtester_state_t *s, int timeout)
 
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_flush_handler (faxtester_state_t *s, faxtester_flush_handler_t handler, void *user_data)
 
int faxtester_next_step (faxtester_state_t *s)
 
logging_state_tfaxtester_get_logging_state (faxtester_state_t *s)
 Get the logging context associated with a FAX tester context.
 
faxtester_state_tfaxtester_init (faxtester_state_t *s, const char *test_file, const char *test)
 Initialise a FAX tester context.
 
int faxtester_release (faxtester_state_t *s)
 Release a FAX context.
 
int faxtester_free (faxtester_state_t *s)
 Free a FAX context.
 

Variables

const char * output_tiff_file_name
 
struct { 
 
   const char *   tag 
 
   int   code 
 
t30_status [] 
 

Function Documentation

◆ faxtester_free()

int faxtester_free ( faxtester_state_t * s)

Free a FAX context.

Free a FAX context.

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

References faxtester_release().

◆ faxtester_get_logging_state()

logging_state_t * faxtester_get_logging_state ( faxtester_state_t * s)

Get the logging context associated with a FAX tester context.

Get the logging context associated with a FAX tester context.

Parameters
sThe FAX tester context.
Returns
A pointer to the logging context

References faxtester_state_s::logging.

◆ faxtester_init()

faxtester_state_t * faxtester_init ( faxtester_state_t * s,
const char * test_file,
const char * test )

Initialise a FAX tester context.

Initialise a FAX tester context.

Parameters
sThe FAX tester context.
test_fileThe name of the file of XML test scripts.
testThe name of the XML script test.
Returns
A pointer to the FAX context, or NULL if there was a problem.

References faxtester_state_s::image_path, faxtester_state_s::logging, and t38_non_ecm_buffer_get_bit().

◆ faxtester_release()

int faxtester_release ( faxtester_state_t * s)

Release a FAX context.

Release a FAX context.

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

References faxtester_state_s::doc.

Referenced by faxtester_free().

◆ 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
sThe FAX tester context.
ampThe audio sample buffer.
lenThe 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
sThe FAX tester context.
use_teptrue if TEP should be sent.

◆ 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
sThe FAX tester context.
transmit_on_idleTrue 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
sThe FAX tester context.
ampThe audio sample buffer.
max_lenThe 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.