public static Span <byte> serialize(uint rate) { var cmd = new BeginCommandDto() { Command = (byte)CommandCodeType.Begin, LowWaterMark = 0, // not used PointRate = rate }; Span <byte> bytes = MemoryMarshal.Cast <BeginCommandDto, byte>(MemoryMarshal.CreateSpan <BeginCommandDto>(ref cmd, 1)); return(bytes); }
public DacResponseDto Begin(ushort pointRate = 30000) { BeginCommandDto cmd = new BeginCommandDto() { Command = COMMAND_BEGIN, LowWaterMark = 0, //not implemented PointRate = pointRate }; var serialized = Serialize<BeginCommandDto>(cmd); var response = Transmit(serialized); var ack = DacResponse.ParseAckCode(response.Response); return response; }