mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-27 06:32:19 +03:00
new Ble ver, 2 parts
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
#include "classes/IoTItem.h"
|
||||
#include <Arduino.h>
|
||||
#include <NimBLEDevice.h>
|
||||
#define BLE_PART1
|
||||
#define BLE_PART2
|
||||
#include <decoder.h>
|
||||
#include <vector>
|
||||
|
||||
@@ -234,23 +236,25 @@ public:
|
||||
|
||||
if (decoder.decodeBLEJson(BLEdata))
|
||||
{
|
||||
String mac_address = BLEdata["MAC"].as<const char *>();
|
||||
String mac_address = BLEdata["mac"].as<const char *>();
|
||||
if (mac_address == "")
|
||||
{
|
||||
BLEdata["MAC"] = BLEdata["id"];
|
||||
BLEdata["mac"] = BLEdata["id"];
|
||||
mac_address = BLEdata["id"].as<const char *>();
|
||||
}
|
||||
mac_address.replace(":", "");
|
||||
|
||||
BLEdata.remove("manufacturerdata");
|
||||
BLEdata.remove("servicedata");
|
||||
BLEdata.remove("type");
|
||||
BLEdata.remove("cidc");
|
||||
BLEdata.remove("acts");
|
||||
BLEdata.remove("cont");
|
||||
BLEdata.remove("track");
|
||||
BLEdata.remove("id");
|
||||
|
||||
if (_debug < 2)
|
||||
{
|
||||
BLEdata.remove("manufacturerdata");
|
||||
BLEdata.remove("servicedata");
|
||||
BLEdata.remove("type");
|
||||
BLEdata.remove("cidc");
|
||||
BLEdata.remove("acts");
|
||||
BLEdata.remove("cont");
|
||||
BLEdata.remove("track");
|
||||
BLEdata.remove("id");
|
||||
}
|
||||
// дописываем время прихода пакета данных
|
||||
BLEdata["last"] = millis();
|
||||
if (_debug)
|
||||
@@ -261,13 +265,16 @@ public:
|
||||
// {
|
||||
// String val = BLEdata.as<String>();
|
||||
String output;
|
||||
BLEdata.remove("servicedatauuid");
|
||||
if (_debug < 2)
|
||||
{
|
||||
BLEdata.remove("servicedatauuid");
|
||||
}
|
||||
serializeJson(BLEdata, output);
|
||||
SerialPrint("i", F("BLE"), mac_address + " " + output);
|
||||
//}
|
||||
}
|
||||
|
||||
SerialPrint("i", F("BLE"), "found: " + String(BLEdata["MAC"].as<const char *>()));
|
||||
SerialPrint("i", F("BLE"), "found: " + String(BLEdata["mac"].as<const char *>()));
|
||||
}
|
||||
|
||||
// Перебираем все зарегистрированные сенсоры BleSens
|
||||
|
||||
Reference in New Issue
Block a user