Simple sample that demonstrates reading the FXOS8700CQ accelerometer, convert the data to JSON and send to an Azure IoT Hub.

Dependencies:   azure_umqtt_c iothub_mqtt_transport mbed-rtos mbed wolfSSL Socket lwip-eth lwip-sys lwip

Committer:
markrad
Date:
Tue Apr 25 01:33:13 2017 +0000
Revision:
7:2564d95cbf81
Parent:
3:c0556ff7b8e3
Fix bug in NTP library. Clean up code some.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
markrad 3:c0556ff7b8e3 1 // Copyright (c) Microsoft. All rights reserved.
markrad 3:c0556ff7b8e3 2 // Licensed under the MIT license. See LICENSE file in the project root for full license information.
markrad 3:c0556ff7b8e3 3
markrad 3:c0556ff7b8e3 4 /** @file blob.h
markrad 3:c0556ff7b8e3 5 * @brief Contains blob APIs needed for File Upload feature of IoTHub client.
markrad 3:c0556ff7b8e3 6 *
markrad 3:c0556ff7b8e3 7 * @details IoTHub client needs to upload a byte array by using blob storage API
markrad 3:c0556ff7b8e3 8 * IoTHub service provides the complete SAS URI to execute a PUT request
markrad 3:c0556ff7b8e3 9 * that will upload the data.
markrad 3:c0556ff7b8e3 10 *
markrad 3:c0556ff7b8e3 11 */
markrad 3:c0556ff7b8e3 12
markrad 3:c0556ff7b8e3 13 #ifndef BLOB_H
markrad 3:c0556ff7b8e3 14 #define BLOB_H
markrad 3:c0556ff7b8e3 15
markrad 3:c0556ff7b8e3 16 #include "azure_c_shared_utility/macro_utils.h"
markrad 3:c0556ff7b8e3 17 #include "azure_c_shared_utility/buffer_.h"
markrad 3:c0556ff7b8e3 18
markrad 3:c0556ff7b8e3 19 #ifdef __cplusplus
markrad 3:c0556ff7b8e3 20 #include <cstddef>
markrad 3:c0556ff7b8e3 21 extern "C"
markrad 3:c0556ff7b8e3 22 {
markrad 3:c0556ff7b8e3 23 #else
markrad 3:c0556ff7b8e3 24 #include <stddef.h>
markrad 3:c0556ff7b8e3 25 #endif
markrad 3:c0556ff7b8e3 26
markrad 3:c0556ff7b8e3 27 #include "azure_c_shared_utility/umock_c_prod.h"
markrad 3:c0556ff7b8e3 28
markrad 3:c0556ff7b8e3 29 #define BLOB_RESULT_VALUES \
markrad 3:c0556ff7b8e3 30 BLOB_OK, \
markrad 3:c0556ff7b8e3 31 BLOB_ERROR, \
markrad 3:c0556ff7b8e3 32 BLOB_NOT_IMPLEMENTED, \
markrad 3:c0556ff7b8e3 33 BLOB_HTTP_ERROR, \
markrad 3:c0556ff7b8e3 34 BLOB_INVALID_ARG
markrad 3:c0556ff7b8e3 35
markrad 3:c0556ff7b8e3 36 DEFINE_ENUM(BLOB_RESULT, BLOB_RESULT_VALUES)
markrad 3:c0556ff7b8e3 37
markrad 3:c0556ff7b8e3 38 /**
markrad 3:c0556ff7b8e3 39 * @brief Synchronously uploads a byte array to blob storage
markrad 3:c0556ff7b8e3 40 *
markrad 3:c0556ff7b8e3 41 * @param SASURI The URI to use to upload data
markrad 3:c0556ff7b8e3 42 * @param size The size of the data to be uploaded (can be 0)
markrad 3:c0556ff7b8e3 43 * @param source A pointer to the byte array to be uploaded (can be NULL, but then size needs to be zero)
markrad 3:c0556ff7b8e3 44 * @param httpStatus A pointer to an out argument receiving the HTTP status (available only when the return value is BLOB_OK)
markrad 3:c0556ff7b8e3 45 * @param httpResponse A BUFFER_HANDLE that receives the HTTP response from the server (available only when the return value is BLOB_OK)
markrad 3:c0556ff7b8e3 46 *
markrad 3:c0556ff7b8e3 47 * @return A @c BLOB_RESULT. BLOB_OK means the blob has been uploaded successfully. Any other value indicates an error
markrad 3:c0556ff7b8e3 48 */
markrad 3:c0556ff7b8e3 49 MOCKABLE_FUNCTION(, BLOB_RESULT, Blob_UploadFromSasUri,const char*, SASURI, const unsigned char*, source, size_t, size, unsigned int*, httpStatus, BUFFER_HANDLE, httpResponse)
markrad 3:c0556ff7b8e3 50
markrad 3:c0556ff7b8e3 51 #ifdef __cplusplus
markrad 3:c0556ff7b8e3 52 }
markrad 3:c0556ff7b8e3 53 #endif
markrad 3:c0556ff7b8e3 54
markrad 3:c0556ff7b8e3 55 #endif /* BLOB_H */