public GeneralWriteCommand(byte[] data, ElementModel RefElement) { data1 = data; RefElements_A.Add(RefElement); InitializeCommandByElement(); GenerateCommand(); }
private void InitializeCommandByElement() { ElementModel element = RefElements_A.First(); addrTypeNum = 0x01; addrType1 = (byte)CommandHelper.GetAddrType((ElementAddressType)Enum.Parse(typeof(ElementAddressType), element.AddrType), element.StartAddr); if (element.ByteCount == 4 && !(element.AddrType == "CV" && element.StartAddr >= 200)) { length1 = 0x02; } else { length1 = 0x01; } byte[] startaddr = ValueConverter.GetBytes((ushort)element.StartAddr); startLowAddr1 = startaddr[1]; startHighAddr1 = startaddr[0]; }