Commit a966bb62 authored by René Schöne's avatar René Schöne
Browse files

Use retain for initial robot config.

- see #26
parent 465ddf3b
Pipeline #7084 passed with stages
in 4 minutes and 54 seconds
...@@ -231,8 +231,16 @@ public class MqttUpdater { ...@@ -231,8 +231,16 @@ public class MqttUpdater {
} }
public void publish(String topic, byte[] bytes) { public void publish(String topic, byte[] bytes) {
publish(topic, bytes, false);
}
public void publish(String topic, byte[] bytes, boolean retain) {
publish(topic, bytes, this.qos, retain);
}
public void publish(String topic, byte[] bytes, org.fusesource.mqtt.client.QoS qos, boolean retain) {
connection.getDispatchQueue().execute(() -> { connection.getDispatchQueue().execute(() -> {
connection.publish(topic, bytes, qos, false, new org.fusesource.mqtt.client.Callback<Void>() { connection.publish(topic, bytes, qos, retain, new org.fusesource.mqtt.client.Callback<Void>() {
@Override @Override
public void onSuccess(Void value) { public void onSuccess(Void value) {
logger.debug("Published some bytes to {}", topic); logger.debug("Published some bytes to {}", topic);
......
...@@ -104,7 +104,7 @@ public class StarterMain { ...@@ -104,7 +104,7 @@ public class StarterMain {
.setEnableTwistLinear(false) .setEnableTwistLinear(false)
.setPublishRate(100) .setPublishRate(100)
.build(); .build();
mainHandler.publish(dataConfigTopic, dataConfig.toByteArray()); mainHandler.publish(dataConfigTopic, dataConfig.toByteArray(), true);
} }
private void logStatus(String prefix, RobotArm robotArm) { private void logStatus(String prefix, RobotArm robotArm) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment