Skip to content

Commit

Permalink
feat(设备影子): 记录指令下发事件
Browse files Browse the repository at this point in the history
  • Loading branch information
xcocx committed Jun 20, 2024
1 parent 0d32cd9 commit 1ec1b91
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 3 additions & 2 deletions internal/core/batch_send.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ import (
// SendBatchWrite 发送多个点位写命令
func SendBatchWrite(deviceId string, points []plugin.PointData) (err error) {
logger.Logger.Info("send batch write", zap.String("deviceId", deviceId), zap.Any("points", points))
for _, point := range points {
_ = helper.DeviceShadow.SetWritePointValue(deviceId, point.PointName, point.Value)
}
//设备驱动层加工
result, err := deviceDriverProcess(deviceId, plugin.WriteMode, points...)
if err != nil {
Expand Down Expand Up @@ -104,8 +107,6 @@ func tryReadNewValues(deviceId string, points []plugin.PointData) {
continue
}
readPoints = append(readPoints, p)
//更新点位写时间
_ = helper.DeviceShadow.SetWritePointValue(deviceId, p.PointName, p.Value)
}
if len(readPoints) == 0 {
return
Expand Down
1 change: 1 addition & 0 deletions internal/core/single_send.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
// 单点操作
func SendSinglePoint(deviceId string, mode plugin.EncodeMode, pointData plugin.PointData) error {
logger.Logger.Info("send single point", zap.String("deviceId", deviceId), zap.Any("mode", mode), zap.Any("pointData", pointData))
_ = helper.DeviceShadow.SetWritePointValue(deviceId, pointData.PointName, pointData.Value)
if !checkMode(mode) {
return errors.New("invalid mode")
}
Expand Down

0 comments on commit 1ec1b91

Please sign in to comment.