TWS Link Environment Functions
TWS_LINK_ENV API Brief
Application |
Brief |
|---|---|
Set scan type |
|
Initialize environment parameters |
|
Enter pairing mode |
|
Set TWS connection status |
|
Set TWS encryption status |
|
Get TWS encryption status |
|
Check that TWS is connected |
|
Get TWS connection handle |
|
Set TWS connection handle |
|
Get TWS pairing enabled |
|
Get TWS role |
|
Set TWS role |
|
Check that snoop is connected |
|
Set sync profile status |
|
Get sync profile status |
|
Set mobile profile status |
|
Clear mobile profile status |
|
Get mobile profile set status |
|
Get mobile authorization status |
|
Set mobile authorization status |
|
Get mobile encryption status |
|
Set mobile encryption status |
|
Check that mobile environment parameters is existed |
|
Allocate mobile environment parameters |
|
Free mobile environment parameters |
|
Check that any mobile phones are connected |
|
Check that mobile is connected |
|
Check that mobile is connected |
|
Set mobile BT role |
|
Set mobile link mode |
|
Get mobile link mode |
|
Check that TWS switch is allowed |
|
Get mobile connected count |
|
Set the TWS switch allowed statue |
|
Handle delete link key command |
|
Get mobile SCO sync connection handle |
|
Set mobile SCO sync connection handle |
|
Get mobile ACL connection handle |
|
Set mobile ACL connection handle |
|
Get mobile address by ACL connection handle |
|
Get profile sync timer |
|
Set audio proxy context |
|
Get audio proxy context |
|
Get profile state backup |
|
Set profile state backup |
|
Handle loss connection event |
|
Handle loss disconnection event |
|
Reset the reconnection environment parameters |
|
get reconnect address when tws link is lose |
|
Update schedule information |
|
Restore schedule information |
|
Get link mobile number |
|
Get scan type |
|
Report battery level |
|
Force sync profile |
TWS_LINK_ENV API Reference
Header File
Functions
-
void tws_link_set_scan_type(void)
Set scan type.
Set the scan type based on the TWS link environment parameters.
- 返回:
N/A
-
void tws_link_env_init(void)
Initialize environment parameters.
Initialize TWS and mobile environment parameters.
- 返回:
N/A
-
void tws_link_enter_pairing(void)
Enter pairing mode.
Enter pairing mode and enable pairing timeout timer.
- 返回:
N/A
-
void tws_link_set_connected(bool connected)
Set TWS connection status.
Set the connection status in the TWS environment parameters.
- 参数:
connected – [in] TWS connection status. true is connected, false is not connected.
- 返回:
N/A
-
void tws_link_set_encrypted(bool encrypted)
Set TWS encryption status.
Set the encryption status in the TWS environment parameters.
- 参数:
connected – [in] TWS encryption status. true is encrypted, false is unencrypted.
- 返回:
N/A
-
bool tws_link_get_encrypted(void)
Get TWS encryption status.
Get the encryption status in the TWS environment parameters.
- 返回值:
true – encrypted
false – unencrypted
- 返回:
TWS encryption status
-
bool tws_link_is_tws_connected(void)
Check that TWS is connected.
Check that TWS is connected in the TWS environment parameter.
- 返回值:
true – connected
false – not connected
- 返回:
TWS connection status
-
uint16_t tws_link_get_tws_handle(void)
Get TWS connection handle.
Get TWS connection handle in the TWS environment parameter.
- 返回:
connection handle
-
void tws_link_set_tws_handle(uint16_t handle)
Set TWS connection handle.
Set TWS connection handle in the TWS environment parameter.
- 参数:
handle – [in] connection handle
- 返回:
N/A
-
bool tws_link_get_pairing_enabled(void)
Get TWS pairing enabled.
Get TWS pairing enabled in the TWS environment parameter.
- 返回值:
true – enabled
false – disabled
- 返回:
TWS pairing enabled
-
btif_tws_role_t tws_link_get_mobile_tws_role(btif_bd_addr_t addr)
Get TWS role.
Get the TWS role for connected to the mobile phone with address [addr].
- 参数:
addr – [in] mobile phone address of type btif_bd_addr_t
- 返回值:
0 – unknown [BTIF_TWS_ROLE_UNKNOWN]
1 – master [BTIF_TWS_ROLE_MASTER]
2 – slave [BTIF_TWS_ROLE_SLAVE]
- 返回:
TWS role
-
btif_ret_t tws_link_set_mobile_tws_role(btif_bd_addr_t addr, btif_tws_role_t role)
Set TWS role.
Set the TWS role for connected to the mobile phone with address [addr].
- 参数:
addr – [in] mobile phone address of type btif_bd_addr_t
role – [in] TWS role 0 unknown [BTIF_TWS_ROLE_UNKNOWN] 1 master [BTIF_TWS_ROLE_MASTER] 2 slave [BTIF_TWS_ROLE_SLAVE]
- 返回值:
0 – success [BTIF_EXIT_SUCCESS]
other – fail
- 返回:
result
-
bool tws_link_is_snoop_connected(btif_bd_addr_t addr)
Check that snoop is connected.
Check that snoop is connected to the mobile phone with address [addr].
- 参数:
addr – [in] mobile phone address of type btif_bd_addr_t
- 返回值:
true – snoop is connected
false – snoop is not connected
- 返回:
check results
-
btif_ret_t tws_set_mobile_sync_profile(btif_bd_addr_t addr, btif_sync_prof_status_t sync_status)
Set sync profile status.
Set the sync profile status for the mobile phone with address [addr].
- 参数:
addr – [in] mobile phone address of type btif_bd_addr_t
sync_status – [in] sync profile status. see@btif_sync_prof_status_t
- 返回值:
0 – success [BTIF_EXIT_SUCCESS]
other – fail
- 返回:
result
-
btif_sync_prof_status_t tws_get_mobile_sync_profile(btif_bd_addr_t addr)
Get sync profile status.
Get the sync profile status for the mobile phone with address [addr].
- 参数:
addr – [in] mobile phone address of type btif_bd_addr_t
- 返回值:
2 – sync done
1 – sync profile ongoing
1 – sync isn’t done
- 返回:
sync profile status
-
btif_ret_t tws_set_mobile_profile_state(uint16_t handle, btif_profile_bitmap_t profile_state)
Set mobile profile status.
Set the profile status for the mobile phone with handle [handle].
- 参数:
handle – [in] connection handle
profile_state – [in] profile state of type btif_profile_bitmap_t to set.
- 返回值:
0 – success [BTIF_EXIT_SUCCESS]
other – fail
- 返回:
result
-
btif_ret_t tws_clear_mobile_profile_state(uint16_t handle, btif_profile_bitmap_t profile_state)
Clear mobile profile status.
Clear the profile status for the mobile phone with handle [handle].
- 参数:
handle – [in] connection handle
profile_state – [in] profile state of type btif_profile_bitmap_t to clear.
- 返回值:
0 – success [BTIF_EXIT_SUCCESS]
other – fail
- 返回:
result
-
btif_profile_bitmap_t tws_get_mobile_profile_state(btif_bd_addr_t *p_addr)
Get mobile profile set status.
Get the profile set status for the mobile phone with address [addr].
- 参数:
p_addr – [in] pointer to an address of type btif_bd_addr_t
- 返回:
profile status of type btif_profile_bitmap_t.
-
bool tws_get_mobile_authed(btif_bd_addr_t addr)
Get mobile authorization status.
Get the authorization status for the mobile phone with address [addr].
- 参数:
addr – [in] mobile phone address of type btif_bd_addr_t
- 返回值:
true – authorized
false – unauthorized
- 返回:
authorization status
-
btif_ret_t tws_set_mobile_authed(btif_bd_addr_t addr, bool authed)
Set mobile authorization status.
Set the authorization status for the mobile phone with address [addr].
- 参数:
addr – [in] mobile phone address of type btif_bd_addr_t
authed – [in] authorization status. true is authorized, false is unauthorized.
- 返回值:
0 – success [BTIF_EXIT_SUCCESS]
other – fail
- 返回:
result
-
bool tws_get_mobile_encryped(btif_bd_addr_t addr)
Get mobile encryption status.
Get the encryption status for the mobile phone with address [addr].
- 参数:
addr – [in] mobile phone address of type btif_bd_addr_t
- 返回值:
true – encrypted
false – not encrypted
- 返回:
encryption status
-
btif_ret_t tws_set_mobile_encryped(btif_bd_addr_t addr, bool encrypted)
Set mobile encryption status.
Set the encryption status for the mobile phone with address [addr].
- 参数:
addr – [in] mobile phone address of type btif_bd_addr_t
encrypted – [in] encryption status. true is encrypted, false is not encrypted.
- 返回值:
0 – success [BTIF_EXIT_SUCCESS]
other – fail
- 返回:
result
-
bool tws_is_mobile_env_existed(uint16_t handle)
Check that mobile environment parameters is existed.
Check that the environment parameters for the mobile phone with handle [handle] is existed.
- 参数:
handle – [in] connection handle
- 返回值:
true – existed
false – not existed
- 返回:
check results
-
btif_ret_t tws_mobile_env_allocate(btif_bd_addr_t addr, uint16_t handle, btif_bt_role_t bt_role)
Allocate mobile environment parameters.
Allocate the environment parameters for the mobile phone with address [addr].
- 参数:
addr – [in] mobile phone address of type btif_bd_addr_t
handle – [in] connection handle
bt_role – [in] TWS role of type btif_bt_role_t
- 返回值:
0 – success [BTIF_EXIT_SUCCESS]
other – fail
- 返回:
result
-
btif_ret_t tws_mobile_env_free(btif_bd_addr_t addr, uint16_t handle)
Free mobile environment parameters.
Free the environment parameters for the mobile phone with address [addr].
- 参数:
addr – [in] mobile phone address of type btif_bd_addr_t
handle – [in] connection handle
- 返回值:
0 – success [BTIF_EXIT_SUCCESS]
other – fail
- 返回:
result
-
bool tws_is_any_mobile_connected(void)
Check that any mobile phones are connected.
Check that any mobile phones are connected.
- 返回值:
true – connection exists
false – no connection
- 返回:
check results
-
btif_bd_addr_t *tws_is_mobile_idx_connected(uint8_t idx)
Check that mobile is connected.
Check that the index [idx] mobile phone is connected.
- 参数:
idx – [in] index of mobile phone
- 返回:
mobile phone address pointer of type btif_bd_addr_t
-
bool tws_is_mobile_connected(btif_bd_addr_t addr)
Check that mobile is connected.
Check that the mobile phone with address [addr] is connected.
- 参数:
addr – [in] mobile phone address of type btif_bd_addr_t
- 返回值:
true – connected
false – no connected
- 返回:
check results
-
btif_ret_t tws_set_mobile_bt_role(uint16_t handle, btif_bt_role_t bt_role)
Set mobile BT role.
Set BT role for the mobile phone with handle [handle].
- 参数:
handle – [in] connection handle
bt_role – [in] BT role of type btif_bt_role_t
- 返回值:
0 – success [BTIF_EXIT_SUCCESS]
other – fail
- 返回:
result
-
btif_ret_t tws_set_mobile_mode(uint16_t handle, if_link_mode_t mode)
Set mobile link mode.
Set link mode for the mobile phone with handle [handle].
- 参数:
handle – [in] connection handle
mode – [in] link mode of type if_link_mode_t
- 返回值:
0 – success [BTIF_EXIT_SUCCESS]
other – fail
- 返回:
result
-
uint8_t tws_get_mobile_mode(uint16_t handle)
Get mobile link mode.
Get link mode for the mobile phone with handle [handle].
- 参数:
handle – [in] connection handle
- 返回值:
0 – active mode [IF_ACTIVE]
1 – hold mode [IF_HOLD]
2 – sniff mode [IF_SNIFF]
3 – error mode [IF_ERROR_MODE]
- 返回:
link mode of type if_link_mode_t
-
bool tws_is_mobile_tws_switch_allowed(btif_bd_addr_t addr)
Check that TWS switch is allowed.
Check that TWS switch is allowed for the mobile phone with address [addr].
- 参数:
addr – [in] mobile phone address of type btif_bd_addr_t
- 返回值:
true – allowed
false – not allowed
- 返回:
check results
-
uint8_t tws_get_mobile_connected_count(void)
Get mobile connected count.
Get the number of connected mobile phones.
- 返回:
number of connected mobile phones.
-
btif_ret_t tws_set_mobile_tws_switch_allowed(btif_bd_addr_t addr, bool allowed)
Set the TWS switch allowed statue.
Set the TWS switch allowed statue for the mobile phone with address [addr].
- 参数:
addr – [in] mobile phone address of type btif_bd_addr_t
allowed – [in] allowed statue
- 返回值:
0 – success [BTIF_EXIT_SUCCESS]
other – fail
- 返回:
result
-
void tws_delete_lk_handle(const uint8_t *p_data, uint16_t length)
Handle delete link key command.
Handle the delete link key command in TWS private commands
- 参数:
p_data – [in] pointer to the delete link key command data
length – [in] length of the delete link key command data
- 返回:
N/A
-
uint16_t tws_get_mobile_sync_handle(btif_bd_addr_t addr)
Get mobile SCO sync connection handle.
Get the SCO sync connection handle for the mobile phone with address [addr].
- 参数:
addr – [in] mobile phone address of type btif_bd_addr_t
- 返回:
SCO sync connection handle
-
btif_ret_t tws_set_mobile_sync_handle(btif_bd_addr_t addr, uint16_t handle)
Set mobile SCO sync connection handle.
Set the SCO sync connection handle for the mobile phone with address [addr].
- 参数:
addr – [in] mobile phone address of type btif_bd_addr_t
handle – [in] SCO sync connection handle
- 返回值:
0 – success [BTIF_EXIT_SUCCESS]
other – fail
- 返回:
result
-
uint16_t tws_link_get_mobile_handle(btif_bd_addr_t addr)
Get mobile ACL connection handle.
Get the ACL connection handle for the mobile phone with address [addr].
- 参数:
addr – [in] mobile phone address of type btif_bd_addr_t
- 返回:
ACL connection handle
-
btif_ret_t tws_link_set_mobile_handle(btif_bd_addr_t addr, uint16_t handle)
Set mobile ACL connection handle.
Set the ACL connection handle for the mobile phone with address [addr].
- 参数:
addr – [in] mobile phone address of type btif_bd_addr_t
handle – [in] ACL connection handle
- 返回值:
0 – success [BTIF_EXIT_SUCCESS]
other – fail
- 返回:
result
-
btif_ret_t tws_link_get_mobile_addr_by_handle(uint16_t acl_handle, btif_bd_addr_t *p_addr)
Get mobile address by ACL connection handle.
Get the mobile phone address by the ACL connection handle [acl_handle].
- 参数:
acl_handle – [in] ACL connection handle
p_addr – [in] pointer to an address of type btif_bd_addr_t
- 返回值:
0 – success [BTIF_EXIT_SUCCESS]
other – fail
- 返回:
result
-
tws_sync_timer_env_t *tws_link_get_profile_sync_timer(btif_bd_addr_t *p_addr)
Get profile sync timer.
Get the profile sync timeout timer for the mobile phone with address [addr].
- 参数:
p_addr – [in] pointer to an address of type btif_bd_addr_t.
- 返回:
sync timeout timer pointer of type tws_sync_timer_env_t
-
bool tws_link_mobile_set_audio_procy(btif_bd_addr_t *p_addr)
Set audio proxy context.
Set the audio proxy context to the environment parameters for the mobile phone with address [addr].
- 参数:
p_addr – [in] pointer to an address of type btif_bd_addr_t
- 返回值:
true – success
false – fail
- 返回:
result
-
bt_audio_proxy_ctx_t *tws_link_mobile_get_audio_procy(btif_bd_addr_t *p_addr)
Get audio proxy context.
Get the audio proxy context from the environment parameters for the mobile phone with address [addr].
- 参数:
p_addr – [in] pointer to an address of type btif_bd_addr_t
- 返回:
pointer to an audio proxy context of type bt_audio_proxy_ctx_t.
-
btif_profile_bitmap_t tws_link_mobile_get_profile_backup(btif_bd_addr_t *p_addr)
Get profile state backup.
Get the profile state backup for the mobile phone with address [addr].
- 参数:
p_addr – [in] pointer to an address of type btif_bd_addr_t
- 返回:
profile state backup of type btif_profile_bitmap_t
-
bool tws_link_mobile_set_profile_backup(btif_bd_addr_t *p_addr, btif_profile_bitmap_t profile_bitmap)
Set profile state backup.
Set the profile state backup for the mobile phone with address [addr].
- 参数:
p_addr – [in] pointer to an address of type btif_bd_addr_t
profile_bitmap – [in] profile state backup of type btif_profile_bitmap_t
- 返回值:
true – success
false – fail
- 返回:
result
-
void tws_link_loss_connect_evt_handle(btif_bd_addr_t *p_addr, uint8_t status)
Handle loss connection event.
Handle reconnection when the mobile phone with address [addr] is connected.
- 参数:
p_addr – [in] pointer to an address of type btif_bd_addr_t
status – [in] connection status
- 返回:
N/A
-
void tws_link_loss_discon_evt_handle(btif_bd_addr_t *p_addr)
Handle loss disconnection event.
Handle reconnection when the mobile phone with address [addr] is disconnected.
- 参数:
p_addr – [in] pointer to an address of type btif_bd_addr_t
- 返回:
N/A
-
void tws_link_loss_reset_env(void)
Reset the reconnection environment parameters.
Reset the reconnection environment parameters.
- 返回:
N/A
-
btif_ret_t tws_link_loss_get_reconn_addr(btif_bd_addr_t **p_addr)
get reconnect address when tws link is lose
provides p_addr type pointer for get the reconnect address pointer.
- 参数:
p_addr – [in] pointer to a btif_bd_addr_t type pointer.
- 返回值:
0 – success
other – fail
- 返回:
result
-
void tws_link_update_sch_info(void)
Update schedule information.
Send TWS schedule information to the controller.
- 返回:
N/A
-
void tws_link_restore_sch_info(void)
Restore schedule information.
Send TWS schedule information to the controller.
- 返回:
N/A
-
uint8_t tws_link_get_mobile_num(void)
Get link mobile number.
Get the number of connected mobile phones.
- 返回:
number of connected mobile phones.
-
uint8_t tws_link_get_scan_type(void)
Get scan type.
Get the scan type based on the TWS link environment parameters.
- 返回:
scan type of type btif_enable_scan_t
-
void tws_link_battery_report(uint8_t bat_level)
Report battery level.
Report the battery level [bat_level] to the mobile phone
- 参数:
bat_level – [in] battery level
- 返回:
N/A
-
void tws_link_force_sync_profile(void)
Force sync profile.
Force sync profile when the device is wating sync profile
- 返回:
N/A TWS_LINK_ENV_H EOF
Structures
-
struct tws_sync_timer_env_t
TWS sync timer structure definition.
-
struct tws_link_reconn_env_t
TWS link reconnect structure definition.