delphi 蓝牙 TBluetoothLE
delphi 蓝牙 TBluetoothLE、TBluetoothLEManager BLE
http://docwiki.embarcadero.com/RADStudio/Seattle/en/Using_Bluetooth_Low_Energy
指定UUID
HRSERVICE: TBluetoothUUID = '{0000180D-0000-1000-8000-00805F9B34FB}';
HRMEASUREMENT_CHARACTERISTIC: TBluetoothUUID = '{00002A37-0000-1000-8000-00805F9B34FB}';
BODY_SENSOR_LOCATION_CHARACTERISTIC: TBluetoothUUID = '{00002A38-0000-1000-8000-00805F9B34FB}';
1、搜索设备
方法一、
BluetoothLE1.DiscoverDevices(4000);
方法二、
HRSERVICE: TBluetoothUUID = '{0000180D-0000-1000-8000-00805F9B34FB}';
BluetoothLE1.DiscoverDevices(2500, [HRSERVICE]);
触发事件
BluetoothLE1EndDiscoverDevices
BluetoothLE1DiscoverLEDevice
2、搜索服务
BluetoothLE1.DiscoverServices(FCurrentDevice)//搜索所有服务
BluetoothLE1.DiscoveredDevices[ListBox1.ItemIndex].DiscoverServices
FGattService:=BluetoothLE1.GetService(FBLEDevice, HRSERVICE);//搜索指定UUID服务,同于第一步的UUID
3、查询特征
BluetoothLE1.GetCharacteristics(FWeightGattService);//特征列表
BluetoothLE1.GetCharacteristic(FWeightGattService, UUIDchar);//UUID指定的某个特征
FWeightMeasurementGattCharacteristic := BluetoothLE1.GetCharacteristic(FGattService,Weight_CHARACTERISTIC);
触发事件
BluetoothLE1EndDiscoverServices
搜索Characteristics
for C := 0 to AServiceList[I].Characteristics.Count - 1 do
ListBox2.Items.Add(' - ' + AServiceList[I].Characteristics[C].UUIDName + ' - ' + AServiceList[I].Characteristics[C].UUID.ToString);
4、订阅
BluetoothLE1.SubscribeToCharacteristic(FBLEDevice, FHRMeasurementGattCharact);
BluetoothLE1.SubscribeToCharacteristic(FBLEDevice, FWeightMeasurementGattCharacteristic);
ADevice.SetCharacteristicNotification(ACharacteristic, True)
5、发送数据
BluetoothLE1.WriteCharacteristic(TBluetoothLEDevice ADevice,TBluetoothGattCharacteristic ACharacteristic);
ADevice.WriteCharacteristic(AChar);
FGattChar.SetValue(sbytes);
bflag := FCurrentDevice.WriteCharacteristic(FGattChar)
6、接收数据
procedure BluetoothLE1CharacteristicRead(const Sender: TObject; const ACharacteristic: TBluetoothGattCharacteristic;
AGattStatus: TBluetoothGattStatus);
7、断开
BluetoothLE1.UnSubscribeToCharacteristic(FBLEDevice, FWeightMeasurementGattCharacteristic);
BluetoothLE1.UnSubscribeToCharacteristic(FBLEDevice, FHRMeasurementGattCharact);
ADevice.SetCharacteristicNotification(ACharacteristic, False)
http://blogs.embarcadero.com/sarinadupont/2014/10/20/creating-a-bluetooth-le-cloud-enabled-luggage-scale-application/
delphi 蓝牙 TBluetoothLE的更多相关文章
- TBluetoothLE
delphi 蓝牙技术 D:\Users\Public\Documents\Embarcadero\Studio\17.0\Samples\Object Pascal\Multi-Device Sam ...
- Delphi IOS 蓝牙锁屏后台运行
Delphi IOS 后台运行 同样的程序,编译成android,锁屏后继续运行正常,蓝牙通讯正常,但在IOS下锁屏后程序的蓝牙就中断通讯了? IOS的机制就是这样,锁屏就关闭了. 音乐播放器是怎么做 ...
- Android实例-Delphi开发蓝牙官方实例解析(XE10+小米2+小米5)
相关资料:1.http://blog.csdn.net/laorenshen/article/details/411498032.http://www.cnblogs.com/findumars/p/ ...
- Delphi XE7的蓝牙 Bluetooth
Delphi XE7已经内建了蓝牙功能,提供了System.Bluetooth.pas单元 顾名思义,System表示XE7的蓝牙功能可以在Windows,Android,IOS系统内使用 Syste ...
- delphi xe5 android 控制蓝牙
本文部分内容摘自: http://www.pclviewer.com/android/用以下代码中的接口实现控制蓝牙的开.关及详细信息 unit Androidapi.JNI.BluetoothAda ...
- delphi xe10 蓝牙
//蓝牙 System.Bluetooth //单元中主要包含以下几个类 TBluetoothManager.TBluetoothDeviceList.TBluetoothAdapter.TBluet ...
- Delphi XE5 android 蓝牙通讯传输
不多讲,直接上代码了. 代码来自网络 http://files.cnblogs.com/nywh2008/Bluetooth_LEDs_android.rar
- delphi 演示数据路径
链接里默认的--------------------------- Error --------------------------- I/O error for file "C:\Prog ...
- Delphi 和 C++Builder 2014年及以后技术路线图
RAD Studio, Delphi 和 C++Builder 2014年及以后技术路线图 By: Embarcadero News 内容源自Embarcadero新闻组,本人水平有限,欢迎各位高人修 ...
随机推荐
- codeforces 705B:Spider Man
Description Peter Parker wants to play a game with Dr. Octopus. The game is about cycles. Cycle is a ...
- Codeforces Round #283 (Div. 2) E. Distributing Parts 贪心+set二分
E. Distributing Parts time limit per test 2 seconds memory limit per test 256 megabytes input standa ...
- 如何破解mssql for linux 3.5G内存的限制
在上有篇博客中主要介绍了如何在CentOS 中安装和配置mssql ,在安装过程中遇到3.5G内存的限制,下面介绍如何去破解, 微软发布了SQLServer for Linux,但是安装竟然需要3.5 ...
- Pycharm如何打断点
一. python代码的调试方式 1. 使用print语句打印出来 2. 在编辑工具中,加断点跟踪(打断点) 3. 使用日志模块,输出到日志中 下面我们来看一下如何打断点 二. 环境 python 3 ...
- JVM 知识点总览 - 高级 Java 工程师面试必备
在江湖中要练就绝世武功必须内外兼备,精妙的招式和深厚的内功,武功的基础是内功.对于武功低(就像江南七怪)的人,招式更重要,因为他们不能靠内功直接去伤人,只能靠招式,利刃上优势来取胜了,但是练到高手之后 ...
- nginx安装目录
1.rpm -ql nginx看看通过yum安装到哪里了 2./etc/logrotate.d/nginx 配置 nginx日志轮转 用于logrotate服务的日志切割 3./etc/ngin ...
- webservice 传输数据过大,解析失败
ERROR 错误信息: 已超过传入消息(65536)的最大消息大小配额.若要增加配额,请使用相应绑定元素上的 MaxReceivedMessageSize 属性. 错误场景: webservice 服 ...
- (转) Android Service完全解析,关于服务你所需知道的一切(上)
相信大多数朋友对Service这个名词都不会陌生,没错,一个老练的Android程序员如果连Service都没听说过的话,那确实也太逊了.Service作为Android四大组件之一,在每一个应用程序 ...
- AngularJS-webapp($q)
$q延迟加载: 当一个数据需要请求多次,后面一个数据需要前面请求的数据时,我们就可以通过延迟加载进行数据传递 如下代码: 首先:我们需要得到职位信息: { "id": " ...
- L119
A big collaboration is trying to understand diseases of the psycheDiseases of the psyche have always ...