-
Notifications
You must be signed in to change notification settings - Fork 62
Feature: supports dynamic interface switching #143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
hideakitai
merged 10 commits into
main
from
feature/supports-dynamic-interface-switching
Oct 16, 2025
+449
−39
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
0ed5b00
refactor: remove redundant ARTNET_ENABLE_ETHER/WIFI
hideakitai da2f9fa
feat: add examples for multiple interfaces in one sketch
hideakitai 75dbf21
refactor: remove function templates from receiver methods
hideakitai 7286fc6
fix: examples to use dynamic dispatch
hideakitai 53f662a
feat: introduce interface classes for Sender, Receiver, and Manager
hideakitai 63a36db
fix: do not use interface for avr boards (low memory)
hideakitai 37a524e
chore: requires ArxTypeTraits >= 0.3.2
hideakitai 540178c
ci: add build test for multiple interface examples
hideakitai d7d6d3c
docs: update README
hideakitai 970c03e
chore: bump version v0.9.0
hideakitai File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,32 +1,28 @@ | ||
| #pragma once | ||
| #ifndef ARTNET_MANAGER_H | ||
| #define ARTNET_MANAGER_H | ||
|
|
||
| #include "Common.h" | ||
| #include "Receiver.h" | ||
| #include "Sender.h" | ||
| #include "ManagerTraits.h" | ||
|
|
||
| namespace art_net { | ||
|
|
||
| template <typename S> | ||
| class Manager : public Sender_<S>, public Receiver_<S> | ||
| class Manager : public IManager, public Sender_<S>, public Receiver_<S> | ||
| { | ||
| S stream; | ||
|
|
||
| public: | ||
| void begin(uint16_t recv_port = DEFAULT_PORT) | ||
| void begin(uint16_t port = DEFAULT_PORT) override | ||
| { | ||
| this->stream.begin(recv_port); | ||
| this->stream.begin(port); | ||
| this->Sender_<S>::attach(this->stream); | ||
| this->Receiver_<S>::attach(this->stream); | ||
| } | ||
|
|
||
| void parse() | ||
| { | ||
| this->Receiver_<S>::parse(); | ||
| } | ||
| }; | ||
|
|
||
|
|
||
| } // namespace art_net | ||
|
|
||
| #endif // ARTNET_MANAGER_H |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| #pragma once | ||
| #ifndef ARTNET_MANAGER_TRAITS_H | ||
| #define ARTNET_MANAGER_TRAITS_H | ||
|
|
||
| #include "ReceiverTraits.h" | ||
| #include "SenderTraits.h" | ||
|
|
||
| namespace art_net { | ||
|
|
||
| struct IManager : virtual ISender_, virtual IReceiver_ | ||
| { | ||
| virtual ~IManager() = default; | ||
| virtual void begin(uint16_t port = DEFAULT_PORT) = 0; | ||
| }; | ||
|
|
||
| } // namespace art_net | ||
|
|
||
| using ArtnetInterface = art_net::IManager; | ||
|
|
||
| #endif // ARTNET_MANAGER_TRAITS_H |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| #pragma once | ||
| #ifndef ARTNET_SENDER_TRAITS_H | ||
| #define ARTNET_SENDER_TRAITS_H | ||
|
|
||
| namespace art_net { | ||
|
|
||
| struct ISender_ | ||
| { | ||
| virtual ~ISender_() = default; | ||
|
|
||
| // streaming artdmx packet | ||
| virtual void setArtDmxData(const uint8_t* const data, uint16_t size) = 0; | ||
| virtual void setArtDmxData(uint16_t ch, uint8_t data) = 0; | ||
|
|
||
| virtual void streamArtDmxTo(const String& ip, uint16_t universe15bit) = 0; | ||
| virtual void streamArtDmxTo(const String& ip, uint8_t net, uint8_t subnet, uint8_t universe) = 0; | ||
| virtual void streamArtDmxTo(const String& ip, uint8_t net, uint8_t subnet, uint8_t universe, uint8_t physical) = 0; | ||
|
|
||
| // streaming artnzs packet | ||
| virtual void setArtNzsData(const uint8_t* const data, uint16_t size) = 0; | ||
| virtual void setArtNzsData(uint16_t ch, uint8_t data) = 0; | ||
|
|
||
| virtual void streamArtNzsTo(const String& ip, uint16_t universe15bit) = 0; | ||
| virtual void streamArtNzsTo(const String& ip, uint8_t net, uint8_t subnet, uint8_t universe) = 0; | ||
| virtual void streamArtNzsTo(const String& ip, uint8_t net, uint8_t subnet, uint8_t universe, uint8_t start_code) = 0; | ||
|
|
||
| // one-line artdmx sender | ||
| virtual void sendArtDmx(const String& ip, uint16_t universe15bit, const uint8_t* const data, uint16_t size) = 0; | ||
| virtual void sendArtDmx(const String& ip, uint8_t net, uint8_t subnet, uint8_t universe, const uint8_t* const data, uint16_t size) = 0; | ||
| virtual void sendArtDmx(const String& ip, uint8_t net, uint8_t subnet, uint8_t universe, uint8_t physical, const uint8_t *data, uint16_t size) = 0; | ||
|
|
||
| // one-line artnzs sender | ||
| virtual void sendArtNzs(const String& ip, uint16_t universe15bit, const uint8_t* const data, uint16_t size) = 0; | ||
| virtual void sendArtNzs(const String& ip, uint8_t net, uint8_t subnet, uint8_t universe, const uint8_t* const data, uint16_t size) = 0; | ||
| virtual void sendArtNzs(const String& ip, uint8_t net, uint8_t subnet, uint8_t universe, uint8_t start_code, const uint8_t *data, uint16_t size) = 0; | ||
|
|
||
| virtual void sendArtTrigger(const String& ip, uint16_t oem = 0, uint8_t key = 0, uint8_t subkey = 0, const uint8_t *payload = nullptr, uint16_t size = 512) = 0; | ||
|
|
||
| virtual void sendArtSync(const String& ip) = 0; | ||
| }; | ||
|
|
||
| struct ISender : virtual ISender_ | ||
| { | ||
| virtual ~ISender() = default; | ||
| virtual void begin(uint16_t send_port = DEFAULT_PORT) = 0; | ||
hideakitai marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }; | ||
|
|
||
| } // namespace art_net | ||
|
|
||
| using ArtnetSenderInterface = art_net::ISender; | ||
|
|
||
| #endif // ARTNET_SENDER_TRAITS_H | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.