Instrument Neutral Distributed Interface INDI  1.9.2
simpledevice.cpp

A very minimal device! It also allows you to connect/disconnect and performs no other functions.

/*
INDI Developers Manual
Tutorial #1
"Hello INDI"
We construct a most basic (and useless) device driver to illustrate INDI.
Refer to README, which contains instruction on how to build this driver, and use it
with an INDI-compatible client.
*/
#include "simpledevice.h"
#include <memory>
std::unique_ptr<SimpleDevice> simpleDevice(new SimpleDevice());
/**************************************************************************************
** Client is asking us to establish connection to the device
***************************************************************************************/
{
IDMessage(getDeviceName(), "Simple device connected successfully!");
return true;
}
/**************************************************************************************
** Client is asking us to terminate connection to the device
***************************************************************************************/
{
IDMessage(getDeviceName(), "Simple device disconnected successfully!");
return true;
}
/**************************************************************************************
** INDI is asking us for our default device name
***************************************************************************************/
{
return "Simple Device";
}
simpleDevice
std::unique_ptr< SimpleDevice > simpleDevice(new SimpleDevice())
SimpleDevice
Definition: simpledevice.h:26
INDI::BaseDevice::getDeviceName
const char * getDeviceName() const
Definition: basedevice.cpp:799
SimpleDevice::getDefaultName
const char * getDefaultName() override
Definition: simpledevice.cpp:49
IDMessage
void IDMessage(const char *dev, const char *msg,...) ATTRIBUTE_FORMAT_PRINTF(2
Function Drivers call to send log messages to Clients.
SimpleDevice::Disconnect
bool Disconnect() override
Disconnect from device.
Definition: simpledevice.cpp:40
simpledevice.h
Construct a basic INDI device with only one property to connect and disconnect.
SimpleDevice::Connect
bool Connect() override
Connect to the device. INDI::DefaultDevice implementation connects to appropriate connection interfac...
Definition: simpledevice.cpp:31