1 /***************************************************************************/ /** 2 * @file 3 * @brief 4 ******************************************************************************* 5 * # License 6 * <b>Copyright 2019 Silicon Laboratories Inc. www.silabs.com</b> 7 ******************************************************************************* 8 * 9 * SPDX-License-Identifier: Zlib 10 * 11 * The licensor of this software is Silicon Laboratories Inc. 12 * 13 * This software is provided 'as-is', without any express or implied 14 * warranty. In no event will the authors be held liable for any damages 15 * arising from the use of this software. 16 * 17 * Permission is granted to anyone to use this software for any purpose, 18 * including commercial applications, and to alter it and redistribute it 19 * freely, subject to the following restrictions: 20 * 21 * 1. The origin of this software must not be misrepresented; you must not 22 * claim that you wrote the original software. If you use this software 23 * in a product, an acknowledgment in the product documentation would be 24 * appreciated but is not required. 25 * 2. Altered source versions must be plainly marked as such, and must not be 26 * misrepresented as being the original software. 27 * 3. This notice may not be removed or altered from any source distribution. 28 * 29 ******************************************************************************/ 30 #pragma once 31 32 #include "sl_net_types.h" 33 #include "sl_net_ip_types.h" 34 #include "sl_net_constants.h" 35 #include "sl_wifi_host_interface.h" 36 37 /** \addtogroup SI91X_NETWORK_FUNCTIONS 38 * \ingroup SL_SI91X_API 39 * @{ */ 40 /***************************************************************************/ 41 /** 42 * @brief 43 * Configure the IP address for the specified virtual AP. 44 * 45 * @details 46 * This function configures the IP address for the specified virtual Access Point (AP) on the Si91x device. The IP address details are provided in the `address` parameter. 47 * 48 * Virtual AP ID is used to differentiate between client and AP in concurrent mode. 49 * 50 * @param[in] address 51 * Pointer to an [sl_net_ip_configuration_t](../wiseconnect-api-reference-guide-nwk-mgmt/sl-net-ip-configuration-t) structure where the assigned IP address details will be stored. 52 * 53 * @param[in] virtual_ap_id 54 * Virtual AP ID. One of the values from @ref sl_si91x_wifi_vap_id_t. 55 * 56 * @return 57 * sl_status_t. See [Status Codes](https://docs.silabs.com/gecko-platform/latest/platform-common/status) and [Additional Status Codes](../wiseconnect-api-reference-guide-err-codes/sl-additional-status-errors) for details. 58 */ 59 sl_status_t sl_si91x_configure_ip_address(sl_net_ip_configuration_t *address, uint8_t virtual_ap_id); 60 /** @} */ 61 62 /***************************************************************************/ /** 63 * @brief 64 * Register a event handler for network events. 65 * @param[in] function 66 * Function pointer to callback. 67 * @pre Pre-conditions: 68 * - 69 * @ref sl_si91x_driver_init should be called before this API. 70 * @return 71 * sl_status_t. See https://docs.silabs.com/gecko-platform/latest/platform-common/status for details. 72 ******************************************************************************/ 73 sl_status_t sl_si91x_register_event_handler(sl_net_event_handler_t function); 74 75 /***************************************************************************/ /** 76 * @brief 77 * Default event handler for all events. 78 * @param[in] event 79 * [sl_net_event_t](../wiseconnect-api-reference-guide-nwk-mgmt/sl-net-constants#sl-net-event-t) Asynchronous event received. 80 * @param[in] buffer 81 * [sl_wifi_buffer_t](../wiseconnect-api-reference-guide-wi-fi/sl-wifi-buffer-t) Buffer containing data related to asynchronous event. 82 * @pre Pre-conditions: 83 * - 84 * @ref sl_si91x_driver_init should be called before this API. 85 * @return 86 * sl_status_t. See https://docs.silabs.com/gecko-platform/latest/platform-common/status for details. 87 ******************************************************************************/ 88 sl_status_t sl_si91x_default_handler(sl_net_event_t event, sl_wifi_buffer_t *buffer); 89 90 //! @cond Doxygen_Suppress 91 /// Enumerate multicast address command types 92 typedef enum { 93 SL_WIFI_MULTICAST_LEAVE = 0, ///< Wi-Fi multicast leave 94 SL_WIFI_MULTICAST_JOIN = 1, ///< Wi-Fi mulitcast join 95 } sl_si91x_multicast_address_command_type_t; 96 97 /// Enumerate IP configuration modes for SI91X module 98 typedef enum { 99 SL_SI91X_STATIC = 0, ///< Static 100 SL_SI91X_DHCP, ///< DHCP 101 SL_SI91X_DHCP_RESERVED, ///< DHCP Rseserved 102 SL_SI91X_DHCP_HOSTNAME, ///< DHCP HostName 103 SL_SI91X_DHCP_OPTION81, ///< DHCP option 81 104 SL_SI91X_DHCP_OPTION77 ///< DHCP option 77 105 } sl_si91x_ip_config_mode_t; 106 107 sl_status_t sl_si91x_set_credential(sl_net_credential_id_t id, 108 sl_net_credential_type_t type, 109 const void *credential, 110 uint32_t credential_length); 111 112 sl_status_t sl_si91x_delete_credential(sl_net_credential_id_t id, sl_net_credential_type_t type); 113 //! @endcond 114