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

    SAP Joule Setup: Prerequisites You Need Before Getting Started

    If you have been hearing your SAP project team talk about Joule lately, you are not alone. SAP’s generative AI copilot has been showing up in conversations across SuccessFactors teams,…

    SAP Joule vs Traditional Chatbots – What’s the Real Difference

    Anyone who has worked inside an SAP environment knows the feeling. You need one number, one approval status, one report, and you end up clicking through five screens to find…

    Leave a Reply

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

    You Missed

    SAP Joule Setup: Prerequisites You Need Before Getting Started

    • By Varad
    • June 23, 2026
    • 3 views
    SAP Joule Setup: Prerequisites You Need Before Getting Started

    SAP Joule vs Traditional Chatbots – What’s the Real Difference

    • By Varad
    • June 22, 2026
    • 5 views
    SAP Joule vs Traditional Chatbots – What’s the Real Difference

    How SAP Joule Integrates with S4HANA SuccessFactors and Ariba

    • By Varad
    • June 21, 2026
    • 14 views
    How SAP Joule Integrates with S4HANA SuccessFactors and Ariba

    SAP Joule for Consultants, Developers & End Users – Who Benefits Most?

    • By Varad
    • June 20, 2026
    • 22 views
    SAP Joule for Consultants, Developers & End Users – Who Benefits Most?

    SAP Joule Architecture: How It Works with SAP BTP & Cloud Identity

    • By Varad
    • June 19, 2026
    • 24 views
    SAP Joule Architecture: How It Works with SAP BTP & Cloud Identity

    4 Core Capabilities of SAP Joule Every Consultant Must Know

    • By Varad
    • June 18, 2026
    • 26 views
    4 Core Capabilities of SAP Joule Every Consultant Must Know