Fix "No SerialPortProvider found" on startup (#939)

Change reference cardinality from MULTIPLE to AT_LEAST_ONE so the serial port provider can be used immediately when ThingHandlers are initialized.

Fixes #937

This would always result in the following logging on startup:

[WARN ] [serial.internal.SerialPortManagerImpl] - No SerialPortProvider found for: /dev/ttyUSB0

Bindings without serial port reconnection logic would need to be manually restarted (Z-Wave Binding).

Signed-off-by: Wouter Born <github@maindrain.net>
This commit is contained in:
Wouter Born 2019-07-29 21:23:18 +02:00 committed by Kai Kreuzer
parent 95e0190d55
commit 9e7c6af1c8

View File

@ -50,7 +50,7 @@ public class SerialPortRegistry {
*
* @param creator
*/
@Reference(cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC, policyOption = ReferencePolicyOption.GREEDY)
@Reference(cardinality = ReferenceCardinality.AT_LEAST_ONE, policy = ReferencePolicy.DYNAMIC, policyOption = ReferencePolicyOption.GREEDY)
protected void registerSerialPortCreator(SerialPortProvider creator) {
synchronized (this.portCreators) {
this.portCreators.add(creator);