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.hue.internal.api.dto.clip2;
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.eclipse.jdt.annotation.Nullable;
17 import org.openhab.binding.hue.internal.api.dto.clip2.enums.ButtonEventType;
19 import com.google.gson.annotations.SerializedName;
22 * DTO for CLIP 2 button state.
24 * @author Andrew Fiddian-Green - Initial contribution
28 private @Nullable @SerializedName("last_event") String lastEvent;
29 private @Nullable @SerializedName("button_report") ButtonReport buttonReport;
30 private @SerializedName("repeat_interval") int repeatInterval;
33 * The underlying field is deprecated in the CLIP 2 API.
34 * Moved to button_report/event
36 * @return the last button event as an enum (null if none or invalid).
38 public @Nullable ButtonEventType getLastEvent() {
39 String lastEvent = this.lastEvent;
40 if (lastEvent == null) {
45 return ButtonEventType.valueOf(lastEvent.toUpperCase());
46 } catch (IllegalArgumentException e) {
51 public @Nullable ButtonReport getButtonReport() {