| | |
| | | foreach (var bin in usefullBytes) { |
| | | pushBytesString += bin + ","; |
| | | } |
| | | Console.WriteLine (pushBytesString); |
| | | Utlis.WriteLine (pushBytesString); |
| | | #endif |
| | | if (DeviceList.Find ((l) => { return l.SubnetID == subnetID && l.DeviceID == deviceID; }) != null) { |
| | | return; |
| | |
| | | continue; |
| | | } |
| | | DeviceType deviceType_wireless = (DeviceType)(usefullBytes [i] * 256 + usefullBytes [i + 1]); |
| | | Console.WriteLine (deviceType_wireless.ToString ()); |
| | | Utlis.WriteLine (deviceType_wireless.ToString ()); |
| | | if (noRemake || MyEncodingGB2312.GetString (usefullBytes, 2, 20).Trim ('\0') == "") { |
| | | byte [] ddd = CommonPage.MyEncodingGB2312.GetBytes (deviceType_wireless.ToString () + "-" + subnetID.ToString () + "-" + deviceID.ToString ()); |
| | | byte [] newddd = new byte [20]; |
| | |
| | | } |
| | | break; |
| | | case Command.SetSingleLightACK: |
| | | //Console.WriteLine ($"Command.SetSingleLightACK: subnetID:{subnetID} deviceID:{deviceID} 回路:{usefullBytes [0]}"); |
| | | //Console.WriteLine ("Command.SetSingleLightACK"); |
| | | //Utlis.WriteLine ($"Command.SetSingleLightACK: subnetID:{subnetID} deviceID:{deviceID} 回路:{usefullBytes [0]}"); |
| | | //Utlis.WriteLine ("Command.SetSingleLightACK"); |
| | | foreach (var room in Room.Lists) { |
| | | var common = room.DeviceList.Find ((obj) => obj.CommonLoopID == subnetID.ToString () + "_" + deviceID.ToString () + "_" + usefullBytes [0].ToString ()); |
| | | if (common != null) { |
| | |
| | | case "DISPMODE": |
| | | if (7 <= backResult [1].Length) { |
| | | music.playMode = int.Parse (backResult [1].Substring (6, 1)); |
| | | System.Console.WriteLine ("DISPMODE=====" + music.playMode); |
| | | Utlis.WriteLine ("DISPMODE=====" + music.playMode); |
| | | } |
| | | break; |
| | | } |
| | |
| | | continue; |
| | | } |
| | | deviceType = (DeviceType)(usefullBytes [iReadDeviceModulACK] * 256 + usefullBytes [iReadDeviceModulACK + 1]); |
| | | Console.WriteLine (deviceType.ToString ()); |
| | | Utlis.WriteLine (deviceType.ToString ()); |
| | | string devcieTempName = MyEncodingGB2312.GetString (usefullBytes, 2, 20).Trim ('\0'); |
| | | if (notHasRemake || MyEncodingGB2312.GetString (usefullBytes, 2, 20).Trim ('\0') == "") { |
| | | devcieTempName = deviceType.ToString ().Replace (DeviceType.Sensor.ToString (), "") + "-" + deviceID.ToString (); |
| | |
| | | wirelessPanelButtonKey.Name = MyEncodingGB2312.GetString (usefullBytes, 3, 20).Trim ('\0'); |
| | | wirelessPanelButtonKey.Mode = usefullBytes [23]; |
| | | ButtonBkeyModelList.Add (wirelessPanelButtonKey.Mode); |
| | | System.Console.WriteLine ("读取面板按键:回路号:" + wirelessPanelButtonKey.LoopID + " 模式:" + wirelessPanelButtonKey.Mode); |
| | | Utlis.WriteLine ("读取面板按键:回路号:" + wirelessPanelButtonKey.LoopID + " 模式:" + wirelessPanelButtonKey.Mode); |
| | | IO.FileUtils.SaveEquipmentMessage (wirelessPanelButtonKey, wirelessPanelButtonKey.LoopID.ToString ()); |
| | | #endregion |
| | | break; |
| | |
| | | //01 01 59(+30) 02 0D 03 64 00 01 |
| | | break; |
| | | case Command.AssignedAddressACK: |
| | | Console.WriteLine (usefullBytes [0].ToString ()); |
| | | Utlis.WriteLine (usefullBytes [0].ToString ()); |
| | | if (usefullBytes [0] == 3) { |
| | | dt = DateTime.Now; |
| | | } else if (usefullBytes [0] == 4) { |
| | |
| | | } |
| | | break; |
| | | case Command.Remote3thACK: |
| | | Console.WriteLine (usefullBytes [0]); |
| | | Utlis.WriteLine (usefullBytes [0]); |
| | | break; |
| | | case Command.DownloadInfraredACK: |
| | | string loopID_IM = usefullBytes [0] < 10 ? "0" + usefullBytes [0].ToString () : usefullBytes [0].ToString (); |
| | | if ((InfraredType)usefullBytes [2] != InfraredType.AC) { |
| | | if ((InfraredType)usefullBytes [2] == InfraredType.NULL) { |
| | | Console.WriteLine ("NULL-------------"); |
| | | Utlis.WriteLine ("NULL-------------"); |
| | | } |
| | | string filePath = "Equipment_InfraredMode_" + subnetID + "_" + deviceID + "_" + loopID_IM; |
| | | InfraredMode im = Newtonsoft.Json.JsonConvert.DeserializeObject<InfraredMode> (CommonPage.MyEncodingUTF8.GetString (IO.FileUtils.ReadFile (filePath))); |
| | | im.InfraredType = (InfraredType)usefullBytes [2]; |
| | | Console.WriteLine (im.InfraredType.ToString () + "------------------------------------------------------"); |
| | | Utlis.WriteLine (im.InfraredType.ToString () + "------------------------------------------------------"); |
| | | IO.FileUtils.SaveEquipmentMessage (im, im.LoopID.ToString ()); |
| | | } |
| | | break; |
| | | } |
| | | } catch (Exception ex) { |
| | | Console.WriteLine ("Packet_ReceiveEvent:" + ex.ToString ()); |
| | | Utlis.WriteLine ("Packet_ReceiveEvent:" + ex.ToString ()); |
| | | } |
| | | |
| | | } |
| | |
| | | outputStream.Flush (); |
| | | } |
| | | } catch (Exception ex) { |
| | | Console.WriteLine ("httpListener_EventHandler" + ex.ToString ()); |
| | | Utlis.WriteLine ("httpListener_EventHandler" + ex.ToString ()); |
| | | } |
| | | } |
| | | |