]> git.basschouten.com Git - openhab-addons.git/blob
325d23275a83af283d6a0582496647053150d690
[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.mikrotik.internal.model;
14
15 import java.util.Map;
16
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18 import org.eclipse.jdt.annotation.Nullable;
19
20 /**
21  * The {@link RouterosCapInterface} is a model class for `cap` interface models having casting accessors for
22  * data that is specific to this network interface kind. Is a subclass of {@link RouterosInterfaceBase}.
23  *
24  * @author Oleg Vivtash - Initial contribution
25  */
26 @NonNullByDefault
27 public class RouterosCapInterface extends RouterosInterfaceBase {
28     public RouterosCapInterface(Map<String, String> props) {
29         super(props);
30     }
31
32     @Override
33     public RouterosInterfaceType getDesignedType() {
34         return RouterosInterfaceType.CAP;
35     }
36
37     @Override
38     public boolean hasDetailedReport() {
39         return true;
40     }
41
42     @Override
43     public boolean hasMonitor() {
44         return false;
45     }
46
47     public boolean isMaster() {
48         return "false".equals(getProp("slave", ""));
49     }
50
51     public boolean isDynamic() {
52         return "true".equals(getProp("dynamic", ""));
53     }
54
55     public boolean isBound() {
56         return "true".equals(getProp("bound", ""));
57     }
58
59     public boolean isActive() {
60         return "false".equals(getProp("inactive", ""));
61     }
62
63     public @Nullable String getCurrentState() {
64         return getProp("current-state");
65     }
66
67     public @Nullable String getRateSet() {
68         return getProp("current-basic-rate-set");
69     }
70
71     public @Nullable Integer getRegisteredClients() {
72         return getIntProp("current-registered-clients");
73     }
74
75     public @Nullable Integer getAuthorizedClients() {
76         return getIntProp("current-authorized-clients");
77     }
78 }