Microchip® Advanced Software Framework

config_file.c File Reference
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include "fsaccess.h"
#include "config_file.h"
#include "cptime.h"
#include "shell.h"
#include "FreeRTOS.h"
#include "semphr.h"
#include "task.h"
#include "portmacro.h"
#include "tracedump.h"
#include "compiler.h"

Functions

signed short config_file_get_value (char *filename, char *pcField, char *pcValue)
 get module config, by parsing config file. More...
 
signed short config_file_set_value (char *filename, int ac, signed char *av[])
 This function replace a (or many) line(s) in a file. More...
 

signed short config_file_get_value ( char *  filename,
char *  pcField,
char *  pcValue 
)

get module config, by parsing config file.

Parameters
filenameInput. file to read into.
pcFieldInput. field to find in file.
pcValueOutput. value read for this field, as string.
Returns
short 0 if success, -1 otherwise.

References close, fsaccess_file_get_size(), MAX_CONFIG_FILE_SIZE, NULL, O_RDONLY, open(), pvPortMalloc(), read, and vPortFree().

Referenced by b_joystick_init(), b_light_init(), b_potentiometer_init(), b_pushb1_init(), b_pushb2_init(), b_pushb3_init(), b_temperature_init(), portTASK_FUNCTION(), and prvEthernetConfigureInterface().

signed short config_file_set_value ( char *  filename,
int  ac,
signed char *  av[] 
)

This function replace a (or many) line(s) in a file.

   Syntax of the line should be :@verbatim field=value\r\n 
Parameters
filenameInput. The filename to write into.
acInput. The argument counter. For this command, should be 1.
avInput. The argument vector.
Returns
short : 0 if success or -1 else

References close, CRLF, FS_DATE_LAST_WRITE, fsaccess_file_get_size(), MAX_CONFIG_FILE_SIZE, nav_file_dateset(), NULL, O_RDONLY, O_WRONLY, open(), pcTempoDate, pvPortMalloc(), read, v_cptime_GetDateInFatStringFormat(), vPortFree(), and write.

Referenced by e_ethernet_cmd_set_config(), e_joystick_set_config(), e_light_set_config(), e_potentiometer_set_config(), e_smtpclient_cmd_set_config(), e_temperature_set_config(), e_webserver_cmd_set_config(), and prv_e_pushb_set_config().