STM32F103C8T6_Internal_RTC

Dependencies:   mbed-STM32F103C8T6 mbed

Fork of STM32F103C8T6_GPRS_TCP by Shivanand Gowda

Revision:
12:91de57777095
Parent:
10:4b88be251088
Child:
13:bf9a5ca067bf
diff -r c050fcabba46 -r 91de57777095 main.cpp
--- a/main.cpp	Mon Jun 26 13:53:25 2017 +0000
+++ b/main.cpp	Fri Jul 13 07:36:58 2018 +0000
@@ -1,20 +1,107 @@
 #include "stm32f103c8t6.h"
 #include "mbed.h"
-  
-int main() {
-    confSysClock();     //Configure system clock (72MHz HSE clock, 48MHz USB clock)
+#include "gprs.h"
+
+    char Server[20]="119.81.0.11" ;              //write your Server IP here shoud be a static IP
+    char Port[5]="8080";                         // write your port Number 
+    char Phone_No[11]="1234567890";
+    char Service_Provider[40]="airtelgprs.com";
+    char Data[100]="Hellow World to Server";
     
     Serial      pc(PA_2, PA_3);
     DigitalOut  myled(LED1);
-    
-    while(1) {
-        // The on-board LED is connected, via a resistor, to +3.3V (not to GND). 
-        // So to turn the LED on or off we have to set it to 0 or 1 respectively
+    GPRS   gprs(PB_6,PB_7,9600,Phone_No);
+    char Reply[100]={'\0'};
+int main()
+ {
+    confSysClock();     
         myled = 0;      // turn the LED on
         wait_ms(200);   // 200 millisecond
         myled = 1;      // turn the LED off
         wait_ms(1000);  // 1000 millisecond
         pc.printf("Blink\r\n");
+        
+          
+    pc.printf("Am here.... GOOD\r\n"); 
+    gprs.init();
+    if(gprs.checkSIMStatus()==0)
+    { 
+        pc.printf("SIM Status is GOOD\r\n"); 
+        }
+    else
+    {
+        pc.printf("SIM NOT Preset \r\n"); 
+        }
+    
+     if(gprs.checkSignalStrength ()>=3)
+     {
+         pc.printf("Signal strength Good \r\n");  
+           
+        }  
+        else
+        {
+        pc.printf("Signal strength Weak\r\n");  
+        }
+        
+        if(gprs.checkSIMStatus()==0)
+        {
+             pc.printf("SIM Status is GOOD\r\n"); 
+        }  
+            
+        else
+        {
+             pc.printf("SIM NOT Present \r\n"); 
+        }  
+        
+//        gprs.networkInit( "202.56.231.117:8080");
+         int success= gprs.networkInit(Service_Provider);   //write your apn here
+         if(success==0)
+         pc.printf("Network Initialised \r\n");
+         else
+         pc.printf("Unable Initialise Network  \r\n");
+          
+          
+          success=gprs.connectTCP(Server,Port);
+          
+         if(success==0)
+         pc.printf("Connected to Server  \r\n");
+         else
+         pc.printf("Unable connect to Server   \r\n");
+         
+         success= gprs.sendTCPData(Data);
+         
+         if(success==0)
+         pc.printf("Data Sent  \r\n");
+         else
+         pc.printf("Unable connect to Server   \r\n");
+         
+         success=gprs.waitforReply(Reply);
+         
+         if(success==0)
+         pc.printf("Data Received form Server  \r\n");
+         else
+         pc.printf("No Reply from Server \r\n");
+
+         success=gprs.closeTCP();
+         
+         if(success==0)
+         pc.printf("Close TCP Connection  \r\n");
+         else
+         pc.printf("Unable to detach from Server \r\n");
+         
+         success=gprs.shutTCP();
+         
+         if(success==0)
+         pc.printf("Shut TCP Connection  \r\n");
+         else
+         pc.printf("Unable to Shut TCP Connection \r\n");
+        
     }
-}
- 
\ No newline at end of file
+        
+    
+    
+
+ 
+ 
+
+