Debian Codegraph @

drivers/rotator/pegasus_falcon.h

raw symbols SCIP
1 /*******************************************************************************
2 Copyright(c) 2020 Jasem Mutlaq. All rights reserved.
3
4 Pegasus Falcon Rotator
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 "indirotator.h"cxx . . $ `<file>/libs/indibase/indirotator.h`/
28 #include <stdint.h>
29
30 class PegasusFalconcxx . . $ PegasusFalcon# : public INDIcxx . . $ INDI/::Rotatorcxx . . $ INDI/Rotator#
31 {
32 public:
33 PegasusFalconcxx . . $ PegasusFalcon#PegasusFalcon(49f6e7a06ebc5aa8).();
34
35 virtual bool initPropertiescxx . . $ PegasusFalcon#initProperties(c9857a73d68e59ba).() override;
36 virtual bool updatePropertiescxx . . $ PegasusFalcon#updateProperties(c9857a73d68e59ba).() override;
37
38 virtual bool ISNewNumbercxx . . $ PegasusFalcon#ISNewNumber(b910d3521abb33fb).(const char *dev, const char *name, double values[], char *names[], int n) override;
39 virtual bool ISNewSwitchcxx . . $ PegasusFalcon#ISNewSwitch(e439c05866add404).(const char *dev, const char *name, ISStatecxx . . $ ISState# *states, char *names[], int n) override;
40
41 protected:
42 const char *getDefaultNamecxx . . $ PegasusFalcon#getDefaultName(33a1f659e94feb42).() override;
43 virtual bool saveConfigItemscxx . . $ PegasusFalcon#saveConfigItems(dc9e5a301483124c).(FILE *fp) override;
44
45 // Event loop
46 virtual void TimerHitcxx . . $ PegasusFalcon#TimerHit(49f6e7a06ebc5aa8).() override;
47
48 // Rotator Overrides
49 virtual IPStatecxx . . $ IPState# MoveRotatorcxx . . $ PegasusFalcon#MoveRotator(962e0c922eecd788).(double angle) override;
50 virtual bool ReverseRotatorcxx . . $ PegasusFalcon#ReverseRotator(efaadfb7dc14930a).(bool enabled) override;
51 virtual bool SyncRotatorcxx . . $ PegasusFalcon#SyncRotator(f8197d536af80c96).(double angle) override;
52 virtual bool AbortRotatorcxx . . $ PegasusFalcon#AbortRotator(c9857a73d68e59ba).() override;
53
54 private:
55 bool Handshakecxx . . $ PegasusFalcon#Handshake(c9857a73d68e59ba).() override;
56
57 ///////////////////////////////////////////////////////////////////////////////
58 /// Query Functions
59 ///////////////////////////////////////////////////////////////////////////////
60 bool getFirmwarecxx . . $ PegasusFalcon#getFirmware(c9857a73d68e59ba).();
61 bool getStatusDatacxx . . $ PegasusFalcon#getStatusData(c9857a73d68e59ba).();
62
63 ///////////////////////////////////////////////////////////////////////////////
64 /// Device Control Functions
65 ///////////////////////////////////////////////////////////////////////////////
66 bool reloadFirmwarecxx . . $ PegasusFalcon#reloadFirmware(c9857a73d68e59ba).();
67 bool setDerotationcxx . . $ PegasusFalcon#setDerotation(dfa6e707f7696010).(uint32_tcxx . . $ uint32_t# ms);
68
69 ///////////////////////////////////////////////////////////////////////////////
70 /// Communication Functions
71 ///////////////////////////////////////////////////////////////////////////////
72 /**
73 * @brief sendCommand Send a string command to device.
74 * @param cmd Command to be sent. Can be either NULL TERMINATED or just byte buffer.
75 * @param res If not nullptr, the function will wait for a response from the device. If nullptr, it returns true immediately
76 * after the command is successfully sent.
77 * @param cmd_len if -1, it is assumed that the @a cmd is a null-terminated string. Otherwise, it would write @a cmd_len bytes from
78 * the @a cmd buffer.
79 * @param res_len if -1 and if @a res is not nullptr, the function will read until it detects the default delimeter DRIVER_STOP_CHAR
80 * up to DRIVER_LEN length. Otherwise, the function will read @a res_len from the device and store it in @a res.
81 * @return True if successful, false otherwise.
82 */
83 bool sendCommandcxx . . $ PegasusFalcon#sendCommand(2ce06d43b6141e45).(const char * cmd, char * res = nullptr, int cmd_len = -1, int res_len = -1);
84 void hexDumpcxx . . $ PegasusFalcon#hexDump(3e2c863ed83053e8).(char * buf, const char * data, uint32_tcxx . . $ uint32_t# size);
85 stdcxx . . $ std/::vectorcxx . . $ std/vector#<stdcxx . . $ std/::stringcxx . . $ std/string#> splitcxx . . $ PegasusFalcon#split(c47e161d59f8b6e7).(const stdcxx . . $ std/::stringcxx . . $ std/string# &input, const stdcxx . . $ std/::stringcxx . . $ std/string# &regex);
86
87 /**
88 * @brief cleanupResponse Removes all spaces
89 * @param response buffer
90 */
91 void cleanupResponsecxx . . $ PegasusFalcon#cleanupResponse(fda57c8427c60377).(char *response);
92
93 ////////////////////////////////////////////////////////////////////////////////////
94 /// Properties
95 ////////////////////////////////////////////////////////////////////////////////////
96 /// Reboot Device
97 ISwitchVectorPropertycxx . . $ ISwitchVectorProperty# ReloadFirmwareSPcxx . . $ PegasusFalcon#ReloadFirmwareSP.;
98 ISwitchcxx . . $ ISwitch# ReloadFirmwareScxx . . $ PegasusFalcon#ReloadFirmwareS.[1];
99 /// Derotation
100 INumberVectorPropertycxx . . $ INumberVectorProperty# DerotateNPcxx . . $ PegasusFalcon#DerotateNP.;
101 INumbercxx . . $ INumber# DerotateNcxx . . $ PegasusFalcon#DerotateN.[1];
102 /// Firmware
103 ITextVectorPropertycxx . . $ ITextVectorProperty# FirmwareTPcxx . . $ PegasusFalcon#FirmwareTP.;
104 ITextcxx . . $ IText# FirmwareTcxx . . $ PegasusFalcon#FirmwareT.[1] {};
105
106 stdcxx . . $ std/::vectorcxx . . $ std/vector#<stdcxx . . $ std/::stringcxx . . $ std/string#> lastStatusDatacxx . . $ PegasusFalcon#lastStatusData.;
107
108 /////////////////////////////////////////////////////////////////////////////
109 /// Static Helper Values
110 /////////////////////////////////////////////////////////////////////////////
111 static constexpr const uint8_tcxx . . $ uint8_t# DRIVER_STOP_CHARcxx . . $ PegasusFalcon#DRIVER_STOP_CHAR. {0xA};
112 static constexpr const uint8_tcxx . . $ uint8_t# DRIVER_TIMEOUTcxx . . $ PegasusFalcon#DRIVER_TIMEOUT. {3};
113 static constexpr const uint8_tcxx . . $ uint8_t# DRIVER_LENcxx . . $ PegasusFalcon#DRIVER_LEN. {128};
114 };