4D v14.3

GET SERIAL PORT MAPPING

Home

 
4D v14.3
GET SERIAL PORT MAPPING

GET SERIAL PORT MAPPING 


 

GET SERIAL PORT MAPPING ( numArray ; nameArray ) 
Parameter Type   Description
numArray  Longint array in Array of port numbers
nameArray  String array in Array of port names

The GET SERIAL PORT MAPPING command returns two arrays, numArray and nameArray, containing the serial port numbers and the serial port names of the current machine.

This command is useful under Mac OS X, where the operating system dynamically allocates the port number when using a USB serial adapter. You can address any extended serial port using its name (static), regardless of its actual number.

Note: This command does not return meaningful values with standard ports. If you want to address a standard port, you must pass its value (0 or 1) directly using the SET CHANNEL command (former operation of 4D).

Example  

This project method can be used to address the same serial port (without protocol), regardless of the number that has been assigned to it:

 ARRAY TEXT($arrPortNames;0)
 ARRAY LONGINT($arrPortNums;0)
 C_LONGINT($vPortNum;$vFinalPortNum)
 
  `Find out the current numbers of the serial ports
 GET SERIAL PORT MAPPING($arrPortNums;$arrPortNames)
 $vPortNum:=Find in array($arrPortNames;vPortName)
  ` vPortName contains the name of the port to be used; it may come from a dialog box,
  ` a value stored in a field, etc.
 If(arrPortNums{$vPortNum}=0)
    $vFinalPortNum:=0 `special case under Mac OS X
 Else
    $vFinalPortNum:=arrPortNums{$vPortNum}+100
 End if
 SET CHANNEL($vFinalPortNum;params) `params contains the communication parameters
 ... `Carry out the desired operations
 SET CHANNEL(11) `Closing of port

 
PROPERTIES 

Product: 4D
Theme: Communications
Number: 909

Mac OS specific

 
HISTORY 

Created: 4D 2004

 
SEE ALSO 

SET CHANNEL

 
ARTICLE USAGE

4D Language Reference ( 4D v11 SQL Release 6)
4D Language Reference ( 4D v12.4)
4D Language Reference ( 4D v14 R2)
4D Language Reference ( 4D v13.5)
4D Language Reference ( 4D v14 R3)
4D Language Reference ( 4D v14.3)
4D Language Reference ( 4D v14 R4)