BSA – Communication Link

BSA contains a build-in component “Communication Link” and I wanted to see how it would be to code this manually in BSA. As you code you can chose to code modules in target language , or you can code components in BSA itself as we do in this example. See discussion below the diagram.

In this case we assume that the host platform have an object “Serial” with Open and Close functions as well as an event “Serial.Error”.

Open is straight forward as we open the serial line and exit with OnOpen or OnClose. Same with Close we exit with OnClose.

The more interesting part is the event “Serial.Error” where we call Close, wait 500ms and call Open three times before we give up. This is designet to keep a serial line open. Open is the same diagram as we have on left, but we override OnOpen and OnError in the “Serial.Error” diagram – if we get OnOpen we forward it, if we get OnError we loop and try x times before we give up.

This should work just fine, I will not advocate that everything should be coded in BSA as that is an user choice, Myself I will code large libraries in C++ and C# and glue them together in BSA. To make this a library you just select the diagram in the dictionary and tag it as library with a version number or you can just re-use it directly from Dictionary by dragging it into the diagram. It is guaranteed to be details and changes on this bit as we go into code generation later.

The same diagram through the clipboard – I thing “someone” has forgotten to convert colors for a component 🙂

Categories: BSA

Leave a Reply