TApxComPort.AddDataTrigger

TApxComPort

function AddDataTrigger(
  const Data : string; const IgnoreCase : Boolean) : Word;

Adds a string match trigger to the dispatcher.

Data is the string the dispatcher attempts to match in the received data stream. If IgnoreCase is True, case is not considered when checking for a match.

If the trigger is added successfully the function returns the handle of the trigger. Otherwise, it generates an exception. No subsequent call is required to activate the trigger.

When the internal dispatcher finds incoming data that matches Data it generates an OnTriggerData event.

The following example tells the internal dispatcher to generate an OnTriggerData event whenever it receives the string "UserID:". The case of the strings must match exactly because False is passed for IgnoreCase.

ApxComPort.AddDataTrigger('UserID:', False);

See also: AddStatusTrigger, AddTimerTrigger, RemoveTrigger