Instrument Neutral Distributed Interface INDI  2.0.2
sqm_simulator.h
Go to the documentation of this file.
1 /*******************************************************************************
2  Copyright(c) 2017 Ralph Rogge. All rights reserved.
3 
4  INDI Sky Quality Meter Simulator
5 
6  This program is free software; you can redistribute it and/or modify it
7  under the terms of the GNU General Public License as published by the Free
8  Software Foundation; either version 2 of the License, or (at your option)
9  any later version.
10 
11  This program is distributed in the hope that it will be useful, but WITHOUT
12  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14  more details.
15 
16  You should have received a copy of the GNU Library General Public License
17  along with this library; see the file COPYING.LIB. If not, write to
18  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  Boston, MA 02110-1301, USA.
20 
21  The full GNU General Public License is included in this distribution in the
22  file called LICENSE.
23 *******************************************************************************/
24 
25 #pragma once
26 
27 #include "defaultdevice.h"
28 
30 {
31  public:
32  SQMSimulator();
33  virtual ~SQMSimulator() = default;
34 
35  virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override;
36 
37  virtual bool initProperties() override;
38  virtual bool updateProperties() override;
39 
40  protected:
41  bool Connect() override;
42  bool Disconnect() override;
43  const char *getDefaultName() override;
44 
45  private:
46  bool getReading();
47  bool getUnit();
48 
49  // Reading
50  static const int READING_NUMBER_OF_VALUES = 5;
51  INumberVectorProperty readingProperties;
52  INumber readingValues[READING_NUMBER_OF_VALUES];
53 
54  // Unit
55  static const int UNIT_NUMBER_OF_VALUES = 4;
56  INumberVectorProperty unitProperties;
57  INumber unitValues[UNIT_NUMBER_OF_VALUES];
58 };
Class to provide extended functionality for devices in addition to the functionality provided by INDI...
virtual bool updateProperties() override
updateProperties is called whenever there is a change in the CONNECTION status of the driver....
virtual bool initProperties() override
Initilize properties initial state and value. The child class must implement this function.
const char * getDefaultName() override
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Process the client newNumber command.
bool Connect() override
Connect to the device. INDI::DefaultDevice implementation connects to appropriate connection interfac...
bool Disconnect() override
Disconnect from device.
virtual ~SQMSimulator()=default
One number descriptor.
Number vector property descriptor.
Definition: indiapi.h:319