66
IND100077-124
C# / Pseudo Ethernet/TCP Code example
{
// Create SCOM package
byte
[] cmd = enc.GetBytes(
"BRT"
);
byte
[] data =
new byte
[1] { 0x99 };
// 60% brightness
COMMessage
message =
new
COMMessage
(cmd, data);
// Transmitting SCOM package to TCP
SendTCPCommand(message);
}
private
Byte
[] SendTCPCommand(
COMMessage
commessage)
{
// Creating new TCPclient
TcpClient
tcpClient =
new
TcpClient
();
// Byte version of the SCOM package
byte
[] byteMessage = (
byte
[])commessage.Message.ToArray(
typeof
(
byte
));
//Display IP adresse
IPAddress
displayAddr =
IPAddress
.Parse(DisplayIPAddress);
Int32
port = 10001;
//constant
//Connecting
tcpClient.Connect(displayAddr,
port);
// Create a stream from TCPClient
NetworkStream
stream = tcpClient.GetStream();
//Write the SCOM package into stream
stream.Write(byteMessage,
0,
byteMessage.Length);
// Wait for response
Thread
.Sleep(GlobalWaitTime);
// Read Response
// To be compliant with SCOM package (ATTN, ADDR, CMD, CMD, CMD, LEN, IHCHK, DATA, IDCHK)
stream.Read(data,
0,
data.Length);
}
Содержание HATTELAND TECHNOLOGY X MMD G2 Series
Страница 56: ...56 This page left intentionally blank...
Страница 57: ...57 Appendixes...
Страница 68: ...Hatteland Technology AS www hattelandtechnology com Enterprise no NO974533146...