How to feed DB2 Progress Bar from C executable

Hello,

I am trying to use the DB2 Progress Bar with node-red flow that uses C programs to operate on a QSPI Flash memory attached to an FPGA. I have written the C program that can do erase, blank check, write and verify operations. Each of these operations take significant time to execute, on the order of minutes, so it continuously writes the percent completion to stdout. My hope was to wire stdout to the DB2 progress bars so that the user can see the progess of each operation.

I attach a picture of the diagram. It executes all the operations in sequence but the progress bars do not update. I think the progress bars expect number but it sees my stdout output as strings. I tried putting the numbers in quotes but that doesn't fix it. What should I do to make this work?

It is true that the progress node does not accept numbers passed as strings.
It ought to.

I attach pictures of a possible solution. I am assuming that your exec node is in spawn mode.

image

Using a Change node to convert the string to a number sounds like the right thing. Unfortunately, I have not been able to run the exec node in spawn mode. In exec mode all the operations run in sequence but the stdout text goes out to the progress bar when the function returns, and all as one string. When I select spawn mode the exec node stops execution and shows "rc: -2" on that node in the flow editor.

Do I need to call the C command differently in spawn mode? Do I need to put an & at the end of the command to put it in background?

At a guess I'd say you need to use unbuffered output in your C code and ensure that every progress message is terminated with a new line.

Alternatively consider using mqtt to interface them, C publishing to a local Mqtt broker

Check all the exec node outputs, with debug nodes set to Output Complete Message, you should find an error message there. If you want to get stdout data while it is running then you do need to use Spawn mode.