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.
ambeengine.h
Go to the documentation of this file.
1 // Copyright (C) 2019 F4EXB //
3 // written by Edouard Griffiths //
4 // //
5 // This program is free software; you can redistribute it and/or modify //
6 // it under the terms of the GNU General Public License as published by //
7 // the Free Software Foundation as version 3 of the License, or //
8 // (at your option) any later version. //
9 // //
10 // This program is distributed in the hope that it will be useful, //
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of //
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
13 // GNU General Public License V3 for more details. //
14 // //
15 // You should have received a copy of the GNU General Public License //
16 // along with this program. If not, see <http://www.gnu.org/licenses/>. //
18 
19 #ifndef SDRBASE_AMBE_AMBEENGINE_H_
20 #define SDRBASE_AMBE_AMBEENGINE_H_
21 
22 #include <vector>
23 #include <string>
24 
25 #include <QObject>
26 #include <QMutex>
27 #include <QString>
28 #include <QByteArray>
29 
30 #include "export.h"
31 
32 class QThread;
33 class AMBEWorker;
34 class AudioFifo;
35 
36 class SDRBASE_API AMBEEngine : public QObject
37 {
38  Q_OBJECT
39 public:
40  AMBEEngine();
41  ~AMBEEngine();
42 
43  void scan(std::vector<QString>& ambeDevices);
44  void releaseAll();
45 
46  int getNbDevices() const { return m_controllers.size(); }
47  void getDeviceRefs(std::vector<QString>& devicesRefs);
48  bool registerController(const std::string& deviceRef);
49  void releaseController(const std::string& deviceRef);
50 
51  void pushMbeFrame(
52  const unsigned char *mbeFrame,
53  int mbeRateIndex,
54  int mbeVolumeIndex,
55  unsigned char channels,
56  bool useHP,
57  int upsampling,
58  AudioFifo *audioFifo);
59 
60  QByteArray serialize() const;
61  bool deserialize(const QByteArray& data);
62 
63 private:
65  {
67  thread(nullptr),
68  worker(nullptr)
69  {}
70 
71  QThread *thread;
73  std::string device;
74  };
75 
76 #ifndef __WINDOWS__
77  static std::string get_driver(const std::string& tty);
78  static void register_comport(std::vector<std::string>& comList, std::vector<std::string>& comList8250, const std::string& dir);
79  static void probe_serial8250_comports(std::vector<std::string>& comList, std::vector<std::string> comList8250);
80 #endif
81  void getComList();
82 
83  std::vector<AMBEController> m_controllers;
84  std::vector<std::string> m_comList;
85  std::vector<std::string> m_comList8250;
86  QMutex m_mutex;
87 };
88 
89 
90 
91 #endif /* SDRBASE_AMBE_AMBEENGINE_H_ */
std::vector< std::string > m_comList8250
Definition: ambeengine.h:85
std::vector< std::string > m_comList
Definition: ambeengine.h:84
int getNbDevices() const
number of devices used
Definition: ambeengine.h:46
QMutex m_mutex
Definition: ambeengine.h:86
#define SDRBASE_API
Definition: export.h:40
std::vector< AMBEController > m_controllers
Definition: ambeengine.h:83