summaryrefslogtreecommitdiff
path: root/staging
diff options
context:
space:
mode:
authorKubeEdge Bot <48982446+kubeedge-bot@users.noreply.github.com>2023-11-28 09:40:41 +0800
committerGitHub <noreply@github.com>2023-11-28 09:40:41 +0800
commit7486980df9dd50f52c03b1e899d637d39890a256 (patch)
tree302824e10074218f5c53fae946727a1b30a9dc28 /staging
parentMerge pull request #5206 from ZhengXinwei-F/bug-27-2 (diff)
parentDefine Twin based on properties in mapper. (diff)
downloadkubeedge-7486980df9dd50f52c03b1e899d637d39890a256.tar.gz
Merge pull request #5140 from luomengY/mapper_define_status
Resolve that users do not need to define the status module in device. yaml.
Diffstat (limited to 'staging')
-rw-r--r--staging/src/github.com/kubeedge/mapper-framework/pkg/util/parse/grpc.go22
1 files changed, 7 insertions, 15 deletions
diff --git a/staging/src/github.com/kubeedge/mapper-framework/pkg/util/parse/grpc.go b/staging/src/github.com/kubeedge/mapper-framework/pkg/util/parse/grpc.go
index 9fb9621e6..450e3730b 100644
--- a/staging/src/github.com/kubeedge/mapper-framework/pkg/util/parse/grpc.go
+++ b/staging/src/github.com/kubeedge/mapper-framework/pkg/util/parse/grpc.go
@@ -72,26 +72,18 @@ func BuildProtocolFromGrpc(device *dmiapi.Device) (common.ProtocolConfig, error)
}
func buildTwinsFromGrpc(device *dmiapi.Device) []common.Twin {
- if len(device.Status.Twins) == 0 {
+ if len(device.Spec.Properties) == 0 {
return nil
}
- res := make([]common.Twin, 0, len(device.Status.Twins))
- for _, twin := range device.Status.Twins {
+ res := make([]common.Twin, 0, len(device.Spec.Properties))
+ for _, property := range device.Spec.Properties {
cur := common.Twin{
- PropertyName: twin.PropertyName,
-
+ PropertyName: property.Name,
ObservedDesired: common.TwinProperty{
- Value: twin.ObservedDesired.Value,
- Metadata: common.Metadata{
- Timestamp: twin.ObservedDesired.Metadata["timestamp"],
- Type: twin.ObservedDesired.Metadata["type"],
- },
- },
- Reported: common.TwinProperty{
- Value: twin.Reported.Value,
+ Value: property.Desired.Value,
Metadata: common.Metadata{
- Timestamp: twin.ObservedDesired.Metadata["timestamp"],
- Type: twin.ObservedDesired.Metadata["type"],
+ Timestamp: property.Desired.Metadata["timestamp"],
+ Type: property.Desired.Metadata["type"],
},
},
}