博通集成 ARMINO BlueK开发框架 Logo
3298v7_bootrom_v1.1-612-gf11840b7
  • 快速入门
  • API 参考手册
    • 概述
    • 蓝牙应用层
      • BOOTROOM
      • COMMON
      • TWS
        • TWS_BT_IF
        • TWS_CONFIG
        • TWS_FSM_CTRL
        • TWS_LINK_ENV
        • TWS_MAIN_FSM
        • TWS_PRIVATE_CMD
        • TWS_PROFILE_CTRL
        • TWS_QUEUE
        • TWS_SEARCH_UX
        • TWS_SUB_FSM
        • TWS_TASK
        • TWS_TEST
        • TWS_TRPC
    • 蓝牙介面层
    • 蓝牙音频代理层
    • 中间件层
    • 驱动层
    • 系统
  • 开发者指南
博通集成 ARMINO BlueK开发框架
  • API 参考
  • Application
  • TWS
  • TWS Link Environment Functions

TWS Link Environment Functions

[English]

TWS_LINK_ENV API Brief

Application

Brief

tws_link_set_scan_type()

Set scan type

tws_link_env_init()

Initialize environment parameters

tws_link_enter_pairing()

Enter pairing mode

tws_link_set_connected()

Set TWS connection status

tws_link_set_encrypted()

Set TWS encryption status

tws_link_get_encrypted()

Get TWS encryption status

tws_link_is_tws_connected()

Check that TWS is connected

tws_link_get_tws_handle()

Get TWS connection handle

tws_link_set_tws_handle()

Set TWS connection handle

tws_link_get_pairing_enabled()

Get TWS pairing enabled

tws_link_get_mobile_tws_role()

Get TWS role

tws_link_set_mobile_tws_role()

Set TWS role

tws_link_is_snoop_connected()

Check that snoop is connected

tws_set_mobile_sync_profile()

Set sync profile status

tws_get_mobile_sync_profile()

Get sync profile status

tws_set_mobile_profile_state()

Set mobile profile status

tws_clear_mobile_profile_state()

Clear mobile profile status

tws_get_mobile_profile_state()

Get mobile profile set status

tws_get_mobile_authed()

Get mobile authorization status

tws_set_mobile_authed()

Set mobile authorization status

tws_get_mobile_encryped()

Get mobile encryption status

tws_set_mobile_encryped()

Set mobile encryption status

tws_is_mobile_env_existed()

Check that mobile environment parameters is existed

tws_mobile_env_allocate()

Allocate mobile environment parameters

tws_mobile_env_free()

Free mobile environment parameters

tws_is_any_mobile_connected()

Check that any mobile phones are connected

tws_is_mobile_idx_connected()

Check that mobile is connected

tws_is_mobile_connected()

Check that mobile is connected

tws_set_mobile_bt_role()

Set mobile BT role

tws_set_mobile_mode()

Set mobile link mode

tws_get_mobile_mode()

Get mobile link mode

tws_is_mobile_tws_switch_allowed()

Check that TWS switch is allowed

tws_get_mobile_connected_count()

Get mobile connected count

tws_set_mobile_tws_switch_allowed()

Set the TWS switch allowed statue

tws_delete_lk_handle()

Handle delete link key command

tws_get_mobile_sync_handle()

Get mobile SCO sync connection handle

tws_set_mobile_sync_handle()

Set mobile SCO sync connection handle

tws_link_get_mobile_handle()

Get mobile ACL connection handle

tws_link_set_mobile_handle()

Set mobile ACL connection handle

tws_link_get_mobile_addr_by_handle()

Get mobile address by ACL connection handle

tws_link_get_profile_sync_timer()

Get profile sync timer

tws_link_mobile_set_audio_procy()

Set audio proxy context

tws_link_mobile_get_audio_procy()

Get audio proxy context

tws_link_mobile_get_profile_backup()

Get profile state backup

tws_link_mobile_set_profile_backup()

Set profile state backup

tws_link_loss_connect_evt_handle()

Handle loss connection event

tws_link_loss_discon_evt_handle()

Handle loss disconnection event

tws_link_loss_reset_env()

Reset the reconnection environment parameters

tws_link_loss_get_reconn_addr()

get reconnect address when tws link is lose

tws_link_update_sch_info()

Update schedule information

tws_link_restore_sch_info()

Restore schedule information

tws_link_get_mobile_num()

Get link mobile number

tws_link_get_scan_type()

Get scan type

tws_link_battery_report()

Report battery level

tws_link_force_sync_profile()

Force sync profile

TWS_LINK_ENV API Reference

Header File

  • tws/tws_ux/inc/tws_link_env.h

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.

下一页 上一页

© Copyright 2020 - 2024 博通集成电路(上海)股份有限公司。 更新时间: 2024-10-30 16:45:42