Ethernet Class

See the Ethernet Entity for generic information.

class EthernetClass : public Acroname::BrainStem::EntityClass

EthernetClass: IP configuration. MAC info. BrainD port.

Public Functions

EthernetClass(void)

Constructor.

virtual ~EthernetClass(void)

Destructor.

void init(Module *pModule, const uint8_t index)

Initialize the Ethernet Class.

Parameters:
  • pModule – The module to which this entity belongs.

  • index – The index of the Ethernet entity to be addressed.

aErr setEnabled(const uint8_t enabled)

Sets the Ethernet’s interface to enabled/disabled.

Parameters:

enabled – 1 = enabled; 0 = disabled

Returns:

Returns common entity return values

aErr getEnabled(uint8_t *enabled)

Gets the current enable value of the Ethernet interface.

Parameters:

enabled – 1 = Fully enabled network connectivity; 0 = Ethernet MAC is disabled.

Returns:

Returns common entity return values

aErr getNetworkConfiguration(uint8_t *addressStyle)

Get the method in which IP Address is assigned to this device

Parameters:

addressStyle – Method used. Current methods

  • NONE = 0

  • STATIC = 1

  • DHCP = 2

Returns:

Returns common entity return values

aErr setNetworkConfiguration(const uint8_t addressStyle)

Get the method in which IP Address is assigned to this device

Parameters:

addressStyle – Method to use. See getNetworkConfiguration for addressStyle enumerations.

Returns:

Returns common entity return values

aErr getStaticIPv4Address(uint8_t *buffer, const size_t bufferLength, size_t *unloadedLength)

Get the expected IPv4 address of this device, when networkConfiguration == STATIC

Note

The functional IPv4 address of The Module will differ if NetworkConfiguration != STATIC.

Parameters:
  • buffer – alias to an array of uint8_t[4] for returned output

  • bufferLength – size of buffer. Should be 4.

  • unloadedLength – occupied bytes in buffer, Should be 4 post-call.

Returns:

Returns common entity return values

aErr setStaticIPv4Address(const uint8_t *buffer, const size_t bufferLength)

Set the desired IPv4 address of this device, if NetworkConfiguration == STATIC.

Parameters:
  • buffer – alias to an array of uint8_t[4] with an IP address

  • bufferLength – size of buffer. Should be 4.

Returns:

Returns common entity return values

aErr getStaticIPv4Netmask(uint8_t *buffer, const size_t bufferLength, size_t *unloadedLength)

Get the expected IPv4 netmask of this device, when networkConfiguration == STATIC

Note

The functional IPv4 netmask of The Module will differ if NetworkConfiguration != STATIC.

Parameters:
  • buffer – alias to an array of uint8_t[4] for returned output

  • bufferLength – size of buffer. Should be 4.

  • unloadedLength – occupied bytes in buffer, Should be 4 post-call.

Returns:

Returns common entity return values

aErr setStaticIPv4Netmask(const uint8_t *buffer, const size_t bufferLength)

Set the desired IPv4 address of this device, if NetworkConfiguration == STATIC

Parameters:
  • buffer – alias to an array of uint8_t[4] with an IP address

  • bufferLength – size of buffer. Should be 4.

Returns:

Returns common entity return values

aErr getStaticIPv4Gateway(uint8_t *buffer, const size_t bufferLength, size_t *unloadedLength)

Get the expected IPv4 gateway of this device, when networkConfiguration == STATIC

Parameters:
  • buffer – alias to an array of uint8_t[4] for returned output

  • bufferLength – size of buffer. Should be 4.

  • unloadedLength – occupied bytes in buffer, Should be 4 post-call.

Returns:

Returns common entity return values

aErr setStaticIPv4Gateway(const uint8_t *buffer, const size_t bufferLength)

Set the desired IPv4 gateway of this device, if NetworkConfiguration == STATIC

Parameters:
  • buffer – alias to an array of uint8_t[4] with an IP address

  • bufferLength – size of buffer. Should be 4. setStaticIPv4Gateway([192, 168, 1, 1], 4) would equate with address “192.168.1.1”

Returns:

Returns common entity return values

aErr getIPv4Address(uint8_t *buffer, const size_t bufferLength, size_t *unloadedLength)

Get the effective IP address of this device.

Parameters:
  • buffer – alias to an array of uint8_t[4] for returned output

  • bufferLength – size of buffer. Should be 4.

  • unloadedLength – occupied bytes in buffer, Should be 4 post-call.

Returns:

Returns common entity return values

aErr getIPv4Netmask(uint8_t *buffer, const size_t bufferLength, size_t *unloadedLength)

Get the effective IP netmask of this device.

Parameters:
  • buffer – alias to an array of uint8_t[4] for returned output

  • bufferLength – size of buffer. Should be 4.

  • unloadedLength – occupied bytes in buffer, Should be 4 post-call.

Returns:

Returns common entity return values

aErr getIPv4Gateway(uint8_t *buffer, const size_t bufferLength, size_t *unloadedLength)

Get the effective IP gateway of this device.

Parameters:
  • buffer – alias to an array of uint8_t[4] for returned output

  • bufferLength – size of buffer. Should be 4.

  • unloadedLength – occupied bytes in buffer, Should be 4 post-call.

Returns:

Returns common entity return values

aErr setStaticIPv4DNSAddress(const uint8_t *buffer, const size_t bufferLength)

Set IPv4 DNS Addresses (plural), if NetworkConfiguration == STATIC

Parameters:
  • buffer – alias to an array of uint8_t[N][4]

  • bufferLength – Total array length in bytes. Must be a multiple of 4.

Returns:

Returns common entity return values

aErr getStaticIPv4DNSAddress(uint8_t *buffer, const size_t bufferLength, size_t *unloadedLength)

Get IPv4 DNS addresses (plural), when NetworkConfiguration == STATIC

Parameters:
  • buffer – alias to an array of uint8_t[N][4]

  • bufferLength – Maximum length of array, in bytes.

  • unloadedLength – Length of occupied bytes of buffer, after the call.

Returns:

Returns common entity return values

aErr getIPv4DNSAddress(uint8_t *buffer, const size_t bufferLength, size_t *unloadedLength)

Get effective IPv4 DNS addresses, for the current NetworkConfiguration

Parameters:
  • buffer – alias to an array of uint8_t[N][4]

  • bufferLength – Maximum length of array, in bytes.

  • unloadedLength – Length of occupied bytes of buffer, after the call.

Returns:

Returns common entity return values

aErr setHostname(const uint8_t *buffer, const size_t bufferLength)

Set hostname that’s requested when this device sends a DHCP request.

Parameters:
  • buffer – alias to an array of uint8_t[N]

  • bufferLength – N, for N bytes.

Returns:

Returns common entity return values

aErr getHostname(uint8_t *buffer, const size_t bufferLength, size_t *unloadedLength)

Get hostname that’s requested when this device sends a DHCP request.

Parameters:
  • buffer – alias to an array of uint8_t[N]

  • bufferLength – N, for N bytes.

  • unloadedLength – Length of occupied bytes of buffer, after the call.

Returns:

Returns common entity return values

aErr getMACAddress(uint8_t *buffer, const size_t bufferLength, size_t *unloadedLength)

Get the MAC address of the Ethernet interface.

Parameters:
  • buffer – alias to an array of uint8_t[6]

  • bufferLength – length of buffer that’s writeable, should be > 6.

  • unloadedLength – Length of occupied bytes of buffer, after the call.

Returns:

Returns common entity return values

aErr setInterfacePort(const uint8_t service, const uint16_t port)

Set the port of a TCPIP service on the device.

Parameters:
  • service – The index of the service to set the port for.

  • port – The port to be used for the TCPIP server.

Returns:

Returns common entity return values

aErr getInterfacePort(const uint8_t service, uint16_t *port)

Get the port of a TCPIP service on the device.

Parameters:
  • service – The index of the service to get the port for.

  • port – The port of the TCPIP server.

Returns:

Returns common entity return values