Ethernet Class¶
See the Ethernet Entity for generic information.
-
class EthernetClass : public Acroname::BrainStem2CLI::EntityClass¶
EthernetClass: IP configuration. MAC info. BrainD port.
Public Functions
-
EthernetClass()¶
Constructors.
-
~EthernetClass()¶
Destructor.
- !EthernetClass ()
Finalizer.
- void init (BrainStem2CLI::ModuleClass^ module, const unsigned char index)
Initializes the class. Should only be called when manually creating classes.
- Parameters:
pModule – The module.
index – The cmdETHERNET index to be addressed.
-
aErr setEnabled(const unsigned char enabled)¶
Sets the Ethernet’s interface to enabled/disabled.
- Parameters:
enabled – 1 = enabled; 0 = disabled
- Returns:
Returns common entity return values
-
aErr getEnabled(unsigned char %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(unsigned char %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 unsigned char 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(unsigned char %buffer, const unsigned int bufferLength, unsigned int %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 unsigned char %buffer, const unsigned int 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(unsigned char %buffer, const unsigned int bufferLength, unsigned int %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 unsigned char %buffer, const unsigned int 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(unsigned char %buffer, const unsigned int bufferLength, unsigned int %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 unsigned char %buffer, const unsigned int 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(unsigned char %buffer, const unsigned int bufferLength, unsigned int %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(unsigned char %buffer, const unsigned int bufferLength, unsigned int %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(unsigned char %buffer, const unsigned int bufferLength, unsigned int %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 unsigned char %buffer, const unsigned int 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(unsigned char %buffer, const unsigned int bufferLength, unsigned int %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(unsigned char %buffer, const unsigned int bufferLength, unsigned int %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 unsigned char %buffer, const unsigned int 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(unsigned char %buffer, const unsigned int bufferLength, unsigned int %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(unsigned char %buffer, const unsigned int bufferLength, unsigned int %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 unsigned char service, const unsigned short 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 unsigned char service, unsigned short %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
-
EthernetClass()¶