2 * Copyright (c) 2010-2023 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
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
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.binding.ecovacs.internal.api;
15 import java.util.List;
16 import java.util.Optional;
17 import java.util.concurrent.ScheduledExecutorService;
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;
26 * @author Danny Baumann - Initial contribution
29 public interface EcovacsDevice {
30 public interface EventListener {
31 void onFirmwareVersionChanged(EcovacsDevice device, String fwVersion);
33 void onBatteryLevelUpdated(EcovacsDevice device, int newLevelPercent);
35 void onChargingStateUpdated(EcovacsDevice device, boolean charging);
37 void onCleaningModeUpdated(EcovacsDevice device, CleanMode newMode, Optional<String> areaDefinition);
39 void onCleaningStatsUpdated(EcovacsDevice device, int cleanedArea, int cleaningTimeSeconds);
41 void onWaterSystemPresentUpdated(EcovacsDevice device, boolean present);
43 void onErrorReported(EcovacsDevice device, int errorCode);
45 void onEventStreamFailure(EcovacsDevice device, Throwable error);
48 String getSerialNumber();
50 String getModelName();
52 boolean hasCapability(DeviceCapability cap);
54 void connect(EventListener listener, ScheduledExecutorService scheduler)
55 throws EcovacsApiException, InterruptedException;
57 void disconnect(ScheduledExecutorService scheduler);
59 <T> T sendCommand(IotDeviceCommand<T> command) throws EcovacsApiException, InterruptedException;
61 List<CleanLogRecord> getCleanLogs() throws EcovacsApiException, InterruptedException;