Commit 4a77bdb4 authored by Mariusz Skamra's avatar Mariusz Skamra Committed by Carles Cufi
Browse files

tests: Bluetooth: tester: Add initial support for HAP



This adds initial support for Hearing Aid Profile BTP service commands.

Signed-off-by: default avatarMariusz Skamra <mariusz.skamra@codecoup.pl>
parent b79a3415
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -63,3 +63,7 @@ endif()
if(CONFIG_BT_MCC OR CONFIG_BT_MCS)
    target_sources(app PRIVATE src/btp_mcp.c)
endif()

if(CONFIG_BT_HAS)
    target_sources(app PRIVATE src/btp_hap.c)
endif()
+2 −0
Original line number Diff line number Diff line
@@ -90,6 +90,8 @@ CONFIG_BT_HAS=y
CONFIG_BT_HAS_PRESET_COUNT=6
CONFIG_BT_HAS_PRESET_NAME_DYNAMIC=y

CONFIG_BT_HAS_CLIENT=y

# CSIS
CONFIG_BT_CSIP_SET_MEMBER=y

+3 −1
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@
#include "btp_cas.h"
#include "btp_mcp.h"
#include "btp_mcs.h"
#include "btp_hap.h"

#define BTP_MTU 1024
#define BTP_DATA_MAX_SIZE (BTP_MTU - sizeof(struct btp_hdr))
@@ -63,8 +64,9 @@
#define BTP_SERVICE_ID_CAS	21
#define BTP_SERVICE_ID_MCP	22
#define BTP_SERVICE_ID_GMCS	23
#define BTP_SERVICE_ID_HAP	24

#define BTP_SERVICE_ID_MAX	BTP_SERVICE_ID_GMCS
#define BTP_SERVICE_ID_MAX	BTP_SERVICE_ID_HAP

#define BTP_STATUS_SUCCESS	0x00
#define BTP_STATUS_FAILED	0x01
+61 −0
Original line number Diff line number Diff line
/* btp_hap.h - Bluetooth tester headers */

/*
 * Copyright (c) 2023 Codecoup
 *
 * SPDX-License-Identifier: Apache-2.0
 */
#include <zephyr/types.h>

/* HAP commands */
#define BTP_HAP_READ_SUPPORTED_COMMANDS         0x01
struct btp_hap_read_supported_commands_rp {
	uint8_t data[0];
} __packed;

#define BTP_HAP_HA_OPT_PRESETS_SYNC             0x01
#define BTP_HAP_HA_OPT_PRESETS_INDEPENDENT      0x02
#define BTP_HAP_HA_OPT_PRESETS_DYNAMIC          0x04
#define BTP_HAP_HA_OPT_PRESETS_WRITABLE         0x08

#define BTP_HAP_HA_INIT                         0x02
struct btp_hap_ha_init_cmd {
	uint8_t type;
	uint16_t opts;
} __packed;

#define BTP_HAP_HARC_INIT                       0x03
#define BTP_HAP_HAUC_INIT                       0x04
#define BTP_HAP_IAC_INIT                        0x05

#define BTP_HAP_IAC_DISCOVER			0x06
struct btp_hap_iac_discover_cmd {
	bt_addr_le_t address;
} __packed;

#define BTP_HAP_IAC_SET_ALERT			0x07
struct btp_hap_iac_set_alert_cmd {
	bt_addr_le_t address;
	uint8_t alert;
} __packed;

#define BTP_HAP_HAUC_DISCOVER			0x08
struct btp_hap_hauc_discover_cmd {
	bt_addr_le_t address;
} __packed;

/* HAP events */
#define BT_HAP_EV_IAC_DISCOVERY_COMPLETE        0x80
struct btp_hap_iac_discovery_complete_ev {
	bt_addr_le_t address;
	uint8_t status;
} __packed;

#define BT_HAP_EV_HAUC_DISCOVERY_COMPLETE       0x81
struct btp_hap_hauc_discovery_complete_ev {
	bt_addr_le_t address;
	uint8_t status;
	uint16_t has_hearing_aid_features_handle;
	uint16_t has_control_point_handle;
	uint16_t has_active_preset_index_handle;
} __packed;
+3 −0
Original line number Diff line number Diff line
@@ -120,3 +120,6 @@ uint8_t tester_unregister_mcp(void);

uint8_t tester_init_mcs(void);
uint8_t tester_unregister_mcs(void);

uint8_t tester_init_hap(void);
uint8_t tester_unregister_hap(void);
Loading