GeoCOM Reference Manual
Communication Settings
Leica TPS1200 / TS30 / TM30 – Version 1.50
26
5.4.3
COM_OpenConnection - opening a port for communication
COM_OpenConnection..............................................................................................................................................................................................................................................................
C-Declaration
........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................ -
COM_OpenConnection( COM_PORT ePort,
COM_BAUD_RATE &eRate,
Short nRetries )
VB-Declaration
VB_COM_OpenConnection( ByVal Port As Integer,
ByVal Baud As Integer,
ByVal Retries As Integer )
ASCII-Request
-
ASCII-Response
-
Remarks
This function opens a PC serial port and attempts to detect a theodolite based on the given baud rate. If a TPS is
well connected to the PC then GeoCOM tries to establish a connection to it.
To be successful the GeoCOM interface on the TPS must be enabled.
RPC COM_NullProc is used to check if the communication is up and running.
nRetries
denotes the number of
retries if the first request has not been fulfilled successfully.
If the TPS is switched off it will be switched on automatically. In such a case it may take several retries to
establish a connection. Since default timeout is three seconds we recommend
nRetries
to be 1-4.
GeoCOM chooses during start-up the default transmission data-format, which is ASCII. If TPS supports binary
data format it is switched automatically to
BINARY
using RPC COM_SetComFormat.
This function will fail if the serial-port is locked or in use. It will also fail if no TPS is connected to the serial
port.
If the call cannot be finished successfully then the port will be freed and closed.
Note:
In the current implementation, GeoCOM does not support two open connections at the same time. A
second attempt to open a second port at once will be denied by GeoCOM.
Parameters
ePort In
Serial port.
eBaud InOut
Baud rate.
nRetries In
Number of retries.
Return-Code Names and Return-Code Values
GRC_OK
0 Execution
successful.
GRC_COM_PORT_NOT_AVAILABLE
3103
Port is in use or does not exist
GRC_COM_NO_PARTNER
3105
GeoCOM failed to detect a TPS.
GRC_IVPARAM
2 Illegal
parameter.
See Also
COM_CloseConnection
COM_NullProc
COM_SetComFormat
Example
see
COM_Init