| | |
| | | using System; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Text; |
| | | using HDL_ON.Entity; |
| | |
| | | { |
| | | if (IsRemote)//如果是远程 |
| | | { |
| | | if(DB_ResidenceData.Instance.HomeGateway == null) |
| | | { |
| | | return; |
| | | } |
| | | if (!DB_ResidenceData.Instance.HomeGateway.gatewayStatus)//远程情况下,网关未链接服务器不能修改主页网关状态 |
| | | { |
| | | new System.Threading.Thread(() => { |
| | |
| | | /// </summary> |
| | | public void SearchLoaclGateway() |
| | | { |
| | | //2021-01-15 : 住宅没有绑定网关的时候不用搜索,并且不能链接mqtt |
| | | if(DB_ResidenceData.Instance.HomeGateway == null) |
| | | { |
| | | return; |
| | | } |
| | | var ggg = DB_ResidenceData.Instance.GatewayType == 0 ? "一端口" : "A网关"; |
| | | var ggg1 = MainPage.InternetStatus == 1 ? "4G" : "wifi"; |
| | | MainPage.Log($"搜索网关列表,网关类型:{ggg};网络类型:{ggg1}"); |
| | |
| | | /// </summary> |
| | | /// <param name="commandString"></param> |
| | | /// <param name="function"></param> |
| | | /// <param name="useRemote">是否直接使用远程发送</param> |
| | | /// <returns></returns> |
| | | public void SendWriteCommand(Function function, Dictionary<string, string> commandDictionary) |
| | | public void SendWriteCommand(Function function, Dictionary<string, string> commandDictionary, bool useRemote = false) |
| | | { |
| | | function.controlCounter++; |
| | | function.refreshTime = DateTime.Now; |
| | |
| | | MainPage.Log($"发送数据:{Newtonsoft.Json.JsonConvert.SerializeObject(commandDictionary)}"); |
| | | |
| | | //远程通讯 |
| | | if (Ins.IsRemote) |
| | | if (Ins.IsRemote || useRemote == true) |
| | | { |
| | | DAL.Server.HttpServerRequest httpServer = new DAL.Server.HttpServerRequest(); |
| | | //ALink控制、Bus控制使用同一个接口控制,由云端负责解析 |
| | |
| | | public void SwtichFunctions(bool open,List<Function> functions) |
| | | { |
| | | var count = 0; |
| | | var logString = open ? "打开" : "关闭"; |
| | | var logString = open ? "打开\r\n" : "关闭\r\n"; |
| | | List<ApiAlinkControlActionObj> actionObjs = new List<ApiAlinkControlActionObj>(); |
| | | Dictionary<string, string> d = new Dictionary<string, string>(); |
| | | d.Add(FunctionAttributeKey.OnOff, open ? "on" : "off"); |
| | | var pm = new DAL.Server.HttpServerRequest(); |
| | | foreach (var temp in functions) |
| | | { |
| | | logString += temp.spk + ":" + temp.sid; |
| | | logString += temp.spk + ":" + temp.sid + "\r\n"; |
| | | var apiControlData = temp.GetApiControlData(d); |
| | | actionObjs.Add(apiControlData); |
| | | count++; |
| | |
| | | { |
| | | if (Ins.IsRemote) |
| | | { |
| | | var pm = new DAL.Server.HttpServerRequest(); |
| | | var result = pm.ExecuteScene(scene.userSceneId); |
| | | //云端做处理发送一端口场景 |
| | | //if (DB_ResidenceData.Instance.GatewayType == 0) |
| | | //{ |
| | | // new Control_Udp().ControlBusScenes(scene); |
| | | //} |
| | | //else |
| | | { |
| | | var pm = new DAL.Server.HttpServerRequest(); |
| | | var result = pm.ExecuteScene(scene.userSceneId); |
| | | } |
| | | } |
| | | else |
| | | { |
| | |
| | | } |
| | | break; |
| | | case SPK.ElectricTV: |
| | | break;
|
| | | case SPK.ElectricTuyaAirCleaner:
|
| | | case SPK.ElectricTuyaFan:
|
| | | case SPK.ElectricTuyaWeepRobot: |
| | | case SPK.ElectricTuyaWaterValve: |
| | | //设备状态推送 |
| | | var myDevice = Stan.HdlDeviceStatuPushLogic.Current.UpdateDeviceStatu(updateTemp); |
| | | if (myDevice != null)
|
| | | {
|
| | | localObj = myDevice;
|
| | | } |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | HomePage.UpdataFunctionStates(localObj); |
| | | RoomPage.UpdataStates(localObj); |
| | | FunctionPage.UpdataStates(localObj); |
| | | ClassificationPage.UpdataInfo(localObj); |
| | | if (localObj != null)
|
| | | {
|
| | | HomePage.UpdataFunctionStates(localObj);
|
| | | RoomPage.UpdataStates(localObj);
|
| | | FunctionPage.UpdataStates(localObj);
|
| | | ClassificationPage.UpdataInfo(localObj);
|
| | | } |
| | | } |
| | | } |
| | | catch (Exception ex) |