Skip to content

Commit

Permalink
Fix a few more cases of hardcoded integers used for data model types (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
bzbarsky-apple authored and pull[bot] committed Jan 26, 2021
1 parent 0ea41d2 commit 1041683
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 11 deletions.
7 changes: 5 additions & 2 deletions examples/all-clusters-app/esp32/main/CHIPDeviceManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,14 @@
#include <stdlib.h>

#include "CHIPDeviceManager.h"
#include <app/util/basic-types.h>
#include <setup_payload/SetupPayload.h>
#include <support/CHIPMem.h>
#include <support/CodeUtils.h>
#include <support/ErrorStr.h>

using namespace ::chip;

namespace chip {

namespace DeviceManager {
Expand Down Expand Up @@ -95,8 +98,8 @@ CHIP_ERROR CHIPDeviceManager::Init(CHIPDeviceManagerCallbacks * cb)
} // namespace DeviceManager
} // namespace chip

void emberAfPostAttributeChangeCallback(uint8_t endpointId, EmberAfClusterId clusterId, EmberAfAttributeId attributeId,
uint8_t mask, uint16_t manufacturerCode, uint8_t type, uint8_t size, uint8_t * value)
void emberAfPostAttributeChangeCallback(EndpointId endpointId, ClusterId clusterId, AttributeId attributeId, uint8_t mask,
uint16_t manufacturerCode, uint8_t type, uint8_t size, uint8_t * value)
{
chip::DeviceManager::CHIPDeviceManagerCallbacks * cb =
chip::DeviceManager::CHIPDeviceManager::GetInstance().GetCHIPDeviceManagerCallbacks();
Expand Down
11 changes: 6 additions & 5 deletions examples/all-clusters-app/esp32/main/DeviceCallbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,13 @@
#include "esp_log.h"
#include "gen/attribute-id.h"
#include "gen/cluster-id.h"
#include <app/util/basic-types.h>
#include <lib/mdns/DiscoveryManager.h>
#include <support/CodeUtils.h>

static const char * TAG = "echo-devicecallbacks";

using namespace ::chip;
using namespace ::chip::Inet;
using namespace ::chip::System;
using namespace ::chip::DeviceLayer;
Expand All @@ -60,9 +62,8 @@ void DeviceCallbacks::DeviceEventCallback(const ChipDeviceEvent * event, intptr_
ESP_LOGI(TAG, "Current free heap: %d\n", heap_caps_get_free_size(MALLOC_CAP_8BIT));
}

void DeviceCallbacks::PostAttributeChangeCallback(uint8_t endpointId, EmberAfClusterId clusterId, EmberAfAttributeId attributeId,
uint8_t mask, uint16_t manufacturerCode, uint8_t type, uint8_t size,
uint8_t * value)
void DeviceCallbacks::PostAttributeChangeCallback(EndpointId endpointId, ClusterId clusterId, AttributeId attributeId, uint8_t mask,
uint16_t manufacturerCode, uint8_t type, uint8_t size, uint8_t * value)
{
ESP_LOGI(TAG, "PostAttributeChangeCallback - Cluster ID: '0x%04x', EndPoint ID: '0x%02x', Attribute ID: '0x%04x'", clusterId,
endpointId, attributeId);
Expand Down Expand Up @@ -117,7 +118,7 @@ void DeviceCallbacks::OnSessionEstablished(const ChipDeviceEvent * event)
}
}

void DeviceCallbacks::OnOnOffPostAttributeChangeCallback(uint8_t endpointId, uint16_t attributeId, uint8_t * value)
void DeviceCallbacks::OnOnOffPostAttributeChangeCallback(EndpointId endpointId, AttributeId attributeId, uint8_t * value)
{
VerifyOrExit(attributeId == ZCL_ON_OFF_ATTRIBUTE_ID, ESP_LOGI(TAG, "Unhandled Attribute ID: '0x%04x", attributeId));
VerifyOrExit(endpointId == 1 || endpointId == 2, ESP_LOGE(TAG, "Unexpected EndPoint ID: `0x%02x'", endpointId));
Expand All @@ -142,7 +143,7 @@ void IdentifyTimerHandler(Layer * systemLayer, void * appState, Error error)
}
}

void DeviceCallbacks::OnIdentifyPostAttributeChangeCallback(uint8_t endpointId, uint16_t attributeId, uint8_t * value)
void DeviceCallbacks::OnIdentifyPostAttributeChangeCallback(EndpointId endpointId, AttributeId attributeId, uint8_t * value)
{
VerifyOrExit(attributeId == ZCL_IDENTIFY_TIME_ATTRIBUTE_ID, ESP_LOGI(TAG, "Unhandled Attribute ID: '0x%04x", attributeId));
VerifyOrExit(endpointId == 1, ESP_LOGE(TAG, "Unexpected EndPoint ID: `0x%02x'", endpointId));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,19 @@

#include "CHIPDeviceManager.h"
#include <app/util/af-types.h>
#include <app/util/basic-types.h>
#include <platform/CHIPDeviceLayer.h>

class DeviceCallbacks : public chip::DeviceManager::CHIPDeviceManagerCallbacks
{
public:
virtual void DeviceEventCallback(const chip::DeviceLayer::ChipDeviceEvent * event, intptr_t arg);
virtual void PostAttributeChangeCallback(uint8_t endpointId, EmberAfClusterId clusterId, EmberAfAttributeId attributeId,
virtual void PostAttributeChangeCallback(chip::EndpointId endpointId, chip::ClusterId clusterId, chip::AttributeId attributeId,
uint8_t mask, uint16_t manufacturerCode, uint8_t type, uint8_t size, uint8_t * value);

private:
void OnInternetConnectivityChange(const chip::DeviceLayer::ChipDeviceEvent * event);
void OnSessionEstablished(const chip::DeviceLayer::ChipDeviceEvent * event);
void OnOnOffPostAttributeChangeCallback(uint8_t endpointId, uint16_t attributeId, uint8_t * value);
void OnIdentifyPostAttributeChangeCallback(uint8_t endpointId, uint16_t attributeId, uint8_t * value);
void OnOnOffPostAttributeChangeCallback(chip::EndpointId endpointId, chip::AttributeId attributeId, uint8_t * value);
void OnIdentifyPostAttributeChangeCallback(chip::EndpointId endpointId, chip::AttributeId attributeId, uint8_t * value);
};
4 changes: 3 additions & 1 deletion src/app/util/af-main-common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@
#include "chip-message-send.h"
#include "util.h"

using namespace chip;

// Querying the Ember Stack for what libraries are present.
//#include "app/util/common/library.h"

Expand Down Expand Up @@ -408,7 +410,7 @@ EmberStatus emberAfSendMulticastToBindings(EmberApsFrame * apsFrame, uint16_t me
EmberStatus status = EMBER_INVALID_BINDING_INDEX;
uint8_t i;
EmberBindingTableEntry binding;
uint16_t groupDest;
GroupId groupDest;

if ((NULL == apsFrame) || (0 == messageLength) || (NULL == message))
{
Expand Down

0 comments on commit 1041683

Please sign in to comment.