public GetAllDataPointsRealTimeDataResponse GetAllDataPointsRealTimeData()
        {
            GetAllDataPointsRealTimeDataResponse response = new GetAllDataPointsRealTimeDataResponse();


            return(response);
        }
Esempio n. 2
0
        public GetAllDataPointsRealTimeDataResponse GetAllDataPointsRealTimeData()
        {
            GetAllDataPointsRealTimeDataResponse response = new GetAllDataPointsRealTimeDataResponse();

            foreach (var dataPoint in this.allDataPoints)
            {
                DataPointRealTimeDataView dataPointRealTimeDataView = new DataPointRealTimeDataView();
                dataPointRealTimeDataView.DataPointId = dataPoint.Id;

                //TODO:模拟数据;要删除模式代码
                //Random random = new Random();
                //= random.NextDouble()
                dataPointRealTimeDataView.DataPointRealTimeValue = dataPoint.RealTimeValue;

                response.AllDataPointsRealTimeData.Add(dataPointRealTimeDataView);
            }

            return(response);
        }
        public void ReadingDataPointRealTimeValue(object obj, EventArgs e)
        {
            IModbusService modbusService = IocContainerFactory.GetUnityContainer().Resolve <IModbusService>();

            lock (objReadingDataPointRealTimeValueLock)
            {
                GetAllDataPointsRealTimeDataResponse response = null;
                response = modbusService.GetAllDataPointsRealTimeData();

                if (null != response && response.ResponseSucceed)
                {
                    List <DataPointRealTimeDataView> dataPointRealTimeDataViews = response.AllDataPointsRealTimeData;
                    foreach (var dataPointRealTimeDataView in dataPointRealTimeDataViews)
                    {
                        DataPointViewModel dataPointViewModel = this.DataPoints.Find(p => p.Id == dataPointRealTimeDataView.DataPointId);
                        if (null != dataPointViewModel)
                        {
                            dataPointViewModel.RealTimeValue = dataPointRealTimeDataView.DataPointRealTimeValue;
                        }
                    }
                }
            }
        }