To start developing INDI drivers, it is necessary to set up an environment for C/C++ development. While INDI can be developed on any OS, It is recommended to use a Debian based distribution with KDE, preferably Kubuntu. Kubuntu offers a complete development platform and provides all the necessary packages required to get started including KStars which is used as one of the graphical frontend clients.
Alternatively, if you are developing under another OS, you can opt to download the Ekos VM. It comes pre-installed with INDI & KStars and is based on the latest Kubuntu release.
You can use any text editor or IDE of your preference. It is recommended to use the cross-platform Qt Creator IDE since it supports CMake builds among other features. You can install Qt Creator from Ubuntu by typing the following command in the console:
sudo apt-get install qtcreator
After installing the OS and IDE, install the necessary pre-requisites:
sudo apt-get install libnova-dev libcfitsio3-dev libusb-1.0-0-dev zlib1g-dev libgsl0-dev build-essential cmake git libjpeg-dev libcurl4-gnutls-dev kdesudo
Once installation is complete, create the projects directory and check out INDI sources from Git:
mkdir ~/Projects cd ~/Projects git clone https://github.com/indilib/indi.git
You can now build libindi. You can either build the INDI Library from the command line or build it from within QtCreator:
- Console Build
To build indilib from the console, open a terminal and run the following:
mkdir -p ~/Projects/build/libindi cd ~/Projects/build/libindi cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Debug ~/Projects/indi/libindi sudo make install
All the drivers reside in the drivers directory, each placed in the corresponding device category directory. Furthermore, 3rd party drivers are located under trunk/3rdparty directory and each is considered a separate project with dependency on core libindi.
To open INDI Library in Qt Creator, go to File -> Open File or Project , and then browse to libindi directory and select CMakeLists.txt. After the project is loaded, click the Projects icons on the left pane, then edit the CMake build settings. Set CMAKE_INSTALL_PREFIX to /usr instead of the default /usr/local
Another important point is that if you are running multiple drivers in INDI server, then the driver you want to debug must be the first driver passed to indiserver. For example, if you plan to run indi_simulator_ccd and indi_simulator_telescope in the debugger, and want to debug indi_simulator_telescope, then run indiserver as following:
indiserver -v indi_simulator_telescope indi_simulator_ccd
After CMake configure process is completed successfully, you can compile libindi and start coding!
The follow is a short video on how to setup libindi in QtCreator in Debug mode (for Celestron GPS driver) and how to use KStars to connect to it while under development.
Developing 3rd party drivers
As described in the 3rd Party drivers section, each driver consists of source code to control your device in additional to an XML file that can be used by client applications to list your device.
For example, the Ekos drivers list is built by parsing INDI XML driver files located (by default on Linux) in /usr/share/indi. You can start experimenting with 3rd party drivers by checking out the Generic CCD driver example.
Start by opening the Generic CCD CMakelists.txt project in QtCreator. Check out the video below for how to setup Generic CCD under Qt Creator: