Code APP3

Dependencies:   mbed EthernetInterface WebSocketClient mbed-rtos BufferedSerial

Fork of APP3_Lab by Jean-Philippe Fournier

parser.cpp

Committer:
Cheroukee
Date:
2017-09-30
Revision:
5:9e6a09a38785
Parent:
4:ed53c87777f6
Child:
6:9ed8153f1328

File content as of revision 5:9e6a09a38785:

#include "parser.h"

char PanID[10] = {0};
char URL[255] = {0};

LocalFileSystem local("local");

void ReadFile()
{
    Serial pc(USBTX, USBRX); // tx, rx
    FILE *fp = fopen("/local/config.txt", "r");  // Ouvrir config.txt pour lecture seulement
    if(fp == NULL)
    {
        pc.printf("Failed to find configuration file. \n\r");
    }
    else
    {
        pc.printf("Config file opened. \n\r");
        fscanf(fp,"%s",&PanID); // read PanId
        fscanf(fp,"%s",&URL); // read URL        
        pc.printf("PanId : %s\r\n",PanID); // Display PanId
        pc.printf("ServeurURL : %s\r\n",URL); // Display URL
        fclose(fp);
    }
}