diff --git a/.gitignore b/.gitignore index 3bd6c2b5aca339..d572189d64957a 100644 --- a/.gitignore +++ b/.gitignore @@ -28,7 +28,7 @@ third_party/nlio/ third_party/nlunit-test/ third_party/mbedtls/ examples/common/m5stack-tft/ -examples/common/QRCode/repo +examples/common/QRCode/repo/ # Example specific rules examples/**/sdkconfig @@ -40,7 +40,7 @@ src/test_driver/esp32/build # Temporary Directories .tmp/ -# Xcode +# Xcode, other development environment stuff *.pbxuser *.mode1v3 *.mode2v3 @@ -50,3 +50,4 @@ project.xcworkspace/ xcuserdata/ *.xcodeproj/* *.xcworkspace/* +TAGS diff --git a/examples/wifi-echo/server/esp32/main/DataModelHandler.cpp b/examples/wifi-echo/server/esp32/main/DataModelHandler.cpp index d601908505d2d9..94540fe8302222 100644 --- a/examples/wifi-echo/server/esp32/main/DataModelHandler.cpp +++ b/examples/wifi-echo/server/esp32/main/DataModelHandler.cpp @@ -45,7 +45,7 @@ void InitDataModelHandler() void HandleDataModelMessage(System::PacketBuffer * buffer) { - ChipZclStatus_t zclStatus = chipZclProcessIncoming(buffer->Start(), buffer->DataLength()); + ChipZclStatus_t zclStatus = chipZclProcessIncoming((ChipZclBuffer_t *) buffer); if (zclStatus == CHIP_ZCL_STATUS_SUCCESS) { ESP_LOGI(TAG, "Data model processing success!"); diff --git a/scripts/examples/esp_echo_app.sh b/scripts/examples/esp_echo_app.sh index 4ba482cd611555..3b2e15b43acd36 100755 --- a/scripts/examples/esp_echo_app.sh +++ b/scripts/examples/esp_echo_app.sh @@ -2,5 +2,5 @@ make -f Makefile-bootstrap repos source examples/wifi-echo/server/esp32/idf.sh -idf make -C examples/wifi-echo/server/esp32 defconfig -idf make -C examples/wifi-echo/server/esp32 +idf make V=1 -C examples/wifi-echo/server/esp32 defconfig +idf make V=1 -C examples/wifi-echo/server/esp32 diff --git a/src/app/DataModel.am b/src/app/DataModel.am index cd239c9b1ad381..a47712372857c0 100644 --- a/src/app/DataModel.am +++ b/src/app/DataModel.am @@ -29,7 +29,7 @@ CHIP_BUILD_DATA_MODEL_SOURCE_FILES @top_builddir@/src/app/gen/gen-command-handler.c \ @top_builddir@/src/app/gen/gen-global-command-handler.c \ @top_builddir@/src/app/gen/gen-specs.c \ - @top_builddir@/src/app/plugin/binding-mock/mock.c \ + @top_builddir@/src/app/plugin/binding-chip/chip.cpp \ @top_builddir@/src/app/plugin/cluster-server-basic/basic-server.c \ @top_builddir@/src/app/plugin/cluster-server-identify/identify-server.c \ @top_builddir@/src/app/plugin/cluster-server-level-control/level-control-server.c \ diff --git a/src/app/Makefile.am b/src/app/Makefile.am index c764211a6670ec..2dc0aadd146a59 100644 --- a/src/app/Makefile.am +++ b/src/app/Makefile.am @@ -36,6 +36,8 @@ lib_LIBRARIES = libCHIPDataModel.a libCHIPDataModel_a_CPPFLAGS = \ -I$(top_srcdir)/src/app/chip-zcl \ -I$(top_srcdir)/src/app/gen \ + -I$(top_srcdir)/src \ + -I$(top_srcdir)/src/lib \ $(NULL) libCHIPDataModel_a_SOURCES = $(CHIP_BUILD_DATA_MODEL_SOURCE_FILES) diff --git a/src/app/chip-zcl/chip-zcl-buffer.h b/src/app/chip-zcl/chip-zcl-buffer.h index c5c81ad5be6fe8..7b41493f45196d 100644 --- a/src/app/chip-zcl/chip-zcl-buffer.h +++ b/src/app/chip-zcl/chip-zcl-buffer.h @@ -26,6 +26,10 @@ #include +#ifdef __cplusplus +extern "C" { +#endif /* #ifdef __cplusplus */ + /** * Structure that describes the buffers passed between the CHIP layers and * the Zap layer. @@ -37,24 +41,7 @@ * from, currentPosition represents the current read position and dataLength is * the total length of the data that can be read. */ -typedef struct -{ - /** - * The data storage for our buffer. - */ - uint8_t * buffer; - - /** - * The size of our buffer above. - */ - uint16_t bufferLength; - - /** - * The length of the data that can be read from this buffer; nonzero only - * when it's ready to be read from. - */ - uint16_t dataLength; -} ChipZclBuffer_t; +typedef struct ChipZclBuffer_t ChipZclBuffer_t; /** * Function that allocates a buffer. @@ -82,14 +69,6 @@ uint8_t * chipZclBufferPointer(ChipZclBuffer_t * buffer); */ void chipZclBufferFree(ChipZclBuffer_t * buffer); -/** - * Function that resets a buffer to have its entire allocated length - * available for writing. - * - * @param[in] buffer the buffer to reset. - */ -void chipZclBufferReset(ChipZclBuffer_t * buffer); - /** * Function that returns the size of the used portion of the buffer, in octets, * when the buffer is ready for reading. Always returns 0 for buffers that are @@ -117,4 +96,7 @@ void chipZclBufferSetDataLength(ChipZclBuffer_t * buffer, uint16_t newLength); */ uint16_t chipZclBufferAvailableLength(ChipZclBuffer_t * buffer); +#ifdef __cplusplus +} +#endif /* #ifdef __cplusplus */ #endif // CHIP_ZCL_BUFFER diff --git a/src/app/chip-zcl/chip-zcl-codec.h b/src/app/chip-zcl/chip-zcl-codec.h index 6020efc5773d54..0f5d0c34dcc761 100644 --- a/src/app/chip-zcl/chip-zcl-codec.h +++ b/src/app/chip-zcl/chip-zcl-codec.h @@ -31,6 +31,10 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif /* #ifdef __cplusplus */ + /** * Codec keeps track of an ongoing encode/decode session of a Buffer */ @@ -84,4 +88,8 @@ ChipZclStatus_t chipZclCodecDecode(ChipZclCodec_t * codec, ChipZclType_t type, v */ ChipZclStatus_t chipZclCodecDecodeEnd(ChipZclCodec_t * me); +#ifdef __cplusplus +} +#endif /* #ifdef __cplusplus */ + #endif // CHIP_ZCL_CODEC diff --git a/src/app/chip-zcl/chip-zcl-struct.h b/src/app/chip-zcl/chip-zcl-struct.h index 620138f53c446f..588afe6d488d81 100644 --- a/src/app/chip-zcl/chip-zcl-struct.h +++ b/src/app/chip-zcl/chip-zcl-struct.h @@ -28,6 +28,10 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif /* #ifdef __cplusplus */ + /** * Base types for the codec. This is a smaller subset than the actual ZCL types, and the * generated layer for a specific code is responsible for mapping ZCL types onto these @@ -250,4 +254,7 @@ void chipZclStoreInt32uValue(uint8_t * valueLoc, uint32_t value, uint8_t valueSi /** @} end addtogroup */ +#ifdef __cplusplus +} +#endif /* #ifdef __cplusplus */ #endif // CHIP_ZCL_STRUCT diff --git a/src/app/chip-zcl/chip-zcl.h b/src/app/chip-zcl/chip-zcl.h index 055912a7a480a5..6ac62570a37aca 100644 --- a/src/app/chip-zcl/chip-zcl.h +++ b/src/app/chip-zcl/chip-zcl.h @@ -24,12 +24,16 @@ #ifndef CHIP_ZCL_MASTER_HEADER #define CHIP_ZCL_MASTER_HEADER +#include "chip-zcl-buffer.h" + #include #include #include #include -#include "chip-zcl-buffer.h" +#ifdef __cplusplus +extern "C" { +#endif /* #ifdef __cplusplus */ typedef uint64_t bitmap64_t; typedef uint8_t enum8_t; @@ -833,6 +837,7 @@ typedef struct void chipZclEventSetDelayMs(Event * event, uint32_t delay); void chEventControlSetDelayMS(ChipZclEventControl * event, uint32_t delay); + /** @brief Sets this ::EmberEventControl to run "delay" milliseconds in the future. * NOTE: To avoid rollover errors in event calculation, the delay must be * less than ::EMBER_MAX_EVENT_CONTROL_DELAY_MS. @@ -976,15 +981,6 @@ void chipZclEventSetDelayMs(Event * event, uint32_t delay); // Endpoint Management ChipZclEndpointId_t chipZclEndpointIndexToId(ChipZclEndpointIndex_t index, const ChipZclClusterSpec_t * clusterSpec); -// Some platform CHIP_ZCL_STATUS_INSUFFICIENT_SPACE -#define MEMSET(d, v, l) memset(d, v, l) -#define MEMCOPY(d, s, l) memcpy(d, s, l) -#define MEMMOVE(d, s, l) memmove(d, s, l) -#define MEMCOMPARE(s0, s1, l) memcmp(s0, s1, l) -#define MEMPGMCOMPARE(s0, s1, l) memcmp(s0, s1, l) -#define LOW_BYTE(n) ((uint8_t)((n) &0xFF)) -#define HIGH_BYTE(n) ((uint8_t)(LOW_BYTE((n) >> 8))) -#define IS_BIG_ENDIAN() false /** * @brief Returns the value built from the two \c uint8_t * values \c high and \c low. @@ -1113,6 +1109,9 @@ void chipZclEncodeZclHeader(ChipZclBuffer_t * buffer, ChipZclCommandContext_t * */ void chipZclDecodeZclHeader(ChipZclBuffer_t * buffer, ChipZclCommandContext_t * context); -ChipZclStatus_t chipZclProcessIncoming(uint8_t * buffer, uint16_t bufferLength); +ChipZclStatus_t chipZclProcessIncoming(ChipZclBuffer_t * buffer); +#ifdef __cplusplus +} +#endif /* #ifdef __cplusplus */ #endif // CHIP_ZCL_MASTER_HEADER diff --git a/src/app/plugin/binding-chip/chip.cpp b/src/app/plugin/binding-chip/chip.cpp new file mode 100644 index 00000000000000..ca875961a51e99 --- /dev/null +++ b/src/app/plugin/binding-chip/chip.cpp @@ -0,0 +1,150 @@ +/** + * + * Copyright (c) 2020 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file + * This file provides the CHIP implementation of functions required + * by the CHIP ZCL Application Layer + * + */ + +#include "chip-zcl.h" + +#include +#include + +#include + +void chipZclCorePrintln(const char * formatString, ...) +{ + va_list args; + va_start(args, formatString); + chip::Logging::LogV(chip::Logging::kLogModule_Zcl, chip::Logging::kLogCategory_Detail, formatString, args); + va_end(args); +} + +// Default Response Stubs +ChipZclStatus_t chipZclSendDefaultResponse(const ChipZclCommandContext_t * context, ChipZclStatus_t status) +{ + return CHIP_ZCL_STATUS_SUCCESS; +} + +// Reporting Configuration Stubs +void chipZclReportingConfigurationsFactoryReset(ChipZclEndpointId_t endpointId) +{ + return; +} + +// Endpoint Management Stubs +ChipZclEndpointId_t chipZclEndpointIndexToId(ChipZclEndpointIndex_t index, const ChipZclClusterSpec_t * clusterSpec) +{ + return CHIP_ZCL_ENDPOINT_NULL; +} + +// Attribute Management Stubs +void chipZclResetAttributes(ChipZclEndpointId_t endpointId) +{ + return; +} + +// Event Management Stubs +EventQueue emAppEventQueue; + +Event * chipZclEventFind(EventQueue * queue, EventActions * actions, EventPredicate predicate, void * data, bool all) +{ + return 0; +} + +void chEventControlSetDelayMS(ChipZclEventControl * event, uint32_t delay) +{ + return; +} + +void chipZclEventSetDelayMs(Event * event, uint32_t delay) +{ + return; +} + +int32_t chipZclCompareClusterSpec(const ChipZclClusterSpec_t * s1, const ChipZclClusterSpec_t * s2) +{ + return 0; +} + +bool chipZclAreClusterSpecsEqual(const ChipZclClusterSpec_t * s1, const ChipZclClusterSpec_t * s2) +{ + return 0; +} + +void chipZclReverseClusterSpec(const ChipZclClusterSpec_t * s1, ChipZclClusterSpec_t * s2) +{ + return; +} + +/** + * ChipZclBuffer_t is merely a type alias + */ +struct ChipZclBuffer_t : public chip::System::PacketBuffer +{ +}; + +/** + * Function that allocates a buffer. + */ +ChipZclBuffer_t * chipZclBufferAlloc(uint16_t allocatedLength) +{ + return static_cast(chip::System::PacketBuffer::NewWithAvailableSize(allocatedLength)); +} + +/** + * Function that frees a buffer and its storage. + */ +void chipZclBufferFree(ChipZclBuffer_t * buffer) +{ + chip::System::PacketBuffer::Free(buffer); +} + +/** + * Function that returns a pointer to the raw buffer. + */ +uint8_t * chipZclBufferPointer(ChipZclBuffer_t * buffer) +{ + return buffer->Start(); +} + +/** + * Function that returns the size of the used portion of the buffer. + */ +uint16_t chipZclBufferDataLength(ChipZclBuffer_t * buffer) +{ + return buffer->DataLength(); +} + +/** + * returns space available for writing after any data already in the buffer + */ +uint16_t chipZclBufferAvailableLength(ChipZclBuffer_t * buffer) +{ + return buffer->AvailableDataLength(); +} + +/** + * sets data length for a buffer that's being written to + */ +void chipZclBufferSetDataLength(ChipZclBuffer_t * buffer, uint16_t newLength) +{ + buffer->SetDataLength(newLength); +} diff --git a/src/app/plugin/binding-mock/mock.c b/src/app/plugin/binding-mock/mock.c index 06e371b44c5c0c..aa5f4c8fee8830 100644 --- a/src/app/plugin/binding-mock/mock.c +++ b/src/app/plugin/binding-mock/mock.c @@ -95,6 +95,25 @@ void chipZclReverseClusterSpec(const ChipZclClusterSpec_t * s1, ChipZclClusterSp return; } +struct ChipZclBuffer_t +{ + /** + * The data storage for our buffer. + */ + void * buffer; + + /** + * The size of our buffer above. + */ + uint16_t bufferLength; + + /** + * The length of the data that can be read from this buffer; nonzero only + * when it's ready to be read from. + */ + uint16_t dataLength; +}; + /** * Function that allocates a buffer. */ @@ -103,7 +122,7 @@ ChipZclBuffer_t * chipZclBufferAlloc(uint16_t allocatedLength) ChipZclBuffer_t * buffer = (ChipZclBuffer_t *) malloc(sizeof(ChipZclBuffer_t) + allocatedLength); if (NULL != buffer) { - buffer->buffer = (uint8_t *) (buffer + 1); + buffer->buffer = (buffer + 1); buffer->dataLength = 0; buffer->bufferLength = allocatedLength; } @@ -117,3 +136,35 @@ void chipZclBufferFree(ChipZclBuffer_t * buffer) { free(buffer); } + +/** + * Function that returns a pointer to the raw buffer. + */ +uint8_t * chipZclBufferPointer(ChipZclBuffer_t * buffer) +{ + return buffer->buffer; +} + +/** + * Function that returns the size of the used portion of the buffer. + */ +uint16_t chipZclBufferDataLength(ChipZclBuffer_t * buffer) +{ + return buffer->dataLength; +} + +/** + * returns space available for writing after any data already in the buffer + */ +uint16_t chipZclBufferAvailableLength(ChipZclBuffer_t * buffer) +{ + return buffer->bufferLength - buffer->dataLength; +} + +/** + * sets data length for a buffer that's being written to + */ +void chipZclBufferSetDataLength(ChipZclBuffer_t * buffer, uint16_t newLength) +{ + buffer->dataLength = newLength; +} diff --git a/src/app/plugin/core-api/core-api.c b/src/app/plugin/core-api/core-api.c index e89a1001a4d70f..d8373b32b41cf7 100644 --- a/src/app/plugin/core-api/core-api.c +++ b/src/app/plugin/core-api/core-api.c @@ -21,50 +21,11 @@ ChipZclStatus_t chipZclClusterCommandParse(ChipZclCommandContext_t * context); -ChipZclStatus_t chipZclProcessIncoming(uint8_t * rawBuffer, uint16_t rawBufferLength) +ChipZclStatus_t chipZclProcessIncoming(ChipZclBuffer_t * message) { - ChipZclBuffer_t buffer = { rawBuffer, rawBufferLength, rawBufferLength }; - ChipZclCommandContext_t context = { 0 }; - chipZclDecodeZclHeader(&buffer, &context); + chipZclDecodeZclHeader(message, &context); return chipZclClusterCommandParse(&context); } - -/** - * Function that returns a pointer to the raw buffer. - */ -uint8_t * chipZclBufferPointer(ChipZclBuffer_t * buffer) -{ - return buffer->buffer; -} - -/** - * Function that returns the size of the used portion of the buffer. - */ -uint16_t chipZclBufferDataLength(ChipZclBuffer_t * buffer) -{ - return buffer->dataLength; -} - -/** - * returns space available for writing after any data already in the buffer - */ -uint16_t chipZclBufferAvailableLength(ChipZclBuffer_t * buffer) -{ - return buffer->bufferLength - buffer->dataLength; -} - -/** - * sets data length for a buffer that's being written to - */ -void chipZclBufferSetDataLength(ChipZclBuffer_t * buffer, uint16_t newLength) -{ - buffer->dataLength = newLength; -} - -void chipZclBufferReset(ChipZclBuffer_t * buffer) -{ - buffer->dataLength = 0; -} diff --git a/src/app/plugin/core-data-model/zcl-data-model.c b/src/app/plugin/core-data-model/zcl-data-model.c index 00d4fdfeeefdb0..3889f11ec96457 100644 --- a/src/app/plugin/core-data-model/zcl-data-model.c +++ b/src/app/plugin/core-data-model/zcl-data-model.c @@ -95,7 +95,7 @@ void chipZclCopyString(uint8_t * dest, uint8_t * src, uint8_t size) { length = size; } - MEMMOVE(dest + 1, src + 1, length); + memmove(dest + 1, src + 1, length); dest[0] = length; } } @@ -133,11 +133,20 @@ void chipZclCopyLongString(uint8_t * dest, uint8_t * src, uint16_t size) { length = size; } - MEMMOVE(dest + 2, src + 2, length); - dest[0] = LOW_BYTE(length); - dest[1] = HIGH_BYTE(length); + memmove(dest + 2, src + 2, length); + dest[0] = (uint8_t)(length & 0xFF); // LOW_BYTE(length); + dest[1] = (uint8_t)((length >> 8) & 0xff); // HIGH_BYTE(length); } } + +#if defined(__LITTLE_ENDIAN) || defined(__LITTLE_ENDIAN__) || (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) +#define BIGENDIAN_CPU 0 +#elif defined(__BIG_ENDIAN) || defined(__BIG_ENDIAN__) || (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__) +#define BIGENDIAN_CPU 1 +#else +#error "cannot determine whether BIGENDIAN_CPU or not" +#endif + // You can pass in val1 as NULL, which will assume that it is // pointing to an array of all zeroes. This is used so that // default value of NULL is treated as all zeroes. @@ -154,10 +163,10 @@ int8_t chipZclCompareValues(uint8_t * val1, uint8_t * val2, uint8_t len, bool si for (i = 0; i < len; i++) { - j = (val1 == NULL ? 0 : (IS_BIG_ENDIAN() ? val1[i] : val1[(len - 1) - i])); + j = (val1 == NULL ? 0 : (BIGENDIAN_CPU ? val1[i] : val1[(len - 1) - i])); accum1 |= j << (8 * (len - 1 - i)); - k = (IS_BIG_ENDIAN() ? val2[i] : val2[(len - 1) - i]); + k = (BIGENDIAN_CPU ? val2[i] : val2[(len - 1) - i]); accum2 |= k << (8 * (len - 1 - i)); } @@ -196,8 +205,8 @@ int8_t chipZclCompareValues(uint8_t * val1, uint8_t * val2, uint8_t len, bool si { // regular unsigned number comparison for (i = 0; i < len; i++) { - j = (val1 == NULL ? 0 : (IS_BIG_ENDIAN() ? val1[i] : val1[(len - 1) - i])); - k = (IS_BIG_ENDIAN() ? val2[i] : val2[(len - 1) - i]); + j = (val1 == NULL ? 0 : (BIGENDIAN_CPU ? val1[i] : val1[(len - 1) - i])); + k = (BIGENDIAN_CPU ? val2[i] : val2[(len - 1) - i]); if (j > k) { @@ -256,11 +265,11 @@ static ChipZclStatus_t chipZclTypeSensitiveMemCopy(uint8_t * dest, uint8_t * src } if (src == NULL) { - MEMSET(dest, 0, size); + memset(dest, 0, size); } else { - MEMMOVE(dest, src, size); + memmove(dest, src, size); } } return CHIP_ZCL_STATUS_SUCCESS; @@ -573,7 +582,7 @@ static ChipZclStatus_t chipZclInternalWriteAttribute(ChipZclEndpointId_t endpoin uint8_t * minI = (uint8_t *) &(minv.defaultValue); uint8_t * maxI = (uint8_t *) &(maxv.defaultValue); // On big endian cpu with length 1 only the second byte counts -#if (BIGENDIAN_CPU) +#if BIGENDIAN_CPU if (dataLen == 1) { minI++; @@ -700,12 +709,12 @@ void chipZclEndpointInit(void) { uint8_t ep; - uint8_t fixedEndpoints[] = FIXED_ENDPOINT_ARRAY; - uint16_t fixedProfileIds[] = FIXED_PROFILE_IDS; - uint16_t fixedDeviceIds[] = FIXED_DEVICE_IDS; - uint8_t fixedDeviceVersions[] = FIXED_DEVICE_VERSIONS; - uint8_t fixedChipZclEndpointTypes[] = FIXED_ENDPOINT_TYPES; - uint8_t fixedNetworks[] = FIXED_NETWORKS; + static const uint8_t fixedEndpoints[] = FIXED_ENDPOINT_ARRAY; + static const uint16_t fixedProfileIds[] = FIXED_PROFILE_IDS; + static const uint16_t fixedDeviceIds[] = FIXED_DEVICE_IDS; + static const uint8_t fixedDeviceVersions[] = FIXED_DEVICE_VERSIONS; + static const uint8_t fixedChipZclEndpointTypes[] = FIXED_ENDPOINT_TYPES; + static const uint8_t fixedNetworks[] = FIXED_NETWORKS; chipZclEndpointCounter = FIXED_ENDPOINT_COUNT; for (ep = 0; ep < FIXED_ENDPOINT_COUNT; ep++) diff --git a/src/app/plugin/tests/cluster-cmd-on-off-test.c b/src/app/plugin/tests/cluster-cmd-on-off-test.c index c9791633bbcec1..c3e41743d042cb 100644 --- a/src/app/plugin/tests/cluster-cmd-on-off-test.c +++ b/src/app/plugin/tests/cluster-cmd-on-off-test.c @@ -99,11 +99,9 @@ int testClusterCmdOnOff(void) return 1; } - uint8_t * rawBuffer = chipZclBufferPointer(buffer); - uint16_t bufferLength = chipZclBufferDataLength(buffer); bool onOff; - printf("Buffer for processing is ready, length: %d\n", bufferLength); + printf("Buffer for processing is ready, length: %d\n", chipZclBufferDataLength(buffer)); // Make sure initial value of the attribute is false. status = chipZclReadAttribute(1, &chipZclClusterOnOffServerSpec, CHIP_ZCL_CLUSTER_ON_OFF_SERVER_ATTRIBUTE_ON_OFF, &onOff, @@ -116,7 +114,7 @@ int testClusterCmdOnOff(void) // At this point, we have a buffer encoded with the command context that contains the command. // So we will be testing top-level entry API. - status = chipZclProcessIncoming(rawBuffer, bufferLength); + status = chipZclProcessIncoming(buffer); if (status == CHIP_ZCL_STATUS_SUCCESS) {