public void makeTimeSyncMsg(ref __ST_TIME_SYNC stTimeSync, ref byte[] szMsg) { int nDstIndx; int nSrcLen; // need before progress Byte-Odering nDstIndx = 0; nSrcLen = sizeof(byte); Buffer.SetByte(szMsg, nDstIndx, (byte)stTimeSync.hxSTX); nDstIndx = nSrcLen; nSrcLen = stTimeSync.szInstruction.Length; Buffer.BlockCopy(stTimeSync.szInstruction, 0, szMsg, nDstIndx, nSrcLen); nDstIndx += nSrcLen; nSrcLen = stTimeSync.szTime.Length; Buffer.BlockCopy(stTimeSync.szTime, 0, szMsg, nDstIndx, nSrcLen); nDstIndx += nSrcLen; nSrcLen = sizeof(byte); Buffer.SetByte(szMsg, nDstIndx, (byte)stTimeSync.hxETX); //Console.WriteLine("{0}", Encoding.ASCII.GetString(szMsg)); //Buffer.BlockCopy(stTimeSync.hxSTX, 0, ) }
public void setTimeSync(ref __ST_TIME_SYNC stTimeSync, string strInstruction, string strTime) { stTimeSync.hxSTX = 0x02; stTimeSync.szInstruction = Encoding.ASCII.GetBytes(strInstruction); stTimeSync.szTime = Encoding.ASCII.GetBytes(strTime); stTimeSync.hxSTX = 0x03; }