Ejemplo n.º 1
0
        public void Test_BitFlagHelperTests_BitOn_byte()
        {
            byte value = 0;
            value =  BitFlagHelper.BitOn(value, 0);

            Assert.Equal(1, value);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Sets the appropriate bits in the GPSModeStore corresponding to the desired pass type
        /// </summary>
        /// <param name="value"></param>
        /// <param name="passType"></param>
        /// <returns></returns>
        public static byte SetPassType(byte value, PassType passType)
        {
            byte result = value;

            switch (passType)
            {
            case PassType.Front: // val 0
                result = BitFlagHelper.BitOff(result, (int)GPSFlagBits.GPSSBit6);
                result = BitFlagHelper.BitOff(result, (int)GPSFlagBits.GPSSBit7);
                break;

            case PassType.Rear: // val 1
                result = BitFlagHelper.BitOn(result, (int)GPSFlagBits.GPSSBit6);
                result = BitFlagHelper.BitOff(result, (int)GPSFlagBits.GPSSBit7);
                break;

            case PassType.Track: // val 2
                result = BitFlagHelper.BitOff(result, (int)GPSFlagBits.GPSSBit6);
                result = BitFlagHelper.BitOn(result, (int)GPSFlagBits.GPSSBit7);
                break;

            case PassType.Wheel: // val 3
                result = BitFlagHelper.BitOn(result, (int)GPSFlagBits.GPSSBit6);
                result = BitFlagHelper.BitOn(result, (int)GPSFlagBits.GPSSBit7);
                break;

            default:
                throw new ArgumentException($"Unknown pass type supplied to SetPassType {passType}", nameof(passType));
            }

            return(result);
        }
Ejemplo n.º 3
0
        public void Test_BitFlagHelperTests_BitOn_ushort()
        {
          ushort value = 0;
          value = BitFlagHelper.BitOn(value, 0);

          Assert.Equal(1, value);
        }