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

Deal with struct types that refer to bitmaps.

上级 3e99ae43
No related branches found
No related tags found
无相关合并请求
...@@ -170,7 +170,7 @@ exports.map = { ...@@ -170,7 +170,7 @@ exports.map = {
return { return {
id: x.BITMAP_ID, id: x.BITMAP_ID,
label: x.NAME, label: x.NAME,
caption: `Bitmap of type ${x.TYPE}`, type: x.TYPE,
} }
}, },
......
...@@ -110,7 +110,7 @@ function selectAllBitmapFields(db, packageId = null) { ...@@ -110,7 +110,7 @@ function selectAllBitmapFields(db, packageId = null) {
.then((rows) => rows.map(dbMapping.map.bitmapField)) .then((rows) => rows.map(dbMapping.map.bitmapField))
} }
function selectBitmapByName(db, name, packageId) { function selectBitmapByName(db, packageId, name) {
return dbApi return dbApi
.dbGet( .dbGet(
db, db,
......
...@@ -19,6 +19,7 @@ const queryZcl = require('../db/query-zcl.js') ...@@ -19,6 +19,7 @@ const queryZcl = require('../db/query-zcl.js')
const templateUtil = require('./template-util.js') const templateUtil = require('./template-util.js')
const bin = require('../util/bin.js') const bin = require('../util/bin.js')
const { exportClustersFromEndpointType } = require('../db/query-impexp.js') const { exportClustersFromEndpointType } = require('../db/query-impexp.js')
const { query } = require('express')
/** /**
* This module contains the API for templating. For more detailed instructions, read {@tutorial template-tutorial} * This module contains the API for templating. For more detailed instructions, read {@tutorial template-tutorial}
...@@ -166,9 +167,23 @@ function asUnderlyingType(value) { ...@@ -166,9 +167,23 @@ function asUnderlyingType(value) {
) )
.then((atomic) => { .then((atomic) => {
if (atomic == null) { if (atomic == null) {
// try to retrieve the atomic as a bitmap. return queryZcl
.selectBitmapByName(this.global.db, this.global.packageId, value)
.then((bitmap) => {
if (bitmap == null) {
return atomic
} else {
return queryZcl.selectAtomicType(
this.global.db,
this.global.packageId,
bitmap.type
)
}
})
} else {
// Just pass it through
return atomic
} }
return atomic
}) })
.then((atomic) => { .then((atomic) => {
if (atomic == null) { if (atomic == null) {
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册