Example #1
0
        public void FromUInt64_TimestampedValue_PayloadHasValue()
        {
            ulong value     = int.MaxValue * 2u;
            var   timestamp = GetTimestamp();
            var   message   = HarpMessage.FromUInt64(DefaultAddress, timestamp, MessageType.Write, value);

            AssertIsValid(message);
            var(payload, actualTimestamp) = message.GetTimestampedPayloadUInt64();
            AssertTimestamp(timestamp, actualTimestamp);
            Assert.AreEqual(value, payload);
        }
Example #2
0
        public void FromUInt64_TimestampedArray_PayloadHasValue()
        {
            var value     = new ulong[] { int.MaxValue * 2u, 123456789 };
            var timestamp = GetTimestamp();
            var message   = HarpMessage.FromUInt64(DefaultAddress, timestamp, MessageType.Write, value);

            AssertIsValid(message);
            var(payload, actualTimestamp) = message.GetTimestampedPayloadArray <ulong>();
            AssertTimestamp(timestamp, actualTimestamp);
            AssertArrayEqual(value, payload);
            Assert.AreEqual(value[1], message.GetTimestampedPayloadUInt64(1).Value);
        }
Example #3
0
 /// <summary>
 /// Returns a <see cref="HarpMessage"/> write command with the specified address, and a
 /// single value 64-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 WriteUInt64(int address, ulong value)
 {
     return(HarpMessage.FromUInt64(address, MessageType.Write, value));
 }
Example #4
0
 /// <summary>
 /// Returns a <see cref="HarpMessage"/> write command with the specified address, and an
 /// array payload of 64-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 WriteUInt64(int address, params ulong[] values)
 {
     return(HarpMessage.FromUInt64(address, MessageType.Write, values));
 }
Example #5
0
 /// <summary>
 /// Returns a <see cref="HarpMessage"/> read command for a 64-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 64-bit unsigned integer
 /// register with the specified address.
 /// </returns>
 public static HarpMessage ReadUInt64(int address)
 {
     return(HarpMessage.FromUInt64(address, MessageType.Read));
 }