Instrument Neutral Distributed Interface INDI  2.0.2
Go to the documentation of this file.
1 /*******************************************************************************
2  Copyright(c) 2012-2019 Jasem Mutlaq. All rights reserved.
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.
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.
14  You should have received a copy of the GNU Library General Public License
15  along with this library; see the file COPYING.LIB. If not, write to
16  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  Boston, MA 02110-1301, USA.
19  The full GNU General Public License is included in this distribution in the
20  file called LICENSE.
21 *******************************************************************************/
23 #pragma once
25 #include "defaultdevice.h"
26 #include "indiguiderinterface.h"
28 #include <chrono>
30 class GPUSBDriver;
33 {
34  public:
35  GPUSB();
36  virtual ~GPUSB();
38  virtual bool initProperties() override;
39  virtual bool updateProperties() override;
40  virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override;
42  static void NSTimerHelper(void *context);
43  static void WETimerHelper(void *context);
45  protected:
46  bool Connect() override;
47  bool Disconnect() override;
48  const char *getDefaultName() override;
49  void debugTriggered(bool enable) override;
51  virtual IPState GuideNorth(uint32_t ms) override;
52  virtual IPState GuideSouth(uint32_t ms) override;
53  virtual IPState GuideEast(uint32_t ms) override;
54  virtual IPState GuideWest(uint32_t ms) override;
56  private:
57  std::chrono::system_clock::time_point NSGuideTS, WEGuideTS;
58  uint32_t NSPulseRequest = 0, WEPulseRequest = 0;
59  int NSDirection = -1, WEDirection = -1, NSTimerID = -1, WETimerID = -1;
61  void NSTimerCallback();
62  void WETimerCallback();
64  GPUSBDriver *driver;
65 };
Definition: gpusb.h:33
bool Connect() override
Connect to the device. INDI::DefaultDevice implementation connects to appropriate connection interfac...
Definition: gpusb.cpp:49
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Process the client newNumber command.
Definition: gpusb.cpp:103
virtual IPState GuideEast(uint32_t ms) override
Guide east for ms milliseconds. East is defined as RA+.
Definition: gpusb.cpp:197
virtual IPState GuideWest(uint32_t ms) override
Guide west for ms milliseconds. West is defined as RA-.
Definition: gpusb.cpp:216
virtual IPState GuideNorth(uint32_t ms) override
Guide north for ms milliseconds. North is defined as DEC+.
Definition: gpusb.cpp:159
const char * getDefaultName() override
Definition: gpusb.cpp:44
bool Disconnect() override
Disconnect from device.
Definition: gpusb.cpp:63
Definition: gpusb.cpp:34
virtual bool initProperties() override
Initilize properties initial state and value. The child class must implement this function.
Definition: gpusb.cpp:70
static void NSTimerHelper(void *context)
Definition: gpusb.cpp:235
virtual ~GPUSB()
Definition: gpusb.cpp:39
virtual IPState GuideSouth(uint32_t ms) override
Guide south for ms milliseconds. South is defined as DEC-.
Definition: gpusb.cpp:178
static void WETimerHelper(void *context)
Definition: gpusb.cpp:240
virtual bool updateProperties() override
updateProperties is called whenever there is a change in the CONNECTION status of the driver....
Definition: gpusb.cpp:85
void debugTriggered(bool enable) override
Inform driver that the debug option was triggered. This function is called after setDebug is triggere...
Definition: gpusb.cpp:117
Class to provide extended functionality for devices in addition to the functionality provided by INDI...
Property state.
Definition: indiapi.h:160