コード例 #1
0
        private CompletedMonitorCallbackParams GetCompletedMonitorCallbackParams()
        {
            CompletedMonitorCallbackParams param = new CompletedMonitorCallbackParams();

            AllMonitorData monitorData = new AllMonitorData();
            param.MonitorData = monitorData;

            int createScreenCount = 3;
            int senderCount = 2;
            int scannerCount = 2;
            int fansCount = 2;
            int powerCount = 2;
            int cableCount = 1;
            int functionCount = 2;
            int peripheralCount = 2;
            int comFunctionCount = 2;
            const int deconcentratorCount = 1;
            for (int scrIndex = 0; scrIndex < createScreenCount; scrIndex++)
            {
                string scrUDID = "1306280000015920-" + scrIndex.ToString("X2");
                ScreenModnitorData scrMonitorData = new ScreenModnitorData(scrUDID);

                for (int senderIndex = 0; senderIndex < senderCount; senderIndex++)
                {
            #region 添加发送卡数据
                    SendStatusMsg("StartReadDVIData" + senderIndex);
                    SenderMonitorInfo sendInfo = new SenderMonitorInfo();
                    sendInfo.DeviceStatus = DeviceWorkStatus.OK;
                    sendInfo.MappingList.Add(new DeviceSearchMapping(HWDeviceType.Sender, senderIndex));

                    sendInfo.IsDviConnected = true;
                    sendInfo.DviRate = 60;
                    sendInfo.ReduPortIndexCollection.Add(new PortOfSenderMonitorInfo());
                    sendInfo.ReduPortIndexCollection.Add(new PortOfSenderMonitorInfo());
                    scrMonitorData.SenderMonitorCollection.Add(sendInfo);
                    SendStatusMsg("FinishReadDVIData" + senderIndex);
            #endregion

            #region 分线器数据
                    scrMonitorData.DeconcentratorCollection = new List<DeconcentratorMonitorInfo>();
                    for (int deconcentratoIndex = 0; deconcentratoIndex < deconcentratorCount; deconcentratoIndex++)
                    {
                        SendStatusMsg("Start分线器数据Data" + deconcentratoIndex);
                        DeconcentratorMonitorInfo deconcentratorInfo = new DeconcentratorMonitorInfo();
                        deconcentratorInfo.DeviceStatus = DeviceWorkStatus.OK;
                        deconcentratorInfo.MappingList.Add(new DeviceSearchMapping(HWDeviceType.Sender, senderIndex));
                        if (deconcentratoIndex < 1)
                            deconcentratorInfo.MappingList.Add(new DeviceSearchMapping(HWDeviceType.PortOfSender, 0));
                        else
                            deconcentratorInfo.MappingList.Add(new DeviceSearchMapping(HWDeviceType.PortOfSender, 1));
                        scrMonitorData.DeconcentratorCollection.Add(deconcentratorInfo);
                        SendStatusMsg("End分线器数据Data" + deconcentratoIndex);
                    }
            #endregion
                    for (int scannerIndex = 0; scannerIndex < scannerCount; scannerIndex++)
                    {
            #region 添加接收卡数据
                        SendStatusMsg("Start接收卡数据Data" + scannerIndex);
                        ScannerMonitorInfo scannerInfo = new ScannerMonitorInfo();
                        scannerInfo.DeviceStatus = DeviceWorkStatus.OK;

                        scannerInfo.MappingList.Add(new DeviceSearchMapping(HWDeviceType.Sender, senderIndex));
                        if (scannerIndex < 50)
                        {
                            scannerInfo.MappingList.Add(new DeviceSearchMapping(HWDeviceType.PortOfSender, 0));
                        }
                        else
                        {
                            scannerInfo.MappingList.Add(new DeviceSearchMapping(HWDeviceType.PortOfSender, 1));
                        }
                        scannerInfo.MappingList.Add(new DeviceSearchMapping(HWDeviceType.Scanner, scannerIndex));

                        scannerInfo.Temperature = 25.5f;
                        scannerInfo.Voltage = 5.5f;
                        scrMonitorData.ScannerMonitorCollection.Add(scannerInfo);
                        SendStatusMsg("End接收卡数据Data" + scannerIndex);
            #endregion

            #region 添加监控卡数据
                        //MonitorCardMonitorInfo
                        SendStatusMsg("Start监控卡数据Data" + scannerIndex);
                        MonitorCardMonitorInfo monitorCardInfo = new MonitorCardMonitorInfo();
                        monitorCardInfo.DeviceStatus = DeviceWorkStatus.OK;

                        monitorCardInfo.MappingList.Add(new DeviceSearchMapping(HWDeviceType.Sender, senderIndex));
                        if (scannerIndex < 50)
                        {
                            monitorCardInfo.MappingList.Add(new DeviceSearchMapping(HWDeviceType.PortOfSender, 0));
                        }
                        else
                        {
                            monitorCardInfo.MappingList.Add(new DeviceSearchMapping(HWDeviceType.PortOfSender, 1));
                        }
                        monitorCardInfo.MappingList.Add(new DeviceSearchMapping(HWDeviceType.Scanner, scannerIndex));
                        monitorCardInfo.MappingList.Add(new DeviceSearchMapping(HWDeviceType.MonitorCard, 0));

                        monitorCardInfo.TemperatureUInfo = new MCTemperatureUpdateInfo() { IsUpdate = true, Temperature = 20.5f };
                        monitorCardInfo.HumidityUInfo = new MCHumidityUpdateInfo() { IsUpdate = true, Humidity = 80.5f };
                        monitorCardInfo.SmokeUInfo = new MCSmokeUpdateInfo() { IsUpdate = true, IsSmokeAlarm = false };
                        monitorCardInfo.CabinetDoorUInfo = new MCDoorUpdateInfo() { IsUpdate = true, IsDoorOpen = true };

                        SendStatusMsg("End监控卡数据Data" + scannerIndex);
            #region 风扇数据
                        SendStatusMsg("Start风扇数据Data" + scannerIndex);
                        MCFansUpdateInfo mcFansUpdateInfo = new MCFansUpdateInfo();
                        mcFansUpdateInfo.IsUpdate = true;
                        mcFansUpdateInfo.FansMonitorInfoCollection = new SerializableDictionary<int, int>();
                        for (int fansIndex = 0; fansIndex < fansCount; fansIndex++)
                        {
                            int speed = 3000;
                            if (scannerIndex < 50)
                            {
                                speed = 3500;
                            }
                            mcFansUpdateInfo.FansMonitorInfoCollection.Add(fansIndex, speed);
                        }
                        monitorCardInfo.FansUInfo = mcFansUpdateInfo;
                        SendStatusMsg("End风扇数据Data" + scannerIndex);
            #endregion

            #region 电源数据
                        SendStatusMsg("Start电源数据Data" + scannerIndex);
                        MCPowerUpdateInfo mcPowerUInfo = new MCPowerUpdateInfo();
                        mcPowerUInfo.IsUpdate = true;
                        mcPowerUInfo.PowerMonitorInfoCollection = new SerializableDictionary<int,float>();
                        for (int pwoerIndex = 0; pwoerIndex < powerCount; pwoerIndex++)
                        {
                            float power = 5.0f;
                            if (scannerIndex < 50)
                            {
                                power = 4.5f;
                            }

                            mcPowerUInfo.PowerMonitorInfoCollection.Add(pwoerIndex, power);
                        }
                        monitorCardInfo.PowerUInfo = mcPowerUInfo;
                        SendStatusMsg("End电源数据Data" + scannerIndex);
            #endregion

            #region 排线数据
                        SendStatusMsg("Start排线数据Data" + scannerIndex);
                        List<SocketCableMonitorInfo> socketCableInfoCollection = new List<SocketCableMonitorInfo>();
                        for (int cableIndex = 0; cableIndex < cableCount; cableIndex++)
                        {
                            SocketCableMonitorInfo cableInfo = new SocketCableMonitorInfo();
                            cableInfo.DeviceStatus = DeviceWorkStatus.OK;

                            cableInfo.MappingList.Add(new DeviceSearchMapping(HWDeviceType.Sender, senderIndex));
                            if (scannerIndex < 50)
                            {
                                cableInfo.MappingList.Add(new DeviceSearchMapping(HWDeviceType.PortOfSender, 0));
                            }
                            else
                            {
                                cableInfo.MappingList.Add(new DeviceSearchMapping(HWDeviceType.PortOfSender, 1));
                            }
                            cableInfo.MappingList.Add(new DeviceSearchMapping(HWDeviceType.Scanner, scannerIndex));
                            cableInfo.MappingList.Add(new DeviceSearchMapping(HWDeviceType.MonitorCard, 0));
                            cableInfo.MappingList.Add(new DeviceSearchMapping(HWDeviceType.SocketOfMonitorCard, cableIndex));
                            for (int groupIndex = 0; groupIndex < 8; groupIndex++)
                            {
                                List<SocketCableStatus> oneGroupStatusList = new List<SocketCableStatus>();
                                SocketCableStatus cableStatus = new SocketCableStatus();
                                cableStatus.CableType = SocketCableType.ABCD_Signal;
                                cableStatus.IsCableOK = true;
                                oneGroupStatusList.Add(cableStatus);

                                cableStatus = new SocketCableStatus();
                                cableStatus.CableType = SocketCableType.CTRL_Signal;
                                cableStatus.IsCableOK = true;
                                oneGroupStatusList.Add(cableStatus);

                                cableStatus = new SocketCableStatus();
                                cableStatus.CableType = SocketCableType.DCLK_Signal;
                                cableStatus.IsCableOK = true;
                                oneGroupStatusList.Add(cableStatus);

                                cableStatus = new SocketCableStatus();
                                cableStatus.CableType = SocketCableType.LAT_Signal;
                                cableStatus.IsCableOK = true;
                                oneGroupStatusList.Add(cableStatus);

                                cableStatus = new SocketCableStatus();
                                cableStatus.CableType = SocketCableType.OE_Signal;
                                cableStatus.IsCableOK = false;
                                oneGroupStatusList.Add(cableStatus);

                                cableStatus = new SocketCableStatus();
                                cableStatus.CableType = SocketCableType.Red_Signal;
                                cableStatus.IsCableOK = false;
                                oneGroupStatusList.Add(cableStatus);

                                cableStatus = new SocketCableStatus();
                                cableStatus.CableType = SocketCableType.Green_Signal;
                                cableStatus.IsCableOK = false;
                                oneGroupStatusList.Add(cableStatus);

                                cableStatus = new SocketCableStatus();
                                cableStatus.CableType = SocketCableType.Blue_Signal;
                                cableStatus.IsCableOK = false;
                                oneGroupStatusList.Add(cableStatus);

                                cableStatus = new SocketCableStatus();
                                cableStatus.CableType = SocketCableType.VRed_Signal;
                                cableStatus.IsCableOK = false;
                                oneGroupStatusList.Add(cableStatus);

                                cableInfo.SocketCableInfoDict.Add(groupIndex, oneGroupStatusList);

                            }
                            socketCableInfoCollection.Add(cableInfo);
                            monitorCardInfo.SocketCableUInfo = new MCSocketCableUpdateInfo() { IsUpdate = true, SocketCableInfoCollection = socketCableInfoCollection };
                        }
                        SendStatusMsg("End排线数据Data" + scannerIndex);
            #endregion

                        scrMonitorData.MonitorCardInfoCollection.Add(monitorCardInfo);
            #endregion
                    }

                    for (int functionIndex = 0; functionIndex < functionCount; functionIndex++)
                    {
                        SendStatusMsg("Start多功能卡数据Data" + functionIndex);
            #region 添加网口上的多功能卡
                        FunctionCardMonitorInfo functionInfo = new FunctionCardMonitorInfo();
                        functionInfo.PeripheralInfoDict = new SerializableDictionary<int, PeripheralMonitorBaseInfo>();
                        functionInfo.DeviceStatus = DeviceWorkStatus.OK;

                        functionInfo.MappingList.Add(new DeviceSearchMapping(HWDeviceType.Sender, senderIndex));
                        functionInfo.MappingList.Add(new DeviceSearchMapping(HWDeviceType.PortOfSender, 1));
                        functionInfo.MappingList.Add(new DeviceSearchMapping(HWDeviceType.FunctionCard, functionIndex));

                        for (int sensorIndex = 0; sensorIndex < peripheralCount; sensorIndex++)
                        {
                            PeripheralMonitorBaseInfo sensorInfo;
                            if (sensorIndex <= 2)
                            {
                                sensorInfo = new LightSensorMonitorInfo() { DeviceStatus = DeviceWorkStatus.OK, Lux = 280 };
                            }
                            else
                            {
                                sensorInfo = new TemperatureSensorMonitorInfo() { DeviceStatus = DeviceWorkStatus.OK, Tempearture = 18.5f };
                            }
                            functionInfo.PeripheralInfoDict.Add(sensorIndex, sensorInfo);
                        }
                        SendStatusMsg("End多功能卡数据Data" + functionIndex);
                        scrMonitorData.FunctionCardInfoCollection.Add(functionInfo);
            #endregion
                    }

                }
                monitorData.AllScreenMonitorCollection.Add(scrMonitorData);
            }

            //for (int comFuncIndex = 0; comFuncIndex < comFunctionCount; comFuncIndex++ )
            //{
            //    #region 添加串口上的多功能卡
            //    FunctionCardMonitorInfo functionInfo = new FunctionCardMonitorInfo();
            //    functionInfo.DeviceStatus = DeviceWorkStatus.OK;

            //    functionInfo.MappingList.Add(new DeviceSearchMapping(HWDeviceType.FunctionCard, comFuncIndex));

            //    for (int sensorIndex = 0; sensorIndex < sensorCount; sensorIndex++)
            //    {
            //        LightSensorMonitorInfo sensorInfo = new LightSensorMonitorInfo();
            //        sensorInfo.MappingList.Add(new DeviceSearchMapping(HWDeviceType.FunctionCard, comFuncIndex));
            //        sensorInfo.MappingList.Add(new DeviceSearchMapping(HWDeviceType.LightSensor, 0));

            //        sensorInfo.Birghtness = 2600;
            //        functionInfo.LightSensorInfoDict.Add(sensorIndex, sensorInfo);
            //    }
            //    #endregion
            //}

            return param;
        }
コード例 #2
0
 public override object Clone()
 {
     MCFansUpdateInfo data = new MCFansUpdateInfo();
     if (!this.CopyTo(data))
     {
         return null;
     }
     return data;
 }