forked from openhab/openhab-addons
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[linktap] Initial contribution (openhab#17235)
* [linkTap] Initial Code Commit [Signed-off-by: dag81 <david.goodyear@gmail.com>
- Loading branch information
Showing
78 changed files
with
8,376 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
This content is produced and maintained by the openHAB project. | ||
|
||
* Project home: https://www.openhab.org | ||
|
||
== Declared Project Licenses | ||
|
||
This program and the accompanying materials are made available under the terms | ||
of the Eclipse Public License 2.0 which is available at | ||
https://www.eclipse.org/legal/epl-2.0/. | ||
|
||
== Source Code | ||
|
||
https://github.com/openhab/openhab-addons | ||
|
||
== Third-party Content | ||
|
||
jsoup | ||
* License: MIT License | ||
* Project: https://jsoup.org/ | ||
* Source: https://github.com/jhy/jsoup |
Large diffs are not rendered by default.
Oops, something went wrong.
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,36 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
|
||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>org.openhab.addons.bundles</groupId> | ||
<artifactId>org.openhab.addons.reactor.bundles</artifactId> | ||
<version>4.3.0-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>org.openhab.binding.linktap</artifactId> | ||
|
||
<name>openHAB Add-ons :: Bundles :: LinkTap Binding</name> | ||
|
||
<properties> | ||
<jsoup.version>1.15.4</jsoup.version> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.jsoup</groupId> | ||
<artifactId>jsoup</artifactId> | ||
<version>${jsoup.version}</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
<version>4.13.2</version> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
</project> |
10 changes: 10 additions & 0 deletions
10
bundles/org.openhab.binding.linktap/src/main/feature/feature.xml
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,10 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<features name="org.openhab.binding.linktap-${project.version}" xmlns="http://karaf.apache.org/xmlns/features/v1.4.0"> | ||
<repository>mvn:org.openhab.core.features.karaf/org.openhab.core.features.karaf.openhab-core/${ohc.version}/xml/features</repository> | ||
|
||
<feature name="openhab-binding-linktap" description="LinkTap Binding" version="${project.version}"> | ||
<feature>openhab-runtime-base</feature> | ||
<bundle dependency="true">mvn:org.jsoup/jsoup/1.15.4</bundle> | ||
<bundle start-level="80">mvn:org.openhab.addons.bundles/org.openhab.binding.linktap/${project.version}</bundle> | ||
</feature> | ||
</features> |
31 changes: 31 additions & 0 deletions
31
...p/src/main/java/org/openhab/binding/linktap/configuration/LinkTapBridgeConfiguration.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,31 @@ | ||
/** | ||
* Copyright (c) 2010-2024 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.linktap.configuration; | ||
|
||
import org.eclipse.jdt.annotation.NonNullByDefault; | ||
|
||
/** | ||
* The {@link LinkTapBridgeConfiguration} class contains fields mapping bridge configuration parameters. | ||
* | ||
* @author David Goodyear - Initial contribution | ||
*/ | ||
@NonNullByDefault | ||
public class LinkTapBridgeConfiguration { | ||
|
||
public String host = ""; | ||
public String username = ""; | ||
public String password = ""; | ||
public boolean enableMDNS = true; | ||
public boolean enableJSONComms = false; | ||
public boolean enforceProtocolLimits = true; | ||
} |
40 changes: 40 additions & 0 deletions
40
...p/src/main/java/org/openhab/binding/linktap/configuration/LinkTapDeviceConfiguration.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,40 @@ | ||
/** | ||
* Copyright (c) 2010-2024 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.linktap.configuration; | ||
|
||
import org.eclipse.jdt.annotation.NonNullByDefault; | ||
|
||
/** | ||
* The {@link LinkTapDeviceConfiguration} class contains fields mapping the configuration parameters for a LinkTap | ||
* device's configuration. | ||
* | ||
* @author David Goodyear - Initial contribution | ||
*/ | ||
@NonNullByDefault | ||
public class LinkTapDeviceConfiguration { | ||
|
||
/** | ||
* The clear text device name as reported by the API. | ||
*/ | ||
public String name = ""; | ||
|
||
/** | ||
* The device id as stored by the gateway to address the device. | ||
*/ | ||
public String id = ""; | ||
|
||
/** | ||
* If enabled the device, will enable all alerts during device initialization. | ||
*/ | ||
public boolean enableAlerts = true; | ||
} |
32 changes: 32 additions & 0 deletions
32
...ktap/src/main/java/org/openhab/binding/linktap/internal/DeviceMetaDataUpdatedHandler.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,32 @@ | ||
/** | ||
* Copyright (c) 2010-2024 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.linktap.internal; | ||
|
||
import org.eclipse.jdt.annotation.NonNullByDefault; | ||
|
||
/** | ||
* The {@link DeviceMetaDataUpdatedHandler} enables call-backs for when the device meta-data is updated from a bridge. | ||
* | ||
* @author David Goodyear - Initial contribution | ||
*/ | ||
@NonNullByDefault | ||
public interface DeviceMetaDataUpdatedHandler { | ||
/** | ||
* Any registered metadata handlers, will have this | ||
* invoked after new configuration data has been retrieved from the GW. | ||
* | ||
* An example use is for the discovery service to refresh its data based on received | ||
* new configuration data of devices attached to a GW. | ||
*/ | ||
void handleMetadataRetrieved(LinkTapBridgeHandler handler); | ||
} |
68 changes: 68 additions & 0 deletions
68
....openhab.binding.linktap/src/main/java/org/openhab/binding/linktap/internal/Firmware.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,68 @@ | ||
/** | ||
* Copyright (c) 2010-2024 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.linktap.internal; | ||
|
||
import org.eclipse.jdt.annotation.NonNullByDefault; | ||
import org.eclipse.jdt.annotation.Nullable; | ||
|
||
/** | ||
* The {@link Firmware} class defines the firmware version. | ||
* | ||
* @author David Goodyear - Initial contribution | ||
*/ | ||
@NonNullByDefault | ||
public class Firmware { | ||
String raw; | ||
int buildVer; | ||
int hwVer; | ||
|
||
public Firmware(final @Nullable String fwVersion) { | ||
raw = "S00000000"; | ||
hwVer = 0; | ||
buildVer = 0; | ||
|
||
if (fwVersion == null || fwVersion.length() < 7) { | ||
return; | ||
} else { | ||
raw = fwVersion; | ||
buildVer = Integer.parseInt(raw.substring(1, 7)); | ||
} | ||
|
||
switch (fwVersion.charAt(0)) { | ||
case 'G': | ||
hwVer = 2; | ||
break; | ||
case 'S': | ||
hwVer = 1; | ||
break; | ||
default: | ||
break; | ||
} | ||
} | ||
|
||
public boolean supportsLocalConfig() { | ||
return buildVer >= 60883; | ||
} | ||
|
||
public boolean supportsMDNS() { | ||
return buildVer >= 60880; | ||
} | ||
|
||
public String generateTestedRevisionForHw(final int versionNo) { | ||
return String.format("%c%05d", raw.charAt(0), versionNo); | ||
} | ||
|
||
public String getRecommendedMinVer() { | ||
return generateTestedRevisionForHw(60883); | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
...enhab.binding.linktap/src/main/java/org/openhab/binding/linktap/internal/IBridgeData.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,31 @@ | ||
/** | ||
* Copyright (c) 2010-2024 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.linktap.internal; | ||
|
||
import org.eclipse.jdt.annotation.NonNullByDefault; | ||
|
||
/** | ||
* Defines a interface that Things under the Bridge can implement to receive | ||
* callbacks, when the bridges configuration data has been updated. | ||
* | ||
* @author David Goodyear - Initial contribution | ||
*/ | ||
@NonNullByDefault | ||
public interface IBridgeData { | ||
|
||
/** | ||
* Any things under a Bridge that implement this interface, will have this | ||
* invoked after new configuration data has been retrieved from the GW. | ||
*/ | ||
void handleBridgeDataUpdated(); | ||
} |
Oops, something went wrong.