From acf6f2bfdd9c4fa2500cc746e1064f375dc633d1 Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期一, 13 六月 2022 11:22:43 +0800 Subject: [PATCH] 备份 --- Crabtree/ON/Resources/Resource.designer.cs | 72 ++++--- Crabtree/SmartHome/UI/SimpleControl/CommonPage.cs | 363 ++++++++++++++++++++++------------------ Crabtree/SmartHome/UI/SimpleControl/Phone/Register/MigrationServer.cs | 43 ++++ Crabtree/ON/Properties/AndroidManifest.xml | 2 Crabtree/SmartHome/UI/SimpleControl/Phone/Register/AccountView.cs | 1 Crabtree/SmartHome/HDL/Operation/MyEnum.cs | 7 6 files changed, 284 insertions(+), 204 deletions(-) diff --git a/Crabtree/ON/Properties/AndroidManifest.xml b/Crabtree/ON/Properties/AndroidManifest.xml index 7f4556f..9fbcd05 100644 --- a/Crabtree/ON/Properties/AndroidManifest.xml +++ b/Crabtree/ON/Properties/AndroidManifest.xml @@ -1,5 +1,5 @@ 锘�<?xml version="1.0" encoding="utf-8"?> -<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.hdl.crabtree" android:versionCode="202206091" android:versionName="2.706091"> +<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.hdl.crabtree" android:versionCode="202206131" android:versionName="2.706131"> <uses-sdk android:minSdkVersion="26" android:targetSdkVersion="28" /> <!-- 鍦ㄥ畨鍗揚鐗堟湰涔嬪悗锛屽繀椤昏鎺堜簣FOREGROUND_SERVICE鏉冮檺锛屾墠鑳藉浣跨敤鍓嶅彴鏈嶅姟 --> <uses-permission android:name="android.permission.FOREGROUND_SERVICE" /> diff --git a/Crabtree/ON/Resources/Resource.designer.cs b/Crabtree/ON/Resources/Resource.designer.cs index d29a043..d4bcf86 100644 --- a/Crabtree/ON/Resources/Resource.designer.cs +++ b/Crabtree/ON/Resources/Resource.designer.cs @@ -25,6 +25,7 @@ public static void UpdateIdValues() { + global::DroidService.Resource.String.library_name = global::com.hdl.on.Resource.String.library_name; global::Xamarin.Essentials.Resource.Attribute.font = global::com.hdl.on.Resource.Attribute.font; global::Xamarin.Essentials.Resource.Attribute.fontProviderAuthority = global::com.hdl.on.Resource.Attribute.fontProviderAuthority; global::Xamarin.Essentials.Resource.Attribute.fontProviderCerts = global::com.hdl.on.Resource.Attribute.fontProviderCerts; @@ -4212,106 +4213,109 @@ public const int hello = 2131558444; // aapt resource value: 0x7F0D002D - public const int not_recognized_fingerprint_hint = 2131558445; + public const int library_name = 2131558445; // aapt resource value: 0x7F0D002E - public const int password_toggle_content_description = 2131558446; + public const int not_recognized_fingerprint_hint = 2131558446; // aapt resource value: 0x7F0D002F - public const int path_password_eye = 2131558447; + public const int password_toggle_content_description = 2131558447; // aapt resource value: 0x7F0D0030 - public const int path_password_eye_mask_strike_through = 2131558448; + public const int path_password_eye = 2131558448; // aapt resource value: 0x7F0D0031 - public const int path_password_eye_mask_visible = 2131558449; + public const int path_password_eye_mask_strike_through = 2131558449; // aapt resource value: 0x7F0D0032 - public const int path_password_strike_through = 2131558450; + public const int path_password_eye_mask_visible = 2131558450; // aapt resource value: 0x7F0D0033 - public const int pickerview_cancel = 2131558451; + public const int path_password_strike_through = 2131558451; // aapt resource value: 0x7F0D0034 - public const int pickerview_day = 2131558452; + public const int pickerview_cancel = 2131558452; // aapt resource value: 0x7F0D0035 - public const int pickerview_hours = 2131558453; + public const int pickerview_day = 2131558453; // aapt resource value: 0x7F0D0036 - public const int pickerview_minutes = 2131558454; + public const int pickerview_hours = 2131558454; // aapt resource value: 0x7F0D0037 - public const int pickerview_month = 2131558455; + public const int pickerview_minutes = 2131558455; // aapt resource value: 0x7F0D0038 - public const int pickerview_seconds = 2131558456; + public const int pickerview_month = 2131558456; // aapt resource value: 0x7F0D0039 - public const int pickerview_submit = 2131558457; + public const int pickerview_seconds = 2131558457; // aapt resource value: 0x7F0D003A - public const int pickerview_year = 2131558458; + public const int pickerview_submit = 2131558458; // aapt resource value: 0x7F0D003B - public const int search_menu_title = 2131558459; + public const int pickerview_year = 2131558459; // aapt resource value: 0x7F0D003C - public const int srl_component_falsify = 2131558460; + public const int search_menu_title = 2131558460; // aapt resource value: 0x7F0D003D - public const int srl_content_empty = 2131558461; + public const int srl_component_falsify = 2131558461; // aapt resource value: 0x7F0D003E - public const int srl_footer_failed = 2131558462; + public const int srl_content_empty = 2131558462; // aapt resource value: 0x7F0D003F - public const int srl_footer_finish = 2131558463; + public const int srl_footer_failed = 2131558463; // aapt resource value: 0x7F0D0040 - public const int srl_footer_loading = 2131558464; + public const int srl_footer_finish = 2131558464; // aapt resource value: 0x7F0D0041 - public const int srl_footer_nothing = 2131558465; + public const int srl_footer_loading = 2131558465; // aapt resource value: 0x7F0D0042 - public const int srl_footer_pulling = 2131558466; + public const int srl_footer_nothing = 2131558466; // aapt resource value: 0x7F0D0043 - public const int srl_footer_refreshing = 2131558467; + public const int srl_footer_pulling = 2131558467; // aapt resource value: 0x7F0D0044 - public const int srl_footer_release = 2131558468; + public const int srl_footer_refreshing = 2131558468; // aapt resource value: 0x7F0D0045 - public const int srl_header_failed = 2131558469; + public const int srl_footer_release = 2131558469; // aapt resource value: 0x7F0D0046 - public const int srl_header_finish = 2131558470; + public const int srl_header_failed = 2131558470; // aapt resource value: 0x7F0D0047 - public const int srl_header_loading = 2131558471; + public const int srl_header_finish = 2131558471; // aapt resource value: 0x7F0D0048 - public const int srl_header_pulling = 2131558472; + public const int srl_header_loading = 2131558472; // aapt resource value: 0x7F0D0049 - public const int srl_header_refreshing = 2131558473; + public const int srl_header_pulling = 2131558473; // aapt resource value: 0x7F0D004A - public const int srl_header_release = 2131558474; + public const int srl_header_refreshing = 2131558474; // aapt resource value: 0x7F0D004B - public const int srl_header_secondary = 2131558475; + public const int srl_header_release = 2131558475; // aapt resource value: 0x7F0D004C - public const int srl_header_update = 2131558476; + public const int srl_header_secondary = 2131558476; // aapt resource value: 0x7F0D004D - public const int status_bar_notification_info_overflow = 2131558477; + public const int srl_header_update = 2131558477; // aapt resource value: 0x7F0D004E - public const int touch_fingerprint_sensor_hint = 2131558478; + public const int status_bar_notification_info_overflow = 2131558478; + + // aapt resource value: 0x7F0D004F + public const int touch_fingerprint_sensor_hint = 2131558479; static String() { diff --git a/Crabtree/SmartHome/HDL/Operation/MyEnum.cs b/Crabtree/SmartHome/HDL/Operation/MyEnum.cs index 9750e13..ac48c8d 100644 --- a/Crabtree/SmartHome/HDL/Operation/MyEnum.cs +++ b/Crabtree/SmartHome/HDL/Operation/MyEnum.cs @@ -330,6 +330,13 @@ /// </summary> InitializationGatewayACK = 0x3001, /// <summary> + /// 璁剧疆缃戝叧杩滅▼ + /// 0 鏈湴 + /// 4 杩滅▼ + /// </summary> + //SetGatewayRemote = 0x3003, + //SetGatewayRemoteACK = 0x3004, + /// <summary> /// 鍐欏叆绉橀挜 /// 01 绉橀挜 /// </summary> diff --git a/Crabtree/SmartHome/UI/SimpleControl/CommonPage.cs b/Crabtree/SmartHome/UI/SimpleControl/CommonPage.cs index 2daf543..e76b52c 100644 --- a/Crabtree/SmartHome/UI/SimpleControl/CommonPage.cs +++ b/Crabtree/SmartHome/UI/SimpleControl/CommonPage.cs @@ -955,8 +955,8 @@ Array.Copy (ddd, 0, newddd, 0, 20 < ddd.Length ? 20 : ddd.Length); Array.Copy (newddd, 0, usefullBytes, 13, 20 < newddd.Length ? 20 : newddd.Length); } - switch (deviceType) { - case DeviceType.SuperWireless: + + if (usefullBytes [2] == 254 && usefullBytes [3] > 4) { #region SuperWireless superWireless = new SuperWireless (); string superWirelessPath = "Equipment_" + typeof (OnePortWirelessFR).Name + "_" + subnetID + "_" + deviceID; @@ -986,172 +986,205 @@ Application.RunOnMainThread (() => { GuideAddGateway.InitGatewayRowView (superWireless); }); - //IO.FileUtils.SaveEquipmentMessage (superWireless); - //System.Threading.Tasks.Task.Run (() => { - // if (string.IsNullOrEmpty (UserConfig.Current.RemoteModeFile)) { - // var gatewayBytes = Control.ControlBytesSendHasReturn (Command.ReadGateWayModelInfo, superWireless.SubnetID, superWireless.DeviceID, new byte [] { }); - // if (gatewayBytes!=null&&gatewayBytes [0] == 2) { - // UserConfig.Current.RemoteModeFile = "Equipment_" + superWireless.Type.ToString () + "_" + superWireless.SubnetID.ToString () + "_" + superWireless.DeviceID.ToString (); - // UserConfig.Current.SaveUserConfig (); - // } - // } - //}); #endregion - break; - case DeviceType.OnePortWirelessFR: - #region - OnePortWirelessFR onePortWirelessFR = new OnePortWirelessFR (); - string wirelessPath = "Equipment_" + typeof (OnePortWirelessFR).Name + "_" + subnetID + "_" + deviceID; - var bytes = IO.FileUtils.ReadFile (wirelessPath); - if (bytes.Length > 1) { - onePortWirelessFR = Newtonsoft.Json.JsonConvert.DeserializeObject<OnePortWirelessFR> (MyEncodingUTF8.GetString (bytes)); - } - onePortWirelessFR.SubnetID = subnetID; - onePortWirelessFR.DeviceID = deviceID; - onePortWirelessFR.ChNumberCount = usefullBytes [4]; - onePortWirelessFR.MAC = byteToHex16 (usefullBytes [5]) + "." + byteToHex16 (usefullBytes [6]) + "." + byteToHex16 (usefullBytes [7]) + "." + byteToHex16 (usefullBytes [8]) + "." + byteToHex16 (usefullBytes [9]) + "." + byteToHex16 (usefullBytes [10]) + "." + byteToHex16 (usefullBytes [11]) + "." + byteToHex16 (usefullBytes [12]); - onePortWirelessFR.Name = MyEncodingGB2312.GetString (usefullBytes, 13, 20).Trim ('\0');//============= - onePortWirelessFR.IPAddress = usefullBytes [33] + "." + usefullBytes [34] + "." + usefullBytes [35] + "." + usefullBytes [36]; - onePortWirelessFR.RouteIPAddress = usefullBytes [37] + "." + usefullBytes [38] + "." + usefullBytes [39] + "." + usefullBytes [40]; - onePortWirelessFR.IPMAC = usefullBytes [41] + "." + usefullBytes [42] + "." + usefullBytes [43] + "." + usefullBytes [44] + "." + usefullBytes [45] + "." + usefullBytes [46]; - onePortWirelessFR.SubnetMask = usefullBytes [47] + "." + usefullBytes [48] + "." + usefullBytes [49] + "." + usefullBytes [50]; - onePortWirelessFR.DHCP = usefullBytes [51] == 0 ? false : true; - if (usefullBytes.Length == 80) { - onePortWirelessFR.EncryptionFlag = usefullBytes [53]; - onePortWirelessFR.Password = MyEncodingGB2312.GetString (usefullBytes, 54, 8).Trim ('\0'); - onePortWirelessFR.WirelessBand = usefullBytes [62]; - onePortWirelessFR.WirelessChannel = usefullBytes [63]; - onePortWirelessFR.WirelessPassword = MyEncodingGB2312.GetString (usefullBytes, 64, 16).Trim ('\0'); - } - GateWayList.Add (onePortWirelessFR); - if (onePortWirelessFR.Name == "") { - onePortWirelessFR.Name = onePortWirelessFR.CommonLoopID.ToString (); - } - Application.RunOnMainThread (() => { - GuideAddGateway.InitGatewayRowView (onePortWirelessFR); - }); - //IO.FileUtils.SaveEquipmentMessage (onePortWirelessFR); - //System.Threading.Tasks.Task.Run (() => { - // if (string.IsNullOrEmpty (UserConfig.Current.RemoteModeFile)) { - // var gatewayBytes = Control.ControlBytesSendHasReturn (Command.ReadGateWayModelInfo, onePortWirelessFR.SubnetID, onePortWirelessFR.DeviceID, new byte [] { }); - // if (gatewayBytes!=null&&gatewayBytes [0] == 2) { - // UserConfig.Current.RemoteModeFile = "Equipment_" + onePortWirelessFR.Type.ToString () + "_" + onePortWirelessFR.SubnetID.ToString () + "_" + onePortWirelessFR.DeviceID.ToString (); - // UserConfig.Current.SaveUserConfig (); - // } - // } - //}); - #endregion - break; - case DeviceType.OnePortBus: - #region - OnePortBus onePortBus = new OnePortBus (); - string onePath = "Equipment_" + typeof (OnePortBus).Name + "_" + subnetID + "_" + deviceID; - var bytesOne = IO.FileUtils.ReadFile (onePath); - if (bytesOne.Length > 1) { - onePortBus = Newtonsoft.Json.JsonConvert.DeserializeObject<OnePortBus> (MyEncodingUTF8.GetString (bytesOne)); - } - onePortBus.SubnetID = subnetID; - onePortBus.DeviceID = deviceID; - onePortBus.ChNumberCount = usefullBytes [4]; - onePortBus.MAC = byteToHex16 (usefullBytes [5]) + "." + byteToHex16 (usefullBytes [6]) + "." + byteToHex16 (usefullBytes [7]) + "." + byteToHex16 (usefullBytes [8]) + "." + byteToHex16 (usefullBytes [9]) + "." + byteToHex16 (usefullBytes [10]) + "." + byteToHex16 (usefullBytes [11]) + "." + byteToHex16 (usefullBytes [12]); - onePortBus.Name = MyEncodingGB2312.GetString (usefullBytes, 13, 20).Trim ('\0'); ; - onePortBus.IPAddress = usefullBytes [33] + "." + usefullBytes [34] + "." + usefullBytes [35] + "." + usefullBytes [36]; - onePortBus.RouteIPAddress = usefullBytes [37] + "." + usefullBytes [38] + "." + usefullBytes [39] + "." + usefullBytes [40]; - onePortBus.IPMAC = usefullBytes [41] + "." + usefullBytes [42] + "." + usefullBytes [43] + "." + usefullBytes [44] + "." + usefullBytes [45] + "." + usefullBytes [46]; - onePortBus.SubnetMask = usefullBytes [47] + "." + usefullBytes [48] + "." + usefullBytes [49] + "." + usefullBytes [50]; - onePortBus.DHCP = usefullBytes [51] == 0 ? false : true; - //onePortBus.SubnetID = usefullBytes [52]; - if (usefullBytes.Length == 53 + 1 + 8) { - onePortBus.EncryptionFlag = usefullBytes [53]; - onePortBus.Password = MyEncodingGB2312.GetString (usefullBytes, 54, 8).Trim ('\0'); - } - GateWayList.Add (onePortBus); - if (onePortBus.Name == "") { - onePortBus.Name = onePortBus.CommonLoopID.ToString (); - } - Application.RunOnMainThread (() => { - GuideAddGateway.InitGatewayRowView (onePortBus); - }); - //IO.FileUtils.SaveEquipmentMessage (onePortBus); - //System.Threading.Tasks.Task.Run (() => { - // if (string.IsNullOrEmpty (UserConfig.Current.RemoteModeFile)) { - // var gatewayBytes = Control.ControlBytesSendHasReturn (Command.ReadGateWayModelInfo, onePortBus.SubnetID, onePortBus.DeviceID, new byte [] { }); - // if (gatewayBytes!=null&&gatewayBytes [0] == 2) { - // UserConfig.Current.RemoteModeFile = "Equipment_" + onePortBus.Type.ToString () + "_" + onePortBus.SubnetID.ToString () + "_" + onePortBus.DeviceID.ToString (); - // UserConfig.Current.SaveUserConfig (); - // } - // } - //}); - #endregion - break; - case DeviceType.RCU: - RCU RCU_Device = new RCU (); - string RCU_DevicePath = "Equipment_" + typeof (RCU).Name + "_" + subnetID + "_" + deviceID; - var RCU_DeviceBytes = IO.FileUtils.ReadFile (RCU_DevicePath); - if (RCU_DeviceBytes.Length > 1) { - RCU_Device = Newtonsoft.Json.JsonConvert.DeserializeObject<RCU> (MyEncodingUTF8.GetString (RCU_DeviceBytes)); - } - RCU_Device.SubnetID = subnetID; - RCU_Device.DeviceID = deviceID; - RCU_Device.LoopID = usefullBytes [4]; - RCU_Device.MAC = byteToHex16 (usefullBytes [5]) + "." + byteToHex16 (usefullBytes [6]) + "." + byteToHex16 (usefullBytes [7]) + "." + byteToHex16 (usefullBytes [8]) + "." + byteToHex16 (usefullBytes [9]) + "." + byteToHex16 (usefullBytes [10]) + "." + byteToHex16 (usefullBytes [11]) + "." + byteToHex16 (usefullBytes [12]); - RCU_Device.Name = MyEncodingGB2312.GetString (usefullBytes, 13, 20).Trim ('\0');//============= - RCU_Device.IPAddress = usefullBytes [33] + "." + usefullBytes [34] + "." + usefullBytes [35] + "." + usefullBytes [36]; - RCU_Device.RouteIPAddress = usefullBytes [37] + "." + usefullBytes [38] + "." + usefullBytes [39] + "." + usefullBytes [40]; - RCU_Device.IPMAC = usefullBytes [41] + "." + usefullBytes [42] + "." + usefullBytes [43] + "." + usefullBytes [44] + "." + usefullBytes [45] + "." + usefullBytes [46]; - RCU_Device.SubnetMask = usefullBytes [47] + "." + usefullBytes [48] + "." + usefullBytes [49] + "." + usefullBytes [50]; - RCU_Device.DHCP = usefullBytes [51] == 0 ? false : true; - RCU_Device.LinkNetworkLine = true; - GateWayList.Add (RCU_Device); - if (RCU_Device.Name == "") { - RCU_Device.Name = RCU_Device.CommonLoopID.ToString (); - } - //IO.FileUtils.SaveEquipmentMessage (RCU_Device); - break; - case DeviceType.MusicModel: - MusicModel mm = new MusicModel (); - GateWayList.Add (mm); - mm.SubnetID = subnetID; - mm.DeviceID = deviceID; - mm.ChNumberCount = usefullBytes [4]; - mm.MAC = byteToHex16 (usefullBytes [5]) + "." + byteToHex16 (usefullBytes [6]) + "." + byteToHex16 (usefullBytes [7]) + "." + byteToHex16 (usefullBytes [8]) + "." + byteToHex16 (usefullBytes [9]) + "." + byteToHex16 (usefullBytes [10]) + "." + byteToHex16 (usefullBytes [11]) + "." + byteToHex16 (usefullBytes [12]); - mm.Name = MyEncodingGB2312.GetString (usefullBytes, 13, 20).Trim ('\0');//============= - mm.IPAddress = usefullBytes [33] + "." + usefullBytes [34] + "." + usefullBytes [35] + "." + usefullBytes [36]; - mm.RouteIPAddress = usefullBytes [37] + "." + usefullBytes [38] + "." + usefullBytes [39] + "." + usefullBytes [40]; - mm.IPMAC = (char)usefullBytes [41] + "." + (char)usefullBytes [42] + "." + (char)usefullBytes [43] + "." + usefullBytes [44] + "." + usefullBytes [45] + "." + usefullBytes [46]; - mm.SubnetMask = usefullBytes [47] + "." + usefullBytes [48] + "." + usefullBytes [49] + "." + usefullBytes [50]; - mm.DHCP = 0; - if (mm.Name == "") { - mm.Name = mm.CommonLoopID.ToString (); - } - IO.FileUtils.SaveEquipmentMessage (mm); - IO.FileUtils.SaveEquipmentMessage (mm, "1"); - break; - case DeviceType.MusicA31: - MusicA31 mm31 = new MusicA31 (); - GateWayList.Add (mm31); - mm31.SubnetID = subnetID; - mm31.DeviceID = deviceID; - mm31.ChNumberCount = usefullBytes [4]; - mm31.MAC = byteToHex16 (usefullBytes [5]) + "." + byteToHex16 (usefullBytes [6]) + "." + byteToHex16 (usefullBytes [7]) + "." + byteToHex16 (usefullBytes [8]) + "." + byteToHex16 (usefullBytes [9]) + "." + byteToHex16 (usefullBytes [10]) + "." + byteToHex16 (usefullBytes [11]) + "." + byteToHex16 (usefullBytes [12]); - mm31.Name = MyEncodingGB2312.GetString (usefullBytes, 13, 20).Trim ('\0');//============= - mm31.IPAddress = usefullBytes [33] + "." + usefullBytes [34] + "." + usefullBytes [35] + "." + usefullBytes [36]; - mm31.RouteIPAddress = usefullBytes [37] + "." + usefullBytes [38] + "." + usefullBytes [39] + "." + usefullBytes [40]; - mm31.IPMAC = usefullBytes [41] + "." + usefullBytes [42] + "." + usefullBytes [43] + "." + usefullBytes [44] + "." + usefullBytes [45] + "." + usefullBytes [46]; - mm31.SubnetMask = usefullBytes [47] + "." + usefullBytes [48] + "." + usefullBytes [49] + "." + usefullBytes [50]; - mm31.DHCP = usefullBytes [51]; - if (mm31.Name == "") { - mm31.Name = mm31.CommonLoopID.ToString (); - } - //mm31.SubnetID - IO.FileUtils.SaveEquipmentMessage (mm31); - IO.FileUtils.SaveEquipmentMessage (mm31, "1"); - break; - default: + } else { + switch (deviceType) { + case DeviceType.SuperWireless: + #region + SuperWireless superWireless = new SuperWireless (); + string superWirelessPath = "Equipment_" + typeof (OnePortWirelessFR).Name + "_" + subnetID + "_" + deviceID; + var superWirelessbytes = IO.FileUtils.ReadFile (superWirelessPath); + if (superWirelessbytes.Length > 1) { + superWireless = Newtonsoft.Json.JsonConvert.DeserializeObject<SuperWireless> (MyEncodingUTF8.GetString (superWirelessbytes)); + } + superWireless.SubnetID = subnetID; + superWireless.DeviceID = deviceID; + superWireless.ChNumberCount = usefullBytes [4]; + superWireless.MAC = byteToHex16 (usefullBytes [5]) + "." + byteToHex16 (usefullBytes [6]) + "." + byteToHex16 (usefullBytes [7]) + "." + byteToHex16 (usefullBytes [8]) + "." + byteToHex16 (usefullBytes [9]) + "." + byteToHex16 (usefullBytes [10]) + "." + byteToHex16 (usefullBytes [11]) + "." + byteToHex16 (usefullBytes [12]); - break; + superWireless.Name = MyEncodingGB2312.GetString (usefullBytes, 13, 20).Trim ('\0');//============= + superWireless.IPAddress = usefullBytes [33] + "." + usefullBytes [34] + "." + usefullBytes [35] + "." + usefullBytes [36]; + superWireless.RouteIPAddress = usefullBytes [37] + "." + usefullBytes [38] + "." + usefullBytes [39] + "." + usefullBytes [40]; + superWireless.IPMAC = usefullBytes [41] + "." + usefullBytes [42] + "." + usefullBytes [43] + "." + usefullBytes [44] + "." + usefullBytes [45] + "." + usefullBytes [46]; + superWireless.SubnetMask = usefullBytes [47] + "." + usefullBytes [48] + "." + usefullBytes [49] + "." + usefullBytes [50]; + superWireless.DHCP = usefullBytes [51] == 0 ? false : true; + if (usefullBytes.Length == 80) { + superWireless.EncryptionFlag = usefullBytes [53]; + superWireless.Password = MyEncodingGB2312.GetString (usefullBytes, 54, 8).Trim ('\0'); + superWireless.WirelessBand = usefullBytes [62]; + superWireless.WirelessChannel = usefullBytes [63]; + superWireless.WirelessPassword = MyEncodingGB2312.GetString (usefullBytes, 64, 16).Trim ('\0'); + } + GateWayList.Add (superWireless); + Application.RunOnMainThread (() => { + GuideAddGateway.InitGatewayRowView (superWireless); + }); + //IO.FileUtils.SaveEquipmentMessage (superWireless); + //System.Threading.Tasks.Task.Run (() => { + // if (string.IsNullOrEmpty (UserConfig.Current.RemoteModeFile)) { + // var gatewayBytes = Control.ControlBytesSendHasReturn (Command.ReadGateWayModelInfo, superWireless.SubnetID, superWireless.DeviceID, new byte [] { }); + // if (gatewayBytes!=null&&gatewayBytes [0] == 2) { + // UserConfig.Current.RemoteModeFile = "Equipment_" + superWireless.Type.ToString () + "_" + superWireless.SubnetID.ToString () + "_" + superWireless.DeviceID.ToString (); + // UserConfig.Current.SaveUserConfig (); + // } + // } + //}); + #endregion + break; + case DeviceType.OnePortWirelessFR: + #region + OnePortWirelessFR onePortWirelessFR = new OnePortWirelessFR (); + string wirelessPath = "Equipment_" + typeof (OnePortWirelessFR).Name + "_" + subnetID + "_" + deviceID; + var bytes = IO.FileUtils.ReadFile (wirelessPath); + if (bytes.Length > 1) { + onePortWirelessFR = Newtonsoft.Json.JsonConvert.DeserializeObject<OnePortWirelessFR> (MyEncodingUTF8.GetString (bytes)); + } + onePortWirelessFR.SubnetID = subnetID; + onePortWirelessFR.DeviceID = deviceID; + onePortWirelessFR.ChNumberCount = usefullBytes [4]; + onePortWirelessFR.MAC = byteToHex16 (usefullBytes [5]) + "." + byteToHex16 (usefullBytes [6]) + "." + byteToHex16 (usefullBytes [7]) + "." + byteToHex16 (usefullBytes [8]) + "." + byteToHex16 (usefullBytes [9]) + "." + byteToHex16 (usefullBytes [10]) + "." + byteToHex16 (usefullBytes [11]) + "." + byteToHex16 (usefullBytes [12]); + onePortWirelessFR.Name = MyEncodingGB2312.GetString (usefullBytes, 13, 20).Trim ('\0');//============= + onePortWirelessFR.IPAddress = usefullBytes [33] + "." + usefullBytes [34] + "." + usefullBytes [35] + "." + usefullBytes [36]; + onePortWirelessFR.RouteIPAddress = usefullBytes [37] + "." + usefullBytes [38] + "." + usefullBytes [39] + "." + usefullBytes [40]; + onePortWirelessFR.IPMAC = usefullBytes [41] + "." + usefullBytes [42] + "." + usefullBytes [43] + "." + usefullBytes [44] + "." + usefullBytes [45] + "." + usefullBytes [46]; + onePortWirelessFR.SubnetMask = usefullBytes [47] + "." + usefullBytes [48] + "." + usefullBytes [49] + "." + usefullBytes [50]; + onePortWirelessFR.DHCP = usefullBytes [51] == 0 ? false : true; + if (usefullBytes.Length == 80) { + onePortWirelessFR.EncryptionFlag = usefullBytes [53]; + onePortWirelessFR.Password = MyEncodingGB2312.GetString (usefullBytes, 54, 8).Trim ('\0'); + onePortWirelessFR.WirelessBand = usefullBytes [62]; + onePortWirelessFR.WirelessChannel = usefullBytes [63]; + onePortWirelessFR.WirelessPassword = MyEncodingGB2312.GetString (usefullBytes, 64, 16).Trim ('\0'); + } + GateWayList.Add (onePortWirelessFR); + if (onePortWirelessFR.Name == "") { + onePortWirelessFR.Name = onePortWirelessFR.CommonLoopID.ToString (); + } + Application.RunOnMainThread (() => { + GuideAddGateway.InitGatewayRowView (onePortWirelessFR); + }); + //IO.FileUtils.SaveEquipmentMessage (onePortWirelessFR); + //System.Threading.Tasks.Task.Run (() => { + // if (string.IsNullOrEmpty (UserConfig.Current.RemoteModeFile)) { + // var gatewayBytes = Control.ControlBytesSendHasReturn (Command.ReadGateWayModelInfo, onePortWirelessFR.SubnetID, onePortWirelessFR.DeviceID, new byte [] { }); + // if (gatewayBytes!=null&&gatewayBytes [0] == 2) { + // UserConfig.Current.RemoteModeFile = "Equipment_" + onePortWirelessFR.Type.ToString () + "_" + onePortWirelessFR.SubnetID.ToString () + "_" + onePortWirelessFR.DeviceID.ToString (); + // UserConfig.Current.SaveUserConfig (); + // } + // } + //}); + #endregion + break; + case DeviceType.OnePortBus: + #region + OnePortBus onePortBus = new OnePortBus (); + string onePath = "Equipment_" + typeof (OnePortBus).Name + "_" + subnetID + "_" + deviceID; + var bytesOne = IO.FileUtils.ReadFile (onePath); + if (bytesOne.Length > 1) { + onePortBus = Newtonsoft.Json.JsonConvert.DeserializeObject<OnePortBus> (MyEncodingUTF8.GetString (bytesOne)); + } + onePortBus.SubnetID = subnetID; + onePortBus.DeviceID = deviceID; + onePortBus.ChNumberCount = usefullBytes [4]; + onePortBus.MAC = byteToHex16 (usefullBytes [5]) + "." + byteToHex16 (usefullBytes [6]) + "." + byteToHex16 (usefullBytes [7]) + "." + byteToHex16 (usefullBytes [8]) + "." + byteToHex16 (usefullBytes [9]) + "." + byteToHex16 (usefullBytes [10]) + "." + byteToHex16 (usefullBytes [11]) + "." + byteToHex16 (usefullBytes [12]); + onePortBus.Name = MyEncodingGB2312.GetString (usefullBytes, 13, 20).Trim ('\0'); ; + onePortBus.IPAddress = usefullBytes [33] + "." + usefullBytes [34] + "." + usefullBytes [35] + "." + usefullBytes [36]; + onePortBus.RouteIPAddress = usefullBytes [37] + "." + usefullBytes [38] + "." + usefullBytes [39] + "." + usefullBytes [40]; + onePortBus.IPMAC = usefullBytes [41] + "." + usefullBytes [42] + "." + usefullBytes [43] + "." + usefullBytes [44] + "." + usefullBytes [45] + "." + usefullBytes [46]; + onePortBus.SubnetMask = usefullBytes [47] + "." + usefullBytes [48] + "." + usefullBytes [49] + "." + usefullBytes [50]; + onePortBus.DHCP = usefullBytes [51] == 0 ? false : true; + //onePortBus.SubnetID = usefullBytes [52]; + if (usefullBytes.Length == 53 + 1 + 8) { + onePortBus.EncryptionFlag = usefullBytes [53]; + onePortBus.Password = MyEncodingGB2312.GetString (usefullBytes, 54, 8).Trim ('\0'); + } + GateWayList.Add (onePortBus); + if (onePortBus.Name == "") { + onePortBus.Name = onePortBus.CommonLoopID.ToString (); + } + Application.RunOnMainThread (() => { + GuideAddGateway.InitGatewayRowView (onePortBus); + }); + //IO.FileUtils.SaveEquipmentMessage (onePortBus); + //System.Threading.Tasks.Task.Run (() => { + // if (string.IsNullOrEmpty (UserConfig.Current.RemoteModeFile)) { + // var gatewayBytes = Control.ControlBytesSendHasReturn (Command.ReadGateWayModelInfo, onePortBus.SubnetID, onePortBus.DeviceID, new byte [] { }); + // if (gatewayBytes!=null&&gatewayBytes [0] == 2) { + // UserConfig.Current.RemoteModeFile = "Equipment_" + onePortBus.Type.ToString () + "_" + onePortBus.SubnetID.ToString () + "_" + onePortBus.DeviceID.ToString (); + // UserConfig.Current.SaveUserConfig (); + // } + // } + //}); + #endregion + break; + case DeviceType.RCU: + RCU RCU_Device = new RCU (); + string RCU_DevicePath = "Equipment_" + typeof (RCU).Name + "_" + subnetID + "_" + deviceID; + var RCU_DeviceBytes = IO.FileUtils.ReadFile (RCU_DevicePath); + if (RCU_DeviceBytes.Length > 1) { + RCU_Device = Newtonsoft.Json.JsonConvert.DeserializeObject<RCU> (MyEncodingUTF8.GetString (RCU_DeviceBytes)); + } + RCU_Device.SubnetID = subnetID; + RCU_Device.DeviceID = deviceID; + RCU_Device.LoopID = usefullBytes [4]; + RCU_Device.MAC = byteToHex16 (usefullBytes [5]) + "." + byteToHex16 (usefullBytes [6]) + "." + byteToHex16 (usefullBytes [7]) + "." + byteToHex16 (usefullBytes [8]) + "." + byteToHex16 (usefullBytes [9]) + "." + byteToHex16 (usefullBytes [10]) + "." + byteToHex16 (usefullBytes [11]) + "." + byteToHex16 (usefullBytes [12]); + RCU_Device.Name = MyEncodingGB2312.GetString (usefullBytes, 13, 20).Trim ('\0');//============= + RCU_Device.IPAddress = usefullBytes [33] + "." + usefullBytes [34] + "." + usefullBytes [35] + "." + usefullBytes [36]; + RCU_Device.RouteIPAddress = usefullBytes [37] + "." + usefullBytes [38] + "." + usefullBytes [39] + "." + usefullBytes [40]; + RCU_Device.IPMAC = usefullBytes [41] + "." + usefullBytes [42] + "." + usefullBytes [43] + "." + usefullBytes [44] + "." + usefullBytes [45] + "." + usefullBytes [46]; + RCU_Device.SubnetMask = usefullBytes [47] + "." + usefullBytes [48] + "." + usefullBytes [49] + "." + usefullBytes [50]; + RCU_Device.DHCP = usefullBytes [51] == 0 ? false : true; + RCU_Device.LinkNetworkLine = true; + GateWayList.Add (RCU_Device); + if (RCU_Device.Name == "") { + RCU_Device.Name = RCU_Device.CommonLoopID.ToString (); + } + //IO.FileUtils.SaveEquipmentMessage (RCU_Device); + break; + case DeviceType.MusicModel: + MusicModel mm = new MusicModel (); + GateWayList.Add (mm); + mm.SubnetID = subnetID; + mm.DeviceID = deviceID; + mm.ChNumberCount = usefullBytes [4]; + mm.MAC = byteToHex16 (usefullBytes [5]) + "." + byteToHex16 (usefullBytes [6]) + "." + byteToHex16 (usefullBytes [7]) + "." + byteToHex16 (usefullBytes [8]) + "." + byteToHex16 (usefullBytes [9]) + "." + byteToHex16 (usefullBytes [10]) + "." + byteToHex16 (usefullBytes [11]) + "." + byteToHex16 (usefullBytes [12]); + mm.Name = MyEncodingGB2312.GetString (usefullBytes, 13, 20).Trim ('\0');//============= + mm.IPAddress = usefullBytes [33] + "." + usefullBytes [34] + "." + usefullBytes [35] + "." + usefullBytes [36]; + mm.RouteIPAddress = usefullBytes [37] + "." + usefullBytes [38] + "." + usefullBytes [39] + "." + usefullBytes [40]; + mm.IPMAC = (char)usefullBytes [41] + "." + (char)usefullBytes [42] + "." + (char)usefullBytes [43] + "." + usefullBytes [44] + "." + usefullBytes [45] + "." + usefullBytes [46]; + mm.SubnetMask = usefullBytes [47] + "." + usefullBytes [48] + "." + usefullBytes [49] + "." + usefullBytes [50]; + mm.DHCP = 0; + if (mm.Name == "") { + mm.Name = mm.CommonLoopID.ToString (); + } + IO.FileUtils.SaveEquipmentMessage (mm); + IO.FileUtils.SaveEquipmentMessage (mm, "1"); + break; + case DeviceType.MusicA31: + MusicA31 mm31 = new MusicA31 (); + GateWayList.Add (mm31); + mm31.SubnetID = subnetID; + mm31.DeviceID = deviceID; + mm31.ChNumberCount = usefullBytes [4]; + mm31.MAC = byteToHex16 (usefullBytes [5]) + "." + byteToHex16 (usefullBytes [6]) + "." + byteToHex16 (usefullBytes [7]) + "." + byteToHex16 (usefullBytes [8]) + "." + byteToHex16 (usefullBytes [9]) + "." + byteToHex16 (usefullBytes [10]) + "." + byteToHex16 (usefullBytes [11]) + "." + byteToHex16 (usefullBytes [12]); + mm31.Name = MyEncodingGB2312.GetString (usefullBytes, 13, 20).Trim ('\0');//============= + mm31.IPAddress = usefullBytes [33] + "." + usefullBytes [34] + "." + usefullBytes [35] + "." + usefullBytes [36]; + mm31.RouteIPAddress = usefullBytes [37] + "." + usefullBytes [38] + "." + usefullBytes [39] + "." + usefullBytes [40]; + mm31.IPMAC = usefullBytes [41] + "." + usefullBytes [42] + "." + usefullBytes [43] + "." + usefullBytes [44] + "." + usefullBytes [45] + "." + usefullBytes [46]; + mm31.SubnetMask = usefullBytes [47] + "." + usefullBytes [48] + "." + usefullBytes [49] + "." + usefullBytes [50]; + mm31.DHCP = usefullBytes [51]; + if (mm31.Name == "") { + mm31.Name = mm31.CommonLoopID.ToString (); + } + //mm31.SubnetID + IO.FileUtils.SaveEquipmentMessage (mm31); + IO.FileUtils.SaveEquipmentMessage (mm31, "1"); + break; + default: + + break; + } } - //GuideAddGateway.InitGatewayRowView (new Common () { // SubnetID = subnetID, DeviceID = deviceID, Name = MyEncodingGB2312.GetString (usefullBytes, 13, 20).Trim ('\0') //}); diff --git a/Crabtree/SmartHome/UI/SimpleControl/Phone/Register/AccountView.cs b/Crabtree/SmartHome/UI/SimpleControl/Phone/Register/AccountView.cs index e0ca42d..08e31e8 100644 --- a/Crabtree/SmartHome/UI/SimpleControl/Phone/Register/AccountView.cs +++ b/Crabtree/SmartHome/UI/SimpleControl/Phone/Register/AccountView.cs @@ -12,6 +12,7 @@ { } + public void ShouwAccountView () { diff --git a/Crabtree/SmartHome/UI/SimpleControl/Phone/Register/MigrationServer.cs b/Crabtree/SmartHome/UI/SimpleControl/Phone/Register/MigrationServer.cs index 0fbf265..16dd21d 100644 --- a/Crabtree/SmartHome/UI/SimpleControl/Phone/Register/MigrationServer.cs +++ b/Crabtree/SmartHome/UI/SimpleControl/Phone/Register/MigrationServer.cs @@ -13,7 +13,8 @@ /// </summary> private bool finish = false; - private string SeverAddr = "https://test-gz.hdlcontrol.com";//"https://bahrain-gateway.hdlcontrol.com" + private string SeverAddr = "https://bahrain-gateway.hdlcontrol.com"; + //private string SeverAddr = "https://test-gz.hdlcontrol.com"; FrameLayout contentView; @@ -27,6 +28,7 @@ string newUserId; Button btnSave; + public MigrationServer () { @@ -76,6 +78,7 @@ Text = "璇疯緭鍏ュ瘑鐮侊紝纭杩佺Щ", TextAlignment = TextAlignment.CenterLeft, TextColor = SkinStyle.Current.TextColor, + IsMoreLines = true, }; contentView.AddChidren (btnTipTitle); @@ -152,7 +155,6 @@ } #if DEBUG - //WriteSecretKey (1, 0, new byte [] {1,1,2,3,2,3,4,5,2,3,5,6 }); //CheckGateway (); @@ -608,12 +610,27 @@ System.Threading.Thread.Sleep (100); } else { Application.RunOnMainThread (() => { - btnTipMsg.Text = "鍒濆鍖栫綉鍏虫垚鍔�,姝e湪杩佺Щ璐﹀彿淇℃伅銆�"; + btnTipMsg.Text = "鍒濆鍖栫綉鍏虫垚鍔�,姝e湪鎵撳紑缃戝叧杩滅▼閰嶇疆銆�"; btnTipMsg.TextColor = SkinStyle.Current.TextColor; }); break; } } + //寮�鍚綉鍏宠繙绋� + var setRemoteResult = SetGatewayRemote (common.SubnetID, common.DeviceID); + if (setRemoteResult) { + Application.RunOnMainThread (() => { + btnTipMsg.Text = "缃戝叧杩滅▼宸插紑鍚�,姝e湪杩佺Щ璐﹀彿淇℃伅銆�"; + btnTipMsg.TextColor = SkinStyle.Current.TextColor; + }); + } else { + Application.RunOnMainThread (() => { + btnTipMsg.Text = "缃戝叧杩滅▼寮�鍚け璐ャ��"; + btnTipMsg.TextColor = SkinStyle.Current.DelColor; + }); + return; + } + //杩佺Щ璐﹀彿 var moveAccontResult = Account2New (pwd); if (moveAccontResult) { @@ -818,7 +835,25 @@ Control.ControlBytesSend (Command.InitializationGateway, subnetId, deviceId, sendByets); } - + + /// <summary> + /// 璁惧缃戝叧寮�鍚繙绋� + /// </summary> + private bool SetGatewayRemote(byte subnetId, byte deviceId) + { + var sendByte = new byte [67]; + sendByte [0] = 4; + var result = Control.ControlBytesSendHasReturn (Command.SetGateWayModelInfo, subnetId, deviceId, sendByte); + if (result == null) { + + } else { + if(result.Length>0 && result[0] == 248) { + return true; + } + } + return false; + } + /// <summary> /// 鍐欏叆homeId /// </summary> -- Gitblit v1.8.0