天道酬勤,学无止境

characteristics

Having trouble with custom UUID in Android BLE

问题 我在使用自己生成的 UUID(不使用蓝牙 SIG 保留的 16 位 UUID)在 Android BLE 中进行通信时遇到问题。 目标设备有两个 - 一个作为外围设备(Samsung Galaxy Note 4/android 5.1.1),另一个作为中央设备(Samsung Galaxy S5/android 5.0.1)。 我将自己的服务的 UUID 和特性的 UUID 放在外围设备端。 在中央,它找不到特色,只有服务。 它似乎是由于不使用这些特征 UUID 之一而是使用自定义生成的 UUID 引起的。 下面是我自己生成的 UUID。 private static final UUID CUSTOM_SERVICE_UUID = UUID.fromString("abcd1111-0000-1000-8000-00805f9b34fb"); private static final UUID CUSTOM_CHARACTERISTIC_UUID = UUID.fromString("abcd1112-0000-1000-8000-00805f9b34fb"); 服务,发现很好,但有特色,没有。 你有什么主意吗? 回答1 您正在使用官方基本 UUID:xxxxxxxx-0000-1000-8000-00805f9b34fb,其中保留了所有高 32 位(一些已分配。) 相反

2022-05-12 04:55:06    分类:技术分享    android   bluetooth   bluetooth-lowenergy   gatt   characteristics

Null pointer exception error sending a characteristic BLE android

问题 我是一名新的 android 开发人员,我正在尝试使用BLE 4.3发送数据,基于 Gatt android 示例项目。 我使用特性来放置我想要传输的数据。 当我尝试传输时,我使用项目的DeviceControlActivity列表中的第三个服务,出现一个文本对话框来介绍文本。 当我按下 OK 时,想法是开始传输,但我得到一个NullPointerException错误。 我不知道为什么会出现这个错误,我该如何解决这个问题。 这是我的完整代码,如果有用的话 package com.example.blem; public class DeviceControlActivity extends Activity { public static final String EXTRAS_DEVICE_NAME = "DEVICE_NAME"; public static final String EXTRAS_DEVICE_ADDRESS = "DEVICE_ADDRESS"; private TextView mConnectionState; private TextView mDataField; private TextView mRssiField; private String mDeviceName; private String mDeviceAddress

2022-05-08 08:48:36    分类:技术分享    android   nullpointerexception   bluetooth-lowenergy   gatt   characteristics

Having trouble with custom UUID in Android BLE

I have a problem with using my own generated UUID(not using 16 bit UUID reserved by Bluetooth SIG) to communicate in Android BLE. Target device is two - one is as a peripheral(Samsung galaxy note 4/android 5.1.1) and another one is as a central(Samsung galaxy S5/android 5.0.1). I put my own service's UUID and characteristic's UUID on the peripheral side. On the central side, it could not find characteristic but service. It seems like it caused by not using one of these Characteristic UUIDs but using custom generated UUID. Below is my own generated UUIDs. private static final UUID CUSTOM

2022-05-01 04:06:38    分类:问答    android   bluetooth   bluetooth-lowenergy   gatt   characteristics

Null pointer exception error sending a characteristic BLE android

I'm a new android developer and I'm trying to send a data using BLE 4.3, based on Gatt android sample project. I use characteristics to put the data that i want to transmit. When I try to transmit, I use the third service in the list of DeviceControlActivity of the project, appears a text dialog to introduce text. When I press OK, the idea is that start the transmission, but I obtain a NullPointerException error. I don't know why appears this error and how can I solve this. This is my full code, if this is useful package com.example.blem; public class DeviceControlActivity extends Activity {

2022-04-28 07:04:29    分类:问答    android   nullpointerexception   bluetooth-lowenergy   gatt   characteristics

Samsung Android BLE multiple read/write

In Samsung 4.2 to 4.3 BLE App Migration Guide (http://developer.samsung.com/ble) it says: The synchronous nature of the stack and F/W hasn’t been affected. That is, if we call for example, writeCharacteristic for a particular characteristic, if it returns true, the next call to any BluetoothGatt or BluetoothGattServer method should be done after the onCharacteristicRead callback is received. This is because the stack is designed to support and process only one GATT call at a time, and if, for example, you call writeCharacteristic or readCharacteristic of any characteristic soon after the first

2022-03-19 07:29:40    分类:问答    android   bluetooth   bluetooth-lowenergy   android-bluetooth   characteristics

How to get data out of bluetooth characteristic in Swift

I've got a Polar h7 device around me right now (it's BTLE) and I've got everything working but I am confused about how to get the BPM our of the characteristic.value now that it is updating. I have to turn some bytes into bpm... My peripheral is updating: func peripheral(peripheral: CBPeripheral!, didUpdateValueForCharacteristic characteristic: CBCharacteristic!, error: NSError!) { if characteristic.UUID == CBUUID.UUIDWithString(heartRateChar) { getInfoAboutHeartRate(characteristic) } } I am getting info about the heart rate: func getInfoAboutHeartRate(characteristic:CBCharacteristic) {

2022-03-11 21:09:20    分类:问答    ios   bluetooth   swift   characteristics   btle

如何使用 Android 订阅多个 BluetoothLE 特性(How to subscribe to multiple BluetoothLE Characteristics with Android)

问题 我正在开发一个 Android 应用程序,它应该订阅多个 BLE 特性。 但无论我做什么,我都只收到来自一个特征的更新值。 这是代码: BluetoothGattCharacteristic characteristicVel = gatt.getService(BleDefinedUUIDs.Service.KOMMMODUL_SERVICE).getCharacteristic(BleDefinedUUIDs.Characteristic.VELOCITY); gatt.setCharacteristicNotification(characteristicVel, true); BluetoothGattDescriptor descriptorVel = characteristicVel.getDescriptor( BleDefinedUUIDs.Descriptor.CHAR_CLIENT_CONFIG); descriptorVel.setValue(BleDefinedUUIDs.Descriptor.ENABLE_NOTIFICATION_VALUE); gatt.writeDescriptor(descriptorVel); BluetoothGattCharacteristic characteristicAcc = gatt.getService

2021-11-30 13:09:05    分类:技术分享    android   bluetooth-lowenergy   characteristics

How to subscribe to multiple BluetoothLE Characteristics with Android

I am developing an Android app which should subscribe to multiple BLE characteristics. But whatever I do, I receive only the updated values from one characteristic. Here is the code: BluetoothGattCharacteristic characteristicVel = gatt.getService(BleDefinedUUIDs.Service.KOMMMODUL_SERVICE).getCharacteristic(BleDefinedUUIDs.Characteristic.VELOCITY); gatt.setCharacteristicNotification(characteristicVel, true); BluetoothGattDescriptor descriptorVel = characteristicVel.getDescriptor( BleDefinedUUIDs.Descriptor.CHAR_CLIENT_CONFIG); descriptorVel.setValue(BleDefinedUUIDs.Descriptor.ENABLE

2021-11-24 06:40:11    分类:问答    android   bluetooth-lowenergy   characteristics