3,848
社区成员




int hci_set_phy(int dd,uint16_t handle,uint8_t all_phys,uint8_t tx_phy,uint8_t rx_phy,
uint8_t phy_options,int to)
{
struct hci_request rq;
le_set_phy_cp set_phy_cp;
evt_phy_update_complete phy_update_complete_rp;
memset(&set_phy_cp,0,sizeof(set_phy_cp));
memset(&phy_update_complete_rp,0,sizeof(phy_update_complete_rp));
set_phy_cp.conn_handle=handle;
set_phy_cp.all_phys=all_phys;
set_phy_cp.tx_phys=tx_phy;
set_phy_cp.rx_phys=rx_phy;
set_phy_cp.phy_optinos=phy_options;
memset(&rq,0,sizeof(rq));
rq.ogf=OGF_CONTROLLER_COMMANDS;
rq.ocf=OCF_SET_PHY;
rq.event=EVT_HCI_LE_PHY_UPDATE_COMPLETE;
rq.cparam=&set_phy_cp;
rq.clen=LE_SET_PHY_SIZE;
rq.rparam=&phy_update_complete_rp;
rq.rlen=EVT_PHY_UPDATE_COMPLETE_SIZE;
if (hci_send_req(dd,&rq,to)<0)
{
perror("\n hci_send_req()");
return -1;
}
printf("rx_phy=%d,tx_phy=%d,status=%d\r\n",
phy_update_complete_rp.rx_phy,phy_update_complete_rp.tx_phy,phy_update_complete_rp.status);
return 0;
}