Provides Javascript wrappers for MQTT.
Dependencies: mbed-http DEVI2C_JS MQTTPacket FP
MQTT_JS Class Reference
Abstract class of MQTT for Javascript. More...
#include <MQTT_JS.h>
Public Member Functions | |
| MQTT_JS () | |
| ~MQTT_JS () | |
| int | onSubscribe (jerry_value_t cb) |
| onSubscribe | |
| int | init (NetworkInterface *network, char *_id, char *_token, char *_url, char *_port) |
| init | |
| int | subscribe (char *pubTopic) |
| subscribe | |
| int | unsubscribe (char *pubTopic) |
| unsubscribe | |
| int | connect (NetworkInterface *network) |
| connect | |
| int | getConnTimeout (int attemptNumber) |
| getConnTimeout | |
| void | attemptConnect (NetworkInterface *network) |
| attemptConnect | |
| int | publish (char *buf, int n=0) |
| publish | |
| int | yield (int time) |
| yield | |
| int | start_mqtt (NetworkInterface *network) |
| start_mqtt | |
Static Public Member Functions | |
| static void | subscribe_cb (MQTT::MessageData &msgMQTT) |
| subscribe_cb | |
Detailed Description
Abstract class of MQTT for Javascript.
Definition at line 73 of file MQTT_JS.h.
Constructor & Destructor Documentation
| MQTT_JS | ( | ) |
Constructor.
Definition at line 50 of file MQTT_JS.cpp.
| ~MQTT_JS | ( | ) |
Destructor.
Definition at line 70 of file MQTT_JS.cpp.
Member Function Documentation
| void attemptConnect | ( | NetworkInterface * | network ) |
attemptConnect
Attempt connection to MQTT server.
- Parameters:
-
NetworkInterface
Definition at line 238 of file MQTT_JS.cpp.
| int connect | ( | NetworkInterface * | network ) |
connect
Connects to the MQTT Server.
- Parameters:
-
NetworkInterface
- Returns:
- Return code
Definition at line 186 of file MQTT_JS.cpp.
| int getConnTimeout | ( | int | attemptNumber ) |
getConnTimeout
Returns the timeout in seconds.
- Parameters:
-
Attempt number
- Returns:
- Return code
Definition at line 227 of file MQTT_JS.cpp.
| int init | ( | NetworkInterface * | network, |
| char * | _id, | ||
| char * | _token, | ||
| char * | _url, | ||
| char * | _port | ||
| ) |
init
Initializes the MQTT.
- Parameters:
-
NetworkInterface ID Token URL Port
- Returns:
- Return code
Definition at line 161 of file MQTT_JS.cpp.
| int onSubscribe | ( | jerry_value_t | cb ) |
onSubscribe
Calls the subscription callback.
- Parameters:
-
Jerry Callback
- Returns:
- Return code
Definition at line 118 of file MQTT_JS.cpp.
| int publish | ( | char * | buf, |
| int | n = 0 |
||
| ) |
publish
Publishes to the MQTT broker.
- Parameters:
-
Data Optional,: retry number
- Returns:
- Return code
Definition at line 268 of file MQTT_JS.cpp.
| int start_mqtt | ( | NetworkInterface * | network ) |
start_mqtt
Starts a demo for MQTT.
- Parameters:
-
NetworkInterface
- Returns:
- Return code
Definition at line 315 of file MQTT_JS.cpp.
| int subscribe | ( | char * | _topic ) |
subscribe
Subscribes to the topic.
- Parameters:
-
Topic
- Returns:
- Return code
Definition at line 132 of file MQTT_JS.cpp.
| void subscribe_cb | ( | MQTT::MessageData & | msgMQTT ) | [static] |
subscribe_cb
Connects the subscription callback.
- Parameters:
-
Message Data
Definition at line 85 of file MQTT_JS.cpp.
| int unsubscribe | ( | char * | pubTopic ) |
unsubscribe
Unsubscribes the callback
- Parameters:
-
Topic
- Returns:
- Return code
Definition at line 146 of file MQTT_JS.cpp.
| int yield | ( | int | time ) |
yield
Waits for the MQTT broker for subscription callback.
- Parameters:
-
Time to wait
- Returns:
- Return code
Definition at line 304 of file MQTT_JS.cpp.
Generated on Thu Jul 14 2022 04:10:19 by
1.7.2