From dc14dbad8e3a55b57cadddba40c3f437e5e80fc5 Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期二, 01 十一月 2022 09:08:03 +0800
Subject: [PATCH] 备份
---
Crabtree/SmartHome/HDL/Common/HDLLinkUtlis.cs | 2752 +++++++++++++++++++++++++++++++++++++++++++----------------
1 files changed, 1,995 insertions(+), 757 deletions(-)
diff --git a/Crabtree/SmartHome/HDL/Common/HDLLinkUtlis.cs b/Crabtree/SmartHome/HDL/Common/HDLLinkUtlis.cs
index 94eedcd..4beb6ca 100644
--- a/Crabtree/SmartHome/HDL/Common/HDLLinkUtlis.cs
+++ b/Crabtree/SmartHome/HDL/Common/HDLLinkUtlis.cs
@@ -1,14 +1,104 @@
锘縰sing System;
using System.Collections.Generic;
using Shared;
+using Shared.IO;
+using Shared.SimpleControl;
-namespace SmartHome
+namespace Shared
{
/// <summary>
/// HDLLink鍗忚 宸ュ叿绫�
/// </summary>
public class HDLLinkUtlis
{
+ /// <summary>
+ /// 鐢熸垚閫昏緫sid鏂规硶
+ /// </summary>
+ public static string NewSceneSid ()
+ {
+ string sceneId = "";
+ try {
+ string sOidBeginsWith = "000101";//鍘傚晢 + 閫氳鏂瑰紡
+
+ string sTimeSpan = "00000000";
+ long sTimeSp = ConvertDateTimeLong (); //浠�2020骞�1鏈�1鏃ョ畻鍑虹殑鏃堕棿鎴�0.1s涓哄崟浣�
+ ConvertIntToByteArray (sTimeSp, ref sTimeSpan);
+
+ if (sTimeSpan.Length > 8) {
+ sTimeSpan = sTimeSpan.Substring (0, 8);
+ }
+
+ sceneId = sOidBeginsWith + sTimeSpan;
+
+ sceneId += "0A";
+ sceneId += "0A01";
+ int maxId = 1;
+
+ Random random = new Random (Guid.NewGuid ().GetHashCode ());
+ maxId = random.Next (65535);
+
+ sceneId += (maxId).ToString ("X4");
+ sceneId += "0000";
+ } catch {
+ return sceneId;
+ }
+ return sceneId;
+ }
+
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="curtainStatus"></param>
+ /// <returns></returns>
+ public static string GetCurtainStatusKey (CurtainStatus curtainStatus) {
+ if(curtainStatus == CurtainStatus.Open) {
+ return "on";
+ } else if (curtainStatus == CurtainStatus.Close) {
+ return "off";
+ } else if (curtainStatus == CurtainStatus.Stop) {
+ return "stop";
+ } else {
+ return "off";
+ }
+
+ }
+
+ #region 鐢熸垚4浣峛yte 鏃堕棿鎴�
+ private static long LastTime = 0;
+ /// <summary>
+ /// DateTime鏃堕棿鏍煎紡杞崲涓�13浣嶅甫姣鐨刄nix鏃堕棿鎴�
+ /// </summary>
+ /// <param name="time"> DateTime鏃堕棿鏍煎紡</param>
+ /// <returns>Unix鏃堕棿鎴虫牸寮�</returns>
+ public static long ConvertDateTimeLong ()
+ {
+ System.DateTime startTime = TimeZoneInfo.ConvertTimeToUtc (new System.DateTime (2020, 1, 1));
+ long l = (long)(Math.Round ((DateTime.Now - startTime).TotalMilliseconds, 1) / 10);
+ if (l <= LastTime) l = LastTime + 1;
+ LastTime = l;
+ return l;
+ }
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="m"></param>
+ /// <param name="strTmp"></param>
+ /// <returns></returns>
+ public static bool ConvertIntToByteArray (long m, ref string strTmp)
+ {
+ strTmp = "00000000";
+ byte [] arry = new byte [4];
+ arry [0] = (byte)(m & 0xFF);
+ arry [1] = (byte)((m & 0xFF00) >> 8);
+ arry [2] = (byte)((m & 0xFF0000) >> 16);
+ arry [3] = (byte)((m & 0xFF000000) >> 24);
+ strTmp = arry [0].ToString ("X2") + arry [1].ToString ("X2") + arry [2].ToString ("X2") + arry [3].ToString ("X2");
+ return true;
+ }
+ #endregion
+
+
+
#region 鈻� Current___________________________
/// <summary>
/// 閫氱敤鏂规硶
@@ -27,7 +117,617 @@
}
#endregion
+ /// <summary>
+ /// 涓�閿皢鏈湴鍥炶矾璁惧鍜屽満鏅暟鎹浆鎹�
+ /// 鐒跺悗涓婁紶oid銆乻id銆佷互鍙婂満鏅垪琛�
+ /// </summary>
+ /// <returns></returns>
+ public void OneclickUpload (bool isMigrate = false)
+ {
+ if (isMigrate) {
+ var res = false;
+ res = UploadOidAndSidList ();
+ if (res) {
+ res = GetFunctionList ();
+ if (res) {
+ res = UploadSecneList ();
+ }
+ }
+ return;
+ }
+ MainPage.Loading.Start ("Uploading...");
+ System.Threading.Tasks.Task.Run (() => {
+ try {
+ var res = false;
+ res = UploadOidAndSidList ();
+ if (res) {
+ res = GetFunctionList ();
+ if (res) {
+ res = UploadSecneList ();
+ }
+ }
+ if (res) {
+ Utlis.ShowAlertOnMainThread (Language.StringByID (SimpleControl.R.MyInternationalizationString.SuccessfullySynchronizedToTheCloud));
+ } else {
+ Utlis.ShowAlertOnMainThread (Language.StringByID (SimpleControl.R.MyInternationalizationString.FailedToSyncToTheCloud));
+ }
+
+ } catch {
+
+ } finally {
+ Application.RunOnMainThread (() => {
+ MainPage.Loading.Hide ();
+ });
+ }
+ });
+
+ }
+
+ /// <summary>
+ ///
+ /// </summary>
+ /// <returns></returns>
+ public bool GetFunctionList ()
+ {
+ var res = false;
+ try {
+ var revertObj = HttpServerRequest.Current.GetDeviceList ();
+ if (revertObj.Code == StateCode.SUCCESS) {
+ var devcieFunctionRes = Newtonsoft.Json.JsonConvert.DeserializeObject<DevcieFunctionRes> (revertObj.Data.ToString ());
+ if (devcieFunctionRes != null && devcieFunctionRes.list != null && devcieFunctionRes.list.Count > 0) {
+ CommonConfig.Current.FunctionList = devcieFunctionRes.list;
+ } else {
+ CommonConfig.Current.FunctionList = new List<Function> ();
+ }
+ CommonConfig.Current.Save ();
+ res = true;
+ } else {
+ //鎻愮ず閿欒
+ IMessageCommon.Current.ShowErrorInfoAlter (revertObj.Code);
+ }
+ } catch {
+
+ }
+
+ return res;
+ }
+
+ #region 鈻� 涓婁紶鍦烘櫙鍒楄〃___________________________
+ /// <summary>
+ /// 涓婁紶鍦烘櫙鍒楄〃
+ /// </summary>
+ public bool UploadSecneList ()
+ {
+ var res = false;
+ try {
+ //1.鍔犺浇鎵�鏈夊満鏅苟杞崲
+ var allSecneList = GetAllSecneList ();
+ var hdlLinkSceneList = new List<HDLLinkScene> ();
+ foreach (var sence in allSecneList) {
+ var mHDLLinkScene = GetHDLLinkScene (sence);
+ //1.1鎴愬姛杞崲鐨勫満鏅墠娣诲姞鍒板噯澶囦笂浼犲垪琛�
+ if(mHDLLinkScene != null && mHDLLinkScene.functions != null && mHDLLinkScene.functions.Count > 0) {
+ hdlLinkSceneList.Add (mHDLLinkScene);
+ }
+ }
+
+ //鍏ㄩ噺鍚屾鍦烘櫙
+ res = UploadSceneList (hdlLinkSceneList);
+
+
+ } catch (Exception ex){
+ Utlis.WriteLine ("catch :" + ex.ToString ());
+ }
+ return res;
+ }
+
+ /// <summary>
+ /// 鑾峰彇鎵�鏈夊満鏅垪琛�
+ /// </summary>
+ /// <returns></returns>
+ public List<Scene> GetAllSecneList ()
+ {
+ List<Scene> targetSceneList = new List<Scene> ();
+ //// 鎵惧嚭闇�瑕佹樉绀虹殑鍦烘櫙
+ // 1.鍏ㄥ眬鍦烘櫙
+ var globalSceneFileList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<string>> (System.Text.Encoding.UTF8.GetString (IO.FileUtils.ReadFile (Scene.GlobalSceneFilePath)));
+ if (globalSceneFileList == null) {
+ globalSceneFileList = new List<string> ();
+ }
+ // 2.鎴块棿鍦烘櫙
+ List<string> RoomsSceneFileList = new List<string> ();
+ foreach (var r in Room.Lists) {
+ if (string.IsNullOrEmpty (r.Name)) {
+ continue;
+ }
+ if (r != null) {
+ RoomsSceneFileList.AddRange (r.SceneFilePathList);
+ }
+ }
+
+ foreach (var sceneFilePath in globalSceneFileList) {
+ var tempScene = Scene.GetSceneByFilePath (sceneFilePath);
+ if (tempScene != null) {
+ if (string.IsNullOrEmpty (tempScene.Sid)) {
+ //濡傛灉Sid涓虹┖锛岄噸鏂扮敓鎴愬苟淇濆瓨
+ tempScene.Sid = NewSceneSid ();
+ tempScene.Save (sceneFilePath);
+ Utlis.WriteLine ("鐢熸垚鏂扮殑鍦烘櫙id锛� " + tempScene.Sid);
+
+ }
+ targetSceneList.Add (tempScene);
+ }
+ }
+
+ foreach (var roomSceneFilePath in RoomsSceneFileList) {
+ var tempScene = Scene.GetSceneByFilePath (roomSceneFilePath);
+ if (tempScene != null) {
+ if (string.IsNullOrEmpty (tempScene.Sid)) {
+ //濡傛灉Sid涓虹┖锛岄噸鏂扮敓鎴愬苟淇濆瓨
+ tempScene.Sid = NewSceneSid ();
+ tempScene.Save (roomSceneFilePath);
+ Utlis.WriteLine ("鐢熸垚鏂扮殑鍦烘櫙id锛� " + tempScene.Sid);
+ }
+ targetSceneList.Add (tempScene);
+ }
+ }
+ // 鎵�鏈夊満鏅�
+ return targetSceneList;
+ }
+
+ /// <summary>
+ /// 鍏ㄩ噺鍚屾鍦烘櫙
+ /// </summary>
+ /// <param name="mScene"></param>
+ bool UploadSceneList (List<HDLLinkScene> hdlLinkSceneList)
+ {
+ var res = false;
+ try {
+ var revertObj = HttpServerRequest.Current.SecneSyncList (hdlLinkSceneList);
+ if (revertObj.Code == StateCode.SUCCESS) {
+ res = true;
+ } else {
+ IMessageCommon.Current.ShowErrorInfoAlter (revertObj.Code);
+ }
+ } catch {
+
+ }
+ return res;
+ }
+
+ ///// <summary>
+ /////
+ ///// </summary>
+ ///// <param name="mScene"></param>
+ //bool UpdateSceneList (List<HDLLinkScene> updateLinkSceneList)
+ //{
+ // var res = false;
+ // try {
+ // var revertObj = HttpServerRequest.Current.EditScene (updateLinkSceneList);
+ // if (revertObj.Code == StateCode.SUCCESS) {
+ // res = true;
+ // } else {
+ // IMessageCommon.Current.ShowErrorInfoAlter (revertObj.Code);
+ // }
+ // } catch {
+
+ // }
+ // return res;
+ //}
+
+ /// <summary>
+ /// 鍘熺敓鍗忚Scene 杞崲鎴� HDLLinkScene鏁版嵁鏍煎紡
+ /// </summary>
+ /// <param name="mScene"></param>
+ /// <returns></returns>
+ HDLLinkScene GetHDLLinkScene (Scene mScene)
+ {
+ var mHDLLinkScene = new HDLLinkScene ();
+ mHDLLinkScene.sid = mScene.Sid;
+ mHDLLinkScene.name = mScene.Name;
+ if (UserConfig.Instance.CheckWhetherGatewayIdNotNull ()) {
+ mHDLLinkScene.gatewayId = UserConfig.Instance.HomeGateway.gatewayId;
+ }
+ var functions = new List<SceneFunction> ();
+ if (!mScene.busScene) {
+ foreach (var deviceFilePath in mScene.DeviceFilePathList) {
+ var jsonInfo = System.Text.Encoding.UTF8.GetString (IO.FileUtils.ReadFile (deviceFilePath));
+ var common = Newtonsoft.Json.JsonConvert.DeserializeObject<Common> (jsonInfo);
+ if (common == null) continue;
+
+ var function = CommonUtlis.Current.CommonToFunction (common, CommonConfig.Current.FunctionList);
+ if (function == null) continue;
+
+ if (common.Type == DeviceType.LightDimming) {
+ var commonNew = Newtonsoft.Json.JsonConvert.DeserializeObject<LightDimming> (jsonInfo);
+ var mSceneFunction = new SceneFunction ();
+ mSceneFunction.sid = function.sid;
+ //1.on_off
+ var status = new List<SceneFunctionStatus> ();
+ status.Add (new SceneFunctionStatus () {
+ key = FunctionAttributeKey.OnOff,
+ value = commonNew.CurrentBrightness > 0 ? "on" : "off",
+ });
+ //2.Brightness
+ status.Add (new SceneFunctionStatus () {
+ key = FunctionAttributeKey.Brightness,
+ value = commonNew.CurrentBrightness.ToString(),
+ });
+ //3.Delay
+ status.Add (new SceneFunctionStatus () {
+ key = FunctionAttributeKey.Delay,
+ value = (commonNew.DelayTimeHeight * 256 + commonNew.DelayTimeLow).ToString (),
+ });
+
+ mSceneFunction.status = status;
+ functions.Add (mSceneFunction);
+
+ } else if (common.Type == DeviceType.LightEnergySocket) {
+ var commonNew = Newtonsoft.Json.JsonConvert.DeserializeObject<LightEnergySocket> (jsonInfo);
+ var mSceneFunction = new SceneFunction ();
+ mSceneFunction.sid = function.sid;
+ //1.on_off
+ var status = new List<SceneFunctionStatus> ();
+ status.Add (new SceneFunctionStatus () {
+ key = FunctionAttributeKey.OnOff,
+ value = commonNew.CurrentBrightness > 0 ? "on" : "off",
+ });
+ //2.Delay
+ status.Add (new SceneFunctionStatus () {
+ key = FunctionAttributeKey.Delay,
+ value = (commonNew.DelayTimeHeight * 256 + commonNew.DelayTimeLow).ToString (),
+ });
+
+ mSceneFunction.status = status;
+ functions.Add (mSceneFunction);
+
+
+ } else if (common.Type == DeviceType.LightEnergySwitch) {
+ var commonNew = Newtonsoft.Json.JsonConvert.DeserializeObject<LightEnergySwitch> (jsonInfo);
+ var mSceneFunction = new SceneFunction ();
+ mSceneFunction.sid = function.sid;
+ //1.on_off
+ var status = new List<SceneFunctionStatus> ();
+ status.Add (new SceneFunctionStatus () {
+ key = FunctionAttributeKey.OnOff,
+ value = commonNew.CurrentBrightness > 0 ? "on" : "off",
+ });
+ //2.Delay
+ status.Add (new SceneFunctionStatus () {
+ key = FunctionAttributeKey.Delay,
+ value = (commonNew.DelayTimeHeight * 256 + commonNew.DelayTimeLow).ToString(),
+ });
+
+ mSceneFunction.status = status;
+ functions.Add (mSceneFunction);
+
+
+ } else if (common.Type == DeviceType.LightRGB) {
+ var commonNew = Newtonsoft.Json.JsonConvert.DeserializeObject<LightLogic> (jsonInfo);
+ var mSceneFunction = new SceneFunction ();
+ mSceneFunction.sid = function.sid;
+ //1.on_off
+ var status = new List<SceneFunctionStatus> ();
+ status.Add (new SceneFunctionStatus () {
+ key = FunctionAttributeKey.OnOff,
+ value = commonNew.CurrentBrightness > 0 ? "on" : "off",
+ });
+ //2.Brightness
+ status.Add (new SceneFunctionStatus () {
+ key = FunctionAttributeKey.Brightness,
+ value = commonNew.CurrentBrightness.ToString (),
+ });
+ //3.Delay
+ status.Add (new SceneFunctionStatus () {
+ key = FunctionAttributeKey.Delay,
+ value = (commonNew.DelayTimeHeigh * 256 + commonNew.DelayTimeLow).ToString (),
+ });
+
+ //4.rgb
+ status.Add (new SceneFunctionStatus () {
+ key = FunctionAttributeKey.RGB,
+ value = commonNew.RStatus + "," + commonNew.GStatus + "," + commonNew.BStatus,
+ });
+
+ mSceneFunction.status = status;
+ functions.Add (mSceneFunction);
+
+ //var device = Newtonsoft.Json.JsonConvert.DeserializeObject<LightLogic> (System.Text.Encoding.UTF8.GetString (IO.FileUtils.ReadFile (deviceFilePath)));
+ ////if (device == null) {
+ //// mSendCount--;
+ //// continue;
+ ////}
+ //if (device == null) {
+ // //replyBytes = new byte [] { 0x00 };
+ //} else {
+ // var mSceneFunction = new SceneFunction ();
+ // functions.Add (mSceneFunction);
+ // replyBytes = Control.ControlBytesSendHasReturn (Command.SetLogicLoopColor, device.SubnetID, device.DeviceID, new byte [] { device.LoopID, device.CurrentBrightness, 254, device.DelayTimeHeigh,device.DelayTimeLow,
+ // 3,device.RStatus,device.GStatus,device.BStatus,0,0});
+ //}
+
+ } else if (common.Type == DeviceType.LightSwitch) {
+ var commonNew = Newtonsoft.Json.JsonConvert.DeserializeObject<LightSwitch> (jsonInfo);
+ var mSceneFunction = new SceneFunction ();
+ mSceneFunction.sid = function.sid;
+ //1.OnOff
+ var status = new List<SceneFunctionStatus> ();
+ status.Add (new SceneFunctionStatus () {
+ key = FunctionAttributeKey.OnOff,
+ value = commonNew.CurrentBrightness > 0 ? "on" : "off",
+ });
+ //2.Delay
+ status.Add (new SceneFunctionStatus () {
+ key = FunctionAttributeKey.Delay,
+ value = (commonNew.DelayTimeHeight * 256 + commonNew.DelayTimeLow).ToString (),
+ });
+
+ mSceneFunction.status = status;
+ functions.Add (mSceneFunction);
+
+
+ } else if (common.Type == DeviceType.CurtainModel) {
+ var commonNew = Newtonsoft.Json.JsonConvert.DeserializeObject<CurtainModel> (jsonInfo);
+ var mSceneFunction = new SceneFunction ();
+ mSceneFunction.sid = function.sid;
+ //1.on_off stop
+ var status = new List<SceneFunctionStatus> ();
+ status.Add (new SceneFunctionStatus () {
+ key = FunctionAttributeKey.OnOff,
+ value = GetCurtainStatusKey(commonNew.Status),
+ });
+
+ mSceneFunction.status = status;
+ functions.Add (mSceneFunction);
+
+
+ } else if (common.Type == DeviceType.CurtainRoller) {
+ var commonNew = Newtonsoft.Json.JsonConvert.DeserializeObject<CurtainRoller> (jsonInfo);
+ var mSceneFunction = new SceneFunction ();
+ mSceneFunction.sid = function.sid;
+ //1.percent
+ var status = new List<SceneFunctionStatus> ();
+ status.Add (new SceneFunctionStatus () {
+ key = FunctionAttributeKey.Percent,
+ value = commonNew.CurtainProress.ToString(),
+ });
+
+ mSceneFunction.status = status;
+ functions.Add (mSceneFunction);
+
+
+ } else if (common.Type == DeviceType.CurtainTrietex) {
+ var commonNew = Newtonsoft.Json.JsonConvert.DeserializeObject<CurtainTrietex> (jsonInfo);
+ var mSceneFunction = new SceneFunction ();
+ mSceneFunction.sid = function.sid;
+ //1.percent
+ var status = new List<SceneFunctionStatus> ();
+ status.Add (new SceneFunctionStatus () {
+ key = FunctionAttributeKey.Percent,
+ value = commonNew.CurtainProress.ToString (),
+ });
+
+ mSceneFunction.status = status;
+ functions.Add (mSceneFunction);
+ } else if (common.Type == DeviceType.HVAC || common.Type == DeviceType.ACInfrared) {
+ var commonNew = Newtonsoft.Json.JsonConvert.DeserializeObject<HVAC> (jsonInfo);
+ var mSceneFunction = new SceneFunction ();
+ mSceneFunction.sid = function.sid;
+ //1.on_off
+ var status = new List<SceneFunctionStatus> ();
+ status.Add (new SceneFunctionStatus () {
+ key = FunctionAttributeKey.OnOff,
+ value = commonNew.Power > 0 ? "on" : "off",
+ });
+
+ //2.mode
+ status.Add (new SceneFunctionStatus () {
+ key = FunctionAttributeKey.Mode,
+ value = commonNew.SetModeAttribute,
+ });
+
+ //3.fan
+ status.Add (new SceneFunctionStatus () {
+ key = FunctionAttributeKey.FanSpeed,
+ value = commonNew.SetFanSpeedAttribute,
+ });
+
+ //4.SetTemp
+ status.Add (new SceneFunctionStatus () {
+ key = FunctionAttributeKey.SetTemp,
+ value = commonNew.SetTemperature.ToString(),
+ });
+
+ mSceneFunction.status = status;
+ functions.Add (mSceneFunction);
+
+ //replyBytes = Control.ControlBytesSendHasReturn (Command.SetACMode, device.SubnetID, device.DeviceID, new byte [] {
+ // device.LoopID,
+ // device.TemperatureMode,
+ // device.IndoorTemperature,
+ // device.CoolTemperature,
+ // device.HeatTemperature,
+ // device.AutoTemperature,
+ // device.ChuShiTemperature,
+ // device.RealModeAndFanSpeed,
+ // device.Power,
+ // device.SetMode,
+ // device.SetFanSpeed,
+ // device.SetTemperature,
+ // device.ShaoFanMode});
+
+
+
+ } else if (common.Type == DeviceType.FoolHeat) {
+ var commonNew = Newtonsoft.Json.JsonConvert.DeserializeObject<FoolHeat> (jsonInfo);
+ var mSceneFunction = new SceneFunction ();
+ mSceneFunction.sid = function.sid;
+ //1.on_off
+ var status = new List<SceneFunctionStatus> ();
+ status.Add (new SceneFunctionStatus () {
+ key = FunctionAttributeKey.OnOff,
+ value = commonNew.Status > 0 ? "on" : "off",
+ });
+
+ //2.mode
+ status.Add (new SceneFunctionStatus () {
+ key = FunctionAttributeKey.Mode,
+ value = commonNew.SetModeAttribute,
+ });
+
+ //3.SetTemp
+ status.Add (new SceneFunctionStatus () {
+ key = FunctionAttributeKey.SetTemp,
+ value = commonNew.WorkingTemperature.ToString (),
+ });
+
+ mSceneFunction.status = status;
+ functions.Add (mSceneFunction);
+
+ //var device = Newtonsoft.Json.JsonConvert.DeserializeObject<FoolHeat> (System.Text.Encoding.UTF8.GetString (IO.FileUtils.ReadFile (deviceFilePath)));
+ ////if (device == null) {
+ //// mSendCount--;
+ //// continue;
+ ////}
+ //if (device == null) {
+ // //replyBytes = new byte [] { 0x00 };
+ //} else {
+ // var mSceneFunction = new SceneFunction ();
+ // functions.Add (mSceneFunction);
+ //replyBytes = Control.ControlBytesSendHasReturn (Command.SetFoolHeat, device.SubnetID, device.DeviceID,
+ // new byte [] { device.LoopID, (byte)(device.Status + device.WorkingMode * 16), 0,device.WorkingMode,device.NormalTemperature, device.DayTemperature,
+ // device.NightTemperature, device.AwayTemperature , 0, 0 });
+ //}
+ } else if (common.Type == DeviceType.FanModule) {
+ var commonNew = Newtonsoft.Json.JsonConvert.DeserializeObject<FanModule> (jsonInfo);
+ var mSceneFunction = new SceneFunction ();
+ mSceneFunction.sid = function.sid;
+ //1.on_off
+ var status = new List<SceneFunctionStatus> ();
+ status.Add (new SceneFunctionStatus () {
+ key = FunctionAttributeKey.OnOff,
+ value = commonNew.WindSpeed > 0 ? "on" : "off",
+ });
+
+ //2.FanSpeedPercent
+ status.Add (new SceneFunctionStatus () {
+ key = FunctionAttributeKey.FanSpeedPercent,
+ value = commonNew.WindSpeed.ToString(),
+ });
+
+ mSceneFunction.status = status;
+ functions.Add (mSceneFunction);
+
+ //replyBytes = Control.ControlBytesSendHasReturn (Command.SetSingleLight, device.SubnetID, device.DeviceID, new byte [] { device.LoopID, (byte)device.WindSpeed });
+
+ } else if (common.Type == DeviceType.LogicModule) {
+ //replyBytes = Control.ControlBytesSendHasReturn (Command.SetScene, device.SubnetID, device.DeviceID, new byte [] {
+ //device.AreaID,device.AreaSceneID});
+ } else if (common.Type == DeviceType.UniversalDevice) {//2020-09-02 澧炲姞閫氱敤寮�鍏�
+ var commonNew = Newtonsoft.Json.JsonConvert.DeserializeObject<UniversalDevice> (jsonInfo);
+ var mSceneFunction = new SceneFunction ();
+ mSceneFunction.sid = function.sid;
+ //1.on_off
+ var status = new List<SceneFunctionStatus> ();
+ status.Add (new SceneFunctionStatus () {
+ key = FunctionAttributeKey.OnOff,
+ value = commonNew.SendBytes [1] > 0 ? "on" : "off",
+ });
+
+ mSceneFunction.status = status;
+ functions.Add (mSceneFunction);
+ //replyBytes = Control.ControlBytesSendHasReturn (Command.SetCommonSwitch, device.SubnetID, device.DeviceID, new byte [] { device.SendBytes [0], device.SendBytes [1] });
+ }
+ }
+ } else {
+
+ }
+
+
+ mHDLLinkScene.functions = functions;
+ return mHDLLinkScene;
+ }
+
+
+ #endregion
+
+ #region 鈻� 涓婁紶璁惧鍒楄〃___________________________
+ /// <summary>
+ /// 涓婁紶璁惧鍒楄〃
+ /// </summary>
+ /// <returns></returns>
+ public bool UploadOidAndSidList ()
+ {
+ var res = false;
+ try {
+ IotCloud currentProject = new IotCloud ();
+ var list = GetAllDeviceList ();
+ ConvertOidListToIotStruct (UserConfig.Instance.CurrentRegion.Id, UserConfig.Instance.HomeGateway.gatewayId, list, ref currentProject);
+ //2022-06-21 13:10:07 mac涓嶈兘涓虹┖锛屽惁鍒欎簯绔湁闂
+ foreach (var bean in currentProject.modules.devices) {
+ if (string.IsNullOrEmpty (bean.mac)) {
+ bean.mac = bean.oid;
+ }
+ }
+
+ Utlis.WriteLine ("list: " + list.Count + "currentProject : " + currentProject.functions.devices.Count);
+
+ var revertObj = HttpServerRequest.Current.UploadDeviceOidList (currentProject.modules);
+ if(revertObj.Code == StateCode.SUCCESS) {
+ var revertObj2 = HttpServerRequest.Current.UploadDeviceSidList (currentProject.functions);
+ if (revertObj2.Code == StateCode.SUCCESS) {
+ res = true;
+ } else {
+ IMessageCommon.Current.ShowErrorInfoAlter (revertObj2.Code);
+ }
+ } else {
+ IMessageCommon.Current.ShowErrorInfoAlter (revertObj.Code);
+ }
+ } catch(Exception EX) {
+ Utlis.WriteLine ("catch: " + EX.ToString());
+ }
+ return res;
+ }
+
+ /// <summary>
+ ///
+ /// </summary>
+ /// <returns></returns>
+ public List<Common> GetAllDeviceList ()
+ {
+ List<Common> TargetList = new List<Common> ();
+
+ //鎵惧嚭闇�瑕佹樉绀虹殑璁惧
+ var localEquipments = CommonUtlis.Current.GetAllLocalEquipments ();
+
+ foreach (string deviceFilePath in localEquipments) {
+ try {
+ string [] str = deviceFilePath.Split ('_');
+
+ var commonBytes = FileUtils.ReadFile (deviceFilePath);
+ if (commonBytes.Length == 0) {
+ Utlis.WriteLine ("length loss");
+ continue;
+ }
+ if (commonBytes.Length == 1) {
+ Utlis.WriteLine ("length loss 1");
+ continue;
+ }
+
+ Common commonDevice = Newtonsoft.Json.JsonConvert.DeserializeObject<Common> (System.Text.Encoding.UTF8.GetString (commonBytes));
+
+ if (commonDevice == null) {
+ continue;
+ }
+
+ TargetList.Add (commonDevice);
+ } catch {
+
+ }
+ }
+ return TargetList;
+ }
/// <summary>
@@ -35,35 +735,24 @@
/// </summary>
/// <param name="moduleCommon">妯″潡璁惧</param>
/// <returns></returns>
- public List<Sid> ConvertToSidListToIotCloud (string sOid, Common moduleCommon)
+ public List<Sid> ConvertToSidListToIotCloud (string sOid, Common loopCommon)
{
- List<Sid> tmpResult = new List<Sid> ();
+ List<Sid> sidList = new List<Sid> ();
try {
- if (moduleCommon != null && moduleCommon.LoopCount > 0) {
- for (int intI = 0; intI < moduleCommon.LoopCount; intI++) {
- //byte BigType = moduleCommon.bytSimpleParam [0 + intI * 3];
- //byte SmallType = moduleCommon.bytSimpleParam [1 + intI * 3];
- int Count = moduleCommon.LoopCount;
- if (Count > 0) {
- for (int j = 1; j <= Count; j++) {
- //妯″潡閲岄潰鐨勫崟涓洖璺�
- Common deviceCommon = new Common ();
- Sid tmpSid = new Sid ();
- tmpSid.sid = FormingNewSid (sOid, deviceCommon);
- tmpSid.oid = sOid;
- tmpSid.name = deviceCommon.Name;
+ Sid tmpSid = new Sid ();
+ tmpSid.sid = FormingNewSid (sOid, loopCommon);
+ tmpSid.oid = sOid;
+ tmpSid.name = loopCommon.Name;
- SidObject tmp = UpdateSidAttributesToDeviceList (deviceCommon, sOid);
- tmpSid.attributes = tmp.attributes;//UpdateSidAttributesToDeviceList(onlineDevice.DeviceType, sOid, j, BigType, SmallType, ref spk);
- tmpSid.spk = tmp.spk;
- tmpResult.Add (tmpSid);
- }
- }
- }
- }
- return tmpResult;
+ SidObject tmp = UpdateSidAttributesToDeviceList (loopCommon, sOid);
+ tmpSid.attributes = tmp.attributes;
+ //UpdateSidAttributesToDeviceList(onlineDevice.DeviceType, sOid, j, BigType, SmallType, ref spk);
+ tmpSid.spk = tmp.spk;
+ sidList.Add (tmpSid);
+
+ return sidList;
} catch (Exception) {
- return tmpResult;
+ return sidList;
}
}
@@ -74,26 +763,18 @@
/// <param name="onlineDevices"></param>
/// <param name="gatewayId"></param>
/// <param name="currentProject"></param>
- public void ConvertOidListToIotStruct (string homeId, string gatewayId, List<Common> moduleCommonList, ref IotCloud currentProject)
+ public void ConvertOidListToIotStruct (string homeId, string gatewayId, List<Common> loopCommonList, ref IotCloud currentProject)
{
try {
//step 1 杞崲绫诲瀷
Sids functionList = new Sids();
List<Sid> tmpFunction = new List<Sid> ();
- //step 2 杞崲绫诲瀷
- Oids mOidList = ConvertToOidListToIotCloud (moduleCommonList, ref tmpFunction);
- if (currentProject.modules == null || currentProject.modules.devices == null || currentProject.modules.devices.Count == 0) {
- currentProject.modules = mOidList;
- } else {
- foreach (Oid tmpModule in mOidList.devices) {
- Oid tmpFind = currentProject.modules.devices.Find (P => P.mac.Equals (tmpModule.mac));
- if (tmpFind == null) currentProject.modules.devices.Add (tmpModule);
- }
- }
+ //step 2 杞崲鐢熸垚Oids鍒楄〃鍜宻id 璁惧鍒楄〃
+ Oids mOidList = ConvertToOidListToIotCloud (loopCommonList, ref tmpFunction);
mOidList.homeId = homeId;
-
+ //step 3
functionList.devices = new List<Sid> ();
functionList.homeId = homeId;
functionList.gatewayId = gatewayId;
@@ -115,31 +796,46 @@
/// </summary>
/// <param name="onlineDevices"></param>
/// <returns></returns>
- public Oids ConvertToOidListToIotCloud (List<Common> moduleCommonList, ref List<Sid> functionLists)
+ public Oids ConvertToOidListToIotCloud (List<Common> loopCommonListlolooloopl, ref List<Sid> functionLists)
{
- Oids tmpResult = new Oids ();
+ Oids mOidsList = new Oids ();
try {
- tmpResult.devices = new List<Oid> ();
+ mOidsList.devices = new List<Oid> ();
//HDLSysPF.IniDeviceChannelRemark (); //鏁寸悊鍏ㄩ儴璁惧澶囨敞鍒扮紦瀛樺垪琛�
- foreach (Common tmp in moduleCommonList) {
- Oid tmpOid = new Oid ();
- tmpOid.protocolType = "bus";
- tmpOid.device_name = tmp.Name;
- tmpOid.oid = FormingNewOid (tmp.Type);
- tmpOid.addresses = string.Format ("{0}{1}", tmp.SubnetID.ToString ("X2"), tmp.DeviceID.ToString ("X2"));
- tmpOid.device_model = tmp.Type.ToString ();
- tmpOid.fw_version = "";
- tmpOid.deviceType = tmp.Type.ToString ();
- tmpOid.hw_info = "";
- tmpOid.mac = tmp.MAC;
- tmpResult.devices.Add (tmpOid);
+ foreach (Common tmp in loopCommonListlolooloopl) {
+ //1.deviceType鏍囪瘑 浜戠鏄痠nt绫诲瀷
+ var deviceType = ((int)tmp.Type);
+ //2.addresses鏍囪瘑 瀛愮綉鍙枫�佽澶囧彿
+ var addresses = string.Format ("{0}{1}", tmp.SubnetID.ToString ("X2"), tmp.DeviceID.ToString ("X2"));
+ //3.鍒ゆ柇褰撳墠鍥炶矾璁惧涔嬪墠鏄惁鐢熸垚杩囩浉鍚屾ā鍧楃殑oid锛屽瓨鍦ㄥ垯鍙栦箣鍓嶇殑oid 娌℃湁鍒欏垱寤烘柊澧炴柊鐨刼id
+ var deviceOid = mOidsList.devices.Find (o => o.deviceType == deviceType && o.addresses == addresses);
+ if (deviceOid == null) {
+ //3.1娌℃湁鍒欏垱寤烘柊澧炴柊鐨刼id
+ Oid tmpOid = new Oid ();
+ tmpOid.protocolType = "bus";
+ tmpOid.device_name = tmp.Type.ToString ();
+ tmpOid.oid = FormingNewOid (tmp);
+ tmpOid.addresses = addresses;
+ tmpOid.device_model = tmp.Type.ToString ();
+ tmpOid.fw_version = "";
+ tmpOid.deviceType = deviceType;
+ tmpOid.hw_info = "";
+ tmpOid.mac = tmp.MAC;
+ mOidsList.devices.Add (tmpOid);
- functionLists.AddRange (ConvertToSidListToIotCloud (tmpOid.oid, tmp));
+ functionLists.AddRange (ConvertToSidListToIotCloud (tmpOid.oid, tmp));
+
+ //Utlis.WriteLine ("鏂扮殑妯″潡锛屾柊鐨勭殑OID锛�" + tmpOid.addresses + " deviceType:" + tmpOid.deviceType);
+ } else {
+ //3.2瀛樺湪鍒欏彇涔嬪墠鐨刼id
+ functionLists.AddRange (ConvertToSidListToIotCloud (deviceOid.oid, tmp));
+ //Utlis.WriteLine ("鐩稿悓鐨勬ā鍧楋紝鍙栦箣鍓嶇殑OID锛�" + deviceOid.addresses + " deviceType:" + deviceOid.deviceType);
+ }
+
}
- return tmpResult;
+ return mOidsList;
} catch (Exception ex) {
- return tmpResult;
- //throw;
+ return mOidsList;
}
}
@@ -192,23 +888,30 @@
/// <summary>
/// 鐢熸垚璁惧Oid
/// </summary>
- /// <param name="iDeviceType"></param>
+ /// <param name="common"></param>
/// <returns></returns>
- public string FormingNewOid (DeviceType deviceType)
+ public string FormingNewOid (Common common)
{
string sOid = "";
try {
//1.鐢熸垚 鍘傚晢 + 閫氳鏂瑰紡
string sOidBeginsWith = "000101";//鍘傚晢 + 閫氳鏂瑰紡
- //2.鐢熸垚浜у搧鏃堕棿鎴�
- long sTimeSp = ConvertDateTimeLong (); //浠�2020骞�1鏈�1鏃ョ畻鍑虹殑鏃堕棿鎴�0.1s涓哄崟浣�
+
+ //****************************
+ ////2.鐢熸垚浜у搧鏃堕棿鎴�
+ //long sTimeSp = ConvertDateTimeLong (); //浠�2020骞�1鏈�1鏃ョ畻鍑虹殑鏃堕棿鎴�0.1s涓哄崟浣�
+ //string sTimeSpan = "";
+ //ConvertIntToByteArray (sTimeSp, ref sTimeSpan);
+ //if (sTimeSpan.Length != 8) return sOid;
+ ////寤惰繜10ms
+
+ //2.鏂规浜岋細鐢熸垚浜у搧鏃堕棿鎴筹紙浜戠涓嶈В鏋愶級鍗板害APP鎶婂綋鍓嶄綅缃敼涓�(瀛愮綉鍙枫�佽澶囧彿銆佸ぇ绫诲皬绫�)琛ㄧず锛屼繚璇佽澶囧湪瀛愮綉鍙疯澶囧彿涓嶅彉鐨勬儏鍐典笅 oid鐢熸垚涔熶笉鍙�
string sTimeSpan = "";
- ConvertIntToByteArray (sTimeSp, ref sTimeSpan);
- if (sTimeSpan.Length != 8) return sOid;
- //寤惰繜10ms
+ sTimeSpan = common.SubnetID.ToString ("X2") + common.DeviceID.ToString ("X2") + common.DeviceTypeString;
+ //****************************
//3.鐢熸垚浜у搧绫诲埆
- var productType = GetProductType (deviceType);
+ var productType = GetProductType (common.Type);
sOid = sOidBeginsWith + sTimeSpan + productType;
return sOid;
@@ -403,7 +1106,7 @@
//2.閫氶亾鍙�
string loopIDStr = loopCommon.LoopID.ToString ("X4");
//3.澶у皬绫诲埆
- string bigMinStr = loopCommon.BigClass.ToString ("X2") + loopCommon.MinClass.ToString ("X2");
+ string bigMinStr = loopCommon.DeviceTypeString;
//4.鎷兼帴
sSid = sOid + mPhysicalModelType + loopIDStr + bigMinStr;
return sSid;
@@ -432,82 +1135,137 @@
tmp.oid = sOid;
tmp.sid = sSid;
tmp.name = loopCommon.Name;
- tmp.attributes = new List<Function> ();
+ tmp.attributes = new List<Attribute> ();
tmp.omodel = loopCommon.Type.ToString ();
- //缁х數鍣ㄥ紑鍏崇被
- if (loopCommon.Type == DeviceType.LightSwitch
- || loopCommon.Type == DeviceType.LightEnergySwitch
- || loopCommon.Type == DeviceType.LightEnergySocket
- || loopCommon.Type == DeviceType.LightSwitchSocket
- || loopCommon.Type == DeviceType.LightMixSwitch) {
- tmp.spk = "light.switch";
+ if (loopCommon.Type == DeviceType.UniversalDevice) {
+ //閫氱敤寮�鍏�
+ tmp.spk = SPK.UniversalDevice;
#region on_off
- Function tempFunction = new Function ();
- tempFunction.key = "on_off";
- tempFunction.data_type = "string";
- tempFunction.value = new List<string> ();
- tempFunction.value.Add ("on");
- tempFunction.value.Add ("off");
- tempFunction.max = 1;
- tempFunction.min = 0;
- tmp.attributes.Add (tempFunction);
+ Attribute tempAttribute = new Attribute ();
+ tempAttribute.key = "on_off";
+ tempAttribute.data_type = "string";
+ tempAttribute.value = new List<string> ();
+ tempAttribute.value.Add ("on");
+ tempAttribute.value.Add ("off");
+ tempAttribute.max = 1;
+ tempAttribute.min = 0;
+ tmp.attributes.Add (tempAttribute);
+ #endregion
+
+ }else if (loopCommon.Type == DeviceType.FanModule ) {
+ //椋庢墖
+ tmp.spk = SPK.ElectricFan;
+ #region on_off
+ Attribute tempAttribute = new Attribute ();
+ tempAttribute.key = "on_off";
+ tempAttribute.data_type = "string";
+ tempAttribute.value = new List<string> ();
+ tempAttribute.value.Add ("on");
+ tempAttribute.value.Add ("off");
+ tempAttribute.max = 1;
+ tempAttribute.min = 0;
+ tmp.attributes.Add (tempAttribute);
+ #endregion
+
+ #region volume_level
+ Attribute tempSpeedAttribute = new Attribute ();
+ tempSpeedAttribute.key = FunctionAttributeKey.FanSpeedPercent;
+ tempSpeedAttribute.data_type = "integer";
+ tempSpeedAttribute.value = new List<string> ();
+ tempSpeedAttribute.max = 8;
+ tempSpeedAttribute.min = 0;
+ tmp.attributes.Add (tempSpeedAttribute);
+ #endregion
+
+ } else if (loopCommon.Type == DeviceType.LightSwitch
+ || loopCommon.Type == DeviceType.LightEnergySwitch
+ || loopCommon.Type == DeviceType.LightMixSwitch) {
+ //缁х數鍣ㄥ紑鍏崇被
+ tmp.spk = SPK.LightSwitch;
+ #region on_off
+ Attribute tempAttribute = new Attribute ();
+ tempAttribute.key = "on_off";
+ tempAttribute.data_type = "string";
+ tempAttribute.value = new List<string> ();
+ tempAttribute.value.Add ("on");
+ tempAttribute.value.Add ("off");
+ tempAttribute.max = 1;
+ tempAttribute.min = 0;
+ tmp.attributes.Add (tempAttribute);
+ #endregion
+ }else if (loopCommon.Type == DeviceType.LightEnergySocket
+ || loopCommon.Type == DeviceType.LightSwitchSocket) {
+ //鐢靛櫒 鎻掑骇
+ tmp.spk = SPK.ElectricSocket;
+ #region on_off
+ Attribute tempAttribute = new Attribute ();
+ tempAttribute.key = "on_off";
+ tempAttribute.data_type = "string";
+ tempAttribute.value = new List<string> ();
+ tempAttribute.value.Add ("on");
+ tempAttribute.value.Add ("off");
+ tempAttribute.max = 1;
+ tempAttribute.min = 0;
+ tmp.attributes.Add (tempAttribute);
#endregion
} else if (loopCommon.Type == DeviceType.LightDimming
|| loopCommon.Type == DeviceType.LightCCT
|| loopCommon.Type == DeviceType.LightDALI) {
//璋冨厜绫�
- tmp.spk = "light.dimming";
+ //tmp.spk = "light.dimming";
+ tmp.spk = SPK.LightDimming;
#region on_off
- Function tempFunction = new Function ();
- tempFunction.key = "on_off";
- tempFunction.data_type = "string";
- tempFunction.value = new List<string> ();
- tempFunction.value.Add ("on");
- tempFunction.value.Add ("off");
- tempFunction.max = 1;
- tempFunction.min = 0;
- tmp.attributes.Add (tempFunction);
+ Attribute tempAttribute = new Attribute ();
+ tempAttribute.key = "on_off";
+ tempAttribute.data_type = "string";
+ tempAttribute.value = new List<string> ();
+ tempAttribute.value.Add ("on");
+ tempAttribute.value.Add ("off");
+ tempAttribute.max = 1;
+ tempAttribute.min = 0;
+ tmp.attributes.Add (tempAttribute);
#endregion
#region brightness
- Function tempFunction1 = new Function ();
- tempFunction1.key = "brightness";
- tempFunction1.data_type = "integer";
- tempFunction1.value = new List<string> ();
+ Attribute tempAttribute1 = new Attribute ();
+ tempAttribute1.key = "brightness";
+ tempAttribute1.data_type = "integer";
+ tempAttribute1.value = new List<string> ();
- tempFunction1.max = 100;
- tempFunction1.min = 0;
- tmp.attributes.Add (tempFunction1);
+ tempAttribute1.max = 100;
+ tempAttribute1.min = 0;
+ tmp.attributes.Add (tempAttribute1);
#endregion
#region fade_time
- Function tempFunction3 = new Function ();
- tempFunction3.key = "fade_time";
- tempFunction3.data_type = "integer";
- tempFunction3.value = new List<string> ();
- //tempFunction1.value.Add("percent");
+ Attribute tempAttribute3 = new Attribute ();
+ tempAttribute3.key = "fade_time";
+ tempAttribute3.data_type = "integer";
+ tempAttribute3.value = new List<string> ();
+ //tempAttribute1.value.Add("percent");
//for (int iPercent = 0; iPercent <= 100; iPercent++)
//{
- // tempFunction1.value.Add(iPercent.ToString());
+ // tempAttribute1.value.Add(iPercent.ToString());
//}
- tempFunction3.max = 100;
- tempFunction3.min = 0;
- tmp.attributes.Add (tempFunction3);
+ tempAttribute3.max = 100;
+ tempAttribute3.min = 0;
+ tmp.attributes.Add (tempAttribute3);
#endregion
if (loopCommon.Type == DeviceType.LightCCT || loopCommon.Type == DeviceType.LightDALI)//鑹叉俯绫诲埆
{
- tmp.spk = "light.cct";
+ //tmp.spk = "light.cct";
+ tmp.spk = SPK.LightCCT;
#region cct
- Function tempFunction2 = new Function ();
- tempFunction2.key = "cct";
- tempFunction2.data_type = "integer";
- tempFunction2.value = new List<string> ();
- //tempFunction2.value.Add("warm light ");
- //tempFunction2.value.Add("cold light ");
- tempFunction2.max = 65535;
- tempFunction2.min = 0;
- tmp.attributes.Add (tempFunction2);
+ Attribute tempAttribute2 = new Attribute ();
+ tempAttribute2.key = "cct";
+ tempAttribute2.data_type = "integer";
+ tempAttribute2.value = new List<string> ();
+ //tempAttribute2.value.Add("warm light ");
+ //tempAttribute2.value.Add("cold light ");
+ tempAttribute2.max = 65535;
+ tempAttribute2.min = 0;
+ tmp.attributes.Add (tempAttribute2);
#endregion
}
} else if (loopCommon.Type == DeviceType.LightRGB
@@ -516,98 +1274,102 @@
|| loopCommon.Type == DeviceType.LightRGBandCCT
|| loopCommon.Type == DeviceType.DMX48) {
- tmp.spk = "light.rgb";
+ tmp.spk = SPK.LightRGB;
+ //tmp.spk = "light.rgb";
#region on_off
- Function tempFunction = new Function ();
- tempFunction.key = "on_off";
- tempFunction.data_type = "string";
- tempFunction.value = new List<string> ();
- tempFunction.value.Add ("on");
- tempFunction.value.Add ("off");
- tempFunction.max = 1;
- tempFunction.min = 0;
- tmp.attributes.Add (tempFunction);
+ Attribute tempAttribute = new Attribute ();
+ tempAttribute.key = "on_off";
+ tempAttribute.data_type = "string";
+ tempAttribute.value = new List<string> ();
+ tempAttribute.value.Add ("on");
+ tempAttribute.value.Add ("off");
+ tempAttribute.max = 1;
+ tempAttribute.min = 0;
+ tmp.attributes.Add (tempAttribute);
#endregion
#region brightness
- Function tempFunction2 = new Function ();
- tempFunction2.key = "brightness";
- tempFunction2.data_type = "integer";
- tempFunction2.value = new List<string> ();
- tempFunction2.max = 100;
- tempFunction2.min = 0;
- tmp.attributes.Add (tempFunction2);
+ Attribute tempAttribute2 = new Attribute ();
+ tempAttribute2.key = "brightness";
+ tempAttribute2.data_type = "integer";
+ tempAttribute2.value = new List<string> ();
+ tempAttribute2.max = 100;
+ tempAttribute2.min = 0;
+ tmp.attributes.Add (tempAttribute2);
#endregion
if (loopCommon.Type == DeviceType.LightRGBW) {
- tmp.spk = "light.rgbw";
+ //tmp.spk = "light.rgbw";
+ tmp.spk = SPK.LightRGBW;
#region color
- Function tempFunction3 = new Function ();
- tempFunction3.key = "rgb";
- tempFunction3.data_type = "integer";
- tempFunction3.value = new List<string> ();
- //tempFunction2.value.Add("red");
- //tempFunction2.value.Add("green");
- //tempFunction2.value.Add("blue");
- tempFunction3.max = 255;
- tempFunction3.min = 0;
- tmp.attributes.Add (tempFunction3);
+ Attribute tempAttribute3 = new Attribute ();
+ tempAttribute3.key = "rgb";
+ tempAttribute3.data_type = "integer";
+ tempAttribute3.value = new List<string> ();
+ //tempAttribute2.value.Add("red");
+ //tempAttribute2.value.Add("green");
+ //tempAttribute2.value.Add("blue");
+ tempAttribute3.max = 255;
+ tempAttribute3.min = 0;
+ tmp.attributes.Add (tempAttribute3);
#endregion
} else {
#region color
- Function tempFunction3 = new Function ();
- tempFunction3.key = "rgb";
- tempFunction3.data_type = "integer";
- tempFunction3.value = new List<string> ();
- tempFunction3.min = 0;
- tmp.attributes.Add (tempFunction3);
+ Attribute tempAttribute3 = new Attribute ();
+ tempAttribute3.key = "rgb";
+ tempAttribute3.data_type = "integer";
+ tempAttribute3.value = new List<string> ();
+ tempAttribute3.min = 0;
+ tmp.attributes.Add (tempAttribute3);
#endregion
}
if (loopCommon.Type == DeviceType.LightRGBandCCT) {
#region CCT
- Function tempFunctionCCT = new Function ();
- tempFunctionCCT.key = "cct";
- tempFunctionCCT.data_type = "integer";
- tempFunctionCCT.value = new List<string> ();
- //tempFunction2.value.Add("red");
- //tempFunction2.value.Add("green");
- //tempFunction2.value.Add("blue");
- tempFunctionCCT.max = 65535;
- tempFunctionCCT.min = 0;
- tmp.attributes.Add (tempFunctionCCT);
+ Attribute tempAttributeCCT = new Attribute ();
+ tempAttributeCCT.key = "cct";
+ tempAttributeCCT.data_type = "integer";
+ tempAttributeCCT.value = new List<string> ();
+ //tempAttribute2.value.Add("red");
+ //tempAttribute2.value.Add("green");
+ //tempAttribute2.value.Add("blue");
+ tempAttributeCCT.max = 65535;
+ tempAttributeCCT.min = 0;
+ tmp.attributes.Add (tempAttributeCCT);
#endregion
}
} else if (loopCommon.Type == DeviceType.CurtainModel || loopCommon.Type == DeviceType.CurtainRoller || loopCommon.Type == DeviceType.CurtainTrietex) {
- tmp.spk = "curtain.switch";
+ //tmp.spk = "curtain.switch";
+ tmp.spk = SPK.CurtainSwitch;
#region on_off
- Function tempFunction = new Function ();
- tempFunction.key = "on_off";
- tempFunction.data_type = "string";
- tempFunction.value = new List<string> ();
- tempFunction.value.Add ("on");
- tempFunction.value.Add ("off");
- tempFunction.value.Add ("stop");
- tempFunction.max = 2;
- tempFunction.min = 0;
- tmp.attributes.Add (tempFunction);
+ Attribute tempAttribute = new Attribute ();
+ tempAttribute.key = "on_off";
+ tempAttribute.data_type = "string";
+ tempAttribute.value = new List<string> ();
+ tempAttribute.value.Add ("on");
+ tempAttribute.value.Add ("off");
+ tempAttribute.value.Add ("stop");
+ tempAttribute.max = 2;
+ tempAttribute.min = 0;
+ tmp.attributes.Add (tempAttribute);
#endregion
if (loopCommon.Type == DeviceType.CurtainRoller || loopCommon.Type == DeviceType.CurtainTrietex)//鎵�鏈夊嵎甯樻帶鍒跺櫒
{
- tmp.spk = "curtain.trietex";
+ tmp.spk = SPK.CurtainTrietex;
+ //tmp.spk = "curtain.trietex";
#region openlevel
- Function tempFunction1 = new Function ();
- tempFunction1.key = "percent";
- tempFunction1.data_type = "integer";
- tempFunction1.value = new List<string> ();
- //tempFunction1.value.Add("percent");
- tempFunction1.max = 100;
- tempFunction1.min = 0;
- tmp.attributes.Add (tempFunction1);
+ Attribute tempAttribute1 = new Attribute ();
+ tempAttribute1.key = "percent";
+ tempAttribute1.data_type = "integer";
+ tempAttribute1.value = new List<string> ();
+ //tempAttribute1.value.Add("percent");
+ tempAttribute1.max = 100;
+ tempAttribute1.min = 0;
+ tmp.attributes.Add (tempAttribute1);
#endregion
}
} else if (loopCommon.Type == DeviceType.ACPanel
@@ -618,103 +1380,104 @@
|| loopCommon.Type == DeviceType.HVAC) {
//绌鸿皟绫�
- tmp.spk = "ac.standard";
+ tmp.spk = SPK.AcStandard;
+ //tmp.spk = "ac.standard";
#region on_off
- Function tempFunction = new Function ();
- tempFunction.key = "on_off";
- tempFunction.data_type = "string";
- tempFunction.value = new List<string> ();
- tempFunction.value.Add ("on");
- tempFunction.value.Add ("off");
- tempFunction.max = 1;
- tempFunction.min = 0;
- tmp.attributes.Add (tempFunction);
+ Attribute tempAttribute = new Attribute ();
+ tempAttribute.key = "on_off";
+ tempAttribute.data_type = "string";
+ tempAttribute.value = new List<string> ();
+ tempAttribute.value.Add ("on");
+ tempAttribute.value.Add ("off");
+ tempAttribute.max = 1;
+ tempAttribute.min = 0;
+ tmp.attributes.Add (tempAttribute);
#endregion
#region mode
- Function tempFunction1 = new Function ();
- tempFunction1.key = "mode";
- tempFunction1.data_type = "integer";
- tempFunction1.value = new List<string> ();
- tempFunction1.value.Add ("cool");
- tempFunction1.value.Add ("heat");
- tempFunction1.value.Add ("fan");
- tempFunction1.value.Add ("auto");
- tempFunction1.value.Add ("dry");
+ Attribute tempAttribute1 = new Attribute ();
+ tempAttribute1.key = "mode";
+ tempAttribute1.data_type = "integer";
+ tempAttribute1.value = new List<string> ();
+ tempAttribute1.value.Add ("cool");
+ tempAttribute1.value.Add ("heat");
+ tempAttribute1.value.Add ("fan");
+ tempAttribute1.value.Add ("auto");
+ tempAttribute1.value.Add ("dry");
- tempFunction1.max = 4;
- tempFunction1.min = 0;
- tmp.attributes.Add (tempFunction1);
+ tempAttribute1.max = 4;
+ tempAttribute1.min = 0;
+ tmp.attributes.Add (tempAttribute1);
#endregion
#region fan
- Function tempFunction2 = new Function ();
- tempFunction2.key = "fan";
- tempFunction2.data_type = "integer";
- tempFunction2.value = new List<string> ();
- tempFunction2.value.Add ("high");
- tempFunction2.value.Add ("medium");
- tempFunction2.value.Add ("low");
- tempFunction2.value.Add ("auto");
- tempFunction2.max = 3;
- tempFunction2.min = 0;
- tmp.attributes.Add (tempFunction2);
+ Attribute tempAttribute2 = new Attribute ();
+ tempAttribute2.key = "fan";
+ tempAttribute2.data_type = "integer";
+ tempAttribute2.value = new List<string> ();
+ tempAttribute2.value.Add ("high");
+ tempAttribute2.value.Add ("medium");
+ tempAttribute2.value.Add ("low");
+ tempAttribute2.value.Add ("auto");
+ tempAttribute2.max = 3;
+ tempAttribute2.min = 0;
+ tmp.attributes.Add (tempAttribute2);
#endregion
#region temp
- Function tempFunction3 = new Function ();
- tempFunction3.key = "set_temp";
+ Attribute tempAttribute3 = new Attribute ();
+ tempAttribute3.key = "set_temp";
//2020 08 11 hvac 娓╁害鎺у埗 1掳-> int 0.5掳->float
//if (HVACModuleDeviceTypeList.HDLHVACwithAcControlHighPrecision.Contains(DevOnLineTmp.DeviceType))
//{
//20201224 璁剧疆娓╁害鏁版嵁绫诲瀷缁熶竴float 浼熷崡鍚庣画ai+鏁版嵁绫诲瀷缃戝叧澶勭悊
- tempFunction3.data_type = "float";
+ tempAttribute3.data_type = "float";
//}
//else
//{
- // tempFunction3.data_type = "integer";
+ // tempAttribute3.data_type = "integer";
//}
- tempFunction3.value = new List<string> ();
- tempFunction3.max = 30;
- tempFunction3.min = 16;
- tmp.attributes.Add (tempFunction3);
+ tempAttribute3.value = new List<string> ();
+ tempAttribute3.max = 30;
+ tempAttribute3.min = 16;
+ tmp.attributes.Add (tempAttribute3);
#endregion
#region temp_step
- Function tempFunction5 = new Function ();
- tempFunction5.key = "set_temp_step";
- tempFunction5.data_type = "string";
- tempFunction5.value = new List<string> ();
- tempFunction5.value.Add ("up");
- tempFunction5.value.Add ("down");
- tempFunction5.max = 1;
- tempFunction5.min = 0;
- tmp.attributes.Add (tempFunction5);
+ Attribute tempAttribute5 = new Attribute ();
+ tempAttribute5.key = "set_temp_step";
+ tempAttribute5.data_type = "string";
+ tempAttribute5.value = new List<string> ();
+ tempAttribute5.value.Add ("up");
+ tempAttribute5.value.Add ("down");
+ tempAttribute5.max = 1;
+ tempAttribute5.min = 0;
+ tmp.attributes.Add (tempAttribute5);
#endregion
#region room_temp
- Function tempFunction6 = new Function ();
- tempFunction6.key = "room_temp";
- tempFunction6.data_type = "float";
- tempFunction6.value = new List<string> ();
- tempFunction6.max = 50;
- tempFunction6.min = -50;
- tmp.attributes.Add (tempFunction6);
+ Attribute tempAttribute6 = new Attribute ();
+ tempAttribute6.key = "room_temp";
+ tempAttribute6.data_type = "float";
+ tempAttribute6.value = new List<string> ();
+ tempAttribute6.max = 50;
+ tempAttribute6.min = -50;
+ tmp.attributes.Add (tempAttribute6);
#endregion
#region swing
- Function tempFunction4 = new Function ();
- tempFunction4.key = "swing";
- tempFunction4.data_type = "string";
- tempFunction4.value = new List<string> ();
- tempFunction4.value.Add ("up_down");
- //tempFunction4.value.Add("down");
- tempFunction4.value.Add ("left_right");
- //tempFunction4.value.Add("right");
- tempFunction4.value.Add ("stop");
- tempFunction4.max = 3;
- tempFunction4.min = 0;
- tmp.attributes.Add (tempFunction4);
+ Attribute tempAttribute4 = new Attribute ();
+ tempAttribute4.key = "swing";
+ tempAttribute4.data_type = "string";
+ tempAttribute4.value = new List<string> ();
+ tempAttribute4.value.Add ("up_down");
+ //tempAttribute4.value.Add("down");
+ tempAttribute4.value.Add ("left_right");
+ //tempAttribute4.value.Add("right");
+ tempAttribute4.value.Add ("stop");
+ tempAttribute4.max = 3;
+ tempAttribute4.min = 0;
+ tmp.attributes.Add (tempAttribute4);
#endregion
#region lock
@@ -723,67 +1486,68 @@
#endregion
} else if (loopCommon.Type == DeviceType.FoolHeat
|| loopCommon.Type == DeviceType.FoolHeatPanel) {
- tmp.spk = "floorHeat.standard";
+ tmp.spk = SPK.FloorHeatStandard;
+ //tmp.spk = "floorHeat.standard";
#region on_off
- Function tempFunction = new Function ();
- tempFunction.key = "on_off";
- tempFunction.data_type = "string";
- tempFunction.value = new List<string> ();
- tempFunction.value.Add ("on");
- tempFunction.value.Add ("off");
- tempFunction.max = 1;
- tempFunction.min = 0;
- tmp.attributes.Add (tempFunction);
+ Attribute tempAttribute = new Attribute ();
+ tempAttribute.key = "on_off";
+ tempAttribute.data_type = "string";
+ tempAttribute.value = new List<string> ();
+ tempAttribute.value.Add ("on");
+ tempAttribute.value.Add ("off");
+ tempAttribute.max = 1;
+ tempAttribute.min = 0;
+ tmp.attributes.Add (tempAttribute);
#endregion
#region mode
- Function tempFunction1 = new Function ();
- tempFunction1.key = "mode";
- tempFunction1.data_type = "string";
- tempFunction1.value = new List<string> ();
- tempFunction1.value.Add ("day");
- tempFunction1.value.Add ("night");
- tempFunction1.value.Add ("away");
- tempFunction1.value.Add ("normal");
- tempFunction1.value.Add ("timer");
- tempFunction1.max = 4;
- tempFunction1.min = 0;
- tmp.attributes.Add (tempFunction1);
+ Attribute tempAttribute1 = new Attribute ();
+ tempAttribute1.key = "mode";
+ tempAttribute1.data_type = "string";
+ tempAttribute1.value = new List<string> ();
+ tempAttribute1.value.Add ("day");
+ tempAttribute1.value.Add ("night");
+ tempAttribute1.value.Add ("away");
+ tempAttribute1.value.Add ("normal");
+ tempAttribute1.value.Add ("timer");
+ tempAttribute1.max = 4;
+ tempAttribute1.min = 0;
+ tmp.attributes.Add (tempAttribute1);
#endregion
#region temp
- Function tempFunction3 = new Function ();
- tempFunction3.key = "set_temp";
- tempFunction3.data_type = "float";
- tempFunction3.value = new List<string> ();
- //tempFunction3.value.Add("up");
- //tempFunction3.value.Add("down");
- //tempFunction3.value.Add("value");
- tempFunction3.max = 35;
- tempFunction3.min = 0;
- tmp.attributes.Add (tempFunction3);
+ Attribute tempAttribute3 = new Attribute ();
+ tempAttribute3.key = "set_temp";
+ tempAttribute3.data_type = "float";
+ tempAttribute3.value = new List<string> ();
+ //tempAttribute3.value.Add("up");
+ //tempAttribute3.value.Add("down");
+ //tempAttribute3.value.Add("value");
+ tempAttribute3.max = 35;
+ tempAttribute3.min = 0;
+ tmp.attributes.Add (tempAttribute3);
#endregion
#region temp
- Function tempFunction4 = new Function ();
- tempFunction4.key = "set_temp_step";
- tempFunction4.data_type = "string";
- tempFunction4.value = new List<string> ();
- tempFunction4.value.Add ("up");
- tempFunction4.value.Add ("down");
- tempFunction4.max = 1;
- tempFunction4.min = 0;
- tmp.attributes.Add (tempFunction4);
+ Attribute tempAttribute4 = new Attribute ();
+ tempAttribute4.key = "set_temp_step";
+ tempAttribute4.data_type = "string";
+ tempAttribute4.value = new List<string> ();
+ tempAttribute4.value.Add ("up");
+ tempAttribute4.value.Add ("down");
+ tempAttribute4.max = 1;
+ tempAttribute4.min = 0;
+ tmp.attributes.Add (tempAttribute4);
#endregion
#region room_temp
- Function tempFunction5 = new Function ();
- tempFunction5.key = "room_temp";
- tempFunction5.data_type = "float";
- tempFunction5.value = new List<string> ();
- tempFunction5.max = 50;
- tempFunction5.min = -50;
- tmp.attributes.Add (tempFunction5);
+ Attribute tempAttribute5 = new Attribute ();
+ tempAttribute5.key = "room_temp";
+ tempAttribute5.data_type = "float";
+ tempAttribute5.value = new List<string> ();
+ tempAttribute5.max = 50;
+ tempAttribute5.min = -50;
+ tmp.attributes.Add (tempAttribute5);
#endregion
#region lock
@@ -793,458 +1557,467 @@
} else if (loopCommon.Type == DeviceType.MusicA31
|| loopCommon.Type == DeviceType.MusicModel
|| loopCommon.Type == DeviceType.MusicPanel) {
- tmp.spk = "music.standard";
+ tmp.spk = SPK.MusicStandard;
+ //tmp.spk = "music.standard";
// on_off volume song_step audio list_channel mode song_num special_song volume_level
#region on_off
- Function tempFunction = new Function ();
- tempFunction.key = "on_off";
- tempFunction.data_type = "string";
- tempFunction.value = new List<string> ();
- tempFunction.value.Add ("play");
- tempFunction.value.Add ("pause");
+ Attribute tempAttribute = new Attribute ();
+ tempAttribute.key = "on_off";
+ tempAttribute.data_type = "string";
+ tempAttribute.value = new List<string> ();
+ tempAttribute.value.Add ("play");
+ tempAttribute.value.Add ("pause");
- //tempFunction.value.Add("play");
- //tempFunction.value.Add("stop");
- //tempFunction.value.Add("pause");
+ //tempAttribute.value.Add("play");
+ //tempAttribute.value.Add("stop");
+ //tempAttribute.value.Add("pause");
//play stop pause
- tempFunction.max = 2;
- tempFunction.min = 0;
- tmp.attributes.Add (tempFunction);
+ tempAttribute.max = 2;
+ tempAttribute.min = 0;
+ tmp.attributes.Add (tempAttribute);
#endregion
#region volume
- Function tempFunction1 = new Function ();
- tempFunction1.key = "volume";
- tempFunction1.data_type = "integer";
- tempFunction1.value = new List<string> ();
- //tempFunction1.value.Add("percent");
- tempFunction1.max = 100;
- tempFunction1.min = 0;
- tmp.attributes.Add (tempFunction1);
+ Attribute tempAttribute1 = new Attribute ();
+ tempAttribute1.key = "volume";
+ tempAttribute1.data_type = "integer";
+ tempAttribute1.value = new List<string> ();
+ //tempAttribute1.value.Add("percent");
+ tempAttribute1.max = 100;
+ tempAttribute1.min = 0;
+ tmp.attributes.Add (tempAttribute1);
#endregion
#region volume_step
- Function tempFunction9 = new Function ();
- tempFunction9.key = "volume_step";
- tempFunction9.data_type = "string";
- tempFunction9.value = new List<string> ();
- tempFunction9.value.Add ("up");
- tempFunction9.value.Add ("down");
- tempFunction9.max = 1;
- tempFunction9.min = 0;
- tmp.attributes.Add (tempFunction9);
+ Attribute tempAttribute9 = new Attribute ();
+ tempAttribute9.key = "volume_step";
+ tempAttribute9.data_type = "string";
+ tempAttribute9.value = new List<string> ();
+ tempAttribute9.value.Add ("up");
+ tempAttribute9.value.Add ("down");
+ tempAttribute9.max = 1;
+ tempAttribute9.min = 0;
+ tmp.attributes.Add (tempAttribute9);
#endregion
#region volume_level
- Function tempFunction10 = new Function ();
- tempFunction10.key = "volume_level";
- tempFunction10.data_type = "integer";
- tempFunction10.value = new List<string> ();
- //tempFunction1.value.Add("percent");
- tempFunction10.max = 10;
- tempFunction10.min = 0;
- tmp.attributes.Add (tempFunction10);
+ Attribute tempAttribute10 = new Attribute ();
+ tempAttribute10.key = "volume_level";
+ tempAttribute10.data_type = "integer";
+ tempAttribute10.value = new List<string> ();
+ //tempAttribute1.value.Add("percent");
+ tempAttribute10.max = 10;
+ tempAttribute10.min = 0;
+ tmp.attributes.Add (tempAttribute10);
#endregion
#region volume_level_step
- Function tempFunction11 = new Function ();
- tempFunction11.key = "volume_level_step";
- tempFunction11.data_type = "string";
- tempFunction11.value = new List<string> ();
- tempFunction11.value.Add ("up");
- tempFunction11.value.Add ("down");
- tempFunction11.max = 1;
- tempFunction11.min = 0;
- tmp.attributes.Add (tempFunction11);
+ Attribute tempAttribute11 = new Attribute ();
+ tempAttribute11.key = "volume_level_step";
+ tempAttribute11.data_type = "string";
+ tempAttribute11.value = new List<string> ();
+ tempAttribute11.value.Add ("up");
+ tempAttribute11.value.Add ("down");
+ tempAttribute11.max = 1;
+ tempAttribute11.min = 0;
+ tmp.attributes.Add (tempAttribute11);
#endregion
#region treble
- Function tempFunction14 = new Function ();
- tempFunction14.key = "treble";
- tempFunction14.data_type = "integer";
- tempFunction14.max = 10;
- tempFunction14.min = -10;
- tmp.attributes.Add (tempFunction14);
+ Attribute tempAttribute14 = new Attribute ();
+ tempAttribute14.key = "treble";
+ tempAttribute14.data_type = "integer";
+ tempAttribute14.max = 10;
+ tempAttribute14.min = -10;
+ tmp.attributes.Add (tempAttribute14);
#endregion
#region treble_step
- Function tempFunction12 = new Function ();
- tempFunction12.key = "treble_step";
- tempFunction12.data_type = "string";
- tempFunction12.value = new List<string> ();
- tempFunction12.value.Add ("up");
- tempFunction12.value.Add ("down");
- tempFunction12.max = 1;
- tempFunction12.min = 0;
- tmp.attributes.Add (tempFunction12);
+ Attribute tempAttribute12 = new Attribute ();
+ tempAttribute12.key = "treble_step";
+ tempAttribute12.data_type = "string";
+ tempAttribute12.value = new List<string> ();
+ tempAttribute12.value.Add ("up");
+ tempAttribute12.value.Add ("down");
+ tempAttribute12.max = 1;
+ tempAttribute12.min = 0;
+ tmp.attributes.Add (tempAttribute12);
#endregion
#region bass
- Function tempFunction15 = new Function ();
- tempFunction15.key = "bass";
- tempFunction15.data_type = "integer";
- tempFunction15.max = 10;
- tempFunction15.min = -10;
- tmp.attributes.Add (tempFunction15);
+ Attribute tempAttribute15 = new Attribute ();
+ tempAttribute15.key = "bass";
+ tempAttribute15.data_type = "integer";
+ tempAttribute15.max = 10;
+ tempAttribute15.min = -10;
+ tmp.attributes.Add (tempAttribute15);
#endregion
#region bass_step
- Function tempFunction13 = new Function ();
- tempFunction13.key = "bass_step";
- tempFunction13.data_type = "string";
- tempFunction13.value = new List<string> ();
- tempFunction13.value.Add ("up");
- tempFunction13.value.Add ("down");
- tempFunction13.max = 1;
- tempFunction13.min = 0;
- tmp.attributes.Add (tempFunction13);
+ Attribute tempAttribute13 = new Attribute ();
+ tempAttribute13.key = "bass_step";
+ tempAttribute13.data_type = "string";
+ tempAttribute13.value = new List<string> ();
+ tempAttribute13.value.Add ("up");
+ tempAttribute13.value.Add ("down");
+ tempAttribute13.max = 1;
+ tempAttribute13.min = 0;
+ tmp.attributes.Add (tempAttribute13);
#endregion
#region mode
- Function tempFunction5 = new Function ();
- tempFunction5.key = "mode";
- tempFunction5.data_type = "string";
- tempFunction5.value = new List<string> ();
+ Attribute tempAttribute5 = new Attribute ();
+ tempAttribute5.key = "mode";
+ tempAttribute5.data_type = "string";
+ tempAttribute5.value = new List<string> ();
//singel/single_circle/order/all
//single/single_cycle/order/list_cycle/random
- tempFunction5.value.Add ("single");
- tempFunction5.value.Add ("single_cycle");
- tempFunction5.value.Add ("order");
- tempFunction5.value.Add ("list_cycle");
- tempFunction5.value.Add ("random");
- tempFunction5.max = 3;
- tempFunction5.min = 0;
- tmp.attributes.Add (tempFunction5);
+ tempAttribute5.value.Add ("single");
+ tempAttribute5.value.Add ("single_cycle");
+ tempAttribute5.value.Add ("order");
+ tempAttribute5.value.Add ("list_cycle");
+ tempAttribute5.value.Add ("random");
+ tempAttribute5.max = 3;
+ tempAttribute5.min = 0;
+ tmp.attributes.Add (tempAttribute5);
#endregion
#region source
//1 = SD, 2 = External Input, 3 = FTP, 4 = Radio
//sdcard/external_input/ftp/radio
- Function tempFunction3 = new Function ();
- tempFunction3.key = "source";
- tempFunction3.data_type = "string";
- tempFunction3.value = new List<string> ();
- tempFunction3.value.Add ("sdcard");
- tempFunction3.value.Add ("audio_in");
- tempFunction3.value.Add ("ftp");
- tempFunction3.value.Add ("radio");
- tempFunction3.value.Add ("bluetooth");
- tempFunction3.max = 3;
- tempFunction3.min = 0;
- tmp.attributes.Add (tempFunction3);
+ Attribute tempAttribute3 = new Attribute ();
+ tempAttribute3.key = "source";
+ tempAttribute3.data_type = "string";
+ tempAttribute3.value = new List<string> ();
+ tempAttribute3.value.Add ("sdcard");
+ tempAttribute3.value.Add ("audio_in");
+ tempAttribute3.value.Add ("ftp");
+ tempAttribute3.value.Add ("radio");
+ tempAttribute3.value.Add ("bluetooth");
+ tempAttribute3.max = 3;
+ tempAttribute3.min = 0;
+ tmp.attributes.Add (tempAttribute3);
#endregion
#region song_step
- Function tempFunction2 = new Function ();
- tempFunction2.key = "song_step";
- tempFunction2.data_type = "string";
- tempFunction2.value = new List<string> ();
- tempFunction2.value.Add ("up");
- tempFunction2.value.Add ("down");
- tempFunction2.max = 1;
- tempFunction2.min = 0;
- tmp.attributes.Add (tempFunction2);
+ Attribute tempAttribute2 = new Attribute ();
+ tempAttribute2.key = "song_step";
+ tempAttribute2.data_type = "string";
+ tempAttribute2.value = new List<string> ();
+ tempAttribute2.value.Add ("up");
+ tempAttribute2.value.Add ("down");
+ tempAttribute2.max = 1;
+ tempAttribute2.min = 0;
+ tmp.attributes.Add (tempAttribute2);
#endregion
#region bass
- Function tempFunction16 = new Function ();
- tempFunction16.key = "playlist_name";
- tempFunction16.data_type = "string";
- tmp.attributes.Add (tempFunction16);
+ Attribute tempAttribute16 = new Attribute ();
+ tempAttribute16.key = "playlist_name";
+ tempAttribute16.data_type = "string";
+ tmp.attributes.Add (tempAttribute16);
#endregion
#region bass
- Function tempFunction17 = new Function ();
- tempFunction17.key = "song_name";
- tempFunction17.data_type = "string";
- tmp.attributes.Add (tempFunction17);
+ Attribute tempAttribute17 = new Attribute ();
+ tempAttribute17.key = "song_name";
+ tempAttribute17.data_type = "string";
+ tmp.attributes.Add (tempAttribute17);
#endregion
#region bass
- Function tempFunction19 = new Function ();
- tempFunction19.key = "song_time";
- tempFunction19.data_type = "string";
- tmp.attributes.Add (tempFunction19);
+ Attribute tempAttribute19 = new Attribute ();
+ tempAttribute19.key = "song_time";
+ tempAttribute19.data_type = "string";
+ tmp.attributes.Add (tempAttribute19);
#endregion
#region bass
- Function tempFunction20 = new Function ();
- tempFunction20.key = "playing_time";
- tempFunction20.data_type = "string";
- tmp.attributes.Add (tempFunction20);
+ Attribute tempAttribute20 = new Attribute ();
+ tempAttribute20.key = "playing_time";
+ tempAttribute20.data_type = "string";
+ tmp.attributes.Add (tempAttribute20);
#endregion
} else if (loopCommon.BigClass == 5) {
//浼犳劅鍣�
if (loopCommon.Type == DeviceType.SensorMobileDetection) {
- tmp.spk = "sensor.pir";
+ tmp.spk = SPK.SensorPir;
+ //tmp.spk = "sensor.pir";
#region on_off
- Function tempFunction = new Function ();
- tempFunction.key = "enable";
- tempFunction.data_type = "string";
- tempFunction.value = new List<string> ();
- tempFunction.value.Add ("true");
- tempFunction.value.Add ("false");
- tempFunction.max = 1;
- tempFunction.min = 0;
- tmp.attributes.Add (tempFunction);
+ Attribute tempAttribute = new Attribute ();
+ tempAttribute.key = "enable";
+ tempAttribute.data_type = "string";
+ tempAttribute.value = new List<string> ();
+ tempAttribute.value.Add ("true");
+ tempAttribute.value.Add ("false");
+ tempAttribute.max = 1;
+ tempAttribute.min = 0;
+ tmp.attributes.Add (tempAttribute);
#endregion
#region status
- Function tempFunction1 = new Function ();
- tempFunction1.key = "status";
- tempFunction1.data_type = "string";
- tempFunction1.value = new List<string> ();
- tempFunction1.value.Add ("true");
- tempFunction1.value.Add ("false");
- tempFunction1.max = 1;
- tempFunction1.min = 0;
- tmp.attributes.Add (tempFunction1);
+ Attribute tempAttribute1 = new Attribute ();
+ tempAttribute1.key = "status";
+ tempAttribute1.data_type = "string";
+ tempAttribute1.value = new List<string> ();
+ tempAttribute1.value.Add ("true");
+ tempAttribute1.value.Add ("false");
+ tempAttribute1.max = 1;
+ tempAttribute1.min = 0;
+ tmp.attributes.Add (tempAttribute1);
#endregion
#region sensitivity
- Function tempFunction2 = new Function ();
- tempFunction2.key = "sensitivity";
- tempFunction2.data_type = "integer";
- tempFunction2.max = 100;
- tempFunction2.min = 0;
- tmp.attributes.Add (tempFunction2);
+ Attribute tempAttribute2 = new Attribute ();
+ tempAttribute2.key = "sensitivity";
+ tempAttribute2.data_type = "integer";
+ tempAttribute2.max = 100;
+ tempAttribute2.min = 0;
+ tmp.attributes.Add (tempAttribute2);
#endregion
}else if (loopCommon.Type == DeviceType.SensorTemperature) {
- tmp.spk = "sensor.temperature";
+ tmp.spk = SPK.SensorTemperature;
+ //tmp.spk = "sensor.temperature";
#region on_off
- Function tempFunction = new Function ();
- tempFunction.key = "enable";
- tempFunction.data_type = "string";
- tempFunction.value = new List<string> ();
- tempFunction.value.Add ("true");
- tempFunction.value.Add ("false");
- tempFunction.max = 1;
- tempFunction.min = 0;
- tmp.attributes.Add (tempFunction);
+ Attribute tempAttribute = new Attribute ();
+ tempAttribute.key = "enable";
+ tempAttribute.data_type = "string";
+ tempAttribute.value = new List<string> ();
+ tempAttribute.value.Add ("true");
+ tempAttribute.value.Add ("false");
+ tempAttribute.max = 1;
+ tempAttribute.min = 0;
+ tmp.attributes.Add (tempAttribute);
#endregion
#region temp
- Function tempFunction1 = new Function ();
- tempFunction1.key = "value"; //2020 12 22
- tempFunction1.data_type = "float";
- tempFunction1.max = 50;
- tempFunction1.min = 0;
- tmp.attributes.Add (tempFunction1);
+ Attribute tempAttribute1 = new Attribute ();
+ tempAttribute1.key = "value"; //2020 12 22
+ tempAttribute1.data_type = "float";
+ tempAttribute1.max = 50;
+ tempAttribute1.min = 0;
+ tmp.attributes.Add (tempAttribute1);
#endregion
#region type
- Function tempFunction2 = new Function ();
- tempFunction2.key = "type";
- tempFunction2.data_type = "string";
- tempFunction2.value = new List<string> ();
- tempFunction2.value.Add ("C");
- tempFunction2.value.Add ("F");
- tempFunction2.max = 1;
- tempFunction2.min = 0;
- tmp.attributes.Add (tempFunction2);
+ Attribute tempAttribute2 = new Attribute ();
+ tempAttribute2.key = "type";
+ tempAttribute2.data_type = "string";
+ tempAttribute2.value = new List<string> ();
+ tempAttribute2.value.Add ("C");
+ tempAttribute2.value.Add ("F");
+ tempAttribute2.max = 1;
+ tempAttribute2.min = 0;
+ tmp.attributes.Add (tempAttribute2);
#endregion
//#region precision
- //Function tempFunction3 = new GateWay.Function();
- //tempFunction3.key = "precision";
- //tempFunction3.data_type = "string";
- //tempFunction3.value = new List<string>();
- //tempFunction3.value.Add("0.01");
- //tempFunction3.value.Add("0.1");
- //tempFunction3.value.Add("100");
- //tempFunction3.max = 2;
- //tempFunction3.min = 0;
- //tmp.attributes.Add(tempFunction3);
+ //Function tempAttribute3 = new GateWay.Function();
+ //tempAttribute3.key = "precision";
+ //tempAttribute3.data_type = "string";
+ //tempAttribute3.value = new List<string>();
+ //tempAttribute3.value.Add("0.01");
+ //tempAttribute3.value.Add("0.1");
+ //tempAttribute3.value.Add("100");
+ //tempAttribute3.max = 2;
+ //tempAttribute3.min = 0;
+ //tmp.attributes.Add(tempAttribute3);
//#endregion
}else if (loopCommon.Type == DeviceType.SensorIllumination) {
- tmp.spk = "sensor.light";
+ //tmp.spk = "sensor.light";
+ tmp.spk = SPK.SensorLight;
#region on_off
- Function tempFunction = new Function ();
- tempFunction.key = "enable";
- tempFunction.data_type = "string";
- tempFunction.value = new List<string> ();
- tempFunction.value.Add ("true");
- tempFunction.value.Add ("false");
- tempFunction.max = 1;
- tempFunction.min = 0;
- tmp.attributes.Add (tempFunction);
+ Attribute tempAttribute = new Attribute ();
+ tempAttribute.key = "enable";
+ tempAttribute.data_type = "string";
+ tempAttribute.value = new List<string> ();
+ tempAttribute.value.Add ("true");
+ tempAttribute.value.Add ("false");
+ tempAttribute.max = 1;
+ tempAttribute.min = 0;
+ tmp.attributes.Add (tempAttribute);
#endregion
#region lux
- Function tempFunction1 = new Function ();
- tempFunction1.key = "value"; //2020 12 22
- tempFunction1.data_type = "integer";
- tmp.attributes.Add (tempFunction1);
+ Attribute tempAttribute1 = new Attribute ();
+ tempAttribute1.key = "value"; //2020 12 22
+ tempAttribute1.data_type = "integer";
+ tmp.attributes.Add (tempAttribute1);
#endregion
#region error_value
- Function tempFunction2 = new Function ();
- tempFunction2.key = "error_value";
- tempFunction2.data_type = "integer";
- tmp.attributes.Add (tempFunction2);
+ Attribute tempAttribute2 = new Attribute ();
+ tempAttribute2.key = "error_value";
+ tempAttribute2.data_type = "integer";
+ tmp.attributes.Add (tempAttribute2);
#endregion
#region precision
- Function tempFunction3 = new Function ();
- tempFunction3.key = "precision";
- tempFunction3.data_type = "string";
- tempFunction3.value = new List<string> ();
- tempFunction3.value.Add ("0.01");
- tempFunction3.value.Add ("0.1");
- tempFunction3.value.Add ("100");
- tempFunction3.max = 2;
- tempFunction3.min = 0;
- tmp.attributes.Add (tempFunction3);
+ Attribute tempAttribute3 = new Attribute ();
+ tempAttribute3.key = "precision";
+ tempAttribute3.data_type = "string";
+ tempAttribute3.value = new List<string> ();
+ tempAttribute3.value.Add ("0.01");
+ tempAttribute3.value.Add ("0.1");
+ tempAttribute3.value.Add ("100");
+ tempAttribute3.max = 2;
+ tempAttribute3.min = 0;
+ tmp.attributes.Add (tempAttribute3);
#endregion
} else if (loopCommon.Type == DeviceType.SensorPM25) {
- tmp.spk = "sensor.pm25";
+ //tmp.spk = "sensor.pm25";
+ tmp.spk = SPK.SensorPm25;
#region on_off
- Function tempFunction = new Function ();
- tempFunction.key = "enable";
- tempFunction.data_type = "string";
- tempFunction.value = new List<string> ();
- tempFunction.value.Add ("true");
- tempFunction.value.Add ("false");
- tempFunction.max = 1;
- tempFunction.min = 0;
- tmp.attributes.Add (tempFunction);
+ Attribute tempAttribute = new Attribute ();
+ tempAttribute.key = "enable";
+ tempAttribute.data_type = "string";
+ tempAttribute.value = new List<string> ();
+ tempAttribute.value.Add ("true");
+ tempAttribute.value.Add ("false");
+ tempAttribute.max = 1;
+ tempAttribute.min = 0;
+ tmp.attributes.Add (tempAttribute);
#endregion
#region value
- Function tempFunction1 = new Function ();
- tempFunction1.key = "value";
- tempFunction1.data_type = "integer";
- tmp.attributes.Add (tempFunction1);
+ Attribute tempAttribute1 = new Attribute ();
+ tempAttribute1.key = "value";
+ tempAttribute1.data_type = "integer";
+ tmp.attributes.Add (tempAttribute1);
#endregion
#region error_value
- Function tempFunction2 = new Function ();
- tempFunction2.key = "error_value";
- tempFunction2.data_type = "integer";
- tmp.attributes.Add (tempFunction2);
+ Attribute tempAttribute2 = new Attribute ();
+ tempAttribute2.key = "error_value";
+ tempAttribute2.data_type = "integer";
+ tmp.attributes.Add (tempAttribute2);
#endregion
#region precision
- Function tempFunction3 = new Function ();
- tempFunction3.key = "precision";
- tempFunction3.data_type = "string";
- tempFunction3.value = new List<string> ();
- tempFunction3.value.Add ("0.01");
- tempFunction3.value.Add ("0.1");
- tempFunction3.value.Add ("100");
- tempFunction3.max = 2;
- tempFunction3.min = 0;
- tmp.attributes.Add (tempFunction3);
+ Attribute tempAttribute3 = new Attribute ();
+ tempAttribute3.key = "precision";
+ tempAttribute3.data_type = "string";
+ tempAttribute3.value = new List<string> ();
+ tempAttribute3.value.Add ("0.01");
+ tempAttribute3.value.Add ("0.1");
+ tempAttribute3.value.Add ("100");
+ tempAttribute3.max = 2;
+ tempAttribute3.min = 0;
+ tmp.attributes.Add (tempAttribute3);
#endregion
}else if (loopCommon.Type == DeviceType.SensorHumidity) {
- tmp.spk = "sensor.humidity";
+ //tmp.spk = "sensor.humidity";
+ tmp.spk = SPK.SensorHumidity;
#region on_off
- Function tempFunction = new Function ();
- tempFunction.key = "enable";
- tempFunction.data_type = "string";
- tempFunction.value = new List<string> ();
- tempFunction.value.Add ("true");
- tempFunction.value.Add ("false");
- tempFunction.max = 1;
- tempFunction.min = 0;
- tmp.attributes.Add (tempFunction);
+ Attribute tempAttribute = new Attribute ();
+ tempAttribute.key = "enable";
+ tempAttribute.data_type = "string";
+ tempAttribute.value = new List<string> ();
+ tempAttribute.value.Add ("true");
+ tempAttribute.value.Add ("false");
+ tempAttribute.max = 1;
+ tempAttribute.min = 0;
+ tmp.attributes.Add (tempAttribute);
#endregion
#region value
- Function tempFunction1 = new Function ();
- tempFunction1.key = "value";
- tempFunction1.data_type = "float";
- tempFunction1.max = 10000;
- tempFunction1.min = 0;
- tmp.attributes.Add (tempFunction1);
+ Attribute tempAttribute1 = new Attribute ();
+ tempAttribute1.key = "value";
+ tempAttribute1.data_type = "float";
+ tempAttribute1.max = 10000;
+ tempAttribute1.min = 0;
+ tmp.attributes.Add (tempAttribute1);
#endregion
}else if (loopCommon.Type == DeviceType.SensorTVOC) {
- tmp.spk = "sensor.tvoc";
+ //tmp.spk = "sensor.tvoc";
+ tmp.spk = SPK.SensorTVOC;
#region on_off
- Function tempFunction = new Function ();
- tempFunction.key = "enable";
- tempFunction.data_type = "string";
- tempFunction.value = new List<string> ();
- tempFunction.value.Add ("true");
- tempFunction.value.Add ("false");
- tempFunction.max = 1;
- tempFunction.min = 0;
- tmp.attributes.Add (tempFunction);
+ Attribute tempAttribute = new Attribute ();
+ tempAttribute.key = "enable";
+ tempAttribute.data_type = "string";
+ tempAttribute.value = new List<string> ();
+ tempAttribute.value.Add ("true");
+ tempAttribute.value.Add ("false");
+ tempAttribute.max = 1;
+ tempAttribute.min = 0;
+ tmp.attributes.Add (tempAttribute);
#endregion
#region value
- Function tempFunction1 = new Function ();
- tempFunction1.key = "value";
- tempFunction1.data_type = "integer";
- tempFunction1.max = 10000;
- tempFunction1.min = 0;
- tmp.attributes.Add (tempFunction1);
+ Attribute tempAttribute1 = new Attribute ();
+ tempAttribute1.key = "value";
+ tempAttribute1.data_type = "integer";
+ tempAttribute1.max = 10000;
+ tempAttribute1.min = 0;
+ tmp.attributes.Add (tempAttribute1);
#endregion
}else if (loopCommon.Type == DeviceType.SensorCO2) {
- tmp.spk = "sensor.co2";
+ //tmp.spk = "sensor.co2";
+ tmp.spk = SPK.SensorCO2;
#region on_off
- Function tempFunction = new Function ();
- tempFunction.key = "enable";
- tempFunction.data_type = "string";
- tempFunction.value = new List<string> ();
- tempFunction.value.Add ("true");
- tempFunction.value.Add ("false");
- tempFunction.max = 1;
- tempFunction.min = 0;
- tmp.attributes.Add (tempFunction);
+ Attribute tempAttribute = new Attribute ();
+ tempAttribute.key = "enable";
+ tempAttribute.data_type = "string";
+ tempAttribute.value = new List<string> ();
+ tempAttribute.value.Add ("true");
+ tempAttribute.value.Add ("false");
+ tempAttribute.max = 1;
+ tempAttribute.min = 0;
+ tmp.attributes.Add (tempAttribute);
#endregion
#region value
- Function tempFunction1 = new Function ();
- tempFunction1.key = "value";
- tempFunction1.data_type = "integer";
- tempFunction1.max = 10000;
- tempFunction1.min = 0;
- tmp.attributes.Add (tempFunction1);
+ Attribute tempAttribute1 = new Attribute ();
+ tempAttribute1.key = "value";
+ tempAttribute1.data_type = "integer";
+ tempAttribute1.max = 10000;
+ tempAttribute1.min = 0;
+ tmp.attributes.Add (tempAttribute1);
#endregion
}else if (loopCommon.Type == DeviceType.Sensor) {
- tmp.spk = "dryContact.standard";
+ //tmp.spk = "dryContact.standard";
+ tmp.spk = SPK.DryContact;
#region on_off
- Function tempFunction = new Function ();
- tempFunction.key = "enable";
- tempFunction.data_type = "string";
- tempFunction.value = new List<string> ();
- tempFunction.value.Add ("true");
- tempFunction.value.Add ("false");
- tempFunction.max = 1;
- tempFunction.min = 0;
- tmp.attributes.Add (tempFunction);
+ Attribute tempAttribute = new Attribute ();
+ tempAttribute.key = "enable";
+ tempAttribute.data_type = "string";
+ tempAttribute.value = new List<string> ();
+ tempAttribute.value.Add ("true");
+ tempAttribute.value.Add ("false");
+ tempAttribute.max = 1;
+ tempAttribute.min = 0;
+ tmp.attributes.Add (tempAttribute);
#endregion
#region status
- Function tempFunction1 = new Function ();
- tempFunction1.key = "status";
- tempFunction1.data_type = "string";
- tempFunction1.value = new List<string> ();
- tempFunction1.value.Add ("on");
- tempFunction1.value.Add ("off");
- tempFunction1.max = 1;
- tempFunction1.min = 0;
- tmp.attributes.Add (tempFunction1);
+ Attribute tempAttribute1 = new Attribute ();
+ tempAttribute1.key = "status";
+ tempAttribute1.data_type = "string";
+ tempAttribute1.value = new List<string> ();
+ tempAttribute1.value.Add ("on");
+ tempAttribute1.value.Add ("off");
+ tempAttribute1.max = 1;
+ tempAttribute1.min = 0;
+ tmp.attributes.Add (tempAttribute1);
#endregion
} else {
#region on_off
- Function tempFunction = new Function ();
- tempFunction.key = "enable";
- tempFunction.data_type = "string";
- tempFunction.value = new List<string> ();
- tempFunction.value.Add ("true");
- tempFunction.value.Add ("false");
- tempFunction.max = 1;
- tempFunction.min = 0;
- tmp.attributes.Add (tempFunction);
+ Attribute tempAttribute = new Attribute ();
+ tempAttribute.key = "enable";
+ tempAttribute.data_type = "string";
+ tempAttribute.value = new List<string> ();
+ tempAttribute.value.Add ("true");
+ tempAttribute.value.Add ("false");
+ tempAttribute.max = 1;
+ tempAttribute.min = 0;
+ tmp.attributes.Add (tempAttribute);
#endregion
#region value
- Function tempFunction1 = new Function ();
- tempFunction1.key = "value";
- tempFunction1.data_type = "integer";
- tempFunction1.max = 10000;
- tempFunction1.min = 0;
- tmp.attributes.Add (tempFunction1);
+ Attribute tempAttribute1 = new Attribute ();
+ tempAttribute1.key = "value";
+ tempAttribute1.data_type = "integer";
+ tempAttribute1.max = 10000;
+ tempAttribute1.min = 0;
+ tmp.attributes.Add (tempAttribute1);
#endregion
}
@@ -1252,21 +2025,30 @@
} else {
#region on_off
- Function tempFunction = new Function ();
- tempFunction.key = "on_off";
- tempFunction.data_type = "string";
- tempFunction.value = new List<string> ();
- tempFunction.value.Add ("on");
- tempFunction.value.Add ("off");
- tempFunction.max = 1;
- tempFunction.min = 0;
- tmp.attributes.Add (tempFunction);
+ Attribute tempAttribute = new Attribute ();
+ tempAttribute.key = "on_off";
+ tempAttribute.data_type = "string";
+ tempAttribute.value = new List<string> ();
+ tempAttribute.value.Add ("on");
+ tempAttribute.value.Add ("off");
+ tempAttribute.max = 1;
+ tempAttribute.min = 0;
+ tmp.attributes.Add (tempAttribute);
#endregion
}
} catch { }
return tmp;
}
+
+ #endregion
+
+
+ #region 鑾峰彇灞炴��
+
+
+
+ #endregion
//#region 鍒ゆ柇绫诲瀷
///// <summary>
@@ -1334,42 +2116,11 @@
//#endregion
- #region 鐢熸垚4浣峛yte 鏃堕棿鎴�
- private long LastTime = 0;
- /// <summary>
- /// DateTime鏃堕棿鏍煎紡杞崲涓�13浣嶅甫姣鐨刄nix鏃堕棿鎴�
- /// </summary>
- /// <param name="time"> DateTime鏃堕棿鏍煎紡</param>
- /// <returns>Unix鏃堕棿鎴虫牸寮�</returns>
- public long ConvertDateTimeLong ()
- {
- System.DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime (new System.DateTime (2020, 1, 1));
- long l = (long)(Math.Round ((DateTime.Now - startTime).TotalSeconds, 1) * 10);
- if (l <= LastTime) l = LastTime + 1;
- LastTime = l;
- return l;
- }
- /// <summary>
- ///
- /// </summary>
- /// <param name="m"></param>
- /// <param name="strTmp"></param>
- /// <returns></returns>
- public bool ConvertIntToByteArray (long m, ref string strTmp)
- {
- strTmp = "00000000";
- byte [] arry = new byte [4];
- arry [0] = (byte)(m & 0xFF);
- arry [1] = (byte)((m & 0xFF00) >> 8);
- arry [2] = (byte)((m & 0xFF0000) >> 16);
- arry [3] = (byte)((m & 0xFF000000) >> 24);
- strTmp = arry [0].ToString ("X2") + arry [1].ToString ("X2") + arry [2].ToString ("X2") + arry [3].ToString ("X2");
- return true;
- }
- #endregion
+
}
+ #region 鈻� 璁惧鍒楄〃鐩稿叧___________________________
[Serializable]
public class BaseCloudFeedback
{
@@ -1407,7 +2158,7 @@
public string fw_version { get; set; }
public string hw_info { get; set; }
public string mac { get; set; }
- public string deviceType { get; set; }
+ public int deviceType { get; set; }
}
[Serializable]
@@ -1420,12 +2171,14 @@
public string oid { get; set; } //璁惧妯″潡鍦板潃
public string omodel { get; set; } //鍨嬪彿
- public List<Function> attributes { get; set; } //灞炴�у垪琛�
+ public List<Attribute> attributes { get; set; } //灞炴�у垪琛�
}
-
+ /// <summary>
+ /// 灞炴��
+ /// </summary>
[Serializable]
- public class Function
+ public class Attribute
{
//public string name { get; set; }
public string key { get; set; }
@@ -1448,6 +2201,485 @@
public Sids functions { get; set; } //鍔熻兘鍒楄〃
}
+ /// <summary>
+ /// 璁惧鍒楄〃鍝嶅簲data鍙傛暟
+ /// </summary>
+ public class DevcieFunctionRes
+ {
+ public List<Function> list = new List<Function> ();
+
+ //public string totalCount = "0";
+
+ //public string totalPage = "0";
+
+ //public string pageNo = "0";
+
+ //public string pageSize = "0";
+
+ }
+
+ /// <summary>
+ /// 鍔熻兘绫昏兘婊¤冻鏁版嵁浣跨敤瑕佹眰锛屽瓙绫诲彧鏄负浜嗘柟渚夸娇鐢ㄥ睘鎬�
+ /// </summary>
+ public class Function
+ {
+ public Function ()
+ {
+ }
+
+ #region base info
+ /// <summary>
+ /// HDL缁熶竴鍗忚鏍煎紡锛�14bytes
+ /// 涓句緥锛� 鏉ユ簮 鍘傚晢浠g爜 閫氳鏂瑰紡 浜у搧鏃堕棿鎴� 浜у搧绫诲埆 鐗╂ā鍨嬬被 閫氶亾鍙� 澶у皬绫诲埆
+ /// 1byte 1byte 1byte 4byte 1byte 2byte 2byte 2byte
+ /// 鏉ユ簮锛�00 榛樿鍘熺敓鎬佺郴缁熸暟鎹� 銆�01 缃戝叧鎴栬�呭叾浠朅璁惧銆�02 璋冭瘯杞欢銆�03 APP搴旂敤绋嬪簭銆�04 绗笁鏂圭綉鍏虫垨鑰呭钩鍙�
+ /// 鍘傚晢浠g爜锛�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 鍗峰笜
+ /// 04 鎭掓俯鍣細01 绌鸿皟銆�02 鍦版殩銆�03 姣涚粏绌鸿皟
+ /// 05 鏂伴
+ /// 06 褰遍煶
+ /// 07 闊充箰
+ /// 08 鑳芥簮
+ /// 09 瀹夐槻
+ /// 澶х被鍒� 1bytes 锛堥鐣欙級
+ /// 灏忕被鍒� 1byte 锛堥鐣欙級
+ /// </summary>
+ public string sid = "0301011234567801012301230123";
+ /// <summary>
+ ///
+ /// </summary>
+ public string oid;
+ /// <summary>
+ /// 澶囨敞
+ /// </summary>
+ public string name;
+ /// <summary>
+ /// 璁惧ID
+ /// 浜戠璐熻矗鐢熸垚
+ /// </summary>
+ public string deviceId = "0";
+ /// <summary>
+ /// 璁惧spk
+ /// </summary>
+ public string spk = "";
+ /// <summary>
+ ///
+ /// </summary>
+ string spk_Prefix;
+ /// <summary>
+ /// spk鍓嶇紑
+ /// 澶х被
+ /// 鍔熻兘绫诲埆
+ /// 濡傦細绌鸿皟绫汇�佺伅鍏夌被銆佺獥甯樼被
+ /// </summary>
+ public string Spk_Prefix {
+ get {
+ if (string.IsNullOrEmpty (spk_Prefix)) {
+ spk_Prefix = spk.Split (".") [0];
+ }
+ return spk_Prefix;
+ }
+ }
+ string spk_Suffix;
+
+ /// <summary>
+ /// A鍗忚鍔熻兘鐨勭壒鎬�
+ /// 濡傦細鏄疉C鍔熻兘锛氱壒鎬э細on_off,mode,fan,temperature
+ /// attri
+ /// </summary>
+ public List<FunctionAttributes> attributes = new List<FunctionAttributes> ();
+
+ /// <summary>
+ /// 鎴块棿ID鍒楄〃
+ /// 璇ュ姛鑳芥坊鍔犲埌鍒版埧闂村垪琛�
+ /// </summary>
+ public List<string> roomIds = new List<string> ();
+
+ /// <summary>
+ /// bus鍗忚鏁版嵁鏍煎紡
+ /// 浣跨敤A鍗忚鎺у埗鏃讹紝鏀瑰睘鎬т负绌�
+ /// </summary>
+ public BusData bus;
+ /// <summary>
+ /// 鏄惁鏀惰棌
+ /// </summary>
+ public bool collect = false;
+ /// <summary>
+ /// 鏄惁鍦ㄧ嚎
+ /// </summary>
+ public bool online = true;
+ /// <summary>
+ /// 浜戠鏁版嵁鍒涘缓鐨勬椂闂�
+ /// </summary>
+ public string createTime = "";
+ /// <summary>
+ /// 浜戠鏁版嵁淇敼鐨勬渶鍚庢椂闂�
+ /// </summary>
+ public string modifyTime = "";
+ /// <summary>
+ /// 鍒犻櫎鏍囪
+ /// 闇�瑕佸垹闄ゆ暟鎹椂锛屾爣璁颁负锛歵rue
+ /// 鐢变簯绔垹闄ゆ垚鍔熶箣鍚庯紝杩斿洖鏁版嵁鍐嶆竻闄ゆ湰鍦版暟鎹�
+ /// </summary>
+ public bool DeleteSign = false;
+
+ #endregion
+ /// <summary>
+ /// 寤舵椂
+ /// </summary>
+ public int delay = 0;
+ /// <summary>
+ /// 鏈�鍚庢帶鍒剁殑涓�娆$姸鎬�
+ /// </summary>
+ [Newtonsoft.Json.JsonIgnore]
+ public string lastState = "";
+
+ 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);
+ //鎵句笉鍒板睘鎬ч渶瑕佸0鏄庝竴涓紝闃叉鎶ラ敊闂��
+ if (_trait_on_off == null) {
+ _trait_on_off = new FunctionAttributes () {
+ key = "on_off",
+ value = new List<string> { "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 = "off";
+ }
+ return _trait_on_off;
+ }
+ //set
+ //{
+ // _trait_on_off = value;
+ //}
+ }
+
+ /// <summary>
+ /// 浣跨敤娆℃暟
+ /// </summary>
+ public double controlCounter = 0;
+ /// <summary>
+ /// 浣跨敤棰戠巼
+ /// </summary>
+ public double usageFrequency {
+ get {
+ return controlCounter / 7;
+ }
+ }
+ /// <summary>
+ /// 鍥哄畾鐨勫簭鍙�
+ /// </summary>
+ public int fixedSerialNumber = int.MaxValue;
+
+ /// <summary>
+ /// 澶х被灏忕被
+ /// </summary>
+ [Newtonsoft.Json.JsonIgnore]
+ public string DeviceTypeString {
+ get {
+ if (!string.IsNullOrEmpty (sid) && sid.Length >= 28) {
+ return sid.Substring (sid.Length - 4, 4);
+ } else {
+ return "0000";
+ }
+ }
+ }
+ }
+
+
+ /// <summary>
+ /// 鍔熻兘灞炴��
+ /// 灞炴�у瓧娈佃В鏋愶細attri :灞炴�у唴瀹癸紝value 灞炴�х殑鍊硷紝max 鏈�澶у�� min 鏈�灏忓��
+ /// </summary>
+ [System.Serializable]
+ public class FunctionAttributes
+ {
+ /// <summary>
+ /// 灞炴�ч敭鍚�
+ /// </summary>
+ public string key;
+ /// <summary>
+ /// 灞炴�х殑鍊煎垪琛�
+ /// </summary>
+ public List<string> value = new List<string> ();
+ /// <summary>
+ /// 鏈�澶у��
+ /// </summary>
+ public int max = 100;
+ /// <summary>
+ /// 鏈�灏忓��
+ /// </summary>
+ public int min = 0;
+ /// <summary>
+ /// 鏁版嵁绫诲瀷
+ /// </summary>
+ public string data_type = "";
+ /// <summary>
+ /// 褰撳墠鍊�
+ /// </summary>
+ public object curValue = new object ();
+
+ }
+
+
+ /// <summary>
+ /// 鍔熻兘灞炴�ч敭鍚嶅垪琛�
+ /// </summary>
+ public static class FunctionAttributeKey
+ {
+ /// <summary>
+ /// 寮�鍏�
+ /// </summary>
+ public const string OnOff = "on_off";
+ /// <summary>
+ /// 浜害
+ /// </summary>
+ public const string Brightness = "brightness";
+ /// <summary>
+ /// 棰滆壊
+ /// </summary>
+ public const string RGB = "rgb";
+ /// <summary>
+ /// 娓愬彉鏃堕棿
+ /// </summary>
+ public const string FadeTime = "fade_time";
+ /// <summary>
+ /// 妯″紡
+ /// </summary>
+ public const string Mode = "mode";
+ /// <summary>
+ /// 椋庨��
+ /// </summary>
+ public const string FanSpeed = "fan";
+ /// <summary>
+ /// 璁剧疆娓╁害
+ /// </summary>
+ public const string SetTemp = "set_temp";
+ /// <summary>
+ /// 寤舵椂
+ /// </summary>
+ public const string Delay = "delay";
+ /// <summary>
+ /// 鑹叉俯
+ /// </summary>
+ public const string CCT = "cct";
+ /// <summary>
+ /// 鐧惧垎姣�
+ /// </summary>
+ public const string Percent = "percent";
+ /// <summary>
+ /// 瀹ゅ唴娓╁害
+ /// </summary>
+ public const string IndoorTemp = "room_temp";
+ /// <summary>
+ /// value
+ /// </summary>
+ public const string Value = "value";
+
+ /// <summary>
+ /// 椋庢墖妗d綅
+ /// </summary>
+ public const string FanSpeedPercent = "fan_speed_percent";
+ }
+
+ /// <summary>
+ /// 鍏煎鏃у崗璁帶鍒�
+ /// </summary>
+ 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 {
+ return Convert.ToByte (loopId, 16);
+ }
+ }
+
+ public string loopId;
+ }
+
+ public static class SPK
+ {
+ /// <summary>
+ /// 锛堝紑鍏崇伅锛�
+ /// </summary>
+ public const string LightSwitch = "light.switch";
+ /// <summary>
+ /// 锛堣皟鍏夌伅锛�
+ /// </summary>
+ public const string LightDimming = "light.dimming";
+ /// <summary>
+ /// 锛圧GB鐏級
+ /// </summary>
+ public const string LightRGB = "light.rgb";
+ /// <summary>
+ /// 锛圧GBW鐏級
+ /// </summary>
+ public const string LightRGBW = "light.rgbw";
+ /// <summary>
+ /// 锛圕CT鐏級
+ /// </summary>
+ public const string LightCCT = "light.cct";
+ /// <summary>
+ /// 锛堝紑鍏崇獥甯橈級
+ /// </summary>
+ public const string CurtainSwitch = "curtain.switch";
+ /// <summary>
+ /// 锛堝紑鍚堝笜锛�
+ /// </summary>
+ public const string CurtainTrietex = "curtain.trietex";
+ /// <summary>
+ /// 锛堢櫨鍙跺笜锛�
+ /// </summary>
+ public const string CurtainShades = "curtain.shades";
+ /// <summary>
+ /// 锛堝嵎甯橈級
+ /// </summary>
+ public const string CurtainRoller = "curtain.roller";
+ /// <summary>
+ /// 锛堢┖璋冿級
+ /// </summary>
+ public const string AcStandard = "ac.standard";
+ /// <summary>
+ /// 锛堝湴鐑級
+ /// </summary>
+ public const string FloorHeatStandard = "floorHeat.standard";
+ /// <summary>
+ /// 锛堟柊椋庯級
+ /// </summary>
+ public const string AirFreshStandard = "airFresh.standard";
+ /// <summary>
+ /// 锛堥煶涔愶級
+ /// </summary>
+ public const string MusicStandard = "music.standard";
+ /// <summary>
+ /// 锛堜寒搴︿紶鎰熷櫒锛�
+ /// </summary>
+ public const string SensorLight = "sensor.light";
+ /// <summary>
+ /// 锛堟俯搴︿紶鎰熷櫒锛�
+ /// </summary>
+ public const string SensorTemperature = "sensor.temperature";
+ /// <summary>
+ /// (绾㈠绉诲姩浼犳劅鍣�)
+ /// </summary>
+ public const string SensorPir = "sensor.pir";
+ /// <summary>
+ /// 锛堥棬绐椾紶鎰熷櫒锛�
+ /// </summary>
+ public const string SensorDoorWindow = "sensor.doorwindow";
+ /// <summary>
+ /// 锛圥M2.5浼犳劅鍣級
+ /// </summary>
+ public const string SensorPm25 = "sensor.pm25";
+ /// <summary>
+ /// co2浼犳劅鍣�
+ /// </summary>
+ public const string SensorCO2 = "sensor.co2";
+ /// <summary>
+ /// tvoc浼犳劅鍣�
+ /// </summary>
+ public const string SensorTVOC = "sensor.tvoc";
+ /// <summary>
+ /// 婀垮害浼犳劅鍣�
+ /// </summary>
+ public const string SensorHumidity = "sensor.humidity";
+ /// <summary>
+ /// 锛堝共鎺ョ偣锛�
+ /// </summary>
+ public const string DryContact = "dryContact.standard";
+ /// <summary>
+ /// 瀹剁數銆佹彃搴�
+ /// </summary>
+ public const string ElectricSocket = "electrical.socket";
+ /// <summary>
+ /// 瀹剁數銆佺數瑙�
+ /// </summary>
+ public const string ElectricTV = "electrical.tv";
+ /// <summary>
+ /// 瀹剁數銆侀鎵�
+ /// </summary>
+ public const string ElectricFan = "electrical.fan";
+ /// <summary>
+ /// 鍏跺畠銆侀�氱敤寮�鍏�
+ /// </summary>
+ public const string UniversalDevice = "other.common";
+
+
+ }
+
+
+ /// <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,
+ }
+
+
///// <summary>
///// 涓婁紶Oid鍒楄〃
///// </summary>
@@ -1469,98 +2701,104 @@
// public Sids devices { get; set; } //璁惧鍒楄〃
//}
-}
-//sid缁勬垚閮ㄥ垎锛�
-//sid
-//鏉ユ簮 鍘傚晢浠g爜 閫氳鏂瑰紡 浜у搧鏃堕棿鎴� 浜у搧绫诲埆 鐗╂ā鍨嬬被 閫氶亾鍙� 澶у皬绫诲埆
-//1byte 1byte 1byte 4byte 1byte 2byte 2byte 2byte
-//oid缁勬垚閮ㄥ垎锛�
-//鏉ユ簮 鍘傚晢浠g爜 閫氳鏂瑰紡 浜у搧鏃堕棿鎴� 浜у搧绫诲埆
-//1byte 1 byte 1 byte 4 byte 1byte
-//鍏朵腑鍚勯儴鍒嗕唬鐮佸垪琛細
-//鏉ユ簮 1byte 缂栧彿 鎻忚堪
-// 00 榛樿鍘熺敓鎬佺郴缁熸暟鎹�
-// 01 缃戝叧鎴栬�呭叾浠朅璁惧
-// 02 璋冭瘯杞欢
-// 03 APP搴旂敤绋嬪簭
-// 04 绗笁鏂圭綉鍏虫垨鑰呭钩鍙�
-//鍘傚晢浠g爜 1byte 缂栧彿 鎻忚堪
-// 01 HDL
-// 02
+ //sid缁勬垚閮ㄥ垎锛�
+ //sid
+ //鏉ユ簮 鍘傚晢浠g爜 閫氳鏂瑰紡 浜у搧鏃堕棿鎴� 浜у搧绫诲埆 鐗╂ā鍨嬬被 閫氶亾鍙� 澶у皬绫诲埆
+ //1byte 1byte 1byte 4byte 1byte 2byte 2byte 2byte
+ //oid缁勬垚閮ㄥ垎锛�
+ //鏉ユ簮 鍘傚晢浠g爜 閫氳鏂瑰紡 浜у搧鏃堕棿鎴� 浜у搧绫诲埆
+ //1byte 1 byte 1 byte 4 byte 1byte
+ //鍏朵腑鍚勯儴鍒嗕唬鐮佸垪琛細
+ //鏉ユ簮 1byte 缂栧彿 鎻忚堪
+ // 00 榛樿鍘熺敓鎬佺郴缁熸暟鎹�
+ // 01 缃戝叧鎴栬�呭叾浠朅璁惧
+ // 02 璋冭瘯杞欢
+ // 03 APP搴旂敤绋嬪簭
+ // 04 绗笁鏂圭綉鍏虫垨鑰呭钩鍙�
-//閫氳鏂瑰紡 1byte 缂栧彿 鎻忚堪
-// 01 HDL Bus
-// 02 Zigbee
-// 03 KNX
-// 04 Z-Wave
+ //鍘傚晢浠g爜 1byte 缂栧彿 鎻忚堪
+ // 01 HDL
+ // 02
-//浜у搧鏃堕棿鎴� 4bytes 浠�2020骞�1鏈�1鏃ョ畻鍑虹殑鏃堕棿鎴�0.1s涓哄崟浣�
+ //閫氳鏂瑰紡 1byte 缂栧彿 鎻忚堪
+ // 01 HDL Bus
+ // 02 Zigbee
+ // 03 KNX
+ // 04 Z-Wave
-//浜у搧绫诲埆 1byte 缂栧彿 鎻忚堪
-// 01 璋冨厜鍣�
-// 02 缁х數鍣�
-// 03 骞叉帴鐐规ā鍧�
-// 04 浼犳劅鍣�
-// 05 闈㈡澘
-// 06 RCU
-// 07 缃戝叧
-// 08 绾㈠鍙戝皠
-// 09 Android灞�
-// 10 鍦烘櫙
-// 11 闊充箰鎾斁鍣�
-// 12 232/485杞崲鍣�
-// 21 鑷姩鍖�
-// 22 瀹夐槻闃插尯
-// 14 绐楀笜妯″潡
-// 15 HVAC
-// 16 鍦扮儹妯″潡
+ //浜у搧鏃堕棿鎴� 4bytes 浠�2020骞�1鏈�1鏃ョ畻鍑虹殑鏃堕棿鎴�0.1s涓哄崟浣�
-//鐗╂ā鍨嬬被鍨� 2bytes 缂栧彿 鎻忚堪
-// 01 寮�鍏崇被 01 寮�鍏�
-// 02 鎻掑骇
-// 03
-// 02 鐓ф槑 01 寮�鍏�
-// 02 璋冨厜
-// 03 鑹叉俯(CCT)
-// 04 RGB
-// 03 閬槼 01 绐楀笜鎺у埗鍣�
-// 02 鐧惧彾绐�
-// 03 寮�鍚堝笜
-// 04 鍗峰笜
-// 05 聽鎺ㄧ獥鍣�
-// 06 聽鎶曞奖骞�
-// 04 闈㈡澘 01 鎸夐敭闈㈡澘
-// 05 浼犳劅鍣� 01 绉诲姩鎺㈡祴
-// 02 娓╁害浼犳劅鍣�
-// 03 婀垮害浼犳劅鍣�
-// 04 鐓у害浼犳劅鍣�
-// 05 TVOC
-// 06 PM2.5
-// 07 CO2
-// 08 姣背娉紶鎰熷櫒
-// 09
-// 10
-// 11 鐑熼浘浼犳劅鍣�
-// 25 骞叉帴鐐�
-// 07 鎭掓俯鍣� 01 绌鸿皟
-// 02 椋庢墖
-// 03 姣涚粏绌鸿皟
-// 08 鍦扮儹 01 鍦扮儹妯″潡
-// 09 鑳屾櫙闊充箰 01 闊充箰鎾斁鍣�
-// 02 Sonos
-// 10 鍦烘櫙 01 鍦烘櫙
-// 02 鐢靛奖鍦烘櫙
-// 19 鏂伴 01 鏂伴
+ //浜у搧绫诲埆 1byte 缂栧彿 鎻忚堪
+ // 01 璋冨厜鍣�
+ // 02 缁х數鍣�
+ // 03 骞叉帴鐐规ā鍧�
+ // 04 浼犳劅鍣�
+ // 05 闈㈡澘
+ // 06 RCU
+ // 07 缃戝叧
+ // 08 绾㈠鍙戝皠
+ // 09 Android灞�
+ // 10 鍦烘櫙
+ // 11 闊充箰鎾斁鍣�
+ // 12 232/485杞崲鍣�
+ // 21 鑷姩鍖�
+ // 22 瀹夐槻闃插尯
+ // 14 绐楀笜妯″潡
+ // 15 HVAC
+ // 16 鍦扮儹妯″潡
-//13 鑳芥簮 01 鐢佃〃
-// 02 姘磋〃
-// 03 鐕冩皵
-// 16 鐢靛櫒 01 椋庢墖
-// 02 TV
-// 20 瀹夐槻 01 瀹夐槻
-// 21 鑷姩鍖� 01 鑷姩鍖�
-//澶х被鍒� 1bytes 锛堥鐣欙級
-//灏忕被鍒� 1byte 锛堥鐣欙級
\ No newline at end of file
+ //鐗╂ā鍨嬬被鍨� 2bytes 缂栧彿 鎻忚堪
+ // 01 寮�鍏崇被 01 寮�鍏�
+ // 02 鎻掑骇
+ // 03
+ // 02 鐓ф槑 01 寮�鍏�
+ // 02 璋冨厜
+ // 03 鑹叉俯(CCT)
+ // 04 RGB
+ // 03 閬槼 01 绐楀笜鎺у埗鍣�
+ // 02 鐧惧彾绐�
+ // 03 寮�鍚堝笜
+ // 04 鍗峰笜
+ // 05 聽鎺ㄧ獥鍣�
+ // 06 聽鎶曞奖骞�
+ // 04 闈㈡澘 01 鎸夐敭闈㈡澘
+ // 05 浼犳劅鍣� 01 绉诲姩鎺㈡祴
+ // 02 娓╁害浼犳劅鍣�
+ // 03 婀垮害浼犳劅鍣�
+ // 04 鐓у害浼犳劅鍣�
+ // 05 TVOC
+ // 06 PM2.5
+ // 07 CO2
+ // 08 姣背娉紶鎰熷櫒
+ // 09
+ // 10
+ // 11 鐑熼浘浼犳劅鍣�
+ // 25 骞叉帴鐐�
+ // 07 鎭掓俯鍣� 01 绌鸿皟
+ // 02 椋庢墖
+ // 03 姣涚粏绌鸿皟
+ // 08 鍦扮儹 01 鍦扮儹妯″潡
+ // 09 鑳屾櫙闊充箰 01 闊充箰鎾斁鍣�
+ // 02 Sonos
+ // 10 鍦烘櫙 01 鍦烘櫙
+ // 02 鐢靛奖鍦烘櫙
+ // 19 鏂伴 01 鏂伴
+
+ //13 鑳芥簮 01 鐢佃〃
+ // 02 姘磋〃
+ // 03 鐕冩皵
+ // 16 鐢靛櫒 01 椋庢墖
+ // 02 TV
+ // 20 瀹夐槻 01 瀹夐槻
+ // 21 鑷姩鍖� 01 鑷姩鍖�
+ //澶х被鍒� 1bytes 锛堥鐣欙級
+ //灏忕被鍒� 1byte 锛堥鐣欙級
+
+ #endregion
+
+
+
+}
\ No newline at end of file
--
Gitblit v1.8.0