File was renamed from HDL_ON/DAL/Net/CommonPage.cs |
| | |
| | | { |
| | | return; |
| | | } |
| | | HttpListener.Start(new NetWiFi().IpAddress, 6001); |
| | | HttpListener.Start(new NetWiFi().IpAddress, 6002); |
| | | HttpListener.EventHandler -= httpListener_EventHandler; |
| | | HttpListener.EventHandler += httpListener_EventHandler; |
| | | isHttpListenerStart = true; |
| | |
| | | { |
| | | case Command.ReadLightSingleLoopBrightnessACK: |
| | | case Command.SetSingleLightACK: |
| | | foreach (var function in DB_ResidenceData.residenceData.functionList.lights) |
| | | foreach (var light in DB_ResidenceData.residenceData.functionList.lights) |
| | | { |
| | | if (function.GetBusId() == subnetID + "_" + deviceID + "_" + receiveBytes[0]) |
| | | if (light.GetBusId() == subnetID + "_" + deviceID + "_" + receiveBytes[0]) |
| | | { |
| | | if (function.functionCategory == FunctionCategory.Light&& function.functionType != FunctionType.RGB) |
| | | if ( light.functionType != FunctionType.RGB) |
| | | { |
| | | var light = function as Light; |
| | | //if (receiveBytes[2] == 0 && light.on_off == "off") |
| | | //{ |
| | | // break; |
| | | //} |
| | | //if (function.functionType == "Relay") |
| | | //{ |
| | | // var relay = function as Light; |
| | | // relay.on_off = receiveBytes[2] == 0 ? "off" : "on"; |
| | | // HomePage.UpdataLightView(relay); |
| | | //} |
| | | //else if (function.functionType == "Dimmer") |
| | | //{ |
| | | //var light = function as Light; |
| | | light.on_off = receiveBytes[2] == 0 ? "off" : "on"; |
| | | if (light.on_off == "on") |
| | | { |
| | |
| | | DimmerPage.UpdataStates(light); |
| | | break; |
| | | } |
| | | //} |
| | | } |
| | | } |
| | | } |
| | | |
| | | foreach (var e in DB_ResidenceData.residenceData.functionList.electricals) |
| | | { |
| | | if (e.GetBusId() == subnetID + "_" + deviceID + "_" + receiveBytes[0]) |
| | | { |
| | | if (e.functionType == FunctionType.Fan) |
| | | { |
| | | var fan = e as Fan; |
| | | fan.on_off = receiveBytes[2] == 0 ? "off" : "on"; |
| | | if (fan.on_off == "on") |
| | | { |
| | | fan.openLevel = receiveBytes[2]; |
| | | fan.lastState = Language.StringByID(StringId.Level) + " : " + receiveBytes[2]; |
| | | } |
| | | HomePage.UpdataFunctionStates(fan); |
| | | RoomPage.UpdataStates(fan); |
| | | FunctionPage.UpdataStates(fan); |
| | | ClassificationPage.UpdataInfo(fan); |
| | | switch (fan.functionType) |
| | | { |
| | | case FunctionType.Fan: |
| | | FanPage.UpdataState(fan); |
| | | break; |
| | | case FunctionType.Socket: |
| | | |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | break; |
| | | case Command.SetLogicLoopColorACK: |
| | | case Command.ReadLogicLoopColorACK: |
| | |
| | | ac.curFanIndex = receiveBytes[10]; |
| | | ac.curTemp = receiveBytes[11]; |
| | | ac.lastState = ""; |
| | | switch (ac.curMode) |
| | | switch (ac.trait_mode.curValues.ToString()) |
| | | { |
| | | case "cool": |
| | | ac.lastState = Language.StringByID(StringId.Cool); |
| | |
| | | ac.lastState = Language.StringByID(StringId.AirSupply); |
| | | break; |
| | | } |
| | | switch (ac.curFan) |
| | | switch (ac.trait_fan.curValues.ToString()) |
| | | { |
| | | case "high": |
| | | ac.lastState += " " + Language.StringByID(StringId.HighWindSpeed); |
| | |
| | | ac.lastState += " " + Language.StringByID(StringId.Auto); |
| | | break; |
| | | } |
| | | ac.lastState += " " + ac.curTemp + "°C"; |
| | | ac.lastState += " " + ac.curTemp + ac.curTempTypeString; |
| | | RoomPage.UpdataStates(ac); |
| | | FunctionPage.UpdataStates(ac); |
| | | HomePage.UpdataFunctionStates(ac); |
| | |
| | | } |
| | | } |
| | | break; |
| | | case Command.ReadFloorHeatACK: |
| | | case Command.SetFloorHeatACK: |
| | | foreach (var fh in DB_ResidenceData.residenceData.functionList.floorHeatings) |
| | | { |
| | | if (fh.GetBusId() == subnetID + "_" + deviceID + "_" + receiveBytes[0]) |
| | | { |
| | | fh.curTempType = receiveBytes[2]; |
| | | fh.on_off = receiveBytes[1] % 2 ==0?"off":"on"; |
| | | fh.curModeIndex = receiveBytes[3]; |
| | | if (fh.modeTemp.ContainsKey("ordinary")) |
| | | { |
| | | fh.modeTemp["ordinary"]= receiveBytes[4]; |
| | | } |
| | | else |
| | | { |
| | | fh.modeTemp.Add("ordinary", receiveBytes[4]); |
| | | } |
| | | if (fh.modeTemp.ContainsKey("day")) |
| | | { |
| | | fh.modeTemp["day"] = receiveBytes[5]; |
| | | } |
| | | else |
| | | { |
| | | fh.modeTemp.Add("day", receiveBytes[5]); |
| | | } |
| | | |
| | | if (fh.modeTemp.ContainsKey("night")) |
| | | { |
| | | fh.modeTemp["night"] = receiveBytes[6]; |
| | | } |
| | | else |
| | | { |
| | | fh.modeTemp.Add("night", receiveBytes[6]); |
| | | } |
| | | |
| | | if (fh.modeTemp.ContainsKey("away")) |
| | | { |
| | | fh.modeTemp["away"] = receiveBytes[7]; |
| | | } |
| | | else |
| | | { |
| | | fh.modeTemp.Add("away", receiveBytes[7]); |
| | | } |
| | | switch (fh.curMode) |
| | | { |
| | | case "ordinary": |
| | | fh.lastState = Language.StringByID(StringId.Ordinary); |
| | | break; |
| | | case "day": |
| | | fh.lastState = Language.StringByID(StringId.Day); |
| | | break; |
| | | case "night": |
| | | fh.lastState = Language.StringByID(StringId.Night); |
| | | break; |
| | | case "timer": |
| | | fh.lastState = Language.StringByID(StringId.Auto); |
| | | if(receiveBytes[8]==0) |
| | | { |
| | | }else |
| | | { |
| | | } |
| | | break; |
| | | case "away": |
| | | fh.curTemp = receiveBytes[7]; |
| | | fh.lastState = Language.StringByID(StringId.Away); |
| | | break; |
| | | } |
| | | fh.lastState += " " + fh.curTemp + fh.curTempTypeString; |
| | | RoomPage.UpdataStates(fh); |
| | | FunctionPage.UpdataStates(fh); |
| | | HomePage.UpdataFunctionStates(fh); |
| | | ClassificationPage.UpdataInfo(fh); |
| | | FloorHeatingPage.UpdataStates(fh); |
| | | } |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | catch (Exception ex) |