diff --git a/build/Adafruit_CircuitPlayground-1.6.8.zip.sha b/build/Adafruit_CircuitPlayground-1.6.8.zip.sha
deleted file mode 100644
index f72775d884c..00000000000
--- a/build/Adafruit_CircuitPlayground-1.6.8.zip.sha
+++ /dev/null
@@ -1 +0,0 @@
-71e641db4f92ea5bf07e435296838aa5781f8f52
diff --git a/build/Adafruit_Circuit_Playground-1.8.1.zip.sha b/build/Adafruit_Circuit_Playground-1.8.1.zip.sha
new file mode 100644
index 00000000000..7692120d7ba
--- /dev/null
+++ b/build/Adafruit_Circuit_Playground-1.8.1.zip.sha
@@ -0,0 +1 @@
+01de573b19ea36114ac7704f20fc13111b8f965f
diff --git a/build/Bridge-1.6.3.zip.sha b/build/Bridge-1.6.3.zip.sha
deleted file mode 100644
index ddf94e442d1..00000000000
--- a/build/Bridge-1.6.3.zip.sha
+++ /dev/null
@@ -1 +0,0 @@
-880792eda3d529d3d6d73867799cbadaeba3fe88
diff --git a/build/Bridge-1.7.0.zip.sha b/build/Bridge-1.7.0.zip.sha
new file mode 100644
index 00000000000..2f6a694a710
--- /dev/null
+++ b/build/Bridge-1.7.0.zip.sha
@@ -0,0 +1 @@
+6d1a6160e029faf1066b6c7d8e80044a0e4fb017
diff --git a/build/Ethernet-2.0.0.zip.sha b/build/Ethernet-2.0.0.zip.sha
new file mode 100644
index 00000000000..f3bd2b030b3
--- /dev/null
+++ b/build/Ethernet-2.0.0.zip.sha
@@ -0,0 +1 @@
+8df0087aa13fa1ef22bfcb8974b46d65675721a1
diff --git a/build/Firmata-2.5.6.zip.sha b/build/Firmata-2.5.6.zip.sha
deleted file mode 100644
index 874fd38cff2..00000000000
--- a/build/Firmata-2.5.6.zip.sha
+++ /dev/null
@@ -1 +0,0 @@
-84e920f160274af13fe6a30641b006af6920a95e
diff --git a/build/Firmata-2.5.8.zip.sha b/build/Firmata-2.5.8.zip.sha
new file mode 100644
index 00000000000..730ac66be9f
--- /dev/null
+++ b/build/Firmata-2.5.8.zip.sha
@@ -0,0 +1 @@
+f3503270998e211d770b3a0269562b97d2f50d80
diff --git a/build/GSM-1.0.6.zip.sha b/build/GSM-1.0.6.zip.sha
new file mode 100644
index 00000000000..17e91951ad4
--- /dev/null
+++ b/build/GSM-1.0.6.zip.sha
@@ -0,0 +1 @@
+dd70f34bea2a715755aa332b0e4a41c1be951496
diff --git a/build/Keyboard-1.0.1.zip.sha b/build/Keyboard-1.0.1.zip.sha
deleted file mode 100644
index 496207cca6c..00000000000
--- a/build/Keyboard-1.0.1.zip.sha
+++ /dev/null
@@ -1 +0,0 @@
-d88b4fd86c80b57a9cd9f21c4ac68494243441ef
diff --git a/build/Keyboard-1.0.2.zip.sha b/build/Keyboard-1.0.2.zip.sha
new file mode 100644
index 00000000000..76653ba7c21
--- /dev/null
+++ b/build/Keyboard-1.0.2.zip.sha
@@ -0,0 +1 @@
+251d547d24d81bb375ed397862dfb181eb8b0089
diff --git a/build/SD-1.1.0.zip.sha b/build/SD-1.1.0.zip.sha
deleted file mode 100644
index 4e5c0917eee..00000000000
--- a/build/SD-1.1.0.zip.sha
+++ /dev/null
@@ -1 +0,0 @@
-9b16bafb44e485f40e7b2dbf9887142e41b90c8f
diff --git a/build/SD-1.2.2.zip.sha b/build/SD-1.2.2.zip.sha
new file mode 100644
index 00000000000..e2ef06cfe92
--- /dev/null
+++ b/build/SD-1.2.2.zip.sha
@@ -0,0 +1 @@
+4c720f714766b9a845c6b3e63c1347eac70a757f
diff --git a/build/Stepper-1.1.3.zip.sha b/build/Stepper-1.1.3.zip.sha
new file mode 100644
index 00000000000..8f0fca876d6
--- /dev/null
+++ b/build/Stepper-1.1.3.zip.sha
@@ -0,0 +1 @@
+0066669962ddf7efc34cfeade75b5d20ba284cb1
diff --git a/build/TFT-1.0.6.zip.sha b/build/TFT-1.0.6.zip.sha
new file mode 100644
index 00000000000..a06f5e82a8c
--- /dev/null
+++ b/build/TFT-1.0.6.zip.sha
@@ -0,0 +1 @@
+1af8d4c8960bd98191d001308528071b1ad0492f
diff --git a/build/WiFi-1.2.7.zip.sha b/build/WiFi-1.2.7.zip.sha
new file mode 100644
index 00000000000..672f2a46442
--- /dev/null
+++ b/build/WiFi-1.2.7.zip.sha
@@ -0,0 +1 @@
+2f70aa472e0c78dd0642fac7befc2df285059727
diff --git a/build/build.xml b/build/build.xml
index ba66230c850..f3838d32296 100644
--- a/build/build.xml
+++ b/build/build.xml
@@ -229,8 +229,13 @@
-
-
+
+
+
+
+
+
+
@@ -238,11 +243,11 @@
-
-
+
+
-
+
@@ -253,7 +258,7 @@
-
+
diff --git a/libraries/.keep b/libraries/.keep
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/libraries/Ethernet/AUTHORS b/libraries/Ethernet/AUTHORS
deleted file mode 100644
index 14097dff407..00000000000
--- a/libraries/Ethernet/AUTHORS
+++ /dev/null
@@ -1,38 +0,0 @@
-
-Alberto Panu https://github.com/bigjohnson
-Alasdair Allan https://github.com/aallan
-Alice Pintus https://github.com/00alis
-Adrian McEwen https://github.com/amcewen
-Arduino LLC http://arduino.cc/
-Arnie97 https://github.com/Arnie97
-Arturo Guadalupi https://github.com/agdl
-Bjoern Hartmann https://people.eecs.berkeley.edu/~bjoern/
-chaveiro https://github.com/chaveiro
-Cristian Maglie https://github.com/cmaglie
-David A. Mellis https://github.com/damellis
-Dino Tinitigan https://github.com/bigdinotech
-Eddy https://github.com/eddyst
-Federico Vanzati https://github.com/Fede85
-Federico Fissore https://github.com/ffissore
-Jack Christensen https://github.com/JChristensen
-Johann Richard https://github.com/johannrichard
-Jordan Terrell https://github.com/iSynaptic
-Justin Paulin https://github.com/interwho
-lathoub https://github.com/lathoub
-Martino Facchin https://github.com/facchinm
-Matthias Hertel https://github.com/mathertel
-Matthijs Kooijman https://github.com/matthijskooijman
-Matt Robinson https://github.com/ribbons
-MCQN Ltd. http://mcqn.com/
-Michael Amie https://github.com/michaelamie
-Michael Margolis https://github.com/michaelmargolis
-Norbert Truchsess https://github.com/ntruchsess
-Paul Stoffregen https://github.com/PaulStoffregen
-per1234 https://github.com/per1234
-Richard Sim
-Scott Fitzgerald https://github.com/shfitz
-Thibaut Viard https://github.com/aethaniel
-Tom Igoe https://github.com/tigoe
-WizNet http://www.wiznet.co.kr
-Zach Eveland https://github.com/zeveland
-
diff --git a/libraries/Ethernet/README.adoc b/libraries/Ethernet/README.adoc
deleted file mode 100644
index 8f890f04556..00000000000
--- a/libraries/Ethernet/README.adoc
+++ /dev/null
@@ -1,24 +0,0 @@
-= Ethernet Library for Arduino =
-
-With the Arduino Ethernet Shield, this library allows an Arduino board to connect to the internet.
-
-For more information about this library please visit us at
-http://www.arduino.cc/en/Reference/Ethernet
-
-== License ==
-
-Copyright (c) 2010 Arduino LLC. All right reserved.
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
diff --git a/libraries/Ethernet/examples/AdvancedChatServer/AdvancedChatServer.ino b/libraries/Ethernet/examples/AdvancedChatServer/AdvancedChatServer.ino
deleted file mode 100644
index 592a00e488c..00000000000
--- a/libraries/Ethernet/examples/AdvancedChatServer/AdvancedChatServer.ino
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- Advanced Chat Server
-
- A more advanced server that distributes any incoming messages
- to all connected clients but the client the message comes from.
- To use, telnet to your device's IP address and type.
- You can see the client's input in the serial monitor as well.
- Using an Arduino Wiznet Ethernet shield.
-
- Circuit:
- * Ethernet shield attached to pins 10, 11, 12, 13
-
- created 18 Dec 2009
- by David A. Mellis
- modified 9 Apr 2012
- by Tom Igoe
- redesigned to make use of operator== 25 Nov 2013
- by Norbert Truchsess
-
- */
-
-#include
-#include
-
-// Enter a MAC address and IP address for your controller below.
-// The IP address will be dependent on your local network.
-// gateway and subnet are optional:
-byte mac[] = {
- 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED
-};
-IPAddress ip(192, 168, 1, 177);
-IPAddress myDns(192, 168, 1, 1);
-IPAddress gateway(192, 168, 1, 1);
-IPAddress subnet(255, 255, 0, 0);
-
-
-// telnet defaults to port 23
-EthernetServer server(23);
-
-EthernetClient clients[4];
-
-void setup() {
- // initialize the Ethernet device
- Ethernet.begin(mac, ip, myDns, gateway, subnet);
- // start listening for clients
- server.begin();
- // Open serial communications and wait for port to open:
- Serial.begin(9600);
- while (!Serial) {
- ; // wait for serial port to connect. Needed for native USB port only
- }
-
-
- Serial.print("Chat server address:");
- Serial.println(Ethernet.localIP());
-}
-
-void loop() {
- // wait for a new client:
- EthernetClient client = server.available();
-
- // when the client sends the first byte, say hello:
- if (client) {
-
- boolean newClient = true;
- for (byte i = 0; i < 4; i++) {
- //check whether this client refers to the same socket as one of the existing instances:
- if (clients[i] == client) {
- newClient = false;
- break;
- }
- }
-
- if (newClient) {
- //check which of the existing clients can be overridden:
- for (byte i = 0; i < 4; i++) {
- if (!clients[i] && clients[i] != client) {
- clients[i] = client;
- // clear out the input buffer:
- client.flush();
- Serial.println("We have a new client");
- client.print("Hello, client number: ");
- client.print(i);
- client.println();
- break;
- }
- }
- }
-
- if (client.available() > 0) {
- // read the bytes incoming from the client:
- char thisChar = client.read();
- // echo the bytes back to all other connected clients:
- for (byte i = 0; i < 4; i++) {
- if (clients[i] && (clients[i] != client)) {
- clients[i].write(thisChar);
- }
- }
- // echo the bytes to the server as well:
- Serial.write(thisChar);
- }
- }
- for (byte i = 0; i < 4; i++) {
- if (!(clients[i].connected())) {
- // client.stop() invalidates the internal socket-descriptor, so next use of == will allways return false;
- clients[i].stop();
- }
- }
-}
diff --git a/libraries/Ethernet/examples/BarometricPressureWebServer/BarometricPressureWebServer.ino b/libraries/Ethernet/examples/BarometricPressureWebServer/BarometricPressureWebServer.ino
deleted file mode 100644
index 1a2bcf0a751..00000000000
--- a/libraries/Ethernet/examples/BarometricPressureWebServer/BarometricPressureWebServer.ino
+++ /dev/null
@@ -1,219 +0,0 @@
-/*
- SCP1000 Barometric Pressure Sensor Display
-
- Serves the output of a Barometric Pressure Sensor as a web page.
- Uses the SPI library. For details on the sensor, see:
- http://www.sparkfun.com/commerce/product_info.php?products_id=8161
-
- This sketch adapted from Nathan Seidle's SCP1000 example for PIC:
- http://www.sparkfun.com/datasheets/Sensors/SCP1000-Testing.zip
-
- Circuit:
- SCP1000 sensor attached to pins 6,7, and 11 - 13:
- DRDY: pin 6
- CSB: pin 7
- MOSI: pin 11
- MISO: pin 12
- SCK: pin 13
-
- created 31 July 2010
- by Tom Igoe
- */
-
-#include
-// the sensor communicates using SPI, so include the library:
-#include
-
-
-// assign a MAC address for the Ethernet controller.
-// fill in your address here:
-byte mac[] = {
- 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED
-};
-// assign an IP address for the controller:
-IPAddress ip(192, 168, 1, 20);
-
-
-// Initialize the Ethernet server library
-// with the IP address and port you want to use
-// (port 80 is default for HTTP):
-EthernetServer server(80);
-
-
-//Sensor's memory register addresses:
-const int PRESSURE = 0x1F; //3 most significant bits of pressure
-const int PRESSURE_LSB = 0x20; //16 least significant bits of pressure
-const int TEMPERATURE = 0x21; //16 bit temperature reading
-
-// pins used for the connection with the sensor
-// the others you need are controlled by the SPI library):
-const int dataReadyPin = 6;
-const int chipSelectPin = 7;
-
-float temperature = 0.0;
-long pressure = 0;
-long lastReadingTime = 0;
-
-void setup() {
- // start the SPI library:
- SPI.begin();
-
- // start the Ethernet connection and the server:
- Ethernet.begin(mac, ip);
- server.begin();
-
- // initalize the data ready and chip select pins:
- pinMode(dataReadyPin, INPUT);
- pinMode(chipSelectPin, OUTPUT);
-
- Serial.begin(9600);
-
- //Configure SCP1000 for low noise configuration:
- writeRegister(0x02, 0x2D);
- writeRegister(0x01, 0x03);
- writeRegister(0x03, 0x02);
-
- // give the sensor and Ethernet shield time to set up:
- delay(1000);
-
- //Set the sensor to high resolution mode tp start readings:
- writeRegister(0x03, 0x0A);
-
-}
-
-void loop() {
- // check for a reading no more than once a second.
- if (millis() - lastReadingTime > 1000) {
- // if there's a reading ready, read it:
- // don't do anything until the data ready pin is high:
- if (digitalRead(dataReadyPin) == HIGH) {
- getData();
- // timestamp the last time you got a reading:
- lastReadingTime = millis();
- }
- }
-
- // listen for incoming Ethernet connections:
- listenForEthernetClients();
-}
-
-
-void getData() {
- Serial.println("Getting reading");
- //Read the temperature data
- int tempData = readRegister(0x21, 2);
-
- // convert the temperature to celsius and display it:
- temperature = (float)tempData / 20.0;
-
- //Read the pressure data highest 3 bits:
- byte pressureDataHigh = readRegister(0x1F, 1);
- pressureDataHigh &= 0b00000111; //you only needs bits 2 to 0
-
- //Read the pressure data lower 16 bits:
- unsigned int pressureDataLow = readRegister(0x20, 2);
- //combine the two parts into one 19-bit number:
- pressure = ((pressureDataHigh << 16) | pressureDataLow) / 4;
-
- Serial.print("Temperature: ");
- Serial.print(temperature);
- Serial.println(" degrees C");
- Serial.print("Pressure: " + String(pressure));
- Serial.println(" Pa");
-}
-
-void listenForEthernetClients() {
- // listen for incoming clients
- EthernetClient client = server.available();
- if (client) {
- Serial.println("Got a client");
- // an http request ends with a blank line
- boolean currentLineIsBlank = true;
- while (client.connected()) {
- if (client.available()) {
- char c = client.read();
- // if you've gotten to the end of the line (received a newline
- // character) and the line is blank, the http request has ended,
- // so you can send a reply
- if (c == '\n' && currentLineIsBlank) {
- // send a standard http response header
- client.println("HTTP/1.1 200 OK");
- client.println("Content-Type: text/html");
- client.println();
- // print the current readings, in HTML format:
- client.print("Temperature: ");
- client.print(temperature);
- client.print(" degrees C");
- client.println("
");
- client.print("Pressure: " + String(pressure));
- client.print(" Pa");
- client.println("
");
- break;
- }
- if (c == '\n') {
- // you're starting a new line
- currentLineIsBlank = true;
- } else if (c != '\r') {
- // you've gotten a character on the current line
- currentLineIsBlank = false;
- }
- }
- }
- // give the web browser time to receive the data
- delay(1);
- // close the connection:
- client.stop();
- }
-}
-
-
-//Send a write command to SCP1000
-void writeRegister(byte registerName, byte registerValue) {
- // SCP1000 expects the register name in the upper 6 bits
- // of the byte:
- registerName <<= 2;
- // command (read or write) goes in the lower two bits:
- registerName |= 0b00000010; //Write command
-
- // take the chip select low to select the device:
- digitalWrite(chipSelectPin, LOW);
-
- SPI.transfer(registerName); //Send register location
- SPI.transfer(registerValue); //Send value to record into register
-
- // take the chip select high to de-select:
- digitalWrite(chipSelectPin, HIGH);
-}
-
-
-//Read register from the SCP1000:
-unsigned int readRegister(byte registerName, int numBytes) {
- byte inByte = 0; // incoming from the SPI read
- unsigned int result = 0; // result to return
-
- // SCP1000 expects the register name in the upper 6 bits
- // of the byte:
- registerName <<= 2;
- // command (read or write) goes in the lower two bits:
- registerName &= 0b11111100; //Read command
-
- // take the chip select low to select the device:
- digitalWrite(chipSelectPin, LOW);
- // send the device the register you want to read:
- int command = SPI.transfer(registerName);
- // send a value of 0 to read the first byte returned:
- inByte = SPI.transfer(0x00);
-
- result = inByte;
- // if there's more than one byte returned,
- // shift the first byte then get the second byte:
- if (numBytes > 1) {
- result = inByte << 8;
- inByte = SPI.transfer(0x00);
- result = result | inByte;
- }
- // take the chip select high to de-select:
- digitalWrite(chipSelectPin, HIGH);
- // return the result:
- return (result);
-}
diff --git a/libraries/Ethernet/examples/ChatServer/ChatServer.ino b/libraries/Ethernet/examples/ChatServer/ChatServer.ino
deleted file mode 100644
index fe501d6ab74..00000000000
--- a/libraries/Ethernet/examples/ChatServer/ChatServer.ino
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- Chat Server
-
- A simple server that distributes any incoming messages to all
- connected clients. To use, telnet to your device's IP address and type.
- You can see the client's input in the serial monitor as well.
- Using an Arduino Wiznet Ethernet shield.
-
- Circuit:
- * Ethernet shield attached to pins 10, 11, 12, 13
-
- created 18 Dec 2009
- by David A. Mellis
- modified 9 Apr 2012
- by Tom Igoe
-
- */
-
-#include
-#include
-
-// Enter a MAC address and IP address for your controller below.
-// The IP address will be dependent on your local network.
-// gateway and subnet are optional:
-byte mac[] = {
- 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED
-};
-IPAddress ip(192, 168, 1, 177);
-IPAddress myDns(192,168,1, 1);
-IPAddress gateway(192, 168, 1, 1);
-IPAddress subnet(255, 255, 0, 0);
-
-
-// telnet defaults to port 23
-EthernetServer server(23);
-boolean alreadyConnected = false; // whether or not the client was connected previously
-
-void setup() {
- // initialize the ethernet device
- Ethernet.begin(mac, ip, myDns, gateway, subnet);
- // start listening for clients
- server.begin();
- // Open serial communications and wait for port to open:
- Serial.begin(9600);
- while (!Serial) {
- ; // wait for serial port to connect. Needed for native USB port only
- }
-
-
- Serial.print("Chat server address:");
- Serial.println(Ethernet.localIP());
-}
-
-void loop() {
- // wait for a new client:
- EthernetClient client = server.available();
-
- // when the client sends the first byte, say hello:
- if (client) {
- if (!alreadyConnected) {
- // clear out the input buffer:
- client.flush();
- Serial.println("We have a new client");
- client.println("Hello, client!");
- alreadyConnected = true;
- }
-
- if (client.available() > 0) {
- // read the bytes incoming from the client:
- char thisChar = client.read();
- // echo the bytes back to the client:
- server.write(thisChar);
- // echo the bytes to the server as well:
- Serial.write(thisChar);
- }
- }
-}
-
-
-
diff --git a/libraries/Ethernet/examples/DhcpAddressPrinter/DhcpAddressPrinter.ino b/libraries/Ethernet/examples/DhcpAddressPrinter/DhcpAddressPrinter.ino
deleted file mode 100644
index d527d257379..00000000000
--- a/libraries/Ethernet/examples/DhcpAddressPrinter/DhcpAddressPrinter.ino
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- DHCP-based IP printer
-
- This sketch uses the DHCP extensions to the Ethernet library
- to get an IP address via DHCP and print the address obtained.
- using an Arduino Wiznet Ethernet shield.
-
- Circuit:
- Ethernet shield attached to pins 10, 11, 12, 13
-
- created 12 April 2011
- modified 9 Apr 2012
- by Tom Igoe
- modified 02 Sept 2015
- by Arturo Guadalupi
-
-*/
-
-#include
-#include
-
-// Enter a MAC address for your controller below.
-// Newer Ethernet shields have a MAC address printed on a sticker on the shield
-byte mac[] = {
- 0x00, 0xAA, 0xBB, 0xCC, 0xDE, 0x02
-};
-
-// Initialize the Ethernet client library
-// with the IP address and port of the server
-// that you want to connect to (port 80 is default for HTTP):
-EthernetClient client;
-
-void setup() {
- // Open serial communications and wait for port to open:
- Serial.begin(9600);
- // this check is only needed on the Leonardo:
- while (!Serial) {
- ; // wait for serial port to connect. Needed for native USB port only
- }
-
- // start the Ethernet connection:
- if (Ethernet.begin(mac) == 0) {
- Serial.println("Failed to configure Ethernet using DHCP");
- // no point in carrying on, so do nothing forevermore:
- for (;;)
- ;
- }
- // print your local IP address:
- printIPAddress();
-}
-
-void loop() {
-
- switch (Ethernet.maintain())
- {
- case 1:
- //renewed fail
- Serial.println("Error: renewed fail");
- break;
-
- case 2:
- //renewed success
- Serial.println("Renewed success");
-
- //print your local IP address:
- printIPAddress();
- break;
-
- case 3:
- //rebind fail
- Serial.println("Error: rebind fail");
- break;
-
- case 4:
- //rebind success
- Serial.println("Rebind success");
-
- //print your local IP address:
- printIPAddress();
- break;
-
- default:
- //nothing happened
- break;
-
- }
-}
-
-void printIPAddress()
-{
- Serial.print("My IP address: ");
- for (byte thisByte = 0; thisByte < 4; thisByte++) {
- // print the value of each byte of the IP address:
- Serial.print(Ethernet.localIP()[thisByte], DEC);
- Serial.print(".");
- }
-
- Serial.println();
-}
diff --git a/libraries/Ethernet/examples/DhcpChatServer/DhcpChatServer.ino b/libraries/Ethernet/examples/DhcpChatServer/DhcpChatServer.ino
deleted file mode 100644
index 4cfb5945d2c..00000000000
--- a/libraries/Ethernet/examples/DhcpChatServer/DhcpChatServer.ino
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- DHCP Chat Server
-
- A simple server that distributes any incoming messages to all
- connected clients. To use, telnet to your device's IP address and type.
- You can see the client's input in the serial monitor as well.
- Using an Arduino Wiznet Ethernet shield.
-
- THis version attempts to get an IP address using DHCP
-
- Circuit:
- * Ethernet shield attached to pins 10, 11, 12, 13
-
- created 21 May 2011
- modified 9 Apr 2012
- by Tom Igoe
- modified 02 Sept 2015
- by Arturo Guadalupi
- Based on ChatServer example by David A. Mellis
-
- */
-
-#include
-#include
-
-// Enter a MAC address and IP address for your controller below.
-// The IP address will be dependent on your local network.
-// gateway and subnet are optional:
-byte mac[] = {
- 0x00, 0xAA, 0xBB, 0xCC, 0xDE, 0x02
-};
-IPAddress ip(192, 168, 1, 177);
-IPAddress myDns(192,168,1, 1);
-IPAddress gateway(192, 168, 1, 1);
-IPAddress subnet(255, 255, 0, 0);
-
-// telnet defaults to port 23
-EthernetServer server(23);
-boolean gotAMessage = false; // whether or not you got a message from the client yet
-
-void setup() {
- // Open serial communications and wait for port to open:
- Serial.begin(9600);
- // this check is only needed on the Leonardo:
- while (!Serial) {
- ; // wait for serial port to connect. Needed for native USB port only
- }
-
-
- // start the Ethernet connection:
- Serial.println("Trying to get an IP address using DHCP");
- if (Ethernet.begin(mac) == 0) {
- Serial.println("Failed to configure Ethernet using DHCP");
- // initialize the Ethernet device not using DHCP:
- Ethernet.begin(mac, ip, myDns, gateway, subnet);
- }
- // print your local IP address:
- Serial.print("My IP address: ");
- ip = Ethernet.localIP();
- for (byte thisByte = 0; thisByte < 4; thisByte++) {
- // print the value of each byte of the IP address:
- Serial.print(ip[thisByte], DEC);
- Serial.print(".");
- }
- Serial.println();
- // start listening for clients
- server.begin();
-
-}
-
-void loop() {
- // wait for a new client:
- EthernetClient client = server.available();
-
- // when the client sends the first byte, say hello:
- if (client) {
- if (!gotAMessage) {
- Serial.println("We have a new client");
- client.println("Hello, client!");
- gotAMessage = true;
- }
-
- // read the bytes incoming from the client:
- char thisChar = client.read();
- // echo the bytes back to the client:
- server.write(thisChar);
- // echo the bytes to the server as well:
- Serial.print(thisChar);
- Ethernet.maintain();
- }
-}
-
diff --git a/libraries/Ethernet/examples/TelnetClient/TelnetClient.ino b/libraries/Ethernet/examples/TelnetClient/TelnetClient.ino
deleted file mode 100644
index c9249b79456..00000000000
--- a/libraries/Ethernet/examples/TelnetClient/TelnetClient.ino
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- Telnet client
-
- This sketch connects to a a telnet server (http://www.google.com)
- using an Arduino Wiznet Ethernet shield. You'll need a telnet server
- to test this with.
- Processing's ChatServer example (part of the network library) works well,
- running on port 10002. It can be found as part of the examples
- in the Processing application, available at
- http://processing.org/
-
- Circuit:
- * Ethernet shield attached to pins 10, 11, 12, 13
-
- created 14 Sep 2010
- modified 9 Apr 2012
- by Tom Igoe
-
- */
-
-#include
-#include
-
-// Enter a MAC address and IP address for your controller below.
-// The IP address will be dependent on your local network:
-byte mac[] = {
- 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED
-};
-IPAddress ip(192, 168, 1, 177);
-
-// Enter the IP address of the server you're connecting to:
-IPAddress server(1, 1, 1, 1);
-
-// Initialize the Ethernet client library
-// with the IP address and port of the server
-// that you want to connect to (port 23 is default for telnet;
-// if you're using Processing's ChatServer, use port 10002):
-EthernetClient client;
-
-void setup() {
- // start the Ethernet connection:
- Ethernet.begin(mac, ip);
- // Open serial communications and wait for port to open:
- Serial.begin(9600);
- while (!Serial) {
- ; // wait for serial port to connect. Needed for native USB port only
- }
-
-
- // give the Ethernet shield a second to initialize:
- delay(1000);
- Serial.println("connecting...");
-
- // if you get a connection, report back via serial:
- if (client.connect(server, 10002)) {
- Serial.println("connected");
- } else {
- // if you didn't get a connection to the server:
- Serial.println("connection failed");
- }
-}
-
-void loop() {
- // if there are incoming bytes available
- // from the server, read them and print them:
- if (client.available()) {
- char c = client.read();
- Serial.print(c);
- }
-
- // as long as there are bytes in the serial queue,
- // read them and send them out the socket if it's open:
- while (Serial.available() > 0) {
- char inChar = Serial.read();
- if (client.connected()) {
- client.print(inChar);
- }
- }
-
- // if the server's disconnected, stop the client:
- if (!client.connected()) {
- Serial.println();
- Serial.println("disconnecting.");
- client.stop();
- // do nothing:
- while (true);
- }
-}
-
-
-
-
diff --git a/libraries/Ethernet/examples/UDPSendReceiveString/UDPSendReceiveString.ino b/libraries/Ethernet/examples/UDPSendReceiveString/UDPSendReceiveString.ino
deleted file mode 100644
index 62d008ff50b..00000000000
--- a/libraries/Ethernet/examples/UDPSendReceiveString/UDPSendReceiveString.ino
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- UDPSendReceiveString:
- This sketch receives UDP message strings, prints them to the serial port
- and sends an "acknowledge" string back to the sender
-
- A Processing sketch is included at the end of file that can be used to send
- and received messages for testing with a computer.
-
- created 21 Aug 2010
- by Michael Margolis
-
- This code is in the public domain.
- */
-
-
-#include // needed for Arduino versions later than 0018
-#include
-#include // UDP library from: bjoern@cs.stanford.edu 12/30/2008
-
-
-// Enter a MAC address and IP address for your controller below.
-// The IP address will be dependent on your local network:
-byte mac[] = {
- 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED
-};
-IPAddress ip(192, 168, 1, 177);
-
-unsigned int localPort = 8888; // local port to listen on
-
-// buffers for receiving and sending data
-char packetBuffer[UDP_TX_PACKET_MAX_SIZE]; //buffer to hold incoming packet,
-char ReplyBuffer[] = "acknowledged"; // a string to send back
-
-// An EthernetUDP instance to let us send and receive packets over UDP
-EthernetUDP Udp;
-
-void setup() {
- // start the Ethernet and UDP:
- Ethernet.begin(mac, ip);
- Udp.begin(localPort);
-
- Serial.begin(9600);
-}
-
-void loop() {
- // if there's data available, read a packet
- int packetSize = Udp.parsePacket();
- if (packetSize) {
- Serial.print("Received packet of size ");
- Serial.println(packetSize);
- Serial.print("From ");
- IPAddress remote = Udp.remoteIP();
- for (int i = 0; i < 4; i++) {
- Serial.print(remote[i], DEC);
- if (i < 3) {
- Serial.print(".");
- }
- }
- Serial.print(", port ");
- Serial.println(Udp.remotePort());
-
- // read the packet into packetBufffer
- Udp.read(packetBuffer, UDP_TX_PACKET_MAX_SIZE);
- Serial.println("Contents:");
- Serial.println(packetBuffer);
-
- // send a reply to the IP address and port that sent us the packet we received
- Udp.beginPacket(Udp.remoteIP(), Udp.remotePort());
- Udp.write(ReplyBuffer);
- Udp.endPacket();
- }
- delay(10);
-}
-
-
-/*
- Processing sketch to run with this example
- =====================================================
-
- // Processing UDP example to send and receive string data from Arduino
- // press any key to send the "Hello Arduino" message
-
-
- import hypermedia.net.*;
-
- UDP udp; // define the UDP object
-
-
- void setup() {
- udp = new UDP( this, 6000 ); // create a new datagram connection on port 6000
- //udp.log( true ); // <-- printout the connection activity
- udp.listen( true ); // and wait for incoming message
- }
-
- void draw()
- {
- }
-
- void keyPressed() {
- String ip = "192.168.1.177"; // the remote IP address
- int port = 8888; // the destination port
-
- udp.send("Hello World", ip, port ); // the message to send
-
- }
-
- void receive( byte[] data ) { // <-- default handler
- //void receive( byte[] data, String ip, int port ) { // <-- extended handler
-
- for(int i=0; i < data.length; i++)
- print(char(data[i]));
- println();
- }
- */
-
-
diff --git a/libraries/Ethernet/examples/UdpNtpClient/UdpNtpClient.ino b/libraries/Ethernet/examples/UdpNtpClient/UdpNtpClient.ino
deleted file mode 100644
index f610ee8bb97..00000000000
--- a/libraries/Ethernet/examples/UdpNtpClient/UdpNtpClient.ino
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
-
- Udp NTP Client
-
- Get the time from a Network Time Protocol (NTP) time server
- Demonstrates use of UDP sendPacket and ReceivePacket
- For more on NTP time servers and the messages needed to communicate with them,
- see http://en.wikipedia.org/wiki/Network_Time_Protocol
-
- created 4 Sep 2010
- by Michael Margolis
- modified 9 Apr 2012
- by Tom Igoe
- modified 02 Sept 2015
- by Arturo Guadalupi
-
- This code is in the public domain.
-
- */
-
-#include
-#include
-#include
-
-// Enter a MAC address for your controller below.
-// Newer Ethernet shields have a MAC address printed on a sticker on the shield
-byte mac[] = {
- 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED
-};
-
-unsigned int localPort = 8888; // local port to listen for UDP packets
-
-char timeServer[] = "time.nist.gov"; // time.nist.gov NTP server
-
-const int NTP_PACKET_SIZE = 48; // NTP time stamp is in the first 48 bytes of the message
-
-byte packetBuffer[ NTP_PACKET_SIZE]; //buffer to hold incoming and outgoing packets
-
-// A UDP instance to let us send and receive packets over UDP
-EthernetUDP Udp;
-
-void setup() {
- // Open serial communications and wait for port to open:
- Serial.begin(9600);
- while (!Serial) {
- ; // wait for serial port to connect. Needed for native USB port only
- }
-
-
- // start Ethernet and UDP
- if (Ethernet.begin(mac) == 0) {
- Serial.println("Failed to configure Ethernet using DHCP");
- // no point in carrying on, so do nothing forevermore:
- for (;;)
- ;
- }
- Udp.begin(localPort);
-}
-
-void loop() {
- sendNTPpacket(timeServer); // send an NTP packet to a time server
-
- // wait to see if a reply is available
- delay(1000);
- if (Udp.parsePacket()) {
- // We've received a packet, read the data from it
- Udp.read(packetBuffer, NTP_PACKET_SIZE); // read the packet into the buffer
-
- // the timestamp starts at byte 40 of the received packet and is four bytes,
- // or two words, long. First, extract the two words:
-
- unsigned long highWord = word(packetBuffer[40], packetBuffer[41]);
- unsigned long lowWord = word(packetBuffer[42], packetBuffer[43]);
- // combine the four bytes (two words) into a long integer
- // this is NTP time (seconds since Jan 1 1900):
- unsigned long secsSince1900 = highWord << 16 | lowWord;
- Serial.print("Seconds since Jan 1 1900 = ");
- Serial.println(secsSince1900);
-
- // now convert NTP time into everyday time:
- Serial.print("Unix time = ");
- // Unix time starts on Jan 1 1970. In seconds, that's 2208988800:
- const unsigned long seventyYears = 2208988800UL;
- // subtract seventy years:
- unsigned long epoch = secsSince1900 - seventyYears;
- // print Unix time:
- Serial.println(epoch);
-
-
- // print the hour, minute and second:
- Serial.print("The UTC time is "); // UTC is the time at Greenwich Meridian (GMT)
- Serial.print((epoch % 86400L) / 3600); // print the hour (86400 equals secs per day)
- Serial.print(':');
- if (((epoch % 3600) / 60) < 10) {
- // In the first 10 minutes of each hour, we'll want a leading '0'
- Serial.print('0');
- }
- Serial.print((epoch % 3600) / 60); // print the minute (3600 equals secs per minute)
- Serial.print(':');
- if ((epoch % 60) < 10) {
- // In the first 10 seconds of each minute, we'll want a leading '0'
- Serial.print('0');
- }
- Serial.println(epoch % 60); // print the second
- }
- // wait ten seconds before asking for the time again
- delay(10000);
- Ethernet.maintain();
-}
-
-// send an NTP request to the time server at the given address
-void sendNTPpacket(char* address) {
- // set all bytes in the buffer to 0
- memset(packetBuffer, 0, NTP_PACKET_SIZE);
- // Initialize values needed to form NTP request
- // (see URL above for details on the packets)
- packetBuffer[0] = 0b11100011; // LI, Version, Mode
- packetBuffer[1] = 0; // Stratum, or type of clock
- packetBuffer[2] = 6; // Polling Interval
- packetBuffer[3] = 0xEC; // Peer Clock Precision
- // 8 bytes of zero for Root Delay & Root Dispersion
- packetBuffer[12] = 49;
- packetBuffer[13] = 0x4E;
- packetBuffer[14] = 49;
- packetBuffer[15] = 52;
-
- // all NTP fields have been given values, now
- // you can send a packet requesting a timestamp:
- Udp.beginPacket(address, 123); //NTP requests are to port 123
- Udp.write(packetBuffer, NTP_PACKET_SIZE);
- Udp.endPacket();
-}
-
-
-
-
-
-
-
-
-
-
diff --git a/libraries/Ethernet/examples/WebClient/WebClient.ino b/libraries/Ethernet/examples/WebClient/WebClient.ino
deleted file mode 100644
index 5e265a77cfd..00000000000
--- a/libraries/Ethernet/examples/WebClient/WebClient.ino
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- Web client
-
- This sketch connects to a website (http://www.google.com)
- using an Arduino Wiznet Ethernet shield.
-
- Circuit:
- * Ethernet shield attached to pins 10, 11, 12, 13
-
- created 18 Dec 2009
- by David A. Mellis
- modified 9 Apr 2012
- by Tom Igoe, based on work by Adrian McEwen
-
- */
-
-#include
-#include
-
-// Enter a MAC address for your controller below.
-// Newer Ethernet shields have a MAC address printed on a sticker on the shield
-byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
-// if you don't want to use DNS (and reduce your sketch size)
-// use the numeric IP instead of the name for the server:
-//IPAddress server(74,125,232,128); // numeric IP for Google (no DNS)
-char server[] = "www.google.com"; // name address for Google (using DNS)
-
-// Set the static IP address to use if the DHCP fails to assign
-IPAddress ip(192, 168, 0, 177);
-
-// Initialize the Ethernet client library
-// with the IP address and port of the server
-// that you want to connect to (port 80 is default for HTTP):
-EthernetClient client;
-
-void setup() {
- // Open serial communications and wait for port to open:
- Serial.begin(9600);
- while (!Serial) {
- ; // wait for serial port to connect. Needed for native USB port only
- }
-
- // start the Ethernet connection:
- if (Ethernet.begin(mac) == 0) {
- Serial.println("Failed to configure Ethernet using DHCP");
- // try to congifure using IP address instead of DHCP:
- Ethernet.begin(mac, ip);
- }
- // give the Ethernet shield a second to initialize:
- delay(1000);
- Serial.println("connecting...");
-
- // if you get a connection, report back via serial:
- if (client.connect(server, 80)) {
- Serial.println("connected");
- // Make a HTTP request:
- client.println("GET /search?q=arduino HTTP/1.1");
- client.println("Host: www.google.com");
- client.println("Connection: close");
- client.println();
- } else {
- // if you didn't get a connection to the server:
- Serial.println("connection failed");
- }
-}
-
-void loop() {
- // if there are incoming bytes available
- // from the server, read them and print them:
- if (client.available()) {
- char c = client.read();
- Serial.print(c);
- }
-
- // if the server's disconnected, stop the client:
- if (!client.connected()) {
- Serial.println();
- Serial.println("disconnecting.");
- client.stop();
-
- // do nothing forevermore:
- while (true);
- }
-}
-
diff --git a/libraries/Ethernet/examples/WebClientRepeating/WebClientRepeating.ino b/libraries/Ethernet/examples/WebClientRepeating/WebClientRepeating.ino
deleted file mode 100644
index e955c4d4a22..00000000000
--- a/libraries/Ethernet/examples/WebClientRepeating/WebClientRepeating.ino
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- Repeating Web client
-
- This sketch connects to a a web server and makes a request
- using a Wiznet Ethernet shield. You can use the Arduino Ethernet shield, or
- the Adafruit Ethernet shield, either one will work, as long as it's got
- a Wiznet Ethernet module on board.
-
- This example uses DNS, by assigning the Ethernet client with a MAC address,
- IP address, and DNS address.
-
- Circuit:
- * Ethernet shield attached to pins 10, 11, 12, 13
-
- created 19 Apr 2012
- by Tom Igoe
- modified 21 Jan 2014
- by Federico Vanzati
-
- http://www.arduino.cc/en/Tutorial/WebClientRepeating
- This code is in the public domain.
-
- */
-
-#include
-#include
-
-// assign a MAC address for the ethernet controller.
-// fill in your address here:
-byte mac[] = {
- 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED
-};
-// fill in an available IP address on your network here,
-// for manual configuration:
-IPAddress ip(192, 168, 1, 177);
-
-// fill in your Domain Name Server address here:
-IPAddress myDns(1, 1, 1, 1);
-
-// initialize the library instance:
-EthernetClient client;
-
-char server[] = "www.arduino.cc";
-//IPAddress server(64,131,82,241);
-
-unsigned long lastConnectionTime = 0; // last time you connected to the server, in milliseconds
-const unsigned long postingInterval = 10L * 1000L; // delay between updates, in milliseconds
-// the "L" is needed to use long type numbers
-
-void setup() {
- // start serial port:
- Serial.begin(9600);
- while (!Serial) {
- ; // wait for serial port to connect. Needed for native USB port only
- }
-
- // give the ethernet module time to boot up:
- delay(1000);
- // start the Ethernet connection using a fixed IP address and DNS server:
- Ethernet.begin(mac, ip, myDns);
- // print the Ethernet board/shield's IP address:
- Serial.print("My IP address: ");
- Serial.println(Ethernet.localIP());
-}
-
-void loop() {
- // if there's incoming data from the net connection.
- // send it out the serial port. This is for debugging
- // purposes only:
- if (client.available()) {
- char c = client.read();
- Serial.write(c);
- }
-
- // if ten seconds have passed since your last connection,
- // then connect again and send data:
- if (millis() - lastConnectionTime > postingInterval) {
- httpRequest();
- }
-
-}
-
-// this method makes a HTTP connection to the server:
-void httpRequest() {
- // close any connection before send a new request.
- // This will free the socket on the WiFi shield
- client.stop();
-
- // if there's a successful connection:
- if (client.connect(server, 80)) {
- Serial.println("connecting...");
- // send the HTTP GET request:
- client.println("GET /latest.txt HTTP/1.1");
- client.println("Host: www.arduino.cc");
- client.println("User-Agent: arduino-ethernet");
- client.println("Connection: close");
- client.println();
-
- // note the time that the connection was made:
- lastConnectionTime = millis();
- } else {
- // if you couldn't make a connection:
- Serial.println("connection failed");
- }
-}
diff --git a/libraries/Ethernet/examples/WebServer/WebServer.ino b/libraries/Ethernet/examples/WebServer/WebServer.ino
deleted file mode 100644
index bf798abad73..00000000000
--- a/libraries/Ethernet/examples/WebServer/WebServer.ino
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- Web Server
-
- A simple web server that shows the value of the analog input pins.
- using an Arduino Wiznet Ethernet shield.
-
- Circuit:
- * Ethernet shield attached to pins 10, 11, 12, 13
- * Analog inputs attached to pins A0 through A5 (optional)
-
- created 18 Dec 2009
- by David A. Mellis
- modified 9 Apr 2012
- by Tom Igoe
- modified 02 Sept 2015
- by Arturo Guadalupi
-
- */
-
-#include
-#include
-
-// Enter a MAC address and IP address for your controller below.
-// The IP address will be dependent on your local network:
-byte mac[] = {
- 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED
-};
-IPAddress ip(192, 168, 1, 177);
-
-// Initialize the Ethernet server library
-// with the IP address and port you want to use
-// (port 80 is default for HTTP):
-EthernetServer server(80);
-
-void setup() {
- // Open serial communications and wait for port to open:
- Serial.begin(9600);
- while (!Serial) {
- ; // wait for serial port to connect. Needed for native USB port only
- }
-
-
- // start the Ethernet connection and the server:
- Ethernet.begin(mac, ip);
- server.begin();
- Serial.print("server is at ");
- Serial.println(Ethernet.localIP());
-}
-
-
-void loop() {
- // listen for incoming clients
- EthernetClient client = server.available();
- if (client) {
- Serial.println("new client");
- // an http request ends with a blank line
- boolean currentLineIsBlank = true;
- while (client.connected()) {
- if (client.available()) {
- char c = client.read();
- Serial.write(c);
- // if you've gotten to the end of the line (received a newline
- // character) and the line is blank, the http request has ended,
- // so you can send a reply
- if (c == '\n' && currentLineIsBlank) {
- // send a standard http response header
- client.println("HTTP/1.1 200 OK");
- client.println("Content-Type: text/html");
- client.println("Connection: close"); // the connection will be closed after completion of the response
- client.println("Refresh: 5"); // refresh the page automatically every 5 sec
- client.println();
- client.println("");
- client.println("");
- // output the value of each analog input pin
- for (int analogChannel = 0; analogChannel < 6; analogChannel++) {
- int sensorReading = analogRead(analogChannel);
- client.print("analog input ");
- client.print(analogChannel);
- client.print(" is ");
- client.print(sensorReading);
- client.println("
");
- }
- client.println("");
- break;
- }
- if (c == '\n') {
- // you're starting a new line
- currentLineIsBlank = true;
- } else if (c != '\r') {
- // you've gotten a character on the current line
- currentLineIsBlank = false;
- }
- }
- }
- // give the web browser time to receive the data
- delay(1);
- // close the connection:
- client.stop();
- Serial.println("client disconnected");
- }
-}
-
diff --git a/libraries/Ethernet/keywords.txt b/libraries/Ethernet/keywords.txt
deleted file mode 100644
index 1f19b2a6b20..00000000000
--- a/libraries/Ethernet/keywords.txt
+++ /dev/null
@@ -1,40 +0,0 @@
-#######################################
-# Syntax Coloring Map For Ethernet
-#######################################
-
-#######################################
-# Datatypes (KEYWORD1)
-#######################################
-
-Ethernet KEYWORD1 Ethernet
-EthernetClient KEYWORD1 EthernetClient
-EthernetServer KEYWORD1 EthernetServer
-IPAddress KEYWORD1 EthernetIPAddress
-
-#######################################
-# Methods and Functions (KEYWORD2)
-#######################################
-
-status KEYWORD2
-connect KEYWORD2
-write KEYWORD2
-available KEYWORD2
-read KEYWORD2
-peek KEYWORD2
-flush KEYWORD2
-stop KEYWORD2
-connected KEYWORD2
-begin KEYWORD2
-beginPacket KEYWORD2
-endPacket KEYWORD2
-parsePacket KEYWORD2
-remoteIP KEYWORD2
-remotePort KEYWORD2
-getSocketNumber KEYWORD2
-localIP KEYWORD2
-maintain KEYWORD2
-
-#######################################
-# Constants (LITERAL1)
-#######################################
-
diff --git a/libraries/Ethernet/library.properties b/libraries/Ethernet/library.properties
deleted file mode 100644
index e700f6c9e37..00000000000
--- a/libraries/Ethernet/library.properties
+++ /dev/null
@@ -1,9 +0,0 @@
-name=Ethernet
-version=1.1.2
-author=Various (see AUTHORS file for details)
-maintainer=Arduino
-sentence=Enables network connection (local and Internet) using the Arduino Ethernet Board or Shield.
-paragraph=With this library you can use the Arduino Ethernet (shield or board) to connect to Internet. The library provides both Client and server functionalities. The library permits you to connect to a local network also with DHCP and to resolve DNS.
-category=Communication
-url=http://www.arduino.cc/en/Reference/Ethernet
-architectures=*
diff --git a/libraries/Ethernet/src/Dhcp.cpp b/libraries/Ethernet/src/Dhcp.cpp
deleted file mode 100644
index 3702d73b64d..00000000000
--- a/libraries/Ethernet/src/Dhcp.cpp
+++ /dev/null
@@ -1,471 +0,0 @@
-// DHCP Library v0.3 - April 25, 2009
-// Author: Jordan Terrell - blog.jordanterrell.com
-
-#include "utility/w5100.h"
-
-#include
-#include
-#include "Dhcp.h"
-#include "Arduino.h"
-#include "utility/util.h"
-
-int DhcpClass::beginWithDHCP(uint8_t *mac, unsigned long timeout, unsigned long responseTimeout)
-{
- _dhcpLeaseTime=0;
- _dhcpT1=0;
- _dhcpT2=0;
- _timeout = timeout;
- _responseTimeout = responseTimeout;
-
- // zero out _dhcpMacAddr
- memset(_dhcpMacAddr, 0, 6);
- reset_DHCP_lease();
-
- memcpy((void*)_dhcpMacAddr, (void*)mac, 6);
- _dhcp_state = STATE_DHCP_START;
- return request_DHCP_lease();
-}
-
-void DhcpClass::reset_DHCP_lease(){
- // zero out _dhcpSubnetMask, _dhcpGatewayIp, _dhcpLocalIp, _dhcpDhcpServerIp, _dhcpDnsServerIp
- memset(_dhcpLocalIp, 0, 20);
-}
-
-//return:0 on error, 1 if request is sent and response is received
-int DhcpClass::request_DHCP_lease(){
-
- uint8_t messageType = 0;
-
-
-
- // Pick an initial transaction ID
- _dhcpTransactionId = random(1UL, 2000UL);
- _dhcpInitialTransactionId = _dhcpTransactionId;
-
- _dhcpUdpSocket.stop();
- if (_dhcpUdpSocket.begin(DHCP_CLIENT_PORT) == 0)
- {
- // Couldn't get a socket
- return 0;
- }
-
- presend_DHCP();
-
- int result = 0;
-
- unsigned long startTime = millis();
-
- while(_dhcp_state != STATE_DHCP_LEASED)
- {
- if(_dhcp_state == STATE_DHCP_START)
- {
- _dhcpTransactionId++;
-
- send_DHCP_MESSAGE(DHCP_DISCOVER, ((millis() - startTime) / 1000));
- _dhcp_state = STATE_DHCP_DISCOVER;
- }
- else if(_dhcp_state == STATE_DHCP_REREQUEST){
- _dhcpTransactionId++;
- send_DHCP_MESSAGE(DHCP_REQUEST, ((millis() - startTime)/1000));
- _dhcp_state = STATE_DHCP_REQUEST;
- }
- else if(_dhcp_state == STATE_DHCP_DISCOVER)
- {
- uint32_t respId;
- messageType = parseDHCPResponse(_responseTimeout, respId);
- if(messageType == DHCP_OFFER)
- {
- // We'll use the transaction ID that the offer came with,
- // rather than the one we were up to
- _dhcpTransactionId = respId;
- send_DHCP_MESSAGE(DHCP_REQUEST, ((millis() - startTime) / 1000));
- _dhcp_state = STATE_DHCP_REQUEST;
- }
- }
- else if(_dhcp_state == STATE_DHCP_REQUEST)
- {
- uint32_t respId;
- messageType = parseDHCPResponse(_responseTimeout, respId);
- if(messageType == DHCP_ACK)
- {
- _dhcp_state = STATE_DHCP_LEASED;
- result = 1;
- //use default lease time if we didn't get it
- if(_dhcpLeaseTime == 0){
- _dhcpLeaseTime = DEFAULT_LEASE;
- }
- // Calculate T1 & T2 if we didn't get it
- if(_dhcpT1 == 0){
- // T1 should be 50% of _dhcpLeaseTime
- _dhcpT1 = _dhcpLeaseTime >> 1;
- }
- if(_dhcpT2 == 0){
- // T2 should be 87.5% (7/8ths) of _dhcpLeaseTime
- _dhcpT2 = _dhcpLeaseTime - (_dhcpLeaseTime >> 3);
- }
- _renewInSec = _dhcpT1;
- _rebindInSec = _dhcpT2;
- }
- else if(messageType == DHCP_NAK)
- _dhcp_state = STATE_DHCP_START;
- }
-
- if(messageType == 255)
- {
- messageType = 0;
- _dhcp_state = STATE_DHCP_START;
- }
-
- if(result != 1 && ((millis() - startTime) > _timeout))
- break;
- }
-
- // We're done with the socket now
- _dhcpUdpSocket.stop();
- _dhcpTransactionId++;
-
- _lastCheckLeaseMillis = millis();
- return result;
-}
-
-void DhcpClass::presend_DHCP()
-{
-}
-
-void DhcpClass::send_DHCP_MESSAGE(uint8_t messageType, uint16_t secondsElapsed)
-{
- uint8_t buffer[32];
- memset(buffer, 0, 32);
- IPAddress dest_addr( 255, 255, 255, 255 ); // Broadcast address
-
- if (-1 == _dhcpUdpSocket.beginPacket(dest_addr, DHCP_SERVER_PORT))
- {
- // FIXME Need to return errors
- return;
- }
-
- buffer[0] = DHCP_BOOTREQUEST; // op
- buffer[1] = DHCP_HTYPE10MB; // htype
- buffer[2] = DHCP_HLENETHERNET; // hlen
- buffer[3] = DHCP_HOPS; // hops
-
- // xid
- unsigned long xid = htonl(_dhcpTransactionId);
- memcpy(buffer + 4, &(xid), 4);
-
- // 8, 9 - seconds elapsed
- buffer[8] = ((secondsElapsed & 0xff00) >> 8);
- buffer[9] = (secondsElapsed & 0x00ff);
-
- // flags
- unsigned short flags = htons(DHCP_FLAGSBROADCAST);
- memcpy(buffer + 10, &(flags), 2);
-
- // ciaddr: already zeroed
- // yiaddr: already zeroed
- // siaddr: already zeroed
- // giaddr: already zeroed
-
- //put data in W5100 transmit buffer
- _dhcpUdpSocket.write(buffer, 28);
-
- memset(buffer, 0, 32); // clear local buffer
-
- memcpy(buffer, _dhcpMacAddr, 6); // chaddr
-
- //put data in W5100 transmit buffer
- _dhcpUdpSocket.write(buffer, 16);
-
- memset(buffer, 0, 32); // clear local buffer
-
- // leave zeroed out for sname && file
- // put in W5100 transmit buffer x 6 (192 bytes)
-
- for(int i = 0; i < 6; i++) {
- _dhcpUdpSocket.write(buffer, 32);
- }
-
- // OPT - Magic Cookie
- buffer[0] = (uint8_t)((MAGIC_COOKIE >> 24)& 0xFF);
- buffer[1] = (uint8_t)((MAGIC_COOKIE >> 16)& 0xFF);
- buffer[2] = (uint8_t)((MAGIC_COOKIE >> 8)& 0xFF);
- buffer[3] = (uint8_t)(MAGIC_COOKIE& 0xFF);
-
- // OPT - message type
- buffer[4] = dhcpMessageType;
- buffer[5] = 0x01;
- buffer[6] = messageType; //DHCP_REQUEST;
-
- // OPT - client identifier
- buffer[7] = dhcpClientIdentifier;
- buffer[8] = 0x07;
- buffer[9] = 0x01;
- memcpy(buffer + 10, _dhcpMacAddr, 6);
-
- // OPT - host name
- buffer[16] = hostName;
- buffer[17] = strlen(HOST_NAME) + 6; // length of hostname + last 3 bytes of mac address
- strcpy((char*)&(buffer[18]), HOST_NAME);
-
- printByte((char*)&(buffer[24]), _dhcpMacAddr[3]);
- printByte((char*)&(buffer[26]), _dhcpMacAddr[4]);
- printByte((char*)&(buffer[28]), _dhcpMacAddr[5]);
-
- //put data in W5100 transmit buffer
- _dhcpUdpSocket.write(buffer, 30);
-
- if(messageType == DHCP_REQUEST)
- {
- buffer[0] = dhcpRequestedIPaddr;
- buffer[1] = 0x04;
- buffer[2] = _dhcpLocalIp[0];
- buffer[3] = _dhcpLocalIp[1];
- buffer[4] = _dhcpLocalIp[2];
- buffer[5] = _dhcpLocalIp[3];
-
- buffer[6] = dhcpServerIdentifier;
- buffer[7] = 0x04;
- buffer[8] = _dhcpDhcpServerIp[0];
- buffer[9] = _dhcpDhcpServerIp[1];
- buffer[10] = _dhcpDhcpServerIp[2];
- buffer[11] = _dhcpDhcpServerIp[3];
-
- //put data in W5100 transmit buffer
- _dhcpUdpSocket.write(buffer, 12);
- }
-
- buffer[0] = dhcpParamRequest;
- buffer[1] = 0x06;
- buffer[2] = subnetMask;
- buffer[3] = routersOnSubnet;
- buffer[4] = dns;
- buffer[5] = domainName;
- buffer[6] = dhcpT1value;
- buffer[7] = dhcpT2value;
- buffer[8] = endOption;
-
- //put data in W5100 transmit buffer
- _dhcpUdpSocket.write(buffer, 9);
-
- _dhcpUdpSocket.endPacket();
-}
-
-uint8_t DhcpClass::parseDHCPResponse(unsigned long responseTimeout, uint32_t& transactionId)
-{
- uint8_t type = 0;
- uint8_t opt_len = 0;
-
- unsigned long startTime = millis();
-
- while(_dhcpUdpSocket.parsePacket() <= 0)
- {
- if((millis() - startTime) > responseTimeout)
- {
- return 255;
- }
- delay(50);
- }
- // start reading in the packet
- RIP_MSG_FIXED fixedMsg;
- _dhcpUdpSocket.read((uint8_t*)&fixedMsg, sizeof(RIP_MSG_FIXED));
-
- if(fixedMsg.op == DHCP_BOOTREPLY && _dhcpUdpSocket.remotePort() == DHCP_SERVER_PORT)
- {
- transactionId = ntohl(fixedMsg.xid);
- if(memcmp(fixedMsg.chaddr, _dhcpMacAddr, 6) != 0 || (transactionId < _dhcpInitialTransactionId) || (transactionId > _dhcpTransactionId))
- {
- // Need to read the rest of the packet here regardless
- _dhcpUdpSocket.flush();
- return 0;
- }
-
- memcpy(_dhcpLocalIp, fixedMsg.yiaddr, 4);
-
- // Skip to the option part
- // Doing this a byte at a time so we don't have to put a big buffer
- // on the stack (as we don't have lots of memory lying around)
- for (int i =0; i < (240 - (int)sizeof(RIP_MSG_FIXED)); i++)
- {
- _dhcpUdpSocket.read(); // we don't care about the returned byte
- }
-
- while (_dhcpUdpSocket.available() > 0)
- {
- switch (_dhcpUdpSocket.read())
- {
- case endOption :
- break;
-
- case padOption :
- break;
-
- case dhcpMessageType :
- opt_len = _dhcpUdpSocket.read();
- type = _dhcpUdpSocket.read();
- break;
-
- case subnetMask :
- opt_len = _dhcpUdpSocket.read();
- _dhcpUdpSocket.read(_dhcpSubnetMask, 4);
- break;
-
- case routersOnSubnet :
- opt_len = _dhcpUdpSocket.read();
- _dhcpUdpSocket.read(_dhcpGatewayIp, 4);
- for (int i = 0; i < opt_len-4; i++)
- {
- _dhcpUdpSocket.read();
- }
- break;
-
- case dns :
- opt_len = _dhcpUdpSocket.read();
- _dhcpUdpSocket.read(_dhcpDnsServerIp, 4);
- for (int i = 0; i < opt_len-4; i++)
- {
- _dhcpUdpSocket.read();
- }
- break;
-
- case dhcpServerIdentifier :
- opt_len = _dhcpUdpSocket.read();
- if ((_dhcpDhcpServerIp[0] == 0 && _dhcpDhcpServerIp[1] == 0 &&
- _dhcpDhcpServerIp[2] == 0 && _dhcpDhcpServerIp[3] == 0) ||
- IPAddress(_dhcpDhcpServerIp) == _dhcpUdpSocket.remoteIP())
- {
- _dhcpUdpSocket.read(_dhcpDhcpServerIp, sizeof(_dhcpDhcpServerIp));
- }
- else
- {
- // Skip over the rest of this option
- while (opt_len--)
- {
- _dhcpUdpSocket.read();
- }
- }
- break;
-
- case dhcpT1value :
- opt_len = _dhcpUdpSocket.read();
- _dhcpUdpSocket.read((uint8_t*)&_dhcpT1, sizeof(_dhcpT1));
- _dhcpT1 = ntohl(_dhcpT1);
- break;
-
- case dhcpT2value :
- opt_len = _dhcpUdpSocket.read();
- _dhcpUdpSocket.read((uint8_t*)&_dhcpT2, sizeof(_dhcpT2));
- _dhcpT2 = ntohl(_dhcpT2);
- break;
-
- case dhcpIPaddrLeaseTime :
- opt_len = _dhcpUdpSocket.read();
- _dhcpUdpSocket.read((uint8_t*)&_dhcpLeaseTime, sizeof(_dhcpLeaseTime));
- _dhcpLeaseTime = ntohl(_dhcpLeaseTime);
- _renewInSec = _dhcpLeaseTime;
- break;
-
- default :
- opt_len = _dhcpUdpSocket.read();
- // Skip over the rest of this option
- while (opt_len--)
- {
- _dhcpUdpSocket.read();
- }
- break;
- }
- }
- }
-
- // Need to skip to end of the packet regardless here
- _dhcpUdpSocket.flush();
-
- return type;
-}
-
-
-/*
- returns:
- 0/DHCP_CHECK_NONE: nothing happened
- 1/DHCP_CHECK_RENEW_FAIL: renew failed
- 2/DHCP_CHECK_RENEW_OK: renew success
- 3/DHCP_CHECK_REBIND_FAIL: rebind fail
- 4/DHCP_CHECK_REBIND_OK: rebind success
-*/
-int DhcpClass::checkLease(){
- int rc = DHCP_CHECK_NONE;
-
- unsigned long now = millis();
- unsigned long elapsed = now - _lastCheckLeaseMillis;
-
- // if more then one sec passed, reduce the counters accordingly
- if (elapsed >= 1000) {
- // set the new timestamps
- _lastCheckLeaseMillis = now - (elapsed % 1000);
- elapsed = elapsed / 1000;
-
- // decrease the counters by elapsed seconds
- // we assume that the cycle time (elapsed) is fairly constant
- // if the remainder is less than cycle time * 2
- // do it early instead of late
- if (_renewInSec < elapsed * 2)
- _renewInSec = 0;
- else
- _renewInSec -= elapsed;
-
- if (_rebindInSec < elapsed * 2)
- _rebindInSec = 0;
- else
- _rebindInSec -= elapsed;
- }
-
- // if we have a lease but should renew, do it
- if (_renewInSec == 0 &&_dhcp_state == STATE_DHCP_LEASED) {
- _dhcp_state = STATE_DHCP_REREQUEST;
- rc = 1 + request_DHCP_lease();
- }
-
- // if we have a lease or is renewing but should bind, do it
- if (_rebindInSec == 0 && (_dhcp_state == STATE_DHCP_LEASED || _dhcp_state == STATE_DHCP_START)) {
- // this should basically restart completely
- _dhcp_state = STATE_DHCP_START;
- reset_DHCP_lease();
- rc = 3 + request_DHCP_lease();
- }
- return rc;
-}
-
-IPAddress DhcpClass::getLocalIp()
-{
- return IPAddress(_dhcpLocalIp);
-}
-
-IPAddress DhcpClass::getSubnetMask()
-{
- return IPAddress(_dhcpSubnetMask);
-}
-
-IPAddress DhcpClass::getGatewayIp()
-{
- return IPAddress(_dhcpGatewayIp);
-}
-
-IPAddress DhcpClass::getDhcpServerIp()
-{
- return IPAddress(_dhcpDhcpServerIp);
-}
-
-IPAddress DhcpClass::getDnsServerIp()
-{
- return IPAddress(_dhcpDnsServerIp);
-}
-
-void DhcpClass::printByte(char * buf, uint8_t n ) {
- char *str = &buf[1];
- buf[0]='0';
- do {
- unsigned long m = n;
- n /= 16;
- char c = m - 16 * n;
- *str-- = c < 10 ? c + '0' : c + 'A' - 10;
- } while(n);
-}
diff --git a/libraries/Ethernet/src/Dhcp.h b/libraries/Ethernet/src/Dhcp.h
deleted file mode 100644
index 22900eade35..00000000000
--- a/libraries/Ethernet/src/Dhcp.h
+++ /dev/null
@@ -1,177 +0,0 @@
-// DHCP Library v0.3 - April 25, 2009
-// Author: Jordan Terrell - blog.jordanterrell.com
-
-#ifndef Dhcp_h
-#define Dhcp_h
-
-#include "EthernetUdp.h"
-
-/* DHCP state machine. */
-#define STATE_DHCP_START 0
-#define STATE_DHCP_DISCOVER 1
-#define STATE_DHCP_REQUEST 2
-#define STATE_DHCP_LEASED 3
-#define STATE_DHCP_REREQUEST 4
-#define STATE_DHCP_RELEASE 5
-
-#define DHCP_FLAGSBROADCAST 0x8000
-
-/* UDP port numbers for DHCP */
-#define DHCP_SERVER_PORT 67 /* from server to client */
-#define DHCP_CLIENT_PORT 68 /* from client to server */
-
-/* DHCP message OP code */
-#define DHCP_BOOTREQUEST 1
-#define DHCP_BOOTREPLY 2
-
-/* DHCP message type */
-#define DHCP_DISCOVER 1
-#define DHCP_OFFER 2
-#define DHCP_REQUEST 3
-#define DHCP_DECLINE 4
-#define DHCP_ACK 5
-#define DHCP_NAK 6
-#define DHCP_RELEASE 7
-#define DHCP_INFORM 8
-
-#define DHCP_HTYPE10MB 1
-#define DHCP_HTYPE100MB 2
-
-#define DHCP_HLENETHERNET 6
-#define DHCP_HOPS 0
-#define DHCP_SECS 0
-
-#define MAGIC_COOKIE 0x63825363
-#define MAX_DHCP_OPT 16
-
-#define HOST_NAME "WIZnet"
-#define DEFAULT_LEASE (900) //default lease time in seconds
-
-#define DHCP_CHECK_NONE (0)
-#define DHCP_CHECK_RENEW_FAIL (1)
-#define DHCP_CHECK_RENEW_OK (2)
-#define DHCP_CHECK_REBIND_FAIL (3)
-#define DHCP_CHECK_REBIND_OK (4)
-
-enum
-{
- padOption = 0,
- subnetMask = 1,
- timerOffset = 2,
- routersOnSubnet = 3,
- /* timeServer = 4,
- nameServer = 5,*/
- dns = 6,
- /*logServer = 7,
- cookieServer = 8,
- lprServer = 9,
- impressServer = 10,
- resourceLocationServer = 11,*/
- hostName = 12,
- /*bootFileSize = 13,
- meritDumpFile = 14,*/
- domainName = 15,
- /*swapServer = 16,
- rootPath = 17,
- extentionsPath = 18,
- IPforwarding = 19,
- nonLocalSourceRouting = 20,
- policyFilter = 21,
- maxDgramReasmSize = 22,
- defaultIPTTL = 23,
- pathMTUagingTimeout = 24,
- pathMTUplateauTable = 25,
- ifMTU = 26,
- allSubnetsLocal = 27,
- broadcastAddr = 28,
- performMaskDiscovery = 29,
- maskSupplier = 30,
- performRouterDiscovery = 31,
- routerSolicitationAddr = 32,
- staticRoute = 33,
- trailerEncapsulation = 34,
- arpCacheTimeout = 35,
- ethernetEncapsulation = 36,
- tcpDefaultTTL = 37,
- tcpKeepaliveInterval = 38,
- tcpKeepaliveGarbage = 39,
- nisDomainName = 40,
- nisServers = 41,
- ntpServers = 42,
- vendorSpecificInfo = 43,
- netBIOSnameServer = 44,
- netBIOSdgramDistServer = 45,
- netBIOSnodeType = 46,
- netBIOSscope = 47,
- xFontServer = 48,
- xDisplayManager = 49,*/
- dhcpRequestedIPaddr = 50,
- dhcpIPaddrLeaseTime = 51,
- /*dhcpOptionOverload = 52,*/
- dhcpMessageType = 53,
- dhcpServerIdentifier = 54,
- dhcpParamRequest = 55,
- /*dhcpMsg = 56,
- dhcpMaxMsgSize = 57,*/
- dhcpT1value = 58,
- dhcpT2value = 59,
- /*dhcpClassIdentifier = 60,*/
- dhcpClientIdentifier = 61,
- endOption = 255
-};
-
-typedef struct __attribute__((packed)) _RIP_MSG_FIXED
-{
- uint8_t op;
- uint8_t htype;
- uint8_t hlen;
- uint8_t hops;
- uint32_t xid;
- uint16_t secs;
- uint16_t flags;
- uint8_t ciaddr[4];
- uint8_t yiaddr[4];
- uint8_t siaddr[4];
- uint8_t giaddr[4];
- uint8_t chaddr[6];
-}RIP_MSG_FIXED;
-
-class DhcpClass {
-private:
- uint32_t _dhcpInitialTransactionId;
- uint32_t _dhcpTransactionId;
- uint8_t _dhcpMacAddr[6];
- uint8_t _dhcpLocalIp[4];
- uint8_t _dhcpSubnetMask[4];
- uint8_t _dhcpGatewayIp[4];
- uint8_t _dhcpDhcpServerIp[4];
- uint8_t _dhcpDnsServerIp[4];
- uint32_t _dhcpLeaseTime;
- uint32_t _dhcpT1, _dhcpT2;
- unsigned long _renewInSec;
- unsigned long _rebindInSec;
- unsigned long _timeout;
- unsigned long _responseTimeout;
- unsigned long _lastCheckLeaseMillis;
- uint8_t _dhcp_state;
- EthernetUDP _dhcpUdpSocket;
-
- int request_DHCP_lease();
- void reset_DHCP_lease();
- void presend_DHCP();
- void send_DHCP_MESSAGE(uint8_t, uint16_t);
- void printByte(char *, uint8_t);
-
- uint8_t parseDHCPResponse(unsigned long responseTimeout, uint32_t& transactionId);
-public:
- IPAddress getLocalIp();
- IPAddress getSubnetMask();
- IPAddress getGatewayIp();
- IPAddress getDhcpServerIp();
- IPAddress getDnsServerIp();
-
- int beginWithDHCP(uint8_t *, unsigned long timeout = 60000, unsigned long responseTimeout = 4000);
- int checkLease();
-};
-
-#endif
diff --git a/libraries/Ethernet/src/Dns.cpp b/libraries/Ethernet/src/Dns.cpp
deleted file mode 100644
index cecbcd267c4..00000000000
--- a/libraries/Ethernet/src/Dns.cpp
+++ /dev/null
@@ -1,404 +0,0 @@
-// Arduino DNS client for WizNet5100-based Ethernet shield
-// (c) Copyright 2009-2010 MCQN Ltd.
-// Released under Apache License, version 2.0
-
-#include "utility/w5100.h"
-#include "EthernetUdp.h"
-#include "utility/util.h"
-
-#include "Dns.h"
-#include
-//#include
-#include "Arduino.h"
-
-
-#define SOCKET_NONE 255
-// Various flags and header field values for a DNS message
-#define UDP_HEADER_SIZE 8
-#define DNS_HEADER_SIZE 12
-#define TTL_SIZE 4
-#define QUERY_FLAG (0)
-#define RESPONSE_FLAG (1<<15)
-#define QUERY_RESPONSE_MASK (1<<15)
-#define OPCODE_STANDARD_QUERY (0)
-#define OPCODE_INVERSE_QUERY (1<<11)
-#define OPCODE_STATUS_REQUEST (2<<11)
-#define OPCODE_MASK (15<<11)
-#define AUTHORITATIVE_FLAG (1<<10)
-#define TRUNCATION_FLAG (1<<9)
-#define RECURSION_DESIRED_FLAG (1<<8)
-#define RECURSION_AVAILABLE_FLAG (1<<7)
-#define RESP_NO_ERROR (0)
-#define RESP_FORMAT_ERROR (1)
-#define RESP_SERVER_FAILURE (2)
-#define RESP_NAME_ERROR (3)
-#define RESP_NOT_IMPLEMENTED (4)
-#define RESP_REFUSED (5)
-#define RESP_MASK (15)
-#define TYPE_A (0x0001)
-#define CLASS_IN (0x0001)
-#define LABEL_COMPRESSION_MASK (0xC0)
-// Port number that DNS servers listen on
-#define DNS_PORT 53
-
-// Possible return codes from ProcessResponse
-#define SUCCESS 1
-#define TIMED_OUT -1
-#define INVALID_SERVER -2
-#define TRUNCATED -3
-#define INVALID_RESPONSE -4
-
-void DNSClient::begin(const IPAddress& aDNSServer)
-{
- iDNSServer = aDNSServer;
- iRequestId = 0;
-}
-
-
-int DNSClient::inet_aton(const char* address, IPAddress& result)
-{
- uint16_t acc = 0; // Accumulator
- uint8_t dots = 0;
-
- while (*address)
- {
- char c = *address++;
- if (c >= '0' && c <= '9')
- {
- acc = acc * 10 + (c - '0');
- if (acc > 255) {
- // Value out of [0..255] range
- return 0;
- }
- }
- else if (c == '.')
- {
- if (dots == 3) {
- // Too much dots (there must be 3 dots)
- return 0;
- }
- result[dots++] = acc;
- acc = 0;
- }
- else
- {
- // Invalid char
- return 0;
- }
- }
-
- if (dots != 3) {
- // Too few dots (there must be 3 dots)
- return 0;
- }
- result[3] = acc;
- return 1;
-}
-
-int DNSClient::getHostByName(const char* aHostname, IPAddress& aResult)
-{
- int ret =0;
-
- // See if it's a numeric IP address
- if (inet_aton(aHostname, aResult))
- {
- // It is, our work here is done
- return 1;
- }
-
- // Check we've got a valid DNS server to use
- if (iDNSServer == INADDR_NONE)
- {
- return INVALID_SERVER;
- }
-
- // Find a socket to use
- if (iUdp.begin(1024+(millis() & 0xF)) == 1)
- {
- // Try up to three times
- int retries = 0;
-// while ((retries < 3) && (ret <= 0))
- {
- // Send DNS request
- ret = iUdp.beginPacket(iDNSServer, DNS_PORT);
- if (ret != 0)
- {
- // Now output the request data
- ret = BuildRequest(aHostname);
- if (ret != 0)
- {
- // And finally send the request
- ret = iUdp.endPacket();
- if (ret != 0)
- {
- // Now wait for a response
- int wait_retries = 0;
- ret = TIMED_OUT;
- while ((wait_retries < 3) && (ret == TIMED_OUT))
- {
- ret = ProcessResponse(5000, aResult);
- wait_retries++;
- }
- }
- }
- }
- retries++;
- }
-
- // We're done with the socket now
- iUdp.stop();
- }
-
- return ret;
-}
-
-uint16_t DNSClient::BuildRequest(const char* aName)
-{
- // Build header
- // 1 1 1 1 1 1
- // 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
- // +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
- // | ID |
- // +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
- // |QR| Opcode |AA|TC|RD|RA| Z | RCODE |
- // +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
- // | QDCOUNT |
- // +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
- // | ANCOUNT |
- // +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
- // | NSCOUNT |
- // +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
- // | ARCOUNT |
- // +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
- // As we only support one request at a time at present, we can simplify
- // some of this header
- iRequestId = millis(); // generate a random ID
- uint16_t twoByteBuffer;
-
- // FIXME We should also check that there's enough space available to write to, rather
- // FIXME than assume there's enough space (as the code does at present)
- uint16_t _id = htons(iRequestId);
- iUdp.write((uint8_t*)&_id, sizeof(_id));
-
- twoByteBuffer = htons(QUERY_FLAG | OPCODE_STANDARD_QUERY | RECURSION_DESIRED_FLAG);
- iUdp.write((uint8_t*)&twoByteBuffer, sizeof(twoByteBuffer));
-
- twoByteBuffer = htons(1); // One question record
- iUdp.write((uint8_t*)&twoByteBuffer, sizeof(twoByteBuffer));
-
- twoByteBuffer = 0; // Zero answer records
- iUdp.write((uint8_t*)&twoByteBuffer, sizeof(twoByteBuffer));
-
- iUdp.write((uint8_t*)&twoByteBuffer, sizeof(twoByteBuffer));
- // and zero additional records
- iUdp.write((uint8_t*)&twoByteBuffer, sizeof(twoByteBuffer));
-
- // Build question
- const char* start =aName;
- const char* end =start;
- uint8_t len;
- // Run through the name being requested
- while (*end)
- {
- // Find out how long this section of the name is
- end = start;
- while (*end && (*end != '.') )
- {
- end++;
- }
-
- if (end-start > 0)
- {
- // Write out the size of this section
- len = end-start;
- iUdp.write(&len, sizeof(len));
- // And then write out the section
- iUdp.write((uint8_t*)start, end-start);
- }
- start = end+1;
- }
-
- // We've got to the end of the question name, so
- // terminate it with a zero-length section
- len = 0;
- iUdp.write(&len, sizeof(len));
- // Finally the type and class of question
- twoByteBuffer = htons(TYPE_A);
- iUdp.write((uint8_t*)&twoByteBuffer, sizeof(twoByteBuffer));
-
- twoByteBuffer = htons(CLASS_IN); // Internet class of question
- iUdp.write((uint8_t*)&twoByteBuffer, sizeof(twoByteBuffer));
- // Success! Everything buffered okay
- return 1;
-}
-
-
-uint16_t DNSClient::ProcessResponse(uint16_t aTimeout, IPAddress& aAddress)
-{
- uint32_t startTime = millis();
-
- // Wait for a response packet
- while(iUdp.parsePacket() <= 0)
- {
- if((millis() - startTime) > aTimeout)
- return TIMED_OUT;
- delay(50);
- }
-
- // We've had a reply!
- // Read the UDP header
- uint8_t header[DNS_HEADER_SIZE]; // Enough space to reuse for the DNS header
- // Check that it's a response from the right server and the right port
- if ( (iDNSServer != iUdp.remoteIP()) ||
- (iUdp.remotePort() != DNS_PORT) )
- {
- // It's not from who we expected
- return INVALID_SERVER;
- }
-
- // Read through the rest of the response
- if (iUdp.available() < DNS_HEADER_SIZE)
- {
- return TRUNCATED;
- }
- iUdp.read(header, DNS_HEADER_SIZE);
-
- uint16_t header_flags = word(header[2], header[3]);
- // Check that it's a response to this request
- if ( (iRequestId != word(header[0], header[1])) ||
- ((header_flags & QUERY_RESPONSE_MASK) != (uint16_t)RESPONSE_FLAG) )
- {
- // Mark the entire packet as read
- iUdp.flush();
- return INVALID_RESPONSE;
- }
- // Check for any errors in the response (or in our request)
- // although we don't do anything to get round these
- if ( (header_flags & TRUNCATION_FLAG) || (header_flags & RESP_MASK) )
- {
- // Mark the entire packet as read
- iUdp.flush();
- return -5; //INVALID_RESPONSE;
- }
-
- // And make sure we've got (at least) one answer
- uint16_t answerCount = word(header[6], header[7]);
- if (answerCount == 0 )
- {
- // Mark the entire packet as read
- iUdp.flush();
- return -6; //INVALID_RESPONSE;
- }
-
- // Skip over any questions
- for (uint16_t i =0; i < word(header[4], header[5]); i++)
- {
- // Skip over the name
- uint8_t len;
- do
- {
- iUdp.read(&len, sizeof(len));
- if (len > 0)
- {
- // Don't need to actually read the data out for the string, just
- // advance ptr to beyond it
- while(len--)
- {
- iUdp.read(); // we don't care about the returned byte
- }
- }
- } while (len != 0);
-
- // Now jump over the type and class
- for (int i =0; i < 4; i++)
- {
- iUdp.read(); // we don't care about the returned byte
- }
- }
-
- // Now we're up to the bit we're interested in, the answer
- // There might be more than one answer (although we'll just use the first
- // type A answer) and some authority and additional resource records but
- // we're going to ignore all of them.
-
- for (uint16_t i =0; i < answerCount; i++)
- {
- // Skip the name
- uint8_t len;
- do
- {
- iUdp.read(&len, sizeof(len));
- if ((len & LABEL_COMPRESSION_MASK) == 0)
- {
- // It's just a normal label
- if (len > 0)
- {
- // And it's got a length
- // Don't need to actually read the data out for the string,
- // just advance ptr to beyond it
- while(len--)
- {
- iUdp.read(); // we don't care about the returned byte
- }
- }
- }
- else
- {
- // This is a pointer to a somewhere else in the message for the
- // rest of the name. We don't care about the name, and RFC1035
- // says that a name is either a sequence of labels ended with a
- // 0 length octet or a pointer or a sequence of labels ending in
- // a pointer. Either way, when we get here we're at the end of
- // the name
- // Skip over the pointer
- iUdp.read(); // we don't care about the returned byte
- // And set len so that we drop out of the name loop
- len = 0;
- }
- } while (len != 0);
-
- // Check the type and class
- uint16_t answerType;
- uint16_t answerClass;
- iUdp.read((uint8_t*)&answerType, sizeof(answerType));
- iUdp.read((uint8_t*)&answerClass, sizeof(answerClass));
-
- // Ignore the Time-To-Live as we don't do any caching
- for (int i =0; i < TTL_SIZE; i++)
- {
- iUdp.read(); // we don't care about the returned byte
- }
-
- // And read out the length of this answer
- // Don't need header_flags anymore, so we can reuse it here
- iUdp.read((uint8_t*)&header_flags, sizeof(header_flags));
-
- if ( (htons(answerType) == TYPE_A) && (htons(answerClass) == CLASS_IN) )
- {
- if (htons(header_flags) != 4)
- {
- // It's a weird size
- // Mark the entire packet as read
- iUdp.flush();
- return -9;//INVALID_RESPONSE;
- }
- iUdp.read(aAddress.raw_address(), 4);
- return SUCCESS;
- }
- else
- {
- // This isn't an answer type we're after, move onto the next one
- for (uint16_t i =0; i < htons(header_flags); i++)
- {
- iUdp.read(); // we don't care about the returned byte
- }
- }
- }
-
- // Mark the entire packet as read
- iUdp.flush();
-
- // If we get here then we haven't found an answer
- return -10;//INVALID_RESPONSE;
-}
-
diff --git a/libraries/Ethernet/src/Dns.h b/libraries/Ethernet/src/Dns.h
deleted file mode 100644
index 6bcb98ab9eb..00000000000
--- a/libraries/Ethernet/src/Dns.h
+++ /dev/null
@@ -1,41 +0,0 @@
-// Arduino DNS client for WizNet5100-based Ethernet shield
-// (c) Copyright 2009-2010 MCQN Ltd.
-// Released under Apache License, version 2.0
-
-#ifndef DNSClient_h
-#define DNSClient_h
-
-#include
-
-class DNSClient
-{
-public:
- // ctor
- void begin(const IPAddress& aDNSServer);
-
- /** Convert a numeric IP address string into a four-byte IP address.
- @param aIPAddrString IP address to convert
- @param aResult IPAddress structure to store the returned IP address
- @result 1 if aIPAddrString was successfully converted to an IP address,
- else error code
- */
- int inet_aton(const char *aIPAddrString, IPAddress& aResult);
-
- /** Resolve the given hostname to an IP address.
- @param aHostname Name to be resolved
- @param aResult IPAddress structure to store the returned IP address
- @result 1 if aIPAddrString was successfully converted to an IP address,
- else error code
- */
- int getHostByName(const char* aHostname, IPAddress& aResult);
-
-protected:
- uint16_t BuildRequest(const char* aName);
- uint16_t ProcessResponse(uint16_t aTimeout, IPAddress& aAddress);
-
- IPAddress iDNSServer;
- uint16_t iRequestId;
- EthernetUDP iUdp;
-};
-
-#endif
diff --git a/libraries/Ethernet/src/Ethernet.cpp b/libraries/Ethernet/src/Ethernet.cpp
deleted file mode 100644
index 54cf8d64cb0..00000000000
--- a/libraries/Ethernet/src/Ethernet.cpp
+++ /dev/null
@@ -1,136 +0,0 @@
-#include "utility/w5100.h"
-#include "Ethernet.h"
-#include "Dhcp.h"
-
-// XXX: don't make assumptions about the value of MAX_SOCK_NUM.
-uint8_t EthernetClass::_state[MAX_SOCK_NUM] = {
- 0, 0, 0, 0 };
-uint16_t EthernetClass::_server_port[MAX_SOCK_NUM] = {
- 0, 0, 0, 0 };
-
-int EthernetClass::begin(uint8_t *mac_address, unsigned long timeout, unsigned long responseTimeout)
-{
- static DhcpClass s_dhcp;
- _dhcp = &s_dhcp;
-
-
- // Initialise the basic info
- W5100.init();
- SPI.beginTransaction(SPI_ETHERNET_SETTINGS);
- W5100.setMACAddress(mac_address);
- W5100.setIPAddress(IPAddress(0,0,0,0).raw_address());
- SPI.endTransaction();
-
- // Now try to get our config info from a DHCP server
- int ret = _dhcp->beginWithDHCP(mac_address, timeout, responseTimeout);
- if(ret == 1)
- {
- // We've successfully found a DHCP server and got our configuration info, so set things
- // accordingly
- SPI.beginTransaction(SPI_ETHERNET_SETTINGS);
- W5100.setIPAddress(_dhcp->getLocalIp().raw_address());
- W5100.setGatewayIp(_dhcp->getGatewayIp().raw_address());
- W5100.setSubnetMask(_dhcp->getSubnetMask().raw_address());
- SPI.endTransaction();
- _dnsServerAddress = _dhcp->getDnsServerIp();
- }
-
- return ret;
-}
-
-void EthernetClass::begin(uint8_t *mac_address, IPAddress local_ip)
-{
- // Assume the DNS server will be the machine on the same network as the local IP
- // but with last octet being '1'
- IPAddress dns_server = local_ip;
- dns_server[3] = 1;
- begin(mac_address, local_ip, dns_server);
-}
-
-void EthernetClass::begin(uint8_t *mac_address, IPAddress local_ip, IPAddress dns_server)
-{
- // Assume the gateway will be the machine on the same network as the local IP
- // but with last octet being '1'
- IPAddress gateway = local_ip;
- gateway[3] = 1;
- begin(mac_address, local_ip, dns_server, gateway);
-}
-
-void EthernetClass::begin(uint8_t *mac_address, IPAddress local_ip, IPAddress dns_server, IPAddress gateway)
-{
- IPAddress subnet(255, 255, 255, 0);
- begin(mac_address, local_ip, dns_server, gateway, subnet);
-}
-
-void EthernetClass::begin(uint8_t *mac, IPAddress local_ip, IPAddress dns_server, IPAddress gateway, IPAddress subnet)
-{
- W5100.init();
- SPI.beginTransaction(SPI_ETHERNET_SETTINGS);
- W5100.setMACAddress(mac);
- W5100.setIPAddress(local_ip.raw_address());
- W5100.setGatewayIp(gateway.raw_address());
- W5100.setSubnetMask(subnet.raw_address());
- SPI.endTransaction();
- _dnsServerAddress = dns_server;
-}
-
-int EthernetClass::maintain(){
- int rc = DHCP_CHECK_NONE;
- if(_dhcp != NULL){
- //we have a pointer to dhcp, use it
- rc = _dhcp->checkLease();
- switch ( rc ){
- case DHCP_CHECK_NONE:
- //nothing done
- break;
- case DHCP_CHECK_RENEW_OK:
- case DHCP_CHECK_REBIND_OK:
- //we might have got a new IP.
- SPI.beginTransaction(SPI_ETHERNET_SETTINGS);
- W5100.setIPAddress(_dhcp->getLocalIp().raw_address());
- W5100.setGatewayIp(_dhcp->getGatewayIp().raw_address());
- W5100.setSubnetMask(_dhcp->getSubnetMask().raw_address());
- SPI.endTransaction();
- _dnsServerAddress = _dhcp->getDnsServerIp();
- break;
- default:
- //this is actually a error, it will retry though
- break;
- }
- }
- return rc;
-}
-
-IPAddress EthernetClass::localIP()
-{
- IPAddress ret;
- SPI.beginTransaction(SPI_ETHERNET_SETTINGS);
- W5100.getIPAddress(ret.raw_address());
- SPI.endTransaction();
- return ret;
-}
-
-IPAddress EthernetClass::subnetMask()
-{
- IPAddress ret;
- SPI.beginTransaction(SPI_ETHERNET_SETTINGS);
- W5100.getSubnetMask(ret.raw_address());
- SPI.endTransaction();
- return ret;
-}
-
-IPAddress EthernetClass::gatewayIP()
-{
- IPAddress ret;
- SPI.beginTransaction(SPI_ETHERNET_SETTINGS);
- W5100.getGatewayIp(ret.raw_address());
- SPI.endTransaction();
- return ret;
-}
-
-IPAddress EthernetClass::dnsServerIP()
-{
- return _dnsServerAddress;
-}
-
-EthernetClass Ethernet;
diff --git a/libraries/Ethernet/src/Ethernet.h b/libraries/Ethernet/src/Ethernet.h
deleted file mode 100644
index 083df4427b0..00000000000
--- a/libraries/Ethernet/src/Ethernet.h
+++ /dev/null
@@ -1,41 +0,0 @@
-#ifndef ethernet_h
-#define ethernet_h
-
-#include
-//#include "w5100.h"
-#include "IPAddress.h"
-#include "EthernetClient.h"
-#include "EthernetServer.h"
-#include "Dhcp.h"
-
-#define MAX_SOCK_NUM 4
-
-class EthernetClass {
-private:
- IPAddress _dnsServerAddress;
- DhcpClass* _dhcp;
-public:
- static uint8_t _state[MAX_SOCK_NUM];
- static uint16_t _server_port[MAX_SOCK_NUM];
- // Initialise the Ethernet shield to use the provided MAC address and gain the rest of the
- // configuration through DHCP.
- // Returns 0 if the DHCP configuration failed, and 1 if it succeeded
- int begin(uint8_t *mac_address, unsigned long timeout = 60000, unsigned long responseTimeout = 4000);
- void begin(uint8_t *mac_address, IPAddress local_ip);
- void begin(uint8_t *mac_address, IPAddress local_ip, IPAddress dns_server);
- void begin(uint8_t *mac_address, IPAddress local_ip, IPAddress dns_server, IPAddress gateway);
- void begin(uint8_t *mac_address, IPAddress local_ip, IPAddress dns_server, IPAddress gateway, IPAddress subnet);
- int maintain();
-
- IPAddress localIP();
- IPAddress subnetMask();
- IPAddress gatewayIP();
- IPAddress dnsServerIP();
-
- friend class EthernetClient;
- friend class EthernetServer;
-};
-
-extern EthernetClass Ethernet;
-
-#endif
diff --git a/libraries/Ethernet/src/EthernetClient.cpp b/libraries/Ethernet/src/EthernetClient.cpp
deleted file mode 100644
index 75765e51a1e..00000000000
--- a/libraries/Ethernet/src/EthernetClient.cpp
+++ /dev/null
@@ -1,177 +0,0 @@
-#include "utility/w5100.h"
-#include "utility/socket.h"
-
-extern "C" {
- #include "string.h"
-}
-
-#include "Arduino.h"
-
-#include "Ethernet.h"
-#include "EthernetClient.h"
-#include "EthernetServer.h"
-#include "Dns.h"
-
-uint16_t EthernetClient::_srcport = 49152; //Use IANA recommended ephemeral port range 49152-65535
-
-EthernetClient::EthernetClient() : _sock(MAX_SOCK_NUM) {
-}
-
-EthernetClient::EthernetClient(uint8_t sock) : _sock(sock) {
-}
-
-int EthernetClient::connect(const char* host, uint16_t port) {
- // Look up the host first
- int ret = 0;
- DNSClient dns;
- IPAddress remote_addr;
-
- dns.begin(Ethernet.dnsServerIP());
- ret = dns.getHostByName(host, remote_addr);
- if (ret == 1) {
- return connect(remote_addr, port);
- } else {
- return ret;
- }
-}
-
-int EthernetClient::connect(IPAddress ip, uint16_t port) {
- if (_sock != MAX_SOCK_NUM)
- return 0;
-
- for (int i = 0; i < MAX_SOCK_NUM; i++) {
- uint8_t s = socketStatus(i);
- if (s == SnSR::CLOSED || s == SnSR::FIN_WAIT || s == SnSR::CLOSE_WAIT) {
- _sock = i;
- break;
- }
- }
-
- if (_sock == MAX_SOCK_NUM)
- return 0;
-
- _srcport++;
- if (_srcport == 0) _srcport = 49152; //Use IANA recommended ephemeral port range 49152-65535
- socket(_sock, SnMR::TCP, _srcport, 0);
-
- if (!::connect(_sock, rawIPAddress(ip), port)) {
- _sock = MAX_SOCK_NUM;
- return 0;
- }
-
- while (status() != SnSR::ESTABLISHED) {
- delay(1);
- if (status() == SnSR::CLOSED) {
- _sock = MAX_SOCK_NUM;
- return 0;
- }
- }
-
- return 1;
-}
-
-size_t EthernetClient::write(uint8_t b) {
- return write(&b, 1);
-}
-
-size_t EthernetClient::write(const uint8_t *buf, size_t size) {
- if (_sock == MAX_SOCK_NUM) {
- setWriteError();
- return 0;
- }
- if (!send(_sock, buf, size)) {
- setWriteError();
- return 0;
- }
- return size;
-}
-
-int EthernetClient::available() {
- if (_sock != MAX_SOCK_NUM)
- return recvAvailable(_sock);
- return 0;
-}
-
-int EthernetClient::read() {
- uint8_t b;
- if ( recv(_sock, &b, 1) > 0 )
- {
- // recv worked
- return b;
- }
- else
- {
- // No data available
- return -1;
- }
-}
-
-int EthernetClient::read(uint8_t *buf, size_t size) {
- return recv(_sock, buf, size);
-}
-
-int EthernetClient::peek() {
- uint8_t b;
- // Unlike recv, peek doesn't check to see if there's any data available, so we must
- if (!available())
- return -1;
- ::peek(_sock, &b);
- return b;
-}
-
-void EthernetClient::flush() {
- ::flush(_sock);
-}
-
-void EthernetClient::stop() {
- if (_sock == MAX_SOCK_NUM)
- return;
-
- // attempt to close the connection gracefully (send a FIN to other side)
- disconnect(_sock);
- unsigned long start = millis();
-
- // wait up to a second for the connection to close
- uint8_t s;
- do {
- s = status();
- if (s == SnSR::CLOSED)
- break; // exit the loop
- delay(1);
- } while (millis() - start < 1000);
-
- // if it hasn't closed, close it forcefully
- if (s != SnSR::CLOSED)
- close(_sock);
-
- EthernetClass::_server_port[_sock] = 0;
- _sock = MAX_SOCK_NUM;
-}
-
-uint8_t EthernetClient::connected() {
- if (_sock == MAX_SOCK_NUM) return 0;
-
- uint8_t s = status();
- return !(s == SnSR::LISTEN || s == SnSR::CLOSED || s == SnSR::FIN_WAIT ||
- (s == SnSR::CLOSE_WAIT && !available()));
-}
-
-uint8_t EthernetClient::status() {
- if (_sock == MAX_SOCK_NUM) return SnSR::CLOSED;
- return socketStatus(_sock);
-}
-
-// the next function allows us to use the client returned by
-// EthernetServer::available() as the condition in an if-statement.
-
-EthernetClient::operator bool() {
- return _sock != MAX_SOCK_NUM;
-}
-
-bool EthernetClient::operator==(const EthernetClient& rhs) {
- return _sock == rhs._sock && _sock != MAX_SOCK_NUM && rhs._sock != MAX_SOCK_NUM;
-}
-
-uint8_t EthernetClient::getSocketNumber() {
- return _sock;
-}
diff --git a/libraries/Ethernet/src/EthernetClient.h b/libraries/Ethernet/src/EthernetClient.h
deleted file mode 100644
index 52a3b8f4284..00000000000
--- a/libraries/Ethernet/src/EthernetClient.h
+++ /dev/null
@@ -1,42 +0,0 @@
-#ifndef ethernetclient_h
-#define ethernetclient_h
-#include "Arduino.h"
-#include "Print.h"
-#include "Client.h"
-#include "IPAddress.h"
-
-class EthernetClient : public Client {
-
-public:
- EthernetClient();
- EthernetClient(uint8_t sock);
-
- uint8_t status();
- virtual int connect(IPAddress ip, uint16_t port);
- virtual int connect(const char *host, uint16_t port);
- virtual size_t write(uint8_t);
- virtual size_t write(const uint8_t *buf, size_t size);
- virtual int available();
- virtual int read();
- virtual int read(uint8_t *buf, size_t size);
- virtual int peek();
- virtual void flush();
- virtual void stop();
- virtual uint8_t connected();
- virtual operator bool();
- virtual bool operator==(const bool value) { return bool() == value; }
- virtual bool operator!=(const bool value) { return bool() != value; }
- virtual bool operator==(const EthernetClient&);
- virtual bool operator!=(const EthernetClient& rhs) { return !this->operator==(rhs); };
- uint8_t getSocketNumber();
-
- friend class EthernetServer;
-
- using Print::write;
-
-private:
- static uint16_t _srcport;
- uint8_t _sock;
-};
-
-#endif
diff --git a/libraries/Ethernet/src/EthernetServer.cpp b/libraries/Ethernet/src/EthernetServer.cpp
deleted file mode 100644
index cfa813eb7be..00000000000
--- a/libraries/Ethernet/src/EthernetServer.cpp
+++ /dev/null
@@ -1,92 +0,0 @@
-#include "utility/w5100.h"
-#include "utility/socket.h"
-extern "C" {
-#include "string.h"
-}
-
-#include "Ethernet.h"
-#include "EthernetClient.h"
-#include "EthernetServer.h"
-
-EthernetServer::EthernetServer(uint16_t port)
-{
- _port = port;
-}
-
-void EthernetServer::begin()
-{
- for (int sock = 0; sock < MAX_SOCK_NUM; sock++) {
- EthernetClient client(sock);
- if (client.status() == SnSR::CLOSED) {
- socket(sock, SnMR::TCP, _port, 0);
- listen(sock);
- EthernetClass::_server_port[sock] = _port;
- break;
- }
- }
-}
-
-void EthernetServer::accept()
-{
- int listening = 0;
-
- for (int sock = 0; sock < MAX_SOCK_NUM; sock++) {
- EthernetClient client(sock);
-
- if (EthernetClass::_server_port[sock] == _port) {
- if (client.status() == SnSR::LISTEN) {
- listening = 1;
- }
- else if (client.status() == SnSR::CLOSE_WAIT && !client.available()) {
- client.stop();
- }
- }
- }
-
- if (!listening) {
- begin();
- }
-}
-
-EthernetClient EthernetServer::available()
-{
- accept();
-
- for (int sock = 0; sock < MAX_SOCK_NUM; sock++) {
- EthernetClient client(sock);
- if (EthernetClass::_server_port[sock] == _port) {
- uint8_t s = client.status();
- if (s == SnSR::ESTABLISHED || s == SnSR::CLOSE_WAIT) {
- if (client.available()) {
- // XXX: don't always pick the lowest numbered socket.
- return client;
- }
- }
- }
- }
-
- return EthernetClient(MAX_SOCK_NUM);
-}
-
-size_t EthernetServer::write(uint8_t b)
-{
- return write(&b, 1);
-}
-
-size_t EthernetServer::write(const uint8_t *buffer, size_t size)
-{
- size_t n = 0;
-
- accept();
-
- for (int sock = 0; sock < MAX_SOCK_NUM; sock++) {
- EthernetClient client(sock);
-
- if (EthernetClass::_server_port[sock] == _port &&
- client.status() == SnSR::ESTABLISHED) {
- n += client.write(buffer, size);
- }
- }
-
- return n;
-}
diff --git a/libraries/Ethernet/src/EthernetServer.h b/libraries/Ethernet/src/EthernetServer.h
deleted file mode 100644
index 86ccafe9690..00000000000
--- a/libraries/Ethernet/src/EthernetServer.h
+++ /dev/null
@@ -1,22 +0,0 @@
-#ifndef ethernetserver_h
-#define ethernetserver_h
-
-#include "Server.h"
-
-class EthernetClient;
-
-class EthernetServer :
-public Server {
-private:
- uint16_t _port;
- void accept();
-public:
- EthernetServer(uint16_t);
- EthernetClient available();
- virtual void begin();
- virtual size_t write(uint8_t);
- virtual size_t write(const uint8_t *buf, size_t size);
- using Print::write;
-};
-
-#endif
diff --git a/libraries/Ethernet/src/EthernetUdp.cpp b/libraries/Ethernet/src/EthernetUdp.cpp
deleted file mode 100644
index 8066783aefa..00000000000
--- a/libraries/Ethernet/src/EthernetUdp.cpp
+++ /dev/null
@@ -1,250 +0,0 @@
-/*
- * Udp.cpp: Library to send/receive UDP packets with the Arduino ethernet shield.
- * This version only offers minimal wrapping of socket.c/socket.h
- * Drop Udp.h/.cpp into the Ethernet library directory at hardware/libraries/Ethernet/
- *
- * MIT License:
- * Copyright (c) 2008 Bjoern Hartmann
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- *
- * bjoern@cs.stanford.edu 12/30/2008
- */
-
-#include "utility/w5100.h"
-#include "utility/socket.h"
-#include "Ethernet.h"
-#include "Udp.h"
-#include "Dns.h"
-
-/* Constructor */
-EthernetUDP::EthernetUDP() : _sock(MAX_SOCK_NUM) {}
-
-/* Start EthernetUDP socket, listening at local port PORT */
-uint8_t EthernetUDP::begin(uint16_t port) {
- if (_sock != MAX_SOCK_NUM)
- return 0;
-
- for (int i = 0; i < MAX_SOCK_NUM; i++) {
- uint8_t s = socketStatus(i);
- if (s == SnSR::CLOSED || s == SnSR::FIN_WAIT) {
- _sock = i;
- break;
- }
- }
-
- if (_sock == MAX_SOCK_NUM)
- return 0;
-
- _port = port;
- _remaining = 0;
- socket(_sock, SnMR::UDP, _port, 0);
-
- return 1;
-}
-
-/* return number of bytes available in the current packet,
- will return zero if parsePacket hasn't been called yet */
-int EthernetUDP::available() {
- return _remaining;
-}
-
-/* Release any resources being used by this EthernetUDP instance */
-void EthernetUDP::stop()
-{
- if (_sock == MAX_SOCK_NUM)
- return;
-
- close(_sock);
-
- EthernetClass::_server_port[_sock] = 0;
- _sock = MAX_SOCK_NUM;
-}
-
-int EthernetUDP::beginPacket(const char *host, uint16_t port)
-{
- // Look up the host first
- int ret = 0;
- DNSClient dns;
- IPAddress remote_addr;
-
- dns.begin(Ethernet.dnsServerIP());
- ret = dns.getHostByName(host, remote_addr);
- if (ret == 1) {
- return beginPacket(remote_addr, port);
- } else {
- return ret;
- }
-}
-
-int EthernetUDP::beginPacket(IPAddress ip, uint16_t port)
-{
- _offset = 0;
- return startUDP(_sock, rawIPAddress(ip), port);
-}
-
-int EthernetUDP::endPacket()
-{
- return sendUDP(_sock);
-}
-
-size_t EthernetUDP::write(uint8_t byte)
-{
- return write(&byte, 1);
-}
-
-size_t EthernetUDP::write(const uint8_t *buffer, size_t size)
-{
- uint16_t bytes_written = bufferData(_sock, _offset, buffer, size);
- _offset += bytes_written;
- return bytes_written;
-}
-
-int EthernetUDP::parsePacket()
-{
- // discard any remaining bytes in the last packet
- while (_remaining) {
- // could this fail (loop endlessly) if _remaining > 0 and recv in read fails?
- // should only occur if recv fails after telling us the data is there, lets
- // hope the w5100 always behaves :)
- read();
- }
-
- if (recvAvailable(_sock) > 0)
- {
- //HACK - hand-parse the UDP packet using TCP recv method
- uint8_t tmpBuf[8];
- int ret =0;
- //read 8 header bytes and get IP and port from it
- ret = recv(_sock,tmpBuf,8);
- if (ret > 0)
- {
- _remoteIP = tmpBuf;
- _remotePort = tmpBuf[4];
- _remotePort = (_remotePort << 8) + tmpBuf[5];
- _remaining = tmpBuf[6];
- _remaining = (_remaining << 8) + tmpBuf[7];
-
- // When we get here, any remaining bytes are the data
- ret = _remaining;
- }
- return ret;
- }
- // There aren't any packets available
- return 0;
-}
-
-int EthernetUDP::read()
-{
- uint8_t byte;
-
- if ((_remaining > 0) && (recv(_sock, &byte, 1) > 0))
- {
- // We read things without any problems
- _remaining--;
- return byte;
- }
-
- // If we get here, there's no data available
- return -1;
-}
-
-int EthernetUDP::read(unsigned char* buffer, size_t len)
-{
-
- if (_remaining > 0)
- {
-
- int got;
-
- if (_remaining <= len)
- {
- // data should fit in the buffer
- got = recv(_sock, buffer, _remaining);
- }
- else
- {
- // too much data for the buffer,
- // grab as much as will fit
- got = recv(_sock, buffer, len);
- }
-
- if (got > 0)
- {
- _remaining -= got;
- return got;
- }
-
- }
-
- // If we get here, there's no data available or recv failed
- return -1;
-
-}
-
-int EthernetUDP::peek()
-{
- uint8_t b;
- // Unlike recv, peek doesn't check to see if there's any data available, so we must.
- // If the user hasn't called parsePacket yet then return nothing otherwise they
- // may get the UDP header
- if (!_remaining)
- return -1;
- ::peek(_sock, &b);
- return b;
-}
-
-void EthernetUDP::flush()
-{
- // TODO: we should wait for TX buffer to be emptied
-}
-
-/* Start EthernetUDP socket, listening at local port PORT */
-uint8_t EthernetUDP::beginMulticast(IPAddress ip, uint16_t port)
-{
- if (_sock != MAX_SOCK_NUM)
- return 0;
-
- for (int i = 0; i < MAX_SOCK_NUM; i++) {
- uint8_t s = W5100.readSnSR(i);
- if (s == SnSR::CLOSED || s == SnSR::FIN_WAIT) {
- _sock = i;
- break;
- }
- }
-
- if (_sock == MAX_SOCK_NUM)
- return 0;
-
- // Calculate MAC address from Multicast IP Address
- byte mac[] = { 0x01, 0x00, 0x5E, 0x00, 0x00, 0x00 };
-
- mac[3] = ip[1] & 0x7F;
- mac[4] = ip[2];
- mac[5] = ip[3];
-
- W5100.writeSnDIPR(_sock, rawIPAddress(ip)); //239.255.0.1
- W5100.writeSnDPORT(_sock, port);
- W5100.writeSnDHAR(_sock,mac);
-
- _remaining = 0;
- socket(_sock, SnMR::UDP, port, SnMR::MULTI);
- return 1;
-}
-
-
diff --git a/libraries/Ethernet/src/EthernetUdp.h b/libraries/Ethernet/src/EthernetUdp.h
deleted file mode 100644
index 549e3551774..00000000000
--- a/libraries/Ethernet/src/EthernetUdp.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Udp.cpp: Library to send/receive UDP packets with the Arduino ethernet shield.
- * This version only offers minimal wrapping of socket.c/socket.h
- * Drop Udp.h/.cpp into the Ethernet library directory at hardware/libraries/Ethernet/
- *
- * NOTE: UDP is fast, but has some important limitations (thanks to Warren Gray for mentioning these)
- * 1) UDP does not guarantee the order in which assembled UDP packets are received. This
- * might not happen often in practice, but in larger network topologies, a UDP
- * packet can be received out of sequence.
- * 2) UDP does not guard against lost packets - so packets *can* disappear without the sender being
- * aware of it. Again, this may not be a concern in practice on small local networks.
- * For more information, see http://www.cafeaulait.org/course/week12/35.html
- *
- * MIT License:
- * Copyright (c) 2008 Bjoern Hartmann
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- *
- * bjoern@cs.stanford.edu 12/30/2008
- */
-
-#ifndef ethernetudp_h
-#define ethernetudp_h
-
-#include
-
-#define UDP_TX_PACKET_MAX_SIZE 24
-
-class EthernetUDP : public UDP {
-private:
- uint16_t _port; // local port to listen on
- IPAddress _remoteIP; // remote IP address for the incoming packet whilst it's being processed
- uint16_t _remotePort; // remote port for the incoming packet whilst it's being processed
- uint16_t _offset; // offset into the packet being sent
-
-protected:
- uint8_t _sock; // socket ID for Wiz5100
- uint16_t _remaining; // remaining bytes of incoming packet yet to be processed
-
-public:
- EthernetUDP(); // Constructor
- virtual uint8_t begin(uint16_t); // initialize, start listening on specified port. Returns 1 if successful, 0 if there are no sockets available to use
- virtual uint8_t beginMulticast(IPAddress, uint16_t); // initialize, start listening on specified port. Returns 1 if successful, 0 if there are no sockets available to use
- virtual void stop(); // Finish with the UDP socket
-
- // Sending UDP packets
-
- // Start building up a packet to send to the remote host specific in ip and port
- // Returns 1 if successful, 0 if there was a problem with the supplied IP address or port
- virtual int beginPacket(IPAddress ip, uint16_t port);
- // Start building up a packet to send to the remote host specific in host and port
- // Returns 1 if successful, 0 if there was a problem resolving the hostname or port
- virtual int beginPacket(const char *host, uint16_t port);
- // Finish off this packet and send it
- // Returns 1 if the packet was sent successfully, 0 if there was an error
- virtual int endPacket();
- // Write a single byte into the packet
- virtual size_t write(uint8_t);
- // Write size bytes from buffer into the packet
- virtual size_t write(const uint8_t *buffer, size_t size);
-
- using Print::write;
-
- // Start processing the next available incoming packet
- // Returns the size of the packet in bytes, or 0 if no packets are available
- virtual int parsePacket();
- // Number of bytes remaining in the current packet
- virtual int available();
- // Read a single byte from the current packet
- virtual int read();
- // Read up to len bytes from the current packet and place them into buffer
- // Returns the number of bytes read, or 0 if none are available
- virtual int read(unsigned char* buffer, size_t len);
- // Read up to len characters from the current packet and place them into buffer
- // Returns the number of characters read, or 0 if none are available
- virtual int read(char* buffer, size_t len) { return read((unsigned char*)buffer, len); };
- // Return the next byte from the current packet without moving on to the next byte
- virtual int peek();
- virtual void flush(); // Finish reading the current packet
-
- // Return the IP address of the host who sent the current incoming packet
- virtual IPAddress remoteIP() { return _remoteIP; };
- // Return the port of the host who sent the current incoming packet
- virtual uint16_t remotePort() { return _remotePort; };
-};
-
-#endif
diff --git a/libraries/Ethernet/src/utility/socket.cpp b/libraries/Ethernet/src/utility/socket.cpp
deleted file mode 100644
index 9254b7439e7..00000000000
--- a/libraries/Ethernet/src/utility/socket.cpp
+++ /dev/null
@@ -1,469 +0,0 @@
-#include "w5100.h"
-#include "socket.h"
-
-static uint16_t local_port;
-
-/**
- * @brief This Socket function initialize the channel in perticular mode, and set the port and wait for W5100 done it.
- * @return 1 for success else 0.
- */
-uint8_t socket(SOCKET s, uint8_t protocol, uint16_t port, uint8_t flag)
-{
- if ((protocol == SnMR::TCP) || (protocol == SnMR::UDP) || (protocol == SnMR::IPRAW) || (protocol == SnMR::MACRAW) || (protocol == SnMR::PPPOE))
- {
- close(s);
- SPI.beginTransaction(SPI_ETHERNET_SETTINGS);
- W5100.writeSnMR(s, protocol | flag);
- if (port != 0) {
- W5100.writeSnPORT(s, port);
- }
- else {
- local_port++; // if don't set the source port, set local_port number.
- W5100.writeSnPORT(s, local_port);
- }
-
- W5100.execCmdSn(s, Sock_OPEN);
- SPI.endTransaction();
- return 1;
- }
-
- return 0;
-}
-
-
-uint8_t socketStatus(SOCKET s)
-{
- SPI.beginTransaction(SPI_ETHERNET_SETTINGS);
- uint8_t status = W5100.readSnSR(s);
- SPI.endTransaction();
- return status;
-}
-
-
-/**
- * @brief This function close the socket and parameter is "s" which represent the socket number
- */
-void close(SOCKET s)
-{
- SPI.beginTransaction(SPI_ETHERNET_SETTINGS);
- W5100.execCmdSn(s, Sock_CLOSE);
- W5100.writeSnIR(s, 0xFF);
- SPI.endTransaction();
-}
-
-
-/**
- * @brief This function established the connection for the channel in passive (server) mode. This function waits for the request from the peer.
- * @return 1 for success else 0.
- */
-uint8_t listen(SOCKET s)
-{
- SPI.beginTransaction(SPI_ETHERNET_SETTINGS);
- if (W5100.readSnSR(s) != SnSR::INIT) {
- SPI.endTransaction();
- return 0;
- }
- W5100.execCmdSn(s, Sock_LISTEN);
- SPI.endTransaction();
- return 1;
-}
-
-
-/**
- * @brief This function established the connection for the channel in Active (client) mode.
- * This function waits for the untill the connection is established.
- *
- * @return 1 for success else 0.
- */
-uint8_t connect(SOCKET s, uint8_t * addr, uint16_t port)
-{
- if
- (
- ((addr[0] == 0xFF) && (addr[1] == 0xFF) && (addr[2] == 0xFF) && (addr[3] == 0xFF)) ||
- ((addr[0] == 0x00) && (addr[1] == 0x00) && (addr[2] == 0x00) && (addr[3] == 0x00)) ||
- (port == 0x00)
- )
- return 0;
-
- // set destination IP
- SPI.beginTransaction(SPI_ETHERNET_SETTINGS);
- W5100.writeSnDIPR(s, addr);
- W5100.writeSnDPORT(s, port);
- W5100.execCmdSn(s, Sock_CONNECT);
- SPI.endTransaction();
-
- return 1;
-}
-
-
-
-/**
- * @brief This function used for disconnect the socket and parameter is "s" which represent the socket number
- * @return 1 for success else 0.
- */
-void disconnect(SOCKET s)
-{
- SPI.beginTransaction(SPI_ETHERNET_SETTINGS);
- W5100.execCmdSn(s, Sock_DISCON);
- SPI.endTransaction();
-}
-
-
-/**
- * @brief This function used to send the data in TCP mode
- * @return 1 for success else 0.
- */
-uint16_t send(SOCKET s, const uint8_t * buf, uint16_t len)
-{
- uint8_t status=0;
- uint16_t ret=0;
- uint16_t freesize=0;
-
- if (len > W5100.SSIZE)
- ret = W5100.SSIZE; // check size not to exceed MAX size.
- else
- ret = len;
-
- // if freebuf is available, start.
- do
- {
- SPI.beginTransaction(SPI_ETHERNET_SETTINGS);
- freesize = W5100.getTXFreeSize(s);
- status = W5100.readSnSR(s);
- SPI.endTransaction();
- if ((status != SnSR::ESTABLISHED) && (status != SnSR::CLOSE_WAIT))
- {
- ret = 0;
- break;
- }
- yield();
- }
- while (freesize < ret);
-
- // copy data
- SPI.beginTransaction(SPI_ETHERNET_SETTINGS);
- W5100.send_data_processing(s, (uint8_t *)buf, ret);
- W5100.execCmdSn(s, Sock_SEND);
-
- /* +2008.01 bj */
- while ( (W5100.readSnIR(s) & SnIR::SEND_OK) != SnIR::SEND_OK )
- {
- /* m2008.01 [bj] : reduce code */
- if ( W5100.readSnSR(s) == SnSR::CLOSED )
- {
- SPI.endTransaction();
- close(s);
- return 0;
- }
- SPI.endTransaction();
- yield();
- SPI.beginTransaction(SPI_ETHERNET_SETTINGS);
- }
- /* +2008.01 bj */
- W5100.writeSnIR(s, SnIR::SEND_OK);
- SPI.endTransaction();
- return ret;
-}
-
-
-/**
- * @brief This function is an application I/F function which is used to receive the data in TCP mode.
- * It continues to wait for data as much as the application wants to receive.
- *
- * @return received data size for success else -1.
- */
-int16_t recv(SOCKET s, uint8_t *buf, int16_t len)
-{
- // Check how much data is available
- SPI.beginTransaction(SPI_ETHERNET_SETTINGS);
- int16_t ret = W5100.getRXReceivedSize(s);
- if ( ret == 0 )
- {
- // No data available.
- uint8_t status = W5100.readSnSR(s);
- if ( status == SnSR::LISTEN || status == SnSR::CLOSED || status == SnSR::CLOSE_WAIT )
- {
- // The remote end has closed its side of the connection, so this is the eof state
- ret = 0;
- }
- else
- {
- // The connection is still up, but there's no data waiting to be read
- ret = -1;
- }
- }
- else if (ret > len)
- {
- ret = len;
- }
-
- if ( ret > 0 )
- {
- W5100.recv_data_processing(s, buf, ret);
- W5100.execCmdSn(s, Sock_RECV);
- }
- SPI.endTransaction();
- return ret;
-}
-
-
-int16_t recvAvailable(SOCKET s)
-{
- SPI.beginTransaction(SPI_ETHERNET_SETTINGS);
- int16_t ret = W5100.getRXReceivedSize(s);
- SPI.endTransaction();
- return ret;
-}
-
-
-/**
- * @brief Returns the first byte in the receive queue (no checking)
- *
- * @return
- */
-uint16_t peek(SOCKET s, uint8_t *buf)
-{
- SPI.beginTransaction(SPI_ETHERNET_SETTINGS);
- W5100.recv_data_processing(s, buf, 1, 1);
- SPI.endTransaction();
- return 1;
-}
-
-
-/**
- * @brief This function is an application I/F function which is used to send the data for other then TCP mode.
- * Unlike TCP transmission, The peer's destination address and the port is needed.
- *
- * @return This function return send data size for success else -1.
- */
-uint16_t sendto(SOCKET s, const uint8_t *buf, uint16_t len, uint8_t *addr, uint16_t port)
-{
- uint16_t ret=0;
-
- if (len > W5100.SSIZE) ret = W5100.SSIZE; // check size not to exceed MAX size.
- else ret = len;
-
- if
- (
- ((addr[0] == 0x00) && (addr[1] == 0x00) && (addr[2] == 0x00) && (addr[3] == 0x00)) ||
- ((port == 0x00)) ||(ret == 0)
- )
- {
- /* +2008.01 [bj] : added return value */
- ret = 0;
- }
- else
- {
- SPI.beginTransaction(SPI_ETHERNET_SETTINGS);
- W5100.writeSnDIPR(s, addr);
- W5100.writeSnDPORT(s, port);
-
- // copy data
- W5100.send_data_processing(s, (uint8_t *)buf, ret);
- W5100.execCmdSn(s, Sock_SEND);
-
- /* +2008.01 bj */
- while ( (W5100.readSnIR(s) & SnIR::SEND_OK) != SnIR::SEND_OK )
- {
- if (W5100.readSnIR(s) & SnIR::TIMEOUT)
- {
- /* +2008.01 [bj]: clear interrupt */
- W5100.writeSnIR(s, (SnIR::SEND_OK | SnIR::TIMEOUT)); /* clear SEND_OK & TIMEOUT */
- SPI.endTransaction();
- return 0;
- }
- SPI.endTransaction();
- yield();
- SPI.beginTransaction(SPI_ETHERNET_SETTINGS);
- }
-
- /* +2008.01 bj */
- W5100.writeSnIR(s, SnIR::SEND_OK);
- SPI.endTransaction();
- }
- return ret;
-}
-
-
-/**
- * @brief This function is an application I/F function which is used to receive the data in other then
- * TCP mode. This function is used to receive UDP, IP_RAW and MAC_RAW mode, and handle the header as well.
- *
- * @return This function return received data size for success else -1.
- */
-uint16_t recvfrom(SOCKET s, uint8_t *buf, uint16_t len, uint8_t *addr, uint16_t *port)
-{
- uint8_t head[8];
- uint16_t data_len=0;
- uint16_t ptr=0;
-
- if ( len > 0 )
- {
- SPI.beginTransaction(SPI_ETHERNET_SETTINGS);
- ptr = W5100.readSnRX_RD(s);
- switch (W5100.readSnMR(s) & 0x07)
- {
- case SnMR::UDP :
- W5100.read_data(s, ptr, head, 0x08);
- ptr += 8;
- // read peer's IP address, port number.
- addr[0] = head[0];
- addr[1] = head[1];
- addr[2] = head[2];
- addr[3] = head[3];
- *port = head[4];
- *port = (*port << 8) + head[5];
- data_len = head[6];
- data_len = (data_len << 8) + head[7];
-
- W5100.read_data(s, ptr, buf, data_len); // data copy.
- ptr += data_len;
-
- W5100.writeSnRX_RD(s, ptr);
- break;
-
- case SnMR::IPRAW :
- W5100.read_data(s, ptr, head, 0x06);
- ptr += 6;
-
- addr[0] = head[0];
- addr[1] = head[1];
- addr[2] = head[2];
- addr[3] = head[3];
- data_len = head[4];
- data_len = (data_len << 8) + head[5];
-
- W5100.read_data(s, ptr, buf, data_len); // data copy.
- ptr += data_len;
-
- W5100.writeSnRX_RD(s, ptr);
- break;
-
- case SnMR::MACRAW:
- W5100.read_data(s, ptr, head, 2);
- ptr+=2;
- data_len = head[0];
- data_len = (data_len<<8) + head[1] - 2;
-
- W5100.read_data(s, ptr, buf, data_len);
- ptr += data_len;
- W5100.writeSnRX_RD(s, ptr);
- break;
-
- default :
- break;
- }
- W5100.execCmdSn(s, Sock_RECV);
- SPI.endTransaction();
- }
- return data_len;
-}
-
-/**
- * @brief Wait for buffered transmission to complete.
- */
-void flush(SOCKET s) {
- // TODO
-}
-
-uint16_t igmpsend(SOCKET s, const uint8_t * buf, uint16_t len)
-{
- uint16_t ret=0;
-
- if (len > W5100.SSIZE)
- ret = W5100.SSIZE; // check size not to exceed MAX size.
- else
- ret = len;
-
- if (ret == 0)
- return 0;
-
- SPI.beginTransaction(SPI_ETHERNET_SETTINGS);
- W5100.send_data_processing(s, (uint8_t *)buf, ret);
- W5100.execCmdSn(s, Sock_SEND);
-
- while ( (W5100.readSnIR(s) & SnIR::SEND_OK) != SnIR::SEND_OK )
- {
- if (W5100.readSnIR(s) & SnIR::TIMEOUT)
- {
- /* in case of igmp, if send fails, then socket closed */
- /* if you want change, remove this code. */
- SPI.endTransaction();
- close(s);
- return 0;
- }
- SPI.endTransaction();
- yield();
- SPI.beginTransaction(SPI_ETHERNET_SETTINGS);
- }
-
- W5100.writeSnIR(s, SnIR::SEND_OK);
- SPI.endTransaction();
- return ret;
-}
-
-uint16_t bufferData(SOCKET s, uint16_t offset, const uint8_t* buf, uint16_t len)
-{
- uint16_t ret =0;
- SPI.beginTransaction(SPI_ETHERNET_SETTINGS);
- if (len > W5100.getTXFreeSize(s))
- {
- ret = W5100.getTXFreeSize(s); // check size not to exceed MAX size.
- }
- else
- {
- ret = len;
- }
- W5100.send_data_processing_offset(s, offset, buf, ret);
- SPI.endTransaction();
- return ret;
-}
-
-int startUDP(SOCKET s, uint8_t* addr, uint16_t port)
-{
- if
- (
- ((addr[0] == 0x00) && (addr[1] == 0x00) && (addr[2] == 0x00) && (addr[3] == 0x00)) ||
- ((port == 0x00))
- )
- {
- return 0;
- }
- else
- {
- SPI.beginTransaction(SPI_ETHERNET_SETTINGS);
- W5100.writeSnDIPR(s, addr);
- W5100.writeSnDPORT(s, port);
- SPI.endTransaction();
- return 1;
- }
-}
-
-int sendUDP(SOCKET s)
-{
- SPI.beginTransaction(SPI_ETHERNET_SETTINGS);
- W5100.execCmdSn(s, Sock_SEND);
-
- /* +2008.01 bj */
- while ( (W5100.readSnIR(s) & SnIR::SEND_OK) != SnIR::SEND_OK )
- {
- if (W5100.readSnIR(s) & SnIR::TIMEOUT)
- {
- /* +2008.01 [bj]: clear interrupt */
- W5100.writeSnIR(s, (SnIR::SEND_OK|SnIR::TIMEOUT));
- SPI.endTransaction();
- return 0;
- }
- SPI.endTransaction();
- yield();
- SPI.beginTransaction(SPI_ETHERNET_SETTINGS);
- }
-
- /* +2008.01 bj */
- W5100.writeSnIR(s, SnIR::SEND_OK);
- SPI.endTransaction();
-
- /* Sent ok */
- return 1;
-}
-
diff --git a/libraries/Ethernet/src/utility/socket.h b/libraries/Ethernet/src/utility/socket.h
deleted file mode 100644
index 37ba8542471..00000000000
--- a/libraries/Ethernet/src/utility/socket.h
+++ /dev/null
@@ -1,44 +0,0 @@
-#ifndef _SOCKET_H_
-#define _SOCKET_H_
-
-#include "utility/w5100.h"
-
-extern uint8_t socket(SOCKET s, uint8_t protocol, uint16_t port, uint8_t flag); // Opens a socket(TCP or UDP or IP_RAW mode)
-extern uint8_t socketStatus(SOCKET s);
-extern void close(SOCKET s); // Close socket
-extern uint8_t connect(SOCKET s, uint8_t * addr, uint16_t port); // Establish TCP connection (Active connection)
-extern void disconnect(SOCKET s); // disconnect the connection
-extern uint8_t listen(SOCKET s); // Establish TCP connection (Passive connection)
-extern uint16_t send(SOCKET s, const uint8_t * buf, uint16_t len); // Send data (TCP)
-extern int16_t recv(SOCKET s, uint8_t * buf, int16_t len); // Receive data (TCP)
-extern int16_t recvAvailable(SOCKET s);
-extern uint16_t peek(SOCKET s, uint8_t *buf);
-extern uint16_t sendto(SOCKET s, const uint8_t * buf, uint16_t len, uint8_t * addr, uint16_t port); // Send data (UDP/IP RAW)
-extern uint16_t recvfrom(SOCKET s, uint8_t * buf, uint16_t len, uint8_t * addr, uint16_t *port); // Receive data (UDP/IP RAW)
-extern void flush(SOCKET s); // Wait for transmission to complete
-
-extern uint16_t igmpsend(SOCKET s, const uint8_t * buf, uint16_t len);
-
-// Functions to allow buffered UDP send (i.e. where the UDP datagram is built up over a
-// number of calls before being sent
-/*
- @brief This function sets up a UDP datagram, the data for which will be provided by one
- or more calls to bufferData and then finally sent with sendUDP.
- @return 1 if the datagram was successfully set up, or 0 if there was an error
-*/
-extern int startUDP(SOCKET s, uint8_t* addr, uint16_t port);
-/*
- @brief This function copies up to len bytes of data from buf into a UDP datagram to be
- sent later by sendUDP. Allows datagrams to be built up from a series of bufferData calls.
- @return Number of bytes successfully buffered
-*/
-uint16_t bufferData(SOCKET s, uint16_t offset, const uint8_t* buf, uint16_t len);
-/*
- @brief Send a UDP datagram built up from a sequence of startUDP followed by one or more
- calls to bufferData.
- @return 1 if the datagram was successfully sent, or 0 if there was an error
-*/
-int sendUDP(SOCKET s);
-
-#endif
-/* _SOCKET_H_ */
diff --git a/libraries/Ethernet/src/utility/util.h b/libraries/Ethernet/src/utility/util.h
deleted file mode 100644
index 33d32a97e7f..00000000000
--- a/libraries/Ethernet/src/utility/util.h
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifndef UTIL_H
-#define UTIL_H
-
-#define htons(x) ( ((x)<< 8 & 0xFF00) | \
- ((x)>> 8 & 0x00FF) )
-#define ntohs(x) htons(x)
-
-#define htonl(x) ( ((x)<<24 & 0xFF000000UL) | \
- ((x)<< 8 & 0x00FF0000UL) | \
- ((x)>> 8 & 0x0000FF00UL) | \
- ((x)>>24 & 0x000000FFUL) )
-#define ntohl(x) htonl(x)
-
-#endif
diff --git a/libraries/Ethernet/src/utility/w5100.cpp b/libraries/Ethernet/src/utility/w5100.cpp
deleted file mode 100644
index f616d0634ea..00000000000
--- a/libraries/Ethernet/src/utility/w5100.cpp
+++ /dev/null
@@ -1,225 +0,0 @@
-/*
- * Copyright (c) 2010 by Arduino LLC. All rights reserved.
- *
- * This file is free software; you can redistribute it and/or modify
- * it under the terms of either the GNU General Public License version 2
- * or the GNU Lesser General Public License version 2.1, both as
- * published by the Free Software Foundation.
- */
-
-#include
-#include
-
-#include "w5100.h"
-
-// W5100 controller instance
-W5100Class W5100;
-
-#define TX_RX_MAX_BUF_SIZE 2048
-#define TX_BUF 0x1100
-#define RX_BUF (TX_BUF + TX_RX_MAX_BUF_SIZE)
-
-#define TXBUF_BASE 0x4000
-#define RXBUF_BASE 0x6000
-
-void W5100Class::init(void)
-{
- delay(300);
-
-#if !defined(SPI_HAS_EXTENDED_CS_PIN_HANDLING)
- SPI.begin();
- initSS();
-#else
- SPI.begin(ETHERNET_SHIELD_SPI_CS);
- // Set clock to 4Mhz (W5100 should support up to about 14Mhz)
- SPI.setClockDivider(ETHERNET_SHIELD_SPI_CS, 21);
- SPI.setDataMode(ETHERNET_SHIELD_SPI_CS, SPI_MODE0);
-#endif
- SPI.beginTransaction(SPI_ETHERNET_SETTINGS);
- writeMR(1< SSIZE)
- {
- // Wrap around circular buffer
- uint16_t size = SSIZE - offset;
- write(dstAddr, data, size);
- write(SBASE[s], data + size, len - size);
- }
- else {
- write(dstAddr, data, len);
- }
-
- ptr += len;
- writeSnTX_WR(s, ptr);
-}
-
-
-void W5100Class::recv_data_processing(SOCKET s, uint8_t *data, uint16_t len, uint8_t peek)
-{
- uint16_t ptr;
- ptr = readSnRX_RD(s);
- read_data(s, ptr, data, len);
- if (!peek)
- {
- ptr += len;
- writeSnRX_RD(s, ptr);
- }
-}
-
-void W5100Class::read_data(SOCKET s, volatile uint16_t src, volatile uint8_t *dst, uint16_t len)
-{
- uint16_t size;
- uint16_t src_mask;
- uint16_t src_ptr;
-
- src_mask = src & RMASK;
- src_ptr = RBASE[s] + src_mask;
-
- if( (src_mask + len) > RSIZE )
- {
- size = RSIZE - src_mask;
- read(src_ptr, (uint8_t *)dst, size);
- dst += size;
- read(RBASE[s], (uint8_t *) dst, len - size);
- }
- else
- read(src_ptr, (uint8_t *) dst, len);
-}
-
-
-uint8_t W5100Class::write(uint16_t _addr, uint8_t _data)
-{
-#if !defined(SPI_HAS_EXTENDED_CS_PIN_HANDLING)
- setSS();
- SPI.transfer(0xF0);
- SPI.transfer(_addr >> 8);
- SPI.transfer(_addr & 0xFF);
- SPI.transfer(_data);
- resetSS();
-#else
- SPI.transfer(ETHERNET_SHIELD_SPI_CS, 0xF0, SPI_CONTINUE);
- SPI.transfer(ETHERNET_SHIELD_SPI_CS, _addr >> 8, SPI_CONTINUE);
- SPI.transfer(ETHERNET_SHIELD_SPI_CS, _addr & 0xFF, SPI_CONTINUE);
- SPI.transfer(ETHERNET_SHIELD_SPI_CS, _data);
-#endif
- return 1;
-}
-
-uint16_t W5100Class::write(uint16_t _addr, const uint8_t *_buf, uint16_t _len)
-{
- for (uint16_t i=0; i<_len; i++)
- {
-#if !defined(SPI_HAS_EXTENDED_CS_PIN_HANDLING)
- setSS();
- SPI.transfer(0xF0);
- SPI.transfer(_addr >> 8);
- SPI.transfer(_addr & 0xFF);
- _addr++;
- SPI.transfer(_buf[i]);
- resetSS();
-#else
- SPI.transfer(ETHERNET_SHIELD_SPI_CS, 0xF0, SPI_CONTINUE);
- SPI.transfer(ETHERNET_SHIELD_SPI_CS, _addr >> 8, SPI_CONTINUE);
- SPI.transfer(ETHERNET_SHIELD_SPI_CS, _addr & 0xFF, SPI_CONTINUE);
- SPI.transfer(ETHERNET_SHIELD_SPI_CS, _buf[i]);
- _addr++;
-#endif
- }
- return _len;
-}
-
-uint8_t W5100Class::read(uint16_t _addr)
-{
-#if !defined(SPI_HAS_EXTENDED_CS_PIN_HANDLING)
- setSS();
- SPI.transfer(0x0F);
- SPI.transfer(_addr >> 8);
- SPI.transfer(_addr & 0xFF);
- uint8_t _data = SPI.transfer(0);
- resetSS();
-#else
- SPI.transfer(ETHERNET_SHIELD_SPI_CS, 0x0F, SPI_CONTINUE);
- SPI.transfer(ETHERNET_SHIELD_SPI_CS, _addr >> 8, SPI_CONTINUE);
- SPI.transfer(ETHERNET_SHIELD_SPI_CS, _addr & 0xFF, SPI_CONTINUE);
- uint8_t _data = SPI.transfer(ETHERNET_SHIELD_SPI_CS, 0);
-#endif
- return _data;
-}
-
-uint16_t W5100Class::read(uint16_t _addr, uint8_t *_buf, uint16_t _len)
-{
- for (uint16_t i=0; i<_len; i++)
- {
-#if !defined(SPI_HAS_EXTENDED_CS_PIN_HANDLING)
- setSS();
- SPI.transfer(0x0F);
- SPI.transfer(_addr >> 8);
- SPI.transfer(_addr & 0xFF);
- _addr++;
- _buf[i] = SPI.transfer(0);
- resetSS();
-#else
- SPI.transfer(ETHERNET_SHIELD_SPI_CS, 0x0F, SPI_CONTINUE);
- SPI.transfer(ETHERNET_SHIELD_SPI_CS, _addr >> 8, SPI_CONTINUE);
- SPI.transfer(ETHERNET_SHIELD_SPI_CS, _addr & 0xFF, SPI_CONTINUE);
- _buf[i] = SPI.transfer(ETHERNET_SHIELD_SPI_CS, 0);
- _addr++;
-#endif
- }
- return _len;
-}
-
-void W5100Class::execCmdSn(SOCKET s, SockCMD _cmd) {
- // Send command to socket
- writeSnCR(s, _cmd);
- // Wait for command to complete
- while (readSnCR(s))
- ;
-}
diff --git a/libraries/Ethernet/src/utility/w5100.h b/libraries/Ethernet/src/utility/w5100.h
deleted file mode 100644
index 15de01c8383..00000000000
--- a/libraries/Ethernet/src/utility/w5100.h
+++ /dev/null
@@ -1,426 +0,0 @@
-/*
- * Copyright (c) 2010 by Arduino LLC. All rights reserved.
- *
- * This file is free software; you can redistribute it and/or modify
- * it under the terms of either the GNU General Public License version 2
- * or the GNU Lesser General Public License version 2.1, both as
- * published by the Free Software Foundation.
- */
-
-#ifndef W5100_H_INCLUDED
-#define W5100_H_INCLUDED
-
-#include
-
-#define ETHERNET_SHIELD_SPI_CS 10
-
-#define MAX_SOCK_NUM 4
-
-typedef uint8_t SOCKET;
-
-#define IDM_OR 0x8000
-#define IDM_AR0 0x8001
-#define IDM_AR1 0x8002
-#define IDM_DR 0x8003
-/*
-class MR {
-public:
- static const uint8_t RST = 0x80;
- static const uint8_t PB = 0x10;
- static const uint8_t PPPOE = 0x08;
- static const uint8_t LB = 0x04;
- static const uint8_t AI = 0x02;
- static const uint8_t IND = 0x01;
-};
-*/
-/*
-class IR {
-public:
- static const uint8_t CONFLICT = 0x80;
- static const uint8_t UNREACH = 0x40;
- static const uint8_t PPPoE = 0x20;
- static const uint8_t SOCK0 = 0x01;
- static const uint8_t SOCK1 = 0x02;
- static const uint8_t SOCK2 = 0x04;
- static const uint8_t SOCK3 = 0x08;
- static inline uint8_t SOCK(SOCKET ch) { return (0x01 << ch); };
-};
-*/
-
-class SnMR {
-public:
- static const uint8_t CLOSE = 0x00;
- static const uint8_t TCP = 0x01;
- static const uint8_t UDP = 0x02;
- static const uint8_t IPRAW = 0x03;
- static const uint8_t MACRAW = 0x04;
- static const uint8_t PPPOE = 0x05;
- static const uint8_t ND = 0x20;
- static const uint8_t MULTI = 0x80;
-};
-
-enum SockCMD {
- Sock_OPEN = 0x01,
- Sock_LISTEN = 0x02,
- Sock_CONNECT = 0x04,
- Sock_DISCON = 0x08,
- Sock_CLOSE = 0x10,
- Sock_SEND = 0x20,
- Sock_SEND_MAC = 0x21,
- Sock_SEND_KEEP = 0x22,
- Sock_RECV = 0x40
-};
-
-/*class SnCmd {
-public:
- static const uint8_t OPEN = 0x01;
- static const uint8_t LISTEN = 0x02;
- static const uint8_t CONNECT = 0x04;
- static const uint8_t DISCON = 0x08;
- static const uint8_t CLOSE = 0x10;
- static const uint8_t SEND = 0x20;
- static const uint8_t SEND_MAC = 0x21;
- static const uint8_t SEND_KEEP = 0x22;
- static const uint8_t RECV = 0x40;
-};
-*/
-
-class SnIR {
-public:
- static const uint8_t SEND_OK = 0x10;
- static const uint8_t TIMEOUT = 0x08;
- static const uint8_t RECV = 0x04;
- static const uint8_t DISCON = 0x02;
- static const uint8_t CON = 0x01;
-};
-
-class SnSR {
-public:
- static const uint8_t CLOSED = 0x00;
- static const uint8_t INIT = 0x13;
- static const uint8_t LISTEN = 0x14;
- static const uint8_t SYNSENT = 0x15;
- static const uint8_t SYNRECV = 0x16;
- static const uint8_t ESTABLISHED = 0x17;
- static const uint8_t FIN_WAIT = 0x18;
- static const uint8_t CLOSING = 0x1A;
- static const uint8_t TIME_WAIT = 0x1B;
- static const uint8_t CLOSE_WAIT = 0x1C;
- static const uint8_t LAST_ACK = 0x1D;
- static const uint8_t UDP = 0x22;
- static const uint8_t IPRAW = 0x32;
- static const uint8_t MACRAW = 0x42;
- static const uint8_t PPPOE = 0x5F;
-};
-
-class IPPROTO {
-public:
- static const uint8_t IP = 0;
- static const uint8_t ICMP = 1;
- static const uint8_t IGMP = 2;
- static const uint8_t GGP = 3;
- static const uint8_t TCP = 6;
- static const uint8_t PUP = 12;
- static const uint8_t UDP = 17;
- static const uint8_t IDP = 22;
- static const uint8_t ND = 77;
- static const uint8_t RAW = 255;
-};
-
-class W5100Class {
-
-public:
- void init();
-
- /**
- * @brief This function is being used for copy the data form Receive buffer of the chip to application buffer.
- *
- * It calculate the actual physical address where one has to read
- * the data from Receive buffer. Here also take care of the condition while it exceed
- * the Rx memory uper-bound of socket.
- */
- void read_data(SOCKET s, volatile uint16_t src, volatile uint8_t * dst, uint16_t len);
-
- /**
- * @brief This function is being called by send() and sendto() function also.
- *
- * This function read the Tx write pointer register and after copy the data in buffer update the Tx write pointer
- * register. User should read upper byte first and lower byte later to get proper value.
- */
- void send_data_processing(SOCKET s, const uint8_t *data, uint16_t len);
- /**
- * @brief A copy of send_data_processing that uses the provided ptr for the
- * write offset. Only needed for the "streaming" UDP API, where
- * a single UDP packet is built up over a number of calls to
- * send_data_processing_ptr, because TX_WR doesn't seem to get updated
- * correctly in those scenarios
- * @param ptr value to use in place of TX_WR. If 0, then the value is read
- * in from TX_WR
- * @return New value for ptr, to be used in the next call
- */
-// FIXME Update documentation
- void send_data_processing_offset(SOCKET s, uint16_t data_offset, const uint8_t *data, uint16_t len);
-
- /**
- * @brief This function is being called by recv() also.
- *
- * This function read the Rx read pointer register
- * and after copy the data from receive buffer update the Rx write pointer register.
- * User should read upper byte first and lower byte later to get proper value.
- */
- void recv_data_processing(SOCKET s, uint8_t *data, uint16_t len, uint8_t peek = 0);
-
- inline void setGatewayIp(uint8_t *_addr);
- inline void getGatewayIp(uint8_t *_addr);
-
- inline void setSubnetMask(uint8_t *_addr);
- inline void getSubnetMask(uint8_t *_addr);
-
- inline void setMACAddress(uint8_t * addr);
- inline void getMACAddress(uint8_t * addr);
-
- inline void setIPAddress(uint8_t * addr);
- inline void getIPAddress(uint8_t * addr);
-
- inline void setRetransmissionTime(uint16_t timeout);
- inline void setRetransmissionCount(uint8_t _retry);
-
- void execCmdSn(SOCKET s, SockCMD _cmd);
-
- uint16_t getTXFreeSize(SOCKET s);
- uint16_t getRXReceivedSize(SOCKET s);
-
-
- // W5100 Registers
- // ---------------
-private:
- static uint8_t write(uint16_t _addr, uint8_t _data);
- static uint16_t write(uint16_t addr, const uint8_t *buf, uint16_t len);
- static uint8_t read(uint16_t addr);
- static uint16_t read(uint16_t addr, uint8_t *buf, uint16_t len);
-
-#define __GP_REGISTER8(name, address) \
- static inline void write##name(uint8_t _data) { \
- write(address, _data); \
- } \
- static inline uint8_t read##name() { \
- return read(address); \
- }
-#define __GP_REGISTER16(name, address) \
- static void write##name(uint16_t _data) { \
- write(address, _data >> 8); \
- write(address+1, _data & 0xFF); \
- } \
- static uint16_t read##name() { \
- uint16_t res = read(address); \
- res = (res << 8) + read(address + 1); \
- return res; \
- }
-#define __GP_REGISTER_N(name, address, size) \
- static uint16_t write##name(uint8_t *_buff) { \
- return write(address, _buff, size); \
- } \
- static uint16_t read##name(uint8_t *_buff) { \
- return read(address, _buff, size); \
- }
-
-public:
- __GP_REGISTER8 (MR, 0x0000); // Mode
- __GP_REGISTER_N(GAR, 0x0001, 4); // Gateway IP address
- __GP_REGISTER_N(SUBR, 0x0005, 4); // Subnet mask address
- __GP_REGISTER_N(SHAR, 0x0009, 6); // Source MAC address
- __GP_REGISTER_N(SIPR, 0x000F, 4); // Source IP address
- __GP_REGISTER8 (IR, 0x0015); // Interrupt
- __GP_REGISTER8 (IMR, 0x0016); // Interrupt Mask
- __GP_REGISTER16(RTR, 0x0017); // Timeout address
- __GP_REGISTER8 (RCR, 0x0019); // Retry count
- __GP_REGISTER8 (RMSR, 0x001A); // Receive memory size
- __GP_REGISTER8 (TMSR, 0x001B); // Transmit memory size
- __GP_REGISTER8 (PATR, 0x001C); // Authentication type address in PPPoE mode
- __GP_REGISTER8 (PTIMER, 0x0028); // PPP LCP Request Timer
- __GP_REGISTER8 (PMAGIC, 0x0029); // PPP LCP Magic Number
- __GP_REGISTER_N(UIPR, 0x002A, 4); // Unreachable IP address in UDP mode
- __GP_REGISTER16(UPORT, 0x002E); // Unreachable Port address in UDP mode
-
-#undef __GP_REGISTER8
-#undef __GP_REGISTER16
-#undef __GP_REGISTER_N
-
- // W5100 Socket registers
- // ----------------------
-private:
- static inline uint8_t readSn(SOCKET _s, uint16_t _addr);
- static inline uint8_t writeSn(SOCKET _s, uint16_t _addr, uint8_t _data);
- static inline uint16_t readSn(SOCKET _s, uint16_t _addr, uint8_t *_buf, uint16_t len);
- static inline uint16_t writeSn(SOCKET _s, uint16_t _addr, uint8_t *_buf, uint16_t len);
-
- static const uint16_t CH_BASE = 0x0400;
- static const uint16_t CH_SIZE = 0x0100;
-
-#define __SOCKET_REGISTER8(name, address) \
- static inline void write##name(SOCKET _s, uint8_t _data) { \
- writeSn(_s, address, _data); \
- } \
- static inline uint8_t read##name(SOCKET _s) { \
- return readSn(_s, address); \
- }
-#define __SOCKET_REGISTER16(name, address) \
- static void write##name(SOCKET _s, uint16_t _data) { \
- writeSn(_s, address, _data >> 8); \
- writeSn(_s, address+1, _data & 0xFF); \
- } \
- static uint16_t read##name(SOCKET _s) { \
- uint16_t res = readSn(_s, address); \
- uint16_t res2 = readSn(_s,address + 1); \
- res = res << 8; \
- res2 = res2 & 0xFF; \
- res = res | res2; \
- return res; \
- }
-#define __SOCKET_REGISTER_N(name, address, size) \
- static uint16_t write##name(SOCKET _s, uint8_t *_buff) { \
- return writeSn(_s, address, _buff, size); \
- } \
- static uint16_t read##name(SOCKET _s, uint8_t *_buff) { \
- return readSn(_s, address, _buff, size); \
- }
-
-public:
- __SOCKET_REGISTER8(SnMR, 0x0000) // Mode
- __SOCKET_REGISTER8(SnCR, 0x0001) // Command
- __SOCKET_REGISTER8(SnIR, 0x0002) // Interrupt
- __SOCKET_REGISTER8(SnSR, 0x0003) // Status
- __SOCKET_REGISTER16(SnPORT, 0x0004) // Source Port
- __SOCKET_REGISTER_N(SnDHAR, 0x0006, 6) // Destination Hardw Addr
- __SOCKET_REGISTER_N(SnDIPR, 0x000C, 4) // Destination IP Addr
- __SOCKET_REGISTER16(SnDPORT, 0x0010) // Destination Port
- __SOCKET_REGISTER16(SnMSSR, 0x0012) // Max Segment Size
- __SOCKET_REGISTER8(SnPROTO, 0x0014) // Protocol in IP RAW Mode
- __SOCKET_REGISTER8(SnTOS, 0x0015) // IP TOS
- __SOCKET_REGISTER8(SnTTL, 0x0016) // IP TTL
- __SOCKET_REGISTER16(SnTX_FSR, 0x0020) // TX Free Size
- __SOCKET_REGISTER16(SnTX_RD, 0x0022) // TX Read Pointer
- __SOCKET_REGISTER16(SnTX_WR, 0x0024) // TX Write Pointer
- __SOCKET_REGISTER16(SnRX_RSR, 0x0026) // RX Free Size
- __SOCKET_REGISTER16(SnRX_RD, 0x0028) // RX Read Pointer
- __SOCKET_REGISTER16(SnRX_WR, 0x002A) // RX Write Pointer (supported?)
-
-#undef __SOCKET_REGISTER8
-#undef __SOCKET_REGISTER16
-#undef __SOCKET_REGISTER_N
-
-
-private:
- static const uint8_t RST = 7; // Reset BIT
-
- static const int SOCKETS = 4;
- static const uint16_t SMASK = 0x07FF; // Tx buffer MASK
- static const uint16_t RMASK = 0x07FF; // Rx buffer MASK
-public:
- static const uint16_t SSIZE = 2048; // Max Tx buffer size
-private:
- static const uint16_t RSIZE = 2048; // Max Rx buffer size
- uint16_t SBASE[SOCKETS]; // Tx buffer base address
- uint16_t RBASE[SOCKETS]; // Rx buffer base address
-
-private:
-#if !defined(SPI_HAS_EXTENDED_CS_PIN_HANDLING)
- #define SPI_ETHERNET_SETTINGS SPISettings(4000000, MSBFIRST, SPI_MODE0)
- #if defined(ARDUINO_ARCH_AVR)
- #if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
- inline static void initSS() { DDRB |= _BV(4); };
- inline static void setSS() { PORTB &= ~_BV(4); };
- inline static void resetSS() { PORTB |= _BV(4); };
- #elif defined(__AVR_ATmega32U4__)
- inline static void initSS() { DDRB |= _BV(6); };
- inline static void setSS() { PORTB &= ~_BV(6); };
- inline static void resetSS() { PORTB |= _BV(6); };
- #elif defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB162__)
- inline static void initSS() { DDRB |= _BV(0); };
- inline static void setSS() { PORTB &= ~_BV(0); };
- inline static void resetSS() { PORTB |= _BV(0); };
- #else
- inline static void initSS() { DDRB |= _BV(2); };
- inline static void setSS() { PORTB &= ~_BV(2); };
- inline static void resetSS() { PORTB |= _BV(2); };
- #endif
- #elif defined(__ARDUINO_ARC__)
- inline static void initSS() { pinMode(10, OUTPUT); };
- inline static void setSS() { digitalWrite(10, LOW); };
- inline static void resetSS() { digitalWrite(10, HIGH); };
- #else
- inline static void initSS() {
- *portModeRegister(digitalPinToPort(ETHERNET_SHIELD_SPI_CS)) |= digitalPinToBitMask(ETHERNET_SHIELD_SPI_CS);
- }
- inline static void setSS() {
- *portOutputRegister(digitalPinToPort(ETHERNET_SHIELD_SPI_CS)) &= ~digitalPinToBitMask(ETHERNET_SHIELD_SPI_CS);
- }
- inline static void resetSS() {
- *portOutputRegister(digitalPinToPort(ETHERNET_SHIELD_SPI_CS)) |= digitalPinToBitMask(ETHERNET_SHIELD_SPI_CS);
- }
- #endif
-#else
- #define SPI_ETHERNET_SETTINGS ETHERNET_SHIELD_SPI_CS,SPISettings(4000000, MSBFIRST, SPI_MODE0)
- // initSS(), setSS(), resetSS() not needed with EXTENDED_CS_PIN_HANDLING
-#endif
-};
-
-extern W5100Class W5100;
-
-uint8_t W5100Class::readSn(SOCKET _s, uint16_t _addr) {
- return read(CH_BASE + _s * CH_SIZE + _addr);
-}
-
-uint8_t W5100Class::writeSn(SOCKET _s, uint16_t _addr, uint8_t _data) {
- return write(CH_BASE + _s * CH_SIZE + _addr, _data);
-}
-
-uint16_t W5100Class::readSn(SOCKET _s, uint16_t _addr, uint8_t *_buf, uint16_t _len) {
- return read(CH_BASE + _s * CH_SIZE + _addr, _buf, _len);
-}
-
-uint16_t W5100Class::writeSn(SOCKET _s, uint16_t _addr, uint8_t *_buf, uint16_t _len) {
- return write(CH_BASE + _s * CH_SIZE + _addr, _buf, _len);
-}
-
-void W5100Class::getGatewayIp(uint8_t *_addr) {
- readGAR(_addr);
-}
-
-void W5100Class::setGatewayIp(uint8_t *_addr) {
- writeGAR(_addr);
-}
-
-void W5100Class::getSubnetMask(uint8_t *_addr) {
- readSUBR(_addr);
-}
-
-void W5100Class::setSubnetMask(uint8_t *_addr) {
- writeSUBR(_addr);
-}
-
-void W5100Class::getMACAddress(uint8_t *_addr) {
- readSHAR(_addr);
-}
-
-void W5100Class::setMACAddress(uint8_t *_addr) {
- writeSHAR(_addr);
-}
-
-void W5100Class::getIPAddress(uint8_t *_addr) {
- readSIPR(_addr);
-}
-
-void W5100Class::setIPAddress(uint8_t *_addr) {
- writeSIPR(_addr);
-}
-
-void W5100Class::setRetransmissionTime(uint16_t _timeout) {
- writeRTR(_timeout);
-}
-
-void W5100Class::setRetransmissionCount(uint8_t _retry) {
- writeRCR(_retry);
-}
-
-#endif
diff --git a/libraries/GSM/README.adoc b/libraries/GSM/README.adoc
deleted file mode 100644
index 876f0dcb794..00000000000
--- a/libraries/GSM/README.adoc
+++ /dev/null
@@ -1,23 +0,0 @@
-= GSM Library for Arduino =
-
-With the Arduino GSM Shield, this library enables an Arduino board to do most of the operations you can do with a GSM phone: place and receive voice calls, send and receive SMS, and connect to the internet over a GPRS network.
-
-For more information about this library please visit us at
-http://www.arduino.cc/en/Reference/GSM
-
-== License ==
-Copyright (c) 2012 Telefónica Digital - PDI - Physical Internet Lab
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
diff --git a/libraries/GSM/examples/GsmWebClient/GsmWebClient.ino b/libraries/GSM/examples/GsmWebClient/GsmWebClient.ino
deleted file mode 100644
index 3abc4136ffb..00000000000
--- a/libraries/GSM/examples/GsmWebClient/GsmWebClient.ino
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- Web client
-
- This sketch connects to a website through a GSM shield. Specifically,
- this example downloads the URL "http://www.arduino.cc/asciilogo.txt" and
- prints it to the Serial monitor.
-
- Circuit:
- * GSM shield attached to an Arduino
- * SIM card with a data plan
-
- created 8 Mar 2012
- by Tom Igoe
-
- http://www.arduino.cc/en/Tutorial/GSMExamplesWebClient
-
- */
-
-// libraries
-#include
-
-// PIN Number
-#define PINNUMBER ""
-
-// APN data
-#define GPRS_APN "GPRS_APN" // replace your GPRS APN
-#define GPRS_LOGIN "login" // replace with your GPRS login
-#define GPRS_PASSWORD "password" // replace with your GPRS password
-
-// initialize the library instance
-GSMClient client;
-GPRS gprs;
-GSM gsmAccess;
-
-// URL, path & port (for example: arduino.cc)
-char server[] = "arduino.cc";
-char path[] = "/asciilogo.txt";
-int port = 80; // port 80 is the default for HTTP
-
-void setup() {
- // initialize serial communications and wait for port to open:
- Serial.begin(9600);
- while (!Serial) {
- ; // wait for serial port to connect. Needed for native USB port only
- }
-
- Serial.println("Starting Arduino web client.");
- // connection state
- boolean notConnected = true;
-
- // After starting the modem with GSM.begin()
- // attach the shield to the GPRS network with the APN, login and password
- while (notConnected) {
- if ((gsmAccess.begin(PINNUMBER) == GSM_READY) &
- (gprs.attachGPRS(GPRS_APN, GPRS_LOGIN, GPRS_PASSWORD) == GPRS_READY)) {
- notConnected = false;
- } else {
- Serial.println("Not connected");
- delay(1000);
- }
- }
-
- Serial.println("connecting...");
-
- // if you get a connection, report back via serial:
- if (client.connect(server, port)) {
- Serial.println("connected");
- // Make a HTTP request:
- client.print("GET ");
- client.print(path);
- client.println(" HTTP/1.1");
- client.print("Host: ");
- client.println(server);
- client.println("Connection: close");
- client.println();
- } else {
- // if you didn't get a connection to the server:
- Serial.println("connection failed");
- }
-}
-
-void loop() {
- // if there are incoming bytes available
- // from the server, read them and print them:
- if (client.available()) {
- char c = client.read();
- Serial.print(c);
- }
-
- // if the server's disconnected, stop the client:
- if (!client.available() && !client.connected()) {
- Serial.println();
- Serial.println("disconnecting.");
- client.stop();
-
- // do nothing forevermore:
- for (;;)
- ;
- }
-}
diff --git a/libraries/GSM/examples/GsmWebServer/GsmWebServer.ino b/libraries/GSM/examples/GsmWebServer/GsmWebServer.ino
deleted file mode 100644
index 74fb572a1d1..00000000000
--- a/libraries/GSM/examples/GsmWebServer/GsmWebServer.ino
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- GSM Web Server
-
- A simple web server that shows the value of the analog input pins.
- using a GSM shield.
-
- Circuit:
- * GSM shield attached
- * Analog inputs attached to pins A0 through A5 (optional)
-
- created 8 Mar 2012
- by Tom Igoe
- */
-
-// libraries
-#include
-
-// PIN Number
-#define PINNUMBER ""
-
-// APN data
-#define GPRS_APN "GPRS_APN" // replace your GPRS APN
-#define GPRS_LOGIN "login" // replace with your GPRS login
-#define GPRS_PASSWORD "password" // replace with your GPRS password
-
-
-// initialize the library instance
-GPRS gprs;
-GSM gsmAccess; // include a 'true' parameter for debug enabled
-GSMServer server(80); // port 80 (http default)
-
-// timeout
-const unsigned long __TIMEOUT__ = 10 * 1000;
-
-void setup() {
- // initialize serial communications and wait for port to open:
- Serial.begin(9600);
- while (!Serial) {
- ; // wait for serial port to connect. Needed for native USB port only
- }
-
- // connection state
- boolean notConnected = true;
-
- // Start GSM shield
- // If your SIM has PIN, pass it as a parameter of begin() in quotes
- while (notConnected) {
- if ((gsmAccess.begin(PINNUMBER) == GSM_READY) &
- (gprs.attachGPRS(GPRS_APN, GPRS_LOGIN, GPRS_PASSWORD) == GPRS_READY)) {
- notConnected = false;
- } else {
- Serial.println("Not connected");
- delay(1000);
- }
- }
-
- Serial.println("Connected to GPRS network");
-
- // start server
- server.begin();
-
- //Get IP.
- IPAddress LocalIP = gprs.getIPAddress();
- Serial.println("Server IP address=");
- Serial.println(LocalIP);
-}
-
-void loop() {
-
-
- // listen for incoming clients
- GSMClient client = server.available();
-
-
-
- if (client) {
- while (client.connected()) {
- if (client.available()) {
- Serial.println("Receiving request!");
- bool sendResponse = false;
- while (char c = client.read()) {
- if (c == '\n') {
- sendResponse = true;
- }
- }
-
- // if you've gotten to the end of the line (received a newline
- // character)
- if (sendResponse) {
- // send a standard http response header
- client.println("HTTP/1.1 200 OK");
- client.println("Content-Type: text/html");
- client.println();
- client.println("");
- // output the value of each analog input pin
- for (int analogChannel = 0; analogChannel < 6; analogChannel++) {
- client.print("analog input ");
- client.print(analogChannel);
- client.print(" is ");
- client.print(analogRead(analogChannel));
- client.println("
");
- }
- client.println("");
- //necessary delay
- delay(1000);
- client.stop();
- }
- }
- }
- }
-}
-
-
diff --git a/libraries/GSM/examples/MakeVoiceCall/MakeVoiceCall.ino b/libraries/GSM/examples/MakeVoiceCall/MakeVoiceCall.ino
deleted file mode 100644
index 5eaace0a77f..00000000000
--- a/libraries/GSM/examples/MakeVoiceCall/MakeVoiceCall.ino
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- Make Voice Call
-
- This sketch, for the Arduino GSM shield, puts a voice call to
- a remote phone number that you enter through the serial monitor.
- To make it work, open the serial monitor, and when you see the
- READY message, type a phone number. Make sure the serial monitor
- is set to send a just newline when you press return.
-
- Circuit:
- * GSM shield
- * Voice circuit.
- With no voice circuit the call will send nor receive any sound
-
-
- created Mar 2012
- by Javier Zorzano
-
- This example is in the public domain.
- */
-
-// libraries
-#include
-
-// PIN Number
-#define PINNUMBER ""
-
-// initialize the library instance
-GSM gsmAccess; // include a 'true' parameter for debug enabled
-GSMVoiceCall vcs;
-
-String remoteNumber = ""; // the number you will call
-char charbuffer[20];
-
-void setup() {
-
- // initialize serial communications and wait for port to open:
- Serial.begin(9600);
- while (!Serial) {
- ; // wait for serial port to connect. Needed for native USB port only
- }
-
- Serial.println("Make Voice Call");
-
- // connection state
- boolean notConnected = true;
-
- // Start GSM shield
- // If your SIM has PIN, pass it as a parameter of begin() in quotes
- while (notConnected) {
- if (gsmAccess.begin(PINNUMBER) == GSM_READY) {
- notConnected = false;
- } else {
- Serial.println("Not connected");
- delay(1000);
- }
- }
-
- Serial.println("GSM initialized.");
- Serial.println("Enter phone number to call.");
-
-}
-
-void loop() {
-
- // add any incoming characters to the String:
- while (Serial.available() > 0) {
- char inChar = Serial.read();
- // if it's a newline, that means you should make the call:
- if (inChar == '\n') {
- // make sure the phone number is not too long:
- if (remoteNumber.length() < 20) {
- // let the user know you're calling:
- Serial.print("Calling to : ");
- Serial.println(remoteNumber);
- Serial.println();
-
- // Call the remote number
- remoteNumber.toCharArray(charbuffer, 20);
-
-
- // Check if the receiving end has picked up the call
- if (vcs.voiceCall(charbuffer)) {
- Serial.println("Call Established. Enter line to end");
- // Wait for some input from the line
- while (Serial.read() != '\n' && (vcs.getvoiceCallStatus() == TALKING));
- // And hang up
- vcs.hangCall();
- }
- Serial.println("Call Finished");
- remoteNumber = "";
- Serial.println("Enter phone number to call.");
- } else {
- Serial.println("That's too long for a phone number. I'm forgetting it");
- remoteNumber = "";
- }
- } else {
- // add the latest character to the message to send:
- if (inChar != '\r') {
- remoteNumber += inChar;
- }
- }
- }
-}
-
diff --git a/libraries/GSM/examples/ReceiveSMS/ReceiveSMS.ino b/libraries/GSM/examples/ReceiveSMS/ReceiveSMS.ino
deleted file mode 100644
index 09546e51e39..00000000000
--- a/libraries/GSM/examples/ReceiveSMS/ReceiveSMS.ino
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- SMS receiver
-
- This sketch, for the Arduino GSM shield, waits for a SMS message
- and displays it through the Serial port.
-
- Circuit:
- * GSM shield attached to and Arduino
- * SIM card that can receive SMS messages
-
- created 25 Feb 2012
- by Javier Zorzano / TD
-
- This example is in the public domain.
-
- http://www.arduino.cc/en/Tutorial/GSMExamplesReceiveSMS
-
-*/
-
-// include the GSM library
-#include
-
-// PIN Number for the SIM
-#define PINNUMBER ""
-
-// initialize the library instances
-GSM gsmAccess;
-GSM_SMS sms;
-
-// Array to hold the number a SMS is retreived from
-char senderNumber[20];
-
-void setup() {
- // initialize serial communications and wait for port to open:
- Serial.begin(9600);
- while (!Serial) {
- ; // wait for serial port to connect. Needed for native USB port only
- }
-
- Serial.println("SMS Messages Receiver");
-
- // connection state
- boolean notConnected = true;
-
- // Start GSM connection
- while (notConnected) {
- if (gsmAccess.begin(PINNUMBER) == GSM_READY) {
- notConnected = false;
- } else {
- Serial.println("Not connected");
- delay(1000);
- }
- }
-
- Serial.println("GSM initialized");
- Serial.println("Waiting for messages");
-}
-
-void loop() {
- char c;
-
- // If there are any SMSs available()
- if (sms.available()) {
- Serial.println("Message received from:");
-
- // Get remote number
- sms.remoteNumber(senderNumber, 20);
- Serial.println(senderNumber);
-
- // An example of message disposal
- // Any messages starting with # should be discarded
- if (sms.peek() == '#') {
- Serial.println("Discarded SMS");
- sms.flush();
- }
-
- // Read message bytes and print them
- while (c = sms.read()) {
- Serial.print(c);
- }
-
- Serial.println("\nEND OF MESSAGE");
-
- // Delete message from modem memory
- sms.flush();
- Serial.println("MESSAGE DELETED");
- }
-
- delay(1000);
-
-}
-
-
diff --git a/libraries/GSM/examples/ReceiveVoiceCall/ReceiveVoiceCall.ino b/libraries/GSM/examples/ReceiveVoiceCall/ReceiveVoiceCall.ino
deleted file mode 100644
index 6ec09f75727..00000000000
--- a/libraries/GSM/examples/ReceiveVoiceCall/ReceiveVoiceCall.ino
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- Receive Voice Call
-
- This sketch, for the Arduino GSM shield, receives voice calls,
- displays the calling number, waits a few seconds then hangs up.
-
- Circuit:
- * GSM shield
- * Voice circuit. Refer to to the GSM shield getting started guide
- at http://www.arduino.cc/en/Guide/ArduinoGSMShield#toc11
- * SIM card that can accept voice calls
-
- With no voice circuit the call will connect, but will not send or receive sound
-
- created Mar 2012
- by Javier Zorzano
-
- This example is in the public domain.
-
- http://www.arduino.cc/en/Tutorial/GSMExamplesReceiveVoiceCall
-
- */
-
-// Include the GSM library
-#include
-
-// PIN Number
-#define PINNUMBER ""
-
-// initialize the library instance
-GSM gsmAccess;
-GSMVoiceCall vcs;
-
-// Array to hold the number for the incoming call
-char numtel[20];
-
-void setup() {
- // initialize serial communications and wait for port to open:
- Serial.begin(9600);
- while (!Serial) {
- ; // wait for serial port to connect. Needed for native USB port only
- }
-
- Serial.println("Receive Voice Call");
-
- // connection state
- boolean notConnected = true;
-
- // Start GSM shield
- // If your SIM has PIN, pass it as a parameter of begin() in quotes
- while (notConnected) {
- if (gsmAccess.begin(PINNUMBER) == GSM_READY) {
- notConnected = false;
- } else {
- Serial.println("Not connected");
- delay(1000);
- }
- }
-
- // This makes sure the modem correctly reports incoming events
- vcs.hangCall();
-
- Serial.println("Waiting for a call");
-}
-
-void loop() {
- // Check the status of the voice call
- switch (vcs.getvoiceCallStatus()) {
- case IDLE_CALL: // Nothing is happening
-
- break;
-
- case RECEIVINGCALL: // Yes! Someone is calling us
-
- Serial.println("RECEIVING CALL");
-
- // Retrieve the calling number
- vcs.retrieveCallingNumber(numtel, 20);
-
- // Print the calling number
- Serial.print("Number:");
- Serial.println(numtel);
-
- // Answer the call, establish the call
- vcs.answerCall();
- break;
-
- case TALKING: // In this case the call would be established
-
- Serial.println("TALKING. Press enter to hang up.");
- while (Serial.read() != '\n') {
- delay(100);
- }
- vcs.hangCall();
- Serial.println("Hanging up and waiting for the next call.");
- break;
- }
- delay(1000);
-}
-
-
diff --git a/libraries/GSM/examples/SendSMS/SendSMS.ino b/libraries/GSM/examples/SendSMS/SendSMS.ino
deleted file mode 100644
index e49156ed966..00000000000
--- a/libraries/GSM/examples/SendSMS/SendSMS.ino
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- SMS sender
-
- This sketch, for the Arduino GSM shield,sends an SMS message
- you enter in the serial monitor. Connect your Arduino with the
- GSM shield and SIM card, open the serial monitor, and wait for
- the "READY" message to appear in the monitor. Next, type a
- message to send and press "return". Make sure the serial
- monitor is set to send a newline when you press return.
-
- Circuit:
- * GSM shield
- * SIM card that can send SMS
-
- created 25 Feb 2012
- by Tom Igoe
-
- This example is in the public domain.
-
- http://www.arduino.cc/en/Tutorial/GSMExamplesSendSMS
-
- */
-
-// Include the GSM library
-#include
-
-#define PINNUMBER ""
-
-// initialize the library instance
-GSM gsmAccess;
-GSM_SMS sms;
-
-void setup() {
- // initialize serial communications and wait for port to open:
- Serial.begin(9600);
- while (!Serial) {
- ; // wait for serial port to connect. Needed for native USB port only
- }
-
- Serial.println("SMS Messages Sender");
-
- // connection state
- boolean notConnected = true;
-
- // Start GSM shield
- // If your SIM has PIN, pass it as a parameter of begin() in quotes
- while (notConnected) {
- if (gsmAccess.begin(PINNUMBER) == GSM_READY) {
- notConnected = false;
- } else {
- Serial.println("Not connected");
- delay(1000);
- }
- }
-
- Serial.println("GSM initialized");
-}
-
-void loop() {
-
- Serial.print("Enter a mobile number: ");
- char remoteNum[20]; // telephone number to send sms
- readSerial(remoteNum);
- Serial.println(remoteNum);
-
- // sms text
- Serial.print("Now, enter SMS content: ");
- char txtMsg[200];
- readSerial(txtMsg);
- Serial.println("SENDING");
- Serial.println();
- Serial.println("Message:");
- Serial.println(txtMsg);
-
- // send the message
- sms.beginSMS(remoteNum);
- sms.print(txtMsg);
- sms.endSMS();
- Serial.println("\nCOMPLETE!\n");
-}
-
-/*
- Read input serial
- */
-int readSerial(char result[]) {
- int i = 0;
- while (1) {
- while (Serial.available() > 0) {
- char inChar = Serial.read();
- if (inChar == '\n') {
- result[i] = '\0';
- Serial.flush();
- return 0;
- }
- if (inChar != '\r') {
- result[i] = inChar;
- i++;
- }
- }
- }
-}
diff --git a/libraries/GSM/examples/Tools/BandManagement/BandManagement.ino b/libraries/GSM/examples/Tools/BandManagement/BandManagement.ino
deleted file mode 100644
index 2ef088a7f1b..00000000000
--- a/libraries/GSM/examples/Tools/BandManagement/BandManagement.ino
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- Band Management
-
- This sketch, for the Arduino GSM shield, checks the band
- currently configured in the modem and allows you to change
- it.
-
- Please check http://www.worldtimezone.com/gsm.html
- Usual configurations:
- Europe, Africa, Middle East: E-GSM(900)+DCS(1800)
- USA, Canada, South America: GSM(850)+PCS(1900)
- Mexico: PCS(1900)
- Brazil: GSM(850)+E-GSM(900)+DCS(1800)+PCS(1900)
-
-
- Circuit:
- * GSM shield
-
- created 12 June 2012
- by Javier Zorzano, Scott Fitzgerald
-
- This example is in the public domain.
- */
-
-// libraries
-#include
-
-// initialize the library instance
-GSMBand band;
-
-void setup() {
- // initialize serial communications and wait for port to open:
- Serial.begin(9600);
- while (!Serial) {
- ; // wait for serial port to connect. Needed for Leonardo only
- }
-
- // Beginning the band manager restarts the modem
- Serial.println("Restarting modem...");
- band.begin();
- Serial.println("Modem restarted.");
-
-};
-
-
-void loop() {
- // Get current band
- String bandName = band.getBand(); // Get and print band name
- Serial.print("Current band:");
- Serial.println(bandName);
- Serial.println("Want to change the band you’re on?");
- String newBandName;
- newBandName = askUser();
- // Tell the user what we are about to do…
- Serial.print("\nConfiguring band ");
- Serial.println(newBandName);
- // Change the band
- boolean operationSuccess;
- operationSuccess = band.setBand(newBandName);
- // Tell the user if the operation was OK
- if (operationSuccess) {
- Serial.println("Success");
- } else {
- Serial.println("Error while changing band");
- }
-
- if (operationSuccess) {
- while (true);
- }
-}
-
-// This function offers the user different options
-// through the Serial interface
-// The user selects one
-String askUser() {
- String newBand;
- Serial.println("Select band:");
- // Print the different options
- Serial.println("1 : E-GSM(900)");
- Serial.println("2 : DCS(1800)");
- Serial.println("3 : PCS(1900)");
- Serial.println("4 : E-GSM(900)+DCS(1800) ex: Europe");
- Serial.println("5 : GSM(850)+PCS(1900) Ex: USA, South Am.");
- Serial.println("6 : GSM(850)+E-GSM(900)+DCS(1800)+PCS(1900)");
-
- // Empty the incoming buffer
- while (Serial.available()) {
- Serial.read();
- }
-
- // Wait for an answer, just look at the first character
- while (!Serial.available());
- char c = Serial.read();
- if (c == '1') {
- newBand = GSM_MODE_EGSM;
- } else if (c == '2') {
- newBand = GSM_MODE_DCS;
- } else if (c == '3') {
- newBand = GSM_MODE_PCS;
- } else if (c == '4') {
- newBand = GSM_MODE_EGSM_DCS;
- } else if (c == '5') {
- newBand = GSM_MODE_GSM850_PCS;
- } else if (c == '6') {
- newBand = GSM_MODE_GSM850_EGSM_DCS_PCS;
- } else {
- newBand = "GSM_MODE_UNDEFINED";
- }
- return newBand;
-}
-
-
-
-
-
diff --git a/libraries/GSM/examples/Tools/GsmScanNetworks/GsmScanNetworks.ino b/libraries/GSM/examples/Tools/GsmScanNetworks/GsmScanNetworks.ino
deleted file mode 100644
index 233d11ae1db..00000000000
--- a/libraries/GSM/examples/Tools/GsmScanNetworks/GsmScanNetworks.ino
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
-
- GSM Scan Networks
-
- This example prints out the IMEI number of the modem,
- then checks to see if it's connected to a carrier. If so,
- it prints the phone number associated with the card.
- Then it scans for nearby networks and prints out their signal strengths.
-
- Circuit:
- * GSM shield
- * SIM card
-
- Created 8 Mar 2012
- by Tom Igoe, implemented by Javier Carazo
- Modified 4 Feb 2013
- by Scott Fitzgerald
-
- http://www.arduino.cc/en/Tutorial/GSMToolsGsmScanNetworks
-
- This example code is part of the public domain
- */
-
-// libraries
-#include
-
-// PIN Number
-#define PINNUMBER ""
-
-// initialize the library instance
-GSM gsmAccess; // include a 'true' parameter to enable debugging
-GSMScanner scannerNetworks;
-GSMModem modemTest;
-
-// Save data variables
-String IMEI = "";
-
-// serial monitor result messages
-String errortext = "ERROR";
-
-void setup() {
- // initialize serial communications and wait for port to open:
- Serial.begin(9600);
- while (!Serial) {
- ; // wait for serial port to connect. Needed for Leonardo only
- }
-
- Serial.println("GSM networks scanner");
- scannerNetworks.begin();
-
- // connection state
- boolean notConnected = true;
-
- // Start GSM shield
- // If your SIM has PIN, pass it as a parameter of begin() in quotes
- while (notConnected) {
- if (gsmAccess.begin(PINNUMBER) == GSM_READY) {
- notConnected = false;
- } else {
- Serial.println("Not connected");
- delay(1000);
- }
- }
-
- // get modem parameters
- // IMEI, modem unique identifier
- Serial.print("Modem IMEI: ");
- IMEI = modemTest.getIMEI();
- IMEI.replace("\n", "");
- if (IMEI != NULL) {
- Serial.println(IMEI);
- }
-}
-
-void loop() {
- // scan for existing networks, displays a list of networks
- Serial.println("Scanning available networks. May take some seconds.");
- Serial.println(scannerNetworks.readNetworks());
-
- // currently connected carrier
- Serial.print("Current carrier: ");
- Serial.println(scannerNetworks.getCurrentCarrier());
-
- // returns strength and ber
- // signal strength in 0-31 scale. 31 means power > 51dBm
- // BER is the Bit Error Rate. 0-7 scale. 99=not detectable
- Serial.print("Signal Strength: ");
- Serial.print(scannerNetworks.getSignalStrength());
- Serial.println(" [0-31]");
-
-}
-
diff --git a/libraries/GSM/examples/Tools/PinManagement/PinManagement.ino b/libraries/GSM/examples/Tools/PinManagement/PinManagement.ino
deleted file mode 100644
index 6dc37b33d6f..00000000000
--- a/libraries/GSM/examples/Tools/PinManagement/PinManagement.ino
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
-
- This example enables you to change or remove the PIN number of
- a SIM card inserted into a GSM shield.
-
- Circuit:
- * GSM shield
- * SIM card
-
- Created 12 Jun 2012
- by David del Peral
-
- This example code is part of the public domain
-
- http://www.arduino.cc/en/Tutorial/GSMToolsPinManagement
-
- */
-
-// libraries
-#include
-
-// pin manager object
-GSMPIN PINManager;
-
-// save input in serial by user
-String user_input = "";
-
-// authenticated with PIN code
-boolean auth = false;
-
-// serial monitor result messages
-String oktext = "OK";
-String errortext = "ERROR";
-
-void setup() {
- // initialize serial communications and wait for port to open:
- Serial.begin(9600);
- while (!Serial) {
- ; // wait for serial port to connect. Needed for Leonardo only
- }
-
- Serial.println("Change PIN example\n");
- PINManager.begin();
-
- // check if the SIM have pin lock
- while (!auth) {
- int pin_query = PINManager.isPIN();
- if (pin_query == 1) {
- // if SIM is locked, enter PIN code
- Serial.print("Enter PIN code: ");
- user_input = readSerial();
- // check PIN code
- if (PINManager.checkPIN(user_input) == 0) {
- auth = true;
- PINManager.setPINUsed(true);
- Serial.println(oktext);
- } else {
- // if PIN code was incorrected
- Serial.println("Incorrect PIN. Remember that you have 3 opportunities.");
- }
- } else if (pin_query == -1) {
- // PIN code is locked, user must enter PUK code
- Serial.println("PIN locked. Enter PUK code: ");
- String puk = readSerial();
- Serial.print("Now, enter a new PIN code: ");
- user_input = readSerial();
- // check PUK code
- if (PINManager.checkPUK(puk, user_input) == 0) {
- auth = true;
- PINManager.setPINUsed(true);
- Serial.println(oktext);
- } else {
- // if PUK o the new PIN are incorrect
- Serial.println("Incorrect PUK or invalid new PIN. Try again!.");
- }
- } else if (pin_query == -2) {
- // the worst case, PIN and PUK are locked
- Serial.println("PIN & PUK locked. Use PIN2/PUK2 in a mobile phone.");
- while (true);
- } else {
- // SIM does not requires authetication
- Serial.println("No pin necessary.");
- auth = true;
- }
- }
-
- // start GSM shield
- Serial.print("Checking register in GSM network...");
- if (PINManager.checkReg() == 0) {
- Serial.println(oktext);
- }
- // if you are connect by roaming
- else if (PINManager.checkReg() == 1) {
- Serial.println("ROAMING " + oktext);
- } else {
- // error connection
- Serial.println(errortext);
- while (true);
- }
-}
-
-void loop() {
- // Function loop implements pin management user menu
- // Only if you SIM use pin lock, you can change PIN code
- // user_op variables save user option
-
- Serial.println("Choose an option:\n1 - On/Off PIN.");
- if (PINManager.getPINUsed()) {
- Serial.println("2 - Change PIN.");
- }
- String user_op = readSerial();
- if (user_op == "1") {
- Serial.println("Enter your PIN code:");
- user_input = readSerial();
- // activate/deactivate PIN lock
- PINManager.switchPIN(user_input);
- } else if (user_op == "2" & PINManager.getPINUsed()) {
- Serial.println("Enter your actual PIN code:");
- String oldPIN = readSerial();
- Serial.println("Now, enter your new PIN code:");
- String newPIN = readSerial();
- // change PIN
- PINManager.changePIN(oldPIN, newPIN);
- } else {
- Serial.println("Incorrect option. Try again!.");
- }
- delay(1000);
-}
-
-/*
- Read input serial
- */
-String readSerial() {
- String text = "";
- while (1) {
- while (Serial.available() > 0) {
- char inChar = Serial.read();
- if (inChar == '\n') {
- return text;
- }
- if (inChar != '\r') {
- text += inChar;
- }
- }
- }
-}
diff --git a/libraries/GSM/examples/Tools/TestGPRS/TestGPRS.ino b/libraries/GSM/examples/Tools/TestGPRS/TestGPRS.ino
deleted file mode 100644
index 85a8bc8bc8a..00000000000
--- a/libraries/GSM/examples/Tools/TestGPRS/TestGPRS.ino
+++ /dev/null
@@ -1,190 +0,0 @@
-/*
-
- This sketch test the GSM shield's ability to connect to a
- GPERS network. It asks for APN information through the
- serial monitor and tries to connect to arduino.cc.
-
- Circuit:
- * GSM shield attached
- * SIM card with data plan
-
- Created 18 Jun 2012
- by David del Peral
-
- This example code is part of the public domain
-
- http://www.arduino.cc/en/Tutorial/GSMToolsTestGPRS
-
- */
-
-// libraries
-#include
-
-// PIN Number
-#define PINNUMBER ""
-
-// initialize the library instance
-GSM gsmAccess; // GSM access: include a 'true' parameter for debug enabled
-GPRS gprsAccess; // GPRS access
-GSMClient client; // Client service for TCP connection
-
-// messages for serial monitor response
-String oktext = "OK";
-String errortext = "ERROR";
-
-// URL and path (for example: arduino.cc)
-char url[] = "arduino.cc";
-char urlproxy[] = "http://www.arduino.cc";
-char path[] = "/";
-
-// variable for save response obtained
-String response = "";
-
-// use a proxy
-boolean use_proxy = false;
-
-void setup() {
- // initialize serial communications and wait for port to open:
- Serial.begin(9600);
- while (!Serial) {
- ; // wait for serial port to connect. Needed for Leonardo only
- }
-}
-
-void loop() {
- use_proxy = false;
-
- // start GSM shield
- // if your SIM has PIN, pass it as a parameter of begin() in quotes
- Serial.print("Connecting GSM network...");
- if (gsmAccess.begin(PINNUMBER) != GSM_READY) {
- Serial.println(errortext);
- while (true);
- }
- Serial.println(oktext);
-
- // read APN introduced by user
- char apn[50];
- Serial.print("Enter your APN: ");
- readSerial(apn);
- Serial.println(apn);
-
- // Read APN login introduced by user
- char login[50];
- Serial.print("Now, enter your login: ");
- readSerial(login);
- Serial.println(login);
-
- // read APN password introduced by user
- char password[20];
- Serial.print("Finally, enter your password: ");
- readSerial(password);
-
- // attach GPRS
- Serial.println("Attaching to GPRS with your APN...");
- if (gprsAccess.attachGPRS(apn, login, password) != GPRS_READY) {
- Serial.println(errortext);
- } else {
-
- Serial.println(oktext);
-
- // read proxy introduced by user
- char proxy[100];
- Serial.print("If your carrier uses a proxy, enter it, if not press enter: ");
- readSerial(proxy);
- Serial.println(proxy);
-
- // if user introduced a proxy, asks him for proxy port
- int pport;
- if (proxy[0] != '\0') {
- // read proxy port introduced by user
- char proxyport[10];
- Serial.print("Enter the proxy port: ");
- readSerial(proxyport);
- // cast proxy port introduced to integer
- pport = (int) proxyport;
- use_proxy = true;
- Serial.println(proxyport);
- }
-
- // connection with arduino.cc and realize HTTP request
- Serial.print("Connecting and sending GET request to arduino.cc...");
- int res_connect;
-
- // if use a proxy, connect with it
- if (use_proxy) {
- res_connect = client.connect(proxy, pport);
- } else {
- res_connect = client.connect(url, 80);
- }
-
- if (res_connect) {
- // make a HTTP 1.0 GET request (client sends the request)
- client.print("GET ");
-
- // if use a proxy, the path is arduino.cc URL
- if (use_proxy) {
- client.print(urlproxy);
- } else {
- client.print(path);
- }
-
- client.println(" HTTP/1.0");
- client.println();
- Serial.println(oktext);
- } else {
- // if you didn't get a connection to the server
- Serial.println(errortext);
- }
- Serial.print("Receiving response...");
-
- boolean test = true;
- while (test) {
- // if there are incoming bytes available
- // from the server, read and check them
- if (client.available()) {
- char c = client.read();
- response += c;
-
- // cast response obtained from string to char array
- char responsechar[response.length() + 1];
- response.toCharArray(responsechar, response.length() + 1);
-
- // if response includes a "200 OK" substring
- if (strstr(responsechar, "200 OK") != NULL) {
- Serial.println(oktext);
- Serial.println("TEST COMPLETE!");
- test = false;
- }
- }
-
- // if the server's disconnected, stop the client:
- if (!client.connected()) {
- Serial.println();
- Serial.println("disconnecting.");
- client.stop();
- test = false;
- }
- }
- }
-}
-
-/*
- Read input serial
- */
-int readSerial(char result[]) {
- int i = 0;
- while (1) {
- while (Serial.available() > 0) {
- char inChar = Serial.read();
- if (inChar == '\n') {
- result[i] = '\0';
- return 0;
- }
- if (inChar != '\r') {
- result[i] = inChar;
- i++;
- }
- }
- }
-}
diff --git a/libraries/GSM/examples/Tools/TestModem/TestModem.ino b/libraries/GSM/examples/Tools/TestModem/TestModem.ino
deleted file mode 100644
index 5ee42219bbd..00000000000
--- a/libraries/GSM/examples/Tools/TestModem/TestModem.ino
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
-
- This example tests to see if the modem of the
- GSM shield is working correctly. You do not need
- a SIM card for this example.
-
- Circuit:
- * GSM shield attached
-
- Created 12 Jun 2012
- by David del Peral
- modified 21 Nov 2012
- by Tom Igoe
-
- http://www.arduino.cc/en/Tutorial/GSMToolsTestModem
-
- This sample code is part of the public domain
-
- */
-
-// libraries
-#include
-
-// modem verification object
-GSMModem modem;
-
-// IMEI variable
-String IMEI = "";
-
-void setup() {
- // initialize serial communications and wait for port to open:
- Serial.begin(9600);
- while (!Serial) {
- ; // wait for serial port to connect. Needed for Leonardo only
- }
-
- // start modem test (reset and check response)
- Serial.print("Starting modem test...");
- if (modem.begin()) {
- Serial.println("modem.begin() succeeded");
- } else {
- Serial.println("ERROR, no modem answer.");
- }
-}
-
-void loop() {
- // get modem IMEI
- Serial.print("Checking IMEI...");
- IMEI = modem.getIMEI();
-
- // check IMEI response
- if (IMEI != NULL) {
- // show IMEI in serial monitor
- Serial.println("Modem's IMEI: " + IMEI);
- // reset modem to check booting:
- Serial.print("Resetting modem...");
- modem.begin();
- // get and check IMEI one more time
- if (modem.getIMEI() != NULL) {
- Serial.println("Modem is functoning properly");
- } else {
- Serial.println("Error: getIMEI() failed after modem.begin()");
- }
- } else {
- Serial.println("Error: Could not get IMEI");
- }
- // do nothing:
- while (true);
-}
-
diff --git a/libraries/GSM/examples/Tools/TestWebServer/TestWebServer.ino b/libraries/GSM/examples/Tools/TestWebServer/TestWebServer.ino
deleted file mode 100644
index d3939e11a0c..00000000000
--- a/libraries/GSM/examples/Tools/TestWebServer/TestWebServer.ino
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- Basic Web Server
-
- A simple web server that replies with nothing, but prints the client's request
- and the server IP address.
-
- Circuit:
- * GSM shield attached
-
- created
- by David Cuartielles
- modified 21 Nov 2012
- by Tom Igoe
-
- http://www.arduino.cc/en/Tutorial/GSMToolsTestWebServer
-
- This example code is part of the public domain
- */
-#include
-
-// PIN Number
-#define PINNUMBER ""
-
-// APN data
-#define GPRS_APN "GPRS_APN" // replace your GPRS APN
-#define GPRS_LOGIN "login" // replace with your GPRS login
-#define GPRS_PASSWORD "password" // replace with your GPRS password
-
-
-// initialize the library instance
-GPRS gprs;
-GSM gsmAccess; // include a 'true' parameter for debug enabled
-GSMServer server(80); // port 80 (http default)
-
-// timeout
-const unsigned long __TIMEOUT__ = 10 * 1000;
-
-void setup() {
- // initialize serial communications and wait for port to open:
- Serial.begin(9600);
- while (!Serial) {
- ; // wait for serial port to connect. Needed for Leonardo only
- }
-
- Serial.println("starting,..");
- // connection state
- boolean connected = true;
-
- // Start GSM shield
- // If your SIM has PIN, pass it as a parameter of begin() in quotes
- while (!connected) {
- if ((gsmAccess.begin(PINNUMBER) == GSM_READY) &
- (gprs.attachGPRS(GPRS_APN, GPRS_LOGIN, GPRS_PASSWORD) == GPRS_READY)) {
- connected = true;
- } else {
- Serial.println("Not connected");
- delay(1000);
- }
- }
-
- Serial.println("Connected to GPRS network");
-
- // start server
- server.begin();
-
- //Get IP.
- IPAddress LocalIP = gprs.getIPAddress();
- Serial.println("Server IP address=");
- Serial.println(LocalIP);
-}
-
-void loop() {
- GSMClient client = server.available();
-
- if (client) {
- if (client.available()) {
- Serial.write(client.read());
- }
- }
-
-}
-
diff --git a/libraries/GSM/extras/License.txt b/libraries/GSM/extras/License.txt
deleted file mode 100644
index 4114b2b23c3..00000000000
--- a/libraries/GSM/extras/License.txt
+++ /dev/null
@@ -1,142 +0,0 @@
-GNU LESSER GENERAL PUBLIC LICENSE
-
-Version 2.1, February 1999
-
-Copyright (C) 1991, 1999 Free Software Foundation, Inc.
-51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-Everyone is permitted to copy and distribute verbatim copies
-of this license document, but changing it is not allowed.
-
-[This is the first released version of the Lesser GPL. It also counts
- as the successor of the GNU Library Public License, version 2, hence
- the version number 2.1.]
-
-Preamble
-
-The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users.
-
-This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below.
-
-When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things.
-
-To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it.
-
-For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights.
-
-We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library.
-
-To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others.
-
-Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license.
-
-Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs.
-
-When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library.
-
-We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances.
-
-For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License.
-
-In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system.
-
-Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library.
-
-The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run.
-TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
-0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you".
-
-A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables.
-
-The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".)
-
-"Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library.
-
-Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does.
-
-1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library.
-
-You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee.
-
-2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions:
-
- a) The modified work must itself be a software library.
- b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change.
- c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License.
- d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful.
-
- (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.)
-
-These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library.
-
-In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License.
-
-3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices.
-
-Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy.
-
-This option is useful when you wish to copy part of the code of the Library into a program that is not a library.
-
-4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange.
-
-If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code.
-
-5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License.
-
-However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables.
-
-When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law.
-
-If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.)
-
-Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself.
-
-6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications.
-
-You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things:
-
- a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.)
- b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with.
- c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution.
- d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place.
- e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy.
-
-For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable.
-
-It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute.
-
-7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things:
-
- a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above.
- b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work.
-
-8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.
-
-9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it.
-
-10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License.
-
-11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library.
-
-If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances.
-
-It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice.
-
-This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License.
-
-12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License.
-
-13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation.
-
-14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally.
-
-NO WARRANTY
-
-15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
-16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
-END OF TERMS AND CONDITIONS
diff --git a/libraries/GSM/keywords.txt b/libraries/GSM/keywords.txt
deleted file mode 100644
index 4a44464add9..00000000000
--- a/libraries/GSM/keywords.txt
+++ /dev/null
@@ -1,72 +0,0 @@
-#######################################
-# Syntax Coloring Map For GSM
-#######################################
-# Class
-#######################################
-
-GSM KEYWORD1 GSM
-GSMVoiceCall KEYWORD1 GSMVCSConstructor
-GSM_SMS KEYWORD1 GSMSMSConstructor
-GPRS KEYWORD1 GPRSConstructor
-GSMClient KEYWORD1 GSMClientConstructor
-GSMServer KEYWORD1 GSMServerConstructor
-GSMModem KEYWORD1 GSMModemConstructor
-GSMScanner KEYWORD1 GSMScannerConstructor
-GSMPIN KEYWORD1 GSMPINConstructor
-GSMBand KEYWORD1 GSMBandConstructor
-
-#######################################
-# Methods and Functions
-#######################################
-
-begin KEYWORD2
-shutdown KEYWORD2
-gatVoiceCallStatus KEYWORD2
-ready KEYWORD2
-voiceCall KEYWORD2
-answerCall KEYWORD2
-hangCall KEYWORD2
-retrieveCallingNumber KEYWORD2
-beginSMS KEYWORD2
-endSMS KEYWORD2
-remoteNumber KEYWORD2
-attachGPRS KEYWORD2
-begnWrite KEYWORD2
-endWrite KEYWORD2
-getIMEI KEYWORD2
-getCurrentCarrier KEYWORD2
-getSignalStrength KEYWORD2
-readNetworks KEYWORD2
-isPIN KEYWORD2
-checkPIN KEYWORD2
-checkPUK KEYWORD2
-changePIN KEYWORD2
-switchPIN KEYWORD2
-checkReg KEYWORD2
-getPINUsed KEYWORD2
-setPINUsed KEYWORD2
-getBand KEYWORD2
-setBand KEYWORD2
-getvoiceCallStatus KEYWORD2
-
-#######################################
-# Constants
-#######################################
-
-ERROR LITERAL1
-IDLE LITERAL1
-CONNECTING LITERAL1
-GSM_READY LITERAL1
-GPRS_READY LITERAL1
-TRANSPARENT_CONNECTED LITERAL1
-IDLE_CALL LITERAL1
-CALLING LITERAL1
-RECEIVINGCALL LITERAL1
-TALKING LITERAL1
-GSM_MODE_UNDEFINED LITERAL1
-GSM_MODE_EGSM LITERAL1
-GSM_MODE_DCS LITERAL1
-GSM_MODE_PCS LITERAL1
-GSM_MODE_EGSM_DCS LITERAL1
-GSM_MODE_GSM850_PCS LITERAL1
-GSM_MODE_GSM850_EGSM_DCS_PCS LITERAL1
diff --git a/libraries/GSM/library.properties b/libraries/GSM/library.properties
deleted file mode 100644
index 3e9cadd98c1..00000000000
--- a/libraries/GSM/library.properties
+++ /dev/null
@@ -1,9 +0,0 @@
-name=GSM
-version=1.0.6
-author=Arduino
-maintainer=Arduino
-sentence=Enables GSM/GRPS network connection using the Arduino GSM Shield.
-paragraph=Use this library to make/receive voice calls, to send and receive SMS with the Quectel M10 GSM module.This library also allows you to connect to internet through the GPRS networks. You can either use web Clients and Servers.
-category=Communication
-url=http://www.arduino.cc/en/Reference/GSM
-architectures=avr
diff --git a/libraries/GSM/src/GSM.h b/libraries/GSM/src/GSM.h
deleted file mode 100644
index a071b082f97..00000000000
--- a/libraries/GSM/src/GSM.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
-This file is part of the GSM3 communications library for Arduino
--- Multi-transport communications platform
--- Fully asynchronous
--- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
--- Voice calls
--- SMS
--- TCP/IP connections
--- HTTP basic clients
-
-This library has been developed by Telefónica Digital - PDI -
-- Physical Internet Lab, as part as its collaboration with
-Arduino and the Open Hardware Community.
-
-September-December 2012
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-The latest version of this library can always be found at
-https://github.com/BlueVia/Official-Arduino
-*/
-#ifndef _GSM3SIMPLIFIERFILE_
-#define _GSM3SIMPLIFIERFILE_
-
-// This file simplifies the use of the GSM3 library
-// First we include everything.
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#define GSM GSM3ShieldV1AccessProvider
-#define GPRS GSM3ShieldV1DataNetworkProvider
-#define GSMClient GSM3MobileClientService
-#define GSMServer GSM3MobileServerService
-#define GSMVoiceCall GSM3VoiceCallService
-#define GSM_SMS GSM3SMSService
-
-#define GSMPIN GSM3ShieldV1PinManagement
-#define GSMModem GSM3ShieldV1ModemVerification
-#define GSMCell GSM3ShieldV1CellManagement
-#define GSMBand GSM3ShieldV1BandManagement
-#define GSMScanner GSM3ShieldV1ScanNetworks
-
-#endif
\ No newline at end of file
diff --git a/libraries/GSM/src/GSM3CircularBuffer.cpp b/libraries/GSM/src/GSM3CircularBuffer.cpp
deleted file mode 100644
index cb6c4cbf97c..00000000000
--- a/libraries/GSM/src/GSM3CircularBuffer.cpp
+++ /dev/null
@@ -1,319 +0,0 @@
-/*
-This file is part of the GSM3 communications library for Arduino
--- Multi-transport communications platform
--- Fully asynchronous
--- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
--- Voice calls
--- SMS
--- TCP/IP connections
--- HTTP basic clients
-
-This library has been developed by Telefónica Digital - PDI -
-- Physical Internet Lab, as part as its collaboration with
-Arduino and the Open Hardware Community.
-
-September-December 2012
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-The latest version of this library can always be found at
-https://github.com/BlueVia/Official-Arduino
-*/
-#include
-#include
-
-GSM3CircularBuffer::GSM3CircularBuffer(GSM3CircularBufferManager* mgr)
-{
- head=0;
- tail=0;
- cbm=mgr;
-}
-
-int GSM3CircularBuffer::write(char c)
-{
- byte aux=(tail+1)& __BUFFERMASK__;
- if(aux!=head)
- {
- theBuffer[tail]=c;
- // Lets put an extra zero at the end, so we can
- // read chains as we like.
- // This is not exactly perfect, we are always 1+ behind the head
- theBuffer[aux]=0;
- tail=aux;
- return 1;
- }
- return 0;
-}
-
-char GSM3CircularBuffer::read()
-{
- char res;
- if(head!=tail)
- {
- res=theBuffer[head];
- head=(head+1)& __BUFFERMASK__;
- //if(cbm)
- // cbm->spaceAvailable();
- return res;
- }
- else
- {
- return 0;
- }
-}
-
-char GSM3CircularBuffer::peek(int increment)
-{
- char res;
- byte num_aux;
-
- if (tail>head) num_aux = tail-head;
- else num_aux = 128 - head + tail;
-
- if(increment < num_aux)
- {
- res=theBuffer[head];
- return res;
- }
- else
- {
- return 0;
- }
-}
-
-void GSM3CircularBufferManager::spaceAvailable(){return;};
-
-void GSM3CircularBuffer::flush()
-{
- head=tail;
-}
-
-char* GSM3CircularBuffer::nextString()
-{
- while(head!=tail)
- {
- head=(head+1) & __BUFFERMASK__;
- if(theBuffer[head]==0)
- {
- head=(head+1) & __BUFFERMASK__;
- return (char*)theBuffer+head;
- }
- }
- return 0;
-}
-
-
-bool GSM3CircularBuffer::locate(const char* reference)
-{
-
- return locate(reference, head, tail, 0, 0);
-}
-
-bool GSM3CircularBuffer::chopUntil(const char* reference, bool movetotheend, bool usehead)
-{
- byte from, to;
-
- if(locate(reference, head, tail, &from, &to))
- {
- if(usehead)
- {
- if(movetotheend)
- head=(to+1) & __BUFFERMASK__;
- else
- head=from;
- }
- else
- {
- if(movetotheend)
- tail=(to+1) & __BUFFERMASK__;
- else
- tail=from;
- }
- return true;
- }
- else
- {
- return false;
- }
-}
-
-bool GSM3CircularBuffer::locate(const char* reference, byte thishead, byte thistail, byte* from, byte* to)
-{
- int refcursor=0;
- bool into=false;
- byte b2, binit;
- bool possible=1;
-
- if(reference[0]==0)
- return true;
-
- for(byte b1=thishead; b1!=thistail;b1=(b1+1)& __BUFFERMASK__)
- {
- possible = 1;
- b2 = b1;
- while (possible&&(b2!=thistail))
- {
- if(theBuffer[b2]==reference[refcursor])
- {
- if(!into)
- binit=b2;
- into=true;
- refcursor++;
- if(reference[refcursor]==0)
- {
- if(from)
- *from=binit;
- if(to)
- *to=b2;
- return true;
- }
- }
- else if (into==true)
- {
- possible = 0;
- into=false;
- refcursor=0;
- }
- b2=(b2+1)& __BUFFERMASK__;
- }
- }
- return false;
-}
-
-bool GSM3CircularBuffer::extractSubstring(const char* from, const char* to, char* buffer, int bufsize)
-{
- byte t1;
- byte h2;
- byte b;
- int i;
-
-//DEBUG
-//Serial.println("Beginning extractSubstring");
-//Serial.print("head,tail=");Serial.print(int(head));Serial.print(",");Serial.println(int(tail));
-
- if(!locate(from, head, tail, 0, &t1))
- return false;
-
-//DEBUG
-//Serial.println("Located chain from.");
-
- t1++; //To point the next.
- if(!locate(to, t1, tail, &h2, 0))
- return false;
-
-//DEBUG
-//Serial.println("Located chain to.");
-/*Serial.print("t1=");Serial.println(int(t1));
-Serial.print("h2=");Serial.println(int(h2));*/
-
-
- for(i=0,b=t1;i='0')&&(c<='9'))
- {
- anyfound=true;
- res=(res*10)+(int)c-48;
- }
- else
- {
- if(negative)
- res=(-1)*res;
- return res;
- }
- }
- if(negative)
- res=(-1)*res;
- return res;
-}
-
-void GSM3CircularBuffer::debugBuffer()
-{
- byte h1=head;
- byte t1=tail;
- Serial.println();
- Serial.print(h1);
- Serial.print(" ");
- Serial.print(t1);
- Serial.print('>');
- for(byte b=h1; b!=t1; b=(b+1)& __BUFFERMASK__)
- printCharDebug(theBuffer[b]);
- Serial.println();
-}
-
-void GSM3CircularBuffer::printCharDebug(uint8_t c)
-{
- if((c>31)&&(c<127))
- Serial.print((char)c);
- else
- {
- Serial.print('%');
- Serial.print(c);
- Serial.print('%');
- }
-}
-
-bool GSM3CircularBuffer::retrieveBuffer(char* buffer, int bufsize, int& SizeWritten)
-{
- byte b;
- int i;
-
- /*for(i=0,b=head;i
-#include
-
-#ifndef byte
-#define byte uint8_t
-#endif
-
-// These values have to be interrelated
-// To-Do: may we have just one? (BUFFERMASK)
-#define __BUFFERSIZE__ 128
-#define __BUFFERMASK__ 0x7F
-
-class GSM3CircularBufferManager
-{
- public:
-
- /** If there is spaceAvailable in the buffer, lets send a XON
- */
- virtual void spaceAvailable();
-};
-
-class GSM3CircularBuffer
-{
- private:
- // Buffer pointers.
- // head=tail means buffer empty
- // tail=head-1 means buffer full
- // tail=head+1 means just one char (pointed by head)
- // REMEMBER. head can be moved only by the main program
- // REMEMBER. tail can be moved only by the other thread (interrupts)
- // REMEMBER. head and tail can move only FORWARD
- volatile byte head; // First written one
- volatile byte tail; // Last written one.
-
- GSM3CircularBufferManager* cbm; // Circular buffer manager
-
- // The buffer
- volatile byte theBuffer[__BUFFERSIZE__];
-
- /** Checks if a substring exists in the buffer
- @param reference Substring
- @param thishead Head
- @param thistail Tail
- @param from Initial byte position
- @param to Final byte position
- @return true if exists, in otherwise return false
- */
- bool locate(const char* reference, byte thishead, byte thistail, byte* from=0, byte* to=0);
-
- public:
-
- /** Constructor
- @param mgr Circular buffer manager
- */
- GSM3CircularBuffer(GSM3CircularBufferManager* mgr=0);
-
- // TO-DO.Check if this formule runs too at the buffer limit
-
- /** Get available bytes in circular buffer
- @return available bytes
- */
- inline byte availableBytes(){ return ((head-(tail+1))&__BUFFERMASK__);};
-
- /** Stored bytes in circular buffer
- @return stored bytes
- */
- inline byte storedBytes(){ return ((tail-head)&__BUFFERMASK__);};
-
- /** Write a character in circular buffer
- @param c Character
- @return 1 if successful
- */
- int write(char c);
-
- /** Returns a character and moves the pointer
- @return character
- */
- char read();
-
- /** Returns a character but does not move the pointer.
- @param increment Increment
- @return character
- */
- char peek(int increment);
-
- /** Returns a pointer to the head of the buffer
- @return buffer with pointer in head
- */
- inline char* firstString(){return (char*)theBuffer+head;};
-
- /** Go forward one string
- @return buffer with one string advance
- */
- char* nextString();
-
- /** Flush circular buffer
- */
- void flush();
-
- /** Get tail
- @return tail
- */
- inline byte getTail(){return tail;};
-
- /** Get head
- @return head
- */
- inline byte getHead(){return head;};
-
- // Only can be executed from the interrupt!
- /** Delete circular buffer to the end
- @param from Initial byte position
- */
- inline void deleteToTheEnd(byte from){tail=from;};
-
- /** Checks if a substring exists in the buffer
- move=0, dont move, =1,put head at the beginning of the string, =2, put head at the end
- @param reference
- @return true if exists, in otherwise return false
- */
- bool locate(const char* reference);
-
- /** Locates reference. If found, moves head (or tail) to the beginning (or end)
- @param reference
- @param movetotheend
- @param head
- @return true if successful
- */
- bool chopUntil(const char* reference, bool movetotheend, bool head=true);
-
- /** Reads an integer from the head. Stops with first non blank, non number character
- @return integer from the head
- */
- int readInt();
-
- // Caveat: copies the first bytes until buffer is full
-
- /** Extract a substring from circular buffer
- @param from Initial byte position
- @param to Final byte position
- @param buffer Buffer for copy substring
- @param bufsize Buffer size
- @return true if successful, false if substring does not exists
- */
- bool extractSubstring(const char* from, const char* to, char* buffer, int bufsize);
-
- /** Retrieve all the contents of buffer from head to tail
- @param buffer
- @param bufsize
- @param SizeWritten
- @return true if successful
- */
- bool retrieveBuffer(char* buffer, int bufsize, int& SizeWritten);
-
- /** Debug function to print the buffer after receiving data from the modem.
- */
- void debugBuffer();
-
- /** Utility: dump character if printable, else, put in %x%
- @param c Character
- */
- static void printCharDebug(uint8_t c);
-
-
-};
-
-
-#endif
\ No newline at end of file
diff --git a/libraries/GSM/src/GSM3IO.h b/libraries/GSM/src/GSM3IO.h
deleted file mode 100644
index da1e7847683..00000000000
--- a/libraries/GSM/src/GSM3IO.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
-This file is part of the GSM3 communications library for Arduino
--- Multi-transport communications platform
--- Fully asynchronous
--- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
--- Voice calls
--- SMS
--- TCP/IP connections
--- HTTP basic clients
-
-This library has been developed by Telefónica Digital - PDI -
-- Physical Internet Lab, as part as its collaboration with
-Arduino and the Open Hardware Community.
-
-September-December 2012
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-The latest version of this library can always be found at
-https://github.com/BlueVia/Official-Arduino
-*/
-#ifdef TTOPEN_V1
- #define __POWERPIN__ 5
- #define __RESETPIN__ 6
-#else
- #define __RESETPIN__ 7
-#endif
-
-#if defined(__AVR_ATmega328P__)
- #ifdef TTOPEN_V1
- #define __TXPIN__ 3
- #define __RXPIN__ 4
- #define __RXINT__ 3
- #else
- #define __TXPIN__ 3
- #define __RXPIN__ 2
- #define __RXINT__ 3
- #endif
-#elif defined(__AVR_ATmega2560__) || defined(__AVR_ATmega1280__)
- #define __TXPIN__ 3
- #define __RXPIN__ 10
- #define __RXINT__ 4
-#elif defined(__AVR_ATmega32U4__)
- #define __TXPIN__ 3
- #define __RXPIN__ 8
- #define __RXINT__ 3
-#endif
diff --git a/libraries/GSM/src/GSM3MobileAccessProvider.cpp b/libraries/GSM/src/GSM3MobileAccessProvider.cpp
deleted file mode 100644
index 225069b2b94..00000000000
--- a/libraries/GSM/src/GSM3MobileAccessProvider.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
-This file is part of the GSM3 communications library for Arduino
--- Multi-transport communications platform
--- Fully asynchronous
--- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
--- Voice calls
--- SMS
--- TCP/IP connections
--- HTTP basic clients
-
-This library has been developed by Telefónica Digital - PDI -
-- Physical Internet Lab, as part as its collaboration with
-Arduino and the Open Hardware Community.
-
-September-December 2012
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-The latest version of this library can always be found at
-https://github.com/BlueVia/Official-Arduino
-*/
-#include
-
-GSM3MobileAccessProvider* theGSM3MobileAccessProvider;
diff --git a/libraries/GSM/src/GSM3MobileAccessProvider.h b/libraries/GSM/src/GSM3MobileAccessProvider.h
deleted file mode 100644
index afaadc8b4f2..00000000000
--- a/libraries/GSM/src/GSM3MobileAccessProvider.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
-This file is part of the GSM3 communications library for Arduino
--- Multi-transport communications platform
--- Fully asynchronous
--- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
--- Voice calls
--- SMS
--- TCP/IP connections
--- HTTP basic clients
-
-This library has been developed by Telefónica Digital - PDI -
-- Physical Internet Lab, as part as its collaboration with
-Arduino and the Open Hardware Community.
-
-September-December 2012
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-The latest version of this library can always be found at
-https://github.com/BlueVia/Official-Arduino
-*/
-#ifndef _GSM3MOBILEACCESSPROVIDER_
-#define _GSM3MOBILEACCESSPROVIDER_
-
-enum GSM3_NetworkStatus_t { ERROR, IDLE, CONNECTING, GSM_READY, GPRS_READY, TRANSPARENT_CONNECTED, OFF};
-
-class GSM3MobileAccessProvider
-{
- public:
- // Access functions
- //Configuration functions.
- /** Establish GSM connection
- @param pin PIN code
- @param restart Determines if hardware restart
- @param synchronous Determines sync mode
- @return If synchronous, GSM3_NetworkStatus_t. If asynchronous, returns 0.
- */
- virtual inline GSM3_NetworkStatus_t begin(char* pin=0,bool restart=true, bool synchronous=true)=0;
-
- /** Check network access status
- @return 1 if Alive, 0 if down
- */
- virtual inline int isAccessAlive()=0;
-
- /** Shutdown the modem (power off really)
- @return true if successful
- */
- virtual inline bool shutdown()=0;
-
- /** Secure shutdown the modem (power off really)
- @return always true
- */
- virtual inline bool secureShutdown()=0;
-
- /** Get last command status
- @return returns 0 if last command is still executing, 1 success, >1 error
- */
- virtual int ready()=0;
-};
-
-#endif
\ No newline at end of file
diff --git a/libraries/GSM/src/GSM3MobileCellManagement.cpp b/libraries/GSM/src/GSM3MobileCellManagement.cpp
deleted file mode 100644
index 5db2717f869..00000000000
--- a/libraries/GSM/src/GSM3MobileCellManagement.cpp
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
-This file is part of the GSM3 communications library for Arduino
--- Multi-transport communications platform
--- Fully asynchronous
--- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
--- Voice calls
--- SMS
--- TCP/IP connections
--- HTTP basic clients
-
-This library has been developed by Telefónica Digital - PDI -
-- Physical Internet Lab, as part as its collaboration with
-Arduino and the Open Hardware Community.
-
-September-December 2012
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-The latest version of this library can always be found at
-https://github.com/BlueVia/Official-Arduino
-*/
-#include
diff --git a/libraries/GSM/src/GSM3MobileCellManagement.h b/libraries/GSM/src/GSM3MobileCellManagement.h
deleted file mode 100644
index 035dfee996f..00000000000
--- a/libraries/GSM/src/GSM3MobileCellManagement.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
-This file is part of the GSM3 communications library for Arduino
--- Multi-transport communications platform
--- Fully asynchronous
--- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
--- Voice calls
--- SMS
--- TCP/IP connections
--- HTTP basic clients
-
-This library has been developed by Telefónica Digital - PDI -
-- Physical Internet Lab, as part as its collaboration with
-Arduino and the Open Hardware Community.
-
-September-December 2012
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-The latest version of this library can always be found at
-https://github.com/BlueVia/Official-Arduino
-*/
-#ifndef _GSM3MOBILECELLMANAGEMENT_
-#define _GSM3MOBILECELLMANAGEMENT_
-
-#include
-
-class GSM3MobileCellManagement
-{
- public:
-
- virtual inline int getLocation() {return 0;};
-
- virtual inline int getICCID() {return 0;};
-
- /** Get last command status
- @return returns 0 if last command is still executing, 1 success, >1 error
- */
- virtual int ready()=0;
-};
-
-#endif
diff --git a/libraries/GSM/src/GSM3MobileClientProvider.cpp b/libraries/GSM/src/GSM3MobileClientProvider.cpp
deleted file mode 100644
index 0de3ceea70b..00000000000
--- a/libraries/GSM/src/GSM3MobileClientProvider.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
-This file is part of the GSM3 communications library for Arduino
--- Multi-transport communications platform
--- Fully asynchronous
--- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
--- Voice calls
--- SMS
--- TCP/IP connections
--- HTTP basic clients
-
-This library has been developed by Telefónica Digital - PDI -
-- Physical Internet Lab, as part as its collaboration with
-Arduino and the Open Hardware Community.
-
-September-December 2012
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-The latest version of this library can always be found at
-https://github.com/BlueVia/Official-Arduino
-*/
-#include
-
-GSM3MobileClientProvider* theGSM3MobileClientProvider;
diff --git a/libraries/GSM/src/GSM3MobileClientProvider.h b/libraries/GSM/src/GSM3MobileClientProvider.h
deleted file mode 100644
index a771ff46d14..00000000000
--- a/libraries/GSM/src/GSM3MobileClientProvider.h
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
-This file is part of the GSM3 communications library for Arduino
--- Multi-transport communications platform
--- Fully asynchronous
--- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
--- Voice calls
--- SMS
--- TCP/IP connections
--- HTTP basic clients
-
-This library has been developed by Telefónica Digital - PDI -
-- Physical Internet Lab, as part as its collaboration with
-Arduino and the Open Hardware Community.
-
-September-December 2012
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-The latest version of this library can always be found at
-https://github.com/BlueVia/Official-Arduino
-*/
-#ifndef __GSM3_MOBILECLIENTPROVIDER__
-#define __GSM3_MOBILECLIENTPROVIDER__
-
-#include
-#include
-
-class GSM3MobileClientProvider
-{
- protected:
-
- uint8_t sockets;
-
- public:
-
- /** Constructor */
- GSM3MobileClientProvider(){};
-
- /** Minimum socket
- @return socket
- */
- virtual inline int minSocket()=0;
-
- /** Maximum socket
- @return socket
- */
- virtual inline int maxSocket()=0;
-
- /** Get last command status
- @return returns 0 if last command is still executing, 1 success, >1 error
- */
- virtual int ready()=0;
-
- /** Get status socket client
- @param socket Socket
- @return 1 if connected
- */
- virtual bool getStatusSocketClient(uint8_t socket)=0;
-
- // Socket management
-
- /** Get socket
- @param socket Socket
- @return socket
- */
- virtual int getSocket(int socket=-1)=0;
-
- /** Release socket
- @param socket Socket
- */
- virtual void releaseSocket(int socket)=0;
-
- // Client socket functions
-
- /** Connect to a server via TCP connection
- @param server Server name or IP address in a String
- @param port Port
- @param id_socket Socket
- @return 0 if command running, 1 if success, otherwise error
- */
- virtual int connectTCPClient(const char* server, int port, int id_socket)=0;
-
- /** Connect to a server (by IP address) via TCP connection
- @param add IP address in IPAddress format
- @param port Port
- @param id_socket Socket
- @return 0 if command running, 1 if success, otherwise error
- */
- virtual int connectTCPClient(IPAddress add, int port, int id_socket)=0;
-
- /** Begin writing through a socket
- @param client1Server0 1 if modem acts as client, 0 if acts as server
- @param id_socket Local socket number
- @return 0 if command running, 1 if success, otherwise error
- */
- virtual void beginWriteSocket(bool client1Server0, int id_socket)=0;
-
- /** Write through a socket. MUST go after beginWriteSocket()
- @param c character to be written
- */
- virtual void writeSocket(uint8_t c)=0;
-
- /** Write through a socket. MUST go after beginWriteSocket()
- @param buf characters to be written (final 0 will not be written)
- */
- virtual void writeSocket(const char* buf)=0;
-
- /** Finish current writing
- */
- virtual void endWriteSocket()=0;
-
- /** Check if there are data to be read in socket.
- @param client1Server0 1 if modem acts as client, 0 if acts as server
- @param id_socket Local socket number
- @return 0 if command running, 1 if there are data available, 4 if no data, otherwise error
- */
- virtual int availableSocket(bool client, int id_socket)=0;
-
- /** Read data (get a character) available in socket
- @return character
- */
- virtual int readSocket()=0;
-
- /** Flush socket
- */
- virtual void flushSocket()=0;
-
- /** Get a character but will not advance the buffer head
- @return character
- */
- virtual int peekSocket()=0;
-
- /** Close a socket
- @param client1Server0 1 if modem acts as client, 0 if acts as server
- @param id_socket Socket
- @return 0 if command running, 1 if success, otherwise error
- */
- virtual int disconnectTCP(bool client1Server0, int idsocket)=0;
-
-};
-
-extern GSM3MobileClientProvider* theGSM3MobileClientProvider;
-
-#endif
diff --git a/libraries/GSM/src/GSM3MobileClientService.cpp b/libraries/GSM/src/GSM3MobileClientService.cpp
deleted file mode 100644
index a913f54bae3..00000000000
--- a/libraries/GSM/src/GSM3MobileClientService.cpp
+++ /dev/null
@@ -1,260 +0,0 @@
-/*
-This file is part of the GSM3 communications library for Arduino
--- Multi-transport communications platform
--- Fully asynchronous
--- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
--- Voice calls
--- SMS
--- TCP/IP connections
--- HTTP basic clients
-
-This library has been developed by Telefónica Digital - PDI -
-- Physical Internet Lab, as part as its collaboration with
-Arduino and the Open Hardware Community.
-
-September-December 2012
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-The latest version of this library can always be found at
-https://github.com/BlueVia/Official-Arduino
-*/
-#include
-#include
-#include
-
-// While there is only a shield (ShieldV1) we will include it by default
-#include
-GSM3ShieldV1ClientProvider theShieldV1ClientProvider;
-
-
-#define GSM3MOBILECLIENTSERVICE_CLIENT 0x01 // 1: This side is Client. 0: This side is Server
-#define GSM3MOBILECLIENTSERVICE_WRITING 0x02 // 1: TRUE 0: FALSE
-#define GSM3MOBILECLIENTSERVICE_SYNCH 0x04 // 1: TRUE, compatible with other clients 0: FALSE
-
-#define __TOUTBEGINWRITE__ 10000
-
-
-GSM3MobileClientService::GSM3MobileClientService(bool synch)
-{
- flags = GSM3MOBILECLIENTSERVICE_CLIENT;
- if(synch)
- flags |= GSM3MOBILECLIENTSERVICE_SYNCH;
- mySocket=255;
-}
-
-GSM3MobileClientService::GSM3MobileClientService(int socket, bool synch)
-{
- // We are creating a socket on an existing, occupied one.
- flags=0;
- if(synch)
- flags |= GSM3MOBILECLIENTSERVICE_SYNCH;
- mySocket=socket;
- theGSM3MobileClientProvider->getSocket(socket);
-
-}
-
-// Returns 0 if last command is still executing
-// 1 if success
-// >1 if error
-int GSM3MobileClientService::ready()
-{
- return theGSM3MobileClientProvider->ready();
-}
-
-int GSM3MobileClientService::connect(IPAddress add, uint16_t port)
-{
- if(theGSM3MobileClientProvider==0)
- return 2;
-
- // TODO: ask for the socket id
- mySocket=theGSM3MobileClientProvider->getSocket();
-
- if(mySocket<0)
- return 2;
-
- int res=theGSM3MobileClientProvider->connectTCPClient(add, port, mySocket);
- if(flags & GSM3MOBILECLIENTSERVICE_SYNCH)
- res=waitForAnswer();
-
- return res;
-};
-
-int GSM3MobileClientService::connect(const char *host, uint16_t port)
-{
-
- if(theGSM3MobileClientProvider==0)
- return 2;
- // TODO: ask for the socket id
- mySocket=theGSM3MobileClientProvider->getSocket();
-
- if(mySocket<0)
- return 2;
-
- int res=theGSM3MobileClientProvider->connectTCPClient(host, port, mySocket);
- if(flags & GSM3MOBILECLIENTSERVICE_SYNCH)
- res=waitForAnswer();
-
- return res;
-}
-
-int GSM3MobileClientService::waitForAnswer()
-{
- unsigned long m;
- m=millis();
- int res;
-
- while(((millis()-m)< __TOUTBEGINWRITE__ )&&(ready()==0))
- delay(100);
-
- res=ready();
-
- // If we get something different from a 1, we are having a problem
- if(res!=1)
- res=0;
-
- return res;
-}
-
-void GSM3MobileClientService::beginWrite(bool sync)
-{
- flags |= GSM3MOBILECLIENTSERVICE_WRITING;
- theGSM3MobileClientProvider->beginWriteSocket(flags & GSM3MOBILECLIENTSERVICE_CLIENT, mySocket);
- if(sync)
- waitForAnswer();
-}
-
-size_t GSM3MobileClientService::write(uint8_t c)
-{
- if(!(flags & GSM3MOBILECLIENTSERVICE_WRITING))
- beginWrite(true);
- theGSM3MobileClientProvider->writeSocket(c);
- return 1;
-}
-
-size_t GSM3MobileClientService::write(const uint8_t* buf)
-{
- if(!(flags & GSM3MOBILECLIENTSERVICE_WRITING))
- beginWrite(true);
- theGSM3MobileClientProvider->writeSocket((const char*)(buf));
- return strlen((const char*)buf);
-}
-
-size_t GSM3MobileClientService::write(const uint8_t* buf, size_t sz)
-{
- if(!(flags & GSM3MOBILECLIENTSERVICE_WRITING))
- beginWrite(true);
- for(int i=0;iwriteSocket(buf[i]);
- return sz;
-}
-
-void GSM3MobileClientService::endWrite(bool sync)
-{
- flags ^= GSM3MOBILECLIENTSERVICE_WRITING;
- theGSM3MobileClientProvider->endWriteSocket();
- if(sync)
- waitForAnswer();
-}
-
-uint8_t GSM3MobileClientService::connected()
-{
- if(mySocket==255)
- return 0;
- return theGSM3MobileClientProvider->getStatusSocketClient(mySocket);
-}
-
-GSM3MobileClientService::operator bool()
-{
- return connected()==1;
-};
-
-int GSM3MobileClientService::available()
-{
- int res;
-
- // Even if not connected, we are looking for available data
-
- if(flags & GSM3MOBILECLIENTSERVICE_WRITING)
- endWrite(true);
-
- res=theGSM3MobileClientProvider->availableSocket(flags & GSM3MOBILECLIENTSERVICE_CLIENT,mySocket);
- if(flags & GSM3MOBILECLIENTSERVICE_SYNCH)
- res=waitForAnswer();
-
- return res;
-}
-
-int GSM3MobileClientService::read(uint8_t *buf, size_t size)
-{
- int i;
- uint8_t c;
-
- for(i=0;ireadSocket(flags & GSM3MOBILECLIENTSERVICE_CLIENT, (char *)(buf), size, mySocket);
-
- return res;
-*/
-}
-
-int GSM3MobileClientService::read()
-{
- if(flags & GSM3MOBILECLIENTSERVICE_WRITING)
- endWrite(true);
- int c=theGSM3MobileClientProvider->readSocket();
- return c;
-}
-
-int GSM3MobileClientService::peek()
-{
- if(flags & GSM3MOBILECLIENTSERVICE_WRITING)
- endWrite(true);
- return theGSM3MobileClientProvider->peekSocket(/*mySocket, false*/);
-}
-
-void GSM3MobileClientService::flush()
-{
- if(flags & GSM3MOBILECLIENTSERVICE_WRITING)
- endWrite(true);
- theGSM3MobileClientProvider->flushSocket(/*mySocket*/);
- if(flags & GSM3MOBILECLIENTSERVICE_SYNCH)
- waitForAnswer();
-
-}
-
-void GSM3MobileClientService::stop()
-{
- if(flags & GSM3MOBILECLIENTSERVICE_WRITING)
- endWrite(true);
- theGSM3MobileClientProvider->disconnectTCP(flags & GSM3MOBILECLIENTSERVICE_CLIENT, mySocket);
- theGSM3MobileClientProvider->releaseSocket(mySocket);
- mySocket = 0;
- if(flags & GSM3MOBILECLIENTSERVICE_SYNCH)
- waitForAnswer();
-}
-
diff --git a/libraries/GSM/src/GSM3MobileClientService.h b/libraries/GSM/src/GSM3MobileClientService.h
deleted file mode 100644
index 5a36a975c97..00000000000
--- a/libraries/GSM/src/GSM3MobileClientService.h
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
-This file is part of the GSM3 communications library for Arduino
--- Multi-transport communications platform
--- Fully asynchronous
--- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
--- Voice calls
--- SMS
--- TCP/IP connections
--- HTTP basic clients
-
-This library has been developed by Telefónica Digital - PDI -
-- Physical Internet Lab, as part as its collaboration with
-Arduino and the Open Hardware Community.
-
-September-December 2012
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-The latest version of this library can always be found at
-https://github.com/BlueVia/Official-Arduino
-*/
-#ifndef _GSM3MOBILECLIENTSERVICE_
-#define _GSM3MOBILECLIENTSERVICE_
-
-#include
-#include
-
-
-class GSM3MobileClientService : public Client
-{
- private:
-
- uint8_t mySocket;
- uint8_t flags;
-
- /** Blocks waiting for an answer
- @return returns 0 if last command is still executing, 1 success, >1 error
- */
- int waitForAnswer();
-
- public:
-
- /** Constructor
- @param synch Sync mode
- */
- GSM3MobileClientService(bool synch=true);
-
- /** Constructor
- @param socket Socket
- @param synch Sync mode
- */
- GSM3MobileClientService(int socket, bool synch);
-
- /** Get last command status
- @return returns 0 if last command is still executing, 1 success, >1 error
- */
- int ready();
-
- // we take this function out as IPAddress is complex to bring to
- // version 1.
- /** Connect to server by IP address
- @param (IPAddress)
- @param (uint16_t)
- @return returns 0 if last command is still executing, 1 success, 2 if there are no resources
- */
- inline int connect(IPAddress, uint16_t);
-
- /** Connect to server by hostname
- @param host Hostname
- @param port Port
- @return returns 0 if last command is still executing, 1 success, 2 if there are no resources
- */
- int connect(const char *host, uint16_t port);
-
- /** Initialize write in request
- @param sync Sync mode
- */
- void beginWrite(bool sync=false);
-
- /** Write a character in request
- @param c Character
- @return size
- */
- size_t write(uint8_t c);
-
- /** Write a characters buffer in request
- @param buf Buffer
- @return buffer size
- */
- size_t write(const uint8_t *buf);
-
- /** Write a characters buffer with size in request
- @param (uint8_t*) Buffer
- @param (size_t) Buffer size
- @return buffer size
- */
- size_t write(const uint8_t*, size_t);
-
- /** Finish write request
- @param sync Sync mode
- */
- void endWrite(bool sync=false);
-
- /** Check if connected to server
- @return 1 if connected
- */
- uint8_t connected();
-
- operator bool();
-
- /** Read from response buffer and copy size specified to buffer
- @param buf Buffer
- @param size Buffer size
- @return bytes read
- */
- int read(uint8_t *buf, size_t size);
-
- /** Read a character from response buffer
- @return character
- */
- int read();
-
- /** Check if exists a response available
- @return 1 if exists, 0 if not exists
- */
- int available();
-
- /** Read a character from response buffer but does not move the pointer.
- @return character
- */
- int peek();
-
- /** Flush response buffer
- */
- void flush();
-
- /** Stop client
- */
- void stop();
-
- /** Get socket
- @return socket
- */
- inline int getSocket(){return (int)mySocket;};
-
-
-};
-
-
-#endif
\ No newline at end of file
diff --git a/libraries/GSM/src/GSM3MobileDataNetworkProvider.cpp b/libraries/GSM/src/GSM3MobileDataNetworkProvider.cpp
deleted file mode 100644
index c57c3416871..00000000000
--- a/libraries/GSM/src/GSM3MobileDataNetworkProvider.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
-This file is part of the GSM3 communications library for Arduino
--- Multi-transport communications platform
--- Fully asynchronous
--- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
--- Voice calls
--- SMS
--- TCP/IP connections
--- HTTP basic clients
-
-This library has been developed by Telefónica Digital - PDI -
-- Physical Internet Lab, as part as its collaboration with
-Arduino and the Open Hardware Community.
-
-September-December 2012
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-The latest version of this library can always be found at
-https://github.com/BlueVia/Official-Arduino
-*/
-#include
-
-// GSM3MobileDataNetworkProvider* theGSM3MobileDataNetworkProvider;
diff --git a/libraries/GSM/src/GSM3MobileDataNetworkProvider.h b/libraries/GSM/src/GSM3MobileDataNetworkProvider.h
deleted file mode 100644
index bffd381fa7f..00000000000
--- a/libraries/GSM/src/GSM3MobileDataNetworkProvider.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
-This file is part of the GSM3 communications library for Arduino
--- Multi-transport communications platform
--- Fully asynchronous
--- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
--- Voice calls
--- SMS
--- TCP/IP connections
--- HTTP basic clients
-
-This library has been developed by Telefónica Digital - PDI -
-- Physical Internet Lab, as part as its collaboration with
-Arduino and the Open Hardware Community.
-
-September-December 2012
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-The latest version of this library can always be found at
-https://github.com/BlueVia/Official-Arduino
-*/
-#ifndef _GSM3MOBILEDATANETWORKPROVIDER_
-#define _GSM3MOBILEDATANETWORKPROVIDER_
-
-#include
-
-// This class is not really useful, but serves as a guideline for programmers
-// We keep it but it should never be linked
-class GSM3MobileDataNetworkProvider
-{
- public:
-
- /** Attach to GPRS/GSM network
- @param networkId APN GPRS
- @param user Username
- @param pass Password
- @return connection status
- */
- virtual GSM3_NetworkStatus_t networkAttach(char* networId, char* user, char* pass)=0;
-
- /** Detach GPRS/GSM network
- @return connection status
- */
- virtual GSM3_NetworkStatus_t networkDetach()=0;
-
-};
-
-extern GSM3MobileDataNetworkProvider* theGSM3MobileDataNetworkProvider;
-
-#endif
\ No newline at end of file
diff --git a/libraries/GSM/src/GSM3MobileMockupProvider.cpp b/libraries/GSM/src/GSM3MobileMockupProvider.cpp
deleted file mode 100644
index 8680e18467e..00000000000
--- a/libraries/GSM/src/GSM3MobileMockupProvider.cpp
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
-This file is part of the GSM3 communications library for Arduino
--- Multi-transport communications platform
--- Fully asynchronous
--- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
--- Voice calls
--- SMS
--- TCP/IP connections
--- HTTP basic clients
-
-This library has been developed by Telefónica Digital - PDI -
-- Physical Internet Lab, as part as its collaboration with
-Arduino and the Open Hardware Community.
-
-September-December 2012
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-The latest version of this library can always be found at
-https://github.com/BlueVia/Official-Arduino
-*/
-#include
-#include
-#include
-#include
-#include
-
-
-GSM3MobileMockupProvider::GSM3MobileMockupProvider()
-{
- lineStatus=IDLE;
- msgExample="Hello#World";
- msgIndex=0;
-};
-
-int GSM3MobileMockupProvider::begin(char* pin)
-{
- Serial.println("GSM3MobileMockupProvider::begin()");
- return 0;
-};
-
-int GSM3MobileMockupProvider::ready()
-{
- Serial.println("GSM3MobileMockupProvider::ready()");
- return 1;
-};
-
-int GSM3MobileMockupProvider::beginSMS(const char* number)
-{
- Serial.println("SM3MobileMockupProvider::beginSMS()");
- return 0;
-};
-
-void GSM3MobileMockupProvider::writeSMS(char c)
-{
- Serial.print(c);
-};
-
-int GSM3MobileMockupProvider::endSMS()
-{
- Serial.println("GSM3MobileMockupProvider::endSMS()");
-};
-
-int GSM3MobileMockupProvider::availableSMS()
-{
- Serial.println("GSM3MobileMockupProvider::availableSMS()");
- return 120;
-};
-
-int GSM3MobileMockupProvider::peek()
-{
- return (int)'H';
-};
-
-int GSM3MobileMockupProvider::remoteSMSNumber(char* number, int nlength)
-{
- if(nlength>=13)
- strcpy(number, "+34630538546");
- return 12;
-};
-
-
-void GSM3MobileMockupProvider::flushSMS()
-{
- Serial.println("GSM3MobileMockupProvider::flushSMS()");
-};
-
-int GSM3MobileMockupProvider::readSMS()
-{
- if(msgExample[msgIndex]==0)
- {
- msgIndex=0;
- return 0;
- }
- else
- {
- msgIndex++;
- return msgExample[msgIndex-1];
- };
-};
-
-int GSM3MobileMockupProvider::connectTCPClient(const char* server, int port, int id_socket)
-{
- Serial.println("GSM3MobileMockupProvider::connectTCPClient()");
- Serial.print(server);Serial.print(":");Serial.print(port);Serial.print("-");Serial.println(id_socket);
-}
-
-void GSM3MobileMockupProvider::writeSocket(const uint8_t *buf, size_t size, int id_socket)
-{
- int i;
- for(i=0;i=minSocket())&&(socket<=maxSocket()))
- return 1;
- else
- return 0;
-};
-*/
-
-int GSM3MobileMockupProvider::readSocket(uint8_t *buf, size_t size, int idsocket)
-{
- int i;
- int l=strlen(msgExample);
- for(i=0;(i12))
- strcpy("192.168.1.1", localIP);
- return 1;
-};
-
-bool GSM3MobileMockupProvider::getSocketModemStatus(uint8_t s)
-{
- // Feeling lazy
- return true;
-}
-
diff --git a/libraries/GSM/src/GSM3MobileMockupProvider.h b/libraries/GSM/src/GSM3MobileMockupProvider.h
deleted file mode 100644
index 59eee4185d6..00000000000
--- a/libraries/GSM/src/GSM3MobileMockupProvider.h
+++ /dev/null
@@ -1,255 +0,0 @@
-/*
-This file is part of the GSM3 communications library for Arduino
--- Multi-transport communications platform
--- Fully asynchronous
--- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
--- Voice calls
--- SMS
--- TCP/IP connections
--- HTTP basic clients
-
-This library has been developed by Telefónica Digital - PDI -
-- Physical Internet Lab, as part as its collaboration with
-Arduino and the Open Hardware Community.
-
-September-December 2012
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-The latest version of this library can always be found at
-https://github.com/BlueVia/Official-Arduino
-*/
-#ifndef _GSM3MOBILEMOCKUPPROVIDER_
-#define _GSM3MOBILEMOCKUPPROVIDER_
-
-#include
-#include
-
-class GSM3MobileMockupProvider: public GSM3MobileNetworkProvider
-{
- private:
- // Introducing this status is quite "heavy". But something like this should
- // be added to ShieldV1. Or not.
- // Note, in ShieldV1 there is no "RECEIVINGSMS" status.
- enum GSM3_modemlinest_e { IDLE, WAITINGANSWER, SENDINGSMS};
- GSM3_modemlinest_e lineStatus;
- char* msgExample;
- int msgIndex;
-
- public:
-
- /** Minimum socket
- @return 1
- */
- inline int minSocket(){return 1;};
-
- /** Maximum socket
- @return 8
- */
- inline int maxSocket(){return 8;};
-
- /** Constructor */
- GSM3MobileMockupProvider();
-
- /** Get network status
- @return network status
- */
- inline GSM3_NetworkStatus_t getStatus(){return ERROR;};
-
- /** Get voice call status
- @return call status
- */
- inline GSM3_voiceCall_st getvoiceCallStatus(){return IDLE_CALL;};
-
- /** Get last command status
- @return Returns 0 if last command is still executing, 1 success, >1 error
- */
- int ready();
- inline void closeCommand(int code){};
-
- //Configuration functions.
-
- /** Begin connection
- @param pin PIN code
- @return
- */
- int begin(char* pin=0);
-
- /** Check if is modem alive
- @return 0
- */
- inline int isModemAlive(){return 0;};
-
- /** Shutdown the modem (power off really)
- @return true if successful
- */
- inline bool shutdown(){return false;};
-
- //Call functions
-
- /** Launch a voice call
- @param number Phone number to be called
- @return If asynchronous, returns 0. If synchronous, 1 if success, other if error
- */
- inline int voiceCall(const char* number){return 0;};
-
- /** Answer a voice call
- @return If asynchronous, returns 0. If synchronous, 1 if success, other if error
- */
- inline int answerCall(){return 0;};
-
- /** Hang a voice call
- @return If asynchronous, returns 0. If synchronous, 1 if success, other if error
- */
- inline int hangCall(){return 0;};
-
- /** Retrieve phone number of caller
- @param buffer Buffer for copy phone number
- @param bufsize Buffer size
- @return If asynchronous, returns 0. If synchronous, 1 if success, other if error
- */
- inline int retrieveCallingNumber(char* buffer, int*& bufsize){return 0;};
-
- // SMS functions
-
- /** Begin a SMS to send it
- @param number Destination
- @return error command if it exists
- */
- int beginSMS(const char* number);
-
- /** End SMS
- @return error command if it exists
- */
- int endSMS();
-
- /** Check if SMS available and prepare it to be read
- @return error command if it exists
- */
- int availableSMS();
-
- /** Read a byte but do not advance the buffer header (circular buffer)
- @return character
- */
- int peek();
-
- /** Delete the SMS from Modem memory and proccess answer
- */
- void flushSMS();
-
- /** Read sender number phone
- @param number Buffer for save number phone
- @param nlength Buffer length
- @return 1 success, >1 error
- */
- int remoteSMSNumber(char* number, int nlength);
-
- /** Read one char for SMS buffer (advance circular buffer)
- @return character
- */
- int readSMS();
-
- /** Write a SMS character by character
- @param c Character
- */
- void writeSMS(char c);
-
- // Socket functions
-
- /** Connect to a remote TCP server
- @param server String with IP or server name
- @param port Remote port number
- @param id_socket Local socket number
- @return 0 if command running, 1 if success, otherwise error
- */
- int connectTCPClient(const char* server, int port, int id_socket);
-
- // Attention to parameter rewriting in ShieldV1
- /** Write buffer information into a socket
- @param buf Buffer
- @param size Buffer size
- @param idsocket Socket
- */
- void writeSocket(const uint8_t *buf, size_t size, int idsocket);
-
- // ShieldV1 will have two reading mechanisms:
- // Mechanism 1: Call AT+QIRD for size bytes. Put them in the circular buffer,
- // fill buf. Take care to xon/xoff effect, as we may copy just a part of the
- // incoming bytes.
- /** Read socket and put information in a buffer
- @param buf Buffer
- @param size Buffer size
- @param idsocket Socket
- @return
- */
- int readSocket(uint8_t *buf, size_t size, int idsocket);
-
- // Mechanism 2 in ShieldV1:
- // When called "available()" or "read()" reuse readSocket code to execute
- // QIRD SYNCHRONOUSLY. Ask the modem for 1500 bytes but do not copy them anywhere,
- // leave data in the circular buffer. Put buffer head at the start of received data.
- // Peek() will get a character but will not advance the buffer head.
- // Read() will get one character. XON/XOFF will take care of buffer filling
- // If Read() gets to the end of the QIRD response, execute again QIRD SYNCHRONOUSLY
- // If the user executes flush(), execute read() until there is nothing more to read()
- // (the modem gives no way to empty the socket of incoming data)
-
- /** Check if there are data to be read in socket.
- @param idsocket Local socket number
- @return 0 if command running, 1 if there are data available, 4 if no data, otherwise error
- */
- int availableSocket(int idsocket);
-
- /** Read data (get a character) available in socket
- @param idsocket Socket
- @param advance Determines if advance the buffer head
- @return character
- */
- int readSocket(int idsocket, bool advance=true);
-
- /** Flush socket
- @param idsocket Socket
- */
- void flushSocket(int idsocket);
-
- // This is the same in ShieldV1
- /** Close a socket
- @param idsocket Socket
- @return 0 if command running, 1 if success, otherwise error
- */
- int disconnectTCP(int idsocket);
-
- // TCP Server. Attention. Changing the int*&. We'll receive a buffer for the IP
- // If the pointer ins NULL just forget it
- // I think that opening a server does not occupy a socket. Is that true?
- /** Establish a TCP connection
- @param port Port
- @param localIP IP address
- @param localIPlength IP address size in characters
- @return command error if exists
- */
- int connectTCPServer(int port, char* localIP, int* localIPlength);
-
- // Modem sockets status. Return TRUE if the modem thinks the socket is occupied.
- // This should be detected through an unrequisited response
- /** Get modem status
- @param s Socket
- @return modem status (true if connected)
- */
- bool getSocketModemStatus(uint8_t s);
-
-
-};
-#endif
diff --git a/libraries/GSM/src/GSM3MobileNetworkProvider.cpp b/libraries/GSM/src/GSM3MobileNetworkProvider.cpp
deleted file mode 100644
index c9fe01af315..00000000000
--- a/libraries/GSM/src/GSM3MobileNetworkProvider.cpp
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
-This file is part of the GSM3 communications library for Arduino
--- Multi-transport communications platform
--- Fully asynchronous
--- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
--- Voice calls
--- SMS
--- TCP/IP connections
--- HTTP basic clients
-
-This library has been developed by Telefónica Digital - PDI -
-- Physical Internet Lab, as part as its collaboration with
-Arduino and the Open Hardware Community.
-
-September-December 2012
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-The latest version of this library can always be found at
-https://github.com/BlueVia/Official-Arduino
-*/
-#include
-
-GSM3MobileNetworkProvider* theProvider;
-
-GSM3MobileNetworkProvider::GSM3MobileNetworkProvider()
-{
- socketsAsServer=0x0000;
-};
-
-
-int GSM3MobileNetworkProvider::getNewOccupiedSocketAsServer()
-{
- int i;
- for(i=minSocketAsServer(); i<=maxSocketAsServer(); i++)
- {
- if ((!(socketsAsServer&(0x0001<
-#include
-#include
-#include
-
-class GSM3MobileNetworkProvider
-{
- private:
-
- /** Restart hardware
- @return 1 if successful
- */
- int HWrestart();
-
- uint16_t socketsAsServer; // Server socket
-
- /** Get modem status
- @param s Socket
- @return modem status (true if connected)
- */
- virtual inline bool getSocketAsServerModemStatus(int s){return false;};
-
- public:
-
- /** minSocketAsServer
- @return 0
- */
- virtual inline int minSocketAsServer(){return 0;};
-
- /** maxSocketAsServer
- @return 0
- */
- virtual inline int maxSocketAsServer(){return 0;};
-
- /** Get last command status
- @return returns 0 if last command is still executing, 1 success, >1 error
- */
- virtual int ready()=0;
-
- /** Constructor */
- GSM3MobileNetworkProvider();
-
- /** Get network status
- @return network status
- */
- virtual inline GSM3_NetworkStatus_t getStatus(){return ERROR;};
-
- /** Get socket client status
- @param socket Socket
- @return 1 if connected, 0 otherwise
- */
- bool getStatusSocketClient(uint8_t socket);
-
- /** Close a AT command
- @param code Close code
- */
- virtual inline void closeCommand(int code){};
-
- /** Establish a TCP connection
- @param port Port
- @param localIP IP address
- @param localIPlength IP address size in characters
- @return command error if exists
- */
- virtual inline int connectTCPServer(int port, char* localIP, int localIPlength){return 0;};
-
- /** Get local IP address
- @param LocalIP Buffer for save IP address
- @param LocalIPlength Buffer size
- */
- virtual inline int getIP(char* LocalIP, int LocalIPlength){return 0;};
-
- /** Get new occupied socket
- @return -1 if no new socket has been occupied
- */
- int getNewOccupiedSocketAsServer();
-
- /** Get socket status as server
- @param socket Socket to get status
- @return socket status
- */
- bool getStatusSocketAsServer(uint8_t socket);
-
- /** Close a socket
- @param client1Server0 1 if modem acts as client, 0 if acts as server
- @param id_socket Local socket number
- @return 0 if command running, 1 if success, otherwise error
- */
- int disconnectTCP(bool client1Server0, int idsocket){return 1;};
-
- /** Release socket
- @param socket Socket
- */
- void releaseSocket(int socket){};
-
-};
-
-extern GSM3MobileNetworkProvider* theProvider;
-
-#endif
diff --git a/libraries/GSM/src/GSM3MobileNetworkRegistry.cpp b/libraries/GSM/src/GSM3MobileNetworkRegistry.cpp
deleted file mode 100644
index 5e22f3af81f..00000000000
--- a/libraries/GSM/src/GSM3MobileNetworkRegistry.cpp
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
-This file is part of the GSM3 communications library for Arduino
--- Multi-transport communications platform
--- Fully asynchronous
--- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
--- Voice calls
--- SMS
--- TCP/IP connections
--- HTTP basic clients
-
-This library has been developed by Telefónica Digital - PDI -
-- Physical Internet Lab, as part as its collaboration with
-Arduino and the Open Hardware Community.
-
-September-December 2012
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-The latest version of this library can always be found at
-https://github.com/BlueVia/Official-Arduino
-*/
-#include
-
-GSM3MobileNetworkRegistry::GSM3MobileNetworkRegistry()
-{
- theProvider=0;
-};
-
-void GSM3MobileNetworkRegistry::registerMobileNetworkProvider(GSM3MobileNetworkProvider* provider)
-{
- theProvider=provider;
-}
-
-GSM3MobileNetworkProvider* GSM3MobileNetworkRegistry::getMobileNetworkProvider()
-{
- return theProvider;
-}
-
-GSM3MobileNetworkRegistry theMobileNetworkRegistry;
diff --git a/libraries/GSM/src/GSM3MobileNetworkRegistry.h b/libraries/GSM/src/GSM3MobileNetworkRegistry.h
deleted file mode 100644
index de4397725f2..00000000000
--- a/libraries/GSM/src/GSM3MobileNetworkRegistry.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
-This file is part of the GSM3 communications library for Arduino
--- Multi-transport communications platform
--- Fully asynchronous
--- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
--- Voice calls
--- SMS
--- TCP/IP connections
--- HTTP basic clients
-
-This library has been developed by Telefónica Digital - PDI -
-- Physical Internet Lab, as part as its collaboration with
-Arduino and the Open Hardware Community.
-
-September-December 2012
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-The latest version of this library can always be found at
-https://github.com/BlueVia/Official-Arduino
-*/
-#ifndef _GSM3MOBILENETWORKREGISTRY_
-#define _GSM3MOBILENETWORKREGISTRY_
-#include
-
-class GSM3MobileNetworkRegistry
-{
- private:
-
- GSM3MobileNetworkProvider* theProvider; // Network provider
-
- public:
-
- /** Constructor */
- GSM3MobileNetworkRegistry();
-
- /** Register in mobile network provider
- @param provider Provider
- */
- void registerMobileNetworkProvider(GSM3MobileNetworkProvider* provider);
-
- /** Returns network provider object pointer
- @return mobile network provider
- */
- GSM3MobileNetworkProvider* getMobileNetworkProvider();
-
-};
-
-extern GSM3MobileNetworkRegistry theMobileNetworkRegistry;
-
-#endif
\ No newline at end of file
diff --git a/libraries/GSM/src/GSM3MobileSMSProvider.cpp b/libraries/GSM/src/GSM3MobileSMSProvider.cpp
deleted file mode 100644
index e5575ceb872..00000000000
--- a/libraries/GSM/src/GSM3MobileSMSProvider.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
-This file is part of the GSM3 communications library for Arduino
--- Multi-transport communications platform
--- Fully asynchronous
--- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
--- Voice calls
--- SMS
--- TCP/IP connections
--- HTTP basic clients
-
-This library has been developed by Telefónica Digital - PDI -
-- Physical Internet Lab, as part as its collaboration with
-Arduino and the Open Hardware Community.
-
-September-December 2012
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-The latest version of this library can always be found at
-https://github.com/BlueVia/Official-Arduino
-*/
-#include
-
-GSM3MobileSMSProvider* theGSM3SMSProvider;
diff --git a/libraries/GSM/src/GSM3MobileSMSProvider.h b/libraries/GSM/src/GSM3MobileSMSProvider.h
deleted file mode 100644
index aa72711014b..00000000000
--- a/libraries/GSM/src/GSM3MobileSMSProvider.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
-This file is part of the GSM3 communications library for Arduino
--- Multi-transport communications platform
--- Fully asynchronous
--- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
--- Voice calls
--- SMS
--- TCP/IP connections
--- HTTP basic clients
-
-This library has been developed by Telefónica Digital - PDI -
-- Physical Internet Lab, as part as its collaboration with
-Arduino and the Open Hardware Community.
-
-September-December 2012
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-The latest version of this library can always be found at
-https://github.com/BlueVia/Official-Arduino
-*/
-#ifndef _GSM3MOBILESMSPROVIDER_
-#define _GSM3MOBILESMSPROVIDER_
-
-class GSM3MobileSMSProvider
-{
- public:
-
- /** Begin a SMS to send it
- @param to Destination
- @return error command if it exists
- */
- virtual inline int beginSMS(const char* to){return 0;};
-
- /** Write a SMS character by character
- @param c Character
- */
- virtual inline void writeSMS(const char c){};
-
- /** End SMS
- @return error command if it exists
- */
- virtual inline int endSMS(){return 0;};
-
- /** Check if SMS available and prepare it to be read
- @return number of bytes in a received SMS
- */
- virtual inline int availableSMS(){return 0;};
-
- /** Read a byte but do not advance the buffer header (circular buffer)
- @return character
- */
- virtual inline int peekSMS(){return 0;};
-
- /** Delete the SMS from Modem memory and proccess answer
- */
- virtual inline void flushSMS(){return;};
-
- /** Read sender number phone
- @param number Buffer for save number phone
- @param nlength Buffer length
- @return 1 success, >1 error
- */
- virtual inline int remoteSMSNumber(char* number, int nlength){return 0;};
-
- /** Read one char for SMS buffer (advance circular buffer)
- @return character
- */
- virtual inline int readSMS(){return 0;};
-
- /** Get last command status
- @return returns 0 if last command is still executing, 1 success, >1 error
- */
- virtual int ready()=0;
-};
-
-extern GSM3MobileSMSProvider* theGSM3SMSProvider;
-
-#endif
diff --git a/libraries/GSM/src/GSM3MobileServerProvider.cpp b/libraries/GSM/src/GSM3MobileServerProvider.cpp
deleted file mode 100644
index d101bbab2a0..00000000000
--- a/libraries/GSM/src/GSM3MobileServerProvider.cpp
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
-This file is part of the GSM3 communications library for Arduino
--- Multi-transport communications platform
--- Fully asynchronous
--- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
--- Voice calls
--- SMS
--- TCP/IP connections
--- HTTP basic clients
-
-This library has been developed by Telefónica Digital - PDI -
-- Physical Internet Lab, as part as its collaboration with
-Arduino and the Open Hardware Community.
-
-September-December 2012
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-The latest version of this library can always be found at
-https://github.com/BlueVia/Official-Arduino
-*/
-
-#include
-
-GSM3MobileServerProvider* theGSM3MobileServerProvider;
-
-
diff --git a/libraries/GSM/src/GSM3MobileServerProvider.h b/libraries/GSM/src/GSM3MobileServerProvider.h
deleted file mode 100644
index e4eb9c5030d..00000000000
--- a/libraries/GSM/src/GSM3MobileServerProvider.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
-This file is part of the GSM3 communications library for Arduino
--- Multi-transport communications platform
--- Fully asynchronous
--- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
--- Voice calls
--- SMS
--- TCP/IP connections
--- HTTP basic clients
-
-This library has been developed by Telefónica Digital - PDI -
-- Physical Internet Lab, as part as its collaboration with
-Arduino and the Open Hardware Community.
-
-September-December 2012
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-The latest version of this library can always be found at
-https://github.com/BlueVia/Official-Arduino
-*/
-#ifndef __GSM3_MOBILESERVERPROVIDER__
-#define __GSM3_MOBILESERVERPROVIDER__
-
-
-#include
-#include
-#include
-
-
-class GSM3MobileServerProvider
-{
- /** Get socket status
- @param s Socket
- @return modem status (true if connected)
- */
- virtual bool getSocketAsServerModemStatus(int s)=0;
-
- public:
-
- /** minSocketAsServer
- @return socket
- */
- virtual int minSocketAsServer()=0;
-
- /** maxSocketAsServer
- @return socket
- */
- virtual int maxSocketAsServer()=0;
-
- /** Get last command status
- @return returns 0 if last command is still executing, 1 success, >1 error
- */
- virtual int ready()=0;
-
- /** Constructor */
- GSM3MobileServerProvider(){};
-
- /** Connect server to TCP port
- @param port TCP port
- @return command error if exists
- */
- virtual int connectTCPServer(int port)=0;
- //virtual int getIP(char* LocalIP, int LocalIPlength)=0;
-
- /** Get new occupied socket as server
- @return return -1 if no new socket has been occupied
- */
- virtual int getNewOccupiedSocketAsServer()=0;
-
- /** Get socket status
- @param socket Socket
- @return socket status (true if connected)
- */
- virtual bool getStatusSocketAsServer(uint8_t socket)=0;
-
- // virtual int disconnectTCP(bool client1Server0, int idsocket)=0;
-
-};
-
-extern GSM3MobileServerProvider* theGSM3MobileServerProvider;
-
-#endif
diff --git a/libraries/GSM/src/GSM3MobileServerService.cpp b/libraries/GSM/src/GSM3MobileServerService.cpp
deleted file mode 100644
index bf76cfcbb63..00000000000
--- a/libraries/GSM/src/GSM3MobileServerService.cpp
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
-This file is part of the GSM3 communications library for Arduino
--- Multi-transport communications platform
--- Fully asynchronous
--- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
--- Voice calls
--- SMS
--- TCP/IP connections
--- HTTP basic clients
-
-This library has been developed by Telefónica Digital - PDI -
-- Physical Internet Lab, as part as its collaboration with
-Arduino and the Open Hardware Community.
-
-September-December 2012
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-The latest version of this library can always be found at
-https://github.com/BlueVia/Official-Arduino
-*/
-#include
-#include
-#include
-
-
-#define __TOUTSERVER__ 10000
-#define BUFFERSIZETWEET 100
-
-#define GSM3MOBILESERVERSERVICE_SYNCH 0x01 // 1: TRUE, compatible with other clients 0: FALSE
-
-// While there is only a shield (ShieldV1) we will include it by default
-#include
-GSM3ShieldV1ServerProvider theShieldV1ServerProvider;
-
-
-GSM3MobileServerService::GSM3MobileServerService(uint8_t port, bool synch)
-{
- mySocket=0;
- _port=port;
- flags = 0;
-
- // If synchronous
- if(synch)
- flags |= GSM3MOBILESERVERSERVICE_SYNCH;
-}
-
-// Returns 0 if last command is still executing
-// 1 if success
-// >1 if error
-int GSM3MobileServerService::ready()
-{
- return theGSM3MobileServerProvider->ready();
-}
-
-void GSM3MobileServerService::begin()
-{
- if(theGSM3MobileServerProvider==0)
- return;
- theGSM3MobileServerProvider->connectTCPServer(_port);
-
- if(flags & GSM3MOBILESERVERSERVICE_SYNCH)
- waitForAnswer();
-}
-
-GSM3MobileClientService GSM3MobileServerService::available(bool synch)
-{
- int newSocket;
- // In case we are debugging, we'll need to force a look at the buffer
- ready();
-
- newSocket=theGSM3MobileServerProvider->getNewOccupiedSocketAsServer();
-
- // Instatiate new client. If we are synch, the client is synchronous/blocking
- GSM3MobileClientService client((uint8_t)(newSocket), (flags & GSM3MOBILESERVERSERVICE_SYNCH));
-
- return client;
-}
-
-size_t GSM3MobileServerService::write(uint8_t c)
-{
-// Adapt to the new, lean implementation
-// theGSM3MobileServerProvider->writeSocket(c);
- return 1;
-}
-
-void GSM3MobileServerService::beginWrite()
-{
-// Adapt to the new, lean implementation
-// theGSM3MobileServerProvider->beginWriteSocket(local1Remote0, mySocket);
-}
-
-size_t GSM3MobileServerService::write(const uint8_t* buf)
-{
-// Adapt to the new, lean implementation
-// theGSM3MobileServerProvider->writeSocket((const char*)(buf));
- return strlen((const char*)buf);
-}
-
-size_t GSM3MobileServerService::write(const uint8_t* buf, size_t sz)
-{
-// Adapt to the new, lean implementation
-// theGSM3MobileServerProvider->writeSocket((const char*)(buf));
-}
-
-void GSM3MobileServerService::endWrite()
-{
-// Adapt to the new, lean implementation
-// theGSM3MobileServerProvider->endWriteSocket();
-}
-
-void GSM3MobileServerService::stop()
-{
-
- // Review, should be the server?
- theGSM3MobileClientProvider->disconnectTCP(local1Remote0, mySocket);
- if(flags & GSM3MOBILESERVERSERVICE_SYNCH)
- waitForAnswer();
- theGSM3MobileClientProvider->releaseSocket(mySocket);
- mySocket = -1;
-}
-
-
-/*int GSM3MobileServerService::getIP(char* LocalIP, int LocalIPlength)
-{
- return theGSM3MobileServerProvider->getIP(LocalIP, LocalIPlength);
-}*/
-
-int GSM3MobileServerService::waitForAnswer()
-{
- unsigned long m;
- m=millis();
- int res;
-
- while(((millis()-m)< __TOUTSERVER__ )&&(ready()==0))
- delay(10);
-
- res=ready();
-
- // If we get something different from a 1, we are having a problem
- if(res!=1)
- res=0;
-
- return res;
-}
-
-
diff --git a/libraries/GSM/src/GSM3MobileServerService.h b/libraries/GSM/src/GSM3MobileServerService.h
deleted file mode 100644
index 12165eed1b1..00000000000
--- a/libraries/GSM/src/GSM3MobileServerService.h
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
-This file is part of the GSM3 communications library for Arduino
--- Multi-transport communications platform
--- Fully asynchronous
--- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
--- Voice calls
--- SMS
--- TCP/IP connections
--- HTTP basic clients
-
-This library has been developed by Telefónica Digital - PDI -
-- Physical Internet Lab, as part as its collaboration with
-Arduino and the Open Hardware Community.
-
-September-December 2012
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-The latest version of this library can always be found at
-https://github.com/BlueVia/Official-Arduino
-*/
-#ifndef _GSM3MOBILESERVERSERVICE_
-#define _GSM3MOBILESERVERSERVICE_
-
-#include
-#include
-#include
-
-class GSM3MobileServerService : public Server
-{
- private:
-
- uint8_t _port; // Port
- uint8_t mySocket; // Actual socket
- uint8_t flags;
- bool local1Remote0;
-
- /** Internal utility, used in synchronous calls
- @return operation result, 1 if success, 0 otherwise
- */
- int waitForAnswer();
-
- public:
-
- /** Constructor
- @param port Port
- @param synch True if the server acts synchronously
- */
- GSM3MobileServerService(uint8_t port, bool synch=true);
-
- /** Get last command status
- @return returns 0 if last command is still executing, 1 success, >1 error
- */
- int ready();
-
- /** Initialize server
- */
- void begin();
-
- /** Check if there is an incoming client request
- @param synch If true, the returned client is synchronous or
- blocking.
- @return Client if successful, else error
- */
- GSM3MobileClientService available(bool synch=true);
-
- // Just to keep in line with Ethernet.
- // Write to every open socket...
- //void write(uint8_t);
- //void write(const uint8_t *buf, size_t size);
-
- /** Begin write in socket
- */
- void beginWrite();
-
- /** Write character in socket
- @param c Character
- @return size
- */
- size_t write(uint8_t c);
-
- /** Write buffer in socket
- @param buf Buffer
- @return size
- */
- size_t write(const uint8_t *buf);
-
- /** Write buffer in socket with size
- @param buf Buffer
- @param sz Buffer size
- @return size
- */
- size_t write(const uint8_t *buf, size_t sz);
-
- /** End write in socket
- */
- void endWrite();
-
- /** Stop server
- */
- void stop();
-
- // we take this function out as IPAddress is complex to bring to
- // version 1.
- // inline int connect(IPAddress ip, uint16_t port){return 0;};
- // Returns 2 if there are no resources
- //int getIP(char* LocalIP, int LocalIPlength);
-
-};
-
-
-#endif
\ No newline at end of file
diff --git a/libraries/GSM/src/GSM3MobileVoiceProvider.cpp b/libraries/GSM/src/GSM3MobileVoiceProvider.cpp
deleted file mode 100644
index b74cbfba788..00000000000
--- a/libraries/GSM/src/GSM3MobileVoiceProvider.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
-This file is part of the GSM3 communications library for Arduino
--- Multi-transport communications platform
--- Fully asynchronous
--- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
--- Voice calls
--- SMS
--- TCP/IP connections
--- HTTP basic clients
-
-This library has been developed by Telefónica Digital - PDI -
-- Physical Internet Lab, as part as its collaboration with
-Arduino and the Open Hardware Community.
-
-September-December 2012
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-The latest version of this library can always be found at
-https://github.com/BlueVia/Official-Arduino
-*/
-#include
-
-GSM3MobileVoiceProvider* theGSM3MobileVoiceProvider;
diff --git a/libraries/GSM/src/GSM3MobileVoiceProvider.h b/libraries/GSM/src/GSM3MobileVoiceProvider.h
deleted file mode 100644
index 2091a1ba7ca..00000000000
--- a/libraries/GSM/src/GSM3MobileVoiceProvider.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
-This file is part of the GSM3 communications library for Arduino
--- Multi-transport communications platform
--- Fully asynchronous
--- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
--- Voice calls
--- SMS
--- TCP/IP connections
--- HTTP basic clients
-
-This library has been developed by Telefónica Digital - PDI -
-- Physical Internet Lab, as part as its collaboration with
-Arduino and the Open Hardware Community.
-
-September-December 2012
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-The latest version of this library can always be found at
-https://github.com/BlueVia/Official-Arduino
-*/
-#ifndef _GSM3MOBILEVOICEPROVIDER_
-#define _GSM3MOBILEVOICEPROVIDER_
-
-enum GSM3_voiceCall_st { IDLE_CALL, CALLING, RECEIVINGCALL, TALKING};
-
-class GSM3MobileVoiceProvider
-{
- public:
-
- /** Initialize the object relating it to the general infrastructure
- @param
- @return void
- */
- virtual void initialize(){};
-
- /** Launch a voice call
- @param number Phone number to be called
- @return If asynchronous, returns 0. If synchronous, 1 if success, other if error
- */
- virtual int voiceCall(const char* number)=0;
-
- /** Answer a voice call
- @return If asynchronous, returns 0. If synchronous, 1 if success, other if error
- */
- virtual int answerCall()=0;
-
- /** Hang a voice call
- @return If asynchronous, returns 0. If synchronous, 1 if success, other if error
- */
- virtual int hangCall()=0;
-
- /** Retrieve phone number of caller
- @param buffer Buffer for copy phone number
- @param bufsize Buffer size
- @return If asynchronous, returns 0. If synchronous, 1 if success, other if error
- */
- virtual int retrieveCallingNumber(char* buffer, int bufsize)=0;
-
- /** Returns voice call status
- @return voice call status
- */
- virtual GSM3_voiceCall_st getvoiceCallStatus()=0;
-
- /** Set voice call status
- @param status New status for voice call
- */
- virtual void setvoiceCallStatus(GSM3_voiceCall_st status)=0;
-
- /** Get last command status
- @return Returns 0 if last command is still executing, 1 success, >1 error
- */
- virtual int ready()=0;
-};
-
-extern GSM3MobileVoiceProvider* theGSM3MobileVoiceProvider;
-
-#endif
diff --git a/libraries/GSM/src/GSM3SMSService.cpp b/libraries/GSM/src/GSM3SMSService.cpp
deleted file mode 100644
index 378dc2cc826..00000000000
--- a/libraries/GSM/src/GSM3SMSService.cpp
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
-This file is part of the GSM3 communications library for Arduino
--- Multi-transport communications platform
--- Fully asynchronous
--- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
--- Voice calls
--- SMS
--- TCP/IP connections
--- HTTP basic clients
-
-This library has been developed by Telefónica Digital - PDI -
-- Physical Internet Lab, as part as its collaboration with
-Arduino and the Open Hardware Community.
-
-September-December 2012
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-The latest version of this library can always be found at
-https://github.com/BlueVia/Official-Arduino
-*/
-#include
-#include
-#include
-
-// While there is only a shield (ShieldV1) we will include it by default
-#include
-GSM3ShieldV1SMSProvider theShieldV1SMSProvider;
-
-#define GSM3SMSSERVICE_SYNCH 0x01 // 1: synchronous 0: asynchronous
-#define __TOUT__ 10000
-
-
-GSM3SMSService::GSM3SMSService(bool synch)
-{
- if(synch)
- flags |= GSM3SMSSERVICE_SYNCH;
-}
-
-// Returns 0 if last command is still executing
-// 1 if success
-// >1 if error
-int GSM3SMSService::ready()
-{
- return theGSM3SMSProvider->ready();
-}
-
-int GSM3SMSService::beginSMS(const char *number)
-{
- return waitForAnswerIfNeeded(theGSM3SMSProvider->beginSMS(number));
-};
-
-int GSM3SMSService::endSMS()
-{
- return waitForAnswerIfNeeded(theGSM3SMSProvider->endSMS());
-};
-
-size_t GSM3SMSService::write(uint8_t c)
-{
- theGSM3SMSProvider->writeSMS(c);
- return 1;
-}
-
-void GSM3SMSService::flush()
-{
- theGSM3SMSProvider->flushSMS();
- waitForAnswerIfNeeded(1);
-};
-
-int GSM3SMSService::available()
-{
- return waitForAnswerIfNeeded(theGSM3SMSProvider->availableSMS());
-};
-
-int GSM3SMSService::remoteNumber(char* number, int nlength)
-{
- return theGSM3SMSProvider->remoteSMSNumber(number, nlength);
-
-}
-
-int GSM3SMSService::read()
-{
- return theGSM3SMSProvider->readSMS();
-};
-int GSM3SMSService::peek()
-{
- return theGSM3SMSProvider->peekSMS();
-};
-
-int GSM3SMSService::waitForAnswerIfNeeded(int returnvalue)
-{
- // If synchronous
- if(flags & GSM3SMSSERVICE_SYNCH )
- {
- unsigned long m;
- m=millis();
- // Wait for __TOUT__
- while(((millis()-m)< __TOUT__ )&&(ready()==0))
- delay(100);
- // If everything was OK, return 1
- // else (timeout or error codes) return 0;
- if(ready()==1)
- return 1;
- else
- return 0;
- }
- // If not synchronous just kick ahead the coming result
- return ready();
-}
-
-
-
-
-
diff --git a/libraries/GSM/src/GSM3SMSService.h b/libraries/GSM/src/GSM3SMSService.h
deleted file mode 100644
index 878be114b25..00000000000
--- a/libraries/GSM/src/GSM3SMSService.h
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
-This file is part of the GSM3 communications library for Arduino
--- Multi-transport communications platform
--- Fully asynchronous
--- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
--- Voice calls
--- SMS
--- TCP/IP connections
--- HTTP basic clients
-
-This library has been developed by Telefónica Digital - PDI -
-- Physical Internet Lab, as part as its collaboration with
-Arduino and the Open Hardware Community.
-
-September-December 2012
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-The latest version of this library can always be found at
-https://github.com/BlueVia/Official-Arduino
-*/
-#ifndef _GSM3SMSSERVICE_
-#define _GSM3SMSSERVICE_
-
-#include
-#include
-
-class GSM3SMSService : public Stream
-{
- private:
-
- uint8_t flags;
-
- /** Makes synchronous the functions, if needed
- @param returnvalue Return value
- @return returns 0 if last command is still executing, 1 success, >1 error
- */
- int waitForAnswerIfNeeded(int returnvalue);
-
- public:
-
- /** Constructor
- @param synch Determines sync mode
- */
- GSM3SMSService(bool synch=true);
-
- /** Write a character in SMS message
- @param c Character
- @return size
- */
- size_t write(uint8_t c);
-
- /** Begin a SMS to send it
- @param to Destination
- @return error command if it exists
- */
- int beginSMS(const char* to);
-
- /** Get last command status
- @return returns 0 if last command is still executing, 1 success, >1 error
- */
- int ready();
-
- /** End SMS
- @return error command if it exists
- */
- int endSMS();
-
- /** Check if SMS available and prepare it to be read
- @return number of bytes in a received SMS
- */
- int available();
-
- /** Read sender number phone
- @param number Buffer for save number phone
- @param nlength Buffer length
- @return 1 success, >1 error
- */
- int remoteNumber(char* number, int nlength);
-
- /** Read one char for SMS buffer (advance circular buffer)
- @return byte
- */
- int read();
-
- /** Read a byte but do not advance the buffer header (circular buffer)
- @return byte
- */
- int peek();
-
- /** Delete the SMS from Modem memory and proccess answer
- */
- void flush();
-
-};
-
-
-#endif
\ No newline at end of file
diff --git a/libraries/GSM/src/GSM3ShieldV1.cpp b/libraries/GSM/src/GSM3ShieldV1.cpp
deleted file mode 100644
index d59487406c7..00000000000
--- a/libraries/GSM/src/GSM3ShieldV1.cpp
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
-This file is part of the GSM3 communications library for Arduino
--- Multi-transport communications platform
--- Fully asynchronous
--- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
--- Voice calls
--- SMS
--- TCP/IP connections
--- HTTP basic clients
-
-This library has been developed by Telefónica Digital - PDI -
-- Physical Internet Lab, as part as its collaboration with
-Arduino and the Open Hardware Community.
-
-September-December 2012
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-The latest version of this library can always be found at
-https://github.com/BlueVia/Official-Arduino
-*/
-#include
-#include
-#include
-
-#define __RESETPIN__ 7
-#define __TOUTLOCALCOMS__ 500
-#define __TOUTSHUTDOWN__ 5000
-#define __TOUTMODEMCONFIGURATION__ 5000//equivalent to 30000 because of time in interrupt routine.
-#define __TOUTAT__ 1000
-#define __TOUTSMS__ 7000
-#define __TOUTCALL__ 15000
-#define __TOUTGPRS__ 10000
-#define __NCLIENTS_MAX__ 3
-
-//Constructor.
-GSM3ShieldV1::GSM3ShieldV1(bool db)
-{
- theGSM3ShieldV1ModemCore.setCommandCounter(1);
- socketsAccepted=0;
- theGSM3ShieldV1ModemCore.registerUMProvider(this);
- theProvider=this;
-}
-
-//Response management.
-void GSM3ShieldV1::manageResponse(byte from, byte to)
-{
- switch(theGSM3ShieldV1ModemCore.getOngoingCommand())
- {
- case NONE:
- theGSM3ShieldV1ModemCore.gss.cb.deleteToTheEnd(from);
- break;
-
- }
-}
-
-//Function for 2 sec delay inside an interruption.
-void GSM3ShieldV1::delayInsideInterrupt2seg()
-{
- for (int k=0;k<40;k++) theGSM3ShieldV1ModemCore.gss.tunedDelay(50000);
-}
-
-///////////////////////////////////////////////////////UNSOLICITED RESULT CODE (URC) FUNCTIONS///////////////////////////////////////////////////////////////////
-
-//URC recognize.
-bool GSM3ShieldV1::recognizeUnsolicitedEvent(byte oldTail)
-{
-
-int nlength;
-char auxLocate [15];
- //POWER DOWN.
- prepareAuxLocate(PSTR("POWER DOWN"), auxLocate);
- if(theGSM3ShieldV1ModemCore.gss.cb.locate(auxLocate))
- {
- theGSM3ShieldV1ModemCore.gss.cb.flush();
- return true;
- }
-
-
- return false;
-}
-
-
-
diff --git a/libraries/GSM/src/GSM3ShieldV1.h b/libraries/GSM/src/GSM3ShieldV1.h
deleted file mode 100644
index db52f7b0e0a..00000000000
--- a/libraries/GSM/src/GSM3ShieldV1.h
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
-This file is part of the GSM3 communications library for Arduino
--- Multi-transport communications platform
--- Fully asynchronous
--- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
--- Voice calls
--- SMS
--- TCP/IP connections
--- HTTP basic clients
-
-This library has been developed by Telefónica Digital - PDI -
-- Physical Internet Lab, as part as its collaboration with
-Arduino and the Open Hardware Community.
-
-September-December 2012
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-The latest version of this library can always be found at
-https://github.com/BlueVia/Official-Arduino
-*/
-#ifndef __GSM3_SHIELDV1__
-#define __GSM3_SHIELDV1__
-
-#include
-#include
-#include
-#include
-
-
-class GSM3ShieldV1 : public GSM3MobileNetworkProvider, public GSM3ShieldV1BaseProvider
-{
- // General code, for modem management
- private:
-
- /** Delay inside an interrupt (2 seconds)
- */
- void delayInsideInterrupt2seg();
-
- // Code for SMS Service
- private:
-
-
- long commandMillis;
- bool commandSent;
-
- const char* pinConfig; //PIN.
- char* accessPoint; //APN.
- char* userName; //User.
- char* passw; //Password.
- const char* remoteID; //Server.
-
- char* dataSocket; //Data socket.
- int local_Port; //Local Port.
- char* local_IP; //Local IP.
- int local_IP_Length; //Local IP length.
-
-
- int socketDataSize; //Size of socket data to be read.
- int socketDataSizeWritten; //Number of socket data written in buffer not to overflow the buffer
-
- int socketsAccepted; //Status for remote clients accepted of closed.
-
- public:
-
- /** Constructor **/
- GSM3ShieldV1(bool debug=false);
-
- /** Manages modem response
- @param from Initial byte of buffer
- @param to Final byte of buffer
- */
- void manageResponse(byte from, byte to);
-
- /** Get last command status
- @return returns 0 if last command is still executing, 1 success, >1 error
- */
- int ready(){return GSM3ShieldV1BaseProvider::ready();};
-
- /** Parse modem response
- @param rsp Returns true if expected response exists
- @param string1 Substring expected in response
- @param string2 Second substring expected in response
- @return true if parsed successful
- */
- bool genericParse_rsp2(bool& rsp, char* string1, char* string2);
-
- /** Recognize URC
- @param oldTail
- @return true if successful
- */
- bool recognizeUnsolicitedEvent(byte oldTail);
-
- /** Receive answer
- @return true if successful
- */
- bool answerReceived();
-
- /** Receive socket
- @param id_socket Socket ID
- @return true if successful
- */
- bool socketReceived(int id_socket);
-
- /** Update active ID sockets
- @param active Active sockets
- @param ID Id for update
- */
- void update_activeIDsockets (bool active, int ID);
-
- /** Assign ID to socket
- @param ID Id to assign to socket
- @return true if successful
- */
- bool assignIDsocket (int& ID);
-
- /** Close data socket
- @return true if successful
- */
- bool closedDataSocket(); //Flag closed current data socket.
-
- //bool writeIncomingCalls(char* bufferForCallerId) If isn't zero, doesn't wait calls
-};
-
-#endif
\ No newline at end of file
diff --git a/libraries/GSM/src/GSM3ShieldV1AccessProvider.cpp b/libraries/GSM/src/GSM3ShieldV1AccessProvider.cpp
deleted file mode 100644
index 19f9768bce4..00000000000
--- a/libraries/GSM/src/GSM3ShieldV1AccessProvider.cpp
+++ /dev/null
@@ -1,356 +0,0 @@
-/*
-This file is part of the GSM3 communications library for Arduino
--- Multi-transport communications platform
--- Fully asynchronous
--- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
--- Voice calls
--- SMS
--- TCP/IP connections
--- HTTP basic clients
-
-This library has been developed by Telefónica Digital - PDI -
-- Physical Internet Lab, as part as its collaboration with
-Arduino and the Open Hardware Community.
-
-September-December 2012
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-The latest version of this library can always be found at
-https://github.com/BlueVia/Official-Arduino
-*/
-#include
-#include
-#include "GSM3IO.h"
-
-#define __TOUTSHUTDOWN__ 5000
-#define __TOUTMODEMCONFIGURATION__ 5000//equivalent to 30000 because of time in interrupt routine.
-#define __TOUTAT__ 1000
-
-const char _command_AT[] PROGMEM = "AT";
-const char _command_CGREG[] PROGMEM = "AT+CGREG?";
-
-
-GSM3ShieldV1AccessProvider::GSM3ShieldV1AccessProvider(bool debug)
-{
- theGSM3ShieldV1ModemCore.setDebug(debug);
-
-}
-
-void GSM3ShieldV1AccessProvider::manageResponse(byte from, byte to)
-{
- switch(theGSM3ShieldV1ModemCore.getOngoingCommand())
- {
- case MODEMCONFIG:
- ModemConfigurationContinue();
- break;
- case ALIVETEST:
- isModemAliveContinue();
- break;
- }
-}
-
-///////////////////////////////////////////////////////CONFIGURATION FUNCTIONS///////////////////////////////////////////////////////////////////
-
-// Begin
-// Restart or start the modem
-// May be synchronous
-GSM3_NetworkStatus_t GSM3ShieldV1AccessProvider::begin(char* pin, bool restart, bool synchronous)
-{
- pinMode(__RESETPIN__, OUTPUT);
-
- #ifdef TTOPEN_V1
- pinMode(__POWERPIN__, OUTPUT);
- digitalWrite(__POWERPIN__, HIGH);
- #endif
-
- // If asked for modem restart, restart
- if (restart)
- HWrestart();
- else
- HWstart();
-
- theGSM3ShieldV1ModemCore.gss.begin(9600);
- // Launch modem configuration commands
- ModemConfiguration(pin);
- // If synchronous, wait till ModemConfiguration is over
- if(synchronous)
- {
- // if we shorten this delay, the command fails
- while(ready()==0)
- delay(1000);
- }
- return getStatus();
-}
-
-//HWrestart.
-int GSM3ShieldV1AccessProvider::HWrestart()
-{
- #ifdef TTOPEN_V1
- digitalWrite(__POWERPIN__, HIGH);
- delay(1000);
- #endif
-
- theGSM3ShieldV1ModemCore.setStatus(IDLE);
- digitalWrite(__RESETPIN__, HIGH);
- delay(12000);
- digitalWrite(__RESETPIN__, LOW);
- delay(1000);
- return 1; //configandwait(pin);
-}
-
-//HWrestart.
-int GSM3ShieldV1AccessProvider::HWstart()
-{
-
- theGSM3ShieldV1ModemCore.setStatus(IDLE);
- digitalWrite(__RESETPIN__, HIGH);
- delay(2000);
- digitalWrite(__RESETPIN__, LOW);
- //delay(1000);
-
- return 1; //configandwait(pin);
-}
-
-//Initial configuration main function.
-int GSM3ShieldV1AccessProvider::ModemConfiguration(char* pin)
-{
- theGSM3ShieldV1ModemCore.setPhoneNumber(pin);
- theGSM3ShieldV1ModemCore.openCommand(this,MODEMCONFIG);
- theGSM3ShieldV1ModemCore.setStatus(CONNECTING);
- ModemConfigurationContinue();
- return theGSM3ShieldV1ModemCore.getCommandError();
-}
-
-//Initial configuration continue function.
-void GSM3ShieldV1AccessProvider::ModemConfigurationContinue()
-{
- bool resp;
-
- // 1: Send AT
- // 2: Wait AT OK and SetPin or CGREG
- // 3: Wait Pin OK and CGREG
- // 4: Wait CGREG and Flow SW control or CGREG
- // 5: Wait IFC OK and SMS Text Mode
- // 6: Wait SMS text Mode OK and Calling line identification
- // 7: Wait Calling Line Id OK and Echo off
- // 8: Wait for OK and COLP command for connecting line identification.
- // 9: Wait for OK.
- int ct=theGSM3ShieldV1ModemCore.getCommandCounter();
- if(ct==1)
- {
- // Launch AT
- theGSM3ShieldV1ModemCore.setCommandCounter(2);
- theGSM3ShieldV1ModemCore.genericCommand_rq(_command_AT);
- }
- else if(ct==2)
- {
- // Wait for AT - OK.
- if(theGSM3ShieldV1ModemCore.genericParse_rsp(resp))
- {
- if(resp)
- {
- // OK received
- if(theGSM3ShieldV1ModemCore.getPhoneNumber() && (theGSM3ShieldV1ModemCore.getPhoneNumber()[0]!=0))
- {
- theGSM3ShieldV1ModemCore.genericCommand_rq(PSTR("AT+CPIN="), false);
- theGSM3ShieldV1ModemCore.setCommandCounter(3);
- theGSM3ShieldV1ModemCore.genericCommand_rqc(theGSM3ShieldV1ModemCore.getPhoneNumber());
- }
- else
- {
- //DEBUG
- //Serial.println("AT+CGREG?");
- theGSM3ShieldV1ModemCore.setCommandCounter(4);
- theGSM3ShieldV1ModemCore.takeMilliseconds();
- theGSM3ShieldV1ModemCore.genericCommand_rq(_command_CGREG);
- }
- }
- else theGSM3ShieldV1ModemCore.closeCommand(3);
- }
- }
- else if(ct==3)
- {
- if(theGSM3ShieldV1ModemCore.genericParse_rsp(resp))
- {
- if(resp)
- {
- theGSM3ShieldV1ModemCore.setCommandCounter(4);
- theGSM3ShieldV1ModemCore.takeMilliseconds();
- theGSM3ShieldV1ModemCore.delayInsideInterrupt(2000);
- theGSM3ShieldV1ModemCore.genericCommand_rq(_command_CGREG);
- }
- else theGSM3ShieldV1ModemCore.closeCommand(3);
- }
- }
- else if(ct==4)
- {
- char auxLocate1 [12];
- char auxLocate2 [12];
- prepareAuxLocate(PSTR("+CGREG: 0,1"), auxLocate1);
- prepareAuxLocate(PSTR("+CGREG: 0,5"), auxLocate2);
- if(theGSM3ShieldV1ModemCore.genericParse_rsp(resp, auxLocate1, auxLocate2))
- {
- if(resp)
- {
- theGSM3ShieldV1ModemCore.setCommandCounter(5);
- theGSM3ShieldV1ModemCore.genericCommand_rq(PSTR("AT+IFC=1,1"));
- }
- else
- {
- // If not, launch command again
- if(theGSM3ShieldV1ModemCore.takeMilliseconds() > __TOUTMODEMCONFIGURATION__)
- {
- theGSM3ShieldV1ModemCore.closeCommand(3);
- }
- else
- {
- theGSM3ShieldV1ModemCore.delayInsideInterrupt(2000);
- theGSM3ShieldV1ModemCore.genericCommand_rq(_command_CGREG);
- }
- }
- }
- }
- else if(ct==5)
- {
- // 5: Wait IFC OK
- if(theGSM3ShieldV1ModemCore.genericParse_rsp(resp))
- {
- //Delay for SW flow control being active.
- theGSM3ShieldV1ModemCore.delayInsideInterrupt(2000);
- // 9: SMS Text Mode
- theGSM3ShieldV1ModemCore.setCommandCounter(6);
- theGSM3ShieldV1ModemCore.genericCommand_rq(PSTR("AT+CMGF=1"));
- }
- }
- else if(ct==6)
- {
- // 6: Wait SMS text Mode OK
- if(theGSM3ShieldV1ModemCore.genericParse_rsp(resp))
- {
- //Calling line identification
- theGSM3ShieldV1ModemCore.setCommandCounter(7);
- theGSM3ShieldV1ModemCore.genericCommand_rq(PSTR("AT+CLIP=1"));
- }
- }
- else if(ct==7)
- {
- // 7: Wait Calling Line Id OK
- if(theGSM3ShieldV1ModemCore.genericParse_rsp(resp))
- {
- // Echo off
- theGSM3ShieldV1ModemCore.setCommandCounter(8);
- theGSM3ShieldV1ModemCore.genericCommand_rq(PSTR("ATE0"));
- }
- }
- else if(ct==8)
- {
- // 8: Wait ATEO OK, send COLP
- // In Arduino Mega, attention, take away the COLP step
- // It looks as we can only have 8 steps
- if(theGSM3ShieldV1ModemCore.genericParse_rsp(resp))
- {
- theGSM3ShieldV1ModemCore.setCommandCounter(9);
- theGSM3ShieldV1ModemCore.genericCommand_rq(PSTR("AT+COLP=1"));
- }
- }
- else if(ct==9)
- {
- // 9: Wait ATCOLP OK
- if(theGSM3ShieldV1ModemCore.genericParse_rsp(resp))
- {
- if (resp)
- {
- theGSM3ShieldV1ModemCore.setStatus(GSM_READY);
- theGSM3ShieldV1ModemCore.closeCommand(1);
- }
- else theGSM3ShieldV1ModemCore.closeCommand(3);
- }
- }
-}
-
-//Alive Test main function.
-int GSM3ShieldV1AccessProvider::isAccessAlive()
-{
- theGSM3ShieldV1ModemCore.setCommandError(0);
- theGSM3ShieldV1ModemCore.setCommandCounter(1);
- theGSM3ShieldV1ModemCore.openCommand(this,ALIVETEST);
- isModemAliveContinue();
- return theGSM3ShieldV1ModemCore.getCommandError();
-}
-
-//Alive Test continue function.
-void GSM3ShieldV1AccessProvider::isModemAliveContinue()
-{
-bool rsp;
-switch (theGSM3ShieldV1ModemCore.getCommandCounter()) {
- case 1:
- theGSM3ShieldV1ModemCore.genericCommand_rq(_command_AT);
- theGSM3ShieldV1ModemCore.setCommandCounter(2);
- break;
- case 2:
- if(theGSM3ShieldV1ModemCore.genericParse_rsp(rsp))
- {
- if (rsp) theGSM3ShieldV1ModemCore.closeCommand(1);
- else theGSM3ShieldV1ModemCore.closeCommand(3);
- }
- break;
- }
-}
-
-//Shutdown.
-bool GSM3ShieldV1AccessProvider::shutdown()
-{
- unsigned long m;
- bool resp;
- char auxLocate [18];
-
- // It makes no sense to have an asynchronous shutdown
- pinMode(__RESETPIN__, OUTPUT);
- digitalWrite(__RESETPIN__, HIGH);
- delay(1500);
- digitalWrite(__RESETPIN__, LOW);
- theGSM3ShieldV1ModemCore.setStatus(IDLE);
- theGSM3ShieldV1ModemCore.gss.close();
-
- m=millis();
- prepareAuxLocate(PSTR("POWER DOWN"), auxLocate);
- while((millis()-m) < __TOUTSHUTDOWN__)
- {
- delay(1);
- if(theGSM3ShieldV1ModemCore.genericParse_rsp(resp, auxLocate))
- return resp;
- }
- return false;
-}
-
-//Secure shutdown.
-bool GSM3ShieldV1AccessProvider::secureShutdown()
-{
- // It makes no sense to have an asynchronous shutdown
- pinMode(__RESETPIN__, OUTPUT);
- digitalWrite(__RESETPIN__, HIGH);
- delay(900);
- digitalWrite(__RESETPIN__, LOW);
- theGSM3ShieldV1ModemCore.setStatus(OFF);
- theGSM3ShieldV1ModemCore.gss.close();
-
-#ifdef TTOPEN_V1
- _delay_ms(12000);
- digitalWrite(__POWERPIN__, LOW);
-#endif
-
- return true;
-}
diff --git a/libraries/GSM/src/GSM3ShieldV1AccessProvider.h b/libraries/GSM/src/GSM3ShieldV1AccessProvider.h
deleted file mode 100644
index 638fb5f1767..00000000000
--- a/libraries/GSM/src/GSM3ShieldV1AccessProvider.h
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
-This file is part of the GSM3 communications library for Arduino
--- Multi-transport communications platform
--- Fully asynchronous
--- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
--- Voice calls
--- SMS
--- TCP/IP connections
--- HTTP basic clients
-
-This library has been developed by Telefónica Digital - PDI -
-- Physical Internet Lab, as part as its collaboration with
-Arduino and the Open Hardware Community.
-
-September-December 2012
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-The latest version of this library can always be found at
-https://github.com/BlueVia/Official-Arduino
-*/
-#ifndef _GSM3SHIELDV1ACCESSPROVIDER_
-#define _GSM3SHIELDV1ACCESSPROVIDER_
-
-#include
-#include
-#include
-
-class GSM3ShieldV1AccessProvider : public GSM3MobileAccessProvider, public GSM3ShieldV1BaseProvider
-{
- private:
-
- /** Initialize main modem configuration
- @param pin PIN code
- @return command error if exists
- */
- int ModemConfiguration(char* pin);
-
- /** Continue to modem configuration function
- */
- void ModemConfigurationContinue();
-
- /** Continue to check if modem alive function
- */
- void isModemAliveContinue();
-
-
- public:
-
- /** Constructor
- @param debug Determines debug mode
- */
-
- GSM3ShieldV1AccessProvider(bool debug=false);
-
- /** Start the GSM/GPRS modem, attaching to the GSM network
- @param pin SIM PIN number (4 digits in a string, example: "1234"). If
- NULL the SIM has no configured PIN.
- @param restart Restart the modem. Default is TRUE. The modem receives
- a signal through the Ctrl/D7 pin. If it is shut down, it will
- start-up. If it is running, it will restart. Takes up to 10
- seconds
- @param synchronous If TRUE the call only returns after the Start is complete
- or fails. If FALSE the call will return inmediately. You have
- to call repeatedly ready() until you get a result. Default is TRUE.
- @return If synchronous, GSM3_NetworkStatus_t. If asynchronous, returns 0.
- */
- GSM3_NetworkStatus_t begin(char* pin=0,bool restart=true, bool synchronous=true);
-
- /** Check network access status
- @return 1 if Alive, 0 if down
- */
- int isAccessAlive();
-
- /** Shutdown the modem (power off really)
- @return true if successful
- */
- bool shutdown();
-
- /** Secure shutdown the modem (power off really)
- @return true if successful
- */
- bool secureShutdown();
-
- /** Returns 0 if last command is still executing
- @return 1 if success, >1 if error
- */
- int ready(){return GSM3ShieldV1BaseProvider::ready();};
-
- /** Returns modem status
- @return modem network status
- */
- inline GSM3_NetworkStatus_t getStatus(){return theGSM3ShieldV1ModemCore.getStatus();};
-
- void manageResponse(byte from, byte to);
-
- /** Restart the modem (will shut down if running)
- @return 1 if success, >1 if error
- */
- int HWrestart();
-
- /** Start the modem (will not shut down if running)
- @return 1 if success, >1 if error
- */
- int HWstart();
-
-};
-
-#endif
\ No newline at end of file
diff --git a/libraries/GSM/src/GSM3ShieldV1BandManagement.cpp b/libraries/GSM/src/GSM3ShieldV1BandManagement.cpp
deleted file mode 100644
index 48132dfb103..00000000000
--- a/libraries/GSM/src/GSM3ShieldV1BandManagement.cpp
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
-This file is part of the GSM3 communications library for Arduino
--- Multi-transport communications platform
--- Fully asynchronous
--- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
--- Voice calls
--- SMS
--- TCP/IP connections
--- HTTP basic clients
-
-This library has been developed by Telefónica Digital - PDI -
-- Physical Internet Lab, as part as its collaboration with
-Arduino and the Open Hardware Community.
-
-September-December 2012
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-The latest version of this library can always be found at
-https://github.com/BlueVia/Official-Arduino
-*/
-#include
-
-GSM3ShieldV1BandManagement::GSM3ShieldV1BandManagement(bool trace): modem(trace)
-{
- quectelStrings[UNDEFINED]="";
- quectelStrings[EGSM_MODE]="\"EGSM_MODE\"";
- quectelStrings[DCS_MODE]="\"DCS_MODE\"";
- quectelStrings[PCS_MODE]="\"PCS_MODE\"";
- quectelStrings[EGSM_DCS_MODE]="\"EGSM_DCS_MODE\"";
- quectelStrings[GSM850_PCS_MODE]="\"GSM850_PCS_MODE\"";
- quectelStrings[GSM850_EGSM_DCS_PCS_MODE]="\"GSM850_EGSM_DCS_PCS_MODE\"";
-}
-
-GSM3_NetworkStatus_t GSM3ShieldV1BandManagement::begin()
-{
- // check modem response
- modem.begin();
-
- // reset hardware
- modem.restartModem();
-
- return IDLE;
-}
-
-String GSM3ShieldV1BandManagement::getBand()
-{
- String modemResponse=modem.writeModemCommand("AT+QBAND?", 2000);
-
- for(GSM3GSMBand i=GSM850_EGSM_DCS_PCS_MODE;i>UNDEFINED;i=(GSM3GSMBand)((int)i-1))
- {
- if(modemResponse.indexOf(quectelStrings[i])>=0)
- return quectelStrings[i];
- }
-
- Serial.print("Unrecognized modem answer:");
- Serial.println(modemResponse);
-
- return "";
-}
-
-bool GSM3ShieldV1BandManagement::setBand(String band)
-{
- String command;
- String modemResponse;
- bool found=false;
-
- command="AT+QBAND=";
- for(GSM3GSMBand i=EGSM_MODE;((i<=GSM850_EGSM_DCS_PCS_MODE)&&(!found));i=(GSM3GSMBand)((int)i+1))
- {
- String aux=quectelStrings[i];
- if(aux.indexOf(band)>=0)
- {
- command+=aux;
- found=true;
- }
- }
-
- if(!found)
- return false;
- // Quad-band takes an awful lot of time
- modemResponse=modem.writeModemCommand(command, 15000);
-
- if(modemResponse.indexOf("QBAND")>=0)
- return true;
- else
- return false;
-}
diff --git a/libraries/GSM/src/GSM3ShieldV1BandManagement.h b/libraries/GSM/src/GSM3ShieldV1BandManagement.h
deleted file mode 100644
index 919d4ad2398..00000000000
--- a/libraries/GSM/src/GSM3ShieldV1BandManagement.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
-This file is part of the GSM3 communications library for Arduino
--- Multi-transport communications platform
--- Fully asynchronous
--- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
--- Voice calls
--- SMS
--- TCP/IP connections
--- HTTP basic clients
-
-This library has been developed by Telefónica Digital - PDI -
-- Physical Internet Lab, as part as its collaboration with
-Arduino and the Open Hardware Community.
-
-September-December 2012
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-The latest version of this library can always be found at
-https://github.com/BlueVia/Official-Arduino
-*/
-#ifndef __GSM3SHIELDV1BANDMANAGEMENT__
-#define __GSM3SHIELDV1BANDMANAGEMENT__
-
-// This class executes band management functions for the ShieldV1
-#include
-
-#define NUMBEROFBANDS 7
-#define GSM_MODE_UNDEFINED "UNDEFINED"
-#define GSM_MODE_EGSM "EGSM_MODE"
-#define GSM_MODE_DCS "DCS_MODE"
-#define GSM_MODE_PCS "PCS_MODE"
-#define GSM_MODE_EGSM_DCS "EGSM_DCS_MODE"
-#define GSM_MODE_GSM850_PCS "GSM850_PCS_MODE"
-#define GSM_MODE_GSM850_EGSM_DCS_PCS "GSM850_EGSM_DCS_PCS_MODE"
-
-typedef enum GSM3GSMBand {UNDEFINED, EGSM_MODE, DCS_MODE, PCS_MODE, EGSM_DCS_MODE, GSM850_PCS_MODE, GSM850_EGSM_DCS_PCS_MODE};
-
-//
-// These are the bands and scopes:
-//
-// E-GSM(900)
-// DCS(1800)
-// PCS(1900)
-// E-GSM(900)+DCS(1800) ex: Europe
-// GSM(850)+PCS(1900) Ex: USA, South Am.
-// GSM(850)+E-GSM(900)+DCS(1800)+PCS(1900)
-
-class GSM3ShieldV1BandManagement
-{
- private:
-
- GSM3ShieldV1DirectModemProvider modem; // Direct access to modem
-
- char* quectelStrings[NUMBEROFBANDS];// = {"\"EGSM_MODE\"", "\"DCS_MODE\"", "\"PCS_MODE\"",
- //"\"EGSM_DCS_MODE\"", "\"GSM850_PCS_MODE\"",
- //"\"GSM850_EGSM_DCS_PCS_MODE\""};
-
-
- public:
-
- /** Constructor
- @param trace If true, dumps all AT dialogue to Serial
- */
- GSM3ShieldV1BandManagement(bool trace=false);
-
- /** Forces modem hardware restart, so we begin from scratch
- @return always returns IDLE status
- */
- GSM3_NetworkStatus_t begin();
-
- /** Get current modem work band
- @return current modem work band
- */
- String getBand();
-
- /** Changes the modem operating band
- @param band Desired new band
- @return true if success, false otherwise
- */
- bool setBand(String band);
-
-};
-#endif
\ No newline at end of file
diff --git a/libraries/GSM/src/GSM3ShieldV1BaseProvider.cpp b/libraries/GSM/src/GSM3ShieldV1BaseProvider.cpp
deleted file mode 100644
index 435a077c5df..00000000000
--- a/libraries/GSM/src/GSM3ShieldV1BaseProvider.cpp
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
-This file is part of the GSM3 communications library for Arduino
--- Multi-transport communications platform
--- Fully asynchronous
--- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
--- Voice calls
--- SMS
--- TCP/IP connections
--- HTTP basic clients
-
-This library has been developed by Telefónica Digital - PDI -
-- Physical Internet Lab, as part as its collaboration with
-Arduino and the Open Hardware Community.
-
-September-December 2012
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-The latest version of this library can always be found at
-https://github.com/BlueVia/Official-Arduino
-*/
-#include
-#include
-#include
-
-// Returns 0 if last command is still executing
-// 1 if success
-// >1 if error
-int GSM3ShieldV1BaseProvider::ready()
-{
- theGSM3ShieldV1ModemCore.manageReceivedData();
-
- return theGSM3ShieldV1ModemCore.getCommandError();
-};
-
-void GSM3ShieldV1BaseProvider::prepareAuxLocate(PGM_P str, char auxLocate[])
-{
- int i=0;
- char c;
-
- do
- {
- c=pgm_read_byte_near(str + i);
- auxLocate[i]=c;
- i++;
- } while (c!=0);
-}
-
diff --git a/libraries/GSM/src/GSM3ShieldV1BaseProvider.h b/libraries/GSM/src/GSM3ShieldV1BaseProvider.h
deleted file mode 100644
index 8f03947cd18..00000000000
--- a/libraries/GSM/src/GSM3ShieldV1BaseProvider.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
-This file is part of the GSM3 communications library for Arduino
--- Multi-transport communications platform
--- Fully asynchronous
--- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
--- Voice calls
--- SMS
--- TCP/IP connections
--- HTTP basic clients
-
-This library has been developed by Telefónica Digital - PDI -
-- Physical Internet Lab, as part as its collaboration with
-Arduino and the Open Hardware Community.
-
-September-December 2012
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-The latest version of this library can always be found at
-https://github.com/BlueVia/Official-Arduino
-*/
-#ifndef _GSM3SHIELDV1BASEPROVIDER_
-#define _GSM3SHIELDV1BASEPROVIDER_
-
-#include
-
-enum GSM3_commandType_e { XON, NONE, MODEMCONFIG, ALIVETEST, BEGINSMS, ENDSMS, AVAILABLESMS, FLUSHSMS,
- VOICECALL, ANSWERCALL, HANGCALL, RETRIEVECALLINGNUMBER,
- ATTACHGPRS, DETACHGPRS, CONNECTTCPCLIENT, DISCONNECTTCP, BEGINWRITESOCKET, ENDWRITESOCKET,
- AVAILABLESOCKET, FLUSHSOCKET, CONNECTSERVER, GETIP, GETCONNECTSTATUS, GETLOCATION, GETICCID};
-
-class GSM3ShieldV1BaseProvider
-{
- public:
-
- /** Get last command status
- @return Returns 0 if last command is still executing, 1 success, >1 error
- */
- int ready();
-
- /** This function locates strings from PROGMEM in the buffer
- @param str PROGMEN
- @param auxLocate Buffer where to locate strings
- */
- void prepareAuxLocate(PGM_P str, char auxLocate[]);
-
- /** Manages modem response
- @param from Initial byte of buffer
- @param to Final byte of buffer
- */
- virtual void manageResponse(byte from, byte to);
-
- /** Recognize URC
- @param from
- @return true if successful (default: false)
- */
- virtual bool recognizeUnsolicitedEvent(byte from){return false;};
-
-};
-
-#endif
diff --git a/libraries/GSM/src/GSM3ShieldV1CellManagement.cpp b/libraries/GSM/src/GSM3ShieldV1CellManagement.cpp
deleted file mode 100644
index 4c69224040b..00000000000
--- a/libraries/GSM/src/GSM3ShieldV1CellManagement.cpp
+++ /dev/null
@@ -1,201 +0,0 @@
-/*
-This file is part of the GSM3 communications library for Arduino
--- Multi-transport communications platform
--- Fully asynchronous
--- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
--- Voice calls
--- SMS
--- TCP/IP connections
--- HTTP basic clients
-
-This library has been developed by Telefónica Digital - PDI -
-- Physical Internet Lab, as part as its collaboration with
-Arduino and the Open Hardware Community.
-
-September-December 2012
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-The latest version of this library can always be found at
-https://github.com/BlueVia/Official-Arduino
-*/
-#include
-
-GSM3ShieldV1CellManagement::GSM3ShieldV1CellManagement()
-{
-}
-
-bool GSM3ShieldV1CellManagement::parseQCCID_available(bool& rsp)
-{
- char c;
- bool iccidFound = false;
- int i = 0;
-
- while(((c = theGSM3ShieldV1ModemCore.theBuffer().read()) != 0) & (i < 19))
- {
- if((c < 58) & (c > 47))
- iccidFound = true;
-
- if(iccidFound)
- {
- bufferICCID[i] = c;
- i++;
- }
- }
- bufferICCID[i]=0;
-
- return true;
-}
-
-bool GSM3ShieldV1CellManagement::parseQENG_available(bool& rsp)
-{
- char c;
- char location[50] = "";
- int i = 0;
-
- if (!(theGSM3ShieldV1ModemCore.theBuffer().chopUntil("+QENG: ", true)))
- rsp = false;
- else
- rsp = true;
-
- if (!(theGSM3ShieldV1ModemCore.theBuffer().chopUntil("+QENG:", true)))
- rsp = false;
- else
- rsp = true;
-
- while(((c = theGSM3ShieldV1ModemCore.theBuffer().read()) != 0) & (i < 50))
- {
- location[i] = c;
- i++;
- }
- location[i]=0;
-
- char* res_tok = strtok(location, ",");
- res_tok=strtok(NULL, ",");
- strcpy(countryCode, res_tok);
- res_tok=strtok(NULL, ",");
- strcpy(networkCode, res_tok);
- res_tok=strtok(NULL, ",");
- strcpy(locationArea, res_tok);
- res_tok=strtok(NULL, ",");
- strcpy(cellId, res_tok);
-
- return true;
-}
-
-int GSM3ShieldV1CellManagement::getLocation(char *country, char *network, char *area, char *cell)
-{
- if((theGSM3ShieldV1ModemCore.getStatus() != GSM_READY) && (theGSM3ShieldV1ModemCore.getStatus() != GPRS_READY))
- return 2;
-
- countryCode=country;
- networkCode=network;
- locationArea=area;
- cellId=cell;
-
- theGSM3ShieldV1ModemCore.openCommand(this,GETLOCATION);
- getLocationContinue();
-
- unsigned long timeOut = millis();
- while(((millis() - timeOut) < 5000) & (ready() == 0));
-
- return theGSM3ShieldV1ModemCore.getCommandError();
-}
-
-void GSM3ShieldV1CellManagement::getLocationContinue()
-{
- bool resp;
-
- switch (theGSM3ShieldV1ModemCore.getCommandCounter()) {
- case 1:
- theGSM3ShieldV1ModemCore.gss.tunedDelay(3000);
- delay(3000);
- theGSM3ShieldV1ModemCore.setCommandCounter(2);
- theGSM3ShieldV1ModemCore.genericCommand_rq(PSTR("AT+QENG=1"), false);
- theGSM3ShieldV1ModemCore.print("\r");
- break;
- case 2:
- if (theGSM3ShieldV1ModemCore.genericParse_rsp(resp))
- {
- theGSM3ShieldV1ModemCore.gss.tunedDelay(3000);
- delay(3000);
- theGSM3ShieldV1ModemCore.setCommandCounter(3);
- theGSM3ShieldV1ModemCore.genericCommand_rq(PSTR("AT+QENG?"), false);
- theGSM3ShieldV1ModemCore.print("\r");
- }
- else theGSM3ShieldV1ModemCore.closeCommand(1);
- break;
- case 3:
- if (resp)
- {
- parseQENG_available(resp);
- theGSM3ShieldV1ModemCore.closeCommand(3);
- }
- else theGSM3ShieldV1ModemCore.closeCommand(2);
- break;
- }
-}
-
-int GSM3ShieldV1CellManagement::getICCID(char *iccid)
-{
- if((theGSM3ShieldV1ModemCore.getStatus() != GSM_READY) && (theGSM3ShieldV1ModemCore.getStatus() != GPRS_READY))
- return 2;
-
- bufferICCID=iccid;
- theGSM3ShieldV1ModemCore.openCommand(this,GETICCID);
- getICCIDContinue();
-
- unsigned long timeOut = millis();
- while(((millis() - timeOut) < 5000) & (ready() == 0));
-
- return theGSM3ShieldV1ModemCore.getCommandError();
-}
-
-void GSM3ShieldV1CellManagement::getICCIDContinue()
-{
- bool resp;
-
- switch (theGSM3ShieldV1ModemCore.getCommandCounter()) {
- case 1:
- theGSM3ShieldV1ModemCore.setCommandCounter(2);
- theGSM3ShieldV1ModemCore.genericCommand_rq(PSTR("AT+QCCID"), false);
- theGSM3ShieldV1ModemCore.print("\r");
- break;
- case 2:
- if (theGSM3ShieldV1ModemCore.genericParse_rsp(resp))
- {
- parseQCCID_available(resp);
- theGSM3ShieldV1ModemCore.closeCommand(2);
- }
- else theGSM3ShieldV1ModemCore.closeCommand(1);
- break;
- }
-}
-
-void GSM3ShieldV1CellManagement::manageResponse(byte from, byte to)
-{
- switch(theGSM3ShieldV1ModemCore.getOngoingCommand())
- {
- case NONE:
- theGSM3ShieldV1ModemCore.gss.cb.deleteToTheEnd(from);
- break;
- case GETLOCATION:
- getLocationContinue();
- break;
- case GETICCID:
- getICCIDContinue();
- break;
- }
-}
diff --git a/libraries/GSM/src/GSM3ShieldV1CellManagement.h b/libraries/GSM/src/GSM3ShieldV1CellManagement.h
deleted file mode 100644
index 78307da3b08..00000000000
--- a/libraries/GSM/src/GSM3ShieldV1CellManagement.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
-This file is part of the GSM3 communications library for Arduino
--- Multi-transport communications platform
--- Fully asynchronous
--- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
--- Voice calls
--- SMS
--- TCP/IP connections
--- HTTP basic clients
-
-This library has been developed by Telefónica Digital - PDI -
-- Physical Internet Lab, as part as its collaboration with
-Arduino and the Open Hardware Community.
-
-September-December 2012
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-The latest version of this library can always be found at
-https://github.com/BlueVia/Official-Arduino
-*/
-#ifndef __GSM3_SHIELDV1CELLMANAGEMENT__
-#define __GSM3_SHIELDV1CELLMANAGEMENT__
-
-#include
-#include
-#include
-
-class GSM3ShieldV1CellManagement : public GSM3MobileCellManagement, public GSM3ShieldV1BaseProvider
-{
- public:
-
- /** Constructor
- */
- GSM3ShieldV1CellManagement();
-
- /** Manages modem response
- @param from Initial byte of buffer
- @param to Final byte of buffer
- */
- void manageResponse(byte from, byte to);
-
- /** getLocation
- @return current cell location
- */
- int getLocation(char *country, char *network, char *area, char *cell);
-
- /** getICCID
- */
- int getICCID(char *iccid);
-
- /** Get last command status
- @return returns 0 if last command is still executing, 1 success, >1 error
- */
- int ready(){return GSM3ShieldV1BaseProvider::ready();};
-
- private:
-
- char *countryCode;
- char *networkCode;
- char *locationArea;
- char *cellId;
-
- char *bufferICCID;
-
- /** Continue to getLocation function
- */
- void getLocationContinue();
-
- /** Continue to getICCID function
- */
- void getICCIDContinue();
-
- bool parseQENG_available(bool& rsp);
-
- bool parseQCCID_available(bool& rsp);
-
-};
-
-#endif
\ No newline at end of file
diff --git a/libraries/GSM/src/GSM3ShieldV1ClientProvider.cpp b/libraries/GSM/src/GSM3ShieldV1ClientProvider.cpp
deleted file mode 100644
index 6540ef1b2f6..00000000000
--- a/libraries/GSM/src/GSM3ShieldV1ClientProvider.cpp
+++ /dev/null
@@ -1,327 +0,0 @@
-/*
-This file is part of the GSM3 communications library for Arduino
--- Multi-transport communications platform
--- Fully asynchronous
--- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
--- Voice calls
--- SMS
--- TCP/IP connections
--- HTTP basic clients
-
-This library has been developed by Telefónica Digital - PDI -
-- Physical Internet Lab, as part as its collaboration with
-Arduino and the Open Hardware Community.
-
-September-December 2012
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-The latest version of this library can always be found at
-https://github.com/BlueVia/Official-Arduino
-*/
-#include
-#include
-
-GSM3ShieldV1ClientProvider::GSM3ShieldV1ClientProvider()
-{
- theGSM3MobileClientProvider=this;
-};
-
-//Response management.
-void GSM3ShieldV1ClientProvider::manageResponse(byte from, byte to)
-{
- switch(theGSM3ShieldV1ModemCore.getOngoingCommand())
- {
- case NONE:
- theGSM3ShieldV1ModemCore.gss.cb.deleteToTheEnd(from);
- break;
- case CONNECTTCPCLIENT:
- connectTCPClientContinue();
- break;
- case FLUSHSOCKET:
- flushSocketContinue();
- break;
- }
-}
-
-//Connect TCP main function.
-int GSM3ShieldV1ClientProvider::connectTCPClient(const char* server, int port, int id_socket)
-{
- theGSM3ShieldV1ModemCore.setPort(port);
- idSocket = id_socket;
-
- theGSM3ShieldV1ModemCore.setPhoneNumber((char*)server);
- theGSM3ShieldV1ModemCore.openCommand(this,CONNECTTCPCLIENT);
- theGSM3ShieldV1ModemCore.registerUMProvider(this);
- connectTCPClientContinue();
- return theGSM3ShieldV1ModemCore.getCommandError();
-}
-
-int GSM3ShieldV1ClientProvider::connectTCPClient(IPAddress add, int port, int id_socket)
-{
- remoteIP=add;
- theGSM3ShieldV1ModemCore.setPhoneNumber(0);
- return connectTCPClient(0, port, id_socket);
-}
-
-//Connect TCP continue function.
-void GSM3ShieldV1ClientProvider::connectTCPClientContinue()
-{
- bool resp;
- // 0: Dot or DNS notation activation
- // 1: Disable SW flow control
- // 2: Waiting for IFC OK
- // 3: Start-up TCP connection "AT+QIOPEN"
- // 4: Wait for connection OK
- // 5: Wait for CONNECT
-
- switch (theGSM3ShieldV1ModemCore.getCommandCounter()) {
- case 1:
- theGSM3ShieldV1ModemCore.genericCommand_rq(PSTR("AT+QIDNSIP="), false);
- if ((theGSM3ShieldV1ModemCore.getPhoneNumber()!=0)&&
- ((*(theGSM3ShieldV1ModemCore.getPhoneNumber())<'0')||((*(theGSM3ShieldV1ModemCore.getPhoneNumber())>'9'))))
- {
- theGSM3ShieldV1ModemCore.print('1');
- theGSM3ShieldV1ModemCore.print('\r');
- }
- else
- {
- theGSM3ShieldV1ModemCore.print('0');
- theGSM3ShieldV1ModemCore.print('\r');
- }
- theGSM3ShieldV1ModemCore.setCommandCounter(2);
- break;
- case 2:
- if(theGSM3ShieldV1ModemCore.genericParse_rsp(resp))
- {
- //Response received
- if(resp)
- {
- // AT+QIOPEN
- theGSM3ShieldV1ModemCore.genericCommand_rq(PSTR("AT+QIOPEN="),false);
- theGSM3ShieldV1ModemCore.print("\"TCP\",\"");
- if(theGSM3ShieldV1ModemCore.getPhoneNumber()!=0)
- {
- theGSM3ShieldV1ModemCore.print(theGSM3ShieldV1ModemCore.getPhoneNumber());
- }
- else
- {
- remoteIP.printTo(theGSM3ShieldV1ModemCore);
- }
- theGSM3ShieldV1ModemCore.print('"');
- theGSM3ShieldV1ModemCore.print(',');
- theGSM3ShieldV1ModemCore.print(theGSM3ShieldV1ModemCore.getPort());
- theGSM3ShieldV1ModemCore.print('\r');
- theGSM3ShieldV1ModemCore.setCommandCounter(3);
- }
- else theGSM3ShieldV1ModemCore.closeCommand(3);
- }
- break;
-
- case 3:
- if(theGSM3ShieldV1ModemCore.genericParse_rsp(resp))
- {
- // Response received
- if(resp)
- {
- // OK Received
- // Great. Go for the next step
- theGSM3ShieldV1ModemCore.setCommandCounter(4);
- }
- else theGSM3ShieldV1ModemCore.closeCommand(3);
- }
- break;
- case 4:
- char auxLocate [12];
- prepareAuxLocate(PSTR("CONNECT\r\n"), auxLocate);
- if(theGSM3ShieldV1ModemCore.genericParse_rsp(resp,auxLocate))
- {
- // Response received
- if(resp)
- {
- // Received CONNECT OK
- // Great. We're done
- theGSM3ShieldV1ModemCore.setStatus(TRANSPARENT_CONNECTED);
- theGSM3ShieldV1ModemCore.theBuffer().chopUntil(auxLocate, true);
- theGSM3ShieldV1ModemCore.closeCommand(1);
- }
- else
- theGSM3ShieldV1ModemCore.closeCommand(3);
- }
- break;
-
- }
-}
-
-//Disconnect TCP main function.
-int GSM3ShieldV1ClientProvider::disconnectTCP(bool client1Server0, int id_socket)
-{
- // id Socket does not really mean anything, in this case we have
- // only one socket running
- theGSM3ShieldV1ModemCore.openCommand(this,DISCONNECTTCP);
-
- // If we are not closed, launch the command
-//[ZZ] if(theGSM3ShieldV1ModemCore.getStatus()==TRANSPARENT_CONNECTED)
-// {
- delay(1000);
- theGSM3ShieldV1ModemCore.print("+++");
- delay(1000);
- theGSM3ShieldV1ModemCore.genericCommand_rq(PSTR("AT+QICLOSE"));
- theGSM3ShieldV1ModemCore.setStatus(GPRS_READY);
-// }
- // Looks like it runs everytime, so we simply flush to death and go on
- do
- {
- // Empty the local buffer, and tell the modem to XON
- // If meanwhile we receive a DISCONNECT we should detect it as URC.
- theGSM3ShieldV1ModemCore.theBuffer().flush();
- theGSM3ShieldV1ModemCore.gss.spaceAvailable();
- // Give some time for the buffer to refill
- delay(100);
- theGSM3ShieldV1ModemCore.closeCommand(1);
- }while(theGSM3ShieldV1ModemCore.theBuffer().storedBytes()>0);
-
- theGSM3ShieldV1ModemCore.unRegisterUMProvider(this);
- return theGSM3ShieldV1ModemCore.getCommandError();
-}
-
-
-//Write socket first chain main function.
-void GSM3ShieldV1ClientProvider::beginWriteSocket(bool client1Server0, int id_socket)
-{
-}
-
-
-//Write socket next chain function.
-void GSM3ShieldV1ClientProvider::writeSocket(const char* buf)
-{
- if(theGSM3ShieldV1ModemCore.getStatus()==TRANSPARENT_CONNECTED)
- theGSM3ShieldV1ModemCore.print(buf);
-}
-
-//Write socket character function.
-void GSM3ShieldV1ClientProvider::writeSocket(uint8_t c)
-{
- if(theGSM3ShieldV1ModemCore.getStatus()==TRANSPARENT_CONNECTED)
- theGSM3ShieldV1ModemCore.print((char)c);
-}
-
-//Write socket last chain main function.
-void GSM3ShieldV1ClientProvider::endWriteSocket()
-{
-}
-
-
-//Available socket main function.
-int GSM3ShieldV1ClientProvider::availableSocket(bool client1Server0, int id_socket)
-{
-
- if(!(theGSM3ShieldV1ModemCore.getStatus()==TRANSPARENT_CONNECTED))
- theGSM3ShieldV1ModemCore.closeCommand(4);
-
- if(theGSM3ShieldV1ModemCore.theBuffer().storedBytes())
- theGSM3ShieldV1ModemCore.closeCommand(1);
- else
- theGSM3ShieldV1ModemCore.closeCommand(4);
-
- return theGSM3ShieldV1ModemCore.getCommandError();
-}
-
-int GSM3ShieldV1ClientProvider::readSocket()
-{
- char charSocket;
-
- if(theGSM3ShieldV1ModemCore.theBuffer().availableBytes()==0)
- {
- return 0;
- }
-
- charSocket = theGSM3ShieldV1ModemCore.theBuffer().read();
-
- if(theGSM3ShieldV1ModemCore.theBuffer().availableBytes()==100)
- theGSM3ShieldV1ModemCore.gss.spaceAvailable();
-
- return charSocket;
-
-}
-
-//Read socket main function.
-int GSM3ShieldV1ClientProvider::peekSocket()
-{
- return theGSM3ShieldV1ModemCore.theBuffer().peek(0);
-}
-
-
-//Flush SMS main function.
-void GSM3ShieldV1ClientProvider::flushSocket()
-{
- theGSM3ShieldV1ModemCore.openCommand(this,FLUSHSOCKET);
-
- flushSocketContinue();
-}
-
-//Send SMS continue function.
-void GSM3ShieldV1ClientProvider::flushSocketContinue()
-{
- // If we have incomed data
- if(theGSM3ShieldV1ModemCore.theBuffer().storedBytes()>0)
- {
- // Empty the local buffer, and tell the modem to XON
- // If meanwhile we receive a DISCONNECT we should detect it as URC.
- theGSM3ShieldV1ModemCore.theBuffer().flush();
- theGSM3ShieldV1ModemCore.gss.spaceAvailable();
- }
- else
- {
- //We're done
- theGSM3ShieldV1ModemCore.closeCommand(1);
- }
-}
-
-// URC recognize.
-// Yes, we recognize "closes" in client mode
-bool GSM3ShieldV1ClientProvider::recognizeUnsolicitedEvent(byte oldTail)
-{
- char auxLocate [12];
- prepareAuxLocate(PSTR("CLOSED"), auxLocate);
-
- if((theGSM3ShieldV1ModemCore.getStatus()==TRANSPARENT_CONNECTED) & theGSM3ShieldV1ModemCore.theBuffer().chopUntil(auxLocate, false, false))
- {
- theGSM3ShieldV1ModemCore.setStatus(GPRS_READY);
- theGSM3ShieldV1ModemCore.unRegisterUMProvider(this);
- return true;
- }
-
- return false;
-}
-
-int GSM3ShieldV1ClientProvider::getSocket(int socket)
-{
- return 0;
-}
-
-void GSM3ShieldV1ClientProvider::releaseSocket(int socket)
-{
-
-}
-
-bool GSM3ShieldV1ClientProvider::getStatusSocketClient(uint8_t socket)
-{
- return (theGSM3ShieldV1ModemCore.getStatus()==TRANSPARENT_CONNECTED);
-
-};
-
-
-
diff --git a/libraries/GSM/src/GSM3ShieldV1ClientProvider.h b/libraries/GSM/src/GSM3ShieldV1ClientProvider.h
deleted file mode 100644
index fa2f8b58a8f..00000000000
--- a/libraries/GSM/src/GSM3ShieldV1ClientProvider.h
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
-This file is part of the GSM3 communications library for Arduino
--- Multi-transport communications platform
--- Fully asynchronous
--- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
--- Voice calls
--- SMS
--- TCP/IP connections
--- HTTP basic clients
-
-This library has been developed by Telefónica Digital - PDI -
-- Physical Internet Lab, as part as its collaboration with
-Arduino and the Open Hardware Community.
-
-September-December 2012
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-The latest version of this library can always be found at
-https://github.com/BlueVia/Official-Arduino
-*/
-#ifndef __GSM3_SHIELDV1CLIENTPROVIDER__
-#define __GSM3_SHIELDV1CLIENTPROVIDER__
-
-#include
-#include
-
-class GSM3ShieldV1ClientProvider : public GSM3MobileClientProvider, public GSM3ShieldV1BaseProvider
-{
- private:
-
- int remotePort; //Current operation remote port.
- IPAddress remoteIP; // Remote IP address
- int idSocket; // Remote ID socket.
-
-
- /** Continue to connect TCP client function
- */
- void connectTCPClientContinue();
-
- /** Continue to available socket function
- */
- void availableSocketContinue();
-
- /** Continue to flush socket function
- */
- void flushSocketContinue();
-
- public:
-
- /** Constructor */
- GSM3ShieldV1ClientProvider();
-
- /** minSocket
- @return 0
- */
- int minSocket(){return 0;};
-
- /** maxSocket
- @return 0
- */
- int maxSocket(){return 0;};
-
- /** Connect to a remote TCP server
- @param server String with IP or server name
- @param port Remote port number
- @param id_socket Local socket number
- @return 0 if command running, 1 if success, otherwise error
- */
- int connectTCPClient(const char* server, int port, int id_socket);
-
- /** Connect to a remote TCP server
- @param add Remote IP address
- @param port Remote port number
- @param id_socket Local socket number
- @return 0 if command running, 1 if success, otherwise error
- */
- int connectTCPClient(IPAddress add, int port, int id_socket);
-
- /** Begin writing through a socket
- @param client1Server0 1 if modem acts as client, 0 if acts as server
- @param id_socket Local socket number
- @return 0 if command running, 1 if success, otherwise error
- */
- void beginWriteSocket(bool client1Server0, int id_socket);
-
- /** Write through a socket. MUST go after beginWriteSocket()
- @param buf characters to be written (final 0 will not be written)
- */
- void writeSocket(const char* buf);
-
- /** Write through a socket. MUST go after beginWriteSocket()
- @param c character to be written
- */
- void writeSocket(uint8_t c);
-
- /** Finish current writing
- */
- void endWriteSocket();
-
- /** Check if there are data to be read in socket.
- @param client1Server0 1 if modem acts as client, 0 if acts as server
- @param id_socket Local socket number
- @return 0 if command running, 1 if there are data available, 4 if no data, otherwise error
- */
- int availableSocket(bool client, int id_socket); // With "available" and "readSocket" ask the modem for 1500 bytes.
-
- /** Read data (get a character) available in socket
- @return character
- */
- int readSocket(); //If Read() gets to the end of the QIRD response, execute again QIRD SYNCHRONOUSLY
-
- /** Flush socket
- */
- void flushSocket();
-
- /** Get a character but will not advance the buffer head
- @return character
- */
- int peekSocket();
-
- /** Close a socket
- @param client1Server0 1 if modem acts as client, 0 if acts as server
- @param id_socket Socket
- @return 0 if command running, 1 if success, otherwise error
- */
- int disconnectTCP(bool client1Server0, int id_socket);
-
- /** Recognize unsolicited event
- @param oldTail
- @return true if successful
- */
- bool recognizeUnsolicitedEvent(byte from);
-
- /** Manages modem response
- @param from Initial byte position
- @param to Final byte position
- */
- void manageResponse(byte from, byte to);
-
- /** Get last command status
- @return returns 0 if last command is still executing, 1 success, >1 error
- */
- int ready(){return GSM3ShieldV1BaseProvider::ready();};
-
- // Client socket management, just to be compatible
- // with the Multi option
-
- /** Get socket
- @param socket Socket
- @return socket
- */
- int getSocket(int socket=-1);
-
- /** Release socket
- @param socket Socket
- */
- void releaseSocket(int socket);
-
- /** Get socket client status
- @param socket Socket
- @return 1 if connected, 0 otherwise
- */
- bool getStatusSocketClient(uint8_t socket);
-
-};
-
-
-#endif
\ No newline at end of file
diff --git a/libraries/GSM/src/GSM3ShieldV1DataNetworkProvider.cpp b/libraries/GSM/src/GSM3ShieldV1DataNetworkProvider.cpp
deleted file mode 100644
index 467136a52f8..00000000000
--- a/libraries/GSM/src/GSM3ShieldV1DataNetworkProvider.cpp
+++ /dev/null
@@ -1,398 +0,0 @@
-/*
-This file is part of the GSM3 communications library for Arduino
--- Multi-transport communications platform
--- Fully asynchronous
--- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
--- Voice calls
--- SMS
--- TCP/IP connections
--- HTTP basic clients
-
-This library has been developed by Telefónica Digital - PDI -
-- Physical Internet Lab, as part as its collaboration with
-Arduino and the Open Hardware Community.
-
-September-December 2012
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-The latest version of this library can always be found at
-https://github.com/BlueVia/Official-Arduino
-*/
-#include
-#include
-
-const char _command_CGATT[] PROGMEM = "AT+CGATT=";
-const char _command_SEPARATOR[] PROGMEM = "\",\"";
-
-//Attach GPRS main function.
-GSM3_NetworkStatus_t GSM3ShieldV1DataNetworkProvider::attachGPRS(char* apn, char* user_name, char* password, bool synchronous)
-{
- user = user_name;
- passwd = password;
- // A sad use of byte reuse
- theGSM3ShieldV1ModemCore.setPhoneNumber(apn);
-
- theGSM3ShieldV1ModemCore.openCommand(this,ATTACHGPRS);
- theGSM3ShieldV1ModemCore.setStatus(CONNECTING);
-
- attachGPRSContinue();
-
- // If synchronous, wait till attach is over, or not.
- if(synchronous)
- {
- // if we shorten this delay, the command fails
- while(ready()==0)
- delay(100);
- }
-
- return theGSM3ShieldV1ModemCore.getStatus();
-}
-
-//Atthach GPRS continue function.
-void GSM3ShieldV1DataNetworkProvider::attachGPRSContinue()
-{
- bool resp;
- // 1: Attach to GPRS service "AT+CGATT=1"
- // 2: Wait attach OK and Set the context 0 as FGCNT "AT+QIFGCNT=0"
- // 3: Wait context OK and Set bearer type as GPRS, APN, user name and pasword "AT+QICSGP=1..."
- // 4: Wait bearer OK and Enable the function of MUXIP "AT+QIMUX=1"
- // 5: Wait for disable MUXIP OK and Set the session mode as non transparent "AT+QIMODE=0"
- // 6: Wait for session mode OK and Enable notification when data received "AT+QINDI=1"
- // 8: Wait domain name OK and Register the TCP/IP stack "AT+QIREGAPP"
- // 9: Wait for Register OK and Activate FGCNT "AT+QIACT"
- // 10: Wait for activate OK
-
- int ct=theGSM3ShieldV1ModemCore.getCommandCounter();
- if(ct==1)
- {
- //AT+CGATT
- theGSM3ShieldV1ModemCore.genericCommand_rq(_command_CGATT,false);
- theGSM3ShieldV1ModemCore.print(1);
- theGSM3ShieldV1ModemCore.print('\r');
- theGSM3ShieldV1ModemCore.setCommandCounter(2);
- }
- else if(ct==2)
- {
- if(theGSM3ShieldV1ModemCore.genericParse_rsp(resp))
- {
- if(resp)
- {
- //AT+QIFGCNT
- theGSM3ShieldV1ModemCore.genericCommand_rq(PSTR("AT+QIFGCNT=0"));
- theGSM3ShieldV1ModemCore.setCommandCounter(3);
- }
- else theGSM3ShieldV1ModemCore.closeCommand(3);
- }
- }
- else if(ct==3)
- {
- if(theGSM3ShieldV1ModemCore.genericParse_rsp(resp))
- {
- if(resp)
- {
- // Great. Go for the next step
- //DEBUG
- //Serial.println("AT+QICSGP.");
- theGSM3ShieldV1ModemCore.genericCommand_rq(PSTR("AT+QICSGP=1,\""),false);
- theGSM3ShieldV1ModemCore.print(theGSM3ShieldV1ModemCore.getPhoneNumber());
- theGSM3ShieldV1ModemCore.genericCommand_rq(_command_SEPARATOR,false);
- theGSM3ShieldV1ModemCore.print(user);
- theGSM3ShieldV1ModemCore.genericCommand_rq(_command_SEPARATOR,false);
- theGSM3ShieldV1ModemCore.print(passwd);
- theGSM3ShieldV1ModemCore.print("\"\r");
- theGSM3ShieldV1ModemCore.setCommandCounter(4);
- }
- else theGSM3ShieldV1ModemCore.closeCommand(3);
- }
- }
- else if(ct==4)
- {
- if(theGSM3ShieldV1ModemCore.genericParse_rsp(resp))
- {
- if(resp)
- {
- // AT+QIMUX=1 for multisocket
- theGSM3ShieldV1ModemCore.genericCommand_rq(PSTR("AT+QIMUX=0"));
- theGSM3ShieldV1ModemCore.setCommandCounter(5);
- }
- else theGSM3ShieldV1ModemCore.closeCommand(3);
- }
- }
- else if(ct==5)
- {
- if(theGSM3ShieldV1ModemCore.genericParse_rsp(resp))
- {
- if(resp)
- {
- //AT+QIMODE=0 for multisocket
- theGSM3ShieldV1ModemCore.genericCommand_rq(PSTR("AT+QIMODE=1"));
- theGSM3ShieldV1ModemCore.setCommandCounter(6);
- }
- else theGSM3ShieldV1ModemCore.closeCommand(3);
- }
- }
- else if(ct==6)
- {
- if(theGSM3ShieldV1ModemCore.genericParse_rsp(resp))
- {
- if(resp)
- {
- // AT+QINDI=1
- theGSM3ShieldV1ModemCore.genericCommand_rq(PSTR("AT+QINDI=1"));
- theGSM3ShieldV1ModemCore.setCommandCounter(8);
- }
- else theGSM3ShieldV1ModemCore.closeCommand(3);
- }
- }
- else if(ct==8)
- {
- if(theGSM3ShieldV1ModemCore.genericParse_rsp(resp))
- {
- if(resp)
- {
- // AT+QIREGAPP
- theGSM3ShieldV1ModemCore.genericCommand_rq(PSTR("AT+QIREGAPP"));
- theGSM3ShieldV1ModemCore.setCommandCounter(9);
- }
- else theGSM3ShieldV1ModemCore.closeCommand(3);
- }
- }
- else if(ct==9)
- {
- if(theGSM3ShieldV1ModemCore.genericParse_rsp(resp))
- {
- if(resp)
- {
- // AT+QIACT
- theGSM3ShieldV1ModemCore.genericCommand_rq(PSTR("AT+QIACT"));
- theGSM3ShieldV1ModemCore.setCommandCounter(10);
- }
- else theGSM3ShieldV1ModemCore.closeCommand(3);
- }
- }
- else if(ct==10)
- {
- if(theGSM3ShieldV1ModemCore.genericParse_rsp(resp))
- {
- if (resp)
- {
- theGSM3ShieldV1ModemCore.setStatus(GPRS_READY);
- theGSM3ShieldV1ModemCore.closeCommand(1);
- }
- else theGSM3ShieldV1ModemCore.closeCommand(3);
- }
- }
-}
-
-//Detach GPRS main function.
-GSM3_NetworkStatus_t GSM3ShieldV1DataNetworkProvider::detachGPRS(bool synchronous)
-{
- theGSM3ShieldV1ModemCore.openCommand(this,DETACHGPRS);
- theGSM3ShieldV1ModemCore.setStatus(CONNECTING);
- detachGPRSContinue();
-
- if(synchronous)
- {
- while(ready()==0)
- delay(1);
- }
-
- return theGSM3ShieldV1ModemCore.getStatus();
-}
-
-void GSM3ShieldV1DataNetworkProvider::detachGPRSContinue()
-{
- bool resp;
- // 1: Detach to GPRS service "AT+CGATT=0"
- // 2: Wait dettach +PDP DEACT
- // 3: Wait for OK
-
- switch (theGSM3ShieldV1ModemCore.getCommandCounter()) {
- case 1:
- //AT+CGATT=0
- theGSM3ShieldV1ModemCore.genericCommand_rq(_command_CGATT,false);
- theGSM3ShieldV1ModemCore.print(0);
- theGSM3ShieldV1ModemCore.print('\r');
- theGSM3ShieldV1ModemCore.setCommandCounter(2);
- break;
- case 2:
- char auxLocate[12];
- prepareAuxLocate(PSTR("+PDP DEACT"), auxLocate);
- if(theGSM3ShieldV1ModemCore.theBuffer().locate(auxLocate))
- {
- if(resp)
- {
- // Received +PDP DEACT;
- theGSM3ShieldV1ModemCore.setCommandCounter(3);
- }
- else theGSM3ShieldV1ModemCore.closeCommand(3);
- }
- break;
- case 3:
- if(theGSM3ShieldV1ModemCore.genericParse_rsp(resp))
- {
- // OK received
- if (resp)
- {
- theGSM3ShieldV1ModemCore.setStatus(GSM_READY);
- theGSM3ShieldV1ModemCore.closeCommand(1);
- }
- else theGSM3ShieldV1ModemCore.closeCommand(3);
- }
- theGSM3ShieldV1ModemCore.theBuffer().flush();
- theGSM3ShieldV1ModemCore.gss.spaceAvailable();
- break;
- }
-}
-
-//QILOCIP parse.
-bool GSM3ShieldV1DataNetworkProvider::parseQILOCIP_rsp(char* LocalIP, int LocalIPlength, bool& rsp)
-{
- if (!(theGSM3ShieldV1ModemCore.theBuffer().extractSubstring("\r\n","\r\n", LocalIP, LocalIPlength)))
- rsp = false;
- else
- rsp = true;
- return true;
-}
-
-//Get IP main function.
-int GSM3ShieldV1DataNetworkProvider::getIP(char* LocalIP, int LocalIPlength)
-{
- theGSM3ShieldV1ModemCore.setPhoneNumber(LocalIP);
- theGSM3ShieldV1ModemCore.setPort(LocalIPlength);
- theGSM3ShieldV1ModemCore.openCommand(this,GETIP);
- getIPContinue();
- return theGSM3ShieldV1ModemCore.getCommandError();
-}
-
-void GSM3ShieldV1DataNetworkProvider::getIPContinue()
-{
-
- bool resp;
- // 1: Read Local IP "AT+QILOCIP"
- // 2: Waiting for IP.
-
- switch (theGSM3ShieldV1ModemCore.getCommandCounter()) {
- case 1:
- //AT+QILOCIP
- theGSM3ShieldV1ModemCore.genericCommand_rq(PSTR("AT+QILOCIP"));
- theGSM3ShieldV1ModemCore.setCommandCounter(2);
- break;
- case 2:
- if(parseQILOCIP_rsp(theGSM3ShieldV1ModemCore.getPhoneNumber(), theGSM3ShieldV1ModemCore.getPort(), resp))
- {
- if (resp)
- theGSM3ShieldV1ModemCore.closeCommand(1);
- else
- theGSM3ShieldV1ModemCore.closeCommand(3);
- }
- theGSM3ShieldV1ModemCore.theBuffer().flush();
- theGSM3ShieldV1ModemCore.gss.spaceAvailable();
- break;
- }
-}
-
-//Get IP with IPAddress object
-IPAddress GSM3ShieldV1DataNetworkProvider::getIPAddress() {
- char ip_temp[15]="";
- getIP(ip_temp, 15);
- unsigned long m=millis();
-
- while((millis()-m)<10*1000 && (!ready())){
- // wait for a response from the modem:
- delay(100);
- }
- IPAddress ip;
- inet_aton(ip_temp, ip);
- return ip;
-}
-
-int GSM3ShieldV1DataNetworkProvider::inet_aton(const char* aIPAddrString, IPAddress& aResult)
-{
- // See if we've been given a valid IP address
- const char* p =aIPAddrString;
- while (*p &&
- ( (*p == '.') || (*p >= '0') || (*p <= '9') ))
- {
- p++;
- }
-
- if (*p == '\0')
- {
- // It's looking promising, we haven't found any invalid characters
- p = aIPAddrString;
- int segment =0;
- int segmentValue =0;
- while (*p && (segment < 4))
- {
- if (*p == '.')
- {
- // We've reached the end of a segment
- if (segmentValue > 255)
- {
- // You can't have IP address segments that don't fit in a byte
- return 0;
- }
- else
- {
- aResult[segment] = (byte)segmentValue;
- segment++;
- segmentValue = 0;
- }
- }
- else
- {
- // Next digit
- segmentValue = (segmentValue*10)+(*p - '0');
- }
- p++;
- }
- // We've reached the end of address, but there'll still be the last
- // segment to deal with
- if ((segmentValue > 255) || (segment > 3))
- {
- // You can't have IP address segments that don't fit in a byte,
- // or more than four segments
- return 0;
- }
- else
- {
- aResult[segment] = (byte)segmentValue;
- return 1;
- }
- }
- else
- {
- return 0;
- }
-}
-
-//Response management.
-void GSM3ShieldV1DataNetworkProvider::manageResponse(byte from, byte to)
-{
- switch(theGSM3ShieldV1ModemCore.getOngoingCommand())
- {
- case ATTACHGPRS:
- attachGPRSContinue();
- break;
- case DETACHGPRS:
- detachGPRSContinue();
- break;
- case GETIP:
- getIPContinue();
- break;
- }
-}
diff --git a/libraries/GSM/src/GSM3ShieldV1DataNetworkProvider.h b/libraries/GSM/src/GSM3ShieldV1DataNetworkProvider.h
deleted file mode 100644
index 012a0ca5412..00000000000
--- a/libraries/GSM/src/GSM3ShieldV1DataNetworkProvider.h
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
-This file is part of the GSM3 communications library for Arduino
--- Multi-transport communications platform
--- Fully asynchronous
--- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
--- Voice calls
--- SMS
--- TCP/IP connections
--- HTTP basic clients
-
-This library has been developed by Telefónica Digital - PDI -
-- Physical Internet Lab, as part as its collaboration with
-Arduino and the Open Hardware Community.
-
-September-December 2012
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-The latest version of this library can always be found at
-https://github.com/BlueVia/Official-Arduino
-*/
-#ifndef _GSM3SHIELDV1DATANETWORKPROVIDER_
-#define _GSM3SHIELDV1DATANETWORKPROVIDER_
-
-#include
-#include
-#include
-#include
-
-class GSM3ShieldV1DataNetworkProvider : public GSM3MobileDataNetworkProvider, public GSM3ShieldV1BaseProvider
-{
- private:
-
- char* user; // Username for GPRS
- char* passwd; // Password for GPRS
-
- /** Continue to attach GPRS function
- */
- void attachGPRSContinue();
-
- /** Continue to detach GPRS function
- */
- void detachGPRSContinue();
-
- /** Parse QILOCIP response
- @param LocalIP Buffer for save local IP address
- @param LocalIPlength Buffer size
- @param rsp Returns true if expected response exists
- @return true if command executed correctly
- */
- bool parseQILOCIP_rsp(char* LocalIP, int LocalIPlength, bool& rsp);
-
- /** Continue to get IP function
- */
- void getIPContinue();
-
- /** Implementation of inet_aton standard function
- @param aIPAddrString IP address in characters buffer
- @param aResult IP address in IPAddress format
- @return 1 if the address is successfully converted, or 0 if the conversion failed
- */
- int inet_aton(const char* aIPAddrString, IPAddress& aResult);
-
- public:
-
- /** Attach to GPRS/GSM network
- @param networkId APN GPRS
- @param user Username
- @param pass Password
- @return connection status
- */
- GSM3_NetworkStatus_t networkAttach(char* networkId, char* user, char* pass)
- {
- return attachGPRS(networkId, user, pass);
- };
-
- /** Detach GPRS/GSM network
- @return connection status
- */
- GSM3_NetworkStatus_t networkDetach(){ return detachGPRS();};
-
- /** Attach to GPRS service
- @param apn APN GPRS
- @param user_name Username
- @param password Password
- @param synchronous Sync mode
- @return connection status
- */
- GSM3_NetworkStatus_t attachGPRS(char* apn, char* user_name, char* password, bool synchronous=true);
-
- /** Detach GPRS service
- @param synchronous Sync mode
- @return connection status
- */
- GSM3_NetworkStatus_t detachGPRS(bool synchronous=true);
-
- /** Returns 0 if last command is still executing
- @return 1 if success, >1 if error
- */
- int ready(){return GSM3ShieldV1BaseProvider::ready();};
-
- /** Get network status (connection)
- @return status
- */
- inline GSM3_NetworkStatus_t getStatus(){return theGSM3ShieldV1ModemCore.getStatus();};
-
- /** Get actual assigned IP address
- @param LocalIP Buffer for copy IP address
- @param LocalIPlength Buffer length
- @return command error if exists
- */
- int getIP(char* LocalIP, int LocalIPlength);
-
- /** Get actual assigned IP address in IPAddress format
- @return IP address in IPAddress format
- */
- IPAddress getIPAddress();
-
- /** Manages modem response
- @param from Initial byte of buffer
- @param to Final byte of buffer
- */
- void manageResponse(byte from, byte to);
-
-
-};
-
-#endif
\ No newline at end of file
diff --git a/libraries/GSM/src/GSM3ShieldV1DirectModemProvider.cpp b/libraries/GSM/src/GSM3ShieldV1DirectModemProvider.cpp
deleted file mode 100644
index 47aa52b0741..00000000000
--- a/libraries/GSM/src/GSM3ShieldV1DirectModemProvider.cpp
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
-This file is part of the GSM3 communications library for Arduino
--- Multi-transport communications platform
--- Fully asynchronous
--- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
--- Voice calls
--- SMS
--- TCP/IP connections
--- HTTP basic clients
-
-This library has been developed by Telefónica Digital - PDI -
-- Physical Internet Lab, as part as its collaboration with
-Arduino and the Open Hardware Community.
-
-September-December 2012
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-The latest version of this library can always be found at
-https://github.com/BlueVia/Official-Arduino
-*/
-#include
-#include
-#include
-#include
-
-#define __RESETPIN__ 7
-
-//Constructor
-GSM3ShieldV1DirectModemProvider::GSM3ShieldV1DirectModemProvider(bool t)
-{
- trace=t;
-};
-
-void GSM3ShieldV1DirectModemProvider::begin()
-{
- theGSM3ShieldV1ModemCore.gss.begin(9600);
-}
-
-void GSM3ShieldV1DirectModemProvider::restartModem()
-{
- pinMode(__RESETPIN__, OUTPUT);
- digitalWrite(__RESETPIN__, HIGH);
- delay(12000);
- digitalWrite(__RESETPIN__, LOW);
- delay(1000);
-
-}
-
-//To enable the debug process
-void GSM3ShieldV1DirectModemProvider::connect()
-{
- theGSM3ShieldV1ModemCore.registerActiveProvider(this);
-}
-
-//To disable the debug process
-void GSM3ShieldV1DirectModemProvider::disconnect()
-{
- theGSM3ShieldV1ModemCore.registerActiveProvider(0);
-}
-
-//Write to the modem by means of SoftSerial
-size_t GSM3ShieldV1DirectModemProvider::write(uint8_t c)
-{
- theGSM3ShieldV1ModemCore.write(c);
-}
-
-//Detect if data to be read
-int/*bool*/ GSM3ShieldV1DirectModemProvider::available()
-{
- if (theGSM3ShieldV1ModemCore.gss.cb.peek(1)) return 1;
- else return 0;
-}
-
-//Read data
-int/*char*/ GSM3ShieldV1DirectModemProvider::read()
-{
- int dataRead;
- dataRead = theGSM3ShieldV1ModemCore.gss.cb.read();
- //In case last char in xof mode.
- if (!(theGSM3ShieldV1ModemCore.gss.cb.peek(0))) {
- theGSM3ShieldV1ModemCore.gss.spaceAvailable();
- delay(100);
- }
- return dataRead;
-}
-
-//Peek data
-int/*char*/ GSM3ShieldV1DirectModemProvider::peek()
-{
- return theGSM3ShieldV1ModemCore.gss.cb.peek(0);
-}
-
-//Flush data
-void GSM3ShieldV1DirectModemProvider::flush()
-{
- return theGSM3ShieldV1ModemCore.gss.cb.flush();
-}
-
-String GSM3ShieldV1DirectModemProvider::writeModemCommand(String ATcommand, int responseDelay)
-{
-
- if(trace)
- Serial.println(ATcommand);
-
- // Flush other texts
- flush();
-
- //Enter debug mode.
- connect();
- //Send the AT command.
- println(ATcommand);
-
- delay(responseDelay);
-
- //Get response data from modem.
- String result = "";
- if(trace)
- theGSM3ShieldV1ModemCore.gss.cb.debugBuffer();
-
- while (available())
- {
- char c = read();
- result += c;
- }
- if(trace)
- Serial.println(result);
- //Leave the debug mode.
- disconnect();
- return result;
-}
\ No newline at end of file
diff --git a/libraries/GSM/src/GSM3ShieldV1DirectModemProvider.h b/libraries/GSM/src/GSM3ShieldV1DirectModemProvider.h
deleted file mode 100644
index 2d20412b47b..00000000000
--- a/libraries/GSM/src/GSM3ShieldV1DirectModemProvider.h
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
-This file is part of the GSM3 communications library for Arduino
--- Multi-transport communications platform
--- Fully asynchronous
--- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
--- Voice calls
--- SMS
--- TCP/IP connections
--- HTTP basic clients
-
-This library has been developed by Telefónica Digital - PDI -
-- Physical Internet Lab, as part as its collaboration with
-Arduino and the Open Hardware Community.
-
-September-December 2012
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-The latest version of this library can always be found at
-https://github.com/BlueVia/Official-Arduino
-*/
-
-#ifndef __GSM3DIRECTMODEMPROVIDER__
-#define __GSM3DIRECTMODEMPROVIDER__
-
-#include
-#include
-#include
-#include
-#include
-
-class GSM3ShieldV1DirectModemProvider : public GSM3ShieldV1BaseProvider, public Stream
-{
- private:
-
- bool trace;
-
- public:
-
- /** Constructor
- @param trace if true, dumps all AT dialogue to Serial
- */
- GSM3ShieldV1DirectModemProvider(bool trace=false);
-
- /**
- */
- void begin();
-
- /**
- */
- void restartModem();
-
- /** Enable the debug process.
- */
- void connect();
-
- /** Disable the debug process.
- */
- void disconnect();
-
- /** Debug write to modem by means of SoftSerial.
- @param c Character
- @return size
- */
- size_t write(uint8_t c);
-
- /** Check for incoming bytes in buffer
- @return
- */
- int available();
-
- /** Read from circular buffer
- @return character
- */
- int read();
-
- /** Read from circular buffer, but do not delete it
- @return character
- */
- int peek();
-
- /** Empty circular buffer
- */
- void flush();
-
- /** Manages modem response
- @param from Initial byte of buffer
- @param to Final byte of buffer
- */
- void manageResponse(byte from, byte to){};
-
- /** Recognize unsolicited event
- @param from
- @return true if successful
- */
- bool recognizeUnsolicitedEvent(byte from){return false;};
-
- /** Send AT command to modem
- @param command AT command
- @param delay Time to wait for response
- @return response from modem
- */
- String writeModemCommand(String command, int delay);
-};
-
-#endif
\ No newline at end of file
diff --git a/libraries/GSM/src/GSM3ShieldV1ModemCore.cpp b/libraries/GSM/src/GSM3ShieldV1ModemCore.cpp
deleted file mode 100644
index 234874cd583..00000000000
--- a/libraries/GSM/src/GSM3ShieldV1ModemCore.cpp
+++ /dev/null
@@ -1,231 +0,0 @@
-/*
-This file is part of the GSM3 communications library for Arduino
--- Multi-transport communications platform
--- Fully asynchronous
--- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
--- Voice calls
--- SMS
--- TCP/IP connections
--- HTTP basic clients
-
-This library has been developed by Telefónica Digital - PDI -
-- Physical Internet Lab, as part as its collaboration with
-Arduino and the Open Hardware Community.
-
-September-December 2012
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-The latest version of this library can always be found at
-https://github.com/BlueVia/Official-Arduino
-*/
-#include
-#include
-
-GSM3ShieldV1ModemCore theGSM3ShieldV1ModemCore;
-
-char* __ok__="OK";
-
-GSM3ShieldV1ModemCore::GSM3ShieldV1ModemCore() : gss()
-{
- gss.registerMgr(this);
- _dataInBufferFrom=0;
- _dataInBufferTo=0;
- commandError=1;
- commandCounter=0;
- ongoingCommand=NONE;
- takeMilliseconds();
-
- for(int i=0;irecognizeUnsolicitedEvent(from);
- }
- if((!recognized)&&(activeProvider))
- activeProvider->manageResponse(from, to);
-}
-
-
-void GSM3ShieldV1ModemCore::openCommand(GSM3ShieldV1BaseProvider* provider, GSM3_commandType_e c)
-{
- activeProvider=provider;
- commandError=0;
- commandCounter=1;
- ongoingCommand=c;
- _dataInBufferFrom=0;
- _dataInBufferTo=0;
-
-};
-
-size_t GSM3ShieldV1ModemCore::writePGM(PGM_P str, bool CR)
-{
- int i=0;
- char c;
-
- do
- {
- c=pgm_read_byte_near(str + i);
- if(c!=0)
- write(c);
- i++;
- } while (c!=0);
- if(CR)
- print("\r");
-
- return 1;
-}
-
-size_t GSM3ShieldV1ModemCore::write(uint8_t c)
-{
- if(_debug)
- GSM3CircularBuffer::printCharDebug(c);
- return gss.write(c);
-}
-
-unsigned long GSM3ShieldV1ModemCore::takeMilliseconds()
-{
- unsigned long now=millis();
- unsigned long delta;
- delta=now-milliseconds;
- milliseconds=now;
- return delta;
-}
-
-void GSM3ShieldV1ModemCore::delayInsideInterrupt(unsigned long milliseconds)
-{
- for (unsigned long k=0;k
-#include
-#include
-#include
-
-#define UMPROVIDERS 3
-
-class GSM3ShieldV1ModemCore : public GSM3SoftSerialMgr, public Print
-{
- private:
-
- // Phone number, used when calling, sending SMS and reading calling numbers
- // Also PIN in modem configuration
- // Also APN
- // Also remote server
- char* phoneNumber;
-
- // Working port. Port used in the ongoing command, while opening a server
- // Also for IP address length
- int port;
-
- // 0 = ongoing
- // 1 = OK
- // 2 = Error. Incorrect state
- // 3 = Unexpected modem message
- // 4 = OK but not available data.
- uint8_t commandError;
-
- // Counts the steps by the command
- uint8_t commandCounter;
-
- // Presently ongoing command
- GSM3_commandType_e ongoingCommand;
-
- // Enable/disable debug
- bool _debug;
- byte _dataInBufferFrom;
- byte _dataInBufferTo;
-
- // This is the modem (known) status
- GSM3_NetworkStatus_t _status;
-
- GSM3ShieldV1BaseProvider* UMProvider[UMPROVIDERS];
- GSM3ShieldV1BaseProvider* activeProvider;
-
- // Private function for anage message
- void manageMsgNow(byte from, byte to);
-
- unsigned long milliseconds;
-
- public:
-
- /** Constructor */
- GSM3ShieldV1ModemCore();
-
- GSM3SoftSerial gss; // Direct access to modem
-
- /** Get phone number
- @return phone number
- */
- char *getPhoneNumber(){return phoneNumber;};
-
- /** Establish a new phone number
- @param n Phone number
- */
- void setPhoneNumber(char *n){phoneNumber=n;};
-
- /** Get port used
- @return port
- */
- int getPort(){return port;};
-
- /** Establish a new port for use
- @param p Port
- */
- void setPort(int p){port=p;};
-
- /** Get command error
- @return command error
- */
- uint8_t getCommandError(){return commandError;};
-
- /** Establish a command error
- @param n Command error
- */
- void setCommandError(uint8_t n){commandError=n;};
-
- /** Get command counter
- @return command counter
- */
- uint8_t getCommandCounter(){return commandCounter;};
-
- /** Set command counter
- @param c Initial value
- */
- void setCommandCounter(uint8_t c){commandCounter=c;};
-
- /** Get ongoing command
- @return command
- */
- GSM3_commandType_e getOngoingCommand(){return ongoingCommand;};
-
- /** Set ongoing command
- @param c New ongoing command
- */
- void setOngoingCommand(GSM3_commandType_e c){ongoingCommand=c;};
-
- /** Open command
- @param activeProvider Active provider
- @param c Command for open
- */
- void openCommand(GSM3ShieldV1BaseProvider* activeProvider, GSM3_commandType_e c);
-
- /** Close command
- @param code Close code
- */
- void closeCommand(int code);
-
- // These functions allow writing to the SoftwareSerial
- // If debug is set, dump to the console
-
- /** Write a character in serial
- @param c Character
- @return size
- */
- size_t write(uint8_t c);
-
- /** Write PGM
- @param str Buffer for write
- @param CR Carriadge return adding automatically
- @return size
- */
- virtual size_t writePGM(PGM_P str, bool CR=true);
-
- /** Establish debug mode
- @param db Boolean that indicates debug on or off
- */
- void setDebug(bool db){_debug=db;};
-
- /** Generic response parser
- @param rsp Returns true if expected response exists
- @param string Substring expected in response
- @param string2 Second substring expected in response
- @return true if parsed correctly
- */
- bool genericParse_rsp(bool& rsp, char* string=0, char* string2=0);
-
- /** Generates a generic AT command request from PROGMEM buffer
- @param str Buffer with AT command
- @param addCR Carriadge return adding automatically
- */
- void genericCommand_rq(PGM_P str, bool addCR=true);
-
- /** Generates a generic AT command request from a simple char buffer
- @param str Buffer with AT command
- @param addCR Carriadge return adding automatically
- */
- void genericCommand_rqc(const char* str, bool addCR=true);
-
- /** Returns the circular buffer
- @return circular buffer
- */
- inline GSM3CircularBuffer& theBuffer(){return gss.cb;};
-
- /** Establish a new network status
- @param status Network status
- */
- inline void setStatus(GSM3_NetworkStatus_t status) { _status = status; };
-
- /** Returns actual network status
- @return network status
- */
- inline GSM3_NetworkStatus_t getStatus() { return _status; };
-
- /** Register provider as willing to receive unsolicited messages
- @param provider Pointer to provider able to receive unsolicited messages
- */
- void registerUMProvider(GSM3ShieldV1BaseProvider* provider);
-
- /** unegister provider as willing to receive unsolicited messages
- @param provider Pointer to provider able to receive unsolicited messages
- */
- void unRegisterUMProvider(GSM3ShieldV1BaseProvider* provider);
-
-
- /** Register a provider as "dialoguing" talking in facto with the modem
- @param provider Pointer to provider receiving responses
- */
- void registerActiveProvider(GSM3ShieldV1BaseProvider* provider){activeProvider=provider;};
-
- /** Needed to manage the SoftSerial. Receives the call when received data
- If _debugging, no code is called
- @param from Starting byte to read
- @param to Last byte to read
- */
- void manageMsg(byte from, byte to);
-
- /** If _debugging, this call is assumed to be made out of interrupts
- Prints incoming info and calls manageMsgNow
- */
- void manageReceivedData();
-
- /** Chronometer. Measure milliseconds from last call
- @return milliseconds from las time function was called
- */
- unsigned long takeMilliseconds();
-
- /** Delay for interrupts
- @param milliseconds Delay time in milliseconds
- */
- void delayInsideInterrupt(unsigned long milliseconds);
-
-};
-
-extern GSM3ShieldV1ModemCore theGSM3ShieldV1ModemCore;
-
-#endif
diff --git a/libraries/GSM/src/GSM3ShieldV1ModemVerification.cpp b/libraries/GSM/src/GSM3ShieldV1ModemVerification.cpp
deleted file mode 100644
index c0e3da991ce..00000000000
--- a/libraries/GSM/src/GSM3ShieldV1ModemVerification.cpp
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
-This file is part of the GSM3 communications library for Arduino
--- Multi-transport communications platform
--- Fully asynchronous
--- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
--- Voice calls
--- SMS
--- TCP/IP connections
--- HTTP basic clients
-
-This library has been developed by Telefónica Digital - PDI -
-- Physical Internet Lab, as part as its collaboration with
-Arduino and the Open Hardware Community.
-
-September-December 2012
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-The latest version of this library can always be found at
-https://github.com/BlueVia/Official-Arduino
-*/
-
-#include
-
-// constructor
-GSM3ShieldV1ModemVerification::GSM3ShieldV1ModemVerification()
-{
-};
-
-// reset the modem for direct access
-int GSM3ShieldV1ModemVerification::begin()
-{
- int result=0;
- String modemResponse;
-
- // check modem response
- modemAccess.begin();
-
- // reset hardware
- modemAccess.restartModem();
-
- modemResponse=modemAccess.writeModemCommand("AT", 1000);
- if(modemResponse.indexOf("OK")>=0)
- result=1;
- modemResponse=modemAccess.writeModemCommand("ATE0", 1000);
- return result;
-}
-
-// get IMEI
-String GSM3ShieldV1ModemVerification::getIMEI()
-{
- String number(NULL);
- // AT command for obtain IMEI
- String modemResponse = modemAccess.writeModemCommand("AT+GSN", 2000);
- // Parse and check response
- char res_to_compare[modemResponse.length()];
- modemResponse.toCharArray(res_to_compare, modemResponse.length());
- if(strstr(res_to_compare,"OK") != NULL)
- number = modemResponse.substring(1, 17);
- return number;
-}
diff --git a/libraries/GSM/src/GSM3ShieldV1ModemVerification.h b/libraries/GSM/src/GSM3ShieldV1ModemVerification.h
deleted file mode 100644
index 98dbc49888d..00000000000
--- a/libraries/GSM/src/GSM3ShieldV1ModemVerification.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
-This file is part of the GSM3 communications library for Arduino
--- Multi-transport communications platform
--- Fully asynchronous
--- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
--- Voice calls
--- SMS
--- TCP/IP connections
--- HTTP basic clients
-
-This library has been developed by Telefónica Digital - PDI -
-- Physical Internet Lab, as part as its collaboration with
-Arduino and the Open Hardware Community.
-
-September-December 2012
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-The latest version of this library can always be found at
-https://github.com/BlueVia/Official-Arduino
-*/
-#ifndef _GSM3SHIELDV1MODEMVERIFICATION_
-#define _GSM3SHIELDV1MODEMVERIFICATION_
-
-#include
-#include
-
-class GSM3ShieldV1ModemVerification
-{
-
- private:
-
- GSM3ShieldV1DirectModemProvider modemAccess;
- GSM3ShieldV1AccessProvider gsm; // Access provider to GSM/GPRS network
-
- public:
-
- /** Constructor */
- GSM3ShieldV1ModemVerification();
-
- /** Check modem response and restart it
- */
- int begin();
-
- /** Obtain modem IMEI (command AT)
- @return modem IMEI number
- */
- String getIMEI();
-
-};
-
-#endif
\ No newline at end of file
diff --git a/libraries/GSM/src/GSM3ShieldV1MultiClientProvider.cpp b/libraries/GSM/src/GSM3ShieldV1MultiClientProvider.cpp
deleted file mode 100644
index b3bdfba842f..00000000000
--- a/libraries/GSM/src/GSM3ShieldV1MultiClientProvider.cpp
+++ /dev/null
@@ -1,616 +0,0 @@
-/*
-This file is part of the GSM3 communications library for Arduino
--- Multi-transport communications platform
--- Fully asynchronous
--- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
--- Voice calls
--- SMS
--- TCP/IP connections
--- HTTP basic clients
-
-This library has been developed by Telefónica Digital - PDI -
-- Physical Internet Lab, as part as its collaboration with
-Arduino and the Open Hardware Community.
-
-September-December 2012
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-The latest version of this library can always be found at
-https://github.com/BlueVia/Official-Arduino
-*/
-#include
-#include
-
-const char _command_MultiQISRVC[] PROGMEM = "AT+QISRVC=";
-
-#define __TOUTFLUSH__ 10000
-
-GSM3ShieldV1MultiClientProvider::GSM3ShieldV1MultiClientProvider()
-{
- theGSM3MobileClientProvider=this;
- theGSM3ShieldV1ModemCore.registerUMProvider(this);
-};
-
-//Response management.
-void GSM3ShieldV1MultiClientProvider::manageResponse(byte from, byte to)
-{
- switch(theGSM3ShieldV1ModemCore.getOngoingCommand())
- {
- case XON:
- if (flagReadingSocket)
- {
-// flagReadingSocket = 0;
- fullBufferSocket = (theGSM3ShieldV1ModemCore.theBuffer().availableBytes()<3);
- }
- else theGSM3ShieldV1ModemCore.setOngoingCommand(NONE);
- break;
- case NONE:
- theGSM3ShieldV1ModemCore.gss.cb.deleteToTheEnd(from);
- break;
- case CONNECTTCPCLIENT:
- connectTCPClientContinue();
- break;
- case DISCONNECTTCP:
- disconnectTCPContinue();
- break;
- case BEGINWRITESOCKET:
- beginWriteSocketContinue();
- break;
- case ENDWRITESOCKET:
- endWriteSocketContinue();
- break;
- case AVAILABLESOCKET:
- availableSocketContinue();
- break;
- case FLUSHSOCKET:
- fullBufferSocket = (theGSM3ShieldV1ModemCore.theBuffer().availableBytes()<3);
- flushSocketContinue();
- break;
- }
-}
-
-//Connect TCP main function.
-int GSM3ShieldV1MultiClientProvider::connectTCPClient(const char* server, int port, int id_socket)
-{
- theGSM3ShieldV1ModemCore.setPort(port);
- idSocket = id_socket;
-
- theGSM3ShieldV1ModemCore.setPhoneNumber((char*)server);
- theGSM3ShieldV1ModemCore.openCommand(this,CONNECTTCPCLIENT);
- connectTCPClientContinue();
- return theGSM3ShieldV1ModemCore.getCommandError();
-}
-
-int GSM3ShieldV1MultiClientProvider::connectTCPClient(IPAddress add, int port, int id_socket)
-{
- remoteIP=add;
- theGSM3ShieldV1ModemCore.setPhoneNumber(0);
- return connectTCPClient(0, port, id_socket);
-}
-
-//Connect TCP continue function.
-void GSM3ShieldV1MultiClientProvider::connectTCPClientContinue()
-{
- bool resp;
- // 0: Dot or DNS notation activation
- // 1: Disable SW flow control
- // 2: Waiting for IFC OK
- // 3: Start-up TCP connection "AT+QIOPEN"
- // 4: Wait for connection OK
- // 5: Wait for CONNECT
-
- switch (theGSM3ShieldV1ModemCore.getCommandCounter()) {
- case 1:
- theGSM3ShieldV1ModemCore.genericCommand_rq(PSTR("AT+QIDNSIP="), false);
- if ((theGSM3ShieldV1ModemCore.getPhoneNumber()!=0)&&
- ((*(theGSM3ShieldV1ModemCore.getPhoneNumber())<'0')||((*(theGSM3ShieldV1ModemCore.getPhoneNumber())>'9'))))
- {
- theGSM3ShieldV1ModemCore.print('1');
- theGSM3ShieldV1ModemCore.print('\r');
- }
- else
- {
- theGSM3ShieldV1ModemCore.print('0');
- theGSM3ShieldV1ModemCore.print('\r');
- }
- theGSM3ShieldV1ModemCore.setCommandCounter(2);
- break;
- case 2:
- if(theGSM3ShieldV1ModemCore.genericParse_rsp(resp))
- {
- //Response received
- if(resp)
- {
- // AT+QIOPEN
- theGSM3ShieldV1ModemCore.genericCommand_rq(PSTR("AT+QIOPEN="),false);
- theGSM3ShieldV1ModemCore.print(idSocket);
- theGSM3ShieldV1ModemCore.print(",\"TCP\",\"");
- if(theGSM3ShieldV1ModemCore.getPhoneNumber()!=0)
- {
- theGSM3ShieldV1ModemCore.print(theGSM3ShieldV1ModemCore.getPhoneNumber());
- }
- else
- {
- remoteIP.printTo(theGSM3ShieldV1ModemCore);
- }
- theGSM3ShieldV1ModemCore.print('"');
- theGSM3ShieldV1ModemCore.print(',');
- theGSM3ShieldV1ModemCore.print(theGSM3ShieldV1ModemCore.getPort());
- theGSM3ShieldV1ModemCore.print('\r');
- theGSM3ShieldV1ModemCore.setCommandCounter(3);
- }
- else theGSM3ShieldV1ModemCore.closeCommand(3);
- }
- break;
-
- case 3:
- if(theGSM3ShieldV1ModemCore.genericParse_rsp(resp))
- {
- // Response received
- if(resp)
- {
- // OK Received
- // Great. Go for the next step
- theGSM3ShieldV1ModemCore.setCommandCounter(4);
- }
- else theGSM3ShieldV1ModemCore.closeCommand(3);
- }
- break;
- case 4:
- char auxLocate [12];
- prepareAuxLocate(PSTR("CONNECT OK"), auxLocate);
- if(theGSM3ShieldV1ModemCore.genericParse_rsp(resp,auxLocate))
- {
- // Response received
- if(resp)
- {
- // Received CONNECT OK
- // Great. We're done
- theGSM3ShieldV1ModemCore.closeCommand(1);
- }
- else
- theGSM3ShieldV1ModemCore.closeCommand(3);
- }
- break;
-
- }
-}
-
-//Disconnect TCP main function.
-int GSM3ShieldV1MultiClientProvider::disconnectTCP(bool client1Server0, int id_socket)
-{
- idSocket = id_socket;
-
- // First of all, we will flush the socket synchronously
- unsigned long m;
- m=millis();
- flushSocket();
- while(((millis()-m)< __TOUTFLUSH__ )&&(ready()==0))
- delay(10);
-
- // Could not flush the communications... strange
- if(ready()==0)
- {
- theGSM3ShieldV1ModemCore.setCommandError(2);
- return theGSM3ShieldV1ModemCore.getCommandError();
- }
-
- // Set up the command
- client1_server0 = client1Server0;
- flagReadingSocket=0;
- theGSM3ShieldV1ModemCore.openCommand(this,DISCONNECTTCP);
- disconnectTCPContinue();
- return theGSM3ShieldV1ModemCore.getCommandError();
-}
-
-//Disconnect TCP continue function
-void GSM3ShieldV1MultiClientProvider::disconnectTCPContinue()
-{
- bool resp;
- // 1: Send AT+QISRVC
- // 2: "AT+QICLOSE"
- // 3: Wait for OK
-
- switch (theGSM3ShieldV1ModemCore.getCommandCounter()) {
- case 1:
- theGSM3ShieldV1ModemCore.genericCommand_rq(_command_MultiQISRVC, false);
- if (client1_server0) theGSM3ShieldV1ModemCore.print('1');
- else theGSM3ShieldV1ModemCore.print('2');
- theGSM3ShieldV1ModemCore.print('\r');
- theGSM3ShieldV1ModemCore.setCommandCounter(2);
- break;
- case 2:
- // Parse response to QISRVC
- theGSM3ShieldV1ModemCore.genericParse_rsp(resp);
- if(resp)
- {
- // Send QICLOSE command
- theGSM3ShieldV1ModemCore.genericCommand_rq(PSTR("AT+QICLOSE="),false);
- theGSM3ShieldV1ModemCore.print(idSocket);
- theGSM3ShieldV1ModemCore.print('\r');
- theGSM3ShieldV1ModemCore.setCommandCounter(3);
- }
- else
- theGSM3ShieldV1ModemCore.closeCommand(3);
- break;
- case 3:
- if(theGSM3ShieldV1ModemCore.genericParse_rsp(resp))
- {
- theGSM3ShieldV1ModemCore.setCommandCounter(0);
- if (resp)
- theGSM3ShieldV1ModemCore.closeCommand(1);
- else
- theGSM3ShieldV1ModemCore.closeCommand(3);
- }
- break;
- }
-}
-
-//Write socket first chain main function.
-void GSM3ShieldV1MultiClientProvider::beginWriteSocket(bool client1Server0, int id_socket)
-{
- idSocket = id_socket;
- client1_server0 = client1Server0;
- theGSM3ShieldV1ModemCore.openCommand(this,BEGINWRITESOCKET);
- beginWriteSocketContinue();
-}
-
-//Write socket first chain continue function.
-void GSM3ShieldV1MultiClientProvider::beginWriteSocketContinue()
-{
- bool resp;
- // 1: Send AT+QISRVC
- // 2: Send AT+QISEND
- // 3: wait for > and Write text
- switch (theGSM3ShieldV1ModemCore.getCommandCounter()) {
- case 1:
- // AT+QISRVC
- theGSM3ShieldV1ModemCore.genericCommand_rq(_command_MultiQISRVC, false);
- if (client1_server0)
- theGSM3ShieldV1ModemCore.print('1');
- else
- theGSM3ShieldV1ModemCore.print('2');
- theGSM3ShieldV1ModemCore.print('\r');
- theGSM3ShieldV1ModemCore.setCommandCounter(2);
- break;
- case 2:
- if(theGSM3ShieldV1ModemCore.genericParse_rsp(resp))
- {
- // Response received
- if(resp)
- {
- // AT+QISEND
- theGSM3ShieldV1ModemCore.genericCommand_rq(PSTR("AT+QISEND="), false);
- theGSM3ShieldV1ModemCore.print(idSocket);
- theGSM3ShieldV1ModemCore.print('\r');
- theGSM3ShieldV1ModemCore.setCommandCounter(3);
- }
- else
- {
- theGSM3ShieldV1ModemCore.closeCommand(3);
- }
- }
- break;
- case 3:
- char aux[2];
- aux[0]='>';
- aux[1]=0;
- if(theGSM3ShieldV1ModemCore.genericParse_rsp(resp, aux))
- {
- if(resp)
- {
- // Received ">"
- theGSM3ShieldV1ModemCore.closeCommand(1);
- }
- else
- {
- theGSM3ShieldV1ModemCore.closeCommand(3);
- }
- }
- break;
- }
-}
-
-//Write socket next chain function.
-void GSM3ShieldV1MultiClientProvider::writeSocket(const char* buf)
-{
- theGSM3ShieldV1ModemCore.print(buf);
-}
-
-//Write socket character function.
-void GSM3ShieldV1MultiClientProvider::writeSocket(char c)
-{
- theGSM3ShieldV1ModemCore.print(c);
-}
-
-//Write socket last chain main function.
-void GSM3ShieldV1MultiClientProvider::endWriteSocket()
-{
- theGSM3ShieldV1ModemCore.openCommand(this,ENDWRITESOCKET);
- endWriteSocketContinue();
-}
-
-//Write socket last chain continue function.
-void GSM3ShieldV1MultiClientProvider::endWriteSocketContinue()
-{
- bool resp;
- // 1: Write text (ctrl-Z)
- // 2: Wait for OK
- switch (theGSM3ShieldV1ModemCore.getCommandCounter()) {
- case 1:
- theGSM3ShieldV1ModemCore.write(26); // Ctrl-Z
- theGSM3ShieldV1ModemCore.setCommandCounter(2);
- break;
- case 2:
- if(theGSM3ShieldV1ModemCore.genericParse_rsp(resp))
- {
- // OK received
- if (resp) theGSM3ShieldV1ModemCore.closeCommand(1);
- else theGSM3ShieldV1ModemCore.closeCommand(3);
- }
- break;
- }
-}
-
-//Available socket main function.
-int GSM3ShieldV1MultiClientProvider::availableSocket(bool client1Server0, int id_socket)
-{
- if(flagReadingSocket==1)
- {
- theGSM3ShieldV1ModemCore.setCommandError(1);
- return 1;
- }
- client1_server0 = client1Server0;
- idSocket = id_socket;
- theGSM3ShieldV1ModemCore.openCommand(this,AVAILABLESOCKET);
- availableSocketContinue();
- return theGSM3ShieldV1ModemCore.getCommandError();
-}
-
-//Available socket continue function.
-void GSM3ShieldV1MultiClientProvider::availableSocketContinue()
-{
- bool resp;
- // 1: AT+QIRD
- // 2: Wait for OK and Next necessary AT+QIRD
-
- switch (theGSM3ShieldV1ModemCore.getCommandCounter()) {
- case 1:
- theGSM3ShieldV1ModemCore.genericCommand_rq(PSTR("AT+QIRD=0,"),false);
- if (client1_server0)
- theGSM3ShieldV1ModemCore.print('1');
- else
- theGSM3ShieldV1ModemCore.print('2');
- theGSM3ShieldV1ModemCore.print(',');
- theGSM3ShieldV1ModemCore.print(idSocket);
- theGSM3ShieldV1ModemCore.print(",1500");
- // theGSM3ShieldV1ModemCore.print(",120");
- theGSM3ShieldV1ModemCore.print('\r');
- theGSM3ShieldV1ModemCore.setCommandCounter(2);
- break;
- case 2:
- if(parseQIRD_head(resp))
- {
- if (!resp)
- {
- theGSM3ShieldV1ModemCore.closeCommand(4);
- }
- else
- {
- flagReadingSocket=1;
- theGSM3ShieldV1ModemCore.closeCommand(1);
- }
- }
- else
- {
- theGSM3ShieldV1ModemCore.closeCommand(3);
- }
- break;
- }
-}
-
-//Read Socket Parse head.
-bool GSM3ShieldV1MultiClientProvider::parseQIRD_head(bool& rsp)
-{
- char _qird [8];
- prepareAuxLocate(PSTR("+QIRD:"), _qird);
- fullBufferSocket = (theGSM3ShieldV1ModemCore.theBuffer().availableBytes()<3);
- if(theGSM3ShieldV1ModemCore.theBuffer().locate(_qird))
- {
- theGSM3ShieldV1ModemCore.theBuffer().chopUntil(_qird, true);
- // Saving more memory, reuse _qird
- _qird[0]='\n';
- _qird[1]=0;
- theGSM3ShieldV1ModemCore.theBuffer().chopUntil(_qird, true);
- rsp = true;
- return true;
- }
- else if(theGSM3ShieldV1ModemCore.theBuffer().locate("OK"))
- {
- rsp = false;
- return true;
- }
- else
- {
- rsp = false;
- return false;
- }
-}
-/*
-//Read socket main function.
-int GSM3ShieldV1MultiClientProvider::readSocket()
-{
- char charSocket;
- charSocket = theGSM3ShieldV1ModemCore.theBuffer().read();
- //Case buffer not full
- if (!fullBufferSocket)
- {
- //The last part of the buffer after data is CRLFOKCRLF
- if (theGSM3ShieldV1ModemCore.theBuffer().availableBytes()==125)
- {
- //Start again availableSocket function.
- flagReadingSocket=0;
- theGSM3ShieldV1ModemCore.openCommand(this,AVAILABLESOCKET);
- availableSocketContinue();
- }
- }
- else if (theGSM3ShieldV1ModemCore.theBuffer().availableBytes()==127)
- {
- // The buffer is full, no more action is possible until we have read()
- theGSM3ShieldV1ModemCore.theBuffer().flush();
- flagReadingSocket = 1;
- theGSM3ShieldV1ModemCore.openCommand(this,XON);
- theGSM3ShieldV1ModemCore.gss.spaceAvailable();
- //A small delay to assure data received after xon.
- delay(10);
- }
- //To distinguish the case no more available data in socket.
- if (ready()==1)
- return charSocket;
- else
- return 0;
-}
-*/
-int GSM3ShieldV1MultiClientProvider::readSocket()
-{
- char charSocket;
-
- if(theGSM3ShieldV1ModemCore.theBuffer().availableBytes()==0)
- {
- Serial.println();Serial.println("*");
- return 0;
- }
-
- charSocket = theGSM3ShieldV1ModemCore.theBuffer().read();
- //Case buffer not full
- if (!fullBufferSocket)
- {
- //The last part of the buffer after data is CRLFOKCRLF
- if (theGSM3ShieldV1ModemCore.theBuffer().availableBytes()==125)
- {
- //Start again availableSocket function.
- flagReadingSocket=0;
- theGSM3ShieldV1ModemCore.openCommand(this,AVAILABLESOCKET);
- availableSocketContinue();
- }
- }
- else if (theGSM3ShieldV1ModemCore.theBuffer().availableBytes()>=100)
- {
- // The buffer was full, we have to let the data flow again
- // theGSM3ShieldV1ModemCore.theBuffer().flush();
- flagReadingSocket = 1;
- theGSM3ShieldV1ModemCore.openCommand(this,XON);
- theGSM3ShieldV1ModemCore.gss.spaceAvailable();
- //A small delay to assure data received after xon.
- delay(100);
- if(theGSM3ShieldV1ModemCore.theBuffer().availableBytes() >=6)
- fullBufferSocket=false;
- }
-
- return charSocket;
-
-}
-
-//Read socket main function.
-int GSM3ShieldV1MultiClientProvider::peekSocket()
-{
- return theGSM3ShieldV1ModemCore.theBuffer().peek(0);
-}
-
-
-//Flush SMS main function.
-void GSM3ShieldV1MultiClientProvider::flushSocket()
-{
- flagReadingSocket=0;
- theGSM3ShieldV1ModemCore.openCommand(this,FLUSHSOCKET);
- flushSocketContinue();
-}
-
-//Send SMS continue function.
-void GSM3ShieldV1MultiClientProvider::flushSocketContinue()
-{
- bool resp;
- // 1: Deleting SMS
- // 2: wait for OK
- switch (theGSM3ShieldV1ModemCore.getCommandCounter()) {
- case 1:
- //DEBUG
- //Serial.println("Flushing Socket.");
- theGSM3ShieldV1ModemCore.theBuffer().flush();
- if (fullBufferSocket)
- {
- //Serial.println("Buffer flushed.");
- theGSM3ShieldV1ModemCore.gss.spaceAvailable();
- }
- else
- {
- //Serial.println("Socket flushed completely.");
- theGSM3ShieldV1ModemCore.closeCommand(1);
- }
- break;
- }
-}
-
-//URC recognize.
-// Momentarily, we will not recognize "closes" in client mode
-bool GSM3ShieldV1MultiClientProvider::recognizeUnsolicitedEvent(byte oldTail)
-{
- return false;
-}
-
-int GSM3ShieldV1MultiClientProvider::getSocket(int socket)
-{
- if(socket==-1)
- {
- int i;
- for(i=minSocket(); i<=maxSocket(); i++)
- {
- if (!(sockets&(0x0001<8)
- return 0;
- if(sockets&(0x0001<
-#include
-
-class GSM3ShieldV1MultiClientProvider : public GSM3MobileClientProvider, public GSM3ShieldV1BaseProvider
-{
- private:
-
- int remotePort; // Current operation remote port
- int idSocket; // Remote ID socket
- IPAddress remoteIP; // Remote IP address
-
- uint16_t sockets;
-
- /** Continue to connect TCP client function
- */
- void connectTCPClientContinue();
-
- /** Continue to disconnect TCP client function
- */
- void disconnectTCPContinue();
-
- /** Continue to begin socket for write function
- */
- void beginWriteSocketContinue();
-
- /** Continue to end write socket function
- */
- void endWriteSocketContinue();
-
- /** Continue to available socket function
- */
- void availableSocketContinue();
-
- /** Continue to flush socket function
- */
- void flushSocketContinue();
-
- // GATHER!
- bool flagReadingSocket; //In case socket data being read, update fullBufferSocket in the next buffer.
- bool fullBufferSocket; //To detect if the socket data being read needs another buffer.
- bool client1_server0; //1 Client, 0 Server.
-
- /** Parse QIRD response
- @param rsp Returns true if expected response exists
- @return true if command executed correctly
- */
- bool parseQIRD_head(bool& rsp);
-
- public:
-
- /** Constructor */
- GSM3ShieldV1MultiClientProvider();
-
- /** Minimum socket
- @return 0
- */
- int minSocket(){return 0;};
-
- /** Maximum socket
- @return 5
- */
- int maxSocket(){return 5;};
-
- /** Connect to a remote TCP server
- @param server String with IP or server name
- @param port Remote port number
- @param id_socket Local socket number
- @return 0 if command running, 1 if success, otherwise error
- */
- int connectTCPClient(const char* server, int port, int id_socket);
-
- /** Connect to a remote TCP server
- @param add Remote IP address
- @param port Remote port number
- @param id_socket Local socket number
- @return 0 if command running, 1 if success, otherwise error
- */
- int connectTCPClient(IPAddress add, int port, int id_socket);
-
- /** Begin writing through a socket
- @param client1Server0 1 if modem acts as client, 0 if acts as server
- @param id_socket Local socket number
- @return 0 if command running, 1 if success, otherwise error
- */
- void beginWriteSocket(bool client1Server0, int id_socket);
-
- /** Write through a socket. MUST go after beginWriteSocket()
- @param buf characters to be written (final 0 will not be written)
- */
- void writeSocket(const char* buf);
-
- /** Write through a socket. MUST go after beginWriteSocket()
- @param c character to be written
- */
- void writeSocket(char c);
-
- /** Finish current writing
- */
- void endWriteSocket();
-
- /** Check if there are data to be read in socket.
- @param client1Server0 1 if modem acts as client, 0 if acts as server
- @param id_socket Local socket number
- @return 0 if command running, 1 if there are data available, 4 if no data, otherwise error
- */
- int availableSocket(bool client, int id_socket); // With "available" and "readSocket" ask the modem for 1500 bytes.
-
- /** Read a character from socket
- @return socket
- */
- int readSocket(); //If Read() gets to the end of the QIRD response, execute again QIRD SYNCHRONOUSLY
-
- /** Flush socket
- */
- void flushSocket();
-
- /** Get a character but will not advance the buffer head
- @return character
- */
- int peekSocket();
-
- /** Close a socket
- @param client1Server0 1 if modem acts as client, 0 if acts as server
- @param id_socket Local socket number
- @return 0 if command running, 1 if success, otherwise error
- */
- int disconnectTCP(bool client1Server0, int id_socket);
-
- /** Recognize unsolicited event
- @param from
- @return true if successful
- */
- bool recognizeUnsolicitedEvent(byte from);
-
- /** Manages modem response
- @param from Initial byte of buffer
- @param to Final byte of buffer
- */
- void manageResponse(byte from, byte to);
-
- /** Get last command status
- @return returns 0 if last command is still executing, 1 success, >1 error
- */
- int ready(){return GSM3ShieldV1BaseProvider::ready();};
-
- /** Get client socket
- @param socket
- @return socket
- */
- int getSocket(int socket=-1);
-
- /** Release socket
- @param socket Socket for release
- */
- void releaseSocket(int socket);
-
- /** Get socket client status
- @param socket Socket
- @return socket client status
- */
- bool getStatusSocketClient(uint8_t socket);
-
-};
-
-
-#endif
\ No newline at end of file
diff --git a/libraries/GSM/src/GSM3ShieldV1MultiServerProvider.cpp b/libraries/GSM/src/GSM3ShieldV1MultiServerProvider.cpp
deleted file mode 100644
index 6ab37dbad98..00000000000
--- a/libraries/GSM/src/GSM3ShieldV1MultiServerProvider.cpp
+++ /dev/null
@@ -1,390 +0,0 @@
-/*
-This file is part of the GSM3 communications library for Arduino
--- Multi-transport communications platform
--- Fully asynchronous
--- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
--- Voice calls
--- SMS
--- TCP/IP connections
--- HTTP basic clients
-
-This library has been developed by Telefónica Digital - PDI -
-- Physical Internet Lab, as part as its collaboration with
-Arduino and the Open Hardware Community.
-
-September-December 2012
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-The latest version of this library can always be found at
-https://github.com/BlueVia/Official-Arduino
-*/
-#include
-#include
-#include
-
-#define __NCLIENTS_MAX__ 3
-
-const char _command_QILOCIP[] PROGMEM = "AT+QILOCIP";
-
-GSM3ShieldV1MultiServerProvider::GSM3ShieldV1MultiServerProvider()
-{
- theGSM3MobileServerProvider=this;
- socketsAsServer=0;
- socketsAccepted=0;
- theGSM3ShieldV1ModemCore.registerUMProvider(this);
-};
-
-//Response management.
-void GSM3ShieldV1MultiServerProvider::manageResponse(byte from, byte to)
-{
- switch(theGSM3ShieldV1ModemCore.getOngoingCommand())
- {
- case NONE:
- theGSM3ShieldV1ModemCore.gss.cb.deleteToTheEnd(from);
- break;
- case CONNECTSERVER:
- connectTCPServerContinue();
- break;
- case GETIP:
- getIPContinue();
- break;
- }
-}
-
-//Connect Server main function.
-int GSM3ShieldV1MultiServerProvider::connectTCPServer(int port)
-{
- // We forget about LocalIP as it has no real use, the modem does whatever it likes
- theGSM3ShieldV1ModemCore.setPort(port);
- theGSM3ShieldV1ModemCore.openCommand(this,CONNECTSERVER);
- connectTCPServerContinue();
- return theGSM3ShieldV1ModemCore.getCommandError();
-}
-
-//Connect Server continue function.
-void GSM3ShieldV1MultiServerProvider::connectTCPServerContinue()
-{
-
- bool resp;
- // 1: Read Local IP "AT+QILOCIP"
- // 2: Waiting for IP and Set local port "AT+QILPORT"
- // 3: Waiting for QILPOR OK andConfigure as server "AT+QISERVER"
- // 4: Wait for SERVER OK
-
- switch (theGSM3ShieldV1ModemCore.getCommandCounter()) {
- case 1:
- //"AT+QILOCIP."
- theGSM3ShieldV1ModemCore.genericCommand_rq(_command_QILOCIP);
- theGSM3ShieldV1ModemCore.setCommandCounter(2);
- break;
- case 2:
- //Not IP storing but the command is necessary.
- //if(parseQILOCIP_rsp(local_IP, local_IP_Length, resp))
- // This awful trick saves some RAM bytes
- char aux[3];
- aux[0]='\r';aux[1]='\n';aux[2]=0;
- if(theGSM3ShieldV1ModemCore.genericParse_rsp(resp, aux))
- {
- //Response received
- if(resp)
- {
- // Great. Go for the next step
- // AT+QILPORT
- theGSM3ShieldV1ModemCore.genericCommand_rq(PSTR("AT+QILPORT=\"TCP\","),false);
- theGSM3ShieldV1ModemCore.print( theGSM3ShieldV1ModemCore.getPort());
- theGSM3ShieldV1ModemCore.print('\r');
- theGSM3ShieldV1ModemCore.setCommandCounter(3);
- }
- else theGSM3ShieldV1ModemCore.closeCommand(3);
- }
- break;
- case 3:
- if(theGSM3ShieldV1ModemCore.genericParse_rsp(resp))
- {
- // Response received
- if(resp)
- {
- // OK received
- // Great. Go for the next step
- // AT+QISERVER
- theGSM3ShieldV1ModemCore.genericCommand_rq(PSTR("AT+QISERVER=0,"),false);
- theGSM3ShieldV1ModemCore.print(__NCLIENTS_MAX__);
- theGSM3ShieldV1ModemCore.print('\r');
- theGSM3ShieldV1ModemCore.setCommandCounter(4);
- }
- else theGSM3ShieldV1ModemCore.closeCommand(3);
- }
- break;
- case 4:
- if(theGSM3ShieldV1ModemCore.genericParse_rsp(resp))
- {
- // Response received
- // OK received, kathapoon, chessespoon
- if (resp) theGSM3ShieldV1ModemCore.closeCommand(1);
- else theGSM3ShieldV1ModemCore.closeCommand(3);
- }
- break;
- }
-}
-
-//QILOCIP parse.
-bool GSM3ShieldV1MultiServerProvider::parseQILOCIP_rsp(char* LocalIP, int LocalIPlength, bool& rsp)
-{
- if (!(theGSM3ShieldV1ModemCore.theBuffer().extractSubstring("\r\n","\r\n", LocalIP, LocalIPlength)))
- rsp = false;
- else
- rsp = true;
- return true;
-}
-
-//Get IP main function.
-int GSM3ShieldV1MultiServerProvider::getIP(char* LocalIP, int LocalIPlength)
-{
- theGSM3ShieldV1ModemCore.setPhoneNumber(LocalIP);
- theGSM3ShieldV1ModemCore.setPort(LocalIPlength);
- theGSM3ShieldV1ModemCore.openCommand(this,GETIP);
- getIPContinue();
- return theGSM3ShieldV1ModemCore.getCommandError();
-}
-
-void GSM3ShieldV1MultiServerProvider::getIPContinue()
-{
-
- bool resp;
- // 1: Read Local IP "AT+QILOCIP"
- // 2: Waiting for IP.
-
- switch (theGSM3ShieldV1ModemCore.getCommandCounter()) {
- case 1:
- //AT+QILOCIP
- theGSM3ShieldV1ModemCore.genericCommand_rq(_command_QILOCIP);
- theGSM3ShieldV1ModemCore.setCommandCounter(2);
- break;
- case 2:
- if(parseQILOCIP_rsp(theGSM3ShieldV1ModemCore.getPhoneNumber(), theGSM3ShieldV1ModemCore.getPort(), resp))
- {
- if (resp)
- theGSM3ShieldV1ModemCore.closeCommand(1);
- else
- theGSM3ShieldV1ModemCore.closeCommand(3);
- }
- break;
- }
-}
-
-bool GSM3ShieldV1MultiServerProvider::getSocketAsServerModemStatus(int s)
-{
- if (socketsAccepted&(0x0001<
-#include
-
-class GSM3ShieldV1MultiServerProvider : public GSM3MobileServerProvider, public GSM3ShieldV1BaseProvider
-{
- private:
-
- // Used sockets
- uint8_t socketsAsServer;
- uint8_t socketsAccepted;
-
- /** Continue to connect TCP server function
- */
- void connectTCPServerContinue();
-
- /** Continue to get IP function
- */
- void getIPContinue();
-
- /** Release socket
- @param socket Socket
- */
- void releaseSocket(int socket);
-
- /** Parse QILOCIP response
- @param LocalIP Buffer for save local IP address
- @param LocalIPlength Buffer size
- @param rsp Returns if expected response exists
- @return true if command executed correctly
- */
- bool parseQILOCIP_rsp(char* LocalIP, int LocalIPlength, bool& rsp);
-
- public:
-
- /** Constructor */
- GSM3ShieldV1MultiServerProvider();
-
- /** minSocketAsServer
- @return 0
- */
- int minSocketAsServer(){return 0;};
-
- /** maxSocketAsServer
- @return 0
- */
- int maxSocketAsServer(){return 4;};
-
- /** Get modem status
- @param s
- @return modem status (true if connected)
- */
- bool getSocketAsServerModemStatus(int s);
-
- /** Get new occupied socket as server
- @return command error if exists
- */
- int getNewOccupiedSocketAsServer();
-
- /** Connect server to TCP port
- @param port TCP port
- @return command error if exists
- */
- int connectTCPServer(int port);
-
- /** Get server IP address
- @param LocalIP Buffer for copy IP address
- @param LocalIPlength Length of buffer
- @return command error if exists
- */
- int getIP(char* LocalIP, int LocalIPlength);
-
-// int disconnectTCP(bool client1Server0, int id_socket);
-
- /** Get last command status
- @return returns 0 if last command is still executing, 1 success, >1 error
- */
- int ready(){return GSM3ShieldV1BaseProvider::ready();};
-
- /** Get socket status as server
- @param socket Socket to get status
- @return socket status
- */
- bool getStatusSocketAsServer(uint8_t socket);
-
- /** Manages modem response
- @param from Initial byte of buffer
- @param to Final byte of buffer
- */
- void manageResponse(byte from, byte to);
-
- /** Recognize unsolicited event
- @param oldTail
- @return true if successful
- */
- bool recognizeUnsolicitedEvent(byte oldTail);
-
-
-};
-
-#endif
diff --git a/libraries/GSM/src/GSM3ShieldV1PinManagement.cpp b/libraries/GSM/src/GSM3ShieldV1PinManagement.cpp
deleted file mode 100644
index 0c0c74960d0..00000000000
--- a/libraries/GSM/src/GSM3ShieldV1PinManagement.cpp
+++ /dev/null
@@ -1,201 +0,0 @@
-/*
-This file is part of the GSM3 communications library for Arduino
--- Multi-transport communications platform
--- Fully asynchronous
--- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
--- Voice calls
--- SMS
--- TCP/IP connections
--- HTTP basic clients
-
-This library has been developed by Telefónica Digital - PDI -
-- Physical Internet Lab, as part as its collaboration with
-Arduino and the Open Hardware Community.
-
-September-December 2012
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-The latest version of this library can always be found at
-https://github.com/BlueVia/Official-Arduino
-*/
-
-#include
-
-// constructor
-GSM3ShieldV1PinManagement::GSM3ShieldV1PinManagement()
-{
-};
-
-// reset the modem for direct access
-void GSM3ShieldV1PinManagement::begin()
-{
- // reset hardware
- gsm.HWrestart();
-
- pin_used = false;
-
- // check modem response
- modemAccess.writeModemCommand("AT", 1000);
- modemAccess.writeModemCommand("ATE0", 1000);
-}
-
-/*
- Check PIN status
-*/
-int GSM3ShieldV1PinManagement::isPIN()
-{
- String res = modemAccess.writeModemCommand("AT+CPIN?",1000);
- // Check response
- char res_to_compare[res.length()];
- res.toCharArray(res_to_compare, res.length());
- if(strstr(res_to_compare, "READY") != NULL)
- return 0;
- else if(strstr(res_to_compare, "SIM PIN") != NULL)
- return 1;
- else if(strstr(res_to_compare, "SIM PUK") != NULL)
- return -1;
- else
- return -2;
-}
-
-/*
- Check PIN code
-*/
-int GSM3ShieldV1PinManagement::checkPIN(String pin)
-{
- String res = modemAccess.writeModemCommand("AT+CPIN=" + pin,1000);
- // check response
- char res_to_compare[res.length()];
- res.toCharArray(res_to_compare, res.length());
- if(strstr(res_to_compare, "OK") == NULL)
- return -1;
- else
- return 0;
-}
-
-/*
- Check PUK code
-*/
-int GSM3ShieldV1PinManagement::checkPUK(String puk, String pin)
-{
- String res = modemAccess.writeModemCommand("AT+CPIN=\"" + puk + "\",\"" + pin + "\"",1000);
- // check response
- char res_to_compare[res.length()];
- res.toCharArray(res_to_compare, res.length());
- if(strstr(res_to_compare, "OK") == NULL)
- return -1;
- else
- return 0;
-}
-
-/*
- Change PIN code
-*/
-void GSM3ShieldV1PinManagement::changePIN(String old, String pin)
-{
- String res = modemAccess.writeModemCommand("AT+CPWD=\"SC\",\"" + old + "\",\"" + pin + "\"",2000);
- Serial.println(res);
- // check response
- char res_to_compare[res.length()];
- res.toCharArray(res_to_compare, res.length());
- if(strstr(res_to_compare, "OK") != NULL)
- Serial.println("Pin changed succesfully.");
- else
- Serial.println("ERROR");
-}
-
-/*
- Switch PIN status
-*/
-void GSM3ShieldV1PinManagement::switchPIN(String pin)
-{
- String res = modemAccess.writeModemCommand("AT+CLCK=\"SC\",2",1000);
- // check response
- char res_to_compare[res.length()];
- res.toCharArray(res_to_compare, res.length());
- if(strstr(res_to_compare, "0") != NULL)
- {
- res = modemAccess.writeModemCommand("AT+CLCK=\"SC\",1,\"" + pin + "\"",1000);
- // check response
- char res_to_compare[res.length()];
- res.toCharArray(res_to_compare, res.length());
- if(strstr(res_to_compare, "OK") == NULL)
- {
- Serial.println("ERROR");
- pin_used = false;
- }
- else
- {
- Serial.println("OK. PIN lock on.");
- pin_used = true;
- }
- }
- else if(strstr(res_to_compare, "1") != NULL)
- {
- res = modemAccess.writeModemCommand("AT+CLCK=\"SC\",0,\"" + pin + "\"",1000);
- // check response
- char res_to_compare[res.length()];
- res.toCharArray(res_to_compare, res.length());
- if(strstr(res_to_compare, "OK") == NULL)
- {
- Serial.println("ERROR");
- pin_used = true;
- }
- else
- {
- Serial.println("OK. PIN lock off.");
- pin_used = false;
- }
- }
- else
- {
- Serial.println("ERROR");
- }
-}
-
-/*
- Check registrer
-*/
-int GSM3ShieldV1PinManagement::checkReg()
-{
- delay(5000);
- String res = modemAccess.writeModemCommand("AT+CREG?",1000);
- // check response
- char res_to_compare[res.length()];
- res.toCharArray(res_to_compare, res.length());
- if(strstr(res_to_compare, "1") != NULL)
- return 0;
- else if(strstr(res_to_compare, "5") != NULL)
- return 1;
- else
- return -1;
-}
-
-/*
- Return if PIN lock is used
-*/
-bool GSM3ShieldV1PinManagement::getPINUsed()
-{
- return pin_used;
-}
-
-/*
- Set if PIN lock is used
-*/
-void GSM3ShieldV1PinManagement::setPINUsed(bool used)
-{
- pin_used = used;
-}
\ No newline at end of file
diff --git a/libraries/GSM/src/GSM3ShieldV1PinManagement.h b/libraries/GSM/src/GSM3ShieldV1PinManagement.h
deleted file mode 100644
index d5924ea1fe7..00000000000
--- a/libraries/GSM/src/GSM3ShieldV1PinManagement.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
-This file is part of the GSM3 communications library for Arduino
--- Multi-transport communications platform
--- Fully asynchronous
--- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
--- Voice calls
--- SMS
--- TCP/IP connections
--- HTTP basic clients
-
-This library has been developed by Telefónica Digital - PDI -
-- Physical Internet Lab, as part as its collaboration with
-Arduino and the Open Hardware Community.
-
-September-December 2012
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-The latest version of this library can always be found at
-https://github.com/BlueVia/Official-Arduino
-*/
-#ifndef _GSM3SHIELDV1PINMANAGEMENT_
-#define _GSM3SHIELDV1PINMANAGEMENT_
-
-#include
-#include
-
-class GSM3ShieldV1PinManagement
-{
-
- private:
-
- GSM3ShieldV1AccessProvider gsm; // GSM access required for network register with PIN code
- GSM3ShieldV1DirectModemProvider modemAccess;
- bool pin_used; // determines if pin lock is activated
-
- public:
-
- /** Constructor */
- GSM3ShieldV1PinManagement();
-
- /** Check modem response and restart it
- */
- void begin();
-
- /** Check if PIN lock or PUK lock is activated
- @return 0 if PIN lock is off, 1 if PIN lock is on, -1 if PUK lock is on, -2 if error exists
- */
- int isPIN();
-
- /** Check if PIN code is correct and valid
- @param pin PIN code
- @return 0 if is correct, -1 if is incorrect
- */
- int checkPIN(String pin);
-
- /** Check if PUK code is correct and establish new PIN code
- @param puk PUK code
- @param pin New PIN code
- @return 0 if successful, otherwise return -1
- */
- int checkPUK(String puk, String pin);
-
- /** Change PIN code
- @param old Old PIN code
- @param pin New PIN code
- */
- void changePIN(String old, String pin);
-
- /** Change PIN lock status
- @param pin PIN code
- */
- void switchPIN(String pin);
-
- /** Check if modem was registered in GSM/GPRS network
- @return 0 if modem was registered, 1 if modem was registered in roaming, -1 if error exists
- */
- int checkReg();
-
- /** Return if PIN lock is used
- @return true if PIN lock is used, otherwise, return false
- */
- bool getPINUsed();
-
- /** Set PIN lock status
- @param used New PIN lock status
- */
- void setPINUsed(bool used);
-};
-
-#endif
\ No newline at end of file
diff --git a/libraries/GSM/src/GSM3ShieldV1SMSProvider.cpp b/libraries/GSM/src/GSM3ShieldV1SMSProvider.cpp
deleted file mode 100644
index 6c028f6554b..00000000000
--- a/libraries/GSM/src/GSM3ShieldV1SMSProvider.cpp
+++ /dev/null
@@ -1,327 +0,0 @@
-/*
-This file is part of the GSM3 communications library for Arduino
--- Multi-transport communications platform
--- Fully asynchronous
--- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
--- Voice calls
--- SMS
--- TCP/IP connections
--- HTTP basic clients
-
-This library has been developed by Telefónica Digital - PDI -
-- Physical Internet Lab, as part as its collaboration with
-Arduino and the Open Hardware Community.
-
-September-December 2012
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-The latest version of this library can always be found at
-https://github.com/BlueVia/Official-Arduino
-*/
-#include
-#include
-
-GSM3ShieldV1SMSProvider::GSM3ShieldV1SMSProvider()
-{
- theGSM3SMSProvider=this;
-};
-
-//Send SMS begin function.
-int GSM3ShieldV1SMSProvider::beginSMS(const char* to)
-{
- if((theGSM3ShieldV1ModemCore.getStatus() != GSM_READY)&&(theGSM3ShieldV1ModemCore.getStatus() != GPRS_READY))
- return 2;
-
- theGSM3ShieldV1ModemCore.setPhoneNumber((char*)to);
- theGSM3ShieldV1ModemCore.openCommand(this,BEGINSMS);
- beginSMSContinue();
- return theGSM3ShieldV1ModemCore.getCommandError();
-}
-
-//Send SMS continue function.
-void GSM3ShieldV1SMSProvider::beginSMSContinue()
-{
- bool resp;
- // 1: Send AT
- // 2: wait for > and write text
- switch (theGSM3ShieldV1ModemCore.getCommandCounter()) {
- case 1:
- theGSM3ShieldV1ModemCore.setCommandCounter(2);
- theGSM3ShieldV1ModemCore.genericCommand_rq(PSTR("AT+CMGS=\""), false);
- theGSM3ShieldV1ModemCore.print(theGSM3ShieldV1ModemCore.getPhoneNumber());
- theGSM3ShieldV1ModemCore.print("\"\r");
- break;
- case 2:
- if(theGSM3ShieldV1ModemCore.genericParse_rsp(resp, ">"))
- {
- if (resp) theGSM3ShieldV1ModemCore.closeCommand(1);
- else theGSM3ShieldV1ModemCore.closeCommand(3);
- }
- break;
- }
-}
-
-//Send SMS write function.
-void GSM3ShieldV1SMSProvider::writeSMS(char c)
-{
- theGSM3ShieldV1ModemCore.write(c);
-}
-
-//Send SMS begin function.
-int GSM3ShieldV1SMSProvider::endSMS()
-{
- theGSM3ShieldV1ModemCore.openCommand(this,ENDSMS);
- endSMSContinue();
- while(ready()==0) delay(100);
- return theGSM3ShieldV1ModemCore.getCommandError();
-}
-
-//Send SMS continue function.
-void GSM3ShieldV1SMSProvider::endSMSContinue()
-{
- bool resp;
- // 1: Send #26
- // 2: wait for OK
- switch (theGSM3ShieldV1ModemCore.getCommandCounter()) {
- case 1:
- theGSM3ShieldV1ModemCore.setCommandCounter(2);
- theGSM3ShieldV1ModemCore.write(26);
- theGSM3ShieldV1ModemCore.print("\r");
- break;
- case 2:
- if(theGSM3ShieldV1ModemCore.genericParse_rsp(resp))
- {
- if (resp)
- theGSM3ShieldV1ModemCore.closeCommand(1);
- else
- theGSM3ShieldV1ModemCore.closeCommand(3);
- }
- break;
- }
-}
-
-//Available SMS main function.
-int GSM3ShieldV1SMSProvider::availableSMS()
-{
- flagReadingSMS = 0;
- theGSM3ShieldV1ModemCore.openCommand(this,AVAILABLESMS);
- availableSMSContinue();
- return theGSM3ShieldV1ModemCore.getCommandError();
-}
-
-//Available SMS continue function.
-void GSM3ShieldV1SMSProvider::availableSMSContinue()
-{
- // 1: AT+CMGL="REC UNREAD",1
- // 2: Receive +CMGL: _id_ ... READ","_numero_" ... \n_mensaje_\nOK
- // 3: Send AT+CMGD= _id_
- // 4: Receive OK
- // 5: Remaining SMS text in case full buffer.
- // This implementation really does not care much if the modem aswers trash to CMGL
- bool resp;
- //int msglength_aux;
- switch (theGSM3ShieldV1ModemCore.getCommandCounter()) {
- case 1:
- theGSM3ShieldV1ModemCore.genericCommand_rq(PSTR("AT+CMGL=\"REC UNREAD\",1"));
- theGSM3ShieldV1ModemCore.setCommandCounter(2);
- break;
- case 2:
- if(parseCMGL_available(resp))
- {
- if (!resp) theGSM3ShieldV1ModemCore.closeCommand(4);
- else theGSM3ShieldV1ModemCore.closeCommand(1);
- }
- break;
- }
-
-}
-
-//SMS available parse.
-bool GSM3ShieldV1SMSProvider::parseCMGL_available(bool& rsp)
-{
- fullBufferSMS = (theGSM3ShieldV1ModemCore.theBuffer().availableBytes()<=4);
- if (!(theGSM3ShieldV1ModemCore.theBuffer().chopUntil("+CMGL:", true)))
- rsp = false;
- else
- rsp = true;
- idSMS=theGSM3ShieldV1ModemCore.theBuffer().readInt();
-
- //If there are 2 SMS in buffer, response is ...CRLFCRLF+CMGL
- twoSMSinBuffer = theGSM3ShieldV1ModemCore.theBuffer().locate("\r\n\r\n+");
-
- checkSecondBuffer = 0;
-
- return true;
-}
-
-//remoteNumber SMS function.
-int GSM3ShieldV1SMSProvider::remoteSMSNumber(char* number, int nlength)
-{
- theGSM3ShieldV1ModemCore.theBuffer().extractSubstring("READ\",\"", "\"", number, nlength);
-
- return 1;
-}
-
-//remoteNumber SMS function.
-int GSM3ShieldV1SMSProvider::readSMS()
-{
- char charSMS;
- //First char.
- if (!flagReadingSMS)
- {
- flagReadingSMS = 1;
- theGSM3ShieldV1ModemCore.theBuffer().chopUntil("\n", true);
- }
- charSMS = theGSM3ShieldV1ModemCore.theBuffer().read();
-
- //Second Buffer.
- if (checkSecondBuffer)
- {
- checkSecondBuffer = 0;
- twoSMSinBuffer = theGSM3ShieldV1ModemCore.theBuffer().locate("\r\n\r\n+");
- }
-
- //Case the last char in buffer.
- if ((!twoSMSinBuffer)&&fullBufferSMS&&(theGSM3ShieldV1ModemCore.theBuffer().availableBytes()==127))
- {
- theGSM3ShieldV1ModemCore.theBuffer().flush();
- fullBufferSMS = 0;
- checkSecondBuffer = 1;
- theGSM3ShieldV1ModemCore.openCommand(this,XON);
- theGSM3ShieldV1ModemCore.gss.spaceAvailable();
- delay(10);
-
- return charSMS;
- }
- //Case two SMS in buffer
- else if (twoSMSinBuffer)
- {
- if (theGSM3ShieldV1ModemCore.theBuffer().locate("\r\n\r\n+"))
- {
- return charSMS;
- }
- else
- {
- theGSM3ShieldV1ModemCore.theBuffer().flush();
- theGSM3ShieldV1ModemCore.openCommand(this,XON);
- theGSM3ShieldV1ModemCore.gss.spaceAvailable();
- delay(10);
- return 0;
- }
- }
- //Case 1 SMS and buffer not full
- else if (!fullBufferSMS)
- {
- if (theGSM3ShieldV1ModemCore.theBuffer().locate("\r\n\r\nOK"))
- {
- return charSMS;
- }
- else
- {
- theGSM3ShieldV1ModemCore.theBuffer().flush();
- theGSM3ShieldV1ModemCore.openCommand(this,XON);
- theGSM3ShieldV1ModemCore.gss.spaceAvailable();
- delay(10);
- return 0;
- }
- }
- //Case to read all the chars in buffer to the end.
- else
- {
- return charSMS;
- }
-}
-
-//Read socket main function.
-int GSM3ShieldV1SMSProvider::peekSMS()
-{
- if (!flagReadingSMS)
- {
- flagReadingSMS = 1;
- theGSM3ShieldV1ModemCore.theBuffer().chopUntil("\n", true);
- }
-
- return theGSM3ShieldV1ModemCore.theBuffer().peek(0);
-}
-
-//Flush SMS main function.
-void GSM3ShieldV1SMSProvider::flushSMS()
-{
-
- //With this, sms data can fill up to 2x128+5x128 bytes.
- for (int aux = 0;aux<5;aux++)
- {
- theGSM3ShieldV1ModemCore.theBuffer().flush();
- theGSM3ShieldV1ModemCore.gss.spaceAvailable();
- delay(10);
- }
-
- theGSM3ShieldV1ModemCore.openCommand(this,FLUSHSMS);
- flushSMSContinue();
-}
-
-//Send SMS continue function.
-void GSM3ShieldV1SMSProvider::flushSMSContinue()
-{
- bool resp;
- // 1: Deleting SMS
- // 2: wait for OK
- switch (theGSM3ShieldV1ModemCore.getCommandCounter()) {
- case 1:
- theGSM3ShieldV1ModemCore.setCommandCounter(2);
- theGSM3ShieldV1ModemCore.genericCommand_rq(PSTR("AT+CMGD="), false);
- theGSM3ShieldV1ModemCore.print(idSMS);
- theGSM3ShieldV1ModemCore.print("\r");
- break;
- case 2:
- if(theGSM3ShieldV1ModemCore.genericParse_rsp(resp))
- {
- if (resp) theGSM3ShieldV1ModemCore.closeCommand(1);
- else theGSM3ShieldV1ModemCore.closeCommand(3);
- }
- break;
- }
-}
-
-void GSM3ShieldV1SMSProvider::manageResponse(byte from, byte to)
-{
- switch(theGSM3ShieldV1ModemCore.getOngoingCommand())
- {
-/* case XON:
- if (flagReadingSocket)
- {
-// flagReadingSocket = 0;
- fullBufferSocket = (theGSM3ShieldV1ModemCore.theBuffer().availableBytes()<3);
- }
- else theGSM3ShieldV1ModemCore.openCommand(this,NONE);
- break;
-*/ case NONE:
- theGSM3ShieldV1ModemCore.gss.cb.deleteToTheEnd(from);
- break;
- case BEGINSMS:
- beginSMSContinue();
- break;
- case ENDSMS:
- endSMSContinue();
- break;
- case AVAILABLESMS:
- availableSMSContinue();
- break;
- case FLUSHSMS:
- flushSMSContinue();
- break;
- }
-}
diff --git a/libraries/GSM/src/GSM3ShieldV1SMSProvider.h b/libraries/GSM/src/GSM3ShieldV1SMSProvider.h
deleted file mode 100644
index 408da338e1d..00000000000
--- a/libraries/GSM/src/GSM3ShieldV1SMSProvider.h
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
-This file is part of the GSM3 communications library for Arduino
--- Multi-transport communications platform
--- Fully asynchronous
--- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
--- Voice calls
--- SMS
--- TCP/IP connections
--- HTTP basic clients
-
-This library has been developed by Telefónica Digital - PDI -
-- Physical Internet Lab, as part as its collaboration with
-Arduino and the Open Hardware Community.
-
-September-December 2012
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-The latest version of this library can always be found at
-https://github.com/BlueVia/Official-Arduino
-*/
-#ifndef __GSM3_SHIELDV1SMSPROVIDER__
-#define __GSM3_SHIELDV1SMSPROVIDER__
-
-#include
-#include
-#include
-
-
-class GSM3ShieldV1SMSProvider : public GSM3MobileSMSProvider, public GSM3ShieldV1BaseProvider
-{
- public:
- GSM3ShieldV1SMSProvider();
-
- /** Manages modem response
- @param from Initial byte of buffer
- @param to Final byte of buffer
- */
- void manageResponse(byte from, byte to);
-
- /** Begin a SMS to send it
- @param to Destination
- @return error command if it exists
- */
- inline int beginSMS(const char* to);
-
- /** Write a SMS character by character
- @param c Character
- */
- inline void writeSMS(char c);
-
- /** End SMS
- @return error command if it exists
- */
- inline int endSMS();
-
- /** Check if SMS available and prepare it to be read
- @return number of bytes in a received SMS
- */
- int availableSMS();
-
- /** Read a byte but do not advance the buffer header (circular buffer)
- @return character
- */
- int peekSMS();
-
- /** Delete the SMS from Modem memory and proccess answer
- */
- void flushSMS();
-
- /** Read sender number phone
- @param number Buffer for save number phone
- @param nlength Buffer length
- @return 1 success, >1 error
- */
- int remoteSMSNumber(char* number, int nlength); //Before reading the SMS, read the phone number.
-
- /** Read one char for SMS buffer (advance circular buffer)
- @return character
- */
- int readSMS();
-
- /** Get last command status
- @return returns 0 if last command is still executing, 1 success, >1 error
- */
- int ready(){return GSM3ShieldV1BaseProvider::ready();};
-
- private:
-
- int idSMS; // Id from current SMS being read.
- bool flagReadingSMS; // To detect first SMS char if not yet reading.
- bool fullBufferSMS; // To detect if the SMS being read needs another buffer.
- bool twoSMSinBuffer; // To detect if the buffer has more than 1 SMS.
- bool checkSecondBuffer; // Pending to detect if the second buffer has more than 1 SMS.
-
- /** Continue to begin SMS function
- */
- void beginSMSContinue();
-
- /** Continue to end SMS function
- */
- void endSMSContinue();
-
- /** Continue to available SMS function
- */
- void availableSMSContinue();
-
- /** Continue to flush SMS function
- */
- void flushSMSContinue();
-
- /** Parse CMGL response
- @param rsp Returns true if expected response exists
- @return true if command executed correctly
- */
- bool parseCMGL_available(bool& rsp);
-};
-#endif
\ No newline at end of file
diff --git a/libraries/GSM/src/GSM3ShieldV1ScanNetworks.cpp b/libraries/GSM/src/GSM3ShieldV1ScanNetworks.cpp
deleted file mode 100644
index 8b5d5e49899..00000000000
--- a/libraries/GSM/src/GSM3ShieldV1ScanNetworks.cpp
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
-This file is part of the GSM3 communications library for Arduino
--- Multi-transport communications platform
--- Fully asynchronous
--- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
--- Voice calls
--- SMS
--- TCP/IP connections
--- HTTP basic clients
-
-This library has been developed by Telefónica Digital - PDI -
-- Physical Internet Lab, as part as its collaboration with
-Arduino and the Open Hardware Community.
-
-September-December 2012
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-The latest version of this library can always be found at
-https://github.com/BlueVia/Official-Arduino
-*/
-
-#include
-
-GSM3ShieldV1ScanNetworks::GSM3ShieldV1ScanNetworks(bool trace): modem(trace)
-{
-}
-
-GSM3_NetworkStatus_t GSM3ShieldV1ScanNetworks::begin()
-{
- modem.begin();
- modem.restartModem();
- // check modem response
- modem.writeModemCommand("AT", 1000);
- modem.writeModemCommand("ATE0", 1000);
- return IDLE;
-}
-
-String GSM3ShieldV1ScanNetworks::getCurrentCarrier()
-{
- String modemResponse = modem.writeModemCommand("AT+COPS?", 2000);
-
- // Parse and check response
- char res_to_split[modemResponse.length()];
- modemResponse.toCharArray(res_to_split, modemResponse.length());
- if(strstr(res_to_split,"ERROR") == NULL){
- // Tokenizer
- char *ptr_token;
- ptr_token = strtok(res_to_split, "\"");
- ptr_token = strtok(NULL, "\"");
- String final_result = ptr_token;
- return final_result;
- }else{
- return String(NULL);
- }
-}
-
-String GSM3ShieldV1ScanNetworks::getSignalStrength()
-{
- String modemResponse = modem.writeModemCommand("AT+CSQ", 2000);
- char res_to_split[modemResponse.length()];
- modemResponse.toCharArray(res_to_split, modemResponse.length());
- if((strstr(res_to_split,"ERROR") == NULL) | (strstr(res_to_split,"99") == NULL)){
- // Tokenizer
- char *ptr_token;
- ptr_token = strtok(res_to_split, ":");
- ptr_token = strtok(NULL, ":");
- ptr_token = strtok(ptr_token, ",");
- String final_result = ptr_token;
- final_result.trim();
- return final_result;
- }else{
- return String(NULL);
- }
-}
-
-String GSM3ShieldV1ScanNetworks::readNetworks()
-{
- String modemResponse = modem.writeModemCommand("AT+COPS=?",20000);
- String result;
- bool inQuotes=false;
- int quoteCounter=0;
- for(unsigned int i=0; i ";
- }
- else
- {
- inQuotes=false;
- if(quoteCounter==3)
- quoteCounter=0;
- if(quoteCounter==1)
- result+="\n";
-
- }
- }
- else
- {
- if(inQuotes&&(quoteCounter==1))
- {
- result+=modemResponse[i];
- }
- }
- }
- return result;
-}
-
diff --git a/libraries/GSM/src/GSM3ShieldV1ScanNetworks.h b/libraries/GSM/src/GSM3ShieldV1ScanNetworks.h
deleted file mode 100644
index f43b1642d72..00000000000
--- a/libraries/GSM/src/GSM3ShieldV1ScanNetworks.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
-This file is part of the GSM3 communications library for Arduino
--- Multi-transport communications platform
--- Fully asynchronous
--- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
--- Voice calls
--- SMS
--- TCP/IP connections
--- HTTP basic clients
-
-This library has been developed by Telefónica Digital - PDI -
-- Physical Internet Lab, as part as its collaboration with
-Arduino and the Open Hardware Community.
-
-September-December 2012
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-The latest version of this library can always be found at
-https://github.com/BlueVia/Official-Arduino
-*/
-#ifndef __GSM3SHIELDV1SCANNETWORKS__
-#define __GSM3SHIELDV1SCANNETWORKS__
-
-// This class executes band management functions for the ShieldV1
-#include
-#include
-
-class GSM3ShieldV1ScanNetworks
-{
- private:
- GSM3ShieldV1DirectModemProvider modem;
-
- public:
-
- /** Constructor
- @param trace if true, dumps all AT dialogue to Serial
- @return -
- */
- GSM3ShieldV1ScanNetworks(bool trace=false);
-
- /** begin (forces modem hardware restart, so we begin from scratch)
- @return Always returns IDLE status
- */
- GSM3_NetworkStatus_t begin();
-
- /** Read current carrier
- @return Current carrier
- */
- String getCurrentCarrier();
-
- /** Obtain signal strength
- @return Signal Strength
- */
- String getSignalStrength();
-
- /** Search available carriers
- @return A string with list of networks available
- */
- String readNetworks();
-};
-
-#endif
\ No newline at end of file
diff --git a/libraries/GSM/src/GSM3ShieldV1ServerProvider.cpp b/libraries/GSM/src/GSM3ShieldV1ServerProvider.cpp
deleted file mode 100644
index 61b5c062cd6..00000000000
--- a/libraries/GSM/src/GSM3ShieldV1ServerProvider.cpp
+++ /dev/null
@@ -1,238 +0,0 @@
-/*
-This file is part of the GSM3 communications library for Arduino
--- Multi-transport communications platform
--- Fully asynchronous
--- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
--- Voice calls
--- SMS
--- TCP/IP connections
--- HTTP basic clients
-
-This library has been developed by Telefónica Digital - PDI -
-- Physical Internet Lab, as part as its collaboration with
-Arduino and the Open Hardware Community.
-
-September-December 2012
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-The latest version of this library can always be found at
-https://github.com/BlueVia/Official-Arduino
-*/
-#include
-#include
-#include
-
-GSM3ShieldV1ServerProvider::GSM3ShieldV1ServerProvider()
-{
- theGSM3MobileServerProvider=this;
-};
-
-//Response management.
-void GSM3ShieldV1ServerProvider::manageResponse(byte from, byte to)
-{
- switch(theGSM3ShieldV1ModemCore.getOngoingCommand())
- {
- case NONE:
- theGSM3ShieldV1ModemCore.gss.cb.deleteToTheEnd(from);
- break;
- case CONNECTSERVER:
- connectTCPServerContinue();
- break;
- /*case GETIP:
- getIPContinue();
- break;*/
- }
-}
-
-//Connect Server main function.
-int GSM3ShieldV1ServerProvider::connectTCPServer(int port)
-{
- // We forget about LocalIP as it has no real use, the modem does whatever it likes
- theGSM3ShieldV1ModemCore.setPort(port);
- theGSM3ShieldV1ModemCore.openCommand(this,CONNECTSERVER);
- // From this moment on we wait for a call
- connectTCPServerContinue();
- return theGSM3ShieldV1ModemCore.getCommandError();
-}
-
-//Connect Server continue function.
-void GSM3ShieldV1ServerProvider::connectTCPServerContinue()
-{
-
- bool resp;
- // 1: Read Local IP "AT+QILOCIP"
- // 2: Waiting for IP and Set local port "AT+QILPORT"
- // 3: Waiting for QILPOR OK andConfigure as server "AT+QISERVER"
- // 4: Wait for SERVER OK
-
- switch (theGSM3ShieldV1ModemCore.getCommandCounter()) {
- case 1:
- //"AT+QILOCIP."
- theGSM3ShieldV1ModemCore.genericCommand_rq(PSTR("AT+QILOCIP"));
- theGSM3ShieldV1ModemCore.setCommandCounter(2);
- break;
- case 2:
- //Not IP storing but the command is necessary.
- //if(parseQILOCIP_rsp(local_IP, local_IP_Length, resp))
- // This awful trick saves some RAM bytes
- char aux[3];
- aux[0]='\r';aux[1]='\n';aux[2]=0;
- if(theGSM3ShieldV1ModemCore.genericParse_rsp(resp, aux))
- {
- //Response received
- if(resp)
- {
- // Great. Go for the next step
- // AT+QILPORT
- theGSM3ShieldV1ModemCore.genericCommand_rq(PSTR("AT+QILPORT=\"TCP\","),false);
- theGSM3ShieldV1ModemCore.print( theGSM3ShieldV1ModemCore.getPort());
- theGSM3ShieldV1ModemCore.print('\r');
- theGSM3ShieldV1ModemCore.setCommandCounter(3);
- }
- else theGSM3ShieldV1ModemCore.closeCommand(3);
- }
- break;
- case 3:
- if(theGSM3ShieldV1ModemCore.genericParse_rsp(resp))
- {
- // Response received
- if(resp)
- {
- // OK received
- // Great. Go for the next step
- // AT+QISERVER
- theGSM3ShieldV1ModemCore.genericCommand_rq(PSTR("AT+QISERVER"),true);
- theGSM3ShieldV1ModemCore.setCommandCounter(4);
- }
- else theGSM3ShieldV1ModemCore.closeCommand(3);
- }
- break;
- case 4:
- if(theGSM3ShieldV1ModemCore.genericParse_rsp(resp))
- {
- // Response received
- // OK received, kathapoon, chessespoon
- if (resp)
- {
- theGSM3ShieldV1ModemCore.registerUMProvider(this);
- theGSM3ShieldV1ModemCore.closeCommand(1);
- }
- else
- theGSM3ShieldV1ModemCore.closeCommand(3);
- }
- break;
- }
-}
-
-//QILOCIP parse.
-/*bool GSM3ShieldV1ServerProvider::parseQILOCIP_rsp(char* LocalIP, int LocalIPlength, bool& rsp)
-{
- if (!(theGSM3ShieldV1ModemCore.theBuffer().extractSubstring("\r\n","\r\n", LocalIP, LocalIPlength)))
- rsp = false;
- else
- rsp = true;
- return true;
-}
-
-//Get IP main function.
-int GSM3ShieldV1ServerProvider::getIP(char* LocalIP, int LocalIPlength)
-{
- theGSM3ShieldV1ModemCore.setPhoneNumber(LocalIP);
- theGSM3ShieldV1ModemCore.setPort(LocalIPlength);
- theGSM3ShieldV1ModemCore.openCommand(this,GETIP);
- getIPContinue();
- return theGSM3ShieldV1ModemCore.getCommandError();
-}
-
-void GSM3ShieldV1ServerProvider::getIPContinue()
-{
-
- bool resp;
- // 1: Read Local IP "AT+QILOCIP"
- // 2: Waiting for IP.
-
- switch (theGSM3ShieldV1ModemCore.getCommandCounter()) {
- case 1:
- //AT+QILOCIP
- theGSM3ShieldV1ModemCore.genericCommand_rq(_command_MonoQILOCIP);
- theGSM3ShieldV1ModemCore.setCommandCounter(2);
- break;
- case 2:
- if(parseQILOCIP_rsp(theGSM3ShieldV1ModemCore.getPhoneNumber(), theGSM3ShieldV1ModemCore.getPort(), resp))
- {
- if (resp)
- theGSM3ShieldV1ModemCore.closeCommand(1);
- else
- theGSM3ShieldV1ModemCore.closeCommand(3);
- }
- theGSM3ShieldV1ModemCore.theBuffer().flush();
- theGSM3ShieldV1ModemCore.gss.spaceAvailable();
- break;
- }
-}*/
-
-bool GSM3ShieldV1ServerProvider::getSocketAsServerModemStatus(int s)
-{
- if(theGSM3ShieldV1ModemCore.getStatus()==TRANSPARENT_CONNECTED)
- return true;
- else
- return false;
-}
-
-
-//URC recognize.
-bool GSM3ShieldV1ServerProvider::recognizeUnsolicitedEvent(byte oldTail)
-{
-
- int nlength;
- char auxLocate [15];
-
- //REMOTE SOCKET CLOSED.
- prepareAuxLocate(PSTR("CLOSED\r\n"), auxLocate);
- if(theGSM3ShieldV1ModemCore.gss.cb.locate(auxLocate))
- {
- //To detect remote socket closed for example inside socket data.
- theGSM3ShieldV1ModemCore.setStatus(GPRS_READY);
- }
-
-
- //REMOTE SOCKET ACCEPTED.
- prepareAuxLocate(PSTR("CONNECT\r\n"), auxLocate);
- if(theGSM3ShieldV1ModemCore.gss.cb.locate(auxLocate))
- {
- //To detect remote socket closed for example inside socket data.
- theGSM3ShieldV1ModemCore.theBuffer().chopUntil(auxLocate, true);
- theGSM3ShieldV1ModemCore.gss.spaceAvailable();
- theGSM3ShieldV1ModemCore.setStatus(TRANSPARENT_CONNECTED);
- return true;
- }
-
- return false;
-}
-
-bool GSM3ShieldV1ServerProvider::getStatusSocketAsServer(uint8_t socket)
-{
- return(theGSM3ShieldV1ModemCore.getStatus()==TRANSPARENT_CONNECTED);
-};
-
-void GSM3ShieldV1ServerProvider::releaseSocket(int socket)
-{
-}
-
-int GSM3ShieldV1ServerProvider::getNewOccupiedSocketAsServer()
-{
- return 0;
-}
diff --git a/libraries/GSM/src/GSM3ShieldV1ServerProvider.h b/libraries/GSM/src/GSM3ShieldV1ServerProvider.h
deleted file mode 100644
index 93fcd89a562..00000000000
--- a/libraries/GSM/src/GSM3ShieldV1ServerProvider.h
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
-This file is part of the GSM3 communications library for Arduino
--- Multi-transport communications platform
--- Fully asynchronous
--- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
--- Voice calls
--- SMS
--- TCP/IP connections
--- HTTP basic clients
-
-This library has been developed by Telefónica Digital - PDI -
-- Physical Internet Lab, as part as its collaboration with
-Arduino and the Open Hardware Community.
-
-September-December 2012
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-The latest version of this library can always be found at
-https://github.com/BlueVia/Official-Arduino
-*/
-#ifndef __GSM3_SHIELDV1SERVERPROVIDER__
-#define __GSM3_SHIELDV1SERVERPROVIDER__
-
-#include
-#include
-
-class GSM3ShieldV1ServerProvider : public GSM3MobileServerProvider, public GSM3ShieldV1BaseProvider
-{
- private:
-
- /** Continue to connect to server with TCP protocol function
- */
- void connectTCPServerContinue();
-
- /** Continue to get IP address function
- */
- //void getIPContinue();
-
- /** Parse QILOCIP response
- @param LocalIP Buffer for save local IP address
- @param LocalIPlength Buffer size
- @param rsp Returns if expected response exists
- @return true if command executed correctly
- */
- //bool parseQILOCIP_rsp(char* LocalIP, int LocalIPlength, bool& rsp);
-
- /** Release socket
- @param socket Socket
- */
- void releaseSocket(int socket);
-
- public:
-
- /** Constructor */
- GSM3ShieldV1ServerProvider();
-
- /** minSocketAsServer
- @return 0
- */
- int minSocketAsServer(){return 0;};
-
- /** maxSocketAsServer
- @return 0
- */
- int maxSocketAsServer(){return 0;};
-
- /** Get modem status
- @param s Socket
- @return modem status (true if connected)
- */
- bool getSocketAsServerModemStatus(int s);
-
- /** Get new occupied socket as server
- @return return -1 if no new socket has been occupied
- */
- int getNewOccupiedSocketAsServer();
-
- /** Connect server to TCP port
- @param port TCP port
- @return command error if exists
- */
- int connectTCPServer(int port);
-
- //int getIP(char* LocalIP, int LocalIPlength);
-// int disconnectTCP(bool client1Server0, int id_socket);
-
- /** Get last command status
- @return returns 0 if last command is still executing, 1 success, >1 error
- */
- int ready(){return GSM3ShieldV1BaseProvider::ready();};
-
- /** Get socket status as server
- @param socket Socket to get status
- @return socket status
- */
- bool getStatusSocketAsServer(uint8_t socket);
-
- /** Manages modem response
- @param from Initial byte of buffer
- @param to Final byte of buffer
- */
- void manageResponse(byte from, byte to);
-
- /** Recognize unsolicited event
- @param oldTail
- @return true if successful
- */
- bool recognizeUnsolicitedEvent(byte oldTail);
-
-
-};
-
-#endif
diff --git a/libraries/GSM/src/GSM3ShieldV1VoiceProvider.cpp b/libraries/GSM/src/GSM3ShieldV1VoiceProvider.cpp
deleted file mode 100644
index e30f9390c58..00000000000
--- a/libraries/GSM/src/GSM3ShieldV1VoiceProvider.cpp
+++ /dev/null
@@ -1,248 +0,0 @@
-/*
-This file is part of the GSM3 communications library for Arduino
--- Multi-transport communications platform
--- Fully asynchronous
--- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
--- Voice calls
--- SMS
--- TCP/IP connections
--- HTTP basic clients
-
-This library has been developed by Telefónica Digital - PDI -
-- Physical Internet Lab, as part as its collaboration with
-Arduino and the Open Hardware Community.
-
-September-December 2012
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-The latest version of this library can always be found at
-https://github.com/BlueVia/Official-Arduino
-*/
-#include
-#include
-
-GSM3ShieldV1VoiceProvider::GSM3ShieldV1VoiceProvider()
- {
- phonelength=0;
- theGSM3MobileVoiceProvider=this;
- }
-
- void GSM3ShieldV1VoiceProvider::initialize()
- {
- theGSM3ShieldV1ModemCore.registerUMProvider(this);
- }
-
-//Voice Call main function.
-int GSM3ShieldV1VoiceProvider::voiceCall(const char* to)
-{
- theGSM3ShieldV1ModemCore.genericCommand_rq(PSTR("ATD"),false);
- theGSM3ShieldV1ModemCore.print(to);
- theGSM3ShieldV1ModemCore.print(";\r");
- setvoiceCallStatus(CALLING);
- return 1;
-}
-
-//Retrieve calling number main function.
-int GSM3ShieldV1VoiceProvider::retrieveCallingNumber (char* buffer, int bufsize)
-{
- theGSM3ShieldV1ModemCore.setPhoneNumber(buffer);
- phonelength = bufsize;
- theGSM3ShieldV1ModemCore.setCommandError(0);
- theGSM3ShieldV1ModemCore.setCommandCounter(1);
- theGSM3ShieldV1ModemCore.openCommand(this,RETRIEVECALLINGNUMBER);
- retrieveCallingNumberContinue();
- return theGSM3ShieldV1ModemCore.getCommandError();
-}
-
-//Retrieve calling number Continue function.
-void GSM3ShieldV1VoiceProvider::retrieveCallingNumberContinue()
-{
- // 1: AT+CLCC
- // 2: Receive +CLCC: 1,1,4,0,0,"num",129,""
- // This implementation really does not care much if the modem aswers trash to CMGL
- bool resp;
- //int msglength_aux;
- switch (theGSM3ShieldV1ModemCore.getCommandCounter()) {
- case 1:
- theGSM3ShieldV1ModemCore.genericCommand_rq(PSTR("AT+CLCC"));
- theGSM3ShieldV1ModemCore.setCommandCounter(2);
- break;
- case 2:
- if(parseCLCC(theGSM3ShieldV1ModemCore.getPhoneNumber(), phonelength))
- {
- theGSM3ShieldV1ModemCore.closeCommand(1);
- }
- break;
- }
-}
-
-//CLCC parse.
-bool GSM3ShieldV1VoiceProvider::parseCLCC(char* number, int nlength)
-{
- theGSM3ShieldV1ModemCore.theBuffer().extractSubstring("+CLCC: 1,1,4,0,0,\"","\"", number, nlength);
- theGSM3ShieldV1ModemCore.theBuffer().flush();
- return true;
-}
-
-//Answer Call main function.
-int GSM3ShieldV1VoiceProvider::answerCall()
-{
- theGSM3ShieldV1ModemCore.setCommandError(0);
- theGSM3ShieldV1ModemCore.setCommandCounter(1);
- theGSM3ShieldV1ModemCore.openCommand(this,ANSWERCALL);
- answerCallContinue();
- return theGSM3ShieldV1ModemCore.getCommandError();
-}
-
-//Answer Call continue function.
-void GSM3ShieldV1VoiceProvider::answerCallContinue()
-{
- // 1: ATA
- // 2: Waiting for OK
-
- // This implementation really does not care much if the modem aswers trash to CMGL
- bool resp;
- switch (theGSM3ShieldV1ModemCore.getCommandCounter()) {
- case 1:
- // ATA ;
- theGSM3ShieldV1ModemCore.genericCommand_rq(PSTR("ATA"));
- theGSM3ShieldV1ModemCore.setCommandCounter(2);
- break;
- case 2:
- if(theGSM3ShieldV1ModemCore.genericParse_rsp(resp))
- {
- setvoiceCallStatus(TALKING);
- if (resp) theGSM3ShieldV1ModemCore.closeCommand(1);
- else theGSM3ShieldV1ModemCore.closeCommand(3);
- }
- break;
- }
-}
-
-//Hang Call main function.
-int GSM3ShieldV1VoiceProvider::hangCall()
-{
- theGSM3ShieldV1ModemCore.setCommandError(0);
- theGSM3ShieldV1ModemCore.setCommandCounter(1);
- theGSM3ShieldV1ModemCore.openCommand(this,HANGCALL);
- hangCallContinue();
- return theGSM3ShieldV1ModemCore.getCommandError();
-}
-
-//Hang Call continue function.
-void GSM3ShieldV1VoiceProvider::hangCallContinue()
-{
- // 1: ATH
- // 2: Waiting for OK
-
- bool resp;
- switch (theGSM3ShieldV1ModemCore.getCommandCounter()) {
- case 1:
- //ATH
- theGSM3ShieldV1ModemCore.genericCommand_rq(PSTR("ATH"));
- theGSM3ShieldV1ModemCore.setCommandCounter(2);
- break;
- case 2:
- if(theGSM3ShieldV1ModemCore.genericParse_rsp(resp))
- {
- setvoiceCallStatus(IDLE_CALL);
- if (resp) theGSM3ShieldV1ModemCore.closeCommand(1);
- else theGSM3ShieldV1ModemCore.closeCommand(3);
- }
- break;
- }
-}
-
-//Response management.
-void GSM3ShieldV1VoiceProvider::manageResponse(byte from, byte to)
-{
- switch(theGSM3ShieldV1ModemCore.getOngoingCommand())
- {
- case ANSWERCALL:
- answerCallContinue();
- break;
- case HANGCALL:
- hangCallContinue();
- break;
- case RETRIEVECALLINGNUMBER:
- retrieveCallingNumberContinue();
- break;
-
- }
-}
-
-//URC recognize.
-bool GSM3ShieldV1VoiceProvider::recognizeUnsolicitedEvent(byte oldTail)
-{
-
- int nlength;
- char auxLocate [15];
- //RING.
- prepareAuxLocate(PSTR("RING"), auxLocate);
- if(theGSM3ShieldV1ModemCore.theBuffer().locate(auxLocate))
- {
- // RING
- setvoiceCallStatus(RECEIVINGCALL);
- theGSM3ShieldV1ModemCore.theBuffer().flush();
- return true;
- }
-
- //CALL ACEPTED.
- prepareAuxLocate(PSTR("+COLP:"), auxLocate);
- if(theGSM3ShieldV1ModemCore.theBuffer().locate(auxLocate))
- {
- //DEBUG
- //Serial.println("Call Accepted.");
- setvoiceCallStatus(TALKING);
- theGSM3ShieldV1ModemCore.theBuffer().flush();
- return true;
- }
-
- //NO CARRIER.
- prepareAuxLocate(PSTR("NO CARRIER"), auxLocate);
- if(theGSM3ShieldV1ModemCore.theBuffer().locate(auxLocate))
- {
- //DEBUG
- //Serial.println("NO CARRIER received.");
- setvoiceCallStatus(IDLE_CALL);
- theGSM3ShieldV1ModemCore.theBuffer().flush();
- return true;
- }
-
- //BUSY.
- prepareAuxLocate(PSTR("BUSY"), auxLocate);
- if(theGSM3ShieldV1ModemCore.theBuffer().locate(auxLocate))
- {
- //DEBUG
- //Serial.println("BUSY received.");
- setvoiceCallStatus(IDLE_CALL);
- theGSM3ShieldV1ModemCore.theBuffer().flush();
- return true;
- }
-
- //CALL RECEPTION.
- prepareAuxLocate(PSTR("+CLIP:"), auxLocate);
- if(theGSM3ShieldV1ModemCore.theBuffer().locate(auxLocate))
- {
- theGSM3ShieldV1ModemCore.theBuffer().flush();
- setvoiceCallStatus(RECEIVINGCALL);
- return true;
- }
-
- return false;
-}
-
-
diff --git a/libraries/GSM/src/GSM3ShieldV1VoiceProvider.h b/libraries/GSM/src/GSM3ShieldV1VoiceProvider.h
deleted file mode 100644
index b96138533c5..00000000000
--- a/libraries/GSM/src/GSM3ShieldV1VoiceProvider.h
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
-This file is part of the GSM3 communications library for Arduino
--- Multi-transport communications platform
--- Fully asynchronous
--- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
--- Voice calls
--- SMS
--- TCP/IP connections
--- HTTP basic clients
-
-This library has been developed by Telefónica Digital - PDI -
-- Physical Internet Lab, as part as its collaboration with
-Arduino and the Open Hardware Community.
-
-September-December 2012
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-The latest version of this library can always be found at
-https://github.com/BlueVia/Official-Arduino
-*/
-
-#ifndef _GSM3SHIELDV1VOICEPROVIDER_
-#define _GSM3SHIELDV1VOICEPROVIDER_
-
-#include
-#include
-#include
-
-class GSM3ShieldV1VoiceProvider : public GSM3MobileVoiceProvider, public GSM3ShieldV1BaseProvider
-{
- public:
-
- /** Constructor */
- GSM3ShieldV1VoiceProvider();
-
- /** initilizer, links with modem provider */
- void initialize();
-
-
- /** Manages modem response
- @param from Initial byte of buffer
- @param to Final byte of buffer
- */
- void manageResponse(byte from, byte to);
-
- //Call functions.
-
- /** Launch a voice call
- @param number Phone number to be called
- @return If asynchronous, returns 0. If synchronous, 1 if success, other if error
- */
- int voiceCall(const char* number);
-
- /** Answer a voice call
- @return If asynchronous, returns 0. If synchronous, 1 if success, other if error
- */
- int answerCall();
-
- /** Hang a voice call
- @return If asynchronous, returns 0. If synchronous, 1 if success, other if error
- */
- int hangCall();
-
- /** Retrieve phone number of caller
- @param buffer Buffer for copy phone number
- @param bufsize Buffer size
- @return If asynchronous, returns 0. If synchronous, 1 if success, other if error
- */
- int retrieveCallingNumber(char* buffer, int bufsize);
-
- /** Get last command status
- @return Returns 0 if last command is still executing, 1 success, >1 error
- */
- int ready(){return GSM3ShieldV1BaseProvider::ready();};
-
- /** Recognize URC
- @param oldTail
- @return true if successful
- */
- bool recognizeUnsolicitedEvent(byte oldTail);
-
- /** Returns voice call status
- @return voice call status
- */
- GSM3_voiceCall_st getvoiceCallStatus(){ready(); return _voiceCallstatus;};
-
- /** Set voice call status
- @param status New status for voice call
- */
- void setvoiceCallStatus(GSM3_voiceCall_st status) { _voiceCallstatus = status; };
-
-
- private:
-
- int phonelength; // Phone number length
-
- GSM3_voiceCall_st _voiceCallstatus; // The voiceCall status
-
- /** Continue to voice call function
- */
- void voiceCallContinue();
-
- /** Continue to answer call function
- */
- void answerCallContinue();
-
- /** Continue to hang call function
- */
- void hangCallContinue();
-
- /** Continue to retrieve calling number function
- */
- void retrieveCallingNumberContinue();
-
- /** Parse CLCC response from buffer
- @param number Number initial for extract substring of response
- @param nlength Substring length
- @return true if successful
- */
- bool parseCLCC(char* number, int nlength);
-
-};
-
-#endif
diff --git a/libraries/GSM/src/GSM3SoftSerial.cpp b/libraries/GSM/src/GSM3SoftSerial.cpp
deleted file mode 100644
index ef87060cad8..00000000000
--- a/libraries/GSM/src/GSM3SoftSerial.cpp
+++ /dev/null
@@ -1,524 +0,0 @@
-/*
-This file is part of the GSM3 communications library for Arduino
--- Multi-transport communications platform
--- Fully asynchronous
--- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
--- Voice calls
--- SMS
--- TCP/IP connections
--- HTTP basic clients
-
-This library has been developed by Telefónica Digital - PDI -
-- Physical Internet Lab, as part as its collaboration with
-Arduino and the Open Hardware Community.
-
-September-December 2012
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-The latest version of this library can always be found at
-https://github.com/BlueVia/Official-Arduino
-*/
-#include "GSM3SoftSerial.h"
-#include "GSM3IO.h"
-#include
-#include
-#include "pins_arduino.h"
-#include
-#include
-
-#define __XON__ 0x11
-#define __XOFF__ 0x13
-
-#define _GSMSOFTSERIALFLAGS_ESCAPED_ 0x01
-#define _GSMSOFTSERIALFLAGS_SENTXOFF_ 0x02
-
-//
-// Lookup table
-//
-#define __PARAGRAPHGUARD__ 50
-typedef struct _DELAY_TABLE
-{
- long baud;
- unsigned short rx_delay_centering;
- unsigned short rx_delay_intrabit;
- unsigned short rx_delay_stopbit;
- unsigned short tx_delay;
-} DELAY_TABLE;
-
-#if F_CPU == 16000000
-
-static const DELAY_TABLE PROGMEM table[] =
-{
- // baud rxcenter rxintra rxstop tx
- { 115200, 1, 17, 17, 12, },
- { 57600, 10, 37, 37, 33, },
- { 38400, 25, 57, 57, 54, },
- { 31250, 31, 70, 70, 68, },
- { 28800, 34, 77, 77, 74, },
- { 19200, 54, 117, 117, 114, },
- { 14400, 74, 156, 156, 153, },
- { 9600, 114, 236, 236, 233, },
- { 4800, 233, 474, 474, 471, },
- { 2400, 471, 950, 950, 947, },
- { 1200, 947, 1902, 1902, 1899, },
- { 300, 3804, 7617, 7617, 7614, },
-};
-
-const int XMIT_START_ADJUSTMENT = 5;
-
-#elif F_CPU == 8000000
-
-static const DELAY_TABLE table[] PROGMEM =
-{
- // baud rxcenter rxintra rxstop tx
- { 115200, 1, 5, 5, 3, },
- { 57600, 1, 15, 15, 13, },
- { 38400, 2, 25, 26, 23, },
- { 31250, 7, 32, 33, 29, },
- { 28800, 11, 35, 35, 32, },
- { 19200, 20, 55, 55, 52, },
- { 14400, 30, 75, 75, 72, },
- { 9600, 50, 114, 114, 112, },
- { 4800, 110, 233, 233, 230, },
- { 2400, 229, 472, 472, 469, },
- { 1200, 467, 948, 948, 945, },
- { 300, 1895, 3805, 3805, 3802, },
-};
-
-const int XMIT_START_ADJUSTMENT = 4;
-
-#elif F_CPU == 20000000
-
-// 20MHz support courtesy of the good people at macegr.com.
-// Thanks, Garrett!
-
-static const DELAY_TABLE PROGMEM table[] =
-{
- // baud rxcenter rxintra rxstop tx
- { 115200, 3, 21, 21, 18, },
- { 57600, 20, 43, 43, 41, },
- { 38400, 37, 73, 73, 70, },
- { 31250, 45, 89, 89, 88, },
- { 28800, 46, 98, 98, 95, },
- { 19200, 71, 148, 148, 145, },
- { 14400, 96, 197, 197, 194, },
- { 9600, 146, 297, 297, 294, },
- { 4800, 296, 595, 595, 592, },
- { 2400, 592, 1189, 1189, 1186, },
- { 1200, 1187, 2379, 2379, 2376, },
- { 300, 4759, 9523, 9523, 9520, },
-};
-
-const int XMIT_START_ADJUSTMENT = 6;
-
-#else
-
-#error This version of GSM3SoftSerial supports only 20, 16 and 8MHz processors
-
-#endif
-
-GSM3SoftSerial* GSM3SoftSerial::_activeObject=0;
-
-GSM3SoftSerial::GSM3SoftSerial():
- _rx_delay_centering(0),
- _rx_delay_intrabit(0),
- _rx_delay_stopbit(0),
- _tx_delay(0),
- cb(this)
-{
- setTX();
- setRX();
- //comStatus=0;
- //waitingAnswer=false;
-}
-
-int GSM3SoftSerial::begin(long speed)
-{
- _rx_delay_centering = _rx_delay_intrabit = _rx_delay_stopbit = _tx_delay = 0;
-
- for (unsigned i=0; ifinalWrite(0x77);
- return this->finalWrite(0xEE);
- }
-
- if(c==0x13)
- {
- this->finalWrite(0x77);
- return this->finalWrite(0xEC);
- }
-
- if(c==0x77)
- {
- this->finalWrite(0x77);
- return this->finalWrite(0x88);
- }
-
- return this->finalWrite(c);
-}
-
-size_t GSM3SoftSerial::finalWrite(uint8_t c)
-{
-
- uint8_t oldSREG = SREG;
- cli(); // turn off interrupts for a clean txmit
-
- // Write the start bit
- tx_pin_write(LOW);
- tunedDelay(_tx_delay + XMIT_START_ADJUSTMENT);
-
- // Write each of the 8 bits
- for (byte mask = 0x01; mask; mask <<= 1)
- {
- if (c & mask) // choose bit
- tx_pin_write(HIGH); // send 1
- else
- tx_pin_write(LOW); // send 0
- tunedDelay(_tx_delay);
- }
-
- tx_pin_write(HIGH); // restore pin to natural state
-
- SREG = oldSREG; // turn interrupts back on
- tunedDelay(_tx_delay);
-
- return 1;
-}
-
-/*inline*/ void GSM3SoftSerial::tunedDelay(uint16_t delay) {
- uint8_t tmp=0;
-
- asm volatile("sbiw %0, 0x01 \n\t"
- "ldi %1, 0xFF \n\t"
- "cpi %A0, 0xFF \n\t"
- "cpc %B0, %1 \n\t"
- "brne .-10 \n\t"
- : "+r" (delay), "+a" (tmp)
- : "0" (delay)
- );
-}
-
-void GSM3SoftSerial::tx_pin_write(uint8_t pin_state)
-{
- // Direct port manipulation is faster than digitalWrite/Read
- if (pin_state == LOW)
- *_transmitPortRegister &= ~_transmitBitMask;
- else
- *_transmitPortRegister |= _transmitBitMask;
-}
-
-void GSM3SoftSerial::setTX()
-{
- pinMode(__TXPIN__, OUTPUT);
- digitalWrite(__TXPIN__, HIGH);
- // For digital port direct manipulation
- _transmitBitMask = digitalPinToBitMask(__TXPIN__);
- uint8_t port = digitalPinToPort(__TXPIN__);
- _transmitPortRegister = portOutputRegister(port);
-}
-
-void GSM3SoftSerial::setRX()
-{
- pinMode(__RXPIN__, INPUT);
- digitalWrite(__RXPIN__, HIGH); // pullup for normal logic!
- // For digital port direct manipulation
- _receiveBitMask = digitalPinToBitMask(__RXPIN__);
- uint8_t port = digitalPinToPort(__RXPIN__);
- _receivePortRegister = portInputRegister(port);
-
-#ifdef __AVR_ATmega32U4__
-//#define __RXINT__ 1
- attachInterrupt(__RXINT__, GSM3SoftSerial::handle_interrupt, FALLING);
-#endif
- // This line comes from the High Middle Ages...
- // attachInterrupt(__RXINT__, GSM3SoftSerial::handle_interrupt, FALLING);
-}
-
-void GSM3SoftSerial::handle_interrupt()
-{
- if(_activeObject)
- _activeObject->recv();
-}
-
-uint8_t GSM3SoftSerial::rx_pin_read()
-{
- // Digital port manipulation
- return *_receivePortRegister & _receiveBitMask;
-}
-
-void GSM3SoftSerial::recv()
-{
-
-#if GCC_VERSION < 40302
-// Work-around for avr-gcc 4.3.0 OSX version bug
-// Preserve the registers that the compiler misses
-// (courtesy of Arduino forum user *etracer*)
- asm volatile(
- "push r18 \n\t"
- "push r19 \n\t"
- "push r20 \n\t"
- "push r21 \n\t"
- "push r22 \n\t"
- "push r23 \n\t"
- "push r26 \n\t"
- "push r27 \n\t"
- ::);
-#endif
-
- bool firstByte=true;
- byte thisHead;
-
- uint8_t d = 0;
- bool morebytes=false;
- //bool fullbuffer=(cb.availableBytes()<3);
- bool fullbuffer;
- bool capturado_fullbuffer = 0;
- int i;
- byte oldTail;
-
- // If RX line is high, then we don't see any start bit
- // so interrupt is probably not for us
- if (!rx_pin_read())
- {
- do
- {
- oldTail=cb.getTail();
- // Wait approximately 1/2 of a bit width to "center" the sample
- tunedDelay(_rx_delay_centering);
-
- fullbuffer=(cb.availableBytes()<6);
-
-
- if(fullbuffer&&(!capturado_fullbuffer))
- tx_pin_write(LOW);
-
-
- // Read each of the 8 bits
- for (uint8_t i=0x1; i; i <<= 1)
- {
- tunedDelay(_rx_delay_intrabit);
- uint8_t noti = ~i;
- if (rx_pin_read())
- d |= i;
- else // else clause added to ensure function timing is ~balanced
- d &= noti;
-
- if(fullbuffer&&(!capturado_fullbuffer))
- {
- if((uint8_t)__XOFF__ & i)
- tx_pin_write(HIGH);
- else
- tx_pin_write(LOW);
- }
- }
-
- if(fullbuffer&&(!capturado_fullbuffer))
- {
- tunedDelay(_rx_delay_intrabit);
- tx_pin_write(HIGH);
- }
-
- // So, we know the buffer is full, and we have sent a XOFF
- if (fullbuffer)
- {
- capturado_fullbuffer =1;
- _flags |=_GSMSOFTSERIALFLAGS_SENTXOFF_;
- }
-
-
- // skip the stop bit
- if (!fullbuffer) tunedDelay(_rx_delay_stopbit);
-
- if(keepThisChar(&d))
- {
- cb.write(d);
- if(firstByte)
- {
- firstByte=false;
- thisHead=cb.getTail();
- }
- }
-
-
- // This part is new. It is used to detect the end of a "paragraph"
- // Caveat: the old fashion would let processor a bit of time between bytes,
- // that here is lost
- // This active waiting avoids drifting
- morebytes=false;
- // TO-DO. This PARAGRAPHGUARD is empyric. We should test it for every speed
- for(i=0;i<__PARAGRAPHGUARD__;i++)
- {
- tunedDelay(1);
- if(!rx_pin_read())
- {
- morebytes=true;
- break;
- }
- }
- }while(morebytes);
- // If we find a line feed, we are at the end of a paragraph
- // check!
-
- if (fullbuffer)
- {
- // And... go handle it!
- if(mgr)
- mgr->manageMsg(thisHead, cb.getTail());
- }
- else if(d==10)
- {
- // And... go handle it!
- if(mgr)
- mgr->manageMsg(thisHead, cb.getTail());
- }
- else if (d==32)
- {
- // And... go handle it!
- if(mgr)
- mgr->manageMsg(thisHead, cb.getTail());
- }
- }
-
-#if GCC_VERSION < 40302
-// Work-around for avr-gcc 4.3.0 OSX version bug
-// Restore the registers that the compiler misses
- asm volatile(
- "pop r27 \n\t"
- "pop r26 \n\t"
- "pop r23 \n\t"
- "pop r22 \n\t"
- "pop r21 \n\t"
- "pop r20 \n\t"
- "pop r19 \n\t"
- "pop r18 \n\t"
- ::);
-#endif
-}
-
-bool GSM3SoftSerial::keepThisChar(uint8_t* c)
-{
- // Horrible things for Quectel XON/XOFF
- // 255 is the answer to a XOFF
- // It comes just once
- if((*c==255)&&(_flags & _GSMSOFTSERIALFLAGS_SENTXOFF_))
- {
- _flags ^= _GSMSOFTSERIALFLAGS_SENTXOFF_;
- return false;
- }
-
- // 0x77, w, is the escape character
- if(*c==0x77)
- {
- _flags |= _GSMSOFTSERIALFLAGS_ESCAPED_;
- return false;
- }
-
- // and these are the escaped codes
- if(_flags & _GSMSOFTSERIALFLAGS_ESCAPED_)
- {
- if(*c==0xEE)
- *c=0x11;
- else if(*c==0xEC)
- *c=0x13;
- else if(*c==0x88)
- *c=0x77;
-
- _flags ^= _GSMSOFTSERIALFLAGS_ESCAPED_;
- return true;
- }
-
- return true;
-}
-
-void GSM3SoftSerial::spaceAvailable()
-{
- // If there is spaceAvailable in the buffer, lets send a XON
- finalWrite((byte)__XON__);
-}
-
-
-// This is here to avoid problems with Arduino compiler
-void GSM3SoftSerialMgr::manageMsg(byte from, byte to){};
-
-//#define PCINT1_vect _VECTOR(2)
-//#undef PCINT1_vect
-
-#if defined(PCINT0_vect)
-ISR(PCINT0_vect)
-{
- GSM3SoftSerial::handle_interrupt();
-}
-#endif
-
-#if defined(PCINT1_vect)
-ISR(PCINT1_vect)
-{
- GSM3SoftSerial::handle_interrupt();
-}
-#endif
-
-#if defined(PCINT2_vect)
-ISR(PCINT2_vect)
-{
- GSM3SoftSerial::handle_interrupt();
-}
-#endif
-
-#if defined(PCINT3_vect)
-ISR(PCINT3_vect)
-{
- GSM3SoftSerial::handle_interrupt();
-}
-#endif
-
diff --git a/libraries/GSM/src/GSM3SoftSerial.h b/libraries/GSM/src/GSM3SoftSerial.h
deleted file mode 100644
index c35ef684894..00000000000
--- a/libraries/GSM/src/GSM3SoftSerial.h
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
-This file is part of the GSM3 communications library for Arduino
--- Multi-transport communications platform
--- Fully asynchronous
--- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
--- Voice calls
--- SMS
--- TCP/IP connections
--- HTTP basic clients
-
-This library has been developed by Telefónica Digital - PDI -
-- Physical Internet Lab, as part as its collaboration with
-Arduino and the Open Hardware Community.
-
-September-December 2012
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-The latest version of this library can always be found at
-https://github.com/BlueVia/Official-Arduino
-*/
-#ifndef __GSM3_SOFTSERIAL__
-#define __GSM3_SOFTSERIAL__
-
-// An adaptation of NewSoftSerial for Modem Shields
-// Assumes directly that Serial is attached to Pins 2 and 3, not inverse
-// We are implementing it because NewSoftSerial does not deal correctly with floods
-// of data
-#include "GSM3CircularBuffer.h"
-#include
-
-/*
-#define _COMSTATUS_ANSWERRECEIVED_ 0x100
-#define _COMSTATUS_SMSRECEIVED_ 0x80
-#define _COMSTATUS_CALLRECEIVED_ 0x40
-
-// PLEASE, when accessing the sockets use "for" and >> (bitwise operator)
-#define _COMSTATUS_SOCKET6RECEIVED_ 0x20
-#define _COMSTATUS_SOCKET5RECEIVED_ 0x10
-#define _COMSTATUS_SOCKET4RECEIVED_ 0x08
-#define _COMSTATUS_SOCKET3RECEIVED_ 0x04
-#define _COMSTATUS_SOCKET2RECEIVED_ 0x02
-#define _COMSTATUS_SOCKET1RECEIVED_ 0x01
-
-#define __CALLTABLEMASK__ 0x3
-*/
-
-class GSM3SoftSerialMgr
-{
- public:
-
- /** Manages soft serial message
- @param from Initial byte
- @param to Final byte
- */
- virtual void manageMsg(byte from, byte to);
-};
-
-// This class manages software serial communications
-// Changing it so it doesn't know about modems or whatever
-
-class GSM3SoftSerial : public GSM3CircularBufferManager
-{
- private:
-
- uint8_t _receiveBitMask;
- volatile uint8_t *_receivePortRegister;
- uint8_t _transmitBitMask;
- volatile uint8_t *_transmitPortRegister;
-
- static GSM3SoftSerial* _activeObject;
- GSM3SoftSerialMgr* mgr;
-
- uint16_t _rx_delay_centering;
- uint16_t _rx_delay_intrabit;
- uint16_t _rx_delay_stopbit;
- uint16_t _tx_delay;
- uint8_t _flags;
-
- /** Write in tx_pin
- @param pin_state Pin state
- */
- void tx_pin_write(uint8_t pin_state);
-
- /** Set transmission
- */
- void setTX();
-
- /** Set receiver
- */
- void setRX();
-
- /** Receive
- */
- void recv();
-
- /** Read from rx_pin
- @return receive bit mask
- */
- uint8_t rx_pin_read();
-
- void setComsReceived();
-
- /** Write a character in serial connection, final action after escaping
- @param c Character
- @return 1 if succesful, 0 if transmission delay = 0
- */
- virtual size_t finalWrite(uint8_t);
-
- /** Decide, attending to escapes, if the received character should we
- kept, forgotten, or changed
- @param c Character, may be changed
- @return 1 if shall be kept, 0 if forgotten
- */
- bool keepThisChar(uint8_t* c);
-
- // Checks the buffer for well-known events.
- //bool recognizeUnsolicitedEvent(byte oldTail);
-
- public:
-
- /** Tuned delay in microcontroller
- @param delay Time to delay
- */
- static /*inline */void tunedDelay(uint16_t delay);
-
- GSM3CircularBuffer cb; // Circular buffer
-
- /** Register serial manager
- @param manager Serial manager
- */
- inline void registerMgr(GSM3SoftSerialMgr* manager){mgr=manager;};
-
- /** If there is spaceAvailable in the buffer, lets send a XON
- */
- void spaceAvailable();
-
- /** Write a character in serial connection
- @param c Character
- @return 1 if succesful, 0 if transmission delay = 0
- */
- virtual size_t write(uint8_t);
-
- /** Constructor */
- GSM3SoftSerial();
-
- /** Establish serial connection
- @param speed Baudrate
- @return
- */
- int begin(long speed);
-
- /** Manage interruptions
- */
- static inline void handle_interrupt();
-
- /** Close serial connection
- */
- void close();
-};
-
-#endif
\ No newline at end of file
diff --git a/libraries/GSM/src/GSM3VoiceCallService.cpp b/libraries/GSM/src/GSM3VoiceCallService.cpp
deleted file mode 100644
index fefb0f04318..00000000000
--- a/libraries/GSM/src/GSM3VoiceCallService.cpp
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
-This file is part of the GSM3 communications library for Arduino
--- Multi-transport communications platform
--- Fully asynchronous
--- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
--- Voice calls
--- SMS
--- TCP/IP connections
--- HTTP basic clients
-
-This library has been developed by Telefónica Digital - PDI -
-- Physical Internet Lab, as part as its collaboration with
-Arduino and the Open Hardware Community.
-
-September-December 2012
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-The latest version of this library can always be found at
-https://github.com/BlueVia/Official-Arduino
-*/
-#include
-#include
-
-#include
-GSM3ShieldV1VoiceProvider theShieldV1VoiceProvider;
-
-// While there is only a shield (ShieldV1) we will include it by default
-
-#define GSM3VOICECALLSERVICE_SYNCH 0x01 // 1: synchronous 0: asynchronous
-#define __TOUT__ 10000
-
-
-
-
-GSM3VoiceCallService::GSM3VoiceCallService(bool synch)
-{
- if(synch)
- flags |= GSM3VOICECALLSERVICE_SYNCH;
- theGSM3MobileVoiceProvider->initialize();
-}
-
-GSM3_voiceCall_st GSM3VoiceCallService::getvoiceCallStatus()
-{
- if(theGSM3MobileVoiceProvider==0)
- return IDLE_CALL;
-
- return theGSM3MobileVoiceProvider->getvoiceCallStatus();
-}
-
-int GSM3VoiceCallService::ready()
-{
- if(theGSM3MobileVoiceProvider==0)
- return 0;
-
- return theGSM3MobileVoiceProvider->ready();
-}
-
-int GSM3VoiceCallService::voiceCall(const char* to, unsigned long timeout)
-{
- if(theGSM3MobileVoiceProvider==0)
- return 0;
-
- if(flags & GSM3VOICECALLSERVICE_SYNCH )
- {
- theGSM3MobileVoiceProvider->voiceCall(to);
- unsigned long m;
- m=millis();
- // Wait an answer for timeout
- while(((millis()-m)< timeout )&&(getvoiceCallStatus()==CALLING))
- delay(100);
-
- if(getvoiceCallStatus()==TALKING)
- return 1;
- else
- return 0;
- }
- else
- {
- return theGSM3MobileVoiceProvider->voiceCall(to);
- }
-
-}
-
-int GSM3VoiceCallService::answerCall()
-{
- if(theGSM3MobileVoiceProvider==0)
- return 0;
-
- return waitForAnswerIfNeeded(theGSM3MobileVoiceProvider->answerCall());
-}
-
-int GSM3VoiceCallService::hangCall()
-{
- if(theGSM3MobileVoiceProvider==0)
- return 0;
-
- return waitForAnswerIfNeeded(theGSM3MobileVoiceProvider->hangCall());
-}
-
-int GSM3VoiceCallService::retrieveCallingNumber(char* buffer, int bufsize)
-{
- if(theGSM3MobileVoiceProvider==0)
- return 0;
-
- return waitForAnswerIfNeeded(theGSM3MobileVoiceProvider->retrieveCallingNumber(buffer, bufsize));
-}
-
-int GSM3VoiceCallService::waitForAnswerIfNeeded(int returnvalue)
-{
- // If synchronous
- if(flags & GSM3VOICECALLSERVICE_SYNCH )
- {
- unsigned long m;
- m=millis();
- // Wait for __TOUT__
- while(((millis()-m)< __TOUT__ )&&(ready()==0))
- delay(100);
- // If everything was OK, return 1
- // else (timeout or error codes) return 0;
- if(ready()==1)
- return 1;
- else
- return 0;
- }
- // If not synchronous just kick ahead the coming result
- return ready();
-}
-
-
-
-
diff --git a/libraries/GSM/src/GSM3VoiceCallService.h b/libraries/GSM/src/GSM3VoiceCallService.h
deleted file mode 100644
index 089d5797a6e..00000000000
--- a/libraries/GSM/src/GSM3VoiceCallService.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
-This file is part of the GSM3 communications library for Arduino
--- Multi-transport communications platform
--- Fully asynchronous
--- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
--- Voice calls
--- SMS
--- TCP/IP connections
--- HTTP basic clients
-
-This library has been developed by Telefónica Digital - PDI -
-- Physical Internet Lab, as part as its collaboration with
-Arduino and the Open Hardware Community.
-
-September-December 2012
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-The latest version of this library can always be found at
-https://github.com/BlueVia/Official-Arduino
-*/
-#ifndef _GSM3VOICECALLSERVICE_
-#define _GSM3VOICECALLSERVICE_
-
-#include
-#include
-
-class GSM3VoiceCallService
-{
- private:
- uint8_t flags;
-
- /** Make synchronous the functions, if needed
- @param returnvalue Return value
- @return returns 0 if last command is still executing, 1 success, >1 error
- */
- int waitForAnswerIfNeeded(int returnvalue);
-
- public:
- /** Service creation
- @param synch If true, the service calls are synchronois
- */
- GSM3VoiceCallService(bool synch=true);
-
- /** Voice call status
- @return Status of the voice call, as described in GSM3MobileVoiceProvider.h
- { IDLE_CALL, CALLING, RECEIVINGCALL, TALKING};
- */
- GSM3_voiceCall_st getvoiceCallStatus();
-
- /** Get last command status
- @return Returns 0 if last command is still executing, 1 success, >1 error
- */
- int ready();
-
- /** Place a voice call. If asynchronous, returns while ringing. If synchronous
- returns if the call is stablished or cancelled.
- @param to Receiver number. Country extension can be used or not.
- Char buffer should not be released or used until command is over
- @param timeout In millisecods. Time ringing before closing the call.
- Only used in synchronous mode.
- If zero, ring undefinitely
- @return In asynchronous mode returns 0 if last command is still executing, 1 success, >1 error
- In synchronous mode returns 1 if the call is placed, 0 if not.
- */
- int voiceCall(const char* to, unsigned long timeout=30000);
-
- /** Accept an incoming voice call
- @return In asynchronous mode returns 0 if last command is still executing, 1 success, >1 error
- In synchronous mode returns 1 if the call is answered, 0 if not.
- */
- int answerCall();
-
- /** Hang a stablished call or an incoming ring
- @return In asynchronous mode returns 0 if last command is still executing, 1 success, >1 error
- In synchronous mode returns 1 if the call is answered, 0 if not.
- */
- int hangCall();
-
- /** Retrieve the calling number, put it in buffer
- @param buffer pointer to the buffer memory
- @param bufsize size of available memory area, at least should be 10 characters
- @return In asynchronous mode returns 0 if last command is still executing, 1 success, >1 error
- In synchronous mode returns 1 if the number is correcty taken 0 if not
- */
- int retrieveCallingNumber(char* buffer, int bufsize);
-};
-
-
-#endif
\ No newline at end of file
diff --git a/libraries/Stepper/README.adoc b/libraries/Stepper/README.adoc
deleted file mode 100644
index 9d4d0521617..00000000000
--- a/libraries/Stepper/README.adoc
+++ /dev/null
@@ -1,26 +0,0 @@
-= Stepper Library for Arduino =
-
-This library allows you to control unipolar or bipolar stepper motors. To use it you will need a stepper motor, and the appropriate hardware to control it.
-
-For more information about this library please visit us at
-http://www.arduino.cc/en/Reference/Stepper
-
-== License ==
-
-Copyright (c) Arduino LLC. All right reserved.
-Copyright (c) Sebastian Gassner. All right reserved.
-Copyright (c) Noah Shibley. All right reserved.
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
diff --git a/libraries/Stepper/examples/MotorKnob/MotorKnob.ino b/libraries/Stepper/examples/MotorKnob/MotorKnob.ino
deleted file mode 100644
index 5cf12ec850c..00000000000
--- a/libraries/Stepper/examples/MotorKnob/MotorKnob.ino
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * MotorKnob
- *
- * A stepper motor follows the turns of a potentiometer
- * (or other sensor) on analog input 0.
- *
- * http://www.arduino.cc/en/Reference/Stepper
- * This example code is in the public domain.
- */
-
-#include
-
-// change this to the number of steps on your motor
-#define STEPS 100
-
-// create an instance of the stepper class, specifying
-// the number of steps of the motor and the pins it's
-// attached to
-Stepper stepper(STEPS, 8, 9, 10, 11);
-
-// the previous reading from the analog input
-int previous = 0;
-
-void setup() {
- // set the speed of the motor to 30 RPMs
- stepper.setSpeed(30);
-}
-
-void loop() {
- // get the sensor value
- int val = analogRead(0);
-
- // move a number of steps equal to the change in the
- // sensor reading
- stepper.step(val - previous);
-
- // remember the previous value of the sensor
- previous = val;
-}
\ No newline at end of file
diff --git a/libraries/Stepper/examples/stepper_oneRevolution/stepper_oneRevolution.ino b/libraries/Stepper/examples/stepper_oneRevolution/stepper_oneRevolution.ino
deleted file mode 100644
index 373eb602259..00000000000
--- a/libraries/Stepper/examples/stepper_oneRevolution/stepper_oneRevolution.ino
+++ /dev/null
@@ -1,44 +0,0 @@
-
-/*
- Stepper Motor Control - one revolution
-
- This program drives a unipolar or bipolar stepper motor.
- The motor is attached to digital pins 8 - 11 of the Arduino.
-
- The motor should revolve one revolution in one direction, then
- one revolution in the other direction.
-
-
- Created 11 Mar. 2007
- Modified 30 Nov. 2009
- by Tom Igoe
-
- */
-
-#include
-
-const int stepsPerRevolution = 200; // change this to fit the number of steps per revolution
-// for your motor
-
-// initialize the stepper library on pins 8 through 11:
-Stepper myStepper(stepsPerRevolution, 8, 9, 10, 11);
-
-void setup() {
- // set the speed at 60 rpm:
- myStepper.setSpeed(60);
- // initialize the serial port:
- Serial.begin(9600);
-}
-
-void loop() {
- // step one revolution in one direction:
- Serial.println("clockwise");
- myStepper.step(stepsPerRevolution);
- delay(500);
-
- // step one revolution in the other direction:
- Serial.println("counterclockwise");
- myStepper.step(-stepsPerRevolution);
- delay(500);
-}
-
diff --git a/libraries/Stepper/examples/stepper_oneStepAtATime/stepper_oneStepAtATime.ino b/libraries/Stepper/examples/stepper_oneStepAtATime/stepper_oneStepAtATime.ino
deleted file mode 100644
index e6c141f4d94..00000000000
--- a/libraries/Stepper/examples/stepper_oneStepAtATime/stepper_oneStepAtATime.ino
+++ /dev/null
@@ -1,44 +0,0 @@
-
-/*
- Stepper Motor Control - one step at a time
-
- This program drives a unipolar or bipolar stepper motor.
- The motor is attached to digital pins 8 - 11 of the Arduino.
-
- The motor will step one step at a time, very slowly. You can use this to
- test that you've got the four wires of your stepper wired to the correct
- pins. If wired correctly, all steps should be in the same direction.
-
- Use this also to count the number of steps per revolution of your motor,
- if you don't know it. Then plug that number into the oneRevolution
- example to see if you got it right.
-
- Created 30 Nov. 2009
- by Tom Igoe
-
- */
-
-#include
-
-const int stepsPerRevolution = 200; // change this to fit the number of steps per revolution
-// for your motor
-
-// initialize the stepper library on pins 8 through 11:
-Stepper myStepper(stepsPerRevolution, 8, 9, 10, 11);
-
-int stepCount = 0; // number of steps the motor has taken
-
-void setup() {
- // initialize the serial port:
- Serial.begin(9600);
-}
-
-void loop() {
- // step one step:
- myStepper.step(1);
- Serial.print("steps:");
- Serial.println(stepCount);
- stepCount++;
- delay(500);
-}
-
diff --git a/libraries/Stepper/examples/stepper_speedControl/stepper_speedControl.ino b/libraries/Stepper/examples/stepper_speedControl/stepper_speedControl.ino
deleted file mode 100644
index 5eb4f6a6684..00000000000
--- a/libraries/Stepper/examples/stepper_speedControl/stepper_speedControl.ino
+++ /dev/null
@@ -1,48 +0,0 @@
-
-/*
- Stepper Motor Control - speed control
-
- This program drives a unipolar or bipolar stepper motor.
- The motor is attached to digital pins 8 - 11 of the Arduino.
- A potentiometer is connected to analog input 0.
-
- The motor will rotate in a clockwise direction. The higher the potentiometer value,
- the faster the motor speed. Because setSpeed() sets the delay between steps,
- you may notice the motor is less responsive to changes in the sensor value at
- low speeds.
-
- Created 30 Nov. 2009
- Modified 28 Oct 2010
- by Tom Igoe
-
- */
-
-#include
-
-const int stepsPerRevolution = 200; // change this to fit the number of steps per revolution
-// for your motor
-
-
-// initialize the stepper library on pins 8 through 11:
-Stepper myStepper(stepsPerRevolution, 8, 9, 10, 11);
-
-int stepCount = 0; // number of steps the motor has taken
-
-void setup() {
- // nothing to do inside the setup
-}
-
-void loop() {
- // read the sensor value:
- int sensorReading = analogRead(A0);
- // map it to a range from 0 to 100:
- int motorSpeed = map(sensorReading, 0, 1023, 0, 100);
- // set the motor speed:
- if (motorSpeed > 0) {
- myStepper.setSpeed(motorSpeed);
- // step 1/100 of a revolution:
- myStepper.step(stepsPerRevolution / 100);
- }
-}
-
-
diff --git a/libraries/Stepper/keywords.txt b/libraries/Stepper/keywords.txt
deleted file mode 100644
index 5e58a66b018..00000000000
--- a/libraries/Stepper/keywords.txt
+++ /dev/null
@@ -1,28 +0,0 @@
-#######################################
-# Syntax Coloring Map For Test
-#######################################
-
-#######################################
-# Datatypes (KEYWORD1)
-#######################################
-
-Stepper KEYWORD1 Stepper
-
-#######################################
-# Methods and Functions (KEYWORD2)
-#######################################
-
-step KEYWORD2
-setSpeed KEYWORD2
-version KEYWORD2
-
-######################################
-# Instances (KEYWORD2)
-#######################################
-direction KEYWORD2
-speed KEYWORD2
-
-
-#######################################
-# Constants (LITERAL1)
-#######################################
diff --git a/libraries/Stepper/library.properties b/libraries/Stepper/library.properties
deleted file mode 100644
index 875067a0be9..00000000000
--- a/libraries/Stepper/library.properties
+++ /dev/null
@@ -1,9 +0,0 @@
-name=Stepper
-version=1.1.3
-author=Arduino
-maintainer=Arduino
-sentence=Allows Arduino boards to control a variety of stepper motors.
-paragraph=This library allows you to control unipolar or bipolar stepper motors. To use it you will need a stepper motor, and the appropriate hardware to control it.
-category=Device Control
-url=http://www.arduino.cc/en/Reference/Stepper
-architectures=*
diff --git a/libraries/Stepper/src/Stepper.cpp b/libraries/Stepper/src/Stepper.cpp
deleted file mode 100644
index 45faaecd00f..00000000000
--- a/libraries/Stepper/src/Stepper.cpp
+++ /dev/null
@@ -1,365 +0,0 @@
-/*
- * Stepper.cpp - Stepper library for Wiring/Arduino - Version 1.1.0
- *
- * Original library (0.1) by Tom Igoe.
- * Two-wire modifications (0.2) by Sebastian Gassner
- * Combination version (0.3) by Tom Igoe and David Mellis
- * Bug fix for four-wire (0.4) by Tom Igoe, bug fix from Noah Shibley
- * High-speed stepping mod by Eugene Kozlenko
- * Timer rollover fix by Eugene Kozlenko
- * Five phase five wire (1.1.0) by Ryan Orendorff
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- *
- * Drives a unipolar, bipolar, or five phase stepper motor.
- *
- * When wiring multiple stepper motors to a microcontroller, you quickly run
- * out of output pins, with each motor requiring 4 connections.
- *
- * By making use of the fact that at any time two of the four motor coils are
- * the inverse of the other two, the number of control connections can be
- * reduced from 4 to 2 for the unipolar and bipolar motors.
- *
- * A slightly modified circuit around a Darlington transistor array or an
- * L293 H-bridge connects to only 2 microcontroler pins, inverts the signals
- * received, and delivers the 4 (2 plus 2 inverted ones) output signals
- * required for driving a stepper motor. Similarly the Arduino motor shields
- * 2 direction pins may be used.
- *
- * The sequence of control signals for 5 phase, 5 control wires is as follows:
- *
- * Step C0 C1 C2 C3 C4
- * 1 0 1 1 0 1
- * 2 0 1 0 0 1
- * 3 0 1 0 1 1
- * 4 0 1 0 1 0
- * 5 1 1 0 1 0
- * 6 1 0 0 1 0
- * 7 1 0 1 1 0
- * 8 1 0 1 0 0
- * 9 1 0 1 0 1
- * 10 0 0 1 0 1
- *
- * The sequence of control signals for 4 control wires is as follows:
- *
- * Step C0 C1 C2 C3
- * 1 1 0 1 0
- * 2 0 1 1 0
- * 3 0 1 0 1
- * 4 1 0 0 1
- *
- * The sequence of controls signals for 2 control wires is as follows
- * (columns C1 and C2 from above):
- *
- * Step C0 C1
- * 1 0 1
- * 2 1 1
- * 3 1 0
- * 4 0 0
- *
- * The circuits can be found at
- *
- * http://www.arduino.cc/en/Reference/Stepper
- */
-
-#include "Arduino.h"
-#include "Stepper.h"
-
-/*
- * two-wire constructor.
- * Sets which wires should control the motor.
- */
-Stepper::Stepper(int number_of_steps, int motor_pin_1, int motor_pin_2)
-{
- this->step_number = 0; // which step the motor is on
- this->direction = 0; // motor direction
- this->last_step_time = 0; // time stamp in us of the last step taken
- this->number_of_steps = number_of_steps; // total number of steps for this motor
-
- // Arduino pins for the motor control connection:
- this->motor_pin_1 = motor_pin_1;
- this->motor_pin_2 = motor_pin_2;
-
- // setup the pins on the microcontroller:
- pinMode(this->motor_pin_1, OUTPUT);
- pinMode(this->motor_pin_2, OUTPUT);
-
- // When there are only 2 pins, set the others to 0:
- this->motor_pin_3 = 0;
- this->motor_pin_4 = 0;
- this->motor_pin_5 = 0;
-
- // pin_count is used by the stepMotor() method:
- this->pin_count = 2;
-}
-
-
-/*
- * constructor for four-pin version
- * Sets which wires should control the motor.
- */
-Stepper::Stepper(int number_of_steps, int motor_pin_1, int motor_pin_2,
- int motor_pin_3, int motor_pin_4)
-{
- this->step_number = 0; // which step the motor is on
- this->direction = 0; // motor direction
- this->last_step_time = 0; // time stamp in us of the last step taken
- this->number_of_steps = number_of_steps; // total number of steps for this motor
-
- // Arduino pins for the motor control connection:
- this->motor_pin_1 = motor_pin_1;
- this->motor_pin_2 = motor_pin_2;
- this->motor_pin_3 = motor_pin_3;
- this->motor_pin_4 = motor_pin_4;
-
- // setup the pins on the microcontroller:
- pinMode(this->motor_pin_1, OUTPUT);
- pinMode(this->motor_pin_2, OUTPUT);
- pinMode(this->motor_pin_3, OUTPUT);
- pinMode(this->motor_pin_4, OUTPUT);
-
- // When there are 4 pins, set the others to 0:
- this->motor_pin_5 = 0;
-
- // pin_count is used by the stepMotor() method:
- this->pin_count = 4;
-}
-
-/*
- * constructor for five phase motor with five wires
- * Sets which wires should control the motor.
- */
-Stepper::Stepper(int number_of_steps, int motor_pin_1, int motor_pin_2,
- int motor_pin_3, int motor_pin_4,
- int motor_pin_5)
-{
- this->step_number = 0; // which step the motor is on
- this->direction = 0; // motor direction
- this->last_step_time = 0; // time stamp in us of the last step taken
- this->number_of_steps = number_of_steps; // total number of steps for this motor
-
- // Arduino pins for the motor control connection:
- this->motor_pin_1 = motor_pin_1;
- this->motor_pin_2 = motor_pin_2;
- this->motor_pin_3 = motor_pin_3;
- this->motor_pin_4 = motor_pin_4;
- this->motor_pin_5 = motor_pin_5;
-
- // setup the pins on the microcontroller:
- pinMode(this->motor_pin_1, OUTPUT);
- pinMode(this->motor_pin_2, OUTPUT);
- pinMode(this->motor_pin_3, OUTPUT);
- pinMode(this->motor_pin_4, OUTPUT);
- pinMode(this->motor_pin_5, OUTPUT);
-
- // pin_count is used by the stepMotor() method:
- this->pin_count = 5;
-}
-
-/*
- * Sets the speed in revs per minute
- */
-void Stepper::setSpeed(long whatSpeed)
-{
- this->step_delay = 60L * 1000L * 1000L / this->number_of_steps / whatSpeed;
-}
-
-/*
- * Moves the motor steps_to_move steps. If the number is negative,
- * the motor moves in the reverse direction.
- */
-void Stepper::step(int steps_to_move)
-{
- int steps_left = abs(steps_to_move); // how many steps to take
-
- // determine direction based on whether steps_to_mode is + or -:
- if (steps_to_move > 0) { this->direction = 1; }
- if (steps_to_move < 0) { this->direction = 0; }
-
-
- // decrement the number of steps, moving one step each time:
- while (steps_left > 0)
- {
- unsigned long now = micros();
- // move only if the appropriate delay has passed:
- if (now - this->last_step_time >= this->step_delay)
- {
- // get the timeStamp of when you stepped:
- this->last_step_time = now;
- // increment or decrement the step number,
- // depending on direction:
- if (this->direction == 1)
- {
- this->step_number++;
- if (this->step_number == this->number_of_steps) {
- this->step_number = 0;
- }
- }
- else
- {
- if (this->step_number == 0) {
- this->step_number = this->number_of_steps;
- }
- this->step_number--;
- }
- // decrement the steps left:
- steps_left--;
- // step the motor to step number 0, 1, ..., {3 or 10}
- if (this->pin_count == 5)
- stepMotor(this->step_number % 10);
- else
- stepMotor(this->step_number % 4);
- }
- }
-}
-
-/*
- * Moves the motor forward or backwards.
- */
-void Stepper::stepMotor(int thisStep)
-{
- if (this->pin_count == 2) {
- switch (thisStep) {
- case 0: // 01
- digitalWrite(motor_pin_1, LOW);
- digitalWrite(motor_pin_2, HIGH);
- break;
- case 1: // 11
- digitalWrite(motor_pin_1, HIGH);
- digitalWrite(motor_pin_2, HIGH);
- break;
- case 2: // 10
- digitalWrite(motor_pin_1, HIGH);
- digitalWrite(motor_pin_2, LOW);
- break;
- case 3: // 00
- digitalWrite(motor_pin_1, LOW);
- digitalWrite(motor_pin_2, LOW);
- break;
- }
- }
- if (this->pin_count == 4) {
- switch (thisStep) {
- case 0: // 1010
- digitalWrite(motor_pin_1, HIGH);
- digitalWrite(motor_pin_2, LOW);
- digitalWrite(motor_pin_3, HIGH);
- digitalWrite(motor_pin_4, LOW);
- break;
- case 1: // 0110
- digitalWrite(motor_pin_1, LOW);
- digitalWrite(motor_pin_2, HIGH);
- digitalWrite(motor_pin_3, HIGH);
- digitalWrite(motor_pin_4, LOW);
- break;
- case 2: //0101
- digitalWrite(motor_pin_1, LOW);
- digitalWrite(motor_pin_2, HIGH);
- digitalWrite(motor_pin_3, LOW);
- digitalWrite(motor_pin_4, HIGH);
- break;
- case 3: //1001
- digitalWrite(motor_pin_1, HIGH);
- digitalWrite(motor_pin_2, LOW);
- digitalWrite(motor_pin_3, LOW);
- digitalWrite(motor_pin_4, HIGH);
- break;
- }
- }
-
- if (this->pin_count == 5) {
- switch (thisStep) {
- case 0: // 01101
- digitalWrite(motor_pin_1, LOW);
- digitalWrite(motor_pin_2, HIGH);
- digitalWrite(motor_pin_3, HIGH);
- digitalWrite(motor_pin_4, LOW);
- digitalWrite(motor_pin_5, HIGH);
- break;
- case 1: // 01001
- digitalWrite(motor_pin_1, LOW);
- digitalWrite(motor_pin_2, HIGH);
- digitalWrite(motor_pin_3, LOW);
- digitalWrite(motor_pin_4, LOW);
- digitalWrite(motor_pin_5, HIGH);
- break;
- case 2: // 01011
- digitalWrite(motor_pin_1, LOW);
- digitalWrite(motor_pin_2, HIGH);
- digitalWrite(motor_pin_3, LOW);
- digitalWrite(motor_pin_4, HIGH);
- digitalWrite(motor_pin_5, HIGH);
- break;
- case 3: // 01010
- digitalWrite(motor_pin_1, LOW);
- digitalWrite(motor_pin_2, HIGH);
- digitalWrite(motor_pin_3, LOW);
- digitalWrite(motor_pin_4, HIGH);
- digitalWrite(motor_pin_5, LOW);
- break;
- case 4: // 11010
- digitalWrite(motor_pin_1, HIGH);
- digitalWrite(motor_pin_2, HIGH);
- digitalWrite(motor_pin_3, LOW);
- digitalWrite(motor_pin_4, HIGH);
- digitalWrite(motor_pin_5, LOW);
- break;
- case 5: // 10010
- digitalWrite(motor_pin_1, HIGH);
- digitalWrite(motor_pin_2, LOW);
- digitalWrite(motor_pin_3, LOW);
- digitalWrite(motor_pin_4, HIGH);
- digitalWrite(motor_pin_5, LOW);
- break;
- case 6: // 10110
- digitalWrite(motor_pin_1, HIGH);
- digitalWrite(motor_pin_2, LOW);
- digitalWrite(motor_pin_3, HIGH);
- digitalWrite(motor_pin_4, HIGH);
- digitalWrite(motor_pin_5, LOW);
- break;
- case 7: // 10100
- digitalWrite(motor_pin_1, HIGH);
- digitalWrite(motor_pin_2, LOW);
- digitalWrite(motor_pin_3, HIGH);
- digitalWrite(motor_pin_4, LOW);
- digitalWrite(motor_pin_5, LOW);
- break;
- case 8: // 10101
- digitalWrite(motor_pin_1, HIGH);
- digitalWrite(motor_pin_2, LOW);
- digitalWrite(motor_pin_3, HIGH);
- digitalWrite(motor_pin_4, LOW);
- digitalWrite(motor_pin_5, HIGH);
- break;
- case 9: // 00101
- digitalWrite(motor_pin_1, LOW);
- digitalWrite(motor_pin_2, LOW);
- digitalWrite(motor_pin_3, HIGH);
- digitalWrite(motor_pin_4, LOW);
- digitalWrite(motor_pin_5, HIGH);
- break;
- }
- }
-}
-
-/*
- version() returns the version of the library:
-*/
-int Stepper::version(void)
-{
- return 5;
-}
diff --git a/libraries/Stepper/src/Stepper.h b/libraries/Stepper/src/Stepper.h
deleted file mode 100644
index 7b77e729fcf..00000000000
--- a/libraries/Stepper/src/Stepper.h
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Stepper.h - Stepper library for Wiring/Arduino - Version 1.1.0
- *
- * Original library (0.1) by Tom Igoe.
- * Two-wire modifications (0.2) by Sebastian Gassner
- * Combination version (0.3) by Tom Igoe and David Mellis
- * Bug fix for four-wire (0.4) by Tom Igoe, bug fix from Noah Shibley
- * High-speed stepping mod by Eugene Kozlenko
- * Timer rollover fix by Eugene Kozlenko
- * Five phase five wire (1.1.0) by Ryan Orendorff
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- *
- * Drives a unipolar, bipolar, or five phase stepper motor.
- *
- * When wiring multiple stepper motors to a microcontroller, you quickly run
- * out of output pins, with each motor requiring 4 connections.
- *
- * By making use of the fact that at any time two of the four motor coils are
- * the inverse of the other two, the number of control connections can be
- * reduced from 4 to 2 for the unipolar and bipolar motors.
- *
- * A slightly modified circuit around a Darlington transistor array or an
- * L293 H-bridge connects to only 2 microcontroler pins, inverts the signals
- * received, and delivers the 4 (2 plus 2 inverted ones) output signals
- * required for driving a stepper motor. Similarly the Arduino motor shields
- * 2 direction pins may be used.
- *
- * The sequence of control signals for 5 phase, 5 control wires is as follows:
- *
- * Step C0 C1 C2 C3 C4
- * 1 0 1 1 0 1
- * 2 0 1 0 0 1
- * 3 0 1 0 1 1
- * 4 0 1 0 1 0
- * 5 1 1 0 1 0
- * 6 1 0 0 1 0
- * 7 1 0 1 1 0
- * 8 1 0 1 0 0
- * 9 1 0 1 0 1
- * 10 0 0 1 0 1
- *
- * The sequence of control signals for 4 control wires is as follows:
- *
- * Step C0 C1 C2 C3
- * 1 1 0 1 0
- * 2 0 1 1 0
- * 3 0 1 0 1
- * 4 1 0 0 1
- *
- * The sequence of controls signals for 2 control wires is as follows
- * (columns C1 and C2 from above):
- *
- * Step C0 C1
- * 1 0 1
- * 2 1 1
- * 3 1 0
- * 4 0 0
- *
- * The circuits can be found at
- *
- * http://www.arduino.cc/en/Reference/Stepper
- */
-
-// ensure this library description is only included once
-#ifndef Stepper_h
-#define Stepper_h
-
-// library interface description
-class Stepper {
- public:
- // constructors:
- Stepper(int number_of_steps, int motor_pin_1, int motor_pin_2);
- Stepper(int number_of_steps, int motor_pin_1, int motor_pin_2,
- int motor_pin_3, int motor_pin_4);
- Stepper(int number_of_steps, int motor_pin_1, int motor_pin_2,
- int motor_pin_3, int motor_pin_4,
- int motor_pin_5);
-
- // speed setter method:
- void setSpeed(long whatSpeed);
-
- // mover method:
- void step(int number_of_steps);
-
- int version(void);
-
- private:
- void stepMotor(int this_step);
-
- int direction; // Direction of rotation
- unsigned long step_delay; // delay between steps, in ms, based on speed
- int number_of_steps; // total number of steps this motor can take
- int pin_count; // how many pins are in use.
- int step_number; // which step the motor is on
-
- // motor pin numbers:
- int motor_pin_1;
- int motor_pin_2;
- int motor_pin_3;
- int motor_pin_4;
- int motor_pin_5; // Only 5 phase motor
-
- unsigned long last_step_time; // time stamp in us of when the last step was taken
-};
-
-#endif
-
diff --git a/libraries/TFT/README.adoc b/libraries/TFT/README.adoc
deleted file mode 100644
index 0550e2d3472..00000000000
--- a/libraries/TFT/README.adoc
+++ /dev/null
@@ -1,26 +0,0 @@
-= TFT Library for Arduino =
-
-This library enables an Arduino board to communicate with the Arduino TFT LCD screen. It simplifies the process for drawing shapes, lines, images, and text to the screen.
-
-For more information about this library please visit us at
-http://www.arduino.cc/en/Reference/TFTLibrary
-
-== License ==
-
-Copyright (c) Arduino LLC. All right reserved.
-Copyright (c) Enrico Gueli. All right reserved.
-Copyright (c) 2012, Adafruit Industries. All rights reserved.
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
diff --git a/libraries/TFT/examples/Arduino/TFTBitmapLogo/TFTBitmapLogo.ino b/libraries/TFT/examples/Arduino/TFTBitmapLogo/TFTBitmapLogo.ino
deleted file mode 100644
index d1b8a731dfb..00000000000
--- a/libraries/TFT/examples/Arduino/TFTBitmapLogo/TFTBitmapLogo.ino
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
-
- Arduino TFT Bitmap Logo example
-
- This example reads an image file from a micro-SD card
- and draws it on the screen, at random locations.
-
- In this sketch, the Arduino logo is read from a micro-SD card.
- There is a .bmp file included with this sketch.
- - open the sketch folder (Ctrl-K or Cmd-K)
- - copy the "arduino.bmp" file to a micro-SD
- - put the SD into the SD slot of the Arduino TFT module.
-
- This example code is in the public domain.
-
- Created 19 April 2013 by Enrico Gueli
-
- http://www.arduino.cc/en/Tutorial/TFTBitmapLogo
-
- */
-
-// include the necessary libraries
-#include
-#include
-#include // Arduino LCD library
-
-// pin definition for the Uno
-#define sd_cs 4
-#define lcd_cs 10
-#define dc 9
-#define rst 8
-
-// pin definition for the Leonardo
-//#define sd_cs 8
-//#define lcd_cs 7
-//#define dc 0
-//#define rst 1
-
-TFT TFTscreen = TFT(lcd_cs, dc, rst);
-
-// this variable represents the image to be drawn on screen
-PImage logo;
-
-
-void setup() {
- // initialize the GLCD and show a message
- // asking the user to open the serial line
- TFTscreen.begin();
- TFTscreen.background(255, 255, 255);
-
- TFTscreen.stroke(0, 0, 255);
- TFTscreen.println();
- TFTscreen.println(F("Arduino TFT Bitmap Example"));
- TFTscreen.stroke(0, 0, 0);
- TFTscreen.println(F("Open serial monitor"));
- TFTscreen.println(F("to run the sketch"));
-
- // initialize the serial port: it will be used to
- // print some diagnostic info
- Serial.begin(9600);
- while (!Serial) {
- // wait for serial port to connect. Needed for native USB port only
- }
-
- // clear the GLCD screen before starting
- TFTscreen.background(255, 255, 255);
-
- // try to access the SD card. If that fails (e.g.
- // no card present), the setup process will stop.
- Serial.print(F("Initializing SD card..."));
- if (!SD.begin(sd_cs)) {
- Serial.println(F("failed!"));
- return;
- }
- Serial.println(F("OK!"));
-
- // initialize and clear the GLCD screen
- TFTscreen.begin();
- TFTscreen.background(255, 255, 255);
-
- // now that the SD card can be access, try to load the
- // image file.
- logo = TFTscreen.loadImage("arduino.bmp");
- if (!logo.isValid()) {
- Serial.println(F("error while loading arduino.bmp"));
- }
-}
-
-void loop() {
- // don't do anything if the image wasn't loaded correctly.
- if (logo.isValid() == false) {
- return;
- }
-
- Serial.println(F("drawing image"));
-
- // get a random location where to draw the image.
- // To avoid the image to be draw outside the screen,
- // take into account the image size.
- int x = random(TFTscreen.width() - logo.width());
- int y = random(TFTscreen.height() - logo.height());
-
- // draw the image to the screen
- TFTscreen.image(logo, x, y);
-
- // wait a little bit before drawing again
- delay(1500);
-}
diff --git a/libraries/TFT/examples/Arduino/TFTBitmapLogo/arduino.bmp b/libraries/TFT/examples/Arduino/TFTBitmapLogo/arduino.bmp
deleted file mode 100644
index 09c670ab54f..00000000000
Binary files a/libraries/TFT/examples/Arduino/TFTBitmapLogo/arduino.bmp and /dev/null differ
diff --git a/libraries/TFT/examples/Arduino/TFTColorPicker/TFTColorPicker.ino b/libraries/TFT/examples/Arduino/TFTColorPicker/TFTColorPicker.ino
deleted file mode 100644
index ba71d1e5708..00000000000
--- a/libraries/TFT/examples/Arduino/TFTColorPicker/TFTColorPicker.ino
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
-
- TFT Color Picker
-
- This example for the Arduino screen reads the input of
- potentiometers or analog sensors attached to A0, A1,
- and A2 and uses the values to change the screen's color.
-
- This example code is in the public domain.
-
- Created 15 April 2013 by Scott Fitzgerald
-
- http://www.arduino.cc/en/Tutorial/TFTColorPicker
-
- */
-
-// pin definition for the Uno
-#define cs 10
-#define dc 9
-#define rst 8
-
-// pin definition for the Leonardo
-// #define cs 7
-// #define dc 0
-// #define rst 1
-
-#include // Arduino LCD library
-#include
-
-TFT TFTscreen = TFT(cs, dc, rst);
-
-void setup() {
- // begin serial communication
- Serial.begin(9600);
-
- // initialize the display
- TFTscreen.begin();
-
- // set the background to white
- TFTscreen.background(255, 255, 255);
-
-}
-
-void loop() {
-
- // read the values from your sensors and scale them to 0-255
- int redVal = map(analogRead(A0), 0, 1023, 0, 255);
- int greenVal = map(analogRead(A1), 0, 1023, 0, 255);
- int blueVal = map(analogRead(A2), 0, 1023, 0, 255);
-
- // draw the background based on the mapped values
- TFTscreen.background(redVal, greenVal, blueVal);
-
- // send the values to the serial monitor
- Serial.print("background(");
- Serial.print(redVal);
- Serial.print(" , ");
- Serial.print(greenVal);
- Serial.print(" , ");
- Serial.print(blueVal);
- Serial.println(")");
-
- // wait for a moment
- delay(33);
-
-}
-
diff --git a/libraries/TFT/examples/Arduino/TFTDisplayText/TFTDisplayText.ino b/libraries/TFT/examples/Arduino/TFTDisplayText/TFTDisplayText.ino
deleted file mode 100644
index a9c1d86999c..00000000000
--- a/libraries/TFT/examples/Arduino/TFTDisplayText/TFTDisplayText.ino
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- Arduino TFT text example
-
- This example demonstrates how to draw text on the
- TFT with an Arduino. The Arduino reads the value
- of an analog sensor attached to pin A0, and writes
- the value to the LCD screen, updating every
- quarter second.
-
- This example code is in the public domain
-
- Created 15 April 2013 by Scott Fitzgerald
-
- http://www.arduino.cc/en/Tutorial/TFTDisplayText
-
- */
-
-#include // Arduino LCD library
-#include
-
-// pin definition for the Uno
-#define cs 10
-#define dc 9
-#define rst 8
-
-// pin definition for the Leonardo
-// #define cs 7
-// #define dc 0
-// #define rst 1
-
-// create an instance of the library
-TFT TFTscreen = TFT(cs, dc, rst);
-
-// char array to print to the screen
-char sensorPrintout[4];
-
-void setup() {
-
- // Put this line at the beginning of every sketch that uses the GLCD:
- TFTscreen.begin();
-
- // clear the screen with a black background
- TFTscreen.background(0, 0, 0);
-
- // write the static text to the screen
- // set the font color to white
- TFTscreen.stroke(255, 255, 255);
- // set the font size
- TFTscreen.setTextSize(2);
- // write the text to the top left corner of the screen
- TFTscreen.text("Sensor Value :\n ", 0, 0);
- // ste the font size very large for the loop
- TFTscreen.setTextSize(5);
-}
-
-void loop() {
-
- // Read the value of the sensor on A0
- String sensorVal = String(analogRead(A0));
-
- // convert the reading to a char array
- sensorVal.toCharArray(sensorPrintout, 4);
-
- // set the font color
- TFTscreen.stroke(255, 255, 255);
- // print the sensor value
- TFTscreen.text(sensorPrintout, 0, 20);
- // wait for a moment
- delay(250);
- // erase the text you just wrote
- TFTscreen.stroke(0, 0, 0);
- TFTscreen.text(sensorPrintout, 0, 20);
-}
-
diff --git a/libraries/TFT/examples/Arduino/TFTEtchASketch/TFTEtchASketch.ino b/libraries/TFT/examples/Arduino/TFTEtchASketch/TFTEtchASketch.ino
deleted file mode 100644
index 4eb75d1d42a..00000000000
--- a/libraries/TFT/examples/Arduino/TFTEtchASketch/TFTEtchASketch.ino
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
-
- TFT EtchASketch
-
- This example for the Arduino screen draws a white point
- on the GLCD based on the values of 2 potentiometers.
- To clear the screen, press a button attached to pin 2.
-
- This example code is in the public domain.
-
- Created 15 April 2013 by Scott Fitzgerald
-
- http://www.arduino.cc/en/Tutorial/TFTEtchASketch
-
- */
-
-#include // Arduino LCD library
-#include
-
-// pin definition for the Uno
-#define cs 10
-#define dc 9
-#define rst 8
-
-// pin definition for the Leonardo
-// #define cs 7
-// #define dc 0
-// #define rst 1
-
-TFT TFTscreen = TFT(cs, dc, rst);
-
-// initial position of the cursor
-int xPos = TFTscreen.width() / 2;
-int yPos = TFTscreen.height() / 2;
-
-// pin the erase switch is connected to
-int erasePin = 2;
-
-void setup() {
- // declare inputs
- pinMode(erasePin, INPUT);
- // initialize the screen
- TFTscreen.begin();
- // make the background black
- TFTscreen.background(0, 0, 0);
-}
-
-void loop() {
- // read the potentiometers on A0 and A1
- int xValue = analogRead(A0);
- int yValue = analogRead(A1);
-
- // map the values and update the position
- xPos = xPos + (map(xValue, 0, 1023, 2, -2));
- yPos = yPos + (map(yValue, 0, 1023, -2, 2));
-
- // don't let the point go past the screen edges
- if (xPos > 159) {
- (xPos = 159);
- }
-
- if (xPos < 0) {
- (xPos = 0);
- }
- if (yPos > 127) {
- (yPos = 127);
- }
-
- if (yPos < 0) {
- (yPos = 0);
- }
-
- // draw the point
- TFTscreen.stroke(255, 255, 255);
- TFTscreen.point(xPos, yPos);
-
- // read the value of the pin, and erase the screen if pressed
- if (digitalRead(erasePin) == HIGH) {
- TFTscreen.background(0, 0, 0);
- }
-
- delay(33);
-}
diff --git a/libraries/TFT/examples/Arduino/TFTGraph/TFTGraph.ino b/libraries/TFT/examples/Arduino/TFTGraph/TFTGraph.ino
deleted file mode 100644
index 3b2f03b97a7..00000000000
--- a/libraries/TFT/examples/Arduino/TFTGraph/TFTGraph.ino
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
-
- TFT Graph
-
- This example for an Arduino screen reads
- the value of an analog sensor on A0, and
- graphs the values on the screen.
-
- This example code is in the public domain.
-
- Created 15 April 2013 by Scott Fitzgerald
-
- http://www.arduino.cc/en/Tutorial/TFTGraph
-
- */
-
-#include // Arduino LCD library
-#include
-
-// pin definition for the Uno
-#define cs 10
-#define dc 9
-#define rst 8
-
-// pin definition for the Leonardo
-// #define cs 7
-// #define dc 0
-// #define rst 1
-
-TFT TFTscreen = TFT(cs, dc, rst);
-
-// position of the line on screen
-int xPos = 0;
-
-void setup() {
- // initialize the serial port
- Serial.begin(9600);
-
- // initialize the display
- TFTscreen.begin();
-
- // clear the screen with a pretty color
- TFTscreen.background(250, 16, 200);
-}
-
-void loop() {
- // read the sensor and map it to the screen height
- int sensor = analogRead(A0);
- int drawHeight = map(sensor, 0, 1023, 0, TFTscreen.height());
-
- // print out the height to the serial monitor
- Serial.println(drawHeight);
-
- // draw a line in a nice color
- TFTscreen.stroke(250, 180, 10);
- TFTscreen.line(xPos, TFTscreen.height() - drawHeight, xPos, TFTscreen.height());
-
- // if the graph has reached the screen edge
- // erase the screen and start again
- if (xPos >= 160) {
- xPos = 0;
- TFTscreen.background(250, 16, 200);
- } else {
- // increment the horizontal position:
- xPos++;
- }
-
- delay(16);
-}
-
diff --git a/libraries/TFT/examples/Arduino/TFTPong/TFTPong.ino b/libraries/TFT/examples/Arduino/TFTPong/TFTPong.ino
deleted file mode 100644
index 7a6191538ab..00000000000
--- a/libraries/TFT/examples/Arduino/TFTPong/TFTPong.ino
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
-
- TFT Pong
-
- This example for the Arduino screen reads the values
- of 2 potentiometers to move a rectangular platform
- on the x and y axes. The platform can intersect
- with a ball causing it to bounce.
-
- This example code is in the public domain.
-
- Created by Tom Igoe December 2012
- Modified 15 April 2013 by Scott Fitzgerald
-
- http://www.arduino.cc/en/Tutorial/TFTPong
-
- */
-
-#include // Arduino LCD library
-#include
-
-// pin definition for the Uno
-#define cs 10
-#define dc 9
-#define rst 8
-
-// pin definition for the Leonardo
-// #define cs 7
-// #define dc 0
-// #define rst 1
-
-TFT TFTscreen = TFT(cs, dc, rst);
-
-// variables for the position of the ball and paddle
-int paddleX = 0;
-int paddleY = 0;
-int oldPaddleX, oldPaddleY;
-int ballDirectionX = 1;
-int ballDirectionY = 1;
-
-int ballSpeed = 10; // lower numbers are faster
-
-int ballX, ballY, oldBallX, oldBallY;
-
-void setup() {
- // initialize the display
- TFTscreen.begin();
- // black background
- TFTscreen.background(0, 0, 0);
-}
-
-void loop() {
-
- // save the width and height of the screen
- int myWidth = TFTscreen.width();
- int myHeight = TFTscreen.height();
-
- // map the paddle's location to the position of the potentiometers
- paddleX = map(analogRead(A0), 512, -512, 0, myWidth) - 20 / 2;
- paddleY = map(analogRead(A1), 512, -512, 0, myHeight) - 5 / 2;
-
- // set the fill color to black and erase the previous
- // position of the paddle if different from present
- TFTscreen.fill(0, 0, 0);
-
- if (oldPaddleX != paddleX || oldPaddleY != paddleY) {
- TFTscreen.rect(oldPaddleX, oldPaddleY, 20, 5);
- }
-
- // draw the paddle on screen, save the current position
- // as the previous.
- TFTscreen.fill(255, 255, 255);
-
- TFTscreen.rect(paddleX, paddleY, 20, 5);
- oldPaddleX = paddleX;
- oldPaddleY = paddleY;
-
- // update the ball's position and draw it on screen
- if (millis() % ballSpeed < 2) {
- moveBall();
- }
-}
-
-// this function determines the ball's position on screen
-void moveBall() {
- // if the ball goes offscreen, reverse the direction:
- if (ballX > TFTscreen.width() || ballX < 0) {
- ballDirectionX = -ballDirectionX;
- }
-
- if (ballY > TFTscreen.height() || ballY < 0) {
- ballDirectionY = -ballDirectionY;
- }
-
- // check if the ball and the paddle occupy the same space on screen
- if (inPaddle(ballX, ballY, paddleX, paddleY, 20, 5)) {
- ballDirectionX = -ballDirectionX;
- ballDirectionY = -ballDirectionY;
- }
-
- // update the ball's position
- ballX += ballDirectionX;
- ballY += ballDirectionY;
-
- // erase the ball's previous position
- TFTscreen.fill(0, 0, 0);
-
- if (oldBallX != ballX || oldBallY != ballY) {
- TFTscreen.rect(oldBallX, oldBallY, 5, 5);
- }
-
-
- // draw the ball's current position
- TFTscreen.fill(255, 255, 255);
- TFTscreen.rect(ballX, ballY, 5, 5);
-
- oldBallX = ballX;
- oldBallY = ballY;
-
-}
-
-// this function checks the position of the ball
-// to see if it intersects with the paddle
-boolean inPaddle(int x, int y, int rectX, int rectY, int rectWidth, int rectHeight) {
- boolean result = false;
-
- if ((x >= rectX && x <= (rectX + rectWidth)) &&
- (y >= rectY && y <= (rectY + rectHeight))) {
- result = true;
- }
-
- return result;
-}
-
-
diff --git a/libraries/TFT/examples/Esplora/EsploraTFTBitmapLogo/EsploraTFTBitmapLogo.ino b/libraries/TFT/examples/Esplora/EsploraTFTBitmapLogo/EsploraTFTBitmapLogo.ino
deleted file mode 100644
index 8d38519a481..00000000000
--- a/libraries/TFT/examples/Esplora/EsploraTFTBitmapLogo/EsploraTFTBitmapLogo.ino
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
-
- Esplora TFT Bitmap Logos
-
- This example for the Arduino TFT screen is for use
- with an Arduino Esplora.
-
- This example reads an image file from a micro-SD card
- and draws it on the screen, at random locations.
-
- There is a .bmp file included with this sketch.
- - open the sketch folder (Ctrl-K or Cmd-K)
- - copy the "arduino.bmp" file to a micro-SD
- - put the SD into the SD slot of the Arduino LCD module.
-
- This example code is in the public domain.
-
- Created 19 April 2013 by Enrico Gueli
-
- http://www.arduino.cc/en/Tutorial/EsploraTFTBitmapLogo
-
- */
-
-// include the necessary libraries
-#include
-#include
-#include
-#include // Arduino LCD library
-
-// the Esplora pin connected to the chip select line for SD card
-#define SD_CS 8
-
-// this variable represents the image to be drawn on screen
-PImage logo;
-
-void setup() {
- // initialize the GLCD and show a message
- // asking the user to open the serial line
- EsploraTFT.begin();
- EsploraTFT.background(255, 255, 255);
-
- EsploraTFT.stroke(0, 0, 255);
- EsploraTFT.println();
- EsploraTFT.println(F("Arduino LCD Bitmap Example"));
- EsploraTFT.stroke(0, 0, 0);
- EsploraTFT.println(F("Open serial monitor"));
- EsploraTFT.println(F("to run the sketch"));
-
- // initialize the serial port: it will be used to
- // print some diagnostic info
- Serial.begin(9600);
- while (!Serial) {
- // wait for serial port to connect. Needed for native USB port only
- }
-
- // try to access the SD card. If that fails (e.g.
- // no card present), the Esplora's LED will turn red.
- Serial.print(F("Initializing SD card..."));
- if (!SD.begin(SD_CS)) {
- Serial.println(F("failed!"));
- Esplora.writeRed(255);
- return;
- }
- Serial.println("OK!");
-
- // clear the GLCD screen before starting
- EsploraTFT.background(255, 255, 255);
-
- // now that the SD card can be access, try to load the
- // image file. The Esplora LED will turn green or red if
- // the loading went OK or not.
- Esplora.writeRGB(0, 0, 0);
- logo = EsploraTFT.loadImage("arduino.bmp");
- if (logo.isValid()) {
- Esplora.writeGreen(255);
- } else {
- Esplora.writeRed(255);
- }
-
-}
-
-void loop() {
- // don't do anything if the image wasn't loaded correctly.
- if (logo.isValid() == false) {
- return;
- }
-
- Serial.println(F("drawing image"));
-
- // get a random location where to draw the image.
- // To avoid the image to be draw outside the screen,
- // take into account the image size.
- int x = random(EsploraTFT.width() - logo.width());
- int y = random(EsploraTFT.height() - logo.height());
-
- // draw the image to the screen
- EsploraTFT.image(logo, x, y);
-
- // wait a little bit before drawing again
- delay(1500);
-}
diff --git a/libraries/TFT/examples/Esplora/EsploraTFTBitmapLogo/arduino.bmp b/libraries/TFT/examples/Esplora/EsploraTFTBitmapLogo/arduino.bmp
deleted file mode 100644
index 09c670ab54f..00000000000
Binary files a/libraries/TFT/examples/Esplora/EsploraTFTBitmapLogo/arduino.bmp and /dev/null differ
diff --git a/libraries/TFT/examples/Esplora/EsploraTFTColorPicker/EsploraTFTColorPicker.ino b/libraries/TFT/examples/Esplora/EsploraTFTColorPicker/EsploraTFTColorPicker.ino
deleted file mode 100644
index cdce051e172..00000000000
--- a/libraries/TFT/examples/Esplora/EsploraTFTColorPicker/EsploraTFTColorPicker.ino
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
-
- Esplora TFT Color Picker
-
- This example for the Esplora with an Arduino TFT reads
- the input of the joystick and slider, using the values
- to change the screen's color.
-
- This example code is in the public domain.
-
- Created 15 April 2013 by Scott Fitzgerald
-
- http://www.arduino.cc/en/Tutorial/TFTColorPicker
-
- */
-
-#include
-#include // Arduino LCD library
-#include
-
-void setup() {
- Serial.begin(9600);
-
- // initialize the LCD
- EsploraTFT.begin();
-
- // start out with a white screen
- EsploraTFT.background(255, 255, 255);
-
-}
-
-void loop() {
-
- // map the values from sensors
- int xValue = map(Esplora.readJoystickX(), -512, 512, 0, 255); // read the joystick's X position
- int yValue = map(Esplora.readJoystickY(), -512, 512, 0, 255); // read the joystick's Y position
- int slider = map(Esplora.readSlider(), 0, 1023, 0, 255); // read the slider's position
-
- // change the background color based on the mapped values
- EsploraTFT.background(xValue, yValue, slider);
-
- // print the mapped values to the Serial monitor
- Serial.print("background(");
- Serial.print(xValue);
- Serial.print(" , ");
- Serial.print(yValue);
- Serial.print(" , ");
- Serial.print(slider);
- Serial.println(")");
-
- delay(33);
-
-}
-
diff --git a/libraries/TFT/examples/Esplora/EsploraTFTEtchASketch/EsploraTFTEtchASketch.ino b/libraries/TFT/examples/Esplora/EsploraTFTEtchASketch/EsploraTFTEtchASketch.ino
deleted file mode 100644
index 7d5b567e137..00000000000
--- a/libraries/TFT/examples/Esplora/EsploraTFTEtchASketch/EsploraTFTEtchASketch.ino
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
-
- Esplora TFT EtchASketch
-
- This example for the Arduino TFT and Esplora draws
- a white line on the screen, based on the position
- of the joystick. To clear the screen, shake the
- Esplora, using the values from the accelerometer.
-
- This example code is in the public domain.
-
- Created 15 April 2013 by Scott Fitzgerald
-
- http://www.arduino.cc/en/Tutorial/EsploraTFTEtchASketch
-
- */
-
-#include
-#include // Arduino LCD library
-#include
-
-// initial position of the cursor
-int xPos = EsploraTFT.width() / 2;
-int yPos = EsploraTFT.height() / 2;
-
-void setup() {
- // initialize the display
- EsploraTFT.begin();
-
- // clear the background
- EsploraTFT.background(0, 0, 0);
-}
-
-void loop() {
-
- int xAxis = Esplora.readJoystickX(); // read the X axis
- int yAxis = Esplora.readJoystickY(); // read the Y axis
-
- // update the position of the line
- // depending on the position of the joystick
- if (xAxis < 10 && xAxis > -10) {
- xPos = xPos;
- } else {
- xPos = xPos + (map(xAxis, -512, 512, 2, -2));
- }
- if (yAxis < 10 && yAxis > -10) {
- yAxis = yAxis;
- } else {
- yPos = yPos + (map(yAxis, -512, 512, -2, 2));
- }
-
- // don't let the point go past the screen edges
- if (xPos > 159) {
- (xPos = 159);
- }
-
- if (xPos < 0) {
- (xPos = 0);
- }
- if (yPos > 127) {
- (yPos = 127);
- }
-
- if (yPos < 0) {
- (yPos = 0);
- }
-
- // draw the point
- EsploraTFT.stroke(255, 255, 255);
- EsploraTFT.point(xPos, yPos);
-
- // check the accelerometer values and clear
- // the screen if it is being shaken
- if (abs(Esplora.readAccelerometer(X_AXIS)) > 200 || abs(Esplora.readAccelerometer(Y_AXIS)) > 200) {
- EsploraTFT.background(0, 0, 0);
- }
-
- delay(33);
-}
-
diff --git a/libraries/TFT/examples/Esplora/EsploraTFTGraph/EsploraTFTGraph.ino b/libraries/TFT/examples/Esplora/EsploraTFTGraph/EsploraTFTGraph.ino
deleted file mode 100644
index 24e0db6dd59..00000000000
--- a/libraries/TFT/examples/Esplora/EsploraTFTGraph/EsploraTFTGraph.ino
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
-
- Esplora TFT Graph
-
- This example for the Esplora with an Arduino TFT reads
- the value of the light sensor, and graphs the values on
- the screen.
-
- This example code is in the public domain.
-
- Created 15 April 2013 by Scott Fitzgerald
-
- http://www.arduino.cc/en/Tutorial/EsploraTFTGraph
-
- */
-
-#include
-#include // Arduino LCD library
-#include
-
-// position of the line on screen
-int xPos = 0;
-
-void setup() {
-
- // initialize the screen
- EsploraTFT.begin();
-
- // clear the screen with a nice color
- EsploraTFT.background(250, 16, 200);
-}
-
-void loop() {
-
- // read the sensor value
- int sensor = Esplora.readLightSensor();
- // map the sensor value to the height of the screen
- int graphHeight = map(sensor, 0, 1023, 0, EsploraTFT.height());
-
- // draw the line in a pretty color
- EsploraTFT.stroke(250, 180, 10);
- EsploraTFT.line(xPos, EsploraTFT.height() - graphHeight, xPos, EsploraTFT.height());
-
- // if the graph reaches the edge of the screen
- // erase it and start over from the other side
- if (xPos >= 160) {
- xPos = 0;
- EsploraTFT.background(250, 16, 200);
- } else {
- // increment the horizontal position:
- xPos++;
- }
-
- delay(16);
-}
diff --git a/libraries/TFT/examples/Esplora/EsploraTFTHorizon/EsploraTFTHorizon.ino b/libraries/TFT/examples/Esplora/EsploraTFTHorizon/EsploraTFTHorizon.ino
deleted file mode 100644
index 9a5a454d0e9..00000000000
--- a/libraries/TFT/examples/Esplora/EsploraTFTHorizon/EsploraTFTHorizon.ino
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
-
- Esplora TFT Horizon
-
- This example for the Arduino TFT and Esplora draws
- a line on the screen that stays level with the ground
- as you tile the Esplora side to side
-
- This example code is in the public domain.
-
- Created 15 April 2013 by Scott Fitzgerald
-
- http://www.arduino.cc/en/Tutorial/EsploraTFTHorizon
-
- */
-
-#include
-#include // Arduino LCD library
-#include
-
-// horizontal start and end positions
-int yStart = EsploraTFT.height() / 2;
-int yEnd = EsploraTFT.height() / 2;
-
-// previous start and end positions
-int oldEndY;
-int oldStartY;
-
-void setup() {
- // initialize the display
- EsploraTFT.begin();
- // make the background black
- EsploraTFT.background(0, 0, 0);
-}
-
-void loop() {
- // read the x-axis of te accelerometer
- int tilt = Esplora.readAccelerometer(X_AXIS);
-
- // the values are 100 when tilted to the left
- // and -100 when tilted to the right
- // map these values to the start and end points
- yStart = map(tilt, -100, 100, EsploraTFT.height(), 0);
- yEnd = map(tilt, -100, 100, 0, EsploraTFT.height());
-
- // if the previous values are different than the current values
- // erase the previous line
- if (oldStartY != yStart || oldEndY != yEnd) {
- EsploraTFT.stroke(0, 0, 0);
- EsploraTFT.line(0, oldStartY, EsploraTFT.width(), oldEndY);
- }
-
- // draw the line in magenta
- EsploraTFT.stroke(255, 0, 255);
- EsploraTFT.line(0, yStart, EsploraTFT.width(), yEnd);
-
- // save the current start and end points
- // to compare int he next loop
- oldStartY = yStart;
- oldEndY = yEnd;
- delay(10);
-}
diff --git a/libraries/TFT/examples/Esplora/EsploraTFTPong/EsploraTFTPong.ino b/libraries/TFT/examples/Esplora/EsploraTFTPong/EsploraTFTPong.ino
deleted file mode 100644
index 11b1dffa1b9..00000000000
--- a/libraries/TFT/examples/Esplora/EsploraTFTPong/EsploraTFTPong.ino
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
-
- Esplora TFT Pong
-
- This example for the Esplora with an Arduino TFT screen reads
- the value of the joystick to move a rectangular platform
- on the x and y axes. The platform can intersect with a ball
- causing it to bounce. The Esplora's slider adjusts the speed
- of the ball.
-
- This example code is in the public domain.
-
- Created by Tom Igoe December 2012
- Modified 15 April 2013 by Scott Fitzgerald
-
- http://www.arduino.cc/en/Tutorial/EsploraTFTPong
-
- */
-
-#include
-#include // Arduino LCD library
-#include
-
-// variables for the position of the ball and paddle
-int paddleX = 0;
-int paddleY = 0;
-int oldPaddleX, oldPaddleY;
-int ballDirectionX = 1;
-int ballDirectionY = 1;
-
-int ballX, ballY, oldBallX, oldBallY;
-
-void setup() {
-
- Serial.begin(9600);
-
- // initialize the display
- EsploraTFT.begin();
- // set the background the black
- EsploraTFT.background(0, 0, 0);
-}
-
-void loop() {
- // save the width and height of the screen
- int myWidth = EsploraTFT.width();
- int myHeight = EsploraTFT.height();
-
- // map the paddle's location to the joystick's position
- paddleX = map(Esplora.readJoystickX(), 512, -512, 0, myWidth) - 20 / 2;
- paddleY = map(Esplora.readJoystickY(), -512, 512, 0, myHeight) - 5 / 2;
- Serial.print(paddleX);
- Serial.print(" ");
- Serial.println(paddleY);
-
- // set the fill color to black and erase the previous
- // position of the paddle if different from present
- EsploraTFT.fill(0, 0, 0);
-
- if (oldPaddleX != paddleX || oldPaddleY != paddleY) {
- EsploraTFT.rect(oldPaddleX, oldPaddleY, 20, 5);
- }
-
- // draw the paddle on screen, save the current position
- // as the previous.
- EsploraTFT.fill(255, 255, 255);
- EsploraTFT.rect(paddleX, paddleY, 20, 5);
- oldPaddleX = paddleX;
- oldPaddleY = paddleY;
-
- // read the slider to determinde the speed of the ball
- int ballSpeed = map(Esplora.readSlider(), 0, 1023, 0, 80) + 1;
- if (millis() % ballSpeed < 2) {
- moveBall();
- }
-}
-
-
-// this function determines the ball's position on screen
-void moveBall() {
- // if the ball goes offscreen, reverse the direction:
- if (ballX > EsploraTFT.width() || ballX < 0) {
- ballDirectionX = -ballDirectionX;
- }
-
- if (ballY > EsploraTFT.height() || ballY < 0) {
- ballDirectionY = -ballDirectionY;
- }
-
- // check if the ball and the paddle occupy the same space on screen
- if (inPaddle(ballX, ballY, paddleX, paddleY, 20, 5)) {
- ballDirectionY = -ballDirectionY;
- }
-
- // update the ball's position
- ballX += ballDirectionX;
- ballY += ballDirectionY;
-
- // erase the ball's previous position
- EsploraTFT.fill(0, 0, 0);
-
- if (oldBallX != ballX || oldBallY != ballY) {
- EsploraTFT.rect(oldBallX, oldBallY, 5, 5);
- }
-
- // draw the ball's current position
- EsploraTFT.fill(255, 255, 255);
-
- EsploraTFT.rect(ballX, ballY, 5, 5);
-
- oldBallX = ballX;
- oldBallY = ballY;
-
-}
-
-// this function checks the position of the ball
-// to see if it intersects with the paddle
-boolean inPaddle(int x, int y, int rectX, int rectY, int rectWidth, int rectHeight) {
- boolean result = false;
-
- if ((x >= rectX && x <= (rectX + rectWidth)) &&
- (y >= rectY && y <= (rectY + rectHeight))) {
- result = true;
- }
-
- return result;
-}
diff --git a/libraries/TFT/examples/Esplora/EsploraTFTTemp/EsploraTFTTemp.ino b/libraries/TFT/examples/Esplora/EsploraTFTTemp/EsploraTFTTemp.ino
deleted file mode 100644
index a5c70817c08..00000000000
--- a/libraries/TFT/examples/Esplora/EsploraTFTTemp/EsploraTFTTemp.ino
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
-
- Esplora TFT Temperature Display
-
- This example for the Arduino TFT screen is for use
- with an Arduino Esplora.
-
- This example reads the temperature of the Esplora's
- on board thermisistor and displays it on an attached
- LCD screen, updating every second.
-
- This example code is in the public domain.
-
- Created 15 April 2013 by Scott Fitzgerald
-
- http://www.arduino.cc/en/Tutorial/EsploraTFTTemp
-
- */
-
-// include the necessary libraries
-#include