Code APP3
Dependencies: mbed EthernetInterface WebSocketClient mbed-rtos BufferedSerial
Fork of APP3_Lab by
parser.cpp@5:9e6a09a38785, 2017-09-30 (annotated)
- Committer:
- Cheroukee
- Date:
- Sat Sep 30 18:36:28 2017 +0000
- Revision:
- 5:9e6a09a38785
- Parent:
- 4:ed53c87777f6
- Child:
- 6:9ed8153f1328
Fixed parser and added comments
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
JayMcGee | 4:ed53c87777f6 | 1 | #include "parser.h" |
JayMcGee | 4:ed53c87777f6 | 2 | |
Cheroukee | 5:9e6a09a38785 | 3 | char PanID[10] = {0}; |
Cheroukee | 5:9e6a09a38785 | 4 | char URL[255] = {0}; |
Cheroukee | 5:9e6a09a38785 | 5 | |
Cheroukee | 5:9e6a09a38785 | 6 | LocalFileSystem local("local"); |
Cheroukee | 5:9e6a09a38785 | 7 | |
JayMcGee | 3:a07b74f94890 | 8 | void ReadFile() |
JayMcGee | 3:a07b74f94890 | 9 | { |
JayMcGee | 4:ed53c87777f6 | 10 | Serial pc(USBTX, USBRX); // tx, rx |
Cheroukee | 5:9e6a09a38785 | 11 | FILE *fp = fopen("/local/config.txt", "r"); // Ouvrir config.txt pour lecture seulement |
JayMcGee | 3:a07b74f94890 | 12 | if(fp == NULL) |
JayMcGee | 3:a07b74f94890 | 13 | { |
JayMcGee | 4:ed53c87777f6 | 14 | pc.printf("Failed to find configuration file. \n\r"); |
JayMcGee | 3:a07b74f94890 | 15 | } |
JayMcGee | 3:a07b74f94890 | 16 | else |
JayMcGee | 3:a07b74f94890 | 17 | { |
JayMcGee | 3:a07b74f94890 | 18 | pc.printf("Config file opened. \n\r"); |
JayMcGee | 4:ed53c87777f6 | 19 | fscanf(fp,"%s",&PanID); // read PanId |
JayMcGee | 4:ed53c87777f6 | 20 | fscanf(fp,"%s",&URL); // read URL |
JayMcGee | 4:ed53c87777f6 | 21 | pc.printf("PanId : %s\r\n",PanID); // Display PanId |
JayMcGee | 4:ed53c87777f6 | 22 | pc.printf("ServeurURL : %s\r\n",URL); // Display URL |
JayMcGee | 3:a07b74f94890 | 23 | fclose(fp); |
JayMcGee | 3:a07b74f94890 | 24 | } |
JayMcGee | 3:a07b74f94890 | 25 | } |