Interface FirmwareRestriction

All Superinterfaces:
Function<Thing,Boolean>

@NonNullByDefault public interface FirmwareRestriction extends Function<Thing,Boolean>
A function for defining specific installation restrictions for a given Firmware.

Example: Consider a device where:
  • the firmware with version 5 must only be installed if the device currently has firmware version 1 installed;
  • the firmware with version 4 can only be installed if the device currently has firmware version 3 installed.
In such case the restrictions function can be defined as follows in the FirmwareProvider:
 {
     @code
     Firmware firmwareV5 = FirmwareBuilder.create(thingTypeUID, "5").withCustomRestrictions(
             // Hardware version A
             thing -> "1".equals(thing.getProperties().get(Thing.PROPERTY_FIRMWARE_VERSION))).build();

     Firmware firmwareV4 = FirmwareBuilder.create(thingTypeUID, "4").withCustomRestrictions(
             // Hardware version B
             thing -> "3".equals(thing.getProperties().get(Thing.PROPERTY_FIRMWARE_VERSION))).build();
 }
 
Author:
Dimitar Ivanov - Initial contribution