bluetooth-lowenergy

“Failed to encrypt the connection” with BlueZ peripheral and iOS

微笑、不失礼 提交于 2021-01-28 11:24:00
问题 I'm trying to make a raspberry pi bluetooth peripheral, so I try running the BlueZ example "example-gatt-server" and "example-advertising" at the same time. Then communicate it with my phone. But I got "Failed to encrypt the connection, the connection has timed out unexpectedly." on my iOS with nrf connect app. I'm using iOS 14, BlueZ 5.50, Raspberry Pi 4, Raspberry Pi OS Stretch 回答1: Instead of using ready made examples, I recommend that you create your own GATT server and then advertise as

Heart Rate Value in BLE

霸气de小男生 提交于 2021-01-28 11:13:17
问题 I am having a hard time getting a valid value out of the HR characteristics. I am clearly not handling the values properly in Dart. Example Data: List<int> value = [22, 56, 55, 4, 7, 3]; Flags Field: I convert the first item in the main byte array to binary to get the flags 22 = 10110 (as binary) this leads me to believe that it is U16 (bit[0] is == 1) HR Value: Because it is 16 bit I am trying to get the bytes in the 1 & 2 indexes. I then try to buffer them into a ByteData. From there I get

Android BLE write 'onCharacteristicWrite' returns status GATT_WRITE_NOT_PERMITTED

南楼画角 提交于 2021-01-28 06:08:56
问题 I've been trying to create a small Android BLE app that sends some bytes of data to a BLE device (an HM-10 module). Using existing applications on the Play Store I've been able to test the connection and this seems to be working but I seem to keep running into problems when trying to implement it in my own app. This is the code I'm using to connect to the BLE device using its MAC-address: // Initializes Bluetooth adapter. final BluetoothManager bluetoothManager = (BluetoothManager)

How to get BLE advertising channel index number

谁说胖子不能爱 提交于 2021-01-28 03:33:20
问题 I would like to get the advertising channel index number when I read the advertisement packet. I can only see that the advertisement information consists of a header info, UUID, major number, minor number and RSSI value. does any of this information have the channel number embedded into it? Can I tell if I'm reading the packet on channel 37/38/39? 回答1: On all host platforms that use HCI to communicate with the Bluetooth controller, this is not possible since HCI does not expose the channel

How to get BLE advertising channel index number

萝らか妹 提交于 2021-01-28 02:16:56
问题 I would like to get the advertising channel index number when I read the advertisement packet. I can only see that the advertisement information consists of a header info, UUID, major number, minor number and RSSI value. does any of this information have the channel number embedded into it? Can I tell if I'm reading the packet on channel 37/38/39? 回答1: On all host platforms that use HCI to communicate with the Bluetooth controller, this is not possible since HCI does not expose the channel

Delete all paired bluetooth devices on Android

↘锁芯ラ 提交于 2021-01-27 19:06:32
问题 I would like to delete paired bluetooth low energy devices with names that start with "ABC" on an Android phone programatically. I am using Android studio. 回答1: To unpair all devices use this code Set<BluetoothDevice> pairedDevices = mBluetoothAdapter.getBondedDevices(); if (pairedDevices.size() > 0) { for (BluetoothDevice device : pairedDevices) { try { if(device.getName().contains("abc")){ Method m = device.getClass() .getMethod("removeBond", (Class[]) null); m.invoke(device, (Object[])

Bluetooth Le Gatt Not Finding Any Devices

可紊 提交于 2021-01-27 10:50:17
问题 ANSWER: Special thanks to Nelson Hoang below for steering me in the right direction and providing valuble resources. Once the code for adding permissions for locations was added (see Edit2 below) I had to manually go into setting and switch location permissions for the app on. Once this was done it was working very well. Question: I am attempting to connect to Bluetooth LE devices using the standard Bluetooth LE Gatt from the android studio. I am forced to update gradle from 2.8 to 2.10 each

Sending bluetooth LE data in advertisement on iOS

孤街浪徒 提交于 2021-01-27 07:33:23
问题 My app is running as a Bluetooth LE peripheral, and I'm trying to send just a few bytes of custom data in the Advertisement. func btStartBroadcasting(peripheral: CBPeripheralManager!) { // create an array of bytes to send var byteArray = [UInt8]() byteArray.append(0b11011110); // 'DE' byteArray.append(0b10101101); // 'AD' // convert that array into an NSData object var manufacturerData = NSData(bytes: byteArray,length: byteArray.count) // define a UIUD for the service let theUUid = CBUUID

Sending bluetooth LE data in advertisement on iOS

淺唱寂寞╮ 提交于 2021-01-27 07:32:42
问题 My app is running as a Bluetooth LE peripheral, and I'm trying to send just a few bytes of custom data in the Advertisement. func btStartBroadcasting(peripheral: CBPeripheralManager!) { // create an array of bytes to send var byteArray = [UInt8]() byteArray.append(0b11011110); // 'DE' byteArray.append(0b10101101); // 'AD' // convert that array into an NSData object var manufacturerData = NSData(bytes: byteArray,length: byteArray.count) // define a UIUD for the service let theUUid = CBUUID

java.lang.NoClassDefFoundError on older Android SDK versions

≡放荡痞女 提交于 2021-01-27 03:53:40
问题 I released a version of my app to the Google Play and woke up this morning with a number of unhappy customers. The latest version of the app integrates support for a Bluetooth Low Energy (BTLE) heart rate monitor. The app runs fine on Android 4.3 and 4.4 but crashes on 4.0, 4.1, and 4.2 with the following error. FATAL EXCEPTION: main java.lang.NoClassDefFoundError: com.eiref.boatcoach.MainActivity at com.eiref.boatcoach.WhatToDo.onClick(WhatToDo.java:274) at android.view.View.performClick