Instrument Neutral Distributed Interface INDI  1.9.5
indiweather.cpp
Go to the documentation of this file.
1 /*******************************************************************************
2  Copyright(c) 2015 Jasem Mutlaq. All rights reserved.
3 
4  INDI Weather Device Class
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 #include "indiweather.h"
26 
29 
30 #include <cstring>
31 
32 #define PARAMETERS_TAB "Parameters"
33 
34 namespace INDI
35 {
36 
38 {
39 }
40 
42 {
45 
46  // Location
47  IUFillNumber(&LocationN[LOCATION_LATITUDE], "LAT", "Lat (dd:mm:ss)", "%010.6m", -90, 90, 0, 0.0);
48  IUFillNumber(&LocationN[LOCATION_LONGITUDE], "LONG", "Lon (dd:mm:ss)", "%010.6m", 0, 360, 0, 0.0);
49  IUFillNumber(&LocationN[LOCATION_ELEVATION], "ELEV", "Elevation (m)", "%g", -200, 10000, 0, 0);
50  IUFillNumberVector(&LocationNP, LocationN, 3, getDeviceName(), "GEOGRAPHIC_COORD", "Location", SITE_TAB, IP_RW, 60,
51  IPS_OK);
52 
53  // Active Devices
54  IUFillText(&ActiveDeviceT[0], "ACTIVE_GPS", "GPS", "GPS Simulator");
55  IUFillTextVector(&ActiveDeviceTP, ActiveDeviceT, 1, getDeviceName(), "ACTIVE_DEVICES", "Snoop devices", OPTIONS_TAB,
56  IP_RW, 60, IPS_IDLE);
57 
58  // Update Period
59  IUFillNumber(&UpdatePeriodN[0], "PERIOD", "Period (secs)", "%4.2f", 0, 3600, 60, 60);
61  IP_RW, 60, IPS_IDLE);
62 
63  // Refresh
64  IUFillSwitch(&RefreshS[0], "REFRESH", "Refresh", ISS_OFF);
65  IUFillSwitchVector(&RefreshSP, RefreshS, 1, getDeviceName(), "WEATHER_REFRESH", "Weather", MAIN_CONTROL_TAB, IP_RW,
66  ISR_ATMOST1, 0, IPS_IDLE);
67 
68  // Override
69  IUFillSwitch(&OverrideS[0], "OVERRIDE", "Override Status", ISS_OFF);
70  IUFillSwitchVector(&OverrideSP, OverrideS, 1, getDeviceName(), "WEATHER_OVERRIDE", "Safety", MAIN_CONTROL_TAB, IP_RW,
71  ISR_NOFMANY, 0, IPS_IDLE);
72 
73 
74  IDSnoopDevice(ActiveDeviceT[0].text, "GEOGRAPHIC_COORD");
75 
76  if (weatherConnection & CONNECTION_SERIAL)
77  {
80  {
81  return callHandshake();
82  });
84  }
85 
86  if (weatherConnection & CONNECTION_TCP)
87  {
88  tcpConnection = new Connection::TCP(this);
90  {
91  return callHandshake();
92  });
94  }
95 
97 
98  return true;
99 }
100 
102 {
104 
105  if (isConnected())
106  {
108 
109  updateTimerID = -1;
115 
116  DEBUG(Logger::DBG_SESSION, "Weather update is in progress...");
117  TimerHit();
118  }
119  else
120  {
122 
128  }
129 
130  return true;
131 }
132 
133 bool Weather::ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n)
134 {
135  if (dev != nullptr && strcmp(dev, getDeviceName()) == 0)
136  {
137  // Refresh
138  if (!strcmp(name, RefreshSP.name))
139  {
140  RefreshS[0].s = ISS_OFF;
141  RefreshSP.s = IPS_OK;
142  IDSetSwitch(&RefreshSP, nullptr);
143 
144  TimerHit();
145  }
146 
147  // Override
148  if (!strcmp(name, OverrideSP.name))
149  {
150  IUUpdateSwitch(&OverrideSP, states, names, n);
151  if (OverrideS[0].s == ISS_ON)
152  {
153  LOG_WARN("Weather override is enabled. Observatory is not safe. Turn off override as soon as possible.");
155 
157  IDSetLight(&critialParametersLP, nullptr);
158  }
159  else
160  {
161  LOG_INFO("Weather override is disabled");
163 
165  IDSetLight(&critialParametersLP, nullptr);
166  }
167 
168  IDSetSwitch(&OverrideSP, nullptr);
169  return true;
170  }
171  }
172 
173  return DefaultDevice::ISNewSwitch(dev, name, states, names, n);
174 }
175 
176 bool Weather::ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n)
177 {
178  // first check if it's for our device
179  if (dev != nullptr && strcmp(dev, getDeviceName()) == 0)
180  {
181  if (strcmp(name, "GEOGRAPHIC_COORD") == 0)
182  {
183  int latindex = IUFindIndex("LAT", names, n);
184  int longindex = IUFindIndex("LONG", names, n);
185  int elevationindex = IUFindIndex("ELEV", names, n);
186 
187  if (latindex == -1 || longindex == -1 || elevationindex == -1)
188  {
190  IDSetNumber(&LocationNP, "Location data missing or corrupted.");
191  }
192 
193  double targetLat = values[latindex];
194  double targetLong = values[longindex];
195  double targetElev = values[elevationindex];
196 
197  return processLocationInfo(targetLat, targetLong, targetElev);
198  }
199 
200  // Update period
201  if (strcmp(name, "WEATHER_UPDATE") == 0)
202  {
203  IUUpdateNumber(&UpdatePeriodNP, values, names, n);
204 
206  IDSetNumber(&UpdatePeriodNP, nullptr);
207 
208  if (UpdatePeriodN[0].value == 0)
209  DEBUG(Logger::DBG_SESSION, "Periodic updates are disabled.");
210  else
211  {
212  if (updateTimerID > 0)
214 
215  updateTimerID = SetTimer(UpdatePeriodN[0].value * 1000);
216  }
217  return true;
218  }
219 
220  // Pass to weather interface
221  if (processNumber(dev, name, values, names, n))
222  return true;
223  }
224 
225  return DefaultDevice::ISNewNumber(dev, name, values, names, n);
226 }
227 
228 bool INDI::Weather::ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n)
229 {
230  // first check if it's for our device
231  if (dev != nullptr && strcmp(dev, getDeviceName()) == 0)
232  {
233  if (!strcmp(name, ActiveDeviceTP.name))
234  {
235  ActiveDeviceTP.s = IPS_OK;
236  IUUpdateText(&ActiveDeviceTP, texts, names, n);
237  // Update client display
238  IDSetText(&ActiveDeviceTP, nullptr);
239 
240  IDSnoopDevice(ActiveDeviceT[0].text, "GEOGRAPHIC_COORD");
241  return true;
242  }
243  }
244  return DefaultDevice::ISNewText(dev, name, texts, names, n);
245 }
246 
248 {
249  XMLEle *ep = nullptr;
250  const char *propName = findXMLAttValu(root, "name");
251 
252  if (isConnected())
253  {
254  if (!strcmp(propName, "GEOGRAPHIC_COORD"))
255  {
256  // Only accept IPS_OK state
257  if (strcmp(findXMLAttValu(root, "state"), "Ok"))
258  return false;
259 
260  double longitude = -1, latitude = -1, elevation = -1;
261 
262  for (ep = nextXMLEle(root, 1); ep != nullptr; ep = nextXMLEle(root, 0))
263  {
264  const char *elemName = findXMLAttValu(ep, "name");
265 
266  if (!strcmp(elemName, "LAT"))
267  latitude = atof(pcdataXMLEle(ep));
268  else if (!strcmp(elemName, "LONG"))
269  longitude = atof(pcdataXMLEle(ep));
270  else if (!strcmp(elemName, "ELEV"))
271  elevation = atof(pcdataXMLEle(ep));
272  }
273 
274  return processLocationInfo(latitude, longitude, elevation);
275  }
276  }
277 
278  return DefaultDevice::ISSnoopDevice(root);
279 }
280 
282 {
283  if (!isConnected())
284  return;
285 
286  if (updateTimerID > 0)
288 
289  IPState state = updateWeather();
290 
291  switch (state)
292  {
293  // Ok
294  case IPS_OK:
295 
297  {
298  // Override weather state if required
299  if (OverrideS[0].s == ISS_ON)
301 
302  IDSetLight(&critialParametersLP, nullptr);
303  }
304 
305  ParametersNP.s = state;
306  IDSetNumber(&ParametersNP, nullptr);
307 
308  // If update period is set, then set up the timer
309  if (UpdatePeriodN[0].value > 0)
310  updateTimerID = SetTimer(static_cast<int>(UpdatePeriodN[0].value * 1000));
311 
312  return;
313 
314  // Alert
315  // We retry every 5000 ms until we get OK
316  case IPS_ALERT:
317  ParametersNP.s = state;
318  IDSetNumber(&ParametersNP, nullptr);
319  break;
320 
321  // Weather update is in progress
322  default:
323  break;
324  }
325 
326  updateTimerID = SetTimer(5000);
327 }
328 
329 bool Weather::updateLocation(double latitude, double longitude, double elevation)
330 {
331  INDI_UNUSED(latitude);
332  INDI_UNUSED(longitude);
333  INDI_UNUSED(elevation);
334 
335  return true;
336 }
337 
338 bool Weather::processLocationInfo(double latitude, double longitude, double elevation)
339 {
340  // Do not update if not necessary
341  if (latitude == LocationN[LOCATION_LATITUDE].value && longitude == LocationN[LOCATION_LONGITUDE].value &&
342  elevation == LocationN[LOCATION_ELEVATION].value)
343  {
344  LocationNP.s = IPS_OK;
345  IDSetNumber(&LocationNP, nullptr);
346  }
347 
348  if (updateLocation(latitude, longitude, elevation))
349  {
350  LocationNP.s = IPS_OK;
351  LocationN[LOCATION_LATITUDE].value = latitude;
352  LocationN[LOCATION_LONGITUDE].value = longitude;
353  LocationN[LOCATION_ELEVATION].value = elevation;
354  // Update client display
355  IDSetNumber(&LocationNP, nullptr);
356 
357  return true;
358  }
359  else
360  {
362  // Update client display
363  IDSetNumber(&LocationNP, nullptr);
364  return false;
365  }
366 }
367 
368 
370 {
376  return true;
377 }
378 
380 {
381  return false;
382 }
383 
384 bool Weather::callHandshake()
385 {
386  if (weatherConnection > 0)
387  {
390  else if (getActiveConnection() == tcpConnection)
392  }
393 
394  return Handshake();
395 }
396 
398 {
399  return weatherConnection;
400 }
401 
402 void Weather::setWeatherConnection(const uint8_t &value)
403 {
405 
406  if (value == 0 || (mask & value) == 0)
407  {
408  DEBUGF(Logger::DBG_ERROR, "Invalid connection mode %d", value);
409  return;
410  }
411 
412  weatherConnection = value;
413 }
414 }
INDI::Weather::Handshake
virtual bool Handshake()
perform handshake with device to check communication
Definition: indiweather.cpp:379
Connection::TCP::getPortFD
int getPortFD() const
Definition: connectiontcp.h:120
INDI::WeatherInterface::initProperties
void initProperties(const char *statusGroup, const char *paramsGroup)
Initilize focuser properties. It is recommended to call this function within initProperties() of your...
Definition: indiweatherinterface.cpp:48
INDI::Weather::LOCATION_LONGITUDE
@ LOCATION_LONGITUDE
Definition: indiweather.h:74
IPState
IPState
Property state.
Definition: indiapi.h:158
IPS_OK
@ IPS_OK
Definition: indiapi.h:161
_INumberVectorProperty::s
IPState s
Definition: indiapi.h:332
INDI::Weather::ActiveDeviceT
IText ActiveDeviceT[1]
Definition: indiweather.h:137
INDI::Weather::initProperties
virtual bool initProperties() override
Initilize properties initial state and value. The child class must implement this function.
Definition: indiweather.cpp:41
ISS_OFF
@ ISS_OFF
Definition: indiapi.h:150
pcdataXMLEle
char * pcdataXMLEle(XMLEle *ep)
Return the pcdata of an XML element.
Definition: lilxml.c:575
connectiontcp.h
IDSetText
void IDSetText(const ITextVectorProperty *t, const char *msg,...) ATTRIBUTE_FORMAT_PRINTF(2
Tell client to update an existing text vector property.
IPS_ALERT
@ IPS_ALERT
Definition: indiapi.h:163
nextXMLEle
XMLEle * nextXMLEle(XMLEle *ep, int init)
Iterate an XML element for a list of nesetd XML elements.
Definition: lilxml.c:524
IDSnoopDevice
void IDSnoopDevice(const char *snooped_device, const char *snooped_property)
Function a Driver calls to snoop on another Device. Snooped messages will then arrive via ISSnoopDevi...
Definition: indidriver.c:137
INDI::Weather::Weather
Weather()
Definition: indiweather.cpp:37
Connection::Serial
The Serial class manages connection with serial devices including Bluetooth. Serial communication is ...
Definition: connectionserial.h:56
Connection::TCP
The TCP class manages connection with devices over the network via TCP/IP. Upon successfull connectio...
Definition: connectiontcp.h:55
IUFillNumber
void IUFillNumber(INumber *np, const char *name, const char *label, const char *format, double min, double max, double step, double value)
Assign attributes for a number property. The number's auxiliary elements will be set to NULL.
Definition: indidriver.c:348
ISR_NOFMANY
@ ISR_NOFMANY
Definition: indiapi.h:174
INDI::Weather::tcpConnection
Connection::TCP * tcpConnection
Definition: indiweather.h:152
INDI::DefaultDevice::defineProperty
void defineProperty(INumberVectorProperty *property)
Definition: defaultdevice.cpp:997
OPTIONS_TAB
const char * OPTIONS_TAB
OPTIONS_TAB Where all the driver's options are located. Those may include auxiliary controls,...
Definition: defaultdevice.cpp:39
MAIN_CONTROL_TAB
const char * MAIN_CONTROL_TAB
MAIN_CONTROL_TAB Where all the primary controls for the device are located.
Definition: defaultdevice.cpp:34
INDI::Logger::DBG_ERROR
@ DBG_ERROR
Definition: indilogger.h:192
IUFillTextVector
void IUFillTextVector(ITextVectorProperty *tvp, IText *tp, int ntp, const char *dev, const char *name, const char *label, const char *group, IPerm p, double timeout, IPState s)
Assign attributes for a text vector property. The vector's auxiliary elements will be set to NULL.
Definition: indidriver.c:477
INDI::WeatherInterface::syncCriticalParameters
bool syncCriticalParameters()
updateWeatherState Send update weather state to client
Definition: indiweatherinterface.cpp:230
Pulsar2Commands::getDeviceName
const char * getDeviceName()
Definition: lx200pulsar2.cpp:455
INDI_UNUSED
#define INDI_UNUSED(x)
Definition: indidevapi.h:799
INDI::Weather::updateTimerID
int updateTimerID
Definition: indiweather.h:155
SITE_TAB
const char * SITE_TAB
SITE_TAB Where all site information setting are located.
Definition: defaultdevice.cpp:38
INDI::BaseDevice::getDeviceName
const char * getDeviceName() const
Definition: basedevice.cpp:799
_ILightVectorProperty::s
IPState s
Definition: indiapi.h:426
INDI::Logger::DBG_SESSION
@ DBG_SESSION
Definition: indilogger.h:194
PARAMETERS_TAB
#define PARAMETERS_TAB
Definition: indiweather.cpp:32
INDI::Weather::ISSnoopDevice
virtual bool ISSnoopDevice(XMLEle *root) override
Process a snoop event from INDI server. This function is called when a snooped property is updated in...
Definition: indiweather.cpp:247
IUSaveConfigNumber
void IUSaveConfigNumber(FILE *fp, const INumberVectorProperty *nvp)
Add a number vector property value to the configuration file.
Definition: indicom.c:1455
IUFillText
void IUFillText(IText *tp, const char *name, const char *label, const char *initialText)
Assign attributes for a text property. The text's auxiliary elements will be set to NULL.
Definition: indidriver.c:369
INDI::Weather::ISNewSwitch
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override
Process the client newSwitch command.
Definition: indiweather.cpp:133
IUUpdateText
int IUUpdateText(ITextVectorProperty *tvp, char *texts[], char *names[], int n)
Update all text members in a text vector property.
Definition: indidriver.c:259
INDI::Weather::CONNECTION_TCP
@ CONNECTION_TCP
Definition: indiweather.h:85
LOG_INFO
#define LOG_INFO(txt)
Definition: indilogger.h:74
INDI::Weather::CONNECTION_SERIAL
@ CONNECTION_SERIAL
Definition: indiweather.h:84
INDI::WeatherInterface::ParametersNP
INumberVectorProperty ParametersNP
Definition: indiweatherinterface.h:150
INDI::Weather::LocationNP
INumberVectorProperty LocationNP
Definition: indiweather.h:132
DEBUG
#define DEBUG(priority, msg)
Macro to print log messages. Example of usage of the Logger: DEBUG(DBG_DEBUG, "hello " << "world");.
Definition: indilogger.h:56
INDI::DefaultDevice::initProperties
virtual bool initProperties()
Initilize properties initial state and value. The child class must implement this function.
Definition: defaultdevice.cpp:917
INDI::Weather::updateLocation
virtual bool updateLocation(double latitude, double longitude, double elevation)
Update weather station location.
Definition: indiweather.cpp:329
INDI::Weather::getWeatherConnection
uint8_t getWeatherConnection() const
Definition: indiweather.cpp:397
INDI::DefaultDevice::ISSnoopDevice
virtual bool ISSnoopDevice(XMLEle *root)
Process a snoop event from INDI server. This function is called when a snooped property is updated in...
Definition: defaultdevice.cpp:633
INDI::Weather::RefreshSP
ISwitchVectorProperty RefreshSP
Definition: indiweather.h:145
INDI::Weather::setWeatherConnection
void setWeatherConnection(const uint8_t &value)
setWeatherConnection Set Weather connection mode. Child class should call this in the constructor bef...
Definition: indiweather.cpp:402
INDI::DefaultDevice::SetTimer
int SetTimer(uint32_t ms)
Set a timer to call the function TimerHit after ms milliseconds.
Definition: defaultdevice.cpp:865
INDI::Weather::PortFD
int PortFD
Definition: indiweather.h:154
INDI::Weather::saveConfigItems
virtual bool saveConfigItems(FILE *fp) override
saveConfigItems Save specific properties in the provide config file handler. Child class usually over...
Definition: indiweather.cpp:369
INDI::Weather::ISNewNumber
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Process the client newNumber command.
Definition: indiweather.cpp:176
IUSaveConfigText
void IUSaveConfigText(FILE *fp, const ITextVectorProperty *tvp)
Add a text vector property value to the configuration file.
Definition: indicom.c:1460
IDSetLight
void void void void void void void IDSetLight(const ILightVectorProperty *l, const char *msg,...) ATTRIBUTE_FORMAT_PRINTF(2
Tell client to update an existing light vector property.
INDI::Weather::updateProperties
virtual bool updateProperties() override
updateProperties is called whenever there is a change in the CONNECTION status of the driver....
Definition: indiweather.cpp:101
INDI::DefaultDevice::ISNewNumber
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n)
Process the client newNumber command.
Definition: defaultdevice.cpp:593
IUFillSwitchVector
void IUFillSwitchVector(ISwitchVectorProperty *svp, ISwitch *sp, int nsp, const char *dev, const char *name, const char *label, const char *group, IPerm p, ISRule r, double timeout, IPState s)
Assign attributes for a switch vector property. The vector's auxiliary elements will be set to NULL.
Definition: indidriver.c:412
IUFillNumberVector
void IUFillNumberVector(INumberVectorProperty *nvp, INumber *np, int nnp, const char *dev, const char *name, const char *label, const char *group, IPerm p, double timeout, IPState s)
Assign attributes for a number vector property. The vector's auxiliary elements will be set to NULL.
Definition: indidriver.c:455
IPS_BUSY
@ IPS_BUSY
Definition: indiapi.h:162
INDI::WeatherInterface::critialParametersLP
ILightVectorProperty critialParametersLP
Definition: indiweatherinterface.h:158
connectionserial.h
IPS_IDLE
@ IPS_IDLE
Definition: indiapi.h:160
INDI::DefaultDevice::registerConnection
void registerConnection(Connection::Interface *newConnection)
registerConnection Add new connection plugin to the existing connection pool. The connection type sha...
Definition: defaultdevice.cpp:1107
xml_ele_
Definition: lilxml.c:105
ISR_ATMOST1
@ ISR_ATMOST1
Definition: indiapi.h:173
_INumberVectorProperty::name
char name[MAXINDINAME]
Definition: indiapi.h:322
IUUpdateSwitch
int IUUpdateSwitch(ISwitchVectorProperty *svp, ISState *states, char *names[], int n)
Update all switches in a switch vector property.
Definition: indidriver.c:171
_ITextVectorProperty::name
char name[MAXINDINAME]
Definition: indiapi.h:249
INDI::BaseDevice::isConnected
bool isConnected() const
Definition: basedevice.cpp:518
INDI::Weather::LOCATION_LATITUDE
@ LOCATION_LATITUDE
Definition: indiweather.h:73
INDI::WeatherInterface::saveConfigItems
virtual bool saveConfigItems(FILE *fp)
saveConfigItems Save parameters ranges in the config file.
Definition: indiweatherinterface.cpp:312
INDI::WeatherInterface::processNumber
bool processNumber(const char *dev, const char *name, double values[], char *names[], int n)
Process focus number properties.
Definition: indiweatherinterface.cpp:96
INDI::Weather::ISNewText
virtual bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n) override
Process the client newSwitch command.
Definition: indiweather.cpp:228
INDI::Weather::OverrideSP
ISwitchVectorProperty OverrideSP
Definition: indiweather.h:149
INDI::Weather::UpdatePeriodNP
INumberVectorProperty UpdatePeriodNP
Definition: indiweather.h:141
INDI::Weather::TimerHit
virtual void TimerHit() override
TimerHit Keep calling updateWeather() until it is successful, if it fails upon first connection.
Definition: indiweather.cpp:281
INDI::Weather::OverrideS
ISwitch OverrideS[1]
Definition: indiweather.h:148
name
const char * name
Definition: indiserver.c:116
_ISwitchVectorProperty::s
IPState s
Definition: indiapi.h:382
INDI::Weather::serialConnection
Connection::Serial * serialConnection
Definition: indiweather.h:151
INDI::Weather::UpdatePeriodN
INumber UpdatePeriodN[1]
Definition: indiweather.h:140
INDI
Namespace to encapsulate INDI client, drivers, and mediator classes.
Definition: AlignmentSubsystemForClients.cpp:11
Connection::Interface::registerHandshake
void registerHandshake(std::function< bool()> callback)
registerHandshake Register a handshake function to be called once the intial connection to the device...
Definition: connectioninterface.cpp:108
INDI::Weather::CONNECTION_NONE
@ CONNECTION_NONE
Definition: indiweather.h:83
INDI::Weather::LocationN
INumber LocationN[3]
Definition: indiweather.h:133
IUUpdateNumber
int IUUpdateNumber(INumberVectorProperty *nvp, double values[], char *names[], int n)
Update all numbers in a number vector property.
Definition: indidriver.c:225
DEBUGF
#define DEBUGF(priority, msg,...)
Definition: indilogger.h:57
INDI::DefaultDevice::saveConfigItems
virtual bool saveConfigItems(FILE *fp)
saveConfigItems Save specific properties in the provide config file handler. Child class usually over...
Definition: defaultdevice.cpp:175
IUFindIndex
int IUFindIndex(const char *needle, char **hay, unsigned int n)
Returns the index of the string in a string array.
Definition: indidriver.c:1861
findXMLAttValu
const char * findXMLAttValu(XMLEle *ep, const char *name)
Find an XML element's attribute value.
Definition: lilxml.c:613
IP_RW
@ IP_RW
Definition: indiapi.h:185
LOG_WARN
#define LOG_WARN(txt)
Definition: indilogger.h:73
INDI::DefaultDevice::RemoveTimer
void RemoveTimer(int id)
Remove timer added with SetTimer.
Definition: defaultdevice.cpp:874
INDI::Weather::RefreshS
ISwitch RefreshS[1]
Definition: indiweather.h:144
ISState
ISState
Switch state.
Definition: indiapi.h:148
Connection::Serial::getPortFD
int getPortFD() const
Definition: connectionserial.h:136
indiweather.h
INDI::DefaultDevice::ISNewSwitch
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n)
Process the client newSwitch command.
Definition: defaultdevice.cpp:409
INDI::WeatherInterface
Provides interface to implement weather reporting functionality.
Definition: indiweatherinterface.h:55
INDI::Weather::LOCATION_ELEVATION
@ LOCATION_ELEVATION
Definition: indiweather.h:75
INDI::Weather::ActiveDeviceTP
ITextVectorProperty ActiveDeviceTP
Definition: indiweather.h:136
INDI::DefaultDevice::deleteProperty
virtual bool deleteProperty(const char *propertyName)
Delete a property and unregister it. It will also be deleted from all clients.
Definition: defaultdevice.cpp:965
INDI::DefaultDevice::ISNewText
virtual bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n)
Process the client newSwitch command.
Definition: defaultdevice.cpp:614
IDSetNumber
void void void IDSetNumber(const INumberVectorProperty *n, const char *msg,...) ATTRIBUTE_FORMAT_PRINTF(2
Tell client to update an existing number vector property.
IDSetSwitch
void void void void void IDSetSwitch(const ISwitchVectorProperty *s, const char *msg,...) ATTRIBUTE_FORMAT_PRINTF(2
Tell client to update an existing switch vector property.
INDI::DefaultDevice::setDriverInterface
void setDriverInterface(uint16_t value)
setInterface Set driver interface. By default the driver interface is set to GENERAL_DEVICE....
Definition: defaultdevice.cpp:902
INDI::WeatherInterface::updateProperties
bool updateProperties()
updateProperties Define or Delete Rotator properties based on the connection status of the base devic...
Definition: indiweatherinterface.cpp:61
IUFillSwitch
void IUFillSwitch(ISwitch *sp, const char *name, const char *label, ISState s)
Assign attributes for a switch property. The switch's auxiliary elements will be set to NULL.
Definition: indidriver.c:320
INDI::BaseDevice::WEATHER_INTERFACE
@ WEATHER_INTERFACE
Definition: basedevice.h:79
INDI::DefaultDevice::updateProperties
virtual bool updateProperties()
updateProperties is called whenever there is a change in the CONNECTION status of the driver....
Definition: defaultdevice.cpp:890
INDI::DefaultDevice::getActiveConnection
Connection::Interface * getActiveConnection()
Definition: defaultdevice.cpp:1245
INDI::WeatherInterface::updateWeather
virtual IPState updateWeather()
updateWeather Update weather conditions from device or service. The function should not change the st...
Definition: indiweatherinterface.cpp:124
_ISwitchVectorProperty::name
char name[MAXINDINAME]
Definition: indiapi.h:370
ISS_ON
@ ISS_ON
Definition: indiapi.h:151