T3SP-D4MX Operator’s Manual
3.2 Programming Examples
3.2.1 C/C
++
-Code
The T3SP-D4MX control library
cDMXU.dll
is written in C
++
. All function
declarations / signatures can be found in the corresponding header file:
All functions return a positive value on success and
-1
on error. For more
detailed information on the individual functions, please refer to the C source
code below:
int
cDMXU_Init(
char
* id);
int
cDMXU_IsInitialized(
void
);
int
cDMXU_SetChannel(
int
channel);
int
cDMXU_GetChannel(
void
);
int
cDMXU_GetSerialNumber(
void
);
int
cDMXU_GetNumberOfChannels(
void
);
int
cDMXU_Release(
void
);
The following is a simple main program that calls all functions as an example:
// make sure cDMXU.lib is added to linker dependencies
#include
<stdio.h>
// include header file
#include
"cDMXU.h"
// include T3SP-D4MX header
// macro for checking on errors
#define
CHK_ERROR(e,m) {
if
(e<0) {printf(m);
return
e; } }
int
main(
void
)
{
int
no_of_channels = -1;
// number of channels of multiplexer
int
channel = -1;
// channel variable
int
serno = -1;
// serial number (50001 --> 05.0001)
// initialize library (id string not required yet)
if
(cDMXU_Init(NULL) != 0)
CHK_ERROR(-1, "Initialization failed");
10
933407 Rev1