1
/*******************************************************************************
2
Copyright(c) 2010 Gerry Rozema. All rights reserved.
4
This program is free software; you can redistribute it and/or modify it
5
under the terms of the GNU General Public License as published by the Free
6
Software Foundation; either version 2 of the License, or (at your option)
9
This program is distributed in the hope that it will be useful, but WITHOUT
10
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14
You should have received a copy of the GNU General Public License along with
15
this program; if not, write to the Free Software Foundation, Inc., 59
16
Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18
The full GNU General Public License is included in this distribution in the
20
*******************************************************************************/
24
#include <libindi/indidevapi.h>
25
#include <libindi/indicom.h>
26
#include <libindi/defaultdriver.h>
29
class IndiDevice : public INDI::DefaultDriver
37
virtual ~IndiDevice();
39
// These are the properties we define, that are generic to pretty much all devices
40
// They are public to make them available to all dervied classes and thier children
41
ISwitchVectorProperty ConnectionSV; // Vector of switches for our connection stuff
42
ISwitch ConnectionS[2];
44
// Helper functions that encapsulate the indi way of doing things
45
// and give us a clean c++ class method
47
virtual int init_properties();
48
// This will be called after connecting
49
// to flesh out and update properties to the
50
// client when the device is connected
51
virtual bool UpdateProperties();
53
// A helper for child classes
54
virtual bool DeleteProperty(char *);
56
// A state variable applicable to all devices
57
// and I cant get any intelligent result from the parent
58
// class calling isConnected or setConnected, so, we wont use it
62
void RemoveTimer(int);
63
virtual void TimerHit();
65
// The function dispatchers required for all drivers
66
virtual void ISGetProperties (const char *dev);
67
virtual bool ISNewNumber (const char *dev, const char *name, double values[], char *names[], int n);
68
virtual bool ISNewText (const char *dev, const char *name, char *texts[], char *names[], int n);
69
virtual bool ISNewSwitch (const char *dev, const char *name, ISState *states, char *names[], int n);
70
virtual void ISSnoopDevice (XMLEle *root);
72
// some virtual functions that our underlying classes are meant to override
73
virtual bool Connect();
74
virtual bool Disconnect();
75
virtual char *getDefaultName()=0;
77
virtual bool SaveConfig();
78
virtual bool LoadConfig();
79
virtual bool WritePersistentConfig(FILE *);
83
extern IndiDevice *device;
84
extern IndiDevice *_create_device();
86
#endif // INDIDEVICE_H