1 | // Copyright (c) Microsoft. All rights reserved.
|
---|
2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
---|
3 |
|
---|
4 | /** @file schemalib.h
|
---|
5 | * @brief The IoT Hub Serializer APIs allows developers to define models for
|
---|
6 | * their devices
|
---|
7 | */
|
---|
8 |
|
---|
9 | #ifndef SCHEMALIB_H
|
---|
10 | #define SCHEMALIB_H
|
---|
11 |
|
---|
12 | #include "azure_macro_utils/macro_utils.h"
|
---|
13 | #include "azure_c_shared_utility/strings.h"
|
---|
14 | #include "iotdevice.h"
|
---|
15 |
|
---|
16 | #ifdef __cplusplus
|
---|
17 | extern "C" {
|
---|
18 | #endif
|
---|
19 |
|
---|
20 | /* Codes_SRS_SCHEMALIB__99_001:[ IoTHubSchema_Client shall expose the following API: ... ] */
|
---|
21 | #define SERIALIZER_RESULT_VALUES \
|
---|
22 | SERIALIZER_OK, \
|
---|
23 | SERIALIZER_INVALID_ARG, \
|
---|
24 | SERIALIZER_CODEFIRST_INIT_FAILED, \
|
---|
25 | SERIALIZER_SCHEMA_FAILED, \
|
---|
26 | SERIALIZER_HTTP_API_INIT_FAILED, \
|
---|
27 | SERIALIZER_ALREADY_INIT, \
|
---|
28 | SERIALIZER_ERROR, \
|
---|
29 | SERIALIZER_NOT_INITIALIZED, \
|
---|
30 | SERIALIZER_ALREADY_STARTED, \
|
---|
31 | SERIALIZER_DEVICE_CREATE_FAILED, \
|
---|
32 | SERIALIZER_GET_MODEL_HANDLE_FAILED, \
|
---|
33 | SERIALIZER_SERVICEBUS_FAILED
|
---|
34 |
|
---|
35 | /** @brief Enumeration specifying the status of calls to various APIs in this
|
---|
36 | * module.
|
---|
37 | */
|
---|
38 | MU_DEFINE_ENUM_WITHOUT_INVALID(SERIALIZER_RESULT, SERIALIZER_RESULT_VALUES);
|
---|
39 |
|
---|
40 | #define SERIALIZER_CONFIG_VALUES \
|
---|
41 | CommandPollingInterval, \
|
---|
42 | SerializeDelayedBufferMaxSize
|
---|
43 |
|
---|
44 | /** @brief Enumeration specifying the option to set on the serializer when
|
---|
45 | * calling ::serializer_setconfig.
|
---|
46 | */
|
---|
47 | MU_DEFINE_ENUM_WITHOUT_INVALID(SERIALIZER_CONFIG, SERIALIZER_CONFIG_VALUES);
|
---|
48 |
|
---|
49 | /**
|
---|
50 | * @brief Initializes the library.
|
---|
51 | *
|
---|
52 | * @param overrideSchemaNamespace An override schema namespace to use for all
|
---|
53 | * models. Optional, can be @c NULL.
|
---|
54 | *
|
---|
55 | * If @p schemaNamespace is not @c NULL, its value shall be used
|
---|
56 | * instead of the namespace defined for each model by using the
|
---|
57 | * @c DECLARE_XXX macro.
|
---|
58 | *
|
---|
59 | * @return @c SERIALIZER_OK on success and any other error on failure.
|
---|
60 | */
|
---|
61 | extern SERIALIZER_RESULT serializer_init(const char* overrideSchemaNamespace);
|
---|
62 |
|
---|
63 | /** @brief Shuts down the IOT library.
|
---|
64 | *
|
---|
65 | * The library will track all created devices and upon a call to
|
---|
66 | * ::serializer_deinit it will de-initialize all devices.
|
---|
67 | */
|
---|
68 | extern void serializer_deinit(void);
|
---|
69 |
|
---|
70 | /**
|
---|
71 | * @brief Set serializer options.
|
---|
72 | *
|
---|
73 | * @param which The option to be set.
|
---|
74 | * @param value The value to set for the given option.
|
---|
75 | *
|
---|
76 | * @return @c SERIALIZER_OK on success and any other error on failure.
|
---|
77 | */
|
---|
78 | extern SERIALIZER_RESULT serializer_setconfig(SERIALIZER_CONFIG which, void* value);
|
---|
79 |
|
---|
80 | #ifdef __cplusplus
|
---|
81 | }
|
---|
82 | #endif
|
---|
83 |
|
---|
84 | #endif /* SCHEMALIB_H */
|
---|