~ubuntu-branches/ubuntu/quantal/libindi/quantal

« back to all changes in this revision

Viewing changes to libs/indibase/indidevice.h

  • Committer: Bazaar Package Importer
  • Author(s): Rohan Garg, Rohan Garg, Jonathan Riddell, Jonathan Thomas
  • Date: 2011-07-14 18:18:04 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20110714181804-3fybxiy3tpjnk9kq
Tags: 0.8-0ubuntu1
[ Rohan Garg ]
* New upstream release
  - Add boost to build deps
  - Bump soversion to 0.8

[ Jonathan Riddell ]
* Use source format 3.0
* Add kubuntu_01_link_pthreads.diff to fix linking with pthreads

[ Jonathan Thomas ]
* Change Maintainer from MOTU to Ubuntu Developers

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*******************************************************************************
 
2
  Copyright(c) 2010 Gerry Rozema. All rights reserved.
 
3
 
 
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)
 
7
  any later version.
 
8
 
 
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
 
12
  more details.
 
13
 
 
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.
 
17
 
 
18
  The full GNU General Public License is included in this distribution in the
 
19
  file called LICENSE.
 
20
*******************************************************************************/
 
21
#ifndef INDIDEVICE_H
 
22
#define INDIDEVICE_H
 
23
 
 
24
#include <libindi/indidevapi.h>
 
25
#include <libindi/indicom.h>
 
26
#include <libindi/defaultdriver.h>
 
27
 
 
28
 
 
29
class IndiDevice : public INDI::DefaultDriver
 
30
{
 
31
 
 
32
    private:
 
33
 
 
34
    protected:
 
35
    public:
 
36
        IndiDevice();
 
37
        virtual ~IndiDevice();
 
38
 
 
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];
 
43
 
 
44
        //  Helper functions that encapsulate the indi way of doing things
 
45
        //  and give us a clean c++ class method
 
46
 
 
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();
 
52
 
 
53
        //  A helper for child classes
 
54
        virtual bool DeleteProperty(char *);
 
55
 
 
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
 
59
        bool Connected;
 
60
 
 
61
        int SetTimer(int);
 
62
        void RemoveTimer(int);
 
63
        virtual void TimerHit();
 
64
 
 
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);
 
71
 
 
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;
 
76
 
 
77
        virtual bool SaveConfig();
 
78
        virtual bool LoadConfig();
 
79
        virtual bool WritePersistentConfig(FILE *);
 
80
 
 
81
};
 
82
 
 
83
extern IndiDevice *device;
 
84
extern IndiDevice *_create_device();
 
85
 
 
86
#endif // INDIDEVICE_H