IdfService.h
Go to the documentation of this file.
1 /****
2  * Sming Framework Project - Open Source framework for high efficiency native ESP8266 development.
3  * Created 2015 by Skurydin Alexey
4  * http://github.com/SmingHub/Sming
5  * All files of the Sming Core are provided under the LGPL v3 license.
6  *
7  * IdfService.h
8  *
9  ****/
10 
11 #pragma once
12 
13 #include <Platform/Ethernet.h>
14 
15 struct esp_eth_mac_s;
16 struct esp_eth_phy_s;
17 struct esp_netif_obj;
18 
19 namespace Ethernet
20 {
24 class IdfService : public Service
25 {
26 public:
28  {
29  }
30 
31  void end() override;
32  MacAddress getMacAddress() const override;
33  bool setMacAddress(const MacAddress& addr) override;
34  bool setSpeed(Ethernet::Speed speed) override;
35  bool setFullDuplex(bool enable) override;
36  bool setLinkState(bool up) override;
37  bool setPromiscuous(bool enable) override;
38  void setHostname(const String& hostname) override;
39  String getHostname() const override;
40  IpAddress getIP() const override;
41  bool setIP(IpAddress address, IpAddress netmask, IpAddress gateway) override;
42  bool isEnabledDHCP() const override;
43  bool enableDHCP(bool enable) override;
44 
45 protected:
46  void enableEventCallback(bool enable);
47  void enableGotIpCallback(bool enable);
48 
50  void* handle{nullptr};
51  esp_netif_obj* netif{nullptr};
52  void* netif_glue{nullptr};
53  esp_eth_mac_s* mac{nullptr};
54  esp_eth_phy_s* phy{nullptr};
55  Event state{Event::Disconnected};
56 };
57 
58 } // namespace Ethernet
void * handle
Definition: IdfService.h:50
esp_eth_phy_s * phy
Definition: IdfService.h:54
MacAddress getMacAddress() const override
Get MAC address.
IdfService(PhyFactory &phyFactory)
Definition: IdfService.h:27
void * netif_glue
Definition: IdfService.h:52
Event state
Definition: IdfService.h:55
esp_eth_mac_s * mac
Definition: IdfService.h:53
The String class.
Definition: WString.h:136
bool setMacAddress(const MacAddress &addr) override
Set MAC address.
void setHostname(const String &hostname) override
Set DHCP hostname.
bool setLinkState(bool up) override
Set link status of MAC.
Virtual class used to construct a specific PHY instance.
Definition: Ethernet.h:97
String getHostname() const override
Get DHCP hostname.
bool setIP(IpAddress address, IpAddress netmask, IpAddress gateway) override
Set static IP address.
bool enableDHCP(bool enable) override
Enable/disable DHCP on this interface.
bool setFullDuplex(bool enable) override
Set duplex mode of MAC.
Abstract Service class.
Definition: Ethernet.h:127
bool setPromiscuous(bool enable) override
Set MAC promiscuous mode.
Base Ethernet service for IDF SDK.
Definition: IdfService.h:24
bool setSpeed(Ethernet::Speed speed) override
Set speed of MAC.
bool isEnabledDHCP() const override
Determine if DHCP is active for this interface.
void enableEventCallback(bool enable)
void enable(Handler &commandHandler, HardwareSerial &serial)
void end() override
Tear down the ethernet connection.
Speed
Link speed.
Definition: Ethernet.h:66
A class to make it easier to handle and pass around IP addresses.
Definition: IpAddress.h:44
Event
Ethernet event codes.
Definition: Ethernet.h:34
PhyFactory & phyFactory
Definition: IdfService.h:49
void enableGotIpCallback(bool enable)
A network hardware (MAC) address.
Definition: MacAddress.h:38
Definition: Dp83848.h:15
IpAddress getIP() const override
Get current IP address.
esp_netif_obj * netif
Definition: IdfService.h:51