Xin Zhang / azure-iot-c-sdk-f767zi

Dependents:   samplemqtt

Committer:
XinZhangMS
Date:
Thu Aug 23 06:52:14 2018 +0000
Revision:
0:f7f1f0d76dd6
azure-c-sdk for mbed os supporting NUCLEO_F767ZI

Who changed what in which revision?

UserRevisionLine numberNew contents of line
XinZhangMS 0:f7f1f0d76dd6 1 // Copyright (c) Microsoft. All rights reserved.
XinZhangMS 0:f7f1f0d76dd6 2 // Licensed under the MIT license. See LICENSE file in the project root for full license information.
XinZhangMS 0:f7f1f0d76dd6 3
XinZhangMS 0:f7f1f0d76dd6 4 // This file is under development and it is subject to change
XinZhangMS 0:f7f1f0d76dd6 5
XinZhangMS 0:f7f1f0d76dd6 6 #ifndef IOTHUB_MESSAGING_H
XinZhangMS 0:f7f1f0d76dd6 7 #define IOTHUB_MESSAGING_H
XinZhangMS 0:f7f1f0d76dd6 8
XinZhangMS 0:f7f1f0d76dd6 9 #include "azure_c_shared_utility/umock_c_prod.h"
XinZhangMS 0:f7f1f0d76dd6 10
XinZhangMS 0:f7f1f0d76dd6 11 #include "iothub_messaging_ll.h"
XinZhangMS 0:f7f1f0d76dd6 12
XinZhangMS 0:f7f1f0d76dd6 13 #ifdef __cplusplus
XinZhangMS 0:f7f1f0d76dd6 14 extern "C"
XinZhangMS 0:f7f1f0d76dd6 15 {
XinZhangMS 0:f7f1f0d76dd6 16 #else
XinZhangMS 0:f7f1f0d76dd6 17 #endif
XinZhangMS 0:f7f1f0d76dd6 18
XinZhangMS 0:f7f1f0d76dd6 19 typedef struct IOTHUB_MESSAGING_CLIENT_INSTANCE_TAG* IOTHUB_MESSAGING_CLIENT_HANDLE;
XinZhangMS 0:f7f1f0d76dd6 20
XinZhangMS 0:f7f1f0d76dd6 21 /** @brief Creates a IoT Hub Service Client Messaging handle for use it in consequent APIs.
XinZhangMS 0:f7f1f0d76dd6 22 *
XinZhangMS 0:f7f1f0d76dd6 23 * @param serviceClientHandle Service client handle.
XinZhangMS 0:f7f1f0d76dd6 24 *
XinZhangMS 0:f7f1f0d76dd6 25 * @return A non-NULL @c IOTHUB_MESSAGING_CLIENT_HANDLE value that is used when
XinZhangMS 0:f7f1f0d76dd6 26 * invoking other functions for IoT Hub DeviceMethod and @c NULL on failure.
XinZhangMS 0:f7f1f0d76dd6 27 */
XinZhangMS 0:f7f1f0d76dd6 28 MOCKABLE_FUNCTION(, IOTHUB_MESSAGING_CLIENT_HANDLE, IoTHubMessaging_Create, IOTHUB_SERVICE_CLIENT_AUTH_HANDLE, serviceClientHandle);
XinZhangMS 0:f7f1f0d76dd6 29
XinZhangMS 0:f7f1f0d76dd6 30 /** @brief Disposes of resources allocated by the IoT Hub Service Client Messaging.
XinZhangMS 0:f7f1f0d76dd6 31 *
XinZhangMS 0:f7f1f0d76dd6 32 * @param messagingClientHandle The handle created by a call to the create function.
XinZhangMS 0:f7f1f0d76dd6 33 */
XinZhangMS 0:f7f1f0d76dd6 34 MOCKABLE_FUNCTION(, void, IoTHubMessaging_Destroy, IOTHUB_MESSAGING_CLIENT_HANDLE, messagingClientHandle);
XinZhangMS 0:f7f1f0d76dd6 35
XinZhangMS 0:f7f1f0d76dd6 36 /** @brief Opens connection to IoTHub.
XinZhangMS 0:f7f1f0d76dd6 37 *
XinZhangMS 0:f7f1f0d76dd6 38 * @param messagingClientHandle The handle created by a call to the create function.
XinZhangMS 0:f7f1f0d76dd6 39 * @param openCompleteCallback The callback specified by the user for receiving
XinZhangMS 0:f7f1f0d76dd6 40 * confirmation of the connection opened.
XinZhangMS 0:f7f1f0d76dd6 41 * The user can specify a @c NULL value here to
XinZhangMS 0:f7f1f0d76dd6 42 * indicate that no callback is required.
XinZhangMS 0:f7f1f0d76dd6 43 * @param userContextCallback User specified context that will be provided to the
XinZhangMS 0:f7f1f0d76dd6 44 * callback. This can be @c NULL.
XinZhangMS 0:f7f1f0d76dd6 45 *
XinZhangMS 0:f7f1f0d76dd6 46 * @return IOTHUB_MESSAGING_OK upon success or an error code upon failure.
XinZhangMS 0:f7f1f0d76dd6 47 */
XinZhangMS 0:f7f1f0d76dd6 48 MOCKABLE_FUNCTION(, IOTHUB_MESSAGING_RESULT, IoTHubMessaging_Open, IOTHUB_MESSAGING_CLIENT_HANDLE, messagingClientHandle, IOTHUB_OPEN_COMPLETE_CALLBACK, openCompleteCallback, void*, userContextCallback);
XinZhangMS 0:f7f1f0d76dd6 49
XinZhangMS 0:f7f1f0d76dd6 50 /** @brief Closes connection to IoTHub.
XinZhangMS 0:f7f1f0d76dd6 51 *
XinZhangMS 0:f7f1f0d76dd6 52 * @param messagingClientHandle The handle created by a call to the create function.
XinZhangMS 0:f7f1f0d76dd6 53 */
XinZhangMS 0:f7f1f0d76dd6 54 MOCKABLE_FUNCTION(, void, IoTHubMessaging_Close, IOTHUB_MESSAGING_CLIENT_HANDLE, messagingClientHandle);
XinZhangMS 0:f7f1f0d76dd6 55
XinZhangMS 0:f7f1f0d76dd6 56 /**
XinZhangMS 0:f7f1f0d76dd6 57 * @brief Asynchronous call to send the message to a specified device.
XinZhangMS 0:f7f1f0d76dd6 58 *
XinZhangMS 0:f7f1f0d76dd6 59 * @param messagingClientHandle The handle created by a call to the create function.
XinZhangMS 0:f7f1f0d76dd6 60 * @param deviceId The name (Id) of the device to send the message to.
XinZhangMS 0:f7f1f0d76dd6 61 * @param message The message to send.
XinZhangMS 0:f7f1f0d76dd6 62 * @param sendCompleteCallback The callback specified by the user for receiving
XinZhangMS 0:f7f1f0d76dd6 63 * confirmation of the delivery of the message.
XinZhangMS 0:f7f1f0d76dd6 64 * The user can specify a @c NULL value here to
XinZhangMS 0:f7f1f0d76dd6 65 * indicate that no callback is required.
XinZhangMS 0:f7f1f0d76dd6 66 * @param userContextCallback User specified context that will be provided to the
XinZhangMS 0:f7f1f0d76dd6 67 * callback. This can be @c NULL.
XinZhangMS 0:f7f1f0d76dd6 68 *
XinZhangMS 0:f7f1f0d76dd6 69 * @b NOTE: The application behavior is undefined if the user calls
XinZhangMS 0:f7f1f0d76dd6 70 * the ::IoTHubMessaging_Destroy or IoTHubMessaging_Close function from within any callback.
XinZhangMS 0:f7f1f0d76dd6 71 *
XinZhangMS 0:f7f1f0d76dd6 72 * @return IOTHUB_MESSAGING_OK upon success or an error code upon failure.
XinZhangMS 0:f7f1f0d76dd6 73 */
XinZhangMS 0:f7f1f0d76dd6 74 MOCKABLE_FUNCTION(, IOTHUB_MESSAGING_RESULT, IoTHubMessaging_SendAsync, IOTHUB_MESSAGING_CLIENT_HANDLE, messagingClientHandle, const char*, deviceId, IOTHUB_MESSAGE_HANDLE, message, IOTHUB_SEND_COMPLETE_CALLBACK, sendCompleteCallback, void*, userContextCallback);
XinZhangMS 0:f7f1f0d76dd6 75
XinZhangMS 0:f7f1f0d76dd6 76 /**
XinZhangMS 0:f7f1f0d76dd6 77 * @brief This API specifies a callback to be used when the device receives the message.
XinZhangMS 0:f7f1f0d76dd6 78 *
XinZhangMS 0:f7f1f0d76dd6 79 * @param messagingClientHandle The handle created by a call to the create function.
XinZhangMS 0:f7f1f0d76dd6 80 * @param feedbackMessageReceivedCallback The callback specified by the user to be used for receiveng
XinZhangMS 0:f7f1f0d76dd6 81 * confirmation feedback from the deice about the recevied message.
XinZhangMS 0:f7f1f0d76dd6 82 *
XinZhangMS 0:f7f1f0d76dd6 83 * @param userContextCallback User specified context that will be provided to the
XinZhangMS 0:f7f1f0d76dd6 84 * callback. This can be @c NULL.
XinZhangMS 0:f7f1f0d76dd6 85 *
XinZhangMS 0:f7f1f0d76dd6 86 * @b NOTE: The application behavior is undefined if the user calls
XinZhangMS 0:f7f1f0d76dd6 87 * the ::IoTHubMessaging_Destroy or IoTHubMessaging_Close function from within any callback.
XinZhangMS 0:f7f1f0d76dd6 88 *
XinZhangMS 0:f7f1f0d76dd6 89 * @return IOTHUB_CLIENT_OK upon success or an error code upon failure.
XinZhangMS 0:f7f1f0d76dd6 90 */
XinZhangMS 0:f7f1f0d76dd6 91 MOCKABLE_FUNCTION(, IOTHUB_MESSAGING_RESULT, IoTHubMessaging_SetFeedbackMessageCallback, IOTHUB_MESSAGING_CLIENT_HANDLE, messagingClientHandle, IOTHUB_FEEDBACK_MESSAGE_RECEIVED_CALLBACK, feedbackMessageReceivedCallback, void*, userContextCallback);
XinZhangMS 0:f7f1f0d76dd6 92
XinZhangMS 0:f7f1f0d76dd6 93 #ifdef __cplusplus
XinZhangMS 0:f7f1f0d76dd6 94 }
XinZhangMS 0:f7f1f0d76dd6 95 #endif
XinZhangMS 0:f7f1f0d76dd6 96
XinZhangMS 0:f7f1f0d76dd6 97 #endif // IOTHUB_MESSAGING_H