Sandesh G
/
gprs1
GSM_GPRS_TX_RX
Fork of gprs1 by
Revision 1:d6d00af5f72f, committed 2015-04-25
- Comitter:
- Lakshmikumar
- Date:
- Sat Apr 25 15:38:19 2015 +0000
- Parent:
- 0:a540c6fcb19b
- Commit message:
- gsmgrpstxrx
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r a540c6fcb19b -r d6d00af5f72f main.cpp --- a/main.cpp Sat Apr 25 11:23:43 2015 +0000 +++ b/main.cpp Sat Apr 25 15:38:19 2015 +0000 @@ -18,12 +18,71 @@ void flush(void); void barrer_set(); void gprs1_set(long int); + +/////////////////////////////////////////////////////////////////// +void flush(void) +{ +char char1 = 0; + while (GPRS.readable()) + { char1 = GPRS.getc(); } + return; + } +////////////////////////////////////////////////////////////////////////////////////////////////// +void barrer_set() +{ char *f; + GPRS.printf("AT+SAPBR=0,1\r\n"); + wait(2); + GPRS.printf("AT+SAPBR=3,1,\"Contype\",\"GPRS\"\r\n"); + wait(2); + GPRS.printf("AT+SAPBR=3,1,\"APN\",\"AIRTELGPRS.COM\"\r\n"); + wait(2); + flush(); + GPRS.printf("AT+SAPBR=1,1\r\n"); + GPRS.scanf("%s",f); + GPRS.scanf("%s",f); + wait(2); + if(f[0]!='O' && f[1]!='K') + barrer_set(); + } + +////////////////////////////////////////////////////////////////////////////////////////// +void gprs1_set(long int rfidno) +{ + char *f; + GPRS.printf("AT+HTTPINIT\r\n"); + wait(5); + GPRS.printf("AT+HTTPPARA=\"CID\",1\r\n"); + wait(5); + GPRS.printf("AT+HTTPPARA=\"URL\",\"http://www.abtsystem.netai.net/view.php?rfidno=%ld\"\r\n",rfidno); + wait(5); + GPRS.printf("AT+HTTPDATA=1000,5000\r\n"); + wait(2); + GPRS.printf("AT+HTTPACTION=1\r\n"); + wait(6); + barrer_set(); + GPRS.printf("AT+HTTPPARA=\"CID\",1\r\n"); + wait(5); + GPRS.printf("AT+HTTPPARA=\"URL\",\"http://www.abtsystem.netai.net/view.php?rfidno=%ld\"\r\n",rfidno); + wait(5); + GPRS.printf("AT+HTTPACTION=0\r\n"); + wait(5); + flush(); + GPRS.printf("AT+HTTPREAD\r\n"); + GPRS.scanf("%s",str); + GPRS.scanf("%s",str); + s1=str; + pc.printf("%s",s1); + lcd.printf("%s",s1); + GPRS.scanf("%s",str); + s2=str; + pc.printf("%s",s2); + lcd.printf("%s",s2); + } +//////////////////////////////////////////////////////////////////////////////////////////////////////// int main() { - pc.baud(9600); - GPRS.baud(9600); - - + GPRS.baud(9600); + lcd.cls(); lcd.printf("Swipe >> ");// RFID.scanf("%d", &rfidno); lcd.locate(0,0); @@ -32,73 +91,12 @@ pc.printf("%d",rfidno); pc.printf("\r \n"); wait(0.3); - lcd.locate(0,0); + lcd.cls(); - barrer_set(); - gprs1_set(rfidno); - - - + lcd.locate(0,0); + + barrer_set(); + gprs1_set(rfidno); } -void barrer_set() -{ - GPRS.printf("AT+SAPBR=0,1\r\n"); - wait(2); - GPRS.printf("AT+SAPBR=3,1,\"Contype\",\"GPRS\"\r\n"); - wait(2); - GPRS.printf("AT+SAPBR=3,1,\"APN\",\"AIRTELGPRS.COM\"\r\n"); - wait(2); - char *f; - flush(); - GPRS.printf("AT+SAPBR=1,1\r\n"); - while(!GPRS.readable()) - {} - GPRS.scanf("%s",f); - GPRS.scanf("%s",f); - if(f[0]!='O' && f[1]!='K' ) - barrer_set(); - } - void gprs1_set(long int rfidno) - { - char *f; - GPRS.printf("AT+HTTPINIT\r\n"); - wait(5); - GPRS.printf("AT+HTTPPARA=\"CID\",1\r\n"); - wait(5); - GPRS.printf("AT+HTTPPARA=\"URL\",\"http://www.abtsystem.netai.net/view.php?rfidno=%ld\"r\n",rfidno); - wait(5); - GPRS.printf("AT+HTTPDATA=1000,5000\r\n"); - wait(2); - GPRS.printf("AT+HTTPACTION=1\r\n"); - wait(6); - GPRS.printf("AT+HTTPPARA=\"CID\",1\r\n"); - wait(5); - flush(); - GPRS.printf("AT+SAPBR=1,1\r\n"); - while(!GPRS.readable()) - {} - GPRS.scanf("%s",f); - GPRS.scanf("%s",f); - if(f[0]!='O' && f[1]!='K' ) - wait(4); - GPRS.printf("AT+HTTPPARA=\"URL\",\"http://www.abtsystem.netai.net/view.php?rfidno=%ld\"r\n",rfidno); - wait(5); - GPRS.printf("AT+HTTPACTION=0\r\n"); - wait(5); - GPRS.printf("AT+HTTPREAD\r\n"); - GPRS.scanf("%s",str); - s1=str; - pc.printf("%s",s1); - lcd.printf("%s",s1); - GPRS.scanf("%s",str); - s2=str; - pc.printf("%s",s2); - lcd.printf("%s",s2); - } -void flush(void) -{ -char char1 = 0; - while (GPRS.readable()) - { char1 = GPRS.getc(); } - return; - } +//////////////////////////////////////////////////////////////////////////////////////////// + \ No newline at end of file