HDL_ON/DAL/DriverLayer/A_Protocol_Common.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
HDL_ON/DAL/DriverLayer/Control.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
HDL_ON/DAL/Mqtt/MqttClient.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
HDL_ON/HDL_ON.projitems | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
HDL_ON/UI/UI0-Stan/Logic/HdlBluetoothAndroidLogic.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
HDL_ON/UI/UI0-Stan/Logic/HdlCloudReceiveLogic.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
HDL_ON/UI/UI2/4-PersonalCenter/AddDevice/AddMiniRemoteControlDirection1Page.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
HDL_ON/UI/UI2/4-PersonalCenter/AddDevice/AddMiniRemoteControlDirection2Page.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
HDL_ON/UI/UI2/4-PersonalCenter/AddDevice/AddMiniRemoteControlDirection3Page.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
HDL_ON/UI/UI2/4-PersonalCenter/AddDevice/AddMiniRemoteControlDirection4Page.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
HDL_ON/DAL/DriverLayer/A_Protocol_Common.cs
@@ -115,15 +115,5 @@ return $"/user/{Control.Ins.GatewayId}/custom/scene/execute"; } } /// <summary> /// 添加设备上报 /// </summary> public string AddDevicePush { get { return $"/base/{Control.Ins.GatewayId}/thing/topo/found_reply"; } } } } HDL_ON/DAL/DriverLayer/Control.cs
@@ -647,7 +647,7 @@ else { //一些特殊的主题处理(为了执行速度,尽可能的别加耗时的操作) Stan.HdlCloudReceiveLogic.Current.CloudOverallMsgReceive(receiveObj.Topic, receiveObj.BodyDataString); Stan.HdlCloudReceiveLogic.Current.CloudOverallMsgReceiveEx(receiveObj.Topic, receiveObj.BodyDataString); } } return receiveObj; HDL_ON/DAL/Mqtt/MqttClient.cs
@@ -278,6 +278,12 @@ } } //一些特殊的主题处理(为了执行速度,尽可能的别加耗时的操作 true:执行了特殊处理 false:没有执行特殊处理) if (Stan.HdlCloudReceiveLogic.Current.CloudOverallMsgReceiveEx(topic, e.ApplicationMessage.Payload, mqttEncryptKey, tuyaEncryptKey) == true) { return; } if (topic == $"/BusGateWayToClient/{UserInfo.Current.ID}" + PushNotifySqueeze) { var mMes = Encoding.UTF8.GetString(e.ApplicationMessage.Payload); @@ -295,7 +301,7 @@ else { //SetGatewayOnlineResetCheck(); var bytes = Securitys.EncryptionService.AesDecryptPayload(e.ApplicationMessage.Payload, mqttEncryptKey); //var bytes = Securitys.EncryptionService.AesDecryptPayload(e.ApplicationMessage.Payload, mqttEncryptKey); //bus数据解析 var packet = new Packet(); HDL_ON/HDL_ON.projitems
@@ -26,6 +26,8 @@ <Compile Include="$(MSBuildThisFileDirectory)Entity\Function\Function.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI0-Public\PublicAssmebly.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\CSS\CSS.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI0-Stan\Logic\HdlBluetoothAndroidLogic.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI0-Stan\Logic\HdlBluetoothIOSLogic.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\UserPageBLL.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\UserPage.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\2-Classification\ClassificationPage.cs" /> @@ -358,7 +360,6 @@ <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Electrical\ClothesHangerSetTimePage.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\ArmSensor\ArmSensorHistroyPaging.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\AC\AcControlPage.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI0-Stan\Logic\HdlBluetoothAndroidLogic.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI0-Stan\Logic\HdlCloudReceiveLogic.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI0-Stan\Logic\HdlWifiLogic.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI0-Stan\Controls\CompoundControls\ProgressRowBar.cs" /> @@ -367,10 +368,8 @@ <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\AddDevice\AddMiniRemoteControlDirection2Page.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\AddDevice\AddMiniRemoteControlDirection4Page.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\AddDevice\AddThirdPartyDeviceMenuListPage.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI0-Stan\Logic\HdlBluetoothIOSLogic.cs" /> </ItemGroup> <ItemGroup> <Folder Include="$(MSBuildThisFileDirectory)UI\" /> <Folder Include="$(MSBuildThisFileDirectory)DAL\" /> <Folder Include="$(MSBuildThisFileDirectory)DAL\Mqtt\" /> <Folder Include="$(MSBuildThisFileDirectory)Common\" /> @@ -408,4 +407,4 @@ <Folder Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\PirDevice\" /> <Folder Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\PirDevice\View\" /> </ItemGroup> </Project> </Project> HDL_ON/UI/UI0-Stan/Logic/HdlBluetoothAndroidLogic.cs
@@ -6,24 +6,24 @@ namespace HDL_ON.Stan { #if __Android__ public class HdlAndroidBluetoothLogic public class HdlBluetoothLogic { #region ■ 变量声明___________________________ /// <summary> /// 安卓蓝牙的逻辑 /// </summary> private static HdlAndroidBluetoothLogic m_Current = null; private static HdlBluetoothLogic m_Current = null; /// <summary> /// 安卓蓝牙的逻辑 /// </summary> public static HdlAndroidBluetoothLogic Current public static HdlBluetoothLogic Current { get { if (m_Current == null) { m_Current = new HdlAndroidBluetoothLogic(); m_Current = new HdlBluetoothLogic(); } return m_Current; } HDL_ON/UI/UI0-Stan/Logic/HdlCloudReceiveLogic.cs
@@ -50,24 +50,50 @@ #region ■ 全局接收___________________________ /// <summary> /// 全局接收云端推送的的逻辑(为了执行速度,尽可能的别加耗时的操作) /// 特殊全局接收云端推送的的逻辑(为了执行速度,尽可能的别加耗时的操作 true:执行了特殊处理 false:没有执行特殊处理) /// </summary> /// <param name="topic">整个主题</param> /// <param name="byteData">接收的数据</param> /// <param name="mqttEncryptKey">Mqtt的解密密钥</param> /// <param name="homeIdEncryptKey">住宅倒序的解密密钥</param> public bool CloudOverallMsgReceiveEx(string topic, byte[] byteData, string mqttEncryptKey, string homeIdEncryptKey) { //设备入网上报主题 if (topic == $"/user/{Entity.DB_ResidenceData.Instance.CurrentRegion.RegionID}/app/thing/topo/found") { if (string.IsNullOrEmpty(homeIdEncryptKey) == false) { //解密 byteData = Securitys.EncryptionService.AesDecryptPayload(byteData, homeIdEncryptKey); } string msgData = Encoding.UTF8.GetString(byteData); //这里特殊,别急着转字符串,先判断主题再转 return this.CloudOverallMsgReceiveEx(topic, msgData); } return false; } /// <summary> /// 特殊全局接收云端推送的的逻辑(为了执行速度,尽可能的别加耗时的操作 true:执行了特殊处理 false:没有执行特殊处理) /// </summary> /// <param name="topic">整个主题</param> /// <param name="msgData">接收的数据</param> public void CloudOverallMsgReceive(string topic, string msgData) public bool CloudOverallMsgReceiveEx(string topic, string msgData) { //没有任何监听 if (ListCloudEvent.Count == 0) { return; } if (ListCloudEvent.Count == 0) { return false; } //设备入网上报主题(目前只有红外宝) if (topic == DriverLayer.CommunicationTopic.ct.AddDevicePush) if (topic == $"/user/{Entity.DB_ResidenceData.Instance.CurrentRegion.RegionID}/app/thing/topo/found") { for (int i = 0; i < this.ListCloudEvent.Count; i++) { //回调事件 this.ListCloudEvent[i].CloudReceiveEvent(CloudPushEnum.A新设备上报, msgData); } return true; } return false; } #endregion HDL_ON/UI/UI2/4-PersonalCenter/AddDevice/AddMiniRemoteControlDirection1Page.cs
@@ -66,7 +66,8 @@ { this.CloseForm(); var form = new AddMiniRemoteControlDirection2Page(); form.AddForm(); //初始wifi和密码为空 form.AddForm(string.Empty, string.Empty); } }); }; HDL_ON/UI/UI2/4-PersonalCenter/AddDevice/AddMiniRemoteControlDirection2Page.cs
@@ -13,6 +13,15 @@ { #region ■ 变量声明___________________________ /// <summary> /// wifi名 /// </summary> private string wifiName = string.Empty; /// <summary> /// wifi密码 /// </summary> private string wifiPassword = string.Empty; #endregion #region ■ 初始化_____________________________ @@ -20,8 +29,13 @@ /// <summary> /// 画面显示(底层会固定调用此方法,借以完成画面创建) /// </summary> public void ShowForm() /// <param name="i_wifiName">wifi名(别的界面传过来的)</param> /// <param name="i_wifiPassword">(别的界面传过来的)</param> public void ShowForm(string i_wifiName, string i_wifiPassword) { this.wifiName = i_wifiName; this.wifiPassword = i_wifiPassword; //设置头部信息 base.SetTitleText(Language.StringByID(StringId.AddInfraredRemoteControl)); //这个界面的背景需要白色 @@ -124,8 +138,12 @@ { this.CloseForm(); var form = new AddMiniRemoteControlDirection3Page(); form.AddForm(); form.AddForm(this.wifiName, this.wifiPassword); }); } else { HdlBluetoothLogic.Current.Dispone(); } }); } @@ -149,9 +167,13 @@ { this.CloseForm(); var form = new AddMiniRemoteControlDirection3Page(); form.AddForm(); form.AddForm(this.wifiName, this.wifiPassword); }); } else { HdlBluetoothLogic.Current.Dispone(); } }); }); } HDL_ON/UI/UI2/4-PersonalCenter/AddDevice/AddMiniRemoteControlDirection3Page.cs
@@ -21,6 +21,14 @@ /// wifi的线程是否启动 /// </summary> private bool WifiThreadAction = false; /// <summary> /// wifi名(别的界面传过来的) /// </summary> private string wifiName = string.Empty; /// <summary> /// wifi密码(别的界面传过来的) /// </summary> private string wifiPassword = string.Empty; #endregion @@ -29,8 +37,13 @@ /// <summary> /// 画面显示(底层会固定调用此方法,借以完成画面创建) /// </summary> public void ShowForm() /// <param name="i_wifiName">wifi名(别的界面传过来的)</param> /// <param name="i_wifiPassword">(别的界面传过来的)</param> public void ShowForm(string i_wifiName, string i_wifiPassword) { this.wifiName = i_wifiName; this.wifiPassword = i_wifiPassword; //设置头部信息 base.SetTitleText(Language.StringByID(StringId.AddInfraredRemoteControl)); //这个界面的背景需要白色 @@ -38,6 +51,14 @@ //初始化中部信息 this.InitMiddleFrame(); //重写底层的返回按键 this.BackButtonClickEvent += () => { //关掉蓝牙 HdlBluetoothLogic.Current.Dispone(); this.CloseForm(); }; } /// <summary> @@ -65,7 +86,7 @@ rowWifi.Y = yy + Application.GetRealHeight(32); bodyFrameLayout.AddChidren(rowWifi); //wifi名字 var txtWifi = rowWifi.frameTable.AddLeftInput("", 200); var txtWifi = rowWifi.frameTable.AddLeftInput(wifiName, 200); txtWifi.TextColor = CSS.CSS_Color.FirstLevelTitleColor; //底线 rowWifi.frameTable.AddBottomLine(); @@ -79,13 +100,18 @@ //刷新wifi名字 this.RefreshWifiName(txtWifi); }; if (this.wifiName != string.Empty) { //这个时候是重试模式,不允许点击 btnRight.CanClick = false; } //密码行 var rowPsw = new RowLayoutControl(); rowPsw.Y = rowWifi.Bottom; bodyFrameLayout.AddChidren(rowPsw); //密码 var txtPsw = rowPsw.frameTable.AddLeftInput("551775569", 200); var txtPsw = rowPsw.frameTable.AddLeftInput(wifiPassword, 200); txtPsw.TextColor = CSS.CSS_Color.FirstLevelTitleColor; txtPsw.PlaceholderText = Language.StringByID(StringId.Password); txtPsw.SecureTextEntry = true; @@ -100,6 +126,22 @@ btnView.IsSelected = !btnView.IsSelected; txtPsw.SecureTextEntry = !btnView.IsSelected; }; if (this.wifiName != string.Empty) { //这个时候是重试模式,不需要点击 HdlThreadLogic.Current.RunThread(() => { System.Threading.Thread.Sleep(1000); HdlThreadLogic.Current.RunMain(() => { //进入下一个界面 this.CloseForm(); var form = new AddMiniRemoteControlDirection4Page(); form.AddForm(wifiName, wifiPassword); }); }); return; } //下一步 var btnNext = this.AddBottomClickButton(Language.StringByID(StringId.Next)); HDL_ON/UI/UI2/4-PersonalCenter/AddDevice/AddMiniRemoteControlDirection4Page.cs
@@ -252,7 +252,9 @@ btnReDo.ButtonClickEvent += (sender, e) => { //重新初始化中部信息 this.InitMiddleFrame(); this.CloseForm(); var form = new AddMiniRemoteControlDirection2Page(); form.AddForm(this.wifiName, this.wifiPsw); }; } @@ -273,6 +275,59 @@ #endregion #region ■ 红外宝相关方法_____________________ /// <summary> /// 检测是否是新的红外宝 /// </summary> /// <param name="pushEnum">推送枚举</param> /// <param name="i_data">推送的数据</param> /// <returns></returns> private bool CheckIsNewMiniRemoteControl(CloudPushEnum pushEnum, string i_data) { if (pushEnum != CloudPushEnum.A新设备上报) { return false; } try { var strSpk = string.Empty; //转为json var json = Newtonsoft.Json.Linq.JObject.Parse(i_data); var linqArry = json["objects"] as Newtonsoft.Json.Linq.JArray; if (linqArry != null) { //数组类型 if (linqArry.Count == 0) { return false; } strSpk = linqArry[0]["spk"].ToString(); } else { //非数组类型 strSpk = json["objects"]["spk"].ToString(); } if (strSpk != Entity.SPK.IrModule) { //如果不是红外宝的话 return false; } return true; } catch { return false; } } /// <summary> /// 刷新红外宝信息 /// </summary> private void RefreshMiniRemoteControlInfo() { var pra = new Dictionary<string, object>(); pra.Add("homeId", Entity.DB_ResidenceData.Instance.CurrentRegion.RegionID); var requestJson = DAL.Server.HttpUtil.GetSignRequestJson(pra); DAL.Server.HttpUtil.RequestHttpsPostFroHome(DAL.Server.NewAPI.Api_Post_GetDevcieList, requestJson); } #endregion #region ■ 云端反馈___________________________ /// <summary> @@ -282,7 +337,13 @@ /// <param name="i_data">推送的内容</param> private void CloudReceiveEvent(CloudPushEnum pushEnum, string i_data) { if (pushEnum != CloudPushEnum.A新设备上报) { return; } //检测是否是新的红外宝 if (this.CheckIsNewMiniRemoteControl(pushEnum, i_data) == false) { return; } //刷新红外宝信息 this.RefreshMiniRemoteControlInfo(); //接收到就移除这个事件 HdlCloudReceiveLogic.Current.RemoveCloudReceiveEvent("AddMiniRemoteControlDirection4Page"); @@ -360,8 +421,8 @@ { HdlThreadLogic.Current.RunThread(() => { //300秒超时 int timeout = 300; //360秒超时 int timeout = 360; while (this.timeoutThreadActivity == false && this.Parent != null) { System.Threading.Thread.Sleep(1000);