GeoCOM Reference Manual
Fundamentals of Programming GeoCOM
Leica TPS1200 / TS30 / TM30 – Version 1.50
13
#define NUM_OF_RETRIES 1
GRC_TYPE RetCode;
BOOLE bOpenAndRunning = FALSE;
// initialize GeoCOM
RetCode = COM_Init();
if (RetCode == GRC_OK)
{
// open a connection to the TPS1200 instrument
RetCode = COM_OpenConnection (COM_1, COM_BAUD_19200,
NUM_OF_RETRIES);
if (RetCode == GRC_OK)
{
bOpenAndRunning = TRUE;
}
}
// optionally set up other comm. parameters here
if (RetCode == GRC_OK)
{
// -- functionality of the application --
// here we just test if communication is up
RetCode = COM_NullProc();
if (RetCode != GRC_OK)
{
// handle error
}
}
// close channel
if (bOpenAndRunning)
{
RetCode = COM_CloseConnection ();
if (RetCode != GRC_OK)
{
// handle error
}
}
// anytime finalize and reset GeoCOM
RetCode = COM_End();
if (RetCode != GRC_OK)
{
// handle error
}
3.3.3
C/C++ Development System Support
GeoCOM system files have been developed using Microsoft Visual C/C++ 6.0. Although this development
environment were the basis for the current GeoCOM implementation, it has been emphasised that it is independent of it,
hence other development environments can be used too. But please notice that it has not been tested thoroughly so far.
3.3.4
Programming Hints
Order of Include Statements
Since GeoCOM redefines
TRUE
,
FALSE
and
NULL
we recommend the following include order:
1. Include system headers like
stdio.h
or
stdafx.hpp
2. Include
com_pub.hpp
3. Include the current project headers
BOOLE Definition
GeoCOM defines its own Boolean type as an enumeration type of
FALSE
and
TRUE
. It is called
BOOLE
. With one
exception, this does not produce any problems. Only if a
BOOL
type value will be assigned to a
BOOLE
type variable or
parameter the compiler (MS-VisualC/C++) generates an error. To solve this problem the expression, which will be
assigned to, has to be converted by a
CAST
statement to
BOOLE
.