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

Add a unit test for new reporting policy, and fix some loader issues that the unit test discovered.

上级 391c8c0f
No related branches found
No related tags found
无相关合并请求
......@@ -91,6 +91,9 @@ async function collectDataFromJsonFile(metadataFile, data) {
// Default reportability.
// `defaultReportable` was old thing that could be true or false.
// We still honor it.
returnObject.defaultReportingPolicy =
dbEnum.reportingPolicy.defaultReportingPolicy
if ('defaultReportable' in obj) {
returnObject.defaultReportingPolicy = obj.defaultReportable
? dbEnum.reportingPolicy.suggested
......@@ -103,7 +106,6 @@ async function collectDataFromJsonFile(metadataFile, data) {
obj.defaultReportingPolicy
)
}
returnObject.version = obj.version
returnObject.supportCustomZclDevice = obj.supportCustomZclDevice
......
......@@ -116,11 +116,12 @@ exports.sessionOption = {
profileCodes: 'profileCodes',
}
exports.reportingPolicy = {
const reportingPolicy = {
mandatory: 'mandatory',
suggested: 'suggested',
optional: 'optional',
prohibited: 'prohibited',
defaultReportingPolicy: 'optional',
resolve: (txt) => {
switch (txt) {
case reportingPolicy.mandatory:
......@@ -130,11 +131,13 @@ exports.reportingPolicy = {
return txt
default:
// Default
return reportingPolicy.optional
return reportingPolicy.defaultReportingPolicy
}
},
}
exports.reportingPolicy = reportingPolicy
// When SDK supports a custom device, these are the default values for it.
exports.customDevice = {
domain: 'Custom',
......
......@@ -208,6 +208,7 @@ test(
let epc = genResult.content['test1.out']
expect(epc).not.toBeNull()
expect(epc).toContain('Test1 template.')
expect(epc).toContain('- attribute: at2 => true => mandatory')
epc = genResult.content['out/test1.out']
expect(epc).not.toBeNull()
......
......@@ -33,7 +33,7 @@ limitations under the License.
<description>at1</description>
<access op="write" role="manage" modifier="fabric-scoped"/>
</attribute>
<attribute side="server" code="0x0001" define="AT2" type="INT16U" writable="false" optional="true" isNullable="true">
<attribute side="server" code="0x0001" define="AT2" type="INT16U" writable="false" optional="true" isNullable="true" reportingPolicy="mandatory">
<description>at2</description>
<access modifier="fabric-sensitive"/>
</attribute>
......@@ -62,7 +62,7 @@ limitations under the License.
<description>at1</description>
<access op="write" role="manage" modifier="fabric-scoped"/>
</attribute>
<attribute side="server" code="0x0001" define="AT2" type="INT16U" writable="false" optional="true" isNullable="true">
<attribute side="server" code="0x0001" define="AT2" type="INT16U" writable="false" optional="true" isNullable="true" reportingPolicy="prohibited">
<description>at2</description>
<access modifier="fabric-sensitive"/>
</attribute>
......
......@@ -42,4 +42,9 @@ Attributes [{{endpoint_attribute_count}}]:
{{/endpoint_config}}
Reporting policy:
{{#zcl_attributes}}
- attribute: {{name}} => {{isReportable}} => {{reportingPolicy}}
{{/zcl_attributes}}
{{/zcl_clusters}}
\ No newline at end of file
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册