Go to the documentation of this file.
28 #if !defined(_SPANDSP_FAX_MODEMS_H_)
29 #define _SPANDSP_FAX_MODEMS_H_
55 #if defined(__cplusplus)
68 SPAN_DECLARE_NONSTD(
int) fax_modems_v27ter_v21_rx(
void *user_data,
const int16_t amp[],
int len);
69 SPAN_DECLARE_NONSTD(
int) fax_modems_v29_v21_rx(
void *user_data,
const int16_t amp[],
int len);
74 SPAN_DECLARE_NONSTD(
void) fax_modems_hdlc_tx_frame(
void *user_data,
const uint8_t *msg,
int len);
91 hdlc_frame_handler_t hdlc_accept,
92 hdlc_underflow_handler_t hdlc_tx_underflow,
95 tone_report_func_t tone_callback,
102 #if defined(__cplusplus)
v27ter_tx_state_t * v27ter_tx_init(v27ter_tx_state_t *s, int bit_rate, int tep, get_bit_func_t get_bit, void *user_data)
Initialise a V.27ter modem transmit context.
Definition: v27ter_tx.c:413
@ T30_TSI
Definition: t30_fcf.h:55
float v29_rx_signal_power(v29_rx_state_t *s)
Definition: v29rx.c:165
@ T30_DCS
Definition: t30_fcf.h:54
@ T30_CSI
Definition: t30_fcf.h:36
@ MODEM_CONNECT_TONES_FAX_CNG
CNG tone is a pure 1100Hz tone, in 0.5s bursts, with 3s silences in between. The bursts repeat for as...
Definition: modem_connect_tones.h:62
@ T4_FCD
Definition: t30_fcf.h:116
v29_rx_state_t * v29_rx_init(v29_rx_state_t *s, int bit_rate, put_bit_func_t put_bit, void *user_data)
Initialise a V.29 modem receive context.
Definition: v29rx.c:1171
@ T30_PWD
Definition: t30_fcf.h:45
void v27ter_rx_set_modem_status_handler(v27ter_rx_state_t *s, modem_status_func_t handler, void *user_data)
Change the modem status report function associated with a V.27ter modem receive context.
Definition: v27ter_rx.c:1023
int rx_frame_received
TRUE if an HDLC frame has been received correctly.
Definition: private/fax_modems.h:95
int hdlc_tx_restart(hdlc_tx_state_t *s)
Re-initialise an HDLC transmitter context.
Definition: hdlc.c:605
hdlc_tx_state_t * hdlc_tx_init(hdlc_tx_state_t *s, int crc32, int inter_frame_flags, int progressive, hdlc_underflow_handler_t handler, void *user_data)
Initialise an HDLC transmitter context.
Definition: hdlc.c:626
void t30_decode_dis_dtc_dcs(t30_state_t *s, const uint8_t *dis, int len)
Decode a DIS, DTC or DCS frame, and log the contents.
Definition: t30_logging.c:506
logging_state_t logging
Error and flow logging control.
Definition: private/fax_modems.h:124
int bad_rows
The number of bad pixel rows in the most recent page.
Definition: t4_rx.h:223
void t4_rx_get_transfer_statistics(t4_rx_state_t *s, t4_stats_t *t)
Get the current transfer statistics.
Definition: t4_rx.c:1133
float fsk_rx_signal_power(fsk_rx_state_t *s)
Definition: fsk.c:246
logging_state_t * v27ter_rx_get_logging_state(v27ter_rx_state_t *s)
Get the logging context associated with a V.27ter modem receive context.
Definition: v27ter_rx.c:1030
v27ter_rx_state_t v27ter_rx
A V.27ter modem context used when receiving FAXes at 2400bps or 4800bps.
Definition: private/fax_modems.h:74
void v29_rx_signal_cutoff(v29_rx_state_t *s, float cutoff)
Definition: v29rx.c:171
int t35_decode(const uint8_t *msg, int len, const char **country, const char **vendor, const char **model)
Decode an NSF field.
Definition: t35.c:909
@ T30_SUB
Definition: t30_fcf.h:57
@ T4_COMPRESSION_ITU_T4_2D
Definition: t4_rx.h:56
void(* put_bit_func_t)(void *user_data, int bit)
Definition: async.h:105
const char * t30_frametype(uint8_t x)
Return a text name for a T.30 frame type.
Definition: t30_logging.c:241
span_rx_fillin_handler_t * rx_fillin_handler
The current receive missing signal fill-in handler.
Definition: private/fax_modems.h:100
@ T30_NSS
Definition: t30_fcf.h:56
v29_tx_state_t v29_tx
A V.29 modem context used when sending FAXes at 7200bps or 9600bps.
Definition: private/fax_modems.h:65
int t4_rx_start_page(t4_rx_state_t *s)
Prepare to receive the next page of the current document.
Definition: t4_rx.c:1010
void t4_rx_set_x_resolution(t4_rx_state_t *s, int resolution)
Set the column-to-column (x) resolution to expect for a received image.
Definition: t4_rx.c:1097
int rx_signal_present
TRUE if a carrier is present. Otherwise FALSE.
Definition: private/fax_modems.h:91
v27ter_tx_state_t v27ter_tx
A V.27ter modem context used when sending FAXes at 2400bps or 4800bps.
Definition: private/fax_modems.h:71
const char * signal_status_to_str(int status)
Convert a signal status to a short text description.
Definition: async.c:42
void v17_rx_signal_cutoff(v17_rx_state_t *s, float cutoff)
Definition: v17rx.c:188
SPAN_DECLARE_NONSTD(int) async_tx_get_bit(void *user_data)
Get the next bit of a transmitted serial bit stream.
v17_tx_state_t v17_tx
A V.17 modem context used when sending FAXes at 7200bps, 9600bps 12000bps or 14400bps.
Definition: private/fax_modems.h:59
int pages_transferred
The number of pages transferred so far.
Definition: t4_rx.h:215
@ T30_DTC
Definition: t30_fcf.h:42
silence_gen_state_t silence_gen
Used to insert timed silences.
Definition: private/fax_modems.h:77
int length
The number of vertical pixels in the most recent page.
Definition: t4_rx.h:221
logging_state_t * fax_modems_get_logging_state(fax_modems_state_t *s)
Get a pointer to the logging context associated with a FAX modems context.
Definition: fax_modems.c:323
logging_state_t * v29_rx_get_logging_state(v29_rx_state_t *s)
Get the logging context associated with a V.29 modem receive context.
Definition: v29rx.c:1066
void v29_rx_set_modem_status_handler(v29_rx_state_t *s, modem_status_func_t handler, void *user_data)
Change the modem status report function associated with a V.29 modem receive context.
Definition: v29rx.c:1059
int width
The number of horizontal pixels in the most recent page.
Definition: t4_rx.h:219
v29_rx_state_t v29_rx
A V.29 modem context used when receiving FAXes at 7200bps or 9600bps.
Definition: private/fax_modems.h:68
Definition: private/t4_tx.h:36
void fsk_rx_set_modem_status_handler(fsk_rx_state_t *s, modem_status_func_t handler, void *user_data)
Change the modem status report function associated with an FSK modem receive context.
Definition: fsk.c:259
Definition: private/fax_modems.h:35
int(* get_bit_func_t)(void *user_data)
Definition: async.h:108
span_rx_handler_t * rx_handler
The current receive signal handler.
Definition: private/fax_modems.h:98
@ T30_SUPPORT_V29
Definition: t30.h:344
@ SIG_STATUS_CARRIER_DOWN
The carrier signal has dropped.
Definition: async.h:54
int t4_rx_put_bit(t4_rx_state_t *s, int bit)
Put a bit of the current document page.
Definition: t4_rx.c:975
@ T30_SUPPORT_V27TER
Definition: t30.h:342
@ T30_SEP
Definition: t30_fcf.h:46
Definition: private/hdlc.h:33
#define T30_MAX_DIS_DTC_DCS_LEN
Definition: t30.h:142
int t4_rx_end_page(t4_rx_state_t *s)
Complete the reception of a page.
Definition: t4_rx.c:581
hdlc_rx_state_t hdlc_rx
An HDLC context used when receiving HDLC messages.
Definition: private/fax_modems.h:48
#define HDLC_FRAMING_OK_THRESHOLD
Definition: t38_gateway.c:175
int span_log(logging_state_t *s, int level, const char *format,...)
Generate a log entry.
Definition: logging.c:84
Definition: private/v27ter_rx.h:52
@ T4_COMPRESSION_ITU_T6
Definition: t4_rx.h:58
logging_state_t * fax_modems_get_logging_state(fax_modems_state_t *s)
Get a pointer to the logging context associated with a FAX modems context.
Definition: fax_modems.c:323
#define T30_MAX_IDENT_LEN
Definition: t30.h:144
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.
Definition: modem_connect_tones.c:253
v27ter_rx_state_t * v27ter_rx_init(v27ter_rx_state_t *s, int bit_rate, put_bit_func_t put_bit, void *user_data)
Initialise a V.27ter modem receive context.
Definition: v27ter_rx.c:1104
logging_state_t logging
Error and flow logging control.
Definition: private/t30.h:306
t4_rx_state_t * t4_rx_init(t4_rx_state_t *s, const char *file, int output_encoding)
Prepare for reception of a document.
Definition: t4_rx.c:1177
hdlc_rx_state_t * hdlc_rx_init(hdlc_rx_state_t *s, int crc32, int report_bad_frames, int framing_ok_threshold, hdlc_frame_handler_t handler, void *user_data)
Initialise an HDLC receiver context.
Definition: hdlc.c:327
logging_state_t * v17_rx_get_logging_state(v17_rx_state_t *s)
Get the logging context associated with a V.17 modem receive context.
Definition: v17rx.c:1374
v29_tx_state_t * v29_tx_init(v29_tx_state_t *s, int bit_rate, int tep, get_bit_func_t get_bit, void *user_data)
Initialise a V.29 modem transmit context.
Definition: v29tx.c:369
Definition: private/t30.h:36
SPAN_DECLARE_NONSTD(int) fax_modems_v17_v21_rx(void *user_data
Get the next bit of a transmitted serial bit stream.
fsk_rx_state_t * fsk_rx_init(fsk_rx_state_t *s, const fsk_spec_t *spec, int framing_mode, put_bit_func_t put_bit, void *user_data)
Initialise an FSK modem receive context.
Definition: fsk.c:314
int longest_bad_row_run
The largest number of bad pixel rows in a block in the most recent page.
Definition: t4_rx.h:225
@ T30_DIS
Definition: t30_fcf.h:35
fsk_tx_state_t * fsk_tx_init(fsk_tx_state_t *s, const fsk_spec_t *spec, get_bit_func_t get_bit, void *user_data)
Initialise an FSK modem transmit context.
Definition: fsk.c:153
int x_resolution
The horizontal resolution of the page in pixels per metre.
Definition: t4_rx.h:227
void fsk_rx_signal_cutoff(fsk_rx_state_t *s, float cutoff)
Adjust an FSK modem receive context's carrier detect power threshold.
Definition: fsk.c:238
modem_connect_tones_rx_state_t connect_rx
CED or CNG detector.
Definition: private/fax_modems.h:81
silence_gen_state_t * silence_gen_init(silence_gen_state_t *s, int silent_samples)
Initialise a timed silence generator context.
Definition: silence_gen.c:118
void t4_rx_set_y_resolution(t4_rx_state_t *s, int resolution)
Set the row-to-row (y) resolution to expect for a received image.
Definition: t4_rx.c:1091
const char * fax_modem_to_str(int modem)
Convert a FAX modem type to a short text description.
Definition: fax_modems.c:89
void t4_rx_set_image_width(t4_rx_state_t *s, int width)
Set the expected width of the received image, in pixel columns.
Definition: t4_rx.c:1085
fsk_rx_state_t v21_rx
A V.21 FSK modem context used when receiving HDLC over V.21 messages.
Definition: private/fax_modems.h:54
Definition: private/v29rx.h:44
int t4_rx_put_chunk(t4_rx_state_t *s, const uint8_t buf[], int len)
Put a byte of the current document page.
Definition: t4_rx.c:987
int use_tep
Definition: private/fax_modems.h:37
span_tx_handler_t * tx_handler
The current transmit signal handler.
Definition: private/fax_modems.h:104
hdlc_tx_state_t hdlc_tx
An HDLC context used when transmitting HDLC messages.
Definition: private/fax_modems.h:46
void t4_rx_set_rx_encoding(t4_rx_state_t *s, int encoding)
Set the encoding for the received data.
Definition: t4_rx.c:1079
v17_rx_state_t v17_rx
A V.29 modem context used when receiving FAXes at 7200bps, 9600bps 12000bps or 14400bps.
Definition: private/fax_modems.h:62
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.
Definition: modem_connect_tones.c:706
@ T30_NSF
Definition: t30_fcf.h:37
@ T30_SUPPORT_V17
Definition: t30.h:346
const char * fax_modem_to_str(int modem)
Convert a FAX modem type to a short text description.
Definition: fax_modems.c:89
int y_resolution
The vertical resolution of the page in pixels per metre.
Definition: t4_rx.h:229
v17_tx_state_t * v17_tx_init(v17_tx_state_t *s, int bit_rate, int tep, get_bit_func_t get_bit, void *user_data)
Initialise a V.17 modem transmit context.
Definition: v17tx.c:431
void v17_rx_set_modem_status_handler(v17_rx_state_t *s, modem_status_func_t handler, void *user_data)
Change the modem status report function associated with a V.17 modem receive context.
Definition: v17rx.c:1367
@ SIG_STATUS_TRAINING_SUCCEEDED
The modem has trained, and is ready for data exchange.
Definition: async.h:65
@ T4_COMPRESSION_ITU_T4_1D
Definition: t4_rx.h:54
float v27ter_rx_signal_power(v27ter_rx_state_t *s)
Definition: v27ter_rx.c:152
Definition: private/logging.h:34
int t4_rx_release(t4_rx_state_t *s)
End reception of a document. Tidy up and close the file. This should be used to end T....
Definition: t4_rx.c:1235
Definition: private/fsk.h:59
int hdlc_tx_frame(hdlc_tx_state_t *s, const uint8_t *frame, size_t len)
Transmit a frame.
Definition: hdlc.c:389
Definition: private/v17rx.h:55
@ T30_SID
Definition: t30_fcf.h:58
void v27ter_rx_signal_cutoff(v27ter_rx_state_t *s, float cutoff)
Definition: v27ter_rx.c:158
modem_connect_tones_tx_state_t connect_tx
CED or CNG generator.
Definition: private/fax_modems.h:79
fsk_tx_state_t v21_tx
A V.21 FSK modem context used when transmitting HDLC over V.21 messages.
Definition: private/fax_modems.h:51
v17_rx_state_t * v17_rx_init(v17_rx_state_t *s, int bit_rate, put_bit_func_t put_bit, void *user_data)
Initialise a V.17 modem receive context.
Definition: v17rx.c:1517
@ T30_NSC
Definition: t30_fcf.h:44
float v17_rx_signal_power(v17_rx_state_t *s)
Definition: v17rx.c:182