Instrument Neutral Distributed Interface INDI  2.0.2
Lx.h
Go to the documentation of this file.
1 
2 #pragma once
3 
4 #include "defaultdevice.h"
5 #include "indiproperty.h"
6 #include "indipropertyswitch.h"
7 
8 //For SPC900 Led control
9 #include "webcam/pwc-ioctl.h"
10 
11 //For serial control
12 #include <termios.h>
13 
14 #define LX_TAB "Long Exposure"
15 // LX Modes
16 #define LXSERIAL 0
17 #define LXLED 1
18 #define LXPARALLEL 2
19 #define LXGPIO 3
20 
21 #define LXMODENUM 2
22 
23 class Lx
24 {
25  public:
50 
51  bool isEnabled();
52  void setCamerafd(int fd);
54  bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n);
55  bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n);
56  bool updateProperties();
57  bool startLx();
58  int stopLx();
59  unsigned int getLxmode();
60 
61  private:
63  const char *device_name;
64  int camerafd;
65 
66  // Serial
67  int serialfd;
68  struct termios oldterminfo;
69  void closeserial(int fd);
70  int openserial(const char *devicename);
71  int setRTS(int fd, int level);
72  int setDTR(int fd, int level);
73  bool startLxSerial();
74  int stopLxSerial();
75  void getSerialOptions(unsigned int *speed, unsigned int *wordsize, unsigned int *parity, unsigned int *stops);
76  const char *getSerialEOL();
77  INDI::Property findByLabel(INDI::DefaultDevice *dev, const char *label);
78 
79  // PWC Cameras
80  INDI::PropertySwitch FlashStrobeSP {INDI::Property()};
81  INDI::PropertySwitch FlashStrobeStopSP {INDI::Property()};
82 
83  enum pwcledmethod
84  {
85  PWCIOCTL,
86  FLASHLED
87  };
88  char ledmethod;
89  struct pwc_probe probe;
90  bool checkPWC();
91  void pwcsetLed(int on, int off);
92  void pwcsetflashon();
93  void pwcsetflashoff();
94  bool startLxPWC();
95  int stopLxPWC();
96 };
#define LXMODENUM
Definition: Lx.h:21
hid_device * device
Class to provide extended functionality for devices in addition to the functionality provided by INDI...
Provides generic container for INDI properties.
Definition: indiproperty.h:48
Definition: Lx.h:24
bool updateProperties()
Definition: Lx.cpp:106
ISwitch LxModeS[LXMODENUM]
Definition: Lx.h:28
IText LxStartStopCmdT[2]
Definition: Lx.h:36
bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n)
Definition: Lx.cpp:151
IText LxPortT[1]
Definition: Lx.h:30
ISwitch LxSerialSizeS[4]
Definition: Lx.h:42
ISwitch LxParallelOptionS[9]
Definition: Lx.h:34
ISwitchVectorProperty LxSerialSizeSP
Definition: Lx.h:43
ISwitch LxLogicalLevelS[2]
Definition: Lx.h:38
bool startLx()
Definition: Lx.cpp:322
ITextVectorProperty LxStartStopCmdTP
Definition: Lx.h:37
ISwitch LxSerialAddeolS[4]
Definition: Lx.h:48
ITextVectorProperty LxPortTP
Definition: Lx.h:31
ISwitchVectorProperty LxSerialParitySP
Definition: Lx.h:45
ISwitch LxEnableS[2]
Definition: Lx.h:26
ISwitch LxSerialSpeedS[9]
Definition: Lx.h:40
ISwitchVectorProperty LxSerialOptionSP
Definition: Lx.h:33
int stopLx()
Definition: Lx.cpp:339
ISwitchVectorProperty LxSerialAddeolSP
Definition: Lx.h:49
ISwitchVectorProperty LxLogicalLevelSP
Definition: Lx.h:39
bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n)
Definition: Lx.cpp:281
ISwitchVectorProperty LxSerialStopSP
Definition: Lx.h:47
ISwitch LxSerialStopS[2]
Definition: Lx.h:46
ISwitchVectorProperty LxEnableSP
Definition: Lx.h:27
bool isEnabled()
Definition: Lx.cpp:21
ISwitch LxSerialParityS[3]
Definition: Lx.h:44
ISwitchVectorProperty LxModeSP
Definition: Lx.h:29
bool initProperties(INDI::DefaultDevice *device)
Definition: Lx.cpp:26
ISwitchVectorProperty LxParallelOptionSP
Definition: Lx.h:35
ISwitchVectorProperty LxSerialSpeedSP
Definition: Lx.h:41
unsigned int getLxmode()
Definition: Lx.cpp:317
void setCamerafd(int fd)
Definition: Lx.cpp:16
ISwitch LxSerialOptionS[3]
Definition: Lx.h:32
ISState
Switch state.
Definition: indiapi.h:150
int fd
Definition: intelliscope.c:43
One switch descriptor.
One text descriptor.
Switch vector property descriptor.
Definition: indiapi.h:367
Text vector property descriptor.
Definition: indiapi.h:246