|
esp8266ndn
NDN Arduino library for ESP8266 and more
|
Retrieve and maintain UnixTime clock. More...
#include <unix-time.hpp>
Inherits ndnph::PacketHandler.
Public Member Functions | |
| UnixTime (ndnph::Face &face) | |
| void | begin (int interval=60000) |
| Enable UnixTime requests. | |
Public Member Functions inherited from ndnph::PacketHandler | |
| PacketHandler ()=default | |
| Construct without adding to Face. | |
| PacketHandler (Face &face, int8_t prio=0) | |
| Construct and add handler to Face. | |
Private Member Functions | |
| void | loop () final |
| Override to be invoked periodically. | |
| bool | processData (ndnph::Data data) final |
| Override to receive Data packets. | |
Additional Inherited Members | |
Public Types inherited from ndnph::PacketHandler | |
| using | PacketInfo = Face::PacketInfo |
Protected Member Functions inherited from ndnph::PacketHandler | |
| virtual | ~PacketHandler () |
| Remove handler from Face. | |
| Face * | getFace () const |
| const PacketInfo * | getCurrentPacketInfo () const |
| Retrieve information about current processing packet. | |
| template<typename Packet > | |
| bool | send (Region ®ion, const Packet &packet, PacketInfo pi={}) |
| Synchronously transmit a packet. | |
| template<typename Packet , typename... PacketInfoModifier> | |
| bool | send (Region ®ion, const Packet &packet, const PacketInfoModifier &... pim) |
| Synchronously transmit a packet. | |
| template<typename Packet , typename... Arg, typename = typename std::enable_if< !std::is_base_of<Region, typename std::decay<Packet>::type>::value>::type> | |
| bool | send (const Packet &packet, Arg &&... arg) |
| Synchronously transmit a packet. | |
| template<typename... Arg> | |
| bool | reply (Arg &&... arg) |
| Synchronously transmit a packet in reply to current processing packet. | |
Retrieve and maintain UnixTime clock.
This module requires a UnixTime service running in the local network.
This module periodically retrieves the current Unix timestamp from the service, and then updates the system clock via ndnph::port::UnixTime::set function. The current Unix time is then available via ndnph::port::UnixTime::now function as well as gettimeofday() and other system functions.
This module cannot be used together with other time synchronization mechanisms such as lwip SNTP client.
|
explicit |
| void esp8266ndn::UnixTime::begin | ( | int | interval = 60000 | ) |
Enable UnixTime requests.
| interval | how often to refresh time (millis), minimum 5000ms. |
|
finalprivatevirtual |
Override to be invoked periodically.
Reimplemented from ndnph::PacketHandler.
|
finalprivatevirtual |
Override to receive Data packets.
| true | packet has been accepted by this handler. |
| false | packet is not accepted, and should go to the next handler. |
Reimplemented from ndnph::PacketHandler.