BOOLEAN btsnd_hcic_set_event_filter (UINT8 filt_type, UINT8 filt_cond_type, UINT8 *filt_cond, UINT8 filt_cond_len) { BT_HDR *p; UINT8 *pp; /* Use buffer large enough to hold all sizes in this command */ if ((p = HCI_GET_CMD_BUF(2 + filt_cond_len)) == NULL) return (FALSE); pp = (UINT8 *)(p + 1); p->offset = 0; UINT16_TO_STREAM (pp, HCI_SET_EVENT_FILTER); if (filt_type) { p->len = (UINT16)(HCIC_PREAMBLE_SIZE + 2 + filt_cond_len); UINT8_TO_STREAM (pp, (UINT8)(2 + filt_cond_len)); UINT8_TO_STREAM (pp, filt_type); UINT8_TO_STREAM (pp, filt_cond_type); if (filt_cond_type == HCI_FILTER_COND_DEVICE_CLASS) { DEVCLASS_TO_STREAM (pp, filt_cond); filt_cond += DEV_CLASS_LEN; DEVCLASS_TO_STREAM (pp, filt_cond); filt_cond += DEV_CLASS_LEN; filt_cond_len -= (2 * DEV_CLASS_LEN); } else if (filt_cond_type == HCI_FILTER_COND_BD_ADDR) { BDADDR_TO_STREAM (pp, filt_cond); filt_cond += BD_ADDR_LEN; filt_cond_len -= BD_ADDR_LEN; } if (filt_cond_len) ARRAY_TO_STREAM (pp, filt_cond, filt_cond_len); } else { p->len = (UINT16)(HCIC_PREAMBLE_SIZE + 1); UINT8_TO_STREAM (pp, 1); UINT8_TO_STREAM (pp, filt_type); } btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); return (TRUE); }
/******************************************************************************* ** ** Function NDEF_MsgAppendMediaBtOobCod ** ** Description This function appends COD EIR data at the end of BT OOB Record. ** ** Returns NDEF_OK if all OK ** *******************************************************************************/ tNDEF_STATUS NDEF_MsgAppendMediaBtOobCod (UINT8 *p_msg, UINT32 max_size, UINT32 *p_cur_size, char *p_id_str, DEV_CLASS cod) { tNDEF_STATUS status; UINT8 *p_rec; UINT8 eir_data[BT_OOB_COD_SIZE + 2]; UINT8 *p; UINT8 eir_data_len; UINT32 oob_data_len; /* find record by Payload ID */ p_rec = ndef_get_bt_oob_record (p_msg, max_size, p_cur_size, p_id_str); if (!p_rec) return (NDEF_REC_NOT_FOUND); /* create EIR data format for COD */ p = eir_data; UINT8_TO_STREAM (p, BT_OOB_COD_SIZE + 1); UINT8_TO_STREAM (p, BT_EIR_OOB_COD_TYPE); DEVCLASS_TO_STREAM (p, cod); eir_data_len = BT_OOB_COD_SIZE + 2; /* append EIR data at the end of record */ status = NDEF_MsgAppendPayload(p_msg, max_size, p_cur_size, p_rec, eir_data, eir_data_len); /* update BT OOB data length, if success */ if (status == NDEF_OK) { /* payload length is the same as BT OOB data length */ p = NDEF_RecGetPayload (p_rec, &oob_data_len); /* Get a pointer to the payload or NULL (for none) which is valid */ if (p) { UINT16_TO_STREAM (p, oob_data_len); } } return (status); }
BOOLEAN btsnd_hcic_write_dev_class(DEV_CLASS dev_class) { BT_HDR *p; UINT8 *pp; if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_WRITE_PARAM3)) == NULL) return (FALSE); pp = (UINT8 *)(p + 1); p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_WRITE_PARAM3; p->offset = 0; UINT16_TO_STREAM (pp, HCI_WRITE_CLASS_OF_DEVICE); UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_WRITE_PARAM3); DEVCLASS_TO_STREAM (pp, dev_class); btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); return (TRUE); }