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

Adding a is_command_default_response_disabled along with...

Adding a is_command_default_response_disabled along with is_command_default_response_enabled for convenience
JIRA: ZAPP-797
上级 313a59ec
No related branches found
No related tags found
无相关合并请求
...@@ -677,6 +677,31 @@ async function is_command_default_response_enabled(command, options) { ...@@ -677,6 +677,31 @@ async function is_command_default_response_enabled(command, options) {
} }
} }
/**
* An if helper to check if default response for a command is disabled or not.
* @param {*} command
* @param {*} options
* @returns true if the the default response policy is either never or
* when the policy is not always and the command has the disable default
* response policy set to true(for eg disableDefaultResponse="true" in xml).
*/
async function is_command_default_response_disabled(command, options) {
let defaultRespPolicy = await querySession.getSessionKeyValue(
this.global.db,
this.global.sessionId,
dbEnum.sessionOption.defaultResponsePolicy
)
if (
defaultRespPolicy.toUpperCase() == 'NEVER' ||
(defaultRespPolicy.toUpperCase() != 'ALWAYS' &&
!command.isDefaultResponseEnabled)
) {
return options.fn(this)
} else {
return options.inverse(this)
}
}
/* /*
* @param {*} endpointTypeId * @param {*} endpointTypeId
* Returns the endpoint type identifier for an endpoint type * Returns the endpoint type identifier for an endpoint type
...@@ -1468,3 +1493,5 @@ exports.all_user_clusters_with_outgoing_commands = ...@@ -1468,3 +1493,5 @@ exports.all_user_clusters_with_outgoing_commands =
exports.all_outgoing_commands_for_cluster = all_outgoing_commands_for_cluster exports.all_outgoing_commands_for_cluster = all_outgoing_commands_for_cluster
exports.is_command_default_response_enabled = exports.is_command_default_response_enabled =
is_command_default_response_enabled is_command_default_response_enabled
exports.is_command_default_response_disabled =
is_command_default_response_disabled
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册