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.
devicelimesdrshared.h
Go to the documentation of this file.
1 // Copyright (C) 2017 Edouard Griffiths, F4EXB //
3 // //
4 // This program is free software; you can redistribute it and/or modify //
5 // it under the terms of the GNU General Public License as published by //
6 // the Free Software Foundation as version 3 of the License, or //
7 // (at your option) any later version. //
8 // //
9 // This program is distributed in the hope that it will be useful, //
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of //
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
12 // GNU General Public License V3 for more details. //
13 // //
14 // You should have received a copy of the GNU General Public License //
15 // along with this program. If not, see <http://www.gnu.org/licenses/>. //
17 
18 #ifndef DEVICES_LIMESDR_DEVICELIMESDRSHARED_H_
19 #define DEVICES_LIMESDR_DEVICELIMESDRSHARED_H_
20 
21 #include <cstddef>
22 #include "devicelimesdrparam.h"
23 #include "util/message.h"
24 #include "export.h"
25 
30 {
31 public:
34 
35  public:
36  int getDevSampleRate() const { return m_devSampleRate; }
37  int getLog2HardDecimInterp() const { return m_log2HardDecimInterp; }
38  uint64_t getCenterFrequency() const { return m_centerFrequency; }
39  bool getRxElseTx() const { return m_rxElseTx; }
40 
42  int devSampleRate,
43  int log2HardDecimInterp,
44  uint64_t centerFrequency,
45  bool rxElseTx)
46  {
47  return new MsgReportBuddyChange(
48  devSampleRate,
49  log2HardDecimInterp,
50  centerFrequency,
51  rxElseTx);
52  }
53 
54  private:
58  bool m_rxElseTx;
59 
61  int devSampleRate,
62  int log2HardDecimInterp,
63  uint64_t centerFrequency,
64  bool rxElseTx) :
65  Message(),
66  m_devSampleRate(devSampleRate),
67  m_log2HardDecimInterp(log2HardDecimInterp),
68  m_centerFrequency(centerFrequency),
69  m_rxElseTx(rxElseTx)
70  { }
71  };
72 
75 
76  public:
77  bool getExtClock() const { return m_extClock; }
78  uint32_t getExtClockFeq() const { return m_extClockFreq; }
79 
81  bool extClock,
82  uint32_t m_extClockFreq)
83  {
84  return new MsgReportClockSourceChange(
85  extClock,
86  m_extClockFreq);
87  }
88 
89  private:
90  bool m_extClock;
92 
94  bool extClock,
95  uint32_t m_extClockFreq) :
96  Message(),
97  m_extClock(extClock),
98  m_extClockFreq(m_extClockFreq)
99  { }
100  };
101 
104 
105  public:
106  float getTemperature() const { return m_temperature; }
107  uint8_t getGPIOPins() const { return m_gpioPins; }
108 
109  static MsgReportDeviceInfo* create(float temperature, uint8_t gpioPins)
110  {
111  return new MsgReportDeviceInfo(temperature, gpioPins);
112  }
113 
114  private:
117 
118  MsgReportDeviceInfo(float temperature, uint8_t gpioPins) :
119  Message(),
120  m_temperature(temperature),
121  m_gpioPins(gpioPins)
122  { }
123  };
124 
127 
128  public:
129  uint8_t getGPIODir() const { return m_gpioDir; }
130  uint8_t getGPIOPins() const { return m_gpioPins; }
131 
132  static MsgReportGPIOChange* create(uint8_t gpioDir, uint8_t gpioPins)
133  {
134  return new MsgReportGPIOChange(gpioDir, gpioPins);
135  }
136 
137  private:
140 
141  MsgReportGPIOChange(uint8_t gpioDir, uint8_t gpioPins) :
142  m_gpioDir(gpioDir),
143  m_gpioPins(gpioPins)
144  {}
145  };
146 
148  {
149  public:
150  virtual void startWork() = 0;
151  virtual void stopWork() = 0;
152  virtual void setDeviceSampleRate(int sampleRate) = 0;
153  virtual bool isRunning() = 0;
154  };
155 
157  int m_channel;
163 
164  static const float m_sampleFifoLengthInSeconds;
165  static const int m_sampleFifoMinSize;
166 
168  m_deviceParams(0),
169  m_channel(-1),
170  m_thread(0),
171  m_ncoFrequency(0),
172  m_centerFrequency(0),
173  m_log2Soft(0),
174  m_threadWasRunning(false)
175  {}
176 
178  {}
179 };
180 
181 #endif /* DEVICES_LIMESDR_DEVICELIMESDRSHARED_H_ */
int m_channel
logical device channel number (-1 if none)
MsgReportDeviceInfo(float temperature, uint8_t gpioPins)
MsgReportBuddyChange(int devSampleRate, int log2HardDecimInterp, uint64_t centerFrequency, bool rxElseTx)
bool m_rxElseTx
tells which side initiated the message
static MsgReportBuddyChange * create(int devSampleRate, int log2HardDecimInterp, uint64_t centerFrequency, bool rxElseTx)
MsgReportGPIOChange(uint8_t gpioDir, uint8_t gpioPins)
#define DEVICES_API
Definition: export.h:76
unsigned int uint32_t
Definition: rtptypes_win.h:46
uint64_t m_centerFrequency
Center frequency.
bool m_threadWasRunning
flag to know if thread needs to be resumed after suspend
unsigned char uint8_t
Definition: rtptypes_win.h:42
bool m_extClock
True if external clock source.
int m_devSampleRate
device/host sample rate
#define MESSAGE_CLASS_DECLARATION
Definition: message.h:43
static const float m_sampleFifoLengthInSeconds
static const int m_sampleFifoMinSize
int m_log2HardDecimInterp
log2 of hardware decimation or interpolation
DeviceLimeSDRParams * m_deviceParams
unique hardware device parameters
MsgReportClockSourceChange(bool extClock, uint32_t m_extClockFreq)
uint32_t m_extClockFreq
Frequency (Hz) of external clock source.
ThreadInterface * m_thread
holds the thread address if started else 0
static MsgReportGPIOChange * create(uint8_t gpioDir, uint8_t gpioPins)
static MsgReportClockSourceChange * create(bool extClock, uint32_t m_extClockFreq)
unsigned __int64 uint64_t
Definition: rtptypes_win.h:48
static MsgReportDeviceInfo * create(float temperature, uint8_t gpioPins)