time recv Ble

This commit is contained in:
Mit4el
2023-10-28 22:12:15 +03:00
parent eeffa8b309
commit 125684f63b
2 changed files with 25 additions and 5 deletions

View File

@@ -18,7 +18,7 @@ private:
// описание параметров передаваемых из настроек датчика из веба
String _MAC;
String _sensor;
int timeRecv;
public:
String whoIAm(/*String &mac, String &sens*/)
{
@@ -31,11 +31,11 @@ public:
{
if (_sensor == "last")
{
int valInt = extBLEdata[_sensor].as<int>();
timeRecv = extBLEdata[_sensor].as<int>();
char *s;
s = TimeToString(millis() / 1000 - valInt / 1000);
s = TimeToString(millis() / 1000 - timeRecv / 1000);
value.isDecimal = 0;
if (valInt > 0)
if (timeRecv > 0)
{
value.valS = s;
}
@@ -82,6 +82,25 @@ public:
return str;
}
void doByInterval()
{
if (_sensor == "last")
{
char *s;
s = TimeToString(millis() / 1000 - timeRecv / 1000);
value.isDecimal = 0;
if (timeRecv > 0)
{
value.valS = s;
}
else
{
value.valS = "";
}
regEvent(value.valS, _id);
}
}
BleSens(String parameters) : IoTItem(parameters)
{
_MAC = jsonReadStr(parameters, "MAC");