From 2774f5981a93cc6cc6aec22a6409f26889e925b4 Mon Sep 17 00:00:00 2001
From: JLChen <551775569@qq.com>
Date: 星期五, 03 七月 2020 16:36:56 +0800
Subject: [PATCH] 2020-07-03 1.修复修改红外TV模块修改备注出错问题。 2.如果搜索红外模块备注为空默认显示TV+回路号备注。 3.上传红外码指令,直接回路备注数据。4.网关配频模式时,开启自动搜索设备线程,定时3秒发送一次E548命令。
---
Crabtree/SmartHome/UI/SimpleControl/Phone/Guide/GuideSettingGateway.cs | 90 +++++++++++++++++++++++++++++
/dev/null | 0
Crabtree/SmartHome/UI/SimpleControl/CommonPage.cs | 5 +
Crabtree/SmartHome/UI/SimpleControl/Phone/TV/ConfigIRCode.cs | 6 ++
Crabtree/ON/Properties/AndroidManifest.xml | 2
Crabtree/.vs/SmartHome/xs/UserPrefs.xml | 31 ++--------
Crabtree/.vs/SmartHome/xs/sqlite3/storage.ide | 0
Crabtree/SmartHome/UI/SimpleControl/Phone/Room/UserDeviceListPage.cs | 18 +++++
Crabtree/SmartHome/UI/SimpleControl/Phone/TV/UserTVAddCustomChannel.cs | 17 +++--
Crabtree/SmartHome/UI/SimpleControl/MainPage.cs | 2
10 files changed, 134 insertions(+), 37 deletions(-)
diff --git a/Crabtree/.vs/SmartHome/xs/UserPrefs.xml b/Crabtree/.vs/SmartHome/xs/UserPrefs.xml
index 761f0f2..d72c26b 100644
--- a/Crabtree/.vs/SmartHome/xs/UserPrefs.xml
+++ b/Crabtree/.vs/SmartHome/xs/UserPrefs.xml
@@ -1,42 +1,23 @@
锘�<Properties StartupConfiguration="{9D9EF20B-6E65-4A65-92BF-567EBF1E1443}|Default">
- <MonoDevelop.Ide.ItemProperties.ON.Droid PreferredExecutionTarget="Android.Android_Accelerated_Oreo" />
- <MonoDevelop.Ide.Workbench ActiveDocument="SmartHome/UI/SimpleControl/Phone/Alexa/AlexaDeviceListPage.cs">
+ <MonoDevelop.Ide.ItemProperties.ON.Droid PreferredExecutionTarget="Android.4b65c46595" />
+ <MonoDevelop.Ide.Workbench>
<Files>
- <File FileName="SmartHome/UI/SimpleControl/Phone/Alexa/AlexaDeviceListPage.cs" Line="478" Column="23" />
- <File FileName="SmartHome/HDL/Operation/ResponseEntity/ErrorCode.cs" />
- <File FileName="SmartHome/UI/SimpleControl/Phone/Light/UserDeviceToSocket.cs" />
- <File FileName="SmartHome/UI/SimpleControl/Phone/Register/Databackup.cs" />
- <File FileName="SmartHome/UI/SimpleControl/Phone/Register/SubaccountListView.cs" />
- <File FileName="ON/Application.cs" />
- <File FileName="SmartHome/UI/SimpleControl/Phone/User/UserMiddle.cs" />
- <File FileName="SmartHome/UI/SimpleControl/MainPage.cs" />
- <File FileName="ON/Properties/AndroidManifest.xml" />
+ <File FileName="SmartHome/UI/SimpleControl/MainPage.cs" Line="41" Column="55" />
</Files>
<Pads>
<Pad Id="ProjectPad">
<State name="__root__">
<Node name="SmartHome" expanded="True">
- <Node name="ON.Droid" expanded="True" selected="True">
- <Node name="Properties" expanded="True" />
- </Node>
- <Node name="ON.Ios" expanded="True" />
+ <Node name="ON.Droid" selected="True" />
<Node name="Shared" expanded="True">
<Node name="HDL" expanded="True">
- <Node name="Operation" expanded="True">
- <Node name="ResponseEntity" expanded="True" />
- </Node>
+ <Node name="Operation" expanded="True" />
</Node>
<Node name="UI" expanded="True">
<Node name="SimpleControl" expanded="True">
<Node name="Phone" expanded="True">
- <Node name="AC" expanded="True" />
- <Node name="Alexa" expanded="True" />
- <Node name="Fan" expanded="True" />
- <Node name="FoolHeat" expanded="True" />
- <Node name="Light" expanded="True" />
- <Node name="Register" expanded="True" />
<Node name="Room" expanded="True" />
- <Node name="User" expanded="True" />
+ <Node name="TV" expanded="True" />
</Node>
</Node>
</Node>
diff --git a/Crabtree/.vs/SmartHome/xs/sqlite3/storage.ide b/Crabtree/.vs/SmartHome/xs/sqlite3/storage.ide
index e15471a..736a846 100644
--- a/Crabtree/.vs/SmartHome/xs/sqlite3/storage.ide
+++ b/Crabtree/.vs/SmartHome/xs/sqlite3/storage.ide
Binary files differ
diff --git a/Crabtree/.vs/SmartHome/xs/sqlite3/storage.ide-shm b/Crabtree/.vs/SmartHome/xs/sqlite3/storage.ide-shm
deleted file mode 100644
index 8a77de6..0000000
--- a/Crabtree/.vs/SmartHome/xs/sqlite3/storage.ide-shm
+++ /dev/null
Binary files differ
diff --git a/Crabtree/.vs/SmartHome/xs/sqlite3/storage.ide-wal b/Crabtree/.vs/SmartHome/xs/sqlite3/storage.ide-wal
deleted file mode 100644
index 98e5e0e..0000000
--- a/Crabtree/.vs/SmartHome/xs/sqlite3/storage.ide-wal
+++ /dev/null
Binary files differ
diff --git a/Crabtree/ON/Properties/AndroidManifest.xml b/Crabtree/ON/Properties/AndroidManifest.xml
index 69c0d20..bde7947 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.crabtreenew" android:versionName="2.507011" android:versionCode="202007011">
+<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.hdl.crabtreenew" android:versionName="2.507031" android:versionCode="202007031">
<uses-sdk android:minSdkVersion="23" android:targetSdkVersion="28" />
<!-- 鍦ㄥ畨鍗揚鐗堟湰涔嬪悗锛屽繀椤昏鎺堜簣FOREGROUND_SERVICE鏉冮檺锛屾墠鑳藉浣跨敤鍓嶅彴鏈嶅姟 -->
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
diff --git a/Crabtree/SmartHome/UI/SimpleControl/CommonPage.cs b/Crabtree/SmartHome/UI/SimpleControl/CommonPage.cs
index 28fe42e..ac206b1 100644
--- a/Crabtree/SmartHome/UI/SimpleControl/CommonPage.cs
+++ b/Crabtree/SmartHome/UI/SimpleControl/CommonPage.cs
@@ -1276,6 +1276,11 @@
//} else if (deviceType1.ToString ().Contains ("Switch")) {
// devcieLoopName = "Relay SW" + usefullBytes [2].ToString ();
//}
+
+ //2020-07-03 濡傛灉鏄孩澶栨ā鍧楃被鍨嬶紝澶囨敞涓虹┖鐨勮瘽锛岄粯璁や负TV鍚嶅瓧
+ if (deviceType1 == DeviceType.InfraredMode) {
+ devcieLoopName = "TV " + usefullBytes [2].ToString ();
+ }
byte [] ddd = CommonPage.MyEncodingGB2312.GetBytes (devcieLoopName);
byte [] newddd = new byte [20];
Array.Copy (ddd, 0, newddd, 0, 20 < ddd.Length ? 20 : ddd.Length);
diff --git a/Crabtree/SmartHome/UI/SimpleControl/MainPage.cs b/Crabtree/SmartHome/UI/SimpleControl/MainPage.cs
index 4c7c090..4174085 100644
--- a/Crabtree/SmartHome/UI/SimpleControl/MainPage.cs
+++ b/Crabtree/SmartHome/UI/SimpleControl/MainPage.cs
@@ -38,7 +38,7 @@
//public static Button LogoButton = new Button ();
- public static string RequestVersion = "2.507011";
+ public static string RequestVersion = "2.507031";
public static UserInfo LoginUser;
/// <summary>
/// 鏄惁鏄鐞嗗憳鏉冮檺(鍙樻洿浜�,鎴愬憳鐨勬椂鍊�,杩欎釜涔熶负ture銆備负浠�涔堜細澹版槑杩欐牱鍙橀噺,鍥犱负鏈変簺鎺ュ彛蹇呴』浣跨敤鍘熸潵鐨凾oken)
diff --git a/Crabtree/SmartHome/UI/SimpleControl/Phone/Guide/GuideSettingGateway.cs b/Crabtree/SmartHome/UI/SimpleControl/Phone/Guide/GuideSettingGateway.cs
index b95835f..16fba51 100644
--- a/Crabtree/SmartHome/UI/SimpleControl/Phone/Guide/GuideSettingGateway.cs
+++ b/Crabtree/SmartHome/UI/SimpleControl/Phone/Guide/GuideSettingGateway.cs
@@ -36,6 +36,8 @@
myLoading.Hide ();
btnCloseLoading.RemoveFromParent ();
WirelessConfig (new byte [] { 1 });//close
+ //2020-07-02 鍏抽棴鑷姩鎼滅储绾跨▼
+ StopSearchDeviceThead ();
if (needRefresh) {
needRefresh = false;
SearchDeviceList ();
@@ -50,6 +52,7 @@
curView = null;
addedCommon.Clear ();
BackgroundColor = SkinStyle.Current.MainColor;
+ //StopSearchDeviceThead ();
base.RemoveFromParent ();
}
@@ -251,6 +254,9 @@
//myLoading.Start ("Waiting for new device, Please touch the here to exit the waiting mode.");
this.AddChidren (btnCloseLoading);
+
+ //2020-07-02 缃戝叧閰嶉妯″紡鏃讹紝寮�鍚嚜鍔ㄦ悳绱㈢嚎绋�
+ StartSearchDeviceThead ();
}
});
});
@@ -1096,6 +1102,88 @@
}
+ #region 2020-07-02
+ /// <summary>
+ /// 瀹氭椂鎼滅储璁惧绾跨▼
+ /// </summary>
+ Thread searchDeviceThead;
+ bool bStartSearch;
+
+ /// <summary>
+ /// 2020-07-02
+ /// 缃戝叧閰嶉妯″紡鏃讹紝寮�鍚嚜鍔ㄦ悳绱㈢嚎绋�
+ /// </summary>
+ void StartSearchDeviceThead ()
+ {
+ StopSearchDeviceThead ();
+ CommonPage.LocalPhoneFindDevice = true;
+ CommonPage.FindGatewayChilren = true;
+ CommonPage.RandomHigh = (byte)new Random ().Next (255);
+ CommonPage.RandomLow = (byte)new Random ().Next (255);
+
+ bStartSearch = true;
+ searchDeviceThead = new Thread ((obj) => {
+ while (bStartSearch) {
+ try {
+ //瀹氭椂4S
+ Thread.Sleep (4000);
+
+ var ms = new System.IO.MemoryStream ();
+ ms.WriteByte (CommonPage.RandomHigh);
+ ms.WriteByte (CommonPage.RandomLow);
+
+ var list = CommonPage.DeviceList;
+ int tempCount = list.Count;
+ string s = ";";
+ for (int i = 0; i < list.Count; i++) {
+ Common common = list [i];
+ if (common.SubnetID != gatewayDeicve.SubnetID)
+ continue;
+ if (s.Contains (";" + common.SubnetID.ToString () + ":" + common.DeviceID.ToString ()))
+ continue;
+ s += common.SubnetID.ToString () + ":" + common.DeviceID.ToString () + ";";
+ ms.WriteByte (common.SubnetID);
+ ms.WriteByte (common.DeviceID);
+ }
+ Utlis.WriteLine ("SearchDeviceThead鎼滅储闈炵綉鍏宠澶囷紝缃戠粶鍦板潃鏄�:" + CommonPage.EndPoint.ToString ());
+ var control = new Control ();
+ control.Send (new Target () {
+ IPEndPoint = CommonPage.EndPoint,
+ Command = Command.ReadDeviceModul,
+ SubnetID = gatewayDeicve.SubnetID,
+ DeviceID = 0xFF,
+ AddData = ms.ToArray ()
+ }, SendCount.Zero, false);
+
+ ms.Close ();
+
+ } catch {
+
+ }
+ }
+ });
+ searchDeviceThead.Start ();
+
+
+ Utlis.WriteLine ("----StartSearchDeviceThead----");
+ }
+
+ /// <summary>
+ /// 鏆傚仠鎼滅储璁惧绾跨▼
+ /// </summary>
+ void StopSearchDeviceThead ()
+ {
+ CommonPage.LocalPhoneFindDevice = false;
+ CommonPage.FindGatewayChilren = false;
+ bStartSearch = false;
+ if (searchDeviceThead != null)
+ searchDeviceThead.Abort ();
+
+ Utlis.WriteLine ("----StopSearchDeviceThead----");
+
+ }
+ #endregion
+
///// <summary>
///// 鏌ヨ褰撳墠浣忓畢 缃戝叧鍒楄〃
///// </summary>
@@ -1235,7 +1323,7 @@
// //Room.InitAllRoom ();
//}
-
+
///// <summary>
///// 淇敼URL
diff --git a/Crabtree/SmartHome/UI/SimpleControl/Phone/Room/UserDeviceListPage.cs b/Crabtree/SmartHome/UI/SimpleControl/Phone/Room/UserDeviceListPage.cs
index d37d926..f314b61 100644
--- a/Crabtree/SmartHome/UI/SimpleControl/Phone/Room/UserDeviceListPage.cs
+++ b/Crabtree/SmartHome/UI/SimpleControl/Phone/Room/UserDeviceListPage.cs
@@ -530,7 +530,23 @@
if (reBytes != null) {
Application.RunOnMainThread (() => {
btnEquipment.Text = commonDevice.Name = etDeviceName.Text.Trim ();
- IO.FileUtils.SaveEquipmentMessage (commonDevice, commonDevice.LoopID.ToString ());
+ if (commonDevice.Type == DeviceType.InfraredMode) {
+ //2020-07-03 淇绾㈠鐢佃淇敼鍚庡彉绾㈠妯″潡闂
+ InfraredMode mTV = Newtonsoft.Json.JsonConvert.DeserializeObject<InfraredMode> (System.Text.Encoding.UTF8.GetString (commonBytes));
+ if (mTV == null) {
+ IO.FileUtils.SaveEquipmentMessage (commonDevice, commonDevice.LoopID.ToString ());
+ } else {
+ mTV.Name = etDeviceName.Text.Trim ();
+ IO.FileUtils.SaveEquipmentMessage (mTV, mTV.LoopID.ToString ());
+ }
+ } else {
+ IO.FileUtils.SaveEquipmentMessage (commonDevice, commonDevice.LoopID.ToString ());
+ }
+
+
+
+
+ //IO.FileUtils.SaveEquipmentMessage (commonDevice, commonDevice.LoopID.ToString ());
MainPage.Loading.Hide ();
dialog.Close ();
});
diff --git a/Crabtree/SmartHome/UI/SimpleControl/Phone/TV/ConfigIRCode.cs b/Crabtree/SmartHome/UI/SimpleControl/Phone/TV/ConfigIRCode.cs
index fbdcd9c..5719a2f 100644
--- a/Crabtree/SmartHome/UI/SimpleControl/Phone/TV/ConfigIRCode.cs
+++ b/Crabtree/SmartHome/UI/SimpleControl/Phone/TV/ConfigIRCode.cs
@@ -49,6 +49,12 @@
port = common.LoopID.ToString ();
}
}
+
+ #region 2020-07-03 璁板綍鍥炶矾澶囨敞
+ byte [] remakeBytes = CommonPage.MyEncodingGB2312.GetBytes (common.Name);
+ Array.Copy (remakeBytes, 0, updateInfraredBytes, 6, remakeBytes.Length < 20 ? remakeBytes.Length : 20);
+ #endregion
+
bodyView = new FrameLayout () {
BackgroundColor = SkinStyle.Current.ViewColor
};
diff --git a/Crabtree/SmartHome/UI/SimpleControl/Phone/TV/UserTVAddCustomChannel.cs b/Crabtree/SmartHome/UI/SimpleControl/Phone/TV/UserTVAddCustomChannel.cs
index 3837564..ee62327 100644
--- a/Crabtree/SmartHome/UI/SimpleControl/Phone/TV/UserTVAddCustomChannel.cs
+++ b/Crabtree/SmartHome/UI/SimpleControl/Phone/TV/UserTVAddCustomChannel.cs
@@ -148,8 +148,8 @@
Height = Application.GetRealHeight (90),
TextColor = SkinStyle.Current.TextColor1,
TextID = R.MyInternationalizationString.TakePhoto,
- UnSelectedImagePath = "TV/TV3_photo.png",
- SelectedImagePath = "TV/TV3_photo_on.png",
+ //UnSelectedImagePath = "TV/TV3_photo.png",
+ //SelectedImagePath = "TV/TV3_photo_on.png",
X = pictureRightLine.Right,
};
middleView.AddChidren (btnTakePictrue);
@@ -170,14 +170,15 @@
Height = btnTakePictrue.Height,
TextID = R.MyInternationalizationString.SelectPicture,
TextColor = SkinStyle.Current.TextColor1,
- UnSelectedImagePath = "TV/TV3_photo.png",
- SelectedImagePath = "TV/TV3_photo_on.png",
+
+ //UnSelectedImagePath = "TV/TV3_photo.png",
+ //SelectedImagePath = "TV/TV3_photo_on.png",
};
middleView.AddChidren (btnSelectPictrue);
var pid = Guid.NewGuid ();
btnTakePictrue.MouseUpEventHandler += (sender, e) => {
- btnTakePictrue.IsSelected = true;
- btnSelectPictrue.IsSelected = false;
+ //btnTakePictrue.IsSelected = true;
+ //btnSelectPictrue.IsSelected = false;
pid = Guid.NewGuid ();
Camera.TakePicture ((obj) => {
if (obj != null) {
@@ -187,8 +188,8 @@
};
btnSelectPictrue.MouseUpEventHandler += (sender, e) => {
- btnTakePictrue.IsSelected = false ;
- btnSelectPictrue.IsSelected = true;
+ //btnTakePictrue.IsSelected = false ;
+ //btnSelectPictrue.IsSelected = true;
pid = Guid.NewGuid ();
Camera.SelectPicture ((obj) => {
if (obj != null) {
--
Gitblit v1.8.0