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.
[enocean] Implemented ESP2 protocol (openhab#6513)
Implemented ESP2 protocol Fixes openhab#6512 Signed-off-by: Daniel Weber <[email protected]> Signed-off-by: Hans-Reiner Hoffmann <[email protected]>
- Loading branch information
1 parent
8a7d953
commit 0a90905
Showing
38 changed files
with
1,409 additions
and
689 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
45 changes: 45 additions & 0 deletions
45
...rg.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/Helper.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,45 @@ | ||
/** | ||
* 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.enocean.internal; | ||
|
||
import java.util.Arrays; | ||
|
||
/** | ||
* | ||
* @author Daniel Weber - Initial contribution | ||
*/ | ||
public class Helper { | ||
|
||
public static byte[] concatAll(byte[] a, byte[]... rest) { | ||
if(rest == null) { | ||
return a; | ||
} | ||
|
||
int totalLength = a.length; | ||
for (byte[] b : rest) { | ||
if (b != null) { | ||
totalLength += b.length; | ||
} | ||
} | ||
|
||
byte[] result = Arrays.copyOf(a, totalLength); | ||
int offset = a.length; | ||
for (byte[] array : rest) { | ||
if (array != null) { | ||
System.arraycopy(array, 0, result, offset, array.length); | ||
offset += array.length; | ||
} | ||
} | ||
return result; | ||
} | ||
} |
58 changes: 58 additions & 0 deletions
58
...nocean/src/main/java/org/openhab/binding/enocean/internal/config/EnOceanBridgeConfig.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,58 @@ | ||
/** | ||
* 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.enocean.internal.config; | ||
|
||
/** | ||
* | ||
* @author Daniel Weber - Initial contribution | ||
*/ | ||
public class EnOceanBridgeConfig { | ||
|
||
public enum ESPVersion { | ||
UNKNOWN("unknown"), | ||
ESP3("ESP3"), | ||
ESP2("ESP2"); | ||
|
||
private String version; | ||
|
||
ESPVersion(String version) { | ||
this.version = version; | ||
} | ||
|
||
public static ESPVersion getESPVersion(String espVersion) { | ||
for (ESPVersion version : values()) { | ||
if (version.version.equalsIgnoreCase (espVersion)) { | ||
return version; | ||
} | ||
} | ||
|
||
return ESPVersion.UNKNOWN; | ||
} | ||
} | ||
|
||
public String path; | ||
|
||
public String espVersion; | ||
public boolean rs485; | ||
public String rs485BaseId; | ||
|
||
public int nextSenderId = 0; | ||
|
||
public EnOceanBridgeConfig() { | ||
espVersion = "ESP3"; | ||
} | ||
|
||
public ESPVersion getESPVersion() { | ||
return ESPVersion.getESPVersion(espVersion); | ||
} | ||
} |
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
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
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
Oops, something went wrong.