fax_tester.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #if !defined(_SPANDSP_FAX_TESTER_H_)
00029 #define _SPANDSP_FAX_TESTER_H_
00030
00031
00032
00033
00034
00035
00036
00037
00038 typedef struct faxtester_state_s faxtester_state_t;
00039
00040 typedef void (faxtester_flush_handler_t)(faxtester_state_t *s, void *user_data, int which);
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051 typedef void (faxtester_real_time_frame_handler_t)(faxtester_state_t *s,
00052 void *user_data,
00053 int direction,
00054 const uint8_t *msg,
00055 int len);
00056
00057 typedef void (faxtester_front_end_step_complete_handler_t)(faxtester_state_t *s, void *user_data);
00058
00059
00060
00061
00062 struct faxtester_state_s
00063 {
00064
00065 xmlNodePtr cur;
00066
00067 faxtester_flush_handler_t *flush_handler;
00068 void *flush_user_data;
00069
00070
00071
00072 faxtester_real_time_frame_handler_t *real_time_frame_handler;
00073
00074 void *real_time_frame_user_data;
00075
00076 faxtester_front_end_step_complete_handler_t *front_end_step_complete_handler;
00077 void *front_end_step_complete_user_data;
00078
00079 faxtester_front_end_step_complete_handler_t *front_end_step_timeout_handler;
00080 void *front_end_step_timeout_user_data;
00081
00082 const uint8_t *image_buffer;
00083 int image_len;
00084 int image_ptr;
00085 int image_bit_ptr;
00086
00087 int ecm_frame_size;
00088 int corrupt_crc;
00089
00090 int final_delayed;
00091
00092 fax_modems_state_t modems;
00093
00094
00095 int transmit;
00096
00097
00098 int short_train;
00099
00100
00101 int current_rx_type;
00102
00103 int current_tx_type;
00104
00105 int wait_for_silence;
00106
00107 int tone_state;
00108 int64_t tone_on_time;
00109
00110 int64_t timer;
00111 int64_t timeout;
00112
00113
00114 logging_state_t logging;
00115 };
00116
00117 #if defined(__cplusplus)
00118 extern "C"
00119 {
00120 #endif
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130 int faxtester_rx(faxtester_state_t *s, int16_t *amp, int len);
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140 int faxtester_tx(faxtester_state_t *s, int16_t *amp, int max_len);
00141
00142 void faxtester_set_tx_type(void *user_data, int type, int bit_rate, int short_train, int use_hdlc);
00143
00144 void faxtester_set_rx_type(void *user_data, int type, int bit_rate, int short_train, int use_hdlc);
00145
00146 void faxtest_set_rx_silence(faxtester_state_t *s);
00147
00148 void faxtester_send_hdlc_flags(faxtester_state_t *s, int flags);
00149
00150 void faxtester_send_hdlc_msg(faxtester_state_t *s, const uint8_t *msg, int len, int crc_ok);
00151
00152 void faxtester_set_flush_handler(faxtester_state_t *s, faxtester_flush_handler_t *handler, void *user_data);
00153
00154
00155
00156
00157
00158
00159
00160
00161 void faxtester_set_transmit_on_idle(faxtester_state_t *s, int transmit_on_idle);
00162
00163
00164
00165
00166
00167
00168 void faxtester_set_tep_mode(faxtester_state_t *s, int use_tep);
00169
00170 void faxtester_set_real_time_frame_handler(faxtester_state_t *s, faxtester_real_time_frame_handler_t *handler, void *user_data);
00171
00172 void faxtester_set_front_end_step_complete_handler(faxtester_state_t *s, faxtester_front_end_step_complete_handler_t *handler, void *user_data);
00173
00174 void faxtester_set_front_end_step_timeout_handler(faxtester_state_t *s, faxtester_front_end_step_complete_handler_t *handler, void *user_data);
00175
00176 void faxtester_set_timeout(faxtester_state_t *s, int timeout);
00177
00178 void faxtester_set_non_ecm_image_buffer(faxtester_state_t *s, const uint8_t *buf, int len);
00179
00180 void faxtester_set_ecm_image_buffer(faxtester_state_t *s, const uint8_t *buf, int len, int block, int frame_size, int crc_hit);
00181
00182
00183
00184
00185
00186
00187
00188
00189 faxtester_state_t *faxtester_init(faxtester_state_t *s, int calling_party);
00190
00191
00192
00193
00194
00195 int faxtester_release(faxtester_state_t *s);
00196
00197
00198
00199
00200
00201 int faxtester_free(faxtester_state_t *s);
00202
00203 #if defined(__cplusplus)
00204 }
00205 #endif
00206
00207 #endif
00208