/******************************************************************************
 * 2016 IdeasX v0.3.1 Module Firmware
 *
 * File Name: config.h
 * Author: Tyler Berezowsky
 * Description: This file is going to need alot of help by a C wizard, but it currently works...I think.
 *
 *     2016/8/8, v1.0 created this file
*******************************************************************************/
#ifndef __CONFIG_H__
#define ___CONFIG_H__

#include "os_type.h"
#include "user_config.h"

typedef struct{
	uint32_t cfg_holder;
	uint8_t device_id[16];

	uint8_t sta_ssid[STORED_WIFI_APS][64];
	uint8_t sta_pwd[STORED_WIFI_APS][64];
	AUTH_MODE sta_type[STORED_WIFI_APS];
	uint32_t registered_stations;
	uint32_t current_station;

	uint8_t mqtt_host[64];
	uint32_t mqtt_port;
	uint8_t mqtt_user[32];
	uint8_t mqtt_pass[32];
	uint32_t mqtt_keepalive;
	uint32_t security;

	uint8_t ota_host[64];
	uint32_t ota_port;

} SYSCFG;
/*------------------------------------------------------------------------------*/
typedef struct {
    uint8 flag;
    uint8 pad[3];
} SAVE_FLAG;
/*------------------------------------------------------------------------------*/

/*------------------------------------------------------------------------------*/
// Function Prototypes
/*------------------------------------------------------------------------------*/
void ICACHE_FLASH_ATTR cfg_save();
void ICACHE_FLASH_ATTR cfg_load();
/*------------------------------------------------------------------------------*/

/*------------------------------------------------------------------------------*/
// Allocate Space for System Configuration
/*------------------------------------------------------------------------------*/
extern SYSCFG sysCfg;
/*------------------------------------------------------------------------------*/

#endif /* USER_CONFIG_H_ */