diff --git a/src/app/clusters/door-lock-server/door-lock-server-schedule.c b/src/app/clusters/door-lock-server/door-lock-server-schedule.c index b3eb5857d3af69..7b42df7002dc65 100644 --- a/src/app/clusters/door-lock-server/door-lock-server-schedule.c +++ b/src/app/clusters/door-lock-server/door-lock-server-schedule.c @@ -156,7 +156,7 @@ bool emberAfDoorLockClusterSetWeekdayScheduleCallback(uint8_t scheduleId, uint16 if (rfProgrammingEventMask & BIT(0)) { emberAfFillCommandDoorLockClusterProgrammingEventNotification(0x01, 0x00, userId, &userPin, 0x00, 0x00, 0x00, &userPin); - // SEND_COMMAND_UNICAST_TO_BINDINGS(); + SEND_COMMAND_UNICAST_TO_BINDINGS(); } return true; diff --git a/src/app/clusters/door-lock-server/door-lock-server-user.c b/src/app/clusters/door-lock-server/door-lock-server-user.c index 0790d78a55a0fd..8d8bf89073abd7 100644 --- a/src/app/clusters/door-lock-server/door-lock-server-user.c +++ b/src/app/clusters/door-lock-server/door-lock-server-user.c @@ -270,7 +270,7 @@ bool emberAfDoorLockClusterSetPinCallback(uint16_t userId, uint8_t userStatus, u emberAfFillCommandDoorLockClusterProgrammingEventNotification( EMBER_ZCL_DOOR_LOCK_EVENT_SOURCE_RF, EMBER_ZCL_DOOR_LOCK_PROGRAMMING_EVENT_CODE_PIN_ADDED, userId, pin, userType, userStatus, 0 /*emberAfGetCurrentTime() #2507*/, pin); - // SEND_COMMAND_UNICAST_TO_BINDINGS(); + SEND_COMMAND_UNICAST_TO_BINDINGS(); } return true; @@ -334,12 +334,12 @@ bool emberAfDoorLockClusterClearPinCallback(uint16_t userId) if ((rfProgrammingEventMask & BIT(2)) && !status) { emberAfFillCommandDoorLockClusterProgrammingEventNotification(0x01, 0x03, userId, &userPin, 0x00, 0x00, 0x00, &userPin); - // SEND_COMMAND_UNICAST_TO_BINDINGS(); + SEND_COMMAND_UNICAST_TO_BINDINGS(); } else if ((rfProgrammingEventMask & BIT(0)) && status) { emberAfFillCommandDoorLockClusterProgrammingEventNotification(0x01, 0x00, userId, &userPin, 0x00, 0x00, 0x00, &userPin); - // SEND_COMMAND_UNICAST_TO_BINDINGS(); + SEND_COMMAND_UNICAST_TO_BINDINGS(); } return true; @@ -532,7 +532,7 @@ bool emberAfDoorLockClusterLockDoorCallback(uint8_t * PIN) emberAfFillCommandDoorLockClusterOperationEventNotification(0x01, 0x03, userId, PIN, 0x00, PIN); } } - // SEND_COMMAND_UNICAST_TO_BINDINGS(); + SEND_COMMAND_UNICAST_TO_BINDINGS(); return true; } @@ -570,7 +570,7 @@ bool emberAfDoorLockClusterUnlockDoorCallback(uint8_t * pin) emberAfFillCommandDoorLockClusterOperationEventNotification(EMBER_ZCL_DOOR_LOCK_EVENT_SOURCE_RF, EMBER_ZCL_DOOR_LOCK_OPERATION_EVENT_CODE_UNLOCK, userId, pin, 0 /*emberAfGetCurrentTime() #2507 */, pin); - // SEND_COMMAND_UNICAST_TO_BINDINGS(); + SEND_COMMAND_UNICAST_TO_BINDINGS(); } return true; diff --git a/src/app/clusters/door-lock-server/door-lock-server.h b/src/app/clusters/door-lock-server/door-lock-server.h index 609c68435b9e8e..9ecdb1efa7775d 100644 --- a/src/app/clusters/door-lock-server/door-lock-server.h +++ b/src/app/clusters/door-lock-server/door-lock-server.h @@ -233,7 +233,6 @@ bool emAfPluginDoorLockServerCheckForSufficientSpace(uint8_t spaceReq, uint8_t s // Critical Message Queue // If the Critical Message Queue Plugin is available, use it for event notifications -/* Replace SEND_COMMAND_UNICAST_TO_BINDINGS #2504 #ifdef EMBER_AF_PLUGIN_CRITICAL_MESSAGE_QUEUE #include "../critical-message-queue/critical-message-queue.h" #define SEND_COMMAND_UNICAST_TO_BINDINGS() \ @@ -241,7 +240,7 @@ bool emAfPluginDoorLockServerCheckForSufficientSpace(uint8_t spaceReq, uint8_t s #else #define SEND_COMMAND_UNICAST_TO_BINDINGS() emberAfSendCommandUnicastToBindings() #endif -*/ + // ------------------------------------------------------------------------------ // Legacy diff --git a/src/app/util/af-main-common.c b/src/app/util/af-main-common.c index bcc430fa4672a8..c86444ee0a17a8 100644 --- a/src/app/util/af-main-common.c +++ b/src/app/util/af-main-common.c @@ -679,10 +679,21 @@ EmberStatus emAfSend(EmberOutgoingMessageType type, uint64_t indexOrDestination, EmberStatus status = EMBER_SUCCESS; switch (type) { - case EMBER_OUTGOING_VIA_BINDING: - // No implementation yet. - status = EMBER_ERR_FATAL; + case EMBER_OUTGOING_VIA_BINDING: { + EmberBindingTableEntry binding; + status = emberGetBinding(indexOrDestination, &binding); + if (status != EMBER_SUCCESS) + { + break; + } + if (binding.type != EMBER_UNICAST_BINDING) + { + status = EMBER_INVALID_BINDING_INDEX; + break; + } + status = chipSendUnicast(binding.nodeId, apsFrame, messageLength, message); break; + } case EMBER_OUTGOING_VIA_ADDRESS_TABLE: // No implementation yet. status = EMBER_ERR_FATAL; diff --git a/src/app/util/client-api.c b/src/app/util/client-api.c index 58f22ae886db9a..c9013b37374d39 100644 --- a/src/app/util/client-api.c +++ b/src/app/util/client-api.c @@ -274,15 +274,15 @@ uint16_t emberAfFillBuffer(uint8_t * buffer, uint16_t bufferLen, uint8_t frameCo return returnValue; } -// EmberStatus emberAfSendCommandUnicastToBindingsWithCallback(EmberAfMessageSentFunction callback) -// { -// return emberAfSendUnicastToBindingsWithCallback(emAfCommandApsFrame, *emAfResponseLengthPtr, emAfZclBuffer, callback); -// } +EmberStatus emberAfSendCommandUnicastToBindingsWithCallback(EmberAfMessageSentFunction callback) +{ + return emberAfSendUnicastToBindingsWithCallback(emAfCommandApsFrame, *emAfResponseLengthPtr, emAfZclBuffer, callback); +} -// EmberStatus emberAfSendCommandUnicastToBindings(void) -// { -// return emberAfSendCommandUnicastToBindingsWithCallback(NULL); -// } +EmberStatus emberAfSendCommandUnicastToBindings(void) +{ + return emberAfSendCommandUnicastToBindingsWithCallback(NULL); +} // EmberStatus emberAfSendCommandMulticastWithCallback(EmberMulticastId multicastId, EmberAfMessageSentFunction callback) // {