示例#1
0
		public OperationResult<bool> ConrtolGKBase(Guid uid, GKStateBit command, bool isPim)
		{
			DescriptorViewModel descriptor;
			if (isPim)
				descriptor = MainViewModel.Current.Descriptors.FirstOrDefault(x => (x.GKBase is GKPim) && (x.GKBase as GKPim).DeviceUid == uid);
			else
				descriptor = MainViewModel.Current.Descriptors.FirstOrDefault(x => x.GKBase.UID == uid);
			if (descriptor == null)
				return OperationResult<bool>.FromError("Не найден элемент " + uid + " в конфигурации");
			if (!ValidateCommand(descriptor, command))
				return OperationResult<bool>.FromError("Команда " + command.ToDescription() + " для типа " + descriptor.GKBase.GetType() + " запрещена");
			switch (command)
			{
				case GKStateBit.Fire1:
					descriptor.SetFire1Command.Execute();
					break;
				case GKStateBit.Fire2:
					descriptor.SetFire2Command.Execute();
					break;
				case GKStateBit.Reset:
					descriptor.ResetFireCommand.Execute();
					break;
				case GKStateBit.TurnOn_InAutomatic:
					descriptor.TurnOnCommand.Execute();
					break;
				case GKStateBit.TurnOnNow_InAutomatic:
					descriptor.TurnOnNowCommand.Execute();
					break;
				case GKStateBit.TurnOff_InAutomatic:
					descriptor.TurnOffCommand.Execute();
					break;
				case GKStateBit.TurnOffNow_InAutomatic:
					descriptor.TurnOffNowCommand.Execute();
					break;
				case GKStateBit.SetRegime_Manual:
					descriptor.TurnOffCommand.Execute();
					break;
				case GKStateBit.TurnOn_InManual:
					descriptor.TurnOffCommand.Execute();
					break;
				case GKStateBit.TurnOnNow_InManual:
					descriptor.TurnOffCommand.Execute();
					break;
				case GKStateBit.TurnOff_InManual:
					descriptor.TurnOffCommand.Execute();
					break;
				case GKStateBit.TurnOffNow_InManual:
					descriptor.TurnOffCommand.Execute();
					break;
				default:
					return OperationResult<bool>.FromError("Команда " + command.ToDescription() + " ещё не реализована");
			}
			return new OperationResult<bool>(true);
		}
示例#2
0
		public static string ClauseToString(ClauseOperationType clauseOperationType, GKStateBit stateBit)
		{
			switch (clauseOperationType)
			{
				case ClauseOperationType.AllZones:
				case ClauseOperationType.AnyZone:
					switch (stateBit)
					{
						case GKStateBit.Fire1:
							return "Пожар 1";

						case GKStateBit.Fire2:
							return "Пожар 2";

						case GKStateBit.Attention:
							return "Внимание";
					}
					break;

				case ClauseOperationType.AllGuardZones:
				case ClauseOperationType.AnyGuardZone:
					switch (stateBit)
					{
						case GKStateBit.On:
							return "На охране";

						case GKStateBit.Off:
							return "Не на охране";

						case GKStateBit.Fire1:
							return "Тревога";
					}
					break;

				case ClauseOperationType.AllDoors:
				case ClauseOperationType.AnyDoor:
					switch (stateBit)
					{
						case GKStateBit.Fire1:
							return "Тревога";
					}
					break;
			}

			return stateBit.ToDescription();
		}
示例#3
0
		public static void GKExecuteDeviceCommand(GKDevice device, GKStateBit stateBit, string userName)
		{
			Watcher.SendControlCommand(device, stateBit, stateBit.ToDescription());
			AddGKMessage(JournalEventNameType.Команда_оператора, JournalEventDescriptionType.NULL, stateBit.ToDescription(), device, userName);
		}