M2D-Laser-Scanner with Ethernet-Interface
Manual
HB-M2D-Ethernet-E
Page 38 of 39
www.MElsensor.com
I
I
P
P
-
-
P
P
r
r
o
o
g
g
r
r
a
a
m
m
m
m
i
i
n
n
g
g
f
f
o
o
r
r
U
U
D
D
P
P
-
-
t
t
r
r
a
a
n
n
s
s
m
m
i
i
s
s
s
s
i
i
o
o
n
n
p
p
r
r
o
o
t
t
o
o
c
c
o
o
l
l
:
:
chTemp[0] = 0x22; // command
chTemp[1] = 0x55; // command
chTemp[2] = 0xAA; // command
chTemp[3] = 0x55; // command
chTemp[4] = 0xAA; // command
chTemp[5] = 0x55; // command
chTemp[6] = 0x00;
chTemp[7] = 0x00;
chTemp[8] = 0x00;
chTemp[9] = 0x00;
chTemp[10] = 0x00;
//RechnerIP (IP of the PC)
chTemp[11] = atoi("192");
chTemp[12] = atoi("168");
chTemp[13] = atoi("123");
chTemp[14] = atoi("117");
//Gateway
chTemp[15] = atoi("192");
chTemp[16] = atoi("168");
chTemp[17] = atoi("123");
chTemp[18] = atoi("1");
//Subnetzmaske (subnet mask)
chTemp[19] = atoi("255");
chTemp[20] = atoi("255");
chTemp[21] = atoi("255");
chTemp[22] = atoi("0");
//ScannerIP (working IP)
chTemp[23] = atoi("192");
chTemp[24] = atoi("168");
chTemp[25] = atoi("123");
chTemp[26] = atoi("224");
//ScannerPort
chTemp[27] = atoi("3000") & 0x00FF;
chTemp[28] = (atoi("3000") & 0xFF00) >> 8;
//RechnerPort (port of the PC)
chTemp[29] = atoi("3000") & 0x00FF;
chTemp[30] = (atoi("3000") & 0xFF00) >> 8;
Note: the UDP transmission protocol has been implemented in a new project of the MEL
EthernetScanner demo software. Typical TCP functions have been dropped as for
example TCPClientThread (global)and EthTCPClientXReceivedData (global).
This function receives the raw data from the Scanner and checks if it is correct:
void EthUDPServerReceivedData(CWnd *theDlg, char *chBuffer, DWORD dwBuffer)
This function checks the protocol version and unpacks the data accordingly:
void CUDPScannerDlg::ScannerViewScan(unsigned char *ucBuffer, DWORD
dwBuffer, DWORD dwStatus, DWORD dwModus)
This function displays the profile:
void CUDPScannerDlg::ShowScannerXZI(DWORD *dwBufferX, DWORD *dwBufferZ,
DWORD *dwBufferI, DWORD dwBuffer, DWORD dwPosGeber, DWORD dwPosGeberRichtung,
DWORD dwProtokoll, DWORD dwLiniarisierung)
This function sends data to the scanner:
void CUDPScannerDlg::SendToScanner(CString strSend)
On the GUI, a double click takes you to the individual functions.
There you will find a description for the commands.
This function starts and stops the UDP server on the PC:
OnCheckEthudpscannerstart