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 = GetFunctionAttributes().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.HvacAirFresh:
iconPath = "airFreshstandard";
break;
case SPK.HvacAirFreshJinmao:
iconPath = "airFreshjinmao";
break;
case SPK.HvacAC:
iconPath = "acstandard";
break;
case SPK.HvacFloorHeat:
iconPath = "floorHeatstandard";
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;
}
}
///
/// A协议功能的特性
/// 如:是AC功能:特性:on_off,mode,fan,temperature
/// attri
///
public List attributes = new List();
public List GetFunctionAttributes()
{
return attributes;
}
///
/// 房间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;
public bool online {
get
{
return true;
}
set
{
_online = value;
}
}
/////
///// 是否在线
/////
//public bool online
//{
// get
// {
// if(spk == SPK.AirSwitchP3)
// {
// return _online;
// }
// return true;
// }
// set
// {
// _online = value;
// }
//}
public bool isOnline()
{
return true;
}
public void setOnine(bool isOnline)
{
online = isOnline;
}
///
/// 环境面板 绑定的 设备目标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 = "";
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 (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 async 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();
var list = new List();
list.AddRange(attributes);
foreach (var attr in list)
{
//窗帘同时发送开关跟百分比会有问题,
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.SetTemp:
var tt = GetAttribute(FunctionAttributeKey.TempType);
if (tt == null)
{
attr.unit = "°C";
}
else
{
if (tt.unit == string.Empty)
{
attr.unit = "°C";
}
else
{
if (tt.unit == "C")
{
attr.unit = "°C";
}
else if (tt.unit == "F")
{
attr.unit = "°F";
}
else
{
attr.unit = tt.unit;
}
}
}
break;
case FunctionAttributeKey.RoomTemp:
attr.unit = "°C";
var tempType = attributes.Find((obj) => obj.key == FunctionAttributeKey.TempType);
if (tempType != null)
{
attr.unit = tempType.curValue.ToString();
}
break;
case FunctionAttributeKey.Percent:
case FunctionAttributeKey.Brightness:
attr.unit = "%";
break;
case FunctionAttributeKey.CCT:
attr.unit = "K";
break;
case FunctionAttributeKey.Angle:
attr.unit = "°";
break;
}
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 FunctionAttributeKey.Colorful:
case FunctionAttributeKey.ColorfulBegin:
case FunctionAttributeKey.ColorfulEnd:
case FunctionAttributeKey.ColorfulTime:
case "security":
//case FunctionAttributeKey.FadeTime:
if (attr.curValue.ToString() == "{}")
{
if (attr.key == FunctionAttributeKey.OnOff || attr.key == FunctionAttributeKey.Colorful)
{
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() {
UintString = attr.unit,
key = attr.key, value = Convert.ToInt32(vv).ToString(), max = attr.max, min = attr.min }) ;
}
else
{
sFunc.status.Add(new SceneFunctionStatus() {
UintString = attr.unit,
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 bool online = true;
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 string unit=string.Empty;
}
///
/// 功能属性键名列表
///
public static class FunctionAttributeKey
{
#region 三相空开属性
///
/// A相功率
///
public const string PowerA = "power_a";
///
/// B相功率
///
public const string PowerB = "power_b";
///
/// C相功率
///
public const string PowerC = "power_c";
///
/// A相电压
///
public const string VoltageA = "voltage_a";
///
/// B相电压
///
public const string VoltageB = "voltage_b";
///
/// C相电压
///
public const string VoltageC = "voltage_c";
///
/// A相电流
///
public const string CurrentA = "current_a";
///
/// B相电流
///
public const string CurrentB = "current_b";
///
/// C相电流
///
public const string CurrentC = "current_c";
///
/// A相温度
///
public const string TempA = "temp_a";
///
/// B相温度
///
public const string TempB = "temp_b";
///
/// C相温度
///
public const string TempC = "temp_c";
///
/// 过流值
///
public const string MaxCurrent = "max_current";
///
/// 过温值
///
public const string MaxTemp = "max_temp";
///
/// A相电量
///
public const string ElectricityA = "electricity_a";
///
/// B相电量
///
public const string ElectricityB = "electricity_b";
///
/// C相电量
///
public const string ElectricityC = "electricity_c";
#endregion
public const string _null = "";
///
/// 安防布防状态
///
public const string Security = "security";
///
/// 开关
///
public const string OnOff = "on_off";
///
/// 亮度
///
public const string Brightness = "brightness";
///
/// 炫彩开关
///
public const string Colorful = "colorful";
///
/// 炫彩开启颜色
///
public const string ColorfulBegin = "colorful_begin";
///
/// 炫彩结束颜色
///
public const string ColorfulEnd = "colorful_end";
///
/// 炫彩运行时间
///
public const string ColorfulTime = "colorful_time";
///
/// 颜色
///
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
{
#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);
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
///
/// 第三方品牌列表
///
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;
}
}