Hello Angelo, Jan,
In general, Angelo is completely right, but there is one thing in his response
that is not:
.setService(IGPIOPin.class, "&((" + Constants.OBJECTCLASS + "=" +
IGPIOPin.class.getName() + ")(PinNumber=1))")
.setRequired(true)
.setAutoConfig("fanPin"))
In the code above, Angelo added the ObjectClass to the filter, because:
Remember to include the ObjectClass in the filter, as you override the service
filter that would normally be created, and you could end up with any other
service that has the PinNumber property set to 1.
However, that is not correct. If you use setService(class, filter) and you
specify both, DM (both version 3 and the just released version 4) will
construct a filter for you consisting of both the ObjectClass and the
conditions you specify. So the code above will work, it will just have a filter
for ObjectClass twice. ;)
Greetings, Marcel