Reputation: 9
I am working on an android app that scans for BLE beacons in range. The beacons could be ibeacon or eddystone format. After discovering a beacon, I am able to get the scancallback and find the UUID, major number and minor number. I need to find the beacon's IP address (similar to what the microchip discovery app seems to be doing). I cant use the other app since my app has to have a lot more functionality. 1st question - do all BLE devices get an IP address? 2nd question - how can I find the IP address of a detected BLE device. I did search various posts about this topic, and have been searching for about 4 hours now, but I am not able to find an answer. Can anyone give me a solution or point me to a post that describes the solution?
Upvotes: 0
Views: 2130
Reputation: 1708
Q) 1st question - do all BLE devices get an IP address?
No there is no IP address in BLE devices.
Q)2nd question - how can I find the IP address of a detected BLE device. I did search various posts about this topic, and have been searching for about 4 hours now, but I am not able to find an answer. Can anyone give me a solution or point me to a post that describes the solution?
Many beacon manufacturers make BLE devices that advertise custom payload thus they can send any information they want.
void onLeScan (BluetoothDevice device,
int rssi,
byte[] scanRecord)
you can get the payload in scanRecord
. If your beacon is broadcasting an IP address parameter it should be in payload but you need to parse it, ask beacon manufacturer to help you to get that IP address parameter from payload.
Upvotes: 0
Reputation: 18452
What exactly are you trying to solve?
Bluetooth and Bluetooth Low Energy is a different protocol than IP (Internet Protocol). Therefore BLE devices don't have IP addresses, just in the same way IP devices don't have Bluetooth device addresses.
Of course if you have a big product (like a computer) it can have both a WiFi-module and a Bluetooth module.
There are however implementations of IP over BLE like https://www.rfc-editor.org/rfc/rfc7668. Is that what you are looking for? I would assume no Beacon devices do that however since it doesn't really match the use case.
Upvotes: 2
Reputation: 114865
The iBeacon specification defines only UUID, major and minor values. The Eddystone format adds some additional information (notably, a URL and information about the device itself such as battery level).
Many beacons have vendor-specific BLE services to allow device configuration. It would also be possible for a vendor to add an IP interface for management, but I would suggest that these would be the minority of beacons; beacons are typically low-cost, low-power broadcast only devices.
Neither configuration BLE services nor IP configuration services are part of the iBeacon or Eddystone standards. If you do have a beacon with an IP interface then you will need to get details from the beacon vendor.
Upvotes: 0
Reputation: 599
You can get the hardware address of the BLE device via BluetoothDevice.getAddress()
.
Assuming that you are using onLeScan(BluetoothDevice device, int rssi, byte[] scanRecord)
callback for scan results which provides BluetoothDevice
found nearby.
Upvotes: 0