-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgpioconnection.h
84 lines (72 loc) · 2.66 KB
/
gpioconnection.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#pragma once
// ============================================================================
// INCLUDES
// ============================================================================
#include "libindi/connectionplugins/connectioninterface.h"
#include "libindi/defaultdevice.h"
#include <string>
// ============================================================================
// GPIOConnection Class
// ============================================================================
/**
* @brief The GPIOConnection class provides a custom connection interface that
* bypasses the default connection management and driver loop in INDI.
*
* This class implements stub functions for Connect/Disconnect and related
* callbacks, essentially allowing the driver to use a custom connection type
* without overriding the entire INDI connection lifecycle.
*/
class GPIOConnection : public Connection::Interface
{
public:
/**
* @brief Constructs a new GPIOConnection object.
*
* @param dev Pointer to the INDI::DefaultDevice associated with this connection.
*/
explicit GPIOConnection(INDI::DefaultDevice *dev)
: Connection::Interface(dev, CONNECTION_CUSTOM)
{
}
// ------------------------------------------------------------------------
// Connection Management Overrides
// ------------------------------------------------------------------------
/**
* @brief Connect stub; always returns true.
*
* @return true indicating successful connection.
*/
bool Connect() override { return true; }
/**
* @brief Disconnect stub; always returns true.
*
* @return true indicating successful disconnection.
*/
bool Disconnect() override { return true; }
// ------------------------------------------------------------------------
// Activation Callbacks
// ------------------------------------------------------------------------
/**
* @brief Called when the connection is activated.
*/
void Activated() override {}
/**
* @brief Called when the connection is deactivated.
*/
void Deactivated() override {}
// ------------------------------------------------------------------------
// Identification
// ------------------------------------------------------------------------
/**
* @brief Returns the name of the connection.
*
* @return A string identifying the connection type.
*/
std::string name() override { return "CONNECTION_GPIO"; }
/**
* @brief Returns the label of the connection.
*
* @return A string representing the connection label.
*/
std::string label() override { return "GPIO"; }
};