Ein Script für den automatischen Login in Wohnheimen, um das lästige Anmelden auf der Loginseite zu umgehen.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ESP8266Ping.h 1.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*
  2. ESP8266Ping - Ping library for ESP8266
  3. Copyright (c) 2015 Daniele Colanardi. All rights reserved.
  4. This library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Lesser General Public
  6. License as published by the Free Software Foundation; either
  7. version 2.1 of the License, or (at your option) any later version.
  8. This library is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public
  13. License along with this library; if not, write to the Free Software
  14. Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  15. */
  16. #ifndef ESP8266Ping_H
  17. #define ESP8266Ping_H
  18. #include <Arduino.h>
  19. #include <ESP8266WiFi.h>
  20. extern "C" {
  21. #include <ping.h>
  22. }
  23. #ifdef ENABLE_DEBUG_PING
  24. #define DEBUG_PING(...) Serial.printf(__VA_ARGS__)
  25. #else
  26. #define DEBUG_PING(...)
  27. #endif
  28. class PingClass {
  29. public:
  30. PingClass();
  31. bool ping(IPAddress dest, byte count = 5);
  32. bool ping(const char* host, byte count = 5);
  33. int averageTime();
  34. protected:
  35. static void _ping_sent_cb(void *opt, void *pdata);
  36. static void _ping_recv_cb(void *opt, void *pdata);
  37. IPAddress _dest;
  38. ping_option _options;
  39. static byte _expected_count, _errors, _success;
  40. static int _avg_time;
  41. };
  42. #include "ESP8266Ping.impl.h"
  43. PingClass Ping;
  44. #endif