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