23static 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);
62 PositionNP[0].
fill(
"POSITION",
"Steps",
"%.f", 0, 100, 10, 0);
89 if (m_ALTO->getPosition(value))
93 PositionNP[0].value = value;
127 if (m_ALTO->getModel(model))
133 LOG_INFO(
"Error retrieving data from device, please ensure ALTO is powered and the port is correct.");
154 m_TargetPosition = values[0];
158 auto rc = m_ALTO->setPosition(m_TargetPosition);
184 MotionSpeedSP.
update(states, names, n);
186 MotionSpeedSP.
apply();
194 MotionCommandSP.
update(states, names, n);
200 rc = m_ALTO->open(MotionSpeedSP[Fast].getState() ==
ISS_ON);
203 rc = m_ALTO->close(MotionSpeedSP[Fast].getState() ==
ISS_ON);
207 if (m_CalibrationStatus == findClosePosition)
209 m_ALTO->storeClosedPosition();
210 LOG_INFO(
"Close position recorded. Open cover to maximum position then click stop.");
211 m_CalibrationStatus = findOpenPosition;
213 else if (m_CalibrationStatus == findOpenPosition)
215 m_ALTO->storeOpenPosition();
216 LOG_INFO(
"Open position recorded. Calibration completed.");
217 m_CalibrationStatus = Idle;
218 CalibrateToggleSP.
reset();
220 CalibrateToggleSP.
apply();
225 MotionCommandSP.
reset();
227 MotionCommandSP.
apply();
234 CalibrateToggleSP.
update(states, names, n);
240 m_ALTO->initCalibration();
241 m_CalibrationStatus = findClosePosition;
242 LOG_INFO(
"Calibration started. Close cover to minimum position then click stop.");
246 m_CalibrationStatus = Idle;
250 CalibrateToggleSP.
apply();
264 m_TargetPosition = 0;
278 if (m_ALTO->UnPark())
280 m_TargetPosition = 100;
302 MotionSpeedSP.
save(fp);
317 m_ALTO->getStatus(status);
318 std::string mst = status[
"MST"];
334 uint8_t newPosition = PositionNP[0].value;
337 m_ALTO->getPosition(newPosition);
344 if (newPosition == m_TargetPosition)
346 PositionNP[0].setValue(m_TargetPosition);
350 else if (newPosition != PositionNP[0].getValue())
352 PositionNP[0].setValue(newPosition);
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 IPState AbortCap() override
Abort motion. Must be implemented by child.
virtual bool initProperties() override
Initialize 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 initial connection to the devic...
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 setDriverInterface(uint32_t value)
setInterface Set driver interface. By default the driver interface is set to GENERAL_DEVICE....
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()
Initialize 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.
int SetTimer(uint32_t ms)
Set a timer to call the function TimerHit after ms milliseconds.
INDI::PropertySwitch ParkCapSP
bool updateProperties()
updateProperties Defines or Delete properties based on default device connection status
void initProperties(const char *group, uint32_t capabilities=0)
Initialize dust cap properties. It is recommended to call this function within initProperties() of yo...
bool processSwitch(const char *dev, const char *name, ISState *states, char *names[], int n)
Process dust cap switch properties.
void setState(IPState state)
void apply(const char *format,...) const ATTRIBUTE_FORMAT_PRINTF(2
void save(FILE *f) const
save Save property to configuration file.
const char * getName() const
bool isNameMatch(const char *otherName) const
void fill(const char *device, const char *name, const char *label, const char *group, IPerm permission, double timeout, IPState state)
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 int id
the id of the exception
const char * what() const noexcept override
returns the explanatory string
const char * MAIN_CONTROL_TAB
MAIN_CONTROL_TAB Where all the primary controls for the device are located.
#define LOGF_INFO(fmt,...)
#define LOGF_ERROR(fmt,...)