Instrument Neutral Distributed Interface INDI 2.2.5
agent_imager.h
Go to the documentation of this file.
1/*******************************************************************************
2 Copyright(c) 2013-2016 CloudMakers, s. r. o. All rights reserved.
3 Copyright(c) 2017 Marco Gulino <[email protected]>
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License version 2 as published by the Free Software Foundation.
8
9 This library 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 GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301, USA.
18 *******************************************************************************/
19
20#pragma once
21
22#include "baseclient.h"
23#include "defaultdevice.h"
24#define MAX_GROUP_COUNT 16
25
26class Group;
27class Imager : public virtual INDI::DefaultDevice, public virtual INDI::BaseClient
28{
29public:
30 static const std::string DEVICE_NAME;
31 Imager();
32 virtual ~Imager() = default;
33
34 // DefaultDevice
35
36 virtual bool initProperties() override;
37 virtual bool updateProperties() override;
38 virtual void ISGetProperties(const char *dev) override;
39 virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override;
40 virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override;
41 virtual bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n) override;
42 virtual bool ISNewBLOB(const char *dev, const char *name, int sizes[], int blobsizes[], char *blobs[],
43 char *formats[], char *names[], int n) override;
44 virtual bool ISSnoopDevice(XMLEle *root) override;
45
46 // BaseClient
47
48 virtual void newDevice(INDI::BaseDevice baseDevice) override;
49 virtual void newProperty(INDI::Property property) override;
50 virtual void updateProperty(INDI::Property property) override;
51
52 virtual void serverConnected() override;
53 virtual void serverDisconnected(int exit_code) override;
54
55protected:
56 virtual const char *getDefaultName() override;
57 virtual bool Connect() override;
58 virtual bool Disconnect() override;
59
60private:
61 bool isRunning();
62 bool isCCDConnected();
63 bool isFilterConnected();
64 void defineProperties();
65 void deleteProperties();
66 void initiateNextFilter();
67 void initiateNextCapture();
68 void startBatch();
69 void abortBatch();
70 void batchDone();
71 void initiateDownload();
72
73 char format[16];
74 int group { 0 };
75 int maxGroup { 0 };
76 int image { 0 };
77 int maxImage { 0 };
78 const char *controlledCCD { nullptr };
79 const char *controlledFilterWheel { nullptr };
80
81 INDI::PropertyText ControlledDeviceTP {2};
82 enum
83 {
84 CCD,
85 FILTER
86 };
87
88 INDI::PropertyNumber GroupCountNP {1};
89
90 INDI::PropertyNumber ProgressNP {3};
91 enum
92 {
93 GROUP,
94 IMAGE,
95 REMAINING_TIME
96 };
97 INDI::PropertySwitch BatchSP {2};
98 enum
99 {
100 START,
101 ABORT
102 };
103 INDI::PropertyLight StatusLP {2};
104
105 INDI::PropertyText ImageNameTP {2};
106 enum
107 {
108 IMAGE_FOLDER,
109 IMAGE_NAME_PREFIX
110 };
111
112 INDI::PropertyNumber DownloadNP {2};
113 INDI::PropertyBlob FitsBP {1};
114
115 INDI::PropertyNumber CCDImageExposureNP {1};
116 INDI::PropertyNumber CCDImageBinNP {2};
117 enum
118 {
119 HOR_BIN,
120 VER_BIN
121 };
122 INDI::PropertySwitch CCDUploadSP {3};
123 enum
124 {
125 UPLOAD_CLIENT,
126 UPLOAD_LOCAL,
127 UPLOAD_BOTH
128 };
129
130 INDI::PropertyText CCDUploadSettingsTP {2};
131 enum
132 {
133 UPLOAD_DIR,
134 UPLOAD_PREFIX
135 };
136
137// ITextVectorProperty CCDUploadSettingsTP;
138
139 INDI::PropertyNumber FilterSlotNP {1};
140
141 std::vector<std::shared_ptr<Group>> groups;
142 std::shared_ptr<Group> currentGroup() const;
143 std::shared_ptr<Group> nextGroup() const;
144 std::shared_ptr<Group> getGroup(int index) const;
145
146};
Definition group.h:29
Class to provide basic client functionality.
Definition baseclient.h:52
Class to provide basic INDI device functionality.
Definition basedevice.h:52
Class to provide extended functionality for devices in addition to the functionality provided by INDI...
Provides generic container for INDI properties.
virtual void updateProperty(INDI::Property property) override
Emmited when a new property value arrives from INDI server.
static const std::string DEVICE_NAME
virtual bool initProperties() override
Initialize properties initial state and value. The child class must implement this function.
virtual const char * getDefaultName() override
virtual void ISGetProperties(const char *dev) override
define the driver's properties to the client. Usually, only a minimum set of properties are defined t...
virtual void serverConnected() override
Emmited when the server is connected.
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Process the client newNumber command.
virtual void newDevice(INDI::BaseDevice baseDevice) override
Emmited when a new device is created from INDI server.
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override
Process the client newSwitch command.
virtual bool Disconnect() override
Disconnect from device.
virtual bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n) override
Process the client newSwitch command.
virtual void serverDisconnected(int exit_code) override
Emmited when the server gets disconnected.
virtual bool updateProperties() override
updateProperties is called whenever there is a change in the CONNECTION status of the driver....
virtual bool ISSnoopDevice(XMLEle *root) override
Process a snoop event from INDI server. This function is called when a snooped property is updated in...
virtual void newProperty(INDI::Property property) override
Emmited when a new property is created for an INDI driver.
virtual ~Imager()=default
virtual bool Connect() override
Connect to the device. INDI::DefaultDevice implementation connects to appropriate connection interfac...
virtual bool ISNewBLOB(const char *dev, const char *name, int sizes[], int blobsizes[], char *blobs[], char *formats[], char *names[], int n) override
Process the client newBLOB command.
ISState
Switch state.
Definition indiapi.h:148