Select Git revision
temp.slrproject
writeDefinition.mustache 795 B
private String {{parentTypeName}}.{{writeTopic}} = null;
private byte[] {{parentTypeName}}.{{lastValue}} = null;
public void {{parentTypeName}}.{{connectMethod}}(String topic, boolean writeCurrentValue) {
{{writeTopic}} = topic;
{{updateMethod}}();
if (writeCurrentValue) {
{{writeMethod}}();
}
}
protected boolean {{parentTypeName}}.{{updateMethod}}() {
{{tokenResetMethod}}();
{{> mappingApplication}}
{{lastValue}} = {{lastResult}};
return true;
}
protected void {{parentTypeName}}.{{writeMethod}}() {
{{#loggingEnabledForWrites}}
System.out.println("[Write] {{TokenName}} = " + get{{TokenName}}() + " -> {{writeTopic}});
{{/loggingEnabledForWrites}}
{{mqttUpdateAttribute}}().publish({{writeTopic}}, {{lastValue}});
}