From c114714a7b21b0eeef60f75a3377ec2bc2310624 Mon Sep 17 00:00:00 2001 From: Jacob Laursen Date: Fri, 4 Nov 2022 18:24:39 +0100 Subject: [PATCH] [hdpowerview] Restructure DTO classes (#13630) * Extract nested DTO's to separate classes * Rename api to dto * Move test classes into internal * Finish moving of files and fix namespaces Signed-off-by: Jacob Laursen --- .../internal/HDPowerViewWebTargets.java | 52 +++---- .../api/responses/SceneCollections.java | 84 ----------- .../internal/api/responses/Scenes.java | 86 ------------ .../api/responses/ScheduledEvents.java | 132 ------------------ .../internal/api/responses/Shades.java | 70 ---------- .../builders/AutomationChannelBuilder.java | 17 ++- .../builders/SceneChannelBuilder.java | 2 +- .../builders/SceneGroupChannelBuilder.java | 2 +- .../console/HDPowerViewCommandExtension.java | 4 +- .../HDPowerViewDeviceDiscoveryService.java | 6 +- .../internal/{api => dto}/BatteryKind.java | 2 +- .../internal/{api => dto}/Color.java | 2 +- .../{api => dto}/CoordinateSystem.java | 2 +- .../internal/{api => dto}/Firmware.java | 2 +- .../internal/{api => dto}/HubFirmware.java | 2 +- .../hdpowerview/internal/dto/Scene.java | 73 ++++++++++ .../internal/dto/SceneCollection.java | 71 ++++++++++ .../internal/dto/ScheduledEvent.java | 117 ++++++++++++++++ .../hdpowerview/internal/dto/ShadeData.java | 52 +++++++ .../internal/{api => dto}/ShadePosition.java | 4 +- .../internal/{api => dto}/SurveyData.java | 2 +- .../internal/{api => dto}/Times.java | 2 +- .../internal/{api => dto}/UserData.java | 2 +- .../requests/RepeaterBlinking.java | 2 +- .../{api => dto}/requests/RepeaterColor.java | 4 +- .../{api => dto}/requests/ShadeCalibrate.java | 2 +- .../{api => dto}/requests/ShadeJog.java | 2 +- .../{api => dto}/requests/ShadeMotion.java | 2 +- .../{api => dto}/requests/ShadeMove.java | 4 +- .../{api => dto}/requests/ShadePositions.java | 4 +- .../{api => dto}/requests/ShadeStop.java | 2 +- .../responses/FirmwareVersion.java | 4 +- .../{api => dto}/responses/Repeater.java | 2 +- .../{api => dto}/responses/RepeaterData.java | 6 +- .../{api => dto}/responses/Repeaters.java | 2 +- .../dto/responses/SceneCollections.java | 30 ++++ .../internal/dto/responses/Scenes.java | 30 ++++ .../dto/responses/ScheduledEvents.java | 30 ++++ .../{api => dto}/responses/Shade.java | 5 +- .../internal/dto/responses/Shades.java | 30 ++++ .../{api => dto}/responses/Survey.java | 4 +- .../responses/UserDataResponse.java | 4 +- .../handler/HDPowerViewHubHandler.java | 22 +-- .../handler/HDPowerViewRepeaterHandler.java | 6 +- .../handler/HDPowerViewShadeHandler.java | 14 +- .../AutomationChannelBuilderTest.java | 41 +++--- .../{ => internal}/HDPowerViewJUnitTests.java | 20 +-- .../OnlineCommunicationTest.java | 15 +- .../SceneChannelBuilderTest.java | 10 +- .../SceneGroupChannelBuilderTest.java | 10 +- .../{ => internal}/ShadePositionTest.java | 6 +- .../providers/MockedLocaleProvider.java | 2 +- .../providers/MockedTranslationProvider.java | 2 +- .../hdpowerview/{ => internal}/duette.json | 0 .../{ => internal}/sceneCollections.json | 0 .../hdpowerview/{ => internal}/scenes.json | 0 .../hdpowerview/{ => internal}/shades.json | 0 57 files changed, 578 insertions(+), 527 deletions(-) delete mode 100644 bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/api/responses/SceneCollections.java delete mode 100644 bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/api/responses/Scenes.java delete mode 100644 bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/api/responses/ScheduledEvents.java delete mode 100644 bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/api/responses/Shades.java rename bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/{api => dto}/BatteryKind.java (96%) rename bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/{api => dto}/Color.java (96%) rename bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/{api => dto}/CoordinateSystem.java (98%) rename bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/{api => dto}/Firmware.java (94%) rename bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/{api => dto}/HubFirmware.java (93%) create mode 100644 bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/Scene.java create mode 100644 bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/SceneCollection.java create mode 100644 bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/ScheduledEvent.java create mode 100644 bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/ShadeData.java rename bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/{api => dto}/ShadePosition.java (99%) rename bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/{api => dto}/SurveyData.java (94%) rename bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/{api => dto}/Times.java (94%) rename bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/{api => dto}/UserData.java (96%) rename bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/{api => dto}/requests/RepeaterBlinking.java (93%) rename bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/{api => dto}/requests/RepeaterColor.java (88%) rename bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/{api => dto}/requests/ShadeCalibrate.java (91%) rename bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/{api => dto}/requests/ShadeJog.java (91%) rename bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/{api => dto}/requests/ShadeMotion.java (93%) rename bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/{api => dto}/requests/ShadeMove.java (85%) rename bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/{api => dto}/requests/ShadePositions.java (84%) rename bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/{api => dto}/requests/ShadeStop.java (91%) rename bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/{api => dto}/responses/FirmwareVersion.java (84%) rename bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/{api => dto}/responses/Repeater.java (91%) rename bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/{api => dto}/responses/RepeaterData.java (84%) rename bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/{api => dto}/responses/Repeaters.java (92%) create mode 100644 bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/responses/SceneCollections.java create mode 100644 bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/responses/Scenes.java create mode 100644 bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/responses/ScheduledEvents.java rename bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/{api => dto}/responses/Shade.java (82%) create mode 100644 bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/responses/Shades.java rename bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/{api => dto}/responses/Survey.java (87%) rename bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/{api => dto}/responses/UserDataResponse.java (84%) rename bundles/org.openhab.binding.hdpowerview/src/test/java/org/openhab/binding/hdpowerview/{ => internal}/AutomationChannelBuilderTest.java (88%) rename bundles/org.openhab.binding.hdpowerview/src/test/java/org/openhab/binding/hdpowerview/{ => internal}/HDPowerViewJUnitTests.java (91%) rename bundles/org.openhab.binding.hdpowerview/src/test/java/org/openhab/binding/hdpowerview/{ => internal}/OnlineCommunicationTest.java (93%) rename bundles/org.openhab.binding.hdpowerview/src/test/java/org/openhab/binding/hdpowerview/{ => internal}/SceneChannelBuilderTest.java (90%) rename bundles/org.openhab.binding.hdpowerview/src/test/java/org/openhab/binding/hdpowerview/{ => internal}/SceneGroupChannelBuilderTest.java (90%) rename bundles/org.openhab.binding.hdpowerview/src/test/java/org/openhab/binding/hdpowerview/{ => internal}/ShadePositionTest.java (99%) rename bundles/org.openhab.binding.hdpowerview/src/test/java/org/openhab/binding/hdpowerview/{ => internal}/providers/MockedLocaleProvider.java (92%) rename bundles/org.openhab.binding.hdpowerview/src/test/java/org/openhab/binding/hdpowerview/{ => internal}/providers/MockedTranslationProvider.java (97%) rename bundles/org.openhab.binding.hdpowerview/src/test/resources/org/openhab/binding/hdpowerview/{ => internal}/duette.json (100%) rename bundles/org.openhab.binding.hdpowerview/src/test/resources/org/openhab/binding/hdpowerview/{ => internal}/sceneCollections.json (100%) rename bundles/org.openhab.binding.hdpowerview/src/test/resources/org/openhab/binding/hdpowerview/{ => internal}/scenes.json (100%) rename bundles/org.openhab.binding.hdpowerview/src/test/resources/org/openhab/binding/hdpowerview/{ => internal}/shades.json (100%) diff --git a/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/HDPowerViewWebTargets.java b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/HDPowerViewWebTargets.java index f8ba04c15..aa3525e7d 100644 --- a/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/HDPowerViewWebTargets.java +++ b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/HDPowerViewWebTargets.java @@ -27,32 +27,32 @@ import org.eclipse.jetty.client.util.StringContentProvider; import org.eclipse.jetty.http.HttpHeader; import org.eclipse.jetty.http.HttpMethod; import org.eclipse.jetty.http.HttpStatus; -import org.openhab.binding.hdpowerview.internal.api.Color; -import org.openhab.binding.hdpowerview.internal.api.HubFirmware; -import org.openhab.binding.hdpowerview.internal.api.ShadePosition; -import org.openhab.binding.hdpowerview.internal.api.SurveyData; -import org.openhab.binding.hdpowerview.internal.api.UserData; -import org.openhab.binding.hdpowerview.internal.api.requests.RepeaterBlinking; -import org.openhab.binding.hdpowerview.internal.api.requests.RepeaterColor; -import org.openhab.binding.hdpowerview.internal.api.requests.ShadeCalibrate; -import org.openhab.binding.hdpowerview.internal.api.requests.ShadeJog; -import org.openhab.binding.hdpowerview.internal.api.requests.ShadeMove; -import org.openhab.binding.hdpowerview.internal.api.requests.ShadeStop; -import org.openhab.binding.hdpowerview.internal.api.responses.FirmwareVersion; -import org.openhab.binding.hdpowerview.internal.api.responses.Repeater; -import org.openhab.binding.hdpowerview.internal.api.responses.RepeaterData; -import org.openhab.binding.hdpowerview.internal.api.responses.Repeaters; -import org.openhab.binding.hdpowerview.internal.api.responses.SceneCollections; -import org.openhab.binding.hdpowerview.internal.api.responses.SceneCollections.SceneCollection; -import org.openhab.binding.hdpowerview.internal.api.responses.Scenes; -import org.openhab.binding.hdpowerview.internal.api.responses.Scenes.Scene; -import org.openhab.binding.hdpowerview.internal.api.responses.ScheduledEvents; -import org.openhab.binding.hdpowerview.internal.api.responses.ScheduledEvents.ScheduledEvent; -import org.openhab.binding.hdpowerview.internal.api.responses.Shade; -import org.openhab.binding.hdpowerview.internal.api.responses.Shades; -import org.openhab.binding.hdpowerview.internal.api.responses.Shades.ShadeData; -import org.openhab.binding.hdpowerview.internal.api.responses.Survey; -import org.openhab.binding.hdpowerview.internal.api.responses.UserDataResponse; +import org.openhab.binding.hdpowerview.internal.dto.Color; +import org.openhab.binding.hdpowerview.internal.dto.HubFirmware; +import org.openhab.binding.hdpowerview.internal.dto.Scene; +import org.openhab.binding.hdpowerview.internal.dto.SceneCollection; +import org.openhab.binding.hdpowerview.internal.dto.ScheduledEvent; +import org.openhab.binding.hdpowerview.internal.dto.ShadeData; +import org.openhab.binding.hdpowerview.internal.dto.ShadePosition; +import org.openhab.binding.hdpowerview.internal.dto.SurveyData; +import org.openhab.binding.hdpowerview.internal.dto.UserData; +import org.openhab.binding.hdpowerview.internal.dto.requests.RepeaterBlinking; +import org.openhab.binding.hdpowerview.internal.dto.requests.RepeaterColor; +import org.openhab.binding.hdpowerview.internal.dto.requests.ShadeCalibrate; +import org.openhab.binding.hdpowerview.internal.dto.requests.ShadeJog; +import org.openhab.binding.hdpowerview.internal.dto.requests.ShadeMove; +import org.openhab.binding.hdpowerview.internal.dto.requests.ShadeStop; +import org.openhab.binding.hdpowerview.internal.dto.responses.FirmwareVersion; +import org.openhab.binding.hdpowerview.internal.dto.responses.Repeater; +import org.openhab.binding.hdpowerview.internal.dto.responses.RepeaterData; +import org.openhab.binding.hdpowerview.internal.dto.responses.Repeaters; +import org.openhab.binding.hdpowerview.internal.dto.responses.SceneCollections; +import org.openhab.binding.hdpowerview.internal.dto.responses.Scenes; +import org.openhab.binding.hdpowerview.internal.dto.responses.ScheduledEvents; +import org.openhab.binding.hdpowerview.internal.dto.responses.Shade; +import org.openhab.binding.hdpowerview.internal.dto.responses.Shades; +import org.openhab.binding.hdpowerview.internal.dto.responses.Survey; +import org.openhab.binding.hdpowerview.internal.dto.responses.UserDataResponse; import org.openhab.binding.hdpowerview.internal.exceptions.HubInvalidResponseException; import org.openhab.binding.hdpowerview.internal.exceptions.HubMaintenanceException; import org.openhab.binding.hdpowerview.internal.exceptions.HubProcessingException; diff --git a/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/api/responses/SceneCollections.java b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/api/responses/SceneCollections.java deleted file mode 100644 index bef9e94b9..000000000 --- a/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/api/responses/SceneCollections.java +++ /dev/null @@ -1,84 +0,0 @@ -/** - * Copyright (c) 2010-2022 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.binding.hdpowerview.internal.api.responses; - -import java.nio.charset.StandardCharsets; -import java.util.Base64; -import java.util.List; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.eclipse.jdt.annotation.Nullable; - -/** - * State of all Scene Collections in an HD PowerView hub - * - * @author Jacob Laursen - Initial contribution - */ -@NonNullByDefault -public class SceneCollections { - - public @Nullable List sceneCollectionData; - public @Nullable List sceneCollectionIds; - - /* - * the following SuppressWarnings annotation is because the Eclipse compiler - * does NOT expect a NonNullByDefault annotation on the inner class, since it is - * implicitly inherited from the outer class, whereas the Maven compiler always - * requires an explicit NonNullByDefault annotation on all classes - */ - @SuppressWarnings("null") - @NonNullByDefault - public static class SceneCollection implements Comparable { - public int id; - public @Nullable String name; - public int order; - public int colorId; - public int iconId; - - @Override - public boolean equals(@Nullable Object o) { - if (o == this) { - return true; - } - if (!(o instanceof SceneCollection)) { - return false; - } - SceneCollection other = (SceneCollection) o; - - return this.id == other.id && this.name.equals(other.name) && this.order == other.order - && this.colorId == other.colorId && this.iconId == other.iconId; - } - - @Override - public final int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + id; - result = prime * result + (name == null ? 0 : name.hashCode()); - result = prime * result + order; - result = prime * result + colorId; - result = prime * result + iconId; - - return result; - } - - @Override - public int compareTo(SceneCollection other) { - return Integer.compare(order, other.order); - } - - public String getName() { - return new String(Base64.getDecoder().decode(name), StandardCharsets.UTF_8); - } - } -} diff --git a/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/api/responses/Scenes.java b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/api/responses/Scenes.java deleted file mode 100644 index 5cb25a8aa..000000000 --- a/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/api/responses/Scenes.java +++ /dev/null @@ -1,86 +0,0 @@ -/** - * Copyright (c) 2010-2022 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.binding.hdpowerview.internal.api.responses; - -import java.nio.charset.StandardCharsets; -import java.util.Base64; -import java.util.List; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.eclipse.jdt.annotation.Nullable; - -/** - * State of all Scenes in an HD PowerView hub - * - * @author Andy Lintner - Initial contribution - */ -@NonNullByDefault -public class Scenes { - - public @Nullable List sceneData; - public @Nullable List sceneIds; - - /* - * the following SuppressWarnings annotation is because the Eclipse compiler - * does NOT expect a NonNullByDefault annotation on the inner class, since it is - * implicitly inherited from the outer class, whereas the Maven compiler always - * requires an explicit NonNullByDefault annotation on all classes - */ - @SuppressWarnings("null") - @NonNullByDefault - public static class Scene implements Comparable { - public int id; - public @Nullable String name; - public int roomId; - public int order; - public int colorId; - public int iconId; - - @Override - public boolean equals(@Nullable Object o) { - if (o == this) { - return true; - } - if (!(o instanceof Scene)) { - return false; - } - Scene other = (Scene) o; - - return this.id == other.id && this.name.equals(other.name) && this.roomId == other.roomId - && this.order == other.order && this.colorId == other.colorId && this.iconId == other.iconId; - } - - @Override - public final int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + id; - result = prime * result + (name == null ? 0 : name.hashCode()); - result = prime * result + roomId; - result = prime * result + order; - result = prime * result + colorId; - result = prime * result + iconId; - - return result; - } - - @Override - public int compareTo(Scene other) { - return Integer.compare(order, other.order); - } - - public String getName() { - return new String(Base64.getDecoder().decode(name), StandardCharsets.UTF_8); - } - } -} diff --git a/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/api/responses/ScheduledEvents.java b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/api/responses/ScheduledEvents.java deleted file mode 100644 index e7ae6ac1a..000000000 --- a/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/api/responses/ScheduledEvents.java +++ /dev/null @@ -1,132 +0,0 @@ -/** - * Copyright (c) 2010-2022 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.binding.hdpowerview.internal.api.responses; - -import java.time.DayOfWeek; -import java.util.EnumSet; -import java.util.List; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.eclipse.jdt.annotation.Nullable; - -/** - * State of all Scheduled Events in an HD PowerView hub - * - * @author Jacob Laursen - Initial contribution - */ -@NonNullByDefault -public class ScheduledEvents { - - public static final EnumSet WEEKDAYS = EnumSet.of(DayOfWeek.MONDAY, DayOfWeek.TUESDAY, - DayOfWeek.WEDNESDAY, DayOfWeek.THURSDAY, DayOfWeek.FRIDAY); - - public static final EnumSet WEEKENDS = EnumSet.of(DayOfWeek.SATURDAY, DayOfWeek.SUNDAY); - - public static final int SCHEDULED_EVENT_TYPE_TIME = 0; - public static final int SCHEDULED_EVENT_TYPE_SUNRISE = 1; - public static final int SCHEDULED_EVENT_TYPE_SUNSET = 2; - - public @Nullable List scheduledEventData; - public @Nullable List scheduledEventIds; - - /* - * the following SuppressWarnings annotation is because the Eclipse compiler - * does NOT expect a NonNullByDefault annotation on the inner class, since it is - * implicitly inherited from the outer class, whereas the Maven compiler always - * requires an explicit NonNullByDefault annotation on all classes - */ - @SuppressWarnings("null") - @NonNullByDefault - public static class ScheduledEvent { - public int id; - public boolean enabled; - public int sceneId; - public int sceneCollectionId; - public boolean daySunday; - public boolean dayMonday; - public boolean dayTuesday; - public boolean dayWednesday; - public boolean dayThursday; - public boolean dayFriday; - public boolean daySaturday; - public int eventType; - public int hour; - public int minute; - - @Override - public boolean equals(@Nullable Object o) { - if (o == this) { - return true; - } - if (!(o instanceof ScheduledEvent)) { - return false; - } - ScheduledEvent other = (ScheduledEvent) o; - - return this.id == other.id && this.enabled == other.enabled && this.sceneId == other.sceneId - && this.sceneCollectionId == other.sceneCollectionId && this.daySunday == other.daySunday - && this.dayMonday == other.dayMonday && this.dayTuesday == other.dayTuesday - && this.dayWednesday == other.dayWednesday && this.dayThursday == other.dayThursday - && this.dayFriday == other.dayFriday && this.daySaturday == other.daySaturday - && this.eventType == other.eventType && this.hour == other.hour && this.minute == other.minute; - } - - @Override - public final int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + id; - result = prime * result + (enabled ? 1 : 0); - result = prime * result + sceneId; - result = prime * result + sceneCollectionId; - result = prime * result + (daySunday ? 1 : 0); - result = prime * result + (dayMonday ? 1 : 0); - result = prime * result + (dayTuesday ? 1 : 0); - result = prime * result + (dayWednesday ? 1 : 0); - result = prime * result + (dayThursday ? 1 : 0); - result = prime * result + (dayFriday ? 1 : 0); - result = prime * result + (daySaturday ? 1 : 0); - result = prime * result + eventType; - result = prime * result + hour; - result = prime * result + minute; - - return result; - } - - public EnumSet getDays() { - EnumSet days = EnumSet.noneOf(DayOfWeek.class); - if (daySunday) { - days.add(DayOfWeek.SUNDAY); - } - if (dayMonday) { - days.add(DayOfWeek.MONDAY); - } - if (dayTuesday) { - days.add(DayOfWeek.TUESDAY); - } - if (dayWednesday) { - days.add(DayOfWeek.WEDNESDAY); - } - if (dayThursday) { - days.add(DayOfWeek.THURSDAY); - } - if (dayFriday) { - days.add(DayOfWeek.FRIDAY); - } - if (daySaturday) { - days.add(DayOfWeek.SATURDAY); - } - return days; - } - } -} diff --git a/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/api/responses/Shades.java b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/api/responses/Shades.java deleted file mode 100644 index 2746523b4..000000000 --- a/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/api/responses/Shades.java +++ /dev/null @@ -1,70 +0,0 @@ -/** - * Copyright (c) 2010-2022 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.binding.hdpowerview.internal.api.responses; - -import java.util.Base64; -import java.util.List; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.eclipse.jdt.annotation.Nullable; -import org.openhab.binding.hdpowerview.internal.api.BatteryKind; -import org.openhab.binding.hdpowerview.internal.api.Firmware; -import org.openhab.binding.hdpowerview.internal.api.ShadePosition; - -/** - * State of all Shades, as returned by an HD PowerView hub - * - * @author Andy Lintner - Initial contribution - */ -@NonNullByDefault -public class Shades { - - public @Nullable List shadeData; - public @Nullable List shadeIds; - - /* - * the following SuppressWarnings annotation is because the Eclipse compiler - * does NOT expect a NonNullByDefault annotation on the inner class, since it is - * implicitly inherited from the outer class, whereas the Maven compiler always - * requires an explicit NonNullByDefault annotation on all classes - */ - @SuppressWarnings("null") - @NonNullByDefault - public static class ShadeData { - public int id; - public @Nullable String name; - public int roomId; - public int groupId; - public int order; - public int type; - public double batteryStrength; - public int batteryStatus; - public boolean batteryIsLow; - public @Nullable ShadePosition positions; - public @Nullable Boolean timedOut; - public int signalStrength; - public @Nullable Integer capabilities; - public @Nullable Firmware firmware; - public @Nullable Firmware motor; - // note: in old JSON batteryKind was a string but now it's a number; fortunately GSON string accepts either - public @Nullable String batteryKind; - - public String getName() { - return new String(Base64.getDecoder().decode(name)); - } - - public BatteryKind getBatteryKind() { - return BatteryKind.fromString(batteryKind); - } - } -} diff --git a/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/builders/AutomationChannelBuilder.java b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/builders/AutomationChannelBuilder.java index 10782b22b..214734694 100644 --- a/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/builders/AutomationChannelBuilder.java +++ b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/builders/AutomationChannelBuilder.java @@ -25,10 +25,9 @@ import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; import org.openhab.binding.hdpowerview.internal.HDPowerViewBindingConstants; import org.openhab.binding.hdpowerview.internal.HDPowerViewTranslationProvider; -import org.openhab.binding.hdpowerview.internal.api.responses.SceneCollections.SceneCollection; -import org.openhab.binding.hdpowerview.internal.api.responses.Scenes.Scene; -import org.openhab.binding.hdpowerview.internal.api.responses.ScheduledEvents; -import org.openhab.binding.hdpowerview.internal.api.responses.ScheduledEvents.ScheduledEvent; +import org.openhab.binding.hdpowerview.internal.dto.Scene; +import org.openhab.binding.hdpowerview.internal.dto.SceneCollection; +import org.openhab.binding.hdpowerview.internal.dto.ScheduledEvent; import org.openhab.core.library.CoreItemFactory; import org.openhab.core.thing.Channel; import org.openhab.core.thing.ChannelGroupUID; @@ -193,10 +192,10 @@ public class AutomationChannelBuilder extends BaseChannelBuilder { String timeString, daysString; switch (scheduledEvent.eventType) { - case ScheduledEvents.SCHEDULED_EVENT_TYPE_TIME: + case ScheduledEvent.SCHEDULED_EVENT_TYPE_TIME: timeString = LocalTime.of(scheduledEvent.hour, scheduledEvent.minute).toString(); break; - case ScheduledEvents.SCHEDULED_EVENT_TYPE_SUNRISE: + case ScheduledEvent.SCHEDULED_EVENT_TYPE_SUNRISE: if (scheduledEvent.minute == 0) { timeString = translationProvider.getText("dynamic-channel.automation.at-sunrise"); } else if (scheduledEvent.minute < 0) { @@ -207,7 +206,7 @@ public class AutomationChannelBuilder extends BaseChannelBuilder { getFormattedTimeOffset(scheduledEvent.minute)); } break; - case ScheduledEvents.SCHEDULED_EVENT_TYPE_SUNSET: + case ScheduledEvent.SCHEDULED_EVENT_TYPE_SUNSET: if (scheduledEvent.minute == 0) { timeString = translationProvider.getText("dynamic-channel.automation.at-sunset"); } else if (scheduledEvent.minute < 0) { @@ -225,9 +224,9 @@ public class AutomationChannelBuilder extends BaseChannelBuilder { EnumSet days = scheduledEvent.getDays(); if (EnumSet.allOf(DayOfWeek.class).equals(days)) { daysString = translationProvider.getText("dynamic-channel.automation.all-days"); - } else if (ScheduledEvents.WEEKDAYS.equals(days)) { + } else if (ScheduledEvent.WEEKDAYS.equals(days)) { daysString = translationProvider.getText("dynamic-channel.automation.weekdays"); - } else if (ScheduledEvents.WEEKENDS.equals(days)) { + } else if (ScheduledEvent.WEEKENDS.equals(days)) { daysString = translationProvider.getText("dynamic-channel.automation.weekends"); } else { StringJoiner joiner = new StringJoiner(", "); diff --git a/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/builders/SceneChannelBuilder.java b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/builders/SceneChannelBuilder.java index 01c05137e..213a60def 100644 --- a/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/builders/SceneChannelBuilder.java +++ b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/builders/SceneChannelBuilder.java @@ -18,7 +18,7 @@ import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; import org.openhab.binding.hdpowerview.internal.HDPowerViewBindingConstants; import org.openhab.binding.hdpowerview.internal.HDPowerViewTranslationProvider; -import org.openhab.binding.hdpowerview.internal.api.responses.Scenes.Scene; +import org.openhab.binding.hdpowerview.internal.dto.Scene; import org.openhab.core.library.CoreItemFactory; import org.openhab.core.thing.Channel; import org.openhab.core.thing.ChannelGroupUID; diff --git a/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/builders/SceneGroupChannelBuilder.java b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/builders/SceneGroupChannelBuilder.java index 4cc4436ea..d4dbd2cde 100644 --- a/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/builders/SceneGroupChannelBuilder.java +++ b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/builders/SceneGroupChannelBuilder.java @@ -18,7 +18,7 @@ import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; import org.openhab.binding.hdpowerview.internal.HDPowerViewBindingConstants; import org.openhab.binding.hdpowerview.internal.HDPowerViewTranslationProvider; -import org.openhab.binding.hdpowerview.internal.api.responses.SceneCollections.SceneCollection; +import org.openhab.binding.hdpowerview.internal.dto.SceneCollection; import org.openhab.core.library.CoreItemFactory; import org.openhab.core.thing.Channel; import org.openhab.core.thing.ChannelGroupUID; diff --git a/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/console/HDPowerViewCommandExtension.java b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/console/HDPowerViewCommandExtension.java index 4252f8d57..2e16968ba 100644 --- a/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/console/HDPowerViewCommandExtension.java +++ b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/console/HDPowerViewCommandExtension.java @@ -19,8 +19,8 @@ import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; import org.openhab.binding.hdpowerview.internal.HDPowerViewBindingConstants; import org.openhab.binding.hdpowerview.internal.HDPowerViewWebTargets; -import org.openhab.binding.hdpowerview.internal.api.responses.RepeaterData; -import org.openhab.binding.hdpowerview.internal.api.responses.Shades.ShadeData; +import org.openhab.binding.hdpowerview.internal.dto.ShadeData; +import org.openhab.binding.hdpowerview.internal.dto.responses.RepeaterData; import org.openhab.binding.hdpowerview.internal.exceptions.HubException; import org.openhab.binding.hdpowerview.internal.handler.HDPowerViewHubHandler; import org.openhab.core.io.console.Console; diff --git a/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/discovery/HDPowerViewDeviceDiscoveryService.java b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/discovery/HDPowerViewDeviceDiscoveryService.java index 98d108bef..65bc26236 100644 --- a/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/discovery/HDPowerViewDeviceDiscoveryService.java +++ b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/discovery/HDPowerViewDeviceDiscoveryService.java @@ -21,13 +21,13 @@ import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; import org.openhab.binding.hdpowerview.internal.HDPowerViewBindingConstants; import org.openhab.binding.hdpowerview.internal.HDPowerViewWebTargets; -import org.openhab.binding.hdpowerview.internal.api.responses.RepeaterData; -import org.openhab.binding.hdpowerview.internal.api.responses.Shades; -import org.openhab.binding.hdpowerview.internal.api.responses.Shades.ShadeData; import org.openhab.binding.hdpowerview.internal.config.HDPowerViewRepeaterConfiguration; import org.openhab.binding.hdpowerview.internal.config.HDPowerViewShadeConfiguration; import org.openhab.binding.hdpowerview.internal.database.ShadeCapabilitiesDatabase; import org.openhab.binding.hdpowerview.internal.database.ShadeCapabilitiesDatabase.Capabilities; +import org.openhab.binding.hdpowerview.internal.dto.ShadeData; +import org.openhab.binding.hdpowerview.internal.dto.responses.RepeaterData; +import org.openhab.binding.hdpowerview.internal.dto.responses.Shades; import org.openhab.binding.hdpowerview.internal.exceptions.HubException; import org.openhab.binding.hdpowerview.internal.exceptions.HubInvalidResponseException; import org.openhab.binding.hdpowerview.internal.exceptions.HubMaintenanceException; diff --git a/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/api/BatteryKind.java b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/BatteryKind.java similarity index 96% rename from bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/api/BatteryKind.java rename to bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/BatteryKind.java index 229d0abce..a3b79bf47 100644 --- a/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/api/BatteryKind.java +++ b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/BatteryKind.java @@ -10,7 +10,7 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.hdpowerview.internal.api; +package org.openhab.binding.hdpowerview.internal.dto; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; diff --git a/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/api/Color.java b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/Color.java similarity index 96% rename from bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/api/Color.java rename to bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/Color.java index 39f1d0f47..717969063 100644 --- a/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/api/Color.java +++ b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/Color.java @@ -10,7 +10,7 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.hdpowerview.internal.api; +package org.openhab.binding.hdpowerview.internal.dto; import org.eclipse.jdt.annotation.NonNullByDefault; import org.openhab.core.library.types.HSBType; diff --git a/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/api/CoordinateSystem.java b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/CoordinateSystem.java similarity index 98% rename from bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/api/CoordinateSystem.java rename to bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/CoordinateSystem.java index 236e46894..47c4a1bb7 100644 --- a/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/api/CoordinateSystem.java +++ b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/CoordinateSystem.java @@ -10,7 +10,7 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.hdpowerview.internal.api; +package org.openhab.binding.hdpowerview.internal.dto; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; diff --git a/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/api/Firmware.java b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/Firmware.java similarity index 94% rename from bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/api/Firmware.java rename to bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/Firmware.java index fd627c8b9..c17d76e99 100644 --- a/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/api/Firmware.java +++ b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/Firmware.java @@ -10,7 +10,7 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.hdpowerview.internal.api; +package org.openhab.binding.hdpowerview.internal.dto; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; diff --git a/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/api/HubFirmware.java b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/HubFirmware.java similarity index 93% rename from bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/api/HubFirmware.java rename to bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/HubFirmware.java index 0a625b2f1..5deb23bd5 100644 --- a/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/api/HubFirmware.java +++ b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/HubFirmware.java @@ -10,7 +10,7 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.hdpowerview.internal.api; +package org.openhab.binding.hdpowerview.internal.dto; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; diff --git a/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/Scene.java b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/Scene.java new file mode 100644 index 000000000..daf5601d6 --- /dev/null +++ b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/Scene.java @@ -0,0 +1,73 @@ +/** + * Copyright (c) 2010-2022 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.binding.hdpowerview.internal.dto; + +import java.nio.charset.StandardCharsets; +import java.util.Base64; +import java.util.Objects; + +import org.eclipse.jdt.annotation.NonNullByDefault; +import org.eclipse.jdt.annotation.Nullable; + +/** + * State of a single Scene, as returned by an HD PowerView Hub + * + * @author Jacob Laursen - Initial contribution + */ +@NonNullByDefault +public class Scene implements Comparable { + public int id; + public @Nullable String name; + public int roomId; + public int order; + public int colorId; + public int iconId; + + @Override + public boolean equals(@Nullable Object o) { + if (o == this) { + return true; + } + if (!(o instanceof Scene)) { + return false; + } + Scene other = (Scene) o; + + return this.id == other.id && Objects.equals(name, other.name) && this.roomId == other.roomId + && this.order == other.order && this.colorId == other.colorId && this.iconId == other.iconId; + } + + @Override + public final int hashCode() { + final int prime = 31; + int result = 1; + String name = this.name; + result = prime * result + id; + result = prime * result + (name == null ? 0 : name.hashCode()); + result = prime * result + roomId; + result = prime * result + order; + result = prime * result + colorId; + result = prime * result + iconId; + + return result; + } + + @Override + public int compareTo(Scene other) { + return Integer.compare(order, other.order); + } + + public String getName() { + return new String(Base64.getDecoder().decode(name), StandardCharsets.UTF_8); + } +} diff --git a/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/SceneCollection.java b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/SceneCollection.java new file mode 100644 index 000000000..35e4f3ce0 --- /dev/null +++ b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/SceneCollection.java @@ -0,0 +1,71 @@ +/** + * Copyright (c) 2010-2022 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.binding.hdpowerview.internal.dto; + +import java.nio.charset.StandardCharsets; +import java.util.Base64; +import java.util.Objects; + +import org.eclipse.jdt.annotation.NonNullByDefault; +import org.eclipse.jdt.annotation.Nullable; + +/** + * State of a single Scene Collection, as returned by an HD PowerView Hub + * + * @author Jacob Laursen - Initial contribution + */ +@NonNullByDefault +public class SceneCollection implements Comparable { + public int id; + public @Nullable String name; + public int order; + public int colorId; + public int iconId; + + @Override + public boolean equals(@Nullable Object o) { + if (o == this) { + return true; + } + if (!(o instanceof SceneCollection)) { + return false; + } + SceneCollection other = (SceneCollection) o; + + return this.id == other.id && Objects.equals(name, other.name) && this.order == other.order + && this.colorId == other.colorId && this.iconId == other.iconId; + } + + @Override + public final int hashCode() { + final int prime = 31; + int result = 1; + String name = this.name; + result = prime * result + id; + result = prime * result + (name == null ? 0 : name.hashCode()); + result = prime * result + order; + result = prime * result + colorId; + result = prime * result + iconId; + + return result; + } + + @Override + public int compareTo(SceneCollection other) { + return Integer.compare(order, other.order); + } + + public String getName() { + return new String(Base64.getDecoder().decode(name), StandardCharsets.UTF_8); + } +} diff --git a/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/ScheduledEvent.java b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/ScheduledEvent.java new file mode 100644 index 000000000..16c9de0c9 --- /dev/null +++ b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/ScheduledEvent.java @@ -0,0 +1,117 @@ +/** + * Copyright (c) 2010-2022 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.binding.hdpowerview.internal.dto; + +import java.time.DayOfWeek; +import java.util.EnumSet; + +import org.eclipse.jdt.annotation.NonNullByDefault; +import org.eclipse.jdt.annotation.Nullable; + +/** + * State of a single Scheduled Event, as returned by an HD PowerView Hub + * + * @author Jacob Laursen - Initial contribution + */ +@NonNullByDefault +public class ScheduledEvent { + public static final EnumSet WEEKDAYS = EnumSet.of(DayOfWeek.MONDAY, DayOfWeek.TUESDAY, + DayOfWeek.WEDNESDAY, DayOfWeek.THURSDAY, DayOfWeek.FRIDAY); + + public static final EnumSet WEEKENDS = EnumSet.of(DayOfWeek.SATURDAY, DayOfWeek.SUNDAY); + + public static final int SCHEDULED_EVENT_TYPE_TIME = 0; + public static final int SCHEDULED_EVENT_TYPE_SUNRISE = 1; + public static final int SCHEDULED_EVENT_TYPE_SUNSET = 2; + + public int id; + public boolean enabled; + public int sceneId; + public int sceneCollectionId; + public boolean daySunday; + public boolean dayMonday; + public boolean dayTuesday; + public boolean dayWednesday; + public boolean dayThursday; + public boolean dayFriday; + public boolean daySaturday; + public int eventType; + public int hour; + public int minute; + + @Override + public boolean equals(@Nullable Object o) { + if (o == this) { + return true; + } + if (!(o instanceof ScheduledEvent)) { + return false; + } + ScheduledEvent other = (ScheduledEvent) o; + + return this.id == other.id && this.enabled == other.enabled && this.sceneId == other.sceneId + && this.sceneCollectionId == other.sceneCollectionId && this.daySunday == other.daySunday + && this.dayMonday == other.dayMonday && this.dayTuesday == other.dayTuesday + && this.dayWednesday == other.dayWednesday && this.dayThursday == other.dayThursday + && this.dayFriday == other.dayFriday && this.daySaturday == other.daySaturday + && this.eventType == other.eventType && this.hour == other.hour && this.minute == other.minute; + } + + @Override + public final int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + id; + result = prime * result + (enabled ? 1 : 0); + result = prime * result + sceneId; + result = prime * result + sceneCollectionId; + result = prime * result + (daySunday ? 1 : 0); + result = prime * result + (dayMonday ? 1 : 0); + result = prime * result + (dayTuesday ? 1 : 0); + result = prime * result + (dayWednesday ? 1 : 0); + result = prime * result + (dayThursday ? 1 : 0); + result = prime * result + (dayFriday ? 1 : 0); + result = prime * result + (daySaturday ? 1 : 0); + result = prime * result + eventType; + result = prime * result + hour; + result = prime * result + minute; + + return result; + } + + public EnumSet getDays() { + EnumSet days = EnumSet.noneOf(DayOfWeek.class); + if (daySunday) { + days.add(DayOfWeek.SUNDAY); + } + if (dayMonday) { + days.add(DayOfWeek.MONDAY); + } + if (dayTuesday) { + days.add(DayOfWeek.TUESDAY); + } + if (dayWednesday) { + days.add(DayOfWeek.WEDNESDAY); + } + if (dayThursday) { + days.add(DayOfWeek.THURSDAY); + } + if (dayFriday) { + days.add(DayOfWeek.FRIDAY); + } + if (daySaturday) { + days.add(DayOfWeek.SATURDAY); + } + return days; + } +} diff --git a/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/ShadeData.java b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/ShadeData.java new file mode 100644 index 000000000..033426750 --- /dev/null +++ b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/ShadeData.java @@ -0,0 +1,52 @@ +/** + * Copyright (c) 2010-2022 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.binding.hdpowerview.internal.dto; + +import java.util.Base64; + +import org.eclipse.jdt.annotation.NonNullByDefault; +import org.eclipse.jdt.annotation.Nullable; + +/** + * Shade data for a single Shade, as returned by an HD PowerView hub + * + * @author Jacob Laursen - Initial contribution + */ +@NonNullByDefault +public class ShadeData { + public int id; + public @Nullable String name; + public int roomId; + public int groupId; + public int order; + public int type; + public double batteryStrength; + public int batteryStatus; + public boolean batteryIsLow; + public @Nullable ShadePosition positions; + public @Nullable Boolean timedOut; + public int signalStrength; + public @Nullable Integer capabilities; + public @Nullable Firmware firmware; + public @Nullable Firmware motor; + // note: in old JSON batteryKind was a string but now it's a number; fortunately GSON string accepts either + public @Nullable String batteryKind; + + public String getName() { + return new String(Base64.getDecoder().decode(name)); + } + + public BatteryKind getBatteryKind() { + return BatteryKind.fromString(batteryKind); + } +} diff --git a/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/api/ShadePosition.java b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/ShadePosition.java similarity index 99% rename from bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/api/ShadePosition.java rename to bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/ShadePosition.java index 0eee7aff4..d6bced818 100644 --- a/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/api/ShadePosition.java +++ b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/ShadePosition.java @@ -10,9 +10,9 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.hdpowerview.internal.api; +package org.openhab.binding.hdpowerview.internal.dto; -import static org.openhab.binding.hdpowerview.internal.api.CoordinateSystem.*; +import static org.openhab.binding.hdpowerview.internal.dto.CoordinateSystem.*; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; diff --git a/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/api/SurveyData.java b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/SurveyData.java similarity index 94% rename from bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/api/SurveyData.java rename to bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/SurveyData.java index bfb5301ba..7f3da5ff9 100644 --- a/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/api/SurveyData.java +++ b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/SurveyData.java @@ -10,7 +10,7 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.hdpowerview.internal.api; +package org.openhab.binding.hdpowerview.internal.dto; import org.eclipse.jdt.annotation.NonNullByDefault; diff --git a/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/api/Times.java b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/Times.java similarity index 94% rename from bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/api/Times.java rename to bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/Times.java index 0dbc911bf..33a9bc99f 100644 --- a/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/api/Times.java +++ b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/Times.java @@ -10,7 +10,7 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.hdpowerview.internal.api; +package org.openhab.binding.hdpowerview.internal.dto; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; diff --git a/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/api/UserData.java b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/UserData.java similarity index 96% rename from bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/api/UserData.java rename to bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/UserData.java index 70c33a918..fd3699224 100644 --- a/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/api/UserData.java +++ b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/UserData.java @@ -10,7 +10,7 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.hdpowerview.internal.api; +package org.openhab.binding.hdpowerview.internal.dto; import java.util.Base64; diff --git a/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/api/requests/RepeaterBlinking.java b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/requests/RepeaterBlinking.java similarity index 93% rename from bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/api/requests/RepeaterBlinking.java rename to bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/requests/RepeaterBlinking.java index ea3886af1..e50a30844 100644 --- a/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/api/requests/RepeaterBlinking.java +++ b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/requests/RepeaterBlinking.java @@ -10,7 +10,7 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.hdpowerview.internal.api.requests; +package org.openhab.binding.hdpowerview.internal.dto.requests; import org.eclipse.jdt.annotation.NonNullByDefault; diff --git a/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/api/requests/RepeaterColor.java b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/requests/RepeaterColor.java similarity index 88% rename from bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/api/requests/RepeaterColor.java rename to bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/requests/RepeaterColor.java index 960e95f58..fc317e7aa 100644 --- a/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/api/requests/RepeaterColor.java +++ b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/requests/RepeaterColor.java @@ -10,10 +10,10 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.hdpowerview.internal.api.requests; +package org.openhab.binding.hdpowerview.internal.dto.requests; import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.binding.hdpowerview.internal.api.Color; +import org.openhab.binding.hdpowerview.internal.dto.Color; /** * Color state of a single Repeater for being updated by an HD PowerView Hub diff --git a/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/api/requests/ShadeCalibrate.java b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/requests/ShadeCalibrate.java similarity index 91% rename from bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/api/requests/ShadeCalibrate.java rename to bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/requests/ShadeCalibrate.java index e1ec80e48..0d1d50ec9 100644 --- a/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/api/requests/ShadeCalibrate.java +++ b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/requests/ShadeCalibrate.java @@ -10,7 +10,7 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.hdpowerview.internal.api.requests; +package org.openhab.binding.hdpowerview.internal.dto.requests; import org.eclipse.jdt.annotation.NonNullByDefault; diff --git a/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/api/requests/ShadeJog.java b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/requests/ShadeJog.java similarity index 91% rename from bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/api/requests/ShadeJog.java rename to bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/requests/ShadeJog.java index 71fb0477a..b1317a7ea 100644 --- a/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/api/requests/ShadeJog.java +++ b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/requests/ShadeJog.java @@ -10,7 +10,7 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.hdpowerview.internal.api.requests; +package org.openhab.binding.hdpowerview.internal.dto.requests; import org.eclipse.jdt.annotation.NonNullByDefault; diff --git a/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/api/requests/ShadeMotion.java b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/requests/ShadeMotion.java similarity index 93% rename from bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/api/requests/ShadeMotion.java rename to bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/requests/ShadeMotion.java index c6b16a000..f5aeb57a5 100644 --- a/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/api/requests/ShadeMotion.java +++ b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/requests/ShadeMotion.java @@ -10,7 +10,7 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.hdpowerview.internal.api.requests; +package org.openhab.binding.hdpowerview.internal.dto.requests; import org.eclipse.jdt.annotation.NonNullByDefault; diff --git a/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/api/requests/ShadeMove.java b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/requests/ShadeMove.java similarity index 85% rename from bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/api/requests/ShadeMove.java rename to bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/requests/ShadeMove.java index fe688f4f7..4f87fdf0c 100644 --- a/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/api/requests/ShadeMove.java +++ b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/requests/ShadeMove.java @@ -10,10 +10,10 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.hdpowerview.internal.api.requests; +package org.openhab.binding.hdpowerview.internal.dto.requests; import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.binding.hdpowerview.internal.api.ShadePosition; +import org.openhab.binding.hdpowerview.internal.dto.ShadePosition; /** * A request to set the position of a shade diff --git a/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/api/requests/ShadePositions.java b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/requests/ShadePositions.java similarity index 84% rename from bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/api/requests/ShadePositions.java rename to bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/requests/ShadePositions.java index 1c544c047..fd98950f5 100644 --- a/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/api/requests/ShadePositions.java +++ b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/requests/ShadePositions.java @@ -10,10 +10,10 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.hdpowerview.internal.api.requests; +package org.openhab.binding.hdpowerview.internal.dto.requests; import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.binding.hdpowerview.internal.api.ShadePosition; +import org.openhab.binding.hdpowerview.internal.dto.ShadePosition; /** * The position of a shade to set diff --git a/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/api/requests/ShadeStop.java b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/requests/ShadeStop.java similarity index 91% rename from bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/api/requests/ShadeStop.java rename to bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/requests/ShadeStop.java index ed7ab4c4b..34f47f038 100644 --- a/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/api/requests/ShadeStop.java +++ b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/requests/ShadeStop.java @@ -10,7 +10,7 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.hdpowerview.internal.api.requests; +package org.openhab.binding.hdpowerview.internal.dto.requests; import org.eclipse.jdt.annotation.NonNullByDefault; diff --git a/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/api/responses/FirmwareVersion.java b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/responses/FirmwareVersion.java similarity index 84% rename from bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/api/responses/FirmwareVersion.java rename to bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/responses/FirmwareVersion.java index d046f06a8..34b9f202e 100644 --- a/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/api/responses/FirmwareVersion.java +++ b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/responses/FirmwareVersion.java @@ -10,11 +10,11 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.hdpowerview.internal.api.responses; +package org.openhab.binding.hdpowerview.internal.dto.responses; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; -import org.openhab.binding.hdpowerview.internal.api.HubFirmware; +import org.openhab.binding.hdpowerview.internal.dto.HubFirmware; /** * Firmware information for an HD PowerView hub diff --git a/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/api/responses/Repeater.java b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/responses/Repeater.java similarity index 91% rename from bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/api/responses/Repeater.java rename to bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/responses/Repeater.java index 55ba66665..d743626d9 100644 --- a/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/api/responses/Repeater.java +++ b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/responses/Repeater.java @@ -10,7 +10,7 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.hdpowerview.internal.api.responses; +package org.openhab.binding.hdpowerview.internal.dto.responses; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; diff --git a/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/api/responses/RepeaterData.java b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/responses/RepeaterData.java similarity index 84% rename from bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/api/responses/RepeaterData.java rename to bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/responses/RepeaterData.java index a083f91a3..1b789637d 100644 --- a/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/api/responses/RepeaterData.java +++ b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/responses/RepeaterData.java @@ -10,14 +10,14 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.hdpowerview.internal.api.responses; +package org.openhab.binding.hdpowerview.internal.dto.responses; import java.util.Base64; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; -import org.openhab.binding.hdpowerview.internal.api.Color; -import org.openhab.binding.hdpowerview.internal.api.Firmware; +import org.openhab.binding.hdpowerview.internal.dto.Color; +import org.openhab.binding.hdpowerview.internal.dto.Firmware; /** * Repeater data for a single Repeater, as returned by an HD PowerView Hub diff --git a/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/api/responses/Repeaters.java b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/responses/Repeaters.java similarity index 92% rename from bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/api/responses/Repeaters.java rename to bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/responses/Repeaters.java index 8b5f15b12..e1aa699b4 100644 --- a/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/api/responses/Repeaters.java +++ b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/responses/Repeaters.java @@ -10,7 +10,7 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.hdpowerview.internal.api.responses; +package org.openhab.binding.hdpowerview.internal.dto.responses; import java.util.List; diff --git a/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/responses/SceneCollections.java b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/responses/SceneCollections.java new file mode 100644 index 000000000..582178bc7 --- /dev/null +++ b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/responses/SceneCollections.java @@ -0,0 +1,30 @@ +/** + * Copyright (c) 2010-2022 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.binding.hdpowerview.internal.dto.responses; + +import java.util.List; + +import org.eclipse.jdt.annotation.NonNullByDefault; +import org.eclipse.jdt.annotation.Nullable; +import org.openhab.binding.hdpowerview.internal.dto.SceneCollection; + +/** + * State of all Scene Collections in an HD PowerView hub + * + * @author Jacob Laursen - Initial contribution + */ +@NonNullByDefault +public class SceneCollections { + public @Nullable List sceneCollectionData; + public @Nullable List sceneCollectionIds; +} diff --git a/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/responses/Scenes.java b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/responses/Scenes.java new file mode 100644 index 000000000..7458d6f90 --- /dev/null +++ b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/responses/Scenes.java @@ -0,0 +1,30 @@ +/** + * Copyright (c) 2010-2022 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.binding.hdpowerview.internal.dto.responses; + +import java.util.List; + +import org.eclipse.jdt.annotation.NonNullByDefault; +import org.eclipse.jdt.annotation.Nullable; +import org.openhab.binding.hdpowerview.internal.dto.Scene; + +/** + * State of all Scenes in an HD PowerView hub + * + * @author Andy Lintner - Initial contribution + */ +@NonNullByDefault +public class Scenes { + public @Nullable List sceneData; + public @Nullable List sceneIds; +} diff --git a/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/responses/ScheduledEvents.java b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/responses/ScheduledEvents.java new file mode 100644 index 000000000..4b4a8b416 --- /dev/null +++ b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/responses/ScheduledEvents.java @@ -0,0 +1,30 @@ +/** + * Copyright (c) 2010-2022 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.binding.hdpowerview.internal.dto.responses; + +import java.util.List; + +import org.eclipse.jdt.annotation.NonNullByDefault; +import org.eclipse.jdt.annotation.Nullable; +import org.openhab.binding.hdpowerview.internal.dto.ScheduledEvent; + +/** + * State of all Scheduled Events in an HD PowerView hub + * + * @author Jacob Laursen - Initial contribution + */ +@NonNullByDefault +public class ScheduledEvents { + public @Nullable List scheduledEventData; + public @Nullable List scheduledEventIds; +} diff --git a/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/api/responses/Shade.java b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/responses/Shade.java similarity index 82% rename from bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/api/responses/Shade.java rename to bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/responses/Shade.java index 69da93783..29b079458 100644 --- a/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/api/responses/Shade.java +++ b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/responses/Shade.java @@ -10,11 +10,11 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.hdpowerview.internal.api.responses; +package org.openhab.binding.hdpowerview.internal.dto.responses; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; -import org.openhab.binding.hdpowerview.internal.api.responses.Shades.ShadeData; +import org.openhab.binding.hdpowerview.internal.dto.ShadeData; /** * State of a single Shade, as returned by an HD PowerView hub @@ -23,6 +23,5 @@ import org.openhab.binding.hdpowerview.internal.api.responses.Shades.ShadeData; */ @NonNullByDefault public class Shade { - public @Nullable ShadeData shade; } diff --git a/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/responses/Shades.java b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/responses/Shades.java new file mode 100644 index 000000000..ab177146e --- /dev/null +++ b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/responses/Shades.java @@ -0,0 +1,30 @@ +/** + * Copyright (c) 2010-2022 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.binding.hdpowerview.internal.dto.responses; + +import java.util.List; + +import org.eclipse.jdt.annotation.NonNullByDefault; +import org.eclipse.jdt.annotation.Nullable; +import org.openhab.binding.hdpowerview.internal.dto.ShadeData; + +/** + * State of all Shades, as returned by an HD PowerView hub + * + * @author Andy Lintner - Initial contribution + */ +@NonNullByDefault +public class Shades { + public @Nullable List shadeData; + public @Nullable List shadeIds; +} diff --git a/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/api/responses/Survey.java b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/responses/Survey.java similarity index 87% rename from bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/api/responses/Survey.java rename to bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/responses/Survey.java index 21709fe1a..e55a1f99f 100644 --- a/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/api/responses/Survey.java +++ b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/responses/Survey.java @@ -10,13 +10,13 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.hdpowerview.internal.api.responses; +package org.openhab.binding.hdpowerview.internal.dto.responses; import java.util.List; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; -import org.openhab.binding.hdpowerview.internal.api.SurveyData; +import org.openhab.binding.hdpowerview.internal.dto.SurveyData; import com.google.gson.annotations.SerializedName; diff --git a/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/api/responses/UserDataResponse.java b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/responses/UserDataResponse.java similarity index 84% rename from bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/api/responses/UserDataResponse.java rename to bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/responses/UserDataResponse.java index 3509ffdb8..15c4cbeae 100644 --- a/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/api/responses/UserDataResponse.java +++ b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/dto/responses/UserDataResponse.java @@ -10,11 +10,11 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.hdpowerview.internal.api.responses; +package org.openhab.binding.hdpowerview.internal.dto.responses; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; -import org.openhab.binding.hdpowerview.internal.api.UserData; +import org.openhab.binding.hdpowerview.internal.dto.UserData; /** * Response with {@link UserData} for an HD PowerView hub diff --git a/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/handler/HDPowerViewHubHandler.java b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/handler/HDPowerViewHubHandler.java index b3991f3aa..7cfe8778f 100644 --- a/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/handler/HDPowerViewHubHandler.java +++ b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/handler/HDPowerViewHubHandler.java @@ -30,22 +30,22 @@ import org.eclipse.jetty.client.HttpClient; import org.openhab.binding.hdpowerview.internal.HDPowerViewBindingConstants; import org.openhab.binding.hdpowerview.internal.HDPowerViewTranslationProvider; import org.openhab.binding.hdpowerview.internal.HDPowerViewWebTargets; -import org.openhab.binding.hdpowerview.internal.api.Firmware; -import org.openhab.binding.hdpowerview.internal.api.HubFirmware; -import org.openhab.binding.hdpowerview.internal.api.UserData; -import org.openhab.binding.hdpowerview.internal.api.responses.SceneCollections; -import org.openhab.binding.hdpowerview.internal.api.responses.SceneCollections.SceneCollection; -import org.openhab.binding.hdpowerview.internal.api.responses.Scenes; -import org.openhab.binding.hdpowerview.internal.api.responses.Scenes.Scene; -import org.openhab.binding.hdpowerview.internal.api.responses.ScheduledEvents; -import org.openhab.binding.hdpowerview.internal.api.responses.ScheduledEvents.ScheduledEvent; -import org.openhab.binding.hdpowerview.internal.api.responses.Shades; -import org.openhab.binding.hdpowerview.internal.api.responses.Shades.ShadeData; import org.openhab.binding.hdpowerview.internal.builders.AutomationChannelBuilder; import org.openhab.binding.hdpowerview.internal.builders.SceneChannelBuilder; import org.openhab.binding.hdpowerview.internal.builders.SceneGroupChannelBuilder; import org.openhab.binding.hdpowerview.internal.config.HDPowerViewHubConfiguration; import org.openhab.binding.hdpowerview.internal.config.HDPowerViewShadeConfiguration; +import org.openhab.binding.hdpowerview.internal.dto.Firmware; +import org.openhab.binding.hdpowerview.internal.dto.HubFirmware; +import org.openhab.binding.hdpowerview.internal.dto.Scene; +import org.openhab.binding.hdpowerview.internal.dto.SceneCollection; +import org.openhab.binding.hdpowerview.internal.dto.ScheduledEvent; +import org.openhab.binding.hdpowerview.internal.dto.ShadeData; +import org.openhab.binding.hdpowerview.internal.dto.UserData; +import org.openhab.binding.hdpowerview.internal.dto.responses.SceneCollections; +import org.openhab.binding.hdpowerview.internal.dto.responses.Scenes; +import org.openhab.binding.hdpowerview.internal.dto.responses.ScheduledEvents; +import org.openhab.binding.hdpowerview.internal.dto.responses.Shades; import org.openhab.binding.hdpowerview.internal.exceptions.HubException; import org.openhab.binding.hdpowerview.internal.exceptions.HubInvalidResponseException; import org.openhab.binding.hdpowerview.internal.exceptions.HubMaintenanceException; diff --git a/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/handler/HDPowerViewRepeaterHandler.java b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/handler/HDPowerViewRepeaterHandler.java index 037c85184..c8080fa2c 100644 --- a/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/handler/HDPowerViewRepeaterHandler.java +++ b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/handler/HDPowerViewRepeaterHandler.java @@ -20,10 +20,10 @@ import java.util.concurrent.TimeUnit; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; import org.openhab.binding.hdpowerview.internal.HDPowerViewWebTargets; -import org.openhab.binding.hdpowerview.internal.api.Color; -import org.openhab.binding.hdpowerview.internal.api.Firmware; -import org.openhab.binding.hdpowerview.internal.api.responses.RepeaterData; import org.openhab.binding.hdpowerview.internal.config.HDPowerViewRepeaterConfiguration; +import org.openhab.binding.hdpowerview.internal.dto.Color; +import org.openhab.binding.hdpowerview.internal.dto.Firmware; +import org.openhab.binding.hdpowerview.internal.dto.responses.RepeaterData; import org.openhab.binding.hdpowerview.internal.exceptions.HubException; import org.openhab.binding.hdpowerview.internal.exceptions.HubInvalidResponseException; import org.openhab.binding.hdpowerview.internal.exceptions.HubMaintenanceException; diff --git a/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/handler/HDPowerViewShadeHandler.java b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/handler/HDPowerViewShadeHandler.java index 53e77e042..f787ad090 100644 --- a/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/handler/HDPowerViewShadeHandler.java +++ b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/handler/HDPowerViewShadeHandler.java @@ -13,7 +13,7 @@ package org.openhab.binding.hdpowerview.internal.handler; import static org.openhab.binding.hdpowerview.internal.HDPowerViewBindingConstants.*; -import static org.openhab.binding.hdpowerview.internal.api.CoordinateSystem.*; +import static org.openhab.binding.hdpowerview.internal.dto.CoordinateSystem.*; import java.util.ArrayList; import java.util.HashMap; @@ -29,15 +29,15 @@ import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; import org.openhab.binding.hdpowerview.internal.HDPowerViewBindingConstants; import org.openhab.binding.hdpowerview.internal.HDPowerViewWebTargets; -import org.openhab.binding.hdpowerview.internal.api.BatteryKind; -import org.openhab.binding.hdpowerview.internal.api.CoordinateSystem; -import org.openhab.binding.hdpowerview.internal.api.Firmware; -import org.openhab.binding.hdpowerview.internal.api.ShadePosition; -import org.openhab.binding.hdpowerview.internal.api.SurveyData; -import org.openhab.binding.hdpowerview.internal.api.responses.Shades.ShadeData; import org.openhab.binding.hdpowerview.internal.config.HDPowerViewShadeConfiguration; import org.openhab.binding.hdpowerview.internal.database.ShadeCapabilitiesDatabase; import org.openhab.binding.hdpowerview.internal.database.ShadeCapabilitiesDatabase.Capabilities; +import org.openhab.binding.hdpowerview.internal.dto.BatteryKind; +import org.openhab.binding.hdpowerview.internal.dto.CoordinateSystem; +import org.openhab.binding.hdpowerview.internal.dto.Firmware; +import org.openhab.binding.hdpowerview.internal.dto.ShadeData; +import org.openhab.binding.hdpowerview.internal.dto.ShadePosition; +import org.openhab.binding.hdpowerview.internal.dto.SurveyData; import org.openhab.binding.hdpowerview.internal.exceptions.HubException; import org.openhab.binding.hdpowerview.internal.exceptions.HubInvalidResponseException; import org.openhab.binding.hdpowerview.internal.exceptions.HubMaintenanceException; diff --git a/bundles/org.openhab.binding.hdpowerview/src/test/java/org/openhab/binding/hdpowerview/AutomationChannelBuilderTest.java b/bundles/org.openhab.binding.hdpowerview/src/test/java/org/openhab/binding/hdpowerview/internal/AutomationChannelBuilderTest.java similarity index 88% rename from bundles/org.openhab.binding.hdpowerview/src/test/java/org/openhab/binding/hdpowerview/AutomationChannelBuilderTest.java rename to bundles/org.openhab.binding.hdpowerview/src/test/java/org/openhab/binding/hdpowerview/internal/AutomationChannelBuilderTest.java index ba6cb9957..6326ea587 100644 --- a/bundles/org.openhab.binding.hdpowerview/src/test/java/org/openhab/binding/hdpowerview/AutomationChannelBuilderTest.java +++ b/bundles/org.openhab.binding.hdpowerview/src/test/java/org/openhab/binding/hdpowerview/internal/AutomationChannelBuilderTest.java @@ -10,7 +10,7 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.hdpowerview; +package org.openhab.binding.hdpowerview.internal; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.Mockito.mock; @@ -22,15 +22,12 @@ import java.util.List; import org.eclipse.jdt.annotation.NonNullByDefault; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.openhab.binding.hdpowerview.internal.HDPowerViewBindingConstants; -import org.openhab.binding.hdpowerview.internal.HDPowerViewTranslationProvider; -import org.openhab.binding.hdpowerview.internal.api.responses.SceneCollections.SceneCollection; -import org.openhab.binding.hdpowerview.internal.api.responses.Scenes.Scene; -import org.openhab.binding.hdpowerview.internal.api.responses.ScheduledEvents; -import org.openhab.binding.hdpowerview.internal.api.responses.ScheduledEvents.ScheduledEvent; import org.openhab.binding.hdpowerview.internal.builders.AutomationChannelBuilder; -import org.openhab.binding.hdpowerview.providers.MockedLocaleProvider; -import org.openhab.binding.hdpowerview.providers.MockedTranslationProvider; +import org.openhab.binding.hdpowerview.internal.dto.Scene; +import org.openhab.binding.hdpowerview.internal.dto.SceneCollection; +import org.openhab.binding.hdpowerview.internal.dto.ScheduledEvent; +import org.openhab.binding.hdpowerview.internal.providers.MockedLocaleProvider; +import org.openhab.binding.hdpowerview.internal.providers.MockedTranslationProvider; import org.openhab.core.thing.Channel; import org.openhab.core.thing.ChannelGroupUID; import org.openhab.core.thing.ThingUID; @@ -78,7 +75,7 @@ public class AutomationChannelBuilderTest { @Test public void sceneSunriseWeekends() { - ScheduledEvent scheduledEvent = createScheduledEventWithScene(ScheduledEvents.SCHEDULED_EVENT_TYPE_SUNRISE); + ScheduledEvent scheduledEvent = createScheduledEventWithScene(ScheduledEvent.SCHEDULED_EVENT_TYPE_SUNRISE); scheduledEvent.daySaturday = true; scheduledEvent.daySunday = true; @@ -91,7 +88,7 @@ public class AutomationChannelBuilderTest { @Test public void sceneSunsetWeekdays() { - ScheduledEvent scheduledEvent = createScheduledEventWithScene(ScheduledEvents.SCHEDULED_EVENT_TYPE_SUNSET); + ScheduledEvent scheduledEvent = createScheduledEventWithScene(ScheduledEvent.SCHEDULED_EVENT_TYPE_SUNSET); scheduledEvent.dayMonday = true; scheduledEvent.dayTuesday = true; scheduledEvent.dayWednesday = true; @@ -107,7 +104,7 @@ public class AutomationChannelBuilderTest { @Test public void sceneTimeAllDays() { - ScheduledEvent scheduledEvent = createScheduledEventWithScene(ScheduledEvents.SCHEDULED_EVENT_TYPE_TIME); + ScheduledEvent scheduledEvent = createScheduledEventWithScene(ScheduledEvent.SCHEDULED_EVENT_TYPE_TIME); scheduledEvent.dayMonday = true; scheduledEvent.dayTuesday = true; scheduledEvent.dayWednesday = true; @@ -127,7 +124,7 @@ public class AutomationChannelBuilderTest { @Test public void sceneMinutesBeforeSunriseMondayTuesday() { - ScheduledEvent scheduledEvent = createScheduledEventWithScene(ScheduledEvents.SCHEDULED_EVENT_TYPE_SUNRISE); + ScheduledEvent scheduledEvent = createScheduledEventWithScene(ScheduledEvent.SCHEDULED_EVENT_TYPE_SUNRISE); scheduledEvent.dayMonday = true; scheduledEvent.dayTuesday = true; scheduledEvent.minute = -15; @@ -141,7 +138,7 @@ public class AutomationChannelBuilderTest { @Test public void sceneHoursMinutesAfterSunriseMonday() { - ScheduledEvent scheduledEvent = createScheduledEventWithScene(ScheduledEvents.SCHEDULED_EVENT_TYPE_SUNRISE); + ScheduledEvent scheduledEvent = createScheduledEventWithScene(ScheduledEvent.SCHEDULED_EVENT_TYPE_SUNRISE); scheduledEvent.dayMonday = true; scheduledEvent.minute = 61; @@ -154,7 +151,7 @@ public class AutomationChannelBuilderTest { @Test public void sceneMinutesBeforeSunsetWednesdayThursdayFriday() { - ScheduledEvent scheduledEvent = createScheduledEventWithScene(ScheduledEvents.SCHEDULED_EVENT_TYPE_SUNSET); + ScheduledEvent scheduledEvent = createScheduledEventWithScene(ScheduledEvent.SCHEDULED_EVENT_TYPE_SUNSET); scheduledEvent.dayWednesday = true; scheduledEvent.dayThursday = true; scheduledEvent.dayFriday = true; @@ -169,7 +166,7 @@ public class AutomationChannelBuilderTest { @Test public void sceneHourAfterSunsetFridaySaturdaySunday() { - ScheduledEvent scheduledEvent = createScheduledEventWithScene(ScheduledEvents.SCHEDULED_EVENT_TYPE_SUNSET); + ScheduledEvent scheduledEvent = createScheduledEventWithScene(ScheduledEvent.SCHEDULED_EVENT_TYPE_SUNSET); scheduledEvent.dayFriday = true; scheduledEvent.daySaturday = true; scheduledEvent.daySunday = true; @@ -185,7 +182,7 @@ public class AutomationChannelBuilderTest { @Test public void sceneCollection() { ScheduledEvent scheduledEvent = createScheduledEventWithSceneCollection( - ScheduledEvents.SCHEDULED_EVENT_TYPE_SUNRISE); + ScheduledEvent.SCHEDULED_EVENT_TYPE_SUNRISE); List scheduledEvents = new ArrayList<>(List.of(scheduledEvent)); List channels = builder.withSceneCollections(sceneCollections).withScheduledEvents(scheduledEvents) @@ -197,7 +194,7 @@ public class AutomationChannelBuilderTest { @Test public void suppliedListIsUsed() { - ScheduledEvent scheduledEvent = createScheduledEventWithScene(ScheduledEvents.SCHEDULED_EVENT_TYPE_SUNRISE); + ScheduledEvent scheduledEvent = createScheduledEventWithScene(ScheduledEvent.SCHEDULED_EVENT_TYPE_SUNRISE); List scheduledEvents = new ArrayList<>(List.of(scheduledEvent)); List existingChannels = new ArrayList<>(0); List channels = builder.withScenes(scenes).withScheduledEvents(scheduledEvents) @@ -215,7 +212,7 @@ public class AutomationChannelBuilderTest { @Test public void emptyListWhenNoScenesOrSceneCollections() { - ScheduledEvent scheduledEvent = createScheduledEventWithScene(ScheduledEvents.SCHEDULED_EVENT_TYPE_SUNRISE); + ScheduledEvent scheduledEvent = createScheduledEventWithScene(ScheduledEvent.SCHEDULED_EVENT_TYPE_SUNRISE); List scheduledEvents = new ArrayList<>(List.of(scheduledEvent)); List channels = builder.withScheduledEvents(scheduledEvents).build(); @@ -225,7 +222,7 @@ public class AutomationChannelBuilderTest { @Test public void emptyListWhenNoSceneForScheduledEvent() { ScheduledEvent scheduledEvent = createScheduledEventWithSceneCollection( - ScheduledEvents.SCHEDULED_EVENT_TYPE_SUNRISE); + ScheduledEvent.SCHEDULED_EVENT_TYPE_SUNRISE); List scheduledEvents = new ArrayList<>(List.of(scheduledEvent)); List channels = builder.withScenes(scenes).withScheduledEvents(scheduledEvents).build(); @@ -234,7 +231,7 @@ public class AutomationChannelBuilderTest { @Test public void emptyListWhenNoSceneCollectionForScheduledEvent() { - ScheduledEvent scheduledEvent = createScheduledEventWithScene(ScheduledEvents.SCHEDULED_EVENT_TYPE_SUNRISE); + ScheduledEvent scheduledEvent = createScheduledEventWithScene(ScheduledEvent.SCHEDULED_EVENT_TYPE_SUNRISE); List scheduledEvents = new ArrayList<>(List.of(scheduledEvent)); List channels = builder.withSceneCollections(sceneCollections).withScheduledEvents(scheduledEvents) @@ -245,7 +242,7 @@ public class AutomationChannelBuilderTest { @Test public void groupAndIdAreCorrect() { - ScheduledEvent scheduledEvent = createScheduledEventWithScene(ScheduledEvents.SCHEDULED_EVENT_TYPE_SUNRISE); + ScheduledEvent scheduledEvent = createScheduledEventWithScene(ScheduledEvent.SCHEDULED_EVENT_TYPE_SUNRISE); scheduledEvent.id = 42; List scheduledEvents = new ArrayList<>(List.of(scheduledEvent)); List channels = builder.withScenes(scenes).withScheduledEvents(scheduledEvents).build(); diff --git a/bundles/org.openhab.binding.hdpowerview/src/test/java/org/openhab/binding/hdpowerview/HDPowerViewJUnitTests.java b/bundles/org.openhab.binding.hdpowerview/src/test/java/org/openhab/binding/hdpowerview/internal/HDPowerViewJUnitTests.java similarity index 91% rename from bundles/org.openhab.binding.hdpowerview/src/test/java/org/openhab/binding/hdpowerview/HDPowerViewJUnitTests.java rename to bundles/org.openhab.binding.hdpowerview/src/test/java/org/openhab/binding/hdpowerview/internal/HDPowerViewJUnitTests.java index 19cd35c7c..b28e2cbf7 100644 --- a/bundles/org.openhab.binding.hdpowerview/src/test/java/org/openhab/binding/hdpowerview/HDPowerViewJUnitTests.java +++ b/bundles/org.openhab.binding.hdpowerview/src/test/java/org/openhab/binding/hdpowerview/internal/HDPowerViewJUnitTests.java @@ -10,10 +10,10 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.hdpowerview; +package org.openhab.binding.hdpowerview.internal; import static org.junit.jupiter.api.Assertions.*; -import static org.openhab.binding.hdpowerview.internal.api.CoordinateSystem.*; +import static org.openhab.binding.hdpowerview.internal.dto.CoordinateSystem.*; import java.io.IOException; import java.io.InputStream; @@ -23,16 +23,16 @@ import java.util.Objects; import org.eclipse.jdt.annotation.NonNullByDefault; import org.junit.jupiter.api.Test; -import org.openhab.binding.hdpowerview.internal.api.BatteryKind; -import org.openhab.binding.hdpowerview.internal.api.ShadePosition; -import org.openhab.binding.hdpowerview.internal.api.responses.SceneCollections; -import org.openhab.binding.hdpowerview.internal.api.responses.SceneCollections.SceneCollection; -import org.openhab.binding.hdpowerview.internal.api.responses.Scenes; -import org.openhab.binding.hdpowerview.internal.api.responses.Scenes.Scene; -import org.openhab.binding.hdpowerview.internal.api.responses.Shades; -import org.openhab.binding.hdpowerview.internal.api.responses.Shades.ShadeData; import org.openhab.binding.hdpowerview.internal.database.ShadeCapabilitiesDatabase; import org.openhab.binding.hdpowerview.internal.database.ShadeCapabilitiesDatabase.Capabilities; +import org.openhab.binding.hdpowerview.internal.dto.BatteryKind; +import org.openhab.binding.hdpowerview.internal.dto.Scene; +import org.openhab.binding.hdpowerview.internal.dto.SceneCollection; +import org.openhab.binding.hdpowerview.internal.dto.ShadeData; +import org.openhab.binding.hdpowerview.internal.dto.ShadePosition; +import org.openhab.binding.hdpowerview.internal.dto.responses.SceneCollections; +import org.openhab.binding.hdpowerview.internal.dto.responses.Scenes; +import org.openhab.binding.hdpowerview.internal.dto.responses.Shades; import org.openhab.core.library.types.PercentType; import org.openhab.core.types.State; import org.openhab.core.types.UnDefType; diff --git a/bundles/org.openhab.binding.hdpowerview/src/test/java/org/openhab/binding/hdpowerview/OnlineCommunicationTest.java b/bundles/org.openhab.binding.hdpowerview/src/test/java/org/openhab/binding/hdpowerview/internal/OnlineCommunicationTest.java similarity index 93% rename from bundles/org.openhab.binding.hdpowerview/src/test/java/org/openhab/binding/hdpowerview/OnlineCommunicationTest.java rename to bundles/org.openhab.binding.hdpowerview/src/test/java/org/openhab/binding/hdpowerview/internal/OnlineCommunicationTest.java index b8670bb91..d5415f675 100644 --- a/bundles/org.openhab.binding.hdpowerview/src/test/java/org/openhab/binding/hdpowerview/OnlineCommunicationTest.java +++ b/bundles/org.openhab.binding.hdpowerview/src/test/java/org/openhab/binding/hdpowerview/internal/OnlineCommunicationTest.java @@ -10,10 +10,10 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.hdpowerview; +package org.openhab.binding.hdpowerview.internal; import static org.junit.jupiter.api.Assertions.*; -import static org.openhab.binding.hdpowerview.internal.api.CoordinateSystem.*; +import static org.openhab.binding.hdpowerview.internal.dto.CoordinateSystem.*; import java.util.List; import java.util.regex.Pattern; @@ -21,14 +21,13 @@ import java.util.regex.Pattern; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jetty.client.HttpClient; import org.junit.jupiter.api.Test; -import org.openhab.binding.hdpowerview.internal.HDPowerViewWebTargets; -import org.openhab.binding.hdpowerview.internal.api.ShadePosition; -import org.openhab.binding.hdpowerview.internal.api.responses.Scenes; -import org.openhab.binding.hdpowerview.internal.api.responses.Scenes.Scene; -import org.openhab.binding.hdpowerview.internal.api.responses.Shades; -import org.openhab.binding.hdpowerview.internal.api.responses.Shades.ShadeData; import org.openhab.binding.hdpowerview.internal.database.ShadeCapabilitiesDatabase; import org.openhab.binding.hdpowerview.internal.database.ShadeCapabilitiesDatabase.Capabilities; +import org.openhab.binding.hdpowerview.internal.dto.Scene; +import org.openhab.binding.hdpowerview.internal.dto.ShadeData; +import org.openhab.binding.hdpowerview.internal.dto.ShadePosition; +import org.openhab.binding.hdpowerview.internal.dto.responses.Scenes; +import org.openhab.binding.hdpowerview.internal.dto.responses.Shades; import org.openhab.binding.hdpowerview.internal.exceptions.HubException; import org.openhab.binding.hdpowerview.internal.exceptions.HubMaintenanceException; import org.openhab.binding.hdpowerview.internal.exceptions.HubProcessingException; diff --git a/bundles/org.openhab.binding.hdpowerview/src/test/java/org/openhab/binding/hdpowerview/SceneChannelBuilderTest.java b/bundles/org.openhab.binding.hdpowerview/src/test/java/org/openhab/binding/hdpowerview/internal/SceneChannelBuilderTest.java similarity index 90% rename from bundles/org.openhab.binding.hdpowerview/src/test/java/org/openhab/binding/hdpowerview/SceneChannelBuilderTest.java rename to bundles/org.openhab.binding.hdpowerview/src/test/java/org/openhab/binding/hdpowerview/internal/SceneChannelBuilderTest.java index eca2a1f2e..4d6be154a 100644 --- a/bundles/org.openhab.binding.hdpowerview/src/test/java/org/openhab/binding/hdpowerview/SceneChannelBuilderTest.java +++ b/bundles/org.openhab.binding.hdpowerview/src/test/java/org/openhab/binding/hdpowerview/internal/SceneChannelBuilderTest.java @@ -10,7 +10,7 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.hdpowerview; +package org.openhab.binding.hdpowerview.internal; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.Mockito.mock; @@ -22,12 +22,10 @@ import java.util.List; import org.eclipse.jdt.annotation.NonNullByDefault; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.openhab.binding.hdpowerview.internal.HDPowerViewBindingConstants; -import org.openhab.binding.hdpowerview.internal.HDPowerViewTranslationProvider; -import org.openhab.binding.hdpowerview.internal.api.responses.Scenes.Scene; import org.openhab.binding.hdpowerview.internal.builders.SceneChannelBuilder; -import org.openhab.binding.hdpowerview.providers.MockedLocaleProvider; -import org.openhab.binding.hdpowerview.providers.MockedTranslationProvider; +import org.openhab.binding.hdpowerview.internal.dto.Scene; +import org.openhab.binding.hdpowerview.internal.providers.MockedLocaleProvider; +import org.openhab.binding.hdpowerview.internal.providers.MockedTranslationProvider; import org.openhab.core.thing.Channel; import org.openhab.core.thing.ChannelGroupUID; import org.openhab.core.thing.ThingUID; diff --git a/bundles/org.openhab.binding.hdpowerview/src/test/java/org/openhab/binding/hdpowerview/SceneGroupChannelBuilderTest.java b/bundles/org.openhab.binding.hdpowerview/src/test/java/org/openhab/binding/hdpowerview/internal/SceneGroupChannelBuilderTest.java similarity index 90% rename from bundles/org.openhab.binding.hdpowerview/src/test/java/org/openhab/binding/hdpowerview/SceneGroupChannelBuilderTest.java rename to bundles/org.openhab.binding.hdpowerview/src/test/java/org/openhab/binding/hdpowerview/internal/SceneGroupChannelBuilderTest.java index e2dc8b1b7..fc1344ea8 100644 --- a/bundles/org.openhab.binding.hdpowerview/src/test/java/org/openhab/binding/hdpowerview/SceneGroupChannelBuilderTest.java +++ b/bundles/org.openhab.binding.hdpowerview/src/test/java/org/openhab/binding/hdpowerview/internal/SceneGroupChannelBuilderTest.java @@ -10,7 +10,7 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.hdpowerview; +package org.openhab.binding.hdpowerview.internal; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.Mockito.mock; @@ -22,12 +22,10 @@ import java.util.List; import org.eclipse.jdt.annotation.NonNullByDefault; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.openhab.binding.hdpowerview.internal.HDPowerViewBindingConstants; -import org.openhab.binding.hdpowerview.internal.HDPowerViewTranslationProvider; -import org.openhab.binding.hdpowerview.internal.api.responses.SceneCollections.SceneCollection; import org.openhab.binding.hdpowerview.internal.builders.SceneGroupChannelBuilder; -import org.openhab.binding.hdpowerview.providers.MockedLocaleProvider; -import org.openhab.binding.hdpowerview.providers.MockedTranslationProvider; +import org.openhab.binding.hdpowerview.internal.dto.SceneCollection; +import org.openhab.binding.hdpowerview.internal.providers.MockedLocaleProvider; +import org.openhab.binding.hdpowerview.internal.providers.MockedTranslationProvider; import org.openhab.core.thing.Channel; import org.openhab.core.thing.ChannelGroupUID; import org.openhab.core.thing.ThingUID; diff --git a/bundles/org.openhab.binding.hdpowerview/src/test/java/org/openhab/binding/hdpowerview/ShadePositionTest.java b/bundles/org.openhab.binding.hdpowerview/src/test/java/org/openhab/binding/hdpowerview/internal/ShadePositionTest.java similarity index 99% rename from bundles/org.openhab.binding.hdpowerview/src/test/java/org/openhab/binding/hdpowerview/ShadePositionTest.java rename to bundles/org.openhab.binding.hdpowerview/src/test/java/org/openhab/binding/hdpowerview/internal/ShadePositionTest.java index 50dcd0e7f..5ced717f2 100644 --- a/bundles/org.openhab.binding.hdpowerview/src/test/java/org/openhab/binding/hdpowerview/ShadePositionTest.java +++ b/bundles/org.openhab.binding.hdpowerview/src/test/java/org/openhab/binding/hdpowerview/internal/ShadePositionTest.java @@ -10,16 +10,16 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.hdpowerview; +package org.openhab.binding.hdpowerview.internal; import static org.junit.jupiter.api.Assertions.*; -import static org.openhab.binding.hdpowerview.internal.api.CoordinateSystem.*; +import static org.openhab.binding.hdpowerview.internal.dto.CoordinateSystem.*; import org.eclipse.jdt.annotation.NonNullByDefault; import org.junit.jupiter.api.Test; -import org.openhab.binding.hdpowerview.internal.api.ShadePosition; import org.openhab.binding.hdpowerview.internal.database.ShadeCapabilitiesDatabase; import org.openhab.binding.hdpowerview.internal.database.ShadeCapabilitiesDatabase.Capabilities; +import org.openhab.binding.hdpowerview.internal.dto.ShadePosition; import org.openhab.core.library.types.PercentType; import org.openhab.core.types.State; import org.openhab.core.types.UnDefType; diff --git a/bundles/org.openhab.binding.hdpowerview/src/test/java/org/openhab/binding/hdpowerview/providers/MockedLocaleProvider.java b/bundles/org.openhab.binding.hdpowerview/src/test/java/org/openhab/binding/hdpowerview/internal/providers/MockedLocaleProvider.java similarity index 92% rename from bundles/org.openhab.binding.hdpowerview/src/test/java/org/openhab/binding/hdpowerview/providers/MockedLocaleProvider.java rename to bundles/org.openhab.binding.hdpowerview/src/test/java/org/openhab/binding/hdpowerview/internal/providers/MockedLocaleProvider.java index 8161cc8e2..d95879f45 100644 --- a/bundles/org.openhab.binding.hdpowerview/src/test/java/org/openhab/binding/hdpowerview/providers/MockedLocaleProvider.java +++ b/bundles/org.openhab.binding.hdpowerview/src/test/java/org/openhab/binding/hdpowerview/internal/providers/MockedLocaleProvider.java @@ -10,7 +10,7 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.hdpowerview.providers; +package org.openhab.binding.hdpowerview.internal.providers; import java.util.Locale; diff --git a/bundles/org.openhab.binding.hdpowerview/src/test/java/org/openhab/binding/hdpowerview/providers/MockedTranslationProvider.java b/bundles/org.openhab.binding.hdpowerview/src/test/java/org/openhab/binding/hdpowerview/internal/providers/MockedTranslationProvider.java similarity index 97% rename from bundles/org.openhab.binding.hdpowerview/src/test/java/org/openhab/binding/hdpowerview/providers/MockedTranslationProvider.java rename to bundles/org.openhab.binding.hdpowerview/src/test/java/org/openhab/binding/hdpowerview/internal/providers/MockedTranslationProvider.java index da7152ad7..9c9503ef1 100644 --- a/bundles/org.openhab.binding.hdpowerview/src/test/java/org/openhab/binding/hdpowerview/providers/MockedTranslationProvider.java +++ b/bundles/org.openhab.binding.hdpowerview/src/test/java/org/openhab/binding/hdpowerview/internal/providers/MockedTranslationProvider.java @@ -10,7 +10,7 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.hdpowerview.providers; +package org.openhab.binding.hdpowerview.internal.providers; import static java.util.Map.entry; diff --git a/bundles/org.openhab.binding.hdpowerview/src/test/resources/org/openhab/binding/hdpowerview/duette.json b/bundles/org.openhab.binding.hdpowerview/src/test/resources/org/openhab/binding/hdpowerview/internal/duette.json similarity index 100% rename from bundles/org.openhab.binding.hdpowerview/src/test/resources/org/openhab/binding/hdpowerview/duette.json rename to bundles/org.openhab.binding.hdpowerview/src/test/resources/org/openhab/binding/hdpowerview/internal/duette.json diff --git a/bundles/org.openhab.binding.hdpowerview/src/test/resources/org/openhab/binding/hdpowerview/sceneCollections.json b/bundles/org.openhab.binding.hdpowerview/src/test/resources/org/openhab/binding/hdpowerview/internal/sceneCollections.json similarity index 100% rename from bundles/org.openhab.binding.hdpowerview/src/test/resources/org/openhab/binding/hdpowerview/sceneCollections.json rename to bundles/org.openhab.binding.hdpowerview/src/test/resources/org/openhab/binding/hdpowerview/internal/sceneCollections.json diff --git a/bundles/org.openhab.binding.hdpowerview/src/test/resources/org/openhab/binding/hdpowerview/scenes.json b/bundles/org.openhab.binding.hdpowerview/src/test/resources/org/openhab/binding/hdpowerview/internal/scenes.json similarity index 100% rename from bundles/org.openhab.binding.hdpowerview/src/test/resources/org/openhab/binding/hdpowerview/scenes.json rename to bundles/org.openhab.binding.hdpowerview/src/test/resources/org/openhab/binding/hdpowerview/internal/scenes.json diff --git a/bundles/org.openhab.binding.hdpowerview/src/test/resources/org/openhab/binding/hdpowerview/shades.json b/bundles/org.openhab.binding.hdpowerview/src/test/resources/org/openhab/binding/hdpowerview/internal/shades.json similarity index 100% rename from bundles/org.openhab.binding.hdpowerview/src/test/resources/org/openhab/binding/hdpowerview/shades.json rename to bundles/org.openhab.binding.hdpowerview/src/test/resources/org/openhab/binding/hdpowerview/internal/shades.json