1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2026-06-01 21:54:55 -04:00

HackRF Output support: created a HackRF device library for Rx/Tx common routines and structures

This commit is contained in:
f4exb
2017-01-07 11:24:09 +01:00
parent 1187ab99cb
commit 250a7f340c
8 changed files with 149 additions and 22 deletions
@@ -24,6 +24,7 @@ if (BUILD_DEBIAN)
include_directories(
.
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_SOURCE_DIR}/devices
${LIBHACKRFSRC}
${LIBHACKRFSRC}/libhackrf/src
)
@@ -31,6 +32,7 @@ else (BUILD_DEBIAN)
include_directories(
.
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_SOURCE_DIR}/devices
${LIBHACKRF_INCLUDE_DIR}
)
endif (BUILD_DEBIAN)
@@ -55,12 +57,14 @@ target_link_libraries(inputhackrf
${QT_LIBRARIES}
hackrf
sdrbase
hackrfdevice
)
else (BUILD_DEBIAN)
target_link_libraries(inputhackrf
${QT_LIBRARIES}
${LIBHACKRF_LIBRARIES}
sdrbase
hackrfdevice
)
endif (BUILD_DEBIAN)
@@ -25,8 +25,8 @@
#include "dsp/dspengine.h"
#include <device/devicesourceapi.h>
#include "../hackrfinput/hackrfinputgui.h"
#include "../hackrfinput/hackrfinputthread.h"
#include "hackrfinputgui.h"
#include "hackrfinputthread.h"
MESSAGE_CLASS_DEFINITION(HackRFInput::MsgConfigureHackRF, Message)
MESSAGE_CLASS_DEFINITION(HackRFInput::MsgReportHackRF, Message)
@@ -73,7 +73,7 @@ bool HackRFInput::start(int device)
return false;
}
if ((m_dev = open_hackrf_from_sequence(device)) == 0)
if ((m_dev = DeviceHackRF::open_hackrf_from_sequence(device)) == 0)
{
qCritical("HackRFInput::start: could not open HackRF #%d", device);
return false;
@@ -405,20 +405,20 @@ bool HackRFInput::applySettings(const HackRFInputSettings& settings, bool force)
return true;
}
hackrf_device *HackRFInput::open_hackrf_from_sequence(int sequence)
{
hackrf_device_list_t *hackrf_devices = hackrf_device_list();
hackrf_device *hackrf_ptr;
hackrf_error rc;
rc = (hackrf_error) hackrf_device_list_open(hackrf_devices, sequence, &hackrf_ptr);
if (rc == HACKRF_SUCCESS)
{
return hackrf_ptr;
}
else
{
return 0;
}
}
//hackrf_device *HackRFInput::open_hackrf_from_sequence(int sequence)
//{
// hackrf_device_list_t *hackrf_devices = hackrf_device_list();
// hackrf_device *hackrf_ptr;
// hackrf_error rc;
//
// rc = (hackrf_error) hackrf_device_list_open(hackrf_devices, sequence, &hackrf_ptr);
//
// if (rc == HACKRF_SUCCESS)
// {
// return hackrf_ptr;
// }
// else
// {
// return 0;
// }
//}
@@ -21,7 +21,8 @@
#include "libhackrf/hackrf.h"
#include <QString>
#include "../hackrfinput/hackrfinputsettings.h"
#include "hackrf/devicehackrf.h"
#include "hackrfinputsettings.h"
class DeviceSourceAPI;
class HackRFInputThread;
@@ -81,7 +82,7 @@ public:
private:
bool applySettings(const HackRFInputSettings& settings, bool force);
hackrf_device *open_hackrf_from_sequence(int sequence);
// hackrf_device *open_hackrf_from_sequence(int sequence);
void setCenterFrequency(quint64 freq);
DeviceSourceAPI *m_deviceAPI;