Instrument Neutral Distributed Interface INDI  2.0.2
pegasus_indigo.h
Go to the documentation of this file.
1 /*******************************************************************************
2  Copyright(c) 2022 Jasem Mutlaq. All rights reserved.
3 
4  Pegasus INDIGO Filter Wheel
5 
6  This program is free software; you can redistribute it and/or modify it
7  under the terms of the GNU General Public License as published by the Free
8  Software Foundation; either version 2 of the License, or (at your option)
9  any later version.
10 
11  This program is distributed in the hope that it will be useful, but WITHOUT
12  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14  more details.
15 
16  You should have received a copy of the GNU Library General Public License
17  along with this library; see the file COPYING.LIB. If not, write to
18  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  Boston, MA 02110-1301, USA.
20 
21  The full GNU General Public License is included in this distribution in the
22  file called LICENSE.
23 *******************************************************************************/
24 
25 #pragma once
26 
27 #include "indifilterwheel.h"
28 #include <stdint.h>
29 
31 {
32  public:
33  PegasusINDIGO();
34 
35  virtual bool initProperties() override;
36  virtual bool updateProperties() override;
37 
38  protected:
39  const char *getDefaultName() override;
40 
41  bool Handshake() override;
42  bool SelectFilter(int) override;
43  void TimerHit() override;
44 
45  private:
49  bool getFirmware();
50 
54 
65  bool sendCommand(const char * cmd, char * res = nullptr, int cmd_len = -1, int res_len = -1);
66  void hexDump(char * buf, const char * data, uint32_t size);
67  std::vector<std::string> split(const std::string &input, const std::string &regex);
68 
73  INDI::PropertyText FirmwareTP {1};
74 
78  static constexpr const uint8_t DRIVER_STOP_CHAR {0xA};
79  static constexpr const uint8_t DRIVER_TIMEOUT {3};
80  static constexpr const uint8_t DRIVER_LEN {128};
81 };
bool SelectFilter(int) override
Select a new filter position.
bool Handshake() override
perform handshake with device to check communication
void TimerHit() override
Callback function to be called once SetTimer duration elapses.
virtual bool initProperties() override
Initilize properties initial state and value. The child class must implement this function.
const char * getDefaultName() override
virtual bool updateProperties() override
updateProperties is called whenever there is a change in the CONNECTION status of the driver....
__u8 cmd[4]
Definition: pwc-ioctl.h:2