Instrument Neutral Distributed Interface INDI  2.0.2
Classes | Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
V4L2_Driver Class Reference

#include <v4l2driver.h>

Inheritance diagram for V4L2_Driver:
INDI::CCD INDI::DefaultDevice INDI::GuiderInterface INDI::ParentDevice INDI::BaseDevice

Classes

struct  img_t
 

Public Member Functions

 V4L2_Driver ()
 
 V4L2_Driver (std::string label, std::string path)
 
virtual ~V4L2_Driver () override
 
virtual void ISGetProperties (const char *dev) override
 define the driver's properties to the client. Usually, only a minimum set of properties are defined to the client in this function if the device is in disconnected state. Those properties should be enough to enable the client to establish a connection to the device. In addition to CONNECT/DISCONNECT, such properties may include port name, IP address, etc. You should check if the device is already connected, and if this is true, then you must define the remainder of the the properties to the client in this function. Otherwise, the remainder of the driver's properties are defined to the client in updateProperties() function which is called when a client connects/disconnects from a device. More...
 
virtual bool ISNewSwitch (const char *dev, const char *name, ISState *states, char *names[], int n) override
 Process the client newSwitch command. More...
 
virtual bool ISNewText (const char *dev, const char *name, char *texts[], char *names[], int n) override
 Process the client newSwitch command. More...
 
virtual bool ISNewNumber (const char *dev, const char *name, double values[], char *names[], int n) override
 Process the client newNumber command. More...
 
virtual bool initProperties () override
 Initilize properties initial state and value. The child class must implement this function. More...
 
virtual bool updateProperties () override
 updateProperties is called whenever there is a change in the CONNECTION status of the driver. This will enable the driver to react to changes of switching ON/OFF a device. For example, a driver may only define a set of properties after a device is connected, but not before. More...
 
virtual void initCamBase ()
 
void stackFrame ()
 
void newFrame ()
 
- Public Member Functions inherited from INDI::CCD
 CCD ()
 
virtual ~CCD ()
 
virtual bool ISNewBLOB (const char *dev, const char *name, int sizes[], int blobsizes[], char *blobs[], char *formats[], char *names[], int n) override
 Process the client newBLOB command. More...
 
virtual bool ISSnoopDevice (XMLEle *root) override
 Process a snoop event from INDI server. This function is called when a snooped property is updated in a snooped driver. More...
 
- Public Member Functions inherited from INDI::DefaultDevice
 DefaultDevice ()
 
virtual ~DefaultDevice () override=default
 
void addAuxControls ()
 Add Debug, Simulation, and Configuration options to the driver. More...
 
void addDebugControl ()
 Add Debug control to the driver. More...
 
void addSimulationControl ()
 Add Simulation control to the driver. More...
 
void addConfigurationControl ()
 Add Configuration control to the driver. More...
 
void addPollPeriodControl ()
 Add Polling period control to the driver. More...
 
void resetProperties ()
 Set all properties to IDLE state. More...
 
void defineNumber (INumberVectorProperty *nvp)
 Define number vector to client & register it. Alternatively, IDDefNumber can be used but the property will not get registered and the driver will not be able to save configuration files. More...
 
void defineProperty (INumberVectorProperty *property)
 
void defineText (ITextVectorProperty *tvp)
 Define text vector to client & register it. Alternatively, IDDefText can be used but the property will not get registered and the driver will not be able to save configuration files. More...
 
void defineProperty (ITextVectorProperty *property)
 
void defineSwitch (ISwitchVectorProperty *svp)
 Define switch vector to client & register it. Alternatively, IDDefswitch can be used but the property will not get registered and the driver will not be able to save configuration files. More...
 
void defineProperty (ISwitchVectorProperty *property)
 
void defineLight (ILightVectorProperty *lvp)
 Define light vector to client & register it. Alternatively, IDDeflight can be used but the property will not get registered and the driver will not be able to save configuration files. More...
 
void defineProperty (ILightVectorProperty *property)
 
void defineBLOB (IBLOBVectorProperty *bvp)
 Define BLOB vector to client & register it. Alternatively, IDDefBLOB can be used but the property will not get registered and the driver will not be able to save configuration files. More...
 
void defineProperty (IBLOBVectorProperty *property)
 
void defineProperty (INDI::Property &property)
 
virtual bool deleteProperty (const char *propertyName)
 Delete a property and unregister it. It will also be deleted from all clients. More...
 
bool deleteProperty (INDI::Property &property)
 deleteProperty Delete a property and unregister it. It will also be deleted from all clients. More...
 
virtual void setConnected (bool status, IPState state=IPS_OK, const char *msg=nullptr)
 Set connection switch status in the client. More...
 
int SetTimer (uint32_t ms)
 Set a timer to call the function TimerHit after ms milliseconds. More...
 
void RemoveTimer (int id)
 Remove timer added with SetTimer. More...
 
virtual void TimerHit ()
 Callback function to be called once SetTimer duration elapses. More...
 
virtual const char * getDriverExec ()
 
virtual const char * getDriverName ()
 
void setVersion (uint16_t vMajor, uint16_t vMinor)
 Set driver version information to be defined in DRIVER_INFO property as vMajor.vMinor. More...
 
uint16_t getMajorVersion () const
 
uint16_t getMinorVersion () const
 
uint16_t getDriverInterface () const
 
void setDriverInterface (uint16_t value)
 setInterface Set driver interface. By default the driver interface is set to GENERAL_DEVICE. You may send an ORed list of DeviceInterface values. More...
 
void watchDevice (const char *deviceName, const std::function< void(INDI::BaseDevice)> &callback)
 Add a device to the watch list. More...
 
- Public Member Functions inherited from INDI::ParentDevice
 ParentDevice (Type type)
 
 ~ParentDevice ()
 
 ParentDevice (ParentDevice &&other)=default
 
ParentDeviceoperator= (ParentDevice &&other)=default
 
- Public Member Functions inherited from INDI::BaseDevice
 BaseDevice ()
 
virtual ~BaseDevice ()
 
void registerProperty (const INDI::Property &property)
 Register the property to be able to observe and update. More...
 
void registerProperty (const INDI::Property &property, INDI_PROPERTY_TYPE type)
 
int removeProperty (const char *name, char *errmsg)
 Remove a property. More...
 
void watchProperty (const char *name, const std::function< void(INDI::Property)> &callback, WATCH watch=WATCH_NEW)
 Call the callback function if property is available. More...
 
Property getProperty (const char *name, INDI_PROPERTY_TYPE type=INDI_UNKNOWN) const
 Return a property and its type given its name. More...
 
Properties getProperties ()
 Return a list of all properties in the device. More...
 
const Properties getProperties () const
 
INDI::PropertyNumber getNumber (const char *name) const
 
INDI::PropertyText getText (const char *name) const
 
INDI::PropertySwitch getSwitch (const char *name) const
 
INDI::PropertyLight getLight (const char *name) const
 
INDI::PropertyBlob getBLOB (const char *name) const
 
IPState getPropertyState (const char *name) const
 
IPerm getPropertyPermission (const char *name) const
 
void * getRawProperty (const char *name, INDI_PROPERTY_TYPE type=INDI_UNKNOWN) const
 Return a property and its type given its name. More...
 
void addMessage (const std::string &msg)
 Add message to the driver's message queue. More...
 
void checkMessage (XMLEle *root)
 
void doMessage (XMLEle *msg)
 
const std::string & messageQueue (size_t index) const
 
const std::string & lastMessage () const
 
bool isValid () const
 
bool isConnected () const
 
void attach ()
 indicates that the device is ready More...
 
void detach ()
 indicates that the device is being removed More...
 
void setMediator (INDI::BaseMediator *mediator)
 Set the driver's mediator to receive notification of news devices and updated property values. More...
 
INDI::BaseMediatorgetMediator () const
 
void setDeviceName (const char *dev)
 Set the device name. More...
 
const char * getDeviceName () const
 
bool isDeviceNameMatch (const char *otherName) const
 Check that the device name matches the argument. More...
 
bool isDeviceNameMatch (const std::string &otherName) const
 Check that the device name matches the argument. More...
 
const char * getDriverName () const
 
const char * getDriverExec () const
 
const char * getDriverVersion () const
 
uint16_t getDriverInterface () const
 getDriverInterface returns ORed values of DRIVER_INTERFACE. It presents the device classes supported by the driver. More...
 
bool buildSkeleton (const char *filename)
 Build driver properties from a skeleton file. More...
 
int buildProp (const INDI::LilXmlElement &root, char *errmsg, bool isDynamic=false)
 Build a property given the supplied XML element (defXXX) More...
 
int setValue (const INDI::LilXmlElement &root, char *errmsg)
 handle SetXXX commands from client More...
 
 operator BaseDevice * ()
 
BaseDeviceoperator-> ()
 
bool operator!= (std::nullptr_t) const
 
bool operator== (std::nullptr_t) const
 
 operator bool () const
 
 operator bool ()
 

Static Public Member Functions

static void newFrame (void *p)
 
- Static Public Member Functions inherited from INDI::CCD
static void wsThreadHelper (void *context)
 
- Static Public Member Functions inherited from INDI::BaseDevice
static std::string getSharedFilePath (std::string fileName)
 

Protected Types

enum  { IMAGE_MONO = 0 , IMAGE_RGB }
 
enum  stackmodes {
  STACK_NONE = 0 , STACK_MEAN = 1 , STACK_ADDITIVE = 2 , STACK_TAKE_DARK = 3 ,
  STACK_RESET_DARK = 4
}
 
- Protected Types inherited from INDI::CCD
enum  {
  ACTIVE_TELESCOPE , ACTIVE_ROTATOR , ACTIVE_FOCUSER , ACTIVE_FILTER ,
  ACTIVE_SKYQUALITY
}
 
enum  { RAMP_SLOPE , RAMP_THRESHOLD }
 
enum  { FORMAT_FITS , FORMAT_NATIVE , FORMAT_XISF }
 
enum  { UPLOAD_DIR , UPLOAD_PREFIX }
 
enum  { FocalLength , Aperture }
 
enum  { WEBSOCKET_ENABLED , WEBSOCKET_DISABLED }
 
enum  { WS_SETTINGS_PORT }
 
enum  { KEYWORD_NAME , KEYWORD_VALUE , KEYWORD_COMMENT }
 

Protected Member Functions

virtual bool Connect () override
 Connect to the device. INDI::DefaultDevice implementation connects to appropriate connection interface (Serial or TCP) governed by connectionMode. If connection is successful, it proceed to call Handshake() function to ensure communication with device is successful. For other communication interface, override the method in the child class implementation. More...
 
virtual bool Disconnect () override
 Disconnect from device. More...
 
virtual const char * getDefaultName () override
 
virtual bool StartExposure (float duration) override
 Start exposing primary CCD chip. More...
 
virtual bool AbortExposure () override
 Abort ongoing exposure. More...
 
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. Derived classes should implement this function. More...
 
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 implement this function. More...
 
virtual bool SetCaptureFormat (uint8_t index) override
 SetCaptureFormat Set Active Capture format. More...
 
virtual bool saveConfigItems (FILE *fp) override
 saveConfigItems Save configuration items in XML file. More...
 
virtual bool StartStreaming () override
 StartStreaming Start live video streaming. More...
 
virtual bool StopStreaming () override
 StopStreaming Stop live video streaming. More...
 
virtual void getBasicData ()
 
bool getPixelFormat (uint32_t v4l2format, INDI_PIXEL_FORMAT &pixelFormat, uint8_t &pixelDepth)
 
void allocateBuffers ()
 
void releaseBuffers ()
 
void updateFrameSize ()
 
bool setShutter (double duration)
 
bool setManualExposure (double duration)
 
bool startlongexposure (double timeinsec)
 
bool start_capturing (bool do_stream)
 
bool stop_capturing ()
 
virtual void updateV4L2Controls ()
 
struct timeval getElapsedExposure () const
 
float getRemainingExposure () const
 
- Protected Member Functions inherited from INDI::CCD
uint32_t GetCCDCapability () const
 GetCCDCapability returns the CCD capabilities. More...
 
void SetCCDCapability (uint32_t cap)
 SetCCDCapability Set the CCD capabilities. Al fields must be initialized. More...
 
bool CanAbort ()
 
bool CanBin ()
 
bool CanSubFrame ()
 
bool HasGuideHead ()
 
bool HasShutter ()
 
bool HasST4Port ()
 
bool HasCooler ()
 
bool HasBayer ()
 
bool HasStreaming ()
 
bool HasWebSocket ()
 
bool HasDSP ()
 
virtual int SetTemperature (double temperature)
 Set CCD temperature. More...
 
virtual bool ExposureComplete (CCDChip *targetChip)
 Uploads target Chip exposed buffer as FITS to the client. Dervied classes should class this function when an exposure is complete. More...
 
virtual bool StartGuideExposure (float duration)
 Start exposing guide CCD chip. More...
 
virtual bool AbortGuideExposure ()
 Abort ongoing exposure. More...
 
virtual bool UpdateGuiderFrame (int x, int y, int w, int h)
 CCD calls this function when Guide head frame dimension is updated by the client. Derived classes should implement this function. More...
 
virtual bool UpdateGuiderBin (int hor, int ver)
 CCD calls this function when Guide head binning is updated by the client. Derived classes should implement this function. More...
 
virtual bool UpdateCCDFrameType (CCDChip::CCD_FRAME fType)
 CCD calls this function when CCD frame type needs to be updated in the hardware. More...
 
virtual bool UpdateCCDUploadMode (CCD_UPLOAD_MODE mode)
 CCD calls this function when client upload mode switch is updated. More...
 
virtual bool UpdateGuiderFrameType (CCDChip::CCD_FRAME fType)
 CCD calls this function when Guide frame type is updated by the client. More...
 
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. More...
 
virtual void SetGuiderParams (int x, int y, int bpp, float xf, float yf)
 Setup CCD paramters for guide head CCD. Child classes call this function to update CCD parameters. More...
 
virtual IPState GuideNorth (uint32_t ms) override
 Guide northward for ms milliseconds. More...
 
virtual IPState GuideSouth (uint32_t ms) override
 Guide southward for ms milliseconds. More...
 
virtual IPState GuideEast (uint32_t ms) override
 Guide easward for ms milliseconds. More...
 
virtual IPState GuideWest (uint32_t ms) override
 Guide westward for ms milliseconds. More...
 
virtual void addFITSKeywords (CCDChip *targetChip, std::vector< FITSRecord > &fitsKeywords)
 Generate FITS keywords that will be added to FIST/XISF file. More...
 
void fits_update_key_s (fitsfile *fptr, int type, std::string name, void *p, std::string explanation, int *status)
 
virtual void activeDevicesUpdated ()
 activeDevicesUpdated Inform children that ActiveDevices property was updated so they can snoop on the updated devices if desired. More...
 
virtual void GuideComplete (INDI_EQ_AXIS axis) override
 GuideComplete Signal guide pulse completion. More...
 
virtual void UploadComplete (CCDChip *)
 UploadComplete Signal that capture is completed and image was uploaded and/or saved successfully. More...
 
virtual void checkTemperatureTarget ()
 checkTemperatureTarget Checks the current temperature against target temperature and calculates the next required temperature if there is a ramp. If the current temperature is within threshold of target temperature, it sets the state as OK. More...
 
virtual bool processFastExposure (CCDChip *targetChip)
 processFastExposure After an exposure is complete, check if fast exposure was enabled. If it is, then immediately start the next exposure if possible and decrement the counter. More...
 
virtual void addCaptureFormat (const CaptureFormat &format)
 addCaptureFormat Add a supported camera native capture format (e.g. Mono, Bayer8..etc) More...
 
- Protected Member Functions inherited from INDI::DefaultDevice
void setDynamicPropertiesBehavior (bool defineEnabled, bool deleteEnabled)
 setDynamicPropertiesBehavior controls handling of dynamic properties. Dyanmic properties are those generated from an external skeleton XML file. By default all properties, including dynamic properties, are defined to the client in ISGetProperties(). Furthermore, when űdeleteProperty(properyName) is called, the dynamic property is deleted by default, and can only be restored by calling buildSkeleton(filename) again. However, it is sometimes desirable to skip the definition of the dynamic properties on startup and delegate this task to the child class. To control this behavior, set enabled to false. More...
 
virtual bool loadConfig (bool silent=false, const char *property=nullptr)
 Load the last saved configuration file. More...
 
bool loadConfig (INDI::Property &property)
 Load property config from the configuration file. If the property configuration is successfully parsed, the corresponding ISNewXXX is called with the values parsed from the config file. More...
 
virtual bool saveConfig (bool silent=false, const char *property=nullptr)
 Save the current properties in a configuration file. More...
 
bool saveConfig (INDI::Property &property)
 Save a property in the configuration file. More...
 
virtual bool purgeConfig ()
 purgeConfig Remove config file from disk. More...
 
virtual bool saveAllConfigItems (FILE *fp)
 saveAllConfigItems Save all the drivers' properties in the configuration file More...
 
virtual bool loadDefaultConfig ()
 Load the default configuration file. More...
 
void setDebug (bool enable)
 Toggle driver debug status A driver can be more verbose if Debug option is enabled by the client. More...
 
void setSimulation (bool enable)
 Toggle driver simulation status A driver can run in simulation mode if Simulation option is enabled by the client. More...
 
virtual void debugTriggered (bool enable)
 Inform driver that the debug option was triggered. This function is called after setDebug is triggered by the client. Reimplement this function if your driver needs to take specific action after debug is enabled/disabled. Otherwise, you can use isDebug() to check if simulation is enabled or disabled. More...
 
virtual void simulationTriggered (bool enable)
 Inform driver that the simulation option was triggered. This function is called after setSimulation is triggered by the client. Reimplement this function if your driver needs to take specific action after simulation is enabled/disabled. Otherwise, you can use isSimulation() to check if simulation is enabled or disabled. More...
 
bool isDebug () const
 
bool isSimulation () const
 
void registerConnection (Connection::Interface *newConnection)
 registerConnection Add new connection plugin to the existing connection pool. The connection type shall be defined to the client in ISGetProperties() More...
 
bool unRegisterConnection (Connection::Interface *existingConnection)
 unRegisterConnection Remove connection from existing pool More...
 
Connection::InterfacegetActiveConnection ()
 
void setActiveConnection (Connection::Interface *existingConnection)
 setActiveConnection Switch the active connection to the passed connection plugin More...
 
void setDefaultPollingPeriod (uint32_t msec)
 setDefaultPollingPeriod Change the default polling period to call TimerHit() function in the driver. More...
 
void setPollingPeriodRange (uint32_t minimum, uint32_t maximum)
 setPollingPeriodRange Set the range permitted by the polling range in milliseconds More...
 
uint32_t getPollingPeriod () const
 getPollingPeriod Return the polling period. More...
 
void setCurrentPollingPeriod (uint32_t msec)
 setCurrentPollingPeriod Change the current polling period to call TimerHit() function in the driver. More...
 
uint32_t getCurrentPollingPeriod () const
 getCurrentPollingPeriod Return the current polling period. More...
 
uint32_t & refCurrentPollingPeriod () __attribute__((deprecated))
 
uint32_t refCurrentPollingPeriod () const __attribute__((deprecated))
 
bool isConfigLoading () const
 isConfigLoading Check if driver configuration is currently in the process of getting loaded. More...
 
bool isInitializationComplete () const
 isInitializationComplete Check if driver initialization is complete. More...
 
void syncDriverInfo ()
 syncDriverInfo sends the current driver information to the client. More...
 
 DefaultDevice (const std::shared_ptr< DefaultDevicePrivate > &dd)
 
- Protected Member Functions inherited from INDI::ParentDevice
 ParentDevice (const std::shared_ptr< ParentDevicePrivate > &dd)
 
- Protected Member Functions inherited from INDI::BaseDevice
 BaseDevice (BaseDevicePrivate &dd)
 
 BaseDevice (const std::shared_ptr< BaseDevicePrivate > &dd)
 

Static Protected Member Functions

static void lxtimerCallback (void *userpointer)
 
static void stdtimerCallback (void *userpointer)
 

Protected Attributes

ISwitch ImageDepthS [2]
 
ISwitch StackModeS [5]
 
ISwitch ColorProcessingS [3]
 
IText PortT [1] {}
 
IText camNameT [1] {}
 
IText CaptureColorSpaceT [3] {}
 
INumberFrameN
 
INumber FrameRateN [1]
 
ISwitchVectorProperty ImageDepthSP
 
ISwitchVectorProperty StackModeSP
 
ISwitchVectorProperty InputsSP
 
ISwitchVectorProperty CaptureFormatsSP
 
ISwitchVectorProperty CaptureSizesSP
 
ISwitchVectorProperty FrameRatesSP
 
ISwitchVectorPropertyOptions
 
ISwitchVectorProperty ColorProcessingSP
 
unsigned int v4loptions
 
unsigned int v4ladjustments
 
bool useExtCtrl
 
INumberVectorProperty CaptureSizesNP
 
INumberVectorProperty FrameRateNP
 
INumberVectorProperty ImageAdjustNP
 
ITextVectorProperty PortTP
 
ITextVectorProperty camNameTP
 
ITextVectorProperty CaptureColorSpaceTP
 
INumberAbsExposureN
 
ISwitchVectorPropertyManualExposureSP
 
INDI::V4L2_Basev4l_base
 
char device_name [MAXINDIDEVICE]
 
int subframeCount
 
int frameCount
 
double divider
 
img_tV4LFrame
 
struct timeval capture_start
 
struct timeval frame_duration
 
struct timeval frame_received
 
struct timeval exposure_duration
 
struct timeval elapsed_exposure
 
unsigned int stackMode
 
ulong frameBytes
 
unsigned int non_capture_frames
 
bool v4l_capture_started
 
bool is_capturing
 
bool is_exposing
 
Lxlx
 
int lxtimer
 
int stdtimer
 
short lxstate
 
char defaultVideoPort [256] = {"/dev/video0"}
 
char configPort [256] = {0}
 
- Protected Attributes inherited from INDI::CCD
double RA
 
double Dec
 
int pierSide
 
double J2000RA
 
double J2000DE
 
bool J2000Valid
 
char exposureStartTime [MAXINDINAME]
 
double exposureDuration
 
double snoopedFocalLength
 
double snoopedAperture
 
bool InExposure
 
bool InGuideExposure
 
bool AutoLoop
 
bool GuiderAutoLoop
 
bool SendImage
 
bool GuiderSendImage
 
bool ShowMarker
 
bool GuiderShowMarker
 
double ExposureTime
 
double GuiderExposureTime
 
double MPSAS
 
double RotatorAngle
 
long FocuserPos
 
double FocuserTemp
 
double Airmass
 
double Latitude
 
double Longitude
 
double Azimuth
 
double Altitude
 
double m_TargetTemperature {0}
 
INDI::Timer m_TemperatureCheckTimer
 
INDI::ElapsedTimer m_TemperatureElapsedTimer
 
std::mutex ccdBufferLock
 
std::vector< std::string > FilterNames
 
int CurrentFilterSlot {-1}
 
std::vector< CaptureFormatm_CaptureFormats
 
std::unique_ptr< StreamManagerStreamer
 
std::unique_ptr< DSP::ManagerDSP
 
CCDChip PrimaryCCD
 
CCDChip GuideCCD
 
INumberVectorProperty EqNP
 Properties. More...
 
INumber EqN [2]
 
INumberVectorProperty J2000EqNP
 J200EqNP Snoop property to read the equatorial J2000 coordinates of the mount. ActiveDeviceTP defines snoop devices and the driver listens to this property emitted by the mount driver if specified. It is important to generate a proper FITS header. More...
 
INumber J2000EqN [2]
 
ITextVectorProperty ActiveDeviceTP
 ActiveDeviceTP defines 4 devices the camera driver can listen to (snoop) for properties of interest so that it can generate a proper FITS header. More...
 
IText ActiveDeviceT [5] {}
 
INumberVectorProperty TemperatureNP
 TemperatureNP Camera Temperature in Celcius. More...
 
INumber TemperatureN [1]
 
INDI::PropertyNumber TemperatureRampNP {2}
 Temperature Ramp in C/Min with configurable threshold. More...
 
ITextVectorProperty BayerTP
 BayerTP Bayer pattern offset and type. More...
 
IText BayerT [3] {}
 
ITextVectorProperty FileNameTP
 FileNameTP File name of locally-saved images. By default, images are uploaded to the client but when upload option is set to either Both or Local, then they are saved on the local disk with this name. More...
 
IText FileNameT [1] {}
 
INDI::PropertySwitch CaptureFormatSP {0}
 Specifies Camera NATIVE capture format (e.g. Mono, RGB, RAW8..etc). More...
 
INDI::PropertySwitch EncodeFormatSP {3}
 Specifies Driver image encoding format (FITS, Native, JPG, ..etc) More...
 
ISwitch UploadS [3]
 
ISwitchVectorProperty UploadSP
 
IText UploadSettingsT [2] {}
 
ITextVectorProperty UploadSettingsTP
 
INDI::PropertyNumber ScopeInfoNP {2}
 
ISwitch WebSocketS [2]
 
ISwitchVectorProperty WebSocketSP
 
INumber WebSocketSettingsN [1]
 
INumberVectorProperty WebSocketSettingsNP
 
ISwitch WorldCoordS [2]
 
ISwitchVectorProperty WorldCoordSP
 
INumber CCDRotationN [1]
 
INumberVectorProperty CCDRotationNP
 
ISwitch FastExposureToggleS [2]
 
ISwitchVectorProperty FastExposureToggleSP
 
INumber FastExposureCountN [1]
 
INumberVectorProperty FastExposureCountNP
 
double m_UploadTime = { 0 }
 
std::chrono::system_clock::time_point FastExposureToggleStartup
 
INDI::PropertyText FITSHeaderTP {3}
 
- Protected Attributes inherited from INDI::BaseDevice
std::shared_ptr< BaseDevicePrivated_ptr
 

Additional Inherited Members

- Public Types inherited from INDI::CCD
enum  {
  CCD_CAN_BIN = 1 << 0 , CCD_CAN_SUBFRAME = 1 << 1 , CCD_CAN_ABORT = 1 << 2 , CCD_HAS_GUIDE_HEAD = 1 << 3 ,
  CCD_HAS_ST4_PORT = 1 << 4 , CCD_HAS_SHUTTER = 1 << 5 , CCD_HAS_COOLER = 1 << 6 , CCD_HAS_BAYER = 1 << 7 ,
  CCD_HAS_STREAMING = 1 << 8 , CCD_HAS_WEB_SOCKET = 1 << 9 , CCD_HAS_DSP = 1 << 10
}
 
enum  CCD_UPLOAD_MODE { UPLOAD_CLIENT , UPLOAD_LOCAL , UPLOAD_BOTH }
 
typedef struct INDI::CCD::CaptureFormat CaptureFormat
 
- Public Types inherited from INDI::ParentDevice
enum  Type { Valid , Invalid }
 
- Public Types inherited from INDI::BaseDevice
enum  INDI_ERROR { INDI_DEVICE_NOT_FOUND = -1 , INDI_PROPERTY_INVALID = -2 , INDI_PROPERTY_DUPLICATED = -3 , INDI_DISPATCH_ERROR = -4 }
 
enum  { INDI_ENABLED , INDI_DISABLED }
 
enum  WATCH { WATCH_NEW = 0 , WATCH_UPDATE , WATCH_NEW_OR_UPDATE }
 
enum  DRIVER_INTERFACE {
  GENERAL_INTERFACE = 0 , TELESCOPE_INTERFACE = (1 << 0) , CCD_INTERFACE = (1 << 1) , GUIDER_INTERFACE = (1 << 2) ,
  FOCUSER_INTERFACE = (1 << 3) , FILTER_INTERFACE = (1 << 4) , DOME_INTERFACE = (1 << 5) , GPS_INTERFACE = (1 << 6) ,
  WEATHER_INTERFACE = (1 << 7) , AO_INTERFACE = (1 << 8) , DUSTCAP_INTERFACE = (1 << 9) , LIGHTBOX_INTERFACE = (1 << 10) ,
  DETECTOR_INTERFACE = (1 << 11) , ROTATOR_INTERFACE = (1 << 12) , SPECTROGRAPH_INTERFACE = (1 << 13) , CORRELATOR_INTERFACE = (1 << 14) ,
  AUX_INTERFACE = (1 << 15) , SENSOR_INTERFACE = SPECTROGRAPH_INTERFACE | DETECTOR_INTERFACE | CORRELATOR_INTERFACE
}
 The DRIVER_INTERFACE enum defines the class of devices the driver implements. A driver may implement one or more interfaces. More...
 
typedef INDI::Properties Properties
 
- Public Attributes inherited from INDI::CCD
enum INDI::CCD:: { ... }  CCDCapability
 
- Static Public Attributes inherited from INDI::CCD
static constexpr const char * GUIDE_CONTROL_TAB = "Guider Control"
 Group Names. More...
 
static constexpr const char * WCS_TAB = "WCS"
 

Detailed Description

Definition at line 48 of file v4l2driver.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
protected
Enumerator
IMAGE_MONO 
IMAGE_RGB 

Definition at line 101 of file v4l2driver.h.

◆ stackmodes

enum V4L2_Driver::stackmodes
protected
Enumerator
STACK_NONE 
STACK_MEAN 
STACK_ADDITIVE 
STACK_TAKE_DARK 
STACK_RESET_DARK 

Definition at line 107 of file v4l2driver.h.

Constructor & Destructor Documentation

◆ V4L2_Driver() [1/2]

V4L2_Driver::V4L2_Driver ( )

Definition at line 104 of file v4l2driver.cpp.

◆ V4L2_Driver() [2/2]

V4L2_Driver::V4L2_Driver ( std::string  label,
std::string  path 
)
explicit

Definition at line 69 of file v4l2driver.cpp.

◆ ~V4L2_Driver()

V4L2_Driver::~V4L2_Driver ( )
overridevirtual

Definition at line 135 of file v4l2driver.cpp.

Member Function Documentation

◆ AbortExposure()

bool V4L2_Driver::AbortExposure ( )
overrideprotectedvirtual

Abort ongoing exposure.

Returns
true is abort is successful, false otherwise.
Note
This function is not implemented in CCD, it must be implemented in the child class

Reimplemented from INDI::CCD.

Definition at line 1711 of file v4l2driver.cpp.

◆ allocateBuffers()

void V4L2_Driver::allocateBuffers ( )
protected

Definition at line 1894 of file v4l2driver.cpp.

◆ Connect()

bool V4L2_Driver::Connect ( )
overrideprotectedvirtual

Connect to the device. INDI::DefaultDevice implementation connects to appropriate connection interface (Serial or TCP) governed by connectionMode. If connection is successful, it proceed to call Handshake() function to ensure communication with device is successful. For other communication interface, override the method in the child class implementation.

Returns
True if connection is successful, false otherwise

Reimplemented from INDI::DefaultDevice.

Definition at line 1729 of file v4l2driver.cpp.

◆ Disconnect()

bool V4L2_Driver::Disconnect ( )
overrideprotectedvirtual

Disconnect from device.

Returns
True if successful, false otherwise

Reimplemented from INDI::DefaultDevice.

Definition at line 1758 of file v4l2driver.cpp.

◆ getBasicData()

void V4L2_Driver::getBasicData ( void  )
protectedvirtual

Definition at line 1775 of file v4l2driver.cpp.

◆ getDefaultName()

const char * V4L2_Driver::getDefaultName ( )
overrideprotectedvirtual
Returns
Default name of the device.

Implements INDI::DefaultDevice.

Definition at line 1769 of file v4l2driver.cpp.

◆ getElapsedExposure()

struct timeval V4L2_Driver::getElapsedExposure ( ) const
protected

Definition at line 1318 of file v4l2driver.cpp.

◆ getPixelFormat()

bool V4L2_Driver::getPixelFormat ( uint32_t  v4l2format,
INDI_PIXEL_FORMAT pixelFormat,
uint8_t &  pixelDepth 
)
protected

Definition at line 1975 of file v4l2driver.cpp.

◆ getRemainingExposure()

float V4L2_Driver::getRemainingExposure ( ) const
protected

Definition at line 1355 of file v4l2driver.cpp.

◆ initCamBase()

void V4L2_Driver::initCamBase ( )
virtual

Definition at line 252 of file v4l2driver.cpp.

◆ initProperties()

bool V4L2_Driver::initProperties ( )
overridevirtual

Initilize properties initial state and value. The child class must implement this function.

Returns
True if initilization is successful, false otherwise.

Reimplemented from INDI::CCD.

Definition at line 152 of file v4l2driver.cpp.

◆ ISGetProperties()

void V4L2_Driver::ISGetProperties ( const char *  dev)
overridevirtual

define the driver's properties to the client. Usually, only a minimum set of properties are defined to the client in this function if the device is in disconnected state. Those properties should be enough to enable the client to establish a connection to the device. In addition to CONNECT/DISCONNECT, such properties may include port name, IP address, etc. You should check if the device is already connected, and if this is true, then you must define the remainder of the the properties to the client in this function. Otherwise, the remainder of the driver's properties are defined to the client in updateProperties() function which is called when a client connects/disconnects from a device.

Parameters
devname of the device
Note
This function is called by the INDI framework, do not call it directly. See LX200 Generic driver for an example implementation

Reimplemented from INDI::CCD.

Definition at line 257 of file v4l2driver.cpp.

◆ ISNewNumber()

bool V4L2_Driver::ISNewNumber ( const char *  dev,
const char *  name,
double  values[],
char *  names[],
int  n 
)
overridevirtual

Process the client newNumber command.

Note
This function is called by the INDI framework, do not call it directly.
Returns
True if any property was successfully processed, false otherwise.

Reimplemented from INDI::CCD.

Definition at line 764 of file v4l2driver.cpp.

◆ ISNewSwitch()

bool V4L2_Driver::ISNewSwitch ( const char *  dev,
const char *  name,
ISState states,
char *  names[],
int  n 
)
overridevirtual

Process the client newSwitch command.

Note
This function is called by the INDI framework, do not call it directly.
Returns
True if any property was successfully processed, false otherwise.

Reimplemented from INDI::CCD.

Definition at line 415 of file v4l2driver.cpp.

◆ ISNewText()

bool V4L2_Driver::ISNewText ( const char *  dev,
const char *  name,
char *  texts[],
char *  names[],
int  n 
)
overridevirtual

Process the client newSwitch command.

Note
This function is called by the INDI framework, do not call it directly.
Returns
True if any property was successfully processed, false otherwise.

Reimplemented from INDI::CCD.

Definition at line 739 of file v4l2driver.cpp.

◆ lxtimerCallback()

void V4L2_Driver::lxtimerCallback ( void *  userpointer)
staticprotected

Definition at line 1227 of file v4l2driver.cpp.

◆ newFrame() [1/2]

void V4L2_Driver::newFrame ( )

Definition at line 1362 of file v4l2driver.cpp.

◆ newFrame() [2/2]

void V4L2_Driver::newFrame ( void *  p)
static

Definition at line 1311 of file v4l2driver.cpp.

◆ releaseBuffers()

void V4L2_Driver::releaseBuffers ( )
protected

Definition at line 1912 of file v4l2driver.cpp.

◆ saveConfigItems()

bool V4L2_Driver::saveConfigItems ( FILE *  fp)
overrideprotectedvirtual

saveConfigItems Save configuration items in XML file.

Parameters
fppointer to file to write to
Returns
True if successful, false otherwise

Reimplemented from INDI::CCD.

Definition at line 1946 of file v4l2driver.cpp.

◆ SetCaptureFormat()

bool V4L2_Driver::SetCaptureFormat ( uint8_t  index)
overrideprotectedvirtual

SetCaptureFormat Set Active Capture format.

Parameters
indexIndex of capture format from CaptureFormatSP property.
Returns
True if change is successful, false otherwise.

Reimplemented from INDI::CCD.

Definition at line 2096 of file v4l2driver.cpp.

◆ setManualExposure()

bool V4L2_Driver::setManualExposure ( double  duration)
protected

Definition at line 965 of file v4l2driver.cpp.

◆ setShutter()

bool V4L2_Driver::setShutter ( double  duration)
protected

Definition at line 922 of file v4l2driver.cpp.

◆ stackFrame()

void V4L2_Driver::stackFrame ( )

Definition at line 1318 of file v4l2driver.cpp.

◆ start_capturing()

bool V4L2_Driver::start_capturing ( bool  do_stream)
protected

Definition at line 1150 of file v4l2driver.cpp.

◆ StartExposure()

bool V4L2_Driver::StartExposure ( float  duration)
overrideprotectedvirtual

Start exposing primary CCD chip.

Parameters
durationDuration in seconds
Returns
true if OK and exposure will take some time to complete, false on error.
Note
This function is not implemented in CCD, it must be implemented in the child class

Reimplemented from INDI::CCD.

Definition at line 873 of file v4l2driver.cpp.

◆ startlongexposure()

bool V4L2_Driver::startlongexposure ( double  timeinsec)
protected

Definition at line 1220 of file v4l2driver.cpp.

◆ StartStreaming()

bool V4L2_Driver::StartStreaming ( )
overrideprotectedvirtual

StartStreaming Start live video streaming.

Returns
True if successful, false otherwise.

Reimplemented from INDI::CCD.

Definition at line 1917 of file v4l2driver.cpp.

◆ stdtimerCallback()

void V4L2_Driver::stdtimerCallback ( void *  userpointer)
staticprotected

Definition at line 1138 of file v4l2driver.cpp.

◆ stop_capturing()

bool V4L2_Driver::stop_capturing ( )
protected

Definition at line 1192 of file v4l2driver.cpp.

◆ StopStreaming()

bool V4L2_Driver::StopStreaming ( )
overrideprotectedvirtual

StopStreaming Stop live video streaming.

Returns
True if successful, false otherwise.

Reimplemented from INDI::CCD.

Definition at line 1932 of file v4l2driver.cpp.

◆ UpdateCCDBin()

bool V4L2_Driver::UpdateCCDBin ( int  hor,
int  ver 
)
overrideprotectedvirtual

CCD calls this function when CCD Binning needs to be updated in the hardware. Derived classes should implement this function.

Parameters
horHorizontal binning.
verVertical binning.
Returns
true is CCD chip update is successful, false otherwise.
Note
This function is not implemented in CCD, it must be implemented in the child class

Reimplemented from INDI::CCD.

Definition at line 1246 of file v4l2driver.cpp.

◆ UpdateCCDFrame()

bool V4L2_Driver::UpdateCCDFrame ( int  x,
int  y,
int  w,
int  h 
)
overrideprotectedvirtual

CCD calls this function when CCD Frame dimension needs to be updated in the hardware. Derived classes should implement this function.

Parameters
xSubframe X coordinate in pixels.
ySubframe Y coordinate in pixels.
wSubframe width in pixels.
hSubframe height in pixels.
Note
(0,0) is defined as most left, top pixel in the subframe.
Returns
true is CCD chip update is successful, false otherwise.
Note
This function is not implemented in CCD, it must be implemented in the child class

Reimplemented from INDI::CCD.

Definition at line 1285 of file v4l2driver.cpp.

◆ updateFrameSize()

void V4L2_Driver::updateFrameSize ( )
protected

Definition at line 140 of file v4l2driver.cpp.

◆ updateProperties()

bool V4L2_Driver::updateProperties ( )
overridevirtual

updateProperties is called whenever there is a change in the CONNECTION status of the driver. This will enable the driver to react to changes of switching ON/OFF a device. For example, a driver may only define a set of properties after a device is connected, but not before.

Returns
True if update is successful, false otherwise.

Reimplemented from INDI::CCD.

Definition at line 295 of file v4l2driver.cpp.

◆ updateV4L2Controls()

void V4L2_Driver::updateV4L2Controls ( )
protectedvirtual

Definition at line 1832 of file v4l2driver.cpp.

Member Data Documentation

◆ AbsExposureN

INumber* V4L2_Driver::AbsExposureN
protected

Definition at line 158 of file v4l2driver.h.

◆ camNameT

IText V4L2_Driver::camNameT[1] {}
protected

Definition at line 124 of file v4l2driver.h.

◆ camNameTP

ITextVectorProperty V4L2_Driver::camNameTP
protected

Definition at line 154 of file v4l2driver.h.

◆ capture_start

struct timeval V4L2_Driver::capture_start
protected

Definition at line 190 of file v4l2driver.h.

◆ CaptureColorSpaceT

IText V4L2_Driver::CaptureColorSpaceT[3] {}
protected

Definition at line 125 of file v4l2driver.h.

◆ CaptureColorSpaceTP

ITextVectorProperty V4L2_Driver::CaptureColorSpaceTP
protected

Definition at line 155 of file v4l2driver.h.

◆ CaptureFormatsSP

ISwitchVectorProperty V4L2_Driver::CaptureFormatsSP
protected

Definition at line 136 of file v4l2driver.h.

◆ CaptureSizesNP

INumberVectorProperty V4L2_Driver::CaptureSizesNP
protected

Definition at line 148 of file v4l2driver.h.

◆ CaptureSizesSP

ISwitchVectorProperty V4L2_Driver::CaptureSizesSP
protected

Definition at line 137 of file v4l2driver.h.

◆ ColorProcessingS

ISwitch V4L2_Driver::ColorProcessingS[3]
protected

Definition at line 120 of file v4l2driver.h.

◆ ColorProcessingSP

ISwitchVectorProperty V4L2_Driver::ColorProcessingSP
protected

Definition at line 140 of file v4l2driver.h.

◆ configPort

char V4L2_Driver::configPort[256] = {0}
protected

Definition at line 220 of file v4l2driver.h.

◆ defaultVideoPort

char V4L2_Driver::defaultVideoPort[256] = {"/dev/video0"}
protected

Definition at line 219 of file v4l2driver.h.

◆ device_name

char V4L2_Driver::device_name[MAXINDIDEVICE]
protected

Definition at line 185 of file v4l2driver.h.

◆ divider

double V4L2_Driver::divider
protected

Definition at line 189 of file v4l2driver.h.

◆ elapsed_exposure

struct timeval V4L2_Driver::elapsed_exposure
protected

Definition at line 190 of file v4l2driver.h.

◆ exposure_duration

struct timeval V4L2_Driver::exposure_duration
protected

Definition at line 190 of file v4l2driver.h.

◆ frame_duration

struct timeval V4L2_Driver::frame_duration
protected

Definition at line 190 of file v4l2driver.h.

◆ frame_received

struct timeval V4L2_Driver::frame_received
protected

Definition at line 190 of file v4l2driver.h.

◆ frameBytes

ulong V4L2_Driver::frameBytes
protected

Definition at line 206 of file v4l2driver.h.

◆ frameCount

int V4L2_Driver::frameCount
protected

Definition at line 188 of file v4l2driver.h.

◆ FrameN

INumber* V4L2_Driver::FrameN
protected

Definition at line 129 of file v4l2driver.h.

◆ FrameRateN

INumber V4L2_Driver::FrameRateN[1]
protected

Definition at line 130 of file v4l2driver.h.

◆ FrameRateNP

INumberVectorProperty V4L2_Driver::FrameRateNP
protected

Definition at line 149 of file v4l2driver.h.

◆ FrameRatesSP

ISwitchVectorProperty V4L2_Driver::FrameRatesSP
protected

Definition at line 138 of file v4l2driver.h.

◆ ImageAdjustNP

INumberVectorProperty V4L2_Driver::ImageAdjustNP
protected

Definition at line 150 of file v4l2driver.h.

◆ ImageDepthS

ISwitch V4L2_Driver::ImageDepthS[2]
protected

Definition at line 118 of file v4l2driver.h.

◆ ImageDepthSP

ISwitchVectorProperty V4L2_Driver::ImageDepthSP
protected

Definition at line 133 of file v4l2driver.h.

◆ InputsSP

ISwitchVectorProperty V4L2_Driver::InputsSP
protected

Definition at line 135 of file v4l2driver.h.

◆ is_capturing

bool V4L2_Driver::is_capturing
protected

Definition at line 209 of file v4l2driver.h.

◆ is_exposing

bool V4L2_Driver::is_exposing
protected

Definition at line 210 of file v4l2driver.h.

◆ lx

Lx* V4L2_Driver::lx
protected

Definition at line 213 of file v4l2driver.h.

◆ lxstate

short V4L2_Driver::lxstate
protected

Definition at line 217 of file v4l2driver.h.

◆ lxtimer

int V4L2_Driver::lxtimer
protected

Definition at line 214 of file v4l2driver.h.

◆ ManualExposureSP

ISwitchVectorProperty* V4L2_Driver::ManualExposureSP
protected

Definition at line 159 of file v4l2driver.h.

◆ non_capture_frames

unsigned int V4L2_Driver::non_capture_frames
protected

Definition at line 207 of file v4l2driver.h.

◆ Options

ISwitchVectorProperty* V4L2_Driver::Options
protected

Definition at line 139 of file v4l2driver.h.

◆ PortT

IText V4L2_Driver::PortT[1] {}
protected

Definition at line 123 of file v4l2driver.h.

◆ PortTP

ITextVectorProperty V4L2_Driver::PortTP
protected

Definition at line 153 of file v4l2driver.h.

◆ stackMode

unsigned int V4L2_Driver::stackMode
protected

Definition at line 205 of file v4l2driver.h.

◆ StackModeS

ISwitch V4L2_Driver::StackModeS[5]
protected

Definition at line 119 of file v4l2driver.h.

◆ StackModeSP

ISwitchVectorProperty V4L2_Driver::StackModeSP
protected

Definition at line 134 of file v4l2driver.h.

◆ stdtimer

int V4L2_Driver::stdtimer
protected

Definition at line 215 of file v4l2driver.h.

◆ subframeCount

int V4L2_Driver::subframeCount
protected

Definition at line 187 of file v4l2driver.h.

◆ useExtCtrl

bool V4L2_Driver::useExtCtrl
protected

Definition at line 144 of file v4l2driver.h.

◆ v4l_base

INDI::V4L2_Base* V4L2_Driver::v4l_base
protected

Definition at line 183 of file v4l2driver.h.

◆ v4l_capture_started

bool V4L2_Driver::v4l_capture_started
protected

Definition at line 208 of file v4l2driver.h.

◆ v4ladjustments

unsigned int V4L2_Driver::v4ladjustments
protected

Definition at line 143 of file v4l2driver.h.

◆ V4LFrame

img_t* V4L2_Driver::V4LFrame
protected

Definition at line 190 of file v4l2driver.h.

◆ v4loptions

unsigned int V4L2_Driver::v4loptions
protected

Definition at line 142 of file v4l2driver.h.


The documentation for this class was generated from the following files: