source: azure_iot_hub_f767zi/trunk/azure_iot_sdk/provisioning_client/inc/azure_prov_client/prov_device_ll_client.h@ 457

Last change on this file since 457 was 457, checked in by coas-nagasima, 4 years ago

ファイルを追加

  • Property svn:eol-style set to native
  • Property svn:mime-type set to text/x-chdr;charset=UTF-8
File size: 5.8 KB
Line 
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#ifndef PROV_DEVICE_LL_CLIENT_H
5#define PROV_DEVICE_LL_CLIENT_H
6
7#include "umock_c/umock_c_prod.h"
8#include "azure_macro_utils/macro_utils.h"
9#include "azure_prov_client/prov_transport.h"
10
11#ifdef __cplusplus
12extern "C" {
13#endif /* __cplusplus */
14
15typedef struct PROV_INSTANCE_INFO_TAG* PROV_DEVICE_LL_HANDLE;
16
17#define PROV_DEVICE_RESULT_VALUE \
18 PROV_DEVICE_RESULT_OK, \
19 PROV_DEVICE_RESULT_INVALID_ARG, \
20 PROV_DEVICE_RESULT_SUCCESS, \
21 PROV_DEVICE_RESULT_MEMORY, \
22 PROV_DEVICE_RESULT_PARSING, \
23 PROV_DEVICE_RESULT_TRANSPORT, \
24 PROV_DEVICE_RESULT_INVALID_STATE, \
25 PROV_DEVICE_RESULT_DEV_AUTH_ERROR, \
26 PROV_DEVICE_RESULT_TIMEOUT, \
27 PROV_DEVICE_RESULT_KEY_ERROR, \
28 PROV_DEVICE_RESULT_ERROR, \
29 PROV_DEVICE_RESULT_HUB_NOT_SPECIFIED, \
30 PROV_DEVICE_RESULT_UNAUTHORIZED, \
31 PROV_DEVICE_RESULT_DISABLED
32
33MU_DEFINE_ENUM_WITHOUT_INVALID(PROV_DEVICE_RESULT, PROV_DEVICE_RESULT_VALUE);
34
35#define PROV_DEVICE_REG_STATUS_VALUES \
36 PROV_DEVICE_REG_STATUS_CONNECTED, \
37 PROV_DEVICE_REG_STATUS_REGISTERING, \
38 PROV_DEVICE_REG_STATUS_ASSIGNING, \
39 PROV_DEVICE_REG_STATUS_ASSIGNED, \
40 PROV_DEVICE_REG_STATUS_ERROR, \
41 PROV_DEVICE_REG_HUB_NOT_SPECIFIED
42
43MU_DEFINE_ENUM_WITHOUT_INVALID(PROV_DEVICE_REG_STATUS, PROV_DEVICE_REG_STATUS_VALUES);
44
45static const char* const PROV_REGISTRATION_ID = "registration_id";
46static const char* const PROV_OPTION_LOG_TRACE = "logtrace";
47static const char* const PROV_OPTION_TIMEOUT = "provisioning_timeout";
48
49typedef void(*PROV_DEVICE_CLIENT_REGISTER_DEVICE_CALLBACK)(PROV_DEVICE_RESULT register_result, const char* iothub_uri, const char* device_id, void* user_context);
50typedef void(*PROV_DEVICE_CLIENT_REGISTER_STATUS_CALLBACK)(PROV_DEVICE_REG_STATUS reg_status, void* user_context);
51
52typedef const PROV_DEVICE_TRANSPORT_PROVIDER*(*PROV_DEVICE_TRANSPORT_PROVIDER_FUNCTION)(void);
53
54/**
55* @brief Creates a Provisioning Client for communications with the Device Provisioning Client Service
56*
57* @param uri The URI of the Device Provisioning Service
58* @param scope_id The customer specific Id Scope
59* @param protocol Function pointer for protocol implementation
60*
61* @return A non-NULL PROV_DEVICE_LL_HANDLE value that is used when invoking other functions
62* and NULL on Failure
63*/
64MOCKABLE_FUNCTION(, PROV_DEVICE_LL_HANDLE, Prov_Device_LL_Create, const char*, uri, const char*, scope_id, PROV_DEVICE_TRANSPORT_PROVIDER_FUNCTION, protocol);
65
66/**
67* @brief Disposes of resources allocated by the provisioning Client.
68*
69* @param handle The handle created by a call to the create function
70*
71*/
72MOCKABLE_FUNCTION(, void, Prov_Device_LL_Destroy, PROV_DEVICE_LL_HANDLE, handle);
73
74/**
75* @brief Asynchronous call initiates the registration of a device.
76*
77* @param handle The handle created by a call to the create function.
78* @param register_callback The callback that gets called on registration or if an error is encountered
79* @param user_context User specified context that will be provided to the callback
80* @param reg_status_cb An optional registration status callback used to inform the caller of registration status
81* @param status_user_ctext User specified context that will be provided to the registration status callback
82*
83* @return PROV_DEVICE_RESULT_OK upon success or an error code upon failure
84*/
85MOCKABLE_FUNCTION(, PROV_DEVICE_RESULT, Prov_Device_LL_Register_Device, PROV_DEVICE_LL_HANDLE, handle, PROV_DEVICE_CLIENT_REGISTER_DEVICE_CALLBACK, register_callback, void*, user_context, PROV_DEVICE_CLIENT_REGISTER_STATUS_CALLBACK, reg_status_cb, void*, status_user_ctext);
86
87/**
88* @brief Api to be called by user when work (registering device) can be done
89*
90* @param handle The handle created by a call to the create function.
91*
92*/
93MOCKABLE_FUNCTION(, void, Prov_Device_LL_DoWork, PROV_DEVICE_LL_HANDLE, handle);
94
95/**
96* @brief API sets a runtime option identified by parameter optionName to a value pointed to by value
97*
98* @param handle The handle created by a call to the create function.
99* @param optionName The name of the option to be set
100* @param value A pointer to the value of the option to be set
101*
102* @return PROV_DEVICE_RESULT_OK upon success or an error code upon failure
103*/
104MOCKABLE_FUNCTION(, PROV_DEVICE_RESULT, Prov_Device_LL_SetOption, PROV_DEVICE_LL_HANDLE, handle, const char*, optionName, const void*, value);
105
106/**
107* @brief API to get the version of the provisioning client
108*
109* @return The version number of the provisioning client
110*/
111MOCKABLE_FUNCTION(, const char*, Prov_Device_LL_GetVersionString);
112
113
114/**
115* @brief Sets the Provisioning Data that is sent to the Provisioning service
116*
117* @param handle The handle created by a call to the create function.
118* @param json The data field that is sent to the service. Setting json to NULL will unset the value previously set
119*
120* @return PROV_DEVICE_RESULT_OK upon success or an error code upon failure
121*/
122MOCKABLE_FUNCTION(, PROV_DEVICE_RESULT, Prov_Device_LL_Set_Provisioning_Payload, PROV_DEVICE_LL_HANDLE, handle, const char*, json);
123
124/**
125* @brief Retrieves the Provisioning Data that is sent from the Provisioning service
126*
127* @param handle The handle created by a call to the create function.
128*
129* @return The data that was specified by the service
130*/
131MOCKABLE_FUNCTION(, const char*, Prov_Device_LL_Get_Provisioning_Payload, PROV_DEVICE_LL_HANDLE, handle);
132
133#ifdef __cplusplus
134}
135#endif /* __cplusplus */
136
137#endif // PROV_DEVICE_LL_CLIENT_H
Note: See TracBrowser for help on using the repository browser.