ORiN 2 programming guide

-1-

ORiN2
Programming guide
Version 1.0.21.0
November 22, 2022

[Remarks]
Some items might not be installed depending on the package you have.

ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide-2-[Revision history]
Date

VersionContent

2005-05-09

1.0.0.0

First edition.

2006-08-21

1.0.1.0

Add the way to register CAO RCW into GAC under .NET framework 2.0.

2007-04-23

1.0.2.0

ORiN Installer registers CAO and CaoSQL RCW into GAC.

2008-07-16

1.0.3.0

Add some descriptions

2009-06-12

1.0.4.0

Add Import and Export commands to save settings.

2009-07-31

1.0.5.0

Add the way to register CAO RCW into GAC under .NET framework 2.0.

2010-02-10

1.0.6.0

Add description on LabVIEW

2010-06-08

1.0.7.0

Add the way to confirm an installation state of ORiN2 SDK.

2011-04-27

1.0.8.0

Add a sample code in C#.

2011-12-22

1.0.9.0

Add an error code.

2012-07-10

1.0.10.0

Add an error code.

2012-08-24

1.0.11.0

Modify an error code

2012-09-07

1.0.12.0

Modify an error code

2014-01-20

1.0.13.0

Add an error code.
Add an integration into Visual Studio

2014-09-22

1.0.14.0

Add an error code.

2015-11-04

1.0.15.0

Add SysLog output of CAO log.

2016-12-12

1.0.16.0

Correction of errors.

2017-03-03

1.0.17.0

Add an error code.

2017-09-21

1.0.18.0

Add client creation using Java-COM bridge

2019-06-18

1.0.19.0

Add an error code.

2021-12-13

Fixes to the CAO call diagram in Java

2022-06-24

1.0.20.0

Add C# programming using ManagedCAO

2022-11-22

1.0.21.0

Correction of errors.

ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide-3-

Content
1. Introduction ............................................................................................ 6
2. Implementation of CAO client ................................................................. 8
2.1. Outline......................................................................................................................................... 8
2.2. Basic knowledge ......................................................................................................................... 9
2.2.1. Early Binding and Late Binding............................................................................................ 9
2.2.2. Creation and management of object ..................................................................................112.2.3. Asynchronous processing .................................................................................................. 13
2.2.4. Variable type used with COM............................................................................................. 13
2.2.5. Notation of data .................................................................................................................. 19
2.2.6. Log output .......................................................................................................................... 20
2.2.7. Error code .......................................................................................................................... 20
2.3. An installation state of ORiN2 SDK .......................................................................................... 24
2.4. CAO client implementation ....................................................................................................... 24
2.4.1. Open controller................................................................................................................... 24
2.4.2. Retrieve and set variable ................................................................................................... 25
2.4.3. Retrieve and set system variable....................................................................................... 26
2.4.4. Event processing ............................................................................................................... 26
2.5. Developing client with VB.NET ................................................................................................. 29
2.5.1. RCW registration to GAC ................................................................................................... 29
2.5.2. VB.NET project setting....................................................................................................... 30
2.5.3. Notes on object deletion .................................................................................................... 30
2.5.4. Method of handling event................................................................................................... 31
2.6. Developing client with other languages .................................................................................... 32
2.6.1. Client development with C++ ............................................................................................. 32
2.6.2. Client development with C ................................................................................................. 36
2.6.3. Client development with C# ............................................................................................... 37
2.6.4. Client development with Delphi ......................................................................................... 45
2.6.5. Creating client in Java........................................................................................................ 47
2.6.6. Creating client in LabVIEW ................................................................................................ 53
2.7. Special functions of CAO .......................................................................................................... 55
2.7.1. CRD switch function ........................................................................................................... 55
2.7.2. Automatic object registration function ................................................................................ 55
2.7.3. Dynamic method addition function..................................................................................... 56

3. CRD programming guide...................................................................... 58
3.1. Outline....................................................................................................................................... 58
3.2. Basic knowledge ....................................................................................................................... 58
ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide-4-

3.2.1. What is XML? ..................................................................................................................... 58
3.2.2. DOM ................................................................................................................................... 59
3.2.3. XML parser ......................................................................................................................... 59
3.2.4. XML schema ...................................................................................................................... 59
3.3. CRD file and CRD provider ...................................................................................................... 60
3.4. Creating CRD file ...................................................................................................................... 61
3.4.1. Header and root element creation ..................................................................................... 61
3.4.2. Static data definition ........................................................................................................... 61
3.4.3. System configuration definition .......................................................................................... 61
3.4.4. Device capability definition................................................................................................. 62
3.5. Sample CRD file ....................................................................................................................... 64
3.5.1. Static data definition example ............................................................................................ 64
3.5.2. System configuration definition example ........................................................................... 65
3.5.3. Device capability definition example .................................................................................. 65

4. CAP programming guide ...................................................................... 68
4.1. Outline....................................................................................................................................... 68
4.2. Basic knowledge ....................................................................................................................... 68
4.2.1. SOAP ................................................................................................................................. 68
4.3. CAP provider and CAP listener ................................................................................................ 68
4.4. Environmental construction ...................................................................................................... 70
4.4.1. Setting of server side ......................................................................................................... 70
4.4.2. Client side .......................................................................................................................... 77
4.5. Sample program ....................................................................................................................... 77

5. Environmental setting ........................................................................... 79
5.1. DCOM setting procedures ........................................................................................................ 79
5.1.1. Preparation ......................................................................................................................... 80
5.1.2. Set item in Windows NT/2000 ........................................................................................... 80
5.1.3. Set item in Windows9x....................................................................................................... 85
5.1.4. Set item in Windows XP..................................................................................................... 86
5.1.5. Set item in Windows XP SP2 ............................................................................................. 93
5.1.6. Set confirmation of DCOM ................................................................................................. 96
5.2. Integration into Visual Studio .................................................................................................... 99
5.2.1. Visual Studio menu bar ...................................................................................................... 99
5.2.2. CAO Provider Wizard ....................................................................................................... 100

6. CaoConfig .......................................................................................... 101
6.1. Window layout ........................................................................................................................ 101
6.1.1. Menu ................................................................................................................................ 101
ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide-5-

6.1.2. Cao Engine tab ................................................................................................................ 103

ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide-6-

1. Introduction
ORiN is a middleware that offers a standard interface of various resources, like various Factory Automation(FA) equipment and databases, etc. including robots. By using ORiN, applications can be developed without
depending on the manufacturer or the model type.
ORiN2 is composed of the following three basic technologies shown in Figure 1-1.
(1) CAO(Controller Access Object)(2) CRD(Controller Resource Definition)(3) CAP(Controller Access Protocol)

Figure 1-1 Three basic techniques of ORiN2
CAO is "Standard program interface" to access robots controller from client applications. CAO is developed
based on the distributed object technology, and it is applied not only to the industrial robots but also PLC(Programmable Logic Controller) and the NC machine tool, etc. CAO has expanded the range of its
application.
CRD is "Standard Data Schema" to share robot controller's resource information without depending on the
robot manufacture, and uses XML files. CAO is a common API, and CRD is a common data expression. CRD
is developed based on the XML technology, and can express various types of data, which differ in each robot
manufacturer, by single CRD schema. Just like CAO, application field of the CRD basic data schema is not
limited to the robot, but "Production information" etc. also can be expressed.
CAP is "Communication protocol for the Internet" to access CAO provider over the Internet. CAP isdeveloped based on the SOAP (Simple Object Access Protocol) technology, and offers the function to access
ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide-7-

remote controllers without forcing ORiN application developer considering the Internet.

This book is a programming guide for these three basic technologies, CAO/CRD/CAP. Chapter 2 describes
about the procedure for "Implementation of the CAO client". Chapter 3 is about the procedure to "Make of
CRD file". Chapter 4 explains procedure for "Remote connection with CAP". Intended reader of each chapter
is shown in Table 1-1. Each chapter explains necessary basic knowledge for the chapter in the first half, andthen explains the implementation method in the latter half with concrete examples.

Table 1-1 Intended reader of this book
ChapterContent

Chapter 2 Implementation of CAO client

Intended Reader
ORiN application developer(p.8)
Chapter 3 Introduction to CRD implementation

Robot vender(p.58)

ORiN application developer

Chapter 4 Remote connection by CAP

ORiN application developer(p. 68)Chapter 5 explains the method of setting DCOM to use the CAO provider remotely. Chapter 6 explains how
to use ORiN2 SDK tools.

ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide-8-

2. Implementation of CAO client
2.1. Outline
CAO is developed based on the distributed object technology as described in the previous chapter. In ORiN2
SDK, DCOM (Distributed Component Object Model) of Microsoft Corporation is adopted as a distributed
object technology. The DCOM based CAO can be used from various program languages such as C++, JAVA,
and Visual Basic.
This chapter uses and explains Visual Basic6.0 (VB6), because the language is best for the introduction
purpose. The first half of this chapter explains the object generation method as basic knowledge of VB6. The
latter half of this chapter explains examples of variable object processing and event handling. The explanation
uses the Blackboard provider, which is a standard provider included in ORiN2 SDK, and also includes
example codes.
The Blackboard provider, which is used in the sample, offers functions to share the variable table between
client applications, and it only has variable object. However, because the provider has functions of the eventand the system variable, etc., readers can experience most of the general functions of the CAO provider.
The object model of CAO is shown as follows.

Figure2-1 Object model of CAO

ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide-9-2.2. Basic knowledge
2.2.1. Early Binding and Late Binding
CAO client has two types of object generation method, i.e. early binding and late binding1. Following
explains the difference of these two methods, and how to generate objects.
2.2.1.1. Early Binding
Early binding is a method of acquiring type information of the object at compiling time by referring to thetype library. Client will keep type information and the information inquiry from client to the component is notnecessary. As a result, the processing speed improves. However, as weak point, clients need to be recompiled if
component with object information are changed, and it reduces flexibility.
Following procedures is how to use Early Binding.

(4) Select [Project]->[reference setting] in the menu bar of VB6.
(5) When the dialog is displayed as shown in Figure2-2, add the type library "CAO 1.0 type library".

Figure2-2 Reference setting screen of VB

1 1

It uses and it explains the early binding in this book.

ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide- 10 -(6) The CaoEngine object can be generated with Early Binding by writing the following codes with
VB6.
'CaoEngine type variable is made.
Dim caoEng As CaoEngine'An instance is created with New keyword, and substituted by Set statement.
Set caoEng = New CaoEngine

Because CaoEngine is an object, Set statement is necessary for substitution2. The CaoEngine type can becalled when the variable is declared, because the reference setting is finished in reference setting ob VB
environment.
2.2.1.2. Late Binding
Unlike early binding, late binding doesn't need the type library. There is no object type inspection incompilation time, and the object type is dynamically inspected at the execution time. Therefore, the processing
speed is slower than early binding because all process including type inspection is executed at runtime.
However, recompilation of application after the change of component is not necessary, because it is completely
independent of the component, and it is excellent in flexibility.
In rate binding, an object is created by using CreateObject. The definition of CreateObject is shown below.
CreateObject(class)This function returns a pointer to an object specified with class. At this time, class is composed of“application-name.object-name."
To create an object with rate binding, write the following codes.
' An Object type variable is declared.
Dim caoEng As Object' A CaoEngine object created with CreateObject() is substituted into caoEng.
Set caoEng = CreateObject(“CAO.CaoEngine" )In this example, object type variable is created first. Then CaoEngine object of CAO.exe is created with
CreateObject.

2

In VB.NET, the Set statement is not used.

ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide- 11 -

2.2.2. Creation and management of object
For the creation of COM object, New keyword or CreateObject function is used. The created object issubstituted into a variable by using Set statement. These created object need to be deleted before the program
ends. To delete the object, substitute Nothing to the variable3.
For instance, following is a sample code of CaoEngine object to be created and deleted.
' CaoEngine type variable is declared.
Dim caoEng As CaoEngine' Creation of object
Set caoEng = New CaoEngine' Deletion of object
If Not caoEng Is Nothing Then
Set caoEng = Nothing
End If

CAO client manages objects in the following way.
By using ORiN2 SDK, the objects shown in table Appendix A.1 CAO engine function list can be created. A
sample program in this document uses a Blackboard provider, and it uses the following objects.
・ CaoEngine
・ CaoWorkspace
・ CaoController
・ CaoVariable
These object need to be created sequentially. Below is the order of creation.

(1) The CaoEngine object is created with New or CreateObject().
(2) The CaoWorkspace object is acquired from the CaoEngine object. (default workspace)(3) The CaoController object is created from the CaoWorkspace object.
(4) The CaoVariable object is created from the CaoController object.

3

It is necessary to call the function to open the object specifying it in VB.NET though the object can be annulled by substituting Nothing in VB6.
Please refer to 2.5.3 f or details.

ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide- 12 -

Section 2.3 describes about a concrete object generation method. The creation order is shown in Figure2-3.

CaoEngine

CaoWorkspace

CaoController

CaoVariable
Figure2-3 Creation and the acquisition order of object

As mentioned previously, when the CAO client ends, it is necessary to delete all created objects. If theobject is not normally deleted, CAO.exe4 might not be terminated even after the CAO client ends. Although
the CAO engine can be deleted only by substituting Nothing, other objects maintained by object collection,
including CAO workspace, need to be deleted in the reverse order of creation and acquisition. Each object of
CAO is created by Add… method. When objects are created, they are automatically registered in the collection.
If an object is registered in a collection, they aren’t deleted even if a client deletes the object. Remove method
is necessary to remove a object from a collection.

Following is an example. In this example, the program deletes objects in order of CaoVariable,
CaoController, CaoWorkspace, and the CaoEngine object.
‘caoVar is deleted from the Variable collection of caoCtrl.
If Not caoVar Is Nothing Then
caoCtrl.Variables.remove caoVar.Index
Set caoVar = Nothing
End If‘caoCtrl is deleted from the Controller collection of 'caoWS.
If Not caoCtrl Is Nothing Then
caoWS.Controllers.remove caoCtrl.Index
Set caoCtrl = Nothing
End If‘caoWS is deleted from the Workspace collection of 'caoEng.
If Not caoWS Is Nothing Then caoEng.Workspaces.Remove (caoWS.Index)
Set caoWS = Nothing
End If

4

CAO.exe is a file of the execute form of the CAO engine. When the CaoEngine object is generated in the client application, it starts
automatically.

ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide- 13 -

If Not caoEng Is Nothing Then
Set caoEng = Nothing
End If2.2.3. Asynchronous processing
Asynchronous processing that uses the event is supported in CAO. For instance, in the Blackboard provider
which we will use as a sample, the event is generated when a variable is added or the value of variable ischanged, and asynchronous processing can be achieved.
Different from synchronous processing, asynchronous processing does not return result by return value of
property. When an event occurs, the event procedure of the variable that maintains an object is called.
Therefore, for asynchronously processing, the client should implement process of receiving the result in theevent procedure.
Following is the procedure to use asynchronous processing of CAO.5(1) Add“WithEvents" to the declaration of the CaoController object. Following is an example of
CaoController declaration with event procedure.
Private WithEvents caoCtrl As CaoController(2) Add process to the event procedure. The event procedure name is the controller name followed by“_OnMessage". Following is an example of implementing the event procedure.
Private Sub caoCtrl_OnMessage(ByVal pICaoMess As CAOLib.ICaoMessage)'Describe the content of processing here
End Sub

Please refer to user's guide of each provider for details of the member variable implemented on
CAOLib.ICaoMessage that is the argument of the event procedure. In the BlackBoard provider, which is used
for the example, the name of the event type, the changing variable name and value, etc. are implemented.

2.2.4. Variable type used with COM
Four variable types, BSTR, VARIANT, SAFEARRAY, and HRESULT are characteristic variable types usedin COM, and they are also often used in provider implementation.
2.2.4.1. BSTR
BSTR is a data type composed of a wide character string and string length in the DWORD type. The pointerof the BSTR type indicates the head of the character string as shown in Figure2-4.

Figure2-4 Structure of BSTR5

It is necessary to set the event procedure by the AddHandler method in VB.NET. Please refer to 2.5.4 for details.

ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide
DWORD- 14 wide char string

BSTR*

To substitute value into BSTR, use SysAllocString() to secures the area of the character string. After thestring is used, the area need to be released by SysFreeString(). Character string conversion macro A2BSTR
also can be used. Following is an example of substituting character string “This is test." into BSTR.
// The BSTR type is declared.
BSTR bstrSample;// Character string “This is test." is substituted.
// Because it is a wide character string, the character string is enclosed with L“ ".
bstrSample = SysAllocString( L"This is test." );// The area is released after it is used.
SysFreeString( bstrSample );// Using character string conversion macro is also possible for substitution.
// (The memory is allocated in the macro.)bstrSample = A2BSTR( "This is test." );// The area is released after it is used.
SysFreeString( bstrSample );BSTR also has a wrapper class named CComBSTR or _bstr_t. In these classes, operations like string
substitution by “=” calls SysAllocString(), and destructor executes SysFreeString(). As a result, BSTR can beused without considering allocation or release of the area of the character string. Other overloaded operators
are also prepared. For example, string addition is easily achieved by using operator “+=”.
Following is an example of substituting character string “THIS IS TEST." into BSTR.
// The BSTR type is declared.
BSTR bstrVal;// CComBSTR is declared by 16 characters.
CComBSTR str(16);// The character string is substituted by “=".
str = L"This ";// The character string is added by the Append method.
str.Append(L"is ");// The character string is added by “+=".
str += L"test.";// ToUpper method converts character string into the capital letters.
str.ToUpper();// CComBSTR type is copied to the BSTR type.
bstrVal = str.Copy();// CComBSTR is released.
delete str;

2.2.4.2. VARIANTVARIANT is a structure that can treat various data types. The variable is composed of VARTYPE typevariable VT to express data type, and a union of stored variable.
Following shows the details of a basic data type.

Table 2-1 Union of VARIANT type (part)
ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide- 15 -

Type

Identifier

Member name

Explanation

BYTE

VT_UI1bVal

Character(unsigned)

SHORT

VT_I2

iVal

short(signed)

LONG

VT_I4

lVal

long(signed)

FLOAT

VT_R4

fltValfloat(signed)

VT_R8

dblValdouble(signed)

VARIANT_BOOL

VT_BOOL

boolVal

Logical(passed as signed short)

SCODE

VT_ERROR

scode

Status code(HRESULT)DATE

VT_DATEdate

Date(passed as double. )BSTR

VT_BSTRbstrValCharacter string type

IUnknown*

VT_UNKNOWN

punkValInterface pointerIDispatch*

VT_DISPATCH

pdispVal

IDispatch interface pointer

SAFEARRAY*

VT_ARRAY

parrayArray type

DOUBLE
6

VT_EMPTY

no value

Among of them, VT_EMPTY shows that there is no value.
Using VARIANT type, these values also can be used for call by reference. In this case, logical AND of theidentifier and VT_BYREF is used to show it is used for call by reference.
To substitute value to VARANT type, substitute identifier into vt at first, and then substitute value into union.
A macro can be used for this substitution. Following is an example of substituting value 1000 of the long type
into VARIANT.
// The VRIANTDATE type is declared, and initialized.
VARIANT varSample;
VariantInit( &varSample );// The data type is set to long.
varSample.vt = VT_I4;// The value of 1000 is substituted.
varSample.lVal = 1000;

Next is an example of substituting value 1000 of the long type into VARIANT using a macro.
// The VRIANT type is declared, and initialized.
VARIANT varSample;
VariantInit( &varSample );// The data type is set to long.
V_VT( &varSample ) = VT_I4;// The value of 1000 is substituted.
V_I4( &varSample ) = 1000;

As shown in above examples, newly declared VARIANT need to be initialized before using it. If
VariantInit() is used for initialization, the identifier becomes VT_EMPTY to show that the value is not put in
VARIANT.
6

To substitute to VT_BOOL type, instead of TRUE，FALSE of BOOL type, VARIANT_TRUE and VARIANT_FALSE need to be used

ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide- 16 -

BSTR type or SAFEARRAY type, which we will discuss later, allocated area need to be released using
function VariantClear() before VARIANT is released. The function judges the necessity of releasing resourcesby the type of identifier. Following is an example of substituting value “This is test." of the BSTR type into
VARIANT.
// The VRIANTDATE type is declared, and initialized.
VARIANT varSample;
VariantClear( &varSample );// The data type is set to BSTR.
varSample.vt = VT_BSTR;// The value,This is test., is substituted.
varSample.bstrVal = SysAllocString(L"This is test.");When substituting VARIANT type into another VARIANT type, VariantCopy() should be used, because
memory may be allocated. The function newly allocates memory area for copy destination and transfers data
into there.

VARIANT type has wrapper classes named CComVariant or _variant_t. These classes call VariantInit() inconstructer, and call VariantClear() in destructor. By using the class, the developer can use VARIANT
without considering initialization or memory release of VARIANT. These wrapper classes also prepares
overloaded operators etc., and operator “=” can directly substitute the integer type or the character string, etc.
without considering the type or the memory allocation. Following is an example of substituting value 2234 of
the long type using CcomVariant.
// The variable of the CcomVariant type is declared in the short int type,// and value 1234 is substituted.
CComVariant var(1234,VT_I2);// Value 2234 is substituted by using “=".
var = 2234;// VARTYPE is changed from VT_I2 to VT_I4.
var.ChangeType(VT_I4);

2.2.4.3. SAFEARRAYSAFEARRAY is an array type mainly used in automation, and is a structure with fields of the dimension,
the number of elements, and a pointer to data. In COM, SAFEARRAY is used to transfer array data between
processes. SAFEARRAY is a structure, but it cannot be directly accessed and need to be accessed using
functions.
The following is necessary procedure to access SAFEARRAY.
(1) Prepare SAFEARRAY.
(2) Access SAFEARRAY.
(3) Close access to SAFEARRAY.

The procedure is explained in detail.

(1) Declare a structure of SAFEARRAYBOUND type and define the structure of created array.
ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide- 17 -

Following is the definition of SAFEARRAYBOUND.
typedef struct tagSAFEARRAYBOUND{ULONG cElements;
LONG lLbound;} SAFEARRAYBOUND;

cElements shows the number of array elements and lLbound shows the lower bound value of theindex. For instance, following is the declaration to define an array of 10 elements with index number
starting from 0.
SAFEARRAYBOUND bound = { 10, 0 };SAFEARRAYBOUND is used when SafeArrayCreate() function is called. SafeArrayCreate() is afunction to make an instance of SAFEARRAY. Following is the definition of SafeArrayCreate().
SAFEARRAY* SafeArrayCreate( VARTYPE vt, UINT cDims, SAFEARRAYBOUND rgsabound );In the argument, vt is the type of array, cDim is the dimension of array, and rgsabound is an pointerto the start address of SAFEARRAYBOUND array. With these arguments, SafeArrayCreate() creates
an instance and returns a pointer to created SAFEARRAY. Following is an example of creating
SAFEARRAY of the VT_I2 type with SafeArrayCreate().
SAFEARRAY pSa = SafeArrayCreate( VT_I2, 1, &bound );(2) To access the data area of SAFEARRAY, prepare an accessing pointer that corresponds to the
SAFEARRAY type. If SAFEARRAY is created with VT_I4, the pointer of the long type is prepared.
Next, call SafeArrayAccessData() to access SAFEARRAY. The definition of SafeArrayAccessData()
is shown below.
HRESULT SafeArrayAccessData( SAFEARRAY * psa, void HUGEP ** ppvData );In the definition, psa is a pointer to accessed SAFEARRAY, and ppvData is an access pointer to thearray data. As a result, array data becomes accessible. For instance, following shows how to accesses
SAFEARRAY*pSa with long*lData.
SafeArrayAccessData( pSa, (void**)&lData );(3) When processing to SAFEARRAY ends, it is necessary to call SafeArrayUnaccessData() and to
close the access to SAFEARRAY. The definition of SafeArrayUnaccessData() is shown below.
HRESULT SafeArrayUnaccessData( SAFEARRAY* psa );This function specifies the pointer to SAFEARRAY for the argument, and closes the access to
SAFEARRAY specified by this argument. Following is an example of closing the access to
SAFEARRAY*pSa.
ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide- 18 -

SafeArrayUnaccessData( pSa );When SAFEARRAY becomes unnecessary, SafeArrayDestroy() releases the area allocated in
SAFEARRAY. The definition of SafeArrayDestroy() is shown below.
HRESULT SafeArrayDestroy( SAFEARRAY* psa );The argument is a pointer to released SAFEARRAY.
Finally, an example of showing the whole of processing with SAFEARRAY is shown. In this example, thearray of the short type is substituted into created SAFEARRAY.
// The array of the short type is prepared.
short sample[10] = { 1, 2 ,3 ,4 ,5 ,6 ,7 ,8 ,9 ,10 };// The pointer of SAFEARRAY is declared.
SAFEARRAY* pSa;// Because the instance of SAFEARRAY doesn't exist, create it.
SAFEARRAYBOUND bound = { 10 ,0 };pSa = SafeArrayCreate( VT_I2, 1, &bound );// Access SAFEARRAY.
short* iArray;
SafeArrayAccessData( pSa, (void**)&iArray);for( int i = 0; i < 10; i++){
iArray[ i ] = sample[ i ];}SafeArrayUnaccessData( pSa );

(1)

(2)

(3)

The above example is copying an array of the short type into an array of SAFEARRAY.
Because the instance of SAFEARRAY doesn't exist, it is necessary to create it. Therefore, as shown at (1), a
pointer (pSa) to created SAFEARRAY is prepared. Then, the structure of the array is defined by
SAFEARRAYBOUND type. In this example, elements number is defined to 10 and the index lower boundvalue is defined as 0. With these definitions, SAFEARRAY is created by SafeArrayCreate(). Because the datastored in the example is an array of the short type, the type of SAFEARRAY becomes VT_I2.
Next, a pointer is prepared to access the data of SAFEARRAY. As shown at (2) of the list, pointer (iArray)of the short type is prepared because SAFEARRAY of VT_I2 is created from SafeArrayCreate() in thisexample. Then, the SafeArrayAccessData() function is called. The second argument is assumed to be (void**)and casted to match the function type.
While accessing to SAFEARRAY, a pointer to SAFEARRAY data (iArray) holds the first address of thearray data. In this example, the data of short type array is copied to SAFEARRAY. After the copy ends, theaccess is closed with SafeArrayUnaccessData() as shown in (3) under the list.
If all array is not accessed together, but each element of array is accessed separately, use
SafeArrayPutElement(). The definition of SafeArrayPutElement() is shown below.
HRESULT SafeArrayPutElement( SAFEARRAY * psa, long * rgIndices, void * pv );Here, psa is a pointer to SAFEARRAY to be accessed, rgIndices is an index of SAFEARRAY to be accessed,
and pv is the value to be set.
ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide- 19 -

Following is an example of substituting short type array to created SAFEARRAY.
// The array of the short type is prepared.
short sample[10] = { 1, 2 ,3 ,4 ,5 ,6 ,7 ,8 ,9 ,10 };// The pointer of SAFEARRAY is declared.
SAFEARRAY* pSa;// Because the instance of SAFEARRAY doesn't exist, create it.
SAFEARRAYBOUND bound = { 10 ,0 };pSa = SafeArrayCreate( VT_I2, 1, &bound );// Access SAFEARRAY.
for( int i = 0; i < 10; i++){
SafeArrayPutElement( psa, &i, &sample[i] );}2.2.4.4. HRESULTHRESULT is 32bit numerical data with a structure to store error code. Many kinds of the error of HRESULT
are prepared by < winerr.h >. Some of the important erro codes are shown in Table 2-4.
To assign error code to HRESULT, substitute it. However, direct comparison of HRESULT to judge thesuccess or failure of function execution is not desirable. Instead, use macros named SUCCEEDED() and
FAILED(). If the argument HRESULT is normal termination, SUCCEEDED() return TRUE, and otherwise it
returns FALSE. If argument HRESULT is abnormal termination, FAILED() returns TRUE, and otherwise, it
returns FALSE.
In the following example, S_OK is substituted into HRESULT, and it is judged by FAILED().
// S_OK is substituted for hr of the HRESULT type.
HRESULT hr = S_OK;// FAILED() judges whether hr is S_OK or not.
if( FAILED( hr ) ){// Error processing}
return hr;

2.2.5. Notation of data
ORiN2 provides a method to express VARIANT type by the character string. Using the expression, even in
the environment where VARIANT type is not supported, pseudo-VARIANT type can be used. This data
description method is used in the transmission character string of RAC, or item value expression of CaoUPnP.
The format expresses the data type and the data row separated by comma.
< data type >,< data row >Data type is expressed by a VARTYPE integer value. Following table shows the available data type andcorresponding value.

Table 2-2 Available data type
Data type

ORiN Forum

Value

Meaning

VT_I2

2 Two byte integer type

VT_I4

3 Four byte integer type
DENSO WAVE Inc.

ORiN 2 programming guide- 20 -

VT_R4

4 Single precision floating point type

VT_R8

5 Double precision floating point type

VT_CY

6 Currency type

VT_DATE

7 Date type

VT_BSTR

8 Character string type

VT_BOOL

11 Boolean type

VT_VARIANT

12 VARIANT type

VT_UI117 Byte type

VT_ARRAY

8192 Array typeAn array of data is expressed by logical AND of the data type of element and VT_ARRAY.
Data row is expressed in the character string. Array data is expressed using “,” (comma) delimiter.

Example1)

2,100

Type:

VT_I2

Value:

100

Example 2)

8,SampleType:

VT_BSTR

Value:

SampleExample 3)8194,100,200,300

Type:

VT_I2｜VTARRAY

Value:

100,200,300

Example 4)

8200,Sample,Test

Type:

VT_BSTR｜VTARRAY

Value:“Sample”,“Test”

Example 5)

8,Sample,Test

Type:

VT_BSTR

Value:“Sample,Test”

2.2.6. Log output
CAO engine has log function, which records start and stop of CAO.exe, object creation and deletion, andother operations. Five types of log output, i.e., console, message box, event viewer, debugging viewer, and text
file, can be selected as the output destination of the log. Use CaoConfig to set output. 6CaoConfig describes
how to use the command.
Following is CAO engine log output timing.
・ When CAO engine starts and stops.
・ When objects such as CaoController and CaoVariable are created or deleted.
・ When a controller thread starts/ends or its operation starts/stops.
・ When log is recorded by a message event from CAO provider7.

2.2.7. Error code
The source of ORiN2 error can be categorized in several modules. Following explains errors generated in
CAO module.

7

Please refer to "3.4.1. the log output by the message event" of 'CAO provider making guide' for the method of outputting the log by themessage event of the CAO provider.

ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide- 21 -

Application

CAO engine specific error

CAO
DCOM standard error

Provider template

CAO provider common error

ProviderCAO provider specific error

Device specific error

Device/Module
Figure 2-5 Errors generated in ORiN2

Table 2-3 ORiN2 error type
Error type

Error generation module

Explanation

DCOM standard error-

General error in DCOM. For details, pleaserefer to Table 2-4.

CAO engine specific error

CAO engine

CAO engine specific errors. For details,
please refer to Table 2-5.

CAO provider common error

CAO provider template

Common error for CAO provider. For
details, please refer to Table 2-6.

CAO provider specific error

CAO provider

Error code specifically defined for each
CAO provider. For details, please refer tothe users guide for each provider.

Device specific error

DeviceError code specifically defined for eachdevice driver. For details, please refer tothe manual for each device driver.

Table 2-4 DCOM common error (part)
Error name

Error code

Explanation

S_OK

0ｘ00000000

Normal finish (0x0) with returning logical
TRUE.

S_FALSE

0x00000001

Normal finish (0x1) with returning logical
FALSE.

ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide- 22 -

E_UNEXPECTED

0x8000FFFF

Catastrophic failure.

E_NOTIMPL

0x80004001

Not implemented.

E_OUTOFMEMORY

0x8007000E

Ran out of memory.

E_INVALIDARG

0x80070057

One or more arguments are invalid.

E_POINTER

0x80004003

Invalid pointer.

E_HANDLE

0x80070006

Invalid handle.

E_ABORT

0x80004004

Operation aborted.

E_FAIL

0x80004005

Unspecified error.

E_ACCESSDENIED

0x80070005

General access denied error.

E_WINDOWS_MASK

0x8007xxxx

Windows standard error codes (16-bit) are stored
into xxxx (the least significant two bytes)
Ex）
Error code: 2 （File not found）--> 0ｘ80070002

Table 2-5 CAO engine specific error
Error name

Error code

Explanation

E_CAO_SEM_CREATE

0x80000200

It failed in the generation of the synchronous
semaphore.

E_CAO_PROV_INVALID

0x80000201

The CAO access provider name is invalid.

E_CAO_COMPUTER_NAME

0x80000202

The computer name can not be acquired.

E_CAO_VARIANT_TYPE_NOSUPPORT

0x80000203

The VARIANT type which isn't supported washanded over.

E_CAO_OBJECT_NOTFOUND

0x80000204

A corresponding object isn't found out.

E_CAO_COLLECTION_REGISTERED

0x80000205

It is already registered on the collection.

E_CAO_THREAD_CREATE

0x80000207

It failed in the generation of the work thread.

E_CAO_REMOTE_ENGINE

0x80000208

Can not access the remote CAO server.

E_CAO_REMOTE_PROVIDER

0x80000209

Can not access the remote CAO's provider.

E_CAO_NOT_WRITABLE

0x8000020a

Can not write a data.

E_CAO_CMD_EXECUTE

0x8000020b

A command is under execution.

E_CAO_PROV_NO_LICENSE

0x8000020c

The specified provider is not licensed.

E_CAO_PRELOAD

0x8000020d

Failed CRD preload.

E_CAO_TEMP_REGISTERED

0x8000020e

Temporarily registered in the collection.

E_CAO_NO_PARENT

0x8000020f

There wa no parent object.

ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide- 23 -

Table 2-6 CAO provider common error
Error name

Error code

Explanation

E_CRDIMPL

0x80000400

Improper CRD file

E_CAOP_SYSTEMNAME_INVALID

0x80000401

It is an invalid system variable name.

E_CAOP_SYSTEMTYPE_INVALID

0x80000402

It is an invalid system variable type.

E_CANCEL

0x80000403

The command was canceled.

E_CAOP_NOT_WRITABLE

0x80000404

It is read-only parameter.

E_TIMEOUT

0x80000900

Timeout

E_NO_LICENSE

0ｘ80000901

No license.

E_NOT_CONNECTED

0x80000902

Connection is not established.

E_NOT_USE

0x80000903

It is not used.

E_INVALID_CMD_NAME

0x80000904

It is illegal command.

E_MAX_OBJECT

0x80000905

Exceeded the number of creatable object limit.

E_OVERLOADING

0x80000906

The setting is duplicated.

E_NONE_CONNECT_OPTION

0x80000907

Connection option is not found.

E_ALREADY_REGISTER

0x80000908

The name you have entered has already used.

E_TOO_MUCH_DATA

0x80000909

Data size is too large.

E_FAILED_ALLOC

0x8000090a

Failed to secure buffer.

E_MAX_CONNECT

0x8000090b

Exceeded the number of connection countlimit.

E_CONVERT_CHAR_CODE

0x8000090c

Failed to convert character code.

E_WINDOWS_MASK

0x8090xxxx

Windows standard error codes (16-bit) arestored into xxxx (the least significant two
bytes)Ex）
Error code: 2 （File not found）
 0ｘ80900002(Notes)This error code was changed to 0x8007xxxx(see table 2-4)

E_WINSOCK_MASK

0x8091xxxx

Windows winsock error codes (16-bit) arestored into xxxx (the least significant two
bytes)Ex）
Error code: 10061 （Connection denied）

ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide- 24 --> 0ｘ8091274D

2.3. An installation state of ORiN2 SDKRegarding the way to confirm an installation state of ORiN2 SDK, please refer to chapter 3.7 of “ORiN2
SDK User’s Guide”.

2.4. CAO client implementation
2.4.1. Open controller
To open controller, take the following procedure.

(1) Prepare a variable to maintain an object.
(2) Create a CaoEngine object.
(3) Acquire or generate a CaoWorkspace object.
(4) Create a CaoController object.

Following is detailed explanation. In this explanation, early binding is used, and New keyword is used tocreate an object.

(1) At first, declare a variable to store object. CaoEngine object and CaoWorkspace object are necessary
to open controller. Then, AddController method will create CaoController object. Therefore, thevariables corresponding to these three objects are prepared. Following is an example of declaring thevariable of each object type as a private variable.
Private caoEng As CaoEngine 'Engin object
Private caoWs As CaoWorkspace 'CaoWorkSpace object
Private caoCtrl As CaoController 'Controlle object(2) Next, create a CaoEngine object. The object is created by New keyword, similar to an example in
2.2.1.1 The object is substituted into variable using Set statement.
Set caoEng = New CaoEngine(3) When CaoEngine object is created, a CaoWorkspaces object and a CaoWorkspace object are also
created. To acquire the default object of CaoWorkspace, use CaoWorkspaces.Item(0). Following is
an example of acquiring the default CaoWorkspace object.
Set caoWS = caoEng.CaoWorkspaces.Item(0)(4) A CaoController object can be created by the AddController method of the CaoWorkspace object.
The definition of the AddController method is shown here.
AddController(BSTR bstrController, BSTR bstrProvider, BSTR bstrMachine, BSTR bstrPara)

ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide- 25 -

The arguments of this method are, the robot controller name, the provider name, the machine name,and a parameter. And, a CaoController object is returned as a return value. The provider nameregistered here can be acquired in an array by using the ProviderNames method of the CaoEngine
object. Because the meaning of the parameter is different for each provider, please refer to theprovider user's guide for details. Following is an example of using AddController method with theBlackboard provider.
' CaoCtrl and CaoWS are variables to maintain the object.
Set CaoCtrl = CaoWS.AddController(“bb1",“CaoProv.Blackboard", “", “")' The third and the foruth argument can be omitted.
Set CaoCtrl = CaoWS.AddController(“bb1",“CaoProv.Blackboard")

2.4.2. Retrieve and set variable
A CaoVariable object needs to be created previously to acquire and to set the variable.

(1) The AddVaribale method of the CaoController object is used to create a CaoVariable object. The
definition is shown as follows.
AddVariable(BSTR bstrName, BSTR bstrOption )At this time, bstrName is a Variable name, and bstrOption is an option when the variable is retrieved.
This method returns a CaoVariable object as a return value. Following is an example of retrieving a
CaoVariable object of Variable name “Val” using AddVariable(),. Here, bstrOption can be omitted.
'CaoCtrl and CaoVar are variables to hold the object.
Set CaoVar = CaoCtrl.AddVariable(“Val”)

After the CaoVariable object is created, refer to the Value property of the CaoVariable object to set
and to retrieve the value of the variable. Following is an example of setting value “1000" of Long
type, and then retrieve the variable.
' CaoCtrl and CaoWS are variables to hold the object.
Dim iData as Integer
IData = 1000
' The value of iData is set to the variable.
CaoVar.Value = iData' The value of the variable is retrieved and substituted to iData.
iData = CaoVar.Value

ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide- 26 -

2.4.3. Retrieve and set system variable
Some providers may prepare peculiar system variable. The Blackboard provider used in the example has
following system variables. Please refer to the user's guide of each provider for details.
・ @COUNT

Number of user variables

・ @CURRENT_TIME

Present time

・ @VERSION

VersionFollowing is an example of retrieving present time as a system variable.
'Retrieve system variable @CURRENT_TIME
Set caoVar = caoCtrl.AddVariable("@CURRENT_TIME")'Retrieve present time from variable object
Dim var as Datevar = caoVar.Value

2.4.4. Event processing
When the variable is added and the value of the variable is changed, the event is generated in the Blackboard
provider as previously described.
To confirm the generation of the event, a simple sample program is made. First of all, please make the form
with three text boxes with VB6, and describe the following codes.

List 2-1

Form1.frm
Dim caoEng As CaoEngine
Dim caoWs As CaoWorkspace
Dim WithEvents caoCtrl As CaoController'Create CAO engine and connect to Blackboard provider
Private Sub Form_Load()
Set caoEng = New CaoEngine
Set caoWs = caoEng.Workspaces(0)Set caoCtrl = caoWs.AddController("BB1", "CaoProv.Blackboard")
End Sub'Blackboard controller's event procedure
Private Sub caoCtrl_OnMessage(ByVal pICaoMess As CAOLib.ICaoMessage)
Text1.Text = pICaoMess.Description
Text2.Text = pICaoMess.Destination
Text3.Text = pICaoMess.ValueEnd Sub

ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide- 27 -

Then, start the application, and confirm the generation of the event.
First of all, when you start the application, only default string is displayed in the text box as shown in
Figure2-6.

Figure2-6 Start of sample application
Next, an event is generated. CaoTester, which is included in ORiN2 SDK, is used to generate an event.
Please refer to the CaoTester user's guide for use of CaoTester.
Start CaoTester, and input controller name as ”BB1”, and select “CaoProv.Blackboard", as shown in
Figure2-7 of the workspace child window. Then, press the [Add] button.

← Controller name← Provider name

←Add Button

Figure2-7 Connection to Blackboard provider

ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide- 28 -

When you press the [Add] button, a child window is displayed as shown in Figure2-8. Select the Variabletab, input to the variable name (Name of AddVariable) as “test", and press the Add button.

Variable tab →← Variable identifier←Add Button

Figure2-8 Addition of variable object
When you press the [Add] button, a child variable window is displayed as shown in Figure2-9. Please input“VT_I4" to variable type, and “1234" to variable value, and press [Put] button.

ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide- 29 -

Type of Variables→←Put Button

variable

Figure2-9 Writing of variable
Now check the window of the sample program. As shown in Figure2-10, an event is generated, and the kindof the event, variable name, and variable value is displayed in the text box by the process of event procedure.

Figure2-10 Generation of event

2.5. Developing client with VB.NET
2.5.1. RCW registration to GAC
VB.NET client accesses COM component through a module called Runtime Callable Wrapper (RCW).
When the client application is created, the RCW module is automatically created automatically and locallyfrom type library. Therefore, each VB.NET application will create its own RCW module. To avoid thissituation, ORiN2 SDK prepares RCW module that can be registered in Global Assembly Cache (GAC).
ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide- 30 -

There are three ways to register ORiN RCW to GAC.
(1) Automatic registration by ORiN2SDK installer.
Note that the automatic installation is possible only when the following conditions are fulfilled.
・ ORiN2SDK installer version is 2.1.2 or later.
・ Microsoft .NET Framework 2.0 or later is already installed.
(2) With Windows explorer, drop CaoRCW.dll into Windows¥assembly directory.

(3) Use global assembly cache tool（Gacutil.exe）8Registration: ORiN2¥DotNet¥RCW> gacutil –i CaoRCW.dll

Deregistration: ORiN2¥DotNet¥RCW> gacutil –u CaoRCW

2.5.2. VB.NET project setting
To set RCW, select [Add reference] dialog -> [.NET] tab, and add the RCW module of CAO. The RCW
module is stored in the following directory.
ORiN2¥DotNet¥RCW¥CaoRCW.dll
By adding RCW module, class variables of CAO engine can be declared. Following is an example of CAO
engine variable declaration.
Dim caoEng As New ORiN2.interop.CAO.CaoEngine

2.5.3. Notes on object deletion
Because garbage collection is used in VB.NET, object is not released even if “Noting” is substituted into avariable. Therefore, when the object is deleted, the resource for the object need to be explicitly released using
system.Runtime.InteropServices.Marshal.ReleaseComObject function. Following is an example of releasing
controller object.
caoWS.Controllers.Remove(caoCtrl.Index)
System.Runtime.InteropServices.Marshal.ReleaseComObject(caoCtrl)
caoCtrl = Nothing

System.Runtime.InteropServices.Marshal.ReleaseComObject is a function to decreases COM reference
counter managed by garbage collector. If the reference count is n, ReleaseComObject need to be called n times
before releasing the object.

Garbage collector also manages auto variables. Therefore, in the following case,caoEng.Workspaces.Item(0).Controllers.Clear

8

Using gacutil.exe is possible only when.NET Framework 2.0 SDK or Visual Studio 2005 is already installed.

ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide- 31 -[.Workspaces] is also assigned to a temporary automatic variable and managed by garbage collector. The
situation is same for [.Item(0)] and [.Controllers]. Therefore, reference counters for each of these automatic
variables are incremented by one, and ReleaseComObject need to be called until reference counter for these
automatic variables becomes 0 before releasing the variable.

For these reasons, managing automatic variable reference count is necessary. However, managing thereference count is troublesome, and may be omitted.
To avoid the reference count management problem, following example code declares local variables are
explicitly. In this way, COM automatic variable assignment will not happen.
Dim caoEng As CaoEngine
Dim caoWss As CaoWorkspaces
Dim caoWs As CaoWorkspace
Dim caoCtrls As CaoControllers
caoEng = new CaoEngine
caoWss = caoEng.Workspaces
caoWs = caoWss.Item(0)caoCtrls = caoWs.Controllers
Dim caoCtrl As CaoController
caoCtrl = caoWs.AddController("RC1", " CaoProv.Blackboard ", "", "")caoCtrls.Clear
System.Runtime.InteropServices.Marshal.ReleaseComObject(caoCtrl)
caoCtrl = Nothing
caoWss.Clear
System.Runtime.InteropServices.Marshal.ReleaseComObject(caoCtrls)
caoCtrls = Nothing
System.Runtime.InteropServices.Marshal.ReleaseComObject(caoWs)
caoWs = Nothing
System.Runtime.InteropServices.Marshal.ReleaseComObject(caoWss)
caoWss = Nothing
System.Runtime.InteropServices.Marshal.ReleaseComObject(caoEng)
caoEng = Nothing

2.5.4. Method of handling event
To handle an event, an event handler needs to be dynamically added and removed using AddHandler and theRemoveHandler key word. Following is an example of creation and deletion of event handler.
(1) A controller object is created and an event handler for the object is added.
caoCtrl = caoWs.AddController("BB1", "CaoProv.Blackboard ", "", "")AddHandler caoCtrl.OnMessage, AddressOf caoCtrl_OnMessage(2) Event handler process is defined.
Private Sub caoCtrl_OnMessage(ByVal pICaoMess As ORiN2.interop.CAO.CaoMessage)
txtReceiveTime.Text = pICaoMess.DateTime
End Sub(3) The event handler is removed before the controller object is deleted.

ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide- 32 -

RemoveHandler caoCtrl.OnMessage, AddressOf caoCtrl_OnMessage
caoCtrls.Remove(caoCtrl.Index)
System.Runtime.InteropServices.Marshal.ReleaseComObject(caoCtrl)
caoCtrl = Nothing

2.6. Developing client with other languages
2.6.1. Client development with C++9
Following is the procedure to use CAO object with C++.
(1) Initialize DCOM
(2) Create CaoEngine object(3) Execute method(4) Release object(5) Terminate DCOM
There are two methods to handle CAO object, i.e.
・ #Include directive
・ #Import directive
Details of each method are described below.
2.6.1.1. Using #include directive
To operate CAO object with C++, CAO header file (CAO.h) and UUID definition file (CAO_i.c) need to be
included. These files are in "< ORIN2 root > ¥CAO¥Include".
#include "CAO.h"#include "CAO_i.c"

Following is the actual procedure to operate CAO object.

(1) Initialize DCOM
Execute CoInitialize() before the CAO object is operated.
(2) Create CaoEngine object
Execute CoCreateInstance(). Following shows an example of arguments.
ICaoEngine* pEng;
hr = CoCreateInstance(CLSID_CaoEngine,
NULL,
CLSCTX_LOCAL_SERVER,
IID_ICaoEngine,(void **)&pEng);(3) Executie methods
Methods of CaoEngine are executed.
Following example executes AddController.
9

Please refer to the following pages for a detailed explanation of DCOM.
“http://www.microsoft.com/japan/msdn/library/default.asp?url=/japan/msdn/library/ja/jpdnguion/htm/msdn_drguion020298.asp”

ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide- 33 -// Retrieve CaoWorkspace collection
ICaoWorkspaces *pWss;
hr = pEng->get_Workspaces(&pWss);
if (FAILED(hr)) return hr;// Retrieve CaoWorkspace
ICaoWorkspace *pWs;
hr = pWss->Item(CComVariant(0L), &pWs);
if (FAILED(hr)) return hr;// Creation of CaoController
ICaoController *pCtrl;
hr = pWs->AddController(CComBSTR(L"TestCtrl"),
CComBSTR(L"CaoProv.DataStore"),CComBSTR(L""),CComBSTR(L""),&pCtrl);(4) Release object
Objects created or retrieved in a program must be released. To release object, execute Release(). The
example shows an example of releasing object.
pCtrl->Release();pWs->Release();pWss->Release();pEng->Release();(5) Terminate DCOM
Execute CoUnitialize()before the program ends.
Following is a sample program to set and get variable

List 2-2

CPPSample1.cpp#include "atlbase.h"#include "CAO.h"#include "CAO_i.c"
HRESULT func1();
int main(int argc, char* argv[]){
CoInitialize(0);HRESULT hr = func1();
CoUninitialize();
return 0;}
HRESULT func1(){
HRESULT hr = S_OK;
ICaoEngine* pEng = NULL;
ICaoWorkspaces *pWss = NULL;
ICaoWorkspace *pWs = NULL;
ICaoController *pCtrl = NULL;
ICaoVariable *pVar = NULL;
CComVariant vntVal;// Create CaoEngine
hr = CoCreateInstance(CLSID_CaoEngine,

ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide- 34 NULL,
CLSCTX_LOCAL_SERVER,
IID_ICaoEngine,(void **)&pEng);

if (FAILED(hr)) {goto EndProc;}// Retrieve CaoWorkspace collection
hr = pEng->get_Workspaces(&pWss);
if (FAILED(hr)) {goto EndProc;}// Retrieve CaoWorkspace
hr = pWss->Item(CComVariant(0L), &pWs);
if (FAILED(hr)) {goto EndProc;}// Create CaoController
hr = pWs->AddController(CComBSTR(L"TestCtrl"),
CComBSTR(L"CaoProv.DataStore"),CComBSTR(L""),CComBSTR(L""),&pCtrl);if (FAILED(hr)) {goto EndProc;}// Create CaoVariable
hr = pCtrl->AddVariable(CComBSTR(L"TestVal"), CComBSTR(L""), &pVar);
if (FAILED(hr)) {goto EndProc;}// Set and get value
pVar->put_Value(CComVariant(L"sample"));pVar->get_Value(&vntVal);// Release object
EndProc:
if (pVar) pVar->Release();if (pCtrl) pCtrl->Release();if (pWs) pWs->Release();if (pWss) pWss->Release();if (pEng) pEng->Release();return hr;}

2.6.1.2. Using #import directive
Another way to operate CAO object with C++ is to import CAO.exe using #import directive.
#import "CAO.exe"

The name space of the CAO object is “CAOLib"10.
By using #import directive, a smart pointer, which is represented by object name followed by “Ptr” can be
10

The setting of the namespace can be set by the option of # import directive. Please refer to MSDN for details.

ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide- 35 -

used. (Example: ICaoEnginePtr)

Following is the actural procedure to operate CAO object.
(1) Initialize DCOM
Execute CoInitialize()before the CAO object is operated.
(2) Create CaoEngine object
The object is created using IcaoEnginePtr, which is a smart pointer of CaoEngine object. Following
is an example. If smart pointer is not used, create object in the same way as described in 2.6.1.1
CAOLib::ICaoEnginePtr pEng(__uuidof(CAOLib::CaoEngine));(3) Execute method
Execute the method of CaoEngine which is created in (2).
Following is an example of executing AddController.
CAOLib::ICaoWorkspacesPtr pWss = pEng->GetWorkspaces();
CAOLib::ICaoWorkspacePtr pWs = pWss->Item(0L);
CAOLib::ICaoControllerPtr pCtrl = pWs->AddController(L"SampleCtrl",
L"CaoProv.DataStore",
L"",
L"");

(4) Release object
Objects held by smart pointers are automatically released. To release object explicitly, or to releaseobject that is not held by a smart pointer, follow the similar procedure of 2.6.1.1.
(5) Terminate DCOM
Execute CoUnitialize()before the program ends.
Following sample program sets and retrieves the variables.

List 2-3

CPPSample2.cpp#import "D:\work\Robot\Repos\ORiN2\CAO\Engine\Bin\CAO.EXE"
HRESULT func1();
int main(int argc, char* argv[]){
CoInitialize(0);HRESULT hr = func1();
CoUninitialize();
return 0;}
HRESULT func1(){
try {CAOLib::ICaoEnginePtr pEng(__uuidof(CAOLib::CaoEngine));
CAOLib::ICaoWorkspacesPtr pWss = pEng->GetWorkspaces();
CAOLib::ICaoWorkspacePtr pWs = pWss->Item(0L);

ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide- 36 -

CAOLib::ICaoControllerPtr pCtrl = pWs->AddController(L"SampleCtrl",
L"CaoProv.DataStore",
L"",
L"");
CAOLib::ICaoVariablePtr pVar = pCtrl->AddVariable(L"SampleVal", L"");pVar->PutValue(_variant_t(L"sample"));_variant_t vntTemp = pVar->GetValue();}catch (_com_error e) {return e.Error();}return S_OK;}

2.6.2. Client development with C
When using C language, #include directive is used and the CAO object is operated. CAO header file
(CAO.h) and UUID definition file (CAO_i.c) are included. These files are in "<ORIN2 root directory>¥CAO¥Include".
#include "CAO.h"#include "CAO_i.c"

The procedure for operating the object of CAO is similar to C++ described in 2.6
Following is a detailed procedure.
(1) Initialize DCOM
CoInitialize() is executed before the CAO object is operated.
(2) Create CaoEngine object
CoCreateInstance() is executed. Following is an example.
hr = CoCreateInstance(&CLSID_CaoSQLEngine,
NULL,
CLSCTX_ALL,&IID_ICaoSQLEngine,(void **)&pEng);(3) Execute method
Execute methods of CaoEngine that created in (2). Methods are called and executed as following.
This is an example of CaoWorkspace collection retrieval.
pEng->lpVtbl->get_Workspaces(pEng, &pWSs);

If you declare a pre-processor symbol named COBJMACROS before header files are included,
macros corresponding to each method become available. Following example shows retrieval of
CaoWorkspace collection using the macro

ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide- 37 -

ICaoEngine_get_Workspaces(pEng, &pWss);(4) Release object
The object that is generated or retrieved in the program should be released. Objects are released byexecuting Release(). Following example shows example of releasing object using macro.
ICaoEngine_Release(pEng)(5) Terminate of DCOM
Before program ends, execute CoUnitialize() to terminate DCOM.
Following is a sample program to set and get variables.

List 2-4

ImportSample.cpp#import "D:/work/Robot/Repos/ORiN2/CAO/Engine/Bin/CAO.EXE"
HRESULT func1();
int main(int argc, char* argv[]){
CoInitialize(0);HRESULT hr = func1();
CoUninitialize();
return 0;}
HRESULT func1(){
try {CAOLib::ICaoEnginePtr pEng(__uuidof(CAOLib::CaoEngine));
CAOLib::ICaoWorkspacesPtr pWss = pEng->GetWorkspaces();
CAOLib::ICaoWorkspacePtr pWs = pWss->Item(0L);
CAOLib::ICaoControllerPtr pCtrl = pWs->AddController(L"SampleCtrl",
L"CaoProv.DataStore",
L"",
L"");
CAOLib::ICaoVariablePtr pVar = pCtrl->AddVariable(L"SampleVal", L"");pVar->PutValue(_variant_t(L"sample"));_variant_t vntTemp = pVar->GetValue();}catch (_com_error e) {return e.Error();}return S_OK;}

2.6.3. Client development with C#
ORiN2 SDK provide two methods for creating C# client applications, ManagedCAO and RCW, but we
ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide- 38 -

currently recommend the more efficient ManagedCAO method. While explicit description of object releaseprocessing is essential with RCW, ManagedCAO does not require explicit description of that part, and is more
efficient in that it is designed to automatically release objects in response to sudden termination of the client
application, which has been an issue with RCW. ManagedCAO is more efficient in that it does not require an
explicit description of this part.
2.6.3.1. Using ManagedCAO module
A C# client accesses the COM component via ManagedCAO, which wraps RCW.
2.6.3.1.1. Configuration when creating a new project
Add a reference to ManagedCAO to the C# client application project.

ManagedCAO corresponds to the following modules under the installation folder of ORiN2 SDK.
"<ORiN2 installed folder>/DotNet/ManagedCAO/Lib/ManagedCAO.dll"

By adding a reference to the ManagedCAO module, <ORiN2.ManagedCAO> will be recognized in thenamespace, so please declare "using ORiN2.ManagedCAO;" as follows.
using System;
using System.Windows.Forms;
using ORiN2.ManagedCAO;

This allows class variables of the CAO engine to be declared as follows．
public partical class Form1 : Form{
private CCaoEngine _engine = null;
private CCaoController _controller = null;
private CCaoVariable _variable = null;

ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide- 39 -

public Form1():}

2.6.3.1.2. Notes when deleting an object
In ManagedCAO, when the Dispose function of CCaoEngine is called, the Cao objects under it areautomatically disposed of. Therefore, when initialization fails or when the application terminates, the
CCaoEngine object should be released and disposed of.
In addition, if a message is received (event is acquired), cancel the message reception process before calling
CCaoEngine's Dispose and call the Application.DoEvents function. This prevents CAO from terminating
normally if the message object is not released.
The following is an example of a description defined as the ReleaseCaoObject function.
private void ReleaseCaoObject(){if (_controller != null){_controller.OnMessage -= new OnMessageEventHandler(_controller_OnMessage);
Application.DoEvents();}
if (_engine != null){_engine.Dispose();}_variable = null;_controller = null;_engine = null;}

The ReleaseCaoObject function defined above can be used to ensure that CAO terminates normally in theevent of an exception. An example of its use is shown below.
private void Form1_Load(object sender, EventArgs e){try{_engine = new CCaoEngine();_controller = _engine.Workspaces[0].AddController(“Panel”, “CoProv.Dummy.Panel”);_variable = _controller.AddVariable(“Variable1”, null);_controller.OnMessage += new OnMessageEventHandler(_controller_OnMessage);}catch (Exception ex){
ReleaseCaoObject();
this.Close();}}ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide- 40 -

2.6.3.1.3. How to call with thread-safe
In WindowsForms applications, access to the control from threads other than the UI thread is prohibited.
Therefore, refer to the InvokeRequired property (true if the application is running outside the UI thread), and if
outside the UI thread, process the control in the UI thread through the Invoke function (pass the process to the
UI thread and wait for it to finish). In other cases, process in your own thread. In other cases, process in yourown thread. An example is shown below.
void _controller_OnMessage(object sender, OnMessageEventArgs e){
Action act = () =>{txtMessage.Text = string.Formart(“Number:{0}, Source:{1}, Value:{2}”,e.Message.Number, e.Message.Source, e.Message.Value);};if (InvokeRequired){
Invoke(act);}
else{
act();}}

The following sample code shows how to display a value of an OnMessage event into a text box.

List 2-5-1

ManagedCaoSample.cs

using System;
using System.Windows.Forms;
using ORiN2.ManagedCAO;
namespace Message{
public partial class frmMessage : Form{
private CCaoEngine caoEng;
private CCaoWorkspaces caoWss;
private CCaoWorkspace caoWs;
private CCaoControllers caoCtrls;
private CCaoController caoCtrl;
public frmMessage(){
InitializeComponent();}
private void frmMessage_Load(object sender, EventArgs e){try{// CAO engine generation
caoEng = new CCaoEngine();caoWss = caoEng.Workspaces;
caoWs = caoWss[0];// Retrieving the controller collection
caoCtrls = caoWs.Controllers;

ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide- 41 -// Connected to controller
caoCtrl = caoCtrls.Add("RC1", "CaoProv.Dummy", "", "");// Register OnMessageEventHandler
caoCtrl.OnMessage += new OnMessageEventHandler(OnMessage);}catch (Exception ex){
MessageBox.Show(ex.Message);}}
private void frmMessage_FormClosed(object sender, FormClosedEventArgs e){try{// Releasing Controller Objects
if (caoCtrl != null){
caoCtrls.Remove(caoCtrl.Name);
caoCtrl = null;}
caoCtrls = null;
caoWs = null;
caoWss = null;
caoEng = null;}
catch (Exception ex){
MessageBox.Show(ex.Message);}}
private void cmdExecute_Click(object sender, EventArgs e){
try{
caoCtrl.Execute("", "");}
catch (Exception ex){
MessageBox.Show(ex.Message);}}// OnMessage event
private void OnMessage(object sender, OnMessageEventArgs e){
Action act = () => { textBox1.Text = e.Message.Value.ToString(); };if (InvokeRequired){
Invoke(act);}
else{
act();}}}}

ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide- 42 -

2.6.3.2. Using RCW module
A C# client program can access CAO (COM component) via RCW like a VB.NET client. The configurationis the same as 2.5.
2.6.3.2.1. Registration of RCW to GAC
The way of RCW registration is the same as VB.NET. Please refer to 2.5.1 for details.
2.6.3.2.2. Configuration when creating a new project
The way to add to “References” is the same as VB.NET. Please refer to 2.5.2 for details.
After adding the RCW module, the following class variable declaration of CaoEngine can be available.
private ORiN2.interop.CAO.CaoEngine caoEng;;
To simplify the above declaration, you can use “ORiN2.interop.CAO” as a name space. A way to declare thename space is as follows.
using ORiN2.interop.CAO;
2.6.3.2.3. Notes when deleting an object
A “Release” processing will not be called immediately even if a variable was set to null, because C#
provides an automatic (delayed) garbage collection mechanism like a VB.NET. If it needs to delete an object
immediately, you have to call “System.Runtime.InteropServices.Marshal.ReleaseComObject” function like
VB.NET. Please refer to 2.5.3 for details.
2.6.3.2.4. How to receive an event
The way to receive an event with C# is as follows.
(1) Create a event handler
private void OnMessage(CaoMessage pICaoMsg){
MessageBox.Show(pICaoMsg.Value.ToString());}(2) Register the event handler
caoCtrl = caoCtrls.Add("RC1", "CaoProv.Dummy", "", "");
caoCtrl.OnMessage += new _ICaoControllerEvents_OnMessageEventHandler(OnMessage);

2.6.3.2.5. How to call with thread-safe
Please note that an OnMessage event will be called back by another thread (not main thread) like VB.NET.
You have to make a thread-safe program as follows.
(1) Create an event processing function.
(2) Create a delegate to call the above function.
private delegate void SetTextCallback(string msg);

ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide- 43 -(3) Call the delegate with “System.Invoke” function in an OnMessageEventHandler.
private void OnMessage(CaoMessage pICaoMsg){// create a delegate with the event processing function.
SetTextCallback SetMsg = new SetTextCallback(SetText);// execute the function via the delegate with “System.Invoke”.
Invoke(SetMsg, pICaoMsg.Value.ToString());}

The following sample code shows how to display a value of an OnMessage event into a text box.

List 2-6-2

RcwSample.cs

using System;
using System.Collections.Generic;using System.ComponentModel;using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using ORiN2.interop.CAO;
namespace Message{
public partial class frmMessage : Form{
private delegate void SetTextCallback(string msg);
processing.

// a delegate for OnMessage event

private CaoEngine caoEng;
private CaoWorkspaces caoWss;
private CaoWorkspace caoWs;
private CaoControllers caoCtrls;
private CaoController caoCtrl;
public frmMessage(){
InitializeComponent();}
private void frmMessage_Load(object sender, EventArgs e){try{// createa a CAO engine
caoEng = new CaoEngine();caoWss = caoEng.Workspaces;
caoWs = caoWss.Item(0);// retrive a CaoController collection
caoCtrls = caoWs.Controllers;// connect to the controller
caoCtrl = caoCtrls.Add("RC1", "CaoProv.Dummy", "", "");// register an OnMessageEventHandler
caoCtrl.OnMessage += new_ICaoControllerEvents_OnMessageEventHandler(OnMessage);}catch (Exception ex)

ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide- 44 -{
MessageBox.Show(ex.Message);}}
private void frmMessage_FormClosed(object sender, FormClosedEventArgs e){try{// Release a CaoController object
if (caoCtrl != null){
caoCtrls.Remove(caoCtrl.Name);
System.Runtime.InteropServices.Marshal.ReleaseComObject(caoCtrl);
caoCtrl = null;}
System.Runtime.InteropServices.Marshal.ReleaseComObject(caoCtrls);
caoCtrls = null;
System.Runtime.InteropServices.Marshal.ReleaseComObject(caoWs);
caoWs = null;
System.Runtime.InteropServices.Marshal.ReleaseComObject(caoWss);
caoWss = null;
System.Runtime.InteropServices.Marshal.ReleaseComObject(caoEng);
caoEng = null;}
catch (Exception ex){
MessageBox.Show(ex.Message);}}
private void cmdExecute_Click(object sender, EventArgs e){
try{
caoCtrl.Execute("", "");}
catch (Exception ex){
MessageBox.Show(ex.Message);}}// OnMessageEventHandler
private void OnMessage(CaoMessage pICaoMsg){
try{// call a method of another thread
SetTextCallback SetMsg = new SetTextCallback(SetText);
Invoke(SetMsg, pICaoMsg.Value.ToString());}
catch (Exception ex){
MessageBox.Show(ex.Message);}}// OnMessage processing function
private void SetText(string msg){
textBox1.Text = msg;}}

ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide- 45 -}

2.6.4. Client development with Delphi
2.6.4.1. Making preparation
To operate the object of CAO with Delphi, create a unit file from the type library, and use the file.
Creation and use the unit in the following procedures.
(1) Select “Project → read type library” menu.
(2) From the displayed library, select "CAO1.0 type library", and crick “Unit creation” button.
(Figure2-11) The unit file is created at the specified directory with file name “CAOLib_TLB.pas".

Figure2-11 Read type library screen(3) Activate the source file that uses the CAO object, and select menu [File] -> [Use unit].
(4) Select ”CAOLib_TLB” on the unit selection screen and click OK button.
(5) Add “ComObj" in the uses paragraph of the source file.
CAO object will become available with these procedures.
ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide- 46 -

2.6.4.2. Operation procedure
CAO object is operated in the following procedures.
(1) Create CaoEngine object
Retrieve UUID with ProgIDToClassID(), and create object with CreateComObject().
CaoObj := CreateComObject(ProgIDToClassID('CAO.CaoEngine'));(2) Retrieve CaoEngine interface
Because the object generated in (1) has IUknown type interface, cast the object to the CaoEngine
interface.
CaoEng := CaoObj as ICaoEngine;(3) Operate with object
Use CaoEngine interface to operate CAO.
CaoWss := CaoEng.Workspaces;

As a note, when CAO object variable is released, Release() is automatically executed. Therefore, if variable
is released explicitly as in the other language, CAO may not end normally.

Following is a sample to set and get the value of a variable.

List 2-7

Unit1.pas
unit Unit1;
interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ComObj;
type
TForm1 = class(TForm)
Button1: TButton;
Edit1: TEdit;
Edit2: TEdit;
Label1: TLabel;
Label2: TLabel;procedure Button1Click(Sender: TObject);private{ Private declaration }public{ Public declaration }end;varForm1: TForm1;

ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide- 47 -

implementation
uses CAOLib_TLB;{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);var
CaoObj: IUnknown;
CaoEng: ICaoEngine;
CaoCtrl: ICaoController;
CaoVar: ICaoVariable;
begin
Try
{ create CaoEngine }CaoObj := CreateComObject(ProgIDToClassID('CAO.CaoEngine'));CaoEng := CaoObj as ICaoEngine;{ create CaoController }CaoCtrl := CaoEng.Workspaces.Item(0).AddController('', 'CaoProv.DataStore', '', '');{ create CaoVariable }CaoVar := CaoCtrl.AddVariable('Test', '');{ set value }CaoVar.Value := Edit1.text;{ get value }Edit2.Text := CaoVar.Value;
Except{ error processing }ShowMessage('Error');
End;
end;
end.

2.6.5. Creating client in Java
It is impossible to call by COM from Java. Therefore, to use CAO from Java, there are the following
methods.
・ JNI native method library.11
・ Java-COM bridge library.

11

CaoSQL provides a library that wraps interface for Java.

ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide- 48 -

2.6.5.1. CAO call from JNI's native method libraryJava Client
JNI
Native method libraries
COM
ORiN2
CAO

CAO Provider

Figure 2-12 Calling CAO by JavaThe following shows the creation procedure of a native method library and a sample client of Java. Words inbrackets in the end of each procedure indicates a language used.

(1) Declaring native method (Java)
Declare a native method that has functions where a client program requires. The native method
declared here does not need to be a CAO interface-wrapped method.
To declare a native method, put “native” keyword in the method declaration.
Example) public native int AddVariable(String VarName);(2) Creating a client program that uses the native method (Java)
Create a class using declared native method, and then compile it.
To compile, run the following command by using command prompt.
Example)javac CaoJNI.java(3) Creating a C++ header of the native method (Java)
Create a header file that is included from the compiled file by the native code
To create, run the following command by using command prompt.
Example)javah -jni CaoJNI(4) Including JNI header file (C++)
ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide- 49 -

Include a created header file and a JNI header file.
Example)#include <jni.h>#include “CaoJNI.h”(5) Implementing a native method library (C++)
Set a CAO object to use by the procedure of 2.6.1.
Implement the native method declared in the created header file.

(6) Compiling the native method library (C++)
Compile the implemented native command library.
To compile, run the following command by the command prompt. For about the compile options,change depending on the environment.
Example) cl /IC:\jdk1.3.1\include /IC:\jdk1.3.1\include\win32 /IC:\ORiN2\CAO\Include/LD CaoJNI.cpp /FeCaoJNI.dll(7) Executing a sample client (Java)
Execute a sample client. A file of the native method library needs to exist in the folder written by anenvironmental variable “CLASSPATH”.
To execute the client, run the following command.
Example)java CaoJNI

The following sample source shows a source code created by the procedure written above.

List 2-8

CaoJNI.java
import java.io.*;public class CaoJNI {/* --- Cao Native Interfases --- */public native int CreateCaoEngine();public native int AddController(String CtrlName, String ProvName, String Machine, String
Param);
public native int AddVariable(String VarName);public native String GetValue();public native void PutValue(String strVal);
public native void FreeMemory();// Constructor
public void CaoJNI() {}// Initializing CaoJNI classpublic void init() {System.loadLibrary("CaoJNI");}public static void main (String args[]) {CaoJNI cao= new CaoJNI();
cao.init();
int iRet;

ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide- 50 -// Creating CaoEngine
iRet = cao.CreateCaoEngine();if (iRet != 0) {System.out.println("Can't make CaoEngine!");return;}iRet = cao.AddController("Sample", "CaoProv.DataStore", "", "");
if (iRet != 0) {System.out.println("Error on OpenController: ErrorCode(" +Integer.toHexString(iRet) + ")");
cao.FreeMemory();
return;}iRet = cao.AddVariable("S1");
if (iRet != 0) {System.out.println("Error on GetVariable: ErrorCode(" +Integer.toHexString(iRet) + ")");
cao.FreeMemory();
return;}cao.PutValue("Sample Data");
System.out.println("PutValue Succeeded");String strRet = cao.GetValue();
System.out.println(strRet);
cao.FreeMemory();}}

List 2-9

CaoJNI.cpp#include <jni.h>#include "CaoJNI.h"#include <atlbase.h>#include "CAO.h"#include "CAO_i.c"
BSTR jstring2BSTR(JNIEnv *env, jstring jstr);
ICaoEngine* g_pICaoEng;
ICaoController* g_pICaoCtrl;
ICaoVariable* g_pICaoVar;// CreateCaoEngine
JNIEXPORT jint JNICALL Java_CaoJNI_CreateCaoEngine(JNIEnv *env, jobject me){
HRESULT hr;
hr = CoInitialize( NULL );/* Create CaoEngine Object */hr = CoCreateInstance(CLSID_CaoEngine, NULL, CLSCTX_LOCAL_SERVER, IID_ICaoEngine,(void**)&g_pICaoEng);
if (SUCCEEDED(hr)) {printf("Make CaoEngine Succeeded!\n");}return hr;}

ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide- 51 -// AddController
JNIEXPORT jint JNICALL Java_CaoJNI_AddController(JNIEnv *env, jobject me, jstring strCtrl, jstring strProv, jstring strMachine, jstring
strParam){
if (g_pICaoCtrl) {return E_FAIL;// Controller has already opened}
HRESULT hr;
CComBSTR bstrProv, bstrMachine, bstrCtrl, bstrParam;
bstrProv = jstring2BSTR(env, strProv);
bstrMachine = jstring2BSTR(env, strMachine);
bstrCtrl = jstring2BSTR(env, strCtrl);
bstrParam = jstring2BSTR(env, strParam);/* Get CaoWorkspace Object */CComPtr<ICaoWorkspaces> pICaoWSs;
CComPtr<ICaoWorkspace> pICaoWS;
hr = g_pICaoEng->get_Workspaces(&pICaoWSs);
if (FAILED(hr)) {return hr;}
hr = pICaoWSs->Item(CComVariant(0L), &pICaoWS);
if (FAILED(hr)) {return hr;}/* Create CaoController Object */hr = pICaoWS->AddController(bstrCtrl, bstrProv, bstrMachine, bstrParam, &g_pICaoCtrl);
if (SUCCEEDED(hr)) {printf("OpenController Succeeded!\n");}return hr;}// AddVariable
JNIEXPORT jint JNICALL Java_CaoJNI_AddVariable(JNIEnv *env , jobject me, jstring strVar){
if (g_pICaoVar) {g_pICaoVar->Release();}HRESULT hr;
CComBSTR bstrVar, bstrOption;
bstrVar = jstring2BSTR(env, strVar);hr = g_pICaoCtrl->AddVariable(bstrVar, bstrOption, &g_pICaoVar);
SysFreeString(bstrVar);
if (SUCCEEDED(hr)) {printf("GetVariable Succeeded!\n");}return hr;}// GetValueJNIEXPORT jstring JNICALL Java_CaoJNI_GetValue(JNIEnv *env, jobject me){if (!g_pICaoVar) {ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide
return NULL;- 52 // Variable is not found}// Obtaining a value
CComVariant vntValue;
HRESULT hr = g_pICaoVar->get_Value(&vntValue);if (FAILED(hr)) {return NULL;}// Convert obtained value to character string
hr = vntValue.ChangeType(VT_BSTR);
if (FAILED(hr)) {return NULL;}
return env->NewString(vntValue.bstrVal, SysStringLen(vntValue.bstrVal));}// PutValueJNIEXPORT void JNICALL Java_CaoJNI_PutValue(JNIEnv *env, jobject me, jstring strVal){
if (!g_pICaoVar) {return;// Variable is not found}
HRESULT hr;
CComBSTR bstrVal;
bstrVal = jstring2BSTR(env, strVal);
hr = g_pICaoVar->put_Value(CComVariant(bstrVal));return;}// FreeMemory
JNIEXPORT void JNICALL Java_CaoJNI_FreeMemory(JNIEnv *env , jobject me){if (g_pICaoVar) {g_pICaoVar->Release();printf("CaoVariable Deleted\n");}if (g_pICaoCtrl) {g_pICaoCtrl->Release();printf("CaoController Closed\n");}if (g_pICaoEng) {g_pICaoEng->Release();printf("CaoEngine Terminated\n");}CoUninitialize();
return;}// Character string conversion(Java→BSTR)
BSTR jstring2BSTR(JNIEnv *env, jstring jstr){
if (jstr==NULL) {return NULL;}
const WCHAR* wc;

ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide- 53 -

wc = env->GetStringChars(jstr, NULL);
int iLen;
iLen = env->GetStringLength(jstr);
BSTR bstrString;
bstrString = SysAllocStringLen(wc, iLen);env->ReleaseStringChars(jstr, wc);
return bstrString;}

2.6.5.2. Call CAO with Java-COM Bridge
You can call CAO by using Java-COM bridge.
Java-COM bridge is a library for calling COM from Java programs, and several kinds are provided as OSS.
(Example: j-interop, COM 4 J etc.)
CAO is created using COM, so you can use CAO directly from Java by using Java-COM bridge.
Since the specific usage depends on the library, refer to the information of each library.

2.6.6. Creating client in LabVIEW
To operate CAO object from LabVIEW, create a VI file functioning as ActiveX client.
Following is the procedure to create and use ActiveX client VI.
Note: LabVIEW ver8.6 is used for window images of the following procedure.
(1) With automation open function, open reference to server.

At automation Refnum input, select [Select ActiveX class]-[Reference], and choose “CAO1.0 Type
Library Version 1.0”, and specify [CaoEngine].

ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide- 54 -

Figure 2-13 Window to select object from type library(2) Setup properties, and use methods.
Note: To use properties with the capability of “Read” and “Write”, change the attribute of theproperty node.

(3) Close reference
Close reference from a function that closes automation Refnum.
Below is an example of setting and getting variable value.

List 2-8

ORiN Forum

ImportSample.vi

DENSO WAVE Inc.

ORiN 2 programming guide- 55 -

2.7. Special functions of CAO
2.7.1. CRD switch function
According to the setting of providers, CAO engine can access to the CRD file when provider is accessed toget properties. Following is the provider set-up steps to use CRD switch function.
(1) Install CRD provider to the machine to run CAO engine.
(2) Set path to the CRD file to be referred in the registry information “CRDFile” of the provider thatuses CRD switch function. CaoConfig can set this pass information. Please refer details in 6.
(3) In property that refers to the CRD file of the provider, return the value “E_CRDIMPL"12.

Please not that object name of created controller needs to be as same as the CRD file.

2.7.2. Automatic object registration function
The function automatically register object to default workspace when CAO engine starts.
The automatically registered object has the same structure as the CRD file registered in the registry. If theregistered file path is wrong, only the registerable object is registered.
CaoConfig can be used to register the path to the registry.

12

When “E_CRDIMPL" is returned by the method, the value is returned to the client as it is.

ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide- 56 -

It is convenient to use the XML editor to edit the CRD file. Following is one of free XML editor software.
Morphon XML-Editor 3.1.4: http://www.morphon.com/

Following is a sample of CRD file.

List 2-10

CRDSample.xml<?xml version="1.0" encoding="Shift_JIS"?><CRD xsi:schemaLocation="http://www.orin.jp/CRD/CRDSchema CRDSchema.xsd"
xmlns="http://www.orin.jp/CRD/CRDSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><Help>CRD Sample Data</Help><Version>1.0.0</Version><Controller name="RC1" provider="CaoProv.XXX" machine="" option="Conn=eth:192.168.1.1"><Command name="Walk"/><Variable name="Var1"/></Controller></CRD>

2.7.3. Dynamic method addition function
The function dynamically adds command class as methods of controller class.
The controller class can execute the Execute method by specifying command name as method name.

Dynamic binding →2. Then, the command
can be called as astandard function.

‘ Visual Basic...
set ctrl = ws.AddController(…)...
ctrl.AddCommand(“Walk”)...
ctrl.Walk 1,2,3...

1. A proprietary command
which is not defined in
ORiN specifications areadded dinamically.
3. This line can be omitted if
it is defined by CAO Modelin advance.

Figure2-14 Dynamic Binding
Following is a sample of dynamic method addition function.
'Create command
Dim Cmd As CaoCommand
Set Cmd = Ctrl.AddCommand("Shoot")'Sample of executing in the command class
Cmd.Parameters = Array(10,10,20)
Cmd.Execute 0

ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide- 57 -'Sample of using dynamic method addition function
Ctrl.Shoot 10, 10, 20

ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide- 58 -

3. CRD programming guide3.1. Outline
CRD (Controller Resource Definition) is a standard to describe various static resources of the FA device
with XML (eXtensible Markup Language). Its data schema is called CRD schema, and a XML file describedaccording to this CRD schema is called as CRD instance. CRD is a standard data schema to manage FA device
information in a common format.
CRD is designed assuming following two usages.
(1) Device static data definition(2) Device and whole system configuration definition(3) Device capability definition
The first half of this chapter explains XML as basic knowledge, and the latter half explains concrete
procedure of creating CRD.

3.2. Basic knowledge
3.2.1. What is XML?
XML is self-extensible standard generalized markup language (eXtensible Markup Language), and the
manufacturer of the document can decide the rule to decide the document structure. (Therefore, it is named as“Self-extensible".) By utilizing the function that the creator of document can freely define its structure, highly
flexible data, or data independent from specific document structure, can be widely exchanged using XML
standard.
XML has the following features.
・ Data format has its meaning and content.
・ A hierarchical data structure definition is possible.
・ Tag can be logically described, and structured comprehensive document can be created.
・ Data format is extensible, and widely spreading as an industry standard.
Following is an simple example of XML document. In XML, data is expressed by using tag. Items from the
beginning tag to the end tag are called as element. In the following example, tags like <ORiN> and <Author>
is used to hold the information of ORiN or its author. The element can have another element as a child element,
to express data structurally. In addition, XML can add expression like “Release=”2003” ”, to give additional
information (attribute) to the elements.
<ORiN><ORiN1 Release=“2003"><Author>ORiN conference </Author><EngineName>RAO</EngineName></ORiN 1>

ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide- 59 -<ORiN2 Release=“2005"><Author>ORiN conference </Author><EngineName>RAO</EngineName></ORiN 2></ORiN>

3.2.2. DOM
DOM (Document Object Model) is standard API to treat the XML document as an object.
XML document itself is a text file. However, when browsers or applications like CAO processed the file,they read out each elements described in XML as objects. If each applications differently handles XML object,
it is very burdensome for developers. Therefore, W3C established DOM as a unified standard. Another XMP
API other than DOM is SAX (Simple API for XML), and both of them are widely used.
DOM has several levels, and the higher level is the newer and more functional. Level-2 is the latest
recommendation from W3C, and CRD provider also uses this level.

3.2.3. XML parser
The XML document is usually a text file. However, XML allows various ways of expression, andapplications need to follow several procedures to read the file. General-purpose procedures are selected andimplemented ad XML parser.
When the XML parser is called from an application, standard API is used. Standard API includes DOM and
SAX, etc., which are explained before. DOM is an open standard, and several XML parsers compliant to thestandard is released. On Windows environment, MSXML can be easily used with Visual C++ and Visual Basic,
and MSXML is used in CRD provider etc. Several versions of MSXML has been released, and CRD provider
uses MSXML4.0. When the CRD provider is used, you need to confirm the version of installed MSXML.

3.2.4. XML schema
The schema in XML is description of possible XML document structure. The schemes describes correct
order of elements and attribute arrays. By describing the schema, XML parser can automatically check thecorrectness of XML document to some degree.
Typical XML Schema includes DTD, XML Schema, RELAX and XDR, and CRD uses XML Schema.

ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide- 60 -

3.3. CRD file and CRD provider
Client applications that utilize CRD file mainly uses following two methods to access the file.

(1) Indirectly access through CAO engine.
(2) Direct access with XML parser.

Please refer a suitable reference book about method (2). For method (1), ORiN2 prepares CRD provider sothat client application can access CRD file just as same way as accessing controller. By using this provider,application program can handle both data in actual controller and data expressed in CRD file in the same way.
CRD schema defines each element almost corresponds one-to-one to CAO interface. For example, whenaccessing a CRD file named “test.xml”, which defines “RC1” controller element and “Var1” variable elementin the controller, CRD provider can access variable element “I4” in the CRD file in the following way.
Dim caoEng As New CaoEngine
Dim caoWS As CaoWorkspace
Dim caoCtrl As CaoController
Dim caoVar As CaoVariable
Set caoWS = CaoEng.CaoWorkspaces(0).
Set caoCtrl = caoWS.AddController("RC1", "CaoProv.CRD", "", "C:\test.xml")
Set caoVar = caoCtrl.AddtVariable("Var1")

After CRD file is created, please try to use CRD provider to check and to change its design.
However, CRD provider can change data that is described as “W” in the R/W field of A.1 CAO engine
function list.
For details of provider, please refer to “CRD provider users’ guide.”

ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide- 61 -

3.4. Creating CRD file
3.4.1. Header and root element creation
CRD file is a XML file, and following description is placed at the top of the file for XML declaration.
<?xml version="1.0" encoding="Shift_JIS"?>In the above declaration, encoding attribute need to match the character code 12 that is used in CRD file.
Next, specify the following as a root element of CRD document.
<CRD xmlns=http://www.orin.jp/CRD/CRDSchema
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance
xsi:schemaLocation="http://www.orin.jp/CRD/CRDSchema CRDSchema.xsd">

In the element, specify the path to the scheme at the list line before “CRDSchema.xsd.” If the schema does
not exist at the specified path, CRD file structure is not checked.
In addition, the CRD root element can have following child elements.

3.4.2. Static data definition
Static data definition is to describe object elements and property elements of controller in XML file.
(1) Add object elements
Object element represents CAO object instance. Controller element is allocated below CRD root
element, and objects below controller element are allocated as the same structure as CAO object tree.
Following is an example of object element description.
<Controller name="RC1"><File name=“pro1.pac”>…
</File><Variable name=“I1”>…
</Varriable></Controller>

All object elements require name element, the name element represents object name. In the above
example, CaoController”RC1” has a CaoFile “pro1.pac” and CaoVariable “I1”
(2) Add property element to object element.
Add property element to describe static data of each object under object element. The property
element depends on the type of object element. Please refer <ORiN2.1 Specifications Part 3: CRD>
for details.

3.4.3. System configuration definition
System configuration definition is to add object elements of controller in XML file. Same as static data
ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide- 62 -

element, object element is allocated under CRD root element in tree structure.
Following is an example description.
<Controller name="RC5" option="Conn=eth:10.8.109.126" provider="CaoProv.DENSO.NetwoRC"><Robot name="Arm1"/><Variable name="IO100"/></Controller>

The table below shows attributes of each object element.

Table 3-1 Object element and attributeobject element

required attribute

optional attribute

Controller

Name

MachineProviderOptionName

OptionNumber-Command
Extension
File
Robot
Task
Variable
Message

3.4.4. Device capability definition
Device capability definition is to add object element and capability definition element to XML file.
(1) Add object element
Object element is allocated under CRD root element in tree structure, like static data definition. All
object elements may have name attribute and key attribute optionally.
Name attribute shows object name, and an object without name attribute is regarded as an object
without name specification.
The capability of an object with key attribute is recognized as the capability defined in the capability
definition element with the same key name. An object without key attribute is regarded as using thedefault capability definition element.
Following is an example of object element.
<Controller><File/><Robot/><Task/><Variable name="@CURRENT_TIME" key="SYS_VAR_CURRENT_TIME"/></Controller>

The above example represents the following.
・ All controllers and the files, robots, task objects under the controllers use the default capability
ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide- 63 -

definition element.
・ “@CURRENT_TIME” variable objects under all controllers refer a capability definition elementwith a key named “SYS_VAR_CURRENT_TIME”.

(2) Add capability element.
Capability definition element referred by each object is allocated under CRD root element.
Capability element definition specifies information like implementation status of controller member
or data type / value range of argument / return value.
Capability elements are described in the controller capability element. In this way, each controller
can have the controller specific capability definition.
Each capability definition element can have ObjectKey element. This is to uniquely determine acapability specified by object element. Capability element without ObjectKey element is regarded as
defining default capability.
Following is a capability definition example.
<Controller_Info><Args><Arg index="1"><HelpString>Controller Name</HelpString><VarInfo><DataInfo><Min>0</Min><Max>10</Max></DataInfo></VarInfo></Arg><Arg index="2"/></Args><Variable_Info><ObjectKey>SYS_VAR_CURRENT_TIME</ObjectKey><Put_Value_Info><Args><Arg index="1"><VarInfo type="VT_DATE"/></Arg></Args></Put_Value_Info><Get_Value_Info><Result><VarInfo type="VT_DATE"/></Result></Get_Value_Info></Variable_Info></Controller_Info>

The above example explains the followings.
・ The number of argument of AddController for default controller is two.
・ The first argument of AddController for default controller is the controller name.
・ The range of the first argument of AddController for default controller is 1 to 10.
・ For object in the default controller, Put_Value() and Get_Value() is implemented for variables with
ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide- 64 -

definition of Key = “SYS_VAR_CURRENT_TIME”.
・ In the above mentioned variable, Put_Value() sets VT_DATA type value.
・ In the above mentioned variable, Get_Value() acquires VT_DATA type value.

3.5. Sample CRD fileFor better understanding, three types of CRD usage examples are shown. These examples may be combined
into one file, but these definitions are usually divided into several files according to the usage.

3.5.1. Static data definition example

List 3-1

CRDSchema2.xsd<?xml version="1.0" encoding="Shift_JIS"?><!-********** [ORiN2] CRD Sample **********--><CRD xsi:schemaLocation="http://www.orin.jp/CRD/CRDSchema ../../Schema/CRDSchema2.xsd"
xmlns=http://www.orin.jp/CRD/CRDSchema
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><Help>CRD Test Data</Help><Version>1.0.0</Version><Controller name="RC1"><Attribute>0</Attribute><Help>Sample Ctrl</Help><!—In case of VT_I2 type --><Variable name="Var1"><Value type="VT_I2"><iVal>10</iVal></Value></Variable><!—In case of VT_I2 type one dimensional array --><Variable name="Var2"><Value type="VT_ARRAY"><array type="VT_I2"><!—Array information --><dimension>1</dimension><arrayBound><lBound>0</lBound><elements>3</elements></arrayBound><!-- Data --><arrayData><iVal>0</iVal><iVal>1</iVal><iVal>2</iVal></arrayData></array></Value></Variable></Controller></CRD>

ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide- 65 -

3.5.2. System configuration definition example

List 3-2

CRDSchema2.xsd<?xml version="1.0" encoding="UTF-8"?><CRD xmlns=http://www.orin.jp/CRD/CRDSchema
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance
xsi:schemaLocation=" http://www.orin.jp/CRD/CRDSchema../../Schema/CRDSchema2.xsd"><Controller name="RC5" option="Conn=eth:10.8.109.126" provider="CaoProv.DENSO.NetwoRC"><Robot name="Arm1"/><Variable name="IO100"/></Controller></CRD>

3.5.3. Device capability definition example

List 3-3

CRDSample_DC.xml<?xml version="1.0" encoding="utf-8"?><CRD xsi:schemaLocation=http://www.orin.jp/CRD/CRDSchema ../../Schema/CRDSchema2.xsd
xmlns=http://www.orin.jp/CRD/CRDSchema
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><Controller_Info><Args><Arg index="1"><HelpString>Controller name</HelpString><VarInfo><DataInfo><Min>0</Min><Max>10</Max></DataInfo></VarInfo></Arg><Arg index="2"/></Args><Get_VariableNames_Info><Result><VarInfo type="VT_ARRAY|VT_VARIANT"/></Result></Get_VariableNames_Info><Execute_Info><Args><Arg index="1"><VarInfo><DataInfo><List>getAutoMode</List><List>putAutoMode</List></DataInfo></VarInfo></Arg><Arg index="2"><VarInfo type="VT_EMPTY"/><VarInfo type="VT_I2"><DataInfo><List>10</List><List>20</List></DataInfo></VarInfo><VarInfo type="VT_I4"><DataInfo><Min>-1</Min><Max>100</Max>

ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide- 66 -</DataInfo></VarInfo></Arg></Args><Result><VarInfo type="VT_EMPTY"/><VarInfo type="VT_I2"/><VarInfo type="VT_I4"/></Result></Execute_Info><File_Info><Get_Value_Info><Result><VarInfo type="VT_BSTR"/><VarInfo type="VT_ARRAY|VT_UI1"/></Result></Get_Value_Info><Get_VariableNames_Info><Result><VarInfo type="VT_ARRAY|VT_VARIANT"/></Result></Get_VariableNames_Info><Copy_Info/><Delete_Info/><Move_Info/></File_Info><Robot_Info><Halt_Info/><Move_Info/><Speed_Info/></Robot_Info><Task_Info><Start_Info/><Stop_Info/></Task_Info><Variable_Info/><Message_Info><Clear_Info/></Message_Info><Variable_Info><ObjectKey>SYS_VAR_CURRENT_TIME</ObjectKey><Put_Value_Info><Args><Arg index="1"><VarInfo type="VT_DATE"/></Arg></Args></Put_Value_Info><Get_Value_Info><Result><VarInfo type="VT_DATE"/></Result></Get_Value_Info></Variable_Info></Controller_Info><Controller><File/><Robot/>ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide- 67 -<Task/><Variable name="@CURRENT_TIME" key="SYS_VAR_CURRENT_TIME"/></Controller></CRD>

ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide- 68 -

4. CAP programming guide4.1. Outline
CAP is a communication protocol to access the CAO provider by way of the Internet. In ORiN2 SDK, thedistributed object technology by way of the Internet has been achieved by using SOAP.
This chapter actually constructs the Web server, and explains the method of calling the provider using CAP.
The composition of this chapter explains SOAP as basic knowledge in the first half, and explains the outline ofoperation of CAP. It explains the environmental construction method to use CAP in the latter half, and thesample program is made at the end.

4.2. Basic knowledge
4.2.1. SOAP
SOAP is a protocol to call the object on PC remotely by transmitting the message described by the XML
format with HTTP.
There are CORBA and DCOM, etc. as a technology that calls the object on PC remotely. However, thesetechnologies should do the setting that permits communicating to a specific port when communicating throughthe firewall to communicate by using an original port number. Because any security hole of DCOM, such asworm, exists these days, the setting that permits communicating to the port of DCOM is not generally done.
Then, to solve these problems, the technology named SOAP was developed. Because SOAP only specifies
the message exchange structure between objects, existing HTTP and SMTP are used for the protocol for thecommunication. As a result, if HTTP or SMTP can be communicated, using the distributed object technology
through the firewall becomes possible by using SOAP.

HTTP
SO AP

DCOM
CO RBAf ir e w a ll

Figure4-1 Image of SOAP

4.3. CAP provider and CAP listener
It provides for the specification named CAP in ORiN2 SDK to access the CAO provider by way of theORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide- 69 -

Internet. The CAO provider can be remotely accessed by analyzing between the client and the server as thesending and receiving message based on the specification of this CAP.
However, the CAP listener is offered with the CAP provider in ORiN2 SDK because it takes time to make asending and receiving message and analytical processing based on CAP.
Figure4-2 shows the operation outline of CAP provider and CAP listener. As this figure shows, CAP
provider is a provider to generate and to transmit the message to access a remote provider. This message istransmitted to CAP listener to have opened Web server to the public. CAP listener is an interface to receive andanalyze CAP-based message, and to call the COM component (CAO provider).
Thus, using the provider remotely just like other local providers become possible by the CAP provider
listener's path.

ServerClient

ORiN2

CAO
CAO
対応
application
アプリケーション

CAO
providerCAOプロバイダ

ORiN2

engineCAO
CAOエンジン

CAOエンジン
engineCAP
listener
CAP
リスナ

provider
CAPプロバイダ

internet
インターネット

Web server
サーバ
Web

CAP
Msg.

Figure4-2 Outline of CAP

ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide- 70 -

4.4. Environmental construction
This chapter explains the environmental construction to use CAP method.
Hereafter, the side which calls a remote provider by using CAP provider is expressed “Client”, and thecalled side is expressed "Server".
ORiN2 SDK is assumed to be installed in both the server computer and client computer.

4.4.1. Setting of server side(1) Installation of Web server
The message transmitted with SOAP as mentioned above starts the CAP listener with the Web server,
and analyzes the message. Therefore, it is necessary to construct the Web server.
Web server IIS (Internet Information Service) is appended to Windows 2000 Server/Windows 2000
Professional/Windows XP Professional by the standard13. However, you need to install additionallybecause it is not installed in the default installation. (It is installed by the standard for Windows 2000
Server.)This section explains the setting procedures with Windows XP Professional.
From the Start menu, click [Setting], click [Control panel], click [Add or Remove Programs], andthen select [Add/Remove Windows Components].
Once the dialog box shown in Figure4-3 is displayed, select the checkbox of Internet Information
Services (IIS).

13

As for IIS of the Windows 2000 Professional/Windows XP Professional attachment, the function is limited compared with the one of Windows2000 Server. Please use Windows 2000 Server when you want to provide real service. Moreover, please note that IIS is not attached to Windows
XP Home Edition.

ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide- 71 -

Figure4-3 Addition of Windows component

When Figure4-4 is displayed, double-click "World Wide Web Service", and then select the check boxof all components. At that time, "Internet Information Service Snap-In" and "Common Component"
will be automatically selected.

Figure4-4 Addition of the Internet information service

Select the components to install, and then click [Next] to start installation of the Windows
components.
"Windows XP Professional installation disk" is requested while installing it.
(2) Installation of SOAP Toolkit
Install Microsoft SOAP Toolkit 3.0 in order to analyze the message that has been transmitted with
SOAP. Double-click the downloaded soapsdk.exe, and then click the button according to the
instruction, the installation is completed. You can leave the setting as the default.

Table 4-1 Soap Toolkit 3.0 download site
File nameURL

soapsdk.exe

http://www.microsoft.com/downloads/details.aspx?

ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide- 72 -

FamilyID=c943c0dd-ceec-4088-9753-86f052ec8450&DisplayLang=en(3) Creating virtual directory
A virtual directory is created by using SOAPVDIR.CMD of Microsoft SOAP Toolkit 3.0. A virtual
directory here is the one that the address of the HTTP access is allocated in a physical path.
SOAPVDIR.CMD is in the following directory.
< SOAP installation directory > ¥Binaries

To create a directory, enter the following commands in the command prompt.
SOAPVDIR.CMD CREATE Cap < Bin directory of CapListener >(4) Setting of IIS
Next, perform the settings necessary to start the CAP listener from ISS.
From the Start menu, click [Setting], click [Control panel], click [Administrative Tools], and thenstart [Internet Information Services].
To confirm the virtual directory [Cap] that you have just created, from the [Internet information
service] window, click [Local computer], click [Web site], and then click [Default Web Site].

Figure4-5 Set screen of IIS
Right-click in the following two files in the Cap directory to display properties, and select the [Read]
ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide- 73 -

checkbox.
・ CapLister.WSML
・ CapListerClient.WSML

Figure4-6 Set screen of WSML file(5) Setting of the start authority of CAO engine
Set the start authority so that an user who accesses via the Internet can start CAO engine.
Right-click in < ORiN installation directory > ¥CAO¥Engine¥Bin¥CAO.EXE, and select [Property],
select [Security], and then click [Add…].
Once Figure4-7 is displayed, add an Internet guest account, and then add the start authority.
To check the Internet guest account name, from the Start menu, click [Setting], click [Control panel],and then click [User Accounts].

ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide- 74 -

Figure4-7 Addition of the Internet guest accountWhen the account is added successfully, the account name will be displayed as Figure4-8 shows.

Figure4-8 The Internet guest account addition result
ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide- 75 -(6) Setting of CapListner.WSDL file
Change the server name written in the line 3459 of the CapListner.WSDL file which is in the
CapListener directory to the actual Web server name.
(Example) soap:address location='http://HOSTNAME/Cap/CapListener.WSDL' />(7) For Windows XP SP2
Because IIS cannot be used by setting the firewall in default when Windows XP Service Pack 2(SP2)
is applied, CAP cannot be used. This problem can be solved by the following two methods.
・ Disable the Windows firewall setting.
・ Perform the setting so that IIS connection is exceptionally permitted.
If the computer has been protected enough by the firewall or other security, you can disable theWindows firewall. If the firewall is disabled, you can use CAP provider without performing thefollowing setting. In that case, as Figure4-9 shows, from the Start menu, click [Control panel], click[Windows Firewall], and then select [Off (not recommended)].

Figure4-9 Nullification of Windows firewall
To permit the connection of IIS the firewall, set as follows.
ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide- 76 -

From the Start menu, click [Control panel], click [Windows Firewall], and select [Advanced] tab.
As Figure4-10 shows, from the [Network Connection Settings] pane, select the connection method
corresponding to the current environment, and then click [Settings…]. (In this example, "Local Area
Connection" is selected.)

Figure4-10 Exception setting of connection
Once a dialog box shown in Figure4-11 is displayed, select [Web Server (HTTP)].

ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide- 77 -

Figure4-11 Selection of service added to exception

4.4.2. Client side(1) Installation of SOAP Toolkit
Install Microsoft SOAP Toolkit 3.0. (see Table 4-1)

4.5. Sample program
Create a sample application in order to confirm the operation of CAP. With VB6, create a form that have one
text box and two buttons, and then write the following codes.

List 4-1

Sample.frm
Private eng As CaoEngine
Private ctrl As CaoController
Private var As CaoVariable
Private Sub Form_Load()
Dim ws As CaoWorkspace
Set eng = New CaoEngine
Set ws = eng.Workspaces(0)‘ Server connect
Set ctrl = ws.AddController( _(1)"RC1", "CaoProv.CAP", "", "Provider=CaoProv.DataStore,Server=XXXXX")' Acquisition of variable
Set var = ctrl.AddVariable("Var1")
End Sub

ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide- 78 -' Setting of variable
Private Sub Command1_Click()var = Text1.Text
End Sub' Acquisition of variable
Private Sub Command2_Click()
Text1.Text = var
End Sub

Look at (1) in the source code. AddController method establishes the connection to the provider via theInternet. The first to the third arguments of this method are the same as other providers. The content of the
fourth argument is shown below.
Provider :Provider name accessed by way of the Internet

Server:Host name of Web server

Option:Option character string of provider that remotely accesses it

Thus, the CaoController object acquired in the AddController method can be used by using the CAP
provider as a controller target of the specified provider name.
In the above example, “ctrl” object can be treated as a controller object of the DataStore provider.

ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide- 79 -

5. Environmental setting
5.1. DCOM setting procedures
In ORiN2 SDK, to start CAO or CAO provider remotely, you need to perform settings by using DCOM
configuration tool. If the security settings of DCOM client and/or server application is incorrect, an error
occurs and the remote start or remote access will fail.
This chapter explains the DCOM setting procedure by using DCOMCNFG.exem which is a configuration
tool. For details, refer to the following reference documents.
・ COM/COM + security
http://www.microsoft.com/japan/com/compapers.asp - comseq
・ Method of setting DCOM to VB5 application program with VB5 DCOMCNFG.EXE
http://support.microsoft.com/default.aspx?scid=kb;ja;JP183607
・ “DCOM Deployment guide” (published by Syoei-sha) Written by Frank E. Redmond III, Translated by
Top studio, and Supervised by Ryoji Kaneko

The content introduces here is a setting to start CAO or the CAO provider with DCOM remotely, and the
security setting level is low (security is not set) in this example. Please note that the system can be attacked bymalicious external program. If possible, please review the setting according to an individual environment.

ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide- 80 -

5.1.1. Preparation(1) Prepare a computer that will be a DCOM server and a computer that will be a DCOM client. The
following table shows the applicable OS.

Table 5-1 OS and correspondence of DCOMOSDCOM server

DCOM client

Windows95✓✓

Windows98✓✓

WindowsNT 4.0 WorkStation✓✓

WindowsNT 4.0 Server✓✓

Windows2000 Professional✓✓

Windows2000 Server✓✓

Windows XP Professional✓✓(2) Please register the DCOM client and the DCOM server in the same domain.

5.1.2. Set item in Windows NT/2000(1) DCOMCNFG.EXE is started.
From the Start menu, click [Run], and then enter “dcomcnfg" to start DCOMCNFG.EXE.

Figure5-1 Start of DCOMCNFG(2) Setting of default value
You can set the default values for DCOM property. Once you set the default values, it affect all
DCOM applications installed in the local computer. Therefore, you have to be very careful to entersuch values. In addition, do not change this setting when there is a problem in security. (However, in
this case, CAO cannot be used via DCOM.)
Click [Default properties] tab.
As Figure5-2 shows, select the [Enable Distributed COM on this computer] checkbox. On the
ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide- 81 -[Default Distributed COM communication properties] pane, in the [Default Authentication Level],select [None], and in the [Default Impersonation Level], select [Identify].

Figure5-2 Default property(3) Setting of each application
From the tab of open DCOMCNFG.EXE, select [Applications] tab, select an application that you
want to start by DCOM, and then click [Property].
This operation must be done for all applications that are remotely started. It means, if providers arestarted by DCOM, this processing must be done for all the providers that are started by DCOM.
Moreover, if remote CAO is used, this process must be done to CAO.

ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide- 82 -

Figure5-3 Setting of each application
Select [General] tab. Set the Authentication Level to [Default] since this sample uses the default
authentication level.

Figure5-4 General setting
ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide- 83 -

Select [Location] tab. In this setting, the location where the application is executed can be specified.
Select [Run application on this computer].Remove other checks.

Figure5-5 Location setting
Select [Security] tab.

ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide- 84 -

Figure5-6 Security setting
Select "Use custom access permissions", click [Edit...] button. Add the following access right.
・ Everyone – Allow Access・ INTERACTIVE - Allow Access・ SYSEM - Allow AccessFigure5-7 Addition of access rightSelect [Use custom launch Permissions ], click [Edit...] button. Add the following launch
permissions.
ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide- 85 -

・ Everyone – Allow Access・ INTERACTIVE - Allow Access・ SYSEM - Allow AccessSelect [Identify] tab, and then select [The interactive user]. If you start DCOM server with WindowsNT, [The launching user] is acceptable. In addition, you may select [This user] and enter a user.
However, at the service registration, [The launching user] and [The Interactive user] cannot be
selected. (You can use the system account instead.)

Figure5-8 Identification setting

5.1.3. Set item in Windows9x
To use Windows 98 or Windows 95, please download DCOM98 or DCOM95 and DCOMCNFG98&95
from following URL according to OS, and install it in your computer.
< Microsoft COM technology-related file download>
http://www.microsoft.com/com/default.mspx(1) Start DCOMCNFG.EXE.
From the Start menu, on the [Run…] textbox, enter “DCOMCNFG" to start DCOMCNFG.EXE.
(2) Set the default properties
Set as follows.
ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide- 86 -

・ Authentication Level:

None・ Impersonation Level:

Identify.

(3) Set the default access right
Add the following access right.
・ World-Permit.
Because the DCOM98 of Windows 9x does not support remote start function, to set 9x-series computer as aserver, you need to start the program beforehand. To start not the CAO engine but provider DLL beforehand,with dllhost.exe, start the provider DLL by using command prompt as follows.
> dllhost.exe {<AppID>}

For instance, to start TCmini provider, write as follows.
> dllhost.exe {2c140adc-c109-43df-a059-c3b116257658}< AppID > has been described to the CaoProvController.RGS file of each provider source project. Also, GUI
of CaoProvExec tool which is supplied with ORiN2 SDK allows you to perform the same setting as above. For
information of how to use CaoProvExec, see "CAO provider development guide".

5.1.4. Set item in Windows XP(1) Start of DCOMCNFG
From the Start menu, from [Run…], enter “dcomcnfg" to start DCOMCNFG.EXE.

Figure5-9 Starting DCOMCNFG(2) Setting of My Computer
As the Figure5-10 shows, click [Component Services], click [Computer], click [My Computer], andthen right-click [Properties].
ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide- 87 -

Figure5-10 Set screen of DCOMCNFGAs Figure5-11 shows, select [Default Properties] tab.
Select [Enable Distributed COM on this computer].
Set [Default Authentication Level] to [None], and [Default Impersonation Level] to [Identify].

ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide- 88 -

Figure5-11 My Computer Properties

ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide- 89 -(3) Setting of each application
From the [Component Services], click [Computer], click [My Computer]. From [DCOM Config],
right-click [CAO], and then select [CAO Properties].

Figure5-12 DCOMCNFG DCOM structure setting window

ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide- 90 -

Select [General] tab. Set [Authentication Level] to [Default].

Figure5-13 Setting of each application (general)
Select [Location] tab. Select [Run application on this computer].

Figure5-14 Location setting of each application
ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide- 91 -

Select [Security] tab. On the [Launch and Activation Permissions] pane, select [Customize]. On the[Access Permissions] pane, select [Customize]. Click [Edit]

Figure5-15 Set security of each application
Click [Add…] button. Add [Everyone], [INTERACTIVE], and [SYSTEM], and then select [Local
access].

ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide- 92 -

Figure5-16 Security access permission for each application
Select [Identify] tab. Select [The interactive user].

Figure5-17 ID setting for each application
Perform this settings for CAO providers that you will use as well.

ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide- 93 -

5.1.5. Set item in Windows XP SP2
To establish strong security, security items (such as DCOM) of Windows XP Service Pack 2 (SP2) have been
reinforced and the firewall function is active in the default setting.
Therefore, it is impossible to access remote CAO provider.
5.1.5.1. Setting of Windows firewall
If the computer has been protected enough by the firewall or other securities, you can disable the Windows
firewall. When the firewall is disabled, CAO provider can be remotely used even if the following setting is not
done.

From the Start menu, click [Setting], click [Control Panel], and then click [Windows Firewall].

Figure5-18 Windows firewall setting

ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide- 94 -

5.1.5.2. Exception setting of firewall
From the Start menu, click [Setting], click [Control Panel], click [Windows Firewall]. Select [Exception] tab.

Figure5-19 Addition of exceptions

ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide- 95 -On the [Exceptions] tab, once [Add Program…] button is clicked, the following window appears (seeFigure5-20). Add the following programs. If there is no list exist on the Program pane, click [Browse..].
< Windows installation directory > ¥WINDOWS¥system32¥dllhost.exe

Figure5-20 Addition of exception program
On the [Windows Firewall] window, on the [Exceptions] tab, click [Add Port..] button.
Add a following port on the [Add a Port] window.
・ Name: DCOM・ Port number: 135

Figure5-21 Addition of exception port number

ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide- 96 -As shown in Figure5-22 , check that the [DCOM] and [dllhost.exe] checkbox are properly selected, and thenclick [OK] button. The security setting of the firewall is completed.

Figure5-22 Additional result of exception

5.1.5.3. Setting of DCOM
Perform the same settings as 5.1.4Set item in Windows XP.

5.1.6. Set confirmation of DCOM
To confirm the DCOM settings, perform the provider connection test remotely by using CaoTester, which is atest tool provided with ORiN2 SDK.
Please refer to the CaoTester user's guide for details.
In this time, DataStore provider is used as a remote connection destination provider. Perform "(3) Setting ofeach application" to the DataStore provider.

ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide- 97 -Start CaoTester with a computer on the client side. Add following items to the workspace child window asshown Figure5-23.
Controller Name:Enter any arbitrary character strings.

Provider Name:

CaoProv.DataStore

Machine Name:Enter the host name of the DCOM server.

Figure5-23 Remote provider connection by DCOM

ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide- 98 -

Click “Add" button of the workspace child window. Once the remote connection is successfully completed,[Succeeded] will be displayed in the log window (see Figure 5-24) that is on the left bottom side of CaoTester.
When the remote connection fails, [Failed...] will be displayed (see Figure5-25).

Figure 5-24 DCOM connection result (Succeed)

Figure5-25 DCOM connection result (Failed)

ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide- 99 -

5.2. Integration into Visual Studio
You can integrate ORiN2 SDK into Visual Studio for facilitating ORiN application development.
To

integrate

ORiN2

SDK

into

VisualStudio,double-click<ORiN

Install

Directory>¥Tools¥VSAddins¥Bin¥ORiN2AddIns.exe.
From the drop-down list box, select a version of Visual Studio that you want to integrate, and then click[Install] button (see Figure 5-26) to complete integration. To release the integration, click [Uninstall] button(see Figure 5-27).

Figure 5-26 Integrate into Visual Studio

Figure 5-27 Release the integration with Visual Studio
5.2.1. Visual Studio menu bar
Once the ORiN2 SDK is integrated into Visual Studio, ORiN2 menu will be added into the menu bar of
Visual Studio (see Figure 5-28). ORiN2 menu contains tools and documents provided by ORiN2 SDK. You
can easily call necessary tool or document by simply clicking these submenus.

ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide- 100 -

Figure 5-28 ORiN2 menu
5.2.2. CAO Provider Wizard
If your ORiN2 package is “ORiN2 SDK (Provider Development)”, then ORiN2 items will be added into a
new project of Visual Studio (see Figure 5-29). Select “ORiN2 CAO Provider Wizard”, and then click [OK]button to create a project for provider development. For detailed information about the provider development,see <ORiN install directory> ¥CAO¥Provider¥Doc¥ProviderDevGuide_en.pdf

Figure 5-29 CAO Provider Wizard

ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide- 101 -

6. CaoConfig
CaoConfig is a tool to change the operation setting of the CAO engine and the CAO provider. This tool can
set items like the priority of CAO engine, log output level, enable/disable each CAO provider, and CRD
redirection function.
Items set by CaoConfig are recorded in the registry.

6.1. Window layout
6.1.1. Menu
6.1.1.1. File Menu

Figure 6-1 CaoConfig File Menu
[Save]
Save the CaoConfig information in the registry.

[Reload]Information on CaoConfig is acquired from the registry.

[Import]Import CaoConfig settings from an XML file.

[Export]Export CaoConfig settings to an XML file.

[Exit]
Close CaoConfig.

ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide- 102 -

6.1.1.2. Action Menu

Figure 6-2 CaoConfig Action Menu
[Default Settings]
Set the selected item to the default setting.
When CaoEngine tab is selected, all items in CaoEngine tab will be set to the default settings.
When CaoProvider tab is selected, an item selected in the Provider List will be set to the default setting.

[Service Start]
Start the CAO service. This selection is available only when CAO is registered as a service.

[Service Stop]
Stop the CAO service. This selection is available only when CAO is registered as a service.

[Service Restart]
Restart the CAO service. This selection is available only when CAO is registered as a service.

6.1.1.3. Help Menu

Figure 6-3 CaoConfig Help Menu
[License]
Display the CAO license management window.

[Version]
Display the CaoConfig version information.

ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide- 103 -

6.1.2. Cao Engine tab
You can set CAO Engine operation settings from CaoEngine tab.

Figure6-4 Cao Engine tab[Process priority]
Set CAO engine process priority. The order of priority is as follows.
REAL TIME > HIGH > NORMAL > IDEL

[Local ID]
Set language ID to be used.

[Log type]
Select CAO.exe log output type. Following are possible log output type.

Table 6-1 Log typeOutput destination

Remarks

ConsoleOutput to console

Message Box

Output to a message box. (When service starts. )Event Viewer

Output to the event viewer. (When service starts. )Debug Viewer

Debug output.

Text File

Output to the specified text file.

ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide
SysLog- 104 Output to the SysLog server.

[Parameter]
Set the log output parameter.
Parameter differs depending on the log type.

Table 6-1 CaoEngine parameter
Log type

Parameter

Console(not used)

Message Box(not used)

Event Viewer(not used)

Debug Viewer(not used)

Text File

Text file path of the output destination
Example) C:¥CaoLog.txt

SysLog

SysLog server of the output destination
Conn=UDP:<IP address of SysLog server>
Example) Conn=UDP:192.168.0.1[Log level]
Set a log output level. (Logs being output will be higher level than the log level specified here.) Choose
desired log level from the five shown below. “FATAL” is the most critical, whereas “DEBUG” is the least
critical. The default setting is “INFO".
FATAL > ERROR > WARN > INFO > DEBUG[CAO Model] - Automatic registration of object
Set whether the Automatic object registration function of the Engine is enabled or disabled.
For detailed information about the Automatic object registration function, refer to 2.7.2.

[CRD file]Specify a CRD file path used in the Automatic object registration function.

ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide- 105 -

6.1.2.1. Cao Provider tab
You can set the operation setting for each provider on the CaoProvider tab.

Figure6-5 Cao Provider tab
Cao Provider tab contains following items.

[Provider list]
Display the list of the installed provider. To enable a provider, select a check box.
[Enable ] – Enable/Disable setting
Set availability of the provider. Selecting this checkbox enables the provider.
[Prog ID] – Program ID
Display the Program ID of the provider.
[CLSID] – Class ID
Display the Class ID of the provider.

[Locale ID]
Set the Locale ID of the provider.

[License]
Set the license of the provider.

ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide- 106 -

[Parameter]
Set the parameter of the provider.

[CRD file]
Set the path to the CRD file used at the CRD file switch function of each provider. For detailed
information, see 2.7.1.
[Writable (NOT read-only)] – Read-only setting
Selecting this checkbox will set the provider to Read-only.
[Bind to a ‘Commands’ collection] – Commands collection method dynamical addition function
Set whether the commands collection method dynamical addition function of CaoCommands is enabled or
disabled. For detailed information, see 2.7.3.
[Bind to a ‘Execute’ method] – Execute method dynamical addition function
Set whether the execute method dynamical addition function of CaoController::Execute is enabled or
disabled. For detailed information, see 2.7.3.

[Run as a local server (Dllhost)]
Run a provider on the different process (dllhost.exe) from CAO.

ORiN ForumDENSO WAVE Inc.

ORiN 2 programming guide- 107 -

Appendix A. Appendix
Appendix A.1. CAO engine function list


CaoEngine Object-engine
Class

CaoEngine

Property, method, andevent

Argument of function
Description

R/W

IN

OUT RETVAL

Remarks

EngineStatus

P

Acquisition of engine statu
s objectR

Object: IcaoEngineStatus(class number: 0) Workspaces

P

Acquisition of workspacecollection
Addition of workspace obj
ectExecution of enhancing co
mmand

R

Collection: ICaoWorkspaces
Object: ICaoWorkspace
The same function as CaoWorkspaces::Add().

AddWorkspace

M

ExecuteM

Meaning of a sy M:Method
mbol
P:Property
E:Event

S

Workspace name: BSTR,[Option:BSTR]
S Command:BSTR
Result: VARIANT
For function expansion (reserved)[Parameter:VARIANT](note ･ Arguments enclosed by square brackets [] can be1)omitted.
･ The default value of BSTR type data’s omittableargument is NULL.
･The default value of Numeric type data’s omittableargument is 0.
･The default value of VARIANT type data’s omittableargument is VT_ERROR.

(note 1)The value of a symbol is as follows. Only the method and the property of W attribute are influenced from ON/OFF of the Access restriction function of CAO engine(writing restriction function).
R-Read: Read the status and the configuration of the controller or the provider or the engine.
W-Write: Change the controller's status and configuration. However, Execute method is classified as S attribute because Execute method depends on the content of the comman
d. The writing restriction is implemented in the provider, if necessary.
S-Setup: Change the provider or the status of the engine and the configuration.

ORiN conference

DENSO WAVE Inc.

ORiN 2 programming guide- 108 -

CaoWorkspace(s) Object-workspaceClass

CaoWorkspaces

Property, method, and
event
Count

P

(class number: 1) Add

M

Clear

M

IsMember

M

Item

M

RemoveM

Controllers

P

CaoWorkspace(class number: 2) Index

P

Name

P

ProviderNames

P

AddController

M

ExecuteM

ORiN conference

Argument of function
Description

R/W

Acquisition of number ofcollections
Addition of workspace obj
ectR

Release of all workspace
objects
Registration confirmation of workspace object
Acquisition of workspace
objectOpening of workspace obj
ectAcquisition of controller collection
Acquisition of workspace
numberAcquisition of workspace
nameAcquisition of provider na
me list

S

S

R
R
S
R

IN

Workspace name:BSTR,[Option:BSTR]

Remarks

OUT RETVAL

Number of collections: Long
Object: ICaoWorkspace
The workspace name is any character string.
When the workspace name is omitted (NULL
specification), a unique name is automaticallygiven.

Workspace name/Number:V Check result: VARIANT_B
ARIANT
OOL
Workspace name/Number:V Object: ICaoWorkspace
Default member
ARIANT
Workspace name/Number:V
ARIANT
Collection: ICaoControllers

R

Workspace number: Long

R

Workspace name: BSTR

R

[Option:BSTR]

Provider name list: VARI Example of options : Filter condition..
ANT(VT_VARIANT|VT_A
RRAY)

Addition of controller obje
ct

SController-name:BSTR,
Provider name:BSTR,[Machine name:BSTR,[Option:BSTR]]

Object: ICaoController

The same function as CaoControllers::Add().

Execution of enhancing co
mmand

S

Command:BSTR[Parameter:VARIANT]

Result: VARIANT

For function expansion (reserved)

DENSO WAVE Inc.

ORiN 2 programming guide

Class

Property, method, andevent

Value of a symb M:Methodol
P:Property
E:Event

ORiN conference- 109 Argument of function
Description

R/W

IN

OUT RETVAL

Remarks･Arguments enclosed with square brackets [] can beomitted.
･The default value of BSTR type data’s omittable argument is NULL.
･The default value of Numeric type data’s omittableargument is 0.
・The default value of VARIANT type data’s omittabl
e argument is VT_ERROR.

DENSO WAVE Inc.

ORiN 2 programming guide- 110 -

CaoController(s) Object-controller
Class

CaoControllers

Property, method, and
event
Count

P

(class number: 3) Add

M

Clear

M

IsMember

M

Item

M

RemoveM

CaoController
Attribute(class number: 4) CommandNames

P
PCommands

P

ExtensionNames

P

Extensions

P

FileNames

P

Files

P

ORiN conference

Argument of function
Explanation

R/W

Acquisition of number ofcollections
Addition of controller obje
ctR

Release of all controller objectsRegistration confirmation i
ntended for controller
Acquisition of controller object
Opening of controller obje
ctAcquisition of attribute
Acquisition of expansion board name list

S

S

R

IN

Controller-name:BSTR,
Provider name:BSTR,[Machine name:BSTR],[Option:BSTR]

OUT RETVAL

Remarks

Number of collections: Long
Object: ICaoController
Controller-name is any character string.
Example of option: Time-out value, Event per
missionEvent permission: @EventEnable[=True/False]
Default value is "True"

Acquisition of command collection
Acquisition of command n
ame list

R

Controller-name/Number:V Check result: VARIANT_B
ARIANT
OOL
Controller-name/Number:V Object: ICaoController
Default member
ARIANT
Controller-name/Number:V
ARIANT
Attribute: Long
Command name list: VAR Example of option : Filter condition[Option：BSTR]
IANT(VT_VARIANT|VT_
ARRAY)
Collection: ICaoCommands

R[Option:BSTR]

Acquisition of expansion board collection
Acquisition of file name li
stR

Acquisition of file collecti

R

R
S
R
R

R

Expansion board name lis Example of option : Filter condition
t: VARIANT(VT_VARIAN
T|VT_ARRAY)
Collection: ICaoExtensions[Option:BSTR]

File name list: VARIANT Example of option : Filter condition(VT_VARIANT|VT_ARRA
Y)
Collection: ICaoFiles

File collection of root directory.

DENSO WAVE Inc.

ORiN 2 programming guideClass- 111 Argument of function

Property, method, and
event
Help

P

ID
Index

P
P

Name

P

RobotNames

P

RobotsP

Tag
TaskNames

P
P

Tasks

P

VariableNames

P

Variables

P

AddCommandM

AddExtension

M

AddFileAddRobot

ORiN conference

Explanation
on
Help

R/W

IN

R

ID
R/W ID:VARIANT
Acquisition of controller n R
umber
Acquisition of controller n R
ame
Acquisition of robot name R [Option:BSTR]list

OUT RETVAL
Help character string: BSTR
ID:VARIANT
Controller number: Long
Controller name: BSTR

Robot name list: VARIAN Example of option : Filter condition
T(VT_VARIANT|VT_ARR
AY)

Acquisition of robot collec R
tion
Tag
R/S Tag data:VARIANT
Acquisition of task name l R [Option:BSTR]
ist

Collection: ICaoRobots

Acquisition of task collection
Acquisition of Variable na
me listR

Collection: ICaoTasks

R

M

Acquisition of variable collection
Addition of command obje
ctAddition of expansion boa
rd object
Addition of file object

M

Addition of robot object

S

R

S
S
S

[Option:BSTR]

Remarks

Tag data: VARIANT
Task name list: VARIANT Example of option : Filter condition(VT_VARIANT|VT_ARRAY)Variable name list: VARIA Example of option : Filter condition
NT(VT_VARIANT|VT_AR
RAY)
Collection: ICaoVariables

Command name:BSTR,
Object: ICaoCommand[Option:BSTR]
Expansion board name:BS Object: ICaoExtension
TR,[Option:BSTR]
File name:BSTR,
Object: ICaoFile[Option:BSTR]
Robot name:BSTR,
Object: ICaoRobot[Option:BSTR]

The same function as CaoCommands::Add().
The same function as CaoExtensions::Add().
The same function as CaoFiles::Add().
The same function as CaoRobots::Add().

DENSO WAVE Inc.

ORiN 2 programming guideClass- 112 -

Property, method, andevent

Argument of function
Explanation

R/W

AddTask

M

Addition of task object

S

AddVariable

M

Addition of variable object

S

ExecuteM

S

GetMessage

M

Execution of enhancing co
mmand
Acquisition of message

R

OnMessage

E

Message reception event

R

Value of a symb M:Methodol
P:Property
E:Event

ORiN conferenceIN
Task name:BSTR,[Option:BSTR]
Variable name:BSTR,[Option:BSTR]
Command:BSTR[Parameter:VARIANT]OUT RETVAL

Remarks

Object: ICaoTask

The same function as CaoTasks::Add().

Object: ICaoVariable

The same function as CaoVariables::Add().

Result: VARIANT

For function expansion

Message: ICaoMessage

The message is acquired from the message queue in the engine. Message can be acquired only when the OnMessage event function is invalid.
･This realizes the following call.
[Provider(controller)]→[Engine]→[Client]- A negative range of the message number has been reserved with ORiN.
- The nullification of the event is specified by
the option of AddController().

Message:ICaoMessage･Arguments enclosed with square brackets [] can beomitted.
･The default value of BSTR type data’s omittable argument is NULL.
･The default value of Numeric type data’s omittableargument is 0.
･The default value of VARIANT type data’s omittabl
e argument is VT_ERROR.

DENSO WAVE Inc.

ORiN 2 programming guide- 113 -

CaoExtension(s) Object-expansion board
Class

CaoExtensions

Property, method, and
event
Count

P

(class number: 5) Add

M

Clear

M

IsMember

M

Item

M

RemoveM

CaoExtension
Attribute(class number: 6) Help

P
P

ID
Index

P
P

Name

P

Tag
VariableNames

P
P

VariablesP

AddVariableM

ExecuteM

Value of a symb M:Method

ORiN conference

Argument of function
Explanation

R/W

Acquisition of number ofcollections
Addition of expansion boa
rd object

R

Release of all expansion board objects
Registration confirmation of expansion board object
Acquisition of expansion board object
Opening of expansion boar
d objectAcquisition of attribute
Help

S

S

IN

OUT RETVAL

Remarks

Number of collections: LongExpansion board name:BS Object: ICaoExtension
TR,[Option:BSTR]

R

Expansion board name/Nu Check result: VARIANT_B
mber:VARIANTOOLR Expansion board name/Nu Object: ICaoExtension
Default member
mber:VARIANTS Expansion board name/Nu
mber:VARIANT
R
Attribute: Long
R
Help character string: BST
R
ID
R/W ID:VARIANT
ID:VARIANT
Acquisition of expansion b R
Expansion board number:oard number
Long
Acquisition of expansion b R
Expansion board name: B
oard name
STR
Tag
R/S Tag data:VARIANT
Tag data: VARIANT
Acquisition of Variable na R [Option:BSTR]
Variable name list: VARIA Example of option : Filter condition
me listNT(VT_VARIANT|VT_AR
RAY)
Acquisition of variable collection
Addition of variable object

R

Execution of enhancing co
mmand

S

S

Collection: ICaoVariables
Variable name:BSTR,
Object: ICaoVariable
The same function as CaoVariables::Add().
[Option:BSTR]
Command:BSTR
Result: VARIANT
For function expansion[Parameter:VARIANT]･Arguments enclosed with square brackets [] can be

DENSO WAVE Inc.

ORiN 2 programming guide

Class

Property, method, and
event

ol
P:Property
E:Event

ORiN conference- 114 Argument of function
Explanation

R/W

IN

OUT RETVAL

Remarks

omitted.
･The default value of BSTR type data’s omittable argument is NULL.
･The default value of Numeric type data’s omittableargument is 0.
･The default value of VARIANT type data’s omittabl
e argument is VT_ERROR.

DENSO WAVE Inc.

ORiN 2 programming guide- 115 -

CaoFile(s) Object-fileClass

CaoFilesProperty, method, and
event
Count

R/W
R

IN

OUT RETVAL(class number: 7) Add

M

Acquisition of number ofcollections
Addition of file object

Clear

M

Release of all file objects

S

IsMember

M

R

Item

M

Registration confirmation of file object
Acquisition of file object

RemoveM

Opening of file object

S

P
P
P

Acquisition of attribute
At the date
The final access date

R
R
R

P

The final change date

R

P

Acquisition of file name li
st

R

Files

P

R

Collection: ICaoFiles

Help

P

Acquisition of file collecti
on
Help

R

ID
Index
Name

P
P
P

ID
R/W ID:VARIANT
Acquisition of file number
R
Acquisition of file nameR

Help character string: BSTR
ID:VARIANT
File number: Long
File name: BSTR

CaoFileAttribute(class number: 8) DateCreated
DateLastAccessed
DateLastModifiedFileNames

ORiN conferenceP

Argument of function
Explanation

S

R

File name:BSTR,[Option:BSTR]

Remarks

Number of collections: Long
Object: ICaoFile
File creation: @Create = numerical value defa
ult value is 0
0 : create a file
Other than 0 : not create a file
When the provider is read-only, if @Create isother than 0, a writing error occurs.

File name/Number:VARIA Check result: VARIANT_B
NT
OOL
File name/Number:VARIA Object: ICaoFile
Default member
NT
File name/Number:VARIA
NT
Attribute: LongAt the date: VARIANT.
The final access date: VA
RIANT
The final change date: VA
RIANT[Option:BSTR]
File name list: VARIANT Example of option : Filter condition(VT_VARIANT|VT_ARRA When the attribute is a directory, the child filY)e name list is returned.

DENSO WAVE Inc.

ORiN 2 programming guideClass- 116 Argument of function

Property, method, andevent

Explanation

R/W
R

IN

OUT RETVAL

Path

P

Acquisition of path

Size
Tag
Type
Value
VariableNames

P
P
P
P
P

Acquisition of size of file
R
Tag
R/S Tag data:VARIANT
Acquisition of type of fileR
Content of file
R/W Data:VARIANT
Acquisition of Variable na R [Option:BSTR]
me listSize of file: Long
Tag data: VARIANT
File type: BSTR
Data: VARIANT
Default member
Variable name list: VARIA Example of option : Filter condition
NT(VT_VARIANT|VT_AR
RAY)

Variables

P

R

Collection: ICaoVariables

AddFileM

Acquisition of variable collection
Addition of file object

AddVariable

M

Addition of variable object

S

Copy

M

Copy

W

DeleteExecute

M
M

W
S

Move

M

Deletion
Execution of enhancing co
mmand
Movement

M

Task creation

W

Run
Value of a symb M:Methodol
P:Property
E:Event

ORiN conference

S

W

Path name: BSTR

Remarks
Absolute path. The file name is not included.
The last delimiter is included.

File name:BSTR,
Object: ICaoFile
The same function as CaoFiles::Add().
[Option:BSTR]
Variable name:BSTR,
Object: ICaoVariable
The same function as CaoVariables::Add().
[Option:BSTR]
Copy destination file nam
e:BSTR[Option:BSTR][Option:BSTR]
Command:BSTR
Result: VARIANT
For function expansion[Parameter:VARIANT]
Moving destination file na
me:BSTR[Option:BSTR][Option:BSTR]
Task name: BSTR
･Arguments enclosed with square brackets [] can beomitted.
･The default value of BSTR type data’s omittable argument is NULL.
･The default value of Numeric type data’s omittableargument is 0.
･The default value of VARIANT type data’s omittabl
e argument is VT_ERROR.

DENSO WAVE Inc.

ORiN 2 programming guide

ORiN conference- 117 -DENSO WAVE Inc.

ORiN 2 programming guide- 118 -

CaoRobot(s) Object-robot
Class

CaoRobots

Property, method, and
event
Count

P

(class number: 9) Add

M

Clear

M

IsMember

M

Item

M

RemoveM

CaoRobot
Attribute(class number: 1 Help
0)
ID
Index

P
P
P
P

Name

P

Tag
VariableNames

P
P

VariablesP

Accelerate

M

ORiN conference

Argument of function
Explanation

R/W

Acquisition of number ofcollections
Addition of robot object

R

Release of all robot objects
Registration confirmation of robot object
Acquisition of robot object

S

S

IN

Robot name:BSTR,[Option:BSTR]

OUT RETVAL

Remarks

Number of collections: Long
Object: ICaoRobot

Robot name/Number:VARI Check result: VARIANT_B
ANTOOL
R Robot name/Number:VARI Object: ICaoRobot
Default member
ANT
Opening of robot object
S Robot name/Number:VARI
ANT
Acquisition of attribute
R
Attribute: Long
Help
R
Help character string: BST
R
ID
R/W ID:VARIANT
ID:VARIANT
Acquisition of robot numb R
Robot number: Longer
Acquisition of CaoRobot n R
Robot name: BSTR
ame
Tag
R/S Tag data:VARIANT
Tag data: VARIANT
Acquisition of Variable na R [Option:BSTR]
Variable name list: VARIA Example of option : Filter condition
me listNT(VT_VARIANT|VT_AR
RAY)
Acquisition of variable collectionRefer to the specificationof the ACCEL sentence of
SLIM.

R

R
W

Collection: ICaoVariables
Axis Number:long,
Acceleration:float,[Deceleration:float]

Axis number
1: Acceleration/Deceleration of tool end.
0: Acceleration/Deceleration of all axis
Other number: Acceleration/Deceleration of spe
cified axis.

DENSO WAVE Inc.

ORiN 2 programming guideClass- 119 -

Property, method, andevent

Argument of function
Explanation

R/W

IN

AddVariable

M

Addition of variable object

S

Change

M

W

Chuck

M

W

[Option:BSTR]

Drive

M

Refer to the specificationof the CHANGE sentenceof SLIM.
Refer to the specificationof the GRASP sentence of
SLIM.
Refer to the specificationof the DRIVE sentence of
SLIM.

Variable name: BSTR,[Option:BSTR]
Hand name: BSTR

W

Axis Number: long,
Motion distance: float,[Motion option: BSTR]

ExecuteM

S

GoHomeM

W

Command: BSTR
[Parameter:VARIANT][Option:BSTR]

Hold

M

Execution of enhancing co
mmand
Refer to the specificationof the GOHOME sentenceof SLIM.
Refer to the specificationof the HOLD sentence of
SLIM.

W

[Option:BSTR]

Halt

M

Refer to the specificationof the HALT sentence of
SLIM.

W

[Option:BSTR]

Move

M

Refer to the specificationof the MOVE sentence of
SLIM.

W

Interpolation specification:
long,
Posed row:VARIANT,[Motion option:BSTR]

ORiN conference

OUT RETVAL
Object: ICaoVariable

Remarks
The same function as CaoVariables::Add().

It is impossible to move multiple axis at thesame time, just like SLIM does. In that case,
MOVE is recommended to be used.
Result: VARIANT

For function expansion

In SLIM, this sentence means “suspend of rob
ot program”. In CAO, this command means“suspend of robot motion”.

In SLIM, this sentence means “force stop of r
obot program”. In CAO, this command means“force stop of robot motion”.

Interpolation specification
1: PTP
2: Linear
3: Circular- Pose specification depends on the manufactu
rer’s specification. Array is used for the circul
ar interpolation specification. Default value ofmotion option is "".

DENSO WAVE Inc.

ORiN 2 programming guideClass- 120 -

Property, method, andevent

Argument of function
Explanation

R/W

IN

RotateM

Refer to the specificationof the ROTATE sentenceof SLIM.

W

Speed

M

Refer to the specificationof the SPEED/JSPEED se
ntence of SLIM.

W

Unchuck

M

W[Option: BSTR]

UnholdM

Refer to the specificationof the RELEASE sentenceof SLIM.
Refer to the specificationof the HOLD sentence of
SLIM.

W

[Option: BSTR]

Value of a symb M:Methodol
P:Property
E:Event

ORiN conference

OUT RETVAL

Rotation surface: VARIAN
T,
Angle:float,
Rotation center:VARIANT,[Motion option: BSTR]
Axis Number: long,
Speed: float

Remarks
Rotation surface specification depends on the
manufacturer’s specification.

Axis number
1: Speed of tool end
0: All axis speeds
Other number: Specified axis speed.
“Release” of SLIM cannot be used because it
is a reserved word. Therefore, use Chuck/Un
chuck instead.
Since the Hold sentence of SLIM means “suspend of program”, there is no command for r
esume. In CAO, HOLD command means “suspend of robot motion”. “Unhold” is used to r
esume the robot motion suspended by HOLD
command.

･Arguments enclosed with square brackets [] can beomitted.
･The default value of BSTR type data’s omittable argument is NULL.
･The default value of Numeric type data’s omittableargument is 0.
･The default value of VARIANT type data’s omittabl
e argument is VT_ERROR.

DENSO WAVE Inc.

ORiN 2 programming guide- 121 -

CaoTask(s) Object-task
Class

CaoTasks

Property, method, and
event
Count

(class number: 1 Add
1)Clear
IsMember

P
M
M
M

Argument of function
Explanation

R/W

Acquisition of number ofcollections
Addition of task object

R

S
R

S

Item

M

Release of all task objects
Registration confirmation of task object
Acquisition of task object

RemoveM

Opening of task object

S

CaoTask
Attribute(class number: 1 FileName
2)
Help

P
P

Acquisition of attribute
Acquisition of correspondence file name
Help

R
R

P

ID
Index

P
P

Name
Tag
VariableNames

PPP

VariablesP

AddVariable

M

DeleteExecuteM
M

ORiN conferenceR

IN

Task name: BSTR,[Option:BSTR]

ID
R/W ID:VARIANT
Acquisition of task numbe RrAcquisition of task name
R
Tag
R/S Tag data: VARIANT
Acquisition of Variable na R [Option:BSTR]
me listR

Deletion of task
Execution of enhancing co
mmand

W
S

S

Number of collections: Long
Object: ICaoTask

Task name/Number: VARI Check result: VARIANT_B
ANTOOL
Task name/Number: VARI Object: ICaoTask
Default member
ANT
Task name/Number: VARI
ANT
Attribute: Long
File name: BSTR

R

Acquisition of variable collection
Addition of variable object

Remarks

OUT RETVAL

Variable name: BSTR,[Option:BSTR][Option:BSTR]
Command: BSTR
[Parameter: VARIANT]

Help character string: BSTR
ID:VARIANT
Task number: Long
Task name: BSTR
Tag data: VARIANT
Variable name list: VARIA Example of option : Filter condition
NT(VT_VARIANT|VT_AR
RAY)
Collection: ICaoVariables
Object: ICaoVariable

The same function as CaoVariables::Add().

Result: VARIANT

For function expansion

DENSO WAVE Inc.

ORiN 2 programming guideClass- 122 -

Property, method, andevent

Argument of function
Explanation

R/W

IN

Start

M

Beginning of taskW

Mode: long,[Option:BSTR]

Stop

M

Stop of taskW

Mode: long,[Option:BSTR]

Value of a symb M:Methodol
P:Property
E:Event

ORiN conference

OUT RETVAL

RemarksMode
1: One-cycle execution
2: Continuous execution
3: One-step forward
4: One-step backExample of option: Start position
Mode
0: Default stop
1: Instantaneous stop
2: Step-stop
3: Cycle-stop
4: Initialization stop
(note) Default stop is any stop of above 1 to
4 stop.

･Arguments enclosed with square brackets [] can beomitted.
･The default value of BSTR type data’s omittable argument is NULL.
･The default value of Numeric type data’s omittableargument is 0.
･The default value of VARIANT type data’s omittabl
e argument is VT_ERROR.

DENSO WAVE Inc.

ORiN 2 programming guide- 123 -

CaoVariable(s) Object-variable
Class

CaoVariables

Property, method, and
event
Count

P

(class number: 1 Add
3)
Clear

M
M

IsMember

M

Item

M

RemoveM

CaoVariable
Attribute(class number: 1 DateTime
4)
Help

P
P
P

ID
Index

P
P

Microsecond

P

Name

P

Tag
Value
Value of a symb M:Methodol
P:Property
E:Event

ORiN conference

P
P

Argument of function
Explanation

R/W

Acquisition of number ofcollections
Addition of variable object

R

Release of all variable obj
ects
Registration confirmation of variable object
Acquisition of variable obj
ectOpening of variable object

S

S

IN

Variable name: BSTR,[Option:BSTR]

OUT RETVAL

Remarks

Number of collections: Long
Object: ICaoVariable

R

Variable name/Number:VA Check result: VARIANT_B
RIANT
OOL
R Variable name/Number:VA Object: ICaoVariable
Default member
RIANT
S Variable name/Number:VA
RIANT
Acquisition of attribute
R
Attribute: Long
Acquisition of time and d R
Time and date stamp: VA
ate stamp (date)
RIANT
Help
R
Help character string: BST
R
ID
R/W ID:VARIANT
ID:VARIANT
Acquisition of variable nu R
Variable number: Long
mber
Acquisition of time and d R
Time and date stamp: Lon
ate stamp (microsecond)g
Acquisition of Variable na R
Variable name: BSTR
The system Variable name starts by @.
me
Tag
R/S Tag data:VARIANT
Tag data: VARIANT
Acquisition of value
R/W Value:VARIANT
Value:VARIANT
Default member･Arguments enclosed with square brackets [] can beomitted.
･The default value of BSTR type data’s omittable argument is NULL.
･The default value of Numeric type data’s omittableargument is 0.

DENSO WAVE Inc.

ORiN 2 programming guide

Class

Property, method, andevent- 124 Argument of function
Explanation

R/W

IN

OUT RETVAL

Remarks･The default value of VARIANT type data’s omittabl
e argument is VT_ERROR.

ORiN conference

DENSO WAVE Inc.

ORiN 2 programming guide- 125 -

CaoCommand(s) Object-command
Class

CaoCommands

Property, method, and
event
Count

P

(class number: 1 Add
5)
Clear

M
M

IsMember

M

Item

M

RemoveM

ExecuteComplete
CaoCommand
Attribute(class number: 1 Help
6)
ID
Index

E
P
P
P
P

Name

P

Parameters

P

Result

P

State

P

Tag
Timeout
CancelP
P
M

ORiN conference

Argument of function
Explanation

R/W

Acquisition of number ofcollections
Addition of command obje
ct
Release of all command objectsRegistration confirmation o
f command object
Acquisition of command object
Opening of command obje
ctCommand execution compl
etion event
Acquisition of attribute
Help

R
S

IN

Command name: BSTR,[Option:BSTR]

OUT RETVAL

Remarks

Number of collections: Long
Object: ICaoCommand

S
R
R
S

R
R

Command name/Number: Check result: VARIANT_B
VARIANTOOL
Command name/Number: Object: ICaoCommand
Default member
VARIANT
Command name/Number:
VARIANT
Command number: Long The result is acquired in the Result property.
Attribute: Long
Help character string: BSTR
ID:VARIANT
Command number: LongID
R/W ID:VARIANT
Acquisition of command n R
umber
Acquisition of command n R
Command name: BSTR
ame
Command parameter
R/W Command parameter: VAR Command parameter: VAR
IANT
IANT
Execution result of Execut R
Execution result: VARIANe() immediately beforeT
Acquisition of state
R
State: Long
The first bit in state
0: Waiting
1: Processing
Other bits: depend on the provider used.
Tag
R/S Tag data: VARIANT
Tag data: VARIANT
Time-out
R/W Time-out: long
Time-out: Long
Cancellation of processing

DENSO WAVE Inc.

ORiN 2 programming guideClass- 126 -

Property, method, andevent
ExecuteValue of a symb M:Methodol
P:Property
E:Event

ORiN conference

M

Argument of function
Explanationcommand
Execution of command

R/W

IN

OUT RETVAL

Mode: long

RemarksMode
0: Synchronous execution
1: Asynchronous execution. In asynchronous e
xecution, S_FALSE is returned.

･Arguments enclosed with square brackets [] can beomitted.
･The default value of BSTR type data’s omittable argument is NULL.
･The default value of Numeric type data’s omittableargument is 0.

DENSO WAVE Inc.

ORiN 2 programming guide- 127 -

CaoMessage Object-message
Class

Property, method, and event

Explanation

DateTime
P Creation date
CaoMessage(class number: 17) Description P Explanation
Destination P Destination address
NumberP Message number
SerialNumbe P Message sequential numberr

Source
Value
Clear
Reply
Value of a symbol M:Method
P:Property
E:Event

ORiN conference

P Sending origin
P Message text
M Clearness of message
M Reply of message

R/W
R
R
R
R
R

IN

Argument of function
OUT RETVALCreation date: VARIANT.
Explanation: BSTR
Destination address: BSTR
Message number: Long
Message sequential number: Long

Remarks

Sequential number which is automatically add
ed to Engine ranging from 0 to “LONG_MA
X”. When it reaches LONG_MAX, it is clear
ed to 0.

R
Message text: VARIANT
R
Message text: VARIANT
W
W(note 1) ･Arguments enclosed with square brackets [] can be omitted.
･The default value of BSTR type data’s omittable argument is
NULL.
･The default value of Numeric type data’s omittable argument
is 0.

DENSO WAVE Inc.

ORiN 2 programming guide- 128 -

CaoEngineStatus Object-engine status
Class

Property, method,and event

Explanation

CaoEngineStatus CurrentDateTime P Current date(class number: 18) ComputerName P Computer nameObjectCounts
P Number of objects of each class
StartDateTime
ValuesVersionValue of a symbol M:Method
P:Property
E:Event

ORiN conference

P Beginning date
P (reserved for the future)
P Acquisition of version of Engine

R/W
R
R
R
R
R

Argument of functionIN

OUT RETVALClass name/number: VARIANT

Current date: VARIANT
Computer name: BSTR
Number of objects: Long

Status name/number: VARIANT

Beginning date: VARIANT
Data: VARIANT

Remarks

R
Version: BSTR
<Major Ver.>.<Minor Ver.>.<Revision>(note 1) ･Arguments enclosed with square brackets [] can be omitted.
･The default value of BSTR type data’s omittable argument is
NULL.
･The default value of Numeric type data’s omittable argument is
0.

DENSO WAVE Inc.

ORiN 2 programming guide- 129 -

Appendix A.2. Glossary

CAO (Controller Access Object)
CAO is "Standard program interface" that offers a common interface and the function to the client
application and the robot controller.



CAO interface (CAO Interface)(API)An interface of the client application side. This enables client application to handle a robot controller
provided by CAO. “CAO API” indicates this interface.



CAO engine(CAO Engine)
A common function to the CAO provider and the CAO interface are offered to the client with the CAO
engine by middleware (EXE) that mounts the interface of CAO. A common function to the CAO provider
includes the collection function, the message output, and the CRD switch function, etc.



CAO provider(CAO Provider)
CAO provider is DLL where the part that depended on the robot makers is mounted by the subordinate
position module of CAO.



CAO provider template(CAO Provider template)
C++ template that supports mounting CAO Provider. This template is generated with ProviderWizard
automatically.



CAP(Controller Access Protocol)
It is "Communication protocol for the Internet" to access CAO provider by way of the Internet. In CAP,
the message to access the CAO provider that uses SOAP is defined.

CAP provider(CAP Provider)
It is CAO provider to generate, and to send and receive the CAP message.



CAP listener(CAP Listener)
The CAP message is received, and the server to operate CAO on a remote machine program.



CAP message(CAP Message)
SOAP message defined by CAP.

CRD (Controller Resource Definition)
Data schema that defines the data general-purpose to express resource information on a robot different
depending on the maker and the model format.



CRD resource(CRD Resource)
A robot resource expressed by CRD.

ORiN conference

DENSO WAVE Inc.

ORiN 2 programming guide- 130 -CRD data(CRD Data)
CRD-based robot resource data that is written in XML.

CRD Dataskema(CRD Data Schema)
A schema that defines the format of the CRD data.



CRD file(CRD File)An XML file where the CRD data is described.



CRD provider(CRD Provider)
A provider to access the CRD data.

RAC (Robot Action Command)
An integrated robot language that send and receive commands between the client application and therobot.

ORiN conference

DENSO WAVE Inc.