From d3839d7f956575dc45437775573d43bc0c113d6e Mon Sep 17 00:00:00 2001 From: Tom Aarts Date: Fri, 22 Nov 2024 20:05:48 -0600 Subject: [PATCH] clarification of Mock Context create --- content/about/release-notes.md | 2 +- content/documentation/create-context.md | 8 ++++++++ content/documentation/providers/_index.md | 3 ++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/content/about/release-notes.md b/content/about/release-notes.md index eb42537c9..85f4158b0 100644 --- a/content/about/release-notes.md +++ b/content/about/release-notes.md @@ -21,7 +21,7 @@ All releases of Pi4J V.2 are listed on [github.com/Pi4J/pi4j-v2/releases](https: Because of the changes in the loading of the mock providers, if you want to load them on a Raspberry Pi board, you need to use the following context builder: ```java -var pi4j = Pi4J.newContextBuilder().autoDetectMockPlugins().build(); +var pi4j = Pi4J.newContextBuilder().autoDetectMockPlugins().autoDetectPlatforms().build(); ``` Thanks to contributions by [@ylexus](https://github.com/ylexus), [@mores](https://github.com/mores), [@taartspi](https://github.com/taartspi), [@eitch](https://github.com/eitch), [@fdelporte](https://github.com/fdelporte). diff --git a/content/documentation/create-context.md b/content/documentation/create-context.md index 9e32db618..b204db631 100644 --- a/content/documentation/create-context.md +++ b/content/documentation/create-context.md @@ -20,6 +20,8 @@ allowing users to customize the context configuration. ### Automatic An auto context includes AUTO-DETECT BINDINGS enabled which will load all detected Pi4J extension libraries (Platforms and Providers) in the class path. +Note: Starting with 2.5.0-SNAPSHOT the Mock providers are not loaded. If the Mock providers are required see +Alternate Context Creation With Mock Providers. ``` java var pi4j = Pi4J.newAutoContext(); @@ -44,6 +46,12 @@ Context pi4j = Pi4J.newContextBuilder() .add(new MyCustomSPIProvider(/* implements SpiProvider, id="my-spi-prov" */)) .build(); ``` +### Alternate Context Creation With Mock Providers +The following code example will create a Context containing all the Mock Providers and Platform. + + ``` java +Context pi4j = Pi4J.newContextBuilder().autoDetectMockPlugins().autoDetectPlatforms().build(); + ``` ## More information diff --git a/content/documentation/providers/_index.md b/content/documentation/providers/_index.md index 3e7764333..09e4ab3b9 100644 --- a/content/documentation/providers/_index.md +++ b/content/documentation/providers/_index.md @@ -13,7 +13,8 @@ Pi4J 2.0 - 2.4: Multiple providers for the same I/O type can be loaded into a Pi inputs at the same time. As of Pi4J 2.5 multiple providers for the same I/O type is no longer supported. During the Context initialization it will -ensure only a single provider for an I/O type is loaded. +ensure only a single provider for an I/O type is loaded. In addition the Mock Providers are not loaded unless +expressly requested when creating the Context. [See Create Context](../create-context.md) Current supported providers: