From 2b640640e56b420800ea4a2254d82032d6848b7c Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Wed, 5 May 2021 17:02:54 -0400 Subject: [PATCH] Use the incoming exchange context to send responses in the data model (#6438) * Switch to a union for the indexOrDestination argument to message send functions. * Return a non-const ExchangeContext from Command's getter. Sending a reply needs a non-const ExchangeContext. * Propagate the incoming-message exchange context down so we can use it for responses. * Add a way to Close() all the exchange contexts for a given delegate. * Use the incoming exchange context to send reply messages instead of creating a new one. * Regenerate generated files --- .../all-clusters-common/gen/callback-stub.cpp | 4 +- .../all-clusters-common/gen/callback.h | 125 +++++++------- .../bridge-common/gen/callback-stub.cpp | 4 +- .../bridge-app/bridge-common/gen/callback.h | 32 ++-- .../chip-tool/gen/CHIPClientCallbacks.cpp | 4 +- examples/chip-tool/gen/callback-stub.cpp | 4 +- examples/chip-tool/gen/callback.h | 155 ++++++++--------- .../lighting-common/gen/callback-stub.cpp | 4 +- .../lighting-common/gen/callback.h | 32 ++-- .../lock-common/gen/callback-stub.cpp | 4 +- examples/lock-app/lock-common/gen/callback.h | 28 +-- .../esp32/main/gen/callback-stub.cpp | 4 +- .../esp32/main/gen/callback.h | 29 ++-- .../tv-app/tv-common/gen/callback-stub.cpp | 4 +- examples/tv-app/tv-common/gen/callback.h | 92 +++++----- .../window-app/common/gen/callback-stub.cpp | 4 +- examples/window-app/common/gen/callback.h | 8 +- src/app/Command.h | 2 +- .../ias-zone-server/ias-zone-server.cpp | 2 +- .../operational-credentials-server.cpp | 8 +- src/app/reporting/reporting.cpp | 17 +- src/app/server/Server.cpp | 2 +- src/app/util/DataModelHandler.cpp | 4 +- src/app/util/DataModelHandler.h | 5 +- src/app/util/af-main-common.cpp | 109 ++++++------ src/app/util/af-main.h | 4 +- src/app/util/af-types.h | 41 ++++- src/app/util/af.h | 19 ++- src/app/util/attribute-storage.cpp | 8 +- src/app/util/attribute-storage.h | 6 +- src/app/util/chip-message-send.cpp | 31 +++- src/app/util/chip-message-send.h | 18 ++ src/app/util/common.h | 4 +- .../util/ember-compatibility-functions.cpp | 5 +- src/app/util/esi-management.cpp | 8 +- src/app/util/message.cpp | 2 +- src/app/util/types_stub.h | 4 +- src/app/util/util.cpp | 16 +- src/app/util/util.h | 6 +- .../app/CHIPClientCallbacks-src.zapt | 4 +- .../templates/app/callback-stub-src.zapt | 2 +- .../zap-templates/templates/app/callback.zapt | 8 +- src/controller/CHIPDevice.cpp | 42 ++--- src/controller/CHIPDevice.h | 24 ++- src/controller/CHIPDeviceController.cpp | 9 +- src/controller/EmptyDataModelHandler.cpp | 4 +- .../python/gen/CHIPClientCallbacks.cpp | 4 +- src/controller/python/gen/callback-stub.cpp | 4 +- src/controller/python/gen/callback.h | 159 +++++++++--------- .../CHIP/gen/CHIPClientCallbacks.cpp | 4 +- .../Framework/CHIP/gen/callback-stub.cpp | 4 +- src/darwin/Framework/CHIP/gen/callback.h | 111 ++++++------ src/messaging/ExchangeMgr.cpp | 18 ++ src/messaging/ExchangeMgr.h | 7 + 54 files changed, 698 insertions(+), 564 deletions(-) diff --git a/examples/all-clusters-app/all-clusters-common/gen/callback-stub.cpp b/examples/all-clusters-app/all-clusters-common/gen/callback-stub.cpp index 3b4905d5be4c66..6901b045162ca0 100644 --- a/examples/all-clusters-app/all-clusters-common/gen/callback-stub.cpp +++ b/examples/all-clusters-app/all-clusters-common/gen/callback-stub.cpp @@ -519,8 +519,8 @@ bool __attribute__((weak)) emberAfPreMessageSendCallback(EmberAfMessageStruct * * @param status Ver.: always */ bool __attribute__((weak)) -emberAfMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, EmberApsFrame * apsFrame, uint16_t msgLen, - uint8_t * message, EmberStatus status) +emberAfMessageSentCallback(EmberOutgoingMessageType type, MessageSendDestination destination, EmberApsFrame * apsFrame, + uint16_t msgLen, uint8_t * message, EmberStatus status) { return false; } diff --git a/examples/all-clusters-app/all-clusters-common/gen/callback.h b/examples/all-clusters-app/all-clusters-common/gen/callback.h index f9b47114ea5a5a..98929ba3fcbf74 100644 --- a/examples/all-clusters-app/all-clusters-common/gen/callback.h +++ b/examples/all-clusters-app/all-clusters-common/gen/callback.h @@ -280,15 +280,15 @@ void emberAfApplicationBasicClusterServerManufacturerSpecificAttributeChangedCal * Server Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfApplicationBasicClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, - EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, - EmberStatus status); +void emberAfApplicationBasicClusterServerMessageSentCallback(EmberOutgoingMessageType type, + chip::MessageSendDestination destination, EmberApsFrame * apsFrame, + uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief Application Basic Cluster Server Pre Attribute Changed * @@ -351,13 +351,13 @@ void emberAfBarrierControlClusterServerManufacturerSpecificAttributeChangedCallb * Server Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfBarrierControlClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfBarrierControlClusterServerMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -421,13 +421,13 @@ void emberAfBasicClusterServerManufacturerSpecificAttributeChangedCallback(chip: * Server Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfBasicClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfBasicClusterServerMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief Basic Cluster Server Pre Attribute Changed @@ -490,13 +490,13 @@ void emberAfBindingClusterServerManufacturerSpecificAttributeChangedCallback(chi * Server Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfBindingClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfBindingClusterServerMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -560,13 +560,13 @@ void emberAfColorControlClusterServerManufacturerSpecificAttributeChangedCallbac * Server Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfColorControlClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfColorControlClusterServerMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -630,13 +630,13 @@ void emberAfDescriptorClusterServerManufacturerSpecificAttributeChangedCallback( * Server Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfDescriptorClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfDescriptorClusterServerMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -700,13 +700,13 @@ void emberAfDoorLockClusterServerManufacturerSpecificAttributeChangedCallback(ch * Server Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfDoorLockClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfDoorLockClusterServerMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -770,15 +770,15 @@ void emberAfGeneralCommissioningClusterServerManufacturerSpecificAttributeChange * Server Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfGeneralCommissioningClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, - EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, - EmberStatus status); +void emberAfGeneralCommissioningClusterServerMessageSentCallback(EmberOutgoingMessageType type, + chip::MessageSendDestination destination, EmberApsFrame * apsFrame, + uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief General Commissioning Cluster Server Pre Attribute Changed * @@ -841,15 +841,15 @@ void emberAfGroupKeyManagementClusterServerManufacturerSpecificAttributeChangedC * Server Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfGroupKeyManagementClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, - EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, - EmberStatus status); +void emberAfGroupKeyManagementClusterServerMessageSentCallback(EmberOutgoingMessageType type, + chip::MessageSendDestination destination, EmberApsFrame * apsFrame, + uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief Group Key Management Cluster Server Pre Attribute Changed * @@ -912,13 +912,13 @@ void emberAfGroupsClusterServerManufacturerSpecificAttributeChangedCallback(chip * Server Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfGroupsClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfGroupsClusterServerMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -982,13 +982,13 @@ void emberAfIasZoneClusterServerManufacturerSpecificAttributeChangedCallback(chi * Server Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfIasZoneClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfIasZoneClusterServerMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -1052,13 +1052,13 @@ void emberAfIdentifyClusterServerManufacturerSpecificAttributeChangedCallback(ch * Server Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfIdentifyClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfIdentifyClusterServerMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -1122,13 +1122,13 @@ void emberAfLevelControlClusterServerManufacturerSpecificAttributeChangedCallbac * Server Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfLevelControlClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfLevelControlClusterServerMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -1192,13 +1192,13 @@ void emberAfLowPowerClusterServerManufacturerSpecificAttributeChangedCallback(ch * Server Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfLowPowerClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfLowPowerClusterServerMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -1262,15 +1262,15 @@ void emberAfNetworkCommissioningClusterServerManufacturerSpecificAttributeChange * Server Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfNetworkCommissioningClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, - EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, - EmberStatus status); +void emberAfNetworkCommissioningClusterServerMessageSentCallback(EmberOutgoingMessageType type, + chip::MessageSendDestination destination, EmberApsFrame * apsFrame, + uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief Network Commissioning Cluster Server Pre Attribute Changed * @@ -1333,13 +1333,14 @@ void emberAfOtaSoftwareUpdateClientClusterServerManufacturerSpecificAttributeCha * Server Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfOtaSoftwareUpdateClientClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfOtaSoftwareUpdateClientClusterServerMessageSentCallback(EmberOutgoingMessageType type, + chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -1404,13 +1405,14 @@ void emberAfOtaSoftwareUpdateServerClusterServerManufacturerSpecificAttributeCha * Server Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfOtaSoftwareUpdateServerClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfOtaSoftwareUpdateServerClusterServerMessageSentCallback(EmberOutgoingMessageType type, + chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -1474,13 +1476,13 @@ void emberAfOnOffClusterServerManufacturerSpecificAttributeChangedCallback(chip: * Server Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfOnOffClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfOnOffClusterServerMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief On/off Cluster Server Pre Attribute Changed @@ -1543,13 +1545,14 @@ void emberAfOperationalCredentialsClusterServerManufacturerSpecificAttributeChan * Server Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfOperationalCredentialsClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfOperationalCredentialsClusterServerMessageSentCallback(EmberOutgoingMessageType type, + chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -1615,13 +1618,14 @@ void emberAfPumpConfigurationAndControlClusterServerManufacturerSpecificAttribut * Server Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfPumpConfigurationAndControlClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfPumpConfigurationAndControlClusterServerMessageSentCallback(EmberOutgoingMessageType type, + chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -1686,13 +1690,13 @@ void emberAfScenesClusterServerManufacturerSpecificAttributeChangedCallback(chip * Server Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfScenesClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfScenesClusterServerMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -1756,13 +1760,13 @@ void emberAfSwitchClusterServerManufacturerSpecificAttributeChangedCallback(chip * Server Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfSwitchClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfSwitchClusterServerMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -1826,13 +1830,14 @@ void emberAfTemperatureMeasurementClusterServerManufacturerSpecificAttributeChan * Server Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfTemperatureMeasurementClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfTemperatureMeasurementClusterServerMessageSentCallback(EmberOutgoingMessageType type, + chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -1897,13 +1902,13 @@ void emberAfTestClusterClusterServerManufacturerSpecificAttributeChangedCallback * Server Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfTestClusterClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfTestClusterClusterServerMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -1967,13 +1972,13 @@ void emberAfThermostatClusterServerManufacturerSpecificAttributeChangedCallback( * Server Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfThermostatClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfThermostatClusterServerMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -3062,13 +3067,13 @@ bool emberAfPreMessageSendCallback(EmberAfMessageStruct * messageStruct, EmberSt * be handled by the application framework. * * @param type Ver.: always - * @param indexOrDestination Ver.: always + * @param destination Ver.: always * @param apsFrame Ver.: always * @param msgLen Ver.: always * @param message Ver.: always * @param status Ver.: always */ -bool emberAfMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, EmberApsFrame * apsFrame, +bool emberAfMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief Pre Attribute Change diff --git a/examples/bridge-app/bridge-common/gen/callback-stub.cpp b/examples/bridge-app/bridge-common/gen/callback-stub.cpp index 9472cfe4f1403e..31e73f34584784 100644 --- a/examples/bridge-app/bridge-common/gen/callback-stub.cpp +++ b/examples/bridge-app/bridge-common/gen/callback-stub.cpp @@ -359,8 +359,8 @@ bool __attribute__((weak)) emberAfPreMessageSendCallback(EmberAfMessageStruct * * @param status Ver.: always */ bool __attribute__((weak)) -emberAfMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, EmberApsFrame * apsFrame, uint16_t msgLen, - uint8_t * message, EmberStatus status) +emberAfMessageSentCallback(EmberOutgoingMessageType type, MessageSendDestination destination, EmberApsFrame * apsFrame, + uint16_t msgLen, uint8_t * message, EmberStatus status) { return false; } diff --git a/examples/bridge-app/bridge-common/gen/callback.h b/examples/bridge-app/bridge-common/gen/callback.h index 498399ab5d4e8e..39aa982192708c 100644 --- a/examples/bridge-app/bridge-common/gen/callback.h +++ b/examples/bridge-app/bridge-common/gen/callback.h @@ -119,13 +119,13 @@ void emberAfBasicClusterServerManufacturerSpecificAttributeChangedCallback(chip: * Server Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfBasicClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfBasicClusterServerMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief Basic Cluster Server Pre Attribute Changed @@ -188,15 +188,15 @@ void emberAfGeneralCommissioningClusterServerManufacturerSpecificAttributeChange * Server Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfGeneralCommissioningClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, - EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, - EmberStatus status); +void emberAfGeneralCommissioningClusterServerMessageSentCallback(EmberOutgoingMessageType type, + chip::MessageSendDestination destination, EmberApsFrame * apsFrame, + uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief General Commissioning Cluster Server Pre Attribute Changed * @@ -259,13 +259,13 @@ void emberAfLevelControlClusterServerManufacturerSpecificAttributeChangedCallbac * Server Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfLevelControlClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfLevelControlClusterServerMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -329,15 +329,15 @@ void emberAfNetworkCommissioningClusterServerManufacturerSpecificAttributeChange * Server Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfNetworkCommissioningClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, - EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, - EmberStatus status); +void emberAfNetworkCommissioningClusterServerMessageSentCallback(EmberOutgoingMessageType type, + chip::MessageSendDestination destination, EmberApsFrame * apsFrame, + uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief Network Commissioning Cluster Server Pre Attribute Changed * @@ -399,13 +399,13 @@ void emberAfOnOffClusterServerManufacturerSpecificAttributeChangedCallback(chip: * Server Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfOnOffClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfOnOffClusterServerMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief On/off Cluster Server Pre Attribute Changed @@ -885,13 +885,13 @@ bool emberAfPreMessageSendCallback(EmberAfMessageStruct * messageStruct, EmberSt * be handled by the application framework. * * @param type Ver.: always - * @param indexOrDestination Ver.: always + * @param destination Ver.: always * @param apsFrame Ver.: always * @param msgLen Ver.: always * @param message Ver.: always * @param status Ver.: always */ -bool emberAfMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, EmberApsFrame * apsFrame, +bool emberAfMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief Pre Attribute Change diff --git a/examples/chip-tool/gen/CHIPClientCallbacks.cpp b/examples/chip-tool/gen/CHIPClientCallbacks.cpp index 29db4ce13f6c36..4c29e8869f75e8 100644 --- a/examples/chip-tool/gen/CHIPClientCallbacks.cpp +++ b/examples/chip-tool/gen/CHIPClientCallbacks.cpp @@ -61,7 +61,7 @@ using namespace ::chip; #define GET_RESPONSE_CALLBACKS(name) \ Callback::Cancelable * onSuccessCallback = nullptr; \ Callback::Cancelable * onFailureCallback = nullptr; \ - NodeId sourceId = emberAfCurrentCommand()->source; \ + NodeId sourceId = emberAfCurrentCommand()->SourceNodeId(); \ uint8_t sequenceNumber = emberAfCurrentCommand()->seqNum; \ CHIP_ERROR err = gCallbacks.GetResponseCallback(sourceId, sequenceNumber, &onSuccessCallback, &onFailureCallback); \ \ @@ -2087,7 +2087,7 @@ bool emberAfReportAttributesCallback(ClusterId clusterId, uint8_t * message, uin ChipLogProgress(Zcl, "emberAfReportAttributeCallback:"); ChipLogProgress(Zcl, " ClusterId: 0x%04x", clusterId); - NodeId sourceId = emberAfCurrentCommand()->source; + NodeId sourceId = emberAfCurrentCommand()->SourceNodeId(); ChipLogProgress(Zcl, " Source NodeId: %" PRIu64, sourceId); EndpointId endpointId = emberAfCurrentCommand()->apsFrame->sourceEndpoint; diff --git a/examples/chip-tool/gen/callback-stub.cpp b/examples/chip-tool/gen/callback-stub.cpp index d56e6179ea5fa9..1d2bb574ae58b6 100644 --- a/examples/chip-tool/gen/callback-stub.cpp +++ b/examples/chip-tool/gen/callback-stub.cpp @@ -575,8 +575,8 @@ bool __attribute__((weak)) emberAfPreMessageSendCallback(EmberAfMessageStruct * * @param status Ver.: always */ bool __attribute__((weak)) -emberAfMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, EmberApsFrame * apsFrame, uint16_t msgLen, - uint8_t * message, EmberStatus status) +emberAfMessageSentCallback(EmberOutgoingMessageType type, MessageSendDestination destination, EmberApsFrame * apsFrame, + uint16_t msgLen, uint8_t * message, EmberStatus status) { return false; } diff --git a/examples/chip-tool/gen/callback.h b/examples/chip-tool/gen/callback.h index dee7c87ac78607..8862345b9ed105 100644 --- a/examples/chip-tool/gen/callback.h +++ b/examples/chip-tool/gen/callback.h @@ -336,13 +336,13 @@ void emberAfAccountLoginClusterClientManufacturerSpecificAttributeChangedCallbac * Client Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfAccountLoginClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfAccountLoginClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -406,15 +406,15 @@ void emberAfApplicationBasicClusterClientManufacturerSpecificAttributeChangedCal * Client Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfApplicationBasicClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, - EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, - EmberStatus status); +void emberAfApplicationBasicClusterClientMessageSentCallback(EmberOutgoingMessageType type, + chip::MessageSendDestination destination, EmberApsFrame * apsFrame, + uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief Application Basic Cluster Client Pre Attribute Changed * @@ -477,15 +477,15 @@ void emberAfApplicationLauncherClusterClientManufacturerSpecificAttributeChanged * Client Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfApplicationLauncherClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, - EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, - EmberStatus status); +void emberAfApplicationLauncherClusterClientMessageSentCallback(EmberOutgoingMessageType type, + chip::MessageSendDestination destination, EmberApsFrame * apsFrame, + uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief Application Launcher Cluster Client Pre Attribute Changed * @@ -548,13 +548,13 @@ void emberAfAudioOutputClusterClientManufacturerSpecificAttributeChangedCallback * Client Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfAudioOutputClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfAudioOutputClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -618,13 +618,13 @@ void emberAfBarrierControlClusterClientManufacturerSpecificAttributeChangedCallb * Client Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfBarrierControlClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfBarrierControlClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -688,13 +688,13 @@ void emberAfBasicClusterClientManufacturerSpecificAttributeChangedCallback(chip: * Client Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfBasicClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfBasicClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief Basic Cluster Client Pre Attribute Changed @@ -757,13 +757,13 @@ void emberAfBindingClusterClientManufacturerSpecificAttributeChangedCallback(chi * Client Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfBindingClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfBindingClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -827,13 +827,13 @@ void emberAfColorControlClusterClientManufacturerSpecificAttributeChangedCallbac * Client Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfColorControlClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfColorControlClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -897,13 +897,13 @@ void emberAfContentLaunchClusterClientManufacturerSpecificAttributeChangedCallba * Client Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfContentLaunchClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfContentLaunchClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -967,13 +967,13 @@ void emberAfDescriptorClusterClientManufacturerSpecificAttributeChangedCallback( * Client Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfDescriptorClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfDescriptorClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -1037,13 +1037,13 @@ void emberAfDoorLockClusterClientManufacturerSpecificAttributeChangedCallback(ch * Client Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfDoorLockClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfDoorLockClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -1107,15 +1107,15 @@ void emberAfGeneralCommissioningClusterClientManufacturerSpecificAttributeChange * Client Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfGeneralCommissioningClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, - EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, - EmberStatus status); +void emberAfGeneralCommissioningClusterClientMessageSentCallback(EmberOutgoingMessageType type, + chip::MessageSendDestination destination, EmberApsFrame * apsFrame, + uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief General Commissioning Cluster Client Pre Attribute Changed * @@ -1178,15 +1178,15 @@ void emberAfGroupKeyManagementClusterClientManufacturerSpecificAttributeChangedC * Client Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfGroupKeyManagementClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, - EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, - EmberStatus status); +void emberAfGroupKeyManagementClusterClientMessageSentCallback(EmberOutgoingMessageType type, + chip::MessageSendDestination destination, EmberApsFrame * apsFrame, + uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief Group Key Management Cluster Client Pre Attribute Changed * @@ -1249,13 +1249,13 @@ void emberAfGroupsClusterClientManufacturerSpecificAttributeChangedCallback(chip * Client Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfGroupsClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfGroupsClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -1319,13 +1319,13 @@ void emberAfIdentifyClusterClientManufacturerSpecificAttributeChangedCallback(ch * Client Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfIdentifyClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfIdentifyClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -1389,13 +1389,13 @@ void emberAfKeypadInputClusterClientManufacturerSpecificAttributeChangedCallback * Client Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfKeypadInputClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfKeypadInputClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -1459,13 +1459,13 @@ void emberAfLevelControlClusterClientManufacturerSpecificAttributeChangedCallbac * Client Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfLevelControlClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfLevelControlClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -1529,13 +1529,13 @@ void emberAfLowPowerClusterClientManufacturerSpecificAttributeChangedCallback(ch * Client Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfLowPowerClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfLowPowerClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -1599,13 +1599,13 @@ void emberAfMediaInputClusterClientManufacturerSpecificAttributeChangedCallback( * Client Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfMediaInputClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfMediaInputClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -1669,13 +1669,13 @@ void emberAfMediaPlaybackClusterClientManufacturerSpecificAttributeChangedCallba * Client Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfMediaPlaybackClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfMediaPlaybackClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -1739,15 +1739,15 @@ void emberAfNetworkCommissioningClusterClientManufacturerSpecificAttributeChange * Client Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfNetworkCommissioningClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, - EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, - EmberStatus status); +void emberAfNetworkCommissioningClusterClientMessageSentCallback(EmberOutgoingMessageType type, + chip::MessageSendDestination destination, EmberApsFrame * apsFrame, + uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief Network Commissioning Cluster Client Pre Attribute Changed * @@ -1809,13 +1809,13 @@ void emberAfOnOffClusterClientManufacturerSpecificAttributeChangedCallback(chip: * Client Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfOnOffClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfOnOffClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief On/off Cluster Client Pre Attribute Changed @@ -1878,13 +1878,14 @@ void emberAfOperationalCredentialsClusterClientManufacturerSpecificAttributeChan * Client Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfOperationalCredentialsClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfOperationalCredentialsClusterClientMessageSentCallback(EmberOutgoingMessageType type, + chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -1950,13 +1951,14 @@ void emberAfPumpConfigurationAndControlClusterClientManufacturerSpecificAttribut * Client Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfPumpConfigurationAndControlClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfPumpConfigurationAndControlClusterClientMessageSentCallback(EmberOutgoingMessageType type, + chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -2021,13 +2023,13 @@ void emberAfScenesClusterClientManufacturerSpecificAttributeChangedCallback(chip * Client Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfScenesClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfScenesClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -2091,13 +2093,13 @@ void emberAfSwitchClusterClientManufacturerSpecificAttributeChangedCallback(chip * Client Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfSwitchClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfSwitchClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -2161,13 +2163,13 @@ void emberAfTvChannelClusterClientManufacturerSpecificAttributeChangedCallback(c * Client Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfTvChannelClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfTvChannelClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -2231,13 +2233,13 @@ void emberAfTargetNavigatorClusterClientManufacturerSpecificAttributeChangedCall * Client Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfTargetNavigatorClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfTargetNavigatorClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -2302,13 +2304,14 @@ void emberAfTemperatureMeasurementClusterClientManufacturerSpecificAttributeChan * Client Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfTemperatureMeasurementClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfTemperatureMeasurementClusterClientMessageSentCallback(EmberOutgoingMessageType type, + chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -2373,13 +2376,13 @@ void emberAfTestClusterClusterClientManufacturerSpecificAttributeChangedCallback * Client Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfTestClusterClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfTestClusterClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -2443,13 +2446,13 @@ void emberAfThermostatClusterClientManufacturerSpecificAttributeChangedCallback( * Client Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfThermostatClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfThermostatClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -2513,13 +2516,13 @@ void emberAfWakeOnLanClusterClientManufacturerSpecificAttributeChangedCallback(c * Client Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfWakeOnLanClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfWakeOnLanClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -3372,13 +3375,13 @@ bool emberAfPreMessageSendCallback(EmberAfMessageStruct * messageStruct, EmberSt * be handled by the application framework. * * @param type Ver.: always - * @param indexOrDestination Ver.: always + * @param destination Ver.: always * @param apsFrame Ver.: always * @param msgLen Ver.: always * @param message Ver.: always * @param status Ver.: always */ -bool emberAfMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, EmberApsFrame * apsFrame, +bool emberAfMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief Pre Attribute Change diff --git a/examples/lighting-app/lighting-common/gen/callback-stub.cpp b/examples/lighting-app/lighting-common/gen/callback-stub.cpp index 9472cfe4f1403e..31e73f34584784 100644 --- a/examples/lighting-app/lighting-common/gen/callback-stub.cpp +++ b/examples/lighting-app/lighting-common/gen/callback-stub.cpp @@ -359,8 +359,8 @@ bool __attribute__((weak)) emberAfPreMessageSendCallback(EmberAfMessageStruct * * @param status Ver.: always */ bool __attribute__((weak)) -emberAfMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, EmberApsFrame * apsFrame, uint16_t msgLen, - uint8_t * message, EmberStatus status) +emberAfMessageSentCallback(EmberOutgoingMessageType type, MessageSendDestination destination, EmberApsFrame * apsFrame, + uint16_t msgLen, uint8_t * message, EmberStatus status) { return false; } diff --git a/examples/lighting-app/lighting-common/gen/callback.h b/examples/lighting-app/lighting-common/gen/callback.h index 498399ab5d4e8e..39aa982192708c 100644 --- a/examples/lighting-app/lighting-common/gen/callback.h +++ b/examples/lighting-app/lighting-common/gen/callback.h @@ -119,13 +119,13 @@ void emberAfBasicClusterServerManufacturerSpecificAttributeChangedCallback(chip: * Server Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfBasicClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfBasicClusterServerMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief Basic Cluster Server Pre Attribute Changed @@ -188,15 +188,15 @@ void emberAfGeneralCommissioningClusterServerManufacturerSpecificAttributeChange * Server Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfGeneralCommissioningClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, - EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, - EmberStatus status); +void emberAfGeneralCommissioningClusterServerMessageSentCallback(EmberOutgoingMessageType type, + chip::MessageSendDestination destination, EmberApsFrame * apsFrame, + uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief General Commissioning Cluster Server Pre Attribute Changed * @@ -259,13 +259,13 @@ void emberAfLevelControlClusterServerManufacturerSpecificAttributeChangedCallbac * Server Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfLevelControlClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfLevelControlClusterServerMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -329,15 +329,15 @@ void emberAfNetworkCommissioningClusterServerManufacturerSpecificAttributeChange * Server Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfNetworkCommissioningClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, - EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, - EmberStatus status); +void emberAfNetworkCommissioningClusterServerMessageSentCallback(EmberOutgoingMessageType type, + chip::MessageSendDestination destination, EmberApsFrame * apsFrame, + uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief Network Commissioning Cluster Server Pre Attribute Changed * @@ -399,13 +399,13 @@ void emberAfOnOffClusterServerManufacturerSpecificAttributeChangedCallback(chip: * Server Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfOnOffClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfOnOffClusterServerMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief On/off Cluster Server Pre Attribute Changed @@ -885,13 +885,13 @@ bool emberAfPreMessageSendCallback(EmberAfMessageStruct * messageStruct, EmberSt * be handled by the application framework. * * @param type Ver.: always - * @param indexOrDestination Ver.: always + * @param destination Ver.: always * @param apsFrame Ver.: always * @param msgLen Ver.: always * @param message Ver.: always * @param status Ver.: always */ -bool emberAfMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, EmberApsFrame * apsFrame, +bool emberAfMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief Pre Attribute Change diff --git a/examples/lock-app/lock-common/gen/callback-stub.cpp b/examples/lock-app/lock-common/gen/callback-stub.cpp index 57b45b9de6f3a5..d09e6a9f0bbd20 100644 --- a/examples/lock-app/lock-common/gen/callback-stub.cpp +++ b/examples/lock-app/lock-common/gen/callback-stub.cpp @@ -351,8 +351,8 @@ bool __attribute__((weak)) emberAfPreMessageSendCallback(EmberAfMessageStruct * * @param status Ver.: always */ bool __attribute__((weak)) -emberAfMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, EmberApsFrame * apsFrame, uint16_t msgLen, - uint8_t * message, EmberStatus status) +emberAfMessageSentCallback(EmberOutgoingMessageType type, MessageSendDestination destination, EmberApsFrame * apsFrame, + uint16_t msgLen, uint8_t * message, EmberStatus status) { return false; } diff --git a/examples/lock-app/lock-common/gen/callback.h b/examples/lock-app/lock-common/gen/callback.h index 54949161f463d0..5d1e8e8052ddd3 100644 --- a/examples/lock-app/lock-common/gen/callback.h +++ b/examples/lock-app/lock-common/gen/callback.h @@ -111,13 +111,13 @@ void emberAfBasicClusterServerManufacturerSpecificAttributeChangedCallback(chip: * Server Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfBasicClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfBasicClusterServerMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief Basic Cluster Server Pre Attribute Changed @@ -180,15 +180,15 @@ void emberAfGeneralCommissioningClusterServerManufacturerSpecificAttributeChange * Server Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfGeneralCommissioningClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, - EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, - EmberStatus status); +void emberAfGeneralCommissioningClusterServerMessageSentCallback(EmberOutgoingMessageType type, + chip::MessageSendDestination destination, EmberApsFrame * apsFrame, + uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief General Commissioning Cluster Server Pre Attribute Changed * @@ -251,15 +251,15 @@ void emberAfNetworkCommissioningClusterServerManufacturerSpecificAttributeChange * Server Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfNetworkCommissioningClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, - EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, - EmberStatus status); +void emberAfNetworkCommissioningClusterServerMessageSentCallback(EmberOutgoingMessageType type, + chip::MessageSendDestination destination, EmberApsFrame * apsFrame, + uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief Network Commissioning Cluster Server Pre Attribute Changed * @@ -321,13 +321,13 @@ void emberAfOnOffClusterServerManufacturerSpecificAttributeChangedCallback(chip: * Server Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfOnOffClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfOnOffClusterServerMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief On/off Cluster Server Pre Attribute Changed @@ -732,13 +732,13 @@ bool emberAfPreMessageSendCallback(EmberAfMessageStruct * messageStruct, EmberSt * be handled by the application framework. * * @param type Ver.: always - * @param indexOrDestination Ver.: always + * @param destination Ver.: always * @param apsFrame Ver.: always * @param msgLen Ver.: always * @param message Ver.: always * @param status Ver.: always */ -bool emberAfMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, EmberApsFrame * apsFrame, +bool emberAfMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief Pre Attribute Change diff --git a/examples/temperature-measurement-app/esp32/main/gen/callback-stub.cpp b/examples/temperature-measurement-app/esp32/main/gen/callback-stub.cpp index 0c0d2d146fd912..c98ee87fe255f0 100644 --- a/examples/temperature-measurement-app/esp32/main/gen/callback-stub.cpp +++ b/examples/temperature-measurement-app/esp32/main/gen/callback-stub.cpp @@ -351,8 +351,8 @@ bool __attribute__((weak)) emberAfPreMessageSendCallback(EmberAfMessageStruct * * @param status Ver.: always */ bool __attribute__((weak)) -emberAfMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, EmberApsFrame * apsFrame, uint16_t msgLen, - uint8_t * message, EmberStatus status) +emberAfMessageSentCallback(EmberOutgoingMessageType type, MessageSendDestination destination, EmberApsFrame * apsFrame, + uint16_t msgLen, uint8_t * message, EmberStatus status) { return false; } diff --git a/examples/temperature-measurement-app/esp32/main/gen/callback.h b/examples/temperature-measurement-app/esp32/main/gen/callback.h index 3b342e4bd85c9a..47b169e5a18f20 100644 --- a/examples/temperature-measurement-app/esp32/main/gen/callback.h +++ b/examples/temperature-measurement-app/esp32/main/gen/callback.h @@ -111,13 +111,13 @@ void emberAfBasicClusterServerManufacturerSpecificAttributeChangedCallback(chip: * Server Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfBasicClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfBasicClusterServerMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief Basic Cluster Server Pre Attribute Changed @@ -180,15 +180,15 @@ void emberAfGeneralCommissioningClusterServerManufacturerSpecificAttributeChange * Server Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfGeneralCommissioningClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, - EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, - EmberStatus status); +void emberAfGeneralCommissioningClusterServerMessageSentCallback(EmberOutgoingMessageType type, + chip::MessageSendDestination destination, EmberApsFrame * apsFrame, + uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief General Commissioning Cluster Server Pre Attribute Changed * @@ -251,15 +251,15 @@ void emberAfNetworkCommissioningClusterServerManufacturerSpecificAttributeChange * Server Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfNetworkCommissioningClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, - EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, - EmberStatus status); +void emberAfNetworkCommissioningClusterServerMessageSentCallback(EmberOutgoingMessageType type, + chip::MessageSendDestination destination, EmberApsFrame * apsFrame, + uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief Network Commissioning Cluster Server Pre Attribute Changed * @@ -322,13 +322,14 @@ void emberAfTemperatureMeasurementClusterServerManufacturerSpecificAttributeChan * Server Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfTemperatureMeasurementClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfTemperatureMeasurementClusterServerMessageSentCallback(EmberOutgoingMessageType type, + chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -717,13 +718,13 @@ bool emberAfPreMessageSendCallback(EmberAfMessageStruct * messageStruct, EmberSt * be handled by the application framework. * * @param type Ver.: always - * @param indexOrDestination Ver.: always + * @param destination Ver.: always * @param apsFrame Ver.: always * @param msgLen Ver.: always * @param message Ver.: always * @param status Ver.: always */ -bool emberAfMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, EmberApsFrame * apsFrame, +bool emberAfMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief Pre Attribute Change diff --git a/examples/tv-app/tv-common/gen/callback-stub.cpp b/examples/tv-app/tv-common/gen/callback-stub.cpp index 5c039a5353800f..e8b02d31d42cc8 100644 --- a/examples/tv-app/tv-common/gen/callback-stub.cpp +++ b/examples/tv-app/tv-common/gen/callback-stub.cpp @@ -471,8 +471,8 @@ bool __attribute__((weak)) emberAfPreMessageSendCallback(EmberAfMessageStruct * * @param status Ver.: always */ bool __attribute__((weak)) -emberAfMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, EmberApsFrame * apsFrame, uint16_t msgLen, - uint8_t * message, EmberStatus status) +emberAfMessageSentCallback(EmberOutgoingMessageType type, MessageSendDestination destination, EmberApsFrame * apsFrame, + uint16_t msgLen, uint8_t * message, EmberStatus status) { return false; } diff --git a/examples/tv-app/tv-common/gen/callback.h b/examples/tv-app/tv-common/gen/callback.h index 81a954961484ca..b3a6dcfd06e512 100644 --- a/examples/tv-app/tv-common/gen/callback.h +++ b/examples/tv-app/tv-common/gen/callback.h @@ -232,13 +232,13 @@ void emberAfAccountLoginClusterServerManufacturerSpecificAttributeChangedCallbac * Server Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfAccountLoginClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfAccountLoginClusterServerMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -302,15 +302,15 @@ void emberAfApplicationBasicClusterServerManufacturerSpecificAttributeChangedCal * Server Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfApplicationBasicClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, - EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, - EmberStatus status); +void emberAfApplicationBasicClusterServerMessageSentCallback(EmberOutgoingMessageType type, + chip::MessageSendDestination destination, EmberApsFrame * apsFrame, + uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief Application Basic Cluster Server Pre Attribute Changed * @@ -373,15 +373,15 @@ void emberAfApplicationLauncherClusterServerManufacturerSpecificAttributeChanged * Server Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfApplicationLauncherClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, - EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, - EmberStatus status); +void emberAfApplicationLauncherClusterServerMessageSentCallback(EmberOutgoingMessageType type, + chip::MessageSendDestination destination, EmberApsFrame * apsFrame, + uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief Application Launcher Cluster Server Pre Attribute Changed * @@ -444,13 +444,13 @@ void emberAfAudioOutputClusterServerManufacturerSpecificAttributeChangedCallback * Server Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfAudioOutputClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfAudioOutputClusterServerMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -514,13 +514,13 @@ void emberAfColorControlClusterServerManufacturerSpecificAttributeChangedCallbac * Server Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfColorControlClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfColorControlClusterServerMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -584,13 +584,13 @@ void emberAfContentLaunchClusterServerManufacturerSpecificAttributeChangedCallba * Server Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfContentLaunchClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfContentLaunchClusterServerMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -654,15 +654,15 @@ void emberAfGeneralCommissioningClusterServerManufacturerSpecificAttributeChange * Server Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfGeneralCommissioningClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, - EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, - EmberStatus status); +void emberAfGeneralCommissioningClusterServerMessageSentCallback(EmberOutgoingMessageType type, + chip::MessageSendDestination destination, EmberApsFrame * apsFrame, + uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief General Commissioning Cluster Server Pre Attribute Changed * @@ -725,13 +725,13 @@ void emberAfGroupsClusterServerManufacturerSpecificAttributeChangedCallback(chip * Server Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfGroupsClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfGroupsClusterServerMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -795,13 +795,13 @@ void emberAfIdentifyClusterServerManufacturerSpecificAttributeChangedCallback(ch * Server Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfIdentifyClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfIdentifyClusterServerMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -865,13 +865,13 @@ void emberAfKeypadInputClusterServerManufacturerSpecificAttributeChangedCallback * Server Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfKeypadInputClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfKeypadInputClusterServerMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -935,13 +935,13 @@ void emberAfLevelControlClusterServerManufacturerSpecificAttributeChangedCallbac * Server Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfLevelControlClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfLevelControlClusterServerMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -1005,13 +1005,13 @@ void emberAfLowPowerClusterServerManufacturerSpecificAttributeChangedCallback(ch * Server Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfLowPowerClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfLowPowerClusterServerMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -1075,13 +1075,13 @@ void emberAfMediaInputClusterServerManufacturerSpecificAttributeChangedCallback( * Server Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfMediaInputClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfMediaInputClusterServerMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -1145,13 +1145,13 @@ void emberAfMediaPlaybackClusterServerManufacturerSpecificAttributeChangedCallba * Server Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfMediaPlaybackClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfMediaPlaybackClusterServerMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -1214,13 +1214,13 @@ void emberAfOnOffClusterServerManufacturerSpecificAttributeChangedCallback(chip: * Server Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfOnOffClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfOnOffClusterServerMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief On/off Cluster Server Pre Attribute Changed @@ -1283,13 +1283,13 @@ void emberAfScenesClusterServerManufacturerSpecificAttributeChangedCallback(chip * Server Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfScenesClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfScenesClusterServerMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -1353,13 +1353,13 @@ void emberAfTvChannelClusterServerManufacturerSpecificAttributeChangedCallback(c * Server Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfTvChannelClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfTvChannelClusterServerMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -1423,13 +1423,13 @@ void emberAfTargetNavigatorClusterServerManufacturerSpecificAttributeChangedCall * Server Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfTargetNavigatorClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfTargetNavigatorClusterServerMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -1494,13 +1494,13 @@ void emberAfWakeOnLanClusterServerManufacturerSpecificAttributeChangedCallback(c * Server Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfWakeOnLanClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfWakeOnLanClusterServerMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -2009,13 +2009,13 @@ bool emberAfPreMessageSendCallback(EmberAfMessageStruct * messageStruct, EmberSt * be handled by the application framework. * * @param type Ver.: always - * @param indexOrDestination Ver.: always + * @param destination Ver.: always * @param apsFrame Ver.: always * @param msgLen Ver.: always * @param message Ver.: always * @param status Ver.: always */ -bool emberAfMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, EmberApsFrame * apsFrame, +bool emberAfMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief Pre Attribute Change diff --git a/examples/window-app/common/gen/callback-stub.cpp b/examples/window-app/common/gen/callback-stub.cpp index 58431f99519b9f..cbee43138d08e8 100644 --- a/examples/window-app/common/gen/callback-stub.cpp +++ b/examples/window-app/common/gen/callback-stub.cpp @@ -327,8 +327,8 @@ bool __attribute__((weak)) emberAfPreMessageSendCallback(EmberAfMessageStruct * * @param status Ver.: always */ bool __attribute__((weak)) -emberAfMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, EmberApsFrame * apsFrame, uint16_t msgLen, - uint8_t * message, EmberStatus status) +emberAfMessageSentCallback(EmberOutgoingMessageType type, MessageSendDestination destination, EmberApsFrame * apsFrame, + uint16_t msgLen, uint8_t * message, EmberStatus status) { return false; } diff --git a/examples/window-app/common/gen/callback.h b/examples/window-app/common/gen/callback.h index 7108699ee67b78..281b6f82c3745a 100644 --- a/examples/window-app/common/gen/callback.h +++ b/examples/window-app/common/gen/callback.h @@ -88,13 +88,13 @@ void emberAfWindowCoveringClusterServerManufacturerSpecificAttributeChangedCallb * Server Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfWindowCoveringClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfWindowCoveringClusterServerMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -412,13 +412,13 @@ bool emberAfPreMessageSendCallback(EmberAfMessageStruct * messageStruct, EmberSt * be handled by the application framework. * * @param type Ver.: always - * @param indexOrDestination Ver.: always + * @param destination Ver.: always * @param apsFrame Ver.: always * @param msgLen Ver.: always * @param message Ver.: always * @param status Ver.: always */ -bool emberAfMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, EmberApsFrame * apsFrame, +bool emberAfMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief Pre Attribute Change diff --git a/src/app/Command.h b/src/app/Command.h index 48684ee967f67e..0e3e3b49e3edb2 100644 --- a/src/app/Command.h +++ b/src/app/Command.h @@ -109,7 +109,7 @@ class Command * exchange context has been assigned or the context * has been released. */ - const Messaging::ExchangeContext * GetExchangeContext() const { return mpExchangeCtx; } + Messaging::ExchangeContext * GetExchangeContext() const { return mpExchangeCtx; } CHIP_ERROR Reset(); diff --git a/src/app/clusters/ias-zone-server/ias-zone-server.cpp b/src/app/clusters/ias-zone-server/ias-zone-server.cpp index af6d1f4a122654..8cdf8b7209161f 100644 --- a/src/app/clusters/ias-zone-server/ias-zone-server.cpp +++ b/src/app/clusters/ias-zone-server/ias-zone-server.cpp @@ -762,7 +762,7 @@ void emberAfPluginIasZoneServerPrintQueueConfig(void) // destination when the destination is the only router the node is joined to. // In that case, the command will never have been sent, as the device will have // had no router by which to send the command. -void emberAfIasZoneClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfIasZoneClusterServerMessageSentCallback(EmberOutgoingMessageType type, MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status) { diff --git a/src/app/clusters/operational-credentials-server/operational-credentials-server.cpp b/src/app/clusters/operational-credentials-server/operational-credentials-server.cpp index 0f96ac36f1b0e0..5bca1d6626355c 100644 --- a/src/app/clusters/operational-credentials-server/operational-credentials-server.cpp +++ b/src/app/clusters/operational-credentials-server/operational-credentials-server.cpp @@ -147,7 +147,7 @@ CHIP_ERROR writeAdminsIntoFabricsListAttribute() AdminPairingInfo * retrieveCurrentAdmin() { - uint64_t fabricId = emberAfCurrentCommand()->source; + uint64_t fabricId = emberAfCurrentCommand()->SourceNodeId(); // TODO: Figure out how to get device node id so we can do FindAdminForNode(fabricId, nodeId)... emberAfPrintln(EMBER_AF_PRINT_DEBUG, "OpCreds: Finding admin with fabricId %" PRIX64 ".", fabricId); return GetGlobalAdminPairingTable().FindAdminForNode(fabricId); @@ -244,11 +244,11 @@ bool emberAfOperationalCredentialsClusterSetFabricCallback(chip::app::Command * err = GetGlobalAdminPairingTable().Store(admin->GetAdminId()); VerifyOrExit(err == CHIP_NO_ERROR, status = EMBER_ZCL_STATUS_FAILURE); - // Return FabricId - we are temporarily using commissioner nodeId (retrieved via emberAfCurrentCommand()->source) as fabricId - // until addOptCert + fabricIndex are implemented. Once they are, this method and its response will go away. + // Return FabricId - we are temporarily using commissioner nodeId (retrieved via emberAfCurrentCommand()->SourceNodeId()) as + // fabricId until addOptCert + fabricIndex are implemented. Once they are, this method and its response will go away. emberAfFillExternalBuffer((ZCL_CLUSTER_SPECIFIC_COMMAND | ZCL_FRAME_CONTROL_SERVER_TO_CLIENT), ZCL_OPERATIONAL_CREDENTIALS_CLUSTER_ID, ZCL_SET_FABRIC_RESPONSE_COMMAND_ID, "y", - emberAfCurrentCommand()->source); + emberAfCurrentCommand()->SourceNodeId()); sendStatus = emberAfSendResponse(); exit: diff --git a/src/app/reporting/reporting.cpp b/src/app/reporting/reporting.cpp index c74db569dfe886..3c2f3cbe88233e 100644 --- a/src/app/reporting/reporting.cpp +++ b/src/app/reporting/reporting.cpp @@ -74,8 +74,8 @@ static void removeConfigurationAndScheduleTick(uint8_t index); static EmberAfStatus configureReceivedAttribute(const EmberAfClusterCommand * cmd, AttributeId attributeId, uint8_t mask, uint16_t timeout); static void putReportableChangeInResp(const EmberAfPluginReportingEntry * entry, EmberAfAttributeType dataType); -static void retrySendReport(EmberOutgoingMessageType type, uint64_t indexOrDestination, EmberApsFrame * apsFrame, uint16_t msgLen, - uint8_t * message, EmberStatus status); +static void retrySendReport(EmberOutgoingMessageType type, MessageSendDestination destination, EmberApsFrame * apsFrame, + uint16_t msgLen, uint8_t * message, EmberStatus status); static uint32_t computeStringHash(uint8_t * data, uint8_t length); EmberEventControl emberAfPluginReportingTickEventControl; @@ -100,13 +100,13 @@ EmberAfStatus emberAfPluginReportingConfiguredCallback(const EmberAfPluginReport return EMBER_ZCL_STATUS_SUCCESS; } -static void retrySendReport(EmberOutgoingMessageType type, uint64_t indexOrDestination, EmberApsFrame * apsFrame, uint16_t msgLen, - uint8_t * message, EmberStatus status) +static void retrySendReport(EmberOutgoingMessageType type, MessageSendDestination destination, EmberApsFrame * apsFrame, + uint16_t msgLen, uint8_t * message, EmberStatus status) { // Retry once, and do so by unicasting without a pointer to this callback if (status != EMBER_SUCCESS) { - emberAfSendUnicast(type, indexOrDestination, apsFrame, msgLen, message); + emberAfSendUnicast(type, destination, apsFrame, msgLen, message); } } @@ -626,7 +626,8 @@ bool emberAfReadReportingConfigurationCommandCallback(const EmberAfClusterComman entry.clusterId == cmd->apsFrame->clusterId && entry.attributeId == attributeId && entry.mask == mask && entry.manufacturerCode == cmd->mfgCode && (entry.direction == EMBER_ZCL_REPORTING_DIRECTION_REPORTED || - (entry.data.received.source == cmd->source && entry.data.received.endpoint == cmd->apsFrame->sourceEndpoint))) + (entry.data.received.source == cmd->SourceNodeId() && + entry.data.received.endpoint == cmd->apsFrame->sourceEndpoint))) { found = true; break; @@ -990,7 +991,7 @@ static EmberAfStatus configureReceivedAttribute(const EmberAfClusterCommand * cm } if (entry.direction == EMBER_ZCL_REPORTING_DIRECTION_RECEIVED && entry.endpoint == cmd->apsFrame->destinationEndpoint && entry.clusterId == cmd->apsFrame->clusterId && entry.attributeId == attributeId && entry.mask == mask && - entry.manufacturerCode == cmd->mfgCode && entry.data.received.source == cmd->source && + entry.manufacturerCode == cmd->mfgCode && entry.data.received.source == cmd->SourceNodeId() && entry.data.received.endpoint == cmd->apsFrame->sourceEndpoint) { initialize = false; @@ -1015,7 +1016,7 @@ static EmberAfStatus configureReceivedAttribute(const EmberAfClusterCommand * cm entry.attributeId = attributeId; entry.mask = mask; entry.manufacturerCode = cmd->mfgCode; - entry.data.received.source = cmd->source; + entry.data.received.source = cmd->SourceNodeId(); entry.data.received.endpoint = cmd->apsFrame->sourceEndpoint; } diff --git a/src/app/server/Server.cpp b/src/app/server/Server.cpp index aa39a7d590b62e..3eea04a0a579c6 100644 --- a/src/app/server/Server.cpp +++ b/src/app/server/Server.cpp @@ -373,7 +373,7 @@ class ServerCallback : public ExchangeDelegate } else { - HandleDataModelMessage(packetHeader.GetSourceNodeId().Value(), std::move(buffer)); + HandleDataModelMessage(exchangeContext, std::move(buffer)); } exit: diff --git a/src/app/util/DataModelHandler.cpp b/src/app/util/DataModelHandler.cpp index 7ee94246b85897..3f0d4be29d8a18 100644 --- a/src/app/util/DataModelHandler.cpp +++ b/src/app/util/DataModelHandler.cpp @@ -65,7 +65,7 @@ void InitDataModelHandler(chip::Messaging::ExchangeManager * exchangeManager) #endif } -void HandleDataModelMessage(NodeId nodeId, System::PacketBufferHandle buffer) +void HandleDataModelMessage(Messaging::ExchangeContext * exchange, System::PacketBufferHandle buffer) { #ifdef USE_ZAP_CONFIG EmberApsFrame frame; @@ -85,7 +85,7 @@ void HandleDataModelMessage(NodeId nodeId, System::PacketBufferHandle buffer) ok = emberAfProcessMessage(&frame, 0, // type message, messageLen, - nodeId, // source identifier + exchange, // source identifier NULL); if (ok) diff --git a/src/app/util/DataModelHandler.h b/src/app/util/DataModelHandler.h index e0a600111b1b83..1dca8c4fa7d2f5 100644 --- a/src/app/util/DataModelHandler.h +++ b/src/app/util/DataModelHandler.h @@ -22,6 +22,7 @@ #pragma once +#include #include #include #include @@ -37,9 +38,9 @@ void InitDataModelHandler(chip::Messaging::ExchangeManager * exchangeMgr); * Handle a message that should be processed via our data model processing * codepath. * - * @param [in] nodeId The source node id of the message + * @param [in] exchange The exchange on which the message was received. * @param [in] buffer The buffer holding the message. This function guarantees * that it will free the buffer before returning. * */ -void HandleDataModelMessage(chip::NodeId nodeId, chip::System::PacketBufferHandle buffer); +void HandleDataModelMessage(chip::Messaging::ExchangeContext * exchange, chip::System::PacketBufferHandle buffer); diff --git a/src/app/util/af-main-common.cpp b/src/app/util/af-main-common.cpp index 06a72d91703fba..6ffd8cd5983822 100644 --- a/src/app/util/af-main-common.cpp +++ b/src/app/util/af-main-common.cpp @@ -202,7 +202,7 @@ void emAfInitializeMessageSentCallbackArray(void) } } -static EmberStatus send(EmberOutgoingMessageType type, uint64_t indexOrDestination, EmberApsFrame * apsFrame, +static EmberStatus send(EmberOutgoingMessageType type, MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t messageLength, uint8_t * message, bool broadcast, EmberNodeId alias, uint8_t sequence, EmberAfMessageSentFunction callback) { @@ -268,7 +268,7 @@ static EmberStatus send(EmberOutgoingMessageType type, uint64_t indexOrDestinati { EmberAfMessageStruct messageStruct = { - callback, apsFrame, message, indexOrDestination, messageLength, type, broadcast, + callback, apsFrame, message, destination, messageLength, type, broadcast, }; // Called prior to fragmentation in case the mesasge does not go out over the // Zigbee radio, and instead goes to some other transport that does not require @@ -285,7 +285,7 @@ static EmberStatus send(EmberOutgoingMessageType type, uint64_t indexOrDestinati if (messageLength <= EMBER_AF_MAXIMUM_SEND_PAYLOAD_LENGTH) { - status = emAfSend(type, indexOrDestination, apsFrame, (uint8_t) messageLength, message, &messageTag, alias, sequence); + status = emAfSend(type, destination, apsFrame, (uint8_t) messageLength, message, &messageTag, alias, sequence); } else { @@ -297,7 +297,7 @@ static EmberStatus send(EmberOutgoingMessageType type, uint64_t indexOrDestinati if ((status != EMBER_SUCCESS) && (callback == emberAfPluginCriticalMessageQueueEnqueueCallback || callback == emAfPluginCriticalMessageQueueRetryCallback)) { - callback(type, indexOrDestination, apsFrame, messageLength, message, status); + callback(type, destination, apsFrame, messageLength, message, status); } #endif // EMBER_AF_PLUGIN_CRITICAL_MESSAGE_QUEUE @@ -332,7 +332,7 @@ EmberStatus emberAfSendMulticastWithAliasWithCallback(GroupId multicastId, Ember EmberAfMessageSentFunction callback) { apsFrame->groupId = multicastId; - return send(EMBER_OUTGOING_MULTICAST_WITH_ALIAS, multicastId, apsFrame, messageLength, message, + return send(EMBER_OUTGOING_MULTICAST_WITH_ALIAS, MessageSendDestination(multicastId), apsFrame, messageLength, message, true, // broadcast alias, sequence, callback); } @@ -341,7 +341,7 @@ EmberStatus emberAfSendMulticastWithCallback(GroupId multicastId, EmberApsFrame uint8_t * message, EmberAfMessageSentFunction callback) { apsFrame->groupId = multicastId; - return send(EMBER_OUTGOING_MULTICAST, multicastId, apsFrame, messageLength, message, + return send(EMBER_OUTGOING_MULTICAST, MessageSendDestination(multicastId), apsFrame, messageLength, message, true, // broadcast? 0, // alias 0, // sequence @@ -393,33 +393,38 @@ EmberStatus emberAfSendMulticastToBindings(EmberApsFrame * apsFrame, uint16_t me return status; } -EmberStatus emberAfSendBroadcastWithCallback(EmberNodeId destination, EmberApsFrame * apsFrame, uint16_t messageLength, - uint8_t * message, EmberAfMessageSentFunction callback) -{ - return send(EMBER_OUTGOING_BROADCAST, destination, apsFrame, messageLength, message, - true, // broadcast? - 0, // alias - 0, // sequence - callback); -} -EmberStatus emberAfSendBroadcastWithAliasWithCallback(EmberNodeId destination, EmberApsFrame * apsFrame, uint16_t messageLength, - uint8_t * message, EmberNodeId alias, uint8_t sequence, - EmberAfMessageSentFunction callback) -{ - return send(EMBER_OUTGOING_BROADCAST_WITH_ALIAS, destination, apsFrame, messageLength, message, - true, // broadcast? - alias, // alias - sequence, // sequence - callback); -} - -EmberStatus emberAfSendBroadcast(EmberNodeId destination, EmberApsFrame * apsFrame, uint16_t messageLength, uint8_t * message) -{ - return emberAfSendBroadcastWithCallback(destination, apsFrame, messageLength, message, NULL); -} - -EmberStatus emberAfSendUnicastWithCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, EmberApsFrame * apsFrame, - uint16_t messageLength, uint8_t * message, EmberAfMessageSentFunction callback) +// TODO: Figure out whether we need emberAfSendBroadcastWithCallback at all. +// EmberStatus emberAfSendBroadcastWithCallback(EmberNodeId destination, EmberApsFrame * apsFrame, uint16_t messageLength, +// uint8_t * message, EmberAfMessageSentFunction callback) +//{ +// return send(EMBER_OUTGOING_BROADCAST, destination, apsFrame, messageLength, message, +// true, // broadcast? +// 0, // alias +// 0, // sequence +// callback); +//} + +// TODO: Figure out whether we need emberAfSendBroadcastWithAliasWithCallback at all. +// EmberStatus emberAfSendBroadcastWithAliasWithCallback(EmberNodeId destination, EmberApsFrame * apsFrame, uint16_t messageLength, +// uint8_t * message, EmberNodeId alias, uint8_t sequence, +// EmberAfMessageSentFunction callback) +//{ +// return send(EMBER_OUTGOING_BROADCAST_WITH_ALIAS, destination, apsFrame, messageLength, message, +// true, // broadcast? +// alias, // alias +// sequence, // sequence +// callback); +//} + +// TODO: Figure out whether we need emberAfSendBroadcast at all. +// EmberStatus emberAfSendBroadcast(EmberNodeId destination, EmberApsFrame * apsFrame, uint16_t messageLength, uint8_t * message) +//{ +// return emberAfSendBroadcastWithCallback(destination, apsFrame, messageLength, message, NULL); +//} + +EmberStatus emberAfSendUnicastWithCallback(EmberOutgoingMessageType type, MessageSendDestination destination, + EmberApsFrame * apsFrame, uint16_t messageLength, uint8_t * message, + EmberAfMessageSentFunction callback) { // The source endpoint in the APS frame MAY NOT be valid at this point if the // outgoing type is "via binding." @@ -431,7 +436,7 @@ EmberStatus emberAfSendUnicastWithCallback(EmberOutgoingMessageType type, uint64 EmberBindingTableEntry binding; // TODO: This cast should go away once // https://github.com/project-chip/connectedhomeip/issues/3584 is fixed. - EmberStatus status = emberGetBinding(static_cast(indexOrDestination), &binding); + EmberStatus status = emberGetBinding(destination.mBindingIndex, &binding); if (status != EMBER_SUCCESS) { return status; @@ -439,17 +444,17 @@ EmberStatus emberAfSendUnicastWithCallback(EmberOutgoingMessageType type, uint64 apsFrame->sourceEndpoint = binding.local; apsFrame->destinationEndpoint = binding.remote; } - return send(type, indexOrDestination, apsFrame, messageLength, message, + return send(type, destination, apsFrame, messageLength, message, false, // broadcast? 0, // alias 0, // sequence callback); } -EmberStatus emberAfSendUnicast(EmberOutgoingMessageType type, uint64_t indexOrDestination, EmberApsFrame * apsFrame, +EmberStatus emberAfSendUnicast(EmberOutgoingMessageType type, MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t messageLength, uint8_t * message) { - return emberAfSendUnicastWithCallback(type, indexOrDestination, apsFrame, messageLength, message, NULL); + return emberAfSendUnicastWithCallback(type, destination, apsFrame, messageLength, message, NULL); } EmberStatus emberAfSendUnicastToBindingsWithCallback(EmberApsFrame * apsFrame, uint16_t messageLength, uint8_t * message, @@ -470,7 +475,7 @@ EmberStatus emberAfSendUnicastToBindingsWithCallback(EmberApsFrame * apsFrame, u binding.clusterId == apsFrame->clusterId) { apsFrame->destinationEndpoint = binding.remote; - status = send(EMBER_OUTGOING_VIA_BINDING, i, apsFrame, messageLength, message, + status = send(EMBER_OUTGOING_VIA_BINDING, MessageSendDestination(i), apsFrame, messageLength, message, false, // broadcast? 0, // alias 0, // sequence @@ -553,7 +558,7 @@ static void printMessage(EmberIncomingMessageType type, EmberApsFrame * apsFrame emberAfAppPrintln(""); } -void emAfMessageSentHandler(EmberOutgoingMessageType type, uint64_t indexOrDestination, EmberApsFrame * apsFrame, +void emAfMessageSentHandler(EmberOutgoingMessageType type, MessageSendDestination destination, EmberApsFrame * apsFrame, EmberStatus status, uint16_t messageLength, uint8_t * messageContents, uint8_t messageTag) { EmberAfMessageSentFunction callback; @@ -571,7 +576,7 @@ void emAfMessageSentHandler(EmberOutgoingMessageType type, uint64_t indexOrDesti if (messageContents != NULL && messageContents[0] & ZCL_CLUSTER_SPECIFIC_COMMAND) { emberAfClusterMessageSentWithMfgCodeCallback( - type, indexOrDestination, apsFrame, messageLength, messageContents, status, + type, destination, apsFrame, messageLength, messageContents, status, // If the manufacturer specific flag is set // get read it as next part of message // else use null code. @@ -582,23 +587,24 @@ void emAfMessageSentHandler(EmberOutgoingMessageType type, uint64_t indexOrDesti if (callback != NULL) { - (*callback)(type, indexOrDestination, apsFrame, messageLength, messageContents, status); + (*callback)(type, destination, apsFrame, messageLength, messageContents, status); } #ifdef EMBER_AF_GENERATED_PLUGIN_MESSAGE_SENT_FUNCTION_CALLS EMBER_AF_GENERATED_PLUGIN_MESSAGE_SENT_FUNCTION_CALLS #endif - emberAfMessageSentCallback(type, indexOrDestination, apsFrame, messageLength, messageContents, status); + emberAfMessageSentCallback(type, destination, apsFrame, messageLength, messageContents, status); } #ifdef EMBER_AF_PLUGIN_FRAGMENTATION -void emAfFragmentationMessageSentHandler(EmberOutgoingMessageType type, uint64_t indexOrDestination, EmberApsFrame * apsFrame, - uint8_t * buffer, uint16_t bufLen, EmberStatus status, uint8_t messageTag) +void emAfFragmentationMessageSentHandler(EmberOutgoingMessageType type, MessageSendDestination destination, + EmberApsFrame * apsFrame, uint8_t * buffer, uint16_t bufLen, EmberStatus status, + uint8_t messageTag) { // the fragmented message is no longer in process emberAfDebugPrintln("%pend.", "Fragmentation:"); - emAfMessageSentHandler(type, indexOrDestination, apsFrame, status, bufLen, buffer, messageTag); + emAfMessageSentHandler(type, destination, apsFrame, status, bufLen, buffer, messageTag); // EMZIGBEE-4437: setting back the buffers to the original in case someone set // that to something else. @@ -606,8 +612,8 @@ void emAfFragmentationMessageSentHandler(EmberOutgoingMessageType type, uint64_t } #endif // EMBER_AF_PLUGIN_FRAGMENTATION -EmberStatus emAfSend(EmberOutgoingMessageType type, uint64_t indexOrDestination, EmberApsFrame * apsFrame, uint8_t messageLength, - uint8_t * message, uint8_t * messageTag, EmberNodeId alias, uint8_t sequence) +EmberStatus emAfSend(EmberOutgoingMessageType type, MessageSendDestination destination, EmberApsFrame * apsFrame, + uint8_t messageLength, uint8_t * message, uint8_t * messageTag, EmberNodeId alias, uint8_t sequence) { // TODO: There's an impedance mismatch here in a few ways: // 1) The caller expects to get a messageTag out that will identify this @@ -628,9 +634,7 @@ EmberStatus emAfSend(EmberOutgoingMessageType type, uint64_t indexOrDestination, { case EMBER_OUTGOING_VIA_BINDING: { EmberBindingTableEntry binding; - // TODO: This cast should go away once - // https://github.com/project-chip/connectedhomeip/issues/3584 is fixed. - status = emberGetBinding(static_cast(indexOrDestination), &binding); + status = emberGetBinding(destination.mBindingIndex, &binding); if (status != EMBER_SUCCESS) { break; @@ -648,7 +652,7 @@ EmberStatus emAfSend(EmberOutgoingMessageType type, uint64_t indexOrDestination, status = EMBER_ERR_FATAL; break; case EMBER_OUTGOING_DIRECT: - status = chipSendUnicast(indexOrDestination, apsFrame, messageLength, message); + status = chipSendUnicast(destination.mNodeId, apsFrame, messageLength, message); break; case EMBER_OUTGOING_MULTICAST: // No implementation yet. @@ -666,6 +670,9 @@ EmberStatus emAfSend(EmberOutgoingMessageType type, uint64_t indexOrDestination, // No implementation yet. status = EMBER_ERR_FATAL; break; + case EMBER_OUTGOING_VIA_EXCHANGE: + status = chipSendUnicast(destination.mExchangeContext, apsFrame, messageLength, message); + break; default: status = EMBER_BAD_ARGUMENT; break; diff --git a/src/app/util/af-main.h b/src/app/util/af-main.h index 010c177a6ff03d..777fde0ebe4b90 100644 --- a/src/app/util/af-main.h +++ b/src/app/util/af-main.h @@ -121,8 +121,8 @@ bool emAfProcessZdo(EmberNodeId sender, EmberApsFrame * apsFrame, uint8_t * mess void emAfIncomingMessageHandler(EmberIncomingMessageType type, EmberApsFrame * apsFrame, uint8_t lastHopLqi, int8_t lastHopRssi, uint16_t messageLength, uint8_t * messageContents); -EmberStatus emAfSend(EmberOutgoingMessageType type, uint64_t indexOrDestination, EmberApsFrame * apsFrame, uint8_t messageLength, - uint8_t * message, uint8_t * messageTag, EmberNodeId alias, uint8_t sequence); +EmberStatus emAfSend(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, + uint8_t messageLength, uint8_t * message, uint8_t * messageTag, EmberNodeId alias, uint8_t sequence); void emAfMessageSentHandler(EmberOutgoingMessageType type, uint64_t indexOrDestination, EmberApsFrame * apsFrame, EmberStatus status, uint16_t messageLength, uint8_t * messageContents, uint8_t messageTag); diff --git a/src/app/util/af-types.h b/src/app/util/af-types.h index c3eda9b1e21b68..89b4c37274baa6 100644 --- a/src/app/util/af-types.h +++ b/src/app/util/af-types.h @@ -55,6 +55,8 @@ #include #include // For various types. +#include + #ifdef EZSP_HOST #include "app/util/ezsp/ezsp-enum.h" #endif @@ -423,14 +425,16 @@ typedef struct * and pass a pointer to that location around during * command processing */ -typedef struct +struct EmberAfClusterCommand { + chip::NodeId SourceNodeId() const { return source->GetSecureSession().GetPeerNodeId(); } + /** * APS frame for the incoming message */ EmberApsFrame * apsFrame; EmberIncomingMessageType type; - chip::NodeId source; + chip::Messaging::ExchangeContext * source; uint8_t * buffer; uint16_t bufLen; bool clusterSpecific; @@ -442,7 +446,7 @@ typedef struct uint8_t direction; EmberAfInterpanHeader * interPanHeader; uint8_t networkIndex; -} EmberAfClusterCommand; +}; /** * @brief Endpoint type struct describes clusters that are on the endpoint. @@ -1239,13 +1243,38 @@ typedef EmberAfStatus (*EmberAfClusterPreAttributeChangedCallback)(chip::Endpoin */ typedef void (*EmberAfDefaultResponseFunction)(chip::EndpointId endpoint, chip::CommandId commandId, EmberAfStatus status); +namespace chip { +/** + * @brief a type that represents where we are trying to send a message. This + * must always be paired with an EmberOutgoingMessageType that identifies + * which arm of the union is in use. + */ +union MessageSendDestination +{ + explicit constexpr MessageSendDestination(uint8_t aBindingIndex) : mBindingIndex(aBindingIndex) {} + explicit constexpr MessageSendDestination(NodeId aNodeId) : mNodeId(aNodeId) {} + explicit constexpr MessageSendDestination(GroupId aGroupId) : mGroupId(aGroupId) {} + explicit constexpr MessageSendDestination(Messaging::ExchangeContext * aExchangeContext) : mExchangeContext(aExchangeContext) {} + + // Used when the type is EMBER_OUTGOING_VIA_BINDING + uint8_t mBindingIndex; + // Used when the type is EMBER_OUTGOING_DIRECT + NodeId mNodeId; + // Used when the type is EMBER_OUTGOING_MULTICAST or + // EMBER_OUTGOING_MULTICAST_WITH_ALIAS + GroupId mGroupId; + // Used when the type is EMBER_OUTGOING_VIA_EXCHANGE + Messaging::ExchangeContext * mExchangeContext; +}; +} // namespace chip + /** * @brief Type for referring to the message sent callback function. * * This function is called when a message is sent. */ -typedef void (*EmberAfMessageSentFunction)(EmberOutgoingMessageType type, uint64_t indexOrDestination, EmberApsFrame * apsFrame, - uint16_t msgLen, uint8_t * message, EmberStatus status); +typedef void (*EmberAfMessageSentFunction)(EmberOutgoingMessageType type, chip::MessageSendDestination destination, + EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); /** * @brief The EmberAfMessageStruct is a struct wrapper that @@ -1257,7 +1286,7 @@ typedef struct EmberAfMessageSentFunction callback; EmberApsFrame * apsFrame; uint8_t * message; - uint64_t indexOrDestination; + chip::MessageSendDestination destination; uint16_t messageLength; EmberOutgoingMessageType type; bool broadcast; diff --git a/src/app/util/af.h b/src/app/util/af.h index 7a71ba4ac3fcaf..5c6e09800d1d81 100644 --- a/src/app/util/af.h +++ b/src/app/util/af.h @@ -1279,32 +1279,33 @@ EmberStatus emberAfSendMulticastWithCallback(chip::GroupId multicastId, EmberAps /** * @brief Sends broadcast. */ -EmberStatus emberAfSendBroadcast(EmberNodeId destination, EmberApsFrame * apsFrame, uint16_t messageLength, uint8_t * message); +// EmberStatus emberAfSendBroadcast(EmberNodeId destination, EmberApsFrame * apsFrame, uint16_t messageLength, uint8_t * message); /** * @brief Sends broadcast with attached message sent callback. */ -EmberStatus emberAfSendBroadcastWithCallback(EmberNodeId destination, EmberApsFrame * apsFrame, uint16_t messageLength, - uint8_t * message, EmberAfMessageSentFunction callback); +// EmberStatus emberAfSendBroadcastWithCallback(EmberNodeId destination, EmberApsFrame * apsFrame, uint16_t messageLength, +// uint8_t * message, EmberAfMessageSentFunction callback); /** * @brief Sends broadcast with alias with attached message sent callback. */ -EmberStatus emberAfSendBroadcastWithAliasWithCallback(EmberNodeId destination, EmberApsFrame * apsFrame, uint16_t messageLength, - uint8_t * message, EmberNodeId alias, uint8_t sequence, - EmberAfMessageSentFunction callback); +// EmberStatus emberAfSendBroadcastWithAliasWithCallback(EmberNodeId destination, EmberApsFrame * apsFrame, uint16_t messageLength, +// uint8_t * message, EmberNodeId alias, uint8_t sequence, +// EmberAfMessageSentFunction callback); /** * @brief Sends unicast. */ -EmberStatus emberAfSendUnicast(EmberOutgoingMessageType type, uint64_t indexOrDestination, EmberApsFrame * apsFrame, +EmberStatus emberAfSendUnicast(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t messageLength, uint8_t * message); /** * @brief Sends unicast with attached message sent callback. */ -EmberStatus emberAfSendUnicastWithCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, EmberApsFrame * apsFrame, - uint16_t messageLength, uint8_t * message, EmberAfMessageSentFunction callback); +EmberStatus emberAfSendUnicastWithCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, + EmberApsFrame * apsFrame, uint16_t messageLength, uint8_t * message, + EmberAfMessageSentFunction callback); /** * @brief Unicasts the message to each remote node in the binding table that diff --git a/src/app/util/attribute-storage.cpp b/src/app/util/attribute-storage.cpp index fd1e264455bcc9..549a92872b5b0c 100644 --- a/src/app/util/attribute-storage.cpp +++ b/src/app/util/attribute-storage.cpp @@ -213,7 +213,7 @@ void emberAfClusterDefaultResponseCallback(EndpointId endpoint, ClusterId cluste } // This function is used to call the per-cluster message sent callback -void emberAfClusterMessageSentWithMfgCodeCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfClusterMessageSentWithMfgCodeCallback(EmberOutgoingMessageType type, MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status, uint16_t mfgCode) { @@ -230,7 +230,7 @@ void emberAfClusterMessageSentWithMfgCodeCallback(EmberOutgoingMessageType type, if (f != NULL) { // emberAfPushEndpointNetworkIndex(apsFrame->sourceEndpoint); - ((EmberAfMessageSentFunction) f)(type, indexOrDestination, apsFrame, msgLen, message, status); + ((EmberAfMessageSentFunction) f)(type, destination, apsFrame, msgLen, message, status); // emberAfPopNetworkIndex(); } } @@ -240,10 +240,10 @@ void emberAfClusterMessageSentWithMfgCodeCallback(EmberOutgoingMessageType type, // This function is used to call the per-cluster message sent callback, and // wraps the emberAfClusterMessageSentWithMfgCodeCallback with a // EMBER_AF_NULL_MANUFACTURER_CODE. -void emberAfClusterMessageSentCallback(EmberOutgoingMessageType type, uint16_t indexOrDestination, EmberApsFrame * apsFrame, +void emberAfClusterMessageSentCallback(EmberOutgoingMessageType type, MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status) { - emberAfClusterMessageSentWithMfgCodeCallback(type, indexOrDestination, apsFrame, msgLen, message, status, + emberAfClusterMessageSentWithMfgCodeCallback(type, destination, apsFrame, msgLen, message, status, EMBER_AF_NULL_MANUFACTURER_CODE); } diff --git a/src/app/util/attribute-storage.h b/src/app/util/attribute-storage.h index 0a0911986ff9b2..deb925e01f781b 100644 --- a/src/app/util/attribute-storage.h +++ b/src/app/util/attribute-storage.h @@ -189,11 +189,11 @@ void emberAfClusterDefaultResponseWithMfgCodeCallback(chip::EndpointId endpoint, EmberAfStatus status, uint8_t clientServerMask, uint16_t manufacturerCode); // Calls the message sent callback for a specific cluster, and wraps emberAfClusterMessageSentWithMfgCodeCallback -void emberAfClusterMessageSentCallback(EmberOutgoingMessageType type, uint16_t indexOrDestination, EmberApsFrame * apsFrame, - uint16_t msgLen, uint8_t * message, EmberStatus status); +void emberAfClusterMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, + EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); // Calls the message sent callback for a specific cluster. -void emberAfClusterMessageSentWithMfgCodeCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfClusterMessageSentWithMfgCodeCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status, uint16_t manufacturerCode); diff --git a/src/app/util/chip-message-send.cpp b/src/app/util/chip-message-send.cpp index 8fd9ba88a20bd3..6ab982b413dfe7 100644 --- a/src/app/util/chip-message-send.cpp +++ b/src/app/util/chip-message-send.cpp @@ -51,7 +51,8 @@ class DeviceExchangeDelegate : public Messaging::ExchangeDelegate extern Messaging::ExchangeManager * ExchangeManager(); } // namespace chip -EmberStatus chipSendUnicast(NodeId destination, EmberApsFrame * apsFrame, uint16_t messageLength, uint8_t * message) +EmberStatus chipSendUnicast(Messaging::ExchangeContext * exchange, EmberApsFrame * apsFrame, uint16_t messageLength, + uint8_t * message, Messaging::SendFlags sendFlags) { uint16_t frameSize = encodeApsFrame(nullptr, 0, apsFrame); uint32_t dataLengthUnchecked = uint32_t(frameSize) + uint32_t(messageLength); @@ -86,6 +87,21 @@ EmberStatus chipSendUnicast(NodeId destination, EmberApsFrame * apsFrame, uint16 memcpy(buffer->Start() + frameSize, message, messageLength); buffer->SetDataLength(dataLength); + // TODO: Disable CRMP for now, because it just doesn't seem to work + sendFlags.Set(Messaging::SendMessageFlags::kNoAutoRequestAck); + CHIP_ERROR err = exchange->SendMessage(Protocols::TempZCL::Id, 0, std::move(buffer), sendFlags); + + if (err != CHIP_NO_ERROR) + { + // FIXME: Figure out better translations between our error types? + return EMBER_DELIVERY_FAILED; + } + + return EMBER_SUCCESS; +} + +EmberStatus chipSendUnicast(NodeId destination, EmberApsFrame * apsFrame, uint16_t messageLength, uint8_t * message) +{ // TODO: temporary create a handle from node id, will be fix in PR 3602 Messaging::ExchangeManager * exchangeMgr = ExchangeManager(); if (exchangeMgr == nullptr) @@ -106,18 +122,15 @@ EmberStatus chipSendUnicast(NodeId destination, EmberApsFrame * apsFrame, uint16 // receive the ack message. This logic needs to be deleted after we convert all legacy ZCL messages to IM messages. DeviceExchangeDelegate delegate; exchange->SetDelegate(&delegate); + Messaging::SendFlags sendFlags; sendFlags.Set(Messaging::SendMessageFlags::kFromInitiator).Set(Messaging::SendMessageFlags::kNoAutoRequestAck); - CHIP_ERROR err = exchange->SendMessage(Protocols::TempZCL::Id, 0, std::move(buffer), sendFlags); - exchange->Close(); + EmberStatus err = chipSendUnicast(exchange, apsFrame, messageLength, message, sendFlags); - if (err != CHIP_NO_ERROR) - { - // FIXME: Figure out better translations between our error types? - return EMBER_DELIVERY_FAILED; - } + // Make sure we always close the temporary exchange we just created. + exchange->Close(); - return EMBER_SUCCESS; + return err; } diff --git a/src/app/util/chip-message-send.h b/src/app/util/chip-message-send.h index cfbc5987264f45..ca429785eb360b 100644 --- a/src/app/util/chip-message-send.h +++ b/src/app/util/chip-message-send.h @@ -25,6 +25,24 @@ #pragma once #include // For EmberApsFrame, EmberStatus, node ids. +#include +#include + +/** + * @brief + * Called to send a unicast message on the given exchange. The message is + * constructed by serializing the given APS frame followed by the actual + * message buffer passed in. + * + * @param[in] exchange The exchange to send the message on. + * @param[in] apsFrame The APS frame to use for the message. + * @param[in] messageLength The length of the message to send after the APS + * frame. + * @param[in] message The message to send after the APS frame. + * @param[in] sendFlags The SendFlags needed, if any. + */ +EmberStatus chipSendUnicast(chip::Messaging::ExchangeContext * exchange, EmberApsFrame * apsFrame, uint16_t messageLength, + uint8_t * message, chip::Messaging::SendFlags sendFlags = chip::Messaging::SendFlags()); /** * @brief diff --git a/src/app/util/common.h b/src/app/util/common.h index 8299594e460251..05cef174755586 100644 --- a/src/app/util/common.h +++ b/src/app/util/common.h @@ -48,8 +48,10 @@ #include #include +#include + // the variables used to setup and send responses to cluster messages extern EmberApsFrame emberAfResponseApsFrame; extern uint8_t appResponseData[EMBER_AF_RESPONSE_BUFFER_LEN]; extern uint16_t appResponseLength; -extern chip::NodeId emberAfResponseDestination; +extern chip::Messaging::ExchangeContext * emberAfResponseDestination; diff --git a/src/app/util/ember-compatibility-functions.cpp b/src/app/util/ember-compatibility-functions.cpp index e1d103b658a042..f2c3fc8ee6e4fb 100644 --- a/src/app/util/ember-compatibility-functions.cpp +++ b/src/app/util/ember-compatibility-functions.cpp @@ -41,7 +41,7 @@ Command * currentCommandObject; void SetupEmberAfObjects(Command * command, ClusterId clusterId, CommandId commandId, EndpointId endpointId) { - const Messaging::ExchangeContext * commandExchangeCtx = command->GetExchangeContext(); + Messaging::ExchangeContext * commandExchangeCtx = command->GetExchangeContext(); imCompatibilityEmberApsFrame.clusterId = clusterId; imCompatibilityEmberApsFrame.destinationEndpoint = endpointId; @@ -51,8 +51,7 @@ void SetupEmberAfObjects(Command * command, ClusterId clusterId, CommandId comma imCompatibilityEmberAfCluster.commandId = commandId; imCompatibilityEmberAfCluster.apsFrame = &imCompatibilityEmberApsFrame; imCompatibilityEmberAfCluster.interPanHeader = &imCompatibilityInterpanHeader; - imCompatibilityEmberAfCluster.source = - (commandExchangeCtx != nullptr ? commandExchangeCtx->GetSecureSessionHandle().GetPeerNodeId() : 0); // 0 is "Any" NodeId. + imCompatibilityEmberAfCluster.source = commandExchangeCtx; emAfCurrentCommand = &imCompatibilityEmberAfCluster; currentCommandObject = command; diff --git a/src/app/util/esi-management.cpp b/src/app/util/esi-management.cpp index cd71df408c0e49..99f0ab6f202be8 100644 --- a/src/app/util/esi-management.cpp +++ b/src/app/util/esi-management.cpp @@ -256,12 +256,12 @@ uint8_t emberAfPluginEsiManagementUpdateEsiAndGetIndex(const EmberAfClusterComma // The source ESI is not in the ESI table. if (esiEntry == NULL) { - emberAfDebugPrintln("source ESI 0x%x not found in table", cmd->source); + emberAfDebugPrintln("source ESI 0x%x not found in table", cmd->SourceNodeId()); // We add the ESI to the table. esiEntry = emberAfPluginEsiManagementGetFreeEntry(); if (esiEntry != NULL) { - esiEntry->nodeId = cmd->source; + esiEntry->nodeId = cmd->SourceNodeId(); esiEntry->networkIndex = cmd->networkIndex; esiEntry->endpoint = cmd->apsFrame->sourceEndpoint; esiEntry->age = 0; @@ -276,10 +276,10 @@ uint8_t emberAfPluginEsiManagementUpdateEsiAndGetIndex(const EmberAfClusterComma { // Check that the short ID is still the one we stored in the ESI table. // If not, update it. - if (esiEntry->nodeId != cmd->source) + if (esiEntry->nodeId != cmd->SourceNodeId()) { emberAfDebugPrintln("ESI short ID changed, updating it"); - esiEntry->nodeId = cmd->source; + esiEntry->nodeId = cmd->SourceNodeId(); } } diff --git a/src/app/util/message.cpp b/src/app/util/message.cpp index 547376fb52d4ce..8bec8a8c055ca2 100644 --- a/src/app/util/message.cpp +++ b/src/app/util/message.cpp @@ -55,7 +55,7 @@ using namespace chip; // receives multiple ZCL messages, the stack will queue these and hand // these to the application via emberIncomingMsgHandler one at a time. EmberApsFrame emberAfResponseApsFrame; -NodeId emberAfResponseDestination; +Messaging::ExchangeContext * emberAfResponseDestination; uint8_t appResponseData[EMBER_AF_RESPONSE_BUFFER_LEN]; uint16_t appResponseLength; diff --git a/src/app/util/types_stub.h b/src/app/util/types_stub.h index 9b8d389003897a..8a08afc863eac4 100644 --- a/src/app/util/types_stub.h +++ b/src/app/util/types_stub.h @@ -392,7 +392,9 @@ enum EMBER_OUTGOING_BROADCAST_WITH_ALIAS, /** A broadcast message. This value is passed to emberMessageSentHandler() only. * It may not be passed to emberSendUnicast(). */ - EMBER_OUTGOING_BROADCAST + EMBER_OUTGOING_BROADCAST, + /** A messaging going via some existing exchange. */ + EMBER_OUTGOING_VIA_EXCHANGE, }; /** @brief Endpoint information (a ZigBee Simple Descriptor). diff --git a/src/app/util/util.cpp b/src/app/util/util.cpp index 154e44b1ee0e34..1197a43bf95775 100644 --- a/src/app/util/util.cpp +++ b/src/app/util/util.cpp @@ -493,7 +493,7 @@ static bool dispatchZclMessage(EmberAfClusterCommand * cmd) } bool emberAfProcessMessageIntoZclCmd(EmberApsFrame * apsFrame, EmberIncomingMessageType type, uint8_t * message, - uint16_t messageLength, NodeId source, InterPanHeader * interPanHeader, + uint16_t messageLength, Messaging::ExchangeContext * exchange, InterPanHeader * interPanHeader, EmberAfClusterCommand * returnCmd) { uint8_t minLength = @@ -508,7 +508,7 @@ bool emberAfProcessMessageIntoZclCmd(EmberApsFrame * apsFrame, EmberIncomingMess // Populate the cluster command struct for processing. returnCmd->apsFrame = apsFrame; returnCmd->type = type; - returnCmd->source = source; + returnCmd->source = exchange; returnCmd->buffer = message; returnCmd->bufLen = messageLength; returnCmd->clusterSpecific = (message[0] & ZCL_CLUSTER_SPECIFIC_COMMAND); @@ -539,12 +539,12 @@ bool emberAfProcessMessageIntoZclCmd(EmberApsFrame * apsFrame, EmberIncomingMess // a single call to process global and cluster-specific messages and callbacks. bool emberAfProcessMessage(EmberApsFrame * apsFrame, EmberIncomingMessageType type, uint8_t * message, uint16_t msgLen, - NodeId source, InterPanHeader * interPanHeader) + Messaging::ExchangeContext * exchange, InterPanHeader * interPanHeader) { bool msgHandled = false; // reset/reinitialize curCmd curCmd = staticCmd; - if (!emberAfProcessMessageIntoZclCmd(apsFrame, type, message, msgLen, source, interPanHeader, &curCmd)) + if (!emberAfProcessMessageIntoZclCmd(apsFrame, type, message, msgLen, exchange, interPanHeader, &curCmd)) { goto kickout; } @@ -703,9 +703,9 @@ void emAfApplyDisableDefaultResponse(uint8_t * frame_control) } } -static bool isBroadcastDestination(NodeId responseDestination) +static bool isBroadcastDestination(Messaging::ExchangeContext * responseDestination) { - // FIXME: Will need to actually figure out how to test for this! + // TODO: Will need to actually figure out how to test for this! return false; } @@ -755,8 +755,8 @@ EmberStatus emberAfSendResponseWithCallback(EmberAfMessageSentFunction callback) else if (!isBroadcastDestination(emberAfResponseDestination)) { label = 'U'; - status = emberAfSendUnicastWithCallback(EMBER_OUTGOING_DIRECT, emberAfResponseDestination, &emberAfResponseApsFrame, - appResponseLength, appResponseData, callback); + status = emberAfSendUnicastWithCallback(EMBER_OUTGOING_VIA_EXCHANGE, MessageSendDestination(emberAfResponseDestination), + &emberAfResponseApsFrame, appResponseLength, appResponseData, callback); } else { diff --git a/src/app/util/util.h b/src/app/util/util.h index 085ac22591c4d0..20ab0f3cb081e8 100644 --- a/src/app/util/util.h +++ b/src/app/util/util.h @@ -152,11 +152,11 @@ void emberAfDecodeAndPrintCluster(chip::ClusterId cluster); void emberAfDecodeAndPrintClusterWithMfgCode(chip::ClusterId cluster, uint16_t mfgCode); bool emberAfProcessMessage(EmberApsFrame * apsFrame, EmberIncomingMessageType type, uint8_t * message, uint16_t msgLen, - chip::NodeId source, InterPanHeader * interPanHeader); + chip::Messaging::ExchangeContext * source, InterPanHeader * interPanHeader); bool emberAfProcessMessageIntoZclCmd(EmberApsFrame * apsFrame, EmberIncomingMessageType type, uint8_t * message, - uint16_t messageLength, chip::NodeId source, InterPanHeader * interPanHeader, - EmberAfClusterCommand * returnCmd); + uint16_t messageLength, chip::Messaging::ExchangeContext * source, + InterPanHeader * interPanHeader, EmberAfClusterCommand * returnCmd); /** * Retrieves the difference between the two passed values. diff --git a/src/app/zap-templates/templates/app/CHIPClientCallbacks-src.zapt b/src/app/zap-templates/templates/app/CHIPClientCallbacks-src.zapt index cb7d53d3e83829..b7e73e39ab7eb0 100644 --- a/src/app/zap-templates/templates/app/CHIPClientCallbacks-src.zapt +++ b/src/app/zap-templates/templates/app/CHIPClientCallbacks-src.zapt @@ -45,7 +45,7 @@ using namespace ::chip; #define GET_RESPONSE_CALLBACKS(name) \ Callback::Cancelable * onSuccessCallback = nullptr; \ Callback::Cancelable * onFailureCallback = nullptr; \ - NodeId sourceId = emberAfCurrentCommand()->source; \ + NodeId sourceId = emberAfCurrentCommand()->SourceNodeId(); \ uint8_t sequenceNumber = emberAfCurrentCommand()->seqNum; \ CHIP_ERROR err = gCallbacks.GetResponseCallback(sourceId, sequenceNumber, &onSuccessCallback, &onFailureCallback); \ \ @@ -771,7 +771,7 @@ bool emberAfReportAttributesCallback(ClusterId clusterId, uint8_t * message, uin ChipLogProgress(Zcl, "emberAfReportAttributeCallback:"); ChipLogProgress(Zcl, " ClusterId: 0x%04x", clusterId); - NodeId sourceId = emberAfCurrentCommand()->source; + NodeId sourceId = emberAfCurrentCommand()->SourceNodeId(); ChipLogProgress(Zcl, " Source NodeId: %" PRIu64, sourceId); EndpointId endpointId = emberAfCurrentCommand()->apsFrame->sourceEndpoint; diff --git a/src/app/zap-templates/templates/app/callback-stub-src.zapt b/src/app/zap-templates/templates/app/callback-stub-src.zapt index e5a55c047aae24..26353353833a53 100644 --- a/src/app/zap-templates/templates/app/callback-stub-src.zapt +++ b/src/app/zap-templates/templates/app/callback-stub-src.zapt @@ -323,7 +323,7 @@ bool __attribute__((weak)) emberAfPreMessageSendCallback( * @param status Ver.: always */ bool __attribute__((weak)) emberAfMessageSentCallback( - EmberOutgoingMessageType type, uint64_t indexOrDestination, + EmberOutgoingMessageType type, MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status) { diff --git a/src/app/zap-templates/templates/app/callback.zapt b/src/app/zap-templates/templates/app/callback.zapt index cbb45dc72c0262..7a244a48c69b3d 100644 --- a/src/app/zap-templates/templates/app/callback.zapt +++ b/src/app/zap-templates/templates/app/callback.zapt @@ -75,13 +75,13 @@ void emberAf{{asCamelCased name false}}Cluster{{asCamelCased side false}}Manufac * {{asCamelCased side false}} Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAf{{asCamelCased name false}}Cluster{{asCamelCased side false}}MessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); +void emberAf{{asCamelCased name false}}Cluster{{asCamelCased side false}}MessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief {{name}} Cluster {{asCamelCased side false}} Pre Attribute Changed * @@ -371,13 +371,13 @@ bool emberAfPreMessageSendCallback(EmberAfMessageStruct * messageStruct, EmberSt * be handled by the application framework. * * @param type Ver.: always - * @param indexOrDestination Ver.: always + * @param destination Ver.: always * @param apsFrame Ver.: always * @param msgLen Ver.: always * @param message Ver.: always * @param status Ver.: always */ -bool emberAfMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, EmberApsFrame * apsFrame, +bool emberAfMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief Pre Attribute Change diff --git a/src/controller/CHIPDevice.cpp b/src/controller/CHIPDevice.cpp index 60151e0d7cd62b..4b2daa3fd93008 100644 --- a/src/controller/CHIPDevice.cpp +++ b/src/controller/CHIPDevice.cpp @@ -55,16 +55,6 @@ using namespace chip::Callback; namespace chip { namespace Controller { -// TODO: This is a placeholder delegate for exchange context created in Device::SendMessage() -// Delete this class when Device::SendMessage() is obsoleted. -class DeviceExchangeDelegate : public Messaging::ExchangeDelegate -{ - void OnMessageReceived(Messaging::ExchangeContext * ec, const PacketHeader & packetHeader, const PayloadHeader & payloadHeader, - System::PacketBufferHandle payload) override - {} - void OnResponseTimeout(Messaging::ExchangeContext * ec) override {} -}; - CHIP_ERROR Device::SendMessage(Protocols::Id protocolId, uint8_t msgType, System::PacketBufferHandle buffer) { System::PacketBufferHandle resend; @@ -88,15 +78,13 @@ CHIP_ERROR Device::SendMessage(Protocols::Id protocolId, uint8_t msgType, System resend = buffer.CloneData(); } - // TODO(#5675): This code is temporary, and must be updated to use the IM API. Currenlty, we use a temporary Protocol - // TempZCL to carry over legacy ZCL messages, use an ephemeral exchange to send message and use its unsolicited message - // handler to receive messages. We need to set flag kFromInitiator to allow receiver to deliver message to corresponding - // unsolicited message handler, and we also need to set flag kNoAutoRequestAck since there is no persistent exchange to - // receive the ack message. This logic need to be deleted after we converting all legacy ZCL messages to IM messages. + // TODO(#5675): This code is temporary, and must be updated to use the IM API. Currently, we use a temporary Protocol + // TempZCL to carry over legacy ZCL messages. We need to set flag kFromInitiator to allow receiver to deliver message to + // corresponding unsolicited message handler. + // + // TODO: Also, disable CRMP for now because it just doesn't seem to work sendFlags.Set(Messaging::SendMessageFlags::kFromInitiator).Set(Messaging::SendMessageFlags::kNoAutoRequestAck); - - DeviceExchangeDelegate delegate; - exchange->SetDelegate(&delegate); + exchange->SetDelegate(this); CHIP_ERROR err = exchange->SendMessage(protocolId, msgType, std::move(buffer), sendFlags); @@ -112,16 +100,15 @@ CHIP_ERROR Device::SendMessage(Protocols::Id protocolId, uint8_t msgType, System ReturnErrorOnFailure(LoadSecureSessionParameters(ResetTransport::kYes)); err = exchange->SendMessage(protocolId, msgType, std::move(resend), sendFlags); - ChipLogDetail(Controller, "Re-SendMessage returned %d", err); - ReturnErrorOnFailure(err); + ChipLogDetail(Controller, "Re-SendMessage returned %s", ErrorStr(err)); } - if (exchange != nullptr) + if (err != CHIP_NO_ERROR) { exchange->Close(); } - return CHIP_NO_ERROR; + return err; } CHIP_ERROR Device::LoadSecureSessionParametersIfNeeded(bool & didLoad) @@ -276,7 +263,8 @@ void Device::OnConnectionExpired(SecureSessionHandle session) mSecureSession = SecureSessionHandle{}; } -void Device::OnMessageReceived(const PacketHeader & header, const PayloadHeader & payloadHeader, System::PacketBufferHandle msgBuf) +void Device::OnMessageReceived(Messaging::ExchangeContext * exchange, const PacketHeader & header, + const PayloadHeader & payloadHeader, System::PacketBufferHandle msgBuf) { if (mState == ConnectionState::SecureConnected) { @@ -286,9 +274,15 @@ void Device::OnMessageReceived(const PacketHeader & header, const PayloadHeader } else { - HandleDataModelMessage(mDeviceId, std::move(msgBuf)); + HandleDataModelMessage(exchange, std::move(msgBuf)); } } + exchange->Close(); +} + +void Device::OnResponseTimeout(Messaging::ExchangeContext * ec) +{ + ec->Close(); } CHIP_ERROR Device::OpenPairingWindow(uint32_t timeout, PairingWindowOption option, SetupPayload & setupPayload) diff --git a/src/controller/CHIPDevice.h b/src/controller/CHIPDevice.h index 83033234c836ec..195c5c13217932 100644 --- a/src/controller/CHIPDevice.h +++ b/src/controller/CHIPDevice.h @@ -32,6 +32,8 @@ #include #include #include +#include +#include #include #include #include @@ -78,11 +80,19 @@ struct ControllerDeviceInitParams #endif }; -class DLL_EXPORT Device +class DLL_EXPORT Device : public Messaging::ExchangeDelegate { public: ~Device() { + if (mExchangeMgr) + { + // Ensure that any exchange contexts we have open get closed now, + // because we don't want them to call back in to us after this + // point. + mExchangeMgr->CloseAllContextsForDelegate(this); + } + if (mCommandSender != nullptr) { mCommandSender->Shutdown(); @@ -236,11 +246,21 @@ class DLL_EXPORT Device * device. The message ownership is transferred to the function, and it is expected * to release the message buffer before returning. * + * @param[in] exchange The exchange context the message was received + * on. The Device guarantees that it will call + * Close() on exchange when it's done processing + * the message. * @param[in] header Reference to common packet header of the received message * @param[in] payloadHeader Reference to payload header in the message * @param[in] msgBuf The message buffer */ - void OnMessageReceived(const PacketHeader & header, const PayloadHeader & payloadHeader, System::PacketBufferHandle msgBuf); + void OnMessageReceived(Messaging::ExchangeContext * exchange, const PacketHeader & header, const PayloadHeader & payloadHeader, + System::PacketBufferHandle msgBuf) override; + + /** + * @brief ExchangeDelegate implementation of OnResponseTimeout. + */ + void OnResponseTimeout(Messaging::ExchangeContext * exchange) override; /** * @brief diff --git a/src/controller/CHIPDeviceController.cpp b/src/controller/CHIPDeviceController.cpp index b21f63c7d19aba..3e04e030298c77 100644 --- a/src/controller/CHIPDeviceController.cpp +++ b/src/controller/CHIPDeviceController.cpp @@ -408,6 +408,7 @@ void DeviceController::OnMessageReceived(Messaging::ExchangeContext * ec, const const PayloadHeader & payloadHeader, System::PacketBufferHandle msgBuf) { uint16_t index; + bool needClose = true; VerifyOrExit(mState == State::Initialized, ChipLogError(Controller, "OnMessageReceived was called in incorrect state")); @@ -417,10 +418,14 @@ void DeviceController::OnMessageReceived(Messaging::ExchangeContext * ec, const index = FindDeviceIndex(packetHeader.GetSourceNodeId().Value()); VerifyOrExit(index < kNumMaxActiveDevices, ChipLogError(Controller, "OnMessageReceived was called for unknown device object")); - mActiveDevices[index].OnMessageReceived(packetHeader, payloadHeader, std::move(msgBuf)); + needClose = false; // Device will handle it + mActiveDevices[index].OnMessageReceived(ec, packetHeader, payloadHeader, std::move(msgBuf)); exit: - ec->Close(); + if (needClose) + { + ec->Close(); + } } void DeviceController::OnResponseTimeout(Messaging::ExchangeContext * ec) diff --git a/src/controller/EmptyDataModelHandler.cpp b/src/controller/EmptyDataModelHandler.cpp index 6565486adf77c7..c29b331ee2f82f 100644 --- a/src/controller/EmptyDataModelHandler.cpp +++ b/src/controller/EmptyDataModelHandler.cpp @@ -25,4 +25,6 @@ #include __attribute__((weak)) void InitDataModelHandler(chip::Messaging::ExchangeManager * exchangeMgr) {} -__attribute__((weak)) void HandleDataModelMessage(chip::NodeId nodeId, chip::System::PacketBufferHandle buffer) {} +__attribute__((weak)) void HandleDataModelMessage(chip::Messaging::ExchangeContext * exchange, + chip::System::PacketBufferHandle buffer) +{} diff --git a/src/controller/python/gen/CHIPClientCallbacks.cpp b/src/controller/python/gen/CHIPClientCallbacks.cpp index 29db4ce13f6c36..4c29e8869f75e8 100644 --- a/src/controller/python/gen/CHIPClientCallbacks.cpp +++ b/src/controller/python/gen/CHIPClientCallbacks.cpp @@ -61,7 +61,7 @@ using namespace ::chip; #define GET_RESPONSE_CALLBACKS(name) \ Callback::Cancelable * onSuccessCallback = nullptr; \ Callback::Cancelable * onFailureCallback = nullptr; \ - NodeId sourceId = emberAfCurrentCommand()->source; \ + NodeId sourceId = emberAfCurrentCommand()->SourceNodeId(); \ uint8_t sequenceNumber = emberAfCurrentCommand()->seqNum; \ CHIP_ERROR err = gCallbacks.GetResponseCallback(sourceId, sequenceNumber, &onSuccessCallback, &onFailureCallback); \ \ @@ -2087,7 +2087,7 @@ bool emberAfReportAttributesCallback(ClusterId clusterId, uint8_t * message, uin ChipLogProgress(Zcl, "emberAfReportAttributeCallback:"); ChipLogProgress(Zcl, " ClusterId: 0x%04x", clusterId); - NodeId sourceId = emberAfCurrentCommand()->source; + NodeId sourceId = emberAfCurrentCommand()->SourceNodeId(); ChipLogProgress(Zcl, " Source NodeId: %" PRIu64, sourceId); EndpointId endpointId = emberAfCurrentCommand()->apsFrame->sourceEndpoint; diff --git a/src/controller/python/gen/callback-stub.cpp b/src/controller/python/gen/callback-stub.cpp index 4e6856332f1f06..6cdb62b98098b0 100644 --- a/src/controller/python/gen/callback-stub.cpp +++ b/src/controller/python/gen/callback-stub.cpp @@ -583,8 +583,8 @@ bool __attribute__((weak)) emberAfPreMessageSendCallback(EmberAfMessageStruct * * @param status Ver.: always */ bool __attribute__((weak)) -emberAfMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, EmberApsFrame * apsFrame, uint16_t msgLen, - uint8_t * message, EmberStatus status) +emberAfMessageSentCallback(EmberOutgoingMessageType type, MessageSendDestination destination, EmberApsFrame * apsFrame, + uint16_t msgLen, uint8_t * message, EmberStatus status) { return false; } diff --git a/src/controller/python/gen/callback.h b/src/controller/python/gen/callback.h index d6feaf86e16ddb..d9fe8c1e89c0e7 100644 --- a/src/controller/python/gen/callback.h +++ b/src/controller/python/gen/callback.h @@ -344,13 +344,13 @@ void emberAfAccountLoginClusterClientManufacturerSpecificAttributeChangedCallbac * Client Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfAccountLoginClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfAccountLoginClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -414,15 +414,15 @@ void emberAfApplicationBasicClusterClientManufacturerSpecificAttributeChangedCal * Client Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfApplicationBasicClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, - EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, - EmberStatus status); +void emberAfApplicationBasicClusterClientMessageSentCallback(EmberOutgoingMessageType type, + chip::MessageSendDestination destination, EmberApsFrame * apsFrame, + uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief Application Basic Cluster Client Pre Attribute Changed * @@ -485,15 +485,15 @@ void emberAfApplicationLauncherClusterClientManufacturerSpecificAttributeChanged * Client Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfApplicationLauncherClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, - EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, - EmberStatus status); +void emberAfApplicationLauncherClusterClientMessageSentCallback(EmberOutgoingMessageType type, + chip::MessageSendDestination destination, EmberApsFrame * apsFrame, + uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief Application Launcher Cluster Client Pre Attribute Changed * @@ -556,13 +556,13 @@ void emberAfAudioOutputClusterClientManufacturerSpecificAttributeChangedCallback * Client Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfAudioOutputClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfAudioOutputClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -626,13 +626,13 @@ void emberAfBarrierControlClusterClientManufacturerSpecificAttributeChangedCallb * Client Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfBarrierControlClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfBarrierControlClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -696,13 +696,13 @@ void emberAfBasicClusterClientManufacturerSpecificAttributeChangedCallback(chip: * Client Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfBasicClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfBasicClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief Basic Cluster Client Pre Attribute Changed @@ -765,13 +765,13 @@ void emberAfBindingClusterClientManufacturerSpecificAttributeChangedCallback(chi * Client Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfBindingClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfBindingClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -835,13 +835,13 @@ void emberAfColorControlClusterClientManufacturerSpecificAttributeChangedCallbac * Client Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfColorControlClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfColorControlClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -905,13 +905,13 @@ void emberAfContentLaunchClusterClientManufacturerSpecificAttributeChangedCallba * Client Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfContentLaunchClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfContentLaunchClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -975,13 +975,13 @@ void emberAfDescriptorClusterClientManufacturerSpecificAttributeChangedCallback( * Client Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfDescriptorClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfDescriptorClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -1045,13 +1045,13 @@ void emberAfDoorLockClusterClientManufacturerSpecificAttributeChangedCallback(ch * Client Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfDoorLockClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfDoorLockClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -1115,15 +1115,15 @@ void emberAfGeneralCommissioningClusterClientManufacturerSpecificAttributeChange * Client Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfGeneralCommissioningClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, - EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, - EmberStatus status); +void emberAfGeneralCommissioningClusterClientMessageSentCallback(EmberOutgoingMessageType type, + chip::MessageSendDestination destination, EmberApsFrame * apsFrame, + uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief General Commissioning Cluster Client Pre Attribute Changed * @@ -1186,15 +1186,15 @@ void emberAfGroupKeyManagementClusterClientManufacturerSpecificAttributeChangedC * Client Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfGroupKeyManagementClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, - EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, - EmberStatus status); +void emberAfGroupKeyManagementClusterClientMessageSentCallback(EmberOutgoingMessageType type, + chip::MessageSendDestination destination, EmberApsFrame * apsFrame, + uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief Group Key Management Cluster Client Pre Attribute Changed * @@ -1257,13 +1257,13 @@ void emberAfGroupsClusterClientManufacturerSpecificAttributeChangedCallback(chip * Client Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfGroupsClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfGroupsClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -1327,13 +1327,13 @@ void emberAfIdentifyClusterClientManufacturerSpecificAttributeChangedCallback(ch * Client Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfIdentifyClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfIdentifyClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -1397,13 +1397,13 @@ void emberAfKeypadInputClusterClientManufacturerSpecificAttributeChangedCallback * Client Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfKeypadInputClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfKeypadInputClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -1467,13 +1467,13 @@ void emberAfLevelControlClusterClientManufacturerSpecificAttributeChangedCallbac * Client Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfLevelControlClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfLevelControlClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -1537,13 +1537,13 @@ void emberAfLowPowerClusterClientManufacturerSpecificAttributeChangedCallback(ch * Client Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfLowPowerClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfLowPowerClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -1607,13 +1607,13 @@ void emberAfMediaInputClusterClientManufacturerSpecificAttributeChangedCallback( * Client Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfMediaInputClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfMediaInputClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -1677,13 +1677,13 @@ void emberAfMediaPlaybackClusterClientManufacturerSpecificAttributeChangedCallba * Client Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfMediaPlaybackClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfMediaPlaybackClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -1747,15 +1747,15 @@ void emberAfNetworkCommissioningClusterClientManufacturerSpecificAttributeChange * Client Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfNetworkCommissioningClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, - EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, - EmberStatus status); +void emberAfNetworkCommissioningClusterClientMessageSentCallback(EmberOutgoingMessageType type, + chip::MessageSendDestination destination, EmberApsFrame * apsFrame, + uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief Network Commissioning Cluster Client Pre Attribute Changed * @@ -1817,13 +1817,13 @@ void emberAfOnOffClusterClientManufacturerSpecificAttributeChangedCallback(chip: * Client Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfOnOffClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfOnOffClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief On/off Cluster Client Pre Attribute Changed @@ -1886,13 +1886,14 @@ void emberAfOperationalCredentialsClusterClientManufacturerSpecificAttributeChan * Client Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfOperationalCredentialsClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfOperationalCredentialsClusterClientMessageSentCallback(EmberOutgoingMessageType type, + chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -1958,13 +1959,14 @@ void emberAfPumpConfigurationAndControlClusterClientManufacturerSpecificAttribut * Client Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfPumpConfigurationAndControlClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfPumpConfigurationAndControlClusterClientMessageSentCallback(EmberOutgoingMessageType type, + chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -2029,13 +2031,13 @@ void emberAfScenesClusterClientManufacturerSpecificAttributeChangedCallback(chip * Client Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfScenesClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfScenesClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -2099,13 +2101,13 @@ void emberAfSwitchClusterClientManufacturerSpecificAttributeChangedCallback(chip * Client Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfSwitchClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfSwitchClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -2169,13 +2171,13 @@ void emberAfTvChannelClusterClientManufacturerSpecificAttributeChangedCallback(c * Client Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfTvChannelClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfTvChannelClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -2239,13 +2241,13 @@ void emberAfTargetNavigatorClusterClientManufacturerSpecificAttributeChangedCall * Client Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfTargetNavigatorClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfTargetNavigatorClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -2310,13 +2312,14 @@ void emberAfTemperatureMeasurementClusterClientManufacturerSpecificAttributeChan * Client Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfTemperatureMeasurementClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfTemperatureMeasurementClusterClientMessageSentCallback(EmberOutgoingMessageType type, + chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -2381,13 +2384,13 @@ void emberAfTestClusterClusterClientManufacturerSpecificAttributeChangedCallback * Client Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfTestClusterClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfTestClusterClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -2451,13 +2454,13 @@ void emberAfThermostatClusterClientManufacturerSpecificAttributeChangedCallback( * Client Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfThermostatClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfThermostatClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -2521,13 +2524,13 @@ void emberAfWakeOnLanClusterClientManufacturerSpecificAttributeChangedCallback(c * Client Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfWakeOnLanClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfWakeOnLanClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -2591,13 +2594,13 @@ void emberAfWindowCoveringClusterClientManufacturerSpecificAttributeChangedCallb * Client Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfWindowCoveringClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfWindowCoveringClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -3425,13 +3428,13 @@ bool emberAfPreMessageSendCallback(EmberAfMessageStruct * messageStruct, EmberSt * be handled by the application framework. * * @param type Ver.: always - * @param indexOrDestination Ver.: always + * @param destination Ver.: always * @param apsFrame Ver.: always * @param msgLen Ver.: always * @param message Ver.: always * @param status Ver.: always */ -bool emberAfMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, EmberApsFrame * apsFrame, +bool emberAfMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief Pre Attribute Change diff --git a/src/darwin/Framework/CHIP/gen/CHIPClientCallbacks.cpp b/src/darwin/Framework/CHIP/gen/CHIPClientCallbacks.cpp index 0e0d31e43b144c..60988152d9a64a 100644 --- a/src/darwin/Framework/CHIP/gen/CHIPClientCallbacks.cpp +++ b/src/darwin/Framework/CHIP/gen/CHIPClientCallbacks.cpp @@ -61,7 +61,7 @@ using namespace ::chip; #define GET_RESPONSE_CALLBACKS(name) \ Callback::Cancelable * onSuccessCallback = nullptr; \ Callback::Cancelable * onFailureCallback = nullptr; \ - NodeId sourceId = emberAfCurrentCommand()->source; \ + NodeId sourceId = emberAfCurrentCommand()->SourceNodeId(); \ uint8_t sequenceNumber = emberAfCurrentCommand()->seqNum; \ CHIP_ERROR err = gCallbacks.GetResponseCallback(sourceId, sequenceNumber, &onSuccessCallback, &onFailureCallback); \ \ @@ -1820,7 +1820,7 @@ bool emberAfReportAttributesCallback(ClusterId clusterId, uint8_t * message, uin ChipLogProgress(Zcl, "emberAfReportAttributeCallback:"); ChipLogProgress(Zcl, " ClusterId: 0x%04x", clusterId); - NodeId sourceId = emberAfCurrentCommand()->source; + NodeId sourceId = emberAfCurrentCommand()->SourceNodeId(); ChipLogProgress(Zcl, " Source NodeId: %" PRIu64, sourceId); EndpointId endpointId = emberAfCurrentCommand()->apsFrame->sourceEndpoint; diff --git a/src/darwin/Framework/CHIP/gen/callback-stub.cpp b/src/darwin/Framework/CHIP/gen/callback-stub.cpp index feb9ba3ca6d82d..6184bbc72ba2d8 100644 --- a/src/darwin/Framework/CHIP/gen/callback-stub.cpp +++ b/src/darwin/Framework/CHIP/gen/callback-stub.cpp @@ -495,8 +495,8 @@ bool __attribute__((weak)) emberAfPreMessageSendCallback(EmberAfMessageStruct * * @param status Ver.: always */ bool __attribute__((weak)) -emberAfMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, EmberApsFrame * apsFrame, uint16_t msgLen, - uint8_t * message, EmberStatus status) +emberAfMessageSentCallback(EmberOutgoingMessageType type, MessageSendDestination destination, EmberApsFrame * apsFrame, + uint16_t msgLen, uint8_t * message, EmberStatus status) { return false; } diff --git a/src/darwin/Framework/CHIP/gen/callback.h b/src/darwin/Framework/CHIP/gen/callback.h index 21d3137f28947f..62596a7e6c182b 100644 --- a/src/darwin/Framework/CHIP/gen/callback.h +++ b/src/darwin/Framework/CHIP/gen/callback.h @@ -256,15 +256,15 @@ void emberAfApplicationBasicClusterClientManufacturerSpecificAttributeChangedCal * Client Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfApplicationBasicClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, - EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, - EmberStatus status); +void emberAfApplicationBasicClusterClientMessageSentCallback(EmberOutgoingMessageType type, + chip::MessageSendDestination destination, EmberApsFrame * apsFrame, + uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief Application Basic Cluster Client Pre Attribute Changed * @@ -327,13 +327,13 @@ void emberAfBarrierControlClusterClientManufacturerSpecificAttributeChangedCallb * Client Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfBarrierControlClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfBarrierControlClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -397,13 +397,13 @@ void emberAfBasicClusterClientManufacturerSpecificAttributeChangedCallback(chip: * Client Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfBasicClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfBasicClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief Basic Cluster Client Pre Attribute Changed @@ -466,13 +466,13 @@ void emberAfBindingClusterClientManufacturerSpecificAttributeChangedCallback(chi * Client Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfBindingClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfBindingClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -536,13 +536,13 @@ void emberAfColorControlClusterClientManufacturerSpecificAttributeChangedCallbac * Client Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfColorControlClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfColorControlClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -606,13 +606,13 @@ void emberAfDescriptorClusterClientManufacturerSpecificAttributeChangedCallback( * Client Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfDescriptorClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfDescriptorClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -676,13 +676,13 @@ void emberAfDoorLockClusterClientManufacturerSpecificAttributeChangedCallback(ch * Client Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfDoorLockClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfDoorLockClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -746,15 +746,15 @@ void emberAfGeneralCommissioningClusterClientManufacturerSpecificAttributeChange * Client Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfGeneralCommissioningClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, - EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, - EmberStatus status); +void emberAfGeneralCommissioningClusterClientMessageSentCallback(EmberOutgoingMessageType type, + chip::MessageSendDestination destination, EmberApsFrame * apsFrame, + uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief General Commissioning Cluster Client Pre Attribute Changed * @@ -817,15 +817,15 @@ void emberAfGroupKeyManagementClusterClientManufacturerSpecificAttributeChangedC * Client Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfGroupKeyManagementClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, - EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, - EmberStatus status); +void emberAfGroupKeyManagementClusterClientMessageSentCallback(EmberOutgoingMessageType type, + chip::MessageSendDestination destination, EmberApsFrame * apsFrame, + uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief Group Key Management Cluster Client Pre Attribute Changed * @@ -888,13 +888,13 @@ void emberAfGroupsClusterClientManufacturerSpecificAttributeChangedCallback(chip * Client Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfGroupsClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfGroupsClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -958,13 +958,13 @@ void emberAfIdentifyClusterClientManufacturerSpecificAttributeChangedCallback(ch * Client Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfIdentifyClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfIdentifyClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -1028,13 +1028,13 @@ void emberAfLevelControlClusterClientManufacturerSpecificAttributeChangedCallbac * Client Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfLevelControlClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfLevelControlClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -1098,13 +1098,13 @@ void emberAfLowPowerClusterClientManufacturerSpecificAttributeChangedCallback(ch * Client Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfLowPowerClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfLowPowerClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -1168,15 +1168,15 @@ void emberAfNetworkCommissioningClusterClientManufacturerSpecificAttributeChange * Client Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfNetworkCommissioningClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, - EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, - EmberStatus status); +void emberAfNetworkCommissioningClusterClientMessageSentCallback(EmberOutgoingMessageType type, + chip::MessageSendDestination destination, EmberApsFrame * apsFrame, + uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief Network Commissioning Cluster Client Pre Attribute Changed * @@ -1238,13 +1238,13 @@ void emberAfOnOffClusterClientManufacturerSpecificAttributeChangedCallback(chip: * Client Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfOnOffClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfOnOffClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief On/off Cluster Client Pre Attribute Changed @@ -1307,13 +1307,14 @@ void emberAfOperationalCredentialsClusterClientManufacturerSpecificAttributeChan * Client Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfOperationalCredentialsClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfOperationalCredentialsClusterClientMessageSentCallback(EmberOutgoingMessageType type, + chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -1379,13 +1380,14 @@ void emberAfPumpConfigurationAndControlClusterClientManufacturerSpecificAttribut * Client Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfPumpConfigurationAndControlClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfPumpConfigurationAndControlClusterClientMessageSentCallback(EmberOutgoingMessageType type, + chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -1450,13 +1452,13 @@ void emberAfScenesClusterClientManufacturerSpecificAttributeChangedCallback(chip * Client Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfScenesClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfScenesClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -1520,13 +1522,13 @@ void emberAfSwitchClusterClientManufacturerSpecificAttributeChangedCallback(chip * Client Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfSwitchClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfSwitchClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -1590,13 +1592,14 @@ void emberAfTemperatureMeasurementClusterClientManufacturerSpecificAttributeChan * Client Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfTemperatureMeasurementClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfTemperatureMeasurementClusterClientMessageSentCallback(EmberOutgoingMessageType type, + chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -1661,13 +1664,13 @@ void emberAfTestClusterClusterClientManufacturerSpecificAttributeChangedCallback * Client Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfTestClusterClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfTestClusterClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -1731,13 +1734,13 @@ void emberAfThermostatClusterClientManufacturerSpecificAttributeChangedCallback( * Client Message Sent * * @param type The type of message sent - * @param indexOrDestination The destination or address to which the message was sent + * @param destination The destination to which the message was sent * @param apsFrame The APS frame for the message * @param msgLen The length of the message * @param message The message that was sent * @param status The status of the sent message */ -void emberAfThermostatClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfThermostatClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -2429,13 +2432,13 @@ bool emberAfPreMessageSendCallback(EmberAfMessageStruct * messageStruct, EmberSt * be handled by the application framework. * * @param type Ver.: always - * @param indexOrDestination Ver.: always + * @param destination Ver.: always * @param apsFrame Ver.: always * @param msgLen Ver.: always * @param message Ver.: always * @param status Ver.: always */ -bool emberAfMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, EmberApsFrame * apsFrame, +bool emberAfMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief Pre Attribute Change diff --git a/src/messaging/ExchangeMgr.cpp b/src/messaging/ExchangeMgr.cpp index cb5f492000a6f8..a34d4047724da4 100644 --- a/src/messaging/ExchangeMgr.cpp +++ b/src/messaging/ExchangeMgr.cpp @@ -389,6 +389,24 @@ void ExchangeManager::OnMessageReceived(const Transport::PeerAddress & source, S } } +void ExchangeManager::CloseAllContextsForDelegate(const ExchangeDelegateBase * delegate) +{ + for (auto & ec : mContextPool) + { + if (ec.GetReferenceCount() == 0 || ec.GetDelegate() != delegate) + { + continue; + } + + // Make sure to null out the delegate before closing the context, so + // we don't notify the delegate that the context is closing. We + // have to do this, because the delegate might be partially + // destroyed by this point. + ec.SetDelegate(nullptr); + ec.Close(); + } +} + void ExchangeManager::IncrementContextsInUse() { mContextsInUse++; diff --git a/src/messaging/ExchangeMgr.h b/src/messaging/ExchangeMgr.h index d5b7fa7ca6f3e7..2c3938bd9864e7 100644 --- a/src/messaging/ExchangeMgr.h +++ b/src/messaging/ExchangeMgr.h @@ -176,6 +176,13 @@ class DLL_EXPORT ExchangeManager : public SecureSessionMgrDelegate, public Trans static_cast(msgType)); } + /** + * A method to call Close() on all contexts that have a given delegate as + * their delegate. To be used if the delegate is being destroyed. This + * method will guarantee that it does not call into the delegate. + */ + void CloseAllContextsForDelegate(const ExchangeDelegateBase * delegate); + void IncrementContextsInUse(); void DecrementContextsInUse();