Advanced SAPUI5 – 4 – How to Use the SAPUI5 Hybrid App to Retrieve Weight from the Weigh Bridge/Weigh Scale Bluetooth Device?

Any new technology always starts with a “Hello World” software or app. However, when working on actual projects, you will need to read data from weighbridges and weighscales or using wireless scanners. Beginners are cruel in life. 🙂

This topic may be difficult for even UI developers with extensive skills to understand. However, I’ve made an effort to explain things step-by-step so that even beginners may grasp them. You would definitely need a cup of coffee, or any other beverage that keeps your mind active 🙂. Remind yourself not to consume any beverages that could impair your cognitive function and cause fatigue. 😛

Step 2

Connect to the weigh scale bluetooth adapter using the mobile bluetooth and send the values using the playstore app bluetooth serial.

Step 3

Send the values like “us0004455. kg” since from weigh scale the data flows in this manner based on the device you have purchased.

Step Four

Create a hybrid SAPUI5 app by using the “cordova-plugin-bluetooth-serial” plugin.

Step Number Five

Use the feature below to connect the weigh scale’s Bluetooth adapter to get its weight.

//Get the paired bluetooth device name and address using
 bluetoothSerial.list(function(devices) {
                 var oModelJson = new sap.ui.model.json.JSONModel(devices);
                 that.getView().setModel(oModelJson, "BluetoothDevices");
                 //For testing choose the first device
                 that.device  = devices[0];
             }, function(error) {
                 sap.m.MessageToast.show(error);
             });
//that.device.address refers to the bluetooth address of the device
//that.device.name refers to the name of the device
 bluetoothSerial.connect(that.device.address, function(){
 bluetoothSerial.read(function(data) {
//From weigh scale you will get every milli second updated values in array so choose the recent one
 data =  data.split("\r\n");
//Here substring values to split are based on the device data format.  
//For me  its 2,10 offset values
 alert("weight="+data[1].substring(2, 10).trim(););
 });
 }, function(){
 sap.m.MessageToast.show("FAILED TO CONNECT TO " + that.device.name);
 });
// for me its 2,10 offset values
 alert("weight="+data[1].substring(2, 10).trim(););
 });
 }, function(){
 sap.m.MessageToast.show("FAILED TO CONNECT TO " + that.device.name);
 });

The trailer was up above. You can see what we’re attempting to achieve. Allow me to outline the stages in further detail now. Let us begin the process of development again.

Step 1: Click Windows’ “Cmd” executable.

Step 2: Type “Cordova create weigh com.weigh weigh” into the command line.

Step 3: Add the Android platform by moving to the directory.

cmd "cd weigh"
cmd " cordova platform add android "

Step 4: Type “cordova plugin add cordova-plugin-bluetooth-serial” to add the plugin.

Step 5: Open Webide, create a sample project, and add two buttons to the view

Step 6: To examine the connected devices, create a fragment (paired in mobile).

I have only coupled this experiment with a single weigh scale Bluetooth adapter device.

Step 7: Use this function call to examine the associated device name and address by pressing the get devices button.

Step 8: From the list, choose a device.

I have called the code below using the table column list press event.

Step 9: Take the device’s weight

Since we don’t have an expensive weigh scale at home, we can test this by connecting the bluetooth weigh scale adapter to a serial Bluetooth Google Play app.

Step 10: Click the “get weight” button to activate the feature below.

How are APK files developed?

You are now aware of its functionality. Time to create the APK file now. Take the actions listed below.

Put the WWW folder containing the sapui5 code.

Add two lines containing a link to an internet resource in the index.html.

At last, execute the commands “cordova build” and “cordova run.”

Thank You

  • Related Posts

    Breaking Silos: QAOps & Its Impact on DevOps

    Learn about QAOps and its role in bridging the gap between Development, Operations, and Quality Engineering. Boost your career with our comprehensive QAOps courses at Bright-Minds.

    AI-Code Creates More Testing Work: Adapting to Increased Demand |

    Learn about the impact of AI-generated code on QA teams and strategies for adapting to increased testing demands. | Bright-Minds Training Institute, Pune

    Leave a Reply

    Your email address will not be published. Required fields are marked *

    You Missed

    Breaking Silos: QAOps & Its Impact on DevOps

    • By Varad
    • October 25, 2026
    • 3 views
    Breaking Silos: QAOps & Its Impact on DevOps

    AI-Code Creates More Testing Work: Adapting to Increased Demand |

    • By Varad
    • October 24, 2026
    • 9 views
    AI-Code Creates More Testing Work: Adapting to Increased Demand |

    Bridging the Gap: How Automation Addresses Understaffing in QA Teams |

    • By Varad
    • October 23, 2026
    • 17 views
    Bridging the Gap: How Automation Addresses Understaffing in QA Teams |

    Selenium BiDi: A Game Changer for Browser Automation |

    • By Varad
    • October 22, 2026
    • 20 views
    Selenium BiDi: A Game Changer for Browser Automation |

    Catch Regressions First: The Power of Continuous Performance Baselines

    • By Varad
    • October 21, 2026
    • 32 views
    Catch Regressions First: The Power of Continuous Performance Baselines

    uman Oversight in AI Testing

    • By Varad
    • October 19, 2026
    • 24 views
    uman Oversight in AI Testing