2 Meade LPI Experimental driver
3 Copyright (C) 2005 by Jasem Mutlaq
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #include "v4ldriver.h"
23 class Meade_LPI
: public V4L_Driver
29 #ifdef HAVE_LINUX_VIDEODEV2_H
30 void connectCamera(void);
35 Meade_LPI::Meade_LPI() : V4L_Driver()
39 Meade_LPI::~Meade_LPI()
43 #ifdef HAVE_LINUX_VIDEODEV2_H
44 void Meade_LPI::connectCamera()
46 char errmsg
[ERRMSGSIZ
];
51 if (v4l_base
->connectCam(PortT
[0].text
, errmsg
, V4L2_PIX_FMT_SBGGR8
, 352, 288) < 0)
54 PowerS
[0].s
= ISS_OFF
;
56 IDSetSwitch(&PowerSP
, "Error: %s", errmsg
);
57 IDLog("Error: %s\n", errmsg
);
63 PowerS
[1].s
= ISS_OFF
;
65 IDSetSwitch(&PowerSP
, "Meade LPI is online. Retrieving basic data.");
67 v4l_base
->registerCallback(newFrame
, this);
69 V4LFrame
->compressedFrame
= (unsigned char *) malloc (sizeof(unsigned char) * 1);
71 IDLog("V4L Device is online. Retrieving basic data.\n");
77 PowerS
[0].s
= ISS_OFF
;
81 free(V4LFrame
->compressedFrame
);
82 V4LFrame
->compressedFrame
= NULL
;
83 v4l_base
->disconnectCam();
85 IDSetSwitch(&PowerSP
, "Video4Linux Generic Device is offline.");
93 Meade_LPI
*MainCam
= NULL
; /* Main and only camera */
95 /* send client definitions of all properties */
100 MainCam
= new Meade_LPI();
101 MainCam
->initProperties("Meade LPI");
102 MainCam
->initCamBase();
106 void ISGetProperties (const char *dev
)
110 MainCam
->ISGetProperties(dev
);
114 void ISNewSwitch (const char *dev
, const char *name
, ISState
*states
, char *names
[], int n
)
119 MainCam
->ISNewSwitch(dev
, name
, states
, names
, n
);
122 void ISNewText (const char *dev
, const char *name
, char *texts
[], char *names
[], int n
)
127 MainCam
->ISNewText(dev
, name
, texts
, names
, n
);
131 void ISNewNumber (const char *dev
, const char *name
, double values
[], char *names
[], int n
)
136 MainCam
->ISNewNumber(dev
, name
, values
, names
, n
);
139 void ISNewBLOB (const char */
*dev*/
, const char */
*name*/
, int */
*sizes
[]*/
, char **/
*blobs
[]*/
, char **/
*formats
[]*/
, char **/
*names
[]*/
, int /*n*/)
142 // We use this if we're receving binary data from the client. Most likely we won't for this driver.