feat: 初始化小米 IoT (MIoT) 智能家居 Go 库

- 实现 MIoT 客户端核心功能(MQTT 连接、设备管理、属性读写)
- 支持云端 API 调用与局域网设备发现(mDNS)
- 集成国际化(i18n)多语言支持
- 添加 MIoT 设备规约解析器(spec_parser)
- 包含单元测试与使用示例
This commit is contained in:
2026-06-28 22:05:49 +08:00
parent ac442812b4
commit 3a44cb9e6a
118 changed files with 31630 additions and 0 deletions
+30
View File
@@ -0,0 +1,30 @@
# R2-03 — spec_parser.go: 属性访问器
## 缺失方法
`MIoTSpecProperty` 缺少 `writable / readable / notifiable` 三个布尔访问器。
Python 中通过 `access` 属性 setter 自动设置:
```python
@access.setter
def access(self, value: list) -> None:
self._writable = 'write' in value
self._readable = 'read' in value
self._notifiable = 'notify' in value
```
## 目标文件
`D:\miot\go-miot\spec_parser.go`
添加:
```go
func (p *MIoTSpecProperty) Writable() bool {
for _, a := range p.Access {
if a == "write" { return true }
}
return false
}
func (p *MIoTSpecProperty) Readable() bool { ... }
func (p *MIoTSpecProperty) Notifiable() bool { ... }
```