1
0
mirror of https://github.com/JvanKatwijk/dab-cmdline synced 2025-10-05 23:52:50 +02:00
Files
SDR-DAB_dab-cmdline/devices/hackrf-handler/hackrf-handler.h

66 lines
2.1 KiB
C
Raw Normal View History

2018-08-28 09:38:42 +02:00
#
/*
* Copyright (C) 2017 .. 2018
* Jan van Katwijk (J.vanKatwijk@gmail.com)
* Lazy Chair Computing
*
2020-06-30 19:25:28 +02:00
* This file is part of the DAB cmdline
*
* DAB cmdline is free software; you can redistribute it and/or modify
2018-08-28 09:38:42 +02:00
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
2020-06-30 19:25:28 +02:00
* DAB cmdline is distributed in the hope that it will be useful,
2018-08-28 09:38:42 +02:00
* 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.
*
* You should have received a copy of the GNU General Public License
2020-06-30 19:25:28 +02:00
* along with DAB cmdline; if not, write to the Free Software
2018-08-28 09:38:42 +02:00
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
2025-06-22 19:12:39 +02:00
#pragma once
2018-08-28 09:38:42 +02:00
#include "ringbuffer.h"
#include <atomic>
#include "device-handler.h"
#include "libhackrf/hackrf.h"
typedef int (*hackrf_sample_block_cb_fn)(hackrf_transfer *transfer);
///////////////////////////////////////////////////////////////////////////
class hackrfHandler: public deviceHandler {
public:
hackrfHandler (int32_t frequency,
int16_t ppm,
int16_t lnaGain,
2019-05-28 11:45:59 +02:00
int16_t vgaGain,
bool ampEnable = false);
2018-08-28 09:38:42 +02:00
~hackrfHandler (void);
2019-01-06 15:47:31 +01:00
bool restartReader (int32_t);
2018-08-28 09:38:42 +02:00
void stopReader (void);
int32_t getSamples (std::complex<float> *,
int32_t);
int32_t Samples (void);
void resetBuffer (void);
int16_t bitDepth (void);
//
// The buffer should be visible by the callback function
RingBuffer<std::complex<float>> *_I_Buffer;
hackrf_device *theDevice;
private:
int32_t vfoFrequency;
2019-05-28 11:45:59 +02:00
int16_t lnaGain;
int16_t vgaGain;
bool ampEnable;
int32_t inputRate;
2018-08-28 09:38:42 +02:00
std::atomic<bool> running;
void setLNAGain (int);
void setVGAGain (int);
};
2025-06-22 19:12:39 +02:00
2018-08-28 09:38:42 +02:00