| | |
| | | Topic = $"/user/{DB_ResidenceData.Instance.CurrentRegion.id}/app/thing/event/appDeviceRefresh/up", |
| | | QualityOfServiceLevel = MQTTnet.Protocol.MqttQualityOfServiceLevel.AtMostOnce |
| | | }; |
| | | //设备在线离线状态推送 |
| | | var deviceOnlinePush = new MqttTopicFilter() |
| | | { |
| | | Topic = $"/user/{DB_ResidenceData.Instance.CurrentRegion.id}/app/son/session/online", |
| | | QualityOfServiceLevel = MQTTnet.Protocol.MqttQualityOfServiceLevel.AtMostOnce |
| | | }; |
| | | //appRoomRefresh:房间数据刷新通知 |
| | | var appRoomRefresh = new MqttTopicFilter() |
| | | { |
| | |
| | | pirStatus,pirStudy, |
| | | appDeviceRefresh,appHomeRefresh,appRoomRefresh,residenceChange, |
| | | topicFilterPush2, topicAlinkStatus ,mqttkeyChange, |
| | | deviceOnlinePush, |
| | | securityStatusChange}); |
| | | if (result.Items[0].ResultCode == MQTTnet.Client.Subscribing.MqttClientSubscribeResultCode.GrantedQoS0) |
| | | { |
| | |
| | | //新挤下线主题方案 收到挤下线主题 |
| | | ReceiveNotifySqueezeAsync(mMes); |
| | | } |
| | | //设备在线离线状态推送 |
| | | else if(topic == $"/user/{DB_ResidenceData.Instance.CurrentRegion.id}/app/son/session/online") |
| | | { |
| | | try |
| | | { |
| | | var mMes = Encoding.UTF8.GetString(e.ApplicationMessage.Payload); |
| | | Newtonsoft.Json.Linq.JObject pairs = Newtonsoft.Json.Linq.JObject.Parse(mMes); |
| | | var pairSid = pairs.GetValue("sid").ToString(); |
| | | var pairOnline = pairs.GetValue("online"); |
| | | if (!string.IsNullOrEmpty(pairSid.ToString())) |
| | | { |
| | | var function_online = FunctionList.List.Functions.Find((obj) => obj.sid == pairSid); |
| | | if (function_online != null){ |
| | | function_online.online = (bool)pairOnline; |
| | | HomePage.LoadEvent_RefreshDevcieOnline(function_online); |
| | | FunctionPage.UpdataOnline(function_online); |
| | | RoomPage.UpdataOnline(function_online); |
| | | } |
| | | } |
| | | |
| | | } |
| | | catch(Exception ex) |
| | | { |
| | | |
| | | } |
| | | } |
| | | //App订阅红外宝/网关遥控器添加成功通知 |
| | | else if (topic == $"/user/{DB_ResidenceData.Instance.CurrentRegion.id}/app/thing/topo/found") |
| | | { |
| | |
| | | /// 固定域名,正式环境 |
| | | /// 公共域名就近解析 |
| | | /// </summary> |
| | | public const string GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com"; |
| | | //public const string GlobalRequestHttpsHost = "https://test-gz.hdlcontrol.com";//mmmm |
| | | //public const string GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com"; |
| | | public const string GlobalRequestHttpsHost = "https://test-gz.hdlcontrol.com";//mmmm |
| | | /// <summary> |
| | | /// RegionMark |
| | | /// </summary> |
| | |
| | | //更新链接状态icon颜色 |
| | | |
| | | |
| | | |
| | | int ddd = 0; |
| | | #if DEBUG |
| | | btnResidenceName.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | |
| | | if (UserInfo.Current.VerOpenDoorPw || string.IsNullOrEmpty(UserInfo.Current.doorPasswordString)) |
| | | //if (UserInfo.Current.VerOpenDoorPw || string.IsNullOrEmpty(UserInfo.Current.doorPasswordString)) |
| | | //{ |
| | | // var page = new DoorLockUnlockPage(new Function()); |
| | | // MainPage.BasePageView.AddChidren(page); |
| | | // page.LoadView(); |
| | | // MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | //} |
| | | //else |
| | | //{ |
| | | // Control.Ins.OneKeyUnlocking(new Function(), UserInfo.Current.doorPasswordString); |
| | | //} |
| | | |
| | | ddd++; |
| | | Function function_online = FunctionList.List.GetLightList().Find((obj) => obj.sid == "0001017DB92D2602020100010101"); |
| | | if(ddd%2 == 0) |
| | | { |
| | | var page = new DoorLockUnlockPage(new Function()); |
| | | MainPage.BasePageView.AddChidren(page); |
| | | page.LoadView(); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | function_online.online = true; |
| | | } |
| | | else |
| | | { |
| | | Control.Ins.OneKeyUnlocking(new Function(), UserInfo.Current.doorPasswordString); |
| | | function_online.online = false; |
| | | } |
| | | HomePage.LoadEvent_RefreshDevcieOnline(function_online); |
| | | |
| | | |
| | | }; |
| | | #endif |
| | |
| | | UpdataFunctionStates(function); |
| | | } |
| | | |
| | | |
| | | if (!function.online) |
| | | var btnOffline = new Button() |
| | | { |
| | | var btnOffline = new Button() |
| | | { |
| | | X = btnIcon.Right, |
| | | Y = Application.GetRealWidth(16), |
| | | Height = Application.GetMinRealAverage(32), |
| | | TextID = StringId.DeviceOffline, |
| | | TextColor = CSS_Color.WarningColor, |
| | | TextSize = CSS_FontSize.PromptFontSize_FirstLevel, |
| | | TextAlignment = TextAlignment.CenterLeft |
| | | }; |
| | | view.AddChidren(btnOffline); |
| | | X = btnIcon.Right, |
| | | Y = Application.GetRealWidth(16), |
| | | Height = Application.GetMinRealAverage(32), |
| | | TextID = StringId.DeviceOffline, |
| | | TextColor = CSS_Color.WarningColor, |
| | | TextSize = CSS_FontSize.PromptFontSize_FirstLevel, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | Tag = "OnlineTag", |
| | | Visible = !function.online |
| | | }; |
| | | view.AddChidren(btnOffline); |
| | | |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | public partial class HomePage |
| | | { |
| | | /// <summary> |
| | | /// 更新设备在线状态 |
| | | /// </summary> |
| | | public static void LoadEvent_RefreshDevcieOnline(Function function) |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | if (bodyView != null) |
| | | { |
| | | foreach (var view in bodyView.functionViews) |
| | | { |
| | | if (view.Tag.ToString() == function.sid) |
| | | { |
| | | for (int i = 0; i < view.ChildrenCount; i++) |
| | | { |
| | | if (view.GetChildren(i).GetType() == typeof(Button)) |
| | | { |
| | | var btn = view.GetChildren(i) as Button; |
| | | if(btn.Tag == null) |
| | | { |
| | | continue; |
| | | } |
| | | if (btn.Tag.ToString() == function.sid) |
| | | { |
| | | if (function.online) |
| | | { |
| | | btn.UnSelectedImagePath = "Collection/Functionbg.png"; |
| | | btn.IsSelected = false; |
| | | } |
| | | else |
| | | { |
| | | btn.UnSelectedImagePath = "Collection/FunctionOfflineBg.png"; |
| | | btn.IsSelected = false; |
| | | } |
| | | } |
| | | else if (btn.Tag.ToString() == "OnlineTag") |
| | | { |
| | | btn.Visible = !function.online; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | /// <summary> |
| | | /// 更新主页天气 |
| | | /// </summary> |
| | | public static void LoadEvent_RefreshAir() |
| | |
| | | using System; |
| | | using HDL_ON.Entity; |
| | | using HDL_ON.UI.CSS; |
| | | using Shared; |
| | | |
| | | namespace HDL_ON.UI |
| | |
| | | /// <param name="updataFunction"></param> |
| | | public void UpdataStates(Function updataFunction, FrameLayout view, VerticalScrolViewLayout scrolView, Room room = null) |
| | | { |
| | | Application.RunOnMainThread((Action)(() => |
| | | Application.RunOnMainThread((() => |
| | | { |
| | | try |
| | | { |
| | |
| | | } |
| | | })); |
| | | } |
| | | |
| | | public void UpdataOnlineStatus(Function updataFunction, FrameLayout view, VerticalScrolViewLayout scrolView, Room room = null) |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | try |
| | | { |
| | | if (view == null || scrolView == null || updataFunction == null) |
| | | { |
| | | return; |
| | | } |
| | | if (!scrolView.ScrollEnabled) |
| | | { |
| | | return; |
| | | } |
| | | if (room != null) |
| | | { |
| | | if (!updataFunction.roomIds.Contains(room.roomId)) |
| | | { |
| | | return; |
| | | } |
| | | } |
| | | for (int i = 0; i < scrolView.ChildrenCount; i++) |
| | | { |
| | | if (scrolView.GetChildren(i).Tag == null || scrolView.GetChildren(i).Tag.ToString() == "") |
| | | { |
| | | continue; |
| | | } |
| | | var viewTag = scrolView.GetChildren(i).Tag.ToString(); |
| | | if (scrolView.GetChildren(i).Tag != null && viewTag == updataFunction.spk + updataFunction.sid) |
| | | { |
| | | if (scrolView.GetChildren(i).GetType() == typeof(FunctionControlZone)) { |
| | | var fcView = scrolView.GetChildren(i) as FunctionControlZone; |
| | | fcView.UpdataOnline(updataFunction.online); |
| | | } |
| | | } |
| | | } |
| | | }catch (Exception ex) |
| | | { |
| | | MainPage.Log("Function Online status error : " + ex.Message); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | } |
| | | } |
| | |
| | | using System; |
| | | using HDL_ON.Entity; |
| | | using HDL_ON.UI.CSS; |
| | | using HDL_ON.UI.Music; |
| | | using Shared; |
| | | |
| | | namespace HDL_ON.UI |
| | |
| | | public partial class FunctionControlZone : FrameLayout |
| | | { |
| | | #region 区域控件 |
| | | static FrameLayout bodyDiv; |
| | | FunctionControlZone bodyDiv; |
| | | /// <summary> |
| | | /// 功能/场景icon |
| | | /// </summary> |
| | |
| | | /// 收藏按钮 |
| | | /// </summary> |
| | | Button btnCollectionIcon; |
| | | /// <summary> |
| | | /// 离线文本 |
| | | /// </summary> |
| | | Button btnOffline; |
| | | |
| | | #endregion |
| | | |
| | | #region 区域变量 |
| | |
| | | } |
| | | LoadDiv(); |
| | | |
| | | |
| | | btnIcon.UnSelectedImagePath = $"FunctionIcon/Icon/{function.IconName}.png"; |
| | | |
| | | btnIcon.UnSelectedImagePath = $"FunctionIcon/Icon/{function.IconName}.png"; |
| | | |
| | | if (SPK.CurtainSpkList().Contains(function.spk)) |
| | | {//窗帘没有开关按钮 |
| | |
| | | if (!function.online) |
| | | { |
| | | bodyDiv.BackgroundColor = CSS_Color.PromptingColor2; |
| | | var btnOffline = new Button() |
| | | btnOffline = new Button() |
| | | { |
| | | X = Application.GetRealWidth(8 + 10 + 32), |
| | | Y = Application.GetRealHeight(28 + 24), |
| | |
| | | using System.Collections.Generic; |
| | | using HDL_ON.DriverLayer; |
| | | using HDL_ON.Entity; |
| | | using HDL_ON.UI.CSS; |
| | | using HDL_ON.UI.Music; |
| | | using Shared; |
| | | |
| | |
| | | { |
| | | public partial class FunctionControlZone |
| | | { |
| | | /// <summary> |
| | | /// 更新开关状态 |
| | | /// </summary> |
| | | /// <param name="upfunc"></param> |
| | | public static void UpdataOnOffState(Function upfunc) |
| | | { |
| | | if(bodyDiv!= null) |
| | | { |
| | | Application.RunOnMainThread(() => { |
| | | if(bodyDiv.Tag.ToString() == upfunc.sid) |
| | | { |
| | | for (var o = 0; o < bodyDiv.ChildrenCount; o++) |
| | | { |
| | | if (bodyDiv.GetChildren(o).GetType() == typeof(Button)) |
| | | { |
| | | var btn = bodyDiv.GetChildren(o) as Button; |
| | | if (btn.Tag != null) |
| | | { |
| | | if (btn.Tag.ToString() == upfunc.sid + "_Switch")// + "_DimmerBar") |
| | | { |
| | | btn.IsSelected = upfunc.trait_on_off.curValue.ToString() == "on"; |
| | | } |
| | | } |
| | | } |
| | | else if (bodyDiv.GetChildren(o).GetType() == typeof(DiyImageSeekBar)) |
| | | { |
| | | var btn = bodyDiv.GetChildren(o) as DiyImageSeekBar; |
| | | if (btn.Tag != null) |
| | | { |
| | | if (btn.Tag.ToString() == upfunc.sid + "_DimmerBar") |
| | | { |
| | | btn.Progress = Convert.ToInt32(upfunc.GetAttrState(FunctionAttributeKey.Brightness)); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | // /// <summary> |
| | | // /// 更新开关状态 |
| | | // /// </summary> |
| | | // /// <param name="upfunc"></param> |
| | | // public static void UpdataOnOffState(Function upfunc) |
| | | // { |
| | | // if(bodyDiv!= null) |
| | | // { |
| | | // Application.RunOnMainThread(() => { |
| | | // if(bodyDiv.Tag.ToString() == upfunc.sid) |
| | | // { |
| | | // for (var o = 0; o < bodyDiv.ChildrenCount; o++) |
| | | // { |
| | | // if (bodyDiv.GetChildren(o).GetType() == typeof(Button)) |
| | | // { |
| | | // var btn = bodyDiv.GetChildren(o) as Button; |
| | | // if (btn.Tag != null) |
| | | // { |
| | | // if (btn.Tag.ToString() == upfunc.sid + "_Switch")// + "_DimmerBar") |
| | | // { |
| | | // btn.IsSelected = upfunc.trait_on_off.curValue.ToString() == "on"; |
| | | // } |
| | | // } |
| | | // } |
| | | // else if (bodyDiv.GetChildren(o).GetType() == typeof(DiyImageSeekBar)) |
| | | // { |
| | | // var btn = bodyDiv.GetChildren(o) as DiyImageSeekBar; |
| | | // if (btn.Tag != null) |
| | | // { |
| | | // if (btn.Tag.ToString() == upfunc.sid + "_DimmerBar") |
| | | // { |
| | | // btn.Progress = Convert.ToInt32(upfunc.GetAttrState(FunctionAttributeKey.Brightness)); |
| | | // } |
| | | // } |
| | | // } |
| | | // } |
| | | |
| | | } |
| | | // } |
| | | // }); |
| | | // } |
| | | // } |
| | | /// <summary> |
| | | /// 更新在线状态 |
| | | /// </summary> |
| | | public void UpdataOnline(bool online) |
| | | { |
| | | if (bodyDiv != null) |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | bodyDiv.BackgroundColor = online ? CSS_Color.MainBackgroundColor : CSS_Color.PromptingColor2; |
| | | bodyDiv.btnOffline.Visible = !online; |
| | | }); |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// 更新亮度状态 |
| | | /// </summary> |
| | | /// <param name="upfunc"></param> |
| | | static void UpdataBrightnessState(Function upfunc) |
| | | { |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | |
| | | public void LoadPage(int titleId) |
| | | { |
| | | |
| | | bodyView.BackgroundColor = CSS_Color.BackgroundColor; |
| | | if (titleId == StringId.Lights) |
| | | { |
| | |
| | | { |
| | | new TopViewDiv(bodyView, Language.StringByID(titleId)).LoadTopView(); |
| | | } |
| | | |
| | | |
| | | |
| | | #if DEBUG |
| | | Button testBtn = new Button() |
| | | { |
| | | X = Application.GetRealWidth(80), |
| | | Height = Application.GetRealHeight(64), |
| | | BackgroundColor = 0xFFFF0000 |
| | | }; |
| | | bodyView.AddChidren(testBtn); |
| | | int ddd = 0; |
| | | testBtn.MouseUpEventHandler = (sender, e) => { |
| | | ddd++; |
| | | |
| | | Function function_online = FunctionList.List.GetLightList().Find((obj) => obj.sid == "0001017DB92D2602020100010101"); |
| | | if (ddd % 2 == 0) |
| | | { |
| | | function_online.online = true; |
| | | } |
| | | else |
| | | { |
| | | function_online.online = false; |
| | | } |
| | | HomePage.LoadEvent_RefreshDevcieOnline(function_online); |
| | | FunctionPage.UpdataOnline(function_online); |
| | | RoomPage.UpdataOnline(function_online); |
| | | |
| | | |
| | | }; |
| | | #endif |
| | | |
| | | /// <summary> |
| | | /// 房间内容显示区域 |
| | | /// </summary> |
| | |
| | | new ClassificaitionPublicBLL().UpdataStates(function, bodyView, functionListView); |
| | | } |
| | | |
| | | public static void UpdataOnline(Function function) |
| | | { |
| | | new ClassificaitionPublicBLL().UpdataOnlineStatus(function, bodyView, functionListView); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | { |
| | | new ClassificaitionPublicBLL().UpdataStates(function, bodyView, functionListView,room); |
| | | } |
| | | public static void UpdataOnline(Function function) |
| | | { |
| | | new ClassificaitionPublicBLL().UpdataOnlineStatus(function, bodyView, functionListView); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 加载事件列表 |
| | |
| | | funAllAreaView.btnText2.Text = areaView.btnClick.Tag.ToString(); |
| | | UserInfo.Current.logicselectedFunction = areaView.btnClick.Tag.ToString(); |
| | | ///获取单个类型(例如:灯光类。。)设备FunctionType列表<简称:spk列表> |
| | | var typeFunctionList = LogicMethod.CurrLogicMethod.GetDeviceTypeFunctionList(UserInfo.Current.logicselectedFunction); |
| | | var typeFunctionList2 = LogicMethod.CurrLogicMethod.GetDeviceTypeFunctionList(UserInfo.Current.logicselectedFunction); |
| | | ///获取单个灯光类型(例如:灯光1,灯光2。。)设备列表 |
| | | var lists2 = LogicMethod.CurrLogicMethod.GetShowDeviceList(typeFunctionList, functionList); |
| | | var lists2 = LogicMethod.CurrLogicMethod.GetShowDeviceList(typeFunctionList2, functionList); |
| | | DeviceListView(vv, lists2); |
| | | |
| | | }; |
| | |
| | | /// 固定域名,正式环境 |
| | | /// 公共域名就近解析 |
| | | /// </summary> |
| | | public const string GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com"; |
| | | //public const string GlobalRequestHttpsHost = "https://test-gz.hdlcontrol.com";//mmmm |
| | | //public const string GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com"; |
| | | public const string GlobalRequestHttpsHost = "https://test-gz.hdlcontrol.com";//mmmm |
| | | /// <summary> |
| | | /// RegionMark |
| | | /// </summary> |