Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: sht15_remote_monitoring RobotArmDemo iothub_client_sample_amqp iothub_client_sample_amqp ... more
iothubtransport_amqp_telemetry_messenger.h@36:f78f9a56869e, 2017-06-16 (annotated)
- Committer:
- AzureIoTClient
- Date:
- Fri Jun 16 16:12:09 2017 -0700
- Revision:
- 36:f78f9a56869e
- Child:
- 41:71c01aa3df1a
1.1.17
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
AzureIoTClient | 36:f78f9a56869e | 1 | // Copyright (c) Microsoft. All rights reserved. |
AzureIoTClient | 36:f78f9a56869e | 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. |
AzureIoTClient | 36:f78f9a56869e | 3 | |
AzureIoTClient | 36:f78f9a56869e | 4 | #ifndef IOTHUBTRANSPORT_AMQP_TELEMETRY_MESSENGER |
AzureIoTClient | 36:f78f9a56869e | 5 | #define IOTHUBTRANSPORT_AMQP_TELEMETRY_MESSENGER |
AzureIoTClient | 36:f78f9a56869e | 6 | |
AzureIoTClient | 36:f78f9a56869e | 7 | #include "azure_c_shared_utility/umock_c_prod.h" |
AzureIoTClient | 36:f78f9a56869e | 8 | #include "azure_c_shared_utility/optionhandler.h" |
AzureIoTClient | 36:f78f9a56869e | 9 | #include "azure_uamqp_c/session.h" |
AzureIoTClient | 36:f78f9a56869e | 10 | #include "iothub_client_private.h" |
AzureIoTClient | 36:f78f9a56869e | 11 | |
AzureIoTClient | 36:f78f9a56869e | 12 | #ifdef __cplusplus |
AzureIoTClient | 36:f78f9a56869e | 13 | extern "C" |
AzureIoTClient | 36:f78f9a56869e | 14 | { |
AzureIoTClient | 36:f78f9a56869e | 15 | #endif |
AzureIoTClient | 36:f78f9a56869e | 16 | |
AzureIoTClient | 36:f78f9a56869e | 17 | |
AzureIoTClient | 36:f78f9a56869e | 18 | static const char* MESSENGER_OPTION_EVENT_SEND_TIMEOUT_SECS = "telemetry_event_send_timeout_secs"; |
AzureIoTClient | 36:f78f9a56869e | 19 | static const char* MESSENGER_OPTION_SAVED_OPTIONS = "saved_telemetry_messenger_options"; |
AzureIoTClient | 36:f78f9a56869e | 20 | |
AzureIoTClient | 36:f78f9a56869e | 21 | typedef struct TELEMETRY_MESSENGER_INSTANCE* TELEMETRY_MESSENGER_HANDLE; |
AzureIoTClient | 36:f78f9a56869e | 22 | |
AzureIoTClient | 36:f78f9a56869e | 23 | typedef enum TELEMETRY_MESSENGER_SEND_STATUS_TAG |
AzureIoTClient | 36:f78f9a56869e | 24 | { |
AzureIoTClient | 36:f78f9a56869e | 25 | TELEMETRY_MESSENGER_SEND_STATUS_IDLE, |
AzureIoTClient | 36:f78f9a56869e | 26 | TELEMETRY_MESSENGER_SEND_STATUS_BUSY |
AzureIoTClient | 36:f78f9a56869e | 27 | } TELEMETRY_MESSENGER_SEND_STATUS; |
AzureIoTClient | 36:f78f9a56869e | 28 | |
AzureIoTClient | 36:f78f9a56869e | 29 | typedef enum TELEMETRY_MESSENGER_EVENT_SEND_COMPLETE_RESULT_TAG |
AzureIoTClient | 36:f78f9a56869e | 30 | { |
AzureIoTClient | 36:f78f9a56869e | 31 | TELEMETRY_MESSENGER_EVENT_SEND_COMPLETE_RESULT_OK, |
AzureIoTClient | 36:f78f9a56869e | 32 | TELEMETRY_MESSENGER_EVENT_SEND_COMPLETE_RESULT_ERROR_CANNOT_PARSE, |
AzureIoTClient | 36:f78f9a56869e | 33 | TELEMETRY_MESSENGER_EVENT_SEND_COMPLETE_RESULT_ERROR_FAIL_SENDING, |
AzureIoTClient | 36:f78f9a56869e | 34 | TELEMETRY_MESSENGER_EVENT_SEND_COMPLETE_RESULT_ERROR_TIMEOUT, |
AzureIoTClient | 36:f78f9a56869e | 35 | TELEMETRY_MESSENGER_EVENT_SEND_COMPLETE_RESULT_MESSENGER_DESTROYED |
AzureIoTClient | 36:f78f9a56869e | 36 | } TELEMETRY_MESSENGER_EVENT_SEND_COMPLETE_RESULT; |
AzureIoTClient | 36:f78f9a56869e | 37 | |
AzureIoTClient | 36:f78f9a56869e | 38 | typedef enum TELEMETRY_MESSENGER_DISPOSITION_RESULT_TAG |
AzureIoTClient | 36:f78f9a56869e | 39 | { |
AzureIoTClient | 36:f78f9a56869e | 40 | TELEMETRY_MESSENGER_DISPOSITION_RESULT_NONE, |
AzureIoTClient | 36:f78f9a56869e | 41 | TELEMETRY_MESSENGER_DISPOSITION_RESULT_ACCEPTED, |
AzureIoTClient | 36:f78f9a56869e | 42 | TELEMETRY_MESSENGER_DISPOSITION_RESULT_REJECTED, |
AzureIoTClient | 36:f78f9a56869e | 43 | TELEMETRY_MESSENGER_DISPOSITION_RESULT_RELEASED |
AzureIoTClient | 36:f78f9a56869e | 44 | } TELEMETRY_MESSENGER_DISPOSITION_RESULT; |
AzureIoTClient | 36:f78f9a56869e | 45 | |
AzureIoTClient | 36:f78f9a56869e | 46 | typedef enum TELEMETRY_MESSENGER_STATE_TAG |
AzureIoTClient | 36:f78f9a56869e | 47 | { |
AzureIoTClient | 36:f78f9a56869e | 48 | TELEMETRY_MESSENGER_STATE_STARTING, |
AzureIoTClient | 36:f78f9a56869e | 49 | TELEMETRY_MESSENGER_STATE_STARTED, |
AzureIoTClient | 36:f78f9a56869e | 50 | TELEMETRY_MESSENGER_STATE_STOPPING, |
AzureIoTClient | 36:f78f9a56869e | 51 | TELEMETRY_MESSENGER_STATE_STOPPED, |
AzureIoTClient | 36:f78f9a56869e | 52 | TELEMETRY_MESSENGER_STATE_ERROR |
AzureIoTClient | 36:f78f9a56869e | 53 | } TELEMETRY_MESSENGER_STATE; |
AzureIoTClient | 36:f78f9a56869e | 54 | |
AzureIoTClient | 36:f78f9a56869e | 55 | typedef struct TELEMETRY_MESSENGER_MESSAGE_DISPOSITION_INFO_TAG |
AzureIoTClient | 36:f78f9a56869e | 56 | { |
AzureIoTClient | 36:f78f9a56869e | 57 | delivery_number message_id; |
AzureIoTClient | 36:f78f9a56869e | 58 | char* source; |
AzureIoTClient | 36:f78f9a56869e | 59 | } TELEMETRY_MESSENGER_MESSAGE_DISPOSITION_INFO; |
AzureIoTClient | 36:f78f9a56869e | 60 | |
AzureIoTClient | 36:f78f9a56869e | 61 | typedef void(*ON_TELEMETRY_MESSENGER_EVENT_SEND_COMPLETE)(IOTHUB_MESSAGE_LIST* iothub_message_list, TELEMETRY_MESSENGER_EVENT_SEND_COMPLETE_RESULT messenger_event_send_complete_result, void* context); |
AzureIoTClient | 36:f78f9a56869e | 62 | typedef void(*ON_TELEMETRY_MESSENGER_STATE_CHANGED_CALLBACK)(void* context, TELEMETRY_MESSENGER_STATE previous_state, TELEMETRY_MESSENGER_STATE new_state); |
AzureIoTClient | 36:f78f9a56869e | 63 | typedef TELEMETRY_MESSENGER_DISPOSITION_RESULT(*ON_TELEMETRY_MESSENGER_MESSAGE_RECEIVED)(IOTHUB_MESSAGE_HANDLE message, TELEMETRY_MESSENGER_MESSAGE_DISPOSITION_INFO* disposition_info, void* context); |
AzureIoTClient | 36:f78f9a56869e | 64 | |
AzureIoTClient | 36:f78f9a56869e | 65 | typedef struct TELEMETRY_MESSENGER_CONFIG_TAG |
AzureIoTClient | 36:f78f9a56869e | 66 | { |
AzureIoTClient | 36:f78f9a56869e | 67 | const char* device_id; |
AzureIoTClient | 36:f78f9a56869e | 68 | char* iothub_host_fqdn; |
AzureIoTClient | 36:f78f9a56869e | 69 | ON_TELEMETRY_MESSENGER_STATE_CHANGED_CALLBACK on_state_changed_callback; |
AzureIoTClient | 36:f78f9a56869e | 70 | void* on_state_changed_context; |
AzureIoTClient | 36:f78f9a56869e | 71 | } TELEMETRY_MESSENGER_CONFIG; |
AzureIoTClient | 36:f78f9a56869e | 72 | |
AzureIoTClient | 36:f78f9a56869e | 73 | MOCKABLE_FUNCTION(, TELEMETRY_MESSENGER_HANDLE, telemetry_messenger_create, const TELEMETRY_MESSENGER_CONFIG*, messenger_config, const char*, product_info); |
AzureIoTClient | 36:f78f9a56869e | 74 | MOCKABLE_FUNCTION(, int, telemetry_messenger_send_async, TELEMETRY_MESSENGER_HANDLE, messenger_handle, IOTHUB_MESSAGE_LIST*, message, ON_TELEMETRY_MESSENGER_EVENT_SEND_COMPLETE, on_messenger_event_send_complete_callback, void*, context); |
AzureIoTClient | 36:f78f9a56869e | 75 | MOCKABLE_FUNCTION(, int, telemetry_messenger_subscribe_for_messages, TELEMETRY_MESSENGER_HANDLE, messenger_handle, ON_TELEMETRY_MESSENGER_MESSAGE_RECEIVED, on_message_received_callback, void*, context); |
AzureIoTClient | 36:f78f9a56869e | 76 | MOCKABLE_FUNCTION(, int, telemetry_messenger_unsubscribe_for_messages, TELEMETRY_MESSENGER_HANDLE, messenger_handle); |
AzureIoTClient | 36:f78f9a56869e | 77 | MOCKABLE_FUNCTION(, int, telemetry_messenger_send_message_disposition, TELEMETRY_MESSENGER_HANDLE, messenger_handle, TELEMETRY_MESSENGER_MESSAGE_DISPOSITION_INFO*, disposition_info, TELEMETRY_MESSENGER_DISPOSITION_RESULT, disposition_result); |
AzureIoTClient | 36:f78f9a56869e | 78 | MOCKABLE_FUNCTION(, int, telemetry_messenger_get_send_status, TELEMETRY_MESSENGER_HANDLE, messenger_handle, TELEMETRY_MESSENGER_SEND_STATUS*, send_status); |
AzureIoTClient | 36:f78f9a56869e | 79 | MOCKABLE_FUNCTION(, int, telemetry_messenger_start, TELEMETRY_MESSENGER_HANDLE, messenger_handle, SESSION_HANDLE, session_handle); |
AzureIoTClient | 36:f78f9a56869e | 80 | MOCKABLE_FUNCTION(, int, telemetry_messenger_stop, TELEMETRY_MESSENGER_HANDLE, messenger_handle); |
AzureIoTClient | 36:f78f9a56869e | 81 | MOCKABLE_FUNCTION(, void, telemetry_messenger_do_work, TELEMETRY_MESSENGER_HANDLE, messenger_handle); |
AzureIoTClient | 36:f78f9a56869e | 82 | MOCKABLE_FUNCTION(, void, telemetry_messenger_destroy, TELEMETRY_MESSENGER_HANDLE, messenger_handle); |
AzureIoTClient | 36:f78f9a56869e | 83 | MOCKABLE_FUNCTION(, int, telemetry_messenger_set_option, TELEMETRY_MESSENGER_HANDLE, messenger_handle, const char*, name, void*, value); |
AzureIoTClient | 36:f78f9a56869e | 84 | MOCKABLE_FUNCTION(, OPTIONHANDLER_HANDLE, telemetry_messenger_retrieve_options, TELEMETRY_MESSENGER_HANDLE, messenger_handle); |
AzureIoTClient | 36:f78f9a56869e | 85 | |
AzureIoTClient | 36:f78f9a56869e | 86 | |
AzureIoTClient | 36:f78f9a56869e | 87 | #ifdef __cplusplus |
AzureIoTClient | 36:f78f9a56869e | 88 | } |
AzureIoTClient | 36:f78f9a56869e | 89 | #endif |
AzureIoTClient | 36:f78f9a56869e | 90 | |
AzureIoTClient | 36:f78f9a56869e | 91 | #endif /*IOTHUBTRANSPORT_AMQP_TELEMETRY_MESSENGER*/ |