Instrument Neutral Distributed Interface INDI  1.4.1
Public Types | Public Member Functions | Protected Member Functions | Friends | List of all members
INDI::BaseDevice Class Reference

Class to provide basic INDI device functionality. More...

#include <basedevice.h>

Inheritance diagram for INDI::BaseDevice:
INDI::DefaultDevice INDI::CCD INDI::Dome INDI::FilterWheel INDI::Focuser INDI::GPS INDI::Telescope INDI::Weather

Public Types

Public Member Functions

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)
 
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.
 
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 (std::string msg)
 Add message to the driver's message queue. More...
 
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.
 
INDI::BaseMediatorgetMediator ()
 
const char * getDriverName ()
 
const char * getDriverExec ()
 
const char * getDriverVersion ()
 
virtual uint16_t getDriverInterface ()
 

Protected Member Functions

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
 
int setBLOB (IBLOBVectorProperty *pp, XMLEle *root, char *errmsg)
 Parse and store BLOB in the respective vector.
 

Friends

class INDI::BaseClient
 
class INDI::BaseClientQt
 
class INDI::DefaultDevice
 

Detailed Description

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.

Author
Jasem Mutlaq
Examples:
tutorial_client.cpp, and tutorial_client.h.

Definition at line 44 of file basedevice.h.

Member Enumeration Documentation

Interfaces define 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 

CCD interface, must subclass INDI::CCD

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 

GPS interface, must subclass INDI::GPS

WEATHER_INTERFACE 

Weather interface, must subclass INDI::Weather

AO_INTERFACE 

Adaptive Optics Interface

DUSTCAP_INTERFACE 

Dust Cap Interface

LIGHTBOX_INTERFACE 

Light Box Interface

AUX_INTERFACE 

Auxiliary interface

Definition at line 61 of file basedevice.h.

INDI error codes.

Enumerator
INDI_DEVICE_NOT_FOUND 

INDI Device was not found.

INDI_PROPERTY_INVALID 

Property has an invalid syntax or attribute.

INDI_PROPERTY_DUPLICATED 

INDI Device was not found.

INDI_DISPATCH_ERROR 

Dispatching command to driver failed.

Definition at line 51 of file basedevice.h.

Member Function Documentation

void INDI::BaseDevice::addMessage ( std::string  msg)

Add message to the driver's message queue.

Parameters
msgMessage to add.

Definition at line 1255 of file basedevice.cpp.

int INDI::BaseDevice::buildProp ( XMLEle *  root,
char *  errmsg 
)
protected

Build a property given the supplied XML element (defXXX)

Parameters
rootXML element to parse and build.
errmsgbuffer to store error message in parsing fails.
Returns
0 if parsing is successful, -1 otherwise and errmsg is set

Definition at line 526 of file basedevice.cpp.

bool INDI::BaseDevice::buildSkeleton ( const char *  filename)

Build driver properties from a skeleton file.

Parameters
filenamefull path name of the file.
Returns
true if successful, false otherwise.

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.

See also
An example skeleton file can be found under examples/tutorial_four_sk.xml

Definition at line 464 of file basedevice.cpp.

IBLOBVectorProperty * INDI::BaseDevice::getBLOB ( const char *  name)
Returns
Return vector BLOB property given its name

Definition at line 107 of file basedevice.cpp.

const char * INDI::BaseDevice::getDeviceName ( )
Returns
Returns the device name
Examples:
tutorial_client.cpp.

Definition at line 1209 of file basedevice.cpp.

const char * INDI::BaseDevice::getDriverExec ( )
Returns
driver executable name
Note
This can only be valid if DRIVER_INFO is defined by the driver.

Definition at line 1382 of file basedevice.cpp.

uint16_t INDI::BaseDevice::getDriverInterface ( )
virtual
Returns
driver interface descriptor
Note
This can only be valid if DRIVER_INFO is defined by the driver.

Reimplemented in INDI::DefaultDevice.

Definition at line 1410 of file basedevice.cpp.

const char * INDI::BaseDevice::getDriverName ( )
Returns
driver name
Note
This can only be valid if DRIVER_INFO is defined by the driver.

Definition at line 1368 of file basedevice.cpp.

const char * INDI::BaseDevice::getDriverVersion ( )
Returns
driver version
Note
This can only be valid if DRIVER_INFO is defined by the driver.

Definition at line 1396 of file basedevice.cpp.

ILightVectorProperty * INDI::BaseDevice::getLight ( const char *  name)
Returns
Return vector light property given its name

Definition at line 98 of file basedevice.cpp.

INDI::BaseMediator* INDI::BaseDevice::getMediator ( )
inline
Returns
Get the meditator assigned to this driver

Definition at line 169 of file basedevice.h.

INumberVectorProperty * INDI::BaseDevice::getNumber ( const char *  name)
Returns
Return vector number property given its name

Definition at line 71 of file basedevice.cpp.

INDI::Property * INDI::BaseDevice::getProperty ( const char *  name,
INDI_PROPERTY_TYPE  type = INDI_UNKNOWN 
)

Return a property and its type given its name.

Parameters
nameof property to be found.
typeof property found.
Returns
If property is found, it is returned. To be used you must use static_cast with given the type of property returned.

Definition at line 312 of file basedevice.cpp.

IPerm INDI::BaseDevice::getPropertyPermission ( const char *  name)
Returns
Return property permission

Definition at line 181 of file basedevice.cpp.

IPState INDI::BaseDevice::getPropertyState ( const char *  name)
Returns
Return property state

Definition at line 116 of file basedevice.cpp.

void * INDI::BaseDevice::getRawProperty ( const char *  name,
INDI_PROPERTY_TYPE  type = INDI_UNKNOWN 
)

Return a property and its type given its name.

Parameters
nameof property to be found.
typeof property found.
Returns
If property is found, the raw void * pointer to the IXXXVectorProperty is returned. To be used you must use static_cast with given the type of property returned. For example, INumberVectorProperty *num = static_cast<INumberVectorProperty> getRawProperty("FOO", INDI_NUMBER);
Note
This is a low-level function and should not be called directly unless necessary. Use getXXX instead where XXX is the property type (Number, Text, Switch..etc).

Definition at line 239 of file basedevice.cpp.

ISwitchVectorProperty * INDI::BaseDevice::getSwitch ( const char *  name)
Returns
Return vector switch property given its name

Definition at line 89 of file basedevice.cpp.

ITextVectorProperty * INDI::BaseDevice::getText ( const char *  name)
Returns
Return vector text property given its name

Definition at line 80 of file basedevice.cpp.

bool INDI::BaseDevice::isConnected ( )
Returns
True if the device is connected (CONNECT=ON), False otherwise

Definition at line 916 of file basedevice.cpp.

string INDI::BaseDevice::lastMessage ( )
Returns
Returns last message message.

Definition at line 1272 of file basedevice.cpp.

string INDI::BaseDevice::messageQueue ( int  index) const
Returns
Returns a specific message.
Examples:
tutorial_client.cpp.

Definition at line 1263 of file basedevice.cpp.

int INDI::BaseDevice::removeProperty ( const char *  name,
char *  errmsg 
)

Remove a property.

Parameters
namename of property to be removed. Pass NULL to remove the whole device.
errmsgbuffer to store error message.
Returns
0 if successul, -1 otherwise.

Definition at line 385 of file basedevice.cpp.

void INDI::BaseDevice::setDeviceName ( const char *  dev)

Set the device name.

Parameters
devnew device name

Definition at line 1204 of file basedevice.cpp.


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