Azure IoT / iothub_client

Dependents:   sht15_remote_monitoring RobotArmDemo iothub_client_sample_amqp f767zi_mqtt ... more

Revision:
88:248736be106e
Child:
92:97148cf9aa2a
diff -r 127f440f845b -r 248736be106e internal/iothub_client_diagnostic.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/internal/iothub_client_diagnostic.h	Mon Jun 11 15:39:23 2018 -0700
@@ -0,0 +1,48 @@
+// Copyright (c) Microsoft. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
+/** @file   iothub_client_diagnostic.h
+*	@brief  The @c diagnostic is a component that helps to add predefined diagnostic 
+            properties to message for end to end diagnostic purpose
+*/
+
+#ifndef IOTHUB_CLIENT_DIAGNOSTIC_H
+#define IOTHUB_CLIENT_DIAGNOSTIC_H
+
+#include "azure_c_shared_utility/umock_c_prod.h"
+
+#include "iothub_message.h"
+#include <stdint.h>
+
+#ifdef __cplusplus
+#include <cstddef>
+extern "C" {
+#else
+#include <stddef.h>
+#endif
+
+/** @brief diagnostic related setting */
+typedef struct IOTHUB_DIAGNOSTIC_SETTING_DATA_TAG
+{
+    uint32_t diagSamplingPercentage;
+    uint32_t currentMessageNumber;
+} IOTHUB_DIAGNOSTIC_SETTING_DATA;
+
+/**
+    * @brief	Adds diagnostic information to message if: 
+    *           a. diagSetting->diagSamplingPercentage > 0 and
+    *           b. the number of current message matches sample rule specified by diagSetting->diagSamplingPercentage
+    *
+    * @param	diagSetting		Pointer to an @c IOTHUB_DIAGNOSTIC_SETTING_DATA structure
+    *
+    * @param	messageHandle	message handle 
+    *
+    * @return	0 upon success
+    */
+MOCKABLE_FUNCTION(, int, IoTHubClient_Diagnostic_AddIfNecessary, IOTHUB_DIAGNOSTIC_SETTING_DATA *, diagSetting, IOTHUB_MESSAGE_HANDLE, messageHandle);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* IOTHUB_CLIENT_DIAGNOSTIC_H */