net/bluetooth: Add support for connection to any address and any channel.
This commit is contained in:
parent
3ba6cc7921
commit
5dd11f465b
@ -51,8 +51,12 @@
|
||||
|
||||
/* Well known addresses: */
|
||||
|
||||
#define BDADDR_ANY {0, 0, 0, 0, 0, 0}
|
||||
#define BDADDR_LOCAL {0, 0, 0, 0xff, 0xff, 0xff}
|
||||
#define BT_ADDR_ANY {0, 0, 0, 0, 0, 0}
|
||||
#define BT_ADDR_LOCAL {0, 0, 0, 0xff, 0xff, 0xff}
|
||||
|
||||
/* Any channel */
|
||||
|
||||
#define BT_CHANNEL_ANY 0
|
||||
|
||||
/* Socket protocols.
|
||||
*
|
||||
|
@ -43,6 +43,7 @@
|
||||
#include <errno.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <netpacket/bluetooth.h>
|
||||
#include <arch/irq.h>
|
||||
|
||||
#include <nuttx/mm/iob.h>
|
||||
@ -75,6 +76,11 @@ static dq_queue_t g_free_bluetooth_connections;
|
||||
|
||||
static dq_queue_t g_active_bluetooth_connections;
|
||||
|
||||
static const bt_addr_t g_any_addr =
|
||||
{
|
||||
BT_ADDR_ANY
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
@ -218,12 +224,11 @@ FAR struct bluetooth_conn_s *
|
||||
conn = (FAR struct bluetooth_conn_s *)conn->bc_node.flink)
|
||||
{
|
||||
/* Does the destination address match the bound address of the socket. */
|
||||
/* REVISIT: Currently and explicit address must be assigned. Should we
|
||||
* support some moral equivalent to INADDR_ANY?
|
||||
*/
|
||||
|
||||
if (!BLUETOOTH_ADDRCMP(&meta->bm_raddr, &conn->bc_laddr) ||
|
||||
meta->bm_channel != conn->bc_channel)
|
||||
if ((BLUETOOTH_ADDRCMP(&conn->bc_raddr, &meta->bm_raddr) ||
|
||||
BLUETOOTH_ADDRCMP(&conn->bc_raddr, &g_any_addr)) &&
|
||||
(meta->bm_channel == conn->bc_channel ||
|
||||
BT_CHANNEL_ANY == conn->bc_channel))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user