From 4c993fcb71b92f8e9837ca8f50f3b5e8f9c59cfe Mon Sep 17 00:00:00 2001
From: JLChen <551775569@qq.com>
Date: 星期三, 20 一月 2021 19:47:04 +0800
Subject: [PATCH] 2021-01-20 1.更新。2.增加写域名配置操作。

---
 Crabtree/SmartHome/HDL/Common/HDLLinkUtlis.cs |  260 +++++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 225 insertions(+), 35 deletions(-)

diff --git a/Crabtree/SmartHome/HDL/Common/HDLLinkUtlis.cs b/Crabtree/SmartHome/HDL/Common/HDLLinkUtlis.cs
index fd49cfb..3671959 100644
--- a/Crabtree/SmartHome/HDL/Common/HDLLinkUtlis.cs
+++ b/Crabtree/SmartHome/HDL/Common/HDLLinkUtlis.cs
@@ -27,6 +27,9 @@
 //        }
 //        #endregion
 
+
+
+
 //        /// <summary>
 //        /// 灏嗗湪绾胯澶囪浆鎹㈡垚sid + 灞炴�у垪琛�
 //        /// </summary>
@@ -51,13 +54,13 @@
 //                }
 //                if (onlineDevice.bytSimpleParam != null && onlineDevice.bytSimpleParam.Length > 0) {
 //                    for (int intI = 0; intI < onlineDevice.bytSimpleParam.Length / 3; intI++) {
-//                        Byte BigType = onlineDevice.bytSimpleParam [0 + intI * 3];
-//                        Byte SmallType = onlineDevice.bytSimpleParam [1 + intI * 3];
+//                        byte BigType = onlineDevice.bytSimpleParam [0 + intI * 3];
+//                        byte SmallType = onlineDevice.bytSimpleParam [1 + intI * 3];
 //                        int Count = onlineDevice.bytSimpleParam [2 + intI * 3];
 //                        if (Count > 0) {
 //                            for (int j = 1; j <= Count; j++) {
 //                                Sid tmpSid = new Sid ();
-//                                tmpSid.sid = HDLSysPF.FormingNewSid (onlineDevice.DeviceType, sOid, j, false, BigType, SmallType);
+//                                tmpSid.sid = HDLSysPF.FormingNewSid (onlineDevice.Type, sOid, j, false, BigType, SmallType);
 //                                tmpSid.oid = sOid;
 
 //                                try {
@@ -181,50 +184,116 @@
 //        /// </summary>
 //        /// <param name="iDeviceType"></param>
 //        /// <returns></returns>
-//        public string FormingNewOid (int iDeviceType)
+//        public string FormingNewOid (DeviceType deviceType)
 //        {
 //            string sOid = "";
 //            try {
+//                //1.鐢熸垚 鍘傚晢 + 閫氳鏂瑰紡 
 //                string sOidBeginsWith = "000101";//鍘傚晢 + 閫氳鏂瑰紡
-
-//                long sTimeSp = HDLSysPF.ConvertDateTimeLong ();
+//                //2.鐢熸垚浜у搧鏃堕棿鎴�
+//                long sTimeSp = ConvertDateTimeLong (); //浠�2020骞�1鏈�1鏃ョ畻鍑虹殑鏃堕棿鎴�0.1s涓哄崟浣�
 //                string sTimeSpan = "";
-//                GateWay.ConvertIntToByteArray (sTimeSp, ref sTimeSpan);
-
+//                ConvertIntToByteArray (sTimeSp, ref sTimeSpan);
 //                if (sTimeSpan.Length != 8) return sOid;
-//                HDLUDP.TimeBetwnNext (10);
-//                sOid = sOidBeginsWith + sTimeSpan;
-//                if (iDeviceType == 00
-//                    || DimmerDeviceTypeList.HDLDimmerDeviceTypeList.Contains (iDeviceType)
-//                 || DMXDeviceTypeList.HDLDMXDeviceTypeList.Contains (iDeviceType))//璋冨厜鍣� 20200730绫�
-//                {
-//                    sOid += "01";
-//                } else if (RelayDeviceTypeList.HDLRelayDeviceTypeList.Contains (iDeviceType))//缁х數鍣ㄧ被
-//                  {
-//                    sOid += "02";
-//                } else if (CurtainDeviceType.HDLCurtainModuleDeviceType.Contains (iDeviceType))//閬槼绫伙紙绐楀笜锛�
-//                  {
-//                    sOid += "03";
-//                } else if (HVACModuleDeviceTypeList.HDLHVACModuleDeviceTypeLists.Contains (iDeviceType) || FloorheatingDeviceTypeList.HDLFloorHeatingDeviceType.Contains (iDeviceType))//鎭掓俯鍣紙绌鸿皟锛�
-//                  {
-//                    sOid += "12";
-//                } else if (AudioDeviceTypeList.AudioBoxDeviceTypeList.Contains (iDeviceType)) {
-//                    sOid += "10";
-//                } else if (Eightin1DeviceTypeList.HDL8in1DeviceType.Contains (iDeviceType)
-//                      || Sevenin1DeviceTypeList.HDL7in1DeviceType.Contains (iDeviceType)
-//                      || Twelvein1DeviceTypeList.HDL12in1DeviceType.Contains (iDeviceType))//浼犳劅鍣ㄧ被
-//                  {
-//                    sOid += "04";
-//                } else {
-//                    sOid += "07"; //缃戝叧浜у搧
-//                }
+//                //寤惰繜10ms
 
+//                //3.鐢熸垚浜у搧绫诲埆
+//                var productType = GetProductType (deviceType);
+//                sOid = sOidBeginsWith + sTimeSpan + productType;
 
 //                return sOid;
 //            } catch {
 //                return sOid;
 //            }
 //        }
+
+//        /// <summary>
+//        /// 鑾峰彇浜у搧绫诲埆
+//        //浜у搧绫诲埆 1byte
+//        //缂栧彿   鎻忚堪
+//		//01	璋冨厜鍣�
+//		//02	缁х數鍣�
+//		//03	骞叉帴鐐规ā鍧�
+//		//04	浼犳劅鍣�
+//		//05	闈㈡澘
+//		//06	RCU
+//		//07	缃戝叧
+//		//08	绾㈠鍙戝皠
+//		//09	Android灞�
+//		//10	鍦烘櫙
+//		//11	闊充箰鎾斁鍣�
+//		//12	232/485杞崲鍣�
+//		//21	鑷姩鍖�
+//        //22	瀹夐槻闃插尯
+//        //14	绐楀笜妯″潡
+//        //15	HVAC
+//        //16	鍦扮儹妯″潡
+//        /// </summary>
+//        /// <param name="deviceType"></param>
+//        /// <returns></returns>
+//        public string GetProductType (DeviceType deviceType)
+//        {
+//            string productType = "";
+//            switch (deviceType) {
+//            case DeviceType.LightDimming:
+//                productType = "01";//01	璋冨厜鍣�
+//                break;
+//            case DeviceType.LightSwitch:
+//                productType = "02";//02 缁х數鍣ㄧ被
+//                break;
+//            case DeviceType.CurtainModel:
+//            case DeviceType.CurtainRoller:
+//            case DeviceType.CurtainTrietex:
+//                productType = "03";//03	閬槼绫伙紙绐楀笜锛�
+//                break;
+//            case DeviceType.SensorWindSpeed:
+//                productType = "04";//04	浼犳劅鍣級
+//                break;
+//            case DeviceType.OnePortWirelessFR:
+//            case DeviceType.OnePortBus:
+//            case DeviceType.RCU:
+//            case DeviceType.SuperWireless:
+//            case DeviceType.OnePortMqttFR:
+//                productType = "07";//07	缃戝叧绫�
+//                break;
+//            case DeviceType.ACPanel:
+//            case DeviceType.ACDevice:
+//            case DeviceType.ACInfrared:
+//            case DeviceType.ACCoolmaster:
+//            case DeviceType.CustomAC:
+//            case DeviceType.HVAC:
+//            case DeviceType.FoolHeat:
+//            case DeviceType.FoolHeatPanel:
+//                productType = "12";//12 鎭掓俯鍣紙绌鸿皟銆佸湴鐑級
+//                break;
+        
+//            }
+
+//            return productType;
+//        }
+
+          
+
+//        /// <summary>
+//        /// 鑾峰彇鐢熸垚鐗╃悊妯″瀷鍙傛暟
+
+//        /// </summary>
+//        /// <param name="deviceType"></param>
+//        /// <returns></returns>
+//        public string GetPhysicalModelType (DeviceType deviceType)
+//        {
+//            string productType = "";
+//            switch (deviceType) {
+//            case DeviceType.LightDimming:
+//                productType = "0101";
+//                break;
+//            }
+
+//            return productType;
+//        }
+        
+
+
 
 //        /// <summary>
 //        /// 鐢熸垚鍔熻兘璁惧Sid
@@ -300,6 +369,33 @@
 //            }
 //        }
 
+//        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;
+//        }
+
+//        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;
+//        }
+
 //    }
 
 
@@ -349,7 +445,7 @@
 //    {
 //        public string sid { get; set; }
 //        public string name { get; set; }
-//        public string[] uids { get; set; }
+//        public string [] uids { get; set; }
 //        public string spk { get; set; }
 
 //        public string oid { get; set; }  //璁惧妯″潡鍦板潃
@@ -370,3 +466,97 @@
 //    }
 
 //}
+
+
+////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	
+
+////閫氳鏂瑰紡	1byte	缂栧彿	鎻忚堪
+////		01	HDL Bus
+////		02	Zigbee
+////		03	KNX
+////		04	Z-Wave
+
+////浜у搧鏃堕棿鎴�	4bytes	浠�2020骞�1鏈�1鏃ョ畻鍑虹殑鏃堕棿鎴�0.1s涓哄崟浣�
+
+////浜у搧绫诲埆	1byte	缂栧彿	鎻忚堪
+////		01	璋冨厜鍣�
+////		02	缁х數鍣�
+////		03	骞叉帴鐐规ā鍧�
+////		04	浼犳劅鍣�
+////		05	闈㈡澘
+////		06	RCU
+////		07	缃戝叧
+////		08	绾㈠鍙戝皠
+////		09	Android灞�
+////		10	鍦烘櫙
+////		11	闊充箰鎾斁鍣�
+////		12	232/485杞崲鍣�
+////		21	鑷姩鍖�
+////		22	瀹夐槻闃插尯
+////		14	绐楀笜妯″潡
+////		15	HVAC
+////		16	鍦扮儹妯″潡
+
+////鐗╂ā鍨嬬被鍨�	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	锛堥鐣欙級
\ No newline at end of file

--
Gitblit v1.8.0