Skip to content
代码片段 群组 项目
未验证 提交 cffd6317 编辑于 作者: Timotej Ecimovic's avatar Timotej Ecimovic 提交者: GitHub
浏览文件

Merge pull request #82 from tecimovic/silabs

Silabs
No related branches found
No related tags found
无相关合并请求
...@@ -146,3 +146,12 @@ Occasionally upgrading your `npm` also makes a difference: ...@@ -146,3 +146,12 @@ Occasionally upgrading your `npm` also makes a difference:
``` ```
then run: `npm rebuild canvas --update-binary` then run: `npm rebuild canvas --update-binary`
**Q: WHat should I do if I run into an xmljs.node issue?**
**A:** If you see an error like the following:
```
Module did not self-register: 'xmljs.node'.
```
then run: npm rebuild libxmljs --update-binary
...@@ -14382,9 +14382,9 @@ ...@@ -14382,9 +14382,9 @@
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
}, },
"ini": { "ini": {
"version": "1.3.5", "version": "1.3.8",
"resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz", "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz",
"integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==" "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew=="
}, },
"inquirer": { "inquirer": {
"version": "7.3.3", "version": "7.3.3",
...@@ -133,7 +133,7 @@ ...@@ -133,7 +133,7 @@
], ],
"husky": { "husky": {
"hooks": { "hooks": {
"pre-commit": "pretty-quick --staged && jsdoc src-electron src-shared -r -d ./generated-html/" "pre-commit": "pretty-quick --staged && jsdoc src-electron src-shared -r -d ./generated-html/ && eslint --ext .js,.vue src src-electron src-shared src-script test"
} }
}, },
"prettier": { "prettier": {
......
...@@ -73,6 +73,7 @@ async function exportEndpoints(db, sessionId, endpointTypes) { ...@@ -73,6 +73,7 @@ async function exportEndpoints(db, sessionId, endpointTypes) {
return { return {
endpointTypeName: x.NAME, endpointTypeName: x.NAME,
endpointTypeIndex: endpointTypeIndex(endpointTypes, x.ENDPOINT_TYPE_REF), endpointTypeIndex: endpointTypeIndex(endpointTypes, x.ENDPOINT_TYPE_REF),
endpointTypeRef: x.ENDPOINT_TYPE_REF,
profileId: x.PROFILE, profileId: x.PROFILE,
endpointId: x.ENDPOINT_IDENTIFIER, endpointId: x.ENDPOINT_IDENTIFIER,
networkId: x.NETWORK_IDENTIFIER, networkId: x.NETWORK_IDENTIFIER,
......
...@@ -327,6 +327,27 @@ async function user_default_response_policy(options) { ...@@ -327,6 +327,27 @@ async function user_default_response_policy(options) {
else return value else return value
} }
/*
* @param {*} endpointTypeId
* Returns the endpoint type identifier for an endpoint type
*/
function endpoint_type_identifier(endpointTypeId) {
return queryImpexp
.exportendPointTypeIds(this.global.db, this.global.sessionId)
.then((endpointTypes) =>
queryImpexp
.exportEndpoints(this.global.db, this.global.sessionId, endpointTypes)
.then((endpoints) => {
let i = 0
for (i = 0; i < endpoints.length; i++) {
if (endpointTypeId == endpoints[i].endpointTypeRef) {
return endpoints[i].endpointId
}
}
})
)
}
// WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! // WARNING! WARNING! WARNING! WARNING! WARNING! WARNING!
// //
// Note: these exports are public API. Templates that might have been created in the past and are // Note: these exports are public API. Templates that might have been created in the past and are
...@@ -348,3 +369,4 @@ exports.user_cluster_has_enabled_command = user_cluster_has_enabled_command ...@@ -348,3 +369,4 @@ exports.user_cluster_has_enabled_command = user_cluster_has_enabled_command
exports.user_session_key = user_session_key exports.user_session_key = user_session_key
exports.user_manufacturer_code = user_manufacturer_code exports.user_manufacturer_code = user_manufacturer_code
exports.user_default_response_policy = user_default_response_policy exports.user_default_response_policy = user_default_response_policy
exports.endpoint_type_identifier = endpoint_type_identifier
...@@ -159,6 +159,17 @@ function isEqual(string_a, string_b) { ...@@ -159,6 +159,17 @@ function isEqual(string_a, string_b) {
return string_a.trim() === string_b.trim() return string_a.trim() === string_b.trim()
} }
/**
* This returns a boolean based on the 2 strings being equal or not given that both
* @param {*} string_a
* @param {*} string_b
*/
function is_lowercase_equal(string_a, string_b) {
str1 = string_a.toLowerCase().replace(/"/g, '').trim()
str2 = string_b.toLowerCase().replace(/"/g, '').trim()
return 0 == str1.localeCompare(str2)
}
function toggle(condition, trueResult, falseResult) { function toggle(condition, trueResult, falseResult) {
return condition ? trueResult : falseResult return condition ? trueResult : falseResult
} }
...@@ -289,6 +300,14 @@ function after(options) { ...@@ -289,6 +300,14 @@ function after(options) {
}) })
} }
/**
* Given: A list of strings
* Returns a concatenated string with spaces between each string
*/
function concatenate() {
return Array.prototype.slice.call(arguments, 0, -1).join(' ')
}
const dep = templateUtil.deprecatedHelper const dep = templateUtil.deprecatedHelper
// WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! // WARNING! WARNING! WARNING! WARNING! WARNING! WARNING!
...@@ -318,3 +337,5 @@ exports.iterateAccumulator = dep(iterateAccumulator, { ...@@ -318,3 +337,5 @@ exports.iterateAccumulator = dep(iterateAccumulator, {
}) })
exports.after = after exports.after = after
exports.toggle = toggle exports.toggle = toggle
exports.concatenate = concatenate
exports.is_lowercase_equal = is_lowercase_equal
...@@ -27,6 +27,7 @@ const testUtil = require('./test-util.js') ...@@ -27,6 +27,7 @@ const testUtil = require('./test-util.js')
const zclLoader = require('../src-electron/zcl/zcl-loader.js') const zclLoader = require('../src-electron/zcl/zcl-loader.js')
const zclHelper = require('../src-electron/generator/helper-zcl.js') const zclHelper = require('../src-electron/generator/helper-zcl.js')
const dbEnum = require('../src-shared/db-enum.js') const dbEnum = require('../src-shared/db-enum.js')
const zapHelper = require('../src-electron/generator/helper-zap.js')
let db let db
const templateCount = 13 const templateCount = 13
...@@ -176,3 +177,10 @@ test('Various small Helper', () => { ...@@ -176,3 +177,10 @@ test('Various small Helper', () => {
expect(result).toBe(dbEnum.zclType.struct) expect(result).toBe(dbEnum.zclType.struct)
}) })
}) })
/*
helper-zap.js
*/
test('Various small Helper', () => {
expect(zapHelper.is_lowercase_equal('A', 'a')).toBeTruthy()
})
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册