Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/issue_226_temp_2' i…
Browse files Browse the repository at this point in the history
…nto issue_226_temp_2
  • Loading branch information
austina-csa committed Dec 18, 2024
2 parents f361e51 + a83508a commit 66d76ff
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 7 deletions.
6 changes: 4 additions & 2 deletions examples/chef/nrfconnect/rpc.overlay
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ CONFIG_LOG_OUTPUT=y
# Increase zephyr tty rx buffer
CONFIG_CONSOLE_GETCHAR_BUFSIZE=128

# Increase BLE thread stack size
CONFIG_BT_RX_STACK_SIZE=2048
# Increase thread stack sizes
CONFIG_BT_RX_STACK_SIZE=4096
CONFIG_MAIN_STACK_SIZE=8092
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048

6 changes: 4 additions & 2 deletions examples/lighting-app/nrfconnect/rpc.overlay
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ CONFIG_LOG_OUTPUT=y
# Increase zephyr tty rx buffer
CONFIG_CONSOLE_GETCHAR_BUFSIZE=128

# Increase BLE thread stack size
CONFIG_BT_RX_STACK_SIZE=2048
# Increase thread stack sizes
CONFIG_BT_RX_STACK_SIZE=4096
CONFIG_MAIN_STACK_SIZE=8092
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048

9 changes: 8 additions & 1 deletion src/app/clusters/user-label-server/user-label-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,14 @@ CHIP_ERROR UserLabelAttrAccess::WriteLabelList(const ConcreteDataAttributePath &
ReturnErrorOnFailure(aDecoder.Decode(entry));
VerifyOrReturnError(IsValidLabelEntry(entry), CHIP_IM_GLOBAL_STATUS(ConstraintError));

return provider->AppendUserLabel(endpoint, entry);
// Append the single user label entry
CHIP_ERROR err = provider->AppendUserLabel(endpoint, entry);
if (err == CHIP_ERROR_NO_MEMORY)
{
return CHIP_IM_GLOBAL_STATUS(ResourceExhausted);
}

return err;
}

return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE;
Expand Down
4 changes: 2 additions & 2 deletions src/app/tests/suites/TestUserLabelClusterConstraints.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,5 +85,5 @@ tests:
]
response:
# When the cluster runs out of capacity to store these entries,
# we expect a FAILURE get returned.
error: FAILURE
# we expect a RESOURCE_EXHAUSTED get returned.
error: RESOURCE_EXHAUSTED
38 changes: 38 additions & 0 deletions src/include/platform/DeviceInfoProvider.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,46 @@ class DeviceInfoProvider
*/
void SetStorageDelegate(PersistentStorageDelegate * storage);

/**
* @brief Sets the user label list for a specified endpoint.
*
* Replaces the current user label list with a new list. If the new list is smaller
* than the existing one, excess labels are deleted to free up space.
*
* @param[in] endpoint The endpoint ID associated with the user label list.
* @param[in] labelList The new list of user labels to store.
*
* @return CHIP_NO_ERROR on success.
* @return CHIP_ERROR if an error occurs.
*/
CHIP_ERROR SetUserLabelList(EndpointId endpoint, const AttributeList<UserLabelType, kMaxUserLabelListLength> & labelList);

/**
* @brief Clears the user label list for a specified endpoint.
*
* Deletes all user labels associated with the given endpoint, resetting the list length to zero.
* If no previous list exists, this function has no effect.
*
* @param[in] endpoint The endpoint ID whose user label list will be cleared.
*
* @return CHIP_NO_ERROR on success or if no previous value exists.
* @return CHIP_ERROR if an error occurs during deletion.
*/
CHIP_ERROR ClearUserLabelList(EndpointId endpoint);

/**
* @brief Appends a user label to the user label list for a specified endpoint.
*
* Adds a new label to the end of the existing user label list. The list size must not
* exceed `kMaxUserLabelListLength`. If the list is full, the function returns an error.
*
* @param[in] endpoint The endpoint ID to which the user label will be added.
* @param[in] label The user label to append to the list.
*
* @return CHIP_NO_ERROR on success.
* @return CHIP_ERROR_NO_MEMORY if the list is already at its maximum size.
* @return CHIP_ERROR if an error occurs during storage.
*/
CHIP_ERROR AppendUserLabel(EndpointId endpoint, const UserLabelType & label);

// Iterators
Expand Down

0 comments on commit 66d76ff

Please sign in to comment.