{
const char *str[] = { "BR/EDR", "LE Public", "LE Random" };
- if (type <= MGMT_ADDR_LE_RANDOM)
+ if (type <= BDADDR_LE_RANDOM)
return str[type];
return "(unknown)";
index = 0;
type = 0;
- hci_set_bit(MGMT_ADDR_BREDR, &type);
- hci_set_bit(MGMT_ADDR_LE_PUBLIC, &type);
- hci_set_bit(MGMT_ADDR_LE_RANDOM, &type);
+ hci_set_bit(BDADDR_BREDR, &type);
+ hci_set_bit(BDADDR_LE_PUBLIC, &type);
+ hci_set_bit(BDADDR_LE_RANDOM, &type);
while ((opt = getopt_long(argc, argv, "+lbh", find_options,
NULL)) != -1) {
switch (opt) {
case 'l':
- hci_clear_bit(MGMT_ADDR_BREDR, &type);
- hci_set_bit(MGMT_ADDR_LE_PUBLIC, &type);
- hci_set_bit(MGMT_ADDR_LE_RANDOM, &type);
+ hci_clear_bit(BDADDR_BREDR, &type);
+ hci_set_bit(BDADDR_LE_PUBLIC, &type);
+ hci_set_bit(BDADDR_LE_RANDOM, &type);
break;
case 'b':
- hci_set_bit(MGMT_ADDR_BREDR, &type);
- hci_clear_bit(MGMT_ADDR_LE_PUBLIC, &type);
- hci_clear_bit(MGMT_ADDR_LE_RANDOM, &type);
+ hci_set_bit(BDADDR_BREDR, &type);
+ hci_clear_bit(BDADDR_LE_PUBLIC, &type);
+ hci_clear_bit(BDADDR_LE_RANDOM, &type);
break;
case 'h':
default:
{
struct mgmt_cp_pair_device cp;
uint8_t cap = 0x01;
- uint8_t type = MGMT_ADDR_BREDR;
+ uint8_t type = BDADDR_BREDR;
int opt;
while ((opt = getopt_long(argc, argv, "+c:t:h", pair_options,
static void cmd_block(int mgmt_sk, uint16_t index, int argc, char **argv)
{
struct mgmt_cp_block_device cp;
- uint8_t type = MGMT_ADDR_BREDR;
+ uint8_t type = BDADDR_BREDR;
int opt;
while ((opt = getopt_long(argc, argv, "+t:h", block_options,
static void cmd_unblock(int mgmt_sk, uint16_t index, int argc, char **argv)
{
struct mgmt_cp_unblock_device cp;
- uint8_t type = MGMT_ADDR_BREDR;
+ uint8_t type = BDADDR_BREDR;
int opt;
while ((opt = getopt_long(argc, argv, "+t:h", block_options,
bonding_complete(info, &ev->key.addr.bdaddr, 0);
}
-static inline uint8_t addr_type(uint8_t mgmt_addr_type)
-{
- switch (mgmt_addr_type) {
- case MGMT_ADDR_BREDR:
- return BDADDR_BREDR;
- case MGMT_ADDR_LE_PUBLIC:
- return BDADDR_LE_PUBLIC;
- case MGMT_ADDR_LE_RANDOM:
- return BDADDR_LE_RANDOM;
- default:
- return BDADDR_BREDR;
- }
-}
-
-static inline uint8_t mgmt_addr_type(uint8_t addr_type)
-{
- switch (addr_type) {
- case BDADDR_BREDR:
- return MGMT_ADDR_BREDR;
- case BDADDR_LE_PUBLIC:
- return MGMT_ADDR_LE_PUBLIC;
- case BDADDR_LE_RANDOM:
- return MGMT_ADDR_LE_RANDOM;
- default:
- return MGMT_ADDR_BREDR;
- }
-}
-
static void mgmt_device_connected(int sk, uint16_t index, void *buf, size_t len)
{
struct mgmt_ev_device_connected *ev = buf;
eir_parse(&eir_data, ev->eir, eir_len);
btd_event_conn_complete(&info->bdaddr, &ev->addr.bdaddr,
- addr_type(ev->addr.type),
+ ev->addr.type,
eir_data.name,
eir_data.dev_class);
cp = (void *) &buf[sizeof(*hdr)];
bacpy(&cp->addr.bdaddr, bdaddr);
- cp->addr.type = MGMT_ADDR_BREDR;
+ cp->addr.type = BDADDR_BREDR;
buf_len = sizeof(*hdr) + sizeof(*cp);
} else {
cp = (void *) &buf[sizeof(*hdr)];
bacpy(&cp->addr.bdaddr, bdaddr);
- cp->addr.type = MGMT_ADDR_BREDR;
+ cp->addr.type = BDADDR_BREDR;
cp->pin_len = pin_len;
memcpy(cp->pin_code, pin, pin_len);
cp = (void *) &buf[sizeof(*hdr)];
bacpy(&cp->addr.bdaddr, bdaddr);
- cp->addr.type = mgmt_addr_type(bdaddr_type);
+ cp->addr.type = bdaddr_type;
if (write(mgmt_sock, buf, sizeof(buf)) < 0)
return -errno;
cp = (void *) &buf[sizeof(*hdr)];
bacpy(&cp->addr.bdaddr, bdaddr);
- cp->addr.type = mgmt_addr_type(bdaddr_type);
+ cp->addr.type = bdaddr_type;
buf_len = sizeof(*hdr) + sizeof(*cp);
} else {
cp = (void *) &buf[sizeof(*hdr)];
bacpy(&cp->addr.bdaddr, bdaddr);
- cp->addr.type = mgmt_addr_type(bdaddr_type);
+ cp->addr.type = bdaddr_type;
cp->passkey = htobl(passkey);
buf_len = sizeof(*hdr) + sizeof(*cp);
confirm_name = (flags & MGMT_DEV_FOUND_CONFIRM_NAME);
btd_event_device_found(&info->bdaddr, &ev->addr.bdaddr,
- addr_type(ev->addr.type),
+ ev->addr.type,
ev->rssi, confirm_name,
eir, eir_len);
}
info->discov_type = 0;
if (mgmt_bredr(info->current_settings))
- hci_set_bit(MGMT_ADDR_BREDR, &info->discov_type);
+ hci_set_bit(BDADDR_BREDR, &info->discov_type);
if (mgmt_low_energy(info->current_settings)) {
- hci_set_bit(MGMT_ADDR_LE_PUBLIC, &info->discov_type);
- hci_set_bit(MGMT_ADDR_LE_RANDOM, &info->discov_type);
+ hci_set_bit(BDADDR_LE_PUBLIC, &info->discov_type);
+ hci_set_bit(BDADDR_LE_RANDOM, &info->discov_type);
}
memset(buf, 0, sizeof(buf));
cp = (void *) &buf[sizeof(*hdr)];
bacpy(&cp->addr.bdaddr, bdaddr);
- cp->addr.type = mgmt_addr_type(bdaddr_type);
+ cp->addr.type = bdaddr_type;
buf_len = sizeof(*hdr) + sizeof(*cp);
cp = (void *) &buf[sizeof(*hdr)];
bacpy(&cp->addr.bdaddr, bdaddr);
- cp->addr.type = mgmt_addr_type(bdaddr_type);
+ cp->addr.type = bdaddr_type;
buf_len = sizeof(*hdr) + sizeof(*cp);
hdr->index = htobs(index);
bacpy(&cp->addr.bdaddr, bdaddr);
- cp->addr.type = mgmt_addr_type(bdaddr_type);
+ cp->addr.type = bdaddr_type;
if (write(mgmt_sock, buf, sizeof(buf)) < 0)
error("write: %s (%d)", strerror(errno), errno);
hdr->index = htobs(index);
bacpy(&cp->addr.bdaddr, bdaddr);
- cp->addr.type = mgmt_addr_type(bdaddr_type);
+ cp->addr.type = bdaddr_type;
cp->disconnect = 1;
if (write(mgmt_sock, buf, sizeof(buf)) < 0)
struct link_key_info *info = l->data;
bacpy(&key->addr.bdaddr, &info->bdaddr);
- key->addr.type = MGMT_ADDR_BREDR;
+ key->addr.type = BDADDR_BREDR;
key->type = info->type;
memcpy(key->val, info->key, 16);
key->pin_len = info->pin_len;
hdr->len = htobs(sizeof(*cp));
bacpy(&cp->addr.bdaddr, bdaddr);
- cp->addr.type = mgmt_addr_type(bdaddr_type);
+ cp->addr.type = bdaddr_type;
cp->name_known = name_known;
if (write(mgmt_sock, &buf, sizeof(buf)) < 0)