通过蓝牙反应本地连接设备并读取数据

时间:2019-10-30 06:25:05

标签: reactjs react-native bluetooth react-native-ble-plx

我想连接名为gt-05的智能手表并读取心率,时间等信息。 我使用react-native-ble-plx,成功搜索并连接了watch,我得到了Service UUID,但是我库存读取了数据。我的代码是

   this.manager.servicesForDevice(item).then((servicesForDevice) => {
                console.log("servicesForDevice");
                console.log(servicesForDevice);
                console.log(servicesForDevice);
            }).catch((error) => {
                console.log(error);
            });
            console.log("device is " + device)

        }).
            catch((error) => {
                console.log("connect error: " + error);
            });

输出是;

servicesForDevice setUpDeveloperTools.js:73 (6)[服务,服务,服务,服务,服务,服务] 0:服务{isPrimary:true,deviceID:“ D8:9B:3B:B0:D0:F5”,uuid:“ 00001800-0000-1000-8000-00805f9b34fb”,ID:1,_manager:BleManager} 1:服务{isPrimary:true,deviceID:“ D8:9B:3B:B0:D0:F5”,uuid:“ 00001801-0000-1000-8000-00805f9b34fb”,id:6,_manager:BleManager} {{1} } 2:服务{isPrimary:true,deviceID:“ D8:9B:3B:B0:D0:F5”,uuid:“ 0000180a-0000-1000-8000-00805f9b34fb”,id:9,_manager:BleManager} 3:服务{isPrimary:true,deviceID:“ D8:9B:3B:B0:D0:F5”,uuid:“ 0000fe86-0000-1000-8000-00805f9b34fb”,id:18,_manager:BleManager} 4:服务{isPrimary:true,deviceID:“ D8:9B:3B:B0:D0:F5”,uuid:“ 00001812-0000-1000-8000-00805f9b34fb”,id:25,_manager:BleManager}

0 个答案:

没有答案