IoT managed integrations End Device SDK
Loading...
Searching...
No Matches
Classes | Macros | Functions
iotmi_device_agent.h File Reference
#include <stdbool.h>
#include <stddef.h>
#include <iotmi_device_types.h>

Go to the source code of this file.

Classes

struct  iotmiDev_Agent_Config
 The struct to hold the configuration of the agent. More...
 
struct  iotmiDev_Agent_ClusterInfo
 The struct to hold the information for a cluster. More...
 

Macros

#define EVENT_NOT_SUPPORTED   0x01
 Bit mask indicating which events are not supported in allEventFlags.
 

Functions

struct iotmiDev_Agent * iotmiDev_Agent_new (const struct iotmiDev_Agent_Config *config)
 Create a device agent.
 
void iotmiDev_Agent_free (struct iotmiDev_Agent *agent)
 Destroy the agent and free all occupied resources.
 
struct iotmiDev_Endpoint * iotmiDev_Agent_addEndpoint (struct iotmiDev_Agent *agent, uint16_t id, const char *name, const char *deviceTypes[], size_t deviceTypesLen)
 Add an endpoint with an empty set of capabilities.
 
struct iotmiDev_Endpoint * iotmiDev_Agent_getEndpoint (struct iotmiDev_Agent *agent, uint16_t id)
 Get an endpoint within an agent.
 
uint16_t iotmiDev_Endpoint_getId (const struct iotmiDev_Endpoint *endpoint)
 Get the endpoint ID of an endpoint.
 
const char * iotmiDev_Endpoint_getName (const struct iotmiDev_Endpoint *endpoint)
 Get the endpoint Name of an endpoint.
 
struct iotmiDev_Agent * iotmiDev_Endpoint_getAgent (const struct iotmiDev_Endpoint *endpoint)
 Get the agent which contains the given endpoint.
 
iotmiDev_DMStatus iotmiDev_Endpoint_registerClusterInfo (struct iotmiDev_Endpoint *endpoint, const struct iotmiDev_Agent_ClusterInfo *info)
 This API registers the necessary information for a cluster.
 
void iotmiDev_Agent_initDefaultConfig (struct iotmiDev_Agent_Config *config)
 This API initializes a default agent config.
 

Detailed Description

This file defines the API for common agent operations that are specific to clusters.

Macro Definition Documentation

◆ EVENT_NOT_SUPPORTED

#define EVENT_NOT_SUPPORTED   0x01

Bit mask indicating which events are not supported in allEventFlags.

This variable holds the event support status where each bit represents an event. If a bit is set (1), the corresponding event is NOT supported. If a bit is clear (0), the corresponding event is supported.

Bit positions:

  • Bit 0: EVENT_NOT_SUPPORTED

Function Documentation

◆ iotmiDev_Agent_addEndpoint()

struct iotmiDev_Endpoint * iotmiDev_Agent_addEndpoint ( struct iotmiDev_Agent *  agent,
uint16_t  id,
const char *  name,
const char *  deviceTypes[],
size_t  deviceTypesLen 
)

Add an endpoint with an empty set of capabilities.

Parameters
[in]agentPointer to the device agent.
[in]idThe endpoint ID.
[in]nameThe endpoint name.
[in]deviceTypesAn array of device type names. Note the names should conform to device types defined in the AWS data model.
[in]deviceTypesLenThe length of deviceTypes array.
Returns
Pointer to the created endpoint, or NULL on failure.
See also
iotmiDev_Endpoint_getId, iotmiDev_Endpoint_getName

◆ iotmiDev_Agent_free()

void iotmiDev_Agent_free ( struct iotmiDev_Agent *  agent)

Destroy the agent and free all occupied resources.

Parameters
[in]agentPointer to the device agent to be destroyed.

◆ iotmiDev_Agent_getEndpoint()

struct iotmiDev_Endpoint * iotmiDev_Agent_getEndpoint ( struct iotmiDev_Agent *  agent,
uint16_t  id 
)

Get an endpoint within an agent.

Parameters
[in]agentPointer to the device agent.
[in]idThe endpoint ID.
Returns
Pointer to the endpoint, or NULL if the endpoint does not exist.
See also
iotmiDev_Endpoint_getId, iotmiDev_Endpoint_getName

◆ iotmiDev_Agent_initDefaultConfig()

void iotmiDev_Agent_initDefaultConfig ( struct iotmiDev_Agent_Config *  config)

This API initializes a default agent config.

This function fills the config with default reasonable values. We suggest to use the function to get the default values and then tweak values if necessary.

Note
this function does not update thingId and clientId at all.
Parameters
[in]configPointer to the config

◆ iotmiDev_Agent_new()

struct iotmiDev_Agent * iotmiDev_Agent_new ( const struct iotmiDev_Agent_Config *  config)

Create a device agent.

Note
A device agent should be created before calling other API functions.
Parameters
[in]configPointer to the configuration for the new agent.
Returns
Pointer to the created device agent, or NULL on failure.
See also
iotmiDev_Agent_free

◆ iotmiDev_Endpoint_getAgent()

struct iotmiDev_Agent * iotmiDev_Endpoint_getAgent ( const struct iotmiDev_Endpoint *  endpoint)

Get the agent which contains the given endpoint.

Parameters
[in]endpointPointer to the endpoint.
Warning
it's undefined if endpoint is NULL
Returns
Pointer to the agent

◆ iotmiDev_Endpoint_getId()

uint16_t iotmiDev_Endpoint_getId ( const struct iotmiDev_Endpoint *  endpoint)

Get the endpoint ID of an endpoint.

Parameters
[in]endpointPointer to the endpoint.
Warning
it's undefined if endpoint is NULL
Returns
The endpoint ID

◆ iotmiDev_Endpoint_getName()

const char * iotmiDev_Endpoint_getName ( const struct iotmiDev_Endpoint *  endpoint)

Get the endpoint Name of an endpoint.

Parameters
[in]endpointPointer to the endpoint.
Warning
it's undefined if endpoint is NULL
Returns
The endpoint name

◆ iotmiDev_Endpoint_registerClusterInfo()

iotmiDev_DMStatus iotmiDev_Endpoint_registerClusterInfo ( struct iotmiDev_Endpoint *  endpoint,
const struct iotmiDev_Agent_ClusterInfo *  info 
)

This API registers the necessary information for a cluster.

This registers the necessary cluster informat needed by the data model handler. It is supported to be called within the cluster register function provided in cluster-specific sources.

Note
This is not intended to be called by normal users. It should only be called by generated cluster-specific sources.
info->clusterSet's ownership is taken if the function succeeds.
Parameters
[in]endpointPointer to the endpoint.
[in]infoThe information for the cluster.
Returns
iotmiDev_DMStatusOk on success.