Skip to content

Commit

Permalink
creating two separate flows to account for situations where the defau…
Browse files Browse the repository at this point in the history
…lt value is different types
  • Loading branch information
paulr34 committed Jul 11, 2024
1 parent d216b84 commit 5f0de79
Showing 1 changed file with 19 additions and 10 deletions.
29 changes: 19 additions & 10 deletions src-electron/generator/helper-endpointconfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -828,6 +828,7 @@ async function collectAttributes(db, sessionId, endpointTypes, options) {
longDefaults.push(a)

let def
let defArray = []
if (
types.isString(a.type) &&
attributeDefaultValue === null &&
Expand All @@ -836,26 +837,34 @@ async function collectAttributes(db, sessionId, endpointTypes, options) {
// We don't want to make longTypeDefaultValue know about our null
// string representation.
if (types.isOneBytePrefixedString(a.type)) {
def = ['0xFF']
defArray = ['0xFF']
} else if (types.isTwoBytePrefixedString(a.type)) {
def = ['0xFF', '0xFF']
defArray = ['0xFF', '0xFF']
} else {
throw new Error(`Unknown string type: ${type}`)
}
longDef = {
value: defArray,
size: defaultSize,
index: longDefaultsIndex,
name: a.name,
comment: cluster.comment,
type: a.type,
}
} else {
def = types.longTypeDefaultValue(
defaultSize,
a.type,
attributeDefaultValue
)
}
let longDef = {
value: def,
size: defaultSize,
index: longDefaultsIndex,
name: a.name,
comment: cluster.comment,
type: a.type,
longDef = {
value: def,
size: defaultSize,
index: longDefaultsIndex,
name: a.name,
comment: cluster.comment,
type: a.type,
}
}
attributeDefaultValue = `ZAP_LONG_DEFAULTS_INDEX(${longDefaultsIndex})`
defaultValueIsMacro = true
Expand Down

0 comments on commit 5f0de79

Please sign in to comment.