Microsoft Azure IoTHub client libraries
Dependents: sht15_remote_monitoring RobotArmDemo iothub_client_sample_amqp f767zi_mqtt ... more
This library implements the Microsoft Azure IoTHub client library. The code is replicated from https://github.com/Azure/azure-iot-sdks
Diff: iothub_client_diagnostic.c
- Revision:
- 88:248736be106e
- Parent:
- 77:e4e36df9caee
- Child:
- 89:a2ed767a532e
--- a/iothub_client_diagnostic.c Fri May 04 13:24:17 2018 -0700 +++ b/iothub_client_diagnostic.c Mon Jun 11 15:39:23 2018 -0700 @@ -9,7 +9,7 @@ #include "azure_c_shared_utility/agenttime.h" #include "azure_c_shared_utility/buffer_.h" -#include "iothub_client_diagnostic.h" +#include "internal/iothub_client_diagnostic.h" #define TIME_STRING_BUFFER_LEN 30 @@ -28,8 +28,8 @@ LogError("Failed getting current time"); result = NULL; } - else if (timeLen == sizeof(int64_t)) - { + else if (timeLen == sizeof(int64_t)) + { long long llTime = (long long)epochTime; if (sprintf(timeBuffer, "%lld", llTime) < 0) { @@ -40,9 +40,9 @@ { result = timeBuffer; } - } - else if (timeLen == sizeof(int32_t)) - { + } + else if (timeLen == sizeof(int32_t)) + { if (sprintf(timeBuffer, "%d", (int32_t)epochTime) < 0) { LogError("Failed sprintf to timeBuffer with 4 bytes of time_t"); @@ -52,7 +52,7 @@ { result = timeBuffer; } - } + } else { LogError("Unknow size of time_t"); @@ -69,7 +69,7 @@ static char* generate_eight_random_characters(char *randomString) { - int i; + int i; char* randomStringPos = randomString; for (i = 0; i < 4; ++i) { @@ -89,9 +89,9 @@ bool result = false; if (diagSetting->diagSamplingPercentage > 0) { - double number; - double percentage; - + double number; + double percentage; + if (diagSetting->currentMessageNumber == UINT32_MAX) { diagSetting->currentMessageNumber %= diagSetting->diagSamplingPercentage * 100; @@ -123,8 +123,8 @@ } else { - char* timeBuffer; - + char* timeBuffer; + (void)generate_eight_random_characters(diagId); result->diagnosticId = diagId;