bluetooth-lowenergy

Unique identifier for peripheral BLE device

折月煮酒 提交于 2021-02-06 11:23:29
问题 So I have peripheral BLE device and I need some identifier for it to later share with another iPhone. Example I connect with iPhone 'A' to peripheral. iPhone 'A' saves peripheral's identifier to database and later I easily can take iPhone 'B' and connect to the peripheral found by this identifier. Now there is UUID what changes for every iPhone-peripheral connection, but MAC Address is not available. What could you suggest? 回答1: If you do not manufacture the peripheral yourself then you can

Read advertisement packet in Android

落爺英雄遲暮 提交于 2021-02-05 13:11:36
问题 I'm working on a BLE sensor that is advertising manufacturer specific data. Is there any sample code that demonstrates how to receive an advertisement packet in Android and parse its payload? 回答1: This is what I was looking for: The BLE scan API BluetoothAdapter.startLeScan(ScanCallback) requires a call back function for the scan results. the method needs to look like the following: private BluetoothAdapter.LeScanCallback ScanCallback = new BluetoothAdapter.LeScanCallback()onLeScan(final

Read advertisement packet in Android

醉酒当歌 提交于 2021-02-05 13:07:49
问题 I'm working on a BLE sensor that is advertising manufacturer specific data. Is there any sample code that demonstrates how to receive an advertisement packet in Android and parse its payload? 回答1: This is what I was looking for: The BLE scan API BluetoothAdapter.startLeScan(ScanCallback) requires a call back function for the scan results. the method needs to look like the following: private BluetoothAdapter.LeScanCallback ScanCallback = new BluetoothAdapter.LeScanCallback()onLeScan(final

ACCESS_COARSE_LOCATION does not work on Android 6 [duplicate]

天大地大妈咪最大 提交于 2021-02-05 05:27:51
问题 This question already has answers here : Android permission doesn't work even if I have declared it (13 answers) Closed 4 years ago . I follow the official example to write this program public class BluetoothActivity extends AppCompatActivity { private static final long SCANNING_TIMEOUT = 5000; /* 5 seconds */ private static final int ENABLE_BT_REQUEST_ID = 1; private BleWrapper mBleWrapper = null; private boolean mScanning = false; private Handler mHandler = new Handler(); private

Advertising with iBeacon when app is in background

我的未来我决定 提交于 2021-02-04 12:48:25
问题 I have been digging all forums and tutorials about transmitting in background mode with iBeacon. Until now, I couldn't find something solid which can help me. My app can successfully receive and transmit but when I press home button, transmitting stops and connection on other device/devices disappear. In myApp.plist, I added required keys but still nothing works. The question is, how can I make my app keep transmitting in background mode? 回答1: iBeacon will not advertise (transmit) in the

Getting a String from a byte (Corebluetooth, Swift)

眉间皱痕 提交于 2021-01-29 20:21:22
问题 Just making this to see if someone could help me with some BLE problems. I'm trying to make an app which gets the stuff from my rowing machine but I can't figure out how to turn bytes into like a string? Its hard to explain but here's my VC: import UIKit import CoreBluetooth let rowerServiceCBUUID = CBUUID(string: "CE060000-43E5-11E4-916C-0800200C9A66") let characteristic1CBUUID = CBUUID(string: "CE060031-43E5-11E4-916C-0800200C9A66") let characteristic2CBUUID = CBUUID(string: "2AD1") class

Gatttool Non-Interactive mode, multiple char-write-req

亡梦爱人 提交于 2021-01-29 18:53:04
问题 I would like to retrieve the data of a stryd footpod. I would like to listen to 2 separate uuid's. In interactive mode, I would connect using sudo gatttool -t random -b XX:XX:XX:XX:XX:XX -I connect char-write-req 0x001a 0100 char-write-req 0x000f 0100 However, as I use this as part of a perl script, I would like to leverage non-interactive mode. Starting gatttool with a single handle works fine: gatttool -t random -i hci0 -b XX:XX:XX:XX:XX:XX --char-write-req --handle=0x001a --value=0100 -

Invalid Params issue when doing hciconfig hci0 reset

风格不统一 提交于 2021-01-29 14:11:46
问题 This issue I am observing with kernel above 5.0. And with controllers that have extended advertising enabled. I have currently tested with bluez-5.50. The issue is something to do with "MGMT_ADV_FLAG_SEC_MASK" flag is what I could get from the code. But when and how will this flag be modified is what I dont understand. Config: kernel 5.4.24(issue seen with any 5.0+ kernel) , bluez 5.50 I am doing following steps: 1. hciattach the BLE extended ADV enabled controller. 2. hciconfig hci0 reset. I

Bluetooth 5 & BLE throughput over multiple connections

有些话、适合烂在心里 提交于 2021-01-29 13:28:14
问题 I've been reading this article on Bluetooth 5 & BLE maximum throughput. It provides data on maximum throughput across different devices and configurations. As far as I've understood, these measurements are defined by the connection between two devices and their respective data rates. When establishing connections to more than one device, do these data rates apply to each connection independently? Or is the data rate shared between all of the connections? For example: If I have a device with a

How to detect bluetooth changes (connection state and characteristic) when app is in background without a foreground service

送分小仙女□ 提交于 2021-01-29 13:10:05
问题 I have a device that is a simple BLE device with a button, and I need to detect when the user long presses the device (via characteristic change) even when the app is in the background. This click will trigger a remote call the server. I have two questions regarding this: #1 Can I have this achieved without a foreground service? #2 If I have a foreground service running with the BLE GATT callbacks how can I detect when the device is in range again? My current solution is to have a foreground