/*
 * challenge_nvs.h
 *
 *  Created on: 08.12.2022
 *      Author: jonas
 */

#ifndef MAIN_CHALLENGE_NVS_H_
#define MAIN_CHALLENGE_NVS_H_

#include <stdbool.h>
#include <stddef.h>

/*! \brief Initialize the NVS storage. */
void Challenge_Nvs_Init(void);

/*! \brief Deinitialize the NVS storage. */
void Challenge_Nvs_Deinit(void);

/*!
* \brief Stores the passed robot mode in NVS.
* \param mode Stationary Mode to store. True = stationary mode, False = mobile mode
* \return true on success
*/
bool Challenge_Nvs_StoreRobotModeToNVS(bool mode);

/*!
 * \brief Retrieve the robot mode stored in NVS. If the robot mode is not yet stored in NVS, it will be initially stored as false.
 * \param mode Pointer to the location where to retrieve the mode to. True = stationary mode, False = mobile mode
 * \return true on success
 */
bool Challenge_Nvs_GetRobotModeFromNVS(bool *mode);

/*!
* \brief Stores the passed MQTT Broker IP in NVS.
* \param ip IP to store.
* \return true on success
*/
bool Challenge_Nvs_StoreBrokerIpToNVS(char* ip);

/*!
 * \brief Retrieve the MQTT Broker IP stored in NVS. If the Broker IP is not yet stored in NVS, it will be initially stored as "10.0.0.1".
 * \param ip Pointer to the location where to store the retrieved the IP to.
 * \param length Size of the array ip.
 * \return true on success
 */
bool Challenge_Nvs_GetBrokerIpFromNVS(char *ip, size_t length);

#endif /* MAIN_CHALLENGE_NVS_H_ */
