-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[tacmi] initial WIP-Checkin of the "Schema API Page" variant
- Loading branch information
Showing
12 changed files
with
1,355 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
...ding.tacmi/src/main/java/org/openhab/binding/tacmi/internal/TACmiChannelTypeProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/** | ||
* Copyright (c) 2010-2020 Contributors to the openHAB project | ||
* | ||
* See the NOTICE file(s) distributed with this work for additional | ||
* information. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0 | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
*/ | ||
package org.openhab.binding.tacmi.internal; | ||
|
||
import java.util.Collection; | ||
import java.util.Collections; | ||
import java.util.HashMap; | ||
import java.util.Locale; | ||
import java.util.Map; | ||
|
||
import org.eclipse.jdt.annotation.NonNullByDefault; | ||
import org.eclipse.jdt.annotation.Nullable; | ||
import org.eclipse.smarthome.core.thing.type.ChannelType; | ||
import org.eclipse.smarthome.core.thing.type.ChannelTypeProvider; | ||
import org.eclipse.smarthome.core.thing.type.ChannelTypeUID; | ||
import org.osgi.service.component.annotations.Component; | ||
|
||
/** | ||
* Provides all ChannelTypes for the schema binding... | ||
* | ||
* @author Christian Niessner (marvkis) - Initial contribution | ||
*/ | ||
@NonNullByDefault | ||
@Component(service = { TACmiChannelTypeProvider.class, ChannelTypeProvider.class }, immediate = true) | ||
public class TACmiChannelTypeProvider implements ChannelTypeProvider { | ||
|
||
private final Map<ChannelTypeUID, ChannelType> channelTypesByUID = new HashMap<>(); | ||
|
||
@Override | ||
public Collection<ChannelType> getChannelTypes(@Nullable Locale locale) { | ||
return Collections.unmodifiableCollection(channelTypesByUID.values()); | ||
} | ||
|
||
@Override | ||
public @Nullable ChannelType getChannelType(ChannelTypeUID channelTypeUID, @Nullable Locale locale) { | ||
return channelTypesByUID.get(channelTypeUID); | ||
} | ||
|
||
public ChannelType getInternalChannelType(ChannelTypeUID channelTypeUID) { | ||
return channelTypesByUID.get(channelTypeUID); | ||
} | ||
|
||
public void addChannelType(ChannelType channelType) { | ||
channelTypesByUID.put(channelType.getUID(), channelType); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
...b.binding.tacmi/src/main/java/org/openhab/binding/tacmi/internal/schema/ApiPageEntry.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/** | ||
* Copyright (c) 2010-2020 Contributors to the openHAB project | ||
* | ||
* See the NOTICE file(s) distributed with this work for additional | ||
* information. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0 | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
*/ | ||
package org.openhab.binding.tacmi.internal.schema; | ||
|
||
import org.eclipse.jdt.annotation.NonNullByDefault; | ||
import org.eclipse.jdt.annotation.Nullable; | ||
import org.eclipse.smarthome.core.thing.Channel; | ||
|
||
/** | ||
* The {@link ApiPageEntry} class contains mapping information for an entry of | ||
* the API page. | ||
* | ||
* @author Christian Niessner (marvkis) - Initial contribution | ||
*/ | ||
@NonNullByDefault | ||
public class ApiPageEntry { | ||
|
||
static enum Type { | ||
ReadOnlySwitch(true), ReadOnlyNumeric(true), NumericForm(false), SwitchButton(false), SwitchForm(false), ReadOnlyState(true), StateForm(false); | ||
|
||
public final boolean readOnly; | ||
|
||
private Type(boolean readOnly) { | ||
this.readOnly = readOnly; | ||
} | ||
} | ||
|
||
/** | ||
* type of this entry | ||
*/ | ||
public final Type type; | ||
|
||
/** | ||
* The channel for this entry | ||
*/ | ||
public final Channel channel; | ||
|
||
/** | ||
* internal address for this channel | ||
*/ | ||
public final @Nullable String address; | ||
|
||
/** | ||
* data for handle 'changerx2' form fields | ||
*/ | ||
public final @Nullable ChangerX2Entry changerX2Entry; | ||
|
||
protected ApiPageEntry(final Type type, final Channel channel, @Nullable final String address, @Nullable ChangerX2Entry changerX2Entry) { | ||
this.type = type; | ||
this.channel = channel; | ||
this.address = address; | ||
this.changerX2Entry = changerX2Entry; | ||
} | ||
} |
Oops, something went wrong.