TWS Sub FSM Functions

[English]

TWS_SUB_FSM API Brief

Application

Brief

subfsm_entry()

subfsm entry

subfsm_tws_handshake_handle()

handle tws handshake command

subfsm_tws_handshake_rsp_handle()

handle tws handshake command response

subfsm_tws_handshake_rsp_TO_handle()

handle tws handshake command response timeout

subfsm_disc_mobile_handle()

handle disconnect mobile phone command

subfsm_recv_master_TSS_handle()

handle receive master TSS command

subfsm_recv_master_TSS_rsp_handle()

handle receive master TSS command response

subfsm_recv_master_TSS_rsp_TO_handle()

handle receive master TSS command response timeout

subfsm_recv_slave_TSS_handle()

handle receive slave TSS command

subfsm_recv_slave_TSS_rsp_handle()

handle receive slave TSS command response

subfsm_recv_slave_TSS_rsp_TO_handle()

handle receive slave TSS command response timeout

subfsm_recv_stop_snoop_handle()

handle receive stop snoop command

subfsm_initialise()

initialize sub FSM

subfsm_register_mainfsm_callback()

register main FSM callback

subfsm_is_enabled()

is some fsm type is running

TWS_SUB_FSM API Reference

Header File

Functions

fsm_result_t subfsm_entry(btif_bd_addr_t addr, subfsm_type_t type)

subfsm entry

subfsm entry function used by mainfsm

参数:
  • addr[in] address of type btif_bd_addr_t

  • type[in] sub FSM type of type subfsm_type_t

返回值:
  • 0 – success [FSM_NO_ERROR]

  • other – fail

返回:

result of type fsm_result_t

void subfsm_tws_handshake_handle(const uint8_t *p_data, uint16_t length)

handle tws handshake command

handshake cmd handler

参数:
  • p_data[in] pointer to command data

  • length[in] length of command data

返回:

N/A

void subfsm_tws_handshake_rsp_handle(const uint8_t *p_data, uint16_t length)

handle tws handshake command response

handshake cmd rsp handle

参数:
  • p_data[in] pointer to command data

  • length[in] length of command data

返回:

N/A

void subfsm_tws_handshake_rsp_TO_handle(const uint8_t *p_data, uint16_t length)

handle tws handshake command response timeout

handshake rsp timeout handle

参数:
  • p_data[in] pointer to command data

  • length[in] length of command data

返回:

N/A

void subfsm_disc_mobile_handle(const uint8_t *p_data, uint16_t length)

handle disconnect mobile phone command

disconnect mobile cmd handle

参数:
  • p_data[in] pointer to command data

  • length[in] length of command data

返回:

N/A

void subfsm_recv_master_TSS_handle(const uint8_t *p_data, uint16_t length)

handle receive master TSS command

rece master TSS cmd handle

参数:
  • p_data[in] pointer to command data

  • length[in] length of command data

返回:

N/A

void subfsm_recv_master_TSS_rsp_handle(const uint8_t *p_data, uint16_t length)

handle receive master TSS command response

recv master TSS cmd rsp handle

参数:
  • p_data[in] pointer to command data

  • length[in] length of command data

返回:

N/A

void subfsm_recv_master_TSS_rsp_TO_handle(const uint8_t *p_data, uint16_t length)

handle receive master TSS command response timeout

recv master TSS rsp timeout handle

参数:
  • p_data[in] pointer to command data

  • length[in] length of command data

返回:

N/A

void subfsm_recv_slave_TSS_handle(const uint8_t *p_data, uint16_t length)

handle receive slave TSS command

recv slave TSS cmd handle

参数:
  • p_data[in] pointer to command data

  • length[in] length of command data

返回:

N/A

void subfsm_recv_slave_TSS_rsp_handle(const uint8_t *p_data, uint16_t length)

handle receive slave TSS command response

recv slave TSS rsp handle

参数:
  • p_data[in] pointer to command data

  • length[in] length of command data

返回:

N/A

void subfsm_recv_slave_TSS_rsp_TO_handle(const uint8_t *p_data, uint16_t length)

handle receive slave TSS command response timeout

recv slave TSS rsp timeout handle

参数:
  • p_data[in] pointer to command data

  • length[in] length of command data

返回:

N/A

void subfsm_recv_stop_snoop_handle(const uint8_t *p_data, uint16_t length)

handle receive stop snoop command

recv stop snoop cmd handle

参数:
  • p_data[in] pointer to command data

  • length[in] length of command data

返回:

N/A

void subfsm_initialise(void)

initialize sub FSM

subfsm initialise

返回:

N/A

void subfsm_register_mainfsm_callback(sub_fsm_callback callback)

register main FSM callback

used for mainfsm to register callback function

参数:

callback[in] callback of type sub_fsm_callback

返回:

N/A

bool subfsm_is_enabled(subfsm_type_t fsm_type)

is some fsm type is running

used to check if the corresponding fsm is running

参数:

fsm_type[in]

返回:

N/A TWS_SUB_FSM_H EOF

Structures

struct share_mobile_info_t

Share mobile phone information structure definition.

struct subfsm_info_t

TWS sub FSM information structure definition.

struct handshake_info_t

TWS handshake information command structure definition.

struct handshake_rsp_t

TWS handshake response command structure definition.

struct disc_mobile_t

Disconnect mobile phone command structure definition.

struct tws_switch_m_t

TWS Master switch command structure definition.

struct tws_switch_s_t

TWS Slave switch command structure definition.

struct tws_stop_snoop_t

Stop snoop command structure definition.

struct tws_start_snoop_t

Start snoop command structure definition.

struct tws_start_snoop_rsp_t

Start snoop response command structure definition.

Macros

FSM_NO_ERROR
FSM_ERROR
FSM_CMD_RSP_TO
FSM_NO_CONN
FSM_NO_SNOOP
FSM_CONDITION_ERROR
FSM_TWS_CONN_FAILED
FSM_TWS_RETRY_TO
IDLE_FSM
CONNECT_MOBILE_FSM

0x01

CONNECT_TWS_FSM

0x02

DISC_MOBILE_FSM

0x04

DISC_TWS_FSM

0x08

SYNC_PROFILE_FSM

0x10

START_SNOOP_FSM

0x20

SUB_TWS_SWITCH_FSM

0x40

STOP_SNOOP_FSM

0x80

MAX_SUB_FSM_NUM
INVALID_SUB_FSM_IDX

Type Definitions

typedef void (*sub_fsm_callback)(btif_bd_addr_t addr, uint8_t action, uint8_t status, void *p_para)

TWS sub FSM callback function pointer definition.

typedef uint8_t fsm_result_t

TWS sub FSM result definition.

typedef uint32_t subfsm_type_t

TWS sub FSM type definition.

Enumerations

enum btif_action_e

TWS sub FSM action enumeration definition.

Values:

enumerator IDLE_ACTION

0

1

2

3

4

enumerator MOBILE_ENTER_ACTIVE_ACTION

5

enumerator SNOOP_CONNECTED_ACTION

6

enumerator PROFILE_SYNC_DONE_ACTION

7

enumerator SNOOP_DISCONNECT_ACTION

8

enumerator TWS_SWITCH_COMP_ACTION

9

enumerator HANDSHARK_COMP_ACTION

10

enumerator TWS_SWITCH_ALLOWED_ACTION

11

enumerator TWS_SWITCH_RSP_ACTION

12

enum subfsm_state_e

TWS sub FSM state enumeration definition.

Values:

enumerator SUB_FSM_IDLE

0

enumerator SUB_FSM_W4_TWS_CONNECTED

1

enumerator SUB_FSM_W4_MOBILE_CONNECTED

2

enumerator SUB_FSM_W4_TWS_DISCONNECTED

3

enumerator SUB_FSM_W4_MOBILE_DISCONNECTED

4

enumerator SUB_FSM_W4_ENTER_ACTIVE

5

enumerator SUB_FSM_W4_SNOOP_CONNECTED

6

enumerator SUB_FSM_W4_PROFILE_SYNC

7

enumerator SUB_FSM_W4_SNOOP_DISCONNECTED

8

enumerator SUB_FSM_W4_TWS_SWITCH_COMP

9

enumerator SUB_FSM_W4_HANDSHARK_COMP

10

enumerator SUB_FSM_W4_TWS_SWITCH_ALLOWED

11

enumerator SUB_FSM_W4_TWS_SWITCH_RSP

12