The eth32cfg_ip_t structure holds an IP address in binary form. It is used to represent IP address information in the ETH32 device configuration structure, to specify the broadcast address, and to retrieve IP address information about the PC's network interfaces.
typedef struct { unsigned char byte[4]; } eth32cfg_ip_t;
byte - Array containing individual octets of the IP address. Index 0 contains the most significant, e.g. 192 from the address 192.168.1.100
The eth32cfg_data_t structure holds all of the network configuration and device information data for a particular ETH32 device. It is provided to your application when retrieving information about detected devices. Your application can also fill in or modify the information and provide it to the API to store new configuration into a device.
typedef struct { unsigned char product_id; unsigned char firmware_major; unsigned char firmware_minor; unsigned char config_enable; unsigned char mac[8]; unsigned short serialnum_batch; unsigned short serialnum_unit; eth32cfg_ip_t config_ip; eth32cfg_ip_t config_gateway; eth32cfg_ip_t config_netmask; eth32cfg_ip_t active_ip; eth32cfg_ip_t active_gateway; eth32cfg_ip_t active_netmask; unsigned char dhcp; } eth32cfg_data_t;
product_id - Contains the product ID code for the device. This will be 105 for ETH32 devices. This makes up a portion of the serial number.
firmware_major - Contains the major portion of the firmware version, e.g. 3 from 3.000
firmware_minor - Contains the minor portion of the firmware version, e.g. 0 from 3.000
config_enable - Nonzero if the device's Allow Config switch is set to Yes
mac - The MAC address of the device. Not that this is an eight-element array. Only the first six are used, and the last two are for proper structure alignment.
serialnum_batch - The batch number portion of the device's serial number
serialnum_unit - The unit number portion of the device's serial number
config_ip - The static IP address stored in the device. This is ignored if DHCP is active.
config_gateway - The static gateway IP address stored in the device. This is ignored if DHCP is active.
config_netmask - The static network mask stored in the device. This is ignored if DHCP is active.
active_ip - The IP address being used by the device, whether it was provided by DHCP or statically configured.
active_gateway - The gateway IP address being used by the device, whether it was provided by DHCP or statically configured.
active_netmask - The network mask being used by the device, whether it was provided by DHCP or statically configured.
dhcp - Nonzero if DHCP is being used by the device, or zero if the static settings (config_ip, etc) are being used.
If a device is using DHCP, then active_ip will most likely be different than the static (stored) config_ip, and so on for the gateway and netmask. If DHCP is not being used, then active_ip will be the same as config_ip, and so on for the gateway and netmask.
When using this structure with the eth32cfg_set_config, you may modify the config_ip, config_gateway, config_netmask, and dhcp members in order to update the corresponding settings within the ETH32 device. The other members of the structure should not be modified, since they will either be ignored, or are required for the new configuration to be accepted by the device. Specifically, the MAC address and serial number information must match the device's information, or the device will ignore the new configuration data.