Send SMS msg via Serial port to GSM Modem

04 Feb.,2024

 

nader.chinichian:

nader.chinichian:

detect packet when there is no delimitator or fixed packet size

Timeouts. This has to be configured in an Ethernet-Serial converter, too, if you use one. (The "force transmit" setting in Moxa devices, for example.) You generally need a dedicated thread in Ignition, with all of the life cycle hassles that entails.

The approach is to use a long timeout to read one byte while looking for the start of a packet, checking for interruption at each return. When a byte is read, stick it in a buffer and start an inner loop with minimal timeouts for the number of bytes the port says are available (but not less than one), adding received bytes to the buffer as you go. When you get nothing on the short timeout, deliver the buffered bytes and return to the outer loop. Also checking for interruption in the inner loop.

With high quality products and considerate service, we will work together with you to enhance your business and improve the efficiency. Please don't hesitate to contact us to get more details of gsm modems.