Microsoft Azure IoTHub client MQTT transport

Dependents:   STM32F746_iothub_client_sample_mqtt FXOS8700CQ_To_Azure_IoT f767zi_mqtt FXOS8700CQ_To_Azure_IoT ... more

Revision:
8:418a3b812584
Parent:
7:7fdd306e6224
Child:
9:50744bd8239e
--- a/iothubtransportmqtt.c	Fri Jul 29 15:53:03 2016 -0700
+++ b/iothubtransportmqtt.c	Fri Aug 12 10:03:50 2016 -0700
@@ -13,6 +13,7 @@
 #include "azure_c_shared_utility/crt_abstractions.h"
 
 #include "iothub_client_ll.h"
+#include "iothub_client_options.h"
 #include "iothub_client_private.h"
 #include "iothubtransportmqtt.h"
 #include "azure_umqtt_c/mqtt_client.h"
@@ -1319,13 +1320,13 @@
     {
         MQTTTRANSPORT_HANDLE_DATA* transportState = (MQTTTRANSPORT_HANDLE_DATA*)handle;
         /* Codes_SRS_IOTHUB_MQTT_TRANSPORT_07_031: [If the option parameter is set to "logtrace" then the value shall be a bool_ptr and the value will determine if the mqtt client log is on or off.] */
-        if (strcmp("logtrace", option) == 0)
+        if (strcmp(OPTION_LOG_TRACE, option) == 0)
         {
             bool* traceVal = (bool*)value;
             mqtt_client_set_trace(transportState->mqttClient, *traceVal, *traceVal);
             result = IOTHUB_CLIENT_OK;
         }
-        else if (strcmp("keepalive", option) == 0)
+        else if (strcmp(OPTION_KEEP_ALIVE, option) == 0)
         {
             /* Codes_SRS_IOTHUB_MQTT_TRANSPORT_07_036: [If the option parameter is set to "keepalive" then the value shall be a int_ptr and the value will determine the mqtt keepalive time that is set for pings.] */
             int* keepAliveOption = (int*)value;
@@ -1342,13 +1343,13 @@
             result = IOTHUB_CLIENT_OK;
         }
         /* Codes_SRS_IOTHUB_MQTT_TRANSPORT_07_039: [If the option parameter is set to "x509certificate" then the value shall be a const char of the certificate to be used for x509.] */
-        else if ((strcmp("x509certificate", option) == 0) && (transportState->transport_creds.credential_type != X509))
+        else if ((strcmp(OPTION_X509_CERT, option) == 0) && (transportState->transport_creds.credential_type != X509))
         {
             LogError("x509certificate specified, but authentication method is not x509");
             result = IOTHUB_CLIENT_INVALID_ARG;
         }
         /* Codes_SRS_IOTHUB_MQTT_TRANSPORT_07_040: [If the option parameter is set to "x509privatekey" then the value shall be a const char of the RSA Private Key to be used for x509.] */
-        else if ((strcmp("x509privatekey", option) == 0) && (transportState->transport_creds.credential_type != X509))
+        else if ((strcmp(OPTION_X509_PRIVATE_KEY, option) == 0) && (transportState->transport_creds.credential_type != X509))
         {
             LogError("x509privatekey specified, but authentication method is not x509");
             result = IOTHUB_CLIENT_INVALID_ARG;