简体   繁体   English

隐藏的蓝牙/BLE 设备

[英]Hidden Bluetooth/BLE Devices

When programming a BLE Device or Sensor - is it possible to make it 'hidden' from the phone's general bluetooth settings > add device?在对 BLE 设备或传感器进行编程时 - 是否可以将其从手机的常规蓝牙设置中“隐藏”> 添加设备? And then make it possible to be discovered/paired with only through a particular phone app.然后可以仅通过特定的手机应用程序被发现/配对。

To achieve this some suggested using a particular UUID and then the propriety app would filter for that particular UUID.为了实现这一点,有人建议使用特定的 UUID,然后专有应用程序将过滤该特定的 UUID。

Design your BLE hardware with your defined UUID .使用您定义的UUID设计您的BLE硬件。 And inside your mobile apps, search available devices using BLE Apis on this UUID only, using filter.在您的移动应用程序中,使用过滤器仅在此UUID上使用 BLE API 搜索可用设备。 This will return only devices having your UUID in BLE range, not others.这将仅返回您的UUID在 BLE 范围内的设备,而不是其他设备。

List<ScanFilter> filters = new ArrayList<>();
    ScanFilter scanFilter = new ScanFilter.Builder()
          .setServiceUuid(ParcelUuid.fromString(YOUR_OWN_UUID))
          .build();
    filters.add(scanFilter);
    // Start scanning on your UUID
    mBluetoothLeScanner.startScan(filters, settings, mScanCallback);

Ref : Example参考: 示例

The suggestion of @Kushal can work. @Kushal 的建议可行。 But still, you can not hide your custom peripheral device in the phone's scan results.但是,您仍然无法在手机的扫描结果中隐藏您的自定义外围设备。

You can hide your custom peripheral device's BLE name by removing the local name from the advertisement data.您可以通过从广告数据中删除本地名称来隐藏自定义外围设备的BLE名称。 This way, your device will be seen as Unknown Device in the phone's scan results (or in any other central device).这样,您的设备将在手机的扫描结果(或任何其他中央设备)中被视为Unknown Device Then you filter the UUID of your custom peripheral device in your app and users can only see your custom peripheral device in the app.然后你在你的应用程序中过滤你的自定义外围设备的UUID ,用户只能在应用程序中看到your自定义外围设备。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM