]> git.basschouten.com Git - openhab-addons.git/blob
904c4c585123d52edc3ae887faf05fba88c5e7c3
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2024 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 RouterosWirelessRegistration} is a model class for WiFi client data retrieced from RouterOS
24  * physical wireless interface. Is a subclass of {@link RouterosRegistrationBase}.
25  *
26  * @author Oleg Vivtash - Initial contribution
27  */
28 @NonNullByDefault
29 public class RouterosWirelessRegistration extends RouterosRegistrationBase {
30     public RouterosWirelessRegistration(Map<String, String> props) {
31         super(props);
32     }
33
34     public int getRxSignal() {
35         String signalValue = getProp("signal-strength", "0@hz").split("@")[0];
36         return Integer.parseInt(signalValue);
37     }
38
39     public @Nullable LocalDateTime getLastActivity() {
40         return Converter.routerosPeriodBack(getProp("last-activity"));
41     }
42 }