Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        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;
        }