gsm shield 908

hii…

I want to learn to change the source code of Ethernet use this source code but I do not know how to change it into a source code that uses the GSM SHIELD 908 that can send the water pH measurement results to my phone, … please help …

This is the source code…

#define PH_DEVICE_PIN 0 // digital
#define USE_MINI_PH_DEVICE
#define WIFI_PIN 0 // digital
#define TEMPERATURE_SENSOR_PIN 2 // digital
#define USE_DS18B20_DEVICE
#define DHT22_SENSOR_PIN 6 // digital
#define USE_TSL2561_DEVICE
#define USE_DISPLAY

// pH Calibration settings
#define PH_7_VALUE 2048
#define PH_4_VALUE 1286

#define DATA_SET_ID dataSetId // Add your data set ID here
#define HOST “www.manylabs.org
#define PATH “/data/rpc/appendData/”
#define HEADERS “Content-Type: application/x-www-form-urlencoded\r\n”

// include files for libraries
#include <TSL2561.h>
#include “DHT22.h”
#include “Wire.h”
#include “SeeedOLED.h”
#include “OneWire.h”
#include “WireGarden.h”

#include <String.h>
#include <SPI.h>
#include <EthernetV2_0.h>

// global variables (shared between all functions)

// MAC address for the ethernet controller.
// This must be unique on the network
byte mac = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
EthernetClient client;

unsigned long lastTime = 0;
unsigned long lastDisplayTime = 0;
unsigned long lastConnectionTime = 0; // last time you connected to the server, in milliseconds
boolean lastConnected = false; // state of the connection last time through the main loop
#define W5200_CS 10
#define SDCARD_CS 4

#define PARAM_BUFFER_LENGTH 100
char paramBuffer[ PARAM_BUFFER_LENGTH ];
int paramBufferPos = 0;
int paramCount = 0;

float sensorReading = 0.0;

MiniPhDevice phDevice;
DSDevice temperatureSensor( TEMPERATURE_SENSOR_PIN );
DHT22 dht( DHT22_SENSOR_PIN );
TSLDevice digitalLight;

// sensors
float mPH = 0.0;
float mWater_temp_c = 0.0;
float mAir_temp_c = 0.0;
float mLight = 0.0;

void setup() {

// configure USB/serial comunication with computer
Serial.begin(9600);

// init OLED display
initDisplay();

// Deselect the SD card on the Ethernet Shield
pinMode(SDCARD_CS,OUTPUT);
digitalWrite(SDCARD_CS,HIGH);//Deselect the SD card

// give the ethernet module time to boot up:
delay(1000);

Serial.println(“Configuring Ethernet”);
// start the Ethernet connection:
if (Ethernet.begin(mac) == 0) {
Serial.println(“Failed to configure Ethernet using DHCP”);
// If the DHCP failed, you can use a fixed IP address: (We’re not doing this)
// Ethernet.begin(mac, ip);
}else{
Serial.println(“Ethernet Configured”);
}

phDevice.setCalib7(PH_7_VALUE);
phDevice.setCalib4(PH_4_VALUE);
}

void loop() {

// if enough time has elapsed since last loop, run the processSensors()
// and sendSensors functions
unsigned long time = millis();
if (time - lastDisplayTime > 5000) {
lastDisplayTime = time;
processSensors();
}
if (!client.connected() && (time - lastTime > 30000) ) {
lastTime = time;

sendSensors(mPH, mWater_temp_c, mAir_temp_c, mLight);
}

// if there’s no connection, but there was one last time through the loop,
// then stop the client
if (!client.connected() && lastConnected) {
Serial.println();
Serial.println(“disconnecting.”);
client.stop();
}

// store the state of the connection for next time through the loop
lastConnected = client.connected();

// This is for debugging the ethernet connection
// if there’s incoming data from the connection send it out the serial port
// if (client.available()) {
// char c = client.read();
// Serial.print(c);
// }

}

// this function is run periodically to get values from sensors and to act upon those sensor values
void processSensors() {
DHT22_ERROR_t errorCode = dht.readData();
if(errorCode == DHT_ERROR_NONE){
mAir_temp_c = dht.getTemperatureC();
}
mPH = phDevice.pH();
mWater_temp_c = temperatureSensor.value();
digitalLight.refresh();
mLight = digitalLight.visibleLuminosity();
displayRow( 0, “pH”, mPH, 2 );
displayRow( 1, “water C”, mWater_temp_c, 2 );
displayRow( 2, “air C”, mAir_temp_c, 2 );
displayRow( 3, “light”, mLight, 2 );
}

void sendSensors( float pH, float water_temp_c, float air_temp_c, float light ) {
displayRow( 4, “sending”, 0, 0 );
add( “dataSetId”, DATA_SET_ID );
add( “addTimestamp”, 1 );
add( “pH”, pH, 0 );
add( “water_temp_c”, water_temp_c, 2 );
add( “air_temp_c”, air_temp_c, 2 );
add( “light”, light, 2 );

if(sendData()){
displayRow( 4, “complete”, 1, 0 );
}else{
displayRow( 4, “not sent”, 1, 0 );
}
}

// this method makes a HTTP connection to the server:
bool sendData() {
bool error = true;
// if there’s a successful connection:
if (client.connect(HOST, 80)) {
Serial.println(“connecting…”);

client.print(“POST “);
client.print(PATH);
client.println(” HTTP/1.1”);

client.print("Host: ");
client.println(HOST);
client.print("Content-Length: ");
client.println(strlen(paramBuffer));

// last pieces of the HTTP request:
client.println(“Content-Type: application/x-www-form-urlencoded”);
client.println(“Connection: close”);
client.println();

// here’s the actual content of the request:
client.println(paramBuffer);
error = false;
} else {
// if you couldn’t make a connection:
Serial.println(“connection failed”);
Serial.println();
Serial.println(“disconnecting.”);
client.stop();
}
// Clear for next time
paramBuffer[ 0 ] = 0;
paramBufferPos = 0;
paramCount = 0;

// note the time that the connection was made or attempted:
lastConnectionTime = millis();
return error;
}

// These functions add data to the buffer for the Ethernet Shield to send:

void append( const char *str ) {
while (str[ 0 ]) {
paramBuffer[ paramBufferPos++ ] = str[ 0 ];
str++;
if (paramBufferPos + 1 >= PARAM_BUFFER_LENGTH) // leave room for zero terminator
break;
}
paramBuffer[ paramBufferPos ] = 0; // add zero terminator
}

// add a value to transmit with the next call to send()
void add( const char *name, const char *value ) {
if (paramCount)
append( “&” );
append( name );
append( “=” );
append( value );
paramCount++;
}

// add a value to transmit with the next call to send()
void add( const char *name, long value ) {
if (paramBufferPos + 12 < PARAM_BUFFER_LENGTH) {
if (paramCount)
append( “&” );
append( name );
append( “=” );
ltoa( value, paramBuffer + paramBufferPos, 10 );
while (paramBuffer[ paramBufferPos ] && paramBufferPos < PARAM_BUFFER_LENGTH) // find new end of string
paramBufferPos++;
paramCount++;
}
}

// add a value to transmit with the next call to send()
void add( const char *name, double value, byte decimalPlaces ) {
if (paramBufferPos + 15 < PARAM_BUFFER_LENGTH) { // we’ll assume that the value doesn’t have more than 14 digits
if (paramCount)
append( “&” );
append( name );
append( “=” );
dtostrf( value, decimalPlaces, decimalPlaces, paramBuffer + paramBufferPos );
while (paramBuffer[ paramBufferPos ] && paramBufferPos < PARAM_BUFFER_LENGTH) // find new end of string
paramBufferPos++;
paramCount++;
}
}

// add a value to transmit with the next call to send()
void add( const char *name, float value, byte decimalPlaces ) {
add( name, (double) value, decimalPlaces );
}

// add a value to transmit with the next call to send()
void add( const char *name, int value ) {
add( name, (long) value );
}