How to get REAL MAC ADDRESS of a device

Learn MoreFAQsTutorials

10 posts / 0 new
Last post
HarishKumar
Offline
Last seen:6 months 2 weeks ago
加入:2020-02-17 06:31
How to get REAL MAC ADDRESS of a device

Hi Everyone,

We have 25 DA14580 devices. We want to broadcast the own MAC Address in the advertisement packet. How to get theown MAC addressof each device that?

as IOS apps can't get the MAC address of the broadcaster device due to security reasons.

Regards,

Harish

Device:
PM_Dialog
Offline
Last seen:6 hours 19 min ago
工作人员
加入:2018-02-08 11:03
Hi HarishKumar,

Hi HarishKumar,

Let me ask in order to check if I understood what you are trying to accomplish:

Do you mean the BLE BD address that the devices are advertising?

>>> How to get the own MAC address of each device that?

Do you mean how to get the BD address in the application code?

If you could provide some extra information on your requirement, it would be very helpful.

Thanks, PM_Dialog

HarishKumar
Offline
Last seen:6 months 2 weeks ago
加入:2020-02-17 06:31
Yes

Yes

how to get theOWNBD地址在应用程序代码中?

Regards,

Harish

PM_Dialog
Offline
Last seen:6 hours 19 min ago
工作人员
加入:2018-02-08 11:03
Hi Harish ,

Hi Harish ,

The BD address is stored in the cmd->op.addr.addr - please check the cmd in the user_app_advertise() function.

gapm_air_operation sctructure includes the struct bd_addr addr sctructure which provideds own static private random address .

Thanks, PM_Dialog

HarishKumar
Offline
Last seen:6 months 2 weeks ago
加入:2020-02-17 06:31
Where do I need to call this

Where do I need to call this structure? Can you provide the logic here?

Regards,

Harish

PM_Dialog
Offline
Last seen:6 hours 19 min ago
工作人员
加入:2018-02-08 11:03
Hi Harish,

Hi Harish,

What kind of BD address are you using in your code?

Thanks, PM_Dialog

HarishKumar
Offline
Last seen:6 months 2 weeks ago
加入:2020-02-17 06:31

I'm using GAPM_PUBLIC_ADDR.

static const struct advertise_configuration user_adv_conf = {
/// Own BD address source of the device:
/// - GAPM_PUBLIC_ADDR: Public Address
.addr_src = GAPM_PUBLIC_ADDR,

please share the line of code to print the device own mac address.

Regards,

Harish.

PM_Dialog
Offline
Last seen:6 hours 19 min ago
工作人员
加入:2018-02-08 11:03
Hi Harish,

Hi Harish,

So, if I understood correctly, the device starts advertising with the BB that is set in CFG_NVDS_TAG_BD_ADDRESS macro. Is that correct? And you would like to print that macro?

Thanks, PM_Dialog

bojanpotocnik
Offline
Last seen:2 months 4 days ago
加入:2019-11-26 11:41
Dear PM_Dialog,

Dear PM_Dialog,

> gapm_air_operation sctructure includes the struct bd_addr addr sctructure which provideds own static private random address .

this structure only contains address type, not the address:

/// Air operation default parameters struct gapm_air_operation { /// Operation code. uint8_t code; /** * Own BD address source of the device: * - GAPM_STATIC_ADDR: Public or Random Static Address according to device address configuration * - GAPM_GEN_RSLV_ADDR: Generated Random Resolvable Private Address * - GAPM_GEN_NON_RSLV_ADDR: Generated Random non-Resolvable Private Address */ uint8_t addr_src; /// Dummy data use to retrieve internal operation state (should be set to 0). uint16_t state; };

HarishKumar, if in app_on_init(), use

void user_app_init(void) { extern struct bd_addr dev_bdaddr; /*< arch_system.c */ /* Note that MAC address is stored in big-endian, but we usually write/use in in little-endian */ arch_printf("%02x:%02x:%02x:%02x:%02x:%02x\n", dev_bdaddr.addr[5], dev_bdaddr.addr[4], dev_bdaddr.addr[3], dev_bdaddr.addr[2], dev_bdaddr.addr[1], dev_bdaddr.addr[0]); }

or anytime later

struct bd_addr addr; lld_util_get_bd_address(&addr); /* Note that MAC address is stored in big-endian, but we usually write/use in in little-endian */ arch_printf("%02x:%02x:%02x:%02x:%02x:%02x\n", addr.addr[5], addr.addr[4], addr.addr[3], addr.addr[2], addr.addr[1], addr.addr[0]);

PM_Dialog
Offline
Last seen:6 hours 19 min ago
工作人员
加入:2018-02-08 11:03
Hi bojanpotocnik,

Hi bojanpotocnik,

Thanks for your inputs and for your indication.

Thanks, PM_Dialog