B4J Code Snippet [B4X] Queue Eliminator

In post #9 there is an B4x example (B4XPages) that uses WebSocket and the xHttpServer library
____________________________________________________________________________________________________________________________________________________________________
Today I didn't have much to do and starting from an idea of @MarcoRome (see this) I wanted to make a software cut queue. (or delete/eliminator code, I don't know how to say exactly in English and google doesn't help)

It will also have happened to you to queue at the post office, at the bank, at the pharmacy, in the bathroom.
Where there is a queue eliminator, a shift number can be obtained, and the number served at that moment appears on the screen. The counter operator advances the number each time he has finished serving the customer.

So there are 3 front end. (1) The progress of the number, (2) The request for the number and finally (3) The display of the current number in turn.

I have come up with a solution that can work with a single application for all 3 front ends, but you can add 2 more applications if you wish. I thought of an html server, which runs on a windows pc that runs in the operator's station who will carry out the shift (but it can be easily created for b4a and b4i)
The server will generate two dynamic html pages which will be viewed by 2 devices.
On a device (which can be a tablet, but it's better if it's an android TV device) that will access an HTML page, with the internal browser, that will display the current shift. The second device, with the internal browser, will access another page that will allow you to request a number for your turn. (This could be a mobile device).

I show you some screenshots of the operation and finally the source code attached.

SERVER B4J

1598361010560.png



Screen that displays the current shift (Tablet / Android TV / TV Box)
http://youaddress:51015/ (locale http://127.0.0.1:51015/)
1.gif


Turn request on mobile device
http://youaddress:51015/request (locale http://127.0.0.1:51015/request)
2.gif



The number is missing. This can always be obtained in JavaScript or with a specific Client for the shift request. But we will see this in the next post, as soon as I have more free time
 

Attachments

  • queue_eliminator.zip
    4.3 KB · Views: 452
Last edited:

Star-Dust

Expert
Licensed User
Longtime User
But it is possible to create specific clients for the "Queue Monitor" and "Queue Number Request"

Here is what you find in the attachment:
  • Client b4a Queue Monitor (Anrdoid TV)
  • Client b4a Request turn
  • Client b4i Queue Monitor
  • Client b4i Request turn
 

Attachments

  • b4i client monitor.zip
    40.5 KB · Views: 465
  • b4a client request.zip
    10 KB · Views: 444
  • b4i client request.zip
    40.8 KB · Views: 452
  • b4a client monitor.zip
    14 KB · Views: 464
Last edited:

Star-Dust

Expert
Licensed User
Longtime User
Looking at it now almost a year later I would make some changes.
The monitor that induces the turn it took now to realize it with the WebSocket rather than an html page that is updating itself over a period of time.
With webSocket I can update a Tag at any time without having to reload the page or program the reload
 

Xfood

Expert
Licensed User
there is always time to correct it, it's a great example, but if you have better ideas, you could improve it.
???
 

Star-Dust

Expert
Licensed User
Longtime User
Maybe I'll do it again, but with the xHttpServer and b4XPages library, so I can create a server that runs on Desktop / ios / Android and manage the size without client, only with the browser.
 

Star-Dust

Expert
Licensed User
Longtime User
it would be great, even adding more queues.?
????
My cat has only one tail, I can't bear to see more queues.

I am sure you will be able to develop it yourself, the example serves to give you the idea. If in addition to cooking I also have to feed you it would be excessive.
If you take a developer and give him a fish, you feed him for a day, but if you teach him to fish, you feed him forever.
 

medifor

Member
Licensed User
nice project !!!
I would like to add an image to the html pages, in which folder should I place the "IMG" html tag files?
 

Star-Dust

Expert
Licensed User
Longtime User

Attachments

  • Queue2.zip
    126.5 KB · Views: 385
Last edited:

Star-Dust

Expert
Licensed User
Longtime User
nice project !!!
I would like to add an image to the html pages, in which folder should I place the "IMG" html tag files?
It depends where you want it to appear.

The main page is where you see the turn is in the status module. The page to request the shift is request
 

medifor

Member
Licensed User
I say in which folder of the project enter the image file to ensure that on the html page "localhost: 51015 / request" you see the image with the img tag example:
img src="(Path)/logo.jpg" alt="Logo" width="500" height="600"
I put the "logo.jpg" file in the "Files" folder of the project, which relative path should I enter in the IMG tag path? I tried in many ways, but I never see the imagin
 

Star-Dust

Expert
Licensed User
Longtime User
you can put it wherever you want, it all depends on how you set the path server le course (in jServer) and / or how you use the Hadler event.

Look at the jServer examples to understand
 
Last edited:

medifor

Member
Licensed User
thank you, I have to use SRVR.StaticFilesFolder. I'm in the beginning and I've never used the JServer library
 

Star-Dust

Expert
Licensed User
Longtime User
if you use StaticFilesFolder all files must be located within this path or in subfolders of the same path. the files including the images must be linked with the file name (and possibly the path).

For example <IMG SRC="myimage.png"> or <IMG SRC="subfolder/myimage.png">
 

medifor

Member
Licensed User
I updated the example to take advantage of webSocket (and avoid reloading the page every 4 seconds) and use the xHttpServer library.

So it is leaner and more logical

Screen that displays the current turn (Tablet / Android TV / TV Box)
(for local http://127.0.0.1:51051/)

Turn request on mobile device
(for local http://127.0.0.1:51051/request)

.. and how do I insert the path img in this project? there is no StaticFilesFolder
 

Star-Dust

Expert
Licensed User
Longtime User
.. and how do I insert the path img in this project? there is no StaticFilesFolder
this example uses another library. to send an image you must use the Res.SendFile command as a response to the request. Check the xHttpServer library examples to understand how it works
 
Top