/// <summary> /// Construcor /// </summary> /// <param name="extAddress">Extended address of locomotive</param> public GetLocomotiveInfo(HiLoAddress extAddress) : base(i18n.FlakeComunicationCommands.GetLocomotiveInfoName, i18n.FlakeComunicationCommands.GetLocomotiveInfoDesc) { _ByteArray = new byte[] { 255, 254, 227, 0, (byte)extAddress.Address_Hi, (byte)extAddress.Address_Lo }; CommunicationHelper.AddChecksumByteToArray(ref _ByteArray); _LogMsg = string.Format(i18n.FlakeComunicationCommandsLogMsgs.GetLocomotiveInfo, extAddress.Address.ToString()); }
/// <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> /// <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)); }
/// <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)); }