35 static std::unique_ptr<TruTech> tru_wheel(
new TruTech());
45 return "TruTech Wheel";
53 IUFillSwitchVector(&HomeSP, HomeS, 1,
getDeviceName(),
"HOME",
"Home",
MAIN_CONTROL_TAB,
IP_RW,
ISR_1OFMANY, 60,
77 if (!strcmp(HomeSP.
name, name))
81 LOG_INFO(
"Filter set to home position.");
103 int rc = 0, nbytes_written = 0, nbytes_read = 0;
106 char filter_command[
BUF_SIZE] = {0};
111 tcflush(
PortFD, TCIOFLUSH);
117 LOGF_ERROR(
"Sending command Home to filter failed: %s", error_message);
120 char filter_response[
BUF_SIZE] = {0};
126 LOGF_ERROR(
"Error receiving response from filter: %s", error_message);
129 if (
static_cast<uint8_t
>(filter_response[0]) ==
COMM_INIT)
144 int rc = 0, nbytes_written = 0;
145 char filter_command[
BUF_SIZE] = {0};
152 tcflush(
PortFD, TCIOFLUSH);
159 LOGF_ERROR(
"Sending command select filter failed: %s", error_message);
175 int rc = 0, nbytes_written = 0, nbytes_read = 0;
178 char filter_command[
BUF_SIZE] = {0};
183 tcflush(
PortFD, TCIOFLUSH);
189 LOGF_WARN(
"Sending filter query failed: %s", error_message);
193 char filter_response[
BUF_SIZE] = {0};
199 LOGF_ERROR(
"Error receiving response from filter: %s", error_message);
202 if (
static_cast<uint8_t
>(filter_response[0]) ==
COMM_INIT)
205 if (filter_response[2] > 0x30)
const char * getDeviceName() const
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)
uint32_t getCurrentPollingPeriod() const
getCurrentPollingPeriod Return the current polling period.
void addAuxControls()
Add Debug, Simulation, and Configuration options to the driver.
int SetTimer(uint32_t ms)
Set a timer to call the function TimerHit after ms milliseconds.
INumberVectorProperty 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.
virtual bool initProperties() override
Initilize 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.
int QueryFilter() override
Return current filter position.
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override
Process the client newSwitch command.
bool initProperties() override
Initilize properties initial state and value. The child class must implement this function.
bool updateProperties() override
updateProperties is called whenever there is a change in the CONNECTION status of the driver....
bool SelectFilter(int) override
Select a new filter position.
void TimerHit() override
Callback function to be called once SetTimer duration elapses.
const char * getDefaultName() override
bool Handshake() override
perform handshake with device to check communication
const char * MAIN_CONTROL_TAB
MAIN_CONTROL_TAB Where all the primary controls for the device are located.
int tty_write(int fd, const char *buf, int nbytes, int *nbytes_written)
Writes a buffer to fd.
int tty_read(int fd, char *buf, int nbytes, int timeout, int *nbytes_read)
read buffer from terminal
void tty_error_msg(int err_code, char *err_msg, int err_msg_len)
Retrieve the tty error message.
Implementations for common driver routines.
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.
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.
void IDSetNumber(const INumberVectorProperty *nvp, const char *fmt,...)
void IDSetSwitch(const ISwitchVectorProperty *svp, const char *fmt,...)
#define LOGF_WARN(fmt,...)
#define LOGF_DEBUG(fmt,...)
#define LOGF_ERROR(fmt,...)