Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions errata/sdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ type SDKType struct {
Quality string `yaml:"quality,omitempty"`
Access string `yaml:"access,omitempty"`
Direction string `yaml:"direction,omitempty"`
Response string `yaml:"response,omitempty"`
FabricScoping string `yaml:"fabric-scoping,omitempty"`

Attributes map[string]*SDKType `yaml:"attributes,omitempty"`
Expand Down
5 changes: 5 additions & 0 deletions matter/bitmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ type Bit interface {
SetName(name string)
Summary() string
Conformance() conformance.Set
SetConformance(conformance conformance.Set)
SetParent(parent types.Entity)

Inherit(parent Bit) error
Expand Down Expand Up @@ -240,6 +241,10 @@ func (bmb *BitmapBit) Conformance() conformance.Set {
return bmb.conformance
}

func (bmb *BitmapBit) SetConformance(conformance conformance.Set) {
bmb.conformance = conformance
}

func (bmb *BitmapBit) Clone() Bit {
return bmb.CloneTo(bmb.parent)
}
Expand Down
2 changes: 1 addition & 1 deletion matter/spec/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ func (sp *Builder) buildSpec(cxt context.Context, libraries []*Library) (referen

sp.resolveClusterDataTypeReferences(false)

sp.resolveConformances()
sp.ResolveConformances()
sp.resolveConstraints()
err = updateBridgedBasicInformationCluster(spec, basicInformationCluster, bridgedDeviceBasicInformationCluster)
if err != nil {
Expand Down
7 changes: 6 additions & 1 deletion matter/spec/conformance.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@ import (
"github.com/project-chip/alchemy/matter/types"
)

func (sp *Builder) resolveConformances() {
func (spec *Specification) ResolveConformances() {
sp := &Builder{Spec: spec}
sp.ResolveConformances()
}

func (sp *Builder) ResolveConformances() {
specEntityFinder := newSpecEntityFinder(sp.Spec, nil, nil)
for cluster := range sp.Spec.Clusters {
specEntityFinder.cluster = cluster
Expand Down
3 changes: 3 additions & 0 deletions sdk/bitmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ func applyBitmapOverride(bitmap *matter.Bitmap, override *errata.SDKType) {
if f.OverrideName != "" {
b.SetName(f.OverrideName)
}
if f.Conformance != "" {
b.SetConformance(conformance.ParseConformance(f.Conformance))
}
break
}
}
Expand Down
10 changes: 10 additions & 0 deletions sdk/errata.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ func ApplyErrata(spec *spec.Specification) (err error) {
spec.BuildDataTypeReferences()
spec.BuildClusterReferences()
}
spec.ResolveConformances()
return
}

Expand All @@ -70,6 +71,9 @@ func applyErrataToCommand(st *matter.Command, typeNames map[string]string, typeO
if override.Conformance != "" {
st.Conformance = conformance.ParseConformance(override.Conformance)
}
if override.Response != "" {
st.Response = types.ParseDataType(override.Response, types.DataTypeRankScalar)
}
applyErrataToFields(st.Fields, override)
}
st.Name = applyTypeName(typeNames, st.Name)
Expand All @@ -93,6 +97,12 @@ func applyErrataToEvent(ev *matter.Event, typeNames map[string]string, typeOverr
if override.Conformance != "" {
ev.Conformance = conformance.ParseConformance(override.Conformance)
}
switch override.FabricScoping {
case "none":
ev.Access.FabricScoping = matter.FabricScopingUnscoped
case "fabric-scoped":
ev.Access.FabricScoping = matter.FabricScopingScoped
}
applyErrataToFields(ev.Fields, override)
}
ev.Name = applyTypeName(typeNames, ev.Name)
Expand Down
3 changes: 3 additions & 0 deletions sdk/extra.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,9 @@ func addExtraCommands(cluster *matter.Cluster, extra *errata.SDKType) {
command.Direction = matter.InterfaceServer
}
}
if cmd.Response != "" {
command.Response = types.ParseDataType(cmd.Response, types.DataTypeRankScalar)
}
for i, f := range cmd.Fields {
field := matter.NewField(nil, command, types.EntityTypeCommandField)
field.Name = f.Name
Expand Down
9 changes: 8 additions & 1 deletion sdk/struct.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,11 @@ func applyErrataToField(field *matter.Field, override *errata.SDKType) {
field.Name = override.OverrideName
}
if override.OverrideType != "" {
field.Type = types.ParseDataType(override.OverrideType, types.DataTypeRankScalar)
rank := types.DataTypeRankScalar
if override.List {
rank = types.DataTypeRankList
}
field.Type = types.ParseDataType(override.OverrideType, rank)
}
if override.Conformance != "" {
field.Conformance = conformance.ParseConformance(override.Conformance)
Expand All @@ -58,6 +62,9 @@ func applyErrataToField(field *matter.Field, override *errata.SDKType) {
if override.Fallback != "" {
field.Fallback = constraint.ParseLimit(override.Fallback)
}
if override.Value != "" {
field.ID = matter.ParseNumber(override.Value)
}
field.Quality = overrideQuality(override, field.Quality)
field.Access = overrideAccess(override, field.EntityType(), field.Access)
}
Loading