- Read Local features al LocalDevice constructor

- keep record in UL and KL side



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36027 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Oliver Ruiz Dorantes
2010-04-02 12:12:29 +00:00
parent 0feca7d685
commit 62f5ba006a
5 changed files with 162 additions and 25 deletions
+108 -2
View File
@@ -9,7 +9,7 @@
typedef int32 hci_id;
#define HCI_DEVICE_INDEX_OFFSET 0x7c
typedef enum { H2 = 2, H3, H4, H5 } transport_type;
typedef enum { H2 = 2, H3, H4, H5 } transport_type;
typedef enum { BT_COMMAND = 0,
BT_EVENT,
@@ -44,8 +44,114 @@ const char* BluetoothError(uint8 error);
/* Device drivers need to take this into account
* when receiving ioctls. Only applies to R5 builds
* in deprecation process
* in deprecation process
*/
#define BT_IOCTLS_PASS_SIZE
// HCI Packet types
#define HCI_2DH1 0x0002
#define HCI_3DH1 0x0004
#define HCI_DM1 0x0008
#define HCI_DH1 0x0010
#define HCI_2DH3 0x0100
#define HCI_3DH3 0x0200
#define HCI_DM3 0x0400
#define HCI_DH3 0x0800
#define HCI_2DH5 0x1000
#define HCI_3DH5 0x2000
#define HCI_DM5 0x4000
#define HCI_DH5 0x8000
#define HCI_HV1 0x0020
#define HCI_HV2 0x0040
#define HCI_HV3 0x0080
#define HCI_EV3 0x0008
#define HCI_EV4 0x0010
#define HCI_EV5 0x0020
#define HCI_2EV3 0x0040
#define HCI_3EV3 0x0080
#define HCI_2EV5 0x0100
#define HCI_3EV5 0x0200
#define SCO_PTYPE_MASK (HCI_HV1 | HCI_HV2 | HCI_HV3)
#define ACL_PTYPE_MASK (HCI_DM1 | HCI_DH1 | HCI_DM3 | HCI_DH3 | HCI_DM5 | HCI_DH5)
// LMP features
#define LMP_3SLOT 0x01
#define LMP_5SLOT 0x02
#define LMP_ENCRYPT 0x04
#define LMP_SOFFSET 0x08
#define LMP_TACCURACY 0x10
#define LMP_RSWITCH 0x20
#define LMP_HOLD 0x40
#define LMP_SNIFF 0x80
#define LMP_PARK 0x01
#define LMP_RSSI 0x02
#define LMP_QUALITY 0x04
#define LMP_SCO 0x08
#define LMP_HV2 0x10
#define LMP_HV3 0x20
#define LMP_ULAW 0x40
#define LMP_ALAW 0x80
#define LMP_CVSD 0x01
#define LMP_PSCHEME 0x02
#define LMP_PCONTROL 0x04
#define LMP_TRSP_SCO 0x08
#define LMP_BCAST_ENC 0x80
#define LMP_EDR_ACL_2M 0x02
#define LMP_EDR_ACL_3M 0x04
#define LMP_ENH_ISCAN 0x08
#define LMP_ILACE_ISCAN 0x10
#define LMP_ILACE_PSCAN 0x20
#define LMP_RSSI_INQ 0x40
#define LMP_ESCO 0x80
#define LMP_EV4 0x01
#define LMP_EV5 0x02
#define LMP_AFH_CAP_SLV 0x08
#define LMP_AFH_CLS_SLV 0x10
#define LMP_EDR_3SLOT 0x80
#define LMP_EDR_5SLOT 0x01
#define LMP_SNIFF_SUBR 0x02
#define LMP_PAUSE_ENC 0x04
#define LMP_AFH_CAP_MST 0x08
#define LMP_AFH_CLS_MST 0x10
#define LMP_EDR_ESCO_2M 0x20
#define LMP_EDR_ESCO_3M 0x40
#define LMP_EDR_3S_ESCO 0x80
#define LMP_EXT_INQ 0x01
#define LMP_SIMPLE_PAIR 0x08
#define LMP_ENCAPS_PDU 0x10
#define LMP_ERR_DAT_REP 0x20
#define LMP_NFLUSH_PKTS 0x40
#define LMP_LSTO 0x01
#define LMP_INQ_TX_PWR 0x02
#define LMP_EXT_FEAT 0x80
// Link policies
#define HCI_LP_RSWITCH 0x0001
#define HCI_LP_HOLD 0x0002
#define HCI_LP_SNIFF 0x0004
#define HCI_LP_PARK 0x0008
// Link mode
#define HCI_LM_ACCEPT 0x8000
#define HCI_LM_MASTER 0x0001
#define HCI_LM_AUTH 0x0002
#define HCI_LM_ENCRYPT 0x0004
#define HCI_LM_TRUSTED 0x0008
#define HCI_LM_RELIABLE 0x0010
#define HCI_LM_SECURE 0x0020
#endif // _BTHCI_H_
+10 -7
View File
@@ -62,9 +62,9 @@ typedef struct bt_hci_transport_hooks {
// to be filled by driver
status_t (*SendCommand)(hci_id hciId, void* command);
status_t (*SendACL)(hci_id hciId, net_buffer* nbuf );
status_t (*SendSCO)(hci_id hciId, net_buffer* nbuf );
status_t (*SendESCO)(hci_id hciId, net_buffer* nbuf );
status_t (*SendACL)(hci_id hciId, net_buffer* nbuf);
status_t (*SendSCO)(hci_id hciId, net_buffer* nbuf);
status_t (*SendESCO)(hci_id hciId, net_buffer* nbuf);
status_t (*DeliverStatistics)(hci_id hciId, bt_hci_statistics* statistics);
@@ -90,6 +90,8 @@ struct bluetooth_device : DoublyLinkedListLinkImpl<bluetooth_device> {
size_t fExpectedPacketSize[HCI_NUM_PACKET_TYPES];
hci_id index;
uint16 supportedPacketTypes;
uint16 linkMode;
int fd;
bt_hci_device_information* info;
@@ -148,10 +150,11 @@ enum {
BT_UP
};
#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))
// To deprecate ...
#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)*/
+7 -5
View File
@@ -35,11 +35,11 @@ public:
BString GetFriendlyName();
DeviceClass GetDeviceClass();
status_t SetDeviceClass(DeviceClass deviceClass);
/* Possible throwing */
status_t SetDiscoverable(int mode);
BString GetProperty(const char* property);
BString GetProperty(const char* property);
status_t GetProperty(const char* property, uint32* value);
int GetDiscoverable();
@@ -53,10 +53,11 @@ private:
LocalDevice(hci_id hid);
virtual ~LocalDevice();
status_t ReadLocalVersion();
status_t ReadBufferSize();
status_t _ReadLocalVersion();
status_t _ReadBufferSize();
status_t _ReadLocalFeatures();
status_t Reset();
static LocalDevice* RequestLocalDeviceID(BMessage* request);
BMessenger* fMessenger;
@@ -70,6 +71,7 @@ private:
}
#ifndef _BT_USE_EXPLICIT_NAMESPACE
using Bluetooth::LocalDevice;
#endif