Had to fork with a different name, because of some incompatibility issues.

Dependencies:   MQTT

Revision:
18:ce12e2072cbb
Parent:
12:ac091f717e40
Child:
19:85e9bc1a3a6a
--- a/DeviceClient.cpp	Tue Sep 17 23:40:07 2019 +0000
+++ b/DeviceClient.cpp	Sun Oct 20 23:21:52 2019 -0400
@@ -86,7 +86,7 @@
     // Check if any organization is set
     if(this->org == NULL || (strcmp("", this->org) == 0))
     {
-        organizationName = QUICKSTART;
+        organizationName = (char*)QUICKSTART;
     } else {
         organizationName = this->org;
     }
@@ -94,7 +94,7 @@
     // Check if device type is already mentioned
     if(this->deviceType == NULL || (strcmp("", this->deviceType) == 0))
     {
-        typeId = "iotsample-mbed";
+        typeId = (char*)"iotsample-mbed";
     } else {
         typeId = this->deviceType;
     }
@@ -102,7 +102,9 @@
     char hostname[strlen(organizationName) + strlen(IBM_IOT_MESSAGING) + 1];
     sprintf(hostname, "%s%s", organizationName, IBM_IOT_MESSAGING);
 
-    NetworkInterface* net = mqttNetwork->getEth();
+    //NetworkInterface* net = mqttNetwork->getEth();
+    NetworkInterface* net = mqttNetwork->network;
+
     const char* ip = net->get_ip_address();
 
     // Get devices MAC address if deviceId is not set already
@@ -127,7 +129,7 @@
 
     if (!quickstartMode)
     {
-        data.username.cstring = "use-token-auth";
+        data.username.cstring = (char*)"use-token-auth";
         data.password.cstring = this->authToken;
 
         //Check and initialize appropriate port
@@ -172,7 +174,8 @@
 
     if(linkStatus())
     {
-        NetworkInterface* net = mqttNetwork->getEth();
+        //NetworkInterface* net = mqttNetwork->getEth();
+        NetworkInterface* net = mqttNetwork->network;
         if(net->connect() == 0)
         {
             bool status = connect();
@@ -356,7 +359,8 @@
         rc = mqttClient->disconnect();
     }
 
-    NetworkInterface* net = mqttNetwork->getEth();
+    //NetworkInterface* net = mqttNetwork->getEth();
+    NetworkInterface* net = mqttNetwork->network;
     mqttNetwork->disconnect();
     net->disconnect();
     connected = false;
@@ -385,7 +389,8 @@
 // Obtain MAC address
 char* DeviceClient::getMac(char* buf, int buflen)
 {
-    NetworkInterface* net = mqttNetwork->getEth();
+    //NetworkInterface* net = mqttNetwork->getEth();
+    NetworkInterface* net = mqttNetwork->network;
     strncpy(buf, net->get_mac_address(), buflen);
 
     char* pos;                                                 // Remove colons from mac address
@@ -397,7 +402,8 @@
 char* DeviceClient::ipaddress() {
     //char iplocal[25];
     
-    NetworkInterface* net = mqttNetwork->getEth();
+    //NetworkInterface* net = mqttNetwork->getEth();
+    NetworkInterface* net = mqttNetwork->network;
     //const char* ip = net->get_ip_address();
     
     //strcpy(iplocal,ip);