]> git.basschouten.com Git - openhab-addons.git/blob
5c0aab15cabff9c5895a138fb7e24c1010d68ede
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2023 Contributors to the openHAB project
3  *
4  * See the NOTICE file(s) distributed with this work for additional
5  * information.
6  *
7  * This program and the accompanying materials are made available under the
8  * terms of the Eclipse Public License 2.0 which is available at
9  * http://www.eclipse.org/legal/epl-2.0
10  *
11  * SPDX-License-Identifier: EPL-2.0
12  */
13 package org.openhab.binding.ojelectronics.internal.config;
14
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.eclipse.jdt.annotation.Nullable;
17
18 /**
19  * The configuration for {@link org.openhab.binding.ojelectronics.internal.OJCloudHandler}
20  *
21  * @author Christian Kittel - Initial contribution
22  */
23 @NonNullByDefault
24 public class OJElectronicsBridgeConfiguration {
25
26     /**
27      * Password
28      */
29     public String password = "";
30
31     /**
32      * Customer-ID
33      */
34     public int customerId = 1;
35
36     /**
37      * User Name
38      */
39     public String userName = "";
40
41     /**
42      * Url for API
43      */
44     private String apiUrl = "https://OWD5-OJ001-App.ojelectronics.com";
45
46     /**
47      * API-Key
48      */
49     public String apiKey = "";
50
51     /**
52      * Software Version
53      */
54     public int softwareVersion = 1060;
55
56     private @Nullable String restApiUrl;
57
58     /*
59      * Gets the Api-URL
60      */
61     public String getRestApiUrl() {
62         String localRestApiUrl = restApiUrl;
63         if (localRestApiUrl == null) {
64             localRestApiUrl = restApiUrl = apiUrl.replace("/api", "") + "/api";
65         }
66         return localRestApiUrl;
67     }
68
69     private @Nullable String signalRApiUrl;
70
71     /*
72      * Gets the SignalR Notification URL
73      */
74     public String getSignalRUrl() {
75         String localSignalRApiUrl = signalRApiUrl;
76         if (localSignalRApiUrl == null) {
77             localSignalRApiUrl = signalRApiUrl = apiUrl.replace("/api", "") + "/ocd5notification";
78         }
79         return localSignalRApiUrl;
80     }
81 }