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:
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
Base Ethernet service for IDF SDK.
Definition: IdfService.h:25
MacAddress getMacAddress() const override
Get MAC address.
bool setMacAddress(const MacAddress &addr) override
Set MAC address.
esp_netif_obj * netif
Definition: IdfService.h:51
bool setFullDuplex(bool enable) override
Set duplex mode of MAC.
String getHostname() const override
Get DHCP hostname.
bool setLinkState(bool up) override
Set link status of MAC.
Event state
Definition: IdfService.h:55
void enableEventCallback(bool enable)
bool isEnabledDHCP() const override
Determine if DHCP is active for this interface.
esp_eth_mac_s * mac
Definition: IdfService.h:53
void setHostname(const String &hostname) override
Set DHCP hostname.
esp_eth_phy_s * phy
Definition: IdfService.h:54
bool setSpeed(Ethernet::Speed speed) override
Set speed of MAC.
void enableGotIpCallback(bool enable)
IpAddress getIP() const override
Get current IP address.
bool setIP(IpAddress address, IpAddress netmask, IpAddress gateway) override
Set static IP address.
bool enableDHCP(bool enable) override
Enable/disable DHCP on this interface.
PhyFactory & phyFactory
Definition: IdfService.h:49
IdfService(PhyFactory &phyFactory)
Definition: IdfService.h:27
void * netif_glue
Definition: IdfService.h:52
void * handle
Definition: IdfService.h:50
void end() override
Tear down the ethernet connection.
bool setPromiscuous(bool enable) override
Set MAC promiscuous mode.
Virtual class used to construct a specific PHY instance.
Definition: Ethernet.h:98
Abstract Service class.
Definition: Ethernet.h:128
A class to make it easier to handle and pass around IP addresses.
Definition: IpAddress.h:45
A network hardware (MAC) address.
Definition: MacAddress.h:39
The String class.
Definition: WString.h:137
void enable(Handler &commandHandler, HardwareSerial &serial)
Definition: Dp83848.h:16
Event
Ethernet event codes.
Definition: Ethernet.h:34
Speed
Link speed.
Definition: Ethernet.h:66