57static std::unique_ptr<iEFW> iefw_wheel(
new iEFW());
67 return "iOptron Wheel";
93 bool rc1 = getiEFWInfo();
94 bool rc2 = getiEFWfirmwareInfo();
115 LOG_INFO(
"Filter is at home position");
136bool iEFW::getiEFWInfo()
138 int nbytes_written = 0, nbytes_read = 0, rc = -1;
140 int iefwpos, iefwmodel, iefwlast;
142 tcflush(
PortFD, TCIOFLUSH);
147 LOGF_ERROR(
"Init send iEFW deviceinfo error: %s.", errstr);
155 LOGF_ERROR(
"Init read iEFW deviceinfo error: %s.", errstr);
158 tcflush(
PortFD, TCIOFLUSH);
159 resp[nbytes_read] =
'\0';
160 sscanf(resp,
"%6d%2d%4d", &iefwpos, &iefwmodel, &iefwlast);
161 if ((iefwmodel == 98) || (iefwmodel == 99))
182 LOGF_ERROR(
"iEFW getinfo Response: %s", resp);
191bool iEFW::getiEFWfirmwareInfo()
193 int nbytes_written = 0, nbytes_read = 0, rc = -1;
196 char iefwfirminfo[16] = {0};
197 tcflush(
PortFD, TCIOFLUSH);
201 LOGF_ERROR(
"get iEFW FiremwareInfo error: %s.", errstr);
206 LOGF_ERROR(
"get iEFW FirmwareInfo error: %s.", errstr);
209 tcflush(
PortFD, TCIOFLUSH);
210 resp[nbytes_read] =
'\0';
211 sscanf(resp,
"%12s", iefwfirminfo);
215 LOGF_DEBUG(
"Success, response from iEFW is : %s", iefwfirminfo);
221 int nbytes_written = 0, nbytes_read = 0, rc = -1;
225 tcflush(
PortFD, TCIOFLUSH);
229 LOGF_ERROR(
"send iEFW filter pos Info error: %s.", errstr);
234 LOGF_ERROR(
"read iEFW filter pos Info error: %s.", errstr);
237 tcflush(
PortFD, TCIOFLUSH);
238 resp[nbytes_read] =
'\0';
239 LOGF_DEBUG(
"Success, response from iEFW is : %s", resp);
240 rc = sscanf(resp,
"%2d", &iefwpos);
259bool iEFW::getiEFWID()
261 return getiEFWInfo();
266 int nbytes_written = 0, rc = -1;
282 tcflush(
PortFD, TCIOFLUSH);
283 snprintf(
cmd, 7,
":WM0%d#", f);
287 LOGF_ERROR(
"select iEFW send pos Info error: %s.", errstr);
289 tcflush(
PortFD, TCIOFLUSH);
296 while (iefwpos == -1);
void setDefaultBaudRate(BaudRate newRate)
setDefaultBaudRate Set default baud rate. The default baud rate is 9600 unless otherwise changed by t...
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)
INDI::PropertyNumber FilterSlotNP
void SelectFilterDone(int newpos)
The child class calls this function when the hardware successfully finished selecting a new filter wh...
virtual bool updateProperties() override
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) override
Process the client newSwitch command.
Connection::Serial * serialConnection
virtual bool initProperties() override
Initialize properties initial state and value. The child class must implement this function.
void setFilterConnection(const uint8_t &value)
setFilterConnection Set Filter connection mode. Child class should call this in the constructor befor...
int PortFD
For Serial & TCP connections.
void setState(IPState state)
void apply(const char *format,...) const ATTRIBUTE_FORMAT_PRINTF(2
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)
INDI::PropertyText WheelIDTP
const char * getDefaultName() override
bool updateProperties() override
updateProperties is called whenever there is a change in the CONNECTION status of the driver....
INDI::PropertyText FirmwareTP
bool Handshake() override
perform handshake with device to check communication
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override
Process the client newSwitch command.
int QueryFilter() override
Return current filter position.
bool SelectFilter(int) override
Select a new filter position.
bool initProperties() override
Initialize properties initial state and value. The child class must implement this function.
const char * FILTER_TAB
FILTER_TAB Where all the properties for filter wheels are located.
int tty_read_section(int fd, char *buf, char stop_char, int timeout, int *nbytes_read)
read buffer from terminal with a delimiter
int tty_write(int fd, const char *buf, int nbytes, int *nbytes_written)
Writes a buffer to fd.
void tty_error_msg(int err_code, char *err_msg, int err_msg_len)
Retrieve the tty error message.
Implementations for common driver routines.
#define LOGF_DEBUG(fmt,...)
#define LOGF_ERROR(fmt,...)