Exemple #1
0
        /// <summary>
        /// Send the speed and direction of the given loc towards the railway.
        /// </summary>
        protected override void OnSendLocSpeedAndDirection(ILocState loc)
        {
            Log.Trace("OnSendLocSpeedAndDirection: {0}", loc);
            var direction = (loc.Direction.Requested == LocDirection.Forward);
            var packet    = Packets.CreateSpeedAndDirection(loc.Address.ValueAsInt, (byte)loc.SpeedInSteps.Requested, direction, loc.SpeedSteps);
            var data      = PacketTranslater.Translate(packet);

            sender.SendSpeedAndDirection(loc.Address.ValueAsInt, data);
            loc.Direction.Actual = loc.Direction.Requested;
            loc.Speed.Actual     = loc.Speed.Requested;
        }