 
 
 char address[] = "www.google.com";
-unsigned char buf[50];
+unsigned char buf[70];
 
 // GPS serial port
 SoftwareSerial mySerial(3, 2);

        debug.println((char *)towers.cell[i].lac);
        debug.println((char *)towers.cell[i].strength);
    }
    for (i = 0; i < 3; i++)
    {
        fill_packet(i);

        ret_val = gsm.OpenTCPSocket(address, 80);
        if (ret_val)
        {
            //debug.println("TCP Open");
        }
        else
        {
            //debug.println("TCP Open Error");
        }
#if 1
        ret_val = gsm.SendTCPdata(header, packet, NULL);
        if (ret_val)
        {
            //debug.println("Send OK");
            char *ptr = strstr((char *)gsm.comm_buf, "\r\n\r\n");
            char *t;
            if (ptr)
            {
                ptr += 5;
                memcpy((char *)buf, ptr, 20);
                /*for(char i=0;i<20;i++)
                {
                    debug.println((unsigned char)buf[i], HEX);
                }*/
                unsigned long lat, lgt;
                char str[20];
                lat = (unsigned long)buf[6] << 24;
                lat += (unsigned long)buf[7] << 16;
                lat += (unsigned long)buf[8] << 8;
                lat += (unsigned long)buf[9];
                sprintf((char *)str, "%ld", lat);
                debug.print((char *)str);

                lgt = (unsigned long)buf[10] << 24;
                lgt += (unsigned long)buf[11] << 16;
                lgt += (unsigned long)buf[12] << 8;
                lgt += (unsigned long)buf[13];
                sprintf((char *)str, "%ld", lgt);
                debug.println((char *)str);

                towers.cell[i].latitude = (float)lat / 1000000;
                towers.cell[i].longitude = (float)lgt / 1000000;
                debug.print(towers.cell[i].latitude, 6);
                debug.print(",");
                debug.println(towers.cell[i].longitude, 6);
            }
        }
        else
        {
            debug.println("Send Error");
        }
    }
#endif
    triangulate();
}

uint32_t timer = millis();

#include <SoftwareSerial.h>
#include "GPS.h"

#define BUTTON 7

signed char ret_val;
uint16_t num_of_rx_bytes;
