Fix #6373, second try
* make BDADDR_* macros refer to value types instead of addresses * adjust all interfaces using bdaddr_t* to use (mostly const) refs instead, which IMHO makes the interface & code clearer * that got rid of a couple of const incorrectness casts * some cleanup along the way git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38265 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -34,15 +34,15 @@ public:
|
||||
}
|
||||
|
||||
|
||||
static bool Compare(const bdaddr_t* ba1, const bdaddr_t* ba2)
|
||||
static bool Compare(const bdaddr_t& ba1, const bdaddr_t& ba2)
|
||||
{
|
||||
return (memcmp(ba1, ba2, sizeof(bdaddr_t)) == 0);
|
||||
return (memcmp(&ba1, &ba2, sizeof(bdaddr_t)) == 0);
|
||||
}
|
||||
|
||||
|
||||
static void Copy(bdaddr_t* dst, const bdaddr_t* src)
|
||||
static void Copy(bdaddr_t& dst, const bdaddr_t& src)
|
||||
{
|
||||
memcpy(dst, src, sizeof(bdaddr_t));
|
||||
memcpy(&dst, &src, sizeof(bdaddr_t));
|
||||
}
|
||||
|
||||
static char* ToString(const bdaddr_t bdaddr)
|
||||
|
||||
@@ -25,9 +25,9 @@ typedef struct {
|
||||
} __attribute__((packed)) bdaddr_t;
|
||||
|
||||
|
||||
#define BDADDR_NULL (&(bdaddr_t) {{0, 0, 0, 0, 0, 0}})
|
||||
#define BDADDR_LOCAL (&(bdaddr_t) {{0, 0, 0, 0xff, 0xff, 0xff}})
|
||||
#define BDADDR_BROADCAST (&(bdaddr_t) {{0xff, 0xff, 0xff, 0xff, 0xff, 0xff}})
|
||||
#define BDADDR_NULL ((bdaddr_t) {{0, 0, 0, 0, 0, 0}})
|
||||
#define BDADDR_LOCAL ((bdaddr_t) {{0, 0, 0, 0xff, 0xff, 0xff}})
|
||||
#define BDADDR_BROADCAST ((bdaddr_t) {{0xff, 0xff, 0xff, 0xff, 0xff, 0xff}})
|
||||
#define BDADDR_ANY BDADDR_BROADCAST
|
||||
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#ifndef _BTCOREDATA_H
|
||||
#define _BTCOREDATA_H
|
||||
|
||||
|
||||
#include <module.h>
|
||||
#include <lock.h>
|
||||
#include <util/DoublyLinkedList.h>
|
||||
@@ -18,8 +19,10 @@
|
||||
#include <bluetooth/HCI/btHCI_transport.h>
|
||||
#include <l2cap.h>
|
||||
|
||||
|
||||
#define BT_CORE_DATA_MODULE_NAME "bluetooth/btCoreData/v1"
|
||||
|
||||
|
||||
struct L2capChannel;
|
||||
struct L2capFrame;
|
||||
struct L2capEndpoint;
|
||||
@@ -29,6 +32,7 @@ typedef enum _connection_status {
|
||||
HCI_CONN_OPEN,
|
||||
} connection_status;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
struct HciConnection : DoublyLinkedListLinkImpl<HciConnection> {
|
||||
@@ -138,12 +142,12 @@ struct bluetooth_core_data_module_info {
|
||||
status_t (*PostEvent)(bluetooth_device* ndev, void* event,
|
||||
size_t size);
|
||||
struct HciConnection* (*AddConnection)(uint16 handle, int type,
|
||||
bdaddr_t* dst, hci_id hid);
|
||||
const bdaddr_t& dst, hci_id hid);
|
||||
|
||||
// status_t (*RemoveConnection)(bdaddr_t destination, hci_id hid);
|
||||
status_t (*RemoveConnection)(uint16 handle, hci_id hid);
|
||||
|
||||
hci_id (*RouteConnection)(const bdaddr_t* destination);
|
||||
hci_id (*RouteConnection)(const bdaddr_t& destination);
|
||||
|
||||
void (*SetAclBuffer)(struct HciConnection* conn,
|
||||
net_buffer* nbuf);
|
||||
@@ -155,8 +159,8 @@ struct bluetooth_core_data_module_info {
|
||||
bool (*AclOverFlowed)(struct HciConnection* conn);
|
||||
|
||||
struct HciConnection* (*ConnectionByHandle)(uint16 handle, hci_id hid);
|
||||
struct HciConnection* (*ConnectionByDestination)(const bdaddr_t* destination,
|
||||
hci_id hid);
|
||||
struct HciConnection* (*ConnectionByDestination)(
|
||||
const bdaddr_t& destination, hci_id hid);
|
||||
|
||||
struct L2capChannel* (*AddChannel)(struct HciConnection* conn,
|
||||
uint16 psm);
|
||||
@@ -169,20 +173,24 @@ struct bluetooth_core_data_module_info {
|
||||
|
||||
struct L2capFrame* (*SignalByIdent)(struct HciConnection* conn,
|
||||
uint8 ident);
|
||||
status_t (*TimeoutSignal)(struct L2capFrame* frame, uint32 timeo);
|
||||
status_t (*TimeoutSignal)(struct L2capFrame* frame,
|
||||
uint32 timeo);
|
||||
status_t (*UnTimeoutSignal)(struct L2capFrame* frame);
|
||||
struct L2capFrame* (*SpawnFrame)(struct HciConnection* conn,
|
||||
struct L2capChannel* channel, net_buffer* buffer, frame_type frame);
|
||||
struct L2capChannel* channel,
|
||||
net_buffer* buffer, frame_type frame);
|
||||
struct L2capFrame* (*SpawnSignal)(struct HciConnection* conn,
|
||||
struct L2capChannel* channel, net_buffer* buffer,
|
||||
uint8 ident, uint8 code);
|
||||
struct L2capChannel* channel,
|
||||
net_buffer* buffer, uint8 ident, uint8 code);
|
||||
status_t (*AcknowledgeSignal)(struct L2capFrame* frame);
|
||||
status_t (*QueueSignal)(struct L2capFrame* frame);
|
||||
|
||||
};
|
||||
|
||||
|
||||
inline bool ExistConnectionByDestination(bdaddr_t* destination, hci_id hid);
|
||||
inline bool ExistConnectionByDestination(const bdaddr_t& destination,
|
||||
hci_id hid);
|
||||
inline bool ExistConnectionByHandle(uint16 handle, hci_id hid);
|
||||
|
||||
|
||||
#endif // _BTCOREDATA_H
|
||||
|
||||
Reference in New Issue
Block a user