Azure IoT / serializer

Dependents:   sht15_remote_monitoring f767zi_mqtt remote_monitoring simplesample_amqp ... more

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers schemalib.h Source File

schemalib.h

Go to the documentation of this file.
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 /** @file   schemalib.h
00005  *    @brief    The IoT Hub Serializer APIs allows developers to define models for
00006 *            their devices
00007  */
00008 
00009 #ifndef SCHEMALIB_H
00010 #define SCHEMALIB_H
00011 
00012 #include "azure_c_shared_utility/macro_utils.h"
00013 #include "azure_c_shared_utility/strings.h"
00014 #include "iotdevice.h"
00015 
00016 #ifdef __cplusplus
00017 extern "C" {
00018 #endif
00019 
00020 /* Codes_SRS_SCHEMALIB__99_001:[ IoTHubSchema_Client shall expose the following API: ... ] */
00021 #define SERIALIZER_RESULT_VALUES                   \
00022     SERIALIZER_OK,                                 \
00023     SERIALIZER_INVALID_ARG,                        \
00024     SERIALIZER_CODEFIRST_INIT_FAILED,              \
00025     SERIALIZER_SCHEMA_FAILED,                      \
00026     SERIALIZER_HTTP_API_INIT_FAILED,               \
00027     SERIALIZER_ALREADY_INIT,                       \
00028     SERIALIZER_ERROR,                              \
00029     SERIALIZER_NOT_INITIALIZED,                    \
00030     SERIALIZER_ALREADY_STARTED,                    \
00031     SERIALIZER_DEVICE_CREATE_FAILED,               \
00032     SERIALIZER_GET_MODEL_HANDLE_FAILED,            \
00033     SERIALIZER_SERVICEBUS_FAILED
00034 
00035 /** @brief Enumeration specifying the status of calls to various APIs in this
00036  * module.
00037  */
00038 DEFINE_ENUM(SERIALIZER_RESULT, SERIALIZER_RESULT_VALUES);
00039 
00040 #define SERIALIZER_CONFIG_VALUES  \
00041     CommandPollingInterval,     \
00042     SerializeDelayedBufferMaxSize
00043 
00044 /** @brief Enumeration specifying the option to set on the serializer when
00045  * calling ::serializer_setconfig.
00046  */
00047 DEFINE_ENUM(SERIALIZER_CONFIG, SERIALIZER_CONFIG_VALUES);
00048 
00049 /**
00050  * @brief   Initializes the library.
00051  *
00052  * @param   overrideSchemaNamespace An override schema namespace to use for all
00053  *                                  models. Optional, can be @c NULL.
00054  *
00055  *          If @p schemaNamespace is not @c NULL, its value shall be used
00056  *          instead of the namespace defined for each model by using the
00057  *          @c DECLARE_XXX macro.
00058  *
00059  * @return  @c SERIALIZER_OK on success and any other error on failure.
00060  */
00061 extern SERIALIZER_RESULT serializer_init(const char* overrideSchemaNamespace);
00062 
00063 /** @brief  Shuts down the IOT library.
00064  *
00065  *          The library will track all created devices and upon a call to
00066  *          ::serializer_deinit it will de-initialize all devices.
00067  */
00068 extern void serializer_deinit(void);
00069 
00070 /**
00071  * @brief   Set serializer options.
00072  *
00073  * @param   which   The option to be set.
00074  * @param   value   The value to set for the given option.
00075  *
00076  * @return  @c SERIALIZER_OK on success and any other error on failure.
00077  */
00078 extern SERIALIZER_RESULT serializer_setconfig(SERIALIZER_CONFIG which, void* value);
00079 
00080 #ifdef __cplusplus
00081 }
00082 #endif
00083 
00084 #endif /* SCHEMALIB_H */