Instrument Neutral Distributed Interface INDI  2.0.2
light_panel_simulator.cpp
Go to the documentation of this file.
1 /*******************************************************************************
2  Light Panel Simulator
3 
4  SPDX-FileCopyrightText: 2021 Jasem Mutlaq
5  SPDX-License-Identifier: LGPL-2.0-or-later
6 *******************************************************************************/
7 
9 
10 static std::unique_ptr<LightPanelSimulator> simulator(new LightPanelSimulator());
11 
13 {
14 }
15 
17 {
19 
20  // Get Light box properties
22 }
23 
25 {
30  return true;
31 }
32 
34 {
36 
37  if (isConnected())
38  {
41  }
42  else
43  {
46  }
47 
49  return true;
50 }
51 
52 bool LightPanelSimulator::ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n)
53 {
54  if (processLightBoxNumber(dev, name, values, names, n))
55  return true;
56 
57  return INDI::DefaultDevice::ISNewNumber(dev, name, values, names, n);
58 }
59 
60 bool LightPanelSimulator::ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n)
61 {
62  if (dev != nullptr && strcmp(dev, getDeviceName()) == 0)
63  {
64  if (processLightBoxText(dev, name, texts, names, n))
65  return true;
66  }
67 
68  return INDI::DefaultDevice::ISNewText(dev, name, texts, names, n);
69 }
70 
71 bool LightPanelSimulator::ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n)
72 {
73  if (dev != nullptr && strcmp(dev, getDeviceName()) == 0)
74  {
75  if (processLightBoxSwitch(dev, name, states, names, n))
76  return true;
77  }
78 
79  return INDI::DefaultDevice::ISNewSwitch(dev, name, states, names, n);
80 }
81 
83 {
84  INDI_UNUSED(value);
85  return true;
86 }
87 
89 {
90  INDI_UNUSED(enable);
91  return true;
92 }
bool isConnected() const
Definition: basedevice.cpp:520
const char * getDeviceName() const
Definition: basedevice.cpp:821
virtual bool updateProperties()
updateProperties is called whenever there is a change in the CONNECTION status of the driver....
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n)
Process the client newSwitch command.
virtual void ISGetProperties(const char *dev)
define the driver's properties to the client. Usually, only a minimum set of properties are defined t...
virtual bool deleteProperty(const char *propertyName)
Delete a property and unregister it. It will also be deleted from all clients.
void defineProperty(INumberVectorProperty *property)
virtual bool initProperties()
Initilize properties initial state and value. The child class must implement this function.
void addAuxControls()
Add Debug, Simulation, and Configuration options to the driver.
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n)
Process the client newNumber command.
void setDriverInterface(uint16_t value)
setInterface Set driver interface. By default the driver interface is set to GENERAL_DEVICE....
virtual bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n)
Process the client newSwitch command.
INumberVectorProperty LightIntensityNP
bool processLightBoxNumber(const char *dev, const char *name, double values[], char *names[], int n)
Process light box number properties.
ISwitchVectorProperty LightSP
bool processLightBoxSwitch(const char *dev, const char *name, ISState *states, char *names[], int n)
Process light box switch properties.
void initLightBoxProperties(const char *deviceName, const char *groupNam)
Initilize light box properties. It is recommended to call this function within initProperties() of yo...
bool processLightBoxText(const char *dev, const char *name, char *texts[], char *names[], int n)
Process light box text properties.
void isGetLightBoxProperties(const char *deviceName)
isGetLightBoxProperties Get light box properties
Provides interface to implement controllable light box/switch device.
bool updateProperties() override
updateProperties is called whenever there is a change in the CONNECTION status of the driver....
bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n) override
Process the client newSwitch command.
virtual bool SetLightBoxBrightness(uint16_t value) override
setBrightness Set light level. Must be impelemented in the child class, if supported.
bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Process the client newNumber command.
virtual bool EnableLightBox(bool enable) override
EnableLightBox Turn on/off on a light box. Must be impelemented in the child class.
bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override
Process the client newSwitch command.
bool initProperties() override
Initilize properties initial state and value. The child class must implement this function.
void ISGetProperties(const char *dev) override
define the driver's properties to the client. Usually, only a minimum set of properties are defined t...
const char * MAIN_CONTROL_TAB
MAIN_CONTROL_TAB Where all the primary controls for the device are located.
ISState
Switch state.
Definition: indiapi.h:150
#define INDI_UNUSED(x)
Definition: indidevapi.h:131
char name[MAXINDINAME]
Definition: indiapi.h:323
char name[MAXINDINAME]
Definition: indiapi.h:371