| 
									
										
										
										
											2019-05-13 01:55:12 +02:00
										 |  |  | ///////////////////////////////////////////////////////////////////////////////////
 | 
					
						
							|  |  |  | // Copyright (C) 2019 F4EXB                                                      //
 | 
					
						
							|  |  |  | // written by Edouard Griffiths                                                  //
 | 
					
						
							|  |  |  | //                                                                               //
 | 
					
						
							|  |  |  | // This program is free software; you can redistribute it and/or modify          //
 | 
					
						
							|  |  |  | // it under the terms of the GNU General Public License as published by          //
 | 
					
						
							|  |  |  | // the Free Software Foundation as version 3 of the License, or                  //
 | 
					
						
							|  |  |  | // (at your option) any later version.                                           //
 | 
					
						
							|  |  |  | //                                                                               //
 | 
					
						
							|  |  |  | // This program is distributed in the hope that it will be useful,               //
 | 
					
						
							|  |  |  | // but WITHOUT ANY WARRANTY; without even the implied warranty of                //
 | 
					
						
							|  |  |  | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the                  //
 | 
					
						
							|  |  |  | // GNU General Public License V3 for more details.                               //
 | 
					
						
							|  |  |  | //                                                                               //
 | 
					
						
							|  |  |  | // You should have received a copy of the GNU General Public License             //
 | 
					
						
							|  |  |  | // along with this program. If not, see <http://www.gnu.org/licenses/>.          //
 | 
					
						
							|  |  |  | ///////////////////////////////////////////////////////////////////////////////////
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #ifndef SDRBASE_DSP_DEVICESAMPLEMIMO_H_
 | 
					
						
							|  |  |  | #define SDRBASE_DSP_DEVICESAMPLEMIMO_H_
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <vector>
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-25 18:39:17 +02:00
										 |  |  | #include "samplemififo.h"
 | 
					
						
							| 
									
										
										
										
											2019-10-17 00:58:36 +02:00
										 |  |  | #include "samplemofifo.h"
 | 
					
						
							| 
									
										
										
										
											2019-05-13 01:55:12 +02:00
										 |  |  | #include "util/message.h"
 | 
					
						
							|  |  |  | #include "util/messagequeue.h"
 | 
					
						
							|  |  |  | #include "export.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | namespace SWGSDRangel | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     class SWGDeviceSettings; | 
					
						
							|  |  |  |     class SWGDeviceState; | 
					
						
							|  |  |  |     class SWGDeviceReport; | 
					
						
							| 
									
										
										
										
											2020-03-09 04:01:23 +01:00
										 |  |  |     class SWGDeviceActions; | 
					
						
							| 
									
										
										
										
											2019-05-13 01:55:12 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class SDRBASE_API DeviceSampleMIMO : public QObject { | 
					
						
							|  |  |  | 	Q_OBJECT | 
					
						
							|  |  |  | public: | 
					
						
							| 
									
										
										
										
											2019-08-14 02:56:15 +02:00
										 |  |  |     enum MIMOType //!< Type of MIMO
 | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         MIMOAsynchronous,    //!< All streams are asynchronous (false MIMO)
 | 
					
						
							|  |  |  |         MIMOHalfSynchronous, //!< MI + MO (synchronous inputs on one side and synchronous outputs on the other side)
 | 
					
						
							|  |  |  |         MIMOFullSynchronous, //!< True MIMO (all streams synchronous)
 | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-05-13 01:55:12 +02:00
										 |  |  |     typedef enum { | 
					
						
							|  |  |  |         FC_POS_INFRA = 0, | 
					
						
							|  |  |  |         FC_POS_SUPRA, | 
					
						
							|  |  |  |         FC_POS_CENTER | 
					
						
							|  |  |  |     } fcPos_t; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	DeviceSampleMIMO(); | 
					
						
							|  |  |  | 	virtual ~DeviceSampleMIMO(); | 
					
						
							|  |  |  | 	virtual void destroy() = 0; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     virtual void init() = 0;  //!< initializations to be done when all collaborating objects are created and possibly connected
 | 
					
						
							| 
									
										
										
										
											2019-10-20 20:05:01 +02:00
										 |  |  | 	virtual bool startRx() = 0; | 
					
						
							|  |  |  | 	virtual void stopRx() = 0; | 
					
						
							|  |  |  | 	virtual bool startTx() = 0; | 
					
						
							|  |  |  | 	virtual void stopTx() = 0; | 
					
						
							| 
									
										
										
										
											2019-05-13 01:55:12 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     virtual QByteArray serialize() const = 0; | 
					
						
							|  |  |  |     virtual bool deserialize(const QByteArray& data) = 0; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	virtual const QString& getDeviceDescription() const = 0; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	virtual int getSinkSampleRate(int index) const = 0;                     //!< Sample rate exposed by the sink at index
 | 
					
						
							|  |  |  |     virtual void setSinkSampleRate(int sampleRate, int index) = 0;          //!< For when the sink sample rate is set externally
 | 
					
						
							|  |  |  | 	virtual quint64 getSinkCenterFrequency(int index) const = 0;            //!< Center frequency exposed by the sink at index
 | 
					
						
							|  |  |  |     virtual void setSinkCenterFrequency(qint64 centerFrequency, int index) = 0; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	virtual int getSourceSampleRate(int index) const = 0;                   //!< Sample rate exposed by the source at index
 | 
					
						
							|  |  |  |     virtual void setSourceSampleRate(int sampleRate, int index) = 0;        //!< For when the source sample rate is set externally
 | 
					
						
							|  |  |  | 	virtual quint64 getSourceCenterFrequency(int index) const = 0;          //!< Center frequency exposed by the source at index
 | 
					
						
							|  |  |  |     virtual void setSourceCenterFrequency(qint64 centerFrequency, int index) = 0; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-13 13:40:31 +02:00
										 |  |  |     virtual quint64 getMIMOCenterFrequency() const = 0; //!< Unique center frequency for preset identification or any unique reference
 | 
					
						
							| 
									
										
										
										
											2019-12-23 18:49:06 +01:00
										 |  |  |     virtual unsigned int getMIMOSampleRate() const = 0; //!< Unique sample rate for any unique reference
 | 
					
						
							| 
									
										
										
										
											2019-09-13 13:40:31 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-05-13 01:55:12 +02:00
										 |  |  | 	virtual bool handleMessage(const Message& message) = 0; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     virtual int webapiSettingsGet( | 
					
						
							|  |  |  |             SWGSDRangel::SWGDeviceSettings& response, | 
					
						
							|  |  |  |             QString& errorMessage) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         (void) response; | 
					
						
							|  |  |  |         errorMessage = "Not implemented"; | 
					
						
							|  |  |  |         return 501; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     virtual int webapiSettingsPutPatch( | 
					
						
							|  |  |  |             bool force, //!< true to force settings = put
 | 
					
						
							|  |  |  |             const QStringList& deviceSettingsKeys, | 
					
						
							|  |  |  |             SWGSDRangel::SWGDeviceSettings& response, | 
					
						
							|  |  |  |             QString& errorMessage) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         (void) force; | 
					
						
							|  |  |  |         (void) deviceSettingsKeys; | 
					
						
							|  |  |  |         (void) response; | 
					
						
							|  |  |  |         errorMessage = "Not implemented"; | 
					
						
							|  |  |  |         return 501; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     virtual int webapiRunGet( | 
					
						
							| 
									
										
										
										
											2019-12-24 19:08:11 +01:00
										 |  |  |             int subsystemIndex, | 
					
						
							| 
									
										
										
										
											2019-05-13 01:55:12 +02:00
										 |  |  |             SWGSDRangel::SWGDeviceState& response, | 
					
						
							|  |  |  |             QString& errorMessage) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         (void) response; | 
					
						
							| 
									
										
										
										
											2019-12-24 19:08:11 +01:00
										 |  |  |         (void) subsystemIndex; | 
					
						
							| 
									
										
										
										
											2019-05-13 01:55:12 +02:00
										 |  |  |         errorMessage = "Not implemented"; | 
					
						
							|  |  |  |         return 501; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     virtual int webapiRun(bool run, | 
					
						
							| 
									
										
										
										
											2019-12-24 19:08:11 +01:00
										 |  |  |             int subsystemIndex, | 
					
						
							| 
									
										
										
										
											2019-05-13 01:55:12 +02:00
										 |  |  |             SWGSDRangel::SWGDeviceState& response, | 
					
						
							|  |  |  |             QString& errorMessage) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         (void) run; | 
					
						
							| 
									
										
										
										
											2019-12-24 19:08:11 +01:00
										 |  |  |         (void) subsystemIndex; | 
					
						
							| 
									
										
										
										
											2019-05-13 01:55:12 +02:00
										 |  |  |         (void) response; | 
					
						
							|  |  |  |         errorMessage = "Not implemented"; | 
					
						
							|  |  |  |         return 501; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     virtual int webapiReportGet( | 
					
						
							|  |  |  |             SWGSDRangel::SWGDeviceReport& response, | 
					
						
							|  |  |  |             QString& errorMessage) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         (void) response; | 
					
						
							|  |  |  |         errorMessage = "Not implemented"; | 
					
						
							|  |  |  |         return 501; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-03-09 04:01:23 +01:00
										 |  |  |     virtual int webapiActionsPost( | 
					
						
							| 
									
										
										
										
											2020-03-09 19:56:09 +01:00
										 |  |  |             const QStringList& deviceActionsKeys, | 
					
						
							| 
									
										
										
										
											2020-03-09 04:01:23 +01:00
										 |  |  |             SWGSDRangel::SWGDeviceActions& actions, | 
					
						
							|  |  |  |             QString& errorMessage) | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2020-03-09 19:56:09 +01:00
										 |  |  |         (void) deviceActionsKeys; | 
					
						
							| 
									
										
										
										
											2020-03-09 04:01:23 +01:00
										 |  |  |         (void) actions; | 
					
						
							|  |  |  |         errorMessage = "Not implemented"; | 
					
						
							|  |  |  |         return 501; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-08-14 02:56:15 +02:00
										 |  |  |     MIMOType getMIMOType() const { return m_mimoType; } | 
					
						
							| 
									
										
										
										
											2019-05-13 01:55:12 +02:00
										 |  |  | 	MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; } | 
					
						
							|  |  |  |     virtual void setMessageQueueToGUI(MessageQueue *queue) = 0; // pure virtual so that child classes must have to deal with this
 | 
					
						
							|  |  |  |     MessageQueue *getMessageQueueToGUI() { return m_guiMessageQueue; } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-10-17 00:58:36 +02:00
										 |  |  |     unsigned int getNbSourceFifos() const { return m_sampleMOFifo.getNbStreams(); } //!< Get the number of Tx FIFOs
 | 
					
						
							|  |  |  |     unsigned int getNbSinkFifos() const { return m_sampleMIFifo.getNbStreams(); }   //!< Get the number of Rx FIFOs
 | 
					
						
							| 
									
										
										
										
											2019-09-25 18:39:17 +02:00
										 |  |  |     SampleMIFifo* getSampleMIFifo() { return &m_sampleMIFifo; } | 
					
						
							| 
									
										
										
										
											2019-10-17 00:58:36 +02:00
										 |  |  |     SampleMOFifo* getSampleMOFifo() { return &m_sampleMOFifo; } | 
					
						
							| 
									
										
										
										
											2019-05-19 10:23:18 +02:00
										 |  |  |     // Streams and FIFOs are in opposed source/sink type whick makes it confusing when stream direction is involved:
 | 
					
						
							|  |  |  |     //   Rx: source stream -> sink FIFO    -> channel sinks
 | 
					
						
							|  |  |  |     //   Tx: sink stream   <- source FIFO  <- channel sources
 | 
					
						
							| 
									
										
										
										
											2019-09-25 18:39:17 +02:00
										 |  |  |     unsigned int getNbSourceStreams() const { return m_sampleMIFifo.getNbStreams(); } //!< Commodity function same as getNbSinkFifos (Rx or source streams)
 | 
					
						
							| 
									
										
										
										
											2019-10-17 00:58:36 +02:00
										 |  |  |     unsigned int getNbSinkStreams() const { return m_sampleMOFifo.getNbStreams(); }   //!< Commodity function same as getNbSourceFifos (Tx or sink streams)
 | 
					
						
							| 
									
										
										
										
											2019-05-13 01:55:12 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | protected slots: | 
					
						
							|  |  |  | 	void handleInputMessages(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | protected: | 
					
						
							| 
									
										
										
										
											2019-08-14 02:56:15 +02:00
										 |  |  |     MIMOType m_mimoType; | 
					
						
							| 
									
										
										
										
											2019-09-25 18:39:17 +02:00
										 |  |  |     SampleMIFifo m_sampleMIFifo;      //!< Multiple Input FIFO
 | 
					
						
							| 
									
										
										
										
											2019-10-17 00:58:36 +02:00
										 |  |  |     SampleMOFifo m_sampleMOFifo;      //!< Multiple Output FIFO
 | 
					
						
							| 
									
										
										
										
											2019-05-13 01:55:12 +02:00
										 |  |  | 	MessageQueue m_inputMessageQueue; //!< Input queue to the sink
 | 
					
						
							|  |  |  |     MessageQueue *m_guiMessageQueue;  //!< Input message queue to the GUI
 | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-04-26 20:06:04 +02:00
										 |  |  | #endif // SDRBASE_DSP_DEVICESAMPLEMIMO_H_
 |