mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-12-23 01:55:48 -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,44 +67,48 @@ void HackRFOutputThread::run()
|
|||||||
{
|
{
|
||||||
hackrf_error rc;
|
hackrf_error rc;
|
||||||
|
|
||||||
rc = (hackrf_error) hackrf_start_tx(m_dev, tx_callback, this);
|
|
||||||
|
|
||||||
if (rc == HACKRF_SUCCESS)
|
|
||||||
{
|
|
||||||
qDebug("HackRFOutputThread::run: started HackRF Tx");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
qDebug("HackRFOutputThread::run: failed to start HackRF Tx: %s", hackrf_error_name(rc));
|
|
||||||
}
|
|
||||||
|
|
||||||
m_running = true;
|
m_running = true;
|
||||||
m_startWaiter.wakeAll();
|
m_startWaiter.wakeAll();
|
||||||
|
|
||||||
if (rc == HACKRF_SUCCESS)
|
|
||||||
{
|
if (hackrf_is_streaming(m_dev) == HACKRF_TRUE)
|
||||||
if (hackrf_is_streaming(m_dev) == HACKRF_TRUE) {
|
{
|
||||||
qDebug("HackRFThread::run: HackRF is streaming");
|
qDebug("HackRFInputThread::run: HackRF is streaming already");
|
||||||
} else {
|
}
|
||||||
qDebug("HackRFThread::run: HackRF is not streaming");
|
else
|
||||||
|
{
|
||||||
|
qDebug("HackRFInputThread::run: HackRF is not streaming");
|
||||||
|
|
||||||
|
rc = (hackrf_error) hackrf_start_tx(m_dev, tx_callback, this);
|
||||||
|
|
||||||
|
if (rc == HACKRF_SUCCESS)
|
||||||
|
{
|
||||||
|
qDebug("HackRFOutputThread::run: started HackRF Tx");
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
qDebug("HackRFOutputThread::run: failed to start HackRF Tx: %s", hackrf_error_name(rc));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
while ((m_running) && (hackrf_is_streaming(m_dev) == HACKRF_TRUE))
|
while ((m_running) && (hackrf_is_streaming(m_dev) == HACKRF_TRUE))
|
||||||
{
|
{
|
||||||
usleep(200000);
|
usleep(200000);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
rc = (hackrf_error) hackrf_stop_tx(m_dev);
|
if (hackrf_is_streaming(m_dev) == HACKRF_TRUE)
|
||||||
|
{
|
||||||
|
rc = (hackrf_error) hackrf_stop_tx(m_dev);
|
||||||
|
|
||||||
if (rc == HACKRF_SUCCESS)
|
if (rc == HACKRF_SUCCESS)
|
||||||
{
|
{
|
||||||
qDebug("HackRFOutputThread::run: stopped HackRF Tx");
|
qDebug("HackRFOutputThread::run: stopped HackRF Tx");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
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,44 +74,47 @@ void HackRFInputThread::run()
|
|||||||
{
|
{
|
||||||
hackrf_error rc;
|
hackrf_error rc;
|
||||||
|
|
||||||
rc = (hackrf_error) hackrf_start_rx(m_dev, rx_callback, this);
|
|
||||||
|
|
||||||
if (rc == HACKRF_SUCCESS)
|
|
||||||
{
|
|
||||||
qDebug("HackRFThread::run: started HackRF Rx");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
qDebug("HackRFThread::run: failed to start HackRF Rx: %s", hackrf_error_name(rc));
|
|
||||||
}
|
|
||||||
|
|
||||||
m_running = true;
|
m_running = true;
|
||||||
m_startWaiter.wakeAll();
|
m_startWaiter.wakeAll();
|
||||||
|
|
||||||
if (rc == HACKRF_SUCCESS)
|
if (hackrf_is_streaming(m_dev) == HACKRF_TRUE)
|
||||||
{
|
{
|
||||||
if (hackrf_is_streaming(m_dev) == HACKRF_TRUE) {
|
qDebug("HackRFInputThread::run: HackRF is streaming already");
|
||||||
qDebug("HackRFThread::run: HackRF is streaming");
|
}
|
||||||
} else {
|
else
|
||||||
qDebug("HackRFThread::run: HackRF is not streaming");
|
{
|
||||||
}
|
qDebug("HackRFInputThread::run: HackRF is not streaming");
|
||||||
|
|
||||||
while ((m_running) && (hackrf_is_streaming(m_dev) == HACKRF_TRUE))
|
rc = (hackrf_error) hackrf_start_rx(m_dev, rx_callback, this);
|
||||||
{
|
|
||||||
usleep(200000);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
rc = (hackrf_error) hackrf_stop_rx(m_dev);
|
if (rc == HACKRF_SUCCESS)
|
||||||
|
{
|
||||||
|
qDebug("HackRFInputThread::run: started HackRF Rx");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
qDebug("HackRFInputThread::run: failed to start HackRF Rx: %s", hackrf_error_name(rc));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (rc == HACKRF_SUCCESS)
|
while ((m_running) && (hackrf_is_streaming(m_dev) == HACKRF_TRUE))
|
||||||
{
|
{
|
||||||
qDebug("HackRFThread::run: stopped HackRF Rx");
|
usleep(200000);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
if (hackrf_is_streaming(m_dev) == HACKRF_TRUE)
|
||||||
qDebug("HackRFThread::run: failed to stop HackRF Rx: %s", hackrf_error_name(rc));
|
{
|
||||||
}
|
rc = (hackrf_error) hackrf_stop_rx(m_dev);
|
||||||
|
|
||||||
|
if (rc == HACKRF_SUCCESS)
|
||||||
|
{
|
||||||
|
qDebug("HackRFInputThread::run: stopped HackRF Rx");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
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