From 11785609fff0dcc355ef11d136d2854a2edd033b Mon Sep 17 00:00:00 2001
From: fesseha-eve <88329315+fessehaeve@users.noreply.github.com>
Date: Mon, 13 Dec 2021 17:13:24 +0100
Subject: [PATCH] Add featuremap for thermostat and power source clusters
(#12903)
* Add featuremap definitions in Thermostat and Power Source cluster
+ moved thermostat cluster to a separate file
* Regenerate all
* Removed attributelist
+ add cluster element to feature bitmaps
* Regenerate all
* More discoballing of thermostat cluster definition
* Regenerate all
---
.../all-clusters-common/all-clusters-app.zap | 4 +-
examples/lock-app/lock-common/lock-app.zap | 5 +-
.../thermostat-common/thermostat.zap | 34 +--
.../tv-casting-common/tv-casting-app.zap | 4 +-
src/app/zap-templates/zcl/data-model/all.xml | 1 +
.../data-model/chip/power-source-cluster.xml | 8 +
.../data-model/chip/thermostat-cluster.xml | 138 +++++++++++++
.../zcl/data-model/silabs/ha.xml | 108 ----------
src/app/zap-templates/zcl/zcl.json | 1 +
.../data_model/controller-clusters.zap | 8 +-
.../java/zap-generated/CHIPCallbackTypes.h | 4 +
.../java/zap-generated/CHIPClusters-JNI.cpp | 18 +-
.../zap-generated/CHIPInvokeCallbacks.cpp | 178 ++++++++++++++++
.../java/zap-generated/CHIPInvokeCallbacks.h | 30 +++
.../chip/devicecontroller/ChipClusters.java | 33 ++-
.../devicecontroller/ClusterInfoMapping.java | 92 ++++++++-
.../python/chip/clusters/Objects.py | 10 +-
.../CHIP/zap-generated/CHIPCallbackBridge.mm | 59 ++++++
.../CHIPCallbackBridge_internal.h | 30 +++
.../CHIP/zap-generated/CHIPClustersObjc.h | 6 +-
.../CHIP/zap-generated/CHIPClustersObjc.mm | 26 +--
.../zap-generated/CHIPCommandPayloadsObjc.h | 4 +-
.../zap-generated/CHIPCommandPayloadsObjc.mm | 4 +-
.../zap-generated/attributes/Accessors.cpp | 4 +-
.../zap-generated/attributes/Accessors.h | 4 +-
.../app-common/zap-generated/callback.h | 19 +-
.../zap-generated/cluster-objects.cpp | 8 +-
.../zap-generated/cluster-objects.h | 54 +++--
.../app-common/zap-generated/command-id.h | 4 +-
.../app-common/zap-generated/enums.h | 20 ++
.../app-common/zap-generated/ids/Attributes.h | 4 +-
.../app-common/zap-generated/ids/Commands.h | 8 +-
.../zap-generated/cluster/Commands.h | 68 +++++-
.../zap-generated/CHIPClientCallbacks.cpp | 40 ++++
.../zap-generated/CHIPClientCallbacks.h | 6 +
.../zap-generated/IMClusterCommandHandler.cpp | 194 ++++++++++++++++++
.../lock-app/zap-generated/endpoint_config.h | 4 +-
37 files changed, 1011 insertions(+), 231 deletions(-)
create mode 100644 src/app/zap-templates/zcl/data-model/chip/thermostat-cluster.xml
diff --git a/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap b/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap
index 22b6ce52d74847..01ab1953daf560 100644
--- a/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap
+++ b/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap
@@ -11124,7 +11124,7 @@
"enabled": 1,
"commands": [
{
- "name": "CurrentWeeklySchedule",
+ "name": "GetWeeklyScheduleResponse",
"code": 0,
"mfgCode": null,
"source": "server",
@@ -11132,7 +11132,7 @@
"outgoing": 0
},
{
- "name": "RelayStatusLog",
+ "name": "GetRelayStatusLogResponse",
"code": 1,
"mfgCode": null,
"source": "server",
diff --git a/examples/lock-app/lock-common/lock-app.zap b/examples/lock-app/lock-common/lock-app.zap
index ccc73eb30b5c14..1770fad717b070 100644
--- a/examples/lock-app/lock-common/lock-app.zap
+++ b/examples/lock-app/lock-common/lock-app.zap
@@ -1298,7 +1298,7 @@
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
- "defaultValue": "0",
+ "defaultValue": "1",
"reportable": 0,
"minInterval": 1,
"maxInterval": 65534,
@@ -5588,5 +5588,6 @@
"endpointVersion": 1,
"deviceIdentifier": 10
}
- ]
+ ],
+ "log": []
}
\ No newline at end of file
diff --git a/examples/thermostat/thermostat-common/thermostat.zap b/examples/thermostat/thermostat-common/thermostat.zap
index bc4deeef9ddb5a..65b81725bc91e2 100644
--- a/examples/thermostat/thermostat-common/thermostat.zap
+++ b/examples/thermostat/thermostat-common/thermostat.zap
@@ -10414,7 +10414,7 @@
"enabled": 1,
"commands": [
{
- "name": "CurrentWeeklySchedule",
+ "name": "GetWeeklyScheduleResponse",
"code": 0,
"mfgCode": null,
"source": "server",
@@ -10422,7 +10422,7 @@
"outgoing": 1
},
{
- "name": "RelayStatusLog",
+ "name": "GetRelayStatusLogResponse",
"code": 1,
"mfgCode": null,
"source": "server",
@@ -12416,7 +12416,7 @@
],
"attributes": [
{
- "name": "tv channel list",
+ "name": "channel list",
"code": 0,
"mfgCode": null,
"side": "server",
@@ -12431,7 +12431,7 @@
"reportableChange": 0
},
{
- "name": "tv channel lineup",
+ "name": "channel lineup",
"code": 1,
"mfgCode": null,
"side": "server",
@@ -12446,7 +12446,7 @@
"reportableChange": 0
},
{
- "name": "current tv channel",
+ "name": "current channel",
"code": 2,
"mfgCode": null,
"side": "server",
@@ -13100,7 +13100,7 @@
"reportableChange": 0
},
{
- "name": "supported streaming types",
+ "name": "supported streaming protocols",
"code": 1,
"mfgCode": null,
"side": "server",
@@ -13396,7 +13396,7 @@
"reportableChange": 0
},
{
- "name": "application id",
+ "name": "application status",
"code": 5,
"mfgCode": null,
"side": "server",
@@ -13411,7 +13411,7 @@
"reportableChange": 0
},
{
- "name": "catalog vendor id",
+ "name": "application version",
"code": 6,
"mfgCode": null,
"side": "server",
@@ -13425,21 +13425,6 @@
"maxInterval": 65344,
"reportableChange": 0
},
- {
- "name": "application status",
- "code": 7,
- "mfgCode": null,
- "side": "server",
- "included": 1,
- "storageOption": "RAM",
- "singleton": 0,
- "bounded": 0,
- "defaultValue": "0x01",
- "reportable": 1,
- "minInterval": 0,
- "maxInterval": 65344,
- "reportableChange": 0
- },
{
"name": "ClusterRevision",
"code": 65533,
@@ -13935,5 +13920,6 @@
"endpointVersion": 1,
"deviceIdentifier": 769
}
- ]
+ ],
+ "log": []
}
\ No newline at end of file
diff --git a/examples/tv-casting-app/tv-casting-common/tv-casting-app.zap b/examples/tv-casting-app/tv-casting-common/tv-casting-app.zap
index 737de10220f581..b1ae7546bc821f 100644
--- a/examples/tv-casting-app/tv-casting-common/tv-casting-app.zap
+++ b/examples/tv-casting-app/tv-casting-common/tv-casting-app.zap
@@ -10016,7 +10016,7 @@
"enabled": 1,
"commands": [
{
- "name": "CurrentWeeklySchedule",
+ "name": "GetWeeklyScheduleResponse",
"code": 0,
"mfgCode": null,
"source": "server",
@@ -10024,7 +10024,7 @@
"outgoing": 1
},
{
- "name": "RelayStatusLog",
+ "name": "GetRelayStatusLogResponse",
"code": 1,
"mfgCode": null,
"source": "server",
diff --git a/src/app/zap-templates/zcl/data-model/all.xml b/src/app/zap-templates/zcl/data-model/all.xml
index 1bbbde543e01d1..feb167213830c0 100644
--- a/src/app/zap-templates/zcl/data-model/all.xml
+++ b/src/app/zap-templates/zcl/data-model/all.xml
@@ -52,6 +52,7 @@
+
diff --git a/src/app/zap-templates/zcl/data-model/chip/power-source-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/power-source-cluster.xml
index 664efc1b23f07b..cc31b480ad0ee8 100644
--- a/src/app/zap-templates/zcl/data-model/chip/power-source-cluster.xml
+++ b/src/app/zap-templates/zcl/data-model/chip/power-source-cluster.xml
@@ -82,6 +82,14 @@ limitations under the License.
+
+
+
+
+
+
+
+
diff --git a/src/app/zap-templates/zcl/data-model/chip/thermostat-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/thermostat-cluster.xml
new file mode 100644
index 00000000000000..59c42899dd556d
--- /dev/null
+++ b/src/app/zap-templates/zcl/data-model/chip/thermostat-cluster.xml
@@ -0,0 +1,138 @@
+
+
+
+
+
+ Thermostat
+ HVAC
+ An interface for configuring and controlling the functionality of a thermostat.
+ 0x0201
+ THERMOSTAT_CLUSTER
+ true
+ true
+
+ local temperature
+ outdoor temperature
+ occupancy
+
+ abs min heat setpoint limit
+ abs max heat setpoint limit
+ abs min cool setpoint limit
+ abs max cool setpoint limit
+ pi cooling demand
+ pi heating demand
+ HVAC system type configuration
+ local temperature calibration
+ occupied cooling setpoint
+ occupied heating setpoint
+ unoccupied cooling setpoint
+ unoccupied heating setpoint
+ min heat setpoint limit
+ max heat setpoint limit
+ min cool setpoint limit
+ max cool setpoint limit
+ min setpoint dead band
+ remote sensing
+ control sequence of operation
+ system mode
+ alarm mask
+
+ thermostat running mode
+ start of week
+ number of weekly transitions
+ number of daily transitions
+ temperature setpoint hold
+ temperature setpoint hold duration
+ thermostat programming operation mode
+ thermostat running state
+ setpoint change source
+ setpoint change amount
+ setpoint change source timestamp
+ ac type
+ ac capacity
+ ac refrigerant type
+ ac compressor
+ ac error code
+ ac louver position
+ ac coil temperature
+ ac capacity format
+
+
+ Command description for SetpointRaiseLower
+
+
+
+
+
+
+ Command description for SetWeeklySchedule
+
+
+
+
+
+
+
+
+ Command description for GetWeeklySchedule
+
+
+
+
+
+
+ The Clear Weekly Schedule command is used to clear the weekly schedule.
+
+
+
+
+ The Get Relay Status Log command is used to query the thermostat internal relay status log.
+
+
+
+
+ The Current Weekly Schedule Command is sent from the server in response to the Get Weekly Schedule Command.
+
+
+
+
+
+
+
+
+ This command is sent from the thermostat cluster server in response to the Get Relay Status Log.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/app/zap-templates/zcl/data-model/silabs/ha.xml b/src/app/zap-templates/zcl/data-model/silabs/ha.xml
index 3a47091f9d00e8..9c79336545174e 100644
--- a/src/app/zap-templates/zcl/data-model/silabs/ha.xml
+++ b/src/app/zap-templates/zcl/data-model/silabs/ha.xml
@@ -45,114 +45,6 @@ limitations under the License.
mode
-
- Thermostat
- HVAC
- An interface for configuring and controlling the functionality of a thermostat.
- 0x0201
- THERMOSTAT_CLUSTER
- true
- true
-
- local temperature
- outdoor temperature
- occupancy
-
- abs min heat setpoint limit
- abs max heat setpoint limit
- abs min cool setpoint limit
- abs max cool setpoint limit
- pi cooling demand
- pi heating demand
- HVAC system type configuration
- local temperature calibration
- occupied cooling setpoint
- occupied heating setpoint
- unoccupied cooling setpoint
- unoccupied heating setpoint
- min heat setpoint limit
- max heat setpoint limit
- min cool setpoint limit
- max cool setpoint limit
- min setpoint dead band
- remote sensing
- control sequence of operation
- system mode
- alarm mask
-
- thermostat running mode
- start of week
- number of weekly transitions
- number of daily transitions
- temperature setpoint hold
- temperature setpoint hold duration
- thermostat programming operation mode
- hvac relay state
- setpoint change source
- setpoint change amount
- setpoint change source timestamp
- ac type
- ac capacity
- ac refrigerant type
- ac compressor
- ac error code
- ac louver position
- ac coil temperature
- ac capacity format
-
-
- Command description for SetpointRaiseLower
-
-
-
-
-
-
- Command description for SetWeeklySchedule
-
-
-
-
-
-
-
-
- Command description for GetWeeklySchedule
-
-
-
-
-
-
- The Clear Weekly Schedule command is used to clear the weekly schedule.
-
-
-
-
- The Get Relay Status Log command is used to query the thermostat internal relay status log.
-
-
-
-
- The Current Weekly Schedule Command is sent from the server in response to the Get Weekly Schedule Command.
-
-
-
-
-
-
-
-
- This command is sent from the thermostat cluster server in response to the Get Relay Status Log.
-
-
-
-
-
-
-
-
-
Fan Control
HVAC
diff --git a/src/app/zap-templates/zcl/zcl.json b/src/app/zap-templates/zcl/zcl.json
index 0513b0ea5fff9d..6ef03a94167223 100644
--- a/src/app/zap-templates/zcl/zcl.json
+++ b/src/app/zap-templates/zcl/zcl.json
@@ -54,6 +54,7 @@
"target-navigator-cluster.xml",
"temperature-measurement-cluster.xml",
"test-cluster.xml",
+ "thermostat-cluster.xml",
"thread-network-diagnostics-cluster.xml",
"time-synchronization-cluster.xml",
"tv-channel-cluster.xml",
diff --git a/src/controller/data_model/controller-clusters.zap b/src/controller/data_model/controller-clusters.zap
index a7df038b4381ec..cc574c91de978b 100644
--- a/src/controller/data_model/controller-clusters.zap
+++ b/src/controller/data_model/controller-clusters.zap
@@ -8030,19 +8030,19 @@
"enabled": 0,
"commands": [
{
- "name": "CurrentWeeklySchedule",
+ "name": "GetWeeklyScheduleResponse",
"code": 0,
"mfgCode": null,
"source": "server",
- "incoming": 0,
+ "incoming": 1,
"outgoing": 0
},
{
- "name": "RelayStatusLog",
+ "name": "GetRelayStatusLogResponse",
"code": 1,
"mfgCode": null,
"source": "server",
- "incoming": 0,
+ "incoming": 1,
"outgoing": 0
}
],
diff --git a/src/controller/java/zap-generated/CHIPCallbackTypes.h b/src/controller/java/zap-generated/CHIPCallbackTypes.h
index 3247fa7bb89ccf..88f567f9050298 100644
--- a/src/controller/java/zap-generated/CHIPCallbackTypes.h
+++ b/src/controller/java/zap-generated/CHIPCallbackTypes.h
@@ -1113,6 +1113,10 @@ typedef void (*CHIPTestClusterClusterAttributeListAttributeCallbackType)(
void *, const chip::app::Clusters::TestCluster::Attributes::AttributeList::TypeInfo::DecodableType &);
typedef void (*CHIPTestClusterClusterClusterRevisionAttributeCallbackType)(
void *, chip::app::Clusters::TestCluster::Attributes::ClusterRevision::TypeInfo::DecodableArgType);
+typedef void (*CHIPThermostatClusterGetRelayStatusLogResponseCallbackType)(
+ void *, const chip::app::Clusters::Thermostat::Commands::GetRelayStatusLogResponse::DecodableType &);
+typedef void (*CHIPThermostatClusterGetWeeklyScheduleResponseCallbackType)(
+ void *, const chip::app::Clusters::Thermostat::Commands::GetWeeklyScheduleResponse::DecodableType &);
typedef void (*CHIPThermostatClusterLocalTemperatureAttributeCallbackType)(
void *, chip::app::Clusters::Thermostat::Attributes::LocalTemperature::TypeInfo::DecodableArgType);
diff --git a/src/controller/java/zap-generated/CHIPClusters-JNI.cpp b/src/controller/java/zap-generated/CHIPClusters-JNI.cpp
index d9d2eedbaee64b..60726bea37aa1b 100644
--- a/src/controller/java/zap-generated/CHIPClusters-JNI.cpp
+++ b/src/controller/java/zap-generated/CHIPClusters-JNI.cpp
@@ -30756,8 +30756,10 @@ JNI_METHOD(void, ThermostatCluster, getRelayStatusLog)(JNIEnv * env, jobject sel
chip::app::Clusters::Thermostat::Commands::GetRelayStatusLog::Type request;
- std::unique_ptr onSuccess(
- Platform::New(callback), Platform::Delete);
+ std::unique_ptr
+ onSuccess(Platform::New(callback),
+ Platform::Delete);
std::unique_ptr onFailure(
Platform::New(callback), Platform::Delete);
VerifyOrReturn(onSuccess.get() != nullptr,
@@ -30772,7 +30774,8 @@ JNI_METHOD(void, ThermostatCluster, getRelayStatusLog)(JNIEnv * env, jobject sel
AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(
env, callback, "Error getting native cluster", CHIP_ERROR_INCORRECT_STATE));
- auto successFn = chip::Callback::Callback::FromCancelable(onSuccess->Cancel());
+ auto successFn =
+ chip::Callback::Callback::FromCancelable(onSuccess->Cancel());
auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel());
err = cppCluster->InvokeCommand(request, onSuccess->mContext, successFn->mCall, failureFn->mCall);
@@ -30797,8 +30800,10 @@ JNI_METHOD(void, ThermostatCluster, getWeeklySchedule)
request.modeToReturn =
static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(modeToReturn));
- std::unique_ptr onSuccess(
- Platform::New(callback), Platform::Delete);
+ std::unique_ptr
+ onSuccess(Platform::New(callback),
+ Platform::Delete);
std::unique_ptr onFailure(
Platform::New(callback), Platform::Delete);
VerifyOrReturn(onSuccess.get() != nullptr,
@@ -30813,7 +30818,8 @@ JNI_METHOD(void, ThermostatCluster, getWeeklySchedule)
AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(
env, callback, "Error getting native cluster", CHIP_ERROR_INCORRECT_STATE));
- auto successFn = chip::Callback::Callback::FromCancelable(onSuccess->Cancel());
+ auto successFn =
+ chip::Callback::Callback::FromCancelable(onSuccess->Cancel());
auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel());
err = cppCluster->InvokeCommand(request, onSuccess->mContext, successFn->mCall, failureFn->mCall);
diff --git a/src/controller/java/zap-generated/CHIPInvokeCallbacks.cpp b/src/controller/java/zap-generated/CHIPInvokeCallbacks.cpp
index 4cdcd9770a2b8c..ab9deedbeb5c5d 100644
--- a/src/controller/java/zap-generated/CHIPInvokeCallbacks.cpp
+++ b/src/controller/java/zap-generated/CHIPInvokeCallbacks.cpp
@@ -4156,4 +4156,182 @@ void CHIPTestClusterClusterTestSpecificResponseCallback::CallbackFn(
env->CallVoidMethod(javaCallbackRef, javaMethod, returnValue);
}
+CHIPThermostatClusterGetRelayStatusLogResponseCallback::CHIPThermostatClusterGetRelayStatusLogResponseCallback(
+ jobject javaCallback) :
+ Callback::Callback(CallbackFn, this)
+{
+ JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread();
+ if (env == nullptr)
+ {
+ ChipLogError(Zcl, "Could not create global reference for Java callback");
+ return;
+ }
+
+ javaCallbackRef = env->NewGlobalRef(javaCallback);
+ if (javaCallbackRef == nullptr)
+ {
+ ChipLogError(Zcl, "Could not create global reference for Java callback");
+ }
+}
+
+CHIPThermostatClusterGetRelayStatusLogResponseCallback::~CHIPThermostatClusterGetRelayStatusLogResponseCallback()
+{
+ JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread();
+ if (env == nullptr)
+ {
+ ChipLogError(Zcl, "Could not delete global reference for Java callback");
+ return;
+ }
+ env->DeleteGlobalRef(javaCallbackRef);
+};
+
+void CHIPThermostatClusterGetRelayStatusLogResponseCallback::CallbackFn(
+ void * context, const chip::app::Clusters::Thermostat::Commands::GetRelayStatusLogResponse::DecodableType & dataResponse)
+{
+ chip::DeviceLayer::StackUnlock unlock;
+ CHIP_ERROR err = CHIP_NO_ERROR;
+ JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread();
+ jobject javaCallbackRef;
+ jmethodID javaMethod;
+
+ VerifyOrReturn(env != nullptr, ChipLogError(Zcl, "Error invoking Java callback: no JNIEnv"));
+
+ std::unique_ptr
+ cppCallback(reinterpret_cast(context),
+ chip::Platform::Delete);
+ VerifyOrReturn(cppCallback != nullptr, ChipLogError(Zcl, "Error invoking Java callback: failed to cast native callback"));
+
+ javaCallbackRef = cppCallback->javaCallbackRef;
+ // Java callback is allowed to be null, exit early if this is the case.
+ VerifyOrReturn(javaCallbackRef != nullptr);
+
+ err = JniReferences::GetInstance().FindMethod(
+ env, javaCallbackRef, "onSuccess",
+ "(Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Integer;)V",
+ &javaMethod);
+ VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error invoking Java callback: %s", ErrorStr(err)));
+
+ jobject timeOfDay;
+
+ std::string timeOfDayClassName = "java/lang/Integer";
+ std::string timeOfDayCtorSignature = "(I)V";
+ chip::JniReferences::GetInstance().CreateBoxedObject(timeOfDayClassName.c_str(), timeOfDayCtorSignature.c_str(),
+ dataResponse.timeOfDay, timeOfDay);
+ jobject relayStatus;
+
+ std::string relayStatusClassName = "java/lang/Integer";
+ std::string relayStatusCtorSignature = "(I)V";
+ chip::JniReferences::GetInstance().CreateBoxedObject(relayStatusClassName.c_str(), relayStatusCtorSignature.c_str(),
+ dataResponse.relayStatus, relayStatus);
+ jobject localTemperature;
+
+ std::string localTemperatureClassName = "java/lang/Integer";
+ std::string localTemperatureCtorSignature = "(I)V";
+ chip::JniReferences::GetInstance().CreateBoxedObject(
+ localTemperatureClassName.c_str(), localTemperatureCtorSignature.c_str(), dataResponse.localTemperature, localTemperature);
+ jobject humidityInPercentage;
+
+ std::string humidityInPercentageClassName = "java/lang/Integer";
+ std::string humidityInPercentageCtorSignature = "(I)V";
+ chip::JniReferences::GetInstance().CreateBoxedObject(humidityInPercentageClassName.c_str(),
+ humidityInPercentageCtorSignature.c_str(),
+ dataResponse.humidityInPercentage, humidityInPercentage);
+ jobject setpoint;
+
+ std::string setpointClassName = "java/lang/Integer";
+ std::string setpointCtorSignature = "(I)V";
+ chip::JniReferences::GetInstance().CreateBoxedObject(setpointClassName.c_str(), setpointCtorSignature.c_str(),
+ dataResponse.setpoint, setpoint);
+ jobject unreadEntries;
+
+ std::string unreadEntriesClassName = "java/lang/Integer";
+ std::string unreadEntriesCtorSignature = "(I)V";
+ chip::JniReferences::GetInstance().CreateBoxedObject(
+ unreadEntriesClassName.c_str(), unreadEntriesCtorSignature.c_str(), dataResponse.unreadEntries, unreadEntries);
+
+ env->CallVoidMethod(javaCallbackRef, javaMethod, timeOfDay, relayStatus, localTemperature, humidityInPercentage, setpoint,
+ unreadEntries);
+}
+CHIPThermostatClusterGetWeeklyScheduleResponseCallback::CHIPThermostatClusterGetWeeklyScheduleResponseCallback(
+ jobject javaCallback) :
+ Callback::Callback(CallbackFn, this)
+{
+ JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread();
+ if (env == nullptr)
+ {
+ ChipLogError(Zcl, "Could not create global reference for Java callback");
+ return;
+ }
+
+ javaCallbackRef = env->NewGlobalRef(javaCallback);
+ if (javaCallbackRef == nullptr)
+ {
+ ChipLogError(Zcl, "Could not create global reference for Java callback");
+ }
+}
+
+CHIPThermostatClusterGetWeeklyScheduleResponseCallback::~CHIPThermostatClusterGetWeeklyScheduleResponseCallback()
+{
+ JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread();
+ if (env == nullptr)
+ {
+ ChipLogError(Zcl, "Could not delete global reference for Java callback");
+ return;
+ }
+ env->DeleteGlobalRef(javaCallbackRef);
+};
+
+void CHIPThermostatClusterGetWeeklyScheduleResponseCallback::CallbackFn(
+ void * context, const chip::app::Clusters::Thermostat::Commands::GetWeeklyScheduleResponse::DecodableType & dataResponse)
+{
+ chip::DeviceLayer::StackUnlock unlock;
+ CHIP_ERROR err = CHIP_NO_ERROR;
+ JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread();
+ jobject javaCallbackRef;
+ jmethodID javaMethod;
+
+ VerifyOrReturn(env != nullptr, ChipLogError(Zcl, "Error invoking Java callback: no JNIEnv"));
+
+ std::unique_ptr
+ cppCallback(reinterpret_cast(context),
+ chip::Platform::Delete);
+ VerifyOrReturn(cppCallback != nullptr, ChipLogError(Zcl, "Error invoking Java callback: failed to cast native callback"));
+
+ javaCallbackRef = cppCallback->javaCallbackRef;
+ // Java callback is allowed to be null, exit early if this is the case.
+ VerifyOrReturn(javaCallbackRef != nullptr);
+
+ err = JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess",
+ "(Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Integer;)V", &javaMethod);
+ VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error invoking Java callback: %s", ErrorStr(err)));
+
+ jobject numberOfTransitionsForSequence;
+
+ std::string numberOfTransitionsForSequenceClassName = "java/lang/Integer";
+ std::string numberOfTransitionsForSequenceCtorSignature = "(I)V";
+ chip::JniReferences::GetInstance().CreateBoxedObject(
+ numberOfTransitionsForSequenceClassName.c_str(), numberOfTransitionsForSequenceCtorSignature.c_str(),
+ dataResponse.numberOfTransitionsForSequence, numberOfTransitionsForSequence);
+ jobject dayOfWeekForSequence;
+
+ std::string dayOfWeekForSequenceClassName = "java/lang/Integer";
+ std::string dayOfWeekForSequenceCtorSignature = "(I)V";
+ chip::JniReferences::GetInstance().CreateBoxedObject>(
+ dayOfWeekForSequenceClassName.c_str(), dayOfWeekForSequenceCtorSignature.c_str(), dataResponse.dayOfWeekForSequence,
+ dayOfWeekForSequence);
+ jobject modeForSequence;
+
+ std::string modeForSequenceClassName = "java/lang/Integer";
+ std::string modeForSequenceCtorSignature = "(I)V";
+ chip::JniReferences::GetInstance().CreateBoxedObject>(
+ modeForSequenceClassName.c_str(), modeForSequenceCtorSignature.c_str(), dataResponse.modeForSequence, modeForSequence);
+ jobject payload;
+
+ payload = nullptr; /* Array - Conversion from this type to Java is not properly implemented yet */
+
+ env->CallVoidMethod(javaCallbackRef, javaMethod, numberOfTransitionsForSequence, dayOfWeekForSequence, modeForSequence,
+ payload);
+}
} // namespace chip
diff --git a/src/controller/java/zap-generated/CHIPInvokeCallbacks.h b/src/controller/java/zap-generated/CHIPInvokeCallbacks.h
index 1d7f32b55d25a2..16a83b5ae49d97 100644
--- a/src/controller/java/zap-generated/CHIPInvokeCallbacks.h
+++ b/src/controller/java/zap-generated/CHIPInvokeCallbacks.h
@@ -897,4 +897,34 @@ class CHIPTestClusterClusterTestSpecificResponseCallback
jobject javaCallbackRef;
};
+class CHIPThermostatClusterGetRelayStatusLogResponseCallback
+ : public Callback::Callback
+{
+public:
+ CHIPThermostatClusterGetRelayStatusLogResponseCallback(jobject javaCallback);
+
+ ~CHIPThermostatClusterGetRelayStatusLogResponseCallback();
+
+ static void CallbackFn(void * context,
+ const chip::app::Clusters::Thermostat::Commands::GetRelayStatusLogResponse::DecodableType & data);
+
+private:
+ jobject javaCallbackRef;
+};
+
+class CHIPThermostatClusterGetWeeklyScheduleResponseCallback
+ : public Callback::Callback
+{
+public:
+ CHIPThermostatClusterGetWeeklyScheduleResponseCallback(jobject javaCallback);
+
+ ~CHIPThermostatClusterGetWeeklyScheduleResponseCallback();
+
+ static void CallbackFn(void * context,
+ const chip::app::Clusters::Thermostat::Commands::GetWeeklyScheduleResponse::DecodableType & data);
+
+private:
+ jobject javaCallbackRef;
+};
+
} // namespace chip
diff --git a/src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java b/src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java
index 8db05defdccf0b..4a0d23f28e2d1b 100644
--- a/src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java
+++ b/src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java
@@ -13848,12 +13848,12 @@ public void clearWeeklySchedule(DefaultClusterCallback callback) {
clearWeeklySchedule(chipClusterPtr, callback);
}
- public void getRelayStatusLog(DefaultClusterCallback callback) {
+ public void getRelayStatusLog(GetRelayStatusLogResponseCallback callback) {
getRelayStatusLog(chipClusterPtr, callback);
}
public void getWeeklySchedule(
- DefaultClusterCallback callback, Integer daysToReturn, Integer modeToReturn) {
+ GetWeeklyScheduleResponseCallback callback, Integer daysToReturn, Integer modeToReturn) {
getWeeklySchedule(chipClusterPtr, callback, daysToReturn, modeToReturn);
}
@@ -13878,11 +13878,12 @@ public void setpointRaiseLower(DefaultClusterCallback callback, Integer mode, In
private native void clearWeeklySchedule(long chipClusterPtr, DefaultClusterCallback Callback);
- private native void getRelayStatusLog(long chipClusterPtr, DefaultClusterCallback Callback);
+ private native void getRelayStatusLog(
+ long chipClusterPtr, GetRelayStatusLogResponseCallback Callback);
private native void getWeeklySchedule(
long chipClusterPtr,
- DefaultClusterCallback Callback,
+ GetWeeklyScheduleResponseCallback Callback,
Integer daysToReturn,
Integer modeToReturn);
@@ -13897,6 +13898,30 @@ private native void setWeeklySchedule(
private native void setpointRaiseLower(
long chipClusterPtr, DefaultClusterCallback Callback, Integer mode, Integer amount);
+ public interface GetRelayStatusLogResponseCallback {
+ void onSuccess(
+ Integer timeOfDay,
+ Integer relayStatus,
+ Integer localTemperature,
+ Integer humidityInPercentage,
+ Integer setpoint,
+ Integer unreadEntries);
+
+ void onError(Exception error);
+ }
+
+ public interface GetWeeklyScheduleResponseCallback {
+ void onSuccess(
+ Integer numberOfTransitionsForSequence,
+ Integer dayOfWeekForSequence,
+ Integer modeForSequence
+ // payload: /* TYPE WARNING: array array defaults to */ uint8_t *
+ // Conversion from this type to Java is not properly implemented yet
+ );
+
+ void onError(Exception error);
+ }
+
public interface AttributeListAttributeCallback {
void onSuccess(List