Create Universal Driver Interface

With the Universal Driver Interface you can create your own data source for Open Automation Software. Simply follow these steps to define your own tag and interface properties that will be included in the OAS framework.

Step 1

You will need to be running Open Automation Software Version 11 or greater to support Universal Drivers.  You can download the latest version at https://openautomationsoftware.com/download/

Step 2

Copy the C# or VB Example Driver Code from C:\Program Files (x86)\Open Automation Software\OPC Systems.NET\Universal Drivers\Example Driver Code\

Step 3

Open the project with Visual Studio.
Note: If you do not have Visual Studio installed on your system you can obtain a free version from https://visualstudio.microsoft.com/vs/community/

Step 4

Under the Project Properties set the Assembly name and Root namespace name to something unique for each driver you create.

Step 5

Open the file DriverInterface.vb for the VB project or DriverInterface.cs for the C# project.
Set the m_DriverName variable to a unique name for each driver you create.

VB

C#

Step 6

Define the Driver Interface properties you would like make adjustable in the function GetDefaultDriverConfig with a list of ClassProperty objects.
VB

C#

ClassProperty
The ClassProperty object is used to define both Driver Interface and Tag properties that you would like to appear in the OAS Framework for system setup.
Following is a list of the variables of a ClassProperty object.

PropName:
A unique name that identifies the property. This will the be name used for CSV Import and Export and also for programmatic setup with the TagCSVImport and DriverInterfaceCSVImport methods.

PropDescription:
The text that will appear next to the property in the Configure OAS application.

PropHelp:
The text that will appear in the help window for this property in the Configure OAS application. If left blank the help icon will not appear next to the property.

PropType:
The data type of the property value. You can define enumerations or common data types.

PropValue:
This will be the default value of the property when a Driver Interface or Tag is created.

InputType:
This is the configuration input type to use for the property. Manual is the most commonly used input type, but there are also FileBrowse and other configuration input types that can be used to define a value in the Configure OAS application.

Binding:
This is an optional property that can be used to control the visibility of property in the Configure OAS application based on the values of other configuration properties. If left blank the property will always appear.

Units:
This is an optional property that defines the text that will appear after the property value. If left blank the text will not appear.

Example of what will appear in Configure-Drivers with this example code:

Step 7

Add code to the Connect method to be executed when the driver instance enters runtime mode.
VB

C#

Note: You can optionally use the GetPropValue function to obtain the configuration value in any of the routines.

Step 8

Add code to the Disconnect method to be executed when the driver instance exits runtime mode.
VB

C#

Step 9

Define the Tag properties you would like make adjustable in the function GetDefaultTagConfig with a list of ClassProperty objects.
VB

C#

Example of what will appear in Configure-Tags with this example code:

Step 10

Add code to the AddTags method that passes the tags to be monitored with continuous polling.
The TagName, PollingRate, and all driver tag property values will be passed to this function. Use the GetPropValue to obtain any values for the properties.

C#

Step 12

Add code to the RemoveTags method that passes the tags to be removed from continuous polling.

C#

Step 13

Add code to the SyncRead method that passes a tags list, each containing properties. This is for one time read of values based on a trigger in OAS for a Device Read.

C#

Step 14

Add code to the WriteValues method that passes a list tagnames, values to be written, and a list of property values for each tag.

C#

Step 15

Add code for continuous polling that will obtain values for the tags and fire the event AsyncReadCallback which will pass an array of tag values.

C#

Step 16

To post a System Error to OAS raise the event UpdateSystemError.
Set the first parameter to true to post the System Error as active and false to clear the System Error that has been previously posted.
Specify a Category to group the error along with a unique MessageID.

VB

C#

View Deploy and Use a Universal Driver Interface for instructions on how to use the driver in the OAS.
To Debug a Universal Driver Interface with the UDI Test Application view Debug Universal Driver Interface.