More information about NFC sdk


#1

Hi,
I try to develop an application using NFC to read beacon information (and maybe write) like the estimote one.
We just want to add a button to automatically push beacon information to our server to ease our configuration when we have a lote of beacons to configure on our plateform.

The problem is, I didn’t found any documentation about beacon informations through NFC. The only example available is ‘NFCStamps’ that doesn’t fit my requirements.

Is there an example application somewhere that demonstrate how to get informations through NFC ?

Thanks


#2

For reading the NFC data from beacons, just use the built-in iOS and Android APIs. The “NFCStamps” is an example of how to do that:

What is it specifically that you’re looking for that NFCStamps doesn’t cover?

A brief overview of the NFC [NDEF] records you can read from our beacons (the beacon identifier and the MAC address of the connectable packet) is here:

https://developer.estimote.com/proximity/nfc/#estimote-ndef-records


When it comes to writing data, that’s where it works a bit differently, as you don’t write the data to the beacon’s NFC tag as you’d do with most regular writable NFC tags. Instead, you configure the beacon to broadcast your custom NDEF records/message via our beacon configuration APIs:

https://github.com/Estimote/Android-SDK/blob/master/Docs/DOC_deviceConnection.md

EstimoteNdefMessage myCustomNdefMessage = new EstimoteNdefMessage( // ...
deviceConnection.settings.nfc.data().set(myCustomerNdefMessage, // ...

Any NDEF records you configure will be broadcast in addition to the beacon identifier and the MAC address mentioned earlier.

(NFC configuration is only available in the Estimote Android SDK at this time.)


#3

I finaly figured out how to deal with NDEF Records thanks to your explainations, Thank you !

But, if I well understood, if we want to get the UUID/Minor/Major of the beacon we have to do the second method you mentionned ? (With device connection)

Secondly, I see that we have to search beacons by scanning in the documentation. Is that possible to pass through this by connecting the becon with a nfc tap ?


#4

I guess you could program a custom NDEF record with the UUID/major/minor data.

BTW, is the deviceIdentifier not enough for you to uniquely identify which beacon was tapped?

Secondly, I see that we have to search beacons by scanning in the documentation. Is that possible to pass through this by connecting the becon with a nfc tap ?

This is what we do in the Estimote app to avoid scanning and connect to the tapped beacon directly:

// input: NdefMessage message

ConfigurableDevice device = null;

NdefRecord[] records = message.getRecords();

DeviceId deviceId = null;
MacAddress macAddress = null;

for (NdefRecord record : records) {
    if (record.getTnf() == NdefRecord.TNF_EXTERNAL_TYPE) {
        String type = new String(record.getType(), Charset.forName("ascii"));
        if ("estimote.com:id".equals(type)) {
            deviceId = DeviceId.fromBytes(record.getPayload());
        } else if ("estimote.com:mac".equals(type)) {
            byte[] revMac = new byte[record.getPayload().length];
            for (int i = 0; i < revMac.length; i++) {
                revMac[i] = record.getPayload()[revMac.length - i - 1];
            }
            macAddress = MacAddress.fromBytes(revMac);
        }
    }
}

if (deviceId != null && macAddress != null) {
    device = new ConfigurableDevice(DeviceType.LOCATION_BEACON,
        deviceId, macAddress, "", "",false,false,0,0,0L);
}

// output: ConfigurableDevice device

Once you have the ConfigurableDevice, you can follow the rest of the connection process. The DeviceConnectionProvider docs have a good snippet for that:

http://estimote.github.io/Android-SDK/JavaDocs/com/estimote/mgmtsdk/connection/api/DeviceConnectionProvider.html

And here’s the full documentation:

https://github.com/Estimote/Android-SDK/blob/master/Docs/DOC_deviceConnection.md