Microsoft Azure IoTHub client libraries
Dependents: sht15_remote_monitoring RobotArmDemo iothub_client_sample_amqp f767zi_mqtt ... more
This library implements the Microsoft Azure IoTHub client library. The code is replicated from https://github.com/Azure/azure-iot-sdks
Diff: iothub_client_ll.h
- Revision:
- 82:f94e6bed4495
- Parent:
- 80:db5f5237bc95
- Child:
- 84:48760e2e7dd8
--- a/iothub_client_ll.h Wed Jan 17 08:56:33 2018 -0800 +++ b/iothub_client_ll.h Tue Jan 30 08:21:20 2018 -0800 @@ -183,18 +183,27 @@ #define BLOCK_SIZE (4*1024*1024) +#define IOTHUB_CLIENT_FILE_UPLOAD_GET_DATA_RESULT_VALUES \ + IOTHUB_CLIENT_FILE_UPLOAD_GET_DATA_OK, \ + IOTHUB_CLIENT_FILE_UPLOAD_GET_DATA_ABORT + + DEFINE_ENUM(IOTHUB_CLIENT_FILE_UPLOAD_GET_DATA_RESULT, IOTHUB_CLIENT_FILE_UPLOAD_GET_DATA_RESULT_VALUES); + /** * @brief Callback invoked by IoTHubClient_UploadMultipleBlocksToBlobAsync requesting the chunks of data to be uploaded. - * @param result The result of the upload of the previous block of data provided by the user. + * @param result The result of the upload of the previous block of data provided by the user (IOTHUB_CLIENT_FILE_UPLOAD_GET_DATA_CALLBACK_EX only) * @param data Next block of data to be uploaded, to be provided by the user when this callback is invoked. * @param size Size of the data parameter. * @param context User context provided on the call to IoTHubClient_UploadMultipleBlocksToBlobAsync. + * @return If the user wants to abort the upload, the callback should return IOTHUB_CLIENT_FILE_UPLOAD_GET_DATA_ABORT + * It should return IOTHUB_CLIENT_FILE_UPLOAD_GET_DATA_OK otherwise. * @remarks If a NULL is provided for parameter "data" and/or zero is provided for "size", the user indicates to the client that the complete file has been uploaded. * In such case this callback will be invoked only once more to indicate the status of the final block upload. * If result is not FILE_UPLOAD_OK, the download is cancelled and this callback stops being invoked. * When this callback is called for the last time, no data or size is expected, so data and size are set to NULL */ typedef void(*IOTHUB_CLIENT_FILE_UPLOAD_GET_DATA_CALLBACK)(IOTHUB_CLIENT_FILE_UPLOAD_RESULT result, unsigned char const ** data, size_t* size, void* context); + typedef IOTHUB_CLIENT_FILE_UPLOAD_GET_DATA_RESULT (*IOTHUB_CLIENT_FILE_UPLOAD_GET_DATA_CALLBACK_EX)(IOTHUB_CLIENT_FILE_UPLOAD_RESULT result, unsigned char const ** data, size_t* size, void* context); #endif /* DONT_USE_UPLOADTOBLOB */ /** @brief This struct captures IoTHub client configuration. */ @@ -575,6 +584,7 @@ MOCKABLE_FUNCTION(, IOTHUB_CLIENT_RESULT, IoTHubClient_LL_UploadToBlob, IOTHUB_CLIENT_LL_HANDLE, iotHubClientHandle, const char*, destinationFileName, const unsigned char*, source, size_t, size); /** + ** DEPRECATED: Use IoTHubClient_LL_UploadMultipleBlocksToBlobAsyncEx instead ** * @brief This API uploads to Azure Storage the content provided block by block by @p getDataCallback * under the blob name devicename/@pdestinationFileName * @@ -584,8 +594,23 @@ * @param context Any data provided by the user to serve as context on getDataCallback. * * @return IOTHUB_CLIENT_OK upon success or an error code upon failure. + ** DEPRECATED: Use IoTHubClient_LL_UploadMultipleBlocksToBlobAsyncEx instead ** */ MOCKABLE_FUNCTION(, IOTHUB_CLIENT_RESULT, IoTHubClient_LL_UploadMultipleBlocksToBlob, IOTHUB_CLIENT_LL_HANDLE, iotHubClientHandle, const char*, destinationFileName, IOTHUB_CLIENT_FILE_UPLOAD_GET_DATA_CALLBACK, getDataCallback, void*, context); + + /** + * @brief This API uploads to Azure Storage the content provided block by block by @p getDataCallback + * under the blob name devicename/@pdestinationFileName + * + * @param iotHubClientHandle The handle created by a call to the create function. + * @param destinationFileName name of the file. + * @param getDataCallbackEx A callback to be invoked to acquire the file chunks to be uploaded, as well as to indicate the status of the upload of the previous block. + * @param context Any data provided by the user to serve as context on getDataCallback. + * + * @return IOTHUB_CLIENT_OK upon success or an error code upon failure. + */ + MOCKABLE_FUNCTION(, IOTHUB_CLIENT_RESULT, IoTHubClient_LL_UploadMultipleBlocksToBlobEx, IOTHUB_CLIENT_LL_HANDLE, iotHubClientHandle, const char*, destinationFileName, IOTHUB_CLIENT_FILE_UPLOAD_GET_DATA_CALLBACK_EX, getDataCallbackEx, void*, context); + #endif /*DONT_USE_UPLOADTOBLOB*/ #ifdef __cplusplus