[453] | 1 | // Copyright (c) Microsoft. All rights reserved.
|
---|
| 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
---|
| 3 |
|
---|
| 4 | /** @file prov_device_client.h
|
---|
| 5 | * @brief Extends the Prov_Device_LL module with additional features.
|
---|
| 6 | *
|
---|
| 7 | * @details Prov_Device is a module that extends the Prov_Device_LL
|
---|
| 8 | * module with 2 features:
|
---|
| 9 | * - scheduling the work for the IoTHubCLient from a
|
---|
| 10 | * thread, so that the user does not need to create their
|
---|
| 11 | * own thread
|
---|
| 12 | * - thread-safe APIs
|
---|
| 13 | */
|
---|
| 14 |
|
---|
| 15 | #ifndef PROV_DEVICE_CLIENT_H
|
---|
| 16 | #define PROV_DEVICE_CLIENT_H
|
---|
| 17 |
|
---|
| 18 | #ifndef PROV_DEVICE_CLIENT_INSTANCE_TYPE
|
---|
| 19 | typedef struct PROV_DEVICE_INSTANCE_TAG* PROV_DEVICE_HANDLE;
|
---|
| 20 | #define PROV_DEVICE_CLIENT_INSTANCE_TYPE
|
---|
| 21 | #endif // PROV_DEVICE_CLIENT_INSTANCE_TYPE
|
---|
| 22 |
|
---|
| 23 | #include <stddef.h>
|
---|
| 24 | #include <stdint.h>
|
---|
| 25 | #include "prov_device_ll_client.h"
|
---|
| 26 | #include "umock_c/umock_c_prod.h"
|
---|
| 27 | #include "azure_macro_utils/macro_utils.h"
|
---|
| 28 | #include "azure_prov_client/prov_transport.h"
|
---|
| 29 |
|
---|
| 30 | #ifdef __cplusplus
|
---|
| 31 | extern "C"
|
---|
| 32 | {
|
---|
| 33 | #endif
|
---|
| 34 |
|
---|
| 35 | MOCKABLE_FUNCTION(, PROV_DEVICE_HANDLE, Prov_Device_Create, const char*, uri, const char*, scope_id, PROV_DEVICE_TRANSPORT_PROVIDER_FUNCTION, protocol);
|
---|
| 36 | MOCKABLE_FUNCTION(, void, Prov_Device_Destroy, PROV_DEVICE_HANDLE, prov_device_handle);
|
---|
| 37 | MOCKABLE_FUNCTION(, PROV_DEVICE_RESULT, Prov_Device_Register_Device, PROV_DEVICE_HANDLE, prov_device_handle, PROV_DEVICE_CLIENT_REGISTER_DEVICE_CALLBACK, register_callback, void*, user_context, PROV_DEVICE_CLIENT_REGISTER_STATUS_CALLBACK, register_status_callback, void*, status_user_context);
|
---|
| 38 | MOCKABLE_FUNCTION(, PROV_DEVICE_RESULT, Prov_Device_SetOption, PROV_DEVICE_HANDLE, prov_device_handle, const char*, optionName, const void*, value);
|
---|
| 39 | MOCKABLE_FUNCTION(, const char*, Prov_Device_GetVersionString);
|
---|
| 40 |
|
---|
| 41 | /**
|
---|
| 42 | * @brief Sets the Provisioning Data that is sent to the Provisioning service
|
---|
| 43 | *
|
---|
| 44 | * @param handle The handle created by a call to the create function.
|
---|
| 45 | * @param json The json payload field that is sent to the service. Setting json to NULL will unset the value previously set
|
---|
| 46 | *
|
---|
| 47 | * @return PROV_DEVICE_RESULT_OK upon success or an error code upon failure
|
---|
| 48 | */
|
---|
| 49 | MOCKABLE_FUNCTION(, PROV_DEVICE_RESULT, Prov_Device_Set_Provisioning_Payload, PROV_DEVICE_HANDLE, handle, const char*, json);
|
---|
| 50 |
|
---|
| 51 | /**
|
---|
| 52 | * @brief Retrieves the Provisioning Data that is sent from the Provisioning service
|
---|
| 53 | *
|
---|
| 54 | * @param handle The handle created by a call to the create function.
|
---|
| 55 | *
|
---|
| 56 | * @return The data that was specified by the service
|
---|
| 57 | */
|
---|
| 58 | MOCKABLE_FUNCTION(, const char*, Prov_Device_Get_Provisioning_Payload, PROV_DEVICE_HANDLE, handle);
|
---|
| 59 |
|
---|
| 60 | #ifdef __cplusplus
|
---|
| 61 | }
|
---|
| 62 | #endif /* __cplusplus */
|
---|
| 63 |
|
---|
| 64 | #endif // PROV_DEVICE_CLIENT_H
|
---|