10#ifndef ZEPHYR_INCLUDE_BLUETOOTH_AUDIO_TBS_H_
11#define ZEPHYR_INCLUDE_BLUETOOTH_AUDIO_TBS_H_
19#define BT_TBS_CALL_STATE_INCOMING 0x00
20#define BT_TBS_CALL_STATE_DIALING 0x01
21#define BT_TBS_CALL_STATE_ALERTING 0x02
22#define BT_TBS_CALL_STATE_ACTIVE 0x03
23#define BT_TBS_CALL_STATE_LOCALLY_HELD 0x04
24#define BT_TBS_CALL_STATE_REMOTELY_HELD 0x05
25#define BT_TBS_CALL_STATE_LOCALLY_AND_REMOTELY_HELD 0x06
28#define BT_TBS_REASON_BAD_REMOTE_URI 0x00
29#define BT_TBS_REASON_CALL_FAILED 0x01
30#define BT_TBS_REASON_REMOTE_ENDED_CALL 0x02
31#define BT_TBS_REASON_SERVER_ENDED_CALL 0x03
32#define BT_TBS_REASON_LINE_BUSY 0x04
33#define BT_TBS_REASON_NETWORK_CONGESTED 0x05
34#define BT_TBS_REASON_CLIENT_TERMINATED 0x06
35#define BT_TBS_REASON_UNSPECIFIED 0x07
38#define BT_TBS_RESULT_CODE_SUCCESS 0x00
39#define BT_TBS_RESULT_CODE_OPCODE_NOT_SUPPORTED 0x01
40#define BT_TBS_RESULT_CODE_OPERATION_NOT_POSSIBLE 0x02
41#define BT_TBS_RESULT_CODE_INVALID_CALL_INDEX 0x03
42#define BT_TBS_RESULT_CODE_STATE_MISMATCH 0x04
43#define BT_TBS_RESULT_CODE_OUT_OF_RESOURCES 0x05
44#define BT_TBS_RESULT_CODE_INVALID_URI 0x06
46#define BT_TBS_FEATURE_HOLD BIT(0)
47#define BT_TBS_FEATURE_JOIN BIT(1)
49#define BT_TBS_CALL_FLAG_SET_INCOMING(flag) (flag &= ~BIT(0))
50#define BT_TBS_CALL_FLAG_SET_OUTGOING(flag) (flag |= BIT(0))
52#define BT_TBS_SIGNAL_STRENGTH_NO_SERVICE 0
53#define BT_TBS_SIGNAL_STRENGTH_MAX 100
54#define BT_TBS_SIGNAL_STRENGTH_UNKNOWN 255
57#define BT_TBS_TECHNOLOGY_3G 0x01
58#define BT_TBS_TECHNOLOGY_4G 0x02
59#define BT_TBS_TECHNOLOGY_LTE 0x03
60#define BT_TBS_TECHNOLOGY_WIFI 0x04
61#define BT_TBS_TECHNOLOGY_5G 0x05
62#define BT_TBS_TECHNOLOGY_GSM 0x06
63#define BT_TBS_TECHNOLOGY_CDMA 0x07
64#define BT_TBS_TECHNOLOGY_2G 0x08
65#define BT_TBS_TECHNOLOGY_WCDMA 0x09
66#define BT_TBS_TECHNOLOGY_IP 0x0a
74#define BT_TBS_GTBS_INDEX 0xFF
77struct bt_tbs_instance;
263 const char *from,
const char *friendly_name);
356 uint8_t tbs_count,
bool gtbs_found);
457#if defined(CONFIG_BT_TBS_CLIENT_ORIGINATE_CALL)
460#if defined(CONFIG_BT_TBS_CLIENT_TERMINATE_CALL)
463#if defined(CONFIG_BT_TBS_CLIENT_HOLD_CALL)
466#if defined(CONFIG_BT_TBS_CLIENT_ACCEPT_CALL)
469#if defined(CONFIG_BT_TBS_CLIENT_RETRIEVE_CALL)
472#if defined(CONFIG_BT_TBS_CLIENT_JOIN_CALLS)
475#if defined(CONFIG_BT_TBS_CLIENT_BEARER_PROVIDER_NAME)
478#if defined(CONFIG_BT_TBS_CLIENT_BEARER_UCI)
481#if defined(CONFIG_BT_TBS_CLIENT_BEARER_TECHNOLOGY)
484#if defined(CONFIG_BT_TBS_CLIENT_BEARER_URI_SCHEMES_SUPPORTED_LIST)
487#if defined(CONFIG_BT_TBS_CLIENT_BEARER_SIGNAL_STRENGTH)
490#if defined(CONFIG_BT_TBS_CLIENT_READ_BEARER_SIGNAL_INTERVAL)
493#if defined(CONFIG_BT_TBS_CLIENT_BEARER_LIST_CURRENT_CALLS)
496#if defined(CONFIG_BT_TBS_CLIENT_CCID)
499#if defined(CONFIG_BT_TBS_CLIENT_INCOMING_URI)
502#if defined(CONFIG_BT_TBS_CLIENT_STATUS_FLAGS)
506#if defined(CONFIG_BT_TBS_CLIENT_OPTIONAL_OPCODES)
510#if defined(CONFIG_BT_TBS_CLIENT_INCOMING_CALL)
513#if defined(CONFIG_BT_TBS_CLIENT_CALL_FRIENDLY_NAME)
Bluetooth connection handling.
#define bool
Definition: stdbool.h:13
__UINT32_TYPE__ uint32_t
Definition: stdint.h:90
__UINT8_TYPE__ uint8_t
Definition: stdint.h:88
__UINT16_TYPE__ uint16_t
Definition: stdint.h:89
bt_tbs_originate_call_cb originate_call
Definition: tbs.h:138
bt_tbs_call_change_cb accept_call
Definition: tbs.h:141
bt_tbs_call_change_cb hold_call
Definition: tbs.h:140
bt_tbs_terminate_call_cb terminate_call
Definition: tbs.h:139
bt_tbs_authorize_cb authorize
Definition: tbs.h:144
bt_tbs_join_calls_cb join_calls
Definition: tbs.h:143
bt_tbs_call_change_cb retrieve_call
Definition: tbs.h:142
uint8_t index
Definition: tbs.h:335
uint8_t state
Definition: tbs.h:336
uint8_t flags
Definition: tbs.h:337
struct bt_tbs_client_call_state call_info
Definition: tbs.h:341
char * remote_uri
Definition: tbs.h:342
bt_tbs_client_call_states_cb call_state
Definition: tbs.h:505
bt_tbs_client_discover_cb discover
Definition: tbs.h:456
bt_tbs_client_termination_reason_cb termination_reason
Definition: tbs.h:509
int bt_tbs_remote_retrieve(uint8_t call_index)
Notify the server that the remote party retrieved the call.
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_accept(uint8_t call_index)
Accept an alerting call.
bool(* bt_tbs_authorize_cb)(struct bt_conn *conn)
Callback function for authorizing a client.
Definition: tbs.h:135
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_join(uint8_t call_index_cnt, uint8_t *call_indexes)
Join calls.
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_terminate_call(struct bt_conn *conn, uint8_t inst_index, uint8_t call_index)
Request to terminate a call.
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.
Definition: tbs.h:450
void(* bt_tbs_call_change_cb)(struct bt_conn *conn, uint8_t call_index)
Callback function for client request call state change.
Definition: tbs.h:123
void bt_tbs_client_register_cb(const struct bt_tbs_client_cb *cbs)
Register the callbacks for CCP.
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_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.
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.
Definition: tbs.h:379
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_remote_incoming(uint8_t bearer_index, const char *to, const char *from, const char *friendly_name)
Notify the server of an incoming call.
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.
Definition: tbs.h:392
int bt_tbs_set_bearer_provider_name(uint8_t bearer_index, const char *name)
Set a new bearer provider.
int bt_tbs_remote_terminate(uint8_t call_index)
Notify the server that the remote party terminated the call.
int bt_tbs_remote_hold(uint8_t call_index)
Notify the server that the remote party held the call.
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.
Definition: tbs.h:405
bool(* bt_tbs_originate_call_cb)(struct bt_conn *conn, uint8_t call_index, const char *uri)
Callback function for client originating a call.
Definition: tbs.h:89
int bt_tbs_client_accept_call(struct bt_conn *conn, uint8_t inst_index, uint8_t call_index)
Accept an incoming call.
void bt_tbs_dbg_print_calls(void)
Prints all calls of all services to the debug log.
void(* bt_tbs_terminate_call_cb)(struct bt_conn *conn, uint8_t call_index, uint8_t reason)
Callback function for client terminating a call.
Definition: tbs.h:102
int bt_tbs_client_read_technology(struct bt_conn *conn, uint8_t inst_index)
Read the technology of a TBS instance.
void bt_tbs_register_cb(struct bt_tbs_cb *cbs)
Register the callbacks for TBS.
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.
Definition: tbs.h:434
int bt_tbs_terminate(uint8_t call_index)
Terminate a call.
int bt_tbs_set_status_flags(uint8_t bearer_index, uint16_t status_flags)
Sets the feature and status value.
int bt_tbs_remote_answer(uint8_t call_index)
Notify the server that the remote party answered the call.
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_set_uri_scheme_list(uint8_t bearer_index, const char **uri_list, uint8_t uri_count)
Sets the URI scheme list of a bearer.
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.
void(* bt_tbs_client_discover_cb)(struct bt_conn *conn, int err, uint8_t tbs_count, bool gtbs_found)
Callback function for ccp_discover.
Definition: tbs.h:355
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_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.
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.
Definition: tbs.h:113
int bt_tbs_client_read_signal_strength(struct bt_conn *conn, uint8_t inst_index)
Read the current signal strength of a TBS instance.
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.
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_remote_uri(struct bt_conn *conn, uint8_t inst_index)
Read the remote URI of a TBS instance.
int bt_tbs_hold(uint8_t call_index)
Hold a call.
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.
Definition: tbs.h:418
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_retrieve_call(struct bt_conn *conn, uint8_t inst_index, uint8_t call_index)
Retrieve call from (local) hold.
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_set_signal_strength(uint8_t bearer_index, uint8_t new_signal_strength)
Update the signal strength reported by the server.
int bt_tbs_client_discover(struct bt_conn *conn)
Discover TBS for a connection.
int bt_tbs_retrieve(uint8_t call_index)
Retrieve a call.
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_originate(uint8_t bearer_index, char *uri, uint8_t *call_index)
Originate a call.
int bt_tbs_set_bearer_technology(uint8_t bearer_index, uint8_t new_technology)
Set a new bearer technology.
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_write_value_cb)(struct bt_conn *conn, int err, uint8_t inst_index)
Callback function for writing values to peer device.
Definition: tbs.h:366
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.