ID : 2244
gCao object
A gCao object controls the generation and/or delete of a provider.
A gCao object is an array-type data that has 10 elements (0 to 9), and its each element corresponds to CaoWorkspace object of ORiN2.
"Cao" and "gCao"
In PacScript language, Cao object and gCao object are the same data type (CaoWorkspace).
The figure above shows the relationship of Cao and gCao in PacScript language.
Each task (program) has only one local "Cao" object, which is an embedded object.
Cao objects in different tasks are independent, so they do not affect each other.
On the other hand, a "gCao" object exists outside of the task (program) as a global object.
Therefore, if different tasks refer the same element number of gCao, these tasks will affect each other.
(For example; when both Task 1 and Task 2 refer gCao[0].)
Reference of Element
There are two formats to refer to the number "n" of a gCao object as follows.
- gCao? format
Enter a digit from 0 to 9 immediately after "gCao". (For example, gCao0, gCao2)
Use this format when the referred element is static. - gCao[n] format
Enter a variable or formula whose calculation result will be 0 to 9, with square brackets, immediately after "gCao".
The formula is evaluated dynamically when it is executed.
Use this format when the referred element is dynamic.
Creation and Delete of Objects
Unlike Cao objects, the creation and delete of gCao object is independent of PacScript tasks. gCao object always exists in the global area of PacScript language and will not disappear.
However, objects in each element of gCao object are correlated within referred tasks.
- If gCao[n] is referred by "task A", when task A stops, a provider cancel request (Provider Cancel) will be issued for all providers where gCao[n] is used.
- If gCao[n] is referred by "task A", when task A starts, a provider clear request (Provider Clear) will be issued for all providers where gCao[n] is used.
Precautions when the Same Element of gCao Object is Used by Multiple Tasks
If a task stops, a provider cancel request (ProviderCancel) will be executed for gCao[n] where the task refers.
It means the provider cancel request will be executed for ongoing process of all providers under gCao[n].Controllers that have been generated by gCao[n].AddController().
This operation will force providers to cancel the ongoing process, issue an error, leading to the tasks that refer the same gCao[n] to stop .
In order not to be affected by other tasks, use different gCao element number from other tasks.
Related Command
For command specifications, refer to Cao object.
gCao object and Cao object are the same object type.
Example
'Tsr0.pcs
Sub Main
I0 = 0 'Clear a flag
'Add QRCode provider to gCao0.
Dim qr As Object
qr = gCao[0].AddController( "QRCode", "CaoProv.DENSO.QRCode", "", "Conn=Com:2" )
Do
Delay 100
If I0 = 1 Then Exit Do 'wait until the flag becomes 1
Loop
'Delete QRCode provider from gCao0.
gCao[0].Controllers.Remove "QRCode"
End Sub
'Tsr1.pcs
Sub Main
'Wait until QRCode is added to gCao0.
Do
Delay 100
If gCao[0].Controllers.IsMember( "QRCode" ) Then Exit Do
Loop
'Obtain QRCode objects from gCao0.
Dim qr As Object
qr = gCao[0].Controllers.Item( "QRCode" )
': Execute qr command.
I0 = 1 'Set the flag to 1 because it is not necessary anymore.
End Sub
ID : 2244