Пример #1
0
        /// <summary>
        /// Update the status to reflect the correct decoder type and
        /// speed steps.
        /// </summary>
        private static SlotStatus1 UpdateDecoderType(SlotStatus1 status, ILocState loc)
        {
            var addressType = loc.Address.Type;

            status = status & ~SlotStatus1.DecoderTypeMask;
            // Motorola?
            if (addressType == AddressType.Motorola)
            {
                return(status | SlotStatus1.DecoderType28Tri);
            }

            // DCC
            switch (loc.SpeedSteps)
            {
            case 14:
                return(status | SlotStatus1.DecoderType14);

            case 28:
                return(status | SlotStatus1.DecoderType28);

            default:
                return(status | SlotStatus1.DecoderType128);
            }
        }
Пример #2
0
 /// <summary>
 /// Are the given bits all set in the given value.
 /// </summary>
 public static bool IsSet(this SlotStatus1 value, SlotStatus1 bits)
 {
     return((value & bits) == bits);
 }
Пример #3
0
 /// <summary>
 /// Are the given bits all set in the given value.
 /// </summary>
 public static bool IsSet(this SlotStatus1 value, SlotStatus1 bits)
 {
     return ((value & bits) == bits);
 }
Пример #4
0
 /// <summary>
 /// Default ctor
 /// </summary>
 public SlotStat1Request(int slot, SlotStatus1 stat1)
 {
     Slot   = slot;
     Status = stat1;
 }