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

    External Debugging of an Application of another SAP User in another Location in another Machine/System

    Today, External Debugging of an Application of another SAP User in other Location in another Machine/System. we would investigate an extremely helpful hint in ABAP which I didn’t be aware…

    Quantum Computing & SAP: Futuristic Possibilities by 2030

    If someone told you 10 years ago that computers could solve complex global challenges in seconds, you might have shrugged it off as science fiction. But today, thanks to quantum…

    Leave a Reply

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

    You Missed

    External Debugging of an Application of another SAP User in another Location in another Machine/System

    • By Varad
    • April 12, 2026
    • 74 views
    External Debugging of an Application of another SAP User in another Location in another Machine/System

    Quantum Computing & SAP: Futuristic Possibilities by 2030

    • By Varad
    • April 11, 2026
    • 68 views
    Quantum Computing & SAP: Futuristic Possibilities by 2030

    Top 10 SAP Fiori Apps Every Consultant Should Know in 2026

    • By Varad
    • April 10, 2026
    • 306 views
    Top 10 SAP Fiori Apps Every Consultant Should Know in 2026

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

    • By Varad
    • April 9, 2026
    • 86 views
    Advanced SAPUI5 – 4 – How to Use the SAPUI5 Hybrid App to Retrieve Weight from the Weigh Bridge/Weigh Scale Bluetooth Device?

    Utilizing Shell Scripts in an ABAP Environment for SAP

    • By Varad
    • April 8, 2026
    • 87 views
    Utilizing Shell Scripts in an ABAP Environment for SAP

    How to Debug SAP ABAP Programs Like a Pro

    • By Varad
    • April 7, 2026
    • 305 views
    How to Debug SAP ABAP Programs Like a Pro