using System; using System.Collections.Generic; using HDL_ON.Common; using HDL_ON.DAL.Server; using HDL_ON.DriverLayer; using Shared; namespace HDL_ON.Entity { /// /// 读取服务器空间信息返回到数据包 /// public class DevcieApiPack { public List list = new List(); public string totalCount = "0"; public string totalPage = "0"; public string pageNo = "0"; public string pageSize = "0"; } /// /// 属性状态 /// public class AttrState { /// /// 属性键名 /// public string key; /// /// 属性的值列表 /// public List value = new List(); /// /// 最大值 /// public int max = 100; /// /// 最小值 /// public int min = 0; /// /// 数据类型 /// public string data_type = ""; /// /// 当前值 /// public string curValue = ""; } /// /// 功能类能满足数据使用要求,子类只是为了方便使用属性 /// public class Function { public Function() { } #region 优化区域 2021-02-25 /// /// 更新的最后时间 /// public string time_stamp = "1615261019796"; public string GeteTime() { try { DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1)); // 当地时区 return startTime.AddMilliseconds(Convert.ToDouble(time_stamp)).ToString("s"); } catch { return DateTime.MinValue.ToString("s"); } } /// /// 获取属性列表 /// /// public List GetAttributes() { var attrs = new List(); foreach (var attr in attributes) { attrs.Add(attr.key); } return attrs; } /// /// 获取指定属性 /// /// public FunctionAttributes GetAttribute(string key) { var attr = attributes.Find((a) => a.key == key); return attr; } /// /// 获取属性当前状态 /// /// /// public string GetAttrState(string key , string defaultValue = "0") { //一级查询keyValue值 var attrState = attributes.Find((s) => s.key == key.ToString()); if (attrState == null) { return defaultValue; } if (string.IsNullOrEmpty(attrState.state)) { //二级查询keyValue值 return GetOriginalState(key); } return attrState.state; } /// /// 获取初始状态 /// 默认值:0 /// /// 语雀定义的属性值 /// public string GetOriginalState(string key) { var originalState = status.Find((s) => s.key == key.ToString()); if (originalState == null || string.IsNullOrEmpty(originalState.value)) { return "0"; } return originalState.value; } /// /// 设置属性状态 /// /// /// /// 修改结果 public bool SetAttrState(string key, object value) { var attr = attributes.Find((s) => s.key == key); if (attr == null) { return false; } else { attr.state = value.ToString(); attr.curValue = value.ToString(); } return true; } /// /// icon文件名称 /// public string IconName { get { string iconPath = spk.Replace(".", ""); switch (spk) { case SPK.PanelSocket: iconPath = "electricalsocket"; break; case SPK.SenesorMegahealth2: iconPath = "sensormegahealth"; break; case SPK.SensorEnvironmentHailin: iconPath = "sensorenvironment"; break; case SPK.HvacAirFresh: iconPath = "airFreshstandard"; break; case SPK.HvacAirFreshJinmao: iconPath = "airFreshjinmao"; break; case SPK.HvacAC: iconPath = "acstandard"; break; case SPK.HvacFan: iconPath = "electricalfan"; break; case SPK.HvacFloorHeat: iconPath = "floorHeatstandard"; break; case SPK.ElectricTuyaFan2: iconPath = "electricaltyqborgovyzytytz"; break; case SPK.ElectricTuyaAirCleaner2: iconPath = "electricalQ1RsefNf91tIXyyQ"; break; case SPK.ElectricTuyaWaterValve2: iconPath = "electricalkoiGhMKwLf2ZP81g"; break; case SPK.ElectricTuyaWeepRobot2: iconPath = "electricalai6HtccKFIw3dxo3"; break; case SPK.AvMusic: iconPath = "musicstandard"; break; } return iconPath; } } /// /// 版本数据列表 /// public List versions = new List(); /// /// 上一次打开的亮度 /// 灯光私有属性 /// [Newtonsoft.Json.JsonIgnore] public int lastBrightness = 100; /// /// 工作模式对应的工作温度 /// 地热私有属性 /// [Newtonsoft.Json.JsonIgnore] public Dictionary Fh_Mode_Temp = new Dictionary(); #endregion #region base info public string sid = "0301011234567801012301230123"; /// /// 备注 /// public string name = ""; /// /// 设备绑定的homeId /// private string _homeId = ""; public string homeId { get { if (string.IsNullOrEmpty(_homeId)) { return DB_ResidenceData.Instance.CurrentRegion.id; } else { return _homeId; } } set { _homeId = value; } } /// /// 设备ID /// 云端负责生成 /// public string deviceId = "0"; /// /// 第三方设备扩展id /// public string extDevId = string.Empty; /// /// 物理设备(模块)型号 /// public string omodel =string.Empty; /// /// 设备spk /// public string spk = ""; private string _SpkCategory = string.Empty; /// /// spk 产品的品类 /// public string SpkCategory { get { if (string.IsNullOrEmpty(_SpkCategory)) { var arr = spk.Split("."); if (arr.Length > 0) { _SpkCategory = arr[0]; } } return _SpkCategory; } } private string _SpkClassification = string.Empty; /// /// spk 产品品类下的分类 /// public string SpkClassification { get { if (string.IsNullOrEmpty(_SpkClassification)) { var arr = spk.Split("."); if (arr.Length > 1) { _SpkClassification = arr[1]; } } return _SpkClassification; } } string _SpkManufacturer = string.Empty; /// /// spk 产品的厂商 /// public string SpkManufacturer { get { if (string.IsNullOrEmpty(_SpkManufacturer)) { var arr = spk.Split("."); if (arr.Length > 2) { _SpkManufacturer = arr[2]; } } return _SpkManufacturer; } } //string spk_Prefix; ///// ///// spk前缀 ///// 大类 ///// 功能类别 ///// 如:空调类、灯光类、窗帘类 ///// //public string Spk_Prefix //{ // get // { // if (string.IsNullOrEmpty(spk_Prefix)) // { // spk_Prefix = spk.Split(".")[0]; // } // return spk_Prefix; // } //} /// /// A协议功能的特性 /// 如:是AC功能:特性:on_off,mode,fan,temperature /// attri /// public List attributes = new List(); /// /// 房间ID列表 /// 该功能添加到到房间列表 /// public List roomIds = new List(); /// /// 存储属性配置 /// 环境传感器的等级 /// public List attrKeyConfigs = new List(); public List GetAttrKeyConfigs(string key) { if (attrKeyConfigs.Count == 0) { switch (key) { case "pm2.5": // break; } } return attrKeyConfigs; } /// /// bus协议数据格式 /// 使用A协议控制时,改属性为空 /// public BusData bus; /// /// 是否收藏 /// public bool collect = false; private bool _online = false; /// /// 是否在线 /// public bool online { get { return true; } set { _online = value; } } /// /// 环境面板 绑定的 设备目标sid列表 /// public List targetSids = new List(); /// /// 云端数据创建的时间 /// public string createTime = ""; /// /// 云端数据修改的最后时间 /// public string modifyTime = ""; /// /// 扩展信息 /// public ExtSet extSet = new ExtSet(); #endregion //public void /// /// 延时 /// public int delay = 0; /// /// 最后控制的一次状态 /// [Newtonsoft.Json.JsonIgnore] public string lastState = ""; /// /// 获取状态显示文本 /// /// public string GetLastStateText() { var text = ""; switch (spk) { case SPK.HvacCac: switch (GetAttrState(FunctionAttributeKey.Mode)) { case "cool": text = Language.StringByID(StringId.Cool); break; case "heat": text = Language.StringByID(StringId.Heat); break; } break; } return text; } FunctionAttributes _trait_on_off; [Newtonsoft.Json.JsonIgnore] public FunctionAttributes trait_on_off { get { if (_trait_on_off == null) { _trait_on_off = attributes.Find((obj) => obj.key == FunctionAttributeKey.OnOff); //找不到属性需要声明一个,防止报错闪退 if (_trait_on_off == null) { _trait_on_off = new FunctionAttributes() { key = "on_off", value = new List { "on", "off" }, max = 1, min = 0, }; _trait_on_off.curValue = "off"; } } if (_trait_on_off.curValue.ToString() != "on" && _trait_on_off.curValue.ToString() != "off" && _trait_on_off.curValue.ToString() != "stop") { _trait_on_off.curValue = "off"; } return _trait_on_off; } } /// /// 功能的属性状态列表 /// public List status = new List(); /// /// 通过状态列表组装属性里面的状态 /// public void AssembleStatus() { foreach (var sta in status) { SetAttrState(sta.key, sta.value); } } /// /// 功能列表排序 /// public int FunctionOrderNumber = 9999; /// /// 房间列表排序 /// public int RoomOrderNumber = 9999; /// /// 使用次数 /// public double controlCounter = 0; /// /// 使用频率 /// public double usageFrequency { get { return controlCounter / 7; } } /// /// 固定的序号 /// public int fixedSerialNumber = int.MaxValue; /// /// 收藏功能 /// public void CollectFunction() { var result = ""; new System.Threading.Thread(() => { if (spk == SPK.GroupControl) { var groupControl = FunctionList.List.groupControls.Find((obj) => obj.sid == sid); if (collect) { result = ApiUtlis.Ins.HttpRequest.CollectGroupControl(groupControl.userDeviceGroupControlId).Code; } else { result = ApiUtlis.Ins.HttpRequest.CancelCollectGroupControl(groupControl.userDeviceGroupControlId).Code; } } else { if (collect) { result = ApiUtlis.Ins.HttpRequest.CollectDevice(deviceId).Code; } else { 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(); }); } }) { IsBackground = true }.Start(); } /// /// 编辑功能绑定房间信息 /// public void EditBindRoomInfo(string roomId) { var result = ""; new System.Threading.Thread(() => { if (collect) { result = ApiUtlis.Ins.HttpRequest.BindDeviceToRoom(new List() { deviceId }, new List() { roomId }).Code; } else { result = ApiUtlis.Ins.HttpRequest.UnbindDeviceToRoom(deviceId, roomId); } //提示错误 if (result != StateCode.SUCCESS) { Application.RunOnMainThread(() => { collect = !collect; IMessageCommon.Current.ShowErrorInfoAlter(result); }); } }) { IsBackground = true }.Start(); } public string GetBusId() { string busId = ""; if (bus != null) { busId = bus.SubnetID + "_" + bus.DeviceID + "_" + bus.LoopId; } return busId; } /// /// 获取设备添加到房间的房间名称 /// /// public string GetRoomListName() { string roomNameList = ""; foreach (var roomId in roomIds) { var findRoom = SpatialInfo.CurrentSpatial.RoomList.Find(obj => obj.roomId == roomId); if (findRoom == null) { continue; } if (roomNameList != "") { roomNameList += ","; } roomNameList += findRoom.floorName + "-" + findRoom.roomName; } if (roomNameList == "") { roomNameList = Language.StringByID(StringId.WholeZone); } return roomNameList; } /// /// 数据存储文件名 /// [Newtonsoft.Json.JsonIgnore] public string savePath { get { return "FunctionData_" + sid; } } /// /// 保存功能文件 /// public void SaveFunctionFile() { var ssd = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(this)); FileUtlis.Files.WriteFileByBytes(savePath, ssd); } /// /// 保存房间绑定信息 /// public void UpdataRoomIds() { new System.Threading.Thread(() => { var pack = ApiUtlis.Ins.HttpRequest.UpdataDevcieBindRoomInfo(this); //直接保存本地, SaveFunctionFile(); if (pack.Code == StateCode.SUCCESS) { if (UI.RoomPage.bodyView != null) { Application.RunOnMainThread(() => { UI.RoomPage.bodyView.ReLoadPage(); }); } } else { IMessageCommon.Current.ShowErrorInfoAlter(pack.Code); } }) { IsBackground = true }.Start(); } /// /// 更新功能信息 /// public void UpdataFuncitonInfo() { new System.Threading.Thread(() => { var pm = new HttpServerRequest(); var pack = pm.UpdataDevcieInfo(this); SaveFunctionFile(); if (pack.Code == StateCode.SUCCESS) { } else { IMessageCommon.Current.ShowErrorInfoAlter(pack.Code); } }) { IsBackground = true }.Start(); } /// /// 更新功能名称 /// public void UpdataFunctionName() { new System.Threading.Thread(() => { var pm = new HttpServerRequest(); var pack = pm.UpdataDevcieInfo(this); SaveFunctionFile(); if (pack.Code == StateCode.SUCCESS) { } else { IMessageCommon.Current.ShowErrorInfoAlter(pack.Code); } }) { IsBackground = true }.Start(); } /// /// 转换成场景功能对象 /// /// public SceneFunction ConvertSceneFunction() { var sFunc = new SceneFunction(); foreach (var attr in attributes) { //窗帘同时发送开关跟百分比会有问题, if(spk == SPK.CurtainRoller || spk == SPK.CurtainTrietex || spk == SPK.CurtainDream) { if (attr.key == FunctionAttributeKey.OnOff) { if (attributes.Find((obj) => obj.key == FunctionAttributeKey.Percent) != null) { continue; } } } switch (attr.key) { case FunctionAttributeKey.OnOff: case FunctionAttributeKey.Brightness: case FunctionAttributeKey.Mode: case FunctionAttributeKey.SetTemp: case FunctionAttributeKey.FanSpeed: case FunctionAttributeKey.Percent: case FunctionAttributeKey.CCT: case FunctionAttributeKey.RGB: case FunctionAttributeKey.Angle: case "security": //case FunctionAttributeKey.FadeTime: if (attr.curValue.ToString() == "{}") { if (attr.key == FunctionAttributeKey.OnOff) { attr.curValue = "off"; } else if (attr.key == FunctionAttributeKey.Mode) { if (DB_ResidenceData.Instance.GatewayType == 0) { attr.curValue = "0"; } else { if (SPK.AcSpkList().Contains(spk)) { attr.curValue = "cool"; } else if (SPK.FhSpkList().Contains(spk)) { attr.curValue = "day"; } } } else if(attr.key == "security") { attr.curValue = "false"; } else { attr.curValue = "0"; } } if (attr.key == FunctionAttributeKey.SetTemp) { double vv = 16; Double.TryParse(attr.curValue.ToString(), out vv); if (vv == 0) { vv = 26; } sFunc.status.Add(new SceneFunctionStatus() { key = attr.key, value = Convert.ToInt32(vv).ToString(), max = attr.max, min = attr.min }); } else { sFunc.status.Add(new SceneFunctionStatus() { key = attr.key, value = attr.curValue.ToString(), max = attr.max, min = attr.min }); } break; } } sFunc.sid = this.sid; return sFunc; } /// /// 更新时间 /// public DateTime refreshTime = DateTime.MinValue; /// /// 获取本地控制数据 /// public AlinkFunctionStatusObj GetGatewayAlinkControlData(Dictionary commandDictionary) { var sendDataObj = new AlinkFunctionStatusObj(); sendDataObj.id = Control.Ins.msg_id.ToString(); sendDataObj.time_stamp = Utlis.GetTimestamp(); var acd = new AlinkStatusData(); acd.sid = sid; foreach (var dic in commandDictionary) { var aca = new AttributesStatus(); aca.key = dic.Key; aca.value = dic.Value; acd.status.Add(aca); } sendDataObj.objects.Add(acd); return sendDataObj; } public AlinkDoorlockObj GetGatewayAlinkDoorlockData(string userId, string extStr) { var sendDataObj = new AlinkDoorlockObj(); sendDataObj.id = Control.Ins.msg_id.ToString(); sendDataObj.time_stamp = Utlis.GetTimestamp(); var acd = new AlinkDoorlockStatus(); acd.sid = sid; acd.user_id = extStr; acd.ext_str = extStr; sendDataObj.objects.Add(acd); return sendDataObj; } /// /// 获取Api控制数据 /// /// public ApiAlinkControlActionObj GetApiControlData(Dictionary keyValues) { ApiAlinkControlActionObj aaao = new ApiAlinkControlActionObj(); aaao.deviceId = this.deviceId; aaao.spk = this.spk; aaao.bus = this.bus; foreach (var kv in keyValues) { aaao.attributes.Add(new AttributesStatus() { key = kv.Key, value = kv.Value, }); } return aaao; } } /// /// 远程控制 /// api a协议控制动作对象 /// public class ApiAlinkControlActionObj { /// /// 设备ID /// public string deviceId = "0"; /// /// spk /// 列:light.switch /// public string spk = ""; public List attributes = new List(); //[Newtonsoft.Json.JsonIgnore] public BusData bus = new BusData(); } /// /// A协议控制数据的对象 /// public class AlinkFunctionStatusObj { public List objects = new List(); public string time_stamp = ""; public string id = ""; } /// /// 门锁通讯数据 /// public class AlinkDoorlockObj { public List objects = new List(); public string time_stamp = ""; public string id = ""; } public class AlinkDoorlockStatus { public string sid; public string user_id; public string ext_str; } /// /// 本地状态读取 /// A协议状态读取格式对象 /// public class AlinkReadFunctionStatusObj { public string id = "0"; public List> objects = new List>(); public string time_stamp = ""; } /// /// A协议状态数据 /// public class AlinkStatusData { /* mqtt接收的状态数据没有deviceId 接口反馈的数据有 */ /// /// /// public string sid = ""; /// /// 设备ID /// 云端负责生成 /// public string deviceId = "0"; public List status = new List(); } /// /// 功能属性状态 /// public class AttributesStatus { /// /// 属性名 /// 列:on_off /// public string key = ""; /// /// 属性值 /// 列:on /// public string value = ""; } /// /// 功能属性 /// 属性字段解析:attri :属性内容,value 属性的值,max 最大值 min 最小值 /// [Serializable] public class FunctionAttributes { /// /// 属性键名 /// public string key; /// /// 属性的值列表 /// public List value = new List(); /// /// 步进 /// 空调温度控制 0.5 1 /// public string step = "1"; /// /// 最大值 /// public int max = 100; /// /// 最小值 /// public int min = 0; /// /// 数据类型 /// public string data_type = ""; /// /// 当前状态 /// public string state = ""; /// /// 当前值 /// public object curValue = new object(); } /// /// 功能属性键名列表 /// public static class FunctionAttributeKey { public const string _null = ""; /// /// 安防布防状态 /// public const string Security = "security"; /// /// 开关 /// public const string OnOff = "on_off"; /// /// 亮度 /// public const string Brightness = "brightness"; /// /// 颜色 /// public const string RGB = "rgb"; public const string RGBW = "rgbw"; /// /// 渐变时间 /// public const string FadeTime = "fade_time"; /// /// 模式 /// public const string Mode = "mode"; /// /// 扫风 /// public const string Swing = "swing"; /// /// 工作模式 /// 地热/地冷/功率地热/功率地冷 /// public const string WorkMode = "mode_work"; /// /// 风速 /// public const string FanSpeed = "fan"; /// /// 手动风向 /// public const string FanManual = "fan_manual"; /// /// 自动风向 /// public const string FanAuto = "fan_auto"; /// /// 设置温度 /// public const string SetTemp = "set_temp"; /// /// 温度加减 /// public const string SetTempStep = "set_temp_step"; /// /// 温度模式 /// 空调、地热//app自加 /// public const string TempType = "temperature_type"; /// /// 时间标记 /// 地热//app自加 /// public const string TimeFlag = "time_flag"; /// /// 延时 /// public const string Delay = "delay"; /// /// 色温 /// public const string CCT = "cct"; /// /// 百分比 /// public const string Percent = "percent"; /// /// 角度 /// public const string Angle = "angle"; /// /// 室内温度 /// public const string RoomTemp = "room_temp"; /// /// 室内湿度 /// public const string RoomHumidity = "room_humidity"; /// /// 露点温度 /// public const string dew_point_temp = "dew_point_temp"; /// /// 表面温度 /// public const string surface_temp = "surface_temp"; /// /// 室内湿度补偿值 /// public const string room_humidity_cc = "room_humidity_cc"; /// /// 室内温度补偿值 /// public const string room_temp_cc = "room_temp_cc"; /// /// 毛细阀门 /// public const string cac_valve = "cac_valve"; /// /// 地暖阀门 /// public const string fh_valve = "fh_valve"; /// /// value /// public const string Value = "value"; public const string Co2 = "co2"; public const string Temperature = "temperature"; public const string Hcho = "hcho"; public const string Humidity = "humidity"; public const string Pm25 = "pm25"; public const string Tvoc = "tvoc"; /// /// 状态,传感器 /// public const string Status = "status"; /// /// 状态(有无人) /// public const string PeopleStatus = "people_status"; /// /// 状态(报警) /// public const string AlarmStatus = "alarm_status"; /// /// 状态(闭合、打开) /// public const string ContactStatus = "contact_status"; /// /// 毫米波传感器,动作状态 /// public const string ActionStatus = "action_state"; /// /// /// public const string PeopleNum = "people_num"; public const string PeopleId = "people_id"; /// /// 毫米波传感器 人物动作 /// public const string TargetStatus = "target_status";//0空,1走,2跑,3坐,4跌倒,5站 /// /// 电量状态 /// public const string BatteryState = "battery_state"; /// /// 烘干 /// public const string HotDry = "hot_dry"; /// /// 风干 /// public const string WindDry = "wind_dry"; /// /// 消毒 /// public const string Disinfect = "disinfect"; /// /// 上升下降 /// public const string Position = "position"; /// /// 进度 /// public const string PositionPercent = "position_percent"; /// /// 烘干时间 /// public const string HotDryTime = "hot_dry_time"; /// /// 烘干剩余时间 /// public const string HotDryTimeLeft = "hot_dry_time_surplus"; /// /// 风干时间 /// public const string WindDryTime = "wind_dry_time"; /// /// 风干剩余时间 /// public const string WindDryTimeLeft = "wind_dry_time_surplus"; /// /// 消毒时间 /// public const string DisinfectTime = "disinfect_time"; /// /// 消毒剩余时间 /// public const string DisinfectTimeLeft = "disinfect_time_surplus"; /// /// 负离子 /// public const string Anion = "anion"; /// /// 负离子时间 /// public const string AnionTime = "anion_time"; /// /// 负离子剩余时间 /// public const string AnionTimeLeft = "anion_time_surplus"; /// /// 打开等级(风扇) /// public const string OpenLevel = "openLevel"; public const string fan_speed_percent = "fan_speed_percent"; /// /// 红外按键 /// public const string Key = "key"; /// /// 节能 /// public const string Energy = "energy"; /// /// 室内温度 /// public const string IndoorTemp = "indoor_temp"; /// /// 室内湿度 /// public const string IndoorHumidity = "indoor_humidity"; /// /// 过滤网剩余量 /// public const string FilterRemain = "filter_remain"; /// /// 过滤网是否超时警告 /// public const string FilterTimeout = "filter_timeout"; #region tuya /// /// 涂鸦水阀开启时间 /// public const string TuyaWaterTime = "countdown_1"; #endregion /// /// 功率 /// public const string Power = "power"; /// /// 总电量 /// public const string TotalElectricity = "total_electricity"; } /// /// 设备功能oid /// public class FunctionOid { public string oid; public string name; public string machine_id; public string net_id; public string dev_id; public string channels; } /// /// 兼容旧协议控制 /// public class BusData { public string addresses = "FFFF"; [Newtonsoft.Json.JsonIgnore] public byte SubnetID { get { return Convert.ToByte(addresses.Substring(0, 2), 16); } } [Newtonsoft.Json.JsonIgnore] public byte DeviceID { get { return Convert.ToByte(addresses.Substring(2, 2), 16); } } public byte LoopId { get { try { return Convert.ToByte(loopId, 16); } catch { return 0; } } } public string loopId; } /// /// Tag 功能SPK /// public static class SPK { /// /// 群控(自定义) /// public const string GroupControl = "GroupControl"; /// /// 通用开关 /// public const string OtherCommon = "other.common"; /// /// 大华摄像头 /// public const string IpCam_Imou = "security.ipcam.imou"; /// /// 机械手 /// public const string MechanicalArm = "electrical.mechanical_arm"; /// /// 空调科技系统(绿建) /// 总控 /// public const string AcstParent = "acst.parent"; /// /// 空调科技系统(绿建) /// 子控 /// public const string AcstSub = "acst.sub"; /// /// 门锁 /// public const string DoorLock = "security.door"; /// /// 门锁spk列表 /// /// public static List GetDoorLockSPKList() { var list = new List(); list.Add(DoorLock); return list; } /// /// 猫眼 /// public const string Peephole = "peephole"; /// /// 萤石视频门锁 /// public const string VideoDoorLock="security.door.ezviz"; /// /// 萤石摄像头 /// public const string Ev_Ipcam = "security.ipcam.ez"; /// /// 萤石视频门锁spk列表 /// /// public static List GetVideoDoorLockSPKList() { var list = new List(); list.Add(VideoDoorLock); return list; } /// /// 萤石摄像头spk列表 /// /// public static List GetEvIpcamSPKList() { var list = new List(); list.Add(Ev_Ipcam); return list; } #region 灯光 /// /// (开关灯) /// public const string LightSwitch = "light.switch"; /// /// (调光灯) /// public const string LightDimming = "light.dimming"; /// /// (RGB灯) /// public const string LightRGB = "light.rgb"; /// /// (RGBW灯) /// public const string LightRGBW = "light.rgbw"; /// /// (CCT灯) /// public const string LightCCT = "light.cct"; /// /// 灯光spk列表 /// /// public static List LightSpkList() { var spkList = new List(); spkList.Add(LightCCT); spkList.Add(LightDimming); spkList.Add(LightRGB); spkList.Add(LightRGBW); spkList.Add(LightSwitch); return spkList; } #endregion #region 窗帘 /// /// (开关窗帘) /// public const string CurtainSwitch = "curtain.switch"; /// /// (开合帘) /// public const string CurtainTrietex = "curtain.trietex"; /// /// (百叶帘) /// public const string CurtainShades = "curtain.shades"; /// /// (卷帘) /// public const string CurtainRoller = "curtain.roller"; /// /// 梦幻帘 /// public const string CurtainDream = "curtain.dream"; /// /// 窗帘spk列表 /// /// public static List CurtainSpkList() { var spkList = new List(); spkList.Add(CurtainRoller); spkList.Add(CurtainSwitch); spkList.Add(CurtainShades); spkList.Add(CurtainTrietex); spkList.Add(CurtainDream); return spkList; } #endregion #region 空调 /// /// (空调) /// public const string AcStandard = "ac.standard"; /// /// (红外空调) /// public const string AcIr = "ir.ac"; /// /// 空调 /// public const string HvacAC = "hvac.ac"; /// /// 毛细管空调 /// /// 空调spk列表 /// /// public static List AcSpkList() { var spkList = new List(); spkList.Add(AcStandard); spkList.Add(HvacAC); spkList.Add(AcIr); spkList.Add(HvacCac); return spkList; } #endregion #region 地热 /// /// (地热) /// public const string FloorHeatStandard = "floorHeat.standard"; /// /// 地暖 /// public const string HvacFloorHeat = "hvac.floorHeat"; /// /// 地热spk列表 /// /// public static List FhSpkList() { var spkList = new List(); spkList.Add(FloorHeatStandard); spkList.Add(HvacFloorHeat); return spkList; } #endregion #region 新风 /// /// (新风) /// public const string AirFreshStandard = "airFresh.standard"; /// /// 新风 /// public const string HvacAirFresh = "hvac.airFresh"; /// /// 新风 ——金茂定制 /// public const string AirFreshJinmao = "airFresh.jinmao"; /// /// 新风 ——金茂定制 /// public const string HvacAirFreshJinmao = "hvac.airFresh.jinmao"; /// /// 新风spk列表 /// /// public static List AirFreshSpkList() { var spkList = new List(); spkList.Add(AirFreshStandard); spkList.Add(AirFreshJinmao); spkList.Add(HvacAirFresh); spkList.Add(HvacAirFreshJinmao); return spkList; } #endregion #region 能源 /// /// 逆变器 /// public const string Inverter = "energy.inverter"; /// /// 三相逆变器 /// public const string InverterRst = "energy.inverter_rst"; /// /// 能源模块 /// public const string EnergyStandard = "energy.standard"; /// /// 能源-电能 /// public const string ElectricEnergy = "energy.electric"; /// /// 能源spk列表 /// /// public static List EnergySpkList() { var spkList = new List(); spkList.Add(ElectricEnergy); return spkList; } #endregion #region 音乐 /// /// (音乐) /// public const string MusicStandard = "music.standard"; /// /// 音乐 /// public const string AvMusic = "av.music"; /// /// 音乐spk列表 /// /// public static List MusicSpkList() { var spkList = new List(); spkList.Add(MusicStandard); spkList.Add(AvMusic); return spkList; } #endregion #region 传感器 #region 安防传感器 /// /// (亮度传感器) /// public const string SensorLight = "sensor.light"; /// /// (红外移动传感器) /// public const string SensorPir = "sensor.pir"; /// /// 人体存在传感器 /// public const string SensorPirHold = "sensor.pir_hold"; /// /// (门窗传感器) /// public const string SensorDoorWindow = "sensor.doorwindow"; /// /// 烟雾传感器 /// public const string SensorSmoke = "sensor.smoke"; /// /// 水浸传感器 /// public const string SensorWater = "sensor.water"; /// /// 燃气传感器 /// public const string SensorGas = "sensor.gas"; /// /// 红外珊栏传感器 /// public const string SensorShanLan = "sensor.shanlan"; /// /// 红外对射传感器 /// public const string SensorDuiShe = "sensor.duishe"; /// /// 超声波传感器 /// public const string SensorUtrasonic = "sensor.ultrasonic"; /// /// (干接点) /// public const string SensorDryContact = "sensor.dryContact"; public const string SensorDryContact2 = "dryContact.standard"; /// /// 毫米波传感器 /// public const string SenesorMegahealth = "sensor.megahealth"; public const string SenesorMegahealth2 = "sensor.megahealth.zg"; /// /// 毫米波传感器(姿态版) /// public const string SensorMmvPose = "sensor.mmv_pose"; /// /// 紧急呼叫 /// public const string SensorHelp = "sensor.help"; /// /// 安防传感器spk列表 /// /// public static List ArmSensorSpkList() { var spkList = new List(); //spkList.Add(SensorLight); spkList.Add(SensorPir); spkList.Add(SensorPirHold); spkList.Add(SensorHelp); spkList.Add(SensorDoorWindow); spkList.Add(SensorSmoke); spkList.Add(SensorWater); spkList.Add(SensorGas); //spkList.Add(SensorShanLan); //spkList.Add(SensorDuiShe); //spkList.Add(SensoruUtrasonic); spkList.Add(SensorDryContact); spkList.Add(SensorDryContact2); spkList.Add(SenesorMegahealth); spkList.Add(SenesorMegahealth2); spkList.Add(SensorMmvPose); return spkList; } #endregion public const string PanelEnvironment = "screen.panel"; /// /// 面板spk列表 /// /// public static List PanelSpkList() { var spkList = new List(); spkList.Add(SensorHelp); spkList.Add(PanelEnvironment); return spkList; } #region 环境传感器 /// /// (PM10传感器) /// public const string SensorPm10 = "sensor.pm10"; /// /// (温度传感器) /// public const string SensorTemperature = "sensor.temperature"; /// /// (PM2.5传感器) /// public const string SensorPm25 = "sensor.pm25"; /// /// co2传感器 /// public const string SensorCO2 = "sensor.co2"; /// /// tvoc传感器 /// public const string SensorTVOC = "sensor.tvoc"; /// /// 湿度传感器 /// public const string SensorHumidity = "sensor.humidity"; /// /// 环境传感器 /// 环境检测传感器 /// 特殊类spk /// 该spk功能是环境传感器功能的集成 /// public const string SensorEnvironment = "sensor.environment"; /// /// 青萍环境传感器 /// public const string SensorEnvironment2 = "sensor.environment2"; /// /// 青萍环境传感器 /// public const string SensorEnvironment3 = "sensor.environment3"; public const string SensorEnvironmentHailin = "sensor.environment.hailin"; /// /// 甲醛 /// public const string SensorHcho = "sensor.hcho"; /// /// 环境传感器设备spk列表 /// /// public static List EnvironDeviceSpkList() { var spkList = new List(); spkList.Add(SensorTemperature); spkList.Add(SensorPm10); spkList.Add(SensorPm25); spkList.Add(SensorCO2); spkList.Add(SensorTVOC); spkList.Add(SensorHumidity); spkList.Add(SensorEnvironment); spkList.Add(SensorEnvironmentHailin); spkList.Add(SensorEnvironment2); spkList.Add(SensorEnvironment3); spkList.Add(SensorHcho); return spkList; } /// /// 环境传感器spk列表 /// /// public static List EnvironSpkList() { var spkList = new List(); spkList.Add(SensorTemperature); spkList.Add(SensorPm10); spkList.Add(SensorPm25); spkList.Add(SensorCO2); spkList.Add(SensorTVOC); spkList.Add(SensorHumidity); spkList.Add(SensorHcho); return spkList; } /// /// 环境传感器设备列表 /// /// public static List EvironmentSensorList() { var spkList = new List(); spkList.Add(SensorEnvironment); spkList.Add(SensorEnvironmentHailin); spkList.Add(SensorEnvironment2); spkList.Add(SensorEnvironment3); return spkList; } #endregion #endregion #region 家电 /// /// 家电、插座 /// public const string ElectricSocket = "electrical.socket"; /// /// 面板、插座、面板 /// public const string PanelSocket = "panel.socket"; /// /// 家电、电视 /// public const string ElectricTV = "electrical.tv"; /// /// 红外、电视 /// public const string TvIr = "ir.tv"; /// /// 红外、小米电视 /// public const string TvXmIr = "ir.tvxm"; /// /// 家电、风扇 /// public const string ElectricFan = "electrical.fan"; public const string HvacFan = "hvac.fan"; /// /// 凉霸 /// public const string ClothesHanger = "electrical.racks"; /// /// 红外遥控器 /// public const string IrLearn = "ir.learn"; /// /// 红外投影仪 /// public const string PjtIr = "ir.pjt"; /// /// 红外机顶盒 /// public const string StbIr = "ir.stb"; /// /// 红外影碟机 /// public const string DvDIr = "ir.dvd"; /// /// 红外空气净化器 /// public const string PurifierIr = "ir.air_purifier"; /// /// 红外热水器 /// public const string HeaterIr = " ir.water_heater"; /// /// 红外风扇 /// public const string FanIr = "ir.fan"; /// /// 智能空开 /// public const string AirSwitch = "electrical.breaker"; #region 涂鸦 /// /// 家电、涂鸦空气净化器 /// public const string ElectricTuyaAirCleaner = "electrical.Q1RsefNf91tIXyyQ"; public const string ElectricTuyaAirCleaner2 = "hvac.air.tuya_epi345"; /// /// 家电、涂鸦电风扇 /// public const string ElectricTuyaFan = "electrical.tyqborgovyzytytz"; public const string ElectricTuyaFan2 = "hvac.fan.tuya_ef101"; /// /// 家电、涂鸦扫地机器人 /// public const string ElectricTuyaWeepRobot = "electrical.ai6HtccKFIw3dxo3"; public const string ElectricTuyaWeepRobot2 = "electrical.sweep.tuya"; /// /// 家电、涂鸦水阀 /// public const string ElectricTuyaWaterValve = "electrical.koiGhMKwLf2ZP81g"; public const string ElectricTuyaWaterValve2 = "electrical.watervalve.tuya_aw713"; #endregion /// /// 家电spk列表 /// /// public static List ElectricalSpkList() { var spkList = new List(); spkList.Add(ElectricSocket); spkList.Add(PanelSocket); spkList.Add(ElectricTV); spkList.Add(TvIr); spkList.Add(TvXmIr); spkList.Add(ElectricFan); spkList.Add(HvacFan); spkList.Add(FanIr); spkList.Add(ClothesHanger); spkList.Add(IrLearn); spkList.Add(PjtIr); spkList.Add(StbIr); spkList.Add(ElectricTuyaAirCleaner); spkList.Add(ElectricTuyaAirCleaner2); spkList.Add(ElectricTuyaFan); spkList.Add(ElectricTuyaFan2); spkList.Add(ElectricTuyaWeepRobot); spkList.Add(ElectricTuyaWeepRobot2); spkList.Add(ElectricTuyaWaterValve); spkList.Add(ElectricTuyaWaterValve2); spkList.Add(AirSwitch); return spkList; } #endregion #region 设备类 /// /// 红外宝 /// public const string IrModule = "ir.module"; /// /// 设备类spk列表 /// /// public static List DeviceSpkList() { var spkList = new List(); spkList.Add(IrModule); return spkList; } #endregion #region 可视对讲 /// /// HDL可视对讲 /// public const string doorgate="door.gate"; #endregion #region 第三方spk列表 /// /// 获取所有第三方品牌功能的spk /// /// public static List GetAll3tySPK() { var spkList = new List(); spkList.Add(ElectricTuyaAirCleaner); spkList.Add(ElectricTuyaAirCleaner2); spkList.Add(ElectricTuyaFan); spkList.Add(ElectricTuyaFan2); spkList.Add(ElectricTuyaWaterValve); spkList.Add(ElectricTuyaWaterValve2); spkList.Add(ElectricTuyaWeepRobot); spkList.Add(ElectricTuyaWeepRobot2); spkList.Add(SensorMmvPose); spkList.Add(SenesorMegahealth); spkList.Add(SenesorMegahealth2); return spkList; } /// /// 获取第三方设备spk /// /// public static List Get3tySpk(BrandType brandType) { var list = new List(); switch (brandType) { case BrandType.Tuya: list.Add(ElectricTuyaAirCleaner); list.Add(ElectricTuyaFan); list.Add(ElectricTuyaWaterValve); list.Add(ElectricTuyaWeepRobot); list.Add(ElectricTuyaAirCleaner2); list.Add(ElectricTuyaFan2); list.Add(ElectricTuyaWaterValve2); list.Add(ElectricTuyaWeepRobot2); break; case BrandType.All3tyBrand: list.Add(SenesorMegahealth2);//兆观 break; } return list; } #endregion /// /// 没有状态显示的功能spk列表 /// public static List NotStatusSpkList = new List { ElectricTV, FanIr, TvIr, TvXmIr, StbIr, PjtIr, IrLearn }; /// /// 第三方品牌列表 /// public enum BrandType { All = 0, Hdl = 1, Tuya = 2, /// /// 兆观 /// Megahealth = 3, All3tyBrand = 999, } } ///// ///// 功能类别 ///// //public static class FunctionCategory //{ // /// // ///(灯) // /// // public const string Light = "light"; // /// // /// (窗帘) // /// // public const string Curtain = "curtain"; // /// // /// (空调) // /// // public const string AC = "ac"; // /// // /// (地热) // /// // public const string FloorHeat = "floorHeat"; // /// // /// (新风) // /// // public const string AirFresh = "airFresh"; // /// // /// (音乐) // /// // public const string Music = "music"; // /// // /// (传感器) // /// // public const string Sensor = "sensor"; // /// // /// (干接点) // /// // public const string DryContact = "dryContact"; // /// // /// 家电 // /// // public const string Electric = "electrical"; // /// // /// 红外设备 // /// // public const string IR = "ir"; //} public class VersionInfo { public string module = ""; public string version = ""; } /// /// 功能属性相关配置信息 /// 环境传感器等级使用 /// public class AttrKeyConfig { public string key = string.Empty; /// /// 配置类型 /// interval 区间 /// 目前只支持:interval /// public string type = string.Empty; public string unit = string.Empty; public List configs = new List(); } public class AttrKeyInfo { /// /// /// public string start = string.Empty; /// /// /// public string end = string.Empty; /// /// /// public string color = string.Empty; /// /// 描述 /// public string desc = string.Empty; } /// /// 扩展信息设置 /// public class ExtSet { /// /// 是否开启实验室模式 /// public bool labModel = false; } }