Class PcscPluginFactoryBuilder.Builder
- Enclosing class:
- PcscPluginFactoryBuilder
PcscPluginFactory
.- Since:
- 2.0.0
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Returns an instance of PcscPluginFactory created from the fields set on this builder.setCardMonitoringCycleDuration
(int cycleDuration) Sets the cycle duration for card monitoring (insertion and removal).setProvider
(Provider provider) Replace the default jnasmartcardio provider by the provider given in argument.updateProtocolIdentificationRule
(String readerProtocolName, String protocolRule) Updates a protocol identification rule.useContactlessReaderIdentificationFilter
(String contactlessReaderIdentificationFilter) Overwrites the default filter with the provided filter based on regular expressions to make the plugin able to identify a contact reader from its name.useContactReaderIdentificationFilter
(String contactReaderIdentificationFilter) Deprecated.
-
Method Details
-
useContactReaderIdentificationFilter
@Deprecated public PcscPluginFactoryBuilder.Builder useContactReaderIdentificationFilter(String contactReaderIdentificationFilter) Deprecated.Useless method that will be removed soon, seeuseContactlessReaderIdentificationFilter(String)
Sets a filter based on regular expressions to make the plugin able to identify a contact reader from its name.Readers whose names match the provided regular expression will be considered contact type readers.
For example, the string ".*less.*" could identify all readers having "less" in their name as contactless readers.
Names are not always as explicit, so it is sometimes better to test the brand and model.
Commonly used contact readers include "Cherry TC" or "Identive".
Thus, an application using these readers should call this method with".*(Cherry TC|Identive).*"
as an argument.- Parameters:
contactReaderIdentificationFilter
- A string a regular expression.- Returns:
- This builder.
- Since:
- 2.0.0
-
useContactlessReaderIdentificationFilter
public PcscPluginFactoryBuilder.Builder useContactlessReaderIdentificationFilter(String contactlessReaderIdentificationFilter) Overwrites the default filter with the provided filter based on regular expressions to make the plugin able to identify a contact reader from its name.Readers whose names match the provided regular expression will be considered contactless type readers.
The default value is "(?i).*(contactless|ask logo|acs acr122).*"
- Parameters:
contactlessReaderIdentificationFilter
- A regular expression.- Returns:
- This builder.
- Throws:
IllegalArgumentException
- If the provided string is null, empty or invalid.- Since:
- 2.0.0
- See Also:
-
updateProtocolIdentificationRule
public PcscPluginFactoryBuilder.Builder updateProtocolIdentificationRule(String readerProtocolName, String protocolRule) Updates a protocol identification rule.A protocol rule is a regular expression contained in a String.
- If a rule already exists for the provided protocol, it is replaced.
- If no rule exists for the provided protocol, it is added.
- If the rule is null, the protocol is disabled.
- Parameters:
readerProtocolName
- A not empty String.protocolRule
- null to disable the protocol.- Returns:
- This builder.
- Throws:
IllegalArgumentException
- If one of the argument is null or empty- Since:
- 2.0.0
-
setCardMonitoringCycleDuration
Sets the cycle duration for card monitoring (insertion and removal).This parameter allows you to reduce the default value of 500 ms if the underlying layer doesn't allow multiple accesses to the reader, resulting in high latency in processing.
This is particularly useful under Linux when, in observed mode, the APDU processing is not executed in the same thread as the one used for card detection. A similar case occurs when several readers are observed simultaneously.
The value given here should be determined with care, as it can lead to a significant increase in the CPU load generated by the application.
- Parameters:
cycleDuration
- The cycle duration for card monitoring, a positive integer in milliseconds.- Returns:
- This builder.
- Throws:
IllegalArgumentException
- If the provided value is out of range.- Since:
- 2.3.0
-
setProvider
Replace the default jnasmartcardio provider by the provider given in argument.- Parameters:
provider
- The provider to use, must not be null.- Returns:
- This builder.
- Throws:
IllegalArgumentException
- If the argument is null.- Since:
- 2.4.0
-
build
Returns an instance of PcscPluginFactory created from the fields set on this builder.The type of reader is determined using a regular expression applied to its name.
The default regular expression is "(?i).*(contactless|ask logo|acs acr122).*".
Readers that do not match this regular expression are considered contact type.
It is possible to redefine the contactless reader filter via the methoduseContactlessReaderIdentificationFilter(String)
.- Returns:
- A
PcscPluginFactory
- Since:
- 2.0.0
-
useContactlessReaderIdentificationFilter(String)