23 static std::unique_ptr<ALTO> sesto(
new ALTO());
52 MotionSpeedSP[Fast].
fill(
"FAST",
"Fast",
ISS_ON);
56 MotionCommandSP[Open].
fill(
"OPEN",
"Open",
ISS_OFF);
57 MotionCommandSP[Close].
fill(
"CLOSE",
"Close",
ISS_OFF);
58 MotionCommandSP[Stop].
fill(
"STOP",
"Stop",
ISS_OFF);
105 if (m_ALTO->getModel(model))
111 LOG_INFO(
"Error retrieving data from device, please ensure ALTO is powered and the port is correct.");
127 bool ALTO::ISNewNumber(
const char *dev,
const char *name,
double values[],
char *names[],
int n)
143 MotionSpeedSP.
update(states, names, n);
145 MotionSpeedSP.
apply();
153 MotionCommandSP.
update(states, names, n);
159 rc = m_ALTO->open(MotionSpeedSP[Fast].getState() ==
ISS_ON);
162 rc = m_ALTO->close(MotionSpeedSP[Fast].getState() ==
ISS_ON);
166 if (m_CalibrationStatus == findClosePosition)
168 m_ALTO->storeClosedPosition();
169 LOG_INFO(
"Close position recorded. Open cover to maximum position then click stop.");
170 m_CalibrationStatus = findOpenPosition;
172 else if (m_CalibrationStatus == findOpenPosition)
174 m_ALTO->storeOpenPosition();
175 LOG_INFO(
"Open position recorded. Calibration completed.");
176 m_CalibrationStatus = Idle;
177 CalibrateToggleSP.
reset();
179 CalibrateToggleSP.
apply();
185 MotionCommandSP.
reset();
187 MotionCommandSP.
apply();
194 CalibrateToggleSP.
update(states, names, n);
200 m_ALTO->initCalibration();
201 m_CalibrationStatus = findClosePosition;
202 LOG_INFO(
"Calibration started. Close cover to minimum position then click stop.");
206 m_CalibrationStatus = Idle;
210 CalibrateToggleSP.
apply();
238 MotionSpeedSP.
save(fp);
252 m_ALTO->getStatus(status);
253 std::string mst = status[
"MST"];
virtual bool updateProperties() override
updateProperties is called whenever there is a change in the CONNECTION status of the driver....
virtual IPState ParkCap() override
Park dust cap (close cover). Must be implemented by child.
const char * getDefaultName() override
virtual void TimerHit() override
Callback function to be called once SetTimer duration elapses.
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 saveConfigItems(FILE *fp) override
saveConfigItems Save specific properties in the provide config file handler. Child class usually over...
virtual bool initProperties() override
Initilize properties initial state and value. The child class must implement this function.
virtual IPState UnParkCap() override
unPark dust cap (open cover). Must be implemented by child.
void registerHandshake(std::function< bool()> callback)
registerHandshake Register a handshake function to be called once the intial connection to the device...
The Serial class manages connection with serial devices including Bluetooth. Serial communication is ...
void setDefaultBaudRate(BaudRate newRate)
setDefaultBaudRate Set default baud rate. The default baud rate is 9600 unless otherwise changed by t...
Provides interface to implement remotely controlled dust cover.
const char * getDeviceName() const
virtual bool updateProperties()
updateProperties is called whenever there is a change in the CONNECTION status of the driver....
virtual bool saveConfig(bool silent=false, const char *property=nullptr)
Save the current properties in a configuration file.
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n)
Process the client newSwitch command.
void registerConnection(Connection::Interface *newConnection)
registerConnection Add new connection plugin to the existing connection pool. The connection type sha...
void setVersion(uint16_t vMajor, uint16_t vMinor)
Set driver version information to be defined in DRIVER_INFO property as vMajor.vMinor.
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.
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....
int SetTimer(uint32_t ms)
Set a timer to call the function TimerHit after ms milliseconds.
void initDustCapProperties(const char *deviceName, const char *groupName)
Initilize dust cap properties. It is recommended to call this function within initProperties() of you...
bool processDustCapSwitch(const char *dev, const char *name, ISState *states, char *names[], int n)
Process dust cap switch properties.
ISwitchVectorProperty ParkCapSP
void setState(IPState state)
void apply(const char *format,...) const ATTRIBUTE_FORMAT_PRINTF(2
const char * getName() const
bool isNameMatch(const char *otherName) const
bool update(const ISState states[], const char *const names[], int n)
int findOnSwitchIndex() const
void fill(const char *device, const char *name, const char *label, const char *group, IPerm permission, ISRule rule, double timeout, IPState state)
a class to store JSON values
general exception of the basic_json class
const char * what() const noexcept override
returns the explanatory string
const int id
the id of the exception
const char * MAIN_CONTROL_TAB
MAIN_CONTROL_TAB Where all the primary controls for the device are located.
void IDSetSwitch(const ISwitchVectorProperty *svp, const char *fmt,...)
#define LOGF_INFO(fmt,...)
#define LOGF_ERROR(fmt,...)