public void FromInt64_TimestampedValue_PayloadHasValue() { long value = -int.MaxValue * 2u; var timestamp = GetTimestamp(); var message = HarpMessage.FromInt64(DefaultAddress, timestamp, MessageType.Write, value); AssertIsValid(message); var(payload, actualTimestamp) = message.GetTimestampedPayloadInt64(); AssertTimestamp(timestamp, actualTimestamp); Assert.AreEqual(value, payload); }
public void FromInt64_TimestampedArray_PayloadHasValue() { var value = new long[] { int.MaxValue * -2u, 123456789 }; var timestamp = GetTimestamp(); var message = HarpMessage.FromInt64(DefaultAddress, timestamp, MessageType.Write, value); AssertIsValid(message); var(payload, actualTimestamp) = message.GetTimestampedPayloadArray <long>(); AssertTimestamp(timestamp, actualTimestamp); AssertArrayEqual(value, payload); Assert.AreEqual(value[1], message.GetTimestampedPayloadInt64(1).Value); }
/// <summary> /// Returns a <see cref="HarpMessage"/> write command with the specified address, and a /// single value 64-bit signed 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 WriteInt64(int address, long value) { return(HarpMessage.FromInt64(address, MessageType.Write, value)); }
/// <summary> /// Returns a <see cref="HarpMessage"/> write command with the specified address, and an /// array payload of 64-bit signed 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 WriteInt64(int address, params long[] values) { return(HarpMessage.FromInt64(address, MessageType.Write, values)); }
/// <summary> /// Returns a <see cref="HarpMessage"/> read command for a 64-bit signed 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 64-bit signed integer /// register with the specified address. /// </returns> public static HarpMessage ReadInt64(int address) { return(HarpMessage.FromInt64(address, MessageType.Read)); }