| | |
| | | DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1)); // 当地时区 |
| | | return startTime.AddMilliseconds(Convert.ToDouble(time_stamp)).ToString("s"); |
| | | } |
| | | catch { |
| | | catch |
| | | { |
| | | return DateTime.MinValue.ToString("s"); |
| | | } |
| | | } |
| | |
| | | /// <summary> |
| | | /// 设置属性状态 |
| | | /// </summary> |
| | | /// <param name="key"></param> |
| | | /// <param name="value"></param> |
| | | /// <param name="setKey"></param> |
| | | /// <param name="setValues"></param> |
| | | /// <returns>修改结果</returns> |
| | | public bool SetAttrState(string key, object value) |
| | | public bool SetAttrState(string setKey, object setValues) |
| | | { |
| | | var attr = attributes.Find((s) => s.key == key); |
| | | var attr = attributes.Find((s) => s.key == setKey); |
| | | if (attr == null) |
| | | { |
| | | switch (setKey) |
| | | { |
| | | case FunctionAttributeKey.CoolTemperatrue: |
| | | case FunctionAttributeKey.HeatTemperatrue: |
| | | case FunctionAttributeKey.AutoTemperatrue: |
| | | case FunctionAttributeKey.DehumiTemperatrue: |
| | | attributes.Add(new FunctionAttributes() |
| | | { |
| | | key = setKey, |
| | | state = setValues.ToString(), |
| | | curValue = setValues.ToString(), |
| | | }); |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | else |
| | | { |
| | | attr.state = value.ToString(); |
| | | attr.curValue = value.ToString(); |
| | | attr.state = setValues.ToString(); |
| | | attr.curValue = setValues.ToString(); |
| | | } |
| | | return true; |
| | | } |
| | |
| | | iconPath = "airFreshjinmao"; |
| | | break; |
| | | case SPK.HvacAC: |
| | | case SPK.HvacAcPanel: |
| | | iconPath = "acstandard"; |
| | | break; |
| | | case SPK.HvacFan: |
| | | iconPath = "electricalfan"; |
| | | break; |
| | | case SPK.HvacFloorHeat: |
| | | case SPK.HvacFloorHeatPanel: |
| | | iconPath = "floorHeatstandard"; |
| | | break; |
| | | case SPK.ElectricTuyaFan2: |
| | |
| | | [Newtonsoft.Json.JsonIgnore] |
| | | public Dictionary<string, byte> Fh_Mode_Temp = new Dictionary<string, byte>(); |
| | | #endregion |
| | | |
| | | |
| | | #region base info |
| | | public string sid = "0301011234567801012301230123"; |
| | |
| | | /// 设备spk |
| | | /// </summary> |
| | | public string spk = ""; |
| | | /// <summary> |
| | | /// 扩展信息 |
| | | /// 字符串 |
| | | /// </summary> |
| | | public string extend = ""; |
| | | |
| | | private string _SpkCategory = string.Empty; |
| | | /// <summary> |
| | |
| | | public bool collect = false; |
| | | |
| | | private bool _online; |
| | | public bool online { |
| | | public bool online |
| | | { |
| | | get |
| | | { |
| | | if (spk == SPK.AirSwitchP3|| spk == SPK.ElectricalTvHisense) |
| | | if (spk == SPK.AirSwitchP3 || spk == SPK.ElectricalTvHisense) |
| | | { |
| | | return _online; |
| | | } |
| | |
| | | |
| | | #endregion |
| | | |
| | | |
| | | //public void |
| | | |
| | | |
| | | /// <summary> |
| | | /// 延时 |
| | | /// </summary> |
| | |
| | | } |
| | | |
| | | break; |
| | | |
| | | |
| | | } |
| | | return text; |
| | | } |
| | |
| | | |
| | | new System.Threading.Thread(() => |
| | | { |
| | | if (spk == SPK.GroupControl) { |
| | | if (spk == SPK.GroupControl) |
| | | { |
| | | var groupControl = FunctionList.List.groupControls.Find((obj) => obj.sid == sid); |
| | | if (collect) |
| | | { |
| | |
| | | result = ApiUtlis.Ins.HttpRequest.CancelCollectDevice(deviceId).Code; |
| | | } |
| | | } |
| | | //提示错误 |
| | | if (result != StateCode.SUCCESS) |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | collect = !collect; |
| | | IMessageCommon.Current.ShowErrorInfoAlter(result); |
| | | }); |
| | | } else |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | UI.HomePage.RefreshFunctionView(); |
| | | }); |
| | | } |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | this.SaveFunctionFile(); |
| | | UI.HomePage.RefreshFunctionView(); |
| | | }); |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | } |
| | |
| | | /// </summary> |
| | | public async void UpdataRoomIds() |
| | | { |
| | | new System.Threading.Thread( () => |
| | | new System.Threading.Thread(() => |
| | | { |
| | | var pack = ApiUtlis.Ins.HttpRequest.UpdataDevcieBindRoomInfo(this); |
| | | //直接保存本地, |
| | |
| | | |
| | | foreach (var attr in list) |
| | | { |
| | | if(attr.key == FunctionAttributeKey.ColorfulBegin || attr.key == FunctionAttributeKey.ColorfulEnd || attr.key == FunctionAttributeKey.ColorfulTime) |
| | | if (attr.key == FunctionAttributeKey.ColorfulBegin || attr.key == FunctionAttributeKey.ColorfulEnd || attr.key == FunctionAttributeKey.ColorfulTime) |
| | | { |
| | | continue; |
| | | } |
| | | //窗帘同时发送开关跟百分比会有问题, |
| | | if(spk == SPK.CurtainRoller || spk == SPK.CurtainTrietex || spk == SPK.CurtainDream) |
| | | if (spk == SPK.CurtainRoller || spk == SPK.CurtainTrietex || spk == SPK.CurtainDream) |
| | | { |
| | | if (attr.key == FunctionAttributeKey.OnOff) |
| | | { |
| | |
| | | continue; |
| | | } |
| | | } |
| | | }else if (spk == SPK.GroupControl) |
| | | } |
| | | else if (spk == SPK.GroupControl) |
| | | { |
| | | sFunc.type = "5"; |
| | | } |
| | |
| | | } |
| | | } |
| | | } |
| | | else if(attr.key == "security") |
| | | else if (attr.key == "security") |
| | | { |
| | | attr.curValue = "false"; |
| | | } |
| | |
| | | { |
| | | vv = 26; |
| | | } |
| | | sFunc.status.Add(new SceneFunctionStatus() { |
| | | sFunc.status.Add(new SceneFunctionStatus() |
| | | { |
| | | UintString = attr.unit, |
| | | key = attr.key, value = Convert.ToInt32(vv).ToString(), max = attr.max, min = attr.min }) ; |
| | | key = attr.key, |
| | | value = Convert.ToInt32(vv).ToString(), |
| | | max = attr.max, |
| | | min = attr.min |
| | | }); |
| | | } |
| | | else |
| | | { |
| | | sFunc.status.Add(new SceneFunctionStatus() { |
| | | sFunc.status.Add(new SceneFunctionStatus() |
| | | { |
| | | UintString = attr.unit, |
| | | key = attr.key, value = attr.curValue.ToString(), max = attr.max, min = attr.min }); |
| | | key = attr.key, |
| | | value = attr.curValue.ToString(), |
| | | max = attr.max, |
| | | min = attr.min |
| | | }); |
| | | } |
| | | break; |
| | | } |
| | |
| | | /// <summary> |
| | | /// 属性单位 |
| | | /// </summary> |
| | | public string unit=string.Empty; |
| | | public string unit = string.Empty; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// </summary> |
| | | public static class FunctionAttributeKey |
| | | { |
| | | #region 空调bus属性 |
| | | /// <summary> |
| | | /// 制冷模式温度 |
| | | /// </summary> |
| | | public const string CoolTemperatrue = "CoolTemperatrue"; |
| | | /// <summary> |
| | | /// 制热模式温度 |
| | | /// </summary> |
| | | public const string HeatTemperatrue = "HeatTemperatrue"; |
| | | /// <summary> |
| | | /// 自动模式温度 |
| | | /// </summary> |
| | | public const string AutoTemperatrue = "AutoTemperatrue"; |
| | | /// <summary> |
| | | /// 除湿模式温度 |
| | | /// </summary> |
| | | public const string DehumiTemperatrue = "DehumiTemperatrue"; |
| | | #endregion |
| | | |
| | | #region 空调bus属性 |
| | | /// <summary> |
| | | /// [4]普通:设置温度(摄氏0-100,华氏32-212)/功率值(0-10) (1byte) |
| | | /// </summary> |
| | | public const string NormalTemperatrue = "NormalTemperatrue"; |
| | | /// <summary> |
| | | /// [5]白天:设置温度(摄氏0-100,华氏32-212)/功率值(0-10) (1byte) |
| | | /// </summary> |
| | | public const string DayTemperatrue = "DayTemperatrue"; |
| | | /// <summary> |
| | | /// [6]夜晚:设置温度(摄氏0-100,华氏32-212)/功率值(0-10) (1byte) |
| | | /// </summary> |
| | | public const string NightTemperatrue = "NightTemperatrue"; |
| | | /// <summary> |
| | | /// [7]离开:设置温度(摄氏0-100,华氏32-212)/功率值(0-10) (1byte) |
| | | /// </summary> |
| | | public const string AwayTemperatrue = "AwayTemperatrue"; |
| | | #region 三相空开属性 |
| | | |
| | | |
| | | /// <summary> |
| | | /// A相功率 |
| | | /// </summary> |
| | |
| | | /// </summary> |
| | | public const string ElectricityC = "electricity_c"; |
| | | |
| | | #endregion |
| | | #endregion |
| | | |
| | | |
| | |
| | | try |
| | | { |
| | | return Convert.ToByte(loopId, 16); |
| | | } catch |
| | | } |
| | | catch |
| | | { |
| | | return 0; |
| | | } |
| | |
| | | /// </summary> |
| | | public static class SPK |
| | | { |
| | | /// <summary> |
| | | /// 未知SPK |
| | | /// (自定义) |
| | | /// </summary> |
| | | public const string NULL = "NULL"; |
| | | /// <summary> |
| | | /// 电梯 |
| | | /// </summary> |
| | | public const string Elevator = "Elevator"; |
| | | /// <summary> |
| | | /// 西墨可视对讲门口机 |
| | | /// (自定义) |
| | | /// </summary> |
| | | public const string LinphoneXiMo = "door.gate"; |
| | | /// <summary> |
| | | /// 群控(自定义) |
| | | /// </summary> |
| | |
| | | /// <summary> |
| | | /// 大华摄像头 |
| | | /// </summary> |
| | | //public const string IpCam_Imou = "security.ipcam.imou"; |
| | | public const string IpCam_Imou = "security.ipcam.imou"; |
| | | /// <summary> |
| | | /// 机械手 |
| | | /// </summary> |
| | |
| | | /// 子控 |
| | | /// </summary> |
| | | public const string AcstSub = "acst.sub"; |
| | | /// <summary> |
| | | /// 热水器 |
| | | /// 金茂 |
| | | /// </summary> |
| | | public const string WaterHeaterJinmao = "electrical.water_heater.jinmao"; |
| | | /// <summary> |
| | | /// 逆变器/新能源 |
| | | /// 金茂 |
| | | /// </summary> |
| | | public const string InverterJinmao = "energy.inverter.jinmao"; |
| | | |
| | | /// <summary> |
| | | /// 门锁 |
| | | /// </summary> |
| | | public const string DoorLock = "security.door"; |
| | | |
| | | |
| | | /// <summary> |
| | | /// 门锁spk列表 |
| | | /// </summary> |
| | |
| | | list.Add(DoorLock); |
| | | return list; |
| | | } |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// 猫眼(旧spk) |
| | | /// </summary> |
| | | public const string Peephole = "peephole"; |
| | | |
| | | /// <summary> |
| | | /// 猫眼(新spk 暂时没用) |
| | | /// </summary> |
| | | //public const string PeepholeEz = "security.peephole.ez"; |
| | | /// <summary> |
| | | /// 萤石视频门锁 |
| | | /// </summary> |
| | | public const string VideoDoorLock = "security.door.ezviz"; |
| | | /// <summary> |
| | | /// 萤石摄像头 |
| | | /// </summary> |
| | | public const string Ev_Ipcam = "security.ipcam.ez"; |
| | | /// <summary> |
| | | /// 影音中控 |
| | | /// </summary> |
| | | public const string AvZkAiks = "av.zk.aiks"; |
| | | |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// 萤石视频门锁spk列表 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public static List<string> GetVideoDoorLockSPKList() |
| | | { |
| | | var list = new List<string>(); |
| | | list.Add(VideoDoorLock); |
| | | return list; |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 影音中控spk列表 |
| | | /// </summary> |
| | |
| | | return list; |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 萤石摄像头spk列表 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public static List<string> GetEvIpcamSPKList() |
| | | { |
| | | var list = new List<string>(); |
| | | list.Add(Ev_Ipcam); |
| | | return list; |
| | | } |
| | | |
| | | #region 灯光 |
| | | /// <summary> |
| | | /// (开关灯) |
| | |
| | | /// </summary> |
| | | public const string HvacAC = "hvac.ac"; |
| | | /// <summary> |
| | | /// 面板空调 |
| | | /// </summary> |
| | | public const string HvacAcPanel = "hvac.ac_panel"; |
| | | /// <summary> |
| | | /// 毛细管空调 |
| | | /// </summaryc |
| | | public const string HvacCac = "hvac.cac"; |
| | |
| | | var spkList = new List<string>(); |
| | | spkList.Add(AcStandard); |
| | | spkList.Add(HvacAC); |
| | | spkList.Add(HvacAcPanel); |
| | | spkList.Add(AcIr); |
| | | spkList.Add(HvacCac); |
| | | return spkList; |
| | |
| | | /// 地暖 |
| | | /// </summary> |
| | | public const string HvacFloorHeat = "hvac.floorHeat"; |
| | | /// <summary> |
| | | /// 面板地暖 |
| | | /// </summary> |
| | | public const string HvacFloorHeatPanel = "hvac.floorHeat_panel"; |
| | | |
| | | /// <summary> |
| | | /// 地热spk列表 |
| | |
| | | { |
| | | var spkList = new List<string>(); |
| | | spkList.Add(FloorHeatStandard); |
| | | spkList.Add(HvacFloorHeat); |
| | | spkList.Add(HvacFloorHeat); spkList.Add(HvacFloorHeatPanel); |
| | | return spkList; |
| | | } |
| | | #endregion |
| | |
| | | #endregion |
| | | |
| | | #region 能源 |
| | | /// <summary> |
| | | /// 逆变器 |
| | | /// </summary> |
| | | public const string Inverter = "energy.inverter"; |
| | | /// <summary> |
| | | /// 三相逆变器 |
| | | /// </summary> |
| | | public const string InverterRst = "energy.inverter_rst"; |
| | | /// <summary> |
| | | /// 能源模块 |
| | | /// </summary> |
| | |
| | | spkList.Add(SensorEnvironment); spkList.Add(SensorEnvironmentHailin); |
| | | spkList.Add(SensorEnvironment2); |
| | | spkList.Add(SensorEnvironment3); |
| | | |
| | | |
| | | return spkList; |
| | | } |
| | | |
| | |
| | | /// <summary> |
| | | /// HDL可视对讲 |
| | | /// </summary> |
| | | public const string doorgate="door.gate"; |
| | | public const string doorgate = "door.gate"; |
| | | #endregion |
| | | |
| | | #region 第三方spk列表 |