[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bluetooth-dev] Implementations of some HCI commands



Here are the implementations of some HCI commands currently unimplemented by the Axis stack. Credits go to Francesco Gallo who wrote them.

s32
hci_hold_mode(u32 con_hdl, u32 max_interval, u32 min_interval)
{
        c_pkt.type = CMD_PKT;
        c_pkt.opcode = hci_put_opcode(HOLD_MODE, HCI_LP) ;
        c_pkt.len = 6;
        c_pkt.data[0] = con_hdl & 0xff;
        c_pkt.data[1] = (con_hdl >> 8) & 0xff;
        c_pkt.data[2] = max_interval & 0xff;
        c_pkt.data[3] = (max_interval >> 8) & 0xff;
        c_pkt.data[4] = min_interval & 0xff;
        c_pkt.data[5] = (min_interval >> 8) & 0xff;

        return send_cmd((u8*) &c_pkt, c_pkt.len + CMD_HDR_LEN + HCI_HDR_LEN);
}

s32
hci_write_page_to(u32 page_to)
{
        c_pkt.type = CMD_PKT;
        c_pkt.opcode = hci_put_opcode(WRITE_PAGE_TIMEOUT, HCI_HC) ;
        c_pkt.len = 2;
        c_pkt.data[0] = page_to & 0xff;
        c_pkt.data[1] = (page_to >> 8) & 0xff;

        return send_cmd((u8*) &c_pkt, c_pkt.len + CMD_HDR_LEN + HCI_HDR_LEN);
}

s32
hci_write_hold_mode_activity(u32 hma)
{
        c_pkt.type = CMD_PKT;
        c_pkt.opcode = hci_put_opcode(WRITE_HOLD_MODE_ACTIVITY, HCI_HC) ;
        c_pkt.len = 1;
        c_pkt.data[0] = hma & 0xff;

        return send_cmd((u8*) &c_pkt, c_pkt.len + CMD_HDR_LEN + HCI_HDR_LEN);
}

s32 hci_write_connection_accept_to(u32 co_ac_to)
{
        c_pkt.type = CMD_PKT;
        c_pkt.opcode = hci_put_opcode(WRITE_CONNECTION_ACCEPT_TIMEOUT, HCI_HC) ;
        c_pkt.len = 2;
        c_pkt.data[0] = co_ac_to & 0xff;
        c_pkt.data[1] = (co_ac_to >> 8) & 0xff;
        return send_cmd((u8*) &c_pkt, c_pkt.len + CMD_HDR_LEN + HCI_HDR_LEN);
}

s32 hci_inquiry_cancel(void)
{
        c_pkt.type = CMD_PKT;
        c_pkt.opcode = hci_put_opcode(INQUIRY_CANCEL, HCI_LC) ;
        c_pkt.len = 0;
        return send_cmd((u8*) &c_pkt, c_pkt.len + CMD_HDR_LEN + HCI_HDR_LEN);
}

s32 hci_read_clock_offset(u32 hdl)
{
        c_pkt.type = CMD_PKT;
        c_pkt.opcode = hci_put_opcode(READ_CLOCK_OFFSET, HCI_LC) ;
        c_pkt.data[0] = (hdl & 0xff);
        c_pkt.data[1] = ((hdl >> 8) & 0xff);
        c_pkt.len = 2;
        return send_cmd((u8*) &c_pkt, c_pkt.len + CMD_HDR_LEN + HCI_HDR_LEN);
}

s32 hci_read_rssi(u32 hdl)
{
        c_pkt.type = CMD_PKT;
        c_pkt.opcode = hci_put_opcode(READ_RSSI, HCI_SP) ;
        c_pkt.data[0] = (hdl & 0xff);
        c_pkt.data[1] = ((hdl >> 8) & 0xff);
        c_pkt.len = 2;
        return send_cmd((u8*) &c_pkt, c_pkt.len + CMD_HDR_LEN + HCI_HDR_LEN);
}
-
To unsubscribe from this list: send the line "unsubscribe bluetooth-dev" in
the body of a message to majordomo@xxxxxxx.com