Exemplo n.º 1
0
        public void FromSByte_TimestampedValue_PayloadHasValue()
        {
            sbyte value     = -3;
            var   timestamp = GetTimestamp();
            var   message   = HarpMessage.FromSByte(DefaultAddress, timestamp, MessageType.Write, value);

            AssertIsValid(message);
            var(payload, actualTimestamp) = message.GetTimestampedPayloadSByte();
            AssertTimestamp(timestamp, actualTimestamp);
            Assert.AreEqual(value, payload);
        }
Exemplo n.º 2
0
        public void FromSByte_TimestampedArray_PayloadHasValue()
        {
            var value     = new sbyte[] { 4, -23 };
            var timestamp = GetTimestamp();
            var message   = HarpMessage.FromSByte(DefaultAddress, timestamp, MessageType.Write, value);

            AssertIsValid(message);
            var(payload, actualTimestamp) = message.GetTimestampedPayloadArray <sbyte>();
            AssertTimestamp(timestamp, actualTimestamp);
            AssertArrayEqual(value, payload);
            Assert.AreEqual(value[1], message.GetTimestampedPayloadSByte(1).Value);
        }
Exemplo n.º 3
0
 /// <summary>
 /// Returns a <see cref="HarpMessage"/> write command with the specified address, and an
 /// array payload of 8-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 WriteSByte(int address, params sbyte[] values)
 {
     return(HarpMessage.FromSByte(address, MessageType.Write, values));
 }
Exemplo n.º 4
0
 /// <summary>
 /// Returns a <see cref="HarpMessage"/> read command for an 8-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 an 8-bit signed integer
 /// register with the specified address.
 /// </returns>
 public static HarpMessage ReadSByte(int address)
 {
     return(HarpMessage.FromSByte(address, MessageType.Read));
 }
Exemplo n.º 5
0
 /// <summary>
 /// Returns a <see cref="HarpMessage"/> write command with the specified address, and a
 /// single value 8-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 WriteSByte(int address, sbyte value)
 {
     return(HarpMessage.FromSByte(address, MessageType.Write, value));
 }