Skip to content

Commit

Permalink
Remove manufacturer code from attribute-table APIs. (#13560)
Browse files Browse the repository at this point in the history
  • Loading branch information
bzbarsky-apple authored and pull[bot] committed Oct 11, 2023
1 parent e27c15a commit 1049596
Show file tree
Hide file tree
Showing 30 changed files with 65 additions and 333 deletions.
8 changes: 4 additions & 4 deletions examples/bridge-app/esp32/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -308,23 +308,23 @@ 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, 0, ZCL_BOOLEAN_ATTRIBUTE_TYPE,
ZCL_REACHABLE_ATTRIBUTE_ID, CLUSTER_MASK_SERVER, 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, 0, ZCL_BOOLEAN_ATTRIBUTE_TYPE, &isOn);
CLUSTER_MASK_SERVER, 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, 0, ZCL_CHAR_STRING_ATTRIBUTE_TYPE,
ZCL_NODE_LABEL_ATTRIBUTE_ID, CLUSTER_MASK_SERVER, ZCL_CHAR_STRING_ATTRIBUTE_TYPE,
zclName);
}
if (itemChangedMask & Device::kChanged_Location)
Expand All @@ -337,7 +337,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, 0, ZCL_ARRAY_ATTRIBUTE_TYPE, buffer);
CLUSTER_MASK_SERVER, ZCL_ARRAY_ATTRIBUTE_TYPE, buffer);
}
}

Expand Down
14 changes: 7 additions & 7 deletions examples/bridge-app/linux/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,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, 0, ZCL_BOOLEAN_ATTRIBUTE_TYPE,
ZCL_REACHABLE_ATTRIBUTE_ID, CLUSTER_MASK_SERVER, ZCL_BOOLEAN_ATTRIBUTE_TYPE,
&reachable);
}

Expand All @@ -269,7 +269,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, 0, ZCL_CHAR_STRING_ATTRIBUTE_TYPE,
ZCL_NODE_LABEL_ATTRIBUTE_ID, CLUSTER_MASK_SERVER, ZCL_CHAR_STRING_ATTRIBUTE_TYPE,
zclNameSpan.data());
}

Expand All @@ -283,7 +283,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, 0, ZCL_ARRAY_ATTRIBUTE_TYPE, buffer);
CLUSTER_MASK_SERVER, ZCL_ARRAY_ATTRIBUTE_TYPE, buffer);
}
}

Expand All @@ -298,7 +298,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, 0, ZCL_BOOLEAN_ATTRIBUTE_TYPE, &isOn);
CLUSTER_MASK_SERVER, ZCL_BOOLEAN_ATTRIBUTE_TYPE, &isOn);
}
}

Expand All @@ -313,21 +313,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, 0, ZCL_INT8U_ATTRIBUTE_TYPE, &numberOfPositions);
CLUSTER_MASK_SERVER, 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, 0, ZCL_INT8U_ATTRIBUTE_TYPE, &currentPosition);
CLUSTER_MASK_SERVER, 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, 0, ZCL_INT8U_ATTRIBUTE_TYPE, &multiPressMax);
CLUSTER_MASK_SERVER, ZCL_INT8U_ATTRIBUTE_TYPE, &multiPressMax);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/app/reporting/reporting.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
* notification to inform its reporting decisions.
*/
void MatterReportingAttributeChangeCallback(chip::EndpointId endpoint, chip::ClusterId clusterId, chip::AttributeId attributeId,
uint8_t mask, uint16_t manufacturerCode, EmberAfAttributeType type, uint8_t * data);
uint8_t mask, EmberAfAttributeType type, uint8_t * data);

/*
* Same but with just an attribute path and no data available.
Expand Down
77 changes: 1 addition & 76 deletions src/app/util/af.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,6 @@ bool emberAfContainsClient(chip::EndpointId endpoint, chip::ClusterId clusterId)
* to perform the given operation.
*
* @see emberAfWriteClientAttribute, emberAfWriteServerAttribute,
* emberAfWriteManufacturerSpecificClientAttribute,
* emberAfWriteManufacturerSpecificServerAttribute
*/
EmberAfStatus emberAfWriteAttribute(chip::EndpointId endpoint, chip::ClusterId cluster, chip::AttributeId attributeID, uint8_t mask,
uint8_t * dataPtr, EmberAfAttributeType dataType);
Expand All @@ -168,8 +166,6 @@ EmberAfStatus emberAfWriteAttribute(chip::EndpointId endpoint, chip::ClusterId c
* is used frequently throughout the framework
*
* @see emberAfWriteClientAttribute,
* emberAfWriteManufacturerSpecificClientAttribute,
* emberAfWriteManufacturerSpecificServerAttribute
*/
EmberAfStatus emberAfWriteServerAttribute(chip::EndpointId endpoint, chip::ClusterId cluster, chip::AttributeId attributeID,
uint8_t * dataPtr, EmberAfAttributeType dataType);
Expand All @@ -183,44 +179,10 @@ EmberAfStatus emberAfWriteServerAttribute(chip::EndpointId endpoint, chip::Clust
* is used frequently throughout the framework
*
* @see emberAfWriteServerAttribute,
* emberAfWriteManufacturerSpecificClientAttribute,
* emberAfWriteManufacturerSpecificServerAttribute
*/
EmberAfStatus emberAfWriteClientAttribute(chip::EndpointId endpoint, chip::ClusterId cluster, chip::AttributeId attributeID,
uint8_t * dataPtr, EmberAfAttributeType dataType);

/**
* @brief write a manufacturer specific server attribute.
*
* This function is the same as emberAfWriteAttribute
* except that it saves having to pass the cluster mask
* and allows passing of a manufacturer code.
* This is useful for code savings since write attribute
* is used frequently throughout the framework
*
* @see emberAfWriteClientAttribute, emberAfWriteServerAttribute,
* emberAfWriteManufacturerSpecificClientAttribute
*/
EmberAfStatus emberAfWriteManufacturerSpecificServerAttribute(chip::EndpointId endpoint, chip::ClusterId cluster,
chip::AttributeId attributeID, uint16_t manufacturerCode,
uint8_t * dataPtr, EmberAfAttributeType dataType);

/**
* @brief write a manufacturer specific client attribute.
*
* This function is the same as emberAfWriteAttribute
* except that it saves having to pass the cluster mask.
* and allows passing of a manufacturer code.
* This is useful for code savings since write attribute
* is used frequently throughout the framework
*
* @see emberAfWriteClientAttribute, emberAfWriteServerAttribute,
* emberAfWriteManufacturerSpecificServerAttribute
*/
EmberAfStatus emberAfWriteManufacturerSpecificClientAttribute(chip::EndpointId endpoint, chip::ClusterId cluster,
chip::AttributeId attributeID, uint16_t manufacturerCode,
uint8_t * dataPtr, EmberAfAttributeType dataType);

/**
* @brief Function that test the success of attribute write.
*
Expand All @@ -236,8 +198,7 @@ EmberAfStatus emberAfWriteManufacturerSpecificClientAttribute(chip::EndpointId e
* @param dataType ZCL attribute type.
*/
EmberAfStatus emberAfVerifyAttributeWrite(chip::EndpointId endpoint, chip::ClusterId cluster, chip::AttributeId attributeID,
uint8_t mask, uint16_t manufacturerCode, uint8_t * dataPtr,
EmberAfAttributeType dataType);
uint8_t mask, uint8_t * dataPtr, EmberAfAttributeType dataType);

/**
* @brief Read the attribute value, performing all the checks.
Expand All @@ -248,8 +209,6 @@ EmberAfStatus emberAfVerifyAttributeWrite(chip::EndpointId endpoint, chip::Clust
* value or type is not desired.
*
* @see emberAfReadClientAttribute, emberAfReadServerAttribute,
* emberAfReadManufacturerSpecificClientAttribute,
* emberAfReadManufacturerSpecificServerAttribute
*/
EmberAfStatus emberAfReadAttribute(chip::EndpointId endpoint, chip::ClusterId cluster, chip::AttributeId attributeID, uint8_t mask,
uint8_t * dataPtr, uint16_t readLength, EmberAfAttributeType * dataType);
Expand All @@ -263,8 +222,6 @@ EmberAfStatus emberAfReadAttribute(chip::EndpointId endpoint, chip::ClusterId cl
* value or type is not desired.
*
* @see emberAfReadClientAttribute,
* emberAfReadManufacturerSpecificClientAttribute,
* emberAfReadManufacturerSpecificServerAttribute
*/
EmberAfStatus emberAfReadServerAttribute(chip::EndpointId endpoint, chip::ClusterId cluster, chip::AttributeId attributeID,
uint8_t * dataPtr, uint16_t readLength);
Expand All @@ -278,42 +235,10 @@ EmberAfStatus emberAfReadServerAttribute(chip::EndpointId endpoint, chip::Cluste
* value or type is not desired.
*
* @see emberAfReadServerAttribute,
* emberAfReadManufacturerSpecificClientAttribute,
* emberAfReadManufacturerSpecificServerAttribute
*/
EmberAfStatus emberAfReadClientAttribute(chip::EndpointId endpoint, chip::ClusterId cluster, chip::AttributeId attributeID,
uint8_t * dataPtr, uint16_t readLength);

/**
* @brief Read the manufacturer-specific server attribute value, performing all checks.
*
* This function will attempt to read the attribute and store
* it into the pointer. It will also read the data type.
* Both dataPtr and dataType may be NULL, signifying that either
* value or type is not desired.
*
* @see emberAfReadClientAttribute, emberAfReadServerAttribute,
* emberAfReadManufacturerSpecificClientAttribute
*/
EmberAfStatus emberAfReadManufacturerSpecificServerAttribute(chip::EndpointId endpoint, chip::ClusterId cluster,
chip::AttributeId attributeID, uint16_t manufacturerCode,
uint8_t * dataPtr, uint16_t readLength);

/**
* @brief Read the manufacturer-specific client attribute value, performing all checks.
*
* This function will attempt to read the attribute and store
* it into the pointer. It will also read the data type.
* Both dataPtr and dataType may be NULL, signifying that either
* value or type is not desired.
*
* @see emberAfReadClientAttribute, emberAfReadServerAttribute,
* emberAfReadManufacturerSpecificServerAttribute
*/
EmberAfStatus emberAfReadManufacturerSpecificClientAttribute(chip::EndpointId endpoint, chip::ClusterId cluster,
chip::AttributeId attributeID, uint16_t manufacturerCode,
uint8_t * dataPtr, uint16_t readLength);

/**
* @brief this function returns the size of the ZCL data in bytes.
*
Expand Down
Loading

0 comments on commit 1049596

Please sign in to comment.