示例#1
0
        public TNDnTagNumberTriggerInstance(TNDnTagNumberTriggerDefinition theDefinition, TestExecution testExecution)
            : base(theDefinition, testExecution)
        {
            mTriggerValue = theDefinition.TriggerValue;
            mAckValue     = theDefinition.AckValue;

            if (theDefinition.TNDReader == null)
            {
                throw new ArgumentException("TND Reader not defined in Number Trigger '" + Name + "'");
            }

            mIntDelegate = new TNDReadRequest.WholeNumberDelegate(HandleValue);
            theDefinition.TNDReadRequest.AddValueListener(mIntDelegate);
            theDefinition.TNDReadRequest.Active = true; // we set the request as Permanent 1/11/08 when it is created by our def object; so this should only do something the first test execution
            TestExecution().LogMessageWithTimeFromCreated("TNDNumberTrigger " + Name + " started polling");
        }
示例#2
0
        public void HandleValue(long valueFromTND)
        {
            // WARNING: don't block in here...this is called from the TNDnTagReader between each value. if we block (e.g. we used to block waiting for the flag to be cleared via a TNDnTagWrite), we can screw things up
            if (valueFromTND == mTriggerValue)
            {
                TNDnTagNumberTriggerDefinition defObject = (TNDnTagNumberTriggerDefinition)Definition();
                defObject.TNDReadRequest.RemoveValueListener(mIntDelegate);
                //defObject.TNDReadRequest.SuggestGoingInActive();

                TestExecution().LogMessageWithTimeFromCreated("TNDNumberTrigger " + Name + " received trigger value of " + valueFromTND);

                /* //TND_WRITE_HACK
                 * // turn off flag via Writer to TND
                 * defObject.TNDWriteRequest.SetBooleanValue(false);
                 * TestExecution().LogMessageWithTimeFromCreated("TNDNumberTrigger " + Name + " step 1");
                 * defObject.TNDWriteRequest.Active = true; // because it is a one-shot write, it is automatically goes Inactive after each write.
                 * TestExecution().LogMessageWithTimeFromCreated("TNDNumberTrigger " + Name + " step 2");
                 * mRequestedWrite = true;
                 * TestExecution().LogMessageWithTimeFromCreated("TNDNumberTrigger " + Name + " requested flag clearing");
                 * // */                //TND_WRITE_HACK
                mRequestedWrite = true; //TND_WRITE_HACK
            }
        }