Embassy
nrf-softdevice-s112

Crates

git

Versions

default

Flavors

pub unsafe fn sd_ble_gatts_sys_attr_set(
conn_handle: u16,
p_sys_attr_data: *const u8,
len: u16,
flags: u32
) -> u32
Expand description

@brief Update persistent system attribute information.

@details Supply information about persistent system attributes to the stack, previously obtained using @ref sd_ble_gatts_sys_attr_get. This call is only allowed for active connections, and is usually made immediately after a connection is established with an known bonded device, often as a response to a @ref BLE_GATTS_EVT_SYS_ATTR_MISSING.

      p_sysattrs may point directly to the application's stored copy of the system attributes
      obtained using @ref sd_ble_gatts_sys_attr_get.
      If the pointer is NULL, the system attribute info is initialized, assuming that
      the application does not have any previously saved system attribute data for this device.

@note The state of persistent system attributes is reset upon connection establishment and then remembered for its duration.

@note If this call returns with an error code different from @ref NRF_SUCCESS, the storage of persistent system attributes may have been completed only partially. This means that the state of the attribute table is undefined, and the application should either provide a new set of attributes using this same call or reset the SoftDevice to return to a known state.

@note When the @ref BLE_GATTS_SYS_ATTR_FLAG_SYS_SRVCS is used with this function, only the system attributes included in system services will be modified. @note When the @ref BLE_GATTS_SYS_ATTR_FLAG_USR_SRVCS is used with this function, only the system attributes included in user services will be modified.

@mscs @mmsc{@ref BLE_GATTS_HVX_SYS_ATTRS_MISSING_MSC} @mmsc{@ref BLE_GATTS_SYS_ATTRS_UNK_PEER_MSC} @mmsc{@ref BLE_GATTS_SYS_ATTRS_BONDED_PEER_MSC} @endmscs

@param[in] conn_handle Connection handle. @param[in] p_sys_attr_data Pointer to a saved copy of system attributes supplied to the stack, or NULL. @param[in] len Size of data pointed by p_sys_attr_data, in octets. @param[in] flags Optional additional flags, see @ref BLE_GATTS_SYS_ATTR_FLAGS

@retval ::NRF_SUCCESS Successfully set the system attribute information. @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle. @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. @retval ::NRF_ERROR_INVALID_STATE Invalid Connection State. @retval ::NRF_ERROR_INVALID_PARAM Invalid flags supplied. @retval ::NRF_ERROR_INVALID_DATA Invalid data supplied, the data should be exactly the same as retrieved with @ref sd_ble_gatts_sys_attr_get. @retval ::NRF_ERROR_NO_MEM Not enough memory to complete operation.