PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Various
  • Transmission between two computers that use character strings in different formats (UNICODE and ANSI)
  • Using an external library: RXTX
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Writes a character string into the output buffer of the specified serial port, parallel port or infrared port. The end of writing can be checked by sInExitQueue.
WEBDEV - Server code This function returns information regarding the server.
Notes:
  • The port must be opened beforehand (sOpen).
  • Versions 16 and later
    Java The management of infrared ports is not available in Java.
    New in version 16
    Java The management of infrared ports is not available in Java.
    Java The management of infrared ports is not available in Java.
Versions 16 and later
WINDEVJava This function is now available for the Java applications.
New in version 16
WINDEVJava This function is now available for the Java applications.
WINDEVJava This function is now available for the Java applications.
Example
// The COM2 port is opened
sMessage is string
// Send a message to the output buffer of COM2
sWrite(2, sMessage)
// Wait for the end of the write operation
LOOP
        IF sInExitQueue(2) = 0 THEN BREAK
END
Info("End of write operation")
Syntax

Writing a character string into the output buffer of a port Hide the details

<Result> = sWrite(<Port Number> , <String to Write>)
<Result>: Integer
  • Number of characters written,
  • 0 if time-out is over and if the writing was not performed.
<Port Number>: Integer
Number of relevant port:
  • Number of serial port: 1, 2, 3, ... 32 for COM1, COM2, COM3, ... COM32.
  • Number of parallel port: -1, -2, -3 or -4 for LPT1, LPT2, LPT3 or LPT4.
  • Number of infrared port: 1, 2, 3, ... 32 for IR1, IR2, IR3, ... IR32.
    Versions 16 and later
    Java The management of infrared ports is not available in Java.
    New in version 16
    Java The management of infrared ports is not available in Java.
    Java The management of infrared ports is not available in Java.
  • Port number returned by sOpen (if this function was called with a port name).
<String to Write>: Character string (with quotes)
Character string that must be written into the output buffer.

Writing a buffer into the output buffer of a port Hide the details

<Result> = sWrite(<Port Number> , <Buffer to Write>)
<Result>: Integer
  • Number of characters written,
  • 0 if time-out is over and if the writing was not performed.
<Port Number>: Integer
Number of relevant port:
  • Number of serial port: 1, 2, 3, ... 32 for COM1, COM2, COM3, ... COM32.
  • Number of parallel port: -1, -2, -3 or -4 for LPT1, LPT2, LPT3 or LPT4.
  • Number of infrared port: 1, 2, 3, ... 32 for IR1, IR2, IR3, ... IR32.
    Versions 16 and later
    Java The management of infrared ports is not available in Java.
    New in version 16
    Java The management of infrared ports is not available in Java.
    Java The management of infrared ports is not available in Java.
  • Port number returned by sOpen (if this function was called with a port name).
<Buffer to Write>: Buffer
Buffer that must be written into the output buffer.
Remarks

Various

  • sWrite has no effect if the port was not opened by sOpen.
  • A 32-bit application is locked during the duration of the transfer. To avoid this lock, the time-out between two write operations must be specified in sOpen. When the time-out is over and if the writing was not performed, sWrite returns 0.
    Versions 16 and later
    Java sWrite is a locking function during the transfer even if a time-out was specified in sOpen.
    New in version 16
    Java sWrite is a locking function during the transfer even if a time-out was specified in sOpen.
    Java sWrite is a locking function during the transfer even if a time-out was specified in sOpen.
  • The time required to transfer the string depends on the transmission speed.
  • The string or the buffer is automatically transferred.
  • WLanguage does not allow you to manage the control signals.

Transmission between two computers that use character strings in different formats (UNICODE and ANSI)

Some conversions are required to perform a transmission between two computers that use different formats of character strings (Windows (ANSI) and Windows Mobile (UNICODE) for example):
Format of character strings on the current computer
Write operation
(sWrite)
Read operation
(sRead)
String in ANSI format
String in UNICODE format
ANSI
(PC running Windows XP for example)
The character string will be in ANSI formatNo conversion is requiredConversion required (UnicodeToAnsi)
UNICODE
(Pocket PC running Windows CE for example)
The character string will be in UNICODE formatConversion required (AnsiToUnicode)No conversion is required
Versions 16 and later
Java

Using an external library: RXTX

In Java, the use of functions for handling the serial and parallel ports (sOpen, sWrite, sRead, ...) requires the presence of an external library: RXTX.
This library includes a Jar archive and one or more native libraries that depend on the operating system on which the application is run. To use these functions:
  • the Jar archive (RXTXComm.jar) must:
    • be found in the same directory as the Java application generated by WINDEV,
    • be found in the execution classpath of the application,
    • be directly included in the generated application (from the wizard for Java generation).
  • the native libraries corresponding to the operating system on which the application is run must be found:
    • in the same directory as the Java application generated by WINDEV,
    • in the path of the application libraries (librarypath).
The RXTX library and its documentation can be downloaded from: http://users.frii.com/jarvi/rxtx/index.html (link valid at the time this documentation was published).
Caution: The management of infrared ports is not available in Java.
New in version 16
Java

Using an external library: RXTX

In Java, the use of functions for handling the serial and parallel ports (sOpen, sWrite, sRead, ...) requires the presence of an external library: RXTX.
This library includes a Jar archive and one or more native libraries that depend on the operating system on which the application is run. To use these functions:
  • the Jar archive (RXTXComm.jar) must:
    • be found in the same directory as the Java application generated by WINDEV,
    • be found in the execution classpath of the application,
    • be directly included in the generated application (from the wizard for Java generation).
  • the native libraries corresponding to the operating system on which the application is run must be found:
    • in the same directory as the Java application generated by WINDEV,
    • in the path of the application libraries (librarypath).
The RXTX library and its documentation can be downloaded from: http://users.frii.com/jarvi/rxtx/index.html (link valid at the time this documentation was published).
Caution: The management of infrared ports is not available in Java.
Java

Using an external library: RXTX

In Java, the use of functions for handling the serial and parallel ports (sOpen, sWrite, sRead, ...) requires the presence of an external library: RXTX.
This library includes a Jar archive and one or more native libraries that depend on the operating system on which the application is run. To use these functions:
  • the Jar archive (RXTXComm.jar) must:
    • be found in the same directory as the Java application generated by WINDEV,
    • be found in the execution classpath of the application,
    • be directly included in the generated application (from the wizard for Java generation).
  • the native libraries corresponding to the operating system on which the application is run must be found:
    • in the same directory as the Java application generated by WINDEV,
    • in the path of the application libraries (librarypath).
The RXTX library and its documentation can be downloaded from: http://users.frii.com/jarvi/rxtx/index.html (link valid at the time this documentation was published).
Caution: The management of infrared ports is not available in Java.
Components
WINDEVWEBDEV - Server codeReports and Queries wd230com.dll
Windows Mobile wp230com.dll
Java wd230java.jar
Minimum required version
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment