Package jmri.jmrix.mqtt
Interface MqttContentParser<T extends NamedBean>
public interface MqttContentParser<T extends NamedBean>
Interface defining a content parser, which translates to and from the MQTT payload
content.
-
Method Summary
Modifier and TypeMethodDescriptionvoidbeanFromPayload(T bean, String payload, String topic) Load a bean's state from a received MQTT payload.payloadFromBean(T bean, int newState) Create the payload for a particular state transformation on a particular bean.
-
Method Details
-
beanFromPayload
Load a bean's state from a received MQTT payload.- Parameters:
bean- The particular item receiving the payloadpayload- The entire string received via MQTTtopic- MQTT topic.- Throws:
IllegalArgumentException- if the payload is unparsable.
-
payloadFromBean
Create the payload for a particular state transformation on a particular bean.- Parameters:
bean- The particular item sending the payloadnewState- The value to be sent to the layout; this is not yet present in the bean- Returns:
- String payload to transfer via MQTT.
-