модуль Ping

This commit is contained in:
Mit4el
2024-03-12 00:11:45 +03:00
parent ab0d5f40e2
commit d2865118f4
3 changed files with 12 additions and 15 deletions

View File

@@ -97,7 +97,7 @@ private:
int data_size = 0;
int count = 0;
int tos = 0;
int ttl = 0;
// int ttl = 0; //Есть только в новых версиях framwork ПОКА УБРАЛ
public:
PingIoTM(String parameters) : IoTItem(parameters)
@@ -108,7 +108,7 @@ public:
jsonRead(parameters, "data_size", data_size);
jsonRead(parameters, "count", count);
jsonRead(parameters, "tos", tos);
jsonRead(parameters, "ttl", ttl);
// jsonRead(parameters, "ttl", ttl);
#ifdef ESP32
/*
@@ -130,18 +130,18 @@ public:
config.count = (uint32_t)(count);
if (tos > 0)
config.tos = (uint32_t)(tos);
if (ttl > 0)
config.ttl = (uint32_t)(ttl);
// if (ttl > 0)
// config.ttl = (uint32_t)(ttl);
#endif
}
/*
void doByInterval()
{
#ifdef ESP8266
regEvent((float)Ping.ping(_ip.c_str()), "ping");
#endif
}
*/
// Основной цикл программы
void loop()
{
@@ -216,7 +216,7 @@ public:
SerialPrint("I", "Ping", "Ping success");
else
SerialPrint("E", "Ping", "Ping error");
regEvent(val, "ping");
regEvent(val.valD, "ping");
return val;
}
#endif

View File

@@ -17,8 +17,7 @@
"interval": 1,
"data_size": 0,
"count": 0,
"tos": 0,
"ttl": 0
"tos": 0
}
],
@@ -28,7 +27,7 @@
"authorGit": "https://github.com/Mit4el",
"specialThanks": "",
"moduleName": "Ping",
"moduleVersion": "1.0",
"moduleVersion": "1.2",
"usedRam": {
"esp32_4mb": 15,
"esp8266_4mb": 15
@@ -41,13 +40,12 @@
"interval": "Интервал. Только для ESP32. Если 0, то пингует со значением по умолчанию",
"data_size": "Размер пакета. Только для ESP32. Если 0, то пингует со значением по умолчанию",
"count": "Количество пакетов. Только для ESP32. Если 0, то пингует со значением по умолчанию",
"tos": "Type Of Service. Только для ESP32. Если 0, то пингует со значением по умолчанию",
"ttl": "Time To Live. Только для ESP32. Если 0, то пингует со значением по умолчанию"
"tos": "Type Of Service. Только для ESP32. Если 0, то пингует со значением по умолчанию"
},
"funcInfo": [
{
"name": "ping",
"descr": "проверить пинг вручную из сценария",
"descr": "Проверить пинг. после вызова данной функции из сценария результат будет в значении самого модуля. if ping21==1 then ЕСТЬ_пинг else НЕТ_пинга",
"params": [
"IP адрес или имя хоста"
]

View File

@@ -43,8 +43,7 @@
"interval": 1,
"data_size": 0,
"count": 0,
"tos": 0,
"ttl": 0
"tos": 0
}
]
}