Azure IoT C SDK
prov_device_ll_client.h
Go to the documentation of this file.
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 
9 #ifndef PROV_DEVICE_LL_CLIENT_H
10 #define PROV_DEVICE_LL_CLIENT_H
11 
12 #include "umock_c/umock_c_prod.h"
13 #include "azure_macro_utils/macro_utils.h"
14 #include "azure_c_shared_utility/const_defines.h"
15 #include "azure_prov_client/prov_transport.h"
16 
17 #ifdef __cplusplus
18 extern "C" {
19 #endif /* __cplusplus */
20 
21 typedef struct PROV_INSTANCE_INFO_TAG* PROV_DEVICE_LL_HANDLE;
22 
23 typedef enum { PROV_DEVICE_RESULT_OK, PROV_DEVICE_RESULT_INVALID_ARG, PROV_DEVICE_RESULT_SUCCESS, PROV_DEVICE_RESULT_MEMORY, PROV_DEVICE_RESULT_PARSING, PROV_DEVICE_RESULT_TRANSPORT, PROV_DEVICE_RESULT_INVALID_STATE, PROV_DEVICE_RESULT_DEV_AUTH_ERROR, PROV_DEVICE_RESULT_TIMEOUT, PROV_DEVICE_RESULT_KEY_ERROR, PROV_DEVICE_RESULT_ERROR, PROV_DEVICE_RESULT_HUB_NOT_SPECIFIED, PROV_DEVICE_RESULT_UNAUTHORIZED, PROV_DEVICE_RESULT_DISABLED } PROV_DEVICE_RESULT;
24 typedef enum { PROV_DEVICE_REG_STATUS_CONNECTED, PROV_DEVICE_REG_STATUS_REGISTERING, PROV_DEVICE_REG_STATUS_ASSIGNING, PROV_DEVICE_REG_STATUS_ASSIGNED, PROV_DEVICE_REG_STATUS_ERROR, PROV_DEVICE_REG_HUB_NOT_SPECIFIED } PROV_DEVICE_REG_STATUS;static STATIC_VAR_UNUSED const char* const PROV_REGISTRATION_ID = "registration_id";
25 static STATIC_VAR_UNUSED const char* const PROV_OPTION_LOG_TRACE = "logtrace";
26 static STATIC_VAR_UNUSED const char* const PROV_OPTION_TIMEOUT = "provisioning_timeout";
27 
28 #ifndef OPTION_X509_CERT_DEF
29 #define OPTION_X509_CERT_DEF
30 static STATIC_VAR_UNUSED const char* OPTION_X509_CERT = "x509certificate";
31 #endif
32 
33 #ifndef OPTION_X509_PRIVATE_KEY_DEF
34 #define OPTION_X509_PRIVATE_KEY_DEF
35 static STATIC_VAR_UNUSED const char* OPTION_X509_PRIVATE_KEY = "x509privatekey";
36 #endif
37 
38 typedef void(*PROV_DEVICE_CLIENT_REGISTER_DEVICE_CALLBACK)(PROV_DEVICE_RESULT register_result, const char* iothub_uri, const char* device_id, void* user_context);
39 typedef void(*PROV_DEVICE_CLIENT_REGISTER_STATUS_CALLBACK)(PROV_DEVICE_REG_STATUS reg_status, void* user_context);
40 
41 typedef const PROV_DEVICE_TRANSPORT_PROVIDER*(*PROV_DEVICE_TRANSPORT_PROVIDER_FUNCTION)(void);
42 
53  PROV_DEVICE_LL_HANDLE Prov_Device_LL_Create( const char* uri, const char* scope_id, PROV_DEVICE_TRANSPORT_PROVIDER_FUNCTION protocol);
60  void Prov_Device_LL_Destroy( PROV_DEVICE_LL_HANDLE handle);
72  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);
79  void Prov_Device_LL_DoWork( PROV_DEVICE_LL_HANDLE handle);
89  PROV_DEVICE_RESULT Prov_Device_LL_SetOption( PROV_DEVICE_LL_HANDLE handle, const char* optionName, const void* value);
96 
105  PROV_DEVICE_RESULT Prov_Device_LL_Set_Provisioning_Payload( PROV_DEVICE_LL_HANDLE handle, const char* json);
113  const char* Prov_Device_LL_Get_Provisioning_Payload( PROV_DEVICE_LL_HANDLE handle);
114 #ifdef __cplusplus
115 }
116 #endif /* __cplusplus */
117 
118 #endif // PROV_DEVICE_LL_CLIENT_H
PROV_DEVICE_RESULT Prov_Device_LL_Set_Provisioning_Payload(PROV_DEVICE_LL_HANDLE handle, const char *json)
Sets the Provisioning Data that is sent to the Provisioning service.
void Prov_Device_LL_DoWork(PROV_DEVICE_LL_HANDLE handle)
Api to be called by user when work (registering device) can be done.
void Prov_Device_LL_Destroy(PROV_DEVICE_LL_HANDLE handle)
Disposes of resources allocated by the provisioning Client.
const char * Prov_Device_LL_Get_Provisioning_Payload(PROV_DEVICE_LL_HANDLE handle)
Retrieves the Provisioning Data that is sent from the Provisioning service.
PROV_DEVICE_LL_HANDLE Prov_Device_LL_Create(const char *uri, const char *scope_id, PROV_DEVICE_TRANSPORT_PROVIDER_FUNCTION protocol)
Creates a Provisioning Client for communications with the Device Provisioning Client Service.
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)
Asynchronous call initiates the registration of a device.
PROV_DEVICE_RESULT Prov_Device_LL_SetOption(PROV_DEVICE_LL_HANDLE handle, const char *optionName, const void *value)
API sets a runtime option identified by parameter optionName to a value pointed to by value.
const char * Prov_Device_LL_GetVersionString()
API to get the version of the provisioning client.