SuperCom - The Data Communication Library

-- A programmers introduction to some of the SuperCom concepts --

SuperCom offers a rich set of APIs that can be used to setup data connections and transfer data or files.

There is always the 'direct API' (calling the native SuperCom functions directly) but also wrappers like the ActiveX control, C++ class CSuperCom, Delphi / Pascal class TSuperCom or the NET class TSCom (imitates the ActiveX) and other. You select the one that fits best to your environment and compiler language.

Many samples are included with each product and are demonstrating the available API.

In this section we will present the most used functions for establishing a data connection with SuperCom. The used functions calls are pretty the same no matter if serial ports or TCP/IP connections.

Data Communications protocol library, serial driver. One API for Serial communication or TCP/IP communication.

Communication Index

In order to setup and control a connection (data link) using SuperCom one usually has to define a 'communication-index'. Every connection, SuperCom handles, uses a unique communication-index. Nearly every function in the SuperCom API expects this index as it's first parameter. This index can also be considered as a 'handle' and is often declared as the variable Com within a program.

When using some classes the communication-index seems to disappear but it's always there. Even when a connection was setup without the need to provide one, SuperCom will allocate one.

When using serial ports the connection-index is hard-wired to a specific serial port. Thus the index 'COM_1' is connected to the first serial port in the system e.g. under Windows it is the "COM1". The index 'COM_2' would connect to "COM2" etc. When using connection over TCP/IP, TAPI, ISDN etc. there exist no such relation and every available index between COM_1 and COM_255 can be used.

A software developer can define the index to use manually although SuperCom offers functions to check for available communication-index (available data link) e.g. ComValid and also offers functions (e.g. ComPortPresent) in order to query for available serial ports, TAPI devices etc.

Setup a data connection

The following short samples show the most frequently used APIs used when setting up a connection with SuperCom.

Calling the native SuperCom API directly


  TCOMMID Com = COM_2;  // Communication index, e.g. using serial port COM2
  char *Msg = "Hello World";


  ComSetState(Com, 57600, 8, 1, 'N', ...);

  RS_TXPacket(Com, Msg, strlen(Msg), &Result);


  C/C++    C#    Delphi    Java    Visual Basic


Let's explain the above lines a bit:
The function ComInit instructs SuperCom to assign the second data link (e.g. the second serial port on Windows "COM2", on Linux "ttyS1"). ComSetState applies the communication parameters and flow control. Now the connection is ready to transfer data. The function RS_TXPacket transmits the data packet Msg through the data link (e.g. serial interface) and ComReset finaly closes all actions on the data link and releases the used data link and the related hardware and software resources used.


Using alternative functions and class libraries (wrapper) created around the native SuperCom API


       // Serial, TCP, ... - direct API
   TCOMMID Com = COM_2; // Communication index, e.g. using serial port COM2

ComGetSetConfig(...); // Set ComType e.g. Serial (RS232, RS485), TCP/IP etc. ComInit (Com); ComSetState (Com, 9600, ...); // if Modem, TAPI, TCP, ISDN: RS_ConnectEx establishes connection RS_ConnectEx(Com,... );
: ComWriteEx(Com, STR_HELLO, strlen(STR_HELLO)); ch = ComRead(Com); : ComReset();
  C/C++    C#    Delphi    Java    Visual Basic


RS_OpenLink is a newer function that eases the setup of a connection since all the required configuration data can be provided using a string as parameter containing "name=value" pairs. There also exists special forms, in selected SuperCom protocol modules, like RS_S7OpenLink used to setup a connection to an S7 type plc.

A short list of the native SuperCom functions can be found here Serial and TCP data communication library function list

Another big source of custom functions and classes are presented in the many example programs accompanying each product. Free to use for the licensed user in order to get the product done faster.


Home   Back

Data communication Software and data communication libraries and components
It Simply Works!

Updated on: 2023-04-28 13:55:57