Android bluetooth low energy (ble) writeCharacteristic delay callback
I am implementing a application on Android using BLE Api (SDK 18), and I have a issue that the transfer data process is delay very slow. This is my log.
03-12 16:20:05.121: D/BluetoothGatt(13578): writeCharacteristic() - uuid: ...
03-12 16:20:06.272: D/BluetoothGatt(13578): onCharacteristicWrite() - Device=... UUID=... Status=0
03-12 16:20:06.972: D/BluetoothGatt(13578): writeCharacteristic() - uuid: ...
03-12 16:20:08.254: D/BluetoothGatt(13578): onCharacteristicWrite() - Device=... UUID=... Status=0
03-12 16:20:10.055: D/BluetoothGatt(13578): writeCharacteristic() - uuid: ...
03-12 16:20:11.257: D/BluetoothGatt(13578): onCharacteristicWrite() - Device=... UUID=... Status=0
03-12 16:20:12.478: D/BluetoothGatt(13578): writeCharacteristic() - uuid: ...
03-12 16:20:14.250: D/BluetoothGatt(13578): onCharacteristicWrite() - Device=... UUID=... Status=0
03-12 16:20:14.960: D/BluetoothGatt(13578): writeCharacteristic() - uuid: ...
03-12 16:20:16.242: D/BluetoothGatt(13578): onCharacteristicWrite() - Device=... UUID=... Status=0
03-12 16:20:16.402: D/BluetoothGatt(13578): writeCharacteristic() - uuid: ...
03-12 16:20:20.225: D/BluetoothGatt(13578): onCharacteristicWrite() - Device=... UUID=... Status=0
03-12 16:20:20.526: D/BluetoothGatt(13578): writeCharacteristic() - uuid: ...
03-12 16:20:24.219: D/BluetoothGatt(13578): onCharacteristicWrite() - Device=... UUID=... Status=0
03-12 16:20:25.360: D/BluetoothGatt(13578): writeCharacteristic() - uuid: ...
03-12 16:20:27.222: D/BluetoothGatt(13578): onCharacteristicWrite() - Device=... UUID=... Status=0
For more information, I found that every Transfer Progress only completes when it has the onCharacteristicWrite callback, this means that all sending command before receive onCharacteristicWrite callback will be ignored.
Is this the flow of Android we have to following or there is any way to setup it skip the callback step to speed up the progress.
My code is:
privatefinalBluetoothGattCallback mGattCallback =newBluetoothGattCallback(){......@Overridepublicvoid onCharacteristicWrite(BluetoothGatt gatt,BluetoothGattCharacteristic characteristic,int status){
mSending =false;}};privatevoid writeCharacteristic(){.....
mGattCharacSetIntensity.setValue(data);
mGattCharacSetIntensity.setWriteType(BluetoothGattCharacteristic.WRITE_TYPE_DEFAULT);
mBluetoothGatt.writeCharacteristic(mGattCharacSetIntensity);return;}
EDIT: I have a comparison with iPhone (a BLE transfer data app from AppStore), the BLE transfer data is very quick (less than 0.5 sec), so impressive. How can we work around to SPEED UP the Android BLE Transfer progress?.
EDIT: If I set WriteType of BluetoothGattCharacteristic to WRITE_TYPE_NO_RESPONSE, and when I send many command sequentially, the Android stores them on a queue and send to remote device one by one after receive writeCharacteristic CallBack, this leads to a issue, when you stop your sending lood, the Android Sending Progress still continue with the delay (Sometime more than 3 sec).
##############
Performance of a BLE link is highly dependent on the connection interval used, and if your connection interval is high, the performance you see may not be that unreasonable. By the Core Specification, the connection interval can be between 7.5 ms and 4 s, so there's quite some flexibility.
If it's possible for you, I'd recommend you to try changing the Peripheral you're talking to to use a shorter connection interval, which should improve performance. You may have use in taking a look at this page, explaining BLE throughput, and this page, explaining connection parameters.
http://stackoverflow.com/questions/22348470/android-bluetooth-low-energy-ble-writecharacteristic-delay-callback
Android bluetooth low energy (ble) writeCharacteristic delay callback的更多相关文章
- Android Bluetooth Low Energy (BLE)简单方便的蓝牙开源库——EasyBLE
源码传送门 最新版本 功能 支持多设备同时连接 支持广播包解析 支持连接同时配对 支持搜索系统已连接设备 支持搜索器设置 支持自定义搜索过滤条件 支持自动重连.最大重连次数限制.直接重连或搜索到设备再 ...
- How to Implement Bluetooth Low Energy (BLE) in Ice Cream Sandwich
ShareThis - By Vikas Verma Bluetooth low energy (BLE) is a feature of Bluetooth 4.0 wireless radio t ...
- Bluefruit LE Sniffer - Bluetooth Low Energy (BLE 4.0) - nRF51822 驱动安装及使用
BLE Sniffer https://www.adafruit.com/product/2269 Bluefruit LE Sniffer - Bluetooth Low Energy (BLE 4 ...
- Overview and Evaluation of Bluetooth Low Energy: An Emerging Low-Power Wireless Technology
转自:http://www.mdpi.com/1424-8220/12/9/11734/htm Sensors 2012, 12(9), 11734-11753; doi:10.3390/s12091 ...
- Android使用BLE(低功耗蓝牙,Bluetooth Low Energy)
背景 在学习BLE的过程中,积累了一些心得的DEMO,放到Github,形成本文.感兴趣的同学可以下载到源代码. github: https://github.com/vir56k/bluetooth ...
- Bluetooth Low Energy 嗅探
Bluetooth Low Energy 嗅探 路人甲 · 2015/10/16 10:52 0x00 前言 如果你打开这篇文章时期望看到一些新的东西,那么很抱歉这篇文章不是你在找的那篇文章.因为严格 ...
- Bluetooth Low Energy介绍
目录 1. 介绍 2. 协议栈 3. 实现方案 3.1 硬件实现方案 3.2 软件实现方案 1. 介绍 Bluetooth low energy,也称BLE(低功耗蓝牙),在4.0规范中提出 BLE分 ...
- Bluetooth Low Energy 介绍
1.简介 BLE(Bluetooth Low Energy,低功耗蓝牙)是对传统蓝牙BR/EDR技术的补充.尽管BLE和传统蓝牙都称之为蓝牙标准,且共享射频,但是,BLE是一个完全不一样的技术.BLE ...
- Bluetooth® Low Energy Beacons
Bluetooth® Low Energy Beacons ABSTRACT (abstract ) 1.This application report presents the concept of ...
随机推荐
- http header详解
HTTP(HyperTextTransferProtocol)即超文本传输协议,目前网页传输的的通用协议.HTTP协议采用了请求/响应模 型,浏览器或其他客户端发出请求,服务器给与响应.就整个网络资源 ...
- parseInt在IE8转换返回不相等(parseInt("08")返回0等以0开头大于7的数字串)
描述 在IE8内核下parseInt("08")返回0,等以0开头大于7的数字串返回的值不相等 解决方法 parseInt当不指定radix时,当以0x开头时,s按照十六进制计算的 ...
- 关于在windows环境下配置xampp多站点问题
前言 由于开发要求,最近开始了php开发,于是就找到了xampp,wamp等集成环境,关于在windows下的xampp和wamp的配置,我过两天在写两篇分别阐述一下,下面就遇到的多站点的配置问题讲一 ...
- Ubuntu系统下载工具的推荐
源 起 大家在上手一段时间Ubuntu系统后,可能突然想起最近新出了一些电影想要下载来看看,但如果用Wine运行迅雷,不是没反应就是启动后也不能下载,针对这个问题,根据我的使用体验推荐大家两款Ubun ...
- (转)Android面试题
1. 下列哪些语句关于内存回收的说明是正确的? (b ) A. 程序员必须创建一个线程来释放内存 B.内存回收程序负责释放无用内存 C.内存回收程序允许程序员直接释放内存 D.内存回收程序可以在 ...
- HTML、JS、CSS之特殊字符
可能这是冷知识了,并不为多数人知道像HTML.JS.CSS它们的特殊字符的写法,我也是在网上收录的在这里make一下: 箭头类 符号 UNICODE 符号 UNICODE HTML JS CSS HT ...
- SQL里IN的用法以及优化
1.in后条件不多,可以考虑主表建索引,或用union all 代替 2. in 和 exists的区别: 如果子查询得出的结果集记录较少,主查询中的表较大且又有索引时应该用in, 反之如果外层的主查 ...
- Windows删除大文件
Temp是目录 或者是 文件很大很大很大很大 cmd rd /s /q Temp
- 《JavaScript高级程序设计》心得笔记-----第四篇章
第十六章 1. 跨文档消息传送: postMessage("消息", "发送消息的文档所在域") 2. 拖放事件: 1) 拖动某元素会依次触发:drag ...
- ArcSDE for Microsoft SQL Server Post Installation图解(转)
ArcSDE for Microsoft SQL Server Post Installation图解 使用ArcSDE作为空间数据引擎时,经常遇到服务无法启动的情况(启动服务时提示:本地计算机上的a ...