Campbell Scientific TDRSDK Software Developement Kit User Manual
Page 7
 
TDRSDK Software Development Kit for TDR100
3
3.1 Commands for error codes, serial port control, call-back
and state machine queries
1. ReadErrorCode
Allows the calling application to get an error string by specifying the API 
function number, and error code. This is used to determine reason for error on 
failure of a DLL command. 
int ReadErrorCode(int apiNumber, int errCode, char errStr, int strSiz)
Parameters:
apiNumber: API function number
errCode: return non-zero value from each API function
errStr: describes Error in a string
strSiz: buffer size for errStr.
Return Codes:
0 = Success
1 = Unknown Error Code
2. SetCommPort
Allows the calling application to specify the communications port and the 
communication baud rate. The comm port values are limited to those available 
on the machine. The baud rate is limited to 9600bps, 19200bps, or 57600bps. 
The default baud rate value is 57600bps. Changing baud rate requires 
repositioning jumpers inside TDR100. See TDR100 Operating Manual. 
int SetCommPort(short portNbr, int baudRate)
Parameters:
portNbr: Communications port number, i.e. 1 for Com1
baudRate:
Communications baud rate, i.e. 57600
Return Codes:
0 = Success
1 = Parameter out of Range
3. CloseCommPort
Allows the calling application to close the current communications port 
previously opened using ‘SetCommPort’; 
int CloseCommPort
Parameters: None
Return Codes:
0 = Success
1
=
Failure
4. RegCallBack
Allows the calling application to register a call-back procedure with the DLL. 
This call-back procedure will allow the DLL to notify the calling application 
when a command response is received from the TDR100. The call-back 
procedure will have parameters to report command type and success/failure. 
The procedure cannot be an object method. This method does not work with 
VB or VBA. See examples. 
int RegCallBack (int cmdType, int errCode))