Skip to content

Commit

Permalink
Handle write on identifyTime attribute on esp32 side
Browse files Browse the repository at this point in the history
  • Loading branch information
PSONALl committed Jan 17, 2022
1 parent e4faade commit 3a2111e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
13 changes: 13 additions & 0 deletions examples/all-clusters-app/esp32/main/DeviceCallbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#include "route_hook/esp_route_hook.h"
#include <app-common/zap-generated/attribute-id.h>
#include <app-common/zap-generated/cluster-id.h>
#include <app-common/zap-generated/attribute-type.h>
#include <app/CommandHandler.h>
#include <app/clusters/identify-server/identify-server.h>
#include <app/server/Dnssd.h>
Expand Down Expand Up @@ -156,6 +157,9 @@ void DeviceCallbacks::PostAttributeChangeCallback(EndpointId endpointId, Cluster
OnColorControlAttributeChangeCallback(endpointId, attributeId, value);
break;
#endif
case ZCL_IDENTIFY_CLUSTER_ID:
OnIdentifyAttributeChangeCallback(endpointId, attributeId, value);
break;
default:
ESP_LOGI(TAG, "Unhandled cluster ID: %d", clusterId);
break;
Expand Down Expand Up @@ -254,6 +258,15 @@ void DeviceCallbacks::OnColorControlAttributeChangeCallback(EndpointId endpointI
}
#endif

void DeviceCallbacks::OnIdentifyAttributeChangeCallback(EndpointId endpointId, AttributeId attributeId, uint8_t * value)
{
if (attributeId == ZCL_IDENTIFY_TIME_ATTRIBUTE_ID)
{
uint8_t identifyTime = *value;
emberAfWriteServerAttribute(endpointId, ZCL_IDENTIFY_CLUSTER_ID,ZCL_IDENTIFY_TIME_ATTRIBUTE_ID, &identifyTime, ZCL_INT8U_ATTRIBUTE_TYPE);
}
}

bool emberAfBasicClusterMfgSpecificPingCallback(chip::app::CommandHandler * commandObj)
{
emberAfSendDefaultResponse(emberAfCurrentCommand(), EMBER_ZCL_STATUS_SUCCESS);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,6 @@ class DeviceCallbacks : public chip::DeviceManager::CHIPDeviceManagerCallbacks
#if CONFIG_DEVICE_TYPE_ESP32_C3_DEVKITM
void OnColorControlAttributeChangeCallback(chip::EndpointId endpointId, chip::AttributeId attributeId, uint8_t * value);
#endif
void OnIdentifyAttributeChangeCallback(chip::EndpointId endpointId, chip::AttributeId attributeId, uint8_t * value);
bool mEndpointOnOffState[2];
};

0 comments on commit 3a2111e

Please sign in to comment.