ZigbeeApp/GateWay.Droid/Assets/Language.ini
@@ -1845,6 +1845,8 @@ 16129=Mini夜灯 16130=燃气泄露 16131=忽略 16132=蜂鸣器开关 16133=小夜灯开关 ;★★★★下面这些是接口的返回信息翻译,从18000开始★★★★ 18004=指定网关已经被绑定 ZigbeeApp/GateWay.Droid/Assets/Phone/Item/ColorTemperatureBar.png
ZigbeeApp/GateWay.Droid/GateWay.Droid.csproj
@@ -2254,6 +2254,9 @@ <ItemGroup> <AndroidAsset Include="Assets\Phone\SmartSound\Xiaodu.png" /> </ItemGroup> <ItemGroup> <AndroidAsset Include="Assets\Phone\Item\ColorTemperatureBar.png" /> </ItemGroup> <Import Project="..\Shared\Shared.projitems" Label="Shared" Condition="Exists('..\Shared\Shared.projitems')" /> <Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" /> <Import Project="..\packages\Xamarin.Android.Support.Annotations.26.0.2\build\MonoAndroid80\Xamarin.Android.Support.Annotations.targets" Condition="Exists('..\packages\Xamarin.Android.Support.Annotations.26.0.2\build\MonoAndroid80\Xamarin.Android.Support.Annotations.targets')" /> ZigbeeApp/GateWay.Droid/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.home" android:versionCode="0120061001" android:installLocation="auto" android:versionName="1.1.0120061001"> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.hdl.home" android:versionCode="0120061701" android:installLocation="auto" android:versionName="1.1.0120061701"> <uses-sdk android:minSdkVersion="23" android:targetSdkVersion="26" /> <permission android:name="com.hdl.home.permission.JPUSH_MESSAGE" android:protectionLevel="signature" /> <uses-permission android:name="android.permission.WAKE_LOCK" /> ZigbeeApp/GateWay.Droid/Resources/Resource.designer.cs
Diff too large ZigbeeApp/Home.Ios/Home.IOS.csproj
@@ -508,6 +508,7 @@ <BundleResource Include="Resources\Phone\Item\QRCode.png" /> <BundleResource Include="Resources\Phone\Item\ScanQRcodeIcon.png" /> <BundleResource Include="Resources\Phone\Item\LogicMsgIcon.png" /> <BundleResource Include="Resources\Phone\Item\ColorTemperatureBar.png" /> <BundleResource Include="Resources\Phone\Item\InputAccountIcon.png" /> <BundleResource Include="Resources\Phone\Item\NormallyOpen.png" /> <BundleResource Include="Resources\Phone\Item\ItemSelected.png" /> ZigbeeApp/Home.Ios/Resources/Language.ini
@@ -1845,6 +1845,8 @@ 16129=Mini夜灯 16130=燃气泄露 16131=忽略 16132=蜂鸣器开关 16133=小夜灯开关 ;★★★★下面这些是接口的返回信息翻译,从18000开始★★★★ 18004=指定网关已经被绑定 ZigbeeApp/Home.Ios/Resources/Phone/Item/ColorTemperatureBar.png
ZigbeeApp/Shared/Common/CommonPage.cs
@@ -50,7 +50,7 @@ /// <summary> /// 版本号 /// </summary> public static string CodeIDString = "1.1.0120061001"; public static string CodeIDString = "1.1.0120061701"; /// <summary> /// 注册来源(0:HDL On 1:Zigbee) /// </summary> ZigbeeApp/Shared/Common/Device.cs
@@ -2432,7 +2432,7 @@ /// <returns></returns> public bool IsMiniLight(CommonDevice device) { return device.DeviceAddr == "3737363534333231"; return device.DriveCode != 0 && device.Type == DeviceType.ColorTemperatureLight; } /// <summary> @@ -2876,6 +2876,7 @@ else if (deviceType == DeviceType.PMSensor) { device = new PMSensor(); } else if (deviceType == DeviceType.FreshAirHumiditySensor) { device = new HumiditySensor(); } else if (deviceType == DeviceType.ColorTemperatureLight) { device = new ColorTemperatureLight(); } else if (deviceType == DeviceType.Buzzer) { device = new Buzzer(); } else if (deviceType == DeviceType.OtaDevice || deviceType == DeviceType.OtaPanelDevice) { device = new OTADevice(); } else { return null; } ZigbeeApp/Shared/DLL/Android/Shared.Droid.dllBinary files differ
ZigbeeApp/Shared/DLL/IOS/Shared.IOS.dllBinary files differ
ZigbeeApp/Shared/Phone/Category/Controls/DeviceRow/DeviceColorTemperatureRowControl.cs
@@ -69,10 +69,21 @@ //深度卡片信息 this.frameTable.ButtonClickEvent += (sender, e) => { var form = new MainPage.ControlForm.DeviceColorTemperatureLightDetailCardForm(); form.RowOrCardControl = this; form.AddForm(i_device, this.nowSelectRoom, 965, 1466); form.FormCloseEvent += this.CardDetailInfoBackEvent; if (Common.LocalDevice.Current.IsMiniLight(this.device) == false) { var form = new MainPage.ControlForm.DeviceColorTemperatureLightDetailCardForm(); form.RowOrCardControl = this; form.AddForm(i_device, this.nowSelectRoom, 965, 1466); form.FormCloseEvent += this.CardDetailInfoBackEvent; } else { //mini夜灯 var form = new MainPage.ControlForm.DeviceMiniLightDetailCardForm(); form.RowOrCardControl = this; form.AddForm(i_device, this.nowSelectRoom, 965, 1466); form.FormCloseEvent += this.CardDetailInfoBackEvent; } }; } ZigbeeApp/Shared/Phone/MainPage/ControlForm/Base/DeviceDetailCardCommonForm.cs
@@ -44,7 +44,7 @@ /// <summary> /// 是否获取网关反馈的结果 0:没有获取得到 1:已经获取得到 /// </summary> private int ResponeResult = 0; public int ResponeResult = 0; /// <summary> /// 当前端点的功能类型 /// </summary> @@ -232,11 +232,9 @@ this.ResponeResult = 0; //先让指定控件不能点击 var listSelect = new List<bool>(); foreach (var myContr in listControl) { myContr.CanClick = false; listSelect.Add(myContr.IsSelected); } HdlThreadLogic.Current.RunThread(() => @@ -269,14 +267,6 @@ { var msgContr = new ShowMsgControl(ShowMsgType.Tip, Language.StringByID(R.MyInternationalizationString.FAIL)); msgContr.Show(); //变更回原来的状态 for (int i = 0; i < listSelect.Count; i++) { if (listSelect[i] != listControl[i].IsSelected) { listControl[i].IsSelected = listSelect[i]; } } }); } //开关按钮可以再点击 @@ -374,7 +364,6 @@ public override void CloseFormBefore() { string mainKeys = Common.LocalDevice.Current.GetDeviceMainKeys(this.device); HdlGatewayReceiveLogic.Current.RemoveEvent("DeviceDetailCardControl" + mainKeys); HdlGatewayReceiveLogic.Current.RemoveEvent("DeviceDetailCardAttribute" + mainKeys); //回调函数 ZigbeeApp/Shared/Phone/MainPage/ControlForm/DeviceAcDetailCardForm.cs
@@ -520,20 +520,16 @@ //检测是否获取网关反馈的结果,如果网关没有回复,则会弹出消息 this.StartCheckResponeResult(this.listControl, (result) => { //没有接收到网关回复 if (result == false) if (result == true) { //接收到网关的回复 HdlThreadLogic.Current.RunMain(() => { //还原状态 listControl[0].SelectedImagePath = DeviceAcDetailCardMethord.GetFanSwingModeSelectedImagePathByFanSwingMode(oldModel); listControl[0].UnSelectedImagePath = DeviceAcDetailCardMethord.GetFanSwingModeUnSelectedImagePathByFanSwingMode(oldModel); listControl[0].SelectedImagePath = DeviceAcDetailCardMethord.GetFanSwingModeSelectedImagePathByFanSwingMode(fanSwingMode); listControl[0].UnSelectedImagePath = DeviceAcDetailCardMethord.GetFanSwingModeUnSelectedImagePathByFanSwingMode(fanSwingMode); }); } }); listControl[0].SelectedImagePath = DeviceAcDetailCardMethord.GetFanSwingModeSelectedImagePathByFanSwingMode(fanSwingMode); listControl[0].UnSelectedImagePath = DeviceAcDetailCardMethord.GetFanSwingModeUnSelectedImagePathByFanSwingMode(fanSwingMode); deviceAc.SetFanSwingAsyncMode(fanSwingMode); } @@ -705,20 +701,14 @@ //检测是否获取网关反馈的结果,如果网关没有回复,则会弹出消息 this.StartCheckResponeResult(this.listControl, (result) => { //没有接收到网关回复 if (result == false) if (result == true) { //接收到网关回复 HdlThreadLogic.Current.RunMain(() => { //还原状态 listControl[1].SelectedImagePath = DeviceAcDetailCardMethord.GetModeSelectedImagePathByMode(oldModel); listControl[1].UnSelectedImagePath = DeviceAcDetailCardMethord.GetModeUnSelectedImagePathByMode(oldModel); }); } else { HdlThreadLogic.Current.RunMain(() => { listControl[1].SelectedImagePath = DeviceAcDetailCardMethord.GetModeSelectedImagePathByMode(mode); listControl[1].UnSelectedImagePath = DeviceAcDetailCardMethord.GetModeUnSelectedImagePathByMode(mode); //送风的时候,没有温度的概念 if (mode == AC.AcMode.FanOnly) { @@ -741,10 +731,6 @@ }); } }); listControl[1].SelectedImagePath = DeviceAcDetailCardMethord.GetModeSelectedImagePathByMode(mode); listControl[1].UnSelectedImagePath = DeviceAcDetailCardMethord.GetModeUnSelectedImagePathByMode(mode); deviceAc.SetSystemModeAsync(mode); } @@ -800,6 +786,7 @@ //那四个图标变更 this.listControl[0].IsSelected = isOpen; this.listControl[1].IsSelected = isOpen; this.listControl[2].IsSelected = isOpen; this.listControl[3].IsSelected = isOpen; if (isOpen == true) { @@ -823,7 +810,6 @@ } }); this.listControl[2].IsSelected = isOpen; if (isOpen == true) { deviceAc.Open(); @@ -955,20 +941,16 @@ //检测是否获取网关反馈的结果,如果网关没有回复,则会弹出消息 this.StartCheckResponeResult(this.listControl, (result) => { //没有接收到网关回复 if (result == false) //接收到网关回复 if (result == true) { HdlThreadLogic.Current.RunMain(() => { //还原状态 listControl[3].SelectedImagePath = DeviceAcDetailCardMethord.GetFanModeSelectedImagePathByFanMode(oldModel); listControl[3].UnSelectedImagePath = DeviceAcDetailCardMethord.GetFanModeSelectedImagePathByFanMode(oldModel); listControl[3].SelectedImagePath = DeviceAcDetailCardMethord.GetFanModeSelectedImagePathByFanMode(mode); listControl[3].UnSelectedImagePath = DeviceAcDetailCardMethord.GetFanModeSelectedImagePathByFanMode(mode); }); } }); listControl[3].SelectedImagePath = DeviceAcDetailCardMethord.GetFanModeSelectedImagePathByFanMode(mode); listControl[3].UnSelectedImagePath = DeviceAcDetailCardMethord.GetFanModeSelectedImagePathByFanMode(mode); deviceAc.SetFanModeAsync(mode); } ZigbeeApp/Shared/Phone/MainPage/ControlForm/DeviceColorLightDetailCardForm.cs
@@ -220,25 +220,26 @@ { HdlThreadLogic.Current.RunMain(() => { bool statu = ((LightBase)this.device).OnOffStatus == 1; //接收到网关回复 if (result == true) { bool statu = ((LightBase)this.device).OnOffStatus == 1; //刷新开关状态 this.RefreshSwitchStatu(statu); if (statu == true) { //等待结果结束后,彩灯控件可以滑动 waveSeekBar.IsClickable = true; } //状态取反 listControl[0].IsSelected = statu; } if (statu == true) { //等待结果结束后,彩灯控件可以滑动 waveSeekBar.IsClickable = true; } }); }); //发送等待的时间内,不能滑动彩灯控件 waveSeekBar.IsClickable = false; //状态取反 listControl[0].IsSelected = !listControl[0].IsSelected; if (isOpen == true) { //打开 ZigbeeApp/Shared/Phone/MainPage/ControlForm/DeviceColorTemperatureLightDetailCardForm.cs
@@ -269,25 +269,25 @@ { HdlThreadLogic.Current.RunMain(() => { bool statu = ((LightBase)this.device).OnOffStatus == 1; //接收到网关回复 if (result == true) { bool statu = ((LightBase)this.device).OnOffStatus == 1; //刷新开关状态 this.RefreshSwitchStatu(statu); if (statu == true) { //等待结果结束后,彩灯控件可以滑动 waveSeekBar.IsClickable = true; } //状态取反 listControl[0].IsSelected = statu; } if (statu == true) { //等待结果结束后,彩灯控件可以滑动 waveSeekBar.IsClickable = true; } }); }); //发送等待的时间内,不能滑动彩灯控件 waveSeekBar.IsClickable = false; //状态取反 listControl[0].IsSelected = !listControl[0].IsSelected; if (isOpen == true) { //打开 ZigbeeApp/Shared/Phone/MainPage/ControlForm/DeviceMiniLightDetailCardForm.cs
New file @@ -0,0 +1,511 @@ using Shared.Common; using Shared.Phone.UserCenter; using System; using System.Collections.Generic; using System.Text; using ZigBee.Device; namespace Shared.Phone.MainPage.ControlForm { /// <summary> /// mini夜灯的深度卡片界面 /// </summary> public class DeviceMiniLightDetailCardForm : DeviceDetailCardCommonForm { #region ■ 变量声明___________________________ /// <summary> /// 蜂鸣器的开关控件 /// </summary> private IconBigViewControl btnBuzzerSwitch = null; /// <summary> /// mini夜灯的开关控件 /// </summary> private IconBigViewControl btnMiniSwitch = null; /// <summary> /// 亮度的进度条控件 /// </summary> private SeekBarControl seekBarLight = null; /// <summary> /// 色温的进度条控件 /// </summary> private SeekBarControl seekBarColor = null; /// <summary> /// MaxLevel /// </summary> private const int MaxLevel = 254; /// <summary> /// 亮度进度值是否在改变中 /// </summary> private bool isLightProgressing = false; /// <summary> /// 色温进度值是否在改变中 /// </summary> private bool isColorProgressing = false; /// <summary> /// 能否发送进度值 /// </summary> private bool canSetProgressValue = true; /// <summary> /// 1:发送的是小夜灯 2:发送的是蜂鸣器 /// </summary> private int sendDiv = 0; #endregion #region ■ 初始化_____________________________ /// <summary> /// 底层初始化中部控件完成之后 /// </summary> /// <param name="frameWhiteBack"></param> public override void InitMiddleFrameAfter(FrameLayout frameWhiteBack) { //添加接收蜂鸣器Ack主题 this.AddReceiveBuzzerAckEvent(); //左滑不能 this.ScrollEnabled = false; //设置状态文字 if (((LightBase)this.device).OnOffStatus == 1) { //亮度 XX this.SetStatuText(Language.StringByID(R.MyInternationalizationString.uBrightness) + " " + HdlDeviceOtherLogic.Current.GetDeviceStatu(this.device)); } else { //关闭 this.SetStatuText(Language.StringByID(R.MyInternationalizationString.Close)); } //亮度 var btnLightView = new NormalViewControl(300, 60, true); btnLightView.Text = Language.StringByID(R.MyInternationalizationString.uBrightness) + ":"; btnLightView.X = Application.GetRealWidth(43); btnLightView.Y = Application.GetRealHeight(320); frameWhiteBack.AddChidren(btnLightView); //底线 var btnLightLine = new NormalViewControl(Application.GetRealWidth(841), ControlCommonResourse.BottomLineHeight, false); btnLightLine.BackgroundColor = UserCenterColor.Current.ButtomLine; btnLightLine.X = btnLightView.X; btnLightLine.Y = btnLightView.Bottom + Application.GetRealHeight(37); frameWhiteBack.AddChidren(btnLightLine); //进度条(+60的偏移量) this.seekBarLight = new SeekBarControl(611 + 120); seekBarLight.Y = Application.GetRealHeight(280); seekBarLight.X = Application.GetRealWidth(266 - 60); seekBarLight.Height = Application.GetRealHeight(144); seekBarLight.SeekBarViewHeight = Application.GetRealHeight(20); seekBarLight.SeekBarPadding = Application.GetRealWidth(60); seekBarLight.IsProgressTextShow = true; seekBarLight.ProgressBarColor = 0xffff6c2c; seekBarLight.ProgressTextSize = 14; seekBarLight.ProgressTextColor = UserCenterColor.Current.TextGrayColor2; seekBarLight.Gravity = Gravity.Frame; seekBarLight.Progress = (int)(((ColorTemperatureLight)this.device).Level * 1.0 / MaxLevel * 100); frameWhiteBack.AddChidren(seekBarLight); //色温 var btnColorView = new NormalViewControl(300, 60, true); btnColorView.Text = Language.StringByID(R.MyInternationalizationString.uColorTemperature) + ":"; btnColorView.X = Application.GetRealWidth(43); btnColorView.Y = btnLightLine.Y + Application.GetRealHeight(107); frameWhiteBack.AddChidren(btnColorView); //底线 var btnColorLine = new NormalViewControl(Application.GetRealWidth(841), ControlCommonResourse.BottomLineHeight, false); btnColorLine.BackgroundColor = UserCenterColor.Current.ButtomLine; btnColorLine.X = btnColorView.X; btnColorLine.Y = btnColorView.Bottom + Application.GetRealHeight(37); frameWhiteBack.AddChidren(btnColorLine); //色温的渐变色背景 var btnColorBack = new PicViewControl(611, 20); btnColorBack.UnSelectedImagePath = "Item/ColorTemperatureBar.png"; btnColorBack.X = Application.GetRealWidth(266); btnColorBack.Y = btnColorView.Y + btnColorView.Height / 2 - HdlControlLogic.Current.GetPictrueRealSize(20) / 2; frameWhiteBack.AddChidren(btnColorBack); //进度条(+60的偏移量,色温的范围是 3400~6000) this.seekBarColor = new SeekBarControl(611 + 120); seekBarColor.Y = btnLightLine.Bottom + Application.GetRealHeight(58); seekBarColor.X = Application.GetRealWidth(266 - 60); seekBarColor.Height = Application.GetRealHeight(144); seekBarColor.SeekBarViewHeight = Application.GetRealHeight(20); seekBarColor.SeekBarPadding = Application.GetRealWidth(60); seekBarColor.IsProgressTextShow = true; seekBarColor.ProgressBarColor = UserCenterColor.Current.Transparent; seekBarColor.SeekBarBackgroundColor = UserCenterColor.Current.Transparent; seekBarColor.ProgressTextSize = 14; seekBarColor.ProgressTextColor = UserCenterColor.Current.TextGrayColor2; seekBarColor.Gravity = Gravity.Frame; seekBarColor.ProgressBarUnitSring = "K"; seekBarColor.MinValue = 34; seekBarColor.MaxValue = 60; frameWhiteBack.AddChidren(seekBarColor); //设置初始值 int colorValue = ((ColorTemperatureLight)this.device).ColorTemperature; if (colorValue == 0) { colorValue = 3400; } seekBarColor.Progress = colorValue / 100; //蜂鸣器开关: var btnBuzzerView = new NormalViewControl(300, 60, true); btnBuzzerView.Text = Language.StringByID(R.MyInternationalizationString.uBuzzerSwitch) + ":"; btnBuzzerView.X = Application.GetRealWidth(43); btnBuzzerView.Y = btnColorLine.Y + Application.GetRealHeight(107); frameWhiteBack.AddChidren(btnBuzzerView); //底线 var btnBuzzerLine = new NormalViewControl(Application.GetRealWidth(841), ControlCommonResourse.BottomLineHeight, false); btnBuzzerLine.BackgroundColor = UserCenterColor.Current.ButtomLine; btnBuzzerLine.X = btnBuzzerView.X; btnBuzzerLine.Y = btnBuzzerView.Bottom + Application.GetRealHeight(37); frameWhiteBack.AddChidren(btnBuzzerLine); //开关 this.btnBuzzerSwitch = new IconBigViewControl(81, 81); btnBuzzerSwitch.UnSelectedImagePath = "Item/Switch.png"; btnBuzzerSwitch.SelectedImagePath = "Item/SwitchSelected.png"; frameWhiteBack.AddChidren(btnBuzzerSwitch); btnBuzzerSwitch.InitControl(); btnBuzzerSwitch.UseClickStatu = false; btnBuzzerSwitch.X = Application.GetRealWidth(795) - btnBuzzerSwitch.XOffset; btnBuzzerSwitch.Y = btnColorLine.Y + Application.GetRealHeight(98) - btnBuzzerSwitch.YOffset; btnBuzzerSwitch.ButtonClickEvent += (sender, e) => { //发送开关命令 this.SetBuzzerSwitchCommand(!btnBuzzerSwitch.IsSelected); }; //小夜灯开关: var btnMiniView = new NormalViewControl(300, 60, true); btnMiniView.Text = Language.StringByID(R.MyInternationalizationString.uMiniLightSwitch) + ":"; btnMiniView.X = Application.GetRealWidth(43); btnMiniView.Y = btnBuzzerLine.Y + Application.GetRealHeight(107); frameWhiteBack.AddChidren(btnMiniView); //底线 var btnMiniLine = new NormalViewControl(Application.GetRealWidth(841), ControlCommonResourse.BottomLineHeight, false); btnMiniLine.BackgroundColor = UserCenterColor.Current.ButtomLine; btnMiniLine.X = btnMiniView.X; btnMiniLine.Y = btnMiniView.Bottom + Application.GetRealHeight(37); frameWhiteBack.AddChidren(btnMiniLine); //开关 this.btnMiniSwitch = new IconBigViewControl(81, 81); btnMiniSwitch.UnSelectedImagePath = "Item/Switch.png"; btnMiniSwitch.SelectedImagePath = "Item/SwitchSelected.png"; frameWhiteBack.AddChidren(btnMiniSwitch); btnMiniSwitch.InitControl(); btnMiniSwitch.UseClickStatu = false; btnMiniSwitch.X = Application.GetRealWidth(795) - btnMiniSwitch.XOffset; btnMiniSwitch.Y = btnBuzzerLine.Y + Application.GetRealHeight(98) - btnMiniSwitch.YOffset; btnMiniSwitch.ButtonClickEvent += (sender, e) => { //发送开关命令 this.SetLightSwitchCommand(!btnMiniSwitch.IsSelected); }; btnMiniSwitch.IsSelected = ((LightBase)this.device).OnOffStatus == 1; this.canSetProgressValue = btnMiniSwitch.IsSelected; //亮度开始滑动的事件 seekBarLight.OnStartTrackingTouchEvent += (sender, e) => { //进度值开始变更 this.isLightProgressing = true; }; //亮度结束滑动的事件 seekBarLight.OnStopTrackingTouchEvent += (sender, e) => { //进度值开始结束 this.isLightProgressing = false; }; //亮度滑动过程中 int oldLightValue = seekBarLight.Progress;//之前的值 int nowLightValue = oldLightValue;//变更的值 seekBarLight.OnProgressChangedEvent += (sender, value) => { if (Common.Config.Instance.Home.IsVirtually == false) { if (this.canSetProgressValue == true) { //能够发送进度值的时候,才记录 nowLightValue = value; } } else { //如果住宅为虚拟住宅,直接改缓存 ((ColorTemperatureLight)this.device).Level = value * MaxLevel / 100; //亮度 XX this.SetStatuText(Language.StringByID(R.MyInternationalizationString.uBrightness) + " " + HdlDeviceOtherLogic.Current.GetDeviceStatu(this.device)); } }; //色温开始滑动的事件 seekBarColor.OnStartTrackingTouchEvent += (sender, e) => { //进度值开始变更 this.isColorProgressing = true; }; //色温结束滑动的事件 seekBarColor.OnStopTrackingTouchEvent += (sender, e) => { //进度值开始结束 this.isColorProgressing = false; }; //色温滑动过程中 int oldColorValue = seekBarColor.Progress;//之前的值 int nowColorValue = oldColorValue;//变更的值 seekBarColor.OnProgressChangedEvent += (sender, value) => { if (Common.Config.Instance.Home.IsVirtually == false) { if (this.canSetProgressValue == true) { //能够发送进度值的时候,才记录 nowColorValue = value; } } else { //如果住宅为虚拟住宅,直接改缓存 ((ColorTemperatureLight)this.device).ColorTemperature = value * 100; } }; //开一个线程,监视是否滑动的滑动条,每秒检测一次 HdlThreadLogic.Current.RunThread(() => { while (this.Parent != null) { System.Threading.Thread.Sleep(1000); //发送亮度值 if (nowLightValue != oldLightValue) { oldLightValue = nowLightValue; ((ColorTemperatureLight)this.device).SetLevel((int)(oldLightValue * MaxLevel / 100.0)); } //发送色温值 if (nowColorValue != oldColorValue) { oldColorValue = nowColorValue; ((ColorTemperatureLight)this.device).SetColorTemperature(oldColorValue * 100); } } if (this.canSetProgressValue == true) { //界面关闭时 if (nowLightValue != oldLightValue) { //发送亮度值 ((ColorTemperatureLight)this.device).SetLevel((int)(nowLightValue * MaxLevel / 100.0)); } if (nowColorValue != oldColorValue) { //发送色温值 ((ColorTemperatureLight)this.device).SetColorTemperature(nowColorValue * 100); } } }); } #endregion #region ■ 发送夜灯开关命令___________________ /// <summary> /// 发送夜灯开关命令 /// </summary> /// <param name="isOpen"></param> private void SetLightSwitchCommand(bool isOpen) { //如果住宅是虚拟住宅 if (Common.Config.Instance.Home.IsVirtually == true) { ((LightBase)this.device).OnOffStatus = isOpen == true ? 1 : 0; //刷新开关状态 this.RefreshSwitchStatu(isOpen); return; } //当按下开关按钮时,不能再发送进度值 this.canSetProgressValue = false; //检测是否获取网关反馈的结果,如果网关没有回复,则会弹出消息 this.StartCheckResponeResult(new List<ButtonBase> { this.btnMiniSwitch.btnIcon }, (result) => { HdlThreadLogic.Current.RunMain(() => { //接收到网关回复 if (result == true) { bool statu = ((LightBase)this.device).OnOffStatus == 1; //刷新开关状态 this.RefreshSwitchStatu(statu); if (statu == true) { //当是打开状态时,网关说它会默认把亮度变成100% //以防万一,这里再次读取一下 ((ColorTemperatureLight)device).ReadLevel(); } } }); }); this.sendDiv = 1; if (isOpen == true) { //打开 this.device.SwitchControl(1); } else { //关闭 this.device.SwitchControl(0); } } #endregion #region ■ 发送蜂鸣器开关命令_________________ /// <summary> /// 发送蜂鸣器开关命令 /// </summary> /// <param name="isOpen"></param> private void SetBuzzerSwitchCommand(bool isOpen) { //如果住宅是虚拟住宅 if (Common.Config.Instance.Home.IsVirtually == true) { //((LightBase)this.device).OnOffStatus = isOpen == true ? 1 : 0; ////刷新开关状态 //this.RefreshSwitchStatu(isOpen); return; } //检测是否获取网关反馈的结果,如果网关没有回复,则会弹出消息 this.StartCheckResponeResult(new List<ButtonBase> { this.btnBuzzerSwitch.btnIcon }, (result) => { HdlThreadLogic.Current.RunMain(() => { //接收到网关回复 if (result == true) { this.btnBuzzerSwitch.IsSelected = isOpen; //bool statu = ((LightBase)this.device).OnOffStatus == 1; ////刷新开关状态 //this.RefreshSwitchStatu(statu); } }); }); //发送命令 this.sendDiv = 2; ((ColorTemperatureLight)this.device).SendBuzzerSwitchControl(isOpen); } /// <summary> /// 添加接收蜂鸣器Ack主题 /// </summary> private void AddReceiveBuzzerAckEvent() { //Ack主题上报 string mainKeys = LocalDevice.Current.GetDeviceMainKeys(this.device); HdlGatewayReceiveLogic.Current.AddAttributeEvent("DeviceBuzzerDetailCardACK", ReceiveComandDiv.A节点控制反馈, (report) => { string mainKey2 = LocalDevice.Current.GetDeviceMainKeys(report); if (mainKeys != mainKey2) { //不是同一个东西 return; } //这里只处理蜂鸣器的 if (this.sendDiv == 2) { //结果已经接收到 this.ResponeResult = 1; } }); } #endregion #region ■ 是否获取网关反馈的结果_____________ /// <summary> /// 检测网关的反馈结果(属性上报的对象:device.DeviceStatusReport) /// </summary> /// <param name="comandDiv">命令区分</param> /// <param name="report">上报数据</param> /// <returns></returns> public override bool CheckResponeResultStatu(ReceiveComandDiv comandDiv, CommonDevice report) { if (comandDiv == ReceiveComandDiv.A设备属性上报) { HdlThreadLogic.Current.RunMain(() => { //刷新开关状态 this.RefreshSwitchStatu(((LightBase)this.device).OnOffStatus == 1); }); return true; } return false; } #endregion #region ■ 刷新开关状态_______________________ /// <summary> /// 刷新开关状态 /// </summary> /// <param name="isOpen">打开状态</param> private void RefreshSwitchStatu(bool isOpen) { if (this.isColorProgressing == true) { //如果是色温滑动的话,不需要刷新界面 return; } if (isOpen == true) { //亮度是必须要刷新的 亮度 XX this.SetStatuText(Language.StringByID(R.MyInternationalizationString.uBrightness) + " " + HdlDeviceOtherLogic.Current.GetDeviceStatu(this.device)); if (this.isLightProgressing == false) { //当进度值在手动变更中时,不接收推送 seekBarLight.Progress = (int)(((ColorTemperatureLight)this.device).Level * 1.0 / MaxLevel * 100); } if (this.isColorProgressing == false) { //当进度值在手动变更中时,不接收推送 seekBarColor.Progress = (int)(((ColorTemperatureLight)this.device).ColorTemperature / 100); } this.btnMiniSwitch.IsSelected = true; } else { //变更字样:关闭 this.SetStatuText(Language.StringByID(R.MyInternationalizationString.Close)); this.btnMiniSwitch.IsSelected = false; } //回复的结果说,处于打开状态才能发送 this.canSetProgressValue = isOpen; } #endregion #region ■ 界面关闭___________________________ /// <summary> /// 界面关闭 /// </summary> public override void CloseFormBefore() { base.CloseFormBefore(); HdlGatewayReceiveLogic.Current.RemoveEvent("DeviceBuzzerDetailCardACK"); } #endregion } } ZigbeeApp/Shared/Phone/MainPage/ControlForm/DeviceRelayDetailCardForm.cs
@@ -215,9 +215,6 @@ /// <param name="isOpen">打开状态</param> private void RefreshSwitchStatu(bool isOpen) { //状态一致(第二索引的控件如果是选择状态,则必定为开状态) if (listControl[1].IsSelected == isOpen) { return; } //变更状态 if (this.device.DfunctionType == DeviceFunctionType.A开关) { @@ -232,6 +229,8 @@ listControl[0].IsSelected = isOpen; listControl[1].IsSelected = isOpen; } //设置状态文字 this.SetStatuText(HdlDeviceOtherLogic.Current.GetDeviceStatu(this.device)); } #endregion @@ -252,8 +251,6 @@ { //变更卡片状态 this.RefreshSwitchStatu(((LightBase)this.device).OnOffStatus == 1); //设置状态文字 this.SetStatuText(HdlDeviceOtherLogic.Current.GetDeviceStatu(this.device)); }); return true; } @@ -276,36 +273,30 @@ ((LightBase)this.device).OnOffStatus = isOpen == true ? 1 : 0; //变更卡片状态 this.RefreshSwitchStatu(((LightBase)this.device).OnOffStatus == 1); //设置状态文字 this.SetStatuText(HdlDeviceOtherLogic.Current.GetDeviceStatu(this.device)); return; } //检测是否获取网关反馈的结果,如果网关没有回复,则会弹出消息 this.StartCheckResponeResult(this.listControl, (result) => { //没有接收到网关回复 if (result == false) //接收到网关回复 if (result == true) { HdlThreadLogic.Current.RunMain(() => { //设置状态文字 this.SetStatuText(HdlDeviceOtherLogic.Current.GetDeviceStatu(this.device)); { //变更卡片状态 bool statu = ((LightBase)this.device).OnOffStatus == 1; this.RefreshSwitchStatu(statu); }); } }); //变更卡片状态 this.RefreshSwitchStatu(isOpen); if (isOpen == true) { //打开 this.SetStatuText(Language.StringByID(R.MyInternationalizationString.uOpen1)); this.device.SwitchControl(1); } else { //关闭 this.SetStatuText(Language.StringByID(R.MyInternationalizationString.Close)); this.device.SwitchControl(0); } } ZigbeeApp/Shared/Phone/MainPage/Controls/DeviceCard/DeviceColorTemperatureCardControl.cs
@@ -71,10 +71,21 @@ { Common.CommonPage.Instance.IsDrawerLockMode = true; var form = new ControlForm.DeviceColorTemperatureLightDetailCardForm(); form.RowOrCardControl = this; form.AddForm(i_device, this.nowSelectRoom, 965, 1466); form.FormCloseEvent += this.CardDetailInfoBackEvent; if (Common.LocalDevice.Current.IsMiniLight(this.device) == false) { var form = new ControlForm.DeviceColorTemperatureLightDetailCardForm(); form.RowOrCardControl = this; form.AddForm(i_device, this.nowSelectRoom, 965, 1466); form.FormCloseEvent += this.CardDetailInfoBackEvent; } else { //mini夜灯 var form = new ControlForm.DeviceMiniLightDetailCardForm(); form.RowOrCardControl = this; form.AddForm(i_device, this.nowSelectRoom, 965, 1466); form.FormCloseEvent += this.CardDetailInfoBackEvent; } }; } ZigbeeApp/Shared/Phone/SmartSound/Forms/SmartSoundContentForDevice.cs
@@ -19,7 +19,12 @@ /// </summary> private FrameLayout TipLayout = null; private List<string> TabList = new List<string>() { "灯光", "窗帘" }; private List<string> TabList = new List<string>() { Language.StringByID(R.MyInternationalizationString.uLight), Language.StringByID(R.MyInternationalizationString.uDeviceBelongId100), Language.StringByID(R.MyInternationalizationString.AC) }; private int CurrentSelectIndex = 0; @@ -40,13 +45,10 @@ /// </summary> public void ShowForm() { //设置标题信息 base.SetTitleText(CurrentRoom.RoomName); //初始化中部控件 this.InitMiddleFrame(); } private void InitMiddleFrame() @@ -167,8 +169,6 @@ listView.Y= tab_layout.Height; listView.Height=ContentLayout.Height- tab_layout.Height; Buttons.Clear(); //添加功能项 @@ -208,12 +208,12 @@ switch (CurrentSelectIndex) { case 0:// 灯光 case 0: // 灯光 { for (int i = 0; i < CurrentRoom.DeviceList.Count; i++) { SmartSound.Device device = CurrentRoom.DeviceList[i]; //灯光 // 灯光 if (device.DeviceType == 1 || device.DeviceType == 2 || device.DeviceType == 3) { var deviceRowLayout = new DeviceRowLayout(this, device); @@ -238,6 +238,28 @@ } } break; case 2: // 空调 { for (int i = 0; i < CurrentRoom.DeviceList.Count; i++) { SmartSound.Device device = CurrentRoom.DeviceList[i]; // if (device.DeviceType == 7) { var deviceRowLayout = new DeviceRowLayout(this, device); listView.AddChidren(deviceRowLayout); deviceRowLayout.InitControl(); } } } break; } if (listView.ChildrenCount > 5) { TextView textView = new TextView(); textView.Height = Application.GetRealHeight(127 * 3); listView.AddChidren(textView); } if (listView.ChildrenCount == 0) ZigbeeApp/Shared/Phone/SmartSound/Forms/SmartSoundContentForDeviceChange.cs
@@ -30,7 +30,12 @@ /// </summary> private FrameLayout TipLayout = null; private List<string> TabList = new List<string>() { Language.StringByID(R.MyInternationalizationString.uLight), Language.StringByID(R.MyInternationalizationString.uDeviceBelongId100) }; private List<string> TabList = new List<string>() { Language.StringByID(R.MyInternationalizationString.uLight), Language.StringByID(R.MyInternationalizationString.uDeviceBelongId100), Language.StringByID(R.MyInternationalizationString.AC) }; private int CurrentSelectIndex = 0; private int imageWith = 683; @@ -251,6 +256,23 @@ } } break; case 2: // 空调 { int n = 0; for (int i = 0; i < CurrentRoom.DeviceList.Count; i++) { SmartSound.Device device = CurrentRoom.DeviceList[i]; // if (device.DeviceType == 7) { var deviceRowLayout = new DeviceRowLayout(this, device, n); DeviceListView.AddChidren(deviceRowLayout); deviceRowLayout.InitControl(); n++; } } } break; } if (DeviceListView.ChildrenCount > 5) @@ -285,9 +307,9 @@ //生成一个弹窗画面 var dialogForm = new DialogInputControl(); //编辑住宅 dialogForm.SetTitleText("自定义唤醒词"); dialogForm.SetTitleText("自定义昵称"); //请输入住宅名称 dialogForm.SetTipText("请输入唤醒词"); dialogForm.SetTipText("请输入昵称"); dialogForm.Text = scene.NicksName; //按下确认按钮 @@ -316,9 +338,9 @@ //生成一个弹窗画面 var dialogForm = new DialogInputControl(); //编辑住宅 dialogForm.SetTitleText("自定义唤醒词"); dialogForm.SetTitleText("自定义昵称"); //请输入住宅名称 dialogForm.SetTipText("请输入唤醒词"); dialogForm.SetTipText("请输入昵称"); dialogForm.Text = device.NicksName; //按下确认按钮 @@ -344,20 +366,22 @@ /// </summary> private void ShowSceneDelectDialog(SmartSound.Scene scene) { this.ShowMassage(ShowMsgType.Confirm, "确认删除该控制内容?", async () => { try this.ShowMassage(ShowMsgType.Confirm, "确认删除该控制内容?", () => { HdlThreadLogic.Current.RunThread(async () => { this.ShowProgressBar(); CurrentRoom.SceneList.Remove(scene); LoadSceneView(); string json = await postBatchEdit(); } catch (Exception e) { string sss = e.Message; } }, Language.StringByID(R.MyInternationalizationString.OkMsg)); HdlThreadLogic.Current.RunMainInThread(() => { LoadSceneView(); this.CloseProgressBar(); }); }); }, Language.StringByID(R.MyInternationalizationString.OkMsg)); } /// <summary> @@ -365,20 +389,21 @@ /// </summary> private void ShowDeviceDelectDialog(SmartSound.Device device) { this.ShowMassage(ShowMsgType.Confirm, "确认删除该控制内容?", async () => this.ShowMassage(ShowMsgType.Confirm, "确认删除该控制内容?", () => { try { //DeviceListView.RemoveAt(index); CurrentRoom.DeviceList.Remove(device); RefreshFunctionListView(); string json = await postBatchEdit(); } catch (Exception e) HdlThreadLogic.Current.RunThread(async () => { string sss = e.Message; } this.ShowProgressBar(); CurrentRoom.DeviceList.Remove(device); string json = await postBatchEdit(); HdlThreadLogic.Current.RunMainInThread(() => { RefreshFunctionListView(); this.CloseProgressBar(); }); }); }, Language.StringByID(R.MyInternationalizationString.OkMsg)); } @@ -446,7 +471,7 @@ // 提交数据至服务器 string url = "https://developer.hdlcontrol.com/zigbeespeakerservice/BatchEdit"; string json = Newtonsoft.Json.JsonConvert.SerializeObject(SmartSound.getInstantiate()); string response_str = await MyHttpWebResponse.PostWebRequest(url, json, Encoding.UTF8); string response_str = MyHttpWebResponse.PostWebRequest(url, json, Encoding.UTF8); return response_str; } ZigbeeApp/Shared/Phone/SmartSound/Forms/SmartSoundControlContentForm.cs
@@ -75,6 +75,7 @@ SmartSound.getInstantiate().LayerList = CollateData(); SmartSound.getInstantiate().TokenID = mSoundInfo.Id; SmartSound.getInstantiate().UserID = mSoundInfo.UserID; SmartSound.getInstantiate().HomeID = mSoundInfo.HomeID; //上传数据到服务器 string str = await postBatchEdit(); @@ -133,7 +134,7 @@ // The remote server returned an error: (400) Bad Request. string url = "https://developer.hdlcontrol.com/zigbeespeakerservice/BatchEdit"; string json = Newtonsoft.Json.JsonConvert.SerializeObject(SmartSound.getInstantiate()); string response_str = await MyHttpWebResponse.PostWebRequest(url, json, Encoding.UTF8); string response_str = MyHttpWebResponse.PostWebRequest(url, json, Encoding.UTF8); return response_str; } @@ -181,7 +182,6 @@ for (int n = 0; n < SmartSound.LocaData.Count; n++) { SmartSound.Layer layer = SmartSound.LocaData[n]; foreach (Room room in roomList) { try @@ -207,20 +207,27 @@ continue; SmartSound.Device smartDevice = new SmartSound.Device(); //smartDevice.Id = device.DeviceID.ToString();//设备 Id smartDevice.DeviceAddress = device.DeviceAddr;//设备 MAC smartDevice.Epoint = device.DeviceEpoint;//设备端口 //smartDevice.ClusterID = 0; smartDevice.DeviceName = device.DeviceName;//设备名称 smartDevice.DeviceName = Common.LocalDevice.Current.GetDeviceEpointName(device);//设备名称 smartDevice.NicksName = ""; smartDevice.DeviceType = GetDeviceType(device);//设备类型 smartDevice.GatewayID = device.CurrentGateWayId;//网关 Id //smartDevice.RoomID = room.Id;//房间 Id if (smartDevice.DeviceType == 0) continue; if(ZbGateway.GateWayBaseInfomations.ContainsKey(device.CurrentGateWayId) ==true) { smartDevice.GatewayID = ZbGateway.GateWayBaseInfomations[device.CurrentGateWayId].MacMark;//网关 Id } else { smartDevice.GatewayID = device.CurrentGateWayId;//网关 Id } if (smartDevice.DeviceName == "" || smartDevice.DeviceName == string.Empty) continue; smartRoom.DeviceList.Add(smartDevice); } #endregion @@ -229,25 +236,36 @@ #region //添加场景 for (int k = 0; k < sceneList.Count; k++) { SceneUI scene = sceneList[k]; if (scene == null) continue; SmartSound.Scene smartScene = new SmartSound.Scene(); //smartScene.Id = scene.DeviceID.ToString(); smartScene.SceneName = scene.Name; smartScene.SceneID = scene.Id; smartScene.DelayTime = scene.DelayTime; //smartScene.ClusterID = 0; smartScene.NicksName = ""; //smartScene.RoomID = room.Id; smartScene.GatewayID = ZbGateway.MainGateWay.GwId; try { SceneUI scene = sceneList[k]; if (smartScene.SceneName == "" || smartScene.SceneName == string.Empty) continue; if (scene == null) continue; SmartSound.Scene smartScene = new SmartSound.Scene(); smartScene.SceneName = scene.Name; smartScene.SceneID = scene.Id; smartScene.DelayTime = scene.DelayTime; smartScene.NicksName = ""; if (ZbGateway.GateWayBaseInfomations.ContainsKey(ZbGateway.MainGateWay.GwId) == true) { smartScene.GatewayID = ZbGateway.GateWayBaseInfomations[ZbGateway.MainGateWay.GwId].MacMark;//网关 Id } else { smartScene.GatewayID = ZbGateway.MainGateWay.GwId;//网关 Id } smartRoom.SceneList.Add(smartScene); if (smartScene.SceneName == "" || smartScene.SceneName == string.Empty) continue; smartRoom.SceneList.Add(smartScene); } catch (Exception e) { } } #endregion if (smartRoom.DeviceList.Count == 0 && sceneList.Count == 0) layer.RoomList.Remove(smartRoom); } catch (Exception e) @@ -432,6 +450,7 @@ if (!_device.Checked) { _room.DeviceList.Remove(_device); k--; } } #endregion @@ -443,6 +462,7 @@ if (!_scene.Checked) { _room.SceneList.Remove(_scene); n--; } } #endregion @@ -450,6 +470,7 @@ else { _layer.RoomList.Remove(_room); j--; } } } @@ -461,6 +482,7 @@ if (_layer.RoomList.Count < 1) { TempDatas.Remove(_layer); j--; } } } @@ -591,6 +613,7 @@ btnName.TextSize = 17; btnName.Y = Application.GetRealHeight(57); btnName.Text = mRoom.RoomName; Right_icon = this.AddRightArrow(); Right_icon.Width = Application.GetRealWidth(115); Right_icon.Height = Application.GetRealHeight(115); ZigbeeApp/Shared/Phone/SmartSound/Forms/SmartSoundControlForm.cs
@@ -74,6 +74,7 @@ SmartSound.getInstantiate().LayerList = dataInfo.ResponseData.LayerList; SmartSound.getInstantiate().TokenID = mSoundInfo.Id; SmartSound.getInstantiate().UserID = mSoundInfo.UserID; SmartSound.getInstantiate().HomeID = mSoundInfo.HomeID; } } @@ -233,7 +234,7 @@ // 提交数据至服务器 string url = "https://developer.hdlcontrol.com/zigbeespeakerservice/BatchEdit"; string json = Newtonsoft.Json.JsonConvert.SerializeObject(SmartSound.getInstantiate()); string response_str = await MyHttpWebResponse.PostWebRequest(url, json, Encoding.UTF8); string response_str = MyHttpWebResponse.PostWebRequest(url, json, Encoding.UTF8); return response_str; } ZigbeeApp/Shared/Phone/SmartSound/Forms/SmartSoundListForm.cs
@@ -69,7 +69,7 @@ //画面关闭 dialogForm.CloseDialog(); }; }; }; } /// <summary> @@ -130,17 +130,11 @@ /// <returns></returns> private async Task getData() { //SmartSoundInfo.Auth auth = new SmartSoundInfo.Auth(); //auth.HomeID = Common.Config.Instance.Home.Id; //auth.UserID = Common.Config.Instance.Guid; //auth.Platform = ""; string url = string.Format("https://developer.hdlcontrol.com/zigbeespeakerservice/Auth?Platform&PageSetting.PageSize=100&PageSetting.PageIndex=1&UserID={0}&HomeID={1}", Common.Config.Instance.Guid,Common.Config.Instance.Home.Id); dataString = await MyHttpWebResponse.GetWebRequest(url); smartSoundInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<SmartSoundInfo>(dataString); dataString = await MyHttpWebResponse.GetWebRequest(url); smartSoundInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<SmartSoundInfo>(dataString); } /// <summary> @@ -150,8 +144,7 @@ /// <param name="new_remark"></param> /// <returns></returns> private async Task<string> setRemark(SmartSoundInfo.SoundInfo soundInfo, string new_remark) { { if (soundInfo == null) return ""; @@ -162,7 +155,7 @@ "\"UserID\":" + "\"" + soundInfo.UserID + "\"" + "," + "\"HomeID\":" + "\"" + soundInfo.HomeID + "\"" + "}"; string response_str = await MyHttpWebResponse.PutWebRequest(url, json, Encoding.UTF8); string response_str = MyHttpWebResponse.PutWebRequest(url, json, Encoding.UTF8); JObject jObject = JObject.Parse(response_str); return jObject["StateCode"].ToString(); @@ -178,55 +171,66 @@ for (int i = 0; i < smartSoundInfo.ResponseData.Data.Count; i++) { // var smartSound = smartSoundInfo.ResponseData.Data[i]; var row = new SoundRowLayout(); listView.AddChidren(row); if (smartSound.Platform == "Baidu") try { row.Account = "小度:" + smartSound.UserName; row.ImagePath = "SmartSound/Xiaodu.png"; row.Remark = smartSound.Remark; // var smartSound = smartSoundInfo.ResponseData.Data[i]; var row = new SoundRowLayout(); listView.AddChidren(row); if (smartSound.PlatfromName == "Baidu") { string remark = "小度"; if (smartSound.Remark != null && smartSound.Remark.Trim() != "") remark += "(" + smartSound.Remark + ")"; row.ImagePath = "SmartSound/Xiaodu.png"; row.Remark = remark; } row.InitControl(); row.btnDelect.AddTag("index", i); row.btnRename.AddTag("index", i); row.frameTable.AddTag("index", i); //重命名 row.btnRename.ButtonClickEvent += (sender, e) => { int index = (int)((NormalViewControl)sender).GetTagByKey("index"); var smartSound1 = smartSoundInfo.ResponseData.Data[index]; ShowRenameDialog(row, smartSound1); }; // 解除绑定 row.btnDelect.ButtonClickEvent += (sender, e) => { int index = (int)(((NormalViewControl)sender).GetTagByKey("index")); var smartSound1 = smartSoundInfo.ResponseData.Data[index]; ShowDelectDialog(smartSound1); }; //跳转到控制内容界面 FrameRowControl row.frameTable.ButtonClickEvent += (sender, e) => { int index = (int)row.frameTable.GetTagByKey("index"); if (SmartSound.getInstantiate().LayerList != null) SmartSound.getInstantiate().LayerList.Clear(); var smartSoundControlForm = new SmartSoundControlForm(smartSoundInfo.ResponseData.Data[index]); smartSoundControlForm.AddForm(); }; } row.InitControl(); row.btnDelect.AddTag("index", i); row.btnRename.AddTag("index", i); row.frameTable.AddTag("index", i); //重命名 row.btnRename.ButtonClickEvent += (sender, e) => catch (Exception e) { int index = (int)((NormalViewControl)sender).GetTagByKey("index"); var smartSound1 = smartSoundInfo.ResponseData.Data[index]; ShowRenameDialog(row, smartSound1); }; // 解除绑定 row.btnDelect.ButtonClickEvent += (sender, e) => { int index = (int)(((NormalViewControl)sender).GetTagByKey("index")); ShowDelectDialog(index); }; //跳转到控制内容界面 FrameRowControl row.frameTable.ButtonClickEvent += (sender, e) => { int index = (int)row.frameTable.GetTagByKey("index"); if (SmartSound.getInstantiate().LayerList != null) SmartSound.getInstantiate().LayerList.Clear(); var smartSoundControlForm = new SmartSoundControlForm(smartSoundInfo.ResponseData.Data[index]); smartSoundControlForm.AddForm(); }; this.ShowMassage(ShowMsgType.Tip, e.Message); } } } /// <summary> /// 解除绑定弹窗 /// </summary> private void ShowDelectDialog(int index) private void ShowDelectDialog(SmartSoundInfo.SoundInfo smartSound) { //生成一个弹窗画面 var dialogForm = new TextDialog("解除绑定需要到第三方 APP 进行操作", "跳转至小度"); @@ -235,8 +239,41 @@ //按下确认按钮 dialogForm.ComfirmClickEvent += () => { //画面关闭 dialogForm.CloseDialog(); HdlThreadLogic.Current.RunThread(() => { this.ShowProgressBar("删除服务器记录..."); string json = DelectSmartSound(smartSound); if (json == "SUCCESS") { smartSoundInfo.ResponseData.Data.Remove(smartSound); } this.CloseProgressBar(); HdlThreadLogic.Current.RunMainInThread(() => { //画面关闭 dialogForm.CloseDialog(); bool bol = false; try { #if Android bol = HDLUtils.OpenAppWithPackageName("com.baidu.duer.superapp"); #else HDLUtils.OpenApp("xiaoduapp://"); #endif } catch (Exception e) { string error = e.Message; bol = false; } if (!bol) { this.ShowMassage(ShowMsgType.Tip, "打开APP失败"); } iniView(); }); }); }; } /// <summary> @@ -250,7 +287,8 @@ //添加备份 dialogForm.SetTitleText("重命名"); //请输入备份名称 dialogForm.SetTipText(smartSound.Remark); dialogForm.SetTipText("请输入名称"); dialogForm.Text = smartSound.Remark; //按下确认按钮 dialogForm.ComfirmClickEvent += (async (textValue) => @@ -264,7 +302,7 @@ if (str == "SUCCESS") { smartSound.Remark = remark; soundRowLayout.btnRemark.Text = textValue; soundRowLayout.btnRemark.Text = "小度" + "(" + textValue + ")"; } else { @@ -276,8 +314,29 @@ #endregion /// <summary> /// 删除数据 /// </summary> /// <param name="soundInfo"></param> /// <returns></returns> private string DelectSmartSound(SmartSoundInfo.SoundInfo soundInfo) { if (soundInfo == null) return ""; #region ■ 界面重新激活事件___________________ string url = "https://developer.hdlcontrol.com/zigbeespeakerservice/Auth"; string json = "{" + "\"AuthID\":" + "\"" + soundInfo.Id + "\"" + "," + "\"UserID\":" + "\"" + soundInfo.UserID + "\"" + "," + "\"HomeID\":" + "\"" + soundInfo.HomeID + "\"" + "}"; string response_str = MyHttpWebResponse.DeleteWebRequest(url, json, Encoding.UTF8); JObject jObject = JObject.Parse(response_str); return jObject["StateCode"].ToString(); } #region ■ 界面重新激活事件___________________ /// <summary> /// 自身的上层界面关闭后,它自身处于最上层时,触发的事件 @@ -287,9 +346,9 @@ return 1; } #endregion #endregion #region ■ 关闭界面___________________________ #region ■ 关闭界面___________________________ /// <summary> /// 画面关闭 @@ -299,7 +358,7 @@ base.CloseFormBefore(); } #endregion #endregion } } ZigbeeApp/Shared/Phone/SmartSound/SmartSound.cs
@@ -22,6 +22,7 @@ private static SmartSound smartSound = null; public string UserID; public string TokenID; public string HomeID; public static SmartSound getInstantiate() { ZigbeeApp/Shared/Phone/SmartSound/SmartSoundInfo.cs
@@ -35,13 +35,13 @@ /// <summary> /// Baidu /// </summary> public string Platform { get; set; } public string PlatfromName { get; set; } public string HomeID { get; set; } public string OpenUID { get; set; } /// <summary> /// 智能音箱备注 /// </summary> public string Remark { get; set; } public string Remark { get; set; } = "我的音箱"; public string Id { get; set; } public bool IsDeleted { get; set; } public string CreatedOnUtc { get; set; } ZigbeeApp/Shared/Phone/SmartSound/Util/MyHttpWebResponse.cs
@@ -17,7 +17,7 @@ /// </summary> /// <param name="getUrl">接口地址</param> /// <returns></returns> public async static Task<string> GetWebRequest(string getUrl) public static async Task<string> GetWebRequest(string getUrl) { string responseContent = ""; @@ -50,7 +50,7 @@ /// <param name="paramData">提交json数据</param> /// <param name="dataEncode">编码方式(Encoding.UTF8)</param> /// <returns></returns> public async static Task<string> PostWebRequest(string postUrl, string paramData, Encoding dataEncode) public static string PostWebRequest(string postUrl, string paramData, Encoding dataEncode) { string responseContent = string.Empty; try @@ -91,7 +91,7 @@ /// <param name="paramData">提交json数据</param> /// <param name="dataEncode">编码方式(Encoding.UTF8)</param> /// <returns></returns> public async static Task<string> PutWebRequest(string postUrl, string paramData, Encoding dataEncode) public static string PutWebRequest(string postUrl, string paramData, Encoding dataEncode) { string responseContent = string.Empty; try @@ -121,5 +121,43 @@ } return responseContent; } /// <summary> /// delete数据接口 /// </summary> /// <param name="postUrl">接口地址</param> /// <param name="paramData">提交json数据</param> /// <param name="dataEncode">编码方式(Encoding.UTF8)</param> /// <returns></returns> public static string DeleteWebRequest(string postUrl, string paramData, Encoding dataEncode) { string responseContent = string.Empty; try { byte[] byteArray = dataEncode.GetBytes(paramData); //转化 HttpWebRequest webReq = (HttpWebRequest)WebRequest.Create(new Uri(postUrl)); webReq.Method = "DELETE"; webReq.ContentType = "application/json"; webReq.ContentLength = byteArray.Length; using (Stream reqStream = webReq.GetRequestStream()) { reqStream.Write(byteArray, 0, byteArray.Length);//写入参数 //reqStream.Close(); } using (HttpWebResponse response = (HttpWebResponse)webReq.GetResponse()) { //在这里对接收到的页面内容进行处理 using (StreamReader sr = new StreamReader(response.GetResponseStream(), Encoding.Default)) { responseContent = sr.ReadToEnd().ToString(); } } } catch (Exception ex) { return ex.Message; } return responseContent; } } } ZigbeeApp/Shared/Phone/SmartSound/Widget/SoundRowLayout.cs
@@ -12,7 +12,9 @@ /// 删除按钮 /// </summary> public NormalViewControl btnDelect = null; /// <summary> /// 备注 /// </summary> public NormalViewControl btnRemark = null; /// <summary> /// 图片路径 @@ -20,13 +22,10 @@ public string ImagePath = "SmartSound/SoundIcon.png"; /// <summary> /// 智能音箱账号 /// </summary> public string Account = ""; /// <summary> /// 智能音箱备注 /// 智能音箱备注名称 /// </summary> public string Remark = ""; public SoundRowLayout() { @@ -38,25 +37,30 @@ /// </summary> public void InitControl() { //图标 var btnIcon = frameTable.AddLeftIcon(81); try { //图标 var btnIcon = frameTable.AddLeftIcon(81); btnIcon.UnSelectedImagePath = ImagePath; btnIcon.SelectedImagePath = ImagePath; btnIcon.UnSelectedImagePath = ImagePath; btnIcon.SelectedImagePath = ImagePath; //设备 var btnAccount = frameTable.AddTopView(Account, 800); //房间 btnRemark = frameTable.AddBottomView(Remark, 800); //底线 frameTable.AddBottomLine(); //备注名称按钮 btnRemark = frameTable.AddLeftCaption(Remark, 800); btnRename = base.AddEditorControl(); btnRename.Text = "重命名"; //底线 frameTable.AddBottomLine(); btnDelect = base.AddDeleteControl(); btnDelect.Text = "解除绑定"; btnRename = base.AddEditorControl(); btnRename.Text = "重命名"; btnDelect = base.AddDeleteControl(); btnDelect.Text = "解除绑定"; } catch (Exception e) { // } } } } ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Common/UserCenterCommon.cs
@@ -294,6 +294,14 @@ /// 云端远程在线状态 /// </summary> public bool MqttOnlineStatus = false; /// <summary> /// 与此网关在云端Emq通信时,负载加解的16位Aes密钥 /// </summary> public string AesKey; /// <summary> /// 网关对应的唯一码 /// </summary> public string MacMark; } /// <summary> ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/ProgressRowBar.cs
@@ -12,6 +12,10 @@ #region ■ 变量声明___________________________ /// <summary> /// 进图条能否往回走(默认可以) /// </summary> public bool ProgressBarGoback = true; /// <summary> /// 会移动的进度条 /// </summary> private FrameLayout btnProgressBar = null; @@ -146,7 +150,7 @@ HdlThreadLogic.Current.RunMain(() => { int width = (int)(value * this.Width); if (btnProgressBar.Width >= width) if (this.ProgressBarGoback == false && btnProgressBar.Width >= width) { //不能让进度条往回走 return; @@ -157,7 +161,7 @@ //文本显示 btnProgressTextView.Text = ((int)(value * 100)) + "%"; //文本显示的那个图片框移动 this.frameProgressBack.X = ControlCommonResourse.XXLeft + btnProgressBar.Right - frameProgressBack.Width / 2; this.frameProgressBack.X = this.X + btnProgressBar.Right - frameProgressBack.Width / 2; } }); } ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/SeekBarControl.cs
@@ -50,7 +50,7 @@ /// </summary> public Action<int, int> ProgressChangedEvent = null; /// <summary> /// 进度条事件的触发时间间隔(默认没有间隔) /// 进度条事件的触发时间间隔(默认没有间隔,单位为毫秒) /// </summary> public int EventWaitTime = -1; /// <summary> @@ -70,10 +70,14 @@ { this.Width = Application.GetRealWidth(i_width); this.Height = Application.GetRealHeight(84); //圆球的宽度 this.ThumbImageHeight = Application.GetRealHeight(84); this.ThumbImagePath = "Item/SeekBarIcon.png"; //进度条的宽度 this.SeekBarViewHeight = Application.GetRealHeight(10); //进度条背景色 this.SeekBarBackgroundColor = 0xfff5f5f5; //上方是否显示文本 this.IsProgressTextShow = false; this.MaxValue = 100; this.Gravity = Gravity.CenterHorizontal; ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceCommonLogic.cs
@@ -166,8 +166,10 @@ /// <param name="receiptCommand">指定接收命令符</param> /// <param name="receiptDataLength">指定接收数据的长度</param> /// <param name="waitTime">超时时间(秒)</param> /// <param name="listReceiptLength">附加检测数据接收长度,当接收的长度在这列表里面时,代表接收成功(旨在对应新旧设备,透传回复的长度可能不同)</param> /// <returns>网关返回的数据</returns> public ReceiptGatewayResult SendJobjectDataToGateway2(CommonDevice device, string sendData, string receiptCommand, int receiptDataLength, int waitTime = 5) public ReceiptGatewayResult SendJobjectDataToGateway2(CommonDevice device, string sendData, string receiptCommand, int receiptDataLength, int waitTime = 5, List<int> listReceiptLength = null) { var reResult = new ReceiptGatewayResult(); var myGateway = device.Gateway; @@ -217,18 +219,29 @@ } var responseData = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ClientDataPassthroughResponseData>(jobject["Data"].ToString()); //长度一致 if (responseData.PassData.Length == receiptDataLength) //长度不一致 if (responseData.PassData.Length != receiptDataLength) { var command = responseData.PassData[4].ToString() + responseData.PassData[5].ToString() + responseData.PassData[2].ToString() + responseData.PassData[3].ToString(); //并且是这个命令 if (command == receiptCommand) if (listReceiptLength == null) { reResult.ReceiptData = responseData.PassData; //如果没有附加检测长度,则直接返回 return; } if (listReceiptLength.Contains(responseData.PassData.Length) == false) { //如果附加的检测长度里面,还不存在的话,直接返回 return; } } var command = responseData.PassData[4].ToString() + responseData.PassData[5].ToString() + responseData.PassData[2].ToString() + responseData.PassData[3].ToString(); //并且是这个命令 if (command == receiptCommand) { reResult.ReceiptData = responseData.PassData; } } }; ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDevicePanelLogic.cs
@@ -618,7 +618,8 @@ var jObject = new JObject { { "DeviceAddr", device.DeviceAddr }, { "Epoint", 200 }, { "Cluster_ID", 64513 }, { "Command", 0 } }; var data = new JObject { { "PassData", passData } }; jObject.Add("Data", data); var result = HdlDeviceCommonLogic.Current.SendJobjectDataToGateway2(device, jObject.ToString(), "0409", 16, 9); //16:旧版本 18:新版本 var result = HdlDeviceCommonLogic.Current.SendJobjectDataToGateway2(device, jObject.ToString(), "0409", 16, 9, new List<int> { 18 }); if (result.ErrorMsg != null) { this.ShowTipMsg(result.ErrorMsg); @@ -645,8 +646,21 @@ { energyInfo.enable = false; } energyInfo.time = Convert.ToInt32(result.ReceiptData[12].ToString() + result.ReceiptData[13].ToString(), 16); energyInfo.level = Convert.ToInt32(result.ReceiptData[14].ToString() + result.ReceiptData[15].ToString(), 16); //新版本:07 0904 11 04 01 3C00 32 if (result.ReceiptData.Length == 18) { energyInfo.time = Convert.ToInt32(result.ReceiptData[14].ToString() + result.ReceiptData[15].ToString() + result.ReceiptData[12].ToString() + result.ReceiptData[13].ToString(), 16); energyInfo.level = Convert.ToInt32(result.ReceiptData[16].ToString() + result.ReceiptData[17].ToString(), 16); } //旧版本:07 0904 11 03 01 3C 32 else { energyInfo.time = Convert.ToInt32(result.ReceiptData[12].ToString() + result.ReceiptData[13].ToString(), 16); energyInfo.level = Convert.ToInt32(result.ReceiptData[14].ToString() + result.ReceiptData[15].ToString(), 16); } return energyInfo; } ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayReceiveLogic.cs
@@ -173,7 +173,7 @@ //设备控制状态反馈 else if (reportTopic == "DeviceDefaultAck") { //this.DeviceControlResponePush(JObject.Parse(msgData)); this.DeviceControlResponePush(JObject.Parse(msgData)); } //撤防 else if (topic == gatewayId + "/Security/WithdrawMode_Respon") ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlRoomLogic.cs
@@ -571,6 +571,8 @@ { //从原来的房间移除设备 this.DeleteDevice(device); //移除我的喜爱 this.DeleteLoveDevice(device); //设备改变房间的话,主页需要重新刷新 UserView.UserPage.Instance.RefreshForm = true; return; ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/UserCenterLogic.cs
@@ -441,6 +441,12 @@ CallFormActionAgainEvent(form, index); } } else if (actionForm != null && actionForm is UserView.UserPage) { //这里它已经退到主页了 var nowForm = UserView.UserPage.Instance.GetNowActionForm(); nowForm?.FormActionAgainEvent(); } } else if (actionForm != null && actionForm is UserView.UserPage) { ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceSearchForm.cs
@@ -15,7 +15,7 @@ /// <summary> /// 新上报的设备 /// </summary> private Dictionary<string, List<CommonDevice>> dicNewDevice = new Dictionary<string, List<CommonDevice>>(); private List<CommonDevice> listNewDevice = new List<CommonDevice>(); /// <summary> /// 显示设备线程是否已经开启 /// </summary> @@ -106,6 +106,7 @@ //进度条 this.btnProgressBar = new ProgressRowBar(559, 29); btnProgressBar.ProgressBarGoback = false; btnProgressBar.Gravity = Gravity.CenterHorizontal; btnProgressBar.Y = Application.GetRealHeight(861); bodyFrameLayout.AddChidren(btnProgressBar); @@ -154,50 +155,42 @@ return; } lock (this.dicNewDevice) var jobject = Newtonsoft.Json.Linq.JObject.Parse(resultData); CommonDevice.DeviceInfoData info = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.DeviceInfoData>(jobject["Data"].ToString()); if (info.DriveCode != 0) { var jobject = Newtonsoft.Json.Linq.JObject.Parse(resultData); CommonDevice.DeviceInfoData info = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.DeviceInfoData>(jobject["Data"].ToString()); if (info.DriveCode != 0) { //不需要虚拟设备 return; } //根据设备Type创建对应的设备对象 var device = Common.LocalDevice.Current.NewDeviceObjectByDeviceId((DeviceType)jobject.Value<int>("Device_ID")); if (device == null) { return; } device.DeviceInfo = info; //给新设备设置主键属性 Common.LocalDevice.Current.SetNewDeviceMainKeys(device, jobject); device.CurrentGateWayId = this.realGateway.GwId; //将DeviceInfo的属性设置到主属性中 Common.LocalDevice.Current.SetDeviceInfoToMain(device, device); //添加设备的缓存 device.IsOnline = 1; Common.LocalDevice.Current.AddDeviceToMemory(ref device); if (this.dicNewDevice.ContainsKey(device.DeviceAddr) == false) { this.dicNewDevice[device.DeviceAddr] = new List<CommonDevice>(); } //刷新超时时间 this.waitDeviceTimeOut = 20; //获取设备的固定属性 HdlDeviceFixedAttributeLogic.Current.SetAllFixedAttributeToDevice(device); //不需要200端点的那个设备 2020.01.13 变更:ota也加进来 this.dicNewDevice[device.DeviceAddr].Add(device); //有新设备,开启显示设备信息界面的线程(里面会等待三秒这样) this.StartShowDeviceAddSuccessFormThread(); //不需要虚拟设备 return; } //根据设备Type创建对应的设备对象 var device = Common.LocalDevice.Current.NewDeviceObjectByDeviceId((DeviceType)jobject.Value<int>("Device_ID")); if (device == null) { return; } device.DeviceInfo = info; //给新设备设置主键属性 Common.LocalDevice.Current.SetNewDeviceMainKeys(device, jobject); device.CurrentGateWayId = this.realGateway.GwId; //将DeviceInfo的属性设置到主属性中 Common.LocalDevice.Current.SetDeviceInfoToMain(device, device); //添加设备的缓存 device.IsOnline = 1; Common.LocalDevice.Current.AddDeviceToMemory(ref device); //刷新超时时间 this.waitDeviceTimeOut = 20; //获取设备的固定属性 HdlDeviceFixedAttributeLogic.Current.SetAllFixedAttributeToDevice(device); //不需要200端点的那个设备 2020.01.13 变更:ota也加进来 this.listNewDevice.Add(device); //有新设备,开启显示设备信息界面的线程(里面会等待三秒这样) this.StartShowDeviceAddSuccessFormThread(); } #endregion @@ -231,22 +224,25 @@ //目前就弄一个 Application.RunOnMainThread(() => { foreach (var listDevice in this.dicNewDevice.Values) var listDevice = new List<CommonDevice>(); for (int i = 0; i < this.listNewDevice.Count; i++) { //重新变更UI foreach (var device in listDevice) var device = this.listNewDevice[i]; if (device.DeviceAddr != this.listNewDevice[0].DeviceAddr) { if (device is OTADevice) { continue; } device.IconPath = string.Empty; device.ReSave(); continue; } //显示设备信息画面 this.ShowDeviceAddSuccessForm(listDevice); break; listDevice.Add(device); //重新变更UI if (device is OTADevice) { continue; } device.IconPath = string.Empty; device.ReSave(); } //显示设备信息画面 this.ShowDeviceAddSuccessForm(listDevice); }); }); } ZigbeeApp/Shared/Phone/UserCenter/HideOption/HideOptionSearchAllFile.cs
@@ -50,7 +50,7 @@ //初始化中部信息 this.InitMiddleFrame(nowDirectory); this.BackButtonClickEvent += (btnContr) => this.BackButtonClickEvent = (btnContr) => { string rootPath = Shared.IO.FileUtils.RootPath.Trim('/'); if (this.nowDirectory.Trim('/') == rootPath) ZigbeeApp/Shared/Phone/UserCenter/Safety/CoercePswAddContactForm.cs
@@ -67,7 +67,7 @@ this.InitMiddleFrame(); //重写底层返回按键事件 this.BackButtonClickEvent += (sender) => this.BackButtonClickEvent = (sender) => { this.AddPhoneEvent = null; this.CloseForm(); ZigbeeApp/Shared/Phone/UserCenter/Safety/CoercePswEditorForm.cs
@@ -154,7 +154,7 @@ this.InitPhoneControl(listView); //重写底层的返回按键事件 this.BackButtonClickEvent += async (sender) => this.BackButtonClickEvent = async (sender) => { sender.CanClick = false; if (rowNote.Text == string.Empty || passwordTip == rowNote.Text) ZigbeeApp/Shared/Phone/UserView/LoginLoading.cs
@@ -32,7 +32,7 @@ btnText.Height = Application.GetRealHeight(70); btnText.Y = btnIcon.Bottom; btnText.TextAlignment = TextAlignment.Center; btnText.Text = "Hdl Home"; btnText.Text = "HDL Home"; btnText.TextColor = UserCenter.UserCenterColor.Current.White; btnText.TextSize = 16; this.AddChidren(btnText); ZigbeeApp/Shared/Phone/ZigBee/Device/Buzzer.cs
New file @@ -0,0 +1,18 @@ using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.Text; namespace ZigBee.Device { /// <summary> /// 蜂鸣器的对象类 /// </summary> public class Buzzer: CommonDevice { public Buzzer() { this.Type = DeviceType.Buzzer; } } } ZigbeeApp/Shared/Phone/ZigBee/Device/ColorTemperatureLight.cs
@@ -84,5 +84,26 @@ jObject.Add("Data", data); Gateway?.Send("DeviceControl", jObject.ToString()); } /// <summary> /// 发送打开获取关闭蜂鸣器的命令(目前先这样吧,小夜灯的蜂鸣器) /// </summary> /// <param name="isOpen"></param> public void SendBuzzerSwitchControl(bool isOpen) { var jObject = new JObject { { "DeviceAddr", DeviceAddr }, { "Epoint", DeviceEpoint }, { "Cluster_ID", 1282 }, { "Command", 0 } }; var data = new JObject { { "WarningMode", isOpen==true?1:0 },//0:关闭报警 1:打开报警 { "Strobe", 0 },//是否启动报警灯 0:不启动 1:启动 { "SirenLevel", 0 },//报警音量 0:Low 1:Medium 2:high 3: very high { "WarningDuration", isOpen==true?10:0 }, //报警时长 0 -65535 单位:秒 { "StrobeDutyCycle", 50 }, //报警等闪烁占空比 0-100 { "StrobeLevel", 1 } //报警灯亮度 0:Low 1:Medium 2:high 3: very high }; jObject.Add("Data", data); //主题可以乱写的 Gateway.Send("SendSwitchCommand", jObject.ToString()); } } } ZigbeeApp/Shared/Phone/ZigBee/Device/CommonDevice.cs
@@ -303,6 +303,10 @@ else if (strDeviceType == ZigBee.Device.DeviceType.ColorTemperatureLight.ToString()) { return Newtonsoft.Json.JsonConvert.DeserializeObject<ColorTemperatureLight>(strDeviceByte); } else if (strDeviceType == ZigBee.Device.DeviceType.Buzzer.ToString()) { return Newtonsoft.Json.JsonConvert.DeserializeObject<Buzzer>(strDeviceByte); } else { return null; } //能少存一个变量就少存一个 ZigbeeApp/Shared/Phone/ZigBee/Device/DeviceType.cs
@@ -32,6 +32,7 @@ /// <summary> /// 设备ID为258的设备 /// <para>色温灯</para> /// <para>定义对象:ColorTemperatureLight</para> /// </summary> ColorTemperatureLight = 258, /// <summary> @@ -56,7 +57,13 @@ /// <para>设备ID为1026的设备</para> /// <para>定义对象:IASZone</para> /// </summary> IASZone = 1026, IASZone = 1026, /// <summary> /// 蜂鸣器 /// <para>设备ID为1027的设备</para> /// <para>定义对象:Buzzer</para> /// </summary> Buzzer = 1027, /// <summary> /// 空气开关 /// </summary> ZigbeeApp/Shared/Phone/ZigBee/Device/ZbGateway.cs
@@ -2449,17 +2449,10 @@ }); } class GateWayBaseInfomation { //public string GatewayUniqueId;//"Emq网关1", <!-- 网关Mac --> public bool MqttOnlineStatus;//: true, <!-- 网关在云端Emq是否在线 --> public string AesKey;// : "a5d8da8a-ddea-48", <!-- 与此网关在云端Emq通信时,负载加解的16位Aes密钥 --> public string MacMark;//: "61eaa0ea-4812-4a7a-86d6-3098c61e64ed" <!-- 网关对应的唯一码 --> } /// <summary> /// 当前有帐号下所有的网关列表及信息 /// </summary> static Dictionary<string, GateWayBaseInfomation> GateWayBaseInfomations = new Dictionary<string, GateWayBaseInfomation> { }; public static Dictionary<string, Shared.Phone.UserCenter.GatewayResult> GateWayBaseInfomations = new Dictionary<string, Shared.Phone.UserCenter.GatewayResult> { }; /// <summary> /// 获取当前帐号所有的网关信息 /// </summary> @@ -2530,7 +2523,7 @@ var list = JArray.Parse(responseData["PageData"].ToString()); foreach (var v in list) { GateWayBaseInfomations[v["GatewayUniqueId"].ToString()] = new GateWayBaseInfomation { AesKey = v["AesKey"].ToString(), MacMark = v["MacMark"].ToString(), MqttOnlineStatus = bool.Parse(v["MqttOnlineStatus"].ToString()) }; GateWayBaseInfomations[v["GatewayUniqueId"].ToString()] = new Shared.Phone.UserCenter.GatewayResult { AesKey = v["AesKey"].ToString(), MacMark = v["MacMark"].ToString(), MqttOnlineStatus = bool.Parse(v["MqttOnlineStatus"].ToString()) }; //if (RemoteMqttClient.IsConnected) { await RemoteMqttClient.SubscribeAsync($"/ZigbeeGateWayToClient/{v["MacMark"].ToString()}/#", MQTTnet.Protocol.MqttQualityOfServiceLevel.ExactlyOnce); ZigbeeApp/Shared/R.cs
@@ -1553,7 +1553,6 @@ /// 当前 亮度 /// </summary> public const int CurrentLightLevel = 13604; @@ -5745,7 +5744,16 @@ /// <summary> /// 忽略 /// </summary> public const int uNeglect = 16131; public const int uNeglect = 16131; /// <summary> /// 蜂鸣器开关 /// </summary> public const int uBuzzerSwitch = 16132; /// <summary> /// 小夜灯开关 /// </summary> public const int uMiniLightSwitch = 16133; ZigbeeApp/Shared/Shared.projitems
@@ -99,6 +99,7 @@ <Compile Include="$(MSBuildThisFileDirectory)Phone\MainPage\ControlForm\DeviceCurtainDetailCardForm.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\MainPage\ControlForm\DeviceFreshAirDetailCardForm.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\MainPage\ControlForm\DeviceColorTemperatureLightDetailCardForm.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\MainPage\ControlForm\DeviceMiniLightDetailCardForm.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\MainPage\ControlForm\DevicePmSensorDetailCardForm.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\MainPage\ControlForm\DeviceRelayDetailCardForm.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\MainPage\Controls\DeviceCard\DeviceColorTemperatureCardControl.cs" /> @@ -429,6 +430,7 @@ <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\UserMain\SecondAuthenticationForm.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\UserView\LoginLoading.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\ZigBee\Device\AC.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\ZigBee\Device\Buzzer.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\ZigBee\Device\ColorTemperatureLight.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\ZigBee\Device\DimmableLight.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\ZigBee\Device\DoorLock.cs" />