Hellena Hempe
Hellena Hempe

Reputation: 1

Cannot detect Beacons (TI SensorTag CC2650) with Altbeacon

I am trying to detect the TI SensorTag as an iBeacon with the Altbeacon library.

I have already implemented the code from the Altbeacon Tutorial and tried to parse into iBeacon layout as described in this post:

Is this the correct layout to detect iBeacons with AltBeacon's Android Beacon Library?

However, the size of the

Collection<Beacon> beacons = 0 

even though I can find the Beacon in the Logfile as following:

D/BluetoothLeScanner: onScanResult() - ScanResult{mDevice=A0:E6:F8:B6:62:01, mScanRecord=ScanRecord [mAdvertiseFlags=5, mServiceUuids=[0000aa80-0000-1000-8000-00805f9b34fb], mManufacturerSpecificData={13=[3, 0, 0]}, mServiceData={}, mTxPowerLevel=0, mDeviceName=CC2650 SensorTag], mRssi=-36, mTimestampNanos=625504179339285}

My code looks as following:

public class BeaconActivity extends Activity implements BeaconConsumer {

    private final static int REQUEST_ENABLE_BT = 1;
    private static final String TAG = "BeaconActivity";

    private BeaconManager beaconManager = null;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_beacon);
        beaconManager = BeaconManager.getInstanceForApplication(this);
        beaconManager.getBeaconParsers().add(new BeaconParser().
                setBeaconLayout("m:2-3=0215,i:4-19,i:20-21,i:22-23,p:24-24"));
        beaconManager.bind(this);
    }

    @Override
    public void onBeaconServiceConnect() {
        beaconManager.setRangeNotifier(new RangeNotifier() {
            @Override
            public void didRangeBeaconsInRegion(Collection<Beacon> beacons, Region region) {
                Log.d(TAG, "onBeaconService");
                if (beacons.size() > 0) {
                    Beacon firstBeacon = beacons.iterator().next();
                    Log.i(TAG, "The first beacon " + firstBeacon.toString() + " is about " + firstBeacon.getDistance() + " meters away.");
                }
            }
        });

        try {
            beaconManager.startRangingBeaconsInRegion(new Region("myRangingUniqueId", null, null, null));

        } catch (RemoteException e) {
            Log.v(TAG, "Error whilte trying to startRangingBeaconsInRegion: ", e);
        }
    }

Upvotes: 0

Views: 431

Answers (1)

davidgyoung
davidgyoung

Reputation: 64941

The log line shown below indicates that the BLE packet detected is not a beacon transmission. This probably means the SensorTag is not loaded with the right firmware to transmit as a beacon.

D/BluetoothLeScanner: onScanResult() - ScanResult{mDevice=A0:E6:F8:B6:62:01, >mScanRecord=ScanRecord [mAdvertiseFlags=5, mServiceUuids=[0000aa80-0000-1000->8000-00805f9b34fb], mManufacturerSpecificData={13=[3, 0, 0]}, mServiceData={}, >mTxPowerLevel=0, mDeviceName=CC2650 SensorTag], mRssi=-36, >mTimestampNanos=625504179339285}

The above means that the SensorTag transmission detected is sending a GATT Service UUID and a manufacturer advertisement for manufacturer Texas Instruments with three data bytes: 03 00 00. That transmission does not correspond to any known beacon format.

Upvotes: 0

Related Questions