Microsoft Azure IoT Gateway SDK
1.0.8
The Microsoft Azure IoT Gateway SDK contains the infrastructure and modules to create IoT gateway solutions.
|
Library that allows a user to create and configure a gateway. More...
#include "azure_c_shared_utility/macro_utils.h"
#include "azure_c_shared_utility/vector.h"
#include "nanomsg/nn.h"
#include "module.h"
#include "module_loader.h"
#include "gateway_export.h"
Go to the source code of this file.
Data Structures | |
struct | GATEWAY_LINK_ENTRY_TAG |
Struct representing a single link for a gateway. More... | |
struct | GATEWAY_MODULE_LOADER_INFO_TAG |
Struct representing the loader and entrypoint to be used for a specific module. More... | |
struct | GATEWAY_MODULES_ENTRY_TAG |
Struct representing a single entry of the GATEWAY_PROPERTIES. More... | |
struct | GATEWAY_PROPERTIES_DATA_TAG |
Struct representing the properties that should be used when creating a module; each entry of the VECTOR_HANDLE being a GATEWAY_MODULES_ENTRY. More... | |
Macros | |
#define | GATEWAY_CONNECTION_ID_MAX NN_SOCKADDR_MAX |
#define | GATEWAY_MESSAGE_VERSION_1 0x01 |
#define | GATEWAY_MESSAGE_VERSION_CURRENT GATEWAY_MESSAGE_VERSION_1 |
Typedefs | |
typedef enum GATEWAY_ADD_LINK_RESULT_TAG | GATEWAY_ADD_LINK_RESULT |
Enumeration describing the result of Gateway_AddLink. | |
typedef enum GATEWAY_START_RESULT_TAG | GATEWAY_START_RESULT |
Enumeration describing the result of Gateway_Start. | |
typedef enum GATEWAY_UPDATE_FROM_JSON_RESULT_TAG | GATEWAY_UPDATE_FROM_JSON_RESULT |
Enumeration describing the result of Gateway_UpdateFromJson. | |
typedef struct GATEWAY_LINK_ENTRY_TAG | GATEWAY_LINK_ENTRY |
Struct representing a single link for a gateway. | |
typedef struct GATEWAY_HANDLE_DATA_TAG * | GATEWAY_HANDLE |
Struct representing a particular gateway. | |
typedef struct GATEWAY_MODULE_LOADER_INFO_TAG | GATEWAY_MODULE_LOADER_INFO |
Struct representing the loader and entrypoint to be used for a specific module. | |
typedef struct GATEWAY_MODULES_ENTRY_TAG | GATEWAY_MODULES_ENTRY |
Struct representing a single entry of the GATEWAY_PROPERTIES. | |
typedef struct GATEWAY_PROPERTIES_DATA_TAG | GATEWAY_PROPERTIES |
Struct representing the properties that should be used when creating a module; each entry of the VECTOR_HANDLE being a GATEWAY_MODULES_ENTRY. | |
Enumerations | |
enum | GATEWAY_ADD_LINK_RESULT_TAG { GATEWAY_ADD_LINK_SUCCESS, GATEWAY_ADD_LINK_ERROR, GATEWAY_ADD_LINK_INVALID_ARG } |
Enumeration describing the result of Gateway_AddLink. | |
enum | GATEWAY_START_RESULT_TAG { GATEWAY_START_SUCCESS, GATEWAY_START_INVALID_ARGS } |
Enumeration describing the result of Gateway_Start. | |
enum | GATEWAY_UPDATE_FROM_JSON_RESULT_TAG { GATEWAY_UPDATE_FROM_JSON_SUCCESS, GATEWAY_UPDATE_FROM_JSON_ERROR, GATEWAY_UPDATE_FROM_JSON_INVALID_ARG, GATEWAY_UPDATE_FROM_JSON_MEMORY } |
Enumeration describing the result of Gateway_UpdateFromJson. | |
Functions | |
const char * | GATEWAY_UPDATE_FROM_JSON_RESULTStrings (GATEWAY_UPDATE_FROM_JSON_RESULT value) |
int | GATEWAY_UPDATE_FROM_JSON_RESULT_FromString (const char *enumAsString, GATEWAY_UPDATE_FROM_JSON_RESULT *destination) |
GATEWAY_EXPORT GATEWAY_HANDLE | Gateway_CreateFromJson (const char *file_path) |
Creates a gateway using a JSON configuration file as input which describes each module. Each module described in the configuration must support Module_CreateFromJson. More... | |
GATEWAY_EXPORT GATEWAY_UPDATE_FROM_JSON_RESULT | Gateway_UpdateFromJson (GATEWAY_HANDLE gw, const char *json_content) |
Updates a gateway using a JSON configuration string as input which describes each module. More... | |
GATEWAY_EXPORT GATEWAY_HANDLE | Gateway_Create (const GATEWAY_PROPERTIES *properties) |
Creates a new gateway using the provided GATEWAY_PROPERTIES. More... | |
GATEWAY_EXPORT GATEWAY_START_RESULT | Gateway_Start (GATEWAY_HANDLE gw) |
Tell the Gateway it's ready to start. More... | |
GATEWAY_EXPORT void | Gateway_Destroy (GATEWAY_HANDLE gw) |
Destroys the gateway and disposes of all associated data. More... | |
GATEWAY_EXPORT MODULE_HANDLE | Gateway_AddModule (GATEWAY_HANDLE gw, const GATEWAY_MODULES_ENTRY *entry) |
Creates a new module based on the GATEWAY_MODULES_ENTRY*. More... | |
GATEWAY_EXPORT void | Gateway_StartModule (GATEWAY_HANDLE gw, MODULE_HANDLE module) |
Tells a module that the gateway is ready for it to start. More... | |
GATEWAY_EXPORT void | Gateway_RemoveModule (GATEWAY_HANDLE gw, MODULE_HANDLE module) |
Removes the provided module from the gateway and all links that involves this module. More... | |
GATEWAY_EXPORT int | Gateway_RemoveModuleByName (GATEWAY_HANDLE gw, const char *module_name) |
Removes module by its unique name. More... | |
GATEWAY_EXPORT GATEWAY_ADD_LINK_RESULT | Gateway_AddLink (GATEWAY_HANDLE gw, const GATEWAY_LINK_ENTRY *entryLink) |
Adds a link to a gateway message broker. More... | |
GATEWAY_EXPORT void | Gateway_RemoveLink (GATEWAY_HANDLE gw, const GATEWAY_LINK_ENTRY *entryLink) |
Remove a link from a gateway message broker. More... | |
Library that allows a user to create and configure a gateway.
The Gateway library provides a mechanism for creating and destroying a gateway, as well as adding and removing modules.
GATEWAY_EXPORT GATEWAY_ADD_LINK_RESULT Gateway_AddLink | ( | GATEWAY_HANDLE | gw, |
const GATEWAY_LINK_ENTRY * | entryLink | ||
) |
Adds a link to a gateway message broker.
gw | Pointer to a GATEWAY_HANDLE from which link is going to be added. |
entryLink | Pointer to a GATEWAY_LINK_ENTRY to be added. |
GATEWAY_EXPORT MODULE_HANDLE Gateway_AddModule | ( | GATEWAY_HANDLE | gw, |
const GATEWAY_MODULES_ENTRY * | entry | ||
) |
Creates a new module based on the GATEWAY_MODULES_ENTRY*.
gw | Pointer to a GATEWAY_HANDLE to add the Module onto. |
entry | Pointer to a GATEWAY_MODULES_ENTRY structure describing the module. |
NULL
on failure. GATEWAY_EXPORT GATEWAY_HANDLE Gateway_Create | ( | const GATEWAY_PROPERTIES * | properties | ) |
Creates a new gateway using the provided GATEWAY_PROPERTIES.
properties | GATEWAY_PROPERTIES structure containing specific module properties and information. |
NULL
on failure. GATEWAY_EXPORT GATEWAY_HANDLE Gateway_CreateFromJson | ( | const char * | file_path | ) |
Creates a gateway using a JSON configuration file as input which describes each module. Each module described in the configuration must support Module_CreateFromJson.
file_path | Path to the JSON configuration file for this gateway. |
Sample JSON configuration file:
{ "modules" : [ { "name": "sensor", "loader": { "name": "dotnet", "entrypoint": { "class.name": "Microsoft.Azure.Gateway.SensorModule", "assembly.path": "./bin/Microsoft.Azure.Gateway.Modules.dll" } }, "args" : { "power.level": 5 } }, { "name": "logger", "loader": { "name": "native", "entrypoint": { "module.path": "./bin/liblogger.so" } }, "args": { "filename": "/var/logs/gateway-log.json" } } ], "links": [ { "source": "sensor", "sink": "logger" } ] }
NULL
on failure. GATEWAY_EXPORT void Gateway_Destroy | ( | GATEWAY_HANDLE | gw | ) |
Destroys the gateway and disposes of all associated data.
gw | GATEWAY_HANDLE to be destroyed. |
GATEWAY_EXPORT void Gateway_RemoveLink | ( | GATEWAY_HANDLE | gw, |
const GATEWAY_LINK_ENTRY * | entryLink | ||
) |
Remove a link from a gateway message broker.
gw | Pointer to a GATEWAY_HANDLE from which link is going to be removed. |
entryLink | Pointer to a GATEWAY_LINK_ENTRY to be removed. |
GATEWAY_EXPORT void Gateway_RemoveModule | ( | GATEWAY_HANDLE | gw, |
MODULE_HANDLE | module | ||
) |
Removes the provided module from the gateway and all links that involves this module.
gw | Pointer to a GATEWAY_HANDLE from which to remove the Module. |
module | Pointer to a MODULE_HANDLE that needs to be removed. |
GATEWAY_EXPORT int Gateway_RemoveModuleByName | ( | GATEWAY_HANDLE | gw, |
const char * | module_name | ||
) |
Removes module by its unique name.
gw | Pointer to a GATEWAY_HANDLE from which to remove the module. |
module_name | A C string representing the name of module to be removed |
GATEWAY_EXPORT GATEWAY_START_RESULT Gateway_Start | ( | GATEWAY_HANDLE | gw | ) |
Tell the Gateway it's ready to start.
gw | GATEWAY_HANDLE to be destroyed. |
GATEWAY_EXPORT void Gateway_StartModule | ( | GATEWAY_HANDLE | gw, |
MODULE_HANDLE | module | ||
) |
Tells a module that the gateway is ready for it to start.
gw | Pointer to a GATEWAY_HANDLE from which to remove the Module. |
module | Pointer to a MODULE_HANDLE that needs to be removed. |
GATEWAY_EXPORT GATEWAY_UPDATE_FROM_JSON_RESULT Gateway_UpdateFromJson | ( | GATEWAY_HANDLE | gw, |
const char * | json_content | ||
) |
Updates a gateway using a JSON configuration string as input which describes each module.
gw | Pointer to a GATEWAY_HANDLE from which to remove the module. |
json_content | A JSON string with a list of Loaders, Modules and/or Links. |