Exemple #1
0
        }           //	end BuildAddressSpace

        public void ChangeSimulationValues()
        {
            if (m_daSimulationElement1 != null)
            {
                m_daSimulationElement1.ValueChanged(new ValueQT(m_random.Next(5000), EnumQuality.GOOD, DateTime.Now));
            }               //	end if

            if (m_daSimulationElement2 != null)
            {
                m_daSimulationElement2.ValueChanged(new ValueQT(m_random.Next(5000), EnumQuality.GOOD, DateTime.Now));
            }       //	end if
        }           //	end ChangeSimulationValues
Exemple #2
0
        public void HandleRequests()
        {
            lock (m_requestsJanitor)
            {
                foreach (MyRequest request in m_requests)
                {
                    if (request.ProgressRequestState(EnumRequestState.PENDING, EnumRequestState.INPROGRESS))
                    {
                        MyDaAddressSpaceElement element = request.AddressSpaceElement as MyDaAddressSpaceElement;
                        if (element == null)
                        {
                            request.Result = EnumResultCode.E_FAIL;
                        }
                        else
                        {
                            switch (request.TransactionType)
                            {
                            case EnumTransactionType.READ:
                                if (request.PropertyId == 0)
                                {
                                    ValueQT cacheValue = null;
                                    request.Result = (EnumResultCode)element.GetCacheValue(ref cacheValue);
                                    request.Value  = cacheValue;
                                }
                                else
                                {
                                    element.GetPropertyValue(request);
                                }                                           //  end if ... else
                                break;

                            case EnumTransactionType.WRITE:
                                if (request.PropertyId == 0)
                                {
                                    ValueQT newValue = request.Value;
                                    request.Result = (EnumResultCode)element.ValueChanged(newValue);
                                }
                                else
                                {
                                    request.Result = EnumResultCode.E_BADRIGHTS;
                                }                                           //  end if ... else
                                break;

                            default:
                                break;
                            } //  end switch
                        }     //  end if ... else
                    }         //  end if ... else
                    request.Complete();
                }             //  end forech
                m_requests.Clear();
            }                 //  end lock
        }                     //  end HandleRequests