/** * Creates a PowerDescriptor * * @param currentPowerMode * @param availablePowerSources * @param currentPowerSource * @param powerLevel */ public PowerDescriptor(int currentPowerMode, int availablePowerSources, int currentPowerSource, int powerLevel) { setCurrentPowerMode(currentPowerMode); setAvailablePowerSources(availablePowerSources); setCurrentPowerSource(currentPowerSource); setCurrentPowerLevel(powerLevel); }
/** * Deserialise the contents of the structure. * * @param deserializer the {@link ZigBeeDeserializer} used to deserialize */ public void deserialize(ZigBeeDeserializer deserializer) { // Deserialize the fields int byte1 = (int) deserializer.readZigBeeType(ZclDataType.UNSIGNED_8_BIT_INTEGER); int byte2 = (int) deserializer.readZigBeeType(ZclDataType.UNSIGNED_8_BIT_INTEGER); setCurrentPowerMode(byte1 & 0x0f); setAvailablePowerSources(byte1 >> 4 & 0x0f); setCurrentPowerSource(byte2 & 0x0f); setCurrentPowerLevel(byte2 >> 4 & 0x0f); }