EtherNet/IP™ Adapter  1.04.06
User Reference Manual

◆ EI_API_ADP_setIpConfig()

uint32_t EI_API_ADP_setIpConfig ( T pAdp_p,
EIP_SConfigurationControl_t  configurationControl_p,
uint32_t  ipAddr_p,
uint32_t  netwMask_p,
uint32_t  gateway_p,
uint32_t  nameServer1_p,
uint32_t  nameServer2_p,
char *  pDomainName_p,
bool  applyChanges_p 
)

Set the IP configuration of the selected adapter (Instance Attribute ID: 3 and 5).

Function that sets the IP configuration of the adapter selected by parameter pAdp_p. The parameter dhcp_p corresponds to Instance Attribute 3 and is used to enable or disable IP configuration via the dynamic host configuration protocol.

Parameters
[in]pAdp_pPointer to the adapter.
[in]configurationControl_pConfiguration method: static, bootp (not yet supported), dhcp.
[in]ipAddr_pNew IP address.
[in]netwMask_pNew network mask.
[in]gateway_pNew gateway address.
[in]nameServer1_pNew primary name server address.
[in]nameServer2_pNew secondary name server address.
[in]pDomainName_pPointer to new domain name.
[in]applyChanges_pRewrite configuration files and applying of changes.
Returns
EI_API_ADP_EError_t as uint32_t value.
Return values
EI_API_ADP_eERR_OKSuccess.
EI_API_ADP_eERR_GENERALGeneral error.
EI_API_ADP_eERR_TCPIP_IPADDR_VALUE_INVALIDIP address value is invalid or reserved.
EI_API_ADP_eERR_TCPIP_GATEWAY_VALUE_INVALIDGateway address value is invalid or reserved.
EI_API_ADP_eERR_TCPIP_DOMAINNAME_NULL_POINTERDomain name can't to be referenced with NULL pointer.
EI_API_ADP_eERR_TCPIP_DOMAINNAME_LENGTHDomain name length is restricted to 48 bytes.
Example
#include <api/EI_API.h>
EI_API_ADP_T* pEI_API_ADP = NULL;
EIP_SConfigurationControl_t configurationControl;
uint32_t errCode;
uint8_t numInterfaces = 1;
pEI_API_ADP = EI_API_ADP_new(numInterfaces);
configurationControl.configurationMethod = EIP_eCFGMETHOD_STATIC;
configurationControl.dnsEnable = 0;
configurationControl.reserved = 0;
// Set the IP address to 192.168.1.10, netmask 255.255.255.0, gateway 192.168.1.1, no name servers and no domain name
errCode = EI_API_ADP_setIpConfig(pEI_API_ADP, configurationControl, 0xC0A8010A, 0xFFFFFF00, 0xC0A80101, 0x0, 0x0, "", false);
See also
EI_API_ADP_getIpAddr EI_API_ADP_getIpNwMask EI_API_ADP_getIpGateway EI_API_ADP_getIpPriNameServer EI_API_ADP_getIpSecNameServer EI_API_ADP_getDomainName EI_API_ADP_EError_t
EIP_SConfigurationControl_t::configurationMethod
EIP_EConfigurationMethod_t configurationMethod
Definition: EI_API_ADP.h:215
EIP_SConfigurationControl_t
Definition: EI_API_ADP.h:214
EIP_SConfigurationControl_t::dnsEnable
bool dnsEnable
Definition: EI_API_ADP.h:216
EIP_SConfigurationControl_t::reserved
uint32_t reserved
Definition: EI_API_ADP.h:217
EI_API_ADP_setIpConfig
ETHIP_API uint32_t EI_API_ADP_setIpConfig(T *pAdp_p, EIP_SConfigurationControl_t configurationControl_p, uint32_t ipAddr_p, uint32_t netwMask_p, uint32_t gateway_p, uint32_t nameServer1_p, uint32_t nameServer2_p, char *pDomainName_p, bool applyChanges)
Set the IP configuration of the selected adapter (Instance Attribute ID: 3 and 5).
Definition: EI_API_ADP_main.c:3392
EI_API_ADP_new
ETHIP_API T * EI_API_ADP_new(uint8_t numInterfaces_p)
Create a new EtherNet/IP adapter.
Definition: EI_API_ADP_main.c:235