The client will connect to the CCD driver and attempts to change the CCD temperature.
#if 0
Simple Client Tutorial
Demonstration of libindi v0.7 capabilities.
Copyright (C) 2010 Jasem Mutlaq (mutlaqja@ikarustech.com)
This library is free software;
you can redistribute it and / or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation;
either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT
ANY WARRANTY;
without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library;
if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110 - 1301 USA
#endif
#include <cstring>
#include <fstream>
#include <iostream>
#include <memory>
#define MYCCD "Simple CCD"
static std::unique_ptr<MyClient> camera_client(
new MyClient());
{
camera_client->setServer("localhost", 7624);
camera_client->watchDevice(
MYCCD);
camera_client->connectServer();
std::cout << "Press any key to terminate the client.\n";
std::string term;
std::cin >> term;
}
{
ccd_simulator = nullptr;
}
{
ccd_temperature = ccd_simulator->
getNumber(
"CCD_TEMPERATURE");
if (ccd_temperature == nullptr)
{
IDLog(
"Error: unable to find CCD Simulator CCD_TEMPERATURE property...\n");
return;
}
ccd_temperature->
np[0].value = -20;
}
{
ccd_exposure = ccd_simulator->
getNumber(
"CCD_EXPOSURE");
if (ccd_exposure == nullptr)
{
IDLog(
"Error: unable to find CCD Simulator CCD_EXPOSURE property...\n");
return;
}
IDLog(
"Taking a 1 second exposure.\n");
ccd_exposure->
np[0].value = 1;
}
{
ccd_simulator = dp;
}
{
{
return;
}
{
{
IDLog(
"CCD is connected. Setting temperature to -20 C.\n");
}
return;
}
}
{
if (strcmp(nvp->
name,
"CCD_TEMPERATURE") == 0)
{
IDLog(
"Receving new CCD Temperature: %g C\n", nvp->
np[0].value);
if (nvp->
np[0].value == -20)
{
IDLog(
"CCD temperature reached desired value!\n");
}
}
}
{
return;
IDLog(
"Recveing message from Server:\n\n########################\n%s\n########################\n\n",
}
{
std::ofstream myfile;
myfile.open("ccd_simulator.fits", std::ios::out | std::ios::binary);
myfile.write(static_cast<char *>(bp->blob), bp->bloblen);
myfile.close();
IDLog(
"Received image, saved as ccd_simulator.fits\n");
}