bluetooth: Implement EIR parsing for HCI_EVENT_EXTENDED_INQUIRY_EVENT
This parses only EIR_NAME_SHORT and EIR_NAME_COMPLETE, others are not yet usefull, adds a way to fetch the cached friendly name and adds a friendlyName field to RemoteDevice. Refactors DeviceListItem to work on RemoteDevice as it's only being used for that.Also adds a check if the cached name is complete or not. If not ask for the complete name. Change-Id: I7e37fb9cf44cb5598ef348fdd4d781c5ae04e24e Reviewed-on: https://review.haiku-os.org/c/haiku/+/10489 Reviewed-by: waddlesplash <[email protected]> Tested-by: Commit checker robot <[email protected]>
This commit is contained in:
committed by
waddlesplash
parent
ee10ca4b42
commit
e7eb60f1a7
@@ -276,6 +276,7 @@ struct hci_ev_sychronous_connection_changed {
|
||||
|
||||
// TODO: Define remaining Bluetooth 2.1 events structures
|
||||
#define HCI_EVENT_EXTENDED_INQUIRY_RESULT 0x2F
|
||||
#define HCI_MAX_EIR_LENGTH 240
|
||||
struct hci_ev_extended_inquiry_info {
|
||||
bdaddr_t bdaddr;
|
||||
uint8 page_repetition_mode;
|
||||
@@ -283,8 +284,10 @@ struct hci_ev_extended_inquiry_info {
|
||||
uint8 dev_class[3];
|
||||
uint16 clock_offset;
|
||||
int8 rssi;
|
||||
uint8 eir[240];
|
||||
uint8 eir[HCI_MAX_EIR_LENGTH];
|
||||
} __attribute__((packed));
|
||||
#define EIR_NAME_SHORT 0x08
|
||||
#define EIR_NAME_COMPLETE 0x09
|
||||
|
||||
#define HCI_EVENT_ENCRYPTION_KEY_REFRESH_COMPLETE 0x30
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ public:
|
||||
bool IsTrustedDevice();
|
||||
BString GetFriendlyName(bool alwaysAsk); /* Throwing */
|
||||
BString GetFriendlyName(void); /* Throwing */
|
||||
BString GetCachedFriendlyName();
|
||||
bdaddr_t GetBluetoothAddress();
|
||||
DeviceClass GetDeviceClass();
|
||||
|
||||
@@ -69,6 +70,8 @@ private:
|
||||
uint8 fScanMode;
|
||||
uint16 fClockOffset;
|
||||
int8 fRSSI;
|
||||
BString fFriendlyName;
|
||||
bool fFriendlyNameIsComplete;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user