public override void DoWork() { //if (mReadRequested || !AreExplicitDependenciesComplete()) return; TestExecution().LogMessageWithTimeFromTrigger("TND Read " + Name + " started"); switch (mDataValueInstance.Type) { case DataType.Boolean: mBoolDelegate = new TNDReadRequest.BoolDelegate(HandleBoolValue); ((ReadValueFromTNDDefinition)Definition()).TNDReadRequest.AddValueListener(mBoolDelegate); break; case DataType.IntegerNumber: mWholeNumDelegate = new TNDReadRequest.WholeNumberDelegate(HandleWholeNumber); ((ReadValueFromTNDDefinition)Definition()).TNDReadRequest.AddValueListener(mWholeNumDelegate); break; case DataType.DecimalNumber: mDecNumDelegate = new TNDReadRequest.DecimalNumberDelegate(HandleDecimalNumber); ((ReadValueFromTNDDefinition)Definition()).TNDReadRequest.AddDecimalNumberListener(mDecNumDelegate); break; case DataType.NotDefined: // we shouldn't get here since this should be trapped in the ctor throw new ArgumentException("Data Type for '" + mDataValueInstance.Name + "' is not defined. Can't copy value from TND."); default: throw new ArgumentException("Can't copy value from TND to data '" + mDataValueInstance.Name + "' since data type " + mDataValueInstance.Type + " isn't supported"); } ((ReadValueFromTNDDefinition)Definition()).TNDReadRequest.Active = true; mReadRequested = true; }
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"); }