OSDK Type Library
OSDK Type Library
Version 6.1
JANUARY 2020
Disclaimer of Warranties and Liability
The information contained in this publication is believed to be accurate and reliable. However, General Electric
Company assumes no responsibilities for any errors, omissions or inaccuracies. Information contained in the pub-
lication is subject to change without notice.
No part of this publication may be reproduced in any form, or stored in a database or retrieval system, or trans-
mitted or distributed in any form by any means, electronic, mechanical photocopying, recording or otherwise,
without the prior written permission of General Electric Company. Information contained herein is subject to
change without notice.
Trademark Notices
© 2020, General Electric Company. All rights reserved.
* Indicates a trademark of General Electric Company and/or its subsidiaries.
All other product names and marks identified throughout this book are trademarks or registered trademarks of
their respective companies. They are used throughout this book in editorial fashion only. No such use, or the use
of any trade name, is intended to convey endorsement or affiliation.
No part of this publication may be reproduced in any form, or stored in a database or retrieval system, or trans-
mitted or distributed in any form by any means, electronic, mechanical photocopying, recording or otherwise,
without the prior written permission of GE. Information contained herein is subject to change without notice.
We want to hear from you. If you have any comments, questions, or suggestions about our documentation, send
them to the following email address:
[email protected]
Table of Contents
Method Summary 1
AddChannel Method 2
Syntax 2
Remarks 2
AddDatablock Method 2
Syntax 2
Remarks 3
Syntax 3
Remarks 3
CopyDevice Method 4
Syntax 4
Settings 4
DebugMessage Method 4
Syntax 5
ErrorMessage Method 5
Syntax 5
FileNew Method 5
Syntax 5
FileOpen Method 6
Syntax 6
Remarks 6
FileSave Method 6
Syntax 6
FileSaveAs Method 6
Syntax 6
Remarks 7
GetChannels Method 7
Remarks 7
GetDataBlocks Method 7
Syntax 7
Remarks 8
GetDevices Method 8
Syntax 8
Remarks 8
GetNameSpace Method 8
Syntax 9
Settings 9
GetProperties Method 9
Syntax 9
Settings 10
Remarks 10
GetPropertyData Method 10
Syntax 10
Remarks 11
InfoMessage Method 11
Syntax 11
IsBrowseSupported Method 11
Syntax 11
Settings 11
Poll Method 12
Syntax 12
Remarks 12
Quit Method 12
Syntax 12
Remarks 12
ReadData Method 12
Syntax 13
Remarks 14
RemoveChannel Method 14
Syntax 15
RemoveDataBlock Method 15
Syntax 15
RemoveDevice Method 15
Syntax 15
SetPropertyData Method 16
Syntax 16
Remarks 16
Start Method 16
Syntax 16
Stop Method 17
Syntax 17
Switch Method 17
Syntax 17
WarnMessage Method 17
Syntax 17
WriteData Method 18
Syntax 18
Settings 18
Remarks 19
Property Summary 19
Application Property 20
Syntax 20
ConfigFileName Property 20
Syntax 20
ConfigFilePath Property 20
Syntax 20
DefaultConfigFileName Property 21
DefaultConfigFilePath Property 21
Syntax 21
FileSaved Property 21
Syntax 21
FullConfigFileName Property 22
Syntax 22
FullDefaultConfigFileName Property 22
Syntax 22
FullName Property 22
Syntax 22
Name Property 23
Syntax 23
Path Property 23
Syntax 23
Running Property 23
Syntax 23
Visible Property 23
Syntax 24
Settings 24
Example Summary 24
StopMethod Example 46
Example 49
IBrowseOPCServer Interface 49
IDriver Message 49
Sample Application 49
Index 57
The OSDK Type Library Reference is intended for programmers who are proficient in the Microsoft®
Visual Basic® programming language.
The following sections provide more details on how to use the methods and properties associated with
the OSDK Type Library.
n Method Summary
n Property Summary
n Obtaining an Interface Pointer to the Server Object
n OPC Client Only
Method Summary
The following list contains the OSDK Type Library methods that are available.
AddChannel
AddDataBlock
AddDevice
CopyDevice
DebugMessage
ErrorMessage
FileNew
FileOpen
FileSave
FileSaveAs
GetChannels
GetDevices
GetDatablocks
GetNameSpace
GetProperties
GetPropertyData
InfoMessage
IsBrowseSupported
Poll
Quit
ReadData
RemoveChannel
AddChannel Method
Adds a channel object to the server configuration, optionally setting channel properties.
Syntax
Handle = object.AddChannel Properties PropertyData Errors
The AddChannel method syntax has these parts:
Part Description
Handle A long integer value specifying the channel object handle assigned by
the server.
Remarks
Any channel properties not specified will be set to a default value.
AddDatablock Method
Adds a datablock to the specified device's configuration, optionally setting datablock properties.
Syntax
Handle = object.AddDataBlock DeviceHandleProperties PropertyData Errors
The AddDataBlock method syntax has these parts:
Remarks
Any datablock properties not specified will be set to a default value.
Returns the path specification for the application's executable file. Read only.
Syntax
Handle = object.AddDevice ChannelHandleProperties PropertyData Errors
The AddDevice method syntax has these parts:
Part Description
Handle A long integer value specifying the channel object handle assigned
by the server.
Remarks
Any device properties not specified will be set to a default value.
Syntax
Error=object.CopyDevice DeviceHandle, bstrName, ChannelHandlebMove
The CopyDevice method syntax has these parts:
Part Description
Error A long integer value specifying success or failure.
DeviceHandle A long integer expression specifying the handle of the device to copy
or move.
bstrName A string expression that specifies the name of the device to copy or
move.
ChannelHandle A long integer value specifying the handle of the channel to add the
device to.
Settings
The settings for bMove are:
Setting Description
True If the device is to be moved.
Setting Description
0 The device was copied or moved.
DebugMessage Method
Syntax
object.DebugMessage Message
Part Description
object An object expression that evaluates to the Driver object.
Message A string expression that specifies the text you want to display in the
I/O Server event window as a debug message.
ErrorMessage Method
Syntax
object.ErrorMessage Message
The ErrorMessage method syntax has these parts:
Part Description
object An object expression that evaluates to the Driver object.
Message A string expression that specifies the text you want to display in the
I/O Server event window as an error message.
FileNew Method
Syntax
object.FileNew
The FileNew method syntax has these parts:
Part Description
object An object expression that evaluates to the Driver object.
Syntax
object.FileOpen [= string]
The FileOpen method syntax has these parts:
Part Description
object An object expression that evaluates to the Driver object.
Remarks
If the specified file does not exist, a new configuration file is created with the specified file name. If an
existing .csv file is specified, the file is imported.
FileSave Method
Syntax
object.FileSave
The FileSave method syntax has these parts:
Part Description
object An object expression that evaluates to the Driver object.
FileSaveAs Method
Syntax
object.FileSaveAs [= string]
The FileSaveAs method syntax has these parts:
Part Description
object An object expression that evaluates to the Driver object.
Remarks
A configuration file specified with the I/O Driver’s acronym as the extension will be saved as a reload-
able binary file, a “.csv” extension will be saved as a comma separated value text file, and a “.txt” exten-
sion will result in the server window’s log being written to a text file.
GetChannels Method
Syntax
NumChannels = object.GetChannels ChannelHandles ChannelNames
The GetChannels method syntax has these parts:
Part Description
NumChannels A long integer expression specifying the number of channels
returned
Remarks
The handles and names retrieved with this method can be used in an application to populate a tree view.
The handles are used in methods such as SetProperyData and GetPropertyData.
GetDataBlocks Method
Returns all configured datablocks on the specified device as handles and names.
Syntax
NumDataBlocks = object.GetDataBlocks DeviceHandle DataBlockHandles DataBlockNames
DeviceHandle A long integer expression specifying the handle of the device from
which to retrieve the datablocks.
Remarks
The handles and names retrieved with this method can be used in an application to populate a tree view.
The handles are used in methods such as SetProperyData and GetPropertyData.
GetDevices Method
Returns all configured devices on the specified channel as handles and names.
Syntax
NumDevices = object.GetDevices ChannelHandle DeviceHandles DeviceNames
The GetDevices method syntax has these parts:
Part Description
NumDevices A long integer expression specifying the number of devices returned.
ChannelHandle A long integer expression specifying the handle of the channel from
which to retrieve the devices.
Remarks
The handles and names retrieved with this method can be used in an application to populate a tree view.
The handles are used in methods such as SetProperyData and GetPropertyData.
GetNameSpace Method
Syntax
NameSpace = object.GetNameSpace(lChannelHandle)
The GetNameSpace method syntax has these parts:
Part Description
NameSpace An integer value that evaluates to a namespace.
IChannelHandle A long integer expression specifying the handle of the OPC server
from which to retrieve the namespace.
Settings
The settings for NameSpace are:
Setting Description
0 Hierarchical namespace
1 Flat namespace
GetProperties Method
Syntax
NumProperties = object.GetProperties ObjectType Properties
The GetProperties method syntax has these parts:
Part Description
NumProperties A long integer expression specifying the number of properties
returned in the Properties array.
Settings
The settings for ObjectType are:
Setting Description
1 Driver object
2 Channel object
3 Device object
4 DataBlock object
Remarks
This method allows an OLE Automation controller to retrieve all exposed properties for each server
object. These property strings are used as properties in methods such as SetProperyData and GetProp-
ertyData.
GetPropertyData Method
Syntax
Errors = object.GetPropertyData ObjectHandleProperties PropertyData
The GetPropertyData method syntax has these parts:
Part Description
Errors A returned array specifying corresponding property retrieving errors.
ObjectHandle A long integer expression specifying the handle of the object (chan-
nel, device or datablock) to return property data for.
InfoMessage Method
Syntax
object.InfoMessage Message
The InfoMessage method syntax has these parts:
Part Description
object An object expression that evaluates to the Driver object.
Message A string expression that specifies the text you want to display in the
I/O Server event window as an information message.
IsBrowseSupported Method
Syntax
Browsable = object.IsBrowseSupported(lChannelHandle)
The IsBrowseSupported method syntax has these parts:
Part Description
Browsable An integer value that indicates whether the OPC server supports
browsing.
IChannelHandle A long integer value that evaluates to the handle of the OPC server
you want to browse.
Settings
The settings for Browsable are:
Setting Description
Poll Method
Syntax
object.Poll ObjectHandle
Part Description
object An object expression that evaluates to the Driver object.
ObjectHandle A long integer value specifying a server object handle received from
server methods such as AddChannel() or GetDevices().
Remarks
The Poll method can be used to demand poll datablocks on the server by configuring the datablocks with
a disabled poll time and calling Poll() with the appropriate datablock handle.
Quit Method
Syntax
object.Quit
The Quit method syntax has these parts:
Part Description
object An object expression that evaluates to the Driver object.
Remarks
The Quit method can be used to explicitly issue a shutdown request to the server. If the server is con-
nected to a FIX client or clients, this method will return an error.
ReadData Method
Syntax
Data = object.ReadData DataBlockHandle RequestedDataType ItemOffset SubItemOffset Count Sig-
nalConditioning HighEgu LoEgu TimeStamp Quality
Part Description
Data An array or expression specifying the datablock’s polled data.
ItemOffset A long integer expression specifying the offset of the desired data
from the start of the datablock.
Settings
The settings for RequestedDataType are:
Setting Description
1 Not specified (VT_EMPTY)
Setting Description
0 None (No Signal Conditioning)
Remarks
The RequestedDataType settings are of type VARTYPE (an enumeration type used in VARIANT,
TYPEDESC, OLE property sets, and safe arrays) and represent the minimum supported for this server.
See your I/O Server documentation for more details regarding this setting.
The SignalConditioning settings represent the minimum supported for this server. See your I/O Server
documentation for more details regarding this setting.
The TimeStamp part is returned as a Time value. The Quality part is returned as an integer representing
OLE for Process Control (OPC) Quality flags. Please reference the OLE for Process Control Version 1.0
Specification for more information.
RemoveChannel Method
14 © 2020 General Electric Company. All rights reserved.
Removes the specified channel from the server configuration.
Syntax
object.RemoveChannel ChannelHandle
The RemoveChannel method syntax has these parts:
Part Description
object An object expression that evaluates to the Driver object.
ChannelHandle A long integer value specifying a channel object handle received from
a server method such as AddChannel().
RemoveDataBlock Method
Syntax
object.RemoveDataBlock DeviceHandle DataBlockHandle
The RemoveDataBlock method syntax has these parts:
Part Description
object An object expression that evaluates to the Driver object.
DeviceHandle A long integer expression specifying the handle of the device from
which to remove the datablock.
RemoveDevice Method
Syntax
object.RemoveDevice ChannelHandle DeviceHandle
The RemoveDevice method syntax has these parts:
Part Description
ChannelHandle A long integer value specifying a channel object handle received from
a server method such as AddChannel().
SetPropertyData Method
Syntax
Errors = object.SetPropertyData ObjectHandleProperties PropertyData
The SetPropertyData method syntax has these parts:
Part Description
Errors A returned array specifying corresponding property setting errors.
ObjectHandle A long integer expression specifying the handle of the object (chan-
nel, device or datablock) to set property data for.
Remarks
When setting data for a single property, the property string may be specified as a string instead of a one-
dimensional array, and the property data value may also be specified as a single VARIANT instead of a
one-dimensional array.
Start Method
Syntax
object.Start
The Start method syntax has these parts:
Stop Method
Syntax
object.Stop
The Stop method syntax has these parts:
Part Description
object An object expression that evaluates to the Driver object.
Switch Method
Syntax
object.Switch ObjectHandle
The Switch method syntax has these parts:
Part Description
object An object expression that evaluates to the Driver object.
ObjectHandle A long integer value specifying a server object handle received from
server methods such as AddChannel() or GetDevices().
WarnMessage Method
Syntax
object.WarnMessage Message
The WarnMessage method syntax has these parts:
Part Description
Message A string expression that specifies the text you want to display in the
I/O Server event window as a warning message.
WriteData Method
Syntax
object.WriteData DataBlockHandle ItemOffset SubItemOffset SignalConditioning HighEgu LoEgu
Data
The WriteData method syntax has these parts:
Part Description
object An object expression that evaluates to the Driver object.
ItemOffset A long integer expression specifying the offset from the start of
the datablock to write to.
SubItemOffset An integer expression specifying the offset from the start of the
data item to write to.
Settings
The settings for SignalConditioning are:
Setting Description
Remarks
The SignalConditioning settings represent the minimum supported for this server. See your I/O Server
documentation for more details regarding this setting.
Property Summary
The following list contains the OSDK Type Library properties that are available.
Application
ConfigFileName
ConfigFilePath
DefaultConfigFileName
DefaultConfigFilePath
FileSaved
FullConfigFileName
FullDefaultConfigFileName
FullName
Name
Application Property
Syntax
object.Application
The Application property syntax has these parts:
Part Description
object An object expression that evaluates to the Driver object.
ConfigFileName Property
Syntax
object.ConfigFileName
The ConfigFileName property syntax has these parts:
Part Description
object An object expression that evaluates to the Driver object.
ConfigFilePath Property
Returns the path specification for the active configuration file. Read only.
Syntax
object.ConfigFilePath
The ConfigFilePath property syntax has these parts:
Part Description
object An object expression that evaluates to the Driver object.
Syntax
object.DefaultConfigFileName [= string]
Part Description
object An object expression that evaluates to the Driver object.
DefaultConfigFilePath Property
Syntax
object.DefaultConfigFilePath [= string]
The DefaultConfigFilePath property syntax has these parts:
Part Description
object An object expression that evaluates to the Driver object.
FileSaved Property
Syntax
object.FileSaved
The FileSaved property syntax has these parts:
FullConfigFileName Property
Returns the file specification for the active configuration file, including path. Read only.
Syntax
object.FullConfigFileName
The FullConfigFileName property syntax has these parts:
Part Description
object An object expression that evaluates to the Driver object.
FullDefaultConfigFileName Property
Returns the file specification for the default configuration file, including path. Read only.
Syntax
object.FullDefaultConfigFileName
The FullDefaultConfigFileName property syntax has these parts:
Part Description
object An object expression that evaluates to the Driver object.
FullName Property
Returns the file specification for the application, including path. Read only.
Syntax
object.FullName
The FullName property syntax has these parts:
Part Description
Name Property
Syntax
object.Name
The Name property syntax has these parts:
Part Description
object An object expression that evaluates to the Driver object.
Path Property
Returns the path specification for the application's executable file. Read only.
Syntax
object.Path
Part Description
object An object expression that evaluates to the Driver object.
Running Property
Returns a value indicating whether the server is started or stopped. Read only.
Syntax
object.Running
The Running property syntax has these parts:
Part Description
object An object expression that evaluates to the Driver object.
Visible Property
Syntax
object.Visible [= boolean]
The Visible property syntax has these parts:
Part Description
object An object expression that evaluates to the Driver object.
Settings
The settings for boolean are:
Setting Description
True Server window is visible.
Example Summary
The following list contains the OSDK Type Library methods that are available.
This example adds a channel object to the server, specifying some properties.
This example adds a datablock object to the server, specifying some properties.
‘ Add a channel
lChanHandle = objDriver.AddChannel vProperties vPropertyData vErrors
‘ Add a datablock
lDbHandle = AddDatablock lDevHandle vProperties vPropertyData vErrors
This example adds a device object to the server with default properties.
‘ Add a channel
lChanHandle = objDriver.AddChannel vProperties vPropertyData vErrors
‘ Add a device
lDevHandle = objDriver.AddDevice lChanHandle vProperties vPropertyData vErrors
‘ Add a datablock
lDbHandle = objDriver.AddDatablock lDevHandle vProperties vPropertyData vErrors
This example adds a device object to the server, specifying some properties.
‘ Add a channel
lChanHandle = objDriver.AddChannel vProperties vPropertyData vErrors
‘ Add a device
lDevHandle = objDriver.AddDevice lChanHandle vProperties vPropertyData vErrors
This example adds a device object to the server with default properties.
‘ Add a channel
lChanHandle = objDriver.AddChannel vProperties vPropertyData vErrors
‘ Add a device
lDevHandle = objDriver.AddDevice lChanHandle vProperties vPropertyData vErrors
This example sets the objDriverApp variable to the Driver Application object:
This example sets the Text property of a TextBox control to the server’s configuration file name.
This example sets the Text property of a TextBox control to the server s configuration file path.
txtText1.Text = objDriver.ConfigFilePath
'Add a channel
lChanHandle = objDriver.AddChannel(vProperties, vPropertyData, vErrors)
'Add a device
lDevHandle = objDriver.AddDevice(lChanHandle, vProperties, vPropertyData, vErrors)
This example sets the Text property of a TextBox control to the server’s default configuration file path
and then sets the server’s default configuration file name to a new value:
This example sets the Text property of a TextBox control to the server’s default configuration file path
and then sets the server’s default configuration file path to a new value:
This example saves the server configuration as a file type determined by the value of an OptionButton
control:
This example checks the FileSaved property and prompts the user if the file needs to be saved. This
may be typical of a client application’s shutdown code.
This example sets the Text property of a TextBox control to the server’s full configuration file name:
This example sets the Text property of a TextBox control to the server’s default configuration file spe-
cification:
This example sets the Caption property of a form to the full application name:
This example returns the configured channels for the driver object and displays them in two TextBox
Control arrays.
‘ Display them
For i = 1 To lNumChans
txtText1(i) = vChannelNames(i - 1)
txtText2(i) = vChannelHandles(i - 1)
Next i
This example returns the configured datablocks for a device and displays them in two TextBox Control
arrays.
‘ Display them
For i = 1 To lNumDBs
txtText1(i) = vDataBlockNames(i - 1)
txtText2(i) = vDataBlockHandles(i - 1)
Next i
This example returns the configured devices for a channel object and displays them in two TextBox Con-
trol arrays.
‘ Display them
For i = 1 To lNumDevs
txtText1(i) = vDeviceNames(i - 1)
txtText2(i) = vDeviceHandles(i - 1)
Next i
Next x
End If
This example gets the exposed properties for the driver object and displays them in a TextBox Control
array.
‘ Display them
For i = 1 To lNumProps
txtText(i) = vProperties(i - 1)
Next i
‘ Add a channel
lChanHandle = objDriver.AddChannel vProperties vPropertyData vErrors
This example returns multiple property data values for a channel object.
‘ Add a channel
lChanHandle = objDriver.AddChannel vProperties vPropertyData vErrors
Next x
End If
pvChannelHandles = Null
pvChannelNames = Null
This example sets the Caption property of a form to the application name:
This example sets the Caption property of a form to the path specification of the application:
‘ Prompt user
If MsgBox(“Shutdown server?”, vbOKCancel) = vbOK Then
‘ Exit server
objDriver.Quit
This example reads data from the server in response to a CommandButton click.
Dim i As Long
Dim lDBHdl As Long
Dim lItemOffset, lSubItemOffset, lCount As Long
Dim vTimeStamp, vQuality, vData As Variant
Dim nDataType, nSigCond As Integer
Dim sngHighEgu, sngLowEgu As Single
This example adds and removes a channel from the server configuration.
‘ Add a channel
lChanHandle = objDriver.AddChannel vProperties vPropertyData vErrors
‘ Add a channel
lChanHandle = objDriver.AddChannel vProperties vPropertyData vErrors
‘ Add a device
lDevHandle = objDriver.AddDevice lChanHandle vProperties vPropertyData vErrors
‘ Add a datablock
lDbHandle = objDriver.AddDatablock lDevHandle vProperties vPropertyData vErrors
‘ Add a channel
lChanHandle = objDriver.AddChannel vProperties vPropertyData vErrors
‘ Add a device
lDevHandle = objDriver.AddDevice lChanHandle vProperties vPropertyData vErrors
This example sets the Value property of an OptionButton control to the running state of the driver:
‘ Add a channel
lChanHandle = objDriver.AddChannel vProperties vPropertyData vErrors
‘ Add a channel
lChanHandle = objDriver.AddChannel vProperties vPropertyData vErrors
StopMethod Example
This example switches all channels to/from their respective backup channels.
There are two different ways to obtain an interface pointer to the server object:
Example
Public iDrv AsNew ITKServer
Early binding has better performance, but late binding allows more diversity.
iBrowseOPCServer Interface
iDriverMessage Interface
Sample Application
IBrowseOPCServer Interface
Lets the OPC Client determine if browsing on the OPC server. If browsing is supported, the interface
lets the OPC Client browse the server for item ids and access paths.
NOTE: You can only use the IsBrowseSupported and GetNameSpace methods from this interface. The other
methods are for internal use and not supported for third-party development.
IDriver Message
Lets the driver send messages to the I/O Server’s event window. Visual Basic applications can also use
this interface to send messages to the event window.
Sample Application
'
'InfoMessage, DebugMessage
'
szEnabled = "1"
szDisabled = "0"
szServerName = "Intellution.OPCDrv"
szProgID = "SIMOPC.SIMOPC.2"
szChannel1 = "MyChannel1"
szChannel2 = "MyChannel2"
szDevice1 = "MyDevice1"
szDevice2 = "MyDevice2"
szItemID = "FLOAT_0"
szDataBlk1 = "MyDataBlock1"
szDataBlk2 = "MyDataBlock2"
szConfigFileName = "Fix.OPC"
szFileName = objDriver.DefaultConfigFileName
szPath = objDriver.DefaultConfigFilePath
End If
If objDriver.Visible = 0 Then
objDriver.Visible = 1
End If
For i = 0 To lNumChans - 1
If vChannelNames(i) = szChannel1 Then
'Remove the channel
Err = objDriver.RemoveChannel(vChannelHandles(i))
End If
Next i
vProperties = Array("Enabled")
vPropertyData = Array(szEnabled)
vErrors = Empty
If objDriver.Running = 0 Then
objDriver.Start
End If
objDriver.Poll (lDevHandle1)
For i = 0 To lNumChans - 1
If vChannelNames(i) = szChannel2 Then
Err = objDriver.RemoveChannel(vChannelHandles(i))
End If
Next i
vPropertyData = Array(szDisabled)
End If
vProperties = Array("Enabled")
vPropertyData = Array(szEnabled)
For i = 0 To lNumDataBlks - 1
'Enable every datablocks
Next i
If objDriver.FileSaved = 0 Then
objDriver.FileSave
End If
objDriver.Stop
'ShutDown
objDriver.Quit
FileNew method 5
C FullConfigFileName property 22
GetProperties method 9
ErrorMessage Method 5
GetProperties Method Example 37
ErrorMessage Method Example 31
GetPropertyData method 10
Running property 23
I
Running Property Example 44
IBrowseOpcServer interface 49
IDriverMessage Interface 49 S
Start method 16
N
Start Method Example 46
Name property 23
Stop method 17
Name Property Example 40
Stop Method Example 46
P Switch method 17
ReadData method 12
RemoveChannel method 14
RemoveDataBlock method 15
RemoveDevice method 15