From: drowe67 Date: Fri, 11 Dec 2015 07:59:34 +0000 (+0000) Subject: receiving freedv signals OK, triggering on txt strings X-Git-Url: http://git.whiteaudio.com/gitweb/?a=commitdiff_plain;h=1df26d1efe6b6a44cd178a8c46d55876314e7e96;p=freetel-svn-tracking.git receiving freedv signals OK, triggering on txt strings git-svn-id: https://svn.code.sf.net/p/freetel/code@2515 01035d8c-6547-0410-b346-abe4f91aad63 --- diff --git a/freebeacon/freebeacon.c b/freebeacon/freebeacon.c index 367e8f7e..9bdf1c28 100644 --- a/freebeacon/freebeacon.c +++ b/freebeacon/freebeacon.c @@ -9,7 +9,7 @@ If stereo audio device we use left channel only. - A whole lot of code was lifted from freedv-dev for this program. + A whole lot of code was lifted from freedv-dev for this program. TODO: @@ -53,24 +53,28 @@ #define SAMPLE_RATE 48000 // 48 kHz sampling rate rec. as we can trust accuracy of sound card #define N8 160 // processing buffer size at 8 kHz #define N48 (N8*SAMPLE_RATE/FS) // processing buffer size at 48 kHz +#define SYNC_FRAMES 50 // frames of valid rx /* globals used to communicate with async events */ volatile int keepRunning; char txtMsg[MAX_CHAR], *ptxtMsg, triggerString[MAX_CHAR]; int triggered; +float snr_est, snr_sample; /* state machine defines */ #define SRX_IDLE 0 /* listening but no FreeDV signal */ -#define SRX_SYNC 1 /* We have sync on a valid FreeDV signal */ -#define SRX_TRIGGERED 2 /* the magic trigger text string has been received, but still in RX */ -#define STX 3 /* transmitting reply */ +#define SRX_MAYBE_SYNC 1 /* We have sync but lets see if it goes away */ +#define SRX_SYNC 2 /* We have sync on a valid FreeDV signal */ +#define SRX_MAYBE_UNSYNC 3 /* We have lost sync but lets see if it's really gone */ +#define STX 4 /* transmitting reply */ char *state_str[] = { "Rx Idle", + "Rx Maybe Sync", "Rx Sync", - "Rx Triggered", + "Rx Maybe UnSync", "Tx" }; @@ -153,18 +157,18 @@ void printHelp(const struct option* long_options, int num_opts, char* argv[]) fprintf(stderr, "\nFreeBeacon - FreeDV Beacon\n" "usage: %s [OPTIONS]\n\n" "Options:\n" - "\t-l list audio devices\n", argv[0]); + "\t-l --list (audio devices)\n", argv[0]); for(i=0; iMAYBE_SYNC as this fires on channel noise all the time */ + + int quiet = 0; + if ((state == SRX_IDLE) && (next_state == SRX_MAYBE_SYNC)) + quiet = 1; + if ((state == SRX_MAYBE_SYNC) && (next_state == SRX_IDLE)) + quiet = 1; + if ((next_state != state) && !quiet) + fprintf(stderr, "state: %15s next_state: %15s\n", state_str[state], state_str[next_state]); state = next_state; } @@ -499,4 +549,5 @@ int main(int argc, char *argv[]) { src_delete(txsrc); src_delete(playsrc); freedv_close(f); + fclose(ftmp); }