]> git.basschouten.com Git - openhab-addons.git/commitdiff
[avmfritz] Minor improvements in code an documentation (#9464)
authorChristoph Weitkamp <github@christophweitkamp.de>
Tue, 22 Dec 2020 23:30:04 +0000 (00:30 +0100)
committerGitHub <noreply@github.com>
Tue, 22 Dec 2020 23:30:04 +0000 (15:30 -0800)
Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
bundles/org.openhab.binding.avmfritz/README.md
bundles/org.openhab.binding.avmfritz/src/main/java/org/openhab/binding/avmfritz/internal/AVMFritzTlsTrustManagerProvider.java
bundles/org.openhab.binding.avmfritz/src/main/java/org/openhab/binding/avmfritz/internal/callmonitor/CallMonitor.java
bundles/org.openhab.binding.avmfritz/src/main/java/org/openhab/binding/avmfritz/internal/handler/BoxHandler.java

index 8e5b88690202c16513f9bb3a858d5d1110020dda..68dda54997f587a9cb0c41b8c660cf650e75c831 100644 (file)
@@ -160,9 +160,9 @@ The AIN (actor identification number) can be found in the FRITZ!Box interface ->
 
 | Channel Type ID | Item Type                | Description                                                                                                                                        | Available on thing                                                                                                  |
 |-----------------|--------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------|
-| incoming_call   | Call                     | Details about incoming call.                                                                                                                       | FRITZ!Box                                                                                                           |
-| outgoing_call   | Call                     | Details about outgoing call.                                                                                                                       | FRITZ!Box                                                                                                           |
-| active_call     | Call                     | Details about active call.                                                                                                                         | FRITZ!Box                                                                                                           |
+| incoming_call   | Call                     | Details about incoming call. %2$s contains the external, calling number, %1$s is the internal, receiving number.                                   | FRITZ!Box                                                                                                           |
+| outgoing_call   | Call                     | Details about outgoing call. %1$s contains the external, called number, %2$s is the internal, calling number.                                      | FRITZ!Box                                                                                                           |
+| active_call     | Call                     | Details about active call. %1$s contains the external, calling number, %2$s is empty.                                                              | FRITZ!Box                                                                                                           |
 | call_state      | String                   | Details about current call state, either IDLE, RINGING, DIALING or ACTIVE.                                                                         | FRITZ!Box                                                                                                           |
 | apply_template  | String                   | Apply template for device(s) (channel's state options contains available templates, for an alternative way see the description below) - FRITZ!OS 7 | FRITZ!Box, FRITZ!Powerline 546E                                                                                     |
 | mode            | String                   | States the mode of the device (MANUAL/AUTOMATIC/VACATION)                                                                                          | FRITZ!DECT 210, FRITZ!DECT 200, FRITZ!Powerline 546E, FRITZ!DECT 301, FRITZ!DECT 300, Comet DECT                    |
index 010a3b19ab225b79ae6cf08fb5206d707e623f88..55c1e1797a2243a67ea076df3fdf7c33ec348fff 100644 (file)
@@ -22,7 +22,7 @@ import org.osgi.service.component.annotations.Component;
 /**
  * Provides a TrustManager to allow secure connections to any FRITZ!Box
  *
- * @author Chritoph Weitkamp - Initial Contribution
+ * @author Christoph Weitkamp - Initial Contribution
  */
 @Component
 @NonNullByDefault
index 6905c9aa491094e94cc1607066f20822c0cc5242..62ee9e7db08ba81f7c379d7c4392f779cbcdef95 100644 (file)
@@ -45,10 +45,10 @@ public class CallMonitor {
     private final int MONITOR_PORT = 1012;
 
     private @Nullable CallMonitorThread monitorThread;
-    private ScheduledFuture<?> reconnectJob;
+    private final ScheduledFuture<?> reconnectJob;
 
-    private String ip;
-    private BoxHandler handler;
+    private final String ip;
+    private final BoxHandler handler;
 
     public CallMonitor(String ip, BoxHandler handler, ScheduledExecutorService scheduler) {
         this.ip = ip;
index 75d6b287149e3ae27e5c2ecc18366a59d77dc9c1..1bbcb225c434fcb4c941a30f24ebce36c73a2b83 100644 (file)
  */
 package org.openhab.binding.avmfritz.internal.handler;
 
-import java.util.HashSet;
+import static org.openhab.binding.avmfritz.internal.AVMFritzBindingConstants.*;
+
 import java.util.Set;
 
 import org.eclipse.jdt.annotation.NonNullByDefault;
 import org.eclipse.jdt.annotation.Nullable;
 import org.eclipse.jetty.client.HttpClient;
-import org.openhab.binding.avmfritz.internal.AVMFritzBindingConstants;
 import org.openhab.binding.avmfritz.internal.AVMFritzDynamicCommandDescriptionProvider;
 import org.openhab.binding.avmfritz.internal.callmonitor.CallMonitor;
 import org.openhab.binding.avmfritz.internal.config.AVMFritzBoxConfiguration;
@@ -38,14 +38,8 @@ import org.openhab.core.types.State;
 @NonNullByDefault
 public class BoxHandler extends AVMFritzBaseBridgeHandler {
 
-    protected static final Set<String> CALL_CHANNELS = new HashSet<>();
-    static {
-        // TODO: We are still on Java 8 and cannot use Set.of
-        CALL_CHANNELS.add(AVMFritzBindingConstants.CHANNEL_CALL_ACTIVE);
-        CALL_CHANNELS.add(AVMFritzBindingConstants.CHANNEL_CALL_INCOMING);
-        CALL_CHANNELS.add(AVMFritzBindingConstants.CHANNEL_CALL_OUTGOING);
-        CALL_CHANNELS.add(AVMFritzBindingConstants.CHANNEL_CALL_STATE);
-    }
+    private static final Set<String> CALL_CHANNELS = Set.of(CHANNEL_CALL_ACTIVE, CHANNEL_CALL_INCOMING,
+            CHANNEL_CALL_OUTGOING, CHANNEL_CALL_STATE);
 
     private @Nullable CallMonitor callMonitor;