#ifndef _FILE_CONFIG_FILE_FORMATER_H_
#define _FILE_CONFIG_FILE_FORMATER_H_
// ****************************************************************************
// CONDITIONAL COMPILATION DIRECTIVES: Conditional compilation control
// ****************************************************************************


// ****************************************************************************
// INCLUDE FILES: Header files of modules referenced by this module
// ****************************************************************************
#include <stdint.h>


// ****************************************************************************
// MODULE DOCUMENTATION: Detailed description of the module
// ****************************************************************************


// ****************************************************************************
// PUBLIC TYPES: Public types shared with other modules
// ****************************************************************************
typedef struct  
{
    const char * ParameterName;
    const char * ParameterUnit;
    uint8_t TotalValues;
    const char * ParameterValues[16];
    uint8_t DefaultValue;
}CFFParamCfg_t;

typedef struct
{
    const char * QuantityName;
    uint8_t QuantityNumber;
}CFFQuantityCfg_t;

typedef struct
{
    const char * SensorName;
    const char * OnBoardChipName;
    uint8_t OnBoardChipNumber;
    uint8_t NumOfQuantities;
    CFFQuantityCfg_t Quantities[10];
}CFFSensorCfg_t;

typedef struct
{
    uint16_t BoardDriverNumber;
    const char * BoardName;
    uint16_t BoardNumber;
    uint8_t SensorsAssembled;
    uint16_t TotalQuantities;
    CFFSensorCfg_t SensorConfig[15];
    uint8_t TotalParameters;
    CFFParamCfg_t ParameterConfig[13];
}CFFSensorBoardCfg_t;

// ****************************************************************************
// PUBLIC MACROS: Public #define directives shared with other modules
// ****************************************************************************
#define CFF_SENSOR_BOARD_EEPROM_SIZE_BYTES (0x00001FFF)


// ****************************************************************************
// PUBLIC VARIABLES: Public variables shared with other modules
// ****************************************************************************
#define CFFstringBoard          "board"
// Quantity name strings
#define CFFstringAcc            "acc"
#define CFFstringTemp           "temp"
#define CFFstringHum			"hum"
#define CFFstringRate           "rate"
#define CFFstringRateAnalog     "rate_analog"
#define CFFstringStatus         "status"
#define CFFstringErrorType      "error_type"
#define CFFstringMagField       "magfield"
#define CFFstringMainStatus     "main_status"
#define CFFstringTempAcc        "temp_acc"
// Parameter name strings

// Parameter unit strings
#define CFFAccRangeG            "G"
#define CFFGyroRangeDpS         "d/s"
#define CFFSampleRateHz         "Hz"


// ****************************************************************************
// PUBLIC FUNCTIONS: Public functions shared with other modules
// ****************************************************************************
//---------------------------------------------------------------------
//! @brief Creates ISTP configuration file for EEPROM
//!
//! Each sensor board needs to have configuration file stored in it's
//! EEPROM memory. Configuration file is encoded in specific format.
//! All sensor board parameters specific for each board can be 
//! configured in "human readable" form in the sensorBoardCfg
//! structure. Function CFFCreateConfigFile takes the "human readable"
//! configuration and encodes it to the config file format needed
//! by ISTP system. 
//!
//! @param[in]  cfgFileSize - size of the provided buffer
//!                           for generated config file in bytes
//! @param[in]  sensorBoardCfg - sensor board configuration structure
//! @param[out] cfgFileOutput - provided buffer where the 
//!                             generated configuration file will be
//!                             stored. Buffer space is allocated by
//!                             the caller. 
//! @return size of the generated config file in bytes
//---------------------------------------------------------------------
uint16_t CFFCreateConfigFile( uint8_t * cfgFileOutput, uint16_t cfgFileSize, CFFSensorBoardCfg_t * sensorBoardCfg );

#endif /* _FILE_CONFIG_FILE_FORMATER_H_ */