From 8edf8fd9f5f7c29cc6302a8d46de06d391ed3657 Mon Sep 17 00:00:00 2001
From: JLChen <551775569@qq.com>
Date: 星期四, 16 一月 2020 13:03:57 +0800
Subject: [PATCH] 2020-01-16 Version 2.50115-B3 1.优化MQTT连接。 2.增加本地通信加密。 3.增加配置网关提示语。 4.编辑定时器增加重复名字提示 5.更新规范翻译。
---
Crabtree/SmartHome/UI/SimpleControl/EquipmentPublicClass.cs | 83 +++++++++++++++++++++--------------------
1 files changed, 43 insertions(+), 40 deletions(-)
diff --git a/Crabtree/SmartHome/UI/SimpleControl/EquipmentPublicClass.cs b/Crabtree/SmartHome/UI/SimpleControl/EquipmentPublicClass.cs
index b66d7a9..98f134f 100644
--- a/Crabtree/SmartHome/UI/SimpleControl/EquipmentPublicClass.cs
+++ b/Crabtree/SmartHome/UI/SimpleControl/EquipmentPublicClass.cs
@@ -23,47 +23,46 @@
/// </summary>
public static void CheckLinkRemote (int status)
{
- if (isConnectiong) {
- return;
- }
- isConnectiong = true;
+ //if (isConnectiong) {
+ // return;
+ //}
+ //isConnectiong = true;
UserConfig.Instance.internetStatus = status;
#if wallon
return;
#endif
- if (MainPage.LoginUser == null || !MainPage.LoginUser.IsLogin) {
+ if (MainPage.LoginUser == null || !MainPage.LoginUser.IsLogin || isConnectiong) {
return;
}
+ isConnectiong = true;
new System.Threading.Thread (async () => {
try {
if (status == 0) {
Application.RunOnMainThread (() => {
MainPage.AddTip (Language.StringByID (R.MyInternationalizationString.InternetStatusTip));
- UserMiddle.LinkStatusTip.BackgroundColor = SkinStyle.Current.DelColor;
+ MainPage.WiFiStatus = "CrabtreeAdd/WiFiUnlink.png";
+ UserMiddle.btnLinkStatus.UnSelectedImagePath = MainPage.WiFiStatus;
});
} else {
- if (MainPage.LoginUser == null || !MainPage.LoginUser.IsLogin) {
- return;
- }
- Application.RunOnMainThread (() => {
- if (UserMiddle.LinkStatusTip.BackgroundColor == SkinStyle.Current.DelColor) {
- UserMiddle.LinkStatusTip.BackgroundColor = SkinStyle.Current.MainColor;
- }
- });
+
+ //Application.RunOnMainThread (() => {
+ // if (UserMiddle.LinkStatusTip.BackgroundColor == SkinStyle.Current.DelColor) {
+ // UserMiddle.LinkStatusTip.BackgroundColor = SkinStyle.Current.MainColor;
+ // }
+ //});
var localFileList = IO.FileUtils.ReadFiles ();
var gateWayList = localFileList.FindAll ((obj) => {
return (obj.StartsWith ("Equipment_")) && (
obj.Split ('_') [1].ToString () == DeviceType.OnePortBus.ToString () ||
obj.Split ('_') [1].ToString () == DeviceType.RCU.ToString () ||
obj.Split ('_') [1].ToString () == DeviceType.SuperWireless.ToString () ||
- obj.Split ('_') [1].ToString () == DeviceType.OnePortWirelessFR.ToString ());
+ obj.Split ('_') [1].ToString () == DeviceType.OnePortWirelessFR.ToString () ||
+ obj.Split ('_') [1].ToString () == DeviceType.OnePortMqttFR.ToString());
});
bool canRemote = false;
if (CommonPage.IsRemote) {
- //await SmartHome.MqttCommon.DisConnectRemoteMqttClient ();
//await SmartHome.MqttCommon.StartCloudMqtt ();
-
SmartHome.MqttCommon.MqttRemoteSend (new byte [] { }, 3);
}
foreach (var gatewayFileName in gateWayList) {
@@ -91,28 +90,30 @@
canRemote = false;
var mac0 = CommonPage.byteToHex16 (result [5]) + "." + CommonPage.byteToHex16 (result [6]) + "." + CommonPage.byteToHex16 (result [7]) + "." + CommonPage.byteToHex16 (result [8]) + "." + CommonPage.byteToHex16 (result [9]) + "." + CommonPage.byteToHex16 (result [10]) + "." + CommonPage.byteToHex16 (result [11]) + "." + CommonPage.byteToHex16 (result [12]);
if (common.MAC == mac0) {
+ CommonPage.IsRemote = false;
//var gatewayBytes = Control.ControlBytesSendHasReturn (Command.ReadGateWayModelInfo, common.SubnetID, common.DeviceID, new byte [] { });
- #region
- control.Send (new Target () {
- IPEndPoint = new System.Net.IPEndPoint (System.Net.IPAddress.Parse (new Net.NetWiFi ().BroadcastIpAddress.ToString ()), 6000),
- Command = Command.ReadGateWayModelInfo,
- SubnetID = common.SubnetID,
- DeviceID = common.DeviceID,
- AddData = new byte [] { },
- }, SendCount.Three, true,true);
- var gatewayBytes = control.UsefulBytes;
- #endregion
- if (gatewayBytes != null) {
- common.Remote_GroupName = CommonPage.MyEncodingGB2312.GetString (gatewayBytes, 1, 20).Trim ('\0');
- common.Remote_ProjectName = CommonPage.MyEncodingGB2312.GetString (gatewayBytes, 21, 20).Trim ('\0');
- common.Remote_UserName = CommonPage.MyEncodingGB2312.GetString (gatewayBytes, 41, 8).Trim ('\0');
- common.Remote_Password = CommonPage.MyEncodingGB2312.GetString (gatewayBytes, 49, 8).Trim ('\0');
- var requestJson2 = @"{'Token':'" + MainPage.LoginUser.LoginTokenString + "','MAC':'" + common.MAC + "','Password':'" + common.Remote_Password + "'}";
- var revertObj2 = MainPage.RequestHttps ("UpdateRemoteSwitchPassword", requestJson2, true, false);
- return;
- }
+ //#region
+ //control.Send (new Target () {
+ // IPEndPoint = new System.Net.IPEndPoint (System.Net.IPAddress.Parse (new Net.NetWiFi ().BroadcastIpAddress.ToString ()), 6000),
+ // Command = Command.ReadGateWayModelInfo,
+ // SubnetID = common.SubnetID,
+ // DeviceID = common.DeviceID,
+ // AddData = new byte [] { },
+ //}, SendCount.Three, true,true);
+ //var gatewayBytes = control.UsefulBytes;
+ //#endregion
+ //if (gatewayBytes != null) {
+ //common.Remote_GroupName = CommonPage.MyEncodingGB2312.GetString (gatewayBytes, 1, 20).Trim ('\0');
+ //common.Remote_ProjectName = CommonPage.MyEncodingGB2312.GetString (gatewayBytes, 21, 20).Trim ('\0');
+ //common.Remote_UserName = CommonPage.MyEncodingGB2312.GetString (gatewayBytes, 41, 8).Trim ('\0');
+ //common.Remote_Password = CommonPage.MyEncodingGB2312.GetString (gatewayBytes, 49, 8).Trim ('\0');
+ //var requestJson2 = @"{'Token':'" + MainPage.LoginUser.LoginTokenString + "','MAC':'" + common.MAC + "','Password':'" + common.Remote_Password + "'}";
+ //var revertObj2 = MainPage.RequestHttps ("UpdateRemoteSwitchPassword", requestJson2, true, false);
+ //return;
+ //}
Application.RunOnMainThread (() => {
- UserMiddle.LinkStatusTip.BackgroundColor = SkinStyle.Current.LinkStatusTipColor;
+ MainPage.WiFiStatus = "CrabtreeAdd/WiFi.png";
+ UserMiddle.btnLinkStatus.UnSelectedImagePath = MainPage.WiFiStatus;
MainPage.Loading.Hide ();
});
Shared.SimpleControl.Phone.UserMiddle.ReadAllDeviceStatus ();
@@ -127,9 +128,11 @@
}
}
if (canRemote && !CommonPage.IsRemote) {
- if (!string.IsNullOrEmpty (UserConfig.Instance.CurrentRegion.MAC)) {
- Shared.SimpleControl.CommonPage.IsRemote = true;
- await SmartHome.MqttCommon.StartCloudMqtt ();
+ if (UserConfig.Instance.CheckHomeGateways ()) {
+ if (!string.IsNullOrEmpty (UserConfig.Instance.CurrentRegion.HomeGateways[0].GatewayUniqueId)) {
+ Shared.SimpleControl.CommonPage.IsRemote = true;
+ //await SmartHome.MqttCommon.StartCloudMqtt ();
+ }
}
}
}
--
Gitblit v1.8.0