This document describes the Panther Sniffer mobile app, which allows communication with DQMH modules via MQTT. It was created to allow interacting with hardware from a mobile device instead of being tethered to a computer screen. The app uses Flutter to connect to DQMH modules as an MQTT client and subscribe to status update broadcasts. This allows monitoring a module's status from a phone. LabVIEW was also updated with an MQTT client DQMH module template to facilitate the connection.
2. About Myself
• Electronics and Telecommunications Engineer
• Master degree In Electronics and Computational Systems
• Master degree In Web technologies and Mobile devices
• Using LabVIEW since Version 6i
• LabVIEW Teacher (18 years)
• Worked in a Research Center for (13 years)
• Start LabVIEW Academy Program (2 CLD + 19 CLAD)
• Software Contractor at Delacor (October 2020)
• Learn, Learn and Learn…
• Founder PantherLAB (September 2021)
3. About PantherLAB
• Software Consulting
• Custom Solutions
• Monitoring
• Testing
• Machine Vision
• Software + Mechanical Design + PLC automation
• SolidWorks
• PLC SIEMENS
• DQMH Training (Spanish)
• Source Code Control for LabVIEW Teams
5. #OurGiantsAreFemale – Karen
Spärck Jones
• She was a British computer scientist
whose work on inverse document
frequency is the underlying
infrastructure used for most of today’s
search engines. She taught computers
to understand human thought and was
an advocate for women in the computer
science community.
• Her Slogan
• “I think it’s very important to get more
women into computing. My slogan is:
Computing is too important to be left to
men.”
6. A little bit of Background…
• We use LabVIEW to communicate with tons
of different hardware and instruments but,
to watch hardware-software interactions
when we are developing, we need a
screen.
• Sometimes we build tests systems,
stations, etc. and the hardware location
vs the screen location makes difficult our
work.
• Testing if hardware works is an essential
part of our debugging and development
8. A little bit of Background…
• This situation Screen + Hardware-Software
Interactions made me think.
• I wish to be able to talk to LabVIEW and ask if
it has detected some hardware changes or
just tell me what is receiving from the
sensors.
• What if this situation can be solved with a
mobile app?, this could help me to be far
away from the computer and interact with
hardware…
9. The mission…
Build a mobile app to see in some way what is happening on the
LabVIEW Side.
The app should establish connection with LabVIEW in some way.
The app must store configurations as easy as possible, to use it on
several machines with almost zero effort.
10. Connectivity Options
• Bluetooth
• Pros:
• All Cell Phones has some Bluetooth communications
• Cons:
• Some Computers does not have Bluetooth
• Different versions of Bluetooth can give some incompatibility problems.
• Short distances about 10 meters
• Needs some pairing, makes difficult the configurations, the pairing happens at OS level.
• Wi-Fi
• Pros:
• All the smart Phones has Wi-Fi
• Can handle a lot of the protocol stack (TCP, UDP, …)
• Easy to add a mobile device to a wi-fi network.
• Larger distances can be achieved.
• Cons:
• The bandwidth of the Wi-Fi network gets weaker as you add more devices
12. MQTT (Message Queue Telemetry
Transport)
• Lightweight open messaging protocol for resource-constrained
Network Clients.
• MQTT started as a proprietary protocol used to communicate
SCADA systems in the oil and gas industry.
• Today is the leading open-source protocol for connecting
internet of things (IoT) and industrial IoT (IIoT) devices.
• It is a Publish-subscribe protocol.
13.
14. MQTT assumptions.
• To communicate using MQTT protocol you need to connect to
an MQTT Broker as a MQTT Client
• The MQTT Broker can run locally or on the cloud
• An MQTT Client can publish or Subscribe to a Topic.
• Topics Examples:
• House/childrenroom/1/temp/
• Motor/status/
15. • Everything
began with the
release of
MQTT Client
and Broker by
Francois
Normandi
(Thanks!)
16. • I did a quick
search for a
MQTT Client
library
available on
the mobile
side
18. The mission Redefined
Build a mobile app using Flutter to see in some way what is
happening on LabVIEW side.
The app should establish connection with a DQMH module using
MQTT protocol, both as MQTT Clients
The app must store configurations as easy as possible, to use it on
several machines with almost zero effort.
20. • Framework
Maintained by
Google
• Uses DART as a
programming
Language
• Fast growing
community
https://www.statista.com/statistics/869224/worldwide-software-developer-working-hours/
21. Flutter overview
• 100% OOP Framework
• Includes a vast and growing number of classes.
• Some of These classes are called Widgets
• Widget catalog
• Examples:
• Button
• Column
• Rows
• Container
• Etc.
22. Flutter overview
• Also, in Flutter there is a place to share packages and libraries
in a similar way as VIPM, it is called pub.dev
• You can find libraries for all kind of purposes, like
• Maps
• SQLite
• …
• MQTT Client Connection
Configuration
24. Flutter…
• A Widget can contain another widget
• Example a button with an icon
• In Flutter you end up with a Widget Tree (Actor Framework
like)
• There are two kinds of Widgets
• Stateless
• Stateful
• All Widgets have properties and methods, and some of them
are mandatory and others optional.
27. pantherlab.com.mx
Panther Sniffer for
DQMH® Development
DQMH (Delacor Queue Message Handler)
Maintained by DQMH Consortium dqmh.org
• Very Popular LabVIEW Framework
• Developer Friendly
• Enforces Developer Experience
• A vast and growing community
• DQMH™ provides event-based message handling and
scripting tools to help you implement and communicate among
parallel loops in LabVIEW.
• When you use DQMH, you create modules, each module has
a QMH inside.
• Each module has associated events
• All modules comes with an API Tester
32. What is Panther Sniffer for
DQMH?
• App on Android Phone
• Simplified API tester for a MQTT DQMH Module
• Allows you to see the Status Updated Broadcast event broadcasted by a DQMH
Module.
• Allows you to Trigger the following predefined Requests
• Show Front Panel
• Show Block Diagram for Troubleshooting
• Stop Module
• Allows to communicate to a specific Module instance or All the Clones (Similarly to
the API Tester)
• LabVIEW
• New DQMH Cloneable Module with a MQTT Client
• Has some MQTT related Events to quickly stablish connection with the APP
• Available trough VIPM
45. pantherlab.com.mx
How the APP
communicate
with the
Module?
• The module is subscribed to its own
broadcast
• This Will allow listening to the status
updated broadcast for the module itself.
Hello everyone, I´m so happy to present the following topic “Panther Sniffer for DQMH”, a mobile app to communicate with DQMH Modules
I’m going to introduce myself, I´m Enrique Noé Arias, I’m also a Certified LabVIEW Architect, an Electronics and Telecommunications Engineer, I have two masters degrees, one about Electronics and Computational Systems and another one about Web and mobile devices development, I´ve being using LabVIEW since Version 6i, I´m also a LabVIEW Teacher at the Universidad de la Salle Bajío for about eighteen years, I worked in a Optical research center for about thirteen years, at October of 2020 I stated working as a Software Contractor at Delacor LLC, and this year I’m starting PantherLAB, the first DQMH Trusted Advisor business in México.
About PantherLAB:
These are the services I’m providing:
Software Development
Software Consulting
I´m also providing DQMH Training in Spanish Language and
Source code Control for LabVIEW Teams.
I also have a partnership with another company who provides Mechanical Design and PLC automation, together we build test stations, and custom solutions, mostly of them about machine vision and quality control.
About the DQMH Trusted Advisors Network
We are a group of companies using DQMH Framework in our developments on a regular basics.
These are the current DQMH Trusted Advisors:
Wired-In Software from Australia,
SAS Workshops from Colorado USA,Studio Bods from Canada,
Prime Test from Florida,
Wovalab from France,
Hampel Software Engineering from Germany,
And PantherLAB in México
Our giants are Female, this is a movement started several years ago by Fabiola de la Cueva and Steve Watts, its purpose is to make visible the outstanding contributions in science and engineering of the women, in my presentation I choose to talk about Karen Sparck Jones.
She is a British computer Scientist
Her work is about inverse document frequency
This topic is the core of the today’s search engines.
She though computer science and she was an advocate for women in science.
we all should be proud of the women.
Ok, let´s start with the presentation, This is a little bit of Background for all of us as LabVIEW developers :
We use LabVIEW to communicate with tons of different hardware and instruments but, to watch hardware-software interactions when we are developing, we need a screen.
Sometimes we build tests systems, stations, etc. and the hardware location vs the screen location makes difficult our work.
Testing if hardware works is an important part of our debugging and development process.
This is a very common scenario, an engineer holding its laptop with one hand and with another hand working with the keyboard and mouse.
Sometimes we see laptops on the knees, on the floor, and on dirty locations.
What is the need to be in this position?
He needs to see what is the machine doing and he also needs to see what is the software doing, all at the same time.
I think I’m not the only one with this uncomfortable situation. So these are some of my thoughts:
I wish to be able to talk to LabVIEW running on its final location and make a phone call and ask LabVIEW if it has detected some hardware changes or just tell me what is receiving from the sensors.
What is LabVIEW doing while I’m near to the hardware?
What if this situation can be solved using a mobile app?
This could help me to be far away from the computer and still be aware of the hardware-software interactions.
I will no longer need the laptop on my knees to be near of the hardware in question.
with these ideas in mind, I started a mission to build a mobile app.
I analyzed the communications channels on mobile devices keeping in mind the goal is to communicate with LabVIEW, my option to go was wi-fi. Using Wi-Fi you can achieve longer distances than Bluetooth, there is no pairing, and Wi-Fi has better speeds.
And Also with Wi-fi you can use a lot of known protocols included in LabVIEW.
Searching for the protocol and navigating on the internet I often find this image, Its about Internet of things but, I noticed on this image something I was trying to achieve, a laptop, a mobile device, and some other things interacting on the equation.
Digging on this image I learned it described the Internet of things protocol Called MQTT (Message Queue Telemetry Transport)
Some of the characteristics about this protocol are:
It is a Lightweight protocol
Started as a proprietary protocol in the oil and gas industry to replace some SCADA elements.
Today is one of the most used protocols on the internet of things environment.
MQTT is a Publish Subscribe protocol.
When you hear about MQTT you often hear the words Broker and Client, these means Client and Server in easy words.
An important thing to notice about MQTT is that you can have a lot of clients but only one broker, some clients publishing, and some subscribed to the topics published by other clients, maybe booth, the MQTT Clients are uncoupled, this means, you can have a client publishing but this client has not knowledge about who is subscribed to its messages, this behaves like a social network but for things, as a client you only have to worry about where is the broker, and start publishing data or subscribe to someone topic, as a client you can be both, publisher and subscriber.
These are some MQTT assumptions:
As MQTT Client you only need to know where and how to connect to the Broker
As Client you can publish and subscribe to Topics
These are some topic examples, please notice they look like a path..
House/childrenroom/1/temp/
Motor/status/
Actually the topics in MQTT act like a path.
Everything was just a possible plan, then, Francois Normanding released the MQTT broker and MQTT Client.
I want to give my gratitude to Francois for this outstanding contribution, this work couldn’t be possible without it.
On the Mobile Side, I searched and found the MQTT Client Library it is also available
Wrapping all together, I had the protocol, LabVIEW Library, Mobile Library, I´m a DQMH fan so in LabVIEW I had the Framework.
On the other side I´m a Flutter Framework fan, it uses Dart as a programming language.
All of these are the ingredients for Panther Sniffer for DQMH
Time to be more specific about the initial plan.
I wanted to Build a mobile app using Flutter to see in some way what is happening on LabVIEW side.
The app should establish connection with a DQMH module using MQTT protocol both as Clients
It is time to talk about Flutter, it is a Framework, it uses Dart as a programming language, it´s purpose is to build mobile apps, but recently you can build web apps, desktop, an even embedded, all of them using the same code base.
On the mobile side it can create IOS and Android apps with outstanding performance and a very nice native appearance.
Flutter is maintained by Google
It has a fast and growing community
This is a graph showing the worldwide software developer working hour by different mobile frameworks, here we can see Flutter and React Native are the leading ones, on third place is Cordoba and Ionic.
React Native is a maintained by Facebook.
Here is a brief overview of Flutter Framework
It is an Object oriented programming framework
Flutter contains an enormous amount of classes
Some of these classes are called widgets,
There is a widget catalog to familiarize with the framework classes
As an example of these widget classes are the button, text, rows, container, etcetera.
In Flutter there is a place to share packages and libraries very similar to VIPM, it is very easy to navigate and search for stuff, for example, you can search for maps, SQLite, custom buttons, etc.
Panther Sniffer for DQMH is using an SQLite and a MQTT Client libraries among others.
Talking about library dependencies In Flutter, each project contains a pubspec.yaml file, this is where the dependencies are managed, we add the names of the packages with the version and using the terminal, we run the command “flutter pub get”, when this command is executed all the packages are sored locally on the project, In LabVIEW when we use VIPM all the packages are installed globally on our system, but I think Project Dragon is about to change dependencies management in LabVIEW.
These are some rules when using flutter,
A widget can contain another widget as a child, as an example, a button can have an icon as a child.
In flutter you will end having a widget tree, this is very similar to Actor Framework relationships between root actor and nested actors.
In Flutter we have two kind of widgets
Stateless and stateful
As I said it is an Object oriented framework, we have a lot of classes to select to build our applications, each of the classes have properties and methods, some of them are mandatory and others are optional.
This is an example of the Text Widget, you use semicolons to separate the properties and methods of the widget, in this example the text is “GLA Summit 2021”, textAlign is a property, style is another property with another class as a parameter, this other class is a wrapper for text properties.
Every flutter project has a main.dart file, this file has the runApp Method, I like to use analogies so here is another one with the Actor framework, this is the “Launch Root Actor method”, so runApp is the launcher of the app, in this case MyApp is the widget to be launched.
So if you use Actor Framework, you will feel like home with Flutter.
But what about the LabVIEW side, Panther Sniffer for DQMH uses DQMH Framework, this framework was designed to create a better developer experience, it includes a lot of scripting tools to help the developer to automate some repetitive tasks, this Framework uses events to communicate among modules and create parallel tasks, each module internally have a Queue Message Handler. Each module comes with an API tester, this is another awesome thing about DQMH, you can test if your development is working as expected while coding.
This is the anatomy of a DQMH Module, a module is a Library, and has a public API to use the module, as I said before all the modules comes with an API tester, the API Tester uses the public API to Test the module itself.
All DQMH Modules has some broadcast events, please notice all the broadcast vis are in private scope, this means this vis can be used inside the library, in this case by the main.vi.
This is an image showing the API tester and some of the relationships about the public API virtual Folder and the API tester, The API Tester comes with some buttons to trigger some module Events, the API tester has a Status String that shows some useful information about the module, the module itself broadcast this status information.
As I mentioned DQMH enforces a better Developer Experience, so all the DQMH modules comes with a broadcast called “Status Updated”, this broadcast is like a debugging tool the module uses to announce it is doing something, working on this or that, when we use other programming languages we have the console.log or printf or something similar in DQMH we have this broadcast as default. One of the objectives of Panther Sniffer for DQMH was to obtain this Status Updated broadcast event and draw the text on the phone.
So what is panther Sniffer for DQMH?
I is an android App (but in the future it can be published to IOS because is the same code, just another target).
I is like a Simplified API tester for a DQMH Module on your phone
This app Allows you to see the Status Updated Broadcast event by a DQMH Module.
Allows you to Trigger the following predefined Requests
Show Front Panel
Show Block Diagram for Troubleshooting
Stop Module
Allows you to communicate to a specific Module instance, or All the Clones (Similarly to the API Tester)
LabVIEW
I published a New DQMH Cloneable Module with a MQTT Client included
It Has some MQTT related Events to quickly stablish connection with the APP
And it is published on VIPM
Panther Sniffer for DQMH is a mobile app, to communicate to a new DQMH Module flavor, both the app and the module are totally free.
Both, the app and the LabVIEW Package are available on Googles Play Store and VIPM
Here is the first quick demo to create some context:
After The APP and The Package are installed
We can add a New DQMH Module
There will be added a new kind of Module Template called MQTT_Client
This package will have a Simple MQTT Broker
When running the broker, it will show you the IP address, Port, and Clients connected to it.
On the API Tester you can place this information and click Start Client and Connect to Broker Button
the App have two buttons, Brokers and Modules at the bottom, in the middle you will have a plus button to add the selected
First, we add the Broker, capture the information Name, IP Address and Port.
Then you add the Module
The module name on the App must be the same as the DQMH Module.
Then click the module on the APP and It will establish communication with the Broker.
Notice the Clients Connected counter.
The app comes with some default events to trigger some DQMH Requests
You can see the Status updated broadcast event on the APP.
You can select the clone instance to stablish communication with.
This is the simplest recipe to create a MQTT Infrastructure, so, for all the DQMH users this new DQMH Module can be used as a Sniffer of your own existing application, you only have to add this new module and subscribe it to all the other modules to sniff what is your app doing, or this new module can be the starting point of all your new cloneable modules. The mobile APP is used as a Debugging tool when things gets complicated, and you need to test the hardware on its final locations with the screen attached to a machine or on a inaccessible location.
So lets tall about the design, I´m going to be talking about LabVIEW then flutter, This is the example of the MQTT Client without DQMH, It comes with 3 buttons to trigger some events, Connect, Subscribe and Stop, this is pretty much an Event handling loop to manage the MQTT Client connection.
With this example I created a New DQMH Module with the MQTT Client included, the first approach was to add it as a Helper loop, then I moved the MQTT client to the Event Handling Loop, as you can see, I added some additional Labels to help the developer to modify and understand the MQTT Client Part.
here we can see the Event handling loop of the new MQTT DQMH Module, please notice there is 2 typedefs added to the Event Registration, this Typedefs are needed for the MQTT Client.
This is the request triggered when the button create client and subscribe to Broker button is clicked, notice the two User Events outputs to make EHL register for MQTT related Events.
Inside this subvi, we have The MQTT Client, it has these sections, Type of connection, by default the module uses TCP/IP, there is no Security nor passwords, there is an Object from JKI, this is the serializer type, I´m using JSON on the app.
Another important part is the Default topic, this default topic is used by the app to generate topics and communicate with the module, this constant vi contains a simple string, then it is a Formatted to this module, this vi creates and builds the MQTT Topics, the module will then subscribe to these topics if the connection is successful.
This is the default string topic that Panther Sniffer uses to publish to the DQMH MQTT Module, you can add more strings to the module if you want, but the app uses this.
The complete process to build the MQTT Topics is, first to have the tropics strings, then the “Format to this module.vi” Will create an array with 2 elements, the client module will subscribe to these topics to be aware if the app is calling all the modules or to a specific Clone instance.
The subscription process is triggered when the client connection to the MQTT Broker is successful, there is an Event Request to the module itself to subscribe to topics, the default topics are used by the app to communicate with this Module
The disconnection request event is pretty much the same as the example provided, you disconnect the client, set the status to offline and clear all the topics from the EHL, also notify the MHL with the connection status.
One of the biggest modifications to the DQMH Module is to allow the module itself to be subscribed to its own broadcasts events.
If the Module itself is subscribed to its own broadcast events it can be listening the status updated broadcast event any time it is triggered by the module, as the broadcast event is handled on the Event Handler loop and is in the same place where we have the MQTT Client, we can then publish trough MQTT the Status updated of the module, this will allow the App notice all the Status Updated of the module.
This constant vi has the default string to publish all the topics on the MQTT network. Here I recycled the “Format to this Module.vi” to create the specific topic to publish the status of the module.
As you can imagine, on the mobile app code exists two constants related to each module.
I used this strings to allow the app and the module be coupled by subscription and publication to MQTT Topics formed dynamically
The App Panther Sniffer for DQMH when you want to stablish a connection with a DQMH MQTT Client you will need the module, the module is an object with an ID, a name and a brokerID, so, when you wan to establish a connection, the app concatenates the module name, slash, module ID, slash, topic, this is to start the client subscribed
Having the Topics, the app creates a new MQTT Client, then the app will subscribe to the topics published by the DQMH Module and will publish to the topics subscribed by the module.
These are the methods used by the app to subscribe and to publish to the DQMH module. As you can see the subscription is fair to simple, you just need the topic, for the publishing part you will need also the topic and the message, this app uses the builder method to construct JSON object to publish the message.