2 Simple Skeleton - Tutorial Four
3 Demonstration of libindi v0.7 capabilities.
5 Copyright (C) 2010 Jasem Mutlaq (mutlaqja@ikarustech.com)
7 This library is free software;
8 you can redistribute it and / or
9 modify it under the terms of the GNU Lesser General Public
10 License as published by the Free Software Foundation;
12 version 2.1 of the License, or (at your option) any later version.
14 This library is distributed in the hope that it will be useful,
15 but WITHOUT
ANY WARRANTY;
16 without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 Lesser General Public License
for more details.
20 You should have received a copy of the GNU Lesser General Public
21 License along with
this library;
22 if not, write to the Free Software
23 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110 - 1301 USA
58 DefaultDevice::initProperties();
63 const char *skelFileName =
"/usr/share/indi/tutorial_four_sk.xml";
66 char *skel = getenv(
"INDISKEL");
70 else if (stat(skelFileName, &st) == 0)
74 "No skeleton file was specified. Set environment variable INDISKEL to the skeleton path and try again.\n");
83 IDLog(
"Property #%d: %s\n", i++, oneProperty.getName());
87 number.
onUpdate([number,
this]()
mutable
92 number.
apply(
"Cannot change property while device is disconnected.");
101 menu.
onUpdate([menu,
this]()
mutable
106 menu.
apply(
"Cannot change property while device is disconnected.");
123 blob.
onUpdate([blob,
this]()
mutable
128 blob.
apply(
"Cannot change property while device is disconnected.");
131 IDLog(
"Received BLOB with name %s, format %s, and size %d, and bloblen %d\n",
132 blob[0].getName(), blob[0].getFormat(), blob[0].getSize(), blob[0].getBlobLen());
134 IDLog(
"BLOB Content:\n"
135 "##################################\n"
137 "##################################\n",
138 blob[0].getBlobAsString().c_str());
153 static int configLoaded = 0;
159 if (configLoaded == 0)
181 return "Simple Skeleton";
INDI::PropertyNumber getNumber(const char *name) const
bool buildSkeleton(const char *filename)
Build driver properties from a skeleton file.
INDI::PropertySwitch getSwitch(const char *name) const
INDI::PropertyBlob getBLOB(const char *name) const
INDI::PropertyLight getLight(const char *name) const
Properties getProperties()
Return a list of all properties in the device.
virtual void ISGetProperties(const char *dev)
define the driver's properties to the client. Usually, only a minimum set of properties are defined t...
virtual bool loadConfig(bool silent=false, const char *property=nullptr)
Load the last saved configuration file.
void addAuxControls()
Add Debug, Simulation, and Configuration options to the driver.
void setState(IPState state)
void apply(const char *format,...) const ATTRIBUTE_FORMAT_PRINTF(2
int findOnSwitchIndex() const
void onUpdate(const std::function< void()> &callback)
bool initProperties() override
Initilize properties initial state and value. The child class must implement this function.
bool Connect() override
Connect to the device. INDI::DefaultDevice implementation connects to appropriate connection interfac...
const char * getDefaultName() override
bool Disconnect() override
Disconnect from device.
void ISGetProperties(const char *dev) override
define the driver's properties to the client. Usually, only a minimum set of properties are defined t...
void IDLog(const char *fmt,...)
std::unique_ptr< SimpleSkeleton > simpleSkeleton(new SimpleSkeleton())
Construct a basic INDI CCD device that demonstrates ability to define properties from a skeleton file...