蓝牙低能耗正在两部手机之间工作? [英] bluetooth low energy is working between two mobile phone?

查看:83
本文介绍了蓝牙低能耗正在两部手机之间工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的移动应用程序中使用了react-native的蓝牙低功耗功能.我只想找到其他移动设备,所以我找不到其他手机以及它们支持的蓝牙低功耗手机,但是我找到了我的Smartwatch,好吧,我的问题是蓝牙低能耗能找到其他手机还是仅用于配件?

i used bluetooth low energy in my mobile app with react-native . and i want to just find other mobile devices, so i can't find any other mobile phone and theirs supported bluetooth low-energy , but i find my Smartwatch , well my question is bluetooth low energy can find other mobile phone or is just for Accessory?

以及您要我怎样寻找其他手机.

我的代码

export const App = () => {
    const manager = new BleManager();

    manager.startDeviceScan(null, { scanMode: 2, }, (error, device) => {
        if (error) {
            console.log('error', error)
            return
        }

        if (device !== null) {
              console.log(device)
        }
    }
}

我已经编辑了android/app/src/main/AndroidManifest.xml

i had edit my android/app/src/main/AndroidManifest.xml

<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission-sdk-23 android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-feature android:name="android.hardware.bluetooth_le" android:required="true"/>

我用过

  "react": "16.13.1",
  "react-native": "0.63.3", 
 "react-native-ble-plx": "^2.0.1",

推荐答案

蓝牙低功耗(BLE)的工作原理不同于旧"蓝牙技术.蓝牙(Bluetooth Classic).开启蓝牙后,您的设备即可在蓝牙经典"扫描中看到,而对于BLE扫描则不可见.

Bluetooth Low Energy (BLE) works different than the "old" Bluetooth (Bluetooth Classic). As soon as you turn on Bluetooth your device is visible for Bluetooth Classic scans, but not for BLE scans.

要找到BLE设备,必须将该设备宣传其礼物.这是BLE和Bluetooth Classic之间的区别之一,并允许小型配件节省电量.您需要在另一部手机上运行GATT服务器并发布服务.一种非常有用的通用工具是 nRF Connect.

To find a BLE device it's necessary that the device advertises its present. That's one of the differences between BLE and Bluetooth Classic and allows small accessories to save power. You need to run a GATT Server on your other phone and advertise a service. One very generic tool that would work is nRF Connect.

请详细了解 BLE的工作原理.

这篇关于蓝牙低能耗正在两部手机之间工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆