| | |
| | | } |
| | | } |
| | | |
| | | |
| | | ///保存设备备注才用gb2312,其他情况用utf8 |
| | | public static Encoding MyEncodingUTF8 = Encoding.UTF8;//Get |
| | | public static Encoding MyEncodingGB2312 |
| | |
| | | return BitConverter.ToSingle(byteTemp, 0); |
| | | } |
| | | |
| | | |
| | | static void Packet_ReceiveEvent(byte subnetID, byte deviceID, Command command, byte[] receiveBytes, string revGatewayIP) |
| | | { |
| | | try |
| | | { |
| | | if(revGatewayIP == "172.16.2.237") |
| | | { |
| | | |
| | | } |
| | | Control.controlLostCount = 0; |
| | | |
| | | switch (command) |
| | |
| | | { |
| | | if (updataObj.functionType != FunctionType.RGB) |
| | | { |
| | | var newState = receiveBytes[2] == 0 ? "off" : "on"; |
| | | if (updataObj.trait_on_off.value.ToString() == newState) |
| | | { |
| | | //状态一样,不用再刷新页面 |
| | | break; |
| | | } |
| | | if (updataObj.trait_on_off.value.ToString() == "on") |
| | | { |
| | | if (updataObj.functionType == FunctionType.Fan) |
| | |
| | | FunctionPage.UpdataStates(curtain); |
| | | HomePage.UpdataFunctionStates(curtain); |
| | | ClassificationPage.UpdataInfo(curtain); |
| | | RollingShutterPage.UpdataState(curtain); |
| | | switch (curtain.functionType) |
| | | { |
| | | case FunctionType.Curtain: |
| | | CurtainModulePage.UpdataState(curtain); |
| | | break; |
| | | case FunctionType.MotorCurtain: |
| | | MotorCurtainPage.UpdataState(curtain); |
| | | break; |
| | | case FunctionType.RollingShutter: |
| | | RollingShutterPage.UpdataState(curtain); |
| | | break; |
| | | } |
| | | } |
| | |
| | | { |
| | | case "normal": |
| | | fh.lastState = Language.StringByID(StringId.Normal); |
| | | fh.curTemp = receiveBytes[4]; |
| | | fh.trait_temp.value = receiveBytes[4]; |
| | | break; |
| | | case "day": |
| | | fh.lastState = Language.StringByID(StringId.Day); |
| | | fh.curTemp = receiveBytes[5]; |
| | | fh.trait_temp.value = receiveBytes[5]; |
| | | break; |
| | | case "night": |
| | | fh.lastState = Language.StringByID(StringId.Night); |
| | | fh.curTemp = receiveBytes[6]; |
| | | fh.trait_temp.value = receiveBytes[6]; |
| | | break; |
| | | case "timer": |
| | | fh.lastState = Language.StringByID(StringId.Auto); |
| | | if (receiveBytes[8] == 0) |
| | | { |
| | | fh.timeFlag = 0; |
| | | fh.curTemp = receiveBytes[5]; |
| | | fh.trait_temp.value = receiveBytes[5]; |
| | | } |
| | | else |
| | | { |
| | | fh.timeFlag = 1; |
| | | fh.curTemp = receiveBytes[6]; |
| | | fh.trait_temp.value = receiveBytes[6]; |
| | | } |
| | | break; |
| | | case "away": |
| | | fh.curTemp = receiveBytes[7]; |
| | | fh.trait_temp.value = receiveBytes[7]; |
| | | fh.lastState = Language.StringByID(StringId.Away); |
| | | break; |
| | | } |
| | | fh.lastState += " " + fh.curTemp + fh.tempUnitString; |
| | | fh.lastState += " " + fh.trait_temp.value + fh.tempUnitString; |
| | | RoomPage.UpdataStates(fh); |
| | | FunctionPage.UpdataStates(fh); |
| | | HomePage.UpdataFunctionStates(fh); |
| | |
| | | } |
| | | } |
| | | break; |
| | | case Command.ReadGatewayACK: |
| | | Control.VerGateway(receiveBytes); |
| | | break; |
| | | } |
| | | } |
| | | catch (Exception ex) |