private void EndMessageMake(Fields.ServiceDataType curMess) { ServiceData.CRC16 = getCRC(dataBuff, dataBuff[5]); }
private void HeadMessageMake(Fields.ServiceDataType curMess) { Array.Clear(dataBuff, 0, dataBuff.Length); UInt32 sn = curMess.serialNumber; // серийный номер dataBuff[3] = (byte)(sn % 10); sn = sn / 10; dataBuff[3] = (byte)(dataBuff[3] + ((sn % 10) << 4)); sn = sn / 10; dataBuff[2] = (byte)(sn % 10); sn = sn / 10; dataBuff[2] = (byte)(dataBuff[2] + ((sn % 10) << 4)); sn = sn / 10; dataBuff[1] = (byte)(sn % 10); sn = sn / 10; dataBuff[1] = (byte)(dataBuff[1] + ((sn % 10) << 4)); sn = sn / 10; dataBuff[0] = (byte)(sn % 10); sn = sn / 10; dataBuff[0] = (byte)(dataBuff[0] + ((sn % 10) << 4)); // dataBuff[4] = curMess.functionCode; dataBuff[5] = curMess.length; }