Ignore:
Timestamp:
Feb 24, 2012, 12:37:36 PM (12 years ago)
Author:
frichard
Message:

-Alignement des antennes
-Version 0.0.9 de libindi

File:
1 edited

Legend:

Unmodified
Added
Removed
  • BAORadio/libindi/libindi/libs/indibase/indiccd.h

    r504 r642  
    11/*******************************************************************************
    2   Copyright(c) 2010 Gerry Rozema. All rights reserved.
    3 
    4   This program is free software; you can redistribute it and/or modify it
    5   under the terms of the GNU General Public License as published by the Free
    6   Software Foundation; either version 2 of the License, or (at your option)
    7   any later version.
    8 
    9   This program is distributed in the hope that it will be useful, but WITHOUT
    10   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    11   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
    12   more details.
    13 
    14   You should have received a copy of the GNU General Public License along with
    15   this program; if not, write to the Free Software Foundation, Inc., 59
    16   Temple Place - Suite 330, Boston, MA  02111-1307, USA.
    17 
    18   The full GNU General Public License is included in this distribution in the
    19   file called LICENSE.
     2  Copyright(c) 2010, 2011 Gerry Rozema, Jasem Mutlaq. All rights reserved.
     3
     4 This library is free software; you can redistribute it and/or
     5 modify it under the terms of the GNU Library General Public
     6 License version 2 as published by the Free Software Foundation.
     7
     8 This library is distributed in the hope that it will be useful,
     9 but WITHOUT ANY WARRANTY; without even the implied warranty of
     10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     11 Library General Public License for more details.
     12
     13 You should have received a copy of the GNU Library General Public License
     14 along with this library; see the file COPYING.LIB.  If not, write to
     15 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
     16 Boston, MA 02110-1301, USA.
    2017*******************************************************************************/
     18
    2119
    2220#ifndef INDI_CCD_H
    2321#define INDI_CCD_H
    2422
     23#include <fitsio.h>
     24
    2525#include "defaultdriver.h"
    26 
    27 #define FRAME_TYPE_LIGHT 0
    28 #define FRAME_TYPE_BIAS 1
    29 #define FRAME_TYPE_DARK 2
    30 #define FRAME_TYPE_FLAT 3
    31 
    32 class INDI::CCD : public INDI::DefaultDriver
     26#include "indiguiderinterface.h"
     27
     28extern const char *IMAGE_SETTINGS_TAB;
     29extern const char *IMAGE_INFO_TAB;
     30extern const char *GUIDE_HEAD_TAB;
     31extern const char *GUIDE_CONTROL_TAB;
     32
     33class CCDChip
    3334{
    34     protected:
    35 
    36         char *RawFrame;
    37         int RawFrameSize;
    38 
    39         //  Altho these numbers are indeed stored in the indi properties
    40         //  It makes for much cleaner code if we have 'plain old number' copies
    41         //  So, when we process messages, just update both
    42 
    43         int XRes;   //  native resolution of the ccd
    44         int YRes;   //  ditto
    45         int SubX;   //  left side of the subframe we are requesting
    46         int SubY;   //  top of the subframe requested
    47         int SubW;   //  width of the subframe
    48         int SubH;   //  height of the subframe
    49         int BinX;   //  Binning requested in the x direction
    50         int BinY;   //  Binning requested in the Y direction
    51         float PixelSizex;   //  pixel size in microns, x direction
    52         float PixelSizey;   //  pixel size in microns, y direction
    53         bool SendCompressed;
    54 
    55         bool HasSt4Port;
    56 
    57         //  If the camera has a second ccd, or integrated guide head
    58         //  we need information on that one too
    59         bool HasGuideHead;
    60         char *RawGuiderFrame;
    61         int RawGuideSize;
    62         int GXRes;  //  native resolution of the guide head
    63         int GYRes;  //  native resolution
    64         int GSubX;  //  left side of the guide image subframe
    65         int GSubY;  //  top of the guide image subframe
    66         int GSubW;  //  Width of the guide image
    67         int GSubH;  //  Height of the guide image
    68         float GPixelSizex;  //  phyiscal size of the guider pixels
    69         float GPixelSizey;
    70         bool GuiderCompressed;
    71 
    72         int FrameType;
    73 
    74 
    75     private:
    76     public:
     35
     36public:
     37    CCDChip();
     38    ~CCDChip();
     39
     40    typedef enum { LIGHT_FRAME=0, BIAS_FRAME, DARK_FRAME, FLAT_FRAME } CCD_FRAME;
     41
     42    int getXRes() { return XRes; }
     43    int getYRes() { return YRes; }
     44    int getSubX() { return SubX; }
     45    int getSubY() { return SubY; }
     46    int getSubW() { return SubW; }
     47    int getSubH() { return SubH; }
     48    int getBinX() { return BinX; }
     49    int getBinY() { return BinY; }
     50    int getPixelSizeX() { return PixelSizex; }
     51    int getPixelSizeY() { return PixelSizey; }
     52    int getBPP() { return BPP; }
     53    int getFrameBufferSize() { return RawFrameSize; }
     54    double getExposure() { return ImageExposureN[0].value; }
     55    char *getFrameBuffer() { return RawFrame; }
     56    bool isCompressed() { return SendCompressed; }
     57    bool isInterlaced() { return Interlaced; }
     58    CCD_FRAME getFrameType() { return FrameType; }
     59
     60    void setResolutoin(int x, int y);
     61    void setFrame(int subx, int suby, int subw, int subh);
     62    void setBin(int hor, int ver);
     63    void setPixelSize(int x, int y);
     64    void setCompressed (bool cmp);
     65    void setInterlaced(bool intr);
     66    void setFrameBufferSize(int nbuf);
     67    void setBPP(int bpp);
     68    int setFrameType(CCD_FRAME);
     69    void setExposure(double duration);
     70    void setExposureFailed();
     71
     72private:
     73
     74    int XRes;   //  native resolution of the ccd
     75    int YRes;   //  ditto
     76    int SubX;   //  left side of the subframe we are requesting
     77    int SubY;   //  top of the subframe requested
     78    int SubW;   //  width of the subframe
     79    int SubH;   //  height of the subframe
     80    int BinX;   //  Binning requested in the x direction
     81    int BinY;   //  Binning requested in the Y direction
     82    float PixelSizex;   //  pixel size in microns, x direction
     83    float PixelSizey;   //  pixel size in microns, y direction
     84    int BPP;            //  Bytes per Pixel
     85    bool Interlaced;
     86    char *RawFrame;
     87    int RawFrameSize;
     88    bool SendCompressed;
     89    CCD_FRAME FrameType;
     90
     91    INumberVectorProperty *ImageExposureNP;
     92    INumber ImageExposureN[1];
     93
     94    INumberVectorProperty *ImageFrameNP;
     95    INumber ImageFrameN[4];
     96
     97    INumberVectorProperty *ImageBinNP;
     98    INumber ImageBinN[2];
     99
     100    INumberVectorProperty *ImagePixelSizeNP;
     101    INumber ImagePixelSizeN[6];
     102
     103    ISwitch FrameTypeS[4];
     104    ISwitchVectorProperty *FrameTypeSP;
     105
     106    ISwitch CompressS[2];
     107    ISwitchVectorProperty *CompressSP;
     108
     109    IBLOB FitsB;
     110    IBLOBVectorProperty *FitsBP;
     111
     112    friend class INDI::CCD;
     113};
     114
     115/**
     116 * \class INDI::CCD
     117   \brief Class to provide general functionality of CCD cameras with a single CCD sensor, or a primary CCD sensor in addition to a secondary CCD guide head.
     118
     119   It also implements the interface to perform guiding. The class enable the ability to \e snoop on telescope equatorial coordinates and record them in the
     120   FITS file before upload. Developers need to subclass INDI::CCD to implement any driver for CCD cameras within INDI.
     121
     122\author Gerry Rozema, Jasem Mutlaq
     123*/
     124class INDI::CCD : public INDI::DefaultDriver, INDI::GuiderInterface
     125{
     126      public:
    77127        CCD();
    78128        virtual ~CCD();
    79129
    80         //  A ccd needs to desribe the frame
    81         //INumberVectorProperty CcdFrameNV;
    82         //INumberVectorProperty CcdExposureNV;
    83         //INumberVectorProperty CcdBinNV;
    84         //INumberVectorProperty CcdPixelSizeNV;
    85 
    86 
    87         INumberVectorProperty ImageFrameNV;
    88         INumber ImageFrameN[4];
    89 
    90         INumberVectorProperty ImageBinNV;
    91         INumber ImageBinN[2];
    92 
    93         INumberVectorProperty ImagePixelSizeNV;
    94         INumber ImagePixelSizeN[6];
    95 
    96         INumberVectorProperty ImageExposureNV;
    97         INumber ImageExposureN[1];
    98 
    99         //INumberVectorProperty ImageExposureReqNV;
    100         //INumber ImageExposureReqN[1];
    101 
    102         INumberVectorProperty GuiderFrameNV;
    103         INumber GuiderFrameN[4];
    104         INumberVectorProperty GuiderPixelSizeNV;
    105         INumber GuiderPixelSizeN[6];
    106         INumberVectorProperty GuiderExposureNV;
    107         INumber GuiderExposureN[1];
    108 
    109         ISwitch FrameTypeS[4];
    110         ISwitchVectorProperty FrameTypeSV;
    111 
    112 
    113         ISwitch CompressS[2];
    114         ISwitchVectorProperty CompressSV;
    115 
    116         ISwitch GuiderCompressS[2];
    117         ISwitchVectorProperty GuiderCompressSV;
    118 
    119 
    120         ISwitch GuiderVideoS[2];
    121         ISwitchVectorProperty GuiderVideoSV;
    122 
    123         INumber GuideNS[2];
    124         INumberVectorProperty GuideNSV;
    125         INumber GuideEW[2];
    126         INumberVectorProperty GuideEWV;
    127 
    128         IBLOB FitsB;
    129         IBLOBVectorProperty FitsBV;
    130 
    131         IBLOB GuiderB;
    132         IBLOBVectorProperty GuiderBV;
    133 
    134         virtual bool  initProperties();
     130        virtual bool initProperties();
    135131        virtual bool updateProperties();
    136132        virtual void ISGetProperties (const char *dev);
    137 
    138133        virtual bool ISNewNumber (const char *dev, const char *name, double values[], char *names[], int n);
    139134        virtual bool ISNewSwitch (const char *dev, const char *name, ISState *states, char *names[], int n);
    140 
    141         virtual bool ISNewText (const char *dev, const char *name, char *texts[], char *names[], int n) {return false;}
    142 
    143 
     135        virtual bool ISNewText (const char *dev, const char *name, char *texts[], char *names[], int n);
     136        virtual void ISSnoopDevice (XMLEle *root);
     137
     138     protected:
     139        /** \brief Start exposing primary CCD chip
     140            \param duration Duration in seconds
     141            \return 0 if OK and exposure will take some time to complete, 1 if exposure is short and complete already (e.g. bias), -1 on error.
     142            \note This function is not implemented in INDI::CCD, it must be implemented in the child class
     143        */
    144144        virtual int StartExposure(float duration);
     145
     146        /** \brief Uploads primary CCD exposed buffer as FITS to the client. Dervied classes should class this function when an exposure is complete.
     147             \note This function is not implemented in INDI::CCD, it must be implemented in the child class
     148        */
    145149        virtual bool ExposureComplete();
     150
     151        /** \brief Abort ongoing exposure
     152            \return true is abort is successful, false otherwise.
     153            \note This function is not implemented in INDI::CCD, it must be implemented in the child class
     154        */
     155        virtual bool AbortExposure();
     156
     157        /** \brief Start exposing guide CCD chip
     158            \param duration Duration in seconds
     159            \return 0 if OK and exposure will take some time to complete, 1 if exposure is short and complete already (e.g. bias), -1 on error.
     160            \note This function is not implemented in INDI::CCD, it must be implemented in the child class
     161        */
    146162        virtual int StartGuideExposure(float duration);
     163
     164        /** \brief Abort ongoing exposure
     165            \return true is abort is successful, false otherwise.
     166            \note This function is not implemented in INDI::CCD, it must be implemented in the child class
     167        */
    147168        virtual bool AbortGuideExposure();
     169
     170        /** \brief Uploads Guide head CCD exposed buffer as FITS to the client. Dervied classes should class this function when an exposure is complete.
     171            \note This function is not implemented in INDI::CCD, it must be implemented in the child class
     172        */
    148173        virtual bool GuideExposureComplete();
    149         virtual int uploadfile(void *fitsdata,int total);
    150         virtual int sendPreview();
    151 
    152         //  Handy functions for child classes
    153         virtual int SetCCDParams(int x,int y,int bpp,float xf,float yf);
    154         virtual int SetGuidHeadParams(int x,int y,int bpp,float xf,float yf);
    155 
    156         virtual int GuideNorth(float);
    157         virtual int GuideSouth(float);
    158         virtual int GuideEast(float);
    159         virtual int GuideWest(float);
    160 
    161         virtual int SetFrameType(int);
     174
     175        /** \brief INDI::CCD calls this function when CCD Frame dimension needs to be updated in the hardware. Derived classes should implement this function
     176            \param x Subframe X coordinate in pixels.
     177            \param y Subframe Y coordinate in pixels.
     178            \param w Subframe width in pixels.
     179            \param h Subframe height in pixels.
     180            \note (0,0) is defined as most left, top pixel in the subframe.
     181            \return true is CCD chip update is successful, false otherwise.
     182            \note This function is not implemented in INDI::CCD, it must be implemented in the child class
     183        */
     184        virtual bool updateCCDFrame(int x, int y, int w, int h);
     185
     186        /** \brief INDI::CCD calls this function when CCD Binning needs to be updated in the hardware. Derived classes should implement this function
     187            \param hor Horizontal binning.
     188            \param ver Vertical binning.
     189            \return true is CCD chip update is successful, false otherwise.
     190            \note This function is not implemented in INDI::CCD, it must be implemented in the child class
     191        */
     192        virtual bool updateCCDBin(int hor, int ver);
     193
     194
     195        /** \brief Setup CCD paramters for primary CCD. Child classes call this function to update CCD paramaters
     196            \param x Frame X coordinates in pixels.
     197            \param y Frame Y coordinates in pixels.
     198            \param bpp Bits Per Pixels.
     199            \param xf X pixel size in microns.
     200            \param yf Y pixel size in microns.
     201        */
     202        virtual void SetCCDParams(int x,int y,int bpp,float xf,float yf);
     203
     204        /** \brief Setup CCD paramters for guide head CCD. Child classes call this function to update CCD paramaters
     205            \param x Frame X coordinates in pixels.
     206            \param y Frame Y coordinates in pixels.
     207            \param bpp Bits Per Pixels.
     208            \param xf X pixel size in microns.
     209            \param yf Y pixel size in microns.
     210        */
     211        virtual void SetGuidHeadParams(int x,int y,int bpp,float xf,float yf);
     212
     213
     214        /** \brief Guide northward for ms milliseconds
     215            \param ms Duration in milliseconds.
     216            \note This function is not implemented in INDI::CCD, it must be implemented in the child class
     217            \return True if successful, false otherwise.
     218        */
     219        virtual bool GuideNorth(float ms);
     220
     221        /** \brief Guide southward for ms milliseconds
     222            \param ms Duration in milliseconds.
     223            \note This function is not implemented in INDI::CCD, it must be implemented in the child class
     224            \return 0 if successful, -1 otherwise.
     225        */
     226        virtual bool GuideSouth(float ms);
     227
     228        /** \brief Guide easward for ms milliseconds
     229            \param ms Duration in milliseconds.
     230            \note This function is not implemented in INDI::CCD, it must be implemented in the child class
     231            \return 0 if successful, -1 otherwise.
     232        */
     233        virtual bool GuideEast(float ms);
     234
     235        /** \brief Guide westward for ms milliseconds
     236            \param ms Duration in milliseconds.
     237            \note This function is not implemented in INDI::CCD, it must be implemented in the child class
     238            \return 0 if successful, -1 otherwise.
     239        */
     240        virtual bool GuideWest(float ms);
     241
     242        float RA;
     243        float Dec;
     244        bool HasGuideHead;
     245        bool HasSt4Port;
     246        bool InExposure;
     247
     248        CCDChip PrimaryCCD;
     249        CCDChip GuideCCD;
     250
     251 private:
     252    //  We are going to snoop these from a telescope
     253    INumberVectorProperty EqNP;
     254    INumber EqN[2];
     255
     256    ITextVectorProperty *TelescopeTP;
     257    IText TelescopeT[1];
     258
     259    void addFITSKeywords(fitsfile *fptr);
     260    int uploadfile(void *fitsdata,int total);
    162261
    163262};
Note: See TracChangeset for help on using the changeset viewer.