Interface
Functions for starting/stop WLAN & SoftAP interfaces. More...
Modules | |
Types | |
Network Interface Types. | |
Macros | |
Network interface specific macros. | |
Functions | |
zos_result_t | zn_network_set_credentials (zos_interface_t interface, const char *ssid, const char *password, zos_bool_t save_to_nvm) |
Set the interface's network credentials. More... | |
zos_result_t | zn_network_get_credentials (zos_interface_t interface, zos_ssid_t *ssid, zos_buffer_t *password) |
Get the interface's network credentials. More... | |
zos_result_t | zn_network_get_security (zos_interface_t interface, zos_security_t *security) |
Get the current security of the interface. More... | |
zos_result_t | zn_network_up (zos_interface_t interface, zos_bool_t block) |
Bring network interface up. More... | |
zos_result_t | zn_network_down (zos_interface_t interface) |
Bring network interface down. More... | |
zos_result_t | zn_network_restart (zos_interface_t interface) |
Restart network interface. More... | |
zos_bool_t | zn_network_is_up (zos_interface_t interface) |
Return status of network interface. More... | |
zos_bool_t | zn_network_is_permanent_down (void) |
Return if the network interface is permanently down, this occurs when the module is being rebooted. More... | |
zos_wlan_result_t | zn_network_get_wlan_join_result (void) |
Return the result of the most recent WLAN join attempt. More... | |
zos_network_status_t | zn_network_get_status (zos_interface_t interface) |
Return the current interface status. More... | |
zos_result_t | zn_network_close_all_streams (zos_interface_t interface) |
Close all data streams on specified network interface. More... | |
zos_result_t | zn_network_softap_client_list (zos_softap_client_t *client_list, uint32_t *client_count) |
Return list of SoftAP clients. More... | |
zos_result_t | zn_network_softap_deauth_client (zos_mac_t *mac, zos_deauth_reason_t reason) |
Deauthenticate SoftAP client. More... | |
zos_result_t | zn_network_register_event_handler (zos_interface_t interface, zos_network_event_handler_t handler) |
Register network event handler. More... | |
zos_result_t | zn_network_register_softap_event_handler (zos_softap_event_handler_t handler) |
Register SoftAP client event handler. More... | |
Detailed Description
Functions for starting/stop WLAN & SoftAP interfaces.
Function Documentation
zos_result_t zn_network_close_all_streams | ( | zos_interface_t | interface | ) |
Close all data streams on specified network interface.
- Parameters
-
[in] interface
zos_interface_t the interface to close all streams on
- Returns
- zos_result_t result of api call
zos_result_t zn_network_down | ( | zos_interface_t | interface | ) |
Bring network interface down.
See ZentriOS Command API documentation: network_down.
- Parameters
-
[in] interface
zos_interface_t the interface to bring down
- Returns
- zos_result_t result of api call
- Examples:
- demo/pong/link_client.c, and demo/pong/link_server.c.
zos_result_t zn_network_get_credentials | ( | zos_interface_t | interface, |
zos_ssid_t * | ssid, |
||
zos_buffer_t * | password |
||
) |
Get the interface's network credentials.
This returns the current credentials for the given network interface.
- Note
- The supplied
password
buffer should be at least 64 bytes.
- Parameters
-
[in] interface
Interface to retrieve network credentials. See zos_interface_t [out] ssid
zos_ssid_t To be populated with interface's current SSID. [out] password
To be populated with interface's current password, the supplied buffer should be at least 64 chars
- Returns
- zos_result_t result of api call
zos_result_t zn_network_get_security | ( | zos_interface_t | interface, |
zos_security_t * | security |
||
) |
Get the current security of the interface.
- Parameters
-
interface
Interface to retrieve network security security
Pointer to zos_security_t to be populated with network's security
- Returns
- zos_result_t result of api call
zos_network_status_t zn_network_get_status | ( | zos_interface_t | interface | ) |
Return the current interface status.
See zos_network_status_t for more info.
- Parameters
-
interface
Network interface, see zos_interface_t
- Returns
- Current interface status, see zos_network_status_t
zos_wlan_result_t zn_network_get_wlan_join_result | ( | void |
| ) |
Return the result of the most recent WLAN join attempt.
See zos_wlan_result_t for more info.
- Returns
- Result of last join attempt, see zos_wlan_result_t
zos_bool_t zn_network_is_permanent_down | ( | void |
| ) |
Return if the network interface is permanently down, this occurs when the module is being rebooted.
- Returns
- ZOS_TRUE if the network interface is permanently down, ZOS_FALSE else
zos_bool_t zn_network_is_up | ( | zos_interface_t | interface | ) |
Return status of network interface.
- Parameters
-
[in] interface
zos_interface_t the interface to check status of
- Returns
- ZOS_TRUE is network interface is up, ZOS_FALSE else
zos_result_t zn_network_register_event_handler | ( | zos_interface_t | interface, |
zos_network_event_handler_t | handler |
||
) |
Register network event handler.
- Note
- The event handler executes in the Zap thread context
- Parameters
-
[in] interface
zos_interface_t the interface to register handler with [in] handler
zos_network_event_handler_t to be called on network interface event
- Returns
- zos_result_t result of api call
zos_result_t zn_network_register_softap_event_handler | ( | zos_softap_event_handler_t | handler | ) |
Register SoftAP client event handler.
- Note
- The event handler executes in the Zap thread context
- Parameters
-
[in] handler
zos_softap_event_handler_t to be called on softap client event
- Returns
- zos_result_t result of api call
- Examples:
- basic/softap_tcp_server/softap_tcp_server.c, and nxp/nfc3d/local.c.
zos_result_t zn_network_restart | ( | zos_interface_t | interface | ) |
Restart network interface.
See ZentriOS Command API documentation: network_restart.
- Parameters
-
[in] interface
zos_interface_t the interface to restart
- Returns
- zos_result_t result of api call
- Examples:
- basic/display_stream/display_stream.c, basic/firmware_update/firmware_update.c, basic/ftp_upload/ftp_upload.c, basic/http_server/http_server.c, basic/http_stream/http_stream.c, basic/tcp_client/tcp_client.c, basic/udp_client/udp_client.c, basic/udp_hello_gpio/udp_hello_gpio.c, basic/websocket_server/websocket_server.c, cloud/bluemix/bluemix.c, cloud/cloud_filesystem/cloud_filesystem.c, cloud/mqttdemo/main.c, demo/accelerometer_stream/accelerometer_stream.c, demo/gps/main.c, demo/led_matrix/led_matrix.c, demo/moray3d/moray3d.c, nxp/nfc3d/local.c, nxp/nxp3d/nxp3d.c, sensors/accel_interrupt/main.c, and sensors/skink/main.c.
zos_result_t zn_network_set_credentials | ( | zos_interface_t | interface, |
const char * | ssid, |
||
const char * | password, |
||
zos_bool_t | save_to_nvm |
||
) |
Set the interface's network credentials.
This sets the network credentials for the given interface.
- Note
- If
save_to_nvm
is ZOS_FALSE, the credentials are cached in RAM only. Ifsave_to_nvm
is ZOS_TRUE, the credentials are ALSO saved to NVM. Any other currently cached settings are also saved to NVM.
- Parameters
-
[in] interface
The network interface, see zos_interface_t [in] ssid
The network name, leave NULL to clear the interface's SSID [in] password
The network password, optional, leave NULL to clear the interface's password [in] save_to_nvm
Save credentials to NVM to they persist through reboots/powercycles
- Returns
- zos_result_t result of api call
zos_result_t zn_network_softap_client_list | ( | zos_softap_client_t * | client_list, |
uint32_t * | client_count |
||
) |
Return list of SoftAP clients.
The supplied client_list argument should be a buffer large enough to hold all associated clients. e.g.
- Parameters
-
[out] client_list
Buffer containing list of associated client's information [out] client_count
Pointer to hold number of client's associated, leave NULL if unused
- Returns
- zos_result_t result of api call
- Examples:
- nxp/nfc3d/cloud_rest.c, and nxp/nfc3d/cloud_websocket.c.
zos_result_t zn_network_softap_deauth_client | ( | zos_mac_t * | mac, |
zos_deauth_reason_t | reason |
||
) |
Deauthenticate SoftAP client.
This boots a softap client of the softap network.
- Parameters
-
[in] mac
MAC address of SoftAP client [in] reason
Reason for deauthenticating client, see zos_deauth_reason_t
- Returns
- zos_result_t result of api call
zos_result_t zn_network_up | ( | zos_interface_t | interface, |
zos_bool_t | block |
||
) |
Bring network interface up.
See ZentriOS Command API documentation: network_up.
- Parameters
-
[in] interface
zos_interface_t the interface to bring up [in] block
ZOS_TRUE if API call should block until interface is brought up, ZOS_FALSE if it should return immediately
- Returns
- zos_result_t result of api call