Pi4J / pi4j-v2

Pi4J Version 2.0
Apache License 2.0
266 stars 54 forks source link

Extended Providers with a priority and have mock plugins marked as such #315

Closed eitch closed 6 months ago

eitch commented 6 months ago

Extended Providers with a priority

This priority helps to determine which Provider should be loaded, when multiple providers with the same IOType are being loaded by different plugins.

This change enforces that a given IOType can only have one Provider loaded at runtime. Currently there is no known situation where this would be necessary, but could lead to problems if for instance two I2C providers are loaded at the same time, concurrently writing to the I2C bus.

Providers explicitly passed in the context config override the priority.

Better handling of mock plugins

Plugins can now define if they are mocks, and these are not auto-detected anymore.

The default target for the pi4j library is the Raspberry Pi, and thus auto-detecting mocks on the Pi, which are only for tests is counterintuitive.