A graphics company requires that the byte count of a string I need to be build be included in the message sent to it. I am building the message like this..
The four chars after the STX needs to represent the total byte count.
In documentation, they show this as ...
BC (Byte Count): Packet total size including Start Code and End Code
Transmit in DWORD (4byte) type
Ex) Packet size = 0x00001234
0x00
0x00
0x12
0x34
I am building this all as a string and using the following to convert to bytes..
SendMsg is my string that I build...
Appreciate any help any one can provide.
Code:
string StartBytes = "" + (char)STX + (char)0x00 + (char)0x00 + (char)0x00 + (char)TotalByteCount + (char)Command; string EndBytes = "" + (char)0x00 + (char)0x00 + (char)0x00 + (char)TotalByteCount + (char)ETX; string SendMsg = StartBytes.Trim() + ObjectList.Trim() + EndBytes.Trim();
In documentation, they show this as ...
BC (Byte Count): Packet total size including Start Code and End Code
Transmit in DWORD (4byte) type
Ex) Packet size = 0x00001234
0x00
0x00
0x12
0x34
I am building this all as a string and using the following to convert to bytes..
Code:
byte[] bytesSendMsg = new byte[SendMsg.Length]; bytesSendMsg = ASCIIEncoding.ASCII.GetBytes(SendMsg);
Appreciate any help any one can provide.
Comment