/*******************************************************************************
**
** Function         BTA_HfClientSendAT
**
** Description      send AT command
**
**
** Returns          void
**
*******************************************************************************/
BTA_API void BTA_HfClientSendAT(UINT16 handle, tBTA_HF_CLIENT_AT_CMD_TYPE at, UINT32 val1, UINT32 val2, const char *str)
{
    tBTA_HF_CLIENT_DATA_VAL  *p_buf;

    if ((p_buf = (tBTA_HF_CLIENT_DATA_VAL *) GKI_getbuf(sizeof(tBTA_HF_CLIENT_DATA_VAL))) != NULL)
    {
        p_buf->hdr.event = BTA_HF_CLIENT_SEND_AT_CMD_EVT;
        p_buf->uint8_val = at;
        p_buf->uint32_val1 = val1;
        p_buf->uint32_val2 = val2;

        if (str)
        {
            strlcpy(p_buf->str, str, BTA_HF_CLIENT_NUMBER_LEN + 1);
            p_buf->str[BTA_HF_CLIENT_NUMBER_LEN] = '\0';
        }
        else
        {
            p_buf->str[0] = '\0';
        }

        p_buf->hdr.layer_specific = handle;
        bta_sys_sendmsg(p_buf);
    }
}
/*******************************************************************************
**
** Function         BTA_HfClientEnable
**
** Description      Enable the HF CLient service. When the enable
**                  operation is complete the callback function will be
**                  called with a BTA_HF_CLIENT_ENABLE_EVT. This function must
**                  be called before other function in the HF CLient API are
**                  called.
**
** Returns          BTA_SUCCESS if OK, BTA_FAILURE otherwise.
**
*******************************************************************************/
BTA_API tBTA_STATUS BTA_HfClientEnable(tBTA_HF_CLIENT_CBACK *p_cback)
{
    tBTA_HF_CLIENT_API_ENABLE  *p_buf;
    UINT8       idx;

    if (bta_sys_is_register (BTA_ID_HS))
    {
        APPL_TRACE_ERROR0("BTA HF Client is already enabled, ignoring ...");
        return BTA_FAILURE;
    }

    /* register with BTA system manager */
    GKI_sched_lock();
    bta_sys_register(BTA_ID_HS, &bta_hf_client_reg);
    GKI_sched_unlock();

    if ((p_buf = (tBTA_HF_CLIENT_API_ENABLE *) GKI_getbuf(sizeof(tBTA_HF_CLIENT_API_ENABLE))) != NULL)
    {
        p_buf->hdr.event = BTA_HF_CLIENT_API_ENABLE_EVT;
        p_buf->p_cback = p_cback;
        bta_sys_sendmsg(p_buf);
    }

    return BTA_SUCCESS;
}
/*******************************************************************************
**
** Function         bta_pan_conn_state_cback
**
** Description      Connection state callback from Pan profile
**
**
** Returns          void
**
*******************************************************************************/
static void bta_pan_conn_state_cback(UINT16 handle, BD_ADDR bd_addr, tPAN_RESULT state,
                                     BOOLEAN is_role_change, UINT8 src_role, UINT8 dst_role)
{

    tBTA_PAN_CONN * p_buf;
    tBTA_PAN_SCB     *p_scb;


    if ((p_buf = (tBTA_PAN_CONN *) GKI_getbuf(sizeof(tBTA_PAN_CONN))) != NULL)
    {
        if((state == PAN_SUCCESS) && !is_role_change)
        {
            p_buf->hdr.event = BTA_PAN_CONN_OPEN_EVT;
            if((p_scb = bta_pan_scb_by_handle(handle)) == NULL)
            {
                /* allocate an scb */
                p_scb = bta_pan_scb_alloc();

            }
            /* we have exceeded maximum number of connections */
            if(!p_scb)
            {
                PAN_Disconnect (handle);
                return;
            }

            p_scb->handle = handle;
            p_scb->local_role = src_role;
            p_scb->peer_role = dst_role;
            p_scb->pan_flow_enable = TRUE;
            bdcpy(p_scb->bd_addr, bd_addr);
            GKI_init_q(&p_scb->data_queue);

            if(src_role == PAN_ROLE_CLIENT)
                p_scb->app_id = bta_pan_cb.app_id[0];
            else if (src_role == PAN_ROLE_GN_SERVER)
                p_scb->app_id = bta_pan_cb.app_id[1];
            else if (src_role == PAN_ROLE_NAP_SERVER)
                p_scb->app_id = bta_pan_cb.app_id[2];

        }
        else if((state != PAN_SUCCESS) && !is_role_change)
        {
            p_buf->hdr.event = BTA_PAN_CONN_CLOSE_EVT;

        }
        else
        {
            return;
        }

        p_buf->result = state;
        p_buf->hdr.layer_specific = handle;
        bta_sys_sendmsg(p_buf);

    }



}
示例#4
0
/*******************************************************************************
**
** Function         BTA_AgRegister
**
** Description      Register an Audio Gateway service.
**
**
** Returns          void
**
*******************************************************************************/
void BTA_AgRegister(tBTA_SERVICE_MASK services, tBTA_SEC sec_mask,tBTA_AG_FEAT features,
                  char * p_service_names[], UINT8 app_id)
{
    tBTA_AG_API_REGISTER    *p_buf;
    int                     i;

    if ((p_buf = (tBTA_AG_API_REGISTER *) GKI_getbuf(sizeof(tBTA_AG_API_REGISTER))) != NULL)
    {
        p_buf->hdr.event = BTA_AG_API_REGISTER_EVT;
        p_buf->features = features;
        p_buf->sec_mask = sec_mask;
        p_buf->services = services;
        p_buf->app_id = app_id;
        for (i = 0; i < BTA_AG_NUM_IDX; i++)
        {
            if(p_service_names[i])
            {
                BCM_STRNCPY_S(p_buf->p_name[i], BTA_SERVICE_NAME_LEN+1, p_service_names[i], BTA_SERVICE_NAME_LEN);
                p_buf->p_name[i][BTA_SERVICE_NAME_LEN] = 0;
            }
            else
            {
                p_buf->p_name[i][0] = 0;
            }
        }
        bta_sys_sendmsg(p_buf);
    }
}
示例#5
0
/*******************************************************************************
**
** Function         BTA_AgEnable
**
** Description      Enable the audio gateway service. When the enable
**                  operation is complete the callback function will be
**                  called with a BTA_AG_ENABLE_EVT. This function must
**                  be called before other function in the AG API are
**                  called.
**
** Returns          BTA_SUCCESS if OK, BTA_FAILURE otherwise.
**
*******************************************************************************/
tBTA_STATUS BTA_AgEnable(tBTA_AG_PARSE_MODE parse_mode, tBTA_AG_CBACK *p_cback)
{
    tBTA_AG_API_ENABLE  *p_buf;
    UINT8       idx;

    /* Error if AG is already enabled, or AG is in the middle of disabling. */
    for (idx = 0; idx < BTA_AG_NUM_SCB; idx++)
    {
        if (bta_ag_cb.scb[idx].in_use)
        {
            APPL_TRACE_ERROR0 ("BTA_AgEnable: FAILED, AG already enabled.");
            return BTA_FAILURE;
        }
    }

    /* register with BTA system manager */
    GKI_sched_lock();
    bta_sys_register(BTA_ID_AG, &bta_ag_reg);
    GKI_sched_unlock();

    if ((p_buf = (tBTA_AG_API_ENABLE *) GKI_getbuf(sizeof(tBTA_AG_API_ENABLE))) != NULL)
    {
        p_buf->hdr.event = BTA_AG_API_ENABLE_EVT;
        p_buf->parse_mode = parse_mode;
        p_buf->p_cback = p_cback;
        bta_sys_sendmsg(p_buf);
    }

    return BTA_SUCCESS;

}
/*******************************************************************************
**
** Function         bta_pan_data_flow_cb
**
** Description      Data flow status callback from PAN
**
**
** Returns          void
**
*******************************************************************************/
static void bta_pan_data_flow_cb(UINT16 handle, tPAN_RESULT result)
{
    BT_HDR  *p_buf;
    tBTA_PAN_SCB *p_scb;

    if((p_scb = bta_pan_scb_by_handle(handle)) == NULL)
        return;

    if(result == PAN_TX_FLOW_ON)
    {
        if ((p_buf = (BT_HDR *) GKI_getbuf(sizeof(BT_HDR))) != NULL)
        {
            p_buf->layer_specific = handle;
            p_buf->event = BTA_PAN_BNEP_FLOW_ENABLE_EVT;
            bta_sys_sendmsg(p_buf);
        }
        bta_pan_co_rx_flow(handle, p_scb->app_id, TRUE);

    }
    else if(result == PAN_TX_FLOW_OFF)
    {

        p_scb->pan_flow_enable = FALSE;
        bta_pan_co_rx_flow(handle, p_scb->app_id, FALSE);

    }


}
示例#7
0
/*******************************************************************************
**
** Function         bta_ag_sdp_cback
**
** Description      SDP callback function.
**
**
** Returns          void
**
*******************************************************************************/
static void bta_ag_sdp_cback(UINT16 status, UINT8 idx)
{
    tBTA_AG_DISC_RESULT *p_buf;
    UINT16              event;
    tBTA_AG_SCB         *p_scb;

    APPL_TRACE_DEBUG("bta_ag_sdp_cback status:0x%x", status);

    if ((p_scb = bta_ag_scb_by_idx(idx)) != NULL)
    {
        /* set event according to int/acp */
        if (p_scb->role == BTA_AG_ACP)
        {
            event = BTA_AG_DISC_ACP_RES_EVT;
        }
        else
        {
            event = BTA_AG_DISC_INT_RES_EVT;
        }

        if ((p_buf = (tBTA_AG_DISC_RESULT *) GKI_getbuf(sizeof(tBTA_AG_DISC_RESULT))) != NULL)
        {
            p_buf->hdr.event = event;
            p_buf->hdr.layer_specific = idx;
            p_buf->status = status;
            bta_sys_sendmsg(p_buf);
        }
    }
}
示例#8
0
/*******************************************************************************
**
** Function         BTA_GpsDisable
**
** Description      
**                  
**
** Returns          void
**
*******************************************************************************/
void BTA_GpsDisable()
{      
    BT_HDR  *p_buf;
    if ((p_buf = (BT_HDR *) GKI_getbuf(sizeof(BT_HDR))) != NULL)
    {
        p_buf->event = 9473;
        bta_sys_sendmsg(p_buf);
    }
}
/*******************************************************************************
**
** Function         ptim_timer_update
**
** Description      Update the protocol timer list and handle expired timers.
**                  This function is called from the task running the protocol
**                  timers when the periodic GKI timer expires.
**
** Returns          void
**
*******************************************************************************/
void ptim_timer_update(tPTIM_CB *p_cb)
{
    TIMER_LIST_ENT *p_tle;
    BT_HDR *p_msg;
    UINT32 new_ticks_count;
    INT32  period_in_ticks;

    /* To handle the case when the function is called less frequently than the period
       we must convert determine the number of ticks since the last update, then
       convert back to milliseconds before updating timer list */
    new_ticks_count = GKI_get_tick_count();

    /* Check for wrapped condition */
    if (new_ticks_count >= p_cb->last_gki_ticks)
    {
        period_in_ticks = (INT32)(new_ticks_count - p_cb->last_gki_ticks);
    }
    else
    {
        period_in_ticks = (INT32)(((UINT32)0xffffffff - p_cb->last_gki_ticks)
                            + new_ticks_count + 1);
    }

    /* update timer list */
    GKI_update_timer_list(&p_cb->timer_queue, GKI_TICKS_TO_MS(period_in_ticks));

    p_cb->last_gki_ticks = new_ticks_count;

    /* while there are expired timers */
    while((p_cb->timer_queue.p_first) && (p_cb->timer_queue.p_first->ticks <= 0))
    {
        /* removed expired timer from list */
        p_tle = p_cb->timer_queue.p_first;
        GKI_remove_from_timer_list(&p_cb->timer_queue, p_tle);

        /* call timer callback */
        if(p_tle->p_cback)
        {
            (*p_tle->p_cback)(p_tle);
        }
        else if(p_tle->event)
        {
            if ((p_msg = (BT_HDR *) GKI_getbuf(sizeof(BT_HDR))) != NULL)
            {
                p_msg->event = p_tle->event;
                p_msg->layer_specific = 0;
                bta_sys_sendmsg(p_msg);
            }
        }
    }

    /* if timer list is empty stop periodic GKI timer */
    if (p_cb->timer_queue.p_first == NULL)
    {
        GKI_stop_timer(p_cb->timer_id);
    }
}
示例#10
0
/*******************************************************************************
**
** Function         BTA_AvStart
**
** Description      Start audio/video stream data transfer.
**
** Returns          void
**
*******************************************************************************/
void BTA_AvStart(void)
{
    BT_HDR  *p_buf;

    if ((p_buf = (BT_HDR *) GKI_getbuf(sizeof(BT_HDR))) != NULL) {
        p_buf->event = BTA_AV_API_START_EVT;
        bta_sys_sendmsg(p_buf);
    }
}
示例#11
0
/*******************************************************************************
**
** Function         BTA_HdRegisterApp
**
** Description      This function is called when application should be registered
**
** Returns          void
**
*******************************************************************************/
extern void BTA_HdRegisterApp(tBTA_HD_APP_INFO *p_app_info, tBTA_HD_QOS_INFO *p_in_qos,
                                            tBTA_HD_QOS_INFO *p_out_qos)
{
    tBTA_HD_REGISTER_APP *p_buf;

    APPL_TRACE_API("%s", __FUNCTION__);

    if ((p_buf = (tBTA_HD_REGISTER_APP *) GKI_getbuf(sizeof(tBTA_HD_REGISTER_APP))) != NULL)
    {
        p_buf->hdr.event = BTA_HD_API_REGISTER_APP_EVT;

        if (p_app_info->p_name)
        {
            BCM_STRNCPY_S(p_buf->name, sizeof(p_buf->name),
                p_app_info->p_name, BTA_HD_APP_NAME_LEN);
            p_buf->name[BTA_HD_APP_NAME_LEN] = '\0';
        }
        else
        {
            p_buf->name[0]= '\0';
        }

        if (p_app_info->p_description)
        {
            BCM_STRNCPY_S(p_buf->description, sizeof(p_buf->description), p_app_info->p_description,
                BTA_HD_APP_DESCRIPTION_LEN);
            p_buf->description[BTA_HD_APP_DESCRIPTION_LEN] = '\0';
        }
        else
        {
            p_buf->description[0]= '\0';
        }

        if (p_app_info->p_provider)
        {
            BCM_STRNCPY_S(p_buf->provider, sizeof(p_buf->provider), p_app_info->p_provider,
                BTA_HD_APP_PROVIDER_LEN);
            p_buf->provider[BTA_HD_APP_PROVIDER_LEN] = '\0';
        }
        else
        {
            p_buf->provider[0]= '\0';
        }

        p_buf->subclass = p_app_info->subclass;

        p_buf->d_len = p_app_info->descriptor.dl_len;
        memcpy(p_buf->d_data, p_app_info->descriptor.dsc_list, p_app_info->descriptor.dl_len);

        // copy qos data as-is
        memcpy(&p_buf->in_qos, p_in_qos, sizeof(tBTA_HD_QOS_INFO));
        memcpy(&p_buf->out_qos, p_out_qos, sizeof(tBTA_HD_QOS_INFO));

        bta_sys_sendmsg(p_buf);
    }
}
/*******************************************************************************
**
** Function         bta_pan_tx_path
**
** Description      Handle the TX data path (data sent from BTA to the phone).
**
**
** Returns          void
**
*******************************************************************************/
void bta_pan_tx_path(tBTA_PAN_SCB *p_scb, tBTA_PAN_DATA *p_data)
{

    BT_HDR * p_buf;
    /* if data path configured for tx pull */
    if ((bta_pan_cb.flow_mask & BTA_PAN_TX_MASK) == BTA_PAN_TX_PULL)
    {
        bta_pan_pm_conn_busy(p_scb);
        /* call application callout function for tx path */
        bta_pan_co_tx_path(p_scb->handle, p_scb->app_id);

        /* free data that exceeds queue level */
        while(p_scb->data_queue.count > bta_pan_cb.q_level)
            GKI_freebuf(GKI_dequeue(&p_scb->data_queue));
        bta_pan_pm_conn_idle(p_scb);
    }
    /* if configured for zero copy push */
    else if ((bta_pan_cb.flow_mask & BTA_PAN_TX_MASK) == BTA_PAN_TX_PUSH_BUF)
    {
        /* if app can accept data */
        if (p_scb->app_flow_enable == TRUE)
        {
            /* read data from the queue */
            if ((p_buf = (BT_HDR *)GKI_dequeue(&p_scb->data_queue)) != NULL)
            {
                /* send data to application */
                bta_pan_co_tx_writebuf(p_scb->handle,
                                        p_scb->app_id,
                                        ((tBTA_PAN_DATA_PARAMS *)p_buf)->src,
                                        ((tBTA_PAN_DATA_PARAMS *)p_buf)->dst,
                                        ((tBTA_PAN_DATA_PARAMS *)p_buf)->protocol,
                                        p_buf,
                                        ((tBTA_PAN_DATA_PARAMS *)p_buf)->ext,
                                        ((tBTA_PAN_DATA_PARAMS *)p_buf)->forward);

            }
            /* free data that exceeds queue level  */
            while(p_scb->data_queue.count > bta_pan_cb.q_level)
                GKI_freebuf(GKI_dequeue(&p_scb->data_queue));

            /* if there is more data to be passed to
            upper layer */
            if(p_scb->data_queue.count)
            {
                if ((p_buf = (BT_HDR *) GKI_getbuf(sizeof(BT_HDR))) != NULL)
                {
                    p_buf->layer_specific = p_scb->handle;
                    p_buf->event = BTA_PAN_RX_FROM_BNEP_READY_EVT;
                    bta_sys_sendmsg(p_buf);
                }

            }

        }
    }
}
示例#13
0
/*******************************************************************************
**
** Function         BTA_AvOpenRc
**
** Description      Open an AVRCP connection toward the device with the
**                  specified handle
**
** Returns          void
**
*******************************************************************************/
void BTA_AvOpenRc(tBTA_AV_HNDL handle)
{
    tBTA_AV_API_OPEN_RC  *p_buf;

    if ((p_buf = (tBTA_AV_API_OPEN_RC *) GKI_getbuf(sizeof(tBTA_AV_API_OPEN_RC))) != NULL) {
        p_buf->hdr.event = BTA_AV_API_RC_OPEN_EVT;
        p_buf->hdr.layer_specific   = handle;
        bta_sys_sendmsg(p_buf);
    }
}
示例#14
0
/*******************************************************************************
**
** Function         BTA_AvClose
**
** Description      Close the current streams.
**
** Returns          void
**
*******************************************************************************/
void BTA_AvClose(tBTA_AV_HNDL handle)
{
    BT_HDR  *p_buf;

    if ((p_buf = (BT_HDR *) GKI_getbuf(sizeof(BT_HDR))) != NULL) {
        p_buf->event = BTA_AV_API_CLOSE_EVT;
        p_buf->layer_specific   = handle;
        bta_sys_sendmsg(p_buf);
    }
}
示例#15
0
/*******************************************************************************
**
** Function         BTA_AvDisconnect
**
** Description      Close the connection to the address.
**
** Returns          void
**
*******************************************************************************/
void BTA_AvDisconnect(BD_ADDR bd_addr)
{
    tBTA_AV_API_DISCNT  *p_buf;

    if ((p_buf = (tBTA_AV_API_DISCNT *) GKI_getbuf(sizeof(tBTA_AV_API_DISCNT))) != NULL) {
        p_buf->hdr.event = BTA_AV_API_DISCONNECT_EVT;
        bdcpy(p_buf->bd_addr, bd_addr);
        bta_sys_sendmsg(p_buf);
    }
}
示例#16
0
/*******************************************************************************
**
** Function         BTA_AgDisable
**
** Description      Disable the audio gateway service
**
**
** Returns          void
**
*******************************************************************************/
void BTA_AgDisable(void)
{
    BT_HDR  *p_buf;

    if ((p_buf = (BT_HDR *) GKI_getbuf(sizeof(BT_HDR))) != NULL)
    {
        p_buf->event = BTA_AG_API_DISABLE_EVT;
        bta_sys_sendmsg(p_buf);
    }
}
示例#17
0
/*******************************************************************************
**
** Function         BTA_AvDeregister
**
** Description      Deregister the audio or video service
**
** Returns          void
**
*******************************************************************************/
void BTA_AvDeregister(tBTA_AV_HNDL hndl)
{
    BT_HDR  *p_buf;

    if ((p_buf = (BT_HDR *) GKI_getbuf(sizeof(BT_HDR))) != NULL) {
        p_buf->layer_specific   = hndl;
        p_buf->event = BTA_AV_API_DEREGISTER_EVT;
        bta_sys_sendmsg(p_buf);
    }
}
示例#18
0
/*******************************************************************************
**
** Function         BTA_AvCloseRc
**
** Description      Close an AVRCP connection
**
** Returns          void
**
*******************************************************************************/
void BTA_AvCloseRc(UINT8 rc_handle)
{
    tBTA_AV_API_CLOSE_RC  *p_buf;

    if ((p_buf = (tBTA_AV_API_CLOSE_RC *) GKI_getbuf(sizeof(tBTA_AV_API_CLOSE_RC))) != NULL) {
        p_buf->hdr.event = BTA_AV_API_RC_CLOSE_EVT;
        p_buf->hdr.layer_specific   = rc_handle;
        bta_sys_sendmsg(p_buf);
    }
}
示例#19
0
/*******************************************************************************
**
** Function         BTA_AvDisable
**
** Description      Disable the advanced audio/video service.
**
** Returns          void
**
*******************************************************************************/
void BTA_AvDisable(void)
{
    BT_HDR  *p_buf;

    bta_sys_deregister(BTA_ID_AV);
    if ((p_buf = (BT_HDR *) GKI_getbuf(sizeof(BT_HDR))) != NULL) {
        p_buf->event = BTA_AV_API_DISABLE_EVT;
        bta_sys_sendmsg(p_buf);
    }
}
示例#20
0
/*******************************************************************************
**
** Function         BTA_PanSetRole
**
** Description      Sets PAN roles. When the enable operation is complete
**                  the callback function will be called with a BTA_PAN_SET_ROLE_EVT.
**
** Returns          void
**
*******************************************************************************/
void BTA_PanSetRole(tBTA_PAN_ROLE role, tBTA_PAN_ROLE_INFO *p_user_info, tBTA_PAN_ROLE_INFO *p_gn_info,
                                        tBTA_PAN_ROLE_INFO *p_nap_info)
{

    tBTA_PAN_API_SET_ROLE  *p_buf;

    if ((p_buf = (tBTA_PAN_API_SET_ROLE *) GKI_getbuf(sizeof(tBTA_PAN_API_SET_ROLE))) != NULL)
    {
        p_buf->hdr.event = BTA_PAN_API_SET_ROLE_EVT;
        p_buf->role = role;

        if(p_user_info && (role & BTA_PAN_ROLE_PANU))
        {
            if(p_user_info->p_srv_name)
                BCM_STRNCPY_S(p_buf->user_name, sizeof(p_buf->user_name), p_user_info->p_srv_name, BTA_SERVICE_NAME_LEN);
            else
                p_buf->user_name[0] = 0;

            p_buf->user_name[BTA_SERVICE_NAME_LEN] = 0;
            p_buf->user_app_id = p_user_info->app_id;
            p_buf->user_sec_mask = p_user_info->sec_mask;
        }

        if(p_gn_info && (role & BTA_PAN_ROLE_GN))
        {
            if(p_gn_info->p_srv_name)
                BCM_STRNCPY_S(p_buf->gn_name, sizeof(p_buf->gn_name), p_gn_info->p_srv_name, BTA_SERVICE_NAME_LEN);
            else
                p_buf->gn_name[0] = 0;

            p_buf->gn_name[BTA_SERVICE_NAME_LEN] = 0;
            p_buf->gn_app_id = p_gn_info->app_id;
            p_buf->gn_sec_mask = p_gn_info->sec_mask;

        }

        if(p_nap_info && (role & BTA_PAN_ROLE_NAP))
        {
            if(p_nap_info->p_srv_name)
                BCM_STRNCPY_S(p_buf->nap_name, sizeof(p_buf->nap_name), p_nap_info->p_srv_name, BTA_SERVICE_NAME_LEN);
            else
                p_buf->nap_name[0] = 0;

            p_buf->nap_name[BTA_SERVICE_NAME_LEN] = 0;
            p_buf->nap_app_id = p_nap_info->app_id;
            p_buf->nap_sec_mask = p_nap_info->sec_mask;

        }

        bta_sys_sendmsg(p_buf);
    }



}
示例#21
0
/*******************************************************************************
**
** Function         BTA_AvStop
**
** Description      Stop audio/video stream data transfer.
**                  If suspend is TRUE, this function sends AVDT suspend signal
**                  to the connected peer(s).
**
** Returns          void
**
*******************************************************************************/
void BTA_AvStop(BOOLEAN suspend)
{
    tBTA_AV_API_STOP  *p_buf;

    if ((p_buf = (tBTA_AV_API_STOP *) GKI_getbuf(sizeof(tBTA_AV_API_STOP))) != NULL) {
        p_buf->hdr.event = BTA_AV_API_STOP_EVT;
        p_buf->flush   = TRUE;
        p_buf->suspend = suspend;
        bta_sys_sendmsg(p_buf);
    }
}
示例#22
0
/*******************************************************************************
**
** Function         BTA_AgDeregister
**
** Description      Deregister an audio gateway service.
**
**
** Returns          void
**
*******************************************************************************/
void BTA_AgDeregister(UINT16 handle)
{
    BT_HDR  *p_buf;

    if ((p_buf = (BT_HDR *) GKI_getbuf(sizeof(BT_HDR))) != NULL)
    {
        p_buf->event = BTA_AG_API_DEREGISTER_EVT;
        p_buf->layer_specific = handle;
        bta_sys_sendmsg(p_buf);
    }
}
/*******************************************************************************
**
** Function         BTA_HfCllientAudioOpen
**
** Description      Opens an audio connection to the currently connected
**                 audio gateway
**
**
** Returns          void
**
*******************************************************************************/
BTA_API void BTA_HfClientAudioOpen(UINT16 handle)
{
    BT_HDR  *p_buf;

    if ((p_buf = (BT_HDR *) GKI_getbuf(sizeof(BT_HDR))) != NULL)
    {
        p_buf->event = BTA_HF_CLIENT_API_AUDIO_OPEN_EVT;
        p_buf->layer_specific = handle;
        bta_sys_sendmsg(p_buf);
    }
}
/*******************************************************************************
**
** Function         bta_av_a2dp_data_cback
**
** Description      A2DP data callback is executed when AVDTP has a media packet
**                  ready for the application. The function type is
**                  tAVDT_DATA_CBACK.
**
** Returns          void
**
*******************************************************************************/
static void bta_av_a2dp_data_cback(UINT8 handle, BT_HDR *p_pkt,
                                   UINT32 time_stamp, UINT8 m_pt)
{
    /* send sink data ready msg to stream SM */
    *((UINT32 *) (p_pkt + 1)) = time_stamp;
    /* sequence number */
    *((UINT16 *) (p_pkt + 1) + 2) = p_pkt->layer_specific;
    p_pkt->layer_specific = BTA_AV_CHNL_AUDIO;
    p_pkt->event = BTA_AV_CI_SNK_DATA_READY_EVT;
    bta_sys_sendmsg(p_pkt);
}
示例#25
0
void BTA_GATTC_CacheGetAddrList(tBTA_GATTC_IF client_if)
{
    tBTA_GATTC_API_GET_ADDR *p_buf;
    if ((p_buf = (tBTA_GATTC_API_GET_ADDR *)osi_malloc(sizeof(tBTA_GATTC_API_GET_ADDR))) != NULL) {
        p_buf->hdr.event = BTA_GATTC_API_CACHE_GET_ADDR_LIST_EVT;
        p_buf->client_if = client_if;

        bta_sys_sendmsg(p_buf);
    }
    return;
}
示例#26
0
/*******************************************************************************
**
** Function         BTA_GATTC_AppDeregister
**
** Description      This function is called to deregister an application
**                  from BTA GATTC module.
**
** Parameters       client_if - client interface identifier.
**
** Returns          None
**
*******************************************************************************/
void BTA_GATTC_AppDeregister(tBTA_GATTC_IF client_if)
{
    tBTA_GATTC_API_DEREG  *p_buf;

    if ((p_buf = (tBTA_GATTC_API_DEREG *) osi_malloc(sizeof(tBTA_GATTC_API_DEREG))) != NULL) {
        p_buf->hdr.event = BTA_GATTC_API_DEREG_EVT;
        p_buf->client_if = client_if;
        bta_sys_sendmsg(p_buf);
    }
    return;
}
示例#27
0
/*******************************************************************************
**
** Function         BTA_HfClientClose
**
** Description      Close the current connection to an audio gateway.
**                  Any current audio connection will also be closed
**
**
** Returns          void
**
*******************************************************************************/
void BTA_HfClientClose(UINT16 handle)
{
    BT_HDR  *p_buf;

    if ((p_buf = (BT_HDR *) GKI_getbuf(sizeof(BT_HDR))) != NULL)
    {
        p_buf->event = BTA_HF_CLIENT_API_CLOSE_EVT;
        p_buf->layer_specific = handle;
        bta_sys_sendmsg(p_buf);
    }
}
示例#28
0
/*******************************************************************************
**
** Function         bta_av_ci_src_data_ready
**
** Description      This function sends an event to the AV indicating that
**                  the phone has audio stream data ready to send and AV
**                  should call bta_av_co_audio_src_data_path() or
**                  bta_av_co_video_src_data_path().
**
** Returns          void
**
*******************************************************************************/
void bta_av_ci_src_data_ready(tBTA_AV_CHNL chnl)
{
    BT_HDR  *p_buf;

    if ((p_buf = (BT_HDR *) GKI_getbuf(sizeof(BT_HDR))) != NULL)
    {
        p_buf->layer_specific   = chnl;
        p_buf->event = BTA_AV_CI_SRC_DATA_READY_EVT;
        bta_sys_sendmsg(p_buf);
    }
}
示例#29
0
/*******************************************************************************
**
** Function         BTA_AgAudioClose
**
** Description      Close the currently active audio connection to a headset
**                  or hnadsfree. The data connection remains open
**
**
** Returns          void
**
*******************************************************************************/
void BTA_AgAudioClose(UINT16 handle)
{
    BT_HDR  *p_buf;

    if ((p_buf = (BT_HDR *) GKI_getbuf(sizeof(BT_HDR))) != NULL)
    {
        p_buf->event = BTA_AG_API_AUDIO_CLOSE_EVT;
        p_buf->layer_specific = handle;
        bta_sys_sendmsg(p_buf);
    }
}
示例#30
0
/*******************************************************************************
**
** Function         bta_dm_sco_ci_data_ready
**
** Description      This function sends an event to indicating that the phone
**                  has SCO data ready.
**
** Parameters       event: is obtained from bta_dm_sco_co_open() function, which
**                          is the BTA event we want to send back to BTA module
**                          when there is encoded data ready.
**                  sco_handle: is the BTA sco handle which indicate a specific
**                           SCO connection.
** Returns          void
**
*******************************************************************************/
void bta_dm_sco_ci_data_ready(UINT16 event, UINT16 sco_handle)
{
    BT_HDR  *p_buf;

    if ((p_buf = (BT_HDR *) GKI_getbuf(sizeof(BT_HDR))) != NULL)
    {
        p_buf->event = event;
        p_buf->layer_specific = sco_handle;

        bta_sys_sendmsg(p_buf);
    }
}