|
static bool | _checkInit (void) |
| Check if the library is initialized. More...
|
|
static AwsIotProvisioningError_t | _initializeOperationObject (uint8_t operationIndex) |
| Initializes the operation object in _activeOperation array for the passed index reference. More...
|
|
static void | _cleanUpOperationObject (uint8_t operationIndex) |
| Cleans up the operation object in _activeOperation array for the passed index reference. More...
|
|
static void | _commonServerResponseHandler (const uint8_t operationIndex, IotMqttCallbackParam_t *const pPublishData, _provisioningServerResponseParser responseParser) |
| A utility common for processing server responses of all Provisioning operation APIs. If there is an ongoing operation, the utility processes the incoming PUBLISH message and invokes the provided parser if the server response is received on the "accepted" topic. More...
|
|
static void | _keysAndCertificateResponseReceivedCallback (void *param1, IotMqttCallbackParam_t *const pPublish) |
| The common MQTT subscription callback for response topics of the CreateKeysAndCertificate service API.
|
|
static void | _csrResponseReceivedCallback (void *param1, IotMqttCallbackParam_t *const pPublish) |
| The common MQTT subscription callback for response topics of the CreateCertificateFromCsr service API.
|
|
static void | _registerThingResponseReceivedCallback (void *param1, IotMqttCallbackParam_t *const pPublish) |
| The common MQTT subscription callback for the response topics of the RegisterThing service API.
|
|
static void | _setActiveOperation (uint8_t operationIndex, const _provisioningCallbackInfo_t *pUserCallback) |
| Sets an operation object in the _activeOperation array to represent an active operation in progress. More...
|
|
static AwsIotProvisioningError_t | _timedWaitForServerResponse (uint8_t operationIndex, uint32_t timeoutMs) |
| Waits for server response within the provided timeout period, and returns the result of the wait operation. More...
|
|
static bool | _isDataForRegisterThingRequestValid (const AwsIotProvisioningRegisterThingRequestInfo_t *pRequestData) |
| Checks whether the data that is provided to send along with the provisioning device request is valid. More...
|
|
AwsIotProvisioningError_t | AwsIotProvisioning_Init (uint32_t mqttTimeoutMs) |
| One-time initialization function for the Provisioning library. More...
|
|
AwsIotProvisioningError_t | AwsIotProvisioning_CreateKeysAndCertificate (IotMqttConnection_t provisioningConnection, uint32_t flags, uint32_t timeoutMs, const AwsIotProvisioningCreateKeysAndCertificateCallbackInfo_t *keysAndCertificateResponseCallback) |
| Requests a new public-private key pair and certificate for the device from AWS IoT Core and invokes the provided user-callback with the response from the server. More...
|
|
AwsIotProvisioningError_t | AwsIotProvisioning_CreateCertificateFromCsr (IotMqttConnection_t connection, IotMqttQos_t operationQos, const char *pCertificateSigningRequest, size_t csrLength, uint32_t timeoutMs, const AwsIotProvisioningCreateCertFromCsrCallbackInfo_t *pResponseCallback) |
| Requests the AWS IoT Core service for a certificate by sending a Certificate-Signing Request, and invokes the provided user-defined response handler with the response it receives from the server. More...
|
|
AwsIotProvisioningError_t | AwsIotProvisioning_RegisterThing (IotMqttConnection_t provisioningConnection, const AwsIotProvisioningRegisterThingRequestInfo_t *pRequestData, uint32_t timeoutMs, const AwsIotProvisioningRegisterThingCallbackInfo_t *pResponseCallback) |
| Requests the AWS IoT Core service to register the device, and invokes the user-defined callback with the response it receives from the server. More...
|
|
void | AwsIotProvisioning_Cleanup (void) |
| One-time deinitialization function for the Provisioning library. More...
|
|
const char * | AwsIotProvisioning_strerror (AwsIotProvisioningError_t status) |
| Returns a string that describes an AwsIotProvisioningError_t. More...
|
|
Implements most user-facing functions of the Provisioning library.
Requests the AWS IoT Core service to register the device, and invokes the user-defined callback with the response it receives from the server.
For registering the device, the service is expected to provide the new certificate, and optionally set up the Thing, Attributes and other cloud settings based on the fleet provisioning template and device context information that are passed to the API.
- Note
- It is advised to use a shared MQTT connection to AWS IoT Core across all API functions.
Also, the AWS IoT account being connected to for registering the device SHOULD have a fleet provisioning template created, whose template name should be passed to this API for requesting device registration.
- Warning
- This function is NOT thread-safe. Concurrent calls to the library API functions can result in undefined behavior. Device provisioning with this library REQUIRES calling the API functions of this library sequentially.
- Note
- In case of success response, the server may send device-specific configuration data, which will be provided as a list of key-value pairs in the callback.
- Parameters
-
[in] | connection | The MQTT connection handle to the user AWS IoT account that will be used for registering the device. |
[in] | pProvisioningDataInfo | The data (including the certificate) that needs to be sent to the server for registering the device. |
[in] | timeoutMs | The timeout (in milliseconds) for a response from the server. If there is a timeout, this function returns AWS_IOT_PROVISIONING_TIMEOUT. |
[in] | pResponseCallback | The user-defined functor that will be called with the response received from the server, whether post-provisioning data in case of success OR error message in case of server rejection of registration request. |
- Returns
- This function will return AWS_IOT_PROVISIONING_SUCCESS upon success; otherwise, AWS_IOT_PROVISIONING_NOT_INITIALIZED, if the API is called without initializing the Provisioning library (i.e. with a prior call to AwsIotProvisioning_Init function.) AWS_IOT_PROVISIONING_BAD_PARAMETER, if one or more input parameters are invalid. AWS_IOT_PROVISIONING_NO_MEMORY, if there is insufficient memory for allocation in internal operations. AWS_IOT_PROVISIONING_MQTT_ERROR, for errors from the MQTT stack. AWS_IOT_PROVISIONING_TIMEOUT, if there is a timeout in waiting for the server response for the request to register the device. AWS_IOT_PROVISIONING_SERVER_REFUSED, if the server rejects the request for register the device. AWS_IOT_PROVISIONING_BAD_RESPONSE, if the response from the server cannot be successfully parsed or comprehended. AWS_IOT_PROVISIONING_INTERNAL_FAILURE, if any there are operation failures internal to the library.
Returns a string that describes an AwsIotProvisioningError_t.
Like POSIX's strerror
, this function returns a string describing a return code. In this case, the return code is a Provisioning library error code, status
.
The string returned by this function MUST be treated as read-only: any attempt to modify its contents may result in a crash. Therefore, this function is limited to usage in logging.
- Parameters
-
[in] | status | The status to describe. |
- Returns
- A read-only string that describes
status
.
- Warning
- The string returned by this function must never be modified.