Hello all, i am new to programing in android and i am trying to do an app that will send the RSSI corresponding to each UUID beacon that i will have in a mesh and that info over a server that i have implemented with a neural network to diferenciate zones in function of different RSSI values, i want to know how to monitor multiple beacons at the same time and get the information values needed for my neural network (RSSI,UUID) of all the beacons in my mesh.
Hi @myance90,
if you want to exploit the RSSI, you have to use the ranging feature.
Your activity must have a BeaconManager
object instance:
BeaconManager beaconManager = new BeaconManager(this);
The BeaconManager needs a listener to know what to do when receiving a signal:
Setup a ranging listener
beaconManager.setRangingListener(new BeaconManager.BeaconRangingListener() {
@Override
public void onBeaconsDiscovered(BeaconRegion region, final List<Beacon> beacons) {
// Put here the code to execute with the beacons found in the given region.
}
});
You must define a Region
to range for. If all your beacons have the same UUID, you can define a Region
that ranges for all of them:
Define a region to range for
String myRegionName = "Default region";
UUID myRegionUUID = UUID.fromString("XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX");
Region myRegion = new Region(myRegionName, myRegionUUID, null, null);
Then call the beaconManager.startRanging()
method.
Hi @Ximun
Thkz for the reply, i have set up as you indicated but i still don’t know how to get the data i mentioned, what i actually want is get the UUID and a RSSI to two separate vectors, i’ve already done it for wifi with something like this:
ListaWifi=ObjWifi.getScanResults(); rssi= new int(ListaWifi.size()) BSSID= new String(ListaWifi.size()) for (int i=0;i<ListaWifi.size();i++){ BSSID[i]=ListaWifi.get(i).BSSID; rssi[i]=ListaWifi.get(i).level; }
Now i want to do the same with the estimote beacons because i need this data to be transfered to a PC over wifi network and processed through a neural network i have already programmed, is it posible to get the data like this??
Oh yeah,
so as I said before, you have to use the ranging feature.
When ranging, the nearby beacons are notified to you with the listener you defined:
[...]
beaconManager.setRangingListener(new BeaconManager.BeaconRangingListener() {
@Override
public void onBeaconsDiscovered(BeaconRegion region, List<Beacon> beacons) {
// The result is a list of Beacon objects.
for (Beacon beacon : beacons) {
// You get the UUID and the RSSI with:
beacon.getProximityUUID();
beacon.getRssi();
// Now, call your own methods to work with the values.
}
}
});
[...]
If you want all the information about how to use a Beacon
object, read the Estimote JavaDoc.
What if I want to separate my beacons with different UUIDs, for example, if I need them to always have the same position in an array based on it’s UUID??? This because my Neural Network uses as inputs the RSSI of the beacons and need them to have always an specific order.
Srry @myance90,
I’m very busy…
The UUID is designed to be the same for all the beacons of a company/university/entity.
You can differentiate them with the major and minor values.
Example:
- UUID XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX for all the beacons of your company,
- the major will for example match the room where the beacons are put,
- the minor allows you to uniquely identify the beacon.
Hope it helps