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

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers condition.h Source File

condition.h

00001 // Copyright (c) Microsoft. All rights reserved.
00002 // Licensed under the MIT license. See LICENSE file in the project root for full license information.
00003 
00004 #ifndef CONDITION_H
00005 #define CONDITION_H
00006 
00007 #include "azure_c_shared_utility/macro_utils.h"
00008 #include "azure_c_shared_utility/lock.h"
00009 #include "azure_c_shared_utility/umock_c_prod.h"
00010 
00011 #ifdef __cplusplus
00012 extern "C" {
00013 #endif
00014 
00015 typedef void* COND_HANDLE;
00016 
00017 #define COND_RESULT_VALUES \
00018     COND_OK, \
00019     COND_INVALID_ARG, \
00020     COND_ERROR, \
00021     COND_TIMEOUT \
00022 
00023 /**
00024 * @brief Enumeration specifying the lock status.
00025 */
00026 DEFINE_ENUM(COND_RESULT, COND_RESULT_VALUES);
00027 
00028 /**
00029 * @brief    This API creates and returns a valid condition handle.
00030 *
00031 * @return   A valid @c COND_HANDLE when successful or @c NULL otherwise.
00032 */
00033 MOCKABLE_FUNCTION(, COND_HANDLE, Condition_Init);
00034 
00035 /**
00036 * @brief    unblock all currently working condition.
00037 *
00038 * @param    handle  A valid handle to the lock.
00039 *
00040 * @return   Returns @c COND_OK when the condition object has been
00041 *           destroyed and @c COND_ERROR when an error occurs
00042 *           and @c COND_TIMEOUT when the handle times out.
00043 */
00044 MOCKABLE_FUNCTION(, COND_RESULT, Condition_Post, COND_HANDLE, handle);
00045 
00046 /**
00047 * @brief    block on the condition handle unti the thread is signalled
00048 *           or until the timeout_milliseconds is reached.
00049 *
00050 * @param    handle  A valid handle to the lock.
00051 *
00052 * @return   Returns @c COND_OK when the condition object has been
00053 *           destroyed and @c COND_ERROR when an error occurs
00054 *           and @c COND_TIMEOUT when the handle times out.
00055 */
00056 MOCKABLE_FUNCTION(, COND_RESULT, Condition_Wait, COND_HANDLE, handle, LOCK_HANDLE, lock, int, timeout_milliseconds);
00057 
00058 /**
00059 * @brief    The condition instance is deinitialized.
00060 *
00061 * @param    handle  A valid handle to the condition.
00062 *
00063 * @return   Returns @c COND_OK when the condition object has been
00064 *           destroyed and @c COND_ERROR when an error occurs.
00065 */
00066 MOCKABLE_FUNCTION(, void, Condition_Deinit, COND_HANDLE, handle);
00067 
00068 #ifdef __cplusplus
00069 }
00070 #endif
00071 
00072 #endif /* CONDITION_H */