[MQTTP10] MQTT vs serial or both

[MQTTP10] MQTT vs serial or both

  
Forge Component
(0)
Published on 8 Jan by Barduino
0 votes
Published on 8 Jan by Barduino

Hi there,

In the past few months, I have been developing a solution that integrates a contactless card reader to a tablet device via usb.  It has been a simple solution until I reached out and asked for help.  I was presented with the alternative to rather consider using MQTT and not full blown native with a serial cordova plugin.  This challenged my understanding as I now have to move away from a self contained application to a solution that runs a server which my application connects to in order to run MQTT.  Having payloads and subscribe to topics seemed to be the holy grail, since I did not have to worry about coding my own callbacks and validation, but on investigating, it seems like I will just be plugging MQTT in the middle of a serial plugin and therefore creating more work to do what I did to begin with.  </endOfRant>

So, the actual reason for this post.  Am I missing something?  Do brokers like Mosquitto have the serial integration built in or do they talk to the OS, like Android, to deliver the payload and vice versa?  My application does not read RF tags, but does EMV transactions, which have req/res patterns that arrive at a solution based on the type of Card that I am using.  Is MQTT the way to go?  Is there a way to develop an application that runs and manages its own server?  My concern is that this application will be running out in the field in uncontrolled environments, so it needs to be easy to support remotely.

Hi Tjaart,

This might be a more complex answer and I don't have the full context.

Can you elaborate a bit more the solution you have in mind?


Cheers 

Hi there,

I have a fixed price kiosk type application where the user selects the product from the application on the tablet, which in turn is the kiosk, the tablet send the request that includes the price to the contactless card reader, the card reader polls for a contactless EMV card.  When the customer taps their card, the contactless reader accesses the unsecured portion of the EMV card in order to process the payment.  The payment will happen with either a promo coupon or a pre-funded balance.

I am currently using the plugin from https://github.com/xseignard/cordovarduino.  It works, ie, I am able to communicate with the device and do transactions, but it is greatly unstable.  Sometimes I do three purchases or sometimes I do 20 purchases and then the application suffers a fatal error.  My hope is that MQTT will offer a cleaner solution that will allow me to send the request to the device and receive the responses without having to worry about clearing buffers and managing resources.  I simply want to send my request, receive it back, like one does with a REST API.

Hi Tjaart,

MQTT will definitely allow you to send high volume of messages between devices, it was design for that. You might want to take a look at the Quality Of Service settings (QOS) of the protocol to see which would work best for your project.

It all comes down to the device where the card reader is and where is the MQTT broker.

Both devices, the tablet and the card reader must be able to "see" the broker. This implies some sort of networks connectivity. You have plenty of arduino modules to connect to the network, both ethernet or wi-fi and even some specialized boards such as the ESP-8266 or the ESP-32 which will support wi-fi out-of-the-box. However you do have another set of issues such as what happens if there is not network or internet connectivity?

You could run a local broker such as mosquito or you could use a cloud broker. IOT cloud services are quite good for large scale deployments, take a look at AWS or Azure, they have a complete solution for your devices managing them from encryption to analytics. 

Cheers

Hi Barduino,

Thanks for the response.  If I understand correctly, the MQTT broker will run on the Android device, this will be in the form of a server of some sort.  The server will then connect to the USB device through a driver.

Is there a way for me to start/run the server from my Android application that was built in OutSystems?  Can I kill the server when the app is closed?