SDRAngel  4.11.5
Developer docs for <a href="https://github.com/f4exb/sdrangel">SDRangel<\a>, an Open Source Qt5 / OpenGL 3.0+ SDR and signal analyzer frontend to various hardware.
Public Member Functions | Private Slots | Private Member Functions | Private Attributes | List of all members
AMBEDevicesDialog Class Reference

#include <ambedevicesdialog.h>

Inherits QDialog.

+ Collaboration diagram for AMBEDevicesDialog:

Public Member Functions

 AMBEDevicesDialog (AMBEEngine *ambeEngine, QWidget *parent=nullptr)
 
 ~AMBEDevicesDialog ()
 

Private Slots

void on_importSerial_clicked (bool checked)
 
void on_importAllSerial_clicked (bool checked)
 
void on_removeAmbeDevice_clicked (bool checked)
 
void on_refreshAmbeList_clicked (bool checked)
 
void on_clearAmbeList_clicked (bool checked)
 
void on_importAddress_clicked (bool checked)
 

Private Member Functions

void populateSerialList ()
 
void refreshInUseList ()
 

Private Attributes

Ui::AMBEDevicesDialog * ui
 
AMBEEnginem_ambeEngine
 

Detailed Description

Definition at line 33 of file ambedevicesdialog.h.

Constructor & Destructor Documentation

◆ AMBEDevicesDialog()

AMBEDevicesDialog::AMBEDevicesDialog ( AMBEEngine ambeEngine,
QWidget *  parent = nullptr 
)
explicit

Definition at line 25 of file ambedevicesdialog.cpp.

References populateSerialList(), refreshInUseList(), and ui.

25  :
26  QDialog(parent),
27  ui(new Ui::AMBEDevicesDialog),
28  m_ambeEngine(ambeEngine)
29 {
30  ui->setupUi(this);
33 }
AMBEEngine * m_ambeEngine
Ui::AMBEDevicesDialog * ui
+ Here is the call graph for this function:

◆ ~AMBEDevicesDialog()

AMBEDevicesDialog::~AMBEDevicesDialog ( )

Definition at line 35 of file ambedevicesdialog.cpp.

References ui.

36 {
37  delete ui;
38 }
Ui::AMBEDevicesDialog * ui

Member Function Documentation

◆ on_clearAmbeList_clicked

void AMBEDevicesDialog::on_clearAmbeList_clicked ( bool  checked)
privateslot

Definition at line 146 of file ambedevicesdialog.cpp.

References m_ambeEngine, AMBEEngine::releaseAll(), and ui.

147 {
148  if (ui->ambeDeviceRefs->count() == 0)
149  {
150  ui->statusText->setText("No active items");
151  return;
152  }
153 
155  ui->ambeDeviceRefs->clear();
156  ui->statusText->setText("All items released");
157 }
void releaseAll()
Definition: ambeengine.cpp:261
AMBEEngine * m_ambeEngine
Ui::AMBEDevicesDialog * ui
+ Here is the call graph for this function:

◆ on_importAddress_clicked

void AMBEDevicesDialog::on_importAddress_clicked ( bool  checked)
privateslot

Definition at line 159 of file ambedevicesdialog.cpp.

References arg(), m_ambeEngine, AMBEEngine::registerController(), and ui.

160 {
161  QString addressAndPort = ui->ambeAddressText->text();
162 
163  QList<QListWidgetItem*> foundItems = ui->ambeDeviceRefs->findItems(addressAndPort, Qt::MatchFixedString|Qt::MatchCaseSensitive);
164 
165  if (foundItems.size() == 0)
166  {
167  if (m_ambeEngine->registerController(addressAndPort.toStdString()))
168  {
169  ui->ambeDeviceRefs->addItem(addressAndPort);
170  ui->statusText->setText(tr("%1 added").arg(addressAndPort));
171  }
172  else
173  {
174  ui->statusText->setText(tr("Cannot open %1").arg(addressAndPort));
175  }
176  }
177  else
178  {
179  ui->statusText->setText("Address already in use");
180  }
181 }
bool registerController(const std::string &deviceRef)
create a new controller for the device in reference
Definition: ambeengine.cpp:214
Fixed< IntType, IntBits > arg(const std::complex< Fixed< IntType, IntBits > > &val)
Definition: fixed.h:2401
AMBEEngine * m_ambeEngine
Ui::AMBEDevicesDialog * ui
+ Here is the call graph for this function:

◆ on_importAllSerial_clicked

void AMBEDevicesDialog::on_importAllSerial_clicked ( bool  checked)
privateslot

Definition at line 99 of file ambedevicesdialog.cpp.

References arg(), i, m_ambeEngine, AMBEEngine::registerController(), and ui.

100 {
101  (void) checked;
102  int count = 0;
103 
104  for (int i = 0; i < ui->ambeSerialDevices->count(); i++)
105  {
106  const QListWidgetItem *serialItem = ui->ambeSerialDevices->item(i);
107  QString serialName = serialItem->text();
108  QList<QListWidgetItem*> foundItems = ui->ambeDeviceRefs->findItems(serialName, Qt::MatchFixedString|Qt::MatchCaseSensitive);
109 
110  if (foundItems.size() == 0)
111  {
112  if (m_ambeEngine->registerController(serialName.toStdString()))
113  {
114  ui->ambeDeviceRefs->addItem(serialName);
115  count++;
116  }
117  }
118  }
119 
120  ui->statusText->setText(tr("%1 devices added").arg(count));
121 }
bool registerController(const std::string &deviceRef)
create a new controller for the device in reference
Definition: ambeengine.cpp:214
Fixed< IntType, IntBits > arg(const std::complex< Fixed< IntType, IntBits > > &val)
Definition: fixed.h:2401
int32_t i
Definition: decimators.h:244
AMBEEngine * m_ambeEngine
Ui::AMBEDevicesDialog * ui
+ Here is the call graph for this function:

◆ on_importSerial_clicked

void AMBEDevicesDialog::on_importSerial_clicked ( bool  checked)
privateslot

Definition at line 67 of file ambedevicesdialog.cpp.

References arg(), m_ambeEngine, AMBEEngine::registerController(), and ui.

68 {
69  (void) checked;
70  QListWidgetItem *serialItem = ui->ambeSerialDevices->currentItem();
71 
72  if (!serialItem)
73  {
74  ui->statusText->setText("No selection");
75  return;
76  }
77 
78  QString serialName = serialItem->text();
79  QList<QListWidgetItem*> foundItems = ui->ambeDeviceRefs->findItems(serialName, Qt::MatchFixedString|Qt::MatchCaseSensitive);
80 
81  if (foundItems.size() == 0)
82  {
83  if (m_ambeEngine->registerController(serialName.toStdString()))
84  {
85  ui->ambeDeviceRefs->addItem(serialName);
86  ui->statusText->setText(tr("%1 added").arg(serialName));
87  }
88  else
89  {
90  ui->statusText->setText(tr("Cannot open %1").arg(serialName));
91  }
92  }
93  else
94  {
95  ui->statusText->setText("Device already in use");
96  }
97 }
bool registerController(const std::string &deviceRef)
create a new controller for the device in reference
Definition: ambeengine.cpp:214
Fixed< IntType, IntBits > arg(const std::complex< Fixed< IntType, IntBits > > &val)
Definition: fixed.h:2401
AMBEEngine * m_ambeEngine
Ui::AMBEDevicesDialog * ui
+ Here is the call graph for this function:

◆ on_refreshAmbeList_clicked

void AMBEDevicesDialog::on_refreshAmbeList_clicked ( bool  checked)
privateslot

Definition at line 140 of file ambedevicesdialog.cpp.

References refreshInUseList(), and ui.

141 {
143  ui->statusText->setText("In use refreshed");
144 }
Ui::AMBEDevicesDialog * ui
+ Here is the call graph for this function:

◆ on_removeAmbeDevice_clicked

void AMBEDevicesDialog::on_removeAmbeDevice_clicked ( bool  checked)
privateslot

Definition at line 123 of file ambedevicesdialog.cpp.

References arg(), m_ambeEngine, refreshInUseList(), AMBEEngine::releaseController(), and ui.

124 {
125  (void) checked;
126  QListWidgetItem *deviceItem = ui->ambeDeviceRefs->currentItem();
127 
128  if (!deviceItem)
129  {
130  ui->statusText->setText("No selection");
131  return;
132  }
133 
134  QString deviceName = deviceItem->text();
135  m_ambeEngine->releaseController(deviceName.toStdString());
136  ui->statusText->setText(tr("%1 removed").arg(deviceName));
138 }
Fixed< IntType, IntBits > arg(const std::complex< Fixed< IntType, IntBits > > &val)
Definition: fixed.h:2401
AMBEEngine * m_ambeEngine
void releaseController(const std::string &deviceRef)
release controller resources for the device in reference
Definition: ambeengine.cpp:239
Ui::AMBEDevicesDialog * ui
+ Here is the call graph for this function:

◆ populateSerialList()

void AMBEDevicesDialog::populateSerialList ( )
private

Definition at line 40 of file ambedevicesdialog.cpp.

References m_ambeEngine, AMBEEngine::scan(), and ui.

Referenced by AMBEDevicesDialog().

41 {
42  std::vector<QString> ambeSerialDevices;
43  m_ambeEngine->scan(ambeSerialDevices);
44  ui->ambeSerialDevices->clear();
45  std::vector<QString>::const_iterator it = ambeSerialDevices.begin();
46 
47  for (; it != ambeSerialDevices.end(); ++it)
48  {
49  ui->ambeSerialDevices->addItem(QString(*it));
50  }
51 }
void scan(std::vector< QString > &ambeDevices)
Definition: ambeengine.cpp:191
AMBEEngine * m_ambeEngine
Ui::AMBEDevicesDialog * ui
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ refreshInUseList()

void AMBEDevicesDialog::refreshInUseList ( )
private

Definition at line 53 of file ambedevicesdialog.cpp.

References AMBEEngine::getDeviceRefs(), m_ambeEngine, and ui.

Referenced by AMBEDevicesDialog(), on_refreshAmbeList_clicked(), and on_removeAmbeDevice_clicked().

54 {
55  std::vector<QString> inUseDevices;
56  m_ambeEngine->getDeviceRefs(inUseDevices);
57  ui->ambeDeviceRefs->clear();
58  std::vector<QString>::const_iterator it = inUseDevices.begin();
59 
60  for (; it != inUseDevices.end(); ++it)
61  {
62  qDebug("AMBEDevicesDialog::refreshInUseList: %s", qPrintable(*it));
63  ui->ambeDeviceRefs->addItem(*it);
64  }
65 }
void getDeviceRefs(std::vector< QString > &devicesRefs)
reference of the devices used (device path or url)
Definition: ambeengine.cpp:279
AMBEEngine * m_ambeEngine
Ui::AMBEDevicesDialog * ui
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ m_ambeEngine

AMBEEngine* AMBEDevicesDialog::m_ambeEngine
private

◆ ui

Ui::AMBEDevicesDialog* AMBEDevicesDialog::ui
private

The documentation for this class was generated from the following files: