internal static LocalStatus ParseData(Reply reply)
        {
            var data = reply.ExtractReplyData.ToArray();

            if (data.Length < 2)
            {
                throw new Exception("Invalid size for the data");
            }

            var localStatus = new LocalStatus
            {
                Tamper       = Convert.ToBoolean(data[0]),
                PowerFailure = Convert.ToBoolean(data[1])
            };

            return(localStatus);
        }
Пример #2
0
        internal static LocalStatus ParseData(ReadOnlySpan <byte> data)
        {
            var dataArray = data.ToArray();

            if (dataArray.Length < 2)
            {
                throw new Exception("Invalid size for the data");
            }

            var localStatus = new LocalStatus
            {
                Tamper       = Convert.ToBoolean(dataArray[0]),
                PowerFailure = Convert.ToBoolean(dataArray[1])
            };

            return(localStatus);
        }