简体   繁体   English

BeaconParser 实例发布 Android 信标库

[英]BeaconParser instance issue Android beacon library

I am trying to collect temperature and humidity from beacons, that sends this raw data:我正在尝试从发送此原始数据的信标收集温度和湿度:

020106 020AFC 0A16 ABFE 70BF01 00DB00DB

where:在哪里:

0x02 – length (2 bytes)
0x01 – type (flags)
0x06 – value (BIN=00000110)

0x02 -length (2 bytes)
0x0A type («Tx Power Level»)
0xFC – value (DEC =-4)

0x0A – length (10 bytes)
0x16 - type («Service Data - 16-bit UUID»
0xABFE - UUID = FEAB
0x70 – frame type (temperature and humidity)
0xBF – TX@1m
0x01 – TX power

0x00DB – temperature (DEC=219 = 21.9 C)
0x00DB – humidity (DEC – 219= 21.9C)

I am trying to build an instance, but it looks like that it is not correct, WAIDW?我正在尝试构建一个实例,但看起来它不正确,WAIDW?

m:9-10=feab, i:11-14, p:6-6, d:14-17

Thank you for your help感谢您的帮助

Try this:尝试这个:

"s:0-1=feab,m:2-2=70,i:3-8,p:3-3,d:5-6,d:7-8"

That expression will:该表达式将:

  • match on a 16 bit service UUID 0xFEAB (which you show)匹配 16 位服务 UUID 0xFEAB(您显示的)
  • make sure the first byte after the service UUID is 0x70 (which you show).确保服务 UUID 之后的第一个字节是 0x70(您显示的)。 This will ensure it is a temp and humidity frame这将确保它是一个温度和湿度框架
  • put the full bytes of the frame into the first identifier field accessible by beacon.getId1() (this is not very useful, but you are required to have at least one identifier field for your beacon parser)将帧的完整字节放入由beacon.getId1()访问的第一个标识符字段(这不是很有用,但您的信标解析器需要至少有一个标识符字段)
  • put the raw temperature value into the first data field accessible by beacon.beacon.getDataFields().get(0)将原始温度值放入beacon.beacon.getDataFields().get(0)可访问的第一个数据字段中
  • put the raw humidity value into the second data field accessible by beacon.beacon.getDataFields().get(1)将原始湿度值放入由beacon.beacon.getDataFields().get(1)访问的第二个数据字段中

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

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