Instrument Neutral Distributed Interface INDI
2.0.2
|
Class to provide basic INDI device functionality. More...
#include <basedevice.h>
Public Types | |
enum | INDI_ERROR { INDI_DEVICE_NOT_FOUND = -1 , INDI_PROPERTY_INVALID = -2 , INDI_PROPERTY_DUPLICATED = -3 , INDI_DISPATCH_ERROR = -4 } |
enum | { INDI_ENABLED , INDI_DISABLED } |
enum | WATCH { WATCH_NEW = 0 , WATCH_UPDATE , WATCH_NEW_OR_UPDATE } |
enum | DRIVER_INTERFACE { GENERAL_INTERFACE = 0 , TELESCOPE_INTERFACE = (1 << 0) , CCD_INTERFACE = (1 << 1) , GUIDER_INTERFACE = (1 << 2) , FOCUSER_INTERFACE = (1 << 3) , FILTER_INTERFACE = (1 << 4) , DOME_INTERFACE = (1 << 5) , GPS_INTERFACE = (1 << 6) , WEATHER_INTERFACE = (1 << 7) , AO_INTERFACE = (1 << 8) , DUSTCAP_INTERFACE = (1 << 9) , LIGHTBOX_INTERFACE = (1 << 10) , DETECTOR_INTERFACE = (1 << 11) , ROTATOR_INTERFACE = (1 << 12) , SPECTROGRAPH_INTERFACE = (1 << 13) , CORRELATOR_INTERFACE = (1 << 14) , AUX_INTERFACE = (1 << 15) , SENSOR_INTERFACE = SPECTROGRAPH_INTERFACE | DETECTOR_INTERFACE | CORRELATOR_INTERFACE } |
The DRIVER_INTERFACE enum defines the class of devices the driver implements. A driver may implement one or more interfaces. More... | |
typedef INDI::Properties | Properties |
Public Member Functions | |
BaseDevice () | |
virtual | ~BaseDevice () |
void | registerProperty (const INDI::Property &property) |
Register the property to be able to observe and update. More... | |
void | registerProperty (const INDI::Property &property, INDI_PROPERTY_TYPE type) |
int | removeProperty (const char *name, char *errmsg) |
Remove a property. More... | |
void | watchProperty (const char *name, const std::function< void(INDI::Property)> &callback, WATCH watch=WATCH_NEW) |
Call the callback function if property is available. More... | |
Property | getProperty (const char *name, INDI_PROPERTY_TYPE type=INDI_UNKNOWN) const |
Return a property and its type given its name. More... | |
Properties | getProperties () |
Return a list of all properties in the device. More... | |
const Properties | getProperties () const |
INDI::PropertyNumber | getNumber (const char *name) const |
INDI::PropertyText | getText (const char *name) const |
INDI::PropertySwitch | getSwitch (const char *name) const |
INDI::PropertyLight | getLight (const char *name) const |
INDI::PropertyBlob | getBLOB (const char *name) const |
IPState | getPropertyState (const char *name) const |
IPerm | getPropertyPermission (const char *name) const |
void * | getRawProperty (const char *name, INDI_PROPERTY_TYPE type=INDI_UNKNOWN) const |
Return a property and its type given its name. More... | |
void | addMessage (const std::string &msg) |
Add message to the driver's message queue. More... | |
void | checkMessage (XMLEle *root) |
void | doMessage (XMLEle *msg) |
const std::string & | messageQueue (size_t index) const |
const std::string & | lastMessage () const |
bool | isValid () const |
bool | isConnected () const |
void | attach () |
indicates that the device is ready More... | |
void | detach () |
indicates that the device is being removed More... | |
void | setMediator (INDI::BaseMediator *mediator) |
Set the driver's mediator to receive notification of news devices and updated property values. More... | |
INDI::BaseMediator * | getMediator () const |
void | setDeviceName (const char *dev) |
Set the device name. More... | |
const char * | getDeviceName () const |
bool | isDeviceNameMatch (const char *otherName) const |
Check that the device name matches the argument. More... | |
bool | isDeviceNameMatch (const std::string &otherName) const |
Check that the device name matches the argument. More... | |
const char * | getDriverName () const |
const char * | getDriverExec () const |
const char * | getDriverVersion () const |
uint16_t | getDriverInterface () const |
getDriverInterface returns ORed values of DRIVER_INTERFACE. It presents the device classes supported by the driver. More... | |
bool | buildSkeleton (const char *filename) |
Build driver properties from a skeleton file. More... | |
int | buildProp (const INDI::LilXmlElement &root, char *errmsg, bool isDynamic=false) |
Build a property given the supplied XML element (defXXX) More... | |
int | setValue (const INDI::LilXmlElement &root, char *errmsg) |
handle SetXXX commands from client More... | |
operator BaseDevice * () | |
BaseDevice * | operator-> () |
bool | operator!= (std::nullptr_t) const |
bool | operator== (std::nullptr_t) const |
operator bool () const | |
operator bool () | |
Static Public Member Functions | |
static std::string | getSharedFilePath (std::string fileName) |
Protected Member Functions | |
BaseDevice (BaseDevicePrivate &dd) | |
BaseDevice (const std::shared_ptr< BaseDevicePrivate > &dd) | |
Protected Attributes | |
std::shared_ptr< BaseDevicePrivate > | d_ptr |
Friends | |
class | AbstractBaseClientPrivate |
Class to provide basic INDI device functionality.
INDI::BaseDevice is the base device for all INDI devices and contains a list of all properties defined by the device either explicity or via a skeleton file. You don't need to subclass INDI::BaseDevice class directly, it is inheritied by INDI::DefaultDevice which takes care of building a standard INDI device. Moreover, INDI::BaseClient maintains a list of INDI::BaseDevice objects as they get defined from the INDI server, and those objects may be accessed to retrieve information on the object properties or message log.
Definition at line 51 of file basedevice.h.
Definition at line 55 of file basedevice.h.
anonymous enum |
Used for switch Enabled/Disabled or On/Off type properties
Enumerator | |
---|---|
INDI_ENABLED | |
INDI_DISABLED |
Definition at line 68 of file basedevice.h.
The DRIVER_INTERFACE enum defines the class of devices the driver implements. A driver may implement one or more interfaces.
Enumerator | |
---|---|
GENERAL_INTERFACE | Default interface for all INDI devices |
TELESCOPE_INTERFACE | Telescope interface, must subclass INDI::Telescope |
CCD_INTERFACE | |
GUIDER_INTERFACE | Guider interface, must subclass INDI::GuiderInterface |
FOCUSER_INTERFACE | Focuser interface, must subclass INDI::FocuserInterface |
FILTER_INTERFACE | Filter interface, must subclass INDI::FilterInterface |
DOME_INTERFACE | Dome interface, must subclass INDI::Dome |
GPS_INTERFACE | |
WEATHER_INTERFACE | Weather interface, must subclass INDI::Weather |
AO_INTERFACE | Adaptive Optics Interface |
DUSTCAP_INTERFACE | Dust Cap Interface |
LIGHTBOX_INTERFACE | Light Box Interface |
DETECTOR_INTERFACE | Detector interface, must subclass INDI::Detector |
ROTATOR_INTERFACE | Rotator interface, must subclass INDI::RotatorInterface |
SPECTROGRAPH_INTERFACE | Spectrograph interface |
CORRELATOR_INTERFACE | Correlators (interferometers) interface |
AUX_INTERFACE | Auxiliary interface |
SENSOR_INTERFACE |
Definition at line 83 of file basedevice.h.
Used for watchProperty callback method.
Enumerator | |
---|---|
WATCH_NEW | Applies to discovered properties only. |
WATCH_UPDATE | Applies to updated properties only. |
WATCH_NEW_OR_UPDATE | Applies when a property appears or is updated, i.e. both of the above. |
Definition at line 75 of file basedevice.h.
INDI::BaseDevice::BaseDevice | ( | ) |
Definition at line 74 of file basedevice.cpp.
|
virtual |
Definition at line 78 of file basedevice.cpp.
|
protected |
Definition at line 81 of file basedevice.cpp.
|
protected |
Definition at line 85 of file basedevice.cpp.
void INDI::BaseDevice::addMessage | ( | const std::string & | msg | ) |
Add message to the driver's message queue.
msg | Message to add. |
Definition at line 878 of file basedevice.cpp.
void INDI::BaseDevice::attach | ( | ) |
indicates that the device is ready
Definition at line 531 of file basedevice.cpp.
int INDI::BaseDevice::buildProp | ( | const INDI::LilXmlElement & | root, |
char * | errmsg, | ||
bool | isDynamic = false |
||
) |
Build a property given the supplied XML element (defXXX)
root | XML element to parse and build. |
errmsg | buffer to store error message in parsing fails. |
isDynamic | set to true if property is loaded from an XML file. |
Definition at line 324 of file basedevice.cpp.
bool INDI::BaseDevice::buildSkeleton | ( | const char * | filename | ) |
Build driver properties from a skeleton file.
filename | full path name of the file. |
A skeloton file defines the properties supported by this driver. It is a list of defXXX elements enclosed by <INDIDriver>@ and </INDIDriver>@ opening and closing tags. After the properties are created, they can be rerieved, manipulated, and defined to other clients.
Definition at line 302 of file basedevice.cpp.
void INDI::BaseDevice::checkMessage | ( | XMLEle * | root | ) |
Definition at line 842 of file basedevice.cpp.
void INDI::BaseDevice::detach | ( | ) |
indicates that the device is being removed
Definition at line 537 of file basedevice.cpp.
void INDI::BaseDevice::doMessage | ( | XMLEle * | msg | ) |
Definition at line 852 of file basedevice.cpp.
INDI::PropertyBlob INDI::BaseDevice::getBLOB | ( | const char * | name | ) | const |
Definition at line 109 of file basedevice.cpp.
const char * INDI::BaseDevice::getDeviceName | ( | ) | const |
Definition at line 821 of file basedevice.cpp.
const char * INDI::BaseDevice::getDriverExec | ( | ) | const |
Definition at line 952 of file basedevice.cpp.
uint16_t INDI::BaseDevice::getDriverInterface | ( | ) | const |
getDriverInterface returns ORed values of DRIVER_INTERFACE. It presents the device classes supported by the driver.
Definition at line 964 of file basedevice.cpp.
const char * INDI::BaseDevice::getDriverName | ( | ) | const |
Definition at line 945 of file basedevice.cpp.
const char * INDI::BaseDevice::getDriverVersion | ( | ) | const |
Definition at line 958 of file basedevice.cpp.
INDI::PropertyLight INDI::BaseDevice::getLight | ( | const char * | name | ) | const |
Definition at line 104 of file basedevice.cpp.
INDI::BaseMediator * INDI::BaseDevice::getMediator | ( | ) | const |
Definition at line 976 of file basedevice.cpp.
INDI::PropertyNumber INDI::BaseDevice::getNumber | ( | const char * | name | ) | const |
Definition at line 89 of file basedevice.cpp.
BaseDevice::Properties INDI::BaseDevice::getProperties | ( | ) |
Return a list of all properties in the device.
Definition at line 158 of file basedevice.cpp.
const BaseDevice::Properties INDI::BaseDevice::getProperties | ( | ) | const |
Definition at line 164 of file basedevice.cpp.
INDI::Property INDI::BaseDevice::getProperty | ( | const char * | name, |
INDI_PROPERTY_TYPE | type = INDI_UNKNOWN |
||
) | const |
Return a property and its type given its name.
name | of property to be found. |
type | of property found. |
Definition at line 138 of file basedevice.cpp.
IPerm INDI::BaseDevice::getPropertyPermission | ( | const char * | name | ) | const |
Definition at line 123 of file basedevice.cpp.
IPState INDI::BaseDevice::getPropertyState | ( | const char * | name | ) | const |
Definition at line 114 of file basedevice.cpp.
void * INDI::BaseDevice::getRawProperty | ( | const char * | name, |
INDI_PROPERTY_TYPE | type = INDI_UNKNOWN |
||
) | const |
Return a property and its type given its name.
name | of property to be found. |
type | of property found. |
Definition at line 132 of file basedevice.cpp.
|
static |
Definition at line 213 of file basedevice.cpp.
INDI::PropertySwitch INDI::BaseDevice::getSwitch | ( | const char * | name | ) | const |
Definition at line 99 of file basedevice.cpp.
INDI::PropertyText INDI::BaseDevice::getText | ( | const char * | name | ) | const |
Definition at line 94 of file basedevice.cpp.
bool INDI::BaseDevice::isConnected | ( | ) | const |
Definition at line 520 of file basedevice.cpp.
bool INDI::BaseDevice::isDeviceNameMatch | ( | const char * | otherName | ) | const |
Check that the device name matches the argument.
Definition at line 827 of file basedevice.cpp.
bool INDI::BaseDevice::isDeviceNameMatch | ( | const std::string & | otherName | ) | const |
Check that the device name matches the argument.
Definition at line 833 of file basedevice.cpp.
bool INDI::BaseDevice::isValid | ( | ) | const |
Definition at line 904 of file basedevice.cpp.
const std::string & INDI::BaseDevice::lastMessage | ( | ) | const |
Definition at line 896 of file basedevice.cpp.
const std::string & INDI::BaseDevice::messageQueue | ( | size_t | index | ) | const |
Definition at line 888 of file basedevice.cpp.
INDI::BaseDevice::operator BaseDevice * | ( | ) |
Definition at line 988 of file basedevice.cpp.
|
inline |
Definition at line 301 of file basedevice.h.
|
inline |
Definition at line 297 of file basedevice.h.
|
inline |
Definition at line 286 of file basedevice.h.
BaseDevice * INDI::BaseDevice::operator-> | ( | ) |
Definition at line 982 of file basedevice.cpp.
|
inline |
Definition at line 292 of file basedevice.h.
void INDI::BaseDevice::registerProperty | ( | const INDI::Property & | property | ) |
Register the property to be able to observe and update.
property | any property from the INDI::PropertyXXX family. |
Definition at line 924 of file basedevice.cpp.
void INDI::BaseDevice::registerProperty | ( | const INDI::Property & | property, |
INDI_PROPERTY_TYPE | type | ||
) |
Definition at line 940 of file basedevice.cpp.
int INDI::BaseDevice::removeProperty | ( | const char * | name, |
char * | errmsg | ||
) |
Remove a property.
name | name of property to be removed. Pass NULL to remove the whole device. |
errmsg | buffer to store error message. |
Definition at line 170 of file basedevice.cpp.
void INDI::BaseDevice::setDeviceName | ( | const char * | dev | ) |
void INDI::BaseDevice::setMediator | ( | INDI::BaseMediator * | mediator | ) |
Set the driver's mediator to receive notification of news devices and updated property values.
Definition at line 970 of file basedevice.cpp.
int INDI::BaseDevice::setValue | ( | const INDI::LilXmlElement & | root, |
char * | errmsg | ||
) |
handle SetXXX commands from client
Definition at line 567 of file basedevice.cpp.
void INDI::BaseDevice::watchProperty | ( | const char * | name, |
const std::function< void(INDI::Property)> & | callback, | ||
WATCH | watch = WATCH_NEW |
||
) |
Call the callback function if property is available.
name | of property. |
callback | as an argument of the function you can use INDI::PropertyNumber, INDI::PropertySwitch etc. |
watch | you can decide whether the callback should be executed only once (WATCH_NEW) on discovery of the property or also on every change of the value (WATCH_UPDATE) or both (WATCH_NEW_OR_UPDATE) |
Definition at line 910 of file basedevice.cpp.
|
friend |
Definition at line 307 of file basedevice.h.
|
protected |
Definition at line 308 of file basedevice.h.