Instrument Neutral Distributed Interface INDI  1.9.2
gpusb.h
Go to the documentation of this file.
1 /*******************************************************************************
2  Copyright(c) 2012-2019 Jasem Mutlaq. All rights reserved.
3 
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.
8 
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.
13 
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.
18 
19  The full GNU General Public License is included in this distribution in the
20  file called LICENSE.
21 *******************************************************************************/
22 
23 #pragma once
24 
25 #include "defaultdevice.h"
26 #include "indiguiderinterface.h"
27 
28 #include <chrono>
29 
30 class GPUSBDriver;
31 
33 {
34  public:
35  GPUSB();
36  virtual ~GPUSB();
37 
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;
41 
42  static void NSTimerHelper(void *context);
43  static void WETimerHelper(void *context);
44 
45  protected:
46  bool Connect() override;
47  bool Disconnect() override;
48  const char *getDefaultName() override;
49  void debugTriggered(bool enable) override;
50 
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;
55 
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;
60 
61  void NSTimerCallback();
62  void WETimerCallback();
63 
64  GPUSBDriver *driver;
65 };
GPUSB::getDefaultName
const char * getDefaultName() override
Definition: gpusb.cpp:44
IPState
IPState
Property state.
Definition: indiapi.h:158
GPUSB::initProperties
virtual bool initProperties() override
Initilize properties initial state and value. The child class must implement this function.
Definition: gpusb.cpp:70
GPUSB::GuideWest
virtual IPState GuideWest(uint32_t ms) override
Guide west for ms milliseconds. West is defined as RA-.
Definition: gpusb.cpp:216
GPUSB::Disconnect
bool Disconnect() override
Disconnect from device.
Definition: gpusb.cpp:63
GPUSB::GuideEast
virtual IPState GuideEast(uint32_t ms) override
Guide east for ms milliseconds. East is defined as RA+.
Definition: gpusb.cpp:197
GPUSB
Definition: gpusb.h:32
GPUSB::GuideNorth
virtual IPState GuideNorth(uint32_t ms) override
Guide north for ms milliseconds. North is defined as DEC+.
Definition: gpusb.cpp:159
GPUSB::GuideSouth
virtual IPState GuideSouth(uint32_t ms) override
Guide south for ms milliseconds. South is defined as DEC-.
Definition: gpusb.cpp:178
GPUSB::Connect
bool Connect() override
Connect to the device. INDI::DefaultDevice implementation connects to appropriate connection interfac...
Definition: gpusb.cpp:49
GPUSB::~GPUSB
virtual ~GPUSB()
Definition: gpusb.cpp:39
GPUSB::GPUSB
GPUSB()
Definition: gpusb.cpp:34
INDI::GuiderInterface
Definition: indiguiderinterface.h:50
GPUSB::debugTriggered
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
GPUSB::NSTimerHelper
static void NSTimerHelper(void *context)
Definition: gpusb.cpp:235
defaultdevice.h
indiguiderinterface.h
GPUSB::updateProperties
virtual bool updateProperties() override
updateProperties is called whenever there is a change in the CONNECTION status of the driver....
Definition: gpusb.cpp:85
GPUSB::WETimerHelper
static void WETimerHelper(void *context)
Definition: gpusb.cpp:240
INDI::DefaultDevice
Class to provide extended functionality for devices in addition to the functionality provided by INDI...
Definition: defaultdevice.h:118
GPUSB::ISNewNumber
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
GPUSBDriver
Definition: gpdriver.h:39