1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155
|
/*
Meade LPI Experimental driver
Copyright (C) 2005 by Jasem Mutlaq
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
*/
#include "v4ldriver.h"
class Meade_LPI : public V4L_Driver
{
public:
Meade_LPI();
~Meade_LPI();
#ifdef HAVE_LINUX_VIDEODEV2_H
void connectCamera(void);
#endif
};
Meade_LPI::Meade_LPI() : V4L_Driver()
{
}
Meade_LPI::~Meade_LPI()
{
}
#ifdef HAVE_LINUX_VIDEODEV2_H
void Meade_LPI::connectCamera()
{
char errmsg[ERRMSGSIZ];
switch (PowerS[0].s)
{
case ISS_ON:
if (v4l_base->connectCam(PortT[0].text, errmsg, V4L2_PIX_FMT_SBGGR8, 352, 288) < 0)
{
PowerSP.s = IPS_IDLE;
PowerS[0].s = ISS_OFF;
PowerS[1].s = ISS_ON;
IDSetSwitch(&PowerSP, "Error: unable to open device");
IDLog("Error: %s\n", errmsg);
return;
}
/* Sucess! */
PowerS[0].s = ISS_ON;
PowerS[1].s = ISS_OFF;
PowerSP.s = IPS_OK;
IDSetSwitch(&PowerSP, "Meade LPI is online. Retrieving basic data.");
v4l_base->registerCallback(newFrame, this);
V4LFrame->compressedFrame = (unsigned char *) malloc (sizeof(unsigned char) * 1);
IDLog("Meade LPI is online. Retrieving basic data.\n");
getBasicData();
break;
case ISS_OFF:
PowerS[0].s = ISS_OFF;
PowerS[1].s = ISS_ON;
PowerSP.s = IPS_IDLE;
free(V4LFrame->compressedFrame);
V4LFrame->compressedFrame = NULL;
v4l_base->disconnectCam();
IDSetSwitch(&PowerSP, "Meade LPI is offline.");
break;
}
}
#endif
Meade_LPI *MainCam = NULL; /* Main and only camera */
/* send client definitions of all properties */
void ISInit()
{
if (MainCam == NULL)
{
MainCam = new Meade_LPI();
MainCam->initProperties("Meade LPI");
MainCam->initCamBase();
}
}
void ISGetProperties (const char *dev)
{
ISInit();
MainCam->ISGetProperties(dev);
}
void ISNewSwitch (const char *dev, const char *name, ISState *states, char *names[], int n)
{
ISInit();
MainCam->ISNewSwitch(dev, name, states, names, n);
}
void ISNewText (const char *dev, const char *name, char *texts[], char *names[], int n)
{
ISInit();
MainCam->ISNewText(dev, name, texts, names, n);
}
void ISNewNumber (const char *dev, const char *name, double values[], char *names[], int n)
{
ISInit();
MainCam->ISNewNumber(dev, name, values, names, n);
}
void ISNewBLOB (const char *dev, const char *name, int sizes[], int blobsizes[], char *blobs[], char *formats[], char *names[], int n)
{
INDI_UNUSED(dev);
INDI_UNUSED(name);
INDI_UNUSED(sizes);
INDI_UNUSED(blobsizes);
INDI_UNUSED(blobs);
INDI_UNUSED(formats);
INDI_UNUSED(names);
INDI_UNUSED(n);
}
void ISSnoopDevice (XMLEle *root)
{
INDI_UNUSED(root);
}
|