From 9c8a5408b707322bc195b5dbce07aa30bd539cc7 Mon Sep 17 00:00:00 2001
From: JLChen <551775569@qq.com>
Date: 星期五, 12 三月 2021 17:13:01 +0800
Subject: [PATCH] ios蓝牙
---
HDL_ON/UI/UI2/4-PersonalCenter/AddDevice/AddMiniRemoteControlDirection2Page.cs | 38 ++-
HDL_ON/UI/UI0-Stan/Logic/HdlBluetoothAndroidLogic.cs | 0
HDL_ON/UI/UI0-Stan/Logic/HdlBluetoothIOSLogic.cs | 493 +++++++++++++++++++++++++++++++++++++++++++++++++
HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPage.cs | 7
HDL_ON/UI/UI2/4-PersonalCenter/AddDevice/AddMiniRemoteControlDirection1Page.cs | 9
HDL_ON/HDL_ON.projitems | 3
HDL_ON/UI/UI2/4-PersonalCenter/AddDevice/AddMiniRemoteControlDirection4Page.cs | 19 -
7 files changed, 529 insertions(+), 40 deletions(-)
diff --git a/HDL_ON/HDL_ON.projitems b/HDL_ON/HDL_ON.projitems
index d1e8fbe..6947b7a 100644
--- a/HDL_ON/HDL_ON.projitems
+++ b/HDL_ON/HDL_ON.projitems
@@ -358,7 +358,7 @@
<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\HdlAndroidBluetoothLogic.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,6 +367,7 @@
<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\" />
diff --git a/HDL_ON/UI/UI0-Stan/Logic/HdlAndroidBluetoothLogic.cs b/HDL_ON/UI/UI0-Stan/Logic/HdlBluetoothAndroidLogic.cs
similarity index 100%
rename from HDL_ON/UI/UI0-Stan/Logic/HdlAndroidBluetoothLogic.cs
rename to HDL_ON/UI/UI0-Stan/Logic/HdlBluetoothAndroidLogic.cs
diff --git a/HDL_ON/UI/UI0-Stan/Logic/HdlBluetoothIOSLogic.cs b/HDL_ON/UI/UI0-Stan/Logic/HdlBluetoothIOSLogic.cs
new file mode 100644
index 0000000..9ecd110
--- /dev/null
+++ b/HDL_ON/UI/UI0-Stan/Logic/HdlBluetoothIOSLogic.cs
@@ -0,0 +1,493 @@
+锘縰sing System;
+using System.Collections.Generic;
+
+namespace HDL_ON.Stan
+{
+#if __IOS__
+ /// <summary>
+ /// IOS钃濈墮鐨勯�昏緫
+ /// </summary>
+ public class HdlBluetoothLogic
+ {
+ #region 鈻� 鍙橀噺澹版槑___________________________
+
+ /// <summary>
+ /// 瀹夊崜钃濈墮鐨勯�昏緫
+ /// </summary>
+ private static HdlBluetoothLogic m_Current = null;
+ /// <summary>
+ /// 瀹夊崜钃濈墮鐨勯�昏緫
+ /// </summary>
+ public static HdlBluetoothLogic Current
+ {
+ get
+ {
+ if (m_Current == null)
+ {
+ m_Current = new HdlBluetoothLogic();
+ }
+ return m_Current;
+ }
+ }
+ /// <summary>
+ /// 鎴戜篃涓嶇煡閬撹繖鏄粈涔堜笢瑗�
+ /// </summary>
+ private HdlBlufi.HdlBluWi hdlBluWiShare;
+ /// <summary>
+ /// 鎴戜篃涓嶇煡閬撹繖鏄粈涔堜笢瑗�
+ /// </summary>
+ private HdlBlufi.BlufiClient blufiClient;
+ /// <summary>
+ /// 鎺ユ敹浜嬩欢
+ /// </summary>
+ private Action<string> ReceiveEvent = null;
+ /// <summary>
+ /// 鍙戦�佺姸鎬�(0:鍙戦�佸け璐� 1:鍙戦�佹垚鍔�)
+ /// </summary>
+ private int sendStatuValue = -1;
+ /// <summary>
+ /// 钃濈墮鏄惁鎵撳紑
+ /// </summary>
+ private bool IsBlufiOpen = false;
+
+ #endregion
+
+ #region 鈻� 鍒濆鍖朹__________________________
+
+ /// <summary>
+ /// 鍒濆鍖�
+ /// </summary>
+ private bool InitHdlBlufi()
+ {
+ if (hdlBluWiShare != null) { return true; }
+
+ try
+ {
+ this.hdlBluWiShare = HdlBlufi.HdlBluWi.Share();
+ this.blufiClient = new HdlBlufi.BlufiClient();
+
+ blufiClient.CentralManagerDelete = new BlueCBCentralManagerDelegate();
+ //娣诲姞鍥炶皟浜嬩欢
+ ((BlueCBCentralManagerDelegate)blufiClient.CentralManagerDelete).StateEvent += (div, data) =>
+ {
+ //-1:寮傚父 1:姝e父
+ if (div == StatuEnum.A寮傚父)
+ {
+ //钃濈墮娌℃湁鎵撳紑
+ this.IsBlufiOpen = false;
+ }
+ else if (div == StatuEnum.A姝e父)
+ {
+ //钃濈墮鎵撳紑鐫�
+ this.IsBlufiOpen = true;
+ }
+ };
+
+ blufiClient.BlufiDelegate = new BlueWifiDelegate();
+ return true;
+ }
+ catch { return false; }
+ }
+
+ #endregion
+
+ #region 鈻� 钃濈墮鎵�闇�鍔熻兘妫�娴媉__________________
+
+ /// <summary>
+ /// 妫�娴嬫槸鍚﹁兘澶熸悳绱㈣摑鐗�(鍐呴儴浼氬脊鍑篗sg妗�,鍥犱负鍐呴儴闇�瑕佹娴嬬郴缁熸潈闄�,鎵�浠ュ弬鏁伴噰鐢ㄥ洖璋冪殑鏂瑰紡)
+ /// </summary>
+ /// <param name="resultEvent">妫�娴嬬粨鏋滀簨浠�</param>
+ public void CheckCanScanBluetooth(Action<bool> resultEvent)
+ {
+ try聽
+ {
+ //鍏堝垵濮嬪寲
+ if (this.InitHdlBlufi() == false)
+ {
+ resultEvent?.Invoke(false);
+ //璇锋墦寮�钃濈墮
+ HdlMessageLogic.Current.ShowMassage(ShowMsgType.Tip, Shared.Language.StringByID(StringId.PleaseTurnOnBluetooth));
+ return;
+ }
+
+ if (this.IsBlufiOpen == true)
+ {
+ //鍥犱负鏄竴鐩寸洃鍚潃锛屾墍浠ュ鏋滄槸true锛岀洿鎺ヨ繑鍥�
+ resultEvent?.Invoke(this.IsBlufiOpen);
+ return;
+ }
+
+ HdlThreadLogic.Current.RunThread(() =>
+ {
+ //ios闇�瑕佺洃鍚墠鑳藉鑾峰緱钃濈墮鐨勭姸鎬�
+ System.Threading.Thread.Sleep(500);
+ if (this.IsBlufiOpen == false)
+ {
+ //璇锋墦寮�钃濈墮
+ HdlMessageLogic.Current.ShowMassage(ShowMsgType.Tip, Shared.Language.StringByID(StringId.PleaseTurnOnBluetooth));
+ }
+ HdlThreadLogic.Current.RunMain(() =>
+ {
+ resultEvent?.Invoke(this.IsBlufiOpen);
+ });
+ }, ShowErrorMode.NO);
+ }
+ catch
+ {
+ resultEvent?.Invoke(false);
+ //璇锋墦寮�钃濈墮
+ HdlMessageLogic.Current.ShowMassage(ShowMsgType.Tip, Shared.Language.StringByID(StringId.PleaseTurnOnBluetooth));
+ }
+ }
+
+ #endregion
+
+ #region 鈻� 钃濈墮鎵弿___________________________
+
+ /// <summary>
+ /// 鎼滅储钃濈墮
+ /// </summary>
+ /// <param name="waitTime">鎼滅储鏃堕棿(绉�)</param>
+ /// <param name="FinishEvent">鎼滅储缁撴潫鐨勪簨浠�</param>
+ public void ScanBluetooth(int waitTime, Action<List<BluetoothInfo>> FinishEvent)
+ {
+ //鍐嶆妫�娴嬫槸鍚﹁兘澶熸悳绱㈣摑鐗�
+ this.CheckCanScanBluetooth((result) =>
+ {
+ if (result == true)
+ {
+ HdlThreadLogic.Current.RunThread(() =>
+ {
+ //寮�濮嬫悳绱㈣摑鐗�
+ this.DoScanBluetooth(waitTime, FinishEvent);
+ });
+ }
+ });
+ }
+
+ /// <summary>
+ /// 寮�濮嬫悳绱㈣摑鐗�
+ /// </summary>
+ /// <param name="waitTime">鎼滅储鏃堕棿(绉�)</param>
+ /// <param name="FinishEvent">鎼滅储缁撴潫鐨勪簨浠�</param>
+ private void DoScanBluetooth(int waitTime, Action<List<BluetoothInfo>> FinishEvent)
+ {
+ //钃濈墮鍒楄〃
+ var listData = new List<BluetoothInfo>();
+ //閲嶅妫�娴�
+ var listCheck = new List<string>();
+ //瀹炵幇钃濈墮鎺ユ敹浜嬩欢
+ var ReceiveBlufiDeviceEvent = new HdlBlufi.FBYBleDeviceBackBlock((arg0) =>
+ {
+ var address = arg0.Uuid.ToString();
+ if (listCheck.Contains(address) == false)
+ {
+ listCheck.Add(address);
+ var data = new BluetoothInfo();
+ data.Address = address;
+ data.Name = arg0.Name == null ? string.Empty : arg0.Name;
+ listData.Add(data);
+ }
+ });
+ HdlThreadLogic.Current.RunMain(() =>
+ {
+ //寮�鍚摑鐗欐悳绱�
+ this.hdlBluWiShare.StartScan(ReceiveBlufiDeviceEvent);
+ }, ShowErrorMode.NO);
+ System.Threading.Thread.Sleep(waitTime * 1000);
+
+ HdlThreadLogic.Current.RunMain(() =>
+ {
+ //鍏抽棴钃濈墮鎼滅储
+ this.hdlBluWiShare.StopScan();
+ ReceiveBlufiDeviceEvent = null;
+
+ }, ShowErrorMode.NO);
+ //鍥炶皟浜嬩欢
+ FinishEvent?.Invoke(listData);
+ }
+
+ #endregion
+
+ #region 鈻� 钃濈墮閾炬帴___________________________
+
+ /// <summary>
+ /// 钃濈墮閾炬帴(false:杩炴帴澶辫触 true:杩炴帴鎴愬姛)
+ /// </summary>
+ /// <param name="bluetooth">闇�瑕侀摼鎺ョ殑钃濈墮瀵硅薄</param>
+ /// <param name="connectEvent">鍥犱负闇�瑕佸鏂瑰弽棣�,鎵�浠ヤ娇鐢ㄥ洖璋�(閾炬帴缁撴灉 false:杩炴帴澶辫触 true:杩炴帴鎴愬姛)</param>
+ public void ContectBluetooth(BluetoothInfo bluetooth, Action<bool> connectEvent)
+ {
+ try
+ {
+ //娣诲姞浜嬩欢
+ ((BlueWifiDelegate)blufiClient.BlufiDelegate).StateEvent += (div, data) =>
+ {
+ //-1:寮傚父 1:姝e父 2:鍙戦�佹暟鎹垚鍔� 3:鍙戦�佹暟鎹け璐�
+ if (div == StatuEnum.A寮傚父)
+ {
+ //鍏抽棴閾炬帴
+ this.DisContectBluetooth();
+ connectEvent?.Invoke(false);
+ //鍙�氱煡涓�娆�
+ connectEvent = null;
+ }
+ else if (div == StatuEnum.A姝e父)
+ {
+ //閾炬帴寤虹珛鎴愬姛
+ connectEvent?.Invoke(true);
+ //鍙�氱煡涓�娆�
+ connectEvent = null;
+ }
+ else if (div == StatuEnum.A鍙戦�佹垚鍔� || div == StatuEnum.A鍙戦�佸け璐�)
+ {
+ sendStatuValue = div == StatuEnum.A鍙戦�佹垚鍔� ? 1 : 0;
+ }
+ else if (div == StatuEnum.A钃濈墮鍙嶉)
+ {
+ //钃濈墮杩斿洖鐨勭粨鏋�
+ this.ReceiveEvent?.Invoke(data);
+ }
+ };
+ //鎵ц閾炬帴
+ this.blufiClient.Connect(bluetooth.Address);
+ }
+ catch
+ {
+ connectEvent?.Invoke(false);
+ connectEvent = null;
+ }
+ }
+
+ #endregion
+
+ #region 鈻� 钃濈墮鍏抽棴___________________________
+
+ /// <summary>
+ /// 鍏抽棴钃濈墮閾炬帴
+ /// </summary>
+ public void DisContectBluetooth()
+ {
+ HdlThreadLogic.Current.RunMain(() =>
+ {
+ this.blufiClient?.Close();
+ this.blufiClient = null;
+ this.hdlBluWiShare = null;
+
+ }, ShowErrorMode.NO);
+ }
+
+ /// <summary>
+ /// 鎽ф瘉
+ /// </summary>
+ public void Dispone()
+ {
+ //鍏抽棴钃濈墮閾炬帴
+ this.DisContectBluetooth();
+ this.ReceiveEvent = null;
+ m_Current = null;
+ }
+
+ #endregion
+
+ #region 鈻� 鍙戦�佹暟鎹甠__________________________
+
+ /// <summary>
+ /// 鍙戦�佹暟鎹粰钃濈墮
+ /// </summary>
+ /// <param name="i_data">鍙戦�佺殑鏁版嵁</param>
+ /// <param name="waiTime">绛夊緟鏃堕棿(绉�),濡傛灉璁剧疆涓�0,鍒欏彧瑕佸彂閫佷笉鍑虹幇寮傚父,鐩存帴鍒ゅ畾涓烘垚鍔�</param>
+ public bool SendData(string i_data, int waiTime = 0)
+ {
+ if (this.blufiClient == null)
+ {
+ return false;
+ }
+
+ try
+ {
+ this.sendStatuValue = -1;
+ if (waiTime == 0)
+ {
+ //鍙戦�佹暟鎹�
+ var data = new Foundation.NSData();
+ data = i_data;
+ blufiClient.PostCustomData(data);
+ //鐩存帴杩斿洖鎴愬姛
+ return true;
+ }
+ else
+ {
+ //鎴栬浠栫敤鐨勬槸绾跨▼鏉ヨ皟鐢�
+ HdlThreadLogic.Current.RunMain(() =>
+ {
+ //鍙戦�佹暟鎹�
+ var data = new Foundation.NSData();
+ data = i_data;
+ blufiClient.PostCustomData(data);
+
+ }, ShowErrorMode.NO);
+ }
+ waiTime *= 5;
+ while (this.sendStatuValue == -1 && waiTime > 0)
+ {
+ System.Threading.Thread.Sleep(200);
+ waiTime--;
+ }
+ return this.sendStatuValue == 1;
+ }
+ catch { return false; }
+ }
+
+ #endregion
+
+ #region 鈻� 涓�鑸柟娉昣__________________________
+
+ /// <summary>
+ /// 娣诲姞钃濈墮鐨勬帴鏀朵簨浠�
+ /// </summary>
+ /// <param name="i_ReceiveEvent">钃濈墮鎺ユ敹浜嬩欢</param>
+ public void AddReceiveEvent(Action<string> i_ReceiveEvent)
+ {
+ this.ReceiveEvent = i_ReceiveEvent;
+ }
+
+ /// <summary>
+ /// 绉婚櫎钃濈墮鐨勬帴鏀朵簨浠�
+ /// </summary>
+ public void RemoveReceiveEvent()
+ {
+ this.ReceiveEvent = null;
+ }
+
+ #endregion
+
+ #region 鈻� 绯荤粺钃濈墮鍥炶皟_______________________
+
+ private class BlueWifiDelegate : HdlBlufi.BlufiDelegate
+ {
+ /// <summary>
+ /// 鐘舵�佷簨浠跺洖璋� 褰撶涓�涓弬鏁颁负"A钃濈墮鍙嶉"鏃�,绗簩涓弬鏁颁负钃濈墮杩斿洖鐨勪俊鎭�
+ /// </summary>
+ public Action<StatuEnum, string> StateEvent = null;
+
+ public override void Blufi_didNegotiateSecurity(HdlBlufi.BlufiClient client, HdlBlufi.BlufiStatusCode status)
+ {
+ //Console.WriteLine("Blufi_didNegotiateSecurity");
+ }
+
+ public override void Blufi_didPostCustomData(HdlBlufi.BlufiClient client, Foundation.NSData data, HdlBlufi.BlufiStatusCode status)
+ {
+ if (status == HdlBlufi.BlufiStatusCode.Success)
+ {
+ //鍙戦�佽摑鐗欐暟鎹垚鍔�
+ StateEvent?.Invoke(StatuEnum.A鍙戦�佹垚鍔�, null);
+ }
+ else
+ {
+ //鍙戦�佽摑鐗欐暟鎹け璐�
+ StateEvent?.Invoke(StatuEnum.A鍙戦�佸け璐�, null);
+ }
+ }
+
+ public override void Blufi_didReceiveDeviceScanResponse(HdlBlufi.BlufiClient client, HdlBlufi.BlufiScanResponse[] scanResults, HdlBlufi.BlufiStatusCode status)
+ {
+ //Console.WriteLine("Blufi_didReceiveDeviceScanResponse");
+ }
+
+ public override void Blufi_didReceiveDeviceVersionResponse(HdlBlufi.BlufiClient client, HdlBlufi.BlufiVersionResponse response, HdlBlufi.BlufiStatusCode status)
+ {
+ //Console.WriteLine("Blufi_didReceiveDeviceVersionResponse");
+ }
+
+ public override void Blufi_didPostConfigureParams(HdlBlufi.BlufiClient client, HdlBlufi.BlufiStatusCode status)
+ {
+ //Console.WriteLine("Blufi_didPostConfigureParams");
+ }
+
+ public override void Blufi_didReceiveCustomData(HdlBlufi.BlufiClient client, Foundation.NSData data, HdlBlufi.BlufiStatusCode status)
+ {
+ //鎺ユ敹钃濈墮鍙戦�佽繃鏉ョ殑鏁版嵁
+ StateEvent?.Invoke(StatuEnum.A钃濈墮鍙嶉, data.ToString());
+ }
+
+ public override void Blufi_didReceiveDeviceStatusResponse(HdlBlufi.BlufiClient client, HdlBlufi.BlufiStatusResponse response, HdlBlufi.BlufiStatusCode status)
+ {
+ //Console.WriteLine("Blufi_didReceiveDeviceStatusResponse");
+ }
+
+ public override void Blufi_didReceiveError(HdlBlufi.BlufiClient client, nint errCode)
+ {
+ //Console.WriteLine("Blufi_didReceiveError");
+ }
+
+ public override void Blufi_gattPrepared(HdlBlufi.BlufiClient client, HdlBlufi.BlufiStatusCode status, CoreBluetooth.CBService service, CoreBluetooth.CBCharacteristic writeChar, CoreBluetooth.CBCharacteristic notifyChar)
+ {
+ if (status == HdlBlufi.BlufiStatusCode.Success)
+ {
+ //钃濈墮杩炴帴鎴愬姛
+ StateEvent?.Invoke(StatuEnum.A姝e父, null);
+ }
+ else
+ {
+ //钃濈墮杩炴帴澶辫触
+ StateEvent?.Invoke(StatuEnum.A寮傚父, null);
+ }
+ }
+ }
+
+ private class BlueCBCentralManagerDelegate : CoreBluetooth.CBCentralManagerDelegate
+ {
+ /// <summary>
+ /// 鐘舵�佷簨浠跺洖璋�
+ /// </summary>
+ public Action<StatuEnum, string> StateEvent = null;
+
+ public override void UpdatedState(CoreBluetooth.CBCentralManager central)
+ {
+ //鍙娌℃湁鎵撳紑钃濈墮锛岄兘绠楀紓甯稿鐞�
+ if (central.State == CoreBluetooth.CBCentralManagerState.PoweredOn)
+ {
+ StateEvent?.Invoke(StatuEnum.A姝e父, null);
+ }
+ else
+ {
+ StateEvent?.Invoke(StatuEnum.A寮傚父, null);
+ }
+ }
+ }
+ #endregion
+
+ #region 鈻� 缁撴瀯浣揰____________________________
+
+ /// <summary>
+ /// 钃濈墮杩斿洖鐨勪俊鎭�
+ /// </summary>
+ public class BluetoothInfo
+ {
+ /// <summary>
+ /// 鍚嶅瓧(姝ゅ悕瀛椾笉浼歯ull,濡傛灉瀹冩湰韬槸null,鍙細鏄痵tring.empty)
+ /// </summary>
+ public string Name = string.Empty;
+ /// <summary>
+ /// 鍦板潃
+ /// </summary>
+ public string Address = string.Empty;
+ }
+
+ /// <summary>
+ /// 鐘舵�佹灇涓�
+ /// </summary>
+ private enum StatuEnum
+ {
+ A寮傚父 = -1,
+ A姝e父 = 1,
+ A鍙戦�佹垚鍔� = 2,
+ A鍙戦�佸け璐� = 3,
+ A钃濈墮鍙嶉 = 4
+ }
+
+ #endregion
+ }
+#endif
+}
diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/AddDevice/AddMiniRemoteControlDirection1Page.cs b/HDL_ON/UI/UI2/4-PersonalCenter/AddDevice/AddMiniRemoteControlDirection1Page.cs
index 3f32913..1120bdd 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/AddDevice/AddMiniRemoteControlDirection1Page.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/AddDevice/AddMiniRemoteControlDirection1Page.cs
@@ -57,21 +57,18 @@
var btnNext = this.AddBottomClickButton(Language.StringByID(StringId.Next));
btnNext.ButtonClickEvent += (sender, e) =>
{
-#if __IOS__
-#endif
-#if __Android__
//妫�娴嬭摑鐗欓渶瑕佺殑涓滆タ
- HdlAndroidBluetoothLogic.Current.CheckCanScanBluetooth((result) =>
+ btnNext.CanClick = false;
+ HdlBluetoothLogic.Current.CheckCanScanBluetooth((result) =>
{
+ btnNext.CanClick = true;
if (result == true)
{
this.CloseForm();
var form = new AddMiniRemoteControlDirection2Page();
- //wifi鍜屽瘑鐮侀兘涓虹┖
form.AddForm();
}
});
-#endif
};
}
diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/AddDevice/AddMiniRemoteControlDirection2Page.cs b/HDL_ON/UI/UI2/4-PersonalCenter/AddDevice/AddMiniRemoteControlDirection2Page.cs
index 68bb03f..93c6491 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/AddDevice/AddMiniRemoteControlDirection2Page.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/AddDevice/AddMiniRemoteControlDirection2Page.cs
@@ -62,12 +62,9 @@
//鎼滅储鏃堕棿(绉�)
int searchTime = 5;
-#if __IOS__
-#endif
-#if __Android__
- //瀹夊崜鎼滅储钃濈墮(鐗规晥闂,鍔�1绉�)
- this.StartSearchBluetoothOnAndriod(searchTime + 1);
-#endif
+ //鎼滅储钃濈墮(鐗规晥闂,鍔�1绉�)
+ this.StartSearchBluetooth(searchTime + 1);
+
HdlThreadLogic.Current.RunThread(() =>
{
//杩涘害鏉$壒鏁�
@@ -84,19 +81,18 @@
#endregion
- #region 鈻� 瀹夊崜鎼滅储钃濈墮_______________________
+ #region 鈻� 鎼滅储钃濈墮___________________________
-#if __Android__
/// <summary>
/// 瀹夊崜鎼滅储钃濈墮
/// </summary>
/// <param name="i_searchTime">鎼滅储鏃堕棿(绉�)</param>
- private void StartSearchBluetoothOnAndriod(int i_searchTime)
+ private void StartSearchBluetooth(int i_searchTime)
{
//寮�濮嬫悳绱㈣摑鐗�
- HdlAndroidBluetoothLogic.Current.ScanBluetooth(i_searchTime, (listBluetooth) =>
+ HdlBluetoothLogic.Current.ScanBluetooth(i_searchTime, (listBluetooth) =>
{
- var listDevice = new List<HdlAndroidBluetoothLogic.BluetoothInfo>();
+ var listDevice = new List<HdlBluetoothLogic.BluetoothInfo>();
foreach (var device in listBluetooth)
{
//鍙湁杩欎釜鏍囪瘑,鎵嶆槸绾㈠瀹�
@@ -109,7 +105,7 @@
if (listDevice.Count == 0)
{
//鎽ф瘉钃濈墮缂撳瓨
- HdlAndroidBluetoothLogic.Current.Dispone();
+ HdlBluetoothLogic.Current.Dispone();
//鏄剧ず澶辫触鐣岄潰
HdlThreadLogic.Current.RunMain(() =>
{
@@ -119,7 +115,7 @@
else if (listDevice.Count == 1)
{
//濡傛灉鍙娴嬪埌涓�涓�,鍒欑洿鎺ヨ繛鎺�
- HdlAndroidBluetoothLogic.Current.ContectBluetooth(listDevice[0], (result) =>
+ HdlBluetoothLogic.Current.ContectBluetooth(listDevice[0], (result) =>
{
if (result == true)
{
@@ -144,7 +140,7 @@
this.ShowBluetoothListView(listName, (index) =>
{
//濡傛灉鍙娴嬪埌涓�涓�,鍒欑洿鎺ヨ繛鎺�
- HdlAndroidBluetoothLogic.Current.ContectBluetooth(listDevice[index], (result) =>
+ HdlBluetoothLogic.Current.ContectBluetooth(listDevice[index], (result) =>
{
if (result == true)
{
@@ -161,7 +157,6 @@
}
});
}
-#endif
#endregion
@@ -232,8 +227,17 @@
var btnReSearch = this.AddBottomClickButton(Language.StringByID(StringId.ReSearch));
btnReSearch.ButtonClickEvent += (sender, e) =>
{
- //鍒濆鍖栦腑閮ㄤ俊鎭�
- this.InitMiddleFrame();
+ //妫�娴嬭摑鐗欓渶瑕佺殑涓滆タ
+ btnReSearch.CanClick = false;
+ HdlBluetoothLogic.Current.CheckCanScanBluetooth((result) =>
+ {
+ btnReSearch.CanClick = true;
+ if (result == true)
+ {
+ //鍒濆鍖栦腑閮ㄤ俊鎭�
+ this.InitMiddleFrame();
+ }
+ });
};
}
diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/AddDevice/AddMiniRemoteControlDirection4Page.cs b/HDL_ON/UI/UI2/4-PersonalCenter/AddDevice/AddMiniRemoteControlDirection4Page.cs
index 490f4a8..daa79cc 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/AddDevice/AddMiniRemoteControlDirection4Page.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/AddDevice/AddMiniRemoteControlDirection4Page.cs
@@ -61,12 +61,9 @@
//杩欎釜鐣岄潰鐨勮儗鏅渶瑕佺櫧鑹�
bodyFrameLayout.BackgroundColor = UI.CSS.CSS_Color.MainBackgroundColor;
-#if __IOS__
-#endif
-#if __Android__
//娣诲姞鎺ユ敹钃濈墮鍙嶉鐨勪簨浠�
- HdlAndroidBluetoothLogic.Current.AddReceiveEvent(this.BluetoothReceiveEvent);
-#endif
+ HdlBluetoothLogic.Current.AddReceiveEvent(this.BluetoothReceiveEvent);
+
//娣诲姞浜戠鍙嶉浜嬩欢
HdlCloudReceiveLogic.Current.AddCloudReceiveEvent("AddMiniRemoteControlDirection4Page", this.CloudReceiveEvent);
@@ -268,14 +265,10 @@
/// </summary>
private void SendAccountAndPswToBluetooth()
{
-#if __IOS__
-#endif
-#if __Android__
//鑾峰彇鍙戦�佸埌钃濈墮鐨勬暟鎹�
var sendData = this.GetSendToBluetoothData();
//涓嶇瓑寰�
- HdlAndroidBluetoothLogic.Current.SendData(sendData);
-#endif
+ HdlBluetoothLogic.Current.SendData(sendData);
}
#endregion
@@ -399,11 +392,7 @@
public override void CloseFormBefore()
{
//鎽ф瘉钃濈墮
-#if __IOS__
-#endif
-#if __Android__
- HdlAndroidBluetoothLogic.Current.Dispone();
-#endif
+ HdlBluetoothLogic.Current.Dispone();
HdlCloudReceiveLogic.Current.RemoveCloudReceiveEvent("AddMiniRemoteControlDirection4Page");
base.CloseFormBefore();
diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPage.cs
index 05a6cf6..7305feb 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPage.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPage.cs
@@ -337,9 +337,14 @@
== false ? StringId.Administrators : StringId.Member
};
userTypeView.AddChidren(btnUserTypeName);
+ btnUserTypeIcon.MouseUpEventHandler += (sender, e) =>
+ {
+ var form = new AddThirdPartyDeviceMenuListPage();
+ form.AddForm("Evoyo");
+ };
#endregion
#region 浣忓畢绠$悊
-
+
if (!DB_ResidenceData.Instance.CurrentRegion.IsOthreShare)
{
#region ---浣忓畢绠$悊鍖哄煙
--
Gitblit v1.8.0