40 return (
const char *)
"STAR2000";
69 "Error connecting to port %s. Make sure you have BOTH write and read permission to your port.", port);
174 float STAR2000::CalcWEPulseTimeLeft()
183 gettimeofday(&now,
nullptr);
184 timesince = (double)(now.tv_sec * 1000.0 + now.tv_usec / 1000) -
185 (double)(WEPulseStart.tv_sec * 1000.0 + WEPulseStart.tv_usec / 1000);
186 timesince = timesince / 1000;
188 timeleft = WEPulseRequest - timesince;
192 float STAR2000::CalcNSPulseTimeLeft()
200 gettimeofday(&now,
nullptr);
202 timesince = (double)(now.tv_sec * 1000.0 + now.tv_usec / 1000) -
203 (double)(NSPulseStart.tv_sec * 1000.0 + NSPulseStart.tv_usec / 1000);
204 timesince = timesince / 1000;
206 timeleft = NSPulseRequest - timesince;
216 timeleft = CalcWEPulseTimeLeft();
239 slv = 100000 * timeleft;
242 timeleft = CalcWEPulseTimeLeft();
262 timeleft = CalcNSPulseTimeLeft();
285 slv = 100000 * timeleft;
288 timeleft = CalcNSPulseTimeLeft();
322 NSPulseRequest = ms / 1000.0;
323 gettimeofday(&NSPulseStart,
nullptr);
350 NSPulseRequest = ms / 1000.0;
351 gettimeofday(&NSPulseStart,
nullptr);
378 WEPulseRequest = ms / 1000.0;
379 gettimeofday(&WEPulseStart,
nullptr);
406 WEPulseRequest = ms / 1000.0;
407 gettimeofday(&WEPulseStart,
nullptr);
std::unique_ptr< STAR2000 > s2kGuide(new STAR2000())
int ConnectSTAR2k(char *port)
void DisconnectSTAR2k(void)
void StopPulse(int direction)
void StartPulse(int direction)
const char * getDeviceName() 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 void ISGetProperties(const char *dev)
define the driver's properties to the client. Usually, only a minimum set of properties are defined t...
virtual bool ISSnoopDevice(XMLEle *root)
Process a snoop event from INDI server. This function is called when a snooped property is updated in...
virtual bool loadConfig(bool silent=false, const char *property=nullptr)
Load the last saved configuration file.
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.
virtual bool initProperties()
Initilize properties initial state and value. The child class must implement this function.
bool isSimulation() const
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.
void addDebugControl()
Add Debug control to the driver.
virtual bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n)
Process the client newSwitch command.
INumberVectorProperty GuideNSNP
void initGuiderProperties(const char *deviceName, const char *groupName)
Initilize guider properties. It is recommended to call this function within initProperties() of your ...
INumberVectorProperty GuideWENP
void processGuiderProperties(const char *name, double values[], char *names[], int n)
Call this function whenever client updates GuideNSNP or GuideWSP properties in the primary device....
virtual IPState GuideEast(uint32_t ms) override
Guide east for ms milliseconds. East is defined as RA+.
virtual bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n) override
Process the client newSwitch command.
virtual IPState GuideWest(uint32_t ms) override
Guide west for ms milliseconds. West is defined as RA-.
void TimerHit() override
Callback function to be called once SetTimer duration elapses.
const char * getDefaultName() override
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.
bool Connect() override
Connect to the device. INDI::DefaultDevice implementation connects to appropriate connection interfac...
virtual void ISGetProperties(const char *dev) override
define the driver's properties to the client. Usually, only a minimum set of properties are defined t...
virtual bool ISSnoopDevice(XMLEle *root) override
Process a snoop event from INDI server. This function is called when a snooped property is updated in...
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Process the client newNumber command.
ITextVectorProperty PortTP
virtual IPState GuideSouth(uint32_t ms) override
Guide south for ms milliseconds. South is defined as DEC-.
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.
bool Disconnect() override
Disconnect from device.
virtual IPState GuideNorth(uint32_t ms) override
Guide north for ms milliseconds. North is defined as DEC+.
const char * MAIN_CONTROL_TAB
MAIN_CONTROL_TAB Where all the primary controls for the device are located.
const char * OPTIONS_TAB
OPTIONS_TAB Where all the driver's options are located. Those may include auxiliary controls,...
void IUFillTextVector(ITextVectorProperty *tvp, IText *tp, int ntp, const char *dev, const char *name, const char *label, const char *group, IPerm p, double timeout, IPState s)
Assign attributes for a text vector property. The vector's auxiliary elements will be set to NULL.
void IUFillText(IText *tp, const char *name, const char *label, const char *initialText)
Assign attributes for a text property. The text's auxiliary elements will be set to NULL.
void IUSaveConfigText(FILE *fp, const ITextVectorProperty *tvp)
Add a text vector property value to the configuration file.
int IUUpdateText(ITextVectorProperty *tvp, char *texts[], char *names[], int n)
Update all text members in a text vector property.
void IDMessage(const char *dev, const char *fmt,...)
void IDSetText(const ITextVectorProperty *tvp, const char *fmt,...)
const char * DEVICE_PORT
Device serial (or bluetooth) connection port. The default value on Linux is /dev/ttyUSB0 while on Mac...