Skip to content

Commit 22c7601

Browse files
committed
Update doc
1 parent 49a4781 commit 22c7601

12 files changed

+381
-57
lines changed

README.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ In your sketch :
8383

8484
That's all !!!
8585

86-
Look at doc (http://bibi21000.gallet.info/index.php/fr/component/sphin
87-
xdoc/documentation/8-fullip-for-arduino/readme.html) and examples to
88-
get more informations.
86+
Look at documentation in the doc directory and examples to get more
87+
informations. You can also browse the documentation online here : http
88+
://bibi21000.gallet.info/index.php/fr/component/sphinxdoc/documentatio
89+
n/8-fullip-for-arduino/readme.html

doc/ftpclient.txt

+12-12
Original file line numberDiff line numberDiff line change
@@ -6,41 +6,41 @@ FullIP FTP Client
66
Installation
77
============
88

9-
Download and install FullIP (Look at *Installation*).
9+
Download and install FullIP (Look at "Installation instructions").
1010

1111
Uncomment #define FULLIP_SD to enable SD in FullIP.h.
1212

1313

1414
Usage
1515
=====
1616

17-
Define a variable dor the FTP client
17+
Define a variable for the FTP client :
1818

1919
FtpClient ftpclient;
2020

21-
Start the FTP client
21+
Initialize the SD and start the FTP client :
2222

23+
pinMode(PIN_SD_CS, OUTPUT);
24+
if (!SD.begin(PIN_SD_CS)) {
25+
Serial.println("SD failed :");
26+
} else {
27+
Serial.println("SD configured :)");
28+
}
2329
ftpclient.begin(server_name,user_name,password);
2430

25-
Send a file
31+
Send a file :
2632

2733
ftpclient.sendFile(filename2,local_dir,remote_dir)
2834

29-
Or retrieve one
35+
Or retrieve one :
3036

3137
ftpclient.getFile(filename2,local_dir,remote_dir)
3238

33-
And process it in your loop
39+
And process it in your loop :
3440

3541
ftpclient.maintain();
3642

3743

38-
Full example
39-
============
40-
41-
Get the full "example".
42-
43-
4444
Class definition
4545
================
4646

doc/httpserver.txt

+91-6
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,108 @@
22
FullIP HTTP Server
33
******************
44

5+
(Work in progress ...)
6+
57

68
Installation
79
============
810

9-
Download and install FullIP (Look at *Installation*).
11+
Download and install FullIP (Look at "Installation instructions").
1012

1113
Uncomment #define FULLIP_SD to enable SD in FullIP.h.
1214

1315

1416
Usage
1517
=====
1618

17-
18-
Full example
19-
============
20-
21-
Get the full "example".
19+
Create a rootdir directory on your SD and copy the html files in it
20+
21+
Define a variable for the HTTP server :
22+
23+
HttpServer http;
24+
25+
Initialize the SD ans start the HTTP server :
26+
27+
pinMode(PIN_SD_CS, OUTPUT);
28+
if (!SD.begin(PIN_SD_CS)) {
29+
Serial.println("SD failed :");
30+
} else {
31+
Serial.println("SD configured :)");
32+
}
33+
http.begin(rootdir, parseUrl, parsePage);
34+
35+
And process client connections in your loop :
36+
37+
http.maintain();
38+
39+
Define a callback function to parse the requested URL :
40+
41+
byte parseUrl(EthernetClient client, char mode[], char url[], byte state) {
42+
//Serial.print("freeMemory()=");
43+
//Serial.println(freeMemory());
44+
byte ret=0;
45+
char buffer[80];
46+
if (state==0) {
47+
urlStateMachine=0;
48+
if (strcmp_P(url,PSTR("/state"))==0) {
49+
http.printJsonHeader(200,0);
50+
strcpy_P(buffer,PSTR("{"));
51+
client.println(buffer);
52+
strcpy_P(buffer,PSTR(" rooms: ["));
53+
client.println(buffer);
54+
urlStateMachine++;
55+
ret=1;
56+
}
57+
} else if (state==1)
58+
if (strcmp_P(url,PSTR("/state"))==0) {
59+
if (urlStateMachine==1) {
60+
strcpy_P(buffer,PSTR(" {key: \"kitchen\", name: \"Cuisine\", devices: ["));
61+
client.println(buffer);
62+
sprintf_P(buffer,PSTR(" {key: \"Lampe1\", name: \"plafonnier\", state: %i},"),digitalRead(1));
63+
client.println(buffer);
64+
sprintf_P(buffer,PSTR(" {key: \"Lampe2\", name: \"applique\", state: %i}"),digitalRead(2));
65+
client.println(buffer);
66+
strcpy_P(buffer,PSTR(" ]},"));
67+
client.println(buffer);
68+
urlStateMachine++;
69+
ret=1;
70+
} else if (urlStateMachine==2) {
71+
strcpy_P(buffer,PSTR(" {key: \"bedroom\", name: \"Chambre a coucher\", devices: ["));
72+
client.println(buffer);
73+
sprintf_P(buffer,PSTR(" {key: \"Lampe1\", name: \"plafonnier\", state: %i},"),digitalRead(3));
74+
client.println(buffer);
75+
sprintf_P(buffer,PSTR(" {key: \"Lampe2\", name: \"applique\", state: %i}"),digitalRead(4));
76+
client.println(buffer);
77+
strcpy_P(buffer,PSTR(" ]},"));
78+
client.println(buffer);
79+
urlStateMachine++;
80+
ret=1;
81+
} else if (urlStateMachine==3) {
82+
strcpy_P(buffer,PSTR(" {key: \"outdoor\", name: \"Exterieur\", devices: ["));
83+
client.println(buffer);
84+
sprintf_P(buffer,PSTR(" {key: \"Lampe\", name: \"appliques\", state: %i}"),digitalRead(5));
85+
client.println(buffer);
86+
strcpy_P(buffer,PSTR(" ]}"));
87+
client.println(buffer);
88+
strcpy_P(buffer,PSTR(" ]"));
89+
client.println(buffer);
90+
strcpy_P(buffer,PSTR("}"));
91+
client.println(buffer);
92+
urlStateMachine++;
93+
ret=0;
94+
}
95+
}
96+
return ret;
97+
}
98+
99+
Define a callback function to parse the page content :
100+
101+
byte parsePage(EthernetClient client, char buffer[], int bsize)
102+
{
103+
if (strcmp_P(buffer,"/state")==0) {
104+
}
105+
return 0;
106+
}
22107

23108

24109
Class definition

doc/installation.txt

+9-4
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,20 @@ FullIP for Arduino
66

77
FullIP is a suite of ip protocols implementation for Arduino.
88

9-
* Download the library from github (https://github.com/bibi21000
10-
/arduino-fullip).
9+
* Download the library from github : https://github.com/bibi21000
10+
/arduino-fullip.
1111

12-
* Install it in your libraries in a directory called FullIP.
12+
* Install it in your libraries. Rename the directory to FullIP.
13+
14+
* If you want to use FullIP with enc28j60, install the UIPEthernet
15+
library : https://github.com/ntruchsess/arduino_uip.
16+
17+
* Restart Arduino IDE.
1318

1419
* Update FullIP.h according to your hardware :
1520

1621
* comment #define FULLIP_UIP to build with official shield (w5100)
17-
or uncomment it to build with enc28j60 and UIPEthernet
22+
or uncomment it to build with enc28j60 and UIPEthernet.
1823

1924
* comment #define FULLIP_SD to disable SD or uncomment it to build
2025
ftpclient, httpserver, ...

doc/smtpclient.txt

+5-11
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,19 @@ FullIP SMTP Client
66
Installation
77
============
88

9-
Download and install FullIP (Look at *Installation*).
9+
Download and install FullIP (Look at "Installation instructions").
1010

1111
Comment #define FULLIP_SD to disable SD in FullIP.h.
1212

1313

1414
Usage
1515
=====
1616

17-
Define a variable dor the SMTP client
17+
Define a variable for the SMTP client :
1818

1919
SmtpClient smtpclient;
2020

21-
Start the SMTP client
21+
Start the SMTP client :
2222

2323
smtpclient.begin(server_name,domain_name);
2424

@@ -32,21 +32,15 @@ using the following command in a terminal :
3232
$ perl -MMIME::Base64 -e 'print encode_base64("\000myuser\@yourisp.com\000password")'
3333
$ AG15dXNlckB5b3VyaXNwLmNvbQBwYXNzd29yZA==
3434

35-
Put a mail in the queue
35+
Put a mail in the queue :
3636

3737
smtpclient.sendMail(from,to,subject,body)
3838

39-
And send it in your loop
39+
And send it in your loop :
4040

4141
smtpclient.maintain();
4242

4343

44-
Full example
45-
============
46-
47-
Get the full "example".
48-
49-
5044
Class definition
5145
================
5246

doc/telnetserver.txt

+67-6
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,76 @@ FullIP Telnet Server
66
Installation
77
============
88

9-
Download and install FullIP (Look at *Installation*).
9+
Download and install FullIP (Look at "Installation instructions").
1010

1111
Comment #define FULLIP_SD to disable SD in FullIP.h.
1212

1313

1414
Usage
1515
=====
1616

17-
18-
Full example
19-
============
20-
21-
Get the full "example".
17+
Define a variable for the Telnet server :
18+
19+
TelnetServer telnet;
20+
21+
Start the Telnet server :
22+
23+
telnet.begin(parse);
24+
25+
And process client connections in your loop :
26+
27+
telnet.maintain();
28+
29+
Define a callback function to parse the client commands and send
30+
result to it :
31+
32+
byte parse(char buffer[]) {
33+
char buff2[4];
34+
int pin;
35+
if (strcmp_P(buffer,PSTR(""))==0) {
36+
telnet.client.println("Here is my telnet");
37+
return 1;
38+
} else if (strcmp_P(buffer,PSTR("?"))==0) {
39+
telnet.client.println("get pin XX : show the state of the pin XX");
40+
telnet.client.println("set pin XX : change the state of the pin XX");
41+
return 1;
42+
} else if (strncmp_P(buffer,PSTR("get pin "),8)==0) {
43+
buff2[0]=buffer[8];
44+
buff2[1]=buffer[9];
45+
buff2[2]='\0';
46+
pin=atoi(buff2);
47+
int val=digitalRead(pin);
48+
telnet.client.print("pin ");
49+
telnet.client.print(buff2);
50+
telnet.client.print(" : ");
51+
if (digitalRead(pin)==HIGH) {
52+
telnet.client.println("HIGH");
53+
} else {
54+
telnet.client.println("LOW");
55+
}
56+
return 1;
57+
} else if (strncmp_P(buffer,PSTR("set pin "),8)==0) {
58+
buff2[0]=buffer[8];
59+
buff2[1]=buffer[9];
60+
buff2[2]='\0';
61+
pin=atoi(buff2);
62+
int val=digitalRead(pin);
63+
telnet.client.print("pin ");
64+
telnet.client.print(buff2);
65+
telnet.client.print(" : ");
66+
if (digitalRead(pin)==HIGH) {
67+
digitalWrite(pin,LOW);
68+
telnet.client.println("LOW");
69+
} else {
70+
digitalWrite(pin,HIGH);
71+
telnet.client.println("HIGH");
72+
}
73+
return 1;
74+
}
75+
return 0;
76+
}
77+
78+
This function must return 1 if the command is recognized and 0 if not.
2279

2380

2481
Class definition
@@ -28,6 +85,10 @@ typedef uint8_t(* **telnetParseCommand**)(char[])
2885

2986
The user defined callback for parsing commands.
3087

88+
**Parameters**
89+
* "char" -
90+
: the command sent by the client
91+
3192
*class* **TelnetServer**
3293

3394
The Telnet Server.

sphinx/ftpclient.rst

+13-7
Original file line numberDiff line numberDiff line change
@@ -6,39 +6,45 @@ FullIP FTP Client
66
Installation
77
============
88

9-
Download and install FullIP (Look at :doc:`installation`).
9+
Download and install FullIP (Look at "Installation instructions").
1010

1111
Uncomment #define FULLIP_SD to enable SD in FullIP.h.
1212

1313

1414
Usage
1515
=====
1616

17-
Define a variable for the FTP client
17+
Define a variable for the FTP client :
1818

1919
.. code-block:: c
2020
2121
FtpClient ftpclient;
2222
23-
Start the FTP client
23+
Initialize the SD and start the FTP client :
2424

2525
.. code-block:: c
2626
27-
ftpclient.begin(server_name,user_name,password);
27+
pinMode(PIN_SD_CS, OUTPUT);
28+
if (!SD.begin(PIN_SD_CS)) {
29+
Serial.println("SD failed :");
30+
} else {
31+
Serial.println("SD configured :)");
32+
}
33+
ftpclient.begin(server_name,user_name,password);
2834
29-
Send a file
35+
Send a file :
3036

3137
.. code-block:: c
3238
3339
ftpclient.sendFile(filename2,local_dir,remote_dir)
3440
35-
Or retrieve one
41+
Or retrieve one :
3642

3743
.. code-block:: c
3844
3945
ftpclient.getFile(filename2,local_dir,remote_dir)
4046
41-
And process it in your loop
47+
And process it in your loop :
4248

4349
.. code-block:: c
4450

0 commit comments

Comments
 (0)