File indexing completed on 2024-07-21 06:28:20

0001 /*
0002     SPDX-FileCopyrightText: 2022 Jasem Mutlaq <mutlaqja@ikarustech.com>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "../fitsviewer/fitsview.h"
0010 #include "indicommon.h"
0011 
0012 namespace ISD
0013 {
0014 
0015 class Camera;
0016 
0017 /**
0018  * @class CameraChip
0019  * CameraChip class controls a particular chip in camera. While most amateur camera only have a single sensor, some
0020  * cameras (e.g. SBIG CCDs) have additional chips for guiding purposes.
0021  */
0022 class CameraChip
0023 {
0024     public:
0025         typedef enum { PRIMARY_CCD, GUIDE_CCD } ChipType;
0026 
0027         CameraChip(ISD::Camera *camera, ChipType type);
0028 
0029         FITSView *getImageView(FITSMode imageType);
0030         void setImageView(FITSView *image, FITSMode imageType);
0031         void setCaptureMode(FITSMode mode)
0032         {
0033             captureMode = mode;
0034         }
0035         void setCaptureFilter(FITSScale fType)
0036         {
0037             captureFilter = fType;
0038         }
0039 
0040         // Common commands
0041         bool getFrame(int *x, int *y, int *w, int *h);
0042         bool getFrameMinMax(int *minX, int *maxX, int *minY, int *maxY, int *minW, int *maxW, int *minH, int *maxH);
0043         bool setFrame(int x, int y, int w, int h, bool force = false);
0044 
0045         bool resetFrame();
0046         bool capture(double exposure);
0047         bool setFrameType(CCDFrameType fType);
0048         bool setFrameType(const QString &name);
0049         CCDFrameType getFrameType();
0050         bool setBinning(int bin_x, int bin_y);
0051         bool setBinning(CCDBinType binType);
0052         CCDBinType getBinning();
0053         bool getBinning(int *bin_x, int *bin_y);
0054         bool getMaxBin(int *max_xbin, int *max_ybin);
0055         ChipType getType() const
0056         {
0057             return m_Type;
0058         }
0059         ISD::Camera *getCCD()
0060         {
0061             return m_Camera;
0062         }
0063 
0064         // Set Image Info
0065         bool setImageInfo(uint16_t width, uint16_t height, double pixelX, double pixelY, uint8_t bitdepth);
0066         // Get Image Info
0067         bool getImageInfo(uint16_t &width, uint16_t &height, double &pixelX, double &pixelY, uint8_t &bitdepth);
0068         // Bayer Info
0069         bool getBayerInfo(uint16_t &offsetX, uint16_t &offsetY, QString &pattern);
0070 
0071         bool isCapturing();
0072         bool abortExposure();
0073 
0074         FITSMode getCaptureMode() const
0075         {
0076             return captureMode;
0077         }
0078         FITSScale getCaptureFilter() const
0079         {
0080             return captureFilter;
0081         }
0082         bool isBatchMode() const
0083         {
0084             return batchMode;
0085         }
0086         void setBatchMode(bool enable)
0087         {
0088             batchMode = enable;
0089         }
0090         QStringList getFrameTypes() const
0091         {
0092             return frameTypes;
0093         }
0094         void addFrameLabel(const QString &label)
0095         {
0096             frameTypes << label;
0097         }
0098         void clearFrameTypes()
0099         {
0100             frameTypes.clear();
0101         }
0102 
0103         bool canBin() const;
0104         void setCanBin(bool value);
0105 
0106         bool canSubframe() const;
0107         void setCanSubframe(bool value);
0108 
0109         bool canAbort() const;
0110         void setCanAbort(bool value);
0111 
0112         const QSharedPointer<FITSData> &getImageData() const;
0113         void setImageData(const QSharedPointer<FITSData> &data)
0114         {
0115             imageData = data;
0116         }
0117 
0118         int getISOIndex() const;
0119         bool getISOValue(QString &value) const;
0120         bool setISOIndex(int value);
0121 
0122         QStringList getISOList() const;
0123 
0124     private:
0125         QPointer<FITSView> normalImage, focusImage, guideImage, calibrationImage, alignImage;
0126         QSharedPointer<FITSData> imageData { nullptr };
0127         FITSMode captureMode { FITS_NORMAL };
0128         FITSScale captureFilter { FITS_NONE };
0129         bool batchMode { false };
0130         QStringList frameTypes;
0131         bool CanBin { false };
0132         bool CanSubframe { false };
0133         bool CanAbort { false };
0134 
0135         ISD::Camera *m_Camera { nullptr };
0136         ChipType m_Type;
0137 };
0138 
0139 }