问题标签 [android-ble]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
323 浏览

android - How will i Split a String that received from a ble device for if else checking and display a value on Textview

In my Android app I receive data from my ble device as something like 10100201201511 ( it includes date,time and other attributes).

I hope I received it as a string, I want to check that value and display it on textview.

My Requirement is

But I always get errors like Array type expected; found 'Java.lang.String'

My current code is:

Plz help me to resolve this..

0 投票
1 回答
240 浏览

android - 如何在Android中从一个字节中提取一点并将其显示在文本视图上?

我正在从 ble 设备接收字符串数据。我将它存储在String names 我需要从它的第八个位置提取一个字节,然后我需要从该字节中提取所有位。

我怎样才能做到这一点?

现在,我只能接收字符串。我能够提取前 2 个子字符串。

我当前的代码是:

0 投票
1 回答
110 浏览

android - Android 应用程序在 0x7F 后未读取值

我有从 ble 设备接收数据的应用程序。首先它发送数据为|0/1|date1|month1|hour1|minute1|date2|month2|hour2|minute2|0x8A|

应用程序读取除0x8A.

当我提到一些网站时,似乎 android 应用程序只能读取standard ASCI 最多0x7F. 如果是,我将如何将数据转换为Extended ASCI?我的数据作为 String 接收。

请帮我解决这个问题。

0 投票
2 回答
3475 浏览

android - 安卓蓝牙获取心率测量

我想获得“A&D UA-651BLE”设备的 HRM 值。这是该设备的数据表中写入的用于获取 HRM 值的内容:

  1. 将应用程序设置为配对模式以开始扫描。
  2. 按照每个说明手册开始配对 A&D BLE 设备。
  3. 在配对模式下,应用程序应为 A&D BLE 设备设置时间和日期以及任何其他设备设置。配对成功后,A&D BLE 设备在屏幕上显示“End”。
  4. 进行测量并完成测量,然后 A&D BLE 设备开始 BLE 连接和广告。应用程序以适当的间隔开始扫描,以便应用程序尽快捕获 A&D BLE 设备的广告。
  5. 在初始连接或配对时,应用程序将“2”设置为 CCCD(客户端特性配置描述符),以便 A&D BLE 设备发送带有指示的测量数据。
  6. A&D 设备识别到 CCCD 设置为“2”并在连接后 5 秒内同步时间和日期后,发送带指示的数据。
  7. 如果超时设置 CCCD 和时间和日期到期,A&D BLE 设备将不会发送数据并将数据存储在内存中。A&D BLE 设备中存储的数据可以发送下一个成功连接。

这是我的服务代码:

这是读取数据的方法:

问题是这段代码不返回任何数据!

0 投票
0 回答
575 浏览

android - 我将如何在多个文本视图上连续显示从 ble 设备接收到的值

我正在开发一个湿度传感器的应用程序。传感器将每秒连续向应用程序发送数据。我需要在多个文本视图上显示它,每秒更新一次。

目前,我的接收部分代码是

0 投票
1 回答
2284 浏览

android - 如何检测我的安卓设备何时与配对的蓝牙设备连接/断开连接

我想收到一个事件,用于检测蓝牙在我的设备中何时配对或未配对。

一开始我发现http://developer.android.com/reference/android/bluetooth/BluetoothServerSocket.html

我关注了这个博客:http ://android-er.blogspot.co.il/2014/12/make-bluetooth-connection-between.html这非常有用,但是没有检测到何时建立新连接。

不用说,我对蓝牙实现没有用处,我很清楚:

任何帮助将不胜感激。

我在想我应该找到一种方法来访问其中一个类:BluetoothBondStateMachine、BTConnectionReceiver、BluetoothBondStateMachine,这将是一个不错的开始,因为我可以在 logcat 中看到,每当创建配对/取消配对时,这些类都会检测到它。

连接到 ble 设备 "shine" :

0 投票
0 回答
268 浏览

java - BLE(蓝牙低功耗)无法找到另一个 BLE 设备

我正在尝试扫描另一个 BLE 设备,但没有找到另一个 BLE 设备。
相反,它扫描了 api <18 的蓝牙设备。

这是我的代码:

这些是请求的权限:

请帮我。

0 投票
2 回答
3503 浏览

android - Reacting to BLE directed advertising (ADV_DIRECT_IND) in Android

How to react to directed advertising (ADV_DIRECT_IND == 0001) in Android?

There is a BLE-gadget which sends directed advertising to an Android phone (using hardcoded MAC address of the phone for now) and in my Android app I would like to react and to initiate a connection to the gadget and read the org.bluetooth.characteristic.location_and_speed value from the gadget:

screenshot

Please advise if it's possible by the means of Android 5 API.

0 投票
1 回答
612 浏览

android - Android BLE 连接断开

我正在编写一个扫描 ble 设备的应用程序,然后在列表视图中显示结果,以便用户可以单击设备进行连接。我有两个问题。一个是当我停止扫描并连接到设备时,连接不是很好。(设备上的 LED 一直闪烁表示连接正在断开并重新连接。)我遇到的第二个问题是在某些手机上我在列表视图中获取同一设备的多个结果。在 OnLeScan() 方法中,我将找到的设备放入数组列表中,以便在扫描完成后显示。我该如何解决我的问题。我知道我正在使用旧的 APi 21+

}

0 投票
0 回答
70 浏览

android - 在android中发现不同的Service uuid

我正在尝试发现我的 ble 设备的服务。当我使用 LG l3 时,我的代码工作正常(我看到了我正在寻找的 uuid)。当我尝试三星 s4 时,我得到了不同的服务 uuid。为什么我得到不同的 uuid?