Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Silabs] Added additonal advertising data for 917 SoC #38052

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/platform/silabs/BLEManagerImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class BLEManagerImpl final : public BLEManager, private BleLayer, private BlePla

#if CHIP_ENABLE_ADDITIONAL_DATA_ADVERTISING
#if (SLI_SI91X_ENABLE_BLE || RSI_BLE_ENABLE)
static void HandleC3ReadRequest(SilabsBleWrapper::sl_wfx_msg_t * rsi_ble_read_req);
static void HandleC3ReadRequest(const SilabsBleWrapper::sl_wfx_msg_t & rsi_ble_read_req);
#else
#if CHIP_ENABLE_ADDITIONAL_DATA_ADVERTISING
static void HandleC3ReadRequest(volatile sl_bt_msg_t * evt);
Expand Down
1 change: 1 addition & 0 deletions src/platform/silabs/efr32/BLEManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -949,6 +949,7 @@ CHIP_ERROR BLEManagerImpl::EncodeAdditionalDataTlv()

err = AdditionalDataPayloadGenerator().generateAdditionalDataPayload(additionalDataPayloadParams, c3AdditionalDataBufferHandle,
additionalDataFields);
SuccessOrExit(err);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are we adding this here? we are already at the exit

Suggested change
SuccessOrExit(err);


exit:
if (err != CHIP_NO_ERROR)
Expand Down
28 changes: 25 additions & 3 deletions src/platform/silabs/rs911x/BLEManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,28 @@ void rsi_ble_add_matter_service(void)
RSI_BLE_ATT_PROPERTY_READ | RSI_BLE_ATT_PROPERTY_NOTIFY |
RSI_BLE_ATT_PROPERTY_INDICATE, // Set read, write, write without response
data, sizeof(data), ATT_REC_MAINTAIN_IN_HOST);
#ifdef CHIP_ENABLE_ADDITIONAL_DATA_ADVERTISING
constexpr uuid_t custom_characteristic_C3 = { .size = RSI_BLE_CUSTOM_CHARACTERISTIC_C3_SIZE,
.reserved = { RSI_BLE_CUSTOM_CHARACTERISTIC_C3_RESERVED },
.val = { .val128 = {
.data1 = RSI_BLE_CUSTOM_CHARACTERISTIC_C3_VALUE_128_DATA_1,
.data2 = RSI_BLE_CUSTOM_CHARACTERISTIC_C3_VALUE_128_DATA_2,
.data3 = RSI_BLE_CUSTOM_CHARACTERISTIC_C3_VALUE_128_DATA_3,
.data4 = { RSI_BLE_CUSTOM_CHARACTERISTIC_C3_VALUE_128_DATA_4 } } } };

// Adding custom characteristic declaration to the custom service
SilabsBleWrapper::rsi_ble_add_char_serv_att(
new_serv_resp.serv_handler, new_serv_resp.start_handle + RSI_BLE_CHARACTERISTIC_C3_ATTRIBUTE_HANDLE_LOCATION,
RSI_BLE_ATT_PROPERTY_READ, // Set read
new_serv_resp.start_handle + RSI_BLE_CHARACTERISTIC_C3_MEASUREMENT_HANDLE_LOCATION, custom_characteristic_C3);

// Adding characteristic value attribute to the service
SilabsBleWrapper::rsi_ble_add_char_val_att(new_serv_resp.serv_handler,
new_serv_resp.start_handle + RSI_BLE_CHARACTERISTIC_C3_MEASUREMENT_HANDLE_LOCATION,
custom_characteristic_C3,
RSI_BLE_ATT_PROPERTY_READ, // Set read
data, sizeof(data), ATT_REC_IN_HOST);
#endif // CHIP_ENABLE_ADDITIONAL_DATA_ADVERTISING
}

} // namespace
Expand Down Expand Up @@ -1028,9 +1050,9 @@ CHIP_ERROR BLEManagerImpl::EncodeAdditionalDataTlv()
additionalDataFields.Set(AdditionalDataFields::RotatingDeviceId);
#endif /* CHIP_ENABLE_ROTATING_DEVICE_ID && defined(CHIP_DEVICE_CONFIG_ROTATING_DEVICE_ID_UNIQUE_ID) */

err = AdditionalDataPayloadGenerator().generateAdditionalDataPayload(additionalDataPayloadParams, c3AdditionalDataBufferHandle,
additionalDataFields);

err = AdditionalDataPayloadGenerator().generateAdditionalDataPayload(
additionalDataPayloadParams, sInstance.c3AdditionalDataBufferHandle, additionalDataFields);
SuccessOrExit(err);
exit:
if (err != CHIP_NO_ERROR)
{
Expand Down
11 changes: 11 additions & 0 deletions src/platform/silabs/rs911x/wfx_sl_ble_init.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,17 @@ extern "C" {
#define RSI_BLE_CHARACTERISTIC_TX_MEASUREMENT_HANDLE_LOCATION (4)
#define RSI_BLE_CHARACTERISTIC_TX_GATT_SERVER_CLIENT_HANDLE_LOCATION (5)

#ifdef CHIP_ENABLE_ADDITIONAL_DATA_ADVERTISING
#define RSI_BLE_CUSTOM_CHARACTERISTIC_C3_SIZE (16)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what does this size of 16 represent? Is this the data length C3 should 512.

#define RSI_BLE_CUSTOM_CHARACTERISTIC_C3_RESERVED 0x00, 0x00, 0x00
#define RSI_BLE_CUSTOM_CHARACTERISTIC_C3_VALUE_128_DATA_1 0x64630238
#define RSI_BLE_CUSTOM_CHARACTERISTIC_C3_VALUE_128_DATA_2 0x8772
#define RSI_BLE_CUSTOM_CHARACTERISTIC_C3_VALUE_128_DATA_3 0x45f2
#define RSI_BLE_CUSTOM_CHARACTERISTIC_C3_VALUE_128_DATA_4 0x7D, 0xB8, 0x8A, 0x74, 0x04, 0x8F, 0x21, 0x83
Comment on lines +77 to +80
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be good to clarify that this is the UUID either by renaming the define or with comments.
Also, why is the format different for data4 than the other data{1..3}.

#define RSI_BLE_CHARACTERISTIC_C3_ATTRIBUTE_HANDLE_LOCATION (6)
#define RSI_BLE_CHARACTERISTIC_C3_MEASUREMENT_HANDLE_LOCATION (7)
#define RSI_BLE_CHARACTERISTIC_C3_GATT_SERVER_CLIENT_HANDLE_LOCATION (8)
#endif
namespace chip {
namespace DeviceLayer {
namespace Internal {
Expand Down
Loading