English | 简体中文
This is an OPC DA client written in Go language, allowing you to communicate with OPC DA servers and retrieve data. OPC DA is a commonly used industrial automation communication protocol that enables data exchange between devices and control systems.
Before using this client, make sure you meet the following prerequisites:
Go 1.20 is the last version that supports Microsoft Windows 7 / 8 / Server 2008 / Server 2012. To ensure compatibility, this client will continue to support Go 1.20.
Testing is done with both Go 1.20 and the latest version of Go, covering both 32-bit and 64-bit testing.
Use the following command to install this client:
go get github.com/huskar-t/opcda
This client provides support for the following types:
OPC Type | Go Type | Description |
---|---|---|
VT_BOOL | bool | Boolean value |
VT_I1 | int8 | 8-bit signed integer |
VT_I2 | int16 | 16-bit signed integer |
VT_I4 | int32 | 32-bit signed integer |
VT_I8 | int64 | 64-bit signed integer |
VT_UI1 | uint8 | 8-bit unsigned integer |
VT_UI2 | uint16 | 16-bit unsigned integer |
VT_UI4 | uint32 | 32-bit unsigned integer |
VT_UI8 | uint64 | 64-bit unsigned integer |
VT_R4 | float32 | 32-bit floating point number |
VT_R8 | float64 | 64-bit floating point number |
VT_BSTR | string | String |
VT_DATE | time.Time | Date time |
VT_ARRAY|VT_BOOL | []bool | Boolean array |
VT_ARRAY|VT_I1 | []int8 | 8-bit signed integer array |
VT_ARRAY|VT_I2 | []int16 | 16-bit signed integer array |
VT_ARRAY|VT_I4 | []int32 | 32-bit signed integer array |
VT_ARRAY|VT_I8 | []int64 | 64-bit signed integer array |
VT_ARRAY|VT_UI1 | []uint8 | 8-bit unsigned integer array |
VT_ARRAY|VT_UI2 | []uint16 | 16-bit unsigned integer array |
VT_ARRAY|VT_UI4 | []uint32 | 32-bit unsigned integer array |
VT_ARRAY|VT_UI8 | []uint64 | 64-bit unsigned integer array |
VT_ARRAY|VT_R4 | []float32 | 32-bit floating point number array |
VT_ARRAY|VT_R8 | []float64 | 64-bit floating point number array |
VT_ARRAY|VT_BSTR | []string | String array |
VT_ARRAY|VT_DATE | []time.Time | Date time array |
Other types are not currently supported.
All APIs can be found in the API documentation.
Cross-platform support
This client only supports the Windows operating system.
Multi-platform compilation
This client cannot be compiled on non-Windows platforms because it relies on Windows platform COM interfaces. If the program needs to support multiple platforms, interfaces can be encapsulated, and non-Windows platform interfaces can be set to empty implementations.
Memory leaks
This client uses COM interfaces, and memory release has been handled internally, with fatigue testing done for all supported types. However, if memory leak issues are found during use, you can submit an issue and provide reproduction steps.