68 bool ISNewSwitch(
const char *dev,
const char *name,
ISState *states,
char *names[],
int n)
override;
69 bool ISNewNumber(
const char *dev,
const char *name,
double values[],
char *names[],
int n)
override;
70 bool ISNewText(
const char *dev,
const char *name,
char *texts[],
char *names[],
int n)
override;
77 bool SetDewPort(
size_t port,
bool enabled,
double dutyCycle)
override;
78 bool SetUSBPort(
size_t port,
bool enabled)
override;
83 void checkTelemetryFreshnessForTesting(std::chrono::steady_clock::time_point now);
84 bool communicationFailureForTesting()
const;
85 IPState powerSensorsStateForTesting()
const;
86 IPState environmentStateForTesting()
const;
87 IPState powerChannelsStateForTesting()
const;
88 IPState dewModeStateForTesting(
size_t index)
const;
90 std::chrono::steady_clock::time_point deadline);
93 void syncInstrumentationLevelForTesting();
94 void setDebugForTesting(
bool enable);
95 void setSerialPortForTesting(
const std::string &port);
96 std::string serialPortForTesting()
const;
97 void setAutoSearchForTesting(
bool enabled);
99 bool detectedPortSaveRequestedForTesting()
const;
103 enum class DriverState
108 CommunicationFailure,
112 void initializePowerInterfaceProperties();
113 void initializeCustomProperties();
114 void defineConnectedProperties();
115 void deleteConnectedProperties();
116 void refreshLabelsFromTextProperties();
117 bool finishSuccessfulConnection(
bool detectedPort);
119 bool autoSearchEnabled()
const;
120 bool updateSerialPortSelection(
const std::string &port);
121 bool discoveryCancellationRequested()
const;
129 char *names[],
int n);
130 bool handleDewDutyCycleChange(
double values[],
char *names[],
int n);
132 void registerDeviceCallbacks();
133 void removeDeviceCallbacks();
137 void syncInstrumentationLevelWithIndiDebug();
138 void flushConnectionEvents();
140 void flushTelemetryToINDI();
141 void refreshPropertiesFromDevice();
142 void checkTelemetryFreshness();
143 void checkTelemetryFreshness(std::chrono::steady_clock::time_point now);
144 void checkPendingOperations();
146 void attemptReconnectIfDue();
147 void markCommunicationFailure(
const std::string &reason);
148 void markHardwareProperties(
IPState state);
149 void failPendingOperations(
IPState state);
150 void scheduleNextTimer();
152 bool requestDcOutputChange(
size_t port,
bool enabled);
153 bool requestUsbOutputChange(
size_t port,
bool enabled);
154 bool requestHeaterEnabledChange(
size_t port,
bool enabled);
156 bool requestHeaterManualPowerChange(
size_t port,
double percent);
161 void applyPendingAwareLiveStates();
172 std::unique_ptr<geminipbh::Device> device_;
176 std::unique_ptr<Connection::Serial> serialConnection_;
179 std::optional<bool> autoSearchOverrideForTesting_;
181 bool detectedPortSaveRequestedForTesting_ =
false;
185 std::atomic<bool> protocolInstrumentationForwarding_{
false};
186 bool haveTelemetry_ =
false;
187 std::atomic<bool> shutdownInProgress_{
false};
189 DriverState driverState_ = DriverState::Disconnected;
190 bool userDisconnectRequested_ =
true;
191 bool connectedPropertiesDefined_ =
false;
193 std::array<unsigned, 2> preservedManualPower_{{0, 0}};
194 std::vector<geminipbh::indi_driver::PendingOperation> pendingOperations_;
195 std::chrono::steady_clock::time_point lastReconnectAttempt_{};
196 std::chrono::steady_clock::time_point lastTelemetryTime_{};