This library was made based on MQTT Protocol
Installation instructions:
- Copy the *.a and *.h files into the folder "Libs" in your MAC or in your MAC HOSTED by AnywhereSoftware, normally in "B4i-MacServer\Libs" folder
-Copy the iMQTT.xml to your custom libraries folder in B4i
- Select in your REFERENCED LIBRARIES
Version history:
V2.0.0 (First public release - Donationware):
- Initial version
iMQTT
Author: Alberto Iglesias (alberto@visualnet.inf.br)
Version: 2
- MQTT
Events:- Received (Message As String)
- onConnect (Status As Int)
- onDisconnect (Status As Int)
- onInitialized ( As )
- onPublish (Status As Int)
- onSubscribe (Topic as String As )
- ClearWill
- Connect (Broker As String, Username As String, Password As String, Port As String)
Connect to Broker - Disconnect
Disconnect from Broker - Initialize (EventName As String)
Initializes the object. - IsConnected As BOOL
Get status of connection - Publish: (Topic As String, Payload As String, qos As Int, Retained As BOOL)
Publish a message to Topic - Reconnect
- Subscribe2: (Topic As String, qos As int)
Subscribe into a Topic with Quality of Service - Subscribe: (Topic As String)
Subscribe into a Topic - Unsubscribe: (Topic As String)
Unsubscribe a Topic
- Author As String [read only]
Author of this Library - ClientID As String
Set/Get the Client ID for broker know who you are. Default = UUID from Device - DebugMode As BOOL
Enable/Disable Debug mode from Library - QoS_AtLeastOnce As Int [read only]
QoS1, At least once: The message is always delivered at least once. It might be delivered multiple times if there is a failure before an acknowledgment is received by the sender. The message must be stored locally at the sender, until the sender receives confirmation that the message has been published by the receiver. The message is stored in case the message must be sent again. - QoS_AtMostOnce As Int [read only]
QoS0, At most once: The message is delivered at most once, or it may not be delivered at all. Its delivery across the network is not acknowledged. The message is not stored. The message could be lost if the client is disconnected, or if the server fails. QoS0 is the fastest mode of transfer. It is sometimes called "fire and forget". - QoS_ExactlyOnce As Int [read only]
QoS2, Exactly once - Version As NSString* [read only]
Library Version
- MQTT
How works the MQTT protocol
Communication Infrastructure
References:
http://mqtt.org/
http://public.dhe.ibm.com/software/dw/webservices/ws-mqtt/mqtt-v3r1.html
Mosquitto Broker: http://mosquitto.org/
* This version is fully functional, the only one difference is when publishing a message the text "Donationware" is delivery with your message.
Please consider a simple €10 donation and I send to you the Library without "Donationware" text in a publish method.
Already available in B4J too: look in https://www.b4x.com/android/forum/threads/mqtt-mq-telemetry-transport-for-b4j.48184/
Already available in B4A too: look in https://www.b4x.com/android/forum/threads/mqtt-mq-telemetry-transport-for-b4a.48167/
Attachments
Last edited: