Skip to content

Commit a8084c4

Browse files
committed
2018.11.09. / official release
- SPPC(Serial Phpoc Procedure Call) support - spi protocol v2 support - new class : Sppc - new member functions . PhpocClient : command, avaiableForWrite . PhpocServer : beginWebSocketText, beginWebSocketBinary - Phpoc . begin boot wait support (500ms) . clear smtp MSA in begin() . cache v2 support : NetCache - PhpocServer . WebSocket path table support . beginWebSocket : remove path argument default value (NULL) . new beginWebSocket argument : proto . proto setup bug fix . add 'connected' log message - PhpocClient . SSL "method client" support . new static/public flags : client.conn_flags, client.init_flags - PhpocEmail : tcp0 busy bug fix ("tcp0 ioctl close" => "tcp0 close") - remove SSL/SSH server - new library metadata : includes=Phpoc.h - new boot log : product name, firmware/package version - examples . add new comments & tutorial URL . new example URL : example.phpoc.com/asciilogo.txt . new example URL : example.phpoc.com/remote_add . new examples : WebSerialPlotter, WebRemotePad
1 parent 3b9f193 commit a8084c4

34 files changed

+3458
-1828
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ Available Examples
88
* DateTime
99
* EmailClient
1010
* GmailClient
11-
* SSHServer
12-
* SSLServer
1311
* TelnetServer
1412
* WebClient
1513
* WebClientIPv6
14+
* WebRemotePad
1615
* WebRemotePush
1716
* WebRemoteSlide
17+
* WebSerialPlotter
1818
* WebSSLClient
1919
* WebSSLClientIPv6
2020

examples/ChatServer/ChatServer.ino

+25-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,23 @@
1-
/* arduino chat server - 4 listening sessions */
1+
// Arduino Chat Server - 4 Listening Sessions
2+
//
3+
// PHPoC Shield and PHPoC WiFi Shield are Internet Shields for Arduino Uno and
4+
// Mega.
5+
//
6+
// This is an example of using Arduino Uno/Mega and PHPoC [WiFi] Shield to
7+
// create a TCP server that can connect up to 4 TCP clients simultaneously. It
8+
// distributes any incoming messages to all connected clients. The incoming
9+
// messages are also printed to the serial monitor.
10+
//
11+
// Arduino communicates with PHPoC [WiFi] Shield via pins 10, 11, 12 and 13 on
12+
// the Uno, and pins 10, 50, 51 and 52 on the Mega. Therefore, these pins CANNOT
13+
// be used for general I/O.
14+
//
15+
// This example code was written by Sollae Systems. It is released into the
16+
// public domain.
17+
//
18+
// Tutorial for the example is available here:
19+
// https://forum.phpoc.com/articles/tutorials/1232-arduino-tcp-chat-server
220

3-
#include <SPI.h>
421
#include <Phpoc.h>
522

623
PhpocServer server(23);
@@ -11,13 +28,16 @@ void setup() {
1128
while(!Serial)
1229
;
1330

31+
// initialize PHPoC [WiFi] Shield:
1432
Phpoc.begin(PF_LOG_SPI | PF_LOG_NET);
1533
//Phpoc.begin();
1634

35+
// start listening for TCP clients:
1736
server.begin();
1837

38+
// print IP address of PHPoC [WiFi] Shield to serial monitor:
1939
Serial.print("Chat server address : ");
20-
Serial.println(Phpoc.localIP());
40+
Serial.println(Phpoc.localIP());
2141
}
2242

2343
void loop() {
@@ -37,10 +57,10 @@ void loop() {
3757
if (client.available() > 0) {
3858
// read the bytes incoming from the client:
3959
char thisChar = client.read();
40-
// echo the bytes back to the client:
60+
// echo the bytes back to all connected clients:
4161
server.write(thisChar);
4262
// echo the bytes to the server as well:
4363
Serial.write(thisChar);
4464
}
4565
}
46-
}
66+
}

examples/ChatServerIPv6/ChatServerIPv6.ino

+28-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,23 @@
1-
/* arduino IPv4 & IPv6 dual stack chat server - 4 listening sessions */
1+
// Arduino IPv4 & IPv6 Dual Stack Chat Server - 4 Listening Sessions
2+
//
3+
// PHPoC Shield and PHPoC WiFi Shield are Internet Shields for Arduino Uno and
4+
// Mega.
5+
//
6+
// This is an example of using Arduino Uno/Mega and PHPoC [WiFi] Shield to
7+
// create a TCP server that can connect up to 4 TCP clients simultaneously using
8+
// IPv6. It distributes any incoming messages to all connected clients. The
9+
// incoming messages are also printed to the serial monitor.
10+
//
11+
// Arduino communicates with PHPoC [WiFi] Shield via pins 10, 11, 12 and 13 on
12+
// the Uno, and pins 10, 50, 51 and 52 on the Mega. Therefore, these pins CANNOT
13+
// be used for general I/O.
14+
//
15+
// This example code was written by Sollae Systems. It is released into the
16+
// public domain.
17+
//
18+
// Tutorial for the example is available here:
19+
// https://forum.phpoc.com/articles/tutorials/1233-arduino-tcp-ipv6-chat-server
220

3-
#include <SPI.h>
421
#include <Phpoc.h>
522

623
PhpocServer server(23);
@@ -11,19 +28,23 @@ void setup() {
1128
while(!Serial)
1229
;
1330

31+
// initialize PHPoC [WiFi] Shield:
1432
Phpoc.begin(PF_LOG_SPI | PF_LOG_NET);
1533
//Phpoc.begin();
1634

35+
// initialize IPv6:
1736
Phpoc.beginIP6();
1837

38+
// start listening for TCP clients:
1939
server.begin();
2040

41+
// print IP address of PHPoC [WiFi] Shield to serial monitor:
2142
Serial.print("Chat server address : ");
22-
Serial.print(Phpoc.localIP());
43+
Serial.print(Phpoc.localIP());
2344
Serial.print(' ');
24-
Serial.print(Phpoc.localIP6());
45+
Serial.print(Phpoc.localIP6());
2546
Serial.print(' ');
26-
Serial.print(Phpoc.globalIP6());
47+
Serial.print(Phpoc.globalIP6());
2748
Serial.println();
2849
}
2950

@@ -44,10 +65,10 @@ void loop() {
4465
if (client.available() > 0) {
4566
// read the bytes incoming from the client:
4667
char thisChar = client.read();
47-
// echo the bytes back to the client:
68+
// echo the bytes back to all connected clients:
4869
server.write(thisChar);
4970
// echo the bytes to the server as well:
5071
Serial.write(thisChar);
5172
}
5273
}
53-
}
74+
}

examples/DateTime/DateTime.ino

+30-10
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,24 @@
1-
/* arduino RTC date & time test */
1+
// Arduino RTC Date & Time Test
2+
//
3+
// PHPoC Shield and PHPoC WiFi Shield are Internet Shields for Arduino Uno and
4+
// Mega.
5+
//
6+
// PHPoC [WiFi] Shield has a built-in rechargeable battery and RTC that allow to
7+
// keep date and time information even when power is down.
8+
//
9+
// This is an example of using Arduino Uno/Mega to get date and time information
10+
// from RTC on PHPoC [WiFi] Shield and print it to serial monitor.
11+
//
12+
// Arduino communicates with PHPoC [WiFi] Shield via pins 10, 11, 12 and 13 on
13+
// the Uno, and pins 10, 50, 51 and 52 on the Mega. Therefore, these pins CANNOT
14+
// be used for general I/O.
15+
//
16+
// This example code was written by Sollae Systems. It is released into the
17+
// public domain.
18+
//
19+
// Tutorial for the example is available here:
20+
// https://forum.phpoc.com/articles/tutorials/1244-arduino-date-and-time
221

3-
#include <SPI.h>
422
#include <Phpoc.h>
523

624
PhpocDateTime datetime;
@@ -9,30 +27,32 @@ void setup() {
927
Serial.begin(9600);
1028
while(!Serial)
1129
;
12-
13-
Phpoc.begin();
14-
30+
31+
// initialize PHPoC [WiFi] Shield:
32+
Phpoc.begin(PF_LOG_SPI | PF_LOG_NET);
33+
1534
Serial.println("Get year/month/day/dayofWeek/hour/minute/second from RTC in PHPoC Shield");
16-
35+
1736
Serial.print(datetime.year());
1837
Serial.print('-');
1938
Serial.print(datetime.month());
2039
Serial.print('-');
2140
Serial.print(datetime.day());
2241
Serial.print(' ');
2342
Serial.print(datetime.dayofWeek());
24-
Serial.print(':');
43+
Serial.print(' ');
2544
Serial.print(datetime.hour());
2645
Serial.print(':');
2746
Serial.print(datetime.minute());
2847
Serial.print(':');
2948
Serial.print(datetime.second());
3049
Serial.println();
3150

32-
datetime.date("Y-m-d H:i:s");
51+
// set date and time format:
52+
datetime.date(F("Y-m-d H:i:s"));
3353
}
3454

3555
void loop() {
3656
Serial.println(datetime.date());
37-
delay(1000);
38-
}
57+
delay(10);
58+
}

examples/EmailClient/EmailClient.ino

+26-10
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,54 @@
1-
/* arduino email client - send email to server directly */
1+
// Arduino Email Client - Send Email to Server Directly
2+
//
3+
// PHPoC Shield and PHPoC WiFi Shield are Internet Shields for Arduino Uno and
4+
// Mega.
5+
//
6+
// This is an example of using Arduino Uno/Mega and PHPoC [WiFi] Shield to send
7+
// an email
8+
//
9+
// Arduino communicates with PHPoC [WiFi] Shield via pins 10, 11, 12 and 13 on
10+
// the Uno, and pins 10, 50, 51 and 52 on the Mega. Therefore, these pins CANNOT
11+
// be used for general I/O.
12+
//
13+
// This example code was written by Sollae Systems. It is released into the
14+
// public domain.
15+
//
16+
// Tutorial for the example is available here:
17+
// https://forum.phpoc.com/articles/tutorials/1252-arduino-email-client
218

3-
#include "SPI.h"
4-
#include "Phpoc.h"
19+
#include <Phpoc.h>
520

621
PhpocEmail email;
722

823
void setup() {
924
Serial.begin(9600);
1025
while(!Serial)
1126
;
12-
27+
28+
// initialize PHPoC [WiFi] Shield:
1329
Phpoc.begin(PF_LOG_SPI | PF_LOG_NET | PF_LOG_APP);
1430
//Phpoc.begin();
15-
31+
1632
Serial.println("Sending email to server directly");
1733

18-
// setup From/To/Subject
34+
// setup From/To/Subject:
1935
email.setFrom("from_email_address", "from_user_name");
2036
email.setTo("to_email_address", "to_user_name");
2137
email.setSubject("Mail from PHPoC Shield for Arduino");
2238

23-
// write email message
39+
// write email message:
2440
email.beginMessage();
2541
email.println("Hello, world!");
2642
email.println("I am PHPoC Shield for Arduino");
2743
email.println("Good bye");
2844
email.endMessage();
29-
30-
// send email
45+
46+
// send email:
3147
if(email.send() > 0)
3248
Serial.println("Email send ok");
3349
else
3450
Serial.println("Email send failed");
3551
}
3652

3753
void loop() {
38-
}
54+
}

examples/GmailClient/GmailClient.ino

+29-12
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,69 @@
1-
/* arduino email client - send email via gmail relay server */
1+
// Arduino Email Client - Send Email via Gmail Relay Server
2+
//
3+
// PHPoC Shield and PHPoC WiFi Shield are Internet Shields for Arduino Uno and
4+
// Mega.
5+
//
6+
// This is an example of using Arduino Uno/Mega and PHPoC [WiFi] Shield to send
7+
// an email via Gmail Relay Server.
8+
//
9+
// Arduino communicates with PHPoC [WiFi] Shield via pins 10, 11, 12 and 13 on
10+
// the Uno, and pins 10, 50, 51 and 52 on the Mega. Therefore, these pins CANNOT
11+
// be used for general I/O.
12+
//
13+
// This example code was written by Sollae Systems. It is released into the
14+
// public domain.
15+
//
16+
// Tutorial for the example is available here:
17+
// https://forum.phpoc.com/articles/tutorials/1238-arduino-gmail-client
218

3-
#include "SPI.h"
4-
#include "Phpoc.h"
19+
#include <Phpoc.h>
520

621
PhpocEmail email;
722

823
void setup() {
924
Serial.begin(9600);
1025
while(!Serial)
1126
;
12-
27+
28+
// initialize PHPoC [WiFi] Shield:
1329
Phpoc.begin(PF_LOG_SPI | PF_LOG_NET | PF_LOG_APP);
1430
//Phpoc.begin();
15-
31+
1632
Serial.println("Sending email to gmail relay server");
1733

1834
// [login using your private password]
19-
// Google may block sign-in attempts from some apps or devices that do not use modern security standards.
35+
// Google may block sign-in attempts from some apps or devices that do not use
36+
// modern security standards.
2037
// Change your settings to allow less secure apps to access your account.
2138
// https://www.google.com/settings/security/lesssecureapps
22-
39+
2340
// [login using app password]
2441
// 1. turn on 2-step verification
2542
// 2. create app password
2643
// 3. apply app password as your login password
2744

28-
// setup outgoing relay server - gmail.com
45+
// setup outgoing relay server - gmail.com:
2946
email.setOutgoingServer("smtp.gmail.com", 587);
3047
email.setOutgoingLogin("your_login_id", "your_login_password or app_password");
3148

32-
// setup From/To/Subject
49+
// setup From/To/Subject:
3350
email.setFrom("from_email_address", "from_user_name");
3451
email.setTo("to_email_address", "to_user_name");
3552
email.setSubject("Mail from PHPoC Shield for Arduino");
3653

37-
// write email message
54+
// write email message:
3855
email.beginMessage();
3956
email.println("Hello, world!");
4057
email.println("I am PHPoC Shield for Arduino");
4158
email.println("Good bye");
4259
email.endMessage();
4360

44-
// send email
61+
// send email:
4562
if(email.send() > 0)
4663
Serial.println("Email send ok");
4764
else
4865
Serial.println("Email send failed");
4966
}
5067

5168
void loop() {
52-
}
69+
}

0 commit comments

Comments
 (0)