private ScreenModnitorData FindScreenMonitorDataFromList(List<ScreenModnitorData> monitorDataList, string scrUdid)
 {
     ScreenModnitorData data = monitorDataList.Find(a => a.ScreenUDID == scrUdid);
     if (data == null)
     {
         data = new ScreenModnitorData(scrUdid);
         _allMonitorData.AllScreenMonitorCollection.Add(data);
     }
     return data;
 }
        private void InitializeScreen(AllCOMHWBaseInfo allComBaseInfo)
        {
            _allComBaseInfo = allComBaseInfo;
            ClearScannerDic();
            if (allComBaseInfo == null || allComBaseInfo.AllInfoDict == null)
            {
                return;
            }
            string[] keys = new string[allComBaseInfo.AllInfoDict.Count];
            allComBaseInfo.AllInfoDict.Keys.CopyTo(keys, 0);
            for (int i = 0; i < keys.Length; i++)
            {
                if (allComBaseInfo.AllInfoDict[keys[i]].DisplayResult != CommonInfoCompeleteResult.OK)
                {
                    allComBaseInfo.AllInfoDict.Remove(keys[i]);
                }
            }
            _fLogService.Debug("InitializeScreen Finish Remove");
            _allMonitorData = new AllMonitorData();
            _comSenderList.Clear();
            _supportList.Clear();
            _reduInfoList.Clear();
            foreach (KeyValuePair<string, OneCOMHWBaseInfo> pair in allComBaseInfo.AllInfoDict)
            {
                string firstSenderSN = pair.Value.FirstSenderSN;
                string udid = "";
                int senderCount = -1;
                int tempCount = 0;
                for (int i = 0; i < pair.Value.LEDDisplayInfoList.Count; i++)
                {
                    List<OneScreenInSupperDisplay> list = new List<OneScreenInSupperDisplay>();
                    udid = GetScreenUdid(firstSenderSN, i);
                    ScreenModnitorData monitorData = new ScreenModnitorData(udid);
                    _allMonitorData.AllScreenMonitorCollection.Add(monitorData);
                    OneScreenInSupperDisplay oneDisplay = new OneScreenInSupperDisplay()
                    {
                        ScreenUDID = udid
                    };
                    list.Add(oneDisplay);

                    SupperDisplay supper = new SupperDisplay()
                    {
                        DisplayUDID = udid,
                        ScreenList = list
                    };
                    _supportList.Add(supper);

                    tempCount = GetCommportSenderCount(pair.Value.LEDDisplayInfoList[i]);
                    if (tempCount > senderCount)
                    {
                        senderCount = tempCount;
                    }
                    SetAutoReader(udid, pair.Key, pair.Value.LEDDisplayInfoList[i], pair.Value.ReduInfoList);
                }
                if (senderCount >= 0)
                {
                    _reduInfoList.Add(pair.Key, pair.Value.ReduInfoList);
                    _comSenderList.Add(pair.Key, senderCount + 1);
                }
            }
            _fLogService.Debug("InitializeScreen Finish _comSenderList");
            #region 获取点检标识
            if (Interlocked.Exchange(ref _isRunning, 1) == 0)
            {
                _screenPointDetectIdentify.Clear();
                string sn;
                ChipType cType;
                ChipInherentProperty chipInherentPro = new ChipInherentProperty();
                foreach (var item in allComBaseInfo.AllInfoDict)
                {
                    for (int i = 0; i < item.Value.LEDDisplayInfoList.Count; i++)
                    {
                        sn = GetScreenUdid(item.Value.FirstSenderSN, i);
                        if (_screenPointDetectIdentify.ContainsKey(sn))
                        {
                            continue;
                        }
                        cType = ReadChipType(item.Value.LEDDisplayInfoList[i], item.Key);
                        if (!chipInherentPro.ChipInherentPropertyDict.ContainsKey(cType))
                        {
                            _screenPointDetectIdentify.Add(sn, false);
                        }
                        else
                        {
                            _screenPointDetectIdentify.Add(sn, chipInherentPro.ChipInherentPropertyDict[cType].IsSupportPointDetect);
                        }
                    }
                }
                _isRunning = 0;
            }
            _fLogService.Debug("InitializeScreen Finish 点检");
            #endregion
        }
        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;
        }
Пример #4
0
 public object Clone()
 {
     ScreenModnitorData data = new ScreenModnitorData();
     if (!this.CopyTo(data))
     {
         return null;
     }
     return data;
 }