Skip to content
Snippets Groups Projects
Commit 8efc5135 authored by René Schöne's avatar René Schöne
Browse files

Rename Item.sendState0 to Item.stateUpdated.

- Also added some documentation
- Resolves issue #15
parent d05b3682
Branches
No related tags found
No related merge requests found
......@@ -235,35 +235,45 @@ aspect ItemHandling {
public void ItemWithBooleanState.setState(boolean value, boolean shouldSendState) {
if (isFrozen) { return; }
set_state(value);
sendState0(shouldSendState);
stateUpdated(shouldSendState);
}
public void ItemWithStringState.setState(String value, boolean shouldSendState) {
if (isFrozen) { return; }
set_state(value);
sendState0(shouldSendState);
stateUpdated(shouldSendState);
}
public void ItemWithDoubleState.setState(double value, boolean shouldSendState) {
if (isFrozen) { return; }
set_state(value);
sendState0(shouldSendState);
stateUpdated(shouldSendState);
}
public void ColorItem.setState(TupleHSB value, boolean shouldSendState) {
if (isFrozen) { return; }
set_state(value);
sendState0(shouldSendState);
stateUpdated(shouldSendState);
}
public void DateTimeItem.setState(Date value, boolean shouldSendState) {
if (isFrozen) { return; }
set_state(value);
sendState0(shouldSendState);
}
//--- sendState0 ---
protected void Item.sendState0(boolean shouldSendState) {
stateUpdated(shouldSendState);
}
//--- stateUpdated ---
/**
* Called, whenever the state of an item is updated. Does various things including:
* <ul>
* <li>Send the new state via MQTT</li>
* <li>Send the new state to Influx DB</li>
* <li>Notify the attached {@link ItemObserver}, if any</li>
* <li>Update state of controlled items</li>
* </ul>
* @param shouldSendState whether to send the new state (currently affects MQTT and Influx)
*/
protected void Item.stateUpdated(boolean shouldSendState) {
if (shouldSendState) {
try {
// sendState() defined in MQTT aspect
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment