STX, ETX packets over any data link (e.g. serial ports RS-232, RS-422, RS_485, TCP/IP, TAPI, Modem, ISDN, etc.) is used to improve reliability over lossy channel but also to easily distinquish messages within a data stream (synchronisation).
STX, ETX packets start with the control character STX (ASCII 2) and end with the control character ETX (ASCII 3). STX, ETX packets may have the following structure:
STX [length] [control] [data] [checksum] ETX
The [length] field, if present, defines the amount of bytes contained in the [data] field. Based on the used specification it is usually one byte long but it can be also two bytes long.
The [control] field, if present, may provide informations like: [address], [type], [status], etc.
The [data] field may contain one or data bytes. The [data] field may contain any data bytes (ASCII 0..255) or only printable characters (e.g. '0'..'9', 'A'..'Z', 'a'..'z'). The [data] field can also be empty (e.g. STX ETX or provide an acknowledgement (e.g. STX ACK ETX)).
A [checksum] field or [block check] field (LRC, BCC, CRC etc.) secures the whole data packet against byte or bit loss. A block check, if present, may add a 8-bit checksum, a 16 bit CRC, a 32 bit CRC or any other type of packet control.
Special packets
There exist exceptions to the above rules where ETB (ASCII 23) is used in place of the ETX. Other protocol variations replace or escape control characters within [data] by another special character like DLE (ASCII 16). Other variations may also exist.
Q: Is it possible to run a STX-ETX framing protocol with SuperCom ?
A: Yes. In fact SuperCom can send and receive any type of data (binary, string, etc.) stored in the [data] field.
SuperCom also includes functions that can easily handle this kind of packets completely automated in background.
With SuperCom one can use the standard packet transfer functions like RS_TXPInTime and RS_RXPInTime in order to transmit and receive data packets. Also, SuperCom includes a so called "DataPacket" functionality that can receive complete packets in background and return the pure data to the applications event function OnDataPacket.
SuperCom contains many functions to calculate different types of block check.
SuperCom functionality ensured a stable data communication link for serial ports, tcp/ip data communication and other connections type.
Q: Is it possible to replace bytes within the [data] while received ?
A: Yes. SuperCom includes so called "DataFilter" where you can instruct the SuperCom data engine which byte to remove or replace by which byte. This happens at low level while data are received from the data link (serial ports, TCP/IP etc.) and includes everything you may need.
SuperCom comes with function to support this packet functionality like RS_TXPInTime, RS_RXPInTime or the far more intelligent RS_GetDataPacket or, the completely in background working, RS_GetDataPacketEx. Also class properties and methods for .NET SCom.DPCollect or the ActiveX control with SCom1.DPCollect or C++, Pascal, Delphi SCom.SetDPCollect.
Note:
NET class TSCom and ActiveX control share both the so called "ActiveX API".
See also https://www.adontec.com/super_f1_e.htm#DATACOLLECTOR.
SuperCom comes with a huge amount of example programs, for many different languages and compiler, demonstrating any possible use case. No matter which compiler or programming language you are using e.g. C, C++, C#, Delphi, Java, LapView, Pascal, PowerBuilder, Python, Visual Basic etc.
To develop a data communication protocol is generally a complex task and one should be able to rely on the tools used to accomplish this task. It safes valuable time and results to a stable product if one does not have to build all tiers by himself but concentrate on the protocol logic and be sure that the data communication library will perform as expected (timing, speed, error and loss free, etc.).
Yes, a highly customizable block transmission library. For many ETX-STX protocol variations and custom solutions please ask for SCUBTP - the SuperCom Universal Block Transmission Library. A protocol library that can be used to easily trabsfer data packets using many ETX-ETX variations incl. ENQ/ACK, EOT and many other settings. As common to SuperCom software, this library can run over many type of connections like serial ports, TCP/IP, Modem, ISDN etc. It supports many simultaneous connections and can work event-driven in the background. This library can also be cusomized to enable custom protocols.