Skip to content

Commit 42bb75c

Browse files
authored
[Python] Fix OnRead[Event|Attribute]DataCallback for Arm64 Apple Patform devices (#33178)
On M1/Arm64 macOS systems, the OnReadEventDataCallback often returned an invalid status, e.g.: ValueError: 16 is not a valid Status Use size_t consistently to fix this issue.
1 parent 5e2bf15 commit 42bb75c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/controller/python/chip/clusters/attribute.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,10 @@ struct __attribute__((packed)) DataVersionFilter
7171
using OnReadAttributeDataCallback = void (*)(PyObject * appContext, chip::DataVersion version, chip::EndpointId endpointId,
7272
chip::ClusterId clusterId, chip::AttributeId attributeId,
7373
std::underlying_type_t<Protocols::InteractionModel::Status> imstatus, uint8_t * data,
74-
uint32_t dataLen);
74+
size_t dataLen);
7575
using OnReadEventDataCallback = void (*)(PyObject * appContext, chip::EndpointId endpointId, chip::ClusterId clusterId,
7676
chip::EventId eventId, chip::EventNumber eventNumber, uint8_t priority, uint64_t timestamp,
77-
uint8_t timestampType, uint8_t * data, uint32_t dataLen,
77+
uint8_t timestampType, uint8_t * data, size_t dataLen,
7878
std::underlying_type_t<Protocols::InteractionModel::Status> imstatus);
7979
using OnSubscriptionEstablishedCallback = void (*)(PyObject * appContext, SubscriptionId subscriptionId);
8080
using OnResubscriptionAttemptedCallback = void (*)(PyObject * appContext, PyChipError aTerminationCause,
@@ -114,7 +114,7 @@ class ReadClientCallback : public ReadClient::Callback
114114
VerifyOrDie(!aPath.IsListItemOperation());
115115
size_t bufferLen = (apData == nullptr ? 0 : apData->GetRemainingLength() + apData->GetLengthRead());
116116
std::unique_ptr<uint8_t[]> buffer = std::unique_ptr<uint8_t[]>(apData == nullptr ? nullptr : new uint8_t[bufferLen]);
117-
uint32_t size = 0;
117+
size_t size = 0;
118118
// When the apData is nullptr, means we did not receive a valid attribute data from server, status will be some error
119119
// status.
120120
if (apData != nullptr)
@@ -166,7 +166,7 @@ class ReadClientCallback : public ReadClient::Callback
166166
void OnEventData(const EventHeader & aEventHeader, TLV::TLVReader * apData, const StatusIB * apStatus) override
167167
{
168168
uint8_t buffer[CHIP_CONFIG_DEFAULT_UDP_MTU_SIZE];
169-
uint32_t size = 0;
169+
size_t size = 0;
170170
CHIP_ERROR err = CHIP_NO_ERROR;
171171
// When the apData is nullptr, means we did not receive a valid event data from server, status will be some error
172172
// status.

0 commit comments

Comments
 (0)