From 4e86527edca0c52e67da45b0ca25858b53e44b13 Mon Sep 17 00:00:00 2001 From: joonhaengHeo <85541460+joonhaengHeo@users.noreply.github.com> Date: Fri, 4 Aug 2023 16:08:33 +0900 Subject: [PATCH] Modify Java helper (#1092) --- .../controller/java/templates/helper.js | 29 ++++++++++++++----- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/src-electron/generator/matter/controller/java/templates/helper.js b/src-electron/generator/matter/controller/java/templates/helper.js index 50ccf9a600..47632fedae 100644 --- a/src-electron/generator/matter/controller/java/templates/helper.js +++ b/src-electron/generator/matter/controller/java/templates/helper.js @@ -113,14 +113,29 @@ function asJniBasicType(type, useBoxedTypes) { return 'jbyteArray'; } else if (StringHelper.isCharString(type)) { return 'jstring'; - } else { - if (useBoxedTypes) { - return 'jobject'; - } - return convertBasicCTypeToJniType( - ChipTypesHelper.asBasicType(this.chipType) - ); + } else if (useBoxedTypes) { + return 'jobject'; + } + function fn(pkgId) { + const options = { hash: {} }; + return zclHelper.asUnderlyingZclType + .call(this, type, options) + .then((zclType) => { + return convertBasicCTypeToJniType( + ChipTypesHelper.asBasicType(zclType), + false + ); + }); } + + const promise = templateUtil + .ensureZclPackageIds(this) + .then(fn.bind(this)) + .catch((err) => { + console.log(err); + throw err; + }); + return templateUtil.templatePromise(this.global, promise); } function asJniSignatureBasic(type, useBoxedTypes) {