Studio:AutoScript: Difference between revisions
No edit summary |
No edit summary |
||
Line 13: | Line 13: | ||
= Automation API = | = Automation API = | ||
== | == ascript == | ||
When creating a script, the user types in Ascript followed by dot '.' to get Autosense to display. The user may select methods to be used within his script. The user may access property data within his script. this API is the definitive API for Autosense. The following table outlines the main objects and collections available to the user. | When creating a script, the user types in Ascript followed by dot '.' to get Autosense to display. The user may select methods to be used within his script. The user may access property data within his script. this API is the definitive API for Autosense. The following table outlines the main objects and collections available to the user. | ||
Line 23: | Line 23: | ||
| bgcolor="#66ff99" | '''Description'''<br> | | bgcolor="#66ff99" | '''Description'''<br> | ||
|- | |- | ||
| [[# | | [[#ascript.Arguments|Arguments]] | ||
| Collection | | Collection | ||
| Collection of arguments. | | Collection of arguments. | ||
|- | |- | ||
| [[# | | [[#ascript.Constants|Constants]] | ||
| Collection | | Collection | ||
| Collection of constants. | | Collection of constants. | ||
|- | |- | ||
| [[# | | [[#ascript.Database|Database]] | ||
| valign="top" align="left" width="150" | Object | | valign="top" align="left" width="150" | Object | ||
| Database settings. | | Database settings. | ||
|- | |- | ||
| [[ | | [[ascript.Functions|Functions]] | ||
| Collection | | Collection | ||
| Collection of functions. | | Collection of functions. | ||
Line 55: | Line 55: | ||
| Displays a model message box dialog. | | Displays a model message box dialog. | ||
|- | |- | ||
| [[ | | [[ascript.Messages|Messages]] | ||
| Collection | | Collection | ||
| Collection of messages. | | Collection of messages. | ||
Line 79: | Line 79: | ||
| Time to pause (in milliseconds). Allowable range is 0 -1440000 (24 hours). | | Time to pause (in milliseconds). Allowable range is 0 -1440000 (24 hours). | ||
|- | |- | ||
| [[# | | [[#ascript.TestUnits|Test Units]] | ||
| Collection | | Collection | ||
| Collection of test units. | | Collection of test units. | ||
|- | |- | ||
| [[# | | [[#ascript.Timers|Timers]] | ||
| Collection | | Collection | ||
| Collection of timers. | | Collection of timers. | ||
Line 98: | Line 98: | ||
<br> | <br> | ||
=== | === ascript.Arguments<br> === | ||
The Arguments collection manages a list of [[# | The Arguments collection manages a list of [[#ascript.Arguments.Item|Arguments]] passed to a script which has been invoked via one of the following methods of the Studio Object Model's File object: | ||
<br> | <br> | ||
* RunBlocking([arg1], [arg2], ...) | * RunBlocking([arg1], [arg2], ...) | ||
Line 118: | Line 118: | ||
|- | |- | ||
| valign="top" align="left" width="150" | | | valign="top" align="left" width="150" | | ||
[[# | [[#ascript.Arguments.Item|Object]] '''Item''' (<br> Integer index<br>''')''' | ||
| valign="top" | Method<br> | | valign="top" | Method<br> | ||
Line 124: | Line 124: | ||
|- | |- | ||
| valign="top" align="left" width="150" | | | valign="top" align="left" width="150" | | ||
[[# | [[#ascript.Arguments.Item|Object]] '''Item''' (<br> String name<br>''')''' | ||
| valign="top" | Method<br> | | valign="top" | Method<br> | ||
Line 132: | Line 132: | ||
|} | |} | ||
==== <br> | ==== <br>ascript.Arguments.Item<br> ==== | ||
The ascript [[# | The ascript [[#ascript.Arguments|Arguments]] Collection's Item() method returns a Argument Object. | ||
{| cellspacing="0" cellpadding="10" width="100%" border="1" | {| cellspacing="0" cellpadding="10" width="100%" border="1" | ||
Line 157: | Line 157: | ||
<br> | <br> | ||
=== | === ascript.Constants<br> === | ||
The Constants collection contains [[# | The Constants collection contains [[#ascript.Constants.Item|Constants]] objects that represent all constants in C/C++ source code compiled by the STRIDE compiler. Constants include all #define symbols and enumerated constants. | ||
{| cellspacing="0" cellpadding="10" width="100%" border="1" | {| cellspacing="0" cellpadding="10" width="100%" border="1" | ||
Line 176: | Line 176: | ||
|- | |- | ||
| valign="top" align="left" width="150" | | | valign="top" align="left" width="150" | | ||
[[# | [[#ascript.Constants.Item|Object]] '''Item''' (<br> Integer index<br>''')''' | ||
| valign="top" | Method<br> | | valign="top" | Method<br> | ||
Line 182: | Line 182: | ||
|- | |- | ||
| valign="top" align="left" width="150" | | | valign="top" align="left" width="150" | | ||
[[# | [[#ascript.Constants.Item|Object]] '''Item''' (<br> String name<br>''')''' | ||
| valign="top" | Method<br> | | valign="top" | Method<br> | ||
Line 192: | Line 192: | ||
<br> | <br> | ||
==== <br> | ==== <br>ascript.Constants.Item<br> ==== | ||
The ascript [[# | The ascript [[#ascript.Constants|Constants]] Collection's Item() method returns a Constant object. | ||
{| cellspacing="0" cellpadding="10" width="100%" border="1" | {| cellspacing="0" cellpadding="10" width="100%" border="1" | ||
Line 209: | Line 209: | ||
<br> | <br> | ||
=== <br> | === <br>ascript.Database === | ||
The Database object represents the currently-loaded STRIDE database managed by | The Database object represents the currently-loaded STRIDE database managed by ascript. You can combine the values of the database path and name to construct a fully-qualified filename. For example: | ||
var dbFullPath = ascript.Database.Path + "\\" + ascript.Database.Name; | var dbFullPath = ascript.Database.Path + "\\" + ascript.Database.Name; | ||
Line 232: | Line 232: | ||
<br> | <br> | ||
=== | === ascript.Functions<br> === | ||
The Functions collection represents all captured [[# | The Functions collection represents all captured [[#ascript.Functions.Item|Function]] interfaces in the active database. | ||
{| cellspacing="0" cellpadding="10" width="100%" border="1" | {| cellspacing="0" cellpadding="10" width="100%" border="1" | ||
Line 251: | Line 251: | ||
|- | |- | ||
| valign="top" align="left" width="150" | | | valign="top" align="left" width="150" | | ||
[[# | [[#ascript.Functions.Item|Object]] '''Item''' (<br> Integer index<br>''')''' | ||
| valign="top" | Method<br> | | valign="top" | Method<br> | ||
| valign="top" | Retrieves the function at the given index. An exception is thrown if the index is out of range.<br> | | valign="top" | Retrieves the function at the given index. An exception is thrown if the index is out of range.<br> | ||
|- | |- | ||
| valign="top" align="left" width="150" | | | valign="top" align="left" width="150" | | ||
[[# | [[#ascript.Functions.Item|Object]] '''Item''' (<br> String name<br>''')''' | ||
| valign="top" | Method<br> | | valign="top" | Method<br> | ||
| valign="top" | Retrieves the function with the given name. A null value is returned if there is no function with the given name.<br> | | valign="top" | Retrieves the function with the given name. A null value is returned if there is no function with the given name.<br> | ||
Line 262: | Line 262: | ||
=== | === ascript.Functions.Item === | ||
The Function object represents a captured function interface in the currently active STRIDE database. A Function object always exists as a member of the [[# | The Function object represents a captured function interface in the currently active STRIDE database. A Function object always exists as a member of the [[#ascript.Functions|Functions]] collection. | ||
{| cellspacing="0" cellpadding="10" width="100%" border="1" | {| cellspacing="0" cellpadding="10" width="100%" border="1" | ||
Line 276: | Line 276: | ||
| Function's name. | | Function's name. | ||
|- | |- | ||
| [[# | | [[#ascript.Functions.Item.Owner|Owner]] | ||
| Property,<br>'''Read-only''',<br>Object | | Property,<br>'''Read-only''',<br>Object | ||
| Function's owner object. The owner object provides access to properties and methods used by the owner-side of the function interface. The owner-side of the interface is used by the implementor of the function. | | Function's owner object. The owner object provides access to properties and methods used by the owner-side of the function interface. The owner-side of the interface is used by the implementor of the function. | ||
Line 288: | Line 288: | ||
| Contains the string "Function". | | Contains the string "Function". | ||
|- | |- | ||
| [[# | | [[#ascript.Functions.Item.User|User]] | ||
| Property<br>'''Read-Only''',<br>Object | | Property<br>'''Read-Only''',<br>Object | ||
| Function's user object. The user object provides access to properties and methods used by the user-side of the function interface. The user-side of the interface is used by the caller of the function. | | Function's user object. The user object provides access to properties and methods used by the user-side of the function interface. The user-side of the interface is used by the caller of the function. | ||
Line 295: | Line 295: | ||
<br> | <br> | ||
==== | ==== ascript.Functions.Item.Owner ==== | ||
The Function Owner object represents the Owner (callee) side of a function. The Owner object is used to implement a function in script that can be called through the STRIDE Runtime. The Function Owner object is reachable from a [[# | The Function Owner object represents the Owner (callee) side of a function. The Owner object is used to implement a function in script that can be called through the STRIDE Runtime. The Function Owner object is reachable from a [[#ascript.Functions.Item|Function]] object's owner property. | ||
{| cellspacing="0" cellpadding="10" width="100%" border="1" | {| cellspacing="0" cellpadding="10" width="100%" border="1" | ||
Line 360: | Line 360: | ||
<br> | <br> | ||
==== | ==== ascript.Functions.Item.User ==== | ||
The Function User object represents the User (caller) side of a function. The User object is used to call a function through the STRIDE Runtime. The Function User object is reachable from a [[# | The Function User object represents the User (caller) side of a function. The User object is used to call a function through the STRIDE Runtime. The Function User object is reachable from a [[#ascript.Functions.Item|Function]] object's User property. | ||
{| cellspacing="0" cellpadding="10" width="100%" border="1" | {| cellspacing="0" cellpadding="10" width="100%" border="1" | ||
|- | |- | ||
Line 456: | Line 456: | ||
<br> | <br> | ||
=== <br> | === <br>ascript.Messages<br> === | ||
The Messages Collection is a collection of captured [[# | The Messages Collection is a collection of captured [[#ascript.Messages.Item|Message]] objects. <br> | ||
{| cellspacing="0" cellpadding="10" width="100%" border="1" | {| cellspacing="0" cellpadding="10" width="100%" border="1" | ||
Line 475: | Line 475: | ||
|- | |- | ||
| valign="top" align="left" width="150" | | | valign="top" align="left" width="150" | | ||
[[# | [[#ascript.Messages.Item|Object]] '''Item '''(<br> Integer index<br>) | ||
| valign="top" | Method<br> | | valign="top" | Method<br> | ||
Line 483: | Line 483: | ||
<br> | <br> | ||
==== <br> | ==== <br>ascript.Messages.Item<br> ==== | ||
The Message object represents a captured message interface in the currently active STRIDE database. A Message object is always a member of the [[# | The Message object represents a captured message interface in the currently active STRIDE database. A Message object is always a member of the [[#ascript.Messages|Messages]] collection. | ||
{| cellspacing="0" cellpadding="10" width="100%" border="1" | {| cellspacing="0" cellpadding="10" width="100%" border="1" | ||
|- | |- | ||
Line 496: | Line 496: | ||
| Message name. | | Message name. | ||
|- | |- | ||
| [[# | | [[#ascript.Messages.Item.Owner|Owner]] | ||
| Property,<br>'''Read-only''',<br>Object | | Property,<br>'''Read-only''',<br>Object | ||
| Message's owner object. | | Message's owner object. | ||
Line 516: | Line 516: | ||
<br> "BroadcastMessage" | <br> "BroadcastMessage" | ||
|- | |- | ||
| [[# | | [[#ascript.Messages.Item.User|User]] | ||
| Property,<br>'''Read-only''',<br>Object | | Property,<br>'''Read-only''',<br>Object | ||
| Message's user object. | | Message's user object. | ||
Line 523: | Line 523: | ||
<br> | <br> | ||
===== | ===== ascript.Messages.Item.Owner<br> ===== | ||
The Message Owner object represents the Owner-side of a [[# | The Message Owner object represents the Owner-side of a [[#ascript.Messages.Item|Message]]. This may be a receiver of a one-way or two-way message. It may also be the broadcaster of a broadcast message. The Owner object may be used to implement the message owner in a script that can be called through the STRIDE Runtime.<br> | ||
{| cellspacing="0" cellpadding="10" width="100%" border="1" | {| cellspacing="0" cellpadding="10" width="100%" border="1" | ||
|- | |- | ||
Line 594: | Line 594: | ||
<br> | <br> | ||
===== | ===== ascript.Messages.Item.User<br> ===== | ||
The Message User object represents the User-side of a [[# | The Message User object represents the User-side of a [[#ascript.Messages.Item|Message]]. This may be a sender of a one-way or two-way message. It may also be the receiver of a broadcast message. The User object may be used to send a message from a script to the registered message owner through the STRIDE Runtime.<br> | ||
{| cellspacing="0" cellpadding="10" width="100%" border="1" | {| cellspacing="0" cellpadding="10" width="100%" border="1" | ||
Line 680: | Line 680: | ||
|} | |} | ||
=== <br><br> | === <br><br>ascript.TestUnits<br> === | ||
TestUnits is a collection of [[# | TestUnits is a collection of [[#ascript.TestUnits.Item|TestUnit]] Objects contained and managed through ascript. | ||
{| cellspacing="0" cellpadding="10" width="100%" border="1" | {| cellspacing="0" cellpadding="10" width="100%" border="1" | ||
Line 699: | Line 699: | ||
|- | |- | ||
| valign="top" align="left" width="150" | | | valign="top" align="left" width="150" | | ||
[[# | [[#ascript.TestUnits.Item|Object]] '''Item '''(<br> Integer index<br>''')''' | ||
| valign="top" | Method<br> | | valign="top" | Method<br> | ||
Line 707: | Line 707: | ||
<br> | <br> | ||
==== <br> | ==== <br>ascript.TestUnits.Item<br> ==== | ||
The TestUnit Object represents a captured Test Unit interface in the currently active STRIDE database. A Test Unit object always exists as a member of the [[# | The TestUnit Object represents a captured Test Unit interface in the currently active STRIDE database. A Test Unit object always exists as a member of the [[#ascript.TestUnits|TestUnits]] collection and is accessed from the collection using the item(#) interface. | ||
{| cellspacing="0" cellpadding="10" width="100%" border="1" | {| cellspacing="0" cellpadding="10" width="100%" border="1" | ||
Line 748: | Line 748: | ||
<br> | <br> | ||
=== <br> | === <br>ascript.Timers<br> === | ||
The Timers collection manages a set of [[# | The Timers collection manages a set of [[#ascript.Timers.Item|Timer]] Objects. The Timers allow scripts to generate periodic or 'one-shot' timed events. Upon creation, the Timers collection is empty. The Timers collection is the only read/write collection in STRIDE; member Timer objects can be added (implicitly created) and removed by scripts. From the collection's point of view, member Timers have two states: dead and alive. Timers are alive upon creation and remain so as long as they exist in the collection. A Timer object that is removed from the collection is considered dead. Any operation on a dead timer will cause an exception to be thrown.<br> | ||
{| cellspacing="0" cellpadding="10" width="100%" border="1" | {| cellspacing="0" cellpadding="10" width="100%" border="1" | ||
Line 758: | Line 758: | ||
| bgcolor="#66ff99" | '''Description'''<br> | | bgcolor="#66ff99" | '''Description'''<br> | ||
|- | |- | ||
| valign="top" align="left" width="150" | [[# | | valign="top" align="left" width="150" | [[#ascript.Timers.Item|Object]] '''Add''' (<br> [[#ascript.Timers.Item|Object]] timerObject<br>''')''' | ||
| valign="top" align="left" | Method<br> | | valign="top" align="left" | Method<br> | ||
| valign="top" align="left" | Adds a new timer object. | | valign="top" align="left" | Adds a new timer object. | ||
Line 770: | Line 770: | ||
| valign="top" | Returns the number of Timers in this collection.<br> | | valign="top" | Returns the number of Timers in this collection.<br> | ||
|- | |- | ||
| valign="top" align="left" width="150" | [[# | | valign="top" align="left" width="150" | [[#ascript.Timers.Item|Object]] '''Item (<br>''' Integer index<br>''')''' | ||
| valign="top" align="left" | Method<br> | | valign="top" align="left" | Method<br> | ||
| valign="top" align="left" | Retrieves the Timer object for the given index. | | valign="top" align="left" | Retrieves the Timer object for the given index. | ||
|- | |- | ||
| valign="top" align="left" width="150" | [[# | | valign="top" align="left" width="150" | [[#ascript.Timers.Item|Object]] '''Remove '''(<br> Integer index<br>''')''' | ||
| valign="top" | Method<br> | | valign="top" | Method<br> | ||
| valign="top" | Removes the timer at the given index.<br>A timer object that is removed from the collection is automatically stopped before removal if it is active. No event is generated in this case. | | valign="top" | Removes the timer at the given index.<br>A timer object that is removed from the collection is automatically stopped before removal if it is active. No event is generated in this case. | ||
Line 781: | Line 781: | ||
<br> | <br> | ||
==== <br> | ==== <br>ascript.Timers.Item<br> ==== | ||
The ascript [[#Ascript.Timers|Timers]] Collection's Item() method returns a Timer Object. The Timer object enables scripting clients to synthesize and receive timer-based periodic or one-shot events.<br> | The ascript [[#ascript.Timers|Timers]] Collection's Item() method returns a Timer Object. The Timer object enables scripting clients to synthesize and receive timer-based periodic or one-shot events.<br> | ||
When a timer expires and rires its event, the event is queued and can be accessed by the ascript.WaitForEvent() method. The expired timer object will be returned by WaitForEvent();<br> | |||
{| cellspacing="0" cellpadding="10" width="100%" border="1" | |||
|- | |||
| width="150" bgcolor="#66ff99" | '''Member'''<br> | |||
| width="100" bgcolor="#66ff99" | '''Type'''<br> | |||
| bgcolor="#66ff99" | '''Description'''<br> | |||
|- | |||
| valign="top" align="left" width="150" | Active | |||
| valign="top" align="left" | Property,<br>'''Read-only,'''<br>Boolean | |||
| valign="top" align="left" | Contains timer operation state. True if timer is in operation (i.e. it will generate an event at some time in the future). A newly created timer is inactive by default. | |||
|- | |||
| valign="top" align="left" width="150" | Id | |||
| valign="top" align="left" | Property,<br>'''Read-only,'''<br>long | |||
| valign="top" align="left" | Contains timer identifier. | |||
|- | |||
| valign="top" align="left" width="150" | Duration | |||
| valign="top" align="left" | Property,<br>long | |||
| valign="top" align="left" | Timer duration in milliseconds. | |||
|- | |||
| valign="top" align="left" width="150" | Name | |||
| valign="top" align="left" | Property,<br>'''Read-only''',<br>String | |||
| valign="top" align="left" | Name assigned when the timer was created. Default names are "Timer_n" where 'n' is the nth named time created by this ascript object. | |||
|- | |||
| valign="top" align="left" width="150" | Periodic | |||
| valign="top" align="left" | Property,<br>Boolean | |||
| valign="top" align="left" | When false, the time will fire only once (one-shot mode). When true, the time automatically restarts after each event is fired. This property can be changed regardless of the state of the timer. This field is false by default when a timer is created. | |||
|- | |||
| valign="top" align="left" width="150" | '''void Start (void)''' | |||
| valign="top" align="left" | Method<br> | |||
| valign="top" align="left" | Transitions an inactive timer to active. Once started, the timer will run for the length of time specified by its Duration property. Calling Start on a timer with a zero/negative duration will cause an exception to be thrown. Calling Start on a timer that has already started will also cause an exception to be thrown. | |||
|- | |||
| valign="top" align="left" width="150" | '''void Stop (void)''' | |||
| valign="top" align="left" | Method<br> | |||
| valign="top" align="left" | Transitions an active timer to inactive. Calling Stop on a timer that is not active will cause an exception to be thrown. | |||
|- | |||
| valign="top" align="left" width="150" | Type | |||
| valign="top" align="left" | Property,<br>'''Read-only''',<br>String | |||
| valign="top" align="left" | Contains the string "Timer". This property is typically used to classify an object that is returned from ascript.WaitForEvent(). | |||
|} | |||
__FORCETOC__ | |||
= Introduction = | |||
Ascript is the definitive hierarchy of methods, objects, and properties provided by Autosense. While Autosense helps the user find the script methods/data desired in a script, Ascript is the definitive source of what is available from STRIDE when using Autosense. | |||
The ascript object provides functionality that allows host-based scripts to interact with target-based binaries through the STRIDE Runtime. Through ascript, you can: | |||
*call target-based functions and messages (synchronously or asynchronously) | |||
*set and read parameter values orf these functions and messages | |||
*transparently emulate (mock) target-based functions | |||
= Automation API = | |||
== ascript == | |||
When creating a script, the user types in Ascript followed by dot '.' to get Autosense to display. The user may select methods to be used within his script. The user may access property data within his script. this API is the definitive API for Autosense. The following table outlines the main objects and collections available to the user. | |||
{| cellspacing="0" cellpadding="10" width="100%" border="1" | |||
|- | |||
| width="250" bgcolor="#66ff99" | '''Member'''<br> | |||
| width="100" bgcolor="#66ff99" | '''Type'''<br> | |||
| bgcolor="#66ff99" | '''Description'''<br> | |||
|- | |||
| [[#ascript.Arguments|Arguments]] | |||
| Collection | |||
| Collection of arguments. | |||
|- | |||
| [[#ascript.Constants|Constants]] | |||
| Collection | |||
| Collection of constants. | |||
|- | |||
| [[#ascript.Database|Database]] | |||
| valign="top" align="left" width="150" | Object | |||
| Database settings. | |||
|- | |||
| [[ascript.Functions|Functions]] | |||
| Collection | |||
| Collection of functions. | |||
|- | |||
| void '''Initialize (''' <br> String STIDName, <br> String databaseFile, <br> Integer messageBoxTimeout [optional] <br>''')''' | |||
| Method | |||
| Initializes and ascript object instance that has been created outside of tghe STRIDE Studio environment. This call is needed only on an explicitly-created ascript instance. This call should not be made on an ascript instance automatically created and injected into a script by STRIDE Studio. | |||
|- | |||
| IsEventPending | |||
| Property, <br>'''Read-only''',<br>Boolean | |||
| Contains true if there is at least one event in this script's message queue. Events are retrieved from the queue using ascript.WaitForEvent(); | |||
|- | |||
| LogicalPath | |||
| Property, <br>'''Read-only''',<br>String | |||
| Contains the script's path in the STRIDE Studio workspace tree. | |||
|- | |||
| void '''MessageBox(''' <br> String message, <br> String title [optional], <br> String type <br>''')''' | |||
| Method | |||
| Displays a model message box dialog. | |||
|- | |||
| [[ascript.Messages|Messages]] | |||
| Collection | |||
| Collection of messages. | |||
|- | |||
| Output | |||
| Property, <br>(String, Integer, or Object) | |||
| This is the return value from a RunBlocking() call that invoked this script. This works only when the script is invoked using RunBlocking() in the studio object model. | |||
|- | |||
| RspTimeoutPeriod | |||
| Property, <br>Integer | |||
| This value controls the timeout threshold for synchronous function and two-way message calls (in milliseconds). A zero value indicates no timeout. For interactively run scripts the timeout behavior may be different. Specific calls affected by this value are: | |||
* Call | |||
* CallBypassOverride | |||
* SendAndRead | |||
* SendAndReadBypassOverride | |||
|- | |||
| ScriptName | |||
| Property, <br>'''Read-only''',<br>String | |||
| Contains the name of the currently running script with extension and without path. If the current ascript instance was instantiated and initialized outside of STRIDE Studio, this value will reflect the STIDName passed to ascript.Initialize(). | |||
|- | |||
| void '''Sleep('''<br> Integer period<br>''')''' | |||
| Method | |||
| Time to pause (in milliseconds). Allowable range is 0 -1440000 (24 hours). | |||
|- | |||
| [[#ascript.TestUnits|Test Units]] | |||
| Collection | |||
| Collection of test units. | |||
|- | |||
| [[#ascript.Timers|Timers]] | |||
| Collection | |||
| Collection of timers. | |||
|- | |||
| Object '''WaitForEvent ( '''void ''')''' | |||
| Method | |||
| Pauses script execution until an event is detected in this script's event queue. | |||
|- | |||
| WaitTimeoutPeriod | |||
| Property, <br>String | |||
| The timeout threshold (in milliseconds) for asynchronous function and message calls. A zero value indicates no timeout. | |||
|} | |||
<br> | |||
=== ascript.Arguments<br> === | |||
The Arguments collection manages a list of [[#ascript.Arguments.Item|Arguments]] passed to a script which has been invoked via one of the following methods of the Studio Object Model's File object: | |||
<br> | |||
* RunBlocking([arg1], [arg2], ...) | |||
* RunNonBlocking([arg1], [arg2], ...) | |||
<br> | |||
The default sort order of the member argument objects is the order in which the arguments were given in the call where the script was invoked. | |||
{| cellspacing="0" cellpadding="10" width="100%" border="1" | |||
|- | |||
| width="150" bgcolor="#66ff99" | '''Member'''<br> | |||
| width="100" bgcolor="#66ff99" | '''Type'''<br> | |||
| bgcolor="#66ff99" | '''Description'''<br> | |||
|- | |||
| valign="top" | Count | |||
| valign="top" | Property,<br>'''Read-only''',<br>Integer | |||
| valign="top" | Returns the number of Arguments in this collection.<br> | |||
|- | |||
| valign="top" align="left" width="150" | | |||
[[#ascript.Arguments.Item|Object]] '''Item''' (<br> Integer index<br>''')''' | |||
| valign="top" | Method<br> | |||
| valign="top" | Retrieves the argument at the given index. An exception is thrown if the index is out of range.<br> | |||
|- | |||
| valign="top" align="left" width="150" | | |||
[[#ascript.Arguments.Item|Object]] '''Item''' (<br> String name<br>''')''' | |||
| valign="top" | Method<br> | |||
| valign="top" | Retrieves the argument with the given name. If a named argument doesn't exist, null is returned.<br> | |||
<br> | |||
|} | |||
==== <br>ascript.Arguments.Item<br> ==== | |||
The ascript [[#ascript.Arguments|Arguments]] Collection's Item() method returns a Argument Object. | |||
{| cellspacing="0" cellpadding="10" width="100%" border="1" | |||
|- | |||
| width="150" bgcolor="#66ff99" | '''Member'''<br> | |||
| width="100" bgcolor="#66ff99" | '''Type'''<br> | |||
| bgcolor="#66ff99" | '''Description'''<br> | |||
|- | |||
| valign="top" align="left" width="150" | Name | |||
| valign="top" align="left" | Property,<br>'''Read-only''', <br>String | |||
| valign="top" align="left" | | |||
The argument name. The name may have been specified in the studio automation RunBlocking() or RunNonBlocking() call that launched the script or if not specified the name is synthesized by the ascript object. | |||
When synthesized, the name is of the form "Unnamed_N" where 'N' is a monotonically incremented number starting from 0. | |||
|- | |||
| valign="top" align="left" width="150" | Value | |||
| valign="top" align="left" | Property,<br>'''Read-only''', <br>String, Integer, or Object | |||
| valign="top" align="left" | The argument value. | |||
|} | |||
<br> | |||
=== ascript.Constants<br> === | |||
The Constants collection contains [[#ascript.Constants.Item|Constants]] objects that represent all constants in C/C++ source code compiled by the STRIDE compiler. Constants include all #define symbols and enumerated constants. | |||
{| cellspacing="0" cellpadding="10" width="100%" border="1" | |||
|- | |||
| width="150" bgcolor="#66ff99" | '''Member'''<br> | |||
| width="100" bgcolor="#66ff99" | '''Type'''<br> | |||
| bgcolor="#66ff99" | '''Description'''<br> | |||
|- | |||
| valign="top" | '''void ArrangeBy ('''<br> String By [optional], <br> String Order [optional]<br>''')''' | |||
| valign="top" | Method | |||
| valign="top" | Sorts the Constants collection so that indexing by position yields predictable results.<br><br>The 'By' parameter may only be "Name". If not specified, the default is "Name". This represents how Constants should be sorted in the collection.<br><br>The 'Order' parameter may be either "Ascending" or "Descending". If not specified, the default is "Ascending".<br><br>Exception thrown if either argument is outside legal values. | |||
|- | |||
| valign="top" | Count | |||
| valign="top" | Property,<br>'''Read-only''',<br>Integer | |||
| valign="top" | Returns the number of Constants in this collection.<br> | |||
|- | |||
| valign="top" align="left" width="150" | | |||
[[#ascript.Constants.Item|Object]] '''Item''' (<br> Integer index<br>''')''' | |||
| valign="top" | Method<br> | |||
| valign="top" | Retrieves the constant at the given index. An exception is thrown if the index is out of range.<br> | |||
|- | |||
| valign="top" align="left" width="150" | | |||
[[#ascript.Constants.Item|Object]] '''Item''' (<br> String name<br>''')''' | |||
| valign="top" | Method<br> | |||
| valign="top" | Retrieves the constant with the given name. If a named constant doesn't exist, null is returned.<br> | |||
<br> | |||
|} | |||
<br> | |||
==== <br>ascript.Constants.Item<br> ==== | |||
The ascript [[#ascript.Constants|Constants]] Collection's Item() method returns a Constant object. | |||
{| cellspacing="0" cellpadding="10" width="100%" border="1" | |||
|- | |||
| width="150" bgcolor="#66ff99" | '''Member'''<br> | |||
| width="100" bgcolor="#66ff99" | '''Type'''<br> | |||
| bgcolor="#66ff99" | '''Description'''<br> | |||
|- | |||
| valign="top" align="left" width="150" | Value | |||
| valign="top" align="left" | Property,<br>'''Read-only''', <br>String | |||
| valign="top" align="left" | The value of the constant. | |||
|} | |||
<br> | |||
=== <br>ascript.Database === | |||
The Database object represents the currently-loaded STRIDE database managed by ascript. You can combine the values of the database path and name to construct a fully-qualified filename. For example: | |||
var dbFullPath = ascript.Database.Path + "\\" + ascript.Database.Name; | |||
{| cellspacing="0" cellpadding="10" width="100%" border="1" | |||
|- | |||
| width="150" bgcolor="#66ff99" | '''Member'''<br> | |||
| width="100" bgcolor="#66ff99" | '''Type'''<br> | |||
| bgcolor="#66ff99" | '''Description'''<br> | |||
|- | |||
| valign="top" | Name | |||
| valign="top" | Property,<br>'''Read-only''',<br>String | |||
| valign="top" | The name of the database in use. The database name includes the ".sidb" extension. | |||
|- | |||
| valign="top" | Path<br> | |||
| valign="top" | Property,<br>'''Read-only''',<br>String | |||
| valign="top" | The path to the STRIDE database in use. The path does not contain a trailing backslash. <br> | |||
|} | |||
<br> | |||
=== ascript.Functions<br> === | |||
The Functions collection represents all captured [[#ascript.Functions.Item|Function]] interfaces in the active database. | |||
{| cellspacing="0" cellpadding="10" width="100%" border="1" | |||
|- | |||
| width="150" bgcolor="#66ff99" | '''Member'''<br> | |||
| width="100" bgcolor="#66ff99" | '''Type'''<br> | |||
| bgcolor="#66ff99" | '''Description'''<br> | |||
|- | |||
| valign="top" | '''void ArrangeBy ('''<br> String By [optional], <br> String Order [optional]<br>''')''' | |||
| valign="top" | Method | |||
| valign="top" | Sorts the Functions collection so that indexing by position yields predictable results.<br><br>The 'By' parameter may be either "Name" or "SUID". If not specified, the default is "Name". This represents how Functions should be sorted in the collection.<br><br>The 'Order' parameter may be either "Ascending" or "Descending". If not specified, the default is "Ascending".<br><br>Exception thrown if either argument is outside legal values. | |||
|- | |||
| valign="top" | Count | |||
| valign="top" | Property,<br>'''Read-only''',<br>Integer | |||
| valign="top" | Returns the number of Functions in this collection.<br> | |||
|- | |||
| valign="top" align="left" width="150" | | |||
[[#ascript.Functions.Item|Object]] '''Item''' (<br> Integer index<br>''')''' | |||
| valign="top" | Method<br> | |||
| valign="top" | Retrieves the function at the given index. An exception is thrown if the index is out of range.<br> | |||
|- | |||
| valign="top" align="left" width="150" | | |||
[[#ascript.Functions.Item|Object]] '''Item''' (<br> String name<br>''')''' | |||
| valign="top" | Method<br> | |||
| valign="top" | Retrieves the function with the given name. A null value is returned if there is no function with the given name.<br> | |||
|} | |||
=== ascript.Functions.Item === | |||
The Function object represents a captured function interface in the currently active STRIDE database. A Function object always exists as a member of the [[#ascript.Functions|Functions]] collection. | |||
{| cellspacing="0" cellpadding="10" width="100%" border="1" | |||
|- | |||
| width="150" bgcolor="#66ff99" | '''Member'''<br> | |||
| width="100" bgcolor="#66ff99" | '''Type'''<br> | |||
| bgcolor="#66ff99" | '''Description'''<br> | |||
|- | |||
| Name | |||
| Property,<br>'''Read-only''',<br>Boolean | |||
| Function's name. | |||
|- | |||
| [[#ascript.Functions.Item.Owner|Owner]] | |||
| Property,<br>'''Read-only''',<br>Object | |||
| Function's owner object. The owner object provides access to properties and methods used by the owner-side of the function interface. The owner-side of the interface is used by the implementor of the function. | |||
|- | |||
| SUID | |||
| Property,<br>'''Read-Only''',<br>Integer | |||
| STRIDE Unique IDentifier assigned by compiler. | |||
|- | |||
| Type | |||
| Property,<br>'''Read-Only''',<br>String | |||
| Contains the string "Function". | |||
|- | |||
| [[#ascript.Functions.Item.User|User]] | |||
| Property<br>'''Read-Only''',<br>Object | |||
| Function's user object. The user object provides access to properties and methods used by the user-side of the function interface. The user-side of the interface is used by the caller of the function. | |||
|} | |||
<br> | |||
==== ascript.Functions.Item.Owner ==== | |||
The Function Owner object represents the Owner (callee) side of a function. The Owner object is used to implement a function in script that can be called through the STRIDE Runtime. The Function Owner object is reachable from a [[#ascript.Functions.Item|Function]] object's owner property. | |||
{| cellspacing="0" cellpadding="10" width="100%" border="1" | |||
|- | |||
| width="140" bgcolor="#66ff99" | '''Member'''<br> | |||
| width="100" bgcolor="#66ff99" | '''Type'''<br> | |||
| bgcolor="#66ff99" | '''Description'''<br> | |||
|- | |||
| IsOverrideRegistered | |||
| Property,<br>'''Read-Only''',<br>Boolean | |||
| Contains true if there is a registered override owner. | |||
|- | |||
| IsRegistered | |||
| Property,<br>'''Read-only''',<br>Boolean | |||
| Contains true if there is a registered owner, a registered override owner, or both. | |||
|- | |||
| Name | |||
| Property,<br>'''Read-only''',<br>Boolean | |||
| Owner name. | |||
|- | |||
| OutPointers | |||
| Property,<br>'''Read-only''',<br>Object | |||
| Contains the OutPointers payload of the Function Owner. This exists only if the function's payload has at least one pointer that is qualified as OUT or INOUT. This property is a [[Dynamic Objects|Dynamic Object]]. | |||
<br><br> This object's members are composed of all the top-level parameters that are either OUT or INOUT pointers, or a structured types (struct or unions) that contain members that are OUT or INOUT (either directly or by containing additional structured types that contain such members). In the case of structured type objects appearing in the OutPointers hierarchy, only members that are qualified as OUT or INOUT (or that themselves contain these qualified types) are available. | |||
|- | |||
| ParameterList | |||
| Property,<br>'''Read-only''',<br>Object | |||
| Contains the object representing the ParameterList payload of the Function Owner. This property will exist only if the capture function contained one or more parameters. This property will contain the values of all ParameterList fields at the time the function User called the Owner. The value is a [[Dynamic Objects|Dynamic Object]]. | |||
|- | |||
| '''void Register (void)''' | |||
| Method | |||
| Registers the script from which it is called as the active owner of the function. If there is a currently registered owner or another registration failure, an exception is thrown. Once registered, ownership can be released either by a call to Unregister or by exiting the script that registered the function. | |||
|- | |||
| '''void RegisterOverride (void)''' | |||
| Method | |||
| Registers the script as the override registered owner. If the function already has an override registered owner or if there is another registration error, an exception is thrown. | |||
|- | |||
| '''void Return ()''' | |||
| Method | |||
| Causes a return from a function call made from another script. | |||
|- | |||
| ReturnValue | |||
| Property,<br>'''Read-only''',<br>Integer | |||
| Contains object representing ReturnValue payload of the function owner. Functions returning void will not have this property. The object is returned as a [[Dynamic Objects|Dynamic Object]]. | |||
|- | |||
| SUID | |||
| Property,<br>'''Read-only''',<br>Integer | |||
| STRIDE Unique IDentifier assigned by compiler. | |||
|- | |||
| Type | |||
| Property,<br>'''Read-only''',<br>String | |||
| Contains "Function". | |||
|- | |||
| '''void Unregister (void)''' | |||
| Method | |||
| Unregisters the script that was registered as the owner of the function from a prior Register call. If the current script is not the owner or if unregistration fails, an exception is thrown. | |||
|- | |||
| '''void UnregisterOverride (void)''' | |||
| Method | |||
| Unregisters the script that was registered as the override owner of the function from a prior RegisterOverride call. If the current script is not the registered override owner or if unregistration fails, an exception is thrown. | |||
|} | |||
<br> | |||
==== ascript.Functions.Item.User ==== | |||
The Function User object represents the User (caller) side of a function. The User object is used to call a function through the STRIDE Runtime. The Function User object is reachable from a [[#ascript.Functions.Item|Function]] object's User property. | |||
{| cellspacing="0" cellpadding="10" width="100%" border="1" | |||
|- | |||
| width="140" bgcolor="#66ff99" | '''Member'''<br> | |||
| width="100" bgcolor="#66ff99" | '''Type'''<br> | |||
| bgcolor="#66ff99" | '''Description'''<br> | |||
|- | |||
| '''void Call (void)''' | |||
| Method | |||
| Synchronously calls the registered owner of the function (Blocking call). | |||
* All current field values of the ParameterList property are marshaled to the function Owner. | |||
* If there is no registered owner or registered override owner, an exception is thrown. | |||
* If there is no registered owner but there is an override registered owner, the call is routed to the override registered owner. | |||
* If the RspTimeoutPeriod is non-zero and the call does not complete in the specified time, an exception is thrown. For interactively run scripts the timeout behavior differ; see [[Timeout Considerations|Timeout Considerations]]. | |||
|- | |||
| '''void CallBypassOverride (void)''' | |||
| Method | |||
| Synchronously calls the override registered owner of the function (Blocking call). | |||
* The call is made to the override registered owner of the function bypassing any existing registered owner. | |||
* The current values of all fields in the ParameterList property are marshaled to the override registered function Owner. | |||
* If there is no override registered owner, an exception is thrown. | |||
* If the RspTimeoutPeriod is non-zero and the call does not complete in the specified time, an exception is thrown. For interactively run scripts the timeout behavior differ; see [[Timeout Considerations|Timeout Considerations]]. | |||
|- | |||
| '''void CallBypassOverrideNonBlocking (void)''' | |||
| Method | |||
| Asynchronously calls the override registered owner of the function (Non-blocking call). | |||
* Invokes call to registered function owner bypassing the registered override owner (if one exists). | |||
* If there is no registered owner but there is an override registered owner, the call is routed to the override registered owner. | |||
* Current values of all fields of the ParameterList property are marshaled to the called function. | |||
* In place of a synchronous return, this method returns to the call immediately. When the function owner (running in a separate thread) returns, an event is placed in this script's queue by the STRIDE Runtime. The event (as a polymorphic object exposing Type and Name properties) is retrieved from the queue using ascript.WaitForEvent(). | |||
* If the RspTimeoutPeriod is non-zero and the call does not complete in the specified time, an exception is thrown. For interactively run scripts the timeout behavior differ; see [[Timeout Considerations|Timeout Considerations]]. | |||
* The object returned from WaitForEvent() in response to CallByPassOverrideNonBlocking() can be: | |||
{| cellspacing="0" cellpadding="1" width="100%" border="0" | |||
|- | |||
| width="10" | | |||
| | |||
* The Function User Object corresponding to the function that was called. (Type = "FunctionUser", Name="function name"). The object's ReturnValue property and the OutPointers property (if present) will be populated with the values supplied by the Owner implementation. | |||
* An Error Object containing information about the error that occurred (Type="Error"; Name="error source"). | |||
|} | |||
|- | |||
| '''void CallNonBlocking (void)''' | |||
| Method | |||
| Asynchronously calls the registered owner of the function (Non-blocking call). | |||
* This call invokes a call to the currently registered owner of the function. If there is an override registered owner, it is called. If there is no override registered owner, but there is a registered owner, the registered owner is called. | |||
* The current values of all fields in the ParameterList property are marshaled to the called function. | |||
* In place of synchronous return, this method returns to the caller immediately. When the function owner (running in a separate thread) returns, an event is placed in this script's queue by the STRIDE Runtime. The event (as a polymorphic object exposing Type and Name properties) is retrieved from the queue using ascript.WaitForEvent(). | |||
* If the RspTimeoutPeriod is non-zero and the call does not complete in the specified time, an exception is thrown. For interactively run scripts the timeout behavior differ; see [[Timeout Considerations|Timeout Considerations]]. | |||
* The object returned from WaitForEvent() in response to CallByPassOverrideNonBlocking() can be: | |||
{| cellspacing="0" cellpadding="1" width="100%" border="0" | |||
|- | |||
| width="10" | | |||
| | |||
* The Function User Object corresponding to the function that was called. (Type = "FunctionUser", Name="function name"). The object's ReturnValue property and the OutPointers property (if present) will be populated with the values supplied by the Owner implementation. | |||
* An Error Object containing information about the error that occurred (Type="Error"; Name="error source"). | |||
|} | |||
|- | |||
| IsOverrideRegistered | |||
| Property,<br>'''Read-only''',<br>Boolean | |||
| Contains true if there is a registered override owner. | |||
|- | |||
| IsRegistered | |||
| Property,<br>'''Read-only''',<br>Boolean | |||
| Contains true if there is a registered owner, a registered override owner, or both. | |||
|- | |||
| Name | |||
| Property,<br>'''Read-only''',<br>String | |||
| User function name. | |||
|- | |||
| OutPointers | |||
| Property,<br>'''Read-only''',<br>Object | |||
| Contains the OutPointers payload of the Function User object. This exists only if the function's payload has at least one pointer that is qualified as OUT or INOUT. This property is a [[Dynamic Objects|Dynamic Object]]. | |||
<br><br> This object's members are composed of all the top-level parameters that are either OUT or INOUT pointers, or a structured types (struct or unions) that contain members that are OUT or INOUT (either directly or by containing additional structured types that contain such members). In the case of structured type objects appearing in the OutPointers hierarchy, only members that are qualified as OUT or INOUT (or that themselves contain these qualified types) are available. | |||
<br>Upon function return, this property will reflect the OutPointers values set by the Function Owner. | |||
|- | |||
| ParameterList | |||
| Property,<br>'''Read-only''',<br>Object | |||
| Contains the object representing the ParameterList payload of the Function Owner. Functions without parameters will not have this property. Before calling the function, all relevent fields in the ParameterList property must be set (includeing the fields of any child objects). These values are marshaled to the currently registered Owner of the function when it is called. This property is a [[Dynamic Objects|Dynamic Object]]. | |||
|- | |||
| ReturnValue | |||
| Property,<br>'''Read-only''',<br>Object | |||
| Contains the object representing the ReturnValue payload of the Function Owner. Functions returning void will not have this property. Upon return this property will reflect the ReturnValue set by the function Owner. This property is a [[Dynamic Objects|Dynamic Object]]. | |||
|- | |||
| SUID | |||
| Property,<br>'''Read-only''',<br>,Integer | |||
| STRIDE Unique Identifier assigned by compiler. | |||
|- | |||
| Type | |||
| Property,<br>'''Read-only''',<br>String | |||
| Contains "FunctionUser". This property is typically used to classify an object that is returned from ascript.WaitForEvent(). | |||
|} | |||
<br> | |||
=== <br>ascript.Messages<br> === | |||
The Messages Collection is a collection of captured [[#ascript.Messages.Item|Message]] objects. <br> | |||
{| cellspacing="0" cellpadding="10" width="100%" border="1" | |||
|- | |||
| width="150" bgcolor="#66ff99" | '''Member'''<br> | |||
| width="100" bgcolor="#66ff99" | '''Type'''<br> | |||
| bgcolor="#66ff99" | '''Description'''<br> | |||
|- | |||
| valign="top" | '''void ArrangeBy ('''<br> String By [optional], <br> String Order [optional]<br>''')''' | |||
| valign="top" | Method | |||
| valign="top" | Sorts the Messages collection so that indexing by position yields predictable results.<br><br>The 'By' parameter may one of the following: "Name", "SMID", "SUID", "Type". The default sorting order is by "Name". This represents how Timers should be sorted in the collection. A runtime exception is thrown if an invalid value is passed<br><br>The 'Order' parameter may be either "Ascending" or "Descending" and is not case sensitive. If not specified, the default is "Ascending". A runtime exception is thrown if a invalid value is passed. | |||
|- | |||
| valign="top" | Count | |||
| valign="top" | Property,<br>'''Read-only''',<br>Integer | |||
| valign="top" | Returns the number of Messages in this collection.<br> | |||
|- | |||
| valign="top" align="left" width="150" | | |||
[[#ascript.Messages.Item|Object]] '''Item '''(<br> Integer index<br>) | |||
| valign="top" | Method<br> | |||
| valign="top" | Retrieves the message at the given index.<br> | |||
|} | |||
<br> | |||
==== <br>ascript.Messages.Item<br> ==== | |||
The Message object represents a captured message interface in the currently active STRIDE database. A Message object is always a member of the [[#ascript.Messages|Messages]] collection. | |||
{| cellspacing="0" cellpadding="10" width="100%" border="1" | |||
|- | |||
| width="120" bgcolor="#66ff99" | '''Member'''<br> | |||
| width="100" bgcolor="#66ff99" | '''Type'''<br> | |||
| bgcolor="#66ff99" | '''Description'''<br> | |||
|- | |||
| Name | |||
| Property,<br>'''Read-only''',<br>String | |||
| Message name. | |||
|- | |||
| [[#ascript.Messages.Item.Owner|Owner]] | |||
| Property,<br>'''Read-only''',<br>Object | |||
| Message's owner object. | |||
|- | |||
| SMID | |||
| Property,<br>'''Read-only''',<br>Integer | |||
| STRIDE Message Identifier assigned by compiler. | |||
|- | |||
| SUID | |||
| Property,<br>'''Read-only''',<br>Integer | |||
| STRIDE Unique Identifier assigned by compiler. | |||
|- | |||
| Type | |||
| Property,<br>'''Read-only''',<br>String | |||
| Contains message type defined by the SCL declaration. Legal values include: | |||
"OneWayMessage" | |||
<br> "OneWayResponse" | |||
<br> "TwoWayMessage" | |||
<br> "BroadcastMessage" | |||
|- | |||
| [[#ascript.Messages.Item.User|User]] | |||
| Property,<br>'''Read-only''',<br>Object | |||
| Message's user object. | |||
|} | |||
<br> | |||
===== ascript.Messages.Item.Owner<br> ===== | |||
The Message Owner object represents the Owner-side of a [[#ascript.Messages.Item|Message]]. This may be a receiver of a one-way or two-way message. It may also be the broadcaster of a broadcast message. The Owner object may be used to implement the message owner in a script that can be called through the STRIDE Runtime.<br> | |||
{| cellspacing="0" cellpadding="10" width="100%" border="1" | |||
|- | |||
| width="210" bgcolor="#66ff99" | '''Member'''<br> | |||
| width="90" bgcolor="#66ff99" | '''Type'''<br> | |||
| bgcolor="#66ff99" | '''Description'''<br> | |||
|- | |||
| '''void Broadcast (void)''' | |||
| Method | |||
| Broadcast method exists only for Broadcast Messages. | |||
|- | |||
| Command | |||
| Property,<br>'''Read-only''',<br>Object | |||
| This property is a [[Dynamic Objects|Dynamic Object]] representing the Command payload of the Message Owner. The property exists only if the captured message took one or more parameters. The property contains all the values of the Message User Command fields at the time that the message User called the Owner. | |||
|- | |||
| IsOverrideRegistered | |||
| Property,<br>'''Read-only''',<br>Boolean | |||
| Contains the override Owner registration state of the message. True only if there is a registered override owner. | |||
|- | |||
| IsRegistered | |||
| Property,<br>'''Read-only''',<br>Boolean | |||
| Contains the Owner registration state of the message. True only if there is a registered owner, a registered override owner, or both. | |||
|- | |||
| Name | |||
| Property,<br>'''Read-only''',<br>String | |||
| Contains Message name. | |||
|- | |||
| '''void Register (void)''' | |||
| Method | |||
| Register method exists only for One-Way Command or Two-Way Messages. | |||
|- | |||
| '''void RegisterOverride (void)''' | |||
| Method | |||
| Register override method exists only for One-Way Command or Two-Way Messages. | |||
|- | |||
| Response | |||
| Property,<br>'''Read-only''',<br>Object | |||
| This property is a [[Dynamic Objects|Dynamic Object]] representing the Response payload of the Message Owner. The property exists only if the message is defined with a response payload. | |||
|- | |||
| '''void SendRsp (void)''' | |||
| Method | |||
| Send response method exists only for One-Way Response or Two-Way Messages. | |||
|- | |||
| SMID | |||
| Property,<br>'''Read-only''',<br>Integer | |||
| STRIDE Message Identifier assigned by compiler. | |||
|- | |||
| SUID | |||
| Property,<br>'''Read-only''',<br>Integer | |||
| STRIDE Unique Identifier assigned by compiler. | |||
|- | |||
| Type | |||
| Property,<br>'''Read-only''',<br>String | |||
| Contains message type defined by the SCL declaration. Legal values include: | |||
"OneWayMessage" | |||
<br> "OneWayResponse" | |||
<br> "TwoWayMessage" | |||
<br> "BroadcastMessage" | |||
|- | |||
| '''void Unregister (void)''' | |||
| Method | |||
| Unregister method exists only for One-Way Command or Two-Way Messages. | |||
|- | |||
| '''void UnregisterOverride (void)''' | |||
| Method | |||
| Unregister override method exists only for One-Way Command or Two-Way Messages. | |||
|} | |||
<br> | |||
===== ascript.Messages.Item.User<br> ===== | |||
The Message User object represents the User-side of a [[#ascript.Messages.Item|Message]]. This may be a sender of a one-way or two-way message. It may also be the receiver of a broadcast message. The User object may be used to send a message from a script to the registered message owner through the STRIDE Runtime.<br> | |||
{| cellspacing="0" cellpadding="10" width="100%" border="1" | |||
|- | |||
| width="210" bgcolor="#66ff99" | '''Member'''<br> | |||
| width="90" bgcolor="#66ff99" | '''Type'''<br> | |||
| bgcolor="#66ff99" | '''Description'''<br> | |||
|- | |||
| '''void Broadcast (void)''' | |||
| Method | |||
| Broadcast method exists only for Broadcast Messages. | |||
|- | |||
| Command | |||
| Property,<br>'''Read-only''',<br>Object | |||
| This property is a [[Dynamic Objects|Dynamic Object]] representing the Command payload of the Message User. The property exists only if the captured message took one or more parameters. The values of all Message User Command payload fields should be set before the Message Owner is called. | |||
|- | |||
| IsOverrideRegistered | |||
| Property,<br>'''Read-only''',<br>Boolean | |||
| Contains the override Owner registration state of the message. True only if there is a registered override owner. | |||
|- | |||
| IsRegistered | |||
| Property,<br>'''Read-only''',<br>Boolean | |||
| Contains the Owner registration state of the message. True only if there is a registered owner, a registered override owner, or both. | |||
|- | |||
| Name | |||
| Property,<br>'''Read-only''',<br>String | |||
| Contains Message name. | |||
|- | |||
| '''void Register (void)''' | |||
| Method | |||
| Register method exists only for One-Way Command or Two-Way Messages. | |||
|- | |||
| '''void RegisterOverride (void)''' | |||
| Method | |||
| Register override method exists only for One-Way Command or Two-Way Messages. | |||
|- | |||
| Response | |||
| Property,<br>'''Read-only''',<br>Object | |||
| This property is a [[Dynamic Objects|Dynamic Object]] representing the Response payload of the Message User. The property exists only if the message is defined with a response payload. | |||
|- | |||
| '''void SendRsp (void)''' | |||
| Method | |||
| Send response method exists only for One-Way Response or Two-Way Messages. | |||
|- | |||
| SMID | |||
| Property,<br>'''Read-only''',<br>Integer | |||
| STRIDE Message Identifier assigned by compiler. | |||
|- | |||
| SUID | |||
| Property,<br>'''Read-only''',<br>Integer | |||
| STRIDE Unique Identifier assigned by compiler. | |||
|- | |||
| '''void SendAndRead (<br> Boolean value<br>)''' | |||
| Method | |||
| Send and read method exists only for Two-Way and Broadcast Messages. | |||
|- | |||
| '''void SendAndReadBypassOverride ('''<br> Boolean value <br>''')''' | |||
| Method | |||
| Send and read bypass override method exists only for Two-Way Messages. | |||
|- | |||
| '''void SendCmd (void)''' | |||
| Method | |||
| Send command method exists only for One-Way Command Messages. | |||
|- | |||
| '''void SendCmdBypassOverride ('''<br> Boolean value <br>''')''' | |||
| Method | |||
| Send command bypass override method exists only for One-Way Command Messages. | |||
|- | |||
| '''void Subscribe (void)''' | |||
| Method | |||
| Subscribe method exists only for Broadcast Messages. | |||
|- | |||
| Type | |||
| Property,<br>'''Read-only''',<br>String | |||
| Contains message type defined by the SCL declaration. Legal values include: | |||
"OneWayMessage" | |||
<br> "OneWayResponse" | |||
<br> "TwoWayMessage" | |||
<br> "BroadcastMessage" | |||
|- | |||
| '''void Unsubscribe (void)''' | |||
| Method | |||
| Unsubscribe method exists only for Broadcast Messages. | |||
|} | |||
=== <br><br>ascript.TestUnits<br> === | |||
TestUnits is a collection of [[#ascript.TestUnits.Item|TestUnit]] Objects contained and managed through ascript. | |||
{| cellspacing="0" cellpadding="10" width="100%" border="1" | |||
|- | |||
| width="150" bgcolor="#66ff99" | '''Member'''<br> | |||
| width="100" bgcolor="#66ff99" | '''Type'''<br> | |||
| bgcolor="#66ff99" | '''Description'''<br> | |||
|- | |||
| valign="top" | '''void ArrangeBy ('''<br> String By [optional], <br> String Order [optional]<br>''')''' | |||
| valign="top" | Method | |||
| valign="top" | Sorts the Test Units collection so that indexing by position yields predictable results.<br><br>The 'By' parameter may be either "Name" or "SUID". If not specified, the default is "Name". This represents how Test Units should be sorted in the collection.<br><br>The 'Order' parameter may be either "Ascending" or "Descending". If not specified, the default is "Ascending".<br><br>Exception thrown if either argument is outside legal values. | |||
|- | |||
| valign="top" | Count | |||
| valign="top" | Property,<br>'''Read-only''',<br>Integer | |||
| valign="top" | Returns the number of Test Units in this collection.<br> | |||
|- | |||
| valign="top" align="left" width="150" | | |||
[[#ascript.TestUnits.Item|Object]] '''Item '''(<br> Integer index<br>''')''' | |||
| valign="top" | Method<br> | |||
| valign="top" | Retrieves the test unit at the given index.<br> | |||
|} | |||
<br> | |||
==== <br>ascript.TestUnits.Item<br> ==== | |||
The TestUnit Object represents a captured Test Unit interface in the currently active STRIDE database. A Test Unit object always exists as a member of the [[#ascript.TestUnits|TestUnits]] collection and is accessed from the collection using the item(#) interface. | |||
{| cellspacing="0" cellpadding="10" width="100%" border="1" | |||
|- | |||
| width="150" bgcolor="#66ff99" | '''Member'''<br> | |||
| width="100" bgcolor="#66ff99" | '''Type'''<br> | |||
| bgcolor="#66ff99" | '''Description'''<br> | |||
|- | |||
| valign="top" align="left" width="150" | Arguments | |||
| valign="top" align="left" | Object | |||
| valign="top" align="left" | Test Unit parameter list payload. | |||
|- | |||
| valign="top" align="left" width="150" | Name | |||
| valign="top" align="left" | Property,<br>'''Read-only''',<br>String | |||
| valign="top" align="left" | Test Unit name. | |||
|- | |||
| valign="top" align="left" width="150" | IsRegistered | |||
| valign="top" align="left" | Property,<br>'''Read-only''',<br>Boolean | |||
| valign="top" align="left" | Contains true if the Test Unit owner has registered on the target side. | |||
|- | |||
| valign="top" align="left" width="150" | '''void Run (void)''' | |||
| valign="top" align="left" | Method | |||
| valign="top" align="left" | Method to run the test unit. | |||
|- | |||
| valign="top" align="left" width="150" | Suite | |||
| valign="top" align="left" | Property,<br>Object | |||
| valign="top" align="left" | An object of type Reporter's TestSuite. By default after a run this object is a sub-Suite of ascript.TestSuite with the same name as the Test Unit (null if no reporting performed). Setting Suite to a concrete external TestSuite prior to execution will override default creation behavior (set to null to revert to default behavior). | |||
|- | |||
| valign="top" align="left" width="150" | Summary | |||
| valign="top" align="left" | Property,<br>Integer | |||
| valign="top" align="left" | Contains static payload object of type srTestCaseTotals_t with result (i.e. pass, fail, in progress, not in use). | |||
|- | |||
| valign="top" align="left" width="150" | Type | |||
| valign="top" align="left" | Property,<br>'''Read-only''',<br>String | |||
| valign="top" align="left" | Contains test unit type (i.e. TestClass, TestCClass, or TestFList). | |||
|} | |||
<br> | |||
=== <br>ascript.Timers<br> === | |||
The Timers collection manages a set of [[#ascript.Timers.Item|Timer]] Objects. The Timers allow scripts to generate periodic or 'one-shot' timed events. Upon creation, the Timers collection is empty. The Timers collection is the only read/write collection in STRIDE; member Timer objects can be added (implicitly created) and removed by scripts. From the collection's point of view, member Timers have two states: dead and alive. Timers are alive upon creation and remain so as long as they exist in the collection. A Timer object that is removed from the collection is considered dead. Any operation on a dead timer will cause an exception to be thrown.<br> | |||
{| cellspacing="0" cellpadding="10" width="100%" border="1" | |||
|- | |||
| width="150" bgcolor="#66ff99" | '''Member'''<br> | |||
| width="100" bgcolor="#66ff99" | '''Type'''<br> | |||
| bgcolor="#66ff99" | '''Description'''<br> | |||
|- | |||
| valign="top" align="left" width="150" | [[#ascript.Timers.Item|Object]] '''Add''' (<br> [[#ascript.Timers.Item|Object]] timerObject<br>''')''' | |||
| valign="top" align="left" | Method<br> | |||
| valign="top" align="left" | Adds a new timer object. | |||
|- | |||
| valign="top" | '''void ArrangeBy ('''<br> String By [optional], <br> String Order [optional]<br>''')''' | |||
| valign="top" | Method | |||
| valign="top" | Sorts the Timers collection so that indexing by position yields predictable results.<br><br>The 'By' parameter may only be "Name". If not specified, the default is "Name". This represents how Timers should be sorted in the collection.<br><br>The 'Order' parameter may be either "Ascending" or "Descending". If not specified, the default is "Ascending".<br><br>Exception thrown if either argument is outside legal values. | |||
|- | |||
| valign="top" | Count | |||
| valign="top" | Property,<br>'''Read-only''',<br>Integer | |||
| valign="top" | Returns the number of Timers in this collection.<br> | |||
|- | |||
| valign="top" align="left" width="150" | [[#ascript.Timers.Item|Object]] '''Item (<br>''' Integer index<br>''')''' | |||
| valign="top" align="left" | Method<br> | |||
| valign="top" align="left" | Retrieves the Timer object for the given index. | |||
|- | |||
| valign="top" align="left" width="150" | [[#ascript.Timers.Item|Object]] '''Remove '''(<br> Integer index<br>''')''' | |||
| valign="top" | Method<br> | |||
| valign="top" | Removes the timer at the given index.<br>A timer object that is removed from the collection is automatically stopped before removal if it is active. No event is generated in this case. | |||
|} | |||
<br> | |||
==== <br>ascript.Timers.Item<br> ==== | |||
The ascript [[#ascript.Timers|Timers]] Collection's Item() method returns a Timer Object. The Timer object enables scripting clients to synthesize and receive timer-based periodic or one-shot events.<br> | |||
When a timer expires and rires its event, the event is queued and can be accessed by the ascript.WaitForEvent() method. The expired timer object will be returned by WaitForEvent();<br> | When a timer expires and rires its event, the event is queued and can be accessed by the ascript.WaitForEvent() method. The expired timer object will be returned by WaitForEvent();<br> |
Revision as of 19:35, 8 July 2008
Introduction
Ascript is the definitive hierarchy of methods, objects, and properties provided by Autosense. While Autosense helps the user find the script methods/data desired in a script, Ascript is the definitive source of what is available from STRIDE when using Autosense.
The ascript object provides functionality that allows host-based scripts to interact with target-based binaries through the STRIDE Runtime. Through ascript, you can:
- call target-based functions and messages (synchronously or asynchronously)
- set and read parameter values orf these functions and messages
- transparently emulate (mock) target-based functions
Automation API
ascript
When creating a script, the user types in Ascript followed by dot '.' to get Autosense to display. The user may select methods to be used within his script. The user may access property data within his script. this API is the definitive API for Autosense. The following table outlines the main objects and collections available to the user.
Member |
Type |
Description |
Arguments | Collection | Collection of arguments. |
Constants | Collection | Collection of constants. |
Database | Object | Database settings. |
Functions | Collection | Collection of functions. |
void Initialize ( String STIDName, String databaseFile, Integer messageBoxTimeout [optional] ) |
Method | Initializes and ascript object instance that has been created outside of tghe STRIDE Studio environment. This call is needed only on an explicitly-created ascript instance. This call should not be made on an ascript instance automatically created and injected into a script by STRIDE Studio. |
IsEventPending | Property, Read-only, Boolean |
Contains true if there is at least one event in this script's message queue. Events are retrieved from the queue using ascript.WaitForEvent(); |
LogicalPath | Property, Read-only, String |
Contains the script's path in the STRIDE Studio workspace tree. |
void MessageBox( String message, String title [optional], String type ) |
Method | Displays a model message box dialog. |
Messages | Collection | Collection of messages. |
Output | Property, (String, Integer, or Object) |
This is the return value from a RunBlocking() call that invoked this script. This works only when the script is invoked using RunBlocking() in the studio object model. |
RspTimeoutPeriod | Property, Integer |
This value controls the timeout threshold for synchronous function and two-way message calls (in milliseconds). A zero value indicates no timeout. For interactively run scripts the timeout behavior may be different. Specific calls affected by this value are:
|
ScriptName | Property, Read-only, String |
Contains the name of the currently running script with extension and without path. If the current ascript instance was instantiated and initialized outside of STRIDE Studio, this value will reflect the STIDName passed to ascript.Initialize(). |
void Sleep( Integer period ) |
Method | Time to pause (in milliseconds). Allowable range is 0 -1440000 (24 hours). |
Test Units | Collection | Collection of test units. |
Timers | Collection | Collection of timers. |
Object WaitForEvent ( void ) | Method | Pauses script execution until an event is detected in this script's event queue. |
WaitTimeoutPeriod | Property, String |
The timeout threshold (in milliseconds) for asynchronous function and message calls. A zero value indicates no timeout. |
ascript.Arguments
The Arguments collection manages a list of Arguments passed to a script which has been invoked via one of the following methods of the Studio Object Model's File object:
- RunBlocking([arg1], [arg2], ...)
- RunNonBlocking([arg1], [arg2], ...)
The default sort order of the member argument objects is the order in which the arguments were given in the call where the script was invoked.
Member |
Type |
Description |
Count | Property, Read-only, Integer |
Returns the number of Arguments in this collection. |
Object Item ( |
Method |
Retrieves the argument at the given index. An exception is thrown if the index is out of range. |
Object Item ( |
Method |
Retrieves the argument with the given name. If a named argument doesn't exist, null is returned.
|
ascript.Arguments.Item
The ascript Arguments Collection's Item() method returns a Argument Object.
Member |
Type |
Description |
Name | Property, Read-only, String |
The argument name. The name may have been specified in the studio automation RunBlocking() or RunNonBlocking() call that launched the script or if not specified the name is synthesized by the ascript object. When synthesized, the name is of the form "Unnamed_N" where 'N' is a monotonically incremented number starting from 0. |
Value | Property, Read-only, String, Integer, or Object |
The argument value. |
ascript.Constants
The Constants collection contains Constants objects that represent all constants in C/C++ source code compiled by the STRIDE compiler. Constants include all #define symbols and enumerated constants.
Member |
Type |
Description |
void ArrangeBy ( String By [optional], String Order [optional] ) |
Method | Sorts the Constants collection so that indexing by position yields predictable results. The 'By' parameter may only be "Name". If not specified, the default is "Name". This represents how Constants should be sorted in the collection. The 'Order' parameter may be either "Ascending" or "Descending". If not specified, the default is "Ascending". Exception thrown if either argument is outside legal values. |
Count | Property, Read-only, Integer |
Returns the number of Constants in this collection. |
Object Item ( |
Method |
Retrieves the constant at the given index. An exception is thrown if the index is out of range. |
Object Item ( |
Method |
Retrieves the constant with the given name. If a named constant doesn't exist, null is returned.
|
ascript.Constants.Item
The ascript Constants Collection's Item() method returns a Constant object.
Member |
Type |
Description |
Value | Property, Read-only, String |
The value of the constant. |
ascript.Database
The Database object represents the currently-loaded STRIDE database managed by ascript. You can combine the values of the database path and name to construct a fully-qualified filename. For example:
var dbFullPath = ascript.Database.Path + "\\" + ascript.Database.Name;
Member |
Type |
Description |
Name | Property, Read-only, String |
The name of the database in use. The database name includes the ".sidb" extension. |
Path |
Property, Read-only, String |
The path to the STRIDE database in use. The path does not contain a trailing backslash. |
ascript.Functions
The Functions collection represents all captured Function interfaces in the active database.
Member |
Type |
Description |
void ArrangeBy ( String By [optional], String Order [optional] ) |
Method | Sorts the Functions collection so that indexing by position yields predictable results. The 'By' parameter may be either "Name" or "SUID". If not specified, the default is "Name". This represents how Functions should be sorted in the collection. The 'Order' parameter may be either "Ascending" or "Descending". If not specified, the default is "Ascending". Exception thrown if either argument is outside legal values. |
Count | Property, Read-only, Integer |
Returns the number of Functions in this collection. |
Object Item ( |
Method |
Retrieves the function at the given index. An exception is thrown if the index is out of range. |
Object Item ( |
Method |
Retrieves the function with the given name. A null value is returned if there is no function with the given name. |
ascript.Functions.Item
The Function object represents a captured function interface in the currently active STRIDE database. A Function object always exists as a member of the Functions collection.
Member |
Type |
Description |
Name | Property, Read-only, Boolean |
Function's name. |
Owner | Property, Read-only, Object |
Function's owner object. The owner object provides access to properties and methods used by the owner-side of the function interface. The owner-side of the interface is used by the implementor of the function. |
SUID | Property, Read-Only, Integer |
STRIDE Unique IDentifier assigned by compiler. |
Type | Property, Read-Only, String |
Contains the string "Function". |
User | Property Read-Only, Object |
Function's user object. The user object provides access to properties and methods used by the user-side of the function interface. The user-side of the interface is used by the caller of the function. |
ascript.Functions.Item.Owner
The Function Owner object represents the Owner (callee) side of a function. The Owner object is used to implement a function in script that can be called through the STRIDE Runtime. The Function Owner object is reachable from a Function object's owner property.
Member |
Type |
Description |
IsOverrideRegistered | Property, Read-Only, Boolean |
Contains true if there is a registered override owner. |
IsRegistered | Property, Read-only, Boolean |
Contains true if there is a registered owner, a registered override owner, or both. |
Name | Property, Read-only, Boolean |
Owner name. |
OutPointers | Property, Read-only, Object |
Contains the OutPointers payload of the Function Owner. This exists only if the function's payload has at least one pointer that is qualified as OUT or INOUT. This property is a Dynamic Object.
|
ParameterList | Property, Read-only, Object |
Contains the object representing the ParameterList payload of the Function Owner. This property will exist only if the capture function contained one or more parameters. This property will contain the values of all ParameterList fields at the time the function User called the Owner. The value is a Dynamic Object. |
void Register (void) | Method | Registers the script from which it is called as the active owner of the function. If there is a currently registered owner or another registration failure, an exception is thrown. Once registered, ownership can be released either by a call to Unregister or by exiting the script that registered the function. |
void RegisterOverride (void) | Method | Registers the script as the override registered owner. If the function already has an override registered owner or if there is another registration error, an exception is thrown. |
void Return () | Method | Causes a return from a function call made from another script. |
ReturnValue | Property, Read-only, Integer |
Contains object representing ReturnValue payload of the function owner. Functions returning void will not have this property. The object is returned as a Dynamic Object. |
SUID | Property, Read-only, Integer |
STRIDE Unique IDentifier assigned by compiler. |
Type | Property, Read-only, String |
Contains "Function". |
void Unregister (void) | Method | Unregisters the script that was registered as the owner of the function from a prior Register call. If the current script is not the owner or if unregistration fails, an exception is thrown. |
void UnregisterOverride (void) | Method | Unregisters the script that was registered as the override owner of the function from a prior RegisterOverride call. If the current script is not the registered override owner or if unregistration fails, an exception is thrown. |
ascript.Functions.Item.User
The Function User object represents the User (caller) side of a function. The User object is used to call a function through the STRIDE Runtime. The Function User object is reachable from a Function object's User property.
Member |
Type |
Description | ||
void Call (void) | Method | Synchronously calls the registered owner of the function (Blocking call).
| ||
void CallBypassOverride (void) | Method | Synchronously calls the override registered owner of the function (Blocking call).
| ||
void CallBypassOverrideNonBlocking (void) | Method | Asynchronously calls the override registered owner of the function (Non-blocking call).
| ||
void CallNonBlocking (void) | Method | Asynchronously calls the registered owner of the function (Non-blocking call).
| ||
IsOverrideRegistered | Property, Read-only, Boolean |
Contains true if there is a registered override owner. | ||
IsRegistered | Property, Read-only, Boolean |
Contains true if there is a registered owner, a registered override owner, or both. | ||
Name | Property, Read-only, String |
User function name. | ||
OutPointers | Property, Read-only, Object |
Contains the OutPointers payload of the Function User object. This exists only if the function's payload has at least one pointer that is qualified as OUT or INOUT. This property is a Dynamic Object.
| ||
ParameterList | Property, Read-only, Object |
Contains the object representing the ParameterList payload of the Function Owner. Functions without parameters will not have this property. Before calling the function, all relevent fields in the ParameterList property must be set (includeing the fields of any child objects). These values are marshaled to the currently registered Owner of the function when it is called. This property is a Dynamic Object. | ||
ReturnValue | Property, Read-only, Object |
Contains the object representing the ReturnValue payload of the Function Owner. Functions returning void will not have this property. Upon return this property will reflect the ReturnValue set by the function Owner. This property is a Dynamic Object. | ||
SUID | Property, Read-only, ,Integer |
STRIDE Unique Identifier assigned by compiler. | ||
Type | Property, Read-only, String |
Contains "FunctionUser". This property is typically used to classify an object that is returned from ascript.WaitForEvent(). |
ascript.Messages
The Messages Collection is a collection of captured Message objects.
Member |
Type |
Description |
void ArrangeBy ( String By [optional], String Order [optional] ) |
Method | Sorts the Messages collection so that indexing by position yields predictable results. The 'By' parameter may one of the following: "Name", "SMID", "SUID", "Type". The default sorting order is by "Name". This represents how Timers should be sorted in the collection. A runtime exception is thrown if an invalid value is passed The 'Order' parameter may be either "Ascending" or "Descending" and is not case sensitive. If not specified, the default is "Ascending". A runtime exception is thrown if a invalid value is passed. |
Count | Property, Read-only, Integer |
Returns the number of Messages in this collection. |
Object Item ( |
Method |
Retrieves the message at the given index. |
ascript.Messages.Item
The Message object represents a captured message interface in the currently active STRIDE database. A Message object is always a member of the Messages collection.
Member |
Type |
Description |
Name | Property, Read-only, String |
Message name. |
Owner | Property, Read-only, Object |
Message's owner object. |
SMID | Property, Read-only, Integer |
STRIDE Message Identifier assigned by compiler. |
SUID | Property, Read-only, Integer |
STRIDE Unique Identifier assigned by compiler. |
Type | Property, Read-only, String |
Contains message type defined by the SCL declaration. Legal values include:
"OneWayMessage"
|
User | Property, Read-only, Object |
Message's user object. |
ascript.Messages.Item.Owner
The Message Owner object represents the Owner-side of a Message. This may be a receiver of a one-way or two-way message. It may also be the broadcaster of a broadcast message. The Owner object may be used to implement the message owner in a script that can be called through the STRIDE Runtime.
Member |
Type |
Description |
void Broadcast (void) | Method | Broadcast method exists only for Broadcast Messages. |
Command | Property, Read-only, Object |
This property is a Dynamic Object representing the Command payload of the Message Owner. The property exists only if the captured message took one or more parameters. The property contains all the values of the Message User Command fields at the time that the message User called the Owner. |
IsOverrideRegistered | Property, Read-only, Boolean |
Contains the override Owner registration state of the message. True only if there is a registered override owner. |
IsRegistered | Property, Read-only, Boolean |
Contains the Owner registration state of the message. True only if there is a registered owner, a registered override owner, or both. |
Name | Property, Read-only, String |
Contains Message name. |
void Register (void) | Method | Register method exists only for One-Way Command or Two-Way Messages. |
void RegisterOverride (void) | Method | Register override method exists only for One-Way Command or Two-Way Messages. |
Response | Property, Read-only, Object |
This property is a Dynamic Object representing the Response payload of the Message Owner. The property exists only if the message is defined with a response payload. |
void SendRsp (void) | Method | Send response method exists only for One-Way Response or Two-Way Messages. |
SMID | Property, Read-only, Integer |
STRIDE Message Identifier assigned by compiler. |
SUID | Property, Read-only, Integer |
STRIDE Unique Identifier assigned by compiler. |
Type | Property, Read-only, String |
Contains message type defined by the SCL declaration. Legal values include:
"OneWayMessage"
|
void Unregister (void) | Method | Unregister method exists only for One-Way Command or Two-Way Messages. |
void UnregisterOverride (void) | Method | Unregister override method exists only for One-Way Command or Two-Way Messages. |
ascript.Messages.Item.User
The Message User object represents the User-side of a Message. This may be a sender of a one-way or two-way message. It may also be the receiver of a broadcast message. The User object may be used to send a message from a script to the registered message owner through the STRIDE Runtime.
Member |
Type |
Description |
void Broadcast (void) | Method | Broadcast method exists only for Broadcast Messages. |
Command | Property, Read-only, Object |
This property is a Dynamic Object representing the Command payload of the Message User. The property exists only if the captured message took one or more parameters. The values of all Message User Command payload fields should be set before the Message Owner is called. |
IsOverrideRegistered | Property, Read-only, Boolean |
Contains the override Owner registration state of the message. True only if there is a registered override owner. |
IsRegistered | Property, Read-only, Boolean |
Contains the Owner registration state of the message. True only if there is a registered owner, a registered override owner, or both. |
Name | Property, Read-only, String |
Contains Message name. |
void Register (void) | Method | Register method exists only for One-Way Command or Two-Way Messages. |
void RegisterOverride (void) | Method | Register override method exists only for One-Way Command or Two-Way Messages. |
Response | Property, Read-only, Object |
This property is a Dynamic Object representing the Response payload of the Message User. The property exists only if the message is defined with a response payload. |
void SendRsp (void) | Method | Send response method exists only for One-Way Response or Two-Way Messages. |
SMID | Property, Read-only, Integer |
STRIDE Message Identifier assigned by compiler. |
SUID | Property, Read-only, Integer |
STRIDE Unique Identifier assigned by compiler. |
void SendAndRead ( Boolean value ) |
Method | Send and read method exists only for Two-Way and Broadcast Messages. |
void SendAndReadBypassOverride ( Boolean value ) |
Method | Send and read bypass override method exists only for Two-Way Messages. |
void SendCmd (void) | Method | Send command method exists only for One-Way Command Messages. |
void SendCmdBypassOverride ( Boolean value ) |
Method | Send command bypass override method exists only for One-Way Command Messages. |
void Subscribe (void) | Method | Subscribe method exists only for Broadcast Messages. |
Type | Property, Read-only, String |
Contains message type defined by the SCL declaration. Legal values include:
"OneWayMessage"
|
void Unsubscribe (void) | Method | Unsubscribe method exists only for Broadcast Messages. |
ascript.TestUnits
TestUnits is a collection of TestUnit Objects contained and managed through ascript.
Member |
Type |
Description |
void ArrangeBy ( String By [optional], String Order [optional] ) |
Method | Sorts the Test Units collection so that indexing by position yields predictable results. The 'By' parameter may be either "Name" or "SUID". If not specified, the default is "Name". This represents how Test Units should be sorted in the collection. The 'Order' parameter may be either "Ascending" or "Descending". If not specified, the default is "Ascending". Exception thrown if either argument is outside legal values. |
Count | Property, Read-only, Integer |
Returns the number of Test Units in this collection. |
Object Item ( |
Method |
Retrieves the test unit at the given index. |
ascript.TestUnits.Item
The TestUnit Object represents a captured Test Unit interface in the currently active STRIDE database. A Test Unit object always exists as a member of the TestUnits collection and is accessed from the collection using the item(#) interface.
Member |
Type |
Description |
Arguments | Object | Test Unit parameter list payload. |
Name | Property, Read-only, String |
Test Unit name. |
IsRegistered | Property, Read-only, Boolean |
Contains true if the Test Unit owner has registered on the target side. |
void Run (void) | Method | Method to run the test unit. |
Suite | Property, Object |
An object of type Reporter's TestSuite. By default after a run this object is a sub-Suite of ascript.TestSuite with the same name as the Test Unit (null if no reporting performed). Setting Suite to a concrete external TestSuite prior to execution will override default creation behavior (set to null to revert to default behavior). |
Summary | Property, Integer |
Contains static payload object of type srTestCaseTotals_t with result (i.e. pass, fail, in progress, not in use). |
Type | Property, Read-only, String |
Contains test unit type (i.e. TestClass, TestCClass, or TestFList). |
ascript.Timers
The Timers collection manages a set of Timer Objects. The Timers allow scripts to generate periodic or 'one-shot' timed events. Upon creation, the Timers collection is empty. The Timers collection is the only read/write collection in STRIDE; member Timer objects can be added (implicitly created) and removed by scripts. From the collection's point of view, member Timers have two states: dead and alive. Timers are alive upon creation and remain so as long as they exist in the collection. A Timer object that is removed from the collection is considered dead. Any operation on a dead timer will cause an exception to be thrown.
Member |
Type |
Description |
Object Add ( Object timerObject ) |
Method |
Adds a new timer object. |
void ArrangeBy ( String By [optional], String Order [optional] ) |
Method | Sorts the Timers collection so that indexing by position yields predictable results. The 'By' parameter may only be "Name". If not specified, the default is "Name". This represents how Timers should be sorted in the collection. The 'Order' parameter may be either "Ascending" or "Descending". If not specified, the default is "Ascending". Exception thrown if either argument is outside legal values. |
Count | Property, Read-only, Integer |
Returns the number of Timers in this collection. |
Object Item ( Integer index ) |
Method |
Retrieves the Timer object for the given index. |
Object Remove ( Integer index ) |
Method |
Removes the timer at the given index. A timer object that is removed from the collection is automatically stopped before removal if it is active. No event is generated in this case. |
ascript.Timers.Item
The ascript Timers Collection's Item() method returns a Timer Object. The Timer object enables scripting clients to synthesize and receive timer-based periodic or one-shot events.
When a timer expires and rires its event, the event is queued and can be accessed by the ascript.WaitForEvent() method. The expired timer object will be returned by WaitForEvent();
Member |
Type |
Description |
Active | Property, Read-only, Boolean |
Contains timer operation state. True if timer is in operation (i.e. it will generate an event at some time in the future). A newly created timer is inactive by default. |
Id | Property, Read-only, long |
Contains timer identifier. |
Duration | Property, long |
Timer duration in milliseconds. |
Name | Property, Read-only, String |
Name assigned when the timer was created. Default names are "Timer_n" where 'n' is the nth named time created by this ascript object. |
Periodic | Property, Boolean |
When false, the time will fire only once (one-shot mode). When true, the time automatically restarts after each event is fired. This property can be changed regardless of the state of the timer. This field is false by default when a timer is created. |
void Start (void) | Method |
Transitions an inactive timer to active. Once started, the timer will run for the length of time specified by its Duration property. Calling Start on a timer with a zero/negative duration will cause an exception to be thrown. Calling Start on a timer that has already started will also cause an exception to be thrown. |
void Stop (void) | Method |
Transitions an active timer to inactive. Calling Stop on a timer that is not active will cause an exception to be thrown. |
Type | Property, Read-only, String |
Contains the string "Timer". This property is typically used to classify an object that is returned from ascript.WaitForEvent(). |
Introduction
Ascript is the definitive hierarchy of methods, objects, and properties provided by Autosense. While Autosense helps the user find the script methods/data desired in a script, Ascript is the definitive source of what is available from STRIDE when using Autosense.
The ascript object provides functionality that allows host-based scripts to interact with target-based binaries through the STRIDE Runtime. Through ascript, you can:
- call target-based functions and messages (synchronously or asynchronously)
- set and read parameter values orf these functions and messages
- transparently emulate (mock) target-based functions
Automation API
ascript
When creating a script, the user types in Ascript followed by dot '.' to get Autosense to display. The user may select methods to be used within his script. The user may access property data within his script. this API is the definitive API for Autosense. The following table outlines the main objects and collections available to the user.
Member |
Type |
Description |
Arguments | Collection | Collection of arguments. |
Constants | Collection | Collection of constants. |
Database | Object | Database settings. |
Functions | Collection | Collection of functions. |
void Initialize ( String STIDName, String databaseFile, Integer messageBoxTimeout [optional] ) |
Method | Initializes and ascript object instance that has been created outside of tghe STRIDE Studio environment. This call is needed only on an explicitly-created ascript instance. This call should not be made on an ascript instance automatically created and injected into a script by STRIDE Studio. |
IsEventPending | Property, Read-only, Boolean |
Contains true if there is at least one event in this script's message queue. Events are retrieved from the queue using ascript.WaitForEvent(); |
LogicalPath | Property, Read-only, String |
Contains the script's path in the STRIDE Studio workspace tree. |
void MessageBox( String message, String title [optional], String type ) |
Method | Displays a model message box dialog. |
Messages | Collection | Collection of messages. |
Output | Property, (String, Integer, or Object) |
This is the return value from a RunBlocking() call that invoked this script. This works only when the script is invoked using RunBlocking() in the studio object model. |
RspTimeoutPeriod | Property, Integer |
This value controls the timeout threshold for synchronous function and two-way message calls (in milliseconds). A zero value indicates no timeout. For interactively run scripts the timeout behavior may be different. Specific calls affected by this value are:
|
ScriptName | Property, Read-only, String |
Contains the name of the currently running script with extension and without path. If the current ascript instance was instantiated and initialized outside of STRIDE Studio, this value will reflect the STIDName passed to ascript.Initialize(). |
void Sleep( Integer period ) |
Method | Time to pause (in milliseconds). Allowable range is 0 -1440000 (24 hours). |
Test Units | Collection | Collection of test units. |
Timers | Collection | Collection of timers. |
Object WaitForEvent ( void ) | Method | Pauses script execution until an event is detected in this script's event queue. |
WaitTimeoutPeriod | Property, String |
The timeout threshold (in milliseconds) for asynchronous function and message calls. A zero value indicates no timeout. |
ascript.Arguments
The Arguments collection manages a list of Arguments passed to a script which has been invoked via one of the following methods of the Studio Object Model's File object:
- RunBlocking([arg1], [arg2], ...)
- RunNonBlocking([arg1], [arg2], ...)
The default sort order of the member argument objects is the order in which the arguments were given in the call where the script was invoked.
Member |
Type |
Description |
Count | Property, Read-only, Integer |
Returns the number of Arguments in this collection. |
Object Item ( |
Method |
Retrieves the argument at the given index. An exception is thrown if the index is out of range. |
Object Item ( |
Method |
Retrieves the argument with the given name. If a named argument doesn't exist, null is returned.
|
ascript.Arguments.Item
The ascript Arguments Collection's Item() method returns a Argument Object.
Member |
Type |
Description |
Name | Property, Read-only, String |
The argument name. The name may have been specified in the studio automation RunBlocking() or RunNonBlocking() call that launched the script or if not specified the name is synthesized by the ascript object. When synthesized, the name is of the form "Unnamed_N" where 'N' is a monotonically incremented number starting from 0. |
Value | Property, Read-only, String, Integer, or Object |
The argument value. |
ascript.Constants
The Constants collection contains Constants objects that represent all constants in C/C++ source code compiled by the STRIDE compiler. Constants include all #define symbols and enumerated constants.
Member |
Type |
Description |
void ArrangeBy ( String By [optional], String Order [optional] ) |
Method | Sorts the Constants collection so that indexing by position yields predictable results. The 'By' parameter may only be "Name". If not specified, the default is "Name". This represents how Constants should be sorted in the collection. The 'Order' parameter may be either "Ascending" or "Descending". If not specified, the default is "Ascending". Exception thrown if either argument is outside legal values. |
Count | Property, Read-only, Integer |
Returns the number of Constants in this collection. |
Object Item ( |
Method |
Retrieves the constant at the given index. An exception is thrown if the index is out of range. |
Object Item ( |
Method |
Retrieves the constant with the given name. If a named constant doesn't exist, null is returned.
|
ascript.Constants.Item
The ascript Constants Collection's Item() method returns a Constant object.
Member |
Type |
Description |
Value | Property, Read-only, String |
The value of the constant. |
ascript.Database
The Database object represents the currently-loaded STRIDE database managed by ascript. You can combine the values of the database path and name to construct a fully-qualified filename. For example:
var dbFullPath = ascript.Database.Path + "\\" + ascript.Database.Name;
Member |
Type |
Description |
Name | Property, Read-only, String |
The name of the database in use. The database name includes the ".sidb" extension. |
Path |
Property, Read-only, String |
The path to the STRIDE database in use. The path does not contain a trailing backslash. |
ascript.Functions
The Functions collection represents all captured Function interfaces in the active database.
Member |
Type |
Description |
void ArrangeBy ( String By [optional], String Order [optional] ) |
Method | Sorts the Functions collection so that indexing by position yields predictable results. The 'By' parameter may be either "Name" or "SUID". If not specified, the default is "Name". This represents how Functions should be sorted in the collection. The 'Order' parameter may be either "Ascending" or "Descending". If not specified, the default is "Ascending". Exception thrown if either argument is outside legal values. |
Count | Property, Read-only, Integer |
Returns the number of Functions in this collection. |
Object Item ( |
Method |
Retrieves the function at the given index. An exception is thrown if the index is out of range. |
Object Item ( |
Method |
Retrieves the function with the given name. A null value is returned if there is no function with the given name. |
ascript.Functions.Item
The Function object represents a captured function interface in the currently active STRIDE database. A Function object always exists as a member of the Functions collection.
Member |
Type |
Description |
Name | Property, Read-only, Boolean |
Function's name. |
Owner | Property, Read-only, Object |
Function's owner object. The owner object provides access to properties and methods used by the owner-side of the function interface. The owner-side of the interface is used by the implementor of the function. |
SUID | Property, Read-Only, Integer |
STRIDE Unique IDentifier assigned by compiler. |
Type | Property, Read-Only, String |
Contains the string "Function". |
User | Property Read-Only, Object |
Function's user object. The user object provides access to properties and methods used by the user-side of the function interface. The user-side of the interface is used by the caller of the function. |
ascript.Functions.Item.Owner
The Function Owner object represents the Owner (callee) side of a function. The Owner object is used to implement a function in script that can be called through the STRIDE Runtime. The Function Owner object is reachable from a Function object's owner property.
Member |
Type |
Description |
IsOverrideRegistered | Property, Read-Only, Boolean |
Contains true if there is a registered override owner. |
IsRegistered | Property, Read-only, Boolean |
Contains true if there is a registered owner, a registered override owner, or both. |
Name | Property, Read-only, Boolean |
Owner name. |
OutPointers | Property, Read-only, Object |
Contains the OutPointers payload of the Function Owner. This exists only if the function's payload has at least one pointer that is qualified as OUT or INOUT. This property is a Dynamic Object.
|
ParameterList | Property, Read-only, Object |
Contains the object representing the ParameterList payload of the Function Owner. This property will exist only if the capture function contained one or more parameters. This property will contain the values of all ParameterList fields at the time the function User called the Owner. The value is a Dynamic Object. |
void Register (void) | Method | Registers the script from which it is called as the active owner of the function. If there is a currently registered owner or another registration failure, an exception is thrown. Once registered, ownership can be released either by a call to Unregister or by exiting the script that registered the function. |
void RegisterOverride (void) | Method | Registers the script as the override registered owner. If the function already has an override registered owner or if there is another registration error, an exception is thrown. |
void Return () | Method | Causes a return from a function call made from another script. |
ReturnValue | Property, Read-only, Integer |
Contains object representing ReturnValue payload of the function owner. Functions returning void will not have this property. The object is returned as a Dynamic Object. |
SUID | Property, Read-only, Integer |
STRIDE Unique IDentifier assigned by compiler. |
Type | Property, Read-only, String |
Contains "Function". |
void Unregister (void) | Method | Unregisters the script that was registered as the owner of the function from a prior Register call. If the current script is not the owner or if unregistration fails, an exception is thrown. |
void UnregisterOverride (void) | Method | Unregisters the script that was registered as the override owner of the function from a prior RegisterOverride call. If the current script is not the registered override owner or if unregistration fails, an exception is thrown. |
ascript.Functions.Item.User
The Function User object represents the User (caller) side of a function. The User object is used to call a function through the STRIDE Runtime. The Function User object is reachable from a Function object's User property.
Member |
Type |
Description | ||
void Call (void) | Method | Synchronously calls the registered owner of the function (Blocking call).
| ||
void CallBypassOverride (void) | Method | Synchronously calls the override registered owner of the function (Blocking call).
| ||
void CallBypassOverrideNonBlocking (void) | Method | Asynchronously calls the override registered owner of the function (Non-blocking call).
| ||
void CallNonBlocking (void) | Method | Asynchronously calls the registered owner of the function (Non-blocking call).
| ||
IsOverrideRegistered | Property, Read-only, Boolean |
Contains true if there is a registered override owner. | ||
IsRegistered | Property, Read-only, Boolean |
Contains true if there is a registered owner, a registered override owner, or both. | ||
Name | Property, Read-only, String |
User function name. | ||
OutPointers | Property, Read-only, Object |
Contains the OutPointers payload of the Function User object. This exists only if the function's payload has at least one pointer that is qualified as OUT or INOUT. This property is a Dynamic Object.
| ||
ParameterList | Property, Read-only, Object |
Contains the object representing the ParameterList payload of the Function Owner. Functions without parameters will not have this property. Before calling the function, all relevent fields in the ParameterList property must be set (includeing the fields of any child objects). These values are marshaled to the currently registered Owner of the function when it is called. This property is a Dynamic Object. | ||
ReturnValue | Property, Read-only, Object |
Contains the object representing the ReturnValue payload of the Function Owner. Functions returning void will not have this property. Upon return this property will reflect the ReturnValue set by the function Owner. This property is a Dynamic Object. | ||
SUID | Property, Read-only, ,Integer |
STRIDE Unique Identifier assigned by compiler. | ||
Type | Property, Read-only, String |
Contains "FunctionUser". This property is typically used to classify an object that is returned from ascript.WaitForEvent(). |
ascript.Messages
The Messages Collection is a collection of captured Message objects.
Member |
Type |
Description |
void ArrangeBy ( String By [optional], String Order [optional] ) |
Method | Sorts the Messages collection so that indexing by position yields predictable results. The 'By' parameter may one of the following: "Name", "SMID", "SUID", "Type". The default sorting order is by "Name". This represents how Timers should be sorted in the collection. A runtime exception is thrown if an invalid value is passed The 'Order' parameter may be either "Ascending" or "Descending" and is not case sensitive. If not specified, the default is "Ascending". A runtime exception is thrown if a invalid value is passed. |
Count | Property, Read-only, Integer |
Returns the number of Messages in this collection. |
Object Item ( |
Method |
Retrieves the message at the given index. |
ascript.Messages.Item
The Message object represents a captured message interface in the currently active STRIDE database. A Message object is always a member of the Messages collection.
Member |
Type |
Description |
Name | Property, Read-only, String |
Message name. |
Owner | Property, Read-only, Object |
Message's owner object. |
SMID | Property, Read-only, Integer |
STRIDE Message Identifier assigned by compiler. |
SUID | Property, Read-only, Integer |
STRIDE Unique Identifier assigned by compiler. |
Type | Property, Read-only, String |
Contains message type defined by the SCL declaration. Legal values include:
"OneWayMessage"
|
User | Property, Read-only, Object |
Message's user object. |
ascript.Messages.Item.Owner
The Message Owner object represents the Owner-side of a Message. This may be a receiver of a one-way or two-way message. It may also be the broadcaster of a broadcast message. The Owner object may be used to implement the message owner in a script that can be called through the STRIDE Runtime.
Member |
Type |
Description |
void Broadcast (void) | Method | Broadcast method exists only for Broadcast Messages. |
Command | Property, Read-only, Object |
This property is a Dynamic Object representing the Command payload of the Message Owner. The property exists only if the captured message took one or more parameters. The property contains all the values of the Message User Command fields at the time that the message User called the Owner. |
IsOverrideRegistered | Property, Read-only, Boolean |
Contains the override Owner registration state of the message. True only if there is a registered override owner. |
IsRegistered | Property, Read-only, Boolean |
Contains the Owner registration state of the message. True only if there is a registered owner, a registered override owner, or both. |
Name | Property, Read-only, String |
Contains Message name. |
void Register (void) | Method | Register method exists only for One-Way Command or Two-Way Messages. |
void RegisterOverride (void) | Method | Register override method exists only for One-Way Command or Two-Way Messages. |
Response | Property, Read-only, Object |
This property is a Dynamic Object representing the Response payload of the Message Owner. The property exists only if the message is defined with a response payload. |
void SendRsp (void) | Method | Send response method exists only for One-Way Response or Two-Way Messages. |
SMID | Property, Read-only, Integer |
STRIDE Message Identifier assigned by compiler. |
SUID | Property, Read-only, Integer |
STRIDE Unique Identifier assigned by compiler. |
Type | Property, Read-only, String |
Contains message type defined by the SCL declaration. Legal values include:
"OneWayMessage"
|
void Unregister (void) | Method | Unregister method exists only for One-Way Command or Two-Way Messages. |
void UnregisterOverride (void) | Method | Unregister override method exists only for One-Way Command or Two-Way Messages. |
ascript.Messages.Item.User
The Message User object represents the User-side of a Message. This may be a sender of a one-way or two-way message. It may also be the receiver of a broadcast message. The User object may be used to send a message from a script to the registered message owner through the STRIDE Runtime.
Member |
Type |
Description |
void Broadcast (void) | Method | Broadcast method exists only for Broadcast Messages. |
Command | Property, Read-only, Object |
This property is a Dynamic Object representing the Command payload of the Message User. The property exists only if the captured message took one or more parameters. The values of all Message User Command payload fields should be set before the Message Owner is called. |
IsOverrideRegistered | Property, Read-only, Boolean |
Contains the override Owner registration state of the message. True only if there is a registered override owner. |
IsRegistered | Property, Read-only, Boolean |
Contains the Owner registration state of the message. True only if there is a registered owner, a registered override owner, or both. |
Name | Property, Read-only, String |
Contains Message name. |
void Register (void) | Method | Register method exists only for One-Way Command or Two-Way Messages. |
void RegisterOverride (void) | Method | Register override method exists only for One-Way Command or Two-Way Messages. |
Response | Property, Read-only, Object |
This property is a Dynamic Object representing the Response payload of the Message User. The property exists only if the message is defined with a response payload. |
void SendRsp (void) | Method | Send response method exists only for One-Way Response or Two-Way Messages. |
SMID | Property, Read-only, Integer |
STRIDE Message Identifier assigned by compiler. |
SUID | Property, Read-only, Integer |
STRIDE Unique Identifier assigned by compiler. |
void SendAndRead ( Boolean value ) |
Method | Send and read method exists only for Two-Way and Broadcast Messages. |
void SendAndReadBypassOverride ( Boolean value ) |
Method | Send and read bypass override method exists only for Two-Way Messages. |
void SendCmd (void) | Method | Send command method exists only for One-Way Command Messages. |
void SendCmdBypassOverride ( Boolean value ) |
Method | Send command bypass override method exists only for One-Way Command Messages. |
void Subscribe (void) | Method | Subscribe method exists only for Broadcast Messages. |
Type | Property, Read-only, String |
Contains message type defined by the SCL declaration. Legal values include:
"OneWayMessage"
|
void Unsubscribe (void) | Method | Unsubscribe method exists only for Broadcast Messages. |
ascript.TestUnits
TestUnits is a collection of TestUnit Objects contained and managed through ascript.
Member |
Type |
Description |
void ArrangeBy ( String By [optional], String Order [optional] ) |
Method | Sorts the Test Units collection so that indexing by position yields predictable results. The 'By' parameter may be either "Name" or "SUID". If not specified, the default is "Name". This represents how Test Units should be sorted in the collection. The 'Order' parameter may be either "Ascending" or "Descending". If not specified, the default is "Ascending". Exception thrown if either argument is outside legal values. |
Count | Property, Read-only, Integer |
Returns the number of Test Units in this collection. |
Object Item ( |
Method |
Retrieves the test unit at the given index. |
ascript.TestUnits.Item
The TestUnit Object represents a captured Test Unit interface in the currently active STRIDE database. A Test Unit object always exists as a member of the TestUnits collection and is accessed from the collection using the item(#) interface.
Member |
Type |
Description |
Arguments | Object | Test Unit parameter list payload. |
Name | Property, Read-only, String |
Test Unit name. |
IsRegistered | Property, Read-only, Boolean |
Contains true if the Test Unit owner has registered on the target side. |
void Run (void) | Method | Method to run the test unit. |
Suite | Property, Object |
An object of type Reporter's TestSuite. By default after a run this object is a sub-Suite of ascript.TestSuite with the same name as the Test Unit (null if no reporting performed). Setting Suite to a concrete external TestSuite prior to execution will override default creation behavior (set to null to revert to default behavior). |
Summary | Property, Integer |
Contains static payload object of type srTestCaseTotals_t with result (i.e. pass, fail, in progress, not in use). |
Type | Property, Read-only, String |
Contains test unit type (i.e. TestClass, TestCClass, or TestFList). |
ascript.Timers
The Timers collection manages a set of Timer Objects. The Timers allow scripts to generate periodic or 'one-shot' timed events. Upon creation, the Timers collection is empty. The Timers collection is the only read/write collection in STRIDE; member Timer objects can be added (implicitly created) and removed by scripts. From the collection's point of view, member Timers have two states: dead and alive. Timers are alive upon creation and remain so as long as they exist in the collection. A Timer object that is removed from the collection is considered dead. Any operation on a dead timer will cause an exception to be thrown.
Member |
Type |
Description |
Object Add ( Object timerObject ) |
Method |
Adds a new timer object. |
void ArrangeBy ( String By [optional], String Order [optional] ) |
Method | Sorts the Timers collection so that indexing by position yields predictable results. The 'By' parameter may only be "Name". If not specified, the default is "Name". This represents how Timers should be sorted in the collection. The 'Order' parameter may be either "Ascending" or "Descending". If not specified, the default is "Ascending". Exception thrown if either argument is outside legal values. |
Count | Property, Read-only, Integer |
Returns the number of Timers in this collection. |
Object Item ( Integer index ) |
Method |
Retrieves the Timer object for the given index. |
Object Remove ( Integer index ) |
Method |
Removes the timer at the given index. A timer object that is removed from the collection is automatically stopped before removal if it is active. No event is generated in this case. |
ascript.Timers.Item
The ascript Timers Collection's Item() method returns a Timer Object. The Timer object enables scripting clients to synthesize and receive timer-based periodic or one-shot events.
When a timer expires and rires its event, the event is queued and can be accessed by the ascript.WaitForEvent() method. The expired timer object will be returned by WaitForEvent();
Member |
Type |
Description |
Active | Property, Read-only, Boolean |
Contains timer operation state. True if timer is in operation (i.e. it will generate an event at some time in the future). A newly created timer is inactive by default. |
Id | Property, Read-only, long |
Contains timer identifier. |
Duration | Property, long |
Timer duration in milliseconds. |
Name | Property, Read-only, String |
Name assigned when the timer was created. Default names are "Timer_n" where 'n' is the nth named time created by this ascript object. |
Periodic | Property, Boolean |
When false, the time will fire only once (one-shot mode). When true, the time automatically restarts after each event is fired. This property can be changed regardless of the state of the timer. This field is false by default when a timer is created. |
void Start (void) | Method |
Transitions an inactive timer to active. Once started, the timer will run for the length of time specified by its Duration property. Calling Start on a timer with a zero/negative duration will cause an exception to be thrown. Calling Start on a timer that has already started will also cause an exception to be thrown. |
void Stop (void) | Method |
Transitions an active timer to inactive. Calling Stop on a timer that is not active will cause an exception to be thrown. |
Type | Property, Read-only, String |
Contains the string "Timer". This property is typically used to classify an object that is returned from ascript.WaitForEvent(). |