Ejemplo n.º 1
0
        void _readDviInfo_CompleteRetryRefreshDviInfoEvent(object sender, CompleteRefreshSenderDviEventArgs e)
        {
            _fLogService.Info("读取DVI数据完成,开始解析...");
            SendStatusMsg("GetDVIDataFinish");
            #region 解析发送卡数据
            if (e.IsRefreshSuccess)
            {
                _allMonitorData.CurAllSenderStatusDic = GetWorkStatusList(e.StatusDic);
                _allMonitorData.CurAllSenderDVIDic = e.RefreshRateDic;
                _allMonitorData.RedundantStateType = e.RedundantState;
                _allMonitorData.TempRedundancyDict = new SerializableDictionary<string, List<SenderRedundancyInfo>>();
                foreach (KeyValuePair<string, List<SenderRedundancyInfo>> keyvalue in _reduInfoList)
                {
                    if (keyvalue.Value == null || keyvalue.Value.Count == 0)
                    {
                        _allMonitorData.TempRedundancyDict.Add(keyvalue.Key, null);
                    }
                    else
                    {
                        _allMonitorData.TempRedundancyDict.Add(keyvalue.Key, keyvalue.Value);
                    }
                }
                _allMonitorData.CommPortData = new SerializableDictionary<string, int>();
                EquipmentInfo equipInfo = null;
                int count = 0;
                foreach (string commPort in _serverProxy.EquipmentTable.Keys)
                {
                    equipInfo = _serverProxy.EquipmentTable[commPort];
                    if (equipInfo == null
                        || equipInfo.EquipTypeCount <= 0)
                    {
                        continue;
                    }
                    if (CustomTransform.IsSystemController(equipInfo.ModuleID))
                    {
                        count = CustomTransform.GetPortNumber(equipInfo.ModuleID);
                        _allMonitorData.CommPortData.Add(commPort, count);
                    }
                }

                //枚举每个使用到的串口
                foreach (string comName in _allComBaseInfo.AllInfoDict.Keys)
                {
                    OneCOMHWBaseInfo baseInfo = _allComBaseInfo.AllInfoDict[comName];
                    //枚举每个显示屏
                    for (int i = 0; i < baseInfo.LEDDisplayInfoList.Count; i++)
                    {
                        ILEDDisplayInfo displayInfo = baseInfo.LEDDisplayInfoList[i];
                        //获取显示屏用到的发送卡
                        List<ScreenSenderAddrInfo> scrSenderAddrList;
                        displayInfo.GetScreenSenderAddrInfo(out scrSenderAddrList);
                        //从所有硬件数据中找出当前显示屏的数据
                        ScreenModnitorData monitorData = FindScreenMonitorDataFromList(_allMonitorData.AllScreenMonitorCollection, GetScreenUdid(baseInfo.FirstSenderSN, i));

                        if (monitorData != null)
                        {
                            for (int j = 0; j < scrSenderAddrList.Count; j++)
                            {
                                #region 获取每个显示屏的每张发送卡的数据

                                int senderIndex = scrSenderAddrList[j].SenderIndex;
                                SenderMonitorInfo senderMInfo = new SenderMonitorInfo();
                                senderMInfo.DeviceStatus = DeviceWorkStatus.OK;

                                senderMInfo.DeviceRegInfo = new DeviceRegionInfo();
                                senderMInfo.DeviceRegInfo.CommPort = comName;
                                senderMInfo.DeviceRegInfo.SenderIndex = (byte)senderIndex;

                                #region 设置发送卡的路径
                                senderMInfo.MappingList = GetSenderSearchMapping(i, senderIndex);
                                #endregion

                                #region 设置发送卡DVI信息
                                if (e.RefreshRateDic.ContainsKey(comName))
                                {
                                    List<ValueInfo> senderRefInfo = e.RefreshRateDic[comName];
                                    if (senderIndex < senderRefInfo.Count)
                                    {
                                        senderMInfo.IsDviConnected = senderRefInfo[senderIndex].IsValid;
                                        senderMInfo.DviRate = (int)senderRefInfo[senderIndex].Value;
                                    }
                                    else
                                    {
                                        senderMInfo.DeviceStatus = DeviceWorkStatus.Error;
                                    }
                                }
                                else
                                {
                                    senderMInfo.DeviceStatus = DeviceWorkStatus.Error;
                                }
                                #endregion

                                #region 设置发送卡网口的状态(冗余)
                                if (e.RedundantState.ContainsKey(comName))
                                {
                                    Dictionary<int, SenderRedundantStateInfo> senderReduStateDict = e.RedundantState[comName];
                                    if (senderReduStateDict.ContainsKey(senderIndex))
                                    {
                                        SenderRedundantStateInfo senderReduInfo = senderReduStateDict[senderIndex];
                                        foreach (int portIndex in senderReduInfo.RedundantStateTypeList.Keys)
                                        {
                                            PortOfSenderMonitorInfo portOfSenderInfo = new PortOfSenderMonitorInfo();
                                            portOfSenderInfo.DeviceStatus = DeviceWorkStatus.OK;
                                            #region 设置网口的路径
                                            portOfSenderInfo.MappingList = GetPortOfSenderMapping(i, senderIndex, portIndex);

                                            #endregion
                                            if (senderReduInfo.RedundantStateTypeList[portIndex] == RedundantStateType.Error)
                                            {
                                                portOfSenderInfo.IsReduState = true;
                                            }
                                            else
                                            {
                                                portOfSenderInfo.IsReduState = false;
                                            }

                                            senderMInfo.ReduPortIndexCollection.Add(portOfSenderInfo);
                                        }
                                    }
                                }
                                #endregion
                                #endregion

                                monitorData.SenderMonitorCollection.Add(senderMInfo);
                            }
                        }
                    }
                }
            }
            SendStatusMsg("ParsingDVIDataFinish");
            NotifyCompleteAllMonitor();
            #endregion
        }
Ejemplo n.º 2
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;
        }
Ejemplo n.º 3
0
 public object Clone()
 {
     SenderMonitorInfo data = new SenderMonitorInfo();
     if (!this.CopyTo(data))
     {
         return null;
     }
     return data;
 }