| 1 |
/* |
| 2 |
GigE interface for INDI based on aravis |
| 3 |
Copyright (C) 2016 Hendrik Beijeman ([email protected]) |
| 4 |
|
| 5 |
This library is free software; you can redistribute it and/or |
| 6 |
modify it under the terms of the GNU Lesser General Public |
| 7 |
License as published by the Free Software Foundation; either |
| 8 |
version 2.1 of the License, or (at your option) any later version. |
| 9 |
|
| 10 |
This library is distributed in the hope that it will be useful, |
| 11 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 |
Lesser General Public License for more details. |
| 14 |
|
| 15 |
You should have received a copy of the GNU Lesser General Public |
| 16 |
License along with this library; if not, write to the Free Software |
| 17 |
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 18 |
*/ |
| 19 |
|
| 20 |
#ifndef GENERIC_CCD_H |
| 21 |
#define GENERIC_CCD_H |
| 22 |
|
| 23 |
#include <indiccd.h> |
| 24 |
#include <iostream> |
| 25 |
|
| 26 |
#include "ArvInterface.h" |
| 27 |
|
| 28 |
using namespace std; |
| 29 |
|
| 30 |
class GigECCD : public INDI::CCD |
| 31 |
{ |
| 32 |
public: |
| 33 |
GigECCD(arv::ArvCamera *camera); |
| 34 |
virtual ~GigECCD(); |
| 35 |
|
| 36 |
const char *getDefaultName(); |
| 37 |
|
| 38 |
bool initProperties(); |
| 39 |
bool updateProperties(); |
| 40 |
|
| 41 |
bool Connect(); |
| 42 |
bool Disconnect(); |
| 43 |
|
| 44 |
bool StartExposure(float duration); |
| 45 |
bool AbortExposure(); |
| 46 |
|
| 47 |
protected: |
| 48 |
void TimerHit(); |
| 49 |
virtual bool UpdateCCDFrame(int x, int y, int w, int h); |
| 50 |
virtual bool UpdateCCDBin(int binx, int biny); |
| 51 |
virtual bool UpdateCCDFrameType(INDI::CCDChip::CCD_FRAME fType); |
| 52 |
|
| 53 |
private: |
| 54 |
void _delete_indi_properties(void); |
| 55 |
void _update_indi_properties(void); |
| 56 |
bool _update_geometry(void); |
| 57 |
void _update_image(uint8_t const *const data, size_t size); |
| 58 |
static void _receive_image_hook(void *const class_ptr, uint8_t const *const data, size_t size); |
| 59 |
|
| 60 |
void _handle_failed(void); |
| 61 |
void _handle_timeout(struct timeval *const tv, uint32_t timeout_us); |
| 62 |
|
| 63 |
arv::ArvCamera *camera; |
| 64 |
char name[32]; |
| 65 |
int timer_id; |
| 66 |
struct timeval exposure_start_time; |
| 67 |
struct timeval exposure_transfer_time; |
| 68 |
|
| 69 |
/* Indi properties */ |
| 70 |
|
| 71 |
INumber indiprop_gain[1]; |
| 72 |
INumberVectorProperty indiprop_gain_prop; |
| 73 |
IText indiprop_info[3] {}; |
| 74 |
ITextVectorProperty indiprop_info_prop; |
| 75 |
|
| 76 |
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n); |
| 77 |
|
| 78 |
friend void ::ISGetProperties(const char *dev); |
| 79 |
friend void ::ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int num); |
| 80 |
friend void ::ISNewText(const char *dev, const char *name, char *texts[], char *names[], int num); |
| 81 |
friend void ::ISNewNumber(const char *dev, const char *name, double values[], char *names[], int num); |
| 82 |
friend void ::ISNewBLOB(const char *dev, const char *name, int sizes[], int blobsizes[], char *blobs[], |
| 83 |
char *formats[], char *names[], int n); |
| 84 |
}; |
| 85 |
|
| 86 |
#endif // GENERIC_CCD_H |