Instrument Neutral Distributed Interface INDI  1.5.0
Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
INDI::DefaultDevice Class Referenceabstract

Class to provide extended functionality for devices in addition to the functionality provided by INDI::BaseDevice. This class should only be subclassed by drivers directly as it is linked with main(). Virtual drivers cannot employ INDI::DefaultDevice. More...

#include <defaultdevice.h>

Inheritance diagram for INDI::DefaultDevice:
INDI::BaseDevice AstrometryDriver Dome FlipFlat GPUSB Imager INDI::CCD INDI::Detector INDI::Dome INDI::FilterWheel INDI::Focuser INDI::GPS INDI::Telescope INDI::Weather JoyStick RainDetector SimpleDevice SimpleSkeleton SkySafari SQM STAR2000 WatchDog WeatherMeta

Public Member Functions

 DefaultDevice ()
 
virtual ~DefaultDevice ()
 
void addAuxControls ()
 Add Debug, Simulation, and Configuration options to the driver. More...
 
void addDebugControl ()
 Add Debug control to the driver. More...
 
void addSimulationControl ()
 Add Simulation control to the driver. More...
 
void addConfigurationControl ()
 Add Configuration control to the driver. More...
 
void resetProperties ()
 Set all properties to IDLE state. More...
 
void defineNumber (INumberVectorProperty *nvp)
 Define number vector to client & register it. Alternatively, IDDefNumber can be used but the property will not get registered and the driver will not be able to save configuration files. More...
 
void defineText (ITextVectorProperty *tvp)
 Define text vector to client & register it. Alternatively, IDDefText can be used but the property will not get registered and the driver will not be able to save configuration files. More...
 
void defineSwitch (ISwitchVectorProperty *svp)
 Define switch vector to client & register it. Alternatively, IDDefswitch can be used but the property will not get registered and the driver will not be able to save configuration files. More...
 
void defineLight (ILightVectorProperty *lvp)
 Define light vector to client & register it. Alternatively, IDDeflight can be used but the property will not get registered and the driver will not be able to save configuration files. More...
 
void defineBLOB (IBLOBVectorProperty *bvp)
 Define BLOB vector to client & register it. Alternatively, IDDefBLOB can be used but the property will not get registered and the driver will not be able to save configuration files. More...
 
virtual bool deleteProperty (const char *propertyName)
 Delete a property and unregister it. It will also be deleted from all clients. More...
 
virtual void setConnected (bool status, IPState state=IPS_OK, const char *msg=nullptr)
 Set connection switch status in the client. More...
 
int SetTimer (int ms)
 Set a timer to call the function TimerHit after ms milliseconds. More...
 
void RemoveTimer (int id)
 Remove timer added with SetTimer. More...
 
virtual void TimerHit ()
 Callback function to be called once SetTimer duration elapses. More...
 
virtual const char * getDriverExec ()
 
virtual const char * getDriverName ()
 
void setVersion (uint16_t vMajor, uint16_t vMinor)
 Set driver version information to be defined in DRIVER_INFO property as vMajor.vMinor. More...
 
uint16_t getMajorVersion ()
 
uint16_t getMinorVersion ()
 
virtual void ISGetProperties (const char *dev)
 define the driver's properties to the client. Usually, only a minimum set of properties are defined to the client in this function if the device is in disconnected state. Those properties should be enough to enable the client to establish a connection to the device. In addition to CONNECT/DISCONNECT, such properties may include port name, IP address, etc. You should check if the device is already connected, and if this is true, then you must define the remainder of the the properties to the client in this function. Otherwise, the remainder of the driver's properties are defined to the client in updateProperties() function which is called when a client connects/disconnects from a device. More...
 
virtual bool ISNewSwitch (const char *dev, const char *name, ISState *states, char *names[], int n)
 Process the client newSwitch command. More...
 
virtual bool ISNewNumber (const char *dev, const char *name, double values[], char *names[], int n)
 Process the client newNumber command. More...
 
virtual bool ISNewText (const char *dev, const char *name, char *texts[], char *names[], int n)
 Process the client newSwitch command. More...
 
virtual bool ISNewBLOB (const char *dev, const char *name, int sizes[], int blobsizes[], char *blobs[], char *formats[], char *names[], int n)
 Process the client newBLOB command. More...
 
virtual bool ISSnoopDevice (XMLEle *root)
 Process a snoop event from INDI server. This function is called when a snooped property is updated in a snooped driver. More...
 
virtual uint16_t getDriverInterface ()
 
void setDriverInterface (uint16_t value)
 setInterface Set driver interface. By default the driver interface is set to GENERAL_DEVICE. You may send an ORed list of DeviceInterface values. More...
 
- Public Member Functions inherited from INDI::BaseDevice
 BaseDevice ()
 
virtual ~BaseDevice ()
 
INumberVectorPropertygetNumber (const char *name)
 
ITextVectorPropertygetText (const char *name)
 
ISwitchVectorPropertygetSwitch (const char *name)
 
ILightVectorPropertygetLight (const char *name)
 
IBLOBVectorPropertygetBLOB (const char *name)
 
IPState getPropertyState (const char *name)
 
IPerm getPropertyPermission (const char *name)
 
void registerProperty (void *p, INDI_PROPERTY_TYPE type)
 
int removeProperty (const char *name, char *errmsg)
 Remove a property. More...
 
void * getRawProperty (const char *name, INDI_PROPERTY_TYPE type=INDI_UNKNOWN)
 Return a property and its type given its name. More...
 
INDI::PropertygetProperty (const char *name, INDI_PROPERTY_TYPE type=INDI_UNKNOWN)
 Return a property and its type given its name. More...
 
std::vector< INDI::Property * > * getProperties ()
 Return a list of all properties in the device. More...
 
bool buildSkeleton (const char *filename)
 Build driver properties from a skeleton file. More...
 
bool isConnected ()
 
void setDeviceName (const char *dev)
 Set the device name. More...
 
const char * getDeviceName ()
 
void addMessage (const std::string &msg)
 Add message to the driver's message queue. More...
 
void checkMessage (XMLEle *root)
 
void doMessage (XMLEle *msg)
 
std::string messageQueue (int index) const
 
std::string lastMessage ()
 
void setMediator (INDI::BaseMediator *med)
 Set the driver's mediator to receive notification of news devices and updated property values. More...
 
INDI::BaseMediatorgetMediator ()
 
const char * getDriverName ()
 
const char * getDriverExec ()
 
const char * getDriverVersion ()
 

Protected Member Functions

void setDynamicPropertiesBehavior (bool defineEnabled, bool deleteEnabled)
 setDynamicPropertiesBehavior controls handling of dynamic properties. Dyanmic properties are those generated from an external skeleton XML file. By default all properties, including dynamic properties, are defined to the client in ISGetProperties(). Furthermore, when ┼▒deleteProperty(properyName) is called, the dynamic property is deleted by default, and can only be restored by calling buildSkeleton(filename) again. However, it is sometimes desirable to skip the definition of the dynamic properties on startup and delegate this task to the child class. To control this behavior, set enabled to false. More...
 
virtual bool loadConfig (bool silent=false, const char *property=nullptr)
 Load the last saved configuration file. More...
 
virtual bool saveConfig (bool silent=false, const char *property=nullptr)
 Save the current properties in a configuration file. More...
 
virtual bool saveConfigItems (FILE *fp)
 saveConfigItems Save specific properties in the provide config file handler. Child class usually override this function to save their own properties and the base class saveConfigItems(fp) must be explicitly called by each child class. The Default Device saveConfigItems(fp) only save Debug properties options in the config file. More...
 
virtual bool saveAllConfigItems (FILE *fp)
 saveAllConfigItems Save all the drivers' properties in the configuration file More...
 
virtual bool loadDefaultConfig ()
 Load the default configuration file. More...
 
void setDebug (bool enable)
 Toggle driver debug status A driver can be more verbose if Debug option is enabled by the client. More...
 
void setSimulation (bool enable)
 Toggle driver simulation status A driver can run in simulation mode if Simulation option is enabled by the client. More...
 
virtual void debugTriggered (bool enable)
 Inform driver that the debug option was triggered. This function is called after setDebug is triggered by the client. Reimplement this function if your driver needs to take specific action after debug is enabled/disabled. Otherwise, you can use isDebug() to check if simulation is enabled or disabled. More...
 
virtual void simulationTriggered (bool enable)
 Inform driver that the simulation option was triggered. This function is called after setSimulation is triggered by the client. Reimplement this function if your driver needs to take specific action after simulation is enabled/disabled. Otherwise, you can use isSimulation() to check if simulation is enabled or disabled. More...
 
bool isDebug ()
 
bool isSimulation ()
 
virtual bool initProperties ()
 Initilize properties initial state and value. The child class must implement this function. More...
 
virtual bool updateProperties ()
 updateProperties is called whenever there is a change in the CONNECTION status of the driver. This will enable the driver to react to changes of switching ON/OFF a device. For example, a driver may only define a set of properties after a device is connected, but not before. More...
 
virtual bool Connect ()
 Connect to the device. INDI::DefaultDevice implementation connects to appropriate connection interface (Serial or TCP) governed by connectionMode. If connection is successful, it proceed to call Handshake() function to ensure communication with device is successful. For other communication interface, override the method in the child class implementation. More...
 
virtual bool Disconnect ()
 Disconnect from device. More...
 
void registerConnection (Connection::Interface *newConnection)
 registerConnection Add new connection plugin to the existing connection pool. The connection type shall be defined to the client in ISGetProperties() More...
 
bool unRegisterConnection (Connection::Interface *existingConnection)
 unRegisterConnection Remove connection from existing pool More...
 
Connection::InterfacegetActiveConnection ()
 
virtual const char * getDefaultName ()=0
 
- Protected Member Functions inherited from INDI::BaseDevice
int buildProp (XMLEle *root, char *errmsg)
 Build a property given the supplied XML element (defXXX) More...
 
int setValue (XMLEle *root, char *errmsg)
 handle SetXXX commands from client More...
 
int setBLOB (IBLOBVectorProperty *pp, XMLEle *root, char *errmsg)
 Parse and store BLOB in the respective vector. More...
 

Protected Attributes

uint32_t updatePeriodMS = 1000
 Period in milliseconds to call TimerHit(). Default 1000 ms. More...
 

Friends

class Connection::Serial
 
class Connection::TCP
 

Additional Inherited Members

- Public Types inherited from INDI::BaseDevice

Detailed Description

Class to provide extended functionality for devices in addition to the functionality provided by INDI::BaseDevice. This class should only be subclassed by drivers directly as it is linked with main(). Virtual drivers cannot employ INDI::DefaultDevice.

INDI::DefaultDevice provides capability to add Debug, Simulation, and Configuration controls. These controls (switches) are defined to the client. Configuration options permit saving and loading of AS-IS property values.

See also
Tutorial Four
Author
Jasem Mutlaq
Examples:
dome.h, raindetector.h, simpledevice.h, and simpleskeleton.h.

Definition at line 104 of file defaultdevice.h.

Constructor & Destructor Documentation

INDI::DefaultDevice::DefaultDevice ( )

Definition at line 54 of file defaultdevice.cpp.

INDI::DefaultDevice::~DefaultDevice ( )
virtual

Definition at line 65 of file defaultdevice.cpp.

Member Function Documentation

void INDI::DefaultDevice::addAuxControls ( )

Add Debug, Simulation, and Configuration options to the driver.

Examples:
simpleccd.cpp, and simpleskeleton.cpp.

Definition at line 531 of file defaultdevice.cpp.

void INDI::DefaultDevice::addConfigurationControl ( )

Add Configuration control to the driver.

Definition at line 526 of file defaultdevice.cpp.

void INDI::DefaultDevice::addDebugControl ( )

Add Debug control to the driver.

Examples:
simplescope.cpp.

Definition at line 514 of file defaultdevice.cpp.

void INDI::DefaultDevice::addSimulationControl ( )

Add Simulation control to the driver.

Definition at line 520 of file defaultdevice.cpp.

bool INDI::DefaultDevice::Connect ( )
protectedvirtual

Connect to the device. INDI::DefaultDevice implementation connects to appropriate connection interface (Serial or TCP) governed by connectionMode. If connection is successful, it proceed to call Handshake() function to ensure communication with device is successful. For other communication interface, override the method in the child class implementation.

Returns
True if connection is successful, false otherwise

Reimplemented in Imager, FocusLynxF2, AstrometryDriver, V4L2_Driver, WatchDog, FocusLynxBase, SkySafari, JoyStick, STAR2000, GPUSB, HitecAstroDCFocuser, PerfectStar, DomeScript, Dome, SynscanMount, GPSSimulator, CCDSim, RollOff, WeatherMeta, WunderGround, FocusSim, ScopeScript, DomeSim, SimpleDetector, SimpleCCD, FocusLynxF1, RainDetector, LX200Pulsar2, SimpleDevice, FilterSim, and ScopeSim.

Definition at line 946 of file defaultdevice.cpp.

void INDI::DefaultDevice::debugTriggered ( bool  enable)
protectedvirtual

Inform driver that the debug option was triggered. This function is called after setDebug is triggered by the client. Reimplement this function if your driver needs to take specific action after debug is enabled/disabled. Otherwise, you can use isDebug() to check if simulation is enabled or disabled.

Parameters
enableIf true, the debug option is set to ON.

Reimplemented in LX200Generic, FocusLynxBase, LX200AstroPhysics, SteelDrive, IEQPro, GPUSB, LX200Basic, and QFW.

Definition at line 625 of file defaultdevice.cpp.

void INDI::DefaultDevice::defineBLOB ( IBLOBVectorProperty bvp)

Define BLOB vector to client & register it. Alternatively, IDDefBLOB can be used but the property will not get registered and the driver will not be able to save configuration files.

Parameters
bvpThe BLOB vector property to be defined

Definition at line 940 of file defaultdevice.cpp.

void INDI::DefaultDevice::defineLight ( ILightVectorProperty lvp)

Define light vector to client & register it. Alternatively, IDDeflight can be used but the property will not get registered and the driver will not be able to save configuration files.

Parameters
lvpThe light vector property to be defined

Definition at line 934 of file defaultdevice.cpp.

void INDI::DefaultDevice::defineNumber ( INumberVectorProperty nvp)

Define number vector to client & register it. Alternatively, IDDefNumber can be used but the property will not get registered and the driver will not be able to save configuration files.

Parameters
nvpThe number vector property to be defined

Definition at line 916 of file defaultdevice.cpp.

void INDI::DefaultDevice::defineSwitch ( ISwitchVectorProperty svp)

Define switch vector to client & register it. Alternatively, IDDefswitch can be used but the property will not get registered and the driver will not be able to save configuration files.

Parameters
svpThe switch vector property to be defined
Examples:
dome.cpp.

Definition at line 928 of file defaultdevice.cpp.

void INDI::DefaultDevice::defineText ( ITextVectorProperty tvp)

Define text vector to client & register it. Alternatively, IDDefText can be used but the property will not get registered and the driver will not be able to save configuration files.

Parameters
tvpThe text vector property to be defined

Definition at line 922 of file defaultdevice.cpp.

bool INDI::DefaultDevice::deleteProperty ( const char *  propertyName)
virtual

Delete a property and unregister it. It will also be deleted from all clients.

Parameters
propertyNamename of property to be deleted.
Examples:
dome.cpp.

Definition at line 885 of file defaultdevice.cpp.

bool INDI::DefaultDevice::Disconnect ( )
protectedvirtual
Connection::Interface* INDI::DefaultDevice::getActiveConnection ( )
inlineprotected
Returns
Return actively selected connection plugin

Definition at line 434 of file defaultdevice.h.

virtual const char* INDI::DefaultDevice::getDefaultName ( )
protectedpure virtual
virtual const char* INDI::DefaultDevice::getDriverExec ( )
inlinevirtual
Returns
driver executable filename

Definition at line 198 of file defaultdevice.h.

uint16_t INDI::DefaultDevice::getDriverInterface ( )
virtual
Returns
getInterface Return the interface declared by the driver.

Reimplemented from INDI::BaseDevice.

Definition at line 824 of file defaultdevice.cpp.

virtual const char* INDI::DefaultDevice::getDriverName ( )
inlinevirtual
Returns
driver name

Reimplemented in LX200Generic.

Definition at line 201 of file defaultdevice.h.

uint16_t INDI::DefaultDevice::getMajorVersion ( )
inline
Returns
Major driver version number.

Definition at line 215 of file defaultdevice.h.

uint16_t INDI::DefaultDevice::getMinorVersion ( )
inline
Returns
Minor driver version number.

Definition at line 218 of file defaultdevice.h.

bool INDI::DefaultDevice::initProperties ( )
protectedvirtual
bool INDI::DefaultDevice::isDebug ( )
protected
Returns
True if Debug is on, False otherwise.

Definition at line 615 of file defaultdevice.cpp.

void INDI::DefaultDevice::ISGetProperties ( const char *  dev)
virtual

define the driver's properties to the client. Usually, only a minimum set of properties are defined to the client in this function if the device is in disconnected state. Those properties should be enough to enable the client to establish a connection to the device. In addition to CONNECT/DISCONNECT, such properties may include port name, IP address, etc. You should check if the device is already connected, and if this is true, then you must define the remainder of the the properties to the client in this function. Otherwise, the remainder of the driver's properties are defined to the client in updateProperties() function which is called when a client connects/disconnects from a device.

Parameters
devname of the device
Note
This function is called by the INDI framework, do not call it directly. See LX200 Generic driver for an example implementation

Reimplemented in INDI::CCD, INDI::Detector, INDI::Telescope, INDI::Dome, FocusLynxF2, TCFS, FocusLynxBase, INDI::Focuser, Imager, INDI::FilterWheel, AstrometryDriver, LX200Generic, V4L2_Driver, WatchDog, FlipFlat, WeatherMeta, CelestronGPS, LX200AstroPhysics, JoyStick, LX200_OnStep, WunderGround, SimpleSkeleton, SkySafari, STAR2000, SkywatcherAPIMount, GPUSB, TemmaMount, QFW, FocusLynxF1, LX200Gemini, CCDSim, LX200Pulsar2, ScopeSim, LX200_16, LX200Basic, LX200GPS, DomeScript, LX200Classic, ScopeScript, FocusSim, LX200Autostar, and SynscanMount.

Examples:
simpleskeleton.cpp.

Definition at line 635 of file defaultdevice.cpp.

bool INDI::DefaultDevice::ISNewBLOB ( const char *  dev,
const char *  name,
int  sizes[],
int  blobsizes[],
char *  blobs[],
char *  formats[],
char *  names[],
int  n 
)
virtual

Process the client newBLOB command.

Note
This function is called by the INDI framework, do not call it directly.
Returns
True if any property was successfully processed, false otherwise.

Reimplemented in TemmaMount, AstrometryDriver, Imager, SynscanMount, SimpleSkeleton, and SkywatcherAPIMount.

Definition at line 494 of file defaultdevice.cpp.

bool INDI::DefaultDevice::ISNewNumber ( const char *  dev,
const char *  name,
double  values[],
char *  names[],
int  n 
)
virtual
bool INDI::DefaultDevice::ISNewSwitch ( const char *  dev,
const char *  name,
ISState states,
char *  names[],
int  n 
)
virtual
bool INDI::DefaultDevice::ISNewText ( const char *  dev,
const char *  name,
char *  texts[],
char *  names[],
int  n 
)
virtual

Process the client newSwitch command.

Note
This function is called by the INDI framework, do not call it directly.
Returns
True if any property was successfully processed, false otherwise.

Reimplemented in INDI::CCD, INDI::Detector, INDI::Dome, INDI::Telescope, FilterIFW, FocusLynxBase, Gemini, TemmaMount, INDI::Focuser, CCDSim, SynscanMount, LX200Generic, INDI::FilterWheel, Imager, AstrometryDriver, WatchDog, V4L2_Driver, FlipFlat, WeatherMeta, JoyStick, SkywatcherAPIMount, SkySafari, SimpleSkeleton, STAR2000, WunderGround, GPUSB, LX200Pulsar2, DSC, DomeScript, and ScopeScript.

Definition at line 486 of file defaultdevice.cpp.

bool INDI::DefaultDevice::isSimulation ( )
protected
Returns
True if Simulation is on, False otherwise.

Definition at line 620 of file defaultdevice.cpp.

bool INDI::DefaultDevice::ISSnoopDevice ( XMLEle root)
virtual

Process a snoop event from INDI server. This function is called when a snooped property is updated in a snooped driver.

Note
This function is called by the INDI framework, do not call it directly.
Returns
True if any property was successfully processed, false otherwise.

Reimplemented in INDI::CCD, INDI::Detector, INDI::Dome, INDI::Telescope, INDI::Weather, INDI::Focuser, AstrometryDriver, CCDSim, Imager, INDI::FilterWheel, FlipFlat, JoyStick, STAR2000, GPUSB, WeatherMeta, Dome, and RollOff.

Definition at line 508 of file defaultdevice.cpp.

bool INDI::DefaultDevice::loadConfig ( bool  silent = false,
const char *  property = nullptr 
)
protectedvirtual

Load the last saved configuration file.

Parameters
silentif true, don't report any error or notification messages.
propertyName of property to load configuration for. If nullptr, all properties in the configuration file are loaded which is the default behavior.
Returns
True if successful, false otherwise.

Reimplemented in FilterIFW.

Examples:
simpleskeleton.cpp.

Definition at line 69 of file defaultdevice.cpp.

bool INDI::DefaultDevice::loadDefaultConfig ( )
protectedvirtual

Load the default configuration file.

Returns
True if successful, false otherwise.

Definition at line 293 of file defaultdevice.cpp.

void INDI::DefaultDevice::registerConnection ( Connection::Interface newConnection)
protected

registerConnection Add new connection plugin to the existing connection pool. The connection type shall be defined to the client in ISGetProperties()

Parameters
newConnectionPointer to new connection plugin

Definition at line 993 of file defaultdevice.cpp.

void INDI::DefaultDevice::RemoveTimer ( int  id)

Remove timer added with SetTimer.

Parameters
idID of the timer as returned from SetTimer

Definition at line 804 of file defaultdevice.cpp.

void INDI::DefaultDevice::resetProperties ( )

Set all properties to IDLE state.

Definition at line 726 of file defaultdevice.cpp.

bool INDI::DefaultDevice::saveAllConfigItems ( FILE *  fp)
protectedvirtual

saveAllConfigItems Save all the drivers' properties in the configuration file

Parameters
fppointer to config file handler
Returns
True if successful, false otherwise.

Definition at line 106 of file defaultdevice.cpp.

bool INDI::DefaultDevice::saveConfig ( bool  silent = false,
const char *  property = nullptr 
)
protectedvirtual

Save the current properties in a configuration file.

Parameters
silentif true, don't report any error or notification messages.
propertyName of specific property to save while leaving all others properties in the file as is.
Returns
True if successful, false otherwise.

Definition at line 153 of file defaultdevice.cpp.

bool INDI::DefaultDevice::saveConfigItems ( FILE *  fp)
protectedvirtual

saveConfigItems Save specific properties in the provide config file handler. Child class usually override this function to save their own properties and the base class saveConfigItems(fp) must be explicitly called by each child class. The Default Device saveConfigItems(fp) only save Debug properties options in the config file.

Parameters
fpPointer to config file handler
Returns
True if successful, false otherwise.

Reimplemented in INDI::CCD, INDI::Detector, INDI::Dome, INDI::Telescope, INDI::Weather, LX200Generic, FilterIFW, CelestronGPS, INDI::Focuser, Gemini, INDI::FilterWheel, V4L2_Driver, AstrometryDriver, LX200AstroPhysics, WatchDog, FocusLynxBase, CCDSim, SkySafari, FlipFlat, JoyStick, LX200Gemini, SteelDrive, LX200GotoNova, SkywatcherAPIMount, IEQPro, WeatherMeta, NightCrawler, NSTEP, DSC, WunderGround, STAR2000, BaaderDome, NFocus, SmartFocus, RoboFocus, HitecAstroDCFocuser, PerfectStar, LX200FS2, RollOff, DomeScript, and ScopeScript.

Definition at line 94 of file defaultdevice.cpp.

void INDI::DefaultDevice::setConnected ( bool  status,
IPState  state = IPS_OK,
const char *  msg = nullptr 
)
virtual

Set connection switch status in the client.

Parameters
statusIf true, the driver will attempt to connect to the device (CONNECT=ON). If false, it will attempt to disconnect the device.
statusTrue to set CONNECT on, false to set DISCONNECT on.
stateState of CONNECTION properti, by default IPS_OK.
msgA message to be sent along with connect/disconnect command, by default nullptr.

Definition at line 765 of file defaultdevice.cpp.

void INDI::DefaultDevice::setDebug ( bool  enable)
protected

Toggle driver debug status A driver can be more verbose if Debug option is enabled by the client.

Parameters
enableIf true, the Debug option is set to ON.

Definition at line 538 of file defaultdevice.cpp.

void INDI::DefaultDevice::setDriverInterface ( uint16_t  value)

setInterface Set driver interface. By default the driver interface is set to GENERAL_DEVICE. You may send an ORed list of DeviceInterface values.

Parameters
valueORed list of DeviceInterface values.

Definition at line 829 of file defaultdevice.cpp.

void INDI::DefaultDevice::setDynamicPropertiesBehavior ( bool  defineEnabled,
bool  deleteEnabled 
)
inlineprotected

setDynamicPropertiesBehavior controls handling of dynamic properties. Dyanmic properties are those generated from an external skeleton XML file. By default all properties, including dynamic properties, are defined to the client in ISGetProperties(). Furthermore, when ┼▒deleteProperty(properyName) is called, the dynamic property is deleted by default, and can only be restored by calling buildSkeleton(filename) again. However, it is sometimes desirable to skip the definition of the dynamic properties on startup and delegate this task to the child class. To control this behavior, set enabled to false.

Parameters
defineEnabledTrue to define all dynamic properties in INDI::DefaultDevice own ISGetProperties() on startup. False to skip defining dynamic properties.
deleteEnabledTrue to delete dynamic properties from memory in deleteProperty(name). False to keep dynamic property in the properties list, but delete it from the client.
Note
This function has no effect on regular properties initialized directly by the driver.

Definition at line 300 of file defaultdevice.h.

void INDI::DefaultDevice::setSimulation ( bool  enable)
protected

Toggle driver simulation status A driver can run in simulation mode if Simulation option is enabled by the client.

Parameters
enableIf true, the Simulation option is set to ON.

Definition at line 579 of file defaultdevice.cpp.

int INDI::DefaultDevice::SetTimer ( int  ms)

Set a timer to call the function TimerHit after ms milliseconds.

Parameters
mstimer duration in milliseconds.
Returns
id of the timer to be used with RemoveTimer
Examples:
simpleccd.cpp.

Definition at line 798 of file defaultdevice.cpp.

void INDI::DefaultDevice::setVersion ( uint16_t  vMajor,
uint16_t  vMinor 
)
inline

Set driver version information to be defined in DRIVER_INFO property as vMajor.vMinor.

Parameters
vMajormajor revision number
vMinorminor revision number

Definition at line 208 of file defaultdevice.h.

void INDI::DefaultDevice::simulationTriggered ( bool  enable)
protectedvirtual

Inform driver that the simulation option was triggered. This function is called after setSimulation is triggered by the client. Reimplement this function if your driver needs to take specific action after simulation is enabled/disabled. Otherwise, you can use isSimulation() to check if simulation is enabled or disabled.

Parameters
enableIf true, the simulation option is set to ON.

Reimplemented in FilterIFW, CelestronGPS, IEQPro, DSC, and QFW.

Definition at line 630 of file defaultdevice.cpp.

void INDI::DefaultDevice::TimerHit ( )
virtual
bool INDI::DefaultDevice::unRegisterConnection ( Connection::Interface existingConnection)
protected

unRegisterConnection Remove connection from existing pool

Parameters
existingConnectionpointer to connection interface
Returns
True if connection is removed, false otherwise.

Definition at line 998 of file defaultdevice.cpp.

bool INDI::DefaultDevice::updateProperties ( )
protectedvirtual

updateProperties is called whenever there is a change in the CONNECTION status of the driver. This will enable the driver to react to changes of switching ON/OFF a device. For example, a driver may only define a set of properties after a device is connected, but not before.

Returns
True if update is successful, false otherwise.

Reimplemented in INDI::CCD, INDI::Detector, INDI::Telescope, INDI::Dome, USBFocusV3, INDI::Weather, FilterIFW, Gemini, FocusLynxBase, TCFS, INDI::Focuser, INDI::GPS, XAGYLWheel, V4L2_Driver, SkywatcherAPIMount, AstrometryDriver, LX200Generic, Microtouch, Imager, SteelDrive, INDI::FilterWheel, LX200_10MICRON, CelestronGPS, LX200AstroPhysics, FlipFlat, DSC, BaaderDome, WeatherMeta, IEQPro, LX200_OnStep, LX200Gemini, Dome, JoyStick, HitecAstroDCFocuser, NFocus, PerfectStar, LX200Autostar, TemmaMount, STAR2000, NSTEP, Paramount, SimpleDetector, SimpleCCD, GPUSB, NightCrawler, LX200Pulsar2, RainDetector, SQM, TruTech, MoonLite, LX200Basic, ScopeSim, DomeScript, FocusLynxF1, RoboFocus, LX200Classic, CCDSim, FocusSim, LX200_16, LX200GPS, SynscanMount, DomeSim, RollOff, SmartFocus, LX200FS2, LX200GotoNova, and LX200ZEQ25.

Examples:
dome.cpp.

Definition at line 818 of file defaultdevice.cpp.

Friends And Related Function Documentation

friend class Connection::Serial
friend

Definition at line 472 of file defaultdevice.h.

friend class Connection::TCP
friend

Definition at line 473 of file defaultdevice.h.

Member Data Documentation

uint32_t INDI::DefaultDevice::updatePeriodMS = 1000
protected

Period in milliseconds to call TimerHit(). Default 1000 ms.

Definition at line 440 of file defaultdevice.h.


The documentation for this class was generated from the following files: