SICK LMS511 sensor data acquisition interface (source code, C++/MFC)

This is data acquisition source code of LMS511(SICK co.)

Source code is made by MFC(vs 2008).
The sensor is communicated by TCP/IP.
You can set sensor ip and test running by  sopas program.
The sopas program is included in the manual CD.

This movie is running test video.

LMS511 communication sample code (tcp/ip)

reference here

Source code is here(github)


Thank you.


CString to char *

- CString to char*

1. memcpy
CString str = "test";
unsigned char st[30];
memcpy(st, (unsigned char*)(LPCTSTR)str,str.GetLength());

2. strcpy
CString strData = "test";
int length = strData.GetLength();
char* st = new char[length];
strcpy(st, strData.GetBuffer(0));

3. Type convert
CString str;
str = "test";
char* st = LPSTR(LPCTSTR(str));

- char* to CString
Using Format function in CString class
char st[] = "test";
CString str;
str.Format("%s", st);