BC Integration with Weighbridge Machine through Serial Port (RS232)

Hello, greetings.
This is my first time posting question here.
I hope can get some solution or good direction to solution here.

I’ve been doing some development on integrating Weighbridge Scale Machine to Business Central
The machine can only transfer data to PC using RS232 (Serial Port)
It’s been so hard since I can’t do testing on the actual machine freely, but I found out a way to have fake data transfer between Serial Port(ex COM3 <~> COM4) using com0com and putty

I’ve been doing the data transfer manually by typing through Putty screen.

** The step :

  1. Type 123 on Putty Screen (Not Showing on PUTTY screen(COM4) but succesfuly sent to COM3)

  2. Click Action on BC(COM3) to get data sent from COM4

From here I already success develop a screen to get data to be printed on screen.

When I try directly on the client machine BC did not get any data. Only showing empty pop up, which mean it’s actually already connected to the port but not getting the data
I try to check whether the machine sent data or not using PUTTY and it’s sending data every second (Real time).

Is there any suggestion what should I do next?
Is there any way to do real time fake data sent?

Thanks.

**Im following this page as referal https://docs.microsoft.com/en-us/dotnet/api/system.io.ports.serialport?view=dotnet-plat-ext-5.0

**Referal code

codeunit 70154 Dotnets
{
    [Scope('onPrem')]
    procedure Check()
    var
        serial: DotNet SerialPort;
        Indicator: Text;
    begin
        SPS.get('Serial Port Setup');
        serial := serial.SerialPort();
        serial.PortName(SPS."Port Name");
        serial.BaudRate(SPS."Baud Rate");
        serial.DataBits(SPS."Data Bits");
        serial.Parity(SPS.Parity);
        serial.StopBits(SPS."Stop Bits");

        serial.Open();
        if serial.IsOpen() then begin
            Message('PORT ' + SPS."Port Name" + ' is Open');
        end else begin
            Message('PORT ' + SPS."Port Name" + ' is not Open');
        end;

        serial.Close();
    end;

    [Scope('onPrem')]
    procedure ReadIndicator()
    var
        serial: DotNet SerialPort;
        Indicator: Text;
    begin
        SPS.get('Serial Port Setup');
        serial := serial.SerialPort();
        serial.PortName(SPS."Port Name");
        serial.BaudRate(SPS."Baud Rate");
        serial.DataBits(SPS."Data Bits");
        serial.Parity(SPS.Parity);
        serial.StopBits(SPS."Stop Bits");

        serial.Open();
        Indicator := serial.ReadExisting();
        if serial.IsOpen() then begin
            Message(Indicator);
        end else begin
            Message('PORT ' + SPS."Port Name" + ' is not Open');
        end;

        serial.Close();
    end;

    var
        SPS: Record "Serial Port Setup";
}
dotnet
{
    assembly("System")
    {
        type(System.IO.Ports.SerialPort; SerialPort) { }
    }
}

Hello its yoyr answer interested but how can do it in the scope Saas Cloud target , have an idea or source code , you test javascript

Hey,
I have written a scale integration before that runs on BC (SaaS).

The key is not to try accessing hardware from BC. I created a separate application that runs locally (written in C# or python) that manages the comms to the scale. Then have that app push the scale values to BC using Web Services. Obviously you want to limit the amount of comms that go up to BC but you could send values every second or so, and only when the scale values are stable.

Hope this helps.
Heinrich