10#ifndef ZEPHYR_INCLUDE_BLUETOOTH_AUDIO_TBS_H_
11#define ZEPHYR_INCLUDE_BLUETOOTH_AUDIO_TBS_H_
17#define BT_TBS_CALL_STATE_INCOMING 0x00
18#define BT_TBS_CALL_STATE_DIALING 0x01
19#define BT_TBS_CALL_STATE_ALERTING 0x02
20#define BT_TBS_CALL_STATE_ACTIVE 0x03
21#define BT_TBS_CALL_STATE_LOCALLY_HELD 0x04
22#define BT_TBS_CALL_STATE_REMOTELY_HELD 0x05
23#define BT_TBS_CALL_STATE_LOCALLY_AND_REMOTELY_HELD 0x06
26#define BT_TBS_REASON_BAD_REMOTE_URI 0x00
27#define BT_TBS_REASON_CALL_FAILED 0x01
28#define BT_TBS_REASON_REMOTE_ENDED_CALL 0x02
29#define BT_TBS_REASON_SERVER_ENDED_CALL 0x03
30#define BT_TBS_REASON_LINE_BUSY 0x04
31#define BT_TBS_REASON_NETWORK_CONGESTED 0x05
32#define BT_TBS_REASON_CLIENT_TERMINATED 0x06
33#define BT_TBS_REASON_UNSPECIFIED 0x07
36#define BT_TBS_RESULT_CODE_SUCCESS 0x00
37#define BT_TBS_RESULT_CODE_OPCODE_NOT_SUPPORTED 0x01
38#define BT_TBS_RESULT_CODE_OPERATION_NOT_POSSIBLE 0x02
39#define BT_TBS_RESULT_CODE_INVALID_CALL_INDEX 0x03
40#define BT_TBS_RESULT_CODE_STATE_MISMATCH 0x04
41#define BT_TBS_RESULT_CODE_OUT_OF_RESOURCES 0x05
42#define BT_TBS_RESULT_CODE_INVALID_URI 0x06
44#define BT_TBS_FEATURE_HOLD BIT(0)
45#define BT_TBS_FEATURE_JOIN BIT(1)
47#define BT_TBS_CALL_FLAG_SET_INCOMING(flag) (flag &= ~BIT(0))
48#define BT_TBS_CALL_FLAG_SET_OUTGOING(flag) (flag |= BIT(0))
50#define BT_TBS_SIGNAL_STRENGTH_NO_SERVICE 0
51#define BT_TBS_SIGNAL_STRENGTH_MAX 100
52#define BT_TBS_SIGNAL_STRENGTH_UNKNOWN 255
55#define BT_TBS_TECHNOLOGY_3G 0x01
56#define BT_TBS_TECHNOLOGY_4G 0x02
57#define BT_TBS_TECHNOLOGY_LTE 0x03
58#define BT_TBS_TECHNOLOGY_WIFI 0x04
59#define BT_TBS_TECHNOLOGY_5G 0x05
60#define BT_TBS_TECHNOLOGY_GSM 0x06
61#define BT_TBS_TECHNOLOGY_CDMA 0x07
62#define BT_TBS_TECHNOLOGY_2G 0x08
63#define BT_TBS_TECHNOLOGY_WCDMA 0x09
64#define BT_TBS_TECHNOLOGY_IP 0x0a
72#define BT_TBS_GTBS_INDEX 0xFF
75struct bt_tbs_instance;
261 const char *from,
const char *friendly_name);
354 uint8_t tbs_count,
bool gtbs_found);
455#if defined(CONFIG_BT_TBS_CLIENT_ORIGINATE_CALL)
458#if defined(CONFIG_BT_TBS_CLIENT_TERMINATE_CALL)
461#if defined(CONFIG_BT_TBS_CLIENT_HOLD_CALL)
464#if defined(CONFIG_BT_TBS_CLIENT_ACCEPT_CALL)
467#if defined(CONFIG_BT_TBS_CLIENT_RETRIEVE_CALL)
470#if defined(CONFIG_BT_TBS_CLIENT_JOIN_CALLS)
473#if defined(CONFIG_BT_TBS_CLIENT_BEARER_PROVIDER_NAME)
476#if defined(CONFIG_BT_TBS_CLIENT_BEARER_UCI)
479#if defined(CONFIG_BT_TBS_CLIENT_BEARER_TECHNOLOGY)
482#if defined(CONFIG_BT_TBS_CLIENT_BEARER_URI_SCHEMES_SUPPORTED_LIST)
485#if defined(CONFIG_BT_TBS_CLIENT_BEARER_SIGNAL_STRENGTH)
488#if defined(CONFIG_BT_TBS_CLIENT_READ_BEARER_SIGNAL_INTERVAL)
491#if defined(CONFIG_BT_TBS_CLIENT_BEARER_LIST_CURRENT_CALLS)
494#if defined(CONFIG_BT_TBS_CLIENT_CCID)
497#if defined(CONFIG_BT_TBS_CLIENT_INCOMING_URI)
500#if defined(CONFIG_BT_TBS_CLIENT_STATUS_FLAGS)
504#if defined(CONFIG_BT_TBS_CLIENT_OPTIONAL_OPCODES)
508#if defined(CONFIG_BT_TBS_CLIENT_INCOMING_CALL)
511#if defined(CONFIG_BT_TBS_CLIENT_CALL_FRIENDLY_NAME)
ZTEST_BMEM int count
Definition: main.c:33
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:136
bt_tbs_call_change_cb accept_call
Definition: tbs.h:139
bt_tbs_call_change_cb hold_call
Definition: tbs.h:138
bt_tbs_terminate_call_cb terminate_call
Definition: tbs.h:137
bt_tbs_authorize_cb authorize
Definition: tbs.h:142
bt_tbs_join_calls_cb join_calls
Definition: tbs.h:141
bt_tbs_call_change_cb retrieve_call
Definition: tbs.h:140
uint8_t index
Definition: tbs.h:333
uint8_t state
Definition: tbs.h:334
uint8_t flags
Definition: tbs.h:335
struct bt_tbs_client_call_state call_info
Definition: tbs.h:339
char * remote_uri
Definition: tbs.h:340
bt_tbs_client_call_states_cb call_state
Definition: tbs.h:503
bt_tbs_client_discover_cb discover
Definition: tbs.h:454
bt_tbs_client_termination_reason_cb termination_reason
Definition: tbs.h:507
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:133
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:448
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:121
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:377
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:390
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:403
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:87
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:100
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:432
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:353
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:111
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:416
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_discover(struct bt_conn *conn, bool subscribe)
Discover TBS for a connection. This will start a GATT discover and setup handles and subscriptions.
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_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:364
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.