Example of Using Serial Gateway Module?

Would anyone have an example of how the Serial Gateway module can be used to allow clients to write to the serial port of the gateway? I have searched within forum, on the site and thru the manuals but haven’t had much luck.

I’ve used the serial client module before and that works the way I have been using it with the serial ports directly on the clients. However, for this I can only use the serial port on the gateway, so I have the gateway module but I’m trying to figure out how to have the clients read and write to the port on the gateway.

Such as my scripts are client scoped and I’m trying to figure out how to scope the script to run on gateway.

I need the clients to be able to read the raw characters streaming from the gateway serial port and the clients be able to write to the same serial port on the gateway.

There’s no magic method that’ll make the client access the gateway serial port. You will need to do all reading and writing in the gateway.
The simplest way to make data available on the clients is to parse the serial strings into useful pieces and place those in memory tags. You could also package the strings read into messages with system.util.sendMessage(). Either approach would typically be implemented in an asynchronous task started from a gateway startup event.
Sending data from the client to the gateway probably should use sendMessage() as well. The gateway’s message event script would unpack the message payloads and write them to the serial port.
You’ll have to share some more about the protocol and expected serial traffic to get more detailed suggestions.