3 INDI Interface
for V4L devices
4 Copyright (C) 2003 - 2013 Jasem Mutlaq (mutlaqja@ikarustech.com)
6 This library is free software;
7 you can redistribute it and / or
8 modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation;
11 version 2.1 of the License, or (at your option) any later version.
13 This library is distributed in the hope that it will be useful,
14 but WITHOUT
ANY WARRANTY;
15 without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 Lesser General Public License
for more details.
19 You should have received a copy of the GNU Lesser General Public
20 License along with
this library;
21 if not, write to the Free Software
22 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110 - 1301 USA
45 {
"NexImage 5",
"NexImage 5",
nullptr, 2.2f, -1,
true },
46 {
"Logitech Webcam Pro 9000",
"UVC Camera (046d:0809)",
"Logitech Webcam Pro 9000", 3.3f, -1,
true },
47 {
"SVBONY SV105",
"SVBONY SV105: SVBONY SV105",
"SVBONY SV105", 3.0f, -1,
true },
48 {
"SVBONY SV205",
"SVBONY SV205: SVBONY SV205",
"SVBONY SV205", 4.0f, -1,
true },
49 {
"NexImage 10",
"NexImage 10",
nullptr, 1.67f, -1,
true },
50 {
"NexImage Burst Color",
"NexImage Burst Color",
nullptr, 3.75f, -1,
false },
51 {
"NexImage Burst Mono",
"NexImage Burst Mono",
nullptr, 3.75f, -1,
false },
52 {
"Skyris 132C",
"Skyris 132C",
nullptr, 3.75f, -1,
false },
53 {
"Skyris 132M",
"Skyris 132M",
nullptr, 3.75f, -1,
false },
54 {
"Skyris 236C",
"Skyris 236C",
nullptr, 2.8f, -1,
false },
55 {
"Skyris 236M",
"Skyris 236M",
nullptr, 2.8f, -1,
false },
56 {
"iOptron iPolar",
"iOptron iPolar: iOptron iPolar",
nullptr, 3.75f, -1,
true },
57 {
"iOptron iPolar",
"iOptron iPolar",
nullptr, 3.75f, -1,
true },
58 {
"iOptron iGuider",
"iOptron iGuider: iOptron iGuide",
nullptr, 3.75f, -1,
true },
59 {
"iOptron iGuider",
"iOptron iGuider 1",
nullptr, 3.75f, -1,
true },
60 {
"Raspberry Pi High Quality Camera",
"mmal service 16.1",
"Raspberry Pi High Quality Camera", 1.55f, -1,
true },
61 {
"Logitech HD C270",
"UVC Camera (046d:0825)",
"Logitech HD C270", 2.8f, -1,
true },
62 {
"IMX290 Camera",
"USB 2.0 Camera: USB Camera",
"USB 2.0 IMX290 Board", 2.9f, -1,
true },
63 {
"IMX290 H264 Camera",
"0c45:6366 Microdia",
"Spinel 2MP Full HD Low Light WDR H264 USB Camera Module IMX290", 2.9f, -1,
true },
64 {
"Microsoft LifeCam Cinema",
"Microsoft® LifeCam Cinema(TM):",
"Microsoft® LifeCam Cinema(TM)", 3.0f, -1,
false },
65 {
"OpenAstroGuider",
"OpenAstroGuider IMX290",
nullptr, 2.9f, -1,
false },
66 {
nullptr,
nullptr,
nullptr, 5.6f, -1,
false}
240 LOG_WARN(
"Can not init Long Exposure");
242 #ifdef HAVE_WEBSOCKET
287 #ifdef WITH_V4L2_EXPERIMENTS
318 #ifdef WITH_V4L2_EXPERIMENTS
328 std::transform(deviceName.begin(), deviceName.end(), deviceName.begin(), ::tolower);
331 std::string infoDeviceName = std::string(info->
deviceName);
332 std::transform(infoDeviceName.begin(), infoDeviceName.end(), infoDeviceName.begin(), ::tolower);
333 std::string infoDeviceLabel = std::string(info->
deviceLabel);
334 std::transform(infoDeviceLabel.begin(), infoDeviceLabel.end(), infoDeviceLabel.begin(), ::tolower);
337 if (infoDeviceName == deviceName || infoDeviceLabel == deviceName)
353 LOGF_INFO(
"Setting pixel size correctly for %s", commonName);
354 if (info->
tested ==
false)
356 LOGF_INFO(
"Please report that the camera worked: Name: %s/%s Detected and working, to https://bit.ly/2S1Vxjq",
362 LOGF_INFO(
"Setting pixel size to default of %5.2f", pixX);
363 LOGF_INFO(
"For future autodetection of pixel size, please report the following: Reported Name: %s, "
364 "Common Name (Eg: NexImage 10), Pixel Size to the following thread: https://bit.ly/2S1Vxjq",
405 #ifdef WITH_V4L2_EXPERIMENTS
430 LOG_ERROR(
"Can not set input while capturing.");
437 unsigned int inputindex, oldindex;
445 LOGF_INFO(
"ERROR (setinput): %s", errmsg);
489 LOG_ERROR(
"Can not set format while capturing.");
502 if (index < 0 || v4l_base->setcaptureformat(*((
unsigned int *)
CaptureFormatsSP.
sp[index].aux), errmsg) == -1)
504 LOGF_INFO(
"ERROR (setformat): %s", errmsg);
527 #ifdef WITH_V4L2_EXPERIMENTS
535 uint8_t pixelDepth = 8;
537 Streamer->setPixelFormat(pixelFormat, pixelDepth);
551 LOG_ERROR(
"Can not set capture size while capturing.");
558 int index{0}, w {0}, h {0};
566 LOGF_INFO(
"ERROR (setsize): %s", errmsg);
602 LOG_ERROR(
"Can not change frame rate while capturing.");
608 struct v4l2_fract frate;
612 sscanf(
FrameRatesSP.
sp[index].name,
"%d/%d", &frate.numerator, &frate.denominator);
615 LOGF_INFO(
"ERROR (setframerate): %s", errmsg);
631 LOG_WARN(
"Can not set Image depth (8/16bits) while recording.");
672 if (strcmp(
Options[iopt].name, name) == 0)
676 unsigned int ctrl_id, optindex, ctrlindex;
686 if (
Options[iopt].sp[optindex].aux !=
nullptr)
687 ctrlindex = *(
unsigned int *)(
Options[iopt].sp[optindex].aux);
689 ctrlindex = optindex;
690 ctrl_id = (*((
unsigned int *)
Options[iopt].aux));
691 LOGF_DEBUG(
" On switch is (%d) %s=\"%s\", ctrl_id = 0x%X ctrl_index=%d", optindex,
692 Options[iopt].sp[optindex].name,
Options[iopt].sp[optindex].label, ctrl_id, ctrlindex);
701 LOGF_ERROR(
"Unable to adjust setting. %s", errmsg);
731 LOG_WARN(
"No color processing in color mode ");
777 LOG_ERROR(
"Can not set capture size while capturing.");
784 unsigned int sizes[2], w = 0, h = 0;
787 if (strcmp(names[0],
"Width") == 0)
789 sizes[0] = values[0];
790 sizes[1] = values[1];
794 sizes[0] = values[1];
795 sizes[1] = values[0];
799 LOGF_INFO(
"ERROR (setsize): %s", errmsg);
804 if (strcmp(names[0],
"Width") == 0)
807 rsizes[0] = (double)w;
809 rsizes[1] = (double)h;
814 rsizes[1] = (double)w;
816 rsizes[0] = (double)h;
842 unsigned int const ctrl_id = *((
unsigned int *)
ImageAdjustNP.
np[i].aux0);
861 LOGF_WARN(
"Control %s set to %f returned %f (ctrl_id = 0x%X)",
883 LOG_ERROR(
"Cannot start new exposure while streamer is busy, stop streaming first");
890 "Cannot start new exposure until the current one completes (%.3f seconds left).",
926 LOGF_INFO(
"Using long exposure mode for %.3f sec frame.", duration);
929 LOGF_INFO(
"Started %.3f-second long exposure.", duration);
935 "Unable to start %.3f-second long exposure, falling back to auto exposure", duration);
954 LOGF_INFO(
"Started %.3f-second manual exposure.", duration);
959 LOGF_WARN(
"Failed %.3f-second manual exposure, no adequate control is registered.",
974 long ticks = lround(duration * 10000.0f);
985 LOGF_WARN(
"Absolute exposure duration control is undefined, stacking up to %.3f seconds using %.16s.",
990 IDLog(
"Interval = %d %d\n", fn,
fd);
991 ticks = (long)(10000.0 * (
float)fn / (float)
fd + 0.5);
999 LOG_ERROR(
"Absolute exposure duration control is undefined and tacking is not supported");
1006 LOGF_ERROR(
"Failed exposing, the absolute exposure duration control is undefined, and stacking is not ready.",
"");
1007 LOGF_ERROR(
"Configure grayscale and stacking in order to stack streamed frames up to %.3f seconds.", duration);
1016 LOG_WARN(
"Requested manual exposure is out of device bounds auto set stackMode to ADDITIVE" );
1028 LOGF_WARN(
"Requested manual exposure is out of device bounds [%.3f,%.3f], stacking up to %.3f seconds using %.16s.",
1037 LOGF_ERROR(
"Failed %.3f-second manual exposure, out of device bounds [%.3f,%.3f], and stacking is not ready.",
1039 LOGF_ERROR(
"Configure grayscale and stacking in order to stack streamed frames up to %.3f seconds.", duration);
1086 LOGF_ERROR(
"Unable to adjust manual/auto exposure control. %s", errmsg);
1096 LOGF_WARN(
"Failed switching to manual exposure, control is unavailable",
"");
1107 LOGF_DEBUG(
"%.3f-second exposure translates to %ld 1/10,000th-second device ticks.",
1110 unsigned int const ctrl_id = *((
unsigned int *)
AbsExposureN->aux0);
1126 LOGF_ERROR(
"Failed %.3f-second manual exposure, out of device bounds [%.3f,%.3f].",
1143 if (1.0f < remaining)
1159 LOG_WARN(
"Cannot start exposure while streaming is in progress");
1165 LOGF_WARN(
"Cannot start exposure while another is in progress (%.3f seconds left)",
1175 LOGF_WARN(
"V4L2 base failed starting capture (%s)", errmsg);
1196 LOG_WARN(
"No exposure or streaming in progress");
1202 LOGF_WARN(
"Stopping running exposure %.3f seconds before completion",
1212 LOGF_WARN(
"V4L2 base failed stopping capture (%s)", errmsg);
1250 if (hor == 1 && ver == 1)
1257 LOG_WARN(
"Binning color frames is currently not supported.");
1263 LOGF_WARN(
"Cannot accept asymmetrical binning %dx%d.", hor, ver);
1267 if (hor != 1 && hor != 2 && hor != 4)
1269 LOG_WARN(
"Can only accept 1x1, 2x2, and 4x4 binning.");
1275 LOG_WARN(
"Cannot change binning while streaming/recording.");
1293 struct v4l2_rect crect;
1305 LOGF_INFO(
"ERROR (setcroprect): %s", errmsg);
1337 while (src < end)
if (frameMax - *dest < *src)
1342 else *dest++ += *src++;
1347 struct timeval
V4L2_Driver::getElapsedExposure() const
1349 struct timeval now = { .tv_sec = 0, .tv_usec = 0 }, duration = { .tv_sec = 0, .tv_usec = 0 };
1350 gettimeofday( &now,
nullptr );
1351 timersub(&now, &capture_start, &duration);
1357 struct timeval remaining = { .tv_sec = 0, .tv_usec = 0 };
1359 return (
float) remaining.tv_sec + (float) remaining.tv_usec / 1000000.0f;
1366 timersub(&
frame_received, ¤t_frame_duration, ¤t_frame_duration);
1378 unsigned char *
buffer =
nullptr;
1400 totalBytes = width * height * (dbpp / 8);
1406 totalBytes = width * height * (dbpp / 8) * 3;
1413 unsigned short * src = (
unsigned short *)
buffer;
1414 unsigned char * dest =
buffer;
1415 unsigned char shift = 0;
1428 for (
int i = 0; i < totalBytes; i++)
1430 *dest++ = *(src++) >> shift;
1435 unsigned char * src = (
unsigned char *)
buffer + 1;
1437 for (
int i = 0; i < totalBytes; i++)
1465 LOG_DEBUG(
"Skip frame, setup not complete yet" );
1469 struct timeval capture_frame_dif = { .tv_sec = 0, .tv_usec = 0 };
1472 float cfd = (float) capture_frame_dif.tv_sec + (
float) capture_frame_dif.tv_usec / 1000000.0f;
1475 if( cfd <
fd * 0.9 )
1477 LOGF_DEBUG(
"Skip early frame cfd = %ld.%06ld seconds.", capture_frame_dif.tv_sec, capture_frame_dif.tv_usec);
1483 LOGF_DEBUG(
"Frame took %ld.%06ld s, e = %ld.%06ld s, t = %ld.%06ld s., cfd = %ld.%06ld s.",
1484 current_frame_duration.tv_sec, current_frame_duration.tv_usec,
1487 capture_frame_dif.tv_sec, capture_frame_dif.tv_usec
1524 unsigned char * src, *dest;
1567 *dest++ = (
unsigned char)((*src++ * 255.0f) /
subframeCount);
1577 *dest++ = (
unsigned short)((*src++ * 65535.0f) /
subframeCount);
1595 *dest++ = *src < 1.0f ? (
unsigned char)((*src * 255)) : 255;
1607 *dest++ = *src < 1.0f ? (
unsigned short)((*src * 65535)) : 65535;
1629 *dest++ = (
unsigned char)((*src++ * 255));
1639 *dest++ = (
unsigned short)((*src++ * 65535));
1653 unsigned char * red = dest;
1659 *(red++) = *(src + i);
1660 *(green++) = *(src + i + 1);
1661 *(blue++) = *(src + i + 2);
1675 LOGF_INFO(
"Capture of LX frame took %ld.%06ld seconds.", current_exposure.tv_sec, current_exposure.tv_usec);
1687 LOGF_DEBUG(
"%s: streamer is busy, continue capturing\n", __FUNCTION__);
1691 LOGF_INFO(
"Capture of one frame (%d stacked frames) took %ld.%06ld seconds.",
subframeCount, current_exposure.tv_sec,
1692 current_exposure.tv_usec);
1705 IDLog(
"%s: frame received while not exposing, force-aborting capture\n", __FUNCTION__);
1725 LOG_WARN(
"Cannot abort exposure while video streamer is busy, stop streaming first");
1736 LOGF_ERROR(
"Error: unable to open device %s: %s",
PortT[0].text, errmsg);
1750 if (!(strcmp((
const char *)
v4l_base->
cap.driver,
"pwc")))
1752 "To use LED Long exposure mode with recent kernels, see https://code.google.com/p/pwc-lxled/");
1771 return (
const char *)
"V4L2 CCD";
1779 int inputindex = -1, formatindex = -1;
1780 struct v4l2_fract frate;
1796 if (inputindex >= 0 && formatindex >= 0)
1797 LOGF_INFO(
"Found initial Input \"%s\", Format \"%s\", Size %dx%d, Frame interval %d/%ds",
1801 LOGF_INFO(
"Found initial size %dx%d, frame interval %d/%ds", w, h, frate.numerator,
1806 #ifdef WITH_V4L2_EXPERIMENTS
1825 uint8_t pixelDepth = 8;
1827 Streamer->setPixelFormat(pixelFormat, pixelDepth);
1836 LOG_DEBUG(
"Enumerating V4L2 controls...");
1875 if (strcmp(
Options[i].label,
"Exposure, Auto") == 0 || strcmp(
Options[i].label,
"Auto Exposure") == 0)
1900 LOG_ERROR(
"Critical Error: Unable to initialize driver. Low memory.");
1921 LOG_WARN(
"Cannot stream binned color frame.");
1926 if (onSwitch && strstr(onSwitch->label,
"JPEG"))
1937 LOGF_WARN(
"Cannot stop streaming, exposure running (%.1f seconds remaining)",
1960 if (format.isValid())
1972 return Streamer->saveConfigItems(fp);
1981 case V4L2_PIX_FMT_GREY:
1982 #ifdef V4L2_PIX_FMT_Y10
1983 case V4L2_PIX_FMT_Y10:
1985 #ifdef V4L2_PIX_FMT_Y12
1986 case V4L2_PIX_FMT_Y12:
1988 #ifdef V4L2_PIX_FMT_Y16
1989 case V4L2_PIX_FMT_Y16:
1992 #ifdef V4L2_PIX_FMT_Y10
1993 if (v4l2format == V4L2_PIX_FMT_Y10)
1996 #ifdef V4L2_PIX_FMT_Y12
1997 if (v4l2format == V4L2_PIX_FMT_Y12)
2000 #ifdef V4L2_PIX_FMT_Y16
2001 if (v4l2format == V4L2_PIX_FMT_Y16)
2005 case V4L2_PIX_FMT_SBGGR8:
2006 #ifdef V4L2_PIX_FMT_SBGGR10
2007 case V4L2_PIX_FMT_SBGGR10:
2009 #ifdef V4L2_PIX_FMT_SBGGR12
2010 case V4L2_PIX_FMT_SBGGR12:
2012 case V4L2_PIX_FMT_SBGGR16:
2014 #ifdef V4L2_PIX_FMT_SBGGR10
2015 if (v4l2format == V4L2_PIX_FMT_SBGGR10)
2018 #ifdef V4L2_PIX_FMT_SBGGR12
2019 if (v4l2format == V4L2_PIX_FMT_SBGGR12)
2022 if (v4l2format == V4L2_PIX_FMT_SBGGR16)
2025 case V4L2_PIX_FMT_SGBRG8:
2026 #ifdef V4L2_PIX_FMT_SGBRG10
2027 case V4L2_PIX_FMT_SGBRG10:
2029 #ifdef V4L2_PIX_FMT_SGBRG12
2030 case V4L2_PIX_FMT_SGBRG12:
2033 #ifdef V4L2_PIX_FMT_SGBRG10
2034 if (v4l2format == V4L2_PIX_FMT_SGBRG10)
2037 #ifdef V4L2_PIX_FMT_SGBRG12
2038 if (v4l2format == V4L2_PIX_FMT_SGBRG12)
2042 #if defined(V4L2_PIX_FMT_SGRBG8) || defined(V4L2_PIX_FMT_SGRBG10) || defined(V4L2_PIX_FMT_SGRBG12)
2043 #ifdef V4L2_PIX_FMT_SGRBG8
2044 case V4L2_PIX_FMT_SGRBG8:
2046 #ifdef V4L2_PIX_FMT_SGRBG10
2047 case V4L2_PIX_FMT_SGRBG10:
2049 #ifdef V4L2_PIX_FMT_SGRBG12
2050 case V4L2_PIX_FMT_SGRBG12:
2053 #ifdef V4L2_PIX_FMT_SGRBG10
2054 if (v4l2format == V4L2_PIX_FMT_SGRBG10)
2058 #ifdef V4L2_PIX_FMT_SGRBG12
2059 if (v4l2format == V4L2_PIX_FMT_SGRBG12)
2064 #if defined(V4L2_PIX_FMT_SRGGB8) || defined(V4L2_PIX_FMT_SRGGB10) || defined(V4L2_PIX_FMT_SRGGB12)
2065 #ifdef V4L2_PIX_FMT_SRGGB8
2066 case V4L2_PIX_FMT_SRGGB8:
2068 #ifdef V4L2_PIX_FMT_SRGGB10
2069 case V4L2_PIX_FMT_SRGGB10:
2071 #ifdef V4L2_PIX_FMT_SRGGB12
2072 case V4L2_PIX_FMT_SRGGB12:
2075 #ifdef V4L2_PIX_FMT_SRGGB10
2076 if (v4l2format == V4L2_PIX_FMT_SRGGB10)
2079 #ifdef V4L2_PIX_FMT_SRGGB12
2080 if (v4l2format == V4L2_PIX_FMT_SRGGB12)
2085 case V4L2_PIX_FMT_RGB24:
2088 case V4L2_PIX_FMT_BGR24:
2100 LOG_WARN(
"Can not set Image type (GRAY/COLOR) while recording.");
const char * getDeviceName() const
Property getProperty(const char *name, INDI_PROPERTY_TYPE type=INDI_UNKNOWN) const
Return a property and its type given its name.
void setDeviceName(const char *dev)
Set the device name.
uint8_t * getFrameBuffer()
getFrameBuffer Get raw frame buffer of the CCD chip.
void setExposureDuration(double duration)
setExposureDuration Set desired CCD frame exposure duration for next exposure. You must call this fun...
void setResolution(uint32_t x, uint32_t y)
setResolution set CCD Chip resolution
int getSubH() const
getSubH Get the height of the frame
double getExposureDuration() const
getExposureDuration Get requested exposure duration for the CCD chip in seconds.
int getBPP() const
getBPP Get CCD Chip depth (bits per pixel).
void setFrame(uint32_t subx, uint32_t suby, uint32_t subw, uint32_t subh)
setFrame Set desired frame resolutoin for an exposure.
void setMinMaxStep(const char *property, const char *element, double min, double max, double step, bool sendToClient=true)
setMinMaxStep for a number property element
int getBinX() const
getBinX Get horizontal binning of the CCD chip.
INumberVectorProperty * getCCDInfo()
Return CCD Info Property.
void setImageExtension(const char *ext)
setImageExtension Set image exntension
void setExposureLeft(double duration)
setExposureLeft Update exposure time left. Inform the client of the new exposure time left value.
int getSubW() const
getSubW Get the width of the frame
void setFrameBufferSize(uint32_t nbuf, bool allocMem=true)
setFrameBufferSize Set desired frame buffer size. The function will allocate memory accordingly....
int getFrameBufferSize() const
getFrameBufferSize Get allocated frame buffer size to hold the CCD image frame.
void setBin(uint8_t hor, uint8_t ver)
setBin Set CCD Chip binnig
void binFrame()
binFrame Perform software binning on the CCD frame. Only use this function if hardware binning is not...
void setBPP(uint8_t bpp)
setBPP Set depth of CCD chip.
void setNAxis(int value)
setNAxis Set FITS number of axis
uint32_t GetCCDCapability() const
GetCCDCapability returns the CCD capabilities.
std::unique_ptr< StreamManager > Streamer
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override
Process the client newSwitch command.
virtual bool ExposureComplete(CCDChip *targetChip)
Uploads target Chip exposed buffer as FITS to the client. Dervied classes should class this function ...
virtual void ISGetProperties(const char *dev) override
define the driver's properties to the client. Usually, only a minimum set of properties are defined t...
INDI::PropertySwitch EncodeFormatSP
Specifies Driver image encoding format (FITS, Native, JPG, ..etc)
virtual bool initProperties() override
Initilize properties initial state and value. The child class must implement this function.
virtual bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n) override
Process the client newSwitch command.
virtual bool updateProperties() override
updateProperties is called whenever there is a change in the CONNECTION status of the driver....
virtual void addCaptureFormat(const CaptureFormat &format)
addCaptureFormat Add a supported camera native capture format (e.g. Mono, Bayer8.....
virtual bool saveConfigItems(FILE *fp) override
saveConfigItems Save configuration items in XML file.
INDI::PropertySwitch CaptureFormatSP
Specifies Camera NATIVE capture format (e.g. Mono, RGB, RAW8..etc).
void SetCCDCapability(uint32_t cap)
SetCCDCapability Set the CCD capabilities. Al fields must be initialized.
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Process the client newNumber command.
virtual void SetCCDParams(int x, int y, int bpp, float xf, float yf)
Setup CCD paramters for primary CCD. Child classes call this function to update CCD parameters.
virtual bool saveConfig(bool silent=false, const char *property=nullptr)
Save the current properties in a configuration file.
void setVersion(uint16_t vMajor, uint16_t vMinor)
Set driver version information to be defined in DRIVER_INFO property as vMajor.vMinor.
virtual bool loadConfig(bool silent=false, const char *property=nullptr)
Load the last saved configuration file.
virtual bool deleteProperty(const char *propertyName)
Delete a property and unregister it. It will also be deleted from all clients.
void defineProperty(INumberVectorProperty *property)
void addDebugControl()
Add Debug control to the driver.
bool isNameMatch(const char *otherName) const
int findOnSwitchIndex() const
int stop_capturing(char *errmsg)
virtual void disconnectCam(bool stopcapture)
int(V4L2_Base::* setframerate)(struct v4l2_fract frate, char *errmsg)
struct v4l2_rect getcroprect()
bool enumerate_ext_ctrl()
int setINTControl(unsigned int ctrl_id, double new_value, char *errmsg)
struct v4l2_capability cap
void queryControls(INumberVectorProperty *nvp, unsigned int *nnumber, ISwitchVectorProperty **options, unsigned int *noptions, const char *dev, const char *group)
int getControl(unsigned int ctrl_id, double *value, char *errmsg)
void setColorProcessing(bool quantization, bool colorconvert, bool linearization)
void getframerates(ISwitchVectorProperty *frameratessp, INumberVectorProperty *frameratenp)
void registerCallback(WPF *fp, void *ud)
void getcaptureformats(ISwitchVectorProperty *captureformatssp)
int start_capturing(char *errmsg)
void getcapturesizes(ISwitchVectorProperty *capturesizessp, INumberVectorProperty *capturesizenp)
unsigned char * getMJPEGBuffer(int &size)
struct v4l2_fract(V4L2_Base::* getframerate)()
void setDeviceName(const char *name)
int setcapturesize(unsigned int w, unsigned int h, char *errmsg)
unsigned char * getRGBBuffer()
int setcroprect(int x, int y, int w, int h, char *errmsg)
bool queryExtControls(INumberVectorProperty *nvp, unsigned int *nnumber, ISwitchVectorProperty **options, unsigned int *noptions, const char *dev, const char *group)
void getinputs(ISwitchVectorProperty *inputssp)
void setNative(bool value)
int setinput(unsigned int inputindex, char *errmsg)
int setOPTControl(unsigned int ctrl_id, unsigned int new_value, char *errmsg)
virtual int connectCam(const char *devpath, char *errmsg, int pixelFormat=-1, int width=-1, int height=-1)
bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n)
bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n)
bool initProperties(INDI::DefaultDevice *device)
bool setManualExposure(double duration)
ITextVectorProperty camNameTP
virtual bool StopStreaming() override
StopStreaming Stop live video streaming.
virtual const char * getDefaultName() override
virtual bool StartStreaming() override
StartStreaming Start live video streaming.
ITextVectorProperty CaptureColorSpaceTP
INumberVectorProperty FrameRateNP
virtual void getBasicData()
struct timeval getElapsedExposure() const
struct timeval exposure_duration
virtual bool Connect() override
Connect to the device. INDI::DefaultDevice implementation connects to appropriate connection interfac...
INumberVectorProperty CaptureSizesNP
struct timeval frame_received
bool setShutter(double duration)
ISwitchVectorProperty FrameRatesSP
virtual void updateV4L2Controls()
virtual bool Disconnect() override
Disconnect from device.
INumberVectorProperty ImageAdjustNP
ISwitchVectorProperty InputsSP
bool startlongexposure(double timeinsec)
ISwitchVectorProperty CaptureFormatsSP
virtual bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n) override
Process the client newSwitch command.
virtual bool UpdateCCDFrame(int x, int y, int w, int h) override
CCD calls this function when CCD Frame dimension needs to be updated in the hardware....
ITextVectorProperty PortTP
virtual void initCamBase()
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override
Process the client newSwitch command.
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Process the client newNumber command.
virtual bool AbortExposure() override
Abort ongoing exposure.
ISwitchVectorProperty ImageDepthSP
virtual bool updateProperties() override
updateProperties is called whenever there is a change in the CONNECTION status of the driver....
virtual bool StartExposure(float duration) override
Start exposing primary CCD chip.
char defaultVideoPort[256]
unsigned int non_capture_frames
virtual bool initProperties() override
Initilize properties initial state and value. The child class must implement this function.
struct timeval frame_duration
struct timeval capture_start
ISwitchVectorProperty CaptureSizesSP
struct timeval elapsed_exposure
ISwitchVectorProperty ColorProcessingSP
virtual void ISGetProperties(const char *dev) override
define the driver's properties to the client. Usually, only a minimum set of properties are defined t...
ISwitchVectorProperty * ManualExposureSP
virtual ~V4L2_Driver() override
virtual bool UpdateCCDBin(int hor, int ver) override
CCD calls this function when CCD Binning needs to be updated in the hardware. Derived classes should ...
IText CaptureColorSpaceT[3]
bool start_capturing(bool do_stream)
virtual bool SetCaptureFormat(uint8_t index) override
SetCaptureFormat Set Active Capture format.
INDI::V4L2_Base * v4l_base
static void stdtimerCallback(void *userpointer)
unsigned int v4ladjustments
bool getPixelFormat(uint32_t v4l2format, INDI_PIXEL_FORMAT &pixelFormat, uint8_t &pixelDepth)
float getRemainingExposure() const
static void lxtimerCallback(void *userpointer)
virtual bool saveConfigItems(FILE *fp) override
saveConfigItems Save configuration items in XML file.
ISwitch ColorProcessingS[3]
ISwitchVectorProperty StackModeSP
const char * MAIN_CONTROL_TAB
MAIN_CONTROL_TAB Where all the primary controls for the device are located.
const char * OPTIONS_TAB
OPTIONS_TAB Where all the driver's options are located. Those may include auxiliary controls,...
void IERmTimer(int timerid)
Remove the timer with the given timerid, as returned from IEAddTimer() or IEAddPeriodicTimer().
void() IE_TCF(void *userpointer)
Signature of a timeout caller.
int IEAddTimer(int millisecs, IE_TCF *fp, void *p)
Register a new single-shot timer function, fp, to be called with ud as argument after ms.
#define NARRAY(a)
Handy macro to find the number of elements in array a[]. Must be used with actual array,...
const char * IMAGE_SETTINGS_TAB
const char * IMAGE_INFO_TAB
void IDLog(const char *fmt,...)
void IUSaveConfigSwitch(FILE *fp, const ISwitchVectorProperty *svp)
Add a switch vector property value to the configuration file.
void IUFillNumberVector(INumberVectorProperty *nvp, INumber *np, int nnp, const char *dev, const char *name, const char *label, const char *group, IPerm p, double timeout, IPState s)
Assign attributes for a number vector property. The vector's auxiliary elements will be set to NULL.
int IUFindOnSwitchIndex(const ISwitchVectorProperty *svp)
Returns the index of first ON switch it finds in the vector switch property.
void IUResetSwitch(ISwitchVectorProperty *svp)
Reset all switches in a switch vector property to OFF.
void IUFillTextVector(ITextVectorProperty *tvp, IText *tp, int ntp, const char *dev, const char *name, const char *label, const char *group, IPerm p, double timeout, IPState s)
Assign attributes for a text vector property. The vector's auxiliary elements will be set to NULL.
const char * IUFindOnSwitchName(ISState *states, char *names[], int n)
Returns the name of the first ON switch it finds in the supplied arguments.
ISwitch * IUFindOnSwitch(const ISwitchVectorProperty *svp)
Returns the first ON switch it finds in the vector switch property.
void IUSaveText(IText *tp, const char *newtext)
Function to reliably save new text in a IText.
void IUSaveConfigNumber(FILE *fp, const INumberVectorProperty *nvp)
Add a number vector property value to the configuration file.
void IUFillSwitch(ISwitch *sp, const char *name, const char *label, ISState s)
Assign attributes for a switch property. The switch's auxiliary elements will be set to NULL.
void IUFillText(IText *tp, const char *name, const char *label, const char *initialText)
Assign attributes for a text property. The text's auxiliary elements will be set to NULL.
void IUSaveConfigText(FILE *fp, const ITextVectorProperty *tvp)
Add a text vector property value to the configuration file.
void IUFillSwitchVector(ISwitchVectorProperty *svp, ISwitch *sp, int nsp, const char *dev, const char *name, const char *label, const char *group, IPerm p, ISRule r, double timeout, IPState s)
Assign attributes for a switch vector property. The vector's auxiliary elements will be set to NULL.
IText * IUFindText(const ITextVectorProperty *tvp, const char *name)
Find an IText member in a vector text property.
int IUUpdateSwitch(ISwitchVectorProperty *svp, ISState *states, char *names[], int n)
Update all switches in a switch vector property.
void IDSetNumber(const INumberVectorProperty *nvp, const char *fmt,...)
void IDSetSwitch(const ISwitchVectorProperty *svp, const char *fmt,...)
int IUGetConfigText(const char *dev, const char *property, const char *member, char *value, int len)
IUGetConfigText Opens configuration file and reads single text property.
int IUUpdateNumber(INumberVectorProperty *nvp, double values[], char *names[], int n)
Update all numbers in a number vector property.
void IDSetText(const ITextVectorProperty *tvp, const char *fmt,...)
#define LOGF_INFO(fmt,...)
#define LOGF_WARN(fmt,...)
#define LOGF_DEBUG(fmt,...)
#define LOG_ERROR(txt)
Shorter logging macros. In order to use these macros, the function (or method) "getDeviceName()" must...
#define LOGF_ERROR(fmt,...)
#define DEBUGF(priority, msg,...)
std::vector< uint8_t > buffer
const char * DEVICE_PORT
Device serial (or bluetooth) connection port. The default value on Linux is /dev/ttyUSB0 while on Mac...
Namespace to encapsulate INDI client, drivers, and mediator classes.
unsigned char * RGB24Buffer
const char * getYCbCrEncodingName(struct v4l2_format *fmt)
const char * getQuantizationName(struct v4l2_format *fmt)
const char * getColorSpaceName(struct v4l2_format *fmt)
struct PixelSizeInfo PixelSizeInfo