#include <SoftwareSerial.h>
 
SoftwareSerial GPRS(7, 8);
char incoming[64]; // buffer array for data recieve over serial port
int count=0;     // counter for buffer array 
void setup()
{
//  POWER_UP();
  GPRS.begin(19200);               // the GPRS baud rate   
  Serial.begin(19200);             // the Serial port of Arduino baud rate.
 
}
 
void clearBufferArray()              // function to clear buffer array
{
  for (int i=0; i<count;i++)
    { incoming[i]=NULL;}                  // clear all index of array with command NULL
}


void getCommand(char *incomingData)
{

 int incomingDataIndex = 0;

 while(GPRS.available())
 {
   incomingData[incomingDataIndex] = GPRS.read();
   incomingDataIndex++;
   incomingData[incomingDataIndex] = '\0';
 }

}

void loop()
{

 char incomingData[64];
 getCommand(incomingData);
 Serial.print(incomingData);
 clearBufferArray();              // call clearBufferArray function to clear the storaged data from the array
    count = 0;  
}
