use of org.eclipse.smarthome.binding.lifx.internal.protocol.StateWifiFirmwareResponse in project smarthome by eclipse.
the class LifxLightPropertiesUpdater method handleResponsePacket.
public void handleResponsePacket(Packet packet) {
if (!updating) {
return;
}
if (packet instanceof StateVersionResponse) {
Products products = Products.getProductFromProductID(((StateVersionResponse) packet).getProduct());
long productVersion = ((StateVersionResponse) packet).getVersion();
properties.put(LifxBindingConstants.PROPERTY_PRODUCT_ID, Long.toString(products.getProduct()));
properties.put(LifxBindingConstants.PROPERTY_PRODUCT_NAME, products.getName());
properties.put(LifxBindingConstants.PROPERTY_PRODUCT_VERSION, Long.toString(productVersion));
properties.put(LifxBindingConstants.PROPERTY_VENDOR_ID, Long.toString(products.getVendor()));
properties.put(LifxBindingConstants.PROPERTY_VENDOR_NAME, products.getVendorName());
receivedPacketTypes.add(packet.getPacketType());
} else if (packet instanceof StateHostFirmwareResponse) {
String hostVersion = ((StateHostFirmwareResponse) packet).getVersion().toString();
properties.put(LifxBindingConstants.PROPERTY_HOST_VERSION, hostVersion);
receivedPacketTypes.add(packet.getPacketType());
} else if (packet instanceof StateWifiFirmwareResponse) {
String wifiVersion = ((StateWifiFirmwareResponse) packet).getVersion().toString();
properties.put(LifxBindingConstants.PROPERTY_WIFI_VERSION, wifiVersion);
receivedPacketTypes.add(packet.getPacketType());
}
if (receivedAllResponsePackets()) {
updating = false;
propertiesUpdateListeners.forEach(listener -> listener.handlePropertiesUpdate(properties));
logger.debug("{} : Finished updating light properties", logId);
}
}
Aggregations