rtlsdr-wsprd/rtlsdr_wsprd.h

86 wiersze
2.4 KiB
C
Czysty Zwykły widok Historia

2016-06-11 21:34:36 +00:00
/*
* rtlsrd-wsprd, WSPR daemon for RTL receivers, Guenael Jouchet (VA2GKA)
* Copyright (C) 2016-2021, Guenael Jouchet (VA2GKA)
2016-06-11 21:34:36 +00:00
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
2016-06-11 21:34:36 +00:00
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
2016-06-11 21:34:36 +00:00
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
2016-06-11 21:34:36 +00:00
*
*/
#pragma once
#include <unistd.h>
#ifndef bool
typedef uint32_t bool;
#define true 1
#define false 0
2016-06-11 21:34:36 +00:00
#endif
struct receiver_state {
/* Variables used for stop conditions */
bool exit_flag;
bool decode_flag;
/* Buffer used for sampling */
float *iSamples;
float *qSamples;
/* Simple index */
uint32_t iqIndex;
};
/* Option & config of the receiver */
struct receiver_options {
uint32_t dialfreq;
uint32_t realfreq;
int32_t gain;
int32_t autogain;
int32_t ppm;
int32_t shift;
2016-06-13 23:29:48 +00:00
int32_t upconverter;
2016-09-26 01:08:17 +00:00
int32_t directsampling;
2017-06-21 00:42:53 +00:00
int32_t maxloop;
2017-06-23 04:32:08 +00:00
int32_t device;
bool selftest;
bool writefile;
bool readfile;
char filename[33];
2016-06-11 21:34:36 +00:00
char date[7];
char uttime[5];
};
2017-06-23 20:37:20 +00:00
2021-12-11 07:00:27 +00:00
static void rtlsdr_callback(unsigned char *samples, uint32_t sigLenght, void *ctx);
2017-06-23 20:37:20 +00:00
static void *rtlsdr_rx(void *arg);
void postSpots(uint32_t n_results);
void printSpots(uint32_t n_results);
void saveSample(float *iSamples, float *qSamples);
static void *decoder(void *arg);
2017-06-23 20:37:20 +00:00
double atofs(char *s);
int32_t parse_u64(char *s, uint64_t *const value);
2017-06-23 20:37:20 +00:00
void initSampleStorage();
void initDecoder_options();
void initrx_options();
void sigint_callback_handler(int signum);
int32_t readRawIQfile(float *iSamples, float *qSamples, char *filename);
int32_t writeRawIQfile(float *iSamples, float *qSamples, char *filename);
void decodeRecordedFile(char *filename);
float whiteGaussianNoise(float factor);
int32_t decoderSelfTest();
2017-06-23 20:37:20 +00:00
void usage(void);
int32_t readRawIQfile(float *iSamples, float *qSamples, char *filename);
int32_t writeRawIQfile(float *iSamples, float *qSamples, char *filename);