GeoCOM Reference Manual
Fundamentals of Programming GeoCOM
Leica TPS1200 / TS30 / TM30 – Version 1.50
10
3
F
UNDAMENTALS OF
P
ROGRAMMING
G
EO
COM
3.1
INTRODUCTION
We will describe how programs can be written using the different protocols. Certainly, the type system, where the main
differences lie between the protocols, will be described in more detail.
3.2
ASCII PROTOCOL PROGRAMMING
Implementing an application, which uses the ASCII protocol, is based on simple data transfers using a serial line. The
programmer is responsible to set up the serial line parameters of the client such that they correspond to the settings of
the TPS1200 instrument. Then Remote calls are done by just sending the valid encoded requests and receiving and
decoding the replies of them.
For debugging purposes, it might be helpful to use a so-called Y-cable, which enables you to observe the
communication on the serial line using either a terminal or a terminal emulator. For further details see
Appendix B-2 Debugging Utility.
Note
: If the settings of the active COM port will be set by any software part and if the server is online, then it is
strongly recommended to use a leading <LF> to clear the receiver buffer at the server side. This will reduce
unnecessary error messages of the next RPC.
3.2.1
Data Types in ASCII Protocol
Each parameter of a RPC has its own associated data type with it. There are varieties of different data types, which have
been defined for the set of published functions. The ASCII protocol supports simple data types only. All data types,
which are different from the base, types in name and aggregated data types are converted and reduced to their base
types. Conversion means to serialise the aggregated data into a comma-separated list of its elements. Therefore, the
programmer has the responsibility to interpret the values depending on the associated data type.
The supported base types and their value range are defined below:
Format Type
Valid range
Len
Valid input
representations
Typical output
representations
boolean
0 = false
1 = true
1 0,1
0,1
byte
0...255 2
(4) ‘00’,’FF’,’ff’,’7a’,
’A7’
‘00’,’FF’,’ff’,
’7a’,’A7’
string
- <512
”abc\x0d\x0a”
”abc\x0d\x0a”
double
±2.225E-308...
±1.797E+308
17+3 1,
1.0,
1.0e4,
-0.1e-07, -2
-0.e67
long
(-2
31
)...(2
31
-1)
11 0x7FFFFFFF,
-54321
15, -154836,
900000
short
-32768...32767
6
0, -1, -32700, 45,
56, 0x45e,
0X3AA
0, -1, -32700, 45,
56
unsigned long
0...(2
32
-1)
10 0xFFFFFFFF
0,
1,
3400065,
95735
unsigned short
0...65535
5
0, 1, 34000, 65,
65535, 0x3a,
0x00, 0xFFFF
0, 1, 34000, 65,
65535
Table 3-1: Communication Parameter Types