}
hstates->uw_len = sizeof(uw_horus_binary);
hstates->uw_thresh = sizeof(uw_horus_binary) - 2; /* allow a few bit errors in UW detection */
+ horus_l2_init();
}
hstates->fsk = fsk_create(hstates->Fs, hstates->Rs, hstates->mFSK, 1000, 2*hstates->Rs);
int extract_horus_binary(struct horus *hstates, char hex_out[], int uw_loc) {
- const int nfield = 8; /* 8 bit binary */
- int st = uw_loc + hstates->uw_len; /* first bit of first char */
- int en = uw_loc + hstates->max_packet_len - nfield; /* last bit of max length packet */
+ const int nfield = 8; /* 8 bit binary */
+ int st = uw_loc; /* first bit of first char */
+ int en = uw_loc + hstates->max_packet_len; /* last bit of max length packet */
int j, b, nout;
uint8_t rxpacket[hstates->max_packet_len];
nout++;
}
+ if (hstates->verbose) {
+ fprintf(stderr, "nout: %d\nReceived Packet before decoding:\n", nout);
+ for (b=0; b<nout; b++) {
+ fprintf(stderr, "%02X", rxpacket[b]);
+ }
+ fprintf(stderr, "\n");
+ }
+
uint8_t payload_bytes[HORUS_BINARY_NUM_PAYLOAD_BYTES];
horus_l2_decode_rx_packet(payload_bytes, rxpacket, HORUS_BINARY_NUM_PAYLOAD_BYTES);
+ /* convert to ASCII string of hex characters */
+
+ hex_out[0] = 0;
+ char hex[3];
+ for (b=0; b<HORUS_BINARY_NUM_PAYLOAD_BYTES; b++) {
+ sprintf(hex, "%02X", payload_bytes[b]);
+ strcat(hex_out, hex);
+ }
+
+ if (hstates->verbose) {
+ fprintf(stderr, "nout: %d\nDecoded Payload bytes:\n%s", nout, hex_out);
+ }
+
return 1;
}
$ sox ~/Desktop/horus.wav -r 48000 -t raw - | ./horus_demod -m RTTY -v - /dev/nul/
+ $ sox ~/Desktop/4FSK_binary_100Rb_8khzfs.wav -r 48000 -t raw - | ./horus_demod -m binary - -
+
\*---------------------------------------------------------------------------*/
/*
/* Main loop ----------------------------------------------------------------------- */
- while( fread(demod_in, sizeof(short), horus_nin(hstates), fin) == horus_nin(hstates) ) {
+ while(fread(demod_in, sizeof(short), horus_nin(hstates), fin) == horus_nin(hstates)) {
if (verbose) {
fprintf(stderr, "read nin %d\n", horus_nin(hstates));