File: simple_receiver.h

package info (click to toggle)
indi 2.1.9%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 15,888 kB
  • sloc: cpp: 217,447; ansic: 31,363; xml: 1,195; sh: 311; makefile: 13
file content (64 lines) | stat: -rw-r--r-- 1,835 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/*
   INDI Developers Manual
   Tutorial #3

   "Simple Receiver Driver"

   We develop a simple Receiver driver.

   Refer to README, which contains instruction on how to build this driver, and use it
   with an INDI-compatible client.

*/

/** \file simpleReceiver.h
    \brief Construct a basic INDI Receiver device that simulates capture & temperature settings. It also generates a random pattern and uploads it as a FITS file.
    \author Ilia Platone

    \example simpleReceiver.h
    A simple detector device that can capture stream frames and controls temperature. It returns a FITS image to the client. To build drivers for complex Receivers, please
    refer to the INDI Generic Receiver driver template in INDI github (under 3rdparty).
*/

#pragma once

#include "indireceiver.h"

class SimpleReceiver : public INDI::Receiver
{
    public:
        SimpleReceiver() = default;

    protected:
        // General device functions
        bool Connect() override;
        bool Disconnect() override;
        const char *getDefaultName() override;
        bool initProperties() override;
        bool updateProperties() override;

        // Receiver specific functions
        bool StartIntegration(double duration) override;
        bool AbortIntegration() override;
        int SetTemperature(double temperature) override;
        void TimerHit() override;

        bool paramsUpdated(float sr, float freq, float bps, float bw, float gain);

    private:
        // Utility functions
        float CalcTimeLeft();
        void setupParams();
        void grabFrame();

        // Are we exposing?
        bool InIntegration { false };
        // Struct to keep timing
        struct timeval CapStart
        {
            0, 0
        };

        double IntegrationRequest { 0 };
        double TemperatureRequest { 0 };
};