mirror of
				https://github.com/f4exb/sdrangel.git
				synced 2025-11-04 05:30:32 -05:00 
			
		
		
		
	HackRF: switch over Rx / Tx with the start button
This commit is contained in:
		
							parent
							
								
									62b6281370
								
							
						
					
					
						commit
						258515b5de
					
				@ -26,6 +26,7 @@
 | 
				
			|||||||
#include "dsp/dspengine.h"
 | 
					#include "dsp/dspengine.h"
 | 
				
			||||||
#include "dsp/dspcommands.h"
 | 
					#include "dsp/dspcommands.h"
 | 
				
			||||||
#include "device/devicesinkapi.h"
 | 
					#include "device/devicesinkapi.h"
 | 
				
			||||||
 | 
					#include "device/devicesourceapi.h"
 | 
				
			||||||
#include "hackrf/devicehackrfvalues.h"
 | 
					#include "hackrf/devicehackrfvalues.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "ui_hackrfoutputgui.h"
 | 
					#include "ui_hackrfoutputgui.h"
 | 
				
			||||||
@ -269,6 +270,13 @@ void HackRFOutputGui::on_startStop_toggled(bool checked)
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
    if (checked)
 | 
					    if (checked)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
 | 
					        // forcibly stop the Rx if present before starting
 | 
				
			||||||
 | 
					        if (m_deviceAPI->getSourceBuddies().size() > 0)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            DeviceSourceAPI *buddy = m_deviceAPI->getSourceBuddies()[0];
 | 
				
			||||||
 | 
					            buddy->stopAcquisition();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (m_deviceAPI->initGeneration())
 | 
					        if (m_deviceAPI->initGeneration())
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            m_deviceAPI->startGeneration();
 | 
					            m_deviceAPI->startGeneration();
 | 
				
			||||||
@ -303,6 +311,7 @@ void HackRFOutputGui::updateStatus()
 | 
				
			|||||||
                break;
 | 
					                break;
 | 
				
			||||||
            case DSPDeviceSinkEngine::StIdle:
 | 
					            case DSPDeviceSinkEngine::StIdle:
 | 
				
			||||||
                ui->startStop->setStyleSheet("QToolButton { background-color : blue; }");
 | 
					                ui->startStop->setStyleSheet("QToolButton { background-color : blue; }");
 | 
				
			||||||
 | 
					                ui->startStop->setChecked(false);
 | 
				
			||||||
                break;
 | 
					                break;
 | 
				
			||||||
            case DSPDeviceSinkEngine::StRunning:
 | 
					            case DSPDeviceSinkEngine::StRunning:
 | 
				
			||||||
                ui->startStop->setStyleSheet("QToolButton { background-color : green; }");
 | 
					                ui->startStop->setStyleSheet("QToolButton { background-color : green; }");
 | 
				
			||||||
 | 
				
			|||||||
@ -25,8 +25,9 @@
 | 
				
			|||||||
#include "gui/glspectrum.h"
 | 
					#include "gui/glspectrum.h"
 | 
				
			||||||
#include "dsp/dspengine.h"
 | 
					#include "dsp/dspengine.h"
 | 
				
			||||||
#include "dsp/dspcommands.h"
 | 
					#include "dsp/dspcommands.h"
 | 
				
			||||||
#include <device/devicesourceapi.h>
 | 
					#include "device/devicesourceapi.h"
 | 
				
			||||||
#include <dsp/filerecord.h>
 | 
					#include "device/devicesinkapi.h"
 | 
				
			||||||
 | 
					#include "dsp/filerecord.h"
 | 
				
			||||||
#include "hackrf/devicehackrfvalues.h"
 | 
					#include "hackrf/devicehackrfvalues.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "ui_hackrfinputgui.h"
 | 
					#include "ui_hackrfinputgui.h"
 | 
				
			||||||
@ -326,6 +327,13 @@ void HackRFInputGui::on_startStop_toggled(bool checked)
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
    if (checked)
 | 
					    if (checked)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
 | 
					        // forcibly stop the Tx if present before starting
 | 
				
			||||||
 | 
					        if (m_deviceAPI->getSinkBuddies().size() > 0)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            DeviceSinkAPI *buddy = m_deviceAPI->getSinkBuddies()[0];
 | 
				
			||||||
 | 
					            buddy->stopGeneration();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (m_deviceAPI->initAcquisition())
 | 
					        if (m_deviceAPI->initAcquisition())
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            m_deviceAPI->startAcquisition();
 | 
					            m_deviceAPI->startAcquisition();
 | 
				
			||||||
@ -375,6 +383,7 @@ void HackRFInputGui::updateStatus()
 | 
				
			|||||||
                break;
 | 
					                break;
 | 
				
			||||||
            case DSPDeviceSourceEngine::StIdle:
 | 
					            case DSPDeviceSourceEngine::StIdle:
 | 
				
			||||||
                ui->startStop->setStyleSheet("QToolButton { background-color : blue; }");
 | 
					                ui->startStop->setStyleSheet("QToolButton { background-color : blue; }");
 | 
				
			||||||
 | 
					                ui->startStop->setChecked(false);
 | 
				
			||||||
                break;
 | 
					                break;
 | 
				
			||||||
            case DSPDeviceSourceEngine::StRunning:
 | 
					            case DSPDeviceSourceEngine::StRunning:
 | 
				
			||||||
                ui->startStop->setStyleSheet("QToolButton { background-color : green; }");
 | 
					                ui->startStop->setStyleSheet("QToolButton { background-color : green; }");
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user