bluetooth_service

bts2_app_interface.h

Author

Sifli software development team

Defines

bt_interface_get_a2dp_stream_state()

Typedefs

typedef int (*register_bt_notify_func_t)(uint16_t type, uint16_t event_id, uint8_t *data, uint16_t data_len)
typedef struct bt_notify_register_callback_t bt_notify_register_callback_t

Enums

enum bt_interface_status_t

Values:

enumerator BT_INTERFACE_STATUS_OK
enumerator BT_INTERFACE_STATUS_NO_MEMORY
enumerator BT_INTERFACE_STATUS_ALREADY_EXIST
enumerator BT_INTERFACE_STATUS_NOT_EXIST

Functions

void bt_interface_open_bt(void)

Performs chip power on and kickstarts OS scheduler.

void bt_interface_close_bt(void)

Inititates shutdown of Bluetooth system. Any active links will be dropped and device entering non connectable/discoverable mode.

void bt_interface_start_inquiry(void)

Start device discovery/inquiry for BT_DEVCLS_AUDIO device.

int8_t bt_interface_start_inquiry_ex(bt_start_inquiry_ex_t *param)

Start device discovery/inquiry with more parameters.

参数:
  • param[in] Parameters for inquiry condition

返回:

int8_t

void bt_interface_stop_inquiry(void)

Stop device discovery/inquiry.

bt_err_t bt_interface_conn_ext(unsigned char *mac, bt_profile_t ext_profile)

Initiate connect with the specified device and profile(hf sink)

参数:
  • mac[in] Remote device address

  • ext_profile[in] Profile value

返回:

bt_err_t

bt_err_t bt_interface_conn_to_source_ext(unsigned char *mac, bt_profile_t ext_profile)

Initiate connect with the specified device and profile(ag source)

参数:
  • mac[in] Remote device address

  • ext_profile[in] Profile value

返回:

bt_err_t

bt_err_t bt_interface_disc_ext(unsigned char *mac, bt_profile_t ext_profile)

Disconnect with the specified profile.

参数:
  • mac[in] Remote device address

  • ext_profile[in] : Profile value

返回:

bt_err_t

              BT_ERROR_INPARAM            = 0x10000001,  input param error
              BT_ERROR_UNSUPPORTED        = 0x10000002,  unsupported function
              BT_ERROR_TIMEOUT            = 0x10000003,  error timout
              BT_ERROR_DISCONNECTED       = 0x10000004,  the bt device is disconnected
              BT_ERROR_STATE              = 0x10000005,  current state  unsupported this function
              BT_ERROR_PARSING            = 0x10000006,  parsing at response error
              BT_ERROR_POWER_OFF          = 0x10000007,  current bt device has been power off
              BT_ERROR_NOTIFY_CB_FULL     = 0x10000008,  register notify cb is more than BT_MAX_EVENT_NOTIFY_CB_NUM
              BT_ERROR_DEVICE_EXCEPTION   = 0x10000009,  current bt device has happend exception
              BT_ERROR_RESP_FAIL          = 0x10000010,  at cmd response fail
              BT_ERROR_AVRCP_NO_REG       = 0x10000011,  set absolute volume, but remote device dont register the event
              BT_ERROR_IN_PROGRESS        = 0x10000012,  for non-blocking processing, wait until the corresponding event is reported
              BT_ERROR_OUT_OF_MEMORY      = 0x10000013,  System heap is not enough

int8_t bt_interface_cancel_connect_req(unsigned char *mac)

Cancel with the specified device.

参数:
  • mac[in] Remote device address

返回:

int8_t

int8_t bt_interface_disconnect_req(unsigned char *mac)

Disconnect with the specified device.

参数:
  • mac[in] Remote device address

返回:

int8_t

void bt_interface_set_local_name(int len, void *data)

Change local name.

参数:
  • len[in] Name length

  • data[in] Name

void bt_interface_rd_local_name(void)

Read local name request.

void bt_interface_rd_local_bd_addr(void)

Read local address request.

void bt_interface_exit_sniff_mode(void)

exit sniff mode

void bt_interface_rd_local_rssi(unsigned char *mac)

Read rssi with the specified device.

参数:
  • mac[in] Remote device address

U8 bt_interface_get_current_scan_mode(void)

Read bluetooth’s current scan mode.

返回:

Bluetooth scan mode

uint8_t bt_addr_convert(BTS2S_BD_ADDR *src_addr, uint8_t *addr)

Bluetooth address covert.

参数:
  • src_addr[in] BTS2S_BD_ADDR to uint8_t

  • addr[out] Device mac address (eg:uint8_t mac[6] = {11,22,33,44,55,66})

返回:

uint8_t

BTS2S_BD_ADDR *bt_interface_this_connect_addr(unsigned char *mac)

Read connected address with the type of BTS2S_BD_ADDR.

参数:
  • mac[in] Device mac address(eg:char mac[6] = {11,22,33,44,55,66})

返回:

BTS2S_BD_ADDR

void bt_interface_acl_accept_role_set(U8 role)

Set the local role when acl connection is received.

参数:
  • role[in] Role to be set when acl connection is received

void bt_interface_set_linkpolicy(U16 lp_in, U16 lp_out)

Set the local link policy.

参数:
  • lp_in[in] Link policy to be set

  • lp_out[in] Link policy to be set

void bt_interface_set_sniff_enable(BOOL enable)

Set whether sniff mode is turned on.

参数:
  • enable[in] Whether the flag of sniff mode is enabled or not

void bt_interface_open_avsink(void)

Open the function of a2dp sink.

bt_err_t bt_interface_close_avsink(void)

Close the function of a2dp sink.

返回:

Return whether closing succeeded

void bt_interface_set_a2dp_bqb_test(U8 value)

Set a2dp bqb test model flag.

参数:
  • value[in] A2dp bqb test-case number

void bt_interface_set_audio_device(U8 device_type)

Set audio device type.

参数:
  • device_type[in] Audio device type

U8 bt_interface_get_current_audio_device(void)

Get current audio device type.

返回:

Return current audio device type

U8 bt_interface_get_receive_a2dp_start(void)

Check whether the a2dp start command sent by the mobile phone has been received.

返回:

Return results

void bt_interface_release_a2dp(void)

release a2dp media channel

void bt_interface_unregister_av_snk_sdp(void)

unregister a2dp sink sdp record

void bt_interface_register_av_snk_sdp(void)

register a2dp sink sdp record

void bt_interface_open_avrcp(void)

Open the function of avrcp profile.

void bt_interface_close_avrcp(void)

Close the function of avrcp profile.

void bt_interface_phone_play_next(void)

Control the phone to switch to the next music.

void bt_interface_phone_play(void)

Control the mobile phone to play music.

void bt_interface_phone_play_pause(void)

Control the mobile phone to suspend music.

void bt_interface_phone_play_stop(void)

Control the mobile phone to stop music.

void bt_interface_avrcp_volume_up(void)

Control the phone to turn up the volume.

void bt_interface_avrcp_volume_down(void)

Control the phone to turn down the volume.

void bt_interface_phone_play_previous(void)

Control the phone to switch to the previous music.

bt_err_t bt_interface_avrcp_volume_changed(U8 volume)

Adjust the volume of mobile phone through avrcp.

参数:
  • volume[in] The volume value you want to adjust

返回:

The result of adjusting the volume

bt_err_t bt_interface_set_absolute_volume(U8 volume)

Adjust the absolute volume by avrcp command.

参数:
  • volume[in] The volume value you want to adjust

void bt_interface_set_avrcp_playback_status(U8 playback_status)

Set the playback status of avrcp.

参数:
  • playback_status[in] The playback status of avrcp

void bt_interface_set_can_play(void)

Get the playback status of avrcp.

U8 bt_interface_get_avrcp_playback_status(void)

Get the playback status of avrcp.

返回:

The playback status of avrcp

void bt_interface_open_hid(void)

Open the function of hid profile.

void bt_interface_close_hid(void)

Close the function of hid profile.

void bt_interface_set_hid_device(U8 is_ios)

Set whether the peer device is an ios device.

参数:
  • is_ios[in] IOS device flag

void bt_interface_phone_drag_up(void)

Control the mobile phone to page up.

void bt_interface_phone_drag_down(void)

Control the mobile phone to page down.

void bt_interface_phone_once_click(void)

Control mobile phone click once.

void bt_interface_phone_double_click(void)

Control mobile phone click twice.

void bt_interface_phone_take_picture(void)

Control mobile phone take a picture.

void bt_interface_phone_volume_down(void)

Control the phone to lower the volume.

void bt_interface_add_hid_descriptor(U8 *data, U8 len)

Add hid descriptor.

参数:
  • data[in] The pointer of hid descriptor

  • len[in] The length of hid descriptor

bt_err_t bt_interface_spp_send_data(U8 *data, U16 len, BTS2S_BD_ADDR *bd_addr, U8 srv_chl)

Send data through spp.

参数:
  • data[in] The pointer of spp data

  • len[in] The length of spp data

  • bd_addr[in] The pointer of bd address

  • srv_chl[in] The service channel of spp

返回:

The results of send spp data

bt_err_t bt_interface_add_spp_uuid(U8 *uuid, U8 uuid_len, char *srv_name)

Add spp uuid.

参数:
  • uuid[in] The pointer of spp uuid

  • uuid_len[in] The length of spp uuid

  • srv_name[in] The service name of spp uuid

bt_err_t bt_interface_spp_srv_data_rsp(BTS2S_BD_ADDR *bd_addr, U8 srv_chl)

Send spp data response.

参数:
  • bd_addr[in] The pointer of bd address

  • srv_chl[in] The service channel of spp

返回:

The results of send spp data response

bt_err_t bt_interface_dis_spp_by_addr_and_chl(BTS2S_BD_ADDR *bd_addr, U8 srv_chl)

Disconnect spp by bd address and service channel.

参数:
  • bd_addr[in] The pointer of bd address

  • srv_chl[in] The service channel of spp

返回:

The results of disconnect spp

bt_err_t bt_interface_dis_spp_all(void)

Disconnect all connected spp.

返回:

The results of disconnect spp

void bt_interface_bt_gatt_reg(br_att_sdp_data_t *sdp_info)

This function register gatt’s sdp_info.

参数:
  • sdp_info[in] BLE gatt UUID information

返回:

void

void bt_interface_bt_gatt_unreg(U32 sdp_hdl)

This function unregister gatt’s sdp_info.

参数:
  • sdp_hdl[in] Sdp_hdl is the value when gatt_sdp_register callback

返回:

void

void bt_interface_bt_gatt_mtu_changed(U16 mtu)

Change l2cap config MTU para.

参数:
  • mtu[in] MTU value

返回:

void

void bt_interface_phone_state_changed(HFP_CALL_INFO_T *call_info)

Update phone call state.

参数:
  • call_info[in] Call information

返回:

void

void bt_interface_local_phone_info_res(hfp_phone_number_t *local_phone_num)

Send subscriber number response for AT+CNUM.

参数:
  • local_phone_num[in] Local phone number information

返回:

void

void bt_interface_remote_call_info_res(hfp_remote_calls_info_t *calls_info)

Response for all call info request(AT+CLCC)

参数:
  • calls_info[in] All call information

返回:

void

void bt_interface_get_all_indicator_info_res(hfp_cind_status_t *cind_status)

Response all indicators information for remote device.

参数:
  • cind_status[in] All indicators information

返回:

void

void bt_interface_indicator_status_changed(HFP_IND_INFO_T *ind_info)

Update indicator status.

参数:
  • ind_info[in] indicator information

返回:

void

void bt_interface_spk_vol_change_req(U8 vol)

Update speaker volume.

参数:
  • vol[in] Volume value

返回:

void

void bt_interface_mic_vol_change_req(U8 vol)

Update microphone volume.

参数:
  • vol[in] Volume value

返回:

void

void bt_interface_make_call_res(U8 res)

The response of make_call request.

参数:
  • res[in] OK (0)/ERROR (1)

返回:

void

bt_err_t bt_interface_ag_audio_switch(bt_hfp_audio_switch_t *audio)

Create/Close an audio connection.

参数:
  • bt_hfp_audio_switch_t[in]

返回:

bt_err_t

bt_err_t bt_interface_hfp_hf_start_connecting(unsigned char *mac)

Connect hf profile request.

参数:
  • mac[in] Connect with the specified device address

返回:

bt_err_t

bt_err_t bt_interface_get_ph_num(void)

Get subscriber information request.

返回:

bt_err_t

bt_err_t bt_interface_get_remote_ph_num(void)

Get all call information request.

返回:

bt_err_t

bt_err_t bt_interface_get_remote_call_status(void)

Get current call status (only CIEV) request.

返回:

bt_err_t

bt_err_t bt_interface_hf_out_going_call(int len, void *data)

Place a call using number.

参数:
  • len[in] Phone number length

  • data[in] Phone number

返回:

bt_err_t

bt_err_t bt_interface_start_last_num_dial_req_send(void)

Place call to last dialed number.

返回:

bt_err_t

bt_err_t bt_interface_start_hf_answer_req_send(void)

Answer a call.

返回:

bt_err_t

bt_err_t bt_interface_handup_call(void)

Hang up a call.

返回:

bt_err_t

bt_err_t bt_interface_start_dtmf_req_send(char key)

Transmit DTMF tone.

参数:
  • key[in] DTMF tone

返回:

bt_err_t

bt_err_t bt_interface_hf_3way_hold(bt_3way_coded_t cmd, int idx)

Call hold and multiparty handling AT command.

1 = Releases all active calls (if any exist) and accepts the other (held or waiting) call. 1(idx) = Releases specified active call only ((idx)).

2 = Places all active calls (if any exist) on hold and accepts the other (held or waiting) call. 2(idx) = Request private consultation mode with specified call ((idx)). (Place all calls on hold EXCEPT the call indicated by (idx).)

3 = Adds a held call to the conversation.

4 = Connects the two calls and disconnects the subscriber from both calls (Explicit Call Transfer). Support for this value and its associated functionality is optional for the HF.

参数:
  • cmd[in] this specification only covers values for (n) of 0, 1, 1(idx), 2, 2(idx), 3 and 4, where: 0 = Releases all held calls or sets User Determined User Busy (UDUB) for a waiting call.

  • idx[in] current call index

返回:

bt_err_t

bt_err_t bt_interface_hf_3way_btrh(bt_3way_incom_t cmd)

Query response and hold status.

参数:
  • cmd[in] cmd

返回:

bt_err_t

bt_err_t bt_interface_hf_3way_ccwa(unsigned int enable)

Call waiting notification control.

参数:
  • enable[in] Enable(1)/Disable(0)call waiting notification

返回:

bt_err_t

bt_err_t bt_interface_voice_recog(uint8_t flag)

Voice recognition control.

参数:
  • flag[in] Enable(1)/Disable(0)voice recognition

返回:

bt_err_t

bt_err_t bt_interface_audio_switch(U8 type)

Create/Close an audio connection.

参数:
  • type[in] Create(0)/Close(1) an audio connection

返回:

bt_err_t

bt_err_t bt_interface_set_speaker_volume(int volume)

Speaker volume control.

参数:
  • volume[in] Volume value

返回:

bt_err_t

bt_err_t bt_interface_hf_update_battery(U8 batt_val)

Update device battery value.

参数:
  • batt_val[in] Current battery value

返回:

bt_err_t

bt_err_t bt_interface_set_wbs_status(U8 status)

Codec negotiation control.

参数:
  • status[in] Enable(1)/Disable(0)codec negotiation

返回:

bt_err_t

void bt_interface_bt_event_notify(uint16_t type, uint16_t event_id, void *data, uint16_t data_len)

BT event notify callback function.

参数:
  • type[in] Event module_id

  • event_id[in] Event identifier

  • data[in] Event result

  • data_len[in] Event result data length

返回:

void

bt_interface_status_t bt_interface_register_bt_event_notify_callback(register_bt_notify_func_t func)

This function is called to register to bt notify callback.

参数:
  • func[in] Need register function

返回:

bt_interface_status_t

bt_interface_status_t bt_interface_unregister_bt_event_notify_callback(register_bt_notify_func_t func)

This function is called to unregister to bt notify callback.

参数:
  • func[in] Need unregister function

返回:

bt_interface_status_t

struct bt_notify_register_callback_t

Public Members

register_bt_notify_func_t function
struct bt_notify_register_callback_t *next

bts2_app_interface_type.h

警告

doxygenfile: Cannot find file “bts2_app_interface_type.h