RTS2  0.9.4
camd.h
1 /*
2  * Basic camera daemon.
3  * Copyright (C) 2001-2012 Petr Kubanek <petr@kubanek.net>
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License
7  * as published by the Free Software Foundation; either version 2
8  * of the License, or (at your option) any later version.
9  *
10  * This program 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
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18  */
19 
20 #ifndef __RTS2_CAMERA_CPP__
21 #define __RTS2_CAMERA_CPP__
22 
23 #include <sys/time.h>
24 #include <time.h>
25 
26 #include "scriptdevice.h"
27 #include "imghdr.h"
28 
29 #define MAX_CHIPS 3
30 #define MAX_DATA_RETRY 100
31 
33 #define STATISTIC_YES 0
34 #define STATISTIC_NOMODE 1
35 #define STATISTIC_ONLY 2
36 #define STATISTIC_NO 3
37 
41 namespace rts2camd
42 {
43 
52 {
53  public:
57  int vertical;
58 
63 
64  Binning2D (int in_vertical, int in_horizontal): Rts2SelData ()
65  {
66  vertical = in_vertical;
67  horizontal = in_horizontal;
68  }
69 
75  std::string getDescription ()
76  {
77  std::ostringstream _os;
78  _os << horizontal << "x" << vertical;
79  return _os.str();
80  }
81 };
82 
91 {
92  public:
93  int type;
94 
95  DataType (int in_type): Rts2SelData ()
96  {
97  type = in_type;
98  }
99 };
100 
101 class Camera;
102 
114 {
115  public:
116  FilterVal (Camera *master, const char *n, char fil);
117  // values are registered in class, hence autodeleted when class holding them is deleted - so there isn't class destructor
118  rts2core::ValueSelection *filter;
119  rts2core::DoubleArray *offsets;
120  rts2core::ValueBool *moving;
121 
122  const char *name;
123 };
124 
198 {
199  public:
200  Camera (int argc, char **argv);
201  virtual ~ Camera (void);
202 
203  virtual int deleteConnection (rts2core::Connection * conn);
211  virtual bool supportFrameTransfer ();
212 
213  // end of CameraChip
214 
215  virtual int initChips ();
216  virtual int initValues ();
217  void checkExposures ();
218  void checkReadouts ();
219 
220  virtual void deviceReady (rts2core::Connection * conn);
221 
222  virtual void postEvent (rts2core::Event * event);
223 
224  virtual void changeMasterState (int old_state, int new_state);
225 
226  virtual int idle ();
227 
228  virtual rts2core::DevClient *createOtherType (rts2core::Connection * conn, int other_device_type);
229  virtual int info ();
230 
231  virtual int killAll (bool callScriptEnds);
232  virtual int scriptEnds ();
233 
241  virtual int setCoolTemp (float new_temp)
242  {
243  tempSet->setValueDouble (new_temp);
244  sendValueAll (tempSet);
245  return 0;
246  }
247 
251  virtual void beforeNight ()
252  {
253  if (nightCoolTemp && !isnan (nightCoolTemp->getValueFloat ()))
254  {
255  switchCooling (true);
256  setCoolTemp (nightCoolTemp->getValueFloat ());
257  }
258  }
259 
263  virtual void afterNight ()
264  {
265  switchCooling (false);
266  }
267 
274  virtual int readoutStart ();
275 
276  int camReadout (rts2core::Connection * conn);
277 
278  // focuser functions
279  int setFocuser (int new_set);
280  int getFocPos ();
281 
282  bool isIdle ();
283 
294  {
295  return lastFilterNum;
296  }
297 
301  virtual int commandAuthorized (rts2core::Connection * conn);
302 
303  virtual int maskQueValueBopState (int new_state, int valueQueCondition);
304 
305  virtual void setFullBopState (int new_state);
306 
307  protected:
308  double pixelX;
309  double pixelY;
310 
311  // buffer used to read data
312  char* getDataBuffer (int chan);
313  char* getDataTop (int chan);
314 
320  void addFilters (char *opt);
321 
326  void addFilterOffsets ();
327 
331  virtual int switchCooling (bool newval) { return 0; }
332 
333  rts2core::ValueSelection * camFilterVal;
334  rts2core::DoubleArray *camFilterOffsets;
335 
336  rts2core::ValueString *filterOffsetFile;
337 
338  // for multiple filter wheels
339  std::list <FilterVal> camFilterVals;
340 
346  double getExposureEnd ()
347  {
348  return exposureEnd->getValueDouble ();
349  }
350 
357  void changeExposureEnd (double off)
358  {
359  exposureEnd->setValueDouble (exposureEnd->getValueDouble () + off);
360  }
361 
367  void nullExposureConn () { exposureConn = NULL; }
368 
371 
376 
383  void changeAxisDirections (bool x_orig, bool y_orig);
384 
390  long getExposureNumber () { return exposureNumber->getValueLong (); }
391 
392  long getScriptExposureNumber () { return scriptExposureNum->getValueLong (); }
393 
398  {
399  exposureNumber->inc ();
400  sendValueAll (exposureNumber);
401  scriptExposureNum->inc ();
402  sendValueAll (scriptExposureNum);
403  }
404 
405  const int getDataType ()
406  {
407  return ((DataType *) dataType->getData ())->type;
408  }
409 
418  void setDataType (int ntype) { dataType->setValueInteger (ntype); }
419 
424  void setDataTypeWritable () { dataType->setWritable (); }
425 
426  int nAcc;
427  struct imghdr *focusingHeader;
428 
437  int sendImage (char *data, size_t dataSize);
438 
439  int sendReadoutData (char *data, size_t dataSize, int chan = 0);
440 
441  int fitsDataTransfer (const char *fn)
442  {
443  if (exposureConn)
444  return exposureConn->fitsDataTransfer (fn);
445  return 0;
446  }
447 
454  {
455  if (currentImageData < 0 && calculateStatistics->getValueInteger () == STATISTIC_ONLY)
456  // end bytes
457  return calculateDataSize;
458  if (exposureConn)
459  return exposureConn->getWriteBinaryDataSize (currentImageData);
460  return 0;
461  }
462 
468  long getWriteBinaryDataSize (int chan)
469  {
470  if (currentImageData < 0 && calculateStatistics->getValueInteger () == STATISTIC_ONLY)
471  // end bytes
472  return calculateDataSize;
473  if (exposureConn)
474  return exposureConn->getWriteBinaryDataSize (currentImageData, chan);
475  return 0;
476  }
477 
478  void addBinning2D (int bin_v, int bin_h);
479 
483  virtual void initBinnings ();
484 
485  void addDataType (int in_type);
486 
490  virtual void initDataTypes ();
491 
495  int binningHorizontal () { return binningX->getValueInteger (); }
496 
500  int binningVertical () { return binningY->getValueInteger (); }
501 
507  const int usedPixelByteSize ()
508  {
509  if (getDataType () == RTS2_DATA_ULONG)
510  return 4;
511  return abs (getDataType () / 8);
512  }
513 
517  const int maxPixelByteSize ();
518 
527 
528  size_t getReadoutPixels () { return readoutPixels; }
529 
530 
536  virtual size_t chipByteSize () { return chipUsedSize () * usedPixelByteSize (); }
537 
541  size_t lineByteSize () { return usedPixelByteSize () * (chipUsedReadout->getWidthInt ()); }
542 
543  virtual int processData (char *data, size_t size);
544 
545  rts2core::ValueRectangle *chipUsedReadout;
546 
555  virtual int processOption (int in_opt);
556 
557  virtual void usage ();
558 
559  int willConnect (rts2core::NetworkAddress * in_addr);
560  char *device_file;
561  // number of data channels
562  rts2core::ValueInteger *dataChannels;
563 
564  // current object
565  rts2core::ValueString *objectName;
566  // which channels are off (and which are on)
567  rts2core::BoolArray *channels;
568 
569  rts2core::ValueBool *coolingOnOff;
570  // temperature and others; all in deg Celsius
571  rts2core::ValueFloat *tempAir;
572  rts2core::ValueFloat *tempCCD;
573  rts2core::ValueDoubleStat *tempCCDHistory;
574  rts2core::ValueInteger *tempCCDHistoryInterval;
575  rts2core::ValueInteger *tempCCDHistorySize;
577 
578  // night cooling temperature
579  rts2core::ValueFloat *nightCoolTemp;
580 
581  // Detector size - for DETSIZE keyword
582  rts2core::ValueRectangle *detsize;
583 
584  // Channel X offsets
585  rts2core::DoubleArray *chan1offset;
586  // Channel Y offsets
587  rts2core::DoubleArray *chan2offset;
588 
589  // channel X deltas;
590  rts2core::DoubleArray *chan1delta;
591  // channel Y deltas;
592  rts2core::DoubleArray *chan2delta;
593 
594  // trimmed corners
595  rts2core::DoubleArray *trimx;
596  rts2core::DoubleArray *trimy;
597  rts2core::DoubleArray *trimx2;
598  rts2core::DoubleArray *trimy2;
599 
600  rts2core::ValueString *ccdRealType;
601  rts2core::ValueString *serialNumber;
602 
603  virtual void checkQueChanges (int fakeState);
604 
605  void checkQueuedExposures ();
606 
607  void initCameraChip ();
608  void initCameraChip (int in_width, int in_height, double in_pixelX, double in_pixelY);
609 
617  virtual int startExposure () = 0;
618 
619  virtual void afterReadout ();
620 
621  virtual int endReadout ();
622 
636  virtual int doReadout () = 0;
637 
638  void clearReadout ();
639 
640  void setSize (int in_width, int in_height, int in_x, int in_y)
641  {
642  chipSize->setInts (in_x, in_y, in_width, in_height);
643  chipUsedReadout->setInts (in_x, in_y, in_width, in_height);
644  }
645 
646  void setUsedHeight (int in_height) { chipUsedReadout->setHeight (in_height); }
647 
648  void setUsedWidth (int in_width) { chipUsedReadout->setWidth (in_width); }
649 
659  virtual size_t suggestBufferSize () { return chipByteSize (); }
660 
666  const int getWidth () { return chipSize->getWidthInt (); }
667 
673  const int getUsedWidth () { return chipUsedReadout->getWidthInt (); }
674 
680  const int getUsedWidthBinned () { return (int) (ceil (getUsedWidth () / binningHorizontal ())); }
681 
687  const int getUsedRowBytes () { return getUsedWidthBinned () * usedPixelByteSize (); }
688 
694  const int getHeight () { return chipSize->getHeightInt (); }
695 
700  const int getUsedY () { return chipUsedReadout->getYInt (); }
701 
706  const int getUsedX () { return chipUsedReadout->getXInt (); }
707 
713  const int getUsedHeight () { return chipUsedReadout->getHeightInt (); }
714 
720  const int getUsedHeightBinned () { return (int) (ceil (getUsedHeight () / binningVertical ())); }
721 
727  const int chipTopX () { return chipUsedReadout->getXInt (); }
728 
734  const int chipTopY () { return chipUsedReadout->getYInt (); }
735 
736  virtual int setBinning (int in_vert, int in_hori);
737 
738  int center (int in_w, int in_h);
739 
748  virtual long isExposing ();
749 
757  virtual int endExposure (int ret);
758 
766  virtual int stopExposure ();
767 
768  virtual int setValue (rts2core::Value * old_value, rts2core::Value * new_value);
769 
770  virtual void valueChanged (rts2core::Value *changed_value);
771 
776  {
777  createValue (expType, "SHUTTER", "shutter state", true, RTS2_VALUE_WRITABLE);
778  expType->addSelVal ("LIGHT", NULL);
779  expType->addSelVal ("DARK", NULL);
780  }
781 
788  void createFilter (bool working = false)
789  {
790  if (camFilterVal == NULL)
791  createValue (camFilterVal, "filter", "used filter number", false, RTS2_VALUE_WRITABLE, working ? CAM_WORKING : CAM_EXPOSING);
792  if (camFilterOffsets == NULL)
793  createValue (camFilterOffsets, "filter_offsets", "filter offsets", false, RTS2_VALUE_WRITABLE);
794  }
795 
802  void addShutterType (const char *enumName, rts2core::Rts2SelData *data = NULL) { expType->addSelVal (enumName, data); }
803 
808  {
809  createValue (dataChannels, "DATA_CHANNELS", "total number of data channels", true);
810  createValue (channels, "CHAN", "channels on/off", true, RTS2_DT_ONOFF | RTS2_VALUE_WRITABLE | RTS2_FITS_HEADERS, CAM_WORKING);
811  }
812 
813  void setNumChannels (int num)
814  {
815  channels->clear ();
816  for (int i = 0; i < num; i++)
817  channels->addValue (true);
818  }
819 
820  int getNumChannels ()
821  {
822  if (channels == NULL)
823  return 1;
824  return channels->size ();
825  }
826 
831  {
832  return dataChannels->getValueInteger ();
833  }
834 
839  void createTempAir () { createValue (tempAir, "CCD_AIR", "detector air temperature"); }
840 
844  void createTempCCD () { createValue (tempCCD, "CCD_TEMP", "CCD temperature"); }
845 
850  createValue (tempCCDHistory, "ccd_temp_history", "history of ccd temperatures", false);
851  createValue (tempCCDHistoryInterval, "ccd_temp_interval", "interval in seconds between repeative queries of CCD temperature", false);
852  createValue (tempCCDHistorySize, "ccd_temp_size", "interval in seconds between repeative queries of CCD temperature", false);
853 
854  tempCCDHistoryInterval->setValueInteger (2);
855  tempCCDHistorySize->setValueInteger (20);
856  }
857 
861  void addTempCCDHistory (float temp);
862 
866  virtual void temperatureCheck () {};
867 
874  {
875  createValue (coolingOnOff, "COOLING", "camera cooling start/stop", true, RTS2_VALUE_WRITABLE | RTS2_DT_ONOFF, CAM_WORKING);
876  createValue (tempSet, "CCD_SET", "CCD set temperature", true, RTS2_VALUE_WRITABLE, CAM_WORKING);
877  createValue (nightCoolTemp, "nightcool", "night cooling temperature", false, RTS2_VALUE_WRITABLE);
878  nightCoolTemp->setValueFloat (NAN);
879  addOption ('c', NULL, 1, "night cooling temperature");
880  }
881 
887  double getExposure () { return exposure->getValueDouble (); }
888 
892  void setExposureMinMax (double exp_min, double exp_max);
893 
897  virtual void setExposure (double exp) { exposure->setValueDouble (exp); }
898 
904  int getExpType () { return expType->getValueInteger (); }
905 
911  virtual int setFilterNum (int new_filter, const char *fn = NULL);
912  virtual int getFilterNum (const char *fn = NULL);
913 
914  void offsetForFilter (int new_filter, std::list <FilterVal>::iterator fvi);
915 
916  int getCamFilterNum () { return camFilterVal->getValueInteger (); }
917 
918  void setFilterWorking (bool working) { getCondValue (camFilterVal)->setStateCondition (working ? CAM_WORKING : CAM_EXPOSING); }
919 
923  void markReadoutStart () { timeReadoutStart = getNow (); }
924 
928  void updateReadoutSpeed (size_t computedPixels)
929  {
930  if (!isnan (timeReadoutStart))
931  {
932  readoutTime->setValueDouble (getNow () - timeReadoutStart);
933  sendValueAll (readoutTime);
934 
935  pixelsSecond->setValueDouble (computedPixels / readoutTime->getValueDouble ());
936  sendValueAll (pixelsSecond);
937 
938  // end computation of readout time
939  if (computedPixels >= readoutPixels)
940  timeReadoutStart = NAN;
941  }
942  }
943 
944  void setFitsTransfer () { currentImageTransfer = FITS; }
945 
946  private:
947  size_t readoutPixels;
948  // data buffers - separated for each channel
949  char** dataBuffers;
950  size_t *dataWritten;
951 
952  int histories;
953  int comments;
954 
955  // readout - ideally time for data->computer. Camera driver should start markReadoutStart and markReadoutEnd to mark start/end times
956  double timeReadoutStart;
957  // readout time including transfer (TCP/IP,..) overhead
958  double timeTransferStart;
959 
960  // focusing header data
961  struct imghdr *fhd;
962 
963  // physical readout time from device
964  rts2core::ValueDouble *pixelsSecond;
965  rts2core::ValueDouble *readoutTime;
966 
967  // data time including transfer overhead
968  rts2core::ValueDouble *transferTime;
969 
970  // connection which requries data to be send after end of exposure
971  rts2core::Connection *exposureConn;
972 
973  rts2core::ValueDoubleMinMax *exposure;
974 
975  // shared memory identifier
976  int sharedMemNum;
977  rts2core::DataSharedWrite *sharedData;
978 
979  // number of exposures camera takes
980  rts2core::ValueLong *exposureNumber;
981  // exposure number inside script
982  rts2core::ValueLong *scriptExposureNum;
983  rts2core::ValueBool *waitingForEmptyQue;
984  rts2core::ValueBool *waitingForNotBop;
985 
986  rts2core::ValueInteger *binningX;
987  rts2core::ValueInteger *binningY;
988 
989  char *focuserDevice;
990  std::vector < const char * > wheelDevices;
991 
992  int lastFilterNum;
993 
994  int currentImageData;
995  // true if current image is send over shared connection
996  enum { TCPIP, SHARED, FITS } currentImageTransfer;
997 
998  // whenewer statistics should be calculated
999  rts2core::ValueSelection *calculateStatistics;
1000 
1001  // image parameters
1002  rts2core::ValueDouble *average;
1003  rts2core::ValueDouble *min;
1004  rts2core::ValueDouble *max;
1005  rts2core::ValueDouble *sum;
1006  rts2core::ValueDouble *image_mode;
1007 
1008  uint32_t *modeCount;
1009  long long unsigned int modeCountSize;
1010 
1011  rts2core::ValueLong *computedPix;
1012 
1016  rts2core::ValueBool *calculateCenter;
1017 
1022  rts2core::ValueRectangle *centerBox;
1023 
1024  rts2core::ValueDouble *centerCutLevel;
1025 
1026  rts2core::DoubleArray *sumsX;
1027  rts2core::DoubleArray *sumsY;
1028 
1029  // center values
1030  rts2core::ValueDouble *centerX;
1031  rts2core::ValueDouble *centerY;
1032 
1033  // maximalADU
1034  rts2core::ValueDouble *centerMax;
1035 
1036  // number of measurements to sum/average
1037  rts2core::ValueInteger *centerSums;
1038 
1039  // center statistics
1040  rts2core::ValueDoubleStat *centerStat;
1041 
1042  // center average
1043  rts2core::ValueDouble *centerAvg;
1044  rts2core::ValueDoubleStat *centerAvgStat;
1045 
1046  // update statistics
1047  template <typename t> int updateStatistics (t *data, size_t dataSize)
1048  {
1049  long double tSum = 0;
1050  double tMin = min->getValueDouble ();
1051  double tMax = max->getValueDouble ();
1052  int pixNum = 0;
1053  t *tData = data;
1054  if (modeCountSize < (((long long unsigned int) 1) << (sizeof (t) * 8)))
1055  {
1056  delete[] modeCount;
1057  modeCountSize = ((long long unsigned int) 1) << (sizeof (t) * 8);
1058  modeCount = new uint32_t[modeCountSize];
1059  bzero (modeCount, modeCountSize * sizeof (uint32_t));
1060  }
1061  while (((char *) tData) < ((char *) data) + dataSize)
1062  {
1063  t tD = *tData;
1064  tSum += tD;
1065  if (tD < tMin)
1066  tMin = tD;
1067  if (tD > tMax)
1068  tMax = tD;
1069  modeCount[(long) tD]++;
1070  tData++;
1071  pixNum++;
1072  }
1073  sum->setValueDouble (sum->getValueDouble () + tSum);
1074  if (tMin < min->getValueDouble ())
1075  min->setValueDouble (tMin);
1076  if (tMax > max->getValueDouble ())
1077  max->setValueDouble (tMax);
1078  return pixNum;
1079  }
1080 
1081  // update center box
1082  template <typename t> int updateCenter (t *data, size_t dataSize)
1083  {
1084  // check if box is inside window
1085  int x = centerBox->getXInt ();
1086  if (x < 0)
1087  x = getUsedX ();
1088  int y = centerBox->getYInt ();
1089  if (y < 0)
1090  y = getUsedY ();
1091  int w = centerBox->getWidthInt () / binningHorizontal ();
1092  if (w < 0)
1093  w = (getUsedWidth () - (x - getUsedX ())) / binningHorizontal ();
1094  int h = centerBox->getHeightInt () / binningVertical ();
1095  if (h < 0)
1096  h = (getUsedHeight () - (y - getUsedY ())) / binningVertical ();
1097 
1098  double center_max = centerCutLevel->getValueDouble ();
1099  double center_avg = 0;
1100  int center_npix = 0;
1101 
1102  x -= getUsedX ();
1103  y -= getUsedY ();
1104 
1105  if (x < 0 || y < 0 || (w + ceil ((double) x / binningHorizontal ())) > getUsedWidthBinned () || (h + ceil ((double) y / binningVertical ())) > getUsedHeightBinned ())
1106  return -1;
1107 
1108  t *tData = data;
1109  // move to the first calculated pixel
1110  tData += y * getUsedWidthBinned () + x;
1111 
1112  int i;
1113 
1114  double sx[w];
1115  for (i = 0; i < w; i++)
1116  sx[i] = 0;
1117 
1118  sumsY->clear ();
1119 
1120  for (int row = 0; row < h; row++)
1121  {
1122  double rs = 0;
1123  for (int col = 0; col < w; col++, tData++)
1124  {
1125  if (*tData >= centerCutLevel->getValueDouble ())
1126  {
1127  sx[col] += *tData;
1128  rs += *tData;
1129  center_npix++;
1130  if (isnan (center_max) || *tData > center_max)
1131  center_max = *tData;
1132  }
1133  }
1134 
1135  sumsY->addValue (rs);
1136  center_avg += rs;
1137  }
1138 
1139  sumsX->clear ();
1140 
1141  for (i = 0; i < w; i++)
1142  sumsX->addValue (sx[i]);
1143 
1144  sendValueAll (sumsX);
1145  sendValueAll (sumsY);
1146 
1147  centerX->setValueDouble (sumsX->calculateMedianIndex ());
1148  centerY->setValueDouble (sumsY->calculateMedianIndex ());
1149 
1150  centerMax->setValueDouble (center_max);
1151 
1152  centerStat->addValue (center_max, centerSums->getValueInteger ());
1153 
1154  if (center_npix > 0)
1155  {
1156  center_avg /= center_npix;
1157  centerAvg->setValueDouble (center_avg);
1158  centerAvgStat->addValue (center_avg, centerSums->getValueInteger ());
1159  }
1160  else
1161  {
1162  centerAvg->setValueDouble (0);
1163  centerAvgStat->addValue (0, centerSums->getValueInteger ());
1164  }
1165 
1166  sendValueAll (centerX);
1167  sendValueAll (centerY);
1168 
1169  sendValueAll (centerMax);
1170 
1171  centerStat->calculate ();
1172  sendValueAll (centerStat);
1173 
1174  sendValueAll (centerAvg);
1175  centerAvgStat->calculate ();
1176  sendValueAll (centerAvgStat);
1177 
1178  return 0;
1179  }
1180 
1181  char multi_wcs;
1182 
1183  // WCS CRPIX
1184  rts2core::ValueDouble *wcs_crpix1;
1185  rts2core::ValueDouble *wcs_crpix2;
1186 
1187  double default_crpix[2];
1188 
1189  // WCS CD matrix
1190  rts2core::ValueString *wcs_ctype1;
1191  rts2core::ValueString *wcs_ctype2;
1192  rts2core::ValueDouble *wcs_cdelta1;
1193  rts2core::ValueDouble *wcs_cdelta2;
1194  rts2core::ValueDouble *wcs_crota;
1195 
1196  // suffixes of auxiliary WCS to record
1197  rts2core::StringArray *wcs_aux;
1198 
1199  // 1:1 binning, default WCS - cdelta1,cdelta2,crota
1200  double default_cd[3];
1201 
1202  rts2core::ValueRectangle *chipSize;
1203 
1204  int camStartExposure ();
1205  int camStartExposureWithoutCheck ();
1206 
1207  rts2core::ValueInteger *camFocVal;
1208 
1209  int getStateChip (int chip);
1210 
1211  // chip binning
1212  rts2core::ValueSelection *binning;
1213 
1214  // allowed chip data type
1215  rts2core::ValueSelection *dataType;
1216 
1217  // when chip exposure will end
1218  rts2core::ValueTime *exposureEnd;
1219 
1220  // filter wheel is moving
1221  rts2core::ValueBool *focuserMoving;
1222 
1223  // set chipUsedSize size
1224  int box (int _x, int _y, int _width, int _height, rts2core::ValueRectangle *retv = NULL);
1225 
1226  // callback functions from camera connection
1227  int camExpose (rts2core::Connection * conn, int chipState, bool fromQue);
1228  int camBox (rts2core::Connection * conn, int x, int y, int width, int height);
1229  int camCenter (rts2core::Connection * conn, int in_w, int in_h);
1230 
1237  int getPhysicalChannel (int ch);
1238 
1239  void startImageData (rts2core::Connection * conn);
1240 
1245  int sendFirstLine (int chan, int pchan);
1246 
1247  // if true, send command OK after exposure is started
1248  bool sendOkInExposure;
1249 
1250  long calculateDataSize;
1251 
1252  void setFilterOffsets (char *opt);
1253 
1254  bool filterMoving ();
1255 
1256  void setFilterOffsetFile (const char *filename);
1257 
1258  std::map <std::string, double> filterOffsets;
1259 };
1260 
1261 }
1262 
1263 #endif /* !__RTS2_CAMERA_CPP__ */