Simple OPC interface version 2.4

Introduction

The OPC Client interface is present as PBOPC.dll. That uses internally the Customer interface of the OPC server.

To read and write the Items SyncronIO is used. The allocation of the Items to the correct SyncronIO administers those DLL over internal lists.

OPC runs under DCOM and thus with Unicode. Applications should be compiled also in Unicode.

Automatic type adjustment

The DLL takes over those automatically adjustment types over the OLE automation VariantChangeType.

That is called if the Item as Word defined is, can this for example as string read and write become.

From the type adjustment Read- and Write- Variant are excluded. As well as Items as array are defined.


Connections

OpcConnect(ServerName.s, ServerNode.s)

·         Param1: ServerName as String

·         Param2: ServerNode as String (Optional)

·         Result: ServerObject as Pointer

OpcRelease(*ServerObject)

·         Param1: ServerObject as Pointer

·         Result: OPC Server Release or hResult

 


Create and Destroy Groups

OpcAddGroup(*ServerObject, GroupName.s)

·         Param1: ServerObject as Pointer

·         Param2: GroupName as String

·         Result: GroupObject as Pointer

OpcRemoveGroup(*GroupObject)

·         Param1: GroupObject as Pointer

·         Result: hResult

 


Create and Destroy Items

OpcAddItem(*GroupObject, AccessPath.s, ItemID.s)

·         Param1: Group Object as Pointer

·         Param2: AccessPath as String

·         Param3: ItemID as String

·         Result: Pointer to the ItemObject

OpcRemoveItem(*ItemObject)

·         Param1: Pointer to the ItemObject

·         Result: hResult

 


Read Items

OpcReadBool(*ItemObject, *pResult.long, *pQuality.long )

·         Param1: Pointer to the ItemObject

·         Param2: Pointer to the pResult as Long

·         Param3: Pointer to the pQuality as Long, can null

·         Result: hResult

OpcReadByte(*ItemObject, *pResult.byte, *pQuality.long)

·         Param1: Pointer to the ItemObject

·         Param2: Pointer to the pResult as Byte

·         Param3: Pointer to the pQuality as Long, can null

·         Result: hResult

OpcReadWord(*ItemObject, *pResult.word, *pQuality.long)

·         Param1: Pointer to the ItemObject

·         Param2: Pointer to the pResult as Word

·         Param3: Pointer to the pQuality as Long can null

·         Result: hResult

OpcReadLong(*ItemObject, *pResult.long, *pQuality.long)

·         Param1: Pointer to the ItemObject

·         Param2: Pointer to the pResult as Long

·         Param3: Pointer to the pQuality as Long

·         Result: hResult

OpcReadFloat(*ItemObject, *pResult.float, *pQuality.long)

·         Param1: Pointer to the ItemObject

·         Param2: Pointer to the pResult as Float

·         Param3: Pointer to the pQuality as Long

·         Result: hResult

OpcReadDouble(*ItemObject, *pResult.double, *pQuality.long)

·         Param1: Pointer to the ItemObject

·         Param2: Pointer to the pResult as Double

·         Param3: Pointer to the pQuality as Long

·         Result: hResult

OpcReadDate(*ItemObject, *pResult.double, *pQuality.long)

·         Param1: Pointer to the ItemObject

·         Param2: Pointer to the pResult as Date (Double)

·         Param3: Pointer to the pQuality as Long

·         Result: hResult

OpcReadDateString(*ItemObject, *pResult, Size.l, *pQuality.long)

·         Param1: Pointer to the ItemObject

·         Param2: Pointer to the pResult as String

·         Param3: Size Of pResult as Long

·         Param4: Pointer to the pQuality as Long

·         Result: hResult

OpcReadString(*ItemObject, *pResult, Size.l, *pQuality.long)

·         Param1: Pointer to the ItemObject

·         Param2: Pointer to the pResult as String

·         Param3: Size Of pResult as Long

·         Param4: Pointer to the pQuality as Long

·         Result: hResult

OpcReadVariant(*ItemObject, *pResult.Variant, *pQuality.long)

·         Param1: Pointer to the ItemObject

·         Param2: Pointer to the pResult as Variant

·         Param3: Pointer to the pQuality as Long

·         Result: hResult

OpcReadItems(ItemCount.l, *ItemObjects.pArray, *pResult.VariantArray, *pQuality.QualityArray, *pErrors.ErrorsArray)

·         Param1: ItemCount as Long

·         Param2: Pointer to the ItemObject as Array

·         Param3: Pointer to the pResult as Array of Variant

·         Param4: Pointer to the pQuality as Array of Long

·         Param5: Pointer to the pErrors as Array of Long

·         Result: hResult

OpcReadItemArray(ItemCount.l, ItemCount.l, *ItemObject.variant, *pResult.variant, *pQuality.variant, *pErrors.variant)

Kompatibilität zu VisualStudio

·         Param1: ItemCount as int32

·         Param2: ItemObject as Array of int32 (Object)

·         Param3: pResult as Array of Variant (Object)

·         Param4: pQuality as Array of int32 (Object)

·         Param5: pErrors as Array of int32 (Object)

·         Result: hResult as int32

 


Write Items

OpcWriteBool(*ItemObject, value.l)

·         Param1: Pointer to the ItemObject

·         Param2: Value as Long

·         Result: hResult

OpcWriteByte(*ItemObject, value.b)

·         Param1: Pointer to the ItemObject

·         Param2: Value as Byte

·         Result: hResult

OpcWriteWord(*ItemObject, value.w)

·         Param1: Pointer to the ItemObject

·         Param2: Value as Word

·         Result: hResult

OpcWriteLong(*ItemObject, value.l)

·         Param1: Pointer to the ItemObject

·         Param2: Value as Long

·         Result: hResult

OpcWriteFloat(*ItemObject, value.f)

·         Param1: Pointer to the ItemObject

·         Param2: Value as Float

·         Result: hResult

OpcWriteDouble(*ItemObject, value.d)

·         Param1: Pointer to the ItemObject

·         Param2: Value as Double

·         Result: hResult

OpcWriteDate(*ItemObject, value.d)

·         Param1: Pointer to the ItemObject

·         Param2: Value as Date (Double)

·         Result: hResult

OpcWriteDateString(*ItemObject, value.s)

·         Param1: Pointer to the ItemObject

·         Param2: Value as Date String

·         Result: hResult

OpcWriteString(*ItemObject, value.s)

·         Param1: Pointer to the ItemObject

·         Param2: Value as String

·         Result: hResult

OpcWriteVariant(*ItemObject, *pValue.Variant)

·         Param1: Pointer to the ItemObject

·         Param2: Value as Variant

·         Result: hResult

OpcWriteItems(ItemCount, *ItemObjects.pArray, *pValues.VariantArray, *pErrors.ErrorsArray)

·         Param1: ItemCount as Long

·         Param2: Pointer to the ItemObject as Array

·         Param3: Pointer to the pValues as Array of Variant

·         Param4: Pointer to the pErrors as Array of Long

·         Result: hResult

OpcWriteItemArray(ItemCount, *ItemObject.variant, *pValues.variant, *pErrors.variant)

Kompatibilität zu VisualStudio

·         Param1: ItemCount as int32

·         Param2: ItemObject as Array of int32 (Object)

·         Param3: pResult as Array of Variant (Object)

·         Param4: pErrors as Array of int32 (Object)

·         Result: hResult as int32


Speziale Functions

OpcGetQualityText(qnr.l)

·         Param1: Quality Number

·         Result: Qualitytext as pString (Unicode)

OpcGetErrorString(*ServerObject, ErrorNumber.l)

·         Para 1: ServerObject

·         Para 2: Errorcode

·         Result: Errortext as pString (Unicode)

OpcGetLastError()

·         Result: Last Error

 


Server Shutdown

OpcInitShutdown(*ServerObject)

·        Param1: ServerObject as pointer

·        Result: ServerObject as pointer or zero by fault

OpcReleaseShutdown(*ServerObject)

·        Param1: ServerObject as pointer

·        Result: Ok = 0 - Shutdown Object = Fail

OpcIsShutdown(*ServerObject)

·         Param1: ServerObject as pointer

·         Result: True is shutdown request

OpcIsShutdownText(*ServerObject)

·         Param1: ServerObject as pointer

·         Result: Shutdown Text as String

OpcSetShutdownCallBack(*ServerObject, *Callback)

·         Param1: ServerObject as pointer

·         Param2: Callback function adress (MyCallback(*szReason))

·         Result: Old callback adress

 


License agreement

-====================================================================-

Using of the program

-====================================================================-

This program can be used for free.

I can´t give any warranty for the functionality and the correctness of the

results. I can´t take any responsibility for any damage of hardware or

software. You will use this software on your own risk.

-====================================================================-

Distribution of the program

-====================================================================-

You can distribute this program for free if you use the package of the

author without any changes. You are not allowed charge any money for the

distribution. If you want to distribute this program in any commerital way

you have to contact the author for a permission.

 

Freeware by Michael Kastner (mk-soft) [mk_soft@arcor.de or http://www.mksoft-planet.de]