ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Standard functions / Windows functions / Serial/Parallel Ports functions
  • Detecting events and threads
  • Managing very close events
  • Disabling one or more events
  • Closing the port
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Branches an event on a serial port.
WEBDEV - Server code This function returns information regarding the server.
Example
// Detect characters on COM1 port
sEvent(1, sEveCharReceived, "ReadCharacter")
// -- ReadCharacter procedure
PROCEDURE ReadCharacter(PortNum, EventNum)
Trace(sRead(1, sInEntryQueue(1)))
Syntax
<Result> = sEvent(<Port number> , <Event managed> , <WLanguage procedure>)
<Result>: Boolean
  • True if the function was run,
  • False otherwise. sEvent has no effect if the port has not been previously opened in "Event management" mode (with sOpen).
<Port number>: Integer
  • Number of the serial port (1, 2, 3, up to 32 for COM1, COM2, COM3, ... COM32).
  • Port number returned by sOpen (if this function was called with a port name).
<Event managed>: Integer constant (or combination of constants)
Event to retrieve on the port:
sEveBreak
(value: 64)
Receive a "Break line" event
sEveCharReceived
(value: 1)
Receive a character
sEveCTS
(value: 8)
Change of CTS status
sEveDSR
(value: 16)
Change of DSR status
sEveEntryQueue80
(value: 1024)
The input buffer is full at 80%
sEveError
(value: 128)
Detect an error on the line
sEvePrinterError
(value: 512)
Printer error detected
sEveRing
(value: 256)
Detect the "Ring" signal (ring)
sEveRLSD
(value: 32)
Change of RLSD status
sEveTransmitCompleted
(value: 4)
The output buffer is empty
<WLanguage procedure>: Procedure name
Name of the WLanguage procedure called whenever the specified event is detected. This procedure has the following format:
PROCEDURE <Procedure name>(<Port number>, <Event number>)
where <Port number> corresponds to the port where the event occurred
where <Event number> corresponds to one of the event constants.
Remarks

Detecting events and threads

The detection of events is performed in a specific thread of WLanguage. The call to the WLanguage procedure is performed in this thread. Therefore, this procedure is subject to thread limitations (especially for the display).
For more details on threads, see Managing threads.

Managing very close events

If another event is triggered during the procedure triggered by the event, this last event will not be detected.
If very close events are likely to be triggered, we advise you to:
  • read the event data (with sRead) in the procedure triggered by sEvent,
  • continue the rest of the process in another thread.

Disabling one or more events

To disable the management of one or more events, use sEndEvent.

Closing the port

When closing the port, all the events managed on this port are disabled. When re-opening the port, you must re-run sEvent to define the events managed on this port.
Business / UI classification: Business Logic
Component: wd290com.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 05/26/2022

Send a report | Local help