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 valueList); diff --git a/src/controller/java/zap-generated/chip/devicecontroller/ClusterInfoMapping.java b/src/controller/java/zap-generated/chip/devicecontroller/ClusterInfoMapping.java index 4ec43fc15a6404..3f79527e0babce 100644 --- a/src/controller/java/zap-generated/chip/devicecontroller/ClusterInfoMapping.java +++ b/src/controller/java/zap-generated/chip/devicecontroller/ClusterInfoMapping.java @@ -4074,6 +4074,89 @@ public void onError(Exception ex) { } } + public static class DelegatedGetRelayStatusLogResponseCallback + implements ChipClusters.ThermostatCluster.GetRelayStatusLogResponseCallback, + DelegatedClusterCallback { + private ClusterCommandCallback callback; + + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess( + Integer timeOfDay, + Integer relayStatus, + Integer localTemperature, + Integer humidityInPercentage, + Integer setpoint, + Integer unreadEntries) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo timeOfDayResponseValue = new CommandResponseInfo("timeOfDay", "int"); + responseValues.put(timeOfDayResponseValue, timeOfDay); + CommandResponseInfo relayStatusResponseValue = new CommandResponseInfo("relayStatus", "int"); + responseValues.put(relayStatusResponseValue, relayStatus); + CommandResponseInfo localTemperatureResponseValue = + new CommandResponseInfo("localTemperature", "int"); + responseValues.put(localTemperatureResponseValue, localTemperature); + CommandResponseInfo humidityInPercentageResponseValue = + new CommandResponseInfo("humidityInPercentage", "int"); + responseValues.put(humidityInPercentageResponseValue, humidityInPercentage); + CommandResponseInfo setpointResponseValue = new CommandResponseInfo("setpoint", "int"); + responseValues.put(setpointResponseValue, setpoint); + CommandResponseInfo unreadEntriesResponseValue = + new CommandResponseInfo("unreadEntries", "int"); + responseValues.put(unreadEntriesResponseValue, unreadEntries); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception error) { + callback.onFailure(error); + } + } + + public static class DelegatedGetWeeklyScheduleResponseCallback + implements ChipClusters.ThermostatCluster.GetWeeklyScheduleResponseCallback, + DelegatedClusterCallback { + private ClusterCommandCallback callback; + + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public 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 + ) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo numberOfTransitionsForSequenceResponseValue = + new CommandResponseInfo("numberOfTransitionsForSequence", "int"); + responseValues.put( + numberOfTransitionsForSequenceResponseValue, numberOfTransitionsForSequence); + CommandResponseInfo dayOfWeekForSequenceResponseValue = + new CommandResponseInfo("dayOfWeekForSequence", "int"); + responseValues.put(dayOfWeekForSequenceResponseValue, dayOfWeekForSequence); + CommandResponseInfo modeForSequenceResponseValue = + new CommandResponseInfo("modeForSequence", "int"); + responseValues.put(modeForSequenceResponseValue, modeForSequence); + // payload: /* TYPE WARNING: array array defaults to */ uint8_t * + // Conversion from this type to Java is not properly implemented yet + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception error) { + callback.onFailure(error); + } + } + public static class DelegatedThermostatClusterAttributeListAttributeCallback implements ChipClusters.ThermostatCluster.AttributeListAttributeCallback, DelegatedClusterCallback { @@ -9184,9 +9267,10 @@ public Map> getCommandMap() { new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.ThermostatCluster) cluster) - .getRelayStatusLog((DefaultClusterCallback) callback); + .getRelayStatusLog( + (ChipClusters.ThermostatCluster.GetRelayStatusLogResponseCallback) callback); }, - () -> new DelegatedDefaultClusterCallback(), + () -> new DelegatedGetRelayStatusLogResponseCallback(), thermostatgetRelayStatusLogCommandParams); thermostatClusterInteractionInfoMap.put( "getRelayStatusLog", thermostatgetRelayStatusLogInteractionInfo); @@ -9208,11 +9292,11 @@ public Map> getCommandMap() { (cluster, callback, commandArguments) -> { ((ChipClusters.ThermostatCluster) cluster) .getWeeklySchedule( - (DefaultClusterCallback) callback, + (ChipClusters.ThermostatCluster.GetWeeklyScheduleResponseCallback) callback, (Integer) commandArguments.get("daysToReturn"), (Integer) commandArguments.get("modeToReturn")); }, - () -> new DelegatedDefaultClusterCallback(), + () -> new DelegatedGetWeeklyScheduleResponseCallback(), thermostatgetWeeklyScheduleCommandParams); thermostatClusterInteractionInfoMap.put( "getWeeklySchedule", thermostatgetWeeklyScheduleInteractionInfo); diff --git a/src/controller/python/chip/clusters/Objects.py b/src/controller/python/chip/clusters/Objects.py index 6468b2e8d3507e..550c3b62b307a0 100644 --- a/src/controller/python/chip/clusters/Objects.py +++ b/src/controller/python/chip/clusters/Objects.py @@ -17509,7 +17509,7 @@ def descriptor(cls) -> ClusterObjectDescriptor: ClusterObjectFieldDescriptor(Label="temperatureSetpointHold", Tag=0x00000023, Type=typing.Optional[uint]), ClusterObjectFieldDescriptor(Label="temperatureSetpointHoldDuration", Tag=0x00000024, Type=typing.Optional[uint]), ClusterObjectFieldDescriptor(Label="thermostatProgrammingOperationMode", Tag=0x00000025, Type=typing.Optional[uint]), - ClusterObjectFieldDescriptor(Label="hvacRelayState", Tag=0x00000029, Type=typing.Optional[uint]), + ClusterObjectFieldDescriptor(Label="thermostatRunningState", Tag=0x00000029, Type=typing.Optional[uint]), ClusterObjectFieldDescriptor(Label="setpointChangeSource", Tag=0x00000030, Type=typing.Optional[uint]), ClusterObjectFieldDescriptor(Label="setpointChangeAmount", Tag=0x00000031, Type=typing.Optional[int]), ClusterObjectFieldDescriptor(Label="setpointChangeSourceTimestamp", Tag=0x00000032, Type=typing.Optional[uint]), @@ -17557,7 +17557,7 @@ def descriptor(cls) -> ClusterObjectDescriptor: temperatureSetpointHold: 'typing.Optional[uint]' = None temperatureSetpointHoldDuration: 'typing.Optional[uint]' = None thermostatProgrammingOperationMode: 'typing.Optional[uint]' = None - hvacRelayState: 'typing.Optional[uint]' = None + thermostatRunningState: 'typing.Optional[uint]' = None setpointChangeSource: 'typing.Optional[uint]' = None setpointChangeAmount: 'typing.Optional[int]' = None setpointChangeSourceTimestamp: 'typing.Optional[uint]' = None @@ -17600,7 +17600,7 @@ def descriptor(cls) -> ClusterObjectDescriptor: amount: 'int' = 0 @dataclass - class CurrentWeeklySchedule(ClusterCommand): + class GetWeeklyScheduleResponse(ClusterCommand): cluster_id: typing.ClassVar[int] = 0x0201 command_id: typing.ClassVar[int] = 0x0000 is_client: typing.ClassVar[bool] = False @@ -17642,7 +17642,7 @@ def descriptor(cls) -> ClusterObjectDescriptor: payload: 'typing.List[uint]' = field(default_factory=lambda: []) @dataclass - class RelayStatusLog(ClusterCommand): + class GetRelayStatusLogResponse(ClusterCommand): cluster_id: typing.ClassVar[int] = 0x0201 command_id: typing.ClassVar[int] = 0x0001 is_client: typing.ClassVar[bool] = False @@ -18208,7 +18208,7 @@ def attribute_type(cls) -> ClusterObjectFieldDescriptor: value: 'typing.Optional[uint]' = None @dataclass - class HvacRelayState(ClusterAttributeDescriptor): + class ThermostatRunningState(ClusterAttributeDescriptor): @ChipUtility.classproperty def cluster_id(cls) -> int: return 0x0201 diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge.mm b/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge.mm index 46bdaabebd4f18..f4717aa83f90eb 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge.mm +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge.mm @@ -5992,6 +5992,65 @@ DispatchSuccess(context, response); }; +void CHIPThermostatClusterGetRelayStatusLogResponseCallbackBridge::OnSuccessFn( + void * context, const chip::app::Clusters::Thermostat::Commands::GetRelayStatusLogResponse::DecodableType & data) +{ + auto * response = [CHIPThermostatClusterGetRelayStatusLogResponseParams new]; + { + response.timeOfDay = [NSNumber numberWithUnsignedShort:data.timeOfDay]; + } + { + response.relayStatus = [NSNumber numberWithUnsignedShort:data.relayStatus]; + } + { + response.localTemperature = [NSNumber numberWithShort:data.localTemperature]; + } + { + response.humidityInPercentage = [NSNumber numberWithUnsignedChar:data.humidityInPercentage]; + } + { + response.setpoint = [NSNumber numberWithShort:data.setpoint]; + } + { + response.unreadEntries = [NSNumber numberWithUnsignedShort:data.unreadEntries]; + } + DispatchSuccess(context, response); +}; + +void CHIPThermostatClusterGetWeeklyScheduleResponseCallbackBridge::OnSuccessFn( + void * context, const chip::app::Clusters::Thermostat::Commands::GetWeeklyScheduleResponse::DecodableType & data) +{ + auto * response = [CHIPThermostatClusterGetWeeklyScheduleResponseParams new]; + { + response.numberOfTransitionsForSequence = [NSNumber numberWithUnsignedChar:data.numberOfTransitionsForSequence]; + } + { + response.dayOfWeekForSequence = [NSNumber numberWithUnsignedChar:data.dayOfWeekForSequence.Raw()]; + } + { + response.modeForSequence = [NSNumber numberWithUnsignedChar:data.modeForSequence.Raw()]; + } + { + auto * array_0 = [NSMutableArray new]; + auto iter_0 = data.payload.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedChar:entry_0]; + [array_0 addObject:newElement_0]; + } + { // Scope for the error so we will know what it's named + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + OnFailureFn(context, EMBER_ZCL_STATUS_INVALID_VALUE); + return; + } + } + response.payload = array_0; + } + DispatchSuccess(context, response); +}; + void CHIPIdentifyClusterIdentifyEffectIdentifierAttributeCallbackBridge::OnSuccessFn( void * context, chip::app::Clusters::Identify::IdentifyEffectIdentifier value) { diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge_internal.h b/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge_internal.h index 144587c74eeceb..b1a4391e7f1029 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge_internal.h +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge_internal.h @@ -149,6 +149,10 @@ typedef void (*CHIPTestClusterClusterTestNullableOptionalResponseCallbackType)( void *, const chip::app::Clusters::TestCluster::Commands::TestNullableOptionalResponse::DecodableType &); typedef void (*CHIPTestClusterClusterTestSpecificResponseCallbackType)( void *, const chip::app::Clusters::TestCluster::Commands::TestSpecificResponse::DecodableType &); +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 (*IdentifyClusterIdentifyEffectIdentifierAttributeCallback)(void *, chip::app::Clusters::Identify::IdentifyEffectIdentifier); @@ -4777,6 +4781,32 @@ class CHIPTestClusterClusterTestSpecificResponseCallbackBridge const chip::app::Clusters::TestCluster::Commands::TestSpecificResponse::DecodableType & data); }; +class CHIPThermostatClusterGetRelayStatusLogResponseCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPThermostatClusterGetRelayStatusLogResponseCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, + const chip::app::Clusters::Thermostat::Commands::GetRelayStatusLogResponse::DecodableType & data); +}; + +class CHIPThermostatClusterGetWeeklyScheduleResponseCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPThermostatClusterGetWeeklyScheduleResponseCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, + const chip::app::Clusters::Thermostat::Commands::GetWeeklyScheduleResponse::DecodableType & data); +}; + class CHIPIdentifyClusterIdentifyEffectIdentifierAttributeCallbackBridge : public CHIPCallbackBridge { diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.h b/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.h index b012e426c44dd3..260070f8d2abbe 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.h @@ -4148,9 +4148,11 @@ NS_ASSUME_NONNULL_BEGIN @interface CHIPThermostat : CHIPCluster - (void)clearWeeklyScheduleWithCompletionHandler:(StatusCompletion)completionHandler; -- (void)getRelayStatusLogWithCompletionHandler:(StatusCompletion)completionHandler; +- (void)getRelayStatusLogWithCompletionHandler:(void (^)(CHIPThermostatClusterGetRelayStatusLogResponseParams * _Nullable data, + NSError * _Nullable error))completionHandler; - (void)getWeeklyScheduleWithParams:(CHIPThermostatClusterGetWeeklyScheduleParams *)params - completionHandler:(StatusCompletion)completionHandler; + completionHandler:(void (^)(CHIPThermostatClusterGetWeeklyScheduleResponseParams * _Nullable data, + NSError * _Nullable error))completionHandler; - (void)setWeeklyScheduleWithParams:(CHIPThermostatClusterSetWeeklyScheduleParams *)params completionHandler:(StatusCompletion)completionHandler; - (void)setpointRaiseLowerWithParams:(CHIPThermostatClusterSetpointRaiseLowerParams *)params diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.mm b/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.mm index 9166e882a02ab9..6c23ea5ff66896 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.mm @@ -18530,25 +18530,23 @@ new CHIPCommandSuccessCallbackBridge( }); } -- (void)getRelayStatusLogWithCompletionHandler:(StatusCompletion)completionHandler +- (void)getRelayStatusLogWithCompletionHandler:(void (^)(CHIPThermostatClusterGetRelayStatusLogResponseParams * _Nullable data, + NSError * _Nullable error))completionHandler { ListFreer listFreer; Thermostat::Commands::GetRelayStatusLog::Type request; - new CHIPCommandSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable value, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - auto successFn = Callback::FromCancelable(success); + new CHIPThermostatClusterGetRelayStatusLogResponseCallbackBridge( + self.callbackQueue, completionHandler, ^(Cancelable * success, Cancelable * failure) { + auto successFn = Callback::FromCancelable(success); auto failureFn = Callback::FromCancelable(failure); return self.cppCluster.InvokeCommand(request, successFn->mContext, successFn->mCall, failureFn->mCall); }); } - (void)getWeeklyScheduleWithParams:(CHIPThermostatClusterGetWeeklyScheduleParams *)params - completionHandler:(StatusCompletion)completionHandler + completionHandler:(void (^)(CHIPThermostatClusterGetWeeklyScheduleResponseParams * _Nullable data, + NSError * _Nullable error))completionHandler { ListFreer listFreer; Thermostat::Commands::GetWeeklySchedule::Type request; @@ -18557,13 +18555,9 @@ - (void)getWeeklyScheduleWithParams:(CHIPThermostatClusterGetWeeklyScheduleParam request.modeToReturn = static_cast>(params.modeToReturn.unsignedCharValue); - new CHIPCommandSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable value, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - auto successFn = Callback::FromCancelable(success); + new CHIPThermostatClusterGetWeeklyScheduleResponseCallbackBridge( + self.callbackQueue, completionHandler, ^(Cancelable * success, Cancelable * failure) { + auto successFn = Callback::FromCancelable(success); auto failureFn = Callback::FromCancelable(failure); return self.cppCluster.InvokeCommand(request, successFn->mContext, successFn->mCall, failureFn->mCall); }); diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPCommandPayloadsObjc.h b/src/darwin/Framework/CHIP/zap-generated/CHIPCommandPayloadsObjc.h index 8165255c8b9f56..233f94efaeb63e 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPCommandPayloadsObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPCommandPayloadsObjc.h @@ -1211,7 +1211,7 @@ NS_ASSUME_NONNULL_BEGIN - (instancetype)init; @end -@interface CHIPThermostatClusterCurrentWeeklyScheduleParams : NSObject +@interface CHIPThermostatClusterGetWeeklyScheduleResponseParams : NSObject @property (strong, nonatomic) NSNumber * _Nonnull numberOfTransitionsForSequence; @property (strong, nonatomic) NSNumber * _Nonnull dayOfWeekForSequence; @property (strong, nonatomic) NSNumber * _Nonnull modeForSequence; @@ -1227,7 +1227,7 @@ NS_ASSUME_NONNULL_BEGIN - (instancetype)init; @end -@interface CHIPThermostatClusterRelayStatusLogParams : NSObject +@interface CHIPThermostatClusterGetRelayStatusLogResponseParams : NSObject @property (strong, nonatomic) NSNumber * _Nonnull timeOfDay; @property (strong, nonatomic) NSNumber * _Nonnull relayStatus; @property (strong, nonatomic) NSNumber * _Nonnull localTemperature; diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPCommandPayloadsObjc.mm b/src/darwin/Framework/CHIP/zap-generated/CHIPCommandPayloadsObjc.mm index bc919c37cdf4b8..2272f2f76cdbbd 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPCommandPayloadsObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPCommandPayloadsObjc.mm @@ -2570,7 +2570,7 @@ - (instancetype)init } @end -@implementation CHIPThermostatClusterCurrentWeeklyScheduleParams +@implementation CHIPThermostatClusterGetWeeklyScheduleResponseParams - (instancetype)init { if (self = [super init]) { @@ -2604,7 +2604,7 @@ - (instancetype)init } @end -@implementation CHIPThermostatClusterRelayStatusLogParams +@implementation CHIPThermostatClusterGetRelayStatusLogResponseParams - (instancetype)init { if (self = [super init]) { diff --git a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp index 0a8332d14e4090..9f8966f7082a3f 100644 --- a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp +++ b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp @@ -16574,7 +16574,7 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) } // namespace ThermostatProgrammingOperationMode -namespace HvacRelayState { +namespace ThermostatRunningState { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { @@ -16601,7 +16601,7 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) return emberAfWriteServerAttribute(endpoint, Clusters::Thermostat::Id, Id, writable, ZCL_BITMAP16_ATTRIBUTE_TYPE); } -} // namespace HvacRelayState +} // namespace ThermostatRunningState namespace SetpointChangeSource { diff --git a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h index d0ec6997bea67a..91b2b32d121208 100644 --- a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h +++ b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h @@ -3109,10 +3109,10 @@ EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value); // bitmap8 EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value); } // namespace ThermostatProgrammingOperationMode -namespace HvacRelayState { +namespace ThermostatRunningState { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value); // bitmap16 EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value); -} // namespace HvacRelayState +} // namespace ThermostatRunningState namespace SetpointChangeSource { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value); // enum8 diff --git a/zzz_generated/app-common/app-common/zap-generated/callback.h b/zzz_generated/app-common/app-common/zap-generated/callback.h index 8497ba36e404cf..399bc428c1d3cb 100644 --- a/zzz_generated/app-common/app-common/zap-generated/callback.h +++ b/zzz_generated/app-common/app-common/zap-generated/callback.h @@ -14498,12 +14498,12 @@ bool emberAfThermostatClusterSetpointRaiseLowerCallback( chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, const chip::app::Clusters::Thermostat::Commands::SetpointRaiseLower::DecodableType & commandData); /** - * @brief Thermostat Cluster CurrentWeeklySchedule Command callback (from server) + * @brief Thermostat Cluster GetWeeklyScheduleResponse Command callback (from server) */ -bool emberAfThermostatClusterCurrentWeeklyScheduleCallback(chip::EndpointId endpoint, chip::app::CommandSender * commandObj, - uint8_t numberOfTransitionsForSequence, uint8_t dayOfWeekForSequence, - uint8_t modeForSequence, - /* TYPE WARNING: array array defaults to */ uint8_t * payload); +bool emberAfThermostatClusterGetWeeklyScheduleResponseCallback(chip::EndpointId endpoint, chip::app::CommandSender * commandObj, + uint8_t numberOfTransitionsForSequence, uint8_t dayOfWeekForSequence, + uint8_t modeForSequence, + /* TYPE WARNING: array array defaults to */ uint8_t * payload); /** * @brief Thermostat Cluster SetWeeklySchedule Command callback (from client) */ @@ -14511,11 +14511,12 @@ bool emberAfThermostatClusterSetWeeklyScheduleCallback( chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, const chip::app::Clusters::Thermostat::Commands::SetWeeklySchedule::DecodableType & commandData); /** - * @brief Thermostat Cluster RelayStatusLog Command callback (from server) + * @brief Thermostat Cluster GetRelayStatusLogResponse Command callback (from server) */ -bool emberAfThermostatClusterRelayStatusLogCallback(chip::EndpointId endpoint, chip::app::CommandSender * commandObj, - uint16_t timeOfDay, uint16_t relayStatus, int16_t localTemperature, - uint8_t humidityInPercentage, int16_t setpoint, uint16_t unreadEntries); +bool emberAfThermostatClusterGetRelayStatusLogResponseCallback(chip::EndpointId endpoint, chip::app::CommandSender * commandObj, + uint16_t timeOfDay, uint16_t relayStatus, int16_t localTemperature, + uint8_t humidityInPercentage, int16_t setpoint, + uint16_t unreadEntries); /** * @brief Thermostat Cluster GetWeeklySchedule Command callback (from client) */ diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp index d0a42c9de65d0d..88117616eedef0 100644 --- a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp +++ b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp @@ -11957,7 +11957,7 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) return CHIP_NO_ERROR; } } // namespace SetpointRaiseLower. -namespace CurrentWeeklySchedule { +namespace GetWeeklyScheduleResponse { CHIP_ERROR Type::Encode(TLV::TLVWriter & writer, TLV::Tag tag) const { TLV::TLVType outer; @@ -12004,7 +12004,7 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) ReturnErrorOnFailure(reader.ExitContainer(outer)); return CHIP_NO_ERROR; } -} // namespace CurrentWeeklySchedule. +} // namespace GetWeeklyScheduleResponse. namespace SetWeeklySchedule { CHIP_ERROR Type::Encode(TLV::TLVWriter & writer, TLV::Tag tag) const { @@ -12053,7 +12053,7 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) return CHIP_NO_ERROR; } } // namespace SetWeeklySchedule. -namespace RelayStatusLog { +namespace GetRelayStatusLogResponse { CHIP_ERROR Type::Encode(TLV::TLVWriter & writer, TLV::Tag tag) const { TLV::TLVType outer; @@ -12107,7 +12107,7 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) ReturnErrorOnFailure(reader.ExitContainer(outer)); return CHIP_NO_ERROR; } -} // namespace RelayStatusLog. +} // namespace GetRelayStatusLogResponse. namespace GetWeeklySchedule { CHIP_ERROR Type::Encode(TLV::TLVWriter & writer, TLV::Tag tag) const { diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h index 0bd8eca641f5bc..97b9f73de2dd97 100644 --- a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h +++ b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h @@ -19798,20 +19798,20 @@ struct Type; struct DecodableType; } // namespace SetpointRaiseLower -namespace CurrentWeeklySchedule { +namespace GetWeeklyScheduleResponse { struct Type; struct DecodableType; -} // namespace CurrentWeeklySchedule +} // namespace GetWeeklyScheduleResponse namespace SetWeeklySchedule { struct Type; struct DecodableType; } // namespace SetWeeklySchedule -namespace RelayStatusLog { +namespace GetRelayStatusLogResponse { struct Type; struct DecodableType; -} // namespace RelayStatusLog +} // namespace GetRelayStatusLogResponse namespace GetWeeklySchedule { struct Type; @@ -19866,7 +19866,7 @@ struct DecodableType CHIP_ERROR Decode(TLV::TLVReader & reader); }; }; // namespace SetpointRaiseLower -namespace CurrentWeeklySchedule { +namespace GetWeeklyScheduleResponse { enum class Fields { kNumberOfTransitionsForSequence = 0, @@ -19879,7 +19879,7 @@ struct Type { public: // Use GetCommandId instead of commandId directly to avoid naming conflict with CommandIdentification in ExecutionOfACommand - static constexpr CommandId GetCommandId() { return Commands::CurrentWeeklySchedule::Id; } + static constexpr CommandId GetCommandId() { return Commands::GetWeeklyScheduleResponse::Id; } static constexpr ClusterId GetClusterId() { return Clusters::Thermostat::Id; } uint8_t numberOfTransitionsForSequence; @@ -19897,7 +19897,7 @@ struct Type struct DecodableType { public: - static constexpr CommandId GetCommandId() { return Commands::CurrentWeeklySchedule::Id; } + static constexpr CommandId GetCommandId() { return Commands::GetWeeklyScheduleResponse::Id; } static constexpr ClusterId GetClusterId() { return Clusters::Thermostat::Id; } uint8_t numberOfTransitionsForSequence; @@ -19906,7 +19906,7 @@ struct DecodableType DataModel::DecodableList payload; CHIP_ERROR Decode(TLV::TLVReader & reader); }; -}; // namespace CurrentWeeklySchedule +}; // namespace GetWeeklyScheduleResponse namespace SetWeeklySchedule { enum class Fields { @@ -19948,7 +19948,7 @@ struct DecodableType CHIP_ERROR Decode(TLV::TLVReader & reader); }; }; // namespace SetWeeklySchedule -namespace RelayStatusLog { +namespace GetRelayStatusLogResponse { enum class Fields { kTimeOfDay = 0, @@ -19963,7 +19963,7 @@ struct Type { public: // Use GetCommandId instead of commandId directly to avoid naming conflict with CommandIdentification in ExecutionOfACommand - static constexpr CommandId GetCommandId() { return Commands::RelayStatusLog::Id; } + static constexpr CommandId GetCommandId() { return Commands::GetRelayStatusLogResponse::Id; } static constexpr ClusterId GetClusterId() { return Clusters::Thermostat::Id; } uint16_t timeOfDay; @@ -19983,7 +19983,7 @@ struct Type struct DecodableType { public: - static constexpr CommandId GetCommandId() { return Commands::RelayStatusLog::Id; } + static constexpr CommandId GetCommandId() { return Commands::GetRelayStatusLogResponse::Id; } static constexpr ClusterId GetClusterId() { return Clusters::Thermostat::Id; } uint16_t timeOfDay; @@ -19994,7 +19994,7 @@ struct DecodableType uint16_t unreadEntries; CHIP_ERROR Decode(TLV::TLVReader & reader); }; -}; // namespace RelayStatusLog +}; // namespace GetRelayStatusLogResponse namespace GetWeeklySchedule { enum class Fields { @@ -20014,7 +20014,7 @@ struct Type CHIP_ERROR Encode(TLV::TLVWriter & writer, TLV::Tag tag) const; - using ResponseType = DataModel::NullObjectType; + using ResponseType = Clusters::Thermostat::Commands::GetWeeklyScheduleResponse::DecodableType; static constexpr bool MustUseTimedInvoke() { return false; } }; @@ -20072,7 +20072,7 @@ struct Type CHIP_ERROR Encode(TLV::TLVWriter & writer, TLV::Tag tag) const; - using ResponseType = DataModel::NullObjectType; + using ResponseType = Clusters::Thermostat::Commands::GetRelayStatusLogResponse::DecodableType; static constexpr bool MustUseTimedInvoke() { return false; } }; @@ -20461,7 +20461,7 @@ struct TypeInfo static constexpr bool MustUseTimedWrite() { return false; } }; } // namespace ThermostatProgrammingOperationMode -namespace HvacRelayState { +namespace ThermostatRunningState { struct TypeInfo { using Type = uint16_t; @@ -20469,10 +20469,10 @@ struct TypeInfo using DecodableArgType = uint16_t; static constexpr ClusterId GetClusterId() { return Clusters::Thermostat::Id; } - static constexpr AttributeId GetAttributeId() { return Attributes::HvacRelayState::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::ThermostatRunningState::Id; } static constexpr bool MustUseTimedWrite() { return false; } }; -} // namespace HvacRelayState +} // namespace ThermostatRunningState namespace SetpointChangeSource { struct TypeInfo { diff --git a/zzz_generated/app-common/app-common/zap-generated/command-id.h b/zzz_generated/app-common/app-common/zap-generated/command-id.h index ddc5cdfeddddf4..d69869337e9192 100644 --- a/zzz_generated/app-common/app-common/zap-generated/command-id.h +++ b/zzz_generated/app-common/app-common/zap-generated/command-id.h @@ -300,9 +300,9 @@ // Commands for cluster: Thermostat #define ZCL_SETPOINT_RAISE_LOWER_COMMAND_ID (0x00) -#define ZCL_CURRENT_WEEKLY_SCHEDULE_COMMAND_ID (0x00) +#define ZCL_GET_WEEKLY_SCHEDULE_RESPONSE_COMMAND_ID (0x00) #define ZCL_SET_WEEKLY_SCHEDULE_COMMAND_ID (0x01) -#define ZCL_RELAY_STATUS_LOG_COMMAND_ID (0x01) +#define ZCL_GET_RELAY_STATUS_LOG_RESPONSE_COMMAND_ID (0x01) #define ZCL_GET_WEEKLY_SCHEDULE_COMMAND_ID (0x02) #define ZCL_CLEAR_WEEKLY_SCHEDULE_COMMAND_ID (0x03) #define ZCL_GET_RELAY_STATUS_LOG_COMMAND_ID (0x04) diff --git a/zzz_generated/app-common/app-common/zap-generated/ids/Attributes.h b/zzz_generated/app-common/app-common/zap-generated/ids/Attributes.h index 62ea80977f6ad0..de11c99fc9a9a7 100644 --- a/zzz_generated/app-common/app-common/zap-generated/ids/Attributes.h +++ b/zzz_generated/app-common/app-common/zap-generated/ids/Attributes.h @@ -2888,9 +2888,9 @@ namespace ThermostatProgrammingOperationMode { static constexpr AttributeId Id = 0x00000025; } // namespace ThermostatProgrammingOperationMode -namespace HvacRelayState { +namespace ThermostatRunningState { static constexpr AttributeId Id = 0x00000029; -} // namespace HvacRelayState +} // namespace ThermostatRunningState namespace SetpointChangeSource { static constexpr AttributeId Id = 0x00000030; diff --git a/zzz_generated/app-common/app-common/zap-generated/ids/Commands.h b/zzz_generated/app-common/app-common/zap-generated/ids/Commands.h index d74ce0eebdb937..0617f7b3e8d5d1 100644 --- a/zzz_generated/app-common/app-common/zap-generated/ids/Commands.h +++ b/zzz_generated/app-common/app-common/zap-generated/ids/Commands.h @@ -1042,17 +1042,17 @@ namespace SetpointRaiseLower { static constexpr CommandId Id = 0x00000000; } // namespace SetpointRaiseLower -namespace CurrentWeeklySchedule { +namespace GetWeeklyScheduleResponse { static constexpr CommandId Id = 0x00000000; -} // namespace CurrentWeeklySchedule +} // namespace GetWeeklyScheduleResponse namespace SetWeeklySchedule { static constexpr CommandId Id = 0x00000001; } // namespace SetWeeklySchedule -namespace RelayStatusLog { +namespace GetRelayStatusLogResponse { static constexpr CommandId Id = 0x00000001; -} // namespace RelayStatusLog +} // namespace GetRelayStatusLogResponse namespace GetWeeklySchedule { static constexpr CommandId Id = 0x00000002; diff --git a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h index 92dd9848e9d263..a885e2bd229bdd 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h @@ -3441,6 +3441,66 @@ static void OnTestClusterTestSpecificResponseSuccess( command->SetCommandExitStatus(err); }; +static void OnThermostatGetRelayStatusLogResponseSuccess( + void * context, const chip::app::Clusters::Thermostat::Commands::GetRelayStatusLogResponse::DecodableType & data) +{ + ChipLogProgress(Zcl, "Received GetRelayStatusLogResponse:"); + CHIP_ERROR err = CHIP_NO_ERROR; + if (err == CHIP_NO_ERROR) + { + err = LogValue("timeOfDay", 1, data.timeOfDay); + } + if (err == CHIP_NO_ERROR) + { + err = LogValue("relayStatus", 1, data.relayStatus); + } + if (err == CHIP_NO_ERROR) + { + err = LogValue("localTemperature", 1, data.localTemperature); + } + if (err == CHIP_NO_ERROR) + { + err = LogValue("humidityInPercentage", 1, data.humidityInPercentage); + } + if (err == CHIP_NO_ERROR) + { + err = LogValue("setpoint", 1, data.setpoint); + } + if (err == CHIP_NO_ERROR) + { + err = LogValue("unreadEntries", 1, data.unreadEntries); + } + + ModelCommand * command = static_cast(context); + command->SetCommandExitStatus(err); +}; + +static void OnThermostatGetWeeklyScheduleResponseSuccess( + void * context, const chip::app::Clusters::Thermostat::Commands::GetWeeklyScheduleResponse::DecodableType & data) +{ + ChipLogProgress(Zcl, "Received GetWeeklyScheduleResponse:"); + CHIP_ERROR err = CHIP_NO_ERROR; + if (err == CHIP_NO_ERROR) + { + err = LogValue("numberOfTransitionsForSequence", 1, data.numberOfTransitionsForSequence); + } + if (err == CHIP_NO_ERROR) + { + err = LogValue("dayOfWeekForSequence", 1, data.dayOfWeekForSequence); + } + if (err == CHIP_NO_ERROR) + { + err = LogValue("modeForSequence", 1, data.modeForSequence); + } + if (err == CHIP_NO_ERROR) + { + err = LogValue("payload", 1, data.payload); + } + + ModelCommand * command = static_cast(context); + command->SetCommandExitStatus(err); +}; + /*----------------------------------------------------------------------------*\ | Cluster Name | ID | |---------------------------------------------------------------------+--------| @@ -40645,8 +40705,8 @@ class ThermostatGetRelayStatusLog : public ModelCommand { ChipLogProgress(chipTool, "Sending cluster (0x00000201) command (0x00000004) on endpoint %" PRIu8, endpointId); - return chip::Controller::InvokeCommand(device, this, OnDefaultSuccess, OnDefaultFailure, endpointId, mRequest, - mTimedInteractionTimeoutMs); + return chip::Controller::InvokeCommand(device, this, OnThermostatGetRelayStatusLogResponseSuccess, OnDefaultFailure, + endpointId, mRequest, mTimedInteractionTimeoutMs); } private: @@ -40673,8 +40733,8 @@ class ThermostatGetWeeklySchedule : public ModelCommand { ChipLogProgress(chipTool, "Sending cluster (0x00000201) command (0x00000002) on endpoint %" PRIu8, endpointId); - return chip::Controller::InvokeCommand(device, this, OnDefaultSuccess, OnDefaultFailure, endpointId, mRequest, - mTimedInteractionTimeoutMs); + return chip::Controller::InvokeCommand(device, this, OnThermostatGetWeeklyScheduleResponseSuccess, OnDefaultFailure, + endpointId, mRequest, mTimedInteractionTimeoutMs); } private: diff --git a/zzz_generated/controller-clusters/zap-generated/CHIPClientCallbacks.cpp b/zzz_generated/controller-clusters/zap-generated/CHIPClientCallbacks.cpp index 6f30ab4df16f5a..0bb35c05f889f8 100644 --- a/zzz_generated/controller-clusters/zap-generated/CHIPClientCallbacks.cpp +++ b/zzz_generated/controller-clusters/zap-generated/CHIPClientCallbacks.cpp @@ -3119,3 +3119,43 @@ bool emberAfTestClusterClusterTestSpecificResponseCallback(EndpointId endpoint, cb->mCall(cb->mContext, returnValue); return true; } + +bool emberAfThermostatClusterGetRelayStatusLogResponseCallback(EndpointId endpoint, app::CommandSender * commandObj, + uint16_t timeOfDay, uint16_t relayStatus, int16_t localTemperature, + uint8_t humidityInPercentage, int16_t setpoint, + uint16_t unreadEntries) +{ + ChipLogProgress(Zcl, "GetRelayStatusLogResponse:"); + ChipLogProgress(Zcl, " timeOfDay: %" PRIu16 "", timeOfDay); + ChipLogProgress(Zcl, " relayStatus: %" PRIu16 "", relayStatus); + ChipLogProgress(Zcl, " localTemperature: %" PRId16 "", localTemperature); + ChipLogProgress(Zcl, " humidityInPercentage: %" PRIu8 "", humidityInPercentage); + ChipLogProgress(Zcl, " setpoint: %" PRId16 "", setpoint); + ChipLogProgress(Zcl, " unreadEntries: %" PRIu16 "", unreadEntries); + + GET_CLUSTER_RESPONSE_CALLBACKS("ThermostatClusterGetRelayStatusLogResponseCallback"); + + Callback::Callback * cb = + Callback::Callback::FromCancelable(onSuccessCallback); + cb->mCall(cb->mContext, timeOfDay, relayStatus, localTemperature, humidityInPercentage, setpoint, unreadEntries); + return true; +} + +bool emberAfThermostatClusterGetWeeklyScheduleResponseCallback(EndpointId endpoint, app::CommandSender * commandObj, + uint8_t numberOfTransitionsForSequence, uint8_t dayOfWeekForSequence, + uint8_t modeForSequence, + /* TYPE WARNING: array array defaults to */ uint8_t * payload) +{ + ChipLogProgress(Zcl, "GetWeeklyScheduleResponse:"); + ChipLogProgress(Zcl, " numberOfTransitionsForSequence: %" PRIu8 "", numberOfTransitionsForSequence); + ChipLogProgress(Zcl, " dayOfWeekForSequence: %" PRIu8 "", dayOfWeekForSequence); + ChipLogProgress(Zcl, " modeForSequence: %" PRIu8 "", modeForSequence); + ChipLogProgress(Zcl, " payload: %p", payload); + + GET_CLUSTER_RESPONSE_CALLBACKS("ThermostatClusterGetWeeklyScheduleResponseCallback"); + + Callback::Callback * cb = + Callback::Callback::FromCancelable(onSuccessCallback); + cb->mCall(cb->mContext, numberOfTransitionsForSequence, dayOfWeekForSequence, modeForSequence, payload); + return true; +} diff --git a/zzz_generated/controller-clusters/zap-generated/CHIPClientCallbacks.h b/zzz_generated/controller-clusters/zap-generated/CHIPClientCallbacks.h index 0fdab6c129bf45..5383519579665f 100644 --- a/zzz_generated/controller-clusters/zap-generated/CHIPClientCallbacks.h +++ b/zzz_generated/controller-clusters/zap-generated/CHIPClientCallbacks.h @@ -128,6 +128,12 @@ typedef void (*TestClusterClusterTestListInt8UReverseResponseCallback)(void * co typedef void (*TestClusterClusterTestNullableOptionalResponseCallback)(void * context, bool wasPresent, bool wasNull, uint8_t value, uint8_t originalValue); typedef void (*TestClusterClusterTestSpecificResponseCallback)(void * context, uint8_t returnValue); +typedef void (*ThermostatClusterGetRelayStatusLogResponseCallback)(void * context, uint16_t timeOfDay, uint16_t relayStatus, + int16_t localTemperature, uint8_t humidityInPercentage, + int16_t setpoint, uint16_t unreadEntries); +typedef void (*ThermostatClusterGetWeeklyScheduleResponseCallback)(void * context, uint8_t numberOfTransitionsForSequence, + uint8_t dayOfWeekForSequence, uint8_t modeForSequence, + /* TYPE WARNING: array array defaults to */ uint8_t * payload); // List specific responses void AccessControlClusterAclListAttributeFilter(chip::TLV::TLVReader * data, chip::Callback::Cancelable * onSuccessCallback, diff --git a/zzz_generated/controller-clusters/zap-generated/IMClusterCommandHandler.cpp b/zzz_generated/controller-clusters/zap-generated/IMClusterCommandHandler.cpp index 70a86fbd3a066a..9c97d3bb88917a 100644 --- a/zzz_generated/controller-clusters/zap-generated/IMClusterCommandHandler.cpp +++ b/zzz_generated/controller-clusters/zap-generated/IMClusterCommandHandler.cpp @@ -4465,6 +4465,197 @@ void DispatchClientCommand(CommandSender * apCommandObj, const ConcreteCommandPa } // namespace TestCluster +namespace Thermostat { + +void DispatchClientCommand(CommandSender * apCommandObj, const ConcreteCommandPath & aCommandPath, TLV::TLVReader & aDataTlv) +{ + // We are using TLVUnpackError and TLVError here since both of them can be CHIP_END_OF_TLV + // When TLVError is CHIP_END_OF_TLV, it means we have iterated all of the items, which is not a real error. + // Any error value TLVUnpackError means we have received an illegal value. + // The following variables are used for all commands to save code size. + CHIP_ERROR TLVError = CHIP_NO_ERROR; + CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR; + uint32_t validArgumentCount = 0; + uint32_t expectArgumentCount = 0; + uint32_t currentDecodeTagId = 0; + bool wasHandled = false; + { + switch (aCommandPath.mCommandId) + { + case Commands::GetRelayStatusLogResponse::Id: { + expectArgumentCount = 6; + uint16_t timeOfDay; + uint16_t relayStatus; + int16_t localTemperature; + uint8_t humidityInPercentage; + int16_t setpoint; + uint16_t unreadEntries; + bool argExists[6]; + + memset(argExists, 0, sizeof argExists); + + while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR) + { + // Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element. + // Skip this element if it is not a ContextTag, not consider it as an error if other values are valid. + if (!TLV::IsContextTag(aDataTlv.GetTag())) + { + continue; + } + currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag()); + if (currentDecodeTagId < 6) + { + if (argExists[currentDecodeTagId]) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + else + { + argExists[currentDecodeTagId] = true; + validArgumentCount++; + } + } + switch (currentDecodeTagId) + { + case 0: + TLVUnpackError = aDataTlv.Get(timeOfDay); + break; + case 1: + TLVUnpackError = aDataTlv.Get(relayStatus); + break; + case 2: + TLVUnpackError = aDataTlv.Get(localTemperature); + break; + case 3: + TLVUnpackError = aDataTlv.Get(humidityInPercentage); + break; + case 4: + TLVUnpackError = aDataTlv.Get(setpoint); + break; + case 5: + TLVUnpackError = aDataTlv.Get(unreadEntries); + break; + default: + // Unsupported tag, ignore it. + ChipLogProgress(Zcl, "Unknown TLV tag during processing."); + break; + } + if (CHIP_NO_ERROR != TLVUnpackError) + { + break; + } + } + + if (CHIP_END_OF_TLV == TLVError) + { + // CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error. + TLVError = CHIP_NO_ERROR; + } + + if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 6 == validArgumentCount) + { + wasHandled = emberAfThermostatClusterGetRelayStatusLogResponseCallback( + aCommandPath.mEndpointId, apCommandObj, timeOfDay, relayStatus, localTemperature, humidityInPercentage, + setpoint, unreadEntries); + } + break; + } + case Commands::GetWeeklyScheduleResponse::Id: { + expectArgumentCount = 4; + uint8_t numberOfTransitionsForSequence; + uint8_t dayOfWeekForSequence; + uint8_t modeForSequence; + /* TYPE WARNING: array array defaults to */ uint8_t * payload; + bool argExists[4]; + + memset(argExists, 0, sizeof argExists); + + while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR) + { + // Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element. + // Skip this element if it is not a ContextTag, not consider it as an error if other values are valid. + if (!TLV::IsContextTag(aDataTlv.GetTag())) + { + continue; + } + currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag()); + if (currentDecodeTagId < 4) + { + if (argExists[currentDecodeTagId]) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + else + { + argExists[currentDecodeTagId] = true; + validArgumentCount++; + } + } + switch (currentDecodeTagId) + { + case 0: + TLVUnpackError = aDataTlv.Get(numberOfTransitionsForSequence); + break; + case 1: + TLVUnpackError = aDataTlv.Get(dayOfWeekForSequence); + break; + case 2: + TLVUnpackError = aDataTlv.Get(modeForSequence); + break; + case 3: + // Just for compatibility, we will add array type support in IM later. + TLVUnpackError = aDataTlv.GetDataPtr(const_cast(payload)); + break; + default: + // Unsupported tag, ignore it. + ChipLogProgress(Zcl, "Unknown TLV tag during processing."); + break; + } + if (CHIP_NO_ERROR != TLVUnpackError) + { + break; + } + } + + if (CHIP_END_OF_TLV == TLVError) + { + // CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error. + TLVError = CHIP_NO_ERROR; + } + + if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 4 == validArgumentCount) + { + wasHandled = emberAfThermostatClusterGetWeeklyScheduleResponseCallback( + aCommandPath.mEndpointId, apCommandObj, numberOfTransitionsForSequence, dayOfWeekForSequence, modeForSequence, + payload); + } + break; + } + default: { + return; + } + } + } + + if (CHIP_NO_ERROR != TLVError || CHIP_NO_ERROR != TLVUnpackError || expectArgumentCount != validArgumentCount || !wasHandled) + { + ChipLogProgress(Zcl, + "Failed to dispatch command, %" PRIu32 "/%" PRIu32 " arguments parsed, TLVError=%" CHIP_ERROR_FORMAT + ", UnpackError=%" CHIP_ERROR_FORMAT " (last decoded tag = %" PRIu32, + validArgumentCount, expectArgumentCount, TLVError.Format(), TLVUnpackError.Format(), currentDecodeTagId); + // A command with no arguments would never write currentDecodeTagId. If + // progress logging is also disabled, it would look unused. Silence that + // warning. + UNUSED_VAR(currentDecodeTagId); + } +} + +} // namespace Thermostat + } // namespace Clusters void DispatchSingleClusterCommand(const ConcreteCommandPath & aCommandPath, TLV::TLVReader & aReader, CommandHandler * apCommandObj) @@ -4542,6 +4733,9 @@ void DispatchSingleClusterResponseCommand(const ConcreteCommandPath & aCommandPa case Clusters::TestCluster::Id: Clusters::TestCluster::DispatchClientCommand(apCommandObj, aCommandPath, aReader); break; + case Clusters::Thermostat::Id: + Clusters::Thermostat::DispatchClientCommand(apCommandObj, aCommandPath, aReader); + break; default: ChipLogError(Zcl, "Unknown cluster " ChipLogFormatMEI, ChipLogValueMEI(aCommandPath.mClusterId)); break;