]> git.basschouten.com Git - openhab-addons.git/blob
cea29fa76c6e2e29882ba43ffe21ebd1f8a1b53a
[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.network.internal;
14
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.eclipse.jdt.annotation.Nullable;
17
18 /**
19  * The {@link SpeedTestConfiguration} is the class used to match the
20  * thing configuration.
21  *
22  * @author GaĆ«l L'hopital - Initial contribution
23  */
24 @NonNullByDefault
25 public class SpeedTestConfiguration {
26     public int refreshInterval = 20;
27     public int initialDelay = 5;
28     public int uploadSize = 1000000;
29     public int maxTimeout = 3;
30     private @Nullable String url;
31     private @Nullable String fileName;
32
33     public @Nullable String getUploadURL() {
34         String localUrl = url;
35         if (localUrl != null) {
36             localUrl += localUrl.endsWith("/") ? "" : "/";
37         }
38         return localUrl;
39     }
40
41     public @Nullable String getDownloadURL() {
42         String result = getUploadURL();
43         if (result != null && fileName != null) {
44             result += fileName;
45         }
46         return result;
47     }
48 }