B4J Library MQTT - MQ Telemetry Transport for B4J

MQttTopB4J.png


This library was made based on MQTT Protocol

Installation instructions:

- Copy the .xml and .jar(s) files to your custom libraries folder
- Select in your REFERENCED LIBRARIES

MqttRef.png


Version history:
V1.0 (First public release - Donationware):
- Initial version

MQTT
Author:
Alberto Iglesias - alberto@visualnet.inf.br
Version: 1.01
  • MQTT
    Events:
    • connectionlost ( As )
    • deliverycomplete (Token As String)
    • messageArrived (Topic As String, Message As String)
    • onConnect (Status as boolean As )
    • onDisconnect (Status as boolean As )
    • onInitialized ( As )
    Fields:
    • CleanSession As Boolean
    • KeepAliveInterval As Int
    • QoS_AtLeastOnce As Int
    • QoS_AtMostOnce As Int
    • QoS_ExactlyOnce As Int
    • generatedClientId As String
    Methods:
    • About As String
    • Connect (broker As String, ClientID As String, Username As String, Password As String) As Boolean
    • Disconnect As Boolean
    • Initialize (eventname As String)
    • Publish (Topic As String, Message As String, Qos As Int, Retained As Boolean)
    • Subscribe (Topic As String)
    • Unsubscribe (Topic As String)
    • Version As String
    • isConnected As Boolean

MqttSample1.png


How works the MQTT protocol
MqttScheme1.jpg


Communication Infrastructure
MqttScheme2.png


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 B4A too:
https://www.b4x.com/android/forum/threads/mqtt-mq-telemetry-transport-for-b4a.48167/

Already available in B4i too:
https://www.b4x.com/android/forum/threads/mqtt-mq-telemetry-transport-for-b4i.50036/





Works on MAC
MQTTScreenMac.jpg


Works on Windows
MQTTScreenWindows.jpg
 

Attachments

  • Library 1.0.0 Donationware.zip
    161.3 KB · Views: 1,032
  • MQTT Sample for B4J.zip
    1.9 KB · Views: 939
Last edited:

alexhi

Member
Licensed User
Longtime User
Hi,Alberto! I try MQTT Sample for B4J. If I run in IDE work OK. If I run java - jar MqttB4J.jar
objMqtt_messageArrived not work :( (Library 1.00)
 

JakeBullet70

Well-Known Member
Licensed User
Longtime User
Hi Alberto.

None of these features are in the b4j version. Can we get them into the b4j version?

V1.0.4 (Release - Donationware):
- Implement method to subscribe a topic with QoS

V1.0.5 (Release - Donationware):
- Now can be used isConnected method "BEFORE" the first connection

Thanks!
 
Last edited:

JakeBullet70

Well-Known Member
Licensed User
Longtime User
Thanks.
I did notice that the version number still says 1.0.1
But the new methods are there.

Thanks again!!!!
 

CanguroCode

Active Member
Licensed User
Longtime User
<English>
But, can i upload to host service free? or is for install in a local machine then access with a noip program? I need remote access to a arduino device
through message text.

<Spanish>
Pero puedo subirlo a un servicio de host gratuito (preferiría subirlo que usar uno de acceso público) o tengo que instalarlo en la computadora local y luego acceder con un programa como noip? Básicamente quiero crear un broker para un arduino y acceder remotamente enviándole mensajes.

Saludos
 

CanguroCode

Active Member
Licensed User
Longtime User
<English>
Thank's for your interest, I have searching for information about this protocol, and I think, I going to give a try to the raspberry. Do you know if exist a serious security problem?

<Spanish>
Gracias por el interés, He estado buscando información de este protocolo y creo que probaré el raspberry. ¿Sabes si existe algún problema serio de seguridad?
 

CanguroCode

Active Member
Licensed User
Longtime User
<English>
In this moment i can say in Raspberry 2 works, I don't think was so easy, thank you for the lib. I will recharge my paypal account and buy you a coffee. BTW, is 10 EU for each lib right?

<Spanish>

En este momento te puedo confirmar que en el Raspberry 2 funciona perfectamente, no pensé fuera tan fácil, gracias por la librería, recargaré mi cuenta de paypal para invitarte un café. Por cierto, ¿son 10 euros por cada librería, cierto?

Saludos
 
Last edited:

CanguroCode

Active Member
Licensed User
Longtime User
<English>
BTW when I run the example code, the logs showme a message (red color), what's mean?


<Spanish>
Por cierto al ejecutar el ejemplo me aparece el siguiente aviso (color rojo) que significa?
LiigSvU.png
 
Top