TMS International BV |
Getting started
The driver package provides support for a large variety of
TMSi data acquisition
devices. To simplify application development all communication with the
devices
is performed through a single Dynamic Link Library (DLL) that exports a
limited
number of functions.
In the directory ExampleCode on de Driver CD, you will find example
code written in C, and the
TMSiSDK.h include file with the prototypes of the functions.
The frontends can be connected to the PC using an WLAN, Bluetooth or
USB connection.
All communication with the frontends is performed through a single DLL. This DLLis named 'TMSiSDK.DLL' and is automatically installed in the Windows system directory during driver installation. This library exports functions for controlling the front ends. The functions use the Microsoft __stdcall calling convention, and have a "C" declaration, so they can be called from a C program.
Because the location
of
the Windows System directory may vary from system to system it is best
to use the
WIN32 API GetSystemDirectory
to locate this library. A handle to the TMSiSDK.DLL can now be opened
and
the
pointers to these functions loaded using the GetProcAddress
function. The
following example shows how a pointer to an exported function can be
obtained.
Excerpt from the example code:
typedef BOOL ( __stdcall * PCLOSE )(HANDLE hHandle); // Prototype from TMSiSDK.h
TCHAR Path[ MAX_PATH ];
GetSystemDirectory(Path, sizeof(Path) / sizeof(TCHAR) );
lstrcat(Path, "\\TMSiSDK.dll");
HINSTANCE LibHandle = LoadLibrary( Path );
PCLOSE Close = (PCLOSE) GetProcAddress( LibHandle , "Close" );
Refer to your Microsoft Windows Platform SDK for more information about
using dynamic
link
libraries and runtime linking. For a complete list of all available
functions
see the functions part of the
SDK documentation.
In case loading any function exported by the DLL fails, use the
WIN32
function GetLastError
for more information.
The TMSiSDK.dll is not thread-safe. When using threads in your
application, you must take care that functions are not called
concurrently.
The example code demonstrates how several common tasks are done, like
getting
information about the serial number and name of the connected frontend,
the channel layout and properties, setting the RTC clock etc.