-
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.
Merge pull request #1 from atennert/devel
Devel
- Loading branch information
Showing
70 changed files
with
680 additions
and
290 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
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
6 changes: 3 additions & 3 deletions
6
...omectrl/controls/util/ControlManager.java → ...omectrl/controls/util/ControlManager.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
2 changes: 1 addition & 1 deletion
2
...omectrl/controls/util/IInitializable.java → ...omectrl/controls/util/IInitializable.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
4 changes: 2 additions & 2 deletions
4
...dataprocessing/AbstractDataProcessor.java → ...dataprocessing/AbstractDataProcessor.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
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
57 changes: 57 additions & 0 deletions
57
dataprocessing/src/main/java/de/atennert/homectrl/dataprocessing/LogicalOrProcessor.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,57 @@ | ||
/******************************************************************************* | ||
* Copyright 2016 Andreas Tennert | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | ||
* use this file except in compliance with the License. You may obtain a copy of | ||
* the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
* License for the specific language governing permissions and limitations under | ||
* the License. | ||
*******************************************************************************/ | ||
package de.atennert.homectrl.dataprocessing; | ||
|
||
import de.atennert.homectrl.event.EDeviceValueUpdate; | ||
import de.atennert.homectrl.event.Subscribe; | ||
import de.atennert.homectrl.util.ConfigurationField; | ||
|
||
import java.util.Map; | ||
|
||
/** | ||
* This sensor is used to combine sensor values with an or combinator. | ||
* It forwards <code>true</code> if at least one of the inputs is | ||
* <code>true</code>, <code>false</code> otherwise. | ||
*/ | ||
public class LogicalOrProcessor extends AbstractDataProcessor<Boolean> { | ||
|
||
private final Map<Integer, Boolean> sensors; | ||
|
||
public LogicalOrProcessor( | ||
@ConfigurationField(fieldId = "id") int id, | ||
@ConfigurationField(fieldId = "resources") Map<Integer, Boolean> sensors) | ||
{ | ||
super(id, false); | ||
|
||
this.sensors = sensors; | ||
} | ||
|
||
@Subscribe | ||
public void update(EDeviceValueUpdate event) | ||
{ | ||
if (sensors.containsKey(event.deviceId)) | ||
{ | ||
sensors.put(event.deviceId, (Boolean)event.value); | ||
|
||
final boolean oldProcessorValue = processorValue; | ||
processorValue = sensors.values().stream().anyMatch(status -> status); | ||
|
||
if (oldProcessorValue != processorValue) { | ||
eventBus.post(processorId, new EDeviceValueUpdate(processorId, processorValue)); | ||
} | ||
} | ||
} | ||
} |
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
6 changes: 3 additions & 3 deletions
6
...dataprocessing/util/ProcessorManager.java → ...dataprocessing/util/ProcessorManager.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
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,10 @@ | ||
|
||
# communication address properties | ||
homectrl.server.address.http=192.168.0.2:80 | ||
homectrl.server.address.enocean=/dev/ttyUSB0 | ||
|
||
# database information | ||
homectrl.server.logDb.driverClassName = org.sqlite.JDBC | ||
homectrl.server.logDb.url = jdbc:sqlite:homectrlLog.sqlite | ||
homectrl.server.logDb.username = "user" | ||
homectrl.server.logDb.password = "pwd" |
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 |
---|---|---|
|
@@ -7,4 +7,5 @@ version = "0.0.2" | |
|
||
dependencies { | ||
compile project(':homectrl') | ||
compile 'de.atennert:com:2+' | ||
} |
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.