I am using BLE peripheral UART application from nordic SDK version 15.2.0 SoftDevice S140 PCA10056 nRF52840 Development kit on Embedded Segger studio operating system - Windows 8.1 Pro. I want to understand how to get or retrieve the address of the android/iOS device when connection occurs between peripheral and central(android). Further I want to activate whitelist option to store the peer address which are allowed to access it. On central, am using nRF toolbox android application and using nordic uart to connect to peripheral. I tried to implement this code snippet:
//Connected device
ble_gap_addr_t addr = p_ble_evt->evt.gap_evt.params.connected.peer_addr;
memcpy(addr.addr, p_ble_evt->evt.gap_evt.params.connected.peer_addr.addr, 6);
mprintf(UART," Connected to %X:%X:%X:%X:%X:%X AddrType:0x0%d\n",
addr.addr[5],addr.addr[4],addr.addr[3],
addr.addr[2],addr.addr[1],addr.addr[0],
p_ble_evt->evt.gap_evt.params.connected.peer_addr.addr_type);
But I get this error and when I try to define UART with 48 bits it gives 2nd and 3rd error.
1. 'UART' undeclared (first use in this function)
2.Output/ble_app_uart_pca10056_s140 Release/Obj/main.o: In function `ble_evt_handler':
3. undefined reference to `mprintf'
i am quite new to this, so any guidance would be helpful.
But by analysising further, I got to know that android and iOS uses random private resolvable address hence it always gives different address on every connection.
So,.in that case how will I get whitelist option enabled as in like to allow only some android phones to connect and ignore other ones who are not in whitelist.
Please hoping to get help soon.