| | |
| | | MGCD01/M-ZB.10 = 1306 / 吸顶式燃气传感器 / 吸顶式燃气传感器 / 1200 / 传感器 / 传感器
|
| | | ;PM2.5空气质量传感器
|
| | | MSPM25/M-ZB.10 = 1307 / PM2.5空气质量传感器 / PM2.5空气质量传感器 / 1307 / 空气质量 / 传感器
|
| | | ;温湿度传感器(这个东西好像有两个)
|
| | | MTH01/M-ZB.10 = 1308 / 温湿度传感器 / 温湿度传感器 / 1200 / 传感器 / 传感器
|
| | | MSHIM01/M-ZB.10 = 1308 / 温湿度传感器 / 温湿度传感器 / 1200 / 传感器 / 传感器
|
| | |
|
| | | ;***************************************************************
|
| | | ; 继电器设备
|
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.hdl.home" android:versionCode="0120071701" android:installLocation="auto" android:versionName="1.1.0120071701"> |
| | | <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.hdl.home" android:versionCode="0120072302" android:installLocation="auto" android:versionName="1.1.0120072302"> |
| | | <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" /> |
| | |
| | | <key>aps-environment</key> |
| | | <string>development</string> |
| | | <key>CFBundleShortVersionString</key> |
| | | <string>1.1.012007061</string> |
| | | <string>1.1.012007231</string> |
| | | <key>CFBundleVersion</key> |
| | | <string>202007061</string> |
| | | <string>202007231</string> |
| | | <key>CFBundleURLTypes</key> |
| | | <array> |
| | | <dict> |
| | |
| | | MGCD01/M-ZB.10 = 1306 / 吸顶式燃气传感器 / 吸顶式燃气传感器 / 1200 / 传感器 / 传感器
|
| | | ;PM2.5空气质量传感器
|
| | | MSPM25/M-ZB.10 = 1307 / PM2.5空气质量传感器 / PM2.5空气质量传感器 / 1307 / 空气质量 / 传感器
|
| | | ;温湿度传感器(这个东西好像有两个)
|
| | | MTH01/M-ZB.10 = 1308 / 温湿度传感器 / 温湿度传感器 / 1200 / 传感器 / 传感器
|
| | | MSHIM01/M-ZB.10 = 1308 / 温湿度传感器 / 温湿度传感器 / 1200 / 传感器 / 传感器
|
| | |
|
| | | ;***************************************************************
|
| | | ; 继电器设备
|
old mode 100755
new mode 100644
| | |
| | | /// <summary> |
| | | /// 版本号 |
| | | /// </summary> |
| | | public static string CodeIDString = "1.1.0120072102"; |
| | | public static string CodeIDString = "1.1.012007231"; |
| | | /// <summary> |
| | | /// 注册来源(0:HDL On 1:Zigbee) |
| | | /// </summary> |
| | |
| | | DeviceType = deviceType |
| | | }; |
| | | var requestJson = Newtonsoft.Json.JsonConvert.SerializeObject(RegIDObj); |
| | | var reverObj = CommonPage.Instance.RequestHttpsZigbeeAsync("ZigbeeUsers/SignZigbeeNeedPushRegID", System.Text.Encoding.UTF8.GetBytes(requestJson)); |
| | | var reverObj = CommonPage.Instance.RequestHttpsZigbeeAsync("ZigbeeUsers/SignZigbeeNeedPushRegID", System.Text.Encoding.UTF8.GetBytes(requestJson), 4); |
| | | if (reverObj == null) |
| | | {
|
| | | //调试:记录极光ID
|
| | |
| | | listDriveDevice.Add(device);
|
| | | }
|
| | | }
|
| | | if (listDriveDevice.Count > 0)
|
| | | {
|
| | | //如果虚拟设备还没有名字的话
|
| | | HdlThreadLogic.Current.RunThread(() =>
|
| | | {
|
| | | //如果不这样放在一个线程里,有可能对Dictionary产生影响
|
| | | foreach (var myDevice in listDriveDevice)
|
| | | {
|
| | | //根据设备类型获取名称
|
| | | var dName = this.GetDeviceObjectText(new List<CommonDevice>() { myDevice }, false);
|
| | | //在端点名字的后面附加【回路】字样
|
| | | dName += "(" + myDevice.DeviceEpoint + Language.StringByID(R.MyInternationalizationString.uDeviceCircuit) + ")";
|
| | | this.ReName(myDevice, dName, ShowErrorMode.NO);
|
| | | }
|
| | | });
|
| | | }
|
| | | //设置虚拟设备的默认名字
|
| | | this.SetDriveDeviceDefultName(listDriveDevice);
|
| | |
|
| | | //只有完全获取的时候,才会去处理删除的问题
|
| | | if (statu != 1)
|
| | |
| | | }
|
| | | }
|
| | | return true;
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 设置虚拟设备的默认名字
|
| | | /// </summary>
|
| | | /// <param name="listDriveDevice">虚拟设备列表</param>
|
| | | private void SetDriveDeviceDefultName(List<CommonDevice> listDriveDevice)
|
| | | {
|
| | | if (listDriveDevice.Count == 0)
|
| | | {
|
| | | return;
|
| | | }
|
| | | //如果虚拟设备还没有名字的话
|
| | | HdlThreadLogic.Current.RunThread(() =>
|
| | | {
|
| | | //如果不这样放在一个线程里,有可能对Dictionary产生影响
|
| | | foreach (var myDevice in listDriveDevice)
|
| | | {
|
| | | string dName = string.Empty;
|
| | | if (this.IsMiniLight(myDevice) == true)
|
| | | {
|
| | | //Mini夜灯
|
| | | dName = Language.StringByID(R.MyInternationalizationString.uMiniNightLight);
|
| | | }
|
| | | else
|
| | | {
|
| | | //根据设备类型获取名称
|
| | | dName = this.GetDeviceObjectText(new List<CommonDevice>() { myDevice }, false);
|
| | | //在端点名字的后面附加【回路】字样
|
| | | dName += "(" + myDevice.DeviceEpoint + Language.StringByID(R.MyInternationalizationString.uDeviceCircuit) + ")";
|
| | | }
|
| | | this.ReName(myDevice, dName, ShowErrorMode.NO);
|
| | |
|
| | | System.Threading.Thread.Sleep(100);
|
| | | }
|
| | | });
|
| | | }
|
| | |
|
| | | ///<summary >
|
| | |
| | | //门锁没有定位功能
|
| | | return false;
|
| | | }
|
| | | var myTypeInfo = this.GetMyDeviceEnumInfo(new List<CommonDevice>() { device });
|
| | | if (device.Type == DeviceType.IASZone)
|
| | | {
|
| | | var myTypeInfo = this.GetMyDeviceEnumInfo(new List<CommonDevice>() { device });
|
| | | if (myTypeInfo.ConcreteType == DeviceConcreteType.Sensor_Pir)
|
| | | {
|
| | | //传感器除了Pir都没有定位功能
|
| | |
| | | //球型移动传感器虽然是电池设备,但是它有定位功能
|
| | | return true;
|
| | | }
|
| | | return false;
|
| | | }
|
| | | //温湿度传感器没有定位功能
|
| | | if (myTypeInfo.ConcreteType == DeviceConcreteType.Sensor_TemperatrueHumidity)
|
| | | {
|
| | | return false;
|
| | | }
|
| | |
|
| | |
| | | info.ObjectTypeName = this.dicDeviceModelIdEnum["A418"].A类型名字;//调光模块
|
| | | }
|
| | | else if (info.BeloneType == DeviceBeloneType.A传感器
|
| | | || device.Type == DeviceType.TemperatureSensor)
|
| | | || device.Type == DeviceType.TemperatureSensor
|
| | | || device.Type == DeviceType.FreshAirHumiditySensor)
|
| | | {
|
| | | //传感器合并
|
| | | info.ConcreteType = DeviceConcreteType.Sensor;
|
| | |
| | | //设置传感器具体的类型
|
| | | info.BeloneType = DeviceBeloneType.A温湿度传感器;
|
| | | info.ConcreteText = this.dicDeviceModelIdEnum["A411"].A官方名字;
|
| | | info.ConcreteType = DeviceConcreteType.Sensor_TemperatureHumidity;
|
| | | info.ConcreteType = DeviceConcreteType.Sensor_TemperatrueHumidity;
|
| | | }
|
| | | else if (temperatrue == true && humidity == false)
|
| | | {
|
| | | //设置传感器具体的类型
|
| | | info.BeloneType = DeviceBeloneType.A温度传感器;
|
| | | info.ConcreteText = this.dicDeviceModelIdEnum["A412"].A官方名字;
|
| | | info.ConcreteType = DeviceConcreteType.Sensor_Temperature;
|
| | | info.ConcreteType = DeviceConcreteType.Sensor_Temperatrue;
|
| | | }
|
| | | else if (temperatrue == false && humidity == true)
|
| | | {
|
| | |
| | | listCheck.Add(mainkeys);
|
| | | //刷新一下本地缓存
|
| | | var localDevice = this.GetDevice(mainkeys);
|
| | | if (localDevice != null)
|
| | | var tempDevice = localDevice == null ? device : localDevice;
|
| | |
|
| | | //刷新属性
|
| | | this.SetDeviceInfoToMain(tempDevice, device);
|
| | | if (this.RefreshDeviceFunctionType(tempDevice, device, false) == true)
|
| | | {
|
| | | //刷新属性
|
| | | this.SetDeviceInfoToMain(localDevice, device);
|
| | | if (this.RefreshDeviceFunctionType(localDevice, device, false) == true)
|
| | | {
|
| | | //需要发送功能类型给网关
|
| | | listFucDevice.Add(localDevice);
|
| | | }
|
| | | //需要发送功能类型给网关
|
| | | listFucDevice.Add(tempDevice);
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | /// PM2.5空气质量传感器
|
| | | /// </summary>
|
| | | Sensor_PMTwoPointFive = 1307,
|
| | | /// <summary>
|
| | | /// 温湿度传感器
|
| | | /// </summary>
|
| | | Sensor_TemperatrueHumidity = 1308,
|
| | |
|
| | | /// <summary>
|
| | | /// 运动传感器
|
| | |
| | | /// </summary>
|
| | | Sensor_Keyfob = -1307,
|
| | | /// <summary>
|
| | | /// 温湿度传感器
|
| | | /// </summary>
|
| | | Sensor_TemperatureHumidity = -1308,
|
| | | /// <summary>
|
| | | /// 温度传感器
|
| | | /// </summary>
|
| | | Sensor_Temperature = -1309,
|
| | | Sensor_Temperatrue = -1309,
|
| | | /// <summary>
|
| | | /// 湿度传感器
|
| | | /// </summary>
|
| | |
| | | var result = await HdlSceneLogic.Current.EditorSceneNameFromGateway(this.editorScene, this.cloneScene.Name);
|
| | | if (result == false)
|
| | | {
|
| | | //关闭进度条
|
| | | this.CloseProgressBar();
|
| | | return;
|
| | | }
|
| | | }
|
| | |
| | | {
|
| | | //修改场景
|
| | | var result = await HdlSceneLogic.Current.EditorSceneFromGateway(this.editorScene, this.listAdjustTarget);
|
| | | //关闭进度条
|
| | | this.CloseProgressBar();
|
| | | if (result == false)
|
| | | {
|
| | | //关闭进度条
|
| | | this.CloseProgressBar();
|
| | | return;
|
| | | }
|
| | | }
|
| | |
| | | //编辑场景,主页需要重新刷新
|
| | | UserView.UserPage.Instance.RefreshAllForm = true;
|
| | |
|
| | | //关闭进度条
|
| | | this.CloseProgressBar();
|
| | |
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | //调用回调函数
|
| | |
| | | //打开
|
| | | this.SetDeviceStatuText(Language.StringByID(R.MyInternationalizationString.uOpen1));
|
| | | i_device.SwitchControl(1);
|
| | | HdlThreadLogic.Current.RunThread(() =>
|
| | | {
|
| | | //获取灯光亮度
|
| | | System.Threading.Thread.Sleep(300);
|
| | | HdlDeviceAttributeLogic.Current.SendLevelStatuComand(i_device);
|
| | | });
|
| | | }
|
| | | else
|
| | | {
|
| | |
| | | //打开
|
| | | this.SetDeviceStatuText(Language.StringByID(R.MyInternationalizationString.uOpen1));
|
| | | i_device.SwitchControl(1);
|
| | | HdlThreadLogic.Current.RunThread(() =>
|
| | | {
|
| | | //获取灯光亮度
|
| | | System.Threading.Thread.Sleep(300);
|
| | | HdlDeviceAttributeLogic.Current.SendLevelStatuComand(i_device);
|
| | | });
|
| | | }
|
| | | else
|
| | | {
|
| | |
| | | HomePage.Instance.ShowLoginLoadView();
|
| | | });
|
| | | var resultRegID = Shared.Common.CommonPage.Instance.PushRegID();
|
| | | var homes = HdlResidenceLogic.Current.GetHomeListsFromDb();
|
| | | var homes = HdlResidenceLogic.Current.GetHomeListsFromDb(false);
|
| | | //刷新个人中心的内存及线程
|
| | | UserCenterLogic.InitUserCenterMenmoryAndThread();
|
| | | //启动ZigBee
|
| | |
| | | Config.Instance.Save();
|
| | |
|
| | | var resultRegID = CommonPage.Instance.PushRegID();
|
| | | var homes = HdlResidenceLogic.Current.GetHomeListsFromDb();
|
| | | var homes = HdlResidenceLogic.Current.GetHomeListsFromDb(false);
|
| | | //刷新个人中心的内存及线程
|
| | | UserCenterLogic.InitUserCenterMenmoryAndThread();
|
| | | //启动ZigBee
|
| | |
| | | //绑定第三方
|
| | | BindAuthUser(Config.Instance.Guid, OpenID);
|
| | | }
|
| | | var homes = HdlResidenceLogic.Current.GetHomeListsFromDb();
|
| | | var homes = HdlResidenceLogic.Current.GetHomeListsFromDb(false);
|
| | |
|
| | | //刷新个人中心的内存及线程
|
| | | UserCenterLogic.InitUserCenterMenmoryAndThread();
|
| | |
| | | seekBarColor.SeekBarPadding = Application.GetRealWidth(60);
|
| | | seekBarColor.IsProgressTextShow = true;
|
| | | seekBarColor.ProgressBarColor = UserCenterColor.Current.Transparent;
|
| | | seekBarColor.ProgressBarUnEnableColor = UserCenterColor.Current.Transparent;
|
| | | seekBarColor.SeekBarBackgroundColor = UserCenterColor.Current.Transparent;
|
| | | seekBarColor.ProgressTextSize = 14;
|
| | | seekBarColor.ProgressTextColor = UserCenterColor.Current.TextGrayColor2;
|
| | |
| | | this.btnBuzzerSwitch = new IconBigViewControl(81, 81);
|
| | | btnBuzzerSwitch.UnSelectedImagePath = "Item/Switch.png";
|
| | | btnBuzzerSwitch.SelectedImagePath = "Item/SwitchSelected.png";
|
| | | btnBuzzerSwitch.IsSelected = ((ColorTemperatureLight)this.device).IsBuzzerRing;
|
| | | frameWhiteBack.AddChidren(btnBuzzerSwitch);
|
| | | btnBuzzerSwitch.InitControl();
|
| | | btnBuzzerSwitch.UseClickStatu = false;
|
| | |
| | | };
|
| | | btnMiniSwitch.IsSelected = ((LightBase)this.device).OnOffStatus == 1;
|
| | | this.canSetProgressValue = btnMiniSwitch.IsSelected;
|
| | | if (btnMiniSwitch.IsSelected == false)
|
| | | {
|
| | | //在没有打开夜灯开关之前,不允许滑动
|
| | | seekBarLight.Enable = false;
|
| | | seekBarColor.Enable = false;
|
| | | }
|
| | |
|
| | | //亮度开始滑动的事件
|
| | | seekBarLight.OnStartTrackingTouchEvent += (sender, e) =>
|
| | |
| | | {
|
| | | //当是打开状态时,网关说它会默认把亮度变成100%
|
| | | //以防万一,这里再次读取一下
|
| | | ((ColorTemperatureLight)device).ReadLevel();
|
| | | HdlThreadLogic.Current.RunThread(() =>
|
| | | {
|
| | | ((ColorTemperatureLight)device).ReadLevel();
|
| | | System.Threading.Thread.Sleep(300);
|
| | | ((ColorTemperatureLight)device).ReadColorTemperature();
|
| | | });
|
| | |
|
| | | }
|
| | | }
|
| | | });
|
| | |
| | | //如果住宅是虚拟住宅
|
| | | if (Common.Config.Instance.Home.IsVirtually == true)
|
| | | {
|
| | | //((LightBase)this.device).OnOffStatus = isOpen == true ? 1 : 0;
|
| | | ////刷新开关状态
|
| | | //this.RefreshSwitchStatu(isOpen);
|
| | | ((ColorTemperatureLight)this.device).IsBuzzerRing = isOpen;
|
| | | //刷新开关状态
|
| | | this.RefreshSwitchStatu(isOpen);
|
| | | return;
|
| | | }
|
| | |
|
| | | //检测是否获取网关反馈的结果,如果网关没有回复,则会弹出消息
|
| | | this.StartCheckResponeResult(new List<ButtonBase> { this.btnBuzzerSwitch.btnIcon }, (result) =>
|
| | | this.btnBuzzerSwitch.CanClick = false;
|
| | | this.StartCheckResponeResult(new List<ButtonBase>(), (result) =>
|
| | | {
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | //接收到网关回复
|
| | | if (result == true)
|
| | | {
|
| | | this.btnBuzzerSwitch.IsSelected = isOpen;
|
| | | //bool statu = ((LightBase)this.device).OnOffStatus == 1;
|
| | | ////刷新开关状态
|
| | | //this.RefreshSwitchStatu(statu);
|
| | | }
|
| | | this.btnBuzzerSwitch.CanClick = true;
|
| | | });
|
| | | });
|
| | | //发送命令
|
| | |
| | | /// <param name="isOpen">打开状态</param>
|
| | | private void RefreshSwitchStatu(bool isOpen)
|
| | | {
|
| | | if (this.isColorProgressing == true)
|
| | | //刷新蜂鸣器开关状态
|
| | | bool isBuzzerRing = ((ColorTemperatureLight)this.device).IsBuzzerRing;
|
| | | if (this.btnBuzzerSwitch.IsSelected != isBuzzerRing)
|
| | | {
|
| | | //如果是色温滑动的话,不需要刷新界面
|
| | | return;
|
| | | this.btnBuzzerSwitch.IsSelected = isBuzzerRing;
|
| | | }
|
| | |
|
| | | if (isOpen == true)
|
| | | {
|
| | | //亮度是必须要刷新的 亮度 XX
|
| | |
| | | //当进度值在手动变更中时,不接收推送
|
| | | seekBarColor.Progress = (int)(((ColorTemperatureLight)this.device).ColorTemperature / 100);
|
| | | }
|
| | | this.btnMiniSwitch.IsSelected = true;
|
| | | if (this.btnMiniSwitch.IsSelected == false)
|
| | | {
|
| | | this.btnMiniSwitch.IsSelected = true;
|
| | | }
|
| | | //滑动条可以滑动
|
| | | seekBarLight.Enable = true;
|
| | | seekBarColor.Enable = true;
|
| | | }
|
| | | else
|
| | | {
|
| | | //变更字样:关闭
|
| | | this.SetStatuText(Language.StringByID(R.MyInternationalizationString.Close));
|
| | | this.btnMiniSwitch.IsSelected = false;
|
| | | if (this.btnMiniSwitch.IsSelected == true)
|
| | | {
|
| | | this.btnMiniSwitch.IsSelected = false;
|
| | | }
|
| | | //滑动条不可以滑动
|
| | | seekBarLight.Enable = false;
|
| | | seekBarColor.Enable = false;
|
| | | }
|
| | |
|
| | | //回复的结果说,处于打开状态才能发送
|
| | |
| | | //打开
|
| | | this.SetDeviceStatuText(Language.StringByID(R.MyInternationalizationString.uOpen1));
|
| | | i_device.SwitchControl(1);
|
| | | HdlThreadLogic.Current.RunThread(() =>
|
| | | {
|
| | | //获取灯光亮度
|
| | | System.Threading.Thread.Sleep(300);
|
| | | HdlDeviceAttributeLogic.Current.SendLevelStatuComand(i_device);
|
| | | });
|
| | | }
|
| | | else
|
| | | {
|
| | |
| | | //打开
|
| | | this.SetDeviceStatuText(Language.StringByID(R.MyInternationalizationString.uOpen1));
|
| | | i_device.SwitchControl(1);
|
| | | HdlThreadLogic.Current.RunThread(() =>
|
| | | {
|
| | | //获取灯光亮度
|
| | | System.Threading.Thread.Sleep(300);
|
| | | HdlDeviceAttributeLogic.Current.SendLevelStatuComand(i_device);
|
| | | });
|
| | | }
|
| | | else
|
| | | {
|
| | |
| | | bodyFrameLayout.RemoveAll();
|
| | | bodyFrameLayout.Height = Application.GetRealHeight(750);
|
| | | this.listBodyContr.RecoverTableHeight();
|
| | | this.dicSceneCardControl.Clear();
|
| | | this.dicDeviceCardControl.Clear();
|
| | | this.dicSceneCardControl = new Dictionary<int, Controls.SceneCardControl>();
|
| | | this.dicDeviceCardControl = new Dictionary<string, Controls.DeviceCardCommon>();
|
| | |
|
| | | var listDevice = new List<CommonDevice>();
|
| | | foreach (var mainkeys in HdlRoomLogic.Current.NowMainPageRoom.ListDevice)
|
| | |
| | | bodyFrameLayout.RemoveAll();
|
| | | bodyFrameLayout.Height = Application.GetRealHeight(750);
|
| | | this.listBodyContr.RecoverTableHeight();
|
| | | this.dicSceneCardControl.Clear();
|
| | | this.dicDeviceCardControl.Clear();
|
| | | this.dicSceneCardControl = new Dictionary<int, Controls.SceneCardControl>();
|
| | | this.dicDeviceCardControl = new Dictionary<string, Controls.DeviceCardCommon>();
|
| | |
|
| | | var listScene = new List<SceneUI>();
|
| | | foreach (int sceneId in HdlRoomLogic.Current.NowMainPageRoom.ListSceneId)
|
| | |
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 传感器状态还原_____________________
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 切换楼层___________________________
|
| | |
|
| | | /// <summary>
|
| | |
| | | {
|
| | | #region ■ 变量声明___________________________
|
| | |
|
| | | private uint nowProgressBarColor = 0;
|
| | | /// <summary>
|
| | | /// 进度条可用时的背景色
|
| | | /// </summary>
|
| | | private uint ProgressBarEnableColor = 0;
|
| | | /// <summary>
|
| | | /// 进度条不可用时的背景色(默认灰色)
|
| | | /// </summary>
|
| | | public uint ProgressBarUnEnableColor = 0xffe8e8e8;
|
| | | /// <summary>
|
| | | /// 当前可用状态
|
| | | /// </summary>
|
| | | private bool nowEnable = true;
|
| | | /// <summary>
|
| | | /// 控件能否使用
|
| | | /// </summary>
|
| | |
| | | {
|
| | | set
|
| | | {
|
| | | //状态没有改变
|
| | | if (nowEnable == value) { return; }
|
| | | nowEnable = value;
|
| | |
|
| | | this.IsClickable = value;
|
| | | if (value == true)
|
| | | {
|
| | | //原来的颜色
|
| | | base.ProgressBarColor = nowProgressBarColor;
|
| | | base.ProgressBarColor = ProgressBarEnableColor;
|
| | | }
|
| | | else
|
| | | {
|
| | | //灰色
|
| | | base.ProgressBarColor = 0xffe8e8e8;
|
| | | base.ProgressBarColor = ProgressBarUnEnableColor;
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | {
|
| | | set
|
| | | {
|
| | | nowProgressBarColor = value;
|
| | | ProgressBarEnableColor = value;
|
| | | base.ProgressBarColor = value;
|
| | | }
|
| | | }
|
| | |
| | | var pra = new MessageInfoPra();
|
| | | pra.LoginAccessToken = UserCenterLogic.GetConnectMainToken();
|
| | |
|
| | | var result = UserCenterLogic.GetResponseDataByRequestHttps("MessageCenter/GetMessageCenterPagger", false, pra, new List<string>() { "NotCheck" });
|
| | | var result = UserCenterLogic.GetResponseDataByRequestHttps("MessageCenter/GetMessageCenterPagger", false, pra, new List<string>() { "NotCheck" }, false);
|
| | | if (string.IsNullOrEmpty(result) == true)
|
| | | {
|
| | | //出错,需要重新读取
|
| | |
| | | /// 发送获取灯光状态命令
|
| | | /// </summary>
|
| | | /// <param name="device">窗帘</param>
|
| | | private void SendLevelStatuComand(CommonDevice device)
|
| | | public void SendLevelStatuComand(CommonDevice device)
|
| | | {
|
| | | if (device == null) |
| | | { |
| | |
| | | colorDevice.ReadLevel();
|
| | | System.Threading.Thread.Sleep(300);
|
| | | colorDevice.ReadColorTemperature(); |
| | | if (LocalDevice.Current.IsMiniLight(device) == true)
|
| | | {
|
| | | //mini夜灯需要读取蜂鸣器状态
|
| | | System.Threading.Thread.Sleep(300);
|
| | | colorDevice.ReadBuzzerStatu();
|
| | | } |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | } |
| | |
| | | private static int GetFirmwareVersionAndSetToMemmory(FirmwareLevelType levelType, GetFirmwareVersionPra pra)
|
| | | {
|
| | | var listCheck = new List<string> { "NotCheck" };
|
| | | string resultValue = UserCenterLogic.GetResponseDataByRequestHttps("FirmwareMana/DetectionPlatformUploadFirmware", false, pra, listCheck);
|
| | | string resultValue = UserCenterLogic.GetResponseDataByRequestHttps("FirmwareMana/DetectionPlatformUploadFirmware", false, pra, listCheck, false);
|
| | | if (string.IsNullOrEmpty(resultValue) == true)
|
| | | {
|
| | | return -1;
|
| | |
| | | /// </summary> |
| | | /// <param name="zbGateway">网关</param> |
| | | /// <param name="mode">是否显示错误</param> |
| | | public async Task<bool> AddNewGateway(ZbGateway zbGateway, ShowErrorMode mode) |
| | | public bool AddNewGateway(ZbGateway zbGateway, ShowErrorMode mode) |
| | | {
|
| | | //设置网关的经纬度
|
| | | bool falge = this.SetGatewaySite(zbGateway, Common.Config.Instance.Home.Longitude, Common.Config.Instance.Home.Latitude, ShowErrorMode.NO); |
| | |
| | | return falge;
|
| | | } |
| | | //执行添加网关到内存 |
| | | var result = await this.DoAddGatewayToMemory(zbGateway, mode); |
| | | var result = this.DoAddGatewayToMemory(zbGateway, mode); |
| | | //前的网关绑定在了当前账号下的不同住宅里面
|
| | | if (result == 0)
|
| | | {
|
| | |
| | | /// <param name="zbGateway">网关对象</param>
|
| | | /// <param name="mode">是否显示错误</param>
|
| | | /// <returns></returns>
|
| | | private async Task<int> DoAddGatewayToMemory(ZbGateway zbGateway, ShowErrorMode mode)
|
| | | private int DoAddGatewayToMemory(ZbGateway zbGateway, ShowErrorMode mode)
|
| | | {
|
| | | if (zbGateway == null)
|
| | | {
|
| | |
| | | //设置住宅ID到网关
|
| | | if (result.HomeId != Common.Config.Instance.HomeId)
|
| | | {
|
| | | bool flage2 = await this.SetHomeIdToGateway(zbGateway, Common.Config.Instance.HomeId, mode);
|
| | | bool flage2 = this.SetHomeIdToGateway(zbGateway, Common.Config.Instance.HomeId, mode);
|
| | | if (flage2 == false)
|
| | | {
|
| | | if (mode == ShowErrorMode.YES)
|
| | |
| | | /// <param name="zbGateway"></param>
|
| | | /// <param name="HomeId"></param>
|
| | | /// <returns></returns> |
| | | public async Task<bool> SetHomeIdToGateway(ZbGateway zbGateway, string HomeId, ShowErrorMode mode)
|
| | | public bool SetHomeIdToGateway(ZbGateway zbGateway, string HomeId, ShowErrorMode mode)
|
| | | {
|
| | | ZbGateway realWay = null;
|
| | | if (this.GetRealGateway(ref realWay, zbGateway) == false)
|
| | | //账号ID
|
| | | string accountId = string.Empty;
|
| | | if (HomeId != string.Empty)
|
| | | {
|
| | | if (UserCenterResourse.UserInfo.AuthorityNo == 1)
|
| | | {
|
| | | //主账号
|
| | | accountId = Config.Instance.Guid;
|
| | | }
|
| | | else
|
| | | {
|
| | | accountId = Config.Instance.Home.MainUserDistributedMark;
|
| | | }
|
| | | }
|
| | | var jObject = new Newtonsoft.Json.Linq.JObject { { "Cluster_ID", 0 }, { "Command", 82 } };
|
| | | var data = new Newtonsoft.Json.Linq.JObject { { "HomeId", HomeId }, { "AccountId", accountId } };
|
| | | jObject.Add("Data", data);
|
| | | //住宅ID的设置,固定使用局域网,不存在远程的说法
|
| | | var result = this.SendJobjectDataToGateway(zbGateway, "GwSetHomeId", jObject.ToString(), "GwSetHomeId_Respon", 5, true);
|
| | | if (result.ErrorMsgDiv == -1)
|
| | | {
|
| | | if (mode == ShowErrorMode.YES)
|
| | | {
|
| | |
| | | }
|
| | | return false;
|
| | | }
|
| | |
|
| | | var info = await realWay.GwSetHomeIdAsync(HomeId);
|
| | | if (info != null && info.gwSetHomeIdData != null)
|
| | | if (result.ErrorMsgDiv == 0)
|
| | | {
|
| | | return true;
|
| | | return false;
|
| | | }
|
| | | return false;
|
| | | return true;
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | |
| | | //获取控制主人账号的Token
|
| | | bindGateway.LoginAccessToken = UserCenterLogic.GetConnectMainToken(); |
| | | |
| | | var result = UserCenterLogic.GetResultCodeByRequestHttps("App/BindGatewayToHome", true, bindGateway, new List<string> { "NotCheck" }); |
| | | var result = UserCenterLogic.GetResultCodeByRequestHttps("App/BindGatewayToHome", true, bindGateway, new List<string> { "NotCheck" }, false); |
| | | if (result == "Error")
|
| | | {
|
| | | return -1;
|
| | |
| | | /// </summary> |
| | | /// <param name="zbGateway">网关</param> |
| | | /// <param name="btnMsg">消息控件</param> |
| | | public async Task<int> ReBindNewGateway(ZbGateway zbGateway, NormalViewControl btnMsg = null) |
| | | public int ReBindNewGateway(ZbGateway zbGateway, NormalViewControl btnMsg = null) |
| | | {
|
| | | if (zbGateway == null)
|
| | | {
|
| | |
| | | }
|
| | |
|
| | | //设置住宅ID到网关
|
| | | bool flage2 = await this.SetHomeIdToGateway(zbGateway, Common.Config.Instance.HomeId, ShowErrorMode.YES);
|
| | | bool flage2 = this.SetHomeIdToGateway(zbGateway, Common.Config.Instance.HomeId, ShowErrorMode.YES);
|
| | | if (flage2 == false)
|
| | | {
|
| | | //向网关设置住宅ID失败
|
| | |
| | | btnMsg.TextID = R.MyInternationalizationString.uGatewayDataIsChangingPleaseWhait;
|
| | | });
|
| | | }
|
| | | await Task.Delay(8000);
|
| | | System.Threading.Thread.Sleep(8000);
|
| | |
|
| | | //获取网关的信息
|
| | | ZbGatewayData.GetGwData result = null;
|
| | |
| | | }
|
| | | count--;
|
| | | //最多再等20秒
|
| | | await Task.Delay(4000);
|
| | | System.Threading.Thread.Sleep(4000);
|
| | | }
|
| | | if (result == null)
|
| | | {
|
| | |
| | | /// 执行切换网关操作
|
| | | /// </summary>
|
| | | /// <param name="gatewayId"></param>
|
| | | public async Task<bool> DoSwitchGateway(string gatewayId)
|
| | | public bool DoSwitchGateway(string gatewayId)
|
| | | {
|
| | | var zbGateway = this.GetLocalGateway(gatewayId);
|
| | |
|
| | | //重新获取在线网关的信息
|
| | | var result = await this.GetOnlineGatewayInfo(gatewayId);
|
| | | var result = this.GetOnlineGatewayInfo(gatewayId);
|
| | | if (result == false)
|
| | | {
|
| | | return false;
|
| | |
| | | /// </summary>
|
| | | /// <param name="gatewayId"></param>
|
| | | /// <returns></returns>
|
| | | private async Task<bool> GetOnlineGatewayInfo(string gatewayId)
|
| | | private bool GetOnlineGatewayInfo(string gatewayId)
|
| | | {
|
| | | //显示进度条
|
| | | ProgressBar.Show();
|
| | |
| | | //重新设置住宅ID(这个应该是不经过APP,直接把网关恢复了出厂设置)
|
| | | if (this.HomeIdIsEmpty(realWay.HomeId) == true)
|
| | | {
|
| | | int result2 = await this.ReBindNewGateway(realWay);
|
| | | int result2 = this.ReBindNewGateway(realWay);
|
| | | if (result2 == 0)
|
| | | {
|
| | | //出现未知错误,请稍后再试
|
| | |
| | | /// <summary> |
| | | /// 删除网关,包括云端和本地(失败时不会显示信息,并且会返回true) |
| | | /// </summary> |
| | | /// <param name="zbGateway"></param> |
| | | public async Task<bool> DeleteGateway(ZbGateway zbGateway) |
| | | { |
| | | //移除本地网关信息 |
| | | return await this.DeleteGateway(zbGateway.GwId); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 删除网关,包括云端和本地(失败时不会显示信息,并且会返回true) |
| | | /// </summary> |
| | | /// <param name="zbGatewayID"></param> |
| | | public async Task<bool> DeleteGateway(string zbGatewayID) |
| | | public bool DeleteGateway(string zbGatewayID) |
| | | {
|
| | | ZbGateway realWay = null;
|
| | | this.GetRealGateway(ref realWay, zbGatewayID);
|
| | | //清空网关的住宅ID 网关解绑失败 不理它,因为网关可以按按键强制搜索得到
|
| | | if (realWay != null)
|
| | | {
|
| | | await this.SetHomeIdToGateway(realWay, string.Empty, ShowErrorMode.NO);
|
| | | this.SetHomeIdToGateway(realWay, string.Empty, ShowErrorMode.NO);
|
| | | }
|
| | |
|
| | | //删除云端的网关
|
| | |
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 清空真实网关列表___________________
|
| | | #region ■ 清空真实网关链接___________________
|
| | |
|
| | | /// <summary>
|
| | | /// 清空全部的真实物理网关对象
|
| | | /// 清空全部的真实物理网关的链接
|
| | | /// </summary>
|
| | | public void ClearAllRealGateway()
|
| | | /// <param name="roadGateway">是否加载本地的网关对象到真实列表中</param>
|
| | | public void ClearAllRealGatewayConection(bool roadGateway)
|
| | | {
|
| | | //因为那一瞬间,有可能mqtt会加回来,所以先加缓存
|
| | | var list = new List<ZbGateway>();
|
| | | list.AddRange(ZbGateway.GateWayList);
|
| | | //然后清空掉
|
| | | ZbGateway.GateWayList.Clear();
|
| | | //最后再断开mqtt连接
|
| | | for (int i = 0; i < list.Count; i++)
|
| | | //断开mqtt连接(即使保存在内存当中也没问题,因为如果广播不到,则它不会建立链接)
|
| | | for (int i = 0; i < ZbGateway.GateWayList.Count; i++)
|
| | | {
|
| | | list[i].DisConnectLocalMqttClient("G");
|
| | | ZbGateway.GateWayList[i].DisConnectLocalMqttClient("G");
|
| | | }
|
| | | list.Clear();
|
| | | //加载本地网关对象
|
| | | if (roadGateway == true)
|
| | | {
|
| | | List<string> listFile = this.GetAllGatewayFile();
|
| | | //反序列化添加到缓存
|
| | | foreach (string file in listFile)
|
| | | {
|
| | | //从文件中反序列化出网关对象
|
| | | var gateway = this.GetGatewayFromFile(file);
|
| | | if (gateway == null)
|
| | | {
|
| | | continue;
|
| | | }
|
| | | var tempWay = ZbGateway.GateWayList.Find(obj => (obj != null) && (obj.GwId == gateway.GwId)); |
| | | if (tempWay == null) |
| | | { |
| | | ZbGateway.GateWayList.Add(tempWay); |
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
| | | /// <returns></returns>
|
| | | public int IsMainGateway(string waiID)
|
| | | {
|
| | | ZbGateway zbGateway = null;
|
| | | if (this.GetRealGateway(ref zbGateway, waiID) == false)
|
| | | var realWay = ZbGateway.GateWayList.Find((obj) =>
|
| | | {
|
| | | return obj.GwId == waiID;
|
| | | });
|
| | | //虚拟网关也返回 0
|
| | | if (realWay == null || realWay.IsVirtual == true)
|
| | | {
|
| | | return 0;
|
| | | }
|
| | | return zbGateway.IsMainGateWay == true ? 1 : 2;
|
| | | return realWay.IsMainGateWay == true ? 1 : 2;
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
| | | //获取控制主人账号的Token
|
| | | pra.ReqDto.LoginAccessToken = UserCenterLogic.GetConnectMainToken();
|
| | |
|
| | | var result = UserCenterLogic.GetResponseDataByRequestHttps("App/GetSingleHomeGatewayPagger", true, pra, list);
|
| | | var result = UserCenterLogic.GetResponseDataByRequestHttps("App/GetSingleHomeGatewayPagger", true, pra, list, false);
|
| | | if (string.IsNullOrEmpty(result) == true)
|
| | | {
|
| | | canBreak = true;
|
| | |
| | |
|
| | | List<string> listNotShowError = new List<string>() { "NoExist", "NoBind", "NoRecord", "NotCheck" };
|
| | |
|
| | | bool result = UserCenterLogic.GetResultStatuByRequestHttps("App/ReleaseGatewayToHome", true, Pra, listNotShowError);
|
| | | bool result = UserCenterLogic.GetResultStatuByRequestHttps("App/ReleaseGatewayToHome", true, Pra, listNotShowError, false);
|
| | | if (result == false)
|
| | | {
|
| | | return false;
|
| | |
| | | {
|
| | | bindGateway.BindGateways.Clear();
|
| | | bindGateway.BindGateways.Add(gwId);
|
| | | var result = UserCenterLogic.GetResultCodeByRequestHttps("App/BindGatewayToHome", true, bindGateway, new List<string> { "NotCheck" });
|
| | | var result = UserCenterLogic.GetResultCodeByRequestHttps("App/BindGatewayToHome", true, bindGateway, new List<string> { "NotCheck" }, false);
|
| | | if (result == "Success")
|
| | | {
|
| | | this.listBackupGwId.Remove(gwId);
|
| | |
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 蜂鸣器推送
|
| | | //蜂鸣器数据
|
| | | else if (report.DeviceStatusReport.CluterID == 1282)
|
| | | {
|
| | | //mini夜灯
|
| | | if (Common.LocalDevice.Current.IsMiniLight(locadevice) == true)
|
| | | {
|
| | | foreach (var attData in report.DeviceStatusReport.AttriBute)
|
| | | {
|
| | | if (attData.AttributeId == 0)
|
| | | {
|
| | | ((ColorTemperatureLight)locadevice).IsBuzzerRing = attData.AttriButeData == 1 ? true : false;
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | #endregion
|
| | |
|
| | | #region ■ 窗帘数据
|
| | | //窗帘数据
|
| | | else if (report.DeviceStatusReport.CluterID == 258)
|
| | |
| | | /// <summary>
|
| | | /// 获取云端住宅列表
|
| | | /// </summary>
|
| | | public List<string> GetHomeListsFromDb()
|
| | | /// <param name="checkNetwork">是否检测网络,如果设置检测的话,当不能联网时,直接返回本地住宅</param>
|
| | | /// <returns></returns>
|
| | | public List<string> GetHomeListsFromDb(bool checkNetwork)
|
| | | {
|
| | | if (HdlWifiLogic.Current.CanAccessHttp == false)
|
| | | if (checkNetwork == true && HdlWifiLogic.Current.CanAccessHttp == false)
|
| | | {
|
| | | //当前无法联网
|
| | | return Config.Instance.HomeFilePathList;
|
| | |
| | | {
|
| | | return false;
|
| | | }
|
| | |
|
| | | if (zoneId > 3)
|
| | | {
|
| | | zoneId = 3;
|
| | | }
|
| | | //状态变更
|
| | | var result = await Safeguard.DisablePushMessageAsync(zoneId, statu);
|
| | | if (result == null || result.disablePushMessageResponseData == null || result.disablePushMessageResponseData.Result == 1)
|
| | |
| | | }
|
| | | //重新初始化Socket
|
| | | ZigBee.Common.Application.FindGateWaySocket.Stop();
|
| | | System.Threading.Thread.Sleep(100);
|
| | |
|
| | | //断掉本地连接
|
| | | HdlGatewayLogic.Current.ClearAllRealGateway();
|
| | | HdlGatewayLogic.Current.ClearAllRealGatewayConection(true);
|
| | | //断掉远程
|
| | | ZigBee.Device.ZbGateway.DisConnectRemoteMqttClient();
|
| | |
|
| | | //如果是wifi
|
| | | if (value == 2)
|
| | | {
|
| | | ZigBee.Common.Application.FindGateWaySocket.Start();
|
| | |
| | | /// <param name="checkAuthority">是否检测权限,该参数不能省略</param>
|
| | | /// <param name="obj">一个类</param>
|
| | | /// <param name="listNotShowError">不需要显示错误的错误类别(接口返回的错误类别),如果包含,则会返回【true】</param>
|
| | | /// <param name="setAgain">当发送失败时,是否重发,默认不重发</param>
|
| | | public static bool GetResultStatuByRequestHttps(string RequestName, bool checkAuthority, object obj, List<string> listNotShowError = null, bool setAgain = false)
|
| | | /// <param name="setAgain">当发送失败时,是否重发,默认重发</param>
|
| | | public static bool GetResultStatuByRequestHttps(string RequestName, bool checkAuthority, object obj, List<string> listNotShowError = null, bool setAgain = true)
|
| | | {
|
| | | if (HdlWifiLogic.Current.CanAccessHttp == false && setAgain == false)
|
| | | {
|
| | | //当前无法访问网络(当需要重新发送时,跳过这个判断)
|
| | | ShowNotNetMsg(listNotShowError);
|
| | | return false;
|
| | | }
|
| | | //获取接口的连接模式
|
| | | var connectMode = GetHttpConnectMode(checkAuthority);
|
| | | //获取从接口那里取到的比特数据
|
| | |
| | | {
|
| | | if (setAgain == false)
|
| | | {
|
| | | //不指定重发
|
| | | //当前无法访问网络
|
| | | ShowNotNetMsg(listNotShowError);
|
| | | return false;
|
| | | }
|
| | | byteData = ResetByteRequestHttps(RequestName, checkAuthority, obj);
|
| | |
| | | /// <param name="checkAuthority">是否检测权限,该参数不能省略</param>
|
| | | /// <param name="obj">一个类</param>
|
| | | /// <param name="listNotShowError">不需要显示错误的错误类别(接口返回的错误类别),如果包含,则会返回【true】</param>
|
| | | /// <param name="setAgain">当发送失败时,是否重发,默认不重发</param>
|
| | | /// <param name="setAgain">当发送失败时,是否重发,默认重发</param>
|
| | | /// </param>
|
| | | public static string GetResultCodeByRequestHttps(string RequestName, bool checkAuthority, object obj, List<string> listNotShowError = null, bool setAgain = false)
|
| | | public static string GetResultCodeByRequestHttps(string RequestName, bool checkAuthority, object obj, List<string> listNotShowError = null, bool setAgain = true)
|
| | | {
|
| | | if (HdlWifiLogic.Current.CanAccessHttp == false && setAgain == false)
|
| | | {
|
| | | //当前无法访问网络(当需要重新发送时,跳过这个判断)
|
| | | ShowNotNetMsg(listNotShowError);
|
| | | return "Error";
|
| | | }
|
| | |
|
| | | //获取接口的连接模式
|
| | | var connectMode = GetHttpConnectMode(checkAuthority);
|
| | | //获取从接口那里取到的比特数据
|
| | |
| | | {
|
| | | if (setAgain == false)
|
| | | {
|
| | | //不指定重发
|
| | | //当前无法访问网络
|
| | | ShowNotNetMsg(listNotShowError);
|
| | | return "Error";
|
| | | }
|
| | | byteData = ResetByteRequestHttps(RequestName, checkAuthority, obj);
|
| | |
| | | /// <param name="checkAuthority">是否检测权限,该参数不能省略</param>
|
| | | /// <param name="obj">一个类</param>
|
| | | /// <param name="listNotShowError">不需要显示错误的错误类别(接口返回的错误类别),如果包含,则会返回【true】</param>
|
| | | /// <param name="setAgain">当发送失败时,是否重发,默认不重发</param>
|
| | | /// <param name="setAgain">当发送失败时,是否重发,默认重发</param>
|
| | | /// </param>
|
| | | public static string GetResponseDataByRequestHttps(string RequestName, bool checkAuthority, object obj, List<string> listNotShowError = null, bool setAgain = false)
|
| | | public static string GetResponseDataByRequestHttps(string RequestName, bool checkAuthority, object obj, List<string> listNotShowError = null, bool setAgain = true)
|
| | | {
|
| | | if (HdlWifiLogic.Current.CanAccessHttp == false && setAgain == false)
|
| | | {
|
| | | //当前无法访问网络(当需要重新发送时,跳过这个判断)
|
| | | ShowNotNetMsg(listNotShowError);
|
| | | return null;
|
| | | }
|
| | | //获取接口的连接模式
|
| | | var connectMode = GetHttpConnectMode(checkAuthority);
|
| | | //获取从接口那里取到的比特数据
|
| | |
| | | {
|
| | | if (setAgain == false)
|
| | | {
|
| | | //不指定重发
|
| | | //当前无法访问网络
|
| | | ShowNotNetMsg(listNotShowError);
|
| | | return null;
|
| | | }
|
| | | byteData = ResetByteRequestHttps(RequestName, checkAuthority, obj);
|
| | |
| | | /// <param name="checkAuthority">是否检测权限,该参数不能省略</param>
|
| | | /// <param name="obj">一个类</param>
|
| | | /// <param name="listNotShowError">不需要显示错误的错误类别(接口返回的错误类别),如果包含,则会返回【true】</param>
|
| | | /// <param name="setAgain">当发送失败时,是否重发,默认不重发</param>
|
| | | public static byte[] GetByteResponseDataByRequestHttps(string RequestName, bool checkAuthority, object obj, List<string> listNotShowError = null, bool setAgain = false)
|
| | | /// <param name="setAgain">当发送失败时,是否重发,默认重发</param>
|
| | | public static byte[] GetByteResponseDataByRequestHttps(string RequestName, bool checkAuthority, object obj, List<string> listNotShowError = null, bool setAgain = true)
|
| | | {
|
| | | if (HdlWifiLogic.Current.CanAccessHttp == false && setAgain == false)
|
| | | {
|
| | | //当前无法访问网络(当需要重新发送时,跳过这个判断)
|
| | | ShowNotNetMsg(listNotShowError);
|
| | | return null;
|
| | | }
|
| | | //获取接口的连接模式
|
| | | var connectMode = GetHttpConnectMode(checkAuthority);
|
| | | //获取从接口那里取到的比特数据
|
| | |
| | | {
|
| | | if (setAgain == false)
|
| | | {
|
| | | //不指定重发
|
| | | //当前无法访问网络
|
| | | ShowNotNetMsg(listNotShowError);
|
| | | return null;
|
| | | }
|
| | | revertObj = ResetByteRequestHttps(RequestName, checkAuthority, obj);
|
| | |
| | | //断开远程Mqtt连接,重新连接
|
| | | HdlThreadLogic.Current.RunThread(async () =>
|
| | | {
|
| | | HdlGatewayLogic.Current.ClearAllRealGateway();
|
| | | HdlGatewayLogic.Current.ClearAllRealGatewayConection(true);
|
| | | await ZigBee.Device.ZbGateway.DisConnectRemoteMqttClient();
|
| | | }, ShowErrorMode.NO);
|
| | | }
|
| | |
| | |
|
| | | //清空当前住宅id
|
| | | Config.Instance.HomeId = string.Empty;
|
| | | HdlGatewayLogic.Current.ClearAllRealGateway();
|
| | | HdlGatewayLogic.Current.ClearAllRealGatewayConection(false);
|
| | |
|
| | | //断开远程Mqtt连接
|
| | | HdlThreadLogic.Current.RunThread(async () =>
|
| | |
| | | }
|
| | | else if (view is UserView.UserPage)
|
| | | {
|
| | | var form = ((UserView.UserPage)view).GetNowActionForm();
|
| | | form?.FormActionAgainEvent();
|
| | | //刷新主页
|
| | | UserView.UserPage.Instance.ReFreshControl();
|
| | | return;
|
| | | }
|
| | | else
|
| | |
| | | //断开远程Mqtt连接,重新连接
|
| | | HdlThreadLogic.Current.RunThread(async () =>
|
| | | {
|
| | | HdlGatewayLogic.Current.ClearAllRealGateway();
|
| | | HdlGatewayLogic.Current.ClearAllRealGatewayConection(true);
|
| | | await ZigBee.Device.ZbGateway.DisConnectRemoteMqttClient();
|
| | | }, ShowErrorMode.NO);
|
| | |
|
| | |
| | | btnRight.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | //回路数大于1才展开
|
| | | if (Common.LocalDevice.Current.GetDevicesCountByMac(deviceMac) > 1)
|
| | | var listMacDevice = LocalDevice.Current.GetDevicesByMac(deviceMac, false);
|
| | | if (listMacDevice.Count > 1)
|
| | | {
|
| | | btnRight.IsSelected = !btnRight.IsSelected;
|
| | | //展开或者折叠明细列表
|
| | |
| | | }
|
| | | else
|
| | | {
|
| | | if (LocalDevice.Current.IsMiniLight(listMacDevice[0]) == true)
|
| | | {
|
| | | //mini夜灯的功能设置界面
|
| | | var room = HdlRoomLogic.Current.GetRoomByDevice(listMacDevice[0]);
|
| | | var form = new MainPage.DeviceDetailInfoForm();
|
| | | form.AddForm(listMacDevice[0], room);
|
| | | }
|
| | | else
|
| | | {
|
| | | //设备信息界面
|
| | | var form = new DeviceMacInfoEditorForm();
|
| | | form.AddForm(deviceMac);
|
| | | }
|
| | | btnNew.Visible = false;
|
| | | var form = new DeviceMacInfoEditorForm();
|
| | | form.AddForm(deviceMac);
|
| | | //界面跳转,记录当前的正在操作的设备的Mac地址
|
| | | this.nowActionDeviceMac = deviceMac;
|
| | | }
|
| | |
| | | form2.AddForm(deviceMac);
|
| | | return;
|
| | | }
|
| | | var listMacDevice = LocalDevice.Current.GetDevicesByMac(deviceMac, false);
|
| | | if (LocalDevice.Current.IsMiniLight(listMacDevice[0]) == true)
|
| | | {
|
| | | //mini夜灯的功能设置界面
|
| | | var room = HdlRoomLogic.Current.GetRoomByDevice(listMacDevice[0]);
|
| | | var form = new MainPage.DeviceDetailInfoForm();
|
| | | form.AddForm(listMacDevice[0], room);
|
| | | }
|
| | | else
|
| | | {
|
| | | //设备信息界面
|
| | | var form = new DeviceMacInfoEditorForm();
|
| | | form.AddForm(deviceMac);
|
| | | }
|
| | |
|
| | | btnNew.Visible = false;
|
| | | var form = new DeviceMacInfoEditorForm();
|
| | | form.AddForm(deviceMac);
|
| | | //界面跳转,记录当前的正在操作的设备的Mac地址
|
| | | this.nowActionDeviceMac = deviceMac;
|
| | | };
|
| | |
| | | /// <summary>
|
| | | /// 滑动控件下拉刷新
|
| | | /// </summary>
|
| | | private async void ListViewBeginHeaderRefreshing()
|
| | | private void ListViewBeginHeaderRefreshing()
|
| | | {
|
| | | //如果当前住宅是虚拟的
|
| | | if (Common.Config.Instance.Home.IsVirtually == true)
|
| | |
| | | {
|
| | | //显示进度条
|
| | | ProgressBar.Show();
|
| | | int result2 = await HdlGatewayLogic.Current.ReBindNewGateway(realWay);
|
| | | int result2 = HdlGatewayLogic.Current.ReBindNewGateway(realWay);
|
| | | //关闭进度条
|
| | | ProgressBar.Close();
|
| | | if (result2 == -1)
|
| | |
| | | HdlThreadLogic.Current.RunThread(() =>
|
| | | {
|
| | | //清空全部列表
|
| | | HdlGatewayLogic.Current.ClearAllRealGateway();
|
| | | HdlGatewayLogic.Current.ClearAllRealGatewayConection(true);
|
| | | ZigBee.Common.Application.IsSearchingGateway = true;
|
| | |
|
| | | int index = 1;
|
| | |
| | | if (timeCount == 10)
|
| | | {
|
| | | //5秒后清空网关列表
|
| | | HdlGatewayLogic.Current.ClearAllRealGateway();
|
| | | HdlGatewayLogic.Current.ClearAllRealGatewayConection(true);
|
| | | ZigBee.Common.Application.IsSearchingGateway = true;
|
| | | }
|
| | | if (timeCount % 2 == 0)
|
| | |
| | | private void StartCheckGatewayThread()
|
| | | {
|
| | | this.isGatewaySearching = true;
|
| | | HdlThreadLogic.Current.RunThread(async () =>
|
| | | HdlThreadLogic.Current.RunThread(() =>
|
| | | {
|
| | | int count = 0;
|
| | | while (this.Parent != null && this.isGatewaySearching == true)
|
| | |
| | | }
|
| | | count = 0;
|
| | |
|
| | | await this.CheckZbGatewayAndSetRow();
|
| | | this.CheckZbGatewayAndSetRow();
|
| | |
|
| | | if (this.newGatewayGetting == true)
|
| | | {
|
| | |
| | | /// <summary>
|
| | | /// 检测搜索到的网关
|
| | | /// </summary>
|
| | | private async Task<bool> CheckZbGatewayAndSetRow()
|
| | | private bool CheckZbGatewayAndSetRow()
|
| | | {
|
| | | for (int i = 0; i < ZbGateway.GateWayList.Count; i++)
|
| | | {
|
| | |
| | | if (mode == GatewayBindMode.First || mode == GatewayBindMode.Binded)
|
| | | {
|
| | | //添加搜索到的网关到缓存(执行网关保存操作)
|
| | | var result = await HdlGatewayLogic.Current.AddNewGateway(way, ShowErrorMode.NO);
|
| | | var result = HdlGatewayLogic.Current.AddNewGateway(way, ShowErrorMode.NO);
|
| | | if (result == false)
|
| | | {
|
| | | continue;
|
| | |
| | | rowWifi.InitControl();
|
| | | rowWifi.AddBottomLine();
|
| | | rowWifi.txtInput.PlaceholderText = Language.StringByID(R.MyInternationalizationString.uPleaseInputHomeWifiAccount);
|
| | | //下拉图标是偏右的
|
| | | rowWifi.RightOffset = -Application.GetRealWidth(18);
|
| | | var btnDrop = rowWifi.AddMostRightEmptyIcon(58, 58);
|
| | | btnDrop.UnSelectedImagePath = "Item/Down.png";
|
| | | rowWifi.ChangedChidrenBindMode(btnDrop, ChidrenBindMode.NotBind);
|
| | | btnDrop.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | //显示Wifi下拉列表
|
| | | this.ShowWifiListView(rowWifi);
|
| | | };
|
| | |
|
| | | //密码
|
| | | var btnPsw = new FrameCaptionInputControl(Language.StringByID(R.MyInternationalizationString.uPassword), string.Empty);
|
| | | btnPsw.Y = rowWifi.Bottom + Application.GetRealHeight(9);
|
| | | frameBack.AddChidren(btnPsw);
|
| | | btnPsw.InitControl();
|
| | | btnPsw.txtInput.SecureTextEntry = true;
|
| | | btnPsw.txtInput.PlaceholderText = Language.StringByID(R.MyInternationalizationString.uPleaseInputWifiPassword);
|
| | | var btnView = btnPsw.AddMostRightEmptyIcon(81, 81);
|
| | | var rowPsw = new FrameCaptionInputControl(Language.StringByID(R.MyInternationalizationString.uPassword), string.Empty);
|
| | | rowPsw.Y = rowWifi.Bottom + Application.GetRealHeight(9);
|
| | | frameBack.AddChidren(rowPsw);
|
| | | rowPsw.InitControl();
|
| | | rowPsw.txtInput.SecureTextEntry = true;
|
| | | rowPsw.txtInput.PlaceholderText = Language.StringByID(R.MyInternationalizationString.uPleaseInputWifiPassword);
|
| | | var btnView = rowPsw.AddMostRightEmptyIcon(81, 81);
|
| | | btnView.UnSelectedImagePath = "Item/HidenPWD.png";
|
| | | btnView.SelectedImagePath = "Item/UnHidenPWD.png";
|
| | | btnPsw.ChangedChidrenBindMode(btnView, ChidrenBindMode.NotBind);
|
| | | rowPsw.ChangedChidrenBindMode(btnView, ChidrenBindMode.NotBind);
|
| | | btnView.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | btnView.IsSelected = !btnView.IsSelected;
|
| | | btnPsw.txtInput.SecureTextEntry = !btnPsw.txtInput.SecureTextEntry;
|
| | | rowPsw.txtInput.SecureTextEntry = !rowPsw.txtInput.SecureTextEntry;
|
| | | };
|
| | |
|
| | | var btnMsg = new NormalViewControl(btnPsw.txtInput.Width, false);
|
| | | var btnMsg = new NormalViewControl(rowPsw.txtInput.Width, false);
|
| | | btnMsg.X = ControlCommonResourse.XXLeft;
|
| | | btnMsg.Y = frameBack.Bottom + Application.GetRealHeight(23);
|
| | | btnMsg.TextSize = 12;
|
| | |
| | | btnMsg.Text = Language.StringByID(R.MyInternationalizationString.uPleaseInputHomeWifiAccount);
|
| | | return;
|
| | | }
|
| | | if (btnPsw.Text == string.Empty)
|
| | | if (rowPsw.Text == string.Empty)
|
| | | {
|
| | | //请输入Wifi密码
|
| | | btnMsg.Text = Language.StringByID(R.MyInternationalizationString.uPleaseInputWifiPassword);
|
| | | return;
|
| | | }
|
| | | //发送密码
|
| | | var result = HdlWifiLogic.Current.SendApHomeWifiPassword(rowWifi.Text, btnPsw.Text);
|
| | | var result = HdlWifiLogic.Current.SendApHomeWifiPassword(rowWifi.Text, rowPsw.Text);
|
| | | if (result == false)
|
| | | {
|
| | | //密码发送失败
|
| | |
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 显示Wifi下拉列表___________________
|
| | |
|
| | | /// <summary>
|
| | | /// 显示Wifi下拉列表
|
| | | /// </summary>
|
| | | /// <param name="rowWifi"></param>
|
| | | private void ShowWifiListView(FrameCaptionInputControl rowWifi)
|
| | | {
|
| | | //一个可以遮住Body的东西
|
| | | var frameTran = new NormalFrameLayout();
|
| | | frameTran.Height = bodyFrameLayout.Height;
|
| | | frameTran.BackgroundColor = UserCenterColor.Current.DialogBackColor;
|
| | | bodyFrameLayout.AddChidren(frameTran);
|
| | | frameTran.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | frameTran.RemoveFromParent();
|
| | | };
|
| | | //白色背景框
|
| | | var frameList = new NormalFrameLayout();
|
| | | frameList.Y = rowWifi.Bottom;
|
| | | frameList.Gravity = Gravity.CenterHorizontal;
|
| | | frameList.Width = frameTran.Width - ControlCommonResourse.XXLeft * 2;
|
| | | frameList.Height = this.GetPictrueRealSize(1200);
|
| | | frameList.Radius = (uint)Application.GetRealWidth(17);
|
| | | frameList.BackgroundColor = UserCenterColor.Current.White;
|
| | | frameTran.AddChidren(frameList);
|
| | | //列表控件
|
| | | var listView = new VerticalListControl();
|
| | | listView.Height = frameList.Height;
|
| | | frameList.AddChidren(listView);
|
| | |
|
| | | for (int i = 1; i <= 10; i++)
|
| | | {
|
| | | var frameRow = new FrameRowControl();
|
| | | listView.AddChidren(frameRow);
|
| | | //wifi名字
|
| | | var btnWifi = new NormalViewControl(frameRow.Width, frameRow.Height - ControlCommonResourse.BottomLineHeight, false);
|
| | | btnWifi.X = ControlCommonResourse.XXLeft;
|
| | | btnWifi.Text = "Application Software" + i;
|
| | | frameRow.AddChidren(btnWifi, ChidrenBindMode.BindEvent);
|
| | | //底线
|
| | | var btnLine = new NormalViewControl(frameRow.Width, ControlCommonResourse.BottomLineHeight, false);
|
| | | btnLine.BackgroundColor = UserCenterColor.Current.ButtomLine;
|
| | | btnLine.Y = btnWifi.Bottom;
|
| | | frameRow.AddChidren(btnLine, ChidrenBindMode.BindEvent);
|
| | | frameRow.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | rowWifi.Text = btnWifi.Text;
|
| | | frameTran.RemoveFromParent();
|
| | | };
|
| | | }
|
| | | }
|
| | | #endregion
|
| | |
|
| | | #region ■ 界面关闭___________________________
|
| | |
|
| | | /// <summary>
|
| | |
| | | private void StartCheckGatewayThread()
|
| | | {
|
| | | this.isGatewaySearching = true;
|
| | | HdlThreadLogic.Current.RunThread(async () =>
|
| | | HdlThreadLogic.Current.RunThread(() =>
|
| | | {
|
| | | //清空全部列表
|
| | | HdlGatewayLogic.Current.ClearAllRealGateway();
|
| | | HdlGatewayLogic.Current.ClearAllRealGatewayConection(true);
|
| | | ZigBee.Common.Application.IsSearchingGateway = true;
|
| | |
|
| | | int count = 0;
|
| | |
| | | }
|
| | | count = 0;
|
| | |
|
| | | await this.CheckZbGatewayAndSetRow();
|
| | | this.CheckZbGatewayAndSetRow();
|
| | |
|
| | | if (this.newGatewayGetting == true)
|
| | | {
|
| | |
| | | /// <summary>
|
| | | /// 检测搜索到的网关,然后添加到画面的行里面
|
| | | /// </summary>
|
| | | private async Task<bool> CheckZbGatewayAndSetRow()
|
| | | private bool CheckZbGatewayAndSetRow()
|
| | | {
|
| | | List<string> listId = new List<string>();
|
| | | for (int i = 0; i < ZbGateway.GateWayList.Count; i++)
|
| | |
| | | if (mode == GatewayBindMode.First || mode == GatewayBindMode.Binded)
|
| | | {
|
| | | //添加搜索到的网关到缓存(执行网关保存操作)
|
| | | var result = await HdlGatewayLogic.Current.AddNewGateway(way, ShowErrorMode.NO);
|
| | | var result = HdlGatewayLogic.Current.AddNewGateway(way, ShowErrorMode.NO);
|
| | | if (result == false)
|
| | | {
|
| | | continue;
|
| | |
| | | if (timeCount == 10)
|
| | | {
|
| | | //5秒后清空网关列表
|
| | | HdlGatewayLogic.Current.ClearAllRealGateway();
|
| | | HdlGatewayLogic.Current.ClearAllRealGatewayConection(true);
|
| | | ZigBee.Common.Application.IsSearchingGateway = true;
|
| | | }
|
| | | if (timeCount % 2 == 0)
|
| | |
| | | private void StartCheckGatewayThread()
|
| | | {
|
| | | this.isGatewaySearching = true;
|
| | | HdlThreadLogic.Current.RunThread(async () =>
|
| | | HdlThreadLogic.Current.RunThread(() =>
|
| | | {
|
| | | int count = 0;
|
| | | while (this.Parent != null && this.isGatewaySearching == true)
|
| | |
| | | }
|
| | | count = 0;
|
| | |
|
| | | await this.CheckZbGatewayAndSetRow();
|
| | | this.CheckZbGatewayAndSetRow();
|
| | |
|
| | | if (this.newGatewayGetting == true)
|
| | | {
|
| | |
| | | /// <summary>
|
| | | /// 检测搜索到的网关
|
| | | /// </summary>
|
| | | private async Task<bool> CheckZbGatewayAndSetRow()
|
| | | private bool CheckZbGatewayAndSetRow()
|
| | | {
|
| | | for (int i = 0; i < ZbGateway.GateWayList.Count; i++)
|
| | | {
|
| | |
| | | if (mode == GatewayBindMode.First || mode == GatewayBindMode.Binded)
|
| | | {
|
| | | //添加搜索到的网关到缓存(执行网关保存操作)
|
| | | var result = await HdlGatewayLogic.Current.AddNewGateway(way, ShowErrorMode.NO);
|
| | | var result = HdlGatewayLogic.Current.AddNewGateway(way, ShowErrorMode.NO);
|
| | | if (result == false)
|
| | | {
|
| | | continue;
|
| | |
| | | using System;
|
| | | using System.Collections.Generic;
|
| | | using System.Security.Cryptography;
|
| | | using System.Text;
|
| | |
|
| | | namespace Shared.Phone.UserCenter.GatewayAdd
|
| | |
| | | rowWifi.InitControl();
|
| | | rowWifi.AddBottomLine();
|
| | | rowWifi.txtInput.PlaceholderText = Language.StringByID(R.MyInternationalizationString.uPleaseInputHomeWifiAccount);
|
| | | //下拉图标是偏右的
|
| | | rowWifi.RightOffset = -Application.GetRealWidth(18);
|
| | | var btnDrop = rowWifi.AddMostRightEmptyIcon(58, 58);
|
| | | btnDrop.UnSelectedImagePath = "Item/Down.png";
|
| | | rowWifi.ChangedChidrenBindMode(btnDrop, ChidrenBindMode.NotBind);
|
| | | btnDrop.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | //显示Wifi下拉列表
|
| | | this.ShowWifiListView(rowWifi);
|
| | | };
|
| | |
|
| | | //密码
|
| | | var btnPsw = new FrameCaptionInputControl(Language.StringByID(R.MyInternationalizationString.uPassword), string.Empty);
|
| | | btnPsw.Y = rowWifi.Bottom + Application.GetRealHeight(9);
|
| | | frameBack.AddChidren(btnPsw);
|
| | | btnPsw.InitControl();
|
| | | btnPsw.txtInput.SecureTextEntry = true;
|
| | | btnPsw.txtInput.PlaceholderText = Language.StringByID(R.MyInternationalizationString.uPleaseInputWifiPassword);
|
| | | var btnView = btnPsw.AddMostRightEmptyIcon(81, 81);
|
| | | var rowPsw = new FrameCaptionInputControl(Language.StringByID(R.MyInternationalizationString.uPassword), string.Empty);
|
| | | rowPsw.Y = rowWifi.Bottom + Application.GetRealHeight(9);
|
| | | frameBack.AddChidren(rowPsw);
|
| | | rowPsw.InitControl();
|
| | | rowPsw.txtInput.SecureTextEntry = true;
|
| | | rowPsw.txtInput.PlaceholderText = Language.StringByID(R.MyInternationalizationString.uPleaseInputWifiPassword);
|
| | | var btnView = rowPsw.AddMostRightEmptyIcon(81, 81);
|
| | | btnView.UnSelectedImagePath = "Item/HidenPWD.png";
|
| | | btnView.SelectedImagePath = "Item/UnHidenPWD.png";
|
| | | btnPsw.ChangedChidrenBindMode(btnView, ChidrenBindMode.NotBind);
|
| | | rowPsw.ChangedChidrenBindMode(btnView, ChidrenBindMode.NotBind);
|
| | | btnView.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | btnView.IsSelected = !btnView.IsSelected;
|
| | | btnPsw.txtInput.SecureTextEntry = !btnPsw.txtInput.SecureTextEntry;
|
| | | rowPsw.txtInput.SecureTextEntry = !rowPsw.txtInput.SecureTextEntry;
|
| | | };
|
| | |
|
| | | var btnMsg = new NormalViewControl(btnPsw.txtInput.Width, false);
|
| | | var btnMsg = new NormalViewControl(rowPsw.txtInput.Width, false);
|
| | | btnMsg.X = ControlCommonResourse.XXLeft;
|
| | | btnMsg.Y = frameBack.Bottom + Application.GetRealHeight(23);
|
| | | btnMsg.TextSize = 12;
|
| | |
| | | btnMsg.Text = Language.StringByID(R.MyInternationalizationString.uPleaseInputHomeWifiAccount);
|
| | | return;
|
| | | }
|
| | | if (btnPsw.Text == string.Empty)
|
| | | if (rowPsw.Text == string.Empty)
|
| | | {
|
| | | //请输入Wifi密码
|
| | | btnMsg.Text = Language.StringByID(R.MyInternationalizationString.uPleaseInputWifiPassword);
|
| | | return;
|
| | | }
|
| | | //发送密码
|
| | | var result = HdlWifiLogic.Current.SendApHomeWifiPassword(rowWifi.Text, btnPsw.Text);
|
| | | var result = HdlWifiLogic.Current.SendApHomeWifiPassword(rowWifi.Text, rowPsw.Text);
|
| | | if (result == false)
|
| | | {
|
| | | //密码发送失败
|
| | |
| | | return;
|
| | | }
|
| | |
|
| | | var form = new WirelessApDirection3Form();
|
| | | this.AddFromAndRemoveNowForm(form);
|
| | | this.CloseForm();
|
| | | var form = new MiniGatewayDirection3Form();
|
| | | form.AddForm();
|
| | | };
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 显示Wifi下拉列表___________________
|
| | |
|
| | | /// <summary>
|
| | | /// 显示Wifi下拉列表
|
| | | /// </summary>
|
| | | /// <param name="rowWifi"></param>
|
| | | private void ShowWifiListView(FrameCaptionInputControl rowWifi)
|
| | | {
|
| | | //一个可以遮住Body的东西
|
| | | var frameTran = new NormalFrameLayout();
|
| | | frameTran.Height = bodyFrameLayout.Height;
|
| | | frameTran.BackgroundColor = UserCenterColor.Current.DialogBackColor;
|
| | | bodyFrameLayout.AddChidren(frameTran);
|
| | | frameTran.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | frameTran.RemoveFromParent();
|
| | | };
|
| | | //白色背景框
|
| | | var frameList = new NormalFrameLayout();
|
| | | frameList.Y = rowWifi.Bottom;
|
| | | frameList.Gravity = Gravity.CenterHorizontal;
|
| | | frameList.Width = frameTran.Width - ControlCommonResourse.XXLeft * 2;
|
| | | frameList.Height = this.GetPictrueRealSize(1200);
|
| | | frameList.Radius = (uint)Application.GetRealWidth(17);
|
| | | frameList.BackgroundColor = UserCenterColor.Current.White;
|
| | | frameTran.AddChidren(frameList);
|
| | | //列表控件
|
| | | var listView = new VerticalListControl();
|
| | | listView.Height = frameList.Height;
|
| | | frameList.AddChidren(listView);
|
| | |
|
| | | for (int i = 1; i <= 10; i++)
|
| | | {
|
| | | var frameRow = new FrameRowControl();
|
| | | listView.AddChidren(frameRow);
|
| | | //wifi名字
|
| | | var btnWifi = new NormalViewControl(frameRow.Width, frameRow.Height - ControlCommonResourse.BottomLineHeight, false);
|
| | | btnWifi.X = ControlCommonResourse.XXLeft;
|
| | | btnWifi.Text = "Application Software" + i;
|
| | | frameRow.AddChidren(btnWifi, ChidrenBindMode.BindEvent);
|
| | | //底线
|
| | | var btnLine = new NormalViewControl(frameRow.Width, ControlCommonResourse.BottomLineHeight, false);
|
| | | btnLine.BackgroundColor = UserCenterColor.Current.ButtomLine;
|
| | | btnLine.Y = btnWifi.Bottom;
|
| | | frameRow.AddChidren(btnLine, ChidrenBindMode.BindEvent);
|
| | | frameRow.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | rowWifi.Text = btnWifi.Text;
|
| | | frameTran.RemoveFromParent();
|
| | | };
|
| | | }
|
| | | }
|
| | | #endregion
|
| | |
|
| | | #region ■ 界面关闭___________________________
|
| | |
|
| | | /// <summary>
|
| | |
| | | if (timeCount == 10)
|
| | | {
|
| | | //5秒后清空网关列表
|
| | | HdlGatewayLogic.Current.ClearAllRealGateway();
|
| | | HdlGatewayLogic.Current.ClearAllRealGatewayConection(true);
|
| | | ZigBee.Common.Application.IsSearchingGateway = true;
|
| | | }
|
| | | if (timeCount % 2 == 0)
|
| | |
| | | private void StartCheckGatewayThread()
|
| | | {
|
| | | this.isGatewaySearching = true;
|
| | | HdlThreadLogic.Current.RunThread(async () =>
|
| | | HdlThreadLogic.Current.RunThread(() =>
|
| | | {
|
| | | int count = 0;
|
| | | while (this.Parent != null && this.isGatewaySearching == true)
|
| | |
| | | }
|
| | | count = 0;
|
| | |
|
| | | await this.CheckZbGatewayAndSetRow();
|
| | | this.CheckZbGatewayAndSetRow();
|
| | |
|
| | | if (this.newGatewayGetting == true)
|
| | | {
|
| | |
| | | /// <summary>
|
| | | /// 检测搜索到的网关
|
| | | /// </summary>
|
| | | private async Task<bool> CheckZbGatewayAndSetRow()
|
| | | private bool CheckZbGatewayAndSetRow()
|
| | | {
|
| | | for (int i = 0; i < ZbGateway.GateWayList.Count; i++)
|
| | | {
|
| | |
| | | if (mode == GatewayBindMode.First || mode == GatewayBindMode.Binded)
|
| | | {
|
| | | //添加搜索到的网关到缓存(执行网关保存操作)
|
| | | var result = await HdlGatewayLogic.Current.AddNewGateway(way, ShowErrorMode.NO);
|
| | | var result = HdlGatewayLogic.Current.AddNewGateway(way, ShowErrorMode.NO);
|
| | | if (result == false)
|
| | | {
|
| | | continue;
|
| | |
| | | private void CheckNewVersion(PicViewControl btnNewVersion)
|
| | | {
|
| | | //获取网关版本信息
|
| | | var result = HdlGatewayLogic.Current.GetGatewayAllNewVersion(this.zbGateway);
|
| | | var result = HdlGatewayLogic.Current.GetGatewayAllNewVersion(this.zbGateway, ShowErrorMode.NO);
|
| | | if (result == null)
|
| | | {
|
| | | return;
|
| | |
| | | /// </summary>
|
| | | /// <param name="gatewayId"></param>
|
| | | /// <param name="online"></param>
|
| | | private async void DoSwitchGateway()
|
| | | private void DoSwitchGateway()
|
| | | {
|
| | | var result = await HdlGatewayLogic.Current.DoSwitchGateway(zbGateway.GwId);
|
| | | var result = HdlGatewayLogic.Current.DoSwitchGateway(zbGateway.GwId);
|
| | | if (result == false)
|
| | | {
|
| | | return;
|
| | |
| | | /// <param name="row"></param>
|
| | | private void DeleteGateway(string strWayId)
|
| | | {
|
| | | HdlThreadLogic.Current.RunThread(async () =>
|
| | | HdlThreadLogic.Current.RunThread(() =>
|
| | | {
|
| | | //打开进度条
|
| | | this.ShowProgressBar();
|
| | |
|
| | | //删除云端网关
|
| | | bool result = await HdlGatewayLogic.Current.DeleteGateway(strWayId);
|
| | | bool result = HdlGatewayLogic.Current.DeleteGateway(strWayId);
|
| | | //关闭进度条
|
| | | this.CloseProgressBar();
|
| | | if (result == false)
|
| | |
| | | /// </summary>
|
| | | /// <param name="strWayId"></param>
|
| | | /// <param name="row"></param>
|
| | | private async void DeleteGateway(string strWayId)
|
| | | private void DeleteGateway(string strWayId)
|
| | | {
|
| | | //打开进度条
|
| | | this.ShowProgressBar();
|
| | | //删除云端网关
|
| | | bool result = await HdlGatewayLogic.Current.DeleteGateway(strWayId);
|
| | | bool result = HdlGatewayLogic.Current.DeleteGateway(strWayId);
|
| | | //关闭进度条
|
| | | this.CloseProgressBar();
|
| | | if (result == false)
|
| | |
| | | /// </summary>
|
| | | /// <param name="gatewayId"></param>
|
| | | /// <param name="online"></param>
|
| | | private async void DoSwitchGateway(string gatewayId)
|
| | | private void DoSwitchGateway(string gatewayId)
|
| | | {
|
| | | var result = await HdlGatewayLogic.Current.DoSwitchGateway(gatewayId);
|
| | | var result = HdlGatewayLogic.Current.DoSwitchGateway(gatewayId);
|
| | | if (result == false)
|
| | | {
|
| | | return;
|
| | |
| | | btnMsg.TextID = R.MyInternationalizationString.uIsReBindingPleaseWaiting;
|
| | | bodyFrameLayout.AddChidren(btnMsg);
|
| | |
|
| | | HdlThreadLogic.Current.RunThread(async () =>
|
| | | HdlThreadLogic.Current.RunThread(() =>
|
| | | {
|
| | | await System.Threading.Tasks.Task.Delay(1000);
|
| | | int value = await HdlGatewayLogic.Current.ReBindNewGateway(i_gateway, btnMsg);
|
| | | System.Threading.Thread.Sleep(1000);
|
| | | int value = HdlGatewayLogic.Current.ReBindNewGateway(i_gateway, btnMsg);
|
| | | if (value == 1)
|
| | | {
|
| | | //成功
|
| | | i_dicZbGatewayDiv[i_gateway.GwId] = 1;
|
| | | //我觉得这里需要获取一下新网关的设备列表
|
| | | Common.LocalDevice.Current.SetDeviceToMemmoryByGateway(i_gateway, true);
|
| | | if (i_gateway.IsMainGateWay == true)
|
| | | {
|
| | | //如果它是主网关,则刷新场景列表
|
| | | HdlSceneLogic.Current.RefreshSceneUIList(true);
|
| | | }
|
| | | }
|
| | | else if (value == 0)
|
| | | {
|
| | |
| | | /// </summary>
|
| | | public override void CloseFormBefore()
|
| | | {
|
| | | var userPageForm = UserView.UserPage.Instance.GetNowActionForm();
|
| | | if (userPageForm != null && userPageForm.FormID == "UserMainForm")
|
| | | {
|
| | | //刷新主页
|
| | | UserView.UserPage.Instance.ReFreshControl();
|
| | | }
|
| | | //刷新主页
|
| | | UserView.UserPage.Instance.ReFreshControl();
|
| | |
|
| | | base.CloseFormBefore();
|
| | | }
|
| | |
|
| | |
| | | row1.AddBottomLine();
|
| | | row1.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | var form = new HideOptionFileListForm();
|
| | | var form = new HideOptionSearchAllFile();
|
| | | form.AddForm(Common.Config.Instance.FullPath);
|
| | | };
|
| | |
|
| | |
| | |
|
| | | row1.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | var form = new HideOptionFileListForm();
|
| | | var form = new HideOptionSearchAllFile();
|
| | | form.AddForm(directoryValue);
|
| | | };
|
| | | }
|
| | |
| | |
|
| | | this.AddNormalRowControl("手机获取的IP", 600, new Shared.Net.NetWiFi().BroadcastIpAddress.ToString(), 600);
|
| | |
|
| | | if (ZigBee.Common.Application.FindGateWaySocket.busSocket == null)
|
| | | if (ZigBee.Common.Application.FindGateWaySocket.udpClient == null)
|
| | | {
|
| | | this.AddNormalRowControl("Socket链接", 400, "未初始化", 400);
|
| | | }
|
| | | else
|
| | | {
|
| | | this.AddNormalRowControl("Socket链接", 400, ZigBee.Common.Application.FindGateWaySocket.busSocket.Connected == true ? "true" : "false", 400);
|
| | | this.AddNormalRowControl("Socket链接", 400, "已初始化", 400);
|
| | | }
|
| | |
|
| | | int count = ZbGateway.GateWayList.Count;
|
| | |
| | | }
|
| | | }
|
| | | listView.AdjustRealHeightByBottomButton(Application.GetRealHeight(50));
|
| | |
|
| | | var btnButon = new BottomClickButton();
|
| | | btnButon.Text = "删除文件夹";
|
| | | bodyFrameLayout.AddChidren(btnButon);
|
| | | btnButon.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | this.ShowMassage(ShowMsgType.Confirm, "是否清除该文件夹", () =>
|
| | | {
|
| | | try
|
| | | {
|
| | | System.IO.Directory.Delete(directory, true);
|
| | | this.CloseForm();
|
| | | }
|
| | | catch (Exception ex)
|
| | | {
|
| | | this.ShowMassage(ShowMsgType.Error, "清除缓存文件夹异常");
|
| | | HdlLogLogic.Current.WriteLog(ex, "清除缓存文件夹异常");
|
| | | }
|
| | | });
|
| | | };
|
| | | if (directory == Common.Config.Instance.FullPath)
|
| | | {
|
| | | btnButon.CanClick = false;
|
| | | }
|
| | | }
|
| | |
|
| | | private void AddDirectoryRowControl(VerticalListControl listView, string directoryName, string directory, bool addLine)
|
| | |
| | | return;
|
| | | }
|
| | | pra.Account = dicMemberAccount[keys];
|
| | | var result = UserCenterLogic.GetByteResponseDataByRequestHttps("ZigbeeUsers/GetSubAccountInfo", false, pra, new List<string> { "NotCheck" });
|
| | | var result = UserCenterLogic.GetByteResponseDataByRequestHttps("ZigbeeUsers/GetSubAccountInfo", false, pra, new List<string> { "NotCheck" }, false);
|
| | | if (result == null)
|
| | | {
|
| | | continue;
|
| | |
| | | {
|
| | | var pra = new AccountInfoPra();
|
| | | pra.Account = memberInfo.Account;
|
| | | var result = UserCenterLogic.GetByteResponseDataByRequestHttps("ZigbeeUsers/GetSubAccountInfo", false, pra, new List<string> { "NotCheck" });
|
| | | var result = UserCenterLogic.GetByteResponseDataByRequestHttps("ZigbeeUsers/GetSubAccountInfo", false, pra, new List<string> { "NotCheck" }, false);
|
| | | if (result == null)
|
| | | {
|
| | | return;
|
| | |
| | | {
|
| | | //获取住宅信息
|
| | | var Pra = new GetResidenceInfoPra();
|
| | | string resultData = UserCenterLogic.GetResponseDataByRequestHttps("App/GetHomePager", false, Pra, new List<string> { "NotCheck" });
|
| | | string resultData = UserCenterLogic.GetResponseDataByRequestHttps("App/GetHomePager", false, Pra, new List<string> { "NotCheck" }, false);
|
| | | if (string.IsNullOrEmpty(resultData) == true)
|
| | | {
|
| | | return false;
|
| | |
| | | var myHouse = HdlResidenceLogic.Current.GetHouseByFilePath(Common.Config.Instance.HomeFilePathList[index]);
|
| | | //切换住宅
|
| | | Common.Config.Instance.HomeId = myHouse.Id;
|
| | | Common.Config.Instance.Home = HdlResidenceLogic.Current.GetHouseByHouseId(myHouse.Id);
|
| | | Common.Global.CreateHomeDirectory(myHouse.Id);
|
| | | Common.Config.Instance.Save();
|
| | |
|
| | |
| | | //登录成功,或者没有网络都可以登录
|
| | | if (loginSuccess == 1 || loginSuccess == 2)
|
| | | {
|
| | | var homes = UserCenter.HdlResidenceLogic.Current.GetHomeListsFromDb();
|
| | | var homes = UserCenter.HdlResidenceLogic.Current.GetHomeListsFromDb(true);
|
| | | //刷新个人中心的内存及线程
|
| | | UserCenter.UserCenterLogic.InitUserCenterMenmoryAndThread();
|
| | | //启动ZigBee
|
| | |
| | | { |
| | | try |
| | | { |
| | | if (FindGateWaySocket.busSocket == null || FindGateWaySocket.busSocket.Available <= 0) |
| | | if (FindGateWaySocket.udpClient == null || FindGateWaySocket.udpClient.Available <= 0) |
| | | { |
| | | System.Threading.Thread.Sleep(500); |
| | | continue; |
| | | } |
| | | var bytes = new byte[1024]; |
| | | var len = FindGateWaySocket.busSocket.Receive(bytes, bytes.Length, System.Net.Sockets.SocketFlags.None); |
| | | }
|
| | | var ipEndPoint = new System.Net.IPEndPoint(0, 0); |
| | | var bytes = FindGateWaySocket.udpClient.Receive(ref ipEndPoint); |
| | | if (bytes[43] == 0xA2) |
| | | { |
| | | //广播回复网关的基本信息处理 |
| | |
| | | } |
| | | } |
| | | } |
| | | catch { } |
| | | catch (Exception ex) |
| | | {
|
| | | //调试用
|
| | | if (Shared.Phone.UserCenter.UserCenterResourse.HideOption.WriteSocketReceiveDataToFile == 1)
|
| | | {
|
| | | Shared.Phone.UserCenter.HdlLogLogic.Current.WriteLog(3, "Receive异常\r\n" + ex.Message);
|
| | | } |
| | | } |
| | | } |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | |
| | | public static class FindGateWaySocket |
| | | { |
| | | //本地Socket |
| | | public static Socket busSocket; |
| | | public static UdpClient udpClient; |
| | | |
| | | /// <summary> |
| | | /// 启动Socket接收和发送功能 |
| | | /// </summary> |
| | | /// <param name="port"></param> |
| | | public static void Start(int port = 7624) |
| | | public static void Start() |
| | | { |
| | | if (IsRunning) |
| | | if (udpClient!=null) |
| | | { |
| | | return; |
| | | } |
| | | //定义网络类型,数据连接类型和网络协议UDP |
| | | busSocket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); |
| | | busSocket.EnableBroadcast = true; |
| | | busSocket.ReceiveTimeout = 1000; |
| | | busSocket.SendTimeout = 1000; |
| | | busSocket.Bind(new IPEndPoint(IPAddress.Any, port)); |
| | | udpClient = new UdpClient { EnableBroadcast = true }; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | { |
| | | try |
| | | { |
| | | busSocket?.Close(); |
| | | udpClient?.Close(); |
| | | } |
| | | catch { } |
| | | busSocket = null; |
| | | udpClient = null; |
| | | |
| | | Console.WriteLine("BusSocket关闭成功!"); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 当前的Socket是否运行 |
| | | /// </summary> |
| | | public static bool IsRunning |
| | | { |
| | | get |
| | | { |
| | | return busSocket == null ? false : true; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | { |
| | | try |
| | | { |
| | | if (IsRunning)
|
| | | if (udpClient == null)
|
| | | {
|
| | | busSocket.BeginSendTo(bytes, 0, bytes.Length, SocketFlags.None, iPEndPoint, new AsyncCallback(asyncEndSend), null);
|
| | | return;
|
| | | }
|
| | |
|
| | | udpClient.Send(bytes, bytes.Length, iPEndPoint);
|
| | | } |
| | | catch (Exception ex) |
| | | {
|
| | |
| | | }
|
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 异步发送数据结束 |
| | | /// </summary> |
| | | /// <param name="iar"></param> |
| | | private static void asyncEndSend(IAsyncResult iar) |
| | | { |
| | | try |
| | | { |
| | | int bytesSent = busSocket.EndSendTo(iar); |
| | | } |
| | | catch (Exception ex)
|
| | | {
|
| | | //调试用
|
| | | if (Shared.Phone.UserCenter.UserCenterResourse.HideOption.WriteSocketReceiveDataToFile == 1)
|
| | | {
|
| | | Shared.Phone.UserCenter.HdlLogLogic.Current.WriteLog(3, "异步发送结束异常(asyncEndSend)\r\n" + ex.Message);
|
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | } |
| | | } |
| | | } |
| | |
| | | public int ColorTemperature = 0;
|
| | |
|
| | | /// <summary>
|
| | | ///蜂鸣器是否在响着(true:响着 false:不响)
|
| | | /// </summary>
|
| | | [Newtonsoft.Json.JsonIgnore]
|
| | | public bool IsBuzzerRing = false;
|
| | |
|
| | | /// <summary>
|
| | | /// 读取亮度
|
| | | /// </summary>
|
| | | public void ReadLevel()
|
| | |
| | | ReadAttri(Device.Cluster_ID.ColorControl, AttriButeId.LevelControl);
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 读取蜂鸣器状态(小夜灯专用)
|
| | | /// </summary>
|
| | | public void ReadBuzzerStatu()
|
| | | {
|
| | | ReadAttri((Cluster_ID)1282, 0);
|
| | | }
|
| | |
|
| | | ///<summary >
|
| | | ///设置设备亮度(Level)
|
| | | ///<para>value:亮度值取值范围:0-254</para>
|
| | |
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\HdlBackup\HdlBackupListForm.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\HideOption\HideOptionDirectoryListForm.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\HideOption\HideOptionFileContentForm.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\HideOption\HideOptionFileListForm.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\HideOption\HideOptionGatewayListForm.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\HideOption\HideOptionMainForm.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\HideOption\HideOptionMemoryListDeviceForm.cs" />
|