How can I read multiple settings of a beacon at the same time?
I’ve tried it in this way, but is there a possibility to do it simpler?
DeviceConnection connection = connectionProvider.getConnection(this.connectedTo);
connection.connect(new DeviceConnectionCallback() {
@Override
public void onConnected() {
Log.d(TAG, "onConnected: connected to " + connectedTo.deviceId.toString());
try {
connection.settings.eddystone.uid.namespace().get(new SettingCallback<String>() {
@Override
public void onSuccess(String s) {
Log.d(TAG, "onSuccess: namespace= " + s);
}
@Override
public void onFailure(DeviceConnectionException e) {
Log.e(TAG, "onFailure: ", e);
}
});
connection.settings.eddystone.uid.instance().get(new SettingCallback<String>() {
@Override
public void onSuccess(String s) {
Log.d(TAG, "onSuccess: instance= " + s);
}
@Override
public void onFailure(DeviceConnectionException e) {
Log.e(TAG, "onFailure: ", e);
}
});
} catch (Exception e) {
Log.e(TAG, "onConnected: ", e);
}
}
@Override
public void onDisconnected() {
Log.d(TAG, "onDisconnected: disconnected from " + connectedTo.deviceId.toString());
connectedTo = null;
}
@Override
public void onConnectionFailed(DeviceConnectionException e) {
Log.e(TAG, "onConnectionFailed: ", e);
connectedTo = null;
}
});
connectedTo is current ConfigurableDevice.
As you can see, I always try to get a setting and get it as SettingsCallback…each time.
As I asked above: can I get all settings in one request?