]> git.basschouten.com Git - openhab-addons.git/blob
e74e3f496457357590ef76378974905f5c95ee5d
[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.ecovacs.internal.api;
14
15 import java.util.List;
16 import java.util.Optional;
17 import java.util.concurrent.ScheduledExecutorService;
18
19 import org.eclipse.jdt.annotation.NonNullByDefault;
20 import org.openhab.binding.ecovacs.internal.api.commands.IotDeviceCommand;
21 import org.openhab.binding.ecovacs.internal.api.model.CleanLogRecord;
22 import org.openhab.binding.ecovacs.internal.api.model.CleanMode;
23 import org.openhab.binding.ecovacs.internal.api.model.DeviceCapability;
24
25 /**
26  * @author Danny Baumann - Initial contribution
27  */
28 @NonNullByDefault
29 public interface EcovacsDevice {
30     public interface EventListener {
31         void onFirmwareVersionChanged(EcovacsDevice device, String fwVersion);
32
33         void onBatteryLevelUpdated(EcovacsDevice device, int newLevelPercent);
34
35         void onChargingStateUpdated(EcovacsDevice device, boolean charging);
36
37         void onCleaningModeUpdated(EcovacsDevice device, CleanMode newMode, Optional<String> areaDefinition);
38
39         void onCleaningStatsUpdated(EcovacsDevice device, int cleanedArea, int cleaningTimeSeconds);
40
41         void onWaterSystemPresentUpdated(EcovacsDevice device, boolean present);
42
43         void onErrorReported(EcovacsDevice device, int errorCode);
44
45         void onEventStreamFailure(EcovacsDevice device, Throwable error);
46     }
47
48     String getSerialNumber();
49
50     String getModelName();
51
52     boolean hasCapability(DeviceCapability cap);
53
54     void connect(EventListener listener, ScheduledExecutorService scheduler)
55             throws EcovacsApiException, InterruptedException;
56
57     void disconnect(ScheduledExecutorService scheduler);
58
59     <T> T sendCommand(IotDeviceCommand<T> command) throws EcovacsApiException, InterruptedException;
60
61     List<CleanLogRecord> getCleanLogs() throws EcovacsApiException, InterruptedException;
62 }