| | |
| | | |
| | | #region base info |
| | | /// <summary> |
| | | /// HDL统一协议格式:14bytes
|
| | | /// 举例: 来源 厂商代码 通讯方式 产品时间戳 产品类别 物模型类 通道号 大小类别
|
| | | /// HDL统一协议格式:14bytes |
| | | /// 举例: 来源 厂商代码 通讯方式 产品时间戳 产品类别 物模型类 通道号 大小类别 |
| | | /// 1byte 1byte 1byte 4byte 1byte 2byte 2byte 2byte |
| | | /// 来源:00 默认原生态系统数据 、01 网关或者其他A设备、02 调试软件、03 APP应用程序、04 第三方网关或者平台
|
| | | /// 厂商代码:01 HDL
|
| | | /// 来源:00 默认原生态系统数据 、01 网关或者其他A设备、02 调试软件、03 APP应用程序、04 第三方网关或者平台 |
| | | /// 厂商代码:01 HDL |
| | | /// 通讯方式:01 HDL Bus、02 Zigbee、03 KNX、04 Z-Wave |
| | | /// 产品时间戳:4bytes 以2020年1月1日算出的时间戳0.1s为单位 |
| | | /// 产品类别:01 调光器、02 继电器、03 干接点模块、04 传感器、05 面板
|
| | | /// 物模型类型:
|
| | | /// 01 开关类:01 开关、02 插座、03 |
| | | /// 02 照明: 01 开关、02 调光、03 色温、04 LED
|
| | | /// 03 遮阳: 01 窗帘电机、02 百叶窗、03 开合帘、04 卷帘
|
| | | /// 产品时间戳:4bytes 以2020年1月1日算出的时间戳0.1s为单位 |
| | | /// 产品类别:01 调光器、02 继电器、03 干接点模块、04 传感器、05 面板 |
| | | /// 物模型类型: |
| | | /// 01 开关类:01 开关、02 插座、03 |
| | | /// 02 照明: 01 开关、02 调光、03 色温、04 LED |
| | | /// 03 遮阳: 01 窗帘电机、02 百叶窗、03 开合帘、04 卷帘 |
| | | /// 04 恒温器:01 空调、02 地暖、03 毛细空调 |
| | | /// 05 新风 |
| | | /// 06 影音 |
| | | /// 07 音乐 |
| | | /// 08 能源 |
| | | /// 09 安防 |
| | | /// 大类别 1bytes (预留)
|
| | | /// 大类别 1bytes (预留) |
| | | /// 小类别 1byte (预留) |
| | | /// </summary> |
| | | public string sid = "0301011234567801012301230123"; |
| | |
| | | /// 设备spk |
| | | /// </summary> |
| | | public string spk = ""; |
| | | /// <summary> |
| | | /// 功能类别 |
| | | /// 如:空调类、灯光类、窗帘类 |
| | | /// </summary> |
| | | public FunctionCategory functionCategory |
| | | { |
| | | get |
| | | { |
| | | try |
| | | { |
| | | var _functionCategoryString = sid.Substring(16, 2); |
| | | var _functionCategory = Convert.ToInt32(_functionCategoryString, 16); |
| | | return (FunctionCategory)Enum.ToObject(typeof(FunctionCategory), _functionCategory); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MainPage.Log($"get FunctionCategory error : {ex.Message}"); |
| | | return FunctionCategory.UnKown; |
| | | } |
| | | } |
| | | } |
| | | ///// <summary> |
| | | ///// 功能类别 |
| | | ///// 如:空调类、灯光类、窗帘类 |
| | | ///// </summary> |
| | | //public FunctionCategory Spk_Prefix |
| | | //{ |
| | | // get |
| | | // { |
| | | // try |
| | | // { |
| | | // var _functionCategoryString = sid.Substring(16, 2); |
| | | // var _functionCategory = Convert.ToInt32(_functionCategoryString, 16); |
| | | // return (FunctionCategory)Enum.ToObject(typeof(FunctionCategory), _functionCategory); |
| | | // } |
| | | // catch (Exception ex) |
| | | // { |
| | | // MainPage.Log($"get FunctionCategory error : {ex.Message}"); |
| | | // return FunctionCategory.UnKown; |
| | | // } |
| | | // } |
| | | //} |
| | | |
| | | ///// <summary> |
| | | ///// 功能类型 |
| | | ///// </summary> |
| | | public FunctionType functionType |
| | | //public FunctionType spk |
| | | //{ |
| | | // get |
| | | // { |
| | | // var _functionTypeString = sid.Substring(16, 4); |
| | | // return (FunctionType)Enum.ToObject(typeof(FunctionType), Convert.ToInt32(_functionTypeString, 16)); |
| | | // } |
| | | //} |
| | | |
| | | string spk_Prefix; |
| | | /// <summary> |
| | | /// spk前缀 |
| | | /// 大类 |
| | | /// 功能类别 |
| | | /// 如:空调类、灯光类、窗帘类 |
| | | /// </summary> |
| | | public string Spk_Prefix |
| | | { |
| | | get |
| | | { |
| | | var _functionTypeString = sid.Substring(16, 4); |
| | | return (FunctionType)Enum.ToObject(typeof(FunctionType), Convert.ToInt32(_functionTypeString, 16)); |
| | | |
| | | if (string.IsNullOrEmpty(spk_Prefix)) |
| | | { |
| | | spk_Prefix = spk.Split(".")[0]; |
| | | } |
| | | return spk_Prefix; |
| | | } |
| | | } |
| | | string spk_Suffix; |
| | | ///// <summary> |
| | | ///// spk后缀 |
| | | ///// 小类 |
| | | ///// 功能类型 |
| | | ///// </summary> |
| | | //public string spk |
| | | //{ |
| | | // get |
| | | // { |
| | | // if (string.IsNullOrEmpty(spk_Suffix)) |
| | | // { |
| | | // try |
| | | // { |
| | | // spk_Suffix = spk.Split(".")[1]; |
| | | // } |
| | | // catch |
| | | // { |
| | | // spk_Suffix = ""; |
| | | // } |
| | | // } |
| | | // return spk_Suffix; |
| | | // } |
| | | //} |
| | | |
| | | /// <summary> |
| | | /// A协议功能的特性 |
| | |
| | | _trait_on_off.curValue = "off"; |
| | | } |
| | | } |
| | | if(_trait_on_off.curValue.ToString() != "on"&& _trait_on_off.curValue.ToString() != "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; |
| | | } |
| | | //set |
| | | //{ |
| | | // _trait_on_off = value; |
| | | //} |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | } |
| | | roomNameList += findRoom.floorName +"-"+ findRoom.roomName; |
| | | } |
| | | if (roomNameList == "" && functionType == FunctionType.Scene) |
| | | if (roomNameList == "" ) |
| | | { |
| | | roomNameList = Language.StringByID(StringId.WholeZone); |
| | | } |
| | |
| | | public const string SensorPir = "sensor.pir"; |
| | | /// <summary> |
| | | /// (门窗传感器) |
| | | /// </summary>
|
| | | /// </summary> |
| | | public const string SensorDoorWindow = "sensor.doorwindow"; |
| | | /// <summary> |
| | | /// (PM2.5传感器) |
| | | /// </summary>
|
| | | /// </summary> |
| | | public const string SensorPm25 = "sensor.pm25"; |
| | | /// <summary> |
| | | /// co2传感器 |
| | |
| | | /// 湿度传感器 |
| | | /// </summary> |
| | | public const string SensorHumidity = "sensor.humidity"; |
| | | |
| | | /// <summary> |
| | | /// 烟雾传感器 |
| | | /// </summary> |
| | | public const string SensorSmoke = "sensor.smoke"; |
| | | /// <summary> |
| | | /// 水浸传感器 |
| | | /// </summary> |
| | | public const string SensorWater = "sensor.water"; |
| | | /// <summary> |
| | | /// 燃气传感器 |
| | | /// </summary> |
| | | public const string SensorGas= "sensor.gas"; |
| | | /// <summary> |
| | | /// 红外珊栏传感器 |
| | | /// </summary> |
| | | public const string SensorShanLan = "sensor.shanlan"; |
| | | /// <summary> |
| | | /// 红外对射传感器 |
| | | /// </summary> |
| | | public const string SensorDuiShe = "sensor.duishe"; |
| | | /// <summary> |
| | | /// 超声波传感器 |
| | | /// </summary> |
| | | public const string SensoruUtrasonic = "sensor.ultrasonic"; |
| | | |
| | | /// <summary> |
| | | /// (干接点) |
| | | /// </summary>
|
| | | public const string DryContact = "dryContact.standard";
|
| | | /// </summary> |
| | | public const string SensorDryContact = "sensor.dryContact"; |
| | | /// <summary> |
| | | /// 家电、插座 |
| | | /// </summary> |
| | | public const string ElectricSocket = "electrical.socket";
|
| | | public const string ElectricSocket = "electrical.socket"; |
| | | /// <summary> |
| | | /// 家电、电视 |
| | | /// </summary> |
| | | public const string ElectricTV = "electrical.tv";
|
| | | public const string ElectricTV = "electrical.tv"; |
| | | /// <summary> |
| | | /// 家电、风扇 |
| | | /// </summary> |
| | | public const string ElectricFan = "electrical.fan"; |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 功能类别 |
| | | /// </summary> |
| | | public static class FunctionCategory |
| | | { |
| | | /// <summary> |
| | | ///(灯) |
| | | /// </summary> |
| | | public const string Light = "light"; |
| | | /// <summary> |
| | | /// (窗帘) |
| | | /// </summary> |
| | | public const string Curtain = "curtain"; |
| | | /// <summary> |
| | | /// (空调) |
| | | /// </summary> |
| | | public const string AC = "ac"; |
| | | /// <summary> |
| | | /// (地热) |
| | | /// </summary> |
| | | public const string FloorHeat = "floorHeat"; |
| | | /// <summary> |
| | | /// (新风) |
| | | /// </summary> |
| | | public const string AirFresh = "airFresh"; |
| | | /// <summary> |
| | | /// (音乐) |
| | | /// </summary> |
| | | public const string Music = "music"; |
| | | /// <summary> |
| | | /// (传感器) |
| | | /// </summary> |
| | | public const string Sensor = "sensor"; |
| | | /// <summary> |
| | | /// (干接点) |
| | | /// </summary> |
| | | public const string DryContact = "dryContact"; |
| | | /// <summary> |
| | | /// 家电 |
| | | /// </summary> |
| | | public const string Electric = "electrical"; |
| | | |
| | | //Music = 0x09, |
| | | } |
| | | |
| | | |
| | | } |