JLChen
2020-04-03 be95e839f40eb3ddf64706b60cba6dfcf4fad5e5
Crabtree/SmartHome/UI/SimpleControl/CommonPage.cs
@@ -103,7 +103,7 @@
                    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;
@@ -122,7 +122,7 @@
                            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];
@@ -256,8 +256,8 @@
                    }
                    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) {
@@ -713,7 +713,7 @@
                            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;
                            }
@@ -1208,7 +1208,7 @@
                            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 ();
@@ -1592,7 +1592,7 @@
                        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;
@@ -2069,7 +2069,7 @@
                    //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) {
@@ -2077,24 +2077,24 @@
                    }
                    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 ());
            }
        }
@@ -2185,7 +2185,7 @@
                    outputStream.Flush ();
                }
            } catch (Exception ex) {
                Console.WriteLine ("httpListener_EventHandler" + ex.ToString ());
                Utlis.WriteLine ("httpListener_EventHandler" + ex.ToString ());
            } 
        }