TWS FSM Control Functions
TWS_FSM_CTRL API Brief
Application |
Brief |
|---|---|
handle TWS FAM task |
|
handle TWS external operation events |
|
send TWS shared information |
|
handle TWS shared information |
|
update saved mobile information |
|
activate phone connection event |
|
send FSM generate message |
|
get TWS environment parameters |
|
get FSM pending external operations |
|
get mobile information |
|
activate mobile information merged event |
|
reconnect tws |
|
clear external operation |
|
activate tws link loss event |
|
delete local address |
|
get battery level |
|
right request left to run connect fsm |
|
enable tws operate |
TWS_FSM_CTRL API Reference
Header File
Functions
-
void tws_fsm_task_handle(void *p_data, uint16_t length)
handle TWS FAM task
run in tws task to generate one new FSM
- 参数:
p_data – [in] pointer to FSM generate message data
length – [in] length of FSM generate message data
- 返回:
N/A
-
void tws_event_ext_isr_handle(ext_operate_t ext_operate)
handle TWS external operation events
external ISR handler
- 参数:
ext_operate – [in] external operation of type ext_operate_t
- 返回:
N/A
send TWS shared information
notify local earbuds info to peer
- 参数:
info_type – [in] information type of type tws_info_type_t
ext_operate – [in] external operation of type ext_operate_t
- 返回:
N/A
handle TWS shared information
peer earbus info handler
- 参数:
p_data – [in] pointer to TWS information data
length – [in] length of TWS information data
- 返回:
N/A
-
void tws_update_saved_mobile_info(void)
update saved mobile information
update saved mobile info when link connect
- 返回:
N/A
-
btif_ret_t tws_fsm_set_phone_connect_active(btif_bd_addr_t *p_addr)
activate phone connection event
activates the connection to the phone with the address p_addr.
- 参数:
p_addr – [in] pointer to a phone address of type btif_bd_addr_t to be connected.
- 返回值:
0 – success
other – fail
- 返回:
result
-
void tws_send_FSM_gen_msg(fsm_gen_msg_t fsm_gen_msg)
send FSM generate message
trigger tws thread to generate a new mainfsm is exist
- 参数:
fsm_gen_msg – [in] FSM generate message
- 返回:
N/A
-
tws_evt_env_t *tws_fsm_ctrl_get_evt_env(void)
get TWS environment parameters
get TWS environment parameters
- 返回:
The pointer of tws_evt_env_t
-
ext_operate_t tws_fsm_get_pending_operate(void)
get FSM pending external operations
get FSM pending external operations
- 返回:
external operation of type ext_operate_t
-
uint8_t tws_get_mobile_info(addr_info_t **p_mobile_info)
get mobile information
provides p_mobile_info type pointer for get the mobile information pointer.
- 参数:
p_mobile_info – [in] pointer to a addr_info_t type pointer.
- 返回:
mobile number
-
void tws_fsm_set_mobile_info_merged_active(void)
activate mobile information merged event
trigger mobile info merged event when tws connected
- 返回:
N/A
-
void tws_fsm_ctrl_reconnect_tws(void)
reconnect tws
trigger fsm ctrl module to start reconnect tws
- 返回:
N/A
-
void tws_fsm_ctrl_clear_operate(ext_operate_t operate)
clear external operation
clear operate
- 参数:
operate – [in] external operation of type ext_operate_t
- 返回:
N/A
-
void tws_fsm_set_link_loss_active(void)
activate tws link loss event
activate tws link loss event
- 返回:
N/A
-
void tws_fsm_del_local_env_addr(btif_bd_addr_t *p_addr)
delete local address
delete the local address in the environment parameters
- 参数:
p_addr – [in] pointer to an address of type btif_bd_addr_t.
- 返回:
N/A
-
uint8_t tws_fsm_ctrl_get_tws_bat_level(void)
get battery level
get the battery level in the environment parameters
- 返回:
battery level
-
void tws_fsm_master_req_connect_handle(const uint8_t *p_data, uint16_t length)
right request left to run connect fsm
right request left to run connect fsm, due to phone cancel pairing
- 返回:
NA
-
void tws_fsm_ctrl_set_operate(ext_operate_t operate)
enable tws operate
enable tws operate bitmap
- 返回:
NA TWS_EVENT_CTRL_H EOF
Structures
-
struct addr_info_t
Address information structure definition.
-
struct tws_evt_env_t
TWS event environment parameters structure definition.
-
struct tws_info_t
TWS information structure definition.
-
struct tws_master_req_conn_t
TWS master request connect structure definition.
-
struct fsm_gen_msg_t
FSM generation event message structure definition.
Macros
-
OPERATE_IDLE
0x01
-
OPERATE_OPEN_BOX
0x02
-
OPERATE_FETCH_OUT
0x04
-
OPERATE_WEAR_UP
0x08
-
OPERATE_WEAR_DOWN
0x10
-
OPERATE_PUT_IN
0x20
-
OPERATE_CLOSE_BOX
0x40
-
OPERATE_LINK_LOSS
0x80
-
OPERATE_ENTER_PAIRING
0x100
-
OPERATE_PHONE_CONNECT
0x200
-
OPERATE_TWS_CONNECT
0x400
-
OPERATE_MOBILE_INFO_MERGED
0x800
-
OPERATE_MASTER_REQ_CONNECT
0x1000
-
OPERATE_TWS_SYNC_BITMAP
-
OPERATE_PEER_OPEN_BOX
0x10000
-
OPERATE_PEER_FETCH_OUT
0x20000
-
OPERATE_PEER_WEAR_UP
0x40000
-
OPERATE_PEER_WEAR_DOWN
0x80000
-
OPERATE_PEER_PUT_IN
0x100000
-
OPERATE_PEER_CLOSE_BOX
0x200000
-
OPERATE_PEER_BITMAP
-
IS_CONNECT_EXT_ISR(isr)
Macro for check if isr includes operations that requires a TWS connection.
-
IS_CLOSE_BOX_OPERATE(opt)
Macro for check if opt includes the close box operations.
-
CLEAR_CLOSE_BOX_OPERATE(opt)
Macro for clear the close box operation from opt.
-
CLEAR_PUT_IN_OPERATE(opt)
Macro for clear the put in operation from opt.
-
CLEAR_WEAR_DOWN_OPERATE(opt)
Macro for clear the wear down operation from opt.
-
CLEAR_OPEN_BOX_OPERATE(opt)
Macro for clear the open box operation from opt.
-
CLEAR_FETCH_OUT_OPERATE(opt)
Macro for clear the fetch out operation from opt.
-
CLEAR_WEAR_UP_OPERATE(opt)
Macro for clear the wear up operation from opt.
-
STATE_UNKNOWN
-
STATE_IN_BOX_CLOSED
-
STATE_IN_BOX_OPEN
-
STATE_OUT_OF_BOX
-
STATE_OUTBOX_WEARED
-
TWS_INFO_TYPE_UNKNOWN
-
TWS_INFO_TYPE_OPERATE
-
TWS_INFO_TYPE_BAT_INFO
-
TWS_INFO_TYPE_PD_TIMER
-
TWS_INFO_TYPE_PD
-
TWS_INFO_TYPE_ENTER_PAIR
-
TWS_MOBILE_INFO_NO_CONNECT
-
TWS_MOBILE_INFO_CONNECTED
-
TWS_MOBILE_INFO_CONNECT_ONGOING
-
EXT_ISR_EVENT
-
PEER_INFO_EVENT
-
USER_LOGIC_EVENT
-
EXTCUTE_PENDING_EVENT
-
LINK_LOSS_EVENT
Type Definitions
-
typedef uint32_t ext_operate_t
External operation definition.
-
typedef uint32_t earbuds_state_t
Earbuds status definition.
-
typedef uint8_t tws_info_type_t
-
typedef uint8_t fsm_gen_type_t
FSM generation event type definition.