Instrument Neutral Distributed Interface INDI  2.0.2
simple_receiver.h
Go to the documentation of this file.
1 /*
2  INDI Developers Manual
3  Tutorial #3
4 
5  "Simple Receiver Driver"
6 
7  We develop a simple Receiver driver.
8 
9  Refer to README, which contains instruction on how to build this driver, and use it
10  with an INDI-compatible client.
11 
12 */
13 
23 #pragma once
24 
25 #include "indireceiver.h"
26 
28 {
29  public:
30  SimpleReceiver() = default;
31 
32  protected:
33  // General device functions
34  bool Connect() override;
35  bool Disconnect() override;
36  const char *getDefaultName() override;
37  bool initProperties() override;
38  bool updateProperties() override;
39 
40  // Receiver specific functions
41  bool StartIntegration(double duration) override;
42  bool AbortIntegration() override;
43  int SetTemperature(double temperature) override;
44  void TimerHit() override;
45 
46  bool paramsUpdated(float sr, float freq, float bps, float bw, float gain);
47 
48  private:
49  // Utility functions
50  float CalcTimeLeft();
51  void setupParams();
52  void grabFrame();
53 
54  // Are we exposing?
55  bool InIntegration { false };
56  // Struct to keep timing
57  struct timeval CapStart
58  {
59  0, 0
60  };
61 
62  double IntegrationRequest { 0 };
63  double TemperatureRequest { 0 };
64 };
Class to provide general functionality of Monodimensional Receiver.
Definition: indireceiver.h:63
void TimerHit() override
Callback function to be called once SetTimer duration elapses.
SimpleReceiver()=default
bool StartIntegration(double duration) override
Start integration from the Sensor device.
bool initProperties() override
Initilize properties initial state and value. The child class must implement this function.
bool Connect() override
Connect to the device. INDI::DefaultDevice implementation connects to appropriate connection interfac...
bool Disconnect() override
Disconnect from device.
const char * getDefaultName() override
int SetTemperature(double temperature) override
Set Sensor temperature.
bool paramsUpdated(float sr, float freq, float bps, float bw, float gain)
bool updateProperties() override
updateProperties is called whenever there is a change in the CONNECTION status of the driver....
bool AbortIntegration() override
Abort ongoing Integration.