{"id":19384914,"url":"https://github.com/huskar-t/opcda","last_synced_at":"2025-04-23T22:31:47.316Z","repository":{"id":221797744,"uuid":"755397247","full_name":"huskar-t/opcda","owner":"huskar-t","description":"An OPC DA client written purely in Go","archived":false,"fork":false,"pushed_at":"2025-04-18T16:54:14.000Z","size":114,"stargazers_count":31,"open_issues_count":3,"forks_count":8,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-19T05:42:06.661Z","etag":null,"topics":["classic","data-access","go","golang","opc","opcda"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/huskar-t.png","metadata":{"files":{"readme":"README-CN.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-02-10T04:25:23.000Z","updated_at":"2025-04-15T05:40:56.000Z","dependencies_parsed_at":"2024-11-10T09:33:44.170Z","dependency_job_id":"124ec4b1-2dfe-4d9f-91ab-315225dc330f","html_url":"https://github.com/huskar-t/opcda","commit_stats":null,"previous_names":["huskar-t/opcda"],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/huskar-t%2Fopcda","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/huskar-t%2Fopcda/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/huskar-t%2Fopcda/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/huskar-t%2Fopcda/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/huskar-t","download_url":"https://codeload.github.com/huskar-t/opcda/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250526925,"owners_count":21445267,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["classic","data-access","go","golang","opc","opcda"],"created_at":"2024-11-10T09:32:58.616Z","updated_at":"2025-04-23T22:31:47.076Z","avatar_url":"https://github.com/huskar-t.png","language":"Go","readme":"# Go OPC DA 客户端\n\n[![OPC_DA_WIN](https://github.com/huskar-t/opcda/actions/workflows/test.yaml/badge.svg)](https://github.com/huskar-t/opcda/actions/workflows/test.yaml)\n[![codecov](https://codecov.io/gh/huskar-t/opcda/graph/badge.svg?token=12QCJ69ZXQ)](https://codecov.io/gh/huskar-t/opcda)\n[![Go Report Card](https://goreportcard.com/badge/github.com/huskar-t/opcda)](https://goreportcard.com/report/github.com/huskar-t/opcda)\n[![Go Reference](https://pkg.go.dev/badge/github.com/huskar-t/opcda.svg)](https://pkg.go.dev/github.com/huskar-t/opcda)\n\n[English](README.md) | 简体中文\n\n这是一个用 Go 语言编写的 OPC DA 客户端，它允许你与 OPC DA 服务器进行通信并获取数据。OPC DA\n是一种常用的工业自动化通信协议，它允许设备和控制系统之间的数据交换。\n\n## 功能\n\n- 获取全部 OPC DA 服务器\n- 连接到 OPC DA 服务器\n- 浏览 OPC DA 服务器上的标签\n- 同步读取标签的值\n- 异步读取标签的值\n- 同步写入标签的值\n- 异步写入标签的值\n- 订阅标签的实时数据变化\n\n## 先决条件\n\n在开始使用本客户端之前，确保满足以下先决条件：\n\n- amd64/i386 架构的 Windows 操作系统\n- Go 版本 1.20 或更高版本\n\n**Go 1.20 是支持 Microsoft Windows 7 / 8 / Server 2008 / Server 2012 的最后一个版本，为了保证兼容性，会一直保持对 Go 1.20\n的支持。**\n\n**测试使用 Go1.20 和 Go 最新版本并进行 32 位和 64 位测试。**\n\n## 安装\n\n使用以下命令安装本客户端：\n\n```shell\ngo get github.com/huskar-t/opcda\n```\n\n## 类型\n\n本客户端提供了以下类型支持：\n\n| OPC 类型            | GO 类型       | 说明          |\n|-------------------|-------------|-------------|\n| VT_BOOL           | bool        | 布尔值         |\n| VT_I1             | int8        | 8 位有符号整数    |\n| VT_I2             | int16       | 16 位有符号整数   |\n| VT_I4             | int32       | 32 位有符号整数   |\n| VT_I8             | int64       | 64 位有符号整数   |\n| VT_UI1            | uint8       | 8 位无符号整数    |\n| VT_UI2            | uint16      | 16 位无符号整数   |\n| VT_UI4            | uint32      | 32 位无符号整数   |\n| VT_UI8            | uint64      | 64 位无符号整数   |\n| VT_R4             | float32     | 32 位浮点数     |\n| VT_R8             | float64     | 64 位浮点数     |\n| VT_BSTR           | string      | 字符串         |\n| VT_DATE           | time.Time   | 日期时间        |\n| VT_ARRAY\\|VT_BOOL | []bool      | 布尔值数组       | \n| VT_ARRAY\\|VT_I1   | []int8      | 8 位有符号整数数组  |\n| VT_ARRAY\\|VT_I2   | []int16     | 16 位有符号整数数组 |\n| VT_ARRAY\\|VT_I4   | []int32     | 32 位有符号整数数组 |\n| VT_ARRAY\\|VT_I8   | []int64     | 64 位有符号整数数组 |\n| VT_ARRAY\\|VT_UI1  | []uint8     | 8 位无符号整数数组  |\n| VT_ARRAY\\|VT_UI2  | []uint16    | 16 位无符号整数数组 |\n| VT_ARRAY\\|VT_UI4  | []uint32    | 32 位无符号整数数组 |\n| VT_ARRAY\\|VT_UI8  | []uint64    | 64 位无符号整数数组 |\n| VT_ARRAY\\|VT_R4   | []float32   | 32 位浮点数数组   |\n| VT_ARRAY\\|VT_R8   | []float64   | 64 位浮点数数组   |\n| VT_ARRAY\\|VT_BSTR | []string    | 字符串数组       |\n| VT_ARRAY\\|VT_DATE | []time.Time | 日期时间数组      |\n\n其他类型暂未支持。\n\n## 使用示例\n\n- [获取全部 OPC DA 服务器](./example/serverlist)\n- [浏览标签](./example/browse)\n- [订阅标签](./example/subscribe)\n- [同步读取标签](./example/read)\n- [异步读取标签](./example/asyncread)\n- [同步写入标签](./example/write)\n- [异步写入标签](./example/asyncwrite)\n\n## API 文档\n\n全部 API 见 [API 文档](https://pkg.go.dev/github.com/huskar-t/opcda)\n\n## 为什么选择本客户端\n\n1. 目前 Go 语言生态中并没有成熟的 OPC DA 客户端，本客户端是为了填补这一空白而开发的。\n2. 本客户端使用纯 Go 语言编写并且支持 32 位与 64 位。\n3. 本客户端还提供了相对完整的功能，包括读取、写入和订阅标签的实时数据变化等。\n\n### 为什么不是 [konimarti/opc](https://github.com/konimarti/opc)\n\n1. [konimarti/opc](https://github.com/konimarti/opc) 使用 OPC DA Automation Wrapper 接口，无法对 Wrapper 进行修改无法保证\n   bug 的修复。例如使用 Graybox DA Automation Wrapper 无法编译 64 位运行（HIGHENTROPYVA 默认开启，Wrapper 内部内存地址转换越界）\n2. 读字符串类型存在内存泄漏问题。\n3. 功能不够完善，如无法订阅标签的实时数据变化。\n4. 未升级 [go-ole](https://github.com/go-ole/go-ole) [#252](https://github.com/go-ole/go-ole/pull/252)，无法获得毫秒时间戳\n\n## 常见问题\n\n1. 跨平台支持\n\n   本客户端目前仅支持 Windows 操作系统。\n\n2. 多平台编译\n\n   本客户端无法在非 Windows 平台编译，因为它依赖于 Windows 平台的 COM 接口。如果程序需要支持多个平台，可以封装接口，并将非\n   Windows 平台的接口设置为空实现。\n\n3. 内存泄漏\n\n   本客户端使用了 COM 接口，内部已经处理了内存释放，并进行了所有支持类型的疲劳测试。但是在使用过程中，如果发现内存泄漏问题，可以提交\n   issue 并提供复现步骤。\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhuskar-t%2Fopcda","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhuskar-t%2Fopcda","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhuskar-t%2Fopcda/lists"}