AYUDA EN LÍNEA
 WINDEVWEBDEV Y WINDEV MOBILE

Este contenido se ha traducido automáticamente.  Haga clic aquí  para ver la versión en inglés.
Ayuda / WLanguage / Funciones WLanguage / Funciones estándar / Funciones de Windows / Funciones de puertos serie y paralelo
  • Miscellaneous
  • Transmission between two stations using different string formats (Unicode and ANSI)
  • Using an external library: RXTX
WINDEV
WindowsLinuxJavaReportes y ConsultasCódigo de Usuario (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Código Navegador
WINDEV Mobile
AndroidWidget Android iPhone/iPadIOS WidgetApple WatchMac Catalyst
Otros
Procedimientos almacenados
Reads a character string in the entry buffer of the specified serial port. The port must be opened beforehand (sOpen).
Remarks:
  • This function cannot be used with a parallel port.
  • Java Infrared ports are not supported.
  • Linux Only serial ports are supported.
Ejemplo
WINDEVCódigo de Usuario (UMC)
// Read 20 characters in the Message variable from
// the entry buffer of COM1
Msg is string
Msg = sRead(1, 20)
Sintaxis

Reading a number of bytes and retrieving a string Ocultar los detalles

<Result> = sRead(<Port number> , <Number of bytes to read>)
<Result>: Character string
  • Character string read in the entry buffer,
  • 0 if the read operation was not performed.
<Port number>: Integer
  • Serial port number: 1, 2, 3, ... 32 for COM1, COM2, COM3, ... COM32.
  • Identifier of the serial port returned by sOpen (if this function was called with a serial port name).
    Linux Only this type of parameter is available.
<Number of bytes to read>: Integer
Number of bytes to read in the entry buffer of the serial port. The number of bytes to read is returned by sInEntryQueue.
Observaciones

Miscellaneous

  • sOpen has no effect if the port was not opened by sRead.
  • sRead clears the input queue of bytes actually read.
  • A 32-bit application is locked during the duration of the transfer. To avoid this lock, the timeout between two read operations must be specified in sOpen. If the timeout is reached and the data could not be read, sRead returns 0.
  • WLanguage does not support control signals.
  • The time to wait for a character to be read or written is specified with sOpen.
    • If this time is set to 1s when reading 1024 bytes, the waiting time will be 1024s.
    • If this time is set to "-1s" when reading 1024 bytes, the waiting time will be 1s.
    This prevents lock problems when reading from or writing to the print port.
WINDEVCódigo de Usuario (UMC)

Transmission between two stations using different string formats (Unicode and ANSI)

When transmitting messages between two stations using a different string format (e.g. Windows (ANSI) and Windows Mobile (Unicode)), certain conversions are necessary:
Format of character strings on the current computerWrite operation
(sWrite function)
Read operation
(sRead function)
Buffer containing an ANSI string
Buffer containing a string in Unicode format
ANSI
(PC running Windows for example)
The character string will be in ANSI formatNo conversion is required
Conversion required (UnicodeToAnsi)
UnicodeThe character string will be in Unicode format
Conversion required (AnsiToUnicode)
No conversion is required
Linux Special case for Linux:
  • Only serial ports can be opened and initialized.
  • By default, users do not have access to serial ports. It is necessary to grant them specific rights to manage serial ports.
Java

Using an external library: RXTX

In Java, the use of serial and parallel port manipulation functions (functions 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).
You can download the RXTX library and its documentation from the following link: http://users.frii.com/jarvi/rxtx/index.html (link valid at the time of writing).
Attention: Infrared port management not available in Java.
Clasificación Lógica de negocio / UI: Lógica de negocio
Componente: wd300com.dll
Versión mínima requerida
  • Versión 9
Esta página también está disponible para…
Comentarios
Haga clic en [Agregar] para publicar un comentario

Última modificación: 27/03/2025

Señalar un error o enviar una sugerencia | Ayuda local