Instrument Neutral Distributed Interface INDI  2.0.2
simpledevice.cpp
Go to the documentation of this file.
1 /*
2  INDI Developers Manual
3  Tutorial #1
4 
5  "Hello INDI"
6 
7  We construct a most basic (and useless) device driver to illustrate INDI.
8 
9  Refer to README, which contains instruction on how to build this driver, and use it
10  with an INDI-compatible client.
11 
12 */
13 
22 #include "simpledevice.h"
23 
24 #include <memory>
25 
26 std::unique_ptr<SimpleDevice> simpleDevice(new SimpleDevice());
27 
28 /**************************************************************************************
29 ** Client is asking us to establish connection to the device
30 ***************************************************************************************/
32 {
33  IDMessage(getDeviceName(), "Simple device connected successfully!");
34  return true;
35 }
36 
37 /**************************************************************************************
38 ** Client is asking us to terminate connection to the device
39 ***************************************************************************************/
41 {
42  IDMessage(getDeviceName(), "Simple device disconnected successfully!");
43  return true;
44 }
45 
46 /**************************************************************************************
47 ** INDI is asking us for our default device name
48 ***************************************************************************************/
50 {
51  return "Simple Device";
52 }
const char * getDeviceName() const
Definition: basedevice.cpp:821
bool Disconnect() override
Disconnect from device.
const char * getDefaultName() override
bool Connect() override
Connect to the device. INDI::DefaultDevice implementation connects to appropriate connection interfac...
void IDMessage(const char *dev, const char *fmt,...)
Definition: indidriver.c:960
std::unique_ptr< SimpleDevice > simpleDevice(new SimpleDevice())
Construct a basic INDI device with only one property to connect and disconnect.