Class MQTTHelper
- java.lang.Object
-
- ptolemy.actor.lib.jjs.HelperBase
-
- ptolemy.actor.lib.jjs.modules.mqtt.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)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
MQTTHelper.MQTTClientWrapper
A wrapper for a Paho MQTT client.-
Nested classes/interfaces inherited from class ptolemy.actor.lib.jjs.HelperBase
HelperBase.DATA_TYPE
-
-
Field Summary
-
Fields inherited from class ptolemy.actor.lib.jjs.HelperBase
_actor, _currentObj
-
-
Constructor Summary
Constructors Constructor Description MQTTHelper(java.lang.Object actor, jdk.nashorn.api.scripting.ScriptObjectMirror helping)
Construct a MQTThelper for the specified JavaScript object.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String
getDefaultId()
Generate a default client ID randomly.static MQTTHelper
getOrCreateHelper(java.lang.Object actor, jdk.nashorn.api.scripting.ScriptObjectMirror helping)
Get or create a helper for the specified actor.-
Methods inherited from class ptolemy.actor.lib.jjs.HelperBase
_appendNumericToBuffer, _appendToBuffer, _error, _error, _error, _error, _extractFromBuffer, _issueResponse, _removeDuplicates, _sizeOfType, _toJavaBytes, _toJSArray, getHelping
-
-
-
-
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.
-
-