Interface

Functions for starting/stop WLAN & SoftAP interfaces. More...

Modules

Types
Network Interface Types.
 
Macros
Network interface specific macros.
 

Functions

gos_result_t gos_network_set_credentials (gos_interface_t interface, const char *ssid, const char *password, bool save_to_nvm)
 Set the interface's network credentials. More...
 
gos_result_t gos_network_get_credentials (gos_interface_t interface, gos_ssid_t *ssid, gos_buffer_t *password)
 Get the interface's network credentials. More...
 
gos_result_t gos_network_get_security (gos_interface_t interface, gos_security_t *security_ptr)
 Get the current security of the interface. More...
 
gos_result_t gos_network_up (gos_interface_t interface, bool block)
 Bring network interface up. More...
 
gos_result_t gos_network_down (gos_interface_t interface)
 Bring network interface down. More...
 
gos_result_t gos_network_restart (gos_interface_t interface)
 Restart network interface. More...
 
bool gos_network_is_up (gos_interface_t interface)
 Return status of network interface. More...
 
bool gos_network_is_permanent_down (void)
 Return if the network interface is permanently down, this occurs when the module is being rebooted. More...
 
gos_interface_t gos_network_get_default_interface (void)
 Return the currently active default network interface. More...
 
gos_result_t gos_network_set_default_interface (gos_interface_t interface)
 Set the default network interface. More...
 
gos_wlan_result_t gos_network_get_wlan_join_result (void)
 Return the result of the most recent WLAN join attempt. More...
 
const char * gos_network_get_wlan_join_result_str (void)
 Return the result string of the most recent WLAN join attempt. More...
 
gos_network_status_t gos_network_get_status (gos_interface_t interface)
 Return the current interface status. More...
 
gos_result_t gos_network_close_all_streams (gos_interface_t interface)
 Close all data streams on specified network interface. More...
 
gos_result_t gos_network_softap_client_list (gos_softap_client_t *client_list, uint32_t *client_count)
 Return list of SoftAP clients. More...
 
gos_result_t gos_network_softap_deauth_client (gos_mac_t *mac, gos_deauth_reason_t reason)
 Deauthenticate SoftAP client. More...
 
gos_result_t gos_network_register_event_handler (gos_interface_t interface, gos_network_handler_t handler)
 Register network event handler. More...
 
gos_result_t gos_network_register_softap_event_handler (gos_softap_event_handler_t handler)
 Register SoftAP client event handler. More...
 
void gos_network_set_softap_domain_list (const char *domain_list)
 Set list of domain names DNS server will resolve. More...
 

Detailed Description

Functions for starting/stop WLAN & SoftAP interfaces.

Function Documentation

◆ gos_network_close_all_streams()

gos_result_t gos_network_close_all_streams ( gos_interface_t  interface)

Close all data streams on specified network interface.

Parameters
[in]interfacegos_interface_t the interface to close all streams on
Returns
gos_result_t result of api call

◆ gos_network_down()

gos_result_t gos_network_down ( gos_interface_t  interface)

Bring network interface down.

See Gecko OS Command API documentation: network_down.

Parameters
[in]interfacegos_interface_t the interface to bring down
Returns
gos_result_t result of api call
Examples:
utility/profiler/main.c.

◆ gos_network_get_credentials()

gos_result_t gos_network_get_credentials ( gos_interface_t  interface,
gos_ssid_t ssid,
gos_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]interfaceInterface to retrieve network credentials. See gos_interface_t
[out]ssidgos_ssid_t To be populated with interface's current SSID.
[out]passwordTo be populated with interface's current password, the supplied buffer should be at least 64 chars
Returns
gos_result_t result of api call

◆ gos_network_get_default_interface()

gos_interface_t gos_network_get_default_interface ( void  )

◆ gos_network_get_security()

gos_result_t gos_network_get_security ( gos_interface_t  interface,
gos_security_t security_ptr 
)

Get the current security of the interface.

Parameters
interfaceInterface to retrieve network security
security_ptrPointer to gos_security_t to be populated with network's security
Returns
gos_result_t result of api call

◆ gos_network_get_status()

gos_network_status_t gos_network_get_status ( gos_interface_t  interface)

Return the current interface status.

See gos_network_status_t for more info.

Parameters
interfaceNetwork interface, see gos_interface_t
Returns
Current interface status, see gos_network_status_t

◆ gos_network_get_wlan_join_result()

gos_wlan_result_t gos_network_get_wlan_join_result ( void  )

Return the result of the most recent WLAN join attempt.

See gos_wlan_result_t for more info.

Returns
Result of last join attempt, see gos_wlan_result_t
Examples:
hurricane/security_camera/main.c, and wifi/web_setup/main.c.

◆ gos_network_get_wlan_join_result_str()

const char* gos_network_get_wlan_join_result_str ( void  )

Return the result string of the most recent WLAN join attempt.

See gos_wlan_result_t for more info.

Returns
Result of last join attempt as string, see gos_wlan_result_t

◆ gos_network_is_permanent_down()

bool gos_network_is_permanent_down ( void  )

Return if the network interface is permanently down, this occurs when the module is being rebooted.

Returns
true if the network interface is permanently down, false else

◆ gos_network_is_up()

bool gos_network_is_up ( gos_interface_t  interface)

Return status of network interface.

Parameters
[in]interfacegos_interface_t the interface to check status of
Returns
true is network interface is up, false else
Examples:
cloud/coap_demo/main.c, hurricane/security_camera/main.c, network/tcp_client/main.c, network/uart_tcp_client/main.c, network/udp_client/main.c, network/websocket_client/main.c, and wifi/device_setup/main.c.

◆ gos_network_register_event_handler()

gos_result_t gos_network_register_event_handler ( gos_interface_t  interface,
gos_network_handler_t  handler 
)

Register network event handler.

Note
The event handler executes in the app thread context
Parameters
[in]interfacegos_interface_t the interface to register handler with
[in]handlergos_network_handler_t to be called on network interface event
Returns
gos_result_t result of api call
Examples:
demo/3d_demo/main.c, demo/accelerometer_stream/main.c, hurricane/security_camera/main.c, utility/profiler/main.c, wifi/device_setup/main.c, and wifi/web_setup/main.c.

◆ gos_network_register_softap_event_handler()

gos_result_t gos_network_register_softap_event_handler ( gos_softap_event_handler_t  handler)

Register SoftAP client event handler.

Note
The event handler executes in the app thread context
Parameters
[in]handlergos_softap_event_handler_t to be called on softap client event
Returns
gos_result_t result of api call
Examples:
network/softap_tcp_server/main.c.

◆ gos_network_restart()

gos_result_t gos_network_restart ( gos_interface_t  interface)

Restart network interface.

See Gecko OS Command API documentation: network_restart.

Parameters
[in]interfacegos_interface_t the interface to restart
Returns
gos_result_t result of api call
Examples:
cloud/coap_demo/main.c.

◆ gos_network_set_credentials()

gos_result_t gos_network_set_credentials ( gos_interface_t  interface,
const char *  ssid,
const char *  password,
bool  save_to_nvm 
)

Set the interface's network credentials.

This sets the network credentials for the given interface.

Note
If save_to_nvm is false, the credentials are cached in RAM only. If save_to_nvm is true, the credentials are ALSO saved to NVM. Any other currently cached settings are also saved to NVM.
Parameters
[in]interfaceThe network interface, see gos_interface_t
[in]ssidThe network name, leave NULL to clear the interface's SSID
[in]passwordThe network password, optional, leave NULL to clear the interface's password
[in]save_to_nvmSave credentials to NVM to they persist through reboots/powercycles
Returns
gos_result_t result of api call

◆ gos_network_set_default_interface()

gos_result_t gos_network_set_default_interface ( gos_interface_t  interface)

Set the default network interface.

Note
The default interface will NOT update until the previous default interface is brought down.
Returns
gos_result_t result of api call

◆ gos_network_set_softap_domain_list()

void gos_network_set_softap_domain_list ( const char *  domain_list)

Set list of domain names DNS server will resolve.

This set a list of domain names the SoftAP's DNS server will resolve. The specified list overrides the Gecko OS setting: softap.dns_server.url

Parameters
[in]domain_listComma seperated list of domain names

◆ gos_network_softap_client_list()

gos_result_t gos_network_softap_client_list ( gos_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.

gos_softap_client_t client_list[GOS_MAX_SOFTAP_CLIENTS];
Parameters
[out]client_listBuffer containing list of associated client's information
[out]client_countPointer to hold number of client's associated, leave NULL if unused
Returns
gos_result_t result of api call

◆ gos_network_softap_deauth_client()

gos_result_t gos_network_softap_deauth_client ( gos_mac_t mac,
gos_deauth_reason_t  reason 
)

Deauthenticate SoftAP client.

This boots a softap client of the softap network.

Parameters
[in]macMAC address of SoftAP client
[in]reasonReason for deauthenticating client, see gos_deauth_reason_t
Returns
gos_result_t result of api call

◆ gos_network_up()

gos_result_t gos_network_up ( gos_interface_t  interface,
bool  block 
)

Bring network interface up.

See Gecko OS Command API documentation: network_up.

Parameters
[in]interfacegos_interface_t the interface to bring up
[in]blocktrue if API call should block until interface is brought up, false if it should return immediately
Returns
gos_result_t result of api call
Examples:
demo/3d_demo/main.c, demo/accelerometer_stream/main.c, hurricane/security_camera/main.c, network/softap_tcp_server/main.c, network/tcp_client/main.c, network/uart_tcp_client/main.c, network/udp_client/main.c, network/websocket_client/main.c, utility/profiler/main.c, and wifi/device_setup/main.c.