1 /* 2 * Copyright (c) 2024 Nordic Semiconductor ASA 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 #include <zephyr/net/wifi_credentials.h> 8 9 #define ENTRY_MAX_LEN sizeof(struct wifi_credentials_personal) 10 11 /** 12 * @brief Write entry to SSID cache. 13 * 14 * @param idx credential index 15 * @param buf encoded settings entry 16 * @param buf_len length of buf 17 */ 18 void wifi_credentials_cache_ssid(size_t idx, const struct wifi_credentials_header *buf); 19 20 /** 21 * @brief Clear entry in SSID cache. 22 * 23 * @param idx credential index 24 */ 25 void wifi_credentials_uncache_ssid(size_t idx); 26 27 /** 28 * @brief Stores settings entry in flash. 29 * 30 * @param idx credential index 31 * @param buf encoded settings entry 32 * @param buf_len length of buf 33 * @return 0 on success, otherwise a negative error code 34 */ 35 int wifi_credentials_store_entry(size_t idx, const void *buf, size_t buf_len); 36 37 /** 38 * @brief Deletes settings entry from flash. 39 * 40 * @param idx credential index 41 * @return 0 on success, otherwise a negative error code 42 */ 43 int wifi_credentials_delete_entry(size_t idx); 44 45 /** 46 * @brief Loads settings entry from flash. 47 * 48 * @param idx credential index 49 * @param buf encoded settings entry 50 * @param buf_len length of buf 51 * @return 0 on success, otherwise a negative error code 52 */ 53 int wifi_credentials_load_entry(size_t idx, void *buf, size_t buf_len); 54 55 /** 56 * @brief Initialize backend. 57 * @note Is called by the library on system startup. 58 * 59 */ 60 int wifi_credentials_backend_init(void); 61