Ejemplo n.º 1
0
        public TNDnTagFlagTriggerInstance(TNDnTagFlagTriggerDefinition theDefinition, TestExecution testExecution)
            : base(theDefinition, testExecution)
        {
            if (theDefinition.TNDReader == null)
            {
                throw new ArgumentException("TND Reader not defined in Flag Trigger '" + Name + "'");
            }

            mBoolDelegate = new TNDReadRequest.BoolDelegate(HandleValue);
            theDefinition.TNDReadRequest.AddValueListener(mBoolDelegate);
            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("TNDFlagTrigger " + Name + " started polling");
        }
Ejemplo n.º 2
0
        public void HandleValue(bool 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)
            {
                TNDnTagFlagTriggerDefinition defObject = (TNDnTagFlagTriggerDefinition)Definition();
                defObject.TNDReadRequest.RemoveValueListener(mBoolDelegate);
                //defObject.TNDReadRequest.SuggestGoingInActive();

                TestExecution().LogMessageWithTimeFromCreated("TNDFlagTrigger " + Name + " received 'true' flag");

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