Instrument Neutral Distributed Interface INDI  2.0.2
receiver_simulator.h
Go to the documentation of this file.
1 /*
2  indi_rtlsdr_detector - a software defined radio driver for INDI
3  Copyright (C) 2017 Ilia Platone
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Lesser General Public
7  License as published by the Free Software Foundation; either
8  version 2 of the License, or (at your option) any later version.
9 
10  This library 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 GNU
13  Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public
16  License along with this library; if not, write to the Free Software
17  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19 
20 #pragma once
21 
22 #include "indireceiver.h"
23 #include "stream/streammanager.h"
24 #include "dsp/convolution.h"
25 #include "dsp/transforms.h"
26 
28 {
33 };
34 class RadioSim : public INDI::Receiver
35 {
36  public:
37  RadioSim();
38  ~RadioSim();
39 
40  bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override;
41 
42  protected:
43  // General device functions
44  bool Connect() override;
45  bool Disconnect() override;
46  const char *getDefaultName() override;
47  bool initProperties() override;
48  bool updateProperties() override;
49 
50  // Detector specific functions
51  bool StartIntegration(double duration) override;
52  bool AbortIntegration() override;
53  void TimerHit() override;
54 
55  bool StartStreaming() override;
56  bool StopStreaming() override;
57  void streamCaptureHelper();
58  void * streamCapture();
59  void grabData();
60 
61  private:
62 
63  // Utility functions
64  float CalcTimeLeft();
65  void setupParams(float sr, float freq, float bw, float gain);
66  struct timeval CapStart;
67  double IntegrationRequest;
68 
69  int streamPredicate;
70  pthread_t primary_thread;
71  bool terminateThread;
72 };
Class to provide general functionality of Monodimensional Receiver.
Definition: indireceiver.h:63
void streamCaptureHelper()
bool updateProperties() override
updateProperties is called whenever there is a change in the CONNECTION status of the driver....
const char * getDefaultName() override
bool Connect() override
Connect to the device. INDI::DefaultDevice implementation connects to appropriate connection interfac...
bool Disconnect() override
Disconnect from device.
bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Process the client newNumber command.
bool initProperties() override
Initilize properties initial state and value. The child class must implement this function.
bool StopStreaming() override
StopStreaming Stop live video streaming.
void TimerHit() override
Callback function to be called once SetTimer duration elapses.
bool StartIntegration(double duration) override
Start integration from the Sensor device.
bool StartStreaming() override
StartStreaming Start live video streaming.
bool AbortIntegration() override
Abort ongoing Integration.
void * streamCapture()
Settings
Definition: indi_rtlsdr.h:31
@ NUM_SETTINGS
@ FREQUENCY_N
@ BANDWIDTH_N
@ SAMPLERATE_N