简体   繁体   English

解释iOS代码以在Android上获取Bluetooth Low Energy数据

[英]Interpreting iOS code to get Bluetooth Low Energy data on Android

I was sent iOS C code to get data from a Bluetooth Low Energy scale and I need to find out how to create similar functions into Android Java code. 我收到了iOS C代码,以从低功耗蓝牙秤获取数据,我需要了解如何在Android Java代码中创建类似的功能。

The scale I am working with aren't using typical UUIDs and formatting. 我正在使用的比例尺未使用典型的UUID和格式。

I already have a scanner set up with the ability to write and listen to notifications. 我已经设置了可以编写和收听通知的扫描程序。

What I need to do is figure out how to get the weight data. 我需要做的是弄清楚如何获取体重数据。

I know is that 0XFFF0 is the service UUID, 0XFFF1 is the write characteristic and 0XFFF4 is the notify characteristic. 我知道0XFFF0是服务UUID,0XFFF1是写特征,0XFFF4是通知特征。

I'm guessing it writes something, then the scale gives you the data. 我猜它会写一些东西,然后刻度会为您提供数据。 But I'm not sure what. 但是我不确定。

Plus I think the scale sends the data with NSUTF8StringEncoding if I'm reading it correctly. 另外,我认为如果我正确读取数据,秤会使用NSUTF8StringEncoding发送数据。 How would I implement this on Java? 我将如何在Java上实现呢?

Here is the code sent to me: 这是发送给我的代码:

http://www.anj.fyi/BTManagerlib.m (I tried to post the code here, but it's registering as spam for some odd reason) http://www.anj.fyi/BTManagerlib.m (我试图在此处发布代码,但是由于某些奇怪的原因它正在注册为垃圾邮件)

I really appreciate the help guys. 我非常感谢你们的帮助。

Many thanks. 非常感谢。

"The scale I am working with aren't using typical UUIDs and formatting." “我正在使用的比例尺没有使用典型的UUID和格式。”

Yes, it uses, except it is written in 16-bit format If you want 128-bit UUID use XXXXYYYY-0000-1000-8000-00805F9B34FB base to create it. 是的,它使用16位格式 ,但以16位格式编写。如果要使用128位UUID,请使用XXXXYYYY-0000-1000-8000-00805F9B34FB基础创建它。

From the example that you have posted: 从您发布的示例中:

-(void)writeDataToBlue:(NSNotification *)note
{
    id obj = [note object];
    _senddata = obj;
    [self sendBlueToothData:_senddata showAlert:YES];
} 

it is clear that data to be written to the device are not bundled into the source code, but they are received via notification center, from some other class. 很显然,要写入设备的数据并未捆绑到源代码中,而是通过通知中心从其他某个类接收的。 Ask them for device documentation or full source code, otherwise you won't be able to make any conclusions. 向他们询问设备文档或完整的源代码,否则您将无法得出任何结论。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM