Class MQTTHelper


  • public class MQTTHelper
    extends HelperBase
    A helper class for the MQTT module in JavaScript. Creates one Paho MQTT client per MQTTHelper.
    Since:
    Ptolemy II 11.0
    Version:
    $Id$
    Author:
    Hokeun Kim
    Pt.AcceptedRating:
    Red (bilung)
    Pt.ProposedRating:
    Yellow (eal)
    • Constructor Detail

      • MQTTHelper

        public MQTTHelper​(java.lang.Object actor,
                          jdk.nashorn.api.scripting.ScriptObjectMirror helping)
        Construct a MQTThelper for the specified JavaScript object. The argument can be a JavaScript actor or an instance of a JavaScript class.
        Parameters:
        actor - The actor that this is helping.
        helping - The JS object that this is helping.
    • Method Detail

      • getOrCreateHelper

        public static MQTTHelper getOrCreateHelper​(java.lang.Object actor,
                                                   jdk.nashorn.api.scripting.ScriptObjectMirror helping)
        Get or create a helper for the specified actor. If one has been created before and has not been garbage collected, return that one. Otherwise, create a new one.
        Parameters:
        actor - Either a JavaScript actor or a RestrictedJavaScriptInterface.
        helping - The JavaScript object that this is helping.
        Returns:
        The MQTTHelper.
      • getDefaultId

        public static java.lang.String getDefaultId()
        Generate a default client ID randomly.
        Returns:
        generated client ID.