/*******************************************************************************
**
** 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;
}
Esempio n. 2
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;
}