我正在尝试使用蓝牙低功耗(BLE)通过Android应用程序连接到Arduino Uno.
我正在开发Android Studio,使用三星Galaxy S4进行测试,使用Android版本5.0.1
我按照以下链接开发:http
://www.truiton.com/2015/04/android-bluetooth-low-energy- ble-example /
我正在扫描设备,当我找到它时,我想在连接它之前得到它的UUID,以确保它是正确类型的设备:
mScanCallback = new ScanCallback() {
@Override
@TargetApi(21)
public void onScanResult(int callbackType, ScanResult result) {
BluetoothDevice btDevice = result.getDevice();
ParcelUuid[] uuids = btDevice.getUuids(); //<-- this is always null!! :(
Log.d(TAG, ""+btDevice.fetchUuidsWithSdp()); //<-- prints true.
Log.d(TAG, "result : " + result.toString()); //<-- prints a bunch of relevant info that contains the UUID I want to check.
Log.d(TAG, "uuids : " + uuids); //<-- prints null.
/*
for (ParcelUuid u : …Run Code Online (Sandbox Code Playgroud) uuid android bluetooth-lowenergy android-bluetooth arduino-uno