Fix EOL
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26231 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
5d7bf42195
commit
ade530ec1d
@ -1,41 +1,41 @@
|
||||
/*
|
||||
* Copyright 2007 Oliver Ruiz Dorantes, oliver.ruiz.dorantes_at_gmail.com
|
||||
*
|
||||
* All rights reserved. Distributed under the terms of the MIT License.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _BTHCI_H_
|
||||
#define _BTHCI_H_
|
||||
|
||||
/* typedefs */
|
||||
typedef int32 hci_id;
|
||||
|
||||
typedef enum { H2 = 2, H3, H4, H5 } transport_type;
|
||||
|
||||
// TODO: something more authomatic here?
|
||||
#define HCI_NUM_PACKET_TYPES 5
|
||||
typedef enum { BT_COMMAND = 0,
|
||||
BT_EVENT,
|
||||
BT_ACL,
|
||||
BT_SCO,
|
||||
BT_ESCO
|
||||
} bt_packet_t;
|
||||
|
||||
|
||||
/* packets sizes */
|
||||
#define HCI_MAX_ACL_SIZE 1024
|
||||
#define HCI_MAX_SCO_SIZE 255
|
||||
#define HCI_MAX_EVENT_SIZE 260
|
||||
#define HCI_MAX_FRAME_SIZE (HCI_MAX_ACL_SIZE + 4)
|
||||
|
||||
/* fields sizes */
|
||||
#define HCI_LAP_SIZE 3 /* LAP */
|
||||
#define HCI_LINK_KEY_SIZE 16 /* link key */
|
||||
#define HCI_PIN_SIZE 16 /* PIN */
|
||||
#define HCI_EVENT_MASK_SIZE 8 /* event mask */
|
||||
#define HCI_CLASS_SIZE 3 /* class */
|
||||
#define HCI_FEATURES_SIZE 8 /* LMP features */
|
||||
#define HCI_DEVICE_NAME_SIZE 248 /* unit name size */
|
||||
|
||||
#endif
|
||||
/*
|
||||
* Copyright 2007 Oliver Ruiz Dorantes, oliver.ruiz.dorantes_at_gmail.com
|
||||
*
|
||||
* All rights reserved. Distributed under the terms of the MIT License.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _BTHCI_H_
|
||||
#define _BTHCI_H_
|
||||
|
||||
/* typedefs */
|
||||
typedef int32 hci_id;
|
||||
|
||||
typedef enum { H2 = 2, H3, H4, H5 } transport_type;
|
||||
|
||||
// TODO: something more authomatic here?
|
||||
#define HCI_NUM_PACKET_TYPES 5
|
||||
typedef enum { BT_COMMAND = 0,
|
||||
BT_EVENT,
|
||||
BT_ACL,
|
||||
BT_SCO,
|
||||
BT_ESCO
|
||||
} bt_packet_t;
|
||||
|
||||
|
||||
/* packets sizes */
|
||||
#define HCI_MAX_ACL_SIZE 1024
|
||||
#define HCI_MAX_SCO_SIZE 255
|
||||
#define HCI_MAX_EVENT_SIZE 260
|
||||
#define HCI_MAX_FRAME_SIZE (HCI_MAX_ACL_SIZE + 4)
|
||||
|
||||
/* fields sizes */
|
||||
#define HCI_LAP_SIZE 3 /* LAP */
|
||||
#define HCI_LINK_KEY_SIZE 16 /* link key */
|
||||
#define HCI_PIN_SIZE 16 /* PIN */
|
||||
#define HCI_EVENT_MASK_SIZE 8 /* event mask */
|
||||
#define HCI_CLASS_SIZE 3 /* class */
|
||||
#define HCI_FEATURES_SIZE 8 /* LMP features */
|
||||
#define HCI_DEVICE_NAME_SIZE 248 /* unit name size */
|
||||
|
||||
#endif
|
||||
|
@ -1,39 +1,39 @@
|
||||
/*
|
||||
* Copyright 2007 Oliver Ruiz Dorantes, oliver.ruiz.dorantes_at_gmail.com
|
||||
*
|
||||
* All rights reserved. Distributed under the terms of the MIT License.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _BTHCI_ACL_H_
|
||||
#define _BTHCI_ACL_H_
|
||||
|
||||
#include <bluetooth/bluetooth.h>
|
||||
#include <bluetooth/HCI/btHCI.h>
|
||||
|
||||
#define HCI_ACL_HDR_SIZE 4
|
||||
|
||||
struct hci_acl_header {
|
||||
uint16 handle; /* Handle & Flags(PB, BC) */
|
||||
uint16 alen;
|
||||
} __attribute__ ((packed)) ;
|
||||
|
||||
/* ACL handle and flags pack/unpack */
|
||||
#define pack_acl_handle_flags(h, pb, bc) (((h) & 0x0fff) | (((pb) & 3) << 12) | (((bc) & 3) << 14))
|
||||
#define get_acl_handle(h) ((h) & 0x0fff)
|
||||
#define get_acl_pb_flag(h) (((h) & 0x3000) >> 12)
|
||||
#define get_acl_bc_flag(h) (((h) & 0xc000) >> 14)
|
||||
|
||||
/* PB flag values */
|
||||
/* 00 - reserved for future use */
|
||||
#define HCI_ACL_PACKET_FRAGMENT 0x1
|
||||
#define HCI_ACL_PACKET_START 0x2
|
||||
/* 11 - reserved for future use */
|
||||
|
||||
/* BC flag values */
|
||||
#define HCI_ACL_POINT2POINT 0x0 /* only Host controller to Host */
|
||||
#define HCI_ACL_BROADCAST_ACTIVE 0x1 /* both directions */
|
||||
#define HCI_ACL_BROADCAST_PICONET 0x2 /* both directions */
|
||||
/* 11 - reserved for future use */
|
||||
|
||||
#endif
|
||||
/*
|
||||
* Copyright 2007 Oliver Ruiz Dorantes, oliver.ruiz.dorantes_at_gmail.com
|
||||
*
|
||||
* All rights reserved. Distributed under the terms of the MIT License.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _BTHCI_ACL_H_
|
||||
#define _BTHCI_ACL_H_
|
||||
|
||||
#include <bluetooth/bluetooth.h>
|
||||
#include <bluetooth/HCI/btHCI.h>
|
||||
|
||||
#define HCI_ACL_HDR_SIZE 4
|
||||
|
||||
struct hci_acl_header {
|
||||
uint16 handle; /* Handle & Flags(PB, BC) */
|
||||
uint16 alen;
|
||||
} __attribute__ ((packed)) ;
|
||||
|
||||
/* ACL handle and flags pack/unpack */
|
||||
#define pack_acl_handle_flags(h, pb, bc) (((h) & 0x0fff) | (((pb) & 3) << 12) | (((bc) & 3) << 14))
|
||||
#define get_acl_handle(h) ((h) & 0x0fff)
|
||||
#define get_acl_pb_flag(h) (((h) & 0x3000) >> 12)
|
||||
#define get_acl_bc_flag(h) (((h) & 0xc000) >> 14)
|
||||
|
||||
/* PB flag values */
|
||||
/* 00 - reserved for future use */
|
||||
#define HCI_ACL_PACKET_FRAGMENT 0x1
|
||||
#define HCI_ACL_PACKET_START 0x2
|
||||
/* 11 - reserved for future use */
|
||||
|
||||
/* BC flag values */
|
||||
#define HCI_ACL_POINT2POINT 0x0 /* only Host controller to Host */
|
||||
#define HCI_ACL_BROADCAST_ACTIVE 0x1 /* both directions */
|
||||
#define HCI_ACL_BROADCAST_PICONET 0x2 /* both directions */
|
||||
/* 11 - reserved for future use */
|
||||
|
||||
#endif
|
||||
|
@ -1,340 +1,340 @@
|
||||
/*
|
||||
* Copyright 2007 Oliver Ruiz Dorantes, oliver.ruiz.dorantes_at_gmail.com
|
||||
*
|
||||
* All rights reserved. Distributed under the terms of the MIT License.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _BTHCI_COMMAND_H_
|
||||
#define _BTHCI_COMMAND_H_
|
||||
|
||||
#include <bluetooth/bluetooth.h>
|
||||
#include <bluetooth/HCI/btHCI.h>
|
||||
|
||||
#define HCI_COMMAND_HDR_SIZE 3
|
||||
|
||||
struct hci_command_header {
|
||||
uint16 opcode; /* OCF & OGF */
|
||||
uint8 clen;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
|
||||
/* Command opcode pack/unpack */
|
||||
#define PACK_OPCODE(ogf, ocf) (uint16)((ocf & 0x03ff)|(ogf << 10))
|
||||
#define GET_OPCODE_OGF(op) (op >> 10)
|
||||
#define GET_OPCODE_OCF(op) (op & 0x03ff)
|
||||
|
||||
|
||||
/* - Informational Parameters Command definition - */
|
||||
#define OGF_INFORMATIONAL_PARAM 0x04
|
||||
|
||||
#define OCF_READ_LOCAL_VERSION 0x0001
|
||||
struct hci_rp_read_loc_version {
|
||||
uint8 status;
|
||||
uint8 hci_ver;
|
||||
uint16 hci_rev;
|
||||
uint8 lmp_ver;
|
||||
uint16 manufacturer;
|
||||
uint16 lmp_subver;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define OCF_READ_LOCAL_FEATURES 0x0003
|
||||
struct hci_rp_read_loc_features {
|
||||
uint8 status;
|
||||
uint8 features[8];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define OCF_READ_BUFFER_SIZE 0x0005
|
||||
struct hci_rp_read_buffer_size {
|
||||
uint8 status;
|
||||
uint16 acl_mtu;
|
||||
uint8 sco_mtu;
|
||||
uint16 acl_max_pkt;
|
||||
uint16 sco_max_pkt;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define OCF_READ_BD_ADDR 0x0009
|
||||
struct hci_rp_read_bd_addr {
|
||||
uint8 status;
|
||||
bdaddr_t bdaddr;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/* - Host Controller and Baseband Command definition - */
|
||||
#define OGF_CONTROL_BASEBAND 0x03
|
||||
|
||||
#define OCF_RESET 0x0003
|
||||
/*struct hci_reset {
|
||||
void no_fields;
|
||||
} __attribute__ ((packed));*/
|
||||
|
||||
#define OCF_SET_EVENT_FLT 0x0005
|
||||
struct hci_cp_set_event_flt {
|
||||
uint8 flt_type;
|
||||
uint8 cond_type;
|
||||
uint8 condition[0];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define OCF_READ_STORED_LINK_KEY 0x000D
|
||||
struct hci_read_stored_link_key {
|
||||
bdaddr_t bdaddr;
|
||||
uint8 all_keys_flag;
|
||||
} __attribute__ ((packed));
|
||||
struct hci_read_stored_link_key_reply {
|
||||
uint8 status;
|
||||
uint16 max_num_keys;
|
||||
uint16 num_keys_read;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define OCF_WRITE_STORED_LINK_KEY 0x0011
|
||||
struct hci_write_stored_link_key {
|
||||
uint8 num_keys_to_write;
|
||||
// these are repeated "num_keys_write" times
|
||||
bdaddr_t bdaddr;
|
||||
uint8 key[HCI_LINK_KEY_SIZE];
|
||||
} __attribute__ ((packed));
|
||||
struct hci_write_stored_link_key_reply {
|
||||
uint8 status;
|
||||
uint8 num_keys_written;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
|
||||
#define OCF_WRITE_LOCAL_NAME 0x0013
|
||||
#define OCF_READ_LOCAL_NAME 0x0014
|
||||
struct hci_rp_read_local_name {
|
||||
uint8 status;
|
||||
char local_name[HCI_DEVICE_NAME_SIZE];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define OCF_WRITE_CA_TIMEOUT 0x0016
|
||||
#define OCF_WRITE_PG_TIMEOUT 0x0018
|
||||
|
||||
#define OCF_WRITE_SCAN_ENABLE 0x001A
|
||||
#define HCI_SCAN_DISABLED 0x00
|
||||
#define HCI_SCAN_INQUIRY 0x01
|
||||
#define HCI_SCAN_PAGE 0x02
|
||||
#define HCI_SCAN_INQUIRY_PAGE 0x03
|
||||
struct hci_write_scan_enable {
|
||||
uint8 scan;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define OCF_READ_AUTH_ENABLE 0x001F
|
||||
#define OCF_WRITE_AUTH_ENABLE 0x0020
|
||||
#define HCI_AUTH_DISABLED 0x00
|
||||
#define HCI_AUTH_ENABLED 0x01
|
||||
struct hci_write_authentication_enable {
|
||||
uint8 authentication;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define OCF_READ_ENCRYPT_MODE 0x0021
|
||||
#define OCF_WRITE_ENCRYPT_MODE 0x0022
|
||||
#define HCI_ENCRYPT_DISABLED 0x00
|
||||
#define HCI_ENCRYPT_P2P 0x01
|
||||
#define HCI_ENCRYPT_BOTH 0x02
|
||||
struct hci_write_encryption_mode_enable {
|
||||
uint8 encryption;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/* Filter types */
|
||||
#define HCI_FLT_CLEAR_ALL 0x00
|
||||
#define HCI_FLT_INQ_RESULT 0x01
|
||||
#define HCI_FLT_CONN_SETUP 0x02
|
||||
|
||||
/* CONN_SETUP Condition types */
|
||||
#define HCI_CONN_SETUP_ALLOW_ALL 0x00
|
||||
#define HCI_CONN_SETUP_ALLOW_CLASS 0x01
|
||||
#define HCI_CONN_SETUP_ALLOW_BDADDR 0x02
|
||||
|
||||
/* CONN_SETUP Conditions */
|
||||
#define HCI_CONN_SETUP_AUTO_OFF 0x01
|
||||
#define HCI_CONN_SETUP_AUTO_ON 0x02
|
||||
|
||||
#define OCF_READ_CLASS_OF_DEV 0x0023
|
||||
|
||||
struct hci_read_dev_class_reply {
|
||||
uint8 status;
|
||||
uint8 dev_class[3];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define OCF_WRITE_CLASS_OF_DEV 0x0024
|
||||
struct hci_write_dev_class {
|
||||
uint8 dev_class[3];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define OCF_READ_VOICE_SETTING 0x0025
|
||||
struct hci_rp_read_voice_setting {
|
||||
uint8 status;
|
||||
uint16 voice_setting;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define OCF_WRITE_VOICE_SETTING 0x0026
|
||||
struct hci_cp_write_voice_setting {
|
||||
uint16 voice_setting;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define OCF_HOST_BUFFER_SIZE 0x0033
|
||||
struct hci_cp_host_buffer_size {
|
||||
uint16 acl_mtu;
|
||||
uint8 sco_mtu;
|
||||
uint16 acl_max_pkt;
|
||||
uint16 sco_max_pkt;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/* Link Control Command definition */
|
||||
#define OGF_LINK_CONTROL 0x01
|
||||
|
||||
#define OCF_INQUIRY 0x0001
|
||||
struct hci_cp_inquiry {
|
||||
uint8 lap[3];
|
||||
uint8 length;
|
||||
uint8 num_rsp;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define OCF_INQUIRY_CANCEL 0x0002
|
||||
|
||||
#define OCF_CREATE_CONN 0x0005
|
||||
struct hci_cp_create_conn {
|
||||
bdaddr_t bdaddr;
|
||||
uint16 pkt_type;
|
||||
uint8 pscan_rep_mode;
|
||||
uint8 pscan_mode;
|
||||
uint16 clock_offset;
|
||||
uint8 role_switch;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define OCF_DISCONNECT 0x0006
|
||||
struct hci_disconnect {
|
||||
uint16 handle;
|
||||
uint8 reason;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define OCF_ADD_SCO 0x0007
|
||||
struct hci_cp_add_sco {
|
||||
uint16 handle;
|
||||
uint16 pkt_type;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define OCF_ACCEPT_CONN_REQ 0x0009
|
||||
struct hci_cp_accept_conn_req {
|
||||
bdaddr_t bdaddr;
|
||||
uint8 role;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define OCF_REJECT_CONN_REQ 0x000a
|
||||
struct hci_cp_reject_conn_req {
|
||||
bdaddr_t bdaddr;
|
||||
uint8 reason;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define OCF_LINK_KEY_REPLY 0x000B
|
||||
struct hci_cp_link_key_reply {
|
||||
bdaddr_t bdaddr;
|
||||
uint8 link_key[16];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define OCF_LINK_KEY_NEG_REPLY 0x000C
|
||||
struct hci_cp_link_key_neg_reply {
|
||||
bdaddr_t bdaddr;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define OCF_PIN_CODE_REPLY 0x000D
|
||||
struct hci_cp_pin_code_reply {
|
||||
bdaddr_t bdaddr;
|
||||
uint8 pin_len;
|
||||
uint8 pin_code[HCI_PIN_SIZE];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define OCF_PIN_CODE_NEG_REPLY 0x000E
|
||||
struct hci_cp_pin_code_neg_reply {
|
||||
bdaddr_t bdaddr;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define OCF_CHANGE_CONN_PTYPE 0x000F
|
||||
struct hci_cp_change_conn_ptype {
|
||||
uint16 handle;
|
||||
uint16 pkt_type;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define OCF_AUTH_REQUESTED 0x0011
|
||||
struct hci_cp_auth_requested {
|
||||
uint16 handle;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define OCF_SET_CONN_ENCRYPT 0x0013
|
||||
struct hci_cp_set_conn_encrypt {
|
||||
uint16 handle;
|
||||
uint8 encrypt;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define OCF_CHANGE_CONN_LINK_KEY 0x0015
|
||||
struct hci_cp_change_conn_link_key {
|
||||
uint16 handle;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define OCF_REMOTE_NAME_REQUEST 0x0019
|
||||
struct hci_remote_name_request {
|
||||
bdaddr_t bdaddr;
|
||||
uint8 pscan_rep_mode;
|
||||
uint8 reserved;
|
||||
uint16 clock_offset;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define OCF_READ_REMOTE_FEATURES 0x001B
|
||||
struct hci_cp_read_rmt_features {
|
||||
uint16 handle;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define OCF_READ_REMOTE_VERSION 0x001D
|
||||
struct hci_cp_read_rmt_version {
|
||||
uint16 handle;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
|
||||
/* Link Policy Command definition */
|
||||
#define OGF_LINK_POLICY 0x02
|
||||
|
||||
#define OCF_ROLE_DISCOVERY 0x0009
|
||||
struct hci_cp_role_discovery {
|
||||
uint16 handle;
|
||||
} __attribute__ ((packed));
|
||||
struct hci_rp_role_discovery {
|
||||
uint8 status;
|
||||
uint16 handle;
|
||||
uint8 role;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define OCF_READ_LINK_POLICY 0x000C
|
||||
struct hci_cp_read_link_policy {
|
||||
uint16 handle;
|
||||
} __attribute__ ((packed));
|
||||
struct hci_rp_read_link_policy {
|
||||
uint8 status;
|
||||
uint16 handle;
|
||||
uint16 policy;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define OCF_SWITCH_ROLE 0x000B
|
||||
struct hci_cp_switch_role {
|
||||
bdaddr_t bdaddr;
|
||||
uint8 role;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define OCF_WRITE_LINK_POLICY 0x000D
|
||||
struct hci_cp_write_link_policy {
|
||||
uint16 handle;
|
||||
uint16 policy;
|
||||
} __attribute__ ((packed));
|
||||
struct hci_rp_write_link_policy {
|
||||
uint8 status;
|
||||
uint16 handle;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/* Status params */
|
||||
#define OGF_STATUS_PARAM 0x05
|
||||
|
||||
/* Testing commands */
|
||||
#define OGF_TESTING_CMD 0x3E
|
||||
|
||||
/* Vendor specific commands */
|
||||
#define OGF_VENDOR_CMD 0x3F
|
||||
|
||||
#endif
|
||||
/*
|
||||
* Copyright 2007 Oliver Ruiz Dorantes, oliver.ruiz.dorantes_at_gmail.com
|
||||
*
|
||||
* All rights reserved. Distributed under the terms of the MIT License.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _BTHCI_COMMAND_H_
|
||||
#define _BTHCI_COMMAND_H_
|
||||
|
||||
#include <bluetooth/bluetooth.h>
|
||||
#include <bluetooth/HCI/btHCI.h>
|
||||
|
||||
#define HCI_COMMAND_HDR_SIZE 3
|
||||
|
||||
struct hci_command_header {
|
||||
uint16 opcode; /* OCF & OGF */
|
||||
uint8 clen;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
|
||||
/* Command opcode pack/unpack */
|
||||
#define PACK_OPCODE(ogf, ocf) (uint16)((ocf & 0x03ff)|(ogf << 10))
|
||||
#define GET_OPCODE_OGF(op) (op >> 10)
|
||||
#define GET_OPCODE_OCF(op) (op & 0x03ff)
|
||||
|
||||
|
||||
/* - Informational Parameters Command definition - */
|
||||
#define OGF_INFORMATIONAL_PARAM 0x04
|
||||
|
||||
#define OCF_READ_LOCAL_VERSION 0x0001
|
||||
struct hci_rp_read_loc_version {
|
||||
uint8 status;
|
||||
uint8 hci_ver;
|
||||
uint16 hci_rev;
|
||||
uint8 lmp_ver;
|
||||
uint16 manufacturer;
|
||||
uint16 lmp_subver;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define OCF_READ_LOCAL_FEATURES 0x0003
|
||||
struct hci_rp_read_loc_features {
|
||||
uint8 status;
|
||||
uint8 features[8];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define OCF_READ_BUFFER_SIZE 0x0005
|
||||
struct hci_rp_read_buffer_size {
|
||||
uint8 status;
|
||||
uint16 acl_mtu;
|
||||
uint8 sco_mtu;
|
||||
uint16 acl_max_pkt;
|
||||
uint16 sco_max_pkt;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define OCF_READ_BD_ADDR 0x0009
|
||||
struct hci_rp_read_bd_addr {
|
||||
uint8 status;
|
||||
bdaddr_t bdaddr;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/* - Host Controller and Baseband Command definition - */
|
||||
#define OGF_CONTROL_BASEBAND 0x03
|
||||
|
||||
#define OCF_RESET 0x0003
|
||||
/*struct hci_reset {
|
||||
void no_fields;
|
||||
} __attribute__ ((packed));*/
|
||||
|
||||
#define OCF_SET_EVENT_FLT 0x0005
|
||||
struct hci_cp_set_event_flt {
|
||||
uint8 flt_type;
|
||||
uint8 cond_type;
|
||||
uint8 condition[0];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define OCF_READ_STORED_LINK_KEY 0x000D
|
||||
struct hci_read_stored_link_key {
|
||||
bdaddr_t bdaddr;
|
||||
uint8 all_keys_flag;
|
||||
} __attribute__ ((packed));
|
||||
struct hci_read_stored_link_key_reply {
|
||||
uint8 status;
|
||||
uint16 max_num_keys;
|
||||
uint16 num_keys_read;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define OCF_WRITE_STORED_LINK_KEY 0x0011
|
||||
struct hci_write_stored_link_key {
|
||||
uint8 num_keys_to_write;
|
||||
// these are repeated "num_keys_write" times
|
||||
bdaddr_t bdaddr;
|
||||
uint8 key[HCI_LINK_KEY_SIZE];
|
||||
} __attribute__ ((packed));
|
||||
struct hci_write_stored_link_key_reply {
|
||||
uint8 status;
|
||||
uint8 num_keys_written;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
|
||||
#define OCF_WRITE_LOCAL_NAME 0x0013
|
||||
#define OCF_READ_LOCAL_NAME 0x0014
|
||||
struct hci_rp_read_local_name {
|
||||
uint8 status;
|
||||
char local_name[HCI_DEVICE_NAME_SIZE];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define OCF_WRITE_CA_TIMEOUT 0x0016
|
||||
#define OCF_WRITE_PG_TIMEOUT 0x0018
|
||||
|
||||
#define OCF_WRITE_SCAN_ENABLE 0x001A
|
||||
#define HCI_SCAN_DISABLED 0x00
|
||||
#define HCI_SCAN_INQUIRY 0x01
|
||||
#define HCI_SCAN_PAGE 0x02
|
||||
#define HCI_SCAN_INQUIRY_PAGE 0x03
|
||||
struct hci_write_scan_enable {
|
||||
uint8 scan;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define OCF_READ_AUTH_ENABLE 0x001F
|
||||
#define OCF_WRITE_AUTH_ENABLE 0x0020
|
||||
#define HCI_AUTH_DISABLED 0x00
|
||||
#define HCI_AUTH_ENABLED 0x01
|
||||
struct hci_write_authentication_enable {
|
||||
uint8 authentication;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define OCF_READ_ENCRYPT_MODE 0x0021
|
||||
#define OCF_WRITE_ENCRYPT_MODE 0x0022
|
||||
#define HCI_ENCRYPT_DISABLED 0x00
|
||||
#define HCI_ENCRYPT_P2P 0x01
|
||||
#define HCI_ENCRYPT_BOTH 0x02
|
||||
struct hci_write_encryption_mode_enable {
|
||||
uint8 encryption;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/* Filter types */
|
||||
#define HCI_FLT_CLEAR_ALL 0x00
|
||||
#define HCI_FLT_INQ_RESULT 0x01
|
||||
#define HCI_FLT_CONN_SETUP 0x02
|
||||
|
||||
/* CONN_SETUP Condition types */
|
||||
#define HCI_CONN_SETUP_ALLOW_ALL 0x00
|
||||
#define HCI_CONN_SETUP_ALLOW_CLASS 0x01
|
||||
#define HCI_CONN_SETUP_ALLOW_BDADDR 0x02
|
||||
|
||||
/* CONN_SETUP Conditions */
|
||||
#define HCI_CONN_SETUP_AUTO_OFF 0x01
|
||||
#define HCI_CONN_SETUP_AUTO_ON 0x02
|
||||
|
||||
#define OCF_READ_CLASS_OF_DEV 0x0023
|
||||
|
||||
struct hci_read_dev_class_reply {
|
||||
uint8 status;
|
||||
uint8 dev_class[3];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define OCF_WRITE_CLASS_OF_DEV 0x0024
|
||||
struct hci_write_dev_class {
|
||||
uint8 dev_class[3];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define OCF_READ_VOICE_SETTING 0x0025
|
||||
struct hci_rp_read_voice_setting {
|
||||
uint8 status;
|
||||
uint16 voice_setting;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define OCF_WRITE_VOICE_SETTING 0x0026
|
||||
struct hci_cp_write_voice_setting {
|
||||
uint16 voice_setting;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define OCF_HOST_BUFFER_SIZE 0x0033
|
||||
struct hci_cp_host_buffer_size {
|
||||
uint16 acl_mtu;
|
||||
uint8 sco_mtu;
|
||||
uint16 acl_max_pkt;
|
||||
uint16 sco_max_pkt;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/* Link Control Command definition */
|
||||
#define OGF_LINK_CONTROL 0x01
|
||||
|
||||
#define OCF_INQUIRY 0x0001
|
||||
struct hci_cp_inquiry {
|
||||
uint8 lap[3];
|
||||
uint8 length;
|
||||
uint8 num_rsp;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define OCF_INQUIRY_CANCEL 0x0002
|
||||
|
||||
#define OCF_CREATE_CONN 0x0005
|
||||
struct hci_cp_create_conn {
|
||||
bdaddr_t bdaddr;
|
||||
uint16 pkt_type;
|
||||
uint8 pscan_rep_mode;
|
||||
uint8 pscan_mode;
|
||||
uint16 clock_offset;
|
||||
uint8 role_switch;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define OCF_DISCONNECT 0x0006
|
||||
struct hci_disconnect {
|
||||
uint16 handle;
|
||||
uint8 reason;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define OCF_ADD_SCO 0x0007
|
||||
struct hci_cp_add_sco {
|
||||
uint16 handle;
|
||||
uint16 pkt_type;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define OCF_ACCEPT_CONN_REQ 0x0009
|
||||
struct hci_cp_accept_conn_req {
|
||||
bdaddr_t bdaddr;
|
||||
uint8 role;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define OCF_REJECT_CONN_REQ 0x000a
|
||||
struct hci_cp_reject_conn_req {
|
||||
bdaddr_t bdaddr;
|
||||
uint8 reason;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define OCF_LINK_KEY_REPLY 0x000B
|
||||
struct hci_cp_link_key_reply {
|
||||
bdaddr_t bdaddr;
|
||||
uint8 link_key[16];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define OCF_LINK_KEY_NEG_REPLY 0x000C
|
||||
struct hci_cp_link_key_neg_reply {
|
||||
bdaddr_t bdaddr;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define OCF_PIN_CODE_REPLY 0x000D
|
||||
struct hci_cp_pin_code_reply {
|
||||
bdaddr_t bdaddr;
|
||||
uint8 pin_len;
|
||||
uint8 pin_code[HCI_PIN_SIZE];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define OCF_PIN_CODE_NEG_REPLY 0x000E
|
||||
struct hci_cp_pin_code_neg_reply {
|
||||
bdaddr_t bdaddr;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define OCF_CHANGE_CONN_PTYPE 0x000F
|
||||
struct hci_cp_change_conn_ptype {
|
||||
uint16 handle;
|
||||
uint16 pkt_type;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define OCF_AUTH_REQUESTED 0x0011
|
||||
struct hci_cp_auth_requested {
|
||||
uint16 handle;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define OCF_SET_CONN_ENCRYPT 0x0013
|
||||
struct hci_cp_set_conn_encrypt {
|
||||
uint16 handle;
|
||||
uint8 encrypt;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define OCF_CHANGE_CONN_LINK_KEY 0x0015
|
||||
struct hci_cp_change_conn_link_key {
|
||||
uint16 handle;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define OCF_REMOTE_NAME_REQUEST 0x0019
|
||||
struct hci_remote_name_request {
|
||||
bdaddr_t bdaddr;
|
||||
uint8 pscan_rep_mode;
|
||||
uint8 reserved;
|
||||
uint16 clock_offset;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define OCF_READ_REMOTE_FEATURES 0x001B
|
||||
struct hci_cp_read_rmt_features {
|
||||
uint16 handle;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define OCF_READ_REMOTE_VERSION 0x001D
|
||||
struct hci_cp_read_rmt_version {
|
||||
uint16 handle;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
|
||||
/* Link Policy Command definition */
|
||||
#define OGF_LINK_POLICY 0x02
|
||||
|
||||
#define OCF_ROLE_DISCOVERY 0x0009
|
||||
struct hci_cp_role_discovery {
|
||||
uint16 handle;
|
||||
} __attribute__ ((packed));
|
||||
struct hci_rp_role_discovery {
|
||||
uint8 status;
|
||||
uint16 handle;
|
||||
uint8 role;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define OCF_READ_LINK_POLICY 0x000C
|
||||
struct hci_cp_read_link_policy {
|
||||
uint16 handle;
|
||||
} __attribute__ ((packed));
|
||||
struct hci_rp_read_link_policy {
|
||||
uint8 status;
|
||||
uint16 handle;
|
||||
uint16 policy;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define OCF_SWITCH_ROLE 0x000B
|
||||
struct hci_cp_switch_role {
|
||||
bdaddr_t bdaddr;
|
||||
uint8 role;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define OCF_WRITE_LINK_POLICY 0x000D
|
||||
struct hci_cp_write_link_policy {
|
||||
uint16 handle;
|
||||
uint16 policy;
|
||||
} __attribute__ ((packed));
|
||||
struct hci_rp_write_link_policy {
|
||||
uint8 status;
|
||||
uint16 handle;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/* Status params */
|
||||
#define OGF_STATUS_PARAM 0x05
|
||||
|
||||
/* Testing commands */
|
||||
#define OGF_TESTING_CMD 0x3E
|
||||
|
||||
/* Vendor specific commands */
|
||||
#define OGF_VENDOR_CMD 0x3F
|
||||
|
||||
#endif
|
||||
|
@ -1,331 +1,331 @@
|
||||
/*
|
||||
* Copyright 2007 Oliver Ruiz Dorantes, oliver.ruiz.dorantes_at_gmail.com
|
||||
*
|
||||
* All rights reserved. Distributed under the terms of the MIT License.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _BTHCI_EVENT_H_
|
||||
#define _BTHCI_EVENT_H_
|
||||
|
||||
#include <bluetooth/bluetooth.h>
|
||||
#include <bluetooth/HCI/btHCI.h>
|
||||
|
||||
#define HCI_EVENT_HDR_SIZE 2
|
||||
|
||||
struct hci_event_header {
|
||||
uint8 ecode;
|
||||
uint8 elen;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
|
||||
/* ---- HCI Events ---- */
|
||||
#define HCI_EVENT_INQUIRY_COMPLETE 0x01
|
||||
|
||||
#define HCI_EVENT_INQUIRY_RESULT 0x02
|
||||
struct inquiry_info {
|
||||
bdaddr_t bdaddr;
|
||||
uint8 pscan_rep_mode;
|
||||
uint8 pscan_period_mode;
|
||||
uint8 pscan_mode;
|
||||
uint8 dev_class[3];
|
||||
uint16 clock_offset;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define HCI_EVENT_CONN_COMPLETE 0x03
|
||||
struct hci_ev_conn_complete {
|
||||
uint8 status;
|
||||
uint16 handle;
|
||||
bdaddr_t bdaddr;
|
||||
uint8 link_type;
|
||||
uint8 encrypt_mode;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define HCI_EVENT_CONN_REQUEST 0x04
|
||||
struct hci_ev_conn_request {
|
||||
bdaddr_t bdaddr;
|
||||
uint8 dev_class[3];
|
||||
uint8 link_type;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define HCI_EVENT_DISCONNECTION_COMPLETE 0x05
|
||||
struct hci_disconnection_complete_reply {
|
||||
uint8 status;
|
||||
uint16 handle;
|
||||
uint8 reason;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define HCI_EVENT_AUTH_COMPLETE 0x06
|
||||
struct hci_ev_auth_complete {
|
||||
uint8 status;
|
||||
uint16 handle;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define HCI_EVENT_REMOTE_NAME_REQUEST_COMPLETE 0x07
|
||||
struct hci_remote_name_request_complete_reply {
|
||||
uint8 status;
|
||||
bdaddr_t bdaddr;
|
||||
char remote_name[248];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define HCI_EVENT_ENCRYPT_CHANGE 0x08
|
||||
struct hci_ev_encrypt_change {
|
||||
uint8 status;
|
||||
uint16 handle;
|
||||
uint8 encrypt;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define HCI_EVENT_CHANGE_CONN_LINK_KEY_COMPLETE 0x09
|
||||
struct hci_ev_change_conn_link_key_complete {
|
||||
uint8 status;
|
||||
uint16 handle;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define HCI_EVENT_MASTER_LINK_KEY_COMPL 0x0a
|
||||
struct hci_ev_master_link_key_complete {
|
||||
uint8 status; /* 0x00 - success */
|
||||
uint16 handle; /* Connection handle */
|
||||
uint8 key_flag; /* Key flag */
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define HCI_EVENT_RMT_FEATURES 0x0B
|
||||
struct hci_ev_rmt_features {
|
||||
uint8 status;
|
||||
uint16 handle;
|
||||
uint8 features[8];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define HCI_EVENT_RMT_VERSION 0x0C
|
||||
struct hci_ev_rmt_version {
|
||||
uint8 status;
|
||||
uint16 handle;
|
||||
uint8 lmp_ver;
|
||||
uint16 manufacturer;
|
||||
uint16 lmp_subver;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define HCI_EVENT_QOS_SETUP_COMPLETE 0x0D
|
||||
struct hci_qos {
|
||||
uint8 service_type;
|
||||
uint32 token_rate;
|
||||
uint32 peak_bandwidth;
|
||||
uint32 latency;
|
||||
uint32 delay_variation;
|
||||
} __attribute__ ((packed));
|
||||
struct hci_ev_qos_setup_complete {
|
||||
uint8 status;
|
||||
uint16 handle;
|
||||
struct hci_qos qos;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define HCI_EVENT_CMD_COMPLETE 0x0E
|
||||
struct hci_ev_cmd_complete {
|
||||
uint8 ncmd;
|
||||
uint16 opcode;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define HCI_EVENT_CMD_STATUS 0x0F
|
||||
struct hci_ev_cmd_status {
|
||||
uint8 status;
|
||||
uint8 ncmd;
|
||||
uint16 opcode;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define HCI_EVENT_HARDWARE_ERROR 0x10
|
||||
struct hci_ev_hardware_error {
|
||||
uint8 hardware_code; /* hardware error code */
|
||||
} __attribute__ ((packed)) ;
|
||||
|
||||
#define HCI_EVENT_FLUSH_OCCUR 0x11
|
||||
struct hci_ev_flush_occur {
|
||||
uint16 handle; /* connection handle */
|
||||
} __attribute__ ((packed)) ;
|
||||
|
||||
#define HCI_EVENT_ROLE_CHANGE 0x12
|
||||
struct hci_ev_role_change {
|
||||
uint8 status;
|
||||
bdaddr_t bdaddr;
|
||||
uint8 role;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define HCI_EVENT_NUM_COMP_PKTS 0x13
|
||||
struct handle_and_number {
|
||||
uint16 handle;
|
||||
uint16 num_completed;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct hci_ev_num_comp_pkts {
|
||||
uint8 num_hndl;
|
||||
// struct handle_and_number; hardcoded...
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define HCI_EVENT_MODE_CHANGE 0x14
|
||||
struct hci_ev_mode_change {
|
||||
uint8 status;
|
||||
uint16 handle;
|
||||
uint8 mode;
|
||||
uint16 interval;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define HCI_EVENT_RETURN_LINK_KEYS 0x15
|
||||
struct link_key_info {
|
||||
bdaddr_t bdaddr;
|
||||
uint8 link_key[HCI_LINK_KEY_SIZE];
|
||||
} __attribute__ ((packed)) ;
|
||||
struct hci_ev_return_link_keys {
|
||||
uint8 num_keys; /* # of keys */
|
||||
struct link_key_info link_keys; /* As much as num_keys param */
|
||||
} __attribute__ ((packed)) ;
|
||||
|
||||
#define HCI_EVENT_PIN_CODE_REQ 0x16
|
||||
struct hci_ev_pin_code_req {
|
||||
bdaddr_t bdaddr;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define HCI_EVENT_LINK_KEY_REQ 0x17
|
||||
struct hci_ev_link_key_req {
|
||||
bdaddr_t bdaddr;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define HCI_EVENT_LINK_KEY_NOTIFY 0x18
|
||||
struct hci_ev_link_key_notify {
|
||||
bdaddr_t bdaddr;
|
||||
uint8 link_key[16];
|
||||
uint8 key_type;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define HCI_EVENT_LOOPBACK_COMMAND 0x19
|
||||
struct hci_ev_loopback_command {
|
||||
uint8 command[0]; /* depends of command */
|
||||
} __attribute__ ((packed)) ;
|
||||
|
||||
#define HCI_EVENT_DATA_BUFFER_OVERFLOW 0x1a
|
||||
struct hci_ev_data_buffer_overflow {
|
||||
uint8 link_type; /* Link type */
|
||||
} __attribute__ ((packed)) ;
|
||||
|
||||
#define HCI_EVENT_MAX_SLOT_CHANGE 0x1b
|
||||
struct hci_ev_max_slot_change {
|
||||
uint16 handle; /* connection handle */
|
||||
uint8 lmp_max_slots; /* Max. # of slots allowed */
|
||||
} __attribute__ ((packed)) ;
|
||||
|
||||
#define HCI_EVENT_READ_CLOCK_OFFSET_COMPL 0x1c
|
||||
struct hci_ev_read_clock_offset_compl {
|
||||
uint8 status; /* 0x00 - success */
|
||||
uint16 handle; /* Connection handle */
|
||||
uint16 clock_offset; /* Clock offset */
|
||||
} __attribute__ ((packed)) ;
|
||||
|
||||
#define HCI_EVENT_CON_PKT_TYPE_CHANGED 0x1d
|
||||
struct hci_ev_con_pkt_type_changed {
|
||||
uint8 status; /* 0x00 - success */
|
||||
uint16 handle; /* connection handle */
|
||||
uint16 pkt_type; /* packet type */
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define HCI_EVENT_QOS_VIOLATION 0x1e
|
||||
struct hci_ev_qos_violation {
|
||||
uint16 handle; /* connection handle */
|
||||
} __attribute__ ((packed)) ;
|
||||
|
||||
#define HCI_EVENT_PAGE_SCAN_REP_MODE_CHANGE 0x20
|
||||
struct hci_ev_page_scan_rep_mode_change {
|
||||
bdaddr_t bdaddr; /* destination address */
|
||||
uint8 page_scan_rep_mode; /* page scan repetition mode */
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/* Events Beyond Bluetooth 1.1 */
|
||||
#define HCI_EVENT_FLOW_SPECIFICATION 0x21
|
||||
struct hci_ev_flow_specification {
|
||||
uint8 status;
|
||||
uint16 handle;
|
||||
uint8 flags;
|
||||
uint8 flow_direction;
|
||||
uint8 service_type;
|
||||
uint32 token_rate;
|
||||
uint32 token_bucket_size;
|
||||
uint32 peak_bandwidth;
|
||||
uint32 access_latency;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define HCI_EVENT_INQUIRY_RESULT_WITH_RSSI 0x22
|
||||
struct hci_ev_inquiry_info_with_rssi {
|
||||
bdaddr_t bdaddr;
|
||||
uint8 pscan_rep_mode;
|
||||
uint8 pscan_period_mode;
|
||||
uint8 dev_class[3];
|
||||
uint16 clock_offset;
|
||||
int8 rssi;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define HCI_EVENT_REMOTE_EXTENDED_FEATURES 0x23
|
||||
struct hci_ev_remote_extended_features {
|
||||
uint8 status;
|
||||
uint16 handle;
|
||||
uint8 page_number;
|
||||
uint8 maximun_page_number;
|
||||
uint64 extended_lmp_features;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define HCI_EVENT_SYNCHRONOUS_CONNECTION_COMPLETED 0x2C
|
||||
struct hci_ev_sychronous_connection_completed {
|
||||
uint8 status;
|
||||
uint16 handle;
|
||||
bdaddr_t bdaddr;
|
||||
uint8 link_type;
|
||||
uint8 transmission_interval;
|
||||
uint8 retransmission_window;
|
||||
uint16 rx_packet_length;
|
||||
uint16 tx_packet_length;
|
||||
uint8 air_mode;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define HCI_EVENT_SYNCHRONOUS_CONNECTION_CHANGED 0x2D
|
||||
struct hci_ev_sychronous_connection_changed {
|
||||
uint8 status;
|
||||
uint16 handle;
|
||||
uint8 transmission_interval;
|
||||
uint8 retransmission_window;
|
||||
uint16 rx_packet_length;
|
||||
uint16 tx_packet_length;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
// TODO: Define remaining Bluetooth 2.1 events structures
|
||||
#define HCI_EVENT_EXTENDED_INQUIRY_RESULT 0x2F
|
||||
|
||||
#define HCI_EVENT_ENCRYPTION_KEY_REFERSH_COMPLETE 0x30
|
||||
|
||||
#define HCI_EVENT_IO_CAPABILITY_REQUEST 0x31
|
||||
|
||||
#define HCI_EVENT_IO_CAPABILITY_RESPONSE 0x32
|
||||
|
||||
#define HCI_EVENT_USER_CONFIRMATION_REQUEST 0x33
|
||||
|
||||
#define HCI_EVENT_USER_PASSKEY_REQUEST 0x34
|
||||
|
||||
#define HCI_EVENT_OOB_DATA_REQUEST 0x35
|
||||
|
||||
#define HCI_EVENT_SIMPLE_PAIRING_COMPLETE 0x36
|
||||
|
||||
#define HCI_EVENT_LINK_SUPERVISION_TIMEOUT_CHANGED 0x38
|
||||
|
||||
#define HCI_EVENT_ENHANCED_FLUSH_COMPLETE 0x39
|
||||
|
||||
#define HCI_EVENT_KEYPRESS_NOTIFICATION 0x3C
|
||||
|
||||
#define HCI_EVENT_REMOTE_HOST_SUPPORTED_FEATURES_NOTIFICATION 0x3D
|
||||
|
||||
|
||||
|
||||
|
||||
/* HAIKU Internal Events, not produced by the transport devices but
|
||||
* by some entity of the Haiku Bluetooth Stack.
|
||||
* The MSB 0xE is chosen for this purpose
|
||||
*/
|
||||
|
||||
#define HCI_HAIKU_EVENT_SERVER_QUITTING 0xE0
|
||||
#define HCI_HAIKU_EVENT_DEVICE_REMOVED 0xE1
|
||||
|
||||
|
||||
#endif
|
||||
/*
|
||||
* Copyright 2007 Oliver Ruiz Dorantes, oliver.ruiz.dorantes_at_gmail.com
|
||||
*
|
||||
* All rights reserved. Distributed under the terms of the MIT License.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _BTHCI_EVENT_H_
|
||||
#define _BTHCI_EVENT_H_
|
||||
|
||||
#include <bluetooth/bluetooth.h>
|
||||
#include <bluetooth/HCI/btHCI.h>
|
||||
|
||||
#define HCI_EVENT_HDR_SIZE 2
|
||||
|
||||
struct hci_event_header {
|
||||
uint8 ecode;
|
||||
uint8 elen;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
|
||||
/* ---- HCI Events ---- */
|
||||
#define HCI_EVENT_INQUIRY_COMPLETE 0x01
|
||||
|
||||
#define HCI_EVENT_INQUIRY_RESULT 0x02
|
||||
struct inquiry_info {
|
||||
bdaddr_t bdaddr;
|
||||
uint8 pscan_rep_mode;
|
||||
uint8 pscan_period_mode;
|
||||
uint8 pscan_mode;
|
||||
uint8 dev_class[3];
|
||||
uint16 clock_offset;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define HCI_EVENT_CONN_COMPLETE 0x03
|
||||
struct hci_ev_conn_complete {
|
||||
uint8 status;
|
||||
uint16 handle;
|
||||
bdaddr_t bdaddr;
|
||||
uint8 link_type;
|
||||
uint8 encrypt_mode;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define HCI_EVENT_CONN_REQUEST 0x04
|
||||
struct hci_ev_conn_request {
|
||||
bdaddr_t bdaddr;
|
||||
uint8 dev_class[3];
|
||||
uint8 link_type;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define HCI_EVENT_DISCONNECTION_COMPLETE 0x05
|
||||
struct hci_disconnection_complete_reply {
|
||||
uint8 status;
|
||||
uint16 handle;
|
||||
uint8 reason;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define HCI_EVENT_AUTH_COMPLETE 0x06
|
||||
struct hci_ev_auth_complete {
|
||||
uint8 status;
|
||||
uint16 handle;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define HCI_EVENT_REMOTE_NAME_REQUEST_COMPLETE 0x07
|
||||
struct hci_remote_name_request_complete_reply {
|
||||
uint8 status;
|
||||
bdaddr_t bdaddr;
|
||||
char remote_name[248];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define HCI_EVENT_ENCRYPT_CHANGE 0x08
|
||||
struct hci_ev_encrypt_change {
|
||||
uint8 status;
|
||||
uint16 handle;
|
||||
uint8 encrypt;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define HCI_EVENT_CHANGE_CONN_LINK_KEY_COMPLETE 0x09
|
||||
struct hci_ev_change_conn_link_key_complete {
|
||||
uint8 status;
|
||||
uint16 handle;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define HCI_EVENT_MASTER_LINK_KEY_COMPL 0x0a
|
||||
struct hci_ev_master_link_key_complete {
|
||||
uint8 status; /* 0x00 - success */
|
||||
uint16 handle; /* Connection handle */
|
||||
uint8 key_flag; /* Key flag */
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define HCI_EVENT_RMT_FEATURES 0x0B
|
||||
struct hci_ev_rmt_features {
|
||||
uint8 status;
|
||||
uint16 handle;
|
||||
uint8 features[8];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define HCI_EVENT_RMT_VERSION 0x0C
|
||||
struct hci_ev_rmt_version {
|
||||
uint8 status;
|
||||
uint16 handle;
|
||||
uint8 lmp_ver;
|
||||
uint16 manufacturer;
|
||||
uint16 lmp_subver;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define HCI_EVENT_QOS_SETUP_COMPLETE 0x0D
|
||||
struct hci_qos {
|
||||
uint8 service_type;
|
||||
uint32 token_rate;
|
||||
uint32 peak_bandwidth;
|
||||
uint32 latency;
|
||||
uint32 delay_variation;
|
||||
} __attribute__ ((packed));
|
||||
struct hci_ev_qos_setup_complete {
|
||||
uint8 status;
|
||||
uint16 handle;
|
||||
struct hci_qos qos;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define HCI_EVENT_CMD_COMPLETE 0x0E
|
||||
struct hci_ev_cmd_complete {
|
||||
uint8 ncmd;
|
||||
uint16 opcode;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define HCI_EVENT_CMD_STATUS 0x0F
|
||||
struct hci_ev_cmd_status {
|
||||
uint8 status;
|
||||
uint8 ncmd;
|
||||
uint16 opcode;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define HCI_EVENT_HARDWARE_ERROR 0x10
|
||||
struct hci_ev_hardware_error {
|
||||
uint8 hardware_code; /* hardware error code */
|
||||
} __attribute__ ((packed)) ;
|
||||
|
||||
#define HCI_EVENT_FLUSH_OCCUR 0x11
|
||||
struct hci_ev_flush_occur {
|
||||
uint16 handle; /* connection handle */
|
||||
} __attribute__ ((packed)) ;
|
||||
|
||||
#define HCI_EVENT_ROLE_CHANGE 0x12
|
||||
struct hci_ev_role_change {
|
||||
uint8 status;
|
||||
bdaddr_t bdaddr;
|
||||
uint8 role;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define HCI_EVENT_NUM_COMP_PKTS 0x13
|
||||
struct handle_and_number {
|
||||
uint16 handle;
|
||||
uint16 num_completed;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct hci_ev_num_comp_pkts {
|
||||
uint8 num_hndl;
|
||||
// struct handle_and_number; hardcoded...
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define HCI_EVENT_MODE_CHANGE 0x14
|
||||
struct hci_ev_mode_change {
|
||||
uint8 status;
|
||||
uint16 handle;
|
||||
uint8 mode;
|
||||
uint16 interval;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define HCI_EVENT_RETURN_LINK_KEYS 0x15
|
||||
struct link_key_info {
|
||||
bdaddr_t bdaddr;
|
||||
uint8 link_key[HCI_LINK_KEY_SIZE];
|
||||
} __attribute__ ((packed)) ;
|
||||
struct hci_ev_return_link_keys {
|
||||
uint8 num_keys; /* # of keys */
|
||||
struct link_key_info link_keys; /* As much as num_keys param */
|
||||
} __attribute__ ((packed)) ;
|
||||
|
||||
#define HCI_EVENT_PIN_CODE_REQ 0x16
|
||||
struct hci_ev_pin_code_req {
|
||||
bdaddr_t bdaddr;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define HCI_EVENT_LINK_KEY_REQ 0x17
|
||||
struct hci_ev_link_key_req {
|
||||
bdaddr_t bdaddr;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define HCI_EVENT_LINK_KEY_NOTIFY 0x18
|
||||
struct hci_ev_link_key_notify {
|
||||
bdaddr_t bdaddr;
|
||||
uint8 link_key[16];
|
||||
uint8 key_type;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define HCI_EVENT_LOOPBACK_COMMAND 0x19
|
||||
struct hci_ev_loopback_command {
|
||||
uint8 command[0]; /* depends of command */
|
||||
} __attribute__ ((packed)) ;
|
||||
|
||||
#define HCI_EVENT_DATA_BUFFER_OVERFLOW 0x1a
|
||||
struct hci_ev_data_buffer_overflow {
|
||||
uint8 link_type; /* Link type */
|
||||
} __attribute__ ((packed)) ;
|
||||
|
||||
#define HCI_EVENT_MAX_SLOT_CHANGE 0x1b
|
||||
struct hci_ev_max_slot_change {
|
||||
uint16 handle; /* connection handle */
|
||||
uint8 lmp_max_slots; /* Max. # of slots allowed */
|
||||
} __attribute__ ((packed)) ;
|
||||
|
||||
#define HCI_EVENT_READ_CLOCK_OFFSET_COMPL 0x1c
|
||||
struct hci_ev_read_clock_offset_compl {
|
||||
uint8 status; /* 0x00 - success */
|
||||
uint16 handle; /* Connection handle */
|
||||
uint16 clock_offset; /* Clock offset */
|
||||
} __attribute__ ((packed)) ;
|
||||
|
||||
#define HCI_EVENT_CON_PKT_TYPE_CHANGED 0x1d
|
||||
struct hci_ev_con_pkt_type_changed {
|
||||
uint8 status; /* 0x00 - success */
|
||||
uint16 handle; /* connection handle */
|
||||
uint16 pkt_type; /* packet type */
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define HCI_EVENT_QOS_VIOLATION 0x1e
|
||||
struct hci_ev_qos_violation {
|
||||
uint16 handle; /* connection handle */
|
||||
} __attribute__ ((packed)) ;
|
||||
|
||||
#define HCI_EVENT_PAGE_SCAN_REP_MODE_CHANGE 0x20
|
||||
struct hci_ev_page_scan_rep_mode_change {
|
||||
bdaddr_t bdaddr; /* destination address */
|
||||
uint8 page_scan_rep_mode; /* page scan repetition mode */
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/* Events Beyond Bluetooth 1.1 */
|
||||
#define HCI_EVENT_FLOW_SPECIFICATION 0x21
|
||||
struct hci_ev_flow_specification {
|
||||
uint8 status;
|
||||
uint16 handle;
|
||||
uint8 flags;
|
||||
uint8 flow_direction;
|
||||
uint8 service_type;
|
||||
uint32 token_rate;
|
||||
uint32 token_bucket_size;
|
||||
uint32 peak_bandwidth;
|
||||
uint32 access_latency;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define HCI_EVENT_INQUIRY_RESULT_WITH_RSSI 0x22
|
||||
struct hci_ev_inquiry_info_with_rssi {
|
||||
bdaddr_t bdaddr;
|
||||
uint8 pscan_rep_mode;
|
||||
uint8 pscan_period_mode;
|
||||
uint8 dev_class[3];
|
||||
uint16 clock_offset;
|
||||
int8 rssi;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define HCI_EVENT_REMOTE_EXTENDED_FEATURES 0x23
|
||||
struct hci_ev_remote_extended_features {
|
||||
uint8 status;
|
||||
uint16 handle;
|
||||
uint8 page_number;
|
||||
uint8 maximun_page_number;
|
||||
uint64 extended_lmp_features;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define HCI_EVENT_SYNCHRONOUS_CONNECTION_COMPLETED 0x2C
|
||||
struct hci_ev_sychronous_connection_completed {
|
||||
uint8 status;
|
||||
uint16 handle;
|
||||
bdaddr_t bdaddr;
|
||||
uint8 link_type;
|
||||
uint8 transmission_interval;
|
||||
uint8 retransmission_window;
|
||||
uint16 rx_packet_length;
|
||||
uint16 tx_packet_length;
|
||||
uint8 air_mode;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define HCI_EVENT_SYNCHRONOUS_CONNECTION_CHANGED 0x2D
|
||||
struct hci_ev_sychronous_connection_changed {
|
||||
uint8 status;
|
||||
uint16 handle;
|
||||
uint8 transmission_interval;
|
||||
uint8 retransmission_window;
|
||||
uint16 rx_packet_length;
|
||||
uint16 tx_packet_length;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
// TODO: Define remaining Bluetooth 2.1 events structures
|
||||
#define HCI_EVENT_EXTENDED_INQUIRY_RESULT 0x2F
|
||||
|
||||
#define HCI_EVENT_ENCRYPTION_KEY_REFERSH_COMPLETE 0x30
|
||||
|
||||
#define HCI_EVENT_IO_CAPABILITY_REQUEST 0x31
|
||||
|
||||
#define HCI_EVENT_IO_CAPABILITY_RESPONSE 0x32
|
||||
|
||||
#define HCI_EVENT_USER_CONFIRMATION_REQUEST 0x33
|
||||
|
||||
#define HCI_EVENT_USER_PASSKEY_REQUEST 0x34
|
||||
|
||||
#define HCI_EVENT_OOB_DATA_REQUEST 0x35
|
||||
|
||||
#define HCI_EVENT_SIMPLE_PAIRING_COMPLETE 0x36
|
||||
|
||||
#define HCI_EVENT_LINK_SUPERVISION_TIMEOUT_CHANGED 0x38
|
||||
|
||||
#define HCI_EVENT_ENHANCED_FLUSH_COMPLETE 0x39
|
||||
|
||||
#define HCI_EVENT_KEYPRESS_NOTIFICATION 0x3C
|
||||
|
||||
#define HCI_EVENT_REMOTE_HOST_SUPPORTED_FEATURES_NOTIFICATION 0x3D
|
||||
|
||||
|
||||
|
||||
|
||||
/* HAIKU Internal Events, not produced by the transport devices but
|
||||
* by some entity of the Haiku Bluetooth Stack.
|
||||
* The MSB 0xE is chosen for this purpose
|
||||
*/
|
||||
|
||||
#define HCI_HAIKU_EVENT_SERVER_QUITTING 0xE0
|
||||
#define HCI_HAIKU_EVENT_DEVICE_REMOVED 0xE1
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -1,39 +1,39 @@
|
||||
/*
|
||||
* Copyright 2007 Oliver Ruiz Dorantes, oliver.ruiz.dorantes_at_gmail.com
|
||||
*
|
||||
* All rights reserved. Distributed under the terms of the MIT License.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _BTHCI_MODULE_H_
|
||||
#define _BTHCI_MODULE_H_
|
||||
|
||||
/* includes */
|
||||
|
||||
#include <bluetooth/HCI/btHCI.h>
|
||||
#include <bluetooth/HCI/btHCI_transport.h>
|
||||
#include <net_buffer.h>
|
||||
|
||||
/* defines */
|
||||
#define BT_HCI_MODULE_NAME "bus_managers/hci/v1"
|
||||
|
||||
/* TODO: Possible definition of a bus manager of whatever is gonna be on the top */
|
||||
typedef struct bt_hci_module_info {
|
||||
|
||||
/* registration */
|
||||
status_t (*RegisterDriver)(bt_hci_transport* desc, hci_id *id /*out*/,
|
||||
bt_hci_device* cookie /*out*/ );
|
||||
status_t (*UnregisterDriver)(hci_id id);
|
||||
|
||||
/* Transferences to be called from drivers */
|
||||
|
||||
status_t (*PostACL)(hci_id id, net_buffer* nbuf);
|
||||
status_t (*PostSCO)(hci_id id, net_buffer* nbuf);
|
||||
|
||||
/* Management */
|
||||
bt_hci_device* (*GetHciDevice)(hci_id id);
|
||||
|
||||
} bt_hci_module_info ;
|
||||
|
||||
|
||||
/*
|
||||
* Copyright 2007 Oliver Ruiz Dorantes, oliver.ruiz.dorantes_at_gmail.com
|
||||
*
|
||||
* All rights reserved. Distributed under the terms of the MIT License.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _BTHCI_MODULE_H_
|
||||
#define _BTHCI_MODULE_H_
|
||||
|
||||
/* includes */
|
||||
|
||||
#include <bluetooth/HCI/btHCI.h>
|
||||
#include <bluetooth/HCI/btHCI_transport.h>
|
||||
#include <net_buffer.h>
|
||||
|
||||
/* defines */
|
||||
#define BT_HCI_MODULE_NAME "bus_managers/hci/v1"
|
||||
|
||||
/* TODO: Possible definition of a bus manager of whatever is gonna be on the top */
|
||||
typedef struct bt_hci_module_info {
|
||||
|
||||
/* registration */
|
||||
status_t (*RegisterDriver)(bt_hci_transport* desc, hci_id *id /*out*/,
|
||||
bt_hci_device* cookie /*out*/ );
|
||||
status_t (*UnregisterDriver)(hci_id id);
|
||||
|
||||
/* Transferences to be called from drivers */
|
||||
|
||||
status_t (*PostACL)(hci_id id, net_buffer* nbuf);
|
||||
status_t (*PostSCO)(hci_id id, net_buffer* nbuf);
|
||||
|
||||
/* Management */
|
||||
bt_hci_device* (*GetHciDevice)(hci_id id);
|
||||
|
||||
} bt_hci_module_info ;
|
||||
|
||||
|
||||
#endif
|
@ -1,101 +1,101 @@
|
||||
/*
|
||||
* Copyright 2007 Oliver Ruiz Dorantes, oliver.ruiz.dorantes_at_gmail.com
|
||||
*
|
||||
* All rights reserved. Distributed under the terms of the MIT License.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _BTHCI_TRANSPORT_H_
|
||||
#define _BTHCI_TRANSPORT_H_
|
||||
|
||||
#include <bluetooth/HCI/btHCI.h>
|
||||
|
||||
#include <net_buffer.h>
|
||||
#include <Drivers.h>
|
||||
|
||||
typedef enum { ANCILLYANT = 1,
|
||||
RUNNING,
|
||||
LEAVING,
|
||||
SENDING,
|
||||
PROCESSING
|
||||
} bt_transport_status_t;
|
||||
|
||||
typedef uint8 bt_stat_t;
|
||||
typedef struct bt_hci_statistics {
|
||||
|
||||
bt_stat_t acceptedTX;
|
||||
bt_stat_t rejectedTX;
|
||||
bt_stat_t successfulTX;
|
||||
bt_stat_t errorTX;
|
||||
|
||||
bt_stat_t acceptedRX;
|
||||
bt_stat_t rejectedRX;
|
||||
bt_stat_t successfulRX;
|
||||
bt_stat_t errorRX;
|
||||
|
||||
bt_stat_t commandTX;
|
||||
bt_stat_t eventRX;
|
||||
bt_stat_t aclTX;
|
||||
bt_stat_t aclRX;
|
||||
bt_stat_t scoTX;
|
||||
bt_stat_t scoRX;
|
||||
bt_stat_t escoTX;
|
||||
bt_stat_t escoRX;
|
||||
|
||||
bt_stat_t bytesRX;
|
||||
bt_stat_t bytesTX;
|
||||
|
||||
|
||||
} bt_hci_statistics;
|
||||
|
||||
/* TODO: Possible Hooks which drivers will have to provide */
|
||||
typedef struct bt_hci_transport {
|
||||
|
||||
status_t (*SendCommand)(hci_id hci_dev, net_buffer* snbuf);
|
||||
status_t (*SendPacket)(hci_id hci_dev, net_buffer* nbuf );
|
||||
status_t (*SendSCO)(hci_id hci_dev, net_buffer* nbuf );
|
||||
status_t (*DeliverStatistics)(bt_hci_statistics* statistics);
|
||||
|
||||
transport_type kind;
|
||||
char name[B_OS_NAME_LENGTH];
|
||||
|
||||
} bt_hci_transport;
|
||||
|
||||
typedef struct bt_hci_device {
|
||||
|
||||
transport_type kind;
|
||||
char realName[B_OS_NAME_LENGTH];
|
||||
|
||||
} bt_hci_device;
|
||||
|
||||
|
||||
/* Here the transport driver have some flags that */
|
||||
/* can be used to inform the upper layer about some */
|
||||
/* special behaouvior to perform */
|
||||
|
||||
#define BT_IGNORE_THIS_DEVICE (1<<0)
|
||||
#define BT_SCO_NOT_WORKING (1<<1)
|
||||
#define BT_WILL_NEED_A_RESET (1<<2)
|
||||
#define BT_DIGIANSWER (1<<4)
|
||||
|
||||
/* Mandatory IOCTLS to be */
|
||||
|
||||
#define BT_IOCTLS_OFFSET 3000
|
||||
|
||||
enum {
|
||||
ISSUE_BT_COMMAND = B_DEVICE_OP_CODES_END + BT_IOCTLS_OFFSET ,
|
||||
GET_STATICS,
|
||||
GET_NOTIFICATION_PORT,
|
||||
GET_HCI_ID
|
||||
};
|
||||
|
||||
#define PACK_PORTCODE(type,hid,data) ((type&0xFF)<<24|(hid&0xFF)<<16|(data&0xFFFF))
|
||||
#define GET_PORTCODE_TYPE(code) ((code&0xFF000000)>>24)
|
||||
#define GET_PORTCODE_HID(code) ((code&0x00FF0000)>>16)
|
||||
#define GET_PORTCODE_DATA(code) ((code&0x0000FFFF))
|
||||
|
||||
/* Port drivers can use to send information (1 for all for
|
||||
at moment refer to ioctl GET_NOTIFICATION_PORT)*/
|
||||
#define BT_USERLAND_PORT_NAME "BT kernel-user Land"
|
||||
|
||||
#endif
|
||||
/*
|
||||
* Copyright 2007 Oliver Ruiz Dorantes, oliver.ruiz.dorantes_at_gmail.com
|
||||
*
|
||||
* All rights reserved. Distributed under the terms of the MIT License.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _BTHCI_TRANSPORT_H_
|
||||
#define _BTHCI_TRANSPORT_H_
|
||||
|
||||
#include <bluetooth/HCI/btHCI.h>
|
||||
|
||||
#include <net_buffer.h>
|
||||
#include <Drivers.h>
|
||||
|
||||
typedef enum { ANCILLYANT = 1,
|
||||
RUNNING,
|
||||
LEAVING,
|
||||
SENDING,
|
||||
PROCESSING
|
||||
} bt_transport_status_t;
|
||||
|
||||
typedef uint8 bt_stat_t;
|
||||
typedef struct bt_hci_statistics {
|
||||
|
||||
bt_stat_t acceptedTX;
|
||||
bt_stat_t rejectedTX;
|
||||
bt_stat_t successfulTX;
|
||||
bt_stat_t errorTX;
|
||||
|
||||
bt_stat_t acceptedRX;
|
||||
bt_stat_t rejectedRX;
|
||||
bt_stat_t successfulRX;
|
||||
bt_stat_t errorRX;
|
||||
|
||||
bt_stat_t commandTX;
|
||||
bt_stat_t eventRX;
|
||||
bt_stat_t aclTX;
|
||||
bt_stat_t aclRX;
|
||||
bt_stat_t scoTX;
|
||||
bt_stat_t scoRX;
|
||||
bt_stat_t escoTX;
|
||||
bt_stat_t escoRX;
|
||||
|
||||
bt_stat_t bytesRX;
|
||||
bt_stat_t bytesTX;
|
||||
|
||||
|
||||
} bt_hci_statistics;
|
||||
|
||||
/* TODO: Possible Hooks which drivers will have to provide */
|
||||
typedef struct bt_hci_transport {
|
||||
|
||||
status_t (*SendCommand)(hci_id hci_dev, net_buffer* snbuf);
|
||||
status_t (*SendPacket)(hci_id hci_dev, net_buffer* nbuf );
|
||||
status_t (*SendSCO)(hci_id hci_dev, net_buffer* nbuf );
|
||||
status_t (*DeliverStatistics)(bt_hci_statistics* statistics);
|
||||
|
||||
transport_type kind;
|
||||
char name[B_OS_NAME_LENGTH];
|
||||
|
||||
} bt_hci_transport;
|
||||
|
||||
typedef struct bt_hci_device {
|
||||
|
||||
transport_type kind;
|
||||
char realName[B_OS_NAME_LENGTH];
|
||||
|
||||
} bt_hci_device;
|
||||
|
||||
|
||||
/* Here the transport driver have some flags that */
|
||||
/* can be used to inform the upper layer about some */
|
||||
/* special behaouvior to perform */
|
||||
|
||||
#define BT_IGNORE_THIS_DEVICE (1<<0)
|
||||
#define BT_SCO_NOT_WORKING (1<<1)
|
||||
#define BT_WILL_NEED_A_RESET (1<<2)
|
||||
#define BT_DIGIANSWER (1<<4)
|
||||
|
||||
/* Mandatory IOCTLS to be */
|
||||
|
||||
#define BT_IOCTLS_OFFSET 3000
|
||||
|
||||
enum {
|
||||
ISSUE_BT_COMMAND = B_DEVICE_OP_CODES_END + BT_IOCTLS_OFFSET ,
|
||||
GET_STATICS,
|
||||
GET_NOTIFICATION_PORT,
|
||||
GET_HCI_ID
|
||||
};
|
||||
|
||||
#define PACK_PORTCODE(type,hid,data) ((type&0xFF)<<24|(hid&0xFF)<<16|(data&0xFFFF))
|
||||
#define GET_PORTCODE_TYPE(code) ((code&0xFF000000)>>24)
|
||||
#define GET_PORTCODE_HID(code) ((code&0x00FF0000)>>16)
|
||||
#define GET_PORTCODE_DATA(code) ((code&0x0000FFFF))
|
||||
|
||||
/* Port drivers can use to send information (1 for all for
|
||||
at moment refer to ioctl GET_NOTIFICATION_PORT)*/
|
||||
#define BT_USERLAND_PORT_NAME "BT kernel-user Land"
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user