Public Access
Add explicit protocol creator function declarations to protocol_factory.h
Make protocol dependencies explicit by declaring the built-in protocol creator functions in the header. This provides better type safety and clearer dependency tracking for the factory initialization.
This commit is contained in:
1 parent
6d84a83236
commit
c69b2e0754
1 file changed
+8
-2
@@ -13,6 +13,12 @@ namespace ups_hid {
|
|||||||
class UpsProtocolBase;
|
class UpsProtocolBase;
|
||||||
class UpsHidComponent;
|
class UpsHidComponent;
|
||||||
|
|
||||||
|
// Forward declarations for built-in protocol creator functions
|
||||||
|
std::unique_ptr<UpsProtocolBase> create_apc_protocol(UpsHidComponent* parent);
|
||||||
|
std::unique_ptr<UpsProtocolBase> create_cyberpower_protocol(UpsHidComponent* parent);
|
||||||
|
std::unique_ptr<UpsProtocolBase> create_goldenmate_protocol(UpsHidComponent* parent);
|
||||||
|
std::unique_ptr<UpsProtocolBase> create_generic_protocol(UpsHidComponent* parent);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Protocol Factory with Self-Registration Support
|
* Protocol Factory with Self-Registration Support
|
||||||
*
|
*
|
||||||
@@ -82,7 +88,7 @@ private:
|
|||||||
// Fallback protocol registry (sorted by priority)
|
// Fallback protocol registry (sorted by priority)
|
||||||
static std::vector<ProtocolInfo>& get_fallback_registry();
|
static std::vector<ProtocolInfo>& get_fallback_registry();
|
||||||
|
|
||||||
// Ensure registries are initialized
|
// Ensure registries are initialized with built-in protocols
|
||||||
static void ensure_initialized();
|
static void ensure_initialized();
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -130,4 +136,4 @@ class ProtocolFactory;
|
|||||||
}
|
}
|
||||||
|
|
||||||
} // namespace ups_hid
|
} // namespace ups_hid
|
||||||
} // namespace esphome
|
} // namespace esphome
|
||||||
Reference in new issue
Block a user