Instrument Neutral Distributed Interface INDI  1.9.2
dome.h

The dome driver snoops on the rain detector signal and watches whether rain is detected or not. If it is detector and the dome is closed, it performs no action, but it also prevents you from opening the dome due to rain. If the dome is open, it will automatically starts closing the shutter. In order snooping to work, both drivers must be started by the same indiserver (or chained INDI servers):

indiserver tutorial_dome tutorial_rain

The dome driver keeps a copy of RainL light property from the rain driver. This makes it easy to parse the property status once an update from the rain driver arrives in the dome driver. Alternatively, you can directly parse the XML root element in ISSnoopDevice(XMLEle *root) to extract the required data.

/*
INDI Developers Manual
Tutorial #5 - Snooping
Dome
Refer to README, which contains instruction on how to build this driver, and use it
with an INDI-compatible client.
*/
#pragma once
#include "defaultdevice.h"
class Dome : public INDI::DefaultDevice
{
public:
Dome() = default;
protected:
// General device functions
bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override;
bool ISSnoopDevice(XMLEle *root) override;
bool Connect() override;
bool Disconnect() override;
const char *getDefaultName() override;
bool initProperties() override;
bool updateProperties() override;
private:
void closeShutter();
ISwitch ShutterS[2];
ILight RainL[1];
};
Dome
Definition: dome.h:30
Dome::updateProperties
bool updateProperties() override
updateProperties is called whenever there is a change in the CONNECTION status of the driver....
Definition: dome.cpp:85
Dome::initProperties
bool initProperties() override
Initilize properties initial state and value. The child class must implement this function.
Definition: dome.cpp:63
_ILightVectorProperty
Light vector property descriptor.
Definition: indiapi.h:415
ISwitch
One switch descriptor.
Dome::ISNewSwitch
bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override
Process the client newSwitch command.
Definition: dome.cpp:106
Dome::Disconnect
bool Disconnect() override
Disconnect from device.
Definition: dome.cpp:46
Dome::Dome
Dome()=default
ILight
One light descriptor.
Dome::getDefaultName
const char * getDefaultName() override
Definition: dome.cpp:55
Dome::Connect
bool Connect() override
Connect to the device. INDI::DefaultDevice implementation connects to appropriate connection interfac...
Definition: dome.cpp:37
xml_ele_
Definition: lilxml.c:105
defaultdevice.h
Dome::ISSnoopDevice
bool ISSnoopDevice(XMLEle *root) override
Process a snoop event from INDI server. This function is called when a snooped property is updated in...
Definition: dome.cpp:151
ISState
ISState
Switch state.
Definition: indiapi.h:148
INDI::DefaultDevice
Class to provide extended functionality for devices in addition to the functionality provided by INDI...
Definition: defaultdevice.h:118
_ISwitchVectorProperty
Switch vector property descriptor.
Definition: indiapi.h:365