Debian Codegraph @

drivers/auxiliary/pegasus_uch.h

raw symbols SCIP
1 /*******************************************************************************
2 Copyright(c) 2021 Chrysikos Efstathios. All rights reserved.
3
4 Pegasus USB Control Hub
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
26 #pragma once
27
28 #include "defaultdevice.h"cxx . . $ `<file>/libs/indibase/defaultdevice.h`/
29 #include <stdint.h>
30 #include <map>
31
32 namespace Connectioncxx . . $ Connection/
33 {
34 class Serialcxx . . $ Connection/Serial#;
35 }
36
37 struct SwitchMapcxx . . $ SwitchMap#
38 {
39 ISwitchcxx . . $ ISwitch# * Scxx . . $ SwitchMap#S.;
40 ISwitchVectorPropertycxx . . $ ISwitchVectorProperty# * SPcxx . . $ SwitchMap#SP.;
41 };
42
43
44
45 class PegasusUCHcxx . . $ PegasusUCH# : public INDIcxx . . $ INDI/::DefaultDevicecxx . . $ INDI/DefaultDevice#
46 {
47 public:
48 PegasusUCHcxx . . $ PegasusUCH#PegasusUCH(49f6e7a06ebc5aa8).();
49 virtual bool initPropertiescxx . . $ PegasusUCH#initProperties(c9857a73d68e59ba).() override;
50 virtual bool updatePropertiescxx . . $ PegasusUCH#updateProperties(c9857a73d68e59ba).() override;
51 virtual bool ISNewSwitchcxx . . $ PegasusUCH#ISNewSwitch(e439c05866add404).(const char *dev, const char *name, ISStatecxx . . $ ISState# *states, char *names[], int n) override;
52
53
54 protected:
55 const char *getDefaultNamecxx . . $ PegasusUCH#getDefaultName(33a1f659e94feb42).() override;
56 virtual bool saveConfigItemscxx . . $ PegasusUCH#saveConfigItems(dc9e5a301483124c).(FILE *fp) override;
57 // Event loop
58 virtual void TimerHitcxx . . $ PegasusUCH#TimerHit(49f6e7a06ebc5aa8).() override;
59
60 private:
61 bool Handshakecxx . . $ PegasusUCH#Handshake(c9857a73d68e59ba).();
62
63 // Device Control
64 bool rebootcxx . . $ PegasusUCH#reboot(c9857a73d68e59ba).();
65
66 // USB
67 bool setPowerLEDEnabledcxx . . $ PegasusUCH#setPowerLEDEnabled(efaadfb7dc14930a).(bool enabled);
68 bool setUSBHubEnabledcxx . . $ PegasusUCH#setUSBHubEnabled(efaadfb7dc14930a).(bool enabled);
69 bool setUSBPortcxx . . $ PegasusUCH#setUSBPort(fb1ac90af4c43dd5).(uint8_tcxx . . $ uint8_t# port, ISwitchcxx . . $ ISwitch# usbPortS[2], ISwitchVectorPropertycxx . . $ ISwitchVectorProperty# sp, ISStatecxx . . $ ISState# * states, char * names[], int n);
70 bool setUSBPortEnabledcxx . . $ PegasusUCH#setUSBPortEnabled(e6c03217c9f46667).(uint8_tcxx . . $ uint8_t# port, bool enabled);
71 void setFirmwareVersioncxx . . $ PegasusUCH#setFirmwareVersion(49f6e7a06ebc5aa8).();
72 void setBootstrapUSBcxx . . $ PegasusUCH#setBootstrapUSB(49f6e7a06ebc5aa8).();
73 void updateUSBPowercxx . . $ PegasusUCH#updateUSBPower(49f6e7a06ebc5aa8).();
74 void updateUpTimecxx . . $ PegasusUCH#updateUpTime(49f6e7a06ebc5aa8).();
75
76 bool sendCommandcxx . . $ PegasusUCH#sendCommand(84e74a5521f49206).(const char *command, char *res);
77 void cleanupResponsecxx . . $ PegasusUCH#cleanupResponse(fda57c8427c60377).(char *response);
78 stdcxx . . $ std/::vectorcxx . . $ std/vector#<stdcxx . . $ std/::stringcxx . . $ std/string#> splitcxx . . $ PegasusUCH#split(c47e161d59f8b6e7).(const stdcxx . . $ std/::stringcxx . . $ std/string# &input, const stdcxx . . $ std/::stringcxx . . $ std/string# &regex);
79
80
81 int PortFDcxx . . $ PegasusUCH#PortFD. { -1 };
82 bool initializedcxx . . $ PegasusUCH#initialized. { false };
83
84 Connectioncxx . . $ Connection/::Serialcxx . . $ Connection/Serial# *serialConnectioncxx . . $ PegasusUCH#serialConnection. { nullptr };
85
86 ////////////////////////////////////////////////////////////////////////////////////
87 /// Main Control
88 ////////////////////////////////////////////////////////////////////////////////////
89
90 /// Reboot Device
91 ISwitchcxx . . $ ISwitch# RebootScxx . . $ PegasusUCH#RebootS.[1];
92 ISwitchVectorPropertycxx . . $ ISwitchVectorProperty# RebootSPcxx . . $ PegasusUCH#RebootSP.;
93
94
95 // Power LED
96 ISwitchcxx . . $ ISwitch# PowerLEDScxx . . $ PegasusUCH#PowerLEDS.[2];
97 ISwitchVectorPropertycxx . . $ ISwitchVectorProperty# PowerLEDSPcxx . . $ PegasusUCH#PowerLEDSP.;
98 enumcxx . . $ PegasusUCH#$anonymous_type_0#
99 {
100 POWER_LED_ONcxx . . $ PegasusUCH#POWER_LED_ON.,
101 POWER_LED_OFFcxx . . $ PegasusUCH#POWER_LED_OFF.,
102 };
103
104
105 // USB
106 enumcxx . . $ PegasusUCH#$anonymous_type_1# { USB_OFFcxx . . $ PegasusUCH#USB_OFF., USB_ONcxx . . $ PegasusUCH#USB_ON. };
107
108
109 stdcxx . . $ std/::mapcxx . . $ std/map#<int, SwitchMapcxx . . $ SwitchMap#> usbPortcxx . . $ PegasusUCH#usbPort. =cxx . . $ std/map#map(7786ef3e167e36fa).
110 {
111 { 0, { .S = USBPort1Scxx . . $ PegasusUCH#USBPort1S., .SP = &USBPort1SPcxx . . $ PegasusUCH#USBPort1SP. } },
112 { 1, { .S = USBPort2Scxx . . $ PegasusUCH#USBPort2S., .SP = &USBPort2SPcxx . . $ PegasusUCH#USBPort2SP. } },
113 { 2, { .S = USBPort3Scxx . . $ PegasusUCH#USBPort3S., .SP = &USBPort3SPcxx . . $ PegasusUCH#USBPort3SP. } },
114 { 3, { .S = USBPort4Scxx . . $ PegasusUCH#USBPort4S., .SP = &USBPort4SPcxx . . $ PegasusUCH#USBPort4SP. } },
115 { 4, { .S = USBPort5Scxx . . $ PegasusUCH#USBPort5S., .SP = &USBPort5SPcxx . . $ PegasusUCH#USBPort5SP. } },
116 { 5, { .S = USBPort6Scxx . . $ PegasusUCH#USBPort6S., .SP = &USBPort6SPcxx . . $ PegasusUCH#USBPort6SP. } }
117 };
118
119
120
121 ISwitchcxx . . $ ISwitch# USBPort1Scxx . . $ PegasusUCH#USBPort1S.[2];
122 ISwitchVectorPropertycxx . . $ ISwitchVectorProperty# USBPort1SPcxx . . $ PegasusUCH#USBPort1SP.;
123
124 ISwitchcxx . . $ ISwitch# USBPort2Scxx . . $ PegasusUCH#USBPort2S.[2];
125 ISwitchVectorPropertycxx . . $ ISwitchVectorProperty# USBPort2SPcxx . . $ PegasusUCH#USBPort2SP.;
126
127 ISwitchcxx . . $ ISwitch# USBPort3Scxx . . $ PegasusUCH#USBPort3S.[2];
128 ISwitchVectorPropertycxx . . $ ISwitchVectorProperty# USBPort3SPcxx . . $ PegasusUCH#USBPort3SP.;
129
130 ISwitchcxx . . $ ISwitch# USBPort4Scxx . . $ PegasusUCH#USBPort4S.[2];
131 ISwitchVectorPropertycxx . . $ ISwitchVectorProperty# USBPort4SPcxx . . $ PegasusUCH#USBPort4SP.;
132
133 ISwitchcxx . . $ ISwitch# USBPort5Scxx . . $ PegasusUCH#USBPort5S.[2];
134 ISwitchVectorPropertycxx . . $ ISwitchVectorProperty# USBPort5SPcxx . . $ PegasusUCH#USBPort5SP.;
135
136 ISwitchcxx . . $ ISwitch# USBPort6Scxx . . $ PegasusUCH#USBPort6S.[2];
137 ISwitchVectorPropertycxx . . $ ISwitchVectorProperty# USBPort6SPcxx . . $ PegasusUCH#USBPort6SP.;
138
139
140
141 //Firmware
142 ITextVectorPropertycxx . . $ ITextVectorProperty# InfoTPcxx . . $ PegasusUCH#InfoTP.;
143 ITextcxx . . $ IText# InfoTcxx . . $ PegasusUCH#InfoT.[3] {};
144
145
146 enumcxx . . $ PegasusUCH#$anonymous_type_2#
147 {
148 INFO_VERSIONcxx . . $ PegasusUCH#INFO_VERSION.,
149 INFO_UPTIMEcxx . . $ PegasusUCH#INFO_UPTIME.,
150 INFO_USBVOLTAGEcxx . . $ PegasusUCH#INFO_USBVOLTAGE.
151
152 };
153
154
155 static constexpr const uint8_tcxx . . $ uint8_t# PEGASUS_TIMEOUTcxx . . $ PegasusUCH#PEGASUS_TIMEOUT. {3};
156 static constexpr const uint8_tcxx . . $ uint8_t# PEGASUS_LENcxx . . $ PegasusUCH#PEGASUS_LEN. {32};
157 static constexpr const char *USB_TABcxx . . $ PegasusUCH#USB_TAB. {"USB"};
158 static constexpr const char *INFO_TABcxx . . $ PegasusUCH#INFO_TAB. {"INFO"};
159 };