From d53e6af2c5f17838fa79659614b15a2a1f383399 Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期五, 31 三月 2023 10:04:58 +0800 Subject: [PATCH] 1 --- Crabtree/SmartHome/HDL/Common/HDLLinkUtlis.cs | 1104 +++++++++++++++++++++++++++++++++++++++++++++------------ 1 files changed, 866 insertions(+), 238 deletions(-) diff --git a/Crabtree/SmartHome/HDL/Common/HDLLinkUtlis.cs b/Crabtree/SmartHome/HDL/Common/HDLLinkUtlis.cs index 7b0d2f2..4beb6ca 100644 --- a/Crabtree/SmartHome/HDL/Common/HDLLinkUtlis.cs +++ b/Crabtree/SmartHome/HDL/Common/HDLLinkUtlis.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using Shared; using Shared.IO; +using Shared.SimpleControl; namespace Shared { @@ -10,6 +11,94 @@ /// </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> /// 閫氱敤鏂规硶 @@ -28,11 +117,544 @@ } #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 () @@ -42,6 +664,13 @@ 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); @@ -55,8 +684,8 @@ } else { IMessageCommon.Current.ShowErrorInfoAlter (revertObj.Code); } - } catch { - + } catch(Exception EX) { + Utlis.WriteLine ("catch: " + EX.ToString()); } return res; } @@ -70,87 +699,7 @@ List<Common> TargetList = new List<Common> (); //鎵惧嚭闇�瑕佹樉绀虹殑璁惧 - var filesList = FileUtils.ReadFiles ().FindAll ((obj) => { - string [] str = obj.Split ('_'); - return obj.StartsWith ("Equipment_") && str.Length == 5; - }); - var localEquipments = filesList.FindAll ((obj) => { - string typeString = obj.Split ('_') [1]; - return ( - #region light - typeString.ToString () == DeviceType.LightCCT.ToString () || - typeString.ToString () == DeviceType.LightRGB.ToString () || - typeString.ToString () == DeviceType.LightDALI.ToString () || - typeString.ToString () == DeviceType.LightRGBW.ToString () || - typeString.ToString () == DeviceType.LightLogic.ToString () || - typeString.ToString () == DeviceType.LightSwitch.ToString () || - typeString.ToString () == DeviceType.LightDimming.ToString () || - typeString.ToString () == DeviceType.LightMixSwitch.ToString () || - typeString.ToString () == DeviceType.LightRGBandCCT.ToString () || - typeString.ToString () == DeviceType.LightMixDimming.ToString () || - typeString.ToString () == DeviceType.LightEnergySwitch.ToString () || - typeString.ToString () == DeviceType.LightEnergySocket.ToString () || - typeString.ToString () == DeviceType.LightSwitchSocket.ToString () - || typeString.ToString () == DeviceType.DMX48.ToString () - #endregion - #region light - || typeString.ToString () == DeviceType.SensorCH4.ToString () || - typeString.ToString () == DeviceType.SensorCO2.ToString () || - typeString.ToString () == DeviceType.SensorLPG.ToString () || - typeString.ToString () == DeviceType.SensorCOH2.ToString () || - typeString.ToString () == DeviceType.SensorPM25.ToString () || - typeString.ToString () == DeviceType.SensorTVOC.ToString () || - typeString.ToString () == DeviceType.SensorPower.ToString () || - typeString.ToString () == DeviceType.SensorSmoke.ToString () || - typeString.ToString () == DeviceType.SensorWater.ToString () || - typeString.ToString () == DeviceType.SensorWeight.ToString () || - typeString.ToString () == DeviceType.SensorCurrent.ToString () || - typeString.ToString () == DeviceType.SensorVoltage.ToString () - || typeString.ToString () == DeviceType.SensorRainfall.ToString () - || typeString.ToString () == DeviceType.SensorVelocity.ToString () - || typeString.ToString () == DeviceType.SensorMenciAndwindowMagnetic.ToString () - || typeString.ToString () == DeviceType.SensorMobileDetection.ToString () - || typeString.ToString () == DeviceType.SensorLiquidPressure.ToString () - || typeString.ToString () == DeviceType.SensorVibration.ToString () - || typeString.ToString () == DeviceType.SensorLiquidFlow.ToString () - || typeString.ToString () == DeviceType.SensorLiquidDepth.ToString () - || typeString.ToString () == DeviceType.SensorTemperature.ToString () - || typeString.ToString () == DeviceType.SensorHeightLength.ToString () - || typeString.ToString () == DeviceType.SensorIllumination.ToString () - || typeString.ToString () == DeviceType.SensorWindPressure.ToString () - || typeString.ToString () == DeviceType.SensorHumidity.ToString () - #endregion - #region curtain - || typeString.ToString () == DeviceType.CurtainModel.ToString () - || typeString.ToString () == DeviceType.CurtainRoller.ToString () - || typeString.ToString () == DeviceType.CurtainTrietex.ToString () - #endregion - #region ac - || typeString.ToString () == DeviceType.ACPanel.ToString () - || typeString.ToString () == DeviceType.ACDevice.ToString () - || typeString.ToString () == DeviceType.ACInfrared.ToString () - || typeString.ToString () == DeviceType.ACCoolmaster.ToString () - || typeString.ToString () == DeviceType.CustomAC.ToString () - || typeString.ToString () == DeviceType.HVAC.ToString () - #endregion - #region foolheat - || typeString.ToString () == DeviceType.FoolHeat.ToString () - || typeString.ToString () == DeviceType.FoolHeatPanel.ToString () - #endregion - #region - || typeString.ToString () == DeviceType.InfraredMode.ToString () - || typeString.ToString () == DeviceType.DoorLock.ToString () - || typeString.ToString () == DeviceType.FanModule.ToString () - || typeString.ToString () == DeviceType.FreshAir.ToString () - || typeString.ToString () == DeviceType.InfraredTV.ToString () - || typeString.ToString () == DeviceType.UniversalDevice.ToString () - || typeString.ToString () == DeviceType.MusicModel.ToString () - || typeString.ToString () == DeviceType.SecurityModule.ToString () - || typeString.ToString () == DeviceType.LogicModule.ToString () - || typeString.ToString () == DeviceType.SecurityPanel.ToString () - #endregion - ); - }); + var localEquipments = CommonUtlis.Current.GetAllLocalEquipments (); foreach (string deviceFilePath in localEquipments) { try { @@ -265,7 +814,7 @@ Oid tmpOid = new Oid (); tmpOid.protocolType = "bus"; tmpOid.device_name = tmp.Type.ToString (); - tmpOid.oid = FormingNewOid (tmp.Type); + tmpOid.oid = FormingNewOid (tmp); tmpOid.addresses = addresses; tmpOid.device_model = tmp.Type.ToString (); tmpOid.fw_version = ""; @@ -276,11 +825,11 @@ functionLists.AddRange (ConvertToSidListToIotCloud (tmpOid.oid, tmp)); - Utlis.WriteLine ("鏂扮殑妯″潡锛屾柊鐨勭殑OID锛�" + tmpOid.addresses + " deviceType:" + tmpOid.deviceType); + //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); + //Utlis.WriteLine ("鐩稿悓鐨勬ā鍧楋紝鍙栦箣鍓嶇殑OID锛�" + deviceOid.addresses + " deviceType:" + deviceOid.deviceType); } } @@ -339,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; @@ -550,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; @@ -581,13 +1137,66 @@ tmp.name = loopCommon.Name; tmp.attributes = new List<Attribute> (); tmp.omodel = loopCommon.Type.ToString (); - //缁х數鍣ㄥ紑鍏崇被 - if (loopCommon.Type == DeviceType.LightSwitch + if (loopCommon.Type == DeviceType.UniversalDevice) { + //閫氱敤寮�鍏� + tmp.spk = SPK.UniversalDevice; + #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.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.LightEnergySocket - || loopCommon.Type == DeviceType.LightSwitchSocket || loopCommon.Type == DeviceType.LightMixSwitch) { - tmp.spk = "light.switch"; + //缁х數鍣ㄥ紑鍏崇被 + 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"; @@ -603,7 +1212,8 @@ || loopCommon.Type == DeviceType.LightCCT || loopCommon.Type == DeviceType.LightDALI) { //璋冨厜绫� - tmp.spk = "light.dimming"; + //tmp.spk = "light.dimming"; + tmp.spk = SPK.LightDimming; #region on_off Attribute tempAttribute = new Attribute (); tempAttribute.key = "on_off"; @@ -644,7 +1254,8 @@ if (loopCommon.Type == DeviceType.LightCCT || loopCommon.Type == DeviceType.LightDALI)//鑹叉俯绫诲埆 { - tmp.spk = "light.cct"; + //tmp.spk = "light.cct"; + tmp.spk = SPK.LightCCT; #region cct Attribute tempAttribute2 = new Attribute (); tempAttribute2.key = "cct"; @@ -663,7 +1274,8 @@ || loopCommon.Type == DeviceType.LightRGBandCCT || loopCommon.Type == DeviceType.DMX48) { - tmp.spk = "light.rgb"; + tmp.spk = SPK.LightRGB; + //tmp.spk = "light.rgb"; #region on_off Attribute tempAttribute = new Attribute (); tempAttribute.key = "on_off"; @@ -689,7 +1301,8 @@ if (loopCommon.Type == DeviceType.LightRGBW) { - tmp.spk = "light.rgbw"; + //tmp.spk = "light.rgbw"; + tmp.spk = SPK.LightRGBW; #region color Attribute tempAttribute3 = new Attribute (); tempAttribute3.key = "rgb"; @@ -730,7 +1343,8 @@ } } 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 Attribute tempAttribute = new Attribute (); tempAttribute.key = "on_off"; @@ -745,7 +1359,8 @@ #endregion if (loopCommon.Type == DeviceType.CurtainRoller || loopCommon.Type == DeviceType.CurtainTrietex)//鎵�鏈夊嵎甯樻帶鍒跺櫒 { - tmp.spk = "curtain.trietex"; + tmp.spk = SPK.CurtainTrietex; + //tmp.spk = "curtain.trietex"; #region openlevel Attribute tempAttribute1 = new Attribute (); tempAttribute1.key = "percent"; @@ -765,7 +1380,8 @@ || loopCommon.Type == DeviceType.HVAC) { //绌鸿皟绫� - tmp.spk = "ac.standard"; + tmp.spk = SPK.AcStandard; + //tmp.spk = "ac.standard"; #region on_off Attribute tempAttribute = new Attribute (); tempAttribute.key = "on_off"; @@ -870,7 +1486,8 @@ #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 Attribute tempAttribute = new Attribute (); tempAttribute.key = "on_off"; @@ -940,7 +1557,8 @@ } 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 Attribute tempAttribute = new Attribute (); @@ -1125,7 +1743,8 @@ } 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 Attribute tempAttribute = new Attribute (); tempAttribute.key = "enable"; @@ -1159,7 +1778,8 @@ 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 Attribute tempAttribute = new Attribute (); tempAttribute.key = "enable"; @@ -1206,7 +1826,8 @@ //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 Attribute tempAttribute = new Attribute (); tempAttribute.key = "enable"; @@ -1246,7 +1867,8 @@ 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 Attribute tempAttribute = new Attribute (); tempAttribute.key = "enable"; @@ -1286,7 +1908,8 @@ 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 Attribute tempAttribute = new Attribute (); tempAttribute.key = "enable"; @@ -1307,7 +1930,8 @@ 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 Attribute tempAttribute = new Attribute (); tempAttribute.key = "enable"; @@ -1328,7 +1952,8 @@ 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 Attribute tempAttribute = new Attribute (); tempAttribute.key = "enable"; @@ -1349,7 +1974,8 @@ 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 Attribute tempAttribute = new Attribute (); tempAttribute.key = "enable"; @@ -1414,6 +2040,9 @@ } catch { } return tmp; } + + #endregion + #region 鑾峰彇灞炴�� @@ -1487,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 { @@ -1786,6 +2384,20 @@ /// 鍥哄畾鐨勫簭鍙� /// </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"; + } + } + } } @@ -1877,6 +2489,11 @@ /// value /// </summary> public const string Value = "value"; + + /// <summary> + /// 椋庢墖妗d綅 + /// </summary> + public const string FanSpeedPercent = "fan_speed_percent"; } /// <summary> @@ -2008,6 +2625,11 @@ /// 瀹剁數銆侀鎵� /// </summary> public const string ElectricFan = "electrical.fan"; + /// <summary> + /// 鍏跺畠銆侀�氱敤寮�鍏� + /// </summary> + public const string UniversalDevice = "other.common"; + } @@ -2079,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