ToBuffer() public static method

public static ToBuffer ( long reading ) : byte[]
reading long
return byte[]
Example #1
0
        public void ToBuffer_upper_neg_int()
        {
            int n     = Int16.MinValue - 1;
            var bytes = TelemetryBuffer.ToBuffer(n);

            Assert.Equal(new byte[] { 0xfc, 0xff, 0x7f, 0xff, 0xff, 0x0, 0x0, 0x0, 0x0 }, bytes);
        }
Example #2
0
        public void ToBuffer_lower_neg_short()
        {
            var bytes = TelemetryBuffer.ToBuffer(Int16.MinValue);

            Assert.Equal(new byte[] { 0xfe, 0x0, 0x80, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 }, bytes);
        }
Example #3
0
        public void ToBuffer_upper_neg_short()
        {
            var bytes = TelemetryBuffer.ToBuffer(-1);

            Assert.Equal(new byte[] { 0xfe, 0xff, 0xff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 }, bytes);
        }
Example #4
0
        public void ToBuffer_Zero()
        {
            var bytes = TelemetryBuffer.ToBuffer(0);

            Assert.Equal(new byte[] { 0xfe, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 }, bytes);
        }
Example #5
0
        public void ToBuffer_upper_long()
        {
            var bytes = TelemetryBuffer.ToBuffer(Int64.MaxValue);

            Assert.Equal(new byte[] { 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f }, bytes);
        }
Example #6
0
        public void ToBuffer_upper_short()
        {
            var bytes = TelemetryBuffer.ToBuffer(Int16.MaxValue);

            Assert.Equal(new byte[] { 0xfe, 0xff, 0x7f, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 }, bytes);
        }
Example #7
0
        public void ToBuffer_lower_ushort()
        {
            var bytes = TelemetryBuffer.ToBuffer((long)Int16.MaxValue + 1);

            Assert.Equal(new byte[] { 0x2, 0x0, 0x80, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 }, bytes);
        }
Example #8
0
        public void ToBuffer_lower_int()
        {
            var bytes = TelemetryBuffer.ToBuffer((long)UInt16.MaxValue + 1);

            Assert.Equal(new byte[] { 0xfc, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0 }, bytes);
        }
Example #9
0
        public void ToBuffer_upper_uint()
        {
            var bytes = TelemetryBuffer.ToBuffer(UInt32.MaxValue);

            Assert.Equal(new byte[] { 0x4, 0xff, 0xff, 0xff, 0xff, 0x0, 0x0, 0x0, 0x0 }, bytes);
        }
Example #10
0
        public void ToBuffer_lower_neg_long()
        {
            var bytes = TelemetryBuffer.ToBuffer(Int64.MinValue);

            Assert.Equal(new byte[] { 0xf8, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x80 }, bytes);
        }
Example #11
0
        public void ToBuffer_upper_neg_long()
        {
            var bytes = TelemetryBuffer.ToBuffer((long)Int32.MinValue - 1);

            Assert.Equal(new byte[] { 0xf8, 0xff, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0xff }, bytes);
        }