]> git.basschouten.com Git - openhab-addons.git/blob
710a14a474d3b8d6ceb8d6b4433fc68ec5d532ae
[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 RouterosEthernetInterface} is a model class for `ether` 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 RouterosEthernetInterface extends RouterosInterfaceBase {
28     public RouterosEthernetInterface(Map<String, String> props) {
29         super(props);
30     }
31
32     @Override
33     public RouterosInterfaceType getDesignedType() {
34         return RouterosInterfaceType.ETHERNET;
35     }
36
37     @Override
38     public String getApiType() {
39         return "ethernet";
40     }
41
42     @Override
43     public boolean hasDetailedReport() {
44         return true;
45     }
46
47     @Override
48     public boolean hasMonitor() {
49         // PowerLine interfaces are of ehter type too
50         String name = getDefaultName();
51         return name != null && !name.startsWith("pwr");
52     }
53
54     public @Nullable String getDefaultName() {
55         return getProp("default-name");
56     }
57
58     public @Nullable String getRate() {
59         return getProp("rate");
60     }
61
62     public @Nullable String getState() {
63         return getProp("status");
64     }
65 }