-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[knx] New modifier to set mainGA write-only #16042
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -28,15 +28,15 @@ | |
| /** | ||
| * Data structure representing the content of a channel's group address configuration. | ||
| * | ||
| * @author Simon Kaufmann - initial contribution and API. | ||
| * @author Simon Kaufmann - Initial contribution and API | ||
| * | ||
| */ | ||
| @NonNullByDefault | ||
| public class GroupAddressConfiguration { | ||
| public static final Logger LOGGER = LoggerFactory.getLogger(GroupAddressConfiguration.class); | ||
|
|
||
| private static final Pattern PATTERN_GA_CONFIGURATION = Pattern.compile( | ||
| "^((?<dpt>[1-9][0-9]{0,2}\\.[0-9]{3,5}):)?(?<read><)?(?<mainGA>[0-9]{1,5}(/[0-9]{1,4}){0,2})(?<listenGAs>(\\+(<?[0-9]{1,5}(/[0-9]{1,4}){0,2}))*)$"); | ||
| "^((?<dpt>[1-9][0-9]{0,2}\\.[0-9]{3,5}):)?(?<modifier>[<>])?(?<mainGA>[0-9]{1,5}(/[0-9]{1,4}){0,2})(?<listenGAs>(\\+(<?[0-9]{1,5}(/[0-9]{1,4}){0,2}))*)$"); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This matches either
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is intended. I can't imagine a use case where I want to read at startup but ignore the response at the same time. |
||
| private static final Pattern PATTERN_LISTEN_GA = Pattern | ||
| .compile("\\+((?<read><)?(?<GA>[0-9]{1,5}(/[0-9]{1,4}){0,2}))"); | ||
|
|
||
|
|
@@ -57,14 +57,28 @@ private GroupAddressConfiguration(@Nullable String dpt, GroupAddress mainGA, Set | |
| return dpt; | ||
| } | ||
|
|
||
| /** | ||
| * Returns the main GA, which is the GA to send commands to. | ||
| */ | ||
| public GroupAddress getMainGA() { | ||
| return mainGA; | ||
| } | ||
|
|
||
| /** | ||
| * Returns all GAs to listen to. | ||
| * This includes the main GA (unless disabled by '>'), and additional listening GAs | ||
| * (those after the "+" symbol). | ||
| */ | ||
| public Set<GroupAddress> getListenGAs() { | ||
| return listenGAs; | ||
| } | ||
|
|
||
| /** | ||
| * Returns all GAs to read from. | ||
| * Those GAs accept read requests to the KNX bus, i.e. they respond to a "GroupValueRead" with a | ||
| * "GroupValueResponse". | ||
| * The '<' sign sets a GA as read GA. | ||
florian-h05 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| */ | ||
| public Set<GroupAddress> getReadGAs() { | ||
| return readGAs; | ||
| } | ||
|
|
@@ -99,9 +113,20 @@ public Set<GroupAddress> getReadGAs() { | |
| String mainGA = matcher.group("mainGA"); | ||
| try { | ||
| GroupAddress groupAddress = new GroupAddress(mainGA); | ||
| listenGAs.add(groupAddress); // also listening to main GA | ||
| if (matcher.group("read") != null) { | ||
| readGAs.add(groupAddress); // also reading main GA | ||
| @Nullable | ||
| String modifier = matcher.group("modifier"); | ||
| if (modifier == null) { | ||
| // default: main GA address writes and listens | ||
| listenGAs.add(groupAddress); | ||
| } else if ("<".equals(modifier)) { | ||
| // configured for read at startup | ||
| listenGAs.add(groupAddress); | ||
| readGAs.add(groupAddress); | ||
| } // else (">").equals(modifier) -> write only, no action | ||
| if (readGAs.size() > 1) { | ||
| LOGGER.info( | ||
| "Item with mainGA {} has more than one GA configured for read at startup, check configuration", | ||
| groupAddress); | ||
| } | ||
| return new GroupAddressConfiguration(matcher.group("dpt"), groupAddress, listenGAs, readGAs); | ||
| } catch (KNXFormatException e) { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.