Ethernet

See the Ethernet Entity for generic information.

class brainstem.entity.Ethernet(module, index)[source]

IP configuration. MAC info. BrainD port.

getEnabled()[source]

Gets the current enable value of the Ethernet interface.

Returns:

Object containing error code and returned value on success.
errorunsigned byte

An error result from the list of defined error codes

valuebool

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

Return type:

brainstem.result.Result

getHostname(buffer_length=65536)[source]

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

Parameters:

buffer_length (unsigned int) – N, for N bytes.

Returns:

Object containing error code and returned value on success.
errorunsigned byte

An error result from the list of defined error codes

valuestring

alias to an array of uint8_t[N]

Return type:

brainstem.result.Result

getIPv4Address(buffer_length=65536)[source]

Get the effective IP address of this device.

Parameters:

buffer_length (unsigned int) – size of buffer. Should be 4.

Returns:

Object containing error code and returned value on success.
errorunsigned byte

An error result from the list of defined error codes

valuelist(unsigned char)

alias to an array of uint8_t[4] for returned output

Return type:

brainstem.result.Result

getIPv4DNSAddress(buffer_length=65536)[source]

Get effective IPv4 DNS addresses, for the current NetworkConfiguration

Parameters:

buffer_length (unsigned int) – Maximum length of array, in bytes.

Returns:

Object containing error code and returned value on success.
errorunsigned byte

An error result from the list of defined error codes

valuelist(unsigned char)

alias to an array of uint8_t[N][4]

Return type:

brainstem.result.Result

getIPv4Gateway(buffer_length=65536)[source]

Get the effective IP gateway of this device.

Parameters:

buffer_length (unsigned int) – size of buffer. Should be 4.

Returns:

Object containing error code and returned value on success.
errorunsigned byte

An error result from the list of defined error codes

valuelist(unsigned char)

alias to an array of uint8_t[4] for returned output

Return type:

brainstem.result.Result

getIPv4Netmask(buffer_length=65536)[source]

Get the effective IP netmask of this device.

Parameters:

buffer_length (unsigned int) – size of buffer. Should be 4.

Returns:

Object containing error code and returned value on success.
errorunsigned byte

An error result from the list of defined error codes

valuelist(unsigned char)

alias to an array of uint8_t[4] for returned output

Return type:

brainstem.result.Result

getInterfacePort(service)[source]

Get the port of a TCPIP service on the device.

Parameters:

service (unsigned char) – The index of the service to get the port for.

Returns:

Object containing error code and returned value on success.
errorunsigned byte

An error result from the list of defined error codes

valueunsigned short

The port of the TCPIP server.

Return type:

brainstem.result.Result

getMACAddress(buffer_length=65536)[source]

Get the MAC address of the Ethernet interface.

Parameters:

buffer_length (unsigned int) – length of buffer that’s writeable, should be > 6.

Returns:

Object containing error code and returned value on success.
errorunsigned byte

An error result from the list of defined error codes

valuelist(unsigned char)

alias to an array of uint8_t[6]

Return type:

brainstem.result.Result

getNetworkConfiguration()[source]

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

Returns:

Object containing error code and returned value on success.
errorunsigned byte

An error result from the list of defined error codes

valueunsigned char
Method used. Current methods
  • NONE = 0

  • STATIC = 1

  • DHCP = 2

Return type:

brainstem.result.Result

getStaticIPv4Address(buffer_length=65536)[source]

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

Parameters:

buffer_length (unsigned int) – size of buffer. Should be 4.

Note

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

Returns:

Object containing error code and returned value on success.
errorunsigned byte

An error result from the list of defined error codes

valuelist(unsigned char)

alias to an array of uint8_t[4] for returned output

Return type:

brainstem.result.Result

getStaticIPv4DNSAddress(buffer_length=65536)[source]

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

Parameters:

buffer_length (unsigned int) – Maximum length of array, in bytes.

Returns:

Object containing error code and returned value on success.
errorunsigned byte

An error result from the list of defined error codes

valuelist(unsigned char)

alias to an array of uint8_t[N][4]

Return type:

brainstem.result.Result

getStaticIPv4Gateway(buffer_length=65536)[source]

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

Parameters:

buffer_length (unsigned int) – size of buffer. Should be 4.

Returns:

Object containing error code and returned value on success.
errorunsigned byte

An error result from the list of defined error codes

valuelist(unsigned char)

alias to an array of uint8_t[4] for returned output

Return type:

brainstem.result.Result

getStaticIPv4Netmask(buffer_length=65536)[source]

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

Parameters:

buffer_length (unsigned int) – size of buffer. Should be 4.

Note

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

Returns:

Object containing error code and returned value on success.
errorunsigned byte

An error result from the list of defined error codes

valuelist(unsigned char)

alias to an array of uint8_t[4] for returned output

Return type:

brainstem.result.Result

setEnabled(enabled)[source]

Sets the Ethernet’s interface to enabled/disabled.

Parameters:

enabled (bool) – 1 = enabled; 0 = disabled

Returns:

An error result from the list of defined error codes in brainstem.result.Result

Return type:

unsigned byte

setHostname(buffer)[source]

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

Parameters:

buffer (string) – alias to an array of uint8_t[N]

Returns:

An error result from the list of defined error codes in brainstem.result.Result

Return type:

unsigned byte

setInterfacePort(service, port)[source]

Set the port of a TCPIP service on the device.

Parameters:
  • service (unsigned char) – The index of the service to set the port for.

  • port (unsigned short) – The port to be used for the TCPIP server.

Returns:

An error result from the list of defined error codes in brainstem.result.Result

Return type:

unsigned byte

setNetworkConfiguration(address_style)[source]

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

Parameters:

address_style (unsigned char) – Method to use. See getNetworkConfiguration for addressStyle enumerations.

Returns:

An error result from the list of defined error codes in brainstem.result.Result

Return type:

unsigned byte

setStaticIPv4Address(buffer)[source]

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

Parameters:

buffer (list(unsigned char)) – alias to an array of uint8_t[4] with an IP address

Returns:

An error result from the list of defined error codes in brainstem.result.Result

Return type:

unsigned byte

setStaticIPv4DNSAddress(buffer)[source]

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

Parameters:

buffer (list(unsigned char)) – alias to an array of uint8_t[N][4]

Returns:

An error result from the list of defined error codes in brainstem.result.Result

Return type:

unsigned byte

setStaticIPv4Gateway(buffer)[source]

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

Parameters:

buffer (list(unsigned char)) – alias to an array of uint8_t[4] with an IP address

Returns:

An error result from the list of defined error codes in brainstem.result.Result

Return type:

unsigned byte

setStaticIPv4Netmask(buffer)[source]

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

Parameters:

buffer (list(unsigned char)) – alias to an array of uint8_t[4] with an IP address

Returns:

An error result from the list of defined error codes in brainstem.result.Result

Return type:

unsigned byte