mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-12-23 10:05:46 -05:00
HackRF: rationalize start/stop device. Needs latest version of libhackrf (2017/03/01) and 2017.02.1 firmware
This commit is contained in:
parent
6b97d9ea59
commit
56582ab2b2
@ -67,6 +67,18 @@ void HackRFOutputThread::run()
|
|||||||
{
|
{
|
||||||
hackrf_error rc;
|
hackrf_error rc;
|
||||||
|
|
||||||
|
m_running = true;
|
||||||
|
m_startWaiter.wakeAll();
|
||||||
|
|
||||||
|
|
||||||
|
if (hackrf_is_streaming(m_dev) == HACKRF_TRUE)
|
||||||
|
{
|
||||||
|
qDebug("HackRFInputThread::run: HackRF is streaming already");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
qDebug("HackRFInputThread::run: HackRF is not streaming");
|
||||||
|
|
||||||
rc = (hackrf_error) hackrf_start_tx(m_dev, tx_callback, this);
|
rc = (hackrf_error) hackrf_start_tx(m_dev, tx_callback, this);
|
||||||
|
|
||||||
if (rc == HACKRF_SUCCESS)
|
if (rc == HACKRF_SUCCESS)
|
||||||
@ -77,24 +89,15 @@ void HackRFOutputThread::run()
|
|||||||
{
|
{
|
||||||
qDebug("HackRFOutputThread::run: failed to start HackRF Tx: %s", hackrf_error_name(rc));
|
qDebug("HackRFOutputThread::run: failed to start HackRF Tx: %s", hackrf_error_name(rc));
|
||||||
}
|
}
|
||||||
|
|
||||||
m_running = true;
|
|
||||||
m_startWaiter.wakeAll();
|
|
||||||
|
|
||||||
if (rc == HACKRF_SUCCESS)
|
|
||||||
{
|
|
||||||
if (hackrf_is_streaming(m_dev) == HACKRF_TRUE) {
|
|
||||||
qDebug("HackRFThread::run: HackRF is streaming");
|
|
||||||
} else {
|
|
||||||
qDebug("HackRFThread::run: HackRF is not streaming");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
while ((m_running) && (hackrf_is_streaming(m_dev) == HACKRF_TRUE))
|
while ((m_running) && (hackrf_is_streaming(m_dev) == HACKRF_TRUE))
|
||||||
{
|
{
|
||||||
usleep(200000);
|
usleep(200000);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
if (hackrf_is_streaming(m_dev) == HACKRF_TRUE)
|
||||||
|
{
|
||||||
rc = (hackrf_error) hackrf_stop_tx(m_dev);
|
rc = (hackrf_error) hackrf_stop_tx(m_dev);
|
||||||
|
|
||||||
if (rc == HACKRF_SUCCESS)
|
if (rc == HACKRF_SUCCESS)
|
||||||
@ -105,6 +108,7 @@ void HackRFOutputThread::run()
|
|||||||
{
|
{
|
||||||
qDebug("HackRFOutputThread::run: failed to stop HackRF Tx: %s", hackrf_error_name(rc));
|
qDebug("HackRFOutputThread::run: failed to stop HackRF Tx: %s", hackrf_error_name(rc));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
m_running = false;
|
m_running = false;
|
||||||
}
|
}
|
||||||
|
@ -74,43 +74,46 @@ void HackRFInputThread::run()
|
|||||||
{
|
{
|
||||||
hackrf_error rc;
|
hackrf_error rc;
|
||||||
|
|
||||||
|
m_running = true;
|
||||||
|
m_startWaiter.wakeAll();
|
||||||
|
|
||||||
|
if (hackrf_is_streaming(m_dev) == HACKRF_TRUE)
|
||||||
|
{
|
||||||
|
qDebug("HackRFInputThread::run: HackRF is streaming already");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
qDebug("HackRFInputThread::run: HackRF is not streaming");
|
||||||
|
|
||||||
rc = (hackrf_error) hackrf_start_rx(m_dev, rx_callback, this);
|
rc = (hackrf_error) hackrf_start_rx(m_dev, rx_callback, this);
|
||||||
|
|
||||||
if (rc == HACKRF_SUCCESS)
|
if (rc == HACKRF_SUCCESS)
|
||||||
{
|
{
|
||||||
qDebug("HackRFThread::run: started HackRF Rx");
|
qDebug("HackRFInputThread::run: started HackRF Rx");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
qDebug("HackRFThread::run: failed to start HackRF Rx: %s", hackrf_error_name(rc));
|
qDebug("HackRFInputThread::run: failed to start HackRF Rx: %s", hackrf_error_name(rc));
|
||||||
}
|
}
|
||||||
|
|
||||||
m_running = true;
|
|
||||||
m_startWaiter.wakeAll();
|
|
||||||
|
|
||||||
if (rc == HACKRF_SUCCESS)
|
|
||||||
{
|
|
||||||
if (hackrf_is_streaming(m_dev) == HACKRF_TRUE) {
|
|
||||||
qDebug("HackRFThread::run: HackRF is streaming");
|
|
||||||
} else {
|
|
||||||
qDebug("HackRFThread::run: HackRF is not streaming");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
while ((m_running) && (hackrf_is_streaming(m_dev) == HACKRF_TRUE))
|
while ((m_running) && (hackrf_is_streaming(m_dev) == HACKRF_TRUE))
|
||||||
{
|
{
|
||||||
usleep(200000);
|
usleep(200000);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
if (hackrf_is_streaming(m_dev) == HACKRF_TRUE)
|
||||||
|
{
|
||||||
rc = (hackrf_error) hackrf_stop_rx(m_dev);
|
rc = (hackrf_error) hackrf_stop_rx(m_dev);
|
||||||
|
|
||||||
if (rc == HACKRF_SUCCESS)
|
if (rc == HACKRF_SUCCESS)
|
||||||
{
|
{
|
||||||
qDebug("HackRFThread::run: stopped HackRF Rx");
|
qDebug("HackRFInputThread::run: stopped HackRF Rx");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
qDebug("HackRFThread::run: failed to stop HackRF Rx: %s", hackrf_error_name(rc));
|
qDebug("HackRFInputThread::run: failed to stop HackRF Rx: %s", hackrf_error_name(rc));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_running = false;
|
m_running = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user