Code APP3

Dependencies:   mbed EthernetInterface WebSocketClient mbed-rtos BufferedSerial

Fork of APP3_Lab by Jean-Philippe Fournier

Files at this revision

API Documentation at this revision

Comitter:
JayMcGee
Date:
Sat Sep 30 18:20:19 2017 +0000
Parent:
2:a9bb12eefc08
Child:
4:ed53c87777f6
Commit message:
Added a Parser ( Test )

Changed in this revision

parser.cpp Show annotated file Show diff for this revision Revisions of this file
parser.h Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/parser.cpp	Sat Sep 30 18:20:19 2017 +0000
@@ -0,0 +1,18 @@
+void ReadFile()
+{
+    FILE *fp = fopen("/config.txt", "r");  // Ouvrir config.txt pour lecture seulement
+    if(fp == NULL)
+    {
+        pc.printf("Failed to find configuration file. \n\r")
+        return -1;
+    }
+    else
+    {
+        pc.printf("Config file opened. \n\r");
+        fscanf(set,"%s",A); // read PanId
+        fscanf(set,"%s",B); // read URL        
+        printf(fp,"PanId : %s\r\n",A); // Display PanId
+        printf(fp,"ServeurURL : %s\r\n",B); // Display URL
+        fclose(fp);
+    }
+} 
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/parser.h	Sat Sep 30 18:20:19 2017 +0000
@@ -0,0 +1,10 @@
+/***
+*   parser.h - Lecture du fichier de configuration du coordinatuer - fouj1807 - mcgj2701
+*/
+
+#include "mbed.h"
+
+char PanID[10], URL[10];
+LocalFileSystem local("local");
+
+void ReadFile();