Esempio n. 1
0
        public static void Run(Device device, bool isUsb, DevicePasswordType devicePasswordType, string password)
        {
			_device = device;
            _isUsb = isUsb;
            _devicePasswordType = devicePasswordType;
            _password = password;

			ServiceFactory.ProgressService.Run(OnPropgress, OnCompleted, device.PresentationAddressAndName + ". Установка пароля");
        }
Esempio n. 2
0
        public static void Run(Guid deviceUID, bool isUsb, DevicePasswordType devicePasswordType, string password)
        {
            _deviceUID = deviceUID;
            _isUsb = isUsb;
            _devicePasswordType = devicePasswordType;
            _password = password;

            var device = FiresecManager.Devices.FirstOrDefault(x => x.UID == _deviceUID);
            ServiceFactory.ProgressService.Run(OnPropgress, OnCompleted, device.PresentationAddressAndDriver + ". Установка пароля");
        }
		static int GetPasswordTypeNo(DevicePasswordType devicePasswordType)
		{
			switch(devicePasswordType)
			{
				case DevicePasswordType.Administrator:
					return 0x0A;
				case DevicePasswordType.Installator:
					return 0x07;
				case DevicePasswordType.Operator:
					return 0x04;
			}
			return 0;
		}
		public static void SetPassword(Device device, DevicePasswordType devicePasswordType, string password)
		{
			if (password == null)
				password = "";
			for (int i = password.Length; i < 6; i++)
			{
				password += 'F';
			}
			password = password.Insert(2, " ");
			password = password.Insert(5, " ");
			var bytes = password.Split().Select(t => byte.Parse(t, NumberStyles.AllowHexSpecifier)).ToList();

			var passwordTypeNo = GetPasswordTypeNo(devicePasswordType);
			USBManager.Send(device, "Запись пароля", 0x02, 0x52, BytesHelper.IntToBytes(passwordTypeNo), 0x02, bytes);
		}
		public OperationResult<bool> DeviceSetPassword(DeviceConfiguration deviceConfiguration, Guid deviceUID, DevicePasswordType devicePasswordType, string password)
		{
			var firesecConfiguration = ConvertBack(deviceConfiguration, false);
			var device = deviceConfiguration.Devices.FirstOrDefault(x => x.UID == deviceUID);
			return FiresecSerializedClient.DeviceSetPassword(firesecConfiguration, device.GetPlaceInTree(), password, (int)devicePasswordType);
		}
Esempio n. 6
0
 public static OperationResult<bool> SetPassword(Guid deviceUID, bool isUsb, DevicePasswordType devicePasswordType, string password)
 {
     return FiresecService.DeviceSetPassword(FiresecConfiguration.DeviceConfiguration.CopyOneBranch(deviceUID, isUsb), deviceUID, devicePasswordType, password);
 }
		public OperationResult DeviceSetPassword(Guid deviceUID, bool isUSB, DevicePasswordType devicePasswordType, string password, string userName)
		{
			return SafeOperationCall(() => { return FS2Contract.DeviceSetPassword(deviceUID, isUSB, devicePasswordType, password, userName); }, "DeviceSetPassword");
		}
 public OperationResult<bool> DeviceSetPassword(DeviceConfiguration deviceConfiguration, Guid deviceUID, DevicePasswordType devicePasswordType, string password)
 {
     return SafeOperationCall(() => { return FiresecService.DeviceSetPassword(deviceConfiguration, deviceUID, devicePasswordType, password); });
 }