IoTHub raw messaging client sample using AMQP

Dependencies:   iothub_client EthernetInterface NTPClient iothub_amqp_transport azure_c_shared_utility mbed-rtos mbed azure_uamqp_c wolfSSL

This sample showcases the usage of Azure IoT client libraries with the AMQP transport for sending/receiving raw messages from an IoT Hub.

Files at this revision

API Documentation at this revision

Comitter:
AzureIoTClient
Date:
Wed Jan 17 08:59:10 2018 -0800
Parent:
84:bc65f4d2e03d
Commit message:
1.1.30

Changed in this revision

azure_c_shared_utility.lib Show annotated file Show diff for this revision Revisions of this file
iothub_amqp_transport.lib Show annotated file Show diff for this revision Revisions of this file
iothub_client.lib Show annotated file Show diff for this revision Revisions of this file
iothub_client_sample_amqp.c Show annotated file Show diff for this revision Revisions of this file
--- a/azure_c_shared_utility.lib	Fri Dec 15 14:11:17 2017 -0800
+++ b/azure_c_shared_utility.lib	Wed Jan 17 08:59:10 2018 -0800
@@ -1,1 +1,1 @@
-https://developer.mbed.org/users/AzureIoTClient/code/azure_c_shared_utility/#f0dc2835e9e0
\ No newline at end of file
+https://developer.mbed.org/users/AzureIoTClient/code/azure_c_shared_utility/#ed9c888e5e12
\ No newline at end of file
--- a/iothub_amqp_transport.lib	Fri Dec 15 14:11:17 2017 -0800
+++ b/iothub_amqp_transport.lib	Wed Jan 17 08:59:10 2018 -0800
@@ -1,1 +1,1 @@
-https://developer.mbed.org/users/AzureIoTClient/code/iothub_amqp_transport/#c688c75b63b9
\ No newline at end of file
+https://developer.mbed.org/users/AzureIoTClient/code/iothub_amqp_transport/#8a238e75a0f7
\ No newline at end of file
--- a/iothub_client.lib	Fri Dec 15 14:11:17 2017 -0800
+++ b/iothub_client.lib	Wed Jan 17 08:59:10 2018 -0800
@@ -1,1 +1,1 @@
-http://mbed.org/users/AzureIoTClient/code/iothub_client/#db5f5237bc95
\ No newline at end of file
+http://mbed.org/users/AzureIoTClient/code/iothub_client/#8de701563187
\ No newline at end of file
--- a/iothub_client_sample_amqp.c	Fri Dec 15 14:11:17 2017 -0800
+++ b/iothub_client_sample_amqp.c	Wed Jan 17 08:59:10 2018 -0800
@@ -177,9 +177,16 @@
             IoTHubClient_LL_SetOption(iotHubClientHandle, OPTION_LOG_TRACE, &traceOn);
 
             // Set keep alive is optional. If it is not set the default (240 secs) will be used.
-            uint32_t c2d_keep_alive_freq_secs = 120;
-            IoTHubClient_LL_SetOption(iotHubClientHandle, OPTION_C2D_KEEP_ALIVE_FREQ_SECS, &c2d_keep_alive_freq_secs);
+            uint32_t svc2cl_keep_alive_timeout_secs = 120; // service will send pings at 120 x 7/8 = 105 seconds. Higher the value, lesser the frequency of service side pings.
+            IoTHubClient_LL_SetOption(iotHubClientHandle, OPTION_SERVICE_SIDE_KEEP_ALIVE_FREQ_SECS, &svc2cl_keep_alive_timeout_secs);
 
+			// Set keep alive for remote idle is optional. If it is not set the default ratio of 1/2 will be used. For default value of 4 minutes, it will be 2 minutes (120 seconds)
+            double cl2svc_keep_alive_send_ratio = 7.0 / 8.0; // Set it to 210 seconds (240 x 7/8 = 210 seconds) for 4 minutes remote idle. Set it to 21 minutes for 25 minutes remote idle increased on per-hub basis via Support Request (SR)
+            if (IoTHubClient_LL_SetOption(iotHubClientHandle, OPTION_REMOTE_IDLE_TIMEOUT_RATIO, &cl2svc_keep_alive_send_ratio) != IOTHUB_CLIENT_OK) // client will send pings to service at 210 second interval for 4 minutes remote idle. For 25 minutes remote idle, it will be set to 21 minutes.
+			{
+			    (void)printf("ERROR: IoTHubClient_remote_idle_timeout_ratio..........FAILED!\r\n");
+			}
+			
 #ifdef SET_TRUSTED_CERT_IN_SAMPLES
             // For mbed add the certificate information
             if (IoTHubClient_LL_SetOption(iotHubClientHandle, OPTION_TRUSTED_CERT, certificates) != IOTHUB_CLIENT_OK)