]> git.basschouten.com Git - openhab-addons.git/blob
b61479fb82f12852ebc9c8238deaca39cc3629b5
[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.time.LocalDateTime;
16 import java.util.Map;
17
18 import org.eclipse.jdt.annotation.NonNullByDefault;
19 import org.eclipse.jdt.annotation.Nullable;
20 import org.openhab.binding.mikrotik.internal.util.Converter;
21
22 /**
23  * The {@link RouterosPPPoECliInterface} is a model class for `pppoe-out` interface models having casting accessors for
24  * data that is specific to this network interface kind. Is a subclass of {@link RouterosInterfaceBase}.
25  *
26  * @author Oleg Vivtash - Initial contribution
27  */
28 @NonNullByDefault
29 public class RouterosPPPoECliInterface extends RouterosInterfaceBase {
30     public RouterosPPPoECliInterface(Map<String, String> props) {
31         super(props);
32     }
33
34     @Override
35     public RouterosInterfaceType getDesignedType() {
36         return RouterosInterfaceType.PPPOE_CLIENT;
37     }
38
39     @Override
40     public String getApiType() {
41         return "pppoe-client";
42     }
43
44     @Override
45     public boolean hasDetailedReport() {
46         return false;
47     }
48
49     @Override
50     public boolean hasMonitor() {
51         return true;
52     }
53
54     public @Nullable String getMacAddress() {
55         return getProp("ac-mac");
56     }
57
58     public @Nullable String getStatus() {
59         return getProp("status");
60     }
61
62     public @Nullable String getUptime() {
63         return getProp("uptime");
64     }
65
66     public @Nullable LocalDateTime getUptimeStart() {
67         return Converter.routerosPeriodBack(getUptime());
68     }
69 }