| | |
| | | using System.Collections.Generic; |
| | | using System.Runtime.CompilerServices; |
| | | using System.Runtime.InteropServices; |
| | | using Shared.Common; |
| | | using ZigBee.Device; |
| | | |
| | | namespace Shared.Phone.UserCenter.DoorLock |
| | |
| | | public class DoorLockCommonInfo : CommonDevice |
| | | { |
| | | #region 本地变量 |
| | | /// <summary> |
| | | /// 是否常开模式[当数据获取失败,返回空] |
| | | /// </summary> |
| | | public static bool? IsDoorLockNormallyMode = new bool?(); |
| | | /// <summary> |
| | | /// 常开模式时间 |
| | | /// </summary> |
| | | public static int NormallyOpenModeInvalidTime = 12; |
| | | /// <summary> |
| | | /// 是否支持修改 |
| | | /// </summary> |
| | |
| | | public static int InValidDateSecond = 0; |
| | | #endregion |
| | | |
| | | /// <summary> |
| | | /// 获取当前门锁的常开模式 |
| | | /// </summary> |
| | | /// <param name="doorLock:当前门锁"></param> |
| | | /// <returns></returns> |
| | | public static async System.Threading.Tasks.Task<bool?> GetNormallyOpenMode(ZigBee.Device.DoorLock doorLock) |
| | | { |
| | | var result = await doorLock.ReadNormallyOpenModeFuncAsync(); |
| | | //共通错误检测 |
| | | string error = HdlCheckLogic.Current.CheckCommonErrorCode(result); |
| | | |
| | | if (result == null || result.errorMessageBase != null || result.errorResponData != null) |
| | | { |
| | | IsDoorLockNormallyMode = null; |
| | | } |
| | | |
| | | if (result.command == "10") |
| | | { |
| | | IsDoorLockNormallyMode = true; |
| | | } |
| | | if (result.command == "11") |
| | | { |
| | | IsDoorLockNormallyMode = false; |
| | | } |
| | | |
| | | return IsDoorLockNormallyMode; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 门锁是否支持常开[这里暂时只有S-One门锁支持,H06C不支持, 后期通过能力值支持] |
| | | /// </summary> |
| | | /// <param name="doorLock:当前门锁"></param> |
| | | /// <returns></returns> |
| | | public static bool CanNormallyOpen(ZigBee.Device.DoorLock doorLock) |
| | | { |
| | | var listDevice = new List<CommonDevice> { }; |
| | | listDevice.Add(doorLock); |
| | | var devTemp = Common.LocalDevice.Current.GetMyDeviceEnumInfo(listDevice); |
| | | if (devTemp.ConcreteType == DeviceConcreteType.IntelligentLocks_Sone) |
| | | { |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 门锁是否支持音量[这里暂时只有S-One门锁支持,H06C不支持,后期通过能力值支持] |
| | | /// </summary> |
| | | /// <param name="doorLock:当前门锁"></param> |
| | | /// <returns></returns> |
| | | public static bool CanVolume(ZigBee.Device.DoorLock doorLock) |
| | | { |
| | | var listDevice = new List<CommonDevice> { }; |
| | | listDevice.Add(doorLock); |
| | | var devTemp = Common.LocalDevice.Current.GetMyDeviceEnumInfo(listDevice); |
| | | if (devTemp.ConcreteType == DeviceConcreteType.IntelligentLocks_Sone) |
| | | { |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | #region 从云端获取的方法 |
| | | /// <summary> |
| | | /// 获取当前账户门锁操作权限(是否被冻结) |
| | | /// </summary> |
| | |
| | | } |
| | | |
| | | var getDoorLockInfoList = await ZigBee.Device.DoorLock.GetDoorLockInfoFromServer("DoorLock/GetDoorLockPager", localDoorLockObj); |
| | | |
| | | if (getDoorLockInfoList == null) |
| | | { |
| | | getDoorLockInfoAllList = null; |
| | | } |
| | | else |
| | | { |
| | | if (getDoorLockInfoList != null) |
| | | { |
| | | if (getDoorLockInfoList.PageData.Count != 0) |
| | |
| | | if (getDoorLockInfoListTemp != null) |
| | | { |
| | | getDoorLockInfoAllList.Add(getDoorLockInfoListTemp); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | /// </summary>
|
| | | public string PrimaryId = ""; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 一般方法 |
| | | /// <summary> |
| | | /// 显示错误信息窗口 |
| | | /// </summary> |
| | | /// <param name="msg"></param> |
| | | private void ShowErrorMsg(string msg) |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | var contr = new ShowMsgControl(ShowMsgType.Error, msg); |
| | | contr.Show(); |
| | | }); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 显示Tip信息窗口 |
| | | /// </summary> |
| | | /// <param name="msg"></param> |
| | | private void ShowTipMsg(string msg) |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | var contr = new ShowMsgControl(ShowMsgType.Tip, msg); |
| | | contr.Show(); |
| | | }); |
| | | } |
| | | |
| | | #endregion |
| | | } |
| | | } |