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.sonos.internal;
15 import java.util.List;
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18 import org.eclipse.jdt.annotation.Nullable;
19 import org.openhab.core.events.EventPublisher;
20 import org.openhab.core.thing.ChannelUID;
21 import org.openhab.core.thing.binding.BaseDynamicStateDescriptionProvider;
22 import org.openhab.core.thing.i18n.ChannelTypeI18nLocalizationService;
23 import org.openhab.core.thing.link.ItemChannelLinkRegistry;
24 import org.openhab.core.thing.type.DynamicStateDescriptionProvider;
25 import org.openhab.core.types.StateOption;
26 import org.osgi.service.component.annotations.Activate;
27 import org.osgi.service.component.annotations.Component;
28 import org.osgi.service.component.annotations.Reference;
31 * Dynamic provider of state options while leaving other state description fields as original.
33 * @author Laurent Garnier - Initial contribution
35 @Component(service = { DynamicStateDescriptionProvider.class, SonosStateDescriptionOptionProvider.class })
37 public class SonosStateDescriptionOptionProvider extends BaseDynamicStateDescriptionProvider {
40 public SonosStateDescriptionOptionProvider(final @Reference EventPublisher eventPublisher, //
41 final @Reference ItemChannelLinkRegistry itemChannelLinkRegistry, //
42 final @Reference ChannelTypeI18nLocalizationService channelTypeI18nLocalizationService) {
43 this.eventPublisher = eventPublisher;
44 this.itemChannelLinkRegistry = itemChannelLinkRegistry;
45 this.channelTypeI18nLocalizationService = channelTypeI18nLocalizationService;
48 public @Nullable List<StateOption> getStateOptions(ChannelUID channelUID) {
49 return channelOptionsMap.get(channelUID);