Morse Micro IoT SDK  2.11.2

Detailed Description

Data Structures

struct  mmagic_m2m_agent_init_args
 M2M initialization args. More...
 

Functions

struct mmagic_m2m_agent * mmagic_m2m_agent_init (const struct mmagic_m2m_agent_init_args *args)
 Initialize the M2M agent. More...
 
enum mmagic_status mmagic_m2m_agent_local_command (struct mmagic_m2m_agent *agent, void(*cb)(struct mmagic_data *core, void *arg), void *cb_arg, uint32_t timeout)
 Queue a callback to execute in the CONTROL_STREAM context. More...
 

Function Documentation

◆ mmagic_m2m_agent_init()

struct mmagic_m2m_agent * mmagic_m2m_agent_init ( const struct mmagic_m2m_agent_init_args args)

Initialize the M2M agent.

Note
this may block whilst the controller is notified that the agent has started.
Parameters
argsInitialization arguments.
Returns
A handle to the newly created Agent. NULL on error.

◆ mmagic_m2m_agent_local_command()

enum mmagic_status mmagic_m2m_agent_local_command ( struct mmagic_m2m_agent *  agent,
void(*)(struct mmagic_data *core, void *arg)  cb,
void *  cb_arg,
uint32_t  timeout 
)

Queue a callback to execute in the CONTROL_STREAM context.

This allows safe calling of mmagic_core_* functions outside of the MMAGIC stream. This may block on adding to the (single element) queue, and will return an error if the timeout is reached. It must only be called after mmagic_m2m_agent_init is run.

Parameters
agentAgent handle returned by mmagic_m2m_agent_init.
cbCallback function to execute. Receives MMAGIC core data and cb_arg.
cb_argArgument to pass to callback.
timeoutTimeout when enqueueing. UINT32_MAX to block.
Returns
MMAGIC_STATUS_OK on success, otherwise an error status.