@@ -126,6 +126,8 @@ extern "C" {
126126#define BT_TBS_FEATURE_HOLD BIT(0)
127127/** Join Call Control Point Opcode supported */
128128#define BT_TBS_FEATURE_JOIN BIT(1)
129+ /** All Control Point Opcodes supported */
130+ #define BT_TBS_FEATURE_ALL (BT_TBS_FEATURE_HOLD | BT_TBS_FEATURE_JOIN)
129131/** @} */
130132
131133/**
@@ -247,8 +249,6 @@ typedef void (*bt_tbs_call_change_cb)(struct bt_conn *conn,
247249/**
248250 * @brief Callback function for authorizing a client.
249251 *
250- * Only used if BT_TBS_AUTHORIZATION is enabled.
251- *
252252 * @param conn The connection used.
253253 *
254254 * @return true if authorized, false otherwise
@@ -462,6 +462,98 @@ int bt_tbs_set_uri_scheme_list(uint8_t bearer_index, const char **uri_list,
462462 */
463463void bt_tbs_register_cb (struct bt_tbs_cb * cbs );
464464
465+ struct bt_tbs_register_param {
466+ /** The name of the provider, for example a cellular service provider */
467+ char * provider_name ;
468+
469+ /**
470+ * @brief The Uniform Caller Identifier of the bearer
471+ *
472+ * See the Uniform Caller Identifiers table in Bluetooth Assigned Numbers
473+ */
474+ char * uci ;
475+
476+ /**
477+ * The Uniform Resource Identifiers schemes supported by this bearer as an UTF-8 string
478+ *
479+ * See https://www.iana.org/assignments/uri-schemes/uri-schemes.xhtml for possible values.
480+ * If multiple values are used, these shall be comma separated, e.g. "tel,skype".
481+ */
482+ char * uri_schemes_supported ;
483+
484+ /**
485+ * @brief Whether this bearer shall be registered as a Generic Telephone Bearer server
486+ *
487+ * A GTBS shall be registered before any non-GTBS services. There can only be a single GTBS
488+ * registered.
489+ */
490+ bool gtbs ;
491+
492+ /**
493+ * @brief Whether the application will need to authorize changes to calls
494+ *
495+ * If set to false then the service will automatically accept write requests from clients.
496+ */
497+ bool authorization_required ;
498+
499+ /**
500+ * @brief The technology of the bearer
501+ *
502+ * See the BT_TBS_TECHNOLOGY_* values.
503+ */
504+ uint8_t technology ;
505+
506+ /**
507+ * @brief The optional supported features of the bearer
508+ *
509+ * See the BT_TBS_FEATURE_* values.
510+ */
511+ uint8_t supported_features ;
512+ };
513+
514+ /**
515+ * @brief Register a Telephone Bearer
516+ *
517+ * This will register a Telephone Bearer Service (TBS) (or a Generic Telephone Bearer service
518+ * (GTBS)) with the provided parameters.
519+ *
520+ * As per the TBS specification, the GTBS shall be instantiated for the feature, and as such a GTBS
521+ * shall always be registered before any TBS can be registered.
522+ * Similarly, all TBS shall be unregistered before the GTBS can be unregistered with
523+ * bt_tbs_unregister_bearer().
524+ *
525+ * @param param The parameters to initialize the bearer.
526+
527+ * @retval index The bearer index if return value is >= 0
528+ * @retval -EINVAL @p param contains invalid data
529+ * @retval -EALREADY @p param.gtbs is true and GTBS has already been registered
530+ * @retval -EAGAIN @p param.gtbs is false and GTBS has not been registered
531+ * @retval -ENOMEM @p param.gtbs is false and no more TBS can be registered (see
532+ * @kconfig{CONFIG_BT_TBS_BEARER_COUNT})
533+ * @retval -ENOEXEC The service failed to be registered
534+ */
535+ int bt_tbs_register_bearer (const struct bt_tbs_register_param * param );
536+
537+ /**
538+ * @brief Unregister a Telephone Bearer
539+ *
540+ * This will unregister a Telephone Bearer Service (TBS) (or a Generic Telephone Bearer service
541+ * (GTBS)) with the provided parameters. The bearer shall be registered first by
542+ * bt_tbs_register_bearer() before it can be unregistered.
543+ *
544+ * Similarly, all TBS shall be unregistered before the GTBS can be unregistered with.
545+ *
546+ * @param bearer_index The index of the bearer to unregister.
547+ *
548+ * @retval 0 Success
549+ * @retval -EINVAL @p bearer_index is invalid
550+ * @retval -EALREADY The bearer identified by @p bearer_index is not registered
551+ * @retval -EAGAIN The bearer identified by @p bearer_index is GTBS and there are TBS instances
552+ * registered.
553+ * @retval -ENOEXEC The service failed to be unregistered
554+ */
555+ int bt_tbs_unregister_bearer (uint8_t bearer_index );
556+
465557/** @brief Prints all calls of all services to the debug log */
466558void bt_tbs_dbg_print_calls (void );
467559
0 commit comments