-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bluetooth: GMAP: Add initial implementation of GMAP
Add initial implementation of GMAP. Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
- Loading branch information
Showing
12 changed files
with
2,103 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
/** @file | ||
* @brief Header for Bluetooth GMAP. | ||
* | ||
* Copyright (c) 2023 Nordic Semiconductor ASA | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
#ifndef ZEPHYR_INCLUDE_BLUETOOTH_AUDIO_GMAP_ | ||
#define ZEPHYR_INCLUDE_BLUETOOTH_AUDIO_GMAP_ | ||
|
||
#include <zephyr/bluetooth/conn.h> | ||
#include <zephyr/sys/util_macro.h> | ||
|
||
/** | ||
* @brief Bluetooth Gaming Profile (GMAP) | ||
* @defgroup bt_gmap Bluetooth Gaming Profile | ||
* @ingroup bluetooth | ||
* @{ | ||
*/ | ||
|
||
/** Gaming Role bitfield */ | ||
enum bt_gmap_role { | ||
/** Gaming Role Unicast Game Gateway */ | ||
BT_GMAP_ROLE_UGG = BIT(0), | ||
/** Gaming Role Unicast Game Terminal */ | ||
BT_GMAP_ROLE_UGT = BIT(1), | ||
/** Gaming Role Broadcast Game Sender */ | ||
BT_GMAP_ROLE_BGS = BIT(2), | ||
/** Gaming Role Broadcast Game Receiver */ | ||
BT_GMAP_ROLE_BGR = BIT(3), | ||
}; | ||
|
||
/* TBD: Should we declare a single enum for feature supported, and then transform from the spec | ||
* defined values to Zephyr define values | ||
*/ | ||
|
||
/** Unicast Game Gateway Feature bitfield */ | ||
enum bt_gmap_ugg_feat { | ||
/** Multiframe support */ | ||
BT_GMAP_UGG_FEAT_MULTIFRAME = BIT(0), | ||
/** 96 kbps support */ | ||
BT_GMAP_UGG_FEAT_96KBPS = BIT(1), | ||
/** Multisink support */ | ||
BT_GMAP_UGG_FEAT_MULTISINK = BIT(2), | ||
}; | ||
|
||
/** Unicast Game Terminal Feature bitfield */ | ||
enum bt_gmap_ugt_feat { | ||
/** Source support */ | ||
BT_GMAP_UGT_FEAT_SOURCE = BIT(0), | ||
/** 80 kbps source support */ | ||
BT_GMAP_UGT_FEAT_80KBPS_SOURCE = BIT(1), | ||
/** Sink support */ | ||
BT_GMAP_UGT_FEAT_SINK = BIT(2), | ||
/** 64 kbps sink support */ | ||
BT_GMAP_UGT_FEAT_64KBPS_SINK = BIT(3), | ||
/** Multiframe support */ | ||
BT_GMAP_UGT_FEAT_MULTIFRAME = BIT(4), | ||
/** Multisink support */ | ||
BT_GMAP_UGT_FEAT_MULTISINK = BIT(5), | ||
/** Multisource support */ | ||
BT_GMAP_UGT_FEAT_MULTISOURCE = BIT(6), | ||
}; | ||
|
||
/** Broadcast Game Sender Feature bitfield */ | ||
enum bt_gmap_bgs_feat { | ||
/** 96 kbps support */ | ||
BT_GMAP_BGS_FEAT_96KBPS = BIT(0), | ||
}; | ||
|
||
/** Broadcast Game Receiver Feature bitfield */ | ||
enum bt_gmap_bgr_feat { | ||
/** Multisink support */ | ||
BT_GMAP_BGR_FEAT_MULTISINK = BIT(0), | ||
/** Multiframe support */ | ||
BT_GMAP_BGR_FEAT_MULTIFRAME = BIT(1), | ||
}; | ||
|
||
/** @brief Hearing Access Service Client callback structure. */ | ||
struct bt_gmap_cb { | ||
/** | ||
* @brief Callback function for bt_has_discover. | ||
* | ||
* This callback is called when discovery procedure is complete. | ||
* | ||
* @param conn Bluetooth connection object. | ||
* @param err 0 on success, ATT error or negative errno otherwise. | ||
* @param role Role of remote device. 0 on failure. | ||
* @param ugg_feat Remote Unicast Game Gateway features. 0 if not supported or on error. | ||
* @param ugt_feat Remote Unicast Game Terminal features. 0 if not supported or on error. | ||
* @param bgs_feat Remote Broadcast Game Sender features. 0 if not supported or on error. | ||
* @param bgr_feat Remote Broadcast Game Receiver features. 0 if not supported or on error. | ||
*/ | ||
void (*discover)(struct bt_conn *conn, int err, enum bt_gmap_role role, | ||
enum bt_gmap_ugg_feat ugg_feat, enum bt_gmap_ugt_feat ugt_feat, | ||
enum bt_gmap_bgs_feat bgs_feat, enum bt_gmap_bgr_feat bgr_feat); | ||
}; | ||
|
||
/** @brief Registers the callbacks used by the Gaming Profile. | ||
* | ||
* @param cb The callback structure. | ||
* | ||
* @return 0 in case of success or negative value in case of error. | ||
*/ | ||
int bt_gmap_cb_register(const struct bt_gmap_cb *cb); | ||
|
||
/** | ||
* @brief Discover Gaming Service on a remote device. | ||
* | ||
* Procedure to find a Gaming Service on a server identified by @p conn. | ||
* The @ref bt_gmap_cb.discover callback is called when the discovery procedure completes of fails. | ||
* On discovery success the callback contains information about the remote device. | ||
* | ||
* @param conn Bluetooth connection object. | ||
* | ||
* @return 0 if success, errno on failure. | ||
*/ | ||
int bt_gmap_discover(struct bt_conn *conn); | ||
|
||
/** @} */ /* end of bt_gmap */ | ||
|
||
#endif /* ZEPHYR_INCLUDE_BLUETOOTH_AUDIO_GMAP_ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,161 @@ | ||
# Bluetooth Audio - Gaming Profile (CAP) options | ||
# | ||
# Copyright (c) 2023 Nordic Semiconductor ASA | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
|
||
config BT_GMAP | ||
def_bool BT_GMAP_UGG || BT_GMAP_UGT || BT_GMAP_BGS || BT_GMAP_BGR | ||
|
||
config BT_GMAS | ||
def_bool BT_GMAP_UGG || BT_GMAP_UGT || BT_GMAP_BGS_SERVICE || BT_GMAP_BGR | ||
|
||
config BT_GMAP_UGG | ||
bool "Gaming Profile Unicast Game Gateway Role Support [EXPERIMENTAL]" | ||
depends on BT_CAP_INITIATOR && BT_BAP_UNICAST_CLIENT && BT_VCP_VOL_CTLR | ||
# TODO: Add BT_CAP_COMMANDER dependency | ||
select EXPERIMENTAL | ||
help | ||
Enabling this will enable the GMAP Unicast Game Gateway role. | ||
This instantiates the Gaming Service (GMAS). | ||
|
||
config BT_GMAP_UGG_MULTIFRAME_SUPPORT | ||
bool "Gaming Profile Unicast Game Gateway Role Multiframe Support [EXPERIMENTAL]" | ||
depends on BT_GMAP_UGG | ||
select EXPERIMENTAL | ||
help | ||
Enabling this will let remote devices know that the GMAP UGG multiframe feature | ||
is supported. | ||
|
||
config BT_GMAP_UGG_96KBPS_SUPPORT | ||
bool "Gaming Profile Unicast Game Gateway Role 96 kbps Support [EXPERIMENTAL]" | ||
depends on BT_GMAP_UGG | ||
select EXPERIMENTAL | ||
help | ||
Enabling this will let remote devices know that the GMAP UGG 96 kbps Source feature | ||
is supported. | ||
|
||
config BT_GMAP_UGG_MULTISINK_SUPPORT | ||
bool "Gaming Profile Unicast Game Gateway Role Multisink Support [EXPERIMENTAL]" | ||
depends on BT_GMAP_UGG | ||
select EXPERIMENTAL | ||
help | ||
Enabling this will let remote devices know that the GMAP UGG Multisink feature | ||
is supported. | ||
|
||
config BT_GMAP_UGT | ||
bool "Gaming Profile Unicast Game Gateway Role Support [EXPERIMENTAL]" | ||
depends on BT_CAP_ACCEPTOR && BT_BAP_UNICAST_SERVER | ||
select EXPERIMENTAL | ||
help | ||
Enabling this will enable the GMAP Unicast Game Terminal role. | ||
This instantiates the Gaming Service (GMAS). | ||
|
||
config BT_GMAP_UGT_SOURCE_SUPPORT | ||
bool "Gaming Profile Unicast Game Gateway Role Source Support [EXPERIMENTAL]" | ||
depends on BT_GMAP_UGT && BT_MICP_MIC_DEV | ||
select EXPERIMENTAL | ||
help | ||
Enabling this will let remote devices know that the GMAP UGT Source feature | ||
is supported. | ||
|
||
config BT_GMAP_UGT_80KBPS_SOURCE_SUPPORT | ||
bool "Gaming Profile Unicast Game Gateway Role 80 kbps Source Support [EXPERIMENTAL]" | ||
depends on BT_GMAP_UGT_SOURCE_SUPPORT | ||
select EXPERIMENTAL | ||
help | ||
Enabling this will let remote devices know that the GMAP UGT 80 KBPS Source feature | ||
is supported. | ||
|
||
config BT_GMAP_UGT_SINK_SUPPORT | ||
bool "Gaming Profile Unicast Game Gateway Role Sink Support [EXPERIMENTAL]" | ||
depends on BT_GMAP_UGT && BT_VCP_VOL_REND | ||
select EXPERIMENTAL | ||
help | ||
Enabling this will let remote devices know that the GMAP UGT Sink feature | ||
is supported. | ||
|
||
config BT_GMAP_UGT_64KBPS_SINK_SUPPORT | ||
bool "Gaming Profile Unicast Game Gateway Role 64 kbps Sink Support [EXPERIMENTAL]" | ||
depends on BT_GMAP_UGT_SINK_SUPPORT | ||
select EXPERIMENTAL | ||
help | ||
Enabling this will let remote devices know that the GMAP UGT 64 kbps Sink feature | ||
is supported. | ||
|
||
config BT_GMAP_UGT_MULTIFRAME_SUPPORT | ||
bool "Gaming Profile Unicast Game Gateway Role Multiframe Support [EXPERIMENTAL]" | ||
depends on BT_GMAP_UGT | ||
select EXPERIMENTAL | ||
help | ||
Enabling this will let remote devices know that the GMAP UGT Multiframe feature | ||
is supported. | ||
|
||
config BT_GMAP_UGT_MULTISINK_SUPPORT | ||
bool "Gaming Profile Unicast Game Gateway Role Multisink Support [EXPERIMENTAL]" | ||
depends on BT_GMAP_UGT_SINK_SUPPORT | ||
select EXPERIMENTAL | ||
help | ||
Enabling this will let remote devices know that the GMAP UGT Multisink feature | ||
is supported. | ||
|
||
config BT_GMAP_UGT_MULTISOURCE_SUPPORT | ||
bool "Gaming Profile Unicast Game Gateway Role Multisource Support [EXPERIMENTAL]" | ||
depends on BT_GMAP_UGT_SOURCE_SUPPORT | ||
select EXPERIMENTAL | ||
help | ||
Enabling this will let remote devices know that the GMAP UGT Multisource feature | ||
is supported. | ||
|
||
config BT_GMAP_BGS | ||
bool "Gaming Profile Broadcast Game Sender Role Support [EXPERIMENTAL]" | ||
depends on BT_CAP_INITIATOR && BT_BAP_BROADCAST_SOURCE | ||
# TODO: Add BT_CAP_COMMANDER dependency | ||
select EXPERIMENTAL | ||
help | ||
Enabling this will enable the GMAP Broadcast Game Sender role. | ||
|
||
config BT_GMAP_BGS_SERVICE | ||
bool "Gaming Profile Broadcast Game Sender Role Support [EXPERIMENTAL]" | ||
depends on BT_GMAP_BGS | ||
select EXPERIMENTAL | ||
help | ||
Enabling this will instantiate the Gaming Service (GMAS). | ||
|
||
config BT_GMAP_BGS_96KBPS_SUPPORT | ||
bool "Gaming Profile Broadcast Game Sender Role 96 kbps Support [EXPERIMENTAL]" | ||
depends on BT_GMAP_BGS | ||
select EXPERIMENTAL | ||
help | ||
Enabling this will let remote devices know that the GMAP BGS Multisource feature | ||
is supported. | ||
|
||
config BT_GMAP_BGR | ||
bool "Gaming Profile Broadcast Game Receiver Role Support [EXPERIMENTAL]" | ||
depends on BT_CAP_ACCEPTOR && BT_BAP_BROADCAST_SINK && BT_VCP_VOL_REND | ||
select EXPERIMENTAL | ||
help | ||
Enabling this will enable the GMAP Broadcast Game Receiver Role role. | ||
This instantiates the Gaming Service (GMAS). | ||
|
||
config BT_GMAP_BGR_MULTISINK_SUPPORT | ||
bool "Gaming Profile Unicast Game Gateway Role Multisink Support [EXPERIMENTAL]" | ||
depends on BT_GMAP_BGR | ||
select EXPERIMENTAL | ||
help | ||
Enabling this will let remote devices know that the GMAP BGR Multisink feature | ||
is supported. | ||
|
||
config BT_GMAP_BGR_MULTIFRAME_SUPPORT | ||
bool "Gaming Profile Unicast Game Gateway Role Multiframe Support [EXPERIMENTAL]" | ||
depends on BT_GMAP_BGR | ||
select EXPERIMENTAL | ||
help | ||
Enabling this will let remote devices know that the GMAP BGR Multiframe feature | ||
is supported. | ||
|
||
parent-module = BT | ||
module = BT_GMAP | ||
module-str = "Bluetooth Gaming Profile" | ||
source "subsys/logging/Kconfig.template.log_config_inherit" |
Oops, something went wrong.