1 | #ifndef INDIBASE_H |
2 | #define INDIBASE_H |
3 | |
4 | #include "indiapi.h" |
5 | #include "indidevapi.h" |
6 | |
7 | #define MAXRBUF 2048 |
8 | |
9 | /** |
10 | * \namespace INDI |
11 | \brief Namespace to encapsulate INDI client, drivers, and mediator classes. |
12 | Developers can subclass the base devices class to implement device specific functionality. This ensures interoperability and consistency among devices within the same family |
13 | and reduces code overhead. |
14 | |
15 | <ul> |
16 | <li>BaseClient: Base class for INDI clients. By subclassing BaseClient, client can easily connect to INDI server |
17 | and handle device communication, command, and notifcation.</li> |
18 | <li>BaseMediator: Abstract class to provide interface for event notifications in INDI::BaseClient.</li> |
19 | <li>BaseDriver: Base class for all INDI virtual driver as handled and stored in INDI::BaseClient.</li> |
20 | <li>DefaultDriver: INDI::BaseDriver with extended functionality such as debug, simulation, and configuration support. |
21 | It is \e only used by drivers directly, it cannot be used by clients.</li> |
22 | <li>FilterInterface: Basic interface for filter wheels functions.</li> |
23 | <li>GuiderInterface: Basic interface for guider (ST4) port functions.</li> |
24 | <li>CCD: Base class for CCD drivers. Provides basic support for single chip CCD and CCDs with a guide head as well.</li> |
25 | <li>Telescope: Base class for telescope drivers.</li> |
26 | <li>FilterWheel: Base class for Filter Wheels. It implements the FilterInterface.</li> |
27 | <li>Focuser: Base class for focusers.</li> |
28 | <li>USBDevice: Base class for USB devices for direct read/write/control over USB.</li> |
29 | <li>Controller: Class to handle controller inputs like joysticks and gamepads.</li> |
30 | <li>Logger: Class to handle debugging and logging of drivers.</li> |
31 | </ul> |
32 | \author Jasem Mutlaq |
33 | \author Gerry Rozema |
34 | */ |
35 | namespace INDI |
36 | { |
37 | class BaseMediator; |
38 | class BaseClient; |
39 | class BaseDevice; |
40 | class DefaultDevice; |
41 | class FilterInterface; |
42 | class GuiderInterface; |
43 | class FocuserInterface; |
44 | class CCD; |
45 | class Telescope; |
46 | class FilterWheel; |
47 | class Focuser; |
48 | class USBDevice; |
49 | class Property; |
50 | class Controller; |
51 | class Logger; |
52 | } |
53 | |
54 | /*! INDI property type */ |
55 | typedef enum |
56 | { |
57 | INDI_NUMBER, /*!< INumberVectorProperty. */ |
58 | INDI_SWITCH, /*!< ISwitchVectorProperty. */ |
59 | INDI_TEXT, /*!< ITextVectorProperty. */ |
60 | INDI_LIGHT, /*!< ILightVectorProperty. */ |
61 | INDI_BLOB, /*!< IBLOBVectorProperty. */ |
62 | INDI_UNKNOWN |
63 | } INDI_TYPE; |
64 | |
65 | |
66 | /** |
67 | * \class INDI::BaseMediator |
68 | \brief Meditates event notification as generated by driver and passed to clients. |
69 | */ |
70 | class INDI::BaseMediator |
71 | { |
72 | public: |
73 | |
74 | /** \brief Emmited when a new device is created from INDI server. |
75 | \param dp Pointer to the base device instance |
76 | */ |
77 | virtual void newDevice(INDI::BaseDevice *dp) =0; |
78 | |
79 | /** \brief Emmited when a new property is created for an INDI driver. |
80 | \param property Pointer to the Property Container |
81 | |
82 | */ |
83 | virtual void newProperty(INDI::Property *property) =0; |
84 | |
85 | |
86 | /** \brief Emmited when a property is deleted for an INDI driver. |
87 | \param property Pointer to the Property Container to remove. |
88 | |
89 | */ |
90 | virtual void removeProperty(INDI::Property *property) =0; |
91 | |
92 | |
93 | /** \brief Emmited when a new BLOB value arrives from INDI server. |
94 | \param bp Pointer to filled and process BLOB. |
95 | */ |
96 | virtual void newBLOB(IBLOB *bp) =0; |
97 | |
98 | /** \brief Emmited when a new switch value arrives from INDI server. |
99 | \param svp Pointer to a switch vector property. |
100 | */ |
101 | virtual void newSwitch(ISwitchVectorProperty *svp) =0; |
102 | |
103 | /** \brief Emmited when a new number value arrives from INDI server. |
104 | \param nvp Pointer to a number vector property. |
105 | */ |
106 | virtual void newNumber(INumberVectorProperty *nvp) =0; |
107 | |
108 | /** \brief Emmited when a new text value arrives from INDI server. |
109 | \param tvp Pointer to a text vector property. |
110 | */ |
111 | virtual void newText(ITextVectorProperty *tvp) =0; |
112 | |
113 | /** \brief Emmited when a new light value arrives from INDI server. |
114 | \param lvp Pointer to a light vector property. |
115 | */ |
116 | virtual void newLight(ILightVectorProperty *lvp) =0; |
117 | |
118 | /** \brief Emmited when a new message arrives from INDI server. |
119 | \param dp pointer to the INDI device the message is sent to. |
120 | \param messageID ID of the message that can be used to retrieve the message from the device's messageQueue() function. |
121 | */ |
122 | virtual void newMessage(INDI::BaseDevice *dp, int messageID) =0; |
123 | |
124 | /** \brief Emmited when the server is connected. |
125 | */ |
126 | virtual void serverConnected() =0; |
127 | |
128 | /** \brief Emmited when the server gets disconnected. |
129 | \param exit_code 0 if client was requested to disconnect from server. -1 if connection to server is terminated due to remote server disconnection. |
130 | */ |
131 | virtual void serverDisconnected(int exit_code) =0; |
132 | |
133 | virtual ~BaseMediator() {} |
134 | |
135 | }; |
136 | |
137 | #endif // INDIBASE_H |
138 | |