- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
从今天起,摩托罗拉开发者门户网站将问题重定向到 Stack Overflow 和 Google Android 论坛,因此希望摩托罗拉的人正在倾听。
我正在尝试在 ICS 设备(在我的例子中是 Atrix HD)上开发一个简单的应用程序,它可以查询和写入 GATT 配置文件(不仅仅是心率监测器)。
说明/示例位于 http://www.motorola.com/sites/motodev/library/bluetooth_gatt_apis.html对于 ICS,充其量是不完整的。例如,ICS 下载中不包含 MOT_BTLE_Stubs.jar。相反,我们有 BluetoothGatt.jar 和 BluetoothGattService.jar。但是这些库没有教程中提到的 BluetoothGatt.connectGatt(...)。
ICS 附加组件包含一个示例,它引导我生成 ACTION_GATT Intent ,但当我为以下内容返回 NULL 时失败了:
String[] ObjectPathArray = (String[])intent.getStringArrayExtra(BluetoothDevice.EXTRA_GATT);
一个编写良好的 ICS 示例将为摩托罗拉和规模较小但不断发展的 Android BLE 开发者社区提供很好的服务。
谢谢!
个人空间
最佳答案
我偶然发现了完全相同的问题。
我的 Razr XT910 已更新到 Android ICS (4.0.4),我正在使用摩托罗拉手机 SDK 插件“Motorola_ICS_R2
”。
我现在谈论的是 SDK Addon 示例“Motorola_BLE_profile_sample”,我将其用作配置文件模板以与运行 SimplePeripheral 示例的 TI CC2540 开发套件的 Keyfob 进行通信。
当您创建配置文件服务时,请确保调用 BluetoothGattService(...) 包含有效的 GATT Primary Service Declaration UUID您要连接到的设备实现。这将解决空 ObjectPathArray 的问题。
例如,我的 key 扣使用 UUID 0x180A 实现设备信息服务,您可以在 BLE CC2540 开发套件用户指南 (http://www.ti.com/lit/ug/swru270b/swru270b.pdf) at page 14 in figure 20. 你看到句柄 0x01, 0x0C, 0x0F 的类型 0x2800 了吗,这些都是主要服务。您可以找到 GATT 配置文件属性类型 here .现在您将配置文件模板 (Motorola_BLE_profile_sample) 从
public static final ParcelUuid HRM = ParcelUuid
.fromString("0000180D-0000-1000-8000-00805f9b34fb");
到:
public static final ParcelUuid HRM = ParcelUuid
.fromString("0000180A-0000-1000-8000-00805f9b34fb");
运行应用程序后,LogCat 如下所示:
11-09 03:17:39.674: I/BluetoothLe(17462): onStop()
11-09 03:17:40.478: I/BluetoothLe(17462): onStart()
11-09 03:17:40.478: I/BluetoothLe(17462): onResume()
11-09 03:17:40.978: D/BluetoothLeREceiver(17462): Bluetooth LE receiver intnet action: android.bluetooth.devicepicker.action.DEVICE_SELECTED
11-09 03:17:40.986: I/BluetoothLe(17462): enter startConnection and value of devicePicker is true
11-09 03:17:40.986: D/BluetoothLe(17462): Calling btDevice.getGattServices
11-09 03:17:40.994: V/BluetoothLe(17462): primary service was successful
11-09 03:17:40.994: D/BluetoothLe(17462): GATT action
11-09 03:17:41.002: D/BluetoothLe(17462): GATT Service data list len : 1
11-09 03:17:41.002: V/BluetoothLe(17462): getBluetoothGattService()
11-09 03:17:41.002: D/BluetoothLe(17462): ++++++ Creating BluetoothGattService with device = 90:D7:EB:B2:4D:1D uuid 0000180a-0000-1000-8000-00805f9b34fb objPath = /org/bluez/358/hci0/dev_90_D7_EB_B2_4D_1D/service0010
11-09 03:17:41.002: D/BluetoothGattService(17462): Discovery State 0 to 0
11-09 03:17:41.002: D/BluetoothGattService(17462): Bond state of remote device : 90:D7:EB:B2:4D:1D is 12
11-09 03:17:41.002: D/BluetoothGattService(17462): doDiscovery /org/bluez/358/hci0/dev_90_D7_EB_B2_4D_1D/service0010
11-09 03:17:41.002: D/BluetoothGattService(17462): Discovery State 0 to 2
11-09 03:17:41.002: D/BluetoothLe(17462): getBluetoothGattService(): Adding gatt service to map for : 0000180a-0000-1000-8000-00805f9b34fbsize :1
11-09 03:17:41.002: D/BluetoothGattService(17462): readCharacteristicValue for /org/bluez/358/hci0/dev_90_D7_EB_B2_4D_1D/service0010
11-09 03:17:55.463: D/BluetoothGattService(17462): onCharacteristicsDiscovered: [Ljava.lang.String;@41412ea0
11-09 03:17:55.471: D/BluetoothGattService(17462): Discovered 9 characteristics for service /org/bluez/358/hci0/dev_90_D7_EB_B2_4D_1D/service0010 ( null )
11-09 03:17:55.510: D/BluetoothGattService(17462): Discovery State 2 to 1
11-09 03:17:55.510: D/BluetoothLe(17462): onDiscoverCharacteristicsResult : path : /org/bluez/358/hci0/dev_90_D7_EB_B2_4D_1D/service0010 result : true
11-09 03:17:55.510: D/BluetoothLe(17462): gattService.getServiceUuid() ======= 0000180a-0000-1000-8000-00805f9b34fb
11-09 03:17:55.517: D/BluetoothGattService(17462): Characteristic UUID: 00002a23-0000-1000-8000-00805f9b34fb
11-09 03:17:55.517: D/BluetoothGattService(17462): Characteristic UUID: 00002a24-0000-1000-8000-00805f9b34fb
11-09 03:17:55.517: D/BluetoothGattService(17462): Characteristic UUID: 00002a25-0000-1000-8000-00805f9b34fb
11-09 03:17:55.517: D/BluetoothGattService(17462): Characteristic UUID: 00002a26-0000-1000-8000-00805f9b34fb
11-09 03:17:55.517: D/BluetoothGattService(17462): Characteristic UUID: 00002a27-0000-1000-8000-00805f9b34fb
11-09 03:17:55.517: D/BluetoothGattService(17462): Characteristic UUID: 00002a28-0000-1000-8000-00805f9b34fb
11-09 03:17:55.517: D/BluetoothGattService(17462): Characteristic UUID: 00002a29-0000-1000-8000-00805f9b34fb
11-09 03:17:55.517: D/BluetoothGattService(17462): Characteristic UUID: 00002a2a-0000-1000-8000-00805f9b34fb
11-09 03:17:55.525: D/BluetoothGattService(17462): Characteristic UUID: 00002a50-0000-1000-8000-00805f9b34fb
11-09 03:17:55.525: D/BluetoothGattService(17462): value is : /org/bluez/358/hci0/dev_90_D7_EB_B2_4D_1D/service0010/characteristic0012,/org/bluez/358/hci0/dev_90_D7_EB_B2_4D_1D/service0010/characteristic0014,/org/bluez/358/hci0/dev_90_D7_EB_B2_4D_1D/service0010/characteristic0016,/org/bluez/358/hci0/dev_90_D7_EB_B2_4D_1D/service0010/characteristic0018,/org/bluez/358/hci0/dev_90_D7_EB_B2_4D_1D/service0010/characteristic001a,/org/bluez/358/hci0/dev_90_D7_EB_B2_4D_1D/service0010/characteristic001c,/org/bluez/358/hci0/dev_90_D7_EB_B2_4D_1D/service0010/characteristic001e,/org/bluez/358/hci0/dev_90_D7_EB_B2_4D_1D/service0010/characteristic0020,/org/bluez/358/hci0/dev_90_D7_EB_B2_4D_1D/service0010/characteristic0022,
11-09 03:17:55.525: D/BluetoothGattService(17462): Characteristic UUID: 00002a23-0000-1000-8000-00805f9b34fb
11-09 03:17:55.525: D/BluetoothLe(17462): Map with key UUID : 00002a23-0000-1000-8000-00805f9b34fb value : /org/bluez/358/hci0/dev_90_D7_EB_B2_4D_1D/service0010/characteristic0012
11-09 03:17:55.525: D/BluetoothGattService(17462): Characteristic UUID: 00002a24-0000-1000-8000-00805f9b34fb
11-09 03:17:55.525: D/BluetoothLe(17462): Map with key UUID : 00002a24-0000-1000-8000-00805f9b34fb value : /org/bluez/358/hci0/dev_90_D7_EB_B2_4D_1D/service0010/characteristic0014
11-09 03:17:55.525: D/BluetoothGattService(17462): Characteristic UUID: 00002a25-0000-1000-8000-00805f9b34fb
11-09 03:17:55.525: D/BluetoothLe(17462): Map with key UUID : 00002a25-0000-1000-8000-00805f9b34fb value : /org/bluez/358/hci0/dev_90_D7_EB_B2_4D_1D/service0010/characteristic0016
11-09 03:17:55.525: D/BluetoothGattService(17462): Characteristic UUID: 00002a26-0000-1000-8000-00805f9b34fb
11-09 03:17:55.525: D/BluetoothLe(17462): Map with key UUID : 00002a26-0000-1000-8000-00805f9b34fb value : /org/bluez/358/hci0/dev_90_D7_EB_B2_4D_1D/service0010/characteristic0018
11-09 03:17:55.525: D/BluetoothGattService(17462): Characteristic UUID: 00002a27-0000-1000-8000-00805f9b34fb
11-09 03:17:55.533: D/BluetoothLe(17462): Map with key UUID : 00002a27-0000-1000-8000-00805f9b34fb value : /org/bluez/358/hci0/dev_90_D7_EB_B2_4D_1D/service0010/characteristic001a
11-09 03:17:55.533: D/BluetoothGattService(17462): Characteristic UUID: 00002a28-0000-1000-8000-00805f9b34fb
11-09 03:17:55.533: D/BluetoothLe(17462): Map with key UUID : 00002a28-0000-1000-8000-00805f9b34fb value : /org/bluez/358/hci0/dev_90_D7_EB_B2_4D_1D/service0010/characteristic001c
11-09 03:17:55.533: D/BluetoothGattService(17462): Characteristic UUID: 00002a29-0000-1000-8000-00805f9b34fb
11-09 03:17:55.533: D/BluetoothLe(17462): Map with key UUID : 00002a29-0000-1000-8000-00805f9b34fb value : /org/bluez/358/hci0/dev_90_D7_EB_B2_4D_1D/service0010/characteristic001e
11-09 03:17:55.533: D/BluetoothGattService(17462): Characteristic UUID: 00002a2a-0000-1000-8000-00805f9b34fb
11-09 03:17:55.533: D/BluetoothLe(17462): Map with key UUID : 00002a2a-0000-1000-8000-00805f9b34fb value : /org/bluez/358/hci0/dev_90_D7_EB_B2_4D_1D/service0010/characteristic0020
11-09 03:17:55.533: D/BluetoothGattService(17462): Characteristic UUID: 00002a50-0000-1000-8000-00805f9b34fb
11-09 03:17:55.533: D/BluetoothLe(17462): Map with key UUID : 00002a50-0000-1000-8000-00805f9b34fb value : /org/bluez/358/hci0/dev_90_D7_EB_B2_4D_1D/service0010/characteristic0022
11-09 03:17:55.533: D/BluetoothLe(17462): Created map with size : 10
就是这样:-)
关于android - 需要在 Android ICS 上使用摩托罗拉 GATT 配置文件 API 的蓝牙低功耗示例,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13185109/
我需要安装一个 VPN 配置文件,以后可以在没有用户干预的情况下进行更改。直接的方法是安装 VPN 配置文件,然后安装 MDM 配置文件,以便以后可以更改配置。 但是,我的要求仅与 VPN 配置有关,
配置文件 全局配置文件hibernate.cfg.xml hibernate.cfg.xml --> com.mysql.cj
我想知道有没有一种方法可以设置配置,我可以有两个数据库条目,当环境是本地时和在服务器上时都可以工作。 我很久以前就通过代码进行切换时遇到了一个解决方案。现在无法找到它。你们是怎么做到的? 最佳答案 我
通常我总能在 Stack Overflow 上找到我要找的东西。但是这次我真的难住了。 我已经阅读了针对遇到类似问题的人的其他 Stack Overflow 回复;但无济于事。 (我认为其中一部分原因
我是 Hadoop 新手。我正在尝试设置单节点集群。 我注意到在我读过的文档中(甚至在 Apache 的配置站点上)它总是引用 conf/目录中的配置文件。但是,当我下载 2.X.X 版时,我只能在
好吧,我之前发布了如何读取其他程序的其他配置文件(这里是链接 Previous Post 。我设法做到了。但是现在还有另一个问题。场景是这样的,我有两个程序。程序 A 从配置文件中读取其配置,程序 B
【全局(系统)配置文件】 复制代码 代码如下: /etc/crontab Linux 主要的配置文件都在 etc 目录下。 复制代码
Apache HBase配置文件 本节是本章内容的开篇,我们首先来认识Apache HBase中有哪些需要的配置文件! Apache HBase使用与Apache Hadoop相同的配置系统。所有
我想了解如何为我们的实验构建配置文件 让我们以 AllenNLP 文档中的这个例子为例 training and prediction 特别是这个片段 我们从哪里得到“token_embedders”
我正在研究 MAVEN 配置文件,我有一个关于使用变量设置属性的问题。目前,我正在使用以下配置: Action type D restriction actionTy
我知道以前可能有人问过这个问题,但我似乎无法为我找到正确的答案。 我有一个名为 的 Windows 服务foobar.exe .我有一个名为 的应用程序配置文件foobar.exe.confi
我使用 FitNesse 作为功能测试框架。当 FitNesse 运行需要配置的代码时,我遇到了麻烦。 如果我需要从配置文件中获取连接字符串,我可以通过将它添加到 FitServer.exe.conf
我对我的 Jenkins 输出感到有些困惑。 关于 Jenkins 的工作:(在底部缩短了 pom.xml) mvn deploy -Pprofile1 我所有的插件将运行 4 次: 父/pom.xm
我偶尔会遇到一个问题,即为设备配置开发版本的应用程序。错误消息通常是“找不到此可执行文件的有效配置文件”。 我已遵循所有 Apple 说明:我拥有有效的开发证书,开发人员配置文件包含相关设备的设备 I
我正在尝试在 F# 控制台应用程序中使用 NLog,我已设法使用 App.config 中的配置部分使其工作,但无法使用独立的 NLog.config 文件使其工作。我的 NLog.config 文件
有没有办法像在 rubocop 中一样使用配置文件禁用 puppet-lint 中的检查?配置文件应该是txt文件、json文件还是其他格式? 最佳答案 是的,该文件名为 .puppet-lint.r
我有多个网站,它们都具有相同的代码,但应用程序设置不同。我想将我的应用程序设置放在位于虚拟目录中的单独配置文件中。这将允许我在所有站点之间共享所有代码的单个副本,每个站点具有不同的虚拟目录。 不幸的是
我在 Ubuntu 上使用 ghci 6.8.2。 ghci 是否使用配置文件来进行一些初始设置?例如::设置提示符“ghci>”。 最佳答案 您是否尝试过将 :set Prompt "ghci> "
我继承了一个运行 JBoss 7.x 服务器、java 后端等单个实例的项目。我对 JBoss 完全陌生,我对文件结构的配置感到好奇),我必须拥有什么以及在哪里。 documentation其结构与我
我有一个关于 Android 的问题。我只需要在开始时运行其中一项 Activity 一次。因此,通常最好的解决方案是创建包含标志 isFirstRun 的文件并在应用程序启动后检查该值。 但在我的应
我是一名优秀的程序员,十分优秀!