/*******************************************************************************
**
** Function         btif_hf_client_execute_service
**
** Description      Initializes/Shuts down the service
**
** Returns          BT_STATUS_SUCCESS on success, BT_STATUS_FAIL otherwise
**
*******************************************************************************/
bt_status_t btif_hf_client_execute_service(BOOLEAN b_enable)
{
    BTIF_TRACE_EVENT("%s enable:%d", __FUNCTION__, b_enable);

    property_get("ro.bluetooth.hfp.ver", btif_hf_client_version, "1.5");

     if (b_enable)
     {
          /* Enable and register with BTA-HFClient */
          BTA_HfClientEnable(bte_hf_client_evt);
          if (strcmp(btif_hf_client_version, "1.6") == 0)
          {
              BTIF_TRACE_EVENT("Support Codec Nego. %d ", BTIF_HF_CLIENT_FEATURES);
              BTA_HfClientRegister(BTIF_HF_CLIENT_SECURITY, BTIF_HF_CLIENT_FEATURES,
                      BTIF_HF_CLIENT_SERVICE_NAME);
          }
          else
          {
              BTIF_TRACE_EVENT("No Codec Nego Supported");
              btif_hf_client_features = BTIF_HF_CLIENT_FEATURES;
              btif_hf_client_features = btif_hf_client_features & (~BTA_HF_CLIENT_FEAT_CODEC);
              BTIF_TRACE_EVENT("btif_hf_client_features is   %d", btif_hf_client_features);
              BTA_HfClientRegister(BTIF_HF_CLIENT_SECURITY, btif_hf_client_features,
                      BTIF_HF_CLIENT_SERVICE_NAME);
          }

     }
     else
     {
         BTA_HfClientDeregister(btif_hf_client_cb.handle);
         BTA_HfClientDisable();
     }
     return BT_STATUS_SUCCESS;
}
Ejemplo n.º 2
0
static bt_status_t connect( bt_bdaddr_t *bd_addr )
{
    BTIF_TRACE_EVENT("HFP Client version is  %s", btif_hf_client_version);
    CHECK_BTHF_CLIENT_INIT();
    return btif_queue_connect(UUID_SERVCLASS_HF_HANDSFREE, bd_addr, connect_int);

}
static void btif_in_pan_generic_evt(UINT16 event, char *p_param)
{
    BTIF_TRACE_EVENT("%s: event=%d", __FUNCTION__, event);
    switch (event) {
        case BTIF_PAN_CB_DISCONNECTING:
        {
            bt_bdaddr_t *bd_addr = (bt_bdaddr_t*)p_param;
            btpan_conn_t* conn = btpan_find_conn_addr(bd_addr->address);
            int btpan_conn_local_role;
            int btpan_remote_role;
            asrt(conn != NULL);
            if (conn) {
                btpan_conn_local_role = bta_role_to_btpan(conn->local_role);
                btpan_remote_role = bta_role_to_btpan(conn->remote_role);
                callback.connection_state_cb(BTPAN_STATE_DISCONNECTING, BT_STATUS_SUCCESS,
                        (const bt_bdaddr_t*)conn->peer, btpan_conn_local_role, btpan_remote_role);
            }
        } break;
        default:
        {
            BTIF_TRACE_WARNING("%s : Unknown event 0x%x", __FUNCTION__, event);
        }
        break;
    }
}
Ejemplo n.º 4
0
/*******************************************************************************
**
** Function         send_at_cmd
**
** Description      Send requested AT command to rempte device.
**
** Returns          bt_status_t
**
*******************************************************************************/
static bt_status_t send_at_cmd(int cmd,int val1,int val2,const char *arg)
{
    CHECK_BTHF_CLIENT_SLC_CONNECTED();
    BTIF_TRACE_EVENT("%s Cmd %d val1 %d val2 %d arg %s",
            __FUNCTION__,cmd,val1,val2,arg);
    BTA_HfClientSendAT(btif_hf_client_cb.handle, cmd, val1, val2, arg);

    return BT_STATUS_SUCCESS;
}
Ejemplo n.º 5
0
/*******************************************************************************
**
** Function         cleanup
**
** Description      Closes the HF interface
**
** Returns          bt_status_t
**
*******************************************************************************/
static void  cleanup( void )
{
    BTIF_TRACE_EVENT("%s", __FUNCTION__);

    if (bt_hf_client_callbacks)
    {
        btif_disable_service(BTA_HFP_HS_SERVICE_ID);
        bt_hf_client_callbacks = NULL;
    }
}
Ejemplo n.º 6
0
static bt_status_t get_remote_mas_instances(bt_bdaddr_t *bd_addr)
{
    bdstr_t bdstr;

    BTIF_TRACE_EVENT("%s: remote_addr=%s", __FUNCTION__, bd2str(bd_addr, &bdstr));

    BTA_MceGetRemoteMasInstances(bd_addr->address);

    return BT_STATUS_SUCCESS;
}
Ejemplo n.º 7
0
static bt_status_t init(btmce_callbacks_t* callbacks)
{
    BTIF_TRACE_EVENT("%s", __FUNCTION__);

    bt_mce_callbacks = callbacks;

    btif_enable_service(BTA_MAP_SERVICE_ID);

    return BT_STATUS_SUCCESS;
}
Ejemplo n.º 8
0
/*******************************************************************************
**
** Function         btif_hf_client_execute_service
**
** Description      Initializes/Shuts down the service
**
** Returns          BT_STATUS_SUCCESS on success, BT_STATUS_FAIL otherwise
**
*******************************************************************************/
bt_status_t btif_hf_client_execute_service(BOOLEAN b_enable)
{
    BTIF_TRACE_EVENT("%s enable:%d", __FUNCTION__, b_enable);

/**
 * TODO(armansito): On OSs other than Android, the sys/properties.h system
 * does not exist. Since that is how the HFP version is currently obtained, on
 * systems other than Android we're hardcoding the version to 1.5 above.
 */
#if !defined(OS_GENERIC)
    property_get("ro.bluetooth.hfp.ver", btif_hf_client_version, "1.5");
#endif  /* !defined(OS_GENERIC) */

     if (b_enable)
     {
          /* Enable and register with BTA-HFClient */
          BTA_HfClientEnable(bte_hf_client_evt);
          if (strcmp(btif_hf_client_version, "1.6") == 0)
          {
              BTIF_TRACE_EVENT("Support Codec Nego. %d ", BTIF_HF_CLIENT_FEATURES);
              BTA_HfClientRegister(BTIF_HF_CLIENT_SECURITY, BTIF_HF_CLIENT_FEATURES,
                      BTIF_HF_CLIENT_SERVICE_NAME);
          }
          else
          {
              BTIF_TRACE_EVENT("No Codec Nego Supported");
              btif_hf_client_features = BTIF_HF_CLIENT_FEATURES;
              btif_hf_client_features = btif_hf_client_features & (~BTA_HF_CLIENT_FEAT_CODEC);
              BTIF_TRACE_EVENT("btif_hf_client_features is   %d", btif_hf_client_features);
              BTA_HfClientRegister(BTIF_HF_CLIENT_SECURITY, btif_hf_client_features,
                      BTIF_HF_CLIENT_SERVICE_NAME);
          }

     }
     else
     {
         BTA_HfClientDeregister(btif_hf_client_cb.handle);
         BTA_HfClientDisable();
     }
     return BT_STATUS_SUCCESS;
}
Ejemplo n.º 9
0
/*******************************************************************************
**
** Function         btif_hf_client_init
**
** Description     initializes the hf interface
**
** Returns         bt_status_t
**
*******************************************************************************/
static bt_status_t init( bthf_client_callbacks_t* callbacks )
{
    BTIF_TRACE_EVENT("%s", __FUNCTION__);

    bt_hf_client_callbacks = callbacks;

    btif_enable_service(BTA_HFP_HS_SERVICE_ID);

    clear_state();

    return BT_STATUS_SUCCESS;
}
Ejemplo n.º 10
0
/*******************************************************************************
**
** Function         btif_mce_execute_service
**
** Description      Initializes/Shuts down the service
**
** Returns          BT_STATUS_SUCCESS on success, BT_STATUS_FAIL otherwise
**
*******************************************************************************/
bt_status_t btif_mce_execute_service(BOOLEAN b_enable)
{
    BTIF_TRACE_EVENT("%s enable:%d", __FUNCTION__, b_enable);

     if (b_enable)
     {
         BTA_MceEnable(mce_dm_cback);
     }
     else
     {
         /* This is called on BT disable so no need to extra cleanup */
     }
     return BT_STATUS_SUCCESS;
}
Ejemplo n.º 11
0
/*******************************************************************************
**
** Function        btif_in_hf_client_generic_evt
**
** Description     Processes generic events to be sent to JNI that are not triggered from the BTA.
**                 Always runs in BTIF context
**
** Returns          void
**
*******************************************************************************/
static void btif_in_hf_client_generic_evt(UINT16 event, char *p_param)
{
    UNUSED(p_param);

    BTIF_TRACE_EVENT("%s: event=%d", __FUNCTION__, event);
    switch (event) {
        case BTIF_HF_CLIENT_CB_AUDIO_CONNECTING:
        {
            HAL_CBACK(bt_hf_client_callbacks, audio_state_cb, (bthf_client_audio_state_t)BTHF_AUDIO_STATE_CONNECTING,
                      &btif_hf_client_cb.connected_bda);
        } break;
        default:
        {
            BTIF_TRACE_WARNING("%s : Unknown event 0x%x", __FUNCTION__, event);
        }
        break;
    }
}
Ejemplo n.º 12
0
static void btif_mce_mas_discovery_comp_evt(UINT16 event, char *p_param)
{
    tBTA_MCE_MAS_DISCOVERY_COMP *evt_data = (tBTA_MCE_MAS_DISCOVERY_COMP*) p_param;
    btmce_mas_instance_t insts[BTA_MCE_MAX_MAS_INSTANCES];
    bt_bdaddr_t addr;
    int i;

    BTIF_TRACE_EVENT("%s:  event = %d", __FUNCTION__, event);

    if (event != BTA_MCE_MAS_DISCOVERY_COMP_EVT)
        return;

    for (i = 0; i < evt_data->num_mas; i++)
    {
        insts[i].id = evt_data->mas[i].instance_id;
        insts[i].scn = evt_data->mas[i].scn;
        insts[i].msg_types = evt_data->mas[i].msg_type;
        insts[i].p_name = evt_data->mas[i].p_srv_name;
    }

    bdcpy(addr.address, evt_data->remote_addr);

    HAL_CBACK(bt_mce_callbacks, remote_mas_instances_cb, evt_data->status, &addr, evt_data->num_mas, insts);
}
Ejemplo n.º 13
0
/*******************************************************************************
**
** Function         btif_hf_get_interface
**
** Description      Get the hf callback interface
**
** Returns          bthf_interface_t
**
*******************************************************************************/
const bthf_client_interface_t *btif_hf_client_get_interface(void)
{
    BTIF_TRACE_EVENT("%s", __FUNCTION__);
    return &bthfClientInterface;
}
Ejemplo n.º 14
0
const btgap_interface_t *btif_gap_get_interface(void)
{
    BTIF_TRACE_EVENT("%s", __FUNCTION__);
    return &btgapInterface;
}
Ejemplo n.º 15
0
const btmce_interface_t *btif_mce_get_interface(void)
{
    BTIF_TRACE_EVENT("%s", __FUNCTION__);
    return &mce_if;
}