📄 hci.h
字号:
} __attribute__ ((packed));#define HCI_OP_READ_VOICE_SETTING 0x0c25struct hci_rp_read_voice_setting { __u8 status; __le16 voice_setting;} __attribute__ ((packed));#define HCI_OP_WRITE_VOICE_SETTING 0x0c26struct hci_cp_write_voice_setting { __le16 voice_setting;} __attribute__ ((packed));#define HCI_OP_HOST_BUFFER_SIZE 0x0c33struct hci_cp_host_buffer_size { __le16 acl_mtu; __u8 sco_mtu; __le16 acl_max_pkt; __le16 sco_max_pkt;} __attribute__ ((packed));#define HCI_OP_READ_LOCAL_VERSION 0x1001struct hci_rp_read_local_version { __u8 status; __u8 hci_ver; __le16 hci_rev; __u8 lmp_ver; __le16 manufacturer; __le16 lmp_subver;} __attribute__ ((packed));#define HCI_OP_READ_LOCAL_COMMANDS 0x1002struct hci_rp_read_local_commands { __u8 status; __u8 commands[64];} __attribute__ ((packed));#define HCI_OP_READ_LOCAL_FEATURES 0x1003struct hci_rp_read_local_features { __u8 status; __u8 features[8];} __attribute__ ((packed));#define HCI_OP_READ_LOCAL_EXT_FEATURES 0x1004struct hci_rp_read_local_ext_features { __u8 status; __u8 page; __u8 max_page; __u8 features[8];} __attribute__ ((packed));#define HCI_OP_READ_BUFFER_SIZE 0x1005struct hci_rp_read_buffer_size { __u8 status; __le16 acl_mtu; __u8 sco_mtu; __le16 acl_max_pkt; __le16 sco_max_pkt;} __attribute__ ((packed));#define HCI_OP_READ_BD_ADDR 0x1009struct hci_rp_read_bd_addr { __u8 status; bdaddr_t bdaddr;} __attribute__ ((packed));/* ---- HCI Events ---- */#define HCI_EV_INQUIRY_COMPLETE 0x01#define HCI_EV_INQUIRY_RESULT 0x02struct inquiry_info { bdaddr_t bdaddr; __u8 pscan_rep_mode; __u8 pscan_period_mode; __u8 pscan_mode; __u8 dev_class[3]; __le16 clock_offset;} __attribute__ ((packed));#define HCI_EV_CONN_COMPLETE 0x03struct hci_ev_conn_complete { __u8 status; __le16 handle; bdaddr_t bdaddr; __u8 link_type; __u8 encr_mode;} __attribute__ ((packed));#define HCI_EV_CONN_REQUEST 0x04struct hci_ev_conn_request { bdaddr_t bdaddr; __u8 dev_class[3]; __u8 link_type;} __attribute__ ((packed));#define HCI_EV_DISCONN_COMPLETE 0x05struct hci_ev_disconn_complete { __u8 status; __le16 handle; __u8 reason;} __attribute__ ((packed));#define HCI_EV_AUTH_COMPLETE 0x06struct hci_ev_auth_complete { __u8 status; __le16 handle;} __attribute__ ((packed));#define HCI_EV_REMOTE_NAME 0x07struct hci_ev_remote_name { __u8 status; bdaddr_t bdaddr; __u8 name[248];} __attribute__ ((packed));#define HCI_EV_ENCRYPT_CHANGE 0x08struct hci_ev_encrypt_change { __u8 status; __le16 handle; __u8 encrypt;} __attribute__ ((packed));#define HCI_EV_CHANGE_LINK_KEY_COMPLETE 0x09struct hci_ev_change_link_key_complete { __u8 status; __le16 handle;} __attribute__ ((packed));#define HCI_EV_REMOTE_FEATURES 0x0bstruct hci_ev_remote_features { __u8 status; __le16 handle; __u8 features[8];} __attribute__ ((packed));#define HCI_EV_REMOTE_VERSION 0x0cstruct hci_ev_remote_version { __u8 status; __le16 handle; __u8 lmp_ver; __le16 manufacturer; __le16 lmp_subver;} __attribute__ ((packed));#define HCI_EV_QOS_SETUP_COMPLETE 0x0dstruct hci_qos { __u8 service_type; __u32 token_rate; __u32 peak_bandwidth; __u32 latency; __u32 delay_variation;} __attribute__ ((packed));struct hci_ev_qos_setup_complete { __u8 status; __le16 handle; struct hci_qos qos;} __attribute__ ((packed));#define HCI_EV_CMD_COMPLETE 0x0estruct hci_ev_cmd_complete { __u8 ncmd; __le16 opcode;} __attribute__ ((packed));#define HCI_EV_CMD_STATUS 0x0fstruct hci_ev_cmd_status { __u8 status; __u8 ncmd; __le16 opcode;} __attribute__ ((packed));#define HCI_EV_ROLE_CHANGE 0x12struct hci_ev_role_change { __u8 status; bdaddr_t bdaddr; __u8 role;} __attribute__ ((packed));#define HCI_EV_NUM_COMP_PKTS 0x13struct hci_ev_num_comp_pkts { __u8 num_hndl; /* variable length part */} __attribute__ ((packed));#define HCI_EV_MODE_CHANGE 0x14struct hci_ev_mode_change { __u8 status; __le16 handle; __u8 mode; __le16 interval;} __attribute__ ((packed));#define HCI_EV_PIN_CODE_REQ 0x16struct hci_ev_pin_code_req { bdaddr_t bdaddr;} __attribute__ ((packed));#define HCI_EV_LINK_KEY_REQ 0x17struct hci_ev_link_key_req { bdaddr_t bdaddr;} __attribute__ ((packed));#define HCI_EV_LINK_KEY_NOTIFY 0x18struct hci_ev_link_key_notify { bdaddr_t bdaddr; __u8 link_key[16]; __u8 key_type;} __attribute__ ((packed));#define HCI_EV_CLOCK_OFFSET 0x1cstruct hci_ev_clock_offset { __u8 status; __le16 handle; __le16 clock_offset;} __attribute__ ((packed));#define HCI_EV_PSCAN_REP_MODE 0x20struct hci_ev_pscan_rep_mode { bdaddr_t bdaddr; __u8 pscan_rep_mode;} __attribute__ ((packed));#define HCI_EV_INQUIRY_RESULT_WITH_RSSI 0x22struct inquiry_info_with_rssi { bdaddr_t bdaddr; __u8 pscan_rep_mode; __u8 pscan_period_mode; __u8 dev_class[3]; __le16 clock_offset; __s8 rssi;} __attribute__ ((packed));struct inquiry_info_with_rssi_and_pscan_mode { bdaddr_t bdaddr; __u8 pscan_rep_mode; __u8 pscan_period_mode; __u8 pscan_mode; __u8 dev_class[3]; __le16 clock_offset; __s8 rssi;} __attribute__ ((packed));#define HCI_EV_REMOTE_EXT_FEATURES 0x23struct hci_ev_remote_ext_features { __u8 status; __le16 handle; __u8 page; __u8 max_page; __u8 features[8];} __attribute__ ((packed));#define HCI_EV_SYNC_CONN_COMPLETE 0x2cstruct hci_ev_sync_conn_complete { __u8 status; __le16 handle; bdaddr_t bdaddr; __u8 link_type; __u8 tx_interval; __u8 retrans_window; __le16 rx_pkt_len; __le16 tx_pkt_len; __u8 air_mode;} __attribute__ ((packed));#define HCI_EV_SYNC_CONN_CHANGED 0x2dstruct hci_ev_sync_conn_changed { __u8 status; __le16 handle; __u8 tx_interval; __u8 retrans_window; __le16 rx_pkt_len; __le16 tx_pkt_len;} __attribute__ ((packed));#define HCI_EV_SNIFF_SUBRATE 0x2estruct hci_ev_sniff_subrate { __u8 status; __le16 handle; __le16 max_tx_latency; __le16 max_rx_latency; __le16 max_remote_timeout; __le16 max_local_timeout;} __attribute__ ((packed));#define HCI_EV_EXTENDED_INQUIRY_RESULT 0x2fstruct extended_inquiry_info { bdaddr_t bdaddr; __u8 pscan_rep_mode; __u8 pscan_period_mode; __u8 dev_class[3]; __le16 clock_offset; __s8 rssi; __u8 data[240];} __attribute__ ((packed));/* Internal events generated by Bluetooth stack */#define HCI_EV_STACK_INTERNAL 0xfdstruct hci_ev_stack_internal { __u16 type; __u8 data[0];} __attribute__ ((packed));#define HCI_EV_SI_DEVICE 0x01struct hci_ev_si_device { __u16 event; __u16 dev_id;} __attribute__ ((packed));#define HCI_EV_SI_SECURITY 0x02struct hci_ev_si_security { __u16 event; __u16 proto; __u16 subproto; __u8 incoming;} __attribute__ ((packed));/* ---- HCI Packet structures ---- */#define HCI_COMMAND_HDR_SIZE 3#define HCI_EVENT_HDR_SIZE 2#define HCI_ACL_HDR_SIZE 4#define HCI_SCO_HDR_SIZE 3struct hci_command_hdr { __le16 opcode; /* OCF & OGF */ __u8 plen;} __attribute__ ((packed));struct hci_event_hdr { __u8 evt; __u8 plen;} __attribute__ ((packed));struct hci_acl_hdr { __le16 handle; /* Handle & Flags(PB, BC) */ __le16 dlen;} __attribute__ ((packed));struct hci_sco_hdr { __le16 handle; __u8 dlen;} __attribute__ ((packed));#ifdef __KERNEL__#include <linux/skbuff.h>static inline struct hci_event_hdr *hci_event_hdr(const struct sk_buff *skb){ return (struct hci_event_hdr *) skb->data;}static inline struct hci_acl_hdr *hci_acl_hdr(const struct sk_buff *skb){ return (struct hci_acl_hdr *) skb->data;}static inline struct hci_sco_hdr *hci_sco_hdr(const struct sk_buff *skb){ return (struct hci_sco_hdr *) skb->data;}#endif/* Command opcode pack/unpack */#define hci_opcode_pack(ogf, ocf) (__u16) ((ocf & 0x03ff)|(ogf << 10))#define hci_opcode_ogf(op) (op >> 10)#define hci_opcode_ocf(op) (op & 0x03ff)/* ACL handle and flags pack/unpack */#define hci_handle_pack(h, f) (__u16) ((h & 0x0fff)|(f << 12))#define hci_handle(h) (h & 0x0fff)#define hci_flags(h) (h >> 12)/* ---- HCI Sockets ---- *//* Socket options */#define HCI_DATA_DIR 1#define HCI_FILTER 2#define HCI_TIME_STAMP 3/* CMSG flags */#define HCI_CMSG_DIR 0x0001#define HCI_CMSG_TSTAMP 0x0002struct sockaddr_hci { sa_family_t hci_family; unsigned short hci_dev;};#define HCI_DEV_NONE 0xffffstruct hci_filter { unsigned long type_mask; unsigned long event_mask[2]; __le16 opcode;};struct hci_ufilter { __u32 type_mask; __u32 event_mask[2]; __le16 opcode;};#define HCI_FLT_TYPE_BITS 31#define HCI_FLT_EVENT_BITS 63#define HCI_FLT_OGF_BITS 63#define HCI_FLT_OCF_BITS 127/* ---- HCI Ioctl requests structures ---- */struct hci_dev_stats { __u32 err_rx; __u32 err_tx; __u32 cmd_tx; __u32 evt_rx; __u32 acl_tx; __u32 acl_rx; __u32 sco_tx; __u32 sco_rx; __u32 byte_rx; __u32 byte_tx;};struct hci_dev_info { __u16 dev_id; char name[8]; bdaddr_t bdaddr; __u32 flags; __u8 type; __u8 features[8]; __u32 pkt_type; __u32 link_policy; __u32 link_mode; __u16 acl_mtu; __u16 acl_pkts; __u16 sco_mtu; __u16 sco_pkts; struct hci_dev_stats stat;};struct hci_conn_info { __u16 handle; bdaddr_t bdaddr; __u8 type; __u8 out; __u16 state; __u32 link_mode;};struct hci_dev_req { __u16 dev_id; __u32 dev_opt;};struct hci_dev_list_req { __u16 dev_num; struct hci_dev_req dev_req[0]; /* hci_dev_req structures */};struct hci_conn_list_req { __u16 dev_id; __u16 conn_num; struct hci_conn_info conn_info[0];};struct hci_conn_info_req { bdaddr_t bdaddr; __u8 type; struct hci_conn_info conn_info[0];};struct hci_inquiry_req { __u16 dev_id; __u16 flags; __u8 lap[3]; __u8 length; __u8 num_rsp;};#define IREQ_CACHE_FLUSH 0x0001#endif /* __HCI_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -