1

I have an Eddystone, and I want to get accelerometer values but I I don't know how to proceed... I saw so we could get data from beacon with

beacon.getExtraDataFields()

but in my case the returned value is empty even I activated acceleromater emission in my Eddistone So I saw this post, : Getting packet data transferred from iBeacon android

but my returned value is like this : c03be53 and I don't know what does it mean... Could you help me to retrieve acceleromater data?

Here's my code :

 ArrayList<BeaconParser> beaconParsers = new ArrayList<BeaconParser>();

        beaconParsers.add(new BeaconParser().setBeaconLayout(EDDYSTONE_UID_LAYOUT));

        Beacon beacon = null;
        for (BeaconParser parser : beaconParsers) {
            beacon = parser.fromScanData(scanRecord,
                    rssi, device);

            if (beacon != null) {
                if (beacon.getServiceUuid() == 0xfeaa) {
                    // This is Eddystone, which uses a service Uuid of 0xfeaa
                    Identifier eddystoneNamespaceId = beacon.getId1();
                    Identifier eddystoneInstanceId = beacon.getId2();

                    WirelessDevice wirelessDevice = new WirelessDevice(null, beacon.getRssi(), null, eddystoneNamespaceId.toString());
                    mainActivity.addDevice(wirelessDevice);


                    byte[] bytes = parser.getBeaconAdvertisementData(beacon);

Thank's

  • What kind of beacon do you have that sends accelereter data? Since this is a non-standard feature, please attach a snippet of the beacon docs or a link to them. – davidgyoung May 31 '18 at 12:50
  • @davidgyoung Thank's for answer, I have an Beacon from BNBeacon (blue net beacon), I have this model : http://bnbeacon.com/Beacon_Full.html The doc is given with at purshase, so I don't know if I could give it :/ Here, my Eddystone is configure as Eddystone-UID, schould I configure it as Eddystone-TLM? I'm a little bit lost :') – Nathanael Heitz May 31 '18 at 12:55

1 Answers1

0

There is no standard way to communicate accelerometer data with any Eddystone format including Eddystone-TLM. Eddystone-TLM includes a field for the temperature of the beacon but not for accelerometer readings.

The documentation for the BNBeacon linked in the comment below the question only mentions accelerometer in this statement: "Intègre un accéléromètre, un vibreur et un buzzer 90 dB" There is no documentation on what the accelerometer does (perhaps it just triggers the beacon to turn on?), or even if its sensor output is exposed at all. It is possible that the output may be somehow encoded into a standard beacon field in a non-standard way. But without further manufacturer documentation that is just conjecture. How to access accelerometer data is probably a question the manufacturer will have to answer.

The parser.getBeaconAdvertisementData(beacon); will simply return the raw bytes of the beacon packet. This is designed for use by beacon transmitters and not for general data access. The same information can be more easily accessed using one of the parsed fields like beacon.getId1(), beacon.getId2(), beacon.getDataFields().get(0), etc. These latter access methods give you access to the parsed fields of the beacon layout.

davidgyoung
  • 63,876
  • 14
  • 121
  • 204
  • Ok thank's, I contacted my manufacturer and he told me he has no knowledges in AndroidStudio so don't know avalable libraries. So he told me to make a native program... Is there any way to catch Data, hexadecimal losse by Eddystone? – Nathanael Heitz Jun 01 '18 at 06:18
  • Yes, if the data are advertised you can access it. "Can the beacon be configured to transmit the accelerometer data in a beacon advertising packet? If yes, which packet type is it and where is the packet does it appear?" If the manufacturer can provide an answer to those two questions, then it will be very easy to write code to access this information. – davidgyoung Jun 01 '18 at 11:30
  • I contacted the manufacturer, he told me that output data from Eddystone are in hexadecimal format. Here's the length of each value : · State value: 1 octet · Mac address: 6 octets · Acceleration value:6 octets (x:2 octets y:2 octets z:2 octets) · Temperature value: 2 octets · Power value: 1 octet · Position data: 1 octet – Nathanael Heitz Jun 04 '18 at 06:57
  • Well, that is a little bit to go on, but not much -- the manufacturer is making this hard on you. This suggests that the MAC address is encoded inside one of the Eddystone beacon frames. First, find the mac address of your beacon by getting it from the beacon.getBluetoothAddress() method in the `didRangeBeaconsInRegion()` method. That will show you a 6 byte pattern. You need to find this pattern in the body of your beacon packets, and see which one has it. Take the output of `parser.getBeaconAdvertisementData(beacon)` and convert it to a hex string, and see if you can find the 6 bytes. – davidgyoung Jun 04 '18 at 17:59
  • You can convert the output of `parser.getBeaconAdvertisementData(beacon)` to a hex string using code like this https://stackoverflow.com/a/9855338/1461050 – davidgyoung Jun 04 '18 at 18:00
  • I tested the MAC address, I obtain something like this : E7:46:75:6E:36:B6 and when I want to get AdvertisementData, I get this : 00A2EBEFD08270A247C89837E7B5634DF524 I don't think it's a represent 6 bytes :p I did not search in didRangeBeaconsInRegion but in onLeScan Method, because I scan iBeacons too – Nathanael Heitz Jun 05 '18 at 07:10