+#include <stdio.h>
+#include <stdlib.h> 
 #include <LiquidCrystal.h>
 #include <Servo.h>
+#include <SoftwareSerial.h>
+
+typedef struct{
+  String fisrt_name;
+  String last_name;
+  String phone_number;
+} Contact;
+
+void constact_set_first_name(String first_name, Contact* contact){
+  contact->fisrt_name = first_name;
+}
+
+void constact_set_last_name(String last_name, Contact* contact){
+  contact->last_name = last_name;
+}
+
+void constact_set_phone_num(String number, Contact* contact){
+  contact->phone_number = number;
+}
+
+void GPRS_init(){
+  // Enter PIN code: AT+CPIN=<pin>
+  Serial.write("AT+CPIN=1234\r");
+  delay(3000); // takes time to accept PIN
+}
+
+void GPRS_send_sms(String text){
+
+}
+
+
+void GPRS_send_sms(String text){
+
+}
 
 #define N_ENTRIES 2
 
 // device phone number: 0466259105 
-// SIM card pin: 1234
 
+SoftwareSerial GPRS(7, 8);
+unsigned char buffer[64]; // buffer array for data recieve over serial port
+int count=0;     // counter for buffer array 
 LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
 Servo gate;
 

  input.reserve(200);
  pinMode(LEDPIN, HIGH);
  gate.attach(9);
}

void loop() {
  serialEvent();
  lcd.home();
  if (stringComplete){ // when string is sent by pressing Enter
    for (int i = 0; i < N_ENTRIES; i++){
      Serial.println(authNumbers[i]); // debugging
      if (input == authNumbers[i]){
        lcd.print("Authorized");
        attempt = 0;
        lcd.setCursor(0,1);
        lcd.print("Attempt: ");
        lcd.print(attempt);
        digitalWrite(LEDPIN, HIGH);
        gate.write(gateMin);
        break; // no need to continue if matches at least one of numbers    
      }else {
        lcd.print("Unauthorized");
        lcd.setCursor(0,1);
        lcd.print("Attempt: ");
        attempt++;
        lcd.print(attempt);   
        digitalWrite(LEDPIN, LOW);
        gate.write(gateMax);
      }
    }
    stringComplete = false; 
    input = ""; 
  }
}

void serialEvent(){

  }
}

void clearBufferArray(){
  for (int i=0; i<count;i++)
    buffer[i]=NULL;
}
