SafeDispatch/LibrarySDR/Flags/ReportFlag.cs
2024-02-22 18:43:59 +02:00

34 lines
904 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static LibrarySDR.Helpers.BinaryHexHelper;
namespace LibrarySDR.Flags
{
public class ReportFlag
{
private bool isAcknowledgmentRequired;
public bool IsAcknowledgmentRequired { get { return isAcknowledgmentRequired; } }
private bool isStorageAllowed;
public bool IsStorageAllowed { get { return isStorageAllowed; } }
public ReportFlag(int flags)
{
int i = 0;
// first bit is 7 , and the last one is 0
String binary = GetBits(flags, 8);
Boolean.TryParse(binary.Substring(i++, 1), out isAcknowledgmentRequired);
// bit 6 and 5 are reserved
i++; i++;
Boolean.TryParse(binary.Substring(i++, 1), out isStorageAllowed);
}
}
}