Skip to content

Commit 75ec480

Browse files
committed
2017.02.16.
1 parent f0171ba commit 75ec480

29 files changed

+1022
-178
lines changed

README.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,21 @@ This library is to use [PHPoC (WiFi) Shield for Arduino](http://www.phpoc.com/ph
44
Available Examples
55
----------------------------
66
* ChatServer
7+
* ChatServerIPv6
78
* DateTime
89
* EmailClient
910
* SSHServer
1011
* SSLServer
1112
* TelnetServer
1213
* WebClient
14+
* WebClientIPv6
1315
* WebRemotePush
1416
* WebRemoteSlide
1517
* WebSSLClient
18+
* WebSSLClientIPv6
1619

1720
References
1821
----------------------------
1922
* [PHPoC (WiFi) Shield for Arduino Library Reference](http://www.phpoc.com/support/manual/phpoc_shield_for_arduino_library_reference/)
2023

21-
Arduino Library 05
24+
Arduino Library 11

examples/ChatServer/ChatServer.ino

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* arduino chat server - 4 listening sessions */
2+
13
#include <SPI.h>
24
#include <Phpoc.h>
35

@@ -8,7 +10,7 @@ void setup() {
810
Serial.begin(9600);
911
while(!Serial)
1012
;
11-
13+
1214
Phpoc.begin(PF_LOG_SPI | PF_LOG_NET);
1315
//Phpoc.begin();
1416

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/* arduino IPv4 & IPv6 dual stack chat server - 4 listening sessions */
2+
3+
#include <SPI.h>
4+
#include <Phpoc.h>
5+
6+
PhpocServer server(23);
7+
boolean alreadyConnected = false; // whether or not the client was connected previously
8+
9+
void setup() {
10+
Serial.begin(9600);
11+
while(!Serial)
12+
;
13+
14+
Phpoc.begin(PF_LOG_SPI | PF_LOG_NET);
15+
//Phpoc.begin();
16+
17+
Phpoc.beginIP6();
18+
19+
server.begin();
20+
21+
Serial.print("Chat server address : ");
22+
Serial.print(Phpoc.localIP());
23+
Serial.print(' ');
24+
Serial.print(Phpoc.localIP6());
25+
Serial.print(' ');
26+
Serial.print(Phpoc.globalIP6());
27+
Serial.println();
28+
}
29+
30+
void loop() {
31+
// wait for a new client:
32+
PhpocClient client = server.available();
33+
34+
// when the client sends the first byte, say hello:
35+
if (client) {
36+
if (!alreadyConnected) {
37+
// clear out the transmission buffer:
38+
client.flush();
39+
Serial.println("We have a new client");
40+
client.println("Hello, client!");
41+
alreadyConnected = true;
42+
}
43+
44+
if (client.available() > 0) {
45+
// read the bytes incoming from the client:
46+
char thisChar = client.read();
47+
// echo the bytes back to the client:
48+
server.write(thisChar);
49+
// echo the bytes to the server as well:
50+
Serial.write(thisChar);
51+
}
52+
}
53+
}

examples/DateTime/DateTime.ino

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* arduino RTC date & time test */
2+
13
#include <SPI.h>
24
#include <Phpoc.h>
35

@@ -10,7 +12,7 @@ void setup() {
1012

1113
Phpoc.begin();
1214

13-
Serial.println("Phpoc Time test");
15+
Serial.println("Get year/month/day/dayofWeek/hour/minute/second from RTC in PHPoC Shield");
1416

1517
Serial.print(datetime.year());
1618
Serial.print('-');

examples/EmailClient/EmailClient.ino

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* arduino email client - send email to server directly */
2+
13
#include "SPI.h"
24
#include "Phpoc.h"
35

@@ -11,7 +13,7 @@ void setup() {
1113
Phpoc.begin(PF_LOG_SPI | PF_LOG_NET | PF_LOG_APP);
1214
//Phpoc.begin();
1315

14-
Serial.println("Email Client Test");
16+
Serial.println("Sending email to server directly");
1517

1618
// setup From/To/Subject
1719
email.setFrom("from_email_address", "from_user_name");

examples/GmailClient/GmailClient.ino

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* arduino email client - send email via gmail relay server */
2+
13
#include "SPI.h"
24
#include "Phpoc.h"
35

@@ -11,7 +13,7 @@ void setup() {
1113
Phpoc.begin(PF_LOG_SPI | PF_LOG_NET | PF_LOG_APP);
1214
//Phpoc.begin();
1315

14-
Serial.println("Email Client Test using outgoing relay server");
16+
Serial.println("Sending email to gmail relay server");
1517

1618
// [login using your private password]
1719
// Google may block sign-in attempts from some apps or devices that do not use modern security standards.

examples/SSHServer/SSHServer.ino

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* arduino SSH server - 1 listening session */
2+
13
#include "SPI.h"
24
#include "Phpoc.h"
35

examples/SSLServer/SSLServer.ino

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* arduino SSL server - 1 listening session */
2+
13
#include "SPI.h"
24
#include "Phpoc.h"
35

examples/TelnetServer/TelnetServer.ino

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* arduino telnet server - 4 listening sessions */
2+
13
#include "SPI.h"
24
#include "Phpoc.h"
35

examples/WebClient/WebClient.ino

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* arduino web client - GET request for index.html or index.php */
2+
13
#include <SPI.h>
24
#include <Phpoc.h>
35

@@ -11,14 +13,14 @@ void setup() {
1113
while(!Serial)
1214
;
1315

14-
Serial.println("PHPoC TCP Client test");
16+
Serial.println("Sending GET request to web server");
1517

1618
Phpoc.begin(PF_LOG_SPI | PF_LOG_NET);
1719
//Phpoc.begin();
1820

1921
if(client.connect(server_name, 80))
2022
{
21-
Serial.println("connected");
23+
Serial.println("Connected to server");
2224
client.println("GET / HTTP/1.0");
2325
client.println();
2426
}
+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/* arduino IPv6 web client - GET request for hello.php or logo.txt */
2+
3+
#include <SPI.h>
4+
#include <Phpoc.h>
5+
6+
char server_name[] = "ipv6test.phpoc.com";
7+
PhpocClient client;
8+
9+
void setup() {
10+
Serial.begin(9600);
11+
while(!Serial)
12+
;
13+
14+
Serial.println("Sending GET reqeust to IPv6 web server");
15+
16+
Phpoc.begin(PF_LOG_SPI | PF_LOG_NET);
17+
//Phpoc.begin();
18+
19+
Phpoc.beginIP6();
20+
21+
if(client.connect(server_name, 80))
22+
{
23+
Serial.println("Connected to server");
24+
client.println("GET /hello.php HTTP/1.0");
25+
//client.println("GET /logo.txt HTTP/1.0");
26+
client.println("Host: ipv6test.phpoc.com");
27+
client.println("Connection: close");
28+
client.println();
29+
}
30+
else
31+
Serial.println("connection failed");
32+
}
33+
34+
void loop() {
35+
if(client.available())
36+
{
37+
char c = client.read();
38+
Serial.print(c);
39+
}
40+
41+
if(!client.connected())
42+
{
43+
Serial.println("disconnected");
44+
client.stop();
45+
while(1)
46+
;
47+
}
48+
}

examples/WebRemotePush/WebRemotePush.ino

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* arduino web server - remote control (push button) */
2+
13
#include "SPI.h"
24
#include "Phpoc.h"
35

examples/WebRemoteSlide/WebRemoteSlide.ino

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* arduino web server - remote control (slide switch) */
2+
13
#include "SPI.h"
24
#include "Phpoc.h"
35

examples/WebSSLClient/WebSSLClient.ino

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* arduino SSL web client - GET reqeust for arduino ascii logo */
2+
13
#include "SPI.h"
24
#include "Phpoc.h"
35

@@ -10,7 +12,7 @@ void setup() {
1012
while(!Serial)
1113
;
1214

13-
Serial.println("PHPoC SSL Client test");
15+
Serial.println("Sending GET request to SSL web server");
1416

1517
Phpoc.begin(PF_LOG_SPI | PF_LOG_NET);
1618
//Phpoc.begin();
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/* arduino SSL IPv6 web client - GET request for index.html or index.php */
2+
3+
#include "SPI.h"
4+
#include "Phpoc.h"
5+
6+
char server[] = "ipv6.google.com";
7+
8+
PhpocClient client;
9+
10+
void setup() {
11+
Serial.begin(9600);
12+
while(!Serial)
13+
;
14+
15+
Serial.println("Sending GET request to SSL IPv6 web server");
16+
17+
Phpoc.begin(PF_LOG_SPI | PF_LOG_NET);
18+
//Phpoc.begin();
19+
20+
Phpoc.beginIP6();
21+
22+
if(client.connectSSL(server, 443)) {
23+
Serial.println("Connected to server");
24+
// Make a HTTP request:
25+
client.println("GET / HTTP/1.0");
26+
client.println();
27+
Serial.println("Request sent");
28+
}
29+
}
30+
31+
void loop() {
32+
// if there are incoming bytes available
33+
// from the server, read them and print them:
34+
while (client.available()) {
35+
char c = client.read();
36+
Serial.write(c);
37+
}
38+
39+
// if the server's disconnected, stop the client:
40+
if (!client.connected()) {
41+
Serial.println();
42+
Serial.println("disconnecting from server.");
43+
client.stop();
44+
45+
// do nothing forevermore:
46+
while (true);
47+
}
48+
49+
}

keywords.txt

+5
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,21 @@ PhpocClient KEYWORD1
1111
PhpocServer KEYWORD1
1212
PhpocEmail KEYWORD1
1313
PhpocDateTime KEYWORD1
14+
IP6Address KEYWORD1
1415

1516
#######################################
1617
# Methods and Functions (KEYWORD2)
1718
#######################################
1819

1920
begin KEYWORD2
21+
localIP KEYWORD2
22+
localIP6 KEYWORD2
23+
globalIP6 KEYWORD2
2024
beginTelnet KEYWORD2
2125
beginWebSocket KEYWORD2
2226
beginSSL KEYWORD2
2327
beginSSH KEYWORD2
28+
beginIP6 KEYWORD2
2429
connect KEYWORD2
2530
connectSSL KEYWORD2
2631
connected KEYWORD2

library.properties

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
name=PHPoC
2-
version=0.8.0
2+
version=1.0.0
33
author=Sollae Systems
44
maintainer=Sollae Systems ([email protected])
5-
sentence=PHPoC Ethernet/Wifi Shield for Arduino
6-
paragraph=TCP/EMAIL/SSL/SSH/Web communication helper based on PHPoC
5+
sentence=PHPoC Ethernet/WiFi Shield for Arduino
6+
paragraph=IPv6/TCP/EMAIL/SSL/SSH/Web communication helper based on PHPoC
77
category=Communication
88
url=http://www.phpoc.com
99
architectures=avr

0 commit comments

Comments
 (0)