Morse Micro IoT SDK  2.9.7
m2m_agent.c
Go to the documentation of this file.
1/*
2 * Copyright 2024 Morse Micro
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
18#include "mmosal.h"
19#include "mmutils.h"
20#include "mmagic.h"
21#include "mm_app_regdb.h"
22
23#if !defined(MBEDTLS_CONFIG_FILE)
24#include "mbedtls/mbedtls_config.h"
25#else
26#include MBEDTLS_CONFIG_FILE
27#endif
28#ifdef MBEDTLS_THREADING_ALT
29#include "threading_alt.h"
30#endif
31
32
33#ifndef APPLICATION_VERSION
34#error Please define APPLICATION_VERSION to an appropriate value.
35#endif
36
41void app_init(void)
42{
43 printf("\n\nM2M Agent Example (Built " __DATE__ " " __TIME__ ")\n\n");
44
45 /* Initialize mbedTLS threading (required if MBEDTLS_THREADING_ALT is defined) */
46#ifdef MBEDTLS_THREADING_ALT
47 mbedtls_platform_threading_init();
48#endif
49
50 const struct mmagic_m2m_agent_init_args init_args = {
51 .app_version = APPLICATION_VERSION,
52 .reg_db = get_regulatory_db(),
53 };
54 struct mmagic_m2m_agent *m2m_agent = mmagic_m2m_agent_init(&init_args);
55 MM_UNUSED(m2m_agent);
56 printf("M2M interface enabled\n");
57}
struct mmagic_m2m_agent * mmagic_m2m_agent_init(const struct mmagic_m2m_agent_init_args *args)
Initialize the M2M agent.
#define MM_UNUSED(_x)
Casts the given expression to void to avoid "unused" warnings from the compiler.
Definition: mmutils.h:69
void app_init(void)
Main entry point to the application.
Definition: m2m_agent.c:41
M2M initialization args.
Definition: mmagic.h:293
char app_version[MMAGIC_SYS_MAX_APP_VERSION_LENGTH+1]
Application version string.
Definition: mmagic.h:295