38 Star 442 Fork 135

联犀/物联网iot模块

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
subDev.go 710 Bytes
一键复制 编辑 原始数据 按行查看 历史
杨磊 提交于 5个月前 . feat: 更新mod
package subDev
import (
"context"
"fmt"
"gitee.com/unitedrhino/share/conf"
"gitee.com/unitedrhino/share/devices"
)
type (
SubDev interface {
SubDevMsg(handle Handle) error
}
Handle func(ctx context.Context) DevSubHandle
DevSubHandle interface {
ExtMsg(topic string, payload []byte) error
Msg(topic string, payload []byte) error
Connected(out *devices.DevConn) error
Disconnected(out *devices.DevConn) error
}
)
func Check(conf conf.DevLinkConf) error {
if conf.Mqtt == nil {
return fmt.Errorf("DevLinkConf need")
}
return nil
}
func NewSubDev(conf conf.DevLinkConf) (SubDev, error) {
if err := Check(conf); err != nil {
return nil, err
}
return newEmqClient(conf.Mqtt)
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/unitedrhino/things.git
git@gitee.com:unitedrhino/things.git
unitedrhino
things
物联网iot模块
v1.1.0

搜索帮助