/// <summary>
 /// Construcor
 /// </summary>
 /// <param name="extAddress">Adress of locomotive</param>
 /// <param name="mode">Startmode for central</param>
 public SetLFunctionRefreshMode(HiLoAddress extAddress, Base.Enums.LocoFunctionRefreshMode.LocoFunctionRefreshMode mode)
     : base(i18n.FlakeComunicationCommands.SetLFunctionRefreshModeName, i18n.FlakeComunicationCommands.SetLFunctionRefreshModeDesc)
 {
     _ByteArray = new byte[] { 255, 254, 228, 47, (byte)extAddress.Address_Hi, (byte)extAddress.Address_Lo, (byte)mode };
     CommunicationHelper.AddChecksumByteToArray(ref _ByteArray);
     _LogMsg = string.Format(i18n.FlakeComunicationCommandsLogMsgs.SetLFunctionRefreshMode, new Base.Enums.LocoFunctionRefreshMode.LocoFunctionRefreshModeExtended(mode).Name, extAddress.Address.ToString());
 }
 /// <summary>
 /// Construcor
 /// </summary>
 /// <param name="extAddress">Extended address of locomotive</param>
 public GetLocomotiveFunctionTypesLo(HiLoAddress extAddress)
     : base(i18n.FlakeComunicationCommands.GetLocomotiveFunctionTypesLoName, i18n.FlakeComunicationCommands.GetLocomotiveFunctionTypesLoDesc)
 {
     _ByteArray = new byte[] { 255, 254, 227, 7, (byte)extAddress.Address_Hi, (byte)extAddress.Address_Lo };
     CommunicationHelper.AddChecksumByteToArray(ref _ByteArray);
     _LogMsg = string.Format(i18n.FlakeComunicationCommandsLogMsgs.GetLocomotiveFunctionTypesLo, extAddress.Address.ToString());
 }
Exemplo n.º 3
0
 /// <summary>
 /// Construcor
 /// </summary>
 /// <param name="extAddress">Extended address of locomotive</param>
 /// <param name="speedValue">Speed of locomotive to be set</param>
 /// <param name="driveForward">use forward direction</param>
 /// <param name="speedSections">speed section setup of locomotive</param>
 public LocomotiveDrive(HiLoAddress extAddress, int speedValue, bool driveForward, Base.Enums.LocomotiveSpeedSections.LocomotiveSpeedSections speedSections)
     : base(i18n.FlakeComunicationCommands.DriveCommandName, i18n.FlakeComunicationCommands.DriveCommandDesc)
 {
     _ByteArray = new byte[] { 255, 254, 228, GetIdentifier(speedSections), (byte)extAddress.Address_Hi,
                               (byte)extAddress.Address_Lo, GetSpeedAndDirection(speedValue, driveForward, speedSections) };
     CommunicationHelper.AddChecksumByteToArray(ref _ByteArray);
     _LogMsg = string.Format(i18n.FlakeComunicationCommandsLogMsgs.DriveCommand, extAddress.Address.ToString(), speedValue.ToString(), (driveForward) ?
                             (new Base.Enums.LocomotiveDirection.LocomotiveDirectionExtended(Base.Enums.LocomotiveDirection.LocomotiveDirection.forward).Name) :
                             (new Base.Enums.LocomotiveDirection.LocomotiveDirectionExtended(Base.Enums.LocomotiveDirection.LocomotiveDirection.backward).Name));
 }
Exemplo n.º 4
0
        /// <summary>
        /// Construcor
        /// </summary>
        /// <param name="extAddress">Extended address of locomotive</param>
        /// <param name="functionNumber">function-number to switch</param>
        /// <param name="setFunction">set (1) or unset (0) the function</param>
        /// <param name="currentFunctions">current function state dictionary</param>
        public SetLocomotiveFunction(HiLoAddress extAddress, int functionNumber, bool setFunction, Dictionary <int, FlakeTrain.FlakeController.Locomotive.LocomotiveFunction> currentFunctions)
            : base(i18n.FlakeComunicationCommands.SetLocomotiveFunctionName, i18n.FlakeComunicationCommands.SetLocomotiveFunctionDesc)
        {
            _Functions = new Dictionary <int, bool>();
            foreach (var f in currentFunctions)
            {
                if (!_Functions.Keys.Contains(f.Key))
                {
                    _Functions.Add(f.Key, f.Value.Active);
                }
            }
            if (_Functions.Keys.Contains(functionNumber))
            {
                _Functions[functionNumber] = setFunction;
            }

            byte identifier;
            byte data3byte = GetData3Byte(functionNumber, out identifier);

            _ByteArray = new byte[] { 255, 254, 228, identifier, (byte)extAddress.Address_Hi, (byte)extAddress.Address_Lo, data3byte };
            CommunicationHelper.AddChecksumByteToArray(ref _ByteArray);
            _LogMsg = string.Format(i18n.FlakeComunicationCommandsLogMsgs.SetLocomotiveFunction, functionNumber.ToString(), extAddress.Address.ToString(), (setFunction) ? (i18n.FlakeComunicationBase.set) : (i18n.FlakeComunicationBase.unset));
        }