V.06 11/3

Dependencies:   FT6206 SDFileSystem SPI_TFT_ILI9341 TFT_fonts

Fork of ATT_AWS_IoT_demo by attiot

Revision:
29:f71a0be59b99
Parent:
28:54d9a550adf1
--- a/AWS_openssl/aws_iot_src/protocol/mqtt/aws_iot_embedded_client_wrapper/platform_mbed_os/openssl/network.cpp	Mon Oct 09 21:13:49 2017 +0000
+++ b/AWS_openssl/aws_iot_src/protocol/mqtt/aws_iot_embedded_client_wrapper/platform_mbed_os/openssl/network.cpp	Fri Nov 03 20:28:02 2017 +0000
@@ -27,29 +27,35 @@
 // Network socket
 WNCTCPSocketConnection* _tcpsocket;
 
+WNCInterface eth_iface;
+
 int net_modem_boot()
 {
     INFO("Booting WNC modem...");
     int rc = -1;
     string str;
-    WNCInterface eth_iface;
+    //WNCInterface eth_iface;
     
     INFO("...Using Avnet Shield and AT&T wireless LTE");
-    rc = eth_iface.init(NULL, &pc);                   
+    rc = eth_iface.init(NULL, &pc);    
+    if( !rc ) 
+    {
+        ERROR("DHCP failed.");
+        return 1;
+    }               
     INFO("WNC Module %s initialized (%02X).", rc?"IS":"IS NOT", rc);
     
-    //ji if test card, skip for now
-    
-    if( !rc ) {
-        ERROR("DHCP failed.");
-        return rc;
-    }
-    
-    eth_iface.connect();
+  
+    rc = eth_iface.connect();
+    if(rc !=0 ) 
+    {
+        ERROR("Connection failed.");
+        return 1;
+    }               
+
     INFO("...IP Address: %s ", eth_iface.getIPAddress());
     
-    
-    
+        
     // Get SIM card number (ICCID)
     eth_iface.getICCID(&str);
     strcpy(iccidName, str.c_str());
@@ -59,9 +65,65 @@
     //INFO("Reading Certificate");
     //eth_iface.getObject();
     
-    return rc;
+    return 0;
+}
+
+int GetSignalStrength(int16_t *dbm)
+{
+    INFO("Reading Signal Strength...");
+    int16_t rc = 0;
+    string str;
+  
+    rc = eth_iface.getSignalStrength();
+    if(rc ==99 ) 
+    {
+        ERROR("Get Signal Strength Failed.");
+        return 1;
+    }               
+
+    INFO("...Singal Strength: %d", rc);
+
+    *dbm = rc;
+        
+    return 0;
 }
 
+int GetUpdateStatus(unsigned char *cStatus)
+{
+    INFO("Reading Update Status...");
+    bool rc = 0;
+    string str;
+  
+    rc = eth_iface.getUpdateStatus(cStatus);
+    if(rc == false) 
+    {
+        ERROR("Get Update Status Failed.");
+        return 1;
+    }               
+
+    INFO("...Update Status: %02X", *cStatus);
+
+    return 0;
+}
+
+int GetAllObjects()
+{
+    INFO("Reading All Objects...");
+    int16_t rc = 0;
+    string str;
+  
+    rc = eth_iface.getAllObjects();
+    if(rc == 0 ) 
+    {
+        ERROR("Read All Objects Failed.");
+        return 1;
+    }               
+
+        
+    return 0;
+}
+
+
 void mbedtls_net_init( mbedtls_net_context *ctx )
 {
     DEBUG("...mbedtls_net_init()");