36 PeriodNP[0].
fill(
"PERIOD",
"Period (s)",
"%.f", 0, 3600, 60.0, 0);
48 TimeTP[1].
fill(
"OFFSET",
"UTC Offset",
nullptr);
131 if (strptime(
TimeTP[0].
getText(),
"%Y-%m-%dT%H:%M:%S", &utm))
133 std::time_t raw_time = std::mktime(&utm);
155 DEBUG(
Logger::DBG_ERROR,
"updateGPS() must be implemented in GPS device child class to update TIME_UTC and "
156 "GEOGRAPHIC_COORD properties.");
166 #if defined(__GNU_LIBRARY__)
167 #if (__GLIBC__ >= 2) && (__GLIBC_MINOR__ > 30)
169 sTime.tv_sec = raw_time;
170 auto rc = clock_settime(CLOCK_REALTIME, &sTime);
172 LOGF_WARN(
"Failed to update system time: %s", strerror(rc));
204 bool GPS::ISNewNumber(
const char *dev,
const char *name,
double values[],
char *names[],
int n)
210 double prevPeriod =
PeriodNP[0].getValue();
228 DEBUG(
Logger::DBG_SESSION,
"GPS Update Timer enabled. Warning: Updating system-wide time repeatedly may lead to undesirable side-effects.");
const char * getDeviceName() const
INDI::PropertyText getText(const char *name) const
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.
void setDefaultPollingPeriod(uint32_t msec)
setDefaultPollingPeriod Change the default polling period to call TimerHit() function in the driver.
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 saveConfigItems(FILE *fp)
saveConfigItems Save specific properties in the provide config file handler. Child class usually over...
uint32_t getCurrentPollingPeriod() const
getCurrentPollingPeriod Return the current polling period.
virtual bool initProperties()
Initilize properties initial state and value. The child class must implement this function.
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....
void RemoveTimer(int id)
Remove timer added with SetTimer.
int SetTimer(uint32_t ms)
Set a timer to call the function TimerHit after ms milliseconds.
virtual bool updateProperties() override
updateProperties is called whenever there is a change in the CONNECTION status of the driver....
INDI::PropertySwitch RefreshSP
virtual IPState updateGPS()
updateGPS Retrieve Location & Time from GPS. Update LocationNP & TimeTP properties (value and state) ...
INDI::PropertyNumber LocationNP
INDI::PropertyText TimeTP
INDI::PropertyNumber PeriodNP
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Process the client newNumber command.
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override
Process the client newSwitch command.
virtual bool initProperties() override
Initilize properties initial state and value. The child class must implement this function.
virtual void TimerHit() override
TimerHit Keep calling updateGPS() until it is successfull, if it fails upon first connection.
virtual bool setSystemTime(time_t &raw_time)
SetSystemTime Update system-wide time.
virtual bool saveConfigItems(FILE *fp) override
saveConfigItems Save refresh period
void setState(IPState state)
void apply(const char *format,...) const ATTRIBUTE_FORMAT_PRINTF(2
bool isNameMatch(const char *otherName) const
bool update(const double values[], const char *const names[], int n)
void fill(const char *device, const char *name, const char *label, const char *group, IPerm permission, double timeout, IPState state)
void fill(const char *device, const char *name, const char *label, const char *group, IPerm permission, ISRule rule, double timeout, IPState state)
void fill(const char *device, const char *name, const char *label, const char *group, IPerm permission, double timeout, IPState state)
const char * MAIN_CONTROL_TAB
MAIN_CONTROL_TAB Where all the primary controls for the device are located.
#define DEBUG(priority, msg)
Macro to print log messages. Example of usage of the Logger: DEBUG(DBG_DEBUG, "hello " << "world");.
#define LOGF_WARN(fmt,...)
Namespace to encapsulate INDI client, drivers, and mediator classes.