Zephyr Project API 3.7.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
tbs.h File Reference

Public APIs for Bluetooth Telephone Bearer Service. More...

#include <stdint.h>
#include <stdbool.h>
#include <zephyr/bluetooth/conn.h>
#include <zephyr/sys/util_macro.h>

Go to the source code of this file.

Data Structures

struct  bt_tbs_cb
 Struct to hold the Telephone Bearer Service callbacks. More...
 
struct  bt_tbs_client_call_state
 Struct to hold a call state. More...
 
struct  bt_tbs_client_call
 Struct to hold a call as the Telephone Bearer Service client. More...
 
struct  bt_tbs_client_cb
 Struct to hold the Telephone Bearer Service client callbacks. More...
 

Macros

#define BT_TBS_GTBS_INDEX   0xFF
 The GTBS index denotes whenever a callback is from a Generic Telephone Bearer Service (GTBS) instance, or whenever the client should perform on action on the GTBS instance of the server, rather than any of the specific Telephone Bearer Service instances.
 
Call States
#define BT_TBS_CALL_STATE_INCOMING   0x00
 A remote party is calling (incoming call).
 
#define BT_TBS_CALL_STATE_DIALING   0x01
 The process to call the remote party has started on the server, but the remote party is not being alerted (outgoing call).
 
#define BT_TBS_CALL_STATE_ALERTING   0x02
 A remote party is being alerted (outgoing call).
 
#define BT_TBS_CALL_STATE_ACTIVE   0x03
 The call is in an active conversation.
 
#define BT_TBS_CALL_STATE_LOCALLY_HELD   0x04
 The call is connected but held locally.
 
#define BT_TBS_CALL_STATE_REMOTELY_HELD   0x05
 The call is connected but held remotely.
 
#define BT_TBS_CALL_STATE_LOCALLY_AND_REMOTELY_HELD   0x06
 The call is connected but held both locally and remotely.
 
Terminate Reason
#define BT_TBS_REASON_BAD_REMOTE_URI   0x00
 The URI value used to originate a call was formed improperly.
 
#define BT_TBS_REASON_CALL_FAILED   0x01
 The call failed.
 
#define BT_TBS_REASON_REMOTE_ENDED_CALL   0x02
 The remote party ended the call.
 
#define BT_TBS_REASON_SERVER_ENDED_CALL   0x03
 The call ended from the server.
 
#define BT_TBS_REASON_LINE_BUSY   0x04
 The line was busy.
 
#define BT_TBS_REASON_NETWORK_CONGESTED   0x05
 Network congestion.
 
#define BT_TBS_REASON_CLIENT_TERMINATED   0x06
 The client terminated the call.
 
#define BT_TBS_REASON_NO_SERVICE   0x07
 No service.
 
#define BT_TBS_REASON_NO_ANSWER   0x08
 No answer.
 
#define BT_TBS_REASON_UNSPECIFIED   0x09
 Unspecified.
 
Control point error codes
#define BT_TBS_RESULT_CODE_SUCCESS   0x00
 The opcode write was successful.
 
#define BT_TBS_RESULT_CODE_OPCODE_NOT_SUPPORTED   0x01
 An invalid opcode was used for the Call Control Point write.
 
#define BT_TBS_RESULT_CODE_OPERATION_NOT_POSSIBLE   0x02
 The requested operation cannot be completed.
 
#define BT_TBS_RESULT_CODE_INVALID_CALL_INDEX   0x03
 The Call Index used for the Call Control Point write is invalid.
 
#define BT_TBS_RESULT_CODE_STATE_MISMATCH   0x04
 The opcode written to the Call Control Point was received when the current Call State for the Call Index was not in the expected state.
 
#define BT_TBS_RESULT_CODE_OUT_OF_RESOURCES   0x05
 Lack of internal resources to complete the requested action.
 
#define BT_TBS_RESULT_CODE_INVALID_URI   0x06
 The Outgoing URI is incorrect or invalid when an Originate opcode is sent.
 
Optional feature bits

Optional features that can be supported.

See bt_tbs_client_read_optional_opcodes() on how to read these from a remote device

#define BT_TBS_FEATURE_HOLD   BIT(0)
 Local Hold and Local Retrieve Call Control Point Opcodes supported.
 
#define BT_TBS_FEATURE_JOIN   BIT(1)
 Join Call Control Point Opcode supported.
 
Signal strength value limits
#define BT_TBS_SIGNAL_STRENGTH_NO_SERVICE   0
 No service.
 
#define BT_TBS_SIGNAL_STRENGTH_MAX   100
 Maximum signal strength.
 
#define BT_TBS_SIGNAL_STRENGTH_UNKNOWN   255
 Signal strength is unknown

 
Bearer Technology
#define BT_TBS_TECHNOLOGY_3G   0x01
 3G
 
#define BT_TBS_TECHNOLOGY_4G   0x02
 4G
 
#define BT_TBS_TECHNOLOGY_LTE   0x03
 Long-term evolution (LTE)
 
#define BT_TBS_TECHNOLOGY_WIFI   0x04
 Wifi.
 
#define BT_TBS_TECHNOLOGY_5G   0x05
 5G
 
#define BT_TBS_TECHNOLOGY_GSM   0x06
 Global System for Mobile Communications (GSM)
 
#define BT_TBS_TECHNOLOGY_CDMA   0x07
 Code-Division Multiple Access (CDMA)
 
#define BT_TBS_TECHNOLOGY_2G   0x08
 2G
 
#define BT_TBS_TECHNOLOGY_WCDMA   0x09
 Wideband Code-Division Multiple Access (WCDMA)
 
Call status flags bitfield
#define BT_TBS_STATUS_FLAG_INBAND_RINGTONE   BIT(0)
 Inband ringtone enabled.
 
#define BT_TBS_STATUS_FLAG_SILENT_MOD   BIT(1)
 Server is in silent mod.
 
Call flags bitfield
#define BT_TBS_CALL_FLAG_OUTGOING   BIT(0)
 If set, call is outgoing else incoming.
 
#define BT_TBS_CALL_FLAG_WITHHELD   BIT(1)
 If set call is withheld, else not withheld.
 
#define BT_TBS_CALL_FLAG_WITHHELD_BY_NETWORK   BIT(2)
 If set call is withheld by network, else provided by network.
 

Typedefs

typedef bool(* bt_tbs_originate_call_cb) (struct bt_conn *conn, uint8_t call_index, const char *uri)
 Callback function for client originating a call.
 
typedef void(* bt_tbs_terminate_call_cb) (struct bt_conn *conn, uint8_t call_index, uint8_t reason)
 Callback function for client terminating a call.
 
typedef void(* bt_tbs_join_calls_cb) (struct bt_conn *conn, uint8_t call_index_count, const uint8_t *call_indexes)
 Callback function for client joining calls.
 
typedef void(* bt_tbs_call_change_cb) (struct bt_conn *conn, uint8_t call_index)
 Callback function for client request call state change.
 
typedef bool(* bt_tbs_authorize_cb) (struct bt_conn *conn)
 Callback function for authorizing a client.
 
typedef void(* bt_tbs_client_discover_cb) (struct bt_conn *conn, int err, uint8_t tbs_count, bool gtbs_found)
 Callback function for ccp_discover.
 
typedef void(* bt_tbs_client_write_value_cb) (struct bt_conn *conn, int err, uint8_t inst_index)
 Callback function for writing values to peer device.
 
typedef void(* bt_tbs_client_cp_cb) (struct bt_conn *conn, int err, uint8_t inst_index, uint8_t call_index)
 Callback function for the CCP call control functions.
 
typedef void(* bt_tbs_client_read_string_cb) (struct bt_conn *conn, int err, uint8_t inst_index, const char *value)
 Callback function for functions that read a string value.
 
typedef void(* bt_tbs_client_read_value_cb) (struct bt_conn *conn, int err, uint8_t inst_index, uint32_t value)
 Callback function for functions that read an integer value.
 
typedef void(* bt_tbs_client_termination_reason_cb) (struct bt_conn *conn, int err, uint8_t inst_index, uint8_t call_index, uint8_t reason)
 Callback function for ccp_read_termination_reason.
 
typedef void(* bt_tbs_client_current_calls_cb) (struct bt_conn *conn, int err, uint8_t inst_index, uint8_t call_count, const struct bt_tbs_client_call *calls)
 Callback function for ccp_read_current_calls.
 
typedef void(* bt_tbs_client_call_states_cb) (struct bt_conn *conn, int err, uint8_t inst_index, uint8_t call_count, const struct bt_tbs_client_call_state *call_states)
 Callback function for ccp_read_call_state.
 

Functions

int bt_tbs_accept (uint8_t call_index)
 Accept an alerting call.
 
int bt_tbs_hold (uint8_t call_index)
 Hold a call.
 
int bt_tbs_retrieve (uint8_t call_index)
 Retrieve a call.
 
int bt_tbs_terminate (uint8_t call_index)
 Terminate a call.
 
int bt_tbs_originate (uint8_t bearer_index, char *uri, uint8_t *call_index)
 Originate a call.
 
int bt_tbs_join (uint8_t call_index_cnt, uint8_t *call_indexes)
 Join calls.
 
int bt_tbs_remote_answer (uint8_t call_index)
 Notify the server that the remote party answered the call.
 
int bt_tbs_remote_hold (uint8_t call_index)
 Notify the server that the remote party held the call.
 
int bt_tbs_remote_retrieve (uint8_t call_index)
 Notify the server that the remote party retrieved the call.
 
int bt_tbs_remote_terminate (uint8_t call_index)
 Notify the server that the remote party terminated the call.
 
int bt_tbs_remote_incoming (uint8_t bearer_index, const char *to, const char *from, const char *friendly_name)
 Notify the server of an incoming call.
 
int bt_tbs_set_bearer_provider_name (uint8_t bearer_index, const char *name)
 Set a new bearer provider.
 
int bt_tbs_set_bearer_technology (uint8_t bearer_index, uint8_t new_technology)
 Set a new bearer technology.
 
int bt_tbs_set_signal_strength (uint8_t bearer_index, uint8_t new_signal_strength)
 Update the signal strength reported by the server.
 
int bt_tbs_set_status_flags (uint8_t bearer_index, uint16_t status_flags)
 Sets the feature and status value.
 
int bt_tbs_set_uri_scheme_list (uint8_t bearer_index, const char **uri_list, uint8_t uri_count)
 Sets the URI scheme list of a bearer.
 
void bt_tbs_register_cb (struct bt_tbs_cb *cbs)
 Register the callbacks for TBS.
 
void bt_tbs_dbg_print_calls (void)
 Prints all calls of all services to the debug log.
 
int bt_tbs_client_discover (struct bt_conn *conn)
 Discover TBS for a connection.
 
int bt_tbs_client_set_outgoing_uri (struct bt_conn *conn, uint8_t inst_index, const char *uri)
 Set the outgoing URI for a TBS instance on the peer device.
 
int bt_tbs_client_set_signal_strength_interval (struct bt_conn *conn, uint8_t inst_index, uint8_t interval)
 Set the signal strength reporting interval for a TBS instance.
 
int bt_tbs_client_originate_call (struct bt_conn *conn, uint8_t inst_index, const char *uri)
 Request to originate a call.
 
int bt_tbs_client_terminate_call (struct bt_conn *conn, uint8_t inst_index, uint8_t call_index)
 Request to terminate a call.
 
int bt_tbs_client_hold_call (struct bt_conn *conn, uint8_t inst_index, uint8_t call_index)
 Request to hold a call.
 
int bt_tbs_client_accept_call (struct bt_conn *conn, uint8_t inst_index, uint8_t call_index)
 Accept an incoming call.
 
int bt_tbs_client_retrieve_call (struct bt_conn *conn, uint8_t inst_index, uint8_t call_index)
 Retrieve call from (local) hold.
 
int bt_tbs_client_join_calls (struct bt_conn *conn, uint8_t inst_index, const uint8_t *call_indexes, uint8_t count)
 Join multiple calls.
 
int bt_tbs_client_read_bearer_provider_name (struct bt_conn *conn, uint8_t inst_index)
 Read the bearer provider name of a TBS instance.
 
int bt_tbs_client_read_bearer_uci (struct bt_conn *conn, uint8_t inst_index)
 Read the UCI of a TBS instance.
 
int bt_tbs_client_read_technology (struct bt_conn *conn, uint8_t inst_index)
 Read the technology of a TBS instance.
 
int bt_tbs_client_read_uri_list (struct bt_conn *conn, uint8_t inst_index)
 Read the URI schemes list of a TBS instance.
 
int bt_tbs_client_read_signal_strength (struct bt_conn *conn, uint8_t inst_index)
 Read the current signal strength of a TBS instance.
 
int bt_tbs_client_read_signal_interval (struct bt_conn *conn, uint8_t inst_index)
 Read the signal strength reporting interval of a TBS instance.
 
int bt_tbs_client_read_current_calls (struct bt_conn *conn, uint8_t inst_index)
 Read the list of current calls of a TBS instance.
 
int bt_tbs_client_read_ccid (struct bt_conn *conn, uint8_t inst_index)
 Read the content ID of a TBS instance.
 
int bt_tbs_client_read_call_uri (struct bt_conn *conn, uint8_t inst_index)
 Read the call target URI of a TBS instance.
 
int bt_tbs_client_read_status_flags (struct bt_conn *conn, uint8_t inst_index)
 Read the feature and status value of a TBS instance.
 
int bt_tbs_client_read_call_state (struct bt_conn *conn, uint8_t inst_index)
 Read the states of the current calls of a TBS instance.
 
int bt_tbs_client_read_remote_uri (struct bt_conn *conn, uint8_t inst_index)
 Read the remote URI of a TBS instance.
 
int bt_tbs_client_read_friendly_name (struct bt_conn *conn, uint8_t inst_index)
 Read the friendly name of a call for a TBS instance.
 
int bt_tbs_client_read_optional_opcodes (struct bt_conn *conn, uint8_t inst_index)
 Read the supported opcode of a TBS instance.
 
void bt_tbs_client_register_cb (const struct bt_tbs_client_cb *cbs)
 Register the callbacks for CCP.
 
struct bt_tbs_instance * bt_tbs_client_get_by_ccid (const struct bt_conn *conn, uint8_t ccid)
 Look up Telephone Bearer Service instance by CCID.
 

Detailed Description

Public APIs for Bluetooth Telephone Bearer Service.

Copyright (c) 2020 Bose Corporation Copyright (c) 2021 Nordic Semiconductor ASA

SPDX-License-Identifier: Apache-2.0