Skip to content

Commit

Permalink
nimble/bttester: Make adv parameters global & small fixes
Browse files Browse the repository at this point in the history
This commit makes advertising parameters global for in BAP test app.
MYNEWT_VAL is corrected in multiple places for an up-to-date name.
Missing semicolon and invalid function name are fixed in btp_bap.c
  • Loading branch information
szymon-czapracki committed Apr 8, 2024
1 parent e56389a commit 93a76d7
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 29 deletions.
4 changes: 2 additions & 2 deletions apps/bttester/src/btp/bttester.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,12 @@ gatt_svr_register_cb(struct ble_gatt_register_ctxt *ctxt, void *arg);
int
gatt_svr_init(void);

#if MYNEWT_VAL(BLE_ISO_BROADCASTER)
#if MYNEWT_VAL(BLE_ISO_BROADCAST_SOURCE)
uint8_t
tester_init_bap(void);
uint8_t
tester_unregister_bap(void);
#endif /* MYNEWT_VAL(BLE_ISO_BROADCASTER) */
#endif /* MYNEWT_VAL(BLE_ISO_BROADCAST_SOURCE) */

#endif /* __BTTESTER_H__ */

43 changes: 20 additions & 23 deletions apps/bttester/src/btp_bap.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

#include "syscfg/syscfg.h"

#if MYNEWT_VAL(BLE_ISO_BROADCASTER)
#if MYNEWT_VAL(BLE_ISO_BROADCAST_SOURCE)

#include "btp/btp_bap.h"

Expand All @@ -38,9 +38,6 @@
#include "audio/ble_audio.h"
#include "host/ble_iso.h"

#include "bsp/bsp.h"


#define BROADCAST_ADV_INSTANCE 1

static struct ble_audio_big_subgroup big_subgroup;
Expand Down Expand Up @@ -71,6 +68,22 @@ struct ble_iso_big_params big_params;

static int audio_data_offset;

struct ble_gap_periodic_adv_params periodic_params = {
.itvl_min = 30,
.itvl_max = 30,
};

struct ble_gap_ext_adv_params extended_params = {
.itvl_min = 50,
.itvl_max = 50,
.scannable = 0,
.connectable = 0,
.primary_phy = BLE_HCI_LE_PHY_1M,
.secondary_phy = BLE_HCI_LE_PHY_2M,
.own_addr_type = 0,
.sid = BROADCAST_ADV_INSTANCE,
};

static void
audio_broadcast_event_cb(struct os_event *ev)
{
Expand Down Expand Up @@ -173,15 +186,15 @@ base_create(const struct bap_broadcast_source_setup_cmd *cmd)

big_subgroup.codec_spec_config_len = sizeof(codec_spec_config);

big_subgroup.codec_spec_config_len = os_memblock_get(&codec_spec_pool);
big_subgroup.codec_spec_config = os_memblock_get(&codec_spec_pool);

memcpy(big_subgroup.codec_spec_config,
codec_spec_config,
sizeof(codec_spec_config));

bis = os_memblock_get(&bis_pool);
if (!bis) {
return BLE_HS_ENOMEM
return BLE_HS_ENOMEM;
}

bis->codec_spec_config_len = 0;
Expand Down Expand Up @@ -221,22 +234,6 @@ broadcast_source_setup(const void *cmd, uint16_t cmd_len, void *rsp,

base_create(source_config);

struct ble_gap_periodic_adv_params periodic_params = {
.itvl_min = 30,
.itvl_max = 30,
};

struct ble_gap_ext_adv_params extended_params = {
.itvl_min = 50,
.itvl_max = 50,
.scannable = 0,
.connectable = 0,
.primary_phy = BLE_HCI_LE_PHY_1M,
.secondary_phy = BLE_HCI_LE_PHY_2M,
.own_addr_type = id_addr_type,
.sid = BROADCAST_ADV_INSTANCE,
};

big_params.sdu_interval = sdu_interval;
big_params.max_sdu = max_sdu;
big_params.max_transport_latency = 8;
Expand Down Expand Up @@ -422,5 +419,5 @@ tester_unregister_bap(void)
return BTP_STATUS_SUCCESS;
}

#endif /* MYNEWT_VAL(BLE_ISO_BROADCASTER) */
#endif /* MYNEWT_VAL(BLE_ISO_BROADCAST_SOURCE) */

8 changes: 4 additions & 4 deletions apps/bttester/src/btp_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,11 @@ register_service(const void *cmd, uint16_t cmd_len,
status = tester_init_mesh();
break;
#endif /* MYNEWT_VAL(BLE_MESH) */
#if MYNEWT_VAL(BLE_ISO_BROADCASTER)
#if MYNEWT_VAL(BLE_ISO_BROADCAST_SOURCE)
case BTP_SERVICE_ID_BAP:
status = tester_init_bap();
break;
#endif /* MYNEWT_VAL(BLE_ISO_BROADCASTER) */
#endif /* MYNEWT_VAL(BLE_ISO_BROADCAST_SOURCE) */
case BTP_SERVICE_ID_GATTC:
status = tester_init_gatt_cl();
break;
Expand Down Expand Up @@ -159,11 +159,11 @@ unregister_service(const void *cmd, uint16_t cmd_len,
case BTP_SERVICE_ID_GATTC:
status = tester_unregister_gatt_cl();
break;
#if MYNEWT_VAL(BLE_ISO_BROADCASTER)
#if MYNEWT_VAL(BLE_ISO_BROADCAST_SOURCE)
case BTP_SERVICE_ID_BAP:
status = tester_unregister_bap();
break;
#endif /* MYNEWT_VAL(BLE_ISO_BROADCASTER) */
#endif /* MYNEWT_VAL(BLE_ISO_BROADCAST_SOURCE) */
default:
status = BTP_STATUS_FAILED;
break;
Expand Down

0 comments on commit 93a76d7

Please sign in to comment.