The Documentation is provided for Network Utility functions used by the LPA application to demonstrate the Low power functionality.
|
int32_t | cylpa_register_suspend_notify_callback (cylpa_suspend_callback_t callback, void *user_data) |
| Registers suspend notify callback. More...
|
|
int32_t | wait_net_suspend (void *net_intf, uint32_t wait_ms, uint32_t inactive_interval_ms, uint32_t inactive_window_ms) |
| Network Monitor Function. More...
|
|
int | cy_tcp_create_socket_connection (void *net_intf, void **socket_handle, const char *remote_ip, uint16_t remote_port, uint16_t local_port, cy_tko_ol_cfg_t *downloaded, int socket_keepalive_enable) |
| Creates TCP Socket connection. More...
|
|
int | cylpa_restart_olm (ol_desc_t *offload_list, void *net_intf) |
| Restarts OLM. More...
|
|
ol_desc_t * | cylpa_find_my_descriptor (const char *name, ol_desc_t *offload_list) |
| Finds OLM descriptor for a given name. More...
|
|
int | cylpa_tko_ol_update_config (const char *remote_ip, uint16_t remote_port, uint16_t local_port, cy_tko_ol_cfg_t *cfg) |
| Configure the user provided TCP keep alive parameters to LPA middleware. More...
|
|
int | cylpa_tlsoe_ol_update_config (int index, cy_tlsoe_ol_cfg_t *cfg, void *socket) |
| Update TLS configuration parameters and socket handle to LPA TLS database. More...
|
|
int | cylpa_tlsoe_ol_set_socket_config (int index, uint16_t local_port, uint16_t remote_port, uint32_t *remote_ip, uint16_t interval) |
| configure the TLS connection parameters like local and peer port, peer IP and keepalive interval. More...
|
|
◆ cylpa_suspend_callback_t
typedef void(* cylpa_suspend_callback_t) (cylpa_notify_event_type_t notify_type, void *arg) |
Application callback function.
This LPA callback function is used for notification of network stack suspend to the application.
- Parameters
-
notify_type | : notify event type |
*arg | : pointer to WLAN interface |
◆ cylpa_register_suspend_notify_callback()
Registers suspend notify callback.
- Parameters
-
*callback | : Application callback function which needs to be called on network suspend. |
*user_data | : Pointer to user data to be passed in the event callback. |
- Returns
- int32_t : CY_RSLT_SUCCESS on success, otherwise it returns error.
◆ wait_net_suspend()
int32_t wait_net_suspend |
( |
void * |
net_intf, |
|
|
uint32_t |
wait_ms, |
|
|
uint32_t |
inactive_interval_ms, |
|
|
uint32_t |
inactive_window_ms |
|
) |
| |
Network Monitor Function.
In this function the network is monitored for inactivity in an interval of length inactive_interval_ms. If the network is inactive for a continuous duration specified by inactive_window_ms, the TCP/IP network stack is suspended and stays suspended until either there is emac activity or a duration of wait_ms has expired. Network stack is resumed on either detecting emac activity or if wait_ms time has elapsed.
- Parameters
-
*net_intf | : pointer to WLAN interface |
wait_ms | : The interval for which the network is monitored for activity. Network stack is resumed ether at the end of wait_ms or on emac activity. |
inactive_interval_ms | : The interval for which the network is monitored for inactivity. |
inactive_window_ms | : The continuous duration for which network has to be inactive in inactive_interval_ms. |
- Returns
- int32_t : Returns status on one of these cases: Network error status if the network stack suspension failed or EMAC activity status as a result of network inactivity monitor.
◆ cy_tcp_create_socket_connection()
int cy_tcp_create_socket_connection |
( |
void * |
net_intf, |
|
|
void ** |
socket_handle, |
|
|
const char * |
remote_ip, |
|
|
uint16_t |
remote_port, |
|
|
uint16_t |
local_port, |
|
|
cy_tko_ol_cfg_t * |
downloaded, |
|
|
int |
socket_keepalive_enable |
|
) |
| |
Creates TCP Socket connection.
This function can be used as reference to create tcp socket connection to provided remote ip address, remote port, local port and the tcp socket handle is returned in *socket_handle
- Parameters
-
net_intf | : Pointer to WLAN interface |
socket_handle | : Pointer to an Array of TCP Socket Handle which is populated by this API |
remote_ip | : Pointer to Remote TCP IP Address |
remote_port | : Pointer to Remote TCP IP Port number |
local_port | : Pointer to Local TCP IP Port number |
downloaded | : Pointer to TKO offload list |
socket_keepalive_enable | : Host TCP Keepalive enable 1 or 0 disable. |
- Returns
- int : Returns CY_RSLT_SUCCESS if the TCP socket connection is successful, otherwise it returns a socket error status
◆ cylpa_restart_olm()
int cylpa_restart_olm |
( |
ol_desc_t * |
offload_list, |
|
|
void * |
net_intf |
|
) |
| |
Restarts OLM.
This function restarts OLM manager with configuration passed by the caller.
- Note
- : This API should only be invoked when device is not connected to AP, if it is connected to an AP then it has to do disconnect first and then invoke this API
- Parameters
-
offload_list | : Pointer to the user defined configuration list ol_desc_t |
net_intf | : Pointer to WLAN interface |
- Returns
- int : Returns CY_RSLT_SUCCESS if the restart is successful, otherwise it returns error.
Restarts OLM.
◆ cylpa_find_my_descriptor()
Finds OLM descriptor for a given name.
This function finds the OLM descriptor for a given name passed by the caller in a OLM descriptor list.
- Parameters
-
name | : Pointer to the string name of OLM descriptor |
offload_list | : OLM descriptor list |
- Returns
- ol_desc_t : Returns OLM descriptor matching the name, otherwise it returns NULL
◆ cylpa_tko_ol_update_config()
int cylpa_tko_ol_update_config |
( |
const char * |
remote_ip, |
|
|
uint16_t |
remote_port, |
|
|
uint16_t |
local_port, |
|
|
cy_tko_ol_cfg_t * |
cfg |
|
) |
| |
Configure the user provided TCP keep alive parameters to LPA middleware.
- Parameters
-
[in] | remote_ip | Pointer to the destination IP address. |
[in] | remote_port | Destination port number. |
[in] | local_port | Source port number. |
[in] | cfg | Structure containing user provided parameters. |
- Returns
- 0 on success; negative on failure.
◆ cylpa_tlsoe_ol_update_config()
int cylpa_tlsoe_ol_update_config |
( |
int |
index, |
|
|
cy_tlsoe_ol_cfg_t * |
cfg, |
|
|
void * |
socket |
|
) |
| |
Update TLS configuration parameters and socket handle to LPA TLS database.
- Parameters
-
[in] | index | Index of MQTT connection. |
[in] | cfg | Pointer to the structure containing the TLS configuration parameters. |
[in] | socket | Pointer to the socket handle used for MQTT connection. |
- Returns
- 0 on success; negative on failure.
◆ cylpa_tlsoe_ol_set_socket_config()
int cylpa_tlsoe_ol_set_socket_config |
( |
int |
index, |
|
|
uint16_t |
local_port, |
|
|
uint16_t |
remote_port, |
|
|
uint32_t * |
remote_ip, |
|
|
uint16_t |
interval |
|
) |
| |
configure the TLS connection parameters like local and peer port, peer IP and keepalive interval.
- Parameters
-
[in] | index | Index of MQTT connection. |
[in] | local_port | Source port number. |
[in] | remote_port | Destination port number. |
[in] | remote_ip | Pointer to the destination IP address. |
[in] | interval | Keep alive connection interval. |
- Returns
- 0 on success; negative on failure.