Serial Communication Library and components for rs-232, tcp/ip communication. Data transfer and file transfer protocols ZMODEM, YMODEM, KERMIT, MODBUS, 3964, RK512, LSV2. Supporting Visual Studio NET, C#, VB Net, class library, Delphi, C++ Builder, Visual Basic.

Data transfer and file transfer protocols ZMODEM, YMODEM, KERMIT, MODBUS, 3964, RK512, LSV2. Supporting Visual Studio NET, C#, VB Net, class library, Delphi, C++ Builder, Visual Basic. Serial Communication Library and components for rs-232, tcp/ip communication.

SuperCom's Smart Path
Data Filtering, Data Monitoring, Data Trigger, Data Packets, ...

Data Data Packets, Trigger, Data Filtering, Data Monitoring, File Transmission Queue

SuperCom includes intelligent functions that solve lengthly or complex operations easily (Smart Path).

Those intelligent functions not only enable to solve complex tasks fast but also eliminate delaying or blocking of your application. The result is a rock-solid solution, working quickly, softly and smoothly and developed much faster than with regular tools.

This concept will now be demonstrated in the following using some samples. And, as it is common practise in SuperCom software, the following samples can be used without changes over the supported communication links (e.g. Serial, TCP/IP or ISDN).

 

Data Packets
Receive and collect complete data packets automatically in background
A very common problem in data transmission is receiving data packets according to some specifications (lookup strings). For this often complex operation SuperCom provides easy to use functions. The lookup strings is sometimes used to provide login information (e.g. "UserName:", "Password:" lines expected when connecting to servers on remote PC or mainframes) or to catch complete data packets and solve a communication protocol using this function only. The following sample presents a simple data packet defined between STX and ETX captured by the SuperCom function:

DLL API

C/C++ Sample

  char cStart=STX; // start sequence
  char cStop =ETX; // end sequence

     :

  if (DP_OK(RS_GetDataPacket(
                 szBuffer,
                 BufLen,       // len of buffer
                 cStart,       // Starts with
                 sizeof(cStart),
                 cStop,        // ends with
                 sizeof(cStop),
                 0, // ignore parameter, return what's received
                 &TimeOut))
  {
     :
  }

     :

  C/C++    C#    Delphi    Visual Basic

Additionally RS_GetDataPacketEx can execute the above completely in background and deliver the collected data by events (OnDataPacket).

The parameter cStart, cStop define the rules a data packet must comply with (the lookup strings). When called the function receives a data packet according to the rules set or the requested amount of data received or the specified timeout occured. The parameter cStart and cStop are defining the expected start and stop sequence that makes a complete data packet or cannot be defined at all.

The parameter for Start and Stop can be a single data byte (character) or a sequence of data bytes also binary data and can even include wildcards.

WildCards
It's not uncommon that an expected data packet (string, byte array, etc.) is not completely defined e.g. a checksum in a specific position, a "LEN" byte etc. A Wildcard can here present the solution in order to define variable Start and/or Stop sequences.
A Wildcard is a character that substitutes for other character. For our purpose the Wildcard "\?" was defined. It uses two characters to define but substitutes one single character. Whenever a data byte in a specific position within the data packet is unknown it can be marked with the wildcard "\?". In the above sample the buffer of the parameter (cStart or cStop) "H\?llo" physically uses 6 bytes but it defines a start or stop sequence of 5 bytes. It will match for any combination of the second character e.g. "Hello", "Hallo".

Set a range of characters
In some cases the expected characters are known but consist of a set of values or a range of values. Such a condition can be described with the "\[]" sequence, where the allowed set of values are entered within the brackets separated by a ',' and a range of values is separated by '..'.

Samples
The trigger "\[1,2,3,a..z]" defines a single character wildcard that allows the trigger to report when any of the characters '1', '2' or '3' or any character in the range from 'a' to 'z' is received.
The trigger "User\[1,2,3]" will report on "User1", "User2" or "User3".
The trigger "User\[a..z]" will report on "Usera", "Userb", "Userc", .., and "Userz".

The trigger "User\[1,2,3,a..c]" will report on "User1", "User2" or "User3" or "Usera", "Userb" oder "Userc" .

The trigger "User\[1,2]\[a..b]" will report on "User1a", "User2a" or "User1b" or "User2b".

 

The combination of wildcards and value ranges makes it possible to filter complex data packets.

This Data packet collector function is so flexible and reliable that even complete protocols can be realized using it. Once configured it works reliable and returns the expected data packets. If required also via event and background operation (RS_GetDataPacketEx).

 

Sample #2

C/C++ Sample

     :
  char cBuffer[1024];
  DWORD dwDataCount=sizeof(cBuffer);
  TSYSTIME TimeOut=SEC_10;
     :

  sLineEnd = "\r\n"; // CRLF
  dwLen = (DWORD)strlen(pLineEnd);
  dwRes = RS_WaitString(Com,
                        cBuffer,      // buffer
                        &dwDataCount, // max bytes expected
                        sLineEnd,
                        dwLen,
                        &TimeOut,
                        WSCF_BINARY);
     :

  C/C++    C#    Delphi    Visual Basic

 

The function RS_WaitString demonstrates another way to receive complete strings or data packets. RS_WaitString waits until a complete line received. The line is defined to end with CRLF. If the line terminator is not received within the speficied Timeout the function returns with any received data in cBuffer.

Info:
The special functions such as RS_GetDataPacket, RS_GetDataPacketEx, TriggerAdd, TriggerDel, TriggerSignaled, ... have been developed around RS_WaitString. Alternatives to solve any problem flexibly and with excellent execution speed.

 

It's just as easy with the ActiveX API or using the class libraries:

 

Select sample: simple or wildcards
Visual Basic Sample


     SCom1.DPStart = "at" & vbCr & vbLf
     SCom1.DPStop = vbCr & vbLf

     SCom1.DPTimeout = 3 * SEC_1
     SCom1.DPLimitLen = 10

     SCom1.DPCollect = True


  C/C++    C#    Delphi    Visual Basic

The properties DPStart, DPEnd, DPLimitLen and DPTimeout define the rules for the Data Packet and DPCollect activates the Data Packet Collector. From that point on the Data Packet Collector collects and reports data packets according to the rules (Start="at"CRLF, End=CRLF, where CR=Carriage Return, LF=Line Feed). The Data Packet Collector is reporting the event through the event function OnDataPacket which also delivers the data packet.

!

The Data Packet Collector runs completely in the background. This allows the application to perform other tasks until the appropriate events arrive and deliver the data. An automated package collecting machine simply activated!

The properties DPStart, DPEnd can be defined as needed or not. DPStart, DPEnd can contain a single data byte (character) or a sequence of data bytes.

WildCards
It's not uncommon that an expected data packet (string,...) is not completely defined (a checksum, a "LEN" byte). A Wildcard can here present the solution. A Wildcard is a character that substitutes for other character. For our purpose the Wildcard "\?" was defined. It uses two characters to define but substitutes one single character. Whenever a data byte in a specific position within the data packet is unknown it can be marked with the wildcard "\?".

The combination of Wildcards and Set and Ranges enables collecting of even complex data packets.

In the above sample the buffer of DPStart was defined as "a\?"CRLF. It physically uses 5 bytes but it defines a start sequence of 4 bytes ("ax"CRLF). It will match for any combination of the second character e.g. "at"CRLF, "aT"CRLF, "ax"CRLF, etc.

The Data Packet Collector is executing completely in background. The application can now do other thinks until it receives events with the reported data packets. An automated data packet collector very simple activated!

 

Trigger
There are situations where the communication library is the one that should act fast on some special data received. The application can do other thinks until the received data require attention. The application will receive a data available event in order to act on.

As shown in the next sample SuperCom makes it realy easy to set and expect events on special data called Trigger. The used lookup string is sometimes used to provide login information (e.g. "UserName:", "Password:" used when connecting to servers on remote PC or on mainframes) or to inform about special sequemces of data when received. The following sample presents the setup of Trigger pair:

DLL API

C/C++ Sample

     :
  pTrigger = "Username:|Password:";
  dwLen = (DWORD)strlen(pTrigger);

  TriggerAdd(Com, pTrigger, dwLen);

   C/C++    C#    Delphi    Visual Basic

In order to define a Trigger the functions accepts a text string or a binary data packet.

A Trigger can be a single data byte (character) or a sequence of data bytes.

The function RS_WaitString* is used to install one or more Trigger (in the above sample a multi-trigger). From now on SuperCom observes the received data stream and as soon SuperCom receives the string "UserName:" or "Password:" it will report the Trigger through an event. Since no other rules are set the data will be observed without restrictions to the character case.

 *  In order to ease the call of RS_WaitString the Trigger Helper API was created with functions like TriggerAdd, TriggerDel, TriggerSignaled,...

WildCards
It's not uncommon that an expected data packet (string,...) is not completely defined e.g. one or more data bytes are unknown. A Wildcard can here present the solution. A Wildcard is a character that substitutes for other characters. For triggers purpose the Wildcard "\?" was defined. It uses two characters to define but substitutes one single character. Whenever a data byte in a specific position within the trigger is unknown it can be marked with the wildcard \?. The buffer of the trigger "H\?llo" physically uses 6 bytes but it defines a trigger of 5 bytes. It will match for any combination of the second character e.g. "Hello", "Hallo". An extra small manual covers this powerfull Trigger Helper API and also presents some aspects of using triggers with protocols.

The combination of Wildcards and Set and Ranges enables running even complex Triggers.

The Trigger mechanism is a real relief for the application. As soon SuperCom receives the awaited data it will report it. The Trigger event EV_TRIGGER is received by the application through the known UserEventProc.

 

ActiveX API

Visual Basic Sample

     :
   SCom.Trigger="Username:|Password:"
   SCom.TriggerAction=SCOMM_TRIGGER_ADD
     :

  C/C++    C#    Delphi    Visual Basic

 

The property Trigger defines the trigger (lookup string) and the property TriggerAction defines the action to perform on the defined trigger (e.g. ADD = observe and report). From that point on "Trigger" events will get reported as soon SuperCom receives the string "UserName:" or "Password:".

As soon SuperCom receives a trigger it reports the event SCOMM_EV_TRIGGER to the OnComm event function. One can define any amount of triggers as needed and remove every single one using the above properties.

WildCards
For unknown data bytes (characters) the Wildcard "\?" can be used e.g. "H\?llo".

The combination of Wildcards and Set and Ranges enables running even complex Triggers.

 

DataFilter
Some tasks require to inspect and/or change data while received or transmited. It's obvious that letting SuperCom do this is advantageous.

SuperCom supports low level data filtering functionality inside the library (DataFilter). Predefined data filter can perform within the library and custom filter using custom functions.

DLL API

C/C++ Sample

     ComFilterInit(..., FLAG_DATA_FILTER_RX_STRIP_NULL |
                        FLAG_DATA_FILTER_TX_STRIP_NULL);
     :
  C/C++    C#    Delphi    Visual Basic / VB Net  

The function ComFilterInit activates the SuperCom data filter. The whole data filter mechanism is running at low level within the library. There exist many predefined filter that can be set using ComFilterInit. The application will always receive the data after all conversions done.

Custom Rx, Tx functions
The SuperCom DLL API additionally enables to install custom Rx and Tx functions in order to implement custom data filtering and data collecting algorithms. These functions are executed at low level by the SuperCom call stack when data received or transmitted.

 

ActiveX API

Visual Basic Sample

     SCom1.DataFilter=FLAG_DATA_FILTER_RX_STRIP_NULL

  C/C++    C#    Delphi    Visual Basic  

The property DataFilter defines one or more filtering rules from the default SuperCom filtering rules set and activates the data filering mechanism. There exist many pre-defined filter that can be set using DataFilter. The application will always receive the data after all conversions done.

 

File Transmission Queue
Enables files to be transferred entirely in the background
SuperCom functions like RS_TXFileEx allow files to be transferred completely in the background via internal queues. A simple function call and the rest is handled by SuperCom in the background. The application can attend to other things in the meantime.

Events are reported continuously as needed. The application is always informed about which file is currently being transferred and the progress.

 


 

Summarizing
The presented tools are offering different ways to complete the mission. Other combinations are also possible. The manual provides additional information and on specific questions our technical team surely can show additional solutions.

Intelligent functions can solve complex tasks. Exactly as one would expect from a professional Tool.

A DUAL API SuperCom software allows even better utilization of the presented tools. Among other things, it allows to call functions from the ActiveX API and DLL API as required.

 

Versatility
SuperCom is still the number one toolkit that supports different development environments providing extensive API support and samples. You're free to switch your compiler anytime and your are not bound to one and only. This saves a huge amount of time and costs of development.

Help!

As a SuperCom customer, you can always contact us and query fast the suitable function, parameter definition, Trigger to define etc. We will tell you exactly if and how to use a suitable SuperCom function in order to get specific data (-packets) fast and accurate.


Home    Back

Data communication software, ActiveX communication libraries and components
It Simply Works!

Updated on: 2024-03-19 11:58:33