public void FromUInt32_TimestampedValue_PayloadHasValue() { uint value = 123456789; var timestamp = GetTimestamp(); var message = HarpMessage.FromUInt32(DefaultAddress, timestamp, MessageType.Write, value); AssertIsValid(message); var(payload, actualTimestamp) = message.GetTimestampedPayloadUInt32(); AssertTimestamp(timestamp, actualTimestamp); Assert.AreEqual(value, payload); }
public void FromUInt32_TimestampedArray_PayloadHasValue() { var value = new uint[] { uint.MaxValue / 2, 123456789 }; var timestamp = GetTimestamp(); var message = HarpMessage.FromUInt32(DefaultAddress, timestamp, MessageType.Write, value); AssertIsValid(message); var(payload, actualTimestamp) = message.GetTimestampedPayloadArray <uint>(); AssertTimestamp(timestamp, actualTimestamp); AssertArrayEqual(value, payload); Assert.AreEqual(value[1], message.GetTimestampedPayloadUInt32(1).Value); }
/// <summary> /// Returns a <see cref="HarpMessage"/> write command with the specified address, and a /// single value 32-bit unsigned integer payload. /// </summary> /// <param name="address">The address of the register to which the Harp message refers to.</param> /// <param name="value">The value to be stored in the payload.</param> /// <returns> /// A valid <see cref="HarpMessage"/> write command with the specified address and payload. /// </returns> public static HarpMessage WriteUInt32(int address, uint value) { return(HarpMessage.FromUInt32(address, MessageType.Write, value)); }
/// <summary> /// Returns a <see cref="HarpMessage"/> write command with the specified address, and an /// array payload of 32-bit unsigned integers. /// </summary> /// <param name="address">The address of the register to which the Harp message refers to.</param> /// <param name="values">The values to be stored in the payload.</param> /// <returns> /// A valid <see cref="HarpMessage"/> write command with the specified address and payload. /// </returns> public static HarpMessage WriteUInt32(int address, params uint[] values) { return(HarpMessage.FromUInt32(address, MessageType.Write, values)); }
/// <summary> /// Returns a <see cref="HarpMessage"/> read command for a 32-bit unsigned integer /// register with the specified address. /// </summary> /// <param name="address">The address of the register to read.</param> /// <returns> /// A valid <see cref="HarpMessage"/> read command for a 32-bit unsigned integer /// register with the specified address. /// </returns> public static HarpMessage ReadUInt32(int address) { return(HarpMessage.FromUInt32(address, MessageType.Read)); }