From 279715c85e5e59154e90917329c19602c624c86c Mon Sep 17 00:00:00 2001 From: gemu2015 Date: Sun, 21 Jun 2020 16:20:14 +0200 Subject: [PATCH] ibeacon json path --- tasmota/xsns_52_ibeacon.ino | 46 +++++++++++++++++++++++++++++-------- 1 file changed, 36 insertions(+), 10 deletions(-) diff --git a/tasmota/xsns_52_ibeacon.ino b/tasmota/xsns_52_ibeacon.ino index 6a33d94a0..8efcc1b0a 100755 --- a/tasmota/xsns_52_ibeacon.ino +++ b/tasmota/xsns_52_ibeacon.ino @@ -25,7 +25,7 @@ #include -#define TMSBSIZ 256 +#define TMSBSIZ 512 #define HM17_BAUDRATE 9600 @@ -197,15 +197,32 @@ void hm17_sendcmd(uint8_t cmd) { } uint32_t ibeacon_add(struct IBEACON *ib) { +/* if (!strncmp(ib->MAJOR,"4B1C",4)) { + return 0; + } + */ + if (!strncmp(ib->RSSI,"0",1)) { + return 0; + } + // keyfob starts with ffff, ibeacon has valid facid if (!strncmp(ib->MAC,"FFFF",4) || strncmp(ib->FACID,"00000000",8)) { for (uint32_t cnt=0;cntMAC,12)) { - // exists - memcpy(ibeacons[cnt].RSSI,ib->RSSI,4); - ibeacons[cnt].TIME=0; - return 1; + if (!strncmp_P(ib->UID,PSTR("00000000000000000000000000000000"),32)) { + if (!strncmp(ibeacons[cnt].MAC,ib->MAC,12)) { + // exists + memcpy(ibeacons[cnt].RSSI,ib->RSSI,4); + ibeacons[cnt].TIME=0; + return 1; + } + } else { + if (!strncmp(ibeacons[cnt].UID,ib->UID,32)) { + // exists + memcpy(ibeacons[cnt].RSSI,ib->RSSI,4); + ibeacons[cnt].TIME=0; + return 1; + } } } } @@ -450,12 +467,15 @@ uint32_t difftime=millis()-hm17_lastms; } #ifdef USE_WEBSERVER -const char HTTP_IBEACON[] PROGMEM = +const char HTTP_IBEACON_mac[] PROGMEM = + "{s}IBEACON-MAC : %s" " - RSSI : %s" "{m}{e}"; +const char HTTP_IBEACON_uid[] PROGMEM = "{s}IBEACON-UID : %s" " - RSSI : %s" "{m}{e}"; void IBEACON_Show(void) { char mac[14]; char rssi[6]; +char uid[34]; for (uint32_t cnt=0;cnt