Skip to content

Commit

Permalink
Get rid of the concept of client attributes. (#17875)
Browse files Browse the repository at this point in the history
They don't exist in Matter.

We still have some places using *ServerAttribute instead of just *Attribute; that
will be sorted out in a separate PR.
  • Loading branch information
bzbarsky-apple authored and pull[bot] committed Jun 23, 2023
1 parent a28963e commit 1012764
Show file tree
Hide file tree
Showing 126 changed files with 350 additions and 1,456 deletions.
5 changes: 2 additions & 3 deletions examples/all-clusters-app/ameba/main/CHIPDeviceManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,12 @@ CHIP_ERROR CHIPDeviceManager::Init(CHIPDeviceManagerCallbacks * cb)
} // namespace DeviceManager
} // namespace chip

void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & path, uint8_t mask, uint8_t type, uint16_t size,
uint8_t * value)
void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & path, uint8_t type, uint16_t size, uint8_t * value)
{
chip::DeviceManager::CHIPDeviceManagerCallbacks * cb =
chip::DeviceManager::CHIPDeviceManager::GetInstance().GetCHIPDeviceManagerCallbacks();
if (cb != nullptr)
{
cb->PostAttributeChangeCallback(path.mEndpointId, path.mClusterId, path.mAttributeId, mask, type, size, value);
cb->PostAttributeChangeCallback(path.mEndpointId, path.mClusterId, path.mAttributeId, type, size, value);
}
}
4 changes: 2 additions & 2 deletions examples/all-clusters-app/ameba/main/DeviceCallbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ void DeviceCallbacks::DeviceEventCallback(const ChipDeviceEvent * event, intptr_
}
}

void DeviceCallbacks::PostAttributeChangeCallback(EndpointId endpointId, ClusterId clusterId, AttributeId attributeId, uint8_t mask,
uint8_t type, uint16_t size, uint8_t * value)
void DeviceCallbacks::PostAttributeChangeCallback(EndpointId endpointId, ClusterId clusterId, AttributeId attributeId, uint8_t type,
uint16_t size, uint8_t * value)
{
switch (clusterId)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,13 @@ class CHIPDeviceManagerCallbacks
* @param endpoint endpoint id
* @param clusterID cluster id
* @param attributeId attribute id that was changed
* @param mask mask of the attribute
* @param manufacturerCode manufacturer code
* @param type attribute type
* @param size size of the attribute
* @param value pointer to the new value
*/
virtual void PostAttributeChangeCallback(chip::EndpointId endpoint, chip::ClusterId clusterId, chip::AttributeId attributeId,
uint8_t mask, uint8_t type, uint16_t size, uint8_t * value)
uint8_t type, uint16_t size, uint8_t * value)
{}
virtual ~CHIPDeviceManagerCallbacks() {}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class DeviceCallbacks : public chip::DeviceManager::CHIPDeviceManagerCallbacks
public:
void DeviceEventCallback(const chip::DeviceLayer::ChipDeviceEvent * event, intptr_t arg) override;
void PostAttributeChangeCallback(chip::EndpointId endpointId, chip::ClusterId clusterId, chip::AttributeId attributeId,
uint8_t mask, uint8_t type, uint16_t size, uint8_t * value) override;
uint8_t type, uint16_t size, uint8_t * value) override;

private:
void OnInternetConnectivityChange(const chip::DeviceLayer::ChipDeviceEvent * event);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
using namespace ::chip;
using namespace ::chip::app::Clusters;

void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & attributePath, uint8_t mask, uint8_t type,
uint16_t size, uint8_t * value)
void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & attributePath, uint8_t type, uint16_t size,
uint8_t * value)
{
EndpointId endpoint = attributePath.mEndpointId;
ClusterId clusterId = attributePath.mClusterId;
Expand Down
5 changes: 2 additions & 3 deletions examples/all-clusters-app/esp32/main/CHIPDeviceManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,7 @@ CHIP_ERROR CHIPDeviceManager::Init(CHIPDeviceManagerCallbacks * cb)
} // namespace DeviceManager
} // namespace chip

void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & path, uint8_t mask, uint8_t type, uint16_t size,
uint8_t * value)
void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & path, uint8_t type, uint16_t size, uint8_t * value)
{
TaskHandle_t task = xTaskGetCurrentTaskHandle();
const char * name = pcTaskGetName(task);
Expand All @@ -99,6 +98,6 @@ void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath &
chip::DeviceManager::CHIPDeviceManager::GetInstance().GetCHIPDeviceManagerCallbacks();
if (cb != nullptr)
{
cb->PostAttributeChangeCallback(path.mEndpointId, path.mClusterId, path.mAttributeId, mask, type, size, value);
cb->PostAttributeChangeCallback(path.mEndpointId, path.mClusterId, path.mAttributeId, type, size, value);
}
}
4 changes: 2 additions & 2 deletions examples/all-clusters-app/esp32/main/DeviceCallbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,8 @@ void DeviceCallbacks::DeviceEventCallback(const ChipDeviceEvent * event, intptr_
ESP_LOGI(TAG, "Current free heap: %u\n", static_cast<unsigned int>(heap_caps_get_free_size(MALLOC_CAP_8BIT)));
}

void DeviceCallbacks::PostAttributeChangeCallback(EndpointId endpointId, ClusterId clusterId, AttributeId attributeId, uint8_t mask,
uint8_t type, uint16_t size, uint8_t * value)
void DeviceCallbacks::PostAttributeChangeCallback(EndpointId endpointId, ClusterId clusterId, AttributeId attributeId, uint8_t type,
uint16_t size, uint8_t * value)
{
ESP_LOGI(TAG,
"PostAttributeChangeCallback - Cluster ID: '0x%04x', EndPoint ID: "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,13 @@ class DLL_EXPORT CHIPDeviceManagerCallbacks
* @param endpoint endpoint id
* @param clusterID cluster id
* @param attributeId attribute id that was changed
* @param mask mask of the attribute
* @param manufacturerCode manufacturer code
* @param type attribute type
* @param size size of the attribute
* @param value pointer to the new value
*/
virtual void PostAttributeChangeCallback(chip::EndpointId endpoint, chip::ClusterId clusterId, chip::AttributeId attributeId,
uint8_t mask, uint8_t type, uint16_t size, uint8_t * value)
uint8_t type, uint16_t size, uint8_t * value)
{}
virtual ~CHIPDeviceManagerCallbacks() {}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class DeviceCallbacks : public chip::DeviceManager::CHIPDeviceManagerCallbacks
public:
virtual void DeviceEventCallback(const chip::DeviceLayer::ChipDeviceEvent * event, intptr_t arg);
virtual void PostAttributeChangeCallback(chip::EndpointId endpointId, chip::ClusterId clusterId, chip::AttributeId attributeId,
uint8_t mask, uint8_t type, uint16_t size, uint8_t * value);
uint8_t type, uint16_t size, uint8_t * value);

private:
void OnInternetConnectivityChange(const chip::DeviceLayer::ChipDeviceEvent * event);
Expand Down
4 changes: 2 additions & 2 deletions examples/all-clusters-app/p6/src/ZclCallbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
using namespace ::chip;
using namespace ::chip::app::Clusters;

void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & attributePath, uint8_t mask, uint8_t type,
uint16_t size, uint8_t * value)
void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & attributePath, uint8_t type, uint16_t size,
uint8_t * value)
{
EndpointId endpoint = attributePath.mEndpointId;
ClusterId clusterId = attributePath.mClusterId;
Expand Down
5 changes: 2 additions & 3 deletions examples/bridge-app/esp32/main/CHIPDeviceManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,12 @@ CHIP_ERROR CHIPDeviceManager::Init(CHIPDeviceManagerCallbacks * cb)
} // namespace DeviceManager
} // namespace chip

void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & path, uint8_t mask, uint8_t type, uint16_t size,
uint8_t * value)
void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & path, uint8_t type, uint16_t size, uint8_t * value)
{
chip::DeviceManager::CHIPDeviceManagerCallbacks * cb =
chip::DeviceManager::CHIPDeviceManager::GetInstance().GetCHIPDeviceManagerCallbacks();
if (cb != nullptr)
{
cb->PostAttributeChangeCallback(path.mEndpointId, path.mClusterId, path.mAttributeId, mask, type, size, value);
cb->PostAttributeChangeCallback(path.mEndpointId, path.mClusterId, path.mAttributeId, type, size, value);
}
}
4 changes: 2 additions & 2 deletions examples/bridge-app/esp32/main/DeviceCallbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,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(EndpointId endpointId, ClusterId clusterId, AttributeId attributeId, uint8_t mask,
uint8_t type, uint16_t size, uint8_t * value)
void DeviceCallbacks::PostAttributeChangeCallback(EndpointId endpointId, ClusterId clusterId, AttributeId attributeId, uint8_t type,
uint16_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
3 changes: 1 addition & 2 deletions examples/bridge-app/esp32/main/include/CHIPDeviceManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,13 @@ class DLL_EXPORT CHIPDeviceManagerCallbacks
* @param endpoint endpoint id
* @param clusterID cluster id
* @param attributeId attribute id that was changed
* @param mask mask of the attribute
* @param manufacturerCode manufacturer code
* @param type attribute type
* @param size size of the attribute
* @param value pointer to the new value
*/
virtual void PostAttributeChangeCallback(chip::EndpointId endpoint, chip::ClusterId clusterId, chip::AttributeId attributeId,
uint8_t mask, uint8_t type, uint16_t size, uint8_t * value)
uint8_t type, uint16_t size, uint8_t * value)
{}
virtual ~CHIPDeviceManagerCallbacks() {}
};
Expand Down
2 changes: 1 addition & 1 deletion examples/bridge-app/esp32/main/include/DeviceCallbacks.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class DeviceCallbacks : public chip::DeviceManager::CHIPDeviceManagerCallbacks
public:
virtual void DeviceEventCallback(const chip::DeviceLayer::ChipDeviceEvent * event, intptr_t arg);
virtual void PostAttributeChangeCallback(chip::EndpointId endpointId, chip::ClusterId clusterId, chip::AttributeId attributeId,
uint8_t mask, uint8_t type, uint16_t size, uint8_t * value);
uint8_t type, uint16_t size, uint8_t * value);

private:
void OnInternetConnectivityChange(const chip::DeviceLayer::ChipDeviceEvent * event);
Expand Down
10 changes: 4 additions & 6 deletions examples/bridge-app/esp32/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -348,24 +348,22 @@ void HandleDeviceStatusChanged(Device * dev, Device::Changed_t itemChangedMask)
{
uint8_t reachable = dev->IsReachable() ? 1 : 0;
MatterReportingAttributeChangeCallback(dev->GetEndpointId(), ZCL_BRIDGED_DEVICE_BASIC_CLUSTER_ID,
ZCL_REACHABLE_ATTRIBUTE_ID, CLUSTER_MASK_SERVER, ZCL_BOOLEAN_ATTRIBUTE_TYPE,
&reachable);
ZCL_REACHABLE_ATTRIBUTE_ID, ZCL_BOOLEAN_ATTRIBUTE_TYPE, &reachable);
}

if (itemChangedMask & Device::kChanged_State)
{
uint8_t isOn = dev->IsOn() ? 1 : 0;
MatterReportingAttributeChangeCallback(dev->GetEndpointId(), ZCL_ON_OFF_CLUSTER_ID, ZCL_ON_OFF_ATTRIBUTE_ID,
CLUSTER_MASK_SERVER, ZCL_BOOLEAN_ATTRIBUTE_TYPE, &isOn);
ZCL_BOOLEAN_ATTRIBUTE_TYPE, &isOn);
}

if (itemChangedMask & Device::kChanged_Name)
{
uint8_t zclName[kNodeLabelSize + 1];
ToZclCharString(zclName, dev->GetName(), kNodeLabelSize);
MatterReportingAttributeChangeCallback(dev->GetEndpointId(), ZCL_BRIDGED_DEVICE_BASIC_CLUSTER_ID,
ZCL_NODE_LABEL_ATTRIBUTE_ID, CLUSTER_MASK_SERVER, ZCL_CHAR_STRING_ATTRIBUTE_TYPE,
zclName);
ZCL_NODE_LABEL_ATTRIBUTE_ID, ZCL_CHAR_STRING_ATTRIBUTE_TYPE, zclName);
}
if (itemChangedMask & Device::kChanged_Location)
{
Expand All @@ -377,7 +375,7 @@ void HandleDeviceStatusChanged(Device * dev, Device::Changed_t itemChangedMask)
EncodeFixedLabel("room", dev->GetLocation(), buffer, sizeof(buffer), &am);

MatterReportingAttributeChangeCallback(dev->GetEndpointId(), ZCL_FIXED_LABEL_CLUSTER_ID, ZCL_LABEL_LIST_ATTRIBUTE_ID,
CLUSTER_MASK_SERVER, ZCL_ARRAY_ATTRIBUTE_TYPE, buffer);
ZCL_ARRAY_ATTRIBUTE_TYPE, buffer);
}
}

Expand Down
16 changes: 7 additions & 9 deletions examples/bridge-app/linux/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -294,8 +294,7 @@ void HandleDeviceStatusChanged(Device * dev, Device::Changed_t itemChangedMask)
{
uint8_t reachable = dev->IsReachable() ? 1 : 0;
MatterReportingAttributeChangeCallback(dev->GetEndpointId(), ZCL_BRIDGED_DEVICE_BASIC_CLUSTER_ID,
ZCL_REACHABLE_ATTRIBUTE_ID, CLUSTER_MASK_SERVER, ZCL_BOOLEAN_ATTRIBUTE_TYPE,
&reachable);
ZCL_REACHABLE_ATTRIBUTE_ID, ZCL_BOOLEAN_ATTRIBUTE_TYPE, &reachable);
}

if (itemChangedMask & Device::kChanged_Name)
Expand All @@ -304,8 +303,7 @@ void HandleDeviceStatusChanged(Device * dev, Device::Changed_t itemChangedMask)
MutableByteSpan zclNameSpan(zclName);
MakeZclCharString(zclNameSpan, dev->GetName());
MatterReportingAttributeChangeCallback(dev->GetEndpointId(), ZCL_BRIDGED_DEVICE_BASIC_CLUSTER_ID,
ZCL_NODE_LABEL_ATTRIBUTE_ID, CLUSTER_MASK_SERVER, ZCL_CHAR_STRING_ATTRIBUTE_TYPE,
zclNameSpan.data());
ZCL_NODE_LABEL_ATTRIBUTE_ID, ZCL_CHAR_STRING_ATTRIBUTE_TYPE, zclNameSpan.data());
}

if (itemChangedMask & Device::kChanged_Location)
Expand All @@ -318,7 +316,7 @@ void HandleDeviceStatusChanged(Device * dev, Device::Changed_t itemChangedMask)
EncodeFixedLabel("room", dev->GetLocation(), buffer, sizeof(buffer), &am);

MatterReportingAttributeChangeCallback(dev->GetEndpointId(), ZCL_FIXED_LABEL_CLUSTER_ID, ZCL_LABEL_LIST_ATTRIBUTE_ID,
CLUSTER_MASK_SERVER, ZCL_ARRAY_ATTRIBUTE_TYPE, buffer);
ZCL_ARRAY_ATTRIBUTE_TYPE, buffer);
}
}

Expand All @@ -333,7 +331,7 @@ void HandleDeviceOnOffStatusChanged(DeviceOnOff * dev, DeviceOnOff::Changed_t it
{
uint8_t isOn = dev->IsOn() ? 1 : 0;
MatterReportingAttributeChangeCallback(dev->GetEndpointId(), ZCL_ON_OFF_CLUSTER_ID, ZCL_ON_OFF_ATTRIBUTE_ID,
CLUSTER_MASK_SERVER, ZCL_BOOLEAN_ATTRIBUTE_TYPE, &isOn);
ZCL_BOOLEAN_ATTRIBUTE_TYPE, &isOn);
}
}

Expand All @@ -348,21 +346,21 @@ void HandleDeviceSwitchStatusChanged(DeviceSwitch * dev, DeviceSwitch::Changed_t
{
uint8_t numberOfPositions = dev->GetNumberOfPositions();
MatterReportingAttributeChangeCallback(dev->GetEndpointId(), ZCL_SWITCH_CLUSTER_ID, ZCL_NUMBER_OF_POSITIONS_ATTRIBUTE_ID,
CLUSTER_MASK_SERVER, ZCL_INT8U_ATTRIBUTE_TYPE, &numberOfPositions);
ZCL_INT8U_ATTRIBUTE_TYPE, &numberOfPositions);
}

if (itemChangedMask & DeviceSwitch::kChanged_CurrentPosition)
{
uint8_t currentPosition = dev->GetCurrentPosition();
MatterReportingAttributeChangeCallback(dev->GetEndpointId(), ZCL_SWITCH_CLUSTER_ID, ZCL_CURRENT_POSITION_ATTRIBUTE_ID,
CLUSTER_MASK_SERVER, ZCL_INT8U_ATTRIBUTE_TYPE, &currentPosition);
ZCL_INT8U_ATTRIBUTE_TYPE, &currentPosition);
}

if (itemChangedMask & DeviceSwitch::kChanged_MultiPressMax)
{
uint8_t multiPressMax = dev->GetMultiPressMax();
MatterReportingAttributeChangeCallback(dev->GetEndpointId(), ZCL_SWITCH_CLUSTER_ID, ZCL_MULTI_PRESS_MAX_ATTRIBUTE_ID,
CLUSTER_MASK_SERVER, ZCL_INT8U_ATTRIBUTE_TYPE, &multiPressMax);
ZCL_INT8U_ATTRIBUTE_TYPE, &multiPressMax);
}
}

Expand Down
4 changes: 2 additions & 2 deletions examples/light-switch-app/efr32/src/ZclCallbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
using namespace ::chip;
using namespace ::chip::app::Clusters;

void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & attributePath, uint8_t mask, uint8_t type,
uint16_t size, uint8_t * value)
void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & attributePath, uint8_t type, uint16_t size,
uint8_t * value)
{
ClusterId clusterId = attributePath.mClusterId;
AttributeId attributeId = attributePath.mAttributeId;
Expand Down
6 changes: 3 additions & 3 deletions examples/lighting-app/ameba/main/CHIPDeviceManager.cpp
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ CHIP_ERROR CHIPDeviceManager::Init(CHIPDeviceManagerCallbacks * cb)
} // namespace DeviceManager
} // namespace chip

void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & attributePath, uint8_t mask, uint8_t type,
uint16_t size, uint8_t * value)
void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & attributePath, uint8_t type, uint16_t size,
uint8_t * value)
{
chip::DeviceManager::CHIPDeviceManagerCallbacks * cb =
chip::DeviceManager::CHIPDeviceManager::GetInstance().GetCHIPDeviceManagerCallbacks();
Expand Down Expand Up @@ -153,7 +153,7 @@ void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath &
{
if (cb != nullptr)
{
cb->PostAttributeChangeCallback(endpointId, clusterId, attributeId, mask, type, size, value);
cb->PostAttributeChangeCallback(endpointId, clusterId, attributeId, type, size, value);
}
ChipLogProgress(Zcl, "ZCL_IDENTIFY_TIME_ATTRIBUTE_ID value: %u ", *value);
}
Expand Down
4 changes: 2 additions & 2 deletions examples/lighting-app/ameba/main/DeviceCallbacks.cpp
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ void DeviceCallbacks::OnSessionEstablished(const ChipDeviceEvent * event)
}
}

void DeviceCallbacks::PostAttributeChangeCallback(EndpointId endpointId, ClusterId clusterId, AttributeId attributeId, uint8_t mask,
uint8_t type, uint16_t size, uint8_t * value)
void DeviceCallbacks::PostAttributeChangeCallback(EndpointId endpointId, ClusterId clusterId, AttributeId attributeId, uint8_t type,
uint16_t size, uint8_t * value)
{
switch (clusterId)
{
Expand Down
3 changes: 1 addition & 2 deletions examples/lighting-app/ameba/main/include/CHIPDeviceManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,13 @@ class CHIPDeviceManagerCallbacks
* @param endpoint endpoint id
* @param clusterID cluster id
* @param attributeId attribute id that was changed
* @param mask mask of the attribute
* @param manufacturerCode manufacturer code
* @param type attribute type
* @param size size of the attribute
* @param value pointer to the new value
*/
virtual void PostAttributeChangeCallback(chip::EndpointId endpoint, chip::ClusterId clusterId, chip::AttributeId attributeId,
uint8_t mask, uint8_t type, uint16_t size, uint8_t * value)
uint8_t type, uint16_t size, uint8_t * value)
{}
virtual ~CHIPDeviceManagerCallbacks() {}
};
Expand Down
Loading

0 comments on commit 1012764

Please sign in to comment.