diff --git a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/LifxChannelFactory.java b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/LifxChannelFactory.java index dca40a8ef1fb5..b507648a71f7d 100644 --- a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/LifxChannelFactory.java +++ b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/LifxChannelFactory.java @@ -19,7 +19,7 @@ /** * The {@link LifxChannelFactory} creates dynamic LIFX channels. * - * @author Wouter Born - Add i18n support + * @author Wouter Born - Initial contribution */ @NonNullByDefault public interface LifxChannelFactory { diff --git a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/LifxChannelFactoryImpl.java b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/LifxChannelFactoryImpl.java index 7c8c3b12ecca4..333c610a7486f 100644 --- a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/LifxChannelFactoryImpl.java +++ b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/LifxChannelFactoryImpl.java @@ -34,7 +34,7 @@ /** * The {@link LifxChannelFactoryImpl} creates dynamic LIFX channels. * - * @author Wouter Born - Add i18n support + * @author Wouter Born - Initial contribution */ @NonNullByDefault @Component(service = LifxChannelFactory.class) diff --git a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/LifxLightCommunicationHandler.java b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/LifxLightCommunicationHandler.java index 375ff33aa8bed..bd27a3a7a83fc 100644 --- a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/LifxLightCommunicationHandler.java +++ b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/LifxLightCommunicationHandler.java @@ -32,12 +32,12 @@ import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; +import org.openhab.binding.lifx.internal.dto.GetServiceRequest; +import org.openhab.binding.lifx.internal.dto.Packet; +import org.openhab.binding.lifx.internal.dto.StateServiceResponse; import org.openhab.binding.lifx.internal.fields.MACAddress; import org.openhab.binding.lifx.internal.handler.LifxLightHandler.CurrentLightState; import org.openhab.binding.lifx.internal.listener.LifxResponsePacketListener; -import org.openhab.binding.lifx.internal.protocol.GetServiceRequest; -import org.openhab.binding.lifx.internal.protocol.Packet; -import org.openhab.binding.lifx.internal.protocol.StateServiceResponse; import org.openhab.binding.lifx.internal.util.LifxNetworkUtil; import org.openhab.binding.lifx.internal.util.LifxSelectorUtil; import org.slf4j.Logger; @@ -46,7 +46,7 @@ /** * The {@link LifxLightCommunicationHandler} is responsible for the communications with a light. * - * @author Wouter Born - Extracted class from LifxLightHandler + * @author Wouter Born - Initial contribution */ @NonNullByDefault public class LifxLightCommunicationHandler { diff --git a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/LifxLightConfig.java b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/LifxLightConfig.java index f39c6fbf5162d..4b193398c824a 100644 --- a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/LifxLightConfig.java +++ b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/LifxLightConfig.java @@ -33,7 +33,7 @@ public class LifxLightConfig { public @Nullable MACAddress getMACAddress() { String localDeviceId = deviceId; - return localDeviceId == null ? null : new MACAddress(localDeviceId, true); + return localDeviceId == null ? null : new MACAddress(localDeviceId); } public @Nullable InetSocketAddress getHost() { diff --git a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/LifxLightContext.java b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/LifxLightContext.java index 254d87921c8b1..633960006b2fa 100644 --- a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/LifxLightContext.java +++ b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/LifxLightContext.java @@ -17,12 +17,11 @@ import org.eclipse.jdt.annotation.NonNullByDefault; import org.openhab.binding.lifx.internal.handler.LifxLightHandler; import org.openhab.binding.lifx.internal.handler.LifxLightHandler.CurrentLightState; -import org.openhab.binding.lifx.internal.protocol.Product; /** * The {@link LifxLightContext} shares the context of a light with {@link LifxLightHandler} helper objects. * - * @author Wouter Born - Add optional host configuration parameter + * @author Wouter Born - Initial contribution */ @NonNullByDefault public class LifxLightContext { @@ -31,10 +30,10 @@ public class LifxLightContext { private final LifxLightConfig configuration; private final CurrentLightState currentLightState; private final LifxLightState pendingLightState; - private final Product product; + private final LifxProduct product; private final ScheduledExecutorService scheduler; - public LifxLightContext(String logId, Product product, LifxLightConfig configuration, + public LifxLightContext(String logId, LifxProduct product, LifxLightConfig configuration, CurrentLightState currentLightState, LifxLightState pendingLightState, ScheduledExecutorService scheduler) { this.logId = logId; this.configuration = configuration; @@ -52,7 +51,7 @@ public LifxLightConfig getConfiguration() { return configuration; } - public Product getProduct() { + public LifxProduct getProduct() { return product; } diff --git a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/LifxLightCurrentStateUpdater.java b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/LifxLightCurrentStateUpdater.java index ad94aa26514f5..910c8b778783f 100644 --- a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/LifxLightCurrentStateUpdater.java +++ b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/LifxLightCurrentStateUpdater.java @@ -13,7 +13,7 @@ package org.openhab.binding.lifx.internal; import static org.openhab.binding.lifx.internal.LifxBindingConstants.MIN_ZONE_INDEX; -import static org.openhab.binding.lifx.internal.protocol.Product.Feature.*; +import static org.openhab.binding.lifx.internal.LifxProduct.Feature.*; import static org.openhab.binding.lifx.internal.util.LifxMessageUtil.infraredToPercentType; import java.util.concurrent.ScheduledExecutorService; @@ -23,22 +23,21 @@ import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; +import org.openhab.binding.lifx.internal.dto.GetColorZonesRequest; +import org.openhab.binding.lifx.internal.dto.GetLightInfraredRequest; +import org.openhab.binding.lifx.internal.dto.GetRequest; +import org.openhab.binding.lifx.internal.dto.GetTileEffectRequest; +import org.openhab.binding.lifx.internal.dto.GetWifiInfoRequest; +import org.openhab.binding.lifx.internal.dto.Packet; +import org.openhab.binding.lifx.internal.dto.StateLightInfraredResponse; +import org.openhab.binding.lifx.internal.dto.StateLightPowerResponse; +import org.openhab.binding.lifx.internal.dto.StateMultiZoneResponse; +import org.openhab.binding.lifx.internal.dto.StatePowerResponse; +import org.openhab.binding.lifx.internal.dto.StateResponse; +import org.openhab.binding.lifx.internal.dto.StateTileEffectResponse; +import org.openhab.binding.lifx.internal.dto.StateWifiInfoResponse; import org.openhab.binding.lifx.internal.fields.HSBK; import org.openhab.binding.lifx.internal.handler.LifxLightHandler.CurrentLightState; -import org.openhab.binding.lifx.internal.protocol.GetColorZonesRequest; -import org.openhab.binding.lifx.internal.protocol.GetLightInfraredRequest; -import org.openhab.binding.lifx.internal.protocol.GetRequest; -import org.openhab.binding.lifx.internal.protocol.GetTileEffectRequest; -import org.openhab.binding.lifx.internal.protocol.GetWifiInfoRequest; -import org.openhab.binding.lifx.internal.protocol.Packet; -import org.openhab.binding.lifx.internal.protocol.Product; -import org.openhab.binding.lifx.internal.protocol.StateLightInfraredResponse; -import org.openhab.binding.lifx.internal.protocol.StateLightPowerResponse; -import org.openhab.binding.lifx.internal.protocol.StateMultiZoneResponse; -import org.openhab.binding.lifx.internal.protocol.StatePowerResponse; -import org.openhab.binding.lifx.internal.protocol.StateResponse; -import org.openhab.binding.lifx.internal.protocol.StateTileEffectResponse; -import org.openhab.binding.lifx.internal.protocol.StateWifiInfoResponse; import org.openhab.core.library.types.PercentType; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -47,7 +46,7 @@ * The {@link LifxLightCurrentStateUpdater} sends packets to a light in order to update the {@code currentLightState} to * the actual light state. * - * @author Wouter Born - Extracted class from LifxLightHandler + * @author Wouter Born - Initial contribution */ @NonNullByDefault public class LifxLightCurrentStateUpdater { @@ -57,7 +56,7 @@ public class LifxLightCurrentStateUpdater { private final Logger logger = LoggerFactory.getLogger(LifxLightCurrentStateUpdater.class); private final String logId; - private final Product product; + private final LifxProduct product; private final CurrentLightState currentLightState; private final ScheduledExecutorService scheduler; private final LifxLightCommunicationHandler communicationHandler; diff --git a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/LifxLightDiscovery.java b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/LifxLightDiscovery.java index 21011010dbe48..cfadb13a671b9 100644 --- a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/LifxLightDiscovery.java +++ b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/LifxLightDiscovery.java @@ -26,18 +26,16 @@ import java.util.concurrent.TimeUnit; import java.util.function.Supplier; -import org.apache.commons.lang.StringUtils; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; +import org.openhab.binding.lifx.internal.dto.GetLabelRequest; +import org.openhab.binding.lifx.internal.dto.GetServiceRequest; +import org.openhab.binding.lifx.internal.dto.GetVersionRequest; +import org.openhab.binding.lifx.internal.dto.Packet; +import org.openhab.binding.lifx.internal.dto.StateLabelResponse; +import org.openhab.binding.lifx.internal.dto.StateServiceResponse; +import org.openhab.binding.lifx.internal.dto.StateVersionResponse; import org.openhab.binding.lifx.internal.fields.MACAddress; -import org.openhab.binding.lifx.internal.protocol.GetLabelRequest; -import org.openhab.binding.lifx.internal.protocol.GetServiceRequest; -import org.openhab.binding.lifx.internal.protocol.GetVersionRequest; -import org.openhab.binding.lifx.internal.protocol.Packet; -import org.openhab.binding.lifx.internal.protocol.Product; -import org.openhab.binding.lifx.internal.protocol.StateLabelResponse; -import org.openhab.binding.lifx.internal.protocol.StateServiceResponse; -import org.openhab.binding.lifx.internal.protocol.StateVersionResponse; import org.openhab.binding.lifx.internal.util.LifxSelectorUtil; import org.openhab.core.config.discovery.AbstractDiscoveryService; import org.openhab.core.config.discovery.DiscoveryResult; @@ -87,7 +85,7 @@ private class DiscoveredLight { private InetSocketAddress socketAddress; private String logId; private @Nullable String label; - private @Nullable Product product; + private @Nullable LifxProduct product; private long productVersion; private boolean supportedProduct = true; private LifxSelectorContext selectorContext; @@ -300,7 +298,8 @@ private void handlePacket(Packet packet, InetSocketAddress address) { light.label = ((StateLabelResponse) packet).getLabel().trim(); } else if (packet instanceof StateVersionResponse) { try { - light.product = Product.getProductFromProductID(((StateVersionResponse) packet).getProduct()); + light.product = LifxProduct + .getProductFromProductID(((StateVersionResponse) packet).getProduct()); light.productVersion = ((StateVersionResponse) packet).getVersion(); } catch (IllegalArgumentException e) { logger.debug("Discovered an unsupported light ({}): {}", light.macAddress.getAsLabel(), @@ -322,7 +321,7 @@ private void handlePacket(Packet packet, InetSocketAddress address) { } private DiscoveryResult createDiscoveryResult(DiscoveredLight light) throws IllegalArgumentException { - Product product = light.product; + LifxProduct product = light.product; if (product == null) { throw new IllegalArgumentException("Product of discovered light is null"); } @@ -331,7 +330,7 @@ private DiscoveryResult createDiscoveryResult(DiscoveredLight light) throws Ille ThingUID thingUID = new ThingUID(product.getThingTypeUID(), macAsLabel); String label = light.label; - if (StringUtils.isBlank(label)) { + if (label == null || label.isBlank()) { label = product.getName(); } diff --git a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/LifxLightOnlineStateUpdater.java b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/LifxLightOnlineStateUpdater.java index c40400e3678ba..62ef83091cdf9 100644 --- a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/LifxLightOnlineStateUpdater.java +++ b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/LifxLightOnlineStateUpdater.java @@ -21,17 +21,17 @@ import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; +import org.openhab.binding.lifx.internal.dto.GetEchoRequest; +import org.openhab.binding.lifx.internal.dto.GetServiceRequest; +import org.openhab.binding.lifx.internal.dto.Packet; import org.openhab.binding.lifx.internal.handler.LifxLightHandler.CurrentLightState; -import org.openhab.binding.lifx.internal.protocol.GetEchoRequest; -import org.openhab.binding.lifx.internal.protocol.GetServiceRequest; -import org.openhab.binding.lifx.internal.protocol.Packet; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * The {@link LifxLightOnlineStateUpdater} sets the state of a light offline when it no longer responds to echo packets. * - * @author Wouter Born - Extracted class from LifxLightHandler + * @author Wouter Born - Initial contribution */ @NonNullByDefault public class LifxLightOnlineStateUpdater { diff --git a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/LifxLightPropertiesUpdater.java b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/LifxLightPropertiesUpdater.java index 7be78cffbd52c..9de0a75ff6f6a 100644 --- a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/LifxLightPropertiesUpdater.java +++ b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/LifxLightPropertiesUpdater.java @@ -27,17 +27,16 @@ import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; +import org.openhab.binding.lifx.internal.dto.GetHostFirmwareRequest; +import org.openhab.binding.lifx.internal.dto.GetVersionRequest; +import org.openhab.binding.lifx.internal.dto.GetWifiFirmwareRequest; +import org.openhab.binding.lifx.internal.dto.Packet; +import org.openhab.binding.lifx.internal.dto.StateHostFirmwareResponse; +import org.openhab.binding.lifx.internal.dto.StateVersionResponse; +import org.openhab.binding.lifx.internal.dto.StateWifiFirmwareResponse; import org.openhab.binding.lifx.internal.fields.MACAddress; import org.openhab.binding.lifx.internal.handler.LifxLightHandler.CurrentLightState; import org.openhab.binding.lifx.internal.listener.LifxPropertiesUpdateListener; -import org.openhab.binding.lifx.internal.protocol.GetHostFirmwareRequest; -import org.openhab.binding.lifx.internal.protocol.GetVersionRequest; -import org.openhab.binding.lifx.internal.protocol.GetWifiFirmwareRequest; -import org.openhab.binding.lifx.internal.protocol.Packet; -import org.openhab.binding.lifx.internal.protocol.Product; -import org.openhab.binding.lifx.internal.protocol.StateHostFirmwareResponse; -import org.openhab.binding.lifx.internal.protocol.StateVersionResponse; -import org.openhab.binding.lifx.internal.protocol.StateWifiFirmwareResponse; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -45,7 +44,7 @@ * The {@link LifxLightPropertiesUpdater} updates the light properties when a light goes online. When packets get lost * the requests are resent when the {@code UPDATE_INTERVAL} elapses. * - * @author Wouter Born - Update light properties when online + * @author Wouter Born - Initial contribution */ @NonNullByDefault public class LifxLightPropertiesUpdater { @@ -157,7 +156,7 @@ public void handleResponsePacket(Packet packet) { properties.put(LifxBindingConstants.PROPERTY_PRODUCT_VERSION, Long.toString(productVersion)); try { - Product product = Product.getProductFromProductID(productId); + LifxProduct product = LifxProduct.getProductFromProductID(productId); properties.put(LifxBindingConstants.PROPERTY_PRODUCT_NAME, product.getName()); properties.put(LifxBindingConstants.PROPERTY_VENDOR_ID, Long.toString(product.getVendor().getID())); properties.put(LifxBindingConstants.PROPERTY_VENDOR_NAME, product.getVendor().getName()); diff --git a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/LifxLightState.java b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/LifxLightState.java index a4db52c45cfe6..b3bbefaf201a7 100644 --- a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/LifxLightState.java +++ b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/LifxLightState.java @@ -22,11 +22,11 @@ import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; +import org.openhab.binding.lifx.internal.dto.Effect; +import org.openhab.binding.lifx.internal.dto.PowerState; +import org.openhab.binding.lifx.internal.dto.SignalStrength; import org.openhab.binding.lifx.internal.fields.HSBK; import org.openhab.binding.lifx.internal.listener.LifxLightStateListener; -import org.openhab.binding.lifx.internal.protocol.Effect; -import org.openhab.binding.lifx.internal.protocol.PowerState; -import org.openhab.binding.lifx.internal.protocol.SignalStrength; import org.openhab.core.library.types.HSBType; import org.openhab.core.library.types.OnOffType; import org.openhab.core.library.types.PercentType; @@ -34,7 +34,7 @@ /** * The {@link LifxLightState} stores the properties that represent the state of a light. * - * @author Wouter Born - Extracted class from LifxLightHandler, added listener logic + * @author Wouter Born - Initial contribution */ @NonNullByDefault public class LifxLightState { diff --git a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/LifxLightStateChanger.java b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/LifxLightStateChanger.java index 4e2ccd16ab8ec..c2ee8d1c9ba42 100644 --- a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/LifxLightStateChanger.java +++ b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/LifxLightStateChanger.java @@ -13,7 +13,7 @@ package org.openhab.binding.lifx.internal; import static org.openhab.binding.lifx.internal.LifxBindingConstants.PACKET_INTERVAL; -import static org.openhab.binding.lifx.internal.protocol.Product.Feature.MULTIZONE; +import static org.openhab.binding.lifx.internal.LifxProduct.Feature.MULTIZONE; import static org.openhab.binding.lifx.internal.util.LifxMessageUtil.*; import java.time.Duration; @@ -29,25 +29,24 @@ import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; +import org.openhab.binding.lifx.internal.dto.AcknowledgementResponse; +import org.openhab.binding.lifx.internal.dto.ApplicationRequest; +import org.openhab.binding.lifx.internal.dto.Effect; +import org.openhab.binding.lifx.internal.dto.GetColorZonesRequest; +import org.openhab.binding.lifx.internal.dto.GetLightInfraredRequest; +import org.openhab.binding.lifx.internal.dto.GetLightPowerRequest; +import org.openhab.binding.lifx.internal.dto.GetRequest; +import org.openhab.binding.lifx.internal.dto.Packet; +import org.openhab.binding.lifx.internal.dto.PowerState; +import org.openhab.binding.lifx.internal.dto.SetColorRequest; +import org.openhab.binding.lifx.internal.dto.SetColorZonesRequest; +import org.openhab.binding.lifx.internal.dto.SetLightInfraredRequest; +import org.openhab.binding.lifx.internal.dto.SetLightPowerRequest; +import org.openhab.binding.lifx.internal.dto.SetPowerRequest; +import org.openhab.binding.lifx.internal.dto.SetTileEffectRequest; +import org.openhab.binding.lifx.internal.dto.SignalStrength; import org.openhab.binding.lifx.internal.fields.HSBK; import org.openhab.binding.lifx.internal.listener.LifxLightStateListener; -import org.openhab.binding.lifx.internal.protocol.AcknowledgementResponse; -import org.openhab.binding.lifx.internal.protocol.ApplicationRequest; -import org.openhab.binding.lifx.internal.protocol.Effect; -import org.openhab.binding.lifx.internal.protocol.GetColorZonesRequest; -import org.openhab.binding.lifx.internal.protocol.GetLightInfraredRequest; -import org.openhab.binding.lifx.internal.protocol.GetLightPowerRequest; -import org.openhab.binding.lifx.internal.protocol.GetRequest; -import org.openhab.binding.lifx.internal.protocol.Packet; -import org.openhab.binding.lifx.internal.protocol.PowerState; -import org.openhab.binding.lifx.internal.protocol.Product; -import org.openhab.binding.lifx.internal.protocol.SetColorRequest; -import org.openhab.binding.lifx.internal.protocol.SetColorZonesRequest; -import org.openhab.binding.lifx.internal.protocol.SetLightInfraredRequest; -import org.openhab.binding.lifx.internal.protocol.SetLightPowerRequest; -import org.openhab.binding.lifx.internal.protocol.SetPowerRequest; -import org.openhab.binding.lifx.internal.protocol.SetTileEffectRequest; -import org.openhab.binding.lifx.internal.protocol.SignalStrength; import org.openhab.core.library.types.PercentType; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -57,7 +56,7 @@ * light so the change the actual light state to that of the {@code pendingLightState}. When the light does not * acknowledge a packet, it resends it (max 3 times). * - * @author Wouter Born - Extracted class from LifxLightHandler, added logic for handling packet loss + * @author Wouter Born - Initial contribution */ @NonNullByDefault public class LifxLightStateChanger implements LifxLightStateListener { @@ -75,7 +74,7 @@ public class LifxLightStateChanger implements LifxLightStateListener { private final Logger logger = LoggerFactory.getLogger(LifxLightStateChanger.class); private final String logId; - private final Product product; + private final LifxProduct product; private final Duration fadeTime; private final LifxLightState pendingLightState; private final ScheduledExecutorService scheduler; diff --git a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/Product.java b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/LifxProduct.java similarity index 88% rename from bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/Product.java rename to bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/LifxProduct.java index cee8e8d04dd79..0416d378e2309 100644 --- a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/Product.java +++ b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/LifxProduct.java @@ -10,17 +10,16 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.lifx.internal.protocol; +package org.openhab.binding.lifx.internal; -import static org.openhab.binding.lifx.internal.protocol.Product.Feature.*; -import static org.openhab.binding.lifx.internal.protocol.Product.TemperatureRange.*; -import static org.openhab.binding.lifx.internal.protocol.Product.Vendor.LIFX; +import static org.openhab.binding.lifx.internal.LifxProduct.Feature.*; +import static org.openhab.binding.lifx.internal.LifxProduct.TemperatureRange.*; +import static org.openhab.binding.lifx.internal.LifxProduct.Vendor.LIFX; import java.util.Arrays; import java.util.EnumSet; import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.binding.lifx.internal.LifxBindingConstants; import org.openhab.core.thing.ThingTypeUID; /** @@ -28,11 +27,11 @@ * * @see https://lan.developer.lifx.com/docs/lifx-products * - * @author Wouter Born - Support LIFX 2016 product line-up and infrared functionality + * @author Wouter Born - Initial contribution * @author Wouter Born - Add temperature ranges and simplify feature definitions */ @NonNullByDefault -public enum Product { +public enum LifxProduct { PRODUCT_1(1, "LIFX Original 1000", TR_2500_9000, COLOR), PRODUCT_3(3, "LIFX Color 650", TR_2500_9000, COLOR), @@ -215,19 +214,19 @@ public int getRange() { private final TemperatureRange temperatureRange; private final EnumSet features = EnumSet.noneOf(Feature.class); - private Product(long id, String name, TemperatureRange temperatureRange) { + private LifxProduct(long id, String name, TemperatureRange temperatureRange) { this(LIFX, id, name, temperatureRange); } - private Product(long id, String name, TemperatureRange temperatureRange, Feature... features) { + private LifxProduct(long id, String name, TemperatureRange temperatureRange, Feature... features) { this(LIFX, id, name, temperatureRange, features); } - private Product(Vendor vendor, long id, String name, TemperatureRange temperatureRange) { + private LifxProduct(Vendor vendor, long id, String name, TemperatureRange temperatureRange) { this(vendor, id, name, temperatureRange, new Feature[0]); } - private Product(Vendor vendor, long id, String name, TemperatureRange temperatureRange, Feature... features) { + private LifxProduct(Vendor vendor, long id, String name, TemperatureRange temperatureRange, Feature... features) { this.vendor = vendor; this.id = id; this.name = name; @@ -283,8 +282,8 @@ public boolean hasFeature(Feature feature) { * @return a product that has the given thing type UID * @throws IllegalArgumentException when uid is not a valid LIFX thing type UID */ - public static Product getLikelyProduct(ThingTypeUID uid) throws IllegalArgumentException { - for (Product product : Product.values()) { + public static LifxProduct getLikelyProduct(ThingTypeUID uid) throws IllegalArgumentException { + for (LifxProduct product : LifxProduct.values()) { if (product.getThingTypeUID().equals(uid)) { return product; } @@ -300,8 +299,8 @@ public static Product getLikelyProduct(ThingTypeUID uid) throws IllegalArgumentE * @return the product that has the given product ID * @throws IllegalArgumentException when id is not a valid LIFX product ID */ - public static Product getProductFromProductID(long id) throws IllegalArgumentException { - for (Product product : Product.values()) { + public static LifxProduct getProductFromProductID(long id) throws IllegalArgumentException { + for (LifxProduct product : LifxProduct.values()) { if (product.id == id) { return product; } diff --git a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/LifxSelectorContext.java b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/LifxSelectorContext.java index 0cd6f671959a4..bc7f3ffd3a59c 100644 --- a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/LifxSelectorContext.java +++ b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/LifxSelectorContext.java @@ -25,7 +25,7 @@ * The {@link LifxSelectorContext} stores the context that is used for broadcast and unicast communications with a * light using a {@link Selector}. * - * @author Wouter Born - Make selector logic reusable between discovery and handlers + * @author Wouter Born - Initial contribution */ @NonNullByDefault public class LifxSelectorContext { diff --git a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/LifxSequenceNumberSupplier.java b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/LifxSequenceNumberSupplier.java index 5f9e10899153a..1d94e146389b5 100644 --- a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/LifxSequenceNumberSupplier.java +++ b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/LifxSequenceNumberSupplier.java @@ -20,7 +20,7 @@ /** * Supplies sequence numbers for packets in the range [0, 255]. * - * @author Wouter Born - Make selector logic reusable between discovery and handlers + * @author Wouter Born - Initial contribution */ @NonNullByDefault public class LifxSequenceNumberSupplier implements Supplier { diff --git a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/AcknowledgementResponse.java b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/AcknowledgementResponse.java similarity index 91% rename from bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/AcknowledgementResponse.java rename to bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/AcknowledgementResponse.java index 79eb57808d134..74ace861ab219 100644 --- a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/AcknowledgementResponse.java +++ b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/AcknowledgementResponse.java @@ -10,12 +10,12 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.lifx.internal.protocol; +package org.openhab.binding.lifx.internal.dto; import java.nio.ByteBuffer; /** - * @author Tim Buckley - Initial Contribution + * @author Tim Buckley - Initial contribution * @author Karel Goderis - Enhancement for the V2 LIFX Firmware and LAN Protocol Specification */ public class AcknowledgementResponse extends Packet { diff --git a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/ApplicationRequest.java b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/ApplicationRequest.java similarity index 93% rename from bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/ApplicationRequest.java rename to bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/ApplicationRequest.java index 233cfde2bda09..9e53718a873b8 100644 --- a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/ApplicationRequest.java +++ b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/ApplicationRequest.java @@ -10,10 +10,10 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.lifx.internal.protocol; +package org.openhab.binding.lifx.internal.dto; /** - * @author Wouter Born - Add support for MultiZone light control + * @author Wouter Born - Initial contribution */ public enum ApplicationRequest { diff --git a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/EchoRequestResponse.java b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/EchoRequestResponse.java similarity index 94% rename from bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/EchoRequestResponse.java rename to bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/EchoRequestResponse.java index 8ea752276bbea..058a76031a22b 100644 --- a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/EchoRequestResponse.java +++ b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/EchoRequestResponse.java @@ -10,7 +10,7 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.lifx.internal.protocol; +package org.openhab.binding.lifx.internal.dto; import java.nio.ByteBuffer; @@ -18,7 +18,7 @@ import org.openhab.binding.lifx.internal.fields.Field; /** - * @author Tim Buckley - Initial Contribution + * @author Tim Buckley - Initial contribution * @author Karel Goderis - Enhancement for the V2 LIFX Firmware and LAN Protocol Specification */ public class EchoRequestResponse extends Packet { diff --git a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/Effect.java b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/Effect.java similarity index 98% rename from bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/Effect.java rename to bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/Effect.java index 73f9d6437df6c..2490e22633585 100644 --- a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/Effect.java +++ b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/Effect.java @@ -10,7 +10,7 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.lifx.internal.protocol; +package org.openhab.binding.lifx.internal.dto; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; @@ -20,7 +20,7 @@ /** * This class represents LIFX Tile effect * - * @author Pawel Pieczul - initial contribution + * @author Pawel Pieczul - Initial contribution */ @NonNullByDefault public class Effect { diff --git a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/GenericHandler.java b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/GenericHandler.java similarity index 95% rename from bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/GenericHandler.java rename to bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/GenericHandler.java index 13127f9fc3168..8447c2d27b2b4 100644 --- a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/GenericHandler.java +++ b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/GenericHandler.java @@ -10,7 +10,7 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.lifx.internal.protocol; +package org.openhab.binding.lifx.internal.dto; import java.lang.reflect.Constructor; import java.lang.reflect.Field; @@ -27,7 +27,7 @@ * * @param the packet subtype this handler constructs * - * @author Tim Buckley - Initial Contribution + * @author Tim Buckley - Initial contribution * @author Karel Goderis - Enhancement for the V2 LIFX Firmware and LAN Protocol Specification */ @NonNullByDefault diff --git a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/GenericPacket.java b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/GenericPacket.java similarity index 90% rename from bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/GenericPacket.java rename to bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/GenericPacket.java index 49667965ad1b2..b0a738054b470 100644 --- a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/GenericPacket.java +++ b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/GenericPacket.java @@ -10,12 +10,12 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.lifx.internal.protocol; +package org.openhab.binding.lifx.internal.dto; import java.nio.ByteBuffer; /** - * @author Tim Buckley - Initial Contribution + * @author Tim Buckley - Initial contribution * @author Karel Goderis - Enhancement for the V2 LIFX Firmware and LAN Protocol Specification */ public class GenericPacket extends Packet { diff --git a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/GetColorZonesRequest.java b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/GetColorZonesRequest.java similarity index 94% rename from bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/GetColorZonesRequest.java rename to bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/GetColorZonesRequest.java index c53515412db75..fbdc0ddec7c86 100644 --- a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/GetColorZonesRequest.java +++ b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/GetColorZonesRequest.java @@ -10,7 +10,7 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.lifx.internal.protocol; +package org.openhab.binding.lifx.internal.dto; import static org.openhab.binding.lifx.internal.LifxBindingConstants.*; @@ -20,7 +20,7 @@ import org.openhab.binding.lifx.internal.fields.UInt8Field; /** - * @author Wouter Born - Add support for MultiZone light control + * @author Wouter Born - Initial contribution */ public class GetColorZonesRequest extends Packet { diff --git a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/GetEchoRequest.java b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/GetEchoRequest.java similarity index 95% rename from bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/GetEchoRequest.java rename to bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/GetEchoRequest.java index 43b0fc262bff5..be09a903d5ab9 100644 --- a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/GetEchoRequest.java +++ b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/GetEchoRequest.java @@ -10,7 +10,7 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.lifx.internal.protocol; +package org.openhab.binding.lifx.internal.dto; import java.nio.ByteBuffer; @@ -18,7 +18,7 @@ import org.openhab.binding.lifx.internal.fields.Field; /** - * @author Tim Buckley - Initial Contribution + * @author Tim Buckley - Initial contribution * @author Karel Goderis - Enhancement for the V2 LIFX Firmware and LAN Protocol Specification */ public class GetEchoRequest extends Packet { diff --git a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/GetGroupRequest.java b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/GetGroupRequest.java similarity index 92% rename from bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/GetGroupRequest.java rename to bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/GetGroupRequest.java index 8bb6cf23e4c24..a6f8e134b994b 100644 --- a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/GetGroupRequest.java +++ b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/GetGroupRequest.java @@ -10,12 +10,12 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.lifx.internal.protocol; +package org.openhab.binding.lifx.internal.dto; import java.nio.ByteBuffer; /** - * @author Tim Buckley - Initial Contribution + * @author Tim Buckley - Initial contribution * @author Karel Goderis - Enhancement for the V2 LIFX Firmware and LAN Protocol Specification */ public class GetGroupRequest extends Packet { diff --git a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/GetHostFirmwareRequest.java b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/GetHostFirmwareRequest.java similarity index 92% rename from bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/GetHostFirmwareRequest.java rename to bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/GetHostFirmwareRequest.java index 9905cecec2553..814f8738e6437 100644 --- a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/GetHostFirmwareRequest.java +++ b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/GetHostFirmwareRequest.java @@ -10,12 +10,12 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.lifx.internal.protocol; +package org.openhab.binding.lifx.internal.dto; import java.nio.ByteBuffer; /** - * @author Tim Buckley - Initial Contribution + * @author Tim Buckley - Initial contribution * @author Karel Goderis - Enhancement for the V2 LIFX Firmware and LAN Protocol Specification */ public class GetHostFirmwareRequest extends Packet { diff --git a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/GetHostInfoRequest.java b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/GetHostInfoRequest.java similarity index 92% rename from bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/GetHostInfoRequest.java rename to bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/GetHostInfoRequest.java index 290c934c42987..a2f1b5131e17b 100644 --- a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/GetHostInfoRequest.java +++ b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/GetHostInfoRequest.java @@ -10,12 +10,12 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.lifx.internal.protocol; +package org.openhab.binding.lifx.internal.dto; import java.nio.ByteBuffer; /** - * @author Tim Buckley - Initial Contribution + * @author Tim Buckley - Initial contribution * @author Karel Goderis - Enhancement for the V2 LIFX Firmware and LAN Protocol Specification */ public class GetHostInfoRequest extends Packet { diff --git a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/GetInfoRequest.java b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/GetInfoRequest.java similarity index 92% rename from bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/GetInfoRequest.java rename to bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/GetInfoRequest.java index 33e830f987083..47212e8648ec0 100644 --- a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/GetInfoRequest.java +++ b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/GetInfoRequest.java @@ -10,12 +10,12 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.lifx.internal.protocol; +package org.openhab.binding.lifx.internal.dto; import java.nio.ByteBuffer; /** - * @author Tim Buckley - Initial Contribution + * @author Tim Buckley - Initial contribution * @author Karel Goderis - Enhancement for the V2 LIFX Firmware and LAN Protocol Specification */ public class GetInfoRequest extends Packet { diff --git a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/GetLabelRequest.java b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/GetLabelRequest.java similarity index 92% rename from bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/GetLabelRequest.java rename to bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/GetLabelRequest.java index 20d6b5a03b3d1..681ac98ad90f3 100644 --- a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/GetLabelRequest.java +++ b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/GetLabelRequest.java @@ -10,12 +10,12 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.lifx.internal.protocol; +package org.openhab.binding.lifx.internal.dto; import java.nio.ByteBuffer; /** - * @author Tim Buckley - Initial Contribution + * @author Tim Buckley - Initial contribution * @author Karel Goderis - Enhancement for the V2 LIFX Firmware and LAN Protocol Specification */ public class GetLabelRequest extends Packet { diff --git a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/GetLightInfraredRequest.java b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/GetLightInfraredRequest.java similarity index 89% rename from bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/GetLightInfraredRequest.java rename to bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/GetLightInfraredRequest.java index 1297026e87b4c..f4b2ce1d88b9e 100644 --- a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/GetLightInfraredRequest.java +++ b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/GetLightInfraredRequest.java @@ -10,12 +10,12 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.lifx.internal.protocol; +package org.openhab.binding.lifx.internal.dto; import java.nio.ByteBuffer; /** - * @author Wouter Born - Support LIFX 2016 product line-up and infrared functionality + * @author Wouter Born - Initial contribution */ public class GetLightInfraredRequest extends Packet { diff --git a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/GetLightPowerRequest.java b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/GetLightPowerRequest.java similarity index 92% rename from bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/GetLightPowerRequest.java rename to bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/GetLightPowerRequest.java index d8853b7a44a21..2fe69366d0a94 100644 --- a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/GetLightPowerRequest.java +++ b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/GetLightPowerRequest.java @@ -10,12 +10,12 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.lifx.internal.protocol; +package org.openhab.binding.lifx.internal.dto; import java.nio.ByteBuffer; /** - * @author Tim Buckley - Initial Contribution + * @author Tim Buckley - Initial contribution * @author Karel Goderis - Enhancement for the V2 LIFX Firmware and LAN Protocol Specification */ public class GetLightPowerRequest extends Packet { diff --git a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/GetLocationRequest.java b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/GetLocationRequest.java similarity index 92% rename from bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/GetLocationRequest.java rename to bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/GetLocationRequest.java index abf7b8337fcae..af75939bee782 100644 --- a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/GetLocationRequest.java +++ b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/GetLocationRequest.java @@ -10,12 +10,12 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.lifx.internal.protocol; +package org.openhab.binding.lifx.internal.dto; import java.nio.ByteBuffer; /** - * @author Tim Buckley - Initial Contribution + * @author Tim Buckley - Initial contribution * @author Karel Goderis - Enhancement for the V2 LIFX Firmware and LAN Protocol Specification */ public class GetLocationRequest extends Packet { diff --git a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/GetPowerRequest.java b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/GetPowerRequest.java similarity index 92% rename from bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/GetPowerRequest.java rename to bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/GetPowerRequest.java index 6e09a2d79dfd6..2b9bfdddbcc01 100644 --- a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/GetPowerRequest.java +++ b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/GetPowerRequest.java @@ -10,12 +10,12 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.lifx.internal.protocol; +package org.openhab.binding.lifx.internal.dto; import java.nio.ByteBuffer; /** - * @author Tim Buckley - Initial Contribution + * @author Tim Buckley - Initial contribution * @author Karel Goderis - Enhancement for the V2 LIFX Firmware and LAN Protocol Specification */ public class GetPowerRequest extends Packet { diff --git a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/GetRequest.java b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/GetRequest.java similarity index 92% rename from bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/GetRequest.java rename to bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/GetRequest.java index 3f11ae49ecea7..ab64dc6d50f15 100644 --- a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/GetRequest.java +++ b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/GetRequest.java @@ -10,12 +10,12 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.lifx.internal.protocol; +package org.openhab.binding.lifx.internal.dto; import java.nio.ByteBuffer; /** - * @author Tim Buckley - Initial Contribution + * @author Tim Buckley - Initial contribution * @author Karel Goderis - Enhancement for the V2 LIFX Firmware and LAN Protocol Specification */ public class GetRequest extends Packet { diff --git a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/GetServiceRequest.java b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/GetServiceRequest.java similarity index 92% rename from bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/GetServiceRequest.java rename to bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/GetServiceRequest.java index 400a19bb58dec..b0b8d745df9b9 100644 --- a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/GetServiceRequest.java +++ b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/GetServiceRequest.java @@ -10,12 +10,12 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.lifx.internal.protocol; +package org.openhab.binding.lifx.internal.dto; import java.nio.ByteBuffer; /** - * @author Tim Buckley - Initial Contribution + * @author Tim Buckley - Initial contribution * @author Karel Goderis - Enhancement for the V2 LIFX Firmware and LAN Protocol Specification */ public class GetServiceRequest extends Packet { diff --git a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/GetTagLabelsRequest.java b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/GetTagLabelsRequest.java similarity index 93% rename from bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/GetTagLabelsRequest.java rename to bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/GetTagLabelsRequest.java index 39aeb592e01d0..c3c313e95667a 100644 --- a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/GetTagLabelsRequest.java +++ b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/GetTagLabelsRequest.java @@ -10,7 +10,7 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.lifx.internal.protocol; +package org.openhab.binding.lifx.internal.dto; import java.nio.ByteBuffer; @@ -18,7 +18,7 @@ import org.openhab.binding.lifx.internal.fields.UInt64Field; /** - * @author Tim Buckley - Initial Contribution + * @author Tim Buckley - Initial contribution * @author Karel Goderis - Enhancement for the V2 LIFX Firmware and LAN Protocol Specification */ public class GetTagLabelsRequest extends Packet { diff --git a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/GetTagsRequest.java b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/GetTagsRequest.java similarity index 91% rename from bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/GetTagsRequest.java rename to bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/GetTagsRequest.java index 1b76a2df2f5e7..c0570cca52912 100644 --- a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/GetTagsRequest.java +++ b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/GetTagsRequest.java @@ -10,12 +10,12 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.lifx.internal.protocol; +package org.openhab.binding.lifx.internal.dto; import java.nio.ByteBuffer; /** - * @author Tim Buckley - Initial Contribution + * @author Tim Buckley - Initial contribution * @author Karel Goderis - Enhancement for the V2 LIFX Firmware and LAN Protocol Specification */ public class GetTagsRequest extends Packet { diff --git a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/GetTileEffectRequest.java b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/GetTileEffectRequest.java similarity index 91% rename from bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/GetTileEffectRequest.java rename to bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/GetTileEffectRequest.java index afb4fa641f21e..fde9dcc647d1e 100644 --- a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/GetTileEffectRequest.java +++ b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/GetTileEffectRequest.java @@ -10,14 +10,14 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.lifx.internal.protocol; +package org.openhab.binding.lifx.internal.dto; import java.nio.ByteBuffer; /** * Implementation of GetTileEffect packet - * - * @author Pawel Pieczul - Add support for Tile Effects + * + * @author Pawel Pieczul - Initial contribution */ public class GetTileEffectRequest extends Packet { diff --git a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/GetVersionRequest.java b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/GetVersionRequest.java similarity index 92% rename from bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/GetVersionRequest.java rename to bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/GetVersionRequest.java index 9e789f8793844..a278480581579 100644 --- a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/GetVersionRequest.java +++ b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/GetVersionRequest.java @@ -10,12 +10,12 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.lifx.internal.protocol; +package org.openhab.binding.lifx.internal.dto; import java.nio.ByteBuffer; /** - * @author Tim Buckley - Initial Contribution + * @author Tim Buckley - Initial contribution * @author Karel Goderis - Enhancement for the V2 LIFX Firmware and LAN Protocol Specification */ public class GetVersionRequest extends Packet { diff --git a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/GetWifiFirmwareRequest.java b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/GetWifiFirmwareRequest.java similarity index 92% rename from bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/GetWifiFirmwareRequest.java rename to bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/GetWifiFirmwareRequest.java index ca18a4a15c23f..e08771de08f7c 100644 --- a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/GetWifiFirmwareRequest.java +++ b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/GetWifiFirmwareRequest.java @@ -10,12 +10,12 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.lifx.internal.protocol; +package org.openhab.binding.lifx.internal.dto; import java.nio.ByteBuffer; /** - * @author Tim Buckley - Initial Contribution + * @author Tim Buckley - Initial contribution * @author Karel Goderis - Enhancement for the V2 LIFX Firmware and LAN Protocol Specification */ public class GetWifiFirmwareRequest extends Packet { diff --git a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/GetWifiInfoRequest.java b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/GetWifiInfoRequest.java similarity index 92% rename from bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/GetWifiInfoRequest.java rename to bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/GetWifiInfoRequest.java index 5740ccea6faab..3b97981a1cce7 100644 --- a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/GetWifiInfoRequest.java +++ b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/GetWifiInfoRequest.java @@ -10,12 +10,12 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.lifx.internal.protocol; +package org.openhab.binding.lifx.internal.dto; import java.nio.ByteBuffer; /** - * @author Tim Buckley - Initial Contribution + * @author Tim Buckley - Initial contribution * @author Karel Goderis - Enhancement for the V2 LIFX Firmware and LAN Protocol Specification */ public class GetWifiInfoRequest extends Packet { diff --git a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/Packet.java b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/Packet.java similarity index 99% rename from bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/Packet.java rename to bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/Packet.java index d9084ab866078..3b65afc370956 100644 --- a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/Packet.java +++ b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/Packet.java @@ -10,7 +10,7 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.lifx.internal.protocol; +package org.openhab.binding.lifx.internal.dto; import java.nio.ByteBuffer; @@ -36,7 +36,7 @@ * Field definitions should remain accessible to outside classes in the event * they need to worked with directly elsewhere. * - * @author Tim Buckley - Initial Contribution + * @author Tim Buckley - Initial contribution * @author Karel Goderis - Enhancement for the V2 LIFX Firmware and LAN Protocol Specification */ public abstract class Packet { diff --git a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/PacketFactory.java b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/PacketFactory.java similarity index 98% rename from bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/PacketFactory.java rename to bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/PacketFactory.java index 6718d31f3c040..ba9ea39f0f4c3 100644 --- a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/PacketFactory.java +++ b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/PacketFactory.java @@ -10,7 +10,7 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.lifx.internal.protocol; +package org.openhab.binding.lifx.internal.dto; import java.util.HashMap; import java.util.Map; @@ -24,7 +24,7 @@ * e. Packet handlers (used to construct actual packet * instances) may be retrieved via their packet type. * - * @author Tim Buckley - Initial Contribution + * @author Tim Buckley - Initial contribution * @author Karel Goderis - Enhancement for the V2 LIFX Firmware and LAN Protocol Specification * @author Wouter Born - Support LIFX 2016 product line-up and infrared functionality */ diff --git a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/PacketHandler.java b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/PacketHandler.java similarity index 92% rename from bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/PacketHandler.java rename to bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/PacketHandler.java index fe8944eb2c8e5..a93b4759be9cb 100644 --- a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/PacketHandler.java +++ b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/PacketHandler.java @@ -10,7 +10,7 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.lifx.internal.protocol; +package org.openhab.binding.lifx.internal.dto; import java.nio.ByteBuffer; @@ -22,7 +22,7 @@ * * @param the generic packet type * - * @author Tim Buckley - Initial Contribution + * @author Tim Buckley - Initial contribution * @author Karel Goderis - Enhancement for the V2 LIFX Firmware and LAN Protocol Specification */ @NonNullByDefault diff --git a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/PowerState.java b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/PowerState.java similarity index 93% rename from bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/PowerState.java rename to bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/PowerState.java index 69d6ad11fd5b5..f12ba58b7d9b3 100644 --- a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/PowerState.java +++ b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/PowerState.java @@ -10,14 +10,14 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.lifx.internal.protocol; +package org.openhab.binding.lifx.internal.dto; import org.openhab.core.library.types.OnOffType; /** * Represents light power states (on or off). * - * @author Tim Buckley - Initial Contribution + * @author Tim Buckley - Initial contribution * @author Karel Goderis - Enhancement for the V2 LIFX Firmware and LAN Protocol Specification * @author Wouter Born - Added OnOffType conversion methods */ diff --git a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/SetColorRequest.java b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/SetColorRequest.java similarity index 96% rename from bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/SetColorRequest.java rename to bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/SetColorRequest.java index 3a24126e6b83f..2ebe1760fe7a2 100644 --- a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/SetColorRequest.java +++ b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/SetColorRequest.java @@ -10,7 +10,7 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.lifx.internal.protocol; +package org.openhab.binding.lifx.internal.dto; import java.nio.ByteBuffer; @@ -21,7 +21,7 @@ import org.openhab.binding.lifx.internal.fields.UInt32Field; /** - * @author Tim Buckley - Initial Contribution + * @author Tim Buckley - Initial contribution * @author Karel Goderis - Enhancement for the V2 LIFX Firmware and LAN Protocol Specification */ public class SetColorRequest extends Packet { diff --git a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/SetColorZonesRequest.java b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/SetColorZonesRequest.java similarity index 96% rename from bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/SetColorZonesRequest.java rename to bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/SetColorZonesRequest.java index 5553877994221..5e40d1b06a8e2 100644 --- a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/SetColorZonesRequest.java +++ b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/SetColorZonesRequest.java @@ -10,7 +10,7 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.lifx.internal.protocol; +package org.openhab.binding.lifx.internal.dto; import static org.openhab.binding.lifx.internal.LifxBindingConstants.*; @@ -23,7 +23,7 @@ import org.openhab.binding.lifx.internal.fields.UInt8Field; /** - * @author Wouter Born - Add support for MultiZone light control + * @author Wouter Born - Initial contribution */ public class SetColorZonesRequest extends Packet { diff --git a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/SetDimAbsoluteRequest.java b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/SetDimAbsoluteRequest.java similarity index 94% rename from bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/SetDimAbsoluteRequest.java rename to bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/SetDimAbsoluteRequest.java index 648db5845c7d2..ca92dedca713b 100644 --- a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/SetDimAbsoluteRequest.java +++ b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/SetDimAbsoluteRequest.java @@ -10,7 +10,7 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.lifx.internal.protocol; +package org.openhab.binding.lifx.internal.dto; import java.nio.ByteBuffer; @@ -19,7 +19,7 @@ import org.openhab.binding.lifx.internal.fields.UInt32Field; /** - * @author Tim Buckley - Initial Contribution + * @author Tim Buckley - Initial contribution * @author Karel Goderis - Enhancement for the V2 LIFX Firmware and LAN Protocol Specification */ public class SetDimAbsoluteRequest extends Packet { diff --git a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/SetLabelRequest.java b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/SetLabelRequest.java similarity index 94% rename from bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/SetLabelRequest.java rename to bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/SetLabelRequest.java index e55dbe5ab60b7..ee11b747cb658 100644 --- a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/SetLabelRequest.java +++ b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/SetLabelRequest.java @@ -10,7 +10,7 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.lifx.internal.protocol; +package org.openhab.binding.lifx.internal.dto; import java.nio.ByteBuffer; @@ -18,7 +18,7 @@ import org.openhab.binding.lifx.internal.fields.StringField; /** - * @author Tim Buckley - Initial Contribution + * @author Tim Buckley - Initial contribution * @author Karel Goderis - Enhancement for the V2 LIFX Firmware and LAN Protocol Specification */ public class SetLabelRequest extends Packet { diff --git a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/SetLightInfraredRequest.java b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/SetLightInfraredRequest.java similarity index 91% rename from bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/SetLightInfraredRequest.java rename to bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/SetLightInfraredRequest.java index e9d601cf321f1..1a0abda764716 100644 --- a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/SetLightInfraredRequest.java +++ b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/SetLightInfraredRequest.java @@ -10,7 +10,7 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.lifx.internal.protocol; +package org.openhab.binding.lifx.internal.dto; import java.nio.ByteBuffer; @@ -18,7 +18,7 @@ import org.openhab.binding.lifx.internal.fields.UInt16Field; /** - * @author Wouter Born - Support LIFX 2016 product line-up and infrared functionality + * @author Wouter Born - Initial contribution */ public class SetLightInfraredRequest extends Packet { diff --git a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/SetLightPowerRequest.java b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/SetLightPowerRequest.java similarity index 95% rename from bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/SetLightPowerRequest.java rename to bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/SetLightPowerRequest.java index ed186fd097e43..ecbfb7a1a7f26 100644 --- a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/SetLightPowerRequest.java +++ b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/SetLightPowerRequest.java @@ -10,7 +10,7 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.lifx.internal.protocol; +package org.openhab.binding.lifx.internal.dto; import java.nio.ByteBuffer; @@ -19,7 +19,7 @@ import org.openhab.binding.lifx.internal.fields.UInt32Field; /** - * @author Tim Buckley - Initial Contribution + * @author Tim Buckley - Initial contribution * @author Karel Goderis - Enhancement for the V2 LIFX Firmware and LAN Protocol Specification */ public class SetLightPowerRequest extends Packet { diff --git a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/SetPowerRequest.java b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/SetPowerRequest.java similarity index 94% rename from bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/SetPowerRequest.java rename to bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/SetPowerRequest.java index 8b0d61a30b14d..ff4988b08b645 100644 --- a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/SetPowerRequest.java +++ b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/SetPowerRequest.java @@ -10,7 +10,7 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.lifx.internal.protocol; +package org.openhab.binding.lifx.internal.dto; import java.nio.ByteBuffer; @@ -18,7 +18,7 @@ import org.openhab.binding.lifx.internal.fields.UInt16Field; /** - * @author Tim Buckley - Initial Contribution + * @author Tim Buckley - Initial contribution * @author Karel Goderis - Enhancement for the V2 LIFX Firmware and LAN Protocol Specification */ public class SetPowerRequest extends Packet { diff --git a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/SetTagsRequest.java b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/SetTagsRequest.java similarity index 94% rename from bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/SetTagsRequest.java rename to bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/SetTagsRequest.java index 384ae11df8811..abbf5b58ddfe2 100644 --- a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/SetTagsRequest.java +++ b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/SetTagsRequest.java @@ -10,7 +10,7 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.lifx.internal.protocol; +package org.openhab.binding.lifx.internal.dto; import java.nio.ByteBuffer; @@ -18,7 +18,7 @@ import org.openhab.binding.lifx.internal.fields.UInt64Field; /** - * @author Tim Buckley - Initial Contribution + * @author Tim Buckley - Initial contribution * @author Karel Goderis - Enhancement for the V2 LIFX Firmware and LAN Protocol Specification */ public class SetTagsRequest extends Packet { diff --git a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/SetTileEffectRequest.java b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/SetTileEffectRequest.java similarity index 99% rename from bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/SetTileEffectRequest.java rename to bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/SetTileEffectRequest.java index f4cef593ae922..21d398e495514 100644 --- a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/SetTileEffectRequest.java +++ b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/SetTileEffectRequest.java @@ -10,7 +10,7 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.lifx.internal.protocol; +package org.openhab.binding.lifx.internal.dto; import java.nio.ByteBuffer; diff --git a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/SignalStrength.java b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/SignalStrength.java similarity index 94% rename from bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/SignalStrength.java rename to bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/SignalStrength.java index 5a10b8a2da399..716a93f94014e 100644 --- a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/SignalStrength.java +++ b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/SignalStrength.java @@ -10,12 +10,12 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.lifx.internal.protocol; +package org.openhab.binding.lifx.internal.dto; /** * The signal strength of a light. * - * @author Wouter Born - Add signal strength channel + * @author Wouter Born - Initial contribution */ public class SignalStrength { diff --git a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/StateGroupResponse.java b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/StateGroupResponse.java similarity index 95% rename from bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/StateGroupResponse.java rename to bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/StateGroupResponse.java index 274a9c510a082..2463edacf9bcb 100644 --- a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/StateGroupResponse.java +++ b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/StateGroupResponse.java @@ -10,7 +10,7 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.lifx.internal.protocol; +package org.openhab.binding.lifx.internal.dto; import java.nio.ByteBuffer; @@ -20,7 +20,7 @@ import org.openhab.binding.lifx.internal.fields.UInt64Field; /** - * @author Tim Buckley - Initial Contribution + * @author Tim Buckley - Initial contribution * @author Karel Goderis - Enhancement for the V2 LIFX Firmware and LAN Protocol Specification */ public class StateGroupResponse extends Packet { diff --git a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/StateHostFirmwareResponse.java b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/StateHostFirmwareResponse.java similarity index 95% rename from bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/StateHostFirmwareResponse.java rename to bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/StateHostFirmwareResponse.java index 4eb17305a73a5..065c06595f766 100644 --- a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/StateHostFirmwareResponse.java +++ b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/StateHostFirmwareResponse.java @@ -10,7 +10,7 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.lifx.internal.protocol; +package org.openhab.binding.lifx.internal.dto; import java.nio.ByteBuffer; @@ -20,7 +20,7 @@ import org.openhab.binding.lifx.internal.fields.VersionField; /** - * @author Tim Buckley - Initial Contribution + * @author Tim Buckley - Initial contribution * @author Karel Goderis - Enhancement for the V2 LIFX Firmware and LAN Protocol Specification */ public class StateHostFirmwareResponse extends Packet { diff --git a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/StateHostInfoResponse.java b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/StateHostInfoResponse.java similarity index 95% rename from bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/StateHostInfoResponse.java rename to bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/StateHostInfoResponse.java index 5b4b712806292..1690bd235183b 100644 --- a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/StateHostInfoResponse.java +++ b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/StateHostInfoResponse.java @@ -10,7 +10,7 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.lifx.internal.protocol; +package org.openhab.binding.lifx.internal.dto; import java.nio.ByteBuffer; @@ -20,7 +20,7 @@ import org.openhab.binding.lifx.internal.fields.UInt32Field; /** - * @author Tim Buckley - Initial Contribution + * @author Tim Buckley - Initial contribution * @author Karel Goderis - Enhancement for the V2 LIFX Firmware and LAN Protocol Specification */ public class StateHostInfoResponse extends Packet { diff --git a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/StateInfoResponse.java b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/StateInfoResponse.java similarity index 95% rename from bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/StateInfoResponse.java rename to bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/StateInfoResponse.java index 5b7e9143303c1..ca3ccf276d657 100644 --- a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/StateInfoResponse.java +++ b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/StateInfoResponse.java @@ -10,7 +10,7 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.lifx.internal.protocol; +package org.openhab.binding.lifx.internal.dto; import java.nio.ByteBuffer; @@ -18,7 +18,7 @@ import org.openhab.binding.lifx.internal.fields.UInt64Field; /** - * @author Tim Buckley - Initial Contribution + * @author Tim Buckley - Initial contribution * @author Karel Goderis - Enhancement for the V2 LIFX Firmware and LAN Protocol Specification */ public class StateInfoResponse extends Packet { diff --git a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/StateLabelResponse.java b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/StateLabelResponse.java similarity index 93% rename from bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/StateLabelResponse.java rename to bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/StateLabelResponse.java index c41afa3184ea4..409d61f40024a 100644 --- a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/StateLabelResponse.java +++ b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/StateLabelResponse.java @@ -10,7 +10,7 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.lifx.internal.protocol; +package org.openhab.binding.lifx.internal.dto; import java.nio.ByteBuffer; @@ -18,7 +18,7 @@ import org.openhab.binding.lifx.internal.fields.StringField; /** - * @author Tim Buckley - Initial Contribution + * @author Tim Buckley - Initial contribution * @author Karel Goderis - Enhancement for the V2 LIFX Firmware and LAN Protocol Specification */ public class StateLabelResponse extends Packet { diff --git a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/StateLightInfraredResponse.java b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/StateLightInfraredResponse.java similarity index 90% rename from bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/StateLightInfraredResponse.java rename to bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/StateLightInfraredResponse.java index 9012583da0674..53d561be493ff 100644 --- a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/StateLightInfraredResponse.java +++ b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/StateLightInfraredResponse.java @@ -10,7 +10,7 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.lifx.internal.protocol; +package org.openhab.binding.lifx.internal.dto; import java.nio.ByteBuffer; @@ -18,7 +18,7 @@ import org.openhab.binding.lifx.internal.fields.UInt16Field; /** - * @author Wouter Born - Support LIFX 2016 product line-up and infrared functionality + * @author Wouter Born - Initial contribution */ public class StateLightInfraredResponse extends Packet { diff --git a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/StateLightPowerResponse.java b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/StateLightPowerResponse.java similarity index 93% rename from bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/StateLightPowerResponse.java rename to bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/StateLightPowerResponse.java index 6b848afb6caa8..9d248a16ee816 100644 --- a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/StateLightPowerResponse.java +++ b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/StateLightPowerResponse.java @@ -10,7 +10,7 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.lifx.internal.protocol; +package org.openhab.binding.lifx.internal.dto; import java.nio.ByteBuffer; @@ -18,7 +18,7 @@ import org.openhab.binding.lifx.internal.fields.UInt16Field; /** - * @author Tim Buckley - Initial Contribution + * @author Tim Buckley - Initial contribution * @author Karel Goderis - Enhancement for the V2 LIFX Firmware and LAN Protocol Specification */ public class StateLightPowerResponse extends Packet { diff --git a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/StateLocationResponse.java b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/StateLocationResponse.java similarity index 96% rename from bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/StateLocationResponse.java rename to bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/StateLocationResponse.java index 35d726aad2bc1..77c014688996b 100644 --- a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/StateLocationResponse.java +++ b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/StateLocationResponse.java @@ -10,7 +10,7 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.lifx.internal.protocol; +package org.openhab.binding.lifx.internal.dto; import java.nio.ByteBuffer; @@ -20,7 +20,7 @@ import org.openhab.binding.lifx.internal.fields.UInt64Field; /** - * @author Tim Buckley - Initial Contribution + * @author Tim Buckley - Initial contribution * @author Karel Goderis - Enhancement for the V2 LIFX Firmware and LAN Protocol Specification */ public class StateLocationResponse extends Packet { diff --git a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/StateMultiZoneResponse.java b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/StateMultiZoneResponse.java similarity index 95% rename from bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/StateMultiZoneResponse.java rename to bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/StateMultiZoneResponse.java index 47f167deb0f11..4e2443bdd2dca 100644 --- a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/StateMultiZoneResponse.java +++ b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/StateMultiZoneResponse.java @@ -10,7 +10,7 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.lifx.internal.protocol; +package org.openhab.binding.lifx.internal.dto; import java.nio.ByteBuffer; @@ -20,7 +20,7 @@ import org.openhab.binding.lifx.internal.fields.UInt8Field; /** - * @author Wouter Born - Add support for MultiZone light control + * @author Wouter Born - Initial contribution */ public class StateMultiZoneResponse extends Packet { diff --git a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/StatePowerResponse.java b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/StatePowerResponse.java similarity index 93% rename from bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/StatePowerResponse.java rename to bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/StatePowerResponse.java index b6689a6429901..7d86030cfcde5 100644 --- a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/StatePowerResponse.java +++ b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/StatePowerResponse.java @@ -10,7 +10,7 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.lifx.internal.protocol; +package org.openhab.binding.lifx.internal.dto; import java.nio.ByteBuffer; @@ -18,7 +18,7 @@ import org.openhab.binding.lifx.internal.fields.UInt16Field; /** - * @author Tim Buckley - Initial Contribution + * @author Tim Buckley - Initial contribution * @author Karel Goderis - Enhancement for the V2 LIFX Firmware and LAN Protocol Specification */ public class StatePowerResponse extends Packet { diff --git a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/StateResponse.java b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/StateResponse.java similarity index 96% rename from bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/StateResponse.java rename to bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/StateResponse.java index ff3bf40bf2bd8..808577b376f3c 100644 --- a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/StateResponse.java +++ b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/StateResponse.java @@ -10,7 +10,7 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.lifx.internal.protocol; +package org.openhab.binding.lifx.internal.dto; import java.nio.ByteBuffer; @@ -22,7 +22,7 @@ import org.openhab.binding.lifx.internal.fields.UInt64Field; /** - * @author Tim Buckley - Initial Contribution + * @author Tim Buckley - Initial contribution * @author Karel Goderis - Enhancement for the V2 LIFX Firmware and LAN Protocol Specification */ public class StateResponse extends Packet { diff --git a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/StateServiceResponse.java b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/StateServiceResponse.java similarity index 94% rename from bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/StateServiceResponse.java rename to bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/StateServiceResponse.java index 84c6a23826e0a..599da30b7098d 100644 --- a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/StateServiceResponse.java +++ b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/StateServiceResponse.java @@ -10,7 +10,7 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.lifx.internal.protocol; +package org.openhab.binding.lifx.internal.dto; import java.nio.ByteBuffer; @@ -20,7 +20,7 @@ import org.openhab.binding.lifx.internal.fields.UInt8Field; /** - * @author Tim Buckley - Initial Contribution + * @author Tim Buckley - Initial contribution * @author Karel Goderis - Enhancement for the V2 LIFX Firmware and LAN Protocol Specification */ public class StateServiceResponse extends Packet { diff --git a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/StateTileEffectResponse.java b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/StateTileEffectResponse.java similarity index 98% rename from bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/StateTileEffectResponse.java rename to bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/StateTileEffectResponse.java index 6bfb630f595f6..c9b6f40e9d6d3 100644 --- a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/StateTileEffectResponse.java +++ b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/StateTileEffectResponse.java @@ -10,7 +10,7 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.lifx.internal.protocol; +package org.openhab.binding.lifx.internal.dto; import java.nio.ByteBuffer; @@ -26,7 +26,7 @@ /** * Implementation of StateTileEffect packet * - * @author Pawel Pieczul - Initial Contribution + * @author Pawel Pieczul - Initial contribution */ public class StateTileEffectResponse extends Packet { diff --git a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/StateVersionResponse.java b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/StateVersionResponse.java similarity index 95% rename from bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/StateVersionResponse.java rename to bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/StateVersionResponse.java index 410dc3720b1b7..db0b14e433493 100644 --- a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/StateVersionResponse.java +++ b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/StateVersionResponse.java @@ -10,7 +10,7 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.lifx.internal.protocol; +package org.openhab.binding.lifx.internal.dto; import java.nio.ByteBuffer; @@ -18,7 +18,7 @@ import org.openhab.binding.lifx.internal.fields.UInt32Field; /** - * @author Tim Buckley - Initial Contribution + * @author Tim Buckley - Initial contribution * @author Karel Goderis - Enhancement for the V2 LIFX Firmware and LAN Protocol Specification */ public class StateVersionResponse extends Packet { diff --git a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/StateWifiFirmwareResponse.java b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/StateWifiFirmwareResponse.java similarity index 95% rename from bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/StateWifiFirmwareResponse.java rename to bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/StateWifiFirmwareResponse.java index b0cbc950106b0..6cf177f0e961f 100644 --- a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/StateWifiFirmwareResponse.java +++ b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/StateWifiFirmwareResponse.java @@ -10,7 +10,7 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.lifx.internal.protocol; +package org.openhab.binding.lifx.internal.dto; import java.nio.ByteBuffer; @@ -20,7 +20,7 @@ import org.openhab.binding.lifx.internal.fields.VersionField; /** - * @author Tim Buckley - Initial Contribution + * @author Tim Buckley - Initial contribution * @author Karel Goderis - Enhancement for the V2 LIFX Firmware and LAN Protocol Specification */ public class StateWifiFirmwareResponse extends Packet { diff --git a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/StateWifiInfoResponse.java b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/StateWifiInfoResponse.java similarity index 95% rename from bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/StateWifiInfoResponse.java rename to bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/StateWifiInfoResponse.java index 3cb832b1538c3..516562d2dae22 100644 --- a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/StateWifiInfoResponse.java +++ b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/StateWifiInfoResponse.java @@ -10,7 +10,7 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.lifx.internal.protocol; +package org.openhab.binding.lifx.internal.dto; import java.nio.ByteBuffer; @@ -20,7 +20,7 @@ import org.openhab.binding.lifx.internal.fields.UInt32Field; /** - * @author Tim Buckley - Initial Contribution + * @author Tim Buckley - Initial contribution * @author Karel Goderis - Enhancement for the V2 LIFX Firmware and LAN Protocol Specification */ public class StateWifiInfoResponse extends Packet { diff --git a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/StateZoneResponse.java b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/StateZoneResponse.java similarity index 94% rename from bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/StateZoneResponse.java rename to bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/StateZoneResponse.java index e95135fc8e54d..26eaf2824635a 100644 --- a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/StateZoneResponse.java +++ b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/StateZoneResponse.java @@ -10,7 +10,7 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.lifx.internal.protocol; +package org.openhab.binding.lifx.internal.dto; import java.nio.ByteBuffer; @@ -20,7 +20,7 @@ import org.openhab.binding.lifx.internal.fields.UInt8Field; /** - * @author Wouter Born - Add support for MultiZone light control + * @author Wouter Born - Initial contribution */ public class StateZoneResponse extends Packet { diff --git a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/TagLabelsResponse.java b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/TagLabelsResponse.java similarity index 94% rename from bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/TagLabelsResponse.java rename to bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/TagLabelsResponse.java index ef3aa17676f72..5ecd16b0c7d45 100644 --- a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/TagLabelsResponse.java +++ b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/TagLabelsResponse.java @@ -10,7 +10,7 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.lifx.internal.protocol; +package org.openhab.binding.lifx.internal.dto; import java.nio.ByteBuffer; @@ -19,7 +19,7 @@ import org.openhab.binding.lifx.internal.fields.UInt64Field; /** - * @author Tim Buckley - Initial Contribution + * @author Tim Buckley - Initial contribution * @author Karel Goderis - Enhancement for the V2 LIFX Firmware and LAN Protocol Specification */ public class TagLabelsResponse extends Packet { diff --git a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/TagsResponse.java b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/TagsResponse.java similarity index 93% rename from bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/TagsResponse.java rename to bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/TagsResponse.java index 257f28eab9444..104ad08b26cae 100644 --- a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/protocol/TagsResponse.java +++ b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/TagsResponse.java @@ -10,7 +10,7 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.lifx.internal.protocol; +package org.openhab.binding.lifx.internal.dto; import java.nio.ByteBuffer; @@ -18,7 +18,7 @@ import org.openhab.binding.lifx.internal.fields.UInt64Field; /** - * @author Tim Buckley - Initial Contribution + * @author Tim Buckley - Initial contribution * @author Karel Goderis - Enhancement for the V2 LIFX Firmware and LAN Protocol Specification */ public class TagsResponse extends Packet { diff --git a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/fields/ByteField.java b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/fields/ByteField.java index 29418f3263a4e..5649a32d81e6f 100644 --- a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/fields/ByteField.java +++ b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/fields/ByteField.java @@ -17,7 +17,7 @@ import org.eclipse.jdt.annotation.NonNullByDefault; /** - * @author Tim Buckley + * @author Tim Buckley - Initial contribution */ @NonNullByDefault public class ByteField extends Field { diff --git a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/fields/Field.java b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/fields/Field.java index e2bcc7d9e6407..1a1ae2c92c49a 100644 --- a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/fields/Field.java +++ b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/fields/Field.java @@ -22,7 +22,7 @@ * * @param the field datatype * - * @author Tim Buckley + * @author Tim Buckley - Initial contribution */ @NonNullByDefault public abstract class Field { diff --git a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/fields/FloatField.java b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/fields/FloatField.java index 7e29fd5819025..ffb7bd40f09d8 100644 --- a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/fields/FloatField.java +++ b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/fields/FloatField.java @@ -17,7 +17,7 @@ import org.eclipse.jdt.annotation.NonNullByDefault; /** - * @author Tim Buckley + * @author Tim Buckley - Initial contribution */ @NonNullByDefault public class FloatField extends Field { diff --git a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/fields/HSBK.java b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/fields/HSBK.java index e31629cbfa158..23885500c6d43 100644 --- a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/fields/HSBK.java +++ b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/fields/HSBK.java @@ -21,7 +21,7 @@ import org.openhab.core.library.types.PercentType; /** - * @author Wouter Born - Add support for MultiZone light control + * @author Wouter Born - Initial contribution */ @NonNullByDefault public class HSBK { diff --git a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/fields/HSBKField.java b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/fields/HSBKField.java index c254f4bdb7919..75d1e167019ef 100644 --- a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/fields/HSBKField.java +++ b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/fields/HSBKField.java @@ -17,7 +17,7 @@ import org.eclipse.jdt.annotation.NonNullByDefault; /** - * @author Wouter Born - Add support for MultiZone light control + * @author Wouter Born - Initial contribution */ @NonNullByDefault public class HSBKField extends Field { diff --git a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/fields/LittleField.java b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/fields/LittleField.java index 8dfcb257f42ec..5352491dfec37 100644 --- a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/fields/LittleField.java +++ b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/fields/LittleField.java @@ -19,7 +19,7 @@ /** * Reads a wrapped field in reversed byte order. * - * @author Tim Buckley + * @author Tim Buckley - Initial contribution */ @NonNullByDefault public class LittleField extends Field { diff --git a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/fields/MACAddress.java b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/fields/MACAddress.java index bfce15f801418..91190f4242b42 100644 --- a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/fields/MACAddress.java +++ b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/fields/MACAddress.java @@ -12,30 +12,23 @@ */ package org.openhab.binding.lifx.internal.fields; -import java.io.ByteArrayInputStream; -import java.io.IOException; import java.nio.ByteBuffer; -import java.util.Arrays; import java.util.LinkedList; import java.util.List; import java.util.Objects; -import org.apache.commons.lang.StringUtils; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +import org.openhab.core.util.HexUtils; /** - * @author Tim Buckley - * @author Karel Goderis + * @author Tim Buckley - Initial contribution + * @author Karel Goderis - Initial contribution */ @NonNullByDefault public class MACAddress { - public static final MACAddress BROADCAST_ADDRESS = new MACAddress("000000000000", true); - - private final Logger logger = LoggerFactory.getLogger(MACAddress.class); + public static final MACAddress BROADCAST_ADDRESS = new MACAddress("000000000000"); private ByteBuffer bytes; private String hex = ""; @@ -54,28 +47,10 @@ public MACAddress(ByteBuffer bytes) { createHex(); } - public MACAddress(String string, boolean isHex) { - if (!isHex) { - this.bytes = ByteBuffer.wrap(string.getBytes()); - createHex(); - } else { - this.bytes = ByteBuffer.wrap(parseHexBinary(string)); - - try { - formatHex(string, 2, ":"); - } catch (IOException e) { - logger.error("An exception occurred while formatting an HEX string : '{}'", e.getMessage()); - } - } - } - - private byte[] parseHexBinary(String s) { - int len = s.length(); - byte[] data = new byte[len / 2]; - for (int i = 0; i < len; i += 2) { - data[i / 2] = (byte) ((Character.digit(s.charAt(i), 16) << 4) + Character.digit(s.charAt(i + 1), 16)); - } - return data; + public MACAddress(String string) { + byte[] byteArray = HexUtils.hexToBytes(string); + this.bytes = ByteBuffer.wrap(byteArray); + this.hex = HexUtils.bytesToHex(byteArray, ":"); } public MACAddress() { @@ -90,7 +65,7 @@ private void createHex() { byteStrings.add(String.format("%02X", bytes.get())); } - hex = StringUtils.join(byteStrings, ':'); + hex = String.join(":", byteStrings); bytes.rewind(); } @@ -108,21 +83,6 @@ public String getAsLabel() { return hex.toString(); } - private void formatHex(String original, int length, String separator) throws IOException { - ByteArrayInputStream bis = new ByteArrayInputStream(original.getBytes()); - byte[] buffer = new byte[length]; - String result = ""; - while (bis.read(buffer) > 0) { - for (byte b : buffer) { - result += (char) b; - } - Arrays.fill(buffer, (byte) 0); - result += separator; - } - - hex = StringUtils.left(result, result.length() - 1); - } - @Override public int hashCode() { int hash = 7; diff --git a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/fields/MACAddressField.java b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/fields/MACAddressField.java index 417348cb71e05..57471120c0279 100644 --- a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/fields/MACAddressField.java +++ b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/fields/MACAddressField.java @@ -17,8 +17,8 @@ import org.eclipse.jdt.annotation.NonNullByDefault; /** - * @author Tim Buckley - * @author Karel Goderis + * @author Tim Buckley - Initial contribution + * @author Karel Goderis - Initial contribution */ @NonNullByDefault public class MACAddressField extends Field { diff --git a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/fields/StringField.java b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/fields/StringField.java index 360ceb2816126..0184d65c09ee0 100644 --- a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/fields/StringField.java +++ b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/fields/StringField.java @@ -19,7 +19,7 @@ import org.eclipse.jdt.annotation.NonNullByDefault; /** - * @author Tim Buckley + * @author Tim Buckley - Initial contribution */ @NonNullByDefault public class StringField extends Field { diff --git a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/fields/UInt16Field.java b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/fields/UInt16Field.java index 3cdcb44c28bbe..a9c65d2e53008 100644 --- a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/fields/UInt16Field.java +++ b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/fields/UInt16Field.java @@ -17,7 +17,7 @@ import org.eclipse.jdt.annotation.NonNullByDefault; /** - * @author Tim Buckley + * @author Tim Buckley - Initial contribution */ @NonNullByDefault public class UInt16Field extends Field { diff --git a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/fields/UInt32Field.java b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/fields/UInt32Field.java index 04b9d7acbee7b..89ce6fb8828e7 100644 --- a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/fields/UInt32Field.java +++ b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/fields/UInt32Field.java @@ -17,7 +17,7 @@ import org.eclipse.jdt.annotation.NonNullByDefault; /** - * @author Tim Buckley + * @author Tim Buckley - Initial contribution */ @NonNullByDefault public class UInt32Field extends Field { diff --git a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/fields/UInt64Field.java b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/fields/UInt64Field.java index bfc229a4dd354..b72ef6b2db748 100644 --- a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/fields/UInt64Field.java +++ b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/fields/UInt64Field.java @@ -21,7 +21,7 @@ * unexpected values will likely be shown if exposed to users. Most bit-level * operations should still work (addition, multiplication, shifting, etc). * - * @author Tim Buckley + * @author Tim Buckley - Initial contribution */ @NonNullByDefault public class UInt64Field extends Field { diff --git a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/fields/UInt8Field.java b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/fields/UInt8Field.java index 23ba2353bde72..969c468061fe6 100644 --- a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/fields/UInt8Field.java +++ b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/fields/UInt8Field.java @@ -17,7 +17,7 @@ import org.eclipse.jdt.annotation.NonNullByDefault; /** - * @author Tim Buckley + * @author Tim Buckley - Initial contribution */ @NonNullByDefault public class UInt8Field extends Field { diff --git a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/fields/Version.java b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/fields/Version.java index 559bae30ecac8..3d53df7703c92 100644 --- a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/fields/Version.java +++ b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/fields/Version.java @@ -15,7 +15,7 @@ import org.eclipse.jdt.annotation.NonNullByDefault; /** - * @author Wouter Born - Add Thing properties + * @author Wouter Born - Initial contribution */ @NonNullByDefault public class Version { diff --git a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/fields/VersionField.java b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/fields/VersionField.java index 7cec7a8e96add..26af5382c6a61 100644 --- a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/fields/VersionField.java +++ b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/fields/VersionField.java @@ -17,7 +17,7 @@ import org.eclipse.jdt.annotation.NonNullByDefault; /** - * @author Wouter Born - Add Thing properties + * @author Wouter Born - Initial contribution */ @NonNullByDefault public class VersionField extends Field { diff --git a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/handler/LifxLightHandler.java b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/handler/LifxLightHandler.java index af941d2f96692..812371394eaf7 100644 --- a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/handler/LifxLightHandler.java +++ b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/handler/LifxLightHandler.java @@ -13,7 +13,7 @@ package org.openhab.binding.lifx.internal.handler; import static org.openhab.binding.lifx.internal.LifxBindingConstants.*; -import static org.openhab.binding.lifx.internal.protocol.Product.Feature.*; +import static org.openhab.binding.lifx.internal.LifxProduct.Feature.*; import static org.openhab.binding.lifx.internal.util.LifxMessageUtil.*; import java.net.InetSocketAddress; @@ -38,18 +38,18 @@ import org.openhab.binding.lifx.internal.LifxLightPropertiesUpdater; import org.openhab.binding.lifx.internal.LifxLightState; import org.openhab.binding.lifx.internal.LifxLightStateChanger; +import org.openhab.binding.lifx.internal.LifxProduct; +import org.openhab.binding.lifx.internal.dto.Effect; +import org.openhab.binding.lifx.internal.dto.GetLightInfraredRequest; +import org.openhab.binding.lifx.internal.dto.GetLightPowerRequest; +import org.openhab.binding.lifx.internal.dto.GetRequest; +import org.openhab.binding.lifx.internal.dto.GetTileEffectRequest; +import org.openhab.binding.lifx.internal.dto.GetWifiInfoRequest; +import org.openhab.binding.lifx.internal.dto.Packet; +import org.openhab.binding.lifx.internal.dto.PowerState; +import org.openhab.binding.lifx.internal.dto.SignalStrength; import org.openhab.binding.lifx.internal.fields.HSBK; import org.openhab.binding.lifx.internal.fields.MACAddress; -import org.openhab.binding.lifx.internal.protocol.Effect; -import org.openhab.binding.lifx.internal.protocol.GetLightInfraredRequest; -import org.openhab.binding.lifx.internal.protocol.GetLightPowerRequest; -import org.openhab.binding.lifx.internal.protocol.GetRequest; -import org.openhab.binding.lifx.internal.protocol.GetTileEffectRequest; -import org.openhab.binding.lifx.internal.protocol.GetWifiInfoRequest; -import org.openhab.binding.lifx.internal.protocol.Packet; -import org.openhab.binding.lifx.internal.protocol.PowerState; -import org.openhab.binding.lifx.internal.protocol.Product; -import org.openhab.binding.lifx.internal.protocol.SignalStrength; import org.openhab.core.config.core.Configuration; import org.openhab.core.library.types.DecimalType; import org.openhab.core.library.types.HSBType; @@ -90,7 +90,7 @@ public class LifxLightHandler extends BaseThingHandler { private static final Duration MAX_STATE_CHANGE_DURATION = Duration.ofSeconds(4); private final LifxChannelFactory channelFactory; - private @NonNullByDefault({}) Product product; + private @NonNullByDefault({}) LifxProduct product; private @Nullable PercentType powerOnBrightness; private @Nullable HSBType powerOnColor; @@ -405,10 +405,10 @@ public String getLogId(@Nullable MACAddress macAddress, @Nullable InetSocketAddr return speed == null ? null : new Double(speed.toString()); } - private Product getProduct() { + private LifxProduct getProduct() { Object propertyValue = getThing().getProperties().get(LifxBindingConstants.PROPERTY_PRODUCT_ID); if (propertyValue == null) { - return Product.getLikelyProduct(getThing().getThingTypeUID()); + return LifxProduct.getLikelyProduct(getThing().getThingTypeUID()); } try { // Without first conversion to double, on a very first thing creation from discovery inbox, @@ -416,9 +416,9 @@ private Product getProduct() { // (e.g. 50.0 instead of 50) Double d = Double.parseDouble((String) propertyValue); long productID = d.longValue(); - return Product.getProductFromProductID(productID); + return LifxProduct.getProductFromProductID(productID); } catch (IllegalArgumentException e) { - return Product.getLikelyProduct(getThing().getThingTypeUID()); + return LifxProduct.getLikelyProduct(getThing().getThingTypeUID()); } } diff --git a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/listener/LifxLightStateListener.java b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/listener/LifxLightStateListener.java index 68b7c460aaf7c..fab89fa7f1984 100644 --- a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/listener/LifxLightStateListener.java +++ b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/listener/LifxLightStateListener.java @@ -15,10 +15,10 @@ import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; import org.openhab.binding.lifx.internal.LifxLightState; +import org.openhab.binding.lifx.internal.dto.Effect; +import org.openhab.binding.lifx.internal.dto.PowerState; +import org.openhab.binding.lifx.internal.dto.SignalStrength; import org.openhab.binding.lifx.internal.fields.HSBK; -import org.openhab.binding.lifx.internal.protocol.Effect; -import org.openhab.binding.lifx.internal.protocol.PowerState; -import org.openhab.binding.lifx.internal.protocol.SignalStrength; import org.openhab.core.library.types.PercentType; /** diff --git a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/listener/LifxPropertiesUpdateListener.java b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/listener/LifxPropertiesUpdateListener.java index 8909ee73bf356..c4dedcdea3e0a 100644 --- a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/listener/LifxPropertiesUpdateListener.java +++ b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/listener/LifxPropertiesUpdateListener.java @@ -21,7 +21,7 @@ * The {@link LifxPropertiesUpdateListener} is notified when the {@link LifxLightPropertiesUpdater} has * updated light properties. * - * @author Wouter Born - Update light properties when online + * @author Wouter Born - Initial contribution */ @NonNullByDefault public interface LifxPropertiesUpdateListener { diff --git a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/listener/LifxResponsePacketListener.java b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/listener/LifxResponsePacketListener.java index fa622f6e64b22..10396ac5e8964 100644 --- a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/listener/LifxResponsePacketListener.java +++ b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/listener/LifxResponsePacketListener.java @@ -14,7 +14,7 @@ import org.eclipse.jdt.annotation.NonNullByDefault; import org.openhab.binding.lifx.internal.LifxLightCommunicationHandler; -import org.openhab.binding.lifx.internal.protocol.Packet; +import org.openhab.binding.lifx.internal.dto.Packet; /** * The {@link LifxResponsePacketListener} is notified when the {@link LifxLightCommunicationHandler} receives a response diff --git a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/util/LifxMessageUtil.java b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/util/LifxMessageUtil.java index 7218a29f3dcc5..03c8135e2d7f3 100644 --- a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/util/LifxMessageUtil.java +++ b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/util/LifxMessageUtil.java @@ -17,8 +17,8 @@ import java.util.UUID; import org.eclipse.jdt.annotation.NonNullByDefault; +import org.openhab.binding.lifx.internal.LifxProduct.TemperatureRange; import org.openhab.binding.lifx.internal.fields.HSBK; -import org.openhab.binding.lifx.internal.protocol.Product.TemperatureRange; import org.openhab.core.library.types.DecimalType; import org.openhab.core.library.types.IncreaseDecreaseType; import org.openhab.core.library.types.PercentType; @@ -26,7 +26,7 @@ /** * Utility class for sharing message utility methods between objects. * - * @author Wouter Born - Extracted methods from LifxLightHandler + * @author Wouter Born - Initial contribution */ @NonNullByDefault public final class LifxMessageUtil { diff --git a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/util/LifxNetworkUtil.java b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/util/LifxNetworkUtil.java index 4d4774801447a..eca9a34a17efa 100644 --- a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/util/LifxNetworkUtil.java +++ b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/util/LifxNetworkUtil.java @@ -34,7 +34,7 @@ * The {@link LifxNetworkUtil} provides network interface information to the LIFX binding objects. The information is * updated when it is older than {@link #UPDATE_INTERVAL_MILLIS}. * - * @author Wouter Born - Periodically update available interface information + * @author Wouter Born - Initial contribution */ @NonNullByDefault public final class LifxNetworkUtil { diff --git a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/util/LifxSelectorUtil.java b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/util/LifxSelectorUtil.java index 10dec21b90a22..1630ec296acd5 100644 --- a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/util/LifxSelectorUtil.java +++ b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/util/LifxSelectorUtil.java @@ -32,17 +32,17 @@ import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; import org.openhab.binding.lifx.internal.LifxSelectorContext; +import org.openhab.binding.lifx.internal.dto.Packet; +import org.openhab.binding.lifx.internal.dto.PacketFactory; +import org.openhab.binding.lifx.internal.dto.PacketHandler; import org.openhab.binding.lifx.internal.fields.MACAddress; -import org.openhab.binding.lifx.internal.protocol.Packet; -import org.openhab.binding.lifx.internal.protocol.PacketFactory; -import org.openhab.binding.lifx.internal.protocol.PacketHandler; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * Utility class for sharing {@link Selector} logic between objects. * - * @author Wouter Born - Make selector logic reusable between discovery and handlers + * @author Wouter Born - Initial contribution */ @NonNullByDefault public class LifxSelectorUtil { diff --git a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/util/LifxThrottlingUtil.java b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/util/LifxThrottlingUtil.java index 397df9e07ea02..8001d1e74b5e7 100644 --- a/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/util/LifxThrottlingUtil.java +++ b/bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/util/LifxThrottlingUtil.java @@ -31,7 +31,7 @@ * sent to LIFX lights. The LIFX LAN Protocol Specification states that lights can process up to 20 messages per second, * not more. * - * @author Karel Goderis - Initial Contribution + * @author Karel Goderis - Initial contribution * @author Wouter Born - Deadlock fix */ @NonNullByDefault diff --git a/bundles/org.openhab.binding.lifx/src/test/java/org/openhab/binding/lifx/internal/fields/MACAddressTest.java b/bundles/org.openhab.binding.lifx/src/test/java/org/openhab/binding/lifx/internal/fields/MACAddressTest.java new file mode 100644 index 0000000000000..78b620b7af4f4 --- /dev/null +++ b/bundles/org.openhab.binding.lifx/src/test/java/org/openhab/binding/lifx/internal/fields/MACAddressTest.java @@ -0,0 +1,88 @@ +/** + * Copyright (c) 2010-2021 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.lifx.internal.fields; + +import static org.hamcrest.CoreMatchers.not; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.core.Is.is; +import static org.openhab.binding.lifx.internal.fields.MACAddress.BROADCAST_ADDRESS; +import static org.openhab.core.util.HexUtils.bytesToHex; + +import java.nio.ByteBuffer; + +import org.eclipse.jdt.annotation.NonNullByDefault; +import org.junit.jupiter.api.Test; +import org.openhab.core.util.HexUtils; + +/** + * Tests {@link MACAddress}. + * + * @author Wouter Born - Initial contribution + */ +@NonNullByDefault +public class MACAddressTest { + + @Test + public void broadcastAddress() { + assertThat(BROADCAST_ADDRESS.getAsLabel(), is("000000000000")); + assertThat(BROADCAST_ADDRESS.getHex(), is("00:00:00:00:00:00")); + assertThat(bytesToHex(BROADCAST_ADDRESS.getBytes().array()), is("000000000000")); + } + + @Test + public void defaultConstructor() { + MACAddress macAddress = new MACAddress(); + assertThat(macAddress.getAsLabel(), is("000000000000")); + assertThat(macAddress.getHex(), is("00:00:00:00:00:00")); + } + + @Test + public void constructFromByteBuffer() { + MACAddress macAddress = new MACAddress(ByteBuffer.wrap(HexUtils.hexToBytes("D073D5123456"))); + assertThat(macAddress.getAsLabel(), is("D073D5123456")); + assertThat(macAddress.getHex(), is("D0:73:D5:12:34:56")); + assertThat(bytesToHex(macAddress.getBytes().array()), is("D073D5123456")); + } + + @Test + public void constructFromString() { + MACAddress macAddress = new MACAddress("D073D5ABCDEF"); + assertThat(macAddress.getAsLabel(), is("D073D5ABCDEF")); + assertThat(macAddress.getHex(), is("D0:73:D5:AB:CD:EF")); + assertThat(bytesToHex(macAddress.getBytes().array()), is("D073D5ABCDEF")); + } + + @Test + public void broadcastAddressComparison() { + assertThat(BROADCAST_ADDRESS, is(BROADCAST_ADDRESS)); + assertThat(BROADCAST_ADDRESS.hashCode(), is(BROADCAST_ADDRESS.hashCode())); + + assertThat(BROADCAST_ADDRESS, is(new MACAddress())); + assertThat(BROADCAST_ADDRESS.hashCode(), is(new MACAddress().hashCode())); + + assertThat(BROADCAST_ADDRESS, is(not(new MACAddress("D073D5ABCDEF")))); + assertThat(BROADCAST_ADDRESS, is(not(new MACAddress("D073D5ABCDEF").hashCode()))); + } + + @Test + public void macAddressComparison() { + assertThat(new MACAddress("D073D5ABCDEF"), is(new MACAddress("D073D5ABCDEF"))); + assertThat(new MACAddress("D073D5ABCDEF").hashCode(), is(new MACAddress("D073D5ABCDEF").hashCode())); + + assertThat(new MACAddress("D073D5ABCDEF"), is(not(BROADCAST_ADDRESS))); + assertThat(new MACAddress("D073D5ABCDEF").hashCode(), is(not(BROADCAST_ADDRESS.hashCode()))); + + assertThat(new MACAddress("D073D5ABCDEF"), is(not(new MACAddress("D073D5123456")))); + assertThat(new MACAddress("D073D5ABCDEF").hashCode(), is(not(new MACAddress("D073D5123456").hashCode()))); + } +}