Hello,
I’m trying to scan for Proximity Beacons “connectivity” packets using BeaconManager.startConfigurableDevicesDiscovery()
, but unable to find any packet.
The Estimote App shows Hardware Revision D3.4
when connecting to the beacons. I read here that there is another way to connect to the “legacy” beacons using EstBeaconConnection
, but I’m on Android and my problem is not really to connect to the device, but to read a ConfigurableDevice
packet.
So I have some questions:
- does the beacon send the connectivity packets everytime?
- if it does, how often?
- does a Proximity beacon (revision “D”) send these packets?
- if it does, how can I recover them?
- do I have to use
ConfigurableDevicesScanner
? - how a connection is precisely established (in terms of packets)?
Thanks for your answers.
Here is my code:
ConfigurableDevicePacketScannerManager.java
package com.estimote.datascanner;
import android.content.Context;
import com.estimote.coresdk.recognition.packets.ConfigurableDevice;
import com.estimote.coresdk.service.BeaconManager;
import java.util.List;
class ConfigurableDevicePacketScannerManager {
private Listener listener;
private BeaconManager beaconManager;
ConfigurableDevicePacketScannerManager(Context context) {
beaconManager = new BeaconManager(context);
beaconManager.setConfigurableDevicesListener(new BeaconManager.ConfigurableDevicesListener() {
@Override
public void onConfigurableDevicesFound(List<ConfigurableDevice> list) {
transferPacketsInformation(list);
}
});
}
void startScanningConfigurableDevicePackets() {
beaconManager.connect(new BeaconManager.ServiceReadyCallback() {
@Override
public void onServiceReady() {
beaconManager.startConfigurableDevicesDiscovery();
}
});
}
void stopScanningConfigurableDevicePackets() {
beaconManager.stopConfigurableDevicesDiscovery();
}
void destroy() {
beaconManager.disconnect();
}
private void transferPacketsInformation(List<ConfigurableDevice> list) {
if (listener != null) {
for (int count = 0; count < list.size(); count++) {
listener.onPacketFound(list.get(count));
}
}
}
interface Listener {
void onPacketFound(ConfigurableDevice packet);
}
void setListener(ConfigurableDevicePacketScannerManager.Listener listener) {
this.listener = listener;
}
}
And the other one:
ConfigurableDevicePacketActivity.java
package com.estimote.datascanner;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.widget.TextView;
import com.estimote.coresdk.common.requirements.SystemRequirementsChecker;
import com.estimote.coresdk.recognition.packets.ConfigurableDevice;
public class ConfigurableDevicePacketActivity extends AppCompatActivity {
private ConfigurableDevicePacketScannerManager configurableDevicePacketScannerManager;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.setContentView(R.layout.activity_main);
configurableDevicePacketScannerManager = new ConfigurableDevicePacketScannerManager(getApplicationContext());
configurableDevicePacketScannerManager.setListener(new ConfigurableDevicePacketScannerManager.Listener() {
@Override
public void onPacketFound(ConfigurableDevice packet) {
((TextView) findViewById(R.id.tip)).setText(packet.toString());
}
});
}
@Override
protected void onPause() {
configurableDevicePacketScannerManager.stopScanningConfigurableDevicePackets();
super.onPause();
}
@Override
protected void onResume() {
super.onResume();
if (SystemRequirementsChecker.checkWithDefaultDialogs(this)) {
configurableDevicePacketScannerManager.startScanningConfigurableDevicePackets();
}
}
@Override
protected void onDestroy() {
configurableDevicePacketScannerManager.destroy();
super.onDestroy();
}
}