📄 x-trigapi3.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><html><head><link rel="STYLESHEET" type="text/css" href="wrs.css"><title> Triggering API </title></head><body bgcolor="FFFFFF"><p class="navbar" align="right"><a href="index.html"><img border="0" alt="[Contents]" src="icons/contents.gif"></a><a href="x-trigAPI.html"><img border="0" alt="[Index]" src="icons/index.gif"></a><a href="x-trigAPI.html"><img border="0" alt="[Top]" src="icons/top.gif"></a><a href="x-trigAPI2.html"><img border="0" alt="[Prev]" src="icons/prev.gif"></a><a href="x-custom.html"><img border="0" alt="[Next]" src="icons/next.gif"></a></p><font face="Helvetica, sans-serif" class="sans"><h3 class="H2"><i><a name="84486">E.3 Triggering API</a></i></h3></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="84870"> </a>The following functions are used to manipulate the triggering structure, to detect the presence of a trigger, and to perform the action specified in the trigger definition: </p></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H4"><i><a name="84871">Adding a Trigger to the Trigger List</a></i></h4></font><dl class="margin"><dl class="margin"><dd><pre class="Code"><b><a name="89948">TRIGGER_ID trgAdd ( event_t event, /* event type as defined in eventP.h */ /* for WindView, if given */ int status, /* initial status (enabled/disabled) */ int contextType, /* type of context where event occurs */ UINT32 contextId, /* ID (if any) of context where event occurs */ OBJ_ID objId, /* object type, if given */ int conditional, /* flag specifying if there is a condition */ int condType, /* flag specifying if an existing condition */ /* is a variable or a function */ int * condEx1, /* pointer to conditional expression */ int condOp, /* operator (==, !=, <, <=, >, >=, |, &) */ int condEx2, /* second operand (constant) */ BOOL disable, /* flag specifying whether to disable */ /* trigger after it is hit */ TRIGGER *chain, /* flag specifying if another trigger is */ /* associated with this one */ int actionType, /* action type associated with trigger */ FUNCPTR actionFunc, /* pointer to the function */ BOOL actionDef, /* defer the action */ int actionArg /* argument passed to function if any */ ) { <i class="i">fills in the trigger struct and adds it to the trigger list; returns the trigger ID </i> }</a></b></pre></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H4"><i><a name="89954">Deleting a Trigger from the Trigger List</a></i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="85371"> </a>Triggers are deleted when they are removed from the trigger list. The function <b class="routine"><i class="routine">trgDelete</i></b><b>( )</b> also checks to see if any other triggers are still active; if none are but triggering is still active, it turns it off. Triggering introduces some overhead and should be disabled if no function is present.</p></dl><dl class="margin"><dd><pre class="Code"><b><a name="89200">STATUS trgDelete ( TRIGGER_ID trgId ) { <i class="i">delete the trigger from the table; turn triggering off if this was the last trigger and triggering is still on </i> }</a></b></pre></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H4"><i><a name="85415">Activating Triggering</a></i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="85520"> </a>Any time an event point is hit when triggering is active, a check for the presence of possible triggers is performed. This introduces overhead, so it is important to activate triggering only when necessary:</p></dl><dl class="margin"><dd><pre class="Code"><b><a name="89202">STATUS trgOn() { <i class="i">set evtAction to TRG_ACTION_IS_SET if not already set </i> }</a></b></pre></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H4"><i><a name="85670">Deactivating Triggering</a></i></h4></font><dl class="margin"><dl class="margin"><dd><pre class="Code"><b><a name="89204">void trgOff() { <i class="i">set evtAction to TRG_ACTION_IS_UNSET if it is on </i> }</a></b></pre></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H4"><i><a name="85671">Showing Information on Triggers</a></i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="85681"> </a>The following information is given:</p></dl><dl class="margin"><ul class="DashSingle" type="circle"><li><a name="85680"> </a>trigger ID </li></ul><ul class="DashSingle" type="circle"><li><a name="85685"> </a>event ID </li></ul><ul class="DashSingle" type="circle"><li><a name="85686"> </a>status </li></ul><ul class="DashSingle" type="circle"><li><a name="85687"> </a>condition </li></ul><ul class="DashSingle" type="circle"><li><a name="85688"> </a>disable trigger </li></ul><ul class="DashSingle" type="circle"><li><a name="85689"> </a>chained trigger</li></ul></dl><dl class="margin"><dd><p class="Body"><a name="85692"> </a>If <i class="textVariable">options</i> is 1 and <i class="textVariable">trgId</i> is specified, all parameters are shown for the specified trigger. If <i class="textVariable">trgId</i> is <b class="symbol_UC">NULL</b> all the triggers are shown. </p></dl><dl class="margin"><dd><pre class="Code"><b><a name="89206">STATUS trgShow ( TRIGGER_ID trgId, int options ) { <i class="i">display information on the specified trigger or on all triggers </i> }</a></b></pre></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H4"><i><a name="85749">Changing Trigger Status</a></i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="85868"> </a>Once a trigger is created by <b class="routine"><i class="routine">trgAdd</i></b><b>( )</b>, its status can be set by using the <b class="routine"><i class="routine">trgEnable</i></b><b>( )</b> function. This is the mechanism used to activate a chained trigger. A counter is also incremented to keep track of the total number of currently enabled triggers. This information is used by <b class="routine"><i class="routine">trgDisable</i></b><b>( )</b>.</p></dl><dl class="margin"><dd><pre class="Code"><b><a name="89853">STATUS trgEnable ( TRIGGER_ID trgId ) { <i class="i">enable the trigger unless the maximum number of triggers is already enabled </i> }</a></b></pre></dl><dl class="margin"><dd><p class="Body"><a name="85894"> </a>A trigger can be disabled by using <b class="routine"><i class="routine">trgDisable</i></b><b>( )</b>. This function also checks to see if there are any other triggers still active. This is done through the counter <b class="symbol_lc">trgCnt</b>. If <b class="symbol_lc">trgCnt</b> is 0 and triggering is still on, it calls <b class="routine"><i class="routine">trgOff</i></b><b>( )</b>.</p></dl><dl class="margin"><dd><pre class="Code"><b><a name="89218">STATUS trgDisable ( TRIGGER_ID trgId ) { <i class="i">turn the trigger off; if this is the last active trigger, turn triggering off. </i> }</a></b></pre></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H4"><i><a name="91161">Creating a User Event to Fire a Trigger</a></i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="91162"> </a>This routine triggers a user event. A trigger must exist and triggering must have been started with <b class="routine"><i class="routine">trgOn</i></b><b>( )</b> or from the triggering GUI to use this routine. <i class="textVariable">evtId</i> must be in the range 40000-65535.</p></dl><dl class="margin"><dd><pre class="Code"><b><a name="91163">void trgEvent ( event_t evtId /* event*/ ) { <i class="i">set a user event with the specified ID </i> }</a></b></pre></dl><dl class="margin"><dd><p class="Body"><a name="88327"> </a></p><dd><p class="Body"><a name="89871"> </a></p></dl></dl><a name="foot"><hr></a><p class="navbar" align="right"><a href="index.html"><img border="0" alt="[Contents]" src="icons/contents.gif"></a><a href="x-trigAPI.html"><img border="0" alt="[Index]" src="icons/index.gif"></a><a href="x-trigAPI.html"><img border="0" alt="[Top]" src="icons/top.gif"></a><a href="x-trigAPI2.html"><img border="0" alt="[Prev]" src="icons/prev.gif"></a><a href="x-custom.html"><img border="0" alt="[Next]" src="icons/next.gif"></a></p></body></html><!---by WRS Documentation (), Wind River Systems, Inc. conversion tool: Quadralay WebWorks Publisher 4.0.11 template: CSS Template, Jan 1998 - Jefro --->
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -