User`s guide
APDCAM User’s Guide
Page 29/32
SendTS
Declaration:
CAMCONTROL_API int SendTS(int *pStreams);
Description:
This call enables stream data input from APDCAM to the PC but does not provide the
data storage. It should be noted that APDCAM sends data in four separate streams each
transmitting data from 8 channels. (Provided they are enabled for transfer.) The input
parameter to this function is a 4-element int array specifying the length of the UDP data-
gram measurement data field in the 4 streams:
int streams[4];
streams[0] = 1440
streams[1] = 1440
streams[2] = 1440
streams[3] = 1440
The datagram measurement data length is not an important parameter. Smaller packets
use higher overhead and need more frequent handling in the network software. 1440 is
the maximum size, in most cases it will be used.
To set up data transfer the following procedure should be followed for all 4 streams
separately. First the necessary memory should be allocated. For this purpose a special
memory allocation is desirable which prevents the allocated memory from paged to vir-
tual memory. If virtual memory is used the data transfer might be blocked when memory
is paged and this might result in data loss. A code example for memory allocation is:
// request a 64 MByte
#define MEMORY_REQUESTED 0x04000000
try
{
CNonPagedMem memoryManager(MEMORY_REQUESTED);
PVOID lpMemReserved0 = memoryManager.GetMem();
}
catch (CNPMemoryException *pEx)
{
delete pEx;
}
The address of the allocated memory is returned in the lpMemReserved0 variable. It is
important, that this type of memory allocation should be enabled for the user which will
run the data acquisition program. This can be done by opening “Local Security Policy” in
the XP Control Panel (in Administrative Tools under Windows 7). In the “Local Policies
-> User Rights Assignments” panel click “Lock pages in memory” with the right mouse
button and select “Properties” from the menu. Add the user to the list who is going to run
the data acquisition program and reboot the computer.
As described above data is transferred from APDCAM in UDP datagrams. Besides the
measurement data their data fields also contain a header for each datagram and a header
for the whole data transmission. Memory should be allocated for all of these elements,
see Section 3.6.1 for a detailed description of the memory map.
For receiving data in to the allocated buffers the CCamServer class should be used. An
example code is the following:
CCamServer TS0_Server;