Sets the currently selected Sealevel I/O module's network configuration.
- Parameters
-
[in] | handle | Valid handle returned by SME_Initialize(). |
[in] | ipAddress | |
[in] | netmask | |
[in] | gateway | |
- Return values
-
0 | Successful completion. |
-1 | Invalid SME_Initialize handle. |
-2 | No module selected. Call SME_SearchForModules() first. |
-3 | Invalid IP address string format. String should be in dotted notation. |
-4 | Invalid netmask string format. String should be in dotted notation. |
-5 | Invalid gateway string format. String should be in dotted notation. |
-6 | Invalid netmask. |
-7 | Invalid IP address. IP address must not be a home or broadcast address. |
-8 | Error getting current configuration. |
-9 | Error writing new configuration. |
Any of the three parameters may be NULL if that part of the network configuration should not be changed. For instance, it is possible to only adjust the netmask of the currently selected module by supplying a valid second parameter, and NULL for the first and third parameters. Likewise, it is possible to set the IP address and netmask, without affecting the gateway.
- Note
- Setting a network configuration will automatically disable DHCP configuration, if it has been enabled. Calling SM_SetDHCPConfig() prior to this function is not required.
-
This function will delete the internal list of found modules and reset the internal current module pointer, resulting in "No module selected" errors on subsequent calls to SME_ functions. SME_SearchForModules() should be called immediately after calling this function if you wish to find or configure other modules.
- Warning
- Care should be taken when setting the IP address and netmask. This method attempts to deny invalid combinations such as home and broadcast addresses, but it does not check for out of subnet addresses.
-
This function will cause the Ethernet to serial bridge to reset for a short time while the new parameters are enabled. For bridges with statically assigned IP addresses, the reset time is only momentary. However, for DHCP assigned IP addresses, the bridge will not respond until it's IP address is re-leased from the DHCP server.
Referenced by CCEthernet::set_information().