2016-03-01 17:40:38 +00:00
|
|
|
#include "../common/sender.h"
|
|
|
|
|
|
|
|
enum dsp_mode {
|
|
|
|
DSP_MODE_SILENCE, /* send silence to transmitter, block audio from receiver */
|
|
|
|
DSP_MODE_AUDIO, /* stream audio */
|
|
|
|
DSP_MODE_TONE, /* send 2280 Hz tone 0 */
|
|
|
|
DSP_MODE_PAGING, /* send four paging tones */
|
|
|
|
};
|
|
|
|
|
|
|
|
enum anetz_state {
|
2016-12-06 16:47:58 +00:00
|
|
|
ANETZ_NULL = 0,
|
2016-03-01 17:40:38 +00:00
|
|
|
ANETZ_FREI, /* sending 2280 Hz tone */
|
|
|
|
ANETZ_GESPRAECH, /* during conversation */
|
|
|
|
ANETZ_ANRUF, /* phone is paged */
|
2016-03-11 17:08:57 +00:00
|
|
|
ANETZ_AUSLOESEN, /* releasing towards phone */
|
2016-03-01 17:40:38 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct anetz {
|
|
|
|
sender_t sender;
|
|
|
|
|
|
|
|
/* sender's states */
|
|
|
|
enum anetz_state state; /* current sender's state */
|
2016-08-21 07:00:55 +00:00
|
|
|
int callref; /* call reference */
|
2016-03-01 17:40:38 +00:00
|
|
|
char station_id[8]; /* current station ID */
|
|
|
|
struct timer timer;
|
|
|
|
|
|
|
|
/* dsp states */
|
|
|
|
enum dsp_mode dsp_mode; /* current mode: audio, durable tone 0 or 1, paging */
|
2016-05-05 11:11:15 +00:00
|
|
|
int fsk_tone_coeff[2]; /* coefficient k = 2*cos(2*PI*f/samplerate), k << 15 */
|
2016-03-01 17:40:38 +00:00
|
|
|
int samples_per_chunk; /* how many samples lasts one chunk */
|
|
|
|
int16_t *fsk_filter_spl; /* array with samples_per_chunk */
|
|
|
|
int fsk_filter_pos; /* current sample position in filter_spl */
|
|
|
|
int tone_detected; /* what tone has been detected */
|
|
|
|
int tone_count; /* how long has that tone been detected */
|
|
|
|
double tone_phaseshift256; /* how much the phase of sine wave changes per sample */
|
|
|
|
double tone_phase256; /* current phase */
|
2017-01-08 10:22:24 +00:00
|
|
|
double page_gain; /* factor to raise the paging tones */
|
2016-11-13 04:51:09 +00:00
|
|
|
int page_sequence; /* if set, use paging tones in sequence rather than parallel */
|
2016-03-01 17:40:38 +00:00
|
|
|
double paging_phaseshift256[4];/* how much the phase of sine wave changes per sample */
|
|
|
|
double paging_phase256[4]; /* current phase */
|
|
|
|
int paging_tone; /* current tone (0..3) in sequenced mode */
|
|
|
|
int paging_count; /* current sample count of tone in seq. mode */
|
2016-11-13 16:45:46 +00:00
|
|
|
int paging_transition; /* set to number of samples during transition */
|
2016-03-01 17:40:38 +00:00
|
|
|
} anetz_t;
|
|
|
|
|
|
|
|
|
|
|
|
double anetz_kanal2freq(int kanal, int unterband);
|
|
|
|
int anetz_init(void);
|
2017-01-08 10:22:24 +00:00
|
|
|
int anetz_create(int kanal, const char *audiodev, int samplerate, double rx_gain, double page_gain, int page_sequence, int pre_emphasis, int de_emphasis, const char *write_rx_wave, const char *write_tx_wave, const char *read_rx_wave, int loopback, double loss_volume);
|
2016-03-01 17:40:38 +00:00
|
|
|
void anetz_destroy(sender_t *sender);
|
|
|
|
void anetz_loss_indication(anetz_t *anetz);
|
|
|
|
void anetz_receive_tone(anetz_t *anetz, int bit);
|
|
|
|
|